@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{getAssetUrl as t}from"../../assets.js";import r from"../../Graphic.js";import s from"../../PopupTemplate.js";import{isSome as o}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import l from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import n from"../../core/Logger.js";import{mappedFind as u}from"../../core/maybe.js";import{eachAlways as c,after as h}from"../../core/promiseUtils.js";import{watch as p,initial as g,whenOnce as d}from"../../core/reactiveUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import f from"../../geometry/Point.js";import S from"../../geometry/SpatialReference.js";import{getPointFromGeometry as _,getPointWithElevation as v}from"../../geometry/support/geometryUtils.js";import w from"../../portal/Portal.js";import{isApiKeyApplicable as b}from"../../support/apiKeyUtils.js";import x from"../../symbols/PictureMarkerSymbol.js";import L from"../../symbols/SimpleFillSymbol.js";import I from"../../symbols/SimpleLineSymbol.js";import T from"../../symbols/TextSymbol.js";import{highlightsSupported as R}from"../../views/support/layerViewUtils.js";import E from"./LayerSearchSource.js";import F from"./LocatorSearchSource.js";import P from"./SearchSource.js";import{isArcGISWorldGeocoder as j,meteredArcGISLocatorUrl as C,isProxiedArcGISWorldGeocoder as G,isMeteredArcGISWorldGeocoder as O}from"./support/locatorUtils.js";import{supported as A,getCurrentPosition as N,positionToPoint as D}from"../support/geolocationUtils.js";import{GoTo as M}from"../support/GoTo.js";function V(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const J="highlight",U=i.ofType({key:e=>e.layer?"layer":"locator",base:P,typeMap:{layer:E,locator:F}}),k=S.WGS84,H="esri/images/search/search-symbol-32.png",B=/<[\s\S]*?>/g,Q=-1;let Z=class extends(M(a)){constructor(e){super(e),this._defaultPopupTemplate=new s({content:"{Match_addr}"}),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultSources=new U,this.defaultSymbols={point:new x({url:t(H),size:24,width:24,height:24}),polyline:new I({color:[130,130,130,1],width:2}),polygon:new L({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=w.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new U,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){this.addHandles([p(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),g),p(()=>this.messages,()=>{this._defaultPopupTemplate.title=this.messages?.searchResult??"",this._update()},g)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=Q}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:Q}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new U;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get defaultPopupTemplate(){return this._defaultPopupTemplate}set defaultPopupTemplate(e){this._overrideIfSome("defaultPopupTemplate",e)}get locationEnabled(){return this._get("locationEnabled")||A()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=A();if(e&&!t){const e=new l("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});n.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===Q)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=(async()=>{try{await this.when();const e=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(s,e,r);const o=this._getFirstResult(s.results),i=r.location&&o?o.name:r.text,l=i?.replaceAll(B,"");return this._set("searchTerm",l),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",s.results),this._set("resultCount",s.results.reduce((e,t)=>e+(t.results?.length??0),0)),this.emit("search-complete",s),await this._selectFirstResult(o),s}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new l("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw n.getLogger(this).error(e),e}const t=(async()=>{try{const t=await N(),r=await D({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new l("select:missing-parameter","Cannot select without a searchResult.",{value:e});throw n.getLogger(this).error(t),t}const{view:t}=this,s=V(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=s?this.allSources.at(s):null;if(!o){const e=new l("select:missing-source","Cannot select without a source.",{source:o});throw n.getLogger(this).error(e),e}const i=o instanceof E?this._getLayerSourcePopupTemplate(o):o.popupTemplate,a=o.resultSymbol||this._getDefaultSymbol(e),u=V(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,h=V(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,p=V(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,g=p?i||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new l("select:missing-feature","Cannot select without a feature.",{feature:d});throw n.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:S}=d,w=y?_(y):null,b={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=w?v(w,t):Promise.resolve(w)},x=await c(b),L=x.layerViewQuery.value,I=x.elevationQuery.value;a instanceof T&&(a.text=e.name);const F=t&&h?e.target||e.extent:null,P=null!=F?this._goToSearchResult(F):Promise.resolve();await P;const j=L?d:new r({geometry:y,symbol:a,attributes:m,layer:f,sourceLayer:S,popupTemplate:g}),C=t?.popup,G=C&&p&&j.getEffectivePopupTemplate(C.defaultPopupTemplateEnabled);return G&&await t.openPopup({features:[j],location:I}),L&&R(L)&&!G&&this._highlightFeature({graphic:j,layerView:L}),!L&&u&&t&&t.graphics.push(j),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",j),this.emit("select-result",{result:e,source:o,sourceIndex:s}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce((e,t)=>e+(t.results?.length??0),0)??null),this.emit("suggest-complete",o),o}async when(e,t){await d(()=>!this.updating)}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=c([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map(e=>{if(!1===e.placefinding)return;const t=j(e.url)&&b(e.url)?{url:C}:null,r=F.fromJSON({...e,...t}),s=r.url;if(j(s)||G(s)||O(s)){const e=r.outFields??["Addr_type","Match_addr","StAddr","City"],t=(r.placeholder||this.messages?.placeholder)??"",s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.singleLineFieldName="SingleLine",r.outFields=e,r.placeholder=t,r.defaultZoomScale=s}return r.singleLineFieldName?r:void 0}).filter(o)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e?.destroy()),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map(e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=E.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map(e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=E.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find(e=>e.id===t.subLayer);if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find(e=>e.id===t.subLayer);if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type)return e;if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new l("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return n.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):null}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){const e=this.view?.popup,{resultGraphic:t}=this;if(!e||!t)return;const r="selectedFeature"in e,s=r?e.selectedFeature:null;r&&(s&&s===t)&&e.close()}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return h(r,null,t?.signal)}_createLocationForSearch(e){return e instanceof r&&e.geometry?_(e.geometry):e instanceof f?e:Array.isArray(e)&&2===e.length?new f({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&V(e,"key")&&V(e,"text")&&V(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return u(e,({results:e})=>e?.[0])??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),n.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===Q){const s=r&&V(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)})}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&V(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new l("search:no-sources-defined","At least one source is required.",{allSources:r});throw n.getLogger(this).error(e),e}return s===Q?r.forEach((r,s)=>{o.push(this._getResultsFromSource(e,s,t))}):o.push(this._getResultsFromSource(e,s,t)),c(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new l("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw n.getLogger(this).error(e),e}return s===Q?r.forEach((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))}):o.push(this._getSuggestionsFromSource(e,s,t)),c(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference??k,l=V(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof E&&V(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({exactMatch:a,location:o,maxResults:l,sourceIndex:t,spatialReference:i,suggestResult:e,view:n},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=V(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=V(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||k,i=V(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof E&&V(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return V(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return u(this.results??[],({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null})??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(J)}async _getLayerView(e){const{view:t}=this;if(!e||!t)return null;const{layer:r,sourceLayer:s}=e,o=r??s;return o&&"building-component"!==o.type&&"subtype-sublayer"!==o.type?(await t.when(),t.whenLayerView(o)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o,sourceLayer:i}=t,l=o??i,{objectIdField:a}=l,n=(a&&s?.[a])??null,u=r.highlight(n??t);this.addHandles(u,J)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([m()],Z.prototype,"_searching",void 0),e([m()],Z.prototype,"_updatingPromise",void 0),e([m({readOnly:!0,value:null})],Z.prototype,"activeSource",null),e([m()],Z.prototype,"activeSourceIndex",null),e([m()],Z.prototype,"allPlaceholder",null),e([m({readOnly:!0})],Z.prototype,"allSources",null),e([m()],Z.prototype,"autoNavigate",void 0),e([m()],Z.prototype,"autoSelect",void 0),e([m({type:s})],Z.prototype,"defaultPopupTemplate",null),e([m({readOnly:!0})],Z.prototype,"defaultSources",void 0),e([m()],Z.prototype,"defaultSymbols",void 0),e([m()],Z.prototype,"includeDefaultSources",void 0),e([m()],Z.prototype,"locationEnabled",null),e([m()],Z.prototype,"maxInputLength",void 0),e([m()],Z.prototype,"maxResults",void 0),e([m()],Z.prototype,"maxSuggestions",void 0),e([m()],Z.prototype,"messages",void 0),e([m()],Z.prototype,"minSuggestCharacters",void 0),e([m({readOnly:!0})],Z.prototype,"placeholder",null),e([m()],Z.prototype,"popupEnabled",void 0),e([m({type:s})],Z.prototype,"popupTemplate",void 0),e([m({type:w})],Z.prototype,"portal",void 0),e([m()],Z.prototype,"resultCount",void 0),e([m()],Z.prototype,"resultGraphicEnabled",void 0),e([m({readOnly:!0})],Z.prototype,"resultGraphic",void 0),e([m({readOnly:!0})],Z.prototype,"results",void 0),e([m({readOnly:!0})],Z.prototype,"selectedSuggestion",void 0),e([m()],Z.prototype,"searchAllEnabled",void 0),e([m({readOnly:!0})],Z.prototype,"selectedResult",void 0),e([m()],Z.prototype,"searchTerm",null),e([m({type:U})],Z.prototype,"sources",void 0),e([m({readOnly:!0})],Z.prototype,"state",null),e([m()],Z.prototype,"suggestionDelay",void 0),e([m()],Z.prototype,"suggestionCount",void 0),e([m({readOnly:!0})],Z.prototype,"suggestions",void 0),e([m()],Z.prototype,"suggestionsEnabled",void 0),e([m({readOnly:!0})],Z.prototype,"updating",null),e([m()],Z.prototype,"view",void 0),e([m()],Z.prototype,"clear",null),Z=e([y("esri.widgets.Search.SearchViewModel")],Z);const q=Z;export{q as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../../assets.js";import r from"../../Graphic.js";import s from"../../PopupTemplate.js";import{isSome as o}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import l from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import n from"../../core/Logger.js";import{mappedFind as u}from"../../core/maybe.js";import{eachAlways as c,after as h}from"../../core/promiseUtils.js";import{watch as p,initial as g,whenOnce as d}from"../../core/reactiveUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import f from"../../geometry/Point.js";import S from"../../geometry/SpatialReference.js";import{getPointFromGeometry as _,getPointWithElevation as v}from"../../geometry/support/geometryUtils.js";import w from"../../portal/Portal.js";import{isApiKeyApplicable as b}from"../../support/apiKeyUtils.js";import x from"../../symbols/PictureMarkerSymbol.js";import L from"../../symbols/SimpleFillSymbol.js";import I from"../../symbols/SimpleLineSymbol.js";import T from"../../symbols/TextSymbol.js";import{popupFromView as E,closePopup as R}from"../../views/popupAdapter.js";import{highlightsSupported as F}from"../../views/support/layerViewUtils.js";import P from"./LayerSearchSource.js";import j from"./LocatorSearchSource.js";import C from"./SearchSource.js";import{isArcGISWorldGeocoder as G,meteredArcGISLocatorUrl as O,isProxiedArcGISWorldGeocoder as A,isMeteredArcGISWorldGeocoder as N}from"./support/locatorUtils.js";import{supported as D,getCurrentPosition as M,positionToPoint as V}from"../support/geolocationUtils.js";import{GoTo as J}from"../support/GoTo.js";function U(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const k="highlight",H=i.ofType({key:e=>e.layer?"layer":"locator",base:C,typeMap:{layer:P,locator:j}}),B=S.WGS84,Q="esri/images/search/search-symbol-32.png",Z=/<[\s\S]*?>/g,q=-1;let z=class extends(J(a)){constructor(e){super(e),this._defaultPopupTemplate=new s({content:"{Match_addr}"}),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultSources=new H,this.defaultSymbols={point:new x({url:t(Q),size:24,width:24,height:24}),polyline:new I({color:[130,130,130,1],width:2}),polygon:new L({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=w.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new H,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){this.addHandles([p(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),g),p(()=>this.messages,()=>{this._defaultPopupTemplate.title=this.messages?.searchResult??"",this._update()},g)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=q}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:q}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new H;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get defaultPopupTemplate(){return this._defaultPopupTemplate}set defaultPopupTemplate(e){this._overrideIfSome("defaultPopupTemplate",e)}get locationEnabled(){return this._get("locationEnabled")||D()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=D();if(e&&!t){const e=new l("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});n.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===q)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=(async()=>{try{await this.when();const e=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(s,e,r);const o=this._getFirstResult(s.results),i=r.location&&o?o.name:r.text,l=i?.replaceAll(Z,"");return this._set("searchTerm",l),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",s.results),this._set("resultCount",s.results.reduce((e,t)=>e+(t.results?.length??0),0)),this.emit("search-complete",s),await this._selectFirstResult(o),s}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new l("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw n.getLogger(this).error(e),e}const t=(async()=>{try{const t=await M(),r=await V({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new l("select:missing-parameter","Cannot select without a searchResult.",{value:e});throw n.getLogger(this).error(t),t}const{view:t}=this,s=U(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=s?this.allSources.at(s):null;if(!o){const e=new l("select:missing-source","Cannot select without a source.",{source:o});throw n.getLogger(this).error(e),e}const i=o instanceof P?this._getLayerSourcePopupTemplate(o):o.popupTemplate,a=o.resultSymbol||this._getDefaultSymbol(e),u=U(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,h=U(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,p=U(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,g=p?i||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new l("select:missing-feature","Cannot select without a feature.",{feature:d});throw n.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:S}=d,w=y?_(y):null,b={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=w?v(w,t):Promise.resolve(w)},x=await c(b),L=x.layerViewQuery.value,I=x.elevationQuery.value;a instanceof T&&(a.text=e.name);const R=t&&h?e.target||e.extent:null,j=null!=R?this._goToSearchResult(R):Promise.resolve();await j;const C=L?d:new r({geometry:y,symbol:a,attributes:m,layer:f,sourceLayer:S,popupTemplate:g}),G=E(t),O=G&&p&&C.getEffectivePopupTemplate(G.defaultPopupTemplateEnabled);return O&&await(t?.openPopup({features:[C],location:I})),L&&F(L)&&!O&&this._highlightFeature({graphic:C,layerView:L}),!L&&u&&t&&t.graphics.push(C),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",C),this.emit("select-result",{result:e,source:o,sourceIndex:s}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce((e,t)=>e+(t.results?.length??0),0)??null),this.emit("suggest-complete",o),o}async when(e,t){await d(()=>!this.updating)}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=c([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map(e=>{if(!1===e.placefinding)return;const t=G(e.url)&&b(e.url)?{url:O}:null,r=j.fromJSON({...e,...t}),s=r.url;if(G(s)||A(s)||N(s)){const e=r.outFields??["Addr_type","Match_addr","StAddr","City"],t=(r.placeholder||this.messages?.placeholder)??"",s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.singleLineFieldName="SingleLine",r.outFields=e,r.placeholder=t,r.defaultZoomScale=s}return r.singleLineFieldName?r:void 0}).filter(o)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e?.destroy()),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map(e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map(e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find(e=>e.id===t.subLayer);if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find(e=>e.id===t.subLayer);if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type)return e;if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new l("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return n.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):null}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){const e=E(this.view),{resultGraphic:t}=this;if(!e||!t)return;const r="selectedFeature"in e,s=r?e.selectedFeature:null;r&&(s&&s===t)&&R(this.view?.popup,this.view?.popupElement)}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return h(r,null,t?.signal)}_createLocationForSearch(e){return e instanceof r&&e.geometry?_(e.geometry):e instanceof f?e:Array.isArray(e)&&2===e.length?new f({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&U(e,"key")&&U(e,"text")&&U(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return u(e,({results:e})=>e?.[0])??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),n.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===q){const s=r&&U(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)})}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&U(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new l("search:no-sources-defined","At least one source is required.",{allSources:r});throw n.getLogger(this).error(e),e}return s===q?r.forEach((r,s)=>{o.push(this._getResultsFromSource(e,s,t))}):o.push(this._getResultsFromSource(e,s,t)),c(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new l("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw n.getLogger(this).error(e),e}return s===q?r.forEach((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))}):o.push(this._getSuggestionsFromSource(e,s,t)),c(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference??B,l=U(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({exactMatch:a,location:o,maxResults:l,sourceIndex:t,spatialReference:i,suggestResult:e,view:n},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=U(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=U(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||B,i=U(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return U(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return u(this.results??[],({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null})??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(k)}async _getLayerView(e){const{view:t}=this;if(!e||!t)return null;const{layer:r,sourceLayer:s}=e,o=r??s;return o&&"building-component"!==o.type&&"subtype-sublayer"!==o.type?(await t.when(),t.whenLayerView(o)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o,sourceLayer:i}=t,l=o??i,{objectIdField:a}=l,n=(a&&s?.[a])??null,u=r.highlight(n??t);this.addHandles(u,k)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([m()],z.prototype,"_searching",void 0),e([m()],z.prototype,"_updatingPromise",void 0),e([m({readOnly:!0,value:null})],z.prototype,"activeSource",null),e([m()],z.prototype,"activeSourceIndex",null),e([m()],z.prototype,"allPlaceholder",null),e([m({readOnly:!0})],z.prototype,"allSources",null),e([m()],z.prototype,"autoNavigate",void 0),e([m()],z.prototype,"autoSelect",void 0),e([m({type:s})],z.prototype,"defaultPopupTemplate",null),e([m({readOnly:!0})],z.prototype,"defaultSources",void 0),e([m()],z.prototype,"defaultSymbols",void 0),e([m()],z.prototype,"includeDefaultSources",void 0),e([m()],z.prototype,"locationEnabled",null),e([m()],z.prototype,"maxInputLength",void 0),e([m()],z.prototype,"maxResults",void 0),e([m()],z.prototype,"maxSuggestions",void 0),e([m()],z.prototype,"messages",void 0),e([m()],z.prototype,"minSuggestCharacters",void 0),e([m({readOnly:!0})],z.prototype,"placeholder",null),e([m()],z.prototype,"popupEnabled",void 0),e([m({type:s})],z.prototype,"popupTemplate",void 0),e([m({type:w})],z.prototype,"portal",void 0),e([m()],z.prototype,"resultCount",void 0),e([m()],z.prototype,"resultGraphicEnabled",void 0),e([m({readOnly:!0})],z.prototype,"resultGraphic",void 0),e([m({readOnly:!0})],z.prototype,"results",void 0),e([m({readOnly:!0})],z.prototype,"selectedSuggestion",void 0),e([m()],z.prototype,"searchAllEnabled",void 0),e([m({readOnly:!0})],z.prototype,"selectedResult",void 0),e([m()],z.prototype,"searchTerm",null),e([m({type:H})],z.prototype,"sources",void 0),e([m({readOnly:!0})],z.prototype,"state",null),e([m()],z.prototype,"suggestionDelay",void 0),e([m()],z.prototype,"suggestionCount",void 0),e([m({readOnly:!0})],z.prototype,"suggestions",void 0),e([m()],z.prototype,"suggestionsEnabled",void 0),e([m({readOnly:!0})],z.prototype,"updating",null),e([m()],z.prototype,"view",void 0),e([m()],z.prototype,"clear",null),z=e([y("esri.widgets.Search.SearchViewModel")],z);const K=z;export{K as default};
|
package/widgets/Search.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"../intl.js";import{deprecateWidget as t,deprecatedPropertyValue as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as r,abortMaybe as i}from"../core/maybe.js";import{ignoreAbortErrors as l,isAbortError as n}from"../core/promiseUtils.js";import{watch as a,initial as c}from"../core/reactiveUtils.js";import{waitAnimationFrame as u}from"../core/scheduling.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import p from"./Widget.js";import{css as g}from"./Search/css.js";import m from"./Search/SearchResultRenderer.js";import v from"./Search/SearchViewModel.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as S}from"./support/decorators/messageBundle.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as b}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";import{substitute as y}from"../intl/substitute.js";let C=class extends p{constructor(e,s){super(e,s),this._currentLocationValue=`${this.id}-search-use-current-location`,this._autocompleteNode=null,this._focusAbortController=null,this._searchResultRenderer=new m,this._suggestController=null,this._searchController=null,this._lastSearchTerm="",this._locateFailed=!1,this._showNoResults=!1,this.disabled=!1,this.messages=null,this.messagesCommon=null,this.viewModel=new v,this._renderSearchResultsContent=()=>this._searchResultRenderer,t(o.getLogger(this),"Search","arcgis-search",{version:"4.33"}),this.addHandles([a(()=>this.viewModel,e=>this._searchResultRenderer.viewModel=e,c),a(()=>this.viewModel.results,()=>this._searchResultRenderer.showMoreResultsOpen=!1),a(()=>this.messages,e=>this.viewModel.messages=e),a(()=>this.viewModel?.defaultPopupTemplate,e=>{e&&(e.content=this._renderSearchResultsContent)},c)])}loadDependencies(){return _({autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item-group":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item-group"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}destroy(){this._cancelQueries(),this._searchResultRenderer=r(this._searchResultRenderer),this._focusAbortController?.abort()}get _isDisabled(){const{state:e}=this.viewModel;return"disabled"===e||"loading"===e||this.disabled}get _showCurrentLocation(){return this.locationEnabled&&!this.searchTerm?.trim()}get _effectiveActiveMenu(){const{activeMenu:e}=this;return this._isDisabled?"none":"warning"===e?"suggestion":e}get activeMenu(){return"none"}set activeMenu(e){"warning"===e&&s(o.getLogger(this),"activeMenu","warning",{replacement:"Use the value 'suggestion' instead",version:"4.32",warnOnce:!0}),this._overrideIfSome("activeMenu",e)}get activeSource(){return this.viewModel?.activeSource}get activeSourceIndex(){return this.viewModel.activeSourceIndex}set activeSourceIndex(e){this.viewModel.activeSourceIndex=e}get allPlaceholder(){return this.viewModel.allPlaceholder}set allPlaceholder(e){this.viewModel.allPlaceholder=e}get allSources(){return this.viewModel.allSources}get autoNavigate(){return this.viewModel.autoNavigate}set autoNavigate(e){this.viewModel.autoNavigate=e}get autoSelect(){return this.viewModel.autoSelect}set autoSelect(e){this.viewModel.autoSelect=e}get defaultSources(){return this.viewModel.defaultSources}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"search"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultSources(){return this.viewModel.includeDefaultSources}set includeDefaultSources(e){this.viewModel.includeDefaultSources=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get locationEnabled(){return this.viewModel.locationEnabled}set locationEnabled(e){this.viewModel.locationEnabled=e}get maxResults(){return this.viewModel.maxResults}set maxResults(e){this.viewModel.maxResults=e}get maxSuggestions(){return this.viewModel.maxSuggestions}set maxSuggestions(e){this.viewModel.maxSuggestions=e}get minSuggestCharacters(){return this.viewModel.minSuggestCharacters}set minSuggestCharacters(e){this.viewModel.minSuggestCharacters=e}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get portal(){return this.viewModel?.portal}set portal(e){this.viewModel&&(this.viewModel.portal=e)}get resultGraphic(){return this.viewModel.resultGraphic}set resultGraphic(e){this.viewModel.resultGraphic=e}get resultGraphicEnabled(){return this.viewModel.resultGraphicEnabled}set resultGraphicEnabled(e){this.viewModel.resultGraphicEnabled=e}get results(){return this.viewModel.results}get searchAllEnabled(){return this.viewModel.searchAllEnabled}set searchAllEnabled(e){this.viewModel.searchAllEnabled=e}get searchTerm(){return this.viewModel.searchTerm}set searchTerm(e){this.viewModel.searchTerm=e}get selectedResult(){return this.viewModel.selectedResult}get sources(){return this.viewModel.sources}set sources(e){this.viewModel.sources=e}get suggestions(){return this.viewModel.suggestions}get suggestionsEnabled(){return this.viewModel.suggestionsEnabled}set suggestionsEnabled(e){this.viewModel.suggestionsEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clear(){this._locateFailed=!1,this.viewModel.clear()}focus(){this._handleFocus(),this._emitFocus()}blur(){this._autocompleteNode?.blur(),this._emitBlur()}async search(e){this._cancelQueries();const t=new AbortController,{signal:s}=t;this._searchController=t;try{const o=await this.viewModel.search(e,{signal:s});if(this._searchController!==t)return;return o?.numResults||(this._showNoResults=!0,this.activeMenu="suggestion"),this._searchController=null,o}catch(o){if(this._searchController!==t)return;return void(this._searchController=null)}}async suggest(e){this._cancelSuggest();const t=new AbortController,{signal:s}=t;this._suggestController=t;try{const o=await this.viewModel.suggest(e,null,{signal:s});if(this._suggestController!==t)return;return this._suggestController=null,o?.numResults&&(this.activeMenu="suggestion",this._scrollToTopSuggestion()),o}catch(o){return this._suggestController!==t||(this._suggestController=null),null}}render(){return b("div",{class:this.classes(g.base,w.widget)},b("div",{class:g.container},this._renderSourcesMenu(),this._renderForm()))}_handleInputKeydown(e){"Tab"===e.key&&this._cancelSuggest()}_emitFocus(){this.emit("search-focus")}_emitBlur(){this.emit("search-blur")}async _handleFocus(){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const e=this._focusAbortController.signal;await l(u(e)),this._autocompleteNode?.setFocus()}_renderSourcesMenu(){const{messages:e,_isDisabled:t,_effectiveActiveMenu:s}=this,{allSources:o,searchAllEnabled:r}=this.viewModel;return o.length>1?b("calcite-dropdown",{bind:this,class:g.dropdown,disabled:t,open:"source"===s,overlayPositioning:"fixed",onCalciteDropdownClose:this._handleSourceClose,onCalciteDropdownOpen:this._handleSourceOpen,onCalciteDropdownSelect:this._handleSourceSelect},b("calcite-button",{appearance:"outline-fill",iconStart:"caret-down",kind:"neutral",label:e.searchIn,slot:"trigger"}),b("calcite-dropdown-group",{groupTitle:e.searchIn},r?this._renderSource(v.ALL_INDEX):null,o.map((e,t)=>this._renderSource(t)).toArray())):null}_renderUseCurrentLocation(){const{_currentLocationValue:e}=this;return b("calcite-autocomplete-item",{heading:this.messages.useCurrentLocation,iconStart:"gps-on",key:e,value:e})}_handleAutocompleteCreate(e){this._autocompleteNode=e}_handleCalciteAutocompleteTextInput(e){const t=e.target.inputValue;t!==this.viewModel.searchTerm&&(this.viewModel.searchTerm=t,t||this.clear(),this.suggest())}_handleAutocompleteOpen(){this.activeMenu="suggestion"}_handleAutocompleteClose(){"suggestion"===this.activeMenu&&(this.activeMenu="none")}_handleCalciteAutocompleteChange(e){const t=e.target.value;if(t===this._currentLocationValue)return void this._useCurrentLocation();const s=JSON.parse(t),o=this.viewModel.suggestions?.find(({sourceIndex:e})=>e===s.sourceIndex)?.results?.find(({key:e})=>`${e}`==`${s.key}`);o&&this.search(o)}_renderAutocomplete(){const{_effectiveActiveMenu:e,messages:t,_isDisabled:s}=this,{maxInputLength:o,placeholder:r,searchTerm:i,state:l}=this.viewModel,n=this.label??t.searchButtonTitle??"";return b("calcite-autocomplete",{afterCreate:this._handleAutocompleteCreate,autocomplete:"off",bind:this,class:g.autocomplete,disabled:s,icon:this.icon||!1,inputValue:i,label:n,loading:"searching"===l,maxLength:o,name:this.id,onblur:this._emitBlur,onfocus:this._emitFocus,onkeydown:this._handleInputKeydown,open:"suggestion"===e,overlayPositioning:"fixed",placeholder:r,title:i?"":r,onCalciteAutocompleteChange:this._handleCalciteAutocompleteChange,onCalciteAutocompleteClose:this._handleAutocompleteClose,onCalciteAutocompleteOpen:this._handleAutocompleteOpen,onCalciteAutocompleteTextChange:this._handleCalciteAutocompleteTextInput,onCalciteAutocompleteTextInput:this._handleCalciteAutocompleteTextInput},this._renderSuggestions(),this._renderNotices())}_renderForm(){return b("form",{bind:this,class:g.form,disabled:this._isDisabled,key:g.form,onsubmit:this._formSubmit,role:"search"},this._renderAutocomplete(),b("button",{class:g.submitButton,type:"submit"},this.label??this.messages.searchButtonTitle??""))}_renderSuggestGroup(e){return e.results?.map(e=>this._renderSuggestion(e))}_renderSuggestions(){const{suggestions:e}=this.viewModel;return this._showNoResults?null:this._showCurrentLocation?this._renderUseCurrentLocation():e?.map(e=>this._renderSuggestResults(e))}_renderSuggestResults(e){const{allSources:t,activeSourceIndex:s}=this.viewModel,{sourceIndex:o}=e,r=e.results?.length,i=t.length>1&&s===v.ALL_INDEX,l=this._getSourceName(o);return r&&i?b("calcite-autocomplete-item-group",{heading:l,key:`suggestion-group-${l}-${o}`},this._renderSuggestGroup(e)):this._renderSuggestGroup(e)}_renderSuggestion({key:e,sourceIndex:t,text:s}){const o={key:e,sourceIndex:t};return b("calcite-autocomplete-item",{heading:s??this.messages.untitledResult,key:`suggestion_${e}`,value:JSON.stringify(o)})}_renderSource(e){const t=this._getSourceName(e);return b("calcite-dropdown-item",{"data-source-index":`${e}`,key:`source-${t}-${e}`,selected:e===this.viewModel.activeSourceIndex},t)}_renderNoResultsWarning(e){const{messages:t}=this,s=e?y(t.noResultsFoundForValue,{value:`"${e}"`}):t.noResultsFound;return b("calcite-notice",{icon:"exclamation-mark-triangle",key:"no-results-warning",kind:"warning",open:!0,slot:"content-bottom"},b("div",{slot:"title"},t.noResults),b("div",{slot:"message"},s))}_renderLocateError(){return b("calcite-notice",{icon:"exclamation-mark-circle",key:"locate-warning",kind:"danger",open:!0,slot:"content-bottom"},b("div",{slot:"message"},this.messages.locateError))}_renderNotices(){return this._locateFailed?this._renderLocateError():this._showNoResults?this._renderNoResultsWarning(this._lastSearchTerm??this.viewModel.searchTerm):null}async _useCurrentLocation(){this._cancelQueries();const e=new AbortController,{signal:t}=e;this._searchController=e;try{await this.viewModel.searchNearby({signal:t})}catch(s){n(s)||(this._locateFailed=!0,this.activeMenu="suggestion")}finally{this._searchController=null}}_handleSourceOpen(){this.activeMenu="source"}_handleSourceClose(){"source"===this.activeMenu&&(this.activeMenu="none")}_handleSourceSelect(e){const t=e.target.selectedItems[0].getAttribute("data-source-index");t&&(this.viewModel.activeSourceIndex=parseInt(t,10))}_cancelSuggest(){this.activeMenu="none",this._locateFailed=!1,this._showNoResults=!1,this._suggestController=i(this._suggestController)}_cancelQueries(){this._cancelSuggest(),this._searchController=i(this._searchController)}_scrollToTopSuggestion(){this._autocompleteNode?.scrollContentTo({top:0})}_formSubmit(e){e.preventDefault(),this.activeMenu="none",this._lastSearchTerm=this.searchTerm,this.searchTerm&&this.search()}_getSourceName(e){const{messages:t}=this,{allSources:s}=this.viewModel,o=s.at(e);return e===v.ALL_INDEX?t.all:o?.name||t.untitledSource}};e([h()],C.prototype,"_locateFailed",void 0),e([h()],C.prototype,"_showNoResults",void 0),e([h()],C.prototype,"_isDisabled",null),e([h()],C.prototype,"_showCurrentLocation",null),e([h()],C.prototype,"_effectiveActiveMenu",null),e([h()],C.prototype,"activeMenu",null),e([h({readOnly:!0})],C.prototype,"activeSource",null),e([h()],C.prototype,"activeSourceIndex",null),e([h()],C.prototype,"allPlaceholder",null),e([h({readOnly:!0})],C.prototype,"allSources",null),e([h()],C.prototype,"autoNavigate",null),e([h()],C.prototype,"autoSelect",null),e([h({readOnly:!0})],C.prototype,"defaultSources",null),e([h()],C.prototype,"disabled",void 0),e([h()],C.prototype,"goToOverride",null),e([h()],C.prototype,"icon",null),e([h()],C.prototype,"includeDefaultSources",null),e([h()],C.prototype,"label",null),e([h()],C.prototype,"locationEnabled",null),e([h()],C.prototype,"maxResults",null),e([h()],C.prototype,"maxSuggestions",null),e([h(),S("esri/widgets/Search/t9n/Search")],C.prototype,"messages",void 0),e([h(),S("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([h()],C.prototype,"minSuggestCharacters",null),e([h()],C.prototype,"popupEnabled",null),e([h()],C.prototype,"popupTemplate",null),e([h()],C.prototype,"portal",null),e([h()],C.prototype,"resultGraphic",null),e([h()],C.prototype,"resultGraphicEnabled",null),e([h({readOnly:!0})],C.prototype,"results",null),e([h()],C.prototype,"searchAllEnabled",null),e([h()],C.prototype,"searchTerm",null),e([h({readOnly:!0})],C.prototype,"selectedResult",null),e([h()],C.prototype,"sources",null),e([h({readOnly:!0})],C.prototype,"suggestions",null),e([h()],C.prototype,"suggestionsEnabled",null),e([h()],C.prototype,"view",null),e([M(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),h({type:v})],C.prototype,"viewModel",void 0),C=e([d("esri.widgets.Search")],C);const f=C;export{f as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import"../intl.js";import{deprecateWidget as t,deprecatedPropertyValue as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as r,abortMaybe as i}from"../core/maybe.js";import{ignoreAbortErrors as l,isAbortError as n}from"../core/promiseUtils.js";import{watch as a,initial as c}from"../core/reactiveUtils.js";import{waitAnimationFrame as u}from"../core/scheduling.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import p from"./Widget.js";import{css as g}from"./Search/css.js";import m from"./Search/SearchResultRenderer.js";import v from"./Search/SearchViewModel.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as S}from"./support/decorators/vmEvent.js";import{tsx as b}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";import{substitute as y}from"../intl/substitute.js";let C=class extends p{constructor(e,s){super(e,s),this._currentLocationValue=`${this.id}-search-use-current-location`,this._autocompleteNode=null,this._focusAbortController=null,this._searchResultRenderer=new m,this._suggestController=null,this._searchController=null,this._lastSearchTerm="",this._locateFailed=!1,this._showNoResults=!1,this.disabled=!1,this.messages=null,this.messagesCommon=null,this.viewModel=new v,this._renderSearchResultsContent=()=>this._searchResultRenderer,t(o.getLogger(this),"Search","arcgis-search",{version:"4.33"}),this.addHandles([a(()=>this.viewModel,e=>this._searchResultRenderer.viewModel=e,c),a(()=>this.viewModel.results,()=>this._searchResultRenderer.showMoreResultsOpen=!1),a(()=>this.messages,e=>this.viewModel.messages=e),a(()=>this.viewModel?.defaultPopupTemplate,e=>{e&&(e.content=this._renderSearchResultsContent)},c),a(()=>this.viewModel?.view?.popupElement&&this.viewModel?.defaultPopupTemplate,()=>{if(this.viewModel?.defaultPopupTemplate&&this.viewModel?.view?.popupElement){const e=document.createElement("arcgis-search-result-renderer");e.viewModel=this.viewModel,e.messages=this.messages,this.viewModel.defaultPopupTemplate.content=e}},c)])}loadDependencies(){return _({autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item-group":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item-group"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}destroy(){this._cancelQueries(),this._searchResultRenderer=r(this._searchResultRenderer),this._focusAbortController?.abort()}get _isDisabled(){const{state:e}=this.viewModel;return"disabled"===e||"loading"===e||this.disabled}get _showCurrentLocation(){return this.locationEnabled&&!this.searchTerm?.trim()}get _effectiveActiveMenu(){const{activeMenu:e}=this;return this._isDisabled?"none":"warning"===e?"suggestion":e}get activeMenu(){return"none"}set activeMenu(e){"warning"===e&&s(o.getLogger(this),"activeMenu","warning",{replacement:"Use the value 'suggestion' instead",version:"4.32",warnOnce:!0}),this._overrideIfSome("activeMenu",e)}get activeSource(){return this.viewModel?.activeSource}get activeSourceIndex(){return this.viewModel.activeSourceIndex}set activeSourceIndex(e){this.viewModel.activeSourceIndex=e}get allPlaceholder(){return this.viewModel.allPlaceholder}set allPlaceholder(e){this.viewModel.allPlaceholder=e}get allSources(){return this.viewModel.allSources}get autoNavigate(){return this.viewModel.autoNavigate}set autoNavigate(e){this.viewModel.autoNavigate=e}get autoSelect(){return this.viewModel.autoSelect}set autoSelect(e){this.viewModel.autoSelect=e}get defaultSources(){return this.viewModel.defaultSources}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"search"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultSources(){return this.viewModel.includeDefaultSources}set includeDefaultSources(e){this.viewModel.includeDefaultSources=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get locationEnabled(){return this.viewModel.locationEnabled}set locationEnabled(e){this.viewModel.locationEnabled=e}get maxResults(){return this.viewModel.maxResults}set maxResults(e){this.viewModel.maxResults=e}get maxSuggestions(){return this.viewModel.maxSuggestions}set maxSuggestions(e){this.viewModel.maxSuggestions=e}get minSuggestCharacters(){return this.viewModel.minSuggestCharacters}set minSuggestCharacters(e){this.viewModel.minSuggestCharacters=e}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get portal(){return this.viewModel?.portal}set portal(e){this.viewModel&&(this.viewModel.portal=e)}get resultGraphic(){return this.viewModel.resultGraphic}set resultGraphic(e){this.viewModel.resultGraphic=e}get resultGraphicEnabled(){return this.viewModel.resultGraphicEnabled}set resultGraphicEnabled(e){this.viewModel.resultGraphicEnabled=e}get results(){return this.viewModel.results}get searchAllEnabled(){return this.viewModel.searchAllEnabled}set searchAllEnabled(e){this.viewModel.searchAllEnabled=e}get searchTerm(){return this.viewModel.searchTerm}set searchTerm(e){this.viewModel.searchTerm=e}get selectedResult(){return this.viewModel.selectedResult}get sources(){return this.viewModel.sources}set sources(e){this.viewModel.sources=e}get suggestions(){return this.viewModel.suggestions}get suggestionsEnabled(){return this.viewModel.suggestionsEnabled}set suggestionsEnabled(e){this.viewModel.suggestionsEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clear(){this._locateFailed=!1,this.viewModel.clear()}focus(){this._handleFocus(),this._emitFocus()}blur(){this._autocompleteNode?.blur(),this._emitBlur()}async search(e){this._cancelQueries();const t=new AbortController,{signal:s}=t;this._searchController=t;try{const o=await this.viewModel.search(e,{signal:s});if(this._searchController!==t)return;return o?.numResults||(this._showNoResults=!0,this.activeMenu="suggestion"),this._searchController=null,o}catch(o){if(this._searchController!==t)return;return void(this._searchController=null)}}async suggest(e){this._cancelSuggest();const t=new AbortController,{signal:s}=t;this._suggestController=t;try{const o=await this.viewModel.suggest(e,null,{signal:s});if(this._suggestController!==t)return;return this._suggestController=null,o?.numResults&&(this.activeMenu="suggestion",this._scrollToTopSuggestion()),o}catch(o){return this._suggestController!==t||(this._suggestController=null),null}}render(){return b("div",{class:this.classes(g.base,w.widget)},b("div",{class:g.container},this._renderSourcesMenu(),this._renderForm()))}_handleInputKeydown(e){"Tab"===e.key&&this._cancelSuggest()}_emitFocus(){this.emit("search-focus")}_emitBlur(){this.emit("search-blur")}async _handleFocus(){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const e=this._focusAbortController.signal;await l(u(e)),this._autocompleteNode?.setFocus()}_renderSourcesMenu(){const{messages:e,_isDisabled:t,_effectiveActiveMenu:s}=this,{allSources:o,searchAllEnabled:r}=this.viewModel;return o.length>1?b("calcite-dropdown",{bind:this,class:g.dropdown,disabled:t,open:"source"===s,overlayPositioning:"fixed",onCalciteDropdownClose:this._handleSourceClose,onCalciteDropdownOpen:this._handleSourceOpen,onCalciteDropdownSelect:this._handleSourceSelect},b("calcite-button",{appearance:"outline-fill",iconStart:"caret-down",kind:"neutral",label:e.searchIn,slot:"trigger"}),b("calcite-dropdown-group",{groupTitle:e.searchIn},r?this._renderSource(v.ALL_INDEX):null,o.map((e,t)=>this._renderSource(t)).toArray())):null}_renderUseCurrentLocation(){const{_currentLocationValue:e}=this;return b("calcite-autocomplete-item",{heading:this.messages.useCurrentLocation,iconStart:"gps-on",key:e,value:e})}_handleAutocompleteCreate(e){this._autocompleteNode=e}_handleCalciteAutocompleteTextInput(e){const t=e.target.inputValue;t!==this.viewModel.searchTerm&&(this.viewModel.searchTerm=t,t||this.clear(),this.suggest())}_handleAutocompleteOpen(){this.activeMenu="suggestion"}_handleAutocompleteClose(){"suggestion"===this.activeMenu&&(this.activeMenu="none")}_handleCalciteAutocompleteChange(e){const t=e.target.value;if(t===this._currentLocationValue)return void this._useCurrentLocation();const s=JSON.parse(t),o=this.viewModel.suggestions?.find(({sourceIndex:e})=>e===s.sourceIndex)?.results?.find(({key:e})=>`${e}`==`${s.key}`);o&&this.search(o)}_renderAutocomplete(){const{_effectiveActiveMenu:e,messages:t,_isDisabled:s}=this,{maxInputLength:o,placeholder:r,searchTerm:i,state:l}=this.viewModel,n=this.label??t.searchButtonTitle??"";return b("calcite-autocomplete",{afterCreate:this._handleAutocompleteCreate,autocomplete:"off",bind:this,class:g.autocomplete,disabled:s,icon:this.icon||!1,inputValue:i,label:n,loading:"searching"===l,maxLength:o,name:this.id,onblur:this._emitBlur,onfocus:this._emitFocus,onkeydown:this._handleInputKeydown,open:"suggestion"===e,overlayPositioning:"fixed",placeholder:r,title:i?"":r,onCalciteAutocompleteChange:this._handleCalciteAutocompleteChange,onCalciteAutocompleteClose:this._handleAutocompleteClose,onCalciteAutocompleteOpen:this._handleAutocompleteOpen,onCalciteAutocompleteTextChange:this._handleCalciteAutocompleteTextInput,onCalciteAutocompleteTextInput:this._handleCalciteAutocompleteTextInput},this._renderSuggestions(),this._renderNotices())}_renderForm(){return b("form",{bind:this,class:g.form,disabled:this._isDisabled,key:g.form,onsubmit:this._formSubmit,role:"search"},this._renderAutocomplete(),b("button",{class:g.submitButton,type:"submit"},this.label??this.messages.searchButtonTitle??""))}_renderSuggestGroup(e){return e.results?.map(e=>this._renderSuggestion(e))}_renderSuggestions(){const{suggestions:e}=this.viewModel;return this._showNoResults?null:this._showCurrentLocation?this._renderUseCurrentLocation():e?.map(e=>this._renderSuggestResults(e))}_renderSuggestResults(e){const{allSources:t,activeSourceIndex:s}=this.viewModel,{sourceIndex:o}=e,r=e.results?.length,i=t.length>1&&s===v.ALL_INDEX,l=this._getSourceName(o);return r&&i?b("calcite-autocomplete-item-group",{heading:l,key:`suggestion-group-${l}-${o}`},this._renderSuggestGroup(e)):this._renderSuggestGroup(e)}_renderSuggestion({key:e,sourceIndex:t,text:s}){const o={key:e,sourceIndex:t};return b("calcite-autocomplete-item",{heading:s??this.messages.untitledResult,key:`suggestion_${e}`,value:JSON.stringify(o)})}_renderSource(e){const t=this._getSourceName(e);return b("calcite-dropdown-item",{"data-source-index":`${e}`,key:`source-${t}-${e}`,selected:e===this.viewModel.activeSourceIndex},t)}_renderNoResultsWarning(e){const{messages:t}=this,s=e?y(t.noResultsFoundForValue,{value:`"${e}"`}):t.noResultsFound;return b("calcite-notice",{icon:"exclamation-mark-triangle",key:"no-results-warning",kind:"warning",open:!0,slot:"content-bottom"},b("div",{slot:"title"},t.noResults),b("div",{slot:"message"},s))}_renderLocateError(){return b("calcite-notice",{icon:"exclamation-mark-circle",key:"locate-warning",kind:"danger",open:!0,slot:"content-bottom"},b("div",{slot:"message"},this.messages.locateError))}_renderNotices(){return this._locateFailed?this._renderLocateError():this._showNoResults?this._renderNoResultsWarning(this._lastSearchTerm??this.viewModel.searchTerm):null}async _useCurrentLocation(){this._cancelQueries();const e=new AbortController,{signal:t}=e;this._searchController=e;try{await this.viewModel.searchNearby({signal:t})}catch(s){n(s)||(this._locateFailed=!0,this.activeMenu="suggestion")}finally{this._searchController=null}}_handleSourceOpen(){this.activeMenu="source"}_handleSourceClose(){"source"===this.activeMenu&&(this.activeMenu="none")}_handleSourceSelect(e){const t=e.target.selectedItems[0].getAttribute("data-source-index");t&&(this.viewModel.activeSourceIndex=parseInt(t,10))}_cancelSuggest(){this.activeMenu="none",this._locateFailed=!1,this._showNoResults=!1,this._suggestController=i(this._suggestController)}_cancelQueries(){this._cancelSuggest(),this._searchController=i(this._searchController)}_scrollToTopSuggestion(){this._autocompleteNode?.scrollContentTo({top:0})}_formSubmit(e){e.preventDefault(),this.activeMenu="none",this._lastSearchTerm=this.searchTerm,this.searchTerm&&this.search()}_getSourceName(e){const{messages:t}=this,{allSources:s}=this.viewModel,o=s.at(e);return e===v.ALL_INDEX?t.all:o?.name||t.untitledSource}};e([h()],C.prototype,"_locateFailed",void 0),e([h()],C.prototype,"_showNoResults",void 0),e([h()],C.prototype,"_isDisabled",null),e([h()],C.prototype,"_showCurrentLocation",null),e([h()],C.prototype,"_effectiveActiveMenu",null),e([h()],C.prototype,"activeMenu",null),e([h({readOnly:!0})],C.prototype,"activeSource",null),e([h()],C.prototype,"activeSourceIndex",null),e([h()],C.prototype,"allPlaceholder",null),e([h({readOnly:!0})],C.prototype,"allSources",null),e([h()],C.prototype,"autoNavigate",null),e([h()],C.prototype,"autoSelect",null),e([h({readOnly:!0})],C.prototype,"defaultSources",null),e([h()],C.prototype,"disabled",void 0),e([h()],C.prototype,"goToOverride",null),e([h()],C.prototype,"icon",null),e([h()],C.prototype,"includeDefaultSources",null),e([h()],C.prototype,"label",null),e([h()],C.prototype,"locationEnabled",null),e([h()],C.prototype,"maxResults",null),e([h()],C.prototype,"maxSuggestions",null),e([h(),M("esri/widgets/Search/t9n/Search")],C.prototype,"messages",void 0),e([h(),M("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([h()],C.prototype,"minSuggestCharacters",null),e([h()],C.prototype,"popupEnabled",null),e([h()],C.prototype,"popupTemplate",null),e([h()],C.prototype,"portal",null),e([h()],C.prototype,"resultGraphic",null),e([h()],C.prototype,"resultGraphicEnabled",null),e([h({readOnly:!0})],C.prototype,"results",null),e([h()],C.prototype,"searchAllEnabled",null),e([h()],C.prototype,"searchTerm",null),e([h({readOnly:!0})],C.prototype,"selectedResult",null),e([h()],C.prototype,"sources",null),e([h({readOnly:!0})],C.prototype,"suggestions",null),e([h()],C.prototype,"suggestionsEnabled",null),e([h()],C.prototype,"view",null),e([S(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),h({type:v})],C.prototype,"viewModel",void 0),C=e([d("esri.widgets.Search")],C);const f=C;export{f 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{isSome as t}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import{drainHandles as r}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as n,abortMaybe as p}from"../../core/maybe.js";import{createAbortError as l,whenOrAbort as h,ignoreAbortErrors as c}from"../../core/promiseUtils.js";import{watch as d,syncAndInitial as u,on as m,when as y,whenOnce as g}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as _}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as w,isLoaded as G,load as O,project as T}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as S}from"../../geometry/support/coordsUtils.js";import{equals as E}from"../../geometry/support/spatialReferenceUtils.js";import A from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as M}from"../../layers/support/layerUtils.js";import k from"../../symbols/FillSymbol3DLayer.js";import C from"../../symbols/MeshSymbol3D.js";import H from"../../symbols/SimpleFillSymbol.js";import j from"../../symbols/SimpleLineSymbol.js";import U from"../../symbols/SimpleMarkerSymbol.js";import D from"../../symbols/TextSymbol.js";import{symbolTypes as I}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as R}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as x}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as P}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as L}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as F}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as V}from"../../views/input/InputManager.js";import{sketchKeys as K}from"../../views/interactive/keybindings.js";import W from"../../views/interactive/sketch/SketchLabelOptions.js";import Z from"../../views/interactive/sketch/SketchOptions.js";import q from"../../views/interactive/sketch/SketchTooltipOptions.js";import N from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as z}from"../../views/interactive/snapping/SnappingManager.js";import B from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as $}from"../../views/interactive/snapping/snappingUtils.js";import{loadAutomaticAreaMeasurementUtils as Y}from"../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as J}from"../../views/support/automaticLengthMeasurementUtils.js";import{defaultHighlightName as Q}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as X}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as ee}from"../../views/support/screenUtils.js";import te from"./adapters/layer/GraphicsLayerAdapter.js";import oe from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ae,UpdateOperationHandle as ie}from"./support/OperationHandle.js";import{getModeFromCreateOptions as re,getDrawToolGeometryTypeFromCreateTool as se,graphicsHaveTooFewVerticesForBox as ne}from"./support/sketchUtils.js";const pe={defaultZ:0},le={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Q},tool:"transform"},he=Symbol(),ce=Symbol();let de=class extends i{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new A({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._updatingHandles=new _,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new U({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new H({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new j({color:[130,130,130,1],width:2}),this.meshSymbol=new C({symbolLayers:new o([new k])}),this.textSymbol=new D({text:"text"}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new U({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new Z,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(ce),!e)return;const o=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),d(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)},u)].filter(t);this.addHandles(o,ce)},this._originalPopupEnabled=null,this.defaultCreateOptions=pe,this.defaultUpdateOptions=le,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new B}initialize(){this.addHandles([m(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),d(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),u),d(()=>this.view,e=>{this._defaultSnappingManager=n(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new z({view:e,options:this.snappingOptions})),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},u),d(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),$(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=n(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new te(e);case"map-notes":return new oe(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get activeCreateToolDrawMode(){return"create"===this._operationHandle?.type&&this._operationHandle.activeComponent&&"mode"in this._operationHandle.activeComponent?this._operationHandle.activeComponent.mode:null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...pe,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...le,...e,reshapeOptions:{...le.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...le.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=n(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new z({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return!(!this._updatingHandles.updating&&!this.snappingManager?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(y(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},u),o),this._set("view",e)}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=p(this._moduleLoaderAbortController),this._viewReadyAbortController=p(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:a}=this;if(!o||"disabled"===this.state)throw a||this._logMissingLayer(),l();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");F(o,this._internalGraphicsLayer);const i=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==i||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=()=>{if(i===this._operationHandle){const o=this.createGraphic,a=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),i.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:a?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"}),a||this._sketchContinuationFlag)return;const{creationMode:r}=this;if("continuous"===r){if(t?.geometryToPlace)return;this._updatingHandles.addPromise(c(this.create(e,t)))}else"update"===r&&o&&this._updatingHandles.addPromise(c(this.update([o])))}};i.on("complete",r),this._operationHandle=i,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:a,state:i}=this;if(!a||"disabled"===i)throw o||this._logMissingLayer(),l();null!=a.activeTool&&(a.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||Ge(s)||(F(a,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||E(o.geometry.spatialReference,t.spatialReference)||(w(o.geometry.spatialReference,t.spatialReference)||G()||await O(),o.geometry=T(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const a=await t.hitTest(e,{exclude:o});return X(a.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{M(e.type)&&o.push(e)});const a=await t.hitTest(e,{exclude:o});if(a.results.length>0){const e=a.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!a.ground.mapPoint||t.map.ground.opacity<1||a.ground.distance-(e.distance??0)>-Math.min(3*a.ground.distance,"global"===t.viewingMode?b(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},V.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(ee(e)));let o=null;if(null!=t){const a=t.graphic;this.updateGraphics.includes(a)||this.hasGraphic(a)?(e.stopPropagation(),o=a):"2d"!==this.view?.type||this._isComponentGraphic(a)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const a={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},i=await this._setupDrawGraphicTool(e,o,a);return null==i?null:(o.tools.add(i),o.activeTool=i,this._setupCreateOperationHandle(i,e))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:a,defaultZ:i,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=re(p,e),c=se(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:a,defaultZ:i,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:c,mode:h,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const[t,o,a]=await Promise.all([this._requireModule(import("../../views/2d/interactive/editingTools.js")),Y(),J()]);return Ge(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ye(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:a})}async _makeDrawGraphicTool3D(e){const[t,o,a]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),Y(),J()]);return Ge(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:a})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let a=null;const i=e.forceUniformSize,s=e.centered,n=[o.on("key-down",t=>{if(t.key===K.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===K.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==K.vertexAdd||t.repeat)t.key===K.undo?(t.stopPropagation(),p.undo()):t.key===K.redo?(t.stopPropagation(),p.redo()):t.key!==K.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===K.center&&(t.repeat||(e.centered=!s,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},V.WIDGET),o.on("key-up",t=>{t.key===K.pan?e.enabled=!0:t.key!==K.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===K.center&&(e.centered=s,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())},V.WIDGET),e.on("vertex-add",t=>{switch(a=null==a?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:a,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),a="complete",e.aborted?p&&p.cancel():p&&p.complete()}),d(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ae({activeComponent:e,type:"create",onEnd:()=>{r(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return p}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let i=a.tool??le.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(i){case"move":return this._setupMove3DOperation(e,a,o,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,o);case"transform":return this._setupGraphicTransform3DOperation(e,a,o)}}switch(i){case"move":return this._setupMove2DOperation(e,a,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,i,a,o);case"transform":return ne(e)&&(i="reshape"),this._setupTransformOrReshape2DOperation(e,i,a,o)}}async _setupMove3DOperation(e,t,o,a,i=!1){const[s,n]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),J()]);if(Ge(s))return s;const{ManipulatedObject3DGraphic:p,MoveTool3D:l}=s.module,h=new Map,c=()=>{h.forEach(e=>e.destroy()),h.clear()};for(const r of e){const e=new p({view:o,graphic:r}),t=x(e);if(0!==t)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${R(t)}).`),null;h.set(r,e)}const d=new l({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,autoLengthMeasurementUtils:n});o.tools.add(d),d.objects.addMany(Array.from(h.values())),i||this.updateGraphics.addMany(e);const u=[],m=new ie({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),we(o,d),c()},undo:()=>{_e(this.view,d),ge(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},redo:()=>{ve(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:e=>{this.updateGraphics.push(e);const t=new p({view:o,graphic:e});h.set(e,t),d.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(m.history.undo.forEach(e=>e.updates.splice(t,1)),m.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void m.complete();const o=h.get(e);o&&(d.objects.remove(o),o.destroy(),h.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==a)return;const e=this.updateGraphics.at(0),i=await this._setupReshape3DOperation(e,t,o,!0);i&&!Ge(i)&&(m.onEnd(),m.destroy(),this._setUpdateOperationHandle(i,t))}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},V.WIDGET)),m}_setupGraphicTransform3DOperation(e,t,o,a=!1){if(1===e.length&&0===L(e[0])){const i=e[0],r=i.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(i,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(i,t,o,a)}return this._setupMove3DOperation(e,t,o,"transform",a)}async _setupPointTransform3DOperation(e,t,o){const a="transform",{enableRotation:i,enableScaling:s,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ge(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:h}=p.module,c=new h({graphic:e,view:o}),d=new l({object:c,view:o,enableRotation:i,enableScaling:s,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],m=new ie({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),we(o,d),c.destroy()},undo:()=>{_e(this.view,d),ge(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},redo:()=>{ve(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},V.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,a=!1){const i="transform",{enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,[h,c]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),J()]);if(Ge(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:u}=h.module,m=this.view?.inputManager?.isModifierKeyDown(K.constraint),y=new d({view:o,graphic:e}),g=new u({object:y,view:o,enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!m,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:c});o.tools.add(g),a||this.updateGraphics.add(e);const v=[],f=new ie({activeComponent:g,tool:i,type:"update",onEnd:()=>{r(v),we(o,g),y.destroy()},canUndo:()=>!g.destroyed&&g.canUndo,undo:()=>{g.destroyed||(g.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!g.destroyed&&g.canRedo,redo:()=>{g.destroyed||(g.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),f.onEnd(),f.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),f.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const a=await this._setupReshape3DOperation(e,t,o,!0);a&&!Ge(a)&&(f.onEnd(),f.destroy(),this._setUpdateOperationHandle(a,t))}});return v.push(...this._getHandlesForComponent(f,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(f,e,t),V.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(f,e),V.WIDGET),o.on("key-down",e=>{e.key!==K.constraint||e.repeat||(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},V.WIDGET),o.on("key-up",e=>{e.key===K.constraint&&(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},V.WIDGET)),f}async _setupMove2DOperation(e,t,o){const a="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const i=await this._getGraphicMover(e,t,o);if(Ge(i))return i;const s=new ie({activeComponent:i,tool:a,type:"update",onEnd:()=>{this._clearCursor(),r(l),r(p),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();ge(s,e),s.refreshComponent(),this._emitUndoEvent({graphics:e,tool:a})},redo:()=>{const e=this.updateGraphics.toArray();ve(s,e),s.refreshComponent(),this._emitRedoEvent({graphics:e,tool:a})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),i.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?i.graphics=o:s.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key!==K.constraint||e.repeat||(n=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},V.WIDGET),o.on("key-up",e=>{e.key===K.constraint&&n&&(n=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},V.WIDGET)],l=this._getHandlesForComponent(s,t);return s}async _setupReshape3DOperation(e,t,o,a=!1){const i="reshape",[s,n,p]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),Y(),J()]);if(Ge(s))return s;const{ManipulatedObject3DGraphic:l,ReshapeTool3D:h}=s.module,c=new l({view:o,graphic:e}),d=P(c);if(0!==d)return c.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${R(d)}).`),null;const u=t.reshapeOptions,m=new h({view:o,object:c,enableZVertex:t.enableZ&&"move"===u?.vertexOperation,enableZShape:t.enableZ&&"move"===u?.shapeOperation,enableMoveObject:"move"===u?.shapeOperation||"move-xy"===u?.shapeOperation,enableMidpoints:"split"===u?.edgeOperation,enableEdgeOffset:"offset"===u?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:p});o.tools.add(m),a||this.updateGraphics.add(c.graphic);const y=[],g=new ie({activeComponent:m,tool:i,type:"update",onEnd:()=>{r(y),we(o,m),c.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;g.onEnd(),g.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);Ge(e)||this._setUpdateOperationHandle(e,t)}});return y.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},V.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,a){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const i="transform"===t?await this._getBox(e,o,a):await this._getReshape(e,o,a);if(Ge(i))return i;const s=new ie({activeComponent:i,type:"update",onEnd:()=>{r(p),r(n),s.activeComponent&&!s.activeComponent.destroyed&&s.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{ge(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},redo:()=>{ve(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},addToSelection:async e=>{let t=s.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),s.onEnd(),s.destroy();const i=await this._setupTransformOrReshape2DOperation(t,"transform",o,a);if(Ge(i))return;this._setUpdateOperationHandle(i,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),s.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?s.complete():ne(o)?s.toggleTool():s.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===s.tool&&"point"===t.type||"transform"===s.tool&&"extent"===t.type))return;let i=null;"transform"===s.tool?i=await this._getReshape([e],o,a):"reshape"===s.tool&&(i=await this._getBox([e],o,a)),Ge(i)||(s.activeComponent?.destroy(),s.activeComponent=i,s.activeComponent&&(r(p),p=this._getHandlesForComponent(s,o)))}}),n=[a.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,o),V.WIDGET),a.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key===K.constraint&&!e.repeat&&s){const e=s.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},V.WIDGET),a.on("key-up",e=>{if(e.key===K.constraint&&s){const e=s.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},V.WIDGET)];let p=this._getHandlesForComponent(s,o);return s}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:a,highlightOptions:i}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Ge(r)?r:new r.module.default({enableMoveAllGraphics:a,highlightName:i?.name,highlightsEnabled:!!i?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:a,enableScaling:i,highlightOptions:r,preserveAspectRatio:s}=t,[n,p]=await Promise.all([this._requireModule(import("../../views/draw/support/Box.js")),J()]);if(Ge(n))return n;const l=this.view?.inputManager?.isModifierKeyDown(K.constraint);return new n.module.default({graphics:e,enableRotation:a,enableScaling:i,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!l,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:p,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const{highlightOptions:a,reshapeOptions:i}=t,r="split"===i?.edgeOperation,s="move"===i?.shapeOperation,[n,p,l]=await Promise.all([this._requireModule(import("../../views/draw/support/Reshape.js")),Y(),J()]);return Ge(n)?n:new n.module.default({enableMidpoints:r,enableMovement:s,graphic:e[0],highlightName:a?.name,highlightsEnabled:!!a?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:l,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const a=e.map(e=>S(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:a,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const a=e.map(e=>S(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:a,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:a})=>{a.native?.shiftKey&&t.multipleSelectionEnabled&&(a.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(be(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(be(t.graphics))),o.on("rotate-start",t=>e.addToHistory(be(t.graphics))),o.on("scale-start",t=>e.addToHistory(be(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(be([t.mover]))),o.on("reshape-start",t=>e.addToHistory(be([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(be([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(be([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:a,viewEvent:i}=o;return i.native?.shiftKey&&this.hasGraphic(a)?(i.stopPropagation(),e.removeFromSelection(a)):t.toggleToolOnClick?(i.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const a=()=>{if(e===this._operationHandle){const a=this.updateGraphics.toArray(),i=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:a,state:"complete",aborted:e.cancelled,tool:i,toolEventInfo:null,type:"update"})}};e.on("complete",a)}async _getCommonUpdateOperationClickHandlers(e,t,o){const a=ee(t),i=await t.defer(()=>this._getFirstHit(a));if(null==i)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([i.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(i.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const a=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!a||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===K.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===K.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===K.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&K.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=n(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(he)}_displayCursor(e){this.removeHandles(he),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),he)}_logError(e,t,o){s.getLogger(this).error(new a(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}get test(){}wait(){return g(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(p(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await h(g(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",me("view"))}_logMissingLayer(){this._logError(ue,me("layer"))}};e([v()],de.prototype,"_defaultSnappingManager",void 0),e([v()],de.prototype,"_layerAdapter",null),e([v()],de.prototype,"_operationHandle",void 0),e([v({readOnly:!0})],de.prototype,"_updatingHandles",void 0),e([v({readOnly:!0})],de.prototype,"activeTool",null),e([v({readOnly:!0})],de.prototype,"activeCreateToolDrawMode",null),e([v()],de.prototype,"activeTooltip",null),e([v({types:I})],de.prototype,"activeFillSymbol",void 0),e([v()],de.prototype,"activeLineSymbol",void 0),e([v()],de.prototype,"activeVertexSymbol",void 0),e([v()],de.prototype,"allowDeleteKey",void 0),e([v({readOnly:!0})],de.prototype,"createGraphic",null),e([v()],de.prototype,"defaultCreateOptions",null),e([v()],de.prototype,"defaultUpdateOptions",null),e([v({type:W,nonNullable:!0})],de.prototype,"labelOptions",null),e([v()],de.prototype,"layer",void 0),e([v({types:I})],de.prototype,"pointSymbol",void 0),e([v({types:I})],de.prototype,"polygonSymbol",void 0),e([v({types:I})],de.prototype,"polylineSymbol",void 0),e([v()],de.prototype,"meshSymbol",void 0),e([v()],de.prototype,"textSymbol",void 0),e([v({type:B,nonNullable:!0})],de.prototype,"snappingOptions",null),e([v()],de.prototype,"snappingManager",null),e([v({readOnly:!0})],de.prototype,"state",null),e([v({type:q,nonNullable:!0})],de.prototype,"tooltipOptions",null),e([v({readOnly:!0})],de.prototype,"updateGraphics",void 0),e([v()],de.prototype,"updateOnGraphicClick",void 0),e([v()],de.prototype,"updating",null),e([v()],de.prototype,"creationMode",void 0),e([v({type:N,nonNullable:!0})],de.prototype,"valueOptions",null),e([v({types:I})],de.prototype,"vertexSymbol",void 0),e([v({value:null})],de.prototype,"view",null),e([v({constructOnly:!0,type:Z})],de.prototype,"sketchOptions",void 0),de=e([f("esri.widgets.Sketch.SketchViewModel")],de);const ue="sketch:missing-property",me=e=>`Property '${e}' is missing on SketchViewModel.`;function ye(e){return"polygon"===e||"rectangle"===e||"circle"===e}function ge(e,t){fe("undo",e.history.undo,e.history.redo,t)}function ve(e,t){fe("redo",e.history.redo,e.history.undo,t)}function fe(e,t,o,a){const i=t.pop();if(!i)return;const r=i.updates,s=[];a.forEach((t,o)=>{const a=r[o];null!=a&&("geometry"in a&&null!=a.geometry&&(s.push({geometry:t.geometry}),t.geometry=a.geometry),"symbol"in a&&null!=a.symbol&&(s.push({symbol:t.symbol}),t.symbol=a.symbol),"undo"in a&&(s.push(a),a[e](t)))}),o.push({updates:s})}function _e(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function be(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function we(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Ge(e){return"requireError"in e&&"aborted"===e.requireError}export{de as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import{drainHandles as r}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as n,abortMaybe as p}from"../../core/maybe.js";import{createAbortError as l,whenOrAbort as h,ignoreAbortErrors as c}from"../../core/promiseUtils.js";import{watch as d,syncAndInitial as u,on as m,when as y,whenOnce as g}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as _}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as w,isLoaded as G,load as O,project as T}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as S}from"../../geometry/support/coordsUtils.js";import{equals as E}from"../../geometry/support/spatialReferenceUtils.js";import A from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as M}from"../../layers/support/layerUtils.js";import k from"../../symbols/FillSymbol3DLayer.js";import C from"../../symbols/MeshSymbol3D.js";import H from"../../symbols/SimpleFillSymbol.js";import j from"../../symbols/SimpleLineSymbol.js";import U from"../../symbols/SimpleMarkerSymbol.js";import D from"../../symbols/TextSymbol.js";import{symbolTypes as I}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as R}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as x}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as P}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as L}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as F}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as V}from"../../views/input/InputManager.js";import{sketchKeys as K}from"../../views/interactive/keybindings.js";import W from"../../views/interactive/sketch/SketchLabelOptions.js";import Z from"../../views/interactive/sketch/SketchOptions.js";import q from"../../views/interactive/sketch/SketchTooltipOptions.js";import N from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as z}from"../../views/interactive/snapping/SnappingManager.js";import B from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as $}from"../../views/interactive/snapping/snappingUtils.js";import{loadAutomaticAreaMeasurementUtils as Y}from"../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as J}from"../../views/support/automaticLengthMeasurementUtils.js";import{defaultHighlightName as Q}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as X}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as ee}from"../../views/support/screenUtils.js";import te from"./adapters/layer/GraphicsLayerAdapter.js";import oe from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ae,UpdateOperationHandle as ie}from"./support/OperationHandle.js";import{getModeFromCreateOptions as re,getDrawToolGeometryTypeFromCreateTool as se,graphicsHaveTooFewVerticesForBox as ne}from"./support/sketchUtils.js";const pe={defaultZ:0},le={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Q},tool:"transform"},he=Symbol(),ce=Symbol();let de=class extends i{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new A({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._updatingHandles=new _,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new U({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new H({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new j({color:[130,130,130,1],width:2}),this.meshSymbol=new C({symbolLayers:new o([new k])}),this.textSymbol=new D({text:"text"}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new U({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new Z,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(ce),!e)return;const o=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),d(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)},u)].filter(t);this.addHandles(o,ce)},this._originalPopupEnabled=null,this.defaultCreateOptions=pe,this.defaultUpdateOptions=le,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new B}initialize(){this.addHandles([m(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),d(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),u),d(()=>this.view,e=>{this._defaultSnappingManager=n(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new z({view:e,options:this.snappingOptions})),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},u),d(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),$(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=n(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new te(e);case"map-notes":return new oe(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get activeCreateToolDrawMode(){return"create"===this._operationHandle?.type&&this._operationHandle.activeComponent&&"mode"in this._operationHandle.activeComponent?this._operationHandle.activeComponent.mode:null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...pe,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...le,...e,reshapeOptions:{...le.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...le.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=n(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new z({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return!(!this._updatingHandles.updating&&!this.snappingManager?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(y(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},u),o),this._set("view",e)}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=p(this._moduleLoaderAbortController),this._viewReadyAbortController=p(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:a}=this;if(!o||"disabled"===this.state)throw a||this._logMissingLayer(),l();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");F(o,this._internalGraphicsLayer);const i=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==i||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=()=>{if(i===this._operationHandle){const o=this.createGraphic,a=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),i.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:a?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"}),a||this._sketchContinuationFlag)return;const{creationMode:r}=this;if("continuous"===r){if(t?.geometryToPlace)return;this._updatingHandles.addPromise(c(this.create(e,t)))}else"update"===r&&o&&this._updatingHandles.addPromise(c(this.update([o])))}};i.on("complete",r),this._operationHandle=i,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:a,state:i}=this;if(!a||"disabled"===i)throw o||this._logMissingLayer(),l();null!=a.activeTool&&(a.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||Ge(s)||(F(a,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||E(o.geometry.spatialReference,t.spatialReference)||(w(o.geometry.spatialReference,t.spatialReference)||G()||await O(),o.geometry=T(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const a=await t.hitTest(e,{exclude:o});return X(a.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{M(e)&&o.push(e)});const a=await t.hitTest(e,{exclude:o});if(a.results.length>0){const e=a.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!a.ground.mapPoint||t.map.ground.opacity<1||a.ground.distance-(e.distance??0)>-Math.min(3*a.ground.distance,"global"===t.viewingMode?b(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},V.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(ee(e)));let o=null;if(null!=t){const a=t.graphic;this.updateGraphics.includes(a)||this.hasGraphic(a)?(e.stopPropagation(),o=a):"2d"!==this.view?.type||this._isComponentGraphic(a)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const a={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},i=await this._setupDrawGraphicTool(e,o,a);return null==i?null:(o.tools.add(i),o.activeTool=i,this._setupCreateOperationHandle(i,e))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:a,defaultZ:i,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=re(p,e),c=se(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:a,defaultZ:i,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:c,mode:h,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const[t,o,a]=await Promise.all([this._requireModule(import("../../views/2d/interactive/editingTools.js")),Y(),J()]);return Ge(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ye(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:a})}async _makeDrawGraphicTool3D(e){const[t,o,a]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),Y(),J()]);return Ge(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:a})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let a=null;const i=e.forceUniformSize,s=e.centered,n=[o.on("key-down",t=>{if(t.key===K.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===K.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==K.vertexAdd||t.repeat)t.key===K.undo?(t.stopPropagation(),p.undo()):t.key===K.redo?(t.stopPropagation(),p.redo()):t.key!==K.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===K.center&&(t.repeat||(e.centered=!s,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},V.WIDGET),o.on("key-up",t=>{t.key===K.pan?e.enabled=!0:t.key!==K.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===K.center&&(e.centered=s,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())},V.WIDGET),e.on("vertex-add",t=>{switch(a=null==a?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:a,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),a="complete",e.aborted?p&&p.cancel():p&&p.complete()}),d(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ae({activeComponent:e,type:"create",onEnd:()=>{r(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return p}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let i=a.tool??le.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(i){case"move":return this._setupMove3DOperation(e,a,o,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,o);case"transform":return this._setupGraphicTransform3DOperation(e,a,o)}}switch(i){case"move":return this._setupMove2DOperation(e,a,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,i,a,o);case"transform":return ne(e)&&(i="reshape"),this._setupTransformOrReshape2DOperation(e,i,a,o)}}async _setupMove3DOperation(e,t,o,a,i=!1){const[s,n]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),J()]);if(Ge(s))return s;const{ManipulatedObject3DGraphic:p,MoveTool3D:l}=s.module,h=new Map,c=()=>{h.forEach(e=>e.destroy()),h.clear()};for(const r of e){const e=new p({view:o,graphic:r}),t=x(e);if(0!==t)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${R(t)}).`),null;h.set(r,e)}const d=new l({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,autoLengthMeasurementUtils:n});o.tools.add(d),d.objects.addMany(Array.from(h.values())),i||this.updateGraphics.addMany(e);const u=[],m=new ie({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),we(o,d),c()},undo:()=>{_e(this.view,d),ge(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},redo:()=>{ve(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:e=>{this.updateGraphics.push(e);const t=new p({view:o,graphic:e});h.set(e,t),d.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(m.history.undo.forEach(e=>e.updates.splice(t,1)),m.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void m.complete();const o=h.get(e);o&&(d.objects.remove(o),o.destroy(),h.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==a)return;const e=this.updateGraphics.at(0),i=await this._setupReshape3DOperation(e,t,o,!0);i&&!Ge(i)&&(m.onEnd(),m.destroy(),this._setUpdateOperationHandle(i,t))}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},V.WIDGET)),m}_setupGraphicTransform3DOperation(e,t,o,a=!1){if(1===e.length&&0===L(e[0])){const i=e[0],r=i.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(i,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(i,t,o,a)}return this._setupMove3DOperation(e,t,o,"transform",a)}async _setupPointTransform3DOperation(e,t,o){const a="transform",{enableRotation:i,enableScaling:s,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ge(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:h}=p.module,c=new h({graphic:e,view:o}),d=new l({object:c,view:o,enableRotation:i,enableScaling:s,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],m=new ie({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),we(o,d),c.destroy()},undo:()=>{_e(this.view,d),ge(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},redo:()=>{ve(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},V.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,a=!1){const i="transform",{enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,[h,c]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),J()]);if(Ge(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:u}=h.module,m=this.view?.inputManager?.isModifierKeyDown(K.constraint),y=new d({view:o,graphic:e}),g=new u({object:y,view:o,enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!m,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:c});o.tools.add(g),a||this.updateGraphics.add(e);const v=[],f=new ie({activeComponent:g,tool:i,type:"update",onEnd:()=>{r(v),we(o,g),y.destroy()},canUndo:()=>!g.destroyed&&g.canUndo,undo:()=>{g.destroyed||(g.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!g.destroyed&&g.canRedo,redo:()=>{g.destroyed||(g.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),f.onEnd(),f.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),f.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const a=await this._setupReshape3DOperation(e,t,o,!0);a&&!Ge(a)&&(f.onEnd(),f.destroy(),this._setUpdateOperationHandle(a,t))}});return v.push(...this._getHandlesForComponent(f,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(f,e,t),V.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(f,e),V.WIDGET),o.on("key-down",e=>{e.key!==K.constraint||e.repeat||(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},V.WIDGET),o.on("key-up",e=>{e.key===K.constraint&&(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},V.WIDGET)),f}async _setupMove2DOperation(e,t,o){const a="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const i=await this._getGraphicMover(e,t,o);if(Ge(i))return i;const s=new ie({activeComponent:i,tool:a,type:"update",onEnd:()=>{this._clearCursor(),r(l),r(p),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();ge(s,e),s.refreshComponent(),this._emitUndoEvent({graphics:e,tool:a})},redo:()=>{const e=this.updateGraphics.toArray();ve(s,e),s.refreshComponent(),this._emitRedoEvent({graphics:e,tool:a})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),i.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?i.graphics=o:s.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key!==K.constraint||e.repeat||(n=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},V.WIDGET),o.on("key-up",e=>{e.key===K.constraint&&n&&(n=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},V.WIDGET)],l=this._getHandlesForComponent(s,t);return s}async _setupReshape3DOperation(e,t,o,a=!1){const i="reshape",[s,n,p]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),Y(),J()]);if(Ge(s))return s;const{ManipulatedObject3DGraphic:l,ReshapeTool3D:h}=s.module,c=new l({view:o,graphic:e}),d=P(c);if(0!==d)return c.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${R(d)}).`),null;const u=t.reshapeOptions,m=new h({view:o,object:c,enableZVertex:t.enableZ&&"move"===u?.vertexOperation,enableZShape:t.enableZ&&"move"===u?.shapeOperation,enableMoveObject:"move"===u?.shapeOperation||"move-xy"===u?.shapeOperation,enableMidpoints:"split"===u?.edgeOperation,enableEdgeOffset:"offset"===u?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:p});o.tools.add(m),a||this.updateGraphics.add(c.graphic);const y=[],g=new ie({activeComponent:m,tool:i,type:"update",onEnd:()=>{r(y),we(o,m),c.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;g.onEnd(),g.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);Ge(e)||this._setUpdateOperationHandle(e,t)}});return y.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},V.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,a){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const i="transform"===t?await this._getBox(e,o,a):await this._getReshape(e,o,a);if(Ge(i))return i;const s=new ie({activeComponent:i,type:"update",onEnd:()=>{r(p),r(n),s.activeComponent&&!s.activeComponent.destroyed&&s.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{ge(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},redo:()=>{ve(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},addToSelection:async e=>{let t=s.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),s.onEnd(),s.destroy();const i=await this._setupTransformOrReshape2DOperation(t,"transform",o,a);if(Ge(i))return;this._setUpdateOperationHandle(i,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),s.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?s.complete():ne(o)?s.toggleTool():s.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===s.tool&&"point"===t.type||"transform"===s.tool&&"extent"===t.type))return;let i=null;"transform"===s.tool?i=await this._getReshape([e],o,a):"reshape"===s.tool&&(i=await this._getBox([e],o,a)),Ge(i)||(s.activeComponent?.destroy(),s.activeComponent=i,s.activeComponent&&(r(p),p=this._getHandlesForComponent(s,o)))}}),n=[a.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,o),V.WIDGET),a.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key===K.constraint&&!e.repeat&&s){const e=s.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},V.WIDGET),a.on("key-up",e=>{if(e.key===K.constraint&&s){const e=s.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},V.WIDGET)];let p=this._getHandlesForComponent(s,o);return s}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:a,highlightOptions:i}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Ge(r)?r:new r.module.default({enableMoveAllGraphics:a,highlightName:i?.name,highlightsEnabled:!!i?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:a,enableScaling:i,highlightOptions:r,preserveAspectRatio:s}=t,[n,p]=await Promise.all([this._requireModule(import("../../views/draw/support/Box.js")),J()]);if(Ge(n))return n;const l=this.view?.inputManager?.isModifierKeyDown(K.constraint);return new n.module.default({graphics:e,enableRotation:a,enableScaling:i,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!l,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:p,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const{highlightOptions:a,reshapeOptions:i}=t,r="split"===i?.edgeOperation,s="move"===i?.shapeOperation,[n,p,l]=await Promise.all([this._requireModule(import("../../views/draw/support/Reshape.js")),Y(),J()]);return Ge(n)?n:new n.module.default({enableMidpoints:r,enableMovement:s,graphic:e[0],highlightName:a?.name,highlightsEnabled:!!a?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:l,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const a=e.map(e=>S(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:a,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const a=e.map(e=>S(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:a,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:a})=>{a.native?.shiftKey&&t.multipleSelectionEnabled&&(a.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(be(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(be(t.graphics))),o.on("rotate-start",t=>e.addToHistory(be(t.graphics))),o.on("scale-start",t=>e.addToHistory(be(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(be([t.mover]))),o.on("reshape-start",t=>e.addToHistory(be([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(be([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(be([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:a,viewEvent:i}=o;return i.native?.shiftKey&&this.hasGraphic(a)?(i.stopPropagation(),e.removeFromSelection(a)):t.toggleToolOnClick?(i.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const a=()=>{if(e===this._operationHandle){const a=this.updateGraphics.toArray(),i=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:a,state:"complete",aborted:e.cancelled,tool:i,toolEventInfo:null,type:"update"})}};e.on("complete",a)}async _getCommonUpdateOperationClickHandlers(e,t,o){const a=ee(t),i=await t.defer(()=>this._getFirstHit(a));if(null==i)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([i.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(i.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const a=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!a||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===K.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===K.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===K.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&K.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=n(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(he)}_displayCursor(e){this.removeHandles(he),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),he)}_logError(e,t,o){s.getLogger(this).error(new a(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}get test(){}wait(){return g(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(p(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await h(g(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",me("view"))}_logMissingLayer(){this._logError(ue,me("layer"))}};e([v()],de.prototype,"_defaultSnappingManager",void 0),e([v()],de.prototype,"_layerAdapter",null),e([v()],de.prototype,"_operationHandle",void 0),e([v({readOnly:!0})],de.prototype,"_updatingHandles",void 0),e([v({readOnly:!0})],de.prototype,"activeTool",null),e([v({readOnly:!0})],de.prototype,"activeCreateToolDrawMode",null),e([v()],de.prototype,"activeTooltip",null),e([v({types:I})],de.prototype,"activeFillSymbol",void 0),e([v()],de.prototype,"activeLineSymbol",void 0),e([v()],de.prototype,"activeVertexSymbol",void 0),e([v()],de.prototype,"allowDeleteKey",void 0),e([v({readOnly:!0})],de.prototype,"createGraphic",null),e([v()],de.prototype,"defaultCreateOptions",null),e([v()],de.prototype,"defaultUpdateOptions",null),e([v({type:W,nonNullable:!0})],de.prototype,"labelOptions",null),e([v()],de.prototype,"layer",void 0),e([v({types:I})],de.prototype,"pointSymbol",void 0),e([v({types:I})],de.prototype,"polygonSymbol",void 0),e([v({types:I})],de.prototype,"polylineSymbol",void 0),e([v()],de.prototype,"meshSymbol",void 0),e([v()],de.prototype,"textSymbol",void 0),e([v({type:B,nonNullable:!0})],de.prototype,"snappingOptions",null),e([v()],de.prototype,"snappingManager",null),e([v({readOnly:!0})],de.prototype,"state",null),e([v({type:q,nonNullable:!0})],de.prototype,"tooltipOptions",null),e([v({readOnly:!0})],de.prototype,"updateGraphics",void 0),e([v()],de.prototype,"updateOnGraphicClick",void 0),e([v()],de.prototype,"updating",null),e([v()],de.prototype,"creationMode",void 0),e([v({type:N,nonNullable:!0})],de.prototype,"valueOptions",null),e([v({types:I})],de.prototype,"vertexSymbol",void 0),e([v({value:null})],de.prototype,"view",null),e([v({constructOnly:!0,type:Z})],de.prototype,"sketchOptions",void 0),de=e([f("esri.widgets.Sketch.SketchViewModel")],de);const ue="sketch:missing-property",me=e=>`Property '${e}' is missing on SketchViewModel.`;function ye(e){return"polygon"===e||"rectangle"===e||"circle"===e}function ge(e,t){fe("undo",e.history.undo,e.history.redo,t)}function ve(e,t){fe("redo",e.history.redo,e.history.undo,t)}function fe(e,t,o,a){const i=t.pop();if(!i)return;const r=i.updates,s=[];a.forEach((t,o)=>{const a=r[o];null!=a&&("geometry"in a&&null!=a.geometry&&(s.push({geometry:t.geometry}),t.geometry=a.geometry),"symbol"in a&&null!=a.symbol&&(s.push({symbol:t.symbol}),t.symbol=a.symbol),"undo"in a&&(s.push(a),a[e](t)))}),o.push({updates:s})}function _e(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function be(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function we(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Ge(e){return"requireError"in e&&"aborted"===e.requireError}export{de 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"
|
|
5
|
+
import{Root as a,addLicense as s}from"@amcharts/amcharts5/index.js";import"../../intl.js";import{getLocale as t,getLocaleLanguage as r}from"../../intl/locale.js";s("AM5C241025748");const c="en-US",m=new Map([["ar",()=>import("@amcharts/amcharts5/locales/ar.js")],["bg-BG",()=>import("@amcharts/amcharts5/locales/bg_BG.js")],["bs-BA",()=>import("@amcharts/amcharts5/locales/bs_BA.js")],["ca-ES",()=>import("@amcharts/amcharts5/locales/ca_ES.js")],["cs-CZ",()=>import("@amcharts/amcharts5/locales/cs_CZ.js")],["da-DK",()=>import("@amcharts/amcharts5/locales/da_DK.js")],["de-DE",()=>import("@amcharts/amcharts5/locales/de_DE.js")],["de-CH",()=>import("@amcharts/amcharts5/locales/de_CH.js")],["el-GR",()=>import("@amcharts/amcharts5/locales/el_GR.js")],["en-US",()=>import("@amcharts/amcharts5/locales/en_US.js")],["en-CA",()=>import("@amcharts/amcharts5/locales/en_CA.js")],["es-ES",()=>import("@amcharts/amcharts5/locales/es_ES.js")],["et-EE",()=>import("@amcharts/amcharts5/locales/et_EE.js")],["fi-FI",()=>import("@amcharts/amcharts5/locales/fi_FI.js")],["fr-FR",()=>import("@amcharts/amcharts5/locales/fr_FR.js")],["he-IL",()=>import("@amcharts/amcharts5/locales/he_IL.js")],["hr-HR",()=>import("@amcharts/amcharts5/locales/hr_HR.js")],["hu-HU",()=>import("@amcharts/amcharts5/locales/hu_HU.js")],["id-ID",()=>import("@amcharts/amcharts5/locales/id_ID.js")],["it-IT",()=>import("@amcharts/amcharts5/locales/it_IT.js")],["ja-JP",()=>import("@amcharts/amcharts5/locales/ja_JP.js")],["ko-KR",()=>import("@amcharts/amcharts5/locales/ko_KR.js")],["lt-LT",()=>import("@amcharts/amcharts5/locales/lt_LT.js")],["lv-LV",()=>import("@amcharts/amcharts5/locales/lv_LV.js")],["no-NO",()=>import("@amcharts/amcharts5/locales/nb_NO.js")],["nb-NO",()=>import("@amcharts/amcharts5/locales/nb_NO.js")],["nl-NL",()=>import("@amcharts/amcharts5/locales/nl_NL.js")],["pl-PL",()=>import("@amcharts/amcharts5/locales/pl_PL.js")],["pt-BR",()=>import("@amcharts/amcharts5/locales/pt_BR.js")],["pt-PT",()=>import("@amcharts/amcharts5/locales/pt_PT.js")],["ro-RO",()=>import("@amcharts/amcharts5/locales/ro_RO.js")],["ru-RU",()=>import("@amcharts/amcharts5/locales/ru_RU.js")],["sk-SK",()=>import("@amcharts/amcharts5/locales/sk_SK.js")],["sl-SL",()=>import("@amcharts/amcharts5/locales/sl_SL.js")],["sr-RS",()=>import("@amcharts/amcharts5/locales/sr_RS.js")],["sv-SE",()=>import("@amcharts/amcharts5/locales/sv_SE.js")],["th-TH",()=>import("@amcharts/amcharts5/locales/th_TH.js")],["tr-TR",()=>import("@amcharts/amcharts5/locales/tr_TR.js")],["uk-UA",()=>import("@amcharts/amcharts5/locales/uk_UA.js")],["vi-VN",()=>import("@amcharts/amcharts5/locales/vi_VN.js")],["zh-CN",()=>import("@amcharts/amcharts5/locales/zh_Hans.js")],["zh-HK",()=>import("@amcharts/amcharts5/locales/zh_Hant.js")],["zh-TW",()=>import("@amcharts/amcharts5/locales/zh_Hant.js")]]);function l(a){const s=r(a);if(!s)return null;for(const t of m.keys()){if(r(t)===s)return t}return null}function o(a){return a?m.has(a)?a:l(a)??c:c}async function h(s,r=t()){const c=a.new(s);return c.locale=(await m.get(o(r))()).default,c}export{h as createRoot};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2848],{159:(e,n,t)=>{t.d(n,{A:()=>u});var l,r=t(31635),i=t(65008),o=t(10107),s=(t(44208),t(53966),t(87811),t(40608)),a=t(99157);let u=l=class extends i.A{constructor(e){super(e),this.steps=[]}getInverse(){const e=new l;for(let n=this.steps.length-1;n>=0;n--){const t=this.steps[n];e.steps.push(t.getInverse())}return e}};(0,r.Cg)([(0,o.MZ)({type:[a.A],nonNullable:!0})],u.prototype,"steps",void 0),u=l=(0,r.Cg)([(0,s.$)("esri.geometry.operators.support.GeographicTransformation")],u)},9762:(e,n,t)=>{t.r(n),t.d(n,{projectBuffer:()=>r});var l=t(37539);function r(e,n,t,r,i,o,s=Math.floor(e.length/3)){const a=(0,l.jd)(n,i);if(null==a)return!1;if(a===l.pO){if(e===r&&t===o)return!0;const n=t+3*s;for(let l=t,i=o;l<n;l++,i++)r[i]=e[l];return!0}const u=t+3*s;for(let n=t,l=o;n<u;n+=3,l+=3)a(e,n,r,l);return!0}},37539:(e,n,t)=>{t.d(n,{pO:()=>g,jd:()=>p,Tp:()=>h,w5:()=>f});var l=t(34727),r=t(83047),i=t(73941),o=t(79258);Math.PI;const s=o.$O.radius,a=o.$O.eccentricitySquared,u={a1:s*a,a2:s*a*s*a,a3:s*a*a/2,a4:s*a*s*a*2.5,a5:s*a+s*a*a/2,a6:1-a};o.$O.radius,o.$O.flattening,o.Sw.radius,o.Sw.flattening,o.sH.radius,o.sH.flattening,o.sH.radius;var c=t(21325);const f={2:{5:g,7:null,9:null,10:g,1:A,6:null,8:null,0:null,3:w,11:y,2:g,4:P},5:{5:g,7:null,9:null,10:g,1:A,6:null,8:null,0:null,3:w,11:y,2:g,4:P},7:{5:null,7:g,9:null,10:g,1:null,6:x,8:null,0:null,3:null,11:null,2:null,4:null},9:{5:null,7:null,9:g,10:g,1:null,6:null,8:R,0:null,3:null,11:null,2:null,4:null},3:{5:m,7:null,9:null,10:m,1:function(e,n,t,l){const r=e[n]/T,i=L-2*Math.atan(Math.exp(-e[n+1]/T)),o=T+e[n+2],s=Math.cos(i)*o;t[l]=Math.cos(r)*s,t[l+1]=Math.sin(r)*s,t[l+2]=Math.sin(i)*o},6:null,8:null,0:null,3:g,11:function(e,n,t,l){m(e,n,t,l),y(t,l,t,l)},2:m,4:function(e,n,t,l){m(e,n,t,l),P(t,l,t,l)}},4:{5:Z,7:null,9:null,10:Z,1:function(e,n,t,l){Z(e,n,t,l),A(t,l,t,l)},6:null,8:null,0:null,3:function(e,n,t,l){Z(e,n,t,l),w(t,l,t,l)},11:function(e,n,t,l){Z(e,n,t,l),y(t,l,t,l)},2:Z,4:g},1:{5:C,7:null,9:null,10:C,1:g,6:null,8:null,0:null,3:function(e,n,t,l){C(e,n,t,l),w(t,l,t,l)},11:function(e,n,t,l){C(e,n,t,l),y(t,l,t,l)},2:C,4:function(e,n,t,l){C(e,n,t,l),P(t,l,t,l)}},6:{5:null,7:I,9:null,10:I,1:null,6:g,8:null,0:null,3:null,11:null,2:null,4:null},8:{5:null,7:null,9:z,10:z,1:null,6:null,8:g,0:null,3:null,11:null,2:null,4:null},0:{5:null,7:null,9:null,10:null,1:null,6:null,8:null,0:g,3:null,11:null,2:null,4:null},10:{5:g,7:g,9:g,10:g,1:A,6:x,8:R,0:null,3:w,11:y,2:g,4:P},11:{5:v,7:null,9:null,10:v,1:function(e,n,t,l){v(e,n,t,l),A(t,l,t,l)},6:null,8:null,0:null,3:function(e,n,t,l){v(e,n,t,l),w(t,l,t,l)},11:g,2:v,4:function(e,n,t,l){v(e,n,t,l),P(t,l,t,l)}}};function p(e,n){return h(e,n)?.projector}function h(e,n){if(null==e||null==n)return null;if(O.source.spatialReference===e&&O.dest.spatialReference===n)return O;const t=d(e,O.source),l=d(n,O.dest);return 0===t&&0===l?(0,c.aI)(e,n)?O.projector=g:O.projector=null:O.projector=f[t][l],O}function d(e,n){return e?n.spatialReference===e?n.spatialReferenceId:(n.spatialReference=e,"metersPerUnit"in n&&(n.metersPerUnit=(0,r.GA)(e,1)),(0,i.jA)(e)?n.spatialReferenceId=1:(0,c.oT)(e)?n.spatialReferenceId=2:(0,c.K8)(e)?n.spatialReferenceId=3:(0,c.r1)(e)?n.spatialReferenceId=11:e.wkt===i.Ro.wkt?n.spatialReferenceId=4:4490===e.wkid?n.spatialReferenceId=5:e.wkt===i.FY.wkt?n.spatialReferenceId=6:e.wkt===i.LJ.wkt?n.spatialReferenceId=8:(0,c.q8)(e)?n.spatialReferenceId=7:(0,c.KQ)(e)?n.spatialReferenceId=9:n.spatialReferenceId=0):0}function g(e,n,t,l){e!==t&&(t[l++]=e[n++],t[l++]=e[n++],t[l]=e[n])}function m(e,n,t,l){t[l]=k*(e[n]/T),t[l+1]=k*(L-2*Math.atan(Math.exp(-e[n+1]/T))),t[l+2]=e[n+2]}function w(e,n,t,r){!function(e,n,t,r,i){const o=.4999999*Math.PI,s=(0,l.qE)(S*e[n+1],-o,o),a=Math.sin(s);t[r++]=S*e[n]*i.radius,t[r++]=i.halfSemiMajorAxis*Math.log((1+a)/(1-a)),t[r]=e[n+2]}(e,n,t,r,o.$O)}function y(e,n,t,l){t[l]=e[n]*b,t[l+1]=e[n+1]*b,t[l+2]=e[n+2]}function v(e,n,t,l){t[l]=e[n]*G,t[l+1]=e[n+1]*G,t[l+2]=e[n+2]}function M(e,n,t,l,r){const i=r+e[n+2],o=S*e[n+1],s=S*e[n],a=Math.cos(o)*i;t[l]=Math.cos(s)*a,t[l+1]=Math.sin(s)*a,t[l+2]=Math.sin(o)*i}function R(e,n,t,l){M(e,n,t,l,o.Sw.radius)}function x(e,n,t,l){M(e,n,t,l,o.sH.radius)}function A(e,n,t,l){M(e,n,t,l,o.$O.radius)}function j(e,n,t,r,i){const o=e[n],s=e[n+1],a=e[n+2],u=Math.sqrt(o*o+s*s+a*a),c=(0,l.YN)(a/(0===u?1:u)),f=Math.atan2(s,o);t[r++]=k*f,t[r++]=k*c,t[r]=u-i}function z(e,n,t,l){j(e,n,t,l,o.Sw.radius)}function I(e,n,t,l){j(e,n,t,l,o.sH.radius)}function C(e,n,t,l){j(e,n,t,l,o.$O.radius)}function P(e,n,t,l){!function(e,n,t,l,r){const i=S*e[n],o=S*e[n+1],s=e[n+2],a=Math.sin(o),u=Math.cos(o),c=r.radius/Math.sqrt(1-r.eccentricitySquared*a*a);t[l++]=(c+s)*u*Math.cos(i),t[l++]=(c+s)*u*Math.sin(i),t[l++]=(c*(1-r.eccentricitySquared)+s)*a}(e,n,t,l,o.$O)}function Z(e,n,t,l){const r=u,i=e[n],s=e[n+1],a=e[n+2];let c,f,p,h,d,g,m,w,y,v,M,R,x,A,j,z,I,C,P,Z,O;c=Math.abs(a),f=i*i+s*s,p=Math.sqrt(f),h=f+a*a,d=Math.sqrt(h),Z=Math.atan2(s,i),g=a*a/h,m=f/h,A=r.a2/d,j=r.a3-r.a4/d,m>.3?(w=c/d*(1+m*(r.a1+A+g*j)/d),P=Math.asin(w),v=w*w,y=Math.sqrt(1-v)):(y=p/d*(1-g*(r.a5-A-m*j)/d),P=Math.acos(y),v=1-y*y,w=Math.sqrt(v)),M=1-o.$O.eccentricitySquared*v,R=o.$O.radius/Math.sqrt(M),x=r.a6*R,A=p-R*y,j=c-x*w,I=y*A+w*j,z=y*j-w*A,C=z/(x/M+I),P+=C,O=I+z*C/2,a<0&&(P=-P),t[l++]=k*Z,t[l++]=k*P,t[l]=O}const O={source:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},dest:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},projector:g},S=(0,l.kU)(1),k=(0,l.KJ)(1),L=.5*Math.PI,T=o.$O.radius,b=T*Math.PI/180,G=180/(T*Math.PI)},62815:(e,n,t)=>{t.d(n,{N:()=>o});var l=t(83047),r=t(73941),i=t(21325);function o(e,n,t){if(null==n||null==t||t.vcsWkid||(0,i.aI)(n,t)||(0,r.xP)(n)||(0,r.xP)(t))return null;const o=(0,l.G9)(n)/(0,l.G9)(t);if(1===o)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,n){null!=e?.z&&(e.z*=n)}(e,o);case"polyline":case"esriGeometryPolyline":return e=>function(e,n){if(e)for(const t of e.paths)for(const e of t)e.length>2&&(e[2]*=n)}(e,o);case"polygon":case"esriGeometryPolygon":return e=>function(e,n){if(e)for(const t of e.rings)for(const e of t)e.length>2&&(e[2]*=n)}(e,o);case"multipoint":case"esriGeometryMultipoint":return e=>function(e,n){if(e)for(const t of e.points)t.length>2&&(t[2]*=n)}(e,o);case"extent":case"esriGeometryEnvelope":return e=>function(e,n){e&&null!=e.zmin&&null!=e.zmax&&(e.zmin*=n,e.zmax*=n)}(e,o);default:return null}}},72802:(e,n,t)=>{t.d(n,{U:()=>l});class l{constructor(e,n,t,l,r=void 0){this.id=e,this.level=n,this.row=t,this.col=l,this.extent=r}}},87045:(e,n,t)=>{t.d(n,{A:()=>R});var l,r=t(31635),i=t(66552),o=t(25482),s=t(83047),a=t(10107),u=t(56507),c=(t(44208),t(87811),t(36005)),f=t(40608),p=t(43937),h=t(86738),d=t(16930),g=t(19419),m=t(21325),w=t(28735),y=t(91806),v=t(72802);const M=new i.J({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let R=class extends o.o{static{l=this}static create(e={}){const{resolutionFactor:n=1,scales:t,size:r=256,spatialReference:i=d.A.WebMercator,numLODs:o=24}=e;if(!(0,m.fn)(i)){const e=[];if(t)for(let n=0;n<t.length;n++){const l=t[n];e.push(new y.A({level:n,scale:l,resolution:l}))}else{let n=5e-4;for(let t=o-1;t>=0;t--)e.unshift(new y.A({level:t,scale:n,resolution:n})),n*=2}return new l({dpi:96,lods:e,origin:new h.A(0,0,i),size:[r,r],spatialReference:i})}const a=(0,m.Vp)(i),u=e.origin?new h.A({x:e.origin.x,y:e.origin.y,spatialReference:i}):new h.A(a?{x:a.origin[0],y:a.origin[1],spatialReference:i}:{x:0,y:0,spatialReference:i}),c=1/(39.37*(0,s.GA)(i)*96),f=[];if(t)for(let e=0;e<t.length;e++){const n=t[e],l=n*c;f.push(new y.A({level:e,scale:n,resolution:l}))}else{let e=(0,m.EA)(i)?512/r*591657527.5917094:256/r*591657527.591555;const t=Math.ceil(o/n);f.push(new y.A({level:0,scale:e,resolution:e*c}));for(let l=1;l<t;l++){const t=e/2**n,r=t*c;f.push(new y.A({level:l,scale:t,resolution:r})),e=t}}return new l({dpi:96,lods:f,origin:u,size:[r,r],spatialReference:i})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:e,origin:n}=this;if(e&&n){const t=(0,m.Vp)(e);return e.isWrappable&&!!t&&Math.abs(t.origin[0]-n.x)<=t.dx}return!1}readOrigin(e,n){return h.A.fromJSON({spatialReference:n.spatialReference,...e})}set lods(e){let n=0,t=0;const l=[],r=this._levelToLOD={};e&&(n=-1/0,t=1/0,e.forEach(e=>{l.push(e.scale),n=e.scale>n?e.scale:n,t=e.scale<t?e.scale:t,r[e.level]=e})),this._set("scales",l),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,n){return[n.cols,n.rows]}writeSize(e,n){n.cols=e[0],n.rows=e[1]}zoomToScale(e){const n=this.scales;if(e<=0)return n[0];if(e>=n.length-1)return n[n.length-1];const t=Math.floor(e),l=t+1;return n[t]/(n[t]/n[l])**(e-t)}scaleToZoom(e){const n=this.scales,t=n.length-1;let l=0;for(;l<t;l++){const t=n[l],r=n[l+1];if(t<=e)return l;if(r===e)return l+1;if(t>e&&r<e)return l+Math.log(t/e)/Math.log(t/r)}return l}tileAt(e,n,t,l){const r=this.lodAt(e);if(!r)return null;let i,o;if("number"==typeof n)i=n,o=t;else if((0,m.aI)(n.spatialReference,this.spatialReference))i=n.x,o=n.y,l=t;else{const e=(0,w.Cv)(n,this.spatialReference);if(null==e)return null;i=e.x,o=e.y,l=t}const s=r.resolution*this.size[0],a=r.resolution*this.size[1];return l||(l=new v.U(null,0,0,0,(0,g.vt)())),l.level=e,l.row=Math.floor((this.origin.y-o)/a+.001),l.col=Math.floor((i-this.origin.x)/s+.001),this.updateTileInfo(l),l}updateTileInfo(e,n=0){let t=this.lodAt(e.level);if(!t&&1===n){const n=this.lods[this.lods.length-1];n.level<e.level&&(t=n)}if(!t)return;const l=e.level-t.level,r=t.resolution*this.size[0]/2**l,i=t.resolution*this.size[1]/2**l;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=(0,g.vt)()),e.extent[0]=this.origin.x+e.col*r,e.extent[1]=this.origin.y-(e.row+1)*i,e.extent[2]=e.extent[0]+r,e.extent[3]=e.extent[1]+i}upsampleTile(e){const n=this._upsampleLevels[e.level];return!(!n||-1===n.parentLevel||(e.level=n.parentLevel,e.row=Math.floor(e.row/n.factor+.001),e.col=Math.floor(e.col/n.factor+.001),this.updateTileInfo(e),0))}getTileBounds(e,n){const t=this.lodAt(n.level);if(null==t)return null;const{resolution:l}=t,r=l*this.size[0],i=l*this.size[1];return e[0]=this.origin.x+n.col*r,e[1]=this.origin.y-(n.row+1)*i,e[2]=e[0]+r,e[3]=e[1]+i,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return l.fromJSON(this.write({}))}getCompatibleForVTL(e){if(this.size[0]!==this.size[1]||256===this.size[0]&&512===e)return null;const n=(512===this.size[0]&&256===e?-1:0)+(this.spatialReference.isGeographic?1:0);if(this.size[0]===e&&0===n)return this;const t=[],r=this.lods.length-n;for(let e=0;e<r;e++){const l=e+n,{scale:r,resolution:i}=l>=0?this.lods[l]:{scale:2*this.lods[0].scale,resolution:2*this.lods[0].resolution};t.push(new y.A({level:e,scale:r,resolution:i}))}return new l({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:t})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let n=null;for(let t=0;t<e.length;t++){const l=e[t];this._upsampleLevels[l.level]={parentLevel:n?n.level:-1,factor:n?n.resolution/l.resolution:0},n=l}}};(0,r.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],R.prototype,"compressionQuality",void 0),(0,r.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],R.prototype,"dpi",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{read:M.read,write:M.write,origins:{"web-scene":{read:!1,write:!1}}}})],R.prototype,"format",void 0),(0,r.Cg)([(0,a.MZ)({readOnly:!0})],R.prototype,"isWrappable",null),(0,r.Cg)([(0,a.MZ)({type:h.A,json:{write:!0}})],R.prototype,"origin",void 0),(0,r.Cg)([(0,c.w)("origin")],R.prototype,"readOrigin",null),(0,r.Cg)([(0,a.MZ)({type:[y.A],value:null,json:{write:!0}})],R.prototype,"lods",null),(0,r.Cg)([(0,a.MZ)({readOnly:!0})],R.prototype,"scales",void 0),(0,r.Cg)([(0,a.MZ)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],R.prototype,"size",void 0),(0,r.Cg)([(0,c.w)("size",["rows","cols"])],R.prototype,"readSize",null),(0,r.Cg)([(0,p.K)("size",{cols:{type:u.jz},rows:{type:u.jz}})],R.prototype,"writeSize",null),(0,r.Cg)([(0,a.MZ)({type:d.A,json:{write:!0}})],R.prototype,"spatialReference",void 0),R=l=(0,r.Cg)([(0,f.$)("esri.layers.support.TileInfo")],R)},91218:(e,n,t)=>{t.r(n),t.d(n,{canProjectWithoutEngine:()=>V,initializeProjection:()=>B,isEqualBaseGCS:()=>_,isLoaded:()=>O,isLoadedOrLoad:()=>S,isLoadedOrLoadFor:()=>k,load:()=>T,project:()=>b,projectExtent:()=>te,projectMany:()=>G,projectMultipoint:()=>K,projectOrLoad:()=>$,projectOrLoadMany:()=>E,projectPoint:()=>J,projectPolygon:()=>ee,projectPolyline:()=>Y,projectWithZConversion:()=>U,projectWithoutEngine:()=>D,requiresLoad:()=>L,test:()=>W,tryProjectWithZConversion:()=>F,unload:()=>q});var l=t(49186),r=t(74887),i=t(62788),o=t(95488),s=t(51850),a=t(21276),u=t(73941),c=t(5443),f=t(91075),p=t(48526),h=t(86738),d=t(39829),g=t(82799),m=t(16930),w=t(159),y=t(9762),v=t(37539);function M(e,n,t,l,r,i){return R[0]=e,R[1]=n,R[2]=t,(0,y.projectBuffer)(R,l,0,r,i,0)}const R=(0,s.vt)();var x=t(21325),A=t(62815);let j=null,z=null,I=null,C=null,P={};const Z=new o.I;function O(){return!!(z?.isLoaded()&&I?.isLoaded()&&C?.isLoaded())}function S(){return!!O()||((0,i.gc)(Z),T(),!1)}function k(e,n){return!e||!n||V(e,n)||S()}function L(e,n){return!V(e,n)&&!O()}async function T(e){null==j&&(j=Promise.all([t.e(3276).then(t.bind(t,83276)).then(e=>(z=e,z.load())),t.e(8377).then(t.bind(t,8377)).then(e=>(I=e,I.load())),t.e(2158).then(t.bind(t,12158)).then(e=>(C=e,C.load()))])),await j,(0,r.Te)(e),Z.notify()}function b(e,n,t){return Array.isArray(e)?0===e.length?[]:((0,a.H)(e),G(e,e[0].spatialReference,n,t)):((0,a.f)(e),G([e],e.spatialReference,n,t)[0])}function G(e,n,t,l){if(null==n||null==t)return e;if(V(n,t,l))return e.map(e=>D(e,n,t));if(null==l?.geographicTransformation&&(0,u.jA)(n))return e.map(e=>D(e,n,m.A.WGS84)).map(e=>F(e,t));if(null==l?.geographicTransformation&&(0,u.jA)(t))return e.map(e=>F(e,m.A.WGS84)).map(e=>D(e,m.A.WGS84,t));if(!O())throw new N;if(!l?.geographicTransformation)if(l?.extendedParams)l={...l,geographicTransformation:C.getTransformation(n,t,l.areaOfInterestExtent)||new w.A};else if(!l?.areaOfInterestExtent){const e=function(e,n){return[e.wkid?.toString()??"-1",e.wkt?.toString()??"",e.wkt2?.toString()??"",n.wkid?.toString()??"-1",n.wkt?.toString()??"",n.wkt2?.toString()??""].join()}(n,t);let r=P[e];r||(r=C.getTransformation(n,t)||new w.A,P[e]=r),l={geographicTransformation:r}}return e[0].spatialReference||(e[0].spatialReference=n),e[0]instanceof f.A?z.executeMany(e,t,l):I.executeMany(e,t,l)}function $(e,n){const t=E([e],n);return null!=t.pending?{pending:t.pending,geometry:null}:null!=t.geometries?{pending:null,geometry:t.geometries[0]}:{pending:null,geometry:null}}function E(e,n){if(!O())for(const t of e)if(null!=t&&!(0,x.aI)(t.spatialReference,n)&&(0,x.fn)(t.spatialReference)&&(0,x.fn)(n)&&!V(t.spatialReference,n))return(0,i.gc)(Z),{pending:T(),geometries:null};return{pending:null,geometries:e.map(e=>null==e?null:(0,x.aI)(e.spatialReference,n)?e:(0,x.fn)(e.spatialReference)&&(0,x.fn)(n)?F(e,n):null)}}class N extends l.A{constructor(){super("projection:not-loaded","projection engine not fully loaded yet, please call load()")}}function q(){j=null,z=null,I=null,C=null,P={}}const W={get loadPromise(){return j}};function F(e,n){try{const t=b(e,n);if(null==t)return null;"xmin"in e&&"xmin"in t&&(t.zmin=e.zmin,t.zmax=e.zmax);const l=(0,A.N)(t.type,e.spatialReference,n);return null!=l&&l(t),t}catch(e){if(!(e instanceof N))throw e;return null}}async function U(e,n,t){const l=e.spatialReference;return null!=l&&null!=n&&await B(l,n,null,t),F(e,n)}function V(e,n,t){return!(t?.areaOfInterestExtent||t?.extendedParams||t?.geographicTransformation)&&(!!(0,x.aI)(e,n)||(0,x.fn)(e)&&(0,x.fn)(n)&&!!(0,v.jd)(e,n))}function _(e,n){if((0,x.aI)(e,n))return!0;if(!(0,x.fn)(e)||!(0,x.fn)(n))return!1;const t=(0,x.oT)(e)||(0,x.K8)(e)||(0,x.x1)(e),l=(0,x.oT)(n)||(0,x.K8)(n)||(0,x.x1)(n);return t&&l}async function B(e,n,t,l){if(O())return(0,r.NO)(l);if(Array.isArray(e)){for(const{source:n,dest:t,options:r}of e)if(n&&t&&!V(n,t,r))return T(l)}else if(e&&n&&!V(e,n,t))return T(l);return(0,r.NO)(l)}function D(e,n,t){return e?"x"in e?H(e,n,new h.A,t,0):"xmin"in e?le(e,n,new c.A,t,0):"rings"in e?ne(e,n,new d.A,t,0):"paths"in e?X(e,n,new g.A,t,0):"points"in e?Q(e,n,new p.A,t,0):null:null}function J(e,n,t=n.spatialReference,l=0){return null!=t&&null!=e.spatialReference&&null!=H(e,e.spatialReference,n,t,l)}function H(e,n,t,l,r){ie[0]=e.x,ie[1]=e.y;const i=e.z;return ie[2]=void 0!==i?i:r,(0,y.projectBuffer)(ie,n,0,ie,l,0)?(t.x=ie[0],t.y=ie[1],t.spatialReference=l,void 0!==i||(0,u.xP)(l)?(t.z=ie[2],t.hasZ=!0):(t.z=void 0,t.hasZ=!1),void 0===e.m?(t.m=void 0,t.hasM=!1):(t.m=e.m,t.hasM=!0),t):null}function K(e,n,t=n.spatialReference,l=0){return null!=e.spatialReference&&null!=t&&null!=Q(e,e.spatialReference,n,t,l)}function Q(e,n,t,l,r){const{points:i,hasZ:o,hasM:s}=e,a=[],c=i.length,f=[];for(const e of i)f.push(e[0],e[1],o?e[2]:r);if(!(0,y.projectBuffer)(f,n,0,f,l,0,c))return null;const p=o||(0,u.xP)(l);for(let e=0;e<c;++e){const n=3*e,t=f[n],l=f[n+1];p&&s?a.push([t,l,f[n+2],i[e][3]]):p?a.push([t,l,f[n+2]]):s?a.push([t,l,i[e][2]]):a.push([t,l])}return t.points=a,t.spatialReference=l,t.hasZ=o,t.hasM=s,t}function Y(e,n,t=n.spatialReference,l=0){return null!=e.spatialReference&&null!=t&&null!=X(e,e.spatialReference,n,t,l)}function X(e,n,t,l,r){const{paths:i,hasZ:o,hasM:s}=e,a=[];if(!re(i,o??!1,s??!1,n,a,l,r))return null;const c=o||(0,u.xP)(l);return t.paths=a,t.spatialReference=l,t.hasZ=c,t.hasM=s,t}function ee(e,n,t=n.spatialReference,l=0){return null!=e.spatialReference&&null!=t&&null!=ne(e,e.spatialReference,n,t,l)}function ne(e,n,t,l,r){const{rings:i,hasZ:o,hasM:s}=e,a=[];if(!re(i,o??!1,s??!1,n,a,l,r))return null;const c=o||(0,u.xP)(l);return t.rings=a,t.spatialReference=l,t.hasZ=c,t.hasM=s,t}function te(e,n,t=n.spatialReference,l=0){return null!=e.spatialReference&&null!=t&&null!=le(e,e.spatialReference,n,t,l)}function le(e,n,t,l,r){const{xmin:i,ymin:o,xmax:s,ymax:a,hasZ:c,hasM:f}=e;if(!M(i,o,c?e.zmin:r,n,ie,l))return null;const p=c||(0,u.xP)(l);return t.xmin=ie[0],t.ymin=ie[1],p&&(t.zmin=ie[2]),M(s,a,c?e.zmax:r,n,ie,l)?(t.xmax=ie[0],t.ymax=ie[1],p&&(t.zmax=ie[2]),f&&(t.mmin=e.mmin,t.mmax=e.mmax),t.spatialReference=l,t):null}function re(e,n,t,l,r,i,o=0){const s=new Array;for(const t of e)for(const e of t)s.push(e[0],e[1],n?e[2]:o);if(!(0,y.projectBuffer)(s,l,0,s,i,0))return!1;let a=0;r.length=0;const c=n||(0,u.xP)(i);for(const n of e){const e=new Array;for(const l of n)c&&t?e.push([s[a++],s[a++],s[a++],l[3]]):c?e.push([s[a++],s[a++],s[a++]]):t?(e.push([s[a++],s[a++],l[2]]),a++):(e.push([s[a++],s[a++]]),a++);r.push(e)}return!0}const ie=(0,s.vt)()},91806:(e,n,t)=>{t.d(n,{A:()=>u});var l,r=t(31635),i=t(25482),o=t(10107),s=t(56507),a=(t(44208),t(87811),t(40608));let u=class extends i.o{static{l=this}constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.origin=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new l({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,r.Cg)([(0,o.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],u.prototype,"cols",void 0),(0,r.Cg)([(0,o.MZ)({type:s.jz,json:{write:!0}})],u.prototype,"level",void 0),(0,r.Cg)([(0,o.MZ)({type:String,json:{write:!0}})],u.prototype,"levelValue",void 0),(0,r.Cg)([(0,o.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],u.prototype,"origin",void 0),(0,r.Cg)([(0,o.MZ)({type:Number,json:{write:!0}})],u.prototype,"resolution",void 0),(0,r.Cg)([(0,o.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],u.prototype,"rows",void 0),(0,r.Cg)([(0,o.MZ)({type:Number,json:{write:!0}})],u.prototype,"scale",void 0),u=l=(0,r.Cg)([(0,a.$)("esri.layers.support.LOD")],u)},99157:(e,n,t)=>{t.d(n,{A:()=>a});var l,r=t(31635),i=t(65008),o=t(10107),s=(t(44208),t(53966),t(87811),t(40608));let a=l=class extends i.A{constructor(e){super(e),this.isInverse=!1,this.wkt=null,this.wkid=null}getInverse(){return new l({isInverse:!this.isInverse,wkid:this.wkid,wkt:this.wkt})}};(0,r.Cg)([(0,o.MZ)()],a.prototype,"isInverse",void 0),(0,r.Cg)([(0,o.MZ)()],a.prototype,"wkt",void 0),(0,r.Cg)([(0,o.MZ)()],a.prototype,"wkid",void 0),a=l=(0,r.Cg)([(0,s.$)("esri.geometry.operators.support.GeographicTransformationStep")],a)}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5856],{35856:(t,n,e)=>{e.r(n),e.d(n,{SplatSortWorkerInput:()=>s,SplatSortWorkerOutput:()=>r,destroy:()=>f,sort:()=>h});class s{constructor(t,n){this.distances=t,this.sortOrderIndices=n}}class r{constructor(t,n){this.distances=t,this.sortedOrderIndices=n}}let l=null,o=null;const c=10,i=20,u=.25;function a(t,n){const e=t.length,s=Math.max(c,Math.min(i,Math.round(Math.log2(e/u)))),r=1+(1<<s);!function(t,n){l?.length!==t&&(l=new Uint32Array(t)),o&&o.length===1+(1<<n)?o.fill(0):o=new Uint32Array(1+(1<<n))}(e,s);let a=t[0],h=t[0];for(let n=0;n<t.length;n++)a=Math.min(a,t[n]),h=Math.max(h,t[n]);const f=h-a;if(f<1e-6)for(let t=0;t<e;++t)l[t]=0,o[0]++;else{const n=(1<<s)/f;for(let s=0;s<e;s++){const e=(t[s]-a)*n>>>0;l[s]=e,o[e]++}}for(let t=1;t<r;t++)o[t]+=o[t-1];for(let t=0;t<e;t++){const e=l[t];n[--o[e]]=t}}async function h(t){const{distances:n,sortOrderIndices:e}=t;return 0===n.length||0===e.length||a(n,e),{result:new r(n,e),transferList:[n.buffer,e.buffer]}}function f(){l=null,o=null}}}]);
|