@arcgis/core 4.34.0-next.55 → 4.34.0-next.57

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 (211) hide show
  1. package/WebScene.js +1 -1
  2. package/analysis/VolumeMeasurement/VolumeMeasurementCutFillOptions.d.ts +4 -0
  3. package/analysis/VolumeMeasurement/{CutFillOptions.js → VolumeMeasurementCutFillOptions.js} +1 -1
  4. package/analysis/VolumeMeasurementAnalysis.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/02a31483e09652a1a1a2.js +1 -0
  7. package/assets/esri/core/workers/chunks/0390f3aa624e3f380ce2.js +1 -0
  8. package/assets/esri/core/workers/chunks/047d6f7b1677cc7ab271.js +1 -0
  9. package/assets/esri/core/workers/chunks/04e652df94790f5ca08a.js +1 -0
  10. package/assets/esri/core/workers/chunks/{9f178cf73c63caaea190.js → 06d2251d6f6b3e44800a.js} +1 -1
  11. package/assets/esri/core/workers/chunks/07d5e0633cc2f765037f.js +1 -0
  12. package/assets/esri/core/workers/chunks/{fe5c37c69da3ec1e56ac.js → 08393d9cc2ed846dd5b4.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{18ceea59e469a0f2721b.js → 094c741fa8139c3f40cf.js} +1 -1
  14. package/assets/esri/core/workers/chunks/0d946a226b846b3c0849.js +1 -0
  15. package/assets/esri/core/workers/chunks/{6530449cd1975deb61f1.js → 184d3c88ac2fc1d7e2c3.js} +1 -1
  16. package/assets/esri/core/workers/chunks/2ded2446700f89155ccd.js +1 -0
  17. package/assets/esri/core/workers/chunks/{19391d60c76a1dc7c262.js → 2f7e192ee2066f863e1d.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{6b11476b2004b4db576e.js → 3445ffd752262673fb13.js} +1 -1
  19. package/assets/esri/core/workers/chunks/38f09e36e174792646bd.js +1 -0
  20. package/assets/esri/core/workers/chunks/43a56c8fa4e5be18c12a.js +1 -0
  21. package/assets/esri/core/workers/chunks/{65e1f5b20a585e04655a.js → 44dc7ec52c4abb700783.js} +1 -1
  22. package/assets/esri/core/workers/chunks/4558f2e3e77831758fdc.js +1 -0
  23. package/assets/esri/core/workers/chunks/4753793daf0b7ff8b5ff.js +1 -0
  24. package/assets/esri/core/workers/chunks/52917b753c5ceab0c1f7.js +353 -0
  25. package/assets/esri/core/workers/chunks/{6940bb6524938894a246.js → 53873f26a2c24cd75e4a.js} +1 -1
  26. package/assets/esri/core/workers/chunks/561a2078458bc0339f83.js +1 -0
  27. package/assets/esri/core/workers/chunks/56b4dcd04c844eaacd60.js +1 -0
  28. package/assets/esri/core/workers/chunks/{d0bf1fc6e3c198bc565d.js → 57486b18421a3c9690d0.js} +1 -1
  29. package/assets/esri/core/workers/chunks/5f079be7f322768aef21.js +1 -0
  30. package/assets/esri/core/workers/chunks/61a294f9411bf884f2ab.js +1 -0
  31. package/assets/esri/core/workers/chunks/{ad93a2621f75270f06cb.js → 69fbe363bb130fdd8146.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{722931d1a60be461e521.js → 70cf81ec5a901782d2db.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{24ac204d8a045aa821be.js → 7388e8c905d93dea1c05.js} +1 -1
  34. package/assets/esri/core/workers/chunks/749c7159e0902388e828.js +1 -0
  35. package/assets/esri/core/workers/chunks/76ff7ccfe583927918f3.js +969 -0
  36. package/assets/esri/core/workers/chunks/{ae73ac81bd10614c2b53.js → 7714228825fb44d506df.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{6130bc641aa7c1bcaaa8.js → 7c23be93d394f1bee941.js} +1 -1
  38. package/assets/esri/core/workers/chunks/7c86af4f60cea383ed96.js +1 -0
  39. package/assets/esri/core/workers/chunks/7eda1c400658b6a99be8.js +1 -0
  40. package/assets/esri/core/workers/chunks/{97ae2fdb6cb98249f5fa.js → 7f80bbbd0897082c1af3.js} +1 -1
  41. package/assets/esri/core/workers/chunks/80a69897fa3ce1eaa6e7.js +1 -0
  42. package/assets/esri/core/workers/chunks/80bd5988180f4618fd61.js +1 -0
  43. package/assets/esri/core/workers/chunks/{62ade6f18b375795ddfd.js → 8257352421f453a669e9.js} +1 -1
  44. package/assets/esri/core/workers/chunks/8762928d10c3821738ad.js +1 -0
  45. package/assets/esri/core/workers/chunks/88a5e7415f8858c454f7.js +1 -0
  46. package/assets/esri/core/workers/chunks/893e5eb5c028c4704317.js +1 -0
  47. package/assets/esri/core/workers/chunks/8ead467a5af0d9bba804.js +1 -0
  48. package/assets/esri/core/workers/chunks/91e04d03b0013bcaad82.js +1 -0
  49. package/assets/esri/core/workers/chunks/{c7d4c296011c5393bcaa.js → 9275313e0f1f521b2658.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{e666ca4d14b6490485d6.js → 92b60d4fb09711919601.js} +1 -1
  51. package/assets/esri/core/workers/chunks/977582cb3c8f17a2cb4c.js +1 -0
  52. package/assets/esri/core/workers/chunks/{5c556468e2a598ab793a.js → 9940e59033a8a1eff2a9.js} +1 -1
  53. package/assets/esri/core/workers/chunks/9b10e70f28873cff44f5.js +1 -0
  54. package/assets/esri/core/workers/chunks/{9928e432b884c75c3436.js → 9d920f3488d59e7f276c.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{a778a72456fefdf40115.js → a249e56a0be8cef33ba8.js} +1 -1
  56. package/assets/esri/core/workers/chunks/a3ee76b7e46d3fba7cf7.js +1 -0
  57. package/assets/esri/core/workers/chunks/{2cda605c302176905e84.js → a96ac5c68d84122e7751.js} +1 -1
  58. package/assets/esri/core/workers/chunks/acf13a64df2991a4cb6b.js +1 -0
  59. package/assets/esri/core/workers/chunks/{7a8d740d1226719a578a.js → b457b7dd907f06278bee.js} +1 -1
  60. package/assets/esri/core/workers/chunks/b5640f9623a9c9ded92a.js +1 -0
  61. package/assets/esri/core/workers/chunks/bb67d491f62a5cce96cd.js +1 -0
  62. package/assets/esri/core/workers/chunks/{71acded1b3c0057917a1.js → bbdbb618a18542f7a4a2.js} +1 -1
  63. package/assets/esri/core/workers/chunks/bc9f54a6b577c43189fd.js +1 -0
  64. package/assets/esri/core/workers/chunks/{6fe738748ce837811ff4.js → bd4125d163f372a7e978.js} +1 -1
  65. package/assets/esri/core/workers/chunks/bead38898c3f4d4d3569.js +1 -0
  66. package/assets/esri/core/workers/chunks/{22334a464f798b5279b2.js → c80c032c5b7a11db177a.js} +1 -1
  67. package/assets/esri/core/workers/chunks/cc748d4f4adb9c584aa4.js +1 -0
  68. package/assets/esri/core/workers/chunks/cf699b9bb530b87be14c.js +1 -0
  69. package/assets/esri/core/workers/chunks/{5d331f7628514a572f82.js → d6ab4d55f1023ee6ec6a.js} +1 -1
  70. package/assets/esri/core/workers/chunks/d71836cf70b9604832f1.js +1 -0
  71. package/assets/esri/core/workers/chunks/{4874aabdb5c60ca66216.js → db2b8d8cf7131554cf7e.js} +1 -1
  72. package/assets/esri/core/workers/chunks/de4da985c398c8bcf2e7.js +1 -0
  73. package/assets/esri/core/workers/chunks/ef85cd0e82d59db8a26f.js +33 -0
  74. package/assets/esri/core/workers/chunks/fd1fdb97a294a1b7041d.js +1 -0
  75. package/config.js +1 -1
  76. package/core/has.js +1 -1
  77. package/geometry/Multipoint.js +1 -1
  78. package/geometry/support/boundsUtils.js +1 -1
  79. package/geometry/support/contains.js +1 -1
  80. package/geometry/support/coordsUtils.js +1 -1
  81. package/geometry/support/curves/circleUtils.js +1 -1
  82. package/geometry/support/curves/circularArcUtils.js +1 -1
  83. package/geometry/support/curves/curveUtils.js +1 -1
  84. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  85. package/geometry/support/curves/rotate.js +5 -0
  86. package/geometry/support/extentUtils.js +1 -1
  87. package/geometry/support/rotate.js +1 -1
  88. package/graphic/ImageryGraphicOrigin.js +5 -0
  89. package/graphic/ImageryTileGraphicOrigin.js +5 -0
  90. package/graphic/KMLGraphicOrigin.js +5 -0
  91. package/graphic/WCSGraphicOrigin.js +5 -0
  92. package/graphic/isImageryGraphicOrigin.js +5 -0
  93. package/graphic/isImageryTileGraphicOrigin.js +5 -0
  94. package/graphic/isKMLGraphicOrigin.js +5 -0
  95. package/graphic/isWCSGraphicOrigin.js +5 -0
  96. package/interfaces.d.ts +10 -10
  97. package/kernel.js +1 -1
  98. package/layers/CatalogLayer.js +1 -1
  99. package/layers/FeatureLayer.js +1 -1
  100. package/layers/GroundLayer.js +5 -0
  101. package/layers/ImageryLayer.js +1 -1
  102. package/layers/ImageryTileLayer.js +1 -1
  103. package/layers/KMLLayer.js +1 -1
  104. package/layers/SceneLayer.js +1 -1
  105. package/layers/WCSLayer.js +1 -1
  106. package/layers/catalog/CatalogFootprintLayer.js +1 -1
  107. package/layers/mixins/ArcGISImageService.js +1 -1
  108. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  109. package/layers/support/ElevationQuery.js +1 -1
  110. package/layers/support/KMLSublayer.js +1 -1
  111. package/layers/support/featureReductionUtils.js +1 -1
  112. package/layers/support/kmlUtils.js +1 -1
  113. package/package.json +1 -1
  114. package/renderers/support/colorRampUtils.js +1 -1
  115. package/support/requestUtils.js +1 -1
  116. package/support/revision.js +1 -1
  117. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  118. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  119. package/views/2d/layers/KMLLayerView2D.js +1 -1
  120. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  121. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  122. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  123. package/views/3d/analysis/Viewshed/{ArrowManipulator.js → ViewshedArrowManipulator.js} +1 -1
  124. package/views/3d/analysis/Viewshed/{FieldOfViewManipulation.js → ViewshedFieldOfViewManipulation.js} +1 -1
  125. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +5 -0
  126. package/views/3d/analysis/Viewshed/ViewshedShapeVisualElement.js +5 -0
  127. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  128. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +5 -0
  129. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  130. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  131. package/views/3d/analysis/VolumeMeasurement/{CutFillVolumeMeasurementComputation.js → VolumeMeasurementCutFillComputation.js} +1 -1
  132. package/views/3d/analysis/VolumeMeasurement/{CutFillVolumeMeasurementController.js → VolumeMeasurementCutFillController.js} +1 -1
  133. package/views/3d/analysis/VolumeMeasurement/{CutFillVolumeMeasurementVisualization.js → VolumeMeasurementCutFillVisualization.js} +1 -1
  134. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  135. package/views/3d/layers/CatalogFootprintLayerView3D.js +1 -1
  136. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  137. package/views/GroundView.js +1 -1
  138. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  139. package/views/draw/DrawOperation.js +1 -1
  140. package/views/draw/MultipointDrawAction.js +1 -1
  141. package/views/draw/PointDrawAction.js +1 -1
  142. package/views/draw/PolygonDrawAction.js +1 -1
  143. package/views/draw/PolylineDrawAction.js +1 -1
  144. package/views/draw/SegmentDrawAction.js +1 -1
  145. package/views/draw/support/Box.js +1 -1
  146. package/views/draw/support/GraphicMover.js +1 -1
  147. package/views/draw/support/Reshape.js +1 -1
  148. package/views/draw/support/drawUtils.js +1 -1
  149. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  150. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  151. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  152. package/views/interactive/editGeometry/operations/AppendVertex.js +1 -1
  153. package/views/interactive/editGeometry/operations/RotateVertex.js +1 -1
  154. package/views/interactive/editGeometry/operations/curveOperationUtils.js +1 -1
  155. package/views/interactive/tooltip/infos/SelectedVertexTooltipInfo.js +1 -1
  156. package/views/layers/ImageryLayerView.js +1 -1
  157. package/views/layers/ImageryTileLayerView.js +1 -1
  158. package/webscene/spec-certification/api.js +1 -1
  159. package/webscene/spec-certification/compare.js +1 -1
  160. package/webscene/spec-certification/spec.js +1 -1
  161. package/widgets/ElevationProfile/support/profileUtils.js +1 -1
  162. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  163. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  164. package/widgets/OrientedImageryViewer.js +1 -1
  165. package/widgets/Sketch/SketchViewModel.js +1 -1
  166. package/widgets/Sketch/support/sketchUtils.js +1 -1
  167. package/analysis/VolumeMeasurement/CutFillOptions.d.ts +0 -4
  168. package/assets/esri/core/workers/chunks/01e8b9dc77a57d1c2a52.js +0 -1
  169. package/assets/esri/core/workers/chunks/027cfcde29fe87aa2ffe.js +0 -1
  170. package/assets/esri/core/workers/chunks/03ee4d63aa8de44958ab.js +0 -1
  171. package/assets/esri/core/workers/chunks/0445de3a8968c0734c91.js +0 -1
  172. package/assets/esri/core/workers/chunks/09268dc856c3d5ce178f.js +0 -1
  173. package/assets/esri/core/workers/chunks/0a6d33d013628f671aea.js +0 -1
  174. package/assets/esri/core/workers/chunks/17776d9d3558d45ea7b5.js +0 -1
  175. package/assets/esri/core/workers/chunks/1a2278b9fe9666342728.js +0 -1
  176. package/assets/esri/core/workers/chunks/1e01aaebdeffdfc0c6bd.js +0 -1
  177. package/assets/esri/core/workers/chunks/222f981e876f60ae282f.js +0 -1
  178. package/assets/esri/core/workers/chunks/252ee00fd6c4ae0ee7fa.js +0 -1
  179. package/assets/esri/core/workers/chunks/277941bec15525dbd3a0.js +0 -1
  180. package/assets/esri/core/workers/chunks/2cb14d040e67a261b31c.js +0 -1
  181. package/assets/esri/core/workers/chunks/31c088966ccfff2ea1db.js +0 -1
  182. package/assets/esri/core/workers/chunks/3245d20ea4bb779f87ef.js +0 -1
  183. package/assets/esri/core/workers/chunks/3800764932a1c32cb29f.js +0 -1
  184. package/assets/esri/core/workers/chunks/46a470bea2a3601182dc.js +0 -1
  185. package/assets/esri/core/workers/chunks/4f8dab492331c9a2d67a.js +0 -1
  186. package/assets/esri/core/workers/chunks/5900dde7a201a7d47469.js +0 -1
  187. package/assets/esri/core/workers/chunks/5b2ff220aebe464dac23.js +0 -1
  188. package/assets/esri/core/workers/chunks/6801b92bce7a918fda6f.js +0 -1
  189. package/assets/esri/core/workers/chunks/772e81e9162e2240a7a6.js +0 -1
  190. package/assets/esri/core/workers/chunks/7b560ac0be93c6aa9940.js +0 -1
  191. package/assets/esri/core/workers/chunks/7bdfc7c7ce1d94c00745.js +0 -353
  192. package/assets/esri/core/workers/chunks/83737d86584bf1b32368.js +0 -1
  193. package/assets/esri/core/workers/chunks/854bfda25bb406814929.js +0 -1
  194. package/assets/esri/core/workers/chunks/87f68c2b9361bd3f8cac.js +0 -1
  195. package/assets/esri/core/workers/chunks/8c81156b1605a16acc29.js +0 -1
  196. package/assets/esri/core/workers/chunks/8f6ff09e7d2f01b79faf.js +0 -1
  197. package/assets/esri/core/workers/chunks/97a38d700f2cb8807d51.js +0 -1
  198. package/assets/esri/core/workers/chunks/9e9be7f6ea32957f1088.js +0 -33
  199. package/assets/esri/core/workers/chunks/cbec768cd98caff212f2.js +0 -1
  200. package/assets/esri/core/workers/chunks/d1842745a7699879a1e1.js +0 -1
  201. package/assets/esri/core/workers/chunks/d81c4afad4abe2d1d0b9.js +0 -1
  202. package/assets/esri/core/workers/chunks/de499e33035b56b6697d.js +0 -1
  203. package/assets/esri/core/workers/chunks/dfb12f42b8d319ffa5fc.js +0 -1
  204. package/assets/esri/core/workers/chunks/e04951ee32f041faaeca.js +0 -1
  205. package/assets/esri/core/workers/chunks/e10c5405f956b2cc59e4.js +0 -1
  206. package/assets/esri/core/workers/chunks/ead1acf95c3385630da8.js +0 -1001
  207. package/assets/esri/core/workers/chunks/f3e3c2340452c1d60c95.js +0 -1
  208. package/assets/esri/core/workers/chunks/f4d7cbd33ef8710d7316.js +0 -1
  209. package/views/3d/analysis/Viewshed/ScaleOrientManipulation.js +0 -5
  210. package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +0 -5
  211. package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{EventedAccessor as i}from"../../../core/Evented.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{zeroMeters as o}from"../../../core/quantityUtils.js";import{when as r,watch as a,syncAndInitial as h,initial as c}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import d from"../../../geometry/Polyline.js";import{create as m}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as g}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as u}from"../../../geometry/support/coordsUtils.js";import y from"../../../geometry/support/rotate.js";import v from"../../../symbols/SimpleFillSymbol.js";import f from"../../../symbols/SimpleLineSymbol.js";import G from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as b,scale as x,getScaleRatio as w,getRotationAngle as S}from"./drawUtils.js";import k from"./GraphicMover.js";import R from"./HighlightHelper.js";import{addUniqueLayer as C}from"./layerUtils.js";import{settings as M}from"./settings.js";import H from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as I}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as O}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as j}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as T}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{autoSize2D as L}from"../../support/extentUtils.js";const E=M.transformGraphics,z={centerIndicator:new G({style:"cross",size:E.center.size,color:E.center.color}),fill:{default:new v({color:E.fill.color,outline:{color:E.fill.outlineColor,join:"round",width:1}}),active:new v({color:E.fill.stagedColor,outline:{color:E.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new G({style:"square",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new G({style:"square",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}})},rotator:{default:new G({style:"circle",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}})},rotatorLine:new f({color:E.line.color,width:1})},B=Symbol();let N=class extends i{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=z,this.sketchOptions=new H,this.view=null,this._getBounds=(()=>{const t=m();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("multipoint"===s.type){const e=u(s);[i,o,r,a]=g(t,[e])}else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=u(s);[i,o,r,a]=g(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new R({view:t}),this._setup(),this.addHandles([r(()=>t?.ready,()=>{const{layer:t,view:e}=this;C(e,t)},{once:!0,initial:!0}),a(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),a(()=>t?.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),a(()=>this.graphics,()=>this.refresh()),a(()=>this.layer,(t,e)=>{e&&this._resetGraphics(e),this.refresh()}),a(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),a(()=>this.sketchOptions.tooltips.effectiveEnabled,e=>{this.tooltip=e?I(()=>({view:t,options:this.sketchOptions.tooltips})):s(this.tooltip)},h),a(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),c),this.on("move-start",t=>this.callbacks?.onMoveStart?.(t)),this.on("move",t=>this.callbacks?.onMove?.(t)),this.on("move-stop",t=>this.callbacks?.onMoveStop?.(t)),this.on("rotate-start",t=>this.callbacks?.onRotateStart?.(t)),this.on("rotate",t=>this.callbacks?.onRotate?.(t)),this.on("rotate-stop",t=>this.callbacks?.onRotateStop?.(t)),this.on("scale-start",t=>this.callbacks?.onScaleStart?.(t)),this.on("scale",t=>this.callbacks?.onScale?.(t)),this.on("scale-stop",t=>this.callbacks?.onScaleStop?.(t))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=b(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",{graphics:this.graphics,mover:null,dx:t,dy:e,type:"move-stop"})}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=x(s,t,e);i.geometry=o}this.refresh(),this.emit("scale-stop",{graphics:this.graphics,mover:null,xScale:t,yScale:e,type:"scale-stop"})}}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new p(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=y(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",{graphics:this.graphics,mover:null,angle:t,type:"rotate-stop"})}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover?.destroy(),this._mover=null,this.removeHandles(B)}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach(t=>!t.destroyed&&t.destroy()),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new k({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setCursor(t){this.addHandles(this.view.acquireCursor(t,"high"),B)}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(m()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(m(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h,graphics:c}=this,{graphic:n,dx:l,dy:p,viewEvent:_}=t;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(n),this._updateTooltip(n,_),n===a?(this._setCursor("grabbing"),this.emit("rotate-start",{type:"rotate-start",mover:n,graphics:c,angle:e})):r.includes(n)?(this._activeHandleGraphic=n,this.emit("scale-start",{type:"scale-start",mover:n,graphics:c,xScale:i,yScale:s})):this.emit("move-start",{type:"move-start",graphics:c,mover:n,dx:l,dy:p})}_onGraphicMoveCallback(t){const e=t.graphic;if(!this._startInfo)return;const{_xScale:i,_yScale:s,_angleOfRotation:o,graphics:r}=this;if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",{type:"scale",graphics:r,mover:e,xScale:i,yScale:s});else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",{type:"rotate",graphics:r,mover:e,angle:o});else{const{dx:i,dy:s}=t;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._updateTooltip(e,t.viewEvent),this.emit("move",{type:"move",graphics:r,mover:e,dx:i,dy:s})}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:o,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:c,graphics:n}=this;this.refresh(),e===c?(this._setCursor("pointer"),this.emit("rotate-stop",{type:"rotate-stop",graphics:n,mover:e,angle:i})):h.includes(e)?this.emit("scale-stop",{type:"scale-stop",mover:e,graphics:n,xScale:r,yScale:a}):this.emit("move-stop",{type:"move-stop",graphics:n,mover:e,dx:s,dy:o})}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:s,_rotateHandleGraphic:o,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===o)return o.symbol=r.rotator.hover,this._setCursor("pointer"),void this._updateTooltip(h);if(s.includes(h)||h===e)return void this._setCursor("move");if(!i.includes(h))return void this._setCursor("pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const c=a.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}this._setCursor(n)}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),this.removeHandles(B),this._updateTooltip()}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:s,view:o}=this,{centerX:r,centerY:a,graphicInfos:h,height:c,startX:n,startY:l,width:_}=e,{resolution:d,transform:m}=o.state,g=i.indexOf(t);1!==g&&5!==g||this._updateX(t,r),3!==g&&7!==g||this._updateY(t,a);const{x:u,y}=t.geometry,v=m[0]*u+m[2]*y+m[4],f=m[1]*u+m[3]*y+m[5],G=h?.map(t=>t.geometry)??[],S=G.every(t=>"point"===t.type);if((0===_||0===c)&&S){const t=U((u-n)/d),i=U((l-y)/d);for(let e=0;e<G.length;e++)this.graphics[e].geometry=b(G[e],t,i,o,!0);return this._centerGraphic.geometry=new p(u,y,o.spatialReference),void(this._backgroundGraphic.geometry=b(e.box,t,i,o,!0))}if(s){const t=U(m[0]*r+m[2]*a+m[4],2),e=U(m[1]*r+m[3]*a+m[5],2),i=U(m[0]*n+m[2]*l+m[4],2),s=U(m[1]*n+m[3]*l+m[5],2);let o=w(t,e,i,s,v,f);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=x(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=u-n,i=l-y;if(1===g||5===g?t=0:3!==g&&7!==g||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let m=(_+(n>r?t:-1*t))/_,v=(c+(l<a?i:-1*i))/c;1!==g&&5!==g&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==g&&7!==g&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(s-r)/d,w=(h-a)/d,S=x(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=b(S,f,w,o,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),C=(k-r)/d,M=-1*(R-a)/d;for(const e of G){const t=G.indexOf(e),i=x(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=b(i,C,M,o,!0)}this._centerGraphic.geometry=new p(k,R,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new p(s,o,h),n=new p(e,i,h),l=t.geometry;this._angleOfRotation=S(c,l,n);const _=this._startInfo.graphicInfos?.map(t=>t.geometry)??[];for(const p of _){const t=_.indexOf(p),e=y(p,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=y(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=y(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=b(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=b(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)})}_updateBackgroundGraphic(){const t=this._getCoordinates().map(([t,e])=>[t,e]);this._backgroundGraphic.geometry=new _({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(m()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new p(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new p(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new d({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new p(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new p(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new p(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>null!=t?.geometry&&"extent"===t.geometry.type)}_getBoxBounds(t){const e=this.graphics.map(t=>t.geometry);return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(m());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new O({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o,automaticLengthMeasurementUtils:r}=this;if(null==t)return;const a=this._getCoordinates(),h=L({topLeft:a[0],topRight:a[1],bottomRight:a[2],bottomLeft:a[3],spatialReference:o.spatialReference,automaticLengthMeasurementUtils:r});if(null==h)return;const{xSize:c,ySize:n}=h,l=Math.abs(e),p=Math.abs(i);t.info=new j({sketchOptions:s,xScale:l,yScale:p,xSize:c,ySize:n})}_updateMoveTooltip(t){const{tooltip:e,sketchOptions:i,view:s,automaticLengthMeasurementUtils:r}=this;if(null==e)return;const a=new T({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,h=s.toMap(t),c=s.toMap({x:e,y:i}),n=r.autoDistanceBetweenPoints2D(c,h);a.distance=null!=n?n:o}e.info=a}};function U(t,e=2){return Number.parseFloat(t.toFixed(e))}t([n()],N.prototype,"tooltip",void 0),t([n({readOnly:!0})],N.prototype,"type",void 0),t([n()],N.prototype,"callbacks",void 0),t([n()],N.prototype,"enableMovement",void 0),t([n()],N.prototype,"enableRotation",void 0),t([n()],N.prototype,"enableScaling",void 0),t([n()],N.prototype,"graphics",void 0),t([n()],N.prototype,"highlightName",void 0),t([n()],N.prototype,"highlightsEnabled",void 0),t([n()],N.prototype,"layer",void 0),t([n()],N.prototype,"preserveAspectRatio",void 0),t([n()],N.prototype,"showCenterGraphic",void 0),t([n({readOnly:!0})],N.prototype,"state",null),t([n()],N.prototype,"symbols",void 0),t([n({type:H})],N.prototype,"sketchOptions",void 0),t([n({constructOnly:!0})],N.prototype,"view",void 0),t([n({constructOnly:!0})],N.prototype,"automaticLengthMeasurementUtils",void 0),N=t([l("esri.views.draw.support.Box")],N);const Y=N;export{Y as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{EventedAccessor as i}from"../../../core/Evented.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{zeroMeters as o}from"../../../core/quantityUtils.js";import{when as r,watch as a,syncAndInitial as h,initial as c}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import d from"../../../geometry/Polyline.js";import{create as m,center as g}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as u}from"../../../geometry/support/boundsUtils.js";import y from"../../../geometry/support/rotate.js";import v from"../../../symbols/SimpleFillSymbol.js";import f from"../../../symbols/SimpleLineSymbol.js";import G from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as b,scale as x,getScaleRatio as w,getRotationAngle as S}from"./drawUtils.js";import k from"./GraphicMover.js";import R from"./HighlightHelper.js";import{addUniqueLayer as C}from"./layerUtils.js";import{settings as M}from"./settings.js";import H from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as I}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as O}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as T}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as j}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{autoSize2D as L}from"../../support/extentUtils.js";const E=M.transformGraphics,B={centerIndicator:new G({style:"cross",size:E.center.size,color:E.center.color}),fill:{default:new v({color:E.fill.color,outline:{color:E.fill.outlineColor,join:"round",width:1}}),active:new v({color:E.fill.stagedColor,outline:{color:E.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new G({style:"square",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new G({style:"square",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}})},rotator:{default:new G({style:"circle",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}})},rotatorLine:new f({color:E.line.color,width:1})},z=Symbol();let N=class extends i{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=B,this.sketchOptions=new H,this.view=null,this._getBounds=(()=>{const t=m();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=u(t,s);[i,o,r,a]=e}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new R({view:t}),this._setup(),this.addHandles([r(()=>t?.ready,()=>{const{layer:t,view:e}=this;C(e,t)},{once:!0,initial:!0}),a(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),a(()=>t?.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),a(()=>this.graphics,()=>this.refresh()),a(()=>this.layer,(t,e)=>{e&&this._resetGraphics(e),this.refresh()}),a(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),a(()=>this.sketchOptions.tooltips.effectiveEnabled,e=>{this.tooltip=e?I(()=>({view:t,options:this.sketchOptions.tooltips})):s(this.tooltip)},h),a(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),c),this.on("move-start",t=>this.callbacks?.onMoveStart?.(t)),this.on("move",t=>this.callbacks?.onMove?.(t)),this.on("move-stop",t=>this.callbacks?.onMoveStop?.(t)),this.on("rotate-start",t=>this.callbacks?.onRotateStart?.(t)),this.on("rotate",t=>this.callbacks?.onRotate?.(t)),this.on("rotate-stop",t=>this.callbacks?.onRotateStop?.(t)),this.on("scale-start",t=>this.callbacks?.onScaleStart?.(t)),this.on("scale",t=>this.callbacks?.onScale?.(t)),this.on("scale-stop",t=>this.callbacks?.onScaleStop?.(t))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=b(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",{graphics:this.graphics,mover:null,dx:t,dy:e,type:"move-stop"})}}scale(t,e){if(!this._mover||!this.graphics.length)return;const i=this._getBoxBounds(m()),s=g(i);for(const o of this.graphics){const i=o.geometry,r=x(i,t,e,s);o.geometry=r}this.refresh(),this.emit("scale-stop",{graphics:this.graphics,mover:null,xScale:t,yScale:e,type:"scale-stop"})}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new p(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=y(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",{graphics:this.graphics,mover:null,angle:t,type:"rotate-stop"})}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover?.destroy(),this._mover=null,this.removeHandles(z)}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach(t=>!t.destroyed&&t.destroy()),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new k({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setCursor(t){this.addHandles(this.view.acquireCursor(t,"high"),z)}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(m()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(m(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h,graphics:c}=this,{graphic:n,dx:l,dy:p,viewEvent:_}=t;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(n),this._updateTooltip(n,_),n===a?(this._setCursor("grabbing"),this.emit("rotate-start",{type:"rotate-start",mover:n,graphics:c,angle:e})):r.includes(n)?(this._activeHandleGraphic=n,this.emit("scale-start",{type:"scale-start",mover:n,graphics:c,xScale:i,yScale:s})):this.emit("move-start",{type:"move-start",graphics:c,mover:n,dx:l,dy:p})}_onGraphicMoveCallback(t){const e=t.graphic;if(!this._startInfo)return;const{_xScale:i,_yScale:s,_angleOfRotation:o,graphics:r}=this;if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",{type:"scale",graphics:r,mover:e,xScale:i,yScale:s});else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",{type:"rotate",graphics:r,mover:e,angle:o});else{const{dx:i,dy:s}=t;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._updateTooltip(e,t.viewEvent),this.emit("move",{type:"move",graphics:r,mover:e,dx:i,dy:s})}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:o,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:c,graphics:n}=this;this.refresh(),e===c?(this._setCursor("pointer"),this.emit("rotate-stop",{type:"rotate-stop",graphics:n,mover:e,angle:i})):h.includes(e)?this.emit("scale-stop",{type:"scale-stop",mover:e,graphics:n,xScale:r,yScale:a}):this.emit("move-stop",{type:"move-stop",graphics:n,mover:e,dx:s,dy:o})}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:s,_rotateHandleGraphic:o,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===o)return o.symbol=r.rotator.hover,this._setCursor("pointer"),void this._updateTooltip(h);if(s.includes(h)||h===e)return void this._setCursor("move");if(!i.includes(h))return void this._setCursor("pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const c=a.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}this._setCursor(n)}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),this.removeHandles(z),this._updateTooltip()}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:s,view:o}=this,{centerX:r,centerY:a,graphicInfos:h,height:c,startX:n,startY:l,width:_}=e,{resolution:d,transform:m}=o.state,g=i.indexOf(t);1!==g&&5!==g||this._updateX(t,r),3!==g&&7!==g||this._updateY(t,a);const{x:u,y}=t.geometry,v=m[0]*u+m[2]*y+m[4],f=m[1]*u+m[3]*y+m[5],G=h?.map(t=>t.geometry)??[],S=G.every(t=>"point"===t.type);if((0===_||0===c)&&S){const t=U((u-n)/d),i=U((l-y)/d);for(let e=0;e<G.length;e++)this.graphics[e].geometry=b(G[e],t,i,o,!0);return this._centerGraphic.geometry=new p(u,y,o.spatialReference),void(this._backgroundGraphic.geometry=b(e.box,t,i,o,!0))}if(s){const t=U(m[0]*r+m[2]*a+m[4],2),e=U(m[1]*r+m[3]*a+m[5],2),i=U(m[0]*n+m[2]*l+m[4],2),s=U(m[1]*n+m[3]*l+m[5],2);let o=w(t,e,i,s,v,f);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=x(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=u-n,i=l-y;if(1===g||5===g?t=0:3!==g&&7!==g||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let m=(_+(n>r?t:-1*t))/_,v=(c+(l<a?i:-1*i))/c;1!==g&&5!==g&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==g&&7!==g&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(s-r)/d,w=(h-a)/d,S=x(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=b(S,f,w,o,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),C=(k-r)/d,M=-1*(R-a)/d;for(const e of G){const t=G.indexOf(e),i=x(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=b(i,C,M,o,!0)}this._centerGraphic.geometry=new p(k,R,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new p(s,o,h),n=new p(e,i,h),l=t.geometry;this._angleOfRotation=S(c,l,n);const _=this._startInfo.graphicInfos?.map(t=>t.geometry)??[];for(const p of _){const t=_.indexOf(p),e=y(p,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=y(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=y(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=b(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=b(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)})}_updateBackgroundGraphic(){const t=this._getCoordinates().map(([t,e])=>[t,e]);this._backgroundGraphic.geometry=new _({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(m()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new p(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new p(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new d({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new p(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new p(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new p(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>null!=t?.geometry&&"extent"===t.geometry.type)}_getBoxBounds(t){const e=this.graphics.map(t=>t.geometry);return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(m());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new O({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o,automaticLengthMeasurementUtils:r}=this;if(null==t)return;const a=this._getCoordinates(),h=L({topLeft:a[0],topRight:a[1],bottomRight:a[2],bottomLeft:a[3],spatialReference:o.spatialReference,automaticLengthMeasurementUtils:r});if(null==h)return;const{xSize:c,ySize:n}=h,l=Math.abs(e),p=Math.abs(i);t.info=new T({sketchOptions:s,xScale:l,yScale:p,xSize:c,ySize:n})}_updateMoveTooltip(t){const{tooltip:e,sketchOptions:i,view:s,automaticLengthMeasurementUtils:r}=this;if(null==e)return;const a=new j({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,h=s.toMap(t),c=s.toMap({x:e,y:i}),n=r.autoDistanceBetweenPoints2D(c,h);a.distance=null!=n?n:o}e.info=a}};function U(t,e=2){return Number.parseFloat(t.toFixed(e))}t([n()],N.prototype,"tooltip",void 0),t([n({readOnly:!0})],N.prototype,"type",void 0),t([n()],N.prototype,"callbacks",void 0),t([n()],N.prototype,"enableMovement",void 0),t([n()],N.prototype,"enableRotation",void 0),t([n()],N.prototype,"enableScaling",void 0),t([n()],N.prototype,"graphics",void 0),t([n()],N.prototype,"highlightName",void 0),t([n()],N.prototype,"highlightsEnabled",void 0),t([n()],N.prototype,"layer",void 0),t([n()],N.prototype,"preserveAspectRatio",void 0),t([n()],N.prototype,"showCenterGraphic",void 0),t([n({readOnly:!0})],N.prototype,"state",null),t([n()],N.prototype,"symbols",void 0),t([n({type:H})],N.prototype,"sketchOptions",void 0),t([n({constructOnly:!0})],N.prototype,"view",void 0),t([n({constructOnly:!0})],N.prototype,"automaticLengthMeasurementUtils",void 0),N=t([l("esri.views.draw.support.Box")],N);const Y=N;export{Y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as i}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{clone as e}from"../../../core/lang.js";import{watch as s,when as r}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../layers/GraphicsLayer.js";import n from"../../../symbols/SimpleFillSymbol.js";import c from"../../../symbols/SimpleLineSymbol.js";import l from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as p}from"./drawUtils.js";import d from"./HighlightHelper.js";import{addUniqueLayer as g,findLayerView as m}from"./layerUtils.js";import{GraphicClickEvent as v,GraphicDoubleClickEvent as _,GraphicPointerDownEvent as y,GraphicPointerUpEvent as f,GraphicPointerOutEvent as u,GraphicPointerOverEvent as w,GraphicMoveStartEvent as G,GraphicMoveEvent as b,GraphicMoveStopEvent as k}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as O}from"../../input/InputManager.js";import{GraphicManipulator as x}from"../../interactive/GraphicManipulator.js";import{createScreenPointFromEvent as H}from"../../support/screenUtils.js";const M="indicator-symbols";let E=class extends t{constructor(i){super(i),this._activeGraphic=null,this._dragEvent=null,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!1,this.indicatorsEnabled=!1,this._defaultLayer=new a({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.layer=this._defaultLayer,this.view=null}initialize(){g(this.view,this.layer),this._highlightHelper=new d({view:this.view}),this.refresh(),this.addHandles([s(()=>this.graphics.length,()=>this.refresh()),r(()=>this.view?.ready,()=>{this.addHandles([this.view.on("immediate-click",i=>this._clickHandler(i),O.TOOL),this.view.on("double-click",i=>this._doubleClickHandler(i),O.TOOL),this.view.on("pointer-down",i=>this._pointerDownHandler(i),O.TOOL),this.view.on("pointer-move",i=>this._pointerMoveHandler(i),O.TOOL),this.view.on("pointer-up",i=>this._pointerUpHandler(i),O.TOOL),this.view.on("drag",i=>this._dragHandler(i),O.TOOL),this.view.on("key-down",i=>this._keyDownHandler(i),O.TOOL)])},{once:!0,initial:!0}),s(()=>this.view,i=>{this._highlightHelper.removeAll(),this._highlightHelper.view=i}),s(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})])}destroy(){this._removeIndicators(),this.view.map?.remove(this.layer),this._defaultLayer.destroy(),this.reset(),this._manipulators.forEach(i=>i.destroy()),this._manipulators=null}get state(){const i=this.view.ready,t=this.graphics.length>0,e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}_clickHandler(i){const t=this._findTargetGraphic(H(i));if(t){const e=new v(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick?.(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(H(i));if(t){const e=new _(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick?.(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(H(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new y(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown?.(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new f(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp?.(r)}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(H(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),h=new u(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",h),this.callbacks.onGraphicPointerOut?.(h)}const r=this.graphics.indexOf(t),h=new w(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",h),void this.callbacks.onGraphicPointerOver?.(h)}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new u(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut?.(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic?.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:s,y:r}=i,h=this.graphics.indexOf(this._activeGraphic),o=this._dragEvent?s-this._dragEvent.x:0,a=this._dragEvent?r-this._dragEvent.y:0,n=s-i.origin.x,c=r-i.origin.y,l="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,d=p(l,n,c,this.view);if(this._activeGraphic.geometry=d,this.enableMoveAllGraphics&&this.graphics.forEach(i=>{i!==this._activeGraphic&&(i.geometry=p(i.geometry,o,a,this.view))}),this._dragEvent=i,"start"===t){this._initialDragGeometry=e(l);const t=new G(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart?.(t),t.defaultPrevented&&this._activeGraphic.set("geometry",l)}else if("update"===t){const t=new b(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove?.(t),t.defaultPrevented&&(this._activeGraphic.geometry=l)}else{const t=new k(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop?.(t),t.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i),e=this.graphics;let s=null,r=Number.MAX_VALUE;this._syncLayerViews();const h=this._layerViews.flatMap(i=>"graphicsViews"in i?Array.from(i.graphicsViews(),i=>i.hitTest(t)).flat():i.graphicsView.hitTest(t)).filter(i=>e.includes(i)).sort((i,t)=>e.indexOf(i)-e.indexOf(t));return h.length?h[0]:(this._manipulators.forEach(t=>{const e=t.intersectionDistance(i);null!=e&&e<r&&(r=e,s=t.graphic)}),s)}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=m(this.view,t.layer);e&&i.add(e)}this._layerViews=[...i]}_setUpManipulators(){const{graphics:i,view:t}=this;this._manipulators.forEach(i=>i.destroy()),this._manipulators=i.length?i.map(i=>new x({graphic:i,view:t})):[]}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper.add(this.graphics,this.highlightName)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=U(i),this._indicators.push(t),this.addHandles(s(()=>i.symbol,()=>this._setUpIndicators()),M)}this.layer.addMany(this._indicators)}}_removeIndicators(){this.removeHandles(M),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach(i=>i.destroy()),this._indicators=[])}};function U(i){const t=12;if(null==i.symbol)return null;switch(i.symbol.type){case"cim":return new l({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,h=s===r?r:Math.max(s,r);return new l({xoffset:t,yoffset:e,size:h,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new l({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new n({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new c({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new l({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}i([h()],E.prototype,"_activeGraphic",void 0),i([h({readOnly:!0})],E.prototype,"type",void 0),i([h()],E.prototype,"callbacks",void 0),i([h()],E.prototype,"enableMoveAllGraphics",void 0),i([h()],E.prototype,"graphics",void 0),i([h()],E.prototype,"highlightName",void 0),i([h()],E.prototype,"highlightsEnabled",void 0),i([h()],E.prototype,"indicatorsEnabled",void 0),i([h()],E.prototype,"_defaultLayer",void 0),i([h()],E.prototype,"layer",void 0),i([h({readOnly:!0})],E.prototype,"state",null),i([h()],E.prototype,"view",void 0),E=i([o("esri.views.draw.support.GraphicMover")],E);export{E as default};
5
+ import{__decorate as i}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{clone as e}from"../../../core/lang.js";import{watch as s,when as r}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../layers/GraphicsLayer.js";import n from"../../../symbols/SimpleFillSymbol.js";import c from"../../../symbols/SimpleLineSymbol.js";import l from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as p}from"./drawUtils.js";import d from"./HighlightHelper.js";import{addUniqueLayer as g,findLayerView as v}from"./layerUtils.js";import{GraphicClickEvent as m,GraphicDoubleClickEvent as _,GraphicPointerDownEvent as y,GraphicPointerUpEvent as f,GraphicPointerOutEvent as u,GraphicPointerOverEvent as w,GraphicMoveStartEvent as G,GraphicMoveEvent as b,GraphicMoveStopEvent as k}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as O}from"../../input/InputManager.js";import{GraphicManipulator as x}from"../../interactive/GraphicManipulator.js";import{createScreenPointFromEvent as H}from"../../support/screenUtils.js";const M="indicator-symbols";let E=class extends t{constructor(i){super(i),this._activeGraphic=null,this._dragEvent=null,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!1,this.indicatorsEnabled=!1,this._defaultLayer=new a({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.layer=this._defaultLayer,this.view=null}initialize(){g(this.view,this.layer),this._highlightHelper=new d({view:this.view}),this.refresh(),this.addHandles([s(()=>this.graphics.length,()=>this.refresh()),r(()=>this.view?.ready,()=>{this.addHandles([this.view.on("immediate-click",i=>this._clickHandler(i),O.TOOL),this.view.on("double-click",i=>this._doubleClickHandler(i),O.TOOL),this.view.on("pointer-down",i=>this._pointerDownHandler(i),O.TOOL),this.view.on("pointer-move",i=>this._pointerMoveHandler(i),O.TOOL),this.view.on("pointer-up",i=>this._pointerUpHandler(i),O.TOOL),this.view.on("drag",i=>this._dragHandler(i),O.TOOL),this.view.on("key-down",i=>this._keyDownHandler(i),O.TOOL)])},{once:!0,initial:!0}),s(()=>this.view,i=>{this._highlightHelper.removeAll(),this._highlightHelper.view=i}),s(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})])}destroy(){this._removeIndicators(),this.view.map?.remove(this.layer),this._defaultLayer.destroy(),this.reset(),this._manipulators.forEach(i=>i.destroy()),this._manipulators=null}get state(){const i=this.view.ready,t=this.graphics.length>0,e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}_clickHandler(i){const t=this._findTargetGraphic(H(i));if(t){const e=new m(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick?.(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(H(i));if(t){const e=new _(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick?.(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(H(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new y(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown?.(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new f(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp?.(r),this._hoverGraphic=this._activeGraphic}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(H(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),h=new u(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",h),this.callbacks.onGraphicPointerOut?.(h)}const r=this.graphics.indexOf(t),h=new w(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",h),void this.callbacks.onGraphicPointerOver?.(h)}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new u(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut?.(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic?.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:s,y:r}=i,h=this.graphics.indexOf(this._activeGraphic),o=this._dragEvent?s-this._dragEvent.x:0,a=this._dragEvent?r-this._dragEvent.y:0,n=s-i.origin.x,c=r-i.origin.y,l="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,d=p(l,n,c,this.view);if(this._activeGraphic.geometry=d,this.enableMoveAllGraphics&&this.graphics.forEach(i=>{i!==this._activeGraphic&&(i.geometry=p(i.geometry,o,a,this.view))}),this._dragEvent=i,"start"===t){this._initialDragGeometry=e(l);const t=new G(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart?.(t),t.defaultPrevented&&this._activeGraphic.set("geometry",l)}else if("update"===t){const t=new b(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove?.(t),t.defaultPrevented&&(this._activeGraphic.geometry=l)}else{const t=new k(this._activeGraphic,this.graphics,h,s,r,o,a,n,c,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop?.(t),t.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i),e=this.graphics;let s=null,r=Number.MAX_VALUE;this._syncLayerViews();const h=this._layerViews.flatMap(i=>"graphicsViews"in i?Array.from(i.graphicsViews(),i=>i.hitTest(t)).flat():i.graphicsView.hitTest(t)).filter(i=>e.includes(i)).sort((i,t)=>e.indexOf(i)-e.indexOf(t));return h.length?h[0]:(this._manipulators.forEach(t=>{const e=t.intersectionDistance(i);null!=e&&e<r&&(r=e,s=t.graphic)}),s)}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=v(this.view,t.layer);e&&i.add(e)}this._layerViews=[...i]}_setUpManipulators(){const{graphics:i,view:t}=this;this._manipulators.forEach(i=>i.destroy()),this._manipulators=i.length?i.map(i=>new x({graphic:i,view:t})):[]}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper.add(this.graphics,this.highlightName)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=U(i),this._indicators.push(t),this.addHandles(s(()=>i.symbol,()=>this._setUpIndicators()),M)}this.layer.addMany(this._indicators)}}_removeIndicators(){this.removeHandles(M),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach(i=>i.destroy()),this._indicators=[])}};function U(i){const t=12;if(null==i.symbol)return null;switch(i.symbol.type){case"cim":return new l({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,h=s===r?r:Math.max(s,r);return new l({xoffset:t,yoffset:e,size:h,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new l({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new n({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new c({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new l({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}i([h()],E.prototype,"_activeGraphic",void 0),i([h({readOnly:!0})],E.prototype,"type",void 0),i([h()],E.prototype,"callbacks",void 0),i([h()],E.prototype,"enableMoveAllGraphics",void 0),i([h()],E.prototype,"graphics",void 0),i([h()],E.prototype,"highlightName",void 0),i([h()],E.prototype,"highlightsEnabled",void 0),i([h()],E.prototype,"indicatorsEnabled",void 0),i([h()],E.prototype,"_defaultLayer",void 0),i([h()],E.prototype,"layer",void 0),i([h({readOnly:!0})],E.prototype,"state",null),i([h()],E.prototype,"view",void 0),E=i([o("esri.views.draw.support.GraphicMover")],E);export{E as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,assertIsSome as h,abortMaybe as p}from"../../../core/maybe.js";import{pausable as c,when as l,watch as d,initial as m,sync as v}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import u from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as f,getMidpoint as x,geometryToCoordinates as G}from"../../../geometry/support/coordsUtils.js";import M from"../../../layers/GraphicsLayer.js";import b from"../../../symbols/SimpleMarkerSymbol.js";import{SnappingVisualizer2D as V}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as S}from"./ConnectedReshapeManager.js";import{cloneMove as w}from"./drawUtils.js";import E from"./GraphicMover.js";import I from"./HighlightHelper.js";import{addUniqueLayer as O,isConnectedReshapeSupportedLayer as C}from"./layerUtils.js";import{createTooltipInfos as k,connectTooltip as T,updateTranslateTooltipInfo as H,updateTranslateVertexTooltipInfo as R}from"./reshapeTooltipUtils.js";import{settings as j}from"./settings.js";import{ViewEventPriorities as A}from"../../input/InputManager.js";import{createCoordinateHelper as U}from"../../interactive/coordinateHelper.js";import{sketchKeys as L}from"../../interactive/keybindings.js";import{EditGeometryOperations as P}from"../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as D}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as F,enterInputModeIfAvailable as N}from"../../interactive/tooltip/tooltipCommonUtils.js";const Z=j.reshapeGraphics,X={vertices:{default:new b({style:"circle",size:Z.vertex.size,color:Z.vertex.color,outline:{color:Z.vertex.outlineColor,width:1}}),hover:new b({style:"circle",size:Z.vertex.hoverSize,color:Z.vertex.hoverColor,outline:{color:Z.vertex.hoverOutlineColor,width:1}}),selected:new b({style:"circle",size:Z.selected.size,color:Z.selected.color,outline:{color:Z.selected.outlineColor,width:1}})},midpoints:{default:new b({style:"circle",size:Z.midpoint.size,color:Z.midpoint.color,outline:{color:Z.midpoint.outlineColor,width:1}}),hover:new b({style:"circle",size:Z.midpoint.size,color:Z.midpoint.color,outline:{color:Z.midpoint.outlineColor,width:1}})}},Y=Symbol();let q=class extends r{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this.activeTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=[],this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.midpointGraphics=new s,this.midpointSymbol=new b({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=new s,this.snappingManager=null,this.symbols=X,this.sketchOptions=new z,this.type="reshape",this.vertexGraphics=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new I({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=c(()=>this.graphic?.geometry,e=>{if(!e)return;const t=new Set(this.selectedVertices.map(e=>e.attributes?.pointIndex));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(e.attributes.pointIndex)).forEach(e=>this._addToSelection(e));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n}=this,a=n.concat(r).items;i&&a.push(o),s?.set("graphics",a)},v),this.tooltip=F(()=>({view:e,options:this.sketchOptions.tooltips})),this.tooltipInfos=k(this.sketchOptions),this.addHandles([l(()=>e?.ready,()=>{const{layer:e,view:t}=this;O(t,e),this.addHandles(t.on("key-down",e=>this._keyDownHandler(e),A.TOOL))},{once:!0,initial:!0}),d(()=>this.graphic,()=>this.refresh()),d(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),d(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),d(()=>this.enableMidpoints,()=>this.refresh()),T(this.tooltip,()=>this._tooltipsContext),d(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),m),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._connectedReshapeManager=a(this._connectedReshapeManager),this.tooltip=a(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??U(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _selectedVertex(){return 1===this.selectedVertices.length?this.selectedVertices.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:e,automaticLengthMeasurementUtils:t,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedVertex,automaticAreaMeasurementUtils:e,automaticLengthMeasurementUtils:t,updateGeometry:(e,t,i,s,o)=>{this._setUpGeometryHelper();const r=e===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e);const n=!0;if(this._syncGeometryAfterVertexMove(e,t,s,o,n),r){const{view:e}=this,s=e.toScreen(i),o=e.toScreen(t),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e);this._editGeometryOperations=a(this._editGeometryOperations)}}}get state(){const e=this.view.ready,t=!(!this.graphic||!this.layer);return e&&t?"active":e?"ready":"disabled"}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length>0&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedVertices:e}=this;e.length&&this._removeVertices(e)}_setup(){const{graphic:e,layer:t}=this;if(!t||null==e?.geometry)return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&f(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(null==e||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new u({paths:[e.points],spatialReference:e.spatialReference}):e;this._editGeometryOperations=P.fromGeometry(t,2)}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new M({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;h(i),this._snappingContext=new D({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new V(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover?.destroy(),this._mover=null,this.removeHandles(Y)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=a(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this.selectedVertices.removeAll(),this._updateTooltip()}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach(e=>e.destroy()),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach(e=>e.destroy()),this.vertexGraphics.removeAll()}_setupGraphics(){const e=this.graphic.geometry;if(null!=e&&("polyline"===e.type||"polygon"===e.type)){const t=K(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s}=this,o=[];return e?.forEach((e,r)=>{e.forEach((e,n)=>{o.push(new t({geometry:this._coordinateHelper.arrayToPoint(e),symbol:s?.vertices?.default,attributes:{...i,pathIndex:r,pointIndex:n}}))})}),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s}=this,o=[];for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++){const a=(e+1)%n.length;if("polyline"===this.graphic.geometry?.type&&0===a)continue;const h=n[e],p=n[a],c=this._getMidpoint(h,p);o.push(new t({geometry:c,symbol:s.midpoints.default,attributes:{...i,pathIndex:r,pointIndexStart:e,pointIndexEnd:a}}))}}return o}_updateSymbolsForTheme(){const 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)},midpoints:{...this.symbols.midpoints}};for(const t of this.vertexGraphics)this._isSelected(t)?t.symbol=this.symbols.vertices.selected:this._hoverGraphic===t?t.symbol=this.symbols.vertices.hover:t.symbol=this.symbols.vertices.default}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const o=t[i],r=t[e];o.x===r.x&&o.y===r.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i).items;e&&r.push(t),this._mover=new E({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,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(){const{connectedReshapeProviders:e}=this;0!==e.length&&(this._connectedReshapeManager=new S({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,o=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const{dx:t,dy:i,graphic:s}=e,o=this._connectedReshapeManager,r=o?Q(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(e),this._emitMoveStartEvent(t,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,i)}))}const{selectedVertices:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),t=this._createVertexFromMidpoint(s);this._emitVertexAddEvent([s],e,t)}this._addToSelection(s)}this._setUpOperation(e),r&&o?.startVertexMove(r,W(n)),this._emitReshapeStartEvent(s),this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(s,e.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e;t.totalDx+=i,t.totalDy+=s;const{operationType:r}=t,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(o,e.viewEvent),this._emitReshapeEvent(o)});else if("point"===n.type)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const t=K(n);this._updateVertexGraphicLocations(t);const{dxMap:o,dyMap:r}=$(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e,{operationType:r}=t;t.totalDx+=i,t.totalDy+=s,this._onHandleMove(o,i,s,e,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(e){const{_coordinateHelper:t}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=t.arrayToPoint(e[s][o])}this._updateMidpointGraphicLocations(e)}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:o}=t.attributes,r=e[i];t.geometry=this._getMidpoint(r[s],r[o])}}_getMidpoint(e,t){const{_coordinateHelper:i}=this,s=i.arrayToVector(e),o=i.arrayToVector(t),r=i.toXYZ(s),n=i.toXYZ(o),[a,h,p]=x(r,n),c=i.hasM()?0:void 0;return new g({x:a,y:h,z:p,m:c,spatialReference:i.spatialReference})}_getVertexFromEditGeometry(e){const[t,i]=B(e);return h(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[i]}_onHandleMove(e,t,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=e.geometry,h="graphic-move-stop"===o.type;if(null!=this.snappingManager&&this.selectedVertices.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(e,new g(this._stagedVertex),t,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(e,new g(this._stagedVertex),t,s,h),r())})}else{const i=null!=this._stagedVertex?new g(this._stagedVertex):a;this._syncGeometryAfterVertexMove(e,i,t,s,h),r()}}_syncGeometryAfterVertexMove(e,t,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry;if(r)if("point"===r.type)e.geometry=t;else if("mesh"===r.type)e.geometry=r.centerAt(t);else{const{_coordinateHelper:n}=this,[a,h]=B(e);let p=G(r);const c=p[a].length-1,l=n.pointToArray(t);p[a][h]=l,"polygon"===r.type&&(0===h?p[a][c]=l:h===c&&(p[a][0]=l)),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,l),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p)),this._updateGraphicGeometry(r.clone());const d=n.pointToVector(t),m=this._getVertexFromEditGeometry(e),v=n.getZ(d),y=d[0]-m.pos[0],_=d[1]-m.pos[1],g=null!=v?v-m.pos[2]:0;this._editGeometryOperations?.moveVertices([m],y,_,g),this._connectedReshapeManager?.translate(y,_,g),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i){const{relatedGraphicIndices:s}=t.attributes;for(const o of s){const s=this.vertexGraphics.at(o),{pathIndex:r,pointIndex:n}=s.attributes;e[r][n]=i,s.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,o){for(const r of this.selectedVertices)if(r!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:a}=r.attributes,h=w(r.geometry,i,s,this.view),p=G(h),c=e[t].length-1;e[t][n]=p,r.geometry=h,o&&(0===n?e[t][c]=p:n===c&&(e[t][0]=p));for(const i of a){const t=this.vertexGraphics.at(i),{pathIndex:s,pointIndex:o}=t.attributes;e[s][o]=p,t.geometry=h}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._hoverGraphic=t;const i=this._isVertex(t);i&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateTooltip(i?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.removeHandles(Y),this._updateTooltip()}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(null==s||"polygon"!==s.type&&"polyline"!==s.type)return[];const o=s.clone(),r=[],{pathIndex:n,pointIndexStart:a,pointIndexEnd:h}=e.attributes,p=G(e.geometry),c=0===h?a+1:h,l=G(o);return l[n].splice(c,0,p),e.attributes={...t,pathIndex:n,pointIndex:c,relatedGraphicIndices:[]},r.push({coordinates:l[n][c],componentIndex:n,vertexIndex:c}),this._updateGraphicGeometry(o),r}_addToSelection(e){const t=J(e);for(const i of t)i.symbol=this.symbols.vertices.selected,this.selectedVertices.add(i),this._updateTooltip(i);this._emitSelectEvent(t)}_removeFromSelection(e,t){const{vertices:i}=this.symbols,s=t?i.hover:i.default;this.selectedVertices.remove(e),e.symbol=s,this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){const e=this.selectedVertices.toArray();if(e.length>0){for(const t of e)t.set("symbol",this.symbols.vertices.default);this.selectedVertices.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){null==this._activeOperationInfo&&N(e,this.tooltip)||L.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const t=this.graphic.geometry;if(null==t||"polygon"!==t.type&&"polyline"!==t.type)return;if("polygon"===t.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;const i=this.graphic.clone(),s=t.clone();let o=G(s);const r=[],n=J(e);for(const a of n){const{x:e,y:t}=a.geometry;for(let i=0;i<o.length;i++){const s=o[i];for(let n=0;n<s.length;n++){const[a,h]=s[n];e===a&&t===h&&(r.push({coordinates:o[i][n],componentIndex:i,vertexIndex:n}),o[i].splice(Number(n),1))}}}if("polygon"===s.type)o=o.filter(e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,o]=e[e.length-1];return(2!==e.length||t!==s||i!==o)&&(t===s&&i===o||e.push(e[0]),!0)}),s.rings=o;else{for(const e of o)1===e.length&&o.splice(o.indexOf(e),1);s.paths=o}this._updateGraphicGeometry(s),this.refresh(),this._emitVertexRemoveEvent(n,i,r)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){const t=this._isMidpoint(e)?"copy":"move";this.addHandles(this.view.acquireCursor(t,"high"),Y)}_updateTooltip(e,t){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedVertex?i=r.selectedVertex:e===this.graphic?(i=r.translateGraphic,H(i,o,this._tooltipsContext,t)):e&&this.selectedVertices.length>1&&(i=r.translateVertices,R(i,o,n,this._tooltipsContext,t)),this.activeTooltipInfo=i}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){const i={type:"move-start",mover:this.graphic,dx:e,dy:t};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(e,t){const i={type:"move",mover:this.graphic,dx:e,dy:t};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(e,t){if(null==e||null==t){const i=this._activeOperationInfo;if(!i)return;e=i.totalDx,t=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:e,dy:t};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(e){const t={type:"reshape-start",graphic:this.graphic,mover:e,selected:this.selectedVertices.toArray()};this.emit("reshape-start",t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){const t={type:"reshape",graphic:this.graphic,mover:e,selected:this.selectedVertices.toArray()};this.emit("reshape",t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){const t={type:"reshape-stop",graphic:this.graphic,mover:e,selected:this.selectedVertices.toArray()};this.emit("reshape-stop",t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){const t={type:"vertex-select",added:e};this.emit("select",t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){const t={type:"vertex-deselect",removed:e};this.emit("deselect",t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,i){const s={type:"vertex-add",added:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(e,t,i){const s={type:"vertex-remove",removed:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function K(e){const t=G(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}function B({attributes:e}){return[e?.pathIndex||0,e?.pointIndex||0]}function J(e){return e instanceof t?[e]:[...e]}function Q(e){const t=e.sourceLayer??e.layer;return C(t)?{graphic:e,layer:t}:null}function W(e){return e.toArray().map(e=>({pathIndex:e.attributes.pathIndex,vertexIndex:e.attributes.pointIndex}))}function $(e,t,i){const s=i.state.inverseTransform;return{dxMap:s[0]*e+s[2]*t,dyMap:s[1]*e+s[3]*t}}e([y()],q.prototype,"_activeOperationInfo",void 0),e([y()],q.prototype,"_connectedReshapeManager",void 0),e([y()],q.prototype,"_coordinateHelper",null),e([y()],q.prototype,"_editGeometryOperations",void 0),e([y()],q.prototype,"tooltip",void 0),e([y()],q.prototype,"tooltipInfos",void 0),e([y()],q.prototype,"activeTooltipInfo",void 0),e([y({constructOnly:!0})],q.prototype,"automaticAreaMeasurementUtils",void 0),e([y({constructOnly:!0})],q.prototype,"automaticLengthMeasurementUtils",void 0),e([y()],q.prototype,"_selectedVertex",null),e([y()],q.prototype,"_tooltipsContext",null),e([y()],q.prototype,"callbacks",void 0),e([y()],q.prototype,"connectedReshapeProviders",void 0),e([y()],q.prototype,"enableMidpoints",void 0),e([y()],q.prototype,"enableMovement",void 0),e([y()],q.prototype,"enableVertices",void 0),e([y()],q.prototype,"graphic",void 0),e([y()],q.prototype,"highlightName",void 0),e([y()],q.prototype,"highlightsEnabled",void 0),e([y()],q.prototype,"layer",void 0),e([y({readOnly:!0})],q.prototype,"midpointGraphics",void 0),e([y()],q.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],q.prototype,"selectedVertices",void 0),e([y()],q.prototype,"snappingManager",void 0),e([y({readOnly:!0})],q.prototype,"state",null),e([y()],q.prototype,"symbols",void 0),e([y({type:z})],q.prototype,"sketchOptions",void 0),e([y({readOnly:!0})],q.prototype,"type",void 0),e([y({readOnly:!0})],q.prototype,"vertexGraphics",void 0),e([y()],q.prototype,"view",void 0),q=e([_("esri.views.draw.support.Reshape")],q);const ee=q;export{ee as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,assertIsSome as h,abortMaybe as p}from"../../../core/maybe.js";import{pausable as c,when as l,watch as d,initial as m,sync as v}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import{closeRingsAndFixWinding as u,getMidpoint as f,geometryToCoordinates as x}from"../../../geometry/support/coordsUtils.js";import G from"../../../layers/GraphicsLayer.js";import M from"../../../symbols/SimpleMarkerSymbol.js";import{SnappingVisualizer2D as b}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as V}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as S,cloneMove as w}from"./drawUtils.js";import E from"./GraphicMover.js";import I from"./HighlightHelper.js";import{addUniqueLayer as O,isConnectedReshapeSupportedLayer as C}from"./layerUtils.js";import{createTooltipInfos as k,connectTooltip as T,updateTranslateTooltipInfo as H,updateTranslateVertexTooltipInfo as R}from"./reshapeTooltipUtils.js";import{settings as j}from"./settings.js";import{ViewEventPriorities as A}from"../../input/InputManager.js";import{createCoordinateHelper as U}from"../../interactive/coordinateHelper.js";import{sketchKeys as L}from"../../interactive/keybindings.js";import{EditGeometryOperations as z}from"../../interactive/editGeometry/EditGeometryOperations.js";import D from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as F}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as P,enterInputModeIfAvailable as N}from"../../interactive/tooltip/tooltipCommonUtils.js";const Z=j.reshapeGraphics,X={vertices:{default:new M({style:"circle",size:Z.vertex.size,color:Z.vertex.color,outline:{color:Z.vertex.outlineColor,width:1}}),hover:new M({style:"circle",size:Z.vertex.hoverSize,color:Z.vertex.hoverColor,outline:{color:Z.vertex.hoverOutlineColor,width:1}}),selected:new M({style:"circle",size:Z.selected.size,color:Z.selected.color,outline:{color:Z.selected.outlineColor,width:1}})},midpoints:{default:new M({style:"circle",size:Z.midpoint.size,color:Z.midpoint.color,outline:{color:Z.midpoint.outlineColor,width:1}}),hover:new M({style:"circle",size:Z.midpoint.size,color:Z.midpoint.color,outline:{color:Z.midpoint.outlineColor,width:1}})}},Y=Symbol();let q=class extends r{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this.activeTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=[],this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.midpointGraphics=new s,this.midpointSymbol=new M({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=new s,this.snappingManager=null,this.symbols=X,this.sketchOptions=new D,this.type="reshape",this.vertexGraphics=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new I({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=c(()=>this.graphic?.geometry,e=>{if(!e)return;const t=new Set(this.selectedVertices.map(e=>e.attributes?.pointIndex));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(e.attributes.pointIndex)).forEach(e=>this._addToSelection(e));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n}=this,a=n.concat(r).items;i&&a.push(o),s?.set("graphics",a)},v),this.tooltip=P(()=>({view:e,options:this.sketchOptions.tooltips})),this.tooltipInfos=k(this.sketchOptions),this.addHandles([l(()=>e?.ready,()=>{const{layer:e,view:t}=this;O(t,e),this.addHandles(t.on("key-down",e=>this._keyDownHandler(e),A.TOOL))},{once:!0,initial:!0}),d(()=>this.graphic,()=>this.refresh()),d(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),d(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),d(()=>this.enableMidpoints,()=>this.refresh()),T(this.tooltip,()=>this._tooltipsContext),d(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),m),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._connectedReshapeManager=a(this._connectedReshapeManager),this.tooltip=a(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??U(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _selectedVertex(){return 1===this.selectedVertices.length?this.selectedVertices.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:e,automaticLengthMeasurementUtils:t,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedVertex,automaticAreaMeasurementUtils:e,automaticLengthMeasurementUtils:t,updateGeometry:(e,t,i,s,o)=>{this._setUpGeometryHelper();const r=e===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e);const n=!0;if(this._syncGeometryAfterVertexMove(e,t,s,o,n),r){const{view:e}=this,s=e.toScreen(i),o=e.toScreen(t),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e);this._editGeometryOperations=a(this._editGeometryOperations)}}}get state(){const e=this.view.ready,t=!(!this.graphic||!this.layer);return e&&t?"active":e?"ready":"disabled"}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length>0&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedVertices:e}=this;e.length&&this._removeVertices(e)}_setup(){const{graphic:e,layer:t}=this;if(!t||null==e?.geometry)return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&u(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const e=this.graphic.geometry;null!=e&&"mesh"!==e.type&&"extent"!==e.type?this._editGeometryOperations=z.fromGeometry(e,2):this._logGeometryTypeError()}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new G({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;h(i),this._snappingContext=new F({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new b(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover?.destroy(),this._mover=null,this.removeHandles(Y)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=a(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this.selectedVertices.removeAll(),this._updateTooltip()}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach(e=>e.destroy()),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach(e=>e.destroy()),this.vertexGraphics.removeAll()}_setupGraphics(){const e=this.graphic.geometry;if(null!=e&&("polyline"===e.type||"polygon"===e.type||"multipoint"===e.type)){const t=K(e);this.enableMidpoints&&"multipoint"!==e.type&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s}=this,o=[];return e?.forEach((e,r)=>{e.forEach((e,n)=>{o.push(new t({geometry:this._coordinateHelper.arrayToPoint(e),symbol:s?.vertices?.default,attributes:{...i,pathIndex:r,pointIndex:n}}))})}),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s}=this,o=[];for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++){const a=(e+1)%n.length;if("polyline"===this.graphic.geometry?.type&&0===a)continue;const h=n[e],p=n[a],c=this._getMidpoint(h,p);o.push(new t({geometry:c,symbol:s.midpoints.default,attributes:{...i,pathIndex:r,pointIndexStart:e,pointIndexEnd:a}}))}}return o}_updateSymbolsForTheme(){const 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)},midpoints:{...this.symbols.midpoints}};for(const t of this.vertexGraphics)this._isSelected(t)?t.symbol=this.symbols.vertices.selected:this._hoverGraphic===t?t.symbol=this.symbols.vertices.hover:t.symbol=this.symbols.vertices.default}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const o=t[i],r=t[e];o.x===r.x&&o.y===r.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i).items;e&&"multipoint"!==t.geometry?.type&&r.push(t),this._mover=new E({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,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(){const{connectedReshapeProviders:e}=this;0!==e.length&&(this._connectedReshapeManager=new V({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,o=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const{dx:t,dy:i,graphic:s}=e,o=this._connectedReshapeManager,r=o?Q(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(e),this._emitMoveStartEvent(t,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,i)}))}const{selectedVertices:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),t=this._createVertexFromMidpoint(s);this._emitVertexAddEvent([s],e,t)}this._addToSelection(s)}this._setUpOperation(e),r&&o?.startVertexMove(r,W(n)),this._emitReshapeStartEvent(s),this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(s,e.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e;t.totalDx+=i,t.totalDy+=s;const{operationType:r}=t,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(o,e.viewEvent),this._emitReshapeEvent(o)});else if("point"===n.type)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const t=K(n);this._updateVertexGraphicLocations(t);const{dxMap:o,dyMap:r}=S(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e,{operationType:r}=t;t.totalDx+=i,t.totalDy+=s,this._onHandleMove(o,i,s,e,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(e){const{_coordinateHelper:t}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=t.arrayToPoint(e[s][o])}this._updateMidpointGraphicLocations(e)}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:o}=t.attributes,r=e[i];t.geometry=this._getMidpoint(r[s],r[o])}}_getMidpoint(e,t){const{_coordinateHelper:i}=this,s=i.arrayToVector(e),o=i.arrayToVector(t),r=i.toXYZ(s),n=i.toXYZ(o),[a,h,p]=f(r,n),c=i.hasM()?0:void 0;return new g({x:a,y:h,z:p,m:c,spatialReference:i.spatialReference})}_getVertexFromEditGeometry(e){const[t,i]=B(e);return h(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[i]}_onHandleMove(e,t,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=e.geometry,h="graphic-move-stop"===o.type;if(null!=this.snappingManager&&this.selectedVertices.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(e,new g(this._stagedVertex),t,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(e,new g(this._stagedVertex),t,s,h),r())})}else{const i=null!=this._stagedVertex?new g(this._stagedVertex):a;this._syncGeometryAfterVertexMove(e,i,t,s,h),r()}}_syncGeometryAfterVertexMove(e,t,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry;if(r)if("point"===r.type)e.geometry=t;else if("mesh"===r.type)e.geometry=r.centerAt(t);else{const{_coordinateHelper:n}=this,[a,h]=B(e);let p=x(r);const c=p[a].length-1,l=n.pointToArray(t);if(p[a][h]=l,"polygon"===r.type&&(0===h?p[a][c]=l:h===c&&(p[a][0]=l)),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,l),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p)),"multipoint"===r.type&&r.points)for(let e=0;e<p.length;e++)r.points[e]=p[e][0];this._updateGraphicGeometry(r.clone());const d=n.pointToVector(t),m=this._getVertexFromEditGeometry(e),v=n.getZ(d),y=d[0]-m.pos[0],_=d[1]-m.pos[1],g=null!=v?v-m.pos[2]:0;this._editGeometryOperations?.moveVertices([m],y,_,g),this._connectedReshapeManager?.translate(y,_,g),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i){const{relatedGraphicIndices:s}=t.attributes;for(const o of s){const s=this.vertexGraphics.at(o),{pathIndex:r,pointIndex:n}=s.attributes;e[r][n]=i,s.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,o){for(const r of this.selectedVertices)if(r!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:a}=r.attributes,h=w(r.geometry,i,s,this.view),p=x(h),c=e[t].length-1;e[t][n]=p,r.geometry=h,o&&(0===n?e[t][c]=p:n===c&&(e[t][0]=p));for(const i of a){const t=this.vertexGraphics.at(i),{pathIndex:s,pointIndex:o}=t.attributes;e[s][o]=p,t.geometry=h}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._hoverGraphic=t;const i=this._isVertex(t);i&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateTooltip(i?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.removeHandles(Y),this._updateTooltip()}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(null==s||"polygon"!==s.type&&"polyline"!==s.type)return[];const o=s.clone(),r=[],{pathIndex:n,pointIndexStart:a,pointIndexEnd:h}=e.attributes,p=x(e.geometry),c=0===h?a+1:h,l=x(o);return l[n].splice(c,0,p),e.attributes={...t,pathIndex:n,pointIndex:c,relatedGraphicIndices:[]},r.push({coordinates:l[n][c],componentIndex:n,vertexIndex:c}),this._updateGraphicGeometry(o),r}_addToSelection(e){const t=J(e);for(const i of t)i.symbol=this.symbols.vertices.selected,this.selectedVertices.add(i),this._updateTooltip(i);this._emitSelectEvent(t)}_removeFromSelection(e,t){const{vertices:i}=this.symbols,s=t?i.hover:i.default;this.selectedVertices.remove(e),e.symbol=s,this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){const e=this.selectedVertices.toArray();if(e.length>0){for(const t of e)t.set("symbol",this.symbols.vertices.default);this.selectedVertices.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){null==this._activeOperationInfo&&N(e,this.tooltip)||L.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const t=this.graphic.geometry,i=this.vertexGraphics.length;if(null==t||"polygon"!==t.type&&"polyline"!==t.type&&"multipoint"!==t.type)return;if("polygon"===t.type&&i<4||"multipoint"===t.type&&i<2||"polyline"===t.type&&i<3)return;const s=this.graphic.clone(),o=t.clone();let r=x(o);const n=[],a=J(e);for(const h of a){const{x:e,y:t}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=s[o];e===a&&t===h&&(n.push({coordinates:r[i][o],componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1))}}}if("polygon"===o.type)r=r.filter(e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,o]=e[e.length-1];return(2!==e.length||t!==s||i!==o)&&(t===s&&i===o||e.push(e[0]),!0)}),o.rings=r;else if("polyline"===o.type){for(const e of r)1===e.length&&r.splice(r.indexOf(e),1);o.paths=r}else o.points=r.flat();this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){const t=this._isMidpoint(e)?"copy":"move";this.addHandles(this.view.acquireCursor(t,"high"),Y)}_updateTooltip(e,t){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedVertex?i=r.selectedVertex:e===this.graphic?(i=r.translateGraphic,H(i,o,this._tooltipsContext,t)):e&&this.selectedVertices.length>1&&(i=r.translateVertices,R(i,o,n,this._tooltipsContext,t)),this.activeTooltipInfo=i}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){const i={type:"move-start",mover:this.graphic,dx:e,dy:t};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(e,t){const i={type:"move",mover:this.graphic,dx:e,dy:t};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(e,t){if(null==e||null==t){const i=this._activeOperationInfo;if(!i)return;e=i.totalDx,t=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:e,dy:t};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(e){const t={type:"reshape-start",graphic:this.graphic,mover:e,selected:this.selectedVertices.toArray()};this.emit("reshape-start",t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){const t={type:"reshape",graphic:this.graphic,mover:e,selected:this.selectedVertices.toArray()};this.emit("reshape",t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){const t={type:"reshape-stop",graphic:this.graphic,mover:e,selected:this.selectedVertices.toArray()};this.emit("reshape-stop",t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){const t={type:"vertex-select",added:e};this.emit("select",t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){const t={type:"vertex-deselect",removed:e};this.emit("deselect",t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,i){const s={type:"vertex-add",added:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(e,t,i){const s={type:"vertex-remove",removed:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function K(e){const t=x(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}function B({attributes:e}){return[e?.pathIndex||0,e?.pointIndex||0]}function J(e){return e instanceof t?[e]:[...e]}function Q(e){const t=e.sourceLayer??e.layer;return C(t)?{graphic:e,layer:t}:null}function W(e){return e.toArray().map(e=>({pathIndex:e.attributes.pathIndex,vertexIndex:e.attributes.pointIndex}))}e([y()],q.prototype,"_activeOperationInfo",void 0),e([y()],q.prototype,"_connectedReshapeManager",void 0),e([y()],q.prototype,"_coordinateHelper",null),e([y()],q.prototype,"_editGeometryOperations",void 0),e([y()],q.prototype,"tooltip",void 0),e([y()],q.prototype,"tooltipInfos",void 0),e([y()],q.prototype,"activeTooltipInfo",void 0),e([y({constructOnly:!0})],q.prototype,"automaticAreaMeasurementUtils",void 0),e([y({constructOnly:!0})],q.prototype,"automaticLengthMeasurementUtils",void 0),e([y()],q.prototype,"_selectedVertex",null),e([y()],q.prototype,"_tooltipsContext",null),e([y()],q.prototype,"callbacks",void 0),e([y()],q.prototype,"connectedReshapeProviders",void 0),e([y()],q.prototype,"enableMidpoints",void 0),e([y()],q.prototype,"enableMovement",void 0),e([y()],q.prototype,"enableVertices",void 0),e([y()],q.prototype,"graphic",void 0),e([y()],q.prototype,"highlightName",void 0),e([y()],q.prototype,"highlightsEnabled",void 0),e([y()],q.prototype,"layer",void 0),e([y({readOnly:!0})],q.prototype,"midpointGraphics",void 0),e([y()],q.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],q.prototype,"selectedVertices",void 0),e([y()],q.prototype,"snappingManager",void 0),e([y({readOnly:!0})],q.prototype,"state",null),e([y()],q.prototype,"symbols",void 0),e([y({type:D})],q.prototype,"sketchOptions",void 0),e([y({readOnly:!0})],q.prototype,"type",void 0),e([y({readOnly:!0})],q.prototype,"vertexGraphics",void 0),e([y()],q.prototype,"view",void 0),q=e([_("esri.views.draw.support.Reshape")],q);const $=q;export{$ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as t}from"../../../core/mathUtils.js";import{create as n}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as e}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as o}from"../../../geometry/support/coordsUtils.js";function r(t,n,e,r){if(null==r||t.hasZ||(r=void 0),"point"===t.type)return t.x+=n,t.y+=e,t.hasZ&&null!=r&&(t.z+=r),t;if("multipoint"===t.type){const o=t.points;for(let t=0;t<o.length;t++)o[t]=l(o[t],n,e,r);return t}if("extent"===t.type)return t.xmin+=n,t.xmax+=n,t.ymin+=e,t.ymax+=e,null!=r&&(t.zmin??=0,t.zmin+=r,t.zmax??=0,t.zmax+=r),t;const i=o(t),s="polyline"===t.type?t.paths:t.rings;for(let o=0;o<i.length;o++){const t=i[o];for(let o=0;o<t.length;o++)t[o]=l(t[o],n,e,r)}return"paths"in t?t.paths=s:t.rings=s,t}function i(t,n,e,i,s){const a=t.clone(),m=i.resolution;if("point"===a.type){if(s)r(a,n*m,-e*m);else{const t=i.state.transform,o=i.state.inverseTransform,r=t[0]*a.x+t[2]*a.y+t[4],s=t[1]*a.x+t[3]*a.y+t[5];a.x=o[0]*(r+n)+o[2]*(s+e)+o[4],a.y=o[1]*(r+n)+o[3]*(s+e)+o[5]}return a}if("multipoint"===a.type){if(s)r(a,n*m,-e*m);else{const t=a.points,o=i.state.transform,r=i.state.inverseTransform;for(let i=0;i<t.length;i++){const s=t[i],a=o[0]*s[0]+o[2]*s[1]+o[4],m=o[1]*s[0]+o[3]*s[1]+o[5],l=r[0]*(a+n)+r[2]*(m+e)+r[4],p=r[1]*(a+n)+r[3]*(m+e)+r[5];t[i]=x(s,l,p,void 0)}}return a}if("extent"===a.type){if(s)r(a,n*m,-e*m);else{const t=i.state.transform,o=i.state.inverseTransform,r=t[0]*a.xmin+t[2]*a.ymin+t[4],s=t[1]*a.xmin+t[3]*a.ymin+t[5],m=t[0]*a.xmax+t[2]*a.ymax+t[4],l=t[1]*a.xmax+t[3]*a.ymax+t[5];a.xmin=o[0]*(r+n)+o[2]*(s+e)+o[4],a.ymin=o[1]*(r+n)+o[3]*(s+e)+o[5],a.xmax=o[0]*(m+n)+o[2]*(l+e)+o[4],a.ymax=o[1]*(m+n)+o[3]*(l+e)+o[5]}return a}if(s)r(a,n*m,-e*m);else{const t=o(a),r="polyline"===a.type?a.paths:a.rings,s=i.state.transform,m=i.state.inverseTransform;for(let o=0;o<t.length;o++){const r=t[o];for(let t=0;t<r.length;t++){const o=r[t],i=s[0]*o[0]+s[2]*o[1]+s[4],a=s[1]*o[0]+s[3]*o[1]+s[5],l=m[0]*(i+n)+m[2]*(a+e)+m[4],p=m[1]*(i+n)+m[3]*(a+e)+m[5];r[t]=x(o,l,p,void 0)}}"paths"in a?a.paths=r:a.rings=r}return a}function s(t,r,i,s){if("point"===t.type){const{x:n,y:e}=t,o=s?s[0]:n,a=s?s[1]:e,m=t.clone(),l=(n-o)*r+o,x=(e-a)*i+a;return m.x=l,m.y=x,m}if("multipoint"===t.type){const a=o(t),m=n(),[l,p,y,f]=e(m,[a]),u=s?s[0]:(l+y)/2,c=s?s[1]:(f+p)/2,h=t.clone(),g=h.points;for(let t=0;t<g.length;t++){const n=g[t],[e,o]=n,s=(e-u)*r+u,a=(o-c)*i+c;g[t]=x(n,s,a,void 0)}return h}if("extent"===t.type){const{xmin:n,xmax:e,ymin:o,ymax:a}=t,m=s?s[0]:(n+e)/2,l=s?s[1]:(a+o)/2,x=t.clone();if(x.xmin=(n-m)*r+m,x.ymax=(a-l)*i+l,x.xmax=(e-m)*r+m,x.ymin=(o-l)*i+l,x.xmin>x.xmax){const t=x.xmin,n=x.xmax;x.xmin=n,x.xmax=t}if(x.ymin>x.ymax){const t=x.ymin,n=x.ymax;x.ymin=n,x.ymax=t}return x}const a=o(t),m=n(),[l,p,y,f]=e(m,a),u=s?s[0]:(l+y)/2,c=s?s[1]:(f+p)/2,h=t.clone(),g="polyline"===h.type?h.paths:h.rings;for(let n=0;n<a.length;n++){const t=a[n];for(let e=0;e<t.length;e++){const o=t[e],[s,a]=o,m=(s-u)*r+u,l=(a-c)*i+c;g[n][e]=x(o,m,l,void 0)}}return"paths"in h?h.paths=g:h.rings=g,h}function a(t,n,e,o,r,i){const s=Math.sqrt((e-t)*(e-t)+(o-n)*(o-n));return Math.sqrt((r-t)*(r-t)+(i-n)*(i-n))/s}function m(n,e,o,r=!1){const i=Math.atan2(e.y-o.y,e.x-o.x)-Math.atan2(n.y-o.y,n.x-o.x),s=Math.atan2(Math.sin(i),Math.cos(i));return r?s:t(s)}function l(t,n,e,o){return x(t,t[0]+n,t[1]+e,null!=t[2]&&null!=o?t[2]+o:void 0)}function x(t,n,e,o){const r=[n,e];return t.length>2&&r.push(null!=o?o:t[2]),t.length>3&&r.push(t[3]),r}export{i as cloneMove,m as getRotationAngle,a as getScaleRatio,r as move,s as scale};
5
+ import{rad2deg as t}from"../../../core/mathUtils.js";import{create as n,center as r}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as o}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as e}from"../../../geometry/support/coordsUtils.js";import{toEllipticArc7 as i}from"../../../geometry/support/curves/circularArcUtils.js";import{isCurvedGeometry as s,isCoordinate as c,isBezierCurve as u,getEndpoint as m,isCircularArc as a}from"../../../geometry/support/curves/curveUtils.js";import{transformEllipticArc as l}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{getScaleTransform as p}from"../../interactive/editGeometry/operations/curveOperationUtils.js";function f(t,n,r,o){if(null==o||t.hasZ||(o=void 0),"point"===t.type)return t.x+=n,t.y+=r,t.hasZ&&null!=o&&(t.z+=o),t;if("multipoint"===t.type){const e=t.points;for(let t=0;t<e.length;t++)e[t]=h(e[t],n,r,o);return t}if("extent"===t.type)return t.xmin+=n,t.xmax+=n,t.ymin+=r,t.ymax+=r,null!=o&&(t.zmin??=0,t.zmin+=o,t.zmax??=0,t.zmax+=o),t;const e="polyline"===t.type?t.curvePaths??t.paths:t.curveRings??t.rings,i=s(t);for(let s=0;s<e.length;s++){const t=e[s];for(let e=0;e<t.length;e++)t[e]=g(t[e],n,r,o)}return"paths"in t?i?t.curvePaths=e:t.paths=e:i?t.curveRings=e:t.rings=e,t}function y(t,n,r,o,e){const i=t.clone();if(e){const{resolution:t}=o;f(i,n*t,-r*t)}else{const{dxMap:t,dyMap:e}=x(n,r,o);f(i,t,e)}return i}function x(t,n,r){const o=r.state.inverseTransform;return{dxMap:o[0]*t+o[2]*n,dyMap:o[1]*t+o[3]*n}}function h(t,n,r,o){return b(t,t[0]+n,t[1]+r,null!=t[2]&&null!=o?t[2]+o:void 0)}function g(t,n,r,o){const e=h(m(t),n,r,o);if(c(t))return e;if(u(t)){const[,o,i]=t.b;return{b:[e,[o[0]+n,o[1]+r],[i[0]+n,i[1]+r]]}}if(a(t)){const[,o]=t.c;return{c:[e,[o[0]+n,o[1]+r]]}}const[,i,...s]=t.a;return{a:[e,[i[0]+n,i[1]+r],...s]}}function v(t,i,s,c){if("point"===t.type){const{x:n,y:r}=t,o=c?c[0]:n,e=c?c[1]:r,u=t.clone(),m=(n-o)*i+o,a=(r-e)*s+e;return u.x=m,u.y=a,u}if("extent"===t.type){const{xmin:n,xmax:r,ymin:o,ymax:e}=t,u=c?c[0]:(n+r)/2,m=c?c[1]:(e+o)/2,a=t.clone();if(a.xmin=(n-u)*i+u,a.ymax=(e-m)*s+m,a.xmax=(r-u)*i+u,a.ymin=(o-m)*s+m,a.xmin>a.xmax){const t=a.xmin,n=a.xmax;a.xmin=n,a.xmax=t}if(a.ymin>a.ymax){const t=a.ymin,n=a.ymax;a.ymin=n,a.ymax=t}return a}let u=null;if(!c){u=e(t);const r=n(),i=o(r,u);if(!i)return t.clone();const[s,m,a,l]=i;c=[(s+a)/2,(m+l)/2]}const[m,a]=c;if("multipoint"===t.type){const n=t.clone(),r=n.points;for(let t=0;t<r.length;t++){const n=r[t],[o,e]=n,c=(o-m)*i+m,u=(e-a)*s+a;r[t]=b(n,c,u,void 0)}return n.points=r,n}const l=t.clone();u??=e(t);const p="polygon"===l.type?l.curveRings??l.rings:l.curvePaths??l.paths;if(!c){const t=n(),e=o(t,p,!1,!1);if(!e)return l;c=r(e)}for(const n of p){let t=null;for(let r=0;r<n.length;r++){const o=n[r];n[r]=d(o,i,s,m,a,t),t=o}}return l}function M(t,n,r,o,e){const[i,s,...c]=t;return[(i-o)*n+o,(s-e)*r+e,...c]}function d(t,n,r,o,e,s){if(c(t))return M(t,n,r,o,e);if(u(t)){const[i,s,c]=t.b.map(t=>M(t,n,r,o,e));return{b:[i,s,c]}}if(!s)return t;const f=m(s),y=a(t)?i(f,t):t,[x,h,g,v,d,j,U]=y.a,b=d??0,z=j??Math.hypot(x[0]-h[0],x[1]-h[1]),R=U??1,P=p(o,e,1,0,0,1,n,r);return l(f,{a:[[...x],[...h],g,v,b,z,R]},P)}function j(t,n,r,o,e,i){const s=Math.sqrt((r-t)*(r-t)+(o-n)*(o-n));return Math.sqrt((e-t)*(e-t)+(i-n)*(i-n))/s}function U(n,r,o,e=!1){const i=Math.atan2(r.y-o.y,r.x-o.x)-Math.atan2(n.y-o.y,n.x-o.x),s=Math.atan2(Math.sin(i),Math.cos(i));return e?s:t(s)}function b(t,n,r,o){const e=[n,r];return t.length>2&&e.push(null!=o?o:t[2]),t.length>3&&e.push(t[3]),e}export{y as cloneMove,U as getRotationAngle,j as getScaleRatio,f as move,v as scale,x as screenDeltaToMapDelta};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{handlesGroup as t}from"../../../core/handleUtils.js";import{zeroMeters as e}from"../../../core/quantityUtils.js";import{watch as o,syncAndInitial as n,sync as i}from"../../../core/reactiveUtils.js";import{createScreenPoint as r}from"../../../core/screenUtils.js";import a from"../../../geometry/Point.js";import{connectPasteEvent as c,getXYZDeltasFromTooltipInfo as s}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as l}from"../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{SelectedVertexTooltipInfo as p}from"../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as m}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateVertexTooltipInfo as u}from"../../interactive/tooltip/infos/TranslateVertexTooltipInfo.js";import{elevationFromPoint as f}from"../../support/euclideanLengthMeasurementUtils.js";function y(t){const e={sketchOptions:t,viewType:"2d"};return{movePoint:new l(e),selectedVertex:new p(e),translateGraphic:new m(e),translateVertices:new u(e)}}function v(e,r){function a(){const t=r(),e=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let s=!1;function l(t){s||(s=!0,t(),s=!1)}return t([o(()=>{const t=a();return{context:t,geometry:t.graphic?.geometry,vertexGeometry:t.selectedVertex?.geometry}},({context:t})=>{l(()=>{g(t),e.info=t.activeTooltipInfo})},n),o(()=>{const t=a(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,key:e.key}},(t,e)=>{t&&e&&t.key!==e.key&&l(()=>T(t.context))},i),c(e,{onBeforePaste:()=>{s=!0},onAfterPaste:()=>{T(a()),s=!1}})])}function g(t){const e=t.activeTooltipInfo;if(e){switch(e?.type){case"move-point":return h(e,t);case"selected-vertex":return d(e,t)}e.sketchOptions=t.sketchOptions}}function h(t,{graphic:e}){x(t,e,e?.geometry)}function d(t,{graphic:e,selectedVertex:o,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:i}){x(t,e,o?.geometry);const r=e?.geometry;switch(r?.type){case"polygon":t.geometryType="polygon",t.totalLength.visible=!1,t.area.actual=n.autoArea2D(r);break;case"polyline":t.geometryType="polyline",t.totalLength.actual=i.autoLength2D(r),t.area.visible=!1}}function x(t,e,o){e&&"point"===o?.type&&(t.setLocationFromPoint(o),t.elevation.actual=f(o),t.elevation.visible=!!e.geometry?.hasZ,t.elevation.readOnly=!1,t.elevation.showAsZ=!0)}function T(t){function e(e,o){const n=o?.geometry;if(!n||"point"!==n.type)return;const{dx:i,dy:r,dz:c}=s(e,n);if(0===i&&0===r&&0===c)return;const{x:l,y:p,z:m,m:u,spatialReference:f}=n,y=new a({x:l+i,y:p+r,z:null!=m?m+c:void 0,m:u,spatialReference:f});t.updateGeometry(o,y,n,i,r)}const{activeTooltipInfo:o,graphic:n,selectedVertex:i}=t;switch(o?.type){case"move-point":return e(o,n);case"selected-vertex":return e(o,i)}}function j(t,e,o,n){t.clear(),U(t,e,n,o)}function w(t,e,o,n,i){t.clear();const{automaticAreaMeasurementUtils:r,automaticLengthMeasurementUtils:a}=n;"polygon"===o?.type?t.area=r.autoArea2D(o):"polyline"===o?.type&&(t.totalLength=a.autoLength2D(o)),U(t,e,i,n)}function U(t,o,n,{automaticLengthMeasurementUtils:i}){if(!n)return;const{x:a,y:c}=n.origin,s=o.toMap(n),l=o.toMap(r(a,c)),p=i.autoDistanceBetweenPoints2D(l,s);t.distance=null!=p?p:e}export{v as connectTooltip,y as createTooltipInfos,j as updateTranslateTooltipInfo,w as updateTranslateVertexTooltipInfo};
5
+ import{handlesGroup as t}from"../../../core/handleUtils.js";import{zeroMeters as e}from"../../../core/quantityUtils.js";import{watch as o,syncAndInitial as n,sync as i}from"../../../core/reactiveUtils.js";import{createScreenPoint as r}from"../../../core/screenUtils.js";import a from"../../../geometry/Point.js";import{connectPasteEvent as s,getXYZDeltasFromTooltipInfo as c}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as l}from"../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{SelectedVertexTooltipInfo as p}from"../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as m}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateVertexTooltipInfo as u}from"../../interactive/tooltip/infos/TranslateVertexTooltipInfo.js";import{elevationFromPoint as f}from"../../support/euclideanLengthMeasurementUtils.js";function y(t){const e={sketchOptions:t,viewType:"2d"};return{movePoint:new l(e),selectedVertex:new p(e),translateGraphic:new m(e),translateVertices:new u(e)}}function v(e,r){function a(){const t=r(),e=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let c=!1;function l(t){c||(c=!0,t(),c=!1)}return t([o(()=>{const t=a();return{context:t,geometry:t.graphic?.geometry,vertexGeometry:t.selectedVertex?.geometry}},({context:t})=>{l(()=>{g(t),e.info=t.activeTooltipInfo})},n),o(()=>{const t=a(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,key:e.key}},(t,e)=>{t&&e&&t.key!==e.key&&l(()=>T(t.context))},i),s(e,{onBeforePaste:()=>{c=!0},onAfterPaste:()=>{T(a()),c=!1}})])}function g(t){const e=t.activeTooltipInfo;if(e){switch(e?.type){case"move-point":return h(e,t);case"selected-vertex":return d(e,t)}e.sketchOptions=t.sketchOptions}}function h(t,{graphic:e}){x(t,e,e?.geometry)}function d(t,{graphic:e,selectedVertex:o,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:i}){x(t,e,o?.geometry);const r=e?.geometry;switch(r?.type){case"polygon":t.geometryType="polygon",t.totalLength.visible=!1,t.area.actual=n.autoArea2D(r);break;case"polyline":t.geometryType="polyline",t.totalLength.actual=i.autoLength2D(r),t.area.visible=!1;break;case"multipoint":t.geometryType="multipoint",t.area.visible=!1,t.totalLength.visible=!1}}function x(t,e,o){e&&"point"===o?.type&&(t.setLocationFromPoint(o),t.elevation.actual=f(o),t.elevation.visible=!!e.geometry?.hasZ,t.elevation.readOnly=!1,t.elevation.showAsZ=!0)}function T(t){function e(e,o){const n=o?.geometry;if(!n||"point"!==n.type)return;const{dx:i,dy:r,dz:s}=c(e,n);if(0===i&&0===r&&0===s)return;const{x:l,y:p,z:m,m:u,spatialReference:f}=n,y=new a({x:l+i,y:p+r,z:null!=m?m+s:void 0,m:u,spatialReference:f});t.updateGeometry(o,y,n,i,r)}const{activeTooltipInfo:o,graphic:n,selectedVertex:i}=t;switch(o?.type){case"move-point":return e(o,n);case"selected-vertex":return e(o,i)}}function j(t,e,o,n){t.clear(),w(t,e,n,o)}function k(t,e,o,n,i){t.clear();const{automaticAreaMeasurementUtils:r,automaticLengthMeasurementUtils:a}=n;"polygon"===o?.type?t.area=r.autoArea2D(o):"polyline"===o?.type&&(t.totalLength=a.autoLength2D(o)),w(t,e,i,n)}function w(t,o,n,{automaticLengthMeasurementUtils:i}){if(!n)return;const{x:a,y:s}=n.origin,c=o.toMap(n),l=o.toMap(r(a,s)),p=i.autoDistanceBetweenPoints2D(l,c);t.distance=null!=p?p:e}export{v as connectTooltip,y as createTooltipInfos,j as updateTranslateTooltipInfo,k as updateTranslateVertexTooltipInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{equals as t}from"../../../core/arrayUtils.js";import{neverReached as e}from"../../../core/compilerUtils.js";import{Evented as r}from"../../../core/Evented.js";import i from"../../../geometry/Polygon.js";import s from"../../../geometry/Polyline.js";import{getEndpoint as n,isCoordinate as o,isBezierCurve as h,isCircularArc as c,isEllipticArc4 as l}from"../../../geometry/support/curves/curveUtils.js";import{createCoordinateHelper as a}from"../coordinateHelper.js";import{unnormalize as p,getUnnormalizationInfo as g}from"./unnormalizationHelper.js";class u{constructor(t){this.part=t,this.leftSegment=null,this.rightSegment=null,this.type="vertex",this.index=null}get pos(){return this._pos}set pos(t){this._pos=t,this.part.unnormalizeVertexPositions()}}class f{constructor(t,e,r){this.part=t,this.leftVertex=e,this.rightVertex=r,this.type="line",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class m{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="bezier",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class d{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="circular-arc",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){const t=this.rightVertex.pos,{interiorPoint:e}=this.curveDefinition;return{c:[[...t],[...e]]}}}class v{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="elliptic-arc-4",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){const t=this.rightVertex.pos,{centerPoint:e,sweep:r,orientation:i}=this.curveDefinition;return{a:[[...t],[...e],r,i]}}}class y{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="elliptic-arc-7",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){const t=this.rightVertex.pos,{centerPoint:e,sweep:r,orientation:i,rotation:s,semiMajorAxisLength:n,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...t],e,r,i,s,n,o]}}}class x{constructor(t,e){this._spatialReference=t,this._viewingMode=e,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||p(this.vertices,g(this._spatialReference,this._viewingMode))}updateVertexIndex(t,e){const{vertices:r}=this;if(0===r.length)return;const i=r[0];let s=null,n=t,o=e;do{s=n,s.index=o++,n=s.rightSegment?s.rightSegment.rightVertex:null}while(null!=n&&n!==i);s.leftSegment&&s!==r[r.length-1]&&this.swapVertices(r.indexOf(s),r.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return null!==this.getFirstVertex()?.leftSegment}swapVertices(t,e){const{vertices:r}=this,i=r[t];r[t]=r[e],r[e]=i}*iterateVertices(){const t=this.getFirstVertex();let e=t;if(e)do{yield e,e=e.rightSegment?.rightVertex}while(e!==t&&null!=e)}}class V extends r{constructor(t,e){super(),this.type=t,this.coordinateHelper=e,this._geometry=null,this._dirty=!0,this.parts=[]}get geometry(){if(this._dirty){switch(this.type){case"point":this._geometry=this._toPoint();break;case"polyline":this._geometry=this._toPolyline();break;case"polygon":this._geometry=this._toPolygon();break;case"mesh":break;default:e(this.type)}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(const t of this.parts)for(const e of t.vertices)yield e}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(const t of this.parts)yield*t.iterateVertices()}notifyChanges(t){this._dirty=!0,this.emit("change",t)}_toPoint(){const{parts:t,coordinateHelper:e}=this;return t.at(0)?.vertices.length?e.vectorToPoint(t[0].vertices[0].pos):null}_toPolyline(){const t=[];let e=!1;for(const r of this.parts){if(r.vertices.length<1)continue;const i=r.vertices[0],s=[];s.push(i.pos);let n=i.rightSegment;for(;n;)e||="line"!==n.type,s.push(n.toCurveOrCoordinate()),n=n.rightVertex.rightSegment;t.push(s)}return new s({paths:e?void 0:t,curvePaths:e?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){const t=[];let e=!1;for(const r of this.parts){if(r.vertices.length<1)continue;const i=r.vertices[0],s=[];s.push(i.pos);let n=i.rightSegment;for(;n&&(e||="line"!==n.type,s.push(n.toCurveOrCoordinate()),n=n.rightVertex.rightSegment,n?.leftVertex!==i););t.push(s)}return new i({rings:e?void 0:t,curveRings:e?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(t,e,r){const i=t.spatialReference,s=a(t.hasZ,t.hasM,i),n=new V(t.type,s);switch(t.type){case"polygon":_(n,t,e,r?.allowCurves??!1);break;case"polyline":S(n,t,e,r?.allowCurves??!1);break;case"point":C(n,t,e);break;case"mesh":C(n,t.origin,e),n._geometry=t,n._dirty=!1}return n}}function w(t,e,r,i){const s=new u(t);t.vertices.push(s);const o=n(i);return s.pos=e.arrayToVector(o),s.index=t.vertices.length-1,r&&t.segments.push(P(t,r,s,i)),s}function P(t,e,r,i){if(o(i))return new f(t,e,r);if(h(i)){const[,s,n]=i.b;return new m(t,e,r,{controlPoint1:[...s],controlPoint2:[...n]})}if(c(i)){const[,s]=i.c;return new d(t,e,r,{interiorPoint:[...s]})}if(l(i)){const[,s,n,o]=i.a;return new v(t,e,r,{centerPoint:[...s],sweep:n,orientation:o})}const[,s,n,a,p,g,u]=i.a;return new y(t,e,r,{centerPoint:[...s],sweep:n,orientation:a,rotation:p,semiMajorAxisLength:g,minorMajorAxisRatio:u})}function _(e,r,i,s){const o=r.spatialReference,h=e.coordinateHelper,{rings:c,curveRings:l}=r,a=l&&s?l:c;for(let p=0;p<a.length;++p){const r=a[p],s=new x(o,i);if(s.index=p,e.parts.push(s),r.length<1)continue;let c=null,l=null;for(let t=0;t<r.length-1;++t)l=w(s,h,l,r[t]),c??=l;r.length>1&&t(n(r[r.length-1]),c?.pos)?l&&c&&s.segments.push(P(s,l,c,r[r.length-1])):l=w(s,h,l,r[r.length-1])}}function S(t,e,r,i){const s=e.spatialReference,n=t.coordinateHelper,{curvePaths:o,paths:h}=e,c=o&&i?o:h;for(let l=0;l<c.length;++l){const e=c[l],i=new x(s,r);if(i.index=l,t.parts.push(i),e.length<1)continue;let o=null;for(let t=0;t<e.length;++t)o=w(i,n,o,e[t])}}function C(t,e,r){const i=e.spatialReference,s=t.coordinateHelper,n=new x(i,r);n.index=0;const o=new u(n);o.index=0,o.pos=s.pointToVector(e),n.vertices.push(o),t.parts.push(n)}function R(t){return"mesh"===t.type}export{m as BezierSegment,d as CircularArcSegment,V as EditGeometry,v as EllipticArc4Segment,y as EllipticArc7Segment,f as LineSegment,x as Part,u as Vertex,P as createConnectingSegment,R as isMeshEditGeometry};
5
+ import{equals as t}from"../../../core/arrayUtils.js";import{neverReached as e}from"../../../core/compilerUtils.js";import{Evented as r}from"../../../core/Evented.js";import i from"../../../geometry/Multipoint.js";import s from"../../../geometry/Polygon.js";import n from"../../../geometry/Polyline.js";import{getEndpoint as o,isCoordinate as h,isBezierCurve as c,isCircularArc as a,isEllipticArc4 as l}from"../../../geometry/support/curves/curveUtils.js";import{createCoordinateHelper as p}from"../coordinateHelper.js";import{unnormalize as u,getUnnormalizationInfo as g}from"./unnormalizationHelper.js";class f{constructor(t){this.part=t,this.leftSegment=null,this.rightSegment=null,this.type="vertex",this.index=null}get pos(){return this._pos}set pos(t){this._pos=t,this.part.unnormalizeVertexPositions()}}class m{constructor(t,e,r){this.part=t,this.leftVertex=e,this.rightVertex=r,this.type="line",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class d{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="bezier",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class y{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="circular-arc",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){const t=this.rightVertex.pos,{interiorPoint:e}=this.curveDefinition;return{c:[[...t],[...e]]}}}class v{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="elliptic-arc-4",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){const t=this.rightVertex.pos,{centerPoint:e,sweep:r,orientation:i}=this.curveDefinition;return{a:[[...t],[...e],r,i]}}}class x{constructor(t,e,r,i){this.part=t,this.leftVertex=e,this.rightVertex=r,this.curveDefinition=i,this.type="elliptic-arc-7",e.rightSegment=this,r.leftSegment=this}toCurveOrCoordinate(){const t=this.rightVertex.pos,{centerPoint:e,sweep:r,orientation:i,rotation:s,semiMajorAxisLength:n,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...t],e,r,i,s,n,o]}}}class V{constructor(t,e){this._spatialReference=t,this._viewingMode=e,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||u(this.vertices,g(this._spatialReference,this._viewingMode))}updateVertexIndex(t,e){const{vertices:r}=this;if(0===r.length)return;const i=r[0];let s=null,n=t,o=e;do{s=n,s.index=o++,n=s.rightSegment?s.rightSegment.rightVertex:null}while(null!=n&&n!==i);s.leftSegment&&s!==r[r.length-1]&&this.swapVertices(r.indexOf(s),r.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return null!==this.getFirstVertex()?.leftSegment}swapVertices(t,e){const{vertices:r}=this,i=r[t];r[t]=r[e],r[e]=i}*iterateVertices(){const t=this.getFirstVertex();let e=t;if(e)do{yield e,e=e.rightSegment?.rightVertex}while(e!==t&&null!=e)}}class w extends r{constructor(t,e){super(),this.type=t,this.coordinateHelper=e,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:e(this.type)}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(const t of this.parts)for(const e of t.vertices)yield e}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(const t of this.parts)yield*t.iterateVertices()}notifyChanges(t){this._dirty=!0,this.emit("change",t)}_toPoint(){const{parts:t,coordinateHelper:e}=this;return t.at(0)?.vertices.length?e.vectorToPoint(t[0].vertices[0].pos):null}_toMultipoint(){const t=[],{coordinateHelper:e,parts:r,spatialReference:s}=this;for(const i of r){const r=i.getFirstVertex();r&&t.push(e.arrayToVector(r.pos))}return new i({hasM:e.hasM(),hasZ:e.hasZ(),spatialReference:s,points:t})}_toPolyline(){const t=[];let e=!1;for(const r of this.parts){if(r.vertices.length<1)continue;const i=r.vertices[0],s=[];s.push(i.pos);let n=i.rightSegment;for(;n;)e||="line"!==n.type,s.push(n.toCurveOrCoordinate()),n=n.rightVertex.rightSegment;t.push(s)}return new n({paths:e?void 0:t,curvePaths:e?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){const t=[];let e=!1;for(const r of this.parts){if(r.vertices.length<1)continue;const i=r.vertices[0],s=[];s.push(i.pos);let n=i.rightSegment;for(;n&&(e||="line"!==n.type,s.push(n.toCurveOrCoordinate()),n=n.rightVertex.rightSegment,n?.leftVertex!==i););t.push(s)}return new s({rings:e?void 0:t,curveRings:e?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(t,e,r){const i=t.spatialReference,s=p(t.hasZ,t.hasM,i),n=new w(t.type,s);switch(t.type){case"polygon":S(n,t,e,r?.allowCurves??!1);break;case"polyline":R(n,t,e,r?.allowCurves??!1);break;case"point":C(n,t,e);break;case"multipoint":M(n,t,e);break;case"mesh":C(n,t.origin,e),n._geometry=t,n._dirty=!1}return n}}function _(t,e,r,i){const s=new f(t);t.vertices.push(s);const n=o(i);return s.pos=e.arrayToVector(n),s.index=t.vertices.length-1,r&&t.segments.push(P(t,r,s,i)),s}function P(t,e,r,i){if(h(i))return new m(t,e,r);if(c(i)){const[,s,n]=i.b;return new d(t,e,r,{controlPoint1:[...s],controlPoint2:[...n]})}if(a(i)){const[,s]=i.c;return new y(t,e,r,{interiorPoint:[...s]})}if(l(i)){const[,s,n,o]=i.a;return new v(t,e,r,{centerPoint:[...s],sweep:n,orientation:o})}const[,s,n,o,p,u,g]=i.a;return new x(t,e,r,{centerPoint:[...s],sweep:n,orientation:o,rotation:p,semiMajorAxisLength:u,minorMajorAxisRatio:g})}function S(e,r,i,s){const n=r.spatialReference,h=e.coordinateHelper,{rings:c,curveRings:a}=r,l=a&&s?a:c;for(let p=0;p<l.length;++p){const r=l[p],s=new V(n,i);if(s.index=p,e.parts.push(s),r.length<1)continue;let c=null,a=null;for(let t=0;t<r.length-1;++t)a=_(s,h,a,r[t]),c??=a;r.length>1&&t(o(r[r.length-1]),c?.pos)?a&&c&&s.segments.push(P(s,a,c,r[r.length-1])):a=_(s,h,a,r[r.length-1])}}function R(t,e,r,i){const s=e.spatialReference,n=t.coordinateHelper,{curvePaths:o,paths:h}=e,c=o&&i?o:h;for(let a=0;a<c.length;++a){const e=c[a],i=new V(s,r);if(i.index=a,t.parts.push(i),e.length<1)continue;let o=null;for(let t=0;t<e.length;++t)o=_(i,n,o,e[t])}}function C(t,e,r){const i=e.spatialReference,s=t.coordinateHelper,n=new V(i,r);n.index=0;const o=new f(n);o.index=0,o.pos=s.pointToVector(e),n.vertices.push(o),t.parts.push(n)}function M(t,e,r){const i=e.spatialReference,{coordinateHelper:s,parts:n}=t,o=e.points.map(t=>s.arrayToVector(t));for(let h=0;h<o.length;h++){const t=new V(i,r);t.index=h,n.push(t);const e=new f(t);e.pos=o[h],e.index=0,t.vertices.push(e)}}function H(t){return"mesh"===t.type}export{d as BezierSegment,y as CircularArcSegment,w as EditGeometry,v as EllipticArc4Segment,x as EllipticArc7Segment,m as LineSegment,V as Part,f as Vertex,P as createConnectingSegment,H as isMeshEditGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{Evented as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{clone as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{hasCompatibleTopology as s}from"../../../geometry/support/coordsUtils.js";import{isMeshEditGeometry as i,EditGeometry as o}from"./EditGeometry.js";import{AppendVertex as a}from"./operations/AppendVertex.js";import{UpdateVertices as n}from"./operations/UpdateVertices.js";import{RemoveVertices as p}from"./operations/RemoveVertices.js";import{SplitSegment as d}from"./operations/SplitSegment.js";import{SetVertexPosition as h}from"./operations/SetVertexPosition.js";import{ClosePart as c}from"./operations/ClosePart.js";import{MoveMesh as u}from"./operations/MoveMesh.js";import{MoveVertex as l}from"./operations/MoveVertex.js";import{OffsetEdgeVertex as m}from"./operations/OffsetEdgeVertex.js";import{RotateVertex as V}from"./operations/RotateVertex.js";import{ScaleVertex as y}from"./operations/ScaleVertex.js";import{SetAllVertexPositions as f}from"./operations/SetAllVertexPositions.js";import{UndoGroup as v}from"./operations/UndoGroup.js";class _ extends e{constructor(e,t,r=!1){super(),this.data=e,this.viewingMode=t,this.allowCurves=r,this._undoStack=[],this._redoStack=[],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 d(this.data,e,t))}updateVertices(e,t,r=1){return this._apply(new n(this.data,e,t),r)}move(e,t,r,s=1){return i(this.data)?this._apply(new u(this.data,e,t,r),s):this.moveVertices(this.data.allVerticesUnordered,e,t,r,s)}moveVertices(e,t,r,s,o=1){return i(this.data)?this._apply(new u(this.data,t,r,s),o):this.updateVertices(e,new l(this.data.coordinateHelper,t,r,s),o)}scale(e,t,r,s,i=1,o=0){return this.scaleVertices(this.data.allVerticesUnordered,e,t,r,s,i,o)}scaleVertices(e,t,r,s,i,o=1,a=0){return this.updateVertices(e,new y(t,r,s,i,a),o)}rotate(e,t,r=1,s=0){return this.rotateVertices(this.data.allVerticesUnordered,e,t,r,s)}rotateVertices(e,t,r,s=1,i=0){return this.updateVertices(e,new V(t,r,i),s)}removeVertices(e){return this._apply(new p(this.data,e,this._minNumVerticesPerType))}appendVertex(e){return 0===this.data.parts.length?null:this._apply(new a(this.data,this.data.parts[0],e))}setVertexPosition(e,t){return this._apply(new h(this.data,e,t))}offsetEdge(e,t,r,s=1){return this.updateVertices([t.leftVertex,t.rightVertex],new m(this.data.coordinateHelper,e,t,r),s)}trySetGeometry(e,t=1){const{data:r}=this,{coordinateHelper:a}=r;if(r.type!==e.type||!r.spatialReference.equals(e.spatialReference)||a.hasZ()!==e.hasZ||a.hasM()!==e.hasM||!s(r.geometry,e)||i(r))return;const n=Array.from(o.fromGeometry(e,this.viewingMode,{allowCurves:this.allowCurves}).iterateVerticesUnordered(),e=>e.pos);return this.setVertexPositions(n,t)}setVertexPositions(e,t=1){return this._apply(new f(this.data,e),t)}createResetState(){if(i(this.data))return this._createResetStateMesh();const e=this.data.geometry.clone();return t(()=>this.trySetGeometry(e))}closePart(e){return this.data.parts.includes(e)?this._apply(new c(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){const e=new v;return this._apply(e),t(()=>e.close())}undo(){if(this._undoStack.length>0){const e=this._undoStack.pop();return e.undo(),this._redoStack.push(e),e}return null}redo(){if(this._redoStack.length>0){const e=this._redoStack.pop();return e.apply(),this._undoStack.push(e),e}return null}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 _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 0!==t&&null!=this.lastOperation&&this.lastOperation.accumulate(e)||(e.apply(),this._undoStack.push(e),this._redoStack=[]),e}_createResetStateMesh(){if(!i(this.data))return t();const e=this.data.geometry,{vertexSpace:s}=e;if(s.origin){const i=r(s.origin);return t(()=>{e.vertexSpace.origin=i})}const o=e.vertexAttributes.clonePositional();return t(()=>{e.vertexAttributes=o,e.vertexAttributesChanged()})}static fromGeometry(e,t,r){return new _(o.fromGeometry(e,t,r),t,!!r?.allowCurves)}}export{_ as EditGeometryOperations};
5
+ import{Evented as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{clone as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{hasCompatibleTopology as s}from"../../../geometry/support/coordsUtils.js";import{isMeshEditGeometry as i,Part as o,EditGeometry as a}from"./EditGeometry.js";import{AppendVertex as n}from"./operations/AppendVertex.js";import{UpdateVertices as p}from"./operations/UpdateVertices.js";import{RemoveVertices as d}from"./operations/RemoveVertices.js";import{SplitSegment as h}from"./operations/SplitSegment.js";import{SetVertexPosition as c}from"./operations/SetVertexPosition.js";import{ClosePart as u}from"./operations/ClosePart.js";import{MoveMesh as l}from"./operations/MoveMesh.js";import{MoveVertex as m}from"./operations/MoveVertex.js";import{OffsetEdgeVertex as V}from"./operations/OffsetEdgeVertex.js";import{RotateVertex as y}from"./operations/RotateVertex.js";import{ScaleVertex as f}from"./operations/ScaleVertex.js";import{SetAllVertexPositions as v}from"./operations/SetAllVertexPositions.js";import{UndoGroup as _}from"./operations/UndoGroup.js";class g extends e{constructor(e,t,r=!1){super(),this.data=e,this.viewingMode=t,this.allowCurves=r,this._undoStack=[],this._redoStack=[],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 h(this.data,e,t))}updateVertices(e,t,r=1){return this._apply(new p(this.data,e,t),r)}move(e,t,r,s=1){return i(this.data)?this._apply(new l(this.data,e,t,r),s):this.moveVertices(this.data.allVerticesUnordered,e,t,r,s)}moveVertices(e,t,r,s,o=1){return i(this.data)?this._apply(new l(this.data,t,r,s),o):this.updateVertices(e,new m(this.data.coordinateHelper,t,r,s),o)}scale(e,t,r,s,i=1,o=0){return this.scaleVertices(this.data.allVerticesUnordered,e,t,r,s,i,o)}scaleVertices(e,t,r,s,i,o=1,a=0){return this.updateVertices(e,new f(t,r,s,i,a),o)}rotate(e,t,r=1,s=0){return this.rotateVertices(this.data.allVerticesUnordered,e,t,r,s)}rotateVertices(e,t,r,s=1,i=0){return this.updateVertices(e,new y(t,r,i),s)}removeVertices(e){return this._apply(new d(this.data,e,this._minNumVerticesPerType))}appendVertex(e,t){return t??=new o(this.data.spatialReference,this.viewingMode),this._apply(new n(this.data,t,e))}appendVertexToFirstPart(e){const t=this.data.parts.at(0);return t?this._apply(new n(this.data,t,e)):null}setVertexPosition(e,t){return this._apply(new c(this.data,e,t))}offsetEdge(e,t,r,s=1){return this.updateVertices([t.leftVertex,t.rightVertex],new V(this.data.coordinateHelper,e,t,r),s)}trySetGeometry(e,t=1){const{data:r}=this,{coordinateHelper:o}=r;if(r.type!==e.type||!r.spatialReference.equals(e.spatialReference)||o.hasZ()!==e.hasZ||o.hasM()!==e.hasM||!s(r.geometry,e)||i(r))return;const n=Array.from(a.fromGeometry(e,this.viewingMode,{allowCurves:this.allowCurves}).iterateVerticesUnordered(),e=>e.pos);return this.setVertexPositions(n,t)}setVertexPositions(e,t=1){return this._apply(new v(this.data,e),t)}createResetState(){if(i(this.data))return this._createResetStateMesh();const e=this.data.geometry.clone();return t(()=>this.trySetGeometry(e))}closePart(e){return this.data.parts.includes(e)?this._apply(new u(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){const e=new _;return this._apply(e),t(()=>e.close())}undo(){if(this._undoStack.length>0){const e=this._undoStack.pop();return e.undo(),this._redoStack.push(e),e}return null}redo(){if(this._redoStack.length>0){const e=this._redoStack.pop();return e.apply(),this._undoStack.push(e),e}return null}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 _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 0!==t&&null!=this.lastOperation&&this.lastOperation.accumulate(e)||(e.apply(),this._undoStack.push(e),this._redoStack=[]),e}_createResetStateMesh(){if(!i(this.data))return t();const e=this.data.geometry,{vertexSpace:s}=e;if(s.origin){const i=r(s.origin);return t(()=>{e.vertexSpace.origin=i})}const o=e.vertexAttributes.clonePositional();return t(()=>{e.vertexAttributes=o,e.vertexAttributesChanged()})}static fromGeometry(e,t,r){return new g(a.fromGeometry(e,t,r),t,!!r?.allowCurves)}}export{g as EditGeometryOperations};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{getEndpoint as e}from"../../../../geometry/support/curves/curveUtils.js";import{Vertex as t,createConnectingSegment as i,LineSegment as s}from"../EditGeometry.js";class r{constructor(e,t,i){this._editGeometry=e,this._part=t,this._posOrCurveDef=i,this._addedVertex=null,this._originalSegment=null,this._left=null,this._right=null}apply(){let r="redo";const{_part:n,_editGeometry:d,_posOrCurveDef:l}=this;null==this._addedVertex&&(r="apply",this._addedVertex=new t(n));const h=n.getLastVertex(),g=d.coordinateHelper.arrayToVector(e(l));if(null==h)n.vertices.push(this._addedVertex),this._addedVertex.pos=g,this._addedVertex.index=0;else{let e=null;h.rightSegment&&(this._originalSegment=h.rightSegment,e=this._originalSegment.rightVertex,n.segments.splice(n.segments.indexOf(this._originalSegment),1)),n.vertices.push(this._addedVertex),this._addedVertex.pos=g,this._left??=i(n,h,this._addedVertex,l),n.segments.push(this._left),h.rightSegment=this._left,null!=this._originalSegment&&null!=e&&(this._right??=new s(this._part,this._addedVertex,e),n.segments.push(this._right),e.leftSegment=this._right),n.updateVertexIndex(this._addedVertex,h.index+1)}this._editGeometry.notifyChanges({operation:r,addedVertices:[this._addedVertex]})}undo(){const{_addedVertex:e,_part:t,_left:i,_right:s,_originalSegment:r}=this;null!=e&&(t.vertices.splice(t.vertices.indexOf(e),1),null!=i&&(t.segments.splice(t.segments.indexOf(i),1),i.leftVertex.rightSegment=null),null!=s&&(t.segments.splice(t.segments.indexOf(s),1),s.rightVertex.leftSegment=null),null!=r&&(t.segments.push(r),r.leftVertex.rightSegment=r,r.rightVertex.leftSegment=r),null!=i?t.updateVertexIndex(i.leftVertex,i.leftVertex.index):t.updateVertexIndex(e,0),this._editGeometry.notifyChanges({operation:"undo",removedVertices:[e]}))}accumulate(){return!1}}export{r as AppendVertex};
5
+ import{getEndpoint as e}from"../../../../geometry/support/curves/curveUtils.js";import{Vertex as t,createConnectingSegment as i,LineSegment as s}from"../EditGeometry.js";class r{constructor(e,t,i){this._editGeometry=e,this._part=t,this._posOrCurveDef=i,this._addedVertex=null,this._originalSegment=null,this._left=null,this._right=null,this._partAdded=!1}apply(){let r="redo";const{_part:d,_editGeometry:n,_posOrCurveDef:l}=this;if(null==this._addedVertex&&(r="apply",this._addedVertex=new t(d)),!n.parts.includes(d)){this._partAdded=!0;const e=n.parts.at(-1)?.index??-1;d.index=e+1,n.parts.push(d)}const h=d.getLastVertex(),a=n.coordinateHelper.arrayToVector(e(l));if(null==h)d.vertices.push(this._addedVertex),this._addedVertex.pos=a,this._addedVertex.index=0;else{let e=null;h.rightSegment&&(this._originalSegment=h.rightSegment,e=this._originalSegment.rightVertex,d.segments.splice(d.segments.indexOf(this._originalSegment),1)),d.vertices.push(this._addedVertex),this._addedVertex.pos=a,this._left??=i(d,h,this._addedVertex,l),d.segments.push(this._left),h.rightSegment=this._left,null!=this._originalSegment&&null!=e&&(this._right??=new s(this._part,this._addedVertex,e),d.segments.push(this._right),e.leftSegment=this._right),d.updateVertexIndex(this._addedVertex,h.index+1)}this._editGeometry.notifyChanges({operation:r,addedVertices:[this._addedVertex]})}undo(){const{_addedVertex:e,_part:t,_left:i,_right:s,_originalSegment:r}=this;null!=e&&(t.vertices.splice(t.vertices.indexOf(e),1),null!=i&&(t.segments.splice(t.segments.indexOf(i),1),i.leftVertex.rightSegment=null),null!=s&&(t.segments.splice(t.segments.indexOf(s),1),s.rightVertex.leftSegment=null),null!=r&&(t.segments.push(r),r.leftVertex.rightSegment=r,r.rightVertex.leftSegment=r),null!=i?t.updateVertexIndex(i.leftVertex,i.leftVertex.index):t.updateVertexIndex(e,0),this._partAdded&&this._editGeometry.parts.splice(this._editGeometry.parts.indexOf(this._part)),this._editGeometry.notifyChanges({operation:"undo",removedVertices:[e]}))}accumulate(){return!1}}export{r as AppendVertex};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{equals as t}from"../../../../core/arrayUtils.js";import{rotate as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{rotateArc as e}from"./curveOperationUtils.js";class o{constructor(t,i,e=0){this.origin=t,this.angle=i,this._accumulationType=e}_rotate(t,e){i(t.pos,t.pos,this.origin,e),n(t.leftSegment,this.origin,e)}apply(t){this._rotate(t,this.angle)}undo(t){this._rotate(t,-this.angle)}canAccumulate(i){return i instanceof o&&t(this.origin,i.origin)}accumulate(t,i){const e=1===i._accumulationType;this._rotate(t,e?i.angle-this.angle:i.angle)}accumulateParams(t){const i=1===t._accumulationType;this.angle=i?t.angle:this.angle+t.angle}}function n(t,o,n){switch(t?.type){case null:case void 0:case"line":return;case"bezier":{const{controlPoint1:e,controlPoint2:r}=t.curveDefinition;return i(e,e,o,n),void i(r,r,o,n)}case"circular-arc":{const{interiorPoint:e}=t.curveDefinition;return void i(e,e,o,n)}case"elliptic-arc-4":case"elliptic-arc-7":{const r=t.leftVertex.pos,a=i([0,0],[r[0],r[1]],o,-n),c=t.toCurveOrCoordinate(),[,s,l,u,p,g,m]=e(a,c,o,n).a;if("elliptic-arc-4"===t.type){const i=t.curveDefinition;i.centerPoint=[...s],i.sweep=l,i.orientation=u}else{const i=t.curveDefinition;i.centerPoint=[...s],i.sweep=l,i.orientation=u,i.rotation=p,i.semiMajorAxisLength=g,i.minorMajorAxisRatio=m}}}}export{o as RotateVertex};
5
+ import{equals as t}from"../../../../core/arrayUtils.js";import{rotate as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{rotateEllipticArc as i}from"../../../../geometry/support/curves/rotate.js";class o{constructor(t,e,i=0){this.origin=t,this.angle=e,this._accumulationType=i}_rotate(t,i){e(t.pos,t.pos,this.origin,i),n(t.leftSegment,this.origin,i)}apply(t){this._rotate(t,this.angle)}undo(t){this._rotate(t,-this.angle)}canAccumulate(e){return e instanceof o&&t(this.origin,e.origin)}accumulate(t,e){const i=1===e._accumulationType;this._rotate(t,i?e.angle-this.angle:e.angle)}accumulateParams(t){const e=1===t._accumulationType;this.angle=e?t.angle:this.angle+t.angle}}function n(t,o,n){switch(t?.type){case null:case void 0:case"line":return;case"bezier":{const{controlPoint1:i,controlPoint2:r}=t.curveDefinition;return e(i,i,o,n),void e(r,r,o,n)}case"circular-arc":{const{interiorPoint:i}=t.curveDefinition;return void e(i,i,o,n)}case"elliptic-arc-4":case"elliptic-arc-7":{const r=t.leftVertex.pos,a=e([0,0],[r[0],r[1]],o,-n),c=t.toCurveOrCoordinate(),[,s,l,u,p,g,m]=i(a,c,o,n).a;if("elliptic-arc-4"===t.type){const e=t.curveDefinition;e.centerPoint=[...s],e.sweep=l,e.orientation=u}else{const e=t.curveDefinition;e.centerPoint=[...s],e.sweep=l,e.orientation=u,e.rotation=p,e.semiMajorAxisLength=g,e.minorMajorAxisRatio=m}}}}export{o as RotateVertex};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as t,create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{mul as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{deriveCircleFromCircularArc as a}from"../../../../geometry/support/curves/circularArcUtils.js";import{isCircularArc as e}from"../../../../geometry/support/curves/curveUtils.js";import{transformEllipticArc as s}from"../../../../geometry/support/curves/ellipticArc7Utils.js";function c(t,r){const[o]=r.c,e=a(t,r);return{a:[o,[e.cx,e.cy],Math.abs(e.thetaEnd-e.thetaStart)<Math.PI?1:0,e.thetaStart>e.thetaEnd?1:0,0,e.radius,1]}}function i(r,o,a,i){const n=e(o)?c(r,o):o,[m,u,p,h,f,l,y]=n.a,M=f??0,g=l??Math.hypot(m[0]-u[0],m[1]-u[1]),j=y??1,x=Math.cos(i),v=Math.sin(i),[b,d]=a,U=t(x,v,0,-v,x,0,b-x*b+v*d,d-v*b-x*d,1);return s(r,{a:[m,u,p,h,M,g,j]},U)}function n(t,r,o,a,i,n,u,p){const h=r??o.leftVertex.pos,f=e(t)?c(h,t):t,[l,y,M,g,j,x,v]=f.a,b=j??0,d=x??Math.hypot(l[0]-y[0],l[1]-y[1]),U=v??1,A=m(a[0],a[1],i[0],i[1],n[0],n[1],u,p);return s(h,{a:[l,y,M,g,b,d,U]},A)}function m(a,e,s,c,i,n,m,u){const p=t(1,0,0,0,1,0,-a,-e,1),h=m-1,f=t(s*s*h+1,c*s*h,0,s*c*h,c*c*h+1,0,0,0,1),l=u-1,y=t(i*i*l+1,n*i*l,0,i*n*l,n*n*l+1,0,0,0,1),M=t(1,0,0,0,1,0,a,e,1),g=r();return o(g,f,p),o(g,y,g),o(g,M,g),g}export{m as getScaleTransform,i as rotateArc,n as scaleArc,c as toEllipticArc7};
5
+ import{fromValues as r,create as t}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{mul as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{toEllipticArc7 as e}from"../../../../geometry/support/curves/circularArcUtils.js";import{isCircularArc as s}from"../../../../geometry/support/curves/curveUtils.js";import{transformEllipticArc as i}from"../../../../geometry/support/curves/ellipticArc7Utils.js";function m(r,t,o,m,p,u,l,a){const f=t??o.leftVertex.pos,n=s(r)?e(f,r):r,[g,j,v,x,y,h,U]=n.a,b=y??0,A=h??Math.hypot(g[0]-j[0],g[1]-j[1]),M=U??1,V=c(m[0],m[1],p[0],p[1],u[0],u[1],l,a);return i(f,{a:[g,j,v,x,b,A,M]},V)}function c(e,s,i,m,c,p,u,l){const a=r(1,0,0,0,1,0,-e,-s,1),f=u-1,n=r(i*i*f+1,m*i*f,0,i*m*f,m*m*f+1,0,0,0,1),g=l-1,j=r(c*c*g+1,p*c*g,0,c*p*g,p*p*g+1,0,0,0,1),v=r(1,0,0,0,1,0,e,s,1),x=t();return o(x,n,a),o(x,j,x),o(x,v,x),x}export{c as getScaleTransform,m as scaleArc};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{makeAreaField as r,makeTotalLengthField as s}from"../fields/fields.js";import{SketchTooltipInfo as i}from"./SketchTooltipInfo.js";import{TooltipInfoWithCoordinates as l}from"./TooltipInfoWithCoordinates.js";let p=class extends(l(i)){constructor(t){super(t),this.type="selected-vertex",this.area=r(),this.totalLength=s(),this.geometryType="polyline",this.allFields.forEach(t=>{t.lockable=!1,t.setActual(null)})}get allFields(){return[this.longitude,this.latitude,this.x,this.y,this.elevation,"polygon"===this.geometryType?this.area:this.totalLength]}};t([o()],p.prototype,"geometryType",void 0),t([o()],p.prototype,"allFields",null),p=t([e("esri.views.interactive.tooltip.infos.SelectedVertexTooltipInfo")],p);export{p as SelectedVertexTooltipInfo};
5
+ import{__decorate as o}from"tslib";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{makeAreaField as r,makeTotalLengthField as s}from"../fields/fields.js";import{SketchTooltipInfo as i}from"./SketchTooltipInfo.js";import{TooltipInfoWithCoordinates as l}from"./TooltipInfoWithCoordinates.js";let p=class extends(l(i)){constructor(o){super(o),this.type="selected-vertex",this.area=r(),this.totalLength=s(),this.geometryType="polyline",this.allFields.forEach(o=>{o.lockable=!1,o.setActual(null)})}get allFields(){const{longitude:o,latitude:t,x:e,y:r,elevation:s,area:i,totalLength:l,geometryType:p}=this;return[o,t,e,r,s,..."multipoint"===p?[]:["polygon"===p?i:l]]}};o([t()],p.prototype,"geometryType",void 0),o([t()],p.prototype,"allFields",null),p=o([e("esri.views.interactive.tooltip.infos.SelectedVertexTooltipInfo")],p);export{p as SelectedVertexTooltipInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/Point.js";import{combineTimeExtent as a}from"../../layers/support/timeSupport.js";import{load as p,getSourceScale as n}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import c from"../../rest/support/Query.js";import{getFetchPopupTemplate as m}from"./support/popupUtils.js";const u=u=>{const l=u;let y=class extends l{constructor(...e){super(...e),this.view=null}get timeExtent(){return a(this.layer,this.view?.timeExtent,this._get("timeExtent"))}async fetchPopupFeaturesAtLocation(e,o){const{layer:s}=this;if(!e)throw new t("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:a}=s,p=m(s,o);if(!a||null==p)return[];const n=await p.getRequiredFields();r(o);const u=new c;u.timeExtent=this.timeExtent,u.geometry=e,u.outFields=n,u.outSpatialReference=e.spatialReference;const{resolution:l,spatialReference:y}=this.view,h="2d"===this.view.type?new i(l,l,y):new i(.5*l,.5*l,y),{returnTopmostRaster:f,showNoDataRecords:w}=p.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},d={returnDomainValues:!0,returnTopmostRaster:f,pixelSize:h,showNoDataRecords:w,signal:o?.signal};return s.queryVisibleRasters(u,d).then(e=>e)}async getSourceScale(){return await p(),await this.layer.load(),n(this.layer.serviceRasterInfo,this.view.spatialReference)}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}};return e([o()],y.prototype,"layer",void 0),e([o()],y.prototype,"suspended",void 0),e([o({readOnly:!0})],y.prototype,"timeExtent",null),e([o()],y.prototype,"view",void 0),y=e([s("esri.views.layers.ImageryLayerView")],y),y};export{u as default};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/Point.js";import{combineTimeExtent as a}from"../../layers/support/timeSupport.js";import{load as p,getSourceScale as n}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import c from"../../rest/support/Query.js";import{getFetchPopupTemplate as m}from"./support/popupUtils.js";const u=u=>{const l=u;let y=class extends l{constructor(...e){super(...e),this.view=null}get timeExtent(){return a(this.layer,this.view?.timeExtent,this._get("timeExtent"))}async fetchPopupFeaturesAtLocation(e,o){const{layer:s}=this;if(!e)throw new t("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:a}=s,p=m(s,o);if(!a||null==p)return[];const n=await p.getRequiredFields();r(o);const u=new c;u.timeExtent=this.timeExtent,u.geometry=e,u.outFields=n,u.outSpatialReference=e.spatialReference;const{resolution:l,spatialReference:y}=this.view,h="2d"===this.view.type?new i(l,l,y):new i(.5*l,.5*l,y),{returnTopmostRaster:f,showNoDataRecords:w}=p.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},d={returnDomainValues:!0,returnTopmostRaster:f,pixelSize:h,showNoDataRecords:w,signal:o?.signal};return s.queryVisibleRasters(u,d)}async getSourceScale(){return await p(),await this.layer.load(),n(this.layer.serviceRasterInfo,this.view.spatialReference)}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}};return e([o()],y.prototype,"layer",void 0),e([o()],y.prototype,"suspended",void 0),e([o({readOnly:!0})],y.prototype,"timeExtent",null),e([o()],y.prototype,"view",void 0),y=e([s("esri.views.layers.ImageryLayerView")],y),y};export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import r from"../../core/Error.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{addMultidimensionalFieldValues as a,commonRasterFieldNames as o,rasterFieldPrefix as n}from"../../layers/support/rasterFieldUtils.js";import{combineTimeExtent as l}from"../../layers/support/timeSupport.js";import{isFunctionRaster as u}from"../../layers/support/rasterDatasets/datasetUtils.js";import{getDefaultDatumTransformationForDataset as p,projectDatasetExtent as c,getSourceScale as m}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as y}from"./support/popupUtils.js";const f=f=>{const d=f;let h=class extends d{constructor(...e){super(...e),this.layer=null,this.tileInfo=null}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}get timeExtent(){return l(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){try{return this.layer.loaded?p(this.layer.fullExtent,this.view.spatialReference,!0):null}catch{return null}}supportsSpatialReference(e){try{return!this.layer.loaded||!!c(this.layer.serviceRasterInfo,e)}catch{return!1}}async fetchPopupFeaturesAtLocation(e,i){const{layer:s}=this;if(!e)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:l}=s,p=y(s,i);if(!l||null==p)return[];const c=[],{value:m,magdirValue:f,processedValue:d}=await s.identify(e,{timeExtent:this.timeExtent,signal:i?.signal});let h="";if(m?.length){h="imagery-tile"===s.type&&s.hasStandardTime()&&null!=m[0]?m.map(e=>s.getStandardTimeValue(e)).join(", "):m.join(", ");const e={ObjectId:0};e[o.servicePixelValue]="imagery-tile"===s.type&&u(s.raster)?d?.join(", "):h,e[o.rawServicePixelValue]=h;const r=s.raster?.rasterInfo??s.serviceRasterInfo,i=r?.attributeTable;if(null!=i){const{fields:t,features:r}=i,s=t.find(({name:e})=>"value"===e.toLowerCase()),a=e[o.servicePixelValue],l=s?r.find(e=>String(e.attributes[s.name])===a):null;if(l)for(const i in l.attributes)if(l.attributes.hasOwnProperty(i)){e[n+i]=l.attributes[i]}}const l=r?.dataType;"vector-magdir"!==l&&"vector-uv"!==l||(e[o.magnitude]=f?.[0],e[o.direction]=f?.[1]);const{multidimensionalDefinition:p}=this.layer.normalizeRasterFetchOptions({timeExtent:this.timeExtent});a(s.rasterFields,e,p);const y=new t({geometry:this.fullExtent?.clone(),attributes:e,layer:s,sourceLayer:s});c.push(y)}return c}async getSourceScale(){return await this.layer.load(),m(this.layer.serviceRasterInfo,this.view.spatialReference)}_getFullExtent(){return c(this.layer.serviceRasterInfo,this.view.spatialReference)}};return e([i()],h.prototype,"fullExtent",null),e([i()],h.prototype,"layer",void 0),e([i({readOnly:!0})],h.prototype,"timeExtent",null),e([i()],h.prototype,"tileInfo",void 0),e([i({readOnly:!0})],h.prototype,"hasTilingEffects",null),e([i()],h.prototype,"datumTransformation",null),h=e([s("esri.views.layers.ImageryTileLayerView")],h),h};export{f as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import r from"../../core/Error.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{addMultidimensionalFieldValues as a,commonRasterFieldNames as o,rasterFieldPrefix as n}from"../../layers/support/rasterFieldUtils.js";import{combineTimeExtent as l}from"../../layers/support/timeSupport.js";import{isFunctionRaster as u}from"../../layers/support/rasterDatasets/datasetUtils.js";import{getDefaultDatumTransformationForDataset as p,projectDatasetExtent as c,getSourceScale as m}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as y}from"./support/popupUtils.js";const f=f=>{const d=f;let h=class extends d{constructor(...e){super(...e),this.layer=null,this.tileInfo=null}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}get timeExtent(){return l(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){try{return this.layer.loaded?p(this.layer.fullExtent,this.view.spatialReference,!0):null}catch{return null}}supportsSpatialReference(e){try{return!this.layer.loaded||!!c(this.layer.serviceRasterInfo,e)}catch{return!1}}async fetchPopupFeaturesAtLocation(e,i){const{layer:s}=this;if(!e)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:l}=s,p=y(s,i);if(!l||null==p)return[];const c=[],{value:m,magdirValue:f,processedValue:d}=await s.identify(e,{timeExtent:this.timeExtent,signal:i?.signal});let h="";if(m?.length){h="imagery-tile"===s.type&&s.hasStandardTime()&&null!=m[0]?m.map(e=>s.getStandardTimeValue(e)).join(", "):m.join(", ");const e={ObjectId:0};e[o.servicePixelValue]="imagery-tile"===s.type&&u(s.raster)?d?.join(", "):h,e[o.rawServicePixelValue]=h;const r=s.raster?.rasterInfo??s.serviceRasterInfo,i=r?.attributeTable;if(null!=i){const{fields:t,features:r}=i,s=t.find(({name:e})=>"value"===e.toLowerCase()),a=e[o.servicePixelValue],l=s?r.find(e=>String(e.attributes[s.name])===a):null;if(l)for(const i in l.attributes)if(l.attributes.hasOwnProperty(i)){e[n+i]=l.attributes[i]}}const l=r?.dataType;"vector-magdir"!==l&&"vector-uv"!==l||(e[o.magnitude]=f?.[0],e[o.direction]=f?.[1]);const{multidimensionalDefinition:p}=this.layer.normalizeRasterFetchOptions({timeExtent:this.timeExtent});a(s.rasterFields,e,p);const{graphicOrigin:y}=s,g=new t({geometry:this.fullExtent?.clone(),attributes:e,layer:s,origin:y,sourceLayer:s});c.push(g)}return c}async getSourceScale(){return await this.layer.load(),m(this.layer.serviceRasterInfo,this.view.spatialReference)}_getFullExtent(){return c(this.layer.serviceRasterInfo,this.view.spatialReference)}};return e([i()],h.prototype,"fullExtent",null),e([i()],h.prototype,"layer",void 0),e([i({readOnly:!0})],h.prototype,"timeExtent",null),e([i()],h.prototype,"tileInfo",void 0),e([i({readOnly:!0})],h.prototype,"hasTilingEffects",null),e([i()],h.prototype,"datumTransformation",null),h=e([s("esri.views.layers.ImageryTileLayerView")],h),h};export{f as default};