@arcgis/core 4.24.0-next.20220511 → 4.24.0-next.20220516

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 (423) hide show
  1. package/analysis/LengthDimension.js +1 -1
  2. package/assets/components/assets/icon/compactness16.json +1 -0
  3. package/assets/components/assets/icon/compactness24.json +1 -0
  4. package/assets/components/assets/icon/compactness32.json +1 -0
  5. package/assets/components/assets/icon/configure16.json +1 -0
  6. package/assets/components/assets/icon/configure24.json +1 -0
  7. package/assets/components/assets/icon/configure32.json +1 -0
  8. package/assets/components/assets/icon/debugScript16.json +1 -0
  9. package/assets/components/assets/icon/debugScript24.json +1 -0
  10. package/assets/components/assets/icon/debugScript32.json +1 -0
  11. package/assets/components/assets/icon/dissolveFeatures16.json +1 -0
  12. package/assets/components/assets/icon/dissolveFeatures24.json +1 -0
  13. package/assets/components/assets/icon/dissolveFeatures32.json +1 -0
  14. package/assets/components/assets/icon/distanceType16.json +1 -0
  15. package/assets/components/assets/icon/distanceType24.json +1 -0
  16. package/assets/components/assets/icon/distanceType32.json +1 -0
  17. package/assets/components/assets/icon/gridDiamond16.json +1 -0
  18. package/assets/components/assets/icon/gridDiamond24.json +1 -0
  19. package/assets/components/assets/icon/gridDiamond32.json +1 -0
  20. package/assets/components/assets/icon/gridHexagon16.json +1 -0
  21. package/assets/components/assets/icon/gridHexagon24.json +1 -0
  22. package/assets/components/assets/icon/gridHexagon32.json +1 -0
  23. package/assets/components/assets/icon/gridTriangle16.json +1 -0
  24. package/assets/components/assets/icon/gridTriangle24.json +1 -0
  25. package/assets/components/assets/icon/gridTriangle32.json +1 -0
  26. package/assets/components/assets/icon/insets16.json +1 -0
  27. package/assets/components/assets/icon/insets24.json +1 -0
  28. package/assets/components/assets/icon/insets32.json +1 -0
  29. package/assets/components/assets/icon/maximumTerritoryDistance16.json +1 -0
  30. package/assets/components/assets/icon/maximumTerritoryDistance24.json +1 -0
  31. package/assets/components/assets/icon/maximumTerritoryDistance32.json +1 -0
  32. package/assets/components/assets/icon/minDistanceBetweenCenters16.json +1 -0
  33. package/assets/components/assets/icon/minDistanceBetweenCenters24.json +1 -0
  34. package/assets/components/assets/icon/minDistanceBetweenCenters32.json +1 -0
  35. package/assets/components/assets/icon/numberOfTerritories16.json +1 -0
  36. package/assets/components/assets/icon/numberOfTerritories24.json +1 -0
  37. package/assets/components/assets/icon/numberOfTerritories32.json +1 -0
  38. package/assets/components/assets/icon/overlapFeatures16.json +1 -0
  39. package/assets/components/assets/icon/overlapFeatures24.json +1 -0
  40. package/assets/components/assets/icon/overlapFeatures32.json +1 -0
  41. package/assets/components/assets/icon/profileVariables16.json +1 -0
  42. package/assets/components/assets/icon/profileVariables24.json +1 -0
  43. package/assets/components/assets/icon/profileVariables32.json +1 -0
  44. package/assets/components/assets/icon/rasterAnalysis16.json +1 -0
  45. package/assets/components/assets/icon/rasterAnalysis24.json +1 -0
  46. package/assets/components/assets/icon/rasterAnalysis32.json +1 -0
  47. package/assets/components/assets/icon/recurrence16.json +1 -0
  48. package/assets/components/assets/icon/recurrence24.json +1 -0
  49. package/assets/components/assets/icon/recurrence32.json +1 -0
  50. package/assets/components/assets/icon/splitFeatures16.json +1 -0
  51. package/assets/components/assets/icon/splitFeatures24.json +1 -0
  52. package/assets/components/assets/icon/splitFeatures32.json +1 -0
  53. package/assets/components/assets/icon/territoryBufferDistance16.json +1 -0
  54. package/assets/components/assets/icon/territoryBufferDistance24.json +1 -0
  55. package/assets/components/assets/icon/territoryBufferDistance32.json +1 -0
  56. package/assets/components/assets/icon/testData16.json +1 -0
  57. package/assets/components/assets/icon/testData24.json +1 -0
  58. package/assets/components/assets/icon/testData32.json +1 -0
  59. package/assets/esri/core/workers/RemoteClient.js +1 -1
  60. package/assets/esri/core/workers/chunks/0ecaa28b8bff1d779d66.js +1 -0
  61. package/assets/esri/core/workers/chunks/161ad66d11d80a9048bb.js +1 -0
  62. package/assets/esri/core/workers/chunks/{adae54f116f311d72d97.js → 1aba8c73c62a64e0658c.js} +1 -1
  63. package/assets/esri/core/workers/chunks/1d109cd048170e2d529a.js +1 -0
  64. package/assets/esri/core/workers/chunks/329b005a06c0e7f0e9f1.js +1 -0
  65. package/assets/esri/core/workers/chunks/366e5c1abd1ab6d3e548.js +1 -0
  66. package/assets/esri/core/workers/chunks/3e94e35f44aadbb332ff.js +1 -0
  67. package/assets/esri/core/workers/chunks/{9f4d892abf55e8625bc9.js → 44403c3ecc7d949a577c.js} +1 -1
  68. package/assets/esri/core/workers/chunks/46411f32b29a0e783105.js +1 -0
  69. package/assets/esri/core/workers/chunks/6281b15009712a5dee3c.js +1 -0
  70. package/assets/esri/core/workers/chunks/66f627d68dbb0fdb725f.js +1 -0
  71. package/assets/esri/core/workers/chunks/672da24bbf86718bf48d.js +1 -0
  72. package/assets/esri/core/workers/chunks/{c51c9b5da855f84b9a48.js → 7391422fc51acb96a25d.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{f435dc615fdc8917f6ca.js → 7cf3cff7b28ff007dbad.js} +1 -1
  74. package/assets/esri/core/workers/chunks/7ea06c86adfc827fda08.js +1 -0
  75. package/assets/esri/core/workers/chunks/{a054a52712a118c6d505.js → 82bc24bdc9c6ebaf58c0.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{b089058b64db3912478f.js → 86ce33b38887e7dec7f9.js} +1 -1
  77. package/assets/esri/core/workers/chunks/8965ab74e03506e3475e.js +1 -0
  78. package/assets/esri/core/workers/chunks/{5405f478af3563580926.js → 8b497d9c37a8f577a467.js} +1 -1
  79. package/assets/esri/core/workers/chunks/919d0d8b1c2176760973.js +1 -0
  80. package/assets/esri/core/workers/chunks/92898387584524a8e626.js +1 -0
  81. package/assets/esri/core/workers/chunks/a508d936296185456b9a.js +1 -0
  82. package/assets/esri/core/workers/chunks/ab2a0480dc2b608deda3.js +1 -0
  83. package/assets/esri/core/workers/chunks/ab97a35f7a7d5cf1da19.js +2 -0
  84. package/assets/esri/core/workers/chunks/{dcd0653191cd4a1ccaae.js.LICENSE.txt → ab97a35f7a7d5cf1da19.js.LICENSE.txt} +1 -1
  85. package/assets/esri/core/workers/chunks/ae554c88e862a5761f2e.js +1 -0
  86. package/assets/esri/core/workers/chunks/ae5ce55cd1a32525f101.js +1 -0
  87. package/assets/esri/core/workers/chunks/b597c04a4abb98e29d1c.js +1 -0
  88. package/assets/esri/core/workers/chunks/{287c484fd40eee643f3a.js → b78c3e9d31c4a562cdf0.js} +1 -1
  89. package/assets/esri/core/workers/chunks/be4bf1e4cbe2a593f8b3.js +1 -0
  90. package/assets/esri/core/workers/chunks/{b7572b0921b23aef8b9d.js → c40d9caf5189be2c698e.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{b28539c5a6bedb71b038.js → d63f736b3560c577a8a4.js} +1 -1
  92. package/assets/esri/core/workers/chunks/dd6c9a114ad38cf622ba.js +1 -0
  93. package/assets/esri/core/workers/chunks/e6b0f74226b9394bfa7a.js +1 -0
  94. package/assets/esri/images/portal/notebook16.png +0 -0
  95. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  96. package/assets/esri/themes/base/widgets/_Editor.scss +3 -2
  97. package/assets/esri/themes/base/widgets/_Tooltip.scss +15 -1
  98. package/assets/esri/themes/dark/main.css +1 -1
  99. package/assets/esri/themes/light/main.css +1 -1
  100. package/assets/esri/themes/light/view.css +1 -1
  101. package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -0
  102. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ar.json +1 -0
  103. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_bg.json +1 -0
  104. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_bs.json +1 -0
  105. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ca.json +1 -0
  106. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_cs.json +1 -0
  107. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_da.json +1 -0
  108. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_de.json +1 -0
  109. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_el.json +1 -0
  110. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -0
  111. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_es.json +1 -0
  112. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_et.json +1 -0
  113. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_fi.json +1 -0
  114. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_fr.json +1 -0
  115. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_he.json +1 -0
  116. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_hr.json +1 -0
  117. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_hu.json +1 -0
  118. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_id.json +1 -0
  119. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_it.json +1 -0
  120. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ja.json +1 -0
  121. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ko.json +1 -0
  122. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_lt.json +1 -0
  123. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_lv.json +1 -0
  124. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_nb.json +1 -0
  125. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_nl.json +1 -0
  126. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_pl.json +1 -0
  127. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_pt-BR.json +1 -0
  128. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_pt-PT.json +1 -0
  129. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ro.json +1 -0
  130. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ru.json +1 -0
  131. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sk.json +1 -0
  132. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sl.json +1 -0
  133. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sr.json +1 -0
  134. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sv.json +1 -0
  135. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_th.json +1 -0
  136. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_tr.json +1 -0
  137. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_uk.json +1 -0
  138. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_vi.json +1 -0
  139. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_zh-CN.json +1 -0
  140. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_zh-HK.json +1 -0
  141. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_zh-TW.json +1 -0
  142. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace.json +1 -1
  143. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ar.json +1 -1
  144. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bg.json +1 -1
  145. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bs.json +1 -1
  146. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ca.json +1 -1
  147. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
  148. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_da.json +1 -1
  149. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_de.json +1 -1
  150. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
  151. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_es.json +1 -1
  152. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_et.json +1 -1
  153. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fi.json +1 -1
  154. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
  155. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_he.json +1 -1
  156. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hr.json +1 -1
  157. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hu.json +1 -1
  158. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_id.json +1 -1
  159. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_it.json +1 -1
  160. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ja.json +1 -1
  161. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ko.json +1 -1
  162. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lt.json +1 -1
  163. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
  164. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nb.json +1 -1
  165. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nl.json +1 -1
  166. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pl.json +1 -1
  167. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-BR.json +1 -1
  168. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-PT.json +1 -1
  169. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ro.json +1 -1
  170. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ru.json +1 -1
  171. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sk.json +1 -1
  172. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sl.json +1 -1
  173. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sr.json +1 -1
  174. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sv.json +1 -1
  175. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_th.json +1 -1
  176. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_tr.json +1 -1
  177. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_uk.json +1 -1
  178. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_vi.json +1 -1
  179. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-CN.json +1 -1
  180. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-HK.json +1 -1
  181. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-TW.json +1 -1
  182. package/chunks/BlendLayers.glsl.js +9 -5
  183. package/chunks/Clouds.glsl.js +29 -11
  184. package/chunks/EdgeShader.glsl.js +3 -4
  185. package/chunks/NoiseTextureAtlas.glsl.js +184 -241
  186. package/chunks/Precipitation.glsl.js +1 -1
  187. package/chunks/vxlLayer.js +1 -1
  188. package/core/quantityFormatUtils.js +1 -1
  189. package/core/unitFormatUtils.js +1 -1
  190. package/interfaces.d.ts +895 -32
  191. package/layers/FeatureLayer.js +1 -1
  192. package/layers/GeoJSONLayer.js +1 -1
  193. package/layers/OGCFeatureLayer.js +1 -1
  194. package/layers/RouteLayer.js +1 -1
  195. package/layers/SceneLayer.js +1 -1
  196. package/layers/StreamLayer.js +1 -1
  197. package/layers/SubtypeGroupLayer.js +1 -1
  198. package/layers/WFSLayer.js +1 -1
  199. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  200. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  201. package/layers/mixins/ArcGISImageService.js +1 -1
  202. package/layers/save/featureLayerUtils.js +1 -1
  203. package/layers/support/AggregateField.d.ts +4 -0
  204. package/layers/support/AggregateField.js +1 -1
  205. package/layers/support/FeatureReductionBinning.d.ts +4 -0
  206. package/layers/support/FeatureReductionBinning.js +1 -1
  207. package/layers/support/OutStatistic.d.ts +4 -0
  208. package/layers/support/Sublayer.js +1 -1
  209. package/layers/support/SubtypeSublayer.js +1 -1
  210. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  211. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  212. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  213. package/layers/support/rasterFunctions/stretchUtils.js +1 -1
  214. package/package.json +3 -3
  215. package/portal/support/portalItemUtils.js +1 -1
  216. package/renderers/PieChartRenderer.d.ts +4 -0
  217. package/renderers/PieChartRenderer.js +5 -0
  218. package/renderers/Renderer.js +1 -1
  219. package/renderers/support/AuthoringInfo.js +1 -1
  220. package/renderers/support/RasterSymbolizer.js +1 -1
  221. package/renderers/support/clickToleranceUtils.js +1 -1
  222. package/renderers/support/rasterRendererHelper.js +1 -1
  223. package/renderers/support/types.js +1 -1
  224. package/renderers/support/utils.js +1 -1
  225. package/renderers.js +1 -1
  226. package/request.js +1 -1
  227. package/rest/imageService/fetchRasterInfo.js +5 -0
  228. package/rest/imageService/getCatalogItemRasterInfo.js +5 -0
  229. package/rest/print.js +1 -1
  230. package/smartMapping/renderers/color.js +1 -1
  231. package/smartMapping/renderers/dotDensity.js +1 -1
  232. package/smartMapping/renderers/heatmap.js +1 -1
  233. package/smartMapping/renderers/location.js +1 -1
  234. package/smartMapping/renderers/size.js +1 -1
  235. package/smartMapping/renderers/type.js +1 -1
  236. package/support/arcadeUtils.js +1 -1
  237. package/support/revision.js +1 -1
  238. package/{widgets/support/widgetThemeUtils.js → support/themeUtils.js} +0 -0
  239. package/symbols/cim/CIMSymbolHelper.js +1 -1
  240. package/symbols/cim/CurveHelper.js +1 -1
  241. package/symbols/cim/ExpandedCIM.js +1 -1
  242. package/symbols/cim/cimAnalyzer.js +1 -1
  243. package/symbols/cim/enums.js +1 -1
  244. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  245. package/views/2d/engine/brushes.js +1 -1
  246. package/views/2d/engine/vectorTiles/GlyphSource.js +1 -1
  247. package/views/2d/engine/vectorTiles/style/Filter.js +1 -1
  248. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  249. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  250. package/views/2d/engine/webgl/Painter.js +1 -1
  251. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  252. package/views/2d/engine/webgl/TextureManager.js +1 -1
  253. package/views/2d/engine/webgl/Utils.js +1 -1
  254. package/views/2d/engine/webgl/animatedFormats/BaseAnimatableTextureResource.js +5 -0
  255. package/views/2d/engine/webgl/animatedFormats/apng.js +1 -1
  256. package/views/2d/engine/webgl/animatedFormats/gif.js +1 -1
  257. package/views/2d/engine/webgl/animatedFormats/utils.js +5 -0
  258. package/views/2d/engine/webgl/brushes/WGLBrushPieChart.js +5 -0
  259. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  260. package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
  261. package/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js +1 -1
  262. package/views/2d/engine/webgl/color.js +1 -1
  263. package/views/2d/engine/webgl/definitions.js +1 -1
  264. package/views/2d/engine/webgl/enums.js +1 -1
  265. package/views/2d/engine/webgl/grouping.js +5 -0
  266. package/views/2d/engine/webgl/mesh/templates/WGLBaseFillTemplate.js +1 -1
  267. package/views/2d/engine/webgl/mesh/templates/WGLBaseLineTemplate.js +1 -1
  268. package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
  269. package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
  270. package/views/2d/engine/webgl/mesh/templates/WGLDynamicMeshTemplate.js +1 -1
  271. package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
  272. package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
  273. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  274. package/views/2d/engine/webgl/techniques/dotDensity/TechniqueDotDensity.js +1 -1
  275. package/views/2d/engine/webgl/techniques/pieChart/TechniquePieChart.js +5 -0
  276. package/views/2d/engine/webgl/techniques/utils.js +1 -1
  277. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  278. package/views/2d/layers/features/schemaUtils.js +1 -1
  279. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  280. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  281. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  282. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  283. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  284. package/views/3d/analysis/Dimensioning/DimensioningTool.js +1 -1
  285. package/views/3d/analysis/Dimensioning/LengthDimensionComputation.js +5 -0
  286. package/views/3d/analysis/Dimensioning/LengthDimensionVisualization.js +1 -1
  287. package/views/3d/analysis/DimensioningAnalysisView3D.js +1 -1
  288. package/views/3d/analysis/LengthDimensionResult.d.ts +4 -0
  289. package/views/3d/analysis/LengthDimensionResult.js +5 -0
  290. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  291. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  292. package/views/3d/analysis/Slice/SliceController.js +1 -1
  293. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  294. package/views/3d/camera/constraintUtils/altitude.js +1 -1
  295. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  296. package/views/3d/environment/Clouds.glsl.js +1 -1
  297. package/views/3d/environment/CloudsGenerator.js +1 -1
  298. package/views/3d/environment/CloudsPresets.js +1 -1
  299. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  300. package/views/3d/environment/Fog.js +1 -1
  301. package/views/3d/environment/NoiseTextureAtlas.glsl.js +1 -1
  302. package/views/3d/environment/NoiseTextureAtlas.js +1 -1
  303. package/views/3d/environment/NoiseTextureAtlasConfiguration.js +5 -0
  304. package/views/3d/environment/NoiseTextureAtlasDimensions.js +5 -0
  305. package/views/3d/environment/NoiseTextureAtlasTechnique.js +1 -1
  306. package/views/3d/environment/Precipitation.js +1 -1
  307. package/views/3d/environment/SnowyWeather.d.ts +4 -0
  308. package/views/3d/interactive/SegmentLabels3D.js +1 -1
  309. package/views/3d/interactive/editingTools/manipulations/Manipulation.js +1 -1
  310. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  311. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  312. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  313. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  314. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  315. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  316. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  317. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  318. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  319. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  320. package/views/3d/layers/I3SMeshView3D.js +1 -1
  321. package/views/3d/layers/MediaLayerView3D.js +1 -1
  322. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  323. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  324. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  325. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  326. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  327. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  328. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  329. package/views/3d/terrain/BlendLayersTechnique.js +1 -1
  330. package/views/3d/terrain/OverlayRenderer.js +1 -1
  331. package/views/3d/terrain/TerrainConst.js +1 -1
  332. package/views/3d/terrain/TerrainRenderer.js +1 -1
  333. package/views/3d/terrain/TerrainSurface.js +1 -1
  334. package/views/3d/terrain/TileCompositor.js +1 -1
  335. package/views/3d/terrain/TileRenderer.js +1 -1
  336. package/views/3d/terrain/terrainUtils.js +1 -1
  337. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  338. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  339. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  340. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +5 -5
  341. package/views/3d/webgl-engine/core/shaderLibrary/terrain/BackgroundGrid.glsl.js +32 -0
  342. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +9 -32
  343. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
  344. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  345. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  346. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  347. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechniqueConfiguration.js +1 -1
  348. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  349. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  350. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  351. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +37 -31
  352. package/views/draw/DrawOperation.js +1 -1
  353. package/views/interactive/SegmentLabels.js +1 -1
  354. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  355. package/views/interactive/snapping/SceneSnappingEngine.js +5 -0
  356. package/views/interactive/snapping/SnappingManager.js +1 -1
  357. package/views/interactive/snapping/snappingFactory.js +5 -0
  358. package/views/interactive/tooltip/DrawTooltipInfos.js +5 -0
  359. package/views/interactive/tooltip/ExtentTooltipInfos.js +5 -0
  360. package/views/interactive/tooltip/Tooltip.js +1 -1
  361. package/views/interactive/tooltip/TransformTooltipInfos.js +5 -0
  362. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  363. package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
  364. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  365. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  366. package/views/interactive/tooltip/content/TooltipContentExtentMoveXY.js +5 -0
  367. package/views/interactive/tooltip/content/TooltipContentExtentMoveZ.js +5 -0
  368. package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +5 -0
  369. package/views/interactive/tooltip/content/TooltipContentExtentScale.js +5 -0
  370. package/views/interactive/tooltip/content/TooltipContentTransformAbsolute.js +5 -0
  371. package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +5 -0
  372. package/views/interactive/tooltip/content/TooltipContentTransformScale.js +5 -0
  373. package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
  374. package/views/interactive/tooltip/content/tooltipContentFactory.js +1 -1
  375. package/views/interactive/tooltip/support/ValueByValue.js +5 -0
  376. package/views/interactive/tooltip/support/measurements.js +1 -1
  377. package/views/overlay/TextOverlayItem.js +1 -1
  378. package/views/support/lengthMeasurementUtils.js +1 -1
  379. package/views/ui/UI.js +1 -1
  380. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  381. package/widgets/BasemapLayerList.js +1 -1
  382. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  383. package/widgets/Editor/workflowUtils.js +1 -1
  384. package/widgets/Editor.js +1 -1
  385. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  386. package/widgets/Feature/FeatureMedia.js +1 -1
  387. package/widgets/LayerList.js +1 -1
  388. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  389. package/widgets/Popup/PopupViewModel.js +1 -1
  390. package/widgets/Popup/actionUtils.js +1 -1
  391. package/widgets/Sketch/SketchViewModel.js +1 -1
  392. package/widgets/TimeSlider.js +1 -1
  393. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  394. package/widgets/UtilityNetworkTrace.js +1 -1
  395. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  396. package/widgets/support/widget.js +1 -1
  397. package/arcade/featureset/support/ArcadeExporter.js +0 -5
  398. package/assets/esri/core/workers/chunks/0564f1cfa3d17ff1aad3.js +0 -1
  399. package/assets/esri/core/workers/chunks/0806d5d706a864542bfb.js +0 -1
  400. package/assets/esri/core/workers/chunks/52478ee2d2a1354b6900.js +0 -1
  401. package/assets/esri/core/workers/chunks/5759af97f96f24c40105.js +0 -1
  402. package/assets/esri/core/workers/chunks/7bc828fbdd54c0b28aac.js +0 -1
  403. package/assets/esri/core/workers/chunks/875f26ee040f3d75c0db.js +0 -1
  404. package/assets/esri/core/workers/chunks/88384e7cafbfd2348598.js +0 -1
  405. package/assets/esri/core/workers/chunks/89acd5f888d6b8df4aad.js +0 -1
  406. package/assets/esri/core/workers/chunks/9d7533aaeac3b8d145c4.js +0 -1
  407. package/assets/esri/core/workers/chunks/a3bb600bfcb0282622f1.js +0 -1
  408. package/assets/esri/core/workers/chunks/b50ae3dc7e43ff452568.js +0 -1
  409. package/assets/esri/core/workers/chunks/b5b7bcbc19b3430903ee.js +0 -1
  410. package/assets/esri/core/workers/chunks/b758f3c419edc2306784.js +0 -1
  411. package/assets/esri/core/workers/chunks/cf47b605c31063e88357.js +0 -1
  412. package/assets/esri/core/workers/chunks/cfbb332d144e65a4a55d.js +0 -1
  413. package/assets/esri/core/workers/chunks/db937849b2c1af87b481.js +0 -1
  414. package/assets/esri/core/workers/chunks/dc3ed59f450283d97a19.js +0 -1
  415. package/assets/esri/core/workers/chunks/dcd0653191cd4a1ccaae.js +0 -2
  416. package/assets/esri/core/workers/chunks/dfb6a28039e5d5ce6fd4.js +0 -1
  417. package/assets/esri/core/workers/chunks/e4fdd1eaf987977d0a51.js +0 -1
  418. package/assets/esri/core/workers/chunks/f7e0bb11ba3677069c94.js +0 -1
  419. package/assets/esri/core/workers/chunks/f7f3dde4c8f9c687cc1e.js +0 -1
  420. package/assets/esri/core/workers/chunks/fc6beaf9466ea3898549.js +0 -1
  421. package/views/interactive/tooltip/DrawPointTooltipInfo.js +0 -5
  422. package/views/interactive/tooltip/DrawPolygonTooltipInfo.js +0 -5
  423. package/views/interactive/tooltip/DrawPolylineTooltipInfo.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.24/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{isSome as s}from"../../../../core/maybe.js";import{d as a}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{b as o,m as u,g as l,a as m,i as d,e as f,n as p,l as y,p as h}from"../../../../chunks/vec3.js";import{c as M}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as C}from"../../../../geometry/projectionEllipsoid.js";import{j as I,k as O,t as T}from"../../../../chunks/sphere.js";import{defaultApplyOptions as A,TiltMode as D,InteractionType as S,hasConstraintType as w,ConstraintTypes as R,adjustRangeForInteraction as j}from"./common.js";import{viewAngle as x}from"../../state/utils/viewUtils.js";function P(t,r,n=A,i=!0){W.eyeCenterDistance=0,W.requiresTwoSteps=!1;const s=U(t,r,n,void 0,W);if(0===s)return!1;switch(a(z,-s,r.viewRight),n.tiltMode){case D.LOOK_AROUND:u(_,r.viewForward,z),l(_,_,W.eyeCenterDistance),r.center=m(G,r.eye,_);break;case D.TUMBLE:o(_,r.center,r.eye),u(_,_,z),r.eye=o(G,r.center,_);break;default:e(n.tiltMode)}return r.up=u(G,r.up,z),!W.requiresTwoSteps||!i||P(t,r,n,!1)}function U(e,t,r=A,n=A,i){if(!e.state.constraints.tilt)return 0;const s=t.distance,a=e.state.constraints.tilt(s,Q);return B(e,r,a),n.interactionType===S.TUMBLE&&w(n.selection,R.ALTITUDE)&&K(e,n.interactionStartCamera,a),r.tiltMode===D.LOOK_AROUND||n.tiltMode===D.LOOK_AROUND?L(e,t,a,i):v(e,t,a)}function v(e,r,n){const i=x(e.renderCoordsHelper,r.center,r.eye),s=i-t(i,n.min,n.max);return g(s)?s:0}function L(t,r,n,i){switch(i&&(i.requiresTwoSteps=!1),t.viewingMode){case"global":return q(t,r,n,i);case"local":return k(t,r,n,i);default:return void e(t.viewingMode)}}function k(e,r,n,i){const s=x(e.renderCoordsHelper,r.center,r.eye),a=t(s,n.min,n.max),c=s-a;if(!g(c))return 0;if(i){const t=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,n=e.renderCoordsHelper.getAltitude(r.eye)-t,s=Math.cos(a);Math.abs(s)>1e-4?i.eyeCenterDistance=n/s:i.eyeCenterDistance=r.distance}return c}function q(e,r,n,i){const s=b(e,r,V),a=t(s.tiltAtCenter,n.min,n.max);if(!g(s.tiltAtCenter-a))return 0;let c,o;return s.centerIsOnSurface?(c=E(s),o=F(s,c)):(c=s.constraints.clampTilt(s.eyeCenterDistance,s.tiltAtCenter),i&&c<Math.PI/2&&(i.requiresTwoSteps=!0,c=Math.PI/2-1e-5),o=N(s,c)),i&&(i.eyeCenterDistance=H(s,c)),o}function b(e,t,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,a=i+C(e.spatialReference).radius,c=e.renderCoordsHelper.intersectManifold(t.ray,i,G);return n.eyeCenterDistance=t.distance,n.centerIsOnSurface=!1,s(c)?(n.eyeCenterDistance=d(t.eye,c),n.tiltAtCenter=x(e.renderCoordsHelper,c,t.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=x(e.renderCoordsHelper,t.center,t.eye):(I(O(T,a),t.ray,G),n.eyeCenterDistance=d(t.eye,G),n.tiltAtCenter=r(-f(t.viewForward,p(G,G)))),n.radius=a,n.eyeRadius=y(t.eye),n.constraints=e.state.constraints,n}function g(e){return Math.abs(e)>1e-9}function E(e){const{constraints:t,eyeCenterDistance:r,tiltAtCenter:n}=e;let i=n,s=t.clampTilt(r,n);const a=H(e,s);if(t.clampTilt(a,n)===s)return s;let c=0;for(;c<10&&g(s-i);){const r=(i+s)/2,n=H(e,r);g(t.clampTilt(n,r)-r)?i=r:s=r,c++}return s}function H(e,r){if(!e.centerIsOnSurface)return e.eyeCenterDistance;const i=Math.PI-t(r,0,Math.PI),s=n(e.radius/e.eyeRadius*Math.sin(i)),a=Math.PI-i-s,c=Math.sin(a)/Math.sin(i);if(e.eyeRadius<e.radius&&c>1){const t=Math.PI-s,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return c*e.eyeRadius}function F(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function N(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function B(e,t,r){if(t.interactionType===S.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t,{min:s,max:a}=r,c=U(e,n,A,t),o=0===c?0:x(e.renderCoordsHelper,n.center,n.eye);r.min=s,r.max=a,t.interactionType===S.TUMBLE?(w(t.selection,R.ALTITUDE)&&K(e,n,r),j(c,o,!0,i,J,r)):j(c,o,!1,i,J,r)}function K(e,t,n){if(e.state.isLocal)return;const i=e.state.constraints;if(!i.altitude)return;const s=h(t.center),a=Math.sqrt(s),c=t.distance,o=C(e.spatialReference).radius,u=i.altitude.min+o,l=i.altitude.max+o,m=(u*u-c*c-s)/(-2*a*c),d=(l*l-c*c-s)/(-2*a*c);n.min=Math.max(n.min,Math.min(Math.PI-r(d),n.max)),n.max=Math.min(n.max,Math.PI-r(m))}const _=M(),z=c(),G=M(),J=i(5),Q={min:0,max:0},V={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},W={eyeCenterDistance:0,requiresTwoSteps:!1};export{P as applyTiltConstraint,U as getTiltConstraintError};
5
+ import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{isSome as s}from"../../../../core/maybe.js";import{d as a}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{b as o,m as u,g as l,a as m,i as d,e as f,n as p,l as y,p as h}from"../../../../chunks/vec3.js";import{c as M}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as C}from"../../../../geometry/projectionEllipsoid.js";import{j as I,k as O,t as T}from"../../../../chunks/sphere.js";import{TiltMode as A,defaultApplyOptions as D,InteractionType as S,hasConstraintType as w,ConstraintTypes as R,adjustRangeForInteraction as j}from"./common.js";import{viewAngle as x}from"../../state/utils/viewUtils.js";function P(t,r,n=D,i=!0){W.eyeCenterDistance=0,W.requiresTwoSteps=!1;const s=U(t,r,n,void 0,W);if(0===s)return!1;switch(a(z,-s,r.viewRight),n.tiltMode){case A.LOOK_AROUND:u(_,r.viewForward,z),l(_,_,W.eyeCenterDistance),r.center=m(G,r.eye,_);break;case A.TUMBLE:o(_,r.center,r.eye),u(_,_,z),r.eye=o(G,r.center,_);break;default:e(n.tiltMode)}return r.up=u(G,r.up,z),!W.requiresTwoSteps||!i||P(t,r,n,!1)}function U(e,t,r=D,n=D,i){if(!e.state.constraints.tilt)return 0;const s=t.distance,a=e.state.constraints.tilt(s,Q);return B(e,r,a),n.interactionType===S.TUMBLE&&w(n.selection,R.ALTITUDE)&&K(e,n.interactionStartCamera,a),r.tiltMode===A.LOOK_AROUND||n.tiltMode===A.LOOK_AROUND?L(e,t,a,i):v(e,t,a)}function v(e,r,n){const i=x(e.renderCoordsHelper,r.center,r.eye),s=i-t(i,n.min,n.max);return g(s)?s:0}function L(t,r,n,i){switch(i&&(i.requiresTwoSteps=!1),t.viewingMode){case"global":return q(t,r,n,i);case"local":return k(t,r,n,i);default:return void e(t.viewingMode)}}function k(e,r,n,i){const s=x(e.renderCoordsHelper,r.center,r.eye),a=t(s,n.min,n.max),c=s-a;if(!g(c))return 0;if(i){const t=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,n=e.renderCoordsHelper.getAltitude(r.eye)-t,s=Math.cos(a);Math.abs(s)>1e-4?i.eyeCenterDistance=n/s:i.eyeCenterDistance=r.distance}return c}function q(e,r,n,i){const s=b(e,r,V),a=t(s.tiltAtCenter,n.min,n.max);if(!g(s.tiltAtCenter-a))return 0;let c,o;return s.centerIsOnSurface?(c=E(s),o=F(s,c)):(c=s.constraints.clampTilt(s.eyeCenterDistance,s.tiltAtCenter),i&&c<Math.PI/2&&(i.requiresTwoSteps=!0,c=Math.PI/2-1e-5),o=N(s,c)),i&&(i.eyeCenterDistance=H(s,c)),o}function b(e,t,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,a=i+C(e.spatialReference).radius,c=e.renderCoordsHelper.intersectManifold(t.ray,i,G);return n.eyeCenterDistance=t.distance,n.centerIsOnSurface=!1,s(c)?(n.eyeCenterDistance=d(t.eye,c),n.tiltAtCenter=x(e.renderCoordsHelper,c,t.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=x(e.renderCoordsHelper,t.center,t.eye):(I(O(T,a),t.ray,G),n.eyeCenterDistance=d(t.eye,G),n.tiltAtCenter=r(-f(t.viewForward,p(G,G)))),n.radius=a,n.eyeRadius=y(t.eye),n.constraints=e.state.constraints,n}function g(e){return Math.abs(e)>1e-9}function E(e){const{constraints:t,eyeCenterDistance:r,tiltAtCenter:n}=e;let i=n,s=t.clampTilt(r,n);const a=H(e,s);if(t.clampTilt(a,n)===s)return s;let c=0;for(;c<10&&g(s-i);){const r=(i+s)/2,n=H(e,r);g(t.clampTilt(n,r)-r)?i=r:s=r,c++}return s}function H(e,r){if(!e.centerIsOnSurface)return e.eyeCenterDistance;const i=Math.PI-t(r,0,Math.PI),s=n(e.radius/e.eyeRadius*Math.sin(i)),a=Math.PI-i-s,c=Math.sin(a)/Math.sin(i);if(e.eyeRadius<e.radius&&c>1){const t=Math.PI-s,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return c*e.eyeRadius}function F(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function N(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function B(e,t,r){if(t.interactionType===S.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t,{min:s,max:a}=r,c=U(e,n,D,t),o=0===c?0:x(e.renderCoordsHelper,n.center,n.eye);r.min=s,r.max=a,t.interactionType===S.TUMBLE?(w(t.selection,R.ALTITUDE)&&K(e,n,r),j(c,o,!0,i,J,r)):j(c,o,!1,i,J,r)}function K(e,t,n){if(e.state.isLocal)return;const i=e.state.constraints;if(!i.altitude)return;const s=h(t.center),a=Math.sqrt(s),c=t.distance,o=C(e.spatialReference).radius,u=i.altitude.min+o,l=i.altitude.max+o,m=(u*u-c*c-s)/(-2*a*c),d=(l*l-c*c-s)/(-2*a*c);n.min=Math.max(n.min,Math.min(Math.PI-r(d),n.max)),n.max=Math.min(n.max,Math.PI-r(m))}const _=M(),z=c(),G=M(),J=i(5),Q={min:0,max:0},V={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},W={eyeCenterDistance:0,requiresTwoSteps:!1};export{P as applyTiltConstraint,U as getTiltConstraintError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import"../../../chunks/mat3f64.js";import"./CloudsTechniqueConfiguration.js";import"./NoiseTextureAtlas.js";import"../webgl-engine/core/shaderLibrary/ScreenSpacePass.js";import"../webgl-engine/core/shaderModules/FloatUniform.js";import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/Matrix3DrawUniform.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";import"../webgl-engine/core/shaderModules/Texture2DUniform.js";export{C as CloudsDrawParameters,b as build}from"../../../chunks/Clouds.glsl.js";
5
+ import"../../../chunks/mat3f64.js";import"./CloudsTechniqueConfiguration.js";import"./NoiseTextureAtlasDimensions.js";import"../webgl-engine/core/shaderLibrary/ScreenSpacePass.js";import"../webgl-engine/core/shaderModules/FloatUniform.js";import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/Matrix3DrawUniform.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";import"../webgl-engine/core/shaderModules/Texture2DUniform.js";export{C as CloudsDrawParameters,b as build}from"../../../chunks/Clouds.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import s from"../../../core/has.js";import{lerp as r}from"../../../core/mathUtils.js";import{releaseMaybe as o,disposeMaybe as h,destroyMaybe as a,isNone as n}from"../../../core/maybe.js";import{watch as u,initial as c}from"../../../core/reactiveUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{f as d}from"../../../chunks/mat3.js";import{x as f}from"../../../chunks/mat4.js";import{c as l}from"../../../chunks/mat4f64.js";import{f as _,z as g}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as y}from"../../../geometry/projectionEllipsoid.js";import{C as b}from"../../../chunks/Clouds.glsl.js";import{cloudPresets as v}from"./CloudsPresets.js";import{CloudsTechnique as S}from"./CloudsTechnique.js";import{CloudsTechniqueConfiguration as T}from"./CloudsTechniqueConfiguration.js";import{NoiseTextureAtlas as x}from"./NoiseTextureAtlas.js";import{BindParameters as w}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as z}from"../webgl-engine/lib/glUtil3D.js";import{TaskPriority as j}from"../../support/Scheduler.js";import{TextureType as C,PixelFormat as M,PixelType as U,TextureWrapMode as E,TextureSamplingMode as q,TargetType as B}from"../../webgl/enums.js";import{FramebufferObject as P}from"../../webgl/FramebufferObject.js";let R=class extends t{constructor(e){super(e),this._frameTask=null,this._handles=new i,this._cubeMapSize=s("esri-mobile")?1024:2048,this._techniques=[],this._techniqueConfiguration=new T,this._bindParameters=new w(null,null,null),this._drawParameters=new b,this.coverage=r(O.coverage[0],O.coverage[1],.5),this.density=r(O.density[0],O.density[1],.5),this.absorption=r(O.absorption[0],O.absorption[1],.5),this.cloudSize=r(O.cloudSize[0],O.cloudSize[1],.5),this.detailSize=r(O.detailSize[0],O.detailSize[1],.5),this.smoothness=r(O.smoothness[0],O.smoothness[1],.5),this.cloudHeight=r(O.cloudHeight[0],O.cloudHeight[1],.5),this.raymarchingStepType=O.raymarchingStepType,this._cloudRadius=0,this._viewMatrix=l(),this.running=!1}_getTechnique(e){const t=this._techniques[e];return t||(this._techniqueConfiguration.steps=e,this._techniques[e]=new S({rctx:this.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[e])}initialize(){this._vao=z(this.rctx);const e=y(this.view.spatialReference);this._cloudRadius=.5*e.radius,this.setDirty(),this._frameTask=this.view.resourceController.scheduler.registerTask(j.CLOUDS_GENERATOR,this),this._handles.add(this._frameTask),this._handles.add(u((()=>[this.coverage,this.density,this.absorption,this.cloudSize,this.detailSize,this.smoothness,this.cloudHeight,this.raymarchingStepType]),(()=>this.setDirty()),c))}destroy(){this._handles.destroy(),this._techniques.forEach((e=>o(e))),this._techniques=null,this._frameBufferCube=h(this._frameBufferCube),this._vao=h(this._vao),this._noiseTexture=a(this._noiseTexture)}_ensureNoiseTexture(){return n(this._noiseTexture)&&(this._noiseTexture=new x(this.rctx,this.view)),this._noiseTexture.textureAtlas}get frameBufferCube(){if(n(this._frameBufferCube)){const e={target:C.TEXTURE_CUBE_MAP,pixelFormat:M.RGBA,dataType:U.UNSIGNED_BYTE,wrapMode:E.CLAMP_TO_EDGE,samplingMode:q.LINEAR,hasMipmap:!1,width:this._cubeMapSize,height:this._cubeMapSize};this._frameBufferCube=new P(this.rctx,{colorTarget:B.CUBEMAP,width:this._cubeMapSize,height:this._cubeMapSize},e)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}applyPreset(e,t){const i=e.median,s=e=>{const s=r(e[0],e[1],i);return t<.5?r(e[0],s,2*t):r(s,e[1],2*(t-.5))};this.coverage=s(e.coverage),this.density=s(e.density),this.absorption=s(e.absorption),this.cloudSize=s(e.cloudSize),this.detailSize=s(e.detailSize),this.smoothness=s(e.smoothness),this.cloudHeight=s(e.cloudHeight),this.raymarchingStepType=e.raymarchingStepType}setDirty(){this.running=!0}runTask(e){if(0===this.coverage||n(this._vao))return void(this.running=!1);const t=this._ensureNoiseTexture();if(n(t))return;const i=this._getTechnique(this.raymarchingStepType);if(!i.compiled)return;const s=this.rctx.getViewport();this.rctx.setViewport(0,0,this._cubeMapSize,this._cubeMapSize),this.rctx.bindFramebuffer(this.frameBufferCube);const o=this.rctx.bindTechnique(i),h=1+this.absorption,a=r(35,120,this.absorption);o.bindTexture("cloudShapeTexture",t),o.setUniform1f("cloudRadius",this._cloudRadius),o.setUniform1f("halfCubeMapSize",.5*this._cubeMapSize),o.setUniform1f("power",a),o.setUniform1f("sigmaE",h),o.setUniform1f("density",r(0,.3,this.density)),o.setUniform1f("cloudSize",r(0,.02,Math.max(.01,1-this.cloudSize))),o.setUniform1f("detailSize",r(0,.2,Math.max(.01,1-this.detailSize))),o.setUniform1f("smoothness",r(0,.5,1-this.smoothness)),o.setUniform1f("cloudHeight",r(0,1500,this.cloudHeight)),o.setUniform1f("coverage",this.coverage),this.rctx.bindVAO(this._vao),o.assertCompatibleVertexAttributeLocations(this._vao);for(let r=0;r<5;r++){const e=A[r],t=k[r];f(this._viewMatrix,H,e,t),d(this._drawParameters.viewMatrix,this._viewMatrix);const i=C.TEXTURE_CUBE_MAP_POSITIVE_X+r;this.frameBufferCube.setColorTextureTarget(i),o.bindDraw(this._drawParameters,this._bindParameters),this.rctx.gl.drawArrays(this.rctx.gl.TRIANGLE_STRIP,0,4),this.rctx.gl.flush()}this.running=!1,this.rctx.setViewport(s.x,s.y,s.width,s.height),this.requestRender(),e.madeProgress()}};e([p({constructOnly:!0})],R.prototype,"rctx",void 0),e([p({constructOnly:!0})],R.prototype,"view",void 0),e([p({constructOnly:!0})],R.prototype,"requestRender",void 0),e([p()],R.prototype,"_frameTask",void 0),e([p()],R.prototype,"coverage",void 0),e([p()],R.prototype,"density",void 0),e([p()],R.prototype,"absorption",void 0),e([p()],R.prototype,"cloudSize",void 0),e([p()],R.prototype,"detailSize",void 0),e([p()],R.prototype,"smoothness",void 0),e([p()],R.prototype,"cloudHeight",void 0),e([p()],R.prototype,"raymarchingStepType",void 0),e([p()],R.prototype,"running",void 0),R=e([m("esri.views.3d.environment.CloudsGenerator")],R);const A=[_(1,0,0),_(-1,0,0),_(0,1,0),_(0,-1,0),_(0,0,1)],k=[_(0,1,0),_(0,1,0),_(0,0,-1),_(0,0,1),_(0,1,0)],H=g(),O=v.sunny;export{R as CloudsGenerator};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import s from"../../../core/has.js";import{lerp as r}from"../../../core/mathUtils.js";import{isSome as o,releaseMaybe as n,disposeMaybe as h,destroyMaybe as a,isNone as u}from"../../../core/maybe.js";import{watch as c,initial as l}from"../../../core/reactiveUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{f as d}from"../../../chunks/mat3.js";import{x as f}from"../../../chunks/mat4.js";import{c as _}from"../../../chunks/mat4f64.js";import{f as g}from"../../../chunks/vec2f32.js";import{f as T,z as v}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as y}from"../../../geometry/projectionEllipsoid.js";import{C as w}from"../../../chunks/Clouds.glsl.js";import{cloudPresets as b}from"./CloudsPresets.js";import{CloudsTechnique as C}from"./CloudsTechnique.js";import{CloudsTechniqueConfiguration as x}from"./CloudsTechniqueConfiguration.js";import{NoiseTextureAtlas as S}from"./NoiseTextureAtlas.js";import{BindParameters as M}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as j}from"../webgl-engine/lib/glUtil3D.js";import{TaskPriority as z}from"../../support/Scheduler.js";import{TextureType as U,PixelFormat as E,PixelType as q,TextureWrapMode as B,TextureSamplingMode as P,TargetType as R}from"../../webgl/enums.js";import{FramebufferObject as A}from"../../webgl/FramebufferObject.js";let k=class extends t{constructor(e){super(e),this._frameTask=null,this._handles=new i,this._cubeMapSize=s("esri-mobile")?1024:2048,this._techniques=[],this._techniqueConfiguration=new x,this._bindParameters=new M(null,null,null),this._drawParameters=new w,this._weatherTile=g(0,0),this._weatherTileCount=128,this.coverage=r(N.coverage[0],N.coverage[1],.5),this.density=r(N.density[0],N.density[1],.5),this.absorption=r(N.absorption[0],N.absorption[1],.5),this.cloudSize=r(N.cloudSize[0],N.cloudSize[1],.5),this.detailSize=r(N.detailSize[0],N.detailSize[1],.5),this.smoothness=r(N.smoothness[0],N.smoothness[1],.5),this.cloudHeight=r(N.cloudHeight[0],N.cloudHeight[1],.5),this.raymarchingStepType=N.raymarchingStepType,this._cloudRadius=0,this._viewMatrix=_(),this.running=!1}_getTechnique(e){const t=this._techniques[e];return t||(this._techniqueConfiguration.steps=e,this._techniques[e]=new C({rctx:this.context.renderContext.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[e])}_getWeatherTile(){const e=this.view.camera.position.latitude,t=this.view.camera.position.longitude;let i=g((e+90)/180,(t+180)/360);const s=Math.floor(this._weatherTileCount*Math.abs(2*i[0]-1));i=g(Math.floor(2*this._weatherTileCount*i[0]),Math.floor(4*(this._weatherTileCount-s)*i[1]));let r=0,n=0;if(o(this.view.environment)&&o(this.view.environment.lighting.date)){const e=new Date(this.view.environment.lighting.date);e.setUTCHours(this.view.environment.lighting.date.getUTCHours()+this.view.environment.lighting.displayUTCOffset),r=31*e.getUTCMonth()+e.getUTCDate(),n=e.getUTCFullYear()}return i[0]=(i[0]+r)%(2*this._weatherTileCount),i[1]=(i[1]+n%100)%(4*this._weatherTileCount),i}initialize(){this._vao=j(this.context.renderContext.rctx);const e=y(this.view.spatialReference);this._cloudRadius=.5*e.radius,this.setDirty(),this._weatherTile=this._getWeatherTile(),this._frameTask=this.view.resourceController.scheduler.registerTask(z.CLOUDS_GENERATOR,this),this._handles.add(this._frameTask),this._handles.add(c((()=>[this.coverage,this.density,this.absorption,this.cloudSize,this.detailSize,this.smoothness,this.cloudHeight,this.raymarchingStepType]),(()=>this.setDirty()),l))}destroy(){this._handles.destroy(),this._techniques.forEach((e=>n(e))),this._techniques=null,this._frameBufferCube=h(this._frameBufferCube),this._vao=h(this._vao),this._noiseTexture=a(this._noiseTexture)}_ensureNoiseTexture(){if(u(this._noiseTexture)){const e=this.context;this._noiseTexture=new S({context:e})}return this._noiseTexture.textureAtlas}ensureWeatherTile(){const e=this._getWeatherTile();this.running||!o(this._noiseTexture)||!o(this.context)||e[0]===this._weatherTile[0]&&e[1]===this._weatherTile[1]||(this._weatherTile=e,this._noiseTexture.updateWeatherMap(this._weatherTile),this.setDirty())}get frameBufferCube(){if(u(this._frameBufferCube)){const e={target:U.TEXTURE_CUBE_MAP,pixelFormat:E.RGBA,dataType:q.UNSIGNED_BYTE,wrapMode:B.CLAMP_TO_EDGE,samplingMode:P.LINEAR,hasMipmap:!1,width:this._cubeMapSize,height:this._cubeMapSize};this._frameBufferCube=new A(this.context.renderContext.rctx,{colorTarget:R.CUBEMAP,width:this._cubeMapSize,height:this._cubeMapSize},e)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}applyPreset(e,t){const i=e.median,s=e=>{const s=r(e[0],e[1],i);return t<.5?r(e[0],s,2*t):r(s,e[1],2*(t-.5))};this.coverage=s(e.coverage),this.density=s(e.density),this.absorption=s(e.absorption),this.cloudSize=s(e.cloudSize),this.detailSize=s(e.detailSize),this.smoothness=s(e.smoothness),this.cloudHeight=s(e.cloudHeight),this.raymarchingStepType=e.raymarchingStepType}setDirty(){this.running=!0}runTask(e){if(0===this.coverage||u(this._vao))return void(this.running=!1);const t=this._ensureNoiseTexture();if(u(t))return;const i=this._getTechnique(this.raymarchingStepType);if(!i.compiled)return;const s=this.context.renderContext.rctx,o=s.getViewport();s.setViewport(0,0,this._cubeMapSize,this._cubeMapSize),s.bindFramebuffer(this.frameBufferCube);const n=s.bindTechnique(i),h=1+this.absorption,a=r(35,120,this.absorption);n.bindTexture("cloudShapeTexture",t),n.setUniform1f("cloudRadius",this._cloudRadius),n.setUniform1f("halfCubeMapSize",.5*this._cubeMapSize),n.setUniform1f("power",a),n.setUniform1f("sigmaE",h),n.setUniform1f("density",r(0,.3,this.density)),n.setUniform1f("cloudSize",r(0,.02,Math.max(.01,1-this.cloudSize))),n.setUniform1f("detailSize",r(0,.2,Math.max(.01,1-this.detailSize))),n.setUniform1f("smoothness",r(0,.5,1-this.smoothness)),n.setUniform1f("cloudHeight",r(0,1500,this.cloudHeight)),n.setUniform1f("coverage",this.coverage),s.bindVAO(this._vao),n.assertCompatibleVertexAttributeLocations(this._vao);for(let r=0;r<5;r++){const e=H[r],t=D[r];f(this._viewMatrix,O,e,t),d(this._drawParameters.viewMatrix,this._viewMatrix);const i=U.TEXTURE_CUBE_MAP_POSITIVE_X+r;this.frameBufferCube.setColorTextureTarget(i),n.bindDraw(this._drawParameters,this._bindParameters),s.gl.drawArrays(s.gl.TRIANGLE_STRIP,0,4),s.gl.flush()}this.running=!1,s.setViewport(o.x,o.y,o.width,o.height),this.requestRender(),e.madeProgress()}};e([m({constructOnly:!0})],k.prototype,"context",void 0),e([m({constructOnly:!0})],k.prototype,"view",void 0),e([m({constructOnly:!0})],k.prototype,"requestRender",void 0),e([m()],k.prototype,"_frameTask",void 0),e([m()],k.prototype,"coverage",void 0),e([m()],k.prototype,"density",void 0),e([m()],k.prototype,"absorption",void 0),e([m()],k.prototype,"cloudSize",void 0),e([m()],k.prototype,"detailSize",void 0),e([m()],k.prototype,"smoothness",void 0),e([m()],k.prototype,"cloudHeight",void 0),e([m()],k.prototype,"raymarchingStepType",void 0),e([m()],k.prototype,"running",void 0),k=e([p("esri.views.3d.environment.CloudsGenerator")],k);const H=[T(1,0,0),T(-1,0,0),T(0,1,0),T(0,-1,0),T(0,0,1)],D=[T(0,1,0),T(0,1,0),T(0,0,-1),T(0,0,1),T(0,1,0)],O=v(),N=b.sunny;export{k as CloudsGenerator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{RayMarchingSteps as i}from"./CloudsTechniqueConfiguration.js";class s{constructor(i,s,t,e,n,o,h,r,c=.5){this.coverage=i,this.density=s,this.absorption=t,this.cloudSize=e,this.detailSize=n,this.smoothness=o,this.cloudHeight=h,this.raymarchingStepType=r,this.median=c}}const t={sunny:new s([.1,.7],[.02,.02],[0,0],[.86,.86],[.8,.8],[.5,.5],[.05,.05],i.SIXTEEN),cloudy:new s([.24,.7],[.135,.2],[0,0],[.5,.5],[.65,.7],[.3,.3],[1,1],i.TWOHUNDRED),rainy:new s([.5,.9],[.2,.5],[.3,.6],[.4,.4],[.7,.7],[.5,.5],[1,1],i.TWOHUNDRED),snowy:new s([.5,.9],[.2,.5],[0,0],[.4,.4],[.7,.7],[.5,.5],[1,1],i.TWOHUNDRED),foggy:new s([.8,.8],[.5,.5],[0,0],[.85,.85],[.75,.75],[.8,.8],[.3,.3],i.HUNDRED)};export{s as CloudPresets,t as cloudPresets};
5
+ import{RayMarchingSteps as i}from"./CloudsTechniqueConfiguration.js";class s{constructor(i,s,t,e,n,o,h,r,c=.5){this.coverage=i,this.density=s,this.absorption=t,this.cloudSize=e,this.detailSize=n,this.smoothness=o,this.cloudHeight=h,this.raymarchingStepType=r,this.median=c}}const t={sunny:new s([0,.6],[.03,.03],[0,0],[.9,.9],[.8,.8],[.7,.7],[.05,.05],i.SIXTEEN),cloudy:new s([.3,.65],[.2,.4],[0,0],[.85,.85],[.75,.75],[.3,.4],[1,1],i.TWOHUNDRED,.6),rainy:new s([.6,.85],[.5,.8],[.1,.5],[.9,.9],[.75,.75],[.5,.5],[1,1],i.TWOHUNDRED),snowy:new s([.25,.75],[.3,.3],[0,0],[.95,.95],[.7,.7],[.69,.75],[.3,1],i.HUNDRED,.4),foggy:new s([.8,.8],[.5,.5],[0,0],[.95,.95],[.9,.9],[.55,.55],[.3,.3],i.SIXTEEN)};export{s as CloudPresets,t as cloudPresets};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as i}from"../../../core/mathUtils.js";import{destroyMaybe as r,isSome as o,isNone as n}from"../../../core/maybe.js";import{when as h,syncAndInitial as a,watch as p,initial as d}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as m}from"../../../chunks/vec3.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{isMoon as u,isEarth as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ChapmanAtmosphere as w}from"./ChapmanAtmosphere.js";import{CloudsComposition as y}from"./CloudsComposition.js";import{isReadyCloudsData as v}from"./CloudsData.js";import{CloudsGenerator as f}from"./CloudsGenerator.js";import{cloudPresets as A}from"./CloudsPresets.js";import{Fog as R}from"./Fog.js";import{PanoramicAtmosphere as b}from"./PanoramicAtmosphere.js";import{Precipitation as E}from"./Precipitation.js";import x from"./SimpleAtmosphere.js";import{Stars as C}from"./Stars.js";import{weatherHeightLimit as N}from"./weather.js";import{RenderPass as j}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";var P;const O=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let S,M=P=class extends t{constructor(e){super(e),this._handles=new s,this._context=null,this._pendingAtmosphere=null,this._atmosphere=null}initialize(){this.view._stage.addRenderPlugin(O,this)}destroy(){this._pendingAtmosphere=r(this._pendingAtmosphere),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._handles=r(this._handles),this._set("view",null)}get atmosphereType(){return o(this._pendingAtmosphere)?this._pendingAtmosphere.type:o(this._atmosphere)?this._atmosphere.type:"none"}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return"realistic"===this._selectAtmosphereType()}updateAnimation(e){return!!o(this._precipitation)&&this._precipitation.update(e)}get updating(){return o(this._pendingAtmosphere)||o(this._stars)&&this._stars.updating||o(this._clouds)&&this._clouds.running}get weatherVisible(){return m(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=N}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||n(this._context)?(r(s),null):o(s)?s:new C({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||n(this._context))return r(e),null;const t=this.view,s=this._context;return o(e)&&e.context===s?e:(r(e),new E({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||n(this._context))return r(e),null;if(o(e))return e;const t=this.view,s=this._context.renderContext.rctx;return r(e),new f({rctx:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||n(this._context))return r(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,i=c(this.view.spatialReference).radius;return o(e)&&e.viewingMode===t&&e.planetRadius===i?e:(r(e),new y({rctx:s,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||n(this._context))return r(e),null;if(o(e))return e;const t=this.view,s=this._context;return r(e),new R({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e,this._handles.add([h((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),a),p((()=>({viewingMode:this.view.viewingMode,atmosphereEnabled:this.view.environment.atmosphereEnabled,atmosphereQuality:this.view.environment.atmosphere.quality})),(()=>this._updateAtmosphere()),a),p((()=>this._stars),(()=>this._setNeedsRender())),p((()=>this._clouds),(()=>this._updateWeather(this._weatherUpdateParameters)),d),p((()=>this._precipitation),(()=>this._setNeedsRender())),p((()=>this._fog),(()=>this._updateFog(this._weatherUpdateParameters)),d),p((()=>this._weatherUpdateParameters),(e=>{this._updateWeather(e),this._updateFog(e)}),a)])}uninitializeRenderContext(){this._context=null,this._atmosphere=r(this._atmosphere),this._set("_stars",r(this._stars)),this._set("_precipitation",r(this._precipitation)),this._set("_clouds",r(this._clouds)),this._set("_cloudsComposition",r(this._cloudsComposition)),this._set("_fog",r(this._fog))}render(e){if(e.pass===j.MATERIAL)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:o(this._stars)&&this._stars.render(e),e.bindParameters.cloudsComposition.clouds=null,o(this._atmosphere)&&this._atmosphere.canRender&&(this._atmosphere.render(e),v(this._clouds)&&o(this._cloudsComposition)&&(e.bindParameters.cloudsComposition.clouds=this._clouds,this._cloudsComposition.render(e,o(this.view.animation))));break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(o(this._atmosphere)&&this._atmosphere.canRender){const t=this.weatherEnabled?this.view.environment.weather.type:"disabled";if(this._atmosphere.renderHaze(e,"rainy"===t),o(this._fog)){const s="foggy"===t||"rainy"===t||"snowy"===t;(s||"realistic"!==this._selectAtmosphereType())&&this._fog.render(e,s,"rainy"===t)}if(o(this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return n(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeather(e){n(e)||n(this._clouds)||(this._clouds.applyPreset(A[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){o(this._context)&&this._context.requestRender()}_updateFog(e){if(!n(this._fog)&&!n(e))switch(e.type){case"foggy":this._fog.strength=i(3e-5,.005,e.weatherAdjustment**3),this._setNeedsRender();break;case"rainy":case"snowy":this._fog.strength=i(4e-6,8e-5,e.effect**3),this._setNeedsRender();break;default:this._fog.strength=4e-6,this._setNeedsRender()}}_updateAtmosphere(){const e=this._selectAtmosphereType();if(this.atmosphereType===e)return;o(this._pendingAtmosphere)&&(this._pendingAtmosphere!==this._atmosphere&&this._pendingAtmosphere.destroy(),this._pendingAtmosphere=null);const t=this._getAtmosphereClass();if(!t)return o(this._atmosphere)&&(this._atmosphere.destroy(),this._atmosphere=null,this._setNeedsRender()),void this._updateBasemapTerrain();const s=new t(this.view);o(this._context)&&s.initializeRenderContext(this._context),n(this._atmosphere)&&(this._atmosphere=s,this._setNeedsRender()),this._pendingAtmosphere=s,s.when().then((()=>{o(this._atmosphere)&&this._pendingAtmosphere&&this._pendingAtmosphere!==this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=this._pendingAtmosphere),this._pendingAtmosphere=null,this._setNeedsRender(),this._updateBasemapTerrain()})).catch((()=>{this._pendingAtmosphere===s&&(this._pendingAtmosphere=null)}))}_getAtmosphereClass(){switch(this._selectAtmosphereType()){case"none":return null;case"realistic":return w;case"panoramic":return b;case"simple":return x;default:return}}_selectAtmosphereType(){const e=this.view.get("environment.atmosphereEnabled"),t=this.view.get("environment.atmosphere.quality"),s=this.view.viewingMode;return!e||null==t||u(this.view.spatialReference)?"none":"local"===s?"panoramic":"high"===t&&o(this._context)&&w.isSupported(this._context)&&g(this.view.spatialReference)?"realistic":"simple"}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=o(this._atmosphere)&&"simple"===this.atmosphereType)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType(),stubGetAtmosphereClass:e=>{S=P.prototype._getAtmosphereClass,P.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{P.prototype._getAtmosphereClass=S}}}};e([l({constructOnly:!0})],M.prototype,"view",void 0),e([l({type:Boolean,readOnly:!0})],M.prototype,"updating",null),e([l()],M.prototype,"weatherVisible",null),e([l()],M.prototype,"_context",void 0),e([l()],M.prototype,"_pendingAtmosphere",void 0),e([l({readOnly:!0})],M.prototype,"_stars",null),e([l({readOnly:!0})],M.prototype,"_precipitation",null),e([l({readOnly:!0})],M.prototype,"_clouds",null),e([l({readOnly:!0})],M.prototype,"_cloudsComposition",null),e([l({readOnly:!0})],M.prototype,"_fog",null),e([l({readOnly:!0})],M.prototype,"weatherEnabled",null),e([l({readOnly:!0})],M.prototype,"_precipitationEnabled",null),e([l({readOnly:!0})],M.prototype,"_weatherUpdateParameters",null),M=P=e([_("esri.views.3d.environment.EnvironmentRenderer")],M);export{M as EnvironmentRenderer};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as i}from"../../../core/mathUtils.js";import{destroyMaybe as r,isSome as o,isNone as n}from"../../../core/maybe.js";import{when as h,syncAndInitial as a,watch as p,initial as d}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as m}from"../../../chunks/vec3.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{isMoon as u,isEarth as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ChapmanAtmosphere as w}from"./ChapmanAtmosphere.js";import{CloudsComposition as y}from"./CloudsComposition.js";import{isReadyCloudsData as v}from"./CloudsData.js";import{CloudsGenerator as f}from"./CloudsGenerator.js";import{cloudPresets as A}from"./CloudsPresets.js";import{Fog as R}from"./Fog.js";import{PanoramicAtmosphere as b}from"./PanoramicAtmosphere.js";import{Precipitation as E}from"./Precipitation.js";import N from"./SimpleAtmosphere.js";import{Stars as T}from"./Stars.js";import{weatherHeightLimit as j}from"./weather.js";import{RenderPass as C}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as x}from"../webgl-engine/lib/RenderSlot.js";var P;const O=[x.POSTPROCESSING_ENVIRONMENT_OPAQUE,x.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let S,M=P=class extends t{constructor(e){super(e),this._handles=new s,this._context=null,this._pendingAtmosphere=null,this._atmosphere=null}initialize(){this.view._stage.addRenderPlugin(O,this)}destroy(){this._pendingAtmosphere=r(this._pendingAtmosphere),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._handles=r(this._handles),this._set("view",null)}get atmosphereType(){return o(this._pendingAtmosphere)?this._pendingAtmosphere.type:o(this._atmosphere)?this._atmosphere.type:"none"}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return"realistic"===this._selectAtmosphereType()}updateAnimation(e){return!!o(this._precipitation)&&this._precipitation.update(e)}get updating(){return o(this._pendingAtmosphere)||o(this._stars)&&this._stars.updating||o(this._clouds)&&this._clouds.running}get weatherVisible(){return m(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=j}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||n(this._context)?(r(s),null):o(s)?s:new T({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||n(this._context))return r(e),null;const t=this.view,s=this._context;return o(e)&&e.context===s?e:(r(e),new E({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||n(this._context))return r(e),null;if(o(e))return e;const t=this.view,s=this._context;return r(e),new f({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||n(this._context))return r(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,i=c(this.view.spatialReference).radius;return o(e)&&e.viewingMode===t&&e.planetRadius===i?e:(r(e),new y({rctx:s,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||n(this._context))return r(e),null;if(o(e))return e;const t=this.view,s=this._context;return r(e),new R({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e,this._handles.add([h((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),a),p((()=>({viewingMode:this.view.viewingMode,atmosphereEnabled:this.view.environment.atmosphereEnabled,atmosphereQuality:this.view.environment.atmosphere.quality})),(()=>this._updateAtmosphere()),a),p((()=>this._stars),(()=>this._setNeedsRender())),p((()=>this._clouds),(()=>this._updateWeather(this._weatherUpdateParameters)),d),p((()=>this._precipitation),(()=>this._setNeedsRender())),p((()=>this._fog),(()=>this._updateFog(this._weatherUpdateParameters)),d),p((()=>this._weatherUpdateParameters),(e=>{this._updateWeather(e),this._updateFog(e)}),a)])}uninitializeRenderContext(){this._context=null,this._atmosphere=r(this._atmosphere),this._set("_stars",r(this._stars)),this._set("_precipitation",r(this._precipitation)),this._set("_clouds",r(this._clouds)),this._set("_cloudsComposition",r(this._cloudsComposition)),this._set("_fog",r(this._fog))}render(e){if(e.pass===C.MATERIAL)switch(e.bindParameters.slot){case x.POSTPROCESSING_ENVIRONMENT_OPAQUE:o(this._stars)&&this._stars.render(e),e.bindParameters.cloudsComposition.clouds=null,o(this._atmosphere)&&this._atmosphere.canRender&&(this._atmosphere.render(e),v(this._clouds)&&o(this._cloudsComposition)&&o(this._clouds)&&(this.weatherVisible&&this._clouds.ensureWeatherTile(),e.bindParameters.cloudsComposition.clouds=this._clouds,this._cloudsComposition.render(e,o(this.view.animation))));break;case x.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(o(this._atmosphere)&&this._atmosphere.canRender){const t=this.weatherEnabled?this.view.environment.weather.type:"disabled";if(this._atmosphere.renderHaze(e,"rainy"===t),o(this._fog)){const s="foggy"===t||"rainy"===t||"snowy"===t;(s||"realistic"!==this._selectAtmosphereType())&&this._fog.render(e,s,"rainy"===t)}if(o(this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return n(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeather(e){n(e)||n(this._clouds)||(this._clouds.applyPreset(A[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){o(this._context)&&this._context.requestRender()}_updateFog(e){if(!n(this._fog)&&!n(e))switch(e.type){case"foggy":this._fog.strength=i(3e-5,.005,e.weatherAdjustment**3),this._setNeedsRender();break;case"rainy":case"snowy":this._fog.strength=i(4e-6,2e-4,e.effect**3),this._setNeedsRender();break;default:this._fog.strength=4e-6,this._setNeedsRender()}}_updateAtmosphere(){const e=this._selectAtmosphereType();if(this.atmosphereType===e)return;o(this._pendingAtmosphere)&&(this._pendingAtmosphere!==this._atmosphere&&this._pendingAtmosphere.destroy(),this._pendingAtmosphere=null);const t=this._getAtmosphereClass();if(!t)return o(this._atmosphere)&&(this._atmosphere.destroy(),this._atmosphere=null,this._setNeedsRender()),void this._updateBasemapTerrain();const s=new t(this.view);o(this._context)&&s.initializeRenderContext(this._context),n(this._atmosphere)&&(this._atmosphere=s,this._setNeedsRender()),this._pendingAtmosphere=s,s.when().then((()=>{o(this._atmosphere)&&this._pendingAtmosphere&&this._pendingAtmosphere!==this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=this._pendingAtmosphere),this._pendingAtmosphere=null,this._setNeedsRender(),this._updateBasemapTerrain()})).catch((()=>{this._pendingAtmosphere===s&&(this._pendingAtmosphere=null)}))}_getAtmosphereClass(){switch(this._selectAtmosphereType()){case"none":return null;case"realistic":return w;case"panoramic":return b;case"simple":return N;default:return}}_selectAtmosphereType(){const e=this.view.get("environment.atmosphereEnabled"),t=this.view.get("environment.atmosphere.quality"),s=this.view.viewingMode;return!e||null==t||u(this.view.spatialReference)?"none":"local"===s?"panoramic":"high"===t&&o(this._context)&&w.isSupported(this._context)&&g(this.view.spatialReference)?"realistic":"simple"}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=o(this._atmosphere)&&"simple"===this.atmosphereType)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType(),stubGetAtmosphereClass:e=>{S=P.prototype._getAtmosphereClass,P.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{P.prototype._getAtmosphereClass=S}}}};e([l({constructOnly:!0})],M.prototype,"view",void 0),e([l({type:Boolean,readOnly:!0})],M.prototype,"updating",null),e([l()],M.prototype,"weatherVisible",null),e([l()],M.prototype,"_context",void 0),e([l()],M.prototype,"_pendingAtmosphere",void 0),e([l({readOnly:!0})],M.prototype,"_stars",null),e([l({readOnly:!0})],M.prototype,"_precipitation",null),e([l({readOnly:!0})],M.prototype,"_clouds",null),e([l({readOnly:!0})],M.prototype,"_cloudsComposition",null),e([l({readOnly:!0})],M.prototype,"_fog",null),e([l({readOnly:!0})],M.prototype,"weatherEnabled",null),e([l({readOnly:!0})],M.prototype,"_precipitationEnabled",null),e([l({readOnly:!0})],M.prototype,"_weatherUpdateParameters",null),M=P=e([_("esri.views.3d.environment.EnvironmentRenderer")],M);export{M as EnvironmentRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{smoothstep as o}from"../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as s,isNone as i}from"../../../core/maybe.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{s as n,g as c,n as g,e as m,h as u,l as p}from"../../../chunks/vec3.js";import{c as _}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as f}from"../../../geometry/projectionEllipsoid.js";import{atmosphereHeight as d}from"./atmosphereUtils.js";import{FogTechniqueConfiguration as l,FogTechnique as T}from"./FogTechnique.js";import{weatherHeightLimit as F}from"./weather.js";import{NoParameters as y}from"../webgl-engine/core/shaderModules/interfaces.js";import{Pos2Tex as b}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as q}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as j}from"../../webgl/enums.js";let v=class extends t{constructor(e){super(e),this._fogColor=_(),this._fogColorAtNight=_(),this._cameraDirection=_(),this._foggyFadeStart=.3,this._foggyFadeEnd=.6,this._hazeFadeStart=.7,this._hazeFadeEnd=1,this._strength=4e-6;const t=e.context.renderContext.rctx;this._vao=q(t,b);const o=f(e.view.spatialReference);this._planetRadius=o.radius,this._atmosphereRadius=o.radius+d}destroy(){this._hazeFogTechnique=r(this._hazeFogTechnique),this._thickFogTechnique=r(this._thickFogTechnique),this._vao=s(this._vao)}get _shaderTechniqueRepository(){return this.context.shaderTechniqueRepository}set strength(e){this._strength=e}get strength(){return this._strength}get thickFogTechnique(){if(i(this._thickFogTechnique)){const e=new l;e.haze=!1,this._thickFogTechnique=this._shaderTechniqueRepository.acquire(T,e)}return this._thickFogTechnique}get hazeFogTechnique(){if(i(this._hazeFogTechnique)){const e=new l;e.haze=!0,this._hazeFogTechnique=this._shaderTechniqueRepository.acquire(T,e)}return this._hazeFogTechnique}when(){return Promise.resolve()}render(e,t,o){if(0===this.view.basemapTerrain.baseOpacity&&!t)return;if(this._update(e,t,o),this._fogAmount<=0)return;const r=t?this.thickFogTechnique:this.hazeFogTechnique;if(!r.compiled)return void this.context.requestRender();const s=e.offscreenRenderingHelper,i=e.rctx.bindTechnique(r,x,e.bindParameters);s.renderDepthDetached((()=>{i.bindTexture("depthTex",s.depthTexture),this._renderFog(r.program,e)}))}_renderFog(e,t){if(i(this._vao))return!1;const o=t.rctx,r=t.bindParameters.camera;return e.setUniform3fv("cameraPosition",r.eye),e.setUniform1f("atmosphereC",this._atmosphereC),e.setUniform1f("fogStrength",this._strength),e.setUniform1f("fogAmount",this._fogAmount),e.setUniform3fv("fogColor",this._fogColor),o.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),o.drawArrays(j.TRIANGLE_STRIP,0,4),!0}_update(e,t,r){const s=e.bindParameters.camera,i=t?.1:0;r?n(this._fogColor,.5,.5,.5):t?n(this._fogColor,1.5,1.5,1.5):n(this._fogColor,.24,.44,.8),c(this._fogColorAtNight,this._fogColor,i),g(this._cameraDirection,s.eye);const h=Math.max(0,m(this._cameraDirection,e.bindParameters.lighting.lightingMainDirection));u(this._fogColor,this._fogColorAtNight,this._fogColor,h);const a=p(s.eye),_=a*a;this._atmosphereC=_-this._atmosphereRadius*this._atmosphereRadius,this._fogAmount=t?1-o(this._foggyFadeStart*F,this._foggyFadeEnd*F,Math.abs(a-this._planetRadius)):1-o(this._hazeFadeStart*F,this._hazeFadeEnd*F,Math.abs(a-this._planetRadius))}static isSupported(e){return e.capabilities.depthTexture}};e([h({constructOnly:!0})],v.prototype,"context",void 0),e([h({constructOnly:!0})],v.prototype,"view",void 0),v=e([a("esri.views.3d.environment.Fog")],v);const x=new y;export{v as Fog};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{smoothstep as o}from"../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as s,isNone as i}from"../../../core/maybe.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{s as n,g as c,n as g,e as m,h as u,l as p}from"../../../chunks/vec3.js";import{c as _}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as f}from"../../../geometry/projectionEllipsoid.js";import{atmosphereHeight as d}from"./atmosphereUtils.js";import{FogTechniqueConfiguration as l,FogTechnique as T}from"./FogTechnique.js";import{weatherHeightLimit as F}from"./weather.js";import{NoParameters as y}from"../webgl-engine/core/shaderModules/interfaces.js";import{Pos2Tex as b}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as q}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as j}from"../../webgl/enums.js";let v=class extends t{constructor(e){super(e),this._fogColor=_(),this._fogColorAtNight=_(),this._cameraDirection=_(),this._foggyFadeStart=.95,this._foggyFadeEnd=1,this._hazeFadeStart=.7,this._hazeFadeEnd=1,this._strength=4e-6;const t=e.context.renderContext.rctx;this._vao=q(t,b);const o=f(e.view.spatialReference);this._planetRadius=o.radius,this._atmosphereRadius=o.radius+d}destroy(){this._hazeFogTechnique=r(this._hazeFogTechnique),this._thickFogTechnique=r(this._thickFogTechnique),this._vao=s(this._vao)}get _shaderTechniqueRepository(){return this.context.shaderTechniqueRepository}set strength(e){this._strength=e}get strength(){return this._strength}get thickFogTechnique(){if(i(this._thickFogTechnique)){const e=new l;e.haze=!1,this._thickFogTechnique=this._shaderTechniqueRepository.acquire(T,e)}return this._thickFogTechnique}get hazeFogTechnique(){if(i(this._hazeFogTechnique)){const e=new l;e.haze=!0,this._hazeFogTechnique=this._shaderTechniqueRepository.acquire(T,e)}return this._hazeFogTechnique}when(){return Promise.resolve()}render(e,t,o){if(0===this.view.basemapTerrain.baseOpacity&&!t)return;if(this._update(e,t,o),this._fogAmount<=0)return;const r=t?this.thickFogTechnique:this.hazeFogTechnique;if(!r.compiled)return void this.context.requestRender();const s=e.offscreenRenderingHelper,i=e.rctx.bindTechnique(r,x,e.bindParameters);s.renderDepthDetached((()=>{i.bindTexture("depthTex",s.depthTexture),this._renderFog(r.program,e)}))}_renderFog(e,t){if(i(this._vao))return!1;const o=t.rctx,r=t.bindParameters.camera;return e.setUniform3fv("cameraPosition",r.eye),e.setUniform1f("atmosphereC",this._atmosphereC),e.setUniform1f("fogStrength",this._strength),e.setUniform1f("fogAmount",this._fogAmount),e.setUniform3fv("fogColor",this._fogColor),o.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),o.drawArrays(j.TRIANGLE_STRIP,0,4),!0}_update(e,t,r){const s=e.bindParameters.camera,i=t?.1:0;r?n(this._fogColor,.5,.5,.5):t?n(this._fogColor,1.5,1.5,1.5):n(this._fogColor,.24,.44,.8),c(this._fogColorAtNight,this._fogColor,i),g(this._cameraDirection,s.eye);const h=Math.max(0,m(this._cameraDirection,e.bindParameters.lighting.lightingMainDirection));u(this._fogColor,this._fogColorAtNight,this._fogColor,h);const a=p(s.eye),_=a*a;this._atmosphereC=_-this._atmosphereRadius*this._atmosphereRadius,this._fogAmount=t?1-o(this._foggyFadeStart*F,this._foggyFadeEnd*F,Math.abs(a-this._planetRadius)):1-o(this._hazeFadeStart*F,this._hazeFadeEnd*F,Math.abs(a-this._planetRadius))}static isSupported(e){return e.capabilities.depthTexture}};e([h({constructOnly:!0})],v.prototype,"context",void 0),e([h({constructOnly:!0})],v.prototype,"view",void 0),v=e([a("esri.views.3d.environment.Fog")],v);const x=new y;export{v as Fog};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import"../webgl-engine/core/shaderLibrary/ScreenSpacePass.js";import"../webgl-engine/core/shaderModules/FloatUniform.js";import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";export{b as build}from"../../../chunks/NoiseTextureAtlas.glsl.js";
5
+ import"./NoiseTextureAtlasConfiguration.js";import"./NoiseTextureAtlasDimensions.js";import"../webgl-engine/core/shaderLibrary/ScreenSpacePass.js";import"../webgl-engine/core/shaderModules/Float2Uniform.js";import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";export{b as build}from"../../../chunks/NoiseTextureAtlas.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/has.js";import{isSome as t,releaseMaybe as i,disposeMaybe as r,isNone as s}from"../../../core/maybe.js";import{NoiseTextureAtlasTechnique as h}from"./NoiseTextureAtlasTechnique.js";import{createQuadVAO as o}from"../webgl-engine/lib/glUtil3D.js";import{TargetType as n,TextureType as a,PixelFormat as f,PixelType as _,TextureWrapMode as u,TextureSamplingMode as m}from"../../webgl/enums.js";import{FramebufferObject as c}from"../../webgl/FramebufferObject.js";const l=e("esri-mobile")?64:128,d=l/128,p=Math.ceil(Math.sqrt(l)),g=(l+2)*p;class w{constructor(e,i){let r;this._frameBuffer=new c(e,{colorTarget:n.TEXTURE,width:g,height:g},{target:a.TEXTURE_2D,pixelFormat:f.RGBA,dataType:_.UNSIGNED_BYTE,wrapMode:u.CLAMP_TO_EDGE,samplingMode:m.LINEAR,hasMipmap:!1,width:g,height:g}),this._vao=o(e),this._technique=new h({rctx:e,viewingMode:i.state.viewingMode}),this._ensureRendered=()=>(t(r)||t(this._technique)&&this._technique.compiled&&(r=this._render(e)),r)}get textureAtlas(){return this._ensureRendered()}destroy(){this._technique=i(this._technique),this._frameBuffer=r(this._frameBuffer),this._vao=r(this._vao)}_render(e){if(s(this._technique)||s(this._vao)||s(this._frameBuffer))return null;const t=e.getViewport();e.setViewport(0,0,g,g),e.bindFramebuffer(this._frameBuffer);const h=e.bindTechnique(this._technique);return h.setUniform1f("tileSize",l),h.setUniform1f("tileRows",p),e.bindVAO(this._vao),h.assertCompatibleVertexAttributeLocations(this._vao),e.gl.drawArrays(e.gl.TRIANGLE_STRIP,0,4),e.setViewport(t.x,t.y,t.width,t.height),this._technique=i(this._technique),this._vao=r(this._vao),this._frameBuffer.colorTexture}}export{g as ATLAS_SIZE,w as NoiseTextureAtlas,d as TEXTURE_SCALE,p as TILE_ROWS,l as TILE_SIZE};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{isSome as r,releaseMaybe as i,disposeMaybe as s,isNone as h}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import{f as n}from"../../../chunks/vec2f32.js";import{NoiseTextureRenderMode as a,NoiseTextureAtlasTechniqueConfiguration as u}from"./NoiseTextureAtlasConfiguration.js";import{ATLAS_SIZE as c,TILE_SIZE as l,TILE_ROWS as f}from"./NoiseTextureAtlasDimensions.js";import{NoiseTextureAtlasTechnique as p}from"./NoiseTextureAtlasTechnique.js";import{createQuadVAO as _}from"../webgl-engine/lib/glUtil3D.js";import{TargetType as T,TextureType as m,PixelFormat as d,PixelType as w,TextureWrapMode as q,TextureSamplingMode as x}from"../../webgl/enums.js";import{FramebufferObject as g}from"../../webgl/FramebufferObject.js";class R extends t{constructor(e){let t;super(e),this._weatherTile=n(0,0),this._needsRender=!0,this._frameBuffer=new g(e.context.renderContext.rctx,{colorTarget:T.TEXTURE,width:c,height:c},{target:m.TEXTURE_2D,pixelFormat:d.RGBA,dataType:w.UNSIGNED_BYTE,wrapMode:q.CLAMP_TO_EDGE,samplingMode:x.LINEAR,hasMipmap:!1,width:c,height:c}),this._vao=_(e.context.renderContext.rctx),this._shaderTechniqueRepository=e.context.shaderTechniqueRepository,this._ensureRendered=()=>(r(t)?r(this.weatherMapTechnique)&&this.weatherMapTechnique.compiled&&this._needsRender&&(t=this._render(e.context.renderContext.rctx,a.WeatherMap)):r(this.fullTechnique)&&this.fullTechnique.compiled&&(t=this._render(e.context.renderContext.rctx,a.Full)),t)}get textureAtlas(){return this._ensureRendered()}_setDirty(){this._needsRender=!0}updateWeatherMap(e){this._weatherTile[0]===e[0]&&this._weatherTile[1]===e[1]||(this._weatherTile=e,this._setDirty())}destroy(){this._fullTechnique=i(this._fullTechnique),this._weatherMapTechnique=i(this._weatherMapTechnique),this._frameBuffer=s(this._frameBuffer),this._vao=s(this._vao)}get fullTechnique(){if(h(this._fullTechnique)){const e=new u;e.mode=a.Full,this._fullTechnique=this._shaderTechniqueRepository.acquire(p,e)}return this._fullTechnique}get weatherMapTechnique(){if(h(this._weatherMapTechnique)){const e=new u;e.mode=a.WeatherMap,this._weatherMapTechnique=this._shaderTechniqueRepository.acquire(p,e)}return this._weatherMapTechnique}_render(e,t){if(h(this._vao)||h(this._frameBuffer))return null;const r=t===a.Full?this.fullTechnique:this.weatherMapTechnique;if(h(r))return null;const i=e.getViewport();e.setViewport(0,0,c,c),e.bindFramebuffer(this._frameBuffer);const s=e.bindTechnique(r);return t===a.Full&&(s.setUniform1f("tileSize",l),s.setUniform1f("tileRows",f)),s.setUniform2f("weatherTile",this._weatherTile[0],this._weatherTile[1]),e.bindVAO(this._vao),s.assertCompatibleVertexAttributeLocations(this._vao),e.gl.drawArrays(e.gl.TRIANGLE_STRIP,0,4),e.setViewport(i.x,i.y,i.width,i.height),this._needsRender=!1,this._frameBuffer.colorTexture}}e([o({constructOnly:!0})],R.prototype,"context",void 0);export{R as NoiseTextureAtlas};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{parameter as o,ShaderTechniqueConfiguration as r}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";var t;!function(e){e[e.Full=0]="Full",e[e.WeatherMap=1]="WeatherMap",e[e.COUNT=2]="COUNT"}(t||(t={}));class s extends r{constructor(){super(...arguments),this.mode=t.Full}}e([o({count:t.COUNT})],s.prototype,"mode",void 0);export{s as NoiseTextureAtlasTechniqueConfiguration,t as NoiseTextureRenderMode};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
+ */
5
+ import e from"../../../core/has.js";const o=e("esri-mobile")?64:128,r=o/128,t=Math.ceil(Math.sqrt(o)),s=(o+2)*t,i=1e5,a=128;export{s as ATLAS_SIZE,r as TEXTURE_SCALE,t as TILE_ROWS,o as TILE_SIZE,i as WEATHER_MAP_SIZE,a as WEATHER_TILE_SIZE};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{N as e}from"../../../chunks/NoiseTextureAtlas.glsl.js";import{ReloadableShaderModule as r}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as t}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Default3D as i}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as o}from"../webgl-engine/lib/Program.js";import{BlendFactor as s,CompareFunction as n}from"../../webgl/enums.js";import{makePipelineState as l,simpleBlendingParams as a,defaultColorWriteParams as m}from"../../webgl/renderState.js";class u extends t{constructor(e){super(e,null,(()=>this.destroy()))}initializeProgram(e){const r=u.shader.get().build();return new o(e.rctx,r,i)}initializePipeline(){return l({blending:a(s.ONE,s.ZERO),depthTest:{func:n.LEQUAL},colorWrite:m})}}u.shader=new r(e,(()=>import("./NoiseTextureAtlas.glsl.js")));export{u as NoiseTextureAtlasTechnique};
5
+ import{N as e}from"../../../chunks/NoiseTextureAtlas.glsl.js";import{NoiseTextureRenderMode as r}from"./NoiseTextureAtlasConfiguration.js";import{ReloadableShaderModule as i}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as t}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Default3D as o}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as n}from"../webgl-engine/lib/Program.js";import{BlendFactor as s,CompareFunction as l}from"../../webgl/enums.js";import{makePipelineState as a,simpleBlendingParams as m,separateBlendingParams as g,defaultColorWriteParams as u}from"../../webgl/renderState.js";class c extends t{initializeProgram(e){const r=c.shader.get().build(this.configuration);return new n(e.rctx,r,o)}initializePipeline(){return a({blending:this.configuration.mode===r.Full?m(s.ONE,s.ZERO):g(s.ZERO,s.ONE,s.ONE,s.ZERO),depthTest:{func:l.ALWAYS},colorWrite:u})}}c.shader=new i(e,(()=>import("./NoiseTextureAtlas.glsl.js")));export{c as NoiseTextureAtlasTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import i from"../../../core/Accessor.js";import{releaseMaybe as e,disposeMaybe as r,isNone as s,isSome as o}from"../../../core/maybe.js";import{secondsFromMilliseconds as n}from"../../../core/time.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{s as c,g as _,n as p,e as m,h as u}from"../../../chunks/vec3.js";import{c as f}from"../../../chunks/vec3f32.js";import{c as d}from"../../../chunks/vec3f64.js";import{WatchUpdatingTracking as l}from"../../../core/support/WatchUpdatingTracking.js";import{getReferenceEllipsoid as w}from"../../../geometry/projectionEllipsoid.js";import{PrecipitationPassParameters as g,PrecipitationTechnique as T}from"./PrecipitationTechnique.js";import{PrecipitationTechniqueConfiguration as y,PrecipitationType as b}from"./PrecipitationTechniqueConfiguration.js";import{glLayout as j}from"../support/buffer/glUtil.js";import{newLayout as v}from"../support/buffer/InterleavedLayout.js";import{AnimationTimer as q}from"../webgl-engine/lib/AnimationTimer.js";import{VertexAttribute as A}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as I}from"../../webgl/BufferObject.js";import{PrimitiveType as P,Usage as C}from"../../webgl/enums.js";import{bindVertexBufferLayout as x,unbindVertexBufferLayout as R}from"../../webgl/Util.js";import{VertexArrayObject as S}from"../../webgl/VertexArrayObject.js";let U=class extends i{constructor(t){super(t),this._numParticles=25e4,this._rainSpeed=.1,this._snowSpeed=.01,this._opacity=1,this._width=500,this._offset=d(),this._tile=d(),this._particleColor=f(),this._particleColorAtNight=f(),this._nightMultiplier=.7,this._cameraDirection=f(),this._renderParameters=new g,this._animation=new q,this._updatingTracking=new l,this._renderParameters.time=0,this._renderParameters.radius=w(t.view.spatialReference).radius,this._shaderTechniqueRepository=t.context.shaderTechniqueRepository}destroy(){this._updatingTracking.destroy(),this._numParticles=0,this._snowTechnique=e(this._snowTechnique),this._rainTechnique=e(this._rainTechnique),this._vao=r(this._vao),this._instanceIdBuffer=r(this._instanceIdBuffer)}get updating(){return this._updatingTracking.updating}get rainTechnique(){if(s(this._rainTechnique)){const t=new y;t.type=b.Rain,this._rainTechnique=this._shaderTechniqueRepository.acquire(T,t)}return this._rainTechnique}get snowTechnique(){if(s(this._snowTechnique)){const t=new y;t.type=b.Snow,this._snowTechnique=this._shaderTechniqueRepository.acquire(T,t)}return this._snowTechnique}update(t){return this._animation.advance(t)}render(t,i,e){const r="rainy"===e,a=r?this.rainTechnique:this.snowTechnique;if(!a.compiled)return void this.context.requestRender();const h=t.rctx;if(this._ensureResources(h),s(a)||s(this._vao)||s(this._instanceIdBuffer))return;if(o(t.bindParameters.cloudsComposition.clouds)&&(this._opacity=1-t.bindParameters.cloudsComposition.fadeInOutHeight.factor),this._opacity<=0)return;if(s(this._vao)||s(this._instanceIdBuffer))return;const c=h.bindTechnique(a);this._renderParameters.camera=t.bindParameters.camera,this._renderParameters.time=(r?this._rainSpeed:this._snowSpeed)*n(this._animation.time),this._update(c,e,t),h.bindVAO(this._vao);const _=T.attributeLocation;c.assertCompatibleVertexAttributeLocations(this._vao),x(h,_,this._instanceIdBuffer,B,0),h.capabilities.instancing.drawArraysInstanced(P.TRIANGLES,0,3,this._numParticles*i),R(h,_,this._instanceIdBuffer,B)}_update(t,i,e){const r=e.bindParameters.camera,s=r.eye;this._tile[0]=Math.floor((s[0]+.5*this._width)/this._width),this._tile[1]=Math.floor((s[1]+.5*this._width)/this._width),this._tile[2]=Math.floor((s[2]+.5*this._width)/this._width),this._offset[0]=s[0]-this._tile[0]*this._width,this._offset[1]=s[1]-this._tile[1]*this._width,this._offset[2]=s[2]-this._tile[2]*this._width,t.setUniform1f("width",this._width),t.setUniform3fv("offset",this._offset),t.setUniformMatrix4fv("view",r.viewMatrix),t.setUniform3fv("cameraPosition",s),t.bindPass(null,e.bindParameters),t.setUniform1f("time",this._renderParameters.time),"rainy"===i?c(this._particleColor,.85,.85,.85):c(this._particleColor,1,1,1),_(this._particleColorAtNight,this._particleColor,this._nightMultiplier),p(this._cameraDirection,s);const o=Math.max(0,m(this._cameraDirection,e.bindParameters.lighting.lightingMainDirection));u(this._particleColor,this._particleColorAtNight,this._particleColor,o),t.setUniform3fv("particleColor",this._particleColor),t.setUniform1f("opacity",this._opacity)}_ensureResources(t){s(this._vao)&&(this._vao=this._createVertexArrayObject(t)),s(this._instanceIdBuffer)&&(this._instanceIdBuffer=this._createInstanceIndices(t))}_createInstanceIndices(t){const i=[];for(let e=0;e<this._numParticles;e++)i.push(e);return I.createVertex(t,C.STATIC_DRAW,new Float32Array(i))}_createVertexArrayObject(t){const i=new Float32Array([-1,0,1,1,0,-1,1,0,1]);return new S(t,T.attributeLocation,{geometry:j(O)},{geometry:I.createVertex(t,C.STATIC_DRAW,i)})}};t([a({constructOnly:!0})],U.prototype,"context",void 0),t([a({constructOnly:!0})],U.prototype,"view",void 0),t([a({readOnly:!0})],U.prototype,"updating",null),t([a()],U.prototype,"_updatingTracking",void 0),U=t([h("esri.views.3d.environment.Precipitation")],U);const O=v().vec3f(A.POSITION),B=j(v().f32(A.INSTANCEFEATUREATTRIBUTE),1);export{U as Precipitation};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{lerp as i}from"../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as s,isNone as o,isSome as n}from"../../../core/maybe.js";import{secondsFromMilliseconds as a}from"../../../core/time.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{s as _,g as m,n as p,e as u,h as f}from"../../../chunks/vec3.js";import{c as d}from"../../../chunks/vec3f32.js";import{c as l}from"../../../chunks/vec3f64.js";import{WatchUpdatingTracking as w}from"../../../core/support/WatchUpdatingTracking.js";import{getReferenceEllipsoid as g}from"../../../geometry/projectionEllipsoid.js";import{PrecipitationPassParameters as T,PrecipitationTechnique as y}from"./PrecipitationTechnique.js";import{PrecipitationTechniqueConfiguration as b,PrecipitationType as j}from"./PrecipitationTechniqueConfiguration.js";import{glLayout as v}from"../support/buffer/glUtil.js";import{newLayout as q}from"../support/buffer/InterleavedLayout.js";import{AnimationTimer as P}from"../webgl-engine/lib/AnimationTimer.js";import{VertexAttribute as A}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as I}from"../../webgl/BufferObject.js";import{PrimitiveType as C,Usage as x}from"../../webgl/enums.js";import{bindVertexBufferLayout as R,unbindVertexBufferLayout as U}from"../../webgl/Util.js";import{VertexArrayObject as S}from"../../webgl/VertexArrayObject.js";let O=class extends e{constructor(t){super(t),this._numParticles=25e4,this._rainSpeed=.1,this._snowSpeed=.01,this._opacity=1,this._width=500,this._offset=l(),this._tile=l(),this._particleColor=d(),this._particleColorAtNight=d(),this._nightMultiplier=.7,this._cameraDirection=d(),this._renderParameters=new T,this._animation=new P,this._updatingTracking=new w,this._renderParameters.time=0,this._renderParameters.radius=g(t.view.spatialReference).radius,this._shaderTechniqueRepository=t.context.shaderTechniqueRepository}destroy(){this._updatingTracking.destroy(),this._numParticles=0,this._snowTechnique=r(this._snowTechnique),this._rainTechnique=r(this._rainTechnique),this._vao=s(this._vao),this._instanceIdBuffer=s(this._instanceIdBuffer)}get updating(){return this._updatingTracking.updating}get rainTechnique(){if(o(this._rainTechnique)){const t=new b;t.type=j.Rain,this._rainTechnique=this._shaderTechniqueRepository.acquire(y,t)}return this._rainTechnique}get snowTechnique(){if(o(this._snowTechnique)){const t=new b;t.type=j.Snow,this._snowTechnique=this._shaderTechniqueRepository.acquire(y,t)}return this._snowTechnique}update(t){return this._animation.advance(t)}render(t,e,r){const s="rainy"===r,h=s?this.rainTechnique:this.snowTechnique;if(!h.compiled)return void this.context.requestRender();const c=t.rctx;if(this._ensureResources(c),o(h)||o(this._vao)||o(this._instanceIdBuffer))return;if(n(t.bindParameters.cloudsComposition.clouds)&&(this._opacity=1-t.bindParameters.cloudsComposition.fadeInOutHeight.factor),this._opacity<=0)return;if(o(this._vao)||o(this._instanceIdBuffer))return;const _=.35;e=e<.5?i(0,_,2*e):i(_,1,2*(e-.5));const m=c.bindTechnique(h);this._renderParameters.camera=t.bindParameters.camera,this._renderParameters.time=(s?this._rainSpeed:this._snowSpeed)*a(this._animation.time),this._renderParameters.time=this._renderParameters.time%1e5,this._update(m,r,t),c.bindVAO(this._vao);const p=y.attributeLocation;m.assertCompatibleVertexAttributeLocations(this._vao),R(c,p,this._instanceIdBuffer,k,0),c.capabilities.instancing.drawArraysInstanced(C.TRIANGLES,0,3,this._numParticles*e),U(c,p,this._instanceIdBuffer,k)}_update(t,e,i){const r=i.bindParameters.camera,s=r.eye;this._tile[0]=Math.floor((s[0]+.5*this._width)/this._width),this._tile[1]=Math.floor((s[1]+.5*this._width)/this._width),this._tile[2]=Math.floor((s[2]+.5*this._width)/this._width),this._offset[0]=s[0]-this._tile[0]*this._width,this._offset[1]=s[1]-this._tile[1]*this._width,this._offset[2]=s[2]-this._tile[2]*this._width,t.setUniform1f("width",this._width),t.setUniform3fv("offset",this._offset),t.setUniformMatrix4fv("view",r.viewMatrix),t.setUniform3fv("cameraPosition",s),t.bindPass(null,i.bindParameters),t.setUniform1f("time",this._renderParameters.time),"rainy"===e?_(this._particleColor,.85,.85,.85):_(this._particleColor,1,1,1),m(this._particleColorAtNight,this._particleColor,this._nightMultiplier),p(this._cameraDirection,s);const o=Math.max(0,u(this._cameraDirection,i.bindParameters.lighting.lightingMainDirection));f(this._particleColor,this._particleColorAtNight,this._particleColor,o),t.setUniform3fv("particleColor",this._particleColor),t.setUniform1f("opacity",this._opacity)}_ensureResources(t){o(this._vao)&&(this._vao=this._createVertexArrayObject(t)),o(this._instanceIdBuffer)&&(this._instanceIdBuffer=this._createInstanceIndices(t))}_createInstanceIndices(t){const e=[];for(let i=0;i<this._numParticles;i++)e.push(i);return I.createVertex(t,x.STATIC_DRAW,new Float32Array(e))}_createVertexArrayObject(t){const e=new Float32Array([-1,0,1,1,0,-1,1,0,1]);return new S(t,y.attributeLocation,{geometry:v(B)},{geometry:I.createVertex(t,x.STATIC_DRAW,e)})}};t([h({constructOnly:!0})],O.prototype,"context",void 0),t([h({constructOnly:!0})],O.prototype,"view",void 0),t([h({readOnly:!0})],O.prototype,"updating",null),t([h()],O.prototype,"_updatingTracking",void 0),O=t([c("esri.views.3d.environment.Precipitation")],O);const B=q().vec3f(A.POSITION),k=v(q().f32(A.INSTANCEFEATUREATTRIBUTE),1);export{O as Precipitation};
@@ -0,0 +1,4 @@
1
+ import "../../../interfaces";
2
+
3
+ import SnowyWeather = __esri.SnowyWeather;
4
+ export default SnowyWeather;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/set.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{c as r}from"../../../chunks/vec3f64.js";import{LabelVisualElement as s}from"./visualElements/LabelVisualElement.js";import{EuclideanSegment as o}from"./visualElements/support/Segment.js";import{SegmentLabels as i}from"../../interactive/SegmentLabels.js";import{anyMapPointToRender as n,screenDistanceSquared as a}from"../../interactive/support/viewUtils.js";let c=class extends i{createLabel({view:e}){return new s({view:e,attached:!0,fontSize:12,distance:10})}positionLabel(e,t,r,s){const i=m(e,r),n=m(e,s);t.geometry={type:"segment",segment:new o(i,n),sampleLocation:"center",callout:!1}}screenDistanceSquared(e,t,r){const s=m(e,t,p),o=m(e,r,l);return a(s,o,e.view)}};function m(e,t,s=r()){const o=e.editGeometryOperations.data.coordinateHelper;return n(t,o,e.elevationInfo,e.view,s)}c=e([t("esri.views.3d.interactive.SegmentLabels3D")],c);const p=r(),l=r();export{c as SegmentLabels3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/set.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{c as r}from"../../../chunks/vec3f64.js";import{LabelVisualElement as s}from"./visualElements/LabelVisualElement.js";import{EuclideanSegment as o}from"./visualElements/support/Segment.js";import{SegmentLabels as i}from"../../interactive/SegmentLabels.js";import{anyMapPointToRender as n,screenDistanceSquared as a}from"../../interactive/support/viewUtils.js";let c=class extends i{createLabel({view:e}){return new s({view:e,attached:!0,fontSize:10,distance:0})}positionLabel(e,t,r,s){const i=m(e,r),n=m(e,s);t.geometry={type:"segment",segment:new o(i,n),sampleLocation:"center",callout:!1}}screenDistanceSquared(e,t,r){const s=m(e,t,p),o=m(e,r,l);return a(s,o,e.view)}};function m(e,t,s=r()){const o=e.editGeometryOperations.data.coordinateHelper;return n(t,o,e.elevationInfo,e.view,s)}c=e([t("esri.views.3d.interactive.SegmentLabels3D")],c);const p=r(),l=r();export{c as SegmentLabels3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{Manipulator3D as a}from"../../Manipulator3D.js";class t{constructor(){this._available=!0}set location(a){this._forEachManipulator3D((t=>t.location=a))}set elevationAlignedLocation(a){this._forEachManipulator3D((t=>t.elevationAlignedLocation=a))}set elevationInfo(a){this._forEachManipulator3D((t=>t.elevationInfo=a))}get renderLocation(){let a;return this._forEachManipulator3D((t=>{a||(a=t.renderLocation)})),a}get available(){return this._available}set available(a){this._available=a,this._forEachManipulator3D((t=>t.available=a))}get grabbing(){return this.someManipulator((a=>a.grabbing))}get dragging(){return this.someManipulator((a=>a.dragging))}hasManipulator(a){return this.someManipulator((t=>t===a))}someManipulator(a){let t=!1;return this.forEachManipulator((i=>{!t&&a(i)&&(t=!0)})),t}_forEachManipulator3D(t){this.forEachManipulator(((i,o)=>{i instanceof a&&t(i,o)}))}}export{t as Manipulation};
5
+ import{Manipulator3D as a}from"../../Manipulator3D.js";class t{constructor(){this._available=!0}set location(a){this._forEachManipulator3D((t=>t.location=a))}set elevationAlignedLocation(a){this._forEachManipulator3D((t=>t.elevationAlignedLocation=a))}set elevationInfo(a){this._forEachManipulator3D((t=>t.elevationInfo=a))}get renderLocation(){let a;return this._forEachManipulator3D((t=>{a||(a=t.renderLocation)})),a}get available(){return this._available}set available(a){this._available=a,this._forEachManipulator3D((t=>t.available=a))}get hovering(){return this.someManipulator((a=>a.hovering))}get grabbing(){return this.someManipulator((a=>a.grabbing))}get dragging(){return this.someManipulator((a=>a.dragging))}hasManipulator(a){return this.someManipulator((t=>t===a))}someManipulator(a){let t=!1;return this.forEachManipulator((i=>{!t&&a(i)&&(t=!0)})),t}_forEachManipulator3D(t){this.forEachManipulator(((i,o)=>{i instanceof a&&t(i,o)}))}}export{t as Manipulation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import t from"../../../../../core/Evented.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import a from"../../../../../core/Handles.js";import{handlesGroup as n,destroyHandle as o}from"../../../../../core/handleUtils.js";import{destroyMaybe as r,isSome as s,isNone as l,unwrap as p,removeMaybe as h,applySome as d}from"../../../../../core/maybe.js";import{watch as u,syncAndInitial as c,initial as m}from"../../../../../core/reactiveUtils.js";import{property as g}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as f}from"../../../../../chunks/mat4f64.js";import{l as v,b as M,h as y,s as x,a as O,g as E}from"../../../../../chunks/vec3.js";import{f as b,c as G}from"../../../../../chunks/vec3f64.js";import S from"../../../../../geometry/Polyline.js";import{makeDehydratedPoint as I}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as V}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as H}from"../../../../../symbols/support/utils.js";import{Manipulator3D as w}from"../../Manipulator3D.js";import{createManipulatorMaterial as A,createManipulatorOutlineMaterial as P,placeAtGraphic as D}from"../../manipulatorUtils.js";import{SegmentLabels3D as L}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as N}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as U,convertToMapCoordinates as j,screenToMapXYAtLocation as k,screenToMapXYForGraphicAtLocation as T}from"../dragEventPipeline3D.js";import{ManipulatorType as R}from"../ManipulatorType.js";import{canMoveZ as F}from"../manipulatorUtils.js";import{settings as C,colors as z}from"../settings.js";import{createVisualElements as Z}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as X}from"../manipulations/config.js";import{MoveManipulation as Y}from"../manipulations/MoveManipulation.js";import{shapeOrientation as q}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as W}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as K,createEdgeOffsetOperation as B,edgeOffsetRotationMatrix as J,screenEdgeLengthSquared as Q}from"./edgeOffsetUtils.js";import{OutlineVisualElement as $}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as ee}from"../../../layers/graphics/GraphicState.js";import te from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as ie}from"../../../../input/IViewEvents.js";import{addMapDelta as ae,createManipulatorDragEventPipeline as ne,dragAtLocation as oe,addScreenDelta as re}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as se,ManipulatorStateCustomFlags as le}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as pe}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as he}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as de}from"../../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as ue}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";let ce=class extends(t.EventedMixin(i)){constructor(e){super(e),this._vertexManipulatorMaterial=A(C.colorToVec4(C.reshapeManipulators.vertex.color),C.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorOutlineMaterial=P(C.colorToVec4(C.reshapeManipulators.vertex.outlineColor),C.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=P(C.colorToVec4(C.reshapeManipulators.vertex.hoverOutlineColor),C.reshapeManipulators.vertex.renderOccluded),this._edgeManipulatorMaterial=A(C.colorToVec4(C.reshapeManipulators.edge.color),C.reshapeManipulators.edge.renderOccluded),this._edgeManipulatorOutlineMaterial=P(C.colorToVec4(C.reshapeManipulators.edge.outlineColor),C.reshapeManipulators.edge.renderOccluded),this._edgeOffsetManipulatorMaterial=A(C.colorToVec4(C.reshapeManipulators.edgeOffset.color),C.reshapeManipulators.edgeOffset.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=A(C.colorToVec4(C.reshapeManipulators.edgeOffset.hoverColor),C.reshapeManipulators.edgeOffset.renderOccluded,!1),this._selectedManipulatorMaterial=A(C.colorToVec4(C.reshapeManipulators.selected.color),C.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorOutlineMaterial=P(C.colorToVec4(C.reshapeManipulators.selected.outlineColor),C.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=P(C.colorToVec4(C.reshapeManipulators.selected.hoverOutlineColor),C.reshapeManipulators.selected.renderOccluded),this._selectedIndex=0,this._vertexManipulatorGeometry=null,this._vertexManipulatorOutlineGeometry=null,this._edgeManipulatorGeometry=null,this._edgeManipulatorOutlineGeometry=null,this._edgeOffsetManipulatorGeometryInside=null,this._edgeOffsetManipulatorGeometryOutside=null,this._manipulatorHandles=new a,this._manipulatorInfos=[],this._editGeometryOperations=null,this._graphicMoveManipulation=null,this._moveManipulation=null,this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=ye.NONE,this._outlineVisualElement=null,this.segmentLabels=null,this.tool=null,this.tooltipOptions=null,this.outputGeometry=null,this._snappingPipeline=new ue,this._snappingPipelineHandle=new ue,this._vertexLaserLineVisualElement=null}initialize(){const e=new ee({graphic:this.graphic});this._graphicState=e,this.handles.add([u((()=>e.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),u((()=>({labels:this.segmentLabels,show:!0===d(this.tooltipOptions,(e=>e.show))})),(({labels:e,show:t})=>{s(e)&&(e.visible=t)}),c),this.view.trackGraphicState(e)])}destroy(){this.segmentLabels=r(this.segmentLabels),this._editGeometryOperations=r(this._editGeometryOperations),this._moveManipulation=r(this._moveManipulation),this._graphicMoveManipulation=r(this._graphicMoveManipulation),this._manipulatorHandles=r(this._manipulatorHandles),this.manipulators.removeAll(),this._manipulatorInfos=[],this._resetGrabbingDragging()}get inputGeometry(){return s(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this.updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.handle.type));this._removeVertices(e)}manipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._moveManipulation=r(this._moveManipulation),this._graphicMoveManipulation=r(this._graphicMoveManipulation),this._manipulatorHandles.removeAll(),this.manipulators.removeAll(),this._manipulatorInfos=[]}_resetGrabbingDragging(){this._numGrabbing=0,this._numDragging=0}_createManipulators(){if(l(this._editGeometryOperations))return;const e=V(this.graphic);for(const t of this._editGeometryOperations.data.components){for(const i of t.vertices)this._createVertexOrEdgeManipulator(i,e);for(const i of t.edges)this._createVertexOrEdgeManipulator(i,e)}this._createGraphicMoveManipulators(e)}get canRedo(){return s(this._editGeometryOperations)&&this._editGeometryOperations.canRedo}get canUndo(){return s(this._editGeometryOperations)&&this._editGeometryOperations.canUndo}redo(){if(l(this._editGeometryOperations))return null;const e=this._editGeometryOperations.redo();return s(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(l(this._editGeometryOperations))return null;this.emit("undo");const e=this._editGeometryOperations.undo();return s(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._removeManipulators(),this._resetGrabbingDragging(),this._createManipulators()}_recreateEditGeometryAndManipulators(e=this.inputGeometry){this._removeManipulators(),this._resetGrabbingDragging(),l(e)||(r(this._editGeometryOperations),this._editGeometryOperations=pe.fromGeometry(e,this.view.state.viewingMode),this._createManipulators(),r(this.segmentLabels),this.segmentLabels=new L({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:V(this.graphic)}}))}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return;let i=0;const a=[],n=this._manipulatorInfos.some((e=>"vertex"===e.handle.type&&e.manipulator.selected)),o=e===xe.SELECTED_OR_ALL&&n;for(const r of this._manipulatorInfos)ge(r)&&(r.manipulator.grabbing||o&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(ye.MOVING),this.destroyed)return;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(ye.RESHAPING),this.destroyed)return;this.emit("reshape",{type:"reshape",mover:this.graphic})}}_isMultiVertexSelection(){let e=0;for(const t of this._manipulatorInfos)ge(t)&&t.manipulator.selected&&e++;return e>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(ye.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)ge(o)&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,he.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case ye.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case ye.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case ye.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case ye.MOVING:switch(this._reshapeEventState){case ye.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case ye.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case ye.RESHAPING:switch(this._reshapeEventState){case ye.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case ye.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulators(e){if(this._graphicMoveManipulation=new W({tool:this.tool,view:this.view,graphicState:this._graphicState}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=p(this._editGeometryOperations).createUndoGroup()),t))).next((t=>{this._perGraphicManipulatorDragAction(xe.ALL,t),"end"===t.action&&(e=h(e))})),a.next(this._cancelDragOperation((()=>e=h(e))))})))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add([this._watchAndUpdateGrabState(e,!1),e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()}))]))),this._moveManipulation=new Y({tool:this.tool,view:this.view,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&F(this.graphic),snapToScene:!1,radius:Y.radiusForSymbol(this.graphic.symbol)}),this._moveManipulation.forEachManipulator((e=>{this.handles.add([this._watchAndUpdateGrabState(e,!1),e.events.on("immediate-click",(t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...t,graphic:this.graphic}),t.stopPropagation()}))])})),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const t=p(this.graphic.geometry).spatialReference,i=this.handles;i.add([this._moveManipulation.createDragPipeline(((t,i,a,n,o)=>{const r=a.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>ge(e)&&e.manipulator.selected));return e.manipulatorType===R.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:{...e,info:null}})).next(this._snappingPipelineHandle.createSnapDragEventPipelineStep({predicate:e=>!!e.info,cancel:n,snappingManager:this.tool.snappingManager,snappingContext:new de({editGeometryOperations:p(this._editGeometryOperations),elevationInfo:e,pointer:o,excludeFeature:this.graphic,visualizer:new N}),updatingHandles:this.updatingHandles}),this._snappingPipelineHandle.next).next(ae()).next((e=>(this._perGraphicManipulatorDragAction(xe.SELECTED_OR_ALL,e),e)));return n.next(this._cancelDragOperation()),r}),e,t,this.graphic),u((()=>this._graphicState?.displaying),(()=>{this._updateMoveManipulationPosition()}),m),this._graphicState.on("changed",(()=>this._updateMoveManipulationPosition())),u((()=>this._graphicState?.isDraped),(e=>{const t="align-move-manipulation";e?i.add(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):i.remove(t)}),m)]),this._updateMoveManipulationPosition();const a=Z({view:this.view,graphic:this.graphic,forEachManipulator:e=>{if(!this.destroyed){s(this._graphicMoveManipulation)&&this._graphicMoveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,R.TRANSLATE_XY);this._moveManipulation.forEachManipulator(e)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});s(a)&&(this._outlineVisualElement=a.visualElement instanceof $?a.visualElement:null),s(this._outlineVisualElement)&&this._manipulatorHandles.add([this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()})),u((()=>this._graphicState.isDraped),(()=>this._updateMoveManipulationPosition()))]),this._manipulatorHandles.add(a)}_createEdgeOffsetManipulator(e,t=V(this.graphic)){const i=C.reshapeManipulators.edgeOffset,a=i.size/2,o=a+i.collisionPadding;if(l(this._edgeOffsetManipulatorGeometryInside)||l(this._edgeOffsetManipulatorGeometryOutside)){const e=a/o,t=e*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside=te.createExtrudedTriangle(t,e/2,e/2,i.height,i.offset),this._edgeOffsetManipulatorGeometryOutside=te.createExtrudedTriangle(-t,e/2,e/2,i.height,-i.offset)}const r=[{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorMaterial,stateMask:se.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:se.Focused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorMaterial,stateMask:se.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:se.Focused}],p=new w({view:this.view,renderObjects:r,elevationInfo:"on-the-ground"!==t.mode||H(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:o,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionType:{type:"disc",direction:b(0,0,1)},collisionPriority:1}),h=new w({view:this.view,renderObjects:[],worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default"}),d={manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=this._getManipulatorInfoFromHandle(d.handle.leftVertex).manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))),c=this._getManipulatorInfoFromHandle(d.handle.rightVertex).manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d)));d.locationUpdateHandle=n([u,c]),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(ne(p,this._createEdgeOffsetPipeline(d,t)),p),this._manipulatorHandles.add(ne(h,((e,i,a,n)=>{if("touch"===n){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const n=this.graphic,o=s(n.geometry)?n.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(oe(this.view,e.elevationAlignedLocation)).next(k(this.view,e.elevationAlignedLocation,t,o,n)).next(re()).next(ae()).next((e=>this._perGraphicManipulatorDragAction(xe.ALL,e))),a.next(this._cancelDragOperation())}})),p);const m=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",m),h.events.on("immediate-click",m)],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,o=()=>{h(e.visibilityHandle);const o=Q(this._getManipulatorInfoFromHandle(e.handle.leftVertex).manipulator.renderLocation,this._getManipulatorInfoFromHandle(e.handle.rightVertex).manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||o)&&(i.grabbable=!o,a.grabbable=!o,e.visibilityHandle=n([i.disableDisplay(),{remove:()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}}]))};this._manipulatorHandles.add([i.events.on("focus-changed",o),a.events.on("focus-changed",o),{remove:()=>{h(e.visibilityHandle),this.manipulators.remove(a)}}],i),o()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const t=p(this._editGeometryOperations).data.coordinateHelper,i=K(this.view,e.manipulator.elevationAlignedLocation,B(t,e.handle,p(e.manipulator.elevationInfo))),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex).manipulator.renderLocation,n=this._getManipulatorInfoFromHandle(e.handle.rightVertex).manipulator.renderLocation,o=s(i)?J(i,a,n):f;e.manipulator.modelTransform=o,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=o;const r=v(M(ve,a,n))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-r,0,0],[r,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,n)=>{this._clearSelection();const{step:o,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(oe(this.view,i.elevationAlignedLocation)).next(o).next(U(this.view)).next(j(this.view,p(this._editGeometryOperations).data.spatialReference)).next(ae()).next(this._applyEdgeOffsetStep(e)).next((e=>{"end"===e.action&&r()})),n.next((e=>(r(),e))).next(this._cancelDragOperation())}}_initializeEdgeOffset(e,t){const i=p(this._editGeometryOperations),a=B(i.data.coordinateHelper,e.handle,t),r=i.createUndoGroup(),s=K(this.view,e.manipulator.elevationAlignedLocation,a);a.requiresSplitEdgeLeft&&this._splitEdgeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge),1),a.requiresSplitEdgeRight&&this._splitEdgeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge),0);const d=()=>new S({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:p(this._editGeometryOperations).data.spatialReference}),c=new $({view:this.view,isDraped:this._graphicState.isDraped,geometry:d(),elevationInfo:e.elevationInfo,width:C.visualElements.lineGraphics.outline.width,color:C.colorToVec4(z.main),attached:!0});let m;const g=()=>{this._cleanEdgeOffsetCollapsedEdges(e),m=h(m)},_=this.on("undo",g);return m=n([o(c),u((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=d())),r,_]),{step:e=>l(a)||l(s)?(g(),null):{...e,operation:a,plane:s},cleanup:g}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||l(t.operation))return t;this._updateEventState(ye.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:n}=t;return(i||a||n)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,n=e.handle.rightVertex,o=p(this._editGeometryOperations).data.coordinateHelper,r=1e-6,s=[];t&&o.distance(t.pos,i.pos)<r&&s.push(this._getManipulatorInfoFromHandle(i)),(o.distance(i.pos,n.pos)<r||a&&o.distance(a.pos,n.pos)<r)&&s.push(this._getManipulatorInfoFromHandle(n)),s.length&&this._removeVertices(s)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=V(this.graphic)){if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(l(this._vertexManipulatorGeometry)||l(this._vertexManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(C.reshapeManipulators.vertex);this._vertexManipulatorGeometry=te.createSphereGeometry(e,16,16),this._vertexManipulatorOutlineGeometry=te.createSphereGeometry(t,16,16)}if(l(this._edgeManipulatorGeometry)||l(this._edgeManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(C.reshapeManipulators.edge);this._edgeManipulatorGeometry=te.createSphereGeometry(e,16,16),this._edgeManipulatorOutlineGeometry=te.createSphereGeometry(t,16,16)}const i=s(this.graphic.geometry)&&"point"===this.graphic.geometry.type?[]:[{geometry:this._vertexManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Me.Vertex|se.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorOutlineMaterial,stateMask:Me.Vertex|se.Unfocused|se.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Me.Vertex|se.Focused|se.Unselected},{geometry:this._vertexManipulatorGeometry,material:this._selectedManipulatorMaterial,stateMask:se.Selected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorOutlineMaterial,stateMask:se.Selected|se.Unfocused},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorHoverOutlineMaterial,stateMask:se.Selected|se.Focused}];this.enableMidpoints&&i.push({geometry:this._edgeManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Me.Edge|se.Focused|se.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Me.Edge|se.Focused|se.Unselected},{geometry:this._edgeManipulatorGeometry,material:this._edgeManipulatorMaterial,stateMask:Me.Edge|se.Unfocused|se.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._edgeManipulatorOutlineMaterial,stateMask:Me.Edge|se.Unfocused|se.Unselected});const a=new w({view:this.view,renderObjects:i,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer.visible)});this._setTypeSpecificManipulatorSettings(a,e,t);const o="edge"===e.type?{manipulator:a,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:a,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(o),this.manipulators.add(a),this._updateManipulatorPosition(o),"edge"===o.type){const e=this._getManipulatorInfoFromHandle(o.handle.leftVertex).manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(o))),t=this._getManipulatorInfoFromHandle(o.handle.rightVertex).manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(o)));o.locationUpdateHandle=n([e,t]),this._manipulatorHandles.add(o.locationUpdateHandle,a)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(a,!0),a);const r=ne(a,((e,i,a,n)=>{let r=null;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(r=p(this._editGeometryOperations).createUndoGroup()),_e(o)){const t=this._splitEdgeManipulator(o);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:o,snapOrigin:o.handle.pos}})).next(oe(this.view,e.elevationAlignedLocation)).next(T(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>!this._isMultiVertexSelection(),cancel:a,snappingManager:this.tool.snappingManager,snappingContext:new de({editGeometryOperations:p(this._editGeometryOperations),elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new N}),updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next(ae()).next((e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=h(r))})),a.next(this._cancelDragOperation((()=>r=h(r))))}));return this._manipulatorHandles.add(r,a),this._manipulatorHandles.add([a.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,o))),a.events.on("select-changed",(()=>{o.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()}))],a),this.emit("manipulators-changed"),o}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_cancelDragOperation(e){return()=>{switch(this._numDragging--,this.undo(),this.outputGeometry=s(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null,s(this.tool.snappingManager)&&this.tool.snappingManager.doneSnapping(),this._reshapeEventState){case ye.NONE:break;case ye.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case ye.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}e&&e(),this.destroyed||this._updateEventState(ye.NONE)}}_setTypeSpecificManipulatorSettings(e,t,i){switch(t.type){case"vertex":e.state=Me.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.radius=C.reshapeManipulators.vertex.size/2+C.reshapeManipulators.vertex.collisionPadding,e.elevationInfo=i,e.interactive=s(this.graphic.geometry)&&"point"!==this.graphic.geometry.type;break;case"edge":e.state=Me.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1,e.radius=C.reshapeManipulators.edge.size/2+C.reshapeManipulators.edge.collisionPadding,e.elevationInfo="on-the-ground"!==i.mode||H(this.graphic.symbol)?{mode:"absolute-height",offset:0}:i}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>{if("start"===i.action)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(ye.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==i.pointerType||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{e.manipulator.interactive=!this._numGrabbing&&s(this.graphic.geometry)&&"point"!==this.graphic.geometry.type,"edgeManipulator"in e&&(e.edgeManipulator.interactive=!this._numGrabbing)})),p(this._graphicMoveManipulation).forEachManipulator((e=>e.interactive=!this._numGrabbing)))}))}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(e){e&&(this._manipulatorHandles.remove(e.manipulator),this._manipulatorInfos.splice(this._manipulatorInfos.indexOf(e),1),this.manipulators.remove(e.manipulator),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(!e)return;const t=p(this._editGeometryOperations);if("vertex"===e.handle.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,fe),e.manipulator.grabbing&&s(this._vertexLaserLineVisualElement)&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.handle.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex).manipulator,a=this._getManipulatorInfoFromHandle(e.handle.rightVertex).manipulator;if(s(e.manipulator.elevationInfo)&&"on-the-ground"===e.manipulator.elevationInfo.mode){const n=i.location,o=a.location,r=.5,s=n.x+r*(o.x-n.x),l=n.y+r*(o.y-n.y),p=n.hasZ&&o.hasZ?0:void 0;e.manipulator.location=I(s,l,p,t.data.spatialReference)}else y(ve,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=ve}}_splitEdgeManipulator(e,t=.5){const i=p(this._editGeometryOperations),a=p(i.splitEdge(e.handle,t).createdVertex);e.locationUpdateHandle.remove(),e.locationUpdateHandle=void 0;const n=V(this.graphic);let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(o),this._updateSelection(e.manipulator);const r=this._updateEventState(ye.RESHAPING),s=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:p(a.index)}],added:s}),r&&this._updateEventState(ye.NONE),o}_updateMoveManipulationPosition(){const e=x(ve,0,0,0);let t=0,i=!1,a=null,n=null;for(const o of this._manipulatorInfos)ge(o)&&(o.manipulator.selected?(t++,O(e,e,o.manipulator.renderLocation),l(a)||o.selectedIndex>a.selectedIndex?(n=a,a=o):(l(n)||o.selectedIndex>n.selectedIndex)&&(n=o)):i=!0);if(0!==t){const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&F(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t}else{const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&F(this.graphic)}if(0!==t){let e=0;if(s(a)){const t=a.handle.pos,i=s(n)?n.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=l(n)&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;i&&o?this._moveManipulation.xyAxisManipulation.available=!1:i?e=me(i,t):o&&(e=me(t,o))}this._moveManipulation.angle=e,this._moveManipulation.radius=X}else this._moveManipulation.angleDeferred=()=>q(p(this.graphic.geometry)),this._moveManipulation.radius=Y.radiusForSymbol(this.graphic.symbol);0!==t&&i?(E(e,e,1/t),fe.spatialReference=p(this._editGeometryOperations).data.spatialReference,fe.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,fe),this._moveManipulation.elevationAlignedLocation=fe):s(this._outlineVisualElement)&&!this._graphicState.isDraped&&s(this._outlineVisualElement.attachmentOrigin)?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:D(this.view,this._moveManipulation,this.graphic)}_removeVertices(e){const t=[],i=p(this._editGeometryOperations);for(const a of e)if("vertex"===a.handle.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=p(i.removeVertices([a.handle]).removedVertices[0].createdEdge);e&&this._createVertexOrEdgeManipulator(e)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:p(e.index)}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(ye.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(ye.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?he.NEW_STEP:he.ACCUMULATE_STEPS)){const a=p(this._editGeometryOperations);a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t){if(l(t.operation))return;const i=p(this._editGeometryOperations),a=t.operation.clone();a.distance=t.operation.signedDistanceToPoint(t.mapEnd),i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.handle.type&&(t.manipulator.selected=!t.manipulator.selected),"vertex"===t.handle.type&&e.button===ie.Right&&this._removeVertices([t]),_e(t)&&e.button===ie.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}};function me(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function ge(e){return"vertex"===e.handle.type}function _e(e){return"edge"===e.handle.type}e([g()],ce.prototype,"segmentLabels",void 0),e([g({constructOnly:!0})],ce.prototype,"tool",void 0),e([g({constructOnly:!0})],ce.prototype,"tooltipOptions",void 0),e([g()],ce.prototype,"inputGeometry",null),e([g()],ce.prototype,"outputGeometry",void 0),e([g({readOnly:!0})],ce.prototype,"updating",null),ce=e([_("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],ce);const fe=I(0,0,null,null),ve=G();var Me,ye,xe;!function(e){e.Vertex=le.Custom1,e.Edge=le.Custom2}(Me||(Me={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(ye||(ye={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(xe||(xe={}));export{ce as ReshapeOperation};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import t from"../../../../../core/Evented.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import a from"../../../../../core/Handles.js";import{handlesGroup as n,destroyHandle as o}from"../../../../../core/handleUtils.js";import{destroyMaybe as r,isSome as s,isNone as l,unwrap as p,removeMaybe as h}from"../../../../../core/maybe.js";import{watch as d,initial as u}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as g}from"../../../../../chunks/mat4f64.js";import{l as _,b as f,h as v,s as M,a as y,g as x}from"../../../../../chunks/vec3.js";import{f as O,c as b}from"../../../../../chunks/vec3f64.js";import E from"../../../../../geometry/Polyline.js";import{makeDehydratedPoint as G}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as S}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as V}from"../../../../../symbols/support/utils.js";import{Manipulator3D as I}from"../../Manipulator3D.js";import{createManipulatorMaterial as H,createManipulatorOutlineMaterial as w,placeAtGraphic as A}from"../../manipulatorUtils.js";import{SegmentLabels3D as L}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as P}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as D,convertToMapCoordinates as N,screenToMapXYAtLocation as U,screenToMapXYForGraphicAtLocation as j}from"../dragEventPipeline3D.js";import{ManipulatorType as k}from"../ManipulatorType.js";import{canMoveZ as T}from"../manipulatorUtils.js";import{settings as R,colors as F}from"../settings.js";import{createVisualElements as C}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as z}from"../manipulations/config.js";import{MoveManipulation as Z}from"../manipulations/MoveManipulation.js";import{shapeOrientation as X}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as Y}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as q,createEdgeOffsetOperation as W,edgeOffsetRotationMatrix as K,screenEdgeLengthSquared as B}from"./edgeOffsetUtils.js";import{OutlineVisualElement as J}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as Q}from"../../../layers/graphics/GraphicState.js";import $ from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as ee}from"../../../../input/IViewEvents.js";import{addMapDelta as te,createManipulatorDragEventPipeline as ie,dragAtLocation as ae,addScreenDelta as ne}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as oe,ManipulatorStateCustomFlags as re}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as se}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as le}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as pe}from"../../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as he}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";let de=class extends(t.EventedMixin(i)){constructor(e){super(e),this._vertexManipulatorMaterial=H(R.colorToVec4(R.reshapeManipulators.vertex.color),R.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorOutlineMaterial=w(R.colorToVec4(R.reshapeManipulators.vertex.outlineColor),R.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=w(R.colorToVec4(R.reshapeManipulators.vertex.hoverOutlineColor),R.reshapeManipulators.vertex.renderOccluded),this._edgeManipulatorMaterial=H(R.colorToVec4(R.reshapeManipulators.edge.color),R.reshapeManipulators.edge.renderOccluded),this._edgeManipulatorOutlineMaterial=w(R.colorToVec4(R.reshapeManipulators.edge.outlineColor),R.reshapeManipulators.edge.renderOccluded),this._edgeOffsetManipulatorMaterial=H(R.colorToVec4(R.reshapeManipulators.edgeOffset.color),R.reshapeManipulators.edgeOffset.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=H(R.colorToVec4(R.reshapeManipulators.edgeOffset.hoverColor),R.reshapeManipulators.edgeOffset.renderOccluded,!1),this._selectedManipulatorMaterial=H(R.colorToVec4(R.reshapeManipulators.selected.color),R.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorOutlineMaterial=w(R.colorToVec4(R.reshapeManipulators.selected.outlineColor),R.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=w(R.colorToVec4(R.reshapeManipulators.selected.hoverOutlineColor),R.reshapeManipulators.selected.renderOccluded),this._selectedIndex=0,this._vertexManipulatorGeometry=null,this._vertexManipulatorOutlineGeometry=null,this._edgeManipulatorGeometry=null,this._edgeManipulatorOutlineGeometry=null,this._edgeOffsetManipulatorGeometryInside=null,this._edgeOffsetManipulatorGeometryOutside=null,this._manipulatorHandles=new a,this._manipulatorInfos=[],this._editGeometryOperations=null,this._graphicMoveManipulation=null,this._moveManipulation=null,this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=ve.NONE,this._outlineVisualElement=null,this._segmentLabels=null,this.tool=null,this.tooltipOptions=null,this.outputGeometry=null,this._snappingPipeline=new he,this._snappingPipelineHandle=new he,this._vertexLaserLineVisualElement=null}initialize(){const e=new Q({graphic:this.graphic});this._graphicState=e,this.handles.add([d((()=>e.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),d((()=>this._tooltipVisible),(()=>this._updateSegmentLabelsVisibility()),u),this.view.trackGraphicState(e)])}destroy(){this._segmentLabels=r(this._segmentLabels),this._editGeometryOperations=r(this._editGeometryOperations),this._moveManipulation=r(this._moveManipulation),this._graphicMoveManipulation=r(this._graphicMoveManipulation),this._manipulatorHandles=r(this._manipulatorHandles),this.manipulators.removeAll(),this._manipulatorInfos=[],this._resetGrabbingDragging()}get _tooltipVisible(){return s(this.tooltipOptions)&&this.tooltipOptions.show}get inputGeometry(){return s(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this.updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.handle.type));this._removeVertices(e)}manipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._moveManipulation=r(this._moveManipulation),this._graphicMoveManipulation=r(this._graphicMoveManipulation),this._manipulatorHandles.removeAll(),this.manipulators.removeAll(),this._manipulatorInfos=[]}_resetGrabbingDragging(){this._numGrabbing=0,this._numDragging=0}_createManipulators(){if(l(this._editGeometryOperations))return;const e=S(this.graphic);for(const t of this._editGeometryOperations.data.components){for(const i of t.vertices)this._createVertexOrEdgeManipulator(i,e);for(const i of t.edges)this._createVertexOrEdgeManipulator(i,e)}this._createGraphicMoveManipulators(e)}get canRedo(){return s(this._editGeometryOperations)&&this._editGeometryOperations.canRedo}get canUndo(){return s(this._editGeometryOperations)&&this._editGeometryOperations.canUndo}redo(){if(l(this._editGeometryOperations))return null;const e=this._editGeometryOperations.redo();return s(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(l(this._editGeometryOperations))return null;this.emit("undo");const e=this._editGeometryOperations.undo();return s(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._removeManipulators(),this._resetGrabbingDragging(),this._createManipulators()}_recreateEditGeometryAndManipulators(e=this.inputGeometry){this._removeManipulators(),this._resetGrabbingDragging(),l(e)||(r(this._editGeometryOperations),this._editGeometryOperations=se.fromGeometry(e,this.view.state.viewingMode),this._createManipulators(),r(this._segmentLabels),this._segmentLabels=new L({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:S(this.graphic)}}),this._updateSegmentLabelsVisibility())}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return;let i=0;const a=[],n=this._manipulatorInfos.some((e=>"vertex"===e.handle.type&&e.manipulator.selected)),o=e===Me.SELECTED_OR_ALL&&n;for(const r of this._manipulatorInfos)ce(r)&&(r.manipulator.grabbing||o&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(ve.MOVING),this.destroyed)return;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(ve.RESHAPING),this.destroyed)return;this.emit("reshape",{type:"reshape",mover:this.graphic})}}_isMultiVertexSelection(){let e=0;for(const t of this._manipulatorInfos)ce(t)&&t.manipulator.selected&&e++;return e>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(ve.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)ce(o)&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,le.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case ve.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case ve.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case ve.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case ve.MOVING:switch(this._reshapeEventState){case ve.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case ve.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case ve.RESHAPING:switch(this._reshapeEventState){case ve.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case ve.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulators(e){if(this._graphicMoveManipulation=new Y({tool:this.tool,view:this.view,graphicState:this._graphicState}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=p(this._editGeometryOperations).createUndoGroup()),t))).next((t=>{this._perGraphicManipulatorDragAction(Me.ALL,t),"end"===t.action&&(e=h(e))})),a.next(this._cancelDragOperation((()=>e=h(e))))})))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add([this._watchAndUpdateGrabState(e,!1),e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()}))]))),this._moveManipulation=new Z({tool:this.tool,view:this.view,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&T(this.graphic),snapToScene:!1,radius:Z.radiusForSymbol(this.graphic.symbol)}),this._moveManipulation.forEachManipulator((e=>{this.handles.add([this._watchAndUpdateGrabState(e,!1),e.events.on("immediate-click",(t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...t,graphic:this.graphic}),t.stopPropagation()}))])})),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const t=p(this.graphic.geometry).spatialReference,i=this.handles;i.add([this._moveManipulation.createDragPipeline(((t,i,a,n,o)=>{const r=a.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>ce(e)&&e.manipulator.selected));return e.manipulatorType===k.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:{...e,info:null}})).next(this._snappingPipelineHandle.createSnapDragEventPipelineStep({predicate:e=>!!e.info,cancel:n,snappingManager:this.tool.snappingManager,snappingContext:new pe({editGeometryOperations:p(this._editGeometryOperations),elevationInfo:e,pointer:o,excludeFeature:this.graphic,visualizer:new P}),updatingHandles:this.updatingHandles}),this._snappingPipelineHandle.next).next(te()).next((e=>(this._perGraphicManipulatorDragAction(Me.SELECTED_OR_ALL,e),e)));return n.next(this._cancelDragOperation()),r}),e,t,this.graphic),d((()=>this._graphicState?.displaying),(()=>{this._updateMoveManipulationPosition()}),u),this._graphicState.on("changed",(()=>this._updateMoveManipulationPosition())),d((()=>this._graphicState?.isDraped),(e=>{const t="align-move-manipulation";e?i.add(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):i.remove(t)}),u)]),this._updateMoveManipulationPosition();const a=C({view:this.view,graphic:this.graphic,forEachManipulator:e=>{if(!this.destroyed){s(this._graphicMoveManipulation)&&this._graphicMoveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,k.TRANSLATE_XY);this._moveManipulation.forEachManipulator(e)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});s(a)&&(this._outlineVisualElement=a.visualElement instanceof J?a.visualElement:null),s(this._outlineVisualElement)&&this._manipulatorHandles.add([this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()})),d((()=>this._graphicState.isDraped),(()=>this._updateMoveManipulationPosition()))]),this._manipulatorHandles.add(a)}_createEdgeOffsetManipulator(e,t=S(this.graphic)){const i=R.reshapeManipulators.edgeOffset,a=i.size/2,o=a+i.collisionPadding;if(l(this._edgeOffsetManipulatorGeometryInside)||l(this._edgeOffsetManipulatorGeometryOutside)){const e=a/o,t=e*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside=$.createExtrudedTriangle(t,e/2,e/2,i.height,i.offset),this._edgeOffsetManipulatorGeometryOutside=$.createExtrudedTriangle(-t,e/2,e/2,i.height,-i.offset)}const r=[{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorMaterial,stateMask:oe.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:oe.Focused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorMaterial,stateMask:oe.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:oe.Focused}],p=new I({view:this.view,renderObjects:r,elevationInfo:"on-the-ground"!==t.mode||V(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:o,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionType:{type:"disc",direction:O(0,0,1)},collisionPriority:1}),h=new I({view:this.view,renderObjects:[],worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default"}),d={manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=this._getManipulatorInfoFromHandle(d.handle.leftVertex).manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))),c=this._getManipulatorInfoFromHandle(d.handle.rightVertex).manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d)));d.locationUpdateHandle=n([u,c]),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(ie(p,this._createEdgeOffsetPipeline(d,t)),p),this._manipulatorHandles.add(ie(h,((e,i,a,n)=>{if("touch"===n){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const n=this.graphic,o=s(n.geometry)?n.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(ae(this.view,e.elevationAlignedLocation)).next(U(this.view,e.elevationAlignedLocation,t,o,n)).next(ne()).next(te()).next((e=>this._perGraphicManipulatorDragAction(Me.ALL,e))),a.next(this._cancelDragOperation())}})),p);const m=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",m),h.events.on("immediate-click",m)],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,o=()=>{h(e.visibilityHandle);const o=B(this._getManipulatorInfoFromHandle(e.handle.leftVertex).manipulator.renderLocation,this._getManipulatorInfoFromHandle(e.handle.rightVertex).manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||o)&&(i.grabbable=!o,a.grabbable=!o,e.visibilityHandle=n([i.disableDisplay(),{remove:()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}}]))};this._manipulatorHandles.add([i.events.on("focus-changed",o),a.events.on("focus-changed",o),{remove:()=>{h(e.visibilityHandle),this.manipulators.remove(a)}}],i),o()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const t=p(this._editGeometryOperations).data.coordinateHelper,i=q(this.view,e.manipulator.elevationAlignedLocation,W(t,e.handle,p(e.manipulator.elevationInfo))),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex).manipulator.renderLocation,n=this._getManipulatorInfoFromHandle(e.handle.rightVertex).manipulator.renderLocation,o=s(i)?K(i,a,n):g;e.manipulator.modelTransform=o,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=o;const r=_(f(_e,a,n))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-r,0,0],[r,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,n)=>{this._clearSelection();const{step:o,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(ae(this.view,i.elevationAlignedLocation)).next(o).next(D(this.view)).next(N(this.view,p(this._editGeometryOperations).data.spatialReference)).next(te()).next(this._applyEdgeOffsetStep(e)).next((e=>{"end"===e.action&&r()})),n.next((e=>(r(),e))).next(this._cancelDragOperation())}}_initializeEdgeOffset(e,t){const i=p(this._editGeometryOperations),a=W(i.data.coordinateHelper,e.handle,t),r=i.createUndoGroup(),s=q(this.view,e.manipulator.elevationAlignedLocation,a);a.requiresSplitEdgeLeft&&this._splitEdgeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge),1),a.requiresSplitEdgeRight&&this._splitEdgeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge),0);const u=()=>new E({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:p(this._editGeometryOperations).data.spatialReference}),c=new J({view:this.view,isDraped:this._graphicState.isDraped,geometry:u(),elevationInfo:e.elevationInfo,width:R.visualElements.lineGraphics.outline.width,color:R.colorToVec4(F.main),attached:!0});let m;const g=()=>{this._cleanEdgeOffsetCollapsedEdges(e),m=h(m)},_=this.on("undo",g);return m=n([o(c),d((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=u())),r,_]),{step:e=>l(a)||l(s)?(g(),null):{...e,operation:a,plane:s},cleanup:g}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||l(t.operation))return t;this._updateEventState(ve.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:n}=t;return(i||a||n)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,n=e.handle.rightVertex,o=p(this._editGeometryOperations).data.coordinateHelper,r=1e-6,s=[];t&&o.distance(t.pos,i.pos)<r&&s.push(this._getManipulatorInfoFromHandle(i)),(o.distance(i.pos,n.pos)<r||a&&o.distance(a.pos,n.pos)<r)&&s.push(this._getManipulatorInfoFromHandle(n)),s.length&&this._removeVertices(s)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=S(this.graphic)){if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(l(this._vertexManipulatorGeometry)||l(this._vertexManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(R.reshapeManipulators.vertex);this._vertexManipulatorGeometry=$.createSphereGeometry(e,16,16),this._vertexManipulatorOutlineGeometry=$.createSphereGeometry(t,16,16)}if(l(this._edgeManipulatorGeometry)||l(this._edgeManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(R.reshapeManipulators.edge);this._edgeManipulatorGeometry=$.createSphereGeometry(e,16,16),this._edgeManipulatorOutlineGeometry=$.createSphereGeometry(t,16,16)}const i=s(this.graphic.geometry)&&"point"===this.graphic.geometry.type?[]:[{geometry:this._vertexManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:fe.Vertex|oe.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorOutlineMaterial,stateMask:fe.Vertex|oe.Unfocused|oe.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:fe.Vertex|oe.Focused|oe.Unselected},{geometry:this._vertexManipulatorGeometry,material:this._selectedManipulatorMaterial,stateMask:oe.Selected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorOutlineMaterial,stateMask:oe.Selected|oe.Unfocused},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorHoverOutlineMaterial,stateMask:oe.Selected|oe.Focused}];this.enableMidpoints&&i.push({geometry:this._edgeManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:fe.Edge|oe.Focused|oe.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:fe.Edge|oe.Focused|oe.Unselected},{geometry:this._edgeManipulatorGeometry,material:this._edgeManipulatorMaterial,stateMask:fe.Edge|oe.Unfocused|oe.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._edgeManipulatorOutlineMaterial,stateMask:fe.Edge|oe.Unfocused|oe.Unselected});const a=new I({view:this.view,renderObjects:i,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer.visible)});this._setTypeSpecificManipulatorSettings(a,e,t);const o="edge"===e.type?{manipulator:a,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:a,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(o),this.manipulators.add(a),this._updateManipulatorPosition(o),"edge"===o.type){const e=this._getManipulatorInfoFromHandle(o.handle.leftVertex).manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(o))),t=this._getManipulatorInfoFromHandle(o.handle.rightVertex).manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(o)));o.locationUpdateHandle=n([e,t]),this._manipulatorHandles.add(o.locationUpdateHandle,a)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(a,!0),a);const r=ie(a,((e,i,a,n)=>{let r=null;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(r=p(this._editGeometryOperations).createUndoGroup()),me(o)){const t=this._splitEdgeManipulator(o);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:o,snapOrigin:o.handle.pos}})).next(ae(this.view,e.elevationAlignedLocation)).next(j(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>!this._isMultiVertexSelection(),cancel:a,snappingManager:this.tool.snappingManager,snappingContext:new pe({editGeometryOperations:p(this._editGeometryOperations),elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new P}),updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next(te()).next((e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=h(r))})),a.next(this._cancelDragOperation((()=>r=h(r))))}));return this._manipulatorHandles.add([r,a.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,o))),a.events.on("select-changed",(()=>{o.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),a.events.on("focus-changed",(()=>this._updateSegmentLabelsVisibility()))],a),this.emit("manipulators-changed"),o}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_updateSegmentLabelsVisibility(){l(this._segmentLabels)||(this._segmentLabels.visible=this._tooltipVisible&&!this._manipulatorInfos.some((e=>"edge"===e.type&&e.manipulator.focused)))}_cancelDragOperation(e){return()=>{switch(this._numDragging--,this.undo(),this.outputGeometry=s(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null,s(this.tool.snappingManager)&&this.tool.snappingManager.doneSnapping(),this._reshapeEventState){case ve.NONE:break;case ve.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case ve.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}e&&e(),this.destroyed||this._updateEventState(ve.NONE)}}_setTypeSpecificManipulatorSettings(e,t,i){switch(t.type){case"vertex":e.state=fe.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.radius=R.reshapeManipulators.vertex.size/2+R.reshapeManipulators.vertex.collisionPadding,e.elevationInfo=i,e.interactive=s(this.graphic.geometry)&&"point"!==this.graphic.geometry.type;break;case"edge":e.state=fe.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1,e.radius=R.reshapeManipulators.edge.size/2+R.reshapeManipulators.edge.collisionPadding,e.elevationInfo="on-the-ground"!==i.mode||V(this.graphic.symbol)?{mode:"absolute-height",offset:0}:i}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>{if("start"===i.action)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(ve.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==i.pointerType||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{e.manipulator.interactive=!this._numGrabbing&&s(this.graphic.geometry)&&"point"!==this.graphic.geometry.type,"edgeManipulator"in e&&(e.edgeManipulator.interactive=!this._numGrabbing)})),p(this._graphicMoveManipulation).forEachManipulator((e=>e.interactive=!this._numGrabbing)))}))}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(e){e&&(this._manipulatorHandles.remove(e.manipulator),this._manipulatorInfos.splice(this._manipulatorInfos.indexOf(e),1),this.manipulators.remove(e.manipulator),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(!e)return;const t=p(this._editGeometryOperations);if("vertex"===e.handle.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,ge),e.manipulator.grabbing&&s(this._vertexLaserLineVisualElement)&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.handle.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex).manipulator,a=this._getManipulatorInfoFromHandle(e.handle.rightVertex).manipulator;if(s(e.manipulator.elevationInfo)&&"on-the-ground"===e.manipulator.elevationInfo.mode){const n=i.location,o=a.location,r=.5,s=n.x+r*(o.x-n.x),l=n.y+r*(o.y-n.y),p=n.hasZ&&o.hasZ?0:void 0;e.manipulator.location=G(s,l,p,t.data.spatialReference)}else v(_e,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=_e}}_splitEdgeManipulator(e,t=.5){const i=p(this._editGeometryOperations),a=p(i.splitEdge(e.handle,t).createdVertex);e.locationUpdateHandle.remove(),e.locationUpdateHandle=void 0;const n=S(this.graphic);let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),this._updateSegmentLabelsVisibility(),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(o),this._updateSelection(e.manipulator);const r=this._updateEventState(ve.RESHAPING),s=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:p(a.index)}],added:s}),r&&this._updateEventState(ve.NONE),o}_updateMoveManipulationPosition(){const e=M(_e,0,0,0);let t=0,i=!1,a=null,n=null;for(const o of this._manipulatorInfos)ce(o)&&(o.manipulator.selected?(t++,y(e,e,o.manipulator.renderLocation),l(a)||o.selectedIndex>a.selectedIndex?(n=a,a=o):(l(n)||o.selectedIndex>n.selectedIndex)&&(n=o)):i=!0);if(0!==t){const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&T(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t}else{const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&T(this.graphic)}if(0!==t){let e=0;if(s(a)){const t=a.handle.pos,i=s(n)?n.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=l(n)&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;i&&o?this._moveManipulation.xyAxisManipulation.available=!1:i?e=ue(i,t):o&&(e=ue(t,o))}this._moveManipulation.angle=e,this._moveManipulation.radius=z}else this._moveManipulation.angleDeferred=()=>X(p(this.graphic.geometry)),this._moveManipulation.radius=Z.radiusForSymbol(this.graphic.symbol);0!==t&&i?(x(e,e,1/t),ge.spatialReference=p(this._editGeometryOperations).data.spatialReference,ge.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,ge),this._moveManipulation.elevationAlignedLocation=ge):s(this._outlineVisualElement)&&!this._graphicState.isDraped&&s(this._outlineVisualElement.attachmentOrigin)?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:A(this.view,this._moveManipulation,this.graphic)}_removeVertices(e){const t=[],i=p(this._editGeometryOperations);for(const a of e)if("vertex"===a.handle.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=p(i.removeVertices([a.handle]).removedVertices[0].createdEdge);e&&this._createVertexOrEdgeManipulator(e)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:p(e.index)}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(ve.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(ve.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?le.NEW_STEP:le.ACCUMULATE_STEPS)){const a=p(this._editGeometryOperations);a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t){if(l(t.operation))return;const i=p(this._editGeometryOperations),a=t.operation.clone();a.distance=t.operation.signedDistanceToPoint(t.mapEnd),i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.handle.type&&(t.manipulator.selected=!t.manipulator.selected),"vertex"===t.handle.type&&e.button===ee.Right&&this._removeVertices([t]),me(t)&&e.button===ee.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}get test(){return{segmentLabels:this._segmentLabels}}};function ue(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function ce(e){return"vertex"===e.handle.type}function me(e){return"edge"===e.handle.type}e([c({constructOnly:!0})],de.prototype,"tool",void 0),e([c({constructOnly:!0})],de.prototype,"tooltipOptions",void 0),e([c()],de.prototype,"_tooltipVisible",null),e([c()],de.prototype,"inputGeometry",null),e([c()],de.prototype,"outputGeometry",void 0),e([c({readOnly:!0})],de.prototype,"updating",null),de=e([m("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],de);const ge=G(0,0,null,null),_e=b();var fe,ve,Me;!function(e){e.Vertex=re.Custom1,e.Edge=re.Custom2}(fe||(fe={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(ve||(ve={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Me||(Me={}));export{de as ReshapeOperation};