@arcgis/core 6.0.0-next.14 → 6.0.0-next.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/analysis/LineOfSightAnalysis.d.ts +49 -32
  2. package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
  3. package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
  4. package/analysis/Viewshed.d.ts +23 -3
  5. package/analysis/ViewshedAnalysis.d.ts +33 -13
  6. package/arcade/geometry/operatorsWorkerConnection.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
  10. package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
  11. package/assets/esri/core/workers/chunks/{fb444954be74c1962ced.js → 10d80e793019dfb45ca2.js} +1 -1
  12. package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
  13. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
  14. package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
  16. package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
  17. package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
  18. package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +1 -0
  19. package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
  20. package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
  21. package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
  22. package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 36cbd614454581aaf334.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
  25. package/assets/esri/core/workers/chunks/3baa4a9c52f41bfd6abb.js +1 -0
  26. package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
  27. package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
  28. package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
  29. package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
  30. package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
  31. package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
  32. package/assets/esri/core/workers/chunks/4bbe1f28f5f16a6bef05.js +1 -0
  33. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
  34. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
  35. package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
  36. package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
  37. package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
  38. package/assets/esri/core/workers/chunks/5acb422fe3cf693d9d4f.js +1 -0
  39. package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
  40. package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
  41. package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
  42. package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
  43. package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +1 -0
  44. package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
  45. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
  46. package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
  49. package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +1 -0
  50. package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
  51. package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
  58. package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
  59. package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +1 -0
  60. package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
  61. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
  62. package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
  63. package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
  64. package/assets/esri/core/workers/chunks/9b051745d24d1f43480b.js +1 -0
  65. package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
  66. package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 9f06ec95bdf0d0b52b41.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → a7bd5ba4d7d97411fd33.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
  72. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
  73. package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
  75. package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
  76. package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → bf35927979fc5e7e0478.js} +1 -1
  78. package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
  79. package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → c5a9e77977e867a75ff2.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → c79934cd6883307203f8.js} +1 -1
  81. package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
  82. package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
  83. package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +1 -0
  84. package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
  85. package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
  86. package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
  88. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
  89. package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
  90. package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
  91. package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
  92. package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
  93. package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
  94. package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
  95. package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
  96. package/assets/esri/core/workers/chunks/{aadfe34a99c9ec7a0e11.js → f9c5aa0bbf23e780fecc.js} +1 -1
  97. package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +1 -0
  98. package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
  100. package/assets/esri/libs/pdfjs/wasm/openjpeg_nowasm_fallback.js +1 -0
  101. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  102. package/chunks/Envelope.js +1 -1
  103. package/chunks/MultiPathImpl.js +1 -1
  104. package/chunks/OperatorGeodeticArea.js +1 -1
  105. package/chunks/OperatorShapePreservingLength.js +1 -1
  106. package/chunks/OperatorShapePreservingProject.js +1 -1
  107. package/chunks/UnitFactory.js +1 -1
  108. package/chunks/basis_encoder.js +1 -1
  109. package/chunks/basis_transcoder.js +1 -1
  110. package/chunks/index.js +1 -1
  111. package/chunks/lclayout.js +1 -1
  112. package/config.d.ts +2 -0
  113. package/config.js +1 -1
  114. package/core/ObjectPool.js +1 -1
  115. package/core/PooledArray.js +1 -1
  116. package/core/accessorSupport/DefaultsStore.js +1 -1
  117. package/core/accessorSupport/MultiOriginStore.js +1 -1
  118. package/core/accessorSupport/Store.js +1 -1
  119. package/core/accessorSupport/decorators/reader.js +1 -1
  120. package/core/accessorSupport/decorators/writer.js +1 -1
  121. package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
  122. package/core/workers/WorkerOwner.js +1 -1
  123. package/core/workers/workerFactory.js +1 -1
  124. package/core/workers/workers.js +2 -2
  125. package/core/workers.d.ts +9 -0
  126. package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
  127. package/geometry/Mesh.js +1 -1
  128. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  129. package/geometry/operators/gx/operatorOffset.js +1 -1
  130. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  131. package/geometry/operators/support/jsonConverter.js +1 -1
  132. package/geometry/support/buffer/BufferPool.js +1 -1
  133. package/geometry/support/coordsUtils.js +1 -1
  134. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  135. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  136. package/geometry/support/meshUtils/merge.js +1 -1
  137. package/geometry/support/meshUtils/rotate.js +1 -1
  138. package/geometry/support/meshUtils.d.ts +5 -6
  139. package/geometry/support/polygonExtentClipping.js +1 -1
  140. package/identity/Credential.js +1 -1
  141. package/interfaces.d.ts +18 -9
  142. package/kernel.js +1 -1
  143. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  144. package/layers/AnnotationFeatureLayer.js +1 -1
  145. package/layers/CatalogLayer.d.ts +2 -2
  146. package/layers/CatalogLayer.js +1 -1
  147. package/layers/DimensionFeatureLayer.d.ts +2 -2
  148. package/layers/DimensionFeatureLayer.js +1 -1
  149. package/layers/FeatureLayer.d.ts +4 -4
  150. package/layers/FeatureLayer.js +1 -1
  151. package/layers/GeospatialPDFLayer.d.ts +154 -4
  152. package/layers/ImageryTileLayer.js +1 -1
  153. package/layers/Layer.d.ts +2 -0
  154. package/layers/LineOfSightLayer.d.ts +10 -8
  155. package/layers/SceneLayer.js +1 -1
  156. package/layers/SubtypeGroupLayer.d.ts +2 -2
  157. package/layers/SubtypeGroupLayer.js +1 -1
  158. package/layers/ViewshedLayer.d.ts +1 -1
  159. package/layers/VoxelLayer.js +1 -1
  160. package/layers/WMSLayer.js +1 -1
  161. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  162. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
  163. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  164. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  165. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  166. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  167. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  168. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  169. package/layers/graphics/data/QueryEngineResult.js +1 -1
  170. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  171. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  172. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  173. package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
  174. package/layers/mixins/ReloadableLayer.js +2 -0
  175. package/layers/raster/datasets/BaseRaster.js +1 -1
  176. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  177. package/layers/raster/datasets/ImageAuxRaster.js +2 -2
  178. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  179. package/layers/raster/datasets/InMemoryRaster.js +1 -1
  180. package/layers/raster/datasets/MRFRaster.js +1 -1
  181. package/layers/raster/datasets/TIFFRaster.js +1 -1
  182. package/layers/raster/datasets/WCSRaster.js +1 -1
  183. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  184. package/layers/raster/formats/RasterCodec.js +1 -1
  185. package/layers/raster/formats/TiffDecoder.js +1 -1
  186. package/layers/raster/formats/Zlib.js +1 -1
  187. package/layers/raster/functions/stretchUtils.js +1 -1
  188. package/layers/raster/functions/vectorFieldUtils.js +1 -1
  189. package/layers/support/FieldsIndex.js +1 -1
  190. package/layers/support/LabelClass.d.ts +3 -2
  191. package/layers/support/PortalItemData.d.ts +31 -8
  192. package/layers/support/RasterWorker.js +1 -1
  193. package/layers/support/featureReductionProperties.js +1 -1
  194. package/layers/support/kmlUtils.js +1 -1
  195. package/layers/support/types.d.ts +4 -1
  196. package/layers/video/VideoController.js +10 -10
  197. package/libs/maquette/projection.js +1 -1
  198. package/networks/UtilityNetworkTraceAnalysis.js +1 -1
  199. package/package.json +5 -5
  200. package/popup/FeatureModel.js +1 -1
  201. package/popup/FeaturesModel.js +1 -1
  202. package/portal/Portal.js +1 -1
  203. package/request/process.js +1 -1
  204. package/request/types.d.ts +7 -0
  205. package/rest/knowledgeGraph/ObjectValue.js +1 -1
  206. package/rest/knowledgeGraphService.js +1 -1
  207. package/rest/networks/trace.js +1 -1
  208. package/rest/query/executeQuery.js +1 -1
  209. package/smartMapping/raster/renderers/shadedRelief.js +1 -1
  210. package/smartMapping/renderers/univariateColorSize.js +1 -1
  211. package/smartMapping/statistics/support/statsWorker.js +1 -1
  212. package/smartMapping/statistics/support/utils.js +1 -1
  213. package/smartMapping/support/clusterUtils.js +1 -1
  214. package/statistics/utils.js +1 -1
  215. package/symbols/cim/CIMCursor.js +1 -1
  216. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  217. package/symbols/cim/cimAnalyzer.js +1 -1
  218. package/symbols/support/ElevationInfo.d.ts +4 -3
  219. package/undoredo/support/Services.js +1 -1
  220. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
  221. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  222. package/views/2d/grid/GridView2D.js +1 -1
  223. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  224. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  225. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  226. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
  227. package/views/2d/viewpointUtils.js +1 -1
  228. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  229. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  230. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  231. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  232. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  233. package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
  234. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  235. package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
  236. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
  237. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  238. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  239. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  240. package/views/3d/analysis/Viewshed/types.d.ts +7 -0
  241. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
  242. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  243. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  244. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  245. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  246. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  247. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  248. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  249. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  250. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  251. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  252. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  253. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  254. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  255. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  256. package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
  257. package/views/3d/layers/i3s/I3SNode.js +1 -1
  258. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  259. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  260. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  261. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  262. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  263. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  264. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  265. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  266. package/views/3d/support/MemoryController.js +1 -1
  267. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  268. package/views/3d/support/elevationUpdateUtils.js +1 -1
  269. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  270. package/views/3d/support/sphereExtentUtils.js +2 -0
  271. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  272. package/views/3d/terrain/OverlayRenderer.js +1 -1
  273. package/views/3d/terrain/PatchRenderData.js +1 -1
  274. package/views/3d/terrain/TerrainData.js +1 -1
  275. package/views/3d/terrain/terrainUtils.js +1 -1
  276. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  277. package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
  278. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  279. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  280. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  281. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  282. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  283. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  284. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  285. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  286. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  287. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  288. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  289. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  290. package/views/SceneView.js +1 -1
  291. package/views/ToolViewManager.js +1 -1
  292. package/views/draw/DrawOperation.js +1 -1
  293. package/views/draw/support/InteractiveHandle.js +1 -1
  294. package/views/draw/support/Reshape.js +1 -1
  295. package/views/draw/support/createUtils.js +1 -1
  296. package/views/draw/support/editingSessionUtils.js +1 -1
  297. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  298. package/views/interactive/SegmentLabels.js +1 -1
  299. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  300. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  301. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  302. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  303. package/views/interactive/options/TooltipOptions.d.ts +2 -0
  304. package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
  305. package/views/interactive/sketch/constraintUtils.js +1 -1
  306. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  307. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  308. package/views/layers/LayerView.js +1 -1
  309. package/views/layers/LineOfSightLayerView.d.ts +35 -13
  310. package/views/layers/SketchLayerView.d.ts +1 -0
  311. package/views/layers/ViewshedLayerView.d.ts +36 -12
  312. package/views/webgl/Program.js +1 -1
  313. package/views/webgl/Texture.js +1 -1
  314. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  315. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  316. package/widgets/BatchAttributeForm.js +1 -1
  317. package/widgets/Directions.js +1 -1
  318. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  319. package/widgets/Editor/EditorViewModel.d.ts +10 -1
  320. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  321. package/widgets/Editor.d.ts +10 -1
  322. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  323. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  324. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  325. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  326. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  327. package/widgets/HistogramRangeSlider.d.ts +2 -2
  328. package/widgets/HistogramRangeSlider.js +1 -1
  329. package/widgets/Legend.d.ts +1 -0
  330. package/widgets/Print.js +1 -1
  331. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
  332. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  333. package/widgets/ScaleRangeSlider.js +1 -1
  334. package/widgets/Slice.js +1 -1
  335. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  336. package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
  337. package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
  338. package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
  339. package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
  340. package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
  341. package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
  342. package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
  343. package/widgets/ValuePicker/types.d.ts +2 -0
  344. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  345. package/widgets/support/SelectionList.js +1 -1
  346. package/widgets/support/componentsUtils.js +1 -1
  347. package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
  348. package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
  349. package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
  350. package/assets/esri/core/workers/chunks/037a8cc19debbaaa4e10.js +0 -1
  351. package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
  352. package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
  353. package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
  354. package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
  355. package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
  356. package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
  357. package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
  358. package/assets/esri/core/workers/chunks/22e8c0aad2fe75943865.js +0 -1
  359. package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
  360. package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
  361. package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
  362. package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
  363. package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
  364. package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
  365. package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
  366. package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
  367. package/assets/esri/core/workers/chunks/5bfea0c55aca826de536.js +0 -1
  368. package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
  369. package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
  370. package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
  371. package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
  372. package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
  373. package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
  374. package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
  375. package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
  376. package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
  377. package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
  378. package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
  379. package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
  380. package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
  381. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
  382. package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
  383. package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
  384. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
  385. package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
  386. package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
  387. package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
  388. package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
  389. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
  390. package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
  391. package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
  392. package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
  393. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
  394. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
  395. package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
  396. package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
  397. package/layers/mixins/FeatureLayerReload.js +0 -2
  398. /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{clone as n}from"../../core/lang.js";import{equalsMaybe as r,destroyMaybe as i}from"../../core/maybe.js";import{memoize as a}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveSet.js";import{watch as c,syncAndInitial as l}from"../../core/reactiveUtils.js";import{createScreenPoint as u}from"../../core/screenUtils.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{diff as p}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{pointEquals as h,pointNear as g}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./drawingModes.js";import{LegacyDrawManipulator as y}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as b}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as x,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as C,Part as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as T}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as E}from"../interactive/sketch/constraints.js";import{getPointConstraint as D,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as k,constraintSpaceToPoint as A}from"../interactive/sketch/constraintUtils.js";import j from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as N}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as P}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as F}from"../interactive/snapping/snappingUtils.js";const I=`crosshair`,L=`progress`,R=Symbol(),z=Symbol();let B=class extends t{constructor(e){super(e),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new s,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new m,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=a(D),this._getPolylineOrPolygonConstraint=a(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new j,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,e.elevationInfo??(this.elevationInfo=_(!!e.hasZ))}initializePointer(){let e=this.view.inputManager?.latestPointerInfo;e!=null&&e.type!==`touch`&&this._updatePointer(e.location,e.id,e.type)}initialize(){let{geometryType:e,view:t}=this,n=t.spatialReference,i=`viewingMode`in t.state?t.state.viewingMode:2,a=e===`segment`||e===`multipoint`?`polyline`:e;this.coordinateHelper=b(this.hasZ,this.hasM,n),this._editGeometryOperations=new T(new C(a,this.coordinateHelper),i),this._snappingOperation=new P({view:t}),this.addHandles([c(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:e,constraint:t},n)=>{let{snappingOptions:r}=this;if(r&&(r.forceDisabled=t!=null&&E(t)),n!=null&&e===n.stagedPoint&&t!==n.constraint)return this._onKeyboardBasedChange();this._processCursor(e??this._screenToMap(this._stagedScreenPoint))},{equals:(e,t)=>e.stagedPoint===t.stagedPoint&&r(e.constraint,t.constraint)}),c(()=>this.view.viewpoint,(e,t)=>{e&&t&&p(e,t)&&this._onKeyboardBasedChange()})]),this._activePart=new w(n,i),this._editGeometryOperations.data.parts.push(this._activePart);let s=this.segmentLabels;s!=null&&(s.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles(c(()=>this.labelOptions.enabled,e=>{s.visible=e},l))),this.addHandles(this._editGeometryOperations.on([`vertex-add`,`vertex-update`,`vertex-remove`],e=>{let t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),n=t.map(e=>e.coordinates),r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;h(r,this.firstVertex)||(this.firstVertex=r);let i=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;h(i,this.lastVertex)||(this.lastVertex=i);let a=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(h(a,this.secondToLastVertex)||(this.secondToLastVertex=a),this._processCursor(this.cursorVertex),e.type){case`vertex-add`:this.emit(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this.emit(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this.emit(e.type,{...e,removed:n,vertices:t})}}));let u=this._manipulator=new y({consumesClicks:!1,grabbableForEvent:e=>this.drawingMode!==`click`||e.pointerType===`touch`&&this._snappingEnabled&&this._pointerDownStates.size===1});this.manipulators.add(u),u.grabbable=e!==`point`&&e!==`multipoint`,this.addHandles([u.events.on(`immediate-click`,e=>this._onImmediateClick(e)),u.events.on(`immediate-double-click`,e=>this._onImmediateDoubleClick(e)),c(()=>this.drawingMode,()=>{this.removeHandles(R),this.addHandles(this._createManipulatorDragPipeline(u),R)},l),c(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:e})=>{u.cursor=e},l)]),F(this,()=>{let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);if(this.snappingManager!=null){let e=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,t);this._updatingHandles.consumePromise(o(e))}})}destroy(){i(this.segmentLabels),i(this._snappingOperation),this._editGeometryOperations=i(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){let{_stagedPointerId:e,_manipulator:t}=this;return e!=null&&this._pointerDownStates.has(e)||t.grabbing||!t.interactive}get _snappingEnabled(){return this.snappingManager!=null&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){let e=this._updateAndGetEffectiveDrawSurface();return this.view.type===`3d`&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(e=>this.coordinateHelper.vectorToArray(e.pos))}get _constraint(){let{constraints:e,constraintsEnabled:t}=this;if(e&&t)switch(this.geometryType){case`point`:case`multipoint`:return this._getPointConstraint(e);case`polygon`:case`polyline`:return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,e)}}set drawingMode(e){this._set(`drawingMode`,e??v)}get effectiveCursor(){return this.loading?L:this._hideDefaultCursor?null:this.cursor||I}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return this.snappingManager==null?null:this.snappingManager.options}get cursorVertex(){return this._get(`cursorVertex`)}get visualizationCursorVertex(){return this._stagedPointerType===`mouse`?this.cursorVertex:null}get committableVertex(){let{cursorVertex:e,lastVertex:t,firstVertex:n,geometryType:r}=this;return r===`polygon`&&g(e,n)||g(e,t)?null:e}get updating(){return this.loading||this._updatingHandles.updating||!!this.segmentLabels?.updating}get geometryIncludingUncommittedVertices(){let{committedVertices:e,committableVertex:t,coordinateHelper:n}=this,r=e.slice();return t!=null&&r.push(n.pointToArray(t)),r}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();let{committableVertex:e}=this;e!=null&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e),this._activePart)}complete(e){let t=e?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();let{geometryType:n,numCommittedVertices:r}=this,i=n===`multipoint`&&r===0||n===`polyline`&&r<2||n===`polygon`&&r<3;(n===`segment`||n===`point`)&&this.commitStagedVertex(),this._createOperationCompleted=!i,(this.isCompleted||t)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit(`complete`,{vertices:this.committedVertices.map((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e})),aborted:t,type:`complete`}))}onInputEvent(e){switch(e.type){case`pointer-down`:this._pointerDownStates.add(e.pointerId);break;case`pointer-up`:this._pointerDownStates.delete(e.pointerId)}switch(e.type){case`pointer-move`:return this._onPointerMove(e);case`hold`:return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(e){let t=n(this.cursorVertex),r=n(e),i=r&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(r)??r),a=this._snapToClosingVertex(i),o=this._applyConstraints(a);g(t,o)||(this._set(`cursorVertex`,o),this.segmentLabels?.set(`stagedVertex`,o==null?null:this.coordinateHelper.pointToVector(o)),o==null||this._stagedPointerType!==`mouse`?this.emit(`cursor-remove`):this.emit(`cursor-update`,{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:`apply`,type:`vertex-update`}))}_snapToClosingVertex(e){if(e==null||this._isDragging||this.geometryType!==`polygon`||this.numCommittedVertices<=2)return e;let t=this._mapToScreen(e);if(!t)return e;let n=this._activePart;return this._vertexWithinPointerDistance(n.vertices[0].pos,t)?this.firstVertex:this._vertexWithinPointerDistance(n.vertices.at(-1).pos,t)?this.lastVertex:e}_createManipulatorDragPipeline(e){switch(this.drawingMode){case`click`:return this._createManipulatorDragPipelineClick(e);case`freehand`:return this._createManipulatorDragPipelineFreehand(e);case`hybrid`:return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return x(e,(e,t,n,r)=>{let i=r===`touch`&&this._snappingEnabled;if(this.isCompleted||!i)return;let{snappingStep:a,cancelSnapping:o}=N({predicate:()=>i,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:r,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});n.next(e=>(i&&this.snappingManager!=null&&this.snappingManager.doneSnapping(),e)).next(o),t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._processCursor(e.mapStart),(this.geometryType===`segment`||i&&!this.numCommittedVertices)&&this.commitStagedVertex()),e)).next(S(this.view,this.elevationInfo)).next(...a).next(e=>(i&&(this._processCursor(e.mapEnd),e.action===`end`&&this.commitStagedVertex()),e)).next(e=>(e.action===`end`&&(this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()),e))})}_createManipulatorDragPipelineFreehand(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.committableVertex??this._processCursor(e.mapStart),this.geometryType===`segment`&&this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this.complete()}return e})})}_createManipulatorDragPipelineHybrid(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),z),this._processCursor(e.mapStart),this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),this.removeHandles(z),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()}return e})})}get _drawAtFixedElevation(){let{constraintsEnabled:e,constraintZ:t,geometryType:n,numCommittedVertices:r}=this;return e?t!=null||n===`segment`&&r>0:(n===`segment`||n===`polygon`)&&r>0}_updateAndGetEffectiveDrawSurface(){let{constraintsEnabled:e,coordinateHelper:t,drawSurface:n,elevationDrawSurface:r,snapToSceneEnabled:i}=this;if(r==null)return n;if(!this.hasZ)return r.defaultZ=null,r;let a=this.elevationInfo?.mode,o=this.defaultZ,s=e||a===`absolute-height`;return i!=null&&(s=i),a===`on-the-ground`&&(s=!1),this._drawAtFixedElevation&&(o=(e?this.constraintZ:null)??t.getZ(this._activePart.vertices[0].pos),s=!1),s?n:(r.defaultZ=o,r)}_mapToScreen(e){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),this.drawingMode===`click`&&e.pointerType===`touch`&&this._snappingEnabled&&this._processCursor(e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if(!(e.pointerType===`mouse`&&e.button===2||this._manipulator.dragging))try{let{drawingMode:t,geometryType:n}=this;this._stagedPointerType=e.pointerType,this._stagedScreenPoint=e.screenPoint;let r=this._screenToMap(e.screenPoint);if(r==null||r==null||t===`freehand`&&n!==`point`&&n!==`multipoint`)return;if((!this._snappingEnabled||this.cursorVertex==null)&&this._processCursor(r),this.committableVertex==null){this.complete();return}this.commitStagedVertex(),e.pointerType!==`mouse`&&this._processCursor(null),(t===`freehand`&&this.geometryType!==`multipoint`||n===`point`||n===`segment`&&this.numCommittedVertices===2||n===`segment`&&t===`hybrid`&&this.numCommittedVertices===1)&&this.complete()}finally{e.stopPropagation()}}_onImmediateDoubleClick(e){this._manipulator.dragging||this.geometryType===`point`||(this.complete(),e.stopPropagation())}_onPointerMove(e){let t=u(e.x,e.y);this._updatePointer(t,e.pointerId,e.pointerType)&&e.stopPropagation()}_updatePointer(e,t,n){return this._stagedScreenPoint=e,this._stagedPointerType=n,this._stagedPointerId=t,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(e,n),!0)}_onKeyboardBasedChange(){this._stagedPointerType!==`mouse`||!this._stagedScreenPoint||this._stagedPointerId==null||this._isDragging?this._snappingOperation.abort():this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType)}_processCursorMovementRelativeToSurface(e,t){let n=this._snappingOperation,r=this._screenToMap(e),i=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(r==null){this._hideDefaultCursor=!0,this._processCursor(null),n.abort();return}this._hideDefaultCursor=!1;let a=this.snappingManager;if(a==null){this._processCursor(r),n.abort();return}let s=this._getSnappingContext(t);this._updatingHandles.consumePromise(o(n.snap({point:r,scenePoint:i},a,s)))}_applyConstraints(e){let{_constraint:t,constraints:n}=this;if(!e||!n||!t)return e;let{context:r}=n,i=k(e,r),a=i?t.closestTo(i):void 0;if(!a)return e;let o=A(a,e,r),s=this.view.type===`2d`||r.elevationInfo.mode!==`absolute-height`;return o!=null&&s&&this.constraintZ!=null&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(e){return e?this._updateAndGetEffectiveDrawSurface()?.screenToMap(e):null}_screenToMapDragEventStep(){let e=null;return t=>{if(t.action===`start`&&(e=this._screenToMap(t.screenStart)),e==null)return null;let n=this._screenToMap(t.screenEnd);return n==null?null:{...t,mapStart:e,mapEnd:n}}}_vertexWithinPointerDistance(e,t){let n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return n!=null&&V(n,t,25)}_getSnappingContext(e){let t=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:t==null?null:{value:t,elevationInfo:this.elevationInfo},drawConstraints:this.constraints})}};e([d()],B.prototype,`_hideDefaultCursor`,void 0),e([d()],B.prototype,`_stagedPointerId`,void 0),e([d()],B.prototype,`_isDragging`,null),e([d()],B.prototype,`_snappingOperation`,void 0),e([d()],B.prototype,`_snappingEnabled`,null),e([d({constructOnly:!0})],B.prototype,`graphic`,void 0),e([d()],B.prototype,`constraintsEnabled`,void 0),e([d()],B.prototype,`constraints`,void 0),e([d()],B.prototype,`_constraint`,null),e([d()],B.prototype,`constraintZ`,void 0),e([d()],B.prototype,`defaultZ`,void 0),e([d()],B.prototype,`isDraped`,void 0),e([d({value:v})],B.prototype,`drawingMode`,null),e([d({constructOnly:!0})],B.prototype,`elevationDrawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`elevationInfo`,void 0),e([d({constructOnly:!0,type:j})],B.prototype,`labelOptions`,void 0),e([d({constructOnly:!0})],B.prototype,`geometryType`,void 0),e([d({constructOnly:!0})],B.prototype,`hasM`,void 0),e([d({constructOnly:!0})],B.prototype,`hasZ`,void 0),e([d()],B.prototype,`cursor`,void 0),e([d()],B.prototype,`effectiveCursor`,null),e([d()],B.prototype,`loading`,void 0),e([d({constructOnly:!0})],B.prototype,`manipulators`,void 0),e([d({constructOnly:!0})],B.prototype,`drawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`segmentLabels`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingManager`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingVisualizer`,void 0),e([d()],B.prototype,`snapToSceneEnabled`,void 0),e([d({readOnly:!0})],B.prototype,`cursorVertex`,null),e([d({readOnly:!0})],B.prototype,`visualizationCursorVertex`,null),e([d()],B.prototype,`committableVertex`,null),e([d()],B.prototype,`firstVertex`,void 0),e([d()],B.prototype,`lastVertex`,void 0),e([d()],B.prototype,`secondToLastVertex`,void 0),e([d()],B.prototype,`updating`,null),e([d({constructOnly:!0})],B.prototype,`view`,void 0),B=e([f(`esri.views.draw.DrawOperation`)],B);function V(e,t,n){let r=e.x-t.x,i=e.y-t.y;return r*r+i*i<=n}export{B as DrawOperation,I as defaultCursor,L as defaultLoadingCursor};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{clone as n}from"../../core/lang.js";import{equalsMaybe as r,destroyMaybe as i}from"../../core/maybe.js";import{memoize as a}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveSet.js";import{watch as c,syncAndInitial as l}from"../../core/reactiveUtils.js";import{createScreenPoint as u}from"../../core/screenUtils.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{diff as p}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{pointEquals as h,pointNear as g}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./drawingModes.js";import{LegacyDrawManipulator as y}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as b}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as x,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as C,Part as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as T}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as E}from"../interactive/sketch/constraints.js";import{getPointConstraint as D,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as k,constraintSpaceToPoint as A}from"../interactive/sketch/constraintUtils.js";import j from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as N}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as P}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as F}from"../interactive/snapping/snappingUtils.js";const I=`crosshair`,L=`progress`,R=Symbol(),z=Symbol();let B=class extends t{constructor(e){super(e),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new s,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new m,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=a(D),this._getPolylineOrPolygonConstraint=a(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new j,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,e.elevationInfo??(this.elevationInfo=_(!!e.hasZ))}initializePointer(){let e=this.view.inputManager?.latestPointerInfo;e!=null&&e.type!==`touch`&&this._updatePointer(e.location,e.id,e.type)}initialize(){let{geometryType:e,view:t}=this,n=t.spatialReference,i=`viewingMode`in t.state?t.state.viewingMode:2,a=e===`segment`||e===`multipoint`?`polyline`:e;this.coordinateHelper=b(this.hasZ,this.hasM,n),this._editGeometryOperations=new T(new C(a,this.coordinateHelper),i),this._snappingOperation=new P({view:t}),this.addHandles([c(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:e,constraint:t},n)=>{let{snappingOptions:r}=this;if(r&&(r.forceDisabled=t!=null&&E(t)),n!=null&&e===n.stagedPoint&&t!==n.constraint)return this._onKeyboardBasedChange();this._processCursor(e??this._screenToMap(this._stagedScreenPoint))},{equals:(e,t)=>e.stagedPoint===t.stagedPoint&&r(e.constraint,t.constraint)}),c(()=>this.view.viewpoint,(e,t)=>{e&&t&&p(e,t)&&this._onKeyboardBasedChange()})]),this._activePart=new w(n,i),this._editGeometryOperations.data.parts.push(this._activePart);let s=this.segmentLabels;s!=null&&(s.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles(c(()=>this.labelOptions.enabled,e=>{s.visible=e},l))),this.addHandles(this._editGeometryOperations.on([`vertex-add`,`vertex-update`,`vertex-remove`],e=>{let t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),n=t.map(e=>e.coordinates),r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;h(r,this.firstVertex)||(this.firstVertex=r);let i=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;h(i,this.lastVertex)||(this.lastVertex=i);let a=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(h(a,this.secondToLastVertex)||(this.secondToLastVertex=a),this._processCursor(this.cursorVertex),e.type){case`vertex-add`:this.emit(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this.emit(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this.emit(e.type,{...e,removed:n,vertices:t})}}));let u=this._manipulator=new y({consumesClicks:!1,grabbableForEvent:e=>this.drawingMode!==`click`||e.pointerType===`touch`&&this._snappingEnabled&&this._pointerDownStates.size===1});this.manipulators.add(u),u.grabbable=e!==`point`&&e!==`multipoint`,this.addHandles([u.events.on(`immediate-click`,e=>this._onImmediateClick(e)),u.events.on(`immediate-double-click`,e=>this._onImmediateDoubleClick(e)),c(()=>this.drawingMode,()=>{this.removeHandles(R),this.addHandles(this._createManipulatorDragPipeline(u),R)},l),c(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:e})=>{u.cursor=e},l)]),F(this,()=>{let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);if(this.snappingManager!=null){let e=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,t);this._updatingHandles.consumePromise(o(e))}})}destroy(){i(this.segmentLabels),i(this._snappingOperation),this._editGeometryOperations=i(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){let{_stagedPointerId:e,_manipulator:t}=this;return e!=null&&this._pointerDownStates.has(e)||t.grabbing||!t.interactive}get _snappingEnabled(){return this.snappingManager!=null&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){let e=this._updateAndGetEffectiveDrawSurface();return this.view.type===`3d`&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(e=>this.coordinateHelper.vectorToArray(e.pos))}get _constraint(){let{constraints:e,constraintsEnabled:t}=this;if(e&&t)switch(this.geometryType){case`point`:case`multipoint`:return this._getPointConstraint(e);case`polygon`:case`polyline`:return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,e)}}set drawingMode(e){this._set(`drawingMode`,e??v)}get effectiveCursor(){return this.loading?L:this._hideDefaultCursor?null:this.cursor||I}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return this.snappingManager==null?null:this.snappingManager.options}get cursorVertex(){return this._get(`cursorVertex`)}get visualizationCursorVertex(){return this._stagedPointerType===`mouse`?this.cursorVertex:null}get committableVertex(){let{cursorVertex:e,lastVertex:t,firstVertex:n,geometryType:r}=this;return r===`polygon`&&g(e,n)||g(e,t)?null:e}get updating(){return this.loading||this._updatingHandles.updating||!!this.segmentLabels?.updating}get geometryIncludingUncommittedVertices(){let{committedVertices:e,committableVertex:t,coordinateHelper:n}=this,r=e.slice();return t!=null&&r.push(n.pointToArray(t)),r}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();let{committableVertex:e}=this;e!=null&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e),this._activePart)}complete(e){let t=e?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();let{geometryType:n,numCommittedVertices:r}=this,i=n===`multipoint`&&r===0||n===`polyline`&&r<2||n===`polygon`&&r<3;(n===`segment`||n===`point`)&&this.commitStagedVertex(),this._createOperationCompleted=!i,(this.isCompleted||t)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit(`complete`,{vertices:this.committedVertices.map((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e})),aborted:t,type:`complete`}))}onInputEvent(e){switch(e.type){case`pointer-down`:this._pointerDownStates.add(e.pointerId);break;case`pointer-up`:this._pointerDownStates.delete(e.pointerId)}switch(e.type){case`pointer-move`:return this._onPointerMove(e);case`hold`:return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(e){let t=n(this.cursorVertex),r=n(e),i=r&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(r)??r),a=this._snapToClosingVertex(i),o=this._applyConstraints(a);g(t,o)||(this._set(`cursorVertex`,o),this.segmentLabels?.set(`stagedVertex`,o==null?null:this.coordinateHelper.pointToVector(o)),o==null||this._stagedPointerType!==`mouse`?this.emit(`cursor-remove`):this.emit(`cursor-update`,{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:`apply`,type:`vertex-update`}))}_snapToClosingVertex(e){if(e==null||this._isDragging||this.geometryType!==`polygon`||this.numCommittedVertices<=2)return e;let t=this._mapToScreen(e);if(!t)return e;let n=this._activePart;return this._vertexWithinPointerDistance(n.vertices[0].pos,t)?this.firstVertex:this._vertexWithinPointerDistance(n.vertices.at(-1).pos,t)?this.lastVertex:e}_createManipulatorDragPipeline(e){switch(this.drawingMode){case`click`:return this._createManipulatorDragPipelineClick(e);case`freehand`:return this._createManipulatorDragPipelineFreehand(e);case`hybrid`:return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return x(e,(e,t,n,r)=>{let i=r===`touch`&&this._snappingEnabled;if(this.isCompleted||!i)return;let{snappingStep:a,cancelSnapping:o}=N({predicate:()=>i,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:r,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});n.next(e=>(i&&this.snappingManager!=null&&this.snappingManager.doneSnapping(),e)).next(o),t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._processCursor(e.mapStart),(this.geometryType===`segment`||i&&!this.numCommittedVertices)&&this.commitStagedVertex()),e)).next(S(this.view,this.elevationInfo)).next(...a).next(e=>(i&&(this._processCursor(e.mapEnd),e.action===`end`&&this.commitStagedVertex()),e)).next(e=>(e.action===`end`&&(this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()),e))})}_createManipulatorDragPipelineFreehand(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.committableVertex??this._processCursor(e.mapStart),this.geometryType===`segment`&&this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this.complete()}return e})})}_createManipulatorDragPipelineHybrid(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),z),this._processCursor(e.mapStart),this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),this.removeHandles(z),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()}return e})})}get _drawAtFixedElevation(){let{constraintsEnabled:e,constraintZ:t,geometryType:n,numCommittedVertices:r}=this;return e?t!=null||n===`segment`&&r>0:(n===`segment`||n===`polygon`)&&r>0}_updateAndGetEffectiveDrawSurface(){let{constraintsEnabled:e,coordinateHelper:t,drawSurface:n,elevationDrawSurface:r,snapToSceneEnabled:i}=this;if(r==null)return n;if(!this.hasZ)return r.defaultZ=null,r;let a=this.elevationInfo?.mode,o=this.defaultZ,s=e||a===`absolute-height`;return i!=null&&(s=i),a===`on-the-ground`&&(s=!1),this._drawAtFixedElevation&&(o=(e?this.constraintZ:null)??t.getZ(this._activePart.vertices[0].pos),s=!1),s?n:(r.defaultZ=o,r)}_mapToScreen(e){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),this.drawingMode===`click`&&e.pointerType===`touch`&&this._snappingEnabled&&this._processCursor(e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if(!(e.pointerType===`mouse`&&e.button===2||this._manipulator.dragging))try{let{drawingMode:t,geometryType:n}=this;this._stagedPointerType=e.pointerType,this._stagedScreenPoint=e.screenPoint;let r=this._screenToMap(e.screenPoint);if(r==null||r==null||t===`freehand`&&n!==`point`&&n!==`multipoint`)return;if(this._snappingEnabled&&this.cursorVertex!=null||this._processCursor(r),this.committableVertex==null){this.complete();return}this.commitStagedVertex(),e.pointerType!==`mouse`&&this._processCursor(null),(t===`freehand`&&this.geometryType!==`multipoint`||n===`point`||n===`segment`&&this.numCommittedVertices===2||n===`segment`&&t===`hybrid`&&this.numCommittedVertices===1)&&this.complete()}finally{e.stopPropagation()}}_onImmediateDoubleClick(e){this._manipulator.dragging||this.geometryType===`point`||(this.complete(),e.stopPropagation())}_onPointerMove(e){let t=u(e.x,e.y);this._updatePointer(t,e.pointerId,e.pointerType)&&e.stopPropagation()}_updatePointer(e,t,n){return this._stagedScreenPoint=e,this._stagedPointerType=n,this._stagedPointerId=t,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(e,n),!0)}_onKeyboardBasedChange(){this._stagedPointerType!==`mouse`||!this._stagedScreenPoint||this._stagedPointerId==null||this._isDragging?this._snappingOperation.abort():this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType)}_processCursorMovementRelativeToSurface(e,t){let n=this._snappingOperation,r=this._screenToMap(e),i=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(r==null){this._hideDefaultCursor=!0,this._processCursor(null),n.abort();return}this._hideDefaultCursor=!1;let a=this.snappingManager;if(a==null){this._processCursor(r),n.abort();return}let s=this._getSnappingContext(t);this._updatingHandles.consumePromise(o(n.snap({point:r,scenePoint:i},a,s)))}_applyConstraints(e){let{_constraint:t,constraints:n}=this;if(!e||!n||!t)return e;let{context:r}=n,i=k(e,r),a=i?t.closestTo(i):void 0;if(!a)return e;let o=A(a,e,r),s=this.view.type===`2d`||r.elevationInfo.mode!==`absolute-height`;return o!=null&&s&&this.constraintZ!=null&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(e){return e?this._updateAndGetEffectiveDrawSurface()?.screenToMap(e):null}_screenToMapDragEventStep(){let e=null;return t=>{if(t.action===`start`&&(e=this._screenToMap(t.screenStart)),e==null)return null;let n=this._screenToMap(t.screenEnd);return n==null?null:{...t,mapStart:e,mapEnd:n}}}_vertexWithinPointerDistance(e,t){let n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return n!=null&&V(n,t,25)}_getSnappingContext(e){let t=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:t==null?null:{value:t,elevationInfo:this.elevationInfo},drawConstraints:this.constraints})}};e([d()],B.prototype,`_hideDefaultCursor`,void 0),e([d()],B.prototype,`_stagedPointerId`,void 0),e([d()],B.prototype,`_isDragging`,null),e([d()],B.prototype,`_snappingOperation`,void 0),e([d()],B.prototype,`_snappingEnabled`,null),e([d({constructOnly:!0})],B.prototype,`graphic`,void 0),e([d()],B.prototype,`constraintsEnabled`,void 0),e([d()],B.prototype,`constraints`,void 0),e([d()],B.prototype,`_constraint`,null),e([d()],B.prototype,`constraintZ`,void 0),e([d()],B.prototype,`defaultZ`,void 0),e([d()],B.prototype,`isDraped`,void 0),e([d({value:v})],B.prototype,`drawingMode`,null),e([d({constructOnly:!0})],B.prototype,`elevationDrawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`elevationInfo`,void 0),e([d({constructOnly:!0,type:j})],B.prototype,`labelOptions`,void 0),e([d({constructOnly:!0})],B.prototype,`geometryType`,void 0),e([d({constructOnly:!0})],B.prototype,`hasM`,void 0),e([d({constructOnly:!0})],B.prototype,`hasZ`,void 0),e([d()],B.prototype,`cursor`,void 0),e([d()],B.prototype,`effectiveCursor`,null),e([d()],B.prototype,`loading`,void 0),e([d({constructOnly:!0})],B.prototype,`manipulators`,void 0),e([d({constructOnly:!0})],B.prototype,`drawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`segmentLabels`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingManager`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingVisualizer`,void 0),e([d()],B.prototype,`snapToSceneEnabled`,void 0),e([d({readOnly:!0})],B.prototype,`cursorVertex`,null),e([d({readOnly:!0})],B.prototype,`visualizationCursorVertex`,null),e([d()],B.prototype,`committableVertex`,null),e([d()],B.prototype,`firstVertex`,void 0),e([d()],B.prototype,`lastVertex`,void 0),e([d()],B.prototype,`secondToLastVertex`,void 0),e([d()],B.prototype,`updating`,null),e([d({constructOnly:!0})],B.prototype,`view`,void 0),B=e([f(`esri.views.draw.DrawOperation`)],B);function V(e,t,n){let r=e.x-t.x,i=e.y-t.y;return r*r+i*i<=n}export{B as DrawOperation,I as defaultCursor,L as defaultLoadingCursor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{memoize as i}from"../../../core/memoize.js";import{ignoreAbortErrors as a}from"../../../core/promiseUtils.js";import{valueInUnit as o}from"../../../core/quantity.js";import{createScreenPoint as s}from"../../../core/screenUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{fromArray as u,create as d}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import p from"../../../geometry/Point.js";import{pointEquals as m}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{makeDehydratedPoint as h}from"../../../layers/graphics/dehydratedPoint.js";import{getZFromVertexSnappingCandidates as g}from"./drawUtils.js";import{getPolylineOrPolygonConstraint as _,getPointConstraint as v,pointToConstraintSpace as y,constraintSpaceToPoint as b}from"../../interactive/sketch/constraintUtils.js";import{SnappingContext as x}from"../../interactive/snapping/SnappingContext.js";import{SnappingOperation as S}from"../../interactive/snapping/SnappingOperation.js";let C=class extends t{constructor(e){super(e),this._snappingOperation=null,this.role=`primary`,this.captureMode=`capture-always`,this.defaultCaptureMode=`capture-always`,this.snappingEnabled=!0,this.selfSnappingEnabled=!0,this.editSession=null,this.outputMapPositionOfDragStart=null,this.selectedSnappingResult=null,this.screenPosition=null,this.inputMapPosition=null,this.drawToolDragging=!1,this.manipulatorDragging=!1,this.activePointerId=null,this.activePointerType=null,this._getSnappingContext=i((e,t,n,r,i,a)=>n?new x({elevationInfo:r,pointer:e,vertexHandle:t,editGeometryOperations:n,visualizer:i,suppressSelfSnapping:!a}):null)}destroy(){this._snappingOperation=r(this._snappingOperation)}get grabbable(){return this.captureMode===`grabbable-object`}get following(){let{captureMode:e}=this;return e===`capture-always`||e===`capture-when-engaged`}get outputMapPosition(){return this._get(`outputMapPosition`)}set outputMapPosition(e){let t=this._get(`outputMapPosition`);e&&t&&m(e,t)||this._set(`outputMapPosition`,e)}get dragging(){return this.drawToolDragging||this.manipulatorDragging}get firstPointZ(){let e=this.editSession?.lastPointAddedBySession;if(!e)return null;let t=this.editSession?.getInformationAboutPoint(0,e.partIndex);return t?.point.hasZ?t.point.z:null}async moveTo(e,t){let{snappingManager:n,skipSnapping:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t;this.notePointerActivity(t.pointerId,o);let l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t);e&&(this.screenPosition=e);let d=this.screenPosition;if(!d)return null;let f=this.firstPointZ,g=i?.screenToMap(d,{firstPointZ:f});if(this.inputMapPosition=g,this.selectedSnappingResult=null,!n||!g||!l||r||!this.snappingEnabled)return this.selectedSnappingResult=void 0,this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,g,t);let _=h(g.x,g.y,g.z,g?.spatialReference),v=i?.screenToScene?.(d,{firstPointZ:f}),y=u.snap({point:_,scenePoint:v},n,l),b=()=>{let e=u.stagedPoint;return m(this.selectedSnappingResult,e)||(this.selectedSnappingResult=e==null?null:new p({...e})),this.outputMapPosition=this._finalizeSnappingAndConstraintResult(this.selectedSnappingResult,g,t)};return b(),a(y.then(b))}async moveDeltaRelativeToScreen(e,t,n){let{inputMapPosition:r,screenPosition:i,firstPointZ:a}=this;if(!r)return null;let o=n.surfaceManager?n.surfaceManager.mapToScreen(r,{firstPointZ:a}):i;if(!o)return null;let c=s(o.x+e,o.y+t);return this.moveTo(c,n)}async noteDragStart(e,t){if(this.notePointerDown(t.pointerId,t.pointerType),this.drawToolDragging=!0,t.skipSnapping||!this.snappingEnabled)return null;let{snappingManager:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t,l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t),d=this.firstPointZ,f=i?.screenToMap(e,{firstPointZ:d});if(this.outputMapPositionOfDragStart=null,r&&l&&f){let o=u.snap({point:h(f.x,f.y,f.z,f?.spatialReference),scenePoint:i?.screenToScene?.(e,{firstPointZ:d})},r,l);return a(o.then(()=>{let e=u.stagedPoint?new p({...u.stagedPoint}):null;return this.outputMapPositionOfDragStart=this._finalizeSnappingAndConstraintResult(e,f,t)})).catch(e=>(n.getLogger(this).error(`drawtool:handle:snapping-failed`,e),null))}return this.outputMapPositionOfDragStart=f,null}async noteDragEnd(e,t){return this.moveTo(e,t).finally(()=>{this.drawToolDragging=!1,this.notePointerUp(t.pointerId,t.pointerType)})}notePointerActivity(e=null,t=null){t&&(this.activePointerType=t),e!=null&&this.dragging&&(this.activePointerId=e)}notePointerDown(e=null,t=null){e!=null&&(this.activePointerId=e),t&&(this.activePointerType=t)}notePointerUp(e=null,t=null){(e==null||this.activePointerId==null||this.activePointerId===e)&&(this.activePointerId=null),t&&this.activePointerType===t&&(this.activePointerType=null)}async moveDeltaRelativeToSketchSegment(e,t){let n=this.editSession?.endVertex?.leftSegment?.leftVertex?.pos,{firstPointZ:r}=this,i=this.inputMapPosition?t.surfaceManager?.mapToScreen(this.inputMapPosition,{firstPointZ:r})??this.screenPosition:this.screenPosition;if(!n||!i)return null;let a=t.editGeometryOperations?.data?.coordinateHelper.vectorToPoint(n);if(!a)return null;let o=t.surfaceManager?.mapToScreen(a,{firstPointZ:r});if(!o)return null;let s=[i.x-o.x,i.y-o.y],c=f(d(),u(s)),[l,p]=[c[0]*e,c[1]*e];return this.moveDeltaRelativeToScreen(l,p,t)}refreshConstraint(e){let t=this.outputMapPosition??this.inputMapPosition;return this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,t,e)}_finalizeSnappingAndConstraintResult(e,t,n){let r=e??t;r&&n.view.type===`2d`&&(r.z=g(n.snappingManager)??r.z);let i=(r?n.surfaceManager?.constrainZToEffectiveSurface?.(r):null)??r;return this._ensureZ(this._applyTooltipConstraints(i,n),n)}_applyTooltipConstraints(e,t){let n=e,r=t.tooltipManager?.getConstraints(this);if(!r&&!t.interactiveHandleManager?.customConstraints||!n)return n;let i=t.interactiveHandleManager?.customConstraints,a=t.editGeometryOperations?.data?.coordinateHelper;if(!a)return n;if(i&&this.editSession&&n){let e={handle:this,editSession:this.editSession,toScreen:e=>t.surfaceManager?.mapToScreen(e,{firstPointZ:this.firstPointZ})??null};for(let t of i)n=t(n,e)||n}let s=(this.editSession?.endVertex)?.leftSegment?.leftVertex,c=s?.leftSegment?.leftVertex,l=s&&a.vectorToPoint(s.pos),u=c&&a.vectorToPoint(c.pos);if(!r)return n;let d=(l||u)&&this.role===`primary`?_(l,u,r):v(r);if(!n||!r||!d)return n;let{context:f}=r,m=y(n,f),h=m?d.closestTo(m):void 0;if(!h)return n;let g=b(h,n,f),x=t.surfaceManager?.view?.type===`2d`||f.elevationInfo.mode!==`absolute-height`,S=r.elevation,{hasZ:C,metersPerVerticalUnit:w}=t.surfaceManager??{};return g!=null&&x&&S!=null&&C&&w&&(g.z=o(S,`meters`)/w),g?new p({x:g.x,y:g.y,z:g.z,hasM:g.hasM,hasZ:g.hasZ,m:g.m,spatialReference:g.spatialReference}):null}_ensureZ(e,t){return!e||!t.hasZ||(e.z==null||!e.hasZ)&&(e.z=t.defaultZ??0,e.hasZ=!0),e}_ensureSnappingOperation({view:e}){return this._snappingOperation??=new S({view:e})}};e([c()],C.prototype,`_snappingOperation`,void 0),e([c()],C.prototype,`role`,void 0),e([c()],C.prototype,`name`,void 0),e([c()],C.prototype,`captureMode`,void 0),e([c()],C.prototype,`defaultCaptureMode`,void 0),e([c()],C.prototype,`grabbable`,null),e([c()],C.prototype,`following`,null),e([c()],C.prototype,`snappingEnabled`,void 0),e([c()],C.prototype,`selfSnappingEnabled`,void 0),e([c()],C.prototype,`editSession`,void 0),e([c()],C.prototype,`outputMapPosition`,null),e([c()],C.prototype,`outputMapPositionOfDragStart`,void 0),e([c()],C.prototype,`selectedSnappingResult`,void 0),e([c()],C.prototype,`screenPosition`,void 0),e([c()],C.prototype,`inputMapPosition`,void 0),e([c()],C.prototype,`dragging`,null),e([c()],C.prototype,`drawToolDragging`,void 0),e([c()],C.prototype,`manipulatorDragging`,void 0),e([c()],C.prototype,`activePointerId`,void 0),e([c()],C.prototype,`activePointerType`,void 0),e([c({readOnly:!0})],C.prototype,`firstPointZ`,null),C=e([l(`esri.views.draw.support.InteractiveHandle`)],C);export{C as InteractiveHandle};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{memoize as i}from"../../../core/memoize.js";import{ignoreAbortErrors as a}from"../../../core/promiseUtils.js";import{valueInUnit as o}from"../../../core/quantity.js";import{createScreenPoint as s}from"../../../core/screenUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{fromArray as u,create as d}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import p from"../../../geometry/Point.js";import{pointEquals as m}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{makeDehydratedPoint as h}from"../../../layers/graphics/dehydratedPoint.js";import{getZFromVertexSnappingCandidates as g}from"./drawUtils.js";import{getPolylineOrPolygonConstraint as _,getPointConstraint as v,pointToConstraintSpace as y,constraintSpaceToPoint as b}from"../../interactive/sketch/constraintUtils.js";import{SnappingContext as x}from"../../interactive/snapping/SnappingContext.js";import{SnappingOperation as S}from"../../interactive/snapping/SnappingOperation.js";let C=class extends t{constructor(e){super(e),this._snappingOperation=null,this.role=`primary`,this.captureMode=`capture-always`,this.defaultCaptureMode=`capture-always`,this.snappingEnabled=!0,this.selfSnappingEnabled=!0,this.editSession=null,this.outputMapPositionOfDragStart=null,this.selectedSnappingResult=null,this.screenPosition=null,this.inputMapPosition=null,this.drawToolDragging=!1,this.manipulatorDragging=!1,this.activePointerId=null,this.activePointerType=null,this._getSnappingContext=i((e,t,n,r,i,a)=>n?new x({elevationInfo:r,pointer:e,vertexHandle:t,editGeometryOperations:n,visualizer:i,suppressSelfSnapping:!a}):null)}destroy(){this._snappingOperation=r(this._snappingOperation)}get grabbable(){return this.captureMode===`grabbable-object`}get following(){let{captureMode:e}=this;return e===`capture-always`||e===`capture-when-engaged`}get outputMapPosition(){return this._get(`outputMapPosition`)}set outputMapPosition(e){let t=this._get(`outputMapPosition`);e&&t&&m(e,t)||this._set(`outputMapPosition`,e)}get dragging(){return this.drawToolDragging||this.manipulatorDragging}get firstPointZ(){let e=this.editSession?.lastPointAddedBySession;if(!e)return null;let t=this.editSession?.getInformationAboutPoint(0,e.partIndex);return t?.point.hasZ?t.point.z:null}async moveTo(e,t){let{snappingManager:n,skipSnapping:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t;this.notePointerActivity(t.pointerId,o);let l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t);e&&(this.screenPosition=e);let d=this.screenPosition;if(!d)return null;let f=this.firstPointZ,g=i?.screenToMap(d,{firstPointZ:f});if(this.inputMapPosition=g,this.selectedSnappingResult=null,!n||!g||!l||r||!this.snappingEnabled)return this.selectedSnappingResult=void 0,this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,g,t);let _=h(g.x,g.y,g.z,g?.spatialReference),v=i?.screenToScene?.(d,{firstPointZ:f}),y=u.snap({point:_,scenePoint:v},n,l),b=()=>{let e=u.stagedPoint;return m(this.selectedSnappingResult,e)||(this.selectedSnappingResult=e==null?null:new p({...e})),this.outputMapPosition=this._finalizeSnappingAndConstraintResult(this.selectedSnappingResult,g,t)};return b(),a(y.then(b))}async moveDeltaRelativeToScreen(e,t,n){let{inputMapPosition:r,screenPosition:i,firstPointZ:a}=this;if(!r)return null;let o=n.surfaceManager?n.surfaceManager.mapToScreen(r,{firstPointZ:a}):i;if(!o)return null;let c=s(o.x+e,o.y+t);return this.moveTo(c,n)}async noteDragStart(e,t){if(this.notePointerDown(t.pointerId,t.pointerType),this.drawToolDragging=!0,t.skipSnapping||!this.snappingEnabled)return null;let{snappingManager:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t,l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t),d=this.firstPointZ,f=i?.screenToMap(e,{firstPointZ:d});if(this.outputMapPositionOfDragStart=null,r&&l&&f){let o=u.snap({point:h(f.x,f.y,f.z,f?.spatialReference),scenePoint:i?.screenToScene?.(e,{firstPointZ:d})},r,l);return a(o.then(()=>{let e=u.stagedPoint?new p({...u.stagedPoint}):null;return this.outputMapPositionOfDragStart=this._finalizeSnappingAndConstraintResult(e,f,t)})).catch(e=>(n.getLogger(this).error(`drawtool:handle:snapping-failed`,e),null))}return this.outputMapPositionOfDragStart=f,null}async noteDragEnd(e,t){return this.moveTo(e,t).finally(()=>{this.drawToolDragging=!1,this.notePointerUp(t.pointerId,t.pointerType)})}notePointerActivity(e=null,t=null){t&&(this.activePointerType=t),e!=null&&this.dragging&&(this.activePointerId=e)}notePointerDown(e=null,t=null){e!=null&&(this.activePointerId=e),t&&(this.activePointerType=t)}notePointerUp(e=null,t=null){(e==null||this.activePointerId==null||this.activePointerId===e)&&(this.activePointerId=null),t&&this.activePointerType===t&&(this.activePointerType=null)}async moveDeltaRelativeToSketchSegment(e,t){let n=this.editSession?.endVertex?.leftSegment?.leftVertex?.pos,{firstPointZ:r}=this,i=this.inputMapPosition?t.surfaceManager?.mapToScreen(this.inputMapPosition,{firstPointZ:r})??this.screenPosition:this.screenPosition;if(!n||!i)return null;let a=t.editGeometryOperations?.data?.coordinateHelper.vectorToPoint(n);if(!a)return null;let o=t.surfaceManager?.mapToScreen(a,{firstPointZ:r});if(!o)return null;let s=[i.x-o.x,i.y-o.y],c=f(d(),u(s)),[l,p]=[c[0]*e,c[1]*e];return this.moveDeltaRelativeToScreen(l,p,t)}refreshConstraint(e){let t=this.outputMapPosition??this.inputMapPosition;return this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,t,e)}_finalizeSnappingAndConstraintResult(e,t,n){let r=e??t;r&&n.view.type===`2d`&&(r.z=g(n.snappingManager)??r.z);let i=(r?n.surfaceManager?.constrainZToEffectiveSurface?.(r):null)??r;return this._ensureZ(this._applyTooltipConstraints(i,n),n)}_applyTooltipConstraints(e,t){let n=e,r=t.tooltipManager?.getConstraints(this);if(!r&&!t.interactiveHandleManager?.customConstraints||!n)return n;let i=t.interactiveHandleManager?.customConstraints,a=t.editGeometryOperations?.data?.coordinateHelper;if(!a)return n;if(i&&this.editSession&&n){let e={handle:this,editSession:this.editSession,toScreen:e=>t.surfaceManager?.mapToScreen(e,{firstPointZ:this.firstPointZ})??null};for(let t of i)n=t(n,e)||n}let s=(this.editSession?.endVertex)?.leftSegment?.leftVertex,c=s?.leftSegment?.leftVertex,l=s&&a.vectorToPoint(s.pos),u=c&&a.vectorToPoint(c.pos);if(!r)return n;let d=(l||u)&&this.role===`primary`?_(l,u,r):v(r);if(!n||!r||!d)return n;let{context:f}=r,m=y(n,f),h=m?d.closestTo(m):void 0;if(!h)return n;let g=b(h,n,f),x=t.surfaceManager?.view?.type===`2d`||f.elevationInfo.mode!==`absolute-height`,S=r.elevation,{hasZ:C,metersPerVerticalUnit:w}=t.surfaceManager??{};return g!=null&&x&&S!=null&&C&&w&&(g.z=o(S,`meters`)/w),g?new p({x:g.x,y:g.y,z:g.z,hasM:g.hasM,hasZ:g.hasZ,m:g.m,spatialReference:g.spatialReference}):null}_ensureZ(e,t){return!e||!t.hasZ||e.z!=null&&e.hasZ||(e.z=t.defaultZ??0,e.hasZ=!0),e}_ensureSnappingOperation({view:e}){return this._snappingOperation??=new S({view:e})}};e([c()],C.prototype,`_snappingOperation`,void 0),e([c()],C.prototype,`role`,void 0),e([c()],C.prototype,`name`,void 0),e([c()],C.prototype,`captureMode`,void 0),e([c()],C.prototype,`defaultCaptureMode`,void 0),e([c()],C.prototype,`grabbable`,null),e([c()],C.prototype,`following`,null),e([c()],C.prototype,`snappingEnabled`,void 0),e([c()],C.prototype,`selfSnappingEnabled`,void 0),e([c()],C.prototype,`editSession`,void 0),e([c()],C.prototype,`outputMapPosition`,null),e([c()],C.prototype,`outputMapPositionOfDragStart`,void 0),e([c()],C.prototype,`selectedSnappingResult`,void 0),e([c()],C.prototype,`screenPosition`,void 0),e([c()],C.prototype,`inputMapPosition`,void 0),e([c()],C.prototype,`dragging`,null),e([c()],C.prototype,`drawToolDragging`,void 0),e([c()],C.prototype,`manipulatorDragging`,void 0),e([c()],C.prototype,`activePointerId`,void 0),e([c()],C.prototype,`activePointerType`,void 0),e([c({readOnly:!0})],C.prototype,`firstPointZ`,null),C=e([l(`esri.views.draw.support.InteractiveHandle`)],C);export{C as InteractiveHandle};
@@ -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{createTask as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import o from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l,assertIsSome as u}from"../../../core/maybe.js";import{throwIfAborted as d}from"../../../core/promiseUtils.js";import{pausable as f,when as p,watch as m,initial as h,sync as g}from"../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import b from"../../../geometry/Point.js";import x from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{isPoint as T}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as E}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as D}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as O,getEndpoint as k,isCircularArc as A,isEllipticArc4 as j,isBezierCurve as M,isCoordinate as N,cloneCurve as ee,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as F}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{normalizeEllipticArcAfterEndpointChange as I}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{wrapAtan2 as te}from"../../../geometry/support/curves/mathUtils.js";import ne from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as re}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as ie}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as ae,getZFromVertexSnappingCandidates as oe,cloneMove as se}from"./drawUtils.js";import ce from"./GraphicMover.js";import le from"./HighlightHelper.js";import{addUniqueLayer as ue,isConnectedReshapeSupportedLayer as de}from"./layerUtils.js";import{createTooltipInfos as fe,connectTooltip as pe,updateTranslateTooltipInfo as me,updateTranslateVertexTooltipInfo as he}from"./reshapeTooltipUtils.js";import{defaultSymbols as ge,createMidpointGraphics as _e,createVertexGraphics as L,createCurveControlPointGraphics as ve,createCurveConstructionLineGraphics as ye,attributeKeys as R,getMidpoint as z,controlPointKinds as B,fastCloneGeometry as V,saveUpdatedCurveOrCoordinate as H,toolIdAttribute as be,splitCurve as xe,isSingleSegmentCircle as Se,isSingleSegmentEllipse as Ce}from"./reshapeUtils.js";import{ViewEventPriorities as we}from"../../input/InputManager.js";import{createCoordinateHelper as Te}from"../../interactive/coordinateHelper.js";import{sketchKeys as Ee}from"../../interactive/keybindings.js";import{EditGeometryOperations as De}from"../../interactive/editGeometry/EditGeometryOperations.js";import Oe from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as ke}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as Ae,enterInputModeIfAvailable as je}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Me}from"../../support/GeometryWorkerHandle.js";const U=Symbol(),W={mode:`on-the-ground`,offset:0};let G=class extends a{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new y,this._measurementWorker=new Me({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=ge,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new Oe,this.type=`reshape`,this.vertexGraphics=new r,this.curveControlPointGraphics=new r,this.constructionLineGraphics=new r,this.midpointGraphics=new r,this.selectedManipulators=new r,this.view=null}initialize(){let e=this.view;this._highlightHelper=new le({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=f(()=>this.graphic?.geometry,e=>{if(!e||this._primaryGraphicMoving===!0)return;let t=new Set(this.selectedManipulators.map(Q));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e)),this.curveControlPointGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e));let{enableMovement:n,_mover:r,graphic:i,midpointGraphics:a,vertexGraphics:o,curveControlPointGraphics:s}=this,c=o.concat(a,s).toArray();n&&c.push(i),r?.set(`graphics`,c)},g),this.tooltip=Ae(()=>({view:e,options:this.toolOptions.tooltips})),this.tooltipInfos=fe(this.toolOptions),this.addHandles([p(()=>e?.ready,()=>{let{layer:e,view:t}=this;ue(t,e),this.addHandles(t.on(`key-down`,e=>this._keyDownHandler(e),we.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[m(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],m(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),pe(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),m(()=>this.toolOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),h),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=c(this._mover),this._connectedReshapeManager=c(this._connectedReshapeManager),this.tooltip=c(this.tooltip),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._updatingHandles=c(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??Te(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return this.view?.type===`2d`&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return this.selectedManipulators.length===1?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){let{toolOptions:e,activeTooltipInfo:t,graphic:n}=this;return{toolOptions:e,activeTooltipInfo:t,graphic:n,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(e,t,n,r,i)=>{this._setUpGeometryHelper();let a=e===this.graphic;if(a?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e),this._syncGeometryAfterVertexMove(e,t,r,i,!0),a){let{view:e}=this,r=e.toScreen(n),i=e.toScreen(t),a=(i?.x??0)-(r?.x??0),o=(i?.y??0)-(r?.y??0);this._emitMoveEvent(a,o),this._emitMoveStopEvent(a,o)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e)}}}get state(){let e=this.view.ready,t=!!(this.graphic&&this.layer);return e&&t?`active`:e?`ready`:`disabled`}get updating(){return!!this._updatingHandles?.updating||!!this._connectedReshapeManager?.updating||!!this._segmentLabels?.updating||!!this.snappingManager?.updating}isUIGraphic(e){return e===this.graphic||this._isMidpoint(e)||this._isCurveControlPoint(e)||this._isVertex(e)||this._isConstructionLine(e)}refresh(e){if(this._reset(),this._setup(),e){for(let t of this.vertexGraphics)e.has(Q(t))&&this._addToSelection(t);for(let t of this.curveControlPointGraphics)e.has(Q(t))&&this._addToSelection(t)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){let{selectedManipulators:e}=this;e.length&&this._removeVertices(e)}_setup(){let{graphic:e,layer:t}=this;if(!t||e?.geometry==null)return;let n=e.geometry;n.type===`mesh`||n.type===`extent`?this._logGeometryTypeError():(n.type===`polygon`&&S(n),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper())}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){let e=this.graphic.geometry;e==null||e.type===`mesh`||e.type===`extent`?(this._segmentLabels=c(this._segmentLabels),this._logGeometryTypeError()):(this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=De.fromGeometry(e,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels()))}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new ne({listMode:`hide`,internal:!0,title:`Reshape snapping layer`}),this.view.map.layers.add(this._snappingGraphicsLayer);let n=this._editGeometryOperations;u(n),this._snappingContext=new ke({editGeometryOperations:n,elevationInfo:W,pointer:t.viewEvent?.pointerType||`mouse`,excludeFeature:this.graphic,feature:this.graphic,visualizer:new re(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._activeOperationInfo=null,this._mover=c(this._mover),this.removeHandles(U),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),c(this._snappingGraphicsLayer)),this._snappingTask=l(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._removeCurveGraphics(e),this._updateTooltip()}_removeMidpointGraphics(e=this.layer){let{midpointGraphics:t}=this;e?.removeMany(t.items),t.drain(c)}_removeVertexGraphics(e=this.layer){let{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(c)}_removeCurveGraphics(e=this.layer){let{curveControlPointGraphics:t,constructionLineGraphics:n}=this;e?.removeMany(t.items),e?.removeMany(n.items),t.drain(c),n.drain(c)}_setupGraphics(){let e=this.graphic.geometry;if(e!=null&&(e.type===`polyline`||e.type===`polygon`||e.type===`multipoint`)){let t=K(e);this.enableMidpoints&&e.type!==`multipoint`&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();let t=_e(e,this.symbols,this._coordinateHelper,this.graphic.geometry?.type===`polygon`,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){let t=L(e,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=t.graphicIndex,this.vertexGraphics.addMany(t.graphics),this.layer.addMany(t.graphics)}else{let t=L(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();let t=ve(e,this.symbols,this._coordinateHelper),n=ye(e,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(t),this.constructionLineGraphics.addMany(n),this.layer.addMany(n),this.layer.addMany(t)}async _setupSegmentLabels(){let e=this._editGeometryOperations,t=this.toolOptions.labels.enabled;if((!e||this._segmentLabels?.context?.editGeometryOperations!==e||!t)&&(this._segmentLabels=c(this._segmentLabels)),!this._segmentLabels&&e&&t){let t=this._segmentLabelsImportTask??=n(async e=>{let t=import(`../../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:n}=await this._updatingHandles.addPromise(t);return e.aborted?null:n}),r=await this._updatingHandles.addPromise(t.promise);if(!r)return;this._segmentLabels=c(this._segmentLabels),this._segmentLabels=new r({context:{view:this.view,editGeometryOperations:e,elevationInfo:W,labelOptions:this.toolOptions.labels},visible:!0})}}_updateSymbolsForTheme(){let e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set(`color`,e),hover:this.symbols.vertices.hover?.clone().set(`color`,e)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set(`color`,e),hover:this.symbols.controlPoints.hover?.clone().set(`color`,e)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set(`color`,e)};for(let e of this.vertexGraphics)e.symbol=this._isSelected(e)?this.symbols.vertices.selected:this._hoverGraphic===e?this.symbols.vertices.hover:this.symbols.vertices.default;for(let e of this.curveControlPointGraphics)e.symbol=this._isSelected(e)?this.symbols.controlPoints.selected:this._hoverGraphic===e?this.symbols.controlPoints.hover:this.symbols.controlPoints.default;for(let e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){let e=this.vertexGraphics.items;if(!e)return;let t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let n=0;n<t.length;n++){let r=[];for(let e=0;e<t.length;e++){if(n===e)continue;let i=t[n],a=t[e];i.x===a.x&&i.y===a.y&&r.push(e)}e[n].attributes[R.relatedGraphicIndices]=r}}_setupMover(){let{enableMovement:e,graphic:t,midpointGraphics:n,vertexGraphics:r,view:i}=this,a=r.concat(n,this.curveControlPointGraphics).toArray();e&&t.geometry?.type!==`multipoint`&&a.push(t),this._mover=new ce({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:a,view:i,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_setupConnectedReshapeManager(){let{connectedReshapeProviders:e}=this;e!=null&&e.length!==0&&(this._connectedReshapeManager??=new ie({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();let t=e.graphic,n=this._isCurveControlPoint(t);if(t===this.graphic)this.clearSelection(),this.emit(`graphic-click`,e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(e.viewEvent.button===2)return;let n=this.graphic.clone(),r=this._handleMidpointClickOrStartMove(e);this.refresh(),r.length&&this._emitVertexAddEvent([t],n,r)}else if(this._isVertex(t)||n){if(e.viewEvent.stopPropagation(),e.viewEvent.button===2){n||this._removeVertices(t);return}e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){let{graphic:t,dx:n,dy:r}=e,i=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:i?`move`:`reshape`,totalDx:n,totalDy:r}}_onGraphicMoveStartCallback(e){let{dx:t,dy:n,graphic:r}=e,i=this._connectedReshapeManager,a=i?Fe(this.graphic):null;if(r===this.graphic){let{geometry:o}=r;this._primaryGraphicMoving=!0,this._setUpOperation(e),this._emitMoveStartEvent(t,n),a&&i?.startFeatureMove([a]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),o!=null&&o.type===`point`&&this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,n)});return}let{selectedManipulators:o}=this;if(!o.includes(r)){if(this._clearSelection(),this._isMidpoint(r)){let t=this.graphic.clone(),n=this._handleMidpointClickOrStartMove(e);n.length&&(this._emitVertexAddEvent([r],t,n),this._refreshGraphicIndicesAttributes(n[0]))}this._addToSelection(r)}if(this._setUpOperation(e),a){let e=o.filter(e=>this._isVertex(e));i?.startVertexMove(a,Ie(e))}this._emitReshapeStartEvent(r),this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(r,e.viewEvent),this._emitReshapeEvent(r)})}_onGraphicMoveCallback(e){let t=this._activeOperationInfo;if(!t)return;let{dx:n,dy:r,graphic:i}=e;t.totalDx+=n,t.totalDy+=r;let{operationType:a}=t,{geometry:o}=i;if(o!=null){if(a===`move`){if(o.type===`point`)this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)});else if(o.type===`polyline`||o.type===`polygon`){let{dxMap:t,dyMap:i}=ae(n,r,this.view);if(!this._effectiveFilterVerticesEnabled){let e=K(o);this._updateVertexGraphicLocations(e)}else if(this.selectedManipulators.length>0){let e=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(let t of e){if(t.geometry?.type===`point`){let{pathIndex:e,pointIndex:n}=t.attributes,r=O(o)[e][n];if(r){let e=k(r);t.geometry=this._coordinateHelper.arrayToPoint(e)}}this._addToSelection(t.clone())}}this._connectedReshapeManager?.translate(t,i,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)}this._syncEditGeometryOperations(o)}else this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(i,e.viewEvent),this._emitReshapeEvent(i)})}}_onGraphicMoveStopCallback(e){let t=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!t)return;let{dx:n,dy:r,graphic:i,x:a,y:o}=e,{operationType:s}=t;t.totalDx+=n,t.totalDy+=r,this._onHandleMove(i,n,r,e,()=>this._handleVertexSnap(i,{x:a,y:o},s))}_afterMoveStop(e,t){if(this._effectiveFilterVerticesEnabled&&t===`move`){let e=new Set;for(let t of this.selectedManipulators)e.add(Q(t));this.refresh(e),this._updateTooltip()}else this._isMidpoint(e)||e.getAttribute(R.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,r){let i=e.geometry,a=this.snappingManager?.getVertexCandidates(),o=this.callbacks.onVertexSnap,s=()=>r===`move`?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);!o||!i||!T(i)||!a||a.length===0?(s(),this._afterMoveStop(e,r)):(l(this._snappingTask),this._snappingTask=n(async n=>{try{let r=await o(i,t,a);d(n);let s=w(r);this._coordinateHelper.hasZ()||(s.z=void 0),this._syncGeometryAfterVertexMove(e,s,0,0),e.geometry=s}finally{s(),this._afterMoveStop(e,r)}}))}_updateVertexGraphicLocations(e){let{_coordinateHelper:t}=this;for(let n of this.vertexGraphics){let{pathIndex:r,pointIndex:i}=n.attributes;n.geometry=t.arrayToPoint(k(e[r][i]))}this._updateMidpointGraphicLocations(e),this._updateCurveGraphicLocations(e)}_updateMidpointGraphicLocations(e,t){let{_coordinateHelper:n}=this;if(t)for(let r of this.midpointGraphics){let{pathIndex:i,pointIndexStart:a,pointIndexEnd:o}=r.attributes;if(!t.has(i))continue;let s=t.get(i);if(!s.has(a)&&!s.has(o))continue;let c=e[i];r.geometry=new b(z(c[a],c[o],n))}else for(let t of this.midpointGraphics){let{pathIndex:r,pointIndexStart:i,pointIndexEnd:a}=t.attributes,o=e[r];t.geometry=new b(z(o[i],o[a],n))}}_updateCurveGraphicLocations(e){let{spatialReference:t}=this._coordinateHelper,n=new Map;for(let e of this.selectedManipulators){let[t,r]=Z(e);t!=null&&r!=null&&e.getAttribute(R.controlPointKind)&&s(n,t,()=>new Set)?.add(r)}for(let t of this.curveControlPointGraphics){let[r,i]=Z(t);if(n.get(r)?.has(i))continue;let a=e[r][i];if(A(a)||j(a)){let n=k(e[r][i-1]),o=A(a)?D(n,a):F(n,a),[s,c]=E(o,.25);t.geometry=new b({x:s,y:c,spatialReference:this._coordinateHelper.spatialReference})}else if(M(a)){let[e,n]=t.getAttribute(R.controlPointKind)===B.bezier.cp1?a.b[1]:a.b[2];t.geometry=new b({x:e,y:n,spatialReference:this._coordinateHelper.spatialReference})}}for(let n of this.constructionLineGraphics){let r=n.getAttribute(R.controlPointKind),[i,a]=Z(n),o=e[i],s=k(o[a-1]),c=k(o[a]),l=e[i][a];n.geometry=r===B.bezier.line1?new x({paths:[[[s[0],s[1]],[...l.b[1]]]],spatialReference:t}):new x({paths:[[[c[0],c[1]],[...l.b[2]]]],spatialReference:t})}}_refreshGraphicIndicesAttributes(e){let{componentIndex:t,vertexIndex:n}=e,r=e=>{let[r,i]=Z(e);r===t&&i>=n&&e.setAttribute(R.pointIndex,i+1)};this.vertexGraphics.forEach(r),this.curveControlPointGraphics.forEach(r),this.constructionLineGraphics.forEach(r);for(let e of this.midpointGraphics){if(e.getAttribute(R.pathIndex)!==t)continue;let r=e.getAttribute(R.pointIndexStart);r>=n&&(e.setAttribute(R.pointIndexStart,r+1),e.setAttribute(R.pointIndexEnd,e.getAttribute(R.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){let[t,n]=Z(e);return u(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[n]}_onHandleMove(e,t,r,i,a){l(this._snappingTask);let o=this._snappingContext;if(!o)return;let s=e.geometry,c=i.type===`graphic-move-stop`;if(!s||!T(s))a();else if(this.snappingManager!=null&&this.selectedManipulators.length<2&&!c){let i=this.snappingManager;this._stagedVertex=i.update({point:s,context:o}),this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a(),this._snappingTask=n(async n=>{let l=await i.snap({point:s,context:o,signal:n});if(l.valid){let n=l.apply();n.z=this._coordinateHelper.hasZ()?oe(this.snappingManager)??n.z:void 0,this._stagedVertex=n,this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{let n=this._stagedVertex==null?s:new b(this._stagedVertex);this._syncGeometryAfterVertexMove(e,n,t,r,c),a()}}_syncGeometryAfterVertexMove(e,t,n,r,i=!1){let a=V(this._editGeometryOperations?.data.geometry);if(!a)return;let{_coordinateHelper:o}=this,s=o.pointToVector(t),c=this._getVertexFromEditGeometry(e),l=null;if(c){let e=o.getZ(s);l=[c.pos[0],c.pos[1]];let t=s[0]-c.pos[0],n=s[1]-c.pos[1],r=e==null?0:e-c.pos[2];(a.type===`point`||a.type===`mesh`)&&this._editGeometryOperations?.moveVertices([c],t,n,r),this._connectedReshapeManager?.translate(t,n,r)}if(a.type===`point`)e.geometry=t;else if(a.type===`mesh`)e.geometry=a.centerAt(t);else{if(e!==this.graphic){l&&!this._isVertex(e)&&(l=null);let[i,s]=Z(e),c=q(a),u=o.pointToArray(t);if(this._updateGeometryFromGraphic(e,c,i,s,u,a.type===`polygon`),this._isVertex(e)||this._isCurveControlPoint(e)){let t=new Map;t.set(i,new Set([s])),c=this._moveRelatedCoordinates(c,e,u,t,l),c=this._moveSelectedHandleCoordinates(c,e,n,r,a.type===`polygon`),this._updateMidpointGraphicLocations(c,t),this._updateCurveGraphicLocations(c)}else this._isMidpoint(e)&&this._updateCurveGraphicLocations(c);H(a,c)}this._updateGraphicGeometry(a),this._syncEditGeometryOperations(a),i&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_syncEditGeometryOperations(e){this._editGeometryOperations?.trySetGeometry(e)||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(e,t,n,r,i){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&i){let a=this._relatedGraphicIndex.search({minX:i[0],maxX:i[0],minY:i[1],maxY:i[1]});for(let o of a)o.coordinate[0]===i[0]&&o.coordinate[1]===i[1]&&o.graphic&&(r&&s(r,o.pathIndex,()=>new Set).add(o.pointIndex),X(e,o.pathIndex,o.pointIndex,n),this._relatedGraphicIndex.remove(o),o.coordinate[0]=t.geometry.x,o.coordinate[1]=t.geometry.y,o.graphic.geometry=t.geometry,this._relatedGraphicIndex.insert(o));return e}let{relatedGraphicIndices:a}=t.attributes;if(!a?.length)return e;for(let i of a){let a=this.vertexGraphics.at(i),[o,c]=Z(a);r&&s(r,o,()=>new Set).add(c),X(e,o,c,n),a.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,n,r,i){for(let a of this.selectedManipulators)if(a!==t){let[t,o]=Z(a),s=a.getAttribute(R.relatedGraphicIndices),c=se(a.geometry,n,r,this.view),l=C(c);if(a.geometry=c,this._updateGeometryFromGraphic(a,e,t,o,l,i),s?.length)for(let t of s){let n=this.vertexGraphics.at(t),[r,i]=Z(n);X(e,r,i,l),n.geometry=c}}return e}_updateGeometryFromGraphic(e,t,n,r,i,a){let o=t[n].length-1;this._isCurveControlPoint(e)?Pe(t,n,r,[i[0],i[1]],e.getAttribute(R.controlPointKind)):(X(t,n,r,i),a&&(r===0?X(t,n,o,i):r===o&&(t[n][0]=i)))}_onGraphicPointerOverCallback(e){let t=e.graphic;this._hoverGraphic=t;let n=this._isVertex(t);n&&!this._isSelected(t)?t.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.hover),this._updateTooltip(n?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){let t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.default),this.removeHandles(U),this._updateTooltip()}_handleMidpointClickOrStartMove(e){let{graphic:t}=e,n=this.graphic.geometry;if(n==null||n.type!==`polygon`&&n.type!==`polyline`)return[];let r=V(n),i=[],{[R.pathIndex]:a,[R.pointIndexStart]:o,[R.pointIndexEnd]:s}=t.attributes,c=C(t.geometry),l=s===0?o+1:s;t.attributes={[R.tool]:be,[R.pathIndex]:a,[R.pointIndex]:l,[R.relatedGraphicIndices]:[]};let u=q(r),d=u[a][s];if(N(d)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){let e=k(u[a][l]);u[a].splice(l,1,{c:[e,[c[0],c[1]]]}),t.setAttribute(R.controlPointKind,B.circle.interior),t.setAttribute(R.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),H(r,u)}else u[a].splice(l,0,c),i.push({coordinates:u[a][l],componentIndex:a,vertexIndex:l})}else{let e=k(u[a][o]),t=xe(e,d,.5,this._coordinateHelper);u[a].splice(s,1,...t),i.push({coordinates:k(u[a][l]),componentIndex:a,vertexIndex:l})}return this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),i}_addToSelection(e){let t=$(e);for(let e of t)e.symbol=this._isCurveControlPoint(e)?this.symbols.controlPoints.selected:this.symbols.vertices.selected,this.selectedManipulators.add(e),this._updateTooltip(e);this._emitSelectEvent(t)}_removeFromSelection(e,t){if(this._isVertex(e)){let{vertices:n}=this.symbols;e.symbol=t?n.hover:n.default}else if(this._isCurveControlPoint(e)){let{controlPoints:n}=this.symbols;e.symbol=t?n.hover:n.default}this.selectedManipulators.remove(e),this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){let e=this.selectedManipulators.toArray(),{controlPoints:t,vertices:n}=this.symbols;if(e.length>0){for(let r of e)this._isVertex(r)?r.symbol=n.default:this._isCurveControlPoint(r)&&(r.symbol=t.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){this._activeOperationInfo==null&&je(e,this.tooltip)||Ee.delete.includes(e.key)&&!e.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),e.stopPropagation())}_removeVertices(e){let t=this.graphic.geometry,n=this.vertexGraphics.length;if(t==null||t.type!==`polygon`&&t.type!==`polyline`&&t.type!==`multipoint`||t.type===`polygon`&&n<4||t.type===`multipoint`&&n<2||t.type===`polyline`&&n<3)return;let r=this.graphic.clone(),i=V(t),a=q(i),o=[],s=$(e);for(let e of s){if(this._isCurveControlPoint(e))continue;let{x:t,y:n}=e.geometry;for(let e=0;e<a.length;e++){let r=a[e];for(let i=0;i<r.length;i++){let[s,c]=k(r[i]);if(t===s&&n===c){o.push({coordinates:k(a[e][i]),componentIndex:e,vertexIndex:i}),a[e].splice(Number(i),1);let t=a[e][i];t&&!N(t)&&(a[e][i]=k(t))}}}}if(i.type===`polygon`)a=a.filter(e=>{if(e.length<2)return!1;let[t,n]=k(e[0]),[r,i]=k(e[e.length-1]);return e.length===2&&t===r&&n===i?!1:((t!==r||n!==i)&&e.push(e[0]),!0)});else if(i.type===`polyline`)for(let e of a)e.length===1&&a.splice(a.indexOf(e),1);H(i,a),this._updateGraphicGeometry(i),this.refresh(),this._emitVertexRemoveEvent(s,r,o)}_isVertex(e){return this.vertexGraphics.includes(e)}_isCurveControlPoint(e){return this.curveControlPointGraphics.includes(e)}_isConstructionLine(e){return this.constructionLineGraphics.includes(e)}_isSelected(e){return(this._isVertex(e)||this.curveControlPointGraphics.includes(e))&&this.selectedManipulators.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){let t=this._isMidpoint(e)?`copy`:`move`;this.addHandles(this.view.acquireCursor(t,`high`),U)}_updateTooltip(e,t){let n=null,{graphic:r,view:i,tooltipInfos:a}=this,o=r?.geometry;o?.type===`point`?n=a.movePoint:this._selectedManipulator?n=a.selectedVertex:e===this.graphic?(n=a.translateGraphic,me(n,i,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(n=a.translateVertices,he(n,i,o,this._tooltipsContext,this._updatingHandles,t)),this.activeTooltipInfo=n}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){let n={type:`move-start`,mover:this.graphic,dx:e,dy:t};this.emit(`move-start`,n),this.callbacks.onMoveStart?.(n)}_emitMoveEvent(e,t){let n={type:`move`,mover:this.graphic,dx:e,dy:t};this.emit(`move`,n),this.callbacks.onMove?.(n)}_emitMoveStopEvent(e,t){if(e==null||t==null){let n=this._activeOperationInfo;if(!n)return;e=n.totalDx,t=n.totalDy}let n={type:`move-stop`,mover:this.graphic,dx:e,dy:t};this.emit(`move-stop`,n),this.callbacks.onMoveStop?.(n)}_emitReshapeStartEvent(e){let t={type:`reshape-start`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-start`,t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){let t={type:`reshape`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape`,t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){let t={type:`reshape-stop`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-stop`,t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){let t={type:`vertex-select`,added:e};this.emit(`select`,t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){let t={type:`vertex-deselect`,removed:e};this.emit(`deselect`,t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,n){let r={type:`vertex-add`,added:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-add`,r),this.callbacks.onVertexAdd?.(r)}_emitVertexRemoveEvent(e,t,n){let r={type:`vertex-remove`,removed:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-remove`,r),this.callbacks.onVertexRemove?.(r)}_logGeometryTypeError(){o.getLogger(this).error(new i(`reshape:invalid-geometry`,`Reshape operation not supported for the provided graphic. The geometry type is not supported.`))}};e([_()],G.prototype,`_activeOperationInfo`,void 0),e([_()],G.prototype,`_connectedReshapeManager`,void 0),e([_()],G.prototype,`_coordinateHelper`,null),e([_()],G.prototype,`_editGeometryOperations`,void 0),e([_()],G.prototype,`_effectiveFilterVerticesEnabled`,null),e([_()],G.prototype,`_primaryGraphicMoving`,void 0),e([_()],G.prototype,`_segmentLabels`,void 0),e([_()],G.prototype,`test`,null),e([_()],G.prototype,`_segmentLabelsImportTask`,void 0),e([_()],G.prototype,`_updatingHandles`,void 0),e([_()],G.prototype,`_selectedManipulator`,null),e([_()],G.prototype,`_tooltipsContext`,null),e([_()],G.prototype,`callbacks`,void 0),e([_()],G.prototype,`connectedReshapeProviders`,void 0),e([_()],G.prototype,`enableMidpoints`,void 0),e([_()],G.prototype,`enableCurveOnMidpoint`,void 0),e([_()],G.prototype,`enableMovement`,void 0),e([_()],G.prototype,`enableVertices`,void 0),e([_()],G.prototype,`filterVerticesEnabled`,void 0),e([_()],G.prototype,`graphic`,void 0),e([_()],G.prototype,`highlightName`,void 0),e([_()],G.prototype,`highlightsEnabled`,void 0),e([_()],G.prototype,`layer`,void 0),e([_()],G.prototype,`snappingManager`,void 0),e([_({readOnly:!0})],G.prototype,`state`,null),e([_()],G.prototype,`symbols`,void 0),e([_()],G.prototype,`tooltip`,void 0),e([_()],G.prototype,`tooltipInfos`,void 0),e([_()],G.prototype,`activeTooltipInfo`,void 0),e([_()],G.prototype,`updating`,null),e([_()],G.prototype,`toolOptions`,void 0),e([_({readOnly:!0})],G.prototype,`type`,void 0),e([_({readOnly:!0})],G.prototype,`vertexGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`curveControlPointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`constructionLineGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`midpointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`selectedManipulators`,void 0),e([_()],G.prototype,`view`,void 0),G=e([v(`esri.views.draw.support.Reshape`)],G);function K(e){let t=q(e);t=t.map(e=>e.slice());for(let e of t)for(let t=0;t<e.length;t++)e[t]=ee(e[t]);if(e.type===`polygon`)for(let e of t){let t=e[e.length-1];if(!N(t))continue;let n=e[0];n[0]===t[0]&&n[1]===t[1]&&e.length>2&&e.pop()}return t}function q(e){return e.type===`polygon`?e.curveRings?.slice()??e.rings.slice():e.type===`polyline`?e.curvePaths?.slice()??e.paths.slice():e.points.map(e=>[e])}function Ne(e,t,n,r){let i=e[t][n];if(A(i))i.c[1]=r;else if(j(i)){let i=k(e[t][n]);e[t][n]={c:[i,r]}}}function Pe(e,t,n,r,i){switch(i){case B.circle.interior:Ne(e,t,n,r);break;case B.bezier.cp1:e[t][n].b[1]=r;break;case B.bezier.cp2:e[t][n].b[2]=r}}function J(e,t){return e<t*1e-8}function Y(e,{cx:t,cy:n,isInvalid:r,thetaStart:i,thetaEnd:a},o,s){let[c,l]=e,[u,d]=o,f=u-c,p=d-l;t-=c,n-=l;let m=s?i>a:i<a,[h,g]=r?[t,n]:m?[-n,t]:[n,-t],[_,v]=[f,p],[y,b]=[h,g],x=_*b-v*y,S=(f**2+p**2)/2;if(J(Math.abs(x),S))return[(c+u)/2,(l+d)/2];let[C,w]=[b/x*S,-y/x*S],T=C**2+w**2,[E,D]=[f/2-C,p/2-w];if(J(E**2+D**2,T)){let[e,t]=m?[-w,C]:[w,-C];return[e+C+c,t+w+l]}let O=Math.sqrt((C**2+w**2)/(E**2+D**2))*Math.sign(f*h+p*g);return[E*O+C+c,D*O+w+l]}function X(e,t,n,r){let i=e[t][n],a=e[t].at(n+1);if(Se(e,t)){let n=e[t][1];e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0]};return}if(Ce(e,t)){let n=e[t][1],[i,a]=n.a[1],[o,s]=r,c=Math.hypot(o-i,s-a),[l,u]=[o-i,s-a],d=te(u,l);e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0,d,c,n.a[6]]};return}let o=k(i);if(N(i))i.splice(0,i.length,...r);else if(M(i))i.b[0].splice(0,i.b[0].length,...r);else if(A(i)||j(i)){let a=k(e[t][n-1]),o=A(i)?D(a,i):F(a,i);e[t].splice(n,1,{c:[[...r],Y(a,o,r,!0)]})}else if(P(i)){i.a[0].splice(0,i.a[0].length,...r);let a=k(e[t][n-1]);I(a,i)}if(a&&!N(a)&&!M(i)){if(A(a)||j(a)){let i=k(a),s=A(a)?D(o,a):F(o,a);e[t].splice(n+1,1,{c:[i,Y(i,s,r,!1)]})}else if(P(a)){let e=k(i);I(e,a)}}}function Z({attributes:e}){return[e?.[R.pathIndex]||0,e?.[R.pointIndex]||0]}function Q({attributes:e}){return`${e?.[R.pathIndex]}-${e?.[R.pointIndex]}-${e?.[R.controlPointKind]??`vertex`}`}function $(e){return e instanceof t?[e]:[...e]}function Fe(e){let t=e.sourceLayer??e.layer;return de(t)?{graphic:e,layer:t}:null}function Ie(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[R.pathIndex],vertexIndex:e[R.pointIndex]}))}const Le=G;export{Le as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{createTask as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import o from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l,assertIsSome as u}from"../../../core/maybe.js";import{throwIfAborted as d}from"../../../core/promiseUtils.js";import{pausable as f,when as p,watch as m,initial as h,sync as g}from"../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import b from"../../../geometry/Point.js";import x from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{isPoint as T}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as E}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as D}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as O,getEndpoint as k,isCircularArc as A,isEllipticArc4 as j,isBezierCurve as M,isCoordinate as N,cloneCurve as ee,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as F}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{normalizeEllipticArcAfterEndpointChange as I}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{wrapAtan2 as te}from"../../../geometry/support/curves/mathUtils.js";import ne from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as re}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as ie}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as ae,getZFromVertexSnappingCandidates as oe,cloneMove as se}from"./drawUtils.js";import ce from"./GraphicMover.js";import le from"./HighlightHelper.js";import{addUniqueLayer as ue,isConnectedReshapeSupportedLayer as de}from"./layerUtils.js";import{createTooltipInfos as fe,connectTooltip as pe,updateTranslateTooltipInfo as me,updateTranslateVertexTooltipInfo as he}from"./reshapeTooltipUtils.js";import{defaultSymbols as ge,createMidpointGraphics as _e,createVertexGraphics as L,createCurveControlPointGraphics as ve,createCurveConstructionLineGraphics as ye,attributeKeys as R,getMidpoint as z,controlPointKinds as B,fastCloneGeometry as V,saveUpdatedCurveOrCoordinate as H,toolIdAttribute as be,splitCurve as xe,isSingleSegmentCircle as Se,isSingleSegmentEllipse as Ce}from"./reshapeUtils.js";import{ViewEventPriorities as we}from"../../input/InputManager.js";import{createCoordinateHelper as Te}from"../../interactive/coordinateHelper.js";import{sketchKeys as Ee}from"../../interactive/keybindings.js";import{EditGeometryOperations as De}from"../../interactive/editGeometry/EditGeometryOperations.js";import Oe from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as ke}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as Ae,enterInputModeIfAvailable as je}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Me}from"../../support/GeometryWorkerHandle.js";const U=Symbol(),W={mode:`on-the-ground`,offset:0};let G=class extends a{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new y,this._measurementWorker=new Me({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=ge,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new Oe,this.type=`reshape`,this.vertexGraphics=new r,this.curveControlPointGraphics=new r,this.constructionLineGraphics=new r,this.midpointGraphics=new r,this.selectedManipulators=new r,this.view=null}initialize(){let e=this.view;this._highlightHelper=new le({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=f(()=>this.graphic?.geometry,e=>{if(!e||this._primaryGraphicMoving===!0)return;let t=new Set(this.selectedManipulators.map(Q));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e)),this.curveControlPointGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e));let{enableMovement:n,_mover:r,graphic:i,midpointGraphics:a,vertexGraphics:o,curveControlPointGraphics:s}=this,c=o.concat(a,s).toArray();n&&c.push(i),r?.set(`graphics`,c)},g),this.tooltip=Ae(()=>({view:e,options:this.toolOptions.tooltips})),this.tooltipInfos=fe(this.toolOptions),this.addHandles([p(()=>e?.ready,()=>{let{layer:e,view:t}=this;ue(t,e),this.addHandles(t.on(`key-down`,e=>this._keyDownHandler(e),we.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[m(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],m(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),pe(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),m(()=>this.toolOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),h),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=c(this._mover),this._connectedReshapeManager=c(this._connectedReshapeManager),this.tooltip=c(this.tooltip),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._updatingHandles=c(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??Te(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return this.view?.type===`2d`&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return this.selectedManipulators.length===1?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){let{toolOptions:e,activeTooltipInfo:t,graphic:n}=this;return{toolOptions:e,activeTooltipInfo:t,graphic:n,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(e,t,n,r,i)=>{this._setUpGeometryHelper();let a=e===this.graphic;if(a?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e),this._syncGeometryAfterVertexMove(e,t,r,i,!0),a){let{view:e}=this,r=e.toScreen(n),i=e.toScreen(t),a=(i?.x??0)-(r?.x??0),o=(i?.y??0)-(r?.y??0);this._emitMoveEvent(a,o),this._emitMoveStopEvent(a,o)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e)}}}get state(){let e=this.view.ready,t=!!(this.graphic&&this.layer);return e&&t?`active`:e?`ready`:`disabled`}get updating(){return!!this._updatingHandles?.updating||!!this._connectedReshapeManager?.updating||!!this._segmentLabels?.updating||!!this.snappingManager?.updating}isUIGraphic(e){return e===this.graphic||this._isMidpoint(e)||this._isCurveControlPoint(e)||this._isVertex(e)||this._isConstructionLine(e)}refresh(e){if(this._reset(),this._setup(),e){for(let t of this.vertexGraphics)e.has(Q(t))&&this._addToSelection(t);for(let t of this.curveControlPointGraphics)e.has(Q(t))&&this._addToSelection(t)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){let{selectedManipulators:e}=this;e.length&&this._removeVertices(e)}_setup(){let{graphic:e,layer:t}=this;if(!t||e?.geometry==null)return;let n=e.geometry;n.type===`mesh`||n.type===`extent`?this._logGeometryTypeError():(n.type===`polygon`&&S(n),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper())}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){let e=this.graphic.geometry;e==null||e.type===`mesh`||e.type===`extent`?(this._segmentLabels=c(this._segmentLabels),this._logGeometryTypeError()):(this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=De.fromGeometry(e,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels()))}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new ne({listMode:`hide`,internal:!0,title:`Reshape snapping layer`}),this.view.map.layers.add(this._snappingGraphicsLayer);let n=this._editGeometryOperations;u(n),this._snappingContext=new ke({editGeometryOperations:n,elevationInfo:W,pointer:t.viewEvent?.pointerType||`mouse`,excludeFeature:this.graphic,feature:this.graphic,visualizer:new re(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._activeOperationInfo=null,this._mover=c(this._mover),this.removeHandles(U),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),c(this._snappingGraphicsLayer)),this._snappingTask=l(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._removeCurveGraphics(e),this._updateTooltip()}_removeMidpointGraphics(e=this.layer){let{midpointGraphics:t}=this;e?.removeMany(t.items),t.drain(c)}_removeVertexGraphics(e=this.layer){let{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(c)}_removeCurveGraphics(e=this.layer){let{curveControlPointGraphics:t,constructionLineGraphics:n}=this;e?.removeMany(t.items),e?.removeMany(n.items),t.drain(c),n.drain(c)}_setupGraphics(){let e=this.graphic.geometry;if(e!=null&&(e.type===`polyline`||e.type===`polygon`||e.type===`multipoint`)){let t=K(e);this.enableMidpoints&&e.type!==`multipoint`&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();let t=_e(e,this.symbols,this._coordinateHelper,this.graphic.geometry?.type===`polygon`,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){let t=L(e,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=t.graphicIndex,this.vertexGraphics.addMany(t.graphics),this.layer.addMany(t.graphics)}else{let t=L(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();let t=ve(e,this.symbols,this._coordinateHelper),n=ye(e,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(t),this.constructionLineGraphics.addMany(n),this.layer.addMany(n),this.layer.addMany(t)}async _setupSegmentLabels(){let e=this._editGeometryOperations,t=this.toolOptions.labels.enabled;if(e&&this._segmentLabels?.context?.editGeometryOperations===e&&t||(this._segmentLabels=c(this._segmentLabels)),!this._segmentLabels&&e&&t){let t=this._segmentLabelsImportTask??=n(async e=>{let t=import(`../../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:n}=await this._updatingHandles.addPromise(t);return e.aborted?null:n}),r=await this._updatingHandles.addPromise(t.promise);if(!r)return;this._segmentLabels=c(this._segmentLabels),this._segmentLabels=new r({context:{view:this.view,editGeometryOperations:e,elevationInfo:W,labelOptions:this.toolOptions.labels},visible:!0})}}_updateSymbolsForTheme(){let e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set(`color`,e),hover:this.symbols.vertices.hover?.clone().set(`color`,e)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set(`color`,e),hover:this.symbols.controlPoints.hover?.clone().set(`color`,e)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set(`color`,e)};for(let e of this.vertexGraphics)e.symbol=this._isSelected(e)?this.symbols.vertices.selected:this._hoverGraphic===e?this.symbols.vertices.hover:this.symbols.vertices.default;for(let e of this.curveControlPointGraphics)e.symbol=this._isSelected(e)?this.symbols.controlPoints.selected:this._hoverGraphic===e?this.symbols.controlPoints.hover:this.symbols.controlPoints.default;for(let e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){let e=this.vertexGraphics.items;if(!e)return;let t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let n=0;n<t.length;n++){let r=[];for(let e=0;e<t.length;e++){if(n===e)continue;let i=t[n],a=t[e];i.x===a.x&&i.y===a.y&&r.push(e)}e[n].attributes[R.relatedGraphicIndices]=r}}_setupMover(){let{enableMovement:e,graphic:t,midpointGraphics:n,vertexGraphics:r,view:i}=this,a=r.concat(n,this.curveControlPointGraphics).toArray();e&&t.geometry?.type!==`multipoint`&&a.push(t),this._mover=new ce({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:a,view:i,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_setupConnectedReshapeManager(){let{connectedReshapeProviders:e}=this;e!=null&&e.length!==0&&(this._connectedReshapeManager??=new ie({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();let t=e.graphic,n=this._isCurveControlPoint(t);if(t===this.graphic)this.clearSelection(),this.emit(`graphic-click`,e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(e.viewEvent.button===2)return;let n=this.graphic.clone(),r=this._handleMidpointClickOrStartMove(e);this.refresh(),r.length&&this._emitVertexAddEvent([t],n,r)}else if(this._isVertex(t)||n){if(e.viewEvent.stopPropagation(),e.viewEvent.button===2){n||this._removeVertices(t);return}e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){let{graphic:t,dx:n,dy:r}=e,i=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:i?`move`:`reshape`,totalDx:n,totalDy:r}}_onGraphicMoveStartCallback(e){let{dx:t,dy:n,graphic:r}=e,i=this._connectedReshapeManager,a=i?Fe(this.graphic):null;if(r===this.graphic){let{geometry:o}=r;this._primaryGraphicMoving=!0,this._setUpOperation(e),this._emitMoveStartEvent(t,n),a&&i?.startFeatureMove([a]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),o!=null&&o.type===`point`&&this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,n)});return}let{selectedManipulators:o}=this;if(!o.includes(r)){if(this._clearSelection(),this._isMidpoint(r)){let t=this.graphic.clone(),n=this._handleMidpointClickOrStartMove(e);n.length&&(this._emitVertexAddEvent([r],t,n),this._refreshGraphicIndicesAttributes(n[0]))}this._addToSelection(r)}if(this._setUpOperation(e),a){let e=o.filter(e=>this._isVertex(e));i?.startVertexMove(a,Ie(e))}this._emitReshapeStartEvent(r),this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(r,e.viewEvent),this._emitReshapeEvent(r)})}_onGraphicMoveCallback(e){let t=this._activeOperationInfo;if(!t)return;let{dx:n,dy:r,graphic:i}=e;t.totalDx+=n,t.totalDy+=r;let{operationType:a}=t,{geometry:o}=i;if(o!=null){if(a===`move`){if(o.type===`point`)this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)});else if(o.type===`polyline`||o.type===`polygon`){let{dxMap:t,dyMap:i}=ae(n,r,this.view);if(!this._effectiveFilterVerticesEnabled){let e=K(o);this._updateVertexGraphicLocations(e)}else if(this.selectedManipulators.length>0){let e=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(let t of e){if(t.geometry?.type===`point`){let{pathIndex:e,pointIndex:n}=t.attributes,r=O(o)[e][n];if(r){let e=k(r);t.geometry=this._coordinateHelper.arrayToPoint(e)}}this._addToSelection(t.clone())}}this._connectedReshapeManager?.translate(t,i,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)}this._syncEditGeometryOperations(o)}else this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(i,e.viewEvent),this._emitReshapeEvent(i)})}}_onGraphicMoveStopCallback(e){let t=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!t)return;let{dx:n,dy:r,graphic:i,x:a,y:o}=e,{operationType:s}=t;t.totalDx+=n,t.totalDy+=r,this._onHandleMove(i,n,r,e,()=>this._handleVertexSnap(i,{x:a,y:o},s))}_afterMoveStop(e,t){if(this._effectiveFilterVerticesEnabled&&t===`move`){let e=new Set;for(let t of this.selectedManipulators)e.add(Q(t));this.refresh(e),this._updateTooltip()}else this._isMidpoint(e)||e.getAttribute(R.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,r){let i=e.geometry,a=this.snappingManager?.getVertexCandidates(),o=this.callbacks.onVertexSnap,s=()=>r===`move`?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);!o||!i||!T(i)||!a||a.length===0?(s(),this._afterMoveStop(e,r)):(l(this._snappingTask),this._snappingTask=n(async n=>{try{let r=await o(i,t,a);d(n);let s=w(r);this._coordinateHelper.hasZ()||(s.z=void 0),this._syncGeometryAfterVertexMove(e,s,0,0),e.geometry=s}finally{s(),this._afterMoveStop(e,r)}}))}_updateVertexGraphicLocations(e){let{_coordinateHelper:t}=this;for(let n of this.vertexGraphics){let{pathIndex:r,pointIndex:i}=n.attributes;n.geometry=t.arrayToPoint(k(e[r][i]))}this._updateMidpointGraphicLocations(e),this._updateCurveGraphicLocations(e)}_updateMidpointGraphicLocations(e,t){let{_coordinateHelper:n}=this;if(t)for(let r of this.midpointGraphics){let{pathIndex:i,pointIndexStart:a,pointIndexEnd:o}=r.attributes;if(!t.has(i))continue;let s=t.get(i);if(!s.has(a)&&!s.has(o))continue;let c=e[i];r.geometry=new b(z(c[a],c[o],n))}else for(let t of this.midpointGraphics){let{pathIndex:r,pointIndexStart:i,pointIndexEnd:a}=t.attributes,o=e[r];t.geometry=new b(z(o[i],o[a],n))}}_updateCurveGraphicLocations(e){let{spatialReference:t}=this._coordinateHelper,n=new Map;for(let e of this.selectedManipulators){let[t,r]=Z(e);t!=null&&r!=null&&e.getAttribute(R.controlPointKind)&&s(n,t,()=>new Set)?.add(r)}for(let t of this.curveControlPointGraphics){let[r,i]=Z(t);if(n.get(r)?.has(i))continue;let a=e[r][i];if(A(a)||j(a)){let n=k(e[r][i-1]),o=A(a)?D(n,a):F(n,a),[s,c]=E(o,.25);t.geometry=new b({x:s,y:c,spatialReference:this._coordinateHelper.spatialReference})}else if(M(a)){let[e,n]=t.getAttribute(R.controlPointKind)===B.bezier.cp1?a.b[1]:a.b[2];t.geometry=new b({x:e,y:n,spatialReference:this._coordinateHelper.spatialReference})}}for(let n of this.constructionLineGraphics){let r=n.getAttribute(R.controlPointKind),[i,a]=Z(n),o=e[i],s=k(o[a-1]),c=k(o[a]),l=e[i][a];n.geometry=r===B.bezier.line1?new x({paths:[[[s[0],s[1]],[...l.b[1]]]],spatialReference:t}):new x({paths:[[[c[0],c[1]],[...l.b[2]]]],spatialReference:t})}}_refreshGraphicIndicesAttributes(e){let{componentIndex:t,vertexIndex:n}=e,r=e=>{let[r,i]=Z(e);r===t&&i>=n&&e.setAttribute(R.pointIndex,i+1)};this.vertexGraphics.forEach(r),this.curveControlPointGraphics.forEach(r),this.constructionLineGraphics.forEach(r);for(let e of this.midpointGraphics){if(e.getAttribute(R.pathIndex)!==t)continue;let r=e.getAttribute(R.pointIndexStart);r>=n&&(e.setAttribute(R.pointIndexStart,r+1),e.setAttribute(R.pointIndexEnd,e.getAttribute(R.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){let[t,n]=Z(e);return u(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[n]}_onHandleMove(e,t,r,i,a){l(this._snappingTask);let o=this._snappingContext;if(!o)return;let s=e.geometry,c=i.type===`graphic-move-stop`;if(!s||!T(s))a();else if(this.snappingManager!=null&&this.selectedManipulators.length<2&&!c){let i=this.snappingManager;this._stagedVertex=i.update({point:s,context:o}),this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a(),this._snappingTask=n(async n=>{let l=await i.snap({point:s,context:o,signal:n});if(l.valid){let n=l.apply();n.z=this._coordinateHelper.hasZ()?oe(this.snappingManager)??n.z:void 0,this._stagedVertex=n,this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{let n=this._stagedVertex==null?s:new b(this._stagedVertex);this._syncGeometryAfterVertexMove(e,n,t,r,c),a()}}_syncGeometryAfterVertexMove(e,t,n,r,i=!1){let a=V(this._editGeometryOperations?.data.geometry);if(!a)return;let{_coordinateHelper:o}=this,s=o.pointToVector(t),c=this._getVertexFromEditGeometry(e),l=null;if(c){let e=o.getZ(s);l=[c.pos[0],c.pos[1]];let t=s[0]-c.pos[0],n=s[1]-c.pos[1],r=e==null?0:e-c.pos[2];(a.type===`point`||a.type===`mesh`)&&this._editGeometryOperations?.moveVertices([c],t,n,r),this._connectedReshapeManager?.translate(t,n,r)}if(a.type===`point`)e.geometry=t;else if(a.type===`mesh`)e.geometry=a.centerAt(t);else{if(e!==this.graphic){l&&!this._isVertex(e)&&(l=null);let[i,s]=Z(e),c=q(a),u=o.pointToArray(t);if(this._updateGeometryFromGraphic(e,c,i,s,u,a.type===`polygon`),this._isVertex(e)||this._isCurveControlPoint(e)){let t=new Map;t.set(i,new Set([s])),c=this._moveRelatedCoordinates(c,e,u,t,l),c=this._moveSelectedHandleCoordinates(c,e,n,r,a.type===`polygon`),this._updateMidpointGraphicLocations(c,t),this._updateCurveGraphicLocations(c)}else this._isMidpoint(e)&&this._updateCurveGraphicLocations(c);H(a,c)}this._updateGraphicGeometry(a),this._syncEditGeometryOperations(a),i&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_syncEditGeometryOperations(e){this._editGeometryOperations?.trySetGeometry(e)||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(e,t,n,r,i){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&i){let a=this._relatedGraphicIndex.search({minX:i[0],maxX:i[0],minY:i[1],maxY:i[1]});for(let o of a)o.coordinate[0]===i[0]&&o.coordinate[1]===i[1]&&o.graphic&&(r&&s(r,o.pathIndex,()=>new Set).add(o.pointIndex),X(e,o.pathIndex,o.pointIndex,n),this._relatedGraphicIndex.remove(o),o.coordinate[0]=t.geometry.x,o.coordinate[1]=t.geometry.y,o.graphic.geometry=t.geometry,this._relatedGraphicIndex.insert(o));return e}let{relatedGraphicIndices:a}=t.attributes;if(!a?.length)return e;for(let i of a){let a=this.vertexGraphics.at(i),[o,c]=Z(a);r&&s(r,o,()=>new Set).add(c),X(e,o,c,n),a.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,n,r,i){for(let a of this.selectedManipulators)if(a!==t){let[t,o]=Z(a),s=a.getAttribute(R.relatedGraphicIndices),c=se(a.geometry,n,r,this.view),l=C(c);if(a.geometry=c,this._updateGeometryFromGraphic(a,e,t,o,l,i),s?.length)for(let t of s){let n=this.vertexGraphics.at(t),[r,i]=Z(n);X(e,r,i,l),n.geometry=c}}return e}_updateGeometryFromGraphic(e,t,n,r,i,a){let o=t[n].length-1;this._isCurveControlPoint(e)?Pe(t,n,r,[i[0],i[1]],e.getAttribute(R.controlPointKind)):(X(t,n,r,i),a&&(r===0?X(t,n,o,i):r===o&&(t[n][0]=i)))}_onGraphicPointerOverCallback(e){let t=e.graphic;this._hoverGraphic=t;let n=this._isVertex(t);n&&!this._isSelected(t)?t.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.hover),this._updateTooltip(n?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){let t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.default),this.removeHandles(U),this._updateTooltip()}_handleMidpointClickOrStartMove(e){let{graphic:t}=e,n=this.graphic.geometry;if(n==null||n.type!==`polygon`&&n.type!==`polyline`)return[];let r=V(n),i=[],{[R.pathIndex]:a,[R.pointIndexStart]:o,[R.pointIndexEnd]:s}=t.attributes,c=C(t.geometry),l=s===0?o+1:s;t.attributes={[R.tool]:be,[R.pathIndex]:a,[R.pointIndex]:l,[R.relatedGraphicIndices]:[]};let u=q(r),d=u[a][s];if(N(d)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){let e=k(u[a][l]);u[a].splice(l,1,{c:[e,[c[0],c[1]]]}),t.setAttribute(R.controlPointKind,B.circle.interior),t.setAttribute(R.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),H(r,u)}else u[a].splice(l,0,c),i.push({coordinates:u[a][l],componentIndex:a,vertexIndex:l})}else{let e=k(u[a][o]),t=xe(e,d,.5,this._coordinateHelper);u[a].splice(s,1,...t),i.push({coordinates:k(u[a][l]),componentIndex:a,vertexIndex:l})}return this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),i}_addToSelection(e){let t=$(e);for(let e of t)e.symbol=this._isCurveControlPoint(e)?this.symbols.controlPoints.selected:this.symbols.vertices.selected,this.selectedManipulators.add(e),this._updateTooltip(e);this._emitSelectEvent(t)}_removeFromSelection(e,t){if(this._isVertex(e)){let{vertices:n}=this.symbols;e.symbol=t?n.hover:n.default}else if(this._isCurveControlPoint(e)){let{controlPoints:n}=this.symbols;e.symbol=t?n.hover:n.default}this.selectedManipulators.remove(e),this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){let e=this.selectedManipulators.toArray(),{controlPoints:t,vertices:n}=this.symbols;if(e.length>0){for(let r of e)this._isVertex(r)?r.symbol=n.default:this._isCurveControlPoint(r)&&(r.symbol=t.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){this._activeOperationInfo==null&&je(e,this.tooltip)||Ee.delete.includes(e.key)&&!e.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),e.stopPropagation())}_removeVertices(e){let t=this.graphic.geometry,n=this.vertexGraphics.length;if(t==null||t.type!==`polygon`&&t.type!==`polyline`&&t.type!==`multipoint`||t.type===`polygon`&&n<4||t.type===`multipoint`&&n<2||t.type===`polyline`&&n<3)return;let r=this.graphic.clone(),i=V(t),a=q(i),o=[],s=$(e);for(let e of s){if(this._isCurveControlPoint(e))continue;let{x:t,y:n}=e.geometry;for(let e=0;e<a.length;e++){let r=a[e];for(let i=0;i<r.length;i++){let[s,c]=k(r[i]);if(t===s&&n===c){o.push({coordinates:k(a[e][i]),componentIndex:e,vertexIndex:i}),a[e].splice(Number(i),1);let t=a[e][i];t&&!N(t)&&(a[e][i]=k(t))}}}}if(i.type===`polygon`)a=a.filter(e=>{if(e.length<2)return!1;let[t,n]=k(e[0]),[r,i]=k(e[e.length-1]);return e.length===2&&t===r&&n===i?!1:((t!==r||n!==i)&&e.push(e[0]),!0)});else if(i.type===`polyline`)for(let e of a)e.length===1&&a.splice(a.indexOf(e),1);H(i,a),this._updateGraphicGeometry(i),this.refresh(),this._emitVertexRemoveEvent(s,r,o)}_isVertex(e){return this.vertexGraphics.includes(e)}_isCurveControlPoint(e){return this.curveControlPointGraphics.includes(e)}_isConstructionLine(e){return this.constructionLineGraphics.includes(e)}_isSelected(e){return(this._isVertex(e)||this.curveControlPointGraphics.includes(e))&&this.selectedManipulators.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){let t=this._isMidpoint(e)?`copy`:`move`;this.addHandles(this.view.acquireCursor(t,`high`),U)}_updateTooltip(e,t){let n=null,{graphic:r,view:i,tooltipInfos:a}=this,o=r?.geometry;o?.type===`point`?n=a.movePoint:this._selectedManipulator?n=a.selectedVertex:e===this.graphic?(n=a.translateGraphic,me(n,i,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(n=a.translateVertices,he(n,i,o,this._tooltipsContext,this._updatingHandles,t)),this.activeTooltipInfo=n}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){let n={type:`move-start`,mover:this.graphic,dx:e,dy:t};this.emit(`move-start`,n),this.callbacks.onMoveStart?.(n)}_emitMoveEvent(e,t){let n={type:`move`,mover:this.graphic,dx:e,dy:t};this.emit(`move`,n),this.callbacks.onMove?.(n)}_emitMoveStopEvent(e,t){if(e==null||t==null){let n=this._activeOperationInfo;if(!n)return;e=n.totalDx,t=n.totalDy}let n={type:`move-stop`,mover:this.graphic,dx:e,dy:t};this.emit(`move-stop`,n),this.callbacks.onMoveStop?.(n)}_emitReshapeStartEvent(e){let t={type:`reshape-start`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-start`,t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){let t={type:`reshape`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape`,t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){let t={type:`reshape-stop`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-stop`,t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){let t={type:`vertex-select`,added:e};this.emit(`select`,t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){let t={type:`vertex-deselect`,removed:e};this.emit(`deselect`,t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,n){let r={type:`vertex-add`,added:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-add`,r),this.callbacks.onVertexAdd?.(r)}_emitVertexRemoveEvent(e,t,n){let r={type:`vertex-remove`,removed:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-remove`,r),this.callbacks.onVertexRemove?.(r)}_logGeometryTypeError(){o.getLogger(this).error(new i(`reshape:invalid-geometry`,`Reshape operation not supported for the provided graphic. The geometry type is not supported.`))}};e([_()],G.prototype,`_activeOperationInfo`,void 0),e([_()],G.prototype,`_connectedReshapeManager`,void 0),e([_()],G.prototype,`_coordinateHelper`,null),e([_()],G.prototype,`_editGeometryOperations`,void 0),e([_()],G.prototype,`_effectiveFilterVerticesEnabled`,null),e([_()],G.prototype,`_primaryGraphicMoving`,void 0),e([_()],G.prototype,`_segmentLabels`,void 0),e([_()],G.prototype,`test`,null),e([_()],G.prototype,`_segmentLabelsImportTask`,void 0),e([_()],G.prototype,`_updatingHandles`,void 0),e([_()],G.prototype,`_selectedManipulator`,null),e([_()],G.prototype,`_tooltipsContext`,null),e([_()],G.prototype,`callbacks`,void 0),e([_()],G.prototype,`connectedReshapeProviders`,void 0),e([_()],G.prototype,`enableMidpoints`,void 0),e([_()],G.prototype,`enableCurveOnMidpoint`,void 0),e([_()],G.prototype,`enableMovement`,void 0),e([_()],G.prototype,`enableVertices`,void 0),e([_()],G.prototype,`filterVerticesEnabled`,void 0),e([_()],G.prototype,`graphic`,void 0),e([_()],G.prototype,`highlightName`,void 0),e([_()],G.prototype,`highlightsEnabled`,void 0),e([_()],G.prototype,`layer`,void 0),e([_()],G.prototype,`snappingManager`,void 0),e([_({readOnly:!0})],G.prototype,`state`,null),e([_()],G.prototype,`symbols`,void 0),e([_()],G.prototype,`tooltip`,void 0),e([_()],G.prototype,`tooltipInfos`,void 0),e([_()],G.prototype,`activeTooltipInfo`,void 0),e([_()],G.prototype,`updating`,null),e([_()],G.prototype,`toolOptions`,void 0),e([_({readOnly:!0})],G.prototype,`type`,void 0),e([_({readOnly:!0})],G.prototype,`vertexGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`curveControlPointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`constructionLineGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`midpointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`selectedManipulators`,void 0),e([_()],G.prototype,`view`,void 0),G=e([v(`esri.views.draw.support.Reshape`)],G);function K(e){let t=q(e);t=t.map(e=>e.slice());for(let e of t)for(let t=0;t<e.length;t++)e[t]=ee(e[t]);if(e.type===`polygon`)for(let e of t){let t=e[e.length-1];if(!N(t))continue;let n=e[0];n[0]===t[0]&&n[1]===t[1]&&e.length>2&&e.pop()}return t}function q(e){return e.type===`polygon`?e.curveRings?.slice()??e.rings.slice():e.type===`polyline`?e.curvePaths?.slice()??e.paths.slice():e.points.map(e=>[e])}function Ne(e,t,n,r){let i=e[t][n];if(A(i))i.c[1]=r;else if(j(i)){let i=k(e[t][n]);e[t][n]={c:[i,r]}}}function Pe(e,t,n,r,i){switch(i){case B.circle.interior:Ne(e,t,n,r);break;case B.bezier.cp1:e[t][n].b[1]=r;break;case B.bezier.cp2:e[t][n].b[2]=r}}function J(e,t){return e<t*1e-8}function Y(e,{cx:t,cy:n,isInvalid:r,thetaStart:i,thetaEnd:a},o,s){let[c,l]=e,[u,d]=o,f=u-c,p=d-l;t-=c,n-=l;let m=s?i>a:i<a,[h,g]=r?[t,n]:m?[-n,t]:[n,-t],[_,v]=[f,p],[y,b]=[h,g],x=_*b-v*y,S=(f**2+p**2)/2;if(J(Math.abs(x),S))return[(c+u)/2,(l+d)/2];let[C,w]=[b/x*S,-y/x*S],T=C**2+w**2,[E,D]=[f/2-C,p/2-w];if(J(E**2+D**2,T)){let[e,t]=m?[-w,C]:[w,-C];return[e+C+c,t+w+l]}let O=Math.sqrt((C**2+w**2)/(E**2+D**2))*Math.sign(f*h+p*g);return[E*O+C+c,D*O+w+l]}function X(e,t,n,r){let i=e[t][n],a=e[t].at(n+1);if(Se(e,t)){let n=e[t][1];e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0]};return}if(Ce(e,t)){let n=e[t][1],[i,a]=n.a[1],[o,s]=r,c=Math.hypot(o-i,s-a),[l,u]=[o-i,s-a],d=te(u,l);e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0,d,c,n.a[6]]};return}let o=k(i);if(N(i))i.splice(0,i.length,...r);else if(M(i))i.b[0].splice(0,i.b[0].length,...r);else if(A(i)||j(i)){let a=k(e[t][n-1]),o=A(i)?D(a,i):F(a,i);e[t].splice(n,1,{c:[[...r],Y(a,o,r,!0)]})}else if(P(i)){i.a[0].splice(0,i.a[0].length,...r);let a=k(e[t][n-1]);I(a,i)}if(a&&!N(a)&&!M(i)){if(A(a)||j(a)){let i=k(a),s=A(a)?D(o,a):F(o,a);e[t].splice(n+1,1,{c:[i,Y(i,s,r,!1)]})}else if(P(a)){let e=k(i);I(e,a)}}}function Z({attributes:e}){return[e?.[R.pathIndex]||0,e?.[R.pointIndex]||0]}function Q({attributes:e}){return`${e?.[R.pathIndex]}-${e?.[R.pointIndex]}-${e?.[R.controlPointKind]??`vertex`}`}function $(e){return e instanceof t?[e]:[...e]}function Fe(e){let t=e.sourceLayer??e.layer;return de(t)?{graphic:e,layer:t}:null}function Ie(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[R.pathIndex],vertexIndex:e[R.pointIndex]}))}const Le=G;export{Le as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e,equals as t}from"../../../core/arrayUtils.js";import{clone as n}from"../../../core/lang.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{lerp as i}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../geometry/Circle.js";import s from"../../../geometry/Multipoint.js";import c from"../../../geometry/Point.js";import l from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{distanceExecute as d}from"../../../geometry/operators/distanceOperator.js";import{simplifyIsSimple as f,simplifyExecute as p}from"../../../geometry/operators/simplifyOperator.js";import{isClockwise as m}from"../../../geometry/support/coordsUtils.js";import{isValid as h}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as g}from"./surfaceCoordinateSystems.js";import{unnormalize as _}from"../../support/unnormalizationUtils.js";function v(e,t){let n=new c({x:e[0],y:e[1],spatialReference:t});return e.length>2&&(n.z=e[2]),n}function y(e,t){return new s({points:e,spatialReference:t})}function b(e,t,n){let r=new u({paths:e,spatialReference:t});return n&&_(r,r.spatialReference),r}function x(e,r,i,a=!0){let o=n(e);o.forEach(e=>{let n=e[0],r=e[e.length-1];(!t(n,r)||e.length===1)&&e.push(e[0])});let s=new l({rings:o,spatialReference:r});return s.rings.forEach(e=>{m(e)||e.reverse()}),i&&_(s,s.spatialReference),a&&!f(s)&&h(r)&&(s=p(s)||s),s}function S(t,n,r){let i=n.mapToLocalMultiple(t),a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y},c=Math.round(s.x-o.x),l=Math.round(s.y-o.y),u=Math.max(Math.abs(c),Math.abs(l));if(r){let e={x:o.x+u,y:o.y+u},t={x:o.x-u,y:o.y-u};a.push(g(e.x,t.y),g(t.x,t.y),g(t.x,e.y),g(e.x,e.y))}else{let e={x:c>0?o.x+u:o.x-u,y:l>0?o.y+u:o.y-u};a.push(g(o.x,o.y),g(e.x,o.y),g(e.x,e.y),g(o.x,e.y))}return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function C(t,n,r){let i=n.mapToLocalMultiple(t);if(i.length===1){let e=i[0];i=[g(e.x-48,e.y+48),g(e.x+48,e.y-48),g(e.x+48,e.y-48),g(e.x-48,e.y+48)]}let a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y};if(r){let e=Math.round(s.x-o.x),t=Math.round(s.y-o.y);a.push(g(o.x-e,o.y-t),g(s.x,o.y-t),g(s.x,s.y),g(o.x-e,s.y))}else a.push(g(o.x,o.y),g(s.x,o.y),g(s.x,s.y),g(o.x,s.y));return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function w(e,t,n){let r=T(t[3],t[2],n),i=T(t[1],t[2],n),a=T(t[0],t[1],n),o=T(t[0],t[3],n);return{geometry:e,midpoints:r!=null&&i!=null&&a!=null&&o!=null?{top:r,right:i,bottom:a,left:o}:null}}function T(e,t,n){D[0]=e.x,D[1]=e.y,D[2]=0,O[0]=t.x,O[1]=t.y,O[2]=0,i(D,D,O,.5),E.x=D[0],E.y=O[1],E.z=O[2];let r=n.localToMap(E);return r==null?null:v(r,n.spatialReference)}const E=g(0,0,0),D=a(),O=a();function k(e,t,n,i){let a=t.mapToLocalMultiple(e),s=null,c=null;if(n)s=a[0],c=a[1];else{let e=a[0],t=a[1],n=Math.round(t.x-e.x),r=Math.round(t.y-e.y),i=Math.max(Math.abs(n),Math.abs(r));s=g(n>0?e.x+i/2:e.x-i/2,r>0?e.y+i/2:e.y-i/2),c=g(Math.abs(n)>Math.abs(r)?s.x-i/2:s.x,Math.abs(n)>Math.abs(r)?s.y:s.y-i/2)}let l=t.localToMap(s),u=t.localToMap(c);if(l==null||u==null)return null;t.doUnnormalization&&_([[l,u]],t.spatialReference);let f=v(l,t.spatialReference),p=v(u,t.spatialReference),m=r(t.spatialReference),y=0;if(h(t.spatialReference))y=m*d(f,p);else{let e=s.x-c.x,t=s.y-c.y;y=m*Math.sqrt(e*e+t*t)*(i||1)}let b=new o({center:f,radius:y,radiusUnit:`meters`,spatialReference:t.spatialReference});return{geometry:x(b.rings,b.spatialReference,!1),center:f,edge:p}}function A(t,n,r){let i=n.mapToLocalMultiple(t),a=i[0],o=i[1],s=Math.round(o.x-a.x),c=Math.round(o.y-a.y),l=g(r?a.x:a.x+s/2,r?a.y:a.y+c/2),u=r?s:s/2,d=r?c:c/2,f=[],p=2*Math.PI/60;function m(e){let t=Math.cos(e),n=Math.sin(e);return g(u*t+l.x,d*n+l.y)}for(let e=0;e<60;e++)f.push(m(e*p));f.push(f[0]);let{spatialReference:h,doUnnormalization:_}=n,y=x([f.map(e=>n.localToMap(e)).filter(e)],h,_,!1),b=n.localToMap(m(Math.PI/2)),S=n.localToMap(m(0)),C=n.localToMap(m(-Math.PI/2)),w=n.localToMap(m(Math.PI));return{geometry:y,midpoints:b!=null&&S!=null&&C!=null&&w!=null?{top:v(b,h),right:v(S,h),bottom:v(C,h),left:v(w,h)}:null}}export{k as createCircle,A as createEllipse,y as createMultipoint,v as createPoint,x as createPolygon,b as createPolyline,C as createRectangle,S as createSquare};
2
+ import{isSome as e,equals as t}from"../../../core/arrayUtils.js";import{clone as n}from"../../../core/lang.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{lerp as i}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../geometry/Circle.js";import s from"../../../geometry/Multipoint.js";import c from"../../../geometry/Point.js";import l from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{distanceExecute as d}from"../../../geometry/operators/distanceOperator.js";import{simplifyIsSimple as f,simplifyExecute as p}from"../../../geometry/operators/simplifyOperator.js";import{isClockwise as m}from"../../../geometry/support/coordsUtils.js";import{isValid as h}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as g}from"./surfaceCoordinateSystems.js";import{unnormalize as _}from"../../support/unnormalizationUtils.js";function v(e,t){let n=new c({x:e[0],y:e[1],spatialReference:t});return e.length>2&&(n.z=e[2]),n}function y(e,t){return new s({points:e,spatialReference:t})}function b(e,t,n){let r=new u({paths:e,spatialReference:t});return n&&_(r,r.spatialReference),r}function x(e,r,i,a=!0){let o=n(e);o.forEach(e=>{let n=e[0],r=e[e.length-1];t(n,r)&&e.length!==1||e.push(e[0])});let s=new l({rings:o,spatialReference:r});return s.rings.forEach(e=>{m(e)||e.reverse()}),i&&_(s,s.spatialReference),a&&!f(s)&&h(r)&&(s=p(s)||s),s}function S(t,n,r){let i=n.mapToLocalMultiple(t),a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y},c=Math.round(s.x-o.x),l=Math.round(s.y-o.y),u=Math.max(Math.abs(c),Math.abs(l));if(r){let e={x:o.x+u,y:o.y+u},t={x:o.x-u,y:o.y-u};a.push(g(e.x,t.y),g(t.x,t.y),g(t.x,e.y),g(e.x,e.y))}else{let e={x:c>0?o.x+u:o.x-u,y:l>0?o.y+u:o.y-u};a.push(g(o.x,o.y),g(e.x,o.y),g(e.x,e.y),g(o.x,e.y))}return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function C(t,n,r){let i=n.mapToLocalMultiple(t);if(i.length===1){let e=i[0];i=[g(e.x-48,e.y+48),g(e.x+48,e.y-48),g(e.x+48,e.y-48),g(e.x-48,e.y+48)]}let a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y};if(r){let e=Math.round(s.x-o.x),t=Math.round(s.y-o.y);a.push(g(o.x-e,o.y-t),g(s.x,o.y-t),g(s.x,s.y),g(o.x-e,s.y))}else a.push(g(o.x,o.y),g(s.x,o.y),g(s.x,s.y),g(o.x,s.y));return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function w(e,t,n){let r=T(t[3],t[2],n),i=T(t[1],t[2],n),a=T(t[0],t[1],n),o=T(t[0],t[3],n);return{geometry:e,midpoints:r!=null&&i!=null&&a!=null&&o!=null?{top:r,right:i,bottom:a,left:o}:null}}function T(e,t,n){D[0]=e.x,D[1]=e.y,D[2]=0,O[0]=t.x,O[1]=t.y,O[2]=0,i(D,D,O,.5),E.x=D[0],E.y=O[1],E.z=O[2];let r=n.localToMap(E);return r==null?null:v(r,n.spatialReference)}const E=g(0,0,0),D=a(),O=a();function k(e,t,n,i){let a=t.mapToLocalMultiple(e),s=null,c=null;if(n)s=a[0],c=a[1];else{let e=a[0],t=a[1],n=Math.round(t.x-e.x),r=Math.round(t.y-e.y),i=Math.max(Math.abs(n),Math.abs(r));s=g(n>0?e.x+i/2:e.x-i/2,r>0?e.y+i/2:e.y-i/2),c=g(Math.abs(n)>Math.abs(r)?s.x-i/2:s.x,Math.abs(n)>Math.abs(r)?s.y:s.y-i/2)}let l=t.localToMap(s),u=t.localToMap(c);if(l==null||u==null)return null;t.doUnnormalization&&_([[l,u]],t.spatialReference);let f=v(l,t.spatialReference),p=v(u,t.spatialReference),m=r(t.spatialReference),y=0;if(h(t.spatialReference))y=m*d(f,p);else{let e=s.x-c.x,t=s.y-c.y;y=m*Math.sqrt(e*e+t*t)*(i||1)}let b=new o({center:f,radius:y,radiusUnit:`meters`,spatialReference:t.spatialReference});return{geometry:x(b.rings,b.spatialReference,!1),center:f,edge:p}}function A(t,n,r){let i=n.mapToLocalMultiple(t),a=i[0],o=i[1],s=Math.round(o.x-a.x),c=Math.round(o.y-a.y),l=g(r?a.x:a.x+s/2,r?a.y:a.y+c/2),u=r?s:s/2,d=r?c:c/2,f=[],p=2*Math.PI/60;function m(e){let t=Math.cos(e),n=Math.sin(e);return g(u*t+l.x,d*n+l.y)}for(let e=0;e<60;e++)f.push(m(e*p));f.push(f[0]);let{spatialReference:h,doUnnormalization:_}=n,y=x([f.map(e=>n.localToMap(e)).filter(e)],h,_,!1),b=n.localToMap(m(Math.PI/2)),S=n.localToMap(m(0)),C=n.localToMap(m(-Math.PI/2)),w=n.localToMap(m(Math.PI));return{geometry:y,midpoints:b!=null&&S!=null&&C!=null&&w!=null?{top:v(b,h),right:v(S,h),bottom:v(C,h),left:v(w,h)}:null}}export{k as createCircle,A as createEllipse,y as createMultipoint,v as createPoint,x as createPolygon,b as createPolyline,C as createRectangle,S as createSquare};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{createTask as e}from"../../../core/asyncUtils.js";import{throwIfAborted as t,isAborted as n,isAbortError as r}from"../../../core/promiseUtils.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{diff as a}from"../../../core/accessorSupport/diffUtils.js";import{isGraphicsLayer as o,isSceneLayer as s}from"../../../layers/support/layerUtils.js";import{getDisplayedSymbol as c}from"../../../symbols/support/symbolUtils.js";import{GraphicState as l}from"../../3d/layers/graphics/GraphicState.js";async function u(e,n,r,i){let a=n.createQuery();a.objectIds=e,a.outFields=[`*`],a.returnM=n.capabilities.data.supportsM,a.returnZ=n.capabilities.data.supportsZ,a.returnGeometry=!0,(!s(n)||n.infoFor3D==null)&&(a.outSpatialReference=r),!s(n)&&n.capabilities?.data.supportsTrueCurve&&(a.returnTrueCurves=!0);let o=await n.queryFeatures(a,{signal:i});return t(i),o.features}async function d(e,n,r){let i=await c(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,scale:n});t(r),a(e.symbol,i)!=null&&(e.symbol=i)}async function f(a,s,c,l,u){t(u),a.graphics.includes(l)||a.add(l);let d=c.sourceLayer,f=c.layer??d,h=c.getObjectId(),g=null,_=null;function v(r){return g?.abort(),o(f)?(c.visible=r,Promise.resolve()):(g=e(async e=>{let i=await p(s,f);if(t(e),!(!i||s.destroyed||i.destroyed))try{h!=null&&typeof h==`number`&&`setVisibility`in i&&i.setVisibility?.(h,r)}catch(t){if(n(e)||s.destroyed||i.destroyed)return;throw t}}),g.promise)}async function y(){return _||(_=(async()=>{try{await v(!0);let e=s.destroyed?null:await p(s,f).catch(()=>{});e&&!e.destroyed&&await i(()=>!e.updating)}catch(e){if(e&&!r(e))throw e}finally{a.remove(l)}})(),s.addUpdatingPromise(_).catch(()=>{}),_)}try{await m(s,l,u),t(u),v(!1).catch(()=>{})}catch(e){throw await y(),e}let b=async()=>y().catch(()=>{});return{remove:b,[Symbol.asyncDispose](){return b()}}}async function p(e,t){if(!t||t.type===`building-component`)return;let n=t.type===`subtype-sublayer`?t.parent:t;return n?e.whenLayerView(n):void 0}async function m(e,t,n){if(e.type===`3d`){let r=new l({graphic:t}),a=e.trackGraphicState(r);try{await i(()=>r.displaying||r.error,n)}finally{a.remove()}}else await i(()=>t.visible,n)}export{u as fetchFullFeaturesByObjectId,f as swapForEditingSession,d as updateGraphicSymbolWhenRequired};
2
+ import{createTask as e}from"../../../core/asyncUtils.js";import{throwIfAborted as t,isAborted as n,isAbortError as r}from"../../../core/promiseUtils.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{diff as a}from"../../../core/accessorSupport/diffUtils.js";import{isGraphicsLayer as o,isSceneLayer as s}from"../../../layers/support/layerUtils.js";import{getDisplayedSymbol as c}from"../../../symbols/support/symbolUtils.js";import{GraphicState as l}from"../../3d/layers/graphics/GraphicState.js";async function u(e,n,r,i){let a=n.createQuery();a.objectIds=e,a.outFields=[`*`],a.returnM=n.capabilities.data.supportsM,a.returnZ=n.capabilities.data.supportsZ,a.returnGeometry=!0,s(n)&&n.infoFor3D!=null||(a.outSpatialReference=r),!s(n)&&n.capabilities?.data.supportsTrueCurve&&(a.returnTrueCurves=!0);let o=await n.queryFeatures(a,{signal:i});return t(i),o.features}async function d(e,n,r){let i=await c(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,scale:n});t(r),a(e.symbol,i)!=null&&(e.symbol=i)}async function f(a,s,c,l,u){t(u),a.graphics.includes(l)||a.add(l);let d=c.sourceLayer,f=c.layer??d,h=c.getObjectId(),g=null,_=null;function v(r){return g?.abort(),o(f)?(c.visible=r,Promise.resolve()):(g=e(async e=>{let i=await p(s,f);if(t(e),!(!i||s.destroyed||i.destroyed))try{h!=null&&typeof h==`number`&&`setVisibility`in i&&i.setVisibility?.(h,r)}catch(t){if(n(e)||s.destroyed||i.destroyed)return;throw t}}),g.promise)}async function y(){return _||(_=(async()=>{try{await v(!0);let e=s.destroyed?null:await p(s,f).catch(()=>{});e&&!e.destroyed&&await i(()=>!e.updating)}catch(e){if(e&&!r(e))throw e}finally{a.remove(l)}})(),s.addUpdatingPromise(_).catch(()=>{}),_)}try{await m(s,l,u),t(u),v(!1).catch(()=>{})}catch(e){throw await y(),e}let b=async()=>y().catch(()=>{});return{remove:b,[Symbol.asyncDispose](){return b()}}}async function p(e,t){if(!t||t.type===`building-component`)return;let n=t.type===`subtype-sublayer`?t.parent:t;return n?e.whenLayerView(n):void 0}async function m(e,t,n){if(e.type===`3d`){let r=new l({graphic:t}),a=e.trackGraphicState(r);try{await i(()=>r.displaying||r.error,n)}finally{a.remove()}}else await i(()=>t.visible,n)}export{u as fetchFullFeaturesByObjectId,f as swapForEditingSession,d as updateGraphicSymbolWhenRequired};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Collection.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import i from"../../../../core/ReactiveMap.js";import{watch as a}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{DrawManipulator as l}from"../../DrawManipulator.js";import{InteractiveHandle as u}from"../InteractiveHandle.js";import{ManipulatorCollection as d}from"../../../interactive/ManipulatorCollection.js";const f=Symbol(`manipulator-handle-watch`);let p=class extends t{constructor(e){super(e),this._pluginConstraintRegistry=new i,this._pluginHandleRegistry=new i,this._handleManipulatorMap=new n,this.renderer=null,this.manipulators=new d,this.view=null,this.capturingHandle=null}initialize(){super.initialize()}destroy(){this._pluginConstraintRegistry.clear(),this._pluginHandleRegistry.forEach(e=>e.drain(e=>e.destroy())),this._pluginHandleRegistry.clear(),this._handleManipulatorMap.removeAll()}get customConstraints(){return Array.from(this._pluginConstraintRegistry.values()).flatMap(e=>Array.from(e.values()))}get focusedHandle(){return this.capturingHandle??this._handleManipulatorMap.find(({handle:e,manipulator:t})=>e.dragging||t.grabbing||t.selected||t.hovering)?.handle}get handleCount(){return this._handleManipulatorMap.length}get allhandles(){return this._handleManipulatorMap.map(({handle:e})=>e).toArray()}cycleManipulator(e){let{capturingHandle:t,_handleManipulatorMap:n}=this;if(!t){this.followHandle(n.at(0)?.handle);return}let r=n.findIndex(({handle:e})=>e===t),i=e===`forward`?r+1:r-1;this.followHandle(n.at(i%n.length)?.handle)}toggleFollow(){let e=this.capturingHandle;if(e)return this.releaseHandle(e),!0;let t=this._handleManipulatorMap.find(e=>e.handle.defaultCaptureMode!==`grabbable-object`)?.handle;return t?(this.followHandle(t),!0):!1}shouldCaptureInput(e=null,t=null){let n=this.capturingHandle;return!n||!(e!=null&&n.activePointerId!=null&&n.activePointerId!==e||t===`touch`&&n.activePointerType===`pen`)}notePointerDown(e=null,t=null){this.shouldCaptureInput(e,t)&&this.capturingHandle?.notePointerDown(e,t)}notePointerUp(e=null,t=null){this.capturingHandle?.notePointerUp(e,t)}releaseHandle(e){e&&(e.captureMode=`grabbable-object`,e.drawToolDragging=!1),(!e||e===this.capturingHandle)&&(this.capturingHandle&&(this.capturingHandle.drawToolDragging=!1,this.capturingHandle.captureMode=`grabbable-object`),this.capturingHandle=null)}followHandle(e){this._handleManipulatorMap.forEach(({handle:e})=>{e.captureMode!==`grabbable-object`&&(e.captureMode=`grabbable-object`)}),e&&(e.captureMode=e.defaultCaptureMode===`grabbable-object`?`capture-always`:e.defaultCaptureMode),e?.captureMode!==`grabbable-object`&&(this.capturingHandle=e)}findHandleByManipulator(e,t){let n=null,r=Number.MAX_VALUE;return this._handleManipulatorMap.forEach(({handle:i,manipulator:a})=>{if(i.captureMode!==`grabbable-object`||!a.interactive)return;let o=a.intersectionDistance(e,t);o!=null&&o<r&&(r=o,n=i)}),n}findHandleDragging(){return this._handleManipulatorMap.find(({handle:e})=>e.dragging)?.handle}async setupManipulatorForHandle(e,t,n){let{view:r}=this,{surfaceManager:i}=n,s=n.editGeometryOperations?.data.coordinateHelper;if(!r||!i||!s)return;let c=await this._createManipulator(r,this.renderer,e);if(this.destroyed||e.destroyed){c.destroy();return}this._handleManipulatorMap.push({handle:e,manipulator:c}),this.manipulators.add(c),e.addHandles([a(()=>c.dragging,t=>{e.manipulatorDragging=t,t||this.releaseHandle(e)})],f),e.following&&(this.capturingHandle=e);let l=(e.inputMapPosition&&i.mapToScreen(e.inputMapPosition,{firstPointZ:e.firstPointZ}))??e.screenPosition??t??o(r?.width/2,r.height/2);await e?.moveTo(l,{...n,pointerType:`mouse`})}removeManipulatorForHandle(e){let t=this._handleManipulatorMap.find(t=>t.handle===e);t&&(this.manipulators.remove(t.manipulator),this._handleManipulatorMap.remove(t),t.manipulator.destroy()),e.removeHandles(f)}registerHandle(e,t){let i=r(this._pluginHandleRegistry,e,()=>new n),a=new u(t);return i.push(a),a}unregisterHandle(e,t){let n=this._pluginHandleRegistry.get(e);n&&(t?(n.remove(t),this.removeManipulatorForHandle(t),t.destroy()):(n.drain(e=>{this.removeManipulatorForHandle(e),e.destroy()}),this._pluginHandleRegistry.delete(e)))}registerCustomConstraint(e,t,n){r(this._pluginConstraintRegistry,e,()=>new i).set(t,n)}unregisterCustomConstraint(e,t){t?this._pluginConstraintRegistry.get(e)?.delete(t):(this._pluginConstraintRegistry.get(e)?.clear(),this._pluginConstraintRegistry.delete(e))}replaceEditSessions(e,t){let n=this._pluginHandleRegistry.get(e);if(n)for(let e of n)e.editSession=t}updateAllScreenPositions(e=null){let{view:t}=this;this._handleManipulatorMap.forEach(({handle:n})=>{let r=n.outputMapPosition;r&&(n.screenPosition=e?.mapToScreen(r,{firstPointZ:n.firstPointZ})??t?.toScreen(r))})}reapplyPositions(e){this._handleManipulatorMap.forEach(({handle:t})=>t.refreshConstraint(e))}async _createManipulator(e,t,n){if(e.type===`3d`){let{DrawManipulator3D:r}=await import(`../../DrawManipulator3D.js`);return new r({view:e,renderer:t,managedHandle:n})}return new l({renderer:t,managedHandle:n})}};e([s({constructOnly:!0})],p.prototype,`renderer`,void 0),e([s({readOnly:!0})],p.prototype,`manipulators`,void 0),e([s({constructOnly:!0})],p.prototype,`view`,void 0),e([s()],p.prototype,`capturingHandle`,void 0),e([s()],p.prototype,`customConstraints`,null),e([s()],p.prototype,`focusedHandle`,null),e([s()],p.prototype,`handleCount`,null),e([s()],p.prototype,`allhandles`,null),p=e([c(`esri.views.draw.support.managers.InteractiveHandleManager`)],p);export{p as InteractiveHandleManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Collection.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import i from"../../../../core/ReactiveMap.js";import{watch as a}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{DrawManipulator as l}from"../../DrawManipulator.js";import{InteractiveHandle as u}from"../InteractiveHandle.js";import{ManipulatorCollection as d}from"../../../interactive/ManipulatorCollection.js";const f=Symbol(`manipulator-handle-watch`);let p=class extends t{constructor(e){super(e),this._pluginConstraintRegistry=new i,this._pluginHandleRegistry=new i,this._handleManipulatorMap=new n,this.renderer=null,this.manipulators=new d,this.view=null,this.capturingHandle=null}initialize(){super.initialize()}destroy(){this._pluginConstraintRegistry.clear(),this._pluginHandleRegistry.forEach(e=>e.drain(e=>e.destroy())),this._pluginHandleRegistry.clear(),this._handleManipulatorMap.removeAll()}get customConstraints(){return Array.from(this._pluginConstraintRegistry.values()).flatMap(e=>Array.from(e.values()))}get focusedHandle(){return this.capturingHandle??this._handleManipulatorMap.find(({handle:e,manipulator:t})=>e.dragging||t.grabbing||t.selected||t.hovering)?.handle}get handleCount(){return this._handleManipulatorMap.length}get allhandles(){return this._handleManipulatorMap.map(({handle:e})=>e).toArray()}cycleManipulator(e){let{capturingHandle:t,_handleManipulatorMap:n}=this;if(!t){this.followHandle(n.at(0)?.handle);return}let r=n.findIndex(({handle:e})=>e===t),i=e===`forward`?r+1:r-1;this.followHandle(n.at(i%n.length)?.handle)}toggleFollow(){let e=this.capturingHandle;if(e)return this.releaseHandle(e),!0;let t=this._handleManipulatorMap.find(e=>e.handle.defaultCaptureMode!==`grabbable-object`)?.handle;return t?(this.followHandle(t),!0):!1}shouldCaptureInput(e=null,t=null){let n=this.capturingHandle;return!n||!(e!=null&&n.activePointerId!=null&&n.activePointerId!==e||t===`touch`&&n.activePointerType===`pen`)}notePointerDown(e=null,t=null){this.shouldCaptureInput(e,t)&&this.capturingHandle?.notePointerDown(e,t)}notePointerUp(e=null,t=null){this.capturingHandle?.notePointerUp(e,t)}releaseHandle(e){e&&(e.captureMode=`grabbable-object`,e.drawToolDragging=!1),e&&e!==this.capturingHandle||(this.capturingHandle&&(this.capturingHandle.drawToolDragging=!1,this.capturingHandle.captureMode=`grabbable-object`),this.capturingHandle=null)}followHandle(e){this._handleManipulatorMap.forEach(({handle:e})=>{e.captureMode!==`grabbable-object`&&(e.captureMode=`grabbable-object`)}),e&&(e.captureMode=e.defaultCaptureMode===`grabbable-object`?`capture-always`:e.defaultCaptureMode),e?.captureMode!==`grabbable-object`&&(this.capturingHandle=e)}findHandleByManipulator(e,t){let n=null,r=Number.MAX_VALUE;return this._handleManipulatorMap.forEach(({handle:i,manipulator:a})=>{if(i.captureMode!==`grabbable-object`||!a.interactive)return;let o=a.intersectionDistance(e,t);o!=null&&o<r&&(r=o,n=i)}),n}findHandleDragging(){return this._handleManipulatorMap.find(({handle:e})=>e.dragging)?.handle}async setupManipulatorForHandle(e,t,n){let{view:r}=this,{surfaceManager:i}=n,s=n.editGeometryOperations?.data.coordinateHelper;if(!r||!i||!s)return;let c=await this._createManipulator(r,this.renderer,e);if(this.destroyed||e.destroyed){c.destroy();return}this._handleManipulatorMap.push({handle:e,manipulator:c}),this.manipulators.add(c),e.addHandles([a(()=>c.dragging,t=>{e.manipulatorDragging=t,t||this.releaseHandle(e)})],f),e.following&&(this.capturingHandle=e);let l=(e.inputMapPosition&&i.mapToScreen(e.inputMapPosition,{firstPointZ:e.firstPointZ}))??e.screenPosition??t??o(r?.width/2,r.height/2);await e?.moveTo(l,{...n,pointerType:`mouse`})}removeManipulatorForHandle(e){let t=this._handleManipulatorMap.find(t=>t.handle===e);t&&(this.manipulators.remove(t.manipulator),this._handleManipulatorMap.remove(t),t.manipulator.destroy()),e.removeHandles(f)}registerHandle(e,t){let i=r(this._pluginHandleRegistry,e,()=>new n),a=new u(t);return i.push(a),a}unregisterHandle(e,t){let n=this._pluginHandleRegistry.get(e);n&&(t?(n.remove(t),this.removeManipulatorForHandle(t),t.destroy()):(n.drain(e=>{this.removeManipulatorForHandle(e),e.destroy()}),this._pluginHandleRegistry.delete(e)))}registerCustomConstraint(e,t,n){r(this._pluginConstraintRegistry,e,()=>new i).set(t,n)}unregisterCustomConstraint(e,t){t?this._pluginConstraintRegistry.get(e)?.delete(t):(this._pluginConstraintRegistry.get(e)?.clear(),this._pluginConstraintRegistry.delete(e))}replaceEditSessions(e,t){let n=this._pluginHandleRegistry.get(e);if(n)for(let e of n)e.editSession=t}updateAllScreenPositions(e=null){let{view:t}=this;this._handleManipulatorMap.forEach(({handle:n})=>{let r=n.outputMapPosition;r&&(n.screenPosition=e?.mapToScreen(r,{firstPointZ:n.firstPointZ})??t?.toScreen(r))})}reapplyPositions(e){this._handleManipulatorMap.forEach(({handle:t})=>t.refreshConstraint(e))}async _createManipulator(e,t,n){if(e.type===`3d`){let{DrawManipulator3D:r}=await import(`../../DrawManipulator3D.js`);return new r({view:e,renderer:t,managedHandle:n})}return new l({renderer:t,managedHandle:n})}};e([s({constructOnly:!0})],p.prototype,`renderer`,void 0),e([s({readOnly:!0})],p.prototype,`manipulators`,void 0),e([s({constructOnly:!0})],p.prototype,`view`,void 0),e([s()],p.prototype,`capturingHandle`,void 0),e([s()],p.prototype,`customConstraints`,null),e([s()],p.prototype,`focusedHandle`,null),e([s()],p.prototype,`handleCount`,null),e([s()],p.prototype,`allhandles`,null),p=e([c(`esri.views.draw.support.managers.InteractiveHandleManager`)],p);export{p as InteractiveHandleManager};
@@ -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"../../Color.js";import{onLocaleChange as n}from"../../intl.js";import r from"../../core/Accessor.js";import{createTask as i}from"../../core/asyncUtils.js";import{multiplyOpacity as a,getContrast as o}from"../../core/colorUtils.js";import{makeHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import{getOrCreateMapValue as c}from"../../core/MapUtils.js";import{deg2rad as l}from"../../core/mathUtils.js";import{debounce as u}from"../../core/promiseUtils.js";import{formatLength as d}from"../../core/quantityFormatUtils.js";import{on as f}from"../../core/reactiveUtils.js";import{createScreenPointArray as p}from"../../core/screenUtils.js";import{getMetersPerUnit as m,getMetersPerVerticalUnitForSR as h}from"../../core/units.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{squaredDistance as v,set as y,normalize as b,scale as x,add as S,lerp as C}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as w}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{clone as T}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isVec3 as E}from"../../core/libs/gl-matrix-2/types/vec3.js";import{UpdatingHandles as D}from"../../core/support/UpdatingHandles.js";import O from"../../geometry/Polyline.js";import{isClockwise as k}from"../../geometry/support/coordsUtils.js";import{getEndpoint as A,isCoordinate as j,cloneCurve as M}from"../../geometry/support/curves/curveUtils.js";import{interpolate2D as N}from"../../geometry/support/curves/interpolateCurve.js";import{fetchMessageBundle as P}from"../../intl/messages.js";import{getConvertedElevationFromVector as F,absoluteHeightElevationInfo as I}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as L}from"../../support/getDefaultUnitForView.js";import R from"../overlay/TextOverlayItem.js";import{GeometryWorkerHandle as z}from"../support/GeometryWorkerHandle.js";const B={default:15,far:25};let V=class extends r{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance=`default`,this._updatingHandles=new D,this._messageUnitsTask=null,this._labelInfos=[],this._nextLabelIndex=0,this._debouncedLabelUpdates=new Map,this._measurementWorker=new z({preloadGeodetic:!0})}initialize(){this.addHandles([this._updatingHandles.add(()=>[this.context!=null&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits],()=>this._update()),f(()=>this.context?.editGeometryOperations,[`vertex-add`,`vertex-remove`],()=>this._update()),f(()=>this.context?.editGeometryOperations,`vertex-update`,e=>this._update(e.vertices)),this._updatingHandles.add(()=>this._colors,e=>this._updateStyle(e)),n(()=>this._refreshMessages()),s(()=>this._messageUnitsTask?.abort())]),this._refreshMessages()}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop());this._measurementWorker.destroy(),this._updatingHandles.destroy()}get updating(){return!this._messageUnitsTask?.finished||this._updatingHandles.updating}get test(){}get _messagesUnits(){return this._messageUnitsTask?.value}get _edgeDistancePixels(){return B[this.edgeDistance]}get _colors(){let e=this.context?.view.effectiveTheme.textColor??t.fromArray([255,255,255]);return{textColor:e,backgroundColor:a(o(e,160),.6)}}_update(e){if(this.destroyed)return;this._nextLabelIndex=0;let{context:t,stagedVertex:n}=this;if(!t)return this._destroyUnusedLabels();let r=t.editGeometryOperations.data,{parts:i,geometry:a,coordinateHelper:o}=r;if(!a)return this._destroyUnusedLabels();let s=i.length;for(let i=0;i<s;++i){let c=this.getRing(a,r,n,o,i),l=c.map(e=>E(e)?e:o.arrayToXYZ(A(e)));if(c.length<2||!H(c,t.view,t.elevationInfo,o.spatialReference))continue;let u=s===1&&!k(l),d=K,f=q;this.toScreenPointArray(t,l[0],d);for(let n=1;n<c.length;++n){let r=l[n-1],a=l[n],o=c[n];this.toScreenPointArray(t,a,f);let s=n===l.length-1,p=!(!e?.length||e.some(({index:e,part:t})=>t.index===i&&(e===n-1||e===n||s&&e===0)));this._addLabel(t,r,d,a,E(o)?null:o,f,u,p),[d,f]=[f,d]}}this._destroyUnusedLabels()}_updateStyle({textColor:e,backgroundColor:t}){let n=this._nextLabelIndex,r=this._labelInfos;for(let i=0;i<n;++i){let{label:n}=r[i];n.textColor=e,n.backgroundColor=t}}_updateLabelMeasurement(e,t,n,r,i){return c(this._debouncedLabelUpdates,r,()=>u(async(e,t,n,r,i)=>{let{spatialReference:a,coordinateHelper:o}=e.editGeometryOperations.data,s=await(!i||j(i)?this._measurementWorker.autoDistance2DBetweenPoints(o.arrayToPoint(t),o.arrayToPoint(n)):this._measurementWorker.autoLength2D(new O({spatialReference:a,curvePaths:[[[t[0],t[1]],i]]})));if(r.destroyed)return;let c=this._messagesUnits,l=L(e.view);r.text=c!=null&&s!=null&&!Number.isNaN(s.value)?d(c,s,l):``}))(e,T(t),T(n),r,i?M(i):void 0)}_addLabel(e,t,n,r,i,a,o,s=!1){let{label:c,wasReused:l}=this._getOrCreateLabel(e);if(!this.visible||v(n,a)<3025){c.visible=!1;return}let{coordinateHelper:u}=e.editGeometryOperations.data;(!s||!l)&&this._updatingHandles.consumePromise(this._updateLabelMeasurement(e,t,r,c,i)),c.visible=!0;let d=a[0]-n[0],f=a[1]-n[1];if(o?y(W,-f,d):y(W,f,-d),b(W,W),x(W,W,this._edgeDistancePixels),i&&!j(i)){let n=u.arrayToXYZ(N(t,i,.5)),r=this.toScreenPointArray(e,n);S(G,r,W)}else C(G,n,a,.5),S(G,G,W);c.position=[G[0],G[1]],c.anchor=Math.abs(W[0])>Math.abs(W[1])?W[0]>0?`left`:`right`:-W[1]<0?`top`:`bottom`}_getOrCreateLabel(e){let t=this._labelInfos.length>this._nextLabelIndex,{textColor:n,backgroundColor:r}=this._colors;if(t){let e=this._labelInfos[this._nextLabelIndex++],{label:t}=e;return t.textColor=n,t.backgroundColor=r,e.wasReused=!0,e}let i=new R({anchor:`center`,fontSize:8,textColor:n,backgroundColor:r});e.view.overlay?.items.add(i);let a={label:i,wasReused:!1};return this._labelInfos.push(a),this._nextLabelIndex=this._labelInfos.length,a}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){this.context?.view.overlay?.items.remove(e),e.destroy(),this._debouncedLabelUpdates.delete(e)}_refreshMessages(){this._messageUnitsTask?.abort(),this._messageUnitsTask=i(()=>P(`esri/core/t9n/Units`))}};e([g()],V.prototype,`context`,void 0),e([g()],V.prototype,`stagedVertex`,void 0),e([g()],V.prototype,`visible`,void 0),e([g()],V.prototype,`edgeDistance`,void 0),e([g()],V.prototype,`updating`,null),e([g()],V.prototype,`_messageUnitsTask`,void 0),e([g()],V.prototype,`_messagesUnits`,null),e([g()],V.prototype,`_edgeDistancePixels`,null),e([g()],V.prototype,`_colors`,null),V=e([_(`esri.views.interactive.SegmentLabels`)],V);function H(e,t,n,r){if(t.type===`2d`)return!0;let i=m(r)??1,a=h(r),o=e=>F(t,e,r,n,I)??0;for(let t=1;t<e.length;++t){let n=e[t-1],r=e[t];if(!E(n)||!E(r))return!1;let s=(r[0]-n[0])*i,c=(r[1]-n[1])*i,l=(o(r)-o(n))*a;if(Math.abs(l)/Math.sqrt(s*s+c*c)>U)return!1}return!0}const U=l(5),W=w(),G=w(),K=p(),q=p();export{V as SegmentLabels};
2
+ import{__decorate as e}from"tslib";import t from"../../Color.js";import{onLocaleChange as n}from"../../intl.js";import r from"../../core/Accessor.js";import{createTask as i}from"../../core/asyncUtils.js";import{multiplyOpacity as a,getContrast as o}from"../../core/colorUtils.js";import{makeHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import{getOrCreateMapValue as c}from"../../core/MapUtils.js";import{deg2rad as l}from"../../core/mathUtils.js";import{debounce as u}from"../../core/promiseUtils.js";import{formatLength as d}from"../../core/quantityFormatUtils.js";import{on as f}from"../../core/reactiveUtils.js";import{createScreenPointArray as p}from"../../core/screenUtils.js";import{getMetersPerUnit as m,getMetersPerVerticalUnitForSR as h}from"../../core/units.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{squaredDistance as v,set as y,normalize as b,scale as x,add as S,lerp as C}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as w}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{clone as T}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isVec3 as E}from"../../core/libs/gl-matrix-2/types/vec3.js";import{UpdatingHandles as D}from"../../core/support/UpdatingHandles.js";import O from"../../geometry/Polyline.js";import{isClockwise as k}from"../../geometry/support/coordsUtils.js";import{getEndpoint as A,isCoordinate as j,cloneCurve as M}from"../../geometry/support/curves/curveUtils.js";import{interpolate2D as N}from"../../geometry/support/curves/interpolateCurve.js";import{fetchMessageBundle as P}from"../../intl/messages.js";import{getConvertedElevationFromVector as F,absoluteHeightElevationInfo as I}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as L}from"../../support/getDefaultUnitForView.js";import R from"../overlay/TextOverlayItem.js";import{GeometryWorkerHandle as z}from"../support/GeometryWorkerHandle.js";const B={default:15,far:25};let V=class extends r{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance=`default`,this._updatingHandles=new D,this._messageUnitsTask=null,this._labelInfos=[],this._nextLabelIndex=0,this._debouncedLabelUpdates=new Map,this._measurementWorker=new z({preloadGeodetic:!0})}initialize(){this.addHandles([this._updatingHandles.add(()=>[this.context!=null&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits],()=>this._update()),f(()=>this.context?.editGeometryOperations,[`vertex-add`,`vertex-remove`],()=>this._update()),f(()=>this.context?.editGeometryOperations,`vertex-update`,e=>this._update(e.vertices)),this._updatingHandles.add(()=>this._colors,e=>this._updateStyle(e)),n(()=>this._refreshMessages()),s(()=>this._messageUnitsTask?.abort())]),this._refreshMessages()}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop());this._measurementWorker.destroy(),this._updatingHandles.destroy()}get updating(){return!this._messageUnitsTask?.finished||this._updatingHandles.updating}get test(){}get _messagesUnits(){return this._messageUnitsTask?.value}get _edgeDistancePixels(){return B[this.edgeDistance]}get _colors(){let e=this.context?.view.effectiveTheme.textColor??t.fromArray([255,255,255]);return{textColor:e,backgroundColor:a(o(e,160),.6)}}_update(e){if(this.destroyed)return;this._nextLabelIndex=0;let{context:t,stagedVertex:n}=this;if(!t)return this._destroyUnusedLabels();let r=t.editGeometryOperations.data,{parts:i,geometry:a,coordinateHelper:o}=r;if(!a)return this._destroyUnusedLabels();let s=i.length;for(let i=0;i<s;++i){let c=this.getRing(a,r,n,o,i),l=c.map(e=>E(e)?e:o.arrayToXYZ(A(e)));if(c.length<2||!H(c,t.view,t.elevationInfo,o.spatialReference))continue;let u=s===1&&!k(l),d=K,f=q;this.toScreenPointArray(t,l[0],d);for(let n=1;n<c.length;++n){let r=l[n-1],a=l[n],o=c[n];this.toScreenPointArray(t,a,f);let s=n===l.length-1,p=!(!e?.length||e.some(({index:e,part:t})=>t.index===i&&(e===n-1||e===n||s&&e===0)));this._addLabel(t,r,d,a,E(o)?null:o,f,u,p),[d,f]=[f,d]}}this._destroyUnusedLabels()}_updateStyle({textColor:e,backgroundColor:t}){let n=this._nextLabelIndex,r=this._labelInfos;for(let i=0;i<n;++i){let{label:n}=r[i];n.textColor=e,n.backgroundColor=t}}_updateLabelMeasurement(e,t,n,r,i){return c(this._debouncedLabelUpdates,r,()=>u(async(e,t,n,r,i)=>{let{spatialReference:a,coordinateHelper:o}=e.editGeometryOperations.data,s=await(!i||j(i)?this._measurementWorker.autoDistance2DBetweenPoints(o.arrayToPoint(t),o.arrayToPoint(n)):this._measurementWorker.autoLength2D(new O({spatialReference:a,curvePaths:[[[t[0],t[1]],i]]})));if(r.destroyed)return;let c=this._messagesUnits,l=L(e.view);r.text=c!=null&&s!=null&&!Number.isNaN(s.value)?d(c,s,l):``}))(e,T(t),T(n),r,i?M(i):void 0)}_addLabel(e,t,n,r,i,a,o,s=!1){let{label:c,wasReused:l}=this._getOrCreateLabel(e);if(!this.visible||v(n,a)<3025){c.visible=!1;return}let{coordinateHelper:u}=e.editGeometryOperations.data;s&&l||this._updatingHandles.consumePromise(this._updateLabelMeasurement(e,t,r,c,i)),c.visible=!0;let d=a[0]-n[0],f=a[1]-n[1];if(o?y(W,-f,d):y(W,f,-d),b(W,W),x(W,W,this._edgeDistancePixels),i&&!j(i)){let n=u.arrayToXYZ(N(t,i,.5)),r=this.toScreenPointArray(e,n);S(G,r,W)}else C(G,n,a,.5),S(G,G,W);c.position=[G[0],G[1]],c.anchor=Math.abs(W[0])>Math.abs(W[1])?W[0]>0?`left`:`right`:-W[1]<0?`top`:`bottom`}_getOrCreateLabel(e){let t=this._labelInfos.length>this._nextLabelIndex,{textColor:n,backgroundColor:r}=this._colors;if(t){let e=this._labelInfos[this._nextLabelIndex++],{label:t}=e;return t.textColor=n,t.backgroundColor=r,e.wasReused=!0,e}let i=new R({anchor:`center`,fontSize:8,textColor:n,backgroundColor:r});e.view.overlay?.items.add(i);let a={label:i,wasReused:!1};return this._labelInfos.push(a),this._nextLabelIndex=this._labelInfos.length,a}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){this.context?.view.overlay?.items.remove(e),e.destroy(),this._debouncedLabelUpdates.delete(e)}_refreshMessages(){this._messageUnitsTask?.abort(),this._messageUnitsTask=i(()=>P(`esri/core/t9n/Units`))}};e([g()],V.prototype,`context`,void 0),e([g()],V.prototype,`stagedVertex`,void 0),e([g()],V.prototype,`visible`,void 0),e([g()],V.prototype,`edgeDistance`,void 0),e([g()],V.prototype,`updating`,null),e([g()],V.prototype,`_messageUnitsTask`,void 0),e([g()],V.prototype,`_messagesUnits`,null),e([g()],V.prototype,`_edgeDistancePixels`,null),e([g()],V.prototype,`_colors`,null),V=e([_(`esri.views.interactive.SegmentLabels`)],V);function H(e,t,n,r){if(t.type===`2d`)return!0;let i=m(r)??1,a=h(r),o=e=>F(t,e,r,n,I)??0;for(let t=1;t<e.length;++t){let n=e[t-1],r=e[t];if(!E(n)||!E(r))return!1;let s=(r[0]-n[0])*i,c=(r[1]-n[1])*i,l=(o(r)-o(n))*a;if(Math.abs(l)/Math.sqrt(s*s+c*c)>U)return!1}return!0}const U=l(5),W=w(),G=w(),K=p(),q=p();export{V as SegmentLabels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{equals as e,pushIfSome as t}from"../../../core/arrayUtils.js";import{Evented as n}from"../../../core/Evented.js";import r from"../../../geometry/Multipoint.js";import i from"../../../geometry/Polygon.js";import a from"../../../geometry/Polyline.js";import{getEndpoint as o,isCoordinate as s,isBezierCurve as c,isCircularArc as l,isEllipticArc4 as u}from"../../../geometry/support/curves/curveUtils.js";import{createCoordinateHelper as d}from"../coordinateHelper.js";import{unnormalize as f}from"../../support/unnormalizationUtils.js";class p{constructor(e){this.part=e,this.leftSegment=null,this.rightSegment=null,this.type=`vertex`,this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.part.unnormalizeVertexPositions()}}class m{constructor(e,t,n){this.part=e,this.leftVertex=t,this.rightVertex=n,this.type=`line`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class h{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`bezier`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class g{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`circular-arc`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{interiorPoint:t}=this.curveDefinition;return{c:[[...e],[...t]]}}}class _{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-4`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r}=this.curveDefinition;return{a:[[...e],[...t],n,r]}}}class v{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-7`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r,rotation:i,semiMajorAxisLength:a,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...e],t,n,r,i,a,o]}}}class y{constructor(e,t,n=!1){this._spatialReference=e,this._viewingMode=t,this.autoClose=n,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||this._viewingMode===1&&f(this.vertices,this._spatialReference)}updateVertexIndex(e,t){let{vertices:n}=this;if(n.length===0)return;let r=n[0],i=null,a=e,o=t;do i=a,i.index=o++,a=i.rightSegment?i.rightSegment.rightVertex:null;while(a!=null&&a!==r);i.leftSegment&&i!==n[n.length-1]&&this.swapVertices(n.indexOf(i),n.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return this.getFirstVertex()?.leftSegment!=null}swapVertices(e,t){let{vertices:n}=this,r=n[e];n[e]=n[t],n[t]=r}*iterateVertices(){let e=this.getFirstVertex(),t=e;if(t)do yield t,t=t.rightSegment?.rightVertex;while(t!==e&&t!=null)}}class b extends n{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.parts=[]}get geometry(){if(this._dirty){switch(this.type){case`point`:this._geometry=this._toPoint();break;case`multipoint`:this._geometry=this._toMultipoint();break;case`polyline`:this._geometry=this._toPolyline();break;case`polygon`:this._geometry=this._toPolygon();break;case`mesh`:break;default:this.type}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(let e of this.parts)for(let t of e.vertices)yield t}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(let e of this.parts)yield*e.iterateVertices()}notifyChanges(e){this._dirty=!0,this.emit(`change`,e)}getPartialGeometry(e,t,n){let{parts:r,hasCurves:i}=w(this,{startingVertex:e,endingVertexInclusive:t,geometryType:n});return C(r,i,n,this.coordinateHelper)}_toPoint(){let{parts:e,coordinateHelper:t}=this;return e.at(0)?.vertices.length?t.vectorToPoint(e[0].vertices[0].pos):null}_toMultipoint(){let e=[],{coordinateHelper:t,parts:n,spatialReference:i}=this;for(let r of n){let n=r.getFirstVertex();n&&e.push(t.arrayToVector(n.pos))}return new r({hasM:t.hasM(),hasZ:t.hasZ(),spatialReference:i,points:e})}_toPolyline(){let e=[],t=!1;for(let n of this.parts){if(n.vertices.length<1)continue;let r=n.vertices[0],i=[];i.push(r.pos);let a=r.rightSegment;for(;a;)t||=a.type!==`line`,i.push(a.toCurveOrCoordinate()),a=a.rightVertex.rightSegment;e.push(i)}return new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){let t=[],n=!1;for(let r of this.parts){if(r.vertices.length<1)continue;let i=r.vertices[0],a=[];a.push(i.pos);let c=i.rightSegment;for(;c&&(n||=c.type!==`line`,a.push(c.toCurveOrCoordinate()),c=c.rightVertex.rightSegment,c?.leftVertex!==i););if(r.autoClose&&a.length>1){let t=a.at(-1),n=o(a[0]),r=o(t);(a.length!==2||!s(t))&&!e(n,r)&&a.push(n)}t.push(a)}return new i({rings:n?void 0:t,curveRings:n?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t,n){let r=e.spatialReference,i=d(e.hasZ,e.hasM,r),a=new b(e.type,i);switch(e.type){case`polygon`:T(a,e,t,n?.allowCurves??!1);break;case`polyline`:E(a,e,t,n?.allowCurves??!1);break;case`point`:D(a,e,t);break;case`multipoint`:O(a,e,t);break;case`mesh`:D(a,e.origin,t),a._geometry=e,a._dirty=!1}return a}}function x(e,t,n,r){let i=new p(e);e.vertices.push(i);let a=o(r);return i.pos=t.arrayToVector(a),i.index=e.vertices.length-1,n&&e.segments.push(S(e,n,i,r)),i}function S(e,t,n,r){if(s(r))return new m(e,t,n);if(c(r)){let[,i,a]=r.b;return new h(e,t,n,{controlPoint1:[...i],controlPoint2:[...a]})}if(l(r)){let[,i]=r.c;return new g(e,t,n,{interiorPoint:[...i]})}if(u(r)){let[,i,a,o]=r.a;return new _(e,t,n,{centerPoint:[...i],sweep:a,orientation:o})}let[,i,a,o,d,f,p]=r.a;return new v(e,t,n,{centerPoint:[...i],sweep:a,orientation:o,rotation:d,semiMajorAxisLength:f,minorMajorAxisRatio:p})}function C(e,t,n,s){let{spatialReference:c}=s;if(n===`point`){let t=e.at(0)?.at(0);return t?s.arrayToPoint(o(t)):null}return n===`polygon`?new i({rings:t?void 0:e,curveRings:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()}):n===`multipoint`?new r({spatialReference:c,points:e.flatMap(e=>e.map(e=>o(e))),hasM:s.hasM(),hasZ:s.hasZ()}):new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()})}function w(n,r){let i=(r?.geometryType??n.type)===`polygon`,a=[],c=!1,l=!1,u=!1;for(let d of n.parts){let n=null;if(u)break;if(d.vertices.length<1)continue;if(r?.startingVertex){if(d!==r.startingVertex.part&&!l)continue;l=!0}let f=d===r?.startingVertex?.part?r.startingVertex:d.vertices.at(0),p=[];if(t(p,f?.pos),f===r?.endingVertexInclusive){u=!0,n=f,a.push(p);break}let m=f?.rightSegment;for(;m;){if(c||=m.type!==`line`,p.push(m.toCurveOrCoordinate()),n=m.rightVertex,m.rightVertex===r?.endingVertexInclusive){u=!0;break}if(m=m.rightVertex.rightSegment,m?.leftVertex===f)break}let h=p.at(-1),g=d.getFirstVertex(),_=d.getLastVertex();i&&d.autoClose&&h&&n===_&&f===g&&(p.length>2||p.length===2&&!s(h))&&f?.pos&&!e(o(h),f.pos)&&p.push([...f.pos]),a.push(p)}return{parts:a,hasCurves:c}}function T(t,n,r,i){let a=n.spatialReference,s=t.coordinateHelper,{rings:c,curveRings:l}=n,u=l&&i?l:c;for(let n=0;n<u.length;++n){let i=u[n],c=new y(a,r);if(c.index=n,t.parts.push(c),i.length<1)continue;let l=null,d=null;for(let e=0;e<i.length-1;++e)d=x(c,s,d,i[e]),l??=d;i.length>1&&e(o(i[i.length-1]),l?.pos)?d&&l&&c.segments.push(S(c,d,l,i[i.length-1])):d=x(c,s,d,i[i.length-1])}}function E(e,t,n,r){let i=t.spatialReference,a=e.coordinateHelper,{curvePaths:o,paths:s}=t,c=o&&r?o:s;for(let t=0;t<c.length;++t){let r=c[t],o=new y(i,n);if(o.index=t,e.parts.push(o),r.length<1)continue;let s=null;for(let e=0;e<r.length;++e)s=x(o,a,s,r[e])}}function D(e,t,n){let r=t.spatialReference,i=e.coordinateHelper,a=new y(r,n);a.index=0;let o=new p(a);o.index=0,o.pos=i.pointToVector(t),a.vertices.push(o),e.parts.push(a)}function O(e,t,n){let r=t.spatialReference,{coordinateHelper:i,parts:a}=e,o=t.points.map(e=>i.arrayToVector(e));for(let e=0;e<o.length;e++){let t=new y(r,n);t.index=e,a.push(t);let i=new p(t);i.pos=o[e],i.index=0,t.vertices.push(i)}}function k(e){return e.type===`mesh`}function A(e,t){if(e.type!==t.type||e.parts.length!==t.parts.length)return!1;for(let n=0;n<e.parts.length;n++){let r=e.parts[n],i=t.parts[n];if(r.vertices.length!==i.vertices.length)return!1}let n=e.allVertices,r=t.allVertices;for(let e=0;e<n.length;e++)if(n[e].leftSegment?.type!==r[e].leftSegment?.type)return!1;return!0}export{h as BezierSegment,g as CircularArcSegment,b as EditGeometry,_ as EllipticArc4Segment,v as EllipticArc7Segment,m as LineSegment,y as Part,p as Vertex,x as addVertexAndConnectingSegment,S as createConnectingSegment,A as haveCompatibleTopologies,k as isMeshEditGeometry,C as partialCoordsToGeometry,w as toPartialCoords};
2
+ import{equals as e,pushIfSome as t}from"../../../core/arrayUtils.js";import{Evented as n}from"../../../core/Evented.js";import r from"../../../geometry/Multipoint.js";import i from"../../../geometry/Polygon.js";import a from"../../../geometry/Polyline.js";import{getEndpoint as o,isCoordinate as s,isBezierCurve as c,isCircularArc as l,isEllipticArc4 as u}from"../../../geometry/support/curves/curveUtils.js";import{createCoordinateHelper as d}from"../coordinateHelper.js";import{unnormalize as f}from"../../support/unnormalizationUtils.js";class p{constructor(e){this.part=e,this.leftSegment=null,this.rightSegment=null,this.type=`vertex`,this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.part.unnormalizeVertexPositions()}}class m{constructor(e,t,n){this.part=e,this.leftVertex=t,this.rightVertex=n,this.type=`line`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class h{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`bezier`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class g{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`circular-arc`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{interiorPoint:t}=this.curveDefinition;return{c:[[...e],[...t]]}}}class _{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-4`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r}=this.curveDefinition;return{a:[[...e],[...t],n,r]}}}class v{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-7`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r,rotation:i,semiMajorAxisLength:a,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...e],t,n,r,i,a,o]}}}class y{constructor(e,t,n=!1){this._spatialReference=e,this._viewingMode=t,this.autoClose=n,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||this._viewingMode===1&&f(this.vertices,this._spatialReference)}updateVertexIndex(e,t){let{vertices:n}=this;if(n.length===0)return;let r=n[0],i=null,a=e,o=t;do i=a,i.index=o++,a=i.rightSegment?i.rightSegment.rightVertex:null;while(a!=null&&a!==r);i.leftSegment&&i!==n[n.length-1]&&this.swapVertices(n.indexOf(i),n.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return this.getFirstVertex()?.leftSegment!=null}swapVertices(e,t){let{vertices:n}=this,r=n[e];n[e]=n[t],n[t]=r}*iterateVertices(){let e=this.getFirstVertex(),t=e;if(t)do yield t,t=t.rightSegment?.rightVertex;while(t!==e&&t!=null)}}class b extends n{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.parts=[]}get geometry(){if(this._dirty){switch(this.type){case`point`:this._geometry=this._toPoint();break;case`multipoint`:this._geometry=this._toMultipoint();break;case`polyline`:this._geometry=this._toPolyline();break;case`polygon`:this._geometry=this._toPolygon();break;case`mesh`:break;default:this.type}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(let e of this.parts)for(let t of e.vertices)yield t}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(let e of this.parts)yield*e.iterateVertices()}notifyChanges(e){this._dirty=!0,this.emit(`change`,e)}getPartialGeometry(e,t,n){let{parts:r,hasCurves:i}=w(this,{startingVertex:e,endingVertexInclusive:t,geometryType:n});return C(r,i,n,this.coordinateHelper)}_toPoint(){let{parts:e,coordinateHelper:t}=this;return e.at(0)?.vertices.length?t.vectorToPoint(e[0].vertices[0].pos):null}_toMultipoint(){let e=[],{coordinateHelper:t,parts:n,spatialReference:i}=this;for(let r of n){let n=r.getFirstVertex();n&&e.push(t.arrayToVector(n.pos))}return new r({hasM:t.hasM(),hasZ:t.hasZ(),spatialReference:i,points:e})}_toPolyline(){let e=[],t=!1;for(let n of this.parts){if(n.vertices.length<1)continue;let r=n.vertices[0],i=[];i.push(r.pos);let a=r.rightSegment;for(;a;)t||=a.type!==`line`,i.push(a.toCurveOrCoordinate()),a=a.rightVertex.rightSegment;e.push(i)}return new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){let t=[],n=!1;for(let r of this.parts){if(r.vertices.length<1)continue;let i=r.vertices[0],a=[];a.push(i.pos);let c=i.rightSegment;for(;c&&(n||=c.type!==`line`,a.push(c.toCurveOrCoordinate()),c=c.rightVertex.rightSegment,c?.leftVertex!==i););if(r.autoClose&&a.length>1){let t=a.at(-1),n=o(a[0]),r=o(t);a.length===2&&s(t)||e(n,r)||a.push(n)}t.push(a)}return new i({rings:n?void 0:t,curveRings:n?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t,n){let r=e.spatialReference,i=d(e.hasZ,e.hasM,r),a=new b(e.type,i);switch(e.type){case`polygon`:T(a,e,t,n?.allowCurves??!1);break;case`polyline`:E(a,e,t,n?.allowCurves??!1);break;case`point`:D(a,e,t);break;case`multipoint`:O(a,e,t);break;case`mesh`:D(a,e.origin,t),a._geometry=e,a._dirty=!1}return a}}function x(e,t,n,r){let i=new p(e);e.vertices.push(i);let a=o(r);return i.pos=t.arrayToVector(a),i.index=e.vertices.length-1,n&&e.segments.push(S(e,n,i,r)),i}function S(e,t,n,r){if(s(r))return new m(e,t,n);if(c(r)){let[,i,a]=r.b;return new h(e,t,n,{controlPoint1:[...i],controlPoint2:[...a]})}if(l(r)){let[,i]=r.c;return new g(e,t,n,{interiorPoint:[...i]})}if(u(r)){let[,i,a,o]=r.a;return new _(e,t,n,{centerPoint:[...i],sweep:a,orientation:o})}let[,i,a,o,d,f,p]=r.a;return new v(e,t,n,{centerPoint:[...i],sweep:a,orientation:o,rotation:d,semiMajorAxisLength:f,minorMajorAxisRatio:p})}function C(e,t,n,s){let{spatialReference:c}=s;if(n===`point`){let t=e.at(0)?.at(0);return t?s.arrayToPoint(o(t)):null}return n===`polygon`?new i({rings:t?void 0:e,curveRings:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()}):n===`multipoint`?new r({spatialReference:c,points:e.flatMap(e=>e.map(e=>o(e))),hasM:s.hasM(),hasZ:s.hasZ()}):new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()})}function w(n,r){let i=(r?.geometryType??n.type)===`polygon`,a=[],c=!1,l=!1,u=!1;for(let d of n.parts){let n=null;if(u)break;if(d.vertices.length<1)continue;if(r?.startingVertex){if(d!==r.startingVertex.part&&!l)continue;l=!0}let f=d===r?.startingVertex?.part?r.startingVertex:d.vertices.at(0),p=[];if(t(p,f?.pos),f===r?.endingVertexInclusive){u=!0,n=f,a.push(p);break}let m=f?.rightSegment;for(;m;){if(c||=m.type!==`line`,p.push(m.toCurveOrCoordinate()),n=m.rightVertex,m.rightVertex===r?.endingVertexInclusive){u=!0;break}if(m=m.rightVertex.rightSegment,m?.leftVertex===f)break}let h=p.at(-1),g=d.getFirstVertex(),_=d.getLastVertex();i&&d.autoClose&&h&&n===_&&f===g&&(p.length>2||p.length===2&&!s(h))&&f?.pos&&!e(o(h),f.pos)&&p.push([...f.pos]),a.push(p)}return{parts:a,hasCurves:c}}function T(t,n,r,i){let a=n.spatialReference,s=t.coordinateHelper,{rings:c,curveRings:l}=n,u=l&&i?l:c;for(let n=0;n<u.length;++n){let i=u[n],c=new y(a,r);if(c.index=n,t.parts.push(c),i.length<1)continue;let l=null,d=null;for(let e=0;e<i.length-1;++e)d=x(c,s,d,i[e]),l??=d;i.length>1&&e(o(i[i.length-1]),l?.pos)?d&&l&&c.segments.push(S(c,d,l,i[i.length-1])):d=x(c,s,d,i[i.length-1])}}function E(e,t,n,r){let i=t.spatialReference,a=e.coordinateHelper,{curvePaths:o,paths:s}=t,c=o&&r?o:s;for(let t=0;t<c.length;++t){let r=c[t],o=new y(i,n);if(o.index=t,e.parts.push(o),r.length<1)continue;let s=null;for(let e=0;e<r.length;++e)s=x(o,a,s,r[e])}}function D(e,t,n){let r=t.spatialReference,i=e.coordinateHelper,a=new y(r,n);a.index=0;let o=new p(a);o.index=0,o.pos=i.pointToVector(t),a.vertices.push(o),e.parts.push(a)}function O(e,t,n){let r=t.spatialReference,{coordinateHelper:i,parts:a}=e,o=t.points.map(e=>i.arrayToVector(e));for(let e=0;e<o.length;e++){let t=new y(r,n);t.index=e,a.push(t);let i=new p(t);i.pos=o[e],i.index=0,t.vertices.push(i)}}function k(e){return e.type===`mesh`}function A(e,t){if(e.type!==t.type||e.parts.length!==t.parts.length)return!1;for(let n=0;n<e.parts.length;n++){let r=e.parts[n],i=t.parts[n];if(r.vertices.length!==i.vertices.length)return!1}let n=e.allVertices,r=t.allVertices;for(let e=0;e<n.length;e++)if(n[e].leftSegment?.type!==r[e].leftSegment?.type)return!1;return!0}export{h as BezierSegment,g as CircularArcSegment,b as EditGeometry,_ as EllipticArc4Segment,v as EllipticArc7Segment,m as LineSegment,y as Part,p as Vertex,x as addVertexAndConnectingSegment,S as createConnectingSegment,A as haveCompatibleTopologies,k as isMeshEditGeometry,C as partialCoordsToGeometry,w as toPartialCoords};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{Evented as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{clone as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isMeshEditGeometry as r,Part as i,EditGeometry as a,haveCompatibleTopologies as o}from"./EditGeometry.js";import{AppendVertex as s}from"./operations/AppendVertex.js";import{UpdateVertices as c}from"./operations/UpdateVertices.js";import{RemoveVertices as l}from"./operations/RemoveVertices.js";import{SplitSegment as u}from"./operations/SplitSegment.js";import{SetVertexPosition as d}from"./operations/SetVertexPosition.js";import{ClosePart as f}from"./operations/ClosePart.js";import{AddOrUpdatePart as p}from"./operations/AddOrUpdatePart.js";import{MoveMesh as m}from"./operations/MoveMesh.js";import{MoveVertex as h}from"./operations/MoveVertex.js";import{OffsetEdgeVertex as g}from"./operations/OffsetEdgeVertex.js";import{RotateVertex as _}from"./operations/RotateVertex.js";import{ScaleVertex as v}from"./operations/ScaleVertex.js";import{SetAllVertexPositions as y}from"./operations/SetAllVertexPositions.js";import{UndoGroup as b}from"./operations/UndoGroup.js";class x extends e{constructor(e,t,n=!1){super(),this.data=e,this.viewingMode=t,this.allowCurves=n,this._undoStack=[],this._redoStack=[],this.disableDefaultRedoBehavior=!1,this._listener=this.data.on(`change`,e=>{e.addedVertices&&this.emit(`vertex-add`,{type:`vertex-add`,vertices:e.addedVertices,operation:e.operation}),e.removedVertices&&this.emit(`vertex-remove`,{type:`vertex-remove`,vertices:e.removedVertices,operation:e.operation}),e.updatedVertices&&this.emit(`vertex-update`,{type:`vertex-update`,vertices:e.updatedVertices,operation:e.operation})})}destroy(){super.destroy(),this._listener.remove()}splitSegment(e,t){return this._apply(new u(this.data,e,t))}updateVertices(e,t,n=1){return this._apply(new c(this.data,e,t),n)}move(e,t,n,i=1){return r(this.data)?this._apply(new m(this.data,e,t,n),i):this.moveVertices(this.data.allVerticesUnordered,e,t,n,i)}moveVertices(e,t,n,i,a=1){return r(this.data)?this._apply(new m(this.data,t,n,i),a):this.updateVertices(e,new h(this.data.coordinateHelper,t,n,i),a)}scale(e,t,n,r,i=1,a=0){return this.scaleVertices(this.data.allVerticesUnordered,e,t,n,r,i,a)}scaleVertices(e,t,n,r,i,a=1,o=0){return this.updateVertices(e,new v(t,n,r,i,o),a)}rotate(e,t,n=1,r=0){return this.rotateVertices(this.data.allVerticesUnordered,e,t,n,r)}rotateVertices(e,t,n,r=1,i=0){return this.updateVertices(e,new _(t,n,i),r)}removeVertices(e){return this._apply(new l(this.data,e,this._minNumVerticesPerType))}appendVertex(e,t,n){return t??=new i(this.data.spatialReference,this.viewingMode,n),this._apply(new s(this.data,t,e))}appendVertexToFirstPart(e){let t=this.data.parts.at(0);return t?this._apply(new s(this.data,t,e)):null}addOrUpdatePart(e,t){return this._apply(new p(this.data,e,t,this.viewingMode))}setVertexPosition(e,t){return this._apply(new d(this.data,e,t))}offsetEdge(e,t,n,r=1){return this.updateVertices([t.leftVertex,t.rightVertex],new g(this.data.coordinateHelper,e,t,n),r)}trySetGeometry(e,t=1){let{data:n}=this,{coordinateHelper:i}=n;if(n.type!==e.type||!n.spatialReference.equals(e.spatialReference)||i.hasZ()!==e.hasZ||i.hasM()!==e.hasM||r(n))return;let s=a.fromGeometry(e,this.viewingMode,{allowCurves:this.allowCurves});if(o(n,s))return this.overwriteGeometryDataInPlace(s,t)}overwriteGeometryDataInPlace(e,t=1){return this._apply(new y(this.data,e),t)}createResetState(){if(r(this.data))return this._createResetStateMesh();let e=this.data.geometry.clone();return t(()=>this.trySetGeometry(e))}closePart(e){return this.data.parts.includes(e)?this._apply(new f(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){let e=new b;return this._apply(e),t(()=>e.close())}groupOperations(e){let t=[],{_undoStack:n}=this;for(;n.length>0;){let r=n.at(-1);if(!r||!e(r))break;n.pop(),t.push(r)}if(t.length>0){let e=new b(t.reverse());return this.recordUndo(e,!0),{group:e,operations:t}}return null}recordUndo(e,t){let n=this.canUndo;this._undoStack.push(e),t&&this.resetRedoStack(),this.emit(`can-redo-change`,{type:`can-redo-change`,canRedo:this.canRedo}),n!==this.canUndo&&this.emit(`can-undo-change`,{type:`can-undo-change`,canUndo:this.canUndo})}recordRedo(e){if(this.disableDefaultRedoBehavior)return;let t=this.canRedo;this._redoStack.push(e),t||this.emit(`can-redo-change`,{type:`can-redo-change`,canRedo:!0})}undo(){if(this._undoStack.length>0){let e=this.canUndo,t=this._undoStack.pop();return t.undo(),this.recordRedo(t),e!==this.canUndo&&this.emit(`can-undo-change`,{type:`can-undo-change`,canUndo:this.canUndo}),t}return null}redo(){if(this._redoStack.length>0){let e=this._redoStack.pop();return e.apply(),this.recordUndo(e,!1),e}return null}resetRedoStack(){this.disableDefaultRedoBehavior||(this._redoStack=[],this.emit(`redo-reset`,{type:`redo-reset`}))}undoHas(e){return this._undoStack.includes(e)}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}get lastOperation(){return this._undoStack.length>0?this._undoStack[this._undoStack.length-1]:null}get nextOperation(){return this._redoStack.length>0?this._redoStack[this._redoStack.length-1]:null}get test(){return{undoLength:this._undoStack.length,redoLength:this._redoStack.length}}get _minNumVerticesPerType(){switch(this.data.type){case`point`:return 1;case`polyline`:return 2;case`polygon`:return 3;default:return 0}}_apply(e,t=1){return(t===0||!this.lastOperation?.accumulate(e))&&(e.apply(),this.recordUndo(e,!0)),e}_createResetStateMesh(){if(!r(this.data))return t();let e=this.data.geometry,{vertexSpace:i}=e;if(i.origin){let r=n(i.origin);return t(()=>{e.vertexSpace.origin=r})}let a=e.vertexAttributes.clonePositional();return t(()=>{e.vertexAttributes=a,e.vertexAttributesChanged()})}static fromGeometry(e,t,n){return new x(a.fromGeometry(e,t,n),t,n?.allowCurves)}}export{x as EditGeometryOperations};
2
+ import{Evented as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{clone as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isMeshEditGeometry as r,Part as i,EditGeometry as a,haveCompatibleTopologies as o}from"./EditGeometry.js";import{AppendVertex as s}from"./operations/AppendVertex.js";import{UpdateVertices as c}from"./operations/UpdateVertices.js";import{RemoveVertices as l}from"./operations/RemoveVertices.js";import{SplitSegment as u}from"./operations/SplitSegment.js";import{SetVertexPosition as d}from"./operations/SetVertexPosition.js";import{ClosePart as f}from"./operations/ClosePart.js";import{AddOrUpdatePart as p}from"./operations/AddOrUpdatePart.js";import{MoveMesh as m}from"./operations/MoveMesh.js";import{MoveVertex as h}from"./operations/MoveVertex.js";import{OffsetEdgeVertex as g}from"./operations/OffsetEdgeVertex.js";import{RotateVertex as _}from"./operations/RotateVertex.js";import{ScaleVertex as v}from"./operations/ScaleVertex.js";import{SetAllVertexPositions as y}from"./operations/SetAllVertexPositions.js";import{UndoGroup as b}from"./operations/UndoGroup.js";class x extends e{constructor(e,t,n=!1){super(),this.data=e,this.viewingMode=t,this.allowCurves=n,this._undoStack=[],this._redoStack=[],this.disableDefaultRedoBehavior=!1,this._listener=this.data.on(`change`,e=>{e.addedVertices&&this.emit(`vertex-add`,{type:`vertex-add`,vertices:e.addedVertices,operation:e.operation}),e.removedVertices&&this.emit(`vertex-remove`,{type:`vertex-remove`,vertices:e.removedVertices,operation:e.operation}),e.updatedVertices&&this.emit(`vertex-update`,{type:`vertex-update`,vertices:e.updatedVertices,operation:e.operation})})}destroy(){super.destroy(),this._listener.remove()}splitSegment(e,t){return this._apply(new u(this.data,e,t))}updateVertices(e,t,n=1){return this._apply(new c(this.data,e,t),n)}move(e,t,n,i=1){return r(this.data)?this._apply(new m(this.data,e,t,n),i):this.moveVertices(this.data.allVerticesUnordered,e,t,n,i)}moveVertices(e,t,n,i,a=1){return r(this.data)?this._apply(new m(this.data,t,n,i),a):this.updateVertices(e,new h(this.data.coordinateHelper,t,n,i),a)}scale(e,t,n,r,i=1,a=0){return this.scaleVertices(this.data.allVerticesUnordered,e,t,n,r,i,a)}scaleVertices(e,t,n,r,i,a=1,o=0){return this.updateVertices(e,new v(t,n,r,i,o),a)}rotate(e,t,n=1,r=0){return this.rotateVertices(this.data.allVerticesUnordered,e,t,n,r)}rotateVertices(e,t,n,r=1,i=0){return this.updateVertices(e,new _(t,n,i),r)}removeVertices(e){return this._apply(new l(this.data,e,this._minNumVerticesPerType))}appendVertex(e,t,n){return t??=new i(this.data.spatialReference,this.viewingMode,n),this._apply(new s(this.data,t,e))}appendVertexToFirstPart(e){let t=this.data.parts.at(0);return t?this._apply(new s(this.data,t,e)):null}addOrUpdatePart(e,t){return this._apply(new p(this.data,e,t,this.viewingMode))}setVertexPosition(e,t){return this._apply(new d(this.data,e,t))}offsetEdge(e,t,n,r=1){return this.updateVertices([t.leftVertex,t.rightVertex],new g(this.data.coordinateHelper,e,t,n),r)}trySetGeometry(e,t=1){let{data:n}=this,{coordinateHelper:i}=n;if(n.type!==e.type||!n.spatialReference.equals(e.spatialReference)||i.hasZ()!==e.hasZ||i.hasM()!==e.hasM||r(n))return;let s=a.fromGeometry(e,this.viewingMode,{allowCurves:this.allowCurves});if(o(n,s))return this.overwriteGeometryDataInPlace(s,t)}overwriteGeometryDataInPlace(e,t=1){return this._apply(new y(this.data,e),t)}createResetState(){if(r(this.data))return this._createResetStateMesh();let e=this.data.geometry.clone();return t(()=>this.trySetGeometry(e))}closePart(e){return this.data.parts.includes(e)?this._apply(new f(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){let e=new b;return this._apply(e),t(()=>e.close())}groupOperations(e){let t=[],{_undoStack:n}=this;for(;n.length>0;){let r=n.at(-1);if(!r||!e(r))break;n.pop(),t.push(r)}if(t.length>0){let e=new b(t.reverse());return this.recordUndo(e,!0),{group:e,operations:t}}return null}recordUndo(e,t){let n=this.canUndo;this._undoStack.push(e),t&&this.resetRedoStack(),this.emit(`can-redo-change`,{type:`can-redo-change`,canRedo:this.canRedo}),n!==this.canUndo&&this.emit(`can-undo-change`,{type:`can-undo-change`,canUndo:this.canUndo})}recordRedo(e){if(this.disableDefaultRedoBehavior)return;let t=this.canRedo;this._redoStack.push(e),t||this.emit(`can-redo-change`,{type:`can-redo-change`,canRedo:!0})}undo(){if(this._undoStack.length>0){let e=this.canUndo,t=this._undoStack.pop();return t.undo(),this.recordRedo(t),e!==this.canUndo&&this.emit(`can-undo-change`,{type:`can-undo-change`,canUndo:this.canUndo}),t}return null}redo(){if(this._redoStack.length>0){let e=this._redoStack.pop();return e.apply(),this.recordUndo(e,!1),e}return null}resetRedoStack(){this.disableDefaultRedoBehavior||(this._redoStack=[],this.emit(`redo-reset`,{type:`redo-reset`}))}undoHas(e){return this._undoStack.includes(e)}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}get lastOperation(){return this._undoStack.length>0?this._undoStack[this._undoStack.length-1]:null}get nextOperation(){return this._redoStack.length>0?this._redoStack[this._redoStack.length-1]:null}get test(){return{undoLength:this._undoStack.length,redoLength:this._redoStack.length}}get _minNumVerticesPerType(){switch(this.data.type){case`point`:return 1;case`polyline`:return 2;case`polygon`:return 3;default:return 0}}_apply(e,t=1){return t!==0&&this.lastOperation?.accumulate(e)||(e.apply(),this.recordUndo(e,!0)),e}_createResetStateMesh(){if(!r(this.data))return t();let e=this.data.geometry,{vertexSpace:i}=e;if(i.origin){let r=n(i.origin);return t(()=>{e.vertexSpace.origin=r})}let a=e.vertexAttributes.clonePositional();return t(()=>{e.vertexAttributes=a,e.vertexAttributesChanged()})}static fromGeometry(e,t,n){return new x(a.fromGeometry(e,t,n),t,n?.allowCurves)}}export{x as EditGeometryOperations};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{equals as e}from"../../../../core/arrayUtils.js";import{notDeepEqual as t}from"../../../../core/object.js";class n{constructor(e,t){this._editGeometry=e,this._newPositions=[],this._newSegments=[];for(let{pos:e,leftSegment:n}of t.allVertices)this._newPositions.push(e),this._newSegments.push(r(n))}apply(){let e=this._originalPositions==null?`apply`:`redo`;if(!this._originalPositions){let e=this._editGeometry.coordinateHelper;this._originalPositions=[],this._originalSegments=[];for(let{pos:t,leftSegment:n}of this._editGeometry.iterateVertices())this._originalPositions.push(e.clone(t)),this._originalSegments.push(r(n))}this._apply(e,this._newPositions,this._newSegments)}undo(){this._originalPositions&&this._originalSegments&&this._apply(`undo`,this._originalPositions,this._originalSegments)}accumulate(e){return e instanceof n&&(this._newPositions=e._newPositions,this._newSegments=e._newSegments,this._apply(`apply`,this._newPositions,this._newSegments),!0)}_apply(t,n,a){let o=this._editGeometry.coordinateHelper,s=this._editGeometry.allVertices,c=[];for(let t=0;t<s.length;t++){let l=s[t],u=n[t],d=a[t];(!e(l.pos,u)||!i(r(l.leftSegment),d))&&(c.push(s[t]),o.copy(u,l.pos),l.leftSegment&&`curveDefinition`in l.leftSegment&&d&&(l.leftSegment.curveDefinition={...d}))}this._editGeometry.parts.forEach(e=>e.unnormalizeVertexPositions()),c.length&&this._editGeometry.notifyChanges({operation:t,updatedVertices:c})}}function r(e){if(e&&e.type!==`line`)return{...e.curveDefinition}}function i(e,n){return e==null&&n==null||!!e&&!!n&&!t(e,n)}export{n as SetAllVertexPositions};
2
+ import{equals as e}from"../../../../core/arrayUtils.js";import{notDeepEqual as t}from"../../../../core/object.js";class n{constructor(e,t){this._editGeometry=e,this._newPositions=[],this._newSegments=[];for(let{pos:e,leftSegment:n}of t.allVertices)this._newPositions.push(e),this._newSegments.push(r(n))}apply(){let e=this._originalPositions==null?`apply`:`redo`;if(!this._originalPositions){let e=this._editGeometry.coordinateHelper;this._originalPositions=[],this._originalSegments=[];for(let{pos:t,leftSegment:n}of this._editGeometry.iterateVertices())this._originalPositions.push(e.clone(t)),this._originalSegments.push(r(n))}this._apply(e,this._newPositions,this._newSegments)}undo(){this._originalPositions&&this._originalSegments&&this._apply(`undo`,this._originalPositions,this._originalSegments)}accumulate(e){return e instanceof n&&(this._newPositions=e._newPositions,this._newSegments=e._newSegments,this._apply(`apply`,this._newPositions,this._newSegments),!0)}_apply(t,n,a){let o=this._editGeometry.coordinateHelper,s=this._editGeometry.allVertices,c=[];for(let t=0;t<s.length;t++){let l=s[t],u=n[t],d=a[t];e(l.pos,u)&&i(r(l.leftSegment),d)||(c.push(s[t]),o.copy(u,l.pos),l.leftSegment&&`curveDefinition`in l.leftSegment&&d&&(l.leftSegment.curveDefinition={...d}))}this._editGeometry.parts.forEach(e=>e.unnormalizeVertexPositions()),c.length&&this._editGeometry.notifyChanges({operation:t,updatedVertices:c})}}function r(e){if(e&&e.type!==`line`)return{...e.curveDefinition}}function i(e,n){return e==null&&n==null||!!e&&!!n&&!t(e,n)}export{n as SetAllVertexPositions};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- var e;const t=Symbol();class n{static{e=t}constructor(t){this._operations=[],this._closed=!1,this[e]=!0,t&&(this._operations=t,this._closed=!0)}close(){this._closed=!0}apply(){for(let e of this._operations)e.apply()}undo(){for(let e=this._operations.length-1;e>=0;e--)this._operations[e].undo()}accumulate(e){if(this._closed)return!1;let t=this._operations.length?this._operations[this._operations.length-1]:null;return(!t||!t.accumulate(e))&&(this._operations.push(e),e.apply()),!0}}export{n as UndoGroup};
2
+ var e;const t=Symbol();class n{static{e=t}constructor(t){this._operations=[],this._closed=!1,this[e]=!0,t&&(this._operations=t,this._closed=!0)}close(){this._closed=!0}apply(){for(let e of this._operations)e.apply()}undo(){for(let e=this._operations.length-1;e>=0;e--)this._operations[e].undo()}accumulate(e){if(this._closed)return!1;let t=this._operations.length?this._operations[this._operations.length-1]:null;return t&&t.accumulate(e)||(this._operations.push(e),e.apply()),!0}}export{n as UndoGroup};
@@ -90,6 +90,8 @@ export interface TooltipOptionsProperties extends Partial<Pick<TooltipOptions, "
90
90
  * `Esc` | Closes the input mode but keeps any applied constraints. |
91
91
  * Left-click-drag (on tooltip header) | Allows to change the position of the tooltip in input mode. |
92
92
  *
93
+ * Numeric inputs accept simple math expressions with two values and one operator: `+`, `-`, `*`, or `/`.
94
+ *
93
95
  * @since 5.2
94
96
  * @see [LabelOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/LabelOptions/)
95
97
  * @see [ValueOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ValueOptions/)
@@ -69,6 +69,8 @@ export interface SketchTooltipOptionsProperties extends TooltipOptionsProperties
69
69
  * `Esc` | Closes the input mode but keeps any applied constraints. |
70
70
  * Left-click-drag (on tooltip header) | Allows to change the position of the tooltip in input mode. |
71
71
  *
72
+ * Numeric inputs accept simple math expressions with two values and one operator: `+`, `-`, `*`, or `/`.
73
+ *
72
74
  * @deprecated since 5.2. Use [TooltipOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/TooltipOptions/) instead.
73
75
  * @since 4.24
74
76
  * @see [Sketch](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{valueInUnit as e,createAngle as t,createLength as n}from"../../../core/quantity.js";import{lengthUnitFromSpatialReference as r,verticalLengthUnitFromSpatialReference as i}from"../../../core/units.js";import{subtract as a,copy as o,add as s}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{geodesicCompatibleSpatialReference as c}from"../../../geometry/geodesicUtils.js";import l from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{makeDehydratedPoint as d}from"../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevationFromXYZ as f}from"../../../support/elevationInfoUtils.js";import{CoordinateConstraint as p,VerticalCylinderConstraint as m,constraintOrSet as h,HorizontalPlaneConstraint as g,VerticalHalfPlaneConstraint as _,GeodesicConstraint as v,PointConstraint as y}from"./constraints.js";import{fromPoint as b,createWritable as x,toElevationAlignedDehydratedPoint as S}from"./normalizedPoint.js";import{getDegreesGeographic as C,directionBetweenPoints as w,pointFromDistanceAlongAzimuth as T}from"../../support/angularMeasurementUtils.js";function E(e,t,n,r,i,a){let o=`geodesic`,s=c(n),l=x();return b(e,t,r,l),l[2]=0,(!s||!u(l,n,l,s))&&(o=`euclidean`,s=n),{mode:o,view:t,elevationInfo:r,hasZ:i,directionMode:a,spatialReference:e.spatialReference,measurementSR:s,origin:l}}function D(t,n,i){if(n==null||t==null)return;let a=r(i.measurementSR);if(a==null)return;let o=I(t,i);if(o==null)return;let s=e(n,a);return new m(o,s)}function O(e,n,r,i){if(r==null||e==null)return;let a=I(e,i);if(a==null)return;let o=C(r),s=e=>{if(e==null)return;let n=x(),r=t(e,`degrees`,`geographic`);if(T(n,a,i.measurementSR,10,r,i.mode))return new _(a,n)},c=()=>{if(n!=null&&e!=null)return C(w(n,e))};switch(i.directionMode){case`absolute`:return s(o);case`relative`:{let e=c();return e==null?void 0:s(e+o)}case`relative-bilateral`:{let e=c();return e==null?void 0:h([s(e+o),s(e-o)])}}}function k(e,t){let n=R(e,t);return n==null?void 0:new g(n)}function A(e,t,n){let{context:r,longitude:i,latitude:a,direction:o,distance:s,elevation:c}=n;if(i!=null||a!=null||s!=null||c!=null||o!=null){if(i!=null||a!=null){let e=C(i),t=C(a),n=R(c,r);return new p(e,t,n)}return j(e,t,n)}}function j(t,n,{context:r,direction:i,distance:a,elevation:o}){if(n==null)return k(o,r);let{view:s,elevationInfo:c,measurementSR:l}=r,d=b(n,s,c);if(!l||!u(d,n.spatialReference,B,l))return;let[f,p]=B,m=a==null?void 0:e(a,`meters`),g=C(i),_=R(o,r),x=e=>{let t=new v([f,p],l,m,_,e);return m!=null&&e!=null&&(_!=null||!r.hasZ)?new y(t.closestTo(d)):t};if(g==null)return x(void 0);let S=()=>{if(t!=null&&n!=null)return C(w(t,n))};switch(r.directionMode){case`absolute`:return x(g);case`relative`:{let e=S();return e==null?void 0:x(e+g)}case`relative-bilateral`:{let e=S();return e==null?void 0:h([x(e+g),x(e-g)])}}}function M(e){return e.context.mode===`geodesic`?A(null,null,e):P(e)}function N(e,t,n){let{context:r,x:i,y:a,distance:o,direction:s,elevation:c}=n;return r.mode===`geodesic`?A(t,e,n):i!=null||a!=null?P(n):F([D(e,o,r),O(e,t,s,r),k(c,r)])}function P({x:e,y:t,elevation:n,context:r}){U.x=e?.value??0,U.y=t?.value??0,U.spatialReference=r.spatialReference;let i=I(U,r,V);return new p(e!=null&&i!=null?i[0]:void 0,t!=null&&i!=null?i[1]:void 0,R(n,r))}function F(e){let t;for(let n of e)n&&(t=t?.intersect(n)??n);return t}function I(e,t,n=x()){let{view:r,elevationInfo:i,measurementSR:o,origin:s,mode:c}=t;if(b(e,r,i,n),u(n,e.spatialReference,n,o))return c!==`geodesic`&&a(n,n,s),n}function L(e,t,n,r){let{view:i,measurementSR:a,spatialReference:c,origin:l,mode:d}=n;if(d===`geodesic`?o(H,e):s(H,e,l),u(H,a,H,c))return S(H,i,t,n,r)}function R(e,t){return z(e,t)?.value??void 0}function z(t,{view:r,origin:a,elevationInfo:o,hasZ:s,measurementSR:c}){if(t==null||!s)return;let l=i(c);if(l==null)return;let[u,d]=a,p=e(t,l),m=r?.type===`3d`?f(r,u,d,p,c,o):p;if(m!=null)return n(m,l)}const B=x(),V=x(),H=x(),U=d(0,0,0,l.WGS84);export{L as constraintSpaceToPoint,E as getConstraintContext,A as getGeodesicConstraint,M as getPointConstraint,N as getPolylineOrPolygonConstraint,F as intersectAll,I as pointToConstraintSpace};
2
+ import{valueInUnit as e,createAngle as t,createLength as n}from"../../../core/quantity.js";import{lengthUnitFromSpatialReference as r,verticalLengthUnitFromSpatialReference as i}from"../../../core/units.js";import{subtract as a,copy as o,add as s}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{geodesicCompatibleSpatialReference as c}from"../../../geometry/geodesicUtils.js";import l from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{makeDehydratedPoint as d}from"../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevationFromXYZ as f}from"../../../support/elevationInfoUtils.js";import{CoordinateConstraint as p,VerticalCylinderConstraint as m,constraintOrSet as h,HorizontalPlaneConstraint as g,VerticalHalfPlaneConstraint as _,GeodesicConstraint as v,PointConstraint as y}from"./constraints.js";import{fromPoint as b,createWritable as x,toElevationAlignedDehydratedPoint as S}from"./normalizedPoint.js";import{getDegreesGeographic as C,directionBetweenPoints as w,pointFromDistanceAlongAzimuth as T}from"../../support/angularMeasurementUtils.js";function E(e,t,n,r,i,a){let o=`geodesic`,s=c(n),l=x();return b(e,t,r,l),l[2]=0,s&&u(l,n,l,s)||(o=`euclidean`,s=n),{mode:o,view:t,elevationInfo:r,hasZ:i,directionMode:a,spatialReference:e.spatialReference,measurementSR:s,origin:l}}function D(t,n,i){if(n==null||t==null)return;let a=r(i.measurementSR);if(a==null)return;let o=I(t,i);if(o==null)return;let s=e(n,a);return new m(o,s)}function O(e,n,r,i){if(r==null||e==null)return;let a=I(e,i);if(a==null)return;let o=C(r),s=e=>{if(e==null)return;let n=x(),r=t(e,`degrees`,`geographic`);if(T(n,a,i.measurementSR,10,r,i.mode))return new _(a,n)},c=()=>{if(n!=null&&e!=null)return C(w(n,e))};switch(i.directionMode){case`absolute`:return s(o);case`relative`:{let e=c();return e==null?void 0:s(e+o)}case`relative-bilateral`:{let e=c();return e==null?void 0:h([s(e+o),s(e-o)])}}}function k(e,t){let n=R(e,t);return n==null?void 0:new g(n)}function A(e,t,n){let{context:r,longitude:i,latitude:a,direction:o,distance:s,elevation:c}=n;if(i!=null||a!=null||s!=null||c!=null||o!=null){if(i!=null||a!=null){let e=C(i),t=C(a),n=R(c,r);return new p(e,t,n)}return j(e,t,n)}}function j(t,n,{context:r,direction:i,distance:a,elevation:o}){if(n==null)return k(o,r);let{view:s,elevationInfo:c,measurementSR:l}=r,d=b(n,s,c);if(!l||!u(d,n.spatialReference,B,l))return;let[f,p]=B,m=a==null?void 0:e(a,`meters`),g=C(i),_=R(o,r),x=e=>{let t=new v([f,p],l,m,_,e);return m!=null&&e!=null&&(_!=null||!r.hasZ)?new y(t.closestTo(d)):t};if(g==null)return x(void 0);let S=()=>{if(t!=null&&n!=null)return C(w(t,n))};switch(r.directionMode){case`absolute`:return x(g);case`relative`:{let e=S();return e==null?void 0:x(e+g)}case`relative-bilateral`:{let e=S();return e==null?void 0:h([x(e+g),x(e-g)])}}}function M(e){return e.context.mode===`geodesic`?A(null,null,e):P(e)}function N(e,t,n){let{context:r,x:i,y:a,distance:o,direction:s,elevation:c}=n;return r.mode===`geodesic`?A(t,e,n):i!=null||a!=null?P(n):F([D(e,o,r),O(e,t,s,r),k(c,r)])}function P({x:e,y:t,elevation:n,context:r}){U.x=e?.value??0,U.y=t?.value??0,U.spatialReference=r.spatialReference;let i=I(U,r,V);return new p(e!=null&&i!=null?i[0]:void 0,t!=null&&i!=null?i[1]:void 0,R(n,r))}function F(e){let t;for(let n of e)n&&(t=t?.intersect(n)??n);return t}function I(e,t,n=x()){let{view:r,elevationInfo:i,measurementSR:o,origin:s,mode:c}=t;if(b(e,r,i,n),u(n,e.spatialReference,n,o))return c!==`geodesic`&&a(n,n,s),n}function L(e,t,n,r){let{view:i,measurementSR:a,spatialReference:c,origin:l,mode:d}=n;if(d===`geodesic`?o(H,e):s(H,e,l),u(H,a,H,c))return S(H,i,t,n,r)}function R(e,t){return z(e,t)?.value??void 0}function z(t,{view:r,origin:a,elevationInfo:o,hasZ:s,measurementSR:c}){if(t==null||!s)return;let l=i(c);if(l==null)return;let[u,d]=a,p=e(t,l),m=r?.type===`3d`?f(r,u,d,p,c,o):p;if(m!=null)return n(m,l)}const B=x(),V=x(),H=x(),U=d(0,0,0,l.WGS84);export{L as constraintSpaceToPoint,E as getConstraintContext,A as getGeodesicConstraint,M as getPointConstraint,N as getPolylineOrPolygonConstraint,F as intersectAll,I as pointToConstraintSpace};