@arcgis/core 5.0.0-next.31 → 5.0.0-next.33

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 (241) hide show
  1. package/applications/SceneViewer/sceneViewerUtils.d.ts +3 -0
  2. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/1dd867fa7c58c06b79ea.js +1 -0
  5. package/assets/esri/core/workers/chunks/22d66d1c8dfccdbbcf30.js +1 -0
  6. package/assets/esri/core/workers/chunks/22f745539ca54d8cd30d.js +1 -0
  7. package/assets/esri/core/workers/chunks/2613e482450b57f2d4f5.js +1 -0
  8. package/assets/esri/core/workers/chunks/27bd88e1101873d4ce12.js +1 -0
  9. package/assets/esri/core/workers/chunks/{1dfca37f95f2b968aa54.js → 39d2b540738431adec98.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{5f2cf73fb2944f82661d.js → 433d249c35c56bf15806.js} +34 -34
  11. package/assets/esri/core/workers/chunks/446f76356fc116204ec3.js +1 -0
  12. package/assets/esri/core/workers/chunks/44b6b7418cbf7f778bef.js +1 -0
  13. package/assets/esri/core/workers/chunks/4675ed3ca3e0104d00bf.js +1 -0
  14. package/assets/esri/core/workers/chunks/4df7cc3477bc46fc39af.js +1 -0
  15. package/assets/esri/core/workers/chunks/52ecbaa2d32692d6d8df.js +1 -0
  16. package/assets/esri/core/workers/chunks/{3777b41b4fa2f1418402.js → 55818fe7a7aa1e5c8bbd.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{7e6fae3660e7a6a0fa16.js → 5f781ef46ce7c4048c2f.js} +1 -1
  18. package/assets/esri/core/workers/chunks/63933cbcb5c12df09715.js +1 -0
  19. package/assets/esri/core/workers/chunks/706423d801fa9cbf2e90.js +1 -0
  20. package/assets/esri/core/workers/chunks/{e6df4327ac1d9b65b80d.js → 71dd80231ea656a6380c.js} +1 -1
  21. package/assets/esri/core/workers/chunks/725819839434c59102f3.js +1 -0
  22. package/assets/esri/core/workers/chunks/72cebf18da5ec5eeb666.js +1 -0
  23. package/assets/esri/core/workers/chunks/{bd58c027408dc858f23c.js → 77b45957cfe42523c1c8.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{b2fbb44e219232e61cbd.js → 794960ec36e11f4416c2.js} +1 -1
  25. package/assets/esri/core/workers/chunks/852de585a72d902344a6.js +1 -0
  26. package/assets/esri/core/workers/chunks/{25fd0884dd14973c89f5.js → 866a608d489bf56bc371.js} +1 -1
  27. package/assets/esri/core/workers/chunks/871dd5e1f016a04b8d98.js +1 -0
  28. package/assets/esri/core/workers/chunks/892c417f5130b003889d.js +1 -0
  29. package/assets/esri/core/workers/chunks/{0bfb7db0a151a5e85dd1.js → 8ad6595ad44c2d60c1ce.js} +1 -1
  30. package/assets/esri/core/workers/chunks/907083c427d7fb4354e9.js +1 -0
  31. package/assets/esri/core/workers/chunks/{11bb437437272d8f3e2c.js → 9252854b512237b6a0ef.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{e615983fab688d515205.js → 944dfa9309da8f49a616.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{f2f4e34247882eceb50d.js → a2cee5ac0d4df0108425.js} +3 -3
  34. package/assets/esri/core/workers/chunks/a4b7ba8aec109beb5b4d.js +1 -0
  35. package/assets/esri/core/workers/chunks/{3bacd904cd93c8013f6a.js → ae793d814cf32db9fbde.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{e0b70652da4a7f672cfc.js → b21cf62652ca772108c8.js} +1 -1
  37. package/assets/esri/core/workers/chunks/c2596f48b37092dd566c.js +1 -0
  38. package/assets/esri/core/workers/chunks/c82a974c8448407885e6.js +1 -0
  39. package/assets/esri/core/workers/chunks/c9c2e00fed979c21e2f0.js +1 -0
  40. package/assets/esri/core/workers/chunks/{94005916d321c879bea1.js → cb500d673ca7ec1ef945.js} +1 -1
  41. package/assets/esri/core/workers/chunks/d239a4ef60e348cfb05a.js +1 -0
  42. package/assets/esri/core/workers/chunks/d6d03f22c91f528b97e5.js +1 -0
  43. package/assets/esri/core/workers/chunks/{4ab89c990a82c745c0fd.js → d764b6273974f4bca31b.js} +1 -1
  44. package/assets/esri/core/workers/chunks/d86e59da76eea888ba86.js +1 -0
  45. package/assets/esri/core/workers/chunks/da517b4b07d4d27ce94c.js +1 -0
  46. package/assets/esri/core/workers/chunks/dc3a4ad62bc041a4f899.js +1 -0
  47. package/assets/esri/core/workers/chunks/defc6b50df5018bd9e86.js +1 -0
  48. package/assets/esri/core/workers/chunks/df458ad51be27df3d79d.js +1 -0
  49. package/assets/esri/core/workers/chunks/{01b8e680befff83e7d3e.js → e093e745708f722bc1b9.js} +1 -1
  50. package/assets/esri/core/workers/chunks/e32fc0b2c6530d28ce85.js +1 -0
  51. package/assets/esri/core/workers/chunks/e3a994587f9b2e88db85.js +1 -0
  52. package/assets/esri/core/workers/chunks/ea5bf896acfcc3106bf5.js +1 -0
  53. package/assets/esri/core/workers/chunks/ed1dabed10ff9f4e0369.js +1 -0
  54. package/assets/esri/core/workers/chunks/{a74e6d505a55ed27f004.js → f11453f24c0b728669d2.js} +1 -1
  55. package/assets/esri/core/workers/chunks/f2ebd6471e1259a6eac0.js +1 -0
  56. package/assets/esri/core/workers/chunks/{14dc21fe66c7b98fb456.js → f3127bdf28a1d9b8db27.js} +1 -1
  57. package/assets/esri/core/workers/chunks/f3c232fc56a29d51196a.js +1 -0
  58. package/assets/esri/core/workers/chunks/fee942ef802a162e0248.js +1 -0
  59. package/assets/esri/themes/base/widgets/_Attribution.scss +8 -0
  60. package/assets/esri/themes/dark/main.css +1 -1
  61. package/assets/esri/themes/light/main.css +1 -1
  62. package/assets/esri/themes/light/view.css +1 -1
  63. package/chunks/BlendLayers.glsl.js +1 -1
  64. package/chunks/Envelope.js +1 -1
  65. package/chunks/GaussianSplat.glsl.js +2 -2
  66. package/chunks/Geometry.js +1 -1
  67. package/chunks/GlowComposition.glsl.js +5 -5
  68. package/chunks/MultiPathImpl.js +1 -1
  69. package/chunks/Point2D.js +1 -1
  70. package/chunks/UnitFactory.js +1 -1
  71. package/config.js +1 -1
  72. package/core/deprecate.js +1 -1
  73. package/core/keyboard.js +5 -0
  74. package/geometry/SpatialReference.js +1 -1
  75. package/geometry/operators/support/apiConverter.js +1 -1
  76. package/geometry/operators/support/jsonConverter.js +1 -1
  77. package/geometry/support/spatialReferenceUtils.js +1 -1
  78. package/interfaces.d.ts +552 -3
  79. package/kernel.js +1 -1
  80. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  81. package/layers/catalog/CatalogDynamicGroupLayer.js +1 -1
  82. package/layers/graphics/data/AttributesBuilder.js +1 -1
  83. package/layers/graphics/data/QueryEngineResult.js +1 -1
  84. package/layers/mixins/ArcGISImageService.js +1 -1
  85. package/package.json +1 -1
  86. package/portal/schemas/definitions.js +1 -1
  87. package/rest/query/operations/query.js +1 -1
  88. package/rest/support/LocateSetting.d.ts +4 -0
  89. package/rest/support/LocateSetting.js +5 -0
  90. package/rest/support/LocateSettingBase.d.ts +4 -0
  91. package/rest/support/LocateSettingBase.js +5 -0
  92. package/rest/support/LocateSettingSource.d.ts +4 -0
  93. package/rest/support/LocateSettingSource.js +5 -0
  94. package/rest/support/LocateSettings.d.ts +4 -0
  95. package/rest/support/LocateSettings.js +5 -0
  96. package/rest/support/LocateSettingsOverrides.d.ts +4 -0
  97. package/rest/support/LocateSettingsOverrides.js +5 -0
  98. package/rest/support/RouteParameters.js +1 -1
  99. package/statistics/utils.js +1 -1
  100. package/support/revision.js +1 -1
  101. package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
  102. package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
  103. package/views/3d/GroundView3D.js +1 -1
  104. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  105. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  106. package/views/3d/layers/I3SMeshView3D.js +1 -1
  107. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  108. package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
  109. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  110. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  111. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  112. package/views/3d/state/ConstraintsManager.js +1 -1
  113. package/views/3d/state/NearFarHeuristic.js +1 -1
  114. package/views/3d/support/Attribution3D.js +5 -0
  115. package/views/3d/support/CombinedElevationProvider.js +1 -1
  116. package/views/3d/support/ElevationRange.js +1 -1
  117. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  118. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +5 -0
  119. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +5 -0
  120. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  121. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  122. package/views/3d/terrain/ElevationBounds.js +1 -1
  123. package/views/3d/terrain/ElevationData.js +1 -1
  124. package/views/3d/terrain/TerrainSurface.js +1 -1
  125. package/views/3d/terrain/Tile.js +1 -1
  126. package/views/3d/terrain/TileBlendTechniqueConfiguration.js +1 -1
  127. package/views/3d/terrain/TileCompositor.js +1 -1
  128. package/views/3d/terrain/TileRenderer.js +1 -1
  129. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  130. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  131. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  132. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  133. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  134. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +12 -12
  135. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentDataConstants.js +5 -0
  136. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  137. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  138. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  139. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +10 -13
  140. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +7 -1
  141. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +6 -6
  142. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +4 -4
  143. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +1 -1
  144. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  145. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
  146. package/views/3d/webgl-engine/effects/glow/GlowPresets.glsl.js +1 -1
  147. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  148. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  149. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  150. package/views/3d/webgl-engine/lib/TextureBackedBuffer/BufferManager.js +1 -1
  151. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  152. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
  153. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  154. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  155. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  156. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  157. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  158. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  159. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  160. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  161. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  162. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  163. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  164. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  165. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  166. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  167. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  168. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  169. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  170. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  171. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +4 -4
  172. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +24 -31
  173. package/views/Attribution.js +5 -0
  174. package/views/DOMContainer.js +1 -1
  175. package/views/SceneView.js +1 -1
  176. package/views/View.js +1 -1
  177. package/views/draw/support/managers/DrawTooltipManager.js +5 -0
  178. package/views/interactive/tooltip/content/TooltipContentDynamic.js +5 -0
  179. package/views/interactive/tooltip/content/tooltipContentFactory.js +1 -1
  180. package/views/interactive/tooltip/fields/TooltipField.js +1 -1
  181. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +5 -0
  182. package/views/layers/LayerView.js +1 -1
  183. package/views/support/AttributionItem.d.ts +4 -0
  184. package/views/support/AttributionItem.js +5 -0
  185. package/views/support/GroundElevationSampler.js +1 -1
  186. package/views/support/LayerViewManager.js +1 -1
  187. package/views/support/attributionUtils.js +5 -0
  188. package/views/support/geodesicAreaMeasurementUtils.js +1 -1
  189. package/views/support/geodesicLengthMeasurementUtils.js +1 -1
  190. package/views/ui/2d/DefaultUI2D.js +1 -1
  191. package/views/ui/3d/DefaultUI3D.js +1 -1
  192. package/widgets/Attribution/AttributionViewModel.js +1 -1
  193. package/widgets/Attribution.js +1 -1
  194. package/widgets/ElevationProfile/ElevationProfileLine.js +1 -1
  195. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  196. package/widgets/ElevationProfile.js +1 -1
  197. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  198. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  199. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  200. package/widgets/Widget.js +1 -1
  201. package/widgets/support/decorators/accessibleHandler.js +1 -1
  202. package/widgets/support/jsxWidgetSupport.js +1 -1
  203. package/widgets/support/widget.js +1 -1
  204. package/widgets/support/widgetUtils.js +1 -1
  205. package/assets/esri/core/workers/chunks/0a1df5a724fe253b3866.js +0 -1
  206. package/assets/esri/core/workers/chunks/155d74b9c0ef31dc2316.js +0 -1
  207. package/assets/esri/core/workers/chunks/25143b919e75d5d2da05.js +0 -1
  208. package/assets/esri/core/workers/chunks/2c8c48433b380da59831.js +0 -1
  209. package/assets/esri/core/workers/chunks/2d17ed5321ca05acb8e3.js +0 -1
  210. package/assets/esri/core/workers/chunks/31b5747a254d13acc58e.js +0 -1
  211. package/assets/esri/core/workers/chunks/3ac84e324d212815e252.js +0 -1
  212. package/assets/esri/core/workers/chunks/41a00c77e6f7ce61e476.js +0 -1
  213. package/assets/esri/core/workers/chunks/447b53a9280b2b19b7a6.js +0 -1
  214. package/assets/esri/core/workers/chunks/45729d006db6a569715f.js +0 -1
  215. package/assets/esri/core/workers/chunks/50cf3cbcad2be1c1e210.js +0 -1
  216. package/assets/esri/core/workers/chunks/565358ea8d1bdc4d1ebc.js +0 -1
  217. package/assets/esri/core/workers/chunks/592afe1a41bed3b0cc31.js +0 -1
  218. package/assets/esri/core/workers/chunks/5aeda8a1f2ccabfdf40f.js +0 -1
  219. package/assets/esri/core/workers/chunks/657d9e5145da1306ace8.js +0 -1
  220. package/assets/esri/core/workers/chunks/6ce7ca6bebdc61d8eada.js +0 -1
  221. package/assets/esri/core/workers/chunks/7f7a81ed8893ab649af7.js +0 -1
  222. package/assets/esri/core/workers/chunks/7ffef8a19166f6b564d8.js +0 -1
  223. package/assets/esri/core/workers/chunks/819781a209608dcdd678.js +0 -1
  224. package/assets/esri/core/workers/chunks/8d57e3a0e5687ce15557.js +0 -1
  225. package/assets/esri/core/workers/chunks/8e9a5d38da40702def80.js +0 -1
  226. package/assets/esri/core/workers/chunks/8fbda0b85731ac77e1d8.js +0 -1
  227. package/assets/esri/core/workers/chunks/98c32d10a2344cd7a50b.js +0 -1
  228. package/assets/esri/core/workers/chunks/aac313257a8b1ae75b75.js +0 -1
  229. package/assets/esri/core/workers/chunks/be06c8a58c217a17451b.js +0 -1
  230. package/assets/esri/core/workers/chunks/d56548a994753b08403c.js +0 -1
  231. package/assets/esri/core/workers/chunks/d5b464ff83ce29b51968.js +0 -1
  232. package/assets/esri/core/workers/chunks/d777d7cb8df3f21ac97e.js +0 -1
  233. package/assets/esri/core/workers/chunks/dd95e679618b7b21a7b1.js +0 -1
  234. package/assets/esri/core/workers/chunks/e08a1934d98e7324776d.js +0 -1
  235. package/assets/esri/core/workers/chunks/e5deb72df8b2505fd325.js +0 -1
  236. package/assets/esri/core/workers/chunks/e689a4849f5af3f2f641.js +0 -1
  237. package/assets/esri/core/workers/chunks/f259ad785ce3aa970792.js +0 -1
  238. package/assets/esri/core/workers/chunks/f4919950a9a3703d9da3.js +0 -1
  239. package/assets/esri/core/workers/chunks/f6ce485c082d0d640b01.js +0 -1
  240. package/assets/esri/core/workers/chunks/fd9ef4b8c969962cf72b.js +0 -1
  241. package/layers/support/attributionUtils.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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import l from"../../../../core/Accessor.js";import{generateUUID as i}from"../../../../core/uuid.js";import{property as o,subclass as e}from"../../../../core/accessorSupport/decorators.js";let s=class extends l{constructor(t){super(t),this.actual=null,this.lockable=!0,this.id=i(),this.inputValue=null,this.readOnly=!1,this.suffix=null,this.visible=!0,this.invalid=!1,this.unlockOnVertexPlacement=!0}get committed(){return this.lockable?this._get("committed"):null}set committed(t){this.lockable&&this._set("committed",t)}get dirty(){return null!=this.inputValue}get disabled(){return null==this.actual&&!this.dirty&&!this.locked}get locked(){return this.lockable&&null!=this.committed}onInput(t){this.inputValue=t,this.invalid=!1}onCommit(t,l,i){this.lockable?this._onCommitLockable(t,i):this._onCommitNonLockable(i),this.invalid&&"commit-and-exit"===t||i.onCommit(l,t)}_onCommitLockable(t,l){const{inputValue:i,locked:o}=this;o&&n(i)?this.unlock():("commit-and-exit"===t&&!o||null!=i)&&this._parseInputAndLock(l)}_onCommitNonLockable(t){const{inputValue:l}=this;n(l)?this.lockable?this.setActual(null):this.clearInputValue():null!=l&&this._parseInputAndSetActual(t)}applyValue(t){this.lockable?this.lock(t):this.setActual(t)}clearInputValue(){this.inputValue=null,this.invalid=!1}setActual(t){this.actual=t,this.clearInputValue()}lock(t){this.lockable&&(this.committed=t??this.actual,this.clearInputValue())}unlock(){this.lockable&&(this.committed=null,this.clearInputValue())}toggleLock(t){this.lockable&&(this.locked?this.unlock():this._parseInputAndLock(t))}getSuffix(t){const{suffix:l}=this;return"function"==typeof l?l(t):l}getFormattedValue(t){const{actual:l,committed:i,format:o}=this;return null!=i?o(i,t):null!=l?o(l,t):null}getRawDisplayValue(t){const{actual:l,committed:i,inputValue:o}=this;return null!=o?o:this.lockable&&null!=i?this.formatForInputMode(i,t):null!=l?this.formatForInputMode(l,t):null}_parseInputAndSetActual(t){const{inputValue:l}=this;if(null==l||n(l))return this.setActual(null);const i=this.parse(l,t);null!=i?this.setActual(i):this.invalid=!0}_parseInputAndLock(t){const{inputValue:l,actual:i}=this;if(n(l))return this.unlock();if(null==l)return this.lock(i);const o=this.parse(l,t);null!=o?this.lock(o):this.invalid=!0}};function n(t){return null!=t&&""===t.trim()}t([o()],s.prototype,"actual",void 0),t([o()],s.prototype,"committed",null),t([o()],s.prototype,"dirty",null),t([o()],s.prototype,"disabled",null),t([o()],s.prototype,"format",void 0),t([o()],s.prototype,"formatForInputMode",void 0),t([o()],s.prototype,"lockable",void 0),t([o()],s.prototype,"locked",null),t([o()],s.prototype,"id",void 0),t([o()],s.prototype,"inputValue",void 0),t([o()],s.prototype,"name",void 0),t([o()],s.prototype,"parse",void 0),t([o()],s.prototype,"readOnly",void 0),t([o()],s.prototype,"suffix",void 0),t([o()],s.prototype,"title",void 0),t([o()],s.prototype,"visible",void 0),t([o()],s.prototype,"invalid",void 0),t([o()],s.prototype,"unlockOnVertexPlacement",void 0),s=t([e("esri.views.interactive.tooltip.fields.TooltipField")],s);export{s as TooltipField};
5
+ import{__decorate as t}from"tslib";import i from"../../../../core/Accessor.js";import{generateUUID as l}from"../../../../core/uuid.js";import{property as o,subclass as e}from"../../../../core/accessorSupport/decorators.js";let s=class extends i{constructor(t){super(t),this.actual=null,this.lockable=!0,this.id=l(),this.inputValue=null,this.readOnly=!1,this.suffix=null,this.visible=!0,this.invalid=!1,this.unlockOnVertexPlacement=!0,this.displayOrder=0}get committed(){return this.lockable?this._get("committed"):null}set committed(t){this.lockable&&this._set("committed",t)}get dirty(){return null!=this.inputValue}get disabled(){return null==this.actual&&!this.dirty&&!this.locked}get locked(){return this.lockable&&null!=this.committed}onInput(t){this.inputValue=t,this.invalid=!1}onCommit(t,i,l){this.lockable?this._onCommitLockable(t,l):this._onCommitNonLockable(l),this.invalid&&"commit-and-exit"===t||l.onCommit(i,t)}_onCommitLockable(t,i){const{inputValue:l,locked:o}=this;o&&n(l)?this.unlock():("commit-and-exit"===t&&!o||null!=l)&&this._parseInputAndLock(i)}_onCommitNonLockable(t){const{inputValue:i}=this;n(i)?this.lockable?this.setActual(null):this.clearInputValue():null!=i&&this._parseInputAndSetActual(t)}applyValue(t){this.lockable?this.lock(t):this.setActual(t)}clearInputValue(){this.inputValue=null,this.invalid=!1}setActual(t){this.actual=t,this.clearInputValue()}lock(t){this.lockable&&(this.committed=t??this.actual,this.clearInputValue())}unlock(){this.lockable&&(this.committed=null,this.clearInputValue())}toggleLock(t){this.lockable&&(this.locked?this.unlock():this._parseInputAndLock(t))}getSuffix(t){const{suffix:i}=this;return"function"==typeof i?i(t):i}getFormattedValue(t){const{actual:i,committed:l,format:o}=this;return null!=l?o(l,t):null!=i?o(i,t):null}getRawDisplayValue(t){const{actual:i,committed:l,inputValue:o}=this;return null!=o?o:this.lockable&&null!=l?this.formatForInputMode(l,t):null!=i?this.formatForInputMode(i,t):null}_parseInputAndSetActual(t){const{inputValue:i}=this;if(null==i||n(i))return this.setActual(null);const l=this.parse(i,t);null!=l?this.setActual(l):this.invalid=!0}_parseInputAndLock(t){const{inputValue:i,actual:l}=this;if(n(i))return this.unlock();if(null==i)return this.lock(l);const o=this.parse(i,t);null!=o?this.lock(o):this.invalid=!0}};function n(t){return null!=t&&""===t.trim()}t([o()],s.prototype,"actual",void 0),t([o()],s.prototype,"committed",null),t([o()],s.prototype,"dirty",null),t([o()],s.prototype,"disabled",null),t([o()],s.prototype,"format",void 0),t([o()],s.prototype,"formatForInputMode",void 0),t([o()],s.prototype,"lockable",void 0),t([o()],s.prototype,"locked",null),t([o()],s.prototype,"id",void 0),t([o()],s.prototype,"inputValue",void 0),t([o()],s.prototype,"name",void 0),t([o()],s.prototype,"parse",void 0),t([o()],s.prototype,"readOnly",void 0),t([o()],s.prototype,"suffix",void 0),t([o()],s.prototype,"title",void 0),t([o()],s.prototype,"visible",void 0),t([o()],s.prototype,"invalid",void 0),t([o()],s.prototype,"unlockOnVertexPlacement",void 0),t([o()],s.prototype,"displayOrder",void 0),s=t([e("esri.views.interactive.tooltip.fields.TooltipField")],s);export{s as TooltipField};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{SketchTooltipInfo as s}from"./SketchTooltipInfo.js";let n=class extends s{constructor(e){super(e),this.type="dynamic",this.xyMode="direction-distance",this._isVisibleField=e=>{switch(e.name){case"x":case"y":return this.visibleElements.coordinates;default:return this.visibleElements[e.name]}}}get availableFields(){return this.getAllFields?.()??[]}get elevation(){return this.allFields.find(e=>"elevation"===e.name)}get allFields(){const{availableFields:e,_useCoordinateDisplay:t,_useDirectionDistanceDisplay:i}=this;return(t?e.filter(l):i?e.filter(r):e).filter(this._isVisibleField).sort(o)}get knownConstraintFields(){return this.allFields.filter(a)}get _useCoordinateDisplay(){const{availableFields:e,xyMode:t}=this;return"coordinates"===t&&e.some(e=>"x"===e.name)&&e.some(e=>"y"===e.name)}get _useDirectionDistanceDisplay(){const{availableFields:e,xyMode:t}=this;return"direction-distance"===t&&e.some(e=>"distance"===e.name)&&e.some(e=>"direction"===e.name)}};function o(e,t){return e.displayOrder-t.displayOrder}function l(e){return"direction"!==e.name&&"distance"!==e.name}function r(e){return"x"!==e.name&&"y"!==e.name}function a(e){switch(e.name){case"direction":case"distance":case"elevation":case"x":case"y":return!0;default:return!1}}e([t()],n.prototype,"type",void 0),e([t()],n.prototype,"xyMode",void 0),e([t()],n.prototype,"getAllFields",void 0),e([t()],n.prototype,"availableFields",null),e([t()],n.prototype,"elevation",null),e([t()],n.prototype,"allFields",null),e([t()],n.prototype,"knownConstraintFields",null),e([t()],n.prototype,"_useCoordinateDisplay",null),e([t()],n.prototype,"_useDirectionDistanceDisplay",null),n=e([i("esri.views.interactive.tooltip.infos.DynamicTooltipInfo")],n);export{n as DynamicTooltipInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{IdentifiableMixin as i}from"../../core/Identifiable.js";import r from"../../core/Logger.js";import{destroyMaybe as s}from"../../core/maybe.js";import{EsriPromiseMixin as n}from"../../core/Promise.js";import{property as l,subclass as a}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as o}from"../../core/support/UpdatingHandles.js";import{validateScaleRange as p}from"../support/layerViewUtils.js";let d=class extends(i(n(t))){get spatialReferenceSupported(){return!0}constructor(e){super(e),this._updatingHandles=new o,this.layer=null,this.parent=null}initialize(){this.when().catch(e=>{if("layerview:create-error"!==e.name){const t=this.layer&&this.layer.id||"no id",i=this.layer?.title||"no title";r.getLogger(this).error("#resolve()",`Failed to resolve layer view (layer title: '${i}', id: '${t}')`,e)}})}destroy(){this._updatingHandles=s(this._updatingHandles),this._set("parent",null)}get fullOpacity(){return(this.layer?.opacity??1)*(this.parent?.fullOpacity??1)}get suspended(){return this.destroyed||!this.canResume()}get suspendInfo(){return this.getSuspendInfo()}get legendEnabled(){return!this.suspended&&!0===this.layer?.legendEnabled}get updating(){return!(!this._updatingHandles?.updating&&!this.isUpdating())}get updatingProgress(){return this.updating?0:1}get updateSuspended(){return this.suspended}get visible(){return!0===this.layer?.visible}set visible(e){this._overrideIfSome("visible",e)}get visibleAtCurrentScale(){return!0}get visibleAtCurrentTimeExtent(){const e=this.view.timeExtent,t=this.layer?.visibilityTimeExtent;return!e||!t||!e.intersection(t).isEmpty}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&p(e)&&this.visibleAtCurrentScale&&this.visibleAtCurrentTimeExtent||!1}getSuspendInfo(){const e=this.parent?.suspended?this.parent.suspendInfo:{},t=this;t.view?.ready||(e.viewNotReady=!0),this.layer&&this.layer.loaded||(e.layerNotLoaded=!0);const i=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return p(i)&&this.visibleAtCurrentScale||(e.outsideScaleRange=!0),this.visibleAtCurrentTimeExtent||(e.outsideVisibilityTimeExtent=!0),this.visible||(e.layerInvisible=!0),e}isUpdating(){return!1}};e([l({readOnly:!0})],d.prototype,"spatialReferenceSupported",null),e([l()],d.prototype,"view",void 0),e([l()],d.prototype,"fullOpacity",null),e([l()],d.prototype,"layer",void 0),e([l()],d.prototype,"parent",void 0),e([l({readOnly:!0})],d.prototype,"suspended",null),e([l({readOnly:!0})],d.prototype,"suspendInfo",null),e([l({readOnly:!0})],d.prototype,"legendEnabled",null),e([l({type:Boolean,readOnly:!0})],d.prototype,"updating",null),e([l({readOnly:!0})],d.prototype,"updatingProgress",null),e([l()],d.prototype,"updateSuspended",null),e([l()],d.prototype,"visible",null),e([l({readOnly:!0})],d.prototype,"visibleAtCurrentScale",null),e([l({readOnly:!0})],d.prototype,"visibleAtCurrentTimeExtent",null),d=e([a("esri.views.layers.LayerView")],d);export{d as default};
5
+ import{__decorate as t}from"tslib";import{createTask as e}from"../../core/asyncUtils.js";import{EventedAccessor as i}from"../../core/Evented.js";import{IdentifiableMixin as r}from"../../core/Identifiable.js";import s from"../../core/Logger.js";import{destroyMaybe as n,removeMaybe as a}from"../../core/maybe.js";import{EsriPromiseMixin as l}from"../../core/Promise.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{property as u,subclass as p}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../core/support/UpdatingHandles.js";import{getAttributionItemFromUserCopyright as h,isDynamicAttributionLayer as y,createAttributionIndex as c,getAttributionItemsFromIndex as g,getAttributionItemFromAccessInformation as m,getAttributionItemFromLayerCopyright as b}from"../support/attributionUtils.js";import{validateScaleRange as f}from"../support/layerViewUtils.js";let v=class extends(r(l(i))){get spatialReferenceSupported(){return!0}constructor(t){super(t),this._updatingHandles=new d,this._attributionIndexTask=null,this.layer=null,this.parent=null}initialize(){this.when().catch(t=>{if("layerview:create-error"!==t.name){const e=this.layer&&this.layer.id||"no id",i=this.layer?.title||"no title";s.getLogger(this).error("#resolve()",`Failed to resolve layer view (layer title: '${i}', id: '${e}')`,t)}})}destroy(){this._updatingHandles=n(this._updatingHandles),this._attributionIndexTask=a(this._attributionIndexTask),this._set("parent",null)}get attributionItems(){const t=this._get("attributionItems")??[];if(this.suspended||!this.layer?.attributionVisible)return 0===t.length?t:[];if(!this.view.stationary)return t;const e=this.getAttributionItems();return t?.length!==e.length||t?.some((t,i)=>t.text!==e[i].text)?e:t}get attributionUpdating(){return!!this._attributionIndexTask&&!this._attributionIndexTask.finished}get fullOpacity(){return(this.layer?.opacity??1)*(this.parent?.fullOpacity??1)}get suspended(){return this.destroyed||!this.canResume()}get suspendInfo(){return this.getSuspendInfo()}get legendEnabled(){return!this.suspended&&!0===this.layer?.legendEnabled}get updating(){return!(!this._updatingHandles?.updating&&!this.isUpdating())}get updatingProgress(){return this.updating?0:1}get updateSuspended(){return this.suspended}get visible(){return!0===this.layer?.visible}set visible(t){this._overrideIfSome("visible",t)}get visibleAtCurrentScale(){return!0}get visibleAtCurrentTimeExtent(){const t=this.view.timeExtent,e=this.layer?.visibilityTimeExtent;return!t||!e||!t.intersection(e).isEmpty}canResume(){const t=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&f(t)&&this.visibleAtCurrentScale&&this.visibleAtCurrentTimeExtent||!1}getSuspendInfo(){const t=this.parent?.suspended?this.parent.suspendInfo:{},e=this;e.view?.ready||(t.viewNotReady=!0),this.layer&&this.layer.loaded||(t.layerNotLoaded=!0);const i=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return f(i)&&this.visibleAtCurrentScale||(t.outsideScaleRange=!0),this.visibleAtCurrentTimeExtent||(t.outsideVisibilityTimeExtent=!0),this.visible||(t.layerInvisible=!0),t}isUpdating(){return!1}getAttributionItems(){const t=h(this.layer);if(t)return[t];if(y(this.layer)&&(this._attributionIndexTask||(this._attributionIndexTask=e(async t=>{const e=await this.layer.fetchAttributionData();return o(t),c(e)}),this._updatingHandles.addPromise(this._attributionIndexTask.promise)),this._attributionIndexTask?.finished&&this._attributionIndexTask.value))return g(this._attributionIndexTask.value,this.layer.tileInfo,this.view.scale,this.view.extent);const i=m(this.layer);if(i)return[i];const r=b(this.layer);return r?[r]:[]}};t([u({readOnly:!0})],v.prototype,"spatialReferenceSupported",null),t([u()],v.prototype,"view",void 0),t([u({readOnly:!0})],v.prototype,"attributionItems",null),t([u({readOnly:!0})],v.prototype,"attributionUpdating",null),t([u()],v.prototype,"fullOpacity",null),t([u()],v.prototype,"layer",void 0),t([u()],v.prototype,"parent",void 0),t([u({readOnly:!0})],v.prototype,"suspended",null),t([u({readOnly:!0})],v.prototype,"suspendInfo",null),t([u({readOnly:!0})],v.prototype,"legendEnabled",null),t([u({type:Boolean,readOnly:!0})],v.prototype,"updating",null),t([u({readOnly:!0})],v.prototype,"updatingProgress",null),t([u()],v.prototype,"updateSuspended",null),t([u()],v.prototype,"visible",null),t([u({readOnly:!0})],v.prototype,"visibleAtCurrentScale",null),t([u({readOnly:!0})],v.prototype,"visibleAtCurrentTimeExtent",null),v=t([p("esri.views.layers.LayerView")],v);export{v as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import AttributionItem = __esri.AttributionItem;
4
+ export default AttributionItem;
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ class t{constructor(t,s){this.text=t,this.score=s}}export{t as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Logger.js";import{property as i,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/SpatialReference.js";import{toExtent as o}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as a}from"../../geometry/support/contains.js";import{GroundViewElevationSampler as s}from"./GroundViewElevationSampler.js";let l=class extends s{initialize(){this.view.basemapTerrain.on("elevation-change",()=>this.emit("changed",{}))}get demResolution(){return this.view.basemapTerrain.demResolution}get extent(){const e=this.view.basemapTerrain;if(null==e?.extent||null==e.spatialReference)return null;const t=o(e.extent,e.spatialReference);return t.zmin=e.visibleElevationBounds.min,t.zmax=e.visibleElevationBounds.max,t}get spatialReference(){return this.view.basemapTerrain?.spatialReference??r.WGS84}elevationAt(e,i){if(null==this.extent||!a(this.extent,e,i)){const n=null!=this.extent?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return t.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`),this.noDataValue}return this.view.elevationProvider?.getElevation(e,i,0,this.spatialReference,"ground")??this.noDataValue}};e([i({readOnly:!0})],l.prototype,"demResolution",null),e([i({readOnly:!0})],l.prototype,"extent",null),e([i()],l.prototype,"spatialReference",null),l=e([n("esri.views.support.GroundElevationSampler")],l);export{l as GroundElevationSampler};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Logger.js";import{property as i,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/SpatialReference.js";import{toExtent as o}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as a}from"../../geometry/support/contains.js";import{GroundViewElevationSampler as s}from"./GroundViewElevationSampler.js";let l=class extends s{initialize(){this.view.basemapTerrain.on("elevation-change",()=>this.emit("changed",{}))}get demResolution(){return this.view.basemapTerrain.demResolution}get extent(){const e=this.view.basemapTerrain;if(null==e?.extent||null==e.spatialReference)return null;const t=o(e.extent,e.spatialReference);return t.zmin=e.visibleElevationRange.minElevation,t.zmax=e.visibleElevationRange.maxElevation,t}get spatialReference(){return this.view.basemapTerrain?.spatialReference??r.WGS84}elevationAt(e,i){if(null==this.extent||!a(this.extent,e,i)){const n=null!=this.extent?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return t.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`),this.noDataValue}return this.view.elevationProvider?.getElevation(e,i,0,this.spatialReference,"ground")??this.noDataValue}};e([i({readOnly:!0})],l.prototype,"demResolution",null),e([i({readOnly:!0})],l.prototype,"extent",null),e([i()],l.prototype,"spatialReference",null),l=e([n("esri.views.support.GroundElevationSampler")],l);export{l as GroundElevationSampler};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import t from"../../core/Error.js";import i from"../../core/Logger.js";import{someMap as o}from"../../core/MapUtils.js";import{createResolver as s,createAbortError as a,isAbortError as n}from"../../core/promiseUtils.js";import{on as l,watch as y,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as p}from"../../core/scheduling.js";import{property as c,subclass as d}from"../../core/accessorSupport/decorators.js";import{get as w}from"../../core/accessorSupport/get.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{destroyMap as u}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as m}from"./LayerLayerViewInfo.js";function g(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let _=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new f,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=s(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(p(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,t=[],i=this.view.ready,o=e=>{if(null!=e)for(const s of e)if(s){if(!1===this.layerViewFilter?.(s))continue;r.add(s);const e=this._layerLayerViewInfoMap.get(s);e&&i?e.start():e||this._recyclingInfoMap.has(s)||t.push(s),"layers"in s&&s.layers&&o(s.layers)}};for(const n of this._rootCollectionNames)o(w(this,n));const s=new Array,a=e=>{const r=e.tryRecycle(t);r?(this._recyclingInfoMap.set(e.layer,e),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{n(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):s.push(e)};for(const n of this._layerLayerViewInfoMap.values())r.has(n.layer)||(this._layerLayerViewInfoMap.delete(n.layer),a(n));for(const n of this._recyclingInfoMap.values())r.has(n.layer)||(this._recyclingInfoMap.delete(n.layer),a(n));for(const n of t)this._createLayerView(n);this._refreshCollections(),s.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([l(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),y(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule(),h)]),this._preloadLayerViewModules(),this._reschedule()}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),u(this._recyclingInfoMap),u(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(a()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||o(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),u(this._layerLayerViewInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new t("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const t=this._layerLayerViewInfoMap.get(e);if(!t?.done)return!0;const i=t.layerView;return!(!i||!r||i.parent===r)||!!(t.done&&i&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,i))}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(w(this,e),w(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())w(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,t){if(!e||!r)return void r?.removeAll();let i=0;for(const o of e){const e=this._layerLayerViewInfoMap.get(o);if(!e?.layerView)continue;const{layerView:s}=e;s.layer=o,s.parent=t,r.at(i)!==s&&r.splice(i,0,s),"layers"in o&&g(s)&&this._populateLayerViewsOwners(o.layers,s.layerViews,s),++i}i<r.length&&r.splice(i)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new m(e,this.view,this.layerViewImporter);r.promise?.then(()=>this._refreshCollections(),r=>{r&&(n(r)||"cancelled:layerview-create"===r.name)||i.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],_.prototype,"_workPromise",void 0),e([c({readOnly:!0})],_.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],_.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],_.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],_.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],_.prototype,"layerViewFilter",void 0),e([c()],_.prototype,"layerViewImporter",void 0),e([c()],_.prototype,"supportsGround",void 0),e([c({readOnly:!0})],_.prototype,"updating",null),e([c({readOnly:!0})],_.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],_.prototype,"view",void 0),_=e([d("esri.views.support.LayerViewManager")],_);const V=_;export{V as default};
5
+ import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import t from"../../core/Error.js";import i from"../../core/Logger.js";import{someMap as o}from"../../core/MapUtils.js";import{createResolver as s,createAbortError as a,isAbortError as n}from"../../core/promiseUtils.js";import{on as l,watch as y,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as c}from"../../core/scheduling.js";import{property as p,subclass as d}from"../../core/accessorSupport/decorators.js";import{get as w}from"../../core/accessorSupport/get.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{destroyMap as u}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as m}from"./LayerLayerViewInfo.js";function g(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let _=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new f,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=s(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(c(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,t=[],i=this.view.ready,o=e=>{if(null!=e)for(const s of e)if(s){if(!1===this.layerViewFilter?.(s))continue;r.add(s);const e=this._layerLayerViewInfoMap.get(s);e&&i?e.start():e||this._recyclingInfoMap.has(s)||t.push(s),"layers"in s&&s.layers&&o(s.layers)}};for(const n of this._rootCollectionNames)o(w(this,n));const s=new Array,a=e=>{const r=e.tryRecycle(t);r?(this._recyclingInfoMap.set(e.layer,e),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{n(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):s.push(e)};for(const n of this._layerLayerViewInfoMap.values())r.has(n.layer)||(this._layerLayerViewInfoMap.delete(n.layer),a(n));for(const n of this._recyclingInfoMap.values())r.has(n.layer)||(this._recyclingInfoMap.delete(n.layer),a(n));for(const n of t)this._createLayerView(n);this._refreshCollections(),s.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([l(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),y(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule(),h)]),this._preloadLayerViewModules(),this._reschedule()}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),u(this._recyclingInfoMap),u(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(a()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||o(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),u(this._layerLayerViewInfoMap),u(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new t("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const t=this._layerLayerViewInfoMap.get(e);if(!t?.done)return!0;const i=t.layerView;return!(!i||!r||i.parent===r)||!!(t.done&&i&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,i))}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(w(this,e),w(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())w(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,t){if(!e||!r)return void r?.removeAll();let i=0;for(const o of e){const e=this._layerLayerViewInfoMap.get(o);if(!e?.layerView)continue;const{layerView:s}=e;s.layer=o,s.parent=t,r.at(i)!==s&&r.splice(i,0,s),"layers"in o&&g(s)&&this._populateLayerViewsOwners(o.layers,s.layerViews,s),++i}i<r.length&&r.splice(i)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new m(e,this.view,this.layerViewImporter);r.promise?.then(()=>this._refreshCollections(),r=>{r&&(n(r)||"cancelled:layerview-create"===r.name)||i.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([p()],_.prototype,"_workPromise",void 0),e([p({readOnly:!0})],_.prototype,"_watchUpdatingTracking",void 0),e([p({readOnly:!0})],_.prototype,"_layersToLayerViews",void 0),e([p({constructOnly:!0})],_.prototype,"layerviewMapping",void 0),e([p({readOnly:!0})],_.prototype,"_rootCollectionNames",null),e([p({constructOnly:!0})],_.prototype,"layerViewFilter",void 0),e([p()],_.prototype,"layerViewImporter",void 0),e([p()],_.prototype,"supportsGround",void 0),e([p({readOnly:!0})],_.prototype,"updating",null),e([p({readOnly:!0})],_.prototype,"updatingRemaining",null),e([p({constructOnly:!0})],_.prototype,"view",void 0),_=e([d("esri.views.support.LayerViewManager")],_);const V=_;export{V as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ import{equals as t}from"../../core/arrayUtils.js";import{isMultiOriginJSONMixin as o}from"../../core/multiOriginJSONSupportUtils.js";import{project as n}from"../../geometry/projectionUtils.js";import r from"../../geometry/SpatialReference.js";import{fromValues as e,containsXY as i}from"../../geometry/support/aaBoundingRect.js";import s from"./AttributionItem.js";const c=100;class a{constructor(t,o,n){this.index=t,this.bbox=o,this.score=n}}function u(t){const o=t.contributors,n={maxZoom:0,attributions:[]};if(!o)return n;for(const r of o){if(!r.coverageAreas?.length||!r.attribution)continue;const t=n.attributions.length;n.attributions.push(r.attribution);for(const o of r.coverageAreas){const r=o.bbox,i=new a(t,e(r[1],r[0],r[3],r[2]),o.score??100);for(let t=o.zoomMin;t<=o.zoomMax;t++)n[t]??=[],n[t].push(i)}}return n.maxZoom=Math.max.apply(null,Object.keys(n).map(t=>+t).filter(t=>Number.isFinite(t))),n}function l(t,o,e,c){let a=o?.scaleToZoom(e)??0;if(a=Math.min(t.maxZoom??0,Math.round(a)),!c||null==a||a<=-1)return[];const u=t[a],{x:l,y:f}=n(c.center.clone().normalize(),r.WGS84),m=new Set;return u?.filter(t=>{const o=!m.has(t.index)&&i(t.bbox,l,f);return o&&m.add(t.index),o}).map(o=>new s(t.attributions[o.index],o.score))??[]}function f(t){return p(t,"user")?new s(t.copyright,c):null}function m(t){return p(t)?new s(t.copyright,c):null}function p(t,n){return null!=t&&"object"==typeof t&&"copyright"in t&&"string"==typeof t.copyright&&t.copyright.length>0&&(!n||o(t)&&"user"===t.originOf("copyright"))}function b(t){return null!=t&&"object"==typeof t&&"hasAttributionData"in t&&!0===t.hasAttributionData&&"attributionDataUrl"in t&&"fetchAttributionData"in t&&"function"==typeof t.fetchAttributionData}function h(t){return null!=t&&"object"==typeof t&&"portalItem"in t&&null!=t.portalItem&&"object"==typeof t.portalItem&&"accessInformation"in t.portalItem&&"string"==typeof t.portalItem.accessInformation&&t.portalItem.accessInformation.length>0}function g(t){return h(t)?new s(t.portalItem.accessInformation,c):null}function y(o,n){const r=new globalThis.Map;for(const t of n){const o=r.get(t.text);o?t.score>o.score&&r.set(t.text,t):r.set(t.text,t)}const e=Array.from(r.values()).sort((t,o)=>o.score-t.score);return o&&t(o,e,(t,o)=>t.text===o.text)?o:e}export{u as createAttributionIndex,y as deduplicateAttributionItems,g as getAttributionItemFromAccessInformation,m as getAttributionItemFromLayerCopyright,f as getAttributionItemFromUserCopyright,l as getAttributionItemsFromIndex,b as isDynamicAttributionLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{createArea as e}from"../../core/quantity.js";import{geodesicAreas as r}from"../../geometry/geodesicUtils.js";import{geodesicMeasure as t}from"./geodesicMeasurementUtils.js";const s=e=>({geodesicArea(r){const{spatialReference:s}=r;return t(s,n,r=>a(e,r),r)}});async function o(){const e=await import("../../geometry/geometryEngine.js");return s(e)}function n(t){return e(Math.abs(r([t],"square-meters")[0]),"square-meters")}function a(r,t){try{return e(Math.abs(r.geodesicArea(t,"square-meters")),"square-meters")}catch(s){return null}}export{o as loadGeodesicAreaMeasurementUtils};
5
+ import{createArea as e}from"../../core/quantity.js";import{geodesicAreas as r}from"../../geometry/geodesicUtils.js";import{l as t,e as s}from"../../chunks/geodeticAreaOperator.js";import{isCurvedGeometry as o}from"../../geometry/support/curves/curveUtils.js";import{geodesicMeasure as a}from"./geodesicMeasurementUtils.js";const n=e=>({geodesicArea(r){const{spatialReference:t}=r,s=o(r);return a(t,s?m:u,s?m:r=>c(e,r),r)}});async function i(){const e=await import("../../geometry/geometryEngine.js");return await t(),n(e)}function u(t){return e(Math.abs(r([t],"square-meters")[0]),"square-meters")}function c(r,t){try{return e(Math.abs(r.geodesicArea(t,"square-meters")),"square-meters")}catch(s){return null}}function m(r){return e(s(r,{unit:"square-meters",curveType:"geodesic"}),"square-meters")}export{i as loadGeodesicAreaMeasurementUtils};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{createLength as e}from"../../core/quantity.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{inverseGeodeticSolver as r,InverseGeodeticSolverResult as n,geodesicLengths as s}from"../../geometry/geodesicUtils.js";import i from"../../geometry/Polyline.js";import{l as o,e as c}from"../../chunks/geodeticLengthOperator.js";import{equals as a}from"../../geometry/support/spatialReferenceUtils.js";import{geodesicMeasure as m}from"./geodesicMeasurementUtils.js";function u(e){const{spatialReference:t}=e;return m(t,j,h,e)}function f(e,t){if(!a(e.spatialReference,t.spatialReference))return null;const{spatialReference:r}=e;return x[0]=e.x,x[1]=e.y,x[2]=e.hasZ?e.z:0,U[0]=t.x,U[1]=t.y,U[2]=t.hasZ?t.z:0,p(x,U,r)}function p(e,t,r){return m(r,y,d,e,t,r)}const l={geodesicLength:u,geodesicDistanceBetweenPoints:f,geodesicDistance:p};async function g(){return await o(),l}function y(t,n,s){return e(r(w,t,n,s).distance,"meters")}function d(t,r,n){return e(c(R(t,r,n),{unit:"meters"}),"meters")}function j(t){return e(s([t],"meters")[0],"meters")}function h(t){return e(c(t,{unit:"meters"}),"meters")}function R(e,t,r){return new i({spatialReference:r,paths:[[[...e],[...t]]]})}const w=new n,x=t(),U=t();export{g as loadGeodesicLengthMeasurementUtils};
5
+ import{createLength as e}from"../../core/quantity.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{inverseGeodeticSolver as r,InverseGeodeticSolverResult as n,geodesicLengths as s}from"../../geometry/geodesicUtils.js";import o from"../../geometry/Polyline.js";import{l as i,e as c}from"../../chunks/geodeticLengthOperator.js";import{equals as m}from"../../geometry/support/spatialReferenceUtils.js";import{isCurvedGeometry as u}from"../../geometry/support/curves/curveUtils.js";import{geodesicMeasure as a}from"./geodesicMeasurementUtils.js";function f(e){const{spatialReference:t}=e,r=u(e);return a(t,r?R:h,R,e)}function p(e,t){if(!m(e.spatialReference,t.spatialReference))return null;const{spatialReference:r}=e;return U[0]=e.x,U[1]=e.y,U[2]=e.hasZ?e.z:0,v[0]=t.x,v[1]=t.y,v[2]=t.hasZ?t.z:0,l(U,v,r)}function l(e,t,r){return a(r,j,d,e,t,r)}const g={geodesicLength:f,geodesicDistanceBetweenPoints:p,geodesicDistance:l};async function y(){return await i(),g}function j(t,n,s){return e(r(x,t,n,s).distance,"meters")}function d(t,r,n){return e(c(w(t,r,n),{unit:"meters"}),"meters")}function h(t){return e(s([t],"meters")[0],"meters")}function R(t){return e(c(t,{unit:"meters"}),"meters")}function w(e,t,r){return new o({spatialReference:r,paths:[[[...e],[...t]]]})}const x=new n,U=t(),v=t();export{y as loadGeodesicLengthMeasurementUtils};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import{property as t,subclass as r}from"../../../core/accessorSupport/decorators.js";import s from"../DefaultUI.js";let e=class extends s{constructor(o){super(o),this.components=["attribution","zoom"]}};o([t()],e.prototype,"components",void 0),e=o([r("esri.views.ui.2d.DefaultUI2D")],e);const i=e;export{i as default};
5
+ import{__decorate as o}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import r from"../DefaultUI.js";let e=class extends r{constructor(o){super(o),this.components=["zoom"]}};o([t()],e.prototype,"components",void 0),e=o([s("esri.views.ui.2d.DefaultUI2D")],e);const p=e;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import r from"../DefaultUI.js";let e=class extends r{constructor(o){super(o),this.components=["attribution","zoom","navigation-toggle","compass"]}};o([t()],e.prototype,"components",void 0),e=o([s("esri.views.ui.3d.DefaultUI3D")],e);const i=e;export{i as default};
5
+ import{__decorate as o}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import e from"../DefaultUI.js";let r=class extends e{constructor(o){super(o),this.components=["zoom","navigation-toggle","compass"]}};o([t()],r.prototype,"components",void 0),r=o([s("esri.views.ui.3d.DefaultUI3D")],r);const p=r;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import{result as i}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{watch as r,on as n,when as o}from"../../core/reactiveUtils.js";import{property as a,subclass as h}from"../../core/accessorSupport/decorators.js";import{getDynamicAttribution as l,createContributorIndex as d}from"../../layers/support/attributionUtils.js";import{getLyr3DWasm as u}from"../../views/3d/layers/Lyr3DWasm.js";function c(t,e){return t&&"copyright"in t&&(!e||"function"==typeof t.originOf&&"user"===t.originOf("copyright"))}function p(t,e){return t.length!==e.length||t.some((t,i)=>t.text!==e[i].text)}function f(t,e,i){if(!i||!e)return;t.find(t=>t.layerView===e&&t.text===i)||t.push({text:i,layerView:e})}const m=[];let y=class extends e{constructor(t){super(t),this._clear=()=>{this._fetchedAttributionData.clear(),this._pendingAttributions.clear(),this.removeHandles("suspension"),this.notifyChange("state")},this._pendingAttributions=new Set,this._fetchedAttributionData=new Map,this.items=new s,this.view=null,this._allLayerViewsChange=t=>{this.removeHandles("suspension"),this.removeHandles("visible-geometry-changed");const e=this.view?.allLayerViews;e&&(this.addHandles(e.map(t=>r(()=>[t.suspended,t.layer?.attributionVisible],()=>this._updateAttributionItems())).toArray(),"suspension"),e.forEach(t=>{"esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D"===t.declaredClass&&this.addHandles(t.on("visible-geometry-changed",()=>this._updateAttributionItems()),"visible-geometry-changed")})),t?.removed&&t.removed.forEach(t=>{this._pendingAttributions.delete(t),this._fetchedAttributionData.delete(t)}),this._updateAttributionItems()},this.addHandles([n(()=>this.view?.allLayerViews,"change",t=>this._allLayerViewsChange(t),{onListenerAdd:()=>this._allLayerViewsChange(),onListenerRemove:this._clear}),o(()=>!0===this.view?.stationary,()=>this._updateAttributionItems())])}destroy(){this.view=null,this._fetchedAttributionData.clear(),this._pendingAttributions.clear(),this.items.removeAll()}get state(){return this.view?.ready?this._pendingAttributions.size>0?"loading":"ready":"disabled"}_updateAttributionItems(){const t=this.view,e=t?.allLayerViews;m.length=0;let i=!1,s=null;if(!t||!e)return void this._clear();e.forEach(e=>{if(e.suspended||!e.layer?.attributionVisible)return;const r=e.layer;if(c(r,"user"))return void f(m,e,r.copyright);if("integrated-mesh-3dtiles"===r.type&&r.hasGoogleUrl&&(i=!0,s=e),r.hasAttributionData){if(this._fetchedAttributionData.has(e)){const i=this._fetchedAttributionData.get(e);return void(i?f(m,e,l(i,r.tileInfo,t.scale,t.extent)):c(r)&&f(m,e,r.copyright))}return void this._fetchAttributionData(e)}const n="portalItem"in r?r.portalItem?.accessInformation:void 0;f(m,e,n||r.copyright)});const r=e.find(t=>"integrated-mesh-3dtiles"===t.layer?.type);if(this.view&&r){const t=u(this.view);if(t){const e=t.getAttributionText();for(let t=e.length-1;t>-1;--t)m.unshift({text:e[t],layerView:r})}}i&&s&&m.unshift({text:"Google Maps",layerView:s}),p(this.items,m)&&(this.items.removeAll(),this.items.addMany(m)),m.length=0,this.notifyChange("state")}async _fetchAttributionData(t){if(this._pendingAttributions.has(t))return;this._pendingAttributions.add(t);const e=await i(t.layer.fetchAttributionData().then(t=>d(t)));this._pendingAttributions.has(t)&&(this._pendingAttributions.delete(t),this._fetchedAttributionData.set(t,e.ok?e.value:null)),this._updateAttributionItems()}};t([a({readOnly:!0,type:s})],y.prototype,"items",void 0),t([a({readOnly:!0})],y.prototype,"state",null),t([a()],y.prototype,"view",void 0),y=t([h("esri.widgets.Attribution.AttributionViewModel")],y);const g=y;export{g as default};
5
+ import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import i from"../../core/Collection.js";import{watch as s,when as o,on as r}from"../../core/reactiveUtils.js";import{property as n,subclass as a}from"../../core/accessorSupport/decorators.js";import{getLyr3DWasm as l}from"../../views/3d/layers/Lyr3DWasm.js";function d(t,e){return t.length!==e.length||t.some((t,i)=>t.text!==e[i].text)}function h(t,e,i){if(!i||!e)return;t.find(t=>t.layerView===e&&t.text===i)||t.push({text:i,layerView:e})}const m=Symbol("attributions");let u=class extends e{constructor(t){super(t),this._clear=()=>{this.removeHandles(m)},this.items=new i,this.view=null,this._allLayerViewsChange=()=>{this.removeHandles(m);const t=this.view?.allLayerViews;let e=!1;if(t){for(const i of t)this.addHandles(s(()=>[i.attributionItems],()=>this._updateAttributionItems()),m),"type"in i&&"integrated-mesh-3dtiles"===i.type&&(e=!0,this.addHandles([s(()=>i.suspended,()=>this._updateAttributionItems()),i.on("visible-geometry-changed",()=>this._updateAttributionItems())],m));e&&this.addHandles(o(()=>!0===this.view?.stationary,()=>this._updateAttributionItems()),m)}this._updateAttributionItems()},this.addHandles([r(()=>this.view?.allLayerViews,"change",this._allLayerViewsChange,{onListenerAdd:this._allLayerViewsChange,onListenerRemove:this._clear})])}destroy(){this.view=null,this.items.removeAll()}get state(){return this.view?.ready?this.view.allLayerViews.some(t=>t.attributionUpdating)?"loading":"ready":"disabled"}_updateAttributionItems(){const t=this.view,e=t?.allLayerViews,i=[];let s=!1,o=null,r=null;if(t&&e){for(const t of e){if(t.suspended)continue;"type"in t&&"integrated-mesh-3dtiles"===t.type&&(r||=t,t.layer.hasGoogleUrl&&(s=!0,o=t));const e=t.attributionItems.slice().sort((t,e)=>e.score-t.score).map(t=>t.text).join(", ");h(i,t,e)}if(r){const e=l(t);if(e){const t=e.getAttributionText();for(let e=t.length-1;e>-1;--e)i.unshift({text:t[e],layerView:r})}}s&&o&&i.unshift({text:"Google Maps",layerView:o}),d(this.items,i)&&(this.items.removeAll(),this.items.addMany(i))}else this._clear()}};t([n({readOnly:!0,type:i})],u.prototype,"items",void 0),t([n({readOnly:!0})],u.prototype,"state",null),t([n()],u.prototype,"view",void 0),u=t([a("esri.widgets.Attribution.AttributionViewModel")],u);const c=u;export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{on as t}from"../core/reactiveUtils.js";import{property as i,subclass as r}from"../core/accessorSupport/decorators.js";import s from"./Widget.js";import o from"./Attribution/AttributionViewModel.js";import{globalCss as n}from"./support/globalCss.js";import{messageBundle as l,accessibleHandler as h,tsx as a}from"./support/widget.js";const c="esri-attribution",d={base:c,poweredBy:`${c}__powered-by`,sources:`${c}__sources`,open:`${c}--open`,sourcesOpen:`${c}__sources--open`,link:`${c}__link`};let u=class extends s{constructor(e,t){super(e,t),this._isOpen=!1,this._attributionTextOverflowed=!1,this._prevSourceNodeHeight=0,this._sourcesNode=null,this._overflowRequestAnimationFrame=null,this._resizeObserver=new ResizeObserver(e=>{e.forEach(({target:e})=>{this._scheduleOverflowCheck(e)})}),this._mutationObserver=new MutationObserver(e=>{let t=!1;for(const i of e)if("childList"===i.type||"characterData"===i.type||"attributes"===i.type){t=!0;break}t&&this._sourcesNode&&this._scheduleOverflowCheck(this._sourcesNode)}),this.itemDelimiter=" | ",this.messages=null,this.viewModel=new o}initialize(){this.addHandles(t(()=>this.viewModel?.items,"change",()=>this.scheduleRender()))}destroy(){this._resizeObserver?.disconnect(),this._mutationObserver?.disconnect(),null!=this._overflowRequestAnimationFrame&&(cancelAnimationFrame(this._overflowRequestAnimationFrame),this._overflowRequestAnimationFrame=null)}get _isInteractive(){return this._isOpen||this._attributionTextOverflowed}_scheduleOverflowCheck(e){null==this._overflowRequestAnimationFrame&&(this._overflowRequestAnimationFrame=requestAnimationFrame(()=>{this._overflowRequestAnimationFrame=null,this._checkSourceTextOverflow(e)}))}get attributionText(){return this.viewModel.items.reduce((e,t)=>(e.includes(t.text)||e.push(t.text),e),[]).join(this.itemDelimiter)}get icon(){return"description"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e={[d.open]:this._isOpen};return a("div",{bind:this,class:this.classes(d.base,n.widget,e),dir:"ltr",onclick:this._toggleState,onkeydown:this._toggleState},this._renderSourcesNode(),this._renderPoweredBy())}_renderPoweredBy(){return a("div",{class:d.poweredBy},"Powered by"," ",a("a",{class:d.link,href:"https://www.esri.com/",rel:"noreferrer",target:"_blank"},"Esri"))}_renderSourcesNode(){const e=this._isOpen,t=this._isInteractive,i=t?0:void 0,{attributionText:r}=this,s={[d.sourcesOpen]:e,[n.interactive]:t};return a("div",{afterCreate:this._afterSourcesNodeCreate,bind:this,class:this.classes(d.sources,s),innerHTML:r,tabIndex:i})}_afterSourcesNodeCreate(e){this._prevSourceNodeHeight=e.clientWidth,this._sourcesNode=e,this._resizeObserver.observe(e),this._mutationObserver.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),this._scheduleOverflowCheck(e)}_checkSourceTextOverflow(e){let t=!1;const{clientHeight:i,clientWidth:r,scrollWidth:s}=e,o=s>r,n=this._attributionTextOverflowed!==o;if(this._attributionTextOverflowed=o,n&&(t=!0),this._isOpen){const e=i<this._prevSourceNodeHeight;this._prevSourceNodeHeight=i,e&&(this._isOpen=!1,t=!0)}t&&this.scheduleRender()}_toggleState(){this._isInteractive&&(this._isOpen=!this._isOpen)}};e([i()],u.prototype,"_isOpen",void 0),e([i()],u.prototype,"_isInteractive",null),e([i()],u.prototype,"_attributionTextOverflowed",void 0),e([i()],u.prototype,"_prevSourceNodeHeight",void 0),e([i({readOnly:!0,dependsOn:["viewModel.items.length","itemDelimiter"]})],u.prototype,"attributionText",null),e([i()],u.prototype,"icon",null),e([i()],u.prototype,"itemDelimiter",void 0),e([i()],u.prototype,"label",null),e([i(),l("esri/widgets/Attribution/t9n/Attribution")],u.prototype,"messages",void 0),e([i()],u.prototype,"view",null),e([i({type:o})],u.prototype,"viewModel",void 0),e([h()],u.prototype,"_toggleState",null),u=e([r("esri.widgets.Attribution")],u);const p=u;export{p as default};
5
+ import{__decorate as e}from"tslib";import{deprecated as t}from"../core/deprecate.js";import has from"../core/has.js";import i from"../core/Logger.js";import{on as r}from"../core/reactiveUtils.js";import{property as s,subclass as o}from"../core/accessorSupport/decorators.js";import n from"./Widget.js";import l from"./Attribution/AttributionViewModel.js";import{globalCss as a}from"./support/globalCss.js";import{messageBundle as c,accessibleHandler as d,tsx as h}from"./support/widget.js";const u="esri-attribution",p={base:u,poweredBy:`${u}__powered-by`,sources:`${u}__sources`,open:`${u}--open`,sourcesOpen:`${u}__sources--open`,link:`${u}__link`};let _=class extends n{constructor(e,r){super(e,r),this._isOpen=!1,this._attributionTextOverflowed=!1,this._prevSourceNodeHeight=0,this._sourcesNode=null,this._overflowRequestAnimationFrame=null,this._resizeObserver=new ResizeObserver(e=>{e.forEach(({target:e})=>{this._scheduleOverflowCheck(e)})}),this._mutationObserver=new MutationObserver(e=>{let t=!1;for(const i of e)if("childList"===i.type||"characterData"===i.type||"attributes"===i.type){t=!0;break}t&&this._sourcesNode&&this._scheduleOverflowCheck(this._sourcesNode)}),this.itemDelimiter=" | ",this.messages=null,this.viewModel=new l,has("esri-deprecation-warnings")&&t(i.getLogger("esri.widgets.Attribution"),"This widget is deprecated. Use View.attributionVisible and View.attributionItems instead.",{replacement:"view.attributionVisible and view.attributionItems",warnOnce:!0})}initialize(){this.addHandles(r(()=>this.viewModel?.items,"change",()=>this.scheduleRender()))}destroy(){this._resizeObserver?.disconnect(),this._mutationObserver?.disconnect(),null!=this._overflowRequestAnimationFrame&&(cancelAnimationFrame(this._overflowRequestAnimationFrame),this._overflowRequestAnimationFrame=null)}get _isInteractive(){return this._isOpen||this._attributionTextOverflowed}_scheduleOverflowCheck(e){null==this._overflowRequestAnimationFrame&&(this._overflowRequestAnimationFrame=requestAnimationFrame(()=>{this._overflowRequestAnimationFrame=null,this._checkSourceTextOverflow(e)}))}get attributionText(){return this.viewModel.items.reduce((e,t)=>(e.includes(t.text)||e.push(t.text),e),[]).join(this.itemDelimiter)}get icon(){return"description"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e={[p.open]:this._isOpen};return h("div",{bind:this,class:this.classes(p.base,a.widget,e),dir:"ltr",onclick:this._toggleState,onkeydown:this._toggleState},this._renderSourcesNode(),this._renderPoweredBy())}_renderPoweredBy(){return h("div",{class:p.poweredBy},"Powered by"," ",h("a",{class:p.link,href:"https://www.esri.com/",rel:"noreferrer",target:"_blank"},"Esri"))}_renderSourcesNode(){const e=this._isOpen,t=this._isInteractive,i=t?0:void 0,{attributionText:r}=this,s={[p.sourcesOpen]:e,[a.interactive]:t};return h("div",{afterCreate:this._afterSourcesNodeCreate,bind:this,class:this.classes(p.sources,s),innerHTML:r,tabIndex:i})}_afterSourcesNodeCreate(e){this._prevSourceNodeHeight=e.clientWidth,this._sourcesNode=e,this._resizeObserver.observe(e),this._mutationObserver.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),this._scheduleOverflowCheck(e)}_checkSourceTextOverflow(e){let t=!1;const{clientHeight:i,clientWidth:r,scrollWidth:s}=e,o=s>r,n=this._attributionTextOverflowed!==o;if(this._attributionTextOverflowed=o,n&&(t=!0),this._isOpen){const e=i<this._prevSourceNodeHeight;this._prevSourceNodeHeight=i,e&&(this._isOpen=!1,t=!0)}t&&this.scheduleRender()}_toggleState(){this._isInteractive&&(this._isOpen=!this._isOpen)}};e([s()],_.prototype,"_isOpen",void 0),e([s()],_.prototype,"_isInteractive",null),e([s()],_.prototype,"_attributionTextOverflowed",void 0),e([s()],_.prototype,"_prevSourceNodeHeight",void 0),e([s({readOnly:!0,dependsOn:["viewModel.items.length","itemDelimiter"]})],_.prototype,"attributionText",null),e([s()],_.prototype,"icon",null),e([s()],_.prototype,"itemDelimiter",void 0),e([s()],_.prototype,"label",null),e([s(),c("esri/widgets/Attribution/t9n/Attribution")],_.prototype,"messages",void 0),e([s()],_.prototype,"view",null),e([s({type:l})],_.prototype,"viewModel",void 0),e([d()],_.prototype,"_toggleState",null),_=e([o("esri.widgets.Attribution")],_);const v=_;export{v as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../Color.js";import{EventedAccessor as i}from"../../core/Evented.js";import{handlesGroup as o}from"../../core/handleUtils.js";import{memoize as r}from"../../core/memoize.js";import{watch as s,syncAndInitial as l,sync as n}from"../../core/reactiveUtils.js";import{generateUUID as p}from"../../core/uuid.js";import{property as u,subclass as a}from"../../core/accessorSupport/decorators.js";import h from"../../geometry/Point.js";import{getConfig as m}from"./support/constants.js";import{binaryFindClosest as d}from"./support/profileUtils.js";import{convertSamples as c,convertStatistics as v}from"./support/unitUtils.js";let f=class extends i{constructor(t){super(t),this.type=null,this.id=p(),this.title=null,this.color=new e("#000000"),this.visible=!0,this._getSamplesMemoized=r((t,e)=>c(t,e)),this._getStatisticsMemoized=r((t,e)=>v(t,e)),this.viewVisualizationEnabled=!0,this.result=null,this.effectiveUnits=null,this.numSamplesForPreview=30,this.numSamplesPerChunk=200,this.chartFillEnabled=!0,this.chartStrokeWidth=1.5,this.chartStrokeOffsetY=0,this._viewModel=null}get progress(){return null!=this.result&&this.visible?this.result.progress:0}get samples(){return this._getSamplesMemoized(this.result,this.effectiveUnits)}get statistics(){return this._getStatisticsMemoized(this.result,this.effectiveUnits)}get hoveredPoint(){const t=this._viewModel?.hoveredChartPosition;return null!=t?this._getPoint(t):null}get available(){return!0}get hasZ(){const t=this.result;return null!=t&&t.hasZ}get minDemResolution(){return m().defaultDemResolution}queryElevation(){throw new Error("not implemented")}attach(t){return this._viewModel=t,o([s(()=>t.effectiveUnits,t=>{this.effectiveUnits=t},l),s(()=>[t.input],()=>this._onChange(),n)])}toggleVisibility(t){this.visible=void 0===t?!this.visible:t}_onChange(){this.emit("change")}_getPoint(t){const{samples:e,result:i}=this;if(null==e||null==i)return null;const o=e.length;if(0===o)return null;const r=e[o-1].distance,s=d(e,t*r,t=>t.distance);if(null==s)return null;const{x:l,y:n,z:p}=s;return null==p?null:new h({x:l,y:n,z:p,spatialReference:i.spatialReference})}};t([u({nonNullable:!0})],f.prototype,"id",void 0),t([u()],f.prototype,"title",void 0),t([u({type:e,nonNullable:!0})],f.prototype,"color",void 0),t([u({nonNullable:!0})],f.prototype,"visible",void 0),t([u({readOnly:!0})],f.prototype,"progress",null),t([u({readOnly:!0})],f.prototype,"samples",null),t([u({readOnly:!0})],f.prototype,"statistics",null),t([u()],f.prototype,"hoveredPoint",null),t([u()],f.prototype,"viewVisualizationEnabled",void 0),t([u()],f.prototype,"available",null),t([u()],f.prototype,"result",void 0),t([u()],f.prototype,"effectiveUnits",void 0),t([u()],f.prototype,"numSamplesForPreview",void 0),t([u()],f.prototype,"numSamplesPerChunk",void 0),t([u()],f.prototype,"chartFillEnabled",void 0),t([u()],f.prototype,"chartStrokeWidth",void 0),t([u()],f.prototype,"chartStrokeOffsetY",void 0),t([u({readOnly:!0})],f.prototype,"hasZ",null),t([u({readOnly:!0})],f.prototype,"minDemResolution",null),t([u()],f.prototype,"_viewModel",void 0),f=t([a("esri.widgets.ElevationProfile.ElevationProfileLine")],f);const y=f;export{y as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Color.js";import{deprecated as o,esriurl as i}from"../../core/deprecate.js";import{EventedAccessor as r}from"../../core/Evented.js";import{handlesGroup as s}from"../../core/handleUtils.js";import has from"../../core/has.js";import l from"../../core/Logger.js";import{memoize as n}from"../../core/memoize.js";import{watch as p,syncAndInitial as a,sync as u}from"../../core/reactiveUtils.js";import{generateUUID as m}from"../../core/uuid.js";import{property as c,subclass as h}from"../../core/accessorSupport/decorators.js";import d from"../../geometry/Point.js";import{getConfig as f}from"./support/constants.js";import{binaryFindClosest as v}from"./support/profileUtils.js";import{convertSamples as y,convertStatistics as g}from"./support/unitUtils.js";let b=class extends r{constructor(e){super(e),this.type=null,this.id=m(),this.title=null,this.color=new t("#000000"),this.visible=!0,this._getSamplesMemoized=n((e,t)=>y(e,t)),this._getStatisticsMemoized=n((e,t)=>g(e,t)),this.viewVisualizationEnabled=!0,this.result=null,this.effectiveUnits=null,this.numSamplesForPreview=30,this.numSamplesPerChunk=200,this.chartFillEnabled=!0,this.chartStrokeWidth=1.5,this.chartStrokeOffsetY=0,this._viewModel=null,has("esri-deprecation-warnings")&&!e?.isDefaultLine&&o(l.getLogger(this),"This class is deprecated. Use the Elevation Profile component or the elevation profile analysis directly instead.",{see:[`Elevation Profile component reference: ${i}arcgis-elevation-profile/`,`Esri's move to web components: ${i}components-transition-plan/`],replacement:"ElevationProfileAnalysis or <arcgis-elevation-profile></arcgis-elevation-profile>",warnOnce:!0})}normalizeCtorArgs(e){const{isDefaultLine:t,...o}=e??{};return o}get progress(){return null!=this.result&&this.visible?this.result.progress:0}get samples(){return this._getSamplesMemoized(this.result,this.effectiveUnits)}get statistics(){return this._getStatisticsMemoized(this.result,this.effectiveUnits)}get hoveredPoint(){const e=this._viewModel?.hoveredChartPosition;return null!=e?this._getPoint(e):null}get available(){return!0}get hasZ(){const e=this.result;return null!=e&&e.hasZ}get minDemResolution(){return f().defaultDemResolution}queryElevation(){throw new Error("not implemented")}attach(e){return this._viewModel=e,s([p(()=>e.effectiveUnits,e=>{this.effectiveUnits=e},a),p(()=>[e.input],()=>this._onChange(),u)])}toggleVisibility(e){this.visible=void 0===e?!this.visible:e}_onChange(){this.emit("change")}_getPoint(e){const{samples:t,result:o}=this;if(null==t||null==o)return null;const i=t.length;if(0===i)return null;const r=t[i-1].distance,s=v(t,e*r,e=>e.distance);if(null==s)return null;const{x:l,y:n,z:p}=s;return null==p?null:new d({x:l,y:n,z:p,spatialReference:o.spatialReference})}};e([c({nonNullable:!0})],b.prototype,"id",void 0),e([c()],b.prototype,"title",void 0),e([c({type:t,nonNullable:!0})],b.prototype,"color",void 0),e([c({nonNullable:!0})],b.prototype,"visible",void 0),e([c({readOnly:!0})],b.prototype,"progress",null),e([c({readOnly:!0})],b.prototype,"samples",null),e([c({readOnly:!0})],b.prototype,"statistics",null),e([c()],b.prototype,"hoveredPoint",null),e([c()],b.prototype,"viewVisualizationEnabled",void 0),e([c()],b.prototype,"available",null),e([c()],b.prototype,"result",void 0),e([c()],b.prototype,"effectiveUnits",void 0),e([c()],b.prototype,"numSamplesForPreview",void 0),e([c()],b.prototype,"numSamplesPerChunk",void 0),e([c()],b.prototype,"chartFillEnabled",void 0),e([c()],b.prototype,"chartStrokeWidth",void 0),e([c()],b.prototype,"chartStrokeOffsetY",void 0),e([c({readOnly:!0})],b.prototype,"hasZ",null),e([c({readOnly:!0})],b.prototype,"minDemResolution",null),e([c()],b.prototype,"_viewModel",void 0),b=e([h("esri.widgets.ElevationProfile.ElevationProfileLine")],b);const w=b;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../Graphic.js";import i from"../../core/Accessor.js";import{isSome as r,min as o}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import{referenceSetter as l}from"../../core/collectionUtils.js";import n from"../../core/Logger.js";import{LRUCache as u}from"../../core/LRUCache.js";import{destroyMaybe as a}from"../../core/maybe.js";import{memoize as p}from"../../core/memoize.js";import{watch as h,syncAndInitial as c}from"../../core/reactiveUtils.js";import{adaptiveLengthUnit as d,adaptiveVerticalLengthUnit as f,measurementLengthUnits as m}from"../../core/units.js";import{property as v,subclass as y}from"../../core/accessorSupport/decorators.js";import{ElevationQueryTileCache as g}from"../../layers/support/ElevationQueryTileCache.js";import{defaultUnitPropertyMetadata as b}from"../../properties/defaultUnit.js";import{ElevationProfileController as _}from"./ElevationProfileController.js";import U from"./ElevationProfileLineGround.js";import{ElevationProfileLineCollection as P}from"./elevationProfileLineTypes.js";import{ElevationProfileTool as w}from"./ElevationProfileTool.js";import{isPolyline as j,isValidInputPath as O}from"./support/geometryUtils.js";import{isProfileGenerationError as C}from"./support/ProfileGenerationError.js";import{createProfileQueue as E}from"./support/profileUtils.js";import{getBoundsInMeters as S,mergeStatistics as T}from"./support/statisticsUtils.js";let L=class extends i{constructor(t){super(t),this.view=null,this.input=null,this._getEffectiveUnitsMemoized=p((t,e)=>({distance:t,elevation:e})),this.hoveredChartPosition=null,this.uniformChartScaling=!1,this.defaultUnit=null,this.queue=null,this._currentTileCache=null,this.error=null,this._defaultProfileLineGround=new U,this._userUnitOptions=null,this._userUnit=null,t?.profiles||(this.profiles=new s([this._defaultProfileLineGround]))}initialize(){this.addHandles(h(()=>this.view,t=>{if(null==t)return void n.getLogger(this).warnOnce("no view. Widget will be disabled until a view is provided.");this.removeHandles(D);const e="3d"===t.type?t.resourceController:void 0;this.queue?.destroy(),this.queue=E(e?.scheduler);const i=e?.addUpdatingObject(this);i&&this.addHandles(i,D)},c)),this.tool=new w({viewModel:this}),this._controller=new _({viewModel:this})}destroy(){this._defaultProfileLineGround=a(this._defaultProfileLineGround),this._controller=a(this._controller),this._currentTileCache=a(this._currentTileCache),this.tool=a(this.tool),this.queue=a(this.queue)}get profiles(){return this._get("profiles")}set profiles(t){const e=this._get("profiles"),i=t??new s;this._set("profiles",l(i,e))}get state(){const t=this.view;return null!=t&&t.ready?this.tool.state:"disabled"}get progress(){let t=0,e=0;for(const i of this.visibleProfiles)t++,e+=i.progress;return t>0?e/t:0}set unitOptions(t){this._userUnitOptions=t,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(t){this._userUnit=t?this._findSelectableUnit(t,this._userUnit):null,this.notifyChange("unit")}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}get effectiveUnits(){const t=S(this.visibleProfiles.map(t=>t.result)),e=d(t.maxDistance,"meters",this.unit),i=f(t.maxElevation,"meters",this.unit);return this._getEffectiveUnitsMemoized(e,i)}get highlightEnabled(){return this.tool.highlightEnabled}set highlightEnabled(t){this.tool.highlightEnabled=t}get hasVertices(){const t=this.input?.geometry;return j(t)&&t.paths.reduce((t,e)=>t+e.length,0)>0}get hoveredPoints(){return null!=this.input&&this.visible&&this.tool.editable?this.visibleProfiles.map(t=>{const e=t.hoveredPoint;return null!=e?{hoveredPoint:e,color:t.color}:null}).filter(r):[]}get statistics(){return T(this.visibleProfiles.map(t=>t.statistics))}get chartData(){if(null==this.input)return null;const{effectiveUnits:t,progress:e,statistics:i,visibleProfiles:r,uniformChartScaling:o}=this,s=r.filter(t=>t.hasZ).map(t=>({id:t.id,type:t.type,title:t.title,color:t.color,samples:t.samples,progress:t.progress,chartFillEnabled:t.chartFillEnabled,chartStrokeWidth:t.chartStrokeWidth,chartStrokeOffsetY:t.chartStrokeOffsetY,viewVisualizationEnabled:t.viewVisualizationEnabled}));return 0===s.length?null:{lines:s,effectiveUnits:t,statistics:i,refined:1===e,dynamicElevationRange:r.some(t=>"view"===t.type),uniformScaling:o}}get visibleProfiles(){return this.profiles.toArray().filter(t=>t.available&&t.visible)}get minDemResolutions(){const t=[];for(const{minDemResolution:e}of this.visibleProfiles)null!=e&&t.push(e);return t}get minDemResolution(){return o(this.minDemResolutions)}get errorState(){const t=this.input?.geometry;if(!O(t))return"no-valid-input";if(null!=this.error){if(C(this.error))switch(this.error.cause){case"too-complex":return"too-complex";case"invalid-geometry":return"invalid-geometry";case"invalid-elevation-info":return"invalid-elevation-info";case"elevation-query-error":return"no-valid-input"}return"unknown-error"}return 0===this.visibleProfiles.length?"no-visible-profiles":null==this.chartData&&1===this.progress?"refined-but-no-chart-data":"none"}get tileCache(){this._currentTileCache=a(this._currentTileCache);const t=this.view;if(null!=t&&"3d"===t?.type){const e=t.basemapTerrain?.elevationQueryCache;if(null!=e)return e}return null==this._currentTileCache&&(this._currentTileCache=new g(new u(20971520))),this._currentTileCache}get visible(){return this.tool.visible}set visible(t){this.tool.visible=t}get selectAvailable(){for(const t of this.view?.map?.allLayers??[]){if("graphics"===t.type&&!t.internal&&t.graphics.some(t=>"polyline"===t.geometry?.type))return!0;if("geometryType"in t&&"polyline"===t.geometryType)return!0}return!!this.view?.graphics?.some(t=>"polyline"===t.geometry?.type)}get inputIsSketched(){return this.tool.interaction.isSketchedGraphic(this.input)}get elevationProvider(){const t=this.view;return null!=t&&"3d"===t.type?t.elevationProvider:null}get updating(){const{progress:t}=this,e=!!this.queue?.updating;return t>0&&t<1||e}start(t){this.tool.interaction.start(t)}stop(){this.tool.interaction.stop()}cancel(){this.tool.interaction.cancel()}clear(){this.tool.interaction.clear()}_findSelectableUnit(t,e){const i=this.unitOptions;return null!=t&&i.includes(t)?t:e?this._findSelectableUnit(e):i[0]}_filteredOrAllUnits(t){const e=(null!=t?t:[]).filter(t=>m.includes(t));return 0===e.length?m.slice():e}};t([v()],L.prototype,"view",void 0),t([v({type:e})],L.prototype,"input",void 0),t([v({type:P,nonNullable:!0})],L.prototype,"profiles",null),t([v({readOnly:!0})],L.prototype,"state",null),t([v({readOnly:!0})],L.prototype,"progress",null),t([v()],L.prototype,"unitOptions",null),t([v()],L.prototype,"unit",null),t([v({readOnly:!0})],L.prototype,"effectiveUnits",null),t([v()],L.prototype,"hoveredChartPosition",void 0),t([v()],L.prototype,"uniformChartScaling",void 0),t([v()],L.prototype,"highlightEnabled",null),t([v({readOnly:!0})],L.prototype,"hoveredPoints",null),t([v({readOnly:!0})],L.prototype,"statistics",null),t([v()],L.prototype,"chartData",null),t([v()],L.prototype,"visibleProfiles",null),t([v()],L.prototype,"minDemResolutions",null),t([v({readOnly:!0})],L.prototype,"minDemResolution",null),t([v({readOnly:!0})],L.prototype,"errorState",null),t([v(b)],L.prototype,"defaultUnit",void 0),t([v()],L.prototype,"queue",void 0),t([v()],L.prototype,"tileCache",null),t([v()],L.prototype,"tool",void 0),t([v()],L.prototype,"visible",null),t([v()],L.prototype,"error",void 0),t([v()],L.prototype,"selectAvailable",null),t([v()],L.prototype,"inputIsSketched",null),t([v()],L.prototype,"elevationProvider",null),t([v()],L.prototype,"updating",null),t([v()],L.prototype,"_defaultProfileLineGround",void 0),t([v()],L.prototype,"_userUnitOptions",void 0),t([v()],L.prototype,"_controller",void 0),t([v()],L.prototype,"_userUnit",void 0),L=t([y("esri.widgets.ElevationProfile.ElevationProfileViewModel")],L);const D=Symbol("updating-object"),G=L;export{G as default};
5
+ import{__decorate as t}from"tslib";import e from"../../Graphic.js";import i from"../../core/Accessor.js";import{isSome as r,min as o}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import{referenceSetter as l}from"../../core/collectionUtils.js";import{deprecateUnnecessaryViewModel as n}from"../../core/deprecate.js";import u from"../../core/Logger.js";import{LRUCache as a}from"../../core/LRUCache.js";import{destroyMaybe as p}from"../../core/maybe.js";import{memoize as h}from"../../core/memoize.js";import{watch as c,syncAndInitial as d}from"../../core/reactiveUtils.js";import{adaptiveLengthUnit as f,adaptiveVerticalLengthUnit as m,measurementLengthUnits as v}from"../../core/units.js";import{property as g,subclass as y}from"../../core/accessorSupport/decorators.js";import{ElevationQueryTileCache as b}from"../../layers/support/ElevationQueryTileCache.js";import{defaultUnitPropertyMetadata as _}from"../../properties/defaultUnit.js";import{ElevationProfileController as U}from"./ElevationProfileController.js";import P from"./ElevationProfileLineGround.js";import{ElevationProfileLineCollection as w}from"./elevationProfileLineTypes.js";import{ElevationProfileTool as j}from"./ElevationProfileTool.js";import{isPolyline as O,isValidInputPath as C}from"./support/geometryUtils.js";import{isProfileGenerationError as E}from"./support/ProfileGenerationError.js";import{createProfileQueue as S}from"./support/profileUtils.js";import{getBoundsInMeters as T,mergeStatistics as D}from"./support/statisticsUtils.js";let L=class extends i{constructor(t){super(t),this.view=null,this.input=null,this._getEffectiveUnitsMemoized=h((t,e)=>({distance:t,elevation:e})),this.hoveredChartPosition=null,this.uniformChartScaling=!1,this.defaultUnit=null,this.queue=null,this._currentTileCache=null,this.error=null,this._defaultProfileLineGround=new P({isDefaultLine:!0}),this._userUnitOptions=null,this._userUnit=null,t?.isDefaultViewModel||n(u.getLogger(this),"Elevation Profile","arcgis-elevation-profile",{version:"5.0"}),t?.profiles||(this.profiles=new s([this._defaultProfileLineGround]))}normalizeCtorArgs(t){const{isDefaultViewModel:e,...i}=t??{};return i}initialize(){this.addHandles(c(()=>this.view,t=>{if(null==t)return void u.getLogger(this).warnOnce("no view. Widget will be disabled until a view is provided.");this.removeHandles(G);const e="3d"===t.type?t.resourceController:void 0;this.queue?.destroy(),this.queue=S(e?.scheduler);const i=e?.addUpdatingObject(this);i&&this.addHandles(i,G)},d)),this.tool=new j({viewModel:this}),this._controller=new U({viewModel:this})}destroy(){this._defaultProfileLineGround=p(this._defaultProfileLineGround),this._controller=p(this._controller),this._currentTileCache=p(this._currentTileCache),this.tool=p(this.tool),this.queue=p(this.queue)}get profiles(){return this._get("profiles")}set profiles(t){const e=this._get("profiles"),i=t??new s;this._set("profiles",l(i,e))}get state(){const t=this.view;return null!=t&&t.ready?this.tool.state:"disabled"}get progress(){let t=0,e=0;for(const i of this.visibleProfiles)t++,e+=i.progress;return t>0?e/t:0}set unitOptions(t){this._userUnitOptions=t,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(t){this._userUnit=t?this._findSelectableUnit(t,this._userUnit):null,this.notifyChange("unit")}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}get effectiveUnits(){const t=T(this.visibleProfiles.map(t=>t.result)),e=f(t.maxDistance,"meters",this.unit),i=m(t.maxElevation,"meters",this.unit);return this._getEffectiveUnitsMemoized(e,i)}get highlightEnabled(){return this.tool.highlightEnabled}set highlightEnabled(t){this.tool.highlightEnabled=t}get hasVertices(){const t=this.input?.geometry;return O(t)&&t.paths.reduce((t,e)=>t+e.length,0)>0}get hoveredPoints(){return null!=this.input&&this.visible&&this.tool.editable?this.visibleProfiles.map(t=>{const e=t.hoveredPoint;return null!=e?{hoveredPoint:e,color:t.color}:null}).filter(r):[]}get statistics(){return D(this.visibleProfiles.map(t=>t.statistics))}get chartData(){if(null==this.input)return null;const{effectiveUnits:t,progress:e,statistics:i,visibleProfiles:r,uniformChartScaling:o}=this,s=r.filter(t=>t.hasZ).map(t=>({id:t.id,type:t.type,title:t.title,color:t.color,samples:t.samples,progress:t.progress,chartFillEnabled:t.chartFillEnabled,chartStrokeWidth:t.chartStrokeWidth,chartStrokeOffsetY:t.chartStrokeOffsetY,viewVisualizationEnabled:t.viewVisualizationEnabled}));return 0===s.length?null:{lines:s,effectiveUnits:t,statistics:i,refined:1===e,dynamicElevationRange:r.some(t=>"view"===t.type),uniformScaling:o}}get visibleProfiles(){return this.profiles.toArray().filter(t=>t.available&&t.visible)}get minDemResolutions(){const t=[];for(const{minDemResolution:e}of this.visibleProfiles)null!=e&&t.push(e);return t}get minDemResolution(){return o(this.minDemResolutions)}get errorState(){const t=this.input?.geometry;if(!C(t))return"no-valid-input";if(null!=this.error){if(E(this.error))switch(this.error.cause){case"too-complex":return"too-complex";case"invalid-geometry":return"invalid-geometry";case"invalid-elevation-info":return"invalid-elevation-info";case"elevation-query-error":return"no-valid-input"}return"unknown-error"}return 0===this.visibleProfiles.length?"no-visible-profiles":null==this.chartData&&1===this.progress?"refined-but-no-chart-data":"none"}get tileCache(){this._currentTileCache=p(this._currentTileCache);const t=this.view;if(null!=t&&"3d"===t?.type){const e=t.basemapTerrain?.elevationQueryCache;if(null!=e)return e}return null==this._currentTileCache&&(this._currentTileCache=new b(new a(20971520))),this._currentTileCache}get visible(){return this.tool.visible}set visible(t){this.tool.visible=t}get selectAvailable(){for(const t of this.view?.map?.allLayers??[]){if("graphics"===t.type&&!t.internal&&t.graphics.some(t=>"polyline"===t.geometry?.type))return!0;if("geometryType"in t&&"polyline"===t.geometryType)return!0}return!!this.view?.graphics?.some(t=>"polyline"===t.geometry?.type)}get inputIsSketched(){return this.tool.interaction.isSketchedGraphic(this.input)}get elevationProvider(){const t=this.view;return null!=t&&"3d"===t.type?t.elevationProvider:null}get updating(){const{progress:t}=this,e=!!this.queue?.updating;return t>0&&t<1||e}start(t){this.tool.interaction.start(t)}stop(){this.tool.interaction.stop()}cancel(){this.tool.interaction.cancel()}clear(){this.tool.interaction.clear()}_findSelectableUnit(t,e){const i=this.unitOptions;return null!=t&&i.includes(t)?t:e?this._findSelectableUnit(e):i[0]}_filteredOrAllUnits(t){const e=(null!=t?t:[]).filter(t=>v.includes(t));return 0===e.length?v.slice():e}};t([g()],L.prototype,"view",void 0),t([g({type:e})],L.prototype,"input",void 0),t([g({type:w,nonNullable:!0})],L.prototype,"profiles",null),t([g({readOnly:!0})],L.prototype,"state",null),t([g({readOnly:!0})],L.prototype,"progress",null),t([g()],L.prototype,"unitOptions",null),t([g()],L.prototype,"unit",null),t([g({readOnly:!0})],L.prototype,"effectiveUnits",null),t([g()],L.prototype,"hoveredChartPosition",void 0),t([g()],L.prototype,"uniformChartScaling",void 0),t([g()],L.prototype,"highlightEnabled",null),t([g({readOnly:!0})],L.prototype,"hoveredPoints",null),t([g({readOnly:!0})],L.prototype,"statistics",null),t([g()],L.prototype,"chartData",null),t([g()],L.prototype,"visibleProfiles",null),t([g()],L.prototype,"minDemResolutions",null),t([g({readOnly:!0})],L.prototype,"minDemResolution",null),t([g({readOnly:!0})],L.prototype,"errorState",null),t([g(_)],L.prototype,"defaultUnit",void 0),t([g()],L.prototype,"queue",void 0),t([g()],L.prototype,"tileCache",null),t([g()],L.prototype,"tool",void 0),t([g()],L.prototype,"visible",null),t([g()],L.prototype,"error",void 0),t([g()],L.prototype,"selectAvailable",null),t([g()],L.prototype,"inputIsSketched",null),t([g()],L.prototype,"elevationProvider",null),t([g()],L.prototype,"updating",null),t([g()],L.prototype,"_defaultProfileLineGround",void 0),t([g()],L.prototype,"_userUnitOptions",void 0),t([g()],L.prototype,"_controller",void 0),t([g()],L.prototype,"_userUnit",void 0),L=t([y("esri.widgets.ElevationProfile.ElevationProfileViewModel")],L);const G=Symbol("updating-object"),k=L;export{k as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{createTask as e}from"../core/asyncUtils.js";import{abortMaybe as i,destroyMaybe as s}from"../core/maybe.js";import{memoize as n}from"../core/memoize.js";import{throwIfAborted as r,createAbortError as o}from"../core/promiseUtils.js";import{watch as a,initial as l}from"../core/reactiveUtils.js";import{property as c,subclass as h}from"../core/accessorSupport/decorators.js";import d from"./Widget.js";import{css as p}from"./ElevationProfile/css.js";import u from"./ElevationProfile/ElevationProfileViewModel.js";import m from"./ElevationProfile/ElevationProfileVisibleElements.js";import{Legend as _}from"./ElevationProfile/components/Legend.js";import{SettingsButton as v}from"./ElevationProfile/components/SettingsButton.js";import{getConfig as C}from"./ElevationProfile/support/constants.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as f}from"./support/globalCss.js";import{messageBundle as y,tsx as b,tsxFragment as w}from"./support/widget.js";const k=[{type:"select"},{type:"sketch"}],M={none:null,"no-valid-input":"noProfile","no-visible-profiles":"noProfile","refined-but-no-chart-data":"noProfile","too-complex":"tooComplex","unknown-error":"unknown","invalid-geometry":"invalidGeometry","invalid-elevation-info":"invalidElevationInfo"};let B=class extends d{constructor(t,e){super(t,e),this.viewModel=null,this.visibleElements=new m,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this._chartContainer=null,this._chart=null,this._chartInitTask=null,this._chartIsRefined=!1,this._zoomOutButtonVisible=!1,this._getChartUpdateParamsMemoized=n((t,e,i,s)=>({chart:t,data:e,stationary:i,messages:s})),this._onZoomOutButtonClick=()=>{this._chart?.zoomOut()},this._onClearButtonClick=()=>{this.viewModel.clear()},t?.viewModel||(this._defaultViewModel=new u({view:t?.view}),this.viewModel=this._defaultViewModel)}loadDependencies(){return g({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}postInitialize(){this.addHandles([a(()=>({container:this._chartContainer}),({container:t})=>{this._destroyChart(),null!=t&&this._initializeChart(t)},l),a(()=>this._chartUpdateParams,()=>this._updateChart(this._chartUpdateParams),l)])}destroy(){this._destroyChart(),null!=this._defaultViewModel&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get input(){return this.viewModel.input}set input(t){this.viewModel.input=t}get profiles(){return this.viewModel.profiles}set profiles(t){this.viewModel.profiles=t}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(t){this.viewModel.unitOptions=t}get unit(){return this.viewModel.unit}set unit(t){this.viewModel.unit=t}get icon(){return"altitude"}set icon(t){this._overrideIfSome("icon",t)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}get test(){return{chart:this._chart}}get _selectButtonVisible(){return!0===this.visibleElements.selectButton&&this.viewModel.selectAvailable}get _chartUpdateParams(){const t=this.view;return this._getChartUpdateParamsMemoized(this._chart,this.viewModel.chartData,null==t||t.stationary,this._chartMessages)}get _chartMessages(){return{...this.messagesUnits,...this.messages}}get _profilesArray(){return this.profiles.toArray()}render(){const{viewModel:t,visible:e}=this;return b("div",{"aria-label":this.messages.widgetLabel,class:this.classes({[p.base]:e,[f.widget]:e,[f.panel]:e,[f.widgetDisabled]:e&&"disabled"===t.state,[p.refined]:1===t.progress}),key:this},b("div",{bind:this,key:"content-wrapper"},e?this._renderContentForState():null))}_renderContentForState(){switch(this.viewModel.state){case"ready":case"disabled":return this._renderContentForReadyState();case"selecting":return this._renderContentForSelectingState();case"creating":return this._renderContentForCreatingState();case"selected":return this._renderContentForSelectedState();case"created":return this._renderContentForCreatedState()}}_renderContentForReadyState(){const{messages:t,visibleElements:e,_selectButtonVisible:i}=this,{sketchButton:s}=e;let n;return n=s&&i?t.readyPrompt:s?t.readyPromptCreateOnly:i?t.readyPromptSelectOnly:t.errors?.noProfile,this._renderContent({prompt:n,chart:!1,actions:k})}_renderContentForSelectingState(){const{view:t}=this;if(null==t)return null;const e=this.messages[`selectingPrompt-${t.type}`];return this._renderContent({prompt:e,chart:!1,actions:[{type:"select-cancel"}]})}_renderContentForCreatingState(){const{view:t,viewModel:e}=this;if(null==t)return null;const i=e.hasVertices?[{type:"sketch-cancel"},{type:"sketch-done",disabled:!e.tool.interaction.canStopCreating}]:[{type:"select"},{type:"sketch",disabled:!0}];if("no-valid-input"===e.errorState){const e=this.messages[`creatingPrompt-${t.type}`];return this._renderContent({chart:!1,actions:i,prompt:e})}const s=this._getErrorMessage();return s?this._renderContent({chart:!1,actions:i,prompt:s}):this._renderContent({chart:!0,actions:i})}_renderContentForSelectedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:k,prompt:t}):this._renderContent({chart:!0,actions:k})}_renderContentForCreatedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:k,prompt:t}):this._renderContent({chart:!0,actions:k})}_getErrorMessage(){const t=M[this.viewModel.errorState];return t?this.messages?.errors?.[t]:null}_renderContent(t){const e=null!=t.prompt?this._renderPrompt(t.prompt):t.chart&&this._renderChart(),{viewModel:i}=this,s=null!=i.input;return b(w,null,b("header",{class:p.header,key:"header"},this._zoomOutButtonVisible?this._renderZoomOutButton():null,this.visibleElements.clearButton&&s?this._renderClearButton():null,this.visibleElements.settingsButton?b(v,{messages:this.messages,uniformChartScaling:i.uniformChartScaling,unit:i.unit,unitOptions:i.unitOptions,visibleElements:this.visibleElements,onUniformChartScalingChange:t=>i.uniformChartScaling=t,onUnitChange:t=>i.unit=t}):null),b("div",{class:p.mainContainer,key:"main-container"},e),this.visibleElements.legend?b(_,{effectiveUnits:i.effectiveUnits,messages:this.messages,profiles:this._profilesArray}):null,this._renderActions(t))}_renderZoomOutButton(){const t=this.messages.zoomOut;return b("calcite-action",{appearance:"transparent",class:p.zoomOutButton,"data-testid":"zoom-out-button",icon:"magnifying-glass-minus",key:"zoom-out",onclick:this._onZoomOutButtonClick,scale:"s",text:t,title:t})}_renderClearButton(){const t=this.messages.clearProfile;return b("calcite-action",{appearance:"transparent",class:p.clearButton,"data-testid":"clear-button",icon:"trash",key:"clear-profile",onclick:this._onClearButtonClick,scale:"s",text:t,title:t})}_renderPrompt(t){return[b("div",{bind:this,class:p.promptContainer,key:"prompt-container"},b("p",null,t))]}_renderChart(){if(!this.visibleElements.chart)return b("div",{class:p.chartContainer,key:"empty-chart-container"});const{chartData:t,progress:e}=this.viewModel,i=this._chartIsRefined||this._canRenderChart(),s=null!=t&&e<1;return i?b(w,null,this._renderSpinner({size:i?"small":"large",visible:s}),b("div",{afterCreate:this._onChartContainerUpdate,afterRemoved:this._onChartContainerRemoved,afterUpdate:this._onChartContainerUpdate,bind:this,class:p.chartContainer,key:"chart-container"})):b(w,null,this._renderSpinner({size:"large",visible:s}),b("div",{class:p.chartContainer,key:"chart-container-empty"}))}_renderSpinner(t){const e="small"===t.size,i=t.visible??!0;return b("calcite-loader",{class:this.classes(p.chartSpinner,e&&p.chartSpinnerSmall,i&&p.chartSpinnerVisible),"data-testid":"chart-spinner",inline:e,key:"spinner",label:"",scale:"s"})}_canRenderChart(){const t=this.viewModel.chartData;if(null==t)return!1;if(!this.viewModel.inputIsSketched)return t.refined;let e=0;for(const{samples:i}of t.lines)e+=null!=i?i.length:0;return t.refined||e<=C().largeChartSamples}_renderActions({actions:t}){const e=t.map(t=>{switch(t.type){case"sketch":return this.visibleElements.sketchButton&&this._renderAction({action:t,className:p.sketchButton,label:this.messages.sketchButtonLabel,onClick:this._onSketchButtonClick,primary:!0});case"sketch-cancel":return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:p.sketchCancelButton,label:this.messagesCommon.cancel,primary:!1});case"sketch-done":return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onDoneButtonClick,className:p.sketchDoneButton,label:this.messagesCommon.done,primary:!0});case"select":return this._selectButtonVisible&&this._renderAction({action:t,onClick:this._onSelectButtonClick,className:p.selectButton,label:this.messages.selectButtonLabel,primary:!1});case"select-cancel":return this._selectButtonVisible&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:p.selectCancelButton,label:this.messagesCommon.cancel,primary:!1})}}).filter(Boolean);return e.length?b("footer",{class:p.footer,key:"footer"},e):null}_renderAction({action:t,className:e,label:i,onClick:s,primary:n}){return b("calcite-button",{appearance:n?"solid":"outline-fill",bind:this,class:this.classes(p.actionButton,e),disabled:t.disabled,key:`action-${t.type}`,onclick:s},i)}_onSketchButtonClick(){this.viewModel.start({mode:"sketch"})}_onSelectButtonClick(){this.viewModel.start({mode:"select"})}_onCancelButtonClick(){this.viewModel.cancel()}_onDoneButtonClick(){this.viewModel.stop()}_updateChart(t){const{data:e,chart:i,messages:s,stationary:n}=t;null!=i&&null!=s&&n&&this._canRenderChart()&&(i.update(t),this._chartIsRefined=null!=e&&e.refined)}_onChartContainerUpdate(t){this._chartContainer=t}_onChartContainerRemoved(t){this._chartContainer===t&&(this._chartContainer=null)}_initializeChart(t){i(this._chartInitTask),this._chartInitTask=e(async e=>{const{createChart:i}=await import("./ElevationProfile/support/chartUtils.js");r(e);const n=await i({container:t,abortOptions:{signal:e},onRangeChange:(t,e)=>{this._zoomOutButtonVisible=1!==t||1!==e},onCursorPositionChange:t=>{this.viewModel.hoveredChartPosition=t}});if(e.aborted)throw s(n),o();this._chart=n,this._updateChart(this._chartUpdateParams)})}_destroyChart(){this._chartInitTask=i(this._chartInitTask),this._chart=s(this._chart),this._chartIsRefined=!1}};t([c({type:u})],B.prototype,"viewModel",void 0),t([c()],B.prototype,"view",null),t([c()],B.prototype,"input",null),t([c()],B.prototype,"profiles",null),t([c()],B.prototype,"unitOptions",null),t([c()],B.prototype,"unit",null),t([c({type:m,nonNullable:!0})],B.prototype,"visibleElements",void 0),t([c()],B.prototype,"icon",null),t([c()],B.prototype,"label",null),t([c()],B.prototype,"visible",null),t([c(),y("esri/widgets/ElevationProfile/t9n/ElevationProfile")],B.prototype,"messages",void 0),t([c(),y("esri/t9n/common")],B.prototype,"messagesCommon",void 0),t([c(),y("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),t([c()],B.prototype,"_chartContainer",void 0),t([c()],B.prototype,"_chart",void 0),t([c()],B.prototype,"_chartInitTask",void 0),t([c()],B.prototype,"_chartIsRefined",void 0),t([c()],B.prototype,"_zoomOutButtonVisible",void 0),t([c()],B.prototype,"_selectButtonVisible",null),t([c()],B.prototype,"_chartUpdateParams",null),t([c()],B.prototype,"_chartMessages",null),t([c()],B.prototype,"_profilesArray",null),B=t([h("esri.widgets.ElevationProfile")],B);const S=B;export{S as default};
5
+ import{__decorate as t}from"tslib";import{createTask as e}from"../core/asyncUtils.js";import{deprecateWidget as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{abortMaybe as n,destroyMaybe as r}from"../core/maybe.js";import{memoize as o}from"../core/memoize.js";import{throwIfAborted as a,createAbortError as l}from"../core/promiseUtils.js";import{watch as c,initial as h}from"../core/reactiveUtils.js";import{property as d,subclass as p}from"../core/accessorSupport/decorators.js";import u from"./Widget.js";import{css as m}from"./ElevationProfile/css.js";import _ from"./ElevationProfile/ElevationProfileViewModel.js";import v from"./ElevationProfile/ElevationProfileVisibleElements.js";import{Legend as C}from"./ElevationProfile/components/Legend.js";import{SettingsButton as g}from"./ElevationProfile/components/SettingsButton.js";import{getConfig as f}from"./ElevationProfile/support/constants.js";import{loadCalciteComponents as y}from"./support/componentsUtils.js";import{globalCss as b}from"./support/globalCss.js";import{messageBundle as w,tsx as k,tsxFragment as M}from"./support/widget.js";const B=[{type:"select"},{type:"sketch"}],S={none:null,"no-valid-input":"noProfile","no-visible-profiles":"noProfile","refined-but-no-chart-data":"noProfile","too-complex":"tooComplex","unknown-error":"unknown","invalid-geometry":"invalidGeometry","invalid-elevation-info":"invalidElevationInfo"};let P=class extends u{constructor(t,e){super(t,e),this.viewModel=null,this.visibleElements=new v,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this._chartContainer=null,this._chart=null,this._chartInitTask=null,this._chartIsRefined=!1,this._zoomOutButtonVisible=!1,this._getChartUpdateParamsMemoized=o((t,e,i,s)=>({chart:t,data:e,stationary:i,messages:s})),this._onZoomOutButtonClick=()=>{this._chart?.zoomOut()},this._onClearButtonClick=()=>{this.viewModel.clear()},i(s.getLogger(this),"Elevation Profile","arcgis-elevation-profile",{version:"5.0"}),t?.viewModel||(this._defaultViewModel=new _({view:t?.view,isDefaultViewModel:!0}),this.viewModel=this._defaultViewModel)}loadDependencies(){return y({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}postInitialize(){this.addHandles([c(()=>({container:this._chartContainer}),({container:t})=>{this._destroyChart(),null!=t&&this._initializeChart(t)},h),c(()=>this._chartUpdateParams,()=>this._updateChart(this._chartUpdateParams),h)])}destroy(){this._destroyChart(),null!=this._defaultViewModel&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get input(){return this.viewModel.input}set input(t){this.viewModel.input=t}get profiles(){return this.viewModel.profiles}set profiles(t){this.viewModel.profiles=t}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(t){this.viewModel.unitOptions=t}get unit(){return this.viewModel.unit}set unit(t){this.viewModel.unit=t}get icon(){return"altitude"}set icon(t){this._overrideIfSome("icon",t)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}get test(){return{chart:this._chart}}get _selectButtonVisible(){return!0===this.visibleElements.selectButton&&this.viewModel.selectAvailable}get _chartUpdateParams(){const t=this.view;return this._getChartUpdateParamsMemoized(this._chart,this.viewModel.chartData,null==t||t.stationary,this._chartMessages)}get _chartMessages(){return{...this.messagesUnits,...this.messages}}get _profilesArray(){return this.profiles.toArray()}render(){const{viewModel:t,visible:e}=this;return k("div",{"aria-label":this.messages.widgetLabel,class:this.classes({[m.base]:e,[b.widget]:e,[b.panel]:e,[b.widgetDisabled]:e&&"disabled"===t.state,[m.refined]:1===t.progress}),key:this},k("div",{bind:this,key:"content-wrapper"},e?this._renderContentForState():null))}_renderContentForState(){switch(this.viewModel.state){case"ready":case"disabled":return this._renderContentForReadyState();case"selecting":return this._renderContentForSelectingState();case"creating":return this._renderContentForCreatingState();case"selected":return this._renderContentForSelectedState();case"created":return this._renderContentForCreatedState()}}_renderContentForReadyState(){const{messages:t,visibleElements:e,_selectButtonVisible:i}=this,{sketchButton:s}=e;let n;return n=s&&i?t.readyPrompt:s?t.readyPromptCreateOnly:i?t.readyPromptSelectOnly:t.errors?.noProfile,this._renderContent({prompt:n,chart:!1,actions:B})}_renderContentForSelectingState(){const{view:t}=this;if(null==t)return null;const e=this.messages[`selectingPrompt-${t.type}`];return this._renderContent({prompt:e,chart:!1,actions:[{type:"select-cancel"}]})}_renderContentForCreatingState(){const{view:t,viewModel:e}=this;if(null==t)return null;const i=e.hasVertices?[{type:"sketch-cancel"},{type:"sketch-done",disabled:!e.tool.interaction.canStopCreating}]:[{type:"select"},{type:"sketch",disabled:!0}];if("no-valid-input"===e.errorState){const e=this.messages[`creatingPrompt-${t.type}`];return this._renderContent({chart:!1,actions:i,prompt:e})}const s=this._getErrorMessage();return s?this._renderContent({chart:!1,actions:i,prompt:s}):this._renderContent({chart:!0,actions:i})}_renderContentForSelectedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:B,prompt:t}):this._renderContent({chart:!0,actions:B})}_renderContentForCreatedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:B,prompt:t}):this._renderContent({chart:!0,actions:B})}_getErrorMessage(){const t=S[this.viewModel.errorState];return t?this.messages?.errors?.[t]:null}_renderContent(t){const e=null!=t.prompt?this._renderPrompt(t.prompt):t.chart&&this._renderChart(),{viewModel:i}=this,s=null!=i.input;return k(M,null,k("header",{class:m.header,key:"header"},this._zoomOutButtonVisible?this._renderZoomOutButton():null,this.visibleElements.clearButton&&s?this._renderClearButton():null,this.visibleElements.settingsButton?k(g,{messages:this.messages,uniformChartScaling:i.uniformChartScaling,unit:i.unit,unitOptions:i.unitOptions,visibleElements:this.visibleElements,onUniformChartScalingChange:t=>i.uniformChartScaling=t,onUnitChange:t=>i.unit=t}):null),k("div",{class:m.mainContainer,key:"main-container"},e),this.visibleElements.legend?k(C,{effectiveUnits:i.effectiveUnits,messages:this.messages,profiles:this._profilesArray}):null,this._renderActions(t))}_renderZoomOutButton(){const t=this.messages.zoomOut;return k("calcite-action",{appearance:"transparent",class:m.zoomOutButton,"data-testid":"zoom-out-button",icon:"magnifying-glass-minus",key:"zoom-out",onclick:this._onZoomOutButtonClick,scale:"s",text:t,title:t})}_renderClearButton(){const t=this.messages.clearProfile;return k("calcite-action",{appearance:"transparent",class:m.clearButton,"data-testid":"clear-button",icon:"trash",key:"clear-profile",onclick:this._onClearButtonClick,scale:"s",text:t,title:t})}_renderPrompt(t){return[k("div",{bind:this,class:m.promptContainer,key:"prompt-container"},k("p",null,t))]}_renderChart(){if(!this.visibleElements.chart)return k("div",{class:m.chartContainer,key:"empty-chart-container"});const{chartData:t,progress:e}=this.viewModel,i=this._chartIsRefined||this._canRenderChart(),s=null!=t&&e<1;return i?k(M,null,this._renderSpinner({size:i?"small":"large",visible:s}),k("div",{afterCreate:this._onChartContainerUpdate,afterRemoved:this._onChartContainerRemoved,afterUpdate:this._onChartContainerUpdate,bind:this,class:m.chartContainer,key:"chart-container"})):k(M,null,this._renderSpinner({size:"large",visible:s}),k("div",{class:m.chartContainer,key:"chart-container-empty"}))}_renderSpinner(t){const e="small"===t.size,i=t.visible??!0;return k("calcite-loader",{class:this.classes(m.chartSpinner,e&&m.chartSpinnerSmall,i&&m.chartSpinnerVisible),"data-testid":"chart-spinner",inline:e,key:"spinner",label:"",scale:"s"})}_canRenderChart(){const t=this.viewModel.chartData;if(null==t)return!1;if(!this.viewModel.inputIsSketched)return t.refined;let e=0;for(const{samples:i}of t.lines)e+=null!=i?i.length:0;return t.refined||e<=f().largeChartSamples}_renderActions({actions:t}){const e=t.map(t=>{switch(t.type){case"sketch":return this.visibleElements.sketchButton&&this._renderAction({action:t,className:m.sketchButton,label:this.messages.sketchButtonLabel,onClick:this._onSketchButtonClick,primary:!0});case"sketch-cancel":return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:m.sketchCancelButton,label:this.messagesCommon.cancel,primary:!1});case"sketch-done":return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onDoneButtonClick,className:m.sketchDoneButton,label:this.messagesCommon.done,primary:!0});case"select":return this._selectButtonVisible&&this._renderAction({action:t,onClick:this._onSelectButtonClick,className:m.selectButton,label:this.messages.selectButtonLabel,primary:!1});case"select-cancel":return this._selectButtonVisible&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:m.selectCancelButton,label:this.messagesCommon.cancel,primary:!1})}}).filter(Boolean);return e.length?k("footer",{class:m.footer,key:"footer"},e):null}_renderAction({action:t,className:e,label:i,onClick:s,primary:n}){return k("calcite-button",{appearance:n?"solid":"outline-fill",bind:this,class:this.classes(m.actionButton,e),disabled:t.disabled,key:`action-${t.type}`,onclick:s},i)}_onSketchButtonClick(){this.viewModel.start({mode:"sketch"})}_onSelectButtonClick(){this.viewModel.start({mode:"select"})}_onCancelButtonClick(){this.viewModel.cancel()}_onDoneButtonClick(){this.viewModel.stop()}_updateChart(t){const{data:e,chart:i,messages:s,stationary:n}=t;null!=i&&null!=s&&n&&this._canRenderChart()&&(i.update(t),this._chartIsRefined=null!=e&&e.refined)}_onChartContainerUpdate(t){this._chartContainer=t}_onChartContainerRemoved(t){this._chartContainer===t&&(this._chartContainer=null)}_initializeChart(t){n(this._chartInitTask),this._chartInitTask=e(async e=>{const{createChart:i}=await import("./ElevationProfile/support/chartUtils.js");a(e);const s=await i({container:t,abortOptions:{signal:e},onRangeChange:(t,e)=>{this._zoomOutButtonVisible=1!==t||1!==e},onCursorPositionChange:t=>{this.viewModel.hoveredChartPosition=t}});if(e.aborted)throw r(s),l();this._chart=s,this._updateChart(this._chartUpdateParams)})}_destroyChart(){this._chartInitTask=n(this._chartInitTask),this._chart=r(this._chart),this._chartIsRefined=!1}};t([d({type:_})],P.prototype,"viewModel",void 0),t([d()],P.prototype,"view",null),t([d()],P.prototype,"input",null),t([d()],P.prototype,"profiles",null),t([d()],P.prototype,"unitOptions",null),t([d()],P.prototype,"unit",null),t([d({type:v,nonNullable:!0})],P.prototype,"visibleElements",void 0),t([d()],P.prototype,"icon",null),t([d()],P.prototype,"label",null),t([d()],P.prototype,"visible",null),t([d(),w("esri/widgets/ElevationProfile/t9n/ElevationProfile")],P.prototype,"messages",void 0),t([d(),w("esri/t9n/common")],P.prototype,"messagesCommon",void 0),t([d(),w("esri/core/t9n/Units")],P.prototype,"messagesUnits",void 0),t([d()],P.prototype,"_chartContainer",void 0),t([d()],P.prototype,"_chart",void 0),t([d()],P.prototype,"_chartInitTask",void 0),t([d()],P.prototype,"_chartIsRefined",void 0),t([d()],P.prototype,"_zoomOutButtonVisible",void 0),t([d()],P.prototype,"_selectButtonVisible",null),t([d()],P.prototype,"_chartUpdateParams",null),t([d()],P.prototype,"_chartMessages",null),t([d()],P.prototype,"_profilesArray",null),P=t([p("esri.widgets.ElevationProfile")],P);const E=P;export{E as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Map.js";import{rotate as i}from"../../../arcade/geometry/operators.js";import r from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{isAbortError as l}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as h,initial as d}from"../../../core/reactiveUtils.js";import{property as g,subclass as p}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import u from"../../../geometry/Point.js";import y from"../../../geometry/Polygon.js";import v from"../../../geometry/SpatialReference.js";import{e as f}from"../../../chunks/intersectionOperator.js";import{g as _}from"../../../chunks/proximityOperator.js";import w from"../../../layers/GraphicsLayer.js";import R from"../../../layers/ImageryTileLayer.js";import x from"../../../layers/support/RasterFunction.js";import{convolutionKernel as C}from"../../../layers/support/rasterFunctionConstants.js";import I from"../../../layers/support/TileInfo.js";import b from"../../../views/MapView.js";import{getResolutionToScaleFactor as j}from"../../../views/2d/viewpointUtils.js";import{castImageSource as M,logAndThrow as P,getMissingPropertyErrorName as k,getMissingPropertyErrorMessage as H}from"../utils.js";const S={click:"click-handle",enhancements:"enhancements-handle"};let V=class extends a{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new w({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageSource=null,this.imageRotation=0,this.navigationManager=null,this.navigationViewModel=null,this.state="ready",this.updatingHandles=new c,this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createImageHandles=()=>{this.removeHandles(S.enhancements),this.addHandles(m(()=>[this.brightness,this.contrast,this.sharpness],([e,t,i])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,i))},h))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,r=r=>{if(!(e&&t&&r.targetGeometry&&e.serviceRasterInfo))return r;const{extent:a}=e.serviceRasterInfo,{constraints:s,rotation:o,width:n,height:l}=t,{extent:m}=i(y.fromExtent(a),o,a.center.x,a.center.y),{width:h,height:d}=m,g=r.targetGeometry.clone(),p=s.scaleToZoom(r.scale),c=1/2**p,u=n/l;let v=c*h,f=c*d;p&&(h/n>d/l?f=v/u:v=f*u);const w=m.clone();return w.xmin+=v/2,w.xmax-=v/2,w.ymin+=f/2,w.ymax-=f/2,r.targetGeometry=_(y.fromExtent(w),g).coordinate,this.state="image-loaded",r};return{constrain:r,applyPanConstraint:r}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(m(()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:r,height:a,rotation:s}=this.imageRenderer,{extent:o}=i(y.fromExtent(t),s,t.center.x,t.center.y),{width:n,height:l}=o;return Math.max(n/r,l/a)},e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:i,spatialReference:r}=this.imageRenderer,a=t.minScale,s=j(r),o=.25*s,n=s*e;let l=n;const m=[];for(;l>o;)m.push(l),l/=2;m.push(l);const{lods:h}=I.create({scales:m});if(t.set({minScale:n,lods:h}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(i-a)<=1e-6?n:i},h),"resize")},this._loadImageInternal=(e,t={})=>{this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0;const i="string"==typeof e,r=i?void 0:e.datasetFormat,a=i?e:e.url,{customParameters:o,options:n}=t;return this._image=new R({ioConfig:{skipExtensions:["aux.xml","jgw"],skipMapInfo:!0,datasetFormat:r},url:a,customParameters:o}),this._image.when(e=>{this._updatePanConstraint(),this._createResizeHandles(e),this._map.add(e),this.state="image-loaded"},t=>{l(t)?this.state="image-load-aborted":(this.state="image-load-error",this.error=t,s.getLogger(this).error(`error occurred while loading image ${i?e:JSON.stringify(e)}`,t),this.imageSource=null)}),this._image.load(n)},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../navigation/NavigationManager.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&(this._map.layers.remove(this.image),this._image=n(this._image))},this.loadImage=e=>{const{customParameters:t,imageSource:i}=this;return i?this._loadImageInternal(i,{customParameters:t,options:e}):P(this.declaredClass,new r(k("image-viewer"),H("ImageViewerViewModel","imageSource")))},this.navigate=async(e,t)=>this.updatingHandles.addPromise(this.navigateInternal(e,t)),this.navigateInternal=async(e,t)=>{const i=await this._loadNavigationManager();return await i.navigate(e,t)},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new b({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:v.WebMercator,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([m(()=>this.imageSource,e=>{e&&this.autoLoad&&this._loadWithController()},h),m(()=>this.image?.loaded,()=>{this._createImageHandles()}),m(()=>this.imageRotation,()=>{this._rotateImage()}),m(()=>this.imageRenderer.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},d),m(()=>this.imageRenderer.map.allLayers.length,e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)},h),m(()=>this.clickAction,e=>{this.removeHandles(S.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.defer(async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});e.results=e.results.filter(e=>"graphic"===e.type),this.emit("hittest-response",e)});break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:i}=this.image.serviceRasterInfo,r=(t.mapPoint.x-e.xmin)*i.x,a=(e.ymax-t.mapPoint.y)*i.y,s=new u({x:r,y:a,spatialReference:e.spatialReference});this.emit("pixel-location",s);break}}}))},h)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",o(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",o(e,-10,10))}get currentNode(){return this.navigationViewModel?.currentNode}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,r=this.imageRotation,a=this.image?.fullExtent,s=this.image?.serviceRasterInfo,o=!0===this._imageRenderer.allLayerViews.find(({layer:e})=>e===this.image)?.attached;if(!(t&&e&&a&&s&&o))return null;const n=i(y.fromExtent(e),r,e.center.x,e.center.y),l=y.fromExtent(a),m=f(n,l),{rings:h}=m;return h.flat().map(([e,t])=>({x:(e-s.extent.xmin)*s.pixelSize.x,y:(s.extent.ymax-t)*s.pixelSize.y}))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:i}=e.raster.rasterInfo;return[t,i]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find(e=>e.layer===this.image)}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",o(e,0,1))}get updating(){return this.updatingHandles.updating}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const i=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],r=new x({functionName:"Convolution",functionArguments:{type:C.userDefined,cols:3,rows:3,kernel:i,convolutionType:C.userDefined}});e.rasterFunction=r}};e([g()],V.prototype,"_image",void 0),e([g()],V.prototype,"_imageRenderer",void 0),e([g()],V.prototype,"_loadController",void 0),e([g()],V.prototype,"_overlays",void 0),e([g()],V.prototype,"_map",void 0),e([g({type:Boolean})],V.prototype,"autoLoad",void 0),e([g({type:Number})],V.prototype,"brightness",null),e([g()],V.prototype,"clickAction",void 0),e([g({type:Number})],V.prototype,"contrast",null),e([g()],V.prototype,"currentNode",null),e([g({type:Object})],V.prototype,"customParameters",void 0),e([g({type:r})],V.prototype,"error",void 0),e([g({readOnly:!0})],V.prototype,"image",null),e([g({readOnly:!0})],V.prototype,"imagePointsInView",null),e([g({readOnly:!0})],V.prototype,"imageSize",null),e([g({cast:M})],V.prototype,"imageSource",void 0),e([g({readOnly:!0})],V.prototype,"imageRenderer",null),e([g({type:Number})],V.prototype,"imageRotation",void 0),e([g()],V.prototype,"imageView",null),e([g()],V.prototype,"navigationManager",void 0),e([g()],V.prototype,"navigationViewModel",void 0),e([g({type:Number})],V.prototype,"sharpness",null),e([g()],V.prototype,"state",void 0),e([g()],V.prototype,"updatingHandles",void 0),e([g()],V.prototype,"updating",null),V=e([p("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],V);const E=V;export{E as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../Map.js";import{rotate as i}from"../../../arcade/geometry/operators.js";import r from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{isAbortError as l}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as h,initial as d}from"../../../core/reactiveUtils.js";import{property as g,subclass as p}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import u from"../../../geometry/Point.js";import y from"../../../geometry/Polygon.js";import v from"../../../geometry/SpatialReference.js";import{e as f}from"../../../chunks/intersectionOperator.js";import{g as _}from"../../../chunks/proximityOperator.js";import w from"../../../layers/GraphicsLayer.js";import R from"../../../layers/ImageryTileLayer.js";import x from"../../../layers/support/RasterFunction.js";import{convolutionKernel as C}from"../../../layers/support/rasterFunctionConstants.js";import I from"../../../layers/support/TileInfo.js";import b from"../../../views/MapView.js";import{getResolutionToScaleFactor as j}from"../../../views/2d/viewpointUtils.js";import{castImageSource as M,logAndThrow as P,getMissingPropertyErrorName as V,getMissingPropertyErrorMessage as k}from"../utils.js";const H={click:"click-handle",enhancements:"enhancements-handle"};let S=class extends a{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new w({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageSource=null,this.imageRotation=0,this.navigationManager=null,this.navigationViewModel=null,this.state="ready",this.updatingHandles=new c,this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createImageHandles=()=>{this.removeHandles(H.enhancements),this.addHandles(m(()=>[this.brightness,this.contrast,this.sharpness],([e,t,i])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,i))},h))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,r=r=>{if(!(e&&t&&r.targetGeometry&&e.serviceRasterInfo))return r;const{extent:a}=e.serviceRasterInfo,{constraints:s,rotation:o,width:n,height:l}=t,{extent:m}=i(y.fromExtent(a),o,a.center.x,a.center.y),{width:h,height:d}=m,g=r.targetGeometry.clone(),p=s.scaleToZoom(r.scale),c=1/2**p,u=n/l;let v=c*h,f=c*d;p&&(h/n>d/l?f=v/u:v=f*u);const w=m.clone();return w.xmin+=v/2,w.xmax-=v/2,w.ymin+=f/2,w.ymax-=f/2,r.targetGeometry=_(y.fromExtent(w),g).coordinate,this.state="image-loaded",r};return{constrain:r,applyPanConstraint:r}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(m(()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:r,height:a,rotation:s}=this.imageRenderer,{extent:o}=i(y.fromExtent(t),s,t.center.x,t.center.y),{width:n,height:l}=o;return Math.max(n/r,l/a)},e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:i,spatialReference:r}=this.imageRenderer,a=t.minScale,s=j(r),o=.25*s,n=s*e;let l=n;const m=[];for(;l>o;)m.push(l),l/=2;m.push(l);const{lods:h}=I.create({scales:m});if(t.set({minScale:n,lods:h}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(i-a)<=1e-6?n:i},h),"resize")},this._loadImageInternal=(e,t={})=>{this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0;const i="string"==typeof e,r=i?void 0:e.datasetFormat,a=i?e:e.url,{customParameters:o,options:n}=t;return this._image=new R({ioConfig:{skipExtensions:["aux.xml","jgw"],skipMapInfo:!0,datasetFormat:r},url:a,customParameters:o}),this._image.when(e=>{this._updatePanConstraint(),this._createResizeHandles(e),this._map.add(e),this.state="image-loaded"},t=>{l(t)?this.state="image-load-aborted":(this.state="image-load-error",this.error=t,s.getLogger(this).error(`error occurred while loading image ${i?e:JSON.stringify(e)}`,t),this.imageSource=null)}),this._image.load(n)},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../navigation/NavigationManager.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&(this._map.layers.remove(this.image),this._image=n(this._image))},this.loadImage=e=>{const{customParameters:t,imageSource:i}=this;return i?this._loadImageInternal(i,{customParameters:t,options:e}):P(this.declaredClass,new r(V("image-viewer"),k("ImageViewerViewModel","imageSource")))},this.navigate=async(e,t)=>this.updatingHandles.addPromise(this.navigateInternal(e,t)),this.navigateInternal=async(e,t)=>{const i=await this._loadNavigationManager();return await i.navigate(e,t)},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new b({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:v.WebMercator,attributionVisible:!1})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([m(()=>this.imageSource,e=>{e&&this.autoLoad&&this._loadWithController()},h),m(()=>this.image?.loaded,()=>{this._createImageHandles()}),m(()=>this.imageRotation,()=>{this._rotateImage()}),m(()=>this.imageRenderer.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},d),m(()=>this.imageRenderer.map.allLayers.length,e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)},h),m(()=>this.clickAction,e=>{this.removeHandles(H.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.defer(async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});e.results=e.results.filter(e=>"graphic"===e.type),this.emit("hittest-response",e)});break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:i}=this.image.serviceRasterInfo,r=(t.mapPoint.x-e.xmin)*i.x,a=(e.ymax-t.mapPoint.y)*i.y,s=new u({x:r,y:a,spatialReference:e.spatialReference});this.emit("pixel-location",s);break}}}))},h)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",o(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",o(e,-10,10))}get currentNode(){return this.navigationViewModel?.currentNode}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,r=this.imageRotation,a=this.image?.fullExtent,s=this.image?.serviceRasterInfo,o=!0===this._imageRenderer.allLayerViews.find(({layer:e})=>e===this.image)?.attached;if(!(t&&e&&a&&s&&o))return null;const n=i(y.fromExtent(e),r,e.center.x,e.center.y),l=y.fromExtent(a),m=f(n,l),{rings:h}=m;return h.flat().map(([e,t])=>({x:(e-s.extent.xmin)*s.pixelSize.x,y:(s.extent.ymax-t)*s.pixelSize.y}))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:i}=e.raster.rasterInfo;return[t,i]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find(e=>e.layer===this.image)}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",o(e,0,1))}get updating(){return this.updatingHandles.updating}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const i=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],r=new x({functionName:"Convolution",functionArguments:{type:C.userDefined,cols:3,rows:3,kernel:i,convolutionType:C.userDefined}});e.rasterFunction=r}};e([g()],S.prototype,"_image",void 0),e([g()],S.prototype,"_imageRenderer",void 0),e([g()],S.prototype,"_loadController",void 0),e([g()],S.prototype,"_overlays",void 0),e([g()],S.prototype,"_map",void 0),e([g({type:Boolean})],S.prototype,"autoLoad",void 0),e([g({type:Number})],S.prototype,"brightness",null),e([g()],S.prototype,"clickAction",void 0),e([g({type:Number})],S.prototype,"contrast",null),e([g()],S.prototype,"currentNode",null),e([g({type:Object})],S.prototype,"customParameters",void 0),e([g({type:r})],S.prototype,"error",void 0),e([g({readOnly:!0})],S.prototype,"image",null),e([g({readOnly:!0})],S.prototype,"imagePointsInView",null),e([g({readOnly:!0})],S.prototype,"imageSize",null),e([g({cast:M})],S.prototype,"imageSource",void 0),e([g({readOnly:!0})],S.prototype,"imageRenderer",null),e([g({type:Number})],S.prototype,"imageRotation",void 0),e([g()],S.prototype,"imageView",null),e([g()],S.prototype,"navigationManager",void 0),e([g()],S.prototype,"navigationViewModel",void 0),e([g({type:Number})],S.prototype,"sharpness",null),e([g()],S.prototype,"state",void 0),e([g()],S.prototype,"updatingHandles",void 0),e([g()],S.prototype,"updating",null),S=e([p("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],S);const E=S;export{E as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Camera.js";import i from"../../Ground.js";import o from"../../Map.js";import a from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as s}from"../../core/Evented.js";import{JSONMap as n}from"../../core/jsonMap.js";import d from"../../core/Logger.js";import{rad2deg as h,deg2rad as m}from"../../core/mathUtils.js";import{destroyMaybe as l}from"../../core/maybe.js";import{waitTick as c}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as g,when as u,whenOnce as v}from"../../core/reactiveUtils.js";import{property as _,subclass as y}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/SpatialReference.js";import V from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as M}from"../../layers/orientedImagery/transformations/utils.js";import R from"../../views/SceneView.js";import{fixedImageSize as P}from"../OrientedImageryViewer/constants.js";import{logAndThrow as z,getMissingPropertyErrorName as H,getMissingPropertyErrorMessage as F}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as C,maxPanoramicViewerHFOV as b,minPanoramicViewerHFOV as S,humanBinocularHFOV as O}from"./constants.js";import j from"./PanoramicZoomConditions.js";import I from"./PanoramicZoomViewModel.js";import{findDiagonalFOV as x,meshToGraphic as L,createImageSphere as k}from"./utils.js";import{enumeration as A}from"../../core/accessorSupport/decorators/enumeration.js";const G={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let T=class extends s{constructor(e){super(e),this._startPosition=null,this._targetPosition=null,this._graphics=new V({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this._loadController=null,this._map=new o({ground:new i({opacity:0,navigationConstraint:null}),layers:new a([this._graphics])}),this._zoomViewModel=null,this.autoLoad=!1,this.clickAction="none",this.closestFeature=null,this.currentTime=0,this.imageSize=null,this.oiViewModel=null,this.videoSource=null,this.videoDuration=void 0,this.videoLoaded=!1,this.videoPaused=null,this.videoMuted=null,this.pitch=90,this.state="ready",this.updatingHandles=new f,this.video=null,this.yaw=0,this._addNavigationHandles=()=>{this.imageRenderer.basemapTerrain.suspended=!0,this.imageRenderer.constraints.tilt.max=180,this.removeHandles(G.navigation),this.addHandles([this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("double-click",this._handleDoubleClick),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const t=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],i=e.key;t.includes(i)&&e.stopPropagation()})],G.navigation)},this._addHFOVHandles=()=>{this.removeHandles(G.fovConstraint),this.addHandles(p(()=>[this.maxHFOV,this.minHFOV],()=>{this._zoomViewModel&&(this._zoomViewModel.panoramicZoomConditions=new j({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},g),G.fovConstraint)},this._addZoomHandles=()=>{this._zoomViewModel=new I({view:this.imageRenderer,panoramicZoomConditions:new j({maxFOV:this.maxHFOV,minFOV:this.minHFOV})});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this._zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:t,x:i,y:o}=e;switch(t){case"start":this._startPosition=this._targetPosition={x:i,y:o};break;case"update":this._targetPosition={x:i,y:o},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const t=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics});t.results=t.results.filter(e=>"graphic"===e.type&&e.graphic!==this._imageGraphic),this.emit("hittest-response",t)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const t=M(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...t,spatialReference:w.WebMercator});break}}},this._handleWheel=e=>{const t=e.deltaX??e.native.deltaX;e.stopPropagation(),t>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadVideo(this._loadController)},this._zoomIn=()=>this._zoomViewModel?.zoomIn(),this._zoomOut=()=>this._zoomViewModel?.zoomOut(),this.addGraphic=(e,t)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,t),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const t=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(t),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.enableAudio=()=>{const{video:e}=this;e&&(e.muted=!1,this.videoMuted=!1)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const t=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(t),!0},this.togglePanoramicAudio=()=>{if(this.video){const e=this.video.muted;this.video.muted=!e,this.videoMuted=!e}},this._imageRenderer=new R({map:this._map,viewingMode:"local",camera:{position:C},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:w.WebMercator,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([p(()=>this.videoSource,()=>{this.videoSource&&this.autoLoad&&this._loadWithController()},g),p(()=>this.fov,()=>{this._reloadCamera()},g),p(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},g),p(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},g),u(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},g),p(()=>this.clickAction,e=>{this.removeHandles(G.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},g),p(()=>this.video,e=>{if(e instanceof HTMLVideoElement){this._startVideo();const t=async()=>{this.currentTime=Number(e.currentTime.toFixed(2)),e.currentTime&&await this._updateVidFootprint(e.currentTime)};e.addEventListener("timeupdate",t),e.addEventListener("play",()=>this._updateVideoIcon(e.paused)),e.addEventListener("pause",()=>this._pauseVideoHandler(e))}},g)],G.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this._zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return null;const{fov:e}=this.camera,{size:[t,i]}=this.imageRenderer,o=t/i,a=Math.atan(o);return 2*h(Math.atan(Math.tan(m(e/2))*Math.sin(a)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,t]}=this.imageRenderer;return this.imageRenderer.ready?x(b,e/t):b}get minHFOV(){const{size:[e,t]}=this.imageRenderer;return this.imageRenderer.ready?x(S,e/t):S}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return null;const{fov:e}=this.camera,{size:[t,i]}=this.imageRenderer,o=t/i,a=Math.atan(o);return 2*h(Math.atan(Math.tan(m(e/2))*Math.cos(a)))}async _loadVideoInternal(e,t){return this.state="image-loading",this.video=document.createElement("video"),this.video.src=e,this.video.addEventListener("loadedmetadata",()=>{this._setVideoDuration(),this.videoLoaded=!0}),this._updateImageSphere(this.video,t)}_pauseVideoHandler(e){this._updateVideoIcon(e.paused)}_setVideoDuration(){const{video:e}=this;e?.duration&&(this.videoDuration=e.duration)}_startVideo(){try{this.enableAudio();const e=this.oiViewModel.currentBestFeature;e&&this.playPanoramicVideoFromSelectedLocation(e)}catch(e){d.getLogger(this).error("oriented-imagery-viewer:video-load",e)}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._imageGraphic&&(this._graphics.remove(this._imageGraphic),this._imageGraphic=l(this._imageGraphic)),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const t=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,t)),this._startPosition=this._targetPosition}async _updateImageSphere(e,t){return await c(t),this._imageGraphic=L(k(e)),this._graphics.add(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,t).then(()=>{const{size:[e,t]}=this.imageRenderer;this.fov=x(O,e/t)}),this.imageSize=P,this._imageGraphic.geometry}async _updateVidFootprint(e){const t=this.oiViewModel?.featureCache.find(t=>t.attributes.offsetFromStart===Math.floor(e)),{yaw:i,pitch:o,vfov:a,hfov:r}=this,s=!(t?.attributes.offsetFromStart&&a&&r&&i&&o),n=t?.attributes.objectId===this.closestFeature?.attributes.objectId;s||n||(this.closestFeature=t,await this.oiViewModel.updateFootprintPanorama({yaw:i,pitch:o,verticalFieldOfView:a,horizontalFieldOfView:r,feature:t}))}_updateVideoIcon(e){this.videoPaused=!!e}async loadVideo(e){return this._removeImageSphere(),this.videoSource?this._loadVideoInternal(this.videoSource,e):z(this.declaredClass,new r(H("panoramic-viewer"),F("PanoramicViewerViewModel","videoSource")))}playPanoramicVideoHandler(){const{video:e}=this;e&&(e.paused?e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}):e.pause())}playPanoramicVideoFromSelectedLocation(e){const t=e.attributes.offsetFromStart;if(t){const e=this.video;e&&(e.currentTime=t,e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}))}}rewindPanoramicVideoHandler(){const{video:e}=this;e&&(e.currentTime=0,e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}))}};e([_()],T.prototype,"_graphics",void 0),e([_()],T.prototype,"_imageGraphic",void 0),e([_()],T.prototype,"_imageRenderer",void 0),e([_()],T.prototype,"_loadController",void 0),e([_()],T.prototype,"_map",void 0),e([_()],T.prototype,"_zoomViewModel",void 0),e([_({type:Boolean})],T.prototype,"autoLoad",void 0),e([_({type:t})],T.prototype,"camera",null),e([A(new n({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],T.prototype,"clickAction",void 0),e([_()],T.prototype,"closestFeature",void 0),e([_()],T.prototype,"currentTime",void 0),e([_({type:Number})],T.prototype,"fov",null),e([_({readOnly:!0})],T.prototype,"hfov",null),e([_({readOnly:!0})],T.prototype,"imageRenderer",null),e([_()],T.prototype,"imageSize",void 0),e([_()],T.prototype,"oiViewModel",void 0),e([_()],T.prototype,"videoSource",void 0),e([_()],T.prototype,"videoDuration",void 0),e([_()],T.prototype,"videoLoaded",void 0),e([_()],T.prototype,"videoPaused",void 0),e([_()],T.prototype,"videoMuted",void 0),e([_({readOnly:!0})],T.prototype,"maxHFOV",null),e([_({readOnly:!0})],T.prototype,"minHFOV",null),e([_({type:Number})],T.prototype,"pitch",void 0),e([_()],T.prototype,"state",void 0),e([_()],T.prototype,"updatingHandles",void 0),e([_()],T.prototype,"updating",null),e([_({readOnly:!0})],T.prototype,"vfov",null),e([_()],T.prototype,"video",void 0),e([_({type:Number})],T.prototype,"yaw",void 0),T=e([y("esri.widgets.PanoramicViewer.PanoramicVideoViewerViewModel")],T);const E=T;export{E as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Camera.js";import i from"../../Ground.js";import o from"../../Map.js";import a from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as s}from"../../core/Evented.js";import{JSONMap as n}from"../../core/jsonMap.js";import d from"../../core/Logger.js";import{rad2deg as h,deg2rad as l}from"../../core/mathUtils.js";import{destroyMaybe as m}from"../../core/maybe.js";import{waitTick as c}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as g,when as u,whenOnce as v}from"../../core/reactiveUtils.js";import{property as _,subclass as y}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/SpatialReference.js";import V from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as M}from"../../layers/orientedImagery/transformations/utils.js";import R from"../../views/SceneView.js";import{fixedImageSize as P}from"../OrientedImageryViewer/constants.js";import{logAndThrow as z,getMissingPropertyErrorName as H,getMissingPropertyErrorMessage as b}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as F,maxPanoramicViewerHFOV as C,minPanoramicViewerHFOV as S,humanBinocularHFOV as O}from"./constants.js";import j from"./PanoramicZoomConditions.js";import I from"./PanoramicZoomViewModel.js";import{findDiagonalFOV as x,meshToGraphic as L,createImageSphere as k}from"./utils.js";import{enumeration as A}from"../../core/accessorSupport/decorators/enumeration.js";const G={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let T=class extends s{constructor(e){super(e),this._startPosition=null,this._targetPosition=null,this._graphics=new V({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this._loadController=null,this._map=new o({ground:new i({opacity:0,navigationConstraint:null}),layers:new a([this._graphics])}),this._zoomViewModel=null,this.autoLoad=!1,this.clickAction="none",this.closestFeature=null,this.currentTime=0,this.imageSize=null,this.oiViewModel=null,this.videoSource=null,this.videoDuration=void 0,this.videoLoaded=!1,this.videoPaused=null,this.videoMuted=null,this.pitch=90,this.state="ready",this.updatingHandles=new f,this.video=null,this.yaw=0,this._addNavigationHandles=()=>{this.imageRenderer.basemapTerrain.suspended=!0,this.imageRenderer.constraints.tilt.max=180,this.removeHandles(G.navigation),this.addHandles([this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("double-click",this._handleDoubleClick),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const t=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],i=e.key;t.includes(i)&&e.stopPropagation()})],G.navigation)},this._addHFOVHandles=()=>{this.removeHandles(G.fovConstraint),this.addHandles(p(()=>[this.maxHFOV,this.minHFOV],()=>{this._zoomViewModel&&(this._zoomViewModel.panoramicZoomConditions=new j({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},g),G.fovConstraint)},this._addZoomHandles=()=>{this._zoomViewModel=new I({view:this.imageRenderer,panoramicZoomConditions:new j({maxFOV:this.maxHFOV,minFOV:this.minHFOV})});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this._zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:t,x:i,y:o}=e;switch(t){case"start":this._startPosition=this._targetPosition={x:i,y:o};break;case"update":this._targetPosition={x:i,y:o},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const t=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics});t.results=t.results.filter(e=>"graphic"===e.type&&e.graphic!==this._imageGraphic),this.emit("hittest-response",t)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const t=M(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...t,spatialReference:w.WebMercator});break}}},this._handleWheel=e=>{const t=e.deltaX??e.native.deltaX;e.stopPropagation(),t>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadVideo(this._loadController)},this._zoomIn=()=>this._zoomViewModel?.zoomIn(),this._zoomOut=()=>this._zoomViewModel?.zoomOut(),this.addGraphic=(e,t)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,t),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const t=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(t),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.enableAudio=()=>{const{video:e}=this;e&&(e.muted=!1,this.videoMuted=!1)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const t=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(t),!0},this.togglePanoramicAudio=()=>{if(this.video){const e=this.video.muted;this.video.muted=!e,this.videoMuted=!e}},this._imageRenderer=new R({map:this._map,viewingMode:"local",camera:{position:F},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:w.WebMercator,attributionVisible:!1,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([p(()=>this.videoSource,()=>{this.videoSource&&this.autoLoad&&this._loadWithController()},g),p(()=>this.fov,()=>{this._reloadCamera()},g),p(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},g),p(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},g),u(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},g),p(()=>this.clickAction,e=>{this.removeHandles(G.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},g),p(()=>this.video,e=>{if(e instanceof HTMLVideoElement){this._startVideo();const t=async()=>{this.currentTime=Number(e.currentTime.toFixed(2)),e.currentTime&&await this._updateVidFootprint(e.currentTime)};e.addEventListener("timeupdate",t),e.addEventListener("play",()=>this._updateVideoIcon(e.paused)),e.addEventListener("pause",()=>this._pauseVideoHandler(e))}},g)],G.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this._zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return null;const{fov:e}=this.camera,{size:[t,i]}=this.imageRenderer,o=t/i,a=Math.atan(o);return 2*h(Math.atan(Math.tan(l(e/2))*Math.sin(a)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,t]}=this.imageRenderer;return this.imageRenderer.ready?x(C,e/t):C}get minHFOV(){const{size:[e,t]}=this.imageRenderer;return this.imageRenderer.ready?x(S,e/t):S}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return null;const{fov:e}=this.camera,{size:[t,i]}=this.imageRenderer,o=t/i,a=Math.atan(o);return 2*h(Math.atan(Math.tan(l(e/2))*Math.cos(a)))}async _loadVideoInternal(e,t){return this.state="image-loading",this.video=document.createElement("video"),this.video.src=e,this.video.addEventListener("loadedmetadata",()=>{this._setVideoDuration(),this.videoLoaded=!0}),this._updateImageSphere(this.video,t)}_pauseVideoHandler(e){this._updateVideoIcon(e.paused)}_setVideoDuration(){const{video:e}=this;e?.duration&&(this.videoDuration=e.duration)}_startVideo(){try{this.enableAudio();const e=this.oiViewModel.currentBestFeature;e&&this.playPanoramicVideoFromSelectedLocation(e)}catch(e){d.getLogger(this).error("oriented-imagery-viewer:video-load",e)}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._imageGraphic&&(this._graphics.remove(this._imageGraphic),this._imageGraphic=m(this._imageGraphic)),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const t=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,t)),this._startPosition=this._targetPosition}async _updateImageSphere(e,t){return await c(t),this._imageGraphic=L(k(e)),this._graphics.add(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,t).then(()=>{const{size:[e,t]}=this.imageRenderer;this.fov=x(O,e/t)}),this.imageSize=P,this._imageGraphic.geometry}async _updateVidFootprint(e){const t=this.oiViewModel?.featureCache.find(t=>t.attributes.offsetFromStart===Math.floor(e)),{yaw:i,pitch:o,vfov:a,hfov:r}=this,s=!(t?.attributes.offsetFromStart&&a&&r&&i&&o),n=t?.attributes.objectId===this.closestFeature?.attributes.objectId;s||n||(this.closestFeature=t,await this.oiViewModel.updateFootprintPanorama({yaw:i,pitch:o,verticalFieldOfView:a,horizontalFieldOfView:r,feature:t}))}_updateVideoIcon(e){this.videoPaused=!!e}async loadVideo(e){return this._removeImageSphere(),this.videoSource?this._loadVideoInternal(this.videoSource,e):z(this.declaredClass,new r(H("panoramic-viewer"),b("PanoramicViewerViewModel","videoSource")))}playPanoramicVideoHandler(){const{video:e}=this;e&&(e.paused?e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}):e.pause())}playPanoramicVideoFromSelectedLocation(e){const t=e.attributes.offsetFromStart;if(t){const e=this.video;e&&(e.currentTime=t,e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}))}}rewindPanoramicVideoHandler(){const{video:e}=this;e&&(e.currentTime=0,e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}))}};e([_()],T.prototype,"_graphics",void 0),e([_()],T.prototype,"_imageGraphic",void 0),e([_()],T.prototype,"_imageRenderer",void 0),e([_()],T.prototype,"_loadController",void 0),e([_()],T.prototype,"_map",void 0),e([_()],T.prototype,"_zoomViewModel",void 0),e([_({type:Boolean})],T.prototype,"autoLoad",void 0),e([_({type:t})],T.prototype,"camera",null),e([A(new n({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],T.prototype,"clickAction",void 0),e([_()],T.prototype,"closestFeature",void 0),e([_()],T.prototype,"currentTime",void 0),e([_({type:Number})],T.prototype,"fov",null),e([_({readOnly:!0})],T.prototype,"hfov",null),e([_({readOnly:!0})],T.prototype,"imageRenderer",null),e([_()],T.prototype,"imageSize",void 0),e([_()],T.prototype,"oiViewModel",void 0),e([_()],T.prototype,"videoSource",void 0),e([_()],T.prototype,"videoDuration",void 0),e([_()],T.prototype,"videoLoaded",void 0),e([_()],T.prototype,"videoPaused",void 0),e([_()],T.prototype,"videoMuted",void 0),e([_({readOnly:!0})],T.prototype,"maxHFOV",null),e([_({readOnly:!0})],T.prototype,"minHFOV",null),e([_({type:Number})],T.prototype,"pitch",void 0),e([_()],T.prototype,"state",void 0),e([_()],T.prototype,"updatingHandles",void 0),e([_()],T.prototype,"updating",null),e([_({readOnly:!0})],T.prototype,"vfov",null),e([_()],T.prototype,"video",void 0),e([_({type:Number})],T.prototype,"yaw",void 0),T=e([y("esri.widgets.PanoramicViewer.PanoramicVideoViewerViewModel")],T);const E=T;export{E as default};