@arcgis/core 4.31.0-next.20240919 → 4.31.0-next.20240921

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 (283) hide show
  1. package/WebDocument2D.js +1 -1
  2. package/WebLinkChart.js +1 -1
  3. package/WebMap.js +1 -1
  4. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  5. package/arcade/featureset/actions/Adapted.js +1 -1
  6. package/arcade/featureset/support/StatsField.js +1 -1
  7. package/arcade/featureset/support/errorsupport.js +1 -1
  8. package/arcade/featureset/support/sqlUtils.js +1 -1
  9. package/arcade/functions/maths.js +1 -1
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{d9d8606f0a7c82b42755.js → 093a1ee161cb6a840283.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2020b99675caabf5ac87.js +1 -0
  13. package/assets/esri/core/workers/chunks/24d45530fe47b3114daf.js +1 -0
  14. package/assets/esri/core/workers/chunks/35f92652df2561845d47.js +1 -0
  15. package/assets/esri/core/workers/chunks/42b92b4c2c9fd2b15f60.js +2 -0
  16. package/assets/esri/core/workers/chunks/{ba561e03df67894e437f.js.LICENSE.txt → 42b92b4c2c9fd2b15f60.js.LICENSE.txt} +1 -1
  17. package/assets/esri/core/workers/chunks/65b1d7fa57d4c764efe8.js +1 -0
  18. package/assets/esri/core/workers/chunks/{b99d380cce485e65c990.js → 6cda92678ffeeaea0330.js} +1 -1
  19. package/assets/esri/core/workers/chunks/736e0c5cb9010ca818d8.js +1 -0
  20. package/assets/esri/core/workers/chunks/757b83799555958e059c.js +1 -0
  21. package/assets/esri/core/workers/chunks/76d8192015ce46dbf92a.js +1 -0
  22. package/assets/esri/core/workers/chunks/7b4880b2dc6b01d70ccc.js +1 -0
  23. package/assets/esri/core/workers/chunks/884cd0bd036c65567929.js +1 -0
  24. package/assets/esri/core/workers/chunks/95ea77a7d63c9d7ed78b.js +1 -0
  25. package/assets/esri/core/workers/chunks/{da3a4eb3fbb9dd509b4b.js → 98e872da08203455a5b6.js} +1 -1
  26. package/assets/esri/core/workers/chunks/ad4fa125e09cc0047f5b.js +1 -0
  27. package/assets/esri/core/workers/chunks/bb5a18dd1e6a71905668.js +2 -0
  28. package/assets/esri/core/workers/chunks/bf406a46515d5dfebe06.js +1 -0
  29. package/assets/esri/core/workers/chunks/d9c34e07627d93d4670b.js +1 -0
  30. package/assets/esri/core/workers/chunks/e1e9a7695e48e34a69bd.js +1 -0
  31. package/assets/esri/core/workers/chunks/e4f1464ed269c301b4ee.js +1 -0
  32. package/assets/esri/core/workers/chunks/{072029d05ccb56979523.js → e611141692355a1ba2b2.js} +1 -1
  33. package/assets/esri/core/workers/chunks/f41e8d0d6f5e81289179.js +1 -0
  34. package/assets/esri/core/workers/chunks/f7c96d34c70ed36da7c2.js +1 -0
  35. package/assets/esri/core/workers/chunks/{5ca8e767cc03e1425338.js → f9e90a2fda559ca68848.js} +1 -1
  36. package/assets/esri/themes/base/_functions.scss +6 -2
  37. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +4 -0
  38. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +6 -0
  39. package/assets/esri/themes/dark/main.css +1 -1
  40. package/assets/esri/themes/light/main.css +1 -1
  41. package/assets/esri/themes/light/view.css +1 -1
  42. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery.json +1 -1
  43. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ar.json +1 -1
  44. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bg.json +1 -1
  45. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bs.json +1 -1
  46. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ca.json +1 -1
  47. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_cs.json +1 -1
  48. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_da.json +1 -1
  49. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_de.json +1 -1
  50. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_el.json +1 -1
  51. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_en.json +1 -1
  52. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_es.json +1 -1
  53. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_et.json +1 -1
  54. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fi.json +1 -1
  55. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fr.json +1 -1
  56. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_he.json +1 -1
  57. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hr.json +1 -1
  58. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hu.json +1 -1
  59. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_id.json +1 -1
  60. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_it.json +1 -1
  61. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ja.json +1 -1
  62. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ko.json +1 -1
  63. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lt.json +1 -1
  64. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lv.json +1 -1
  65. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nb.json +1 -1
  66. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nl.json +1 -1
  67. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pl.json +1 -1
  68. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-BR.json +1 -1
  69. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-PT.json +1 -1
  70. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ro.json +1 -1
  71. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ru.json +1 -1
  72. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sk.json +1 -1
  73. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sl.json +1 -1
  74. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sr.json +1 -1
  75. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sv.json +1 -1
  76. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_th.json +1 -1
  77. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_tr.json +1 -1
  78. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_uk.json +1 -1
  79. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_vi.json +1 -1
  80. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-CN.json +1 -1
  81. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-HK.json +1 -1
  82. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-TW.json +1 -1
  83. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  84. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  85. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  86. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  87. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  88. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  89. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  90. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  91. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  92. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  93. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  94. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  95. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  96. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  97. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  98. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  99. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  100. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  101. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  102. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  103. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  104. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  105. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  106. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nb.json +1 -1
  107. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  108. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  109. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  110. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  111. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  112. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  113. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  114. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  115. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  116. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  117. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  118. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  119. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  120. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  121. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  122. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  123. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  124. package/chunks/Bufferer-93RDFIRm.js +5 -0
  125. package/chunks/Centroid-DZi-eb9F.js +1 -1
  126. package/chunks/ComponentShader.glsl.js +10 -13
  127. package/chunks/Distance2DCalculator-De7WFGFq.js +5 -0
  128. package/chunks/GeodeticDistanceCalculator-CN7xMqrJ.js +5 -0
  129. package/chunks/LineSeries.js +1 -1
  130. package/chunks/{OITCompositing.glsl.js → OITBlend.glsl.js} +1 -1
  131. package/chunks/OperatorGeneralize.js +1 -1
  132. package/chunks/OperatorGeodesicBuffer.js +1 -1
  133. package/chunks/OperatorGeodeticArea.js +1 -1
  134. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  135. package/chunks/OperatorGeodeticDistance.js +1 -1
  136. package/chunks/OperatorGeodeticLength.js +1 -1
  137. package/chunks/OperatorProximity.js +1 -1
  138. package/chunks/OperatorShapePreservingLength.js +5 -0
  139. package/chunks/Polyline.js +1 -1
  140. package/chunks/Theme.js +1 -1
  141. package/chunks/Tick.js +1 -1
  142. package/chunks/tslib.es6.js +1 -1
  143. package/core/mathUtils.js +1 -1
  144. package/core/sql/AggregateFunctions.js +1 -1
  145. package/core/sql/SqlInterval.js +1 -1
  146. package/core/sql/StandardizedFunctions.js +1 -1
  147. package/core/sql/WhereClause.js +1 -1
  148. package/core/sql/WhereGrammar.js +1 -1
  149. package/core/sql/errorSupport.js +5 -0
  150. package/core/sql/sqlArithmeticUtils.js +1 -1
  151. package/core/sql/sqlCompareUtils.js +1 -1
  152. package/core/sql/sqlDateParsingUtils.js +1 -1
  153. package/geometry/operators/areaOperator.js +5 -0
  154. package/geometry/operators/containsOperator.js +1 -1
  155. package/geometry/operators/crossesOperator.js +1 -1
  156. package/geometry/operators/disjointOperator.js +1 -1
  157. package/geometry/operators/distanceOperator.js +1 -1
  158. package/geometry/operators/equalsOperator.js +1 -1
  159. package/geometry/operators/geodeticDensifyOperator.js +5 -0
  160. package/geometry/operators/graphicBufferOperator.js +5 -0
  161. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  162. package/geometry/operators/gx/operatorBuffer.js +1 -1
  163. package/geometry/operators/gx/operatorClip.js +1 -1
  164. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  165. package/geometry/operators/gx/operatorCut.js +1 -1
  166. package/geometry/operators/gx/operatorDifference.js +1 -1
  167. package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
  168. package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
  169. package/geometry/operators/gx/{operatorGeodeticDensifyByLength.js → operatorGeodeticDensify.js} +1 -1
  170. package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
  171. package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
  172. package/geometry/operators/gx/operatorGraphicBuffer.js +5 -0
  173. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  174. package/geometry/operators/gx/operatorIntersection.js +1 -1
  175. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  176. package/geometry/operators/gx/operatorOffset.js +1 -1
  177. package/geometry/operators/gx/operatorSimplify.js +1 -1
  178. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  179. package/geometry/operators/gx/operatorUnion.js +1 -1
  180. package/geometry/operators/intersectsOperator.js +1 -1
  181. package/geometry/operators/isNearOperator.js +1 -1
  182. package/geometry/operators/lengthOperator.js +5 -0
  183. package/geometry/operators/overlapsOperator.js +1 -1
  184. package/geometry/operators/proximityOperator.d.ts +4 -0
  185. package/geometry/operators/proximityOperator.js +1 -1
  186. package/geometry/operators/relateOperator.js +1 -1
  187. package/geometry/operators/reshapeOperator.js +1 -1
  188. package/geometry/operators/touchesOperator.js +1 -1
  189. package/geometry/operators/withinOperator.js +1 -1
  190. package/interfaces.d.ts +310 -28
  191. package/layers/mixins/ArcGISMapService.js +1 -1
  192. package/layers/support/ControlPointsGeoreference.js +1 -1
  193. package/layers/support/MediaElementBase.js +1 -1
  194. package/layers/support/mediaUtils.js +1 -1
  195. package/linkChart/LinkChartProperties.js +1 -1
  196. package/linkChart/utils.js +1 -1
  197. package/package.json +2 -2
  198. package/portal/schemas/definitions.js +1 -1
  199. package/support/revision.js +1 -1
  200. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  201. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  202. package/views/2d/layers/LayerView2D.js +1 -1
  203. package/views/2d/support/highlightGroupUtils.js +1 -1
  204. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  205. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  206. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  207. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  208. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  209. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  210. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  211. package/views/3d/webgl-engine/effects/transparency/OITBlend.glsl.js +5 -0
  212. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +5 -0
  213. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +5 -0
  214. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  215. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  216. package/views/LinkChartView.js +1 -1
  217. package/views/MapView.js +1 -1
  218. package/views/View.js +1 -1
  219. package/views/View2D.js +1 -1
  220. package/views/draw/DrawGraphicTool.js +1 -1
  221. package/views/draw/support/Box.js +1 -1
  222. package/views/draw/support/Reshape.js +1 -1
  223. package/views/interactive/Tooltip.d.ts +4 -0
  224. package/views/interactive/Tooltip.js +5 -0
  225. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  226. package/webdoc/widgets/TimeSlider.js +1 -1
  227. package/webmap/InitialViewProperties.js +1 -1
  228. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  229. package/widgets/BasemapGallery.js +1 -1
  230. package/widgets/BasemapLayerList/css.js +1 -1
  231. package/widgets/BasemapLayerList.js +1 -1
  232. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  233. package/widgets/BatchAttributeForm/templates/BatchAttributeFormElementTemplate.js +1 -1
  234. package/widgets/BatchAttributeForm/templates/BatchAttributeFormTemplate.js +1 -1
  235. package/widgets/BatchAttributeForm/templates/BatchFieldElementTemplate.js +1 -1
  236. package/widgets/BatchAttributeForm/templates/batchAttributeFormTemplateUtils.js +1 -1
  237. package/widgets/CatalogLayerList.js +1 -1
  238. package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
  239. package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
  240. package/widgets/FeatureForm/FieldInput.js +1 -1
  241. package/widgets/LayerList/LayerListItem.js +1 -1
  242. package/widgets/LayerList/LayerListViewModel.js +1 -1
  243. package/widgets/LayerList.js +1 -1
  244. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  245. package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
  246. package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter3D.js +1 -1
  247. package/widgets/OrientedImageryViewer/constants.js +1 -1
  248. package/widgets/OrientedImageryViewer/css.js +1 -1
  249. package/widgets/OrientedImageryViewer/utils.js +1 -1
  250. package/widgets/OrientedImageryViewer.js +1 -1
  251. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  252. package/widgets/Sketch/SketchViewModel.js +1 -1
  253. package/widgets/Sketch.js +1 -1
  254. package/widgets/support/SnappingControls.js +1 -1
  255. package/assets/esri/core/workers/chunks/0cfa9665dab31e5235a8.js +0 -1
  256. package/assets/esri/core/workers/chunks/22fb5687932019304225.js +0 -1
  257. package/assets/esri/core/workers/chunks/3b3c8362359a82c66793.js +0 -1
  258. package/assets/esri/core/workers/chunks/3cb1de0b9bf9a25112e0.js +0 -1
  259. package/assets/esri/core/workers/chunks/59833b27d8413b6d9312.js +0 -1
  260. package/assets/esri/core/workers/chunks/5e43cb91bbe20f2d32e3.js +0 -1
  261. package/assets/esri/core/workers/chunks/67df47efb9a9dfeafee2.js +0 -1
  262. package/assets/esri/core/workers/chunks/6be62448e33baabe028c.js +0 -1
  263. package/assets/esri/core/workers/chunks/6d668f7696f280ec9588.js +0 -1
  264. package/assets/esri/core/workers/chunks/74edde71352e1f578a3b.js +0 -1
  265. package/assets/esri/core/workers/chunks/907e74abb4a85a76e3b5.js +0 -1
  266. package/assets/esri/core/workers/chunks/941fe04f47059074c05b.js +0 -2
  267. package/assets/esri/core/workers/chunks/a0005bc65f79e83f26ee.js +0 -1
  268. package/assets/esri/core/workers/chunks/a6560ff77be29344bc50.js +0 -1
  269. package/assets/esri/core/workers/chunks/a6c3c1827d2e8bbfcd9e.js +0 -1
  270. package/assets/esri/core/workers/chunks/ba561e03df67894e437f.js +0 -2
  271. package/assets/esri/core/workers/chunks/df9daac7ea581e9e5ca4.js +0 -1
  272. package/assets/esri/core/workers/chunks/ea51a7c32f716f4f1a34.js +0 -1
  273. package/assets/esri/core/workers/chunks/ef7dcb8758e7f21d30bc.js +0 -1
  274. package/chunks/Distance2DCalculator-BzAEa8Xe.js +0 -5
  275. package/chunks/GeodeticDistanceCalculator-BS_KY66f.js +0 -5
  276. package/chunks/OperatorShapePreservingDensify.js +0 -5
  277. package/geometry/operators/geodeticDensifyByLengthOperator.js +0 -5
  278. package/geometry/operators/gx/operatorShapePreservingDensify.js +0 -5
  279. package/geometry/operators/shapePreservingDensifyOperator.js +0 -5
  280. package/views/3d/webgl-engine/shaders/OITCompositing.glsl.js +0 -5
  281. package/views/3d/webgl-engine/shaders/OITCompositingTechnique.js +0 -5
  282. package/views/interactive/tooltip/Tooltip.js +0 -5
  283. /package/assets/esri/core/workers/chunks/{941fe04f47059074c05b.js.LICENSE.txt → bb5a18dd1e6a71905668.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import{UndoRedo as o}from"../../UndoRedo.js";import{createTask as r}from"../../core/asyncUtils.js";import i from"../../core/Evented.js";import{makeHandle as s}from"../../core/handleUtils.js";import{destroyMaybe as n}from"../../core/maybe.js";import{watch as a,syncAndInitial as p}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{load as h}from"../../geometry/coordinateFormatter.js";import d from"../../layers/GraphicsLayer.js";import{pointEquals as u}from"../../layers/graphics/dehydratedFeatureComparison.js";import{CreateOperationGeometry as m}from"./support/CreateOperationGeometry.js";import{createCircle as y,createEllipse as g,createSquare as v,createRectangle as f,createPolygon as _,createPolyline as O,createMultipoint as w}from"./support/createUtils.js";import{createViewAlignedCoordinateSystem as C}from"./support/surfaceCoordinateSystems.js";import{createTooltipInfos as G,initializeConstraints as x,unlockConstraintsOnVertexAddOrRemove as V,lockElevationOnVertexAdd as b,getActiveTooltipInfo as j,updateTooltipInfo as S,getConstraintZ as T}from"./support/tooltipUtils.js";import{InteractiveToolBase as U}from"../interactive/InteractiveToolBase.js";import k from"../interactive/sketch/SketchOptions.js";import{makeTooltip as H}from"../interactive/tooltip/Tooltip.js";import{pasteLocation as R,enterInputModeIfAvailable as L}from"../interactive/tooltip/tooltipCommonUtils.js";import{autorun as z}from"../../core/accessorSupport/trackingUtils.js";let E=class extends(i.EventedMixin(U)){constructor(t){super(t),this._graphic=null,this._coordinateFormatterLoadTask=null,this._createOperationGeometry=null,this.defaultZ=0,this.directionOptions=null,this.geometryType=null,this.hasZ=!0,this.geometryToPlace=null,this.snappingManager=null,this.snapToScene=!1,this.sketchOptions=new k}initialize(){const{view:t}=this;this.internalGraphicsLayer=new d({listMode:"hide",internal:!0}),this.view.map.layers.add(this.internalGraphicsLayer);const e=this.drawOperation=this.makeDrawOperation();this.tooltipInfos=G(t.type,this.sketchOptions);const o=H((()=>({view:t,options:this.sketchOptions.tooltips})));this.tooltip=o,x(this._tooltipsContext),this._coordinateFormatterLoadTask=r((()=>h())),this.addHandles([e.on("vertex-add",(t=>this.onVertexAdd(t))),e.on("vertex-remove",(t=>this.onVertexRemove(t))),e.on("vertex-update",(t=>this.onVertexUpdate(t))),e.on("cursor-update",(t=>this.onCursorUpdate(t))),e.on("cursor-remove",(()=>this._updateGraphic())),e.on("complete",(t=>this.onComplete(t))),this._coordinateFormatterLoadTask,o.on("paste",(t=>R(t,this.activeTooltipInfo))),a((()=>this.cursor),(t=>{e.cursor=t}),p),z((()=>{const{activeTooltipInfo:t,sketchOptions:e}=this;S(t,this._tooltipsContext),o.info=e.tooltips.effectiveEnabled?t:null})),z((()=>{e.constraintZ=T(this._tooltipsContext)}))]),this.finishToolCreation()}destroy(){this.drawOperation=n(this.drawOperation),this.tooltip=n(this.tooltip),this._destroyAllVisualizations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=n(this.internalGraphicsLayer),this._set("view",null)}get _drawSpatialReference(){return this.drawOperation.coordinateHelper.spatialReference}get _tooltipsContext(){return{createOperationGeometry:this._createOperationGeometry,defaultZ:this.defaultZ,directionOptions:this.directionOptions,drawOperation:this.drawOperation,forceUniformSize:this.forceUniformSize,geometryType:this.geometryType,graphic:this.graphic,sketchOptions:this.sketchOptions,tooltipInfos:this.tooltipInfos,view:this.view}}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(t){this._set("centered",t),this._updateGraphic()}get cursor(){return this._get("cursor")}set cursor(t){this._set("cursor",t)}set enabled(t){this.drawOperation.interactive=t,this._set("enabled",t)}set forceUniformSize(t){this._set("forceUniformSize",t),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(t){this._set("graphicSymbol",t),null!=this._graphic&&(this._graphic.symbol=t)}set mode(t){const e=this.drawOperation;e&&(e.drawingMode=t),this._set("mode",t)}get updating(){return this.drawOperation?.updating??!1}get undoRedo(){const{view:{type:t,map:e}}=this;return"2d"===t&&e&&"undoRedo"in e&&e.undoRedo instanceof o?e.undoRedo:null}set undoRedo(t){this._override("undoRedo",t)}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(t){this.destroyed||L(t,this.tooltip)||this.drawOperation.onInputEvent(t)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo(),0===this.drawOperation.numCommittedVertices&&x(this._tooltipsContext)}_destroyAllVisualizations(){this.removeHandles(A.outline),this.removeHandles(A.regularVertices),this.removeHandles(A.activeVertex),this.removeHandles(A.activeEdge),this.removeHandles(I)}_createOrUpdateGraphic(t){if(null!=this._graphic)return this.updateGraphicGeometry(t),this._graphic;const o=new e({...this.graphicProperties,symbol:this.graphicSymbol});return this._graphic=o,this.updateGraphicGeometry(t),this.internalGraphicsLayer.add(o),this.addHandles(this.initializeGraphic(o)),this.notifyChange("graphic"),this.addHandles(s((()=>{this.internalGraphicsLayer.remove(o),this._graphic===o&&(this._graphic=null)})),I),o}updateGraphicGeometry(t){this._graphic.geometry=t}_getCreateOperationGeometry(t={operationComplete:!1}){if(null==this.drawOperation)return;const{coordinateHelper:e,view:o,visualizationCursorVertex:r,lastVertex:i,committedVertices:s,geometryIncludingUncommittedVertices:n,numCommittedVertices:a}=this.drawOperation;if(!(a>0||null!=r))return;const p=t.operationComplete?s:n,l=p.length,c=null!=r?e.pointToArray(r):null,h=this._drawSpatialReference,d="3d"===o.type&&"global"===o.viewingMode,G=new m;G.committedVertices=s,G.cursorVertex=c;const{geometryType:x}=this;switch(x){case"point":case"mesh":G.full=e.arrayToPoint(p[0]);break;case"multipoint":G.full=l>0?w(p,h):null;break;case"polyline":case"polygon":l>0&&(G.full="polygon"===x?_([p],h,d,!0):O([p],h,d),G.cursorEdge=null!=c&&i&&!u(r,i)?O([[c,e.pointToArray(i)]],h,d):null,G.outline=l>1?G.full:null);break;case"circle":case"rectangle":{if(G.committedVertices=G.cursorVertex=null,!l)break;const e=C(o,p[0]),r=p[0],i=e.makeMapPoint(r[0]+M*o.resolution,r[1]);"circle"===x?1===l&&t.operationComplete?G.circle=y([r,i],e,!0):2===l&&(this.forceUniformSize?G.circle=y(p,e,this.centered):G.rectangle=g(p,e,this.centered)):1===l&&t.operationComplete?G.rectangle=v([r,i],e,!0):2===l&&(G.rectangle=this.forceUniformSize?v(p,e,this.centered):f(p,e,this.centered)),G.full=null!=G.circle?G.circle.geometry:G.rectangle?.geometry,G.outline="polygon"===G.full?.type?G.full:null;break}default:return null}return G}initializeGraphic(t){return s()}onComplete(t){if(!this.drawOperation)return;this._updateGraphic();let e=null;if(this.drawOperation.isCompleted){const t=this._getCreateOperationGeometry({operationComplete:!0});null!=t&&(e=this._createOrUpdateGraphic(t.full))}this._createOperationGeometry=null,this.emit("complete",{graphic:e,...t})}onCursorUpdate(t){this._updateGraphic(),this.emit("cursor-update",t)}onDeactivate(){const{drawOperation:t}=this;t&&(t.isCompleted||t.cancel())}onOutlineChanged(t){return s()}onCursorEdgeChanged(t){return s()}onVertexAdd(t){V(this._tooltipsContext),this._updateGraphic(),b(t.vertices.at(0)?.coordinates,this._tooltipsContext),this.emit("vertex-add",t)}onVertexRemove(t){V(this._tooltipsContext),this._updateGraphic(),this.emit("vertex-remove",t)}onVertexUpdate(t){this._updateGraphic(),this.emit("vertex-update",t)}_updateGraphic(){const t=this._getCreateOperationGeometry();this._createOperationGeometry=t,null!=t?(null!=t.cursorEdge?this.addHandles(this.onCursorEdgeChanged(t.cursorEdge),A.activeEdge):this.removeHandles(A.activeEdge),null!=t.outline?this.addHandles(this.onOutlineChanged(t.outline),A.outline):this.removeHandles(A.outline),null!=t.committedVertices?this.addHandles(this.onRegularVerticesChanged(t.committedVertices),A.regularVertices):this.removeHandles(A.regularVertices),null!=t.cursorVertex?this.addHandles(this.onActiveVertexChanged(t.cursorVertex),A.activeVertex):this.removeHandles(A.activeVertex),null!=t.full?this._createOrUpdateGraphic(t.full):this.removeHandles(I)):this._destroyAllVisualizations()}get activeTooltipInfo(){return this._coordinateFormatterLoadTask?.finished?j(this._tooltipsContext):null}};t([l()],E.prototype,"_coordinateFormatterLoadTask",void 0),t([l()],E.prototype,"_createOperationGeometry",void 0),t([l()],E.prototype,"_tooltipsContext",null),t([l({value:!0})],E.prototype,"centered",null),t([l()],E.prototype,"cursor",null),t([l({nonNullable:!0})],E.prototype,"defaultZ",void 0),t([l({constructOnly:!0})],E.prototype,"directionOptions",void 0),t([l()],E.prototype,"drawOperation",void 0),t([l({value:!0})],E.prototype,"enabled",null),t([l({value:!0})],E.prototype,"forceUniformSize",null),t([l({constructOnly:!0})],E.prototype,"geometryType",void 0),t([l()],E.prototype,"graphic",null),t([l({constructOnly:!0})],E.prototype,"graphicProperties",void 0),t([l()],E.prototype,"graphicSymbol",null),t([l({constructOnly:!0})],E.prototype,"hasZ",void 0),t([l({constructOnly:!0})],E.prototype,"geometryToPlace",void 0),t([l()],E.prototype,"mode",null),t([l()],E.prototype,"snappingManager",void 0),t([l()],E.prototype,"snapToScene",void 0),t([l()],E.prototype,"tooltip",void 0),t([l()],E.prototype,"tooltipInfos",void 0),t([l({constructOnly:!0,type:k})],E.prototype,"sketchOptions",void 0),t([l()],E.prototype,"updating",null),t([l({constructOnly:!0,nonNullable:!0})],E.prototype,"view",void 0),t([l({constructOnly:!0})],E.prototype,"undoRedo",null),t([l()],E.prototype,"activeTooltipInfo",null),E=t([c("esri.views.draw.DrawGraphicTool")],E);const I=Symbol("create-operation-graphic"),A={outline:Symbol("outline-visual"),regularVertices:Symbol("regular-vertices-visual"),activeVertex:Symbol("active-vertex-visual"),activeEdge:Symbol("active-edge-visual")};function F(t){switch(t){case"point":case"polyline":case"polygon":case"multipoint":return t;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const M=48;export{E as DrawGraphicTool,F as geometryTypeToDrawOperationGeometryType};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import{UndoRedo as o}from"../../UndoRedo.js";import{createTask as r}from"../../core/asyncUtils.js";import i from"../../core/Evented.js";import{makeHandle as s}from"../../core/handleUtils.js";import{destroyMaybe as n}from"../../core/maybe.js";import{watch as a,syncAndInitial as p}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{load as h}from"../../geometry/coordinateFormatter.js";import d from"../../layers/GraphicsLayer.js";import{pointEquals as u}from"../../layers/graphics/dehydratedFeatureComparison.js";import{CreateOperationGeometry as m}from"./support/CreateOperationGeometry.js";import{createCircle as y,createEllipse as g,createSquare as v,createRectangle as f,createPolygon as _,createPolyline as O,createMultipoint as w}from"./support/createUtils.js";import{createViewAlignedCoordinateSystem as C}from"./support/surfaceCoordinateSystems.js";import{createTooltipInfos as G,initializeConstraints as x,unlockConstraintsOnVertexAddOrRemove as V,lockElevationOnVertexAdd as b,getActiveTooltipInfo as S,updateTooltipInfo as U,getConstraintZ as j}from"./support/tooltipUtils.js";import{InteractiveToolBase as T}from"../interactive/InteractiveToolBase.js";import k from"../interactive/sketch/SketchOptions.js";import{makeTooltip as H,pasteLocation as R,enterInputModeIfAvailable as L}from"../interactive/tooltip/tooltipCommonUtils.js";import{autorun as z}from"../../core/accessorSupport/trackingUtils.js";let E=class extends(i.EventedMixin(T)){constructor(t){super(t),this._graphic=null,this._coordinateFormatterLoadTask=null,this._createOperationGeometry=null,this.defaultZ=0,this.directionOptions=null,this.geometryType=null,this.hasZ=!0,this.geometryToPlace=null,this.snappingManager=null,this.snapToScene=!1,this.sketchOptions=new k}initialize(){const{view:t}=this;this.internalGraphicsLayer=new d({listMode:"hide",internal:!0}),this.view.map.layers.add(this.internalGraphicsLayer);const e=this.drawOperation=this.makeDrawOperation();this.tooltipInfos=G(t.type,this.sketchOptions);const o=H((()=>({view:t,options:this.sketchOptions.tooltips})));this.tooltip=o,x(this._tooltipsContext),this._coordinateFormatterLoadTask=r((()=>h())),this.addHandles([e.on("vertex-add",(t=>this.onVertexAdd(t))),e.on("vertex-remove",(t=>this.onVertexRemove(t))),e.on("vertex-update",(t=>this.onVertexUpdate(t))),e.on("cursor-update",(t=>this.onCursorUpdate(t))),e.on("cursor-remove",(()=>this._updateGraphic())),e.on("complete",(t=>this.onComplete(t))),this._coordinateFormatterLoadTask,o.on("paste",(t=>R(t,this.activeTooltipInfo))),a((()=>this.cursor),(t=>{e.cursor=t}),p),z((()=>{const{activeTooltipInfo:t,sketchOptions:e}=this;U(t,this._tooltipsContext),o.info=e.tooltips.effectiveEnabled?t:null})),z((()=>{e.constraintZ=j(this._tooltipsContext)}))]),this.finishToolCreation()}destroy(){this.drawOperation=n(this.drawOperation),this.tooltip=n(this.tooltip),this._destroyAllVisualizations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=n(this.internalGraphicsLayer),this._set("view",null)}get _drawSpatialReference(){return this.drawOperation.coordinateHelper.spatialReference}get _tooltipsContext(){return{createOperationGeometry:this._createOperationGeometry,defaultZ:this.defaultZ,directionOptions:this.directionOptions,drawOperation:this.drawOperation,forceUniformSize:this.forceUniformSize,geometryType:this.geometryType,graphic:this.graphic,sketchOptions:this.sketchOptions,tooltipInfos:this.tooltipInfos,view:this.view}}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(t){this._set("centered",t),this._updateGraphic()}get cursor(){return this._get("cursor")}set cursor(t){this._set("cursor",t)}set enabled(t){this.drawOperation.interactive=t,this._set("enabled",t)}set forceUniformSize(t){this._set("forceUniformSize",t),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(t){this._set("graphicSymbol",t),null!=this._graphic&&(this._graphic.symbol=t)}set mode(t){const e=this.drawOperation;e&&(e.drawingMode=t),this._set("mode",t)}get updating(){return this.drawOperation?.updating??!1}get undoRedo(){const{view:{type:t,map:e}}=this;return"2d"===t&&e&&"undoRedo"in e&&e.undoRedo instanceof o?e.undoRedo:null}set undoRedo(t){this._override("undoRedo",t)}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(t){this.destroyed||L(t,this.tooltip)||this.drawOperation.onInputEvent(t)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo(),0===this.drawOperation.numCommittedVertices&&x(this._tooltipsContext)}_destroyAllVisualizations(){this.removeHandles(A.outline),this.removeHandles(A.regularVertices),this.removeHandles(A.activeVertex),this.removeHandles(A.activeEdge),this.removeHandles(I)}_createOrUpdateGraphic(t){if(null!=this._graphic)return this.updateGraphicGeometry(t),this._graphic;const o=new e({...this.graphicProperties,symbol:this.graphicSymbol});return this._graphic=o,this.updateGraphicGeometry(t),this.internalGraphicsLayer.add(o),this.addHandles(this.initializeGraphic(o)),this.notifyChange("graphic"),this.addHandles(s((()=>{this.internalGraphicsLayer.remove(o),this._graphic===o&&(this._graphic=null)})),I),o}updateGraphicGeometry(t){this._graphic.geometry=t}_getCreateOperationGeometry(t={operationComplete:!1}){if(null==this.drawOperation)return;const{coordinateHelper:e,view:o,visualizationCursorVertex:r,lastVertex:i,committedVertices:s,geometryIncludingUncommittedVertices:n,numCommittedVertices:a}=this.drawOperation;if(!(a>0||null!=r))return;const p=t.operationComplete?s:n,l=p.length,c=null!=r?e.pointToArray(r):null,h=this._drawSpatialReference,d="3d"===o.type&&"global"===o.viewingMode,G=new m;G.committedVertices=s,G.cursorVertex=c;const{geometryType:x}=this;switch(x){case"point":case"mesh":G.full=e.arrayToPoint(p[0]);break;case"multipoint":G.full=l>0?w(p,h):null;break;case"polyline":case"polygon":l>0&&(G.full="polygon"===x?_([p],h,d,!0):O([p],h,d),G.cursorEdge=null!=c&&i&&!u(r,i)?O([[c,e.pointToArray(i)]],h,d):null,G.outline=l>1?G.full:null);break;case"circle":case"rectangle":{if(G.committedVertices=G.cursorVertex=null,!l)break;const e=C(o,p[0]),r=p[0],i=e.makeMapPoint(r[0]+M*o.resolution,r[1]);"circle"===x?1===l&&t.operationComplete?G.circle=y([r,i],e,!0):2===l&&(this.forceUniformSize?G.circle=y(p,e,this.centered):G.rectangle=g(p,e,this.centered)):1===l&&t.operationComplete?G.rectangle=v([r,i],e,!0):2===l&&(G.rectangle=this.forceUniformSize?v(p,e,this.centered):f(p,e,this.centered)),G.full=null!=G.circle?G.circle.geometry:G.rectangle?.geometry,G.outline="polygon"===G.full?.type?G.full:null;break}default:return null}return G}initializeGraphic(t){return s()}onComplete(t){if(!this.drawOperation)return;this._updateGraphic();let e=null;if(this.drawOperation.isCompleted){const t=this._getCreateOperationGeometry({operationComplete:!0});null!=t&&(e=this._createOrUpdateGraphic(t.full))}this._createOperationGeometry=null,this.emit("complete",{graphic:e,...t})}onCursorUpdate(t){this._updateGraphic(),this.emit("cursor-update",t)}onDeactivate(){const{drawOperation:t}=this;t&&(t.isCompleted||t.cancel())}onOutlineChanged(t){return s()}onCursorEdgeChanged(t){return s()}onVertexAdd(t){V(this._tooltipsContext),this._updateGraphic(),b(t.vertices.at(0)?.coordinates,this._tooltipsContext),this.emit("vertex-add",t)}onVertexRemove(t){V(this._tooltipsContext),this._updateGraphic(),this.emit("vertex-remove",t)}onVertexUpdate(t){this._updateGraphic(),this.emit("vertex-update",t)}_updateGraphic(){const t=this._getCreateOperationGeometry();this._createOperationGeometry=t,null!=t?(null!=t.cursorEdge?this.addHandles(this.onCursorEdgeChanged(t.cursorEdge),A.activeEdge):this.removeHandles(A.activeEdge),null!=t.outline?this.addHandles(this.onOutlineChanged(t.outline),A.outline):this.removeHandles(A.outline),null!=t.committedVertices?this.addHandles(this.onRegularVerticesChanged(t.committedVertices),A.regularVertices):this.removeHandles(A.regularVertices),null!=t.cursorVertex?this.addHandles(this.onActiveVertexChanged(t.cursorVertex),A.activeVertex):this.removeHandles(A.activeVertex),null!=t.full?this._createOrUpdateGraphic(t.full):this.removeHandles(I)):this._destroyAllVisualizations()}get activeTooltipInfo(){return this._coordinateFormatterLoadTask?.finished?S(this._tooltipsContext):null}};t([l()],E.prototype,"_coordinateFormatterLoadTask",void 0),t([l()],E.prototype,"_createOperationGeometry",void 0),t([l()],E.prototype,"_tooltipsContext",null),t([l({value:!0})],E.prototype,"centered",null),t([l()],E.prototype,"cursor",null),t([l({nonNullable:!0})],E.prototype,"defaultZ",void 0),t([l({constructOnly:!0})],E.prototype,"directionOptions",void 0),t([l()],E.prototype,"drawOperation",void 0),t([l({value:!0})],E.prototype,"enabled",null),t([l({value:!0})],E.prototype,"forceUniformSize",null),t([l({constructOnly:!0})],E.prototype,"geometryType",void 0),t([l()],E.prototype,"graphic",null),t([l({constructOnly:!0})],E.prototype,"graphicProperties",void 0),t([l()],E.prototype,"graphicSymbol",null),t([l({constructOnly:!0})],E.prototype,"hasZ",void 0),t([l({constructOnly:!0})],E.prototype,"geometryToPlace",void 0),t([l()],E.prototype,"mode",null),t([l()],E.prototype,"snappingManager",void 0),t([l()],E.prototype,"snapToScene",void 0),t([l()],E.prototype,"tooltip",void 0),t([l()],E.prototype,"tooltipInfos",void 0),t([l({constructOnly:!0,type:k})],E.prototype,"sketchOptions",void 0),t([l()],E.prototype,"updating",null),t([l({constructOnly:!0,nonNullable:!0})],E.prototype,"view",void 0),t([l({constructOnly:!0})],E.prototype,"undoRedo",null),t([l()],E.prototype,"activeTooltipInfo",null),E=t([c("esri.views.draw.DrawGraphicTool")],E);const I=Symbol("create-operation-graphic"),A={outline:Symbol("outline-visual"),regularVertices:Symbol("regular-vertices-visual"),activeVertex:Symbol("active-vertex-visual"),activeEdge:Symbol("active-edge-visual")};function F(t){switch(t){case"point":case"polyline":case"polygon":case"multipoint":return t;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const M=48;export{E as DrawGraphicTool,F as geometryTypeToDrawOperationGeometryType};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import e from"../../../Graphic.js";import 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{create as p}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as _}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as d}from"../../../geometry/support/coordsUtils.js";import m from"../../../geometry/support/rotate.js";import u from"../../../symbols/SimpleFillSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import y from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as v,scale as f,getRotationAngle as G,getScaleRatio as b}from"./drawUtils.js";import x from"./GraphicMover.js";import w from"./HighlightHelper.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as k}from"./settings.js";import R from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as M}from"../../interactive/tooltip/Tooltip.js";import{ExtentRotateTooltipInfo as I}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as H}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as C}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{autoDistanceBetweenPoints2D as O}from"../../support/automaticLengthMeasurementUtils.js";import{autoSize2D as j}from"../../support/extentUtils.js";import T from"../../../geometry/Point.js";import E from"../../../geometry/Polygon.js";import L from"../../../geometry/Polyline.js";class z{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class B{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class Y{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class N{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-start"}}class U{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate"}}class A{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-stop"}}class P{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-start"}}class X{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale"}}class F{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-stop"}}const D=k.transformGraphics,V={centerIndicator:new y({style:"cross",size:D.center.size,color:D.center.color}),fill:{default:new u({color:D.fill.color,outline:{color:D.fill.outlineColor,join:"round",width:1}}),active:new u({color:D.fill.stagedColor,outline:{color:D.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new y({style:"square",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new y({style:"square",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotator:{default:new y({style:"circle",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new y({style:"circle",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotatorLine:new g({color:D.line.color,width:1})};let q=class extends i.EventedAccessor{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.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=V,this.sketchOptions=new R,this.view=null,this._getBounds=(()=>{const t=p();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=d(s);[i,o,r,a]=_(t,[e])}else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=d(s);[i,o,r,a]=_(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 w({view:t}),this._setup(),this.addHandles([r((()=>t?.ready),(()=>{const{layer:t,view:e}=this;S(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._highlightHelper?.removeAll(),this._setUpHighlights()})),a((()=>this.sketchOptions.tooltips.effectiveEnabled),(e=>{this.tooltip=e?M((()=>({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=v(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",new Y(this.graphics,null,t,e))}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=f(s,t,e);i.geometry=o}this.refresh(),this.emit("scale-stop",new F(this.graphics,null,t,e))}}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 T(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=m(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",new A(this.graphics,null,t))}}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&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_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.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new x({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)}})}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(p()),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(p(),[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}=this,c=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(c),this._updateTooltip(c,t.viewEvent),c===a?(this.view.cursor="grabbing",this.emit("rotate-start",new N(this.graphics,c,e))):r.includes(c)?(this._activeHandleGraphic=c,this.emit("scale-start",new P(this.graphics,c,i,s))):this.emit("move-start",new z(this.graphics,c,t.dx,t.dy))}_onGraphicMoveCallback(t){const e=t.graphic;if(this._startInfo)if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",new X(this.graphics,e,this._xScale,this._yScale));else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",new U(this.graphics,e,this._angleOfRotation));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",new B(this.graphics,e,i,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}=this;this.refresh(),e===c?(this.view.cursor="pointer",this.emit("rotate-stop",new A(this.graphics,e,i))):h.includes(e)?this.emit("scale-stop",new F(this.graphics,e,r,a)):this.emit("move-stop",new Y(this.graphics,e,s,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,a.cursor="pointer",void this._updateTooltip(h);if(s.includes(h)||h===e)return void(a.cursor="move");if(!i.includes(h))return void(a.cursor="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"}a.cursor=n}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s,view:o}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),o.cursor="default",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:p}=e,{resolution:_,transform:d}=o.state,m=i.indexOf(t);1!==m&&5!==m||this._updateX(t,r),3!==m&&7!==m||this._updateY(t,a);const{x:u,y:g}=t.geometry,y=d[0]*u+d[2]*g+d[4],G=d[1]*u+d[3]*g+d[5],x=h?.map((t=>t.geometry))??[],w=x.every((t=>"point"===t.type));if((0===p||0===c)&&w){const t=J((u-n)/_),i=J((l-g)/_);for(let e=0;e<x.length;e++)this.graphics[e].geometry=v(x[e],t,i,o,!0);return this._centerGraphic.geometry=new T(u,g,o.spatialReference),void(this._backgroundGraphic.geometry=v(e.box,t,i,o,!0))}if(s){const t=J(d[0]*r+d[2]*a+d[4],2),e=J(d[1]*r+d[3]*a+d[5],2),i=J(d[0]*n+d[2]*l+d[4],2),s=J(d[1]*n+d[3]*l+d[5],2);let o=b(t,e,i,s,y,G);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of x){const t=x.indexOf(h);this.graphics[t].geometry=f(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=u-n,i=l-g;if(1===m||5===m?t=0:3!==m&&7!==m||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let d=(p+(n>r?t:-1*t))/p,y=(c+(l<a?i:-1*i))/c;1!==m&&5!==m&&0!==d&&Math.abs(d)!==1/0||(d=1),3!==m&&7!==m&&0!==y&&Math.abs(y)!==1/0||(y=1),this._xScale=d,this._yScale=y;const G=(s-r)/_,b=(h-a)/_,w=f(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=v(w,G,b,o,!0);const{centerX:S,centerY:k}=this._getGraphicInfo(this._backgroundGraphic),R=(S-r)/_,M=-1*(k-a)/_;for(const e of x){const t=x.indexOf(e),i=f(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=v(i,R,M,o,!0)}this._centerGraphic.geometry=new T(S,k,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 T(s,o,h),n=new T(e,i,h),l=t.geometry;this._angleOfRotation=G(c,l,n);const p=this._startInfo.graphicInfos?.map((t=>t.geometry))??[];for(const _ of p){const t=p.indexOf(_),e=m(_,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=m(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=m(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=v(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=v(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=v(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=v(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics)}_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 E({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(p()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new T(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 T(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 L({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new T(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new T(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new T(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(p());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 I({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o}=this;if(null==t)return;const r=this._getCoordinates(),a=j({topLeft:r[0],topRight:r[1],bottomRight:r[2],bottomLeft:r[3],spatialReference:o.spatialReference});if(null==a)return;const{xSize:h,ySize:c}=a,n=Math.abs(e),l=Math.abs(i);t.info=new H({sketchOptions:s,xScale:n,yScale:l,xSize:h,ySize:c})}_updateMoveTooltip(t){const{tooltip:e,sketchOptions:i,view:s}=this;if(null==e)return;const r=new C({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,a=s.toMap(t),h=s.toMap({x:e,y:i}),c=O(h,a);r.distance=null!=c?c:o}e.info=r}};function J(t,e=2){return Number.parseFloat(t.toFixed(e))}t([n()],q.prototype,"tooltip",void 0),t([n({readOnly:!0})],q.prototype,"type",void 0),t([n()],q.prototype,"callbacks",void 0),t([n()],q.prototype,"enableMovement",void 0),t([n()],q.prototype,"enableRotation",void 0),t([n()],q.prototype,"enableScaling",void 0),t([n()],q.prototype,"graphics",void 0),t([n()],q.prototype,"highlightsEnabled",void 0),t([n()],q.prototype,"layer",void 0),t([n()],q.prototype,"preserveAspectRatio",void 0),t([n()],q.prototype,"showCenterGraphic",void 0),t([n({readOnly:!0})],q.prototype,"state",null),t([n()],q.prototype,"symbols",void 0),t([n({type:R})],q.prototype,"sketchOptions",void 0),t([n({constructOnly:!0})],q.prototype,"view",void 0),q=t([l("esri.views.draw.support.Box")],q);const K=q;export{K as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import e from"../../../Graphic.js";import 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{create as p}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as _}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as d}from"../../../geometry/support/coordsUtils.js";import m from"../../../geometry/support/rotate.js";import u from"../../../symbols/SimpleFillSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import y from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as v,scale as f,getRotationAngle as G,getScaleRatio as b}from"./drawUtils.js";import x from"./GraphicMover.js";import w from"./HighlightHelper.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as k}from"./settings.js";import R from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as M}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as I}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as C}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as H}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{autoDistanceBetweenPoints2D as O}from"../../support/automaticLengthMeasurementUtils.js";import{autoSize2D as j}from"../../support/extentUtils.js";import T from"../../../geometry/Point.js";import E from"../../../geometry/Polygon.js";import L from"../../../geometry/Polyline.js";class z{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class B{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class Y{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class N{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-start"}}class U{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate"}}class A{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-stop"}}class P{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-start"}}class X{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale"}}class F{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-stop"}}const D=k.transformGraphics,V={centerIndicator:new y({style:"cross",size:D.center.size,color:D.center.color}),fill:{default:new u({color:D.fill.color,outline:{color:D.fill.outlineColor,join:"round",width:1}}),active:new u({color:D.fill.stagedColor,outline:{color:D.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new y({style:"square",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new y({style:"square",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotator:{default:new y({style:"circle",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new y({style:"circle",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotatorLine:new g({color:D.line.color,width:1})};let q=class extends i.EventedAccessor{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.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=V,this.sketchOptions=new R,this.view=null,this._getBounds=(()=>{const t=p();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=d(s);[i,o,r,a]=_(t,[e])}else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=d(s);[i,o,r,a]=_(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 w({view:t}),this._setup(),this.addHandles([r((()=>t?.ready),(()=>{const{layer:t,view:e}=this;S(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._highlightHelper?.removeAll(),this._setUpHighlights()})),a((()=>this.sketchOptions.tooltips.effectiveEnabled),(e=>{this.tooltip=e?M((()=>({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=v(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",new Y(this.graphics,null,t,e))}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=f(s,t,e);i.geometry=o}this.refresh(),this.emit("scale-stop",new F(this.graphics,null,t,e))}}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 T(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=m(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",new A(this.graphics,null,t))}}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&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_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.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new x({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)}})}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(p()),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(p(),[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}=this,c=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(c),this._updateTooltip(c,t.viewEvent),c===a?(this.view.cursor="grabbing",this.emit("rotate-start",new N(this.graphics,c,e))):r.includes(c)?(this._activeHandleGraphic=c,this.emit("scale-start",new P(this.graphics,c,i,s))):this.emit("move-start",new z(this.graphics,c,t.dx,t.dy))}_onGraphicMoveCallback(t){const e=t.graphic;if(this._startInfo)if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",new X(this.graphics,e,this._xScale,this._yScale));else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",new U(this.graphics,e,this._angleOfRotation));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",new B(this.graphics,e,i,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}=this;this.refresh(),e===c?(this.view.cursor="pointer",this.emit("rotate-stop",new A(this.graphics,e,i))):h.includes(e)?this.emit("scale-stop",new F(this.graphics,e,r,a)):this.emit("move-stop",new Y(this.graphics,e,s,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,a.cursor="pointer",void this._updateTooltip(h);if(s.includes(h)||h===e)return void(a.cursor="move");if(!i.includes(h))return void(a.cursor="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"}a.cursor=n}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s,view:o}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),o.cursor="default",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:p}=e,{resolution:_,transform:d}=o.state,m=i.indexOf(t);1!==m&&5!==m||this._updateX(t,r),3!==m&&7!==m||this._updateY(t,a);const{x:u,y:g}=t.geometry,y=d[0]*u+d[2]*g+d[4],G=d[1]*u+d[3]*g+d[5],x=h?.map((t=>t.geometry))??[],w=x.every((t=>"point"===t.type));if((0===p||0===c)&&w){const t=J((u-n)/_),i=J((l-g)/_);for(let e=0;e<x.length;e++)this.graphics[e].geometry=v(x[e],t,i,o,!0);return this._centerGraphic.geometry=new T(u,g,o.spatialReference),void(this._backgroundGraphic.geometry=v(e.box,t,i,o,!0))}if(s){const t=J(d[0]*r+d[2]*a+d[4],2),e=J(d[1]*r+d[3]*a+d[5],2),i=J(d[0]*n+d[2]*l+d[4],2),s=J(d[1]*n+d[3]*l+d[5],2);let o=b(t,e,i,s,y,G);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of x){const t=x.indexOf(h);this.graphics[t].geometry=f(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=u-n,i=l-g;if(1===m||5===m?t=0:3!==m&&7!==m||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let d=(p+(n>r?t:-1*t))/p,y=(c+(l<a?i:-1*i))/c;1!==m&&5!==m&&0!==d&&Math.abs(d)!==1/0||(d=1),3!==m&&7!==m&&0!==y&&Math.abs(y)!==1/0||(y=1),this._xScale=d,this._yScale=y;const G=(s-r)/_,b=(h-a)/_,w=f(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=v(w,G,b,o,!0);const{centerX:S,centerY:k}=this._getGraphicInfo(this._backgroundGraphic),R=(S-r)/_,M=-1*(k-a)/_;for(const e of x){const t=x.indexOf(e),i=f(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=v(i,R,M,o,!0)}this._centerGraphic.geometry=new T(S,k,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 T(s,o,h),n=new T(e,i,h),l=t.geometry;this._angleOfRotation=G(c,l,n);const p=this._startInfo.graphicInfos?.map((t=>t.geometry))??[];for(const _ of p){const t=p.indexOf(_),e=m(_,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=m(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=m(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=v(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=v(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=v(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=v(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics)}_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 E({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(p()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new T(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 T(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 L({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new T(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new T(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new T(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(p());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 I({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o}=this;if(null==t)return;const r=this._getCoordinates(),a=j({topLeft:r[0],topRight:r[1],bottomRight:r[2],bottomLeft:r[3],spatialReference:o.spatialReference});if(null==a)return;const{xSize:h,ySize:c}=a,n=Math.abs(e),l=Math.abs(i);t.info=new C({sketchOptions:s,xScale:n,yScale:l,xSize:h,ySize:c})}_updateMoveTooltip(t){const{tooltip:e,sketchOptions:i,view:s}=this;if(null==e)return;const r=new H({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,a=s.toMap(t),h=s.toMap({x:e,y:i}),c=O(h,a);r.distance=null!=c?c:o}e.info=r}};function J(t,e=2){return Number.parseFloat(t.toFixed(e))}t([n()],q.prototype,"tooltip",void 0),t([n({readOnly:!0})],q.prototype,"type",void 0),t([n()],q.prototype,"callbacks",void 0),t([n()],q.prototype,"enableMovement",void 0),t([n()],q.prototype,"enableRotation",void 0),t([n()],q.prototype,"enableScaling",void 0),t([n()],q.prototype,"graphics",void 0),t([n()],q.prototype,"highlightsEnabled",void 0),t([n()],q.prototype,"layer",void 0),t([n()],q.prototype,"preserveAspectRatio",void 0),t([n()],q.prototype,"showCenterGraphic",void 0),t([n({readOnly:!0})],q.prototype,"state",null),t([n()],q.prototype,"symbols",void 0),t([n({type:R})],q.prototype,"sketchOptions",void 0),t([n({constructOnly:!0})],q.prototype,"view",void 0),q=t([l("esri.views.draw.support.Box")],q);const K=q;export{K 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";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 r from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{destroyMaybe as h,assertIsSome as a,abortMaybe as p}from"../../../core/maybe.js";import{pausable as c,when as l,watch as d,sync as m,initial 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{closeRingsAndFixWinding as g,getMidpoint as u,geometryToCoordinates as f}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import G from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as b}from"../../ViewingMode.js";import{SnappingVisualizer2D as V}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as M}from"./drawUtils.js";import S from"./GraphicMover.js";import w from"./HighlightHelper.js";import{addUniqueLayer as E}from"./layerUtils.js";import{createTooltipInfos as I,connectTooltip as O,updateTranslateTooltipInfo as k,updateTranslateVertexTooltipInfo as T}from"./reshapeTooltipUtils.js";import{settings as C}from"./settings.js";import{ViewEventPriorities as H}from"../../input/InputManager.js";import{createCoordinateHelper as j}from"../../interactive/coordinateHelper.js";import{sketchKeys as R}from"../../interactive/keybindings.js";import{EditGeometryOperations as A}from"../../interactive/editGeometry/EditGeometryOperations.js";import U from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as L}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as z}from"../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as D}from"../../interactive/tooltip/tooltipCommonUtils.js";import F from"../../../geometry/Polyline.js";import P from"../../../geometry/Point.js";class Z{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class X{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class Y{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class K{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class N{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class q{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class B{constructor(e){this.added=e,this.type="vertex-select"}}class J{constructor(e){this.removed=e,this.type="vertex-deselect"}}class Q{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class W{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const $=C.reshapeGraphics,ee={vertices:{default:new G({style:"circle",size:$.vertex.size,color:$.vertex.color,outline:{color:$.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:$.vertex.hoverSize,color:$.vertex.hoverColor,outline:{color:$.vertex.hoverOutlineColor,width:1}}),selected:new G({style:"circle",size:$.selected.size,color:$.selected.color,outline:{color:$.selected.outlineColor,width:1}})},midpoints:{default:new G({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}}),hover:new G({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}})}};let te=class extends r.EventedAccessor{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=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.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new s,this.midpointSymbol=new G({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=new s,this.snappingManager=null,this.symbols=ee,this.sketchOptions=new U,this.type="reshape",this.vertexGraphics=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new w({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,h=n.concat(r).items;i&&h.push(o),s?.set("graphics",h)}),m),this.tooltip=z((()=>({view:e,options:this.sketchOptions.tooltips}))),this.tooltipInfos=I(this.sketchOptions),this.addHandles([l((()=>e?.ready),(()=>{const{layer:e,view:t}=this;E(t,e),this.addHandles(t.on("key-down",(e=>this._keyDownHandler(e)),H.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.enableMidpoints),(()=>this.refresh())),O(this.tooltip,(()=>this._tooltipsContext)),d((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),v),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this.tooltip=h(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??j(!!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(){return{sketchOptions:this.sketchOptions,activeTooltipInfo:this.activeTooltipInfo,graphic:this.graphic,selectedVertex:this._selectedVertex,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=h(this._editGeometryOperations)}}}set highlightsEnabled(e){this._highlightHelper?.removeAll(),this._set("highlightsEnabled",e),this._setUpHighlights()}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&&g(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic)}_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 F({paths:[e.points],spatialReference:e.spatialReference}):e;this._editGeometryOperations=A.fromGeometry(t,b.Local)}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;a(i),this._snappingContext=new L({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&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_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=h(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=ie(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 h=(e+1)%n.length;if("polyline"===this.graphic.geometry?.type&&0===h)continue;const a=n[e],p=n[h],c=this._getMidpoint(a,p);o.push(new t({geometry:c,symbol:s.midpoints.default,attributes:{...i,pathIndex:r,pointIndexStart:e,pointIndexEnd:h}}))}}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 S({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)}})}_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;if(s===this.graphic){const{geometry:o}=s;return this._setUpOperation(e),this._emitMoveStartEvent(t,i),void(null!=o&&"point"===o.type&&this._onHandleMove(s,t,i,e,(()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,i)})))}if(!this.selectedVertices.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),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=ie(n);this._updateVertexGraphicLocations(t),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._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),[h,a,p]=u(r,n),c=i.hasM()?0:void 0;return new P({x:h,y:a,z:p,m:c,spatialReference:i.spatialReference})}_getVertexFromEditGeometry(e){const[t,i]=se(e);return a(this._editGeometryOperations),this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const h=e.geometry,a="graphic-move-stop"===o.type;if(null!=this.snappingManager&&this.selectedVertices.length<2&&!a){const o=this.snappingManager;this._stagedVertex=o.update({point:h,context:n}),this._syncGeometryAfterVertexMove(e,new P(this._stagedVertex),t,s,a),r(),this._snappingTask=i((async i=>{const p=await o.snap({point:h,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(e,new P(this._stagedVertex),t,s,a),r())}))}else{const i=null!=this._stagedVertex?new P(this._stagedVertex):h;this._syncGeometryAfterVertexMove(e,i,t,s,a),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,[h,a]=se(e);let p=f(r);const c=p[h].length-1,l=n.pointToArray(t);p[h][a]=l,"polygon"===r.type&&(0===a?p[h][c]=l:a===c&&(p[h][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),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:h}=r.attributes,a=M(r.geometry,i,s,this.view),p=f(a),c=e[t].length-1;e[t][n]=p,r.geometry=a,o&&(0===n?e[t][c]=p:n===c&&(e[t][0]=p));for(const i of h){const t=this.vertexGraphics.at(i),{pathIndex:s,pointIndex:o}=t.attributes;e[s][o]=p,t.geometry=a}}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.view.cursor="default",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:h,pointIndexEnd:a}=e.attributes,p=f(e.geometry),c=0===a?h+1:a,l=f(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=oe(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&&D(e,this.tooltip)||R.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=f(s);const r=[],n=oe(e);for(const h of n){const{x:e,y:t}=h.geometry;for(let i=0;i<o.length;i++){const s=o[i];for(let n=0;n<s.length;n++){const[h,a]=s[n];e===h&&t===a&&(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){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_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,k(i,o,t)):e&&this.selectedVertices.length>1&&(i=r.translateVertices,T(i,o,n,t)),this.activeTooltipInfo=i}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){const i=new K(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(e,t){const i=new N(this.graphic,e,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=new q(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(e){const t=new Z(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape-start",t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){const t=new X(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape",t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){const t=new Y(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape-stop",t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){const t=new B(e);this.emit("select",t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){const t=new J(e);this.emit("deselect",t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,i){const s=new Q(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(e,t,i){const s=new W(e,this.graphic,t,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 ie(e){const t=f(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 se({attributes:e}){return[e?.pathIndex||0,e?.pointIndex||0]}function oe(e){return e instanceof t?[e]:[...e]}e([y()],te.prototype,"_activeOperationInfo",void 0),e([y()],te.prototype,"_coordinateHelper",null),e([y()],te.prototype,"_editGeometryOperations",void 0),e([y()],te.prototype,"tooltip",void 0),e([y()],te.prototype,"tooltipInfos",void 0),e([y()],te.prototype,"activeTooltipInfo",void 0),e([y()],te.prototype,"_selectedVertex",null),e([y()],te.prototype,"_tooltipsContext",null),e([y()],te.prototype,"callbacks",void 0),e([y()],te.prototype,"enableMidpoints",void 0),e([y()],te.prototype,"enableMovement",void 0),e([y()],te.prototype,"enableVertices",void 0),e([y()],te.prototype,"graphic",void 0),e([y({value:!0})],te.prototype,"highlightsEnabled",null),e([y()],te.prototype,"layer",void 0),e([y({readOnly:!0})],te.prototype,"midpointGraphics",void 0),e([y()],te.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],te.prototype,"selectedVertices",void 0),e([y()],te.prototype,"snappingManager",void 0),e([y({readOnly:!0})],te.prototype,"state",null),e([y()],te.prototype,"symbols",void 0),e([y({type:U})],te.prototype,"sketchOptions",void 0),e([y({readOnly:!0})],te.prototype,"type",void 0),e([y({readOnly:!0})],te.prototype,"vertexGraphics",void 0),e([y()],te.prototype,"view",void 0),te=e([_("esri.views.draw.support.Reshape")],te);const re=te;export{re as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";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 r from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{destroyMaybe as h,assertIsSome as a,abortMaybe as p}from"../../../core/maybe.js";import{pausable as c,when as l,watch as d,sync as m,initial 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{closeRingsAndFixWinding as g,getMidpoint as u,geometryToCoordinates as f}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import G from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as b}from"../../ViewingMode.js";import{SnappingVisualizer2D as V}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as M}from"./drawUtils.js";import S from"./GraphicMover.js";import w from"./HighlightHelper.js";import{addUniqueLayer as E}from"./layerUtils.js";import{createTooltipInfos as I,connectTooltip as O,updateTranslateTooltipInfo as k,updateTranslateVertexTooltipInfo as T}from"./reshapeTooltipUtils.js";import{settings as C}from"./settings.js";import{ViewEventPriorities as H}from"../../input/InputManager.js";import{createCoordinateHelper as j}from"../../interactive/coordinateHelper.js";import{sketchKeys as R}from"../../interactive/keybindings.js";import{EditGeometryOperations as A}from"../../interactive/editGeometry/EditGeometryOperations.js";import U from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as L}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as z,enterInputModeIfAvailable as D}from"../../interactive/tooltip/tooltipCommonUtils.js";import F from"../../../geometry/Polyline.js";import P from"../../../geometry/Point.js";class Z{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class X{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class Y{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class K{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class N{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class q{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class B{constructor(e){this.added=e,this.type="vertex-select"}}class J{constructor(e){this.removed=e,this.type="vertex-deselect"}}class Q{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class W{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const $=C.reshapeGraphics,ee={vertices:{default:new G({style:"circle",size:$.vertex.size,color:$.vertex.color,outline:{color:$.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:$.vertex.hoverSize,color:$.vertex.hoverColor,outline:{color:$.vertex.hoverOutlineColor,width:1}}),selected:new G({style:"circle",size:$.selected.size,color:$.selected.color,outline:{color:$.selected.outlineColor,width:1}})},midpoints:{default:new G({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}}),hover:new G({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}})}};let te=class extends r.EventedAccessor{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=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.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new s,this.midpointSymbol=new G({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=new s,this.snappingManager=null,this.symbols=ee,this.sketchOptions=new U,this.type="reshape",this.vertexGraphics=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new w({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,h=n.concat(r).items;i&&h.push(o),s?.set("graphics",h)}),m),this.tooltip=z((()=>({view:e,options:this.sketchOptions.tooltips}))),this.tooltipInfos=I(this.sketchOptions),this.addHandles([l((()=>e?.ready),(()=>{const{layer:e,view:t}=this;E(t,e),this.addHandles(t.on("key-down",(e=>this._keyDownHandler(e)),H.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.enableMidpoints),(()=>this.refresh())),O(this.tooltip,(()=>this._tooltipsContext)),d((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),v),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this.tooltip=h(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??j(!!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(){return{sketchOptions:this.sketchOptions,activeTooltipInfo:this.activeTooltipInfo,graphic:this.graphic,selectedVertex:this._selectedVertex,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=h(this._editGeometryOperations)}}}set highlightsEnabled(e){this._highlightHelper?.removeAll(),this._set("highlightsEnabled",e),this._setUpHighlights()}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&&g(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic)}_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 F({paths:[e.points],spatialReference:e.spatialReference}):e;this._editGeometryOperations=A.fromGeometry(t,b.Local)}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;a(i),this._snappingContext=new L({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&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_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=h(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=ie(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 h=(e+1)%n.length;if("polyline"===this.graphic.geometry?.type&&0===h)continue;const a=n[e],p=n[h],c=this._getMidpoint(a,p);o.push(new t({geometry:c,symbol:s.midpoints.default,attributes:{...i,pathIndex:r,pointIndexStart:e,pointIndexEnd:h}}))}}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 S({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)}})}_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;if(s===this.graphic){const{geometry:o}=s;return this._setUpOperation(e),this._emitMoveStartEvent(t,i),void(null!=o&&"point"===o.type&&this._onHandleMove(s,t,i,e,(()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,i)})))}if(!this.selectedVertices.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),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=ie(n);this._updateVertexGraphicLocations(t),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._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),[h,a,p]=u(r,n),c=i.hasM()?0:void 0;return new P({x:h,y:a,z:p,m:c,spatialReference:i.spatialReference})}_getVertexFromEditGeometry(e){const[t,i]=se(e);return a(this._editGeometryOperations),this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const h=e.geometry,a="graphic-move-stop"===o.type;if(null!=this.snappingManager&&this.selectedVertices.length<2&&!a){const o=this.snappingManager;this._stagedVertex=o.update({point:h,context:n}),this._syncGeometryAfterVertexMove(e,new P(this._stagedVertex),t,s,a),r(),this._snappingTask=i((async i=>{const p=await o.snap({point:h,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(e,new P(this._stagedVertex),t,s,a),r())}))}else{const i=null!=this._stagedVertex?new P(this._stagedVertex):h;this._syncGeometryAfterVertexMove(e,i,t,s,a),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,[h,a]=se(e);let p=f(r);const c=p[h].length-1,l=n.pointToArray(t);p[h][a]=l,"polygon"===r.type&&(0===a?p[h][c]=l:a===c&&(p[h][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),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:h}=r.attributes,a=M(r.geometry,i,s,this.view),p=f(a),c=e[t].length-1;e[t][n]=p,r.geometry=a,o&&(0===n?e[t][c]=p:n===c&&(e[t][0]=p));for(const i of h){const t=this.vertexGraphics.at(i),{pathIndex:s,pointIndex:o}=t.attributes;e[s][o]=p,t.geometry=a}}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.view.cursor="default",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:h,pointIndexEnd:a}=e.attributes,p=f(e.geometry),c=0===a?h+1:a,l=f(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=oe(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&&D(e,this.tooltip)||R.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=f(s);const r=[],n=oe(e);for(const h of n){const{x:e,y:t}=h.geometry;for(let i=0;i<o.length;i++){const s=o[i];for(let n=0;n<s.length;n++){const[h,a]=s[n];e===h&&t===a&&(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){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_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,k(i,o,t)):e&&this.selectedVertices.length>1&&(i=r.translateVertices,T(i,o,n,t)),this.activeTooltipInfo=i}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){const i=new K(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(e,t){const i=new N(this.graphic,e,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=new q(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(e){const t=new Z(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape-start",t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){const t=new X(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape",t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){const t=new Y(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape-stop",t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){const t=new B(e);this.emit("select",t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){const t=new J(e);this.emit("deselect",t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,i){const s=new Q(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(e,t,i){const s=new W(e,this.graphic,t,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 ie(e){const t=f(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 se({attributes:e}){return[e?.pathIndex||0,e?.pointIndex||0]}function oe(e){return e instanceof t?[e]:[...e]}e([y()],te.prototype,"_activeOperationInfo",void 0),e([y()],te.prototype,"_coordinateHelper",null),e([y()],te.prototype,"_editGeometryOperations",void 0),e([y()],te.prototype,"tooltip",void 0),e([y()],te.prototype,"tooltipInfos",void 0),e([y()],te.prototype,"activeTooltipInfo",void 0),e([y()],te.prototype,"_selectedVertex",null),e([y()],te.prototype,"_tooltipsContext",null),e([y()],te.prototype,"callbacks",void 0),e([y()],te.prototype,"enableMidpoints",void 0),e([y()],te.prototype,"enableMovement",void 0),e([y()],te.prototype,"enableVertices",void 0),e([y()],te.prototype,"graphic",void 0),e([y({value:!0})],te.prototype,"highlightsEnabled",null),e([y()],te.prototype,"layer",void 0),e([y({readOnly:!0})],te.prototype,"midpointGraphics",void 0),e([y()],te.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],te.prototype,"selectedVertices",void 0),e([y()],te.prototype,"snappingManager",void 0),e([y({readOnly:!0})],te.prototype,"state",null),e([y()],te.prototype,"symbols",void 0),e([y({type:U})],te.prototype,"sketchOptions",void 0),e([y({readOnly:!0})],te.prototype,"type",void 0),e([y({readOnly:!0})],te.prototype,"vertexGraphics",void 0),e([y()],te.prototype,"view",void 0),te=e([_("esri.views.draw.support.Reshape")],te);const re=te;export{re as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import Tooltip = __esri.Tooltip;
4
+ export default Tooltip;
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
+ */
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{on as o}from"../../core/events.js";import{destroyMaybe as i}from"../../core/maybe.js";import{watch as n,when as s,syncAndInitial as r,initial as c,sync as l}from"../../core/reactiveUtils.js";import{cloneScreenPoint as p,createScreenPoint as a}from"../../core/screenUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{setCalciteThemeClass as d}from"../../support/themeUtils.js";import{base as f}from"./tooltip/css.js";import{tooltipContentFactory as m}from"./tooltip/content/tooltipContentFactory.js";import{isRTL as v}from"../../widgets/support/widgetUtils.js";const y={base:`${f}`,ltr:`${f}--ltr`,rtl:`${f}--rtl`,debug:`${f}--debug`},g=20,_=16,b="bottom-end";let C=class extends e.EventedAccessor{constructor(t){super(t),this.info=null,this.options=null,this.position=null,this.content=null,this._focused=!1,this.outerContainer=document.createElement("div"),this.debug=!1,this._lastPosition=null,this._rtl=!1,this._prevXY=[0,0]}initialize(){const{outerContainer:t}=this;this.addHandles([n((()=>this.view.overlay?.surface),(e=>{t.remove(),e?.appendChild(t),this._rtl=v(e)}),r),n((()=>this.info),((e,o)=>{if(null!=this.content&&null!=e&&null!=o&&e.type===o.type)this.content.info=e;else{i(this.content);const o=m(this,e);o?(this.content=o,o.container&&t.appendChild(o.container),this.exitInputMode()):this.content=null}}),r),n((()=>({container:this.outerContainer,content:this.content,screenPoint:this._screenPoint,position:this.position})),(()=>this._updatePosition()),c),n((()=>({outerContainer:this.outerContainer,placement:this.effectivePlacement,effectiveOffset:this.effectiveOffset,rtl:this._rtl,debug:this.debug})),(({outerContainer:t,placement:e,effectiveOffset:o,rtl:i,debug:n})=>{const{classList:s}=t;s.add(y.base),s.toggle(y.rtl,i),s.toggle(y.ltr,!i),s.toggle(y.debug,n),this.outerContainer.style.setProperty("--offset",`${o}px`),d(t),O(t,e)}),c),s((()=>"feedback"===this.mode),(()=>{this.position=null,this._clearOverride("effectivePlacement")}),l),o(this.outerContainer,"paste",(t=>{this.emit("paste",t)})),o(this.outerContainer,["focusin","focusout"],(()=>{setTimeout((()=>{this._focused=this.content?.container?.contains(document.activeElement)??!1}))}))])}destroy(){this.info=null,this.content=i(this.content),this.outerContainer.remove()}get mode(){return this.content?.mode??"feedback"}get focused(){return this._focused}get visible(){return"none"!==this.outerContainer?.style.display}get contentContainer(){return this.content?.container}get effectivePlacement(){const t=this.options?.placement;return"auto"===t?"bottom-end":t??b}get _screenPoint(){const{inputManager:t}=this.view;return t?.multiTouchActive?null:t?.latestPointerLocation}get effectiveOffset(){return this.options?.offset??g}clear(){this.info=null}async enterInputMode(t){const e=this.position??this._lastPosition??this._screenPoint,o=this.position=p(e),{effectivePlacement:i}=this;this._override("effectivePlacement",i);const n=()=>{o&&(this.position=P(this.contentContainer,o,this.effectiveOffset,this.view),this._updatePosition())};await(this.content?.enterInputMode(t,n))}async exitInputMode(t){await(this.content?.exitInputMode(t))}onDragStart(t,e){this._prevXY=[t,e]}onDrag(t,e){const o=t-this._prevXY[0],i=e-this._prevXY[1];this._prevXY=[t,e];const{position:n}=this;if(n){const{view:s}=this,r=t-s.position[0],c=e-s.position[1];if(r<0||r>s.width||c<0||c>s.height-_)return;this.position=a(n.x+o,n.y+i)}}onDragEnd(){this._prevXY=[0,0]}_updatePosition(){const{style:t}=this.outerContainer,e=this.position??this._screenPoint;if(this._lastPosition=p(e),null!=e&&null!=this.content){t.display="block";const o=Math.round(e.x),i=Math.round(e.y);t.transform=`translate(${o}px, ${i}px)`}else t.display="none"}};function P(t,e,o,i){if(!t||!i.container)return e;const n=t.getBoundingClientRect(),{left:s,top:r}=i.container.getBoundingClientRect();let{x:c,y:l}=e;const p=n.left-s-o;p<0&&(c-=p);const h=n.right-s+o-i.width;h>0&&(c-=h);const u=n.top-r-o;u<0&&(l-=u);const d=n.bottom-r+o-i.height;return d>0&&(l-=d),a(c,l)}t([h({nonNullable:!0})],C.prototype,"view",void 0),t([h()],C.prototype,"info",void 0),t([h()],C.prototype,"options",void 0),t([h()],C.prototype,"position",void 0),t([h()],C.prototype,"content",void 0),t([h({readOnly:!0})],C.prototype,"mode",null),t([h()],C.prototype,"_focused",void 0),t([h({readOnly:!0})],C.prototype,"focused",null),t([h({readOnly:!0})],C.prototype,"outerContainer",void 0),t([h({readOnly:!0})],C.prototype,"contentContainer",null),t([h({readOnly:!0})],C.prototype,"effectivePlacement",null),t([h()],C.prototype,"debug",void 0),t([h()],C.prototype,"_lastPosition",void 0),t([h()],C.prototype,"_screenPoint",null),t([h()],C.prototype,"_rtl",void 0),t([h()],C.prototype,"effectiveOffset",null),C=t([u("esri.views.interactive.Tooltip")],C);const j=["top","bottom","leading","trailing"].flatMap((t=>[w(`${t}-start`),w(t),w(`${t}-end`)]));function w(t){return`${y.base}--${t}`}function O({classList:t},e){j.forEach((e=>t.remove(e))),t.add(w(e))}const x=C;export{x 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{createTask as t}from"../../../core/asyncUtils.js";import{handlesGroup as e,makeHandle as o}from"../../../core/handleUtils.js";import{floatEqualUlp as n}from"../../../core/mathUtils.js";import{createAngle as r,createScalar as a,valueInUnit as l}from"../../../core/quantityUtils.js";import{verticalLengthUnitFromSpatialReference as i}from"../../../core/unitUtils.js";import{k as s,j as u,H as c}from"../../../chunks/vec32.js";import{clone as p,ONES as f,create as m,UNIT_Z as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoaded as g,load as d}from"../../../geometry/coordinateFormatter.js";import x from"../../../geometry/Point.js";import v from"../../../geometry/support/MeshTransform.js";import{isRelativeVertexSpace as j}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isWebMercator as b}from"../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as S}from"../../../geometry/support/webMercatorUtils.js";import{tooltipKeys as h}from"../keybindings.js";import{parseLatitudeLongitude as U,parseXY as M}from"./fields/parsingAndFormattingUtils.js";import{getDegreesArithmetic as z,getDegreesGeographic as A}from"../../support/angularMeasurementUtils.js";function R(t,e){const o=j(e.vertexSpace),{scale:n,orientation:l}=t,{transform:i}=e,s=I(i);o&&null!=s?(l.actual=r(s,"degrees","arithmetic"),l.visible=!0):(l.actual=null,l.visible=!1),o?(n.actual=a(H(i)),n.visible=!0):(n.actual=null,n.visible=!1)}function k(t,e,o){if(!e||!j(e.vertexSpace))return;const n=e.transform??=new v;w(t,n,o),P(t,n,o)}function w(t,e,o){const n=z(t.orientation.actual),r=q(e.rotationAxis);if(null==n||null==r)return;const a=e.rotationAngle,l=n*r,i=(n-a)*r;a!==l&&(o?.onRotateStart(0),e.rotationAngle=l,o?.onRotate(i),o?.onRotateStop(i))}function P(t,e,o){const n=t.scale.actual?.value,r=H(e);if(null==n||n===r)return;const{scale:a}=e;let l;if(0===r)l=p(f);else{const t=n/r;l=u(m(),a,t)}o?.onScaleStart(a[0],a[1],a[2]),e.scale=l,o?.onScale(l[0],l[1],l[2]),o?.onScaleStop(l[0],l[1],l[2])}function V(t,e,o){if(!e||!j(e.vertexSpace))return;const{origin:n,spatialReference:r}=e,{x:a,y:l,z:i}=F(t,r),{dx:s,dy:u,dz:c}=D(t,n);0===s&&0===u&&0===c||(o.onMoveStart(),e.centerAt(new x({x:a??n.x,y:l??n.y,z:i??n.z,spatialReference:r})),o.onMove(s,u,c),o.onMoveStop())}function D(t,e){const{x:o,y:r,z:a}=e,{x:l,y:i,z:s}=F(t,e.spatialReference);return{dx:null==l||n(l,o)?0:l-o,dy:null==i||n(i,r)?0:i-r,dz:null==s||null==a||n(s,a)?0:s-a}}function F(t,e){let o,n;t.geographic?(o=A(t.longitude.actual),n=A(t.latitude.actual),b(e)&&(null!=o&&null!=n?[o,n]=S(o,n,E):null!=o?o=S(o,0,E)[0]:null!=n&&(n=S(0,n,E)[1]))):(o=t.x.actual?.value,n=t.y.actual?.value);const r=t.elevation.actual,a=i(e);return{x:o,y:n,z:null!=a&&null!=r?l(r,a):void 0}}const E=[0,0];function I(t){if(!t)return 0;const e=q(t.rotationAxis);return null!=e?e*t.rotationAngle:null}function q(t){return c(t,y)?1:c(t,B)?-1:null}const B=s(m(),y);function H(t){return t?Math.max(...t.scale):1}function O(t,e){return!("key-down"!==t.type||t.key!==h.enterInputMode||!e||!T(e.info))&&(e.enterInputMode(),t.stopPropagation(),!0)}function T(t){const e=t?.sketchOptions;if(!e)return!1;const{inputEnabled:o,visibleElements:n}=e.tooltips;return o&&!0===t.editableFields.some((({name:t})=>"x"===t||"y"===t?n.coordinates:n[t]))}function C(n,r){let a=null;return e([n.on("paste",(async e=>{a?.abort(),a=t((async()=>{g()||await d(),G(e,n.info,r)}))})),t((()=>d())),o((()=>a?.abort()))])}function G(t,e,o){if(!e||!("geographic"in e))return;const n=t.clipboardData?.getData("text");if(!n)return;const r=e=>{t.stopPropagation(),t.preventDefault(),o?.onBeforePaste(),e(),o?.onAfterPaste()};if(e.geographic){const t=U(n);t&&r((()=>{e.longitude.applyValue(t.longitude),e.latitude.applyValue(t.latitude)}))}else{const t=M(n);t&&r((()=>{e.x.applyValue(t.x),e.y.applyValue(t.y)}))}}export{C as connectPasteEvent,O as enterInputModeIfAvailable,D as getXYZDeltasFromTooltipInfo,G as pasteLocation,V as updateMeshOriginFromTooltipInfo,k as updateMeshTransformFromTooltipInfo,R as updateTooltipInfoFromMeshTransform};
5
+ import{createTask as t}from"../../../core/asyncUtils.js";import{handlesGroup as o,makeHandle as e}from"../../../core/handleUtils.js";import{floatEqualUlp as n}from"../../../core/mathUtils.js";import{createAngle as r,createScalar as i,valueInUnit as a}from"../../../core/quantityUtils.js";import{watch as l}from"../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as s}from"../../../core/unitUtils.js";import{k as u,j as c,H as p}from"../../../chunks/vec32.js";import{clone as f,ONES as m,create as d,UNIT_Z as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoaded as g,load as v}from"../../../geometry/coordinateFormatter.js";import x from"../../../geometry/Point.js";import j from"../../../geometry/support/MeshTransform.js";import{isRelativeVertexSpace as b}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isWebMercator as S}from"../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as h}from"../../../geometry/support/webMercatorUtils.js";import{tooltipKeys as U}from"../keybindings.js";import M from"../Tooltip.js";import{parseLatitudeLongitude as w,parseXY as z}from"./fields/parsingAndFormattingUtils.js";import{getDegreesArithmetic as A,getDegreesGeographic as R}from"../../support/angularMeasurementUtils.js";function k(t){const o=new M(t());return o.addHandles(l((()=>t()),(({view:t,options:e,info:n})=>{o.view=t,void 0!==e&&(o.options=e),void 0!==n&&(o.info=n)}))),o}function P(t,o){const e=b(o.vertexSpace),{scale:n,orientation:a}=t,{transform:l}=o,s=q(l);e&&null!=s?(a.actual=r(s,"degrees","arithmetic"),a.visible=!0):(a.actual=null,a.visible=!1),e?(n.actual=i(C(l)),n.visible=!0):(n.actual=null,n.visible=!1)}function V(t,o,e){if(!o||!b(o.vertexSpace))return;const n=o.transform??=new j;D(t,n,e),F(t,n,e)}function D(t,o,e){const n=A(t.orientation.actual),r=B(o.rotationAxis);if(null==n||null==r)return;const i=o.rotationAngle,a=n*r,l=(n-i)*r;i!==a&&(e?.onRotateStart(0),o.rotationAngle=a,e?.onRotate(l),e?.onRotateStop(l))}function F(t,o,e){const n=t.scale.actual?.value,r=C(o);if(null==n||n===r)return;const{scale:i}=o;let a;if(0===r)a=f(m);else{const t=n/r;a=c(d(),i,t)}e?.onScaleStart(i[0],i[1],i[2]),o.scale=a,e?.onScale(a[0],a[1],a[2]),e?.onScaleStop(a[0],a[1],a[2])}function E(t,o,e){if(!o||!b(o.vertexSpace))return;const{origin:n,spatialReference:r}=o,{x:i,y:a,z:l}=I(t,r),{dx:s,dy:u,dz:c}=H(t,n);0===s&&0===u&&0===c||(e.onMoveStart(),o.centerAt(new x({x:i??n.x,y:a??n.y,z:l??n.z,spatialReference:r})),e.onMove(s,u,c),e.onMoveStop())}function H(t,o){const{x:e,y:r,z:i}=o,{x:a,y:l,z:s}=I(t,o.spatialReference);return{dx:null==a||n(a,e)?0:a-e,dy:null==l||n(l,r)?0:l-r,dz:null==s||null==i||n(s,i)?0:s-i}}function I(t,o){let e,n;t.geographic?(e=R(t.longitude.actual),n=R(t.latitude.actual),S(o)&&(null!=e&&null!=n?[e,n]=h(e,n,T):null!=e?e=h(e,0,T)[0]:null!=n&&(n=h(0,n,T)[1]))):(e=t.x.actual?.value,n=t.y.actual?.value);const r=t.elevation.actual,i=s(o);return{x:e,y:n,z:null!=i&&null!=r?a(r,i):void 0}}const T=[0,0];function q(t){if(!t)return 0;const o=B(t.rotationAxis);return null!=o?o*t.rotationAngle:null}function B(t){return p(t,y)?1:p(t,O)?-1:null}const O=u(d(),y);function C(t){return t?Math.max(...t.scale):1}function G(t,o){return!("key-down"!==t.type||t.key!==U.enterInputMode||!o||!J(o.info))&&(o.enterInputMode(),t.stopPropagation(),!0)}function J(t){const o=t?.sketchOptions;if(!o)return!1;const{inputEnabled:e,visibleElements:n}=o.tooltips;return e&&!0===t.editableFields.some((({name:t})=>"x"===t||"y"===t?n.coordinates:n[t]))}function K(n,r){let i=null;return o([n.on("paste",(async o=>{i?.abort(),i=t((async()=>{g()||await v(),L(o,n.info,r)}))})),t((()=>v())),e((()=>i?.abort()))])}function L(t,o,e){if(!o||!("geographic"in o))return;const n=t.clipboardData?.getData("text");if(!n)return;const r=o=>{t.stopPropagation(),t.preventDefault(),e?.onBeforePaste(),o(),e?.onAfterPaste()};if(o.geographic){const t=w(n);t&&r((()=>{o.longitude.applyValue(t.longitude),o.latitude.applyValue(t.latitude)}))}else{const t=z(n);t&&r((()=>{o.x.applyValue(t.x),o.y.applyValue(t.y)}))}}export{K as connectPasteEvent,G as enterInputModeIfAvailable,H as getXYZDeltasFromTooltipInfo,k as makeTooltip,L as pasteLocation,E as updateMeshOriginFromTooltipInfo,V as updateMeshTransformFromTooltipInfo,P as updateTooltipInfoFromMeshTransform};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{JSONSupport as e}from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{setDeepValue as o}from"../../core/object.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{Integer as s,Null as p}from"../../core/accessorSupport/ensureType.js";import{reader as i}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../../core/accessorSupport/decorators/writer.js";import{timeUnitKebabDictionary as m}from"../../portal/timeUnitKebabDictionary.js";import a from"../../time/TimeExtent.js";import c from"../../time/TimeInterval.js";var d;let T=d=class extends e{constructor(t){super(t),this.currentTimeExtent=null,this.fullTimeExtent=null,this.loop=!1,this.numStops=null,this.numThumbs=null,this.stopDelay=null,this.stopInterval=null,this.stops=null}readCurrentTimeExtent(t){if(!t)return;const e=null!=t[0]?new Date(t[0]):null,r=null!=t[1]?new Date(t[1]):null;return new a({start:e,end:r})}writeCurrentTimeExtent(t,e,r){t&&o(r,[null!=t.start?t.start.getTime():null,null!=t.end?t.end.getTime():null],e)}readFullTimeExtent(t,e){const r=e.properties;if(!r)return;const o=null!=r.endTime?new Date(r.endTime):null,n=null!=r.startTime?new Date(r.startTime):null;return new a({start:n,end:o})}writeFullTimeExtent(t,e){if(!t)return;const r=e.properties=e.properties||{},o=t.end,n=t.start;o&&(r.endTime=null!=o?o.getTime():null),n&&(r.startTime=null!=n?n.getTime():null)}readStopInterval(t,e,r){return t?c.fromJSON({value:t.interval,unit:t.units},r):null}writeStopInterval(t,e,r,n){if(!t)return;const s=t.toJSON(n);o("properties.timeStopInterval",{interval:s.value,units:s.unit},e)}readStops(t){return t?.length?t.map((t=>new Date(t))):null}writeStops(t,e,r){t?.length&&o(r,t.map((t=>t.getTime())),e)}clone(){return new d(r({currentTimeExtent:this.currentTimeExtent,fullTimeExtent:this.fullTimeExtent,loop:this.loop,numStops:this.numStops,numThumbs:this.numThumbs,stopDelay:this.stopDelay,stopInterval:this.stopInterval,stops:this.stops}))}};t([n({type:a,json:{type:[[s,p]],read:{source:"properties.currentTimeExtent"},write:{target:"properties.currentTimeExtent"}}})],T.prototype,"currentTimeExtent",void 0),t([i("currentTimeExtent")],T.prototype,"readCurrentTimeExtent",null),t([u("currentTimeExtent")],T.prototype,"writeCurrentTimeExtent",null),t([n({type:a,json:{read:{source:["properties.endTime","properties.startTime"]},write:{target:{"properties.endTime":{type:Number},"properties.startTime":{type:Number}}}}})],T.prototype,"fullTimeExtent",void 0),t([i("fullTimeExtent")],T.prototype,"readFullTimeExtent",null),t([u("fullTimeExtent")],T.prototype,"writeFullTimeExtent",null),t([n({type:Boolean,nonNullable:!0,json:{default:!1,read:{source:"properties.loop"},write:{target:"properties.loop"}}})],T.prototype,"loop",void 0),t([n({type:s,json:{read:{source:"properties.numberOfStops"},write:{target:"properties.numberOfStops",overridePolicy(){const t=!!this.stopInterval,e=!!this.stops?.length,r=!(t||e);return{enabled:r,isRequired:r}}}}})],T.prototype,"numStops",void 0),t([n({type:[1,2],nonNullable:!0,json:{type:s,read:{source:"properties.thumbCount"},write:{target:"properties.thumbCount",isRequired:!0}}})],T.prototype,"numThumbs",void 0),t([n({type:Number,nonNullable:!0,json:{read:{source:"properties.thumbMovingRate"},write:{target:"properties.thumbMovingRate",isRequired:!0}}})],T.prototype,"stopDelay",void 0),t([n({type:c,json:{read:{source:"properties.timeStopInterval"},write:{target:{"properties.timeStopInterval.interval":{type:Number},"properties.timeStopInterval.units":{type:m.jsonValues.filter((t=>"esriTimeUnitsUnknown"!==t))}},overridePolicy(){const t=null!=this.numStops,e=!!this.stops?.length;return{enabled:!e,isRequired:!(t||e)}}}}})],T.prototype,"stopInterval",void 0),t([i("stopInterval")],T.prototype,"readStopInterval",null),t([u("stopInterval")],T.prototype,"writeStopInterval",null),t([n({type:[Date],json:{type:[s],read:{source:"properties.stops"},write:{target:"properties.stops",overridePolicy(){return{isRequired:null==this.numStops&&!this.stopInterval}}}}})],T.prototype,"stops",void 0),t([i("stops")],T.prototype,"readStops",null),t([u("stops")],T.prototype,"writeStops",null),T=d=t([l("esri.webdoc.widgets.TimeSlider")],T);const y=T;export{y as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{JSONSupport as e}from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{setDeepValue as o}from"../../core/object.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{Integer as p,Null as i}from"../../core/accessorSupport/ensureType.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../../core/accessorSupport/decorators/writer.js";import{timeUnitKebabDictionary as m}from"../../portal/timeUnitKebabDictionary.js";import a from"../../time/TimeExtent.js";import c from"../../time/TimeInterval.js";var d;let T=d=class extends e{constructor(t){super(t),this.currentTimeExtent=null,this.fullTimeExtent=null,this.loop=!1,this.numStops=null,this.numThumbs=null,this.stopDelay=null,this.stopInterval=null,this.stops=null}readCurrentTimeExtent(t){return t?a.fromArray(t):void 0}writeCurrentTimeExtent(t,e,r){t&&o(r,t.toArray(),e)}readFullTimeExtent(t,e){const r=e.properties;if(!r)return;const o=null!=r.endTime?new Date(r.endTime):null,s=null!=r.startTime?new Date(r.startTime):null;return new a({start:s,end:o})}writeFullTimeExtent(t,e){if(!t)return;const r=e.properties=e.properties||{},o=t.end,s=t.start;o&&(r.endTime=null!=o?o.getTime():null),s&&(r.startTime=null!=s?s.getTime():null)}readStopInterval(t,e,r){return t?c.fromJSON({value:t.interval,unit:t.units},r):null}writeStopInterval(t,e,r,s){if(!t)return;const p=t.toJSON(s);o("properties.timeStopInterval",{interval:p.value,units:p.unit},e)}readStops(t){return t?.length?t.map((t=>new Date(t))):null}writeStops(t,e,r){t?.length&&o(r,t.map((t=>t.getTime())),e)}clone(){return new d(r({currentTimeExtent:this.currentTimeExtent,fullTimeExtent:this.fullTimeExtent,loop:this.loop,numStops:this.numStops,numThumbs:this.numThumbs,stopDelay:this.stopDelay,stopInterval:this.stopInterval,stops:this.stops}))}};t([s({type:a,json:{type:[[p,i]],read:{source:"properties.currentTimeExtent"},write:{target:"properties.currentTimeExtent"}}})],T.prototype,"currentTimeExtent",void 0),t([n("currentTimeExtent")],T.prototype,"readCurrentTimeExtent",null),t([u("currentTimeExtent")],T.prototype,"writeCurrentTimeExtent",null),t([s({type:a,json:{read:{source:["properties.endTime","properties.startTime"]},write:{target:{"properties.endTime":{type:Number},"properties.startTime":{type:Number}}}}})],T.prototype,"fullTimeExtent",void 0),t([n("fullTimeExtent")],T.prototype,"readFullTimeExtent",null),t([u("fullTimeExtent")],T.prototype,"writeFullTimeExtent",null),t([s({type:Boolean,nonNullable:!0,json:{default:!1,read:{source:"properties.loop"},write:{target:"properties.loop"}}})],T.prototype,"loop",void 0),t([s({type:p,json:{read:{source:"properties.numberOfStops"},write:{target:"properties.numberOfStops",overridePolicy(){const t=!!this.stopInterval,e=!!this.stops?.length,r=!(t||e);return{enabled:r,isRequired:r}}}}})],T.prototype,"numStops",void 0),t([s({type:[1,2],nonNullable:!0,json:{type:p,read:{source:"properties.thumbCount"},write:{target:"properties.thumbCount",isRequired:!0}}})],T.prototype,"numThumbs",void 0),t([s({type:Number,nonNullable:!0,json:{read:{source:"properties.thumbMovingRate"},write:{target:"properties.thumbMovingRate",isRequired:!0}}})],T.prototype,"stopDelay",void 0),t([s({type:c,json:{read:{source:"properties.timeStopInterval"},write:{target:{"properties.timeStopInterval.interval":{type:Number},"properties.timeStopInterval.units":{type:m.jsonValues.filter((t=>"esriTimeUnitsUnknown"!==t))}},overridePolicy(){const t=null!=this.numStops,e=!!this.stops?.length;return{enabled:!e,isRequired:!(t||e)}}}}})],T.prototype,"stopInterval",void 0),t([n("stopInterval")],T.prototype,"readStopInterval",null),t([u("stopInterval")],T.prototype,"writeStopInterval",null),t([s({type:[Date],json:{type:[p],read:{source:"properties.stops"},write:{target:"properties.stops",overridePolicy(){return{isRequired:null==this.numStops&&!this.stopInterval}}}}})],T.prototype,"stops",void 0),t([n("stops")],T.prototype,"readStops",null),t([u("stops")],T.prototype,"writeStops",null),T=d=t([l("esri.webdoc.widgets.TimeSlider")],T);const y=T;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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../chunks/tslib.es6.js";import e from"../Viewpoint.js";import r from"../core/Accessor.js";import{ClonableMixin as t}from"../core/Clonable.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import p from"../geometry/SpatialReference.js";import{system as n}from"../time/timeZoneUtils.js";import m from"../webdoc/RangeInfo.js";import c from"./background/ColorBackground.js";let a=class extends(t(r)){constructor(o){super(o),this.background=null,this.rangeInfo=null,this.spatialReference=null,this.timeZone=n,this.viewpoint=null}};o([s({type:c})],a.prototype,"background",void 0),o([s({type:m})],a.prototype,"rangeInfo",void 0),o([s({type:p})],a.prototype,"spatialReference",void 0),o([s({nonNullable:!0})],a.prototype,"timeZone",void 0),o([s({type:e})],a.prototype,"viewpoint",void 0),a=o([i("esri.webmap.InitialViewProperties")],a);const l=a;export{l as default};
5
+ import{_ as o}from"../chunks/tslib.es6.js";import e from"../Viewpoint.js";import t from"../core/Accessor.js";import{ClonableMixin as r}from"../core/Clonable.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 p from"../geometry/SpatialReference.js";import m from"../time/TimeExtent.js";import{system as n}from"../time/timeZoneUtils.js";import c from"../webdoc/RangeInfo.js";import a from"./background/ColorBackground.js";let l=class extends(r(t)){constructor(o){super(o),this.background=null,this.rangeInfo=null,this.spatialReference=null,this.timeExtent=null,this.timeZone=n,this.viewpoint=null}};o([i({type:a})],l.prototype,"background",void 0),o([i({type:c})],l.prototype,"rangeInfo",void 0),o([i({type:p})],l.prototype,"spatialReference",void 0),o([i({type:m})],l.prototype,"timeExtent",void 0),o([i({nonNullable:!0})],l.prototype,"timeZone",void 0),o([i({type:e})],l.prototype,"viewpoint",void 0),l=o([s("esri.webmap.InitialViewProperties")],l);const f=l;export{f as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Basemap.js";import s from"../../core/Collection.js";import i from"../../core/Loadable.js";import{watch as a,on as r,when as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/RandomLCG.js";import"../../core/has.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{canProjectWithoutEngine as m,isLoaded as l,load as u}from"../../geometry/projection.js";import{equals as d}from"../../geometry/support/spatialReferenceUtils.js";import{contentEquals as h}from"../../support/basemapUtils.js";import{default3DCompatibility as f,default2DCompatibility as y}from"./support/basemapCompatibilityUtils.js";import v from"./support/BasemapGalleryItem.js";import b from"./support/LocalBasemapsSource.js";import g from"./support/PortalBasemapsSource.js";const j=s.ofType(v);function w(e){return e&&"esri.portal.Portal"===e.declaredClass}function B(e){return e&&!(e instanceof g)&&(!!e.portal||!!e.query)}function _(e){return e&&"basemaps"in e&&"state"in e&&"refresh"in e}let I=class extends i{constructor(e){super(e),this._loadingProjectionEngine=!1,this.items=new j,this.source=new g,this.view=null}initialize(){const e=()=>this._recreateItems();this.addHandles([a((()=>"ready"===this.state?this.compatibilityFunction:null),(()=>this._updateItems())),r((()=>this.source?.basemaps),"change",e,{onListenerAdd:e}),o((()=>this.view),(()=>{this.source instanceof g&&(this.source.viewType=this.view?.type)}),{once:!0})])}destroy(){const e=this.source.basemaps.find((e=>e===this.activeBasemap));e&&this.source.basemaps.remove(e),this.source?.destroy()}get activeBasemap(){return this.view?.map?.basemap??null}set activeBasemap(e){const s=this.view;if(!s?.map)return;const i="string"==typeof e?t.fromId(e):e;if(!i||!s.ready)return s.map.basemap=i,void this._clearOverride("activeBasemap");const a=i.spatialReference||this.items?.find((e=>this.basemapEquals(i,e.basemap)))?.spatialReference;if(a&&"spatialReferenceLocked"in s&&!s.spatialReferenceLocked){const t=s.spatialReference;if(null!=a&&!d(t,a)&&!m(s.spatialReference,a)&&!l())return this._override("activeBasemap",i),this._loadingProjectionEngine=!0,void u().then((()=>{this._get("activeBasemap")===e&&(s.map.basemap=e,s.spatialReference=a,this._clearOverride("activeBasemap"))}),(()=>{})).then((()=>{this._loadingProjectionEngine=!1}));s.map.basemap=i,this._clearOverride("activeBasemap"),null==a||d(s.spatialReference,a)||(s.spatialReference=a)}else s.map.basemap=i,this._clearOverride("activeBasemap")}get activeBasemapIndex(){const{state:e,activeBasemap:t}=this;return"ready"!==e?-1:this._findBasemapIndex(t)}get compatibilityFunction(){return"3d"===this.view?.type?f:y}set compatibilityFunction(e){this._overrideIfSome("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||s.isCollection(e)?new b({basemaps:Array.isArray(e)?new s(e):e}):w(e)?new g({portal:e}):B(e)?new g(e):_(e)?e:null}get state(){return this.view?.ready&&this.source?this._loadingProjectionEngine?"loading":"ready":"disabled"}basemapEquals(e,t){return h(e,t)}refresh(){this._recreateItems()}load(){return this.loadSource()}loadSource(e){return this.addResolvingPromise(i.isLoadable(this.source)?this.source.load(e):null),Promise.resolve(this)}_findBasemapIndex(e){const{items:t}=this,s=t.findIndex((t=>t.basemap===e));return-1===s?t.findIndex((t=>this.basemapEquals(t.basemap,e))):s}_recreateItems(){const e=this.source?.basemaps??[],{view:t,compatibilityFunction:s}=this,i=new Map(this.items.map((e=>[e.basemap,e]))),a=e.map((e=>{const a=i.get(e);return a?(i.delete(e),a):new v({basemap:e,compatibilityFunction:s,view:t})}));this.items.removeAll(),this.items.addMany(a),i.forEach((e=>e.destroy()))}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([n()],I.prototype,"_loadingProjectionEngine",void 0),e([n()],I.prototype,"activeBasemap",null),e([n({readOnly:!0})],I.prototype,"activeBasemapIndex",null),e([n()],I.prototype,"compatibilityFunction",null),e([n({readOnly:!0,type:j})],I.prototype,"items",void 0),e([n()],I.prototype,"source",void 0),e([p("source")],I.prototype,"castSource",null),e([n({readOnly:!0})],I.prototype,"state",null),e([n()],I.prototype,"view",void 0),I=e([c("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],I);const R=I;export{R as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Basemap.js";import s from"../../core/Collection.js";import i from"../../core/Loadable.js";import{watch as a,on as r,when as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/RandomLCG.js";import"../../core/has.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{canProjectWithoutEngine as m,isLoaded as l,load as u}from"../../geometry/projection.js";import{equals as d}from"../../geometry/support/spatialReferenceUtils.js";import{isLinkChartView as h}from"../../linkChart/utils.js";import{contentEquals as f}from"../../support/basemapUtils.js";import{default3DCompatibility as y,default2DCompatibility as v}from"./support/basemapCompatibilityUtils.js";import b from"./support/BasemapGalleryItem.js";import w from"./support/LocalBasemapsSource.js";import g from"./support/PortalBasemapsSource.js";const j=s.ofType(b);function B(e){return e&&"esri.portal.Portal"===e.declaredClass}function _(e){return e&&!(e instanceof g)&&(!!e.portal||!!e.query)}function I(e){return e&&"basemaps"in e&&"state"in e&&"refresh"in e}let R=class extends i{constructor(e){super(e),this._loadingProjectionEngine=!1,this.items=new j,this.source=new g,this.view=null}initialize(){const e=()=>this._recreateItems();this.addHandles([a((()=>"ready"===this.state?this.compatibilityFunction:null),(()=>this._updateItems())),r((()=>this.source?.basemaps),"change",e,{onListenerAdd:e}),o((()=>this.view),(()=>{this.source instanceof g&&(this.source.viewType=this.view?.type)}),{once:!0})])}destroy(){const e=this.source.basemaps.find((e=>e===this.activeBasemap));e&&this.source.basemaps.remove(e),this.source?.destroy()}get activeBasemap(){return this.view?.map?.basemap??null}set activeBasemap(e){const s=this.view;if(!s?.map)return;const i="string"==typeof e?t.fromId(e):e;if(!i||!s.ready)return s.map.basemap=i,void this._clearOverride("activeBasemap");const a=i.spatialReference||this.items?.find((e=>this.basemapEquals(i,e.basemap)))?.spatialReference;if(a&&"spatialReferenceLocked"in s&&!s.spatialReferenceLocked){const t=s.spatialReference;if(null!=a&&!d(t,a)&&!m(s.spatialReference,a)&&!l())return this._override("activeBasemap",i),this._loadingProjectionEngine=!0,void u().then((()=>{this._get("activeBasemap")===e&&(s.map.basemap=e,s.spatialReference=a,this._clearOverride("activeBasemap"))}),(()=>{})).then((()=>{this._loadingProjectionEngine=!1}));s.map.basemap=i,this._clearOverride("activeBasemap"),null==a||d(s.spatialReference,a)||(s.spatialReference=a)}else s.map.basemap=i,this._clearOverride("activeBasemap")}get activeBasemapIndex(){const{state:e,activeBasemap:t}=this;return"ready"!==e?-1:this._findBasemapIndex(t)}get compatibilityFunction(){return"3d"===this.view?.type?y:v}set compatibilityFunction(e){this._overrideIfSome("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||s.isCollection(e)?new w({basemaps:Array.isArray(e)?new s(e):e}):B(e)?new g({portal:e}):_(e)?new g(e):I(e)?e:null}get state(){return this.view?.ready&&this.source?h(this.view)&&!this.view.inGeographicLayout?"unsupported":this._loadingProjectionEngine?"loading":"ready":"disabled"}basemapEquals(e,t){return f(e,t)}refresh(){this._recreateItems()}load(){return this.loadSource()}loadSource(e){return this.addResolvingPromise(i.isLoadable(this.source)?this.source.load(e):null),Promise.resolve(this)}_findBasemapIndex(e){const{items:t}=this,s=t.findIndex((t=>t.basemap===e));return-1===s?t.findIndex((t=>this.basemapEquals(t.basemap,e))):s}_recreateItems(){const e=this.source?.basemaps??[],{view:t,compatibilityFunction:s}=this,i=new Map(this.items.map((e=>[e.basemap,e]))),a=e.map((e=>{const a=i.get(e);return a?(i.delete(e),a):new b({basemap:e,compatibilityFunction:s,view:t})}));this.items.removeAll(),this.items.addMany(a),i.forEach((e=>e.destroy()))}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([n()],R.prototype,"_loadingProjectionEngine",void 0),e([n()],R.prototype,"activeBasemap",null),e([n({readOnly:!0})],R.prototype,"activeBasemapIndex",null),e([n()],R.prototype,"compatibilityFunction",null),e([n({readOnly:!0,type:j})],R.prototype,"items",void 0),e([n()],R.prototype,"source",void 0),e([p("source")],R.prototype,"castSource",null),e([n({readOnly:!0})],R.prototype,"state",null),e([n()],R.prototype,"view",void 0),R=e([c("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],R);const S=R;export{S 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import{when as s}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{getBasemapThumbnailUrl as r,isBasemap3D as o,isBasemapInBeta as l}from"../support/basemapUtils.js";import n from"./Widget.js";import d from"./BasemapGallery/BasemapGalleryViewModel.js";import{css as p}from"./BasemapGallery/css.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import{Heading as h}from"./support/Heading.js";import{accessibleHandler as u}from"./support/decorators/accessibleHandler.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as v}from"./support/jsxFactory.js";import{onResize as b}from"./support/widgetUtils.js";const y={small:200,default:280,wide:420};let w=class extends n{constructor(e,t){super(e,t),this.disabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new d,this._focusBasemapItemEnabled=!1,this._container=null,this._width=0,this._onContainerCreated=e=>{this._container=e}}initialize(){this.addHandles([b((()=>this._container),(({contentRect:e})=>{this._width=e.width})),s((()=>this.source),(()=>this.viewModel.loadSource()),{sync:!0,initial:!0})])}loadDependencies(){return m({scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip.js")})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get icon(){return"basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="loading"===this.source.state,t=this.disabled||"disabled"===this.viewModel.state,s=this.viewModel.items,a={[p.sourceLoading]:e,[c.disabled]:t},i=this._width;i<=y.small||i>=y.wide?a[p.layoutGrid]=!0:i<y.default&&(a[p.narrowItems]=!0);const r=e?v("div",{class:p.loader,key:"loader"}):null,o=e?null:s.length>0?v("ul",{"aria-disabled":this.disabled,"aria-label":this.label,bind:this,class:p.itemContainer,key:"item-container",onkeydown:this._handleKeyDown,role:"radiogroup"},s.map(((e,t)=>this._renderBasemapGalleryItem(e,t))).toArray()):v("div",{class:c.empty,key:"empty-message"},v(h,{level:this.headingLevel},this.messages.noBasemaps));return v("div",{afterCreate:this._onContainerCreated,class:this.classes(p.base,c.widget,c.panel,a),key:"container",styles:{"--esri-basemap-gallery-small":`${y.small}px`}},0===this._width?null:[r,o])}_getRoundRobinIndex(e,t){return(e+t)%t}_handleKeyDown(e){const{key:t}=e;if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t))return;e.preventDefault();const{items:s,activeBasemapIndex:a}=this.viewModel,i="ArrowUp"===t||"ArrowLeft"===t?this._getRoundRobinIndex(Math.max(a-1,-1),s.length):this._getRoundRobinIndex(a+1,s.length),r=s.at(i);"ready"===r?.state&&(this.viewModel.activeBasemap=r.basemap),this._focusBasemapItemEnabled=!0}_focusBasemapItem(e){this._focusBasemapItemEnabled&&0===e.tabIndex&&(e.focus(),this._focusBasemapItemEnabled=!1)}_handleClick(e){const t=e.currentTarget["data-item"];"ready"===t.state&&(this.viewModel.activeBasemap=t.basemap)}_renderBasemapGalleryItem(e,s){const a=r(e.basemap)||t("esri/themes/base/images/basemap-toggle-64.svg"),i=e.basemap.title,l=e.basemap.portalItem?.snippet,n=e.error?.message||l||i,{viewModel:{state:d,activeBasemapIndex:m}}=this,h=this.disabled||"disabled"===d,u=m===s,g=u||-1===m&&0===s?0:-1,b="loading"===d,y={[p.selectedItem]:u,[p.itemError]:"error"===e.state},w=`basemapgallery-item-${e.uid}`;return v("li",{afterUpdate:this._focusBasemapItem,"aria-checked":u.toString(),"aria-disabled":h.toString(),"aria-labelledby":w,bind:this,class:this.classes(p.item,y),"data-item":e,key:e.uid,onclick:this._handleClick,onkeydown:this._handleClick,role:"radio",tabIndex:g,title:n},v("img",{alt:"",class:p.itemThumbnail,src:a}),v("div",{class:p.itemContent,key:"content"},v("div",{class:p.itemTitle,key:"title"},v("span",{id:w},i)),o(e.basemap)?this._renderTags(e.basemap):null),"loading"===e.state||u&&b?v("calcite-scrim",null,v("span",{"aria-hidden":"true",class:c.loaderAnimation,key:"loader",role:"presentation"})):null)}_renderTags(e){return v("div",{class:p.itemTagsContainer,key:"tag"},this._render3DTag(),l(e)?this._renderBetaTag():null)}_render3DTag(){const{messages:e}=this;return v("calcite-chip",{key:"tag-3d",scale:"s",value:e.tag3D},this.messages.tag3D)}_renderBetaTag(){const{messages:e}=this;return v("calcite-chip",{appearance:"outline-fill",key:"tag-beta",scale:"s",value:e.tagBeta},this.messages.tagBeta)}};e([a()],w.prototype,"activeBasemap",null),e([a()],w.prototype,"disabled",void 0),e([a()],w.prototype,"headingLevel",void 0),e([a()],w.prototype,"icon",null),e([a()],w.prototype,"label",null),e([a(),g("esri/widgets/BasemapGallery/t9n/BasemapGallery")],w.prototype,"messages",void 0),e([a()],w.prototype,"source",null),e([a()],w.prototype,"view",null),e([a()],w.prototype,"viewModel",void 0),e([a()],w.prototype,"_focusBasemapItemEnabled",void 0),e([a()],w.prototype,"_container",void 0),e([a()],w.prototype,"_width",void 0),e([u()],w.prototype,"_handleClick",null),w=e([i("esri.widgets.BasemapGallery")],w);const _=w;export{_ as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import{when as s}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{getBasemapThumbnailUrl as r,isBasemap3D as o,isBasemapInBeta as l}from"../support/basemapUtils.js";import n from"./Widget.js";import d from"./BasemapGallery/BasemapGalleryViewModel.js";import{css as p}from"./BasemapGallery/css.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import{Heading as h}from"./support/Heading.js";import{accessibleHandler as u}from"./support/decorators/accessibleHandler.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as v}from"./support/jsxFactory.js";import{onResize as y}from"./support/widgetUtils.js";const b={small:200,default:280,wide:420};let w=class extends n{constructor(e,t){super(e,t),this.disabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new d,this._focusBasemapItemEnabled=!1,this._container=null,this._width=0,this._onContainerCreated=e=>{this._container=e}}initialize(){this.addHandles([y((()=>this._container),(({contentRect:e})=>{this._width=e.width})),s((()=>this.source),(()=>this.viewModel.loadSource()),{sync:!0,initial:!0})])}loadDependencies(){return m({scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip.js")})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get icon(){return"basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="loading"===this.source.state,t=this.disabled||"disabled"===this.viewModel.state,s={[p.sourceLoading]:e,[c.disabled]:t},a=this._width;a<=b.small||a>=b.wide?s[p.layoutGrid]=!0:a<b.default&&(s[p.narrowItems]=!0);const i=this._getContext();return v("div",{afterCreate:this._onContainerCreated,class:this.classes(p.base,c.widget,c.panel,s),key:"container",styles:{"--esri-basemap-gallery-small":`${b.small}px`}},0===this._width?null:i)}_getContext(){if("unsupported"===this.viewModel.state)return v("div",{class:c.empty,key:"empty-message"},v(h,{level:this.headingLevel},this.messages.unsupported));if("loading"===this.source.state)return v("div",{class:p.loader,key:"loader"});const e=this.viewModel.items;return e.length>0?v("ul",{"aria-disabled":this.disabled,"aria-label":this.label,bind:this,class:p.itemContainer,key:"item-container",onkeydown:this._handleKeyDown,role:"radiogroup"},e.map(((e,t)=>this._renderBasemapGalleryItem(e,t))).toArray()):v("div",{class:c.empty,key:"empty-message"},v(h,{level:this.headingLevel},this.messages.noBasemaps))}_getRoundRobinIndex(e,t){return(e+t)%t}_handleKeyDown(e){const{key:t}=e;if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t))return;e.preventDefault();const{items:s,activeBasemapIndex:a}=this.viewModel,i="ArrowUp"===t||"ArrowLeft"===t?this._getRoundRobinIndex(Math.max(a-1,-1),s.length):this._getRoundRobinIndex(a+1,s.length),r=s.at(i);"ready"===r?.state&&(this.viewModel.activeBasemap=r.basemap),this._focusBasemapItemEnabled=!0}_focusBasemapItem(e){this._focusBasemapItemEnabled&&0===e.tabIndex&&(e.focus(),this._focusBasemapItemEnabled=!1)}_handleClick(e){const t=e.currentTarget["data-item"];"ready"===t.state&&(this.viewModel.activeBasemap=t.basemap)}_renderBasemapGalleryItem(e,s){const a=r(e.basemap)||t("esri/themes/base/images/basemap-toggle-64.svg"),i=e.basemap.title,l=e.basemap.portalItem?.snippet,n=e.error?.message||l||i,{viewModel:{state:d,activeBasemapIndex:m}}=this,h=this.disabled||"disabled"===d,u=m===s,g=u||-1===m&&0===s?0:-1,y="loading"===d,b={[p.selectedItem]:u,[p.itemError]:"error"===e.state},w=`basemapgallery-item-${e.uid}`;return v("li",{afterUpdate:this._focusBasemapItem,"aria-checked":u.toString(),"aria-disabled":h.toString(),"aria-labelledby":w,bind:this,class:this.classes(p.item,b),"data-item":e,key:e.uid,onclick:this._handleClick,onkeydown:this._handleClick,role:"radio",tabIndex:g,title:n},v("img",{alt:"",class:p.itemThumbnail,src:a}),v("div",{class:p.itemContent,key:"content"},v("div",{class:p.itemTitle,key:"title"},v("span",{id:w},i)),o(e.basemap)?this._renderTags(e.basemap):null),"loading"===e.state||u&&y?v("calcite-scrim",null,v("span",{"aria-hidden":"true",class:c.loaderAnimation,key:"loader",role:"presentation"})):null)}_renderTags(e){return v("div",{class:p.itemTagsContainer,key:"tag"},this._render3DTag(),l(e)?this._renderBetaTag():null)}_render3DTag(){const{messages:e}=this;return v("calcite-chip",{key:"tag-3d",scale:"s",value:e.tag3D},this.messages.tag3D)}_renderBetaTag(){const{messages:e}=this;return v("calcite-chip",{appearance:"outline-fill",key:"tag-beta",scale:"s",value:e.tagBeta},this.messages.tagBeta)}};e([a()],w.prototype,"activeBasemap",null),e([a()],w.prototype,"disabled",void 0),e([a()],w.prototype,"headingLevel",void 0),e([a()],w.prototype,"icon",null),e([a()],w.prototype,"label",null),e([a(),g("esri/widgets/BasemapGallery/t9n/BasemapGallery")],w.prototype,"messages",void 0),e([a()],w.prototype,"source",null),e([a()],w.prototype,"view",null),e([a()],w.prototype,"viewModel",void 0),e([a()],w.prototype,"_focusBasemapItemEnabled",void 0),e([a()],w.prototype,"_container",void 0),e([a()],w.prototype,"_width",void 0),e([u()],w.prototype,"_handleClick",null),w=e([i("esri.widgets.BasemapGallery")],w);const _=w;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.31/esri/copyright.txt for details.
4
4
  */
5
- const t="esri-basemap-layer-list",i=`${t}__item`,e={base:t,actionMenu:`${t}__action-menu`,actionGroup:`${t}__action-group`,filterNoResults:`${t}__filter-no-results`,item:i,itemActive:`${i}--active`,itemContent:`${i}-content`,itemContentBottom:`${i}-content-bottom`,itemMessage:`${i}-message`,itemInvisible:`${i}--invisible`,itemActionIcon:`${i}-action-icon`,itemActionImage:`${i}-action-image`,itemTemporaryIcon:`${i}-temporary-icon`,itemCatalogIcon:`${i}-catalog-icon`,statusIndicator:`${t}__status-indicator`,publishing:`${t}__publishing`,updating:`${t}__updating`,editing:`${t}__editing`,connectionStatus:`${t}__connection-status`,connectionStatusConnected:`${t}__connection-status--connected`,visibleToggle:`${t}__visible-toggle`,visibleIcon:`${t}__visible-icon`,section:`${t}__section`};export{e as css};
5
+ const t="esri-basemap-layer-list",i=`${t}__item`,e={base:t,actionMenu:`${t}__action-menu`,actionGroup:`${t}__action-group`,filterNoResults:`${t}__filter-no-results`,item:i,itemActive:`${i}--active`,itemContent:`${i}-content`,itemContentBottom:`${i}-content-bottom`,itemMessage:`${i}-message`,itemInvisible:`${i}--invisible`,itemActionIcon:`${i}-action-icon`,itemActionImage:`${i}-action-image`,itemTableIcon:`${i}-table-icon`,itemTemporaryIcon:`${i}-temporary-icon`,itemCatalogIcon:`${i}-catalog-icon`,statusIndicator:`${t}__status-indicator`,publishing:`${t}__publishing`,updating:`${t}__updating`,editing:`${t}__editing`,connectionStatus:`${t}__connection-status`,connectionStatusConnected:`${t}__connection-status--connected`,visibleToggle:`${t}__visible-toggle`,visibleIcon:`${t}__visible-icon`,section:`${t}__section`};export{e as css};