@arcgis/core 6.0.0-next.15 → 6.0.0-next.17
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/analysis/LineOfSightAnalysis.d.ts +49 -32
- package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
- package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
- package/analysis/Viewshed.d.ts +23 -3
- package/analysis/ViewshedAnalysis.d.ts +33 -13
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
- package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
- package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
- package/assets/esri/core/workers/chunks/164c8eeefa8232b2b191.js +2 -0
- package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
- package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +1 -0
- package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
- package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
- package/assets/esri/core/workers/chunks/{261fea092ee7d27608a0.js → 20a2124cbe43e5527c40.js} +1 -1
- package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
- package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
- package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
- package/assets/esri/core/workers/chunks/2853606099602f73d379.js +1 -0
- package/assets/esri/core/workers/chunks/2981e904ab62f3ed80d0.js +2 -0
- package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
- package/assets/esri/core/workers/chunks/32cc59e126df8c96a0cf.js +2 -0
- package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 34e0a8a3a2beea50f4f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
- package/assets/esri/core/workers/chunks/3e30b96a8c75bd5b9ae2.js +1 -0
- package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → 42753cf4965a94bc91ca.js} +1 -1
- package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
- package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
- package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
- package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
- package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
- package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
- package/assets/esri/core/workers/chunks/{b564ec4e03478f5659db.js → 4c240ca50f70bf30813f.js} +1 -1
- package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
- package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
- package/assets/esri/core/workers/chunks/{70d3055f15d8b0cf4074.js → 532e9cda8ac3601d8892.js} +1 -1
- package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
- package/assets/esri/core/workers/chunks/{953ba13299e7aa92c1a0.js → 564565246dae080f5e6c.js} +1 -1
- package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
- package/assets/esri/core/workers/chunks/{2145a512d269d64036b0.js → 58c3ae6030def2ed5f31.js} +1 -1
- package/assets/esri/core/workers/chunks/5a19a9c3e01d3d415188.js +1 -0
- package/assets/esri/core/workers/chunks/5a830bc35adbedd33783.js +1 -0
- package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 5b91e2dffdc84c006539.js} +1 -1
- package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/603fdbbe9534c614928f.js +1 -0
- package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → 60f92eb03c6e17ab4747.js} +1 -1
- package/assets/esri/core/workers/chunks/{67ebc5a3d46b254b725c.js → 612345f17f5eeb99ea8f.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b077c92345ffb5916c2.js → 65c98f3449044fa4fd79.js} +1 -1
- package/assets/esri/core/workers/chunks/{2bd4ee083ca4ad221f8b.js → 65cb5e39c467a35621ca.js} +1 -1
- package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
- package/assets/esri/core/workers/chunks/67a35155b8b4d36f171e.js +1 -0
- package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
- package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
- package/assets/esri/core/workers/chunks/{ae31fd416bbb41a81392.js → 6ad309154fe84210d23c.js} +1 -1
- package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
- package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
- package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
- package/assets/esri/core/workers/chunks/784d6c6949284ed6e10b.js +1 -0
- package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
- package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
- package/assets/esri/core/workers/chunks/{e2190361247f35b02b32.js → 7b5cd150a4d0139850be.js} +1 -1
- package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
- package/assets/esri/core/workers/chunks/7d2cbc767c336d15e4d5.js +1 -0
- package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
- package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js → 844eedda8f749972f707.js} +2 -2
- package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
- package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
- package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
- package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
- package/assets/esri/core/workers/chunks/9503eedfdda55fc5adab.js +1 -0
- package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
- package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
- package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
- package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +1 -0
- package/assets/esri/core/workers/chunks/9b6929faf649e81265fb.js +1 -0
- package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
- package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
- package/assets/esri/core/workers/chunks/a35c69a4751d28c39907.js +1 -0
- package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
- package/assets/esri/core/workers/chunks/{ec8b7476eac4718eb0ac.js → a504a5e06cb89a620799.js} +1 -1
- package/assets/esri/core/workers/chunks/a596779eaeec7310671d.js +1 -0
- package/assets/esri/core/workers/chunks/{d5d0fe8e198ff5a902ee.js → a5c8f9f5be4ef5063b42.js} +1 -1
- package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
- package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → ab1660f5f8a5268c2fac.js} +1 -1
- package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
- package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
- package/assets/esri/core/workers/chunks/ae0563d573baf91e01f7.js +1 -0
- package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
- package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
- package/assets/esri/core/workers/chunks/b686cd74975da09b9c91.js +2 -0
- package/assets/esri/core/workers/chunks/{aa36c3a9bbaa086e3757.js → b8fd7c3b36981261378b.js} +1 -1
- package/assets/esri/core/workers/chunks/bd046399e05e759e0bc2.js +1 -0
- package/assets/esri/core/workers/chunks/bd46a04a9ee4ea9e6ef1.js +2 -0
- package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
- package/assets/esri/core/workers/chunks/bfb39590c548188f5052.js +1 -0
- package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
- package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
- package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
- package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
- package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
- package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → dd0310184fe4832755a8.js} +1 -1
- package/assets/esri/core/workers/chunks/dfa5f1311806473e473f.js +1 -0
- package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
- package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
- package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
- package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
- package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
- package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
- package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
- package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
- package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
- package/assets/esri/core/workers/chunks/{634523cc7757da9020e4.js → fb70ab267a08e24b710f.js} +1 -1
- package/assets/esri/core/workers/chunks/fc139f251dc0523074e7.js +1 -0
- package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
- package/assets/esri/themes/base/widgets/_Weather.scss +1 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/index.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/config.d.ts +2 -0
- package/config.js +1 -1
- package/core/accessorSupport/DefaultsStore.js +1 -1
- package/core/accessorSupport/MultiOriginStore.js +1 -1
- package/core/accessorSupport/Store.js +1 -1
- package/core/accessorSupport/decorators/reader.js +1 -1
- package/core/accessorSupport/decorators/writer.js +1 -1
- package/core/sql/WhereGrammar.js +2 -2
- package/core/workers/WorkerOwner.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +2 -2
- package/core/workers.d.ts +9 -0
- package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
- package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/curves/bezierCurveUtils.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/polygonExtentClipping.js +1 -1
- package/identity/Credential.js +1 -1
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -2
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/CatalogLayer.d.ts +2 -2
- package/layers/CatalogLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -2
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +4 -4
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.d.ts +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/LineOfSightLayer.d.ts +10 -8
- package/layers/SceneLayer.js +1 -1
- package/layers/SubtypeGroupLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.d.ts +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/effects/parser.js +3 -3
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
- package/layers/mixins/ReloadableLayer.js +2 -0
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +2 -2
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/InMemoryRaster.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/raster/formats/ElevationCodec.js +2 -0
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/Lerc.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/Zlib.js +1 -1
- package/layers/raster/functions/stretchUtils.js +1 -1
- package/layers/raster/functions/vectorFieldUtils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/LercWorker.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/TileInfo.d.ts +1 -1
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/featureReductionProperties.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/layerOriginUtils.js +1 -1
- package/layers/video/VideoController.js +10 -10
- package/libs/maquette/projection.js +1 -1
- package/networks/UtilityNetworkTraceAnalysis.js +1 -1
- package/package.json +6 -6
- package/popup/FeatureModel.js +1 -1
- package/popup/FeaturesModel.js +1 -1
- package/portal/Portal.js +1 -1
- package/request/process.js +1 -1
- package/request/types.d.ts +7 -0
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/trace.js +1 -1
- package/rest/query/executeQuery.js +1 -1
- package/smartMapping/raster/renderers/shadedRelief.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/clusterUtils.js +1 -1
- package/statistics/utils.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/ElevationInfo.d.ts +4 -3
- package/time/TimeExtent.d.ts +1 -1
- package/undoredo/support/Services.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/grid/GridView2D.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +7 -0
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
- package/views/3d/layers/i3s/I3SNode.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/FeatureTileFetcher3DDebugger.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/sphereExtentUtils.js +2 -0
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
- package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
- package/views/interactive/options/TooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/constraintUtils.js +1 -1
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/interactive/snapping/SnappingManagerPool.js +1 -1
- package/views/interactive/snapping/allLayerSnapping.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +35 -13
- package/views/layers/SketchLayerView.d.ts +1 -0
- package/views/layers/ViewshedLayerView.d.ts +36 -12
- package/views/webgl/Program.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +2 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +2 -0
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +2 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
- package/widgets/ElevationProfile/components/Statistics.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/Expand/ExpandViewModel.d.ts +2 -0
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/Fullscreen/FullscreenViewModel.d.ts +3 -1
- package/widgets/Home/HomeViewModel.d.ts +2 -0
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Swipe/SwipeViewModel.d.ts +2 -0
- package/widgets/Swipe/types.d.ts +9 -2
- package/widgets/TimeSlider/TimeSliderViewModel.d.ts +9 -5
- package/widgets/TimeSlider/types.d.ts +7 -0
- package/widgets/TimeSlider.d.ts +2 -3
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track/TrackViewModel.d.ts +4 -0
- package/widgets/Track/types.d.ts +1 -0
- package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/Selector3D/selectorUtils.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0050916e462e3c9e0627.js +0 -1
- package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
- package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
- package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
- package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
- package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
- package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
- package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
- package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
- package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
- package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
- package/assets/esri/core/workers/chunks/34cbaf844730ac2d92c2.js +0 -2
- package/assets/esri/core/workers/chunks/3c301a689c7853c9fa67.js +0 -2
- package/assets/esri/core/workers/chunks/3f946c13ad97fbed867b.js +0 -1
- package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
- package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
- package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
- package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
- package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
- package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
- package/assets/esri/core/workers/chunks/604f0f4150fb79ee54c8.js +0 -1
- package/assets/esri/core/workers/chunks/6299be5e7e26bf3c6859.js +0 -1
- package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
- package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
- package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
- package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
- package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
- package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
- package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
- package/assets/esri/core/workers/chunks/745a153d0cd34faa124e.js +0 -1
- package/assets/esri/core/workers/chunks/7572c2bc5062e66f6330.js +0 -1
- package/assets/esri/core/workers/chunks/76ab353d80d786777161.js +0 -2
- package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
- package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
- package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
- package/assets/esri/core/workers/chunks/8483c50ed8f280fd74bb.js +0 -1
- package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
- package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
- package/assets/esri/core/workers/chunks/8cb716f110d164030309.js +0 -1
- package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
- package/assets/esri/core/workers/chunks/94e427040edb469d58ad.js +0 -1
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
- package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
- package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
- package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
- package/assets/esri/core/workers/chunks/b49df4ebd4be1181b0f9.js +0 -2
- package/assets/esri/core/workers/chunks/b557824bc1fa163d72a3.js +0 -2
- package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
- package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
- package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
- package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
- package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
- package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
- package/assets/esri/core/workers/chunks/ed8786fed345718ed684.js +0 -1
- package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
- package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
- package/assets/esri/core/workers/chunks/fc44227c1756f65b95df.js +0 -1
- package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
- package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
- package/layers/mixins/FeatureLayerReload.js +0 -2
- /package/assets/esri/core/workers/chunks/{b557824bc1fa163d72a3.js.LICENSE.txt → 164c8eeefa8232b2b191.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b49df4ebd4be1181b0f9.js.LICENSE.txt → 2981e904ab62f3ed80d0.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{34cbaf844730ac2d92c2.js.LICENSE.txt → 32cc59e126df8c96a0cf.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js.LICENSE.txt → 844eedda8f749972f707.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{3c301a689c7853c9fa67.js.LICENSE.txt → b686cd74975da09b9c91.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{76ab353d80d786777161.js.LICENSE.txt → bd46a04a9ee4ea9e6ef1.js.LICENSE.txt} +0 -0
package/widgets/Print.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{JSONMap as i}from"../core/jsonMap.js";import a from"../core/Logger.js";import{watch as o,on as s,whenOnce as c}from"../core/reactiveUtils.js";import{unitName as l}from"../core/unitFormatUtils.js";import{addProxy as u,hasSameOrigin as d}from"../core/urlUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureInteger as m}from"../core/accessorSupport/ensureType.js";import h from"../geometry/SpatialReference.js";import{isValid as g}from"../geometry/support/spatialReferenceUtils.js";import _ from"../portal/Portal.js";import{reArcGISOnlineDomain as v}from"../portal/support/urlUtils.js";import{findToken as y}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import x from"./Widget.js";import S from"./Print/FileLink.js";import C from"./Print/PrintViewModel.js";import w from"./Print/TemplateOptions.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{Heading as D}from"./support/Heading.js";import{legacyIcon as O}from"./support/legacyIcon.js";import{messageBundle as k,tsx as A,isRTL as j,tsxFragment as M,isActivationKey as N}from"./support/widget.js";const P=`map-only`,F=`esri-print`,I={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function L(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function R(e){return e?.toLowerCase()===P}function z(e){let{state:t,extension:n}=e;switch(t){case`pending`:return`spinner`;case`error`:return`exclamation-mark-circle`;default:return n?.toLowerCase()?.includes(`pdf`)?`file-pdf`:`file`}}const B=new i({inch:`inches`,foot:`feet`,yard:`yards`,mile:`miles`,"nautical-mile":`nautical-miles`,millimeter:`millimeters`,centimeter:`centimeters`,decimeter:`decimeters`,meter:`meters`,kilometer:`kilometers`}),V=new Map([[`a3-landscape`,`a3-landscape`],[`a3-portrait`,`a3-portrait`],[`a4-landscape`,`a4-landscape`],[`a4-portrait`,`a4-portrait`],[`letter-ansi-a-landscape`,`ansi-a-landscape`],[`letter-ansi-a-portrait`,`ansi-a-portrait`],[`tabloid-ansi-b-landscape`,`ansi-b-landscape`],[`tabloid-ansi-b-portrait`,`ansi-b-portrait`]]);let H=class extends x{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab=`layoutTab`,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new C,this._onInput=e=>{this._selectedTab===`layoutTab`?this.templateOptions.title=e.currentTarget.value:this._selectedTab===`mapOnlyTab`&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{let t=e.currentTarget[`data-item`];if(!t||t.state!==`ready`||!t.url)return;let n=y(this.viewModel.effectivePrintServiceUrl),r=t.url,i=document.createElement(`a`);if(i.target=`_blank`,i.href=r,i.rel=`noreferrer`,i.download=t.formattedName??``,!n){i.click(),e.stopPropagation();return}e.preventDefault();let a=new URL(r);a.searchParams.set(`token`,n),i.href=a.href,i.click(),i.href=r},r(a.getLogger(this),`Print`,`arcgis-print`,{version:`4.33`}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{let{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){let t=b.apiValues;this._formats=e.format.choiceList.map(e=>{let n=t.find(t=>RegExp(`\\b${t}\\b`,`i`).test(e))??e;return{value:n,label:e===n?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}let t=this._formats.some(({value:e})=>RegExp(`\\b${e}\\b`,`i`).test(this.templateOptions.format));if(e.format.defaultValue&&!t){let t=this._formats.find(({value:t})=>RegExp(`\\b${t}\\b`,`i`).test(e.format.defaultValue))?.value;t&&(this.templateOptions.format=t)}}),o(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{let{layout:e}=this.templateOptions;this._selectedTab=R(e)?`mapOnlyTab`:`layoutTab`,this._selectedTab===`layoutTab`&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),o(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),o(()=>this.viewModel.view?.scale,e=>{e&&(!this.templateOptions.scaleEnabled||!this.templateOptions.scale)&&(this.templateOptions.scale=e)}),s(()=>this.viewModel,`submit`,e=>this.emit(`submit`,e)),s(()=>this.viewModel,`complete`,e=>this.emit(`complete`,e))]);let{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;let n=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(n),this._awaitingServerResponse=!1},()=>{})}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),link:()=>import(`@esri/calcite-components/dist/components/calcite-link`)})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return`print`}set icon(e){this._overrideIfSome(`icon`,e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{messages:e,templateOptions:t,viewModel:n,view:r}=this,{attributionEnabled:i,author:a,copyright:o,dpi:s,format:c,height:l,layout:u,layoutItem:d,legendEnabled:f,northArrowEnabled:p,scaleBarEnabled:_,scaleEnabled:v,scale:y,width:b}=t,x=n.state!==`ready`||this._awaitingServerResponse||!(u||d),S=this._renderTitleOrFileNameSection(),C=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.fileFormatTitle,A(`calcite-combobox`,{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??`pdf`}},this._formats.map(({value:e,label:t},n)=>A(`calcite-combobox-item`,{heading:t,key:`file-format-${n}`,selected:e===this.templateOptions.format,value:e}))))),w=A(`calcite-label`,{layout:`inline`},A(`calcite-switch`,{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),T=A(`div`,null,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.template,A(`calcite-block`,{class:I.templateSelectContainer,description:this._getPageSizeLabel(this._selectedTemplate),expandable:!1,heading:this._getTemplateLabel(this._selectedTemplate,!0),key:`template-select-block`,label:e.template,loading:this._selectedTemplate?.state===`loading`,tabIndex:0,onclick:()=>this._showTemplates=!0,onkeydown:e=>{(e.key===`Enter`||e.key===` `)&&(this._showTemplates=!0)}},A(`calcite-icon`,{class:I.templateSelectIcon,icon:(this._selectedTemplate?.layout?V.get(this._selectedTemplate.layout):null)||`custom-print`,key:`template-select-icon`,scale:`l`,slot:`content-start`}),this._selectedTemplate?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-select-error`,scale:`s`,slot:`actions-end`}):null,A(`calcite-icon`,{class:I.templateSelectArrow,icon:j()?`chevron-left`:`chevron-right`,key:`template-select-arrow`,scale:`s`,slot:`actions-end`})))),w),k=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.dpi,A(`calcite-input-number`,{bind:this,"data-input-name":`dpi`,min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),M=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,A(`div`,{class:I.srLabel},e.outSpatialReference,A(`calcite-link`,{href:`https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/`,target:`_blank`},`(WKID)`)),A(`calcite-input-number`,{bind:this,"data-input-name":`outSpatialReference`,integer:!0,numberButtonType:`none`,value:n.outSpatialReference?.wkid?.toString()??``,onCalciteInputNumberInput:({currentTarget:e})=>{let t=m(e.value);n.outSpatialReference=Number.isNaN(t)||t==null?null:new h({wkid:t}),this._isValidSpatialReference=!n.outSpatialReference||g(n.outSpatialReference)}}),this._isValidSpatialReference?null:A(`div`,{class:I.invalidWkidText,key:`out-sr-${n.outSpatialReference?.wkid}`},e.invalidWkid))),N=A(`div`,{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:v,"data-option-name":`scaleEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),A(`div`,{class:I.scaleInputContainer},A(`calcite-input-number`,{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:I.scaleInput,"data-input-name":`scale`,disabled:!v,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),A(`calcite-button`,{appearance:`outline`,"aria-label":e.reset,bind:this,disabled:!v,iconStart:`refresh`,kind:`neutral`,onclick:this._resetToCurrentScale}))),P=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer,key:`advanced-section-for-layout`},N,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??!0?A(`div`,{class:I.formSectionContainer,key:`author-info`},A(`calcite-label`,null,e.author,A(`calcite-input`,{bind:this,"data-input-name":`author`,value:a??``,onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??!0?A(`div`,{class:I.formSectionContainer,key:`copyright-text`},A(`calcite-label`,null,e.copyright,A(`calcite-input`,{bind:this,"data-input-name":`copyright`,value:o??``,onCalciteInputInput:this._updateInputValue}))):null,k,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??!0?A(`div`,{class:I.formSectionContainer,key:`legend-info`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!f,"data-option-name":`legendEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?A(`div`,{class:I.formSectionContainer,key:`north-arrow`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!p,"data-option-name":`northArrowEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?A(`div`,{class:I.formSectionContainer,key:`scale-bar`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!_,"data-option-name":`scaleBarEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),F=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},N,k,M,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:i,"data-option-name":`attributionEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),L=this.exportedLinks.toArray(),R=this._renderExportedLinkItems(L),z={[I.exportSectionCentered]:!L.length},B=this._selectedTab===`layoutTab`?A(`section`,{"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,id:`${this.id}__layoutContent`,key:`esri-print__layoutContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??!0?S:null,T,this._selectedTab===`layoutTab`?C:null,A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),disabled:!(u||d?.id),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForLayout`,key:`advanced-options-for-layout`},P))):this._selectedTab===`mapOnlyTab`?A(`section`,{"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:`esri-print__mapOnlyContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},S,C,A(`div`,null,A(`div`,{class:this.classes(I.sizeContainer,I.formSectionContainer)},A(`calcite-label`,null,e.width,A(`calcite-input-number`,{bind:this,"data-input-name":`width`,value:`${b}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`calcite-label`,null,e.height,A(`calcite-input-number`,{bind:this,"data-input-name":`height`,value:`${l}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`button`,{"aria-label":e.swap,bind:this,class:this.classes(E.widgetButton,I.swapButton,O.swap),type:`button`,onclick:this._switchInput})),w),A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForMapOnly`,key:`advanced-options-for-map-only`},F))):A(`section`,{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(I.exportSection,z),id:`${this.id}__exportContent`,key:`esri-print__exportContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},A(`div`,{afterUpdate:this._scrollExportIntoView,bind:this,class:I.exportedFilesContainer},L.length===0?A(`div`,{class:I.exportedFilesEmpty},A(`calcite-icon`,{icon:`file`,scale:`l`}),A(`div`,null,A(D,{class:I.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),A(`div`,null,e.exportHint))):R))),H=r?.type!==`2d`,U=A(`div`,{class:I.panelError},r?H?e.sceneViewError:e.serviceError:e.noViewError),W=L.some(({state:e})=>e===`pending`),G=A(`div`,{class:I.content,key:`panel`},A(`div`,null,A(`ul`,{bind:this,class:I.layoutTabList,role:`tablist`,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown},A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`layoutTab`}`,class:I.layoutTab,"data-tab-id":`layoutTab`,id:`${this.id}__layoutTab`,role:`tab`,tabIndex:0},e.layoutTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`mapOnlyTab`}`,class:I.layoutTab,"data-tab-id":`mapOnlyTab`,id:`${this.id}__mapOnlyTab`,role:`tab`,tabIndex:0},e.mapOnlyTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`exportTab`}`,class:I.layoutTab,"data-tab-id":`exportTab`,id:`${this.id}__exportedFilesTab`,role:`tab`,tabIndex:0},W?A(`calcite-loader`,{inline:!0,label:`loading`,scale:`s`}):null,e.exportsTab)),B),this._selectedTab===`exportTab`?null:A(`div`,{class:this.classes(I.printButtonSection,!this.saveExportHidden&&this.portal?I.printButtonSectionDivider:null),key:`export-button-section`},!this.saveExportHidden&&this.portal?A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,A(`calcite-button`,{"aria-label":e.exportDescription,bind:this,class:this.classes(I.printButton),disabled:x||!(u||d?.id)&&!c,scale:`l`,width:`full`,onclick:this._handlePrintMap},e.export))),K=A(`calcite-flow`,{key:`root-flow`},A(`calcite-flow-item`,{bind:this,key:`root-flow-item`,selected:!this._showTemplates},A(`div`,{class:I.printWidgetContainer},this.headerVisible?A(`header`,{class:I.headerTitle},e.export):null,this.error||H||!r?U:G)),this._renderChooseTemplateFlowItem()),q=n.state===`initializing`,J=q?this._renderLoader():K,Y={[I.panelItemsCentered]:q};return A(`div`,{bind:this,class:this.classes(I.base,E.widget,E.panel,Y)},J)}_getPageSizeLabel(e){if(!e)return;let n=e.layoutTemplateInfo;if(!n)return;let r=B.fromJSON(n.pageUnits.toLowerCase());return`${t(n.pageSize[0])} \u00D7 ${t(n.pageSize[1])} ${l(this.messagesUnits,r,`abbr`)}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;let{label:n,layout:r,layoutItem:i}=e;return(r&&!i&&this.messages[r]?this.messages[r]:null)||((n??r??i?.id)?.replaceAll(`_`,` `)??this.messages.untitled)}_getPortalTemplates(){return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!!t?.id):[]}_getDefaultTemplates(){return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!t?.id):[]}_getPrintServiceTemplates(){return!this.includeDefaultTemplates||!this._getDefaultTemplates().length?this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!R(e)):[]}_renderLayoutTemplates(e,t=!1,n=!1){return t&&e.sort((e,t)=>(e.label??``)>(t.label??``)?1:-1),e.map(e=>A(`calcite-list-item`,{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??``,value:e},A(`calcite-icon`,{icon:(e.layout?V.get(e.layout):null)||`custom-print`,slot:`content-start`}),e.state===`loading`?A(`calcite-loader`,{inline:!0,key:`template-loader-${e.id}`,label:`loading`,scale:`s`,slot:`content-end`}):null,e?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-error-${e.id}`,scale:`s`,slot:`content-end`}):null,n?A(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:`delete`,onclick:()=>this.viewModel.removePortalTemplate(e)}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;let{messages:e}=this,t=v.test(this.portal?.url),n=this.viewModel.browseTemplates.toArray(),r=this._getPortalTemplates(),i=this._getDefaultTemplates(),a=this._getPrintServiceTemplates(),o=n.length+r.length+i.length+a.length>15,s=this.browseTemplateButtonOnClick?A(`calcite-button`,{appearance:`outline`,class:o?I.browseTemplateButtonContainerFilter:I.browseTemplateButtonContainer,iconStart:`folder`,key:`browse-template-button`,slot:o?`filter-actions-end`:`default`,onclick:this.browseTemplateButtonOnClick},o?null:e.browseTemplates):null;return A(`calcite-flow-item`,{bind:this,closable:!1,heading:e.chooseTemplate,key:`template-flow-item`,selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},A(`div`,{class:I.templateSelectFlowItemContainer},A(`div`,{class:I.templateSelectFlowItemContent},o?null:s,A(`calcite-list`,{filterEnabled:o,filterProps:[`label`],key:`template-list`,label:e.templateList,selectionMode:`single-persist`,onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},o?s:null,n.length?A(`div`,{key:`my-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.myTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(n,!0,!0)):null,r.length?A(`div`,{key:`org-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.organizationTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(r)):null,n.length||r.length?i.length?A(`div`,{key:`default-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(i,!0)):null:this._renderLayoutTemplates(i,!0),n.length||r.length?a.length?A(`div`,{key:`service-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(a)):null:this._renderLayoutTemplates(a))),A(`div`,{class:I.templateButtonContainer},A(`calcite-button`,{class:I.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){let{customTextElements:e}=this.templateOptions;return e?A(`div`,{class:I.formSectionContainer,key:`custom-text-elements`},e.map((e,t)=>{let[n,r]=Object.entries(e)[0];return n===`date`?null:A(`calcite-label`,{key:`custom-text-elements-${n}-${t}`},n,A(`calcite-input`,{bind:this,"data-input-custom":!0,"data-input-name":n,value:r??``,onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){let{title:e,fileName:t,titlePlaceHolder:n,fileNamePlaceHolder:r}=this.messages,i=this._selectedTab===`layoutTab`?e:t,a=this._selectedTab===`layoutTab`?n:r,o=this._selectedTab===`layoutTab`?this.templateOptions.title:this.templateOptions.fileName;return A(`div`,{class:I.formSectionContainer,key:i},A(`calcite-label`,null,i,A(`calcite-input`,{placeholder:a,value:o??``,onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;let t=e.getAttribute(`data-tab-id`);(t===`layoutTab`&&this._selectedTab===`layoutTab`||t===`mapOnlyTab`&&this._selectedTab===`mapOnlyTab`||t===`exportTab`&&this._selectedTab===`exportTab`)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){let e={[I.loader]:this._awaitingServerResponse};return A(`div`,{class:this.classes(e),key:`loader`})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,n){let r=e.find(e=>{let[n]=Object.entries(e)[0];return n===t});r[t]=n}_updateInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),r=!!t[`data-input-custom`],{templateOptions:i}=this;r?this._updateCustomTextElementValue(i.customTextElements,n,t.value):i[n]=t.value}_updateNumberInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),{templateOptions:r}=this,i=Number(t.value);L(i)?r[n]=i:t.value=`${r[n]}`}_handlePrintMap(){this._pendingExportScroll=!0;let{templateOptions:e}=this,t=this._selectedTab===`layoutTab`?e.title:e.fileName,{promise:n}=this.viewModel.export(t||this.messages.untitled);this._selectedTab=`exportTab`,n.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;let e=this._rootNode;if(!e)return;let{clientHeight:t,scrollHeight:n}=e,r=n-t;r>0&&(e.scrollTop=r)}_toggleInputValue(e){let t=e.target,n=t.getAttribute(`data-option-name`);this.templateOptions[n]=t.checked,n===`scaleEnabled`&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){let t=this.messages,n=e.formattedName??``,{state:r}=e,i=this.saveAsButtonCallback&&r!==`error`&&this._isFormatAllowedForSaving(e.extension);return r!==`pending`&&i?A(`calcite-popover`,{autoClose:!0,key:`${n}-popover`,label:`Popover`,offsetDistance:1,overlayPositioning:`fixed`,pointerDisabled:!0,referenceElement:`${n}-popover-button`,scale:`s`,topLayerDisabled:this.topLayerDisabled},A(`calcite-list`,{label:``},e.portalItem?A(`calcite-list-item`,{label:t.openItem,onCalciteListItemSelect:()=>{let t=e.portalItem;if(!t||!t.itemPageUrl)return;let n=document.createElement(`a`);n.target=`_blank`,n.href=t.itemPageUrl,n.rel=`noreferrer`,n.click()}},A(`calcite-icon`,{icon:`launch2`,key:`${n}-launch-icon`,scale:`s`,slot:`content-start`})):A(`calcite-list-item`,{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(c(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},A(`calcite-icon`,{icon:`save`,key:`${n}-save-icon`,scale:`s`,slot:`content-start`})),A(`calcite-list-item`,{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},A(`calcite-icon`,{icon:`trash`,key:`${n}-delete-icon`,scale:`s`,slot:`content-start`})))):null}_renderExportedLinkItemContent(e){let t=this.messages,{url:n,state:r,error:i}=e,a=e.formattedName??``,o=n||null;o&&=u(o);let s=d(o,location.href),c=r===`error`?i?.name===`print-task:cim-symbol-unsupported`?t.exportWebMapCIMError:t.exportWebMapError:null;return A(`div`,{class:I.exportedFile,"data-item":e,slot:`content`,onclick:this._handleLinkClick},A(`div`,null,A(`div`,{class:I.exportedFileLinkTitle},a),A(`div`,{class:I.exportedFileLinkDescription},r===`pending`?t.generatingExport:c||(s?t.ready:t.linkReady))),r===`ready`?A(`calcite-icon`,{"aria-label":`${a}. ${t.linkReady}`,icon:s?`download-to`:`launch`,key:`${a}-end-icon`,scale:`s`,slot:`content-end`}):null)}_renderExportedLinkItemIcon(e){let t=e.formattedName??``;return e.state===`pending`?A(`calcite-loader`,{class:I.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:`m`,slot:`content-start`}):A(`calcite-icon`,{icon:z(e),key:`${t}-start-icon`,scale:`s`,slot:`content-start`})}_renderExportedLinkItemAction(e){let{state:t}=e,n=e.formattedName??``,r=this.saveAsButtonCallback&&t!==`error`&&this._isFormatAllowedForSaving(e.extension);return t===`pending`?null:A(`calcite-action`,{icon:r?`ellipsis`:`x`,id:r?`${n}-popover-button`:void 0,key:r?`${n}-saveAs-action`:`${n}-action`,slot:`actions-end`,text:r?this.messagesCommon.options:this.messagesCommon.remove,onclick:r?void 0:()=>{this.exportedLinks.remove(e)}})}_renderExportedLinkItem(e){let t=e.formattedName??``;return A(M,null,A(`calcite-list-item`,{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return A(`calcite-list`,{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:`none`},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||this.allowedFormatsForSaving===`all`||!!(e&&this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){let t=e.target;this._toggleTab(t.getAttribute(`data-tab-id`))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===`mapOnlyTab`)this.viewModel.applyTemplate(P);else if(this._selectedTab===`layoutTab`){let e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){let{key:t}=e,n=e.target.getAttribute(`data-tab-id`);if(N(t))this._toggleTab(n),e.preventDefault(),e.stopPropagation();else if(t===`ArrowLeft`||t===`ArrowRight`){switch(n){case`layoutTab`:this._toggleTab(t===`ArrowLeft`?`exportTab`:`mapOnlyTab`);break;case`mapOnlyTab`:this._toggleTab(t===`ArrowLeft`?`layoutTab`:`exportTab`);break;case`exportTab`:this._toggleTab(t===`ArrowLeft`?`mapOnlyTab`:`layoutTab`)}e.preventDefault(),e.stopPropagation()}}};e([f()],H.prototype,`_showTemplates`,void 0),e([f()],H.prototype,`_isValidSpatialReference`,void 0),e([f()],H.prototype,`allowedFormats`,null),e([f()],H.prototype,`allowedFormatsForSaving`,void 0),e([f()],H.prototype,`allowedLayouts`,null),e([f()],H.prototype,`browseTemplateButtonOnClick`,void 0),e([f()],H.prototype,`error`,null),e([f({type:n.ofType(S)})],H.prototype,`exportedLinks`,null),e([f()],H.prototype,`extraParameters`,null),e([f()],H.prototype,`headerVisible`,void 0),e([f()],H.prototype,`headingLevel`,void 0),e([f()],H.prototype,`icon`,null),e([f()],H.prototype,`includeDefaultTemplates`,null),e([f()],H.prototype,`includeOrganizationTemplates`,void 0),e([f()],H.prototype,`label`,null),e([f(),k(`esri/widgets/Print/t9n/Print`)],H.prototype,`messages`,void 0),e([f(),k(`esri/t9n/common`)],H.prototype,`messagesCommon`,void 0),e([f(),k(`esri/core/t9n/Units`)],H.prototype,`messagesUnits`,void 0),e([f({type:h})],H.prototype,`outSpatialReference`,null),e([f({type:_})],H.prototype,`portal`,null),e([f()],H.prototype,`saveExportEnabled`,null),e([f()],H.prototype,`saveExportHidden`,void 0),e([f()],H.prototype,`showPrintAreaEnabled`,null),e([f()],H.prototype,`printServiceUrl`,null),e([f()],H.prototype,`saveAsButtonCallback`,void 0),e([f()],H.prototype,`templateCustomTextElements`,null),e([f({type:w})],H.prototype,`templateOptions`,null),e([f()],H.prototype,`view`,null),e([f({type:C})],H.prototype,`viewModel`,void 0),H=e([p(`esri.widgets.Print`)],H);const U=H;export{U as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{JSONMap as i}from"../core/jsonMap.js";import a from"../core/Logger.js";import{watch as o,on as s,whenOnce as c}from"../core/reactiveUtils.js";import{unitName as l}from"../core/unitFormatUtils.js";import{addProxy as u,hasSameOrigin as d}from"../core/urlUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureInteger as m}from"../core/accessorSupport/ensureType.js";import h from"../geometry/SpatialReference.js";import{isValid as g}from"../geometry/support/spatialReferenceUtils.js";import _ from"../portal/Portal.js";import{reArcGISOnlineDomain as v}from"../portal/support/urlUtils.js";import{findToken as y}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import x from"./Widget.js";import S from"./Print/FileLink.js";import C from"./Print/PrintViewModel.js";import w from"./Print/TemplateOptions.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{Heading as D}from"./support/Heading.js";import{legacyIcon as O}from"./support/legacyIcon.js";import{messageBundle as k,tsx as A,isRTL as j,tsxFragment as M,isActivationKey as N}from"./support/widget.js";const P=`map-only`,F=`esri-print`,I={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function L(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function R(e){return e?.toLowerCase()===P}function z(e){let{state:t,extension:n}=e;switch(t){case`pending`:return`spinner`;case`error`:return`exclamation-mark-circle`;default:return n?.toLowerCase()?.includes(`pdf`)?`file-pdf`:`file`}}const B=new i({inch:`inches`,foot:`feet`,yard:`yards`,mile:`miles`,"nautical-mile":`nautical-miles`,millimeter:`millimeters`,centimeter:`centimeters`,decimeter:`decimeters`,meter:`meters`,kilometer:`kilometers`}),V=new Map([[`a3-landscape`,`a3-landscape`],[`a3-portrait`,`a3-portrait`],[`a4-landscape`,`a4-landscape`],[`a4-portrait`,`a4-portrait`],[`letter-ansi-a-landscape`,`ansi-a-landscape`],[`letter-ansi-a-portrait`,`ansi-a-portrait`],[`tabloid-ansi-b-landscape`,`ansi-b-landscape`],[`tabloid-ansi-b-portrait`,`ansi-b-portrait`]]);let H=class extends x{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab=`layoutTab`,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new C,this._onInput=e=>{this._selectedTab===`layoutTab`?this.templateOptions.title=e.currentTarget.value:this._selectedTab===`mapOnlyTab`&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{let t=e.currentTarget[`data-item`];if(!t||t.state!==`ready`||!t.url)return;let n=y(this.viewModel.effectivePrintServiceUrl),r=t.url,i=document.createElement(`a`);if(i.target=`_blank`,i.href=r,i.rel=`noreferrer`,i.download=t.formattedName??``,!n){i.click(),e.stopPropagation();return}e.preventDefault();let a=new URL(r);a.searchParams.set(`token`,n),i.href=a.href,i.click(),i.href=r},r(a.getLogger(this),`Print`,`arcgis-print`,{version:`4.33`}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{let{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){let t=b.apiValues;this._formats=e.format.choiceList.map(e=>{let n=t.find(t=>RegExp(`\\b${t}\\b`,`i`).test(e))??e;return{value:n,label:e===n?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}let t=this._formats.some(({value:e})=>RegExp(`\\b${e}\\b`,`i`).test(this.templateOptions.format));if(e.format.defaultValue&&!t){let t=this._formats.find(({value:t})=>RegExp(`\\b${t}\\b`,`i`).test(e.format.defaultValue))?.value;t&&(this.templateOptions.format=t)}}),o(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{let{layout:e}=this.templateOptions;this._selectedTab=R(e)?`mapOnlyTab`:`layoutTab`,this._selectedTab===`layoutTab`&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),o(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),o(()=>this.viewModel.view?.scale,e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}),s(()=>this.viewModel,`submit`,e=>this.emit(`submit`,e)),s(()=>this.viewModel,`complete`,e=>this.emit(`complete`,e))]);let{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;let n=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(n),this._awaitingServerResponse=!1},()=>{})}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),link:()=>import(`@esri/calcite-components/dist/components/calcite-link`)})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return`print`}set icon(e){this._overrideIfSome(`icon`,e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{messages:e,templateOptions:t,viewModel:n,view:r}=this,{attributionEnabled:i,author:a,copyright:o,dpi:s,format:c,height:l,layout:u,layoutItem:d,legendEnabled:f,northArrowEnabled:p,scaleBarEnabled:_,scaleEnabled:v,scale:y,width:b}=t,x=n.state!==`ready`||this._awaitingServerResponse||!(u||d),S=this._renderTitleOrFileNameSection(),C=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.fileFormatTitle,A(`calcite-combobox`,{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??`pdf`}},this._formats.map(({value:e,label:t},n)=>A(`calcite-combobox-item`,{heading:t,key:`file-format-${n}`,selected:e===this.templateOptions.format,value:e}))))),w=A(`calcite-label`,{layout:`inline`},A(`calcite-switch`,{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),T=A(`div`,null,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.template,A(`calcite-block`,{class:I.templateSelectContainer,description:this._getPageSizeLabel(this._selectedTemplate),expandable:!1,heading:this._getTemplateLabel(this._selectedTemplate,!0),key:`template-select-block`,label:e.template,loading:this._selectedTemplate?.state===`loading`,tabIndex:0,onclick:()=>this._showTemplates=!0,onkeydown:e=>{(e.key===`Enter`||e.key===` `)&&(this._showTemplates=!0)}},A(`calcite-icon`,{class:I.templateSelectIcon,icon:(this._selectedTemplate?.layout?V.get(this._selectedTemplate.layout):null)||`custom-print`,key:`template-select-icon`,scale:`l`,slot:`content-start`}),this._selectedTemplate?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-select-error`,scale:`s`,slot:`actions-end`}):null,A(`calcite-icon`,{class:I.templateSelectArrow,icon:j()?`chevron-left`:`chevron-right`,key:`template-select-arrow`,scale:`s`,slot:`actions-end`})))),w),k=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.dpi,A(`calcite-input-number`,{bind:this,"data-input-name":`dpi`,min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),M=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,A(`div`,{class:I.srLabel},e.outSpatialReference,A(`calcite-link`,{href:`https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/`,target:`_blank`},`(WKID)`)),A(`calcite-input-number`,{bind:this,"data-input-name":`outSpatialReference`,integer:!0,numberButtonType:`none`,value:n.outSpatialReference?.wkid?.toString()??``,onCalciteInputNumberInput:({currentTarget:e})=>{let t=m(e.value);n.outSpatialReference=Number.isNaN(t)||t==null?null:new h({wkid:t}),this._isValidSpatialReference=!n.outSpatialReference||g(n.outSpatialReference)}}),this._isValidSpatialReference?null:A(`div`,{class:I.invalidWkidText,key:`out-sr-${n.outSpatialReference?.wkid}`},e.invalidWkid))),N=A(`div`,{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:v,"data-option-name":`scaleEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),A(`div`,{class:I.scaleInputContainer},A(`calcite-input-number`,{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:I.scaleInput,"data-input-name":`scale`,disabled:!v,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),A(`calcite-button`,{appearance:`outline`,"aria-label":e.reset,bind:this,disabled:!v,iconStart:`refresh`,kind:`neutral`,onclick:this._resetToCurrentScale}))),P=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer,key:`advanced-section-for-layout`},N,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??!0?A(`div`,{class:I.formSectionContainer,key:`author-info`},A(`calcite-label`,null,e.author,A(`calcite-input`,{bind:this,"data-input-name":`author`,value:a??``,onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??!0?A(`div`,{class:I.formSectionContainer,key:`copyright-text`},A(`calcite-label`,null,e.copyright,A(`calcite-input`,{bind:this,"data-input-name":`copyright`,value:o??``,onCalciteInputInput:this._updateInputValue}))):null,k,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??!0?A(`div`,{class:I.formSectionContainer,key:`legend-info`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!f,"data-option-name":`legendEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?A(`div`,{class:I.formSectionContainer,key:`north-arrow`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!p,"data-option-name":`northArrowEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?A(`div`,{class:I.formSectionContainer,key:`scale-bar`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!_,"data-option-name":`scaleBarEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),F=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},N,k,M,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:i,"data-option-name":`attributionEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),L=this.exportedLinks.toArray(),R=this._renderExportedLinkItems(L),z={[I.exportSectionCentered]:!L.length},B=this._selectedTab===`layoutTab`?A(`section`,{"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,id:`${this.id}__layoutContent`,key:`esri-print__layoutContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??!0?S:null,T,this._selectedTab===`layoutTab`?C:null,A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),disabled:!(u||d?.id),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForLayout`,key:`advanced-options-for-layout`},P))):this._selectedTab===`mapOnlyTab`?A(`section`,{"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:`esri-print__mapOnlyContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},S,C,A(`div`,null,A(`div`,{class:this.classes(I.sizeContainer,I.formSectionContainer)},A(`calcite-label`,null,e.width,A(`calcite-input-number`,{bind:this,"data-input-name":`width`,value:`${b}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`calcite-label`,null,e.height,A(`calcite-input-number`,{bind:this,"data-input-name":`height`,value:`${l}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`button`,{"aria-label":e.swap,bind:this,class:this.classes(E.widgetButton,I.swapButton,O.swap),type:`button`,onclick:this._switchInput})),w),A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForMapOnly`,key:`advanced-options-for-map-only`},F))):A(`section`,{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(I.exportSection,z),id:`${this.id}__exportContent`,key:`esri-print__exportContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},A(`div`,{afterUpdate:this._scrollExportIntoView,bind:this,class:I.exportedFilesContainer},L.length===0?A(`div`,{class:I.exportedFilesEmpty},A(`calcite-icon`,{icon:`file`,scale:`l`}),A(`div`,null,A(D,{class:I.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),A(`div`,null,e.exportHint))):R))),H=r?.type!==`2d`,U=A(`div`,{class:I.panelError},r?H?e.sceneViewError:e.serviceError:e.noViewError),W=L.some(({state:e})=>e===`pending`),G=A(`div`,{class:I.content,key:`panel`},A(`div`,null,A(`ul`,{bind:this,class:I.layoutTabList,role:`tablist`,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown},A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`layoutTab`}`,class:I.layoutTab,"data-tab-id":`layoutTab`,id:`${this.id}__layoutTab`,role:`tab`,tabIndex:0},e.layoutTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`mapOnlyTab`}`,class:I.layoutTab,"data-tab-id":`mapOnlyTab`,id:`${this.id}__mapOnlyTab`,role:`tab`,tabIndex:0},e.mapOnlyTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`exportTab`}`,class:I.layoutTab,"data-tab-id":`exportTab`,id:`${this.id}__exportedFilesTab`,role:`tab`,tabIndex:0},W?A(`calcite-loader`,{inline:!0,label:`loading`,scale:`s`}):null,e.exportsTab)),B),this._selectedTab===`exportTab`?null:A(`div`,{class:this.classes(I.printButtonSection,!this.saveExportHidden&&this.portal?I.printButtonSectionDivider:null),key:`export-button-section`},!this.saveExportHidden&&this.portal?A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,A(`calcite-button`,{"aria-label":e.exportDescription,bind:this,class:this.classes(I.printButton),disabled:x||!(u||d?.id)&&!c,scale:`l`,width:`full`,onclick:this._handlePrintMap},e.export))),K=A(`calcite-flow`,{key:`root-flow`},A(`calcite-flow-item`,{bind:this,key:`root-flow-item`,selected:!this._showTemplates},A(`div`,{class:I.printWidgetContainer},this.headerVisible?A(`header`,{class:I.headerTitle},e.export):null,this.error||H||!r?U:G)),this._renderChooseTemplateFlowItem()),q=n.state===`initializing`,J=q?this._renderLoader():K,Y={[I.panelItemsCentered]:q};return A(`div`,{bind:this,class:this.classes(I.base,E.widget,E.panel,Y)},J)}_getPageSizeLabel(e){if(!e)return;let n=e.layoutTemplateInfo;if(!n)return;let r=B.fromJSON(n.pageUnits.toLowerCase());return`${t(n.pageSize[0])} \u00D7 ${t(n.pageSize[1])} ${l(this.messagesUnits,r,`abbr`)}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;let{label:n,layout:r,layoutItem:i}=e;return(r&&!i&&this.messages[r]?this.messages[r]:null)||((n??r??i?.id)?.replaceAll(`_`,` `)??this.messages.untitled)}_getPortalTemplates(){return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!!t?.id):[]}_getDefaultTemplates(){return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!t?.id):[]}_getPrintServiceTemplates(){return!this.includeDefaultTemplates||!this._getDefaultTemplates().length?this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!R(e)):[]}_renderLayoutTemplates(e,t=!1,n=!1){return t&&e.sort((e,t)=>(e.label??``)>(t.label??``)?1:-1),e.map(e=>A(`calcite-list-item`,{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??``,value:e},A(`calcite-icon`,{icon:(e.layout?V.get(e.layout):null)||`custom-print`,slot:`content-start`}),e.state===`loading`?A(`calcite-loader`,{inline:!0,key:`template-loader-${e.id}`,label:`loading`,scale:`s`,slot:`content-end`}):null,e?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-error-${e.id}`,scale:`s`,slot:`content-end`}):null,n?A(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:`delete`,onclick:()=>this.viewModel.removePortalTemplate(e)}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;let{messages:e}=this,t=v.test(this.portal?.url),n=this.viewModel.browseTemplates.toArray(),r=this._getPortalTemplates(),i=this._getDefaultTemplates(),a=this._getPrintServiceTemplates(),o=n.length+r.length+i.length+a.length>15,s=this.browseTemplateButtonOnClick?A(`calcite-button`,{appearance:`outline`,class:o?I.browseTemplateButtonContainerFilter:I.browseTemplateButtonContainer,iconStart:`folder`,key:`browse-template-button`,slot:o?`filter-actions-end`:`default`,onclick:this.browseTemplateButtonOnClick},o?null:e.browseTemplates):null;return A(`calcite-flow-item`,{bind:this,closable:!1,heading:e.chooseTemplate,key:`template-flow-item`,selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},A(`div`,{class:I.templateSelectFlowItemContainer},A(`div`,{class:I.templateSelectFlowItemContent},o?null:s,A(`calcite-list`,{filterEnabled:o,filterProps:[`label`],key:`template-list`,label:e.templateList,selectionMode:`single-persist`,onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},o?s:null,n.length?A(`div`,{key:`my-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.myTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(n,!0,!0)):null,r.length?A(`div`,{key:`org-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.organizationTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(r)):null,n.length||r.length?i.length?A(`div`,{key:`default-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(i,!0)):null:this._renderLayoutTemplates(i,!0),n.length||r.length?a.length?A(`div`,{key:`service-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(a)):null:this._renderLayoutTemplates(a))),A(`div`,{class:I.templateButtonContainer},A(`calcite-button`,{class:I.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){let{customTextElements:e}=this.templateOptions;return e?A(`div`,{class:I.formSectionContainer,key:`custom-text-elements`},e.map((e,t)=>{let[n,r]=Object.entries(e)[0];return n===`date`?null:A(`calcite-label`,{key:`custom-text-elements-${n}-${t}`},n,A(`calcite-input`,{bind:this,"data-input-custom":!0,"data-input-name":n,value:r??``,onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){let{title:e,fileName:t,titlePlaceHolder:n,fileNamePlaceHolder:r}=this.messages,i=this._selectedTab===`layoutTab`?e:t,a=this._selectedTab===`layoutTab`?n:r,o=this._selectedTab===`layoutTab`?this.templateOptions.title:this.templateOptions.fileName;return A(`div`,{class:I.formSectionContainer,key:i},A(`calcite-label`,null,i,A(`calcite-input`,{placeholder:a,value:o??``,onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;let t=e.getAttribute(`data-tab-id`);(t===`layoutTab`&&this._selectedTab===`layoutTab`||t===`mapOnlyTab`&&this._selectedTab===`mapOnlyTab`||t===`exportTab`&&this._selectedTab===`exportTab`)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){let e={[I.loader]:this._awaitingServerResponse};return A(`div`,{class:this.classes(e),key:`loader`})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,n){let r=e.find(e=>{let[n]=Object.entries(e)[0];return n===t});r[t]=n}_updateInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),r=!!t[`data-input-custom`],{templateOptions:i}=this;r?this._updateCustomTextElementValue(i.customTextElements,n,t.value):i[n]=t.value}_updateNumberInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),{templateOptions:r}=this,i=Number(t.value);L(i)?r[n]=i:t.value=`${r[n]}`}_handlePrintMap(){this._pendingExportScroll=!0;let{templateOptions:e}=this,t=this._selectedTab===`layoutTab`?e.title:e.fileName,{promise:n}=this.viewModel.export(t||this.messages.untitled);this._selectedTab=`exportTab`,n.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;let e=this._rootNode;if(!e)return;let{clientHeight:t,scrollHeight:n}=e,r=n-t;r>0&&(e.scrollTop=r)}_toggleInputValue(e){let t=e.target,n=t.getAttribute(`data-option-name`);this.templateOptions[n]=t.checked,n===`scaleEnabled`&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){let t=this.messages,n=e.formattedName??``,{state:r}=e,i=this.saveAsButtonCallback&&r!==`error`&&this._isFormatAllowedForSaving(e.extension);return r!==`pending`&&i?A(`calcite-popover`,{autoClose:!0,key:`${n}-popover`,label:`Popover`,offsetDistance:1,overlayPositioning:`fixed`,pointerDisabled:!0,referenceElement:`${n}-popover-button`,scale:`s`,topLayerDisabled:this.topLayerDisabled},A(`calcite-list`,{label:``},e.portalItem?A(`calcite-list-item`,{label:t.openItem,onCalciteListItemSelect:()=>{let t=e.portalItem;if(!t||!t.itemPageUrl)return;let n=document.createElement(`a`);n.target=`_blank`,n.href=t.itemPageUrl,n.rel=`noreferrer`,n.click()}},A(`calcite-icon`,{icon:`launch2`,key:`${n}-launch-icon`,scale:`s`,slot:`content-start`})):A(`calcite-list-item`,{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(c(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},A(`calcite-icon`,{icon:`save`,key:`${n}-save-icon`,scale:`s`,slot:`content-start`})),A(`calcite-list-item`,{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},A(`calcite-icon`,{icon:`trash`,key:`${n}-delete-icon`,scale:`s`,slot:`content-start`})))):null}_renderExportedLinkItemContent(e){let t=this.messages,{url:n,state:r,error:i}=e,a=e.formattedName??``,o=n||null;o&&=u(o);let s=d(o,location.href),c=r===`error`?i?.name===`print-task:cim-symbol-unsupported`?t.exportWebMapCIMError:t.exportWebMapError:null;return A(`div`,{class:I.exportedFile,"data-item":e,slot:`content`,onclick:this._handleLinkClick},A(`div`,null,A(`div`,{class:I.exportedFileLinkTitle},a),A(`div`,{class:I.exportedFileLinkDescription},r===`pending`?t.generatingExport:c||(s?t.ready:t.linkReady))),r===`ready`?A(`calcite-icon`,{"aria-label":`${a}. ${t.linkReady}`,icon:s?`download-to`:`launch`,key:`${a}-end-icon`,scale:`s`,slot:`content-end`}):null)}_renderExportedLinkItemIcon(e){let t=e.formattedName??``;return e.state===`pending`?A(`calcite-loader`,{class:I.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:`m`,slot:`content-start`}):A(`calcite-icon`,{icon:z(e),key:`${t}-start-icon`,scale:`s`,slot:`content-start`})}_renderExportedLinkItemAction(e){let{state:t}=e,n=e.formattedName??``,r=this.saveAsButtonCallback&&t!==`error`&&this._isFormatAllowedForSaving(e.extension);return t===`pending`?null:A(`calcite-action`,{icon:r?`ellipsis`:`x`,id:r?`${n}-popover-button`:void 0,key:r?`${n}-saveAs-action`:`${n}-action`,slot:`actions-end`,text:r?this.messagesCommon.options:this.messagesCommon.remove,onclick:r?void 0:()=>{this.exportedLinks.remove(e)}})}_renderExportedLinkItem(e){let t=e.formattedName??``;return A(M,null,A(`calcite-list-item`,{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return A(`calcite-list`,{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:`none`},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||this.allowedFormatsForSaving===`all`||!!(e&&this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){let t=e.target;this._toggleTab(t.getAttribute(`data-tab-id`))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===`mapOnlyTab`)this.viewModel.applyTemplate(P);else if(this._selectedTab===`layoutTab`){let e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){let{key:t}=e,n=e.target.getAttribute(`data-tab-id`);if(N(t))this._toggleTab(n),e.preventDefault(),e.stopPropagation();else if(t===`ArrowLeft`||t===`ArrowRight`){switch(n){case`layoutTab`:this._toggleTab(t===`ArrowLeft`?`exportTab`:`mapOnlyTab`);break;case`mapOnlyTab`:this._toggleTab(t===`ArrowLeft`?`layoutTab`:`exportTab`);break;case`exportTab`:this._toggleTab(t===`ArrowLeft`?`mapOnlyTab`:`layoutTab`)}e.preventDefault(),e.stopPropagation()}}};e([f()],H.prototype,`_showTemplates`,void 0),e([f()],H.prototype,`_isValidSpatialReference`,void 0),e([f()],H.prototype,`allowedFormats`,null),e([f()],H.prototype,`allowedFormatsForSaving`,void 0),e([f()],H.prototype,`allowedLayouts`,null),e([f()],H.prototype,`browseTemplateButtonOnClick`,void 0),e([f()],H.prototype,`error`,null),e([f({type:n.ofType(S)})],H.prototype,`exportedLinks`,null),e([f()],H.prototype,`extraParameters`,null),e([f()],H.prototype,`headerVisible`,void 0),e([f()],H.prototype,`headingLevel`,void 0),e([f()],H.prototype,`icon`,null),e([f()],H.prototype,`includeDefaultTemplates`,null),e([f()],H.prototype,`includeOrganizationTemplates`,void 0),e([f()],H.prototype,`label`,null),e([f(),k(`esri/widgets/Print/t9n/Print`)],H.prototype,`messages`,void 0),e([f(),k(`esri/t9n/common`)],H.prototype,`messagesCommon`,void 0),e([f(),k(`esri/core/t9n/Units`)],H.prototype,`messagesUnits`,void 0),e([f({type:h})],H.prototype,`outSpatialReference`,null),e([f({type:_})],H.prototype,`portal`,null),e([f()],H.prototype,`saveExportEnabled`,null),e([f()],H.prototype,`saveExportHidden`,void 0),e([f()],H.prototype,`showPrintAreaEnabled`,null),e([f()],H.prototype,`printServiceUrl`,null),e([f()],H.prototype,`saveAsButtonCallback`,void 0),e([f()],H.prototype,`templateCustomTextElements`,null),e([f({type:w})],H.prototype,`templateOptions`,null),e([f()],H.prototype,`view`,null),e([f({type:C})],H.prototype,`viewModel`,void 0),H=e([p(`esri.widgets.Print`)],H);const U=H;export{U 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"../../Graphic.js";import{isSome as n}from"../../core/arrayUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import{handlesGroup as o,makeHandle as s,drainHandles as c,destroyHandle as l}from"../../core/handleUtils.js";import has from"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as d,abortMaybe as f,removeMaybe as p}from"../../core/maybe.js";import{createAbortError as m,ignoreAbortErrors as h,whenOrAbort as g}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as v,on as ee,when as te,sync as ne,whenOnce as y}from"../../core/reactiveUtils.js";import{property as b,subclass as re}from"../../core/accessorSupport/decorators.js";import{trackAccess as x}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as ie}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{UpdatingHandles as S}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as ae}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as oe,isLoaded as se,load as ce,project as le}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as ue}from"../../geometry/support/spatialReferenceUtils.js";import de from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as fe}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as pe}from"../../support/elevationInfoUtils.js";import me from"../../symbols/FillSymbol3DLayer.js";import he from"../../symbols/MeshSymbol3D.js";import ge from"../../symbols/SimpleFillSymbol.js";import _e from"../../symbols/SimpleLineSymbol.js";import w from"../../symbols/SimpleMarkerSymbol.js";import T from"../../symbols/TextSymbol.js";import{symbolTypes as E}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as ve}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as ye}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as be}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 xe}from"../../views/interactive/options/bindViewToolOptions.js";import j from"../../views/interactive/options/InteractiveToolOptions.js";import M from"../../views/interactive/sketch/SketchLabelOptions.js";import N from"../../views/interactive/sketch/SketchOptions.js";import Se from"../../views/interactive/sketch/SketchTooltipOptions.js";import Ce from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as P}from"../../views/interactive/snapping/SnappingManager.js";import{acquire as we}from"../../views/interactive/snapping/SnappingManagerPool.js";import F from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as I}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as Te}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as Ee}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as De}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as L}from"../../views/support/screenUtils.js";import Oe from"./adapters/layer/GraphicsLayerAdapter.js";import ke from"./adapters/layer/MapNotesLayerAdapter.js";import Ae from"./adapters/layer/SketchLayerAdapter.js";import{CreateOperationHandle as je,DrawToolOperationHandle as Me,UpdateOperationHandle as R}from"./support/OperationHandle.js";import{PluginManager as Ne}from"./support/PluginManager.js";import{SettingsManager as Pe}from"./support/SettingsManager.js";import{getLegacyTool as z,isCompletelyDegenerate as Fe,graphicsHaveTooFewVerticesForBox as B,getModeFromCreateOptions as Ie,getDrawToolGeometryTypeFromCreateTool as Le}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:Ee},tool:`transform`},U=Symbol(),W=Symbol();let G=class extends a{constructor(e){super(e),this._defaultSnappingManager=null,this._operationContext=null,this._internalGraphicsLayer=new de({listMode:`hide`,internal:!0,title:`SVM Internal`}),this._pluginManager=new Ne({sketchViewModel:this}),this.settingsManager=new Pe({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new S,this._toolTransitionHandles=new S,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new Te,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 ge({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new _e({color:[130,130,130,1],width:2}),this.meshSymbol=new he({symbolLayers:new r([new me])}),this.updateGraphics=new r,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 N,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)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},v)].filter(n);this.addHandles(t,W)},this._originalPopupEnabled=null,this.defaultCreateOptions=V,this.defaultUpdateOptions=H,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new F,this.textSymbol=new T({text:`text`})}initialize(){this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([ee(()=>this.view?.map?.layers,`change`,e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),v),_(()=>this.view,e=>{this._defaultSnappingManager=d(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new P({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`)))},v),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),I(this,void 0,()=>this._operationSnappingManager?.options??this.snappingOptions)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=d(this._defaultSnappingManager),this._destroyOperationContext(),this._set(`snappingManager`,null),this._set(`view`,null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=f(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 Oe(e);case`map-notes`:return new ke(e);case`sketch`:return new Ae(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(n).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=d(this._defaultSnappingManager)),this._override(`snappingManager`,e);else{let{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new P({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.snappingManager?.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){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(te(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},v),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(n)??[]}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(n)??[]}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=f(this._moduleLoaderAbortController),this._viewReadyAbortController=f(this._viewReadyAbortController),this._drawToolSimplifyAbortController=f(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(),m();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(),d(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(h(this.create(e,t)))}else i===`update`&&n&&this._updatingHandles.consumePromise(h(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(),m();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`&&!ue(n.geometry.spatialReference,t.spatialReference)&&(!oe(n.geometry.spatialReference,t.spatialReference)&&!se()&&await ce(),n.geometry=le(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?we(e):null,r=t?new j:this.sketchOptions,i;if(t){let{values:t}=r;i=o([xe(r,()=>e.options,()=>this.sketchOptions),_(()=>t.directionMode,e=>{this.sketchOptions.values.directionMode=e},ne)])}return this._operationContext={snappingManager:n?.snappingManager??this.snappingManager,toolOptions:r,...o([n,i])}}_destroyOperationContext(e=this._operationContext){e===this._operationContext?this._operationContext=p(this._operationContext):p(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 De(r.results)}let n=[t.map.ground];t.map.allLayers.forEach(e=>{fe(e)&&(!has(`enable-feature:im-as-ground`)||e.isUsedAsGroundLayer)&&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`?ae(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(L(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.mode):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=Ie(c,e),d=Le(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:ze(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 r=null,i=e.forceUniformSize,a=e.centered,o=new ie,l=[s(()=>o.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(),u.undo()):t.key===A.redo?(t.stopPropagation(),u.redo()):t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)&&!t.repeat?(e.forceUniformSize=!i,t.stopPropagation()):t.key===A.center&&(t.repeat||(e.centered=!a,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=i,t.stopPropagation()):t.key===A.center&&(e.centered=a,t.stopPropagation())},k.WIDGET),e.on(`vertex-update`,()=>{o.notify()}),e.on(`vertex-add`,t=>{switch(o.notify(),r=r==null?`start`:`active`,t.operation){case`apply`:this.emit(`create`,{graphic:e.graphic,state:r,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(o.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),r=`complete`,e.aborted?u&&u.cancel():u&&u.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],u=new je({activeComponent:e,type:`create`,onEnd:()=>{c(l),n.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(x(o),e.canUndo),canRedo:()=>(x(o),e.canRedo)});return u}_setupDrawToolOperationHandle(e,t){let r=this.view;if(!r)return this._logMissingView(),null;let i=null,a=[r.on(`key-down`,t=>{t.key===A.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},k.WIDGET),r.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||Fe(n))&&t.preventDefault()}),e.on([`vertex-add`,`vertex-remove`],r=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.getGeometryIfCompleted()),i=i==null&&r.type!==`vertex-remove`?`start`:`active`,r.operation){case`apply`:this.emit(`create`,{graphic:this.createGraphic,state:i,tool:this.activeTool,toolEventInfo:r,type:`create`});break;case`undo`:this._emitUndoEvent({graphics:[this.createGraphic].filter(n),tool:t});break;case`redo`:this._emitRedoEvent({graphics:[this.createGraphic].filter(n),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(h(this._finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:r,handle:o})))}})],o=new Me({activeComponent:e,type:`create`,onEnd:()=>{c(a),r.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return a.push(e.on(`cancel`,()=>{this._drawToolSimplifyAbortController=f(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,l=new Map,u=()=>{l.forEach(e=>e.destroy()),l.clear()};for(let t of e){let e=new o({view:n,graphic:t}),r=ve(e);if(r!==0)return u(),this._logError(`sketch:move`,`Move operation not supported for provided graphic(s) (${D(r)}).`),null;l.set(t,e)}let d=new s({view:n,enableZ:t.enableZ,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(d),d.objects.addMany(Array.from(l.values())),i||this.updateGraphics.addMany(e);let f=[],p=new R({activeComponent:d,tool:r,type:`update`,onEnd:()=>{c(f),Q(n,d),u()},undo:()=>{X(this.view,d),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});l.set(e,t),d.objects.push(t),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:`selection-change`},type:`update`})},removeFromSelection: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=l.get(e);n&&(d.objects.remove(n),n.destroy(),l.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&&be(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:l,ManipulatedObject3DGraphic:u}=s.module,d=new u({graphic:e,view:n}),f=new l({object:d,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:()=>{c(p),Q(n,f),d.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:l}=t,u=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(u))return u;let{ManipulatedObject3DGraphic:d,ExtentTransformTool:f}=u.module,p=this.view?.inputManager?.isModifierKeyDown(A.constraint),m=new d({view:n,graphic:e}),h=new f({object:m,view:n,enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:!!l!=!!p,toolOptions:this._operationToolOptions});n.tools.add(h),r||this.updateGraphics.add(e);let g=[],_=new R({activeComponent:h,tool:i,type:`update`,onEnd:()=>{c(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(),c(l),c(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)],l=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,l=new o({view:n,graphic:e}),u=ye(l);if(u!==0)return l.destroy(),this._logError(`sketch:reshape`,`Reshape operation not supported for provided graphic(s) (${D(u)}).`),null;let d=t.reshapeOptions,f=new s({view:n,object:l,enableZVertex:t.enableZ&&d?.vertexOperation===`move`,enableZShape:t.enableZ&&d?.shapeOperation===`move`,enableMoveObject:d?.shapeOperation===`move`||d?.shapeOperation===`move-xy`,enableMidpoints:d?.edgeOperation===`split`,enableEdgeOffset:d?.edgeOperation===`offset`,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),r||this.updateGraphics.add(l.graphic);let p=[],m=new R({activeComponent:f,tool:i,type:`update`,onEnd:()=>{c(p),Q(n,f),l.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:()=>{c(s),c(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&&(c(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(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,n])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=n??t.enableScaling??!0,l.refresh()},v)),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=L(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),d(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){u.getLogger(this).error(new i(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,n,r){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;let i=this.view,a=await import(`../../views/draw/DrawTool.js`);await this.pluginManager.loadPlugins();let o=await this.pluginManager.makeRenderer({customSymbol:n.graphicSymbol,useTextSymbol:r===`text`}),s=new a.DrawTool({view:i,elevationInfo:this._layerAdapter?.elevationInfo??pe(i.type===`3d`),hasZ:!!n.hasZ,toolOptions:this._operationToolOptions,renderer:o,defaultZ:n.defaultZ??0,directionOptions:n.directionOptions,snappingManager:this._operationSnappingManager,enableVertexVisuals:r!==`rectangle`&&r!==`circle`,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});s.addHandles(l(o));let c=new t({...n.graphicProperties,attributes:{...n.graphicProperties?.attributes},symbol:n.graphicSymbol??this._getGraphicSymbolFromTool(r)});return n.graphicSymbol||s.addHandles(_(()=>this._getGraphicSymbolFromTool(r),e=>c.symbol=e)),this._set(`createGraphic`,c),i.addAndActivateTool(s),s.begin(e),s}get test(){}wait(){return y(()=>!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?(f(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await g(y(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError(`sketch:missing-property`,K(`view`))}_logMissingLayer(){this._logError(Re,K(`layer`))}};e([b()],G.prototype,`_defaultSnappingManager`,void 0),e([b()],G.prototype,`_operationContext`,void 0),e([b()],G.prototype,`_layerAdapter`,null),e([b()],G.prototype,`_pluginManager`,void 0),e([b({readOnly:!0})],G.prototype,`settingsManager`,void 0),e([b()],G.prototype,`_operationHandle`,void 0),e([b({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([b({readOnly:!0})],G.prototype,`_toolTransitionHandles`,void 0),e([b()],G.prototype,`_drawToolSimplifyAbortController`,void 0),e([b({readOnly:!0})],G.prototype,`activeTool`,null),e([b()],G.prototype,`geometrySimplificationInProgress`,null),e([b({readOnly:!0})],G.prototype,`activeCreateToolDrawMode`,null),e([b()],G.prototype,`activeTooltip`,null),e([b({types:E})],G.prototype,`activeFillSymbol`,void 0),e([b()],G.prototype,`activeLineSymbol`,void 0),e([b()],G.prototype,`activeVertexSymbol`,void 0),e([b()],G.prototype,`allowDeleteKey`,void 0),e([b({readOnly:!0})],G.prototype,`createGraphic`,null),e([b()],G.prototype,`defaultCreateOptions`,null),e([b()],G.prototype,`defaultUpdateOptions`,null),e([b()],G.prototype,`activeUpdateOptions`,void 0),e([b({type:M,nonNullable:!0})],G.prototype,`labelOptions`,null),e([b()],G.prototype,`layer`,void 0),e([b({types:E})],G.prototype,`pointSymbol`,void 0),e([b({types:E})],G.prototype,`polygonSymbol`,void 0),e([b({types:E})],G.prototype,`polylineSymbol`,void 0),e([b()],G.prototype,`meshSymbol`,void 0),e([b({type:T})],G.prototype,`textSymbol`,null),e([b({type:F,nonNullable:!0})],G.prototype,`snappingOptions`,null),e([b()],G.prototype,`snappingManager`,null),e([b({readOnly:!0})],G.prototype,`state`,null),e([b()],G.prototype,`toolTransitionInProgress`,null),e([b({type:Se,nonNullable:!0})],G.prototype,`tooltipOptions`,null),e([b({readOnly:!0})],G.prototype,`updateGraphics`,void 0),e([b()],G.prototype,`updateOnGraphicClick`,void 0),e([b()],G.prototype,`useViewOptions`,void 0),e([b()],G.prototype,`cancelUpdateOnClickAway`,void 0),e([b()],G.prototype,`updating`,null),e([b()],G.prototype,`creationMode`,void 0),e([b({type:Ce,nonNullable:!0})],G.prototype,`valueOptions`,null),e([b({types:E})],G.prototype,`vertexSymbol`,void 0),e([b({value:null})],G.prototype,`view`,null),e([b({constructOnly:!0,type:N})],G.prototype,`sketchOptions`,void 0),e([b()],G.prototype,`useLegacyCreateTools`,void 0),e([b()],G.prototype,`isUsingLegacyCreateTools`,null),e([b()],G.prototype,`pluginManager`,null),e([b()],G.prototype,`drawTool`,null),e([b()],G.prototype,`activePluginConfigurations`,null),e([b()],G.prototype,`rootPlugins`,null),e([b()],G.prototype,`effectiveAvailablePlugins`,null),e([b()],G.prototype,`firstPluginWithSwappableLeaf`,null),e([b()],G.prototype,`multiplePluginsActive`,null),G=e([re(`esri.widgets.Sketch.SketchViewModel`)],G);const Re=`sketch:missing-property`,K=e=>`Property '${e}' is missing on SketchViewModel.`;function ze(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 t from"../../Graphic.js";import{isSome as n}from"../../core/arrayUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import{handlesGroup as o,makeHandle as s,drainHandles as c,destroyHandle as l}from"../../core/handleUtils.js";import has from"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as d,abortMaybe as f,removeMaybe as p}from"../../core/maybe.js";import{createAbortError as m,ignoreAbortErrors as h,whenOrAbort as g}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as v,on as ee,when as te,sync as ne,whenOnce as y}from"../../core/reactiveUtils.js";import{property as b,subclass as re}from"../../core/accessorSupport/decorators.js";import{trackAccess as x}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as ie}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{UpdatingHandles as S}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as ae}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as oe,isLoaded as se,load as ce,project as le}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as ue}from"../../geometry/support/spatialReferenceUtils.js";import de from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as fe}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as pe}from"../../support/elevationInfoUtils.js";import me from"../../symbols/FillSymbol3DLayer.js";import he from"../../symbols/MeshSymbol3D.js";import ge from"../../symbols/SimpleFillSymbol.js";import _e from"../../symbols/SimpleLineSymbol.js";import w from"../../symbols/SimpleMarkerSymbol.js";import T from"../../symbols/TextSymbol.js";import{symbolTypes as E}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as ve}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as ye}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as be}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 xe}from"../../views/interactive/options/bindViewToolOptions.js";import j from"../../views/interactive/options/InteractiveToolOptions.js";import M from"../../views/interactive/sketch/SketchLabelOptions.js";import N from"../../views/interactive/sketch/SketchOptions.js";import Se from"../../views/interactive/sketch/SketchTooltipOptions.js";import Ce from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as P}from"../../views/interactive/snapping/SnappingManager.js";import{acquireForViewOptions as we}from"../../views/interactive/snapping/SnappingManagerPool.js";import F from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as I}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as Te}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as Ee}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as De}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as L}from"../../views/support/screenUtils.js";import Oe from"./adapters/layer/GraphicsLayerAdapter.js";import ke from"./adapters/layer/MapNotesLayerAdapter.js";import Ae from"./adapters/layer/SketchLayerAdapter.js";import{CreateOperationHandle as je,DrawToolOperationHandle as Me,UpdateOperationHandle as R}from"./support/OperationHandle.js";import{PluginManager as Ne}from"./support/PluginManager.js";import{SettingsManager as Pe}from"./support/SettingsManager.js";import{getLegacyTool as z,isCompletelyDegenerate as Fe,graphicsHaveTooFewVerticesForBox as B,getModeFromCreateOptions as Ie,getDrawToolGeometryTypeFromCreateTool as Le}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:Ee},tool:`transform`},U=Symbol(),W=Symbol();let G=class extends a{constructor(e){super(e),this._defaultSnappingManager=null,this._operationContext=null,this._internalGraphicsLayer=new de({listMode:`hide`,internal:!0,title:`SVM Internal`}),this._pluginManager=new Ne({sketchViewModel:this}),this.settingsManager=new Pe({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new S,this._toolTransitionHandles=new S,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new Te,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 ge({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new _e({color:[130,130,130,1],width:2}),this.meshSymbol=new he({symbolLayers:new r([new me])}),this.updateGraphics=new r,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 N,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)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},v)].filter(n);this.addHandles(t,W)},this._originalPopupEnabled=null,this.defaultCreateOptions=V,this.defaultUpdateOptions=H,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new F,this.textSymbol=new T({text:`text`})}initialize(){this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([ee(()=>this.view?.map?.layers,`change`,e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),v),_(()=>this.view,e=>{this._defaultSnappingManager=d(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new P({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`)))},v),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),I(this,void 0,()=>this._operationSnappingManager?.options??this.snappingOptions)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=d(this._defaultSnappingManager),this._destroyOperationContext(),this._set(`snappingManager`,null),this._set(`view`,null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=f(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 Oe(e);case`map-notes`:return new ke(e);case`sketch`:return new Ae(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(n).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=d(this._defaultSnappingManager)),this._override(`snappingManager`,e);else{let{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new P({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.snappingManager?.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){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(te(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},v),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(n)??[]}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(n)??[]}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=f(this._moduleLoaderAbortController),this._viewReadyAbortController=f(this._viewReadyAbortController),this._drawToolSimplifyAbortController=f(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(),m();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(),d(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(h(this.create(e,t)))}else i===`update`&&n&&this._updatingHandles.consumePromise(h(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(),m();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`&&!ue(n.geometry.spatialReference,t.spatialReference)&&(!oe(n.geometry.spatialReference,t.spatialReference)&&!se()&&await ce(),n.geometry=le(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?we(e):null,r=t?new j:this.sketchOptions,i;if(t){let{values:t}=r;i=o([xe(r,()=>e.options,()=>this.sketchOptions),_(()=>t.directionMode,e=>{this.sketchOptions.values.directionMode=e},ne)])}return this._operationContext={snappingManager:n?.snappingManager??this.snappingManager,toolOptions:r,...o([n,i])}}_destroyOperationContext(e=this._operationContext){e===this._operationContext?this._operationContext=p(this._operationContext):p(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 De(r.results)}let n=[t.map.ground];t.map.allLayers.forEach(e=>{fe(e)&&(!has(`enable-feature:im-as-ground`)||e.isUsedAsGroundLayer)&&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`?ae(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(L(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.mode):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=Ie(c,e),d=Le(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:ze(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 r=null,i=e.forceUniformSize,a=e.centered,o=new ie,l=[s(()=>o.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(),u.undo()):t.key===A.redo?(t.stopPropagation(),u.redo()):t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)&&!t.repeat?(e.forceUniformSize=!i,t.stopPropagation()):t.key===A.center&&(t.repeat||(e.centered=!a,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=i,t.stopPropagation()):t.key===A.center&&(e.centered=a,t.stopPropagation())},k.WIDGET),e.on(`vertex-update`,()=>{o.notify()}),e.on(`vertex-add`,t=>{switch(o.notify(),r=r==null?`start`:`active`,t.operation){case`apply`:this.emit(`create`,{graphic:e.graphic,state:r,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(o.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),r=`complete`,e.aborted?u&&u.cancel():u&&u.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],u=new je({activeComponent:e,type:`create`,onEnd:()=>{c(l),n.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(x(o),e.canUndo),canRedo:()=>(x(o),e.canRedo)});return u}_setupDrawToolOperationHandle(e,t){let r=this.view;if(!r)return this._logMissingView(),null;let i=null,a=[r.on(`key-down`,t=>{t.key===A.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},k.WIDGET),r.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||Fe(n))&&t.preventDefault()}),e.on([`vertex-add`,`vertex-remove`],r=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.getGeometryIfCompleted()),i=i==null&&r.type!==`vertex-remove`?`start`:`active`,r.operation){case`apply`:this.emit(`create`,{graphic:this.createGraphic,state:i,tool:this.activeTool,toolEventInfo:r,type:`create`});break;case`undo`:this._emitUndoEvent({graphics:[this.createGraphic].filter(n),tool:t});break;case`redo`:this._emitRedoEvent({graphics:[this.createGraphic].filter(n),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(h(this._finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:r,handle:o})))}})],o=new Me({activeComponent:e,type:`create`,onEnd:()=>{c(a),r.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return a.push(e.on(`cancel`,()=>{this._drawToolSimplifyAbortController=f(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,l=new Map,u=()=>{l.forEach(e=>e.destroy()),l.clear()};for(let t of e){let e=new o({view:n,graphic:t}),r=ve(e);if(r!==0)return u(),this._logError(`sketch:move`,`Move operation not supported for provided graphic(s) (${D(r)}).`),null;l.set(t,e)}let d=new s({view:n,enableZ:t.enableZ,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(d),d.objects.addMany(Array.from(l.values())),i||this.updateGraphics.addMany(e);let f=[],p=new R({activeComponent:d,tool:r,type:`update`,onEnd:()=>{c(f),Q(n,d),u()},undo:()=>{X(this.view,d),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});l.set(e,t),d.objects.push(t),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:`selection-change`},type:`update`})},removeFromSelection: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=l.get(e);n&&(d.objects.remove(n),n.destroy(),l.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&&be(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:l,ManipulatedObject3DGraphic:u}=s.module,d=new u({graphic:e,view:n}),f=new l({object:d,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:()=>{c(p),Q(n,f),d.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:l}=t,u=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(u))return u;let{ManipulatedObject3DGraphic:d,ExtentTransformTool:f}=u.module,p=this.view?.inputManager?.isModifierKeyDown(A.constraint),m=new d({view:n,graphic:e}),h=new f({object:m,view:n,enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:!!l!=!!p,toolOptions:this._operationToolOptions});n.tools.add(h),r||this.updateGraphics.add(e);let g=[],_=new R({activeComponent:h,tool:i,type:`update`,onEnd:()=>{c(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(),c(l),c(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)],l=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,l=new o({view:n,graphic:e}),u=ye(l);if(u!==0)return l.destroy(),this._logError(`sketch:reshape`,`Reshape operation not supported for provided graphic(s) (${D(u)}).`),null;let d=t.reshapeOptions,f=new s({view:n,object:l,enableZVertex:t.enableZ&&d?.vertexOperation===`move`,enableZShape:t.enableZ&&d?.shapeOperation===`move`,enableMoveObject:d?.shapeOperation===`move`||d?.shapeOperation===`move-xy`,enableMidpoints:d?.edgeOperation===`split`,enableEdgeOffset:d?.edgeOperation===`offset`,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),r||this.updateGraphics.add(l.graphic);let p=[],m=new R({activeComponent:f,tool:i,type:`update`,onEnd:()=>{c(p),Q(n,f),l.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:()=>{c(s),c(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&&(c(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(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,n])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=n??t.enableScaling??!0,l.refresh()},v)),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=L(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),d(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){u.getLogger(this).error(new i(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,n,r){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;let i=this.view,a=await import(`../../views/draw/DrawTool.js`);await this.pluginManager.loadPlugins();let o=await this.pluginManager.makeRenderer({customSymbol:n.graphicSymbol,useTextSymbol:r===`text`}),s=new a.DrawTool({view:i,elevationInfo:this._layerAdapter?.elevationInfo??pe(i.type===`3d`),hasZ:!!n.hasZ,toolOptions:this._operationToolOptions,renderer:o,defaultZ:n.defaultZ??0,directionOptions:n.directionOptions,snappingManager:this._operationSnappingManager,enableVertexVisuals:r!==`rectangle`&&r!==`circle`,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});s.addHandles(l(o));let c=new t({...n.graphicProperties,attributes:{...n.graphicProperties?.attributes},symbol:n.graphicSymbol??this._getGraphicSymbolFromTool(r)});return n.graphicSymbol||s.addHandles(_(()=>this._getGraphicSymbolFromTool(r),e=>c.symbol=e)),this._set(`createGraphic`,c),i.addAndActivateTool(s),s.begin(e),s}get test(){}wait(){return y(()=>!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?(f(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await g(y(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError(`sketch:missing-property`,K(`view`))}_logMissingLayer(){this._logError(Re,K(`layer`))}};e([b()],G.prototype,`_defaultSnappingManager`,void 0),e([b()],G.prototype,`_operationContext`,void 0),e([b()],G.prototype,`_layerAdapter`,null),e([b()],G.prototype,`_pluginManager`,void 0),e([b({readOnly:!0})],G.prototype,`settingsManager`,void 0),e([b()],G.prototype,`_operationHandle`,void 0),e([b({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([b({readOnly:!0})],G.prototype,`_toolTransitionHandles`,void 0),e([b()],G.prototype,`_drawToolSimplifyAbortController`,void 0),e([b({readOnly:!0})],G.prototype,`activeTool`,null),e([b()],G.prototype,`geometrySimplificationInProgress`,null),e([b({readOnly:!0})],G.prototype,`activeCreateToolDrawMode`,null),e([b()],G.prototype,`activeTooltip`,null),e([b({types:E})],G.prototype,`activeFillSymbol`,void 0),e([b()],G.prototype,`activeLineSymbol`,void 0),e([b()],G.prototype,`activeVertexSymbol`,void 0),e([b()],G.prototype,`allowDeleteKey`,void 0),e([b({readOnly:!0})],G.prototype,`createGraphic`,null),e([b()],G.prototype,`defaultCreateOptions`,null),e([b()],G.prototype,`defaultUpdateOptions`,null),e([b()],G.prototype,`activeUpdateOptions`,void 0),e([b({type:M,nonNullable:!0})],G.prototype,`labelOptions`,null),e([b()],G.prototype,`layer`,void 0),e([b({types:E})],G.prototype,`pointSymbol`,void 0),e([b({types:E})],G.prototype,`polygonSymbol`,void 0),e([b({types:E})],G.prototype,`polylineSymbol`,void 0),e([b()],G.prototype,`meshSymbol`,void 0),e([b({type:T})],G.prototype,`textSymbol`,null),e([b({type:F,nonNullable:!0})],G.prototype,`snappingOptions`,null),e([b()],G.prototype,`snappingManager`,null),e([b({readOnly:!0})],G.prototype,`state`,null),e([b()],G.prototype,`toolTransitionInProgress`,null),e([b({type:Se,nonNullable:!0})],G.prototype,`tooltipOptions`,null),e([b({readOnly:!0})],G.prototype,`updateGraphics`,void 0),e([b()],G.prototype,`updateOnGraphicClick`,void 0),e([b()],G.prototype,`useViewOptions`,void 0),e([b()],G.prototype,`cancelUpdateOnClickAway`,void 0),e([b()],G.prototype,`updating`,null),e([b()],G.prototype,`creationMode`,void 0),e([b({type:Ce,nonNullable:!0})],G.prototype,`valueOptions`,null),e([b({types:E})],G.prototype,`vertexSymbol`,void 0),e([b({value:null})],G.prototype,`view`,null),e([b({constructOnly:!0,type:N})],G.prototype,`sketchOptions`,void 0),e([b()],G.prototype,`useLegacyCreateTools`,void 0),e([b()],G.prototype,`isUsingLegacyCreateTools`,null),e([b()],G.prototype,`pluginManager`,null),e([b()],G.prototype,`drawTool`,null),e([b()],G.prototype,`activePluginConfigurations`,null),e([b()],G.prototype,`rootPlugins`,null),e([b()],G.prototype,`effectiveAvailablePlugins`,null),e([b()],G.prototype,`firstPluginWithSwappableLeaf`,null),e([b()],G.prototype,`multiplePluginsActive`,null),G=e([re(`esri.widgets.Sketch.SketchViewModel`)],G);const Re=`sketch:missing-property`,K=e=>`Property '${e}' is missing on SketchViewModel.`;function ze(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};
|
package/widgets/Slice.js
CHANGED
|
@@ -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"../analysis/SliceAnalysis.js";import{deprecateWidget as n}from"../core/deprecate.js";import r from"../core/Logger.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{property as a,subclass as o}from"../core/accessorSupport/decorators.js";import s from"./Widget.js";import c from"./Slice/SliceViewModel.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{Heading as d}from"./support/Heading.js";import{messageBundle as f,tsx as p}from"./support/widget.js";const m=`esri-slice`,h={base:m,actions:`${m}__actions`,cancelButton:`${m}__cancel-button`,container:`${m}__container`,error:`${m}__error`,excludeButton:`${m}__exclude-button`,hint:`${m}__hint`,hintText:`${m}__hint-text`,layerItem:`${m}__layer-item`,layerList:`${m}__layer-list`,layerListHeading:`${m}__layer-list-title`,newSliceButton:`${m}__clear-button`};let g=class extends s{constructor(e,t){super(e,t),this.headingLevel=3,this.messages=null,this.viewModel=new c({suppressDeprecationWarning:!0}),this._onNewSliceClick=()=>{i(this.viewModel.start())},n(r.getLogger(this),`Slice`,`arcgis-slice`,{version:`4.33`})}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`)})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get icon(){return`slice`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get hasVoxelLayers(){let e=this.viewModel?.view;return e!=null&&e.allLayerViews.some(e=>e.type===`voxel-3d`)}render(){return p(`div`,{class:this.classes(h.base,u.widget,u.panel),role:`presentation`},this.visible?p(`div`,{class:h.container},this.viewModel.supported?[this._renderHint(),this._renderLayerList(),this._renderActions()]:this._renderUnsupported()):null)}_renderUnsupported(){return p(`div`,{class:h.error,key:`unsupported`},p(`p`,null,this.messages.unsupported))}_renderHint(){let{hasVoxelLayers:e,messages:t,viewModel:n}=this,{active:r,mode:i,state:a}=n,o=null;return r&&(i===`exclude`?o=t.excludeHint:a===`ready`&&(o=e?t.voxelHint:t.hint)),o?p(`div`,{class:h.hint,key:`hint`},p(`p`,{class:h.hintText},o),p(`p`,{class:h.hintText},t.verticalHint)):null}_renderLayerList(){let{excludedLayers:e,excludeGroundSurface:t,headingLevel:n,messages:r,viewModel:i}=this,{mode:a,state:o}=i,s=o===`slicing`||o===`sliced`,c=e?e.toArray().map(e=>this._renderLayerItem({uid:e.uid,title:e.title,onClick:()=>(this.excludedLayers.remove(e),!1)})):[];return t&&c.push(this._renderLayerItem({uid:`ground`,title:r.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)})),a===`exclude`||!s||c.length===0?null:p(`div`,{class:h.layerList,key:`settings`},p(d,{class:h.layerListHeading,level:n},r.excludedLayers),p(`calcite-list`,{label:r.excludedLayers,selectionMode:`none`},c))}_renderActions(){let{messages:e,viewModel:t}=this,{active:n,state:r}=t,i=r===`disabled`,a=r===`slicing`||r===`sliced`,o=t.mode===`exclude`,s=[];return
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../analysis/SliceAnalysis.js";import{deprecateWidget as n}from"../core/deprecate.js";import r from"../core/Logger.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{property as a,subclass as o}from"../core/accessorSupport/decorators.js";import s from"./Widget.js";import c from"./Slice/SliceViewModel.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{Heading as d}from"./support/Heading.js";import{messageBundle as f,tsx as p}from"./support/widget.js";const m=`esri-slice`,h={base:m,actions:`${m}__actions`,cancelButton:`${m}__cancel-button`,container:`${m}__container`,error:`${m}__error`,excludeButton:`${m}__exclude-button`,hint:`${m}__hint`,hintText:`${m}__hint-text`,layerItem:`${m}__layer-item`,layerList:`${m}__layer-list`,layerListHeading:`${m}__layer-list-title`,newSliceButton:`${m}__clear-button`};let g=class extends s{constructor(e,t){super(e,t),this.headingLevel=3,this.messages=null,this.viewModel=new c({suppressDeprecationWarning:!0}),this._onNewSliceClick=()=>{i(this.viewModel.start())},n(r.getLogger(this),`Slice`,`arcgis-slice`,{version:`4.33`})}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`)})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get icon(){return`slice`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get hasVoxelLayers(){let e=this.viewModel?.view;return e!=null&&e.allLayerViews.some(e=>e.type===`voxel-3d`)}render(){return p(`div`,{class:this.classes(h.base,u.widget,u.panel),role:`presentation`},this.visible?p(`div`,{class:h.container},this.viewModel.supported?[this._renderHint(),this._renderLayerList(),this._renderActions()]:this._renderUnsupported()):null)}_renderUnsupported(){return p(`div`,{class:h.error,key:`unsupported`},p(`p`,null,this.messages.unsupported))}_renderHint(){let{hasVoxelLayers:e,messages:t,viewModel:n}=this,{active:r,mode:i,state:a}=n,o=null;return r&&(i===`exclude`?o=t.excludeHint:a===`ready`&&(o=e?t.voxelHint:t.hint)),o?p(`div`,{class:h.hint,key:`hint`},p(`p`,{class:h.hintText},o),p(`p`,{class:h.hintText},t.verticalHint)):null}_renderLayerList(){let{excludedLayers:e,excludeGroundSurface:t,headingLevel:n,messages:r,viewModel:i}=this,{mode:a,state:o}=i,s=o===`slicing`||o===`sliced`,c=e?e.toArray().map(e=>this._renderLayerItem({uid:e.uid,title:e.title,onClick:()=>(this.excludedLayers.remove(e),!1)})):[];return t&&c.push(this._renderLayerItem({uid:`ground`,title:r.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)})),a===`exclude`||!s||c.length===0?null:p(`div`,{class:h.layerList,key:`settings`},p(d,{class:h.layerListHeading,level:n},r.excludedLayers),p(`calcite-list`,{label:r.excludedLayers,selectionMode:`none`},c))}_renderActions(){let{messages:e,viewModel:t}=this,{active:n,state:r}=t,i=r===`disabled`,a=r===`slicing`||r===`sliced`,o=t.mode===`exclude`,s=[];return n&&!a||o||s.push(p(`calcite-button`,{class:h.newSliceButton,disabled:i,key:`new-slice`,onclick:this._onNewSliceClick},e.newSlice)),a&&!o&&s.push(p(`calcite-button`,{appearance:`outline-fill`,class:h.excludeButton,disabled:i,key:`exclude`,onclick:()=>t.enterExcludeLayerMode()},e.excludeLayer)),n&&o&&s.push(p(`calcite-button`,{appearance:`outline-fill`,class:h.cancelButton,disabled:i,key:`cancel-exclude`,onclick:()=>t.exitExcludeLayerMode()},e.cancel)),s.length===0?null:p(`div`,{class:h.actions},s)}_renderLayerItem(e){let t=this.messages.includeLayer;return p(`calcite-list-item`,{class:h.layerItem,"data-testid":`list-item-${e.uid}`,key:e.uid,label:e.title??``},p(`calcite-action`,{icon:`x`,slot:`actions-end`,text:t,title:t,onclick:e.onClick}))}};e([a()],g.prototype,`active`,null),e([a({type:t,nonNullable:!0})],g.prototype,`analysis`,null),e([a()],g.prototype,`excludedLayers`,null),e([a()],g.prototype,`excludeGroundSurface`,null),e([a()],g.prototype,`headingLevel`,void 0),e([a()],g.prototype,`icon`,null),e([a()],g.prototype,`label`,null),e([a(),f(`esri/widgets/Slice/t9n/Slice`)],g.prototype,`messages`,void 0),e([a()],g.prototype,`view`,null),e([a({type:c})],g.prototype,`viewModel`,void 0),e([a()],g.prototype,`visible`,null),e([a()],g.prototype,`hasVoxelLayers`,null),g=e([o(`esri.widgets.Slice`)],g);const _=g;export{_ as default};
|
|
@@ -5,6 +5,7 @@ import type MapView from "../../views/MapView.js";
|
|
|
5
5
|
import type { ReadonlyArrayOrCollection } from "../../core/Collection.js";
|
|
6
6
|
import type { Direction, State } from "./types.js";
|
|
7
7
|
|
|
8
|
+
/** @deprecated since 5.2. Use the [Swipe component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/) instead. */
|
|
8
9
|
export interface SwipeViewModelProperties extends Partial<Pick<SwipeViewModel, "direction" | "position" | "step" | "stepMultiplier" | "view">> {
|
|
9
10
|
/**
|
|
10
11
|
* A collection of [Layer](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/)s that will show on the left or top side of the Swipe.
|
|
@@ -25,6 +26,7 @@ export interface SwipeViewModelProperties extends Partial<Pick<SwipeViewModel, "
|
|
|
25
26
|
/**
|
|
26
27
|
* Provides the logic for the [Swipe widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/) and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/).
|
|
27
28
|
*
|
|
29
|
+
* @deprecated since 5.2. Use the [Swipe component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/) instead.
|
|
28
30
|
* @since 4.13
|
|
29
31
|
* @see [Swipe widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/Swipe/) - _Deprecated since 4.32. Use the [Swipe component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/) instead._
|
|
30
32
|
* @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
|
package/widgets/Swipe/types.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated since 5.2. Use the Swipe component's [`state`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/#state) property instead.
|
|
3
|
+
* @since 5.0
|
|
4
|
+
*/
|
|
2
5
|
export type State = "ready" | "disabled";
|
|
3
6
|
|
|
4
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated since 5.2. Use the Swipe component's [`direction`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/#direction) property instead.
|
|
9
|
+
* @since 5.0
|
|
10
|
+
*/
|
|
5
11
|
export type Direction = "vertical" | "horizontal";
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* The visible elements that are displayed within the widget.
|
|
9
15
|
* This provides the ability to turn individual elements of the widget's display on/off.
|
|
10
16
|
*
|
|
17
|
+
* @deprecated since 5.2. Use the Swipe component's [`hideHandle`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/#hideHandle) and [`hideDivider`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-swipe/#hideDivider) properties instead.
|
|
11
18
|
* @since 5.0
|
|
12
19
|
*/
|
|
13
20
|
export interface VisibleElements {
|
|
@@ -8,6 +8,7 @@ import type { Action, Stops, TimeSliderMode, TimeSliderState } from "./types.js"
|
|
|
8
8
|
import type { ReadonlyArrayOrCollection } from "../../core/Collection.js";
|
|
9
9
|
import type { TimeExtentProperties } from "../../time/TimeExtent.js";
|
|
10
10
|
|
|
11
|
+
/** @deprecated since 5.2. Use the Time Bar component's [fullTimeExtent](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/#fullTimeExtent), [loop](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/#loop), [mode](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/#mode), [playRate](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/#playRate), [stops](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/#stops), and [timeExtent](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/#timeExtent) properties instead. */
|
|
11
12
|
export interface TimeSliderViewModelProperties extends Partial<Pick<TimeSliderViewModel, "loop" | "mode" | "playRate" | "stops" | "view">> {
|
|
12
13
|
/**
|
|
13
14
|
* Defines actions that will appear in a menu when the user clicks the ellipsis button
|
|
@@ -152,7 +153,11 @@ export interface TimeSliderViewModelEvents {
|
|
|
152
153
|
"trigger-action": TimeSliderViewModelTriggerActionEvent;
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Event payload for the [@trigger-action](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/TimeSliderViewModel/#event-trigger-action) event.
|
|
158
|
+
*
|
|
159
|
+
* @deprecated since 5.2. Use custom actions in the Time Bar component's [`actions-end` slot](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/#slot-actions-end) instead.
|
|
160
|
+
*/
|
|
156
161
|
export interface TimeSliderViewModelTriggerActionEvent {
|
|
157
162
|
/** The action that was clicked. */
|
|
158
163
|
action: Action;
|
|
@@ -164,11 +169,10 @@ export interface TimeSliderViewModelTriggerActionEvent {
|
|
|
164
169
|
* @deprecated since version 5.2. Use the [Time Bar component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/) instead.
|
|
165
170
|
* @since 4.12
|
|
166
171
|
* @see [TimeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/) widget
|
|
167
|
-
* @see [Time
|
|
168
|
-
* @see [Sample - Time
|
|
172
|
+
* @see [Time Bar component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/)
|
|
173
|
+
* @see [Sample - Time Bar component](https://developers.arcgis.com/javascript/latest/sample-code/time-bar/)
|
|
169
174
|
* @see [Sample - SceneLayer with time filter](https://developers.arcgis.com/javascript/latest/sample-code/layers-scenelayer-time/)
|
|
170
|
-
* @see [Sample - Filter features with
|
|
171
|
-
* @see [Sample - TimeSlider with offset](https://developers.arcgis.com/javascript/latest/sample-code/widgets-timeslider-offset/)
|
|
175
|
+
* @see [Sample - Filter features with Time Bar component](https://developers.arcgis.com/javascript/latest/sample-code/time-bar-filter/)
|
|
172
176
|
* @see [Sample - Visualizing wind data with VectorFieldRenderer](https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-vfrenderer/)
|
|
173
177
|
* @see [Temporal data (ArcGIS Pro)](https://pro.arcgis.com/en/pro-app/latest/help/mapping/time/temporal-data.htm)
|
|
174
178
|
* @see [Set time properties on data (ArcGIS Pro)](https://pro.arcgis.com/en/pro-app/latest/help/mapping/time/set-the-time-properties-on-data.htm)
|