@arcgis/core 4.28.0-next.20230921 → 4.28.0-next.20230923

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 (415) hide show
  1. package/Graphic.js +1 -1
  2. package/PopupTemplate.js +1 -1
  3. package/TimeExtent.js +1 -1
  4. package/arcade/ArcadeDate.js +1 -1
  5. package/arcade/Feature.js +1 -1
  6. package/arcade/featureSetUtils.js +1 -1
  7. package/arcade/featureset/actions/Adapted.js +1 -1
  8. package/arcade/featureset/actions/GroupBy.js +1 -1
  9. package/arcade/featureset/support/FeatureSet.js +1 -1
  10. package/arcade/featureset/support/FeatureSetIterator.js +1 -1
  11. package/arcade/featureset/support/StatsField.js +1 -1
  12. package/arcade/featureset/support/sqlUtils.js +1 -1
  13. package/arcade/functions/convertdirection.js +1 -1
  14. package/arcade/functions/date.js +1 -1
  15. package/arcade/functions/featuresetbase.js +1 -1
  16. package/arcade/functions/featuresetstats.js +1 -1
  17. package/arcade/treeAnalysis.js +1 -1
  18. package/arcade.js +1 -1
  19. package/assets/esri/core/workers/RemoteClient.js +1 -1
  20. package/assets/esri/core/workers/chunks/02156fd04279f4d0fd3f.js +1 -0
  21. package/assets/esri/core/workers/chunks/07f6175b52366b2c28bd.js +1 -0
  22. package/assets/esri/core/workers/chunks/098073c3b2849f56dad8.js +1 -0
  23. package/assets/esri/core/workers/chunks/1186ba1947bd0c32f148.js +1 -0
  24. package/assets/esri/core/workers/chunks/186445b9fbedd261f684.js +1 -0
  25. package/assets/esri/core/workers/chunks/{580039dd491854ca325c.js → 21fc02f0d5716c4a7acd.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{dff1c3c38dda2bd1a9d6.js → 246a954347fe9318190e.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{c9dfb145f0c1d93e0fbd.js → 250bb6ae6f1992b5b4f9.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{314c307e30f308a40a28.js → 25b09e9c0511c8e1cf8a.js} +1 -1
  29. package/assets/esri/core/workers/chunks/2a0b3b52ecd787a613bc.js +1 -0
  30. package/assets/esri/core/workers/chunks/2bc9b55e655968229ef4.js +1 -0
  31. package/assets/esri/core/workers/chunks/2f0924e7aa89e689da4a.js +1 -0
  32. package/assets/esri/core/workers/chunks/3f218d65ec451b2a1027.js +1 -0
  33. package/assets/esri/core/workers/chunks/425b5733bb88e6efe242.js +1 -0
  34. package/assets/esri/core/workers/chunks/45d6b942cdccca2ce44a.js +1 -0
  35. package/assets/esri/core/workers/chunks/4bf1a7e82a68ccee0ee1.js +1 -0
  36. package/assets/esri/core/workers/chunks/4c110c7f4f940ec58010.js +1 -0
  37. package/assets/esri/core/workers/chunks/{bde89b2684b6185992ef.js → 4ed77097e69fa3096ce4.js} +1 -1
  38. package/assets/esri/core/workers/chunks/4fe5bac782a742d5b1c0.js +1 -0
  39. package/assets/esri/core/workers/chunks/{1cbaba30f55f00f7498b.js → 51324d042f469f3b8914.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{3f4e9b1663ec521bfe00.js → 542ce10e1872399790b4.js} +1 -1
  41. package/assets/esri/core/workers/chunks/54d2b7e2ac4ba883bee8.js +1 -0
  42. package/assets/esri/core/workers/chunks/54ecb6cae310818d1aa2.js +1 -0
  43. package/assets/esri/core/workers/chunks/57c932e289d89d97da4b.js +1 -0
  44. package/assets/esri/core/workers/chunks/{6403de6fc067cf8f7436.js → 592c1fb531f2be928e8a.js} +1 -1
  45. package/assets/esri/core/workers/chunks/59a807220d6f0dd18776.js +1 -0
  46. package/assets/esri/core/workers/chunks/59dff10d7ad2b1bf469e.js +1 -0
  47. package/assets/esri/core/workers/chunks/609a475ab395f2ce63e2.js +1 -0
  48. package/assets/esri/core/workers/chunks/612c485c5aad1548d708.js +1 -0
  49. package/assets/esri/core/workers/chunks/{2bb69d76a13564e8e455.js → 645ba2d5c10184632d23.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{332689bf60d246485993.js → 65186e168dd112ac6221.js} +1 -1
  51. package/assets/esri/core/workers/chunks/6b9248fb2d6aadbce7bb.js +1 -0
  52. package/assets/esri/core/workers/chunks/709465832d306e02df52.js +1 -0
  53. package/assets/esri/core/workers/chunks/72c5bd6f7b8541b8d69e.js +1 -0
  54. package/assets/esri/core/workers/chunks/{bbc0dcd316c5598bc9ad.js → 74368a5213def6c200a2.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{94188fe381239d48a975.js → 76483c9a8848f3106126.js} +1 -1
  56. package/assets/esri/core/workers/chunks/7aa58c96798447ce5907.js +1 -0
  57. package/assets/esri/core/workers/chunks/7d078b8b9997b5300c0a.js +1 -0
  58. package/assets/esri/core/workers/chunks/7fe641cf1467496e670a.js +1 -0
  59. package/assets/esri/core/workers/chunks/{df8f62beb36fb9d2ac81.js → 810c8d6ff19976fd1366.js} +1 -1
  60. package/assets/esri/core/workers/chunks/8458ed96f3e72814cef2.js +1 -0
  61. package/assets/esri/core/workers/chunks/{243a4eed107d363dfad8.js → 887652bbdb3b71d0a089.js} +1 -1
  62. package/assets/esri/core/workers/chunks/896bfda379cf620b63ec.js +1 -0
  63. package/assets/esri/core/workers/chunks/91c9f0d59eaed7a735ce.js +1 -0
  64. package/assets/esri/core/workers/chunks/{1f7e041140088f8ac489.js → 97073a60f0ea2a397165.js} +1 -1
  65. package/assets/esri/core/workers/chunks/97658ac749664a07c92d.js +1 -0
  66. package/assets/esri/core/workers/chunks/{1da74a306aa5b4eacaae.js → 9866bbaeaf885c2dcca9.js} +1 -1
  67. package/assets/esri/core/workers/chunks/a39ae87298ac674f129d.js +1 -0
  68. package/assets/esri/core/workers/chunks/a7b3048c19348540e004.js +1 -0
  69. package/assets/esri/core/workers/chunks/a8ca4b116909e47722f9.js +1 -0
  70. package/assets/esri/core/workers/chunks/{101f776316a85b708927.js → a99070ec4c06c435b744.js} +1 -1
  71. package/assets/esri/core/workers/chunks/ab145d13932d87dd7bf9.js +1 -0
  72. package/assets/esri/core/workers/chunks/{77c15b1c2729c780f75a.js → aeeeb386134b341d7ad2.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{3ca759f72d3bb29e9ea9.js → af54b233f6d6ad70b4a3.js} +2 -2
  74. package/assets/esri/core/workers/chunks/b9146daae8457224fd08.js +1 -0
  75. package/assets/esri/core/workers/chunks/bcdd2e8841abcb4df6da.js +1 -0
  76. package/assets/esri/core/workers/chunks/be05cc0cdabd5e051045.js +1 -0
  77. package/assets/esri/core/workers/chunks/c5f5f37bef11c6fbdc40.js +1 -0
  78. package/assets/esri/core/workers/chunks/d414dba3179bcf75bc6b.js +1 -0
  79. package/assets/esri/core/workers/chunks/{b449d6bd5851187d419f.js → d6e5408f9fa6b4bcd118.js} +1 -1
  80. package/assets/esri/core/workers/chunks/d9fb500cbd0f04d219a3.js +1 -0
  81. package/assets/esri/core/workers/chunks/e0dd6789fb797e9b7206.js +1 -0
  82. package/assets/esri/core/workers/chunks/{6f271249e042086d5a16.js → e4e49deae8da74f629db.js} +1 -1
  83. package/assets/esri/core/workers/chunks/e5dcff7a4fa84ba09670.js +1 -0
  84. package/assets/esri/core/workers/chunks/{f508ccfde6425dabe9ac.js → ee0bf611d191103a7046.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{ed1fbc1bc8d50453e2f5.js → f793cd41fcd022baeea2.js} +1 -1
  86. package/assets/esri/core/workers/chunks/fad6a7bb82a0a2df726f.js +1 -0
  87. package/assets/esri/themes/base/widgets/_FeatureForm.scss +2 -84
  88. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -0
  89. package/assets/esri/themes/dark/main.css +1 -1
  90. package/assets/esri/themes/light/main.css +1 -1
  91. package/assets/esri/themes/light/view.css +1 -1
  92. package/chunks/arcade.js +1 -1
  93. package/config.js +1 -1
  94. package/core/Accessor.js +1 -1
  95. package/core/accessorSupport/diffUtils.js +1 -1
  96. package/core/has.js +1 -1
  97. package/core/number.js +1 -1
  98. package/core/reactiveUtils.js +1 -1
  99. package/core/sql/DateOnly.js +1 -1
  100. package/core/sql/WhereClause.js +1 -1
  101. package/core/sql.js +1 -1
  102. package/core/timeUtils.js +1 -1
  103. package/identity/IdentityForm.js +1 -1
  104. package/identity/IdentityModal.js +1 -1
  105. package/interfaces.d.ts +48 -203
  106. package/layers/LinkChartLayer.js +1 -1
  107. package/layers/OrientedImageryLayer.js +1 -1
  108. package/layers/SceneLayer.js +1 -1
  109. package/layers/graphics/applyEditsUtils.js +5 -0
  110. package/layers/graphics/editingSupport.js +1 -1
  111. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  112. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  113. package/layers/mixins/ArcGISImageService.js +1 -1
  114. package/layers/mixins/EditBusLayer.js +1 -1
  115. package/layers/orientedImagery/core/CameraOrientationLTP.js +1 -1
  116. package/layers/orientedImagery/core/ElevationSourceDefinitions.js +5 -0
  117. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  118. package/layers/orientedImagery/core/cameraOrientationFactory.js +1 -1
  119. package/layers/orientedImagery/core/utils.js +5 -0
  120. package/layers/orientedImagery/transformations/groundToImageUtils.js +1 -1
  121. package/layers/support/fieldProperties.js +1 -1
  122. package/layers/support/fieldUtils.js +1 -1
  123. package/layers/support/imageryRendererUtils.js +1 -1
  124. package/layers/support/kmlUtils.js +1 -1
  125. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  126. package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
  127. package/networks/Network.js +1 -1
  128. package/package.json +1 -1
  129. package/request.js +1 -1
  130. package/rest/featureService/FeatureService.js +1 -1
  131. package/rest/support/DirectionsFeatureSet.js +1 -1
  132. package/smartMapping/renderers/pieChart.js +1 -1
  133. package/smartMapping/renderers/relationship.js +1 -1
  134. package/smartMapping/renderers/support/utils.js +1 -1
  135. package/smartMapping/statistics/support/ageUtils.js +1 -1
  136. package/smartMapping/support/adapters/support/utils.js +1 -1
  137. package/smartMapping/support/utils.js +1 -1
  138. package/support/apiKeyUtils.js +1 -1
  139. package/support/arcadeUtils.js +1 -1
  140. package/support/revision.js +1 -1
  141. package/symbols/cim/cimAnalyzer.js +1 -1
  142. package/symbols/support/svgUtils.js +1 -1
  143. package/time/TimeReference.js +1 -1
  144. package/time/timeReferenceUtils.js +1 -1
  145. package/versionManagement/VersionManagementService.js +1 -1
  146. package/versionManagement/support/EditMomentStack.js +5 -0
  147. package/versionManagement/support/versionManagementUtils.js +1 -1
  148. package/views/2d/engine/Container.js +1 -1
  149. package/views/2d/engine/DisplayObject.js +1 -1
  150. package/views/2d/engine/ManagedCanvas.js +5 -0
  151. package/views/2d/engine/Stage.js +1 -1
  152. package/views/2d/engine/webgl/GroupContainer.js +1 -1
  153. package/views/2d/engine/webgl/Painter.js +1 -1
  154. package/views/2d/engine/webgl/WGLContainer.js +1 -1
  155. package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
  156. package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
  157. package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
  158. package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
  159. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  160. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  161. package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
  162. package/views/2d/layers/MediaLayerView2D.js +1 -1
  163. package/views/2d/layers/TileLayerView2D.js +1 -1
  164. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  165. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  166. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  167. package/views/2d/layers/graphics/BaseGraphicContainer.js +1 -1
  168. package/views/2d/layers/graphics/GraphicContainer.js +1 -1
  169. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  170. package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
  171. package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
  172. package/views/2d/layers/support/DisplayGL.js +1 -1
  173. package/views/2d/webglDeps.js +1 -1
  174. package/views/3d/glTF/loader.js +1 -1
  175. package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
  176. package/views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js +1 -1
  177. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  178. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  179. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  180. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  181. package/views/3d/layers/SceneLayerView3D.js +1 -1
  182. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  183. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  184. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  185. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  186. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  187. package/views/3d/layers/graphics/Labeler.js +1 -1
  188. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  189. package/views/3d/layers/i3s/featureEditing.js +1 -1
  190. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  191. package/views/3d/state/ViewStateManager.js +1 -1
  192. package/views/3d/support/buffer/glUtil.js +1 -1
  193. package/views/3d/support/engineContent/line.js +1 -1
  194. package/views/3d/support/viewpointUtils.js +1 -1
  195. package/views/3d/webgl-engine/Stage.js +1 -1
  196. package/views/3d/webgl-engine/effects/RenderPluginInput.js +1 -1
  197. package/views/3d/webgl-engine/effects/blit/Blit.js +5 -0
  198. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  199. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  200. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  201. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  202. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  203. package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
  204. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  205. package/views/3d/webgl-engine/lib/RenderSlot.js +1 -1
  206. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  207. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  208. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  209. package/views/3d/webgl-engine/lib/TextTextureFactory.js +1 -1
  210. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  211. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  212. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  213. package/views/3d/webgl-engine/lib/edgeRendering/edgeProcessing.js +1 -1
  214. package/views/View.js +1 -1
  215. package/views/interactive/tooltip/TooltipContentWithHelpMessage.js +1 -1
  216. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  217. package/views/interactive/tooltip/constraintUtils.js +1 -1
  218. package/views/interactive/tooltip/content/Fields.js +1 -1
  219. package/views/interactive/tooltip/content/TooltipContentDrawCircle.js +1 -1
  220. package/views/interactive/tooltip/content/TooltipContentDrawMesh.js +1 -1
  221. package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
  222. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  223. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  224. package/views/interactive/tooltip/content/TooltipContentDrawRectangle.js +1 -1
  225. package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
  226. package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
  227. package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
  228. package/views/interactive/tooltip/content/TooltipContentTransformAbsolute.js +1 -1
  229. package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
  230. package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
  231. package/views/interactive/tooltip/content/TooltipContentTranslateGraphic.js +1 -1
  232. package/views/interactive/tooltip/content/TooltipContentTranslateGraphicXY.js +1 -1
  233. package/views/interactive/tooltip/content/TooltipContentTranslateGraphicZ.js +1 -1
  234. package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
  235. package/views/interactive/tooltip/content/TooltipContentTranslateVertexXY.js +1 -1
  236. package/views/interactive/tooltip/content/TooltipContentTranslateVertexZ.js +1 -1
  237. package/views/support/angularMeasurementUtils.js +1 -1
  238. package/views/ui/UI.js +1 -1
  239. package/views/webgl/ShaderTranspiler.js +1 -1
  240. package/views/webgl/Texture.js +1 -1
  241. package/views/webgl/contextUtils.js +1 -1
  242. package/webmap/InitialViewProperties.js +1 -1
  243. package/widgets/AreaMeasurement2D.js +1 -1
  244. package/widgets/AreaMeasurement3D.js +1 -1
  245. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  246. package/widgets/Attachments.js +1 -1
  247. package/widgets/Attribution.js +1 -1
  248. package/widgets/BasemapGallery.js +1 -1
  249. package/widgets/BasemapLayerList.js +1 -1
  250. package/widgets/BasemapToggle.js +1 -1
  251. package/widgets/Bookmarks.js +1 -1
  252. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  253. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
  254. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  255. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  256. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  257. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  258. package/widgets/BuildingExplorer.js +1 -1
  259. package/widgets/Compass.js +1 -1
  260. package/widgets/CoordinateConversion.js +1 -1
  261. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  262. package/widgets/Daylight.js +1 -1
  263. package/widgets/DirectLineMeasurement3D.js +1 -1
  264. package/widgets/DirectionalPad.js +1 -1
  265. package/widgets/Directions/components/SaveLayer.js +1 -1
  266. package/widgets/Directions.js +1 -1
  267. package/widgets/DistanceMeasurement2D.js +1 -1
  268. package/widgets/Editor/components/FooterActions.js +1 -1
  269. package/widgets/Editor/components/Notices.js +1 -1
  270. package/widgets/Editor/components/PanelContent.js +1 -1
  271. package/widgets/Editor/components/PanelToolbar.js +1 -1
  272. package/widgets/Editor/components/Prompt.js +1 -1
  273. package/widgets/Editor/components/Settings.js +1 -1
  274. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  275. package/widgets/Editor/components/UploadDetails.js +1 -1
  276. package/widgets/Editor.js +1 -1
  277. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  278. package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
  279. package/widgets/ElevationProfile/components/Statistics.js +1 -1
  280. package/widgets/ElevationProfile.js +1 -1
  281. package/widgets/Expand.js +1 -1
  282. package/widgets/Feature/FeatureContent.js +1 -1
  283. package/widgets/Feature/FeatureExpression.js +1 -1
  284. package/widgets/Feature/FeatureFields.js +1 -1
  285. package/widgets/Feature/FeatureMedia.js +1 -1
  286. package/widgets/Feature/FeatureRelationship.js +1 -1
  287. package/widgets/Feature/FeatureViewModel.js +1 -1
  288. package/widgets/Feature/support/FeatureContentMixin.js +1 -1
  289. package/widgets/Feature/support/FeatureElementInfo.js +1 -1
  290. package/widgets/Feature.js +1 -1
  291. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  292. package/widgets/FeatureForm/GroupInput.js +1 -1
  293. package/widgets/FeatureForm/css.js +1 -1
  294. package/widgets/FeatureForm.js +1 -1
  295. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  296. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  297. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  298. package/widgets/FeatureTable.js +1 -1
  299. package/widgets/FeatureTemplates/ItemList.js +1 -1
  300. package/widgets/FeatureTemplates.js +1 -1
  301. package/widgets/Features/FeaturesRelatedRecords.js +1 -1
  302. package/widgets/Features.js +1 -1
  303. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  304. package/widgets/FloorFilter.js +1 -1
  305. package/widgets/Fullscreen.js +1 -1
  306. package/widgets/Histogram.js +1 -1
  307. package/widgets/HistogramRangeSlider.js +1 -1
  308. package/widgets/Home.js +1 -1
  309. package/widgets/LayerList/ListItemPanel.js +1 -1
  310. package/widgets/LayerList.js +1 -1
  311. package/widgets/Legend/LegendViewModel.js +1 -1
  312. package/widgets/Legend/styles/Card.js +1 -1
  313. package/widgets/Legend/styles/Classic.js +1 -1
  314. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  315. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  316. package/widgets/LineOfSight.js +1 -1
  317. package/widgets/Locate.js +1 -1
  318. package/widgets/NavigationToggle.js +1 -1
  319. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  320. package/widgets/OrientedImageryViewer.js +1 -1
  321. package/widgets/Popup.js +1 -1
  322. package/widgets/Print.js +1 -1
  323. package/widgets/ScaleRangeSlider/scalePreviewUtils.js +1 -1
  324. package/widgets/ScaleRangeSlider.js +1 -1
  325. package/widgets/Search/SearchResultRenderer.js +1 -1
  326. package/widgets/Search.js +1 -1
  327. package/widgets/ShadowCast/components/DiscreteConfigurator.js +1 -1
  328. package/widgets/ShadowCast/components/DurationConfigurator.js +1 -1
  329. package/widgets/ShadowCast/components/ShadowTooltipContent.js +1 -1
  330. package/widgets/ShadowCast/components/ThresholdConfigurator.js +1 -1
  331. package/widgets/ShadowCast.js +1 -1
  332. package/widgets/Sketch.js +1 -1
  333. package/widgets/Slice.js +1 -1
  334. package/widgets/Slider.js +1 -1
  335. package/widgets/Swipe.js +1 -1
  336. package/widgets/TableList.js +1 -1
  337. package/widgets/TimeSlider.js +1 -1
  338. package/widgets/Track.js +1 -1
  339. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +1 -1
  340. package/widgets/UtilityNetworkAssociations.js +1 -1
  341. package/widgets/UtilityNetworkTrace.js +1 -1
  342. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  343. package/widgets/ValuePicker.js +1 -1
  344. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  345. package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
  346. package/widgets/VideoPlayer.js +1 -1
  347. package/widgets/Weather/LabeledSlider.js +1 -1
  348. package/widgets/Weather.js +1 -1
  349. package/widgets/Zoom/IconButton.js +1 -1
  350. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  351. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  352. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  353. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  354. package/widgets/smartMapping/ColorSlider.js +1 -1
  355. package/widgets/smartMapping/HeatmapSlider.js +1 -1
  356. package/widgets/smartMapping/OpacitySlider.js +1 -1
  357. package/widgets/smartMapping/SizeSlider.js +1 -1
  358. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  359. package/widgets/support/ColorPicker.js +1 -1
  360. package/widgets/support/DatePicker.js +1 -1
  361. package/widgets/support/Heading.js +1 -1
  362. package/widgets/support/LabeledSwitch.js +1 -1
  363. package/widgets/support/MeasurementWidgetContent.js +1 -1
  364. package/widgets/support/Popover.js +1 -1
  365. package/widgets/support/SelectionToolbar.js +1 -1
  366. package/widgets/support/SketchTooltipControls.js +1 -1
  367. package/widgets/support/SnappingControls.js +1 -1
  368. package/widgets/support/TimePicker.js +1 -1
  369. package/widgets/support/TimezonePicker.js +1 -1
  370. package/widgets/support/UnitSelect.js +1 -1
  371. package/widgets/support/dateUtils.js +1 -1
  372. package/assets/esri/core/workers/chunks/072b4e041b8630c513a0.js +0 -1
  373. package/assets/esri/core/workers/chunks/092920c25cac89c038ee.js +0 -1
  374. package/assets/esri/core/workers/chunks/114269dda1d296893908.js +0 -1
  375. package/assets/esri/core/workers/chunks/126df6237fc80608344e.js +0 -1
  376. package/assets/esri/core/workers/chunks/1b3655f5bf5d90fa8730.js +0 -1
  377. package/assets/esri/core/workers/chunks/1c83f47d446f2bca1721.js +0 -1
  378. package/assets/esri/core/workers/chunks/1cf7bb514e7eefc3e9c6.js +0 -1
  379. package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +0 -1
  380. package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +0 -1
  381. package/assets/esri/core/workers/chunks/2a1c1be9c202462cf54d.js +0 -1
  382. package/assets/esri/core/workers/chunks/2cb36f9686693234991a.js +0 -1
  383. package/assets/esri/core/workers/chunks/2d0d03cbea83c868edba.js +0 -1
  384. package/assets/esri/core/workers/chunks/2e130cb2f1038055c07b.js +0 -1
  385. package/assets/esri/core/workers/chunks/3619e04cbb6691549014.js +0 -1
  386. package/assets/esri/core/workers/chunks/3dbfb4f370a874393822.js +0 -1
  387. package/assets/esri/core/workers/chunks/406db5c90271a3a203d4.js +0 -1
  388. package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +0 -1
  389. package/assets/esri/core/workers/chunks/4f4a424d1747d04501df.js +0 -1
  390. package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +0 -1
  391. package/assets/esri/core/workers/chunks/5a5720caa64a46daadf9.js +0 -1
  392. package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +0 -1
  393. package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +0 -1
  394. package/assets/esri/core/workers/chunks/650a317b6dc245a7060f.js +0 -1
  395. package/assets/esri/core/workers/chunks/7a358b1fd0c0cce59e9b.js +0 -1
  396. package/assets/esri/core/workers/chunks/83d1a1b3d371c991cc4c.js +0 -1
  397. package/assets/esri/core/workers/chunks/846b7a81b870c8b238a1.js +0 -1
  398. package/assets/esri/core/workers/chunks/8ab832468300cc4feb5a.js +0 -1
  399. package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +0 -1
  400. package/assets/esri/core/workers/chunks/bc6323bdc98013da6fe5.js +0 -1
  401. package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +0 -1
  402. package/assets/esri/core/workers/chunks/c60cf62f374e71e562fc.js +0 -1
  403. package/assets/esri/core/workers/chunks/c6ea5aac232d1eca04dd.js +0 -1
  404. package/assets/esri/core/workers/chunks/c8438c2d9ac48afe4033.js +0 -1
  405. package/assets/esri/core/workers/chunks/c8f239c25fe864f0e47a.js +0 -1
  406. package/assets/esri/core/workers/chunks/cad260881653567bc8f9.js +0 -1
  407. package/assets/esri/core/workers/chunks/d824f4b405a72cd2fa74.js +0 -1
  408. package/assets/esri/core/workers/chunks/dd7508d4016715371e0c.js +0 -1
  409. package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +0 -1
  410. package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +0 -1
  411. package/assets/esri/core/workers/chunks/f38c54ada9e7012a2960.js +0 -1
  412. package/assets/esri/core/workers/chunks/f5e0ff5292b9fd18fc92.js +0 -1
  413. package/assets/esri/core/workers/chunks/f5eb8b5021620be7538e.js +0 -1
  414. package/core/watchUtils.d.ts +0 -4
  415. package/core/watchUtils.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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as l}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{someMap as a}from"../../../../core/MapUtils.js";import{disposeMaybe as r,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as n,isAbortError as c}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as u}from"../../../../chunks/vec2f64.js";import{hydrateGraphic as p}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as f,VisibilityFlag as m}from"./enums.js";import{make as x}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as _}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as L}from"./graphicSymbolUtils.js";import{LabelParameters as v}from"./LabelParameters.js";import{getLabelPlacement as T,LabelInfo as A}from"./labelPlacement.js";import{horizontalPlacementFromAnchor as D,verticalPlacementFromAnchor as G,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{MaterialCollection as I}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as R}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as S}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as P}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as E,Task as O}from"../../../support/Scheduler.js";class z{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.addedToTextureAtlas=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class V{constructor(e,t,s,l,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=l,this.labelFunction=i,this.calloutSymbolLayerIndex=0}}class F{constructor(e,t,s,l,i,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=l,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0,disableOctree:!0},t.uid)}destroy(){this.stageLayer.destroy()}}let M=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h((()=>this.view.state?.camera),(()=>this.setDirty())),h((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(E.LABELER,this)]),this._textTextureAtlas=new P({view:this.view}),this._hudMaterialCollection=new I(this.view._stage),this._calloutMaterialCollection=new I(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),H.graphic=null,H.renderingInfo=null,H.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l),t.setVisibilityFlag(f.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(f.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(this._textTextureAtlas.addTextTexture(s,t.stageObject),e.addedToTextureAtlas=!0)}}_removeLabelTextureFromAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];null!=s&&(this._textTextureAtlas.removeTextTexture(s,t.stageObject),e.addedToTextureAtlas=!1)}}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(U(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else a(t.labelsToInitialize,((s,l)=>(this._ensureGraphics3DResources(s)&&(this._labels.set(l,s),this.deconflictor.setDirty(),e.madeProgress()),(s.visible&&s.textInitialized||!s.visible&&s.hasGraphics3DResources)&&(t.labelsToInitialize.delete(l),e.madeProgress()),e.done)))&&(this._dirty=!0);this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),n(t),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,o=r.labelingInfo&&r.labelingInfo.filter((e=>!!e.symbol));if(!o||0===o.length)return;let c=!1;await s(o,(async(s,r)=>{const o=s.symbol,h=L(a.getOrCreateGraphics3DSymbol(o));if(null==h)return void i.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),n(t);let b=null;g(o)&&o.hasVisibleCallout()&&(b=x(o,a.symbolCreationContext),await b.load(),n(t));const d=await l(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(n(t),!0===d.ok){const l=await this._createTextRenderParameters(h.symbol);n(t),e.labelClassContexts[r]=new V(s,h,b,l,d.value)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`),c=!0})),n(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(c(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:S.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,l,i,a){const r=new v(s,D(s.anchor),G(s.anchor),e.text,u(e.displayWidth,e.displayHeight));return H.graphic=t,H.renderingInfo=null,H.layer=l,i.createLabel(H,r,this._hudMaterialCollection,this._textTextureAtlas,(()=>{const e=T(a);return e?e.elevationOffset:null}))}_createLineCalloutGraphic(e,t,s,l,i){H.graphic=e,H.layer=i;const a=l.screenOffset[0];return H.renderingInfo=new C(null,t,l.translation,l.centerOffset,a,l.centerOffsetUnits,l.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(H)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,l=s.labelClassContexts;if(k(l)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let i=!1;const a=t.graphic,r=s.layer,o=B(s.layer);for(let n=0;n<l.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=l[n],d=b.graphics3DSymbol,u=d.symbol&&"label-3d"===d.symbol.type?d.symbol:null,p=d.symbolLayers[0];if(!p)continue;p.setElevationInfoOverride(s.elevationInfoOverride);const y=new A(t,u,b.labelClass),g=this._createTextSymbolGraphic(c,a,h,r,p,y);if(null==g)return!1;g._labelClass=b.labelClass,g._labelIndex=n,t.addLabelGraphic(g,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(f.LABEL,m.USER,o),t.setVisibilityFlag(f.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(f.LABEL,m.DECONFLICTION,!1),i=!0;const x=b.graphics3DCalloutSymbolLayer;if(x&&h.hasLabelVerticalOffset){x.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,x,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return s.scaleVisibility&&i&&s.scaleVisibility.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const l=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?p(l,t.layer):l;n=o.evaluate(e)}catch(i){n=null}else n=o.evaluate(l);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol,h="label-3d"===c.symbol?.type?c.symbol:null;if(!c.symbolLayers[0])continue;const b=e.graphics3DGraphic,d=r.labelClass,u=t.disablePlacement,y=T({graphics3DGraphic:b,labelSymbol:h,labelClass:d,disablePlacement:u});if(null==y)continue;const g=D(y.anchor),f=w(g);e.textRenderers[a]=new R(n,f,r.textRenderParameters,this._textTextureAtlas.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l)}this.setDirty(),this.deconflictor.setDirty()}_removeGraphic(e,t){const s=t.graphic.uid,l=this._labels.get(s);e.graphics.delete(s),l&&(this._destroyGraphic(l,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const l=new Map;t.graphics.forEach((e=>l.set(e.graphic.uid,e)));const i=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,l,i),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,l,t)}}}_visibilityInfoChange(e){const t=B(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const l=this._labels.get(s);l&&(this._destroyGraphic(l,s),l.visible=!1,e.labelsToInitialize.set(s,l))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const l=s&&s.emptySymbolLabelSupported||!1,i=s&&s.elevationInfoOverride||null,a=s&&s.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new F(this.view._stage,r,e,t,l,i,a,B(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),featureReductionChange:()=>{},layerLabelsEnabled:()=>B(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),clear:()=>{}}}removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,l=this._labels.get(s);l&&l.visible!==t&&(t&&!l.addedToTextureAtlas?(this._addLabelTextureToAtlas(l),l.textInitialized||l.labelingContext.labelsToInitialize.set(s,l)):!t&&l.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(l),l.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>U(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(U(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function U(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([b({constructOnly:!0})],M.prototype,"view",void 0),e([b({constructOnly:!0})],M.prototype,"deconflictor",void 0),e([b()],M.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],M.prototype,"updating",null),M=e([d("esri.views.3d.layers.graphics.Labeler")],M);const H=new _(null,null,null);export{M as Labeler,B as areLabelsVisible};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as l}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{someMap as a}from"../../../../core/MapUtils.js";import{disposeMaybe as r,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as n,isAbortError as c}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as u}from"../../../../chunks/vec2f64.js";import{hydrateGraphic as p}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as f,VisibilityFlag as m}from"./enums.js";import{make as x}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as _}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as L}from"./graphicSymbolUtils.js";import{LabelParameters as v}from"./LabelParameters.js";import{getLabelPlacement as T,LabelInfo as A}from"./labelPlacement.js";import{horizontalPlacementFromAnchor as D,verticalPlacementFromAnchor as G,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{MaterialCollection as I}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as R}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as S}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as P}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as E,Task as O}from"../../../support/Scheduler.js";class z{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.addedToTextureAtlas=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class V{constructor(e,t,s,l,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=l,this.labelFunction=i,this.calloutSymbolLayerIndex=0}}class F{constructor(e,t,s,l,i,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=l,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0,disableOctree:!0},t.uid)}destroy(){this.stageLayer.destroy()}}let M=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h((()=>this.view.state?.camera),(()=>this.setDirty())),h((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(E.LABELER,this)]),this._textTextureAtlas=new P({view:this.view}),this._hudMaterialCollection=new I(this.view._stage),this._calloutMaterialCollection=new I(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),H.graphic=null,H.renderingInfo=null,H.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l),t.setVisibilityFlag(f.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(f.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(this._textTextureAtlas.addTextTexture(s,t.stageObject),e.addedToTextureAtlas=!0)}}_removeLabelTextureFromAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];null!=s&&(this._textTextureAtlas.removeTextTexture(s,t.stageObject),e.addedToTextureAtlas=!1)}}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(U(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else a(t.labelsToInitialize,((s,l)=>(this._ensureGraphics3DResources(s)&&(this._labels.set(l,s),this.deconflictor.setDirty(),e.madeProgress()),(s.visible&&s.textInitialized||!s.visible&&s.hasGraphics3DResources)&&(t.labelsToInitialize.delete(l),e.madeProgress()),e.done)))&&(this._dirty=!0);this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),n(t),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,o=r.labelingInfo&&r.labelingInfo.filter((e=>!!e.symbol));if(!o||0===o.length)return;let c=!1;await s(o,(async(s,r)=>{const o=s.symbol,h=L(a.getOrCreateGraphics3DSymbol(o));if(null==h)return void i.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),n(t);let b=null;g(o)&&o.hasVisibleCallout()&&(b=x(o,a.symbolCreationContext),await b.load(),n(t));const d=await l(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(n(t),!0===d.ok){const l=await this._createTextRenderParameters(h.symbol);n(t),e.labelClassContexts[r]=new V(s,h,b,l,d.value)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`),c=!0})),n(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(c(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:S.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,l,i,a){const r=new v(s,D(s.anchor),G(s.anchor),e.text,u(e.displayWidth,e.displayHeight));return H.graphic=t,H.renderingInfo=null,H.layer=l,i.createLabel(H,r,this._hudMaterialCollection,this._textTextureAtlas,(()=>{const e=T(a);return e?e.elevationOffset:null}))}_createLineCalloutGraphic(e,t,s,l,i){H.graphic=e,H.layer=i;const a=l.screenOffset[0];return H.renderingInfo=new C(null,t,l.translation,l.centerOffset,a,l.centerOffsetUnits,l.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(H)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,l=s.labelClassContexts;if(k(l)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let i=!1;const a=t.graphic,r=s.layer,o=B(s.layer);for(let n=0;n<l.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=l[n],d=b.graphics3DSymbol,u=d.symbol&&"label-3d"===d.symbol.type?d.symbol:null,p=d.symbolLayers[0];if(!p)continue;p.setElevationInfoOverride(s.elevationInfoOverride);const y=new A(t,u,b.labelClass),g=this._createTextSymbolGraphic(c,a,h,r,p,y);if(null==g)return!1;g._labelClass=b.labelClass,g._labelIndex=n,t.addLabelGraphic(g,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(f.LABEL,m.USER,o),t.setVisibilityFlag(f.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(f.LABEL,m.DECONFLICTION,!1),i=!0;const x=b.graphics3DCalloutSymbolLayer;if(x&&h.hasLabelVerticalOffset){x.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,x,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return s.scaleVisibility&&i&&s.scaleVisibility.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const l=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?p(l,t.layer):l;n=o.evaluate(e)}catch(i){n=null}else n=o.evaluate(l);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol,h="label-3d"===c.symbol?.type?c.symbol:null;if(!c.symbolLayers[0])continue;const b=e.graphics3DGraphic,d=r.labelClass,u=t.disablePlacement,y=T({graphics3DGraphic:b,labelSymbol:h,labelClass:d,disablePlacement:u});if(null==y)continue;const g=D(y.anchor),f=w(g);e.textRenderers[a]=new R(n,f,r.textRenderParameters,P.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l)}this.setDirty(),this.deconflictor.setDirty()}_removeGraphic(e,t){const s=t.graphic.uid,l=this._labels.get(s);e.graphics.delete(s),l&&(this._destroyGraphic(l,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const l=new Map;t.graphics.forEach((e=>l.set(e.graphic.uid,e)));const i=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,l,i),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,l,t)}}}_visibilityInfoChange(e){const t=B(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const l=this._labels.get(s);l&&(this._destroyGraphic(l,s),l.visible=!1,e.labelsToInitialize.set(s,l))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const l=s&&s.emptySymbolLabelSupported||!1,i=s&&s.elevationInfoOverride||null,a=s&&s.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new F(this.view._stage,r,e,t,l,i,a,B(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),featureReductionChange:()=>{},layerLabelsEnabled:()=>B(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),clear:()=>{}}}removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,l=this._labels.get(s);l&&l.visible!==t&&(t&&!l.addedToTextureAtlas?(this._addLabelTextureToAtlas(l),l.textInitialized||l.labelingContext.labelsToInitialize.set(s,l)):!t&&l.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(l),l.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>U(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(U(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function U(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([b({constructOnly:!0})],M.prototype,"view",void 0),e([b({constructOnly:!0})],M.prototype,"deconflictor",void 0),e([b()],M.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],M.prototype,"updating",null),M=e([d("esri.views.3d.layers.graphics.Labeler")],M);const H=new _(null,null,null);export{M as Labeler,B as areLabelsVisible};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{o as e,r as n,n as r}from"../../../../chunks/mat4.js";import{a as o}from"../../../../chunks/mat4f64.js";import{e as i,O as s}from"../../../../chunks/vec3f64.js";import{s as l}from"../../../../chunks/vec4.js";import{d as u,O as a}from"../../../../chunks/vec4f64.js";import{projectPoint as m}from"../../../../geometry/projection.js";import{width as c,depth as f,height as p}from"../../../../geometry/support/aaBoundingBox.js";import{create as h}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as g}from"../../../../geometry/support/centroid.js";import{getPointOnPath as y,getPathLength as d}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as x}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as j,clonePoint as b}from"../../../../layers/graphics/hydratedFeatures.js";import{VertexAttribute as v}from"../../webgl-engine/lib/VertexAttribute.js";function w(t,e){if("point"===t.type)return P(t,e,!1);if(j(t))switch(t.type){case"extent":return P(t.center,e,!1);case"polygon":return P(t.centroid,e,!1);case"polyline":return P(z(t),e,!0);case"mesh":return P(t.origin,e,!1)}else switch(t.type){case"extent":return P(A(t),e,!0);case"polygon":return P(M(t),e,!0);case"polyline":return P(z(t),e,!0)}}function z(t){const e=t.paths[0];if(!e||0===e.length)return null;const n=y(e,d(e)/2);return x(n[0],n[1],n[2],t.spatialReference)}function A(t){return x(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function M(t){const e=t.rings[0];if(!e||0===e.length)return null;const n=g(t.rings,!!t.hasZ);return x(n[0],n[1],n[2],t.spatialReference)}function P(t,e,n){const r=n?t:b(t);return e&&t?m(t,r,e)?r:null:r}function R(t,e,n,r=0){if(t){e||(e=h());const o=t;let i=.5*o.width*(n-1),s=.5*o.height*(n-1);return o.width<1e-7*o.height?i+=s/20:o.height<1e-7*o.width&&(s+=i/20),l(e,o.xmin-i-r,o.ymin-s-r,o.xmax+i+r,o.ymax+s+r),e}return null}function k(t,e){for(let n=0;n<t.geometries.length;++n){const r=t.geometries[n].getMutableAttribute(v.AUXPOS1);r&&r.data[3]!==e&&(r.data[3]=e,t.geometryVertexAttrsUpdated(t.geometries[n]))}}function F(t,e,n=null){const r=u(a);return null!=t&&(r[0]=t[0],r[1]=t[1],r[2]=t[2]),null!=e?r[3]=e:null!=t&&t.length>3&&(r[3]=t[3]),n&&(r[0]*=n,r[1]*=n,r[2]*=n,r[3]*=n),r}function U(t,e,n,r,o,i=[0,0,0,0]){for(let s=0;s<3;++s)null!=t&&null!=t[s]?i[s]=t[s]:null!=n&&null!=n[s]?i[s]=n[s]:i[s]=o[s];return i[3]=null!=e?e:null!=r?r:o[3],i}function B(t=s,e,n,r=1){const o=new Array(3);if(null==e||null==n)o[0]=1,o[1]=1,o[2]=1;else{let r,i=0;for(let s=2;s>=0;s--){const l=t[s];let u;const a=null!=l,m=0===s&&!r&&!a,c=n[s];"symbol-value"===l||m?u=0!==c?e[s]/c:1:a&&"proportional"!==l&&isFinite(l)&&(u=0!==c?l/c:1),null!=u&&(o[s]=u,r=u,i=Math.max(i,Math.abs(u)))}for(let t=2;t>=0;t--)null==o[t]?o[t]=r:0===o[t]&&(o[t]=.001*i)}for(let i=2;i>=0;i--)o[i]/=r;return i(o)}function D(t){return null!=t.isPrimitive}function I(t){return O(D(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function O(t){const e=t=>null==t||t>=0;return Array.isArray(t)?t.every(e):e(t)}function S(t,i,s,l=o()){return t&&e(l,l,-t/180*Math.PI),i&&n(l,l,i/180*Math.PI),s&&r(l,l,s/180*Math.PI),l}function V(e,n,r){if(null!=r.minDemResolution)return r.minDemResolution;const o=t(n),i=c(e)*o,s=f(e)*o,l=p(e)*(n.isGeographic?1:o);return 0===i&&0===s&&0===l?r.minDemResolutionForPoints:.01*Math.max(i,s,l)}export{w as computeCentroid,S as computeObjectRotation,B as computeObjectScale,V as demResolutionForBoundingBox,R as enlargeExtent,O as isValidSize,F as mixinColorAndOpacity,U as overrideColor,k as updateVertexAttributeAuxpos1w,I as validateSymbolLayerSize};
5
+ import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{o as e,r as n,n as r}from"../../../../chunks/mat4.js";import{a as o}from"../../../../chunks/mat4f64.js";import{e as i,O as s}from"../../../../chunks/vec3f64.js";import{s as l}from"../../../../chunks/vec4.js";import{d as u,O as a}from"../../../../chunks/vec4f64.js";import{projectPoint as m}from"../../../../geometry/projection.js";import{width as c,depth as f,height as p}from"../../../../geometry/support/aaBoundingBox.js";import{create as h}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as g}from"../../../../geometry/support/centroid.js";import{getPointOnPath as y,getPathLength as d}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as x}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as j,clonePoint as b}from"../../../../layers/graphics/hydratedFeatures.js";import{VertexAttribute as v}from"../../webgl-engine/lib/VertexAttribute.js";function w(t,e){if("point"===t.type)return M(t,e,!1);if(j(t))switch(t.type){case"extent":return M(t.center,e,!1);case"polygon":return M(t.centroid,e,!1);case"polyline":return M(A(t),e,!0);case"mesh":return M(t.origin,e,!1)}else switch(t.type){case"extent":return M(P(t),e,!0);case"polygon":return M(z(t),e,!0);case"polyline":return M(A(t),e,!0)}}function A(t){const e=t.paths[0];if(!e||0===e.length)return null;const n=y(e,d(e)/2);return x(n[0],n[1],n[2],t.spatialReference)}function P(t){return x(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function z(t){const e=t.rings[0];if(!e||0===e.length)return null;const n=g(t.rings,!!t.hasZ);return x(n[0],n[1],n[2],t.spatialReference)}function M(t,e,n){const r=n?t:b(t);return e&&t?m(t,r,e)?r:null:r}function R(t,e,n,r=0){if(t){e||(e=h());const o=t;let i=.5*o.width*(n-1),s=.5*o.height*(n-1);return o.width<1e-7*o.height?i+=s/20:o.height<1e-7*o.width&&(s+=i/20),l(e,o.xmin-i-r,o.ymin-s-r,o.xmax+i+r,o.ymax+s+r),e}return null}function k(t,e){for(let n=0;n<t.geometries.length;++n){const r=t.geometries[n].getMutableAttribute(v.AUXPOS1);r&&r.data[3]!==e&&(r.data[3]=e,t.geometryVertexAttributeUpdated(t.geometries[n],v.AUXPOS1))}}function F(t,e,n=null){const r=u(a);return null!=t&&(r[0]=t[0],r[1]=t[1],r[2]=t[2]),null!=e?r[3]=e:null!=t&&t.length>3&&(r[3]=t[3]),n&&(r[0]*=n,r[1]*=n,r[2]*=n,r[3]*=n),r}function U(t,e,n,r,o,i=[0,0,0,0]){for(let s=0;s<3;++s)null!=t&&null!=t[s]?i[s]=t[s]:null!=n&&null!=n[s]?i[s]=n[s]:i[s]=o[s];return i[3]=null!=e?e:null!=r?r:o[3],i}function O(t=s,e,n,r=1){const o=new Array(3);if(null==e||null==n)o[0]=1,o[1]=1,o[2]=1;else{let r,i=0;for(let s=2;s>=0;s--){const l=t[s];let u;const a=null!=l,m=0===s&&!r&&!a,c=n[s];"symbol-value"===l||m?u=0!==c?e[s]/c:1:a&&"proportional"!==l&&isFinite(l)&&(u=0!==c?l/c:1),null!=u&&(o[s]=u,r=u,i=Math.max(i,Math.abs(u)))}for(let t=2;t>=0;t--)null==o[t]?o[t]=r:0===o[t]&&(o[t]=.001*i)}for(let i=2;i>=0;i--)o[i]/=r;return i(o)}function B(t){return null!=t.isPrimitive}function D(t){return I(B(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function I(t){const e=t=>null==t||t>=0;return Array.isArray(t)?t.every(e):e(t)}function S(t,i,s,l=o()){return t&&e(l,l,-t/180*Math.PI),i&&n(l,l,i/180*Math.PI),s&&r(l,l,s/180*Math.PI),l}function V(e,n,r){if(null!=r.minDemResolution)return r.minDemResolution;const o=t(n),i=c(e)*o,s=f(e)*o,l=p(e)*(n.isGeographic?1:o);return 0===i&&0===s&&0===l?r.minDemResolutionForPoints:.01*Math.max(i,s,l)}export{w as computeCentroid,S as computeObjectRotation,O as computeObjectScale,V as demResolutionForBoundingBox,R as enlargeExtent,I as isValidSize,F as mixinColorAndOpacity,U as overrideColor,k as updateVertexAttributeAuxpos1w,D as validateSymbolLayerSize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{clone as t}from"../../../../core/lang.js";import{attributeLookup as e}from"../support/attributeUtils.js";const n={setAttribute(){},rollback(){},commit(){}};var r;function o(e,o){const s=o.attributes[e.objectIdField];if(null==s)return n;const l=e.sessions.get(s);if(l)return l;const u=t(o.attributes),i=new Set,a=e.i3sOverrides.createInteractiveEditSession(s),d=new Map,c=(t,e)=>{const n=d.get(t);if(null==n){const n=e.indexOf(s);return d.set(t,n),n}return n};let f=r.EDITING;const b={setAttribute(t,n){if(f!==r.EDITING)return;const s=e.fieldsIndex.get(t);if(!s)return;const l=e.attributeStorageInfo.findIndex((t=>t.name===s.name));if(l<0)return;if(!(t in u))throw new Error(`Attribute "${t}" is not an attribute of the edited feature.`);a.setAttribute(l,n);const d=e.attributeStorageInfo[l];let b=!1;i.add(t),e.forEachNode(((t,r)=>{const s=c(t,r);if(-1===s)return;const l=e.getAttributeData(t.index);if(l){const r=l[d.name];r&&(r[s]=n,e.setAttributeData(t.index,l,o),b=!0)}})),b&&e.clearMemCache()},rollback(){if(f===r.EDITING){for(const t of i)this.setAttribute(t,u[t]);a.remove(),f=r.ROLLED_BACK,e.sessions.delete(s)}},commit(){f===r.EDITING&&(a.remove(),f=r.COMMITTED,e.sessions.delete(s))}};return e.sessions.set(s,b),b}function s(t,n){const r=t.fieldsIndex,o=t.objectIdField,s=t.globalIdField;if(null==s)return;const l=new Map,u=f(n.addedFeatures),i=n.edits.addFeatures,a=b(n.updatedFeatures),d=n.edits.updateFeatures,I=c(r,o,s,n.edits?.deleteFeatures),g=b(n.deletedFeatures,I),m=n.edits.deleteFeatures;if(null!=i&&i.length>0)for(const c of i){const t=e(r,c.attributes,s),n=u.get(t);null!=c.geometry&&"mesh"===c.geometry.type&&null!=n&&l.set(n,c.geometry)}if(null!=d&&d.length>0)for(const c of d){const t=e(r,c.attributes,o);null!=c.geometry&&"mesh"===c.geometry.type&&a.has(t)&&l.set(t,c.geometry)}if(null!=m&&m.length>0)for(const c of m){let t=null;t="attributes"in c?e(r,c.attributes,o):c.objectId,null!=t&&g.has(t)&&l.set(t,null)}for(const[e,c]of l)t.i3sOverrides.updateGeometry(e,c)}function l(t,e){const n=i(t,e),r=u(t,e);if(0===n.size&&0===r.size)return;const o=new Map;for(let u=0;u<t.attributeStorageInfo.length;u++)o.set(t.attributeStorageInfo[u].name,u);let s=!1;n.forEach(((e,n)=>{const r=t.getAttributeData(n);let l=!1;e.forEach(((e,n)=>{const u=null!=r?r[n]:null,i=o.get(n);for(const{featureIndex:r,value:o,featureId:a}of e)u&&(u[r]=o,l=!0,s=!0),t.i3sOverrides.updateAttributeValue(a,i,o)})),l&&t.setAttributeData(n,r,null)})),s&&t.clearMemCache();const{fieldsIndex:l,i3sOverrides:a,objectIdField:d,globalIdField:c}=t,f=a.layer.associatedLayer?.infoFor3D,b=new Set(f?[...Object.values(f.assetMapFieldRoles),...Object.values(f.transformFieldRoles)]:[]);for(const[u,i]of r){a.featureAdded(u);const{attributes:t}=i;for(const e in t){if(e!==d&&e!==c&&b.has(e))continue;const n=l.normalizeFieldName(e),r=null!=n?o.get(n):null;if(null==r)continue;const s=t[e];a.updateAttributeValue(u,r,s)}}}function u(t,{edits:n,addedFeatures:r}){const o=new Map,s=n.addAssetFeatures,{fieldsIndex:l,globalIdField:u}=t;if(!s||0===s.length||null==u)return o;const i=f(r);for(const a of s){const t=e(l,a.attributes,u),n=i.get(t);null!=a.geometry&&"mesh"===a.geometry.type&&null!=n&&o.set(n,a)}return o}function i(t,n){const r=n.edits.updateFeatures;if(!r||0===r.length)return new g;const o=b(n.updatedFeatures),s=new g,l=new Map;for(let e=0;e<t.attributeStorageInfo.length;e++)l.set(t.attributeStorageInfo[e].name,e);const u=t.fieldsIndex,i=t.objectIdField,d=r.filter((t=>{const n=e(u,t.attributes,i);return o.has(n)}));return t.forEachNode(((n,r)=>{const o=new Set(r);for(const l of d){const d=e(u,l.attributes,i);if(!o.has(d))continue;const c=r.indexOf(d);for(const e in l.attributes){const r=t.fieldsIndex.normalizeFieldName(e),o=a(s,n.index,r),u=l.attributes[e];o.push({featureIndex:c,featureId:d,value:u})}}})),s}function a(t,e,n){const r=d(t,e),o=null!=n&&r.get(n);if(o)return o;const s=new Array;return r.set(n,s),s}function d(t,e){const n=t.get(e);if(n)return n;const r=new I;return t.set(e,r),r}function c(t,n,r,o){const s=new Map;if(!o)return s;for(const l of o){let o=null,u=null;"attributes"in l?(o=e(t,l.attributes,n),u=e(t,l.attributes,r)):(o=l.objectId,u=l.globalId),null!=u&&null!=o&&s.set(u,o)}return s}function f(t){const e=new Map;if(!t)return e;for(const n of t)null!=n.globalId&&null!=n.objectId&&null==n.error&&e.set(n.globalId,n.objectId);return e}function b(t,e=null){const n=new Set;if(!t)return n;for(const r of t)if(null==r.error)if(null!=r.objectId&&-1!==r.objectId)n.add(r.objectId);else if(null!=r.globalId&&null!=e){const t=e.get(r.globalId);null!=t&&n.add(t)}return n}!function(t){t[t.EDITING=0]="EDITING",t[t.ROLLED_BACK=1]="ROLLED_BACK",t[t.COMMITTED=2]="COMMITTED"}(r||(r={}));const I=Map,g=Map;export{o as createInteractiveEditSession,l as processAttributeEdits,s as processGeometryEdits};
5
+ import{resultOrAbort as e}from"../../../../core/asyncUtils.js";import{clone as t}from"../../../../core/lang.js";import{queryAllJSON as n}from"../../../../layers/support/featureQueryAll.js";const o={setAttribute(){},rollback(){},commit(){}};var r;function i(e,n){const i=n.attributes[e.objectIdField];if(null==i)return o;const s=e.sessions.get(i);if(s)return s;const l=t(n.attributes),a=new Set,u=e.i3sOverrides.createInteractiveEditSession(i),d=new Map,f=(e,t)=>{const n=d.get(e);if(null==n){const n=t.indexOf(i);return d.set(e,n),n}return n};let c=r.EDITING;const I={setAttribute(t,o){if(c!==r.EDITING)return;const i=e.fieldsIndex.get(t);if(!i)return;const s=e.attributeStorageInfo.findIndex((e=>e.name===i.name));if(s<0)return;if(!(t in l))throw new Error(`Attribute "${t}" is not an attribute of the edited feature.`);u.setAttribute(s,o);const d=e.attributeStorageInfo[s];let I=!1;a.add(t),e.forEachNode(((t,r)=>{const i=f(t,r);if(-1===i)return;const s=e.getAttributeData(t.index);if(s){const r=s[d.name];r&&(r[i]=o,e.setAttributeData(t.index,s,n),I=!0)}})),I&&e.clearMemCache()},rollback(){if(c===r.EDITING){for(const e of a)this.setAttribute(e,l[e]);u.remove(),c=r.ROLLED_BACK,e.sessions.delete(i)}},commit(){c===r.EDITING&&(u.remove(),c=r.COMMITTED,e.sessions.delete(i))}};return e.sessions.set(i,I),I}function s(e,t,n){const{gidToFeatureInfo:o,oidToFeatureInfo:r,fieldsIndex:i,objectIdField:s,globalIdField:l,featureOrIdentifierList:a}=n;if(!n.featuresResolved&&null!=a){for(const e of a){const t={feature:null,oid:-1,gid:null};if("attributes"in e){t.feature=e;const n=e.attributes;if(null!=n)for(const e in n){if(-1!==t.oid&&null!=t.gid)break;const o=i.normalizeFieldName(e);o===s&&(t.oid=n[e]??-1),o===l&&(t.gid=n[e])}}else t.oid=e.objectId??-1,t.gid=e.globalId;null!=t.gid&&o.set(t.gid,t),-1!==t.oid&&r.set(t.oid,t)}n.featuresResolved=!0}return(-1!==e?r.get(e):null)??(null!=t?o.get(t):null)}function l(e,t,n,o,r=!0){const i=[],l={gidToFeatureInfo:new Map,oidToFeatureInfo:new Map,featuresResolved:null==n,fieldsIndex:e.fieldsIndex,objectIdField:e.objectIdField,globalIdField:e.globalIdField,featureOrIdentifierList:n};for(const a of t){if(null!=a.error)continue;const e=a.objectId??-1,t=a.globalId,n=(-1===e||r?s(e,t,l):null)??{feature:null,oid:e,gid:t},u={oid:-1===e?n.oid:e,gid:t??n.gid,feature:n.feature,result:a};if(i.push(u),-1===u.oid&&null!=u.gid){let e=o.get(u.gid);null==e&&(e=[],o.set(u.gid,e)),e.push(u)}}return i}async function a(e,t){const n=new Map,o=l(e,t.addedFeatures,t.edits?.addFeatures,n),r=l(e,t.updatedFeatures,t.edits?.updateFeatures,n),i=l(e,t.deletedFeatures,t.edits?.deleteFeatures,n,!1);return n.size>0&&await u(e,n),{adds:o.filter((e=>-1!==e.oid)),updates:r.filter((e=>-1!==e.oid)),deletes:i.filter((e=>-1!==e.oid))}}async function u(t,o){const r=t.i3sOverrides.layer.associatedLayer;if(null==r?.globalIdField)return;const i=r.createQuery(),{objectIdField:s,globalIdField:l}=r;i.where=Array.from(o.keys()).map((e=>`${l}='${e}'`)).join(" OR "),i.returnGeometry=!1,i.outFields=[s,l],i.cacheHint=!1;const a=await e(n(r,i));if(!a.ok)return;const u=a.value.features;for(const e of u){const t=e.attributes[l],n=e.attributes[s];if(null==t||null==n||-1===n)continue;const r=o.get(t);if(null!=r)for(const e of r)e.oid=n}}function d(e,t){const n=new Map,o=t.adds,r=t.updates,i=t.deletes;if(o.length>0)for(const s of o){const e=s.oid,t=s.feature;"mesh"===t?.geometry?.type&&n.set(e,t.geometry)}if(r.length>0)for(const s of r){const e=s.oid,t=s.feature;"mesh"===t?.geometry?.type&&n.set(e,t.geometry)}if(i.length>0)for(const s of i)n.set(s.oid,null);for(const[s,l]of n)e.i3sOverrides.updateGeometry(s,l)}function f(e,t){const n=I(e,t),o=c(e,t);if(0===n.size&&0===o.size)return;const r=new Map;for(let c=0;c<e.attributeStorageInfo.length;c++)r.set(e.attributeStorageInfo[c].name,c);let i=!1;n.forEach(((t,n)=>{const o=e.getAttributeData(n);let s=!1;t.forEach(((t,n)=>{const l=null!=o?o[n]:null,a=r.get(n);for(const{featureIndex:o,value:r,featureId:u}of t)l&&(l[o]=r,s=!0,i=!0),e.i3sOverrides.updateAttributeValue(u,a,r)})),s&&e.setAttributeData(n,o,null)})),i&&e.clearMemCache();const{fieldsIndex:s,i3sOverrides:l,objectIdField:a,globalIdField:u}=e,d=l.layer.associatedLayer?.infoFor3D,f=new Set(d?[...Object.values(d.assetMapFieldRoles),...Object.values(d.transformFieldRoles)]:[]);for(const[c,I]of o){l.featureAdded(c);const{attributes:e}=I;for(const t in e){if(t!==a&&t!==u&&f.has(t))continue;const n=s.normalizeFieldName(t),o=null!=n?r.get(n):null;if(null==o)continue;const i=e[t];l.updateAttributeValue(c,o,i)}}}function c(e,t){const n=new Map,o=t.adds;if(!o||0===o.length||null==e.globalIdField)return n;for(const r of o){const e=r.oid,t=r.feature;"mesh"===t?.geometry?.type&&n.set(e,t)}return n}function I(e,t){const n=t.updates;if(!n||0===n.length)return new p;const o=new p,r=new Map;for(let i=0;i<e.attributeStorageInfo.length;i++)r.set(e.attributeStorageInfo[i].name,i);return e.forEachNode(((t,r)=>{for(const i of n){if(null==i.feature)continue;const n=i.feature,s=i.oid,l=r.indexOf(s);for(const r in n.attributes){const i=e.fieldsIndex.normalizeFieldName(r),a=g(o,t.index,i),u=n.attributes[r];a.push({featureIndex:l,featureId:s,value:u})}}})),o}function g(e,t,n){const o=b(e,t),r=null!=n&&o.get(n);if(r)return r;const i=new Array;return o.set(n,i),i}function b(e,t){const n=e.get(t);if(n)return n;const o=new m;return e.set(t,o),o}!function(e){e[e.EDITING=0]="EDITING",e[e.ROLLED_BACK=1]="ROLLED_BACK",e[e.COMMITTED=2]="COMMITTED"}(r||(r={}));const m=Map,p=Map;export{i as createInteractiveEditSession,a as normalizeEditResultsEvent,f as processAttributeEdits,d as processGeometryEdits};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import o from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/unitUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a}from"../../../../chunks/vec3.js";import{c as l}from"../../../../chunks/vec3f64.js";import{empty as c,toRect as d,expandWithVec3 as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as m}from"../../../../geometry/support/aaBoundingRect.js";import{getMetersPerUnit as h}from"../../../../symbols/support/unitConversionUtils.js";import{newIntersector as u}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as f}from"../../webgl-engine/lib/IntersectorInterfaces.js";const _=1;let y=class extends(o.EventedMixin(t)){get spatialReference(){return this.view?.spatialReference}constructor(e){super(e),this._elevationOffset=0,this._layerHandlesKey="layerHandles"}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=u(this.view.state.viewingMode),this._intersector.options.store=f.MIN;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const t=this.stageLayer.events;this.addHandles([t.on("layerObjectAdded",(e=>this._objectChanged(e.object))),t.on("layerObjectRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryAdded",(e=>this._objectChanged(e.object))),t.on("objectGeometryRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryUpdated",(e=>this._objectChanged(e.object))),t.on("objectTransformation",(e=>this._objectChanged(e)))],this._layerHandlesKey)}dispose(){this.removeHandles(this._layerHandlesKey)}elevationInfoChanged(){const e=null!=this.layer?this.layer.elevationInfo:null;if(null!=e&&"on-the-ground"!==e.mode){const t=s(this.layer.spatialReference),o=h(e.unit??"meters");this._elevationOffset=(e.offset??0)*o/t}else this._elevationOffset=0}getElevation(e,t,o,s){if(b[0]=e,b[1]=t,b[2]=o,!this._renderCoordsHelper.toRenderCoords(b,s,b))return r.getLogger(this).error("could not project point for elevation alignment"),null;const n=this._elevationOffset,i=this._zmin+n,a=this._zmax+n;this._renderCoordsHelper.setAltitude(x,a,b),this._renderCoordsHelper.setAltitude(C,i,b);const l=e=>!!e.lastValidElevationBB;return this._intersector.reset(x,C,null),this._intersector.intersect(this._intersectLayers,null,_,null,l),this._intersector.results.min.getIntersectionPoint(b)?this._renderCoordsHelper.getAltitude(b):null}_objectChanged(e){const t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;c(g);const o=e.lastValidElevationBB;o.isEmpty()||this._expandExtent(t,o.min,o.max,g);const{min:r,max:s}=e.boundingVolumeWorldSpace;this._expandExtent(t,r,s,g),d(g,j),this._zmin=Math.min(this._zmin,g[2]),this._zmax=Math.max(this._zmax,g[5]),v.extent=j,v.spatialReference=t,this.emit("elevation-change",v),a(o.min,r),a(o.max,s)}_computeLayerExtent(e,t){return c(g),null!=e&&t.objects.forAll((t=>this._expandExtent(e,t.boundingVolumeWorldSpace.min,t.boundingVolumeWorldSpace.max,g))),g}_expandExtent(e,t,o,r){for(let s=0;s<8;++s)b[0]=1&s?t[0]:o[0],b[1]=2&s?t[1]:o[1],b[2]=4&s?t[2]:o[2],this._renderCoordsHelper.fromRenderCoords(b,b,e),p(r,b);return r}};e([n({constructOnly:!0})],y.prototype,"layer",void 0),e([n({constructOnly:!0})],y.prototype,"stageLayer",void 0),e([n({constructOnly:!0})],y.prototype,"view",void 0),e([n()],y.prototype,"spatialReference",null),y=e([i("esri.views.3d.layers.support.StageLayerElevationProvider")],y);const g=c(),j=m(),v={spatialReference:null,extent:j,context:"scene"},b=l(),x=l(),C=l();export{y as StageLayerElevationProvider};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import o from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/unitUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a}from"../../../../chunks/vec3.js";import{c as l}from"../../../../chunks/vec3f64.js";import{empty as c,toRect as d,expandWithVec3 as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as m}from"../../../../geometry/support/aaBoundingRect.js";import{getMetersPerUnit as h}from"../../../../symbols/support/unitConversionUtils.js";import{newIntersector as u}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as f}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{VertexAttribute as _}from"../../webgl-engine/lib/VertexAttribute.js";const y=1;let g=class extends(o.EventedMixin(t)){get spatialReference(){return this.view?.spatialReference}constructor(e){super(e),this._elevationOffset=0,this._layerHandlesKey="layerHandles"}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=u(this.view.state.viewingMode),this._intersector.options.store=f.MIN;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const t=this.stageLayer.events;this.addHandles([t.on("layerObjectAdded",(e=>this._objectChanged(e.object))),t.on("layerObjectRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryAdded",(e=>this._objectChanged(e.object))),t.on("objectGeometryRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryUpdated",(e=>e.attribute===_.POSITION&&this._objectChanged(e.object))),t.on("objectTransformation",(e=>this._objectChanged(e)))],this._layerHandlesKey)}dispose(){this.removeHandles(this._layerHandlesKey)}elevationInfoChanged(){const e=null!=this.layer?this.layer.elevationInfo:null;if(null!=e&&"on-the-ground"!==e.mode){const t=s(this.layer.spatialReference),o=h(e.unit??"meters");this._elevationOffset=(e.offset??0)*o/t}else this._elevationOffset=0}getElevation(e,t,o,s){if(x[0]=e,x[1]=t,x[2]=o,!this._renderCoordsHelper.toRenderCoords(x,s,x))return r.getLogger(this).error("could not project point for elevation alignment"),null;const i=this._elevationOffset,n=this._zmin+i,a=this._zmax+i;this._renderCoordsHelper.setAltitude(C,a,x),this._renderCoordsHelper.setAltitude(E,n,x);const l=e=>!!e.lastValidElevationBB;return this._intersector.reset(C,E,null),this._intersector.intersect(this._intersectLayers,null,y,null,l),this._intersector.results.min.getIntersectionPoint(x)?this._renderCoordsHelper.getAltitude(x):null}_objectChanged(e){const t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;c(j);const o=e.lastValidElevationBB;o.isEmpty()||this._expandExtent(t,o.min,o.max,j);const{min:r,max:s}=e.boundingVolumeWorldSpace;this._expandExtent(t,r,s,j),d(j,b),this._zmin=Math.min(this._zmin,j[2]),this._zmax=Math.max(this._zmax,j[5]),v.extent=b,v.spatialReference=t,this.emit("elevation-change",v),a(o.min,r),a(o.max,s)}_computeLayerExtent(e,t){return c(j),null!=e&&t.objects.forAll((t=>this._expandExtent(e,t.boundingVolumeWorldSpace.min,t.boundingVolumeWorldSpace.max,j))),j}_expandExtent(e,t,o,r){for(let s=0;s<8;++s)x[0]=1&s?t[0]:o[0],x[1]=2&s?t[1]:o[1],x[2]=4&s?t[2]:o[2],this._renderCoordsHelper.fromRenderCoords(x,x,e),p(r,x);return r}};e([i({constructOnly:!0})],g.prototype,"layer",void 0),e([i({constructOnly:!0})],g.prototype,"stageLayer",void 0),e([i({constructOnly:!0})],g.prototype,"view",void 0),e([i()],g.prototype,"spatialReference",null),g=e([n("esri.views.3d.layers.support.StageLayerElevationProvider")],g);const j=c(),b=m(),v={spatialReference:null,extent:b,context:"scene"},x=l(),C=l(),E=l();export{g as StageLayerElevationProvider};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import a from"../../../core/Accessor.js";import r from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as n,on as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{a as v}from"../../../chunks/vec3.js";import{e as u}from"../../../chunks/vec3f64.js";import{s as w}from"../../../chunks/vec4.js";import{c as g}from"../../../chunks/vec4f64.js";import y from"../../../geometry/Extent.js";import _ from"../../../geometry/Point.js";import{canProject as C}from"../../../geometry/support/webMercatorUtils.js";import{ViewingMode as f}from"../../ViewingMode.js";import{applyAll as R}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as x,surfaceElevationBelowRenderLocation as P}from"../camera/intersectionUtils.js";import{ConstraintsManager as S}from"./ConstraintsManager.js";import{Frustum as O}from"./Frustum.js";import{GoToOperation as T}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as b}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as I,externalToInternal as j,toExtent as z,distanceToScale as M,scaleToZoom as E,fromExtentSync as A,OrientationMode as H,getObserverForPointAtDistanceSync as N,scaleToDistance as V,zoomToScale as L}from"../support/cameraUtils.js";import{PropertiesPool as B}from"../support/PropertiesPool.js";import{fromCamera as D,toCameraSync as U}from"../support/viewpointUtils.js";import{Camera as k,PaddingSide as F}from"../webgl-engine/lib/Camera.js";import{RenderFeature as G}from"../webgl-engine/lib/RenderFeature.js";import{RenderState as q}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as W}from"../../webgl/FramebufferObject.js";let J=class extends a{get camera(){const e=this._get("camera");if(!this.ready)return e;const t=I(this.view,this.view.state.camera,Z);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableElevationCache(!0),this.setStateCamera(j(this.view,e),{applyConstraints:!1})||r.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableElevationCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=I(this.view,this.view.state.contentCamera,Z);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=j(this.view,e);null!=t?(this._updateElevation(t),this.view.state.contentCamera=t):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(ie),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,a=u(this.view.state.camera.center),r=e.sticky?this.contentCamera.clone():null;return this.addHandles([n((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(ie),this.test.contentCameraResetState.clear())})),n((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=r))})),n((()=>this.view.state.camera),(e=>{const t=v(a,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=r)}))],ie),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():r.getLogger(this).error("#center=","Invalid center",e):r.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):r.getLogger(this).error("#center=","Center may not be null or undefined"))}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=z(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||r.getLogger(this).error("#extent=","Invalid extent",e):r.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):r.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(this.ready){const e=this.view.pointsOfInterest.centerOnContent;return M(this.view,e.distance,e.location.latitude)}return this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||r.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,a=this._get("padding"),r=Math.round(t[F.TOP]/i),s=Math.round(t[F.RIGHT]/i),n=Math.round(t[F.BOTTOM]/i),o=Math.round(t[F.LEFT]/i);return null!=a&&a.top===r&&a.right===s&&a.bottom===n&&a.left===o?a:{top:r,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,ee),this.view.state.updateCamera((e=>e.padding=ee)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let a=0;a<4;a++)i[a]=Math.round(i[a]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?D(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||r.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;r.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else r.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?E(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||r.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view._stage.renderView.renderingContext.parameters.maxTextureSize;return W(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?._stage?.renderer.isFeatureEnabled(G.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?._stage?.renderer;return e&&(e.isFeatureEnabled(G.PhysicalPixelRendering,q.IDLE)||e.isFeatureEnabled(G.PhysicalPixelRendering,q.INTERACTING)||e.isFeatureEnabled(G.PhysicalPixelRendering,q.ANIMATING))}constructor(e){super(e),this.constraintsManager=null,this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._updatingIgnoreRenderState=!1,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},set updatingIgnoreRenderState(e){this.viewStateManager._updatingIgnoreRenderState=e},get updatingIgnoreRenderState(){return this.viewStateManager._updatingIgnoreRenderState||null!=this.renderState}},this._propertiesPool=new B({frustum:O},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new K}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([o((()=>this.view.state.events),"before-camera-change",(e=>e&&this._updateElevation(e))),n((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),n((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(te)})),o((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}init(){this.constraintsManager=new S({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===f.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(te),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),te)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(te),this.constraintsManager=s(this.constraintsManager))}async goTo(e,t){const i={animate:!0,...t};return null!=this._gotoOperation&&this._gotoOperation.abort(i.animate),this._gotoOperation=new T(e,i,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(x(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:a}of X){const r=e.has(i),s=this._isOverridden(i);!r&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(r||s)&&a.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(j(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=A(this.view,e.targetGeometry,0,.5,H.LOCKED);return void(null!=t&&this.setStateCamera(j(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const a=A(this.view,e,0,.5,H.LOCKED);null!=a&&this.setStateCamera(j(this.view,a),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Q.includes(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&C(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=Y){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=$){const{heading:a,tilt:r}=this._getPreservingHeadingTilt(),s=N(this.view,a,r,e,t,H.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.distance;return this._centerPointAtDistanceToCamera(e,i)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),a=A(this.view,e,t,i,H.ADJUST,Z);return a?j(this.view,a):null}_scaleToCamera(e){if(null==e)return null;const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.renderLocation,a=t.location.latitude;if(null==a)return null;const r=V(this.view,e,a);return this._centerPointAtDistanceToCamera(i,r)}_zoomToCamera(e){return this._scaleToCamera(L(this.view,e))}_viewpointToCamera(e){return j(this.view,U(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up):i.copyFrom(e),t.applyConstraints&&R(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new b({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||($.copyFrom(e),$.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,ee),$.padding=ee),$.fullWidth=i.width,$.fullHeight=i.height,$.pixelRatio=i.pixelRatio,this.view.state.camera=$),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain&&this.view.basemapTerrain.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,a=t?P(this.view,e.eye):0;e.relativeElevation=i-a}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=q.ANIMATING:this.view.interacting?this.view.state.mode=q.INTERACTING:(this.view.state.mode===q.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<=ae?this.view.state.mode=q.INTERACTING:this.view.state.mode=q.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],J.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],J.prototype,"contentCamera",null),e([m({type:_})],J.prototype,"center",null),e([m({type:y})],J.prototype,"extent",null),e([m({readOnly:!0})],J.prototype,"frustum",null),e([m()],J.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],J.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],J.prototype,"ready",void 0),e([m({type:Number})],J.prototype,"scale",null),e([m()],J.prototype,"padding",null),e([m({readOnly:!0})],J.prototype,"screenCenter",null),e([m({constructOnly:!0})],J.prototype,"view",void 0),e([m({type:i})],J.prototype,"viewpoint",null),e([m({type:Number})],J.prototype,"zoom",null),e([m({readOnly:!0})],J.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],J.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],J.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],J.prototype,"_windowDevicePixelRatio",void 0),e([m()],J.prototype,"_devicePixelRatioOverride",void 0),J=e([d("esri.views.3d.state.ViewStateManager")],J);class K{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Q=["camera","viewpoint","extent","scale","center","zoom"],X=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],Y={heading:0,tilt:0},Z=new t,$=new k,ee=g(),te="pending-initial-view",ie="content-camera-reset",ae=300,re=100;export{J as ViewStateManager,re as interactingTimeout};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import a from"../../../core/Accessor.js";import r from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as n,on as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{a as v}from"../../../chunks/vec3.js";import{e as u}from"../../../chunks/vec3f64.js";import{s as w}from"../../../chunks/vec4.js";import{c as g}from"../../../chunks/vec4f64.js";import y from"../../../geometry/Extent.js";import _ from"../../../geometry/Point.js";import{canProject as C}from"../../../geometry/support/webMercatorUtils.js";import{ViewingMode as f}from"../../ViewingMode.js";import{applyAll as R}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as x,surfaceElevationBelowRenderLocation as P}from"../camera/intersectionUtils.js";import{ConstraintsManager as S}from"./ConstraintsManager.js";import{Frustum as O}from"./Frustum.js";import{GoToOperation as T}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as b}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as I,externalToInternal as j,toExtent as z,distanceToScale as M,scaleToZoom as E,fromExtentSync as A,OrientationMode as H,getObserverForPointAtDistanceSync as N,scaleToDistance as V,zoomToScale as L}from"../support/cameraUtils.js";import{PropertiesPool as B}from"../support/PropertiesPool.js";import{fromCamera as D,toCameraSync as U}from"../support/viewpointUtils.js";import{Camera as k,PaddingSide as F}from"../webgl-engine/lib/Camera.js";import{RenderFeature as G}from"../webgl-engine/lib/RenderFeature.js";import{RenderState as q}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as W}from"../../webgl/FramebufferObject.js";let J=class extends a{get camera(){const e=this._get("camera");if(!this.ready)return e;const t=I(this.view,this.view.state.camera,Z);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableElevationCache(!0),this.setStateCamera(j(this.view,e),{applyConstraints:!1})||r.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableElevationCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=I(this.view,this.view.state.contentCamera,Z);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=j(this.view,e);null!=t?(this._updateElevation(t),this.view.state.contentCamera=t):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(ie),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,a=u(this.view.state.camera.center),r=e.sticky?this.contentCamera.clone():null;return this.addHandles([n((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(ie),this.test.contentCameraResetState.clear())})),n((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=r))})),n((()=>this.view.state.camera),(e=>{const t=v(a,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=r)}))],ie),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():r.getLogger(this).error("#center=","Invalid center",e):r.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):r.getLogger(this).error("#center=","Center may not be null or undefined"))}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=z(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||r.getLogger(this).error("#extent=","Invalid extent",e):r.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):r.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(this.ready){const e=this.view.pointsOfInterest.centerOnContent;return M(this.view,e.distance,e.location.latitude)}return this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||r.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,a=this._get("padding"),r=Math.round(t[F.TOP]/i),s=Math.round(t[F.RIGHT]/i),n=Math.round(t[F.BOTTOM]/i),o=Math.round(t[F.LEFT]/i);return null!=a&&a.top===r&&a.right===s&&a.bottom===n&&a.left===o?a:{top:r,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,ee),this.view.state.updateCamera((e=>e.padding=ee)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let a=0;a<4;a++)i[a]=Math.round(i[a]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?D(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||r.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;r.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else r.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?E(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||r.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view._stage.renderView.renderingContext.parameters.maxTextureSize;return W(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?._stage?.renderer.isFeatureEnabled(G.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?._stage?.renderer;return e&&(e.isFeatureEnabled(G.PhysicalPixelRendering,q.IDLE)||e.isFeatureEnabled(G.PhysicalPixelRendering,q.INTERACTING)||e.isFeatureEnabled(G.PhysicalPixelRendering,q.ANIMATING))}constructor(e){super(e),this.constraintsManager=null,this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._updatingIgnoreRenderState=!1,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},set updatingIgnoreRenderState(e){this.viewStateManager._updatingIgnoreRenderState=e},get updatingIgnoreRenderState(){return this.viewStateManager._updatingIgnoreRenderState||null!=this.renderState}},this._propertiesPool=new B({frustum:O},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new K}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([o((()=>this.view.state.events),"before-camera-change",(e=>e&&this._updateElevation(e))),n((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),n((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(te)})),o((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}init(){this.constraintsManager=new S({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===f.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(te),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),te)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(te),this.constraintsManager=s(this.constraintsManager))}async goTo(e,t){const i={animate:!0,...t};return null!=this._gotoOperation&&this._gotoOperation.abort(i.animate),this._gotoOperation=new T(e,i,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(x(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:a}of X){const r=e.has(i),s=this._isOverridden(i);!r&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(r||s)&&a.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(j(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=A(this.view,e.targetGeometry,0,.5,H.LOCKED);return void(null!=t&&this.setStateCamera(j(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const a=A(this.view,e,0,.5,H.LOCKED);null!=a&&this.setStateCamera(j(this.view,a),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Q.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&C(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=Y){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=$){const{heading:a,tilt:r}=this._getPreservingHeadingTilt(),s=N(this.view,a,r,e,t,H.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.distance;return this._centerPointAtDistanceToCamera(e,i)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),a=A(this.view,e,t,i,H.ADJUST,Z);return a?j(this.view,a):null}_scaleToCamera(e){if(null==e)return null;const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.renderLocation,a=t.location.latitude;if(null==a)return null;const r=V(this.view,e,a);return this._centerPointAtDistanceToCamera(i,r)}_zoomToCamera(e){return this._scaleToCamera(L(this.view,e))}_viewpointToCamera(e){return j(this.view,U(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up):i.copyFrom(e),t.applyConstraints&&R(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new b({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||($.copyFrom(e),$.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,ee),$.padding=ee),$.fullWidth=i.width,$.fullHeight=i.height,$.pixelRatio=i.pixelRatio,this.view.state.camera=$),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain&&this.view.basemapTerrain.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,a=t?P(this.view,e.eye):0;e.relativeElevation=i-a}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=q.ANIMATING:this.view.interacting?this.view.state.mode=q.INTERACTING:(this.view.state.mode===q.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<=ae?this.view.state.mode=q.INTERACTING:this.view.state.mode=q.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],J.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],J.prototype,"contentCamera",null),e([m({type:_})],J.prototype,"center",null),e([m({type:y})],J.prototype,"extent",null),e([m({readOnly:!0})],J.prototype,"frustum",null),e([m()],J.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],J.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],J.prototype,"ready",void 0),e([m({type:Number})],J.prototype,"scale",null),e([m()],J.prototype,"padding",null),e([m({readOnly:!0})],J.prototype,"screenCenter",null),e([m({constructOnly:!0})],J.prototype,"view",void 0),e([m({type:i})],J.prototype,"viewpoint",null),e([m({type:Number})],J.prototype,"zoom",null),e([m({readOnly:!0})],J.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],J.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],J.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],J.prototype,"_windowDevicePixelRatio",void 0),e([m()],J.prototype,"_devicePixelRatioOverride",void 0),J=e([d("esri.views.3d.state.ViewStateManager")],J);class K{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Q=new Set(["camera","viewpoint","extent","scale","center","zoom"]),X=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],Y={heading:0,tilt:0},Z=new t,$=new k,ee=g(),te="pending-initial-view",ie="content-camera-reset",ae=300,re=100;export{J as ViewStateManager,re as interactingTimeout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{DataType as t}from"../../../webgl/enums.js";import{VertexElementDescriptor as e}from"../../../webgl/VertexElementDescriptor.js";function r(t,r=0){const n=t.stride;return Array.from(t.fields.keys()).filter((e=>{const r=t.fields.get(e)?.optional;return!(r&&r.glPadding)})).map((i=>{const s=t.fields.get(i),f=s.constructor.ElementCount,l=o(s.constructor.ElementType),u=s.offset,c=!(!s.optional||!s.optional.glNormalized);return new e(i,f,l,u,n,c,r)}))}function o(t){const e=n[t];if(e)return e;throw new Error("BufferType not supported in WebGL")}const n={u8:t.UNSIGNED_BYTE,u16:t.UNSIGNED_SHORT,u32:t.UNSIGNED_INT,i8:t.BYTE,i16:t.SHORT,i32:t.INT,f32:t.FLOAT};export{r as glLayout};
5
+ import{DataType as e}from"../../../webgl/enums.js";import{VertexElementDescriptor as t}from"../../../webgl/VertexElementDescriptor.js";function r(e,r=0){const n=e.stride;return Array.from(e.fields.keys()).map((i=>{const s=e.fields.get(i),u=s.constructor.ElementCount,f=o(s.constructor.ElementType),c=s.offset,l=!(!s.optional||!s.optional.glNormalized);return new t(i,u,f,c,n,l,r)}))}function o(e){const t=n[e];if(t)return t;throw new Error("BufferType not supported in WebGL")}const n={u8:e.UNSIGNED_BYTE,u16:e.UNSIGNED_SHORT,u32:e.UNSIGNED_INT,i8:e.BYTE,i16:e.SHORT,i32:e.INT,f32:e.FLOAT};export{r as glLayout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{p as t}from"../../../../chunks/vec2.js";import{s as e}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{O as o}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as s}from"../../../../geometry/support/Indices.js";import{ViewingMode as l}from"../../../ViewingMode.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as p}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";function b(t,e,r=null){const o=[],n=e.mapPositions;g(e,o);const i=o[0][1].data,a=o[0][1].indices.length??0,u=s(a);return h(e,o,u),j(e,o,u),T(e,o,u),D(e,o,u),w(e,o,u),y(e,o,u),E(e,o,i),new f(t,o,n,p.Line,r)}function g(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=A(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),u=n?r.slice(0,-3):r;let s=0;for(let l=0;l<i-1;l++)a[s++]=l,a[s++]=l+1;e.push([m.POSITION,new c(u,a,3,n)])}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push([m.COLOR,new c(n??o,r,4)])}function T(t,e,r){t.attributeData.normal&&e.push([m.NORMAL,new c(t.attributeData.normal,r,3)])}function D(t,e,r){null!=t.attributeData.colorFeature&&e.push([m.COLORFEATUREATTRIBUTE,new c([t.attributeData.colorFeature],r,1,!0)])}function j(t,e,r){null==t.attributeData.sizeFeature&&e.push([m.SIZE,new c([t.attributeData.size??1],r,1,!0)])}function w(t,e,r){null!=t.attributeData.sizeFeature&&e.push([m.SIZEFEATUREATTRIBUTE,new c([t.attributeData.sizeFeature],r,1,!0)])}function y(t,e,r){null!=t.attributeData.opacityFeature&&e.push([m.OPACITYFEATUREATTRIBUTE,new c([t.attributeData.opacityFeature],r,1,!0)])}function E(r,o,s){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==l.Global||!r.overlayInfo.spatialReference.isGeographic)return;const p=a(s.length),f=n(r.overlayInfo.spatialReference);for(let t=0;t<p.length;t+=3)i(s,t,p,t,f);const b=s.length/3,g=u(b+1);let h=I,T=F,D=0,j=0;e(h,p[j++],p[j++],p[j++]),g[0]=0;for(let n=1;n<b+1;++n)n===b&&(j=0),e(T,p[j++],p[j++],p[j++]),D+=t(h,T),g[n]=D,[h,T]=[T,h];o.push([m.DISTANCETOSTART,new c(g,o[0][1].indices,1,!0)])}function A(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const I=r(),F=r();function R(t,e){if(null==t||0===t.length)return[];const r=[];return t.forEach((t=>{const o=t.length,n=a(3*o);t.forEach(((t,e)=>{n[3*e]=t[0],n[3*e+1]=t[1],n[3*e+2]=t[2]}));const i={attributeData:{position:n,normal:e},removeDuplicateStartEnd:!1};r.push(i)})),r}export{b as createGeometry,R as lineStripsToParameters};
5
+ import{p as t}from"../../../../chunks/vec2.js";import{s as e}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{O as o}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as s}from"../../../../geometry/support/Indices.js";import{ViewingMode as l}from"../../../ViewingMode.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as p}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";function b(t,e,r=null){const o=[],n=e.mapPositions;g(e,o);const i=o[0][1].data,a=o[0][1].indices.length,u=s(a);return h(e,o,u),j(e,o,u),T(e,o,u),D(e,o,u),w(e,o,u),y(e,o,u),E(e,o,i),new f(t,o,n,p.Line,r)}function g(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=A(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),u=n?r.slice(0,-3):r;let s=0;for(let l=0;l<i-1;l++)a[s++]=l,a[s++]=l+1;e.push([m.POSITION,new c(u,a,3,n)])}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push([m.COLOR,new c(n??o,r,4)])}function T(t,e,r){t.attributeData.normal&&e.push([m.NORMAL,new c(t.attributeData.normal,r,3)])}function D(t,e,r){null!=t.attributeData.colorFeature&&e.push([m.COLORFEATUREATTRIBUTE,new c([t.attributeData.colorFeature],r,1,!0)])}function j(t,e,r){null==t.attributeData.sizeFeature&&e.push([m.SIZE,new c([t.attributeData.size??1],r,1,!0)])}function w(t,e,r){null!=t.attributeData.sizeFeature&&e.push([m.SIZEFEATUREATTRIBUTE,new c([t.attributeData.sizeFeature],r,1,!0)])}function y(t,e,r){null!=t.attributeData.opacityFeature&&e.push([m.OPACITYFEATUREATTRIBUTE,new c([t.attributeData.opacityFeature],r,1,!0)])}function E(r,o,s){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==l.Global||!r.overlayInfo.spatialReference.isGeographic)return;const p=a(s.length),f=n(r.overlayInfo.spatialReference);for(let t=0;t<p.length;t+=3)i(s,t,p,t,f);const b=s.length/3,g=u(b+1);let h=I,T=F,D=0,j=0;e(h,p[j++],p[j++],p[j++]),g[0]=0;for(let n=1;n<b+1;++n)n===b&&(j=0),e(T,p[j++],p[j++],p[j++]),D+=t(h,T),g[n]=D,[h,T]=[T,h];o.push([m.DISTANCETOSTART,new c(g,o[0][1].indices,1,!0)])}function A(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const I=r(),F=r();function R(t,e){if(null==t||0===t.length)return[];const r=[];return t.forEach((t=>{const o=t.length,n=a(3*o);t.forEach(((t,e)=>{n[3*e]=t[0],n[3*e+1]=t[1],n[3*e+2]=t[2]}));const i={attributeData:{position:n,normal:e},removeDuplicateStartEnd:!1};r.push(i)})),r}export{b as createGeometry,R as lineStripsToParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../Camera.js";import"../../../geometry.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as o}from"../../../core/Cyclical.js";import r from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{f as s,t as c}from"../../../chunks/mat3.js";import{a as l}from"../../../chunks/mat3f64.js";import{a as m}from"../../../chunks/mat4f64.js";import{i as u,g as f,o as p,c as g,f as h,s as y,t as d}from"../../../chunks/vec3.js";import{c as w}from"../../../chunks/vec3f64.js";import{project as x,projectWithZConversion as j}from"../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as v}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorWithEngine as b}from"../../../geometry/projection/projectPointToVectorWithEngine.js";import{projectVectorToPoint as R}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as G,empty as S,center as B,toRect as T,isPoint as M,expandWithVec3 as A,expandWithAABB as E,width as Z,height as k,depth as F}from"../../../geometry/support/aaBoundingBox.js";import{create as O,isPoint as P}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as D}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as U}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as V}from"../camera/intersectionUtils.js";import{getViewSR as C,fromExtentSync as I,fromExtentAsync as J,internalToExternal as K,OrientationMode as L,scaleToDistance as N,fromCenterDistanceSync as W,fromCenterDistanceAsync as Y,externalToInternal as q,computeScale as X,distanceToScale as _,fromCenterScale as H,directionToHeadingTilt as Q,zoomToScale as $}from"./cameraUtils.js";import{getElevationAtPoint as tt}from"./ElevationProvider.js";import et from"../../../geometry/Point.js";import nt from"../../../geometry/Extent.js";import at from"../../../geometry/SpatialReference.js";import ot from"../../../geometry/Geometry.js";import rt from"../../../geometry/Multipoint.js";const it=.66;function st(t){return 360-o.normalize(t)}function ct(t){return o.normalize(360-t)}function lt(t,e,n){const a=e.camera;if(null!=a)return ut(a,C(t));const{targetGeometry:o}=e;if(null==o)return null;const{camera:r,mode:i}=pt(t,e.rotation,n);if("point"===o.type)return gt(t,e,o,r,i);const s=o.extent;return null==s?null:I(t,s,r.heading,r.tilt,i)}async function mt(t,e,n,a){const o=e.camera;if(null!=o)return ft(o,C(t),a);const{targetGeometry:r}=e;if(null==r)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=pt(t,e.rotation,n);if("point"===r.type)return ht(t,e,r,i,s,a);const c=r.extent;if(null==c)throw new Error("Target geometry has no extent!");return J(t,c,i.heading,i.tilt,s,a)}function ut(t,e){const n=t.position;let a;try{a=x(n,e)}catch(r){return null}const o=t.clone();return o.position=a.clone(),o}async function ft(t,e,n){const a=t.position,o=await j(a,e,{signal:n});i(n);const r=t.clone();return r.position=o.clone(),r}function pt(t,e,n){const a=K(t,t.state.camera);let o=L.ADJUST;return null!=e&&(a.heading=st(e),o=L.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:o}}function gt(t,e,n,a,o){const r=t.spatialReference;let i;try{i=x(n.clone(),r)}catch(c){return null}const s=null!=e.scale?N(t,e.scale,i.latitude):t.state.camera.distance;return W(t,i,s,a,o)}async function ht(t,e,n,a,o,r){const s=t.spatialReference,c=await j(n.clone(),s,{signal:r});i(r);const l=null!=e.scale?N(t,e.scale,c.latitude):t.state.camera.distance;return Y(t,c,l,a,o,r)}function yt(t,e,a=null){return null==a&&(a=new n),vt(t,null,e.clone(),a)}async function dt(e,a,o){const i=Ft(e,a);if(!i)throw new r("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Ot(await Gt(e,i.target,i,o,c))}if(i.target instanceof t)return Ot(await St(e,i.target,o,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof nt){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Ot(l||t?await Tt(e,i,i.target.center,s,o,c):await Et(e,i,i.target,s,o,c))}const m={boundingBox:S(),hasZ:!1,screenSpaceObjects:[]},u=l?xt(e,i):void 0;if(await zt(e,i.target,u,m,o),isFinite(m.boundingBox[0])){let t;if(B(m.boundingBox,Dt),Wt.x=Dt[0],Wt.y=Dt[1],Wt.z=Dt[2],Wt.spatialReference=e.spatialReference,isFinite(Wt.z)&&m.hasZ?t=M(m.boundingBox):(Wt.z=void 0,t=P(T(m.boundingBox,It))),l||t)return Ot(await Tt(e,i,Wt,s,o,c));const n=Pt(e,m.screenSpaceObjects);return Ot(await kt(e,i,Wt,m.boundingBox,n,s,o,c))}return i.position?Ot(await Mt(e,i,s,c,o)):Ot(await At(e,i,s,o,c))}function wt(t,e){return null==e.scale&&null!=e.zoom?$(t,e.zoom):e.scale}function xt(t,e){const n=wt(t,e);return n?U(n):void 0}function jt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=st(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function vt(t,e,n,a){const o=t.spatialReference||at.WGS84;return null==(e=null!=e?e:q(t,n))||(a.targetGeometry=R(e.center,t.renderSpatialReference,o),a.scale=X(t,e),a.rotation=ct(n.heading),a.camera=n),a}async function bt(t,e,n,a){const o=()=>new r("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw o();const i=e.spatialReference,s=t.spatialReference,c=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"mesh":n=e.origin;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&null!=c&&null!=t.elevationProvider?(n=await j(n,c,{signal:a}),Dt[2]=tt(t.elevationProvider,n)??0):Dt[2]=0}const l=Yt[e.type],m=new Array;if(l(e,e.hasZ?t=>{m.push([t[0],t[1],t[2]])}:t=>{m.push([t[0],t[1]])},Dt),0===m.length)throw o();const u=await j(new rt({spatialReference:i,hasZ:e.hasZ,hasM:!1,points:m}),s,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[r,f,p]of u.points)Dt[0]=r,Dt[1]=f,Dt[2]=p,A(n.boundingBox,Dt);else for(const[r,f]of u.points)Dt[0]=r,Dt[1]=f,A(n.boundingBox,Dt)}async function Rt(t,e,n,o,r){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await bt(t,e.geometry,o,r);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await bt(t,e.geometry,o,r);const{screenSpaceObjects:l,boundingBox:m}=c.value;E(o.boundingBox,m),l&&l.forEach((t=>{o.screenSpaceObjects.push(t)})),isFinite(m[2])&&(o.hasZ=!0)}async function zt(t,n,a,o,r){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return Wt.x=e,Wt.y=a,Wt.z=void 0,Wt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:at.WGS84,void await bt(t,Wt,o,r)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>zt(t,e,a,o,r)))):n instanceof ot?await bt(t,n,o,r):n instanceof e&&await Rt(t,n,a,o,r)}async function Gt(t,e,n,a,o){if(null!=e.camera)return St(t,e.camera,a,o);o.scale=e.scale,o.rotation=e.rotation,o.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,o.camera=null,null!=n.heading?o.rotation=ct(n.heading):null!=n.rotation&&(o.rotation=n.rotation);const r=wt(t,n);return null!=r&&(o.scale=r),o.camera=await mt(t,o,n.tilt,a),o}async function St(t,e,n,a){const o=t.spatialReference,r=await j(e.position,o,{signal:n});return(e=e.clone()).fov=t.camera.fov,e.position=r,vt(t,null,e,a)}async function Bt(t,e,n,a,o,r,i){const s=t.renderSpatialReference;return await b(e,Lt,s,0,{signal:i}),await b(n,Kt,s,0,{signal:i}),r.targetGeometry=new et(e),o.position=new et(n),h(Jt,Lt,Kt),Q(t,Kt,Jt,a.up,o),r.scale=_(t,p(Kt,Lt),r.targetGeometry.latitude),r.rotation=ct(o.heading),r.camera=o,r}async function Tt(t,e,n,a,o,i){if(null==n)throw new r("createfromcenter","invalid point");i.targetGeometry=n.clone();const s=V(t);if(e.position)return Bt(t,i.targetGeometry,e.position,s,a,i,o);if(e.zoomFactor){const a=s.distance/e.zoomFactor,o=u(Dt,s.viewForward,-a);s.eye=f(Dt,s.center,o),i.scale=_(t,a,n.latitude)}K(t,s,a);const c=jt(a,e)?L.LOCKED:L.ADJUST;if(!e.zoomFactor){const r=wt(t,e);if(null==r){const{renderSpatialReference:e}=t;await b(n,Dt,e,0,{signal:o}),D(s.frustum,Dt)?i.scale=_(t,p(s.eye,Dt),n.latitude):i.scale=X(t,s)}else i.scale=r;i.camera=await H(t,i.targetGeometry,i.scale,a,c,o)}return i}async function Mt(t,e,n,a,o){const r=V(t);g(Jt,r.viewForward),Q(t,r.eye,Jt,r.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await j(s,i,{signal:o});n.position=t}else n.position=new et;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,vt(t,null,n,a)}async function At(t,e,n,a,o){const r=V(t),{spatialReference:i,renderSpatialReference:s}=t;return Tt(t,e,R(r.center,s,i),n,a,o)}async function Et(t,e,n,a,o,r){r.targetGeometry=n.clone();const i=V(t);K(t,i,a);const s=jt(a,e)?L.LOCKED:L.ADJUST;return r.camera=await J(t,n,a.heading,a.tilt,s,o),r}function Zt(t,e,n,a,o){let r=0;null!=n.z?r=n.z:t.basemapTerrain&&t.elevationProvider&&(r=tt(t.elevationProvider,n)),y(Dt,n.x,n.y,r),v(t.spatialReference,Dt,Ut,t.renderSpatialReference),s(Vt,Ut),c(Vt,Vt),S(Ct);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=r),y(Dt,a[e[0]],a[e[1]],n),z(Dt,t.spatialReference,Dt,t.renderSpatialReference),A(Ct,d(Dt,Dt,Vt))}const l=Z(Ct),m=k(Ct),u=F(Ct),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,h=.5*m*p+.5*Math.max(l,u);return Math.max(g,h)/o}async function kt(t,e,n,a,o,r,i,s){s.targetGeometry=n.clone();const c=V(t),l=Zt(t,c,n,a,o);K(t,c,r);const m=jt(r,e)?L.LOCKED:L.ADJUST;return s.scale=_(t,l,s.targetGeometry.latitude),s.camera=await H(t,s.targetGeometry,s.scale,r,m,i),s}function Ft(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),e.center&&!n.target&&(n.target=e.center)),n}function Ot(t){return t&&null!=t.camera&&(t.rotation=ct(t.camera.heading)),t}function Pt(t,e){const n=it;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let o=0;o<e.length;o++){const t=e[o].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}const Dt=w(),Ut=m(),Vt=l(),Ct=G(),It=O(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},Wt=new et,Yt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let o=0;o<t.rings.length;o++){const r=t.rings[o];for(let t=0;t<r.length;t++)n[0]=r[t][0],n[1]=r[t][1],a&&(n[2]=r[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let o=0;o<t.paths.length;o++){const r=t.paths[o];for(let t=0;t<r.length;t++)n[0]=r[t][0],n[1]=r[t][1],a&&(n[2]=r[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,o=t.hasZ;for(let r=0;r<a.length;r++)n[0]=a[r][0],n[1]=a[r][1],o&&(n[2]=a[r][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(y(n,t.xmin,t.ymin,t.zmin)),e(y(n,t.xmax,t.ymin,t.zmin)),e(y(n,t.xmin,t.ymax,t.zmin)),e(y(n,t.xmax,t.ymax,t.zmin)),e(y(n,t.xmin,t.ymin,t.zmax)),e(y(n,t.xmax,t.ymin,t.zmax)),e(y(n,t.xmin,t.ymax,t.zmax)),e(y(n,t.xmax,t.ymax,t.zmax))):(e(y(n,t.xmin,t.ymin,n[2])),e(y(n,t.xmax,t.ymin,n[2])),e(y(n,t.xmin,t.ymax,n[2])),e(y(n,t.xmax,t.ymax,n[2])))},mesh(t,e,n){const a=t.vertexAttributes&&t.vertexAttributes.position;if(a)for(let o=0;o<a.length;o+=3)e(y(n,a[o],a[o+1],a[o+2]))}};export{dt as create,yt as fromCamera,mt as toCameraAsync,lt as toCameraSync};
5
+ import t from"../../../Camera.js";import"../../../geometry.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as o}from"../../../core/Cyclical.js";import r from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{f as s,t as c}from"../../../chunks/mat3.js";import{a as l}from"../../../chunks/mat3f64.js";import{a as m}from"../../../chunks/mat4f64.js";import{i as u,g as f,o as p,c as g,f as y,s as h,t as d}from"../../../chunks/vec3.js";import{c as w}from"../../../chunks/vec3f64.js";import{project as x,projectWithZConversion as j}from"../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as v}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorWithEngine as R}from"../../../geometry/projection/projectPointToVectorWithEngine.js";import{projectVectorToPoint as b}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as G,empty as S,center as B,toRect as T,isPoint as M,expandWithVec3 as E,expandWithAABB as Z,width as A,height as F,depth as k}from"../../../geometry/support/aaBoundingBox.js";import{create as O,isPoint as P}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as D}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as U}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as V}from"../camera/intersectionUtils.js";import{getViewSR as C,fromExtentSync as I,fromExtentAsync as J,internalToExternal as K,OrientationMode as L,scaleToDistance as N,fromCenterDistanceSync as W,fromCenterDistanceAsync as Y,externalToInternal as q,computeScale as X,distanceToScale as _,fromCenterScale as H,directionToHeadingTilt as Q,zoomToScale as $}from"./cameraUtils.js";import{getElevationAtPoint as tt}from"./ElevationProvider.js";import et from"../../../geometry/Point.js";import nt from"../../../geometry/Extent.js";import at from"../../../geometry/SpatialReference.js";import ot from"../../../geometry/Geometry.js";import rt from"../../../geometry/Multipoint.js";const it=.66;function st(t){return 360-o.normalize(t)}function ct(t){return o.normalize(360-t)}function lt(t,e,n){const a=e.camera;if(null!=a)return ut(a,C(t));const{targetGeometry:o}=e;if(null==o)return null;const{camera:r,mode:i}=pt(t,e.rotation,n);if("point"===o.type)return gt(t,e,o,r,i);const s=o.extent;return null==s?null:I(t,s,r.heading,r.tilt,i)}async function mt(t,e,n,a){const o=e.camera;if(null!=o)return ft(o,C(t),a);const{targetGeometry:r}=e;if(null==r)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=pt(t,e.rotation,n);if("point"===r.type)return yt(t,e,r,i,s,a);const c=r.extent;if(null==c)throw new Error("Target geometry has no extent!");return J(t,c,i.heading,i.tilt,s,a)}function ut(t,e){const n=t.position;let a;try{a=x(n,e)}catch(r){return null}const o=t.clone();return o.position=a.clone(),o}async function ft(t,e,n){const a=t.position,o=await j(a,e,{signal:n});i(n);const r=t.clone();return r.position=o.clone(),r}function pt(t,e,n){const a=K(t,t.state.camera);let o=L.ADJUST;return null!=e&&(a.heading=st(e),o=L.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:o}}function gt(t,e,n,a,o){const r=t.spatialReference;let i;try{i=x(n.clone(),r)}catch(c){return null}const s=null!=e.scale?N(t,e.scale,i.latitude):t.state.camera.distance;return W(t,i,s,a,o)}async function yt(t,e,n,a,o,r){const s=t.spatialReference,c=await j(n.clone(),s,{signal:r});i(r);const l=null!=e.scale?N(t,e.scale,c.latitude):t.state.camera.distance;return Y(t,c,l,a,o,r)}function ht(t,e,a=null){return null==a&&(a=new n),vt(t,null,e.clone(),a)}async function dt(e,a,o){const i=kt(e,a);if(!i)throw new r("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Ot(await Gt(e,i.target,i,o,c))}if(i.target instanceof t)return Ot(await St(e,i.target,o,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof nt){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Ot(l||t?await Tt(e,i,i.target.center,s,o,c):await Zt(e,i,i.target,s,o,c))}const m={boundingBox:S(),hasZ:!1,screenSpaceObjects:[]},u=l?xt(e,i):void 0;if(await zt(e,i.target,u,m,o),isFinite(m.boundingBox[0])){let t;if(B(m.boundingBox,Dt),Wt.x=Dt[0],Wt.y=Dt[1],Wt.z=Dt[2],Wt.spatialReference=e.spatialReference,isFinite(Wt.z)&&m.hasZ?t=M(m.boundingBox):(Wt.z=void 0,t=P(T(m.boundingBox,It))),l||t)return Ot(await Tt(e,i,Wt,s,o,c));const n=Pt(e,m.screenSpaceObjects);return Ot(await Ft(e,i,Wt,m.boundingBox,n,s,o,c))}return i.position?Ot(await Mt(e,i,s,c,o)):Ot(await Et(e,i,s,o,c))}function wt(t,e){return null==e.scale&&null!=e.zoom?$(t,e.zoom):e.scale}function xt(t,e){const n=wt(t,e);return n?U(n):void 0}function jt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=st(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function vt(t,e,n,a){const o=t.spatialReference||at.WGS84;return null==(e=null!=e?e:q(t,n))||(a.targetGeometry=b(e.center,t.renderSpatialReference,o),a.scale=X(t,e),a.rotation=ct(n.heading),a.camera=n),a}async function Rt(t,e,n,a){const o=()=>new r("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw o();"mesh"===e.type&&(e=e.extent);const i=e.spatialReference,s=t.spatialReference,c=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&null!=c&&null!=t.elevationProvider?(n=await j(n,c,{signal:a}),Dt[2]=tt(t.elevationProvider,n)??0):Dt[2]=0}const l=Yt[e.type],m=new Array;if(l(e,e.hasZ?t=>{m.push([t[0],t[1],t[2]])}:t=>{m.push([t[0],t[1]])},Dt),0===m.length)throw o();const u=await j(new rt({spatialReference:i,hasZ:e.hasZ,hasM:!1,points:m}),s,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[r,f,p]of u.points)Dt[0]=r,Dt[1]=f,Dt[2]=p,E(n.boundingBox,Dt);else for(const[r,f]of u.points)Dt[0]=r,Dt[1]=f,E(n.boundingBox,Dt)}async function bt(t,e,n,o,r){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await Rt(t,e.geometry,o,r);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await Rt(t,e.geometry,o,r);const{screenSpaceObjects:l,boundingBox:m}=c.value;Z(o.boundingBox,m),l&&l.forEach((t=>{o.screenSpaceObjects.push(t)})),isFinite(m[2])&&(o.hasZ=!0)}async function zt(t,n,a,o,r){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return Wt.x=e,Wt.y=a,Wt.z=void 0,Wt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:at.WGS84,void await Rt(t,Wt,o,r)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>zt(t,e,a,o,r)))):n instanceof ot?await Rt(t,n,o,r):n instanceof e&&await bt(t,n,a,o,r)}async function Gt(t,e,n,a,o){if(null!=e.camera)return St(t,e.camera,a,o);o.scale=e.scale,o.rotation=e.rotation,o.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,o.camera=null,null!=n.heading?o.rotation=ct(n.heading):null!=n.rotation&&(o.rotation=n.rotation);const r=wt(t,n);return null!=r&&(o.scale=r),o.camera=await mt(t,o,n.tilt,a),o}async function St(t,e,n,a){const o=t.spatialReference,r=await j(e.position,o,{signal:n});return(e=e.clone()).fov=t.camera.fov,e.position=r,vt(t,null,e,a)}async function Bt(t,e,n,a,o,r,i){const s=t.renderSpatialReference;return await R(e,Lt,s,0,{signal:i}),await R(n,Kt,s,0,{signal:i}),r.targetGeometry=new et(e),o.position=new et(n),y(Jt,Lt,Kt),Q(t,Kt,Jt,a.up,o),r.scale=_(t,p(Kt,Lt),r.targetGeometry.latitude),r.rotation=ct(o.heading),r.camera=o,r}async function Tt(t,e,n,a,o,i){if(null==n)throw new r("createfromcenter","invalid point");i.targetGeometry=n.clone();const s=V(t);if(e.position)return Bt(t,i.targetGeometry,e.position,s,a,i,o);if(e.zoomFactor){const a=s.distance/e.zoomFactor,o=u(Dt,s.viewForward,-a);s.eye=f(Dt,s.center,o),i.scale=_(t,a,n.latitude)}K(t,s,a);const c=jt(a,e)?L.LOCKED:L.ADJUST;if(!e.zoomFactor){const r=wt(t,e);if(null==r){const{renderSpatialReference:e}=t;await R(n,Dt,e,0,{signal:o}),D(s.frustum,Dt)?i.scale=_(t,p(s.eye,Dt),n.latitude):i.scale=X(t,s)}else i.scale=r;i.camera=await H(t,i.targetGeometry,i.scale,a,c,o)}return i}async function Mt(t,e,n,a,o){const r=V(t);g(Jt,r.viewForward),Q(t,r.eye,Jt,r.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await j(s,i,{signal:o});n.position=t}else n.position=new et;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,vt(t,null,n,a)}async function Et(t,e,n,a,o){const r=V(t),{spatialReference:i,renderSpatialReference:s}=t;return Tt(t,e,b(r.center,s,i),n,a,o)}async function Zt(t,e,n,a,o,r){r.targetGeometry=n.clone();const i=V(t);K(t,i,a);const s=jt(a,e)?L.LOCKED:L.ADJUST;return r.camera=await J(t,n,a.heading,a.tilt,s,o),r}function At(t,e,n,a,o){let r=0;null!=n.z?r=n.z:t.basemapTerrain&&t.elevationProvider&&(r=tt(t.elevationProvider,n)),h(Dt,n.x,n.y,r),v(t.spatialReference,Dt,Ut,t.renderSpatialReference),s(Vt,Ut),c(Vt,Vt),S(Ct);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=r),h(Dt,a[e[0]],a[e[1]],n),z(Dt,t.spatialReference,Dt,t.renderSpatialReference),E(Ct,d(Dt,Dt,Vt))}const l=A(Ct),m=F(Ct),u=k(Ct),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/o}async function Ft(t,e,n,a,o,r,i,s){s.targetGeometry=n.clone();const c=V(t),l=At(t,c,n,a,o);K(t,c,r);const m=jt(r,e)?L.LOCKED:L.ADJUST;return s.scale=_(t,l,s.targetGeometry.latitude),s.camera=await H(t,s.targetGeometry,s.scale,r,m,i),s}function kt(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),e.center&&!n.target&&(n.target=e.center)),n}function Ot(t){return t&&null!=t.camera&&(t.rotation=ct(t.camera.heading)),t}function Pt(t,e){const n=it;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let o=0;o<e.length;o++){const t=e[o].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}const Dt=w(),Ut=m(),Vt=l(),Ct=G(),It=O(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},Wt=new et,Yt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let o=0;o<t.rings.length;o++){const r=t.rings[o];for(let t=0;t<r.length;t++)n[0]=r[t][0],n[1]=r[t][1],a&&(n[2]=r[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let o=0;o<t.paths.length;o++){const r=t.paths[o];for(let t=0;t<r.length;t++)n[0]=r[t][0],n[1]=r[t][1],a&&(n[2]=r[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,o=t.hasZ;for(let r=0;r<a.length;r++)n[0]=a[r][0],n[1]=a[r][1],o&&(n[2]=a[r][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{dt as create,ht as fromCamera,mt as toCameraAsync,lt as toCameraSync};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/PooledArray.js";import{isPromiseLike as s}from"../../../core/promiseUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{isIntersectionHandler as o}from"../state/helpers/SceneIntersectionHelper.js";import{ChangeSet as d}from"./lib/ChangeSet.js";import{UpdatePolicy as a}from"./lib/UpdatePolicy.js";import{isWebGLLayer as h}from"./lib/WebGLLayer.js";import{Model as y}from"./parts/Model.js";import{RenderView as l}from"./parts/RenderView.js";import{TaskPriority as c,noBudget as m}from"../../support/Scheduler.js";let p=class extends t{constructor(e){super(e),this._model=new y,this._layers=new r,this._asyncChangeSet=new d,this._syncChangeSet=new d,this._layerSyncSet=new Set}initialize(){this._set("renderView",new l(this)),this._frameTask=this.view.resourceController.scheduler.registerTask(c.STAGE,this),this.addHandles(this._frameTask)}get viewingMode(){return this.view.state.viewingMode}get updating(){return this.running||this.renderView.updating||this._frameTask.updating}get renderer(){return this.renderView?.renderer}add(e){this._model.add(e),h(e)&&this._addLayer(e),this.renderView.requestRender()}remove(e){null!=e&&!this.destroyed&&this._model.remove(e)&&(h(e)&&this._removeLayer(e),this.renderView.requestRender())}addMany(e){null!=e&&(this._model.addMany(e),this.renderView.requestRender())}removeMany(e){null!=e&&(this._model?.removeMany(e),this.renderView?.requestRender())}forEachOfType(e,t){this._model.forEachOfType(e,t)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get running(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty}runTask(e){this._frameTask.processQueue(e),this._commit(e)}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||r.updatePolicy===a.SYNC,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.modify(i,s?m:e),this.renderView.requestRender(),e.madeProgress())})),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{e.done||this._layerSyncSet.has(r.id)||r.updatePolicy!==a.ASYNC||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))})),this._layerSyncSet.clear(),this.notifyChange("running")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forAll((t=>{(this._layerSyncSet.has(t.id)||t.updatePolicy===a.SYNC)&&(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id))}));for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender())}_commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}getObject(e){return this._model.getObject(e)}get layers(){return this._layers}_addLayer(e){this._layers.includes(e)||this._layers.push(e)}_removeLayer(e){this._commitLayer(e),null!=this._layers.removeUnordered(e)&&(this._model.dirtySet.getResidentRenderGeometries(e.id,this._syncChangeSet.removes),this.renderer.modify(this._syncChangeSet,m))}addRenderPlugin(e,t){const r=this.renderer.renderPlugins.add(e,t),i=()=>{o(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(s(r))return r.then(i);i()}removeRenderPlugin(e){this.destroyed||(o(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.renderPlugins.remove(e))}get performanceInfo(){return this._model.getStats()}get test(){const e=this;return{getCount:t=>e._model.test.content.filter((e=>e.type===t)).length,model:e._model}}};p.DebugSettings={endFrameContentValidation:!1},e([i({constructOnly:!0})],p.prototype,"view",void 0),e([i({constructOnly:!0})],p.prototype,"options",void 0),e([i({readOnly:!0})],p.prototype,"viewingMode",null),e([i({constructOnly:!0})],p.prototype,"container",void 0),e([i({readOnly:!0})],p.prototype,"updating",null),e([i({constructOnly:!0})],p.prototype,"_model",void 0),e([i({autoDestroy:!0})],p.prototype,"renderView",void 0),e([i({readOnly:!0})],p.prototype,"renderer",null),e([i({readOnly:!0})],p.prototype,"running",null),p=e([n("esri.views.3d.webgl-engine.Stage")],p);export{p as Stage};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/PooledArray.js";import{isPromiseLike as s}from"../../../core/promiseUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{isIntersectionHandler as o}from"../state/helpers/SceneIntersectionHelper.js";import{ChangeSet as d}from"./lib/ChangeSet.js";import{UpdatePolicy as a}from"./lib/UpdatePolicy.js";import{isWebGLLayer as h}from"./lib/WebGLLayer.js";import{Model as y}from"./parts/Model.js";import{RenderView as c}from"./parts/RenderView.js";import{TaskPriority as l,noBudget as m}from"../../support/Scheduler.js";let p=class extends t{constructor(e){super(e),this._model=new y,this._layers=new r,this._asyncChangeSet=new d,this._syncChangeSet=new d,this._layerSyncSet=new Set}initialize(){this._set("renderView",new c(this)),this._frameTask=this.view.resourceController.scheduler.registerTask(l.STAGE,this),this.addHandles(this._frameTask)}get viewingMode(){return this.view.state.viewingMode}get updating(){return this.running||this.renderView.updating||this._frameTask.updating}get renderer(){return this.renderView?.renderer}add(e){this._model.add(e),h(e)&&this._addLayer(e),this.renderView.requestRender()}remove(e){null!=e&&!this.destroyed&&this._model.remove(e)&&(h(e)&&this._removeLayer(e),this.renderView.requestRender())}addMany(e){null!=e&&(this._model.addMany(e),this.renderView.requestRender())}removeMany(e){null!=e&&(this._model?.removeMany(e),this.renderView?.requestRender())}forEachOfType(e,t){this._model.forEachOfType(e,t)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get running(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty}runTask(e){this._frameTask.processQueue(e),this._commit(e)}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||r.updatePolicy===a.SYNC,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.modify(i,s?m:e),this.renderView.requestRender(),e.madeProgress())})),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{e.done||this._layerSyncSet.has(r.id)||r.updatePolicy!==a.ASYNC||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))})),this._layerSyncSet.clear(),this.notifyChange("running")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forAll((t=>{this._layerSyncSet.has(t.id)||t.updatePolicy===a.SYNC?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)}));for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender())}_commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}getObject(e){return this._model.getObject(e)}get layers(){return this._layers}_addLayer(e){this._layers.includes(e)||this._layers.push(e)}_removeLayer(e){this._commitLayer(e),null!=this._layers.removeUnordered(e)&&(this._model.dirtySet.getResidentRenderGeometries(e.id,this._syncChangeSet.removes),this.renderer.modify(this._syncChangeSet,m))}addRenderPlugin(e,t){const r=this.renderer.renderPlugins.add(e,t),i=()=>{o(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(s(r))return r.then(i);i()}removeRenderPlugin(e){this.destroyed||(o(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.renderPlugins.remove(e))}get performanceInfo(){return this._model.getStats()}get test(){const e=this;return{getCount:t=>e._model.test.content.filter((e=>e.type===t)).length,model:e._model}}};p.DebugSettings={endFrameContentValidation:!1},e([i({constructOnly:!0})],p.prototype,"view",void 0),e([i({constructOnly:!0})],p.prototype,"options",void 0),e([i({readOnly:!0})],p.prototype,"viewingMode",null),e([i({constructOnly:!0})],p.prototype,"container",void 0),e([i({readOnly:!0})],p.prototype,"updating",null),e([i({constructOnly:!0})],p.prototype,"_model",void 0),e([i({autoDestroy:!0})],p.prototype,"renderView",void 0),e([i({readOnly:!0})],p.prototype,"renderer",null),e([i({readOnly:!0})],p.prototype,"running",null),p=e([n("esri.views.3d.webgl-engine.Stage")],p);export{p as Stage};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t=null,l=null,e=null){this.compositeTexture=t,this.normalTexture=l,this.highlightTexture=e}}export{t as RenderPluginInput};
5
+ class l{constructor(l=null,t=null,s=null){this.composite=l,this.normal=t,this.highlight=s}}export{l as RenderPluginInput};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
+ */
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{property as e}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{SyncRenderPlugin as r}from"../RenderPlugin.js";import{RenderSlot as i}from"../../lib/RenderSlot.js";import{C as s}from"../../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as n}from"../../shaders/CompositingTechnique.js";import{AlphaMode as c,CompositingTechniqueConfiguration as a}from"../../shaders/CompositingTechniqueConfiguration.js";let p=class extends r{constructor(t){super(t),this._context=null,this.opacity=1,this.alphaMode=c.None,this._blitConfiguration=new a,this._blitParameters=new s,this.produces=new Map([[i.BLIT,()=>null!=this._context]])}initializeRenderContext(t){this._context=t}uninitializeRenderContext(){this._context=null}destroy(){}renderNode(t,e,o,r){const i=o?.composite?.colorTexture;if(!this._context||!i)return r;const s=this._context.techniqueRepository.acquire(n,this._blitConfiguration);return s?.compiled?(t.rctx.bindFramebuffer(r?.fbo),this._blitParameters.texture=i,this._blitParameters.opacity=this.opacity,t.rctx.bindTechnique(s,this._blitParameters,t.bindParameters),t.rctx.screen.draw(),s.release(),r):(this._context.requestRender(),r)}};t([e()],p.prototype,"_context",void 0),t([e()],p.prototype,"opacity",void 0),t([e()],p.prototype,"alphaMode",void 0),p=t([o("esri.views.3d.webgl-engine.effects.blit.Blit")],p);export{p as Blit};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import{releaseMaybe as r,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}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 h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as l}from"../../../../../chunks/vec2.js";import{ColorFormat as n}from"../../core/FBOCache.js";import{SyncRenderPlugin as c,ConsumesHighlight as p}from"../RenderPlugin.js";import{HighlightApplyTechnique as u}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as m}from"./HighlightBlurTechnique.js";import{defaultColor as _,defaultHaloOpacity as d,defaultFillOpacity as g}from"./HighlightDefaults.js";import{HighlightDownsampleTechnique as b}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{Default3D as w}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos2Tex as T}from"../../lib/DefaultVertexBufferLayouts.js";import{RenderSlot as q}from"../../lib/RenderSlot.js";import{VertexArrayObject as v}from"../../lib/VertexArrayObject.js";import{H as x}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as P,g as y}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as j}from"../../../../webgl/BufferObject.js";import{ClearBufferBit as C,Usage as O}from"../../../../webgl/enums.js";import{vertexCount as R}from"../../../../webgl/Util.js";let D=class extends c{constructor(e){super(e),this._context=null,this._passParameters=new f,this._downsampleDrawParameters=new P,this._blurDrawParameters=new x,this._grid={coverage:null,vao:null,verticalCellCount:0,horizontalCellCount:0,viewportWidth:0,viewportHeight:0},this.produces=new Map([[q.HIGHLIGHT,()=>!0]])}consumes(){return p}initializeRenderContext(e){this._context=e,null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(m)),null==this._downsampleTechnique&&(this._downsampleTechnique=this._context.techniqueRepository.acquire(b)),null==this._applyTechnique&&(this._applyTechnique=this._context.techniqueRepository.acquire(u)),this.addHandles([s((()=>this.view.highlightOptions.color),(e=>{this._passParameters.color=t(e??_),this.view.highlightOptions.haloColor||(this._passParameters.haloColor=this._passParameters.color),this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloColor),(e=>{this._passParameters.haloColor=null!=e?t(e):this._passParameters.color,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloOpacity),(e=>{this._passParameters.haloOpacity=e??d,this._passParameters.haloOpacityOccluded=.25*this._passParameters.haloOpacity,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.fillOpacity),(e=>{this._passParameters.fillOpacity=e??g,this._passParameters.fillOpacityOccluded=.25*this._passParameters.fillOpacity,this._context.requestRender()}),o)])}uninitializeRenderContext(){this._context=null}dispose(){this._blurTechnique=r(this._blurTechnique),this._downsampleTechnique=r(this._downsampleTechnique),this._applyTechnique=r(this._applyTechnique),this._grid.coverage=r(this._grid.coverage),this._grid.vao=i(this._grid.vao)}renderNode(e,t,r,i){const s=r?.highlightTexture;if(!this._context||!s)return;if(!(this._blurTechnique.compiled&&this._downsampleTechnique.compiled&&this._applyTechnique.compiled))return void this._context.requestRender();const o=e.bindParameters.camera,a=o.fullWidth,h=o.fullHeight,c=o.pixelRatio,p=Math.ceil(a/c),u=Math.ceil(h/c),m=this._context.fbos.rctx,_=this._context.fbos;this._gridUpdateResources(s),this._gridComputeCoverage(s,e.bindParameters),this._passParameters.highlightTexture=s,this._passParameters.coverageTexture=this._grid.coverage?.colorTexture;const d=m.bindTechnique(this._blurTechnique,this._passParameters,e.bindParameters),g=this._grid.vao;m.bindVAO(g);const b=_.acquire(n.RGBA4,p,u);m.bindFramebuffer(b.fbo),m.setViewport(0,0,p,u),m.setClearColor(0,0,0,0),m.clear(C.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=s,l(this._blurDrawParameters.blurSize,1/p,0),d.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),m.drawArrays(this._blurTechnique.primitiveType,0,R(g,"geometry"));const f=_.acquire(n.RGBA4,p,u);m.bindFramebuffer(f.fbo),m.clear(C.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=b.colorTexture,l(this._blurDrawParameters.blurSize,0,1/u),d.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),m.drawArrays(this._blurTechnique.primitiveType,0,R(g,"geometry")),m.bindFramebuffer(i?.fbo),m.setViewport4fv(o.fullViewport),this._passParameters.blurTexture=f.colorTexture,m.bindTechnique(this._applyTechnique,this._passParameters,e.bindParameters),m.drawArrays(this._applyTechnique.primitiveType,0,R(g,"geometry")),f.release(),b.release()}_gridUpdateResources(e){if(!this._context)return;const t=this._context.fbos.rctx,r=this._grid,s=Math.ceil(e.descriptor.height/y),o=Math.ceil(e.descriptor.width/y);if(!r.vao||r.verticalCellCount!==s||r.horizontalCellCount!==o){r.verticalCellCount=s,r.horizontalCellCount=o;const e=s+1,a=o+1,h=1/s,l=1/o,n=6,c=4,p=new Float32Array(n*c*e*a);let u=0;for(let t=0;t<e;t++)for(let e=0;e<a;e++)p[u]=(e-.5)*l*2-1,p[u+1]=(t-.5)*h*2-1,p[u+2]=e*l,p[u+3]=t*h,p[u+4]=(e+.5)*l*2-1,p[u+5]=(t-.5)*h*2-1,p[u+6]=e*l,p[u+7]=t*h,p[u+8]=(e-.5)*l*2-1,p[u+9]=(t+.5)*h*2-1,p[u+10]=e*l,p[u+11]=t*h,p[u+12]=(e-.5)*l*2-1,p[u+13]=(t+.5)*h*2-1,p[u+14]=e*l,p[u+15]=t*h,p[u+16]=(e+.5)*l*2-1,p[u+17]=(t-.5)*h*2-1,p[u+18]=e*l,p[u+19]=t*h,p[u+20]=(e+.5)*l*2-1,p[u+21]=(t+.5)*h*2-1,p[u+22]=e*l,p[u+23]=t*h,u+=n*c;r.vao=i(r.vao),r.vao=new v(t,w,{geometry:T},{geometry:j.createVertex(t,O.STATIC_DRAW,p)})}}_gridComputeCoverage(e,t){if(!this._context)return;const r=this._context.fbos.rctx,i=this._grid,s=r.bindTechnique(this._downsampleTechnique,this._passParameters,t),o=e.descriptor;i.coverage?.release(),i.coverage=this._context.fbos.acquire(n.RG,Math.ceil(o.width/y),Math.ceil(o.height/y)),r.bindFramebuffer(i.coverage.fbo),this._downsampleDrawParameters.input=e,s.bindDraw(this._downsampleDrawParameters,t,this._passParameters);const{width:a,height:h}=o;r.setViewport(0,0,a,h),r.screen.draw()}get test(){return{coverage:this._grid.coverage}}};e([a()],D.prototype,"_context",void 0),e([a()],D.prototype,"view",void 0),D=e([h("esri.views.3d.webgl-engine.lib.Highlight")],D);export{D as Highlight};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import{releaseMaybe as r,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}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 h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as l}from"../../../../../chunks/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as n,ConsumesHighlight as p}from"../RenderPlugin.js";import{HighlightApplyTechnique as u}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as m}from"./HighlightBlurTechnique.js";import{defaultColor as _,defaultHaloOpacity as d,defaultFillOpacity as g}from"./HighlightDefaults.js";import{HighlightDownsampleTechnique as b}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{Default3D as w}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos2Tex as T}from"../../lib/DefaultVertexBufferLayouts.js";import{RenderSlot as q}from"../../lib/RenderSlot.js";import{VertexArrayObject as v}from"../../lib/VertexArrayObject.js";import{H as x}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as P,g as y}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as j}from"../../../../webgl/BufferObject.js";import{ClearBufferBit as C,Usage as O}from"../../../../webgl/enums.js";import{vertexCount as R}from"../../../../webgl/Util.js";let D=class extends n{constructor(e){super(e),this._context=null,this._passParameters=new f,this._downsampleDrawParameters=new P,this._blurDrawParameters=new x,this._grid={coverage:null,vao:null,verticalCellCount:0,horizontalCellCount:0,viewportWidth:0,viewportHeight:0},this.produces=new Map([[q.HIGHLIGHT,()=>!0]])}consumes(){return p}initializeRenderContext(e){this._context=e,null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(m)),null==this._downsampleTechnique&&(this._downsampleTechnique=this._context.techniqueRepository.acquire(b)),null==this._applyTechnique&&(this._applyTechnique=this._context.techniqueRepository.acquire(u)),this.addHandles([s((()=>this.view.highlightOptions.color),(e=>{this._passParameters.color=t(e??_),this.view.highlightOptions.haloColor||(this._passParameters.haloColor=this._passParameters.color),this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloColor),(e=>{this._passParameters.haloColor=null!=e?t(e):this._passParameters.color,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloOpacity),(e=>{this._passParameters.haloOpacity=e??d,this._passParameters.haloOpacityOccluded=.25*this._passParameters.haloOpacity,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.fillOpacity),(e=>{this._passParameters.fillOpacity=e??g,this._passParameters.fillOpacityOccluded=.25*this._passParameters.fillOpacity,this._context.requestRender()}),o)])}uninitializeRenderContext(){this._context=null}dispose(){this._blurTechnique=r(this._blurTechnique),this._downsampleTechnique=r(this._downsampleTechnique),this._applyTechnique=r(this._applyTechnique),this._grid.coverage=r(this._grid.coverage),this._grid.vao=i(this._grid.vao)}renderNode(e,t,r,i){const s=r?.highlight?.colorTexture;if(!this._context||!s)return;if(!(this._blurTechnique.compiled&&this._downsampleTechnique.compiled&&this._applyTechnique.compiled))return void this._context.requestRender();const o=e.bindParameters.camera,a=o.fullWidth,h=o.fullHeight,n=o.pixelRatio,p=Math.ceil(a/n),u=Math.ceil(h/n),m=this._context.fbos.rctx,_=this._context.fbos;this._gridUpdateResources(s),this._gridComputeCoverage(s,e.bindParameters),this._passParameters.highlightTexture=s,this._passParameters.coverageTexture=this._grid.coverage?.colorTexture;const d=m.bindTechnique(this._blurTechnique,this._passParameters,e.bindParameters),g=this._grid.vao;m.bindVAO(g);const b=_.acquire(c.RGBA4,p,u);m.bindFramebuffer(b.fbo),m.setViewport(0,0,p,u),m.setClearColor(0,0,0,0),m.clear(C.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=s,l(this._blurDrawParameters.blurSize,1/p,0),d.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),m.drawArrays(this._blurTechnique.primitiveType,0,R(g,"geometry"));const f=_.acquire(c.RGBA4,p,u);m.bindFramebuffer(f.fbo),m.clear(C.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=b.colorTexture,l(this._blurDrawParameters.blurSize,0,1/u),d.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),m.drawArrays(this._blurTechnique.primitiveType,0,R(g,"geometry")),m.bindFramebuffer(i?.fbo),m.setViewport4fv(o.fullViewport),this._passParameters.blurTexture=f.colorTexture,m.bindTechnique(this._applyTechnique,this._passParameters,e.bindParameters),m.drawArrays(this._applyTechnique.primitiveType,0,R(g,"geometry")),f.release(),b.release()}_gridUpdateResources(e){if(!this._context)return;const t=this._context.fbos.rctx,r=this._grid,s=Math.ceil(e.descriptor.height/y),o=Math.ceil(e.descriptor.width/y);if(!r.vao||r.verticalCellCount!==s||r.horizontalCellCount!==o){r.verticalCellCount=s,r.horizontalCellCount=o;const e=s+1,a=o+1,h=1/s,l=1/o,c=6,n=4,p=new Float32Array(c*n*e*a);let u=0;for(let t=0;t<e;t++)for(let e=0;e<a;e++)p[u]=(e-.5)*l*2-1,p[u+1]=(t-.5)*h*2-1,p[u+2]=e*l,p[u+3]=t*h,p[u+4]=(e+.5)*l*2-1,p[u+5]=(t-.5)*h*2-1,p[u+6]=e*l,p[u+7]=t*h,p[u+8]=(e-.5)*l*2-1,p[u+9]=(t+.5)*h*2-1,p[u+10]=e*l,p[u+11]=t*h,p[u+12]=(e-.5)*l*2-1,p[u+13]=(t+.5)*h*2-1,p[u+14]=e*l,p[u+15]=t*h,p[u+16]=(e+.5)*l*2-1,p[u+17]=(t-.5)*h*2-1,p[u+18]=e*l,p[u+19]=t*h,p[u+20]=(e+.5)*l*2-1,p[u+21]=(t+.5)*h*2-1,p[u+22]=e*l,p[u+23]=t*h,u+=c*n;r.vao=i(r.vao),r.vao=new v(t,w,{geometry:T},{geometry:j.createVertex(t,O.STATIC_DRAW,p)})}}_gridComputeCoverage(e,t){if(!this._context)return;const r=this._context.fbos.rctx,i=this._grid,s=r.bindTechnique(this._downsampleTechnique,this._passParameters,t),o=e.descriptor;i.coverage?.release(),i.coverage=this._context.fbos.acquire(c.RG,Math.ceil(o.width/y),Math.ceil(o.height/y)),r.bindFramebuffer(i.coverage.fbo),this._downsampleDrawParameters.input=e,s.bindDraw(this._downsampleDrawParameters,t,this._passParameters);const{width:a,height:h}=o;r.setViewport(0,0,a,h),r.screen.draw()}get test(){return{coverage:this._grid.coverage}}};e([a()],D.prototype,"_context",void 0),e([a()],D.prototype,"view",void 0),D=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],D);export{D as Highlight};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as e}from"../../../../../core/colorUtils.js";import{smoothstep as s,clamp as i}from"../../../../../core/mathUtils.js";import{watch as a,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,s as n,j as p}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec3f64.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{ReadShadowMapDrawParameters as l}from"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{SyncRenderPlugin as u,ConsumesHighlight as _}from"../RenderPlugin.js";import{defaultShadowOpacity as w,defaultShadowDifference as f,defaultShadowColor as g}from"./HighlightDefaults.js";import{ShadowHighlightPassParameters as y,ShadowHighlightTechnique as x}from"./ShadowHighlightTechnique.js";import{RenderSlot as O}from"../../lib/RenderSlot.js";const b=.001953125,P=4e4,j=5e4;let v=class extends u{constructor(t){super(t),this._maxOpacity=1,this._passParameters=new y,this._drawParameters=new l,this._shadowDifference=.2,this._context=null,this.produces=new Map([[O.SHADOW_HIGHLIGHT,()=>this._isVisible]])}consumes(){return _}initializeRenderContext(t){this._context=t,this.addHandles([a((()=>this.view.highlightOptions.shadowOpacity),(t=>{this._passParameters.shadowOpacity=t??w,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),r),a((()=>this.view.highlightOptions.shadowDifference),(t=>{this._shadowDifference=t??f,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),r),a((()=>this.view.highlightOptions.shadowColor),(t=>{this._passParameters.shadowColor=e(t??g),this._updateMaxOpacity()}),r)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_updateMaxOpacity(){const t=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=t*this._passParameters.shadowColor[3]}uninitializeRenderContext(){this._context=null}enable(){this._context&&null==this._technique&&(this._technique=this._context.techniqueRepository.acquire(x))}renderNode(t,e,s,i){if(!(this._context&&s&&s.highlightTexture&&this._isVisible))return;if(!this._technique?.compiled)return void this._context.requestRender();const a=t.bindParameters;if(!a.shadowMap.enabled||!a.linearDepth)return;const r=t.rctx,o=this._technique;this._passParameters.highlight=s.highlightTexture,this._drawParameters.origin=a.camera.center,r.bindFramebuffer(i?.fbo),r.bindTechnique(o,this._passParameters,a).bindDraw(this._drawParameters,a,this._passParameters),r.screen.draw()}updateParameters(t,e){this._passParameters.opacityElevation=1-s(P,j,t.relativeElevation);const a=this.viewingMode===m.Global?c(S,t.center):n(S,0,0,1),r=p(a,e);this._passParameters.dayNightTerminator=s(0,1,i(30*r,0,1)),this._isVisible&&this.enable()}get _isVisible(){const{opacityElevation:t,dayNightTerminator:e}=this._passParameters;return this._maxOpacity*t*e>=b}};t([o()],v.prototype,"_context",void 0),t([o()],v.prototype,"view",void 0),t([o()],v.prototype,"viewingMode",void 0),v=t([h("esri.views.3d.webgl-engine.lib.ShadowHighlight")],v);const S=d();export{v as ShadowHighlight};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as e}from"../../../../../core/colorUtils.js";import{smoothstep as s,clamp as i}from"../../../../../core/mathUtils.js";import{watch as a,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,s as n,j as p}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec3f64.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{ReadShadowMapDrawParameters as l}from"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{SyncRenderPlugin as _,ConsumesHighlight as u}from"../RenderPlugin.js";import{defaultShadowOpacity as w,defaultShadowDifference as f,defaultShadowColor as g}from"./HighlightDefaults.js";import{ShadowHighlightPassParameters as y,ShadowHighlightTechnique as O}from"./ShadowHighlightTechnique.js";import{RenderSlot as x}from"../../lib/RenderSlot.js";const P=.001953125,b=4e4,j=5e4;let v=class extends _{constructor(t){super(t),this._maxOpacity=1,this._passParameters=new y,this._drawParameters=new l,this._shadowDifference=.2,this._context=null,this.produces=new Map([[x.SHADOW_HIGHLIGHT,()=>this._isVisible]])}consumes(){return u}initializeRenderContext(t){this._context=t,this.addHandles([a((()=>this.view.highlightOptions.shadowOpacity),(t=>{this._passParameters.shadowOpacity=t??w,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),r),a((()=>this.view.highlightOptions.shadowDifference),(t=>{this._shadowDifference=t??f,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),r),a((()=>this.view.highlightOptions.shadowColor),(t=>{this._passParameters.shadowColor=e(t??g),this._updateMaxOpacity()}),r)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_updateMaxOpacity(){const t=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=t*this._passParameters.shadowColor[3]}uninitializeRenderContext(){this._context=null}enable(){this._context&&null==this._technique&&(this._technique=this._context.techniqueRepository.acquire(O))}renderNode(t,e,s,i){const a=s?.highlight?.colorTexture;if(!(this._context&&s&&a&&this._isVisible))return;if(!this._technique?.compiled)return void this._context.requestRender();const r=t.bindParameters;if(!r.shadowMap.enabled||!r.linearDepth)return;const o=t.rctx,h=this._technique;this._passParameters.highlight=a,this._drawParameters.origin=r.camera.center,o.bindFramebuffer(i?.fbo),o.bindTechnique(h,this._passParameters,r).bindDraw(this._drawParameters,r,this._passParameters),o.screen.draw()}updateParameters(t,e){this._passParameters.opacityElevation=1-s(b,j,t.relativeElevation);const a=this.viewingMode===m.Global?c(S,t.center):n(S,0,0,1),r=p(a,e);this._passParameters.dayNightTerminator=s(0,1,i(30*r,0,1)),this._isVisible&&this.enable()}get _isVisible(){const{opacityElevation:t,dayNightTerminator:e}=this._passParameters;return this._maxOpacity*t*e>=P}};t([o()],v.prototype,"_context",void 0),t([o()],v.prototype,"view",void 0),t([o()],v.prototype,"viewingMode",void 0),v=t([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],v);const S=d();export{v as ShadowHighlight};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t,abortMaybe as r}from"../../../../../core/maybe.js";import{isAbortError as s,throwIfAborted as i,isAborted as o}from"../../../../../core/promiseUtils.js";import{watch as a,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as h}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{requestImage as u}from"../../../../../support/requestImageUtils.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as d}from"../RenderPlugin.js";import{SMAABlendWeightsTechnique as _}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as m}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as p}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as b}from"./SMAAPassParameters.js";import{RenderFeature as T}from"../../lib/RenderFeature.js";import{RenderSlot as x}from"../../lib/RenderSlot.js";import{PixelFormat as f,TextureSamplingMode as q,ClearBufferBit as g,TextureWrapMode as C}from"../../../../webgl/enums.js";import{Texture as j}from"../../../../webgl/Texture.js";import{TextureDescriptor as A}from"../../../../webgl/TextureDescriptor.js";let w=class extends d{constructor(e){super(e),this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new b,this.produces=new Map([[x.ANTIALIASING,()=>this._isEnabled&&null!=this._context]])}get updating(){return null!=this._abortController}initializeRenderContext(e){this._context=e,this.addHandles([a((()=>this.view.qualitySettings.antialiasingEnabled),(e=>e||this._context?.isFeatureEnabled(T.Antialiasing)?this.enable():this.disable()),n)])}renderFeatureChanged(){this.view.qualitySettings.antialiasingEnabled||this._context?.isFeatureEnabled(T.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}enable(){if(this._isEnabled||!this._context||this._abortController)return;if(null==this._edgeTechnique&&(this._edgeTechnique=this._context.techniqueRepository.acquire(p)),null==this._blendTechnique&&(this._blendTechnique=this._context.techniqueRepository.acquire(_)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(m)),this._areaTexture&&this._searchTexture)return void(this._isEnabled=!0);this._abortController=new AbortController;const e=this._abortController.signal;import("./SMAAData.js").then((t=>this._loadTextures(this._context,t,e))).then((()=>{this._context?.requestRender(),this._abortController=null})).catch((e=>{s(e)||this._disposeTextures()}))}_loadTextures(e,t,r){return i(r),e?Promise.all([u(t.areaTexture).then((t=>E(e.fbos.rctx,q.LINEAR,f.RGB,t))),u(t.searchTexure).then((t=>E(e.fbos.rctx,q.NEAREST,f.LUMINANCE,t)))]).then((([e,t])=>{o(r)?(e.dispose(),t.dispose(),i(r)):(this._areaTexture=e,this._searchTexture=t,this._isEnabled=!0)})):Promise.reject()}_disposeTextures(){this._areaTexture=t(this._areaTexture),this._searchTexture=t(this._searchTexture)}disable(){this._abortController=r(this._abortController),this._isEnabled=!1}destroy(){this.disable(),this._disposeTextures()}renderNode(e,t,r,s){if(!(this._isEnabled&&this._context&&r&&r.compositeTexture))return s;if(!(this._edgeTechnique?.compiled&&this._blendTechnique?.compiled&&this._blurTechnique?.compiled))return this._context.requestRender(),s;const i=r.compositeTexture,o=i.descriptor.width,a=i.descriptor.height,n=this._context.fbos,h=e.rctx;h.setViewport(0,0,o,a);const l=n.acquire(c.RG,o,a);h.bindFramebuffer(l.fbo),h.setClearColor(0,0,0,1),h.clear(g.COLOR_BUFFER_BIT),this._smaaParameters.color=i,h.bindTechnique(this._edgeTechnique,this._smaaParameters),h.screen.draw();const u=n.acquire(c.RGBA,o,a);return h.bindFramebuffer(u.fbo),h.setClearColor(0,0,1,1),h.clear(g.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=l.colorTexture,this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,h.bindTechnique(this._blendTechnique,this._smaaParameters),h.screen.draw(),h.bindFramebuffer(s?.fbo),l.release(),h.setClearColor(0,1,0,1),h.clear(g.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=u.colorTexture,h.bindTechnique(this._blurTechnique,this._smaaParameters),h.screen.draw(),u.release(),s}};function E(e,t,r,s){const i=new A;return i.pixelFormat=r,i.wrapMode=C.CLAMP_TO_EDGE,i.width=s.width,i.height=s.height,i.samplingMode=t,new j(e,i,s)}e([h()],w.prototype,"view",void 0),e([h()],w.prototype,"_context",void 0),e([h()],w.prototype,"_abortController",void 0),e([h({readOnly:!0})],w.prototype,"updating",null),w=e([l("esri.views.3d.webgl-engine.lib.SMAA")],w);export{w as SMAA};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t,abortMaybe as r}from"../../../../../core/maybe.js";import{isAbortError as s,throwIfAborted as i,isAborted as o}from"../../../../../core/promiseUtils.js";import{watch as a,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as h}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{requestImage as u}from"../../../../../support/requestImageUtils.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as d}from"../RenderPlugin.js";import{SMAABlendWeightsTechnique as _}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as m}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as p}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as b}from"./SMAAPassParameters.js";import{RenderFeature as T}from"../../lib/RenderFeature.js";import{RenderSlot as x}from"../../lib/RenderSlot.js";import{PixelFormat as f,TextureSamplingMode as q,ClearBufferBit as g,TextureWrapMode as C}from"../../../../webgl/enums.js";import{Texture as j}from"../../../../webgl/Texture.js";import{TextureDescriptor as A}from"../../../../webgl/TextureDescriptor.js";let w=class extends d{constructor(e){super(e),this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new b,this.produces=new Map([[x.ANTIALIASING,()=>this._isEnabled&&null!=this._context]])}get updating(){return null!=this._abortController}initializeRenderContext(e){this._context=e,this.addHandles([a((()=>this.view.qualitySettings.antialiasingEnabled),(e=>e||this._context?.isFeatureEnabled(T.Antialiasing)?this.enable():this.disable()),n)])}renderFeatureChanged(){this.view.qualitySettings.antialiasingEnabled||this._context?.isFeatureEnabled(T.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}enable(){if(this._isEnabled||!this._context||this._abortController)return;if(null==this._edgeTechnique&&(this._edgeTechnique=this._context.techniqueRepository.acquire(p)),null==this._blendTechnique&&(this._blendTechnique=this._context.techniqueRepository.acquire(_)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(m)),this._areaTexture&&this._searchTexture)return void(this._isEnabled=!0);this._abortController=new AbortController;const e=this._abortController.signal;import("./SMAAData.js").then((t=>this._loadTextures(this._context,t,e))).then((()=>{this._context?.requestRender(),this._abortController=null})).catch((e=>{s(e)||this._disposeTextures()}))}_loadTextures(e,t,r){return i(r),e?Promise.all([u(t.areaTexture).then((t=>E(e.fbos.rctx,q.LINEAR,f.RGB,t))),u(t.searchTexure).then((t=>E(e.fbos.rctx,q.NEAREST,f.LUMINANCE,t)))]).then((([e,t])=>{o(r)?(e.dispose(),t.dispose(),i(r)):(this._areaTexture=e,this._searchTexture=t,this._isEnabled=!0)})):Promise.reject()}_disposeTextures(){this._areaTexture=t(this._areaTexture),this._searchTexture=t(this._searchTexture)}disable(){this._abortController=r(this._abortController),this._isEnabled=!1}destroy(){this.disable(),this._disposeTextures()}renderNode(e,t,r,s){const i=r?.composite?.colorTexture;if(!(this._isEnabled&&this._context&&r&&i))return s;if(!(this._edgeTechnique?.compiled&&this._blendTechnique?.compiled&&this._blurTechnique?.compiled))return this._context.requestRender(),s;const o=i.descriptor.width,a=i.descriptor.height,n=this._context.fbos,h=e.rctx;h.setViewport(0,0,o,a);const l=n.acquire(c.RG,o,a);h.bindFramebuffer(l.fbo),h.setClearColor(0,0,0,1),h.clear(g.COLOR_BUFFER_BIT),this._smaaParameters.color=i,h.bindTechnique(this._edgeTechnique,this._smaaParameters),h.screen.draw();const u=n.acquire(c.RGBA,o,a);return h.bindFramebuffer(u.fbo),h.setClearColor(0,0,1,1),h.clear(g.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=l.colorTexture,this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,h.bindTechnique(this._blendTechnique,this._smaaParameters),h.screen.draw(),h.bindFramebuffer(s?.fbo),l.release(),h.setClearColor(0,1,0,1),h.clear(g.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=u.colorTexture,h.bindTechnique(this._blurTechnique,this._smaaParameters),h.screen.draw(),u.release(),s}};function E(e,t,r,s){const i=new A;return i.pixelFormat=r,i.wrapMode=C.CLAMP_TO_EDGE,i.width=s.width,i.height=s.height,i.samplingMode=t,new j(e,i,s)}e([h()],w.prototype,"view",void 0),e([h()],w.prototype,"_context",void 0),e([h()],w.prototype,"_abortController",void 0),e([h({readOnly:!0})],w.prototype,"updating",null),w=e([l("esri.views.3d.webgl-engine.effects.smaa.SMAA")],w);export{w as SMAA};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}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";import{s as n}from"../../../../../chunks/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as m,ConsumesDepthNormal as l,ConsumesNone as u}from"../RenderPlugin.js";import{SSAOBlurTechnique as h}from"./SSAOBlurTechnique.js";import{noiseData as p}from"./SSAONoiseData.js";import{SSAOPassParameters as _,BlurDrawParameters as d}from"./SSAOParameters.js";import{SSAOTechnique as b}from"./SSAOTechnique.js";import{RenderFeature as T}from"../../lib/RenderFeature.js";import{RenderSlot as w}from"../../lib/RenderSlot.js";import{g as x}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as f,PixelFormat as P,ClearBufferBit as S}from"../../../../webgl/enums.js";import{Texture as q}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";const R=2;let y=class extends m{constructor(e){super(e),this._context=null,this._passParameters=new _,this._drawParameters=new d,this.produces=new Map([[w.SSAO,()=>this._produces()]])}_produces(){return null!=this._enableTime&&null!=this._context}consumes(){return this._produces()?l:u}initializeRenderContext(e){this._context=e,this.addHandles([r((()=>this.view.qualitySettings.ambientOcclusion||this._context?.isFeatureEnabled(T.SSAO)),(e=>e?this._enable():this._disable()),s)])}uninitializeRenderContext(){this._disable(),this._context=null}_disable(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture),this._enableTime=null}destroy(){this._disable()}_enable(){if(null!=this._enableTime||!this._context)return;const e=Uint8Array.from(atob(p),(e=>e.charCodeAt(0))),t=new j;t.wrapMode=f.CLAMP_TO_EDGE,t.pixelFormat=P.RGB,t.wrapMode=f.REPEAT,t.hasMipmap=!0,t.width=32,t.height=32,this._passParameters.noiseTexture=new q(this._context.renderContext.rctx,t,e),null==this._ssaoTechnique&&(this._ssaoTechnique=this._context.techniqueRepository.acquire(b)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(h)),this._enableTime=i(0),this._context?.requestRender()}renderNode(e,t,r){const s=e.bindParameters,i=s.linearDepth?.colorTexture;if(null==this._enableTime||null==this._context||null==i||!r?.normalTexture)return;if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=e.time,void this._context.requestRender();0===this._enableTime&&(this._enableTime=e.time);const o=e.rctx,a=s.camera,m=this.view.qualitySettings.fadeDuration,l=m>0?Math.min(m,e.time-this._enableTime)/m:1;this._passParameters.normalTexture=r.normalTexture,this._passParameters.depthTexture=i,this._passParameters.projScale=1/a.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*O/x(a)**6*l;const u=a.fullViewport[2],h=a.fullViewport[3],p=u/R,_=h/R,d=this._context.fbos,b=d.acquire(c.RED,u,h);o.bindFramebuffer(b.fbo),o.setViewport(0,0,u,h);o.bindTechnique(this._ssaoTechnique,this._passParameters,s).bindDraw(this._drawParameters,s,this._passParameters),o.screen.draw();const T=o.bindTechnique(this._blurTechnique,this._passParameters,s);o.setViewport(0,0,p,_);const w=d.acquire(c.RED,p,_);o.bindFramebuffer(w.fbo),this._drawParameters.colorTexture=b.colorTexture,n(this._drawParameters.blurSize,0,R/h),T.bindDraw(this._drawParameters,s,this._passParameters),o.setViewport(0,0,p,_),o.screen.draw(),b.release();const f=d.acquire(c.RED,p,_);return o.bindFramebuffer(f.fbo),o.setViewport(0,0,u,h),o.setClearColor(1,1,1,0),o.clear(S.COLOR_BUFFER_BIT),o.setViewport(0,0,p,_),this._drawParameters.colorTexture=w.colorTexture,n(this._drawParameters.blurSize,R/u,0),T.bindDraw(this._drawParameters,s,this._passParameters),o.screen.draw(),o.setViewport4fv(a.fullViewport),w.release(),l<1&&this._context.requestRender(),f}};e([o({constructOnly:!0})],y.prototype,"view",void 0),e([o()],y.prototype,"_context",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SSAO")],y);const O=.5;export{y as SSAO,R as blurSizePixels};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}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";import{s as n}from"../../../../../chunks/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as m,ConsumesDepthNormal as l,ConsumesNone as u}from"../RenderPlugin.js";import{SSAOBlurTechnique as h}from"./SSAOBlurTechnique.js";import{noiseData as p}from"./SSAONoiseData.js";import{SSAOPassParameters as _,BlurDrawParameters as d}from"./SSAOParameters.js";import{SSAOTechnique as b}from"./SSAOTechnique.js";import{RenderFeature as f}from"../../lib/RenderFeature.js";import{RenderSlot as w}from"../../lib/RenderSlot.js";import{g as T}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as x,PixelFormat as P,ClearBufferBit as S}from"../../../../webgl/enums.js";import{Texture as q}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";const R=2;let y=class extends m{constructor(e){super(e),this._context=null,this._passParameters=new _,this._drawParameters=new d,this.produces=new Map([[w.SSAO,()=>this._produces()]])}_produces(){return null!=this._enableTime&&null!=this._context}consumes(){return this._produces()?l:u}initializeRenderContext(e){this._context=e,this.addHandles([r((()=>this.view.qualitySettings.ambientOcclusion||this._context?.isFeatureEnabled(f.SSAO)),(e=>e?this._enable():this._disable()),s)])}uninitializeRenderContext(){this._disable(),this._context=null}_disable(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture),this._enableTime=null}destroy(){this._disable()}_enable(){if(null!=this._enableTime||!this._context)return;const e=Uint8Array.from(atob(p),(e=>e.charCodeAt(0))),t=new j;t.wrapMode=x.CLAMP_TO_EDGE,t.pixelFormat=P.RGB,t.wrapMode=x.REPEAT,t.hasMipmap=!0,t.width=32,t.height=32,this._passParameters.noiseTexture=new q(this._context.renderContext.rctx,t,e),null==this._ssaoTechnique&&(this._ssaoTechnique=this._context.techniqueRepository.acquire(b)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(h)),this._enableTime=i(0),this._context?.requestRender()}renderNode(e,t,r){const s=e.bindParameters,i=s.linearDepth?.colorTexture,o=r?.normal?.colorTexture;if(null==this._enableTime||null==this._context||null==i||!o)return;if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=e.time,void this._context.requestRender();0===this._enableTime&&(this._enableTime=e.time);const a=e.rctx,m=s.camera,l=this.view.qualitySettings.fadeDuration,u=l>0?Math.min(l,e.time-this._enableTime)/l:1;this._passParameters.normalTexture=o,this._passParameters.depthTexture=i,this._passParameters.projScale=1/m.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*O/T(m)**6*u;const h=m.fullViewport[2],p=m.fullViewport[3],_=h/R,d=p/R,b=this._context.fbos,f=b.acquire(c.RED,h,p);a.bindFramebuffer(f.fbo),a.setViewport(0,0,h,p);a.bindTechnique(this._ssaoTechnique,this._passParameters,s).bindDraw(this._drawParameters,s,this._passParameters),a.screen.draw();const w=a.bindTechnique(this._blurTechnique,this._passParameters,s);a.setViewport(0,0,_,d);const x=b.acquire(c.RED,_,d);a.bindFramebuffer(x.fbo),this._drawParameters.colorTexture=f.colorTexture,n(this._drawParameters.blurSize,0,R/p),w.bindDraw(this._drawParameters,s,this._passParameters),a.setViewport(0,0,_,d),a.screen.draw(),f.release();const P=b.acquire(c.RED,_,d);return a.bindFramebuffer(P.fbo),a.setViewport(0,0,h,p),a.setClearColor(1,1,1,0),a.clear(S.COLOR_BUFFER_BIT),a.setViewport(0,0,_,d),this._drawParameters.colorTexture=x.colorTexture,n(this._drawParameters.blurSize,R/h,0),w.bindDraw(this._drawParameters,s,this._passParameters),a.screen.draw(),a.setViewport4fv(m.fullViewport),x.release(),u<1&&this._context.requestRender(),P}};e([o({constructOnly:!0})],y.prototype,"view",void 0),e([o()],y.prototype,"_context",void 0),y=e([a("esri.views.3d.webgl-engine.effects.ssao.SSAO")],y);const O=.5;export{y as SSAO,R as blurSizePixels};