@arcgis/core 4.34.0-next.92 → 4.34.0-next.94
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.
- package/Color.js +1 -1
- package/Ground.js +1 -1
- package/WebScene.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileDisplayUnits.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileUnits.js → ElevationProfileDisplayUnits.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +1 -1
- package/analysis/ElevationProfile/ElevationProfileViewOptions.js +1 -1
- package/analysis/ElevationProfileAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/004b13c1db79c9e668b1.js +1 -0
- package/assets/esri/core/workers/chunks/{700b5a536f97233bc4af.js → 03b455e9405a8b6fec68.js} +1 -1
- package/assets/esri/core/workers/chunks/{a244afea77127e54dd3a.js → 08b0fc6bfe9640ee2525.js} +1 -1
- package/assets/esri/core/workers/chunks/0a981061df08da19372c.js +1 -0
- package/assets/esri/core/workers/chunks/{db5a985ccc6b7d0ad855.js → 176f56de787bf486be9f.js} +1 -1
- package/assets/esri/core/workers/chunks/1fc7df018c8f802565a6.js +1 -0
- package/assets/esri/core/workers/chunks/20003728a679479b14dc.js +1 -0
- package/assets/esri/core/workers/chunks/20f4c6d8b310ecab97be.js +1 -0
- package/assets/esri/core/workers/chunks/25639559336109ff3df1.js +1 -0
- package/assets/esri/core/workers/chunks/26081b6486c623735657.js +1 -0
- package/assets/esri/core/workers/chunks/2698f656405876f4bd20.js +1 -0
- package/assets/esri/core/workers/chunks/{4660798b3b45dcb5cecb.js → 2b9c9a35a6e1f56920b5.js} +2 -2
- package/assets/esri/core/workers/chunks/352511dbc67166face40.js +1 -0
- package/assets/esri/core/workers/chunks/3acd79a6a0572926a799.js +1 -0
- package/assets/esri/core/workers/chunks/3d7923d25734d03a4d27.js +1 -0
- package/assets/esri/core/workers/chunks/48133effac2eacc2196e.js +1 -0
- package/assets/esri/core/workers/chunks/4dfcd03082be83600f3a.js +1 -0
- package/assets/esri/core/workers/chunks/503c81dda242e6077317.js +1 -0
- package/assets/esri/core/workers/chunks/{06aed0a5464965be8d52.js → 56b3bb68b61b77138186.js} +1 -1
- package/assets/esri/core/workers/chunks/5746c4861af83c1d57a8.js +1 -0
- package/assets/esri/core/workers/chunks/5aacd1c6b171c99b41f5.js +1 -0
- package/assets/esri/core/workers/chunks/6810ecdeccf4b7eae5e2.js +1 -0
- package/assets/esri/core/workers/chunks/6b208f5d423da64c8559.js +1 -0
- package/assets/esri/core/workers/chunks/{7a240ab31d9ff2d2c5af.js → 73db6c070b049fe05147.js} +1 -1
- package/assets/esri/core/workers/chunks/801451fb572bc5f1f270.js +1 -0
- package/assets/esri/core/workers/chunks/82e0d22619dc26920ca9.js +1 -0
- package/assets/esri/core/workers/chunks/8f426cb210a4250517d5.js +1 -0
- package/assets/esri/core/workers/chunks/94ddf029698991d853b9.js +1 -0
- package/assets/esri/core/workers/chunks/97eb2cfc1f036feea9a9.js +1 -0
- package/assets/esri/core/workers/chunks/98381404f2d99a1f9341.js +1 -0
- package/assets/esri/core/workers/chunks/9adecee0ed2f1df3b0d2.js +1 -0
- package/assets/esri/core/workers/chunks/a0fab8cd791c33d3895d.js +1 -0
- package/assets/esri/core/workers/chunks/{a85acb948cc7d22be592.js → a410dcf80d17a2383337.js} +1 -1
- package/assets/esri/core/workers/chunks/{d9d86cf0500fa29d1d43.js → a98b284b147258629947.js} +1 -1
- package/assets/esri/core/workers/chunks/b1ccbc2fef7f7e5e04f7.js +1 -0
- package/assets/esri/core/workers/chunks/b5c829e904bc9cb5347d.js +1 -0
- package/assets/esri/core/workers/chunks/bec9ddd38c9ab9f2561b.js +1 -0
- package/assets/esri/core/workers/chunks/bf9031749d10e7d457b6.js +1 -0
- package/assets/esri/core/workers/chunks/bf9d09493fd849ea69fd.js +1 -0
- package/assets/esri/core/workers/chunks/c4641c2c130c7b8bcdee.js +1 -0
- package/assets/esri/core/workers/chunks/{58e2652810143f509fe1.js → c473b15d4d52f0a63d20.js} +1 -1
- package/assets/esri/core/workers/chunks/c8e4fe0e3b109eb80e8e.js +1 -0
- package/assets/esri/core/workers/chunks/c9159ebf930af3f336f3.js +1 -0
- package/assets/esri/core/workers/chunks/cd0c222a36caa7f80860.js +1 -0
- package/assets/esri/core/workers/chunks/ce2fcaa21d6efcdf4da5.js +1 -0
- package/assets/esri/core/workers/chunks/d2df6e685d6cffc5f486.js +1 -0
- package/assets/esri/core/workers/chunks/{c27783ce7ea51a5e49c5.js → e153b61560a7a869db63.js} +1 -1
- package/assets/esri/core/workers/chunks/e2c293331515f3bd0355.js +1 -0
- package/assets/esri/core/workers/chunks/{100a0041ee42b0b2fa32.js → e5d974593043d5e2b502.js} +1 -1
- package/assets/esri/core/workers/chunks/ec7b156425f25d231078.js +1 -0
- package/assets/esri/core/workers/chunks/{1194c2432c31def87db1.js → f71b76c9506178124fa3.js} +1 -1
- package/assets/esri/core/workers/chunks/fb456e7425e09df17d8c.js +1 -0
- package/assets/esri/core/workers/chunks/{f6806780ca2aa591475a.js → fe1dcf9f81da4adbb1fe.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/assets/esri/themes/base/_core.scss +0 -2
- package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +10 -7
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/CutFillComposition.glsl.js +15 -3
- package/chunks/CutFillMask.glsl.js +1 -1
- package/chunks/WaterSurface.glsl.js +0 -1
- package/chunks/bundle.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/colorUtils.js +1 -1
- package/config.js +1 -1
- package/core/CollectionFlattener.js +1 -1
- package/editing/sharedTemplates/executor/support/createPresetServiceEdit.js +1 -1
- package/geometry/operators/json/graphicBufferOperator.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/geometry/support/geometryUtils.js +1 -1
- package/geometry/support/meshUtils/elevationSampler.js +1 -1
- package/geometry/support/meshUtils.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/interfaces.d.ts +262 -339
- package/kernel.js +1 -1
- package/layers/BaseElevationLayer.js +1 -1
- package/layers/BaseTileLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/dehydratedFeatureComparison.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/ElevationQueryContext.js +5 -0
- package/layers/support/ElevationSampler.js +1 -1
- package/layers/support/ElevationTile.js +1 -1
- package/layers/support/GeometryDescriptor.js +1 -1
- package/layers/support/ParquetEncodingLocation.js +1 -1
- package/layers/support/ParquetEncodingWkb.js +1 -1
- package/layers/support/RasterBandInfo.js +1 -1
- package/layers/support/TileElevationSampler.js +5 -0
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/TileKey.js +1 -1
- package/layers/support/TilemapCache.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/parquetEncodingUtils.js +5 -0
- package/layers/support/parquetUtils.js +1 -1
- package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/NetworkSystemLayers.js +1 -1
- package/networks/support/typeUtils.js +1 -1
- package/package.json +3 -2
- package/popup/FieldInfo.js +1 -1
- package/popup/content/AttachmentsContent.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileInputVisualization2D.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
- package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/flow/BrushFlow.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/animatedFormats/AnimatableTextureResource.js +1 -1
- package/views/2d/engine/webgl/animatedFormats/utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/utils.js +1 -1
- package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
- package/views/2d/layers/VideoLayerView2D.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/navigation/actions/Pan.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/support/GaussianSplatSortWorker.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/support/popupHitTest.js +1 -1
- package/views/3d/terrain/ExtentHelper.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
- package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/Viewport2DMixin.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineQueryComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js +1 -1
- package/views/analysis/ExclusiveOperationManager.js +5 -0
- package/views/interactive/snapping/LineSnapper.js +1 -1
- package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/PendingFeatureTile.js +1 -1
- package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
- package/views/interactive/snapping/snappingUtils.js +1 -1
- package/views/navigation/Navigation.js +1 -1
- package/views/popupAdapter.js +5 -0
- package/views/support/GroundViewElevationSampler.js +1 -1
- package/views/video/VideoOperationalDataView.js +1 -1
- package/views/webgl/ContextState.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/widgets/Attachments/AttachmentsViewModel.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureMedia/chartCommon.js +1 -1
- package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
- package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUI360.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/services/DepthImageService.js +5 -0
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/chartUtilsAm5.js +1 -1
- package/assets/esri/core/workers/chunks/08374e5805fcedc1cb57.js +0 -1
- package/assets/esri/core/workers/chunks/0b24a6c06d1becbb6815.js +0 -1
- package/assets/esri/core/workers/chunks/14114be3afd6d292f89c.js +0 -1
- package/assets/esri/core/workers/chunks/19f1bfe815896d4983af.js +0 -1
- package/assets/esri/core/workers/chunks/22c3a21bc9f32c429c48.js +0 -1
- package/assets/esri/core/workers/chunks/2605062e44f2d4e73f14.js +0 -1
- package/assets/esri/core/workers/chunks/282c4f3484c605ce7d5e.js +0 -1
- package/assets/esri/core/workers/chunks/2e1cc11462846febb3b2.js +0 -1
- package/assets/esri/core/workers/chunks/37b5007660535f1c91c6.js +0 -1
- package/assets/esri/core/workers/chunks/393274af1804e5b6046a.js +0 -1
- package/assets/esri/core/workers/chunks/3b2ef975831eb75b40fb.js +0 -1
- package/assets/esri/core/workers/chunks/3ff3e1507220d3869c76.js +0 -1
- package/assets/esri/core/workers/chunks/4133ab8720e7e4afa9a6.js +0 -1
- package/assets/esri/core/workers/chunks/4d807bfe75108438db83.js +0 -1
- package/assets/esri/core/workers/chunks/5ad1985a9e66fb2232ae.js +0 -1
- package/assets/esri/core/workers/chunks/5b7a2ee44883b1fb2a5f.js +0 -1
- package/assets/esri/core/workers/chunks/614a00a3179f8fe23f45.js +0 -1
- package/assets/esri/core/workers/chunks/6aa349e1adf844df4b5b.js +0 -1
- package/assets/esri/core/workers/chunks/83065bef261314f9b2c5.js +0 -1
- package/assets/esri/core/workers/chunks/8bdbd94a59269e216fba.js +0 -1
- package/assets/esri/core/workers/chunks/8cae725e631d922853c8.js +0 -1
- package/assets/esri/core/workers/chunks/8f4cfef97716c3502b0f.js +0 -1
- package/assets/esri/core/workers/chunks/8ff2daef892881ff2019.js +0 -1
- package/assets/esri/core/workers/chunks/9bb6984f24cd5461a754.js +0 -1
- package/assets/esri/core/workers/chunks/9f2a3f37fe9b19ef1209.js +0 -1
- package/assets/esri/core/workers/chunks/a1196637268b89281780.js +0 -1
- package/assets/esri/core/workers/chunks/a6a2d4602dfeb62e0ecc.js +0 -1
- package/assets/esri/core/workers/chunks/b240298b8b643a323d34.js +0 -1
- package/assets/esri/core/workers/chunks/b47f26d6aa9a2848a677.js +0 -1
- package/assets/esri/core/workers/chunks/b661ea374fe38c8e29ca.js +0 -1
- package/assets/esri/core/workers/chunks/b8997ae5893afa0298d1.js +0 -1
- package/assets/esri/core/workers/chunks/baa48614d9567d5f240d.js +0 -1
- package/assets/esri/core/workers/chunks/c20862fe15295a294bbd.js +0 -1
- package/assets/esri/core/workers/chunks/c3020747f9001ca6a6e7.js +0 -1
- package/assets/esri/core/workers/chunks/c7c76a8a1c47eb62bef1.js +0 -1
- package/assets/esri/core/workers/chunks/c95e6bef8c97cf647869.js +0 -1
- package/assets/esri/core/workers/chunks/d71836cf70b9604832f1.js +0 -1
- package/assets/esri/core/workers/chunks/e99fc64b67bb0c71dc34.js +0 -1
- package/assets/esri/core/workers/chunks/eea9d49d55c2d1355497.js +0 -1
- package/assets/esri/core/workers/chunks/fb6ebb780bb59e252887.js +0 -1
- package/assets/esri/core/workers/chunks/ff6d189ba78980d40bb5.js +0 -1
- package/assets/esri/themes/base/widgets/_ButtonMenu.scss +0 -87
- package/chunks/Button.js +0 -5
- package/chunks/ColorSet.js +0 -5
- package/chunks/DefaultTheme.js +0 -5
- package/chunks/LineSeries.js +0 -5
- package/chunks/ResponsiveTheme.js +0 -5
- package/chunks/Theme.js +0 -5
- package/chunks/Tick.js +0 -5
- package/chunks/Tooltip.js +0 -5
- package/chunks/ar.js +0 -5
- package/chunks/bg_BG.js +0 -5
- package/chunks/bs_BA.js +0 -5
- package/chunks/ca_ES.js +0 -5
- package/chunks/chartUtilsAm5.js +0 -5
- package/chunks/cs_CZ.js +0 -5
- package/chunks/da_DK.js +0 -5
- package/chunks/de_CH.js +0 -5
- package/chunks/de_DE.js +0 -5
- package/chunks/el_GR.js +0 -5
- package/chunks/en_CA.js +0 -5
- package/chunks/en_US.js +0 -5
- package/chunks/es_ES.js +0 -5
- package/chunks/et_EE.js +0 -5
- package/chunks/fi_FI.js +0 -5
- package/chunks/fr_FR.js +0 -5
- package/chunks/he_IL.js +0 -5
- package/chunks/hr_HR.js +0 -5
- package/chunks/hu_HU.js +0 -5
- package/chunks/id_ID.js +0 -5
- package/chunks/it_IT.js +0 -5
- package/chunks/ja_JP.js +0 -5
- package/chunks/ko_KR.js +0 -5
- package/chunks/lt_LT.js +0 -5
- package/chunks/lv_LV.js +0 -5
- package/chunks/nb_NO.js +0 -5
- package/chunks/nl_NL.js +0 -5
- package/chunks/pl_PL.js +0 -5
- package/chunks/pt_BR.js +0 -5
- package/chunks/pt_PT.js +0 -5
- package/chunks/ro_RO.js +0 -5
- package/chunks/ru_RU.js +0 -5
- package/chunks/sk_SK.js +0 -5
- package/chunks/sl_SL.js +0 -5
- package/chunks/sr_RS.js +0 -5
- package/chunks/sv_SE.js +0 -5
- package/chunks/th_TH.js +0 -5
- package/chunks/tr_TR.js +0 -5
- package/chunks/uk_UA.js +0 -5
- package/chunks/vi_VN.js +0 -5
- package/chunks/zh_Hans.js +0 -5
- package/chunks/zh_Hant.js +0 -5
- package/widgets/FeatureTable/Grid/support/ButtonMenu.d.ts +0 -4
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +0 -5
- package/widgets/FeatureTable/Grid/support/ButtonMenuItem.d.ts +0 -4
- package/widgets/FeatureTable/Grid/support/ButtonMenuItem.js +0 -5
- package/widgets/FeatureTable/Grid/support/ButtonMenuViewModel.d.ts +0 -4
- package/widgets/FeatureTable/Grid/support/ButtonMenuViewModel.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import"../../intl.js";import i from"../../core/Accessor.js";import r from"../../core/Collection.js";import{watch as t,initial as s,when as a}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{get as l}from"../../core/accessorSupport/get.js";import{getEffectiveFeatureReduction as y}from"../../views/2d/layers/features/layerAdapters/featureReductionUtils.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),f=new Set(["esri.layers.BuildingSceneLayer","esri.layers.CatalogLayer","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.OrientedImageryLayer","esri.layers.ParquetLayer","esri.layers.PointCloudLayer","esri.layers.StreamLayer","esri.layers.SceneLayer","esri.layers.SubtypeGroupLayer","esri.layers.TileLayer","esri.layers.VoxelLayer","esri.layers.WFSLayer","esri.layers.WMSLayer","esri.layers.WMTSLayer","esri.layers.WCSLayer","esri.layers.LinkChartLayer","esri.layers.catalog.CatalogFootprintLayer","esri.layers.catalog.CatalogDynamicGroupLayer","esri.layers.knowledgeGraph.KnowledgeGraphSublayer","esri.layers.KnowledgeGraphLayer"]),u="view.basemapView.baseLayerViews",p="view.groundView.layerViews",v="view.basemapView.referenceLayerViews",_=[u,p,"view.layerViews",v];let w=class extends i{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this._activeLayerInfosPromises=new WeakMap,this.activeLayerInfos=new L,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null}initialize(){this.addHandles(t(()=>this.view,()=>this._viewHandles(),s),c.view),this.addHandles([h(()=>this._refresh()),t(()=>[this.basemapLegendVisible,this.groundLegendVisible,this.hideLayersNotInCurrentView,this.keepCacheOnDestroy,this.layerInfos,this.respectLayerDefinitionExpression,this.respectLayerVisibility],()=>this._refresh())])}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get loading(){return this.activeLayerInfos.some(e=>e.loading)}get state(){return this.view?.ready?"ready":"disabled"}_viewHandles(){this.removeHandles(c.state),this.view&&this.addHandles(t(()=>this.state,()=>this._stateHandles(),s),c.state)}_stateHandles(){this._resetAll(),"ready"===this.state&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([c.allLayerViews,c.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);const i=this._activeLayerInfosByLayerViewId[e];i&&this._activeLayerInfosPromises.delete(i),delete this._activeLayerInfosByLayerViewId[e],i?.parent?.children.remove(i)}_watchPropertiesAndAllLayerViews(){const{view:e}=this;if(!e)return;const{allLayerViews:i}=e;i.length&&this._refresh(),this.addHandles(i.on("change",e=>this._allLayerViewsChangeHandle(e)),c.allLayerViews),this.addHandles(t(()=>[this.layerInfos,this.basemapLegendVisible,this.groundLegendVisible],()=>this._propertiesChangeHandle()),c.legendProperties)}_allLayerViewsChangeHandle(e){if(e.added.length&&this._generateActiveLayerInfosForLayerViews(e.added),e.moved.length)this._propertiesChangeHandle();else if(e.removed.length){for(const{uid:i}of e.removed)this._destroyViewActiveLayerInfo(i);this._refresh()}}_propertiesChangeHandle(){this._destroyViewActiveLayerInfos(),this._refresh()}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.drain(e=>this._activeLayerInfosPromises.delete(e)),this._generateActiveLayerInfosForLayerViews(this._generateLayerViews())}_generateActiveLayerInfosForLayerViews(e){e.filter(this._filterBasemapLayerViews,this).filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this)}_filterBasemapLayerViews(e){if(!this.view?.basemapView)return!0;const{baseLayerViews:i,groundLayerViews:r,referenceLayerViews:t}=this.view.basemapView,s=!this.basemapLegendVisible&&(i?.includes(e)||t?.includes(e)),a=!this.groundLegendVisible&&r?.includes(e);return!s&&!a}_sortActiveLayerInfos(e){const i=this.view;if(e.length<2||!i)return;const r=[];e.forEach(i=>{if(!i.parent){const t=i.layer.parent,s=t&&"uid"in t&&this._layerViewByLayerId[t.uid],a=s&&this._activeLayerInfosByLayerViewId[s.uid];a&&e.includes(a)&&(r.push(i),i.parent=a,a.children.add(i),this._sortActiveLayerInfos(a.children))}}),e.removeMany(r);const t={};i.allLayerViews.forEach((e,i)=>t[e.layer.uid]=i),e.sort((e,i)=>{const r=t[e.layer.uid]||0;return(t[i.layer.uid]||0)-r})}_generateLayerViews(){const e=[];return _.filter(this._filterLayerViews,this).map(e=>l(this,e)).filter(e=>null!=e).forEach(this._collectLayerViews("layerViews",e)),e}_filterLayerViews(e){const i=!this.basemapLegendVisible&&(e===u||e===v),r=!this.groundLegendVisible&&e===p;return!i&&!r}_collectLayerViews(e,i){const r=t=>(t&&t.forEach(t=>{i.push(t),r(t[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!!f.has(e.layer.declaredClass)&&(this._layerViewByLayerId[e.layer.uid]=e,!0)}_generateActiveLayerInfo(e){this._isLayerActive(e)?this._buildActiveLayerInfo(e):(this.removeHandles(e.uid),this.addHandles(t(()=>[e.legendEnabled,e.layer?.legendEnabled],()=>this._layerActiveHandle(e)),e.uid))}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.layer?.legendEnabled}async _buildActiveLayerInfo(e){const i=e.layer,r=e.uid,t=this._layerInfosByLayerViewId[r];let s=this._activeLayerInfosByLayerViewId[r];if(!s){const a=void 0!==t?.title&&t.layer.uid===i.uid;s=new d({layer:i,layerView:e,title:a?t.title:i.title,view:this.view??void 0,respectLayerDefinitionExpression:this.respectLayerDefinitionExpression,respectLayerVisibility:this.respectLayerVisibility,hideLayersNotInCurrentView:this.hideLayersNotInCurrentView,keepCacheOnDestroy:this.keepCacheOnDestroy,sublayerIds:t?.sublayerIds||[]}),this._activeLayerInfosByLayerViewId[r]=s}const a=i.parent&&"uid"in i.parent?this._layerViewByLayerId[i.parent?.uid]:null;s.parent=this._activeLayerInfosByLayerViewId[a?.uid],this._addActiveLayerInfo(s),this._constructLegendElements(s),this._attachHandlesToActiveLayerInfo(s)}_attachHandlesToActiveLayerInfo(e){const{layer:i,layerView:r}=e,n=r.uid;if(!this.hasHandles(n)){const o=[t(()=>i.title,i=>this._titleHandle(i,e)),t(()=>[i.opacity,"renderer"in i&&i.renderer,"pointSymbol"in i&&i.pointSymbol,"lineSymbol"in i&&i.lineSymbol,"polygonSymbol"in i&&i.polygonSymbol],()=>this._constructLegendElements(e)),a(()=>!!this.view?.stationary,()=>this._scaleHandle(e)),t(()=>r.layer?y(r.layer,r.view):null,()=>this._constructLegendElements(e)),t(()=>r.updating,()=>{if(null==r.layer)return;null!=y(r.layer,r.view)&&this._constructLegendElements(e)}),t(()=>"effect"in i&&i.effect,()=>this._constructLegendElements(e)),a(()=>this.view?.timeZone,()=>this._constructLegendElements(e)),t(()=>e.loading,()=>this.notifyChange("loading"),s)];if(this.respectLayerVisibility){const s=t(()=>r.legendEnabled,i=>this._legendEnabledHandle(i,e)),a=t(()=>i.legendEnabled,i=>this._legendEnabledHandle(i,e));o.push(s,a)}if(this.respectLayerDefinitionExpression&&"definitionExpression"in i){const r=t(()=>[i.definitionExpression,this.respectLayerDefinitionExpression],()=>{e.respectLayerDefinitionExpression=this.respectLayerDefinitionExpression,this._constructLegendElements(e)});o.push(r)}this.addHandles(o,n)}}_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),t=r.parent;(t&&"uid"in t?this._layerViewByLayerId[t.uid]:null)&&!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,t=r&&"uid"in r?this._layerViewByLayerId[r?.uid]:null,s=this._activeLayerInfosByLayerViewId[t?.uid];s&&(e.push(i),i.parent=s)}),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)}async _getBuildLegendPromise(e){const{layer:i}=e;if("featureCollections"in i&&i.featureCollections)return e.buildLegendElementsForFeatureCollections(i.featureCollections);if("featureReduction"in i&&i.featureReduction&&"renderer"in i.featureReduction&&("binning"===i.featureReduction.type||"cluster"===i.featureReduction.type)&&(!this.view||i.featureReduction.maxScale<=this.view.scale))return e.buildLegendElementsForFeatureReduction(i.featureReduction);if("renderer"in i&&i.renderer&&!("sublayers"in i))return e.buildLegendElementsForRenderer(i.renderer);if("url"in i&&i.url&&"catalog"!==i.type&&"knowledge-graph"!==i.type)return e.buildLegendElementsForTools();const r=e.children.map(e=>this._constructLegendElements(e));return Promise.all(r).then(()=>{})}async _constructLegendElements(e){const i=this._activeLayerInfosPromises.get(e);i&&await i.catch(()=>{});const r=this._getBuildLegendPromise(e);this._activeLayerInfosPromises.set(e,r),r.finally(()=>{this._activeLayerInfosPromises.delete(e)})}};e([n({type:L})],w.prototype,"activeLayerInfos",void 0),e([n()],w.prototype,"basemapLegendVisible",void 0),e([n()],w.prototype,"groundLegendVisible",void 0),e([n()],w.prototype,"hideLayersNotInCurrentView",void 0),e([n()],w.prototype,"keepCacheOnDestroy",void 0),e([n({readOnly:!0})],w.prototype,"loading",null),e([n()],w.prototype,"respectLayerDefinitionExpression",void 0),e([n()],w.prototype,"respectLayerVisibility",void 0),e([n()],w.prototype,"layerInfos",void 0),e([n({readOnly:!0})],w.prototype,"state",null),e([n()],w.prototype,"view",void 0),w=e([o("esri.widgets.Legend.LegendViewModel")],w);export{w as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import"../../intl.js";import i from"../../core/Accessor.js";import r from"../../core/Collection.js";import{watch as t,initial as s,when as a}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{get as y}from"../../core/accessorSupport/get.js";import{getEffectiveFeatureReduction as l}from"../../views/2d/layers/features/layerAdapters/featureReductionUtils.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),f=new Set(["esri.layers.BuildingSceneLayer","esri.layers.CatalogLayer","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.OrientedImageryLayer","esri.layers.ParquetLayer","esri.layers.PointCloudLayer","esri.layers.StreamLayer","esri.layers.SceneLayer","esri.layers.SubtypeGroupLayer","esri.layers.TileLayer","esri.layers.VoxelLayer","esri.layers.WFSLayer","esri.layers.WMSLayer","esri.layers.WMTSLayer","esri.layers.WCSLayer","esri.layers.LinkChartLayer","esri.layers.catalog.CatalogFootprintLayer","esri.layers.catalog.CatalogDynamicGroupLayer","esri.layers.knowledgeGraph.KnowledgeGraphSublayer","esri.layers.KnowledgeGraphLayer"]),u="view.basemapView.baseLayerViews",p="view.groundView.layerViews",v="view.basemapView.referenceLayerViews",w=[u,p,"view.layerViews",v];let _=class extends i{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this._activeLayerInfosPromises=new WeakMap,this.activeLayerInfos=new L,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerViewVisibility=!0,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null}initialize(){this.addHandles(t(()=>this.view,()=>this._viewHandles(),s),c.view),this.addHandles(h(()=>this._refresh()))}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get loading(){return this.activeLayerInfos.some(e=>e.loading)}get state(){return this.view?.ready?"ready":"disabled"}_viewHandles(){this.removeHandles(c.state),this.view&&this.addHandles(t(()=>this.state,()=>this._stateHandles(),s),c.state)}_stateHandles(){this._resetAll(),"ready"===this.state&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([c.allLayerViews,c.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);const i=this._activeLayerInfosByLayerViewId[e];i&&this._activeLayerInfosPromises.delete(i),delete this._activeLayerInfosByLayerViewId[e],i?.parent?.children.remove(i)}_watchPropertiesAndAllLayerViews(){const{view:e}=this;if(!e)return;const{allLayerViews:i}=e;i.length&&this._refresh(),this.addHandles(i.on("change",e=>this._allLayerViewsChangeHandle(e)),c.allLayerViews),this.addHandles(t(()=>[this.basemapLegendVisible,this.groundLegendVisible,this.hideLayersNotInCurrentView,this.respectLayerViewVisibility,this.keepCacheOnDestroy,this.layerInfos,this.respectLayerDefinitionExpression,this.respectLayerVisibility],()=>this._refresh()),c.legendProperties)}_allLayerViewsChangeHandle(e){if(e.added.length&&this._generateActiveLayerInfosForLayerViews(e.added),e.moved.length)return this._destroyViewActiveLayerInfos(),void this._refresh();if(e.removed.length){for(const{uid:i}of e.removed)this._destroyViewActiveLayerInfo(i);this._refresh()}}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.drain(e=>this._activeLayerInfosPromises.delete(e)),this._generateActiveLayerInfosForLayerViews(this._generateLayerViews())}_generateActiveLayerInfosForLayerViews(e){e.filter(this._filterBasemapLayerViews,this).filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this)}_filterBasemapLayerViews(e){if(!this.view?.basemapView)return!0;const{baseLayerViews:i,groundLayerViews:r,referenceLayerViews:t}=this.view.basemapView,s=!this.basemapLegendVisible&&(i?.includes(e)||t?.includes(e)),a=!this.groundLegendVisible&&r?.includes(e);return!s&&!a}_sortActiveLayerInfos(e){const i=this.view;if(e.length<2||!i)return;const r=[];e.forEach(i=>{if(!i.parent){const t=i.layer.parent,s=t&&"uid"in t&&this._layerViewByLayerId[t.uid],a=s&&this._activeLayerInfosByLayerViewId[s.uid];a&&e.includes(a)&&(r.push(i),i.parent=a,a.children.add(i),this._sortActiveLayerInfos(a.children))}}),e.removeMany(r);const t={};i.allLayerViews.forEach((e,i)=>t[e.layer.uid]=i),e.sort((e,i)=>{const r=t[e.layer.uid]||0;return(t[i.layer.uid]||0)-r})}_generateLayerViews(){const e=[];return w.filter(this._filterLayerViews,this).map(e=>y(this,e)).filter(e=>null!=e).forEach(this._collectLayerViews("layerViews",e)),e}_filterLayerViews(e){const i=!this.basemapLegendVisible&&(e===u||e===v),r=!this.groundLegendVisible&&e===p;return!i&&!r}_collectLayerViews(e,i){const r=t=>(t&&t.forEach(t=>{i.push(t),r(t[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!!f.has(e.layer.declaredClass)&&(this._layerViewByLayerId[e.layer.uid]=e,!0)}_generateActiveLayerInfo(e){this._isLayerActive(e)?this._buildActiveLayerInfo(e):(this.removeHandles(e.uid),this.addHandles(t(()=>[e.legendEnabled,e.layer?.legendEnabled],()=>this._layerActiveHandle(e)),e.uid))}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){const i=!this.respectLayerViewVisibility||e.legendEnabled,r=!this.respectLayerVisibility||!!e.layer?.legendEnabled;return i&&r}async _buildActiveLayerInfo(e){const i=e.layer,r=e.uid,t=this._layerInfosByLayerViewId[r];let s=this._activeLayerInfosByLayerViewId[r];s||(s=new d({layer:i,layerView:e,view:this.view??void 0}),this._activeLayerInfosByLayerViewId[r]=s);const a=void 0!==t?.title&&t.layer.uid===i.uid;s.title=a?t.title:i.title,s.respectLayerDefinitionExpression=this.respectLayerDefinitionExpression,s.respectLayerVisibility=this.respectLayerVisibility,s.hideLayersNotInCurrentView=this.hideLayersNotInCurrentView,s.keepCacheOnDestroy=this.keepCacheOnDestroy,s.sublayerIds=t?.sublayerIds||[];const n=i.parent&&"uid"in i.parent?this._layerViewByLayerId[i.parent?.uid]:null;s.parent=this._activeLayerInfosByLayerViewId[n?.uid],this._addActiveLayerInfo(s),this._constructLegendElements(s),this._attachHandlesToActiveLayerInfo(s)}_attachHandlesToActiveLayerInfo(e){const{layer:i,layerView:r}=e,n=r.uid;this.removeHandles(n),this.addHandles([t(()=>i.title,i=>this._titleHandle(i,e)),t(()=>[i.opacity,"renderer"in i&&i.renderer,"pointSymbol"in i&&i.pointSymbol,"lineSymbol"in i&&i.lineSymbol,"polygonSymbol"in i&&i.polygonSymbol,"effect"in i&&i.effect,"definitionExpression"in i&&i.definitionExpression,"featureReduction"in i&&l(i,r.view)],()=>this._constructLegendElements(e)),a(()=>!!this.view?.stationary,()=>this._scaleHandle(e)),a(()=>this.view?.timeZone,()=>this._constructLegendElements(e)),t(()=>e.loading,()=>this.notifyChange("loading"),s)],n),this.respectLayerViewVisibility&&this.addHandles(t(()=>r.legendEnabled,i=>this._legendEnabledHandle(i,e)),n),this.respectLayerVisibility&&this.addHandles(t(()=>i.legendEnabled,i=>this._legendEnabledHandle(i,e)),n),this.respectLayerDefinitionExpression&&"definitionExpression"in i&&this.addHandles(t(()=>i.definitionExpression,()=>this._constructLegendElements(e)),n)}_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),t=r.parent;(t&&"uid"in t?this._layerViewByLayerId[t.uid]:null)&&!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,t=r&&"uid"in r?this._layerViewByLayerId[r?.uid]:null,s=this._activeLayerInfosByLayerViewId[t?.uid];s&&(e.push(i),i.parent=s)}),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)}async _getBuildLegendPromise(e){const{layer:i}=e;if("featureCollections"in i&&i.featureCollections)return e.buildLegendElementsForFeatureCollections(i.featureCollections);if("featureReduction"in i&&i.featureReduction&&"renderer"in i.featureReduction&&("binning"===i.featureReduction.type||"cluster"===i.featureReduction.type)&&(!this.view||i.featureReduction.maxScale<=this.view.scale))return e.buildLegendElementsForFeatureReduction(i.featureReduction);if("renderer"in i&&i.renderer&&!("sublayers"in i))return e.buildLegendElementsForRenderer(i.renderer);if("url"in i&&i.url&&"catalog"!==i.type&&"knowledge-graph"!==i.type)return e.buildLegendElementsForTools();const r=e.children.map(e=>this._constructLegendElements(e));return Promise.all(r).then(()=>{})}async _constructLegendElements(e){const i=this._activeLayerInfosPromises.get(e);i&&await i.catch(()=>{});const r=this._getBuildLegendPromise(e);this._activeLayerInfosPromises.set(e,r),r.finally(()=>{this._activeLayerInfosPromises.delete(e)})}};e([n({type:L})],_.prototype,"activeLayerInfos",void 0),e([n()],_.prototype,"basemapLegendVisible",void 0),e([n()],_.prototype,"groundLegendVisible",void 0),e([n()],_.prototype,"hideLayersNotInCurrentView",void 0),e([n()],_.prototype,"keepCacheOnDestroy",void 0),e([n({readOnly:!0})],_.prototype,"loading",null),e([n()],_.prototype,"respectLayerDefinitionExpression",void 0),e([n()],_.prototype,"respectLayerViewVisibility",void 0),e([n()],_.prototype,"respectLayerVisibility",void 0),e([n()],_.prototype,"layerInfos",void 0),e([n({readOnly:!0})],_.prototype,"state",null),e([n()],_.prototype,"view",void 0),_=e([o("esri.widgets.Legend.LegendViewModel")],_);export{_ 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{addTokenParameter as i}from"../../../kernel.js";import s from"../../../request.js";import l from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import n from"../../../core/Collection.js";import has from"../../../core/has.js";import{JSONMap as a}from"../../../core/jsonMap.js";import o from"../../../core/Logger.js";import{clamp as u}from"../../../core/mathUtils.js";import{debounce as c,timeout as d}from"../../../core/promiseUtils.js";import{on as y,watch as h,initial as f,whenOnce as m}from"../../../core/reactiveUtils.js";import{px2pt as p}from"../../../core/screenUtils.js";import{parseWhereClause as g}from"../../../core/sql.js";import{addQueryParameters as b}from"../../../core/urlUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";import{EffectView as w}from"../../../layers/effects/EffectView.js";import{getEffectiveDisplayFilter as v}from"../../../layers/support/displayFilterUtils.js";import{ExportImageParameters as L}from"../../../layers/support/ExportImageParameters.js";import{collectFields as E,collectArcadeFieldNames as F}from"../../../layers/support/fieldUtils.js";import{isFeatureLayer as C}from"../../../layers/support/layerUtils.js";import{getPixelValueRange as I}from"../../../layers/support/rasterFormats/pixelRangeUtils.js";import{fromJSON as R}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as V}from"../../../renderers/support/rendererConversion.js";import D from"../../../renderers/visualVariables/SizeVariable.js";import x from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{updateReferenceSizeSymbol as z}from"../../../smartMapping/renderers/support/referenceSizeUtils.js";import T from"../../../symbols/SimpleFillSymbol.js";import j from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolColor as O}from"../../../symbols/support/cimSymbolUtils.js";import{renderSymbol as k}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as M,renderDotDensityPreviewHTML as P,renderPieChartPreviewHTML as U,renderPreviewHTML as A}from"../../../symbols/support/symbolUtils.js";import{getCSSFilterFromEffectList as B,isVolumetricSymbol as N}from"../../../symbols/support/utils.js";import{getEffectiveClusterSizeVariable as $}from"./clusterUtils.js";import{getColorFromPointCloudStops as H,getRampStopsForPointCloud as q,getStretchRampStops as W,getRampStops as G}from"./colorRampUtils.js";import{getHeatmapRampStops as J}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as Q,getRelationshipRampElement as Z}from"./relationshipRampUtils.js";import{getRampStops as K,realWorldMaxSize as X,realWorldMinSize as Y}from"./sizeRampUtils.js";import{specialCharsLessThan as ee,specialCharsGreaterThan as te,getAuthoringInfoVisualVariableByTheme as ie,getSymbolForFlowRenderer as se,mergeWhereClauses as le,getMedianColor as re,rgbImgSource as ne,getDateFormatOptions as ae}from"./utils.js";import{formatNumberLabel as oe}from"../../smartMapping/support/utils.js";const ue=16,ce="https://utility.arcgis.com/sharing/tools/legend",de="esri.layers.ImageryLayer",ye="esri.layers.ImageryTileLayer",he="esri.layers.WCSLayer",fe=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,me=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),pe=new j({size:6,outline:{color:[128,128,128,.5],width:.5}}),ge=new T({style:"solid"});function be(e){return"flow"===e.type}function _e(e){return"vector-field"===e.type}function Se(e){return"raster-colormap"===e.type}function we(e){return"raster-stretch"===e.type}function ve(e){return"raster-shaded-relief"===e.type}function Le(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function Fe(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function Ce(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function Ie(e){return Ve(e)||De(e)||xe(e)||Re(e)}function Re(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function Ve(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function De(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function xe(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function ze(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Te(e){return"esri.renderers.PieChartRenderer"===e.declaredClass}function je(e,t){return Le(e)||Ee(e)||Fe(e)||Ce(e)||ze(e)||Te(e)?"2d"===t.type||V(e):we(e)||Se(e)||ve(e)||Ve(e)||De(e)||xe(e)||_e(e)||be(e)}function Oe(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function ke(e){return"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Me(e){return"esri.layers.VoxelLayer"===e.declaredClass}function Pe(e){return"esri.layers.WMSLayer"===e.declaredClass}function Ue(e){return"esri.layers.WMTSLayer"===e.declaredClass}function Ae(e){return"esri.layers.MapImageLayer"===e.declaredClass}function Be(e){return"esri.layers.TileLayer"===e.declaredClass}function Ne(e){return e.declaredClass===de}function $e(e){return e.declaredClass===ye}function He(e){return e.declaredClass===he}function qe(e){return"stretch-ramp"===e.type}function We(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type}function Ge(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type&&"above-and-below"===t?.univariateTheme}function Je(e){return"sublayers"in e}function Qe(e){return e&&"symbol"in e}function Ze(e,t){const{field:i,field2:s,field3:l,fieldDelimiter:r,valueExpression:n}=e;if(!i)return null;const a=!(!i&&!n||!s&&!l)?t?.toString().split(r||""):[t],o=i?{[i]:a?.[0]}:null;return o&&(s&&(o[s]=a?.[1]),l&&(o[l]=a?.[2])),o}const Ke=new j({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let Xe={};const Ye=new WeakMap;let et=class extends l{constructor(e){super(e),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._loading=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._clusterSizeVariable=null,this._layerDefinitionExpression=null,this._layerDefinitionExpressionClause=null,this._layerDisplayFilter=null,this._layerDisplayFilterClause=null,this.children=new n,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this.addHandles([y(()=>this.children,"change",t=>{const{added:i,removed:s}=t;i.forEach(t=>{const i=`activeLayerInfo-ready-watcher-${t.layer.uid}`;this.addHandles(h(()=>t.ready,e,f),i)}),s.forEach(e=>this.removeHandles(e.layer.uid)),e()})]),this.keepCacheOnDestroy||(Xe={})}destroy(){this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(Xe=null),this._layerDefinitionExpressionClause=null}get cssEffectFilter(){const{layer:e,scale:t}=this,i="effect"in e?e.effect:null;if(!i)return null;const s=new w({effect:i});return s.endTransition(),s.scale=t,B(s,!0)}get loading(){return this.children.length>0?this.children.some(e=>e.loading):this._loading}get opacity(){const e=this.layer.opacity,t=this.parent?.opacity,i=this.layer.parent,s=i&&"uid"in i?this._getParentLayerOpacity(i):null;return null!=t?t*e:null!=s?s*e:e}get ready(){return null===this.layer||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){return this.view?.scale??0}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){if("cluster"===e.featureReduction.type)return!0;if("binning"===e.featureReduction.type&&"renderer"in e.featureReduction&&e.featureReduction.renderer)return this._isRendererScaleDriven(e.featureReduction.renderer)}return"renderer"in e&&e.renderer?!!("displayFilterInfo"in e&&e.displayFilterInfo&&Fe(e.renderer))||this._isRendererScaleDriven(e.renderer):this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(e){this._loading=!0;if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],this._loading=!1,void this.notifyChange("ready");const t=Array.from(e,e=>{if(C(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet?.features.length){const t=e.layerDefinition,i=t?.drawingInfo,s=i&&R(i.renderer),l=me.read(t.geometryType);return s?this._getRendererLegendElements(s,{title:e.name,geometryType:l}):(o.getLogger(this).warn("drawingInfo not available!"),null)}return null});try{const e=[],i=await Promise.allSettled(t);for(const t of i)if("fulfilled"===t.status)for(const i of t.value??[])e.push(i);this.legendElements=e}catch(i){o.getLogger(this).warn("error while building legend for layer!",i)}finally{this._loading=!1,this.notifyChange("ready")}}async buildLegendElementsForRenderer(e){try{this._loading=!0;const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getRendererLegendElements(e):[]}catch(t){o.getLogger(this).warn("error while building legend for layer!",t)}finally{this._loading=!1,this.notifyChange("ready")}}async buildLegendElementsForFeatureReduction(e){try{this._loading=!0;const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getLegendElementsForFeatureReduction(e):[]}catch(t){o.getLogger(this).warn("error while building legend for layer!",t)}finally{this._loading=!1,this.notifyChange("ready")}}async buildLegendElementsForTools(){this._loading=!0;const e=this.layer;if(Me(e))await this._constructLegendElementsForVoxelLayer();else if(Ue(e))this._constructLegendElementsForWMTSlayer();else if(Pe(e))await this._constructLegendElementsForWMSSublayers();else if(Oe(e))await this._constructLegendElementsForBuildingSceneLayer();else if(Ae(e)||Be(e)||ke(e))await this._constructLegendElementsForSublayers();else{this.removeHandles("imageryLayers-watcher");let t="default";if(Ne(e)){const i=e;t=(i?.rasterFunction?.functionName||"default")+"_"+(e.bandIds?.length?e.bandIds.join(""):"###")}if($e(e)||"link-chart"===e.type)return;await this._getLegendLayers(`${e.uid}-${t}`).then(async t=>{this.legendElements=[];const i=t.map(async t=>{if(Ne(e)){const t=h(()=>[e.rasterFunction,e.bandIds],()=>c(async()=>{Xe.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()})());this.addHandles(t,"imageryLayers-watcher")}const i=this._generateSymbolTableElementForLegendLayer(t);i?.infos.length&&(Ne(e)&&(i.title=e.title),this.legendElements.push(i))});await Promise.allSettled(i)}).catch(e=>{o.getLogger(this).warn("Request to server for legend has failed!",e)})}this._loading=!1,this.notifyChange("ready")}async _isLayerInCurrentView(e){return this._checkFeatureCountForExpression(e,this.view.extent)}_getParentLayerOpacity(e){let t=1;const i=e.parent;return i&&"uid"in i&&(t=this._getParentLayerOpacity(i)),e.opacity*t}_isGroupActive(){return this.children.some(e=>e.ready)}_isRendererScaleDriven(e){if("dot-density"===e.type)return!0;const t="valueExpression"in e?e.valueExpression:null;if(fe.test(t))return!0;const i="visualVariables"in e?e.visualVariables:null;return!!i?.some(e=>this._isScaleDrivenSizeVariable(e))||this._hasScaleDrivenSymbols(e)}_hasScaleDrivenSymbols(e){switch(e.type){case"simple":return this._isScaleDrivenSymbol(e.symbol);case"class-breaks":return this._isScaleDrivenSymbol(e.defaultSymbol)||e.classBreakInfos.some(e=>this._isScaleDrivenSymbol(e.symbol));case"unique-value":return this._isScaleDrivenSymbol(e.defaultSymbol)||!!e.uniqueValueInfos?.some(e=>this._isScaleDrivenSymbol(e.symbol))}return!1}_isScaleDrivenSymbol(e){if("cim"===e?.type){const{primitiveOverrides:t,minScale:i,maxScale:s}=e.data,l=t?.some(e=>(e.valueExpressionInfo?.expression||"").includes("$view.scale"))??!1;return null!=i||null!=s||l}return!1}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,i=t.minSize,s=t.maxSize;return!("object"!=typeof i||!i||!this._isScaleDrivenSizeVariable(i))||(!("object"!=typeof s||!s||!this._isScaleDrivenSizeVariable(s))||fe.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&&Ae(t)&&"source"in e&&e.source&&"map-layer"===e.source.type)for(const i of t.sourceJSON.layers??[])if(i.id===e.source.mapLayerId&&(i.minScale>0||i.maxScale>0))return!0;return!1}async _constructLegendElementsForVoxelLayer(){this._loading=!0,this.legendElements=[],this.removeHandles("voxel-style-watcher"),this.removeHandles("voxel-current-variable");const e=this.layer;this.addHandles(h(()=>e.currentVariableId,()=>this._constructLegendElementsForVoxelLayer()),"voxel-current-variable"),this.addHandles(h(()=>e.getVariableStyles(),()=>this._constructLegendElementsForVoxelLayer()),"voxel-style-watcher");const t=e.getVariableStyle(null),i=[];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 T({color:t.color,outline:null})})}),e.length&&i.push({type:"symbol-table",title:t.label,infos:e})}else if(t.transferFunction){const{colorStops:e,stretchRange:s}=t.transferFunction,l=e.toArray().reverse(),r=s.map((e,t)=>`${0===t?ee:te} ${oe(e)}`).reverse(),n=l.map(e=>({color:e.color,value:null,label:null}));n[0].label=r[0],n[n.length-1].label=r[1],i.push({type:"color-ramp",title:t.label,infos:n,preview:M(l.map(e=>e.color))})}await this._generatePreviewsForLegendElements(i,{opacity:e.opacity}),this.legendElements=i,this._loading=!1,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this._loading=!0,this.legendElements=[],this.removeHandles("wmts-activeLayer-watcher");const e=this.layer.activeLayer;this.addHandles(h(()=>{const{layer:e}=this;return e&&"activeLayer"in e&&e.activeLayer},()=>this._constructLegendElementsForWMTSlayer()),"wmts-activeLayer-watcher");const t=e.styleId?e.styles?.find(({id:t})=>t===e.styleId)?.legendUrl:void 0;t&&(this.legendElements=[{type:"symbol-table",title:e.title,infos:[{src:t,opacity:this.opacity}]}]),this._loading=!1,this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this._loading=!0,this.legendElements=[],this.removeHandles("wms-sublayers-watcher");const e=this.layer;let t=null;(e.customParameters||e.customLayerParameters)&&(t={...e.customParameters,...e.customLayerParameters}),this.addHandles(h(()=>{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._loading=!1,this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(e,t){const i=this.layer,s=[];this.addHandles(e.on("change",()=>this._constructLegendElementsForWMSSublayers()),"wms-sublayers-watcher");const l=this.sublayerIds?.map(e=>i.findSublayerById(e))?.filter(r)??[],n=l.length?l:e.toArray();for(const r of n){const e=h(()=>[r.title,r.visible,r.legendEnabled],()=>this._constructLegendElementsForWMSSublayers());if(this.addHandles(e,"wms-sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled){const e=await this._generateSymbolTableElementForWMSSublayer(r,t);e?.infos.length&&s.unshift(e)}}return s}async _generateSymbolTableElementForWMSSublayer(e,t){if(!e.legendUrl&&e.sublayers){const i=(await this._generateLegendElementsForWMSSublayers(e.sublayers,t)).filter(e=>e);return{type:"symbol-table",title:e.title,infos:i}}return this._generateSymbolTableElementForLegendUrl(e,t)}async _generateSymbolTableElementForLegendUrl(e,t){let i=e.legendUrl;if(!i)return;const l={type:"symbol-table",title:e.title||e.name||String(e.id??""),infos:[]};t&&(i=b(i,t));let r=null;const n=e.layer?.opacity;try{r=(await s(i,{responseType:"image"})).data,r&&(r.style.opacity=n)}catch{}return l.infos.push({src:i,preview:r,opacity:n}),l}_getLegendLayers(e,t){const i=Xe&&Xe[e];return i?Promise.resolve(i):this._legendRequest(t).then(t=>{const i=t.layers;return Xe[e]=i,i})}_legendRequest(e){const t=this.layer;let i={f:"json",dynamicLayers:e};if(Ne(t)){const e=t.exportImageServiceParameters.rasterFunction;if(e&&(i.renderingRule=JSON.stringify(e.functionDefinition?.toJSON()||e.toJSON())),t.bandIds&&(i.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:s,customParameters:l}=t;i={raster:e,viewId:s,...i,...l}}}let l=t.url.replace(/(\/)+$/,"");if("version"in t&&+t.version>=10.01){const e=l.indexOf("?");e>-1?l=l.slice(0,e)+"/legend"+l.slice(e):l+="/legend"}else{const e=l.toLowerCase().indexOf("/rest/"),t=-1===e?l:l.slice(0,e)+l.slice(e+5);l=ce+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return s(l,{query:i}).then(e=>e.data)}async _constructLegendElementsForBuildingSceneLayer(){this._loading=!0,this.legendElements=[],this.removeHandles("sublayers-watcher");const e=this.layer;this.addHandles(h(()=>e.sublayers,()=>this._constructLegendElementsForBuildingSceneLayer()),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(e.sublayers,this.opacity)}catch(t){o.getLogger(this).warn("Request to server for legend has failed!",t)}finally{this._loading=!1,this.notifyChange("ready")}}async _generateLegendElementsForBuildingSublayers(e,t){let i=[];this.addHandles(e.on("change",()=>this._constructLegendElementsForBuildingSceneLayer()),"sublayers-watcher");const s=e.toArray();for(const l of s){const e=h(()=>["renderer"in l&&l.renderer,l.opacity,l.title,l.visible],()=>this._constructLegendElementsForBuildingSceneLayer());if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||l.visible){const e=null!=l?.opacity?l.opacity:null,s=null!=e?e*t:t;if("building-group"===l.type){const e={type:"symbol-table",title:l.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(l.sublayers,s);e.infos.push(...t),i=[e,...i]}else if(l.renderer){i=[...await this._getRendererLegendElements(l.renderer,{title:l.title,opacity:s,sublayer:l}),...i]}}}return i.filter(e=>!!e&&(!("infos"in e)||!e.infos||e.infos.length>0))}async _constructLegendElementsForSublayers(){this._loading=!0,this.removeHandles("sublayers-watcher");const e=this.layer;if(!(Ae(e)||Be(e)||ke(e))||this.hideLayersNotInCurrentView&&!await this._isLayerInCurrentView())return this.legendElements=[],this._loading=!1,void this.notifyChange("ready");this.addHandles(h(()=>e.sublayers,()=>this._constructLegendElementsForSublayers),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(e.sublayers,this.opacity)}catch(t){o.getLogger(this).warn("Request to server for legend has failed!",t)}finally{this._loading=!1,this.notifyChange("ready")}}async _generateLegendElementsForSublayers(e,t,i){const s=this.layer;let l=[];this.addHandles(e.on("change",()=>this._constructLegendElementsForSublayers()),"sublayers-watcher");let n=e.toArray();!i&&this.sublayerIds&&this.sublayerIds.length&&(n=ke(s)?this.sublayerIds.map(e=>s.findSublayerForSubtypeCode(e)).filter(r):this.sublayerIds.map(e=>s.findSublayerById(e)).filter(r));for(const r of n){const e=h(()=>[r.renderer,r.opacity,r.title,r.visible,r.legendEnabled],()=>this._constructLegendElementsForSublayers());this.addHandles(e,"sublayers-watcher");const s=r.createQuery().where,n=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView(s),a=!this.respectLayerVisibility||r.visible&&r.legendEnabled&&this._isSublayerInScale(r);if(n&&a){const e=null!=r?.opacity?r.opacity:null,s=null!=e?e*t:t,n=!Je(r)||r.originIdOf("renderer")>2&&!r.sublayers;if(r.renderer&&n){await r.load();l=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:s,sublayer:r}),...l]}else if(Je(r)){const e=await this._generateSymbolTableElementForSublayer(r,s,i);e&&l.unshift(e)}}}return l.filter(e=>!!e&&(!("infos"in e)||!e.infos||e.infos.length>0))}async _generateSymbolTableElementForSublayer(e,t,i){if(!i){i=new Map;const t=this.layer,s=e.source;let l=null;if(!(!s||"map-layer"===s.type&&s.mapLayerId===e.id&&(!s.gdbVersion||s.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>2||e.originIdOf("labelingInfo")>2||e.originIdOf("labelsVisible")>2){const e=new L({layer:this.layer});l=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const r=l||`${t.uid}-default`;(await this._getLegendLayers(r,l)).forEach(e=>i.set(e.layerId,e))}const s=i.get(e.id);if((!s||s?.subLayerIds&&s.defaultVisibility)&&e.sublayers){const s=await this._generateLegendElementsForSublayers(e.sublayers,t,i);return{type:"symbol-table",title:e.title,infos:s}}return this._generateSymbolTableElementForLegendLayer(s,e,t)}_generateSymbolTableElementForLegendLayer(e,t,i){if(!e?.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const s=t?.renderer;let l=t?.title||e.layerName;if(s&&(!t||t?.originIdOf("renderer")>2)){const e=t?.title||this._getRendererTitle(s,t);e&&(l&&"string"!=typeof e&&"title"in e&&(e.title=l),l=e)}const r={type:"symbol-table",title:l,legendType:e.legendType||null,infos:[]},n=t?this._sanitizeLegendForSublayer(e.legend.slice(),t):e.legend;return e.legendGroups&&e.legendGroups.length>0?e.legendGroups.forEach(s=>{const l={type:"symbol-table",title:s.heading,legendType:e.legendType||null,infos:this._generateSymbolTableElementInfosForLegendLayer(n.filter(e=>e.groupId===s.id),e.layerId,s.heading||r.title||t?.title,i)};l.infos?.length>0&&r.infos.push(l)}):r.infos=this._generateSymbolTableElementInfosForLegendLayer(n,e.layerId,r.title||t?.title,i),r.infos.length>0?r:null}_generateSymbolTableElementInfosForLegendLayer(e,t,s,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(r.startsWith("http"))return null;r=i(`${this.layer.url}/${t}/images/${r}`)}let n=e.label;return"<all other values>"===n&&(n="others"),{previewAriaLabel:n||s,label:n,src:r,opacity:l??this.opacity,width:e.width,height:e.height}}).filter(r)}_isSublayerInScale(e){const t=e.minScale||0,i=e.maxScale||0;return!(t>0&&t<this.scale||i>this.scale)}_isLegendLayerInScale(e,t){const i=t||this.layer;let s=null,l=null,r=!0;return!i.minScale&&0!==i.minScale||!i.maxScale&&0!==i.maxScale?(0===e.minScale&&i.tileInfo&&(s=i.tileInfo.lods[0].scale),0===e.maxScale&&i.tileInfo&&(l=i.tileInfo.lods[i.tileInfo.lods.length-1].scale)):(s=Math.min(i.minScale,e.minScale)||i.minScale||e.minScale,l=Math.max(i.maxScale,e.maxScale)),(s>0&&s<this.scale||l>this.scale)&&(r=!1),r}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&+this.layer.version<10.1||0===e.length)return e;const i=t.renderer,s=e.some(e=>e.values);let l=0,r=null;return s&&e.some((e,t)=>(e.values||(l=t,r=e,r.label||(r.label="others")),null!=r)),i?"unique-value"===i.type?r&&(e.splice(l,1),e.push(r)):"class-breaks"===i.type&&(r&&e.splice(l,1),i.legendOptions?.order||e.reverse(),r&&e.push(r)):r&&(e.splice(l,1),e.push(r)),e}async _getRendererLegendElements(e,t={}){if(!je(e,this.view))return o.getLogger(this).warn(`Renderer of type '${e.type}' not supported!`),[];if(Ie(e))return this._constructPointCloudRendererLegendElements(e,t);if(ze(e))return this._constructDotDensityRendererLegendElements(e);const i=await this._loadRenderer(e);return Te(i)?this._constructPieChartRendererLegendElements(i):this._constructRendererLegendElements(i,t)}async _getLegendElementsForFeatureReduction(e){let t=null;return"binning"===e.type?t=e.renderer:"cluster"===e.type&&(t=this._getClusterRenderer(e)),t?this._getRendererLegendElements(t,{isFeatureReductionRenderer:!0}):[]}_getPointCloudRendererTitle(e){return(e.legendOptions?.title||e.field)??""}async _constructPointCloudRendererLegendElements(e,t={}){const i=t.title,s=[];let l=null,r=null;if(Ve(e))l={type:"symbol-table",title:i||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach(e=>{l.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(pe,e.color)})});else if(De(e)){const t=e.stops;let s=null;if(t?.length&&(1===t.length&&(s=t[0].color),!s)){const e=t[0].value,i=t[t.length-1].value;if(null!=e&&null!=i){s=H(e+(i-e)/2,t)}}l={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(pe,s||pe.color)}]};const n=q(e.stops??[])??[];r={type:"color-ramp",title:i||this._getPointCloudRendererTitle(e),infos:n,preview:M(n.map(e=>e.color))}}else xe(e)&&(l={type:"symbol-table",title:i||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos?.forEach(e=>{l.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(pe,e.color)})}));return l?.infos.length&&s.push(l),r?.infos.length&&s.push(r),await this._generatePreviewsForLegendElements(s,{opacity:this.opacity,symbolConfig:{applyColorModulation:!!e.colorModulation}}),s}async _getElementInfoForDotDensity(e,t){const{color:i,label:s,valueExpressionTitle:l}=t,{backgroundColor:r,outline:n,dotSize:a}=e,o=this.cssEffectFilter,u=a+"-"+i+"-"+r+"-"+(n&&JSON.stringify(n.toJSON()))+"-"+o,c=this._dotDensityUrlCache,d=c.has(u)?c.get(u):P(e,i);c.set(u,d);const y={shape:{type:"image",x:0,y:0,width:d.width,height:d.height,src:d.src},fill:null,stroke:null,offset:[0,0]},h=k([[y]],[d.width,d.height],{cssEffectFilter:this.cssEffectFilter});return{opacity:1,src:d.src,preview:h,width:d.width,height:d.height,previewAriaLabel:s||l}}async _constructDotDensityRendererLegendElements(e){const t=e.calculateDotValue(this.view.scale),i=e.legendOptions?.unit,s={type:"symbol-table",title:{value:t&&Math.round(t),unit:i||""},infos:[]};for(const l of e.attributes){const t=await this._getElementInfoForDotDensity(e,l);t.label=l.label||l.valueExpressionTitle||l.field,s.infos.push(t)}return[s]}async _constructPieChartRendererLegendElements(e){const t=[];let i=null;const s=e.outline;e.attributes.forEach(e=>{const i=new j({color:e.color,outline:s}),l=e.label||e.valueExpressionTitle||e.field;t.push({label:l,symbol:i})});const l=t.length?[...t]:[];if(e.othersCategory?.color&&0!==e.othersCategory?.threshold){const l=new j({color:e.othersCategory.color,outline:s});i=e.othersCategory.label||"Other",t.push({label:i,symbol:l})}if(e.defaultColor?.a){const i=new j({color:e.defaultColor,outline:s});t.push({label:e.defaultLabel,symbol:i})}const r=await this._getVisualVariableLegendElements(e,this.layer)||[];if(t.length){r.unshift({type:"symbol-table",title:null,infos:t});const n=l.filter(e=>e.label!==i).map(e=>e.symbol.color).filter(Boolean),a=U(n,{holePercentage:e.holePercentage,backgroundColor:e.backgroundFillSymbol?.color,cssEffectFilter:this.cssEffectFilter,outline:s});r.unshift({type:"pie-chart-ramp",title:this._getRendererTitle(e,this.layer),infos:t,preview:a})}return await this._generatePreviewsForLegendElements(r,{opacity:this.layer.opacity,cssEffectFilter:this.cssEffectFilter}),r}async _getWhereClause(e,t,i){const s=await g(e,i),l=new Set,{field:r,field2:n,field3:a}=t;E(l,i,[r,n,a]),await F(l,i,null,t.valueExpression);const o=new Set(Array.from(l,e=>e.toLowerCase())),u=s?.fieldNames.map(e=>e.toLowerCase());return u?.some(e=>!o.has(e))?null:s}async _processDefinitionExpression(e,t){if(!("definitionExpression"in e))return;const i=e.definitionExpression;i&&this.respectLayerDefinitionExpression?this._layerDefinitionExpression!==i&&(this._layerDefinitionExpressionClause=await this._getWhereClause(i,t,e.fieldsIndex)):this._layerDefinitionExpressionClause=null,this._layerDefinitionExpression=i}async _processDisplayFilter(e,t){if(!("displayFilterInfo"in e))return;const i=e.displayFilterInfo?v(e.displayFilterInfo,this.view):null;return i?.where?this._layerDisplayFilter?.id!==i?.id&&(this._layerDisplayFilterClause=await this._getWhereClause(i.where,t,e.fieldsIndex)):this._layerDisplayFilterClause=null,this._layerDisplayFilter=i,i}async _constructRendererLegendElements(e,t={}){const{title:i,sublayer:s,isFeatureReductionRenderer:l}=t,r=s||this.layer,n=ie(e,"reference-size"),a=ie(e,"spike"),o=l&&"renderer"in r&&r.renderer?r.renderer:e;let u=null;Fe(o)&&(await this._processDefinitionExpression(r,o),u=await this._processDisplayFilter(r,o)),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const c=await this._getVisualVariableLegendElements(e,r)||[],d={type:"symbol-table",title:i||this._getRendererTitle(e,r),infos:[]};let y=null,h=!1;const f=new Set;if(be(e)&&!this._hasSizeRamp){const t=await se(e);d.infos.push({label:null,symbol:t})}else if(We(e)){let t=i;const s=Ge(e)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",l=c.findIndex(e=>"color-ramp"===e.type),r=-1!==l?c.splice(l,1)[0]:null,n=c.findIndex(e=>"size-ramp"===e.type),a=-1!==n?c.splice(n,1)[0]:null,o=[];r&&(t=r.title,o.push(r)),a&&(t=a.title,o.push(a)),o.length>0&&c.push({type:s,title:t,infos:o})}else if(Ce(e)){const t=J(e);c.push({type:"heatmap-ramp",title:i||this._getRendererTitle(e,r),infos:t,preview:M(t.map(e=>e.color),{cssEffectFilter:this.cssEffectFilter})})}else if(Fe(e)){const t=e.authoringInfo;if(t&&"relationship"===t.type){const{numClasses:i,field1:s,field2:l}=t,n=t.focus;if(i&&s&&l){const t=[s,l];let a=Q(n)||0;for(const e of t){const{field:t,normalizationField:i,label:s}=e,l=s||{field:this._getFieldAlias(t,r),normField:i&&this._getFieldAlias(i,r)},n=Ke.clone();n.angle=a,d.infos.push({label:l,symbol:n}),f.add(n),a+=90}const o=Z({focus:n,numClasses:i,infos:e.uniqueValueInfos??[]});c.unshift(o)}}else if(Ne(this.layer)||$e(this.layer)){const{uniqueValueInfos:t}=e;if(t)for(const e of t)e.symbol&&await this._checkClausesForUVR(o,e.value)&&d.infos.push({label:e.label||e.value,value:e.value,symbol:e.symbol})}else{const{field:t,field2:s,field3:l,fieldDelimiter:a,valueExpression:c,defaultSymbol:y}=e,f=!(!t&&!c||!s&&!l),m=u?u.title:null,p=[],{uniqueValueGroups:g}=e;if(g)for(const e of g){const i={type:"symbol-table",title:m||e.heading,infos:[]},{classes:u}=e;if(u)for(const e of u){const{symbol:u,values:d}=e;if(u){const y=[],h=[];for(const e of d??[]){const{value:i,value2:n,value3:o}=e,u=[],d=[];(t||c)&&(u.push(i),d.push(this._getDomainName(t,i,r))),s&&(u.push(n),d.push(this._getDomainName(s,n,r))),l&&(u.push(o),d.push(this._getDomainName(l,o,r))),y.push(f?u.join(a||""):u[0]),h.push(d.join(" - "))}const m=y.join(", ");let p=e.label;if(!p){const e=h.filter(Boolean);p=e.length?e.join(", "):m}let g=u;"cim"===g.type&&n&&(g=g.clone(),z(g,{innerDotSize:.5*ue,outerRingSize:ue}));let b=!1;for(const e of y)if(b=await this._checkClausesForUVR(o,e),b)break;b&&i.infos.push({label:p,value:m,symbol:g})}}i.infos.length&&p.push(i)}if(p.length){const t=p[0];if(1===p.length&&"title"in t&&!t.title){const e=t.infos?.filter(Qe)??[];d.infos.push(...e)}else y&&(p.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:y}]}),h=!0),d.infos.push(...p);i||e.legendOptions?.title||e.valueExpressionTitle||(d.title=null)}}e.defaultSymbol&&!h&&(d.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),h=!0)}else if(Ee(e)){if(!n&&!a){y=this._isUnclassedRenderer(e);if(!y||!this._hasSizeRamp){const t=e.classBreakInfos.filter(({symbol:e})=>e),i="ascending-values"===e.legendOptions?.order;for(const{label:e,minValue:s,maxValue:l,symbol:n}of t){const t=e||(y?null:`${s} - ${l}`),a={previewAriaLabel:t||d.title||r.title,label:t,value:[s,l],symbol:n};i?d.infos.push(a):d.infos.unshift(a)}y&&(d.title=null),this._updateInfosForClassedSizeRenderer(e,d.infos)}e.defaultSymbol&&!y&&(d.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),h=!0)}}else if(we(e))if($e(this.layer)||He(this.layer)){const t=await this._constructTileImageryStretchRendererElements(e);qe(t)?c.push(t):d.infos=t}else{const t=this.layer;let i,s;e.customStatistics?.length&&({min:i,max:s}=e.customStatistics[0]);let l=[],r=t.serviceRasterInfo;if(t.rasterFunction)try{r=await t.generateRasterInfo(t.rasterFunction)}catch{}const n=I(r.pixelType);if(1===r.bandCount){const l=t.bandIds?.[0]||0;i=null!=i?i:r.statistics?r.statistics[l].min:n[0],s=null!=s?s:r.statistics?r.statistics[l].max:n[1],i||s?c.push(await this._getStretchLegendElements(e,{min:i,max:s})):this._getServerSideLegend()}else if(t.bandIds&&1===t.bandIds.length)i=null!=i?i:r.statistics?r.statistics[t.bandIds[0]].min:n[0],s=null!=s?s:r.statistics?r.statistics[t.bandIds[0]].max:n[1],i||s?c.push(await this._getStretchLegendElements(e,{min:i,max:s})):this._getServerSideLegend();else if(r.bandCount>=3){const{bandInfos:e}=r,{bandIds:i}=t;e.length>=r.bandCount?3===i?.length?(l=i.map(t=>e[t].name),d.infos=this._createSymbolTableElementMultiBand(l)):"lerc"===t.format?(l=[0,1,2].map(t=>e[t].name),d.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend():"lerc"===t.format?(l=["band1","band2","band3"],d.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend()}else this._getServerSideLegend()}else if(Se(e))e.colormapInfos.forEach(e=>{d.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(ge,e.color)})});else if(Le(e)){let i=e.symbol;switch(t.geometryType){case"point":i="pointSymbol"in r?r.pointSymbol:null;break;case"polyline":i="lineSymbol"in r?r.lineSymbol:null;break;case"polygon":i="polygonSymbol"in r?r.polygonSymbol:null}const s=this._clusterSizeVariable&&this._getClusterSymbol()||!this._hasSizeRamp;e.symbol&&s&&d.infos.push({previewAriaLabel:e.label||d.title||r.title,label:e.label,symbol:i})}else if(_e(e)){e.outputUnit&&(this.title="("+e.toJSON().outputUnit+")"),d.title=e.attributeField;const t=e.getClassBreakInfos();t?.length?t.forEach(e=>{d.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})}):d.infos.push({label:e.attributeField,symbol:e.getDefaultSymbol()})}else ve(e)&&c.push(await this._getStretchLegendElements(e,{min:0,max:255}));const m=e.defaultSymbol;!m||h||Le(e)||y&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||c.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:m}]}),d.infos.length&&c.unshift(d);const p=null==t.opacity?this.opacity:t.opacity,g=this._isTallSymbol("visualVariables"in e?e.visualVariables:null),b=Ne(this.layer)||$e(this.layer);return await this._generatePreviewsForLegendElements(c,{opacity:p,symbolConfig:{isTall:g,isSquareFill:b},cssEffectFilter:this.cssEffectFilter},{arrowMarkerSymbols:f}),e=null,c}async _waitForLayerViewUpdate(e){const t=new AbortController,i=m(()=>!e.updating,t.signal);await d(i,5e3,t)}async _checkFeatureCountForExpression(e,t){const i=this.layerView;if(!(i&&"createQuery"in i&&"queryFeatureCount"in i))return!0;try{await this._waitForLayerViewUpdate(i);const s=i.createQuery();e&&(s.where=le(s.where,e)),t&&(s.geometry=t);return await i.queryFeatureCount(s)>0}catch{return!0}}async _checkClausesForUVR(e,t){const i=Ze(e,t);if(!i)return!0;return(!!!(!this._layerDefinitionExpressionClause&&this._layerDefinitionExpression&&this.respectLayerDefinitionExpression||!this._layerDisplayFilterClause&&this._layerDisplayFilter?.where)||await this._checkFeatureCountForExpression(`${e.field} = ${t}`))&&(!this._layerDefinitionExpressionClause||this._layerDefinitionExpressionClause.testFeature(i))&&(!this._layerDisplayFilterClause||this._layerDisplayFilterClause.testFeature(i))}_getServerSideLegend(){setTimeout(()=>this.buildLegendElementsForTools(),0)}_getAllInfos(e){const t=e?.infos;return t?t.reduce((e,t)=>e.concat(this._getAllInfos(t)),[]):[e]}async _constructTileImageryStretchRendererElements(e){const t=this.layer,i=t.symbolizer.rasterInfo??t.raster.rasterInfo;let s,l;const r=e?.customStatistics?.length?e.customStatistics:i?.statistics;if(r)({min:s,max:l}=r[0]);else{const e=I(i.pixelType);s=e[0],l=e[1]}if(t.hasStandardTime()&&(s=t.getStandardTimeValue(s),l=t.getStandardTimeValue(l)),1===i.bandCount||1===t.bandIds?.length)return this._getStretchLegendElements(e,{min:s,max:l});const n=(t?.bandIds?.length?t.bandIds:Array.from(Array(Math.min(i.bandCount,3)).keys())).map(e=>i.bandInfos[e].name);return n.length<3?n.push(n[1]):n.length>3&&n.splice(3),this._createSymbolTableElementMultiBand(n)}async _getStretchLegendElements(e,t){const i=e.colorRamp,s=W(i,t);return{type:"stretch-ramp",title:"",infos:s,preview:M(s.map(e=>e.color))}}_getClusterSymbol(){const e=this.layer,t="featureReduction"in e&&e.featureReduction,i=t&&"symbol"in t&&t.renderer;return i&&!0!==i?.authoringInfo?.isAutoGenerated?null:t&&"symbol"in t?t.symbol:null}async _getSizeLegendElement(e,t,i,s){return{type:"size-ramp",title:this._clusterSizeVariable?this._getClusterTitle(t):e,infos:await K(i,t,await re(i),this.scale,this.view,s,this._clusterSizeVariable?this._getClusterSymbol():null)}}_createSymbolTableElementMultiBand(e){const t=[],i=["red","green","blue"];return e.forEach((e,s)=>{t.push({label:{colorName:i[s],bandName:e},src:ne[s],opacity:this.opacity??1})}),t}_updateInfosForClassedSizeRenderer(e,t){const i=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,s=e.classBreakInfos.some(e=>N(e.symbol));if(i&&s){const i=X,s=Y,l=e.classBreakInfos.length,r=(i-s)/(l>1?l-1:l);t.forEach((e,t)=>{e.size=i-r*t})}}_isTallSymbol(e){let t=!1,i=!1;if(e)for(let s=0;s<e.length&&(!t||!i);s++){const l=e[s];"size"===l.type&&("height"===l.axis&&(t=!0),"width-and-depth"===l.axis&&(i=!0))}return t&&i}async _generatePreviewsForLegendElements(e,t,i){const s=[];for(const l of e)for(const e of l.infos??[])if("infos"in e&&e.infos&&s.push(this._generatePreviewsForLegendElements([e],t,i)),Qe(e)&&e.symbol&&!e.preview){let r=!0;if("cim"===e.symbol.type){const{minScale:t,maxScale:i}=e.symbol.data;(t&&t<this.scale||i&&i>this.scale)&&(r=!1)}r&&s.push(this._generateSymbolPreviewForInfo(e,{...t,clipBloomEffect:"theme"in l&&"spike"===l.theme,cssEffectFilter:i?.arrowMarkerSymbols?.has(e.symbol)?null:t.cssEffectFilter},i?{applyScaleDrivenSize:!i.arrowMarkerSymbols?.has(e.symbol)}:void 0))}await Promise.all(s)}async _getSize(e,t){let i=null==e.size&&this._hasSizeRamp?p(22):e.size;if(this._scaleDrivenSizeVariable&&t?.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");i=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}return i}_getPreviewCIMOptions(e){return{style:"legend",cimOptions:{allowScalingUp:this._hasSizeRamp||!(!this._scaleDrivenSizeVariable||!e?.applyScaleDrivenSize),viewParams:this.isScaleDriven?{viewingMode:"2d"===this.view?.type?"map":this.view?.viewingMode,scale:this.view?.scale}:null}}}async _generateSymbolPreviewForInfo(e,t={},i){const{symbol:s}=e;try{if(t.size=await this._getSize(e,i),t.scale=!1,"cim"===s.type){const e=this._getPreviewCIMOptions(i);t={...t,...e}}e.preview=await A(s,t)}catch{e.preview=null,o.getLogger(this).warn(`Generating symbol preview failed for symbol type: ${s?.type}`)}}_getClusterRenderer(e){this._clusterSizeVariable=null;const t="renderer"in this.layer?this.layer.renderer:null,i=e.renderer?.clone()||t?.clone(),s=$(e,this.layerView,this.view);if(s&&null!=i&&"visualVariables"in i){const t=i.visualVariables?.some(e=>"size"===e.type&&"outline"!==e.target&&!fe.test(e.valueExpression));if(!t){if("clusterMinSize"in e&&"clusterMaxSize"in e){const{clusterMinSize:t,clusterMaxSize:i}=e;s.legendOptions=new x({showLegend:t!==i})}const t=i.visualVariables||[];i.visualVariables=t.concat([s]),this._clusterSizeVariable=s}}return i}async _loadRenderer(e){if(Ye.has(e))return Ye.get(e);const t=[],i=e.clone(),s=await re(i);if(Ee(i)||Fe(i)){const e=(i.classBreakInfos||i.uniqueValueInfos).map(e=>this._fetchSymbol(e.symbol,s).then(t=>{e.symbol=t}).catch(()=>{e.symbol=null}));Array.prototype.push.apply(t,e)}return t.push(this._fetchSymbol(i.symbol||i.defaultSymbol,i.defaultSymbol?null:s).then(e=>{this._applySymbolToRenderer(i,e,Le(i))}).catch(()=>{this._applySymbolToRenderer(i,null,Le(i))})),await Promise.allSettled(t),Ye.set(e,i),i}_applySymbolToRenderer(e,t,i){i?e.symbol=t:e.defaultSymbol=t}async _fetchSymbol(e,t){if(!e)throw new Error;if("web-style"===e.type){const i=this._webStyleSymbolCache;try{const s=await e.fetchSymbol({cache:i});return this._getAppliedCloneSymbol(s,t)}catch{throw o.getLogger(this).warn("Fetching web-style failed!"),new Error}}return this._getAppliedCloneSymbol(e,t)}_getAppliedCloneSymbol(e,i){if(!e||!i)return e;const s=e.clone(),l=i&&i.toRgba();return s.type.includes("3d")?this._applyColorTo3dSymbol(s,l):"cim"===s.type?O(s,i):s.color&&(s.color=new t(l||s.color)),s}_applyColorTo3dSymbol(e,i){i&&e.symbolLayers.forEach(e=>{e&&(e.material||(e.material={}),e.material.color=new t(i))})}async _getVisualVariableLegendElements(e,t){if(!("visualVariables"in e)||"vector-field"===e.type)return null;const i=e.visualVariables??[],s=[],l=[],n=[],a=ie(e,"reference-size")??ie(e,"spike");let o;const c=this._clusterSizeVariable;if(2===a?.sizeStops?.length&&(Ee(e)||Fe(e))){const[e,t]=a.sizeStops,i=c?c.minDataValue:e.value,s=c?c.maxDataValue:t.value;o=new D({field:a.field??void 0,normalizationField:a.normalizationField,minSize:u(e.size,10,100),maxSize:u(t.size,50,150),minDataValue:i,maxDataValue:s}),l.push(o)}for(const r of i)if("color"===r.type)s.push(r);else if("size"===r.type){if("cluster_count"===r.field&&o)continue;l.push(r)}else"opacity"===r.type&&n.push(r);const d=[...s,...l,...n];let y,h;if(0===s.length&&Ee(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];y=t&&t.symbol}if(0===s.length&&Le(e)&&(y=e.symbol),y)if(y.type.includes("3d")){const e=y.symbolLayers.at(0);"water"===e.type?null!=e.color&&(h=e.color):null!=e.material?.color&&(h=e.material.color)}else y.url||(h=y.color);const f=this.cssEffectFilter;return(await Promise.all(d.map(async i=>{if(!i.legendOptions||!1!==i.legendOptions.showLegend){const s=be(e)?i.field:this._getRampTitle(i,t);let l=null;const r=ae(t,i,this.view.timeZone);if("color"===i.type){const e=await G(i,null,r)??[];l={type:"color-ramp",title:s,infos:e,preview:M(e.map(e=>e.color),{cssEffectFilter:f})},this._hasColorRamp||(this._hasColorRamp=e.length>0)}else if("size"===i.type&&"outline"!==i.target)fe.test(i.valueExpression)?this._clusterSizeVariable||(this._scaleDrivenSizeVariable=i):(l=await this._getSizeLegendElement(s,i,e,r),o===i&&"spike"===a?.theme&&(l.theme=a.theme),this._hasSizeRamp||(this._hasSizeRamp=!(null==l.infos||!l.infos.length)));else if("opacity"===i.type){const e=await G(i,h,r)??[];l={type:"opacity-ramp",title:s,infos:e,preview:M(e.map(e=>e.color),{cssEffectFilter:f})},this._hasOpacityRamp||(this._hasOpacityRamp=e.length>0)}return l?.infos?l:null}}))).filter(r)}_getDomainName(e,t,i){if(e&&"function"!=typeof e){const s="getField"in i&&i.getField?.(e),l=s&&"getFieldDomain"in i&&i.getFieldDomain?i.getFieldDomain(s.name,{excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")}):null;return"coded-value"===l?.type?l.getName(t):null}return null}_getClusterTitle(e){const t=this.layer,i=e.field;if("featureReduction"in t&&t.featureReduction&&"cluster"===t.featureReduction.type){const e=t.featureReduction,s="popupTemplate"in e&&e.popupTemplate,l=s&&s.fieldInfos;if(l)for(const t of l)if(t.fieldName===i)return"cluster_count"===i?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let i=e.field,s=e.normalizationField,l=!1,r=!1,n=!1,a=null;i="function"==typeof i?null:i,s="function"==typeof s?null:s;const o=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?.visualVariables){const e=t.renderer.authoringInfo.visualVariables;for(let t=0;t<e.length;t++){const i=e[t];if("color"===i.type){if("ratio"===i.style){l=!0;break}if("percent"===i.style){r=!0;break}if("percent-of-total"===i.style){n=!0;break}}}}a={field:i&&this._getFieldAlias(i,t),normField:s&&this._getFieldAlias(s,t),ratio:l,ratioPercent:r,ratioPercentTotal:n}}return a}_getRendererTitle(e,t){const i=e;if(i.legendOptions?.title)return i.legendOptions.title;if(i.valueExpressionTitle)return i.valueExpressionTitle;let s=i.field,l=null,r=null;if(Ee(i)&&(l=i.normalizationField,r="percent-of-total"===i.normalizationType),s="function"==typeof s?null:s,l="function"==typeof l?null:l,Fe(i)){const{field2:e,field3:l,fieldDelimiter:r}=i;let n=s&&this._getFieldAlias(s,t);return e&&(n=`<${n}>${r}<${this._getFieldAlias(e,t)}>`,l&&(n=`${n}${r}<${this._getFieldAlias(l,t)}>`)),n}let n=null;return(s||l)&&(n={field:s&&this._getFieldAlias(s,t),normField:l&&this._getFieldAlias(l,t),normByPct:r}),n}_getFieldAlias(e,t){const i="popupTemplate"in t?t.popupTemplate:null,s=i?.fieldInfos;let l=s?.find(t=>e===t.fieldName),r=null;"getField"in t&&t.getField?r=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(r=t.fieldsIndex.get(e));let n=null;const a="featureReduction"in t&&t.featureReduction;a&&(l??="popupTemplate"in a?a.popupTemplate?.fieldInfos?.find(t=>e?.toLowerCase()===t.fieldName?.toLowerCase()):void 0,"fields"in a&&a.fields&&(n=a.fields.find(t=>t.name?.toLowerCase()===e?.toLowerCase())));const o=l||r||n;let u=null;return o&&(u=l?.label||r?.alias||n?.alias||"name"in o&&o.name||"fieldName"in o&&o.fieldName||null),u}_isUnclassedRenderer(e){const t=e.visualVariables;let i=!1;return Ee(e)&&e.classBreakInfos&&1===e.classBreakInfos.length&&t&&(i=e.field?t.some(t=>!(!t||e.field!==t.field||(e.normalizationField||t.normalizationField)&&e.normalizationField!==t.normalizationField)):!!t.length),i}};e([_()],et.prototype,"_loading",void 0),e([_()],et.prototype,"children",void 0),e([_({readOnly:!0})],et.prototype,"cssEffectFilter",null),e([_()],et.prototype,"layerView",void 0),e([_()],et.prototype,"layer",void 0),e([_()],et.prototype,"legendElements",void 0),e([_({readOnly:!0})],et.prototype,"loading",null),e([_({readOnly:!0})],et.prototype,"opacity",null),e([_()],et.prototype,"parent",void 0),e([_({readOnly:!0,dependsOn:[]})],et.prototype,"ready",null),e([_()],et.prototype,"hideLayersNotInCurrentView",void 0),e([_()],et.prototype,"keepCacheOnDestroy",void 0),e([_()],et.prototype,"respectLayerDefinitionExpression",void 0),e([_()],et.prototype,"respectLayerVisibility",void 0),e([_({readOnly:!0})],et.prototype,"scale",null),e([_()],et.prototype,"sublayerIds",void 0),e([_({readOnly:!0})],et.prototype,"isScaleDriven",null),e([_()],et.prototype,"title",void 0),e([_({readOnly:!0,dependsOn:["ready"],value:0})],et.prototype,"version",null),e([_()],et.prototype,"view",void 0),et=e([S("esri.widgets.Legend.support.ActiveLayerInfo")],et);export{et as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{addTokenParameter as i}from"../../../kernel.js";import s from"../../../request.js";import l from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import n from"../../../core/Collection.js";import has from"../../../core/has.js";import{JSONMap as a}from"../../../core/jsonMap.js";import o from"../../../core/Logger.js";import{clamp as u}from"../../../core/mathUtils.js";import{debounce as c,timeout as d}from"../../../core/promiseUtils.js";import{on as y,watch as h,initial as f,whenOnce as m}from"../../../core/reactiveUtils.js";import{px2pt as p}from"../../../core/screenUtils.js";import{parseWhereClause as g}from"../../../core/sql.js";import{addQueryParameters as b}from"../../../core/urlUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";import{EffectView as w}from"../../../layers/effects/EffectView.js";import{getEffectiveDisplayFilter as v}from"../../../layers/support/displayFilterUtils.js";import{ExportImageParameters as L}from"../../../layers/support/ExportImageParameters.js";import{collectFields as E,collectArcadeFieldNames as F}from"../../../layers/support/fieldUtils.js";import{isFeatureLayer as C}from"../../../layers/support/layerUtils.js";import{getPixelValueRange as I}from"../../../layers/support/rasterFormats/pixelRangeUtils.js";import{fromJSON as R}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as V}from"../../../renderers/support/rendererConversion.js";import D from"../../../renderers/visualVariables/SizeVariable.js";import x from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{updateReferenceSizeSymbol as z}from"../../../smartMapping/renderers/support/referenceSizeUtils.js";import T from"../../../symbols/SimpleFillSymbol.js";import j from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolColor as O}from"../../../symbols/support/cimSymbolUtils.js";import{renderSymbol as k}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as M,renderDotDensityPreviewHTML as P,renderPieChartPreviewHTML as U,renderPreviewHTML as A}from"../../../symbols/support/symbolUtils.js";import{getCSSFilterFromEffectList as B,isVolumetricSymbol as N}from"../../../symbols/support/utils.js";import{getEffectiveClusterSizeVariable as $}from"./clusterUtils.js";import{getColorFromPointCloudStops as H,getRampStopsForPointCloud as q,getStretchRampStops as W,getRampStops as G}from"./colorRampUtils.js";import{getHeatmapRampStops as J}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as Q,getRelationshipRampElement as Z}from"./relationshipRampUtils.js";import{getRampStops as K,realWorldMaxSize as X,realWorldMinSize as Y}from"./sizeRampUtils.js";import{specialCharsLessThan as ee,specialCharsGreaterThan as te,getAuthoringInfoVisualVariableByTheme as ie,getSymbolForFlowRenderer as se,mergeWhereClauses as le,getMedianColor as re,rgbImgSource as ne,getDateFormatOptions as ae}from"./utils.js";import{formatNumberLabel as oe}from"../../smartMapping/support/utils.js";const ue=16,ce="https://utility.arcgis.com/sharing/tools/legend",de="esri.layers.ImageryLayer",ye="esri.layers.ImageryTileLayer",he="esri.layers.WCSLayer",fe=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,me=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),pe=new j({size:6,outline:{color:[128,128,128,.5],width:.5}}),ge=new T({style:"solid"});function be(e){return"flow"===e.type}function _e(e){return"vector-field"===e.type}function Se(e){return"raster-colormap"===e.type}function we(e){return"raster-stretch"===e.type}function ve(e){return"raster-shaded-relief"===e.type}function Le(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function Fe(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function Ce(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function Ie(e){return Ve(e)||De(e)||xe(e)||Re(e)}function Re(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function Ve(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function De(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function xe(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function ze(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Te(e){return"esri.renderers.PieChartRenderer"===e.declaredClass}function je(e,t){return Le(e)||Ee(e)||Fe(e)||Ce(e)||ze(e)||Te(e)?"2d"===t.type||V(e):we(e)||Se(e)||ve(e)||Ve(e)||De(e)||xe(e)||_e(e)||be(e)}function Oe(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function ke(e){return"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Me(e){return"esri.layers.VoxelLayer"===e.declaredClass}function Pe(e){return"esri.layers.WMSLayer"===e.declaredClass}function Ue(e){return"esri.layers.WMTSLayer"===e.declaredClass}function Ae(e){return"esri.layers.MapImageLayer"===e.declaredClass}function Be(e){return"esri.layers.TileLayer"===e.declaredClass}function Ne(e){return e.declaredClass===de}function $e(e){return e.declaredClass===ye}function He(e){return e.declaredClass===he}function qe(e){return"stretch-ramp"===e.type}function We(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type}function Ge(e){const t="authoringInfo"in e?e?.authoringInfo:null;return"univariate-color-size"===t?.type&&"above-and-below"===t?.univariateTheme}function Je(e){return"sublayers"in e}function Qe(e){return e&&"symbol"in e}function Ze(e,t){const{field:i,field2:s,field3:l,fieldDelimiter:r,valueExpression:n}=e;if(!i)return null;const a=!(!i&&!n||!s&&!l)?t?.toString().split(r||""):[t],o=i?{[i]:a?.[0]}:null;return o&&(s&&(o[s]=a?.[1]),l&&(o[l]=a?.[2])),o}const Ke=new j({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let Xe={};const Ye=new WeakMap;let et=class extends l{constructor(e){super(e),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._loading=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._clusterSizeVariable=null,this._layerDefinitionExpression=null,this._layerDefinitionExpressionClause=null,this._layerDisplayFilter=null,this._layerDisplayFilterClause=null,this.children=new n,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this.addHandles([y(()=>this.children,"change",t=>{const{added:i,removed:s}=t;i.forEach(t=>{const i=`activeLayerInfo-ready-watcher-${t.layer.uid}`;this.addHandles(h(()=>t.ready,e,f),i)}),s.forEach(e=>this.removeHandles(e.layer.uid)),e()})]),this.keepCacheOnDestroy||(Xe={})}destroy(){this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(Xe=null),this._layerDefinitionExpressionClause=null}get cssEffectFilter(){const{layer:e,scale:t}=this,i="effect"in e?e.effect:null;if(!i)return null;const s=new w({effect:i});return s.endTransition(),s.scale=t,B(s,!0)}get loading(){return this.children.length>0?this.children.some(e=>e.loading):this._loading}get opacity(){const e=this.layer.opacity,t=this.parent?.opacity,i=this.layer.parent,s=i&&"uid"in i?this._getParentLayerOpacity(i):null;return null!=t?t*e:null!=s?s*e:e}get ready(){return null===this.layer||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){return this.view?.scale??0}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){if("cluster"===e.featureReduction.type)return!0;if("binning"===e.featureReduction.type&&"renderer"in e.featureReduction&&e.featureReduction.renderer)return this._isRendererScaleDriven(e.featureReduction.renderer)}return"renderer"in e&&e.renderer?!!("displayFilterInfo"in e&&e.displayFilterInfo&&Fe(e.renderer))||this._isRendererScaleDriven(e.renderer):this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(e){this._loading=!0;if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],this._loading=!1,void this.notifyChange("ready");const t=Array.from(e,e=>{if(C(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet?.features.length){const t=e.layerDefinition,i=t?.drawingInfo,s=i&&R(i.renderer),l=me.read(t.geometryType);return s?this._getRendererLegendElements(s,{title:e.name,geometryType:l}):(o.getLogger(this).warn("drawingInfo not available!"),null)}return null});try{const e=[],i=await Promise.allSettled(t);for(const t of i)if("fulfilled"===t.status)for(const i of t.value??[])e.push(i);this.legendElements=e}catch(i){o.getLogger(this).warn("error while building legend for layer!",i)}finally{this._loading=!1,this.notifyChange("ready")}}async buildLegendElementsForRenderer(e){try{this._loading=!0;const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getRendererLegendElements(e):[]}catch(t){o.getLogger(this).warn("error while building legend for layer!",t)}finally{this._loading=!1,this.notifyChange("ready")}}async buildLegendElementsForFeatureReduction(e){try{this._loading=!0,await this._waitForLayerViewUpdate(this.layerView);const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getLegendElementsForFeatureReduction(e):[]}catch(t){o.getLogger(this).warn("error while building legend for layer!",t)}finally{this._loading=!1,this.notifyChange("ready")}}async buildLegendElementsForTools(){this._loading=!0;const e=this.layer;if(Me(e))await this._constructLegendElementsForVoxelLayer();else if(Ue(e))this._constructLegendElementsForWMTSlayer();else if(Pe(e))await this._constructLegendElementsForWMSSublayers();else if(Oe(e))await this._constructLegendElementsForBuildingSceneLayer();else if(Ae(e)||Be(e)||ke(e))await this._constructLegendElementsForSublayers();else{this.removeHandles("imageryLayers-watcher");let t="default";if(Ne(e)){const i=e;t=(i?.rasterFunction?.functionName||"default")+"_"+(e.bandIds?.length?e.bandIds.join(""):"###")}if($e(e)||"link-chart"===e.type)return;await this._getLegendLayers(`${e.uid}-${t}`).then(async t=>{this.legendElements=[];const i=t.map(async t=>{if(Ne(e)){const t=h(()=>[e.rasterFunction,e.bandIds],()=>c(async()=>{Xe.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()})());this.addHandles(t,"imageryLayers-watcher")}const i=this._generateSymbolTableElementForLegendLayer(t);i?.infos.length&&(Ne(e)&&(i.title=e.title),this.legendElements.push(i))});await Promise.allSettled(i)}).catch(e=>{o.getLogger(this).warn("Request to server for legend has failed!",e)})}this._loading=!1,this.notifyChange("ready")}async _isLayerInCurrentView(e){return this._checkFeatureCountForExpression(e,this.view.extent)}_getParentLayerOpacity(e){let t=1;const i=e.parent;return i&&"uid"in i&&(t=this._getParentLayerOpacity(i)),e.opacity*t}_isGroupActive(){return this.children.some(e=>e.ready)}_isRendererScaleDriven(e){if("dot-density"===e.type)return!0;const t="valueExpression"in e?e.valueExpression:null;if(fe.test(t))return!0;const i="visualVariables"in e?e.visualVariables:null;return!!i?.some(e=>this._isScaleDrivenSizeVariable(e))||this._hasScaleDrivenSymbols(e)}_hasScaleDrivenSymbols(e){switch(e.type){case"simple":return this._isScaleDrivenSymbol(e.symbol);case"class-breaks":return this._isScaleDrivenSymbol(e.defaultSymbol)||e.classBreakInfos.some(e=>this._isScaleDrivenSymbol(e.symbol));case"unique-value":return this._isScaleDrivenSymbol(e.defaultSymbol)||!!e.uniqueValueInfos?.some(e=>this._isScaleDrivenSymbol(e.symbol))}return!1}_isScaleDrivenSymbol(e){if("cim"===e?.type){const{primitiveOverrides:t,minScale:i,maxScale:s}=e.data,l=t?.some(e=>(e.valueExpressionInfo?.expression||"").includes("$view.scale"))??!1;return null!=i||null!=s||l}return!1}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,i=t.minSize,s=t.maxSize;return!("object"!=typeof i||!i||!this._isScaleDrivenSizeVariable(i))||(!("object"!=typeof s||!s||!this._isScaleDrivenSizeVariable(s))||fe.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&&Ae(t)&&"source"in e&&e.source&&"map-layer"===e.source.type)for(const i of t.sourceJSON.layers??[])if(i.id===e.source.mapLayerId&&(i.minScale>0||i.maxScale>0))return!0;return!1}async _constructLegendElementsForVoxelLayer(){this._loading=!0,this.legendElements=[],this.removeHandles("voxel-style-watcher"),this.removeHandles("voxel-current-variable");const e=this.layer;this.addHandles(h(()=>e.currentVariableId,()=>this._constructLegendElementsForVoxelLayer()),"voxel-current-variable"),this.addHandles(h(()=>e.getVariableStyles(),()=>this._constructLegendElementsForVoxelLayer()),"voxel-style-watcher");const t=e.getVariableStyle(null),i=[];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 T({color:t.color,outline:null})})}),e.length&&i.push({type:"symbol-table",title:t.label,infos:e})}else if(t.transferFunction){const{colorStops:e,stretchRange:s}=t.transferFunction,l=e.toArray().reverse(),r=s.map((e,t)=>`${0===t?ee:te} ${oe(e)}`).reverse(),n=l.map(e=>({color:e.color,value:null,label:null}));n[0].label=r[0],n[n.length-1].label=r[1],i.push({type:"color-ramp",title:t.label,infos:n,preview:M(l.map(e=>e.color))})}await this._generatePreviewsForLegendElements(i,{opacity:e.opacity}),this.legendElements=i,this._loading=!1,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this._loading=!0,this.legendElements=[],this.removeHandles("wmts-activeLayer-watcher");const e=this.layer.activeLayer;this.addHandles(h(()=>{const{layer:e}=this;return e&&"activeLayer"in e&&e.activeLayer},()=>this._constructLegendElementsForWMTSlayer()),"wmts-activeLayer-watcher");const t=e.styleId?e.styles?.find(({id:t})=>t===e.styleId)?.legendUrl:void 0;t&&(this.legendElements=[{type:"symbol-table",title:e.title,infos:[{src:t,opacity:this.opacity}]}]),this._loading=!1,this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this._loading=!0,this.legendElements=[],this.removeHandles("wms-sublayers-watcher");const e=this.layer;let t=null;(e.customParameters||e.customLayerParameters)&&(t={...e.customParameters,...e.customLayerParameters}),this.addHandles(h(()=>{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._loading=!1,this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(e,t){const i=this.layer,s=[];this.addHandles(e.on("change",()=>this._constructLegendElementsForWMSSublayers()),"wms-sublayers-watcher");const l=this.sublayerIds?.map(e=>i.findSublayerById(e))?.filter(r)??[],n=l.length?l:e.toArray();for(const r of n){const e=h(()=>[r.title,r.visible,r.legendEnabled],()=>this._constructLegendElementsForWMSSublayers());if(this.addHandles(e,"wms-sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled){const e=await this._generateSymbolTableElementForWMSSublayer(r,t);e?.infos.length&&s.unshift(e)}}return s}async _generateSymbolTableElementForWMSSublayer(e,t){if(!e.legendUrl&&e.sublayers){const i=(await this._generateLegendElementsForWMSSublayers(e.sublayers,t)).filter(e=>e);return{type:"symbol-table",title:e.title,infos:i}}return this._generateSymbolTableElementForLegendUrl(e,t)}async _generateSymbolTableElementForLegendUrl(e,t){let i=e.legendUrl;if(!i)return;const l={type:"symbol-table",title:e.title||e.name||String(e.id??""),infos:[]};t&&(i=b(i,t));let r=null;const n=e.layer?.opacity;try{r=(await s(i,{responseType:"image"})).data,r&&(r.style.opacity=n)}catch{}return l.infos.push({src:i,preview:r,opacity:n}),l}_getLegendLayers(e,t){const i=Xe&&Xe[e];return i?Promise.resolve(i):this._legendRequest(t).then(t=>{const i=t.layers;return Xe[e]=i,i})}_legendRequest(e){const t=this.layer;let i={f:"json",dynamicLayers:e};if(Ne(t)){const e=t.exportImageServiceParameters.rasterFunction;if(e&&(i.renderingRule=JSON.stringify(e.functionDefinition?.toJSON()||e.toJSON())),t.bandIds&&(i.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:s,customParameters:l}=t;i={raster:e,viewId:s,...i,...l}}}let l=t.url.replace(/(\/)+$/,"");if("version"in t&&+t.version>=10.01){const e=l.indexOf("?");e>-1?l=l.slice(0,e)+"/legend"+l.slice(e):l+="/legend"}else{const e=l.toLowerCase().indexOf("/rest/"),t=-1===e?l:l.slice(0,e)+l.slice(e+5);l=ce+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return s(l,{query:i}).then(e=>e.data)}async _constructLegendElementsForBuildingSceneLayer(){this._loading=!0,this.legendElements=[],this.removeHandles("sublayers-watcher");const e=this.layer;this.addHandles(h(()=>e.sublayers,()=>this._constructLegendElementsForBuildingSceneLayer()),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(e.sublayers,this.opacity)}catch(t){o.getLogger(this).warn("Request to server for legend has failed!",t)}finally{this._loading=!1,this.notifyChange("ready")}}async _generateLegendElementsForBuildingSublayers(e,t){let i=[];this.addHandles(e.on("change",()=>this._constructLegendElementsForBuildingSceneLayer()),"sublayers-watcher");const s=e.toArray();for(const l of s){const e=h(()=>["renderer"in l&&l.renderer,l.opacity,l.title,l.visible],()=>this._constructLegendElementsForBuildingSceneLayer());if(this.addHandles(e,"sublayers-watcher"),!this.respectLayerVisibility||l.visible){const e=null!=l?.opacity?l.opacity:null,s=null!=e?e*t:t;if("building-group"===l.type){const e={type:"symbol-table",title:l.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(l.sublayers,s);e.infos.push(...t),i=[e,...i]}else if(l.renderer){i=[...await this._getRendererLegendElements(l.renderer,{title:l.title,opacity:s,sublayer:l}),...i]}}}return i.filter(e=>!!e&&(!("infos"in e)||!e.infos||e.infos.length>0))}async _constructLegendElementsForSublayers(){this._loading=!0,this.removeHandles("sublayers-watcher");const e=this.layer;if(!(Ae(e)||Be(e)||ke(e))||this.hideLayersNotInCurrentView&&!await this._isLayerInCurrentView())return this.legendElements=[],this._loading=!1,void this.notifyChange("ready");this.addHandles(h(()=>e.sublayers,()=>this._constructLegendElementsForSublayers),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(e.sublayers,this.opacity)}catch(t){o.getLogger(this).warn("Request to server for legend has failed!",t)}finally{this._loading=!1,this.notifyChange("ready")}}async _generateLegendElementsForSublayers(e,t,i){const s=this.layer;let l=[];this.addHandles(e.on("change",()=>this._constructLegendElementsForSublayers()),"sublayers-watcher");let n=e.toArray();!i&&this.sublayerIds&&this.sublayerIds.length&&(n=ke(s)?this.sublayerIds.map(e=>s.findSublayerForSubtypeCode(e)).filter(r):this.sublayerIds.map(e=>s.findSublayerById(e)).filter(r));for(const r of n){const e=h(()=>[r.renderer,r.opacity,r.title,r.visible,r.legendEnabled],()=>this._constructLegendElementsForSublayers());this.addHandles(e,"sublayers-watcher");const s=r.createQuery().where,n=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView(s),a=!this.respectLayerVisibility||r.visible&&r.legendEnabled&&this._isSublayerInScale(r);if(n&&a){const e=null!=r?.opacity?r.opacity:null,s=null!=e?e*t:t,n=!Je(r)||r.originIdOf("renderer")>2&&!r.sublayers;if(r.renderer&&n){await r.load();l=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:s,sublayer:r}),...l]}else if(Je(r)){const e=await this._generateSymbolTableElementForSublayer(r,s,i);e&&l.unshift(e)}}}return l.filter(e=>!!e&&(!("infos"in e)||!e.infos||e.infos.length>0))}async _generateSymbolTableElementForSublayer(e,t,i){if(!i){i=new Map;const t=this.layer,s=e.source;let l=null;if(!(!s||"map-layer"===s.type&&s.mapLayerId===e.id&&(!s.gdbVersion||s.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>2||e.originIdOf("labelingInfo")>2||e.originIdOf("labelsVisible")>2){const e=new L({layer:this.layer});l=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const r=l||`${t.uid}-default`;(await this._getLegendLayers(r,l)).forEach(e=>i.set(e.layerId,e))}const s=i.get(e.id);if((!s||s?.subLayerIds&&s.defaultVisibility)&&e.sublayers){const s=await this._generateLegendElementsForSublayers(e.sublayers,t,i);return{type:"symbol-table",title:e.title,infos:s}}return this._generateSymbolTableElementForLegendLayer(s,e,t)}_generateSymbolTableElementForLegendLayer(e,t,i){if(!e?.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const s=t?.renderer;let l=t?.title||e.layerName;if(s&&(!t||t?.originIdOf("renderer")>2)){const e=t?.title||this._getRendererTitle(s,t);e&&(l&&"string"!=typeof e&&"title"in e&&(e.title=l),l=e)}const r={type:"symbol-table",title:l,legendType:e.legendType||null,infos:[]},n=t?this._sanitizeLegendForSublayer(e.legend.slice(),t):e.legend;return e.legendGroups&&e.legendGroups.length>0?e.legendGroups.forEach(s=>{const l={type:"symbol-table",title:s.heading,legendType:e.legendType||null,infos:this._generateSymbolTableElementInfosForLegendLayer(n.filter(e=>e.groupId===s.id),e.layerId,s.heading||r.title||t?.title,i)};l.infos?.length>0&&r.infos.push(l)}):r.infos=this._generateSymbolTableElementInfosForLegendLayer(n,e.layerId,r.title||t?.title,i),r.infos.length>0?r:null}_generateSymbolTableElementInfosForLegendLayer(e,t,s,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(r.startsWith("http"))return null;r=i(`${this.layer.url}/${t}/images/${r}`)}let n=e.label;return"<all other values>"===n&&(n="others"),{previewAriaLabel:n||s,label:n,src:r,opacity:l??this.opacity,width:e.width,height:e.height}}).filter(r)}_isSublayerInScale(e){const t=e.minScale||0,i=e.maxScale||0;return!(t>0&&t<this.scale||i>this.scale)}_isLegendLayerInScale(e,t){const i=t||this.layer;let s=null,l=null,r=!0;return!i.minScale&&0!==i.minScale||!i.maxScale&&0!==i.maxScale?(0===e.minScale&&i.tileInfo&&(s=i.tileInfo.lods[0].scale),0===e.maxScale&&i.tileInfo&&(l=i.tileInfo.lods[i.tileInfo.lods.length-1].scale)):(s=Math.min(i.minScale,e.minScale)||i.minScale||e.minScale,l=Math.max(i.maxScale,e.maxScale)),(s>0&&s<this.scale||l>this.scale)&&(r=!1),r}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&+this.layer.version<10.1||0===e.length)return e;const i=t.renderer,s=e.some(e=>e.values);let l=0,r=null;return s&&e.some((e,t)=>(e.values||(l=t,r=e,r.label||(r.label="others")),null!=r)),i?"unique-value"===i.type?r&&(e.splice(l,1),e.push(r)):"class-breaks"===i.type&&(r&&e.splice(l,1),i.legendOptions?.order||e.reverse(),r&&e.push(r)):r&&(e.splice(l,1),e.push(r)),e}async _getRendererLegendElements(e,t={}){if(!je(e,this.view))return o.getLogger(this).warn(`Renderer of type '${e.type}' not supported!`),[];if(Ie(e))return this._constructPointCloudRendererLegendElements(e,t);if(ze(e))return this._constructDotDensityRendererLegendElements(e);const i=await this._loadRenderer(e);return Te(i)?this._constructPieChartRendererLegendElements(i):this._constructRendererLegendElements(i,t)}async _getLegendElementsForFeatureReduction(e){let t=null;return"binning"===e.type?t=e.renderer:"cluster"===e.type&&(t=this._getClusterRenderer(e)),t?this._getRendererLegendElements(t,{isFeatureReductionRenderer:!0}):[]}_getPointCloudRendererTitle(e){return(e.legendOptions?.title||e.field)??""}async _constructPointCloudRendererLegendElements(e,t={}){const i=t.title,s=[];let l=null,r=null;if(Ve(e))l={type:"symbol-table",title:i||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach(e=>{l.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(pe,e.color)})});else if(De(e)){const t=e.stops;let s=null;if(t?.length&&(1===t.length&&(s=t[0].color),!s)){const e=t[0].value,i=t[t.length-1].value;if(null!=e&&null!=i){s=H(e+(i-e)/2,t)}}l={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(pe,s||pe.color)}]};const n=q(e.stops??[])??[];r={type:"color-ramp",title:i||this._getPointCloudRendererTitle(e),infos:n,preview:M(n.map(e=>e.color))}}else xe(e)&&(l={type:"symbol-table",title:i||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos?.forEach(e=>{l.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(pe,e.color)})}));return l?.infos.length&&s.push(l),r?.infos.length&&s.push(r),await this._generatePreviewsForLegendElements(s,{opacity:this.opacity,symbolConfig:{applyColorModulation:!!e.colorModulation}}),s}async _getElementInfoForDotDensity(e,t){const{color:i,label:s,valueExpressionTitle:l}=t,{backgroundColor:r,outline:n,dotSize:a}=e,o=this.cssEffectFilter,u=a+"-"+i+"-"+r+"-"+(n&&JSON.stringify(n.toJSON()))+"-"+o,c=this._dotDensityUrlCache,d=c.has(u)?c.get(u):P(e,i);c.set(u,d);const y={shape:{type:"image",x:0,y:0,width:d.width,height:d.height,src:d.src},fill:null,stroke:null,offset:[0,0]},h=k([[y]],[d.width,d.height],{cssEffectFilter:this.cssEffectFilter});return{opacity:1,src:d.src,preview:h,width:d.width,height:d.height,previewAriaLabel:s||l}}async _constructDotDensityRendererLegendElements(e){const t=e.calculateDotValue(this.view.scale),i=e.legendOptions?.unit,s={type:"symbol-table",title:{value:t&&Math.round(t),unit:i||""},infos:[]};for(const l of e.attributes){const t=await this._getElementInfoForDotDensity(e,l);t.label=l.label||l.valueExpressionTitle||l.field,s.infos.push(t)}return[s]}async _constructPieChartRendererLegendElements(e){const t=[];let i=null;const s=e.outline;e.attributes.forEach(e=>{const i=new j({color:e.color,outline:s}),l=e.label||e.valueExpressionTitle||e.field;t.push({label:l,symbol:i})});const l=t.length?[...t]:[];if(e.othersCategory?.color&&0!==e.othersCategory?.threshold){const l=new j({color:e.othersCategory.color,outline:s});i=e.othersCategory.label||"Other",t.push({label:i,symbol:l})}if(e.defaultColor?.a){const i=new j({color:e.defaultColor,outline:s});t.push({label:e.defaultLabel,symbol:i})}const r=await this._getVisualVariableLegendElements(e,this.layer)||[];if(t.length){r.unshift({type:"symbol-table",title:null,infos:t});const n=l.filter(e=>e.label!==i).map(e=>e.symbol.color).filter(Boolean),a=U(n,{holePercentage:e.holePercentage,backgroundColor:e.backgroundFillSymbol?.color,cssEffectFilter:this.cssEffectFilter,outline:s});r.unshift({type:"pie-chart-ramp",title:this._getRendererTitle(e,this.layer),infos:t,preview:a})}return await this._generatePreviewsForLegendElements(r,{opacity:this.layer.opacity,cssEffectFilter:this.cssEffectFilter}),r}async _getWhereClause(e,t,i){const s=await g(e,i),l=new Set,{field:r,field2:n,field3:a}=t;E(l,i,[r,n,a]),await F(l,i,null,t.valueExpression);const o=new Set(Array.from(l,e=>e.toLowerCase())),u=s?.fieldNames.map(e=>e.toLowerCase());return u?.some(e=>!o.has(e))?null:s}async _processDefinitionExpression(e,t){if(!("definitionExpression"in e))return;const i=e.definitionExpression;i&&this.respectLayerDefinitionExpression?this._layerDefinitionExpression!==i&&(this._layerDefinitionExpressionClause=await this._getWhereClause(i,t,e.fieldsIndex)):this._layerDefinitionExpressionClause=null,this._layerDefinitionExpression=i}async _processDisplayFilter(e,t){if(!("displayFilterInfo"in e))return;const i=e.displayFilterInfo?v(e.displayFilterInfo,this.view):null;return i?.where?this._layerDisplayFilter?.id!==i?.id&&(this._layerDisplayFilterClause=await this._getWhereClause(i.where,t,e.fieldsIndex)):this._layerDisplayFilterClause=null,this._layerDisplayFilter=i,i}async _constructRendererLegendElements(e,t={}){const{title:i,sublayer:s,isFeatureReductionRenderer:l}=t,r=s||this.layer,n=ie(e,"reference-size"),a=ie(e,"spike"),o=l&&"renderer"in r&&r.renderer?r.renderer:e;let u=null;Fe(o)&&(await this._processDefinitionExpression(r,o),u=await this._processDisplayFilter(r,o)),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const c=await this._getVisualVariableLegendElements(e,r)||[],d={type:"symbol-table",title:i||this._getRendererTitle(e,r),infos:[]};let y=null,h=!1;const f=new Set;if(be(e)&&!this._hasSizeRamp){const t=await se(e);d.infos.push({label:null,symbol:t})}else if(We(e)){let t=i;const s=Ge(e)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",l=c.findIndex(e=>"color-ramp"===e.type),r=-1!==l?c.splice(l,1)[0]:null,n=c.findIndex(e=>"size-ramp"===e.type),a=-1!==n?c.splice(n,1)[0]:null,o=[];r&&(t=r.title,o.push(r)),a&&(t=a.title,o.push(a)),o.length>0&&c.push({type:s,title:t,infos:o})}else if(Ce(e)){const t=J(e);c.push({type:"heatmap-ramp",title:i||this._getRendererTitle(e,r),infos:t,preview:M(t.map(e=>e.color),{cssEffectFilter:this.cssEffectFilter})})}else if(Fe(e)){const t=e.authoringInfo;if(t&&"relationship"===t.type){const{numClasses:i,field1:s,field2:l}=t,n=t.focus;if(i&&s&&l){const t=[s,l];let a=Q(n)||0;for(const e of t){const{field:t,normalizationField:i,label:s}=e,l=s||{field:this._getFieldAlias(t,r),normField:i&&this._getFieldAlias(i,r)},n=Ke.clone();n.angle=a,d.infos.push({label:l,symbol:n}),f.add(n),a+=90}const o=Z({focus:n,numClasses:i,infos:e.uniqueValueInfos??[]});c.unshift(o)}}else if(Ne(this.layer)||$e(this.layer)){const{uniqueValueInfos:t}=e;if(t)for(const e of t)e.symbol&&await this._checkClausesForUVR(o,e.value)&&d.infos.push({label:e.label||e.value,value:e.value,symbol:e.symbol})}else{const{field:t,field2:s,field3:l,fieldDelimiter:a,valueExpression:c,defaultSymbol:y}=e,f=!(!t&&!c||!s&&!l),m=u?u.title:null,p=[],{uniqueValueGroups:g}=e;if(g)for(const e of g){const i={type:"symbol-table",title:m||e.heading,infos:[]},{classes:u}=e;if(u)for(const e of u){const{symbol:u,values:d}=e;if(u){const y=[],h=[];for(const e of d??[]){const{value:i,value2:n,value3:o}=e,u=[],d=[];(t||c)&&(u.push(i),d.push(this._getDomainName(t,i,r))),s&&(u.push(n),d.push(this._getDomainName(s,n,r))),l&&(u.push(o),d.push(this._getDomainName(l,o,r))),y.push(f?u.join(a||""):u[0]),h.push(d.join(" - "))}const m=y.join(", ");let p=e.label;if(!p){const e=h.filter(Boolean);p=e.length?e.join(", "):m}let g=u;"cim"===g.type&&n&&(g=g.clone(),z(g,{innerDotSize:.5*ue,outerRingSize:ue}));let b=!1;for(const e of y)if(b=await this._checkClausesForUVR(o,e),b)break;b&&i.infos.push({label:p,value:m,symbol:g})}}i.infos.length&&p.push(i)}if(p.length){const t=p[0];if(1===p.length&&"title"in t&&!t.title){const e=t.infos?.filter(Qe)??[];d.infos.push(...e)}else y&&(p.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:y}]}),h=!0),d.infos.push(...p);i||e.legendOptions?.title||e.valueExpressionTitle||(d.title=null)}}e.defaultSymbol&&!h&&(d.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),h=!0)}else if(Ee(e)){if(!n&&!a){y=this._isUnclassedRenderer(e);if(!y||!this._hasSizeRamp){const t=e.classBreakInfos.filter(({symbol:e})=>e),i="ascending-values"===e.legendOptions?.order;for(const{label:e,minValue:s,maxValue:l,symbol:n}of t){const t=e||(y?null:`${s} - ${l}`),a={previewAriaLabel:t||d.title||r.title,label:t,value:[s,l],symbol:n};i?d.infos.push(a):d.infos.unshift(a)}y&&(d.title=null),this._updateInfosForClassedSizeRenderer(e,d.infos)}e.defaultSymbol&&!y&&(d.infos.push({label:e.defaultLabel||"others",symbol:e.defaultSymbol}),h=!0)}}else if(we(e))if($e(this.layer)||He(this.layer)){const t=await this._constructTileImageryStretchRendererElements(e);qe(t)?c.push(t):d.infos=t}else{const t=this.layer;let i,s;e.customStatistics?.length&&({min:i,max:s}=e.customStatistics[0]);let l=[],r=t.serviceRasterInfo;if(t.rasterFunction)try{r=await t.generateRasterInfo(t.rasterFunction)}catch{}const n=I(r.pixelType);if(1===r.bandCount){const l=t.bandIds?.[0]||0;i=null!=i?i:r.statistics?r.statistics[l].min:n[0],s=null!=s?s:r.statistics?r.statistics[l].max:n[1],i||s?c.push(await this._getStretchLegendElements(e,{min:i,max:s})):this._getServerSideLegend()}else if(t.bandIds&&1===t.bandIds.length)i=null!=i?i:r.statistics?r.statistics[t.bandIds[0]].min:n[0],s=null!=s?s:r.statistics?r.statistics[t.bandIds[0]].max:n[1],i||s?c.push(await this._getStretchLegendElements(e,{min:i,max:s})):this._getServerSideLegend();else if(r.bandCount>=3){const{bandInfos:e}=r,{bandIds:i}=t;e.length>=r.bandCount?3===i?.length?(l=i.map(t=>e[t].name),d.infos=this._createSymbolTableElementMultiBand(l)):"lerc"===t.format?(l=[0,1,2].map(t=>e[t].name),d.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend():"lerc"===t.format?(l=["band1","band2","band3"],d.infos=this._createSymbolTableElementMultiBand(l)):this._getServerSideLegend()}else this._getServerSideLegend()}else if(Se(e))e.colormapInfos.forEach(e=>{d.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(ge,e.color)})});else if(Le(e)){let i=e.symbol;switch(t.geometryType){case"point":i="pointSymbol"in r?r.pointSymbol:null;break;case"polyline":i="lineSymbol"in r?r.lineSymbol:null;break;case"polygon":i="polygonSymbol"in r?r.polygonSymbol:null}const s=this._clusterSizeVariable&&this._getClusterSymbol()||!this._hasSizeRamp;e.symbol&&s&&d.infos.push({previewAriaLabel:e.label||d.title||r.title,label:e.label,symbol:i})}else if(_e(e)){e.outputUnit&&(this.title="("+e.toJSON().outputUnit+")"),d.title=e.attributeField;const t=e.getClassBreakInfos();t?.length?t.forEach(e=>{d.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})}):d.infos.push({label:e.attributeField,symbol:e.getDefaultSymbol()})}else ve(e)&&c.push(await this._getStretchLegendElements(e,{min:0,max:255}));const m=e.defaultSymbol;!m||h||Le(e)||y&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||c.push({type:"symbol-table",infos:[{label:e.defaultLabel||"others",symbol:m}]}),d.infos.length&&c.unshift(d);const p=null==t.opacity?this.opacity:t.opacity,g=this._isTallSymbol("visualVariables"in e?e.visualVariables:null),b=Ne(this.layer)||$e(this.layer);return await this._generatePreviewsForLegendElements(c,{opacity:p,symbolConfig:{isTall:g,isSquareFill:b},cssEffectFilter:this.cssEffectFilter},{arrowMarkerSymbols:f}),e=null,c}async _waitForLayerViewUpdate(e){const t=new AbortController,i=m(()=>!e.updating,t.signal);await d(i,5e3,t)}async _checkFeatureCountForExpression(e,t){const i=this.layerView;if(!(i&&"createQuery"in i&&"queryFeatureCount"in i))return!0;try{await this._waitForLayerViewUpdate(i);const s=i.createQuery();e&&(s.where=le(s.where,e)),t&&(s.geometry=t);return await i.queryFeatureCount(s)>0}catch{return!0}}async _checkClausesForUVR(e,t){const i=Ze(e,t);if(!i)return!0;return(!!!(!this._layerDefinitionExpressionClause&&this._layerDefinitionExpression&&this.respectLayerDefinitionExpression||!this._layerDisplayFilterClause&&this._layerDisplayFilter?.where)||await this._checkFeatureCountForExpression(`${e.field} = ${t}`))&&(!this._layerDefinitionExpressionClause||this._layerDefinitionExpressionClause.testFeature(i))&&(!this._layerDisplayFilterClause||this._layerDisplayFilterClause.testFeature(i))}_getServerSideLegend(){setTimeout(()=>this.buildLegendElementsForTools(),0)}_getAllInfos(e){const t=e?.infos;return t?t.reduce((e,t)=>e.concat(this._getAllInfos(t)),[]):[e]}async _constructTileImageryStretchRendererElements(e){const t=this.layer,i=t.symbolizer.rasterInfo??t.raster.rasterInfo;let s,l;const r=e?.customStatistics?.length?e.customStatistics:i?.statistics;if(r)({min:s,max:l}=r[0]);else{const e=I(i.pixelType);s=e[0],l=e[1]}if(t.hasStandardTime()&&(s=t.getStandardTimeValue(s),l=t.getStandardTimeValue(l)),1===i.bandCount||1===t.bandIds?.length)return this._getStretchLegendElements(e,{min:s,max:l});const n=(t?.bandIds?.length?t.bandIds:Array.from(Array(Math.min(i.bandCount,3)).keys())).map(e=>i.bandInfos[e].name);return n.length<3?n.push(n[1]):n.length>3&&n.splice(3),this._createSymbolTableElementMultiBand(n)}async _getStretchLegendElements(e,t){const i=e.colorRamp,s=W(i,t);return{type:"stretch-ramp",title:"",infos:s,preview:M(s.map(e=>e.color))}}_getClusterSymbol(){const e=this.layer,t="featureReduction"in e&&e.featureReduction,i=t&&"symbol"in t&&t.renderer;return i&&!0!==i?.authoringInfo?.isAutoGenerated?null:t&&"symbol"in t?t.symbol:null}async _getSizeLegendElement(e,t,i,s){return{type:"size-ramp",title:this._clusterSizeVariable?this._getClusterTitle(t):e,infos:await K(i,t,await re(i),this.scale,this.view,s,this._clusterSizeVariable?this._getClusterSymbol():null)}}_createSymbolTableElementMultiBand(e){const t=[],i=["red","green","blue"];return e.forEach((e,s)=>{t.push({label:{colorName:i[s],bandName:e},src:ne[s],opacity:this.opacity??1})}),t}_updateInfosForClassedSizeRenderer(e,t){const i=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,s=e.classBreakInfos.some(e=>N(e.symbol));if(i&&s){const i=X,s=Y,l=e.classBreakInfos.length,r=(i-s)/(l>1?l-1:l);t.forEach((e,t)=>{e.size=i-r*t})}}_isTallSymbol(e){let t=!1,i=!1;if(e)for(let s=0;s<e.length&&(!t||!i);s++){const l=e[s];"size"===l.type&&("height"===l.axis&&(t=!0),"width-and-depth"===l.axis&&(i=!0))}return t&&i}async _generatePreviewsForLegendElements(e,t,i){const s=[];for(const l of e)for(const e of l.infos??[])if("infos"in e&&e.infos&&s.push(this._generatePreviewsForLegendElements([e],t,i)),Qe(e)&&e.symbol&&!e.preview){let r=!0;if("cim"===e.symbol.type){const{minScale:t,maxScale:i}=e.symbol.data;(t&&t<this.scale||i&&i>this.scale)&&(r=!1)}r&&s.push(this._generateSymbolPreviewForInfo(e,{...t,clipBloomEffect:"theme"in l&&"spike"===l.theme,cssEffectFilter:i?.arrowMarkerSymbols?.has(e.symbol)?null:t.cssEffectFilter},i?{applyScaleDrivenSize:!i.arrowMarkerSymbols?.has(e.symbol)}:void 0))}await Promise.all(s)}async _getSize(e,t){let i=null==e.size&&this._hasSizeRamp?p(22):e.size;if(this._scaleDrivenSizeVariable&&t?.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");i=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}return i}_getPreviewCIMOptions(e){return{style:"legend",cimOptions:{allowScalingUp:this._hasSizeRamp||!(!this._scaleDrivenSizeVariable||!e?.applyScaleDrivenSize),viewParams:this.isScaleDriven?{viewingMode:"2d"===this.view?.type?"map":this.view?.viewingMode,scale:this.view?.scale}:null}}}async _generateSymbolPreviewForInfo(e,t={},i){const{symbol:s}=e;try{if(t.size=await this._getSize(e,i),t.scale=!1,"cim"===s.type){const e=this._getPreviewCIMOptions(i);t={...t,...e}}e.preview=await A(s,t)}catch{e.preview=null,o.getLogger(this).warn(`Generating symbol preview failed for symbol type: ${s?.type}`)}}_getClusterRenderer(e){this._clusterSizeVariable=null;const t="renderer"in this.layer?this.layer.renderer:null,i=e.renderer?.clone()||t?.clone(),s=$(e,this.layerView,this.view);if(s&&null!=i&&"visualVariables"in i){const t=i.visualVariables?.some(e=>"size"===e.type&&"outline"!==e.target&&!fe.test(e.valueExpression));if(!t){if("clusterMinSize"in e&&"clusterMaxSize"in e){const{clusterMinSize:t,clusterMaxSize:i}=e;s.legendOptions=new x({showLegend:t!==i})}const t=i.visualVariables||[];i.visualVariables=t.concat([s]),this._clusterSizeVariable=s}}return i}async _loadRenderer(e){if(Ye.has(e))return Ye.get(e);const t=[],i=e.clone(),s=await re(i);if(Ee(i)||Fe(i)){const e=(i.classBreakInfos||i.uniqueValueInfos).map(e=>this._fetchSymbol(e.symbol,s).then(t=>{e.symbol=t}).catch(()=>{e.symbol=null}));Array.prototype.push.apply(t,e)}return t.push(this._fetchSymbol(i.symbol||i.defaultSymbol,i.defaultSymbol?null:s).then(e=>{this._applySymbolToRenderer(i,e,Le(i))}).catch(()=>{this._applySymbolToRenderer(i,null,Le(i))})),await Promise.allSettled(t),Ye.set(e,i),i}_applySymbolToRenderer(e,t,i){i?e.symbol=t:e.defaultSymbol=t}async _fetchSymbol(e,t){if(!e)throw new Error;if("web-style"===e.type){const i=this._webStyleSymbolCache;try{const s=await e.fetchSymbol({cache:i});return this._getAppliedCloneSymbol(s,t)}catch{throw o.getLogger(this).warn("Fetching web-style failed!"),new Error}}return this._getAppliedCloneSymbol(e,t)}_getAppliedCloneSymbol(e,i){if(!e||!i)return e;const s=e.clone(),l=i&&i.toRgba();return s.type.includes("3d")?this._applyColorTo3dSymbol(s,l):"cim"===s.type?O(s,i):s.color&&(s.color=new t(l||s.color)),s}_applyColorTo3dSymbol(e,i){i&&e.symbolLayers.forEach(e=>{e&&(e.material||(e.material={}),e.material.color=new t(i))})}async _getVisualVariableLegendElements(e,t){if(!("visualVariables"in e)||"vector-field"===e.type)return null;const i=e.visualVariables??[],s=[],l=[],n=[],a=ie(e,"reference-size")??ie(e,"spike");let o;const c=this._clusterSizeVariable;if(2===a?.sizeStops?.length&&(Ee(e)||Fe(e))){const[e,t]=a.sizeStops,i=c?c.minDataValue:e.value,s=c?c.maxDataValue:t.value;o=new D({field:a.field??void 0,normalizationField:a.normalizationField,minSize:u(e.size,10,100),maxSize:u(t.size,50,150),minDataValue:i,maxDataValue:s}),l.push(o)}for(const r of i)if("color"===r.type)s.push(r);else if("size"===r.type){if("cluster_count"===r.field&&o)continue;l.push(r)}else"opacity"===r.type&&n.push(r);const d=[...s,...l,...n];let y,h;if(0===s.length&&Ee(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];y=t&&t.symbol}if(0===s.length&&Le(e)&&(y=e.symbol),y)if(y.type.includes("3d")){const e=y.symbolLayers.at(0);"water"===e.type?null!=e.color&&(h=e.color):null!=e.material?.color&&(h=e.material.color)}else y.url||(h=y.color);const f=this.cssEffectFilter;return(await Promise.all(d.map(async i=>{if(!i.legendOptions||!1!==i.legendOptions.showLegend){const s=be(e)?i.field:this._getRampTitle(i,t);let l=null;const r=ae(t,i,this.view.timeZone);if("color"===i.type){const e=await G(i,null,r)??[];l={type:"color-ramp",title:s,infos:e,preview:M(e.map(e=>e.color),{cssEffectFilter:f})},this._hasColorRamp||(this._hasColorRamp=e.length>0)}else if("size"===i.type&&"outline"!==i.target)fe.test(i.valueExpression)?this._clusterSizeVariable||(this._scaleDrivenSizeVariable=i):(l=await this._getSizeLegendElement(s,i,e,r),o===i&&"spike"===a?.theme&&(l.theme=a.theme),this._hasSizeRamp||(this._hasSizeRamp=!(null==l.infos||!l.infos.length)));else if("opacity"===i.type){const e=await G(i,h,r)??[];l={type:"opacity-ramp",title:s,infos:e,preview:M(e.map(e=>e.color),{cssEffectFilter:f})},this._hasOpacityRamp||(this._hasOpacityRamp=e.length>0)}return l?.infos?l:null}}))).filter(r)}_getDomainName(e,t,i){if(e&&"function"!=typeof e){const s="getField"in i&&i.getField?.(e),l=s&&"getFieldDomain"in i&&i.getFieldDomain?i.getFieldDomain(s.name,{excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")}):null;return"coded-value"===l?.type?l.getName(t):null}return null}_getClusterTitle(e){const t=this.layer,i=e.field;if("featureReduction"in t&&t.featureReduction&&"cluster"===t.featureReduction.type){const e=t.featureReduction,s="popupTemplate"in e&&e.popupTemplate,l=s&&s.fieldInfos;if(l)for(const t of l)if(t.fieldName===i)return"cluster_count"===i?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let i=e.field,s=e.normalizationField,l=!1,r=!1,n=!1,a=null;i="function"==typeof i?null:i,s="function"==typeof s?null:s;const o=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?.visualVariables){const e=t.renderer.authoringInfo.visualVariables;for(let t=0;t<e.length;t++){const i=e[t];if("color"===i.type){if("ratio"===i.style){l=!0;break}if("percent"===i.style){r=!0;break}if("percent-of-total"===i.style){n=!0;break}}}}a={field:i&&this._getFieldAlias(i,t),normField:s&&this._getFieldAlias(s,t),ratio:l,ratioPercent:r,ratioPercentTotal:n}}return a}_getRendererTitle(e,t){const i=e;if(i.legendOptions?.title)return i.legendOptions.title;if(i.valueExpressionTitle)return i.valueExpressionTitle;let s=i.field,l=null,r=null;if(Ee(i)&&(l=i.normalizationField,r="percent-of-total"===i.normalizationType),s="function"==typeof s?null:s,l="function"==typeof l?null:l,Fe(i)){const{field2:e,field3:l,fieldDelimiter:r}=i;let n=s&&this._getFieldAlias(s,t);return e&&(n=`<${n}>${r}<${this._getFieldAlias(e,t)}>`,l&&(n=`${n}${r}<${this._getFieldAlias(l,t)}>`)),n}let n=null;return(s||l)&&(n={field:s&&this._getFieldAlias(s,t),normField:l&&this._getFieldAlias(l,t),normByPct:r}),n}_getFieldAlias(e,t){const i="popupTemplate"in t?t.popupTemplate:null,s=i?.fieldInfos;let l=s?.find(t=>e===t.fieldName),r=null;"getField"in t&&t.getField?r=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(r=t.fieldsIndex.get(e));let n=null;const a="featureReduction"in t&&t.featureReduction;a&&(l??="popupTemplate"in a?a.popupTemplate?.fieldInfos?.find(t=>e?.toLowerCase()===t.fieldName?.toLowerCase()):void 0,"fields"in a&&a.fields&&(n=a.fields.find(t=>t.name?.toLowerCase()===e?.toLowerCase())));const o=l||r||n;let u=null;return o&&(u=l?.label||r?.alias||n?.alias||"name"in o&&o.name||"fieldName"in o&&o.fieldName||null),u}_isUnclassedRenderer(e){const t=e.visualVariables;let i=!1;return Ee(e)&&e.classBreakInfos&&1===e.classBreakInfos.length&&t&&(i=e.field?t.some(t=>!(!t||e.field!==t.field||(e.normalizationField||t.normalizationField)&&e.normalizationField!==t.normalizationField)):!!t.length),i}};e([_()],et.prototype,"_loading",void 0),e([_()],et.prototype,"children",void 0),e([_({readOnly:!0})],et.prototype,"cssEffectFilter",null),e([_()],et.prototype,"layerView",void 0),e([_()],et.prototype,"layer",void 0),e([_()],et.prototype,"legendElements",void 0),e([_({readOnly:!0})],et.prototype,"loading",null),e([_({readOnly:!0})],et.prototype,"opacity",null),e([_()],et.prototype,"parent",void 0),e([_({readOnly:!0,dependsOn:[]})],et.prototype,"ready",null),e([_()],et.prototype,"hideLayersNotInCurrentView",void 0),e([_()],et.prototype,"keepCacheOnDestroy",void 0),e([_()],et.prototype,"respectLayerDefinitionExpression",void 0),e([_()],et.prototype,"respectLayerVisibility",void 0),e([_({readOnly:!0})],et.prototype,"scale",null),e([_()],et.prototype,"sublayerIds",void 0),e([_({readOnly:!0})],et.prototype,"isScaleDriven",null),e([_()],et.prototype,"title",void 0),e([_({readOnly:!0,dependsOn:["ready"],value:0})],et.prototype,"version",null),e([_()],et.prototype,"view",void 0),et=e([S("esri.widgets.Legend.support.ActiveLayerInfo")],et);export{et 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import
|
|
5
|
+
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import i from"../core/Logger.js";import{on as s,watch as r,initial as o}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{cast as l}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import p from"./Legend/LegendViewModel.js";import y from"./Legend/styles/card/CardView.js";import c from"./Legend/styles/classic/ClassicView.js";import{globalCss as h}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as v}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";const L={base:"esri-legend"};let u=class extends d{constructor(e,s){super(e,s),this.headingLevel=3,this.messages=null,this.viewModel=new p,this.style=new c,t(i.getLogger(this),"Legend","arcgis-legend",{version:"4.34"})}initialize(){this.addHandles([s(()=>this.view,"resize",()=>this.scheduleRender()),s(()=>this.activeLayerInfos,"change",()=>this._refreshActiveLayerInfos(this.activeLayerInfos)),r(()=>this.headingLevel,e=>{const{style:t}=this;t&&(t.headingLevel=e)}),r(()=>this.style,(e,t)=>{t&&e!==t&&t.destroy(),e&&(e.activeLayerInfos=this.activeLayerInfos,"card"===e.type&&(e.view=this.view),e.headingLevel=this.headingLevel)},o)])}destroy(){this.style?.destroy()}get activeLayerInfos(){return this.viewModel.activeLayerInfos}set activeLayerInfos(e){this.viewModel.activeLayerInfos=e}get basemapLegendVisible(){return this.viewModel.basemapLegendVisible}set basemapLegendVisible(e){this.viewModel.basemapLegendVisible=e}get groundLegendVisible(){return this.viewModel.groundLegendVisible}set groundLegendVisible(e){this.viewModel.groundLegendVisible=e}get hideLayersNotInCurrentView(){return this.viewModel.hideLayersNotInCurrentView}set hideLayersNotInCurrentView(e){this.viewModel.hideLayersNotInCurrentView=e}get respectLayerViewVisibility(){return this.viewModel.respectLayerViewVisibility}set respectLayerViewVisibility(e){this.viewModel.respectLayerViewVisibility=e}get keepCacheOnDestroy(){return this.viewModel.keepCacheOnDestroy}set keepCacheOnDestroy(e){this.viewModel.keepCacheOnDestroy=e}get respectLayerDefinitionExpression(){return this.viewModel.respectLayerDefinitionExpression}set respectLayerDefinitionExpression(e){this.viewModel.respectLayerDefinitionExpression=e}get respectLayerVisibility(){return this.viewModel.respectLayerVisibility}set respectLayerVisibility(e){this.viewModel.respectLayerVisibility=e}get icon(){return"legend"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}set style(e){const t=this._get("style");e!==t&&t?.destroy(),this._set("style",e)}castStyle(e){if(e instanceof y||e instanceof c)return e;if("string"==typeof e)return"card"===e?new y:new c;if(e&&"string"==typeof e.type){const t={...e};return delete t.type,"card"===e.type?new y(t):new c(t)}return new c}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){return v("div",{class:this.classes(L.base,h.widget,this.style instanceof c?h.panel:null)},this.style.render())}_refreshActiveLayerInfos(e){e.forEach(e=>{this.removeHandles(`version_${e.layer.uid}`),this._renderOnActiveLayerInfoChange(e)}),this.scheduleRender()}_renderOnActiveLayerInfoChange(e){const t=r(()=>e.version,()=>this.scheduleRender());this.addHandles(t,`version_${e.layer.uid}`);const i=s(()=>e.children,"change",()=>e.children.forEach(e=>this._renderOnActiveLayerInfoChange(e)),o);this.addHandles(i,`version_${e.layer.uid}`),e.children.forEach(e=>this._renderOnActiveLayerInfoChange(e))}};e([n()],u.prototype,"activeLayerInfos",null),e([n()],u.prototype,"basemapLegendVisible",null),e([n()],u.prototype,"groundLegendVisible",null),e([n()],u.prototype,"headingLevel",void 0),e([n()],u.prototype,"hideLayersNotInCurrentView",null),e([n()],u.prototype,"respectLayerViewVisibility",null),e([n()],u.prototype,"keepCacheOnDestroy",null),e([n()],u.prototype,"respectLayerDefinitionExpression",null),e([n()],u.prototype,"respectLayerVisibility",null),e([n()],u.prototype,"icon",null),e([n()],u.prototype,"label",null),e([n()],u.prototype,"layerInfos",null),e([n(),g("esri/widgets/Legend/t9n/Legend")],u.prototype,"messages",void 0),e([n()],u.prototype,"style",null),e([l("style")],u.prototype,"castStyle",null),e([n()],u.prototype,"view",null),e([n()],u.prototype,"viewModel",void 0),u=e([a("esri.widgets.Legend")],u);const f=u;export{f as default};
|