@arcgis/core 4.27.0-next.20230317 → 4.27.0-next.20230321

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 (300) hide show
  1. package/TimeExtent.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/05e47e78e258dd5ab6ea.js +1 -0
  4. package/assets/esri/core/workers/chunks/{b661d2c785333429aad3.js → 0b005e3502dd97562701.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{8812629e07e5bf46caa7.js → 1d2271a36641f6834401.js} +1 -1
  6. package/assets/esri/core/workers/chunks/1d65a2bc91774fdbd690.js +1 -0
  7. package/assets/esri/core/workers/chunks/273a894ab44b76ee4488.js +1 -0
  8. package/assets/esri/core/workers/chunks/29ee4f14602caf6967e4.js +1 -0
  9. package/assets/esri/core/workers/chunks/{56ddde83f40cda0a8a5c.js → 2c0775541cfec9d43acb.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{48a1b8be3c2a59c4c925.js → 32f9b488915a4a8864e5.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{790d62ea3c90ca076095.js → 403c18eaa30673b096fe.js} +1 -1
  12. package/assets/esri/core/workers/chunks/41bbf58417f4085657f4.js +1 -0
  13. package/assets/esri/core/workers/chunks/{c36efbdd0a84fe851bbb.js → 433686dfda9e2ff1f98b.js} +1 -1
  14. package/assets/esri/core/workers/chunks/4be7647605300e07e843.js +1 -0
  15. package/assets/esri/core/workers/chunks/5cc99e9e974fec32b597.js +1 -0
  16. package/assets/esri/core/workers/chunks/6062bc79ebd5047a473a.js +1 -0
  17. package/assets/esri/core/workers/chunks/{57aa75a10fb8bb3fa517.js → 622139ef8f7181e48cd0.js} +1 -1
  18. package/assets/esri/core/workers/chunks/6b14673a4afd6ef81487.js +1 -0
  19. package/assets/esri/core/workers/chunks/70ea44365021b665c213.js +1 -0
  20. package/assets/esri/core/workers/chunks/{7727e6a4338c831f272f.js → 7570ec6a64a88ddc0fdd.js} +1 -1
  21. package/assets/esri/core/workers/chunks/81a6f4b43e047c3395c0.js +1 -0
  22. package/assets/esri/core/workers/chunks/87edeb09a948122fa030.js +1 -0
  23. package/assets/esri/core/workers/chunks/8daa0523d49653cc5861.js +1 -0
  24. package/assets/esri/core/workers/chunks/{3ff3d67f1bc6e2b2f48e.js → 90e12cff7672f3d92ced.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{f150bd21c3b9e098da57.js → 92951b85676df776961f.js} +56 -56
  26. package/assets/esri/core/workers/chunks/983b26414cc46d9c3105.js +1 -0
  27. package/assets/esri/core/workers/chunks/{19355af765993931a7c0.js → 9b196a726c6d175ca60f.js} +1 -1
  28. package/assets/esri/core/workers/chunks/a27951dbe83c63f9d01a.js +1 -0
  29. package/assets/esri/core/workers/chunks/bc002e4dff8859571a7a.js +1 -0
  30. package/assets/esri/core/workers/chunks/bfc2b40f1892970281c6.js +1 -0
  31. package/assets/esri/core/workers/chunks/c162d1e27e779732d494.js +1 -0
  32. package/assets/esri/core/workers/chunks/c5d872adce711ec61ede.js +1 -0
  33. package/assets/esri/core/workers/chunks/c5dd23d11fa91b0f318e.js +1 -0
  34. package/assets/esri/core/workers/chunks/{e97c4beb3a6cf1d91310.js → c6c2f771bca0e303b5c0.js} +1 -1
  35. package/assets/esri/core/workers/chunks/c8f019d13f6b22481f2e.js +1 -0
  36. package/assets/esri/core/workers/chunks/d34dbb49508a95588423.js +1 -0
  37. package/assets/esri/core/workers/chunks/e637e47000f4dc48054d.js +1 -0
  38. package/assets/esri/core/workers/chunks/e7093d27a31345953dca.js +1 -0
  39. package/assets/esri/core/workers/chunks/f1ab86dbbd5b04e2a96c.js +1 -0
  40. package/assets/esri/core/workers/chunks/f85a01429959e60a8713.js +1 -0
  41. package/assets/esri/core/workers/chunks/ff9efa829497557ec26a.js +1 -0
  42. package/assets/esri/themes/base/widgets/_Bookmarks.scss +3 -0
  43. package/assets/esri/themes/base/widgets/_Editor.scss +18 -0
  44. package/assets/esri/themes/base/widgets/_ItemList.scss +13 -33
  45. package/assets/esri/themes/dark/main.css +1 -1
  46. package/assets/esri/themes/light/main.css +1 -1
  47. package/assets/esri/themes/light/view.css +1 -1
  48. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  49. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  50. package/assets/esri/widgets/Slice/t9n/Slice_ar.json +1 -1
  51. package/assets/esri/widgets/Slice/t9n/Slice_bg.json +1 -1
  52. package/assets/esri/widgets/Slice/t9n/Slice_bs.json +1 -1
  53. package/assets/esri/widgets/Slice/t9n/Slice_ca.json +1 -1
  54. package/assets/esri/widgets/Slice/t9n/Slice_cs.json +1 -1
  55. package/assets/esri/widgets/Slice/t9n/Slice_da.json +1 -1
  56. package/assets/esri/widgets/Slice/t9n/Slice_de.json +1 -1
  57. package/assets/esri/widgets/Slice/t9n/Slice_el.json +1 -1
  58. package/assets/esri/widgets/Slice/t9n/Slice_es.json +1 -1
  59. package/assets/esri/widgets/Slice/t9n/Slice_et.json +1 -1
  60. package/assets/esri/widgets/Slice/t9n/Slice_fi.json +1 -1
  61. package/assets/esri/widgets/Slice/t9n/Slice_fr.json +1 -1
  62. package/assets/esri/widgets/Slice/t9n/Slice_he.json +1 -1
  63. package/assets/esri/widgets/Slice/t9n/Slice_hr.json +1 -1
  64. package/assets/esri/widgets/Slice/t9n/Slice_hu.json +1 -1
  65. package/assets/esri/widgets/Slice/t9n/Slice_id.json +1 -1
  66. package/assets/esri/widgets/Slice/t9n/Slice_it.json +1 -1
  67. package/assets/esri/widgets/Slice/t9n/Slice_ja.json +1 -1
  68. package/assets/esri/widgets/Slice/t9n/Slice_ko.json +1 -1
  69. package/assets/esri/widgets/Slice/t9n/Slice_lt.json +1 -1
  70. package/assets/esri/widgets/Slice/t9n/Slice_lv.json +1 -1
  71. package/assets/esri/widgets/Slice/t9n/Slice_nb.json +1 -1
  72. package/assets/esri/widgets/Slice/t9n/Slice_nl.json +1 -1
  73. package/assets/esri/widgets/Slice/t9n/Slice_pl.json +1 -1
  74. package/assets/esri/widgets/Slice/t9n/Slice_pt-BR.json +1 -1
  75. package/assets/esri/widgets/Slice/t9n/Slice_pt-PT.json +1 -1
  76. package/assets/esri/widgets/Slice/t9n/Slice_ro.json +1 -1
  77. package/assets/esri/widgets/Slice/t9n/Slice_ru.json +1 -1
  78. package/assets/esri/widgets/Slice/t9n/Slice_sk.json +1 -1
  79. package/assets/esri/widgets/Slice/t9n/Slice_sl.json +1 -1
  80. package/assets/esri/widgets/Slice/t9n/Slice_sr.json +1 -1
  81. package/assets/esri/widgets/Slice/t9n/Slice_sv.json +1 -1
  82. package/assets/esri/widgets/Slice/t9n/Slice_th.json +1 -1
  83. package/assets/esri/widgets/Slice/t9n/Slice_tr.json +1 -1
  84. package/assets/esri/widgets/Slice/t9n/Slice_uk.json +1 -1
  85. package/assets/esri/widgets/Slice/t9n/Slice_vi.json +1 -1
  86. package/assets/esri/widgets/Slice/t9n/Slice_zh-CN.json +1 -1
  87. package/assets/esri/widgets/Slice/t9n/Slice_zh-HK.json +1 -1
  88. package/assets/esri/widgets/Slice/t9n/Slice_zh-TW.json +1 -1
  89. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ar.json +1 -1
  90. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bg.json +1 -1
  91. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bs.json +1 -1
  92. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ca.json +1 -1
  93. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_cs.json +1 -1
  94. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_da.json +1 -1
  95. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_de.json +1 -1
  96. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_el.json +1 -1
  97. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_es.json +1 -1
  98. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_et.json +1 -1
  99. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fi.json +1 -1
  100. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fr.json +1 -1
  101. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_he.json +1 -1
  102. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hr.json +1 -1
  103. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hu.json +1 -1
  104. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_id.json +1 -1
  105. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_it.json +1 -1
  106. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ja.json +1 -1
  107. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ko.json +1 -1
  108. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lt.json +1 -1
  109. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lv.json +1 -1
  110. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nb.json +1 -1
  111. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nl.json +1 -1
  112. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pl.json +1 -1
  113. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-BR.json +1 -1
  114. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-PT.json +1 -1
  115. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ro.json +1 -1
  116. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ru.json +1 -1
  117. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sk.json +1 -1
  118. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sl.json +1 -1
  119. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sr.json +1 -1
  120. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sv.json +1 -1
  121. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_th.json +1 -1
  122. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_tr.json +1 -1
  123. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_uk.json +1 -1
  124. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_vi.json +1 -1
  125. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-CN.json +1 -1
  126. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-HK.json +1 -1
  127. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-TW.json +1 -1
  128. package/chunks/ColorMaterial.glsl.js +16 -14
  129. package/core/domUtils.js +1 -1
  130. package/core/maybe.js +1 -1
  131. package/core/urlUtils.js +1 -1
  132. package/geohash/GeohashTree.js +1 -1
  133. package/interfaces.d.ts +12 -214
  134. package/layers/SceneLayer.js +1 -1
  135. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  136. package/layers/support/FieldsIndex.js +1 -1
  137. package/layers/support/fieldType.js +1 -1
  138. package/layers/support/fieldUtils.js +1 -1
  139. package/layers/support/rasterFunctionConstants.js +1 -1
  140. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  141. package/layers/support/rasterFunctions/CurvatureFunction.js +5 -0
  142. package/layers/support/rasterFunctions/CurvatureFunctionArguments.js +5 -0
  143. package/layers/support/rasterFunctions/SlopeFunction.js +1 -1
  144. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  145. package/layers/support/rasterFunctions/surfaceUtils.js +1 -1
  146. package/package.json +1 -1
  147. package/portal/schemas/definitions.js +1 -1
  148. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  149. package/support/revision.js +1 -1
  150. package/views/2d/engine/imagery/processor/curvatureProcessor.js +5 -0
  151. package/views/2d/engine/imagery/processor/rasterProcessor.js +1 -1
  152. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  153. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  154. package/views/2d/layers/features/support/BinStore.js +1 -1
  155. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  156. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  157. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  158. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  159. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  160. package/views/2d/layers/features/support/FeatureSetReaderPBFIndirect.js +1 -1
  161. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  162. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  163. package/views/3d/environment/CloudsData.js +1 -1
  164. package/views/3d/environment/CloudsGenerator.js +1 -1
  165. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  166. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  167. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  168. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
  169. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  170. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  171. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  172. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  173. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  174. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  175. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  176. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  177. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  178. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  179. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  180. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  181. package/views/3d/layers/graphics/interfaces.js +1 -1
  182. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  183. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  184. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  185. package/views/3d/support/buffer/glUtil.js +1 -1
  186. package/views/3d/support/buffer/workerHelper.js +1 -1
  187. package/views/3d/support/engineContent/line.js +1 -1
  188. package/views/3d/terrain/PatchRenderData.js +1 -1
  189. package/views/3d/terrain/TerrainSurface.js +1 -1
  190. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +2 -2
  191. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  192. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  193. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  194. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  195. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  196. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  197. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  198. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  199. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  200. package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
  201. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  202. package/views/interactive/tooltip/TransformTooltipInfos.js +1 -1
  203. package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
  204. package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
  205. package/widgets/Bookmarks/css.js +1 -1
  206. package/widgets/Bookmarks.js +1 -1
  207. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  208. package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
  209. package/widgets/Editor/EditorViewModel.js +1 -1
  210. package/widgets/Editor/Upload.js +5 -0
  211. package/widgets/Editor/UploadState.js +4 -0
  212. package/widgets/Editor/workflowUtils.js +1 -1
  213. package/widgets/Editor.js +1 -1
  214. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  215. package/widgets/FeatureForm/{InputField.js → FieldInput.js} +1 -1
  216. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  217. package/widgets/FeatureForm/GroupInput.js +5 -0
  218. package/widgets/FeatureForm/css.js +1 -1
  219. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  220. package/widgets/FeatureForm.js +1 -1
  221. package/widgets/FeatureTable/FieldColumn.js +1 -1
  222. package/widgets/FeatureTemplates/ItemList.js +1 -1
  223. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  224. package/widgets/FeatureTemplates.js +1 -1
  225. package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
  226. package/widgets/LayerList/LayerListViewModel.js +1 -1
  227. package/widgets/LayerList.js +1 -1
  228. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  229. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  230. package/assets/esri/core/workers/chunks/009348f65fab440f7752.js +0 -1
  231. package/assets/esri/core/workers/chunks/075ecd53fb229dfee53c.js +0 -1
  232. package/assets/esri/core/workers/chunks/1c77b92063ee36421914.js +0 -1
  233. package/assets/esri/core/workers/chunks/1ee774c3f29d8074da12.js +0 -1
  234. package/assets/esri/core/workers/chunks/262b6de5a29c713b4010.js +0 -1
  235. package/assets/esri/core/workers/chunks/281c0f936b5645a673ab.js +0 -1
  236. package/assets/esri/core/workers/chunks/2883a59fc1fc9e4d71af.js +0 -1
  237. package/assets/esri/core/workers/chunks/2e032a58ac6717313227.js +0 -1
  238. package/assets/esri/core/workers/chunks/4d4cbfe72835c0460b09.js +0 -1
  239. package/assets/esri/core/workers/chunks/5504dff4113dd74d2fa7.js +0 -1
  240. package/assets/esri/core/workers/chunks/5bded2588008117d0c35.js +0 -1
  241. package/assets/esri/core/workers/chunks/6caf8a0b49bd01906f32.js +0 -1
  242. package/assets/esri/core/workers/chunks/9cab04c71d8bccf0156d.js +0 -1
  243. package/assets/esri/core/workers/chunks/9f02a0670ad73718d8f9.js +0 -1
  244. package/assets/esri/core/workers/chunks/a265e454461edb306e2d.js +0 -1
  245. package/assets/esri/core/workers/chunks/a50ca44a62434bf18664.js +0 -1
  246. package/assets/esri/core/workers/chunks/bd090f9ec6cfe08e19a3.js +0 -1
  247. package/assets/esri/core/workers/chunks/c3338bdce8368731c4e9.js +0 -1
  248. package/assets/esri/core/workers/chunks/c54df59b2b3f73828a44.js +0 -1
  249. package/assets/esri/core/workers/chunks/ddebf3b5a131a6da5419.js +0 -1
  250. package/assets/esri/core/workers/chunks/de461c30aa24ec8bb212.js +0 -1
  251. package/assets/esri/core/workers/chunks/e23f56bee694a38da5b9.js +0 -1
  252. package/assets/esri/core/workers/chunks/ec73d16ef169adfc34fb.js +0 -1
  253. package/assets/esri/core/workers/chunks/ef884e2833868234c13c.js +0 -1
  254. package/assets/esri/core/workers/chunks/f3c99525fb1b0f719fe0.js +0 -1
  255. package/assets/esri/core/workers/chunks/fe314feede84dd688010.js +0 -1
  256. package/assets/esri/core/workers/chunks/ff15557dc7b74162ed75.js +0 -1
  257. package/assets/esri/widgets/Directions/t9n/Printout.json +0 -1
  258. package/assets/esri/widgets/Directions/t9n/Printout_ar.json +0 -1
  259. package/assets/esri/widgets/Directions/t9n/Printout_bg.json +0 -1
  260. package/assets/esri/widgets/Directions/t9n/Printout_bs.json +0 -1
  261. package/assets/esri/widgets/Directions/t9n/Printout_ca.json +0 -1
  262. package/assets/esri/widgets/Directions/t9n/Printout_cs.json +0 -1
  263. package/assets/esri/widgets/Directions/t9n/Printout_da.json +0 -1
  264. package/assets/esri/widgets/Directions/t9n/Printout_de.json +0 -1
  265. package/assets/esri/widgets/Directions/t9n/Printout_el.json +0 -1
  266. package/assets/esri/widgets/Directions/t9n/Printout_en.json +0 -1
  267. package/assets/esri/widgets/Directions/t9n/Printout_es.json +0 -1
  268. package/assets/esri/widgets/Directions/t9n/Printout_et.json +0 -1
  269. package/assets/esri/widgets/Directions/t9n/Printout_fi.json +0 -1
  270. package/assets/esri/widgets/Directions/t9n/Printout_fr.json +0 -1
  271. package/assets/esri/widgets/Directions/t9n/Printout_he.json +0 -1
  272. package/assets/esri/widgets/Directions/t9n/Printout_hr.json +0 -1
  273. package/assets/esri/widgets/Directions/t9n/Printout_hu.json +0 -1
  274. package/assets/esri/widgets/Directions/t9n/Printout_id.json +0 -1
  275. package/assets/esri/widgets/Directions/t9n/Printout_it.json +0 -1
  276. package/assets/esri/widgets/Directions/t9n/Printout_ja.json +0 -1
  277. package/assets/esri/widgets/Directions/t9n/Printout_ko.json +0 -1
  278. package/assets/esri/widgets/Directions/t9n/Printout_lt.json +0 -1
  279. package/assets/esri/widgets/Directions/t9n/Printout_lv.json +0 -1
  280. package/assets/esri/widgets/Directions/t9n/Printout_nb.json +0 -1
  281. package/assets/esri/widgets/Directions/t9n/Printout_nl.json +0 -1
  282. package/assets/esri/widgets/Directions/t9n/Printout_pl.json +0 -1
  283. package/assets/esri/widgets/Directions/t9n/Printout_pt-BR.json +0 -1
  284. package/assets/esri/widgets/Directions/t9n/Printout_pt-PT.json +0 -1
  285. package/assets/esri/widgets/Directions/t9n/Printout_ro.json +0 -1
  286. package/assets/esri/widgets/Directions/t9n/Printout_ru.json +0 -1
  287. package/assets/esri/widgets/Directions/t9n/Printout_sk.json +0 -1
  288. package/assets/esri/widgets/Directions/t9n/Printout_sl.json +0 -1
  289. package/assets/esri/widgets/Directions/t9n/Printout_sr.json +0 -1
  290. package/assets/esri/widgets/Directions/t9n/Printout_sv.json +0 -1
  291. package/assets/esri/widgets/Directions/t9n/Printout_th.json +0 -1
  292. package/assets/esri/widgets/Directions/t9n/Printout_tr.json +0 -1
  293. package/assets/esri/widgets/Directions/t9n/Printout_uk.json +0 -1
  294. package/assets/esri/widgets/Directions/t9n/Printout_vi.json +0 -1
  295. package/assets/esri/widgets/Directions/t9n/Printout_zh-CN.json +0 -1
  296. package/assets/esri/widgets/Directions/t9n/Printout_zh-HK.json +0 -1
  297. package/assets/esri/widgets/Directions/t9n/Printout_zh-TW.json +0 -1
  298. package/widgets/FeatureForm/InputField.d.ts +0 -4
  299. package/widgets/FeatureForm/InputFieldGroup.d.ts +0 -4
  300. package/widgets/FeatureForm/InputFieldGroup.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Evented.js";import i from"../../../core/Handles.js";import{destroyMaybe as n,mapOr as s}from"../../../core/maybe.js";import{after as o}from"../../../core/promiseUtils.js";import{watch as a,sync as h,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{s as p,g as _,c as u,h as m}from"../../../chunks/vec3.js";import{c as f,f as g}from"../../../chunks/vec3f64.js";import{b as P,f as v}from"../../../chunks/vec4f64.js";import{canProjectToWGS84ComparableLonLat as b,projectPointToWGS84ComparableLonLat as w}from"../../../geometry/projection.js";import{isEarth as C}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as y}from"../../ViewingMode.js";import{EnvironmentRenderer as U}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as T}from"../support/earthUtils.js";import{computeColorAndIntensity as R,computeVirtualLightDirection as S,ColorAndIntensity as M,computeShadowsEnabled as H}from"../support/sunUtils.js";import{Update as W}from"../webgl-engine/lib/Update.js";import{MainLight as G,AmbientLight as j,FillLight as L}from"../webgl-engine/lighting/Lightsources.js";import k from"../../../webscene/background/ColorBackground.js";let E=class extends r.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandles=new i,this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new G,this._ambientLight=new j,this._moonLight=new L,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView(),this._viewHandles.destroy()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===y.Global&&C(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new U({view:e});const t=()=>this._updateRenderParameters(),r=()=>this._cameraHandler();this._viewHandles.add([a((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),h),a((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),h),a((()=>e.stationary),(()=>this._interactingStationaryHandler())),a((()=>e.environment.lighting.directShadowsEnabled),t,h),a((()=>e.environment.lighting.ambientOcclusionEnabled),t,h),a((()=>e.environment.lighting.waterReflectionEnabled),t,h),a((()=>e.environment.background?.color),t,h),a((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),h),a((()=>e.environment.weather.type),(()=>this._updateLighting(null,W.Faded)),h),a((()=>this.weatherEnabled),(()=>this._updateLighting(null,W.Faded)),h),a((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),c),a((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),c),a((()=>e.state.camera),r,c),a((()=>this.disableQueries),r)]),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this._viewHandles.removeAll(),this._resetReferencePosition(),this._renderer=n(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!b(r)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),null!=this._referencePosWGS84Comparable){const e=T(this._referencePosWGS84Comparable,A);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const r=t.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,t){const r=C(this._view.spatialReference);if(r&&!b(this._view.spatialReference))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const i=e.position;return null==this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable=f()),r?w(i,this._referencePosWGS84Comparable):p(this._referencePosWGS84Comparable,i.longitude??0,i.latitude??0,i.z??0),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=(t.z??0)*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,t=W.Immediate){const r=this._view;e=e||("virtual"===r.environment.lighting.type?null:r.environment.lighting.date);const i=this._referencePosWGS84Comparable,n=null!=i?Q:D,s=this.weatherVisible?r.environment.weather.type:"disabled";null!=i?R(e,i,r.state.viewingMode,s,r.state.camera,n):"virtual"===r.environment.lighting.type&&S(r.state.camera,r.state.viewingMode,n.direct.directionToLightSource);const o=this._mainLight,a=n.direct;_(o.intensity,a.color,a.intensity*Math.PI),u(o.direction,a.directionToLightSource),o.specularStrength=n.specularStrength,o.environmentStrength=n.environmentStrength;const h=this._ambientLight;_(h.intensity,n.ambient.color,n.ambient.intensity);const c=this._moonLight;m(c.intensity,I,V,n.globalFactor);const d=(1-.5*n.globalFactor)*(1-.4*n.noonFactor*(1-n.globalFactor));_(c.intensity,c.intensity,d),u(c.direction,a.directionToLightSource),this._renderer.updateLightSources([o,h,c],n.noonFactor,n.globalFactor,t),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const r=q;r.setTime((t||this._view.environment.lighting.date).getTime());const i=T(e,A);if(null==i)return!1;let n=this._view.environment.lighting.positionTimezoneInfo;if(n.autoUpdated){if(n.hours===i.hours&&n.minutes===i.minutes&&n.seconds===i.seconds)return!1}else n=i;const s=r.getUTCHours()-(i.hours-n.hours),o=r.getUTCMinutes()-(i.minutes-n.minutes),a=r.getUTCSeconds()-(i.seconds-n.seconds);return r.setUTCHours(s),r.setUTCMinutes(o),r.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(r,i)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const r=s(this._referencePosWGS84Comparable,!0,(e=>H(e[2],this._view.state.viewingMode))),i=this._view.environment.background,n=i instanceof k?{type:"color",color:P(t.toUnitRGBA(i.color))}:{type:"color",color:v(0,0,0,1)};e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&r,background:n,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=o(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=o(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(t[0])&&!isNaN(t[1])){const e=(this._referencePosMapCoords.z??0)*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=t[0],this._referencePosWGS84Comparable[1]=t[1],this._referencePosWGS84Comparable[2]=e):this._referencePosWGS84Comparable=[t[0],t[1],e],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let t=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(t*=this._view.mapCoordsHelper.unitInMeters),t>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(t){e._referencePointUpdateInterval=t},set referencePointUpdateDistThreshold(t){e._referencePointUpdateDistThreshold=t},set referencePosUpdateTimer(t){e._referencePosUpdateTimer=t},set referencePointUpdateDelay(t){e._referencePointUpdateDelay=t},set disableWeather(t){e._disableWeather=t}}}};e([d({type:Boolean,readOnly:!0})],E.prototype,"updating",null),e([d()],E.prototype,"disableQueries",void 0),e([d()],E.prototype,"_disableWeather",void 0),e([d()],E.prototype,"weatherEnabled",null),e([d()],E.prototype,"weatherVisible",null),e([d()],E.prototype,"referencePositionWGS84Comparable",null),e([d()],E.prototype,"_renderer",void 0),e([d()],E.prototype,"_referencePosWGS84Comparable",void 0),E=e([l("esri.views.3d.environment.SceneViewEnvironmentManager")],E);const Q=new M,D=new M,q=new Date,A={hours:0,minutes:0,seconds:0},I=g(.22,.22,.33),V=g(.22,.22,.22);export{E as SceneViewEnvironmentManager};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Evented.js";import i from"../../../core/Handles.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{after as s}from"../../../core/promiseUtils.js";import{watch as o,sync as a,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{s as d,g as p,c as _,h as u}from"../../../chunks/vec3.js";import{c as m,f}from"../../../chunks/vec3f64.js";import{b as g,f as P}from"../../../chunks/vec4f64.js";import{canProjectToWGS84ComparableLonLat as v,projectPointToWGS84ComparableLonLat as b}from"../../../geometry/projection.js";import{isEarth as w}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as C}from"../../ViewingMode.js";import{EnvironmentRenderer as y}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as U}from"../support/earthUtils.js";import{computeColorAndIntensity as T,computeVirtualLightDirection as R,computeShadowsEnabled as S,ColorAndIntensity as M}from"../support/sunUtils.js";import{Update as W}from"../webgl-engine/lib/Update.js";import{MainLight as H,AmbientLight as G,FillLight as j}from"../webgl-engine/lighting/Lightsources.js";import L from"../../../webscene/background/ColorBackground.js";let k=class extends r.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandles=new i,this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new H,this._ambientLight=new G,this._moonLight=new j,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView(),this._viewHandles.destroy()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===C.Global&&w(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new y({view:e});const t=()=>this._updateRenderParameters(),r=()=>this._cameraHandler();this._viewHandles.add([o((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),a),o((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),a),o((()=>e.stationary),(()=>this._interactingStationaryHandler())),o((()=>e.environment.lighting.directShadowsEnabled),t,a),o((()=>e.environment.lighting.ambientOcclusionEnabled),t,a),o((()=>e.environment.lighting.waterReflectionEnabled),t,a),o((()=>e.environment.background?.color),t,a),o((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),a),o((()=>e.environment.weather.type),(()=>this._updateLighting(null,W.Faded)),a),o((()=>this.weatherEnabled),(()=>this._updateLighting(null,W.Faded)),a),o((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),h),o((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),h),o((()=>e.state.camera),r,h),o((()=>this.disableQueries),r)]),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this._viewHandles.removeAll(),this._resetReferencePosition(),this._renderer=n(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!v(r)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),null!=this._referencePosWGS84Comparable){const e=U(this._referencePosWGS84Comparable,q);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const r=t.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,t){const r=w(this._view.spatialReference);if(r&&!v(this._view.spatialReference))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const i=e.position;return null==this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable=m()),r?b(i,this._referencePosWGS84Comparable):d(this._referencePosWGS84Comparable,i.longitude??0,i.latitude??0,i.z??0),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=(t.z??0)*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,t=W.Immediate){const r=this._view;e=e||("virtual"===r.environment.lighting.type?null:r.environment.lighting.date);const i=this._referencePosWGS84Comparable,n=null!=i?E:Q,s=this.weatherVisible?r.environment.weather.type:"disabled";null!=i?T(e,i,r.state.viewingMode,s,r.state.camera,n):"virtual"===r.environment.lighting.type&&R(r.state.camera,r.state.viewingMode,n.direct.directionToLightSource);const o=this._mainLight,a=n.direct;p(o.intensity,a.color,a.intensity*Math.PI),_(o.direction,a.directionToLightSource),o.specularStrength=n.specularStrength,o.environmentStrength=n.environmentStrength;const h=this._ambientLight;p(h.intensity,n.ambient.color,n.ambient.intensity);const c=this._moonLight;u(c.intensity,A,I,n.globalFactor);const l=(1-.5*n.globalFactor)*(1-.4*n.noonFactor*(1-n.globalFactor));p(c.intensity,c.intensity,l),_(c.direction,a.directionToLightSource),this._renderer.updateLightSources([o,h,c],n.noonFactor,n.globalFactor,t),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const r=D;r.setTime((t||this._view.environment.lighting.date).getTime());const i=U(e,q);if(null==i)return!1;let n=this._view.environment.lighting.positionTimezoneInfo;if(n.autoUpdated){if(n.hours===i.hours&&n.minutes===i.minutes&&n.seconds===i.seconds)return!1}else n=i;const s=r.getUTCHours()-(i.hours-n.hours),o=r.getUTCMinutes()-(i.minutes-n.minutes),a=r.getUTCSeconds()-(i.seconds-n.seconds);return r.setUTCHours(s),r.setUTCMinutes(o),r.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(r,i)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const r=null==this._referencePosWGS84Comparable||S(this._referencePosWGS84Comparable[2],this._view.state.viewingMode),i=this._view.environment.background,n=i instanceof L?{type:"color",color:g(t.toUnitRGBA(i.color))}:{type:"color",color:P(0,0,0,1)};e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&r,background:n,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=s(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=s(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(t[0])&&!isNaN(t[1])){const e=(this._referencePosMapCoords.z??0)*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=t[0],this._referencePosWGS84Comparable[1]=t[1],this._referencePosWGS84Comparable[2]=e):this._referencePosWGS84Comparable=[t[0],t[1],e],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let t=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(t*=this._view.mapCoordsHelper.unitInMeters),t>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(t){e._referencePointUpdateInterval=t},set referencePointUpdateDistThreshold(t){e._referencePointUpdateDistThreshold=t},set referencePosUpdateTimer(t){e._referencePosUpdateTimer=t},set referencePointUpdateDelay(t){e._referencePointUpdateDelay=t},set disableWeather(t){e._disableWeather=t}}}};e([c({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([c()],k.prototype,"disableQueries",void 0),e([c()],k.prototype,"_disableWeather",void 0),e([c()],k.prototype,"weatherEnabled",null),e([c()],k.prototype,"weatherVisible",null),e([c()],k.prototype,"referencePositionWGS84Comparable",null),e([c()],k.prototype,"_renderer",void 0),e([c()],k.prototype,"_referencePosWGS84Comparable",void 0),k=e([l("esri.views.3d.environment.SceneViewEnvironmentManager")],k);const E=new M,Q=new M,D=new Date,q={hours:0,minutes:0,seconds:0},A=f(.22,.22,.33),I=f(.22,.22,.22);export{k as SceneViewEnvironmentManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{cyclicalPI as t}from"../../../../../core/Cyclical.js";import e from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{clamp as i,rad2deg as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{createAngle as s,createLength as r}from"../../../../../core/quantityUtils.js";import{when as l,initial as c,watch as h}from"../../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../../core/scheduling.js";import{createScreenPointArray as u}from"../../../../../core/screenUtils.js";import{d,E as g,m,k as _,e as f}from"../../../../../chunks/mat4.js";import{c as D}from"../../../../../chunks/mat4f64.js";import{s as S,b as M,l as v,d as y,f as b,a as w}from"../../../../../chunks/vec3.js";import{a as T,f as R}from"../../../../../chunks/vec3f64.js";import{b as j}from"../../../../../chunks/vec4f64.js";import{fromPositionAndNormal as O,create as I,normal as A}from"../../../../../geometry/support/plane.js";import{wrap as k,distance2 as E}from"../../../../../geometry/support/ray.js";import{sv3d as F,sm4d as P}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as C}from"../../../../../support/elevationInfoUtils.js";import{Manipulator3D as U}from"../../Manipulator3D.js";import{calculateInputRotationTransform as z}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as x}from"../dragEventPipeline3D.js";import{ManipulatorType as N}from"../ManipulatorType.js";import{RING_INDICATOR_DELAY_MS as H,ROTATE_INDICATOR_DIRECTION_BUFFER as V,SCALE_INDICATOR_DIRECTION_BUFFER as q,ROTATE_INDICATOR_ARROW_PLACEMENT_PERCENTAGE as B,RING_THICKNESS as G,HANDLE_COLOR as J,DRAG_THRESHOLD_PX as K,RING_RADIUS as Q,INNER_INDICATOR_RADIUS as W,OUTER_INDICATOR_RADIUS as X,RING_HEIGHT as Y,ROTATE_INDICATOR_ARROW_TIP_RADIUS as Z,ROTATE_INDICATOR_ARROW_TIP_LENGTH as $,SCALE_INDICATOR_OFFSET1 as tt,SCALE_INDICATOR_OFFSET2 as et,INDICATOR_THICKNESS as at,GEOMETRY_SEGMENTS as it,ROTATE_INDICATOR_ARC_LENGTH as ot,RING_RESET_ANIMATION_SPEED_FACTOR as nt,SCALE_INDICATOR_ARC_LENGTH as st}from"../manipulations/config.js";import{CullFaceOptions as rt}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as lt,transformInPlace as ct,createPathExtrusionGeometry as ht}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as pt}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as ut}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as dt}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as gt,ManipulatorStateFlags as mt}from"../../../../interactive/interfaces.js";import{Tooltip as _t}from"../../../../interactive/tooltip/Tooltip.js";import{TransformRotateTooltipInfo as ft,TransformScaleTooltipInfo as Dt,TransformAbsoluteTooltipInfo as St}from"../../../../interactive/tooltip/TransformTooltipInfos.js";var Mt,vt;!function(t){t.ScaleIn=gt.Custom2,t.ScaleOut=gt.Custom3,t.RotateLeft=gt.Custom4,t.RotateRight=gt.Custom5,t.Unlocked=gt.Custom7,t.DelayedFocused=gt.Custom8,t.TouchInput=gt.Custom12}(Mt||(Mt={}));class yt{get angle(){return this._adapter.angle}get scale(){return this._adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}constructor({adapter:t,tooltipOptions:i,mode:o,tool:n}){this._mode=null,this._handles=new a,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new e,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>null!=this._scaleRotateDragData&&"scale"===this._scaleRotateDragData.mode?this._adapter.scale:1,this.tool=n,this._mode=o,this._adapter=t,this._tooltipOptions=i,this._tooltip=new _t({view:n.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this._handles.add(l((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),c))}destroy(){null!=this._activeAnimation&&(this._activeAnimation.frameTask.remove(),this._activeAnimation=null),this._handles=n(this._handles),this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this._tooltip=n(this._tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=p({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){null!=this._activeAnimation&&(this._activeAnimation.frameTask.remove(),this._activeAnimation=n(this._activeAnimation))}forEachManipulator(t){t(this._ringManipulator,N.SCALE_ROTATE)}_createManipulator(){const e=this._createRingManipulator();this._ringManipulator=e,this.tool.manipulators.add(e);const a=this.tool.graphicState.graphic,n=dt(e,((e,n,s)=>{this._scaleRotateDragData=null;const r=this._adapter.startInteraction(),l={mode:"none",origin:T(e.renderLocation),initialAngle:this._adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=F.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(e.renderLocation,c),n.next(x(this.tool.view,O(e.renderLocation,c,I()))).next((e=>{const n=A(e.plane),s=z(e.renderStart,e.renderEnd,l.origin,n),c=t.shortestSignedDiff(l.angle,s);l.angleDir=i(l.angleDir+c,-V,V),l.angle=s;const h=bt(l,e),p=h-this._adapter.scale;if(l.scaleDir=i(l.scaleDir+p,-q,q),this._onScaleChanged(),"none"===l.mode){const t=this._mode||wt(e,e.plane,l.origin,this.tool.view.state.camera);if(null!=t){switch(t){case"rotate":this.tool.emit("graphic-rotate-start",{graphic:a,angle:0}),this.tool.emit("record-undo",{record:this._adapter.createUndoRecord()});break;case"scale":this.tool.emit("graphic-scale-start",{graphic:a,xScale:1,yScale:1}),this.tool.emit("record-undo",{record:this._adapter.createUndoRecord()})}l.mode=t}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+s;break;case"scale":r.state.scale=h,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),e.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.emit("graphic-rotate",{graphic:a,angle:o(l.angle)});break;case"scale":this.tool.emit("graphic-scale",{graphic:a,xScale:h,yScale:h})}break;case"end":switch(l.mode){case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:o(l.angle)});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:h,yScale:h})}}return"end"===e.action&&(this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),e})).next(this._updateTooltipPipelineStep(l)),s.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:0});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:1,yScale:1})}this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this._handles.add([n,e.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(jt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),e.events.on("immediate-click",(t=>{t.stopPropagation()})),h((()=>this.tool.graphicState?.displaying),(t=>this._ringManipulator.available=t),c)])}_updateTooltipPipelineStep(t){return e=>{const a=this._tooltipOptions;if(!a.enabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const i=this._tooltip,o=this._tooltipOptions.visualVariables,n=null!=o?o.size:null,l=null!=o?o.rotation:null;switch(t.mode){case"scale":i.info=new Dt({tooltipOptions:a,scale:{value:this._adapter.scale},size:r(this._adapter.size??-1,"meters"),sizeUnit:null!=n?n.unit:null,sizePrecision:null!=n?Ot(n.valueType):null});break;case"rotate":{const t=null!=l?Ot(l.valueType):null,e=null!=l?l.rotationType:"geographic";i.info=new ft({tooltipOptions:a,rotation:s(-(this._adapter.relativeAngle??0),"radians","geographic"),rotationPrecision:t,orientation:s(-this._adapter.angle,"radians","geographic"),orientationPrecision:t,rotationType:e})}}return e}}_updateFocusTooltip(){if(!this._tooltipOptions.enabled)return;if(this.getFocused()){const t=this._tooltipOptions.visualVariables,e=null!=t?t.rotation:null,a=null!=t?t.size:null;this._tooltip.info=new St({tooltipOptions:this._tooltipOptions,orientation:s(-this._adapter.angle,"radians","geographic"),orientationEnabled:null==this._mode||"rotate"===this._mode,orientationPrecision:null!=e?Ot(e.valueType):null,rotationType:null!=e?e.rotationType:"geographic",size:r(this._adapter.size??-1,"meters"),sizeUnit:null!=a?a.unit:null,sizeEnabled:null==this._mode||"scale"===this._mode,sizePrecision:null!=a?Ot(a.valueType):null})}else this._tooltip.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=d(P.get(),this._adapter.angle,R(0,0,1));if(null==t)return;const e=this.getScale(),a=g(P.get(),S(F.get(),e,e,e));this._ringManipulator.modelTransform=m(P.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const i=[],o=Math.ceil(it*(e-t)/(2*Math.PI));for(let n=0;n<o+1;n++){const s=t+n*(e-t)/o;i.push(R(a*Math.cos(s),a*Math.sin(s),0))}return i},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,Y/2],[-t/2,Y/2]],i=this._createMaterial(1),o=(t,e,o=i)=>ht(o,a(e),t,[],[],!1),n=e(Q),s=o(n,G),r={left:new Array,right:new Array},l=[];for(let R=0;R<2;R++){const e=R*Math.PI-Math.PI/4,a=Math.PI/2-ot,n=e+a,s=e+Math.PI/2-a,c=t(n,s,W),h=o(c,at);l.push(c),l.push(t(n,s,X-G/2)),r.left.push(h),r.right.push(h.instantiate());for(let t=0;t<2;t++){const e=0===t,a=D();if(e){_(a,a,[1,-1,1]),f(a,a,-n,[0,0,1]);const t=Math.round(B*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{f(a,a,s,[0,0,1]);const t=Math.round((1-B)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const o=lt(i,$,0,Z,Y);ct(o,a),(e?r.left:r.right).push(o)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-st,i=e+a,n=e+Math.PI/2-a,s=t(i,n,X);c.push(o(s,at))}const h=this._createMaterial(.66),p=this._createMaterial(.5),u=this._createMaterial(.33),d=e(Q+tt),g=e(Q+et),m=o(d,at,h),S=o(g,at,u),M=e(Q-tt),v=e(Q-et),y=o(M,at,h),b=o(v,at,u);let w=[new L(s,Mt.DelayedFocused),new L(s.instantiate({material:p}),mt.None)];this._mode&&"scale"!==this._mode||(w=w.concat([...c.map((t=>new L(t,Mt.DelayedFocused|Mt.Unlocked))),new L(m,Mt.DelayedFocused|Mt.ScaleIn),new L(S,Mt.DelayedFocused|Mt.ScaleIn),new L(y,Mt.DelayedFocused|Mt.ScaleOut),new L(b,Mt.DelayedFocused|Mt.ScaleOut)])),this._mode&&"rotate"!==this._mode||(w=w.concat([...r.right.map((t=>new L(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new L(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new L(t,Mt.DelayedFocused|Mt.RotateRight)))]));const T=[n,...l];return new U({view:this.tool.view,renderObjects:w,autoScaleRenderObjects:!1,worldOriented:!0,radius:G,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:C(this.tool.graphicState.graphic),collisionType:{type:"ribbon",paths:T,direction:R(0,0,1)}})}_createMaterial(t){const e=j([...J,t]);return new ut({color:e,transparent:1!==t,cullFace:rt.Back,renderOccluded:pt.Transparent})}get test(){return{ringManipulator:this._ringManipulator,setRingIndicatorDelayMs:t=>this._ringIndicatorDelayMs=t,tooltip:this._tooltip}}}function bt(t,e){const a=M(F.get(),e.renderStart,t.origin),i=M(F.get(),e.renderEnd,t.origin),o=v(a),n=v(i);return 0===o?0:n/o}function wt(t,e,a,i){const{renderStart:o,renderEnd:n}=t,s=Tt(o,i,F.get()),r=Tt(n,i,F.get());if(y(s,r)<K*K)return null;const l=M(F.get(),o,a),c=b(F.get(),l,A(e)),h=o,p=w(F.get(),h,c),u=Tt(a,i,F.get()),d=s,g=Tt(p,i,F.get()),m=M(F.get(),g,d),_=M(F.get(),s,u),f=k(d,m),D=k(u,_);return E(f,r)<E(D,r)?"rotate":"scale"}function Tt(t,e,a){return e.projectToScreen(t,It),S(a,It[0],It[1],0)}function Rt(t,e){let a=null,i=1;const o=()=>i;return{start:()=>{i=t.getScale(),a=t.getScale,t.getScale=o,e()},update:t=>(i+=((i+1)/2-i)*Math.min(t*nt,1),e(),Math.abs(i-1)<.01?vt.STOP:vt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function jt(t,e,a){let i=0,o=null;const n=()=>!1;return{start:()=>{o=t.getFocused,t.getFocused=n,i=0,e()},update:t=>(i+=t,!o?.()||i>=a.delayMs?vt.STOP:vt.CONTINUE),destroy:()=>{o&&(t.getFocused=o),e()}}}function Ot(t){switch(t){case"integer":case"long":return 0;default:return null}}!function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(vt||(vt={}));const It=u();export{yt as GraphicScaleRotateTransform};
5
+ import{cyclicalPI as t}from"../../../../../core/Cyclical.js";import e from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{clamp as i,rad2deg as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{createAngle as n,createLength as r}from"../../../../../core/quantityUtils.js";import{when as l,initial as c,watch as h}from"../../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../../core/scheduling.js";import{createScreenPointArray as d}from"../../../../../core/screenUtils.js";import{d as u,E as g,m,k as _,e as f}from"../../../../../chunks/mat4.js";import{c as D}from"../../../../../chunks/mat4f64.js";import{s as S,b as M,l as v,d as b,f as y,a as w}from"../../../../../chunks/vec3.js";import{a as T,f as R}from"../../../../../chunks/vec3f64.js";import{b as j}from"../../../../../chunks/vec4f64.js";import{fromPositionAndNormal as O,create as I,normal as A}from"../../../../../geometry/support/plane.js";import{wrap as E,distance2 as k}from"../../../../../geometry/support/ray.js";import{sv3d as F,sm4d as P}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as C}from"../../../../../support/elevationInfoUtils.js";import{Manipulator3D as U}from"../../Manipulator3D.js";import{calculateInputRotationTransform as z}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as x}from"../dragEventPipeline3D.js";import{ManipulatorType as N}from"../ManipulatorType.js";import{RING_INDICATOR_DELAY_MS as H,ROTATE_INDICATOR_DIRECTION_BUFFER as V,SCALE_INDICATOR_DIRECTION_BUFFER as q,ROTATE_INDICATOR_ARROW_PLACEMENT_PERCENTAGE as B,RING_THICKNESS as G,HANDLE_COLOR as J,DRAG_THRESHOLD_PX as K,RING_RADIUS as Q,INNER_INDICATOR_RADIUS as W,OUTER_INDICATOR_RADIUS as X,RING_HEIGHT as Y,ROTATE_INDICATOR_ARROW_TIP_RADIUS as Z,ROTATE_INDICATOR_ARROW_TIP_LENGTH as $,SCALE_INDICATOR_OFFSET1 as tt,SCALE_INDICATOR_OFFSET2 as et,INDICATOR_THICKNESS as at,GEOMETRY_SEGMENTS as it,ROTATE_INDICATOR_ARC_LENGTH as ot,RING_RESET_ANIMATION_SPEED_FACTOR as st,SCALE_INDICATOR_ARC_LENGTH as nt}from"../manipulations/config.js";import{CullFaceOptions as rt}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as lt,transformInPlace as ct,createPathExtrusionGeometry as ht}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as pt}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as dt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as ut}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as gt,ManipulatorStateFlags as mt}from"../../../../interactive/interfaces.js";import{Tooltip as _t}from"../../../../interactive/tooltip/Tooltip.js";import{TransformRotateTooltipInfo as ft,TransformScaleTooltipInfo as Dt,TransformAbsoluteTooltipInfo as St}from"../../../../interactive/tooltip/TransformTooltipInfos.js";var Mt,vt;!function(t){t.ScaleIn=gt.Custom2,t.ScaleOut=gt.Custom3,t.RotateLeft=gt.Custom4,t.RotateRight=gt.Custom5,t.Unlocked=gt.Custom7,t.DelayedFocused=gt.Custom8,t.TouchInput=gt.Custom12}(Mt||(Mt={}));class bt{get angle(){return this._adapter.angle}get scale(){return this._adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}constructor({adapter:t,tooltipOptions:i,mode:o,tool:s}){this._mode=null,this._handles=new a,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new e,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this._adapter.scale:1,this.tool=s,this._mode=o,this._adapter=t,this._tooltipOptions=i,this._tooltip=new _t({view:s.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this._handles.add(l((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),c))}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this._handles=s(this._handles),this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this._tooltip=s(this._tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=p({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=s(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,N.SCALE_ROTATE)}_createManipulator(){const e=this._createRingManipulator();this._ringManipulator=e,this.tool.manipulators.add(e);const a=this.tool.graphicState.graphic,s=ut(e,((e,s,n)=>{this._scaleRotateDragData=null;const r=this._adapter.startInteraction(),l={mode:"none",origin:T(e.renderLocation),initialAngle:this._adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=F.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(e.renderLocation,c),s.next(x(this.tool.view,O(e.renderLocation,c,I()))).next((e=>{const s=A(e.plane),n=z(e.renderStart,e.renderEnd,l.origin,s),c=t.shortestSignedDiff(l.angle,n);l.angleDir=i(l.angleDir+c,-V,V),l.angle=n;const h=yt(l,e),p=h-this._adapter.scale;if(l.scaleDir=i(l.scaleDir+p,-q,q),this._onScaleChanged(),"none"===l.mode){const t=this._mode||wt(e,e.plane,l.origin,this.tool.view.state.camera);if(null!=t){switch(t){case"rotate":this.tool.emit("graphic-rotate-start",{graphic:a,angle:0}),this.tool.emit("record-undo",{record:this._adapter.createUndoRecord()});break;case"scale":this.tool.emit("graphic-scale-start",{graphic:a,xScale:1,yScale:1}),this.tool.emit("record-undo",{record:this._adapter.createUndoRecord()})}l.mode=t}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+n;break;case"scale":r.state.scale=h,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),e.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.emit("graphic-rotate",{graphic:a,angle:o(l.angle)});break;case"scale":this.tool.emit("graphic-scale",{graphic:a,xScale:h,yScale:h})}break;case"end":switch(l.mode){case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:o(l.angle)});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:h,yScale:h})}}return"end"===e.action&&(this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),e})).next(this._updateTooltipPipelineStep(l)),n.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:0});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:1,yScale:1})}this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this._handles.add([s,e.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(jt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),e.events.on("immediate-click",(t=>{t.stopPropagation()})),h((()=>this.tool.graphicState?.displaying),(t=>this._ringManipulator.available=t),c)])}_updateTooltipPipelineStep(t){return e=>{const a=this._tooltipOptions;if(!a.enabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const i=this._tooltip,{size:o,scale:s,angle:l,relativeAngle:c}=this._adapter,h=this._tooltipOptions.visualVariables,p=h?.size,d=h?.rotation;switch(t.mode){case"scale":i.info=new Dt({tooltipOptions:a,scale:{value:s},size:r(o??-1,"meters"),sizeEnabled:!!p,sizeUnit:p?.unit,sizePrecision:Ot(p?.valueType)});break;case"rotate":{const t=Ot(d?.valueType);i.info=new ft({tooltipOptions:a,rotation:n(-(c??0),"radians","geographic"),rotationPrecision:t,rotationType:d?.rotationType??"geographic",orientation:n(-l,"radians","geographic"),orientationEnabled:!!d,orientationPrecision:t})}}return e}}_updateFocusTooltip(){if(!this._tooltipOptions.enabled)return;if(this.getFocused()){const t=this._tooltipOptions.visualVariables,e=t?.rotation,a=t?.size,i=this._mode,{size:o,angle:s}=this._adapter;this._tooltip.info=new St({tooltipOptions:this._tooltipOptions,orientation:n(-s,"radians","geographic"),orientationEnabled:!!e&&(null==i||"rotate"===i),orientationPrecision:Ot(e?.valueType),rotationType:e?.rotationType??"geographic",size:r(o??-1,"meters"),sizeUnit:a?.unit,sizeEnabled:!!a&&(null==i||"scale"===i),sizePrecision:Ot(a?.valueType)})}else this._tooltip.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=u(P.get(),this._adapter.angle,R(0,0,1));if(null==t)return;const e=this.getScale(),a=g(P.get(),S(F.get(),e,e,e));this._ringManipulator.modelTransform=m(P.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const i=[],o=Math.ceil(it*(e-t)/(2*Math.PI));for(let s=0;s<o+1;s++){const n=t+s*(e-t)/o;i.push(R(a*Math.cos(n),a*Math.sin(n),0))}return i},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,Y/2],[-t/2,Y/2]],i=this._createMaterial(1),o=(t,e,o=i)=>ht(o,a(e),t,[],[],!1),s=e(Q),n=o(s,G),r={left:new Array,right:new Array},l=[];for(let R=0;R<2;R++){const e=R*Math.PI-Math.PI/4,a=Math.PI/2-ot,s=e+a,n=e+Math.PI/2-a,c=t(s,n,W),h=o(c,at);l.push(c),l.push(t(s,n,X-G/2)),r.left.push(h),r.right.push(h.instantiate());for(let t=0;t<2;t++){const e=0===t,a=D();if(e){_(a,a,[1,-1,1]),f(a,a,-s,[0,0,1]);const t=Math.round(B*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{f(a,a,n,[0,0,1]);const t=Math.round((1-B)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const o=lt(i,$,0,Z,Y);ct(o,a),(e?r.left:r.right).push(o)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-nt,i=e+a,s=e+Math.PI/2-a,n=t(i,s,X);c.push(o(n,at))}const h=this._createMaterial(.66),p=this._createMaterial(.5),d=this._createMaterial(.33),u=e(Q+tt),g=e(Q+et),m=o(u,at,h),S=o(g,at,d),M=e(Q-tt),v=e(Q-et),b=o(M,at,h),y=o(v,at,d);let w=[new L(n,Mt.DelayedFocused),new L(n.instantiate({material:p}),mt.None)];this._mode&&"scale"!==this._mode||(w=w.concat([...c.map((t=>new L(t,Mt.DelayedFocused|Mt.Unlocked))),new L(m,Mt.DelayedFocused|Mt.ScaleIn),new L(S,Mt.DelayedFocused|Mt.ScaleIn),new L(b,Mt.DelayedFocused|Mt.ScaleOut),new L(y,Mt.DelayedFocused|Mt.ScaleOut)])),this._mode&&"rotate"!==this._mode||(w=w.concat([...r.right.map((t=>new L(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new L(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new L(t,Mt.DelayedFocused|Mt.RotateRight)))]));const T=[s,...l];return new U({view:this.tool.view,renderObjects:w,autoScaleRenderObjects:!1,worldOriented:!0,radius:G,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:C(this.tool.graphicState.graphic),collisionType:{type:"ribbon",paths:T,direction:R(0,0,1)}})}_createMaterial(t){const e=j([...J,t]);return new dt({color:e,transparent:1!==t,cullFace:rt.Back,renderOccluded:pt.Transparent})}get test(){return{ringManipulator:this._ringManipulator,setRingIndicatorDelayMs:t=>this._ringIndicatorDelayMs=t,tooltip:this._tooltip}}}function yt(t,e){const a=M(F.get(),e.renderStart,t.origin),i=M(F.get(),e.renderEnd,t.origin),o=v(a),s=v(i);return 0===o?0:s/o}function wt(t,e,a,i){const{renderStart:o,renderEnd:s}=t,n=Tt(o,i,F.get()),r=Tt(s,i,F.get());if(b(n,r)<K*K)return null;const l=M(F.get(),o,a),c=y(F.get(),l,A(e)),h=o,p=w(F.get(),h,c),d=Tt(a,i,F.get()),u=n,g=Tt(p,i,F.get()),m=M(F.get(),g,u),_=M(F.get(),n,d),f=E(u,m),D=E(d,_);return k(f,r)<k(D,r)?"rotate":"scale"}function Tt(t,e,a){return e.projectToScreen(t,It),S(a,It[0],It[1],0)}function Rt(t,e){let a=null,i=1;const o=()=>i;return{start:()=>{i=t.getScale(),a=t.getScale,t.getScale=o,e()},update:t=>(i+=((i+1)/2-i)*Math.min(t*st,1),e(),Math.abs(i-1)<.01?vt.STOP:vt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function jt(t,e,a){let i=0,o=null;const s=()=>!1;return{start:()=>{o=t.getFocused,t.getFocused=s,i=0,e()},update:t=>(i+=t,!o?.()||i>=a.delayMs?vt.STOP:vt.CONTINUE),destroy:()=>{o&&(t.getFocused=o),e()}}}function Ot(t){switch(t){case"integer":case"long":return 0;default:return null}}!function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(vt||(vt={}));const It=d();export{bt as GraphicScaleRotateTransform};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Evented.js";import{HandleOwnerMixin as i}from"../../../../../core/HandleOwner.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as l}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import h from"../../../../../geometry/Point.js";import{getGraphicEffectiveElevationInfo as u}from"../../../../../support/elevationInfoUtils.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{Manipulator3D as d}from"../../Manipulator3D.js";import{placeAtGraphic as g}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{canMoveZ as _}from"../manipulatorUtils.js";import{createVisualElements as M}from"../visualElementUtils.js";import{ALIGN_ARROWS_SCALE_THRESHOLD as f}from"../manipulations/config.js";import{MoveManipulation as y,ManipulationType as S}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as R}from"../manipulations/moveUtils.js";import{GraphicScaleRotateTransform as b}from"./GraphicScaleRotateTransform.js";import{ScaleRotateMeshAdapter as w}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as j}from"./ScaleRotateObjectSymbol3DAdapter.js";import{createGraphicGeometryUndoRecord as A}from"./undoRecords.js";import{GraphicState as T}from"../../../layers/graphics/GraphicState.js";import{sceneSnappingAtProjectedLocation as x}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as O}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as E}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import G from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as U}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as k,TranslateGraphicTooltipInfo as C}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as L}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Z}from"../../../../support/euclideanLengthMeasurementUtils.js";let V=class extends(i(e.EventedMixin(O))){constructor(t){super(t),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new G,this.type="transform-3d",this._scaleRotate=null,this._tooltip=null}initialize(){const{graphic:t,view:e}=this;this.graphicState=new T({graphic:t}),this.addHandles(r((()=>this.tooltipOptions.enabled),(t=>{this._tooltip=t?new U({view:e}):o(this._tooltip)}),l)),this._moveManipulation=new y({tool:this,view:e,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&_(t),radius:y.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.handles.add(e.events.on("immediate-click",(e=>{this.emit("immediate-click",{...e,graphic:t}),e.stopPropagation()})))));const i=t=>e=>{this.handles.add(e.events.on("focus-changed",(({action:e})=>{const i=this._tooltip;null!=i&&("focus"===e?this._updateMoveTooltip(t):i.clear())})))};this._moveManipulation.xyManipulation.forEachManipulator(i(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(i(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(i(S.Z));const n=u(t);this._moveManipulation.elevationInfo=n;const s=t.geometry;if(this._moveManipulation.createGraphicDragPipeline(((i,a,o,r,l)=>{if(null!=s&&i===S.XY){const{snappingStep:i,cancelSnapping:a}=D({snappingContext:new z({elevationInfo:n,pointer:l,editGeometryOperations:E.fromGeometry(new h({spatialReference:s.spatialReference}),e.state.viewingMode),visualizer:new v,excludeFeature:t}),snappingManager:this.snappingManager,updatingHandles:this.updatingHandles,useZ:!1});r=r.next(a),o=o.next(x(this.view,n)).next(...i)}return{steps:o=o.next((t=>(this._updateMoveTooltip(i,t),t))),cancel:r}}),this.graphicState,(t=>{const{action:e,graphic:i,dxScreen:a,dyScreen:o}=t,n={graphic:i,dxScreen:a,dyScreen:o};switch(e){case"start":this.emit("graphic-translate-start",n),this.emit("record-undo",{record:this._createGeometryUndoRecord()});break;case"update":this.emit("graphic-translate",n);break;case"end":this.emit("graphic-translate-stop",n)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.handles.add(r((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new b({tool:this,mode:t,adapter:this._scaleRotateAdapter,tooltipOptions:this.tooltipOptions}),this.handles.add(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.handles.add([M({view:this.view,graphic:this.graphic,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()}),this.graphicState.on("changed",(()=>this._onGeometryChanged())),this._hideManipulatorsForGraphicState(),r((()=>e.scale),(()=>this._updateMoveAngle()))]),this.handles.add(this.view.trackGraphicState(this.graphicState)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof d&&this.handles.add(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))})),this.finishToolCreation()}destroy(){this._tooltip=o(this._tooltip),this._moveManipulation.destroy(),this._scaleRotate=o(this._scaleRotate),this._scaleRotateAdapter=o(this._scaleRotateAdapter),this._set("view",null),this._set("graphic",null)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){return null!=this.graphic.geometry&&"mesh"===this.graphic.geometry.type?new w({graphic:this.graphic,geometry:this.graphic.geometry,viewingMode:this.view.state.viewingMode}):new j({graphic:this.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.graphic.layer)),sizeAxis:null!=this.tooltipOptions.visualVariables&&null!=this.tooltipOptions.visualVariables.size?this.tooltipOptions.visualVariables.size.axis:null})}_forEachManipulator(t){this._moveManipulation.forEachManipulator(t),null!=this._scaleRotate&&this._scaleRotate.forEachManipulator(t)}_hideManipulatorsForGraphicState(){return r((()=>this.graphicState.displaying),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&_(this.graphic)}))}_createGeometryUndoRecord(){return A(this.graphic)}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this.updatingHandles.updating}set location(t){this._moveManipulation.location=t,null!=this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,null!=this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onHide(){null!=this._scaleRotate&&this._scaleRotate.cancelActiveAnimation()}_onScaleChanged(){if(null==this._scaleRotate)return;const t=this._scaleRotate.getScale();this._moveManipulation.displayScale=t}_updateMoveAngle(){this.view.state.viewingMode===m.Local||this.view.scale<f?this._moveManipulation.angle=this._scaleRotateAdapter.angle:this._moveManipulation.angle=0}_onGeometryChanged(){g(this.view,this,this.graphic)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}_updateMoveTooltip(t,e){const{tooltipOptions:i,_tooltip:a}=this;if(null==a)return;a.clear();const o=this.graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case S.XY:a.info=new C({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,e)=>L(t,e,o)));break;case S.XY_AXIS:a.info=new k({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const a=L(t,i,o);return n(a,R(e))}));break;case S.Z:a.info=new I({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,Z)}}_updateMoveTooltipDistance(t,e,i){if(null!=e&&"end"!==e.action){const{mapStart:a,mapEnd:o}=e,n=i(a,o);t.distance=null!=n?n:s}}get test(){return{discManipulator:this._moveManipulation.xyManipulation.test.discManipulator,zManipulator:this._moveManipulation.zManipulation.test.manipulator,ringManipulator:null!=this._scaleRotate?this._scaleRotate.test.ringManipulator:null,arrowManipulators:this._moveManipulation.xyAxisManipulation.test.arrowManipulators,setRingIndicatorDelayMs:t=>null!=this._scaleRotate?this._scaleRotate.test.setRingIndicatorDelayMs(t):null,scaleRotateAdapter:this._scaleRotateAdapter,scaleRotateTransform:this._scaleRotate,tooltip:this._tooltip}}};t([p({constructOnly:!0,nonNullable:!0})],V.prototype,"view",void 0),t([p({constructOnly:!0,nonNullable:!0})],V.prototype,"graphic",void 0),t([p({constructOnly:!0,nonNullable:!0})],V.prototype,"enableZ",void 0),t([p()],V.prototype,"enableRotation",void 0),t([p()],V.prototype,"enableScaling",void 0),t([p({constructOnly:!0,type:G})],V.prototype,"tooltipOptions",void 0),t([p()],V.prototype,"graphicState",void 0),t([p({value:!1})],V.prototype,"snapToScene",null),t([p({constructOnly:!0})],V.prototype,"snappingManager",void 0),t([p({readOnly:!0})],V.prototype,"type",void 0),t([p({readOnly:!0})],V.prototype,"updating",null),V=t([c("esri.views.3d.interactive.editingTools.graphicTransform3D.GraphicTransformTool")],V);export{V as GraphicTransformTool};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Evented.js";import{HandleOwnerMixin as i}from"../../../../../core/HandleOwner.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as l}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import h from"../../../../../geometry/Point.js";import{getGraphicEffectiveElevationInfo as u}from"../../../../../support/elevationInfoUtils.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{Manipulator3D as d}from"../../Manipulator3D.js";import{placeAtGraphic as g}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{canMoveZ as _}from"../manipulatorUtils.js";import{createVisualElements as M}from"../visualElementUtils.js";import{ALIGN_ARROWS_SCALE_THRESHOLD as f}from"../manipulations/config.js";import{MoveManipulation as y,ManipulationType as S}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as R}from"../manipulations/moveUtils.js";import{GraphicScaleRotateTransform as w}from"./GraphicScaleRotateTransform.js";import{ScaleRotateMeshAdapter as b}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as j}from"./ScaleRotateObjectSymbol3DAdapter.js";import{createGraphicGeometryUndoRecord as A}from"./undoRecords.js";import{GraphicState as T}from"../../../layers/graphics/GraphicState.js";import{sceneSnappingAtProjectedLocation as x}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as O}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as E}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import G from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as U}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as k,TranslateGraphicTooltipInfo as C}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as L}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Z}from"../../../../support/euclideanLengthMeasurementUtils.js";let X=class extends(i(e.EventedMixin(O))){constructor(t){super(t),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new G,this.type="transform-3d",this._scaleRotate=null,this._tooltip=null}initialize(){const{graphic:t,view:e}=this;this.graphicState=new T({graphic:t}),this.addHandles(r((()=>this.tooltipOptions.enabled),(t=>{this._tooltip=t?new U({view:e}):o(this._tooltip)}),l)),this._moveManipulation=new y({tool:this,view:e,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&_(t),radius:y.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.handles.add(e.events.on("immediate-click",(e=>{this.emit("immediate-click",{...e,graphic:t}),e.stopPropagation()})))));const i=t=>e=>{this.handles.add(e.events.on("focus-changed",(({action:e})=>{const i=this._tooltip;null!=i&&("focus"===e?this._updateMoveTooltip(t):i.clear())})))};this._moveManipulation.xyManipulation.forEachManipulator(i(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(i(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(i(S.Z));const n=u(t);this._moveManipulation.elevationInfo=n;const s=t.geometry;if(this._moveManipulation.createGraphicDragPipeline(((i,a,o,r,l)=>{if(null!=s&&i===S.XY){const{snappingStep:i,cancelSnapping:a}=D({snappingContext:new z({elevationInfo:n,pointer:l,editGeometryOperations:E.fromGeometry(new h({spatialReference:s.spatialReference}),e.state.viewingMode),visualizer:new v,excludeFeature:t}),snappingManager:this.snappingManager,updatingHandles:this.updatingHandles,useZ:!1});r=r.next(a),o=o.next(x(this.view,n)).next(...i)}return{steps:o=o.next((t=>(this._updateMoveTooltip(i,t),t))),cancel:r}}),this.graphicState,(t=>{const{action:e,graphic:i,dxScreen:a,dyScreen:o}=t,n={graphic:i,dxScreen:a,dyScreen:o};switch(e){case"start":this.emit("graphic-translate-start",n),this.emit("record-undo",{record:this._createGeometryUndoRecord()});break;case"update":this.emit("graphic-translate",n);break;case"end":this.emit("graphic-translate-stop",n)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.handles.add(r((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new w({tool:this,mode:t,adapter:this._scaleRotateAdapter,tooltipOptions:this.tooltipOptions}),this.handles.add(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.handles.add([M({view:this.view,graphic:this.graphic,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()}),this.graphicState.on("changed",(()=>this._onGeometryChanged())),this._hideManipulatorsForGraphicState(),r((()=>e.scale),(()=>this._updateMoveAngle()))]),this.handles.add(this.view.trackGraphicState(this.graphicState)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof d&&this.handles.add(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))})),this.finishToolCreation()}destroy(){this._tooltip=o(this._tooltip),this._moveManipulation.destroy(),this._scaleRotate=o(this._scaleRotate),this._scaleRotateAdapter=o(this._scaleRotateAdapter),this._set("view",null),this._set("graphic",null)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){return null!=this.graphic.geometry&&"mesh"===this.graphic.geometry.type?new b({graphic:this.graphic,geometry:this.graphic.geometry,viewingMode:this.view.state.viewingMode}):new j({graphic:this.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.graphic.layer)),sizeAxis:this.tooltipOptions?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForGraphicState(){return r((()=>this.graphicState.displaying),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&_(this.graphic)}))}_createGeometryUndoRecord(){return A(this.graphic)}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this.updatingHandles.updating}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){this.view.state.viewingMode===m.Local||this.view.scale<f?this._moveManipulation.angle=this._scaleRotateAdapter.angle:this._moveManipulation.angle=0}_onGeometryChanged(){g(this.view,this,this.graphic)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}_updateMoveTooltip(t,e){const{tooltipOptions:i,_tooltip:a}=this;if(null==a)return;a.clear();const o=this.graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case S.XY:a.info=new C({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,e)=>L(t,e,o)));break;case S.XY_AXIS:a.info=new k({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const a=L(t,i,o);return n(a,R(e))}));break;case S.Z:a.info=new I({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,Z)}}_updateMoveTooltipDistance(t,e,i){if(null!=e&&"end"!==e.action){const{mapStart:a,mapEnd:o}=e,n=i(a,o);t.distance=null!=n?n:s}}get test(){return{discManipulator:this._moveManipulation.xyManipulation.test.discManipulator,zManipulator:this._moveManipulation.zManipulation.test.manipulator,ringManipulator:null!=this._scaleRotate?this._scaleRotate.test.ringManipulator:null,arrowManipulators:this._moveManipulation.xyAxisManipulation.test.arrowManipulators,setRingIndicatorDelayMs:t=>null!=this._scaleRotate?this._scaleRotate.test.setRingIndicatorDelayMs(t):null,scaleRotateAdapter:this._scaleRotateAdapter,scaleRotateTransform:this._scaleRotate,tooltip:this._tooltip}}};t([p({constructOnly:!0,nonNullable:!0})],X.prototype,"view",void 0),t([p({constructOnly:!0,nonNullable:!0})],X.prototype,"graphic",void 0),t([p({constructOnly:!0,nonNullable:!0})],X.prototype,"enableZ",void 0),t([p()],X.prototype,"enableRotation",void 0),t([p()],X.prototype,"enableScaling",void 0),t([p({constructOnly:!0,type:G})],X.prototype,"tooltipOptions",void 0),t([p()],X.prototype,"graphicState",void 0),t([p({value:!1})],X.prototype,"snapToScene",null),t([p({constructOnly:!0})],X.prototype,"snappingManager",void 0),t([p({readOnly:!0})],X.prototype,"type",void 0),t([p({readOnly:!0})],X.prototype,"updating",null),X=t([c("esri.views.3d.interactive.editingTools.graphicTransform3D.GraphicTransformTool")],X);export{X as GraphicTransformTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import{deg2rad as o,rad2deg as r}from"../../../../../core/mathUtils.js";import{when as n,sync as s}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{axis as l,angle as p}from"../../../../../geometry/support/axisAngleDegrees.js";import{ViewingMode as h}from"../../../../ViewingMode.js";import{createGraphicGeometryUndoRecord as g}from"./undoRecords.js";let u=class extends i{constructor(t){super(t),this._interactionState=null}initialize(){this.addHandles([n((()=>null!=this._interactionState&&this._interactionState.angle!==this._interactionState.previousAngle?{interactionState:this._interactionState,angle:this._interactionState.state.angle}:null),(({interactionState:t})=>{this._updateMeshRotation(t)}),s),n((()=>null!=this._interactionState&&this._interactionState.scale!==this._interactionState.previousScale?{interactionState:this._interactionState,scale:this._interactionState.state.scale}:null),(({interactionState:t})=>{this._updateMeshSize(t)}),s)])}get angle(){const t=this.geometry.transform;if(null==t)return 0;const e=l(t.rotation)[2];return Math.abs(e)>.999999?o(p(t.rotation))*Math.sign(e):0}get scale(){return null!=this._interactionState?this._interactionState.scale:1}startInteraction(){const t=new m({angle:this.angle});this._interactionState=t;const e=()=>{this._interactionState=null};return{state:t,done:e,cancel:()=>{t.cancel(),e()}}}createUndoRecord(){return g(this.graphic)}_updateMeshRotation(t){const e=this.geometry.anchor,i=this.viewingMode===h.Global,{angle:o,previousAngle:n}=t;this.geometry.rotate(0,0,r(o-n),{origin:e,geographic:i}),t.previousAngle=o,null!=this.geometry.transform&&this.graphic.notifyMeshTransformChanged(),this.graphic.notifyGeometryChanged()}_updateMeshSize(t){const e=this.geometry.anchor,i=this.viewingMode===h.Global,{scale:o,previousScale:r}=t;this.geometry.scale(o/r,{origin:e,geographic:i}),t.previousScale=o,null!=this.geometry.transform&&this.graphic.notifyMeshTransformChanged(),this.graphic.notifyGeometryChanged()}};t([a({constructOnly:!0})],u.prototype,"graphic",void 0),t([a({constructOnly:!0})],u.prototype,"geometry",void 0),t([a({constructOnly:!0})],u.prototype,"viewingMode",void 0),t([a()],u.prototype,"angle",null),t([a()],u.prototype,"scale",null),t([a()],u.prototype,"_interactionState",void 0),u=t([c("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateMeshAdapter")],u);let m=class extends e{get state(){const{angle:t,scale:e}=this;return{angle:t,scale:e}}constructor(t){super(t),this.angle=0,this.initialAngle=0,this.previousAngle=0,this.previousScale=1,this.scale=1,this.initialAngle=t.angle,this.previousAngle=t.angle}cancel(){this.angle=this.initialAngle,this.scale=1}};t([a()],m.prototype,"angle",void 0),t([a()],m.prototype,"initialAngle",void 0),t([a()],m.prototype,"previousAngle",void 0),t([a()],m.prototype,"previousScale",void 0),t([a()],m.prototype,"scale",void 0),t([a()],m.prototype,"state",null),m=t([c("InteractionState")],m);export{u as ScaleRotateMeshAdapter};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import{deg2rad as o,rad2deg as r}from"../../../../../core/mathUtils.js";import{when as n,sync as s}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{axis as c,angle as p}from"../../../../../geometry/support/axisAngleDegrees.js";import{ViewingMode as g}from"../../../../ViewingMode.js";import{createGraphicGeometryUndoRecord as h}from"./undoRecords.js";let u=class extends i{constructor(t){super(t),this._interactionState=null}initialize(){this.addHandles([n((()=>{const t=this._interactionState;return t&&t.angle!==t.previousAngle?{interactionState:t,angle:t.state.angle}:null}),(({interactionState:t})=>{this._updateMeshRotation(t)}),s),n((()=>{const t=this._interactionState;return t&&t.scale!==t.previousScale?{interactionState:t,scale:t.state.scale}:null}),(({interactionState:t})=>{this._updateMeshSize(t)}),s)])}get angle(){const t=this.geometry.transform;if(null==t)return this._interactionState?.angle??0;const e=c(t.rotation)[2];return Math.abs(e)>.999999?o(p(t.rotation))*Math.sign(e):0}get relativeAngle(){return this.angle-this.initialAngle}get initialAngle(){return this._interactionState?.initialAngle??0}get scale(){return this._interactionState?.scale??1}startInteraction(){const t=new m({angle:this.angle});this._interactionState=t;const e=()=>{this._interactionState=null};return{state:t,done:e,cancel:()=>{t.cancel(),e()}}}createUndoRecord(){return h(this.graphic)}_updateMeshRotation(t){const e=this.geometry.anchor,i=this.viewingMode===g.Global,{angle:o,previousAngle:n}=t;this.geometry.rotate(0,0,r(o-n),{origin:e,geographic:i}),t.previousAngle=o,null!=this.geometry.transform&&this.graphic.notifyMeshTransformChanged(),this.graphic.notifyGeometryChanged()}_updateMeshSize(t){const e=this.geometry.anchor,i=this.viewingMode===g.Global,{scale:o,previousScale:r}=t;this.geometry.scale(o/r,{origin:e,geographic:i}),t.previousScale=o,null!=this.geometry.transform&&this.graphic.notifyMeshTransformChanged(),this.graphic.notifyGeometryChanged()}};t([a({constructOnly:!0})],u.prototype,"graphic",void 0),t([a({constructOnly:!0})],u.prototype,"geometry",void 0),t([a({constructOnly:!0})],u.prototype,"viewingMode",void 0),t([a()],u.prototype,"angle",null),t([a()],u.prototype,"relativeAngle",null),t([a()],u.prototype,"initialAngle",null),t([a()],u.prototype,"scale",null),t([a()],u.prototype,"_interactionState",void 0),u=t([l("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateMeshAdapter")],u);let m=class extends e{get state(){const{angle:t,scale:e}=this;return{angle:t,scale:e}}constructor(t){super(t),this.angle=0,this.initialAngle=0,this.previousAngle=0,this.previousScale=1,this.scale=1,this.initialAngle=t.angle,this.previousAngle=t.angle}cancel(){this.angle=this.initialAngle,this.scale=1}};t([a()],m.prototype,"angle",void 0),t([a()],m.prototype,"initialAngle",void 0),t([a()],m.prototype,"previousAngle",void 0),t([a()],m.prototype,"previousScale",void 0),t([a()],m.prototype,"scale",void 0),t([a()],m.prototype,"state",null),m=t([l("InteractionState")],m);export{u as ScaleRotateMeshAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import{rad2deg as l,deg2rad as n}from"../../../../../core/mathUtils.js";import{when as o,sync as r}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";let c=class extends i{constructor(t){super(t),this.sizeAxis=null,this._interactionState=null}initialize(){this.addHandles(o((()=>null!=this._interactionState?this._interactionState.state:null),(t=>{this._updateSymbol(t)}),r))}get angle(){return null!=this._interactionState?this._interactionState.angle:null!=this._orientationReferenceSymbolLayer?h(this._orientationReferenceSymbolLayer.heading??0):0}get scale(){return null!=this._interactionState?this._interactionState.scale:1}get relativeAngle(){return this.angle-this.initialAngle}get initialAngle(){return null!=this._interactionState?this._interactionState.initialAngle:0}get size(){const t=this._sizeReferenceSymbolLayer;if(null==t)return null;const e=this.findLayerView(),i=this._graphicSymbol;if(null==e||null==i||"point-3d"!==i.type)return null;const l=e.getSymbolLayerSize(i,t);if("size"in l&&null!=l.size)return l.size;const n=this.sizeAxis;return!("width"in l)||null==l.width||null!=n&&"width"!==n&&"all"!==n&&"width-and-depth"!==n?!("depth"in l)||null==t.depth||null!=n&&"depth"!==n&&"all"!==n&&"width-and-depth"!==n?!("height"in l)||null==t.height||null!=n&&"height"!==n&&"all"!==n?null:l.height:l.depth:l.width}get _sizeReferenceSymbolLayer(){const t=this._graphicSymbol;return null==t||0===t.symbolLayers.length?null:t.symbolLayers.find((t=>"object"===t.type))}get _orientationReferenceSymbolLayer(){const t=this._graphicSymbol;return null==t||0===t.symbolLayers.length?null:t.symbolLayers.find((t=>"object"===t.type&&null!=t.heading))}get _graphicSymbol(){return null!=this.graphic&&null!=this.graphic.symbol&&"point-3d"===this.graphic.symbol.type?this.graphic.symbol:null}set _graphicSymbol(t){this.graphic.symbol=t}startInteraction(){const t=this._graphicSymbol,e=this.findLayerView();if(null!=this._interactionState||null==t||null==e)return p;const i=t.symbolLayers.map((i=>"object"===i.type?e.getSymbolLayerSize(t,i):null)).toArray(),l=t.clone(),n=this.angle,o=new y({originalSymbol:l,angle:n,initialSizes:i});this._interactionState=o;const r=()=>{this._interactionState=null};return{state:o,done:r,cancel:()=>{this._graphicSymbol=l,r()}}}createUndoRecord(){let t=this.graphic.symbol,e=null;return{undo:i=>{e=i.symbol,i.symbol=t},redo:i=>{t=i.symbol,i.symbol=e}}}_updateSymbol({scale:t,angle:e,originalSymbol:i,initialSizes:n}){const o=this._graphicSymbol;if(null==o||"point-3d"!==o.type)return;const r=o.clone(),s=-l(e-this.initialAngle);let a=!1;this._forEachObjectSymbolLayerPair(i,r,((e,i,l)=>{const o=(e.heading??0)+s;i.heading!==o&&(i.heading=o,a=!0);const r=n[l];if(null!=r&&"width"in r){r.width=this.sizeFilter(r.width),r.height=this.sizeFilter(r.height),r.depth=this.sizeFilter(r.depth);const e=r.width*t;i.width!==e&&(i.width=e,a=!0);const l=r.depth*t;i.depth!==l&&(i.depth=l,a=!0);const n=r.height*t;i.height!==n&&(i.height=n,a=!0)}})),a&&(this._graphicSymbol=r)}_forEachObjectSymbolLayerPair(t,e,i){t.symbolLayers.forEach(((t,l)=>{const n=e.symbolLayers.getItemAt(l);"object"===t.type&&"object"===n.type&&i(t,n,l)}))}};function h(t){return-n(t)}t([s()],c.prototype,"angle",null),t([s()],c.prototype,"scale",null),t([s()],c.prototype,"relativeAngle",null),t([s()],c.prototype,"initialAngle",null),t([s()],c.prototype,"size",null),t([s()],c.prototype,"sizeAxis",void 0),t([s({constructOnly:!0})],c.prototype,"graphic",void 0),t([s()],c.prototype,"_interactionState",void 0),t([s({constructOnly:!0})],c.prototype,"findLayerView",void 0),t([s({constructOnly:!0})],c.prototype,"sizeFilter",void 0),t([s()],c.prototype,"_sizeReferenceSymbolLayer",null),t([s()],c.prototype,"_orientationReferenceSymbolLayer",null),t([s()],c.prototype,"_graphicSymbol",null),c=t([a("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateObjectSymbol3DAdapter")],c);const p={state:{angle:0,scale:0},done:()=>{},cancel:()=>{}};let y=class extends e{get state(){const{originalSymbol:t,angle:e,initialAngle:i,scale:l,initialSizes:n}=this;return{originalSymbol:t,angle:e,initialAngle:i,scale:l,initialSizes:n}}constructor(t){super(t),this.angle=0,this.initialAngle=0,this.scale=1,this.initialAngle=t.angle}};t([s()],y.prototype,"originalSymbol",void 0),t([s()],y.prototype,"angle",void 0),t([s()],y.prototype,"initialAngle",void 0),t([s()],y.prototype,"initialSizes",void 0),t([s()],y.prototype,"scale",void 0),t([s()],y.prototype,"state",null),y=t([a("InteractionState")],y);export{c as ScaleRotateObjectSymbol3DAdapter,h as headingToAngle};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import{rad2deg as l,deg2rad as n}from"../../../../../core/mathUtils.js";import{when as o,sync as r}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";let c=class extends i{constructor(t){super(t),this.sizeAxis=null,this._interactionState=null}initialize(){this.addHandles(o((()=>null!=this._interactionState?this._interactionState.state:null),(t=>{this._updateSymbol(t)}),r))}get angle(){return null!=this._interactionState?this._interactionState.angle:null!=this._orientationReferenceSymbolLayer?h(this._orientationReferenceSymbolLayer.heading??0):0}get scale(){return this._interactionState?.scale??1}get relativeAngle(){return this.angle-this.initialAngle}get initialAngle(){return this._interactionState?.initialAngle??0}get size(){const t=this._sizeReferenceSymbolLayer;if(null==t)return null;const e=this.findLayerView(),i=this._graphicSymbol;if(null==e||null==i||"point-3d"!==i.type)return null;const l=e.getSymbolLayerSize(i,t);if("size"in l&&null!=l.size)return l.size;const n=this.sizeAxis;return!("width"in l)||null==l.width||null!=n&&"width"!==n&&"all"!==n&&"width-and-depth"!==n?!("depth"in l)||null==t.depth||null!=n&&"depth"!==n&&"all"!==n&&"width-and-depth"!==n?!("height"in l)||null==t.height||null!=n&&"height"!==n&&"all"!==n?null:l.height:l.depth:l.width}get _sizeReferenceSymbolLayer(){const t=this._graphicSymbol;return null==t||0===t.symbolLayers.length?null:t.symbolLayers.find((t=>"object"===t.type))}get _orientationReferenceSymbolLayer(){const t=this._graphicSymbol;return null==t||0===t.symbolLayers.length?null:t.symbolLayers.find((t=>"object"===t.type&&null!=t.heading))}get _graphicSymbol(){return null!=this.graphic&&null!=this.graphic.symbol&&"point-3d"===this.graphic.symbol.type?this.graphic.symbol:null}set _graphicSymbol(t){this.graphic.symbol=t}startInteraction(){const t=this._graphicSymbol,e=this.findLayerView();if(null!=this._interactionState||null==t||null==e)return p;const i=t.symbolLayers.map((i=>"object"===i.type?e.getSymbolLayerSize(t,i):null)).toArray(),l=t.clone(),n=this.angle,o=new y({originalSymbol:l,angle:n,initialSizes:i});this._interactionState=o;const r=()=>{this._interactionState=null};return{state:o,done:r,cancel:()=>{this._graphicSymbol=l,r()}}}createUndoRecord(){let t=this.graphic.symbol,e=null;return{undo:i=>{e=i.symbol,i.symbol=t},redo:i=>{t=i.symbol,i.symbol=e}}}_updateSymbol({scale:t,angle:e,originalSymbol:i,initialSizes:n}){const o=this._graphicSymbol;if(null==o||"point-3d"!==o.type)return;const r=o.clone(),s=-l(e-this.initialAngle);let a=!1;this._forEachObjectSymbolLayerPair(i,r,((e,i,l)=>{const o=(e.heading??0)+s;i.heading!==o&&(i.heading=o,a=!0);const r=n[l];if(null!=r&&"width"in r){r.width=this.sizeFilter(r.width),r.height=this.sizeFilter(r.height),r.depth=this.sizeFilter(r.depth);const e=r.width*t;i.width!==e&&(i.width=e,a=!0);const l=r.depth*t;i.depth!==l&&(i.depth=l,a=!0);const n=r.height*t;i.height!==n&&(i.height=n,a=!0)}})),a&&(this._graphicSymbol=r)}_forEachObjectSymbolLayerPair(t,e,i){t.symbolLayers.forEach(((t,l)=>{const n=e.symbolLayers.getItemAt(l);"object"===t.type&&"object"===n.type&&i(t,n,l)}))}};function h(t){return-n(t)}t([s()],c.prototype,"angle",null),t([s()],c.prototype,"scale",null),t([s()],c.prototype,"relativeAngle",null),t([s()],c.prototype,"initialAngle",null),t([s()],c.prototype,"size",null),t([s()],c.prototype,"sizeAxis",void 0),t([s({constructOnly:!0})],c.prototype,"graphic",void 0),t([s()],c.prototype,"_interactionState",void 0),t([s({constructOnly:!0})],c.prototype,"findLayerView",void 0),t([s({constructOnly:!0})],c.prototype,"sizeFilter",void 0),t([s()],c.prototype,"_sizeReferenceSymbolLayer",null),t([s()],c.prototype,"_orientationReferenceSymbolLayer",null),t([s()],c.prototype,"_graphicSymbol",null),c=t([a("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateObjectSymbol3DAdapter")],c);const p={state:{angle:0,scale:0},done:()=>{},cancel:()=>{}};let y=class extends e{get state(){const{originalSymbol:t,angle:e,initialAngle:i,scale:l,initialSizes:n}=this;return{originalSymbol:t,angle:e,initialAngle:i,scale:l,initialSizes:n}}constructor(t){super(t),this.angle=0,this.initialAngle=0,this.scale=1,this.initialAngle=t.angle}};t([s()],y.prototype,"originalSymbol",void 0),t([s()],y.prototype,"angle",void 0),t([s()],y.prototype,"initialAngle",void 0),t([s()],y.prototype,"initialSizes",void 0),t([s()],y.prototype,"scale",void 0),t([s()],y.prototype,"state",null),y=t([a("InteractionState")],y);export{c as ScaleRotateObjectSymbol3DAdapter,h as headingToAngle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import"../../../../renderers/ClassBreaksRenderer.js";import"../../../../renderers/DictionaryRenderer.js";import"../../../../renderers/DotDensityRenderer.js";import"../../../../renderers/HeatmapRenderer.js";import"../../../../renderers/PieChartRenderer.js";import"../../../../renderers/Renderer.js";import"../../../../renderers/SimpleRenderer.js";import i from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import"../../../../symbols.js";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import s from"../../../../core/Handles.js";import{makeHandle as a}from"../../../../core/handleUtils.js";import n from"../../../../core/Logger.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{destroyMaybe as h,removeMaybe as d,get as p,disposeMaybe as c,isSome as y}from"../../../../core/maybe.js";import m from"../../../../core/PooledArray.js";import{throwIfAborted as g,eachAlways as u,createDeferred as b,isAbortError as _}from"../../../../core/promiseUtils.js";import{watch as f,when as v,on as C,syncAndInitial as S,whenOnce as w}from"../../../../core/reactiveUtils.js";import{schedule as G}from"../../../../core/scheduling.js";import{property as x}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as P}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as R,isEmpty as D}from"../../../../core/accessorSupport/diffUtils.js";import{s as E,a as I,g as U}from"../../../../chunks/vec3.js";import{c as A}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as O,projectXYZToVector as L,canProjectWithoutEngine as j,projectBuffer as V}from"../../../../geometry/projection.js";import{create as F,center as T,fromRect as k,equals as z}from"../../../../geometry/support/aaBoundingBox.js";import{create as W}from"../../../../geometry/support/aaBoundingRect.js";import{equals as M}from"../../../../geometry/support/spatialReferenceUtils.js";import N from"../../../../layers/Layer.js";import{getObjectId as B,computeAABB as H,hasGeometry as q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as Y}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as $,validateTo3D as Z}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as J}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as Q}from"../../../../symbols/support/defaults3D.js";import{to3D as K}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as X}from"./ElevationQuery.js";import{VisibilityFlag as ee,VisibilityGroup as ie}from"./enums.js";import{extractExpressionInfo as te,createContext as re}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as se}from"./Graphics3DFeatureStore.js";import ae from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ne}from"./Graphics3DSymbolCreationContext.js";import{make as oe}from"./Graphics3DSymbolFactory.js";import le from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as he}from"./GraphicStateTracking.js";import{computeCentroid as de}from"./graphicUtils.js";import{ApplyRendererDiffResult as pe}from"./interfaces.js";import{LoadStatus as ce}from"./Loadable.js";import{SpatialIndex2D as ye}from"./SpatialIndex2D.js";import{averageSymbolComplexities as me,defaultSymbolComplexity as ge}from"./symbolComplexity.js";import{StageLayerElevationProvider as ue}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as be}from"../../support/extentUtils.js";import{PropertiesPool as _e}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as fe}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as ve}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as Ce}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as Se,noBudget as we,TaskPriority as Ge,Task as xe}from"../../../support/Scheduler.js";import Pe from"../../../../geometry/Extent.js";import Re from"../../../../geometry/Point.js";import De from"../../../../symbols/LabelSymbol3D.js";import Ee from"../../../../symbols/TextSymbol.js";import Ie from"../../../../symbols/WebStyleSymbol.js";var Ue;const Ae=A(),Oe=F(),Le="esri.views.3d.layers.graphics.Graphics3DCore",je=n.getLogger(Le);let Ve=Ue=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ye({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 numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?ve.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._graphicsWaitingForSymbol.size>0||this.running||this._elevationAlignment?.updating||null!=this._scaleVisibility&&this._scaleVisibility.updating||null!=this._filterVisibility&&this._filterVisibility.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._updatingPendingLoadedGraphicsChange||this._frameTask.updating||this._loadingSymbols>0)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating}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,i=e?e.graphics3D.minTotalNumberOfFeatures:0,t=e?e.graphics3D.maxTotalNumberOfFeatures:0,r=e?e.graphics3D.maxTotalNumberOfPrimitives:0,s=this.averageSymbolComplexity,a=Math.max(1,null!=s?s.primitivesPerFeature:1),n=null!=s&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),h=this._get("displayFeatureLimit");return h&&h.minimumTotalNumberOfFeatures===i&&h.maximumTotalNumberOfFeatures===t&&h.maximumTotalNumberOfPrimitives===r&&h.averageSymbolComplexity===s&&h.maximumNumberOfFeatures===l?h:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=me(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=i&&(e.estimated&&(i.primitivesPerFeature>=e.primitivesPerFeature||i.primitivesPerCoordinate>=e.primitivesPerCoordinate||i.drawCallsPerFeature>=e.drawCallsPerFeature)||i.primitivesPerFeature===e.primitivesPerFeature&&i.primitivesPerCoordinate===e.primitivesPerCoordinate&&i.drawCallsPerFeature===e.drawCallsPerFeature)?i:e}get usedMemory(){const e=null!=this.averageSymbolComplexity&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,i=this._getSymbolComplexitiesUsed().reduce(((e,i)=>e+i.memory.resourceBytes),0);return this._usedMemory+e+i}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){if("web-style"===e.type)return e.clone();const i=this._symbolConversionCache.get(e.id);if(null!=i)return i;const t=K(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return null==r&&t.error&&je.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const i=e.getSymbols(),t="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!(t||i&&i.length))return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(t);null!=s&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const i=this._symbols.get(e.id);if(null!=i)return i.complexity;const t=this._getConvertedSymbol(e);return null!=t?ge(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{null!=i&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new _e({computedExtent:Pe},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._handles=new s,this._frameTask=Se,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=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 m({allocator:e=>e||new Te,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new m,this.preferredUpdatePolicy=ve.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.symbolCreationContext=new ne(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new se({objectIdField:this.owner.layer&&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,i,t)=>this.spatialIndex.queryGraphicUIDsInExtent(e,i,t),{componentFactories:i}=this;if(null!=i.elevationAlignment){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(null!=i.scaleVisibility){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(null!=i.filterVisibility){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e(B(i.graphic,this._objectIdField)),ie.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e,ie.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(ee.FILTER)))});this._filterVisibility=e}if(null!=i.deconflictor){const e=i.deconflictor(this);this._deconflictor=e}if(null!=i.labeler&&null!=this._scaleVisibility){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(null!=i.objectStates){const e=i.objectStates(this);this._objectStates=e}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,i=this.owner.view;this._viewElevationProvider=new X(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid);const t=i.sharedSymbolResources;this.symbolCreationContext.sharedResources=t,this._sharedSymbolResourcesOwnerHandle=t.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=t.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=i.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new fe(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await re(r,this._viewSpatialReference,e,je),g(e),this.symbolCreationContext.screenSizePerspectiveEnabled=i.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=i.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this._handles.add(a((()=>i.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this._handles.add([f((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),f((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=i.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),f((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),f((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),f((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),f((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),v((()=>i.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==i.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=i.basemapTerrain.spatialReference),this._handles.has("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this._handles.add([C(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),f((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===ve.ASYNC,e===ve.SYNC&&this.runTask(we)}),S)]),this._frameTask=i.resourceController.scheduler.registerTask(Ge.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(f((()=>this.layer.featureReduction),(()=>this._deconflictor.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTask.remove(),this._frameTask=Se,this.owner.view?.deconflictor?.removeGraphicsOwner(this),this.owner.view?.labeler?.removeGraphicsOwner(this),this._elevationAlignment=h(this._elevationAlignment),this._scaleVisibility=h(this._scaleVisibility),this._filterVisibility=h(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=h(this._objectStates),this.clear(),this._featureStore=h(this._featureStore),this._updatingPendingLoadedGraphicsChange=d(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=h(this._graphicStateTracking),this.stage&&(this.stageLayer=h(this.stageLayer),this.stage=null),this._handles=h(this._handles),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=d(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._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("updating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(e,i){this.stage=e._stage,this.stageLayer=new Ce(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*ke,t=!this.suspendedOrOutsideOfView&&!i;t!==this._visible&&(this._visible=t,t?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(null==this.layer.opacity||this.layer.opacity>0)}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,i=this.owner.layer&&this.owner.layer.objectIdField){return B(e,i)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer&&this.owner.layer.objectIdField;if(!e)return;const i=new Map;return this.graphics3DGraphics.forEach((t=>{if(!t)return;const r=t.graphic,s=this._getGraphicObjectID(r,e);null!=s&&i.set(s,t)})),i}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(e){const i=this._deconflictor&&this._deconflictor.labelingInfoChange(e),t=this._labeler&&this._labeler.labelingInfoChange(e);await u([i,t])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,i=0;return o(this._symbols,((t,r)=>{if(null!=t){const s=t.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(i+=s.fast,e+=s.slow)}return!1}))?"unknown":i>=0&&0===e?"fast":e>=0&&0===i?"slow":"mixed"}runTask(e){if(this._frameTask.processQueue(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("updating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return xe.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);null!=t&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(null==t||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(ee.USER_SETTING,r,ie.GRAPHIC)}_whenGraphics3DGraphic(e){const i=this.graphics3DGraphics.get(e.uid);if(i)return Promise.resolve(i);const t=this._whenGraphics3DGraphicRequests[e.uid];if(t)return t.promise;const r=b();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,i){const t=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,i,s)=>V(e,r,i,e,t,i,s),n=(e,i,r)=>V(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=i&&!!i.useViewElevation,minDemResolution:null!=i?i.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,p(i,"signal"));if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){T(h,Ae);const i=e.getElevation(Ae[0],Ae[1],0,t,"ground")??0;h[2]=Math.min(h[2],i),h[5]=Math.max(h[5],i)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await w((()=>this.owner?.loadedGraphics));const t=this.owner.layer&&this.owner.layer.objectIdField,s=this.owner.loadedGraphics.find((i=>i===e||null!=t&&null!=i.attributes&&e.attributes&&i.attributes[t]===e.attributes[t]));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,i)}computeAttachmentOrigin(e,i){const t=this.graphics3DGraphics.get(e.uid);if(!t)return null;const r=t.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;E(ze,0,0,0);let s=0;if(r.render.num>0){if(!O(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,We,i))return null;I(ze,ze,We),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,t,"ground")??0;if(E(We,e,t,a),!O(We,this._viewElevationProvider.spatialReference,We,i))return null;I(ze,ze,We),s++}return s>1&&U(ze,ze,1/s),new Re({x:ze[0],y:ze[1],z:ze[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(null==t)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(i);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=t.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 i=e.graphic.uid,t=this.graphics3DGraphics.get(i);if(null!=t||null!=this._graphicsWithoutSymbol.get(i))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(t);break;case"geometry":this._graphicUpdateGeometryHandler(t,e);break;case"symbol":this._graphicUpdateSymbolHandler(t,e);break;case"attributes":break;case"transform":this._graphicUpdateTransformHandler(t,e)}}_graphicUpdateGeometryHandler(e,i){const t=i.graphic.geometry;if(null==t)return void this._recreateGraphic(i.graphic);if(null==e){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(null!=i&&i.loadStatus===ce.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;null!=i.newValue&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=null!=e?e.graphics3DSymbol:null!=i.oldValue?this._symbols.get(i.oldValue.id):null;if(null==r||null==i.newValue)return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(t);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(t);const o=R(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!D(l.diff))return void this._recreateGraphic(t);const h=this._getRenderingInfo(t);if(null==h)return void this._recreateGraphic(t);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&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}_graphicUpdateTransformHandler(e,i){}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===ve.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const i=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,i),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("updating"),i}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((i=>{null!=i&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=Oe,t=e.spatialReference;H(e,i);const r=this._viewSpatialReference,s=Ue.tmpVec;if(M(t,r)||L(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],L(i[3],i[4],0,t,s,r),i[3]=s[0],i[4]=s[1]),!(isFinite(i[0])&&isFinite(i[3])&&isFinite(i[1])&&isFinite(i[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(i[2])&&isFinite(i[5]),l=o&&(!a||null==a.zmin||i[2]<a.zmin),h=o&&(!a||null==a.zmax||i[5]>a.zmax);if(a){(i[0]<a.xmin||i[1]<a.ymin||i[3]>a.xmax||i[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(i[0],a.xmin),n.ymin=Math.min(i[1],a.ymin),n.xmax=Math.max(i[3],a.xmax),n.ymax=Math.max(i[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=i[0],n.ymin=i[1],n.xmax=i[3],n.ymax=i[4],n.spatialReference=r;n&&(l&&(n.zmin=i[2]),h&&(n.zmax=i[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 i=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await re(i,this._viewSpatialReference,e.signal,je),g(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("elevationInfo",i)?i.forEach((e=>{const i=e.graphic,t=e.labelLayers;for(const r of t){r.graphics3DSymbolLayer.updateGraphicElevationContext(i,r)}})):this._recreateSymbol(t)})),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=c(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new ue({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=c(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:i,view:t}=this.owner,r=t.basemapTerrain.tilingScheme&&i&&i.length?i.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 i=this._graphicsBySymbol.get(e),t=[];i&&(i.forEach(((e,i)=>{const r=e.usedMemory;this._conditionalRemove(e,i),this._spatialIndex?.remove(e),t.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(i,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);h(r),this._symbols.delete(e),this.add(t)}_recreateGraphicsForSymbol(e){const i=this._graphicsBySymbol.get(e);if(i){const e=[];i.forEach((i=>e.push(i.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,i){this._graphicsDrapedUids.delete(i),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&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===ve.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):je.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===ve.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(null!=i.geometry&&"mesh"===i.geometry.type&&!i.geometry.loaded)return ve.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,je),ve.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(e){for(const i of e){const e=i.uid;let t=this._pendingUpdates.get(e);t?t.add?t.state!==Fe.NEW&&t.abortController?.abort():this._pendingAdds++:(t=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,t)),t.add=i}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(e){this.effectiveUpdatePolicy===ve.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("updating")}_removeImmediate(e){for(const i of e)this._removeGraphic(i);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(e){for(const i of e){const e=i.uid,t=this._pendingUpdates.get(e);if(t)t.add&&(t.remove?t.add=null:this._pendingUpdates.delete(e),t.state===Fe.LOADING&&t.abortController?.abort(),this._pendingAdds--);else{const t=this._pendingUpdatesPool.pushNew();t.remove=i,this._pendingUpdates.set(e,t),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&je.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[i,t]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(t.remove&&!t.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,this._pendingUpdates.delete(i),0===this._pendingRemoves))break}}for(const[i,t]of this._pendingUpdates){if(e.done)break;t.add&&t.state===Fe.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==Fe.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=ve.SYNC),t.add)switch(t.state){case Fe.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case Fe.REJECTED:t.add=null,this._pendingAdds--;case Fe.LOADING:}null==t.remove&&null==t.add&&this._pendingUpdates.delete(i)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=Fe.READY);const i=e.add.geometry;null==i||"mesh"!==i.type||i.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,i)}async _processPendingUpdateNewMesh(e,i){e.state=Fe.LOADING,e.abortController=new AbortController;const t=e.abortController.signal;try{await i.load({signal:t})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,i){e.abortController=null,_(i)?e.state=Fe.NEW:e.state=Fe.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,je),void(e.state=Fe.READY);e.state=Fe.LOADING,e.abortController=new AbortController;let i=null;try{i=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(t){return e.abortController=null,void(_(t)?e.state=Fe.NEW:e.state=Fe.REJECTED)}null==i||null==i.symbol?(je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=Fe.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),null==i||null==i.symbol||!q(e))return;null!=this.stage.renderView.objectAndLayerIdRenderHelper&&this.setUidToIdOnAdd&&this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled);const r=i.symbol,s=this.getOrCreateGraphics3DSymbol(r,i.renderer);if(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new ae(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const h=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(l);if(this._graphicsWaitingForSymbol.get(e.uid)!==a||o||s.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==s.symbol.id)--s.referenced,this._cleanupSymbols();else{const i=this._createGraphics3DGraphic(s,n);this._spatialIndex&&null!=i&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},d=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(_(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===ve.ASYNC?s.load((()=>this._frameTask.schedule(h)),(e=>this._frameTask.schedule((()=>d(e))))):s.load(h,d)}_removeGraphic(e){const i=e.uid,t=this.graphics3DGraphics.get(i);if(t){t.graphics3DSymbol.onRemoveGraphic(t);const e=t.usedMemory,r=t.isElevationSource;this._conditionalRemove(t,i),this._spatialIndex?.remove(t);const s=t.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(i),this._graphicsWithoutSymbol.delete(i),this._removeGraphics3DGraphic(i,e,r),t.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(i),this._graphicsWaitingForSymbol.delete(i),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(e){if(e instanceof De||e instanceof Ee){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof De&&!this._hasLabelingContext(e))||(je.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,i){const t=e.geometry;if(null==t)return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!j(t.spatialReference,this._viewSpatialReference))return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.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{s={symbol:r.symbol||Q(r.geometry)}}return null==s||null==s.symbol?(i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,i){if(null==e.geometry)return je&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const t=this.rendererHasGeometryOperations?Y(e,this.layer):e;return this.owner.getRenderingInfoAsync(t,this.currentRenderer,this._arcadeOnDemand,i)}_createGraphics3DSymbol(e,i){if(!this._hasValidSymbolCreationContext(e))return null;const t=this._getConvertedSymbol(e);if(!t)return null;let r;if(null!=i&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=K(i.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=oe(t,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,i){let t=this._symbols.get(e.id);return void 0===t&&(t=e instanceof Ie?new le(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),null!=t&&++t.referenced,t}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new he(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,i,t=!1){this._usedMemory-=i,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,t&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,i){const t=i.graphic;if(this._graphicsWithoutSymbol.delete(t.uid),!this._symbols.has(e.symbol.id))return this.add([t]),null;if(this.graphics3DGraphics.has(t.uid))return null;const r=e.createGraphics3DGraphic(i);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(t.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(t.uid),r.centroid=null,null!=t.geometry&&"point"!==t.geometry.type&&(r.centroid=de(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(ee.FILTER,e,ie.GRAPHIC),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),this._deconflictor&&this.owner.view.deconflictor.setInitialIconVisibilityFlag(this,r),r.initialize(this.stageLayer,this.owner),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[t.uid];return a&&(delete this._whenGraphics3DGraphicRequests[t.uid],a.resolve(r)),r}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(e){if(this._abortRendererChange(),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),$(e))if(null!=e&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();g(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),g(i)),this.effectiveUpdatePolicy===ve.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===ve.ASYNC){const i=new AbortController;this._rendererChangeAbortController=i,await this._frameTask.schedule((()=>this._currentRendererChange(e,!1)),i.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await J(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=this._arcadeOnDemand;const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=R(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,t)?this._volatileGraphicsUpdated():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const i in e.diff)switch(i){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[i];break;default:return!0}return!1}_applySymbolSetDiff(e,i,t){e=e||[],i=i||[];const r=[];for(const s of i){const i=this._graphicsBySymbol.get(s.id);i&&i.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof N?this.layer:null,h=this._arcadeOnDemand;if(s===t.defaultSymbol&&t.getSymbol(Y(o,l),{arcade:h})===t.defaultSymbol)return;const d=a.usedMemory;e.length||t.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),i.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&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(e,i,t){const r=e.diff.defaultSymbol,s=e.diff.uniqueValueInfos;if(r||s){const a=s?s.added.map((e=>e.symbol)).filter(y):[],n=s?s.removed.map((e=>e.symbol)).filter(y):[];if(s)for(let e=0;e<s.changed.length;e++)a.push(s.changed[e].newValue.symbol),n.push(s.changed[e].oldValue.symbol);return r?(t.defaultSymbol&&n.push(t.defaultSymbol),i.defaultSymbol&&a.push(i.defaultSymbol)):t.defaultSymbol&&a.length&&n.push(i.defaultSymbol),this._applySymbolSetDiff(a,n,i),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,i,t){if("unique-value"!==i?.type||"unique-value"!==t?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s&&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 t.uniqueValueInfos??[]){const t=r(e.symbol),s=i.uniqueValueInfos?.find((i=>i.value===e.value));s&&t!==r(s.symbol)&&o.push({oldId:t,newId:r(s.symbol)})}}return!a&&t.defaultSymbol&&o.push({oldId:r(t.defaultSymbol),newId:r(i.defaultSymbol)}),o}_updateSymbolMapping(e,i){const t=null!=i&&i?"string"==typeof i?i:i.id:null;if(null==e||e===t)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(t,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(t,s),null!=s)){const e="string"==typeof i?null:i;null!=e?s.symbol=e:s.symbol.id=t}}_updateUnchangedSymbolMappings(e,i,t){const r=this._calculateUnchangedSymbolMapping(e,i,t);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,r){if(this._diffHasSymbolChange(e))return!1;if(t instanceof i&&r instanceof i&&this._applyUniqueValueRendererDiff(e,t,r)&&0===Object.keys(e.diff).length)return!0;for(const[i]of this._graphicsBySymbol){const r=this._symbols.get(i);if(null!=r)switch(r.applyRendererDiff(e,t)){case pe.Recreate_Symbol:this._recreateSymbol(i);break;case pe.Recreate_Graphics:this._recreateGraphicsForSymbol(i);case pe.Fast_Update:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("opacity",i))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("slicePlaneEnabled",i))),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",i)||this._recreateSymbol(t)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("skipHighSymbolLods",i)||this._recreateSymbol(t)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=G((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=W();return be(e,r,i)?this.symbolCreationContext.clippingExtent=k(F(),r):this.symbolCreationContext.clippingExtent=null,!z(this.symbolCreationContext.clippingExtent,t)}modifyGraphics3DGraphicVisibilities(e){let i=!1;this.graphics3DGraphics.forEach((t=>{e(t)&&(i=!0)})),i&&(this.owner.view.labeler?.setDirty(),this.owner.view.deconflictor.setDirty())}forEachGraphics3DSymbol(e){for(const[i,t]of this._symbols){if(null==t)return;e(t,this._graphicsBySymbol.get(i)||Me,i)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(ee.USER_SETTING,!1,ie.GRAPHIC)))}_validateRenderer(e){const i=Z(e,{geometryType:this.layer?.geometryType});if(i){const e=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;je.warn(e,i.message)}}_volatileGraphicsUpdated(){this._labeler?.reset(),this.stageLayer.shaderTransformationChanged(),this.notifyChange("updating")}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((i,t)=>{if(null==i||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),h(i),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){return{snapshotInternals:()=>({graphics:[...this.graphics3DGraphics.keys()].sort(),symbols:[...this._symbols.keys()].sort(),graphicsBySymbol:[...this._graphicsBySymbol.keys()].sort().map((e=>({symbolId:e,graphics:[...this._graphicsBySymbol.get(e).keys()].sort()}))),graphicsWithoutSymbol:[...this._graphicsWithoutSymbol.keys()].sort(),graphicsDrapedUids:[...this._graphicsDrapedUids].sort(),pendingUpdates:this._pendingUpdates}),symbols:this._symbols,filterVisibility:this._filterVisibility,numPending:this._pendingUpdates.size,forceUpdatePolicy:e=>{this._forcedUpdatePolicy=e}}}get performanceInfo(){return{visible:this.graphics3DGraphics.size,missing:this._graphicsWithoutSymbol.size,pending:this._pendingUpdates.size}}};var Fe;Ve.tmpVec=A(),e([x({readOnly:!0})],Ve.prototype,"computedExtent",void 0),e([x()],Ve.prototype,"currentRenderer",void 0),e([x()],Ve.prototype,"rendererHasGeometryOperations",void 0),e([x()],Ve.prototype,"_frameTask",void 0),e([x({readOnly:!0})],Ve.prototype,"_viewSpatialReference",null),e([x()],Ve.prototype,"_rendererChangeAbortController",void 0),e([x()],Ve.prototype,"_elevationInfoChangeAbortController",void 0),e([x()],Ve.prototype,"_initializeAbortController",void 0),e([x()],Ve.prototype,"_elevationAlignment",void 0),e([x()],Ve.prototype,"_scaleVisibility",void 0),e([x()],Ve.prototype,"_filterVisibility",void 0),e([x()],Ve.prototype,"_initializePromise",void 0),e([x()],Ve.prototype,"_spatialIndex",void 0),e([x({readOnly:!0})],Ve.prototype,"extentPadding",void 0),e([x()],Ve.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([x()],Ve.prototype,"_featureStore",void 0),e([x()],Ve.prototype,"_deconflictor",void 0),e([x()],Ve.prototype,"_labeler",void 0),e([x()],Ve.prototype,"_objectStates",void 0),e([x()],Ve.prototype,"_loadingSymbols",void 0),e([x()],Ve.prototype,"preferredUpdatePolicy",void 0),e([x()],Ve.prototype,"_forcedUpdatePolicy",void 0),e([x({readOnly:!0})],Ve.prototype,"effectiveUpdatePolicy",null),e([x({constructOnly:!0})],Ve.prototype,"elevationFeatureExpressionEnabled",void 0),e([x({constructOnly:!0})],Ve.prototype,"owner",void 0),e([x({constructOnly:!0})],Ve.prototype,"layer",void 0),e([x({constructOnly:!0})],Ve.prototype,"graphicSymbolSupported",void 0),e([x({constructOnly:!0})],Ve.prototype,"getRenderingInfoWithoutRenderer",void 0),e([x({constructOnly:!0})],Ve.prototype,"componentFactories",void 0),e([x({constructOnly:!0})],Ve.prototype,"setUidToIdOnAdd",void 0),e([x()],Ve.prototype,"featureStore",null),e([x()],Ve.prototype,"initializePromise",null),e([x()],Ve.prototype,"scaleVisibility",null),e([x()],Ve.prototype,"elevationAlignment",null),e([x()],Ve.prototype,"objectStates",null),e([x()],Ve.prototype,"filterVisibility",null),e([x({readOnly:!0})],Ve.prototype,"updating",null),e([x({readOnly:!0})],Ve.prototype,"running",null),e([x({readOnly:!0})],Ve.prototype,"suspendedOrOutsideOfView",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"updatingRemaining",null),e([x({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],Ve.prototype,"displayFeatureLimit",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"averageSymbolComplexity",null),e([x({constructOnly:!0})],Ve.prototype,"hasZ",void 0),e([x({constructOnly:!0})],Ve.prototype,"hasM",void 0),e([x()],Ve.prototype,"_objectIdField",null),Ve=Ue=e([P(Le)],Ve),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(Fe||(Fe={}));class Te{constructor(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}}const ke=10,ze=A(),We=A(),Me=new Map;export{Ve as Graphics3DCore};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import"../../../../renderers/ClassBreaksRenderer.js";import"../../../../renderers/DictionaryRenderer.js";import"../../../../renderers/DotDensityRenderer.js";import"../../../../renderers/HeatmapRenderer.js";import"../../../../renderers/PieChartRenderer.js";import"../../../../renderers/Renderer.js";import"../../../../renderers/SimpleRenderer.js";import i from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import"../../../../symbols.js";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import s from"../../../../core/Handles.js";import{makeHandle as a}from"../../../../core/handleUtils.js";import n from"../../../../core/Logger.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{destroyMaybe as h,removeMaybe as d,get as p,disposeMaybe as c,isSome as y}from"../../../../core/maybe.js";import m from"../../../../core/PooledArray.js";import{throwIfAborted as g,eachAlways as u,createDeferred as b,isAbortError as _}from"../../../../core/promiseUtils.js";import{watch as f,when as v,on as C,syncAndInitial as S,whenOnce as w}from"../../../../core/reactiveUtils.js";import{schedule as G}from"../../../../core/scheduling.js";import{property as x}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as P}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as R,isEmpty as D}from"../../../../core/accessorSupport/diffUtils.js";import{s as E,a as I,g as U}from"../../../../chunks/vec3.js";import{c as A}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as O,projectXYZToVector as L,canProjectWithoutEngine as j,projectBuffer as V}from"../../../../geometry/projection.js";import{create as F,center as T,fromRect as k,equals as z}from"../../../../geometry/support/aaBoundingBox.js";import{create as W}from"../../../../geometry/support/aaBoundingRect.js";import{equals as M}from"../../../../geometry/support/spatialReferenceUtils.js";import N from"../../../../layers/Layer.js";import{getObjectId as B,computeAABB as H,hasGeometry as q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as Y}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as $,validateTo3D as Z}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as J}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as Q}from"../../../../symbols/support/defaults3D.js";import{to3D as K}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as X}from"./ElevationQuery.js";import{VisibilityFlag as ee,VisibilityGroup as ie}from"./enums.js";import{extractExpressionInfo as te,createContext as re}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as se}from"./Graphics3DFeatureStore.js";import ae from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ne}from"./Graphics3DSymbolCreationContext.js";import{make as oe}from"./Graphics3DSymbolFactory.js";import le from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as he}from"./GraphicStateTracking.js";import{computeCentroid as de}from"./graphicUtils.js";import{ApplyRendererDiffResult as pe}from"./interfaces.js";import{LoadStatus as ce}from"./Loadable.js";import{SpatialIndex2D as ye}from"./SpatialIndex2D.js";import{averageSymbolComplexities as me,defaultSymbolComplexity as ge}from"./symbolComplexity.js";import{StageLayerElevationProvider as ue}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as be}from"../../support/extentUtils.js";import{PropertiesPool as _e}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as fe}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as ve}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as Ce}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as Se,noBudget as we,TaskPriority as Ge,Task as xe}from"../../../support/Scheduler.js";import Pe from"../../../../geometry/Extent.js";import Re from"../../../../geometry/Point.js";import De from"../../../../symbols/LabelSymbol3D.js";import Ee from"../../../../symbols/TextSymbol.js";import Ie from"../../../../symbols/WebStyleSymbol.js";var Ue;const Ae=A(),Oe=F(),Le="esri.views.3d.layers.graphics.Graphics3DCore",je=n.getLogger(Le);let Ve=Ue=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ye({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 numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?ve.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._graphicsWaitingForSymbol.size>0||this.running||this._elevationAlignment?.updating||null!=this._scaleVisibility&&this._scaleVisibility.updating||null!=this._filterVisibility&&this._filterVisibility.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._updatingPendingLoadedGraphicsChange||this._frameTask.updating||this._loadingSymbols>0)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating}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,i=e?e.graphics3D.minTotalNumberOfFeatures:0,t=e?e.graphics3D.maxTotalNumberOfFeatures:0,r=e?e.graphics3D.maxTotalNumberOfPrimitives:0,s=this.averageSymbolComplexity,a=Math.max(1,null!=s?s.primitivesPerFeature:1),n=null!=s&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),h=this._get("displayFeatureLimit");return h&&h.minimumTotalNumberOfFeatures===i&&h.maximumTotalNumberOfFeatures===t&&h.maximumTotalNumberOfPrimitives===r&&h.averageSymbolComplexity===s&&h.maximumNumberOfFeatures===l?h:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=me(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=i&&(e.estimated&&(i.primitivesPerFeature>=e.primitivesPerFeature||i.primitivesPerCoordinate>=e.primitivesPerCoordinate||i.drawCallsPerFeature>=e.drawCallsPerFeature)||i.primitivesPerFeature===e.primitivesPerFeature&&i.primitivesPerCoordinate===e.primitivesPerCoordinate&&i.drawCallsPerFeature===e.drawCallsPerFeature)?i:e}get usedMemory(){const e=null!=this.averageSymbolComplexity&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,i=this._getSymbolComplexitiesUsed().reduce(((e,i)=>e+i.memory.resourceBytes),0);return this._usedMemory+e+i}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){if("web-style"===e.type)return e.clone();const i=this._symbolConversionCache.get(e.id);if(null!=i)return i;const t=K(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return null==r&&t.error&&je.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const i=e.getSymbols(),t="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!(t||i&&i.length))return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(t);null!=s&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const i=this._symbols.get(e.id);if(null!=i)return i.complexity;const t=this._getConvertedSymbol(e);return null!=t?ge(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{null!=i&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new _e({computedExtent:Pe},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._handles=new s,this._frameTask=Se,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=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 m({allocator:e=>e||new Te,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new m,this.preferredUpdatePolicy=ve.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.symbolCreationContext=new ne(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new se({objectIdField:this.owner.layer&&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,i,t)=>this.spatialIndex.queryGraphicUIDsInExtent(e,i,t),{componentFactories:i}=this;if(null!=i.elevationAlignment){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(null!=i.scaleVisibility){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(null!=i.filterVisibility){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e(B(i.graphic,this._objectIdField)),ie.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e,ie.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(ee.FILTER)))});this._filterVisibility=e}if(null!=i.deconflictor){const e=i.deconflictor(this);this._deconflictor=e}if(null!=i.labeler&&null!=this._scaleVisibility){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(null!=i.objectStates){const e=i.objectStates(this);this._objectStates=e}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,i=this.owner.view;this._viewElevationProvider=new X(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid);const t=i.sharedSymbolResources;this.symbolCreationContext.sharedResources=t,this._sharedSymbolResourcesOwnerHandle=t.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=t.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=i.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new fe(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await re(r,this._viewSpatialReference,e,je),g(e),this.symbolCreationContext.screenSizePerspectiveEnabled=i.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=i.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this._handles.add(a((()=>i.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this._handles.add([f((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),f((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=i.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),f((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),f((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),f((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),f((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),v((()=>i.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==i.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=i.basemapTerrain.spatialReference),this._handles.has("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this._handles.add([C(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),f((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===ve.ASYNC,e===ve.SYNC&&this.runTask(we)}),S)]),this._frameTask=i.resourceController.scheduler.registerTask(Ge.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(f((()=>this.layer.featureReduction),(()=>this._deconflictor.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTask.remove(),this._frameTask=Se,this.owner.view?.deconflictor?.removeGraphicsOwner(this),this.owner.view?.labeler?.removeGraphicsOwner(this),this._elevationAlignment=h(this._elevationAlignment),this._scaleVisibility=h(this._scaleVisibility),this._filterVisibility=h(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=h(this._objectStates),this.clear(),this._featureStore=h(this._featureStore),this._updatingPendingLoadedGraphicsChange=d(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=h(this._graphicStateTracking),this.stage&&(this.stageLayer=h(this.stageLayer),this.stage=null),this._handles=h(this._handles),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=d(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._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("updating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(e,i){this.stage=e._stage,this.stageLayer=new Ce(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*ke,t=!this.suspendedOrOutsideOfView&&!i;t!==this._visible&&(this._visible=t,t?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(null==this.layer.opacity||this.layer.opacity>0)}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,i=this.owner.layer&&this.owner.layer.objectIdField){return B(e,i)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer&&this.owner.layer.objectIdField;if(!e)return;const i=new Map;return this.graphics3DGraphics.forEach((t=>{if(!t)return;const r=t.graphic,s=this._getGraphicObjectID(r,e);null!=s&&i.set(s,t)})),i}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(e){const i=this._deconflictor&&this._deconflictor.labelingInfoChange(e),t=this._labeler&&this._labeler.labelingInfoChange(e);await u([i,t])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,i=0;return o(this._symbols,((t,r)=>{if(null!=t){const s=t.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(i+=s.fast,e+=s.slow)}return!1}))?"unknown":i>=0&&0===e?"fast":e>=0&&0===i?"slow":"mixed"}runTask(e){if(this._frameTask.processQueue(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("updating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return xe.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);null!=t&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(null==t||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(ee.USER_SETTING,r,ie.GRAPHIC)}_whenGraphics3DGraphic(e){const i=this.graphics3DGraphics.get(e.uid);if(i)return Promise.resolve(i);const t=this._whenGraphics3DGraphicRequests[e.uid];if(t)return t.promise;const r=b();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,i){const t=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,i,s)=>V(e,r,i,e,t,i,s),n=(e,i,r)=>V(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=i&&!!i.useViewElevation,minDemResolution:null!=i?i.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,p(i,"signal"));if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){T(h,Ae);const i=e.getElevation(Ae[0],Ae[1],0,t,"ground")??0;h[2]=Math.min(h[2],i),h[5]=Math.max(h[5],i)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await w((()=>this.owner?.loadedGraphics));const t=this.owner.layer&&this.owner.layer.objectIdField,s=this.owner.loadedGraphics.find((i=>i===e||null!=t&&null!=i.attributes&&e.attributes&&i.attributes[t]===e.attributes[t]));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,i)}computeAttachmentOrigin(e,i){const t=this.graphics3DGraphics.get(e.uid);if(!t)return null;const r=t.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;E(ze,0,0,0);let s=0;if(r.render.num>0){if(!O(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,We,i))return null;I(ze,ze,We),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,t,"ground")??0;if(E(We,e,t,a),!O(We,this._viewElevationProvider.spatialReference,We,i))return null;I(ze,ze,We),s++}return s>1&&U(ze,ze,1/s),new Re({x:ze[0],y:ze[1],z:ze[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(null==t)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(i);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=t.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 i=e.graphic.uid,t=this.graphics3DGraphics.get(i);if(null!=t||null!=this._graphicsWithoutSymbol.get(i))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(t);break;case"geometry":this._graphicUpdateGeometryHandler(t,e);break;case"symbol":this._graphicUpdateSymbolHandler(t,e);break;case"attributes":break;case"transform":this._graphicUpdateTransformHandler(t,e)}}_graphicUpdateGeometryHandler(e,i){const t=i.graphic.geometry;if(null==t)return void this._recreateGraphic(i.graphic);if(null==e){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(null!=i&&i.loadStatus===ce.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;null!=i.newValue&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=null!=e?e.graphics3DSymbol:null!=i.oldValue?this._symbols.get(i.oldValue.id):null;if(null==r||null==i.newValue)return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(t);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(t);const o=R(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!D(l.diff))return void this._recreateGraphic(t);const h=this._getRenderingInfo(t);if(null==h)return void this._recreateGraphic(t);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&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}_graphicUpdateTransformHandler(e,i){}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===ve.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const i=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,i),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("updating"),i}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((i=>{null!=i&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=Oe,t=e.spatialReference;H(e,i);const r=this._viewSpatialReference,s=Ue.tmpVec;if(M(t,r)||L(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],L(i[3],i[4],0,t,s,r),i[3]=s[0],i[4]=s[1]),!(isFinite(i[0])&&isFinite(i[3])&&isFinite(i[1])&&isFinite(i[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(i[2])&&isFinite(i[5]),l=o&&(!a||null==a.zmin||i[2]<a.zmin),h=o&&(!a||null==a.zmax||i[5]>a.zmax);if(a){(i[0]<a.xmin||i[1]<a.ymin||i[3]>a.xmax||i[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(i[0],a.xmin),n.ymin=Math.min(i[1],a.ymin),n.xmax=Math.max(i[3],a.xmax),n.ymax=Math.max(i[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=i[0],n.ymin=i[1],n.xmax=i[3],n.ymax=i[4],n.spatialReference=r;n&&(l&&(n.zmin=i[2]),h&&(n.zmax=i[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 i=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await re(i,this._viewSpatialReference,e.signal,je),g(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("elevationInfo",i)?i.forEach((e=>{const i=e.graphic,t=e.labelLayers;for(const r of t){r.graphics3DSymbolLayer.updateGraphicElevationContext(i,r)}})):this._recreateSymbol(t)})),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=c(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new ue({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=c(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:i,view:t}=this.owner,r=t.basemapTerrain.tilingScheme&&i&&i.length?i.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 i=this._graphicsBySymbol.get(e),t=[];i&&(i.forEach(((e,i)=>{const r=e.usedMemory;this._conditionalRemove(e,i),this._spatialIndex?.remove(e),t.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(i,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);h(r),this._symbols.delete(e),this.add(t)}_recreateGraphicsForSymbol(e){const i=this._graphicsBySymbol.get(e);if(i){const e=[];i.forEach((i=>e.push(i.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,i){this._graphicsDrapedUids.delete(i),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&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===ve.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):je.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===ve.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(null!=i.geometry&&"mesh"===i.geometry.type&&!i.geometry.loaded)return ve.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,je),ve.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(e){for(const i of e){const e=i.uid;let t=this._pendingUpdates.get(e);t?t.add?t.state!==Fe.NEW&&t.abortController?.abort():this._pendingAdds++:(t=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,t)),t.add=i}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(e){this.effectiveUpdatePolicy===ve.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("updating")}_removeImmediate(e){for(const i of e)this._removeGraphic(i);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(e){for(const i of e){const e=i.uid,t=this._pendingUpdates.get(e);if(t)t.add&&(t.remove?t.add=null:this._pendingUpdates.delete(e),t.state===Fe.LOADING&&t.abortController?.abort(),this._pendingAdds--);else{const t=this._pendingUpdatesPool.pushNew();t.remove=i,this._pendingUpdates.set(e,t),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&je.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[i,t]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(t.remove&&!t.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,this._pendingUpdates.delete(i),0===this._pendingRemoves))break}}for(const[i,t]of this._pendingUpdates){if(e.done)break;t.add&&t.state===Fe.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==Fe.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=ve.SYNC),t.add)switch(t.state){case Fe.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case Fe.REJECTED:t.add=null,this._pendingAdds--;case Fe.LOADING:}null==t.remove&&null==t.add&&this._pendingUpdates.delete(i)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=Fe.READY);const i=e.add.geometry;null==i||"mesh"!==i.type||i.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,i)}async _processPendingUpdateNewMesh(e,i){e.state=Fe.LOADING,e.abortController=new AbortController;const t=e.abortController.signal;try{await i.load({signal:t})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,i){e.abortController=null,_(i)?e.state=Fe.NEW:e.state=Fe.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,je),void(e.state=Fe.READY);e.state=Fe.LOADING,e.abortController=new AbortController;let i=null;try{i=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(t){return e.abortController=null,void(_(t)?e.state=Fe.NEW:e.state=Fe.REJECTED)}null==i||null==i.symbol?(je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=Fe.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),null==i||null==i.symbol||!q(e))return;null!=this.stage.renderView.objectAndLayerIdRenderHelper&&this.setUidToIdOnAdd&&this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled);const r=i.symbol,s=this.getOrCreateGraphics3DSymbol(r,i.renderer);if(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new ae(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const h=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(l);if(this._graphicsWaitingForSymbol.get(e.uid)!==a||o||s.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==s.symbol.id)--s.referenced,this._cleanupSymbols();else{const i=this._createGraphics3DGraphic(s,n);this._spatialIndex&&null!=i&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},d=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(_(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===ve.ASYNC?s.load((()=>this._frameTask.schedule(h)),(e=>this._frameTask.schedule((()=>d(e))))):s.load(h,d)}_removeGraphic(e){const i=e.uid,t=this.graphics3DGraphics.get(i);if(t){t.graphics3DSymbol.onRemoveGraphic(t);const e=t.usedMemory,r=t.isElevationSource;this._conditionalRemove(t,i),this._spatialIndex?.remove(t);const s=t.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(i),this._graphicsWithoutSymbol.delete(i),this._removeGraphics3DGraphic(i,e,r),t.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(i),this._graphicsWaitingForSymbol.delete(i),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(e){if(e instanceof De||e instanceof Ee){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof De&&!this._hasLabelingContext(e))||(je.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,i){const t=e.geometry;if(null==t)return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!j(t.spatialReference,this._viewSpatialReference))return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.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{s={symbol:r.symbol||Q(r.geometry)}}return null==s||null==s.symbol?(i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,i){if(null==e.geometry)return je&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const t=this.rendererHasGeometryOperations?Y(e,this.layer):e;return this.owner.getRenderingInfoAsync(t,this.currentRenderer,this._arcadeOnDemand,i)}_createGraphics3DSymbol(e,i){if(!this._hasValidSymbolCreationContext(e))return null;const t=this._getConvertedSymbol(e);if(!t)return null;let r;if(null!=i&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=K(i.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=oe(t,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,i){let t=this._symbols.get(e.id);return void 0===t&&(t=e instanceof Ie?new le(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),null!=t&&++t.referenced,t}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new he(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,i,t=!1){this._usedMemory-=i,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,t&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,i){const t=i.graphic;if(this._graphicsWithoutSymbol.delete(t.uid),!this._symbols.has(e.symbol.id))return this.add([t]),null;if(this.graphics3DGraphics.has(t.uid))return null;const r=e.createGraphics3DGraphic(i);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(t.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(t.uid),r.centroid=null,null!=t.geometry&&"point"!==t.geometry.type&&(r.centroid=de(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(ee.FILTER,e,ie.GRAPHIC),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),this._deconflictor&&this.owner.view.deconflictor.setInitialIconVisibilityFlag(this,r),r.initialize(this.stageLayer,this.owner),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[t.uid];return a&&(delete this._whenGraphics3DGraphicRequests[t.uid],a.resolve(r)),r}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(e){if(this._abortRendererChange(),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),$(e))if(null!=e&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();g(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),g(i)),this.effectiveUpdatePolicy===ve.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===ve.ASYNC){const i=new AbortController;this._rendererChangeAbortController=i,await this._frameTask.schedule((()=>this._currentRendererChange(e,!1)),i.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await J(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=this._arcadeOnDemand;const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=R(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,t)?this._volatileGraphicsUpdated():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const i in e.diff)switch(i){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[i];break;default:return!0}return!1}_applySymbolSetDiff(e,i,t){e=e||[],i=i||[];const r=[];for(const s of i){const i=this._graphicsBySymbol.get(s.id);i&&i.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof N?this.layer:null,h=this._arcadeOnDemand;if(s===t.defaultSymbol&&t.getSymbol(Y(o,l),{arcade:h})===t.defaultSymbol)return;const d=a.usedMemory;e.length||t.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),i.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&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(e,i,t){const r=e.diff.defaultSymbol,s=e.diff.uniqueValueInfos;if(r||s){const a=s?s.added.map((e=>e.symbol)).filter(y):[],n=s?s.removed.map((e=>e.symbol)).filter(y):[];if(s)for(let e=0;e<s.changed.length;e++)a.push(s.changed[e].newValue.symbol),n.push(s.changed[e].oldValue.symbol);return r?(t.defaultSymbol&&n.push(t.defaultSymbol),i.defaultSymbol&&a.push(i.defaultSymbol)):t.defaultSymbol&&a.length&&n.push(i.defaultSymbol),this._applySymbolSetDiff(a,n,i),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,i,t){if("unique-value"!==i?.type||"unique-value"!==t?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s&&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 t.uniqueValueInfos??[]){const t=r(e.symbol),s=i.uniqueValueInfos?.find((i=>i.value===e.value));s&&t!==r(s.symbol)&&o.push({oldId:t,newId:r(s.symbol)})}}return!a&&t.defaultSymbol&&o.push({oldId:r(t.defaultSymbol),newId:r(i.defaultSymbol)}),o}_updateSymbolMapping(e,i){const t=null!=i&&i?"string"==typeof i?i:i.id:null;if(null==e||e===t)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(t,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(t,s),null!=s)){const e="string"==typeof i?null:i;null!=e?s.symbol=e:s.symbol.id=t}}_updateUnchangedSymbolMappings(e,i,t){const r=this._calculateUnchangedSymbolMapping(e,i,t);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,r){if(this._diffHasSymbolChange(e))return!1;if(t instanceof i&&r instanceof i&&this._applyUniqueValueRendererDiff(e,t,r)&&0===Object.keys(e.diff).length)return!0;for(const[i]of this._graphicsBySymbol){const r=this._symbols.get(i);if(null!=r)switch(r.applyRendererDiff(e,t)){case pe.RecreateSymbol:this._recreateSymbol(i);break;case pe.RecreateGraphics:this._recreateGraphicsForSymbol(i);case pe.FastUpdate:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("opacity",i))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("slicePlaneEnabled",i))),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",i)||this._recreateSymbol(t)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("skipHighSymbolLods",i)||this._recreateSymbol(t)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=G((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=W();return be(e,r,i)?this.symbolCreationContext.clippingExtent=k(F(),r):this.symbolCreationContext.clippingExtent=null,!z(this.symbolCreationContext.clippingExtent,t)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let i=!1;this.graphics3DGraphics.forEach((t=>{e(t)&&(i=!0)})),i&&(this.owner.view.labeler?.setDirty(),this.owner.view.deconflictor?.setDirty())}forEachGraphics3DSymbol(e){for(const[i,t]of this._symbols){if(null==t)return;e(t,this._graphicsBySymbol.get(i)||Me,i)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(ee.USER_SETTING,!1,ie.GRAPHIC)))}_validateRenderer(e){const i=Z(e,{geometryType:this.layer?.geometryType});if(i){const e=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;je.warn(e,i.message)}}_volatileGraphicsUpdated(){this._labeler?.reset(),this.stageLayer.shaderTransformationChanged(),this.notifyChange("updating")}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((i,t)=>{if(null==i||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),h(i),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){return{snapshotInternals:()=>({graphics:[...this.graphics3DGraphics.keys()].sort(),symbols:[...this._symbols.keys()].sort(),graphicsBySymbol:[...this._graphicsBySymbol.keys()].sort().map((e=>({symbolId:e,graphics:[...this._graphicsBySymbol.get(e).keys()].sort()}))),graphicsWithoutSymbol:[...this._graphicsWithoutSymbol.keys()].sort(),graphicsDrapedUids:[...this._graphicsDrapedUids].sort(),pendingUpdates:this._pendingUpdates}),symbols:this._symbols,filterVisibility:this._filterVisibility,numPending:this._pendingUpdates.size,forceUpdatePolicy:e=>{this._forcedUpdatePolicy=e}}}get performanceInfo(){return{visible:this.graphics3DGraphics.size,missing:this._graphicsWithoutSymbol.size,pending:this._pendingUpdates.size}}};var Fe;Ve.tmpVec=A(),e([x({readOnly:!0})],Ve.prototype,"computedExtent",void 0),e([x()],Ve.prototype,"currentRenderer",void 0),e([x()],Ve.prototype,"rendererHasGeometryOperations",void 0),e([x()],Ve.prototype,"_frameTask",void 0),e([x({readOnly:!0})],Ve.prototype,"_viewSpatialReference",null),e([x()],Ve.prototype,"_rendererChangeAbortController",void 0),e([x()],Ve.prototype,"_elevationInfoChangeAbortController",void 0),e([x()],Ve.prototype,"_initializeAbortController",void 0),e([x()],Ve.prototype,"_elevationAlignment",void 0),e([x()],Ve.prototype,"_scaleVisibility",void 0),e([x()],Ve.prototype,"_filterVisibility",void 0),e([x()],Ve.prototype,"_initializePromise",void 0),e([x()],Ve.prototype,"_spatialIndex",void 0),e([x({readOnly:!0})],Ve.prototype,"extentPadding",void 0),e([x()],Ve.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([x()],Ve.prototype,"_featureStore",void 0),e([x()],Ve.prototype,"_deconflictor",void 0),e([x()],Ve.prototype,"_labeler",void 0),e([x()],Ve.prototype,"_objectStates",void 0),e([x()],Ve.prototype,"_loadingSymbols",void 0),e([x()],Ve.prototype,"preferredUpdatePolicy",void 0),e([x()],Ve.prototype,"_forcedUpdatePolicy",void 0),e([x({readOnly:!0})],Ve.prototype,"effectiveUpdatePolicy",null),e([x({constructOnly:!0})],Ve.prototype,"elevationFeatureExpressionEnabled",void 0),e([x({constructOnly:!0})],Ve.prototype,"owner",void 0),e([x({constructOnly:!0})],Ve.prototype,"layer",void 0),e([x({constructOnly:!0})],Ve.prototype,"graphicSymbolSupported",void 0),e([x({constructOnly:!0})],Ve.prototype,"getRenderingInfoWithoutRenderer",void 0),e([x({constructOnly:!0})],Ve.prototype,"componentFactories",void 0),e([x({constructOnly:!0})],Ve.prototype,"setUidToIdOnAdd",void 0),e([x()],Ve.prototype,"featureStore",null),e([x()],Ve.prototype,"initializePromise",null),e([x()],Ve.prototype,"scaleVisibility",null),e([x()],Ve.prototype,"elevationAlignment",null),e([x()],Ve.prototype,"objectStates",null),e([x()],Ve.prototype,"filterVisibility",null),e([x({readOnly:!0})],Ve.prototype,"updating",null),e([x({readOnly:!0})],Ve.prototype,"running",null),e([x({readOnly:!0})],Ve.prototype,"suspendedOrOutsideOfView",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"updatingRemaining",null),e([x({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],Ve.prototype,"displayFeatureLimit",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"averageSymbolComplexity",null),e([x({constructOnly:!0})],Ve.prototype,"hasZ",void 0),e([x({constructOnly:!0})],Ve.prototype,"hasM",void 0),e([x()],Ve.prototype,"_objectIdField",null),Ve=Ue=e([P(Le)],Ve),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(Fe||(Fe={}));class Te{constructor(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}}const ke=10,ze=A(),We=A(),Me=new Map;export{Ve as Graphics3DCore};