@arcgis/core 6.0.0-next.54 → 6.0.0-next.56
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/WebScene.js +2 -2
- package/applications/Components/OrientedImageryViewer/shared/constants.js +1 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/validation/arcadeValidator.js +1 -1
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0329fa3aa3403f1c243b.js +1 -0
- package/assets/esri/core/workers/chunks/033b9fcd9833db3b6e7d.js +1 -0
- package/assets/esri/core/workers/chunks/{6602310c3fcd91fb6a2f.js → 07c8ac092e4b9e8d5b3c.js} +1 -1
- package/assets/esri/core/workers/chunks/0978e12dd6a1cbc50b80.js +1 -0
- package/assets/esri/core/workers/chunks/0a97b1974367382cfdf5.js +1 -0
- package/assets/esri/core/workers/chunks/{db0a7671ab5cbe8afd72.js → 123661019bb69c53f2d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{e956845255bce0910944.js → 1507297550c3cd1268e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b41ba050cde068d2860.js → 193a73a2c7f4f8482c21.js} +1 -1
- package/assets/esri/core/workers/chunks/1c0f5c42331fb6fc26cb.js +1 -0
- package/assets/esri/core/workers/chunks/20acb6f3ed5140b6c6c6.js +1 -0
- package/assets/esri/core/workers/chunks/2cd2fcf4a37d180d5d5c.js +1 -0
- package/assets/esri/core/workers/chunks/2f9adf0b809ce8797ebf.js +1 -0
- package/assets/esri/core/workers/chunks/{afb4dfb89fbc8a342cc5.js → 3354f1fa90f8ce4c8fde.js} +1 -1
- package/assets/esri/core/workers/chunks/3982409149571a827390.js +1 -0
- package/assets/esri/core/workers/chunks/{9b458b0d1627f22fdd93.js → 3b11e4d2e69b7aea1d65.js} +1 -1
- package/assets/esri/core/workers/chunks/3d851710f7fcc27c5b60.js +2 -0
- package/assets/esri/core/workers/chunks/3e8d70039800f2395d66.js +1 -0
- package/assets/esri/core/workers/chunks/41694ee8990e799da225.js +1 -0
- package/assets/esri/core/workers/chunks/4d8539674fc2e4fea03c.js +1 -0
- package/assets/esri/core/workers/chunks/{12add2003631fa314f25.js → 5060be52a380fc4920f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{2aa6be0b047a1b25a520.js → 53bbb9aa6e4e4a0a8121.js} +1 -1
- package/assets/esri/core/workers/chunks/{c6d82397044e403a1f61.js → 5954f02c3901b28d8e73.js} +1 -1
- package/assets/esri/core/workers/chunks/5ba6007c3c49a8153256.js +1 -0
- package/assets/esri/core/workers/chunks/5bdd95eeb8f34dbf26f2.js +2 -0
- package/assets/esri/core/workers/chunks/{4707aedcc1b3bdf5e987.js → 5c34d49a6c9cc34b7626.js} +1 -1
- package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js → 5e47026c681238038955.js} +2 -2
- package/assets/esri/core/workers/chunks/{2baf35b1b19482d603b5.js → 5f7505ada0991cfbdd84.js} +1 -1
- package/assets/esri/core/workers/chunks/{976303f47c342b9d1cc0.js → 62ddd3a82864e26f009a.js} +1 -1
- package/assets/esri/core/workers/chunks/69a09c6acb5ae03c67f6.js +1 -0
- package/assets/esri/core/workers/chunks/{542a9c414c99d84d52ab.js → 6a202ef9ba9b89e09153.js} +1 -1
- package/assets/esri/core/workers/chunks/{0826feebdca8a31eb630.js → 6ba6fece5c11fe2a6ace.js} +1 -1
- package/assets/esri/core/workers/chunks/{5eb69e2895e5aec81051.js → 6fd10891506925560443.js} +1 -1
- package/assets/esri/core/workers/chunks/7b156905d168bf973518.js +1 -0
- package/assets/esri/core/workers/chunks/7b6fd287e7043ad50f4e.js +1 -0
- package/assets/esri/core/workers/chunks/7baa49055bc31618b56e.js +1 -0
- package/assets/esri/core/workers/chunks/8570e3df90fb76a8741a.js +1 -0
- package/assets/esri/core/workers/chunks/{c3c0f24a9e0047232ae1.js → 8679dfc0c53355b6feb0.js} +1 -1
- package/assets/esri/core/workers/chunks/8a636dc51372e14c98f5.js +1 -0
- package/assets/esri/core/workers/chunks/{d14732a57c8e63948c60.js → 9117c9b720c9ba6e7a6e.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7e33d37dd11fb08f3f8.js → 97107e64407fa6825620.js} +1 -1
- package/assets/esri/core/workers/chunks/{5118c7269b706089c88e.js → a05a2c2aaf0c288f9681.js} +1 -1
- package/assets/esri/core/workers/chunks/{944f17e9c9f681b971fb.js → a12e2a345005189c64be.js} +1 -1
- package/assets/esri/core/workers/chunks/a22458e5272332d86cb9.js +1 -0
- package/assets/esri/core/workers/chunks/{15b3386ad92a0b4149b8.js → a24dc5350af001db417a.js} +1 -1
- package/assets/esri/core/workers/chunks/{10967a36c77c5188690d.js → a66d6298236d59a615db.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ea480cebf8ee56228a5.js → a7dfca326883384d2751.js} +1 -1
- package/assets/esri/core/workers/chunks/{723d8316f5d4b6ce2942.js → a9539393e2f1812a973a.js} +1 -1
- package/assets/esri/core/workers/chunks/{ac8d38016e4bee37a77c.js → ab784764ddf9d7f693a1.js} +1 -1
- package/assets/esri/core/workers/chunks/{255f5b45c4d32f97f86c.js → ac0861014b3d2f1a1de2.js} +1 -1
- package/assets/esri/core/workers/chunks/ace210d313ce53f3ae10.js +1 -0
- package/assets/esri/core/workers/chunks/ae48ee283cfa5b3c14b0.js +1 -0
- package/assets/esri/core/workers/chunks/b38b6fe08a367e9de4f5.js +1 -0
- package/assets/esri/core/workers/chunks/{4e651869e9a196494694.js → b6e628b5d2643af4c19b.js} +1 -1
- package/assets/esri/core/workers/chunks/{b37ab6b1cb4cfc85cd9d.js → b7828d7e2c5b75644057.js} +1 -1
- package/assets/esri/core/workers/chunks/bbd8fcb0bbba7bde3d9b.js +1 -0
- package/assets/esri/core/workers/chunks/{ec465abb0344ad719e9d.js → bd8e329ec74d921d311a.js} +1 -1
- package/assets/esri/core/workers/chunks/{56e6e70aa40e51827290.js → c3f94024c6c9eed9f273.js} +1 -1
- package/assets/esri/core/workers/chunks/{6d17b45022dfd2548098.js → c5ddf8b347c31fe772a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{ee9af58ae202b803bba7.js → c7a0c4ca37ebd1d98cf1.js} +1 -1
- package/assets/esri/core/workers/chunks/d0659f1b0495734be4b3.js +1 -0
- package/assets/esri/core/workers/chunks/d7763c42754152510e13.js +2 -0
- package/assets/esri/core/workers/chunks/{b9a2b05ede02c305e865.js → d8ffb1502def5c85740b.js} +1 -1
- package/assets/esri/core/workers/chunks/{7dfe1e78d2e66de6be22.js → d9ef244019954d5a8a27.js} +1 -1
- package/assets/esri/core/workers/chunks/{95403bb27a4ea0a4b7b1.js → ddbfa664e69612295785.js} +1 -1
- package/assets/esri/core/workers/chunks/dfa1b0308e5e82d1ddfe.js +1120 -0
- package/assets/esri/core/workers/chunks/e566102c7ed7a8ebf89e.js +1 -0
- package/assets/esri/core/workers/chunks/e74586b074d0fa6abb4b.js +1 -0
- package/assets/esri/core/workers/chunks/e7dff025780726d5feae.js +1 -0
- package/assets/esri/core/workers/chunks/e96fa029acba59c04e4e.js +2 -0
- package/assets/esri/core/workers/chunks/{55d28d3f5b8ced061e39.js → eaf73ce60f39a48ddd2a.js} +1 -1
- package/assets/esri/core/workers/chunks/ed2f2a5da830d058e339.js +1 -0
- package/assets/esri/core/workers/chunks/{e592f2483db71230e8e5.js → efd6ea0966f60ab19520.js} +1 -1
- package/assets/esri/core/workers/chunks/{944cb751c85d3a127f49.js → f52d081bbde5c95265cf.js} +1 -1
- package/assets/esri/core/workers/chunks/{1de9be7b65109c207bd5.js → fbd5f3b81cd9f061824d.js} +1 -1
- package/assets/esri/core/workers/chunks/fdfbd201be372d3796bf.js +2 -0
- package/assets/esri/core/workers/chunks/ff0a0819bba5e8264c47.js +1 -0
- package/assets/esri/layers/raster/formats/blosc-wasm.wasm +0 -0
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/basemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/chunks/BlendLayers.glsl.js +1 -1
- package/chunks/ColorMaterial.glsl.js +14 -14
- package/chunks/Component.glsl.js +37 -37
- package/chunks/CypherParser.js +1 -1
- package/chunks/DefaultMaterial.glsl.js +15 -15
- package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
- package/chunks/HUDMaterial.glsl.js +3 -3
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/Path.glsl.js +15 -15
- package/chunks/Pattern.glsl.js +20 -20
- package/chunks/RasterColorizer.glsl.js +1 -1
- package/chunks/ShadowHighlight.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +24 -24
- package/chunks/UnitFactory.js +1 -1
- package/chunks/Water.glsl.js +29 -20
- package/chunks/blosc-wasm.js +2 -0
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/parquet.js +1 -1
- package/chunks/pdf.js +57 -0
- package/chunks/text.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/write.js +1 -1
- package/core/scheduling.js +1 -1
- package/core/sql/SqlInterval.js +1 -1
- package/core/urlUtils.js +1 -1
- package/geometry/geometryEngine.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/support/Ellipsoid.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/geodesicConstants.js +1 -1
- package/geometry/support/meshUtils/primitives.js +1 -1
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -56
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/parserUtils.js +2 -0
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/parquet.js +1 -1
- package/layers/raster/datasets/ZarrRaster.js +1 -1
- package/layers/raster/datasets/wcsCoverageParser.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/blosc.js +2 -0
- package/layers/support/BuildingFilter.js +1 -1
- package/layers/support/ControlPoint.js +1 -1
- package/layers/support/ControlPointsGeoreference.js +1 -1
- package/layers/support/IntegratedMeshSemantics.js +1 -1
- package/layers/support/commonProperties.js +1 -1
- package/layers/support/fieldUtils.d.ts +23 -87
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/geospatialPDFUtils.d.ts +63 -0
- package/layers/support/geospatialPDFUtils.js +2 -0
- package/layers/support/layersMapping.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/legend/ActiveLayerInfo.js +1 -1
- package/libs/ajv/ajv.bundle-wrapper.js +1 -1
- package/package.json +6 -6
- package/renderers/types.d.ts +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
- package/smartMapping/statistics/support/attributeDensity.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/tests/serviceMockDependencies.js +1 -1
- package/symbols/CIMSymbol.d.ts +9 -9
- package/symbols/PathSymbol3DLayer.d.ts +1 -1
- package/symbols/WaterSymbol3DLayer.d.ts +13 -1
- package/symbols/WaterSymbol3DLayer.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
- package/symbols/cim/rasterizingUtils.js +1 -1
- package/views/2d/PaddedViewState.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
- package/views/2d/engine/vectorTiles/constants.js +1 -1
- package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/ParquetLayerView2D.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/camera/constraintUtils.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/EnvironmentView.js +1 -1
- package/views/3d/focusAreaUtils.js +1 -1
- package/views/3d/input/handlers/ground/GroundNavigation.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/Manipulator3DBase.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/config.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
- package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolFactory.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/Tiles3DBVH.js +1 -1
- package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +1 -1
- package/views/3d/layers/support/createTileBVHForLayer.js +1 -1
- package/views/3d/layers/support/selectTiles3DSpatialReference.js +1 -1
- package/views/3d/layers/support/uvUtils.js +1 -1
- package/views/3d/state/Constraints.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/RenderCoordsHelper.js +1 -1
- package/views/3d/support/SweptSphereVolume.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/engineContent/marker.js +1 -1
- package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/terrain/BlendLayersTechniqueConfiguration.js +1 -1
- package/views/3d/terrain/ExtentHelper.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/RasterColorizerTechniqueConfiguration.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TilingSchemeLogic.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/clampShadowPosition.glsl.js +2 -0
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +14 -14
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/Attribution.js +5 -5
- package/views/DOMContainer.d.ts +2 -1
- package/views/MapView.d.ts +1 -0
- package/views/SceneView.js +1 -1
- package/views/View2D.js +1 -1
- package/views/ViewingMode.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/helpMessageUtils.js +1 -1
- package/views/draw/support/managers/EditSessionManager.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/AddOrUpdatePart.js +1 -1
- package/views/layers/support/editableLayerViews.js +1 -1
- package/views/overlay/TextOverlayItem.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/support/spatialReferenceSupport.js +1 -1
- package/views/webgl/Program.js +3 -3
- package/views/webgl/ShaderBuilder.js +23 -23
- package/views/webgl/ShaderTranspiler.js +2 -2
- package/webscene/Slide.js +1 -1
- package/webscene/VirtualLighting.d.ts +2 -4
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +17 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.d.ts +7 -0
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Legend/styles/card/ColorRamp.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Measurement.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/Weather/WeatherViewModel.js +1 -1
- package/widgets/Weather/css.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/ContingentValuesManager.js +1 -1
- package/widgets/support/forms/types.d.ts +23 -1
- package/assets/esri/core/workers/chunks/021bd07b9a3e70598840.js +0 -1
- package/assets/esri/core/workers/chunks/032733b863426c5bde00.js +0 -1121
- package/assets/esri/core/workers/chunks/144f18a3dd2c8cf07cf7.js +0 -1
- package/assets/esri/core/workers/chunks/170e68624b71ac96de4a.js +0 -1
- package/assets/esri/core/workers/chunks/23fc1c1ed483ed3b2298.js +0 -1
- package/assets/esri/core/workers/chunks/2634927d26cb1139c6d0.js +0 -1
- package/assets/esri/core/workers/chunks/2d1b8154ee40afc9d40b.js +0 -1
- package/assets/esri/core/workers/chunks/2d3e977f3b75474d7ebc.js +0 -1
- package/assets/esri/core/workers/chunks/4a41bf3d1e2e9bb79771.js +0 -2
- package/assets/esri/core/workers/chunks/5f324d88785ffcb73ae0.js +0 -1
- package/assets/esri/core/workers/chunks/70695e0fb53018d48e7b.js +0 -2
- package/assets/esri/core/workers/chunks/723c9ad4c25be2b82476.js +0 -1
- package/assets/esri/core/workers/chunks/766a1357be2ed7f4e125.js +0 -1
- package/assets/esri/core/workers/chunks/817bf487df056da1e6ec.js +0 -1
- package/assets/esri/core/workers/chunks/89e55895683369b5277a.js +0 -1
- package/assets/esri/core/workers/chunks/8a820e303941b351de81.js +0 -1
- package/assets/esri/core/workers/chunks/8c94e987754b3919181e.js +0 -1
- package/assets/esri/core/workers/chunks/90d567e920b6982b402d.js +0 -1
- package/assets/esri/core/workers/chunks/919115788da38049aea7.js +0 -2
- package/assets/esri/core/workers/chunks/97cdcedfe853280f6258.js +0 -1
- package/assets/esri/core/workers/chunks/9ebc6026934400fc1e1f.js +0 -1
- package/assets/esri/core/workers/chunks/b33e7e74cf8fa3926617.js +0 -1
- package/assets/esri/core/workers/chunks/b4a325dcf50e276751d7.js +0 -1
- package/assets/esri/core/workers/chunks/bb2af16e55cb39163827.js +0 -1
- package/assets/esri/core/workers/chunks/be5857b0d1b00faf430b.js +0 -1
- package/assets/esri/core/workers/chunks/cd9100a7c8309dfa7569.js +0 -1
- package/assets/esri/core/workers/chunks/d5bb9f9b7b341c671525.js +0 -1
- package/assets/esri/core/workers/chunks/d96e63d66f7b1f4ea54a.js +0 -2
- package/assets/esri/core/workers/chunks/e3bcd2e356f75afc316a.js +0 -1
- package/assets/esri/core/workers/chunks/e507dfc4788295d9c244.js +0 -1
- package/assets/esri/core/workers/chunks/e58f51618251f74aaafd.js +0 -1
- package/assets/esri/core/workers/chunks/e80526571f1a34de3278.js +0 -1
- package/assets/esri/core/workers/chunks/e83806797979138fd22a.js +0 -1
- package/assets/esri/core/workers/chunks/ea71850ba87ae6038000.js +0 -1
- package/assets/esri/core/workers/chunks/f537a5e808dc546813c7.js +0 -1
- package/assets/esri/core/workers/chunks/fe811d651d201f698b8f.js +0 -2
- package/chunks/NativeLine.glsl.js +0 -8
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +0 -2
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +0 -2
- package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +0 -2
- /package/assets/esri/core/workers/chunks/{919115788da38049aea7.js.LICENSE.txt → 3d851710f7fcc27c5b60.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{fe811d651d201f698b8f.js.LICENSE.txt → 5bdd95eeb8f34dbf26f2.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js.LICENSE.txt → 5e47026c681238038955.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{4a41bf3d1e2e9bb79771.js.LICENSE.txt → d7763c42754152510e13.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d96e63d66f7b1f4ea54a.js.LICENSE.txt → e96fa029acba59c04e4e.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{70695e0fb53018d48e7b.js.LICENSE.txt → fdfbd201be372d3796bf.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{measurementLengthUnits as r,measurementAreaUnits as i}from"../../../core/units.js";import{loadCalciteComponents as a}from"../../support/componentsUtils.js";import{messageBundle as o}from"../../support/decorators/messageBundle.js";import{UnitSelect as s}from"../../support/UnitSelect.js";import{tsx as c}from"../../support/widget.js";import l from"../../Widget.js";import{css as u}from"../css.js";import{TriangulatedImageMeasurementMixin as d}from"../mixins/TriangulatedImageMeasurementMixin.js";let f=class extends d(l){constructor(e){super(e),this.messagesCommon=null}loadDependencies(){return a({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),table:()=>import(`@esri/calcite-components/dist/components/calcite-table`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),"table-row":()=>import(`@esri/calcite-components/dist/components/calcite-table-row`),"table-header":()=>import(`@esri/calcite-components/dist/components/calcite-table-header`),"table-cell":()=>import(`@esri/calcite-components/dist/components/calcite-table-cell`)})}get _measurementResult(){let{measurementType:e,oiViewModel:t}=this,{areaMeasurementResult:n,heightMeasurementResult:r,distanceMeasurementResult:i}=t;switch(e){case`area`:return n;case`height`:return r;case`distance`:return i}}get _measurementAccuracy(){let{measurementType:e,oiViewModel:t}=this,{areaMeasurementAccuracy:n,heightMeasurementAccuracy:r,distanceAccuracyArray:i}=t;switch(e){case`area`:return n;case`height`:return r;case`distance`:return i}}get _measurementUnit(){let{measurementType:e,pixelAreaMeasurementUnit:t,pixelMeasurementUnit:n}=this;
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{measurementLengthUnits as r,measurementAreaUnits as i}from"../../../core/units.js";import{loadCalciteComponents as a}from"../../support/componentsUtils.js";import{messageBundle as o}from"../../support/decorators/messageBundle.js";import{UnitSelect as s}from"../../support/UnitSelect.js";import{tsx as c}from"../../support/widget.js";import l from"../../Widget.js";import{css as u}from"../css.js";import{TriangulatedImageMeasurementMixin as d}from"../mixins/TriangulatedImageMeasurementMixin.js";let f=class extends d(l){constructor(e){super(e),this.messagesCommon=null}loadDependencies(){return a({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),table:()=>import(`@esri/calcite-components/dist/components/calcite-table`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),"table-row":()=>import(`@esri/calcite-components/dist/components/calcite-table-row`),"table-header":()=>import(`@esri/calcite-components/dist/components/calcite-table-header`),"table-cell":()=>import(`@esri/calcite-components/dist/components/calcite-table-cell`)})}get _measurementResult(){let{measurementType:e,oiViewModel:t}=this,{areaMeasurementResult:n,heightMeasurementResult:r,distanceMeasurementResult:i}=t;switch(e){case`area`:return n;case`height`:return r;case`distance`:return i}}get _measurementAccuracy(){let{measurementType:e,oiViewModel:t}=this,{areaMeasurementAccuracy:n,heightMeasurementAccuracy:r,distanceAccuracyArray:i}=t;switch(e){case`area`:return n;case`height`:return r;case`distance`:return i}}get _measurementUnit(){let{measurementType:e,pixelAreaMeasurementUnit:t,pixelMeasurementUnit:n}=this;return e===`area`?t:n}get _measurementUnitOptions(){let{measurementType:e}=this;return e===`area`?i:r}_convertedMeasurement(){let{measurementType:e}=this;switch(e){case`area`:return this.getConvertedAreaString(`measurement`);case`height`:return this.getConvertedHeightString(`measurement`);case`distance`:return this.getConvertedDistanceString(`measurement`)}}_measurementUnitChangeHandler(e){let{measurementType:t}=this;t===`area`?this.pixelAreaMeasurementUnit=e:this.pixelMeasurementUnit=e}_renderUnitSelect(){let{_measurementUnit:e,_measurementResult:t,_measurementUnitOptions:n,oiViewModel:r,messagesCommon:i}=this,{triangularMeasurementActive:a}=r;return t?c(`div`,{class:u.measurementsBar},c(s,{options:n,selectLabel:``,value:e,onChange:e=>this._measurementUnitChangeHandler(e)}),t?c(`calcite-action`,{bind:this,icon:`copy-to-clipboard`,label:`copy`,scale:`s`,text:``,title:i.copy,onclick:()=>this.copyActiveMeasurementResults(this.measurementType,a)}):null):null}_renderMeasurementResults(){let{_measurementResult:e,_measurementAccuracy:t,messages:n,measurementType:r}=this,{measurementTable:i,value:a,accuracy:o}=n;return e?c(`calcite-table`,{bordered:!0,caption:i,class:u.measurementsTable,scale:`s`},c(`calcite-table-row`,{slot:`table-header`},c(`calcite-table-header`,{alignment:`center`,heading:a}),c(`calcite-table-header`,{alignment:`center`,heading:o})),c(`calcite-table-row`,null,c(`calcite-table-cell`,{alignment:`center`},this._convertedMeasurement()),c(`calcite-table-cell`,{alignment:`center`},r===`distance`&&Array.isArray(t)&&t?.length||r===`area`&&t||r===`height`&&t?this.getAccuracy(this.measurementType):c(`calcite-icon`,{icon:`hourglass-active`,scale:`s`})))):null}_renderActiveMeasurementResults(){let{oiViewModel:e}=this,{triangularMeasurementActive:t,measureType:n}=e;if(t)switch(n){case`area`:return this._renderTriangularAreaMeasurementResults();case`distance`:return this._renderTriangularDistanceMeasurementResults()}return this._renderMeasurementResults()}_renderNewMeasurementButton(){let{messages:e,measurementType:t}=this;return c(`calcite-button`,{class:u.measurementsButton,onclick:()=>this.oiViewModel.initializeMeasurement(t)},e.newMeasurement)}_renderStartMeasurementMessage(){let{oiViewModel:{displayNewMeasurementButton:e},messages:t,_measurementResult:n}=this;return!e&&!n&&c(`div`,{class:u.measurementDisplay,key:`start-measurement-${this.measurementType}`},t.startMeasurement)}_renderTriangularAreaMeasurementResults(){let{messages:e,oiViewModel:t}=this,{measurementTable:n,value:r,accuracy:i}=e,{triangulatedAreaMeasurement:a}=t;return a?c(`calcite-table`,{bordered:!0,caption:n,class:u.measurementsTable,scale:`s`},c(`calcite-table-row`,{slot:`table-header`},c(`calcite-table-header`,{alignment:`center`,heading:r}),c(`calcite-table-header`,{alignment:`center`,heading:i})),c(`calcite-table-row`,null,this._renderTriangularAreaCell(`measurement`),this._renderTriangularAreaCell(`accuracy`))):null}_renderTriangularDistanceAccuracyCell(){let{oiViewModel:e}=this,{triangulatedDistanceAccuracy:t}=e;return c(`calcite-table-cell`,{alignment:`center`},t?.distanceAccuracy?this.getConvertedTriangularDistanceMeasurementString(t.distanceAccuracy):c(`calcite-icon`,{icon:`hourglass-active`,scale:`s`}))}_renderTriangularAreaCell(e){let{oiViewModel:t}=this,{triangulatedAreaMeasurement:n}=t;return c(`calcite-table-cell`,{alignment:`center`},n?this.getConvertedTriangularAreaString(e):c(`calcite-icon`,{icon:`hourglass-active`,scale:`s`}))}_renderTriangularDistanceAngleAccuracyCell(){let{oiViewModel:e}=this,{triangulatedDistanceAccuracy:t}=e;return c(`calcite-table-cell`,{alignment:`center`},t?.angleAccuracy?this.getConvertedTriangularDistanceAngularResultsString(t.angleAccuracy):c(`calcite-icon`,{icon:`hourglass-active`,scale:`s`}))}_renderTriangularDistanceMeasurementResults(){let{oiViewModel:e,messages:t}=this,{distance:n,horizontal:r,vertical:i,slope:a,aspect:o,measurementTable:s,value:l,accuracy:d,type:f}=t,{triangulatedDistanceMeasurement:p,triangularMeasurementActive:m,measureType:h}=e;return!m||h!==`distance`?null:p?c(`calcite-table`,{bordered:!0,caption:s,class:u.measurementsTable,scale:`s`},c(`calcite-table-row`,{slot:`table-header`},c(`calcite-table-header`,{alignment:`center`,heading:f}),c(`calcite-table-header`,{alignment:`center`,heading:l}),c(`calcite-table-header`,{alignment:`center`,heading:d})),c(`calcite-table-row`,null,c(`calcite-table-cell`,{alignment:`center`},n),c(`calcite-table-cell`,{alignment:`center`},p?.distance?this.getConvertedTriangularDistanceMeasurementString(p.distance):c(`calcite-icon`,{icon:`hourglass-active`,scale:`s`})),this._renderTriangularDistanceAccuracyCell()),c(`calcite-table-row`,null,c(`calcite-table-cell`,{alignment:`center`},r),c(`calcite-table-cell`,{alignment:`center`},p?.horizontalDistance?this.getConvertedTriangularDistanceMeasurementString(p.horizontalDistance):c(`calcite-icon`,{icon:`hourglass-active`,scale:`s`})),this._renderTriangularDistanceAccuracyCell()),c(`calcite-table-row`,null,c(`calcite-table-cell`,{alignment:`center`},i),c(`calcite-table-cell`,{alignment:`center`},p?.verticalDistance?this.getConvertedTriangularDistanceMeasurementString(p.verticalDistance):c(`calcite-icon`,{icon:`hourglass-active`,scale:`s`})),this._renderTriangularDistanceAccuracyCell()),c(`calcite-table-row`,null,c(`calcite-table-cell`,{alignment:`center`},a),c(`calcite-table-cell`,{alignment:`center`},p?.slope?this.getConvertedTriangularDistanceAngularResultsString(p.slope):c(`calcite-icon`,{icon:`hourglass-active`,scale:`s`})),this._renderTriangularDistanceAngleAccuracyCell()),c(`calcite-table-row`,null,c(`calcite-table-cell`,{alignment:`center`},o),c(`calcite-table-cell`,{alignment:`center`},p?.aspect?this.getConvertedTriangularDistanceAngularResultsString(p.aspect):c(`calcite-icon`,{icon:`hourglass-active`,scale:`s`})),this._renderTriangularDistanceAngleAccuracyCell())):null}render(){return c(`calcite-panel`,{class:u.measurementResults,key:`measurement-result-container-${this.measurementType}`},this._renderStartMeasurementMessage(),this._renderNewMeasurementButton(),this._renderUnitSelect(),this._renderActiveMeasurementResults())}};e([t(),o(`esri/t9n/common`)],f.prototype,`messagesCommon`,void 0),e([t()],f.prototype,`_measurementResult`,null),e([t()],f.prototype,`_measurementAccuracy`,null),e([t()],f.prototype,`_measurementUnit`,null),e([t()],f.prototype,`_measurementUnitOptions`,null),f=e([n(`esri.widgets.OrientedImageryViewer.components.ImageMeasurementWidget`)],f);const p=f;export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";import{clone as t}from"../../../core/lang.js";import n from"../../../core/Logger.js";import{mappedFind as r}from"../../../core/maybe.js";import{getMetersPerUnitForSR as i}from"../../../core/units.js";import a from"../../../geometry/Polygon.js";import{getExtentFromGeometry as o,scaleExtent as s}from"../../../geometry/support/geometryUtils.js";import{substitute as c,formatDate as l}from"../../../intl.js";import{getPopupLayer as u}from"../../../popup/support/featureUtils.js";import d from"../../../rest/support/FullTextSearch.js";const f=/https?:\/\/services.*\.arcgis\.com/i,p=/(?:\{([^}]+)\})/g,m=()=>n.getLogger(`esri.widgets.Search.support.layerSearchUtils`);function h(t,n){let{exactMatch:r=!1,location:a,maxResults:o,spatialReference:s,source:c,sourceIndex:l,suggestResult:u,view:d}=t,{layer:f,zoomScale:p}=c,h=d?.scale,g=_(c,d),x=n?.signal;return y(f).then(()=>{let e=f.popupTemplate;return e?e.getRequiredFields(f.fieldsIndex):null}).then(t=>{let{objectIdField:n,returnZ:_}=f,y=O(c);if(!A(f,y))throw m().error(`invalid-field: displayField is invalid.`),new e(`getResults():invalid-field`,`displayField is invalid.`);let S=t?.length?t:[y],w=c.outFields||S,T=v(w);if(!w.includes(n)&&!T&&w.push(n),f.floorInfo?.floorField&&w.push(f.floorInfo.floorField),!(T||k(f,w)))throw m().error(`invalid-field: outField is invalid.`),new e(`getResults():invalid-field`,`outField is invalid.`);let D=f.createQuery(),{orderByFields:j}=c;if(j&&(D.orderByFields=j),s){D.outSpatialReference=s;let e=1/i(s);e&&(D.maxAllowableOffset=e)}let M=f.geometryType===`mesh`||f.geometryType===`multipatch`;if(D.returnZ=f.capabilities?.data?.supportsZ&&!M&&_!==!1,D.returnGeometry=!0,D.multipatchOption=M?`xyFootprint`:null,w&&(D.outFields=w),a)D.geometry=a;else if(u.key)D.objectIds=[u.key];else{let t=c.searchFields||[y];if(!k(f,t))throw m().error(`invalid-field: search field is invalid.`),new e(`getResults():invalid-field`,`search field is invalid.`);E(f)&&(D.num=o),g&&(D.geometry=g);let n=u.text;if(!n?.trim()||(C({source:c,searchTerm:n,searchFields:t,exactMatch:r,query:D,type:`search`}),!b(D)))return[]}return f.queryFeatures(D,{signal:x}).then(async e=>{let{labelPointExecute:t}=await import(`../../../geometry/operators/labelPointOperator.js`);return K(e,d,c,l,y,h,p,t)})})}function g(t,n){let{source:r,spatialReference:i,view:a,suggestTerm:o,maxSuggestions:s,sourceIndex:c,exactMatch:l}=t,{layer:u}=r,d=n?.signal,f=_(r,a);return y(u).then(()=>{if(!E(u))return[];let t=O(r),n=r.searchFields||[t],a=[];r.suggestionTemplate?r.suggestionTemplate.replaceAll(p,(e,t)=>(a.push(t),e)):a.push(t);let h=v(a);!a.includes(u.objectIdField)&&!h&&a.push(u.objectIdField);let g=A(u,t),_=h||k(u,a),y=k(u,n);if(!g)throw m().error(`invalid-field: displayField is invalid.`),new e(`getSuggestions():invalid-field`,`displayField is invalid.`);if(!_)throw m().error(`invalid-field: outField is invalid.`),new e(`getSuggestions():invalid-field`,`outField is invalid.`);if(!y)throw m().error(`invalid-field: search field is invalid.`),new e(`getSuggestions():invalid-field`,`search field is invalid.`);let x=u.createQuery(),{orderByFields:S}=r;return S&&(x.orderByFields=S),x.outSpatialReference=i,x.returnGeometry=!1,x.num=s,x.outFields=a,f&&(x.geometry=f),!o.trim()||(C({source:r,searchTerm:o,searchFields:n,exactMatch:l,query:x,type:`suggest`}),!b(x))?[]:u.queryFeatures(x,{signal:d}).then(e=>U(e,r,c,t))})}function _(e,t){let{filter:n,withinViewEnabled:r}=e,i=t?.extent;return n?.geometry??(r&&i?i:void 0)}function v(e){return e&&e.includes(`*`)}async function y(t){if(!t)throw new e(`search:missing-layer`,`A layer is required for a layer search source.`);await t.load()}function b(e){return!!(e.fullText||e.where)}function x(e,t){let n=e?.indexes;return!n||!t?.length?!1:n.filter(e=>e.indexType===`FullText`).some(e=>{let n=e.fields?.split(`,`).map(e=>e.trim().toLowerCase())||[];return t.every(e=>n.includes(e.toLowerCase()))})}function S({text:e,searchFields:t,searchType:n=`prefix`}){return(n===`simple`?[e.trim()]:e.trim().split(` `)).filter(e=>!!e.trim()).map(e=>new d({onFields:t,searchTerm:e,searchType:n}))}function C({source:e,searchTerm:t,searchFields:n,exactMatch:r,query:i,type:a}){let{layer:o,filter:s,prefix:c=``,suffix:l=``,searchMode:u}=e,d=w(u,r,o,n);d.fullTextSearchType&&t&&(i.fullText=S({text:t,searchFields:n,searchType:d.fullTextSearchType})),i.where=L({searchTerm:N(`${c}${t}${l}`),layer:o,searchFields:n,filter:s,exactMatch:d.exactMatch,query:i,type:a})}function w(e,t,n,r){let i=T(n)&&x(n,r),a=e??(t?`simple`:`starts-with`);return a===`simple`?{exactMatch:!0,fullTextSearchType:null}:e===`starts-with`?{exactMatch:!1,fullTextSearchType:null}:a===`full-text-simple`?i?{exactMatch:!1,fullTextSearchType:`simple`}:{exactMatch:!0,fullTextSearchType:null}:i?{exactMatch:!1,fullTextSearchType:`prefix`}:{exactMatch:!1,fullTextSearchType:null}}function T(e){return e?.capabilities?.query?.supportsFullTextSearch??!1}function E(e){return e?.capabilities?.query?.supportsPagination??!1}function D(e){return e?.fieldsIndex?.fields?.find(e=>e.type===`string`)?.name??``}function O(e){return e.displayField||e.layer.displayField||D(e.layer)}function k(e,t){return!e||!t?.length?!1:t.every(t=>A(e,t))}function A(e,t){return!!e.getField(t)}function j(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function M({codedValues:e},t,n){return r(e??[],e=>{let r=e.name,i=n?r:r.toLowerCase();return(n?t:t.toLowerCase())===i?e.code.toString():null})??null}function N(e){return e.replaceAll(`'`,`''`)}function P(e,t){let n=t?.where;return n?`(${e}) AND (${n})`:e}function F({currentTerm:e,field:t,filter:n,exactMatch:r,url:i,type:a}){let o=t?.type,s=t?.name;if(o===`string`||o===`date`||o===`global-id`){let t=f.test(i??``),o=t&&j(e)?`N`:``;return P(r&&a===`search`?`${s} = ${o}'${e}'`:t?`${s} LIKE ${o}
|
|
2
|
+
import e from"../../../core/Error.js";import{clone as t}from"../../../core/lang.js";import n from"../../../core/Logger.js";import{mappedFind as r}from"../../../core/maybe.js";import{getMetersPerUnitForSR as i}from"../../../core/units.js";import a from"../../../geometry/Polygon.js";import{getExtentFromGeometry as o,scaleExtent as s}from"../../../geometry/support/geometryUtils.js";import{substitute as c,formatDate as l}from"../../../intl.js";import{getPopupLayer as u}from"../../../popup/support/featureUtils.js";import d from"../../../rest/support/FullTextSearch.js";const f=/https?:\/\/services.*\.arcgis\.com/i,p=/(?:\{([^}]+)\})/g,m=()=>n.getLogger(`esri.widgets.Search.support.layerSearchUtils`);function h(t,n){let{exactMatch:r=!1,location:a,maxResults:o,spatialReference:s,source:c,sourceIndex:l,suggestResult:u,view:d}=t,{layer:f,zoomScale:p}=c,h=d?.scale,g=_(c,d),x=n?.signal;return y(f).then(()=>{let e=f.popupTemplate;return e?e.getRequiredFields(f.fieldsIndex):null}).then(t=>{let{objectIdField:n,returnZ:_}=f,y=O(c);if(!A(f,y))throw m().error(`invalid-field: displayField is invalid.`),new e(`getResults():invalid-field`,`displayField is invalid.`);let S=t?.length?t:[y],w=c.outFields||S,T=v(w);if(!w.includes(n)&&!T&&w.push(n),f.floorInfo?.floorField&&w.push(f.floorInfo.floorField),!(T||k(f,w)))throw m().error(`invalid-field: outField is invalid.`),new e(`getResults():invalid-field`,`outField is invalid.`);let D=f.createQuery(),{orderByFields:j}=c;if(j&&(D.orderByFields=j),s){D.outSpatialReference=s;let e=1/i(s);e&&(D.maxAllowableOffset=e)}let M=f.geometryType===`mesh`||f.geometryType===`multipatch`;if(D.returnZ=f.capabilities?.data?.supportsZ&&!M&&_!==!1,D.returnGeometry=!0,D.multipatchOption=M?`xyFootprint`:null,w&&(D.outFields=w),a)D.geometry=a;else if(u.key)D.objectIds=[u.key];else{let t=c.searchFields||[y];if(!k(f,t))throw m().error(`invalid-field: search field is invalid.`),new e(`getResults():invalid-field`,`search field is invalid.`);E(f)&&(D.num=o),g&&(D.geometry=g);let n=u.text;if(!n?.trim()||(C({source:c,searchTerm:n,searchFields:t,exactMatch:r,query:D,type:`search`}),!b(D)))return[]}return f.queryFeatures(D,{signal:x}).then(async e=>{let{labelPointExecute:t}=await import(`../../../geometry/operators/labelPointOperator.js`);return K(e,d,c,l,y,h,p,t)})})}function g(t,n){let{source:r,spatialReference:i,view:a,suggestTerm:o,maxSuggestions:s,sourceIndex:c,exactMatch:l}=t,{layer:u}=r,d=n?.signal,f=_(r,a);return y(u).then(()=>{if(!E(u))return[];let t=O(r),n=r.searchFields||[t],a=[];r.suggestionTemplate?r.suggestionTemplate.replaceAll(p,(e,t)=>(a.push(t),e)):a.push(t);let h=v(a);!a.includes(u.objectIdField)&&!h&&a.push(u.objectIdField);let g=A(u,t),_=h||k(u,a),y=k(u,n);if(!g)throw m().error(`invalid-field: displayField is invalid.`),new e(`getSuggestions():invalid-field`,`displayField is invalid.`);if(!_)throw m().error(`invalid-field: outField is invalid.`),new e(`getSuggestions():invalid-field`,`outField is invalid.`);if(!y)throw m().error(`invalid-field: search field is invalid.`),new e(`getSuggestions():invalid-field`,`search field is invalid.`);let x=u.createQuery(),{orderByFields:S}=r;return S&&(x.orderByFields=S),x.outSpatialReference=i,x.returnGeometry=!1,x.num=s,x.outFields=a,f&&(x.geometry=f),!o.trim()||(C({source:r,searchTerm:o,searchFields:n,exactMatch:l,query:x,type:`suggest`}),!b(x))?[]:u.queryFeatures(x,{signal:d}).then(e=>U(e,r,c,t))})}function _(e,t){let{filter:n,withinViewEnabled:r}=e,i=t?.extent;return n?.geometry??(r&&i?i:void 0)}function v(e){return e&&e.includes(`*`)}async function y(t){if(!t)throw new e(`search:missing-layer`,`A layer is required for a layer search source.`);await t.load()}function b(e){return!!(e.fullText||e.where)}function x(e,t){let n=e?.indexes;return!n||!t?.length?!1:n.filter(e=>e.indexType===`FullText`).some(e=>{let n=e.fields?.split(`,`).map(e=>e.trim().toLowerCase())||[];return t.every(e=>n.includes(e.toLowerCase()))})}function S({text:e,searchFields:t,searchType:n=`prefix`}){return(n===`simple`?[e.trim()]:e.trim().split(` `)).filter(e=>!!e.trim()).map(e=>new d({onFields:t,searchTerm:e,searchType:n}))}function C({source:e,searchTerm:t,searchFields:n,exactMatch:r,query:i,type:a}){let{layer:o,filter:s,prefix:c=``,suffix:l=``,searchMode:u}=e,d=w(u,r,o,n);d.fullTextSearchType&&t&&(i.fullText=S({text:t,searchFields:n,searchType:d.fullTextSearchType})),i.where=L({searchTerm:N(`${c}${t}${l}`),layer:o,searchFields:n,filter:s,exactMatch:d.exactMatch,query:i,type:a})}function w(e,t,n,r){let i=T(n)&&x(n,r),a=e??(t?`simple`:`starts-with`);return a===`simple`?{exactMatch:!0,fullTextSearchType:null}:e===`starts-with`?{exactMatch:!1,fullTextSearchType:null}:a===`full-text-simple`?i?{exactMatch:!1,fullTextSearchType:`simple`}:{exactMatch:!0,fullTextSearchType:null}:i?{exactMatch:!1,fullTextSearchType:`prefix`}:{exactMatch:!1,fullTextSearchType:null}}function T(e){return e?.capabilities?.query?.supportsFullTextSearch??!1}function E(e){return e?.capabilities?.query?.supportsPagination??!1}function D(e){return e?.fieldsIndex?.fields?.find(e=>e.type===`string`)?.name??``}function O(e){return e.displayField||e.layer.displayField||D(e.layer)}function k(e,t){return!e||!t?.length?!1:t.every(t=>A(e,t))}function A(e,t){return!!e.getField(t)}function j(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function M({codedValues:e},t,n){return r(e??[],e=>{let r=e.name,i=n?r:r.toLowerCase();return(n?t:t.toLowerCase())===i?e.code.toString():null})??null}function N(e){return e.replaceAll(`'`,`''`)}function P(e,t){let n=t?.where;return n?`(${e}) AND (${n})`:e}function F({currentTerm:e,field:t,filter:n,exactMatch:r,url:i,type:a}){let o=t?.type,s=t?.name;if(o===`string`||o===`date`||o===`global-id`){let t=f.test(i??``),o=t&&j(e)?`N`:``;return P(r&&a===`search`?`${s} = ${o}'${e}'`:t?`${s} LIKE ${o}'${e}%'`:`LOWER(${s}) LIKE ${o}'${e.toLowerCase()}%'`,n)}if(o===`oid`||o===`small-integer`||o===`integer`||o===`single`||o===`double`){let t=Number(e);return isNaN(t)?null:P(`${s} = ${t}`,n)}return P(`${s} = ${e}`,n)}function I(e,t){return e?` OR (${t})`:`(${t})`}function L({searchTerm:e,layer:t,searchFields:n,filter:r,exactMatch:i,query:a,type:o}){let{definitionExpression:s,url:c}=t,l=``;if(!a.fullText&&e&&n&&n.forEach(n=>{let a=t.getField(n),s=t.getFieldDomain?.(n),u=(s?.type===`coded-value`?M(s,e,i):null)||e||null;if(u!==null){let e=F({currentTerm:u,field:a,filter:r,exactMatch:i,url:c,type:o});e&&(l+=I(l,e))}}),a.fullText){let e=r?.where;return s&&e?`(${s}) AND (${e})`:s||e||``}return s&&l?`(${s}) AND (${l})`:l}function R(e,t){let n=null,{codedValues:r}=e;return r&&r.length&&r.some(e=>e.code===t&&(n=e.name,!0)),n}function z(e,t){return e[t]??e[Object.keys(e).find(e=>e.toLowerCase()===t.toLowerCase())]}function B(e){return!!e&&`getField`in e&&`queryFeatures`in e}function V(e,t,n){let r=u(e);if(!B(r))return``;let{attributes:i}=e,a=r.getFieldDomain?.(n,{feature:e});if(t)return c(t,i);if(n&&i){let e=r.getField(n),t=z(i,n);return t==null?``:a?.type===`coded-value`?R(a,t)??``:e?.type===`date`?l(new Date(t)):typeof t==`number`?t.toString():typeof t==`string`?t.trim():``}return``}function H(e,t,n,r){let i=u(e),{attributes:a}=e,o=B(i)&&i.objectIdField?a[i.objectIdField]:null;return{text:V(e,t.suggestionTemplate,r),key:o,sourceIndex:n}}function U(e,t,n,r){return e.features.map(e=>H(e,t,n,r))}function W(e){return e!=null&&e.minScale!=null&&e.maxScale!=null}function G(e,n,r,i,c,l,d,f){let p=e.clone(),m=u(e);p.layer=m,p.origin=e.origin;let h=B(m)?m.objectIdField:void 0,g=h?e.attributes[h]:null,_=V(e,r.searchTemplate,c);l!=null&&W(m)&&(m.minScale&&m.minScale<l?l=m.minScale:m.maxScale&&m.maxScale>l&&(l=m.maxScale));let v=o(p.geometry,n,l,f),y=typeof d==`number`&&v?s(t(v),n??void 0,d):v,b=e.clone();return b.layer=m,b.origin=e.origin,y!=null&&(b.geometry=a.fromExtent(y)),{extent:y,target:b,feature:p,key:g,name:_,sourceIndex:i}}function K(e,t,n,r,i,a,o,s){return e.features.map(e=>G(e,t,n,r,i,a,o,s))}export{S as createFullTextSearchInfos,h as getResults,g as getSuggestions,B as isSearchableLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{isSome as i,equals as a}from"../../core/arrayUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import{deprecateUnnecessaryViewModel as s}from"../../core/deprecate.js";import"../../core/has.js";import{create as c}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../core/Logger.js";import{abortMaybe as u,destroyMaybe as d}from"../../core/maybe.js";import{after as f,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as m,syncAndInitial as h}from"../../core/reactiveUtils.js";import{createScreenPointArray as g,createRenderScreenPointArray as _}from"../../core/screenUtils.js";import{convertTime as v,offsetDateUTC as y}from"../../core/timeUtils.js";import{equals as b}from"../../geometry/support/boundedPlane.js";import{longitudeToTimezone as x}from"../../views/3d/support/earthUtils.js";import{computeDirectionsOverTime as S}from"../../views/3d/support/sunUtils.js";import{breadthFirstBinaryPartitioning as C}from"../support/traversalUtils.js";import w from"./DiscreteOptions.js";import T from"./DurationOptions.js";import{ShadowTooltipViewModel as E}from"./ShadowTooltipViewModel.js";import D from"./ThresholdOptions.js";const O=[],k=c(),A=[],j=v(1,`hours`,`milliseconds`);let M=class extends t{constructor(e){let{suppressDeprecationWarning:t,...n}=e??{};super(n),this.view=null,this.tooltip=new E({getDuration:e=>this.getDuration(e)}),this.startTimeOfDay=v(10,`hours`,`milliseconds`),this.endTimeOfDay=v(16,`hours`,`milliseconds`),this.visualizationType=`threshold`,this.thresholdOptions=new D({suppressDeprecationWarning:!0}),this.durationOptions=new T({suppressDeprecationWarning:!0}),this.discreteOptions=new w({suppressDeprecationWarning:!0}),this._running=!0,this._stopPreviewingTask=null,this._updatedRecently=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,t||s(l.getLogger(this),`Shadow Cast`,`arcgis-shadow-cast`,{version:`5.0`}),this.date=new Date}initialize(){this.addHandles([m(()=>({view:this.view,tooltipEnabled:this._tooltipEnabled}),({view:e,tooltipEnabled:t})=>{this.tooltip.view=e,this.tooltip.enabled=t},h),m(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{u(this._stopPreviewingTask),this._updatedRecently=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=o(async e=>{await f(500,e),p(e),this._updatedRecently=!1}))},{sync:!0,initial:!0,equals:(e,t)=>F(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),m(()=>({renderer:this.renderer,parameters:this._visualizationParameters}),e=>N(e.renderer,e.parameters),h),m(()=>({renderer:this.renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext}),e=>N(e.renderer,{lightDirections:e.lightDirections,lightDirectionsContext:e.lightDirectionsContext}),h),m(()=>({renderer:this.renderer,parameters:{enabled:this._running}}),e=>N(e.renderer,e.parameters),h),m(()=>({renderer:this.renderer,parameters:{previewing:this._previewing}}),e=>N(e.renderer,e.parameters),{sync:!0,initial:!0,equals:()=>!1})])}destroy(){this.stop(),N(this.renderer,{enabled:!1}),d(this.tooltip),this._stopPreviewingTask=u(this._stopPreviewingTask)}get state(){return this.view!=null&&this.view.ready&&this._referencePosition!=null?`ready`:`disabled`}set date(e){let t=new Date(e);t.setHours(0,0,0,0),this._set(`date`,t)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(e){this._utcOffset=e}get testData(){}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews?.some(e=>e.updating)??!1,s=!i?.suspended&&!!i?.updating;return a||o||s}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:x(e[0],!1)}get _dateUTCOffset(){let e=this.date;return e=y(e,-e.getTimezoneOffset(),`minutes`),e=y(e,-this.utcOffset,`hours`),e}get _startDateTimeUTC(){return y(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return y(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _durationInterval(){return this._duration>0?Math.floor(this._duration/254):255}get _interval(){let e=this._durationInterval;switch(this.visualizationType){case`threshold`:case`duration`:return e;case`discrete`:return this.discreteOptions.interval||e}}get _intervalContext(){let{contextEnabled:e,contextOptions:{interval:t}}=this.thresholdOptions;return this.visualizationType===`threshold`&&e?t||this._durationInterval:-1}get _durationSampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(t==null||e<=0)return O;let n=t.viewingMode===`global`?k:this._referencePosition;if(n==null)return O;let r=S(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,255),i=r.length;A.length=0;let a=C(0,i,A),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _tooltipEnabled(){return this.state===`ready`&&this.visualizationType!==`discrete`&&this._running&&!this._previewing}get _visualizationParameters(){if(!this._running)return null;switch(this.visualizationType){case`threshold`:return this._thresholdVisualizationParameters;case`duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _thresholdVisualizationParameters(){let{value:e,color:t}=this.thresholdOptions,n=this._duration;return{visualization:2,thresholdColor:t.toUnitRGBA(),threshold:n>0?e/this._duration:0,...this._thresholdDiscreteVisualizationParameters}}get _thresholdDiscreteVisualizationParameters(){let{contextOptions:{color:e},contextEnabled:t}=this.thresholdOptions,n=e.toUnitRGBA(),r=[n[0],n[1],n[2],0];return t?{visualization:3,gradientColorRamp:[[0,r],[1,n]]}:{}}get _durationVisualizationParameters(){let{color:e,mode:t}=this.durationOptions,n=this._duration,r=n>0&&t===`hourly`?j/n:0,i=e.toUnitRGBA(),a=[i[0],i[1],i[2],0];return r===0?{...this._discreteVisualizationParameters,gradientColorRamp:[[0,a],[1,i]]}:{bandedGradientColorRamp:[[0,a],[1,i]],visualization:1,bandSize:r}}get _discreteVisualizationParameters(){let e=this.discreteOptions.color.toUnitRGBA();return{gradientColorRamp:[[0,[e[0],e[1],e[2],0]],[1,e]],visualization:0}}get _shadowLayerViews(){return this.view?.allLayerViews.items.filter(P)}get _previewDependencies(){let{view:e,_shadowLayerViews:t}=this;if(e==null||t==null)return null;let n=e.slice.plane,r=t,a=r.map(e=>e.layer).filter(i),o=r.map(e=>e.suspended),s=a.map(e=>e.visible),c=a.map(e=>e.opacity),l=!!e.graphicsView?.suspended,u=a.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),d=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:o,graphicsViewSuspended:l,layerVisibilities:s,layerOpacities:c,filters:d,definitionExpressions:u}}get renderer(){let{view:e}=this;if(e==null)return null;let t=e.stage;return t==null?null:t.renderer}start(){this.setRunning(!0)}stop(){this.setRunning(!1)}setRunning(e){this._running=e}async getDuration(e){let{view:t,renderer:n,_durationSampleCount:r}=this;if(t==null||n==null||r===0)return 0;let i=t.state.camera.screenToRender(g(e.x,e.y),_());return n.readAccumulatedShadow(i)*this._duration}};e([n()],M.prototype,`state`,null),e([n()],M.prototype,`view`,void 0),e([n()],M.prototype,`tooltip`,void 0),e([n({type:Date,nonNullable:!0})],M.prototype,`date`,null),e([n({type:Number,nonNullable:!0})],M.prototype,`utcOffset`,null),e([n({type:Number,nonNullable:!0})],M.prototype,`startTimeOfDay`,void 0),e([n({type:Number,nonNullable:!0})],M.prototype,`endTimeOfDay`,void 0),e([n({type:[`threshold`,`duration`,`discrete`],nonNullable:!0})],M.prototype,`visualizationType`,void 0),e([n({type:D,nonNullable:!0})],M.prototype,`thresholdOptions`,void 0),e([n({type:T,nonNullable:!0})],M.prototype,`durationOptions`,void 0),e([n({type:w,nonNullable:!0})],M.prototype,`discreteOptions`,void 0),e([n()],M.prototype,`_running`,void 0),e([n()],M.prototype,`_stopPreviewingTask`,void 0),e([n()],M.prototype,`_updatedRecently`,void 0),e([n()],M.prototype,`_autoRestoreForcePreviewEnabled`,void 0),e([n()],M.prototype,`_sceneUpdating`,null),e([n()],M.prototype,`_utcOffset`,void 0),e([n()],M.prototype,`_utcOffsetAuto`,null),e([n()],M.prototype,`_dateUTCOffset`,null),e([n()],M.prototype,`_startDateTimeUTC`,null),e([n()],M.prototype,`_endDateTimeUTC`,null),e([n()],M.prototype,`_referencePosition`,null),e([n()],M.prototype,`_interval`,null),e([n()],M.prototype,`_intervalContext`,null),e([n()],M.prototype,`_durationSampleCount`,null),e([n()],M.prototype,`_duration`,null),e([n()],M.prototype,`_lightDirections`,null),e([n()],M.prototype,`_lightDirectionsContext`,null),e([n()],M.prototype,`_tooltipEnabled`,null),e([n()],M.prototype,`_visualizationParameters`,null),e([n()],M.prototype,`_thresholdVisualizationParameters`,null),e([n()],M.prototype,`_thresholdDiscreteVisualizationParameters`,null),e([n()],M.prototype,`_durationVisualizationParameters`,null),e([n()],M.prototype,`_discreteVisualizationParameters`,null),e([n()],M.prototype,`_shadowLayerViews`,null),e([n()],M.prototype,`_previewDependencies`,null),e([n()],M.prototype,`renderer`,null),M=e([r(`esri.widgets.ShadowCast.ShadowCastViewModel`)],M);function N(e,t){e!=null&&t!=null&&e.setParameters({shadowCast:t})}function P(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`gaussian-splat-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:case`group`:return!1;case`graphics-3d`:case`sketch-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function F(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let n=b(e.slicePlane,t.slicePlane),r=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),i=a(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=a(e.layerVisibilities,t.layerVisibilities),s=a(e.layerOpacities,t.layerOpacities),c=a(e.filters,t.filters),l=a(e.definitionExpressions,t.definitionExpressions);return n&&r&&i&&o&&s&&c&&l}const I=M;export{I as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{isSome as i,equals as a}from"../../core/arrayUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import{deprecateUnnecessaryViewModel as s}from"../../core/deprecate.js";import"../../core/has.js";import{create as c}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../core/Logger.js";import{abortMaybe as u,destroyMaybe as d}from"../../core/maybe.js";import{after as f,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as m,syncAndInitial as h}from"../../core/reactiveUtils.js";import{createScreenPointArray as g,createRenderScreenPointArray as _}from"../../core/screenUtils.js";import{convertTime as v,offsetDateUTC as y}from"../../core/timeUtils.js";import{equals as b}from"../../geometry/support/boundedPlane.js";import{longitudeToTimezone as x}from"../../views/3d/support/earthUtils.js";import{computeDirectionsOverTime as S}from"../../views/3d/support/sunUtils.js";import{breadthFirstBinaryPartitioning as C}from"../support/traversalUtils.js";import w from"./DiscreteOptions.js";import T from"./DurationOptions.js";import{ShadowTooltipViewModel as E}from"./ShadowTooltipViewModel.js";import D from"./ThresholdOptions.js";const O=[],k=c(),A=[],j=v(1,`hours`,`milliseconds`);let M=class extends t{constructor(e){let{suppressDeprecationWarning:t,...n}=e??{};super(n),this.view=null,this.tooltip=new E({getDuration:e=>this.getDuration(e)}),this.startTimeOfDay=v(10,`hours`,`milliseconds`),this.endTimeOfDay=v(16,`hours`,`milliseconds`),this.visualizationType=`threshold`,this.thresholdOptions=new D({suppressDeprecationWarning:!0}),this.durationOptions=new T({suppressDeprecationWarning:!0}),this.discreteOptions=new w({suppressDeprecationWarning:!0}),this._running=!0,this._stopPreviewingTask=null,this._updatedRecently=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,t||s(l.getLogger(this),`Shadow Cast`,`arcgis-shadow-cast`,{version:`5.0`}),this.date=new Date}initialize(){this.addHandles([m(()=>({view:this.view,tooltipEnabled:this._tooltipEnabled}),({view:e,tooltipEnabled:t})=>{this.tooltip.view=e,this.tooltip.enabled=t},h),m(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{u(this._stopPreviewingTask),this._updatedRecently=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=o(async e=>{await f(500,e),p(e),this._updatedRecently=!1}))},{sync:!0,initial:!0,equals:(e,t)=>F(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),m(()=>({renderer:this.renderer,parameters:this._visualizationParameters}),e=>N(e.renderer,e.parameters),h),m(()=>({renderer:this.renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext}),e=>N(e.renderer,{lightDirections:e.lightDirections,lightDirectionsContext:e.lightDirectionsContext}),h),m(()=>({renderer:this.renderer,parameters:{enabled:this._running}}),e=>N(e.renderer,e.parameters),h),m(()=>({renderer:this.renderer,parameters:{previewing:this._previewing}}),e=>N(e.renderer,e.parameters),{sync:!0,initial:!0,equals:()=>!1})])}destroy(){this.stop(),N(this.renderer,{enabled:!1}),d(this.tooltip),this._stopPreviewingTask=u(this._stopPreviewingTask)}get state(){return this.view!=null&&this.view.ready&&this._referencePosition!=null?`ready`:`disabled`}set date(e){let t=new Date(e);t.setHours(0,0,0,0),this._set(`date`,t)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(e){this._utcOffset=e}get testData(){}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews?.some(e=>e.updating)??!1,s=!i?.suspended&&!!i?.updating;return a||o||s}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:x(e[0],!1)}get _dateUTCOffset(){let e=this.date;return e=y(e,-e.getTimezoneOffset(),`minutes`),e=y(e,-this.utcOffset,`hours`),e}get _startDateTimeUTC(){return y(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return y(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _durationInterval(){return this._duration>0?Math.floor(this._duration/254):255}get _interval(){let e=this._durationInterval;switch(this.visualizationType){case`threshold`:case`duration`:return e;case`discrete`:return this.discreteOptions.interval||e}}get _intervalContext(){let{contextEnabled:e,contextOptions:{interval:t}}=this.thresholdOptions;return this.visualizationType===`threshold`&&e?t||this._durationInterval:-1}get _durationSampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(t==null||e<=0)return O;let n=t.state.isGlobal?k:this._referencePosition;if(n==null)return O;let r=S(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.isGlobal,255),i=r.length;A.length=0;let a=C(0,i,A),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _tooltipEnabled(){return this.state===`ready`&&this.visualizationType!==`discrete`&&this._running&&!this._previewing}get _visualizationParameters(){if(!this._running)return null;switch(this.visualizationType){case`threshold`:return this._thresholdVisualizationParameters;case`duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _thresholdVisualizationParameters(){let{value:e,color:t}=this.thresholdOptions,n=this._duration;return{visualization:2,thresholdColor:t.toUnitRGBA(),threshold:n>0?e/this._duration:0,...this._thresholdDiscreteVisualizationParameters}}get _thresholdDiscreteVisualizationParameters(){let{contextOptions:{color:e},contextEnabled:t}=this.thresholdOptions,n=e.toUnitRGBA(),r=[n[0],n[1],n[2],0];return t?{visualization:3,gradientColorRamp:[[0,r],[1,n]]}:{}}get _durationVisualizationParameters(){let{color:e,mode:t}=this.durationOptions,n=this._duration,r=n>0&&t===`hourly`?j/n:0,i=e.toUnitRGBA(),a=[i[0],i[1],i[2],0];return r===0?{...this._discreteVisualizationParameters,gradientColorRamp:[[0,a],[1,i]]}:{bandedGradientColorRamp:[[0,a],[1,i]],visualization:1,bandSize:r}}get _discreteVisualizationParameters(){let e=this.discreteOptions.color.toUnitRGBA();return{gradientColorRamp:[[0,[e[0],e[1],e[2],0]],[1,e]],visualization:0}}get _shadowLayerViews(){return this.view?.allLayerViews.items.filter(P)}get _previewDependencies(){let{view:e,_shadowLayerViews:t}=this;if(e==null||t==null)return null;let n=e.slice.plane,r=t,a=r.map(e=>e.layer).filter(i),o=r.map(e=>e.suspended),s=a.map(e=>e.visible),c=a.map(e=>e.opacity),l=!!e.graphicsView?.suspended,u=a.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),d=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:o,graphicsViewSuspended:l,layerVisibilities:s,layerOpacities:c,filters:d,definitionExpressions:u}}get renderer(){let{view:e}=this;if(e==null)return null;let t=e.stage;return t==null?null:t.renderer}start(){this.setRunning(!0)}stop(){this.setRunning(!1)}setRunning(e){this._running=e}async getDuration(e){let{view:t,renderer:n,_durationSampleCount:r}=this;if(t==null||n==null||r===0)return 0;let i=t.state.camera.screenToRender(g(e.x,e.y),_());return n.readAccumulatedShadow(i)*this._duration}};e([n()],M.prototype,`state`,null),e([n()],M.prototype,`view`,void 0),e([n()],M.prototype,`tooltip`,void 0),e([n({type:Date,nonNullable:!0})],M.prototype,`date`,null),e([n({type:Number,nonNullable:!0})],M.prototype,`utcOffset`,null),e([n({type:Number,nonNullable:!0})],M.prototype,`startTimeOfDay`,void 0),e([n({type:Number,nonNullable:!0})],M.prototype,`endTimeOfDay`,void 0),e([n({type:[`threshold`,`duration`,`discrete`],nonNullable:!0})],M.prototype,`visualizationType`,void 0),e([n({type:D,nonNullable:!0})],M.prototype,`thresholdOptions`,void 0),e([n({type:T,nonNullable:!0})],M.prototype,`durationOptions`,void 0),e([n({type:w,nonNullable:!0})],M.prototype,`discreteOptions`,void 0),e([n()],M.prototype,`_running`,void 0),e([n()],M.prototype,`_stopPreviewingTask`,void 0),e([n()],M.prototype,`_updatedRecently`,void 0),e([n()],M.prototype,`_autoRestoreForcePreviewEnabled`,void 0),e([n()],M.prototype,`_sceneUpdating`,null),e([n()],M.prototype,`_utcOffset`,void 0),e([n()],M.prototype,`_utcOffsetAuto`,null),e([n()],M.prototype,`_dateUTCOffset`,null),e([n()],M.prototype,`_startDateTimeUTC`,null),e([n()],M.prototype,`_endDateTimeUTC`,null),e([n()],M.prototype,`_referencePosition`,null),e([n()],M.prototype,`_interval`,null),e([n()],M.prototype,`_intervalContext`,null),e([n()],M.prototype,`_durationSampleCount`,null),e([n()],M.prototype,`_duration`,null),e([n()],M.prototype,`_lightDirections`,null),e([n()],M.prototype,`_lightDirectionsContext`,null),e([n()],M.prototype,`_tooltipEnabled`,null),e([n()],M.prototype,`_visualizationParameters`,null),e([n()],M.prototype,`_thresholdVisualizationParameters`,null),e([n()],M.prototype,`_thresholdDiscreteVisualizationParameters`,null),e([n()],M.prototype,`_durationVisualizationParameters`,null),e([n()],M.prototype,`_discreteVisualizationParameters`,null),e([n()],M.prototype,`_shadowLayerViews`,null),e([n()],M.prototype,`_previewDependencies`,null),e([n()],M.prototype,`renderer`,null),M=e([r(`esri.widgets.ShadowCast.ShadowCastViewModel`)],M);function N(e,t){e!=null&&t!=null&&e.setParameters({shadowCast:t})}function P(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`gaussian-splat-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:case`group`:return!1;case`graphics-3d`:case`sketch-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function F(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let n=b(e.slicePlane,t.slicePlane),r=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),i=a(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=a(e.layerVisibilities,t.layerVisibilities),s=a(e.layerOpacities,t.layerOpacities),c=a(e.filters,t.filters),l=a(e.definitionExpressions,t.definitionExpressions);return n&&r&&i&&o&&s&&c&&l}const I=M;export{I as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import{trackAccess as r}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as i}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{isSome as a}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import s from"../../core/Error.js";import{EventedAccessor as c}from"../../core/Evented.js";import{handlesGroup as l,makeHandle as u,drainHandles as d,destroyHandle as f}from"../../core/handleUtils.js";import"../../core/has.js";import p from"../../core/Logger.js";import{destroyMaybe as m,abortMaybe as h,removeMaybe as g}from"../../core/maybe.js";import{createAbortError as _,ignoreAbortErrors as v,whenOrAbort as ee}from"../../core/promiseUtils.js";import{watch as y,syncAndInitial as b,on as te,when as ne,sync as re,whenOnce as x}from"../../core/reactiveUtils.js";import{UpdatingHandles as S}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as ie}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as ae,isLoaded as oe,load as se,project as ce}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as le}from"../../geometry/support/spatialReferenceUtils.js";import ue from"../../Graphic.js";import de from"../../layers/GraphicsLayer.js";import{IntegratedMeshSemantics as fe}from"../../layers/support/IntegratedMeshSemantics.js";import{isIntegratedMeshLayer as pe}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as me}from"../../support/elevationInfoUtils.js";import he from"../../symbols/FillSymbol3DLayer.js";import ge from"../../symbols/MeshSymbol3D.js";import _e from"../../symbols/SimpleFillSymbol.js";import ve from"../../symbols/SimpleLineSymbol.js";import w from"../../symbols/SimpleMarkerSymbol.js";import{symbolTypes as T}from"../../symbols/support/typeUtils.js";import E from"../../symbols/TextSymbol.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as ye}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as be}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as xe}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as O}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as k}from"../../views/input/InputManager.js";import{sketchKeys as A}from"../../views/interactive/keybindings.js";import{bindViewToolOptions as j}from"../../views/interactive/options/bindViewToolOptions.js";import M from"../../views/interactive/options/InteractiveToolOptions.js";import Se from"../../views/interactive/options/LabelOptions.js";import N from"../../views/interactive/options/SnappingOptions.js";import Ce from"../../views/interactive/options/TooltipOptions.js";import we from"../../views/interactive/options/ValueOptions.js";import P from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as F}from"../../views/interactive/snapping/SnappingManager.js";import{acquireForViewOptions as Te}from"../../views/interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as Ee}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as De}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as Oe}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as ke}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as I}from"../../views/support/screenUtils.js";import Ae from"./adapters/layer/GraphicsLayerAdapter.js";import je from"./adapters/layer/MapNotesLayerAdapter.js";import Me from"./adapters/layer/SketchLayerAdapter.js";import{CreateOperationHandle as Ne,DrawToolOperationHandle as L,UpdateOperationHandle as R}from"./support/OperationHandle.js";import{PluginManager as Pe}from"./support/PluginManager.js";import{SettingsManager as Fe}from"./support/SettingsManager.js";import{getLegacyTool as z,isCompletelyDegenerate as Ie,graphicsHaveTooFewVerticesForBox as B,getModeFromCreateOptions as Le,getDrawToolGeometryTypeFromCreateTool as Re}from"./support/sketchUtils.js";const V={defaultZ:0},H={reshapeOptions:{edgeOperation:`split`,shapeOperation:`move`,vertexOperation:`move`,enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Oe},tool:`transform`},U=Symbol(),W=Symbol();let G=class extends c{constructor(e){super(e),this._defaultSnappingManager=null,this._operationContext=null,this._internalGraphicsLayer=new de({listMode:`hide`,internal:!0,title:`SVM Internal`}),this._pluginManager=new Pe({sketchViewModel:this}),this.settingsManager=new Fe({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new S,this._toolTransitionHandles=new S,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new De,this._viewHandlesKey=`viewHandles`,this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new w({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new _e({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new ve({color:[130,130,130,1],width:2}),this.meshSymbol=new ge({symbolLayers:new o([new he])}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.useViewOptions=!1,this.cancelUpdateOnClickAway=!0,this.creationMode=`single`,this.vertexSymbol=new w({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new P,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{let{_layerAdapter:e}=this;if(this.removeHandles(W),!e)return;let t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),y(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},b)].filter(a);this.addHandles(t,W)},this._originalPopupEnabled=null,this.defaultCreateOptions=V,this.defaultUpdateOptions=H,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new N,this.textSymbol=new E({text:`text`})}initialize(){this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([te(()=>this.view?.map?.layers,`change`,e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),y(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),b),y(()=>this.view,e=>{this._defaultSnappingManager=m(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new F({view:e,options:this.snappingOptions})),e.type===`2d`?(import(`../../views/2d/interactive/editingTools.js`),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())):e.type===`3d`&&(import(`../../views/3d/interactive/editingTools.js`),import(`../../views/3d/layers/GraphicsLayerView3D.js`)))},b),y(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),Ee(this,void 0,()=>this._operationSnappingManager?.options??this.snappingOptions)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=m(this._defaultSnappingManager),this._destroyOperationContext(),this._set(`snappingManager`,null),this._set(`view`,null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=h(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit(`destroy`)}get _operationSnappingManager(){return this._operationContext?.snappingManager??this.snappingManager}get _operationToolOptions(){return this._operationContext?.toolOptions??this.sketchOptions}get _layerAdapter(){let{layer:e}=this;switch(e?.type){case`graphics`:return new Ae(e);case`map-notes`:return new je(e);case`sketch`:return new Me(e);case void 0:default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){let e=this._operationHandle;if(e?.type===`create`&&e.activeComponent&&`mode`in e.activeComponent)return e.activeComponent.mode;if(e?.activeComponent?.type===`draw-2.0`){let t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(a).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){let{activeComponent:e,destroyed:t}=this,n=!t&&e&&`tooltip`in e?e.tooltip:null;return n?.visible?n:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return this.activeComponent!=null&&(this.activeComponent.type===`draw-3d`||this.activeComponent.type===`draw-2d`)?this.activeComponent.graphic:this._get(`createGraphic`)}get defaultCreateOptions(){return this._get(`defaultCreateOptions`)}set defaultCreateOptions(e){this._set(`defaultCreateOptions`,{...V,...e})}get defaultUpdateOptions(){return this._get(`defaultUpdateOptions`)}set defaultUpdateOptions(e){this._set(`defaultUpdateOptions`,{...H,...e,reshapeOptions:{...H.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...H.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get(`textSymbol`)}set textSymbol(e){this._set(`textSymbol`,e)}get snappingOptions(){return this.snappingManager?.options??this._get(`snappingOptions`)}set snappingOptions(e){this._defaultSnappingManager!=null&&(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=m(this._defaultSnappingManager)),this._override(`snappingManager`,e);else{let{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new F({options:this.snappingOptions,view:e})),this._clearOverride(`snappingManager`)}}get state(){let e=!!(this.view?.ready&&this.layer),t=this._operationHandle;return e&&t?`active`:e?`ready`:`disabled`}get toolTransitionInProgress(){return this._toolTransitionHandles.updating||!!this.drawTool?.lifecycleManager.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.toolTransitionInProgress||this.activeComponent&&`updating`in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this._operationSnappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get(`view`)}set view(e){let t=this._get(`view`);if(t===e)return;if(t){let{container:e,map:n}=t;e&&this._clearCursor(),n?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}let n=`view-ready`;this.removeHandles(n),e&&this.addHandles(ne(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},b),n),this._set(`view`,e),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||this.view?.type!==`2d`}get pluginManager(){return this._pluginManager}get drawTool(){return this.activeComponent?.type===`draw-2.0`?this.activeComponent:null}get activePluginConfigurations(){return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).filter(a)??[]}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome(`rootPlugins`,e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;let e=this.view?.type??`2d`,{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(a)??[]}get firstPluginWithSwappableLeaf(){let e=this.view?.type??`2d`;return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>t!=null&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1)}get multiplePluginsActive(){return this.drawTool?this.drawTool.pluginStack.length>1:!1}replaceLeaf(e){this.drawTool?.replaceLeaf(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=h(this._moduleLoaderAbortController),this._viewReadyAbortController=h(this._viewReadyAbortController),this._drawToolSimplifyAbortController=h(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){let{state:e,updateGraphics:t}=this;if(e===`active`&&t.length){let{activeTool:e}=this,n=t.toArray();this.removeGraphics(n),this.cancel(),this._emitDeleteEvent({graphics:n,tool:e})}}duplicate(){if(this.state===`active`&&this.updateGraphics.length){let 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){return this._toolTransitionHandles.addPromise(this._create(e,t))}async _create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{view:n,layer:r}=this;if(!n||this.state===`disabled`)throw r||this._logMissingLayer(),_();if(n.activeTool!=null&&(n.activeTool=null),!e){this._logError(`sketch:missing-parameter`,`Missing parameter 'tool'.`);return}O(n,this._internalGraphicsLayer);let i=this._createOperationContext(n),a;try{a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t))}catch(e){throw this._destroyOperationContext(i),e}if(a==null||this.destroyed||i!==this._operationContext){let e=i===this._operationContext;a?.onEnd(),m(a),this._destroyOperationContext(i),e&&n.map?.remove(this._internalGraphicsLayer);return}let o=z(e);a.on(`complete`,()=>{if(a===this._operationHandle){let n=this.createGraphic,r=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._set(`createGraphic`,null),this.view?.map?.remove(this._internalGraphicsLayer),!a.cancelled&&n!=null&&this.addGraphic(n),this._sketchContinuationFlag=!1,this.emit(`create`,{graphic:n,state:r?`cancel`:`complete`,tool:o??`point`,toolEventInfo:null,type:`create`}),r||this._sketchContinuationFlag)return;let{creationMode:i}=this;if(i===`continuous`){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(v(this.create(e,t)))}else i===`update`&&n&&this._updatingHandles.consumePromise(v(this.update([n])))}}),this._operationHandle=a,n.ready&&n.focus()}async place(e,t){return await e.load(),this.create(`mesh`,{mode:`click`,hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){return this._toolTransitionHandles.addPromise(this._update(e,t))}async _update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{layer:n,view:r,state:i}=this;if(!r||i===`disabled`)throw n||this._logMissingLayer(),_();r.activeTool!=null&&(r.activeTool=null);let a=Array.isArray(e)?e:[e];if(e==null||!a?.length){this._logError(`sketch:missing-parameter`,`Missing parameter 'graphics'.`);return}if(a.some(e=>this.hasGraphic(e)?e.geometry==null&&(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;let o=this._createOperationContext(r),s;try{s=await this._updatingHandles.addPromise(this._setupUpdateOperation(a,t))}catch(e){throw this._destroyOperationContext(o),e}this.destroyed||s==null||$(s)||o!==this._operationContext?(s&&!$(s)&&(s.onEnd(),s.destroy()),this._destroyOperationContext(o)):(O(r,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit(`update`,{graphics:a,state:`start`,aborted:!1,tool:s.tool,toolEventInfo:null,type:`update`}))}async _updateSpatialReference(e){let t=this.view;if(!t)this._logMissingView();else{e=Array.isArray(e)?e:[e];for(let n of e)n.geometry!=null&&n.geometry.type!==`mesh`&&!le(n.geometry.spatialReference,t.spatialReference)&&(!ae(n.geometry.spatialReference,t.spatialReference)&&!oe()&&await se(),n.geometry=ce(n.geometry,t.spatialReference))}}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._updatingHandles.consumePromise(this._operationHandle?.toggleTool())}_createOperationContext(e){this._destroyOperationContext();let t=this.useViewOptions?e.options:null,n=t?Te(e):null,r=t?new M:this.sketchOptions,i;if(t){let{values:t}=r;i=l([j(r,()=>e.options,()=>this.sketchOptions),y(()=>t.directionMode,e=>{this.sketchOptions.values.directionMode=e},re)])}return this._operationContext={snappingManager:n?.snappingManager??this.snappingManager,toolOptions:r,...l([n,i])}}_destroyOperationContext(e=this._operationContext){e===this._operationContext?this._operationContext=g(this._operationContext):g(e)}async _getFirstHit(e){let t=this.view;if(!t)return this._logMissingView(),null;if(t.type===`2d`){let n=[];t.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});return ke(r.results)}let n=[t.map.ground];t.map.allLayers.forEach(e=>{pe(e)&&fe.shouldIntersectAsGround(e)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});if(r.results.length>0){let e=r.results[0];if(e!=null&&e.type===`graphic`&&e.graphic&&(!r.ground.mapPoint||t.map.ground.opacity<1||r.ground.distance-(e.distance??0)>-Math.min(3*r.ground.distance,t.viewingMode===`global`?ie(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:1/0)))return e}return null}_generateViewHandles(e){return[e.on(`immediate-click`,async e=>{let t=this.state===`active`&&this._operationHandle?.type===`create`;this.state!==`disabled`&&!t&&this.updateOnGraphicClick&&await this._toolTransitionHandles.addPromise(this._handleImmediateClick(e))},k.WIDGET)]}async _handleImmediateClick(e){let t=await e.defer(()=>this._getFirstHit(I(e))),n=null;if(t!=null){let r=t.graphic;this.updateGraphics.includes(r)||this.hasGraphic(r)?(e.stopPropagation(),n=r):this.view?.type===`2d`&&!this._isComponentGraphic(r)&&this.state===`active`&&this.cancel()}else this.state===`active`&&this.cancelUpdateOnClickAway&&this.cancel();n!=null&&!this.updateGraphics.includes(n)&&await this.update([n],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r={hasZ:n.type===`3d`,...this.defaultCreateOptions,...t},i=typeof e==`string`?this.pluginManager?.getPluginsEquivalentToCreateTool(e,r):e,a=z(e);if(i&&!this.isUsingLegacyCreateTools){let e=await this._setupDrawTool(i,r,a??`polyline`);if(e)return this._setupDrawToolOperationHandle(e,a??`point`)}if(!a)return null;let o=await this._setupDrawGraphicTool(a,n,r);return o==null?null:(n.tools.add(o),n.activeTool=o,this._setupCreateOperationHandle(o,a))}async _setupDrawGraphicTool(e,t,n){if(e===`multipoint`&&t.type===`3d`)return this._logError(`sketch:create`,`Multipoint geometries are not supported in SceneView.`),null;if(!t)return this._logMissingView(),null;let{cursor:r,defaultZ:i,hasZ:a,geometryToPlace:o,graphicProperties:s,mode:c,preserveAspectRatio:l}=n,u=Le(c,e),d=Re(e),f=n?.optionsPerTool?.has(e)?n.optionsPerTool.get(e):{},p=f?.preserveAspectRatio??l??e!==`rectangle`,m={centered:e!==`rectangle`&&!(e===`circle`&&!p),cursor:r,defaultZ:i,forceUniformSize:p,graphicProperties:{...s,attributes:{...s?.attributes}},geometryToPlace:o,geometryType:d,mode:u,graphicSymbol:n.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:a,snappingManager:this._operationSnappingManager,snapToScene:!1,view:t,...f};return t.type===`2d`?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){let t=await this._requireModule(import(`../../views/2d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:Be(e.geometryType)?this.activeFillSymbol:null,toolOptions:this._operationToolOptions})}async _makeDrawGraphicTool3D(e){let t=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,toolOptions:this._operationToolOptions})}_setupCreateOperationHandle(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let a=null,o=e.forceUniformSize,s=e.centered,c=new i,l=[u(()=>c.destroy()),n.on(`key-down`,t=>{if(t.key===A.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===A.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key===A.vertexAdd&&!t.repeat){let n=e.drawOperation.geometryType;(n===`polyline`||n===`polygon`||n===`multipoint`)&&(t.stopPropagation(),e.drawOperation.commitStagedVertex())}else t.key===A.undo?(t.stopPropagation(),f.undo()):t.key===A.redo?(t.stopPropagation(),f.redo()):t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)&&!t.repeat?(e.forceUniformSize=!o,t.stopPropagation()):t.key===A.center&&(t.repeat||(e.centered=!s,t.stopPropagation()))},k.WIDGET),n.on(`key-up`,t=>{t.key===A.pan?e.enabled=!0:t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)?(e.forceUniformSize=o,t.stopPropagation()):t.key===A.center&&(e.centered=s,t.stopPropagation())},k.WIDGET),e.on(`vertex-update`,()=>{c.notify()}),e.on(`vertex-add`,t=>{switch(c.notify(),a=a==null?`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(c.notify(),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?f&&f.cancel():f&&f.complete()}),y(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],f=new Ne({activeComponent:e,type:`create`,onEnd:()=>{d(l),n.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(r(c),e.canUndo),canRedo:()=>(r(c),e.canRedo)});return f}_setupDrawToolOperationHandle(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r=null,i=[n.on(`key-down`,t=>{t.key===A.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},k.WIDGET),n.on(`key-up`,t=>{t.key===A.pan&&(e.editable=!0)},k.WIDGET),e.on(`before-vertex-add`,t=>{let n=e.mostUpstreamPlugin?.configuration;if(n&&`legacyCreateTool`in n&&(n?.legacyCreateTool===`point`||n.legacyCreateTool===`text`)){let e=t.detail.originalEvent;e&&`key`in e&&e.key===A.vertexAdd&&t.preventDefault()}}),e.on(`before-complete`,t=>{let n=e.getGeometryIfCompleted();(!n||Ie(n))&&t.preventDefault()}),e.on([`vertex-add`,`vertex-remove`],n=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.getGeometryIfCompleted()),r=r==null&&n.type!==`vertex-remove`?`start`:`active`,n.operation){case`apply`:this.emit(`create`,{graphic:this.createGraphic,state:r,tool:this.activeTool,toolEventInfo:n,type:`create`});break;case`undo`:this._emitUndoEvent({graphics:[this.createGraphic].filter(a),tool:t});break;case`redo`:this._emitRedoEvent({graphics:[this.createGraphic].filter(a),tool:t})}}),e.on(`cursor-update`,t=>{this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),(t.vertices[0]?.vertexIndex>0||t.vertices[0]?.componentIndex>0)&&this.emit(`create`,{graphic:this.createGraphic,state:`active`,tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:`cursor-update`},type:`create`})}),e.on(`complete`,async({geometry:t,isSimple:n})=>{let r=this.createGraphic,i=!!t&&t.type!==`mesh`&&t.type!==`extent`&&!n;if(r&&(r.geometry=n?t:e.unprocessedGeometry??t),!i||!r)o.complete();else{this._internalGraphicsLayer.add(this.createGraphic);let e=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=e,await this._updatingHandles.addPromise(v(this._finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:r,handle:o})))}})],o=new L({activeComponent:e,type:`create`,onEnd:()=>{d(i),n.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return i.push(e.on(`cancel`,()=>{this._drawToolSimplifyAbortController=h(this._drawToolSimplifyAbortController),o.cancel()})),o}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:n,handle:r}){let i=this.view?.acquireCursor(`progress`,`high`);i&&this.addHandles(i);let a=()=>e.signal.aborted?(n&&(this._layerAdapter?.remove(n),this._internalGraphicsLayer?.remove(n)),this._set(`createGraphic`,null),!0):!1;try{let i=await this._geometryWorkerHandle.simplify(t,e.signal);if(a())return;n.geometry=i??t,this._internalGraphicsLayer?.remove(n),r.complete()}finally{i?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_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){let{view:n}=this;if(!n)return this._logMissingView(),null;let r={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=r;let i=r.tool??H.tool;if(this.removeGraphics(e),this.addGraphics(e),n.type===`3d`){if(e.length===0)return null;switch(i){case`move`:return this._setupMove3DOperation(e,r,n,i);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupReshape3DOperation(e[0],r,n);case`transform`:return this._setupGraphicTransform3DOperation(e,r,n)}}switch(i){case`move`:return this._setupMove2DOperation(e,r,n);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupTransformOrReshape2DOperation(e,i,r,n);case`transform`:return B(e)&&(i=`reshape`),this._setupTransformOrReshape2DOperation(e,i,r,n)}}async _setupMove3DOperation(e,t,n,r,i=!1){let a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,MoveTool3D:s}=a.module,c=new Map,l=()=>{c.forEach(e=>e.destroy()),c.clear()};for(let t of e){let e=new o({view:n,graphic:t}),r=ye(e);if(r!==0)return l(),this._logError(`sketch:move`,`Move operation not supported for provided graphic(s) (${D(r)}).`),null;c.set(t,e)}let u=new s({view:n,enableZ:t.enableZ,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(u),u.objects.addMany(Array.from(c.values())),i||this.updateGraphics.addMany(e);let f=[],p=new R({activeComponent:u,tool:r,type:`update`,onEnd:()=>{d(f),Q(n,u),l()},undo:()=>{X(this.view,u),q(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},addToSelection:async e=>{this.updateGraphics.push(e);let t=new o({view:n,graphic:e});c.set(e,t),u.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:async e=>{let t=this.updateGraphics.indexOf(e);if(p.history.undo.forEach(e=>e.updates.splice(t,1)),p.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`}),this.updateGraphics.length===0){p.complete();return}let n=c.get(e);n&&(u.objects.remove(n),n.destroy(),c.delete(e))},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1||r!==`transform`)return;let e=this.updateGraphics.at(0),i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));i&&!$(i)&&(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(i,t))}});return f.push(...this._getHandlesForComponent(p,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(p,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e)},k.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,n,r=!1){if(e.length===1&&xe(e[0])===0){let i=e[0],a=i.geometry;if(a!=null&&(a.type===`point`||a.type===`mesh`))return this._setupPointTransform3DOperation(i,t,n);if(a!=null&&(a.type===`polygon`||a.type===`polyline`))return this._setupPolyTransform3DOperation(i,t,n,r)}return this._setupMove3DOperation(e,t,n,`transform`,r)}async _setupPointTransform3DOperation(e,t,n){let r=`transform`,{enableRotation:i,enableScaling:a,enableZ:o}=t,s=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(s))return s;let{TransformTool3D:c,ManipulatedObject3DGraphic:l}=s.module,u=new l({graphic:e,view:n}),f=new c({object:u,view:n,enableRotation:i,enableScaling:a,enableZ:o,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),this.updateGraphics.add(e);let p=[],m=new R({activeComponent:f,tool:r,type:`update`,onEnd:()=>{d(p),Q(n,f),u.destroy()},undo:()=>{X(this.view,f),q(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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:async()=>{}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,n,r=!1){let i=`transform`,{enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:c}=t,l=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(l))return l;let{ManipulatedObject3DGraphic:u,ExtentTransformTool:f}=l.module,p=this.view?.inputManager?.isModifierKeyDown(A.constraint),m=new u({view:n,graphic:e}),h=new f({object:m,view:n,enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:!!c!=!!p,toolOptions:this._operationToolOptions});n.tools.add(h),r||this.updateGraphics.add(e);let g=[],_=new R({activeComponent:h,tool:i,type:`update`,onEnd:()=>{d(g),Q(n,h),m.destroy()},canUndo:()=>!h.destroyed&&h.canUndo,undo:()=>{h.destroyed||(h.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!h.destroyed&&h.canRedo,redo:()=>{h.destroyed||(h.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`}),await this._replaceUpdateOperationHandle(_,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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`}),_.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1)return;let r=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));r&&!$(r)&&(_.onEnd(),_.destroy(),this._setUpdateOperationHandle(r,t))}});return g.push(...this._getHandlesForComponent(_,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(_,e,t),k.WIDGET),n.on(`key-down`,e=>this._getCommonUpdateOperationKeyDownHandlers(_,e),k.WIDGET),n.on(`key-down`,e=>{e.key===A.constraint&&!e.repeat&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET)),_}async _setupMove2DOperation(e,t,n){let r=`move`;this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,n));if($(i))return i;let a=new R({activeComponent:i,tool:r,type:`update`,onEnd:()=>{this._clearCursor(),d(c),d(s),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{let e=this.updateGraphics.toArray();q(a,e),a.refreshComponent(),this._emitUndoEvent({graphics:e,tool:r})},redo:()=>{let e=this.updateGraphics.toArray();J(a,e),a.refreshComponent(),this._emitRedoEvent({graphics:e,tool:r})},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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`}),this.updateGraphics.length===0?a.complete():i.graphics=n}}),o=!1,s=[n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&(o=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&o&&(o=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET)],c=this._getHandlesForComponent(a,t);return a}async _setupReshape3DOperation(e,t,n,r=!1){let i=`reshape`,a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,ReshapeTool3D:s}=a.module,c=new o({view:n,graphic:e}),l=be(c);if(l!==0)return c.destroy(),this._logError(`sketch:reshape`,`Reshape operation not supported for provided graphic(s) (${D(l)}).`),null;let u=t.reshapeOptions,f=new s({view:n,object:c,enableZVertex:t.enableZ&&u?.vertexOperation===`move`,enableZShape:t.enableZ&&u?.shapeOperation===`move`,enableMoveObject:u?.shapeOperation===`move`||u?.shapeOperation===`move-xy`,enableMidpoints:u?.edgeOperation===`split`,enableEdgeOffset:u?.edgeOperation===`offset`,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),r||this.updateGraphics.add(c.graphic);let p=[],m=new R({activeComponent:f,tool:i,type:`update`,onEnd:()=>{d(p),Q(n,f),c.destroy()},canUndo:()=>!f.destroyed&&f.canUndo,undo:()=>{f.destroyed||(f.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!f.destroyed&&f.canRedo,redo:()=>{f.destroyed||(f.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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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:async()=>{t.toggleToolOnClick!==!1&&await this._replaceUpdateOperationHandle(m,t,()=>this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,n,!0))}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupTransformOrReshape2DOperation(e,t,n,r){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(t===`transform`?this._getBox(e,n,r):this._getReshape(e,n,r));if($(i))return i;let a=new R({activeComponent:i,type:`update`,onEnd:()=>{d(s),d(o),a.activeComponent&&!a.activeComponent.destroyed&&a.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{q(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},redo:()=>{J(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},addToSelection:async e=>{let t=a.activeComponent;if(t?.type===`reshape`){let t=[...this.updateGraphics,e];if(this.updateGraphics.removeAll(),!await this._replaceUpdateOperationHandle(a,n,()=>this._setupTransformOrReshape2DOperation(t,`transform`,n,r)))return}else this.updateGraphics.add(e),t=t,t.graphics=this.updateGraphics.toArray(),t.refresh(),a.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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();n.length===0?a.complete():B(n)?await a.toggleTool():a.activeComponent.graphics=n,this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;let e=this.updateGraphics.at(0),t=e.geometry;if(t!=null&&(a.tool===`reshape`&&t.type===`point`||a.tool===`transform`&&t.type===`extent`))return;let i=null,o={...this.defaultUpdateOptions,...n,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...n?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...n?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};a.tool===`transform`?i=await this._updatingHandles.addPromise(this._getReshape([e],o,r)):a.tool===`reshape`&&(i=await this._updatingHandles.addPromise(this._getBox([e],o,r))),$(i)||(a.activeComponent?.destroy(),a.activeComponent=i,a.activeComponent&&(d(s),s=this._getHandlesForComponent(a,o)))}}),o=[r.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,n),k.WIDGET),r.on(`key-down`,e=>{if(this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET),r.on(`key-up`,e=>{if(e.key===A.constraint&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET)],s=this._getHandlesForComponent(a,n);return a}async _getGraphicMover(e,t,n){let{enableMoveAllGraphics:r,highlightOptions:i}=t,a=await this._requireModule(import(`../../views/draw/support/GraphicMover.js`));return $(a)?a:new a.module.default({enableMoveAllGraphics:r,highlightName:i?.name,highlightsEnabled:!!i?.enabled,indicatorsEnabled:!1,graphics:e,view:n,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`grabbing`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-start`},type:`update`})},onGraphicMove:({dx:e,dy:t,graphic:n})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move`},type:`update`}),onGraphicMoveStop:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`pointer`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-stop`},type:`update`})},onGraphicPointerOver:()=>this._displayCursor(`move`),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,n){let{enableRotation:r,enableScaling:i,highlightOptions:a,preserveAspectRatio:o}=t,s=await this._requireModule(import(`../../views/draw/support/Box.js`));if($(s))return s;let c=this.view?.inputManager?.isModifierKeyDown(A.constraint),l=new s.module.default({graphics:e,enableRotation:r,enableScaling:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,preserveAspectRatio:!!o!=!!c,layer:this._internalGraphicsLayer,view:n,toolOptions:this._operationToolOptions,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`})}});return l.addHandles(y(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,n])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=n??t.enableScaling??!0,l.refresh()},b)),l}async _getReshape(e,t,n){let{highlightOptions:r,reshapeOptions:i}=t,a=i?.edgeOperation===`split`,o=i?.shapeOperation===`move`,s=!!i?.enableCreateCurveFromStraightEdge,c=await this._requireModule(import(`../../views/draw/support/Reshape.js`));return $(c)?c:new c.module.default({enableMidpoints:a,enableMovement:o,enableCurveOnMidpoint:s,graphic:e[0],highlightName:r?.name,highlightsEnabled:!!r?.enabled,layer:this._internalGraphicsLayer,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions,view:n,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:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMove:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMoveStop:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onVertexAdd:({added:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:r,vertices:n,type:t},type:`update`})},onVertexRemove:({removed:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{removed:r,vertices:n,type:t},type:`update`})}}})}_getHandlesForComponent(e,t){let n=e.activeComponent;if(!n)return[];switch(n.type){case`graphic-mover`:return[n.on(`graphic-click`,({graphic:n,viewEvent:r})=>{r.native?.shiftKey&&t.multipleSelectionEnabled&&(r.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(n)))}),n.on(`graphic-move-start`,t=>e.addToHistory(Z(t.allGraphics)))];case`box`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`rotate-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`scale-start`,t=>e.addToHistory(Z(t.graphics)))];case`reshape`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z([t.mover]))),n.on(`reshape-start`,t=>e.addToHistory(Z([t.graphic]))),n.on(`vertex-add`,t=>e.addToHistory(Z([t.oldGraphic]))),n.on(`vertex-remove`,t=>e.addToHistory(Z([t.oldGraphic])))];case`move-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`transform-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`reshape-3d`:return[n.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`})}),n.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`})}),n.events.on(`vertex-add`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`vertex-remove`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})]}}_onTransformOrReshape2DGraphicClick(e,t,n){let{graphic:r,viewEvent:i}=n;i.native?.shiftKey&&this.hasGraphic(r)?(i.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(r))):t.toggleToolOnClick&&(i.stopPropagation(),this._updatingHandles.consumePromise(e.toggleTool()))}async _replaceUpdateOperationHandle(e,t,n){let r=this._operationContext;e.onEnd(),e.destroy();let i=await this._updatingHandles.addPromise(n());return!i||$(i)||r!==this._operationContext?(i&&!$(i)&&(i.onEnd(),i.destroy()),this._destroyOperationContext(r),!1):(this._setUpdateOperationHandle(i,t),!0)}_setUpdateOperationHandle(e,t){this._operationHandle=e;let n=this.view?.map;this._disablePopup(t),e.on(`complete`,()=>{if(e===this._operationHandle){let r=this.updateGraphics.toArray(),i=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),n&&n.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit(`update`,{graphics:r,state:`complete`,aborted:e.cancelled,tool:i,toolEventInfo:null,type:`update`})}})}_getCommonUpdateOperationClickHandlers(e,t,n){return this._updatingHandles.addPromise(this._handleCommonUpdateOperationClick(e,t,n))}async _handleCommonUpdateOperationClick(e,t,n){let r=I(t),i=await t.defer(()=>this._getFirstHit(r));if(i==null){this.cancelUpdateOnClickAway&&e.complete();return}let a=t.native.shiftKey?this._toggleSelection([i.graphic],e,n):null;a?(t.stopPropagation(),await a):this.updateGraphics.includes(i.graphic)?this._shouldTemporarilyDisablePopup(n)&&t.stopPropagation():e.complete()}async _toggleSelection(e,t,n){let r=!!n.multipleSelectionEnabled;for(let n of e)if(n!=null&&r&&this.hasGraphic(n))return this.updateGraphics.includes(n)?await t.removeFromSelection(n):await t.addToSelection(n)}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;let n=t.key;n===A.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):n===A.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):n===A.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&A.delete.includes(n)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&this._operationHandle.type===`update`&&this.activeComponent!=null&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&=(this.view?.map?.remove(this._internalGraphicsLayer),m(this._internalGraphicsLayer))}_isComponentGraphic(e){let{activeComponent:t}=this;return!e||t==null?!1:e.attributes?.esriSketchTool||t.type===`draw-2d`&&t.graphic===e||(t.type===`box`||t.type===`reshape`)&&t.isUIGraphic(e)}_clearCursor(){this.removeHandles(U)}_displayCursor(e){this.removeHandles(U),this.view?.container&&e!=null&&this.addHandles(this.view.acquireCursor(e,`high`),U)}_logError(e,t,n){p.getLogger(this).error(new s(e,t,n))}async _requireModule(e){let t=new AbortController;this._moduleLoaderAbortController=t;let n=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:`aborted`}:{module:n}}_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(this._operationHandle!=null){let{updateGraphics:t}=this;for(let n of e.removed)if(t.includes(n)){if(t.length>1)this._updatingHandles.consumePromise(this._operationHandle.removeFromSelection(n));else{this._operationHandle.cancel();break}}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,t,n){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;let r=this.view,i=await import(`../../views/draw/DrawTool.js`);await this.pluginManager.loadPlugins();let a=await this.pluginManager.makeRenderer({customSymbol:t.graphicSymbol,useTextSymbol:n===`text`}),o=new i.DrawTool({view:r,elevationInfo:this._layerAdapter?.elevationInfo??me(r.type===`3d`),hasZ:!!t.hasZ,toolOptions:this._operationToolOptions,renderer:a,defaultZ:t.defaultZ??0,directionOptions:t.directionOptions,snappingManager:this._operationSnappingManager,enableVertexVisuals:n!==`rectangle`&&n!==`circle`,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});o.addHandles(f(a));let s=new ue({...t.graphicProperties,attributes:{...t.graphicProperties?.attributes},symbol:t.graphicSymbol??this._getGraphicSymbolFromTool(n)});return t.graphicSymbol||o.addHandles(y(()=>this._getGraphicSymbolFromTool(n),e=>s.symbol=e)),this._set(`createGraphic`,s),r.addAndActivateTool(o),o.begin(e),o}get test(){}wait(){return x(()=>!this.updating)}_shouldTemporarilyDisablePopup(e){return this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled==null&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled!=null&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){let e=this.view;e?(h(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await ee(x(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError(`sketch:missing-property`,K(`view`))}_logMissingLayer(){this._logError(ze,K(`layer`))}};e([t()],G.prototype,`_defaultSnappingManager`,void 0),e([t()],G.prototype,`_operationContext`,void 0),e([t()],G.prototype,`_layerAdapter`,null),e([t()],G.prototype,`_pluginManager`,void 0),e([t({readOnly:!0})],G.prototype,`settingsManager`,void 0),e([t()],G.prototype,`_operationHandle`,void 0),e([t({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([t({readOnly:!0})],G.prototype,`_toolTransitionHandles`,void 0),e([t()],G.prototype,`_drawToolSimplifyAbortController`,void 0),e([t({readOnly:!0})],G.prototype,`activeTool`,null),e([t()],G.prototype,`geometrySimplificationInProgress`,null),e([t({readOnly:!0})],G.prototype,`activeCreateToolDrawMode`,null),e([t()],G.prototype,`activeTooltip`,null),e([t({types:T})],G.prototype,`activeFillSymbol`,void 0),e([t()],G.prototype,`activeLineSymbol`,void 0),e([t()],G.prototype,`activeVertexSymbol`,void 0),e([t()],G.prototype,`allowDeleteKey`,void 0),e([t({readOnly:!0})],G.prototype,`createGraphic`,null),e([t()],G.prototype,`defaultCreateOptions`,null),e([t()],G.prototype,`defaultUpdateOptions`,null),e([t()],G.prototype,`activeUpdateOptions`,void 0),e([t({type:Se,nonNullable:!0})],G.prototype,`labelOptions`,null),e([t()],G.prototype,`layer`,void 0),e([t({types:T})],G.prototype,`pointSymbol`,void 0),e([t({types:T})],G.prototype,`polygonSymbol`,void 0),e([t({types:T})],G.prototype,`polylineSymbol`,void 0),e([t()],G.prototype,`meshSymbol`,void 0),e([t({type:E})],G.prototype,`textSymbol`,null),e([t({type:N,nonNullable:!0})],G.prototype,`snappingOptions`,null),e([t()],G.prototype,`snappingManager`,null),e([t({readOnly:!0})],G.prototype,`state`,null),e([t()],G.prototype,`toolTransitionInProgress`,null),e([t({type:Ce,nonNullable:!0})],G.prototype,`tooltipOptions`,null),e([t({readOnly:!0})],G.prototype,`updateGraphics`,void 0),e([t()],G.prototype,`updateOnGraphicClick`,void 0),e([t()],G.prototype,`useViewOptions`,void 0),e([t()],G.prototype,`cancelUpdateOnClickAway`,void 0),e([t()],G.prototype,`updating`,null),e([t()],G.prototype,`creationMode`,void 0),e([t({type:we,nonNullable:!0})],G.prototype,`valueOptions`,null),e([t({types:T})],G.prototype,`vertexSymbol`,void 0),e([t({value:null})],G.prototype,`view`,null),e([t({constructOnly:!0,type:P})],G.prototype,`sketchOptions`,void 0),e([t()],G.prototype,`useLegacyCreateTools`,void 0),e([t()],G.prototype,`isUsingLegacyCreateTools`,null),e([t()],G.prototype,`pluginManager`,null),e([t()],G.prototype,`drawTool`,null),e([t()],G.prototype,`activePluginConfigurations`,null),e([t()],G.prototype,`rootPlugins`,null),e([t()],G.prototype,`effectiveAvailablePlugins`,null),e([t()],G.prototype,`firstPluginWithSwappableLeaf`,null),e([t()],G.prototype,`multiplePluginsActive`,null),G=e([n(`esri.widgets.Sketch.SketchViewModel`)],G);const ze=`sketch:missing-property`,K=e=>`Property '${e}' is missing on SketchViewModel.`;function Be(e){return e===`polygon`||e===`rectangle`||e===`circle`}function q(e,t){Y(`undo`,e.history.undo,e.history.redo,t)}function J(e,t){Y(`redo`,e.history.redo,e.history.undo,t)}function Y(e,t,n,r){let i=t.pop();if(!i)return;let a=i.updates,o=[];r.forEach((t,n)=>{let r=a[n];r!=null&&(`geometry`in r&&r.geometry!=null&&(o.push({geometry:t.geometry}),t.geometry=r.geometry),`symbol`in r&&r.symbol!=null&&(o.push({symbol:t.symbol}),t.symbol=r.symbol),`undo`in r&&(o.push(r),r[e](t)))}),n.push({updates:o})}function X(e,t){e!=null&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Z(e){return{updates:e.map(({geometry:e})=>e?.type===`mesh`?{geometry:e.cloneShallow()}:{geometry:e})}}function Q(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function $(e){return`requireError`in e&&e.requireError===`aborted`}export{G as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import{trackAccess as r}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as i}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{isSome as a}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import s from"../../core/Error.js";import{EventedAccessor as c}from"../../core/Evented.js";import{handlesGroup as l,makeHandle as u,drainHandles as d,destroyHandle as f}from"../../core/handleUtils.js";import"../../core/has.js";import p from"../../core/Logger.js";import{destroyMaybe as m,abortMaybe as h,removeMaybe as g}from"../../core/maybe.js";import{createAbortError as _,ignoreAbortErrors as v,whenOrAbort as ee}from"../../core/promiseUtils.js";import{watch as y,syncAndInitial as b,on as te,when as ne,sync as re,whenOnce as x}from"../../core/reactiveUtils.js";import{UpdatingHandles as S}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as ie}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as ae,isLoaded as oe,load as se,project as ce}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as le}from"../../geometry/support/spatialReferenceUtils.js";import ue from"../../Graphic.js";import de from"../../layers/GraphicsLayer.js";import{IntegratedMeshSemantics as fe}from"../../layers/support/IntegratedMeshSemantics.js";import{isIntegratedMeshLayer as pe}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as me}from"../../support/elevationInfoUtils.js";import he from"../../symbols/FillSymbol3DLayer.js";import ge from"../../symbols/MeshSymbol3D.js";import _e from"../../symbols/SimpleFillSymbol.js";import ve from"../../symbols/SimpleLineSymbol.js";import w from"../../symbols/SimpleMarkerSymbol.js";import{symbolTypes as T}from"../../symbols/support/typeUtils.js";import E from"../../symbols/TextSymbol.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as ye}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as be}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as xe}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as O}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as k}from"../../views/input/InputManager.js";import{sketchKeys as A}from"../../views/interactive/keybindings.js";import{bindViewToolOptions as j}from"../../views/interactive/options/bindViewToolOptions.js";import M from"../../views/interactive/options/InteractiveToolOptions.js";import Se from"../../views/interactive/options/LabelOptions.js";import N from"../../views/interactive/options/SnappingOptions.js";import Ce from"../../views/interactive/options/TooltipOptions.js";import we from"../../views/interactive/options/ValueOptions.js";import P from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as F}from"../../views/interactive/snapping/SnappingManager.js";import{acquireForViewOptions as Te}from"../../views/interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as Ee}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as De}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as Oe}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as ke}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as I}from"../../views/support/screenUtils.js";import Ae from"./adapters/layer/GraphicsLayerAdapter.js";import je from"./adapters/layer/MapNotesLayerAdapter.js";import Me from"./adapters/layer/SketchLayerAdapter.js";import{CreateOperationHandle as Ne,DrawToolOperationHandle as L,UpdateOperationHandle as R}from"./support/OperationHandle.js";import{PluginManager as Pe}from"./support/PluginManager.js";import{SettingsManager as Fe}from"./support/SettingsManager.js";import{getLegacyTool as z,isCompletelyDegenerate as Ie,graphicsHaveTooFewVerticesForBox as B,getModeFromCreateOptions as Le,getDrawToolGeometryTypeFromCreateTool as Re}from"./support/sketchUtils.js";const V={defaultZ:0},H={reshapeOptions:{edgeOperation:`split`,shapeOperation:`move`,vertexOperation:`move`,enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Oe},tool:`transform`},U=Symbol(),W=Symbol();let G=class extends c{constructor(e){super(e),this._defaultSnappingManager=null,this._operationContext=null,this._internalGraphicsLayer=new de({listMode:`hide`,internal:!0,title:`SVM Internal`}),this._pluginManager=new Pe({sketchViewModel:this}),this.settingsManager=new Fe({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new S,this._toolTransitionHandles=new S,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new De,this._viewHandlesKey=`viewHandles`,this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new w({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new _e({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new ve({color:[130,130,130,1],width:2}),this.meshSymbol=new ge({symbolLayers:new o([new he])}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.useViewOptions=!1,this.cancelUpdateOnClickAway=!0,this.creationMode=`single`,this.vertexSymbol=new w({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new P,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{let{_layerAdapter:e}=this;if(this.removeHandles(W),!e)return;let t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),y(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},b)].filter(a);this.addHandles(t,W)},this._originalPopupEnabled=null,this.defaultCreateOptions=V,this.defaultUpdateOptions=H,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new N,this.textSymbol=new E({text:`text`})}initialize(){this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([te(()=>this.view?.map?.layers,`change`,e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),y(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),b),y(()=>this.view,e=>{this._defaultSnappingManager=m(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new F({view:e,options:this.snappingOptions})),e.type===`2d`?(import(`../../views/2d/interactive/editingTools.js`),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())):e.type===`3d`&&(import(`../../views/3d/interactive/editingTools.js`),import(`../../views/3d/layers/GraphicsLayerView3D.js`)))},b),y(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),Ee(this,void 0,()=>this._operationSnappingManager?.options??this.snappingOptions)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=m(this._defaultSnappingManager),this._destroyOperationContext(),this._set(`snappingManager`,null),this._set(`view`,null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=h(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit(`destroy`)}get _operationSnappingManager(){return this._operationContext?.snappingManager??this.snappingManager}get _operationToolOptions(){return this._operationContext?.toolOptions??this.sketchOptions}get _layerAdapter(){let{layer:e}=this;switch(e?.type){case`graphics`:return new Ae(e);case`map-notes`:return new je(e);case`sketch`:return new Me(e);case void 0:default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){let e=this._operationHandle;if(e?.type===`create`&&e.activeComponent&&`mode`in e.activeComponent)return e.activeComponent.mode;if(e?.activeComponent?.type===`draw-2.0`){let t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(a).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){let{activeComponent:e,destroyed:t}=this,n=!t&&e&&`tooltip`in e?e.tooltip:null;return n?.visible?n:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return this.activeComponent!=null&&(this.activeComponent.type===`draw-3d`||this.activeComponent.type===`draw-2d`)?this.activeComponent.graphic:this._get(`createGraphic`)}get defaultCreateOptions(){return this._get(`defaultCreateOptions`)}set defaultCreateOptions(e){this._set(`defaultCreateOptions`,{...V,...e})}get defaultUpdateOptions(){return this._get(`defaultUpdateOptions`)}set defaultUpdateOptions(e){this._set(`defaultUpdateOptions`,{...H,...e,reshapeOptions:{...H.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...H.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get(`textSymbol`)}set textSymbol(e){this._set(`textSymbol`,e)}get snappingOptions(){return this.snappingManager?.options??this._get(`snappingOptions`)}set snappingOptions(e){this._defaultSnappingManager!=null&&(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=m(this._defaultSnappingManager)),this._override(`snappingManager`,e);else{let{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new F({options:this.snappingOptions,view:e})),this._clearOverride(`snappingManager`)}}get state(){let e=!!(this.view?.ready&&this.layer),t=this._operationHandle;return e&&t?`active`:e?`ready`:`disabled`}get toolTransitionInProgress(){return this._toolTransitionHandles.updating||!!this.drawTool?.lifecycleManager.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.toolTransitionInProgress||this.activeComponent&&`updating`in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this._operationSnappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get(`view`)}set view(e){let t=this._get(`view`);if(t===e)return;if(t){let{container:e,map:n}=t;e&&this._clearCursor(),n?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}let n=`view-ready`;this.removeHandles(n),e&&this.addHandles(ne(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},b),n),this._set(`view`,e),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||this.view?.type!==`2d`}get pluginManager(){return this._pluginManager}get drawTool(){return this.activeComponent?.type===`draw-2.0`?this.activeComponent:null}get activePluginConfigurations(){return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).filter(a)??[]}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome(`rootPlugins`,e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;let e=this.view?.type??`2d`,{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(a)??[]}get firstPluginWithSwappableLeaf(){let e=this.view?.type??`2d`;return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>t!=null&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1)}get multiplePluginsActive(){return this.drawTool?this.drawTool.pluginStack.length>1:!1}replaceLeaf(e){this.drawTool?.replaceLeaf(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=h(this._moduleLoaderAbortController),this._viewReadyAbortController=h(this._viewReadyAbortController),this._drawToolSimplifyAbortController=h(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){let{state:e,updateGraphics:t}=this;if(e===`active`&&t.length){let{activeTool:e}=this,n=t.toArray();this.removeGraphics(n),this.cancel(),this._emitDeleteEvent({graphics:n,tool:e})}}duplicate(){if(this.state===`active`&&this.updateGraphics.length){let 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){return this._toolTransitionHandles.addPromise(this._create(e,t))}async _create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{view:n,layer:r}=this;if(!n||this.state===`disabled`)throw r||this._logMissingLayer(),_();if(n.activeTool!=null&&(n.activeTool=null),!e){this._logError(`sketch:missing-parameter`,`Missing parameter 'tool'.`);return}O(n,this._internalGraphicsLayer);let i=this._createOperationContext(n),a;try{a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t))}catch(e){throw this._destroyOperationContext(i),e}if(a==null||this.destroyed||i!==this._operationContext){let e=i===this._operationContext;a?.onEnd(),m(a),this._destroyOperationContext(i),e&&n.map?.remove(this._internalGraphicsLayer);return}let o=z(e);a.on(`complete`,()=>{if(a===this._operationHandle){let n=this.createGraphic,r=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._set(`createGraphic`,null),this.view?.map?.remove(this._internalGraphicsLayer),!a.cancelled&&n!=null&&this.addGraphic(n),this._sketchContinuationFlag=!1,this.emit(`create`,{graphic:n,state:r?`cancel`:`complete`,tool:o??`point`,toolEventInfo:null,type:`create`}),r||this._sketchContinuationFlag)return;let{creationMode:i}=this;if(i===`continuous`){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(v(this.create(e,t)))}else i===`update`&&n&&this._updatingHandles.consumePromise(v(this.update([n])))}}),this._operationHandle=a,n.ready&&n.focus()}async place(e,t){return await e.load(),this.create(`mesh`,{mode:`click`,hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){return this._toolTransitionHandles.addPromise(this._update(e,t))}async _update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{layer:n,view:r,state:i}=this;if(!r||i===`disabled`)throw n||this._logMissingLayer(),_();r.activeTool!=null&&(r.activeTool=null);let a=Array.isArray(e)?e:[e];if(e==null||!a?.length){this._logError(`sketch:missing-parameter`,`Missing parameter 'graphics'.`);return}if(a.some(e=>this.hasGraphic(e)?e.geometry==null&&(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;let o=this._createOperationContext(r),s;try{s=await this._updatingHandles.addPromise(this._setupUpdateOperation(a,t))}catch(e){throw this._destroyOperationContext(o),e}this.destroyed||s==null||$(s)||o!==this._operationContext?(s&&!$(s)&&(s.onEnd(),s.destroy()),this._destroyOperationContext(o)):(O(r,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit(`update`,{graphics:a,state:`start`,aborted:!1,tool:s.tool,toolEventInfo:null,type:`update`}))}async _updateSpatialReference(e){let t=this.view;if(!t)this._logMissingView();else{e=Array.isArray(e)?e:[e];for(let n of e)n.geometry!=null&&n.geometry.type!==`mesh`&&!le(n.geometry.spatialReference,t.spatialReference)&&(!ae(n.geometry.spatialReference,t.spatialReference)&&!oe()&&await se(),n.geometry=ce(n.geometry,t.spatialReference))}}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._updatingHandles.consumePromise(this._operationHandle?.toggleTool())}_createOperationContext(e){this._destroyOperationContext();let t=this.useViewOptions?e.options:null,n=t?Te(e):null,r=t?new M:this.sketchOptions,i;if(t){let{values:t}=r;i=l([j(r,()=>e.options,()=>this.sketchOptions),y(()=>t.directionMode,e=>{this.sketchOptions.values.directionMode=e},re)])}return this._operationContext={snappingManager:n?.snappingManager??this.snappingManager,toolOptions:r,...l([n,i])}}_destroyOperationContext(e=this._operationContext){e===this._operationContext?this._operationContext=g(this._operationContext):g(e)}async _getFirstHit(e){let t=this.view;if(!t)return this._logMissingView(),null;if(t.type===`2d`){let n=[];t.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});return ke(r.results)}let n=[t.map.ground];t.map.allLayers.forEach(e=>{pe(e)&&fe.shouldIntersectAsGround(e)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});if(r.results.length>0){let e=r.results[0];if(e!=null&&e.type===`graphic`&&e.graphic&&(!r.ground.mapPoint||t.map.ground.opacity<1||r.ground.distance-(e.distance??0)>-Math.min(3*r.ground.distance,t.state.isGlobal?ie(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:1/0)))return e}return null}_generateViewHandles(e){return[e.on(`immediate-click`,async e=>{let t=this.state===`active`&&this._operationHandle?.type===`create`;this.state!==`disabled`&&!t&&this.updateOnGraphicClick&&await this._toolTransitionHandles.addPromise(this._handleImmediateClick(e))},k.WIDGET)]}async _handleImmediateClick(e){let t=await e.defer(()=>this._getFirstHit(I(e))),n=null;if(t!=null){let r=t.graphic;this.updateGraphics.includes(r)||this.hasGraphic(r)?(e.stopPropagation(),n=r):this.view?.type===`2d`&&!this._isComponentGraphic(r)&&this.state===`active`&&this.cancel()}else this.state===`active`&&this.cancelUpdateOnClickAway&&this.cancel();n!=null&&!this.updateGraphics.includes(n)&&await this.update([n],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r={hasZ:n.type===`3d`,...this.defaultCreateOptions,...t},i=typeof e==`string`?this.pluginManager?.getPluginsEquivalentToCreateTool(e,r):e,a=z(e);if(i&&!this.isUsingLegacyCreateTools){let e=await this._setupDrawTool(i,r,a??`polyline`);if(e)return this._setupDrawToolOperationHandle(e,a??`point`)}if(!a)return null;let o=await this._setupDrawGraphicTool(a,n,r);return o==null?null:(n.tools.add(o),n.activeTool=o,this._setupCreateOperationHandle(o,a))}async _setupDrawGraphicTool(e,t,n){if(e===`multipoint`&&t.type===`3d`)return this._logError(`sketch:create`,`Multipoint geometries are not supported in SceneView.`),null;if(!t)return this._logMissingView(),null;let{cursor:r,defaultZ:i,hasZ:a,geometryToPlace:o,graphicProperties:s,mode:c,preserveAspectRatio:l}=n,u=Le(c,e),d=Re(e),f=n?.optionsPerTool?.has(e)?n.optionsPerTool.get(e):{},p=f?.preserveAspectRatio??l??e!==`rectangle`,m={centered:e!==`rectangle`&&!(e===`circle`&&!p),cursor:r,defaultZ:i,forceUniformSize:p,graphicProperties:{...s,attributes:{...s?.attributes}},geometryToPlace:o,geometryType:d,mode:u,graphicSymbol:n.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:a,snappingManager:this._operationSnappingManager,snapToScene:!1,view:t,...f};return t.type===`2d`?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){let t=await this._requireModule(import(`../../views/2d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:Be(e.geometryType)?this.activeFillSymbol:null,toolOptions:this._operationToolOptions})}async _makeDrawGraphicTool3D(e){let t=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,toolOptions:this._operationToolOptions})}_setupCreateOperationHandle(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let a=null,o=e.forceUniformSize,s=e.centered,c=new i,l=[u(()=>c.destroy()),n.on(`key-down`,t=>{if(t.key===A.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===A.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key===A.vertexAdd&&!t.repeat){let n=e.drawOperation.geometryType;(n===`polyline`||n===`polygon`||n===`multipoint`)&&(t.stopPropagation(),e.drawOperation.commitStagedVertex())}else t.key===A.undo?(t.stopPropagation(),f.undo()):t.key===A.redo?(t.stopPropagation(),f.redo()):t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)&&!t.repeat?(e.forceUniformSize=!o,t.stopPropagation()):t.key===A.center&&(t.repeat||(e.centered=!s,t.stopPropagation()))},k.WIDGET),n.on(`key-up`,t=>{t.key===A.pan?e.enabled=!0:t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)?(e.forceUniformSize=o,t.stopPropagation()):t.key===A.center&&(e.centered=s,t.stopPropagation())},k.WIDGET),e.on(`vertex-update`,()=>{c.notify()}),e.on(`vertex-add`,t=>{switch(c.notify(),a=a==null?`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(c.notify(),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?f&&f.cancel():f&&f.complete()}),y(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],f=new Ne({activeComponent:e,type:`create`,onEnd:()=>{d(l),n.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(r(c),e.canUndo),canRedo:()=>(r(c),e.canRedo)});return f}_setupDrawToolOperationHandle(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r=null,i=[n.on(`key-down`,t=>{t.key===A.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},k.WIDGET),n.on(`key-up`,t=>{t.key===A.pan&&(e.editable=!0)},k.WIDGET),e.on(`before-vertex-add`,t=>{let n=e.mostUpstreamPlugin?.configuration;if(n&&`legacyCreateTool`in n&&(n?.legacyCreateTool===`point`||n.legacyCreateTool===`text`)){let e=t.detail.originalEvent;e&&`key`in e&&e.key===A.vertexAdd&&t.preventDefault()}}),e.on(`before-complete`,t=>{let n=e.getGeometryIfCompleted();(!n||Ie(n))&&t.preventDefault()}),e.on([`vertex-add`,`vertex-remove`],n=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.getGeometryIfCompleted()),r=r==null&&n.type!==`vertex-remove`?`start`:`active`,n.operation){case`apply`:this.emit(`create`,{graphic:this.createGraphic,state:r,tool:this.activeTool,toolEventInfo:n,type:`create`});break;case`undo`:this._emitUndoEvent({graphics:[this.createGraphic].filter(a),tool:t});break;case`redo`:this._emitRedoEvent({graphics:[this.createGraphic].filter(a),tool:t})}}),e.on(`cursor-update`,t=>{this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),(t.vertices[0]?.vertexIndex>0||t.vertices[0]?.componentIndex>0)&&this.emit(`create`,{graphic:this.createGraphic,state:`active`,tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:`cursor-update`},type:`create`})}),e.on(`complete`,async({geometry:t,isSimple:n})=>{let r=this.createGraphic,i=!!t&&t.type!==`mesh`&&t.type!==`extent`&&!n;if(r&&(r.geometry=n?t:e.unprocessedGeometry??t),!i||!r)o.complete();else{this._internalGraphicsLayer.add(this.createGraphic);let e=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=e,await this._updatingHandles.addPromise(v(this._finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:r,handle:o})))}})],o=new L({activeComponent:e,type:`create`,onEnd:()=>{d(i),n.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return i.push(e.on(`cancel`,()=>{this._drawToolSimplifyAbortController=h(this._drawToolSimplifyAbortController),o.cancel()})),o}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:n,handle:r}){let i=this.view?.acquireCursor(`progress`,`high`);i&&this.addHandles(i);let a=()=>e.signal.aborted?(n&&(this._layerAdapter?.remove(n),this._internalGraphicsLayer?.remove(n)),this._set(`createGraphic`,null),!0):!1;try{let i=await this._geometryWorkerHandle.simplify(t,e.signal);if(a())return;n.geometry=i??t,this._internalGraphicsLayer?.remove(n),r.complete()}finally{i?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_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){let{view:n}=this;if(!n)return this._logMissingView(),null;let r={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=r;let i=r.tool??H.tool;if(this.removeGraphics(e),this.addGraphics(e),n.type===`3d`){if(e.length===0)return null;switch(i){case`move`:return this._setupMove3DOperation(e,r,n,i);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupReshape3DOperation(e[0],r,n);case`transform`:return this._setupGraphicTransform3DOperation(e,r,n)}}switch(i){case`move`:return this._setupMove2DOperation(e,r,n);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupTransformOrReshape2DOperation(e,i,r,n);case`transform`:return B(e)&&(i=`reshape`),this._setupTransformOrReshape2DOperation(e,i,r,n)}}async _setupMove3DOperation(e,t,n,r,i=!1){let a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,MoveTool3D:s}=a.module,c=new Map,l=()=>{c.forEach(e=>e.destroy()),c.clear()};for(let t of e){let e=new o({view:n,graphic:t}),r=ye(e);if(r!==0)return l(),this._logError(`sketch:move`,`Move operation not supported for provided graphic(s) (${D(r)}).`),null;c.set(t,e)}let u=new s({view:n,enableZ:t.enableZ,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(u),u.objects.addMany(Array.from(c.values())),i||this.updateGraphics.addMany(e);let f=[],p=new R({activeComponent:u,tool:r,type:`update`,onEnd:()=>{d(f),Q(n,u),l()},undo:()=>{X(this.view,u),q(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},addToSelection:async e=>{this.updateGraphics.push(e);let t=new o({view:n,graphic:e});c.set(e,t),u.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:async e=>{let t=this.updateGraphics.indexOf(e);if(p.history.undo.forEach(e=>e.updates.splice(t,1)),p.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`}),this.updateGraphics.length===0){p.complete();return}let n=c.get(e);n&&(u.objects.remove(n),n.destroy(),c.delete(e))},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1||r!==`transform`)return;let e=this.updateGraphics.at(0),i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));i&&!$(i)&&(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(i,t))}});return f.push(...this._getHandlesForComponent(p,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(p,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e)},k.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,n,r=!1){if(e.length===1&&xe(e[0])===0){let i=e[0],a=i.geometry;if(a!=null&&(a.type===`point`||a.type===`mesh`))return this._setupPointTransform3DOperation(i,t,n);if(a!=null&&(a.type===`polygon`||a.type===`polyline`))return this._setupPolyTransform3DOperation(i,t,n,r)}return this._setupMove3DOperation(e,t,n,`transform`,r)}async _setupPointTransform3DOperation(e,t,n){let r=`transform`,{enableRotation:i,enableScaling:a,enableZ:o}=t,s=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(s))return s;let{TransformTool3D:c,ManipulatedObject3DGraphic:l}=s.module,u=new l({graphic:e,view:n}),f=new c({object:u,view:n,enableRotation:i,enableScaling:a,enableZ:o,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),this.updateGraphics.add(e);let p=[],m=new R({activeComponent:f,tool:r,type:`update`,onEnd:()=>{d(p),Q(n,f),u.destroy()},undo:()=>{X(this.view,f),q(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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:async()=>{}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,n,r=!1){let i=`transform`,{enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:c}=t,l=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(l))return l;let{ManipulatedObject3DGraphic:u,ExtentTransformTool:f}=l.module,p=this.view?.inputManager?.isModifierKeyDown(A.constraint),m=new u({view:n,graphic:e}),h=new f({object:m,view:n,enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:!!c!=!!p,toolOptions:this._operationToolOptions});n.tools.add(h),r||this.updateGraphics.add(e);let g=[],_=new R({activeComponent:h,tool:i,type:`update`,onEnd:()=>{d(g),Q(n,h),m.destroy()},canUndo:()=>!h.destroyed&&h.canUndo,undo:()=>{h.destroyed||(h.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!h.destroyed&&h.canRedo,redo:()=>{h.destroyed||(h.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`}),await this._replaceUpdateOperationHandle(_,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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`}),_.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1)return;let r=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));r&&!$(r)&&(_.onEnd(),_.destroy(),this._setUpdateOperationHandle(r,t))}});return g.push(...this._getHandlesForComponent(_,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(_,e,t),k.WIDGET),n.on(`key-down`,e=>this._getCommonUpdateOperationKeyDownHandlers(_,e),k.WIDGET),n.on(`key-down`,e=>{e.key===A.constraint&&!e.repeat&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET)),_}async _setupMove2DOperation(e,t,n){let r=`move`;this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,n));if($(i))return i;let a=new R({activeComponent:i,tool:r,type:`update`,onEnd:()=>{this._clearCursor(),d(c),d(s),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{let e=this.updateGraphics.toArray();q(a,e),a.refreshComponent(),this._emitUndoEvent({graphics:e,tool:r})},redo:()=>{let e=this.updateGraphics.toArray();J(a,e),a.refreshComponent(),this._emitRedoEvent({graphics:e,tool:r})},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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`}),this.updateGraphics.length===0?a.complete():i.graphics=n}}),o=!1,s=[n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&(o=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&o&&(o=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET)],c=this._getHandlesForComponent(a,t);return a}async _setupReshape3DOperation(e,t,n,r=!1){let i=`reshape`,a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,ReshapeTool3D:s}=a.module,c=new o({view:n,graphic:e}),l=be(c);if(l!==0)return c.destroy(),this._logError(`sketch:reshape`,`Reshape operation not supported for provided graphic(s) (${D(l)}).`),null;let u=t.reshapeOptions,f=new s({view:n,object:c,enableZVertex:t.enableZ&&u?.vertexOperation===`move`,enableZShape:t.enableZ&&u?.shapeOperation===`move`,enableMoveObject:u?.shapeOperation===`move`||u?.shapeOperation===`move-xy`,enableMidpoints:u?.edgeOperation===`split`,enableEdgeOffset:u?.edgeOperation===`offset`,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),r||this.updateGraphics.add(c.graphic);let p=[],m=new R({activeComponent:f,tool:i,type:`update`,onEnd:()=>{d(p),Q(n,f),c.destroy()},canUndo:()=>!f.destroyed&&f.canUndo,undo:()=>{f.destroyed||(f.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!f.destroyed&&f.canRedo,redo:()=>{f.destroyed||(f.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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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:async()=>{t.toggleToolOnClick!==!1&&await this._replaceUpdateOperationHandle(m,t,()=>this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,n,!0))}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupTransformOrReshape2DOperation(e,t,n,r){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(t===`transform`?this._getBox(e,n,r):this._getReshape(e,n,r));if($(i))return i;let a=new R({activeComponent:i,type:`update`,onEnd:()=>{d(s),d(o),a.activeComponent&&!a.activeComponent.destroyed&&a.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{q(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},redo:()=>{J(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},addToSelection:async e=>{let t=a.activeComponent;if(t?.type===`reshape`){let t=[...this.updateGraphics,e];if(this.updateGraphics.removeAll(),!await this._replaceUpdateOperationHandle(a,n,()=>this._setupTransformOrReshape2DOperation(t,`transform`,n,r)))return}else this.updateGraphics.add(e),t=t,t.graphics=this.updateGraphics.toArray(),t.refresh(),a.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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();n.length===0?a.complete():B(n)?await a.toggleTool():a.activeComponent.graphics=n,this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;let e=this.updateGraphics.at(0),t=e.geometry;if(t!=null&&(a.tool===`reshape`&&t.type===`point`||a.tool===`transform`&&t.type===`extent`))return;let i=null,o={...this.defaultUpdateOptions,...n,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...n?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...n?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};a.tool===`transform`?i=await this._updatingHandles.addPromise(this._getReshape([e],o,r)):a.tool===`reshape`&&(i=await this._updatingHandles.addPromise(this._getBox([e],o,r))),$(i)||(a.activeComponent?.destroy(),a.activeComponent=i,a.activeComponent&&(d(s),s=this._getHandlesForComponent(a,o)))}}),o=[r.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,n),k.WIDGET),r.on(`key-down`,e=>{if(this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET),r.on(`key-up`,e=>{if(e.key===A.constraint&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET)],s=this._getHandlesForComponent(a,n);return a}async _getGraphicMover(e,t,n){let{enableMoveAllGraphics:r,highlightOptions:i}=t,a=await this._requireModule(import(`../../views/draw/support/GraphicMover.js`));return $(a)?a:new a.module.default({enableMoveAllGraphics:r,highlightName:i?.name,highlightsEnabled:!!i?.enabled,indicatorsEnabled:!1,graphics:e,view:n,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`grabbing`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-start`},type:`update`})},onGraphicMove:({dx:e,dy:t,graphic:n})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move`},type:`update`}),onGraphicMoveStop:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`pointer`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-stop`},type:`update`})},onGraphicPointerOver:()=>this._displayCursor(`move`),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,n){let{enableRotation:r,enableScaling:i,highlightOptions:a,preserveAspectRatio:o}=t,s=await this._requireModule(import(`../../views/draw/support/Box.js`));if($(s))return s;let c=this.view?.inputManager?.isModifierKeyDown(A.constraint),l=new s.module.default({graphics:e,enableRotation:r,enableScaling:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,preserveAspectRatio:!!o!=!!c,layer:this._internalGraphicsLayer,view:n,toolOptions:this._operationToolOptions,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`})}});return l.addHandles(y(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,n])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=n??t.enableScaling??!0,l.refresh()},b)),l}async _getReshape(e,t,n){let{highlightOptions:r,reshapeOptions:i}=t,a=i?.edgeOperation===`split`,o=i?.shapeOperation===`move`,s=!!i?.enableCreateCurveFromStraightEdge,c=await this._requireModule(import(`../../views/draw/support/Reshape.js`));return $(c)?c:new c.module.default({enableMidpoints:a,enableMovement:o,enableCurveOnMidpoint:s,graphic:e[0],highlightName:r?.name,highlightsEnabled:!!r?.enabled,layer:this._internalGraphicsLayer,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions,view:n,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:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMove:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMoveStop:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onVertexAdd:({added:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:r,vertices:n,type:t},type:`update`})},onVertexRemove:({removed:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{removed:r,vertices:n,type:t},type:`update`})}}})}_getHandlesForComponent(e,t){let n=e.activeComponent;if(!n)return[];switch(n.type){case`graphic-mover`:return[n.on(`graphic-click`,({graphic:n,viewEvent:r})=>{r.native?.shiftKey&&t.multipleSelectionEnabled&&(r.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(n)))}),n.on(`graphic-move-start`,t=>e.addToHistory(Z(t.allGraphics)))];case`box`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`rotate-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`scale-start`,t=>e.addToHistory(Z(t.graphics)))];case`reshape`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z([t.mover]))),n.on(`reshape-start`,t=>e.addToHistory(Z([t.graphic]))),n.on(`vertex-add`,t=>e.addToHistory(Z([t.oldGraphic]))),n.on(`vertex-remove`,t=>e.addToHistory(Z([t.oldGraphic])))];case`move-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`transform-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`reshape-3d`:return[n.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`})}),n.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`})}),n.events.on(`vertex-add`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`vertex-remove`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})]}}_onTransformOrReshape2DGraphicClick(e,t,n){let{graphic:r,viewEvent:i}=n;i.native?.shiftKey&&this.hasGraphic(r)?(i.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(r))):t.toggleToolOnClick&&(i.stopPropagation(),this._updatingHandles.consumePromise(e.toggleTool()))}async _replaceUpdateOperationHandle(e,t,n){let r=this._operationContext;e.onEnd(),e.destroy();let i=await this._updatingHandles.addPromise(n());return!i||$(i)||r!==this._operationContext?(i&&!$(i)&&(i.onEnd(),i.destroy()),this._destroyOperationContext(r),!1):(this._setUpdateOperationHandle(i,t),!0)}_setUpdateOperationHandle(e,t){this._operationHandle=e;let n=this.view?.map;this._disablePopup(t),e.on(`complete`,()=>{if(e===this._operationHandle){let r=this.updateGraphics.toArray(),i=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),n&&n.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit(`update`,{graphics:r,state:`complete`,aborted:e.cancelled,tool:i,toolEventInfo:null,type:`update`})}})}_getCommonUpdateOperationClickHandlers(e,t,n){return this._updatingHandles.addPromise(this._handleCommonUpdateOperationClick(e,t,n))}async _handleCommonUpdateOperationClick(e,t,n){let r=I(t),i=await t.defer(()=>this._getFirstHit(r));if(i==null){this.cancelUpdateOnClickAway&&e.complete();return}let a=t.native.shiftKey?this._toggleSelection([i.graphic],e,n):null;a?(t.stopPropagation(),await a):this.updateGraphics.includes(i.graphic)?this._shouldTemporarilyDisablePopup(n)&&t.stopPropagation():e.complete()}async _toggleSelection(e,t,n){let r=!!n.multipleSelectionEnabled;for(let n of e)if(n!=null&&r&&this.hasGraphic(n))return this.updateGraphics.includes(n)?await t.removeFromSelection(n):await t.addToSelection(n)}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;let n=t.key;n===A.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):n===A.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):n===A.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&A.delete.includes(n)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&this._operationHandle.type===`update`&&this.activeComponent!=null&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&=(this.view?.map?.remove(this._internalGraphicsLayer),m(this._internalGraphicsLayer))}_isComponentGraphic(e){let{activeComponent:t}=this;return!e||t==null?!1:e.attributes?.esriSketchTool||t.type===`draw-2d`&&t.graphic===e||(t.type===`box`||t.type===`reshape`)&&t.isUIGraphic(e)}_clearCursor(){this.removeHandles(U)}_displayCursor(e){this.removeHandles(U),this.view?.container&&e!=null&&this.addHandles(this.view.acquireCursor(e,`high`),U)}_logError(e,t,n){p.getLogger(this).error(new s(e,t,n))}async _requireModule(e){let t=new AbortController;this._moduleLoaderAbortController=t;let n=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:`aborted`}:{module:n}}_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(this._operationHandle!=null){let{updateGraphics:t}=this;for(let n of e.removed)if(t.includes(n)){if(t.length>1)this._updatingHandles.consumePromise(this._operationHandle.removeFromSelection(n));else{this._operationHandle.cancel();break}}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,t,n){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;let r=this.view,i=await import(`../../views/draw/DrawTool.js`);await this.pluginManager.loadPlugins();let a=await this.pluginManager.makeRenderer({customSymbol:t.graphicSymbol,useTextSymbol:n===`text`}),o=new i.DrawTool({view:r,elevationInfo:this._layerAdapter?.elevationInfo??me(r.type===`3d`),hasZ:!!t.hasZ,toolOptions:this._operationToolOptions,renderer:a,defaultZ:t.defaultZ??0,directionOptions:t.directionOptions,snappingManager:this._operationSnappingManager,enableVertexVisuals:n!==`rectangle`&&n!==`circle`,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});o.addHandles(f(a));let s=new ue({...t.graphicProperties,attributes:{...t.graphicProperties?.attributes},symbol:t.graphicSymbol??this._getGraphicSymbolFromTool(n)});return t.graphicSymbol||o.addHandles(y(()=>this._getGraphicSymbolFromTool(n),e=>s.symbol=e)),this._set(`createGraphic`,s),r.addAndActivateTool(o),o.begin(e),o}get test(){}wait(){return x(()=>!this.updating)}_shouldTemporarilyDisablePopup(e){return this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled==null&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled!=null&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){let e=this.view;e?(h(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await ee(x(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError(`sketch:missing-property`,K(`view`))}_logMissingLayer(){this._logError(ze,K(`layer`))}};e([t()],G.prototype,`_defaultSnappingManager`,void 0),e([t()],G.prototype,`_operationContext`,void 0),e([t()],G.prototype,`_layerAdapter`,null),e([t()],G.prototype,`_pluginManager`,void 0),e([t({readOnly:!0})],G.prototype,`settingsManager`,void 0),e([t()],G.prototype,`_operationHandle`,void 0),e([t({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([t({readOnly:!0})],G.prototype,`_toolTransitionHandles`,void 0),e([t()],G.prototype,`_drawToolSimplifyAbortController`,void 0),e([t({readOnly:!0})],G.prototype,`activeTool`,null),e([t()],G.prototype,`geometrySimplificationInProgress`,null),e([t({readOnly:!0})],G.prototype,`activeCreateToolDrawMode`,null),e([t()],G.prototype,`activeTooltip`,null),e([t({types:T})],G.prototype,`activeFillSymbol`,void 0),e([t()],G.prototype,`activeLineSymbol`,void 0),e([t()],G.prototype,`activeVertexSymbol`,void 0),e([t()],G.prototype,`allowDeleteKey`,void 0),e([t({readOnly:!0})],G.prototype,`createGraphic`,null),e([t()],G.prototype,`defaultCreateOptions`,null),e([t()],G.prototype,`defaultUpdateOptions`,null),e([t()],G.prototype,`activeUpdateOptions`,void 0),e([t({type:Se,nonNullable:!0})],G.prototype,`labelOptions`,null),e([t()],G.prototype,`layer`,void 0),e([t({types:T})],G.prototype,`pointSymbol`,void 0),e([t({types:T})],G.prototype,`polygonSymbol`,void 0),e([t({types:T})],G.prototype,`polylineSymbol`,void 0),e([t()],G.prototype,`meshSymbol`,void 0),e([t({type:E})],G.prototype,`textSymbol`,null),e([t({type:N,nonNullable:!0})],G.prototype,`snappingOptions`,null),e([t()],G.prototype,`snappingManager`,null),e([t({readOnly:!0})],G.prototype,`state`,null),e([t()],G.prototype,`toolTransitionInProgress`,null),e([t({type:Ce,nonNullable:!0})],G.prototype,`tooltipOptions`,null),e([t({readOnly:!0})],G.prototype,`updateGraphics`,void 0),e([t()],G.prototype,`updateOnGraphicClick`,void 0),e([t()],G.prototype,`useViewOptions`,void 0),e([t()],G.prototype,`cancelUpdateOnClickAway`,void 0),e([t()],G.prototype,`updating`,null),e([t()],G.prototype,`creationMode`,void 0),e([t({type:we,nonNullable:!0})],G.prototype,`valueOptions`,null),e([t({types:T})],G.prototype,`vertexSymbol`,void 0),e([t({value:null})],G.prototype,`view`,null),e([t({constructOnly:!0,type:P})],G.prototype,`sketchOptions`,void 0),e([t()],G.prototype,`useLegacyCreateTools`,void 0),e([t()],G.prototype,`isUsingLegacyCreateTools`,null),e([t()],G.prototype,`pluginManager`,null),e([t()],G.prototype,`drawTool`,null),e([t()],G.prototype,`activePluginConfigurations`,null),e([t()],G.prototype,`rootPlugins`,null),e([t()],G.prototype,`effectiveAvailablePlugins`,null),e([t()],G.prototype,`firstPluginWithSwappableLeaf`,null),e([t()],G.prototype,`multiplePluginsActive`,null),G=e([n(`esri.widgets.Sketch.SketchViewModel`)],G);const ze=`sketch:missing-property`,K=e=>`Property '${e}' is missing on SketchViewModel.`;function Be(e){return e===`polygon`||e===`rectangle`||e===`circle`}function q(e,t){Y(`undo`,e.history.undo,e.history.redo,t)}function J(e,t){Y(`redo`,e.history.redo,e.history.undo,t)}function Y(e,t,n,r){let i=t.pop();if(!i)return;let a=i.updates,o=[];r.forEach((t,n)=>{let r=a[n];r!=null&&(`geometry`in r&&r.geometry!=null&&(o.push({geometry:t.geometry}),t.geometry=r.geometry),`symbol`in r&&r.symbol!=null&&(o.push({symbol:t.symbol}),t.symbol=r.symbol),`undo`in r&&(o.push(r),r[e](t)))}),n.push({updates:o})}function X(e,t){e!=null&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Z(e){return{updates:e.map(({geometry:e})=>e?.type===`mesh`?{geometry:e.cloneShallow()}:{geometry:e})}}function Q(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function $(e){return`requireError`in e&&e.requireError===`aborted`}export{G as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import i from"../../core/Collection.js";import{deprecatedModule as a}from"../../core/deprecate.js";import o from"../../core/Error.js";import s from"../../core/Logger.js";import{watch as c}from"../../core/reactiveUtils.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import u from"../../Graphic.js";import{onLocaleChange as d,fetchMessageBundle as f}from"../../intl.js";import p from"../../layers/GraphicsLayer.js";import m from"../../symbols/LineSymbolMarker.js";import h from"../../symbols/SimpleLineSymbol.js";import{addUniqueLayer as g}from"../../views/draw/support/layerUtils.js";const _={noAssociationTypeSpecified:-0x7ffbcd38};a(s.getLogger(`esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationViewModel`),`UtilityNetworkAssociationViewModel`,{replacement:`UtilityNetwork.synthesizeAssociationGeometries`,version:`5.0`,see:`https://esriurl.com/UtilityNetworkClass#synthesizeAssociationGeometries`,warnOnce:!0});let v=class extends t{constructor(e){super(e),this._internalGraphicsLayerConnectivity=this._createInternalGraphicsLayer(`Connectivity Associations (Internal)`),this._internalGraphicsLayerStructuralAttachment=this._createInternalGraphicsLayer(`Structural Attachment Associations (Internal)`),this._initialValidationsFinished=!1,this._updatingHandles=new l,this.autoRefreshAssociations=!1,this.connectivityAssociationsLineSymbol=new h({style:`short-dash`,width:2,color:[190,159,159,1]}),this.executionError=``,this.loadErrors=new i,this.maxAllowableAssociations=250,this.showAssociationsEnabled=!1,this.showArrowsConnectivity=!1,this.showArrowsStructuralAttachment=!1,this.structuralAttachmentAssociationsLineSymbol=new h({style:`short-dash`,width:2,color:[159,190,159,1]})}initialize(){let e=async()=>{this.messages||=await f(`esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations`)};e().then(()=>{this.view||=null,this.utilityNetwork||=null,this.addHandles([c(()=>[this.view,this.utilityNetwork],async()=>{let{loadErrors:e,messages:{info:{noUtilityNetwork:t,noView:n}}}=this;this._initialValidationsFinished=!1,e.removeAll();let r=!1,i=!1;this.removeAssociations(),this.view?.type===`2d`?(g(this.view,this._internalGraphicsLayerConnectivity),g(this.view,this._internalGraphicsLayerStructuralAttachment),r=!0):(this.loadErrors.push(n),s.getLogger(this).error(new o(`utilityNetworkAssociations:missing-property`,n))),this.utilityNetwork?.type===`utility`?i=!0:(this.loadErrors.push(t),s.getLogger(this).error(new o(`utilityNetworkAssociations:missing-property`,t))),r&&i&&this.showAssociationsEnabled&&await this.showAssociations(),this._internalGraphicsLayerConnectivity.visible=this.includeConnectivityAssociations,this._internalGraphicsLayerStructuralAttachment.visible=this.includeStructuralAttachmentAssociations,this._initialValidationsFinished=!0},{initial:!0}),c(()=>[this.view?.stationary,this.showAssociationsEnabled,this.maxAllowableAssociations],async()=>{this.view?.stationary&&this.showAssociationsEnabled&&(this.includeConnectivityAssociations||this.includeStructuralAttachmentAssociations)&&await this.showAssociations()}),c(()=>[this.showArrowsConnectivity],()=>{let e=this.connectivityAssociationsLineSymbol.clone();e.marker=null,this.showArrowsConnectivity&&(e.marker=new m({color:this.connectivityAssociationsLineSymbol.color,placement:`end`,style:`arrow`}));for(let t of this._internalGraphicsLayerConnectivity.graphics)t.symbol=e}),c(()=>[this.showArrowsStructuralAttachment],()=>{let e=this.structuralAttachmentAssociationsLineSymbol.clone();e.marker=null,this.showArrowsStructuralAttachment&&(e.marker=new m({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:`end`,style:`arrow`}));for(let t of this._internalGraphicsLayerStructuralAttachment.graphics)t.symbol=e}),c(()=>{let{cap:e,color:t,style:n,width:r,marker:i}=this.connectivityAssociationsLineSymbol;return[e,t,n,r,i]},()=>{let e=this.connectivityAssociationsLineSymbol.clone();for(let t of this._internalGraphicsLayerConnectivity.graphics)t.symbol=e;this.showArrowsConnectivity=!1,e.marker=null,this.connectivityAssociationsLineSymbol.marker&&(this.showArrowsConnectivity=!0,e.marker=new m({color:this.connectivityAssociationsLineSymbol.color,placement:`end`,style:`arrow`}))}),c(()=>{let{cap:e,color:t,style:n,width:r,marker:i}=this.structuralAttachmentAssociationsLineSymbol;return[e,t,n,r,i]},()=>{let e=this.structuralAttachmentAssociationsLineSymbol.clone();for(let t of this._internalGraphicsLayerStructuralAttachment.graphics)t.symbol=e;this.showArrowsStructuralAttachment=!1,e.marker=null,this.structuralAttachmentAssociationsLineSymbol.marker&&(this.showArrowsStructuralAttachment=!0,e.marker=new m({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:`end`,style:`arrow`}))}),d(e)])})}destroy(){this._updatingHandles.destroy(),this.view=null,this._removeInternalGraphicsLayers()}set includeConnectivityAssociations(e){this._set(`includeConnectivityAssociations`,e),this._internalGraphicsLayerConnectivity.visible=e}set includeStructuralAttachmentAssociations(e){this._set(`includeStructuralAttachmentAssociations`,e),this._internalGraphicsLayerStructuralAttachment.visible=e}get state(){return this.loadErrors.length?`disabled`:this._updatingHandles.updating?`executing`:this.executionError===``?this._initialValidationsFinished?`ready`:`loading`:`warning`}get utilityNetwork(){return this._get(`utilityNetwork`)}set utilityNetwork(e){this._get(`utilityNetwork`)!==e&&this._set(`utilityNetwork`,e)}get view(){return this._get(`view`)}set view(e){this._get(`view`)!==e&&this._set(`view`,e)}removeAssociations(){this._internalGraphicsLayerConnectivity.removeAll(),this._internalGraphicsLayerStructuralAttachment.removeAll()}async showAssociations(){let{messages:{info:{maxAllowableAssociationsExceeded:e,noAssociationsFound:t,noAssociationTypeSpecified:n}},utilityNetwork:r}=this;this._set(`executionError`,``);let i={extent:this.view?.extent,gdbVersion:this.utilityNetwork?.gdbVersion,maxGeometryCount:this.maxAllowableAssociations,moment:this.utilityNetwork?.historicMoment,outSpatialReference:this.view?.spatialReference.clone(),returnConnectivityAssociations:this.includeConnectivityAssociations,returnAttachmentAssociations:this.includeStructuralAttachmentAssociations};this._updatingHandles.consumePromise(r?.synthesizeAssociationGeometries(i).then(n=>{let r=[],i=[];n?.maxGeometryCountExceeded?(this.removeAssociations(),this._set(`executionError`,e)):n?.associations.length===0?(this.removeAssociations(),this._set(`executionError`,t)):n&&(r=n?.associations.filter(({associationType:e})=>e.toLowerCase().includes(`connectivity`)).map(e=>(this.connectivityAssociationsLineSymbol.marker=null,this.showArrowsConnectivity&&(this.connectivityAssociationsLineSymbol.marker=new m({color:this.connectivityAssociationsLineSymbol.color,placement:`end`,style:`arrow`})),new u({geometry:e.geometry.clone(),symbol:this.connectivityAssociationsLineSymbol}))),i=n.associations.filter(({associationType:e})=>e===`attachment`).map(e=>(this.structuralAttachmentAssociationsLineSymbol.marker=null,this.showArrowsStructuralAttachment&&(this.structuralAttachmentAssociationsLineSymbol.marker=new m({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:`end`,style:`arrow`})),new u({geometry:e.geometry.clone(),symbol:this.structuralAttachmentAssociationsLineSymbol}))),this._internalGraphicsLayerConnectivity.removeAll(),r.length>0&&this._internalGraphicsLayerConnectivity.addMany(r),this._internalGraphicsLayerStructuralAttachment.removeAll(),i.length>0&&this._internalGraphicsLayerStructuralAttachment.addMany(i))},e=>{let t=`Error: `+e;
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import i from"../../core/Collection.js";import{deprecatedModule as a}from"../../core/deprecate.js";import o from"../../core/Error.js";import s from"../../core/Logger.js";import{watch as c}from"../../core/reactiveUtils.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import u from"../../Graphic.js";import{onLocaleChange as d,fetchMessageBundle as f}from"../../intl.js";import p from"../../layers/GraphicsLayer.js";import m from"../../symbols/LineSymbolMarker.js";import h from"../../symbols/SimpleLineSymbol.js";import{addUniqueLayer as g}from"../../views/draw/support/layerUtils.js";const _={noAssociationTypeSpecified:-0x7ffbcd38};a(s.getLogger(`esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationViewModel`),`UtilityNetworkAssociationViewModel`,{replacement:`UtilityNetwork.synthesizeAssociationGeometries`,version:`5.0`,see:`https://esriurl.com/UtilityNetworkClass#synthesizeAssociationGeometries`,warnOnce:!0});let v=class extends t{constructor(e){super(e),this._internalGraphicsLayerConnectivity=this._createInternalGraphicsLayer(`Connectivity Associations (Internal)`),this._internalGraphicsLayerStructuralAttachment=this._createInternalGraphicsLayer(`Structural Attachment Associations (Internal)`),this._initialValidationsFinished=!1,this._updatingHandles=new l,this.autoRefreshAssociations=!1,this.connectivityAssociationsLineSymbol=new h({style:`short-dash`,width:2,color:[190,159,159,1]}),this.executionError=``,this.loadErrors=new i,this.maxAllowableAssociations=250,this.showAssociationsEnabled=!1,this.showArrowsConnectivity=!1,this.showArrowsStructuralAttachment=!1,this.structuralAttachmentAssociationsLineSymbol=new h({style:`short-dash`,width:2,color:[159,190,159,1]})}initialize(){let e=async()=>{this.messages||=await f(`esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations`)};e().then(()=>{this.view||=null,this.utilityNetwork||=null,this.addHandles([c(()=>[this.view,this.utilityNetwork],async()=>{let{loadErrors:e,messages:{info:{noUtilityNetwork:t,noView:n}}}=this;this._initialValidationsFinished=!1,e.removeAll();let r=!1,i=!1;this.removeAssociations(),this.view?.type===`2d`?(g(this.view,this._internalGraphicsLayerConnectivity),g(this.view,this._internalGraphicsLayerStructuralAttachment),r=!0):(this.loadErrors.push(n),s.getLogger(this).error(new o(`utilityNetworkAssociations:missing-property`,n))),this.utilityNetwork?.type===`utility`?i=!0:(this.loadErrors.push(t),s.getLogger(this).error(new o(`utilityNetworkAssociations:missing-property`,t))),r&&i&&this.showAssociationsEnabled&&await this.showAssociations(),this._internalGraphicsLayerConnectivity.visible=this.includeConnectivityAssociations,this._internalGraphicsLayerStructuralAttachment.visible=this.includeStructuralAttachmentAssociations,this._initialValidationsFinished=!0},{initial:!0}),c(()=>[this.view?.stationary,this.showAssociationsEnabled,this.maxAllowableAssociations],async()=>{this.view?.stationary&&this.showAssociationsEnabled&&(this.includeConnectivityAssociations||this.includeStructuralAttachmentAssociations)&&await this.showAssociations()}),c(()=>[this.showArrowsConnectivity],()=>{let e=this.connectivityAssociationsLineSymbol.clone();e.marker=null,this.showArrowsConnectivity&&(e.marker=new m({color:this.connectivityAssociationsLineSymbol.color,placement:`end`,style:`arrow`}));for(let t of this._internalGraphicsLayerConnectivity.graphics)t.symbol=e}),c(()=>[this.showArrowsStructuralAttachment],()=>{let e=this.structuralAttachmentAssociationsLineSymbol.clone();e.marker=null,this.showArrowsStructuralAttachment&&(e.marker=new m({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:`end`,style:`arrow`}));for(let t of this._internalGraphicsLayerStructuralAttachment.graphics)t.symbol=e}),c(()=>{let{cap:e,color:t,style:n,width:r,marker:i}=this.connectivityAssociationsLineSymbol;return[e,t,n,r,i]},()=>{let e=this.connectivityAssociationsLineSymbol.clone();for(let t of this._internalGraphicsLayerConnectivity.graphics)t.symbol=e;this.showArrowsConnectivity=!1,e.marker=null,this.connectivityAssociationsLineSymbol.marker&&(this.showArrowsConnectivity=!0,e.marker=new m({color:this.connectivityAssociationsLineSymbol.color,placement:`end`,style:`arrow`}))}),c(()=>{let{cap:e,color:t,style:n,width:r,marker:i}=this.structuralAttachmentAssociationsLineSymbol;return[e,t,n,r,i]},()=>{let e=this.structuralAttachmentAssociationsLineSymbol.clone();for(let t of this._internalGraphicsLayerStructuralAttachment.graphics)t.symbol=e;this.showArrowsStructuralAttachment=!1,e.marker=null,this.structuralAttachmentAssociationsLineSymbol.marker&&(this.showArrowsStructuralAttachment=!0,e.marker=new m({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:`end`,style:`arrow`}))}),d(e)])})}destroy(){this._updatingHandles.destroy(),this.view=null,this._removeInternalGraphicsLayers()}set includeConnectivityAssociations(e){this._set(`includeConnectivityAssociations`,e),this._internalGraphicsLayerConnectivity.visible=e}set includeStructuralAttachmentAssociations(e){this._set(`includeStructuralAttachmentAssociations`,e),this._internalGraphicsLayerStructuralAttachment.visible=e}get state(){return this.loadErrors.length?`disabled`:this._updatingHandles.updating?`executing`:this.executionError===``?this._initialValidationsFinished?`ready`:`loading`:`warning`}get utilityNetwork(){return this._get(`utilityNetwork`)}set utilityNetwork(e){this._get(`utilityNetwork`)!==e&&this._set(`utilityNetwork`,e)}get view(){return this._get(`view`)}set view(e){this._get(`view`)!==e&&this._set(`view`,e)}removeAssociations(){this._internalGraphicsLayerConnectivity.removeAll(),this._internalGraphicsLayerStructuralAttachment.removeAll()}async showAssociations(){let{messages:{info:{maxAllowableAssociationsExceeded:e,noAssociationsFound:t,noAssociationTypeSpecified:n}},utilityNetwork:r}=this;this._set(`executionError`,``);let i={extent:this.view?.extent,gdbVersion:this.utilityNetwork?.gdbVersion,maxGeometryCount:this.maxAllowableAssociations,moment:this.utilityNetwork?.historicMoment,outSpatialReference:this.view?.spatialReference.clone(),returnConnectivityAssociations:this.includeConnectivityAssociations,returnAttachmentAssociations:this.includeStructuralAttachmentAssociations};this._updatingHandles.consumePromise(r?.synthesizeAssociationGeometries(i).then(n=>{let r=[],i=[];n?.maxGeometryCountExceeded?(this.removeAssociations(),this._set(`executionError`,e)):n?.associations.length===0?(this.removeAssociations(),this._set(`executionError`,t)):n&&(r=n?.associations.filter(({associationType:e})=>e.toLowerCase().includes(`connectivity`)).map(e=>(this.connectivityAssociationsLineSymbol.marker=null,this.showArrowsConnectivity&&(this.connectivityAssociationsLineSymbol.marker=new m({color:this.connectivityAssociationsLineSymbol.color,placement:`end`,style:`arrow`})),new u({geometry:e.geometry.clone(),symbol:this.connectivityAssociationsLineSymbol}))),i=n.associations.filter(({associationType:e})=>e===`attachment`).map(e=>(this.structuralAttachmentAssociationsLineSymbol.marker=null,this.showArrowsStructuralAttachment&&(this.structuralAttachmentAssociationsLineSymbol.marker=new m({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:`end`,style:`arrow`})),new u({geometry:e.geometry.clone(),symbol:this.structuralAttachmentAssociationsLineSymbol}))),this._internalGraphicsLayerConnectivity.removeAll(),r.length>0&&this._internalGraphicsLayerConnectivity.addMany(r),this._internalGraphicsLayerStructuralAttachment.removeAll(),i.length>0&&this._internalGraphicsLayerStructuralAttachment.addMany(i))},e=>{let t=`Error: `+e;e instanceof o&&e.details?.raw&&(t=e.details.raw.extendedCode===_.noAssociationTypeSpecified?n:e.details.message),this._set(`executionError`,t)}))}_createInternalGraphicsLayer(e){return new p({listMode:`hide`,internal:!0,title:e})}_removeInternalGraphicsLayers(){this._internalGraphicsLayerConnectivity&&this._internalGraphicsLayerStructuralAttachment&&this.view?.map&&(this.view.map.remove(this._internalGraphicsLayerConnectivity),this.view.map.remove(this._internalGraphicsLayerStructuralAttachment))}};e([n()],v.prototype,`_initialValidationsFinished`,void 0),e([n()],v.prototype,`autoRefreshAssociations`,void 0),e([n({type:h,nonNullable:!0})],v.prototype,`connectivityAssociationsLineSymbol`,void 0),e([n({readOnly:!0})],v.prototype,`executionError`,void 0),e([n({type:Boolean,value:!0})],v.prototype,`includeConnectivityAssociations`,null),e([n({type:Boolean,value:!0})],v.prototype,`includeStructuralAttachmentAssociations`,null),e([n()],v.prototype,`loadErrors`,void 0),e([n()],v.prototype,`maxAllowableAssociations`,void 0),e([n()],v.prototype,`messages`,void 0),e([n()],v.prototype,`showAssociationsEnabled`,void 0),e([n()],v.prototype,`showArrowsConnectivity`,void 0),e([n()],v.prototype,`showArrowsStructuralAttachment`,void 0),e([n({readOnly:!0})],v.prototype,`state`,null),e([n({type:h,nonNullable:!0})],v.prototype,`structuralAttachmentAssociationsLineSymbol`,void 0),e([n()],v.prototype,`utilityNetwork`,null),e([n()],v.prototype,`view`,null),v=e([r(`esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationsViewModel`)],v);const y=v;export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../core/accessorSupport/decorators.js";import{deprecateWidget as r}from"../core/deprecate.js";import i from"../core/Logger.js";import{watch as a,initial as o,on as s}from"../core/reactiveUtils.js";import c from"../symbols/SimpleLineSymbol.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import{messageBundle as u,tsx as d}from"./support/widget.js";import f from"./UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js";import p from"./UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";import m from"./UtilityNetworkAssociations/VisibleElements.js";import h from"./Widget.js";const g=`esri-un-associations`,_={action:`${g}__action`,blockContent:`${g}__block-content`,blockSectionSettings:`${g}__block-section-settings`,combobox:`${g}__combobox`,comboboxItem:`${g}__combobox-item`,divControlsMain:`${g}__div-controls-main`,label:`${g}__label`,labelAndCombobox:`${g}__label-and-combobox`,labelAndSlider:`${g}__label-and-slider`,labelAndToggle:`${g}__label-and-toggle`,panel:`${g}__panel`,slider:`${g}__slider`,statusIconWarning:`${g}__status-icon-warning`,switch:`${g}__switch`,widgetContainer:`${g}__widget-container`};let v=class extends h{constructor(e){super(e),this._autoRefreshAssociations=!0,this._associationsOptionsEnabled=!1,this._maxAllowableAssociationsSliderMax=1e3,this._maxAllowableAssociationsSliderMin=250,this._maxAllowableAssociationsSliderStep=250,this.messages=null,this.messagesCommon=null,this.viewModel=new p,this.visibleElements=new m,this.announceDeprecation=()=>{r(i.getLogger(this),`Utility Network Associations`,`arcgis-utility-network-associations`,{version:`5.0`})}}initialize(){this.addHandles([a(()=>[this.view?.stationary,this.showAssociationsEnabled,this.includeConnectivityAssociations,this.includeStructuralAttachmentAssociations,this.maxAllowableAssociations],()=>{this.autoRefreshAssociations===!0&&(this.showAssociationsEnabled===!0?this.viewModel.showAssociations():this.viewModel.removeAssociations())}),a(()=>this.view?.map?.utilityNetworks,e=>{e?.items.forEach(async(e,t)=>{e.loaded||await e.load(),t===0&&(this.utilityNetwork=e)})},o),s(()=>this.view?.map?.utilityNetworks,`change`,e=>{let t=e.target;e.added.forEach(async e=>{e.loaded||await e.load()}),e.removed.some(e=>e.layerUrl===this.utilityNetwork?.layerUrl)&&(this.utilityNetwork=null),this.utilityNetwork=t.length?t.getItemAt(0):null})])}get autoRefreshAssociations(){return this._autoRefreshAssociations}set autoRefreshAssociations(e){this._autoRefreshAssociations=e}get connectivityAssociationsLineSymbol(){return this.viewModel.connectivityAssociationsLineSymbol}set connectivityAssociationsLineSymbol(e){this.viewModel.connectivityAssociationsLineSymbol=e}get icon(){return`view-associations`}set icon(e){this._overrideIfSome(`icon`,e)}get includeConnectivityAssociations(){return this.viewModel.includeConnectivityAssociations}set includeConnectivityAssociations(e){this.viewModel.includeConnectivityAssociations=e}get includeStructuralAttachmentAssociations(){return this.viewModel.includeStructuralAttachmentAssociations}set includeStructuralAttachmentAssociations(e){this.viewModel.includeStructuralAttachmentAssociations=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get maxAllowableAssociations(){return this.viewModel.maxAllowableAssociations}set maxAllowableAssociations(e){this.viewModel.maxAllowableAssociations=e}get maxAllowableAssociationsSliderMax(){return this._maxAllowableAssociationsSliderMax}set maxAllowableAssociationsSliderMax(e){e<=this.maxAllowableAssociationsSliderMin||(this._maxAllowableAssociationsSliderMax=e)}get maxAllowableAssociationsSliderMin(){return this._maxAllowableAssociationsSliderMin}set maxAllowableAssociationsSliderMin(e){e<0||e>=this.maxAllowableAssociationsSliderMax||(this._maxAllowableAssociationsSliderMin=e)}get maxAllowableAssociationsSliderStep(){return this._maxAllowableAssociationsSliderStep}set maxAllowableAssociationsSliderStep(e){this._maxAllowableAssociationsSliderStep=e}get showArrowsConnectivity(){return this.viewModel.showArrowsConnectivity}set showArrowsConnectivity(e){this.viewModel.showArrowsConnectivity=e}get showArrowsStructuralAttachment(){return this.viewModel.showArrowsStructuralAttachment}set showArrowsStructuralAttachment(e){this.viewModel.showArrowsStructuralAttachment=e}get showAssociationsEnabled(){return this.viewModel.showAssociationsEnabled}set showAssociationsEnabled(e){this.viewModel.showAssociationsEnabled=e}get structuralAttachmentAssociationsLineSymbol(){return this.viewModel.structuralAttachmentAssociationsLineSymbol}set structuralAttachmentAssociationsLineSymbol(e){this.viewModel.structuralAttachmentAssociationsLineSymbol=e}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(e){this.viewModel.utilityNetwork=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{label:e}=this;return d(`div`,{class:_.widgetContainer},d(`calcite-block`,{class:_.blockContent,expandable:!0,heading:e},this._renderStatusIcon(),this.autoRefreshAssociations?this._renderShowAssociationsSwitch():this._renderRefreshAssociationsAction(),this._renderContent()),this._renderWarningIconTooltip(),this._renderStatusIconTooltip(),this._renderShowAssociationsTooltip(),this._renderRefreshAssociationsActionTooltip())}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),"block-section":()=>import(`@esri/calcite-components/dist/components/calcite-block-section`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),slider:()=>import(`@esri/calcite-components/dist/components/calcite-slider`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)})}_connectivityAssociationsSwitchChange(e){this.includeConnectivityAssociations=e.currentTarget.checked}_getLoadErrorMessagesAsNotices(e,t){return d(`calcite-notice`,{closable:!1,key:`error-notice-${t}`,kind:`warning`,open:!0,scale:`s`},d(`div`,{slot:`message`},e))}_maxAllowableAssociationsSliderChange(e){this.maxAllowableAssociations=Number(e.currentTarget.value)}_refreshAssociations(){let{viewModel:e,viewModel:{state:t}}=this;(t===`ready`||t===`warning`)&&e.showAssociations()}_renderConnectivityAssociationsSettings(){let{messages:{input:{enableConnectivity:e}},visibleElements:{connectivityAssociationsSettings:t}}=this;if(t)return d(`calcite-block-section`,{class:_.blockSectionSettings,text:e},d(f,{id:`${this.id}-symbol-picker-connectivity`,lineSymbol:this.connectivityAssociationsLineSymbol,showArrows:this.showArrowsConnectivity,visibleElements:t}))}_renderConnectivityAssociationsToggle(){let{messages:{input:{enableConnectivity:e}}}=this;return d(`div`,{class:_.labelAndToggle,key:`connectivityAssociationsToggleDiv`},d(`calcite-label`,{class:_.label},e),d(`calcite-switch`,{bind:this,checked:this.includeConnectivityAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._connectivityAssociationsSwitchChange}))}_renderComboboxItem({heading:e,value:t,selected:n}){return d(`calcite-combobox-item`,{class:_.comboboxItem,heading:e,selected:n,value:t})}_renderContent(){let{viewModel:{loadErrors:e,state:t}}=this;return t===`disabled`?d(`div`,{class:_.divControlsMain,key:`loadErrorsDiv`},e.items.map(this._getLoadErrorMessagesAsNotices)):d(`calcite-panel`,{class:_.panel,disabled:t===`loading`},d(`div`,{class:_.divControlsMain},this._renderConnectivityAssociationsToggle(),this._renderStructuralAttachmentAssociationsToggle(),this._renderSettingsPane()))}_renderLoadingIcon(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return d(`calcite-action`,{class:_.statusIconWarning,icon:`spinner`,id:r,loading:!0,scale:`s`,slot:`actions-end`,text:n===`executing`?e:t})}_renderMaxAllowableAssociationsSlider(){let{messages:{input:{maxAllowableAssociations:e}},visibleElements:{maxAllowableAssociationsSlider:t}}=this;if(t)return d(`div`,{class:_.labelAndSlider,key:`maxAllowableAssociationsSliderDiv`},d(`calcite-label`,{class:_.label},e),d(`calcite-slider`,{bind:this,class:_.slider,labelTicks:!0,max:this.maxAllowableAssociationsSliderMax,min:this.maxAllowableAssociationsSliderMin,scale:`s`,snap:!0,step:this.maxAllowableAssociationsSliderStep,ticks:this.maxAllowableAssociationsSliderStep,value:this.maxAllowableAssociations,onCalciteSliderChange:this._maxAllowableAssociationsSliderChange}))}_renderRefreshAssociationsAction(){let{messages:{input:{refreshAssociations:e}},viewModel:{state:t}}=this,n=`${this.id}-refresh-action`;return d(`calcite-action`,{bind:this,class:_.action,disabled:t===`disabled`,icon:`refresh-f`,id:n,loading:t===`loading`,slot:`actions-end`,text:e,onclick:this._refreshAssociations})}_renderRefreshAssociationsActionTooltip(){let{messages:{input:{refreshAssociations:e}}}=this,t=`${this.id}-refresh-action`;return d(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderSettingsPane(){let{messagesCommon:{settings:e},visibleElements:{maxAllowableAssociationsSlider:t,connectivityAssociationsSettings:n,structuralAttachmentAssociationsSettings:r}}=this;if((this.view?.map).utilityNetworks?.items?.length!==1||t||n||r)return d(`calcite-block`,{class:_.blockContent,expandable:!0,heading:e},d(`div`,{class:_.divControlsMain},this._renderUtilityNetworkSettings(),this._renderMaxAllowableAssociationsSlider()),this._renderConnectivityAssociationsSettings(),this._renderStructuralAttachmentAssociationsSettings())}_renderShowAssociationsSwitch(){let{viewModel:{state:e}}=this,t=`${this.id}-show-associations-switch`;return d(`calcite-switch`,{bind:this,checked:this.showAssociationsEnabled,class:_.switch,disabled:e===`disabled`,id:t,slot:`actions-end`,onCalciteSwitchChange:this._showAssociationsSwitchChange})}_renderShowAssociationsTooltip(){let{messages:{input:{enableAssociations:e}}}=this,t=`${this.id}-show-associations-switch`;return d(`calcite-tooltip`,{referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderStatusIcon(){let{viewModel:{state:e}}=this;switch(e){case`disabled`:case`warning`:return this._renderWarningIcon();case`loading`:case`executing`:return this._renderLoadingIcon();default:return}}_renderStatusIconTooltip(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return d(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:r,topLayerDisabled:this.topLayerDisabled},n===`executing`?e:t)}_renderStructuralAttachmentAssociationsSettings(){let{messages:{input:{enableStructuralAttachment:e}},visibleElements:{structuralAttachmentAssociationsSettings:t}}=this;if(t)return d(`calcite-block-section`,{class:_.blockSectionSettings,text:e},d(f,{id:`${this.id}-symbol-picker-structural-attachment`,lineSymbol:this.structuralAttachmentAssociationsLineSymbol,showArrows:this.showArrowsStructuralAttachment,visibleElements:t}))}_renderStructuralAttachmentAssociationsToggle(){let{messages:{input:{enableStructuralAttachment:e}}}=this;return d(`div`,{class:_.labelAndToggle,key:`structuralAttachmentAssociationsToggleDiv`},d(`calcite-label`,{class:_.label},e),d(`calcite-switch`,{bind:this,checked:this.includeStructuralAttachmentAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._structuralAttAssociationsSwitchChange}))}_renderUtilityNetworkSettings(){let{messages:{input:{utilityNetwork:e}}}=this,t=(this.view?.map).utilityNetworks?.items;if(t?.length===1)return null;let n=t?.map(e=>{let t=e.title,n=e.layerUrl,r=e.layerUrl===this.utilityNetwork?.layerUrl;return this._renderComboboxItem({heading:t,value:n,selected:r})});return d(`div`,{class:_.labelAndCombobox,key:`utilityNetworkComboboxDiv`},d(`calcite-label`,{class:_.label},e),d(`calcite-combobox`,{class:_.combobox,clearDisabled:!0,label:``,maxItems:3,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:e=>{let n=t?.find(t=>t.layerUrl===e.currentTarget.value);this.utilityNetwork=n}},n))}_showAssociationsSwitchChange({currentTarget:e}){let{viewModel:t}=this;this.showAssociationsEnabled=e.checked,this._associationsOptionsEnabled=e.checked,this.showAssociationsEnabled||t.removeAssociations()}_structuralAttAssociationsSwitchChange(e){this.includeStructuralAttachmentAssociations=e.currentTarget.checked}_renderWarningIcon(){let e=`${this.id}-warning-action`;return d(`calcite-icon`,{class:_.statusIconWarning,icon:`exclamation-mark-triangle`,id:e,scale:`s`,slot:`actions-end`})}_renderWarningIconTooltip(){let{viewModel:{executionError:e,state:t}}=this,n=`${this.id}-warning-action`;switch(t){case`warning`:return d(`calcite-tooltip`,{referenceElement:n,topLayerDisabled:this.topLayerDisabled},e);default:return}}};e([t()],v.prototype,`autoRefreshAssociations`,null),e([t({type:c})],v.prototype,`connectivityAssociationsLineSymbol`,null),e([t()],v.prototype,`icon`,null),e([t()],v.prototype,`includeConnectivityAssociations`,null),e([t()],v.prototype,`includeStructuralAttachmentAssociations`,null),e([t()],v.prototype,`label`,null),e([t()],v.prototype,`maxAllowableAssociations`,null),e([t()],v.prototype,`maxAllowableAssociationsSliderMax`,null),e([t()],v.prototype,`maxAllowableAssociationsSliderMin`,null),e([t()],v.prototype,`maxAllowableAssociationsSliderStep`,null),e([t(),u(`esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations`)],v.prototype,`messages`,void 0),e([t(),u(`esri/t9n/common`)],v.prototype,`messagesCommon`,void 0),e([t()],v.prototype,`showArrowsConnectivity`,null),e([t()],v.prototype,`showArrowsStructuralAttachment`,null),e([t()],v.prototype,`showAssociationsEnabled`,null),e([t({type:c})],v.prototype,`structuralAttachmentAssociationsLineSymbol`,null),e([t()],v.prototype,`utilityNetwork`,null),e([t()],v.prototype,`view`,null),e([t({type:p})],v.prototype,`viewModel`,void 0),e([t({type:m,nonNullable:!0})],v.prototype,`visibleElements`,void 0),v=e([n(`esri.widgets.UtilityNetworkAssociations`)],v);const y=v;export{y as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../core/accessorSupport/decorators.js";import{deprecateWidget as r}from"../core/deprecate.js";import i from"../core/Logger.js";import{watch as a,initial as o,on as s}from"../core/reactiveUtils.js";import c from"../symbols/SimpleLineSymbol.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import{messageBundle as u,tsx as d}from"./support/widget.js";import f from"./UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js";import p from"./UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";import m from"./UtilityNetworkAssociations/VisibleElements.js";import h from"./Widget.js";const g=`esri-un-associations`,_={action:`${g}__action`,blockContent:`${g}__block-content`,blockSectionSettings:`${g}__block-section-settings`,combobox:`${g}__combobox`,comboboxItem:`${g}__combobox-item`,divControlsMain:`${g}__div-controls-main`,label:`${g}__label`,labelAndCombobox:`${g}__label-and-combobox`,labelAndSlider:`${g}__label-and-slider`,labelAndToggle:`${g}__label-and-toggle`,panel:`${g}__panel`,slider:`${g}__slider`,statusIconWarning:`${g}__status-icon-warning`,switch:`${g}__switch`,widgetContainer:`${g}__widget-container`};let v=class extends h{constructor(e){super(e),this._autoRefreshAssociations=!0,this._associationsOptionsEnabled=!1,this._maxAllowableAssociationsSliderMax=1e3,this._maxAllowableAssociationsSliderMin=250,this._maxAllowableAssociationsSliderStep=250,this.messages=null,this.messagesCommon=null,this.viewModel=new p,this.visibleElements=new m,this.announceDeprecation=()=>{r(i.getLogger(this),`Utility Network Associations`,`arcgis-utility-network-associations`,{version:`5.0`})}}initialize(){this.addHandles([a(()=>[this.view?.stationary,this.showAssociationsEnabled,this.includeConnectivityAssociations,this.includeStructuralAttachmentAssociations,this.maxAllowableAssociations],()=>{this.autoRefreshAssociations===!0&&(this.showAssociationsEnabled===!0?this.viewModel.showAssociations():this.viewModel.removeAssociations())}),a(()=>this.view?.map?.utilityNetworks,e=>{e?.items.forEach(async(e,t)=>{e.loaded||await e.load(),t===0&&(this.utilityNetwork=e)})},o),s(()=>this.view?.map?.utilityNetworks,`change`,e=>{let t=e.target;e.added.forEach(async e=>{e.loaded||await e.load()}),e.removed.some(e=>e.layerUrl===this.utilityNetwork?.layerUrl)&&(this.utilityNetwork=null),this.utilityNetwork=t.length?t.getItemAt(0):null})])}get autoRefreshAssociations(){return this._autoRefreshAssociations}set autoRefreshAssociations(e){this._autoRefreshAssociations=e}get connectivityAssociationsLineSymbol(){return this.viewModel.connectivityAssociationsLineSymbol}set connectivityAssociationsLineSymbol(e){this.viewModel.connectivityAssociationsLineSymbol=e}get icon(){return`view-associations`}set icon(e){this._overrideIfSome(`icon`,e)}get includeConnectivityAssociations(){return this.viewModel.includeConnectivityAssociations}set includeConnectivityAssociations(e){this.viewModel.includeConnectivityAssociations=e}get includeStructuralAttachmentAssociations(){return this.viewModel.includeStructuralAttachmentAssociations}set includeStructuralAttachmentAssociations(e){this.viewModel.includeStructuralAttachmentAssociations=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get maxAllowableAssociations(){return this.viewModel.maxAllowableAssociations}set maxAllowableAssociations(e){this.viewModel.maxAllowableAssociations=e}get maxAllowableAssociationsSliderMax(){return this._maxAllowableAssociationsSliderMax}set maxAllowableAssociationsSliderMax(e){e<=this.maxAllowableAssociationsSliderMin||(this._maxAllowableAssociationsSliderMax=e)}get maxAllowableAssociationsSliderMin(){return this._maxAllowableAssociationsSliderMin}set maxAllowableAssociationsSliderMin(e){e<0||e>=this.maxAllowableAssociationsSliderMax||(this._maxAllowableAssociationsSliderMin=e)}get maxAllowableAssociationsSliderStep(){return this._maxAllowableAssociationsSliderStep}set maxAllowableAssociationsSliderStep(e){this._maxAllowableAssociationsSliderStep=e}get showArrowsConnectivity(){return this.viewModel.showArrowsConnectivity}set showArrowsConnectivity(e){this.viewModel.showArrowsConnectivity=e}get showArrowsStructuralAttachment(){return this.viewModel.showArrowsStructuralAttachment}set showArrowsStructuralAttachment(e){this.viewModel.showArrowsStructuralAttachment=e}get showAssociationsEnabled(){return this.viewModel.showAssociationsEnabled}set showAssociationsEnabled(e){this.viewModel.showAssociationsEnabled=e}get structuralAttachmentAssociationsLineSymbol(){return this.viewModel.structuralAttachmentAssociationsLineSymbol}set structuralAttachmentAssociationsLineSymbol(e){this.viewModel.structuralAttachmentAssociationsLineSymbol=e}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(e){this.viewModel.utilityNetwork=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{label:e}=this;return d(`div`,{class:_.widgetContainer},d(`calcite-block`,{class:_.blockContent,expandable:!0,heading:e},this._renderStatusIcon(),this.autoRefreshAssociations?this._renderShowAssociationsSwitch():this._renderRefreshAssociationsAction(),this._renderContent()),this._renderWarningIconTooltip(),this._renderStatusIconTooltip(),this._renderShowAssociationsTooltip(),this._renderRefreshAssociationsActionTooltip())}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),"block-section":()=>import(`@esri/calcite-components/dist/components/calcite-block-section`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),slider:()=>import(`@esri/calcite-components/dist/components/calcite-slider`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)})}_connectivityAssociationsSwitchChange(e){this.includeConnectivityAssociations=e.currentTarget.checked}_getLoadErrorMessagesAsNotices(e,t){return d(`calcite-notice`,{closable:!1,key:`error-notice-${t}`,kind:`warning`,open:!0,scale:`s`},d(`div`,{slot:`message`},e))}_maxAllowableAssociationsSliderChange(e){this.maxAllowableAssociations=Number(e.currentTarget.value)}_refreshAssociations(){let{viewModel:e,viewModel:{state:t}}=this;(t===`ready`||t===`warning`)&&e.showAssociations()}_renderConnectivityAssociationsSettings(){let{messages:{input:{enableConnectivity:e}},visibleElements:{connectivityAssociationsSettings:t}}=this;if(t)return d(`calcite-block-section`,{class:_.blockSectionSettings,text:e},d(f,{id:`${this.id}-symbol-picker-connectivity`,lineSymbol:this.connectivityAssociationsLineSymbol,showArrows:this.showArrowsConnectivity,visibleElements:t}))}_renderConnectivityAssociationsToggle(){let{messages:{input:{enableConnectivity:e}}}=this;return d(`div`,{class:_.labelAndToggle,key:`connectivityAssociationsToggleDiv`},d(`calcite-label`,{class:_.label},e),d(`calcite-switch`,{bind:this,checked:this.includeConnectivityAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._connectivityAssociationsSwitchChange}))}_renderComboboxItem({heading:e,value:t,selected:n}){return d(`calcite-combobox-item`,{class:_.comboboxItem,heading:e,selected:n,value:t})}_renderContent(){let{viewModel:{loadErrors:e,state:t}}=this;return t===`disabled`?d(`div`,{class:_.divControlsMain,key:`loadErrorsDiv`},e.items.map(this._getLoadErrorMessagesAsNotices)):d(`calcite-panel`,{class:_.panel,disabled:t===`loading`},d(`div`,{class:_.divControlsMain},this._renderConnectivityAssociationsToggle(),this._renderStructuralAttachmentAssociationsToggle(),this._renderSettingsPane()))}_renderLoadingIcon(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return d(`calcite-action`,{class:_.statusIconWarning,icon:`spinner`,id:r,loading:!0,scale:`s`,slot:`actions-end`,text:n===`executing`?e:t})}_renderMaxAllowableAssociationsSlider(){let{messages:{input:{maxAllowableAssociations:e}},visibleElements:{maxAllowableAssociationsSlider:t}}=this;if(t)return d(`div`,{class:_.labelAndSlider,key:`maxAllowableAssociationsSliderDiv`},d(`calcite-label`,{class:_.label},e),d(`calcite-slider`,{bind:this,class:_.slider,labelTicks:!0,max:this.maxAllowableAssociationsSliderMax,min:this.maxAllowableAssociationsSliderMin,scale:`s`,snap:!0,step:this.maxAllowableAssociationsSliderStep,ticks:this.maxAllowableAssociationsSliderStep,value:this.maxAllowableAssociations,onCalciteSliderChange:this._maxAllowableAssociationsSliderChange}))}_renderRefreshAssociationsAction(){let{messages:{input:{refreshAssociations:e}},viewModel:{state:t}}=this,n=`${this.id}-refresh-action`;return d(`calcite-action`,{bind:this,class:_.action,disabled:t===`disabled`,icon:`refresh-f`,id:n,loading:t===`loading`,slot:`actions-end`,text:e,onclick:this._refreshAssociations})}_renderRefreshAssociationsActionTooltip(){let{messages:{input:{refreshAssociations:e}}}=this,t=`${this.id}-refresh-action`;return d(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderSettingsPane(){let{messagesCommon:{settings:e},visibleElements:{maxAllowableAssociationsSlider:t,connectivityAssociationsSettings:n,structuralAttachmentAssociationsSettings:r}}=this;if((this.view?.map).utilityNetworks?.items?.length!==1||t||n||r)return d(`calcite-block`,{class:_.blockContent,expandable:!0,heading:e},d(`div`,{class:_.divControlsMain},this._renderUtilityNetworkSettings(),this._renderMaxAllowableAssociationsSlider()),this._renderConnectivityAssociationsSettings(),this._renderStructuralAttachmentAssociationsSettings())}_renderShowAssociationsSwitch(){let{viewModel:{state:e}}=this,t=`${this.id}-show-associations-switch`;return d(`calcite-switch`,{bind:this,checked:this.showAssociationsEnabled,class:_.switch,disabled:e===`disabled`,id:t,slot:`actions-end`,onCalciteSwitchChange:this._showAssociationsSwitchChange})}_renderShowAssociationsTooltip(){let{messages:{input:{enableAssociations:e}}}=this,t=`${this.id}-show-associations-switch`;return d(`calcite-tooltip`,{referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderStatusIcon(){let{viewModel:{state:e}}=this;switch(e){case`disabled`:case`warning`:return this._renderWarningIcon();case`loading`:case`executing`:return this._renderLoadingIcon();default:return}}_renderStatusIconTooltip(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return d(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:r,topLayerDisabled:this.topLayerDisabled},n===`executing`?e:t)}_renderStructuralAttachmentAssociationsSettings(){let{messages:{input:{enableStructuralAttachment:e}},visibleElements:{structuralAttachmentAssociationsSettings:t}}=this;if(t)return d(`calcite-block-section`,{class:_.blockSectionSettings,text:e},d(f,{id:`${this.id}-symbol-picker-structural-attachment`,lineSymbol:this.structuralAttachmentAssociationsLineSymbol,showArrows:this.showArrowsStructuralAttachment,visibleElements:t}))}_renderStructuralAttachmentAssociationsToggle(){let{messages:{input:{enableStructuralAttachment:e}}}=this;return d(`div`,{class:_.labelAndToggle,key:`structuralAttachmentAssociationsToggleDiv`},d(`calcite-label`,{class:_.label},e),d(`calcite-switch`,{bind:this,checked:this.includeStructuralAttachmentAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._structuralAttAssociationsSwitchChange}))}_renderUtilityNetworkSettings(){let{messages:{input:{utilityNetwork:e}}}=this,t=(this.view?.map).utilityNetworks?.items;if(t?.length===1)return null;let n=t?.map(e=>{let t=e.title,n=e.layerUrl,r=e.layerUrl===this.utilityNetwork?.layerUrl;return this._renderComboboxItem({heading:t,value:n,selected:r})});return d(`div`,{class:_.labelAndCombobox,key:`utilityNetworkComboboxDiv`},d(`calcite-label`,{class:_.label},e),d(`calcite-combobox`,{class:_.combobox,clearDisabled:!0,label:``,maxItems:3,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:e=>{let n=t?.find(t=>t.layerUrl===e.currentTarget.value);this.utilityNetwork=n}},n))}_showAssociationsSwitchChange({currentTarget:e}){let{viewModel:t}=this;this.showAssociationsEnabled=e.checked,this._associationsOptionsEnabled=e.checked,this.showAssociationsEnabled||t.removeAssociations()}_structuralAttAssociationsSwitchChange(e){this.includeStructuralAttachmentAssociations=e.currentTarget.checked}_renderWarningIcon(){let e=`${this.id}-warning-action`;return d(`calcite-icon`,{class:_.statusIconWarning,icon:`exclamation-mark-triangle`,id:e,scale:`s`,slot:`actions-end`})}_renderWarningIconTooltip(){let{viewModel:{executionError:e,state:t}}=this,n=`${this.id}-warning-action`;if(t===`warning`)return d(`calcite-tooltip`,{referenceElement:n,topLayerDisabled:this.topLayerDisabled},e)}};e([t()],v.prototype,`autoRefreshAssociations`,null),e([t({type:c})],v.prototype,`connectivityAssociationsLineSymbol`,null),e([t()],v.prototype,`icon`,null),e([t()],v.prototype,`includeConnectivityAssociations`,null),e([t()],v.prototype,`includeStructuralAttachmentAssociations`,null),e([t()],v.prototype,`label`,null),e([t()],v.prototype,`maxAllowableAssociations`,null),e([t()],v.prototype,`maxAllowableAssociationsSliderMax`,null),e([t()],v.prototype,`maxAllowableAssociationsSliderMin`,null),e([t()],v.prototype,`maxAllowableAssociationsSliderStep`,null),e([t(),u(`esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations`)],v.prototype,`messages`,void 0),e([t(),u(`esri/t9n/common`)],v.prototype,`messagesCommon`,void 0),e([t()],v.prototype,`showArrowsConnectivity`,null),e([t()],v.prototype,`showArrowsStructuralAttachment`,null),e([t()],v.prototype,`showAssociationsEnabled`,null),e([t({type:c})],v.prototype,`structuralAttachmentAssociationsLineSymbol`,null),e([t()],v.prototype,`utilityNetwork`,null),e([t()],v.prototype,`view`,null),e([t({type:p})],v.prototype,`viewModel`,void 0),e([t({type:m,nonNullable:!0})],v.prototype,`visibleElements`,void 0),v=e([n(`esri.widgets.UtilityNetworkAssociations`)],v);const y=v;export{y as default};
|