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

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 (338) hide show
  1. package/AggregateGraphic.js +1 -1
  2. package/analysis/Analysis.js +1 -1
  3. package/analysis/DimensioningAnalysis.js +1 -1
  4. package/analysis/LengthDimension.d.ts +4 -0
  5. package/analysis/LengthDimension.js +5 -0
  6. package/analysis/dimensionUtils.js +5 -0
  7. package/arcade/Dictionary.js +1 -1
  8. package/arcade/Feature.js +1 -1
  9. package/arcade/arcade.js +1 -1
  10. package/arcade/arcadeAsyncRuntime.js +1 -1
  11. package/arcade/arcadeCompiler.js +1 -1
  12. package/arcade/credentials.js +1 -1
  13. package/arcade/featureSetCollection.js +1 -1
  14. package/arcade/featureSetUtils.js +1 -1
  15. package/arcade/featureset/actions/Adapted.js +1 -1
  16. package/arcade/featureset/actions/AttributeFilter.js +1 -1
  17. package/arcade/featureset/actions/GroupBy.js +1 -1
  18. package/arcade/featureset/actions/OrderBy.js +1 -1
  19. package/arcade/featureset/actions/SpatialFilter.js +1 -1
  20. package/arcade/featureset/actions/Top.js +1 -1
  21. package/arcade/featureset/sources/Empty.js +1 -1
  22. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  23. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  24. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  25. package/arcade/featureset/support/FeatureSet.js +1 -1
  26. package/arcade/featureset/support/FeatureSetIterator.js +1 -1
  27. package/arcade/featureset/support/shared.js +1 -1
  28. package/arcade/featureset/support/stats.js +1 -1
  29. package/arcade/functions/featuresetbase.js +1 -1
  30. package/arcade/functions/featuresetgeom.js +1 -1
  31. package/arcade/functions/featuresetstats.js +1 -1
  32. package/arcade/functions/featuresetstring.js +1 -1
  33. package/arcade/functions/geomasync.js +1 -1
  34. package/arcade/languageUtils.js +1 -1
  35. package/arcade/request.js +1 -1
  36. package/assets/esri/core/workers/RemoteClient.js +1 -1
  37. package/assets/esri/core/workers/chunks/0564f1cfa3d17ff1aad3.js +1 -0
  38. package/assets/esri/core/workers/chunks/0806d5d706a864542bfb.js +1 -0
  39. package/assets/esri/core/workers/chunks/0a6977144ea1abf96fbf.js +1 -0
  40. package/assets/esri/core/workers/chunks/13387f56acbc3291561a.js +1 -0
  41. package/assets/esri/core/workers/chunks/16c4e0a32d50d4db984d.js +1 -0
  42. package/assets/esri/core/workers/chunks/{076d1b1101b59af0d389.js → 1c010202b4c7e1d15f23.js} +1 -1
  43. package/assets/esri/core/workers/chunks/26827ec144676e6385f8.js +1 -0
  44. package/assets/esri/core/workers/chunks/287c484fd40eee643f3a.js +1 -0
  45. package/assets/esri/core/workers/chunks/5210f0b42dba27945226.js +1 -0
  46. package/assets/esri/core/workers/chunks/{db6c5b3b4efe8d804f9c.js → 52478ee2d2a1354b6900.js} +1 -1
  47. package/assets/esri/core/workers/chunks/5759af97f96f24c40105.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b85218d44c6094b7e5e6.js → 6d7e2a23a0a5dd9ded1d.js} +1 -1
  49. package/assets/esri/core/workers/chunks/70b6356357e7640c4e8b.js +1 -0
  50. package/assets/esri/core/workers/chunks/7574316b3af61c389e8f.js +1 -0
  51. package/assets/esri/core/workers/chunks/7bc828fbdd54c0b28aac.js +1 -0
  52. package/assets/esri/core/workers/chunks/7e5c22b5a32ac74b1b6e.js +1 -0
  53. package/assets/esri/core/workers/chunks/8102bb78fe96e6197e4e.js +1 -0
  54. package/assets/esri/core/workers/chunks/88384e7cafbfd2348598.js +1 -0
  55. package/assets/esri/core/workers/chunks/9d7533aaeac3b8d145c4.js +1 -0
  56. package/assets/esri/core/workers/chunks/{1eecae5227318f491263.js → 9f4d892abf55e8625bc9.js} +3 -3
  57. package/assets/esri/core/workers/chunks/{98607a0da63626cc4614.js → a054a52712a118c6d505.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{69a20e4d9e28c3e599fc.js → a3bb600bfcb0282622f1.js} +1 -1
  59. package/assets/esri/core/workers/chunks/aa49841b14c6e6df2a07.js +1 -0
  60. package/assets/esri/core/workers/chunks/b089058b64db3912478f.js +1 -0
  61. package/assets/esri/core/workers/chunks/b28539c5a6bedb71b038.js +1 -0
  62. package/assets/esri/core/workers/chunks/b4f171db73355c6f766e.js +1 -0
  63. package/assets/esri/core/workers/chunks/b7572b0921b23aef8b9d.js +1 -0
  64. package/assets/esri/core/workers/chunks/b758f3c419edc2306784.js +1 -0
  65. package/assets/esri/core/workers/chunks/c3e7290fb128d4fefd44.js +1 -0
  66. package/assets/esri/core/workers/chunks/c51c9b5da855f84b9a48.js +1 -0
  67. package/assets/esri/core/workers/chunks/c66ac36da6392b6bf331.js +1 -0
  68. package/assets/esri/core/workers/chunks/d16b328d32a6ddc2fdb9.js +1 -0
  69. package/assets/esri/core/workers/chunks/d94c5f36d52cf71f0bb9.js +1 -0
  70. package/assets/esri/core/workers/chunks/db937849b2c1af87b481.js +1 -0
  71. package/assets/esri/core/workers/chunks/{66cd99e91dad60c5274c.js → dc3ed59f450283d97a19.js} +1 -1
  72. package/assets/esri/core/workers/chunks/dcd0653191cd4a1ccaae.js +2 -0
  73. package/assets/esri/core/workers/chunks/{31df729c17470245288c.js.LICENSE.txt → dcd0653191cd4a1ccaae.js.LICENSE.txt} +2 -2
  74. package/assets/esri/core/workers/chunks/e4fdd1eaf987977d0a51.js +1 -0
  75. package/assets/esri/core/workers/chunks/e51f0e71f2a55af604d3.js +1 -0
  76. package/assets/esri/core/workers/chunks/eb3855d3753d6b8334bd.js +1 -0
  77. package/assets/esri/core/workers/chunks/{7c290763920f52a1f504.js → eeed138930a4a805691d.js} +1 -1
  78. package/assets/esri/core/workers/chunks/f435dc615fdc8917f6ca.js +1 -0
  79. package/assets/esri/core/workers/chunks/{d5c5b9f7f5401f36a3a5.js → f7f3dde4c8f9c687cc1e.js} +1 -1
  80. package/assets/esri/core/workers/chunks/fc6beaf9466ea3898549.js +1 -0
  81. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  82. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -0
  83. package/assets/esri/themes/base/widgets/_Weather.scss +1 -2
  84. package/assets/esri/themes/dark/main.css +1 -1
  85. package/assets/esri/themes/light/main.css +1 -1
  86. package/assets/esri/themes/light/view.css +1 -1
  87. package/chunks/BlendLayers.glsl.js +6 -6
  88. package/chunks/arcade.js +1 -1
  89. package/chunks/array.js +1 -1
  90. package/chunks/languageUtils.js +1 -1
  91. package/config.js +1 -1
  92. package/core/sql/StandardizedFunctions.js +1 -1
  93. package/geohash/GeohashTree.js +1 -1
  94. package/geometry/support/contains.js +1 -1
  95. package/geometry/support/heightModelInfoUtils.js +1 -1
  96. package/geometry/support/intersects.js +1 -1
  97. package/geometry/support/intersectsBase.js +1 -1
  98. package/geometry/support/normalizeUtilsCommon.js +1 -1
  99. package/geometry/support/spatialReferenceUtils.js +1 -1
  100. package/interfaces.d.ts +685 -37
  101. package/layers/MediaLayer.d.ts +4 -0
  102. package/layers/MediaLayer.js +5 -0
  103. package/layers/VoxelLayer.js +1 -1
  104. package/layers/VoxelWasmPerSceneView.js +5 -0
  105. package/layers/graphics/OptimizedGeometry.js +1 -1
  106. package/layers/graphics/data/BoundsStore.js +1 -1
  107. package/layers/support/CornersGeoreference.d.ts +4 -0
  108. package/layers/support/CornersGeoreference.js +5 -0
  109. package/layers/support/ExtentAndRotationGeoreference.d.ts +4 -0
  110. package/layers/support/ExtentAndRotationGeoreference.js +5 -0
  111. package/layers/support/FeatureReduction.js +1 -1
  112. package/layers/support/FeatureReductionBinning.js +5 -0
  113. package/layers/support/GeoreferenceBase.js +5 -0
  114. package/layers/support/ImageElement.d.ts +4 -0
  115. package/layers/support/ImageElement.js +5 -0
  116. package/layers/support/LocalMediaElementSource.d.ts +4 -0
  117. package/layers/support/LocalMediaElementSource.js +5 -0
  118. package/layers/support/MediaElementBase.d.ts +4 -0
  119. package/layers/support/MediaElementBase.js +5 -0
  120. package/layers/support/RouteStopSymbols.d.ts +4 -0
  121. package/layers/support/RouteSymbols.d.ts +4 -0
  122. package/layers/support/VoxelFormat.d.ts +4 -0
  123. package/layers/support/VoxelStyle.d.ts +4 -0
  124. package/layers/support/VoxelVariable.d.ts +4 -0
  125. package/layers/support/VoxelVolume.d.ts +4 -0
  126. package/layers/support/VoxelVolumeStyle.d.ts +4 -0
  127. package/layers/support/arcgisLayerUrl.js +1 -1
  128. package/layers/support/featureReductionUtils.js +1 -1
  129. package/layers/support/fieldUtils.js +1 -1
  130. package/layers/support/rasterFormats/Lerc.js +1 -1
  131. package/package.json +3 -3
  132. package/request.js +1 -1
  133. package/support/requestUtils.js +1 -1
  134. package/support/revision.js +1 -1
  135. package/symbols/Font.js +1 -1
  136. package/symbols/support/textUtils.js +1 -1
  137. package/views/2d/engine/brushes.js +1 -1
  138. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  139. package/views/2d/engine/webgl/Overlay.js +5 -0
  140. package/views/2d/engine/webgl/OverlayContainer.js +5 -0
  141. package/views/2d/engine/webgl/brushes/BrushOverlay.js +5 -0
  142. package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
  143. package/views/2d/engine/webgl/shaders/OverlayPrograms.js +5 -0
  144. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  145. package/views/2d/layerViewModuleImportUtils.js +1 -1
  146. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  147. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  148. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  149. package/views/2d/layers/MediaLayerView2D.js +5 -0
  150. package/views/2d/layers/StreamLayerView2D.js +1 -1
  151. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  152. package/views/2d/layers/features/FeatureStore2D.js +1 -1
  153. package/views/2d/layers/features/Pipeline.js +1 -1
  154. package/views/2d/layers/features/Store2D.js +1 -1
  155. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  156. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  157. package/views/2d/layers/features/schemaUtils.js +1 -1
  158. package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
  159. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  160. package/views/2d/layers/features/support/BinStore.js +5 -0
  161. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  162. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  163. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  164. package/views/2d/layers/support/clusterUtils.js +1 -1
  165. package/views/2d/magnifier/MagnifierView2D.js +1 -1
  166. package/views/2d/navigation/actions/Pinch.js +1 -1
  167. package/views/2d/viewpointUtils.js +1 -1
  168. package/views/3d/analysis/AnalysisView3D.js +1 -1
  169. package/views/3d/analysis/Dimensioning/DimensioningTool.js +5 -0
  170. package/views/3d/analysis/Dimensioning/DimensioningVisualization.js +1 -1
  171. package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +5 -0
  172. package/views/3d/analysis/Dimensioning/{LinearDimensionVisualization.js → LengthDimensionVisualization.js} +1 -1
  173. package/views/3d/analysis/Dimensioning/settings.js +5 -0
  174. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  175. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  176. package/views/3d/interactive/SegmentLabels3D.js +5 -0
  177. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  178. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  179. package/views/3d/interactive/editingTools/reshapeGraphic/GraphicReshapeTool.js +1 -1
  180. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  181. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  182. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  183. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  184. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  185. package/views/3d/layerViewModuleImportUtils.js +1 -1
  186. package/views/3d/layers/I3SMeshView3D.js +1 -1
  187. package/views/3d/layers/MediaLayerView3D.js +5 -0
  188. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  189. package/views/3d/layers/i3s/IDBCache.js +1 -1
  190. package/views/3d/state/controllers/RotateController.js +1 -1
  191. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  192. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  193. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  194. package/views/3d/support/ResourceController.js +1 -1
  195. package/views/3d/support/sunUtils.js +1 -1
  196. package/views/3d/terrain/TerrainRenderer.js +1 -1
  197. package/views/3d/terrain/TerrainSurface.js +1 -1
  198. package/views/3d/terrain/TileCompositor.js +1 -1
  199. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  200. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  201. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
  202. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  203. package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
  204. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  206. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  207. package/views/DOMContainer.js +1 -1
  208. package/views/GroundView.js +1 -1
  209. package/views/SceneView.js +1 -1
  210. package/views/ToolViewManager.js +1 -1
  211. package/views/View.js +1 -1
  212. package/views/draw/DrawOperation.js +1 -1
  213. package/views/draw/support/Reshape.js +1 -1
  214. package/views/interactive/GraphicManipulator.js +1 -1
  215. package/views/interactive/InteractiveToolBase.js +1 -1
  216. package/views/interactive/SegmentLabels.js +5 -0
  217. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  218. package/views/interactive/snapping/LineSnapper.js +1 -1
  219. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  220. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  221. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  222. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  223. package/views/interactive/snapping/SnappingManager.js +1 -1
  224. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  225. package/views/interactive/snapping/snappingUtils.js +1 -1
  226. package/views/interactive/support/viewUtils.js +5 -0
  227. package/views/interactive/tooltip/DrawPointTooltipInfo.js +5 -0
  228. package/views/interactive/tooltip/DrawPolygonTooltipInfo.js +5 -0
  229. package/views/interactive/tooltip/DrawPolylineTooltipInfo.js +5 -0
  230. package/views/interactive/tooltip/Tooltip.js +1 -1
  231. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  232. package/views/interactive/tooltip/support/measurements.js +5 -0
  233. package/views/layers/FeatureLayerView.js +1 -1
  234. package/views/layers/GroupLayerView.js +1 -1
  235. package/views/overlay/TextOverlayItem.js +1 -1
  236. package/views/support/Scheduler.js +1 -1
  237. package/views/support/screenUtils.js +1 -1
  238. package/webscene/Slide.js +1 -1
  239. package/widgets/Attribution/AttributionViewModel.js +1 -1
  240. package/widgets/Bookmarks.js +1 -1
  241. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  242. package/widgets/Editor/EditorViewModel.js +1 -1
  243. package/widgets/Editor/UpdateWorkflow.js +1 -1
  244. package/widgets/Editor/workflowUtils.js +1 -1
  245. package/widgets/Editor.js +1 -1
  246. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  247. package/widgets/ElevationProfile.js +1 -1
  248. package/widgets/Feature/FeatureAttachments.js +1 -1
  249. package/widgets/Feature/FeatureContent/FeatureContentViewModel.js +1 -1
  250. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  251. package/widgets/Feature/FeatureExpression.js +1 -1
  252. package/widgets/Feature/FeatureFields.js +1 -1
  253. package/widgets/Feature/FeatureViewModel.js +1 -1
  254. package/widgets/Feature.js +1 -1
  255. package/widgets/FeatureForm/InputFieldGroup.js +1 -1
  256. package/widgets/FeatureForm.js +1 -1
  257. package/widgets/FeatureTable/FieldColumn.js +1 -1
  258. package/widgets/FeatureTable/Grid/Column.js +1 -1
  259. package/widgets/FeatureTable/Grid/Grid.js +11 -11
  260. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  261. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  262. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  263. package/widgets/FeatureTemplates.js +1 -1
  264. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  265. package/widgets/FloorFilter.js +1 -1
  266. package/widgets/HistogramRangeSlider.js +1 -1
  267. package/widgets/LayerList/LayerListViewModel.js +1 -1
  268. package/widgets/LayerList/ListItem.js +1 -1
  269. package/widgets/LayerList/ListItemPanel.js +1 -1
  270. package/widgets/LayerList.js +1 -1
  271. package/widgets/Legend/LegendViewModel.js +1 -1
  272. package/widgets/Legend/styles/Card.js +1 -1
  273. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  274. package/widgets/Legend.js +1 -1
  275. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  276. package/widgets/Measurement.js +1 -1
  277. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  278. package/widgets/Popup/PopupViewModel.js +1 -1
  279. package/widgets/Popup.js +1 -1
  280. package/widgets/Print/FileLink.js +1 -1
  281. package/widgets/Print.js +1 -1
  282. package/widgets/ScaleBar.js +1 -1
  283. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  284. package/widgets/ScaleRangeSlider.js +1 -1
  285. package/widgets/Search/SearchViewModel.js +1 -1
  286. package/widgets/Search.js +1 -1
  287. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  288. package/widgets/Sketch/SketchViewModel.js +1 -1
  289. package/widgets/Sketch.js +1 -1
  290. package/widgets/TableList/ListItem.js +1 -1
  291. package/widgets/Weather/LabeledSlider.js +1 -1
  292. package/widgets/Weather/VisibleElements.js +5 -0
  293. package/widgets/Weather/css.js +1 -1
  294. package/widgets/Weather.js +1 -1
  295. package/widgets/support/AnalysisViewModel.js +1 -1
  296. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  297. package/analysis/LinearDimension.d.ts +0 -4
  298. package/analysis/LinearDimension.js +0 -5
  299. package/assets/esri/core/workers/chunks/0018053ac16a09feba70.js +0 -1
  300. package/assets/esri/core/workers/chunks/042938ca73f0b9e5a7e2.js +0 -1
  301. package/assets/esri/core/workers/chunks/048645611caa28dca7cd.js +0 -1
  302. package/assets/esri/core/workers/chunks/0b72d123386dc4ec7538.js +0 -1
  303. package/assets/esri/core/workers/chunks/13b04d5bf348ab5054c2.js +0 -1
  304. package/assets/esri/core/workers/chunks/215007e7c44811d90777.js +0 -1
  305. package/assets/esri/core/workers/chunks/31df729c17470245288c.js +0 -2
  306. package/assets/esri/core/workers/chunks/36272141b3c33cb19026.js +0 -1
  307. package/assets/esri/core/workers/chunks/36c8e8de9c3f67d32572.js +0 -1
  308. package/assets/esri/core/workers/chunks/37c428489c59df4b597b.js +0 -1
  309. package/assets/esri/core/workers/chunks/493169fd978fd543ef3b.js +0 -1
  310. package/assets/esri/core/workers/chunks/4f378ad6f4299183df85.js +0 -1
  311. package/assets/esri/core/workers/chunks/58e4c6ce1580427e7b55.js +0 -1
  312. package/assets/esri/core/workers/chunks/6c5441da675a8af35be2.js +0 -1
  313. package/assets/esri/core/workers/chunks/6ea16f6a0df946de480b.js +0 -1
  314. package/assets/esri/core/workers/chunks/7dfd70f4fa1096e56641.js +0 -1
  315. package/assets/esri/core/workers/chunks/88193e61072d7bf957f5.js +0 -1
  316. package/assets/esri/core/workers/chunks/8ccbde593c86c872e525.js +0 -1
  317. package/assets/esri/core/workers/chunks/9c6be39f1f21ab8b1c2d.js +0 -1
  318. package/assets/esri/core/workers/chunks/a73795cce722ba15b3da.js +0 -1
  319. package/assets/esri/core/workers/chunks/a8ed1a938dc164b401d9.js +0 -1
  320. package/assets/esri/core/workers/chunks/a9a73bc4875a5aeaf1b9.js +0 -1
  321. package/assets/esri/core/workers/chunks/adcc5bce6c0971c1b592.js +0 -1
  322. package/assets/esri/core/workers/chunks/afddfe620e6539991e6b.js +0 -1
  323. package/assets/esri/core/workers/chunks/b340c9bdabdb37995c8f.js +0 -1
  324. package/assets/esri/core/workers/chunks/b4c23630d6c85f7b59c0.js +0 -1
  325. package/assets/esri/core/workers/chunks/c180c40838246985479d.js +0 -1
  326. package/assets/esri/core/workers/chunks/caed2365bd296fcc8a75.js +0 -1
  327. package/assets/esri/core/workers/chunks/d85b5b73a151c6fbb658.js +0 -1
  328. package/assets/esri/core/workers/chunks/da6261673c3e1537b6a6.js +0 -1
  329. package/assets/esri/core/workers/chunks/dafe120243db6648a4ab.js +0 -1
  330. package/assets/esri/core/workers/chunks/ec6d138e8183e193f977.js +0 -1
  331. package/assets/esri/core/workers/chunks/ed4519ac9533a4d340f1.js +0 -1
  332. package/assets/esri/core/workers/chunks/f206300eef4560611728.js +0 -1
  333. package/assets/esri/core/workers/chunks/f55cbaf5a1d6ee6ac171.js +0 -1
  334. package/layers/GeoreferencedImageLayer.d.ts +0 -4
  335. package/layers/GeoreferencedImageLayer.js +0 -5
  336. package/layers/VoxelWasmManager.js +0 -5
  337. package/layers/VoxelWasmPerScene.js +0 -5
  338. package/views/3d/interactive/measurementTools/support/viewUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import i from"../../core/Accessor.js";import r from"../../core/Collection.js";import s from"../../core/Handles.js";import{init as t,watch as a,whenTrue as n}from"../../core/watchUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import y from"./support/ActiveLayerInfo.js";import{onLocaleChange as d}from"../../intl/locale.js";const h={state:"state",view:"view",allLayerViews:"all-layer-views",legendProperties:"legend-properties"},c=r.ofType(y),L=["esri.layers.BuildingSceneLayer","esri.layers.CSVLayer","esri.layers.FeatureLayer","esri.layers.GeoJSONLayer","esri.layers.GeoRSSLayer","esri.layers.GroupLayer","esri.layers.HeatmapLayer","esri.layers.ImageryLayer","esri.layers.ImageryTileLayer","esri.layers.MapImageLayer","esri.layers.OGCFeatureLayer","esri.layers.PointCloudLayer","esri.layers.StreamLayer","esri.layers.SceneLayer","esri.layers.TileLayer","esri.layers.VoxelLayer","esri.layers.WFSLayer","esri.layers.WMSLayer","esri.layers.WMTSLayer","esri.layers.WCSLayer"],_="view.basemapView.baseLayerViews",f="view.groundView.layerViews",p="view.basemapView.referenceLayerViews",u=[_,f,"view.layerViews",p];let v=class extends i{constructor(e){super(e),this._handles=new s,this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this.activeLayerInfos=new c,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null}initialize(){this._handles.add(t(this,"view",this._viewHandles),h.view),this._handles.add(d((()=>this._refresh())))}destroy(){this._destroyViewActiveLayerInfos(),this._handles.destroy(),this._handles=null,this.view=null}get state(){return this.get("view.ready")?"ready":"disabled"}_viewHandles(){this._handles.remove(h.state),this.view&&this._handles.add(t(this,"state",this._stateHandles),h.state)}_stateHandles(){this._resetAll(),"ready"===this.state&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this._handles.remove([h.allLayerViews,h.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this._handles.remove(e);const i=this._activeLayerInfosByLayerViewId[e];delete this._activeLayerInfosByLayerViewId[e],i&&i.parent&&i.parent.children.remove(i)}_watchPropertiesAndAllLayerViews(){const{allLayerViews:e}=this.view;e.length&&this._refresh(),this._handles.add(e.on("change",this._allLayerViewsChangeHandle.bind(this)),h.allLayerViews),this._handles.add(a(this,"layerInfos, basemapLegendVisible, groundLegendVisible",this._propertiesChangeHandle.bind(this)),h.legendProperties)}_allLayerViewsChangeHandle(e){e.removed.forEach((e=>this._destroyViewActiveLayerInfo(e.uid))),this._refresh()}_propertiesChangeHandle(){this._destroyViewActiveLayerInfos(),this._refresh()}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.removeAll(),this._generateLayerViews().filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this),this._sortActiveLayerInfos(this.activeLayerInfos)}_sortActiveLayerInfos(e){if(e.length<2)return;const i=[];e.forEach((r=>{if(!r.parent){const s=r.layer.parent,t=s&&"uid"in s&&this._layerViewByLayerId[s.uid],a=t&&this._activeLayerInfosByLayerViewId[t.uid];a&&e.includes(a)&&(i.push(r),r.parent=a,a.children.add(r),this._sortActiveLayerInfos(a.children))}})),e.removeMany(i);const r={};this.view.allLayerViews.forEach(((e,i)=>r[e.layer.uid]=i)),e.sort(((e,i)=>{const s=r[e.layer.uid]||0;return(r[i.layer.uid]||0)-s}))}_generateLayerViews(){const e=[];return u.filter(this._filterLayerViews,this).map(this.get,this).filter((e=>null!=e)).forEach(this._collectLayerViews("layerViews",e)),e}_filterLayerViews(e){const i=!this.basemapLegendVisible&&(e===_||e===p),r=!this.groundLegendVisible&&e===f;return!i&&!r}_collectLayerViews(e,i){const r=s=>(s&&s.forEach((s=>{i.push(s),r(s[e])})),i);return r}_filterLayerViewsByLayerInfos(e){const i=this.layerInfos;return!i||!i.length||i.some((i=>this._hasLayerInfo(i,e)))}_hasLayerInfo(e,i){const r=this._isLayerUIDMatching(e.layer,i.layer.uid);return r&&(this._layerInfosByLayerViewId[i.uid]=e),r}_isLayerUIDMatching(e,i){return e&&(e.uid===i||this._hasLayerUID(e.layers,i))}_hasLayerUID(e,i){return e&&e.some((e=>this._isLayerUIDMatching(e,i)))}_isLayerViewSupported(e){return!!L.includes(e.layer.declaredClass)&&(this._layerViewByLayerId[e.layer.uid]=e,!0)}_generateActiveLayerInfo(e){this._isLayerActive(e)?this._buildActiveLayerInfo(e):(this._handles.remove(e.uid),this._handles.add(a(e,"legendEnabled, layer.legendEnabled",(()=>this._layerActiveHandle(e))),e.uid))}_layerActiveHandle(e){this._isLayerActive(e)&&(this._handles.remove(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.get("layer.legendEnabled")}_buildActiveLayerInfo(e){const i=e.layer,r=e.uid,s=this._layerInfosByLayerViewId[r];let t=this._activeLayerInfosByLayerViewId[r];if(!t){const a=s&&void 0!==s.title&&s.layer.uid===i.uid;t=new y({layer:i,layerView:e,title:a?s.title:i.title,view:this.view,respectLayerVisibility:this.respectLayerVisibility,hideLayersNotInCurrentView:this.hideLayersNotInCurrentView,keepCacheOnDestroy:this.keepCacheOnDestroy,sublayerIds:s&&s.sublayerIds||[]}),this._activeLayerInfosByLayerViewId[r]=t}const o=i.parent&&"uid"in i.parent&&this._layerViewByLayerId[i.parent?.uid];if(t.parent=this._activeLayerInfosByLayerViewId[o?.uid],!this._handles.has(r)){const s=[a(i,"title",(e=>this._titleHandle(e,t))),a(i,"renderer?, opacity, pointSymbol?, lineSymbol?, polygonSymbol?",(()=>this._constructLegendElements(t))),n(this.view,"stationary",(()=>this._scaleHandle(t))),a(e,"_effectiveRenderer",(()=>this._constructLegendElements(t))),a(i,"effect",(()=>this._constructLegendElements(t)))];if(this.respectLayerVisibility){const r=a(e,"legendEnabled",(e=>this._legendEnabledHandle(e,t))),n=a(i,"legendEnabled",(e=>this._legendEnabledHandle(e,t)));s.push(r,n)}this._handles.add(s,r)}t.isScaleDriven||this._constructLegendElements(t),this._addActiveLayerInfo(t)}_titleHandle(e,i){i.title=e,this._constructLegendElements(i)}_legendEnabledHandle(e,i){e?this._addActiveLayerInfo(i):this._removeActiveLayerInfo(i)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){const{layerView:i,layer:r}=e;if(this._isLayerActive(i)&&!this.activeLayerInfos.includes(e)){const i=e.parent;if(i)i.children.includes(e)||i.children.push(e),this._sortActiveLayerInfos(i.children);else{const i=this.layerInfos?.some((e=>e.layer.uid===r.uid));r.parent&&"uid"in r.parent&&!i?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){const e=[];this._activeLayerInfosWithNoParent.forEach((i=>{const r=i.layer.parent,s=r&&"uid"in r&&this._layerViewByLayerId[r?.uid],t=this._activeLayerInfosByLayerViewId[s?.uid];t&&(e.push(i),i.parent=t)})),e.length&&(this._activeLayerInfosWithNoParent.removeMany(e),e.forEach((e=>this._addActiveLayerInfo(e))))}}}_removeActiveLayerInfo(e){const i=e.parent;i?i.children.remove(e):this.activeLayerInfos.remove(e)}_constructLegendElements(e){const i=e.layer;"featureCollections"in i&&i.featureCollections?e.buildLegendElementsForFeatureCollections(i.featureCollections):"renderer"in i&&i.renderer?e.buildLegendElementsForRenderer(i.renderer):"url"in i&&i.url?e.buildLegendElementsForTools():e.children.forEach((e=>this._constructLegendElements(e)))}};e([o({type:c})],v.prototype,"activeLayerInfos",void 0),e([o()],v.prototype,"basemapLegendVisible",void 0),e([o()],v.prototype,"groundLegendVisible",void 0),e([o()],v.prototype,"hideLayersNotInCurrentView",void 0),e([o()],v.prototype,"keepCacheOnDestroy",void 0),e([o()],v.prototype,"respectLayerVisibility",void 0),e([o()],v.prototype,"layerInfos",void 0),e([o({readOnly:!0})],v.prototype,"state",null),e([o()],v.prototype,"view",void 0),v=e([l("esri.widgets.Legend.LegendViewModel")],v);const I=v;export{I as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import i from"../../core/Accessor.js";import r from"../../core/Collection.js";import s from"../../core/Handles.js";import{equalsShallow as t}from"../../core/lang.js";import{watch as a,initial as n,when as l}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import d from"./support/ActiveLayerInfo.js";import{onLocaleChange as h}from"../../intl/locale.js";const c={state:"state",view:"view",allLayerViews:"all-layer-views",legendProperties:"legend-properties"},L=r.ofType(d),_=["esri.layers.BuildingSceneLayer","esri.layers.CSVLayer","esri.layers.FeatureLayer","esri.layers.GeoJSONLayer","esri.layers.GeoRSSLayer","esri.layers.GroupLayer","esri.layers.HeatmapLayer","esri.layers.ImageryLayer","esri.layers.ImageryTileLayer","esri.layers.MapImageLayer","esri.layers.OGCFeatureLayer","esri.layers.PointCloudLayer","esri.layers.StreamLayer","esri.layers.SceneLayer","esri.layers.TileLayer","esri.layers.VoxelLayer","esri.layers.WFSLayer","esri.layers.WMSLayer","esri.layers.WMTSLayer","esri.layers.WCSLayer"],f="view.basemapView.baseLayerViews",p="view.groundView.layerViews",u="view.basemapView.referenceLayerViews",v=[f,p,"view.layerViews",u];let I=class extends i{constructor(e){super(e),this._handles=new s,this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this.activeLayerInfos=new L,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null}initialize(){this._handles.add(a((()=>this.view),(()=>this._viewHandles()),n),c.view),this._handles.add(h((()=>this._refresh())))}destroy(){this._destroyViewActiveLayerInfos(),this._handles.destroy(),this._handles=null,this.view=null}get state(){return this.get("view.ready")?"ready":"disabled"}_viewHandles(){this._handles.remove(c.state),this.view&&this._handles.add(a((()=>this.state),(()=>this._stateHandles()),n),c.state)}_stateHandles(){this._resetAll(),"ready"===this.state&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this._handles.remove([c.allLayerViews,c.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this._handles.remove(e);const i=this._activeLayerInfosByLayerViewId[e];delete this._activeLayerInfosByLayerViewId[e],i&&i.parent&&i.parent.children.remove(i)}_watchPropertiesAndAllLayerViews(){const{allLayerViews:e}=this.view;e.length&&this._refresh(),this._handles.add(e.on("change",(e=>this._allLayerViewsChangeHandle(e))),c.allLayerViews),this._handles.add(a((()=>[this.layerInfos,this.basemapLegendVisible,this.groundLegendVisible]),(()=>this._propertiesChangeHandle()),{equals:t}),c.legendProperties)}_allLayerViewsChangeHandle(e){e.removed.forEach((e=>this._destroyViewActiveLayerInfo(e.uid))),this._refresh()}_propertiesChangeHandle(){this._destroyViewActiveLayerInfos(),this._refresh()}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.removeAll(),this._generateLayerViews().filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this),this._sortActiveLayerInfos(this.activeLayerInfos)}_sortActiveLayerInfos(e){if(e.length<2)return;const i=[];e.forEach((r=>{if(!r.parent){const s=r.layer.parent,t=s&&"uid"in s&&this._layerViewByLayerId[s.uid],a=t&&this._activeLayerInfosByLayerViewId[t.uid];a&&e.includes(a)&&(i.push(r),r.parent=a,a.children.add(r),this._sortActiveLayerInfos(a.children))}})),e.removeMany(i);const r={};this.view.allLayerViews.forEach(((e,i)=>r[e.layer.uid]=i)),e.sort(((e,i)=>{const s=r[e.layer.uid]||0;return(r[i.layer.uid]||0)-s}))}_generateLayerViews(){const e=[];return v.filter(this._filterLayerViews,this).map(this.get,this).filter((e=>null!=e)).forEach(this._collectLayerViews("layerViews",e)),e}_filterLayerViews(e){const i=!this.basemapLegendVisible&&(e===f||e===u),r=!this.groundLegendVisible&&e===p;return!i&&!r}_collectLayerViews(e,i){const r=s=>(s&&s.forEach((s=>{i.push(s),r(s[e])})),i);return r}_filterLayerViewsByLayerInfos(e){const i=this.layerInfos;return!i||!i.length||i.some((i=>this._hasLayerInfo(i,e)))}_hasLayerInfo(e,i){const r=this._isLayerUIDMatching(e.layer,i.layer.uid);return r&&(this._layerInfosByLayerViewId[i.uid]=e),r}_isLayerUIDMatching(e,i){return e&&(e.uid===i||this._hasLayerUID(e.layers,i))}_hasLayerUID(e,i){return e&&e.some((e=>this._isLayerUIDMatching(e,i)))}_isLayerViewSupported(e){return!!_.includes(e.layer.declaredClass)&&(this._layerViewByLayerId[e.layer.uid]=e,!0)}_generateActiveLayerInfo(e){this._isLayerActive(e)?this._buildActiveLayerInfo(e):(this._handles.remove(e.uid),this._handles.add(a((()=>[e.legendEnabled,e.layer.legendEnabled]),(()=>this._layerActiveHandle(e)),{equals:t}),e.uid))}_layerActiveHandle(e){this._isLayerActive(e)&&(this._handles.remove(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.get("layer.legendEnabled")}_buildActiveLayerInfo(e){const i=e.layer,r=e.uid,s=this._layerInfosByLayerViewId[r];let o=this._activeLayerInfosByLayerViewId[r];if(!o){const t=s&&void 0!==s.title&&s.layer.uid===i.uid;o=new d({layer:i,layerView:e,title:t?s.title:i.title,view:this.view,respectLayerVisibility:this.respectLayerVisibility,hideLayersNotInCurrentView:this.hideLayersNotInCurrentView,keepCacheOnDestroy:this.keepCacheOnDestroy,sublayerIds:s&&s.sublayerIds||[]}),this._activeLayerInfosByLayerViewId[r]=o}const y=i.parent&&"uid"in i.parent&&this._layerViewByLayerId[i.parent?.uid];if(o.parent=this._activeLayerInfosByLayerViewId[y?.uid],!this._handles.has(r)){const s=[a((()=>i.title),(e=>this._titleHandle(e,o))),a((()=>[i.opacity,"renderer"in i&&i.renderer,"pointSymbol"in i&&i.pointSymbol,"lineSymbol"in i&&i.lineSymbol,"polygonSymbol"in i&&i.polygonSymbol]),(()=>this._constructLegendElements(o)),{equals:t}),l((()=>!0===this.view?.stationary),(()=>this._scaleHandle(o)),n),a((()=>e._effectiveRenderer),(()=>this._constructLegendElements(o))),a((()=>"effect"in i&&i.effect),(()=>this._constructLegendElements(o)))];if(this.respectLayerVisibility){const r=a((()=>e.legendEnabled),(e=>this._legendEnabledHandle(e,o))),t=a((()=>i.legendEnabled),(e=>this._legendEnabledHandle(e,o)));s.push(r,t)}this._handles.add(s,r)}o.isScaleDriven||this._constructLegendElements(o),this._addActiveLayerInfo(o)}_titleHandle(e,i){i.title=e,this._constructLegendElements(i)}_legendEnabledHandle(e,i){e?this._addActiveLayerInfo(i):this._removeActiveLayerInfo(i)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){const{layerView:i,layer:r}=e;if(this._isLayerActive(i)&&!this.activeLayerInfos.includes(e)){const i=e.parent;if(i)i.children.includes(e)||i.children.push(e),this._sortActiveLayerInfos(i.children);else{const i=this.layerInfos?.some((e=>e.layer.uid===r.uid));r.parent&&"uid"in r.parent&&!i?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){const e=[];this._activeLayerInfosWithNoParent.forEach((i=>{const r=i.layer.parent,s=r&&"uid"in r&&this._layerViewByLayerId[r?.uid],t=this._activeLayerInfosByLayerViewId[s?.uid];t&&(e.push(i),i.parent=t)})),e.length&&(this._activeLayerInfosWithNoParent.removeMany(e),e.forEach((e=>this._addActiveLayerInfo(e))))}}}_removeActiveLayerInfo(e){const i=e.parent;i?i.children.remove(e):this.activeLayerInfos.remove(e)}_constructLegendElements(e){const i=e.layer;"featureCollections"in i&&i.featureCollections?e.buildLegendElementsForFeatureCollections(i.featureCollections):"renderer"in i&&i.renderer?e.buildLegendElementsForRenderer(i.renderer):"url"in i&&i.url?e.buildLegendElementsForTools():e.children.forEach((e=>this._constructLegendElements(e)))}};e([o({type:L})],I.prototype,"activeLayerInfos",void 0),e([o()],I.prototype,"basemapLegendVisible",void 0),e([o()],I.prototype,"groundLegendVisible",void 0),e([o()],I.prototype,"hideLayersNotInCurrentView",void 0),e([o()],I.prototype,"keepCacheOnDestroy",void 0),e([o()],I.prototype,"respectLayerVisibility",void 0),e([o()],I.prototype,"layerInfos",void 0),e([o({readOnly:!0})],I.prototype,"state",null),e([o()],I.prototype,"view",void 0),I=e([y("esri.widgets.Legend.LegendViewModel")],I);const w=I;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/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import t from"../../../core/Handles.js";import{pt2px as s}from"../../../core/screenUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{renderSVG as a}from"../../../symbols/support/svgUtils.js";import{getCSSFilterFromEffectList as o}from"../../../symbols/support/utils.js";import l from"../../Widget.js";import{renderRelationshipRamp as n}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as c,getUnivariateSizeRampSize as d,getUnivariateColorRampSize as p,getUnivariateColorRampPreview as m,getUnivariateColorRampMargin as h,getUnivariateColorSizeRampElements as y}from"./support/univariateUtils.js";import{getTitle as g,attachToNode as _,isImageryStretchedLegend as v}from"../support/styleUtils.js";import{Heading as u,incrementHeadingLevel as f}from"../../support/Heading.js";import{accessibleHandler as b}from"../../support/decorators/accessibleHandler.js";import{messageBundle as w}from"../../support/decorators/messageBundle.js";import{tsx as L}from"../../support/jsxFactory.js";import{isRTL as C}from"../../support/widgetUtils.js";import{substitute as x}from"../../../intl/substitute.js";const S={activated:"esri-legend--card__carousel-indicator--activated",base:"esri-legend--card",stacked:"esri-legend--stacked",carouselTitle:"esri-legend--card__carousel-title",indicator:"esri-legend--card__carousel-indicator",intervalSeparator:"esri-legend--card__interval-separator",imageryLayerStretchedImage:"esri-legend--card__imagery-layer-image--stretched",imageLabel:"esri-legend--card__image-label",layerCaption:"esri-legend--card__layer-caption",labelElement:"esri-legend--card__label-element",layerRow:"esri-legend--card__layer-row",labelCell:"esri-legend--card__label-cell",message:"esri-legend--card__message",rampLabel:"esri-legend--card__ramp-label",section:"esri-legend--card__section",relationshipSection:"esri-legend--card__relationship-section",serviceCaptionText:"esri-legend--card__service-caption-text",serviceContent:"esri-legend--card__service-content",service:"esri-legend--card__service",groupLayer:"esri-legend--card__group-layer",groupLayerChild:"esri-legend--card__group-layer-child",symbol:"esri-legend--card__symbol",sizeRampRow:"esri-legend--card__size-ramp-row",symbolRow:"esri-legend--card__symbol-row",symbolCell:"esri-legend--card__symbol-cell",indicatorContainer:"esri-legend--card__carousel-indicator-container",intervalSeparatorsContainer:"esri-legend--card__interval-separators-container",relationshipLabelContainer:"esri-legend--card__relationship-label-container",labelContainer:"esri-legend--card__label-container",serviceCaptionContainer:"esri-legend--card__service-caption-container",symbolContainer:"esri-legend--card__symbol-container",sizeRampContainer:"esri-legend--card__size-ramp-container",sizeRampPreview:"esri-legend--card__size-ramp-preview",rampContainer:"esri-legend__ramps",sizeRampHorizontal:"esri-legend__size-ramp--horizontal",rampLabelsContainer:"esri-legend__ramp-labels",layerInfo:"esri-legend__layer-cell esri-legend__layer-cell--info",univariateAboveAndBelowColorRamp:"esri-univariate-above-and-below-ramp__color--card",hidden:"esri-hidden"},R=25,z=25,$=768,I=100;var k;!function(e){e.Auto="auto",e.Stack="stack",e.SideBySide="side-by-side"}(k||(k={}));const A="#ddd",N=window.devicePixelRatio;function j(e){if(e){if(e.type.includes("3d")){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1),i=s.resource&&s.resource.primitive;return"circle"===i||"cross"===i||"kite"===i||"sphere"===i||"cube"===i||"diamond"===i}{const t=e.style;return"circle"===t||"diamond"===t||"cross"===t}}}function E(e){if(e){if(e.type.includes("3d")){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1).get("resource.primitive");return"triangle"===s||"cone"===s||"tetrahedron"===s}return"triangle"===e.style}}let F=class extends l{constructor(e,s){super(e,s),this._handles=new t,this._hasIndicators=!1,this._selectedSectionName=null,this._sectionNames=[],this._sectionMap=new Map,this.activeLayerInfos=null,this.headingLevel=3,this.layout=k.Stack,this.messages=null,this.messagesCommon=null,this.type="card",this.view=null}initialize(){this.own([this.watch("activeLayerInfos",(e=>{this._handles.removeAll(),this._watchForSectionChanges(e)}))])}destroy(){this._handles.destroy(),this._handles=null}render(){this._hasIndicators=this.layout===k.Auto&&this.view.container.clientWidth<=$||this.layout===k.Stack;const e=this.activeLayerInfos,t=e&&e.toArray().map((e=>this._renderLegendForLayer(e))).filter((e=>!!e));this._hasIndicators?this._selectedSectionName&&this._sectionNames.includes(this._selectedSectionName)||(this._selectedSectionName=this._sectionNames&&this._sectionNames[0]):this._selectedSectionName=null;const s=this._sectionNames.length,i=this._sectionNames.map(((e,t)=>{const i=x(this.messagesCommon.pagination.pageText,{index:t+1,total:s});return L("div",{key:e,role:"tab",id:e,"aria-label":i,"aria-controls":`${e}-panel`,"aria-selected":(this._selectedSectionName===e).toString(),tabIndex:this._selectedSectionName===e?0:-1,title:i,onclick:this._selectSection,onkeydown:this._focusSection,bind:this,class:this.classes(S.indicator,{[S.activated]:this._selectedSectionName===e}),"data-section-name":e})})),r=this._hasIndicators&&s>1?L("div",{class:S.indicatorContainer,key:"carousel-navigation",role:"tablist"},i):null,a=this._hasIndicators?this._sectionMap.get(this._selectedSectionName):t&&t.length?t:null,o={[S.stacked]:this._hasIndicators};return L("div",{class:this.classes(S.base,o)},a||L("div",{class:S.message},this.messages.noLegend),r)}_selectSection(e){const t=e.target.getAttribute("data-section-name");t&&(this._selectedSectionName=t)}_focusSection(e){switch(e.key){case"ArrowLeft":case"ArrowRight":this._switchSectionOnArrowPress(e);break;case"Enter":case" ":this._selectSection(e)}}_switchSectionOnArrowPress(e){const t=e.key,s="ArrowLeft"===t?-1:1,i=e.target.getAttribute("data-section-name"),r=this._sectionNames.indexOf(i),a=this._sectionNames;let o=null;-1!==r&&(a[r+s]?o=document.getElementById(a[r+s]):"ArrowLeft"===t?o=document.getElementById(a[a.length-1]):"ArrowRight"===t&&(o=document.getElementById(a[0])),o&&o.focus())}_watchForSectionChanges(e){if(this._generateSectionNames(),e){e.forEach((e=>{const t=`activeLayerInfo-${e.layer.uid}-version-change`;this._handles.remove(t),this._watchForSectionChanges(e.children),this._handles.add(e.watch("version",(()=>this._generateSectionNames())),t)}));const t="activeLayerInfos-collection-change";this._handles.remove(t),this._handles.add(e.on("change",(()=>this._watchForSectionChanges(e))),t)}}_generateSectionNames(){this._sectionNames.length=0,this._selectedSectionName=null,this.activeLayerInfos&&this.activeLayerInfos.forEach(this._generateSectionNamesForActiveLayerInfo,this)}_getSectionName(e,t,s){return`${this.id}${e.uid}-type-${t.type}-${s}`}_generateSectionNamesForActiveLayerInfo(e){e.children.forEach(this._generateSectionNamesForActiveLayerInfo,this),e.legendElements&&e.legendElements.forEach(((t,s)=>{this._sectionNames.push(this._getSectionName(e.layer,t,s))}))}_renderLegendForLayer(e){if(!e.ready)return null;if(e.children.length){const t=e.children.map((e=>this._renderLegendForLayer(e))).toArray();return L("div",{key:e.layer.uid,class:this.classes(S.service,S.groupLayer)},L("div",{class:S.serviceCaptionContainer},e.title),t)}{const t=e.legendElements;if(t&&!t.length)return null;const s=t.some((e=>"relationship-ramp"===e.type)),i=t.map(((t,i)=>this._renderLegendForElement(t,e,i,s))).filter((e=>!!e));if(!i.length)return null;const r={[S.groupLayerChild]:!!e.parent};return L("div",{key:e.layer.uid,class:this.classes(S.service,r)},L("div",{class:S.serviceCaptionContainer},L("div",{class:S.serviceCaptionText},e.title)),L("div",{class:S.serviceContent},i))}}_renderLegendForElement(e,t,s,i=!1){const r="color-ramp"===e.type,a="opacity-ramp"===e.type,o="size-ramp"===e.type,l=t.layer;let c=null;if("string"==typeof e.title)c=e.title;else if(e.title){const t=e.title,s=g(this.messages,t,r||a);c=t.title?`${t.title} (${s})`:s}const d=this._getSectionName(l,e,s),p=this._hasIndicators?L("div",null,L(u,{level:this.headingLevel,class:S.carouselTitle},t.title),L(u,{level:f(this.headingLevel),class:S.layerCaption},c)):c?L(u,{level:this.headingLevel,class:S.layerCaption},c):null,m=t.effectList;let h=null;if("symbol-table"===e.type){const s=e.infos.map(((s,i)=>this._renderLegendForElementInfo(s,t,e.legendType,i))).filter((e=>!!e));if(s.length){const e=s[0].properties.classes&&s[0].properties.classes[S.symbolRow],t={[S.labelContainer]:!e&&!i,[S.relationshipLabelContainer]:i};h=L("div",{class:this.classes(t)},s)}}else"color-ramp"===e.type||"opacity-ramp"===e.type||"heatmap-ramp"===e.type?h=this._renderLegendForRamp(e,l.opacity,m):o?h=this._renderSizeRamp(e,l.opacity):"relationship-ramp"===e.type?h=n(e,this.id,l.opacity,m):"univariate-above-and-below-ramp"===e.type?h=this._renderUnivariateAboveAndBelowRamp(e,l.opacity,m):"univariate-color-size-ramp"===e.type&&(h=this._renderUnivariateColorSizeRamp(e,l.opacity,m));if(!h)return null;const y=L("div",{key:d,class:S.section,id:`${d}-panel`,role:"tabpanel","aria-labelledby":d,tabIndex:0},[p,h]);return this._sectionMap.set(d,y),y}_renderUnivariateAboveAndBelowRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=c(e,t,"horizontal");if(!i)return null;const a=d(i,"full",!0,"horizontal"),o=p(i,"above",!0,"horizontal"),l=p(i,"below",!0,"horizontal"),n=12,y=m(r,{width:o,height:n,rampAlignment:"horizontal",opacity:t,type:"above",effectList:s}),g=m(r,{width:l,height:n,rampAlignment:"horizontal",opacity:t,type:"below",effectList:s}),v=h(i,"card"),u=i.infos.map((e=>e.label)),f=u.length-1,b=u.map(((e,t)=>0===t||t===f?L("div",{key:t},e):null)),w={display:"flex",flexDirection:"column"},x={display:"flex",flexDirection:"row"},R={marginTop:"3px",display:"flex"};C(this.container)?R.marginRight=`${v}px`:R.marginLeft=`${v}px`;const z={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:w},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:x},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),y?L("div",{class:S.univariateAboveAndBelowColorRamp,styles:R,key:"color-ramp-preview"},L("div",{bind:y,afterCreate:_}),L("div",{bind:g,afterCreate:_})):null,L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:z},b)))}_renderUnivariateColorSizeRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=y(e,"horizontal");if(!i)return null;const a=d(i,"full",!1,"horizontal"),o=p(i,"full",!1,"horizontal"),l=m(r,{width:o,height:12,rampAlignment:"horizontal",opacity:t,type:"full",effectList:s}),n=h(i,"card"),c=i.infos.length-1,g=i.infos.map(((e,t)=>0===t||t===c?L("div",{key:t},e.label):null)),v={display:"flex",flexDirection:"column"},u={display:"flex",flexDirection:"row"},f={marginTop:"3px",display:"flex"};C(this.container)?f.marginRight=`${n}px`:f.marginLeft=`${n}px`;const b={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:v},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:u},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),L("div",{class:S.univariateAboveAndBelowColorRamp,styles:f,key:"color-ramp-preview"},L("div",{bind:l,afterCreate:_})),L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:b},g)))}_renderLegendForElementInfo(e,t,s,i){const r=t.layer;if(e.type)return this._renderLegendForElement(e,t,i);const a=v(r,s);if(e.preview){if(!e.symbol||!e.symbol.type.includes("simple-fill")){if(!e.label)return L("div",{key:i,bind:e.preview,afterCreate:_});const t={[S.symbolCell]:this._hasIndicators};return L("div",{key:i,class:this.classes(S.layerRow,{[S.symbolRow]:this._hasIndicators})},L("div",{class:this.classes(t),bind:e.preview,afterCreate:_}),L("div",{class:this.classes(S.imageLabel,{[S.labelCell]:this._hasIndicators})},g(this.messages,e.label,!1)||""))}let s=255,a=255,l=255,n=0,c=255,d=255,p=255,m=0;const h=e.symbol.color&&e.symbol.color.a,y=e.symbol.outline&&e.symbol.outline.color&&e.symbol.outline.color.a;h&&(s=e.symbol.color.r,a=e.symbol.color.g,l=e.symbol.color.b,n=e.symbol.color.a*r.opacity),y&&(c=e.symbol.outline.color.r,d=e.symbol.outline.color.g,p=e.symbol.outline.color.b,m=e.symbol.outline.color.a*r.opacity);const v=e.symbol.color?.isBright??!0,u=v?"rgba(255, 255, 255, .6)":"rgba(0, 0, 0, .6)",f={background:h?`rgba(${s}, ${a}, ${l}, ${n})`:"none",color:v?"black":"white",textShadow:`-1px -1px 0 ${u},\n 1px -1px 0 ${u},\n -1px 1px 0 ${u},\n 1px 1px 0 ${u}`,border:y?`1px solid rgba(${c}, ${d}, ${p}, ${m})`:"none",filter:o(t.effectList)};return L("div",{key:i,class:S.layerRow},L("div",{class:S.labelElement,styles:f}," ",e.label," "))}if(e.src){const t=this._renderImage(e,r,a);return L("div",{key:i,class:S.layerRow},t,L("div",{class:S.imageLabel},e.label||""))}}_renderImage(e,t,s){const{label:i,src:r,opacity:a}=e,o={[S.imageryLayerStretchedImage]:s,[S.symbol]:!s},l={opacity:`${null!=a?a:t.opacity}`};return L("img",{alt:g(this.messages,i,!1),src:r,border:0,width:e.width,height:e.height,class:this.classes(o),styles:l})}_renderSizeRampLines(e){const t=e.infos,i=t[0],r=t[t.length-1],a=i.symbol,o=this._hasIndicators,l=s(i.size+i.outlineSize)*N,n=s(r.size+r.outlineSize)*N,c=o?l:l+50*N,d=o?l/2+50*N:l,p=E(a),m=j(a),h=document.createElement("canvas");h.width=c,h.height=d,h.style.width=h.width/N+"px",h.style.height=h.height/N+"px";const y=h.getContext("2d");if(o){y.beginPath();const e=0,t=0,s=c/2-n/2,i=d;y.moveTo(e,t),y.lineTo(s,i);const r=c,a=0,o=c/2+n/2,l=d;y.moveTo(r,a),y.lineTo(o,l)}else{y.beginPath();const e=0,t=d/2-n/2,s=c,i=0;y.moveTo(e,t),y.lineTo(s,i);const r=0,a=d/2+n/2,o=c,l=d;y.moveTo(r,a),y.lineTo(o,l)}return y.strokeStyle=A,y.stroke(),L("div",{bind:h,afterCreate:_,styles:o?{display:"flex",marginTop:`-${p?0:m?l/2:0}px`,marginBottom:`-${p?n:m?n/2:0}px`}:{display:"flex",marginRight:`-${p?0:m?l/2:0}px`,marginLeft:`-${p?0:m?n/2:0}px`}})}_renderSizeRamp(e,t){const s=e.infos,i=s[0].label,r=s[s.length-1].label;let a=s[0].preview,o=s[s.length-1].preview;const l=this._hasIndicators,n={"flex-direction":l?"column":"row-reverse"};a&&(a=a.cloneNode(!0),a.style.display="flex"),o&&(o=o.cloneNode(!0),o.style.display="flex");const c={opacity:null!=t?`${t}`:""};return L("div",{class:this.classes(S.layerRow,{[S.sizeRampRow]:l})},L("div",{class:S.rampLabel},l?i:r),L("div",{class:S.sizeRampContainer,styles:n},L("div",{bind:a,afterCreate:_,class:S.sizeRampPreview,styles:c}),this._renderSizeRampLines(e),L("div",{bind:o,afterCreate:_,class:S.sizeRampContainer,styles:c})),L("div",{class:S.rampLabel},l?r:i))}_renderLegendForRamp(e,t,s){const i=e.infos,r="heatmap-ramp"===e.type,l=i.length-1,n=z,c=l>2&&!r?R*l:I,d=c+20,p=10,m=i.slice(0).reverse();m.forEach(((e,t)=>{e.offset=r?e.ratio:t/l}));const h=m.length-1,y=m.length%2!=0&&m[m.length/2|0],g=y&&L("div",{class:S.intervalSeparatorsContainer},L("div",{class:S.intervalSeparator},"|"),L("div",{class:S.rampLabel},y.label)),_=i[i.length-1].label,v=i[0].label,u=[[{shape:{type:"path",path:`M0 ${n/2} L${p} 0 L${p} ${n} Z`},fill:m[0].color,stroke:{width:0}},{shape:{type:"rect",x:p,y:0,width:c,height:n},fill:{type:"linear",x1:p,y1:0,x2:c+p,y2:0,colors:m},stroke:{width:0}},{shape:{type:"path",path:`M${c+p} 0 L${d} ${n/2} L${c+p} ${n} Z`},fill:m[h].color,stroke:{width:0}}]],f=a(u,d,n),{messages:b}=this,w={filter:o(s),opacity:null==t?null:`${t}`},C={justifyContent:"center"};return L("div",{class:S.layerRow,styles:C},L("div",{class:S.rampLabel},r?b[_]:_),L("div",{class:S.symbolContainer},L("div",{styles:w},f),g),L("div",{class:S.rampLabel},r?b[v]:v))}};e([i()],F.prototype,"activeLayerInfos",void 0),e([i()],F.prototype,"headingLevel",void 0),e([i()],F.prototype,"layout",void 0),e([i(),w("esri/widgets/Legend/t9n/Legend")],F.prototype,"messages",void 0),e([i(),w("esri/t9n/common")],F.prototype,"messagesCommon",void 0),e([i({readOnly:!0})],F.prototype,"type",void 0),e([i()],F.prototype,"view",void 0),e([b()],F.prototype,"_selectSection",null),F=e([r("esri.widgets.Legend.styles.Card")],F);const T=F;export{T as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import t from"../../../core/Handles.js";import{watch as s}from"../../../core/reactiveUtils.js";import{pt2px as i}from"../../../core/screenUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{renderSVG as o}from"../../../symbols/support/svgUtils.js";import{getCSSFilterFromEffectList as l}from"../../../symbols/support/utils.js";import n from"../../Widget.js";import{renderRelationshipRamp as c}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as d,getUnivariateSizeRampSize as p,getUnivariateColorRampSize as m,getUnivariateColorRampPreview as h,getUnivariateColorRampMargin as y,getUnivariateColorSizeRampElements as g}from"./support/univariateUtils.js";import{getTitle as _,attachToNode as v,isImageryStretchedLegend as u}from"../support/styleUtils.js";import{Heading as f,incrementHeadingLevel as b}from"../../support/Heading.js";import{accessibleHandler as w}from"../../support/decorators/accessibleHandler.js";import{messageBundle as L}from"../../support/decorators/messageBundle.js";import{tsx as C}from"../../support/jsxFactory.js";import{isRTL as x}from"../../support/widgetUtils.js";import{substitute as S}from"../../../intl/substitute.js";const R={activated:"esri-legend--card__carousel-indicator--activated",base:"esri-legend--card",stacked:"esri-legend--stacked",carouselTitle:"esri-legend--card__carousel-title",indicator:"esri-legend--card__carousel-indicator",intervalSeparator:"esri-legend--card__interval-separator",imageryLayerStretchedImage:"esri-legend--card__imagery-layer-image--stretched",imageLabel:"esri-legend--card__image-label",layerCaption:"esri-legend--card__layer-caption",labelElement:"esri-legend--card__label-element",layerRow:"esri-legend--card__layer-row",labelCell:"esri-legend--card__label-cell",message:"esri-legend--card__message",rampLabel:"esri-legend--card__ramp-label",section:"esri-legend--card__section",relationshipSection:"esri-legend--card__relationship-section",serviceCaptionText:"esri-legend--card__service-caption-text",serviceContent:"esri-legend--card__service-content",service:"esri-legend--card__service",groupLayer:"esri-legend--card__group-layer",groupLayerChild:"esri-legend--card__group-layer-child",symbol:"esri-legend--card__symbol",sizeRampRow:"esri-legend--card__size-ramp-row",symbolRow:"esri-legend--card__symbol-row",symbolCell:"esri-legend--card__symbol-cell",indicatorContainer:"esri-legend--card__carousel-indicator-container",intervalSeparatorsContainer:"esri-legend--card__interval-separators-container",relationshipLabelContainer:"esri-legend--card__relationship-label-container",labelContainer:"esri-legend--card__label-container",serviceCaptionContainer:"esri-legend--card__service-caption-container",symbolContainer:"esri-legend--card__symbol-container",sizeRampContainer:"esri-legend--card__size-ramp-container",sizeRampPreview:"esri-legend--card__size-ramp-preview",rampContainer:"esri-legend__ramps",sizeRampHorizontal:"esri-legend__size-ramp--horizontal",rampLabelsContainer:"esri-legend__ramp-labels",layerInfo:"esri-legend__layer-cell esri-legend__layer-cell--info",univariateAboveAndBelowColorRamp:"esri-univariate-above-and-below-ramp__color--card",hidden:"esri-hidden"},z=25,$=25,I=768,k=100;var A;!function(e){e.Auto="auto",e.Stack="stack",e.SideBySide="side-by-side"}(A||(A={}));const N="#ddd",j=window.devicePixelRatio;function E(e){if(e){if(e.type.includes("3d")){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1),i=s.resource&&s.resource.primitive;return"circle"===i||"cross"===i||"kite"===i||"sphere"===i||"cube"===i||"diamond"===i}{const t=e.style;return"circle"===t||"diamond"===t||"cross"===t}}}function F(e){if(e){if(e.type.includes("3d")){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1).get("resource.primitive");return"triangle"===s||"cone"===s||"tetrahedron"===s}return"triangle"===e.style}}let T=class extends n{constructor(e,s){super(e,s),this._handles=new t,this._hasIndicators=!1,this._selectedSectionName=null,this._sectionNames=[],this._sectionMap=new Map,this.activeLayerInfos=null,this.headingLevel=3,this.layout=A.Stack,this.messages=null,this.messagesCommon=null,this.type="card",this.view=null}initialize(){this.own(s((()=>this.activeLayerInfos),(e=>{this._handles.removeAll(),this._watchForSectionChanges(e)})))}destroy(){this._handles.destroy(),this._handles=null}render(){this._hasIndicators=this.layout===A.Auto&&this.view.container.clientWidth<=I||this.layout===A.Stack;const e=this.activeLayerInfos,t=e&&e.toArray().map((e=>this._renderLegendForLayer(e))).filter((e=>!!e));this._hasIndicators?this._selectedSectionName&&this._sectionNames.includes(this._selectedSectionName)||(this._selectedSectionName=this._sectionNames&&this._sectionNames[0]):this._selectedSectionName=null;const s=this._sectionNames.length,i=this._sectionNames.map(((e,t)=>{const i=S(this.messagesCommon.pagination.pageText,{index:t+1,total:s});return C("div",{key:e,role:"tab",id:e,"aria-label":i,"aria-controls":`${e}-panel`,"aria-selected":(this._selectedSectionName===e).toString(),tabIndex:this._selectedSectionName===e?0:-1,title:i,onclick:this._selectSection,onkeydown:this._focusSection,bind:this,class:this.classes(R.indicator,{[R.activated]:this._selectedSectionName===e}),"data-section-name":e})})),r=this._hasIndicators&&s>1?C("div",{class:R.indicatorContainer,key:"carousel-navigation",role:"tablist"},i):null,a=this._hasIndicators?this._sectionMap.get(this._selectedSectionName):t&&t.length?t:null,o={[R.stacked]:this._hasIndicators};return C("div",{class:this.classes(R.base,o)},a||C("div",{class:R.message},this.messages.noLegend),r)}_selectSection(e){const t=e.target.getAttribute("data-section-name");t&&(this._selectedSectionName=t)}_focusSection(e){switch(e.key){case"ArrowLeft":case"ArrowRight":this._switchSectionOnArrowPress(e);break;case"Enter":case" ":this._selectSection(e)}}_switchSectionOnArrowPress(e){const t=e.key,s="ArrowLeft"===t?-1:1,i=e.target.getAttribute("data-section-name"),r=this._sectionNames.indexOf(i),a=this._sectionNames;let o=null;-1!==r&&(a[r+s]?o=document.getElementById(a[r+s]):"ArrowLeft"===t?o=document.getElementById(a[a.length-1]):"ArrowRight"===t&&(o=document.getElementById(a[0])),o&&o.focus())}_watchForSectionChanges(e){if(this._generateSectionNames(),e){e.forEach((e=>{const t=`activeLayerInfo-${e.layer.uid}-version-change`;this._handles.remove(t),this._watchForSectionChanges(e.children),this._handles.add(s((()=>e.version),(()=>this._generateSectionNames())),t)}));const t="activeLayerInfos-collection-change";this._handles.remove(t),this._handles.add(e.on("change",(()=>this._watchForSectionChanges(e))),t)}}_generateSectionNames(){this._sectionNames.length=0,this._selectedSectionName=null,this.activeLayerInfos&&this.activeLayerInfos.forEach(this._generateSectionNamesForActiveLayerInfo,this)}_getSectionName(e,t,s){return`${this.id}${e.uid}-type-${t.type}-${s}`}_generateSectionNamesForActiveLayerInfo(e){e.children.forEach(this._generateSectionNamesForActiveLayerInfo,this),e.legendElements&&e.legendElements.forEach(((t,s)=>{this._sectionNames.push(this._getSectionName(e.layer,t,s))}))}_renderLegendForLayer(e){if(!e.ready)return null;if(e.children.length){const t=e.children.map((e=>this._renderLegendForLayer(e))).toArray();return C("div",{key:e.layer.uid,class:this.classes(R.service,R.groupLayer)},C("div",{class:R.serviceCaptionContainer},e.title),t)}{const t=e.legendElements;if(t&&!t.length)return null;const s=t.some((e=>"relationship-ramp"===e.type)),i=t.map(((t,i)=>this._renderLegendForElement(t,e,i,s))).filter((e=>!!e));if(!i.length)return null;const r={[R.groupLayerChild]:!!e.parent};return C("div",{key:e.layer.uid,class:this.classes(R.service,r)},C("div",{class:R.serviceCaptionContainer},C("div",{class:R.serviceCaptionText},e.title)),C("div",{class:R.serviceContent},i))}}_renderLegendForElement(e,t,s,i=!1){const r="color-ramp"===e.type,a="opacity-ramp"===e.type,o="size-ramp"===e.type,l=t.layer;let n=null;if("string"==typeof e.title)n=e.title;else if(e.title){const t=e.title,s=_(this.messages,t,r||a);n=t.title?`${t.title} (${s})`:s}const d=this._getSectionName(l,e,s),p=this._hasIndicators?C("div",null,C(f,{level:this.headingLevel,class:R.carouselTitle},t.title),C(f,{level:b(this.headingLevel),class:R.layerCaption},n)):n?C(f,{level:this.headingLevel,class:R.layerCaption},n):null,m=t.effectList;let h=null;if("symbol-table"===e.type){const s=e.infos.map(((s,i)=>this._renderLegendForElementInfo(s,t,e.legendType,i))).filter((e=>!!e));if(s.length){const e=s[0].properties.classes&&s[0].properties.classes[R.symbolRow],t={[R.labelContainer]:!e&&!i,[R.relationshipLabelContainer]:i};h=C("div",{class:this.classes(t)},s)}}else"color-ramp"===e.type||"opacity-ramp"===e.type||"heatmap-ramp"===e.type?h=this._renderLegendForRamp(e,l.opacity,m):o?h=this._renderSizeRamp(e,l.opacity):"relationship-ramp"===e.type?h=c(e,this.id,l.opacity,m):"univariate-above-and-below-ramp"===e.type?h=this._renderUnivariateAboveAndBelowRamp(e,l.opacity,m):"univariate-color-size-ramp"===e.type&&(h=this._renderUnivariateColorSizeRamp(e,l.opacity,m));if(!h)return null;const y=C("div",{key:d,class:R.section,id:`${d}-panel`,role:"tabpanel","aria-labelledby":d,tabIndex:0},[p,h]);return this._sectionMap.set(d,y),y}_renderUnivariateAboveAndBelowRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=d(e,t,"horizontal");if(!i)return null;const a=p(i,"full",!0,"horizontal"),o=m(i,"above",!0,"horizontal"),l=m(i,"below",!0,"horizontal"),n=12,c=h(r,{width:o,height:n,rampAlignment:"horizontal",opacity:t,type:"above",effectList:s}),g=h(r,{width:l,height:n,rampAlignment:"horizontal",opacity:t,type:"below",effectList:s}),_=y(i,"card"),u=i.infos.map((e=>e.label)),f=u.length-1,b=u.map(((e,t)=>0===t||t===f?C("div",{key:t},e):null)),w={display:"flex",flexDirection:"column"},L={display:"flex",flexDirection:"row"},S={marginTop:"3px",display:"flex"};x(this.container)?S.marginRight=`${_}px`:S.marginLeft=`${_}px`;const z={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return C("div",{class:R.layerRow,key:"size-ramp-preview",styles:w},C("div",{class:this.classes(R.symbolContainer,R.sizeRampHorizontal),styles:L},i.infos.map(((e,t)=>C("div",{key:t,class:R.symbol,bind:e.preview,afterCreate:v})))),c?C("div",{class:R.univariateAboveAndBelowColorRamp,styles:S,key:"color-ramp-preview"},C("div",{bind:c,afterCreate:v}),C("div",{bind:g,afterCreate:v})):null,C("div",{class:R.layerInfo},C("div",{class:R.rampLabelsContainer,styles:z},b)))}_renderUnivariateColorSizeRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=g(e,"horizontal");if(!i)return null;const a=p(i,"full",!1,"horizontal"),o=m(i,"full",!1,"horizontal"),l=h(r,{width:o,height:12,rampAlignment:"horizontal",opacity:t,type:"full",effectList:s}),n=y(i,"card"),c=i.infos.length-1,d=i.infos.map(((e,t)=>0===t||t===c?C("div",{key:t},e.label):null)),_={display:"flex",flexDirection:"column"},u={display:"flex",flexDirection:"row"},f={marginTop:"3px",display:"flex"};x(this.container)?f.marginRight=`${n}px`:f.marginLeft=`${n}px`;const b={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return C("div",{class:R.layerRow,key:"size-ramp-preview",styles:_},C("div",{class:this.classes(R.symbolContainer,R.sizeRampHorizontal),styles:u},i.infos.map(((e,t)=>C("div",{key:t,class:R.symbol,bind:e.preview,afterCreate:v})))),C("div",{class:R.univariateAboveAndBelowColorRamp,styles:f,key:"color-ramp-preview"},C("div",{bind:l,afterCreate:v})),C("div",{class:R.layerInfo},C("div",{class:R.rampLabelsContainer,styles:b},d)))}_renderLegendForElementInfo(e,t,s,i){const r=t.layer;if(e.type)return this._renderLegendForElement(e,t,i);const a=u(r,s);if(e.preview){if(!e.symbol||!e.symbol.type.includes("simple-fill")){if(!e.label)return C("div",{key:i,bind:e.preview,afterCreate:v});const t={[R.symbolCell]:this._hasIndicators};return C("div",{key:i,class:this.classes(R.layerRow,{[R.symbolRow]:this._hasIndicators})},C("div",{class:this.classes(t),bind:e.preview,afterCreate:v}),C("div",{class:this.classes(R.imageLabel,{[R.labelCell]:this._hasIndicators})},_(this.messages,e.label,!1)||""))}let s=255,a=255,o=255,n=0,c=255,d=255,p=255,m=0;const h=e.symbol.color&&e.symbol.color.a,y=e.symbol.outline&&e.symbol.outline.color&&e.symbol.outline.color.a;h&&(s=e.symbol.color.r,a=e.symbol.color.g,o=e.symbol.color.b,n=e.symbol.color.a*r.opacity),y&&(c=e.symbol.outline.color.r,d=e.symbol.outline.color.g,p=e.symbol.outline.color.b,m=e.symbol.outline.color.a*r.opacity);const g=e.symbol.color?.isBright??!0,u=g?"rgba(255, 255, 255, .6)":"rgba(0, 0, 0, .6)",f={background:h?`rgba(${s}, ${a}, ${o}, ${n})`:"none",color:g?"black":"white",textShadow:`-1px -1px 0 ${u},\n 1px -1px 0 ${u},\n -1px 1px 0 ${u},\n 1px 1px 0 ${u}`,border:y?`1px solid rgba(${c}, ${d}, ${p}, ${m})`:"none",filter:l(t.effectList)};return C("div",{key:i,class:R.layerRow},C("div",{class:R.labelElement,styles:f}," ",e.label," "))}if(e.src){const t=this._renderImage(e,r,a);return C("div",{key:i,class:R.layerRow},t,C("div",{class:R.imageLabel},e.label||""))}}_renderImage(e,t,s){const{label:i,src:r,opacity:a}=e,o={[R.imageryLayerStretchedImage]:s,[R.symbol]:!s},l={opacity:`${null!=a?a:t.opacity}`};return C("img",{alt:_(this.messages,i,!1),src:r,border:0,width:e.width,height:e.height,class:this.classes(o),styles:l})}_renderSizeRampLines(e){const t=e.infos,s=t[0],r=t[t.length-1],a=s.symbol,o=this._hasIndicators,l=i(s.size+s.outlineSize)*j,n=i(r.size+r.outlineSize)*j,c=o?l:l+50*j,d=o?l/2+50*j:l,p=F(a),m=E(a),h=document.createElement("canvas");h.width=c,h.height=d,h.style.width=h.width/j+"px",h.style.height=h.height/j+"px";const y=h.getContext("2d");if(o){y.beginPath();const e=0,t=0,s=c/2-n/2,i=d;y.moveTo(e,t),y.lineTo(s,i);const r=c,a=0,o=c/2+n/2,l=d;y.moveTo(r,a),y.lineTo(o,l)}else{y.beginPath();const e=0,t=d/2-n/2,s=c,i=0;y.moveTo(e,t),y.lineTo(s,i);const r=0,a=d/2+n/2,o=c,l=d;y.moveTo(r,a),y.lineTo(o,l)}return y.strokeStyle=N,y.stroke(),C("div",{bind:h,afterCreate:v,styles:o?{display:"flex",marginTop:`-${p?0:m?l/2:0}px`,marginBottom:`-${p?n:m?n/2:0}px`}:{display:"flex",marginRight:`-${p?0:m?l/2:0}px`,marginLeft:`-${p?0:m?n/2:0}px`}})}_renderSizeRamp(e,t){const s=e.infos,i=s[0].label,r=s[s.length-1].label;let a=s[0].preview,o=s[s.length-1].preview;const l=this._hasIndicators,n={"flex-direction":l?"column":"row-reverse"};a&&(a=a.cloneNode(!0),a.style.display="flex"),o&&(o=o.cloneNode(!0),o.style.display="flex");const c={opacity:null!=t?`${t}`:""};return C("div",{class:this.classes(R.layerRow,{[R.sizeRampRow]:l})},C("div",{class:R.rampLabel},l?i:r),C("div",{class:R.sizeRampContainer,styles:n},C("div",{bind:a,afterCreate:v,class:R.sizeRampPreview,styles:c}),this._renderSizeRampLines(e),C("div",{bind:o,afterCreate:v,class:R.sizeRampContainer,styles:c})),C("div",{class:R.rampLabel},l?r:i))}_renderLegendForRamp(e,t,s){const i=e.infos,r="heatmap-ramp"===e.type,a=i.length-1,n=$,c=a>2&&!r?z*a:k,d=c+20,p=10,m=i.slice(0).reverse();m.forEach(((e,t)=>{e.offset=r?e.ratio:t/a}));const h=m.length-1,y=m.length%2!=0&&m[m.length/2|0],g=y&&C("div",{class:R.intervalSeparatorsContainer},C("div",{class:R.intervalSeparator},"|"),C("div",{class:R.rampLabel},y.label)),_=i[i.length-1].label,v=i[0].label,u=[[{shape:{type:"path",path:`M0 ${n/2} L${p} 0 L${p} ${n} Z`},fill:m[0].color,stroke:{width:0}},{shape:{type:"rect",x:p,y:0,width:c,height:n},fill:{type:"linear",x1:p,y1:0,x2:c+p,y2:0,colors:m},stroke:{width:0}},{shape:{type:"path",path:`M${c+p} 0 L${d} ${n/2} L${c+p} ${n} Z`},fill:m[h].color,stroke:{width:0}}]],f=o(u,d,n),{messages:b}=this,w={filter:l(s),opacity:null==t?null:`${t}`},L={justifyContent:"center"};return C("div",{class:R.layerRow,styles:L},C("div",{class:R.rampLabel},r?b[_]:_),C("div",{class:R.symbolContainer},C("div",{styles:w},f),g),C("div",{class:R.rampLabel},r?b[v]:v))}};e([r()],T.prototype,"activeLayerInfos",void 0),e([r()],T.prototype,"headingLevel",void 0),e([r()],T.prototype,"layout",void 0),e([r(),L("esri/widgets/Legend/t9n/Legend")],T.prototype,"messages",void 0),e([r(),L("esri/t9n/common")],T.prototype,"messagesCommon",void 0),e([r({readOnly:!0})],T.prototype,"type",void 0),e([r()],T.prototype,"view",void 0),e([w()],T.prototype,"_selectSection",null),T=e([a("esri.widgets.Legend.styles.Card")],T);const B=T;export{B as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import{addTokenParameter as s}from"../../../kernel.js";import l from"../../../request.js";import"../../../symbols.js";import r from"../../../core/Accessor.js";import i from"../../../core/Collection.js";import n from"../../../core/Handles.js";import{JSONMap as a}from"../../../core/jsonMap.js";import o from"../../../core/Logger.js";import{unwrap as u,isSome as c}from"../../../core/maybe.js";import{eachAlways as d,debounce as y}from"../../../core/promiseUtils.js";import{px2pt as h}from"../../../core/screenUtils.js";import{addQueryParameters as m}from"../../../core/urlUtils.js";import{on as p,init as f,whenFalseOnce as g,watch as b}from"../../../core/watchUtils.js";import{property as S}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{OriginId as w}from"../../../core/accessorSupport/PropertyOrigin.js";import{EffectView as v}from"../../../layers/effects/EffectView.js";import{effectFunctionsFromJSON as L}from"../../../layers/effects/jsonUtils.js";import{ExportImageParameters as E}from"../../../layers/support/ExportImageParameters.js";import{isDateField as I}from"../../../layers/support/fieldUtils.js";import{fromJSON as C}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as R}from"../../../renderers/support/rendererConversion.js";import F from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{applyCIMSymbolColor as V}from"../../../symbols/support/cimSymbolUtils.js";import{SymbolSizeDefaults as T}from"../../../symbols/support/previewUtils.js";import{renderSymbol as z}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as x,renderDotDensityPreviewHTML as j,renderPreviewHTML as D}from"../../../symbols/support/symbolUtils.js";import{isVolumetricSymbol as O}from"../../../symbols/support/utils.js";import{getClusterSizeVariable as M}from"./clusterUtils.js";import{getColorFromPointCloudStops as P,getRampStopsForPointCloud as A,getStrectchRampStops as U,getRampStops as B}from"./colorRampUtils.js";import{getHeatmapRampStops as k}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as N,getRelationshipRampElement as q}from"./relationshipRampUtils.js";import{getRampStops as W,REAL_WORLD_MAX_SIZE as $,REAL_WORLD_MIN_SIZE as G}from"./sizeRampUtils.js";import{SPECIAL_CHARS_LESS_THAN as J,SPECIAL_CHARS_GREATER_THAN as Q,getSymbolForFlowRenderer as H,getMedianColor as X,RGB_IMG_SOURCE as K}from"./utils.js";import{formatNumberLabel as Y}from"../../smartMapping/support/utils.js";import Z from"../../../symbols/SimpleMarkerSymbol.js";import ee from"../../../symbols/SimpleFillSymbol.js";const te=o.getLogger("esri.widgets.Legend.support.ActiveLayerInfo"),se="https://utility.arcgis.com/sharing/tools/legend",le="esri.layers.ImageryLayer",re="esri.layers.ImageryTileLayer",ie="esri.layers.WCSLayer",ne=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,ae=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),oe={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34e38,34e38],f64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ue=new Z({size:6,outline:{color:[128,128,128,.5],width:.5}}),ce=new ee({style:"solid"});function de(e){return"flow"===e.type}function ye(e){return"vector-field"===e.type}function he(e){return"raster-colormap"===e.type}function me(e){return"raster-stretch"===e.type}function pe(e){return"raster-shaded-relief"===e.type}function fe(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function ge(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function be(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function Se(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function _e(e){return ve(e)||Le(e)||Ee(e)||we(e)}function we(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function ve(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function Le(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function Ie(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Ce(e,t){return fe(e)||ge(e)||be(e)||Se(e)||Ie(e)?"2d"===t.type||R(e):me(e)||he(e)||pe(e)||ve(e)||Le(e)||Ee(e)||ye(e)||de(e)}function Re(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function Fe(e){return"esri.layers.VoxelLayer"===e.declaredClass}function Ve(e){return"esri.layers.WMSLayer"===e.declaredClass}function Te(e){return"esri.layers.WMTSLayer"===e.declaredClass}function ze(e){return"esri.layers.MapImageLayer"===e.declaredClass}function xe(e){return"esri.layers.TileLayer"===e.declaredClass}function je(e){return"esri.layers.FeatureLayer"===e.declaredClass}function De(e){return e.declaredClass===le}function Oe(e){return e.declaredClass===re}function Me(e){return e.declaredClass===ie}function Pe(e){return"stretch-ramp"===e.type}function Ae(e){return"univariate-color-size"===("authoringInfo"in e&&e?.authoringInfo)?.type}function Ue(e){const t="authoringInfo"in e&&e?.authoringInfo;return"univariate-color-size"===t?.type&&"above-and-below"===t?.univariateTheme}const Be=new Z({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let ke={},Ne=class extends r{constructor(e){super(e),this._handles=new n,this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._hasClusterSizeVariable=!1,this.children=new i,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this._handles.add([p(this,"children","change",(t=>{const{added:s,removed:l}=t,r=this._handles;s.forEach((t=>{const s=`activeLayerInfo-ready-watcher-${t.layer.uid}`;r.add(f(t,"ready",e),s)})),l.forEach((e=>r.remove(e.layer.uid))),e()}))]),this.keepCacheOnDestroy||(ke={})}destroy(){this._handles.destroy(),this._handles=null,this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(ke=null)}get effectList(){const e=this.layer;let t=null;return"effect"in e&&e.effect&&(t=new v,t.effect=e.effect,t.end(),t.scale=this.scale),t}get opacity(){const e=this.layer.opacity,t=this.parent?.opacity,s=this.layer.parent,l=s&&"uid"in s?this._getParentLayerOpacity(s):null;return null!=t?t*e:null!=l?l*e:e}get ready(){return null===this.layer||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){return this.view&&this.view.scale}get isScaleDriven(){const e=this.layer;if(null===e)return!1;if("effect"in e&&e.effect&&Array.isArray(e.effect))return!0;if("featureReduction"in e&&e.featureReduction&&"cluster"===e.featureReduction.type)return!0;if("renderer"in e&&e.renderer){if("dot-density"===e.renderer.type)return!0;const t=e.get("renderer.valueExpression");if(ne.test(t))return!0;const s=e.get("renderer.visualVariables");if(s)return s.some((e=>this._isScaleDrivenSizeVariable(e)))}return this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(e){if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],void this.notifyChange("ready");const t=Array.from(e,(e=>{if(je(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet&&e.featureSet.features.length){const t=e.layerDefinition,s=t&&t.drawingInfo,l=s&&C(s.renderer),r=ae.read(t.geometryType);return l?this._getRendererLegendElements(l,{title:e.name,geometryType:r}):(te.warn("drawingInfo not available!"),null)}return null}));try{const e=[];await d(t).then((t=>{t.forEach((({value:t})=>t&&e.push(...t)))})),this.legendElements=e,this.notifyChange("ready")}catch(s){te.warn("error while building legend for layer!",s)}}async buildLegendElementsForRenderer(e){try{const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getRendererLegendElements(e):[],this.notifyChange("ready")}catch(t){te.warn("error while building legend for layer!",t)}}async buildLegendElementsForTools(){const e=this.layer;if(Fe(e))this._constructLegendElementsForVoxellayer();else if(Te(e))this._constructLegendElementsForWMTSlayer();else if(Ve(e))await this._constructLegendElementsForWMSSublayers();else if(Re(e))await this._constructLegendElementsForBuildingSceneLayer();else if(ze(e)||xe(e)||Re(e))await this._constructLegendElementsForSublayers();else{this._handles.remove("imageryLayers-watcher");let t="default";if(De(e)){t=(e?.renderingRule?.functionName||"default")+"_"+(e.bandIds?.length?e.bandIds.join(""):"###")}await this._getLegendLayers(`${e.uid}-${t}`).then((async t=>{this.legendElements=[],this.notifyChange("ready");const s=t.map((async t=>{if(De(e)||Oe(e)){const t=e.watch(["renderingRule","bandIds"],(()=>y((async()=>{ke.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()}))()));this._handles.add(t,"imageryLayers-watcher")}const s=this._generateSymbolTableElementForLegendLayer(t);s&&s.infos.length&&(De(e)&&(s.title=e.title),this.legendElements.push(s)),this.notifyChange("ready")}));await d(s)})).catch((e=>{te.warn("Request to server for legend has failed!",e)}))}}async _isLayerInCurrentView(){const e=this.layer,t=this.layerView,s=t&&"createQuery"in t&&"queryFeatureCount"in t;if(!s&&!(t&&"createQuery"in e&&"queryFeatureCount"in e))return!0;await g(t,"updating");const l=s?"createQuery"in t&&t.createQuery():"createQuery"in e&&e.createQuery();l.geometry=this.view.extent;return 0!==(s?"queryFeatureCount"in t&&await t.queryFeatureCount(l):"queryFeatureCount"in e&&await e.queryFeatureCount(l))}_getParentLayerOpacity(e){let t=1;const s=e.parent;return s&&"uid"in s&&(t=this._getParentLayerOpacity(s)),e.opacity*t}_isGroupActive(){const e=this.children;return!!e.length&&e.some((e=>e.ready))}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,s=t.minSize,l=t.maxSize;return"object"==typeof s&&s?this._isScaleDrivenSizeVariable(s):"object"==typeof l&&l?this._isScaleDrivenSizeVariable(l):!!t.expression||ne.test(t.valueExpression)}_isLayerScaleDriven(e){if("minScale"in e&&e.minScale>0||"maxScale"in e&&e.maxScale>0)return!0;if("sublayers"in e&&e.sublayers)return e.sublayers.some((e=>this._isLayerScaleDriven(e)));const t=e.parent;if(!1===e.loaded&&t&&ze(t)&&"source"in e&&e.source&&"map-layer"===e.source.type)for(const s of t.sourceJSON.layers)if(s.id===e.source.mapLayerId&&(s.minScale>0||s.maxScale>0))return!0;return!1}async _constructLegendElementsForVoxellayer(){this.legendElements=[],this._handles.remove("voxel-style-watcher");const e=this.layer;this._handles.add(b(e,"style",(()=>this._constructLegendElementsForVoxellayer())),"voxel-style-watcher");const t=u(e.getVariableStyle(null)),s=[];if(t)if(t.uniqueValues?.length){const e=[];t.uniqueValues.forEach((t=>{t.enabled&&e.push({label:t.label||`${t.value}`,value:t.value,symbol:new ee({color:t.color,outline:null})})})),e.length&&s.push({type:"symbol-table",title:t.label,infos:e})}else if(t.transferFunction){const{colorStops:e,stretchRange:l}=t.transferFunction,r=e.toArray().reverse(),i=l.map(((e,t)=>`${0===t?J:Q} ${Y(e)}`)).reverse(),n=r.map((e=>({color:e.color,value:null,label:null})));n[0].label=i[0],n[n.length-1].label=i[1],s.push({type:"color-ramp",title:t.label,infos:n,preview:x(r.map((e=>e.color)))})}const l=e.opacity,r=s.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]).filter((e=>!!e?.symbol)).map((e=>this._getSymbolPreview(e,l)));await d(r),this.legendElements=s,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this._handles.remove("wmts-activeLayer-watcher");const e=this.layer.activeLayer;if(this._handles.add(b(this.layer,"activeLayer",(()=>this._constructLegendElementsForWMTSlayer())),"wmts-activeLayer-watcher"),e.styleId&&e.styles){let t=null;e.styles.some((s=>e.styleId===s.id&&(t=s.legendUrl,!0))),t&&(this.legendElements=[{type:"symbol-table",title:e.title,infos:[{src:t,opacity:this.opacity}]}])}this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this.legendElements=[],this._handles.remove("wms-sublayers-watcher");const e=this.layer;let t=null;(e.customParameters||e.customLayerParameters)&&(t={...e.customParameters,...e.customLayerParameters}),this._handles.add(b(this.layer,"sublayers",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher"),this.legendElements=await this._generateLegendElementsForWMSSublayers(e.sublayers,t),this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(e,t){const s=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher");const l=e.toArray();for(const r of l){const e=r.watch(["title","visible","legendEnabled"],(()=>this._constructLegendElementsForWMSSublayers()));if(this._handles.add(e,"wms-sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled){const e=await this._generateSymbolTableElementForWMSSublayer(r,t);e&&e.infos.length&&s.unshift(e)}}return s}async _generateSymbolTableElementForWMSSublayer(e,t){if(!e.legendUrl&&e.sublayers){const s=(await this._generateLegendElementsForWMSSublayers(e.sublayers,t)).filter((e=>e));return{type:"symbol-table",title:e.title,infos:s}}return this._generateSymbolTableElementForLegendUrl(e,t)}async _generateSymbolTableElementForLegendUrl(e,t){let s=e.legendUrl;if(!s)return;const r={type:"symbol-table",title:e.title||e.name||e.id&&e.id+"",infos:[]};t&&(s=m(s,t));let i=null;const n=e.layer?.opacity;try{i=(await l(s,{responseType:"image"})).data,i&&(i.style.opacity=n)}catch{}return r.infos.push({src:s,preview:i,opacity:n}),r}_getLegendLayers(e,t){const s=ke&&ke[e];return s?Promise.resolve(s):this._legendRequest(t).then((t=>{const s=t.layers;return ke[e]=s,s}))}_legendRequest(e){const t=this.layer;let s={f:"json",dynamicLayers:e};if(De(t)){const e=t.exportImageServiceParameters.renderingRule;if(e&&(s.renderingRule=JSON.stringify(e.rasterFunctionDefinition||e.toJSON())),t.bandIds&&(s.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:l,customParameters:r}=t;s={raster:e,viewId:l,...s,...r}}}let r=t.url.replace(/(\/)+$/,"");if("version"in t&&t.version>=10.01){const e=r.indexOf("?");e>-1?r=r.substring(0,e)+"/legend"+r.substring(e):r+="/legend"}else{const e=r.toLowerCase().indexOf("/rest/"),t=r.substring(0,e)+r.substring(e+5,r.length);r=se+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return l(r,{query:s}).then((e=>e.data))}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this._handles.remove("sublayers-watcher");const e=this.layer;this._handles.add(b(e,"sublayers",(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){te.warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForBuildingSublayers(e,t){let s=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");const l=e.toArray();for(const r of l){const e=r.watch(["renderer","opacity","title","visible"],(()=>this._constructLegendElementsForBuildingSceneLayer()));if(this._handles.add(e,"sublayers-watcher"),!this.respectLayerVisibility||r.visible){const e=r&&null!=r.opacity?r.opacity:null,l=null!=e?e*t:t;if("building-group"===r.type){const e={type:"symbol-table",title:r.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(r.sublayers,l);e.infos.push(...t),s=[e,...s]}else if(r.renderer){s=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:l,sublayer:r}),...s]}}}return s.filter((e=>!!e&&(!("infos"in e)||e.infos.length>0)))}async _constructLegendElementsForSublayers(){this.legendElements=[],this._handles.remove("sublayers-watcher");const e=this.layer;this._handles.add(b(e,"sublayers",(()=>this._constructLegendElementsForSublayers)),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){te.warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForSublayers(e,t,s){const l=this.layer;let r=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForSublayers())),"sublayers-watcher");let i=e.toArray();!s&&this.sublayerIds&&this.sublayerIds.length&&(i=this.sublayerIds.map((e=>l.findSublayerById(e))).filter(Boolean));for(const n of i){const e=n.watch("renderer, opacity, title, visible, legendEnabled",(()=>this._constructLegendElementsForSublayers()));if(this._handles.add(e,"sublayers-watcher"),!this.respectLayerVisibility||n.visible&&n.legendEnabled&&this._isSublayerInScale(n)){const e=n&&null!=n.opacity?n.opacity:null,l=null!=e?e*t:t;if(n.renderer&&!n.sublayers&&n.originIdOf("renderer")>w.SERVICE){await n.load();r=[...await this._getRendererLegendElements(n.renderer,{title:n.title,opacity:l,sublayer:n}),...r]}else{const e=await this._generateSymbolTableElementForSublayer(n,l,s);e&&r.unshift(e)}}}return r.filter((e=>!!e&&(!("infos"in e)||e.infos.length>0)))}async _generateSymbolTableElementForSublayer(e,t,s){if(!s){s=new Map;const t=this.layer,l=e.source;let r=null;if(!(!l||"map-layer"===l.type&&l.mapLayerId===e.id&&(!l.gdbVersion||l.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>w.SERVICE||e.originIdOf("labelingInfo")>w.SERVICE||e.originIdOf("labelsVisible")>w.SERVICE){const e=new E({layer:this.layer});r=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const i=r||`${t.uid}-default`;(await this._getLegendLayers(i,r)).forEach((e=>s.set(e.layerId,e)))}const l=s.get(e.id);if((!l||l?.subLayerIds&&l.defaultVisibility)&&e.sublayers){const l=await this._generateLegendElementsForSublayers(e.sublayers,t,s);return{type:"symbol-table",title:e.title,infos:l}}return this._generateSymbolTableElementForLegendLayer(l,e,t)}_generateSymbolTableElementForLegendLayer(e,t,s){if(!e||!e.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const l=t?.renderer;let r=t?.title||e.layerName;if(l&&(!t||t?.originIdOf("renderer")>w.SERVICE)){const e=t?.title||this._getRendererTitle(l,t);e&&(r&&"string"!=typeof e&&"title"in e&&(e.title=r),r=e)}const i={type:"symbol-table",title:r,legendType:e.legendType?e.legendType:null,infos:[]},n=t?this._sanitizeLegendForSublayer(e.legend.slice(),t):e.legend;return e.legendGroups?.length>0?e.legendGroups.forEach((t=>{const l={type:"symbol-table",title:t.heading,legendType:e.legendType?e.legendType:null,infos:this._generateSymbolTableElementInfosForLegendLayer(n.filter((e=>e.groupId===t.id)),e.layerId,s)};l.infos?.length>0&&i.infos.push(l)})):i.infos=this._generateSymbolTableElementInfosForLegendLayer(n,e.layerId,s),i.infos.length>0?i:null}_generateSymbolTableElementInfosForLegendLayer(e,t,l){return e.map((e=>{let r=e.url;if(e.imageData&&e.imageData.length>0)r=`data:image/png;base64,${e.imageData}`;else{if(0===r.indexOf("http"))return null;r=s(`${this.layer.url}/${t}/images/${r}`)}return{label:e.label,src:r,opacity:null==l?this.opacity:l,width:e.width,height:e.height}})).filter((e=>!!e))}_isSublayerInScale(e){const t=e.minScale||0,s=e.maxScale||0;return!(t>0&&t<this.scale||s>this.scale)}_isLegendLayerInScale(e,t){const s=t||this.layer;let l=null,r=null,i=!0;return!s.minScale&&0!==s.minScale||!s.maxScale&&0!==s.maxScale?(0===e.minScale&&s.tileInfo&&(l=s.tileInfo.lods[0].scale),0===e.maxScale&&s.tileInfo&&(r=s.tileInfo.lods[s.tileInfo.lods.length-1].scale)):(l=Math.min(s.minScale,e.minScale)||s.minScale||e.minScale,r=Math.max(s.maxScale,e.maxScale)),(l>0&&l<this.scale||r>this.scale)&&(i=!1),i}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&this.layer.version<10.1||0===e.length)return e;const s=t.renderer,l=e.some((e=>e.values));let r=null,i=null;return l&&e.some(((e,t)=>(e.values||(r=t,i=e,i.label||(i.label="others")),null!=i))),s?"unique-value"===s.type?i&&(e.splice(r,1),e.push(i)):"class-breaks"===s.type&&(i&&e.splice(r,1),e.reverse(),i&&e.push(i)):i&&(e.splice(r,1),e.push(i)),e}async _getRendererLegendElements(e,t={}){return Ce(e,this.view)?_e(e)?this._constructPointCloudRendererLegendElements(e,t):Ie(e)?this._constructDotDensityRendererLegendElements(e):this._constructRendererLegendElements(e,t):(te.warn(`Renderer of type '${e.type}' not supported!`),[])}_getPointCloudRendererTitle(e){return e.legendOptions&&e.legendOptions.title||e.field}_constructPointCloudRendererLegendElements(e,t={}){const s=t.title,l=[];let r=null,i=null;if(ve(e))r={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach((e=>{r.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(ue,e.color)})}));else if(Le(e)){const t=e.stops;let l=null;if(t.length&&(1===t.length&&(l=t[0].color),!l)){const e=t[0].value,s=t[t.length-1].value;if(null!=e&&null!=s){l=P(e+(s-e)/2,t)}}r={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(ue,l||ue.color)}]};const n=A(e.stops);i={type:"color-ramp",title:s||this._getPointCloudRendererTitle(e),infos:n,preview:x(n.map((e=>e.color)))}}else Ee(e)&&(r={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos.forEach((e=>{r.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(ue,e.color)})})));r&&r.infos.length&&l.push(r),i&&i.infos.length&&l.push(i);const n=l.reduce(((e,t)=>e.concat(t.infos)),[]).filter((e=>!!e.symbol)).map((t=>this._getSymbolPreview(t,this.opacity,{symbolConfig:{applyColorModulation:!!e.colorModulation}})));return d(n).then((()=>l))}_getElementInfoForDotDensity(e,t){const{backgroundColor:s,outline:l,dotSize:r}=e,i=this.effectList?.effects.map((e=>e.toJSON())),n=L(i),a=r+"-"+t+"-"+s+"-"+(l&&JSON.stringify(l.toJSON()))+"-"+n,o=this._dotDensityUrlCache,u=o.has(a)?o.get(a):j(e,t);o.set(a,u);const c={shape:{type:"image",x:0,y:0,width:u.width,height:u.height,src:u.src},fill:null,stroke:null,offset:[0,0]},d=z([[c]],[u.width,u.height],{effectView:this.effectList});return{opacity:1,src:u.src,preview:d,width:u.width,height:u.height}}_constructDotDensityRendererLegendElements(e){const t=e.calculateDotValue(this.view.scale),s=e.legendOptions&&e.legendOptions.unit,l={type:"symbol-table",title:{value:t&&Math.round(t),unit:s||""},infos:[]};return e.attributes.forEach((t=>{const s=this._getElementInfoForDotDensity(e,t.color);s.label=t.label||t.valueExpressionTitle||t.field,l.infos.push(s)})),Promise.resolve([l])}async _constructRendererLegendElements(e,t={}){const{title:s,sublayer:l}=t,r=l||this.layer;let i=await this._loadRenderer(e);this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const n=await this._getVisualVariableLegendElements(i,r)||[],a={type:"symbol-table",title:s||this._getRendererTitle(i,r),infos:[]};let o=null,c=!1;const y=new Set;if(de(i)&&!this._hasSizeRamp){const e=await H(i);a.infos.push({label:null,symbol:e})}else if(Ae(i)){let e=s;const t=Ue(i)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",l=n.findIndex((e=>"color-ramp"===e.type)),r=-1!==l?n.splice(l,1)[0]:null,a=n.findIndex((e=>"size-ramp"===e.type)),o=-1!==a?n.splice(a,1)[0]:null,u=[];r&&(e=r.title,u.push(r)),o&&(e=o.title,u.push(o)),u.length>0&&n.push({type:t,title:e,infos:u})}else if(Se(i)){const e=k(i);n.push({type:"heatmap-ramp",title:s,infos:e,preview:x(e.map((e=>e.color)),{effectList:this.effectList})})}else if(be(i)){const e=i&&i.authoringInfo;if(e&&"relationship"===e.type){const{focus:t,numClasses:s,field1:l,field2:o}=e;if(s&&l&&o){const e=[l,o];let u=N(t)||0;for(const t of e){const{field:e,normalizationField:s,label:l}=t,i=l||{field:this._getFieldAlias(e,r),normField:s&&this._getFieldAlias(s,r)},n=Be.clone();n.angle=u,a.infos.push({label:i,symbol:n}),y.add(n),u+=90}const c=q({focus:t,numClasses:s,infos:i.uniqueValueInfos});n.unshift(c)}}else{const e=i.field;i.uniqueValueInfos.forEach((t=>{t.symbol&&a.infos.push({label:t.label||this._getDomainName(e,t.value,r)||t.value,value:t.value,symbol:t.symbol})}))}i.defaultSymbol&&(a.infos.push({label:i.defaultLabel||"others",symbol:i.defaultSymbol}),c=!0)}else if(ge(i)){o=this._isUnclassedRenderer(i);(!o||!this._hasSizeRamp)&&(i.classBreakInfos.forEach((e=>{e.symbol&&a.infos.unshift({label:e.label||(o?null:e.minValue+" - "+e.maxValue),value:[e.minValue,e.maxValue],symbol:e.symbol})})),o&&(a.title=null),this._updateInfosforClassedSizeRenderer(i,a.infos)),i.defaultSymbol&&!o&&(a.infos.push({label:i.defaultLabel||"others",symbol:i.defaultSymbol}),c=!0)}else if(me(i))if(Oe(this.layer)||Me(this.layer)){const e=this._constructTileImageryStretchRendererElements(i);Pe(e)?n.push(e):a.infos=e}else{const e=this.layer;let t,s;i.statistics&&i.statistics.length&&(t=null!=i.statistics[0].min?i.statistics[0].min:i.statistics[0][0],s=null!=i.statistics[0].max?i.statistics[0].max:i.statistics[0][1]);let l=[];const r=u(e.renderingRule?await e.generateRasterInfo(e.renderingRule):e.serviceRasterInfo),o=r.keyProperties.BandProperties,c=oe[e.rasterInfo.pixelType.toLowerCase()];1===r.bandCount||e.bandIds&&1===e.bandIds.length?(t=null!=t?t:r.statistics?r.statistics[e.bandIds[0]].min:c[0],s=null!=s?s:r.statistics?r.statistics[e.bandIds[0]].max:c[1],t||s?n.push(this._getStretchLegendElements(i,{min:t,max:s})):this._getServerSideLegend()):r.bandCount>=3?o&&o.length>=r.bandCount?e.bandIds&&3===e.bandIds.length?(l=e.bandIds.map((e=>o[e].BandName)),a.infos=this._createSymbolTableElementMultiBand(l)):"lerc"===e.format?(l=[0,1,2].map((e=>o[e].BandName)),a.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend():"lerc"===e.format?(l=["band1","band2","band3"],a.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend():this._getServerSideLegend()}else if(he(i))i.colormapInfos.forEach((e=>{a.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(ce,e.color)})}));else if(fe(i)){let e=i.symbol;switch(t.geometryType){case"point":e="pointSymbol"in r&&r.pointSymbol;break;case"polyline":e="lineSymbol"in r&&r.lineSymbol;break;case"polygon":e="polygonSymbol"in r&&r.polygonSymbol}i.symbol&&!this._hasSizeRamp&&a.infos.push({label:i.label,symbol:e})}else if(ye(i)){i.outputUnit&&(this.title="("+i.toJSON().outputUnit+")"),a.title=i.attributeField;const e=i.getClassBreakInfos();e?.length?e.forEach((e=>{a.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})})):a.infos.push({label:i.attributeField,symbol:i.getDefaultSymbol()})}else pe(i)&&n.push(this._getStretchLegendElements(i,{min:0,max:255}));const h=i.defaultSymbol;!h||c||fe(i)||o&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||n.push({type:"symbol-table",infos:[{label:i.defaultLabel||"others",symbol:h}]}),a.infos.length&&n.unshift(a);const m=null==t.opacity?this.opacity:t.opacity,p=this._isTallSymbol("visualVariables"in i&&i.visualVariables),f=De(this.layer)||Oe(this.layer),g=n.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]).filter((e=>!!e?.symbol)).map((e=>this._getSymbolPreview(e,m,{isDefault:e.symbol===h,applyScaleDrivenSize:!y.has(e.symbol),symbolConfig:{isTall:p,isSquareFill:f},effectList:y.has(e.symbol)?null:this.effectList})));return i=null,await d(g),n}_getServerSideLegend(){setTimeout((()=>this.buildLegendElementsForTools()),0)}_getAllInfos(e){const t=e?.infos;return t?t.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]):[e]}_constructTileImageryStretchRendererElements(e){const t=this.layer,s=t.rasterInfo,l=s.bandCount||e.statistics.length;let r,i,n=[];const a=s.keyProperties&&s.keyProperties.BandProperties,o=e?.statistics?.length?e.statistics:s?.statistics;if(o)r=void 0!==o[0].min?o[0].min:o[0][0],i=o[0].max||o[0][1];else{const e=oe[t.rasterInfo.pixelType.toLowerCase()];r=e[0],i=e[1]}if(t.hasStandardTime()&&(r=t.getStandardTimeValue(r),i=t.getStandardTimeValue(i)),1===s.bandCount||1===t.bandIds?.length)return this._getStretchLegendElements(e,{min:r,max:i});function u(e){const l=(t?.bandIds?.length?t.bandIds:Array.from(Array(Math.min(s.bandCount,3)).keys())).map((t=>e&&e[t]&&e[t].BandName||"band"+(t+1)));return l.length<3?l.push(l[1]):l.length>3&&l.splice(3),l}return n=a&&a.length>=l?u(a):u(),this._createSymbolTableElementMultiBand(n)}_getStretchLegendElements(e,t){const s=e.colorRamp,l=U(s,t);return{type:"stretch-ramp",title:"",infos:l,preview:x(l.map((e=>e.color)))}}async _getSizeLegendElement(e,t,s,l){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(t):e,infos:await W(s,t,await X(s),this.scale,this.view.type,l)}}_createSymbolTableElementMultiBand(e){const t=[],s=["red","green","blue"];return e.forEach(((e,l)=>{t.push({label:{colorName:s[l],bandName:e},src:K[l],opacity:1})})),t}_updateInfosforClassedSizeRenderer(e,t){const s=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,l=e.classBreakInfos.some((e=>O(e.symbol)));if(s&&l){const s=$,l=G,r=e.classBreakInfos.length,i=(s-l)/(r>1?r-1:r);t.forEach(((e,t)=>{e.size=s-i*t}))}}_isTallSymbol(e){let t=!1,s=!1;if(e)for(let l=0;l<e.length&&(!t||!s);l++){const r=e[l];"size"===r.type&&("height"===r.axis&&(t=!0),"width-and-depth"===r.axis&&(s=!0))}return t&&s}async _getSymbolPreview(e,t,s){let l=!s?.isDefault&&null==e.size&&this._hasSizeRamp?h(T.size):e.size;if(this._scaleDrivenSizeVariable&&s?.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");l=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}return D(e.symbol,{size:l,opacity:t,scale:!1,symbolConfig:s?.symbolConfig,effectView:s?.effectList}).then((t=>(e.preview=t,e))).catch((()=>(e.preview=null,e)))}async _loadRenderer(e){const t=[],s=this.layer;e=e.clone(),this._hasClusterSizeVariable=!1;const l="visualVariables"in e&&e.visualVariables?.some((e=>"size"===e.type&&"outline"!==e.target&&!ne.test(e.valueExpression)));if(e&&"visualVariables"in e&&!l&&"featureReduction"in s&&"cluster"===s.featureReduction?.type){const t=this.layerView._effectiveRenderer,l=u(M(t,this.view));if(l){const t=s.featureReduction;if("clusterMinSize"in t&&"clusterMaxSize"in t){const{clusterMinSize:e,clusterMaxSize:s}=t;l.legendOptions=new F({showLegend:e!==s})}const r=e.visualVariables||[];e.visualVariables=r.concat([l]),this._hasClusterSizeVariable=!0}}const r=await X(e);if(ge(e)||be(e)){const s=(e.classBreakInfos||e.uniqueValueInfos).map((e=>this._fetchSymbol(e.symbol,r).then((t=>{e.symbol=t})).catch((()=>{e.symbol=null}))));Array.prototype.push.apply(t,s)}return t.push(this._fetchSymbol(e.symbol||e.defaultSymbol,e.defaultSymbol?null:r).then((t=>{this._applySymbolToRenderer(e,t,fe(e))})).catch((()=>{this._applySymbolToRenderer(e,null,fe(e))}))),d(t).then((()=>e))}_applySymbolToRenderer(e,t,s){s?e.symbol=t:e.defaultSymbol=t}_fetchSymbol(e,t){if(!e)return Promise.reject();if("web-style"===e.type){const s=e.portal,l=s&&s.url,r=s&&s.user&&s.user.username,i=e.name+"-"+e.styleName+"-"+e.styleUrl+"-"+l+"-"+r,n=this._webStyleSymbolCache;return n.has(i)||("2d"===this.view.type?n.set(i,e.fetchCIMSymbol()):n.set(i,e.fetchSymbol())),n.get(i).then((e=>this._getAppliedCloneSymbol(e,t))).catch((()=>{throw te.warn("Fetching web-style failed!"),new Error}))}return Promise.resolve(this._getAppliedCloneSymbol(e,t))}_getAppliedCloneSymbol(e,s){if(!e||!s)return e;const l=e.clone(),r=s&&s.toRgba();return l.type.includes("3d")?this._applyColorTo3dSymbol(l,r):"cim"===l.type?V(l,s):l.color&&(l.color=new t(r||l.color)),l}_applyColorTo3dSymbol(e,s){s&&e.symbolLayers.forEach((e=>{e&&(e.material||(e.material={}),e.material.color=new t(s))}))}async _getVisualVariableLegendElements(e,t){if(!("visualVariables"in e)||!e.visualVariables||"vector-field"===e.type)return null;const s=e.visualVariables,l=[],r=[],i=[];for(const c of s)"color"===c.type?l.push(c):"size"===c.type?r.push(c):"opacity"===c.type&&i.push(c);const n=[...l,...r,...i];let a,o;if(0===l.length&&ge(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];a=t&&t.symbol}if(0===l.length&&fe(e)&&(a=e.symbol),a)if(a.type.includes("3d")){const e=a.symbolLayers.getItemAt(0);"water"===e.type?c(e.color)&&(o=e.color):c(e.material)&&c(e.material.color)&&(o=e.material.color)}else a.url||(o=a.color);const u=this.effectList;return(await Promise.all(n.map((async s=>{if(!s.legendOptions||!1!==s.legendOptions.showLegend){const l=de(e)?s.field:this._getRampTitle(s,t);let r=null;const i="getField"in t&&t.getField&&t.getField(s.field),n=i&&I(i);if("color"===s.type){const e=await B(s,null,n);r={type:"color-ramp",title:l,infos:e,preview:x(e.map((e=>e.color)),{effectList:u})},this._hasColorRamp||(this._hasColorRamp=!(null==r.infos||!r.infos.length))}else if("size"===s.type&&"outline"!==s.target)ne.test(s.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=s):(r=await this._getSizeLegendElement(l,s,e,n),this._hasSizeRamp||(this._hasSizeRamp=!(null==r.infos||!r.infos.length)));else if("opacity"===s.type){const e=await B(s,o,n);r={type:"opacity-ramp",title:l,infos:e,preview:x(e.map((e=>e.color)),{effectList:u})},this._hasOpacityRamp||(this._hasOpacityRamp=!(null==r.infos||!r.infos.length))}return r&&r.infos?r:null}})))).filter((e=>!!e))}_getDomainName(e,t,s){if(e&&"function"!=typeof e){const l="getField"in s&&s.getField&&s.getField(e),r=l&&"getFieldDomain"in s&&s.getFieldDomain?s.getFieldDomain(l.name):null;return r&&"coded-value"===r.type?r.getName(t):null}return null}_getClusterTitle(e){const t=this.layer,s=e.field;if("featureReduction"in t&&t.featureReduction&&"cluster"===t.featureReduction.type){const e=t.featureReduction,l="popupTemplate"in e&&e.popupTemplate,r=l&&l.fieldInfos;if(r)for(const t of r)if(t.fieldName===s)return"cluster_count"===s?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let s=e.field,l=e.normalizationField,r=!1,i=!1,n=!1,a=null;s="function"==typeof s?null:s,l="function"==typeof l?null:l;const o=e.legendOptions&&e.legendOptions.title;if(null!=o)a=o;else if(e.valueExpressionTitle)a=e.valueExpressionTitle;else{if("renderer"in t&&t.renderer&&"authoringInfo"in t.renderer&&t.renderer.authoringInfo&&t.renderer.authoringInfo.visualVariables){const e=t.renderer.authoringInfo.visualVariables;for(let t=0;t<e.length;t++){const s=e[t];if("color"===s.type){if("ratio"===s.style){r=!0;break}if("percent"===s.style){i=!0;break}if("percent-of-total"===s.style){n=!0;break}}}}a={field:s&&this._getFieldAlias(s,t),normField:l&&this._getFieldAlias(l,t),ratio:r,ratioPercent:i,ratioPercentTotal:n}}return a}_getRendererTitle(e,t){const s=e;if(s.legendOptions&&s.legendOptions.title)return s.legendOptions.title;if(s.valueExpressionTitle)return s.valueExpressionTitle;let l=s.field,r=null,i=null;ge(s)&&(r=s.normalizationField,i="percent-of-total"===s.normalizationType),l="function"==typeof l?null:l,r="function"==typeof r?null:r;let n=null;return(l||r)&&(n={field:l&&this._getFieldAlias(l,t),normField:r&&this._getFieldAlias(r,t),normByPct:i}),n}_getFieldAlias(e,t){const s="popupTemplate"in t&&t.popupTemplate,l=s&&s.fieldInfos;let r=null;l&&l.some((t=>e===t.fieldName&&(r=t,!0)));let i=null;"getField"in t&&t.getField?i=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(i=t.fieldsIndex.get(e));const n=r||i;let a=null;return n&&(a=r&&r.label||i&&i.alias||"name"in n&&n.name||"fieldName"in n&&n.fieldName),a}_isUnclassedRenderer(e){const t=e.visualVariables;let s=!1;return ge(e)&&e.classBreakInfos&&1===e.classBreakInfos.length&&t&&(s=e.field?t.some((t=>!(!t||e.field!==t.field||(e.normalizationField||t.normalizationField)&&e.normalizationField!==t.normalizationField))):!!t.length),s}};e([S()],Ne.prototype,"children",void 0),e([S({readOnly:!0})],Ne.prototype,"effectList",null),e([S()],Ne.prototype,"layerView",void 0),e([S()],Ne.prototype,"layer",void 0),e([S()],Ne.prototype,"legendElements",void 0),e([S({readOnly:!0})],Ne.prototype,"opacity",null),e([S()],Ne.prototype,"parent",void 0),e([S({readOnly:!0,dependsOn:[]})],Ne.prototype,"ready",null),e([S()],Ne.prototype,"hideLayersNotInCurrentView",void 0),e([S()],Ne.prototype,"keepCacheOnDestroy",void 0),e([S()],Ne.prototype,"respectLayerVisibility",void 0),e([S({readOnly:!0})],Ne.prototype,"scale",null),e([S()],Ne.prototype,"sublayerIds",void 0),e([S({readOnly:!0})],Ne.prototype,"isScaleDriven",null),e([S()],Ne.prototype,"title",void 0),e([S({readOnly:!0,dependsOn:["ready"],value:0})],Ne.prototype,"version",null),e([S()],Ne.prototype,"view",void 0),Ne=e([_("esri.widgets.Legend.support.ActiveLayerInfo")],Ne);const qe=Ne;export{qe as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import{addTokenParameter as s}from"../../../kernel.js";import l from"../../../request.js";import"../../../symbols.js";import r from"../../../core/Accessor.js";import i from"../../../core/Collection.js";import n from"../../../core/Handles.js";import{JSONMap as a}from"../../../core/jsonMap.js";import{equalsShallow as o}from"../../../core/lang.js";import u from"../../../core/Logger.js";import{unwrap as c,isSome as d}from"../../../core/maybe.js";import{eachAlways as y,debounce as h}from"../../../core/promiseUtils.js";import{on as m,watch as p,whenOnce as f,initial as g}from"../../../core/reactiveUtils.js";import{px2pt as b}from"../../../core/screenUtils.js";import{addQueryParameters as S}from"../../../core/urlUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as v}from"../../../core/accessorSupport/decorators/subclass.js";import{OriginId as w}from"../../../core/accessorSupport/PropertyOrigin.js";import{EffectView as L}from"../../../layers/effects/EffectView.js";import{effectFunctionsFromJSON as E}from"../../../layers/effects/jsonUtils.js";import{ExportImageParameters as I}from"../../../layers/support/ExportImageParameters.js";import{isDateField as C}from"../../../layers/support/fieldUtils.js";import{fromJSON as R}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as F}from"../../../renderers/support/rendererConversion.js";import V from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{applyCIMSymbolColor as T}from"../../../symbols/support/cimSymbolUtils.js";import{SymbolSizeDefaults as z}from"../../../symbols/support/previewUtils.js";import{renderSymbol as x}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as j,renderDotDensityPreviewHTML as D,renderPreviewHTML as O}from"../../../symbols/support/symbolUtils.js";import{isVolumetricSymbol as M}from"../../../symbols/support/utils.js";import{getClusterSizeVariable as P}from"./clusterUtils.js";import{getColorFromPointCloudStops as A,getRampStopsForPointCloud as U,getStrectchRampStops as B,getRampStops as k}from"./colorRampUtils.js";import{getHeatmapRampStops as N}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as q,getRelationshipRampElement as W}from"./relationshipRampUtils.js";import{getRampStops as $,REAL_WORLD_MAX_SIZE as G,REAL_WORLD_MIN_SIZE as J}from"./sizeRampUtils.js";import{SPECIAL_CHARS_LESS_THAN as Q,SPECIAL_CHARS_GREATER_THAN as H,getSymbolForFlowRenderer as X,getMedianColor as K,RGB_IMG_SOURCE as Y}from"./utils.js";import{formatNumberLabel as Z}from"../../smartMapping/support/utils.js";import ee from"../../../symbols/SimpleMarkerSymbol.js";import te from"../../../symbols/SimpleFillSymbol.js";const se=u.getLogger("esri.widgets.Legend.support.ActiveLayerInfo"),le="https://utility.arcgis.com/sharing/tools/legend",re="esri.layers.ImageryLayer",ie="esri.layers.ImageryTileLayer",ne="esri.layers.WCSLayer",ae=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,oe=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),ue={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34e38,34e38],f64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ce=new ee({size:6,outline:{color:[128,128,128,.5],width:.5}}),de=new te({style:"solid"});function ye(e){return"flow"===e.type}function he(e){return"vector-field"===e.type}function me(e){return"raster-colormap"===e.type}function pe(e){return"raster-stretch"===e.type}function fe(e){return"raster-shaded-relief"===e.type}function ge(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function be(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function Se(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function _e(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function ve(e){return Le(e)||Ee(e)||Ie(e)||we(e)}function we(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function Le(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function Ie(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function Ce(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Re(e,t){return ge(e)||be(e)||Se(e)||_e(e)||Ce(e)?"2d"===t.type||F(e):pe(e)||me(e)||fe(e)||Le(e)||Ee(e)||Ie(e)||he(e)||ye(e)}function Fe(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function Ve(e){return"esri.layers.VoxelLayer"===e.declaredClass}function Te(e){return"esri.layers.WMSLayer"===e.declaredClass}function ze(e){return"esri.layers.WMTSLayer"===e.declaredClass}function xe(e){return"esri.layers.MapImageLayer"===e.declaredClass}function je(e){return"esri.layers.TileLayer"===e.declaredClass}function De(e){return"esri.layers.FeatureLayer"===e.declaredClass}function Oe(e){return e.declaredClass===re}function Me(e){return e.declaredClass===ie}function Pe(e){return e.declaredClass===ne}function Ae(e){return"stretch-ramp"===e.type}function Ue(e){return"univariate-color-size"===("authoringInfo"in e&&e?.authoringInfo)?.type}function Be(e){const t="authoringInfo"in e&&e?.authoringInfo;return"univariate-color-size"===t?.type&&"above-and-below"===t?.univariateTheme}const ke=new ee({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let Ne={},qe=class extends r{constructor(e){super(e),this._handles=new n,this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._hasClusterSizeVariable=!1,this.children=new i,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this._handles.add([m((()=>this.children),"change",(t=>{const{added:s,removed:l}=t,r=this._handles;s.forEach((t=>{const s=`activeLayerInfo-ready-watcher-${t.layer.uid}`;r.add(p((()=>t.ready),e,g),s)})),l.forEach((e=>r.remove(e.layer.uid))),e()}))]),this.keepCacheOnDestroy||(Ne={})}destroy(){this._handles.destroy(),this._handles=null,this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(Ne=null)}get effectList(){const e=this.layer;let t=null;return"effect"in e&&e.effect&&(t=new L,t.effect=e.effect,t.end(),t.scale=this.scale),t}get opacity(){const e=this.layer.opacity,t=this.parent?.opacity,s=this.layer.parent,l=s&&"uid"in s?this._getParentLayerOpacity(s):null;return null!=t?t*e:null!=l?l*e:e}get ready(){return null===this.layer||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){return this.view&&this.view.scale}get isScaleDriven(){const e=this.layer;if(null===e)return!1;if("effect"in e&&e.effect&&Array.isArray(e.effect))return!0;if("featureReduction"in e&&e.featureReduction&&"cluster"===e.featureReduction.type)return!0;if("renderer"in e&&e.renderer){if("dot-density"===e.renderer.type)return!0;const t=e.get("renderer.valueExpression");if(ae.test(t))return!0;const s=e.get("renderer.visualVariables");if(s)return s.some((e=>this._isScaleDrivenSizeVariable(e)))}return this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(e){if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],void this.notifyChange("ready");const t=Array.from(e,(e=>{if(De(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet&&e.featureSet.features.length){const t=e.layerDefinition,s=t&&t.drawingInfo,l=s&&R(s.renderer),r=oe.read(t.geometryType);return l?this._getRendererLegendElements(l,{title:e.name,geometryType:r}):(se.warn("drawingInfo not available!"),null)}return null}));try{const e=[];await y(t).then((t=>{t.forEach((({value:t})=>t&&e.push(...t)))})),this.legendElements=e,this.notifyChange("ready")}catch(s){se.warn("error while building legend for layer!",s)}}async buildLegendElementsForRenderer(e){try{const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getRendererLegendElements(e):[],this.notifyChange("ready")}catch(t){se.warn("error while building legend for layer!",t)}}async buildLegendElementsForTools(){const e=this.layer;if(Ve(e))this._constructLegendElementsForVoxellayer();else if(ze(e))this._constructLegendElementsForWMTSlayer();else if(Te(e))await this._constructLegendElementsForWMSSublayers();else if(Fe(e))await this._constructLegendElementsForBuildingSceneLayer();else if(xe(e)||je(e)||Fe(e))await this._constructLegendElementsForSublayers();else{this._handles.remove("imageryLayers-watcher");let t="default";if(Oe(e)){t=(e?.renderingRule?.functionName||"default")+"_"+(e.bandIds?.length?e.bandIds.join(""):"###")}await this._getLegendLayers(`${e.uid}-${t}`).then((async t=>{this.legendElements=[],this.notifyChange("ready");const s=t.map((async t=>{if(Oe(e)||Me(e)){const t=p((()=>["renderingRule"in e&&e.renderingRule,e.bandIds]),(()=>h((async()=>{Ne.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()}))()),{equals:o});this._handles.add(t,"imageryLayers-watcher")}const s=this._generateSymbolTableElementForLegendLayer(t);s&&s.infos.length&&(Oe(e)&&(s.title=e.title),this.legendElements.push(s)),this.notifyChange("ready")}));await y(s)})).catch((e=>{se.warn("Request to server for legend has failed!",e)}))}}async _isLayerInCurrentView(){const e=this.layer,t=this.layerView,s=t&&"createQuery"in t&&"queryFeatureCount"in t;if(!s&&!(t&&"createQuery"in e&&"queryFeatureCount"in e))return!0;await f((()=>!t.updating));const l=s?"createQuery"in t&&t.createQuery():"createQuery"in e&&e.createQuery();l.geometry=this.view.extent;return 0!==(s?"queryFeatureCount"in t&&await t.queryFeatureCount(l):"queryFeatureCount"in e&&await e.queryFeatureCount(l))}_getParentLayerOpacity(e){let t=1;const s=e.parent;return s&&"uid"in s&&(t=this._getParentLayerOpacity(s)),e.opacity*t}_isGroupActive(){const e=this.children;return!!e.length&&e.some((e=>e.ready))}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,s=t.minSize,l=t.maxSize;return"object"==typeof s&&s?this._isScaleDrivenSizeVariable(s):"object"==typeof l&&l?this._isScaleDrivenSizeVariable(l):!!t.expression||ae.test(t.valueExpression)}_isLayerScaleDriven(e){if("minScale"in e&&e.minScale>0||"maxScale"in e&&e.maxScale>0)return!0;if("sublayers"in e&&e.sublayers)return e.sublayers.some((e=>this._isLayerScaleDriven(e)));const t=e.parent;if(!1===e.loaded&&t&&xe(t)&&"source"in e&&e.source&&"map-layer"===e.source.type)for(const s of t.sourceJSON.layers)if(s.id===e.source.mapLayerId&&(s.minScale>0||s.maxScale>0))return!0;return!1}async _constructLegendElementsForVoxellayer(){this.legendElements=[],this._handles.remove("voxel-style-watcher");const e=this.layer;this._handles.add(p((()=>e.style),(()=>this._constructLegendElementsForVoxellayer())),"voxel-style-watcher");const t=c(e.getVariableStyle(null)),s=[];if(t)if(t.uniqueValues?.length){const e=[];t.uniqueValues.forEach((t=>{t.enabled&&e.push({label:t.label||`${t.value}`,value:t.value,symbol:new te({color:t.color,outline:null})})})),e.length&&s.push({type:"symbol-table",title:t.label,infos:e})}else if(t.transferFunction){const{colorStops:e,stretchRange:l}=t.transferFunction,r=e.toArray().reverse(),i=l.map(((e,t)=>`${0===t?Q:H} ${Z(e)}`)).reverse(),n=r.map((e=>({color:e.color,value:null,label:null})));n[0].label=i[0],n[n.length-1].label=i[1],s.push({type:"color-ramp",title:t.label,infos:n,preview:j(r.map((e=>e.color)))})}const l=e.opacity,r=s.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]).filter((e=>!!e?.symbol)).map((e=>this._getSymbolPreview(e,l)));await y(r),this.legendElements=s,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this._handles.remove("wmts-activeLayer-watcher");const e=this.layer.activeLayer;if(this._handles.add(p((()=>{const{layer:e}=this;return e&&"activeLayer"in e&&e.activeLayer}),(()=>this._constructLegendElementsForWMTSlayer())),"wmts-activeLayer-watcher"),e.styleId&&e.styles){let t=null;e.styles.some((s=>e.styleId===s.id&&(t=s.legendUrl,!0))),t&&(this.legendElements=[{type:"symbol-table",title:e.title,infos:[{src:t,opacity:this.opacity}]}])}this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this.legendElements=[],this._handles.remove("wms-sublayers-watcher");const e=this.layer;let t=null;(e.customParameters||e.customLayerParameters)&&(t={...e.customParameters,...e.customLayerParameters}),this._handles.add(p((()=>{const{layer:e}=this;return e&&"sublayers"in e&&e.sublayers}),(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher"),this.legendElements=await this._generateLegendElementsForWMSSublayers(e.sublayers,t),this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(e,t){const s=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher");const l=e.toArray();for(const r of l){const e=p((()=>[r.title,r.visible,r.legendEnabled]),(()=>this._constructLegendElementsForWMSSublayers()));if(this._handles.add(e,"wms-sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled){const e=await this._generateSymbolTableElementForWMSSublayer(r,t);e&&e.infos.length&&s.unshift(e)}}return s}async _generateSymbolTableElementForWMSSublayer(e,t){if(!e.legendUrl&&e.sublayers){const s=(await this._generateLegendElementsForWMSSublayers(e.sublayers,t)).filter((e=>e));return{type:"symbol-table",title:e.title,infos:s}}return this._generateSymbolTableElementForLegendUrl(e,t)}async _generateSymbolTableElementForLegendUrl(e,t){let s=e.legendUrl;if(!s)return;const r={type:"symbol-table",title:e.title||e.name||e.id&&e.id+"",infos:[]};t&&(s=S(s,t));let i=null;const n=e.layer?.opacity;try{i=(await l(s,{responseType:"image"})).data,i&&(i.style.opacity=n)}catch{}return r.infos.push({src:s,preview:i,opacity:n}),r}_getLegendLayers(e,t){const s=Ne&&Ne[e];return s?Promise.resolve(s):this._legendRequest(t).then((t=>{const s=t.layers;return Ne[e]=s,s}))}_legendRequest(e){const t=this.layer;let s={f:"json",dynamicLayers:e};if(Oe(t)){const e=t.exportImageServiceParameters.renderingRule;if(e&&(s.renderingRule=JSON.stringify(e.rasterFunctionDefinition||e.toJSON())),t.bandIds&&(s.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:l,customParameters:r}=t;s={raster:e,viewId:l,...s,...r}}}let r=t.url.replace(/(\/)+$/,"");if("version"in t&&t.version>=10.01){const e=r.indexOf("?");e>-1?r=r.substring(0,e)+"/legend"+r.substring(e):r+="/legend"}else{const e=r.toLowerCase().indexOf("/rest/"),t=r.substring(0,e)+r.substring(e+5,r.length);r=le+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return l(r,{query:s}).then((e=>e.data))}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this._handles.remove("sublayers-watcher");const e=this.layer;this._handles.add(p((()=>e.sublayers),(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){se.warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForBuildingSublayers(e,t){let s=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");const l=e.toArray();for(const r of l){const e=p((()=>["renderer"in r&&r.renderer,r.opacity,r.title,r.visible]),(()=>this._constructLegendElementsForBuildingSceneLayer()),{equals:o});if(this._handles.add(e,"sublayers-watcher"),!this.respectLayerVisibility||r.visible){const e=r&&null!=r.opacity?r.opacity:null,l=null!=e?e*t:t;if("building-group"===r.type){const e={type:"symbol-table",title:r.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(r.sublayers,l);e.infos.push(...t),s=[e,...s]}else if(r.renderer){s=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:l,sublayer:r}),...s]}}}return s.filter((e=>!!e&&(!("infos"in e)||e.infos.length>0)))}async _constructLegendElementsForSublayers(){this.legendElements=[],this._handles.remove("sublayers-watcher");const e=this.layer;this._handles.add(p((()=>e.sublayers),(()=>this._constructLegendElementsForSublayers)),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){se.warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForSublayers(e,t,s){const l=this.layer;let r=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForSublayers())),"sublayers-watcher");let i=e.toArray();!s&&this.sublayerIds&&this.sublayerIds.length&&(i=this.sublayerIds.map((e=>l.findSublayerById(e))).filter(Boolean));for(const n of i){const e=p((()=>[n.renderer,n.opacity,n.title,n.visible,n.legendEnabled]),(()=>this._constructLegendElementsForSublayers()),{equals:o});if(this._handles.add(e,"sublayers-watcher"),!this.respectLayerVisibility||n.visible&&n.legendEnabled&&this._isSublayerInScale(n)){const e=n&&null!=n.opacity?n.opacity:null,l=null!=e?e*t:t;if(n.renderer&&!n.sublayers&&n.originIdOf("renderer")>w.SERVICE){await n.load();r=[...await this._getRendererLegendElements(n.renderer,{title:n.title,opacity:l,sublayer:n}),...r]}else{const e=await this._generateSymbolTableElementForSublayer(n,l,s);e&&r.unshift(e)}}}return r.filter((e=>!!e&&(!("infos"in e)||e.infos.length>0)))}async _generateSymbolTableElementForSublayer(e,t,s){if(!s){s=new Map;const t=this.layer,l=e.source;let r=null;if(!(!l||"map-layer"===l.type&&l.mapLayerId===e.id&&(!l.gdbVersion||l.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>w.SERVICE||e.originIdOf("labelingInfo")>w.SERVICE||e.originIdOf("labelsVisible")>w.SERVICE){const e=new I({layer:this.layer});r=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const i=r||`${t.uid}-default`;(await this._getLegendLayers(i,r)).forEach((e=>s.set(e.layerId,e)))}const l=s.get(e.id);if((!l||l?.subLayerIds&&l.defaultVisibility)&&e.sublayers){const l=await this._generateLegendElementsForSublayers(e.sublayers,t,s);return{type:"symbol-table",title:e.title,infos:l}}return this._generateSymbolTableElementForLegendLayer(l,e,t)}_generateSymbolTableElementForLegendLayer(e,t,s){if(!e||!e.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const l=t?.renderer;let r=t?.title||e.layerName;if(l&&(!t||t?.originIdOf("renderer")>w.SERVICE)){const e=t?.title||this._getRendererTitle(l,t);e&&(r&&"string"!=typeof e&&"title"in e&&(e.title=r),r=e)}const i={type:"symbol-table",title:r,legendType:e.legendType?e.legendType:null,infos:[]},n=t?this._sanitizeLegendForSublayer(e.legend.slice(),t):e.legend;return e.legendGroups?.length>0?e.legendGroups.forEach((t=>{const l={type:"symbol-table",title:t.heading,legendType:e.legendType?e.legendType:null,infos:this._generateSymbolTableElementInfosForLegendLayer(n.filter((e=>e.groupId===t.id)),e.layerId,s)};l.infos?.length>0&&i.infos.push(l)})):i.infos=this._generateSymbolTableElementInfosForLegendLayer(n,e.layerId,s),i.infos.length>0?i:null}_generateSymbolTableElementInfosForLegendLayer(e,t,l){return e.map((e=>{let r=e.url;if(e.imageData&&e.imageData.length>0)r=`data:image/png;base64,${e.imageData}`;else{if(0===r.indexOf("http"))return null;r=s(`${this.layer.url}/${t}/images/${r}`)}return{label:e.label,src:r,opacity:null==l?this.opacity:l,width:e.width,height:e.height}})).filter((e=>!!e))}_isSublayerInScale(e){const t=e.minScale||0,s=e.maxScale||0;return!(t>0&&t<this.scale||s>this.scale)}_isLegendLayerInScale(e,t){const s=t||this.layer;let l=null,r=null,i=!0;return!s.minScale&&0!==s.minScale||!s.maxScale&&0!==s.maxScale?(0===e.minScale&&s.tileInfo&&(l=s.tileInfo.lods[0].scale),0===e.maxScale&&s.tileInfo&&(r=s.tileInfo.lods[s.tileInfo.lods.length-1].scale)):(l=Math.min(s.minScale,e.minScale)||s.minScale||e.minScale,r=Math.max(s.maxScale,e.maxScale)),(l>0&&l<this.scale||r>this.scale)&&(i=!1),i}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&this.layer.version<10.1||0===e.length)return e;const s=t.renderer,l=e.some((e=>e.values));let r=null,i=null;return l&&e.some(((e,t)=>(e.values||(r=t,i=e,i.label||(i.label="others")),null!=i))),s?"unique-value"===s.type?i&&(e.splice(r,1),e.push(i)):"class-breaks"===s.type&&(i&&e.splice(r,1),e.reverse(),i&&e.push(i)):i&&(e.splice(r,1),e.push(i)),e}async _getRendererLegendElements(e,t={}){return Re(e,this.view)?ve(e)?this._constructPointCloudRendererLegendElements(e,t):Ce(e)?this._constructDotDensityRendererLegendElements(e):this._constructRendererLegendElements(e,t):(se.warn(`Renderer of type '${e.type}' not supported!`),[])}_getPointCloudRendererTitle(e){return e.legendOptions&&e.legendOptions.title||e.field}_constructPointCloudRendererLegendElements(e,t={}){const s=t.title,l=[];let r=null,i=null;if(Le(e))r={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach((e=>{r.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(ce,e.color)})}));else if(Ee(e)){const t=e.stops;let l=null;if(t.length&&(1===t.length&&(l=t[0].color),!l)){const e=t[0].value,s=t[t.length-1].value;if(null!=e&&null!=s){l=A(e+(s-e)/2,t)}}r={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(ce,l||ce.color)}]};const n=U(e.stops);i={type:"color-ramp",title:s||this._getPointCloudRendererTitle(e),infos:n,preview:j(n.map((e=>e.color)))}}else Ie(e)&&(r={type:"symbol-table",title:s||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos.forEach((e=>{r.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(ce,e.color)})})));r&&r.infos.length&&l.push(r),i&&i.infos.length&&l.push(i);const n=l.reduce(((e,t)=>e.concat(t.infos)),[]).filter((e=>!!e.symbol)).map((t=>this._getSymbolPreview(t,this.opacity,{symbolConfig:{applyColorModulation:!!e.colorModulation}})));return y(n).then((()=>l))}_getElementInfoForDotDensity(e,t){const{backgroundColor:s,outline:l,dotSize:r}=e,i=this.effectList?.effects.map((e=>e.toJSON())),n=E(i),a=r+"-"+t+"-"+s+"-"+(l&&JSON.stringify(l.toJSON()))+"-"+n,o=this._dotDensityUrlCache,u=o.has(a)?o.get(a):D(e,t);o.set(a,u);const c={shape:{type:"image",x:0,y:0,width:u.width,height:u.height,src:u.src},fill:null,stroke:null,offset:[0,0]},d=x([[c]],[u.width,u.height],{effectView:this.effectList});return{opacity:1,src:u.src,preview:d,width:u.width,height:u.height}}_constructDotDensityRendererLegendElements(e){const t=e.calculateDotValue(this.view.scale),s=e.legendOptions&&e.legendOptions.unit,l={type:"symbol-table",title:{value:t&&Math.round(t),unit:s||""},infos:[]};return e.attributes.forEach((t=>{const s=this._getElementInfoForDotDensity(e,t.color);s.label=t.label||t.valueExpressionTitle||t.field,l.infos.push(s)})),Promise.resolve([l])}async _constructRendererLegendElements(e,t={}){const{title:s,sublayer:l}=t,r=l||this.layer;let i=await this._loadRenderer(e);this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const n=await this._getVisualVariableLegendElements(i,r)||[],a={type:"symbol-table",title:s||this._getRendererTitle(i,r),infos:[]};let o=null,u=!1;const d=new Set;if(ye(i)&&!this._hasSizeRamp){const e=await X(i);a.infos.push({label:null,symbol:e})}else if(Ue(i)){let e=s;const t=Be(i)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",l=n.findIndex((e=>"color-ramp"===e.type)),r=-1!==l?n.splice(l,1)[0]:null,a=n.findIndex((e=>"size-ramp"===e.type)),o=-1!==a?n.splice(a,1)[0]:null,u=[];r&&(e=r.title,u.push(r)),o&&(e=o.title,u.push(o)),u.length>0&&n.push({type:t,title:e,infos:u})}else if(_e(i)){const e=N(i);n.push({type:"heatmap-ramp",title:s,infos:e,preview:j(e.map((e=>e.color)),{effectList:this.effectList})})}else if(Se(i)){const e=i&&i.authoringInfo;if(e&&"relationship"===e.type){const{focus:t,numClasses:s,field1:l,field2:o}=e;if(s&&l&&o){const e=[l,o];let u=q(t)||0;for(const t of e){const{field:e,normalizationField:s,label:l}=t,i=l||{field:this._getFieldAlias(e,r),normField:s&&this._getFieldAlias(s,r)},n=ke.clone();n.angle=u,a.infos.push({label:i,symbol:n}),d.add(n),u+=90}const c=W({focus:t,numClasses:s,infos:i.uniqueValueInfos});n.unshift(c)}}else{const e=i.field;i.uniqueValueInfos.forEach((t=>{t.symbol&&a.infos.push({label:t.label||this._getDomainName(e,t.value,r)||t.value,value:t.value,symbol:t.symbol})}))}i.defaultSymbol&&(a.infos.push({label:i.defaultLabel||"others",symbol:i.defaultSymbol}),u=!0)}else if(be(i)){o=this._isUnclassedRenderer(i);(!o||!this._hasSizeRamp)&&(i.classBreakInfos.forEach((e=>{e.symbol&&a.infos.unshift({label:e.label||(o?null:e.minValue+" - "+e.maxValue),value:[e.minValue,e.maxValue],symbol:e.symbol})})),o&&(a.title=null),this._updateInfosforClassedSizeRenderer(i,a.infos)),i.defaultSymbol&&!o&&(a.infos.push({label:i.defaultLabel||"others",symbol:i.defaultSymbol}),u=!0)}else if(pe(i))if(Me(this.layer)||Pe(this.layer)){const e=this._constructTileImageryStretchRendererElements(i);Ae(e)?n.push(e):a.infos=e}else{const e=this.layer;let t,s;i.statistics&&i.statistics.length&&(t=null!=i.statistics[0].min?i.statistics[0].min:i.statistics[0][0],s=null!=i.statistics[0].max?i.statistics[0].max:i.statistics[0][1]);let l=[];const r=c(e.renderingRule?await e.generateRasterInfo(e.renderingRule):e.serviceRasterInfo),o=r.keyProperties.BandProperties,u=ue[e.rasterInfo.pixelType.toLowerCase()];1===r.bandCount||e.bandIds&&1===e.bandIds.length?(t=null!=t?t:r.statistics?r.statistics[e.bandIds[0]].min:u[0],s=null!=s?s:r.statistics?r.statistics[e.bandIds[0]].max:u[1],t||s?n.push(this._getStretchLegendElements(i,{min:t,max:s})):this._getServerSideLegend()):r.bandCount>=3?o&&o.length>=r.bandCount?e.bandIds&&3===e.bandIds.length?(l=e.bandIds.map((e=>o[e].BandName)),a.infos=this._createSymbolTableElementMultiBand(l)):"lerc"===e.format?(l=[0,1,2].map((e=>o[e].BandName)),a.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend():"lerc"===e.format?(l=["band1","band2","band3"],a.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend():this._getServerSideLegend()}else if(me(i))i.colormapInfos.forEach((e=>{a.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(de,e.color)})}));else if(ge(i)){let e=i.symbol;switch(t.geometryType){case"point":e="pointSymbol"in r&&r.pointSymbol;break;case"polyline":e="lineSymbol"in r&&r.lineSymbol;break;case"polygon":e="polygonSymbol"in r&&r.polygonSymbol}i.symbol&&!this._hasSizeRamp&&a.infos.push({label:i.label,symbol:e})}else if(he(i)){i.outputUnit&&(this.title="("+i.toJSON().outputUnit+")"),a.title=i.attributeField;const e=i.getClassBreakInfos();e?.length?e.forEach((e=>{a.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})})):a.infos.push({label:i.attributeField,symbol:i.getDefaultSymbol()})}else fe(i)&&n.push(this._getStretchLegendElements(i,{min:0,max:255}));const h=i.defaultSymbol;!h||u||ge(i)||o&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||n.push({type:"symbol-table",infos:[{label:i.defaultLabel||"others",symbol:h}]}),a.infos.length&&n.unshift(a);const m=null==t.opacity?this.opacity:t.opacity,p=this._isTallSymbol("visualVariables"in i&&i.visualVariables),f=Oe(this.layer)||Me(this.layer),g=n.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]).filter((e=>!!e?.symbol)).map((e=>this._getSymbolPreview(e,m,{isDefault:e.symbol===h,applyScaleDrivenSize:!d.has(e.symbol),symbolConfig:{isTall:p,isSquareFill:f},effectList:d.has(e.symbol)?null:this.effectList})));return i=null,await y(g),n}_getServerSideLegend(){setTimeout((()=>this.buildLegendElementsForTools()),0)}_getAllInfos(e){const t=e?.infos;return t?t.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]):[e]}_constructTileImageryStretchRendererElements(e){const t=this.layer,s=t.rasterInfo,l=s.bandCount||e.statistics.length;let r,i,n=[];const a=s.keyProperties&&s.keyProperties.BandProperties,o=e?.statistics?.length?e.statistics:s?.statistics;if(o)r=void 0!==o[0].min?o[0].min:o[0][0],i=o[0].max||o[0][1];else{const e=ue[t.rasterInfo.pixelType.toLowerCase()];r=e[0],i=e[1]}if(t.hasStandardTime()&&(r=t.getStandardTimeValue(r),i=t.getStandardTimeValue(i)),1===s.bandCount||1===t.bandIds?.length)return this._getStretchLegendElements(e,{min:r,max:i});function u(e){const l=(t?.bandIds?.length?t.bandIds:Array.from(Array(Math.min(s.bandCount,3)).keys())).map((t=>e&&e[t]&&e[t].BandName||"band"+(t+1)));return l.length<3?l.push(l[1]):l.length>3&&l.splice(3),l}return n=a&&a.length>=l?u(a):u(),this._createSymbolTableElementMultiBand(n)}_getStretchLegendElements(e,t){const s=e.colorRamp,l=B(s,t);return{type:"stretch-ramp",title:"",infos:l,preview:j(l.map((e=>e.color)))}}async _getSizeLegendElement(e,t,s,l){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(t):e,infos:await $(s,t,await K(s),this.scale,this.view.type,l)}}_createSymbolTableElementMultiBand(e){const t=[],s=["red","green","blue"];return e.forEach(((e,l)=>{t.push({label:{colorName:s[l],bandName:e},src:Y[l],opacity:1})})),t}_updateInfosforClassedSizeRenderer(e,t){const s=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,l=e.classBreakInfos.some((e=>M(e.symbol)));if(s&&l){const s=G,l=J,r=e.classBreakInfos.length,i=(s-l)/(r>1?r-1:r);t.forEach(((e,t)=>{e.size=s-i*t}))}}_isTallSymbol(e){let t=!1,s=!1;if(e)for(let l=0;l<e.length&&(!t||!s);l++){const r=e[l];"size"===r.type&&("height"===r.axis&&(t=!0),"width-and-depth"===r.axis&&(s=!0))}return t&&s}async _getSymbolPreview(e,t,s){let l=!s?.isDefault&&null==e.size&&this._hasSizeRamp?b(z.size):e.size;if(this._scaleDrivenSizeVariable&&s?.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");l=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}return O(e.symbol,{size:l,opacity:t,scale:!1,symbolConfig:s?.symbolConfig,effectView:s?.effectList}).then((t=>(e.preview=t,e))).catch((()=>(e.preview=null,e)))}async _loadRenderer(e){const t=[],s=this.layer;e=e.clone(),this._hasClusterSizeVariable=!1;const l="visualVariables"in e&&e.visualVariables?.some((e=>"size"===e.type&&"outline"!==e.target&&!ae.test(e.valueExpression)));if(e&&"visualVariables"in e&&!l&&"featureReduction"in s&&"cluster"===s.featureReduction?.type){const t=this.layerView._effectiveRenderer,l=c(P(t,this.view));if(l){const t=s.featureReduction;if("clusterMinSize"in t&&"clusterMaxSize"in t){const{clusterMinSize:e,clusterMaxSize:s}=t;l.legendOptions=new V({showLegend:e!==s})}const r=e.visualVariables||[];e.visualVariables=r.concat([l]),this._hasClusterSizeVariable=!0}}const r=await K(e);if(be(e)||Se(e)){const s=(e.classBreakInfos||e.uniqueValueInfos).map((e=>this._fetchSymbol(e.symbol,r).then((t=>{e.symbol=t})).catch((()=>{e.symbol=null}))));Array.prototype.push.apply(t,s)}return t.push(this._fetchSymbol(e.symbol||e.defaultSymbol,e.defaultSymbol?null:r).then((t=>{this._applySymbolToRenderer(e,t,ge(e))})).catch((()=>{this._applySymbolToRenderer(e,null,ge(e))}))),y(t).then((()=>e))}_applySymbolToRenderer(e,t,s){s?e.symbol=t:e.defaultSymbol=t}_fetchSymbol(e,t){if(!e)return Promise.reject();if("web-style"===e.type){const s=e.portal,l=s&&s.url,r=s&&s.user&&s.user.username,i=e.name+"-"+e.styleName+"-"+e.styleUrl+"-"+l+"-"+r,n=this._webStyleSymbolCache;return n.has(i)||("2d"===this.view.type?n.set(i,e.fetchCIMSymbol()):n.set(i,e.fetchSymbol())),n.get(i).then((e=>this._getAppliedCloneSymbol(e,t))).catch((()=>{throw se.warn("Fetching web-style failed!"),new Error}))}return Promise.resolve(this._getAppliedCloneSymbol(e,t))}_getAppliedCloneSymbol(e,s){if(!e||!s)return e;const l=e.clone(),r=s&&s.toRgba();return l.type.includes("3d")?this._applyColorTo3dSymbol(l,r):"cim"===l.type?T(l,s):l.color&&(l.color=new t(r||l.color)),l}_applyColorTo3dSymbol(e,s){s&&e.symbolLayers.forEach((e=>{e&&(e.material||(e.material={}),e.material.color=new t(s))}))}async _getVisualVariableLegendElements(e,t){if(!("visualVariables"in e)||!e.visualVariables||"vector-field"===e.type)return null;const s=e.visualVariables,l=[],r=[],i=[];for(const c of s)"color"===c.type?l.push(c):"size"===c.type?r.push(c):"opacity"===c.type&&i.push(c);const n=[...l,...r,...i];let a,o;if(0===l.length&&be(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];a=t&&t.symbol}if(0===l.length&&ge(e)&&(a=e.symbol),a)if(a.type.includes("3d")){const e=a.symbolLayers.getItemAt(0);"water"===e.type?d(e.color)&&(o=e.color):d(e.material)&&d(e.material.color)&&(o=e.material.color)}else a.url||(o=a.color);const u=this.effectList;return(await Promise.all(n.map((async s=>{if(!s.legendOptions||!1!==s.legendOptions.showLegend){const l=ye(e)?s.field:this._getRampTitle(s,t);let r=null;const i="getField"in t&&t.getField&&t.getField(s.field),n=i&&C(i);if("color"===s.type){const e=await k(s,null,n);r={type:"color-ramp",title:l,infos:e,preview:j(e.map((e=>e.color)),{effectList:u})},this._hasColorRamp||(this._hasColorRamp=!(null==r.infos||!r.infos.length))}else if("size"===s.type&&"outline"!==s.target)ae.test(s.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=s):(r=await this._getSizeLegendElement(l,s,e,n),this._hasSizeRamp||(this._hasSizeRamp=!(null==r.infos||!r.infos.length)));else if("opacity"===s.type){const e=await k(s,o,n);r={type:"opacity-ramp",title:l,infos:e,preview:j(e.map((e=>e.color)),{effectList:u})},this._hasOpacityRamp||(this._hasOpacityRamp=!(null==r.infos||!r.infos.length))}return r&&r.infos?r:null}})))).filter((e=>!!e))}_getDomainName(e,t,s){if(e&&"function"!=typeof e){const l="getField"in s&&s.getField&&s.getField(e),r=l&&"getFieldDomain"in s&&s.getFieldDomain?s.getFieldDomain(l.name):null;return r&&"coded-value"===r.type?r.getName(t):null}return null}_getClusterTitle(e){const t=this.layer,s=e.field;if("featureReduction"in t&&t.featureReduction&&"cluster"===t.featureReduction.type){const e=t.featureReduction,l="popupTemplate"in e&&e.popupTemplate,r=l&&l.fieldInfos;if(r)for(const t of r)if(t.fieldName===s)return"cluster_count"===s?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let s=e.field,l=e.normalizationField,r=!1,i=!1,n=!1,a=null;s="function"==typeof s?null:s,l="function"==typeof l?null:l;const o=e.legendOptions&&e.legendOptions.title;if(null!=o)a=o;else if(e.valueExpressionTitle)a=e.valueExpressionTitle;else{if("renderer"in t&&t.renderer&&"authoringInfo"in t.renderer&&t.renderer.authoringInfo&&t.renderer.authoringInfo.visualVariables){const e=t.renderer.authoringInfo.visualVariables;for(let t=0;t<e.length;t++){const s=e[t];if("color"===s.type){if("ratio"===s.style){r=!0;break}if("percent"===s.style){i=!0;break}if("percent-of-total"===s.style){n=!0;break}}}}a={field:s&&this._getFieldAlias(s,t),normField:l&&this._getFieldAlias(l,t),ratio:r,ratioPercent:i,ratioPercentTotal:n}}return a}_getRendererTitle(e,t){const s=e;if(s.legendOptions&&s.legendOptions.title)return s.legendOptions.title;if(s.valueExpressionTitle)return s.valueExpressionTitle;let l=s.field,r=null,i=null;be(s)&&(r=s.normalizationField,i="percent-of-total"===s.normalizationType),l="function"==typeof l?null:l,r="function"==typeof r?null:r;let n=null;return(l||r)&&(n={field:l&&this._getFieldAlias(l,t),normField:r&&this._getFieldAlias(r,t),normByPct:i}),n}_getFieldAlias(e,t){const s="popupTemplate"in t&&t.popupTemplate,l=s&&s.fieldInfos;let r=null;l&&l.some((t=>e===t.fieldName&&(r=t,!0)));let i=null;"getField"in t&&t.getField?i=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(i=t.fieldsIndex.get(e));const n=r||i;let a=null;return n&&(a=r&&r.label||i&&i.alias||"name"in n&&n.name||"fieldName"in n&&n.fieldName),a}_isUnclassedRenderer(e){const t=e.visualVariables;let s=!1;return be(e)&&e.classBreakInfos&&1===e.classBreakInfos.length&&t&&(s=e.field?t.some((t=>!(!t||e.field!==t.field||(e.normalizationField||t.normalizationField)&&e.normalizationField!==t.normalizationField))):!!t.length),s}};e([_()],qe.prototype,"children",void 0),e([_({readOnly:!0})],qe.prototype,"effectList",null),e([_()],qe.prototype,"layerView",void 0),e([_()],qe.prototype,"layer",void 0),e([_()],qe.prototype,"legendElements",void 0),e([_({readOnly:!0})],qe.prototype,"opacity",null),e([_()],qe.prototype,"parent",void 0),e([_({readOnly:!0,dependsOn:[]})],qe.prototype,"ready",null),e([_()],qe.prototype,"hideLayersNotInCurrentView",void 0),e([_()],qe.prototype,"keepCacheOnDestroy",void 0),e([_()],qe.prototype,"respectLayerVisibility",void 0),e([_({readOnly:!0})],qe.prototype,"scale",null),e([_()],qe.prototype,"sublayerIds",void 0),e([_({readOnly:!0})],qe.prototype,"isScaleDriven",null),e([_()],qe.prototype,"title",void 0),e([_({readOnly:!0,dependsOn:["ready"],value:0})],qe.prototype,"version",null),e([_()],qe.prototype,"view",void 0),qe=e([v("esri.widgets.Legend.support.ActiveLayerInfo")],qe);const We=qe;export{We as default};
package/widgets/Legend.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import s from"../core/Handles.js";import{on as t,watch as i,init as r}from"../core/watchUtils.js";import{aliasOf as o}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import l from"./Widget.js";import c from"./Legend/LegendViewModel.js";import p from"./Legend/styles/Card.js";import h from"./Legend/styles/Classic.js";import"./support/widgetUtils.js";import{messageBundle as y}from"./support/decorators/messageBundle.js";import{tsx as v}from"./support/jsxFactory.js";const g={base:"esri-legend",widget:"esri-widget",panel:"esri-widget--panel",widgetIcon:"esri-icon-layer-list"};let f=class extends l{constructor(e,t){super(e,t),this._handles=new s,this.activeLayerInfos=null,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.headingLevel=3,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.iconClass=g.widgetIcon,this.label=void 0,this.layerInfos=null,this.messages=null,this.style=new h,this.view=null,this.viewModel=new c}initialize(){this.own([t(this,"view","resize",(()=>this.scheduleRender())),t(this,"activeLayerInfos","change",(()=>this._refreshActiveLayerInfos(this.activeLayerInfos))),i(this,"headingLevel",(e=>{const{style:s}=this;s&&(s.headingLevel=e)})),r(this,"style",((e,s)=>{s&&e!==s&&s.destroy(),e&&(e.activeLayerInfos=this.activeLayerInfos,"card"===e.type&&(e.view=this.view),e.headingLevel=this.headingLevel)}))])}destroy(){this._handles.destroy(),this._handles=null}castStyle(e){if(e instanceof p||e instanceof h)return e;if("string"==typeof e)return"card"===e?new p:new h;if(e&&"string"==typeof e.type){const s={...e};delete s.type;return new("card"===e.type?p:h)(s)}return new h}render(){return v("div",{class:this.classes(g.base,g.widget,this.style instanceof h?g.panel:null)},this.style.render())}_refreshActiveLayerInfos(e){this._handles.removeAll(),e.forEach((e=>this._renderOnActiveLayerInfoChange(e))),this.scheduleRender()}_renderOnActiveLayerInfoChange(e){const s=r(e,"version",(()=>this.scheduleRender()));this._handles.add(s,`version_${e.layer.uid}`);const i=t(e,"children","change",(()=>{e.children.forEach((e=>this._renderOnActiveLayerInfoChange(e)))}));this._handles.add(i,`children_${e.layer.uid}`),e.children.forEach((e=>this._renderOnActiveLayerInfoChange(e)))}};e([o("viewModel.activeLayerInfos")],f.prototype,"activeLayerInfos",void 0),e([o("viewModel.basemapLegendVisible")],f.prototype,"basemapLegendVisible",void 0),e([o("viewModel.groundLegendVisible")],f.prototype,"groundLegendVisible",void 0),e([a()],f.prototype,"headingLevel",void 0),e([o("viewModel.hideLayersNotInCurrentView")],f.prototype,"hideLayersNotInCurrentView",void 0),e([o("viewModel.keepCacheOnDestroy")],f.prototype,"keepCacheOnDestroy",void 0),e([o("viewModel.respectLayerVisibility")],f.prototype,"respectLayerVisibility",void 0),e([a()],f.prototype,"iconClass",void 0),e([a({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],f.prototype,"label",void 0),e([o("viewModel.layerInfos")],f.prototype,"layerInfos",void 0),e([a(),y("esri/widgets/Legend/t9n/Legend")],f.prototype,"messages",void 0),e([a()],f.prototype,"style",void 0),e([n("style")],f.prototype,"castStyle",null),e([o("viewModel.view")],f.prototype,"view",void 0),e([a()],f.prototype,"viewModel",void 0),f=e([d("esri.widgets.Legend")],f);const w=f;export{w as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import s from"../core/Handles.js";import{destroyMaybe as t}from"../core/maybe.js";import{on as i,watch as r,initial as o}from"../core/reactiveUtils.js";import{aliasOf as n}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as a}from"../core/accessorSupport/decorators/cast.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import p from"./Legend/LegendViewModel.js";import h from"./Legend/styles/Card.js";import y from"./Legend/styles/Classic.js";import"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import{tsx as f}from"./support/jsxFactory.js";const g={base:"esri-legend",widget:"esri-widget",panel:"esri-widget--panel",widgetIcon:"esri-icon-layer-list"};let m=class extends c{constructor(e,t){super(e,t),this._handles=new s,this.activeLayerInfos=null,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.headingLevel=3,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.iconClass=g.widgetIcon,this.label=void 0,this.layerInfos=null,this.messages=null,this.style=new y,this.view=null,this.viewModel=new p}initialize(){this.own([i((()=>this.view),"resize",(()=>this.scheduleRender())),i((()=>this.activeLayerInfos),"change",(()=>this._refreshActiveLayerInfos(this.activeLayerInfos))),r((()=>this.headingLevel),(e=>{const{style:s}=this;s&&(s.headingLevel=e)})),r((()=>this.style),((e,s)=>{s&&e!==s&&s.destroy(),e&&(e.activeLayerInfos=this.activeLayerInfos,"card"===e.type&&(e.view=this.view),e.headingLevel=this.headingLevel)}),o)])}destroy(){this._handles=t(this._handles)}castStyle(e){if(e instanceof h||e instanceof y)return e;if("string"==typeof e)return"card"===e?new h:new y;if(e&&"string"==typeof e.type){const s={...e};delete s.type;return new("card"===e.type?h:y)(s)}return new y}render(){return f("div",{class:this.classes(g.base,g.widget,this.style instanceof y?g.panel:null)},this.style.render())}_refreshActiveLayerInfos(e){this._handles.removeAll(),e.forEach((e=>this._renderOnActiveLayerInfoChange(e))),this.scheduleRender()}_renderOnActiveLayerInfoChange(e){const s=r((()=>e.version),(()=>this.scheduleRender()));this._handles.add(s,`version_${e.layer.uid}`);const t=i((()=>e.children),"change",(()=>e.children.forEach((e=>this._renderOnActiveLayerInfoChange(e)))),o);this._handles.add(t,`children_${e.layer.uid}`),e.children.forEach((e=>this._renderOnActiveLayerInfoChange(e)))}};e([n("viewModel.activeLayerInfos")],m.prototype,"activeLayerInfos",void 0),e([n("viewModel.basemapLegendVisible")],m.prototype,"basemapLegendVisible",void 0),e([n("viewModel.groundLegendVisible")],m.prototype,"groundLegendVisible",void 0),e([d()],m.prototype,"headingLevel",void 0),e([n("viewModel.hideLayersNotInCurrentView")],m.prototype,"hideLayersNotInCurrentView",void 0),e([n("viewModel.keepCacheOnDestroy")],m.prototype,"keepCacheOnDestroy",void 0),e([n("viewModel.respectLayerVisibility")],m.prototype,"respectLayerVisibility",void 0),e([d()],m.prototype,"iconClass",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],m.prototype,"label",void 0),e([n("viewModel.layerInfos")],m.prototype,"layerInfos",void 0),e([d(),v("esri/widgets/Legend/t9n/Legend")],m.prototype,"messages",void 0),e([d()],m.prototype,"style",void 0),e([a("style")],m.prototype,"castStyle",null),e([n("viewModel.view")],m.prototype,"view",void 0),e([d()],m.prototype,"viewModel",void 0),m=e([l("esri.widgets.Legend")],m);const L=m;export{L as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/LineOfSightAnalysis.js";import s from"../../analysis/LineOfSightAnalysisObserver.js";import o from"../../analysis/LineOfSightAnalysisTarget.js";import i from"../../core/Collection.js";import{castForReferenceSetter as n,referenceSetter as r}from"../../core/collectionUtils.js";import a from"../../core/Handles.js";import{handlesGroup as l}from"../../core/handleUtils.js";import{destroyMaybe as d,isNone as h,isSome as c,applySome as g,unwrap as m}from"../../core/maybe.js";import{watch as p,syncAndInitial as y,sync as T}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import _ from"./LineOfSightTarget.js";import{AnalysisViewModel as w}from"../support/AnalysisViewModel.js";const f=i.ofType(_);let A=class extends w{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="LineOfSightViewModel is only supported in 3D views.",this._handles=new a,this._vmTargetsToConnection=new Map,this._analysisTargetsToConnection=new Map}initialize(){this._handles.add([this.targets.on("after-add",(e=>this._onViewModelTargetAdded(e.item))),this.targets.on("after-remove",(e=>this._onViewModelTargetRemoved(e.item))),p((()=>this.analysis),(e=>this._onAnalysisChange(e)),y)])}destroy(){this._analysisTargetsToConnection.forEach((e=>e.remove())),this._handles=d(this._handles)}get state(){return this.disabled||!this.ready?"disabled":h(this.tool)?"ready":this.tool.state}get observer(){return c(this.analysis.observer)?this.analysis.observer.position:null}set observer(e){this.analysis.observer=new s({position:e})}get targets(){return this._get("targets")||new f}set targets(e){this._set("targets",r(e,this.targets,f))}clearAnalysis(){this.observer=null,this.targets.removeAll()}continue(){c(this.tool)&&this.tool.continue()}stop(){c(this.tool)&&this.tool.stop()}get testInfo(){return{getAnalysisTargetFromViewModelTarget:e=>g(this._vmTargetsToConnection.get(e),(e=>e.analysisTarget))}}constructAnalysis(){return new t}async onConnectToAnalysisView(e){this._handles.add([e.on("result-changed",(e=>{const t=this._analysisTargetsToConnection.get(e.target);c(e.result)?(t.viewModelTarget.intersectedGraphic=e.result.intersectedGraphic,t.viewModelTarget.intersectedLocation=m(e.result.intersectedLocation),t.viewModelTarget.visible=e.result.visible):(t.viewModelTarget.intersectedGraphic=null,t.viewModelTarget.intersectedLocation=null,t.viewModelTarget.visible=void 0)}))],"view")}onDisconnectFromAnalysisView(){null!=this._handles&&this._handles.remove("view")}_onViewModelTargetAdded(e){if(this._vmTargetsToConnection.get(e))return;const t=new o({position:e.location});this._connectViewModelWithAnalysisTarget(e,t),this.analysis.targets.add(t)}_onViewModelTargetRemoved(e){const t=this._vmTargetsToConnection.get(e);t&&(t.remove(),this.analysis.targets.remove(t.analysisTarget))}_onAnalysisTargetAdded(e){if(this._analysisTargetsToConnection.get(e))return;const t=new _({location:g(e.position,(e=>e.clone()))});this._connectViewModelWithAnalysisTarget(t,e),this.targets.add(t)}_onAnalysisTargetRemoved(e){const t=this._analysisTargetsToConnection.get(e);t&&(t.remove(),this.targets.remove(t.viewModelTarget))}_connectViewModelWithAnalysisTarget(e,t){let s=!1;const o=l([p((()=>t.position),(t=>{s||(s=!0,e.location=g(t,(e=>e.clone())),s=!1)}),T),p((()=>e.location),(e=>{s||(s=!0,t.position=g(e,(e=>e.clone())),s=!1)}),T)]),i={analysisTarget:t,viewModelTarget:e,remove:()=>{o.remove(),this._vmTargetsToConnection.delete(e),this._analysisTargetsToConnection.delete(t)}};this._vmTargetsToConnection.set(e,i),this._analysisTargetsToConnection.set(t,i)}_onAnalysisChange(e){const t="analysis";this._handles.remove(t),this._handles.add([this.analysis.targets.on("after-add",(e=>this._onAnalysisTargetAdded(e.item))),this.analysis.targets.on("after-remove",(e=>this._onAnalysisTargetRemoved(e.item)))],t),this.targets.removeAll(),e.targets.forEach((e=>{this._onAnalysisTargetAdded(e)}))}};e([v({type:t})],A.prototype,"analysis",void 0),e([v({readOnly:!0})],A.prototype,"state",null),e([v()],A.prototype,"observer",null),e([v({type:f,cast:n,nonNullable:!0})],A.prototype,"targets",null),A=e([u("esri.widgets.lineOfSight.LineOfSightViewModel")],A);const M=A;export{M as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/LineOfSightAnalysis.js";import s from"../../analysis/LineOfSightAnalysisObserver.js";import o from"../../analysis/LineOfSightAnalysisTarget.js";import i from"../../core/Collection.js";import{castForReferenceSetter as n,referenceSetter as r}from"../../core/collectionUtils.js";import a from"../../core/Handles.js";import{handlesGroup as l}from"../../core/handleUtils.js";import{destroyMaybe as d,isNone as h,isSome as c,applySome as g,unwrap as y}from"../../core/maybe.js";import{watch as m,syncAndInitial as p,sync as T}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import _ from"./LineOfSightTarget.js";import{AnalysisViewModel as w}from"../support/AnalysisViewModel.js";const f=i.ofType(_);let A=class extends w{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="LineOfSightViewModel is only supported in 3D views.",this._handles=new a,this._vmTargetsToConnection=new Map,this._analysisTargetsToConnection=new Map}initialize(){this._handles.add([this.targets.on("after-add",(e=>this._onViewModelTargetAdded(e.item))),this.targets.on("after-remove",(e=>this._onViewModelTargetRemoved(e.item))),m((()=>this.analysis),(e=>this._onAnalysisChange(e)),p)])}destroy(){this._analysisTargetsToConnection.forEach((e=>e.remove())),this._handles=d(this._handles)}get state(){return this.disabled||!this.ready?"disabled":h(this.tool)?"ready":this.tool.state}get observer(){return c(this.analysis.observer)?this.analysis.observer.position:null}set observer(e){this.analysis.observer=new s({position:e})}get targets(){return this._get("targets")||new f}set targets(e){this._set("targets",r(e,this.targets,f))}clearAnalysis(){this.observer=null,this.targets.removeAll()}continue(){c(this.tool)&&this.tool.continue()}stop(){c(this.tool)&&this.tool.stop()}get testInfo(){return{analysisView:this.analysisView,getAnalysisTargetFromViewModelTarget:e=>g(this._vmTargetsToConnection.get(e),(e=>e.analysisTarget))}}constructAnalysis(){return new t}async onConnectToAnalysisView(e){this._handles.add([e.on("result-changed",(e=>{const t=this._analysisTargetsToConnection.get(e.target);c(e.result)?(t.viewModelTarget.intersectedGraphic=e.result.intersectedGraphic,t.viewModelTarget.intersectedLocation=y(e.result.intersectedLocation),t.viewModelTarget.visible=e.result.visible):(t.viewModelTarget.intersectedGraphic=null,t.viewModelTarget.intersectedLocation=null,t.viewModelTarget.visible=void 0)}))],"view")}onDisconnectFromAnalysisView(){null!=this._handles&&this._handles.remove("view")}_onViewModelTargetAdded(e){if(this._vmTargetsToConnection.get(e))return;const t=new o({position:e.location});this._connectViewModelWithAnalysisTarget(e,t),this.analysis.targets.add(t)}_onViewModelTargetRemoved(e){const t=this._vmTargetsToConnection.get(e);t&&(t.remove(),this.analysis.targets.remove(t.analysisTarget))}_onAnalysisTargetAdded(e){if(this._analysisTargetsToConnection.get(e))return;const t=new _({location:g(e.position,(e=>e.clone()))});this._connectViewModelWithAnalysisTarget(t,e),this.targets.add(t)}_onAnalysisTargetRemoved(e){const t=this._analysisTargetsToConnection.get(e);t&&(t.remove(),this.targets.remove(t.viewModelTarget))}_connectViewModelWithAnalysisTarget(e,t){let s=!1;const o=l([m((()=>t.position),(t=>{s||(s=!0,e.location=g(t,(e=>e.clone())),s=!1)}),T),m((()=>e.location),(e=>{s||(s=!0,t.position=g(e,(e=>e.clone())),s=!1)}),T)]),i={analysisTarget:t,viewModelTarget:e,remove:()=>{o.remove(),this._vmTargetsToConnection.delete(e),this._analysisTargetsToConnection.delete(t)}};this._vmTargetsToConnection.set(e,i),this._analysisTargetsToConnection.set(t,i)}_onAnalysisChange(e){const t="analysis";this._handles.remove(t),this._handles.add([this.analysis.targets.on("after-add",(e=>this._onAnalysisTargetAdded(e.item))),this.analysis.targets.on("after-remove",(e=>this._onAnalysisTargetRemoved(e.item)))],t),this.targets.removeAll(),e.targets.forEach((e=>{this._onAnalysisTargetAdded(e)}))}};e([v({type:t})],A.prototype,"analysis",void 0),e([v({readOnly:!0})],A.prototype,"state",null),e([v()],A.prototype,"observer",null),e([v({type:f,cast:n,nonNullable:!0})],A.prototype,"targets",null),A=e([u("esri.widgets.lineOfSight.LineOfSightViewModel")],A);const M=A;export{M as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../core/has.js";import{ignoreAbortErrors as t}from"../core/promiseUtils.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import a from"./Measurement/MeasurementViewModel.js";import"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{tsx as d}from"./support/jsxFactory.js";const l={base:"esri-measurement",widgetIcon:"esri-icon-measure"};function c(e){return e&&("esri.widgets.AreaMeasurement2D"===e.declaredClass||"esri.widgets.AreaMeasurement3D"===e.declaredClass)}let u=class extends o{constructor(e,t){super(e,t),this._widgets=new Map,this.activeTool=null,this.activeWidget=null,this.areaUnit=null,this.iconClass=l.widgetIcon,this.label=void 0,this.linearUnit=null,this.messages=null,this.view=null,this.viewModel=new a}initialize(){this.activeWidget&&this.viewModel.set("activeViewModel",this.activeWidget.viewModel),this.view&&this.activeTool&&this._getActiveWidget().then((e=>{this._set("activeWidget",e)})),this.own([this.watch(["view","activeTool"],(()=>{this._getActiveWidget().then((e=>{this._set("activeWidget",e)}))})),this.watch("activeWidget",((e,t)=>{this.viewModel.set("activeViewModel",e?e.viewModel:null),t&&(t.visible=!1)})),this.watch(["areaUnit","linearUnit","uiStrings"],(()=>this._updateSubWidgetProperties()))])}destroy(){this._destroyWidgets()}render(){const{activeWidget:e}=this,t=e&&!e.destroyed?e.render():null;return d("div",{class:l.base},t)}clear(){this.activeTool=null,this._destroyWidgets()}startMeasurement(){const{activeViewModel:e}=this.viewModel;e&&t(e.start())}async _createWidget(e){const{areaUnit:t,linearUnit:i,view:s}=this;switch(e){case"area":{const{type:i}=s;switch(i){case"2d":return new(0,(await import("./AreaMeasurement2D.js")).default)({view:s,unit:t,uiStrings:this._createUIStringsForWidget(e)});case"3d":return new(0,(await import("./AreaMeasurement3D.js")).default)({view:s,unit:t,uiStrings:this._createUIStringsForWidget(e)});default:return null}}case"distance":return new(0,(await import("./DistanceMeasurement2D.js")).default)({view:s,unit:i,uiStrings:this._createUIStringsForWidget(e)});case"direct-line":return new(0,(await import("./DirectLineMeasurement3D.js")).default)({view:s,unit:i,uiStrings:this._createUIStringsForWidget(e)});default:return null}}_destroyWidgets(){this._widgets.forEach((e=>e.destroy())),this._widgets.clear()}async _getActiveWidget(){const{activeTool:e,view:t}=this;if(!t||!e)return null;let i=null;if(this._widgets.has(e))i=this._widgets.get(e),i.visible=!0;else{if(i=await this._createWidget(e),!i)return null;await i.viewModel.start(),this._widgets.set(e,i)}return i}_createUIStringsForWidget(e){if(!this.uiStrings)return null;const t=e+"-"+this.view.type;return this.uiStrings[t]}_updateSubWidgetProperties(){this._widgets.forEach(((e,t)=>{const{areaUnit:i,linearUnit:s}=this;e.unit=c(e)?i:s,e.uiStrings=this._createUIStringsForWidget(t)}))}};e([i("viewModel.activeTool")],u.prototype,"activeTool",void 0),e([s({readOnly:!0})],u.prototype,"activeWidget",void 0),e([i("viewModel.areaUnit")],u.prototype,"areaUnit",void 0),e([s()],u.prototype,"iconClass",void 0),e([s({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],u.prototype,"label",void 0),e([i("viewModel.linearUnit")],u.prototype,"linearUnit",void 0),e([s(),n("esri/widgets/Measurement/t9n/Measurement")],u.prototype,"messages",void 0),e([s()],u.prototype,"uiStrings",void 0),e([i("viewModel.view")],u.prototype,"view",void 0),e([s({type:a})],u.prototype,"viewModel",void 0),u=e([r("esri.widgets.Measurement")],u);const p=u;export{p as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../core/has.js";import{equalsShallow as t}from"../core/lang.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{watch as s}from"../core/reactiveUtils.js";import{aliasOf as r}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/accessorSupport/ensureType.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import d from"./Measurement/MeasurementViewModel.js";import"./support/widgetUtils.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import{tsx as c}from"./support/jsxFactory.js";const u={base:"esri-measurement",widgetIcon:"esri-icon-measure"};function p(e){return e&&("esri.widgets.AreaMeasurement2D"===e.declaredClass||"esri.widgets.AreaMeasurement3D"===e.declaredClass)}let g=class extends n{constructor(e,t){super(e,t),this._widgets=new Map,this.activeTool=null,this.activeWidget=null,this.areaUnit=null,this.iconClass=u.widgetIcon,this.label=void 0,this.linearUnit=null,this.messages=null,this.view=null,this.viewModel=new d}initialize(){this.activeWidget&&this.viewModel.set("activeViewModel",this.activeWidget.viewModel),this.view&&this.activeTool&&this._getActiveWidget().then((e=>{this._set("activeWidget",e)})),this.own([s((()=>[this.view,this.activeTool]),(async()=>{this._set("activeWidget",await this._getActiveWidget())}),{equals:t}),s((()=>this.activeWidget),((e,t)=>{this.viewModel.set("activeViewModel",e?e.viewModel:null),t&&(t.visible=!1)})),s((()=>[this.areaUnit,this.linearUnit,this.uiStrings]),(()=>this._updateSubWidgetProperties()),{equals:t})])}destroy(){this._destroyWidgets()}render(){const{activeWidget:e}=this,t=e&&!e.destroyed?e.render():null;return c("div",{class:u.base},t)}clear(){this.activeTool=null,this._destroyWidgets()}startMeasurement(){const{activeViewModel:e}=this.viewModel;e&&i(e.start())}async _createWidget(e){const{areaUnit:t,linearUnit:i,view:s}=this;switch(e){case"area":{const{type:i}=s;switch(i){case"2d":return new(0,(await import("./AreaMeasurement2D.js")).default)({view:s,unit:t,uiStrings:this._createUIStringsForWidget(e)});case"3d":return new(0,(await import("./AreaMeasurement3D.js")).default)({view:s,unit:t,uiStrings:this._createUIStringsForWidget(e)});default:return null}}case"distance":return new(0,(await import("./DistanceMeasurement2D.js")).default)({view:s,unit:i,uiStrings:this._createUIStringsForWidget(e)});case"direct-line":return new(0,(await import("./DirectLineMeasurement3D.js")).default)({view:s,unit:i,uiStrings:this._createUIStringsForWidget(e)});default:return null}}_destroyWidgets(){this._widgets.forEach((e=>e.destroy())),this._widgets.clear()}async _getActiveWidget(){const{activeTool:e,view:t}=this;if(!t||!e)return null;let i=null;if(this._widgets.has(e))i=this._widgets.get(e),i.visible=!0;else{if(i=await this._createWidget(e),!i)return null;await i.viewModel.start(),this._widgets.set(e,i)}return i}_createUIStringsForWidget(e){if(!this.uiStrings)return null;const t=e+"-"+this.view.type;return this.uiStrings[t]}_updateSubWidgetProperties(){this._widgets.forEach(((e,t)=>{const{areaUnit:i,linearUnit:s}=this;e.unit=p(e)?i:s,e.uiStrings=this._createUIStringsForWidget(t)}))}};e([r("viewModel.activeTool")],g.prototype,"activeTool",void 0),e([o({readOnly:!0})],g.prototype,"activeWidget",void 0),e([r("viewModel.areaUnit")],g.prototype,"areaUnit",void 0),e([o()],g.prototype,"iconClass",void 0),e([o({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],g.prototype,"label",void 0),e([r("viewModel.linearUnit")],g.prototype,"linearUnit",void 0),e([o(),l("esri/widgets/Measurement/t9n/Measurement")],g.prototype,"messages",void 0),e([o()],g.prototype,"uiStrings",void 0),e([r("viewModel.view")],g.prototype,"view",void 0),e([o({type:d})],g.prototype,"viewModel",void 0),g=e([a("esri.widgets.Measurement")],g);const v=g;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/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import o from"../../core/Handles.js";import{when as s}from"../../core/watchUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let a=class extends e{constructor(t){super(t),this._handles=new o,this.navigationMode="pan",this.view=null}initialize(){this._handles.add(s(this,"view.inputManager",this._setNavigationMode.bind(this)))}destroy(){this._handles.destroy(),this._handles=null,this.view=null}get state(){return this.get("view.ready")&&"3d"===this.view.type?"ready":"disabled"}toggle(){"disabled"!==this.state&&(this.navigationMode="pan"!==this.navigationMode?"pan":"rotate",this._setNavigationMode())}_setNavigationMode(){this.get("view.inputManager").primaryDragAction="pan"===this.navigationMode?"pan":"rotate"}};t([i({readOnly:!0})],a.prototype,"state",null),t([i()],a.prototype,"navigationMode",void 0),t([i()],a.prototype,"view",void 0),a=t([r("esri.widgets.NavigationToggleViewModel")],a);const n=a;export{n as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import o from"../../core/Handles.js";import{when as s}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let a=class extends e{constructor(t){super(t),this._handles=new o,this.navigationMode="pan",this.view=null}initialize(){this._handles.add(s((()=>this.view?.inputManager),(()=>this._setNavigationMode())))}destroy(){this._handles.destroy(),this._handles=null,this.view=null}get state(){return this.get("view.ready")&&"3d"===this.view.type?"ready":"disabled"}toggle(){"disabled"!==this.state&&(this.navigationMode="pan"!==this.navigationMode?"pan":"rotate",this._setNavigationMode())}_setNavigationMode(){this.get("view.inputManager").primaryDragAction="pan"===this.navigationMode?"pan":"rotate"}};t([i({readOnly:!0})],a.prototype,"state",null),t([i()],a.prototype,"navigationMode",void 0),t([i()],a.prototype,"view",void 0),a=t([r("esri.widgets.NavigationToggleViewModel")],a);const n=a;export{n as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import i from"../../core/Collection.js";import s from"../../core/Error.js";import r from"../../core/Handles.js";import o from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{init as l,watch as u,whenFalse as h}from"../../core/watchUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as p}from"../../geometry/support/webMercatorUtils.js";import g from"../../layers/Layer.js";import f from"../../support/actions/ActionBase.js";import m from"../../support/actions/ActionButton.js";import y from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as F}from"../../views/input/InputManager.js";import{highlightsSupported as v}from"../../views/support/layerViewUtils.js";import _ from"../Feature/FeatureViewModel.js";import{zoomToClusteredFeatures as b,browseClusteredFeatures as C,zoomToFeature as P}from"./actions.js";import{triggerAction as E,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as M,displayClusterExtent as V,browseAggregateFeatures as j}from"./actionUtils.js";import L from"../support/AnchorElementViewModel.js";import{GoToMixin as O}from"../support/GoTo.js";import x from"../../symbols/SimpleFillSymbol.js";import I from"../../geometry/Point.js";const T=i.ofType({key:"type",defaultKeyValue:"button",base:f,typeMap:{button:m,toggle:y}}),S=()=>[P.clone()],B=()=>[b.clone(),C.clone()],R="esri.widgets.Popup.PopupViewModel",G=o.getLogger(R);let z=class extends(O(L)){constructor(e){super(e),this._handles=new r,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new T,this.activeFeature=null,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new x({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([l(this,["autoOpenEnabled","view"],(()=>this._autoOpenEnabledChange())),this.on("view-change",(()=>this._autoClose())),u(this,["highlightEnabled","selectedFeature","visible","view"],(()=>this._highlightSelectedFeature())),u(this,["highlightEnabled","activeFeature","view","visible"],(()=>this._highlightActiveFeature())),u(this,"view.animation.state",(e=>this._animationStateChange(e))),u(this,"location",(e=>this._locationChange(e))),u(this,"selectedFeature",(e=>this._selectedFeatureChange(e))),u(this,["selectedFeatureIndex","featureCount","featuresPerPage"],(()=>this._selectedFeatureIndexChange())),u(this,["featurePage","selectedFeatureIndex","featureCount","featuresPerPage, featureViewModels"],(()=>this._setGraphicOnFeatureViewModels())),u(this,"featureViewModels",(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>E({event:e,view:this.view}))),h(this,"waitingForResult",(()=>this._waitingForResultChange()),!0),u(this,["features","view","view.map","view.spatialReference"],(()=>this._updateFeatureVMs())),u(this,["view.scale"],this._viewScaleChange),h(this,"visible",(()=>this.browseClusterEnabled=!1)),u(this,"browseClusterEnabled",(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new T;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,n=r?i.concat(t):t,a=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=a&&a.actions,u=a&&a.overwriteActions?l:l?l.concat(n):n;return u&&u.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new T;return e.removeAll(),e.addMany(this.selectedFeature?.isAggregate?B():S()),e}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=p(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},i=()=>this._updatePendingPromises(e);e.then(t,i)})),this.notifyChange("pendingPromisesCount")}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);if(!t){const i=new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e});return G.error(i),Promise.reject(i)}return this.callGoTo({target:{target:t,scale:e.scale}})}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e){const t=new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return G.error(t),Promise.reject(t)}return i.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed","featureMenuOpen"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){M(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){await V(this),await j(this)}_animationStateChange(e){this.zoomToLocation||(P.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=this.view?.graphics;e&&(e.remove(this.selectedClusterBoundaryFeature),e.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(this.selectedFeature?.isAggregate)return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.browseClusterEnabled=!1,this.features=[this.selectedFeature])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i}=this;i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null===i)return;const o=((i-1)*s+t)%t,n=o+s;r.slice(o,n).forEach(((t,i)=>{t&&!t.graphic&&(t.graphic=e[o+i])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:i,view:s}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),e.isAggregate)return;return e.symbol=await w(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}!i&&t||!e.geometry?i&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=s.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:i}=e,s=Promise.resolve(t),r=i.map((e=>e.promise));this.promises=[s,...r]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i}=this;if(e?.isAggregate||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const s=i.slice(0),r=[];t.forEach(((t,i)=>{if(!t)return;let o=null;if(s.some(((e,i)=>(e&&e.graphic===t&&(o=e,s.splice(i,1)),!!o))),o)r[i]=o;else{const s=new _({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:this.view?.spatialReference,graphic:t===e?t:null,map:this.view?.map,view:this.view});r[i]=s}})),s.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",r)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:i}=this;if(t.remove(e),i&&this.view){const i=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),F.WIDGET);t.add(i,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const i=new AbortController,{signal:s}=i;this._fetchFeaturesController=i,this.notifyChange("waitingForResult");const r=this.fetchFeatures(e,{signal:s,event:t});return r.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),r}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:i}=e,{view:s}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:r,location:o}=e,n=[Promise.resolve(t),...r.map((e=>e.promise))];return s.popup.open({location:o||i,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightTarget(e,t){const i="imagery"===t.type?void 0:"objectIdField"in t&&t.objectIdField,s=e.attributes;return s&&i&&s[i]||e}async _highlightActiveFeature(){const e="highlight-active-feature";this._handles.remove(e);const{highlightEnabled:t,view:i,activeFeature:s,visible:r}=this;if(!(s&&i&&t&&r))return;const o=this._getHighlightLayer(s);if(!(o&&o instanceof g))return;const n=this._getLayerView(i,o);this._highlightActiveFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightActiveFeaturePromise===n&&this.activeFeature&&this.highlightEnabled))return;const l=a.highlight(this._getHighlightTarget(s,o));this._handles.add(l,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:i,view:s,visible:r}=this;if(!(t&&s&&i&&r))return;const o=this._getHighlightLayer(t);if(!(o&&o instanceof g))return;const n=this._getLayerView(s,o);this._highlightSelectedFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightSelectedFeaturePromise===n&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const l=a.highlight(this._getHighlightTarget(t,o));this._handles.add(l,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const i=e.filter((e=>!t.includes(e)));this.features=t.concat(i)}};e([c()],z.prototype,"featurePage",void 0),e([c()],z.prototype,"isLoadingFeature",null),e([c({type:T})],z.prototype,"actions",void 0),e([c({readOnly:!0})],z.prototype,"active",null),e([c()],z.prototype,"activeFeature",void 0),e([c({readOnly:!0})],z.prototype,"allActions",null),e([c({type:Boolean})],z.prototype,"defaultPopupTemplateEnabled",void 0),e([c()],z.prototype,"autoCloseEnabled",void 0),e([c()],z.prototype,"autoOpenEnabled",void 0),e([c()],z.prototype,"browseClusterEnabled",void 0),e([c()],z.prototype,"content",void 0),e([c({type:T,readOnly:!0})],z.prototype,"defaultActions",null),e([c({readOnly:!0})],z.prototype,"featureCount",null),e([c()],z.prototype,"features",null),e([c()],z.prototype,"featuresPerPage",void 0),e([c()],z.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],z.prototype,"featureViewModels",void 0),e([c()],z.prototype,"highlightEnabled",void 0),e([c()],z.prototype,"includeDefaultActions",void 0),e([c({type:I})],z.prototype,"location",null),e([c({readOnly:!0})],z.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],z.prototype,"selectedClusterBoundaryFeature",void 0),e([c({readOnly:!0})],z.prototype,"waitingForResult",null),e([c({readOnly:!0})],z.prototype,"promiseCount",null),e([c()],z.prototype,"promises",null),e([c({value:null,readOnly:!0})],z.prototype,"selectedFeature",null),e([c({value:-1})],z.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],z.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],z.prototype,"state",null),e([c()],z.prototype,"title",void 0),e([c()],z.prototype,"updateLocationEnabled",void 0),e([c()],z.prototype,"view",void 0),e([c()],z.prototype,"visible",void 0),e([c()],z.prototype,"zoomFactor",void 0),e([c()],z.prototype,"zoomToLocation",void 0),e([c()],z.prototype,"centerAtLocation",null),z=e([d(R)],z);const H=z;export{H as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import i from"../../core/Collection.js";import s from"../../core/Error.js";import r from"../../core/Handles.js";import o from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{watch as l,when as h,initial as u}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as p}from"../../geometry/support/webMercatorUtils.js";import g from"../../layers/Layer.js";import f from"../../support/actions/ActionBase.js";import m from"../../support/actions/ActionButton.js";import y from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as F}from"../../views/input/InputManager.js";import{highlightsSupported as v}from"../../views/support/layerViewUtils.js";import _ from"../Feature/FeatureViewModel.js";import{zoomToClusteredFeatures as b,browseClusteredFeatures as C,zoomToFeature as P}from"./actions.js";import{triggerAction as E,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as M,displayClusterExtent as V,browseAggregateFeatures as j}from"./actionUtils.js";import L from"../support/AnchorElementViewModel.js";import{GoToMixin as O}from"../support/GoTo.js";import x from"../../symbols/SimpleFillSymbol.js";import I from"../../geometry/Point.js";const T=i.ofType({key:"type",defaultKeyValue:"button",base:f,typeMap:{button:m,toggle:y}}),S=()=>[P.clone()],B=()=>[b.clone(),C.clone()],R="esri.widgets.Popup.PopupViewModel",G=o.getLogger(R);let z=class extends(O(L)){constructor(e){super(e),this._handles=new r,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new T,this.activeFeature=null,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new x({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([l((()=>[this.autoOpenEnabled,this.view]),(()=>this._autoOpenEnabledChange()),u),this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>E({event:e,view:this.view}))),h((()=>!this.waitingForResult),(()=>this._waitingForResultChange())),l((()=>[this.features,this.view?.map,this.view?.spatialReference]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),h((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new T;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,n=r?i.concat(t):t,a=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=a&&a.actions,h=a&&a.overwriteActions?l:l?l.concat(n):n;return h&&h.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new T;return e.removeAll(),e.addMany(this.selectedFeature?.isAggregate?B():S()),e}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=p(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},i=()=>this._updatePendingPromises(e);e.then(t,i)})),this.notifyChange("pendingPromisesCount")}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);if(!t){const i=new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e});return G.error(i),Promise.reject(i)}return this.callGoTo({target:{target:t,scale:e.scale}})}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e){const t=new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return G.error(t),Promise.reject(t)}return i.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed","featureMenuOpen"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){M(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){await V(this),await j(this)}_animationStateChange(e){this.zoomToLocation||(P.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=this.view?.graphics;e&&(e.remove(this.selectedClusterBoundaryFeature),e.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(this.selectedFeature?.isAggregate)return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.browseClusterEnabled=!1,this.features=[this.selectedFeature])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i}=this;i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null===i)return;const o=((i-1)*s+t)%t,n=o+s;r.slice(o,n).forEach(((t,i)=>{t&&!t.graphic&&(t.graphic=e[o+i])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:i,view:s}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),e.isAggregate)return;return e.symbol=await w(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}!i&&t||!e.geometry?i&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=s.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:i}=e,s=Promise.resolve(t),r=i.map((e=>e.promise));this.promises=[s,...r]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i}=this;if(e?.isAggregate||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const s=i.slice(0),r=[];t.forEach(((t,i)=>{if(!t)return;let o=null;if(s.some(((e,i)=>(e&&e.graphic===t&&(o=e,s.splice(i,1)),!!o))),o)r[i]=o;else{const s=new _({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:this.view?.spatialReference,graphic:t===e?t:null,map:this.view?.map,view:this.view});r[i]=s}})),s.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",r)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:i}=this;if(t.remove(e),i&&this.view){const i=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),F.WIDGET);t.add(i,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const i=new AbortController,{signal:s}=i;this._fetchFeaturesController=i,this.notifyChange("waitingForResult");const r=this.fetchFeatures(e,{signal:s,event:t});return r.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),r}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:i}=e,{view:s}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:r,location:o}=e,n=[Promise.resolve(t),...r.map((e=>e.promise))];return s.popup.open({location:o||i,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightTarget(e,t){const i="imagery"===t.type?void 0:"objectIdField"in t&&t.objectIdField,s=e.attributes;return s&&i&&s[i]||e}async _highlightActiveFeature(){const e="highlight-active-feature";this._handles.remove(e);const{highlightEnabled:t,view:i,activeFeature:s,visible:r}=this;if(!(s&&i&&t&&r))return;const o=this._getHighlightLayer(s);if(!(o&&o instanceof g))return;const n=this._getLayerView(i,o);this._highlightActiveFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightActiveFeaturePromise===n&&this.activeFeature&&this.highlightEnabled))return;const l=a.highlight(this._getHighlightTarget(s,o));this._handles.add(l,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:i,view:s,visible:r}=this;if(!(t&&s&&i&&r))return;const o=this._getHighlightLayer(t);if(!(o&&o instanceof g))return;const n=this._getLayerView(s,o);this._highlightSelectedFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightSelectedFeaturePromise===n&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const l=a.highlight(this._getHighlightTarget(t,o));this._handles.add(l,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const i=e.filter((e=>!t.includes(e)));this.features=t.concat(i)}};e([c()],z.prototype,"featurePage",void 0),e([c()],z.prototype,"isLoadingFeature",null),e([c({type:T})],z.prototype,"actions",void 0),e([c({readOnly:!0})],z.prototype,"active",null),e([c()],z.prototype,"activeFeature",void 0),e([c({readOnly:!0})],z.prototype,"allActions",null),e([c({type:Boolean})],z.prototype,"defaultPopupTemplateEnabled",void 0),e([c()],z.prototype,"autoCloseEnabled",void 0),e([c()],z.prototype,"autoOpenEnabled",void 0),e([c()],z.prototype,"browseClusterEnabled",void 0),e([c()],z.prototype,"content",void 0),e([c({type:T,readOnly:!0})],z.prototype,"defaultActions",null),e([c({readOnly:!0})],z.prototype,"featureCount",null),e([c()],z.prototype,"features",null),e([c()],z.prototype,"featuresPerPage",void 0),e([c()],z.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],z.prototype,"featureViewModels",void 0),e([c()],z.prototype,"highlightEnabled",void 0),e([c()],z.prototype,"includeDefaultActions",void 0),e([c({type:I})],z.prototype,"location",null),e([c({readOnly:!0})],z.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],z.prototype,"selectedClusterBoundaryFeature",void 0),e([c({readOnly:!0})],z.prototype,"waitingForResult",null),e([c({readOnly:!0})],z.prototype,"promiseCount",null),e([c()],z.prototype,"promises",null),e([c({value:null,readOnly:!0})],z.prototype,"selectedFeature",null),e([c({value:-1})],z.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],z.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],z.prototype,"state",null),e([c()],z.prototype,"title",void 0),e([c()],z.prototype,"updateLocationEnabled",void 0),e([c()],z.prototype,"view",void 0),e([c()],z.prototype,"visible",void 0),e([c()],z.prototype,"zoomFactor",void 0),e([c()],z.prototype,"zoomToLocation",void 0),e([c()],z.prototype,"centerAtLocation",null),z=e([d(R)],z);const H=z;export{H as default};