@arcgis/core 4.33.0-next.20250516 → 4.33.0-next.20250517

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 (411) hide show
  1. package/applications/Components/QuantityFormatter.d.ts +4 -0
  2. package/applications/Components/QuantityFormatter.js +5 -0
  3. package/arcade/ArcadeDate.js +1 -1
  4. package/arcade/enum.js +5 -0
  5. package/arcade/featureset/actions/GroupBy.js +1 -1
  6. package/arcade/functions/convertdirection.js +1 -1
  7. package/arcade/functions/date.js +1 -1
  8. package/arcade/functions/featuresetbase.js +1 -1
  9. package/arcade/functions/geomasync.js +1 -1
  10. package/arcade/functions/geomsync.js +1 -1
  11. package/arcade/functions/string.js +1 -1
  12. package/arcade/geometry/functions.js +1 -1
  13. package/arcade/geometry/unitConversion.js +1 -1
  14. package/assets/esri/core/workers/RemoteClient.js +1 -1
  15. package/assets/esri/core/workers/chunks/{0fd6d80393722132e044.js → 0229c573fa8a2fff2d8b.js} +2 -2
  16. package/assets/esri/core/workers/chunks/{612f6739c9399fbae4d0.js → 094e8aae6dada24c8115.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{ffaa977cd97a2b7190c5.js → 0c2dccec20c0994366fe.js} +1 -1
  18. package/assets/esri/core/workers/chunks/151d6354e7bc105b25c0.js +346 -0
  19. package/assets/esri/core/workers/chunks/1cf0fae3f2e848a2a738.js +1 -0
  20. package/assets/esri/core/workers/chunks/24327d01cb2c5c55a4b7.js +1 -0
  21. package/assets/esri/core/workers/chunks/{1a010d877b8428e755fb.js → 2841888fdbc2770e90c8.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{7e1dc8e5e18f18dd21e2.js → 29fb64826bb1351aca8d.js} +2 -2
  23. package/assets/esri/core/workers/chunks/{4e0d2458f4d7a35bb97c.js → 2ce5cc797ae0d66c8678.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{9d564f79b82d427fc1da.js → 2fd30428309f4c517d4c.js} +1 -1
  25. package/assets/esri/core/workers/chunks/3ca6f893fd58f5b17af5.js +1 -0
  26. package/assets/esri/core/workers/chunks/{52d160cb7921ae7a4f57.js → 3fc44d8cef392b4b9c7a.js} +1 -1
  27. package/assets/esri/core/workers/chunks/417293f00b2c21cc3175.js +1 -0
  28. package/assets/esri/core/workers/chunks/{4cb199b547e5b97e65fb.js → 48cedef1c926d11164b7.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{563594357f3648652a5c.js → 4b21c4815533a43835c3.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{921c040d0497031fd8ff.js → 54da9c7fd1088a8076ce.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{ab9614555a15f04396f6.js → 54f981fe0f8851767be9.js} +2 -2
  32. package/assets/esri/core/workers/chunks/{28d9e2ffc3059a55311e.js → 59f701c30bcd9088b291.js} +1 -1
  33. package/assets/esri/core/workers/chunks/5d50a8d0427eab0a2514.js +1 -0
  34. package/assets/esri/core/workers/chunks/5f4ca51b82daf0e51010.js +1 -0
  35. package/assets/esri/core/workers/chunks/{05c80002c37002ac99e8.js → 5f6719286a6c9a3ac74b.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{a09b5700c92bb76c3234.js → 638ecabe3e22978af5a3.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{9fff43ffcd5602ccc50f.js → 649caffe8f5dbaad0d7b.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{4480e4b61affb3b2e9d6.js → 6648e68f00d28e12bcf9.js} +1 -1
  39. package/assets/esri/core/workers/chunks/66a1b92358344dd28ee1.js +1 -0
  40. package/assets/esri/core/workers/chunks/{b92a34f88569c481ed10.js → 67338948e470c1251d8a.js} +3 -3
  41. package/assets/esri/core/workers/chunks/{a8d043b73e087bee7c40.js → 67c5f1112a7c65e9eeff.js} +1 -1
  42. package/assets/esri/core/workers/chunks/6a225393b63e1e8c7933.js +1 -0
  43. package/assets/esri/core/workers/chunks/6c29a768f02dc7ce0ed6.js +1 -0
  44. package/assets/esri/core/workers/chunks/{fbd2f45d5adce4ca323f.js → 73ddb356121add556994.js} +2 -2
  45. package/assets/esri/core/workers/chunks/{a6ca68ef6311ffc365b2.js → 73e179b04bb931ca9b86.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7678177555570682154e.js +1 -0
  47. package/assets/esri/core/workers/chunks/7b9d14cc4a466ef18d71.js +1 -0
  48. package/assets/esri/core/workers/chunks/7e6141b5baae47682f97.js +1 -0
  49. package/assets/esri/core/workers/chunks/{257db39a1ba1a11ebfb4.js → 8365707e408d19988356.js} +1 -1
  50. package/assets/esri/core/workers/chunks/8a2cee726b7843c7408a.js +1 -0
  51. package/assets/esri/core/workers/chunks/{b1e275607d9754079f60.js → 8eadf90d938753691044.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{ff4e7da880b206fd98ec.js → 9049c81445cc044286f1.js} +1 -1
  53. package/assets/esri/core/workers/chunks/9588328d4ed6b0f04166.js +2 -0
  54. package/assets/esri/core/workers/chunks/{dcf5719f38ad40b92941.js → 9826a1c66885dbbdc130.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{4954e0cf4a40e45d237f.js → 9c8e66da6cf32ace0914.js} +1 -1
  56. package/assets/esri/core/workers/chunks/9cac00d4bfac14aaae12.js +1 -0
  57. package/assets/esri/core/workers/chunks/{d60da671aba70485050e.js → 9f18392933c06f1d63b6.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{c3b2b05996e2008adbe3.js → a9f16323666042a9d47f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/aad9a693813b47a51530.js +2 -0
  60. package/assets/esri/core/workers/chunks/{654fe135d41af81daa13.js → be1f3cac908c28c64401.js} +1 -1
  61. package/assets/esri/core/workers/chunks/bf4d9cdcbe6bb8bc9d39.js +1 -0
  62. package/assets/esri/core/workers/chunks/{d49518eb4b351afc5f00.js → ca3851ca2621879eb887.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{56db71ea7eb8a5652d98.js → ca62e7ec102a1bb879dc.js} +1 -1
  64. package/assets/esri/core/workers/chunks/cb16ba9512ae0a09c55d.js +1 -0
  65. package/assets/esri/core/workers/chunks/{8c1242ffd48b3ef800fa.js → d103e184ddf9beec779d.js} +1 -1
  66. package/assets/esri/core/workers/chunks/d3d98ea5b5e56fc60a31.js +1 -0
  67. package/assets/esri/core/workers/chunks/{5719471414810b6a9aec.js → d9d9180689bcf71af00f.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{dcaeb57c69d432118604.js → db13c93b4d708a2481db.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{2c3bfa75286376388806.js → db192728fa0ee08a776a.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{40b8e53c8b1c447eff7e.js → e2d012078d51dc2b2802.js} +1 -1
  71. package/assets/esri/core/workers/chunks/e385a27fd1ac2123a05f.js +1 -0
  72. package/assets/esri/core/workers/chunks/{e85f892ea44d67d53ff0.js → f3b51aa0a1a8fc3b231c.js} +2 -2
  73. package/assets/esri/core/workers/chunks/f74f8ed3f17713a208c3.js +1 -0
  74. package/assets/esri/core/workers/chunks/f9567108862629f25c8b.js +1 -0
  75. package/assets/esri/core/workers/chunks/fa99abc572b382e7e0c7.js +1 -0
  76. package/assets/esri/themes/base/widgets/_Directions.scss +74 -0
  77. package/assets/esri/themes/dark/main.css +1 -1
  78. package/assets/esri/themes/light/main.css +1 -1
  79. package/assets/esri/themes/light/view.css +1 -1
  80. package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
  81. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  82. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  83. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  84. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  85. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  86. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  87. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  88. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  89. package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
  90. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  91. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  92. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  93. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  94. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  95. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  96. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  97. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  98. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  99. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  100. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  101. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  102. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  103. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  104. package/assets/esri/widgets/Directions/t9n/Directions_no.json +1 -1
  105. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  106. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  107. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  108. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  109. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  110. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  111. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  112. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  113. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  114. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  115. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  116. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  117. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  118. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  119. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  120. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  121. package/assets/esri/widgets/Search/t9n/Search_ar.json +1 -1
  122. package/assets/esri/widgets/Search/t9n/Search_bg.json +1 -1
  123. package/assets/esri/widgets/Search/t9n/Search_bs.json +1 -1
  124. package/assets/esri/widgets/Search/t9n/Search_ca.json +1 -1
  125. package/assets/esri/widgets/Search/t9n/Search_cs.json +1 -1
  126. package/assets/esri/widgets/Search/t9n/Search_da.json +1 -1
  127. package/assets/esri/widgets/Search/t9n/Search_de.json +1 -1
  128. package/assets/esri/widgets/Search/t9n/Search_el.json +1 -1
  129. package/assets/esri/widgets/Search/t9n/Search_es.json +1 -1
  130. package/assets/esri/widgets/Search/t9n/Search_et.json +1 -1
  131. package/assets/esri/widgets/Search/t9n/Search_fi.json +1 -1
  132. package/assets/esri/widgets/Search/t9n/Search_fr.json +1 -1
  133. package/assets/esri/widgets/Search/t9n/Search_he.json +1 -1
  134. package/assets/esri/widgets/Search/t9n/Search_hr.json +1 -1
  135. package/assets/esri/widgets/Search/t9n/Search_hu.json +1 -1
  136. package/assets/esri/widgets/Search/t9n/Search_id.json +1 -1
  137. package/assets/esri/widgets/Search/t9n/Search_it.json +1 -1
  138. package/assets/esri/widgets/Search/t9n/Search_ja.json +1 -1
  139. package/assets/esri/widgets/Search/t9n/Search_ko.json +1 -1
  140. package/assets/esri/widgets/Search/t9n/Search_lt.json +1 -1
  141. package/assets/esri/widgets/Search/t9n/Search_lv.json +1 -1
  142. package/assets/esri/widgets/Search/t9n/Search_nl.json +1 -1
  143. package/assets/esri/widgets/Search/t9n/Search_no.json +1 -1
  144. package/assets/esri/widgets/Search/t9n/Search_pl.json +1 -1
  145. package/assets/esri/widgets/Search/t9n/Search_pt-BR.json +1 -1
  146. package/assets/esri/widgets/Search/t9n/Search_pt-PT.json +1 -1
  147. package/assets/esri/widgets/Search/t9n/Search_ro.json +1 -1
  148. package/assets/esri/widgets/Search/t9n/Search_ru.json +1 -1
  149. package/assets/esri/widgets/Search/t9n/Search_sk.json +1 -1
  150. package/assets/esri/widgets/Search/t9n/Search_sl.json +1 -1
  151. package/assets/esri/widgets/Search/t9n/Search_sr.json +1 -1
  152. package/assets/esri/widgets/Search/t9n/Search_sv.json +1 -1
  153. package/assets/esri/widgets/Search/t9n/Search_th.json +1 -1
  154. package/assets/esri/widgets/Search/t9n/Search_tr.json +1 -1
  155. package/assets/esri/widgets/Search/t9n/Search_uk.json +1 -1
  156. package/assets/esri/widgets/Search/t9n/Search_vi.json +1 -1
  157. package/assets/esri/widgets/Search/t9n/Search_zh-CN.json +1 -1
  158. package/assets/esri/widgets/Search/t9n/Search_zh-HK.json +1 -1
  159. package/assets/esri/widgets/Search/t9n/Search_zh-TW.json +1 -1
  160. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ar.json +1 -0
  161. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bg.json +1 -0
  162. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bs.json +1 -0
  163. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ca.json +1 -0
  164. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_cs.json +1 -0
  165. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_da.json +1 -0
  166. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_de.json +1 -0
  167. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_el.json +1 -0
  168. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_es.json +1 -0
  169. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_et.json +1 -0
  170. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fi.json +1 -0
  171. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fr.json +1 -0
  172. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_he.json +1 -0
  173. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hr.json +1 -0
  174. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hu.json +1 -0
  175. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_id.json +1 -0
  176. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_it.json +1 -0
  177. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ja.json +1 -0
  178. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ko.json +1 -0
  179. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lt.json +1 -0
  180. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lv.json +1 -0
  181. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_nl.json +1 -0
  182. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_no.json +1 -0
  183. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pl.json +1 -0
  184. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-BR.json +1 -0
  185. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-PT.json +1 -0
  186. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ro.json +1 -0
  187. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ru.json +1 -0
  188. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sk.json +1 -0
  189. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sl.json +1 -0
  190. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sr.json +1 -0
  191. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sv.json +1 -0
  192. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_th.json +1 -0
  193. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_tr.json +1 -0
  194. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_uk.json +1 -0
  195. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_vi.json +1 -0
  196. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-CN.json +1 -0
  197. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-HK.json +1 -0
  198. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-TW.json +1 -0
  199. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ar.json +1 -0
  200. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bg.json +1 -0
  201. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bs.json +1 -0
  202. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ca.json +1 -0
  203. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_cs.json +1 -0
  204. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_da.json +1 -0
  205. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_de.json +1 -0
  206. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_el.json +1 -0
  207. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_es.json +1 -0
  208. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_et.json +1 -0
  209. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fi.json +1 -0
  210. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fr.json +1 -0
  211. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_he.json +1 -0
  212. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hr.json +1 -0
  213. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hu.json +1 -0
  214. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_id.json +1 -0
  215. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_it.json +1 -0
  216. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ja.json +1 -0
  217. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ko.json +1 -0
  218. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lt.json +1 -0
  219. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lv.json +1 -0
  220. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_nl.json +1 -0
  221. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_no.json +1 -0
  222. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pl.json +1 -0
  223. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-BR.json +1 -0
  224. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-PT.json +1 -0
  225. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ro.json +1 -0
  226. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ru.json +1 -0
  227. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sk.json +1 -0
  228. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sl.json +1 -0
  229. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sr.json +1 -0
  230. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sv.json +1 -0
  231. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_th.json +1 -0
  232. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_tr.json +1 -0
  233. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_uk.json +1 -0
  234. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_vi.json +1 -0
  235. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-CN.json +1 -0
  236. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-HK.json +1 -0
  237. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-TW.json +1 -0
  238. package/chunks/Bufferer-Dw9Qi4T1.js +5 -0
  239. package/chunks/Distance2DCalculator-CXhBP-8I.js +5 -0
  240. package/chunks/Envelope.js +1 -1
  241. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +5 -0
  242. package/chunks/Geometry.js +1 -1
  243. package/chunks/MultiPathImpl.js +5 -0
  244. package/chunks/OperatorClip.js +1 -1
  245. package/chunks/OperatorCut.js +1 -1
  246. package/chunks/OperatorDensify.js +1 -1
  247. package/chunks/OperatorGeneralize.js +1 -1
  248. package/chunks/OperatorGeodesicBuffer.js +1 -1
  249. package/chunks/OperatorGeodeticArea.js +1 -1
  250. package/chunks/OperatorGeodeticDistance.js +1 -1
  251. package/chunks/OperatorGeodeticLength.js +1 -1
  252. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  253. package/chunks/OperatorProximityGeodesic.js +1 -1
  254. package/chunks/OperatorShapePreservingLength.js +1 -1
  255. package/chunks/OperatorShapePreservingProject.js +1 -1
  256. package/chunks/Point2D.js +1 -1
  257. package/chunks/ProjectionTransformation.js +1 -1
  258. package/chunks/distanceOperator.js +1 -1
  259. package/geometry/operators/extendOperator.js +1 -1
  260. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  261. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  262. package/geometry/operators/gx/operatorBoundary.js +1 -1
  263. package/geometry/operators/gx/operatorBuffer.js +1 -1
  264. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  265. package/geometry/operators/gx/operatorDifference.js +1 -1
  266. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  267. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  268. package/geometry/operators/gx/operatorIntersection.js +1 -1
  269. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  270. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  271. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  272. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  273. package/geometry/operators/gx/operatorOffset.js +1 -1
  274. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  275. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  276. package/geometry/operators/gx/operatorSimplify.js +1 -1
  277. package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
  278. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  279. package/geometry/operators/gx/operatorUnion.js +1 -1
  280. package/geometry/operators/isNearOperator.js +1 -1
  281. package/geometry/operators/reshapeOperator.js +1 -1
  282. package/geometry/operators/support/apiConverter.js +1 -1
  283. package/geometry/operators/support/initNoPeFactory.js +1 -1
  284. package/geometry/operators/support/jsonConverter.js +1 -1
  285. package/geometry.js +1 -1
  286. package/interfaces.d.ts +68 -11
  287. package/layers/KnowledgeGraphLayer.js +1 -1
  288. package/layers/LinkChartLayer.js +1 -1
  289. package/layers/graphics/sources/support/QueryTask.js +1 -1
  290. package/package.json +1 -1
  291. package/pointCloudRenderers.js +1 -1
  292. package/rasterRenderers.js +1 -1
  293. package/renderers.js +1 -1
  294. package/rest/query/executeForCount.js +1 -1
  295. package/support/revision.js +1 -1
  296. package/symbols.js +1 -1
  297. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  298. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementController.js +1 -1
  299. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  300. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  301. package/views/3d/analysis/Dimension/DimensionController.js +1 -1
  302. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  303. package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
  304. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  305. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  306. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  307. package/views/3d/analysis/support/measurementUtils.js +1 -1
  308. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  309. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  310. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  311. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  312. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
  313. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  314. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  315. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  316. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  317. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  318. package/views/3d/layers/DimensionLayerView3D.js +1 -1
  319. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  320. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  321. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  322. package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
  323. package/views/3d/layers/RouteLayerView3D.js +1 -1
  324. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  325. package/views/3d/layers/ViewshedLayerView3D.js +1 -1
  326. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  327. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  328. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  329. package/views/3d/layers/graphics/Labeler.js +1 -1
  330. package/views/3d/layers/support/LayerViewAnalysisViewManager.js +1 -1
  331. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  332. package/views/3d/terrain/TerrainRenderer.js +1 -1
  333. package/views/3d/terrain/TerrainSurface.js +1 -1
  334. package/views/LinkChartView.js +1 -1
  335. package/views/draw/DrawAction.js +1 -1
  336. package/views/draw/DrawGraphicTool.js +1 -1
  337. package/views/draw/DrawOperation.js +1 -1
  338. package/views/draw/DrawScreenTool.js +1 -1
  339. package/views/draw/DrawTool.js +1 -1
  340. package/views/draw/PointDrawAction.js +1 -1
  341. package/views/draw/PolygonDrawAction.js +1 -1
  342. package/views/draw/PolylineDrawAction.js +1 -1
  343. package/views/draw/SegmentDrawAction.js +1 -1
  344. package/views/draw/support/Box.js +1 -1
  345. package/views/draw/support/Reshape.js +1 -1
  346. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  347. package/views/draw/support/tooltipUtils.js +1 -1
  348. package/views/interactive/SegmentLabels.js +1 -1
  349. package/views/interactive/coordinateHelper.js +1 -1
  350. package/views/interactive/snapping/LineSnapper.js +1 -1
  351. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  352. package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
  353. package/views/interactive/snapping/SnappingManager.js +1 -1
  354. package/views/support/automaticAreaMeasurementUtils.js +1 -1
  355. package/views/support/automaticLengthMeasurementUtils.js +1 -1
  356. package/views/support/extentUtils.js +1 -1
  357. package/views/support/geodesicAreaMeasurementUtils.js +1 -1
  358. package/views/support/geodesicLengthMeasurementUtils.js +1 -1
  359. package/views/support/geodesicMeasurementUtils.js +1 -1
  360. package/views/support/layerViewUtils.js +1 -1
  361. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  362. package/widgets/BasemapLayerList.js +1 -1
  363. package/widgets/CatalogLayerList.js +1 -1
  364. package/widgets/Directions/css.js +1 -1
  365. package/widgets/Directions.js +1 -1
  366. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  367. package/widgets/Editor/EditorViewModel.js +1 -1
  368. package/widgets/Editor/UpdateFeaturesWorkflow.d.ts +1 -1
  369. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  370. package/widgets/Editor/UpdateFeaturesWorkflowData.d.ts +1 -1
  371. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  372. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  373. package/widgets/LayerList.js +1 -1
  374. package/widgets/Sketch/SketchViewModel.js +1 -1
  375. package/widgets/TableList.js +1 -1
  376. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  377. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  378. package/assets/esri/core/workers/chunks/009730713ed9bc7c7388.js +0 -1
  379. package/assets/esri/core/workers/chunks/0817ddd885ce8b2459cb.js +0 -1
  380. package/assets/esri/core/workers/chunks/0cce3770591b0730cf22.js +0 -1
  381. package/assets/esri/core/workers/chunks/1991f0d0f0a12175f849.js +0 -1
  382. package/assets/esri/core/workers/chunks/19c50f052eba0553bf4d.js +0 -1
  383. package/assets/esri/core/workers/chunks/1f194ffea16cc6595ecc.js +0 -1
  384. package/assets/esri/core/workers/chunks/320e821af81138fe12ac.js +0 -1
  385. package/assets/esri/core/workers/chunks/394b9723d108cff7136e.js +0 -1
  386. package/assets/esri/core/workers/chunks/4a362a35bcdb8405a53a.js +0 -1
  387. package/assets/esri/core/workers/chunks/52a3d0e041717da7697e.js +0 -1
  388. package/assets/esri/core/workers/chunks/5f766bcb751d66fbf1c8.js +0 -1
  389. package/assets/esri/core/workers/chunks/a70a86ba4e487f62f683.js +0 -346
  390. package/assets/esri/core/workers/chunks/aeb5bbe861f65544d504.js +0 -1
  391. package/assets/esri/core/workers/chunks/b52b28a6f422b10ff166.js +0 -1
  392. package/assets/esri/core/workers/chunks/c07c1bb7ae09136dc1f6.js +0 -1
  393. package/assets/esri/core/workers/chunks/cbbca011f8b176d4b5db.js +0 -1
  394. package/assets/esri/core/workers/chunks/cd5c380196db7fb55242.js +0 -1
  395. package/assets/esri/core/workers/chunks/ce321fd8fc5551e190ec.js +0 -1
  396. package/assets/esri/core/workers/chunks/ce53ddda04e09ba2f860.js +0 -1
  397. package/assets/esri/core/workers/chunks/d6ab65ad864782c50705.js +0 -1
  398. package/assets/esri/core/workers/chunks/da3c62a851a4332f6dda.js +0 -1
  399. package/assets/esri/core/workers/chunks/db3f710d770adf631b28.js +0 -2
  400. package/assets/esri/core/workers/chunks/f4c6ea630cecf0f260d7.js +0 -2
  401. package/chunks/Bufferer-CicaNej1.js +0 -5
  402. package/chunks/Distance2DCalculator-C1KHhZwD.js +0 -5
  403. package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +0 -5
  404. package/chunks/QuadraticBezier.js +0 -5
  405. /package/assets/esri/core/workers/chunks/{0fd6d80393722132e044.js.LICENSE.txt → 0229c573fa8a2fff2d8b.js.LICENSE.txt} +0 -0
  406. /package/assets/esri/core/workers/chunks/{7e1dc8e5e18f18dd21e2.js.LICENSE.txt → 29fb64826bb1351aca8d.js.LICENSE.txt} +0 -0
  407. /package/assets/esri/core/workers/chunks/{ab9614555a15f04396f6.js.LICENSE.txt → 54f981fe0f8851767be9.js.LICENSE.txt} +0 -0
  408. /package/assets/esri/core/workers/chunks/{fbd2f45d5adce4ca323f.js.LICENSE.txt → 73ddb356121add556994.js.LICENSE.txt} +0 -0
  409. /package/assets/esri/core/workers/chunks/{db3f710d770adf631b28.js.LICENSE.txt → 9588328d4ed6b0f04166.js.LICENSE.txt} +0 -0
  410. /package/assets/esri/core/workers/chunks/{f4c6ea630cecf0f260d7.js.LICENSE.txt → aad9a693813b47a51530.js.LICENSE.txt} +0 -0
  411. /package/assets/esri/core/workers/chunks/{e85f892ea44d67d53ff0.js.LICENSE.txt → f3b51aa0a1a8fc3b231c.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{makeHandle as r}from"../../core/handleUtils.js";import{destroyMaybe as o}from"../../core/maybe.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{IDENTITY as a}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{DrawOperation as n}from"./DrawOperation.js";import{ScreenDrawSurface as p}from"./drawSurfaces.js";import{createCircle as c,createSquare as l,createEllipse as d,createRectangle as m}from"./support/createUtils.js";import{AffineCoordinateSystem as u}from"./support/surfaceCoordinateSystems.js";import{InteractiveToolBase as h}from"../interactive/InteractiveToolBase.js";import g from"../overlay/OutlineOverlayItem.js";let y=class extends(t.EventedMixin(h)){constructor(e){super(e),this._overlayItem=void 0,this.geometryType=null,this.mode=null,this.type="draw-screen"}initialize(){this.drawOperation=this._makeDrawOperation();const e=e=>this.drawOperation.on(e,(t=>{this._updateVisuals(),this.emit(e,t)}));this.addHandles([e("vertex-add"),e("vertex-remove"),e("vertex-update"),e("cursor-update"),e("complete")]),this.finishToolCreation()}destroy(){this.drawOperation=o(this.drawOperation),this._set("view",null)}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centeredToggled(e){this._set("centeredToggled",e),this._updateVisuals()}set enabled(e){this.drawOperation.interactive=e,this._set("enabled",e)}set uniformSizeToggled(e){this._set("uniformSizeToggled",e),this._updateVisuals()}get updating(){return this.drawOperation?.updating??!1}get cursor(){return this._get("cursor")??"crosshair"}set cursor(e){this._set("cursor",e),this.drawOperation.cursor=e}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(e){this.destroyed||this.drawOperation.onInputEvent(e)}redo(){this.drawOperation.redo()}undo(){this.drawOperation.undo()}reset(){}_makeDrawOperation(){const{view:e}=this;return new n({view:e,manipulators:this.manipulators,geometryType:v(this.geometryType),drawingMode:this.mode,hasZ:!1,defaultZ:0,snapToSceneEnabled:!1,drawSurface:new p,hasM:!1,snappingManager:null,snappingVisualizer:null,graphic:null,cursor:this.cursor})}get coordinates(){const{drawOperation:e}=this;if(!e?.geometryIncludingUncommittedVertices.length)return[];const{coordinateHelper:t}=e,r=e.committableVertex,o=e.committedVertices.slice();null!=r&&o.push(t.pointToArray(r));const i=o.length;switch(this.geometryType){case"point":return o.slice(0,1);case"circle":case"rectangle":{const t=new u(a,p.spatialReference),r="circle"===this.geometryType?c:l,s="circle"===this.geometryType?d:m;if(1===i&&e.isCompleted){const e=o[0],i=t.makeMapPoint(e[0]+w,e[1]);return r([e,i],t,!0)?.geometry.rings[0]??[]}if(2===i){const e="rectangle"!==this.geometryType,i=this.centeredToggled!==e,a="rectangle"!==this.geometryType;return(this.uniformSizeToggled!==a?r(o,t,i)?.geometry.rings[0]:s(o,t,i)?.geometry.rings[0])??[]}return[]}}return o}_updateVisuals(){if(!this._overlayItem){const e=new g({strokeDash:[5],strokeDashColor:[255,255,255,255]});this.view.overlay?.addItem(e),this.addHandles(r((()=>{this.view.overlay?.removeItem(e),e?.destroy(),this._overlayItem=void 0}))),this._overlayItem=e}this._overlayItem.coordinates=this.coordinates}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}};function v(e){switch(e){case"polygon":case"point":return e;case"circle":case"rectangle":return"segment"}}e([i({value:!1})],y.prototype,"centeredToggled",null),e([i()],y.prototype,"drawOperation",void 0),e([i({value:!0})],y.prototype,"enabled",null),e([i({value:!1})],y.prototype,"uniformSizeToggled",null),e([i({constructOnly:!0})],y.prototype,"geometryType",void 0),e([i({constructOnly:!0})],y.prototype,"mode",void 0),e([i({readOnly:!0})],y.prototype,"type",void 0),e([i({readOnly:!0})],y.prototype,"updating",null),e([i({constructOnly:!0,nonNullable:!0})],y.prototype,"view",void 0),e([i()],y.prototype,"cursor",null),y=e([s("esri.views.draw.DrawScreenTool")],y);const w=48;export{y as DrawScreenTool,v as geometryTypeToDrawOperationGeometryType};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{makeHandle as r}from"../../core/handleUtils.js";import{destroyMaybe as o}from"../../core/maybe.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{IDENTITY as a}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{DrawOperation as n}from"./DrawOperation.js";import{ScreenDrawSurface as p}from"./drawSurfaces.js";import{createCircle as c,createSquare as l,createEllipse as d,createRectangle as m}from"./support/createUtils.js";import{AffineCoordinateSystem as u}from"./support/surfaceCoordinateSystems.js";import{InteractiveToolBase as h}from"../interactive/InteractiveToolBase.js";import g from"../overlay/OutlineOverlayItem.js";let y=class extends(t.EventedMixin(h)){constructor(e){super(e),this._overlayItem=void 0,this.geometryType=null,this.mode=null,this.type="draw-screen"}initialize(){this.drawOperation=this._makeDrawOperation();const e=e=>this.drawOperation.on(e,(t=>{this._updateVisuals(),this.emit(e,t)}));this.addHandles([e("vertex-add"),e("vertex-remove"),e("vertex-update"),e("cursor-update"),e("complete")]),this.finishToolCreation()}destroy(){this.drawOperation=o(this.drawOperation),this._set("view",null)}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centeredToggled(e){this._set("centeredToggled",e),this._updateVisuals()}set enabled(e){this.drawOperation.interactive=e,this._set("enabled",e)}set uniformSizeToggled(e){this._set("uniformSizeToggled",e),this._updateVisuals()}get updating(){return this.drawOperation?.updating??!1}get cursor(){return this._get("cursor")??"crosshair"}set cursor(e){this._set("cursor",e),this.drawOperation.cursor=e}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(e){this.destroyed||this.drawOperation.onInputEvent(e)}redo(){this.drawOperation.redo()}undo(){this.drawOperation.undo()}reset(){}_makeDrawOperation(){const{view:e}=this;return new n({view:e,manipulators:this.manipulators,geometryType:v(this.geometryType),drawingMode:this.mode,hasZ:!1,defaultZ:0,snapToSceneEnabled:!1,drawSurface:new p,hasM:!1,snappingManager:null,snappingVisualizer:null,graphic:null,cursor:this.cursor,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils})}get coordinates(){const{drawOperation:e}=this;if(!e?.geometryIncludingUncommittedVertices.length)return[];const{coordinateHelper:t}=e,r=e.committableVertex,o=e.committedVertices.slice();null!=r&&o.push(t.pointToArray(r));const i=o.length;switch(this.geometryType){case"point":return o.slice(0,1);case"circle":case"rectangle":{const t=new u(a,p.spatialReference),r="circle"===this.geometryType?c:l,s="circle"===this.geometryType?d:m;if(1===i&&e.isCompleted){const e=o[0],i=t.makeMapPoint(e[0]+w,e[1]);return r([e,i],t,!0)?.geometry.rings[0]??[]}if(2===i){const e="rectangle"!==this.geometryType,i=this.centeredToggled!==e,a="rectangle"!==this.geometryType;return(this.uniformSizeToggled!==a?r(o,t,i)?.geometry.rings[0]:s(o,t,i)?.geometry.rings[0])??[]}return[]}}return o}_updateVisuals(){if(!this._overlayItem){const e=new g({strokeDash:[5],strokeDashColor:[255,255,255,255]});this.view.overlay?.addItem(e),this.addHandles(r((()=>{this.view.overlay?.removeItem(e),e?.destroy(),this._overlayItem=void 0}))),this._overlayItem=e}this._overlayItem.coordinates=this.coordinates}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}};function v(e){switch(e){case"polygon":case"point":return e;case"circle":case"rectangle":return"segment"}}e([i({value:!1})],y.prototype,"centeredToggled",null),e([i()],y.prototype,"drawOperation",void 0),e([i({value:!0})],y.prototype,"enabled",null),e([i({value:!1})],y.prototype,"uniformSizeToggled",null),e([i({constructOnly:!0})],y.prototype,"geometryType",void 0),e([i({constructOnly:!0})],y.prototype,"mode",void 0),e([i({readOnly:!0})],y.prototype,"type",void 0),e([i({readOnly:!0})],y.prototype,"updating",null),e([i({constructOnly:!0,nonNullable:!0})],y.prototype,"view",void 0),e([i({constructOnly:!0})],y.prototype,"automaticLengthMeasurementUtils",void 0),e([i()],y.prototype,"cursor",null),y=e([s("esri.views.draw.DrawScreenTool")],y);const w=48;export{y as DrawScreenTool,v 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{destroyMaybe as o}from"../../core/maybe.js";import{property as r}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{getEffectiveElevationInfo as n}from"../../support/elevationInfoUtils.js";import{DrawOperation as a}from"./DrawOperation.js";import{ElevationDrawSurface as s,SceneDrawSurface as p}from"./drawSurfaces.js";import{InteractiveToolBase as d}from"../interactive/InteractiveToolBase.js";let l=class extends(t.EventedMixin(d)){constructor(e){super(e),this.defaultZ=0,this.elevationInfo=null,this.hasZ=!0,this.mode=null,this.snapToScene=null,this.type="draw-3d"}initialize(){const e=this.view,t=n(this.hasZ,this.elevationInfo);this.drawOperation=new a({view:e,manipulators:this.manipulators,geometryType:this.geometryType,drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:"3d"===e.type?new p(e,t):null,elevationDrawSurface:"3d"===e.type?new s(t,this.defaultZ,e):null,hasM:!1,elevationInfo:t}),this.addHandles([this.drawOperation.on("vertex-add",(e=>this.onVertexAdd(e))),this.drawOperation.on("vertex-remove",(e=>this.onVertexRemove(e))),this.drawOperation.on("vertex-update",(e=>this.onVertexUpdate(e))),this.drawOperation.on("cursor-update",(e=>this.onCursorUpdate(e))),this.drawOperation.on("complete",(e=>this.onComplete(e)))]),this.finishToolCreation()}destroy(){this.drawOperation=o(this.drawOperation),this._set("view",null)}set enabled(e){this.drawOperation.interactive=e,this._set("enabled",e)}get updating(){return this.drawOperation?.updating??!1}completeCreateOperation(){this.drawOperation.complete()}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}getVertexCoords(){return this.drawOperation.geometryIncludingUncommittedVertices}onInputEvent(e){this.drawOperation.onInputEvent(e)}canRedo(){return this.drawOperation.canRedo}canUndo(){return this.drawOperation.canUndo}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo()}onComplete(e){this.emit("complete",e)}onCursorUpdate(e){this.emit("cursor-update",e)}onVertexAdd(e){this.emit("vertex-add",e)}onVertexRemove(e){this.emit("vertex-remove",e)}onVertexUpdate(e){this.emit("vertex-update",e)}};e([r({constructOnly:!0,nonNullable:!0})],l.prototype,"defaultZ",void 0),e([r()],l.prototype,"drawOperation",void 0),e([r({constructOnly:!0})],l.prototype,"elevationInfo",void 0),e([r({value:!0})],l.prototype,"enabled",null),e([r({constructOnly:!0})],l.prototype,"geometryType",void 0),e([r({constructOnly:!0})],l.prototype,"hasZ",void 0),e([r({constructOnly:!0})],l.prototype,"mode",void 0),e([r()],l.prototype,"snapToScene",void 0),e([r({readOnly:!0})],l.prototype,"type",void 0),e([r({readOnly:!0})],l.prototype,"updating",null),e([r({constructOnly:!0,nonNullable:!0})],l.prototype,"view",void 0),l=e([i("esri.views.draw.DrawTool")],l);export{l as DrawTool};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{destroyMaybe as o}from"../../core/maybe.js";import{property as r}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{getEffectiveElevationInfo as n}from"../../support/elevationInfoUtils.js";import{DrawOperation as a}from"./DrawOperation.js";import{ElevationDrawSurface as s,SceneDrawSurface as p}from"./drawSurfaces.js";import{InteractiveToolBase as d}from"../interactive/InteractiveToolBase.js";let l=class extends(e.EventedMixin(d)){constructor(t){super(t),this.defaultZ=0,this.elevationInfo=null,this.hasZ=!0,this.mode=null,this.snapToScene=null,this.type="draw-3d"}initialize(){const t=this.view,e=n(this.hasZ,this.elevationInfo);this.drawOperation=new a({view:t,manipulators:this.manipulators,geometryType:this.geometryType,drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:"3d"===t.type?new p(t,e):null,elevationDrawSurface:"3d"===t.type?new s(e,this.defaultZ,t):null,hasM:!1,elevationInfo:e,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils}),this.addHandles([this.drawOperation.on("vertex-add",(t=>this.onVertexAdd(t))),this.drawOperation.on("vertex-remove",(t=>this.onVertexRemove(t))),this.drawOperation.on("vertex-update",(t=>this.onVertexUpdate(t))),this.drawOperation.on("cursor-update",(t=>this.onCursorUpdate(t))),this.drawOperation.on("complete",(t=>this.onComplete(t)))]),this.finishToolCreation()}destroy(){this.drawOperation=o(this.drawOperation),this._set("view",null)}set enabled(t){this.drawOperation.interactive=t,this._set("enabled",t)}get updating(){return this.drawOperation?.updating??!1}completeCreateOperation(){this.drawOperation.complete()}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}getVertexCoords(){return this.drawOperation.geometryIncludingUncommittedVertices}onInputEvent(t){this.drawOperation.onInputEvent(t)}canRedo(){return this.drawOperation.canRedo}canUndo(){return this.drawOperation.canUndo}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo()}onComplete(t){this.emit("complete",t)}onCursorUpdate(t){this.emit("cursor-update",t)}onVertexAdd(t){this.emit("vertex-add",t)}onVertexRemove(t){this.emit("vertex-remove",t)}onVertexUpdate(t){this.emit("vertex-update",t)}};t([r({constructOnly:!0,nonNullable:!0})],l.prototype,"defaultZ",void 0),t([r()],l.prototype,"drawOperation",void 0),t([r({constructOnly:!0})],l.prototype,"elevationInfo",void 0),t([r({value:!0})],l.prototype,"enabled",null),t([r({constructOnly:!0})],l.prototype,"geometryType",void 0),t([r({constructOnly:!0})],l.prototype,"automaticLengthMeasurementUtils",void 0),t([r({constructOnly:!0})],l.prototype,"hasZ",void 0),t([r({constructOnly:!0})],l.prototype,"mode",void 0),t([r()],l.prototype,"snapToScene",void 0),t([r({readOnly:!0})],l.prototype,"type",void 0),t([r({readOnly:!0})],l.prototype,"updating",null),t([r({constructOnly:!0,nonNullable:!0})],l.prototype,"view",void 0),l=t([i("esri.views.draw.DrawTool")],l);export{l as DrawTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import"../../core/Logger.js";import"../../core/has.js";import"../../core/RandomLCG.js";import"../../core/Error.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{DrawTool as r}from"./DrawTool.js";import{CursorUpdateEvent as s,DrawCompleteEvent as n}from"./input/DrawEvents.js";import{ViewEventPriorities as a}from"../input/InputManager.js";import{sketchKeys as d}from"../interactive/keybindings.js";import{createScreenPointFromEvent as h}from"../support/screenUtils.js";let p=class extends o{constructor(t){super(t),this._addVertexOnPointerUp=!1,this._drawTool=null}initialize(){this._addViewHandles(),"3d"===this.view.type&&this._addDrawTool()}destroy(){this._removeDrawTool(),this.emit("destroy")}complete(){this._completeDrawing()}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles([this.view.on("key-down",(t=>{t.key===d.complete&&(this._drawTool?this.complete():(this._abortSnapping(),this._vertexAddHandler(t)))}),a.TOOL)])}_addViewHandles2DOnly(){"2d"===this.view.type&&this.addHandles([this.view.on("pointer-down",(t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._activePointerId=t.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=h(t),"touch"===t.pointerType&&this._updateCursor())}),a.TOOL),this.view.on("pointer-move",(t=>{this._abortSnapping(),this._cursorScreenPoint=h(t),"touch"!==t.pointerType&&this._updateCursor()}),a.TOOL),this.view.on("pointer-drag",(t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)}),a.TOOL),this.view.on("pointer-up",(t=>{if(this._shouldHandlePointerEvent(t))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp)t.stopPropagation(),this._vertexAddHandler(t);else{const e="touch"===t.pointerType;this._updateCursor(e)}}),a.TOOL),this.view.on("drag",["Shift"],(t=>{t.stopPropagation()}),a.TOOL)])}_addDrawTool(){const t=new r({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"point",mode:"click"});this._drawTool=t,this.view.addAndActivateTool(t),this.addHandles([t.on("cursor-update",(e=>{1===e.vertices.length&&this.emit("cursor-update",new s(this.view,e.vertices[0].vertexIndex,t.getVertexCoords()))})),t.on("complete",(e=>{this.emit("draw-complete",new n(t.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()}))])}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(t){const e=this._coordinateHelper.arrayToVector(t);this._isDuplicateOfLastVertex(e)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(e),this.notifyChange("vertices"),this._completeDrawing())}_updateCursor(t=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==e||t||this._pushCursorVertex(e.vertex,(()=>this.emit("cursor-update",new s(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new i(this._stagedVertex):null))))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const t=new n(this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this.removeAllHandles()}};p=t([e("esri.views.draw.PointDrawAction")],p);const l=p;export{l as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import"../../core/Logger.js";import"../../core/has.js";import"../../core/RandomLCG.js";import"../../core/Error.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{CursorUpdateEvent as r,DrawCompleteEvent as s}from"./input/DrawEvents.js";import{ViewEventPriorities as n}from"../input/InputManager.js";import{sketchKeys as a}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as d}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as h}from"../support/screenUtils.js";let p=class extends o{constructor(t){super(t),this._addVertexOnPointerUp=!1,this._drawTool=null}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}complete(){this._completeDrawing()}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles([this.view.on("key-down",(t=>{t.key===a.complete&&(this._drawTool?this.complete():(this._abortSnapping(),this._vertexAddHandler(t)))}),n.TOOL)])}_addViewHandles2DOnly(){"2d"===this.view.type&&this.addHandles([this.view.on("pointer-down",(t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._activePointerId=t.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=h(t),"touch"===t.pointerType&&this._updateCursor())}),n.TOOL),this.view.on("pointer-move",(t=>{this._abortSnapping(),this._cursorScreenPoint=h(t),"touch"!==t.pointerType&&this._updateCursor()}),n.TOOL),this.view.on("pointer-drag",(t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)}),n.TOOL),this.view.on("pointer-up",(t=>{if(this._shouldHandlePointerEvent(t))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp)t.stopPropagation(),this._vertexAddHandler(t);else{const e="touch"===t.pointerType;this._updateCursor(e)}}),n.TOOL),this.view.on("drag",["Shift"],(t=>{t.stopPropagation()}),n.TOOL)])}async _addDrawTool(){const[{DrawTool:t},e]=await Promise.all([import("./DrawTool.js"),d()]),i=new t({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"point",mode:"click",automaticLengthMeasurementUtils:e});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),this.addHandles([i.on("cursor-update",(t=>{1===t.vertices.length&&this.emit("cursor-update",new r(this.view,t.vertices[0].vertexIndex,i.getVertexCoords()))})),i.on("complete",(t=>{this.emit("draw-complete",new s(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()}))]))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(t){const e=this._coordinateHelper.arrayToVector(t);this._isDuplicateOfLastVertex(e)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(e),this.notifyChange("vertices"),this._completeDrawing())}_updateCursor(t=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==e||t||this._pushCursorVertex(e.vertex,(()=>this.emit("cursor-update",new r(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new i(this._stagedVertex):null))))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const t=new s(this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this.removeAllHandles()}};p=t([e("esri.views.draw.PointDrawAction")],p);const l=p;export{l 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./DrawingMode.js";import{DrawTool as a}from"./DrawTool.js";import{VertexRemoveEvent as d,VertexAddEvent as h,CursorUpdateEvent as p,DrawCompleteEvent as l}from"./input/DrawEvents.js";import{ViewEventPriorities as c}from"../input/InputManager.js";import{sketchKeys as _}from"../interactive/keybindings.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";let u=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.mode=n}initialize(){this._addViewHandles(),"3d"===this.view.type&&this._addDrawTool()}destroy(){this._removeDrawTool(),this.emit("destroy")}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}undo(){this._drawTool?this._drawTool.undo():(super.undo(),this.notifyChange("vertices"))}redo(){this._drawTool?this._drawTool.redo():(super.redo(),this.notifyChange("vertices"))}canUndo(){return this._drawTool?.canUndo()??super.canUndo()}canRedo(){return this._drawTool?.canRedo()??super.canRedo()}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles(this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t!==_.vertexAdd||i?t!==_.complete||i?t!==_.undo||this.interactiveUndoDisabled||i?t!==_.redo||this.interactiveUndoDisabled||i||(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e)):(e.stopPropagation(),this._handleVertexAddKey(e))}),c.TOOL))}_addViewHandles2DOnly(){"2d"===this.view.type&&(this.addHandles([this.view.on("click",(e=>{e.stopPropagation()}),c.TOOL),this.view.on("pointer-down",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),"touch"===e.pointerType&&this._updateCursor())}),c.TOOL),this.view.on("pointer-move",(e=>{this._abortSnapping(),this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._cursorScreenPoint=v(e),"touch"!==e.pointerType&&this._updateCursor()}),c.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=v(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)}),c.TOOL),this.view.on("pointer-up",(e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}else{const t="touch"===e.pointerType;this._updateCursor(t)}}),c.TOOL),this.view.on("drag",(e=>{this._dragEnabled&&null!=this._activePointerId&&!this._panEnabled&&e.stopPropagation()}),c.TOOL),this.view.on("drag",["Shift"],(e=>{e.stopPropagation()}),c.TOOL),this.view.on("double-click",(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),c.TOOL),this.view.on("double-click",["Control"],(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),c.TOOL),this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t!==_.pan||i||(e.stopPropagation(),this._panEnabled=!0)}),c.TOOL),this.view.on("key-up",(e=>{e.key===_.pan&&(e.stopPropagation(),this._panEnabled=!1)}),c.TOOL)]),this._addUndoRedoHandles())}_handleVertexAddKey(e){this._drawTool?this._drawTool.drawOperation.commitStagedVertex():this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(e))}_addUndoRedoHandles(){this.addHandles([this._editGeometryOperations.on("vertex-remove",(e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new d(this.view,e.vertices[0].index,t))}})),this._editGeometryOperations.on("vertex-add",(e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new h(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new h(this.view,e.vertices[0].index,t))}}))])}_addDrawTool(){const e=new a({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polygon",mode:this.mode});this._drawTool=e,this.view.addAndActivateTool(e),e.on("vertex-add",(t=>{if(1===t.vertices.length){const{view:i}=this,o=t.vertices[0].vertexIndex,r=e.getVertexCoords();this.emit("vertex-add",new h(i,o,r)),"undo"!==t.operation&&"redo"!==t.operation||this.emit(t.operation,new h(i,o,r))}})),e.on("vertex-remove",(t=>{if(1===t.vertices.length){const{view:i}=this,o=t.vertices[0].vertexIndex,r=e.getVertexCoords();this.emit("vertex-remove",new d(i,o,r)),"undo"!==t.operation&&"redo"!==t.operation||this.emit(t.operation,new d(i,o,r))}})),e.on("cursor-update",(t=>{1===t.vertices.length&&this.emit("cursor-update",new p(this.view,t.vertices[0].vertexIndex,e.getVertexCoords()))})),e.on("complete",(t=>{this.emit("draw-complete",new l(e.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()}))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(t))}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,(()=>this.emit("cursor-update",new p(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new o(this._stagedVertex):null))))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<3)return;this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const e=new l(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}};e([t()],u.prototype,"_dragEnabled",null),e([t()],u.prototype,"_clickEnabled",null),e([t({type:s})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.PolygonDrawAction")],u);const m=u;export{m as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./DrawingMode.js";import{VertexRemoveEvent as a,VertexAddEvent as d,CursorUpdateEvent as h,DrawCompleteEvent as p}from"./input/DrawEvents.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as _}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";let u=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.mode=n}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}undo(){this._drawTool?this._drawTool.undo():(super.undo(),this.notifyChange("vertices"))}redo(){this._drawTool?this._drawTool.redo():(super.redo(),this.notifyChange("vertices"))}canUndo(){return this._drawTool?.canUndo()??super.canUndo()}canRedo(){return this._drawTool?.canRedo()??super.canRedo()}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles(this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t!==c.vertexAdd||i?t!==c.complete||i?t!==c.undo||this.interactiveUndoDisabled||i?t!==c.redo||this.interactiveUndoDisabled||i||(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e)):(e.stopPropagation(),this._handleVertexAddKey(e))}),l.TOOL))}_addViewHandles2DOnly(){"2d"===this.view.type&&(this.addHandles([this.view.on("click",(e=>{e.stopPropagation()}),l.TOOL),this.view.on("pointer-down",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),"touch"===e.pointerType&&this._updateCursor())}),l.TOOL),this.view.on("pointer-move",(e=>{this._abortSnapping(),this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._cursorScreenPoint=v(e),"touch"!==e.pointerType&&this._updateCursor()}),l.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=v(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)}),l.TOOL),this.view.on("pointer-up",(e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}else{const t="touch"===e.pointerType;this._updateCursor(t)}}),l.TOOL),this.view.on("drag",(e=>{this._dragEnabled&&null!=this._activePointerId&&!this._panEnabled&&e.stopPropagation()}),l.TOOL),this.view.on("drag",["Shift"],(e=>{e.stopPropagation()}),l.TOOL),this.view.on("double-click",(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),l.TOOL),this.view.on("double-click",["Control"],(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),l.TOOL),this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t!==c.pan||i||(e.stopPropagation(),this._panEnabled=!0)}),l.TOOL),this.view.on("key-up",(e=>{e.key===c.pan&&(e.stopPropagation(),this._panEnabled=!1)}),l.TOOL)]),this._addUndoRedoHandles())}_handleVertexAddKey(e){this._drawTool?this._drawTool.drawOperation.commitStagedVertex():this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(e))}_addUndoRedoHandles(){this.addHandles([this._editGeometryOperations.on("vertex-remove",(e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new a(this.view,e.vertices[0].index,t))}})),this._editGeometryOperations.on("vertex-add",(e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new d(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new d(this.view,e.vertices[0].index,t))}}))])}async _addDrawTool(){const[{DrawTool:e},t]=await Promise.all([import("./DrawTool.js"),_()]),i=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polygon",mode:this.mode,automaticLengthMeasurementUtils:t});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),i.on("vertex-add",(e=>{if(1===e.vertices.length){const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-add",new d(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new d(t,o,r))}})),i.on("vertex-remove",(e=>{if(1===e.vertices.length){const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-remove",new a(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new a(t,o,r))}})),i.on("cursor-update",(e=>{1===e.vertices.length&&this.emit("cursor-update",new h(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))})),i.on("complete",(e=>{this.emit("draw-complete",new p(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()})))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(t))}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,(()=>this.emit("cursor-update",new h(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new o(this._stagedVertex):null))))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<3)return;this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const e=new p(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}};e([t()],u.prototype,"_dragEnabled",null),e([t()],u.prototype,"_clickEnabled",null),e([t({type:s})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.PolygonDrawAction")],u);const m=u;export{m 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./DrawingMode.js";import{DrawTool as d}from"./DrawTool.js";import{VertexRemoveEvent as a,VertexAddEvent as h,CursorUpdateEvent as p,DrawCompleteEvent as l}from"./input/DrawEvents.js";import{ViewEventPriorities as c}from"../input/InputManager.js";import{sketchKeys as _}from"../interactive/keybindings.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";let u=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.mode=n}initialize(){this._addViewHandles(),"3d"===this.view.type&&this._addDrawTool()}destroy(){this._removeDrawTool(),this.emit("destroy")}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}undo(){this._drawTool?this._drawTool.undo():(super.undo(),this.notifyChange("vertices"))}redo(){this._drawTool?this._drawTool.redo():(super.redo(),this.notifyChange("vertices"))}canUndo(){return this._drawTool?.canUndo()??super.canUndo()}canRedo(){return this._drawTool?.canRedo()??super.canRedo()}complete(){this._completeDrawing()}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles([this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t!==_.vertexAdd||i?t!==_.complete||i?t!==_.undo||this.interactiveUndoDisabled||i?t!==_.redo||this.interactiveUndoDisabled||i||(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e)):(e.stopPropagation(),this._handleVertexAddKey(e))}),c.TOOL)])}_addViewHandles2DOnly(){"2d"===this.view.type&&(this.addHandles([this.view.on("click",(e=>{e.stopPropagation()}),c.TOOL),this.view.on("pointer-down",(e=>{this._shouldHandlePointerEvent(e)&&!this._panEnabled&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),"touch"===e.pointerType&&this._updateCursor())}),c.TOOL),this.view.on("pointer-move",(e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=v(e),"touch"!==e.pointerType&&this._updateCursor()}),c.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=v(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)}),c.TOOL),this.view.on("pointer-up",(e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}else{const t="touch"===e.pointerType;this._updateCursor(t)}}),c.TOOL),this.view.on("drag",(e=>{this._dragEnabled&&null!=this._activePointerId&&!this._panEnabled&&e.stopPropagation()}),c.TOOL),this.view.on("drag",["Shift"],(e=>{e.stopPropagation()}),c.TOOL),this.view.on("double-click",(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),c.TOOL),this.view.on("double-click",["Control"],(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),c.TOOL),this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t!==_.pan||i||(e.stopPropagation(),this._panEnabled=!0)}),c.TOOL),this.view.on("key-up",(e=>{e.key===_.pan&&(e.stopPropagation(),this._panEnabled=!1)}),c.TOOL)]),this._addUndoRedoHandles())}_handleVertexAddKey(e){this._drawTool?this._drawTool.drawOperation.commitStagedVertex():this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(e))}_addUndoRedoHandles(){this.addHandles([this._editGeometryOperations.on("vertex-remove",(e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new a(this.view,e.vertices[0].index,t))}})),this._editGeometryOperations.on("vertex-add",(e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new h(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new h(this.view,e.vertices[0].index,t))}}))])}_addDrawTool(){const e=new d({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polyline",mode:this.mode});this._drawTool=e,this.view.addAndActivateTool(e),this.addHandles([e.on("vertex-add",(t=>{if(1!==t.vertices.length)return;const{view:i}=this,o=t.vertices[0].vertexIndex,r=e.getVertexCoords();this.emit("vertex-add",new h(i,o,r)),"undo"!==t.operation&&"redo"!==t.operation||this.emit(t.operation,new h(i,o,r))})),e.on("vertex-remove",(t=>{if(1!==t.vertices.length)return;const{view:i}=this,o=t.vertices[0].vertexIndex,r=e.getVertexCoords();this.emit("vertex-remove",new a(i,o,r)),"undo"!==t.operation&&"redo"!==t.operation||this.emit(t.operation,new a(i,o,r))})),e.on("cursor-update",(t=>{1===t.vertices.length&&this.emit("cursor-update",new p(this.view,t.vertices[0].vertexIndex,e.getVertexCoords()))})),e.on("complete",(t=>{this.emit("draw-complete",new l(e.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()}))])}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(t))}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,(()=>this.emit("cursor-update",new p(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new o(this._stagedVertex):null))))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<2)return;this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const e=new l(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}};e([t()],u.prototype,"_clickEnabled",null),e([t()],u.prototype,"_dragEnabled",null),e([t({type:s})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.PolylineDrawAction")],u);const m=u;export{m as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./DrawingMode.js";import{VertexRemoveEvent as a,VertexAddEvent as d,CursorUpdateEvent as h,DrawCompleteEvent as p}from"./input/DrawEvents.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as _}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";let u=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.mode=n}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}undo(){this._drawTool?this._drawTool.undo():(super.undo(),this.notifyChange("vertices"))}redo(){this._drawTool?this._drawTool.redo():(super.redo(),this.notifyChange("vertices"))}canUndo(){return this._drawTool?.canUndo()??super.canUndo()}canRedo(){return this._drawTool?.canRedo()??super.canRedo()}complete(){this._completeDrawing()}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles([this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t!==c.vertexAdd||i?t!==c.complete||i?t!==c.undo||this.interactiveUndoDisabled||i?t!==c.redo||this.interactiveUndoDisabled||i||(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e)):(e.stopPropagation(),this._handleVertexAddKey(e))}),l.TOOL)])}_addViewHandles2DOnly(){"2d"===this.view.type&&(this.addHandles([this.view.on("click",(e=>{e.stopPropagation()}),l.TOOL),this.view.on("pointer-down",(e=>{this._shouldHandlePointerEvent(e)&&!this._panEnabled&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),"touch"===e.pointerType&&this._updateCursor())}),l.TOOL),this.view.on("pointer-move",(e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=v(e),"touch"!==e.pointerType&&this._updateCursor()}),l.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=v(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)}),l.TOOL),this.view.on("pointer-up",(e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}else{const t="touch"===e.pointerType;this._updateCursor(t)}}),l.TOOL),this.view.on("drag",(e=>{this._dragEnabled&&null!=this._activePointerId&&!this._panEnabled&&e.stopPropagation()}),l.TOOL),this.view.on("drag",["Shift"],(e=>{e.stopPropagation()}),l.TOOL),this.view.on("double-click",(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),l.TOOL),this.view.on("double-click",["Control"],(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),l.TOOL),this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t!==c.pan||i||(e.stopPropagation(),this._panEnabled=!0)}),l.TOOL),this.view.on("key-up",(e=>{e.key===c.pan&&(e.stopPropagation(),this._panEnabled=!1)}),l.TOOL)]),this._addUndoRedoHandles())}_handleVertexAddKey(e){this._drawTool?this._drawTool.drawOperation.commitStagedVertex():this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(e))}_addUndoRedoHandles(){this.addHandles([this._editGeometryOperations.on("vertex-remove",(e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new a(this.view,e.vertices[0].index,t))}})),this._editGeometryOperations.on("vertex-add",(e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new d(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new d(this.view,e.vertices[0].index,t))}}))])}async _addDrawTool(){const[{DrawTool:e},t]=await Promise.all([import("./DrawTool.js"),_()]),i=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polyline",mode:this.mode,automaticLengthMeasurementUtils:t});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),this.addHandles([i.on("vertex-add",(e=>{if(1!==e.vertices.length)return;const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-add",new d(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new d(t,o,r))})),i.on("vertex-remove",(e=>{if(1!==e.vertices.length)return;const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-remove",new a(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new a(t,o,r))})),i.on("cursor-update",(e=>{1===e.vertices.length&&this.emit("cursor-update",new h(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))})),i.on("complete",(e=>{this.emit("draw-complete",new p(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()}))]))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(t))}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,(()=>this.emit("cursor-update",new h(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new o(this._stagedVertex):null))))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<2)return;this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const e=new p(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}};e([t()],u.prototype,"_clickEnabled",null),e([t()],u.prototype,"_dragEnabled",null),e([t({type:s})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.PolylineDrawAction")],u);const m=u;export{m 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import r from"../../geometry/Point.js";import{ViewingMode as o}from"../ViewingMode.js";import s from"./DrawAction.js";import{DrawTool as n}from"./DrawTool.js";import{VertexAddEvent as a,CursorUpdateEvent as d,DrawCompleteEvent as h}from"./input/DrawEvents.js";import{createViewAlignedCoordinateSystem as p}from"./support/surfaceCoordinateSystems.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{EditGeometry as _,Component as m}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as g}from"../interactive/editGeometry/EditGeometryOperations.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";const u=["freehand","click"];let w=class extends s{constructor(e){super(e),this._isDragging=!1,this._panEnabled=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.viewAlignedCoordinateSystem=null,this.mode="freehand"}initialize(){"2d"===this.view.type?this._addViewHandles():this._addDrawTool()}destroy(){this._removeDrawTool(),this.emit("destroy")}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){"click"===this.mode?this.addHandles(this._getClickModeViewHandles()):this.addHandles(this._getDragModeViewHandles())}_getDragModeViewHandles(){return[this.view.on("immediate-click",(e=>{if(e.stopPropagation(),e.mapPoint&&!this._panEnabled){null!=this.getCoordsFromScreenPoint(v(e))&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))}}),l.TOOL),this.view.on("pointer-down",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._panEnabled||(this._resetGeometry(),this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),this._activePointerId=e.pointerId,this._vertexAddHandler(e),this._isDragging=!1,"touch"===e.pointerType&&this._updateCursor()))}),l.TOOL),this.view.on("pointer-move",(e=>{this._abortSnapping(),null==this._activePointerId&&"touch"!==e.pointerType&&(this._cursorScreenPoint=v(e),this._updateCursor())}),l.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0,this._cursorScreenPoint=v(e),this._updateCursor())}),l.TOOL),this.view.on("pointer-up",(e=>{this._shouldHandlePointerEvent(e)&&this._addVertexOnPointerUp&&(this._abortSnapping(),this._activePointerId=null,this._isDragging&&this._vertexAddHandler(e),2===this._committedVertices.length&&this._drawCompleteHandler(e),this._isDragging=!1)}),l.TOOL),this.view.on("key-down",(e=>{e.key===c.complete&&this._cursorScreenPoint?(this._abortSnapping(),this._vertexAddHandler(e),this._drawCompleteHandler(e)):e.key===c.pan&&(this._panEnabled=!0)}),l.TOOL),this.view.on("key-up",(e=>{e.key===c.pan&&(this._panEnabled=!1)}),l.TOOL),this.view.on("drag",(e=>{null!=this._activePointerId&&e.stopPropagation()}),l.TOOL),this.view.on("drag",["Shift"],(e=>{e.stopPropagation()}),l.TOOL)]}_getClickModeViewHandles(){return[this.view.on("pointer-down",(e=>{this._abortSnapping(),this._cursorScreenPoint=v(e),this._activePointerId=e.pointerId,this._isDragging=!1,"touch"===e.pointerType&&this._updateCursor()}),l.TOOL),this.view.on("pointer-move",(e=>{this._abortSnapping(),this._cursorScreenPoint=v(e),null==this._activePointerId&&"touch"!==e.pointerType&&this._updateCursor()}),l.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0)}),l.TOOL),this.view.on("pointer-up",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=null,e.stopPropagation(),this._isDragging||this._vertexAddHandler(e),2!==this.vertices.length||this._isDragging||this._drawCompleteHandler(e),this._isDragging=!1)}),l.TOOL),this.view.on("key-down",(e=>{e.key===c.vertexAdd&&this._cursorScreenPoint&&(this._vertexAddHandler(e),2===this.vertices.length&&this._drawCompleteHandler(e)),e.key===c.complete&&this._cursorScreenPoint&&2===this.vertices.length&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))}),l.TOOL)]}_addDrawTool(){const e=new n({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"segment",mode:this.mode});this._drawTool=e,this.view.addAndActivateTool(e),this.addHandles([e.on("vertex-add",(t=>{1===t.vertices.length&&this.emit("vertex-add",new a(this.view,t.vertices[0].vertexIndex,e.getVertexCoords()))})),e.on("cursor-update",(t=>{1===t.vertices.length&&this.emit("cursor-update",new d(this.view,t.vertices[0].vertexIndex,e.getVertexCoords()))})),e.on("complete",(t=>{this.emit("draw-complete",new h(e.getVertexCoords())),this._removeDrawTool()})),this.view.on("key-down",(t=>{t.key!==c.vertexAdd||t.repeat||"click"!==this.mode?t.key!==c.complete||t.repeat||e.completeCreateOperation():e.drawOperation.numCommittedVertices>0?e.completeCreateOperation():e.drawOperation.commitStagedVertex()}),l.TOOL)])}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(t))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(t),1===this._committedVertices.length&&(this.viewAlignedCoordinateSystem=p(this.view,this._committedVertices[0]));const i=this._committedVertices.length-1,r=new a(this.view,i,this.vertices);this.emit("vertex-add",r)}_updateCursor(){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null!=e&&this._pushCursorVertex(e.vertex,(()=>this.emit("cursor-update",new d(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new r(this._stagedVertex):null))))}_completeDrawing(){if(this._drawTool)return this._drawTool.completeCreateOperation(),void this.removeAllHandles();if(this._activePointerId=null,this._popCursorVertex(),this._cursorScreenPoint=null,this._isDragging=!1,this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;const e=new h(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}_resetGeometry(){this._editGeometryOperations.destroy(),this._editGeometryOperations=new g(new _("polygon",this._coordinateHelper),o.Local),this._activeComponent=new m(this._coordinateHelper.spatialReference,o.Local),this._editGeometryOperations.data.components.push(this._activeComponent)}};e([t({type:u})],w.prototype,"mode",void 0),w=e([i("esri.views.draw.SegmentDrawAction")],w);const O=w;export{O as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import r from"../../geometry/Point.js";import{ViewingMode as s}from"../ViewingMode.js";import o from"./DrawAction.js";import{VertexAddEvent as n,CursorUpdateEvent as a,DrawCompleteEvent as d}from"./input/DrawEvents.js";import{createViewAlignedCoordinateSystem as h}from"./support/surfaceCoordinateSystems.js";import{ViewEventPriorities as p}from"../input/InputManager.js";import{sketchKeys as l}from"../interactive/keybindings.js";import{EditGeometry as c,Component as _}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as m}from"../interactive/editGeometry/EditGeometryOperations.js";import{loadAutomaticLengthMeasurementUtils as g}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as u}from"../support/screenUtils.js";const v=["freehand","click"];let w=class extends o{constructor(e){super(e),this._isDragging=!1,this._panEnabled=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.viewAlignedCoordinateSystem=null,this.mode="freehand"}initialize(){"2d"===this.view.type?this._addViewHandles():this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){"click"===this.mode?this.addHandles(this._getClickModeViewHandles()):this.addHandles(this._getDragModeViewHandles())}_getDragModeViewHandles(){return[this.view.on("immediate-click",(e=>{if(e.stopPropagation(),e.mapPoint&&!this._panEnabled){null!=this.getCoordsFromScreenPoint(u(e))&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))}}),p.TOOL),this.view.on("pointer-down",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._panEnabled||(this._resetGeometry(),this._addVertexOnPointerUp=!0,this._cursorScreenPoint=u(e),this._activePointerId=e.pointerId,this._vertexAddHandler(e),this._isDragging=!1,"touch"===e.pointerType&&this._updateCursor()))}),p.TOOL),this.view.on("pointer-move",(e=>{this._abortSnapping(),null==this._activePointerId&&"touch"!==e.pointerType&&(this._cursorScreenPoint=u(e),this._updateCursor())}),p.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0,this._cursorScreenPoint=u(e),this._updateCursor())}),p.TOOL),this.view.on("pointer-up",(e=>{this._shouldHandlePointerEvent(e)&&this._addVertexOnPointerUp&&(this._abortSnapping(),this._activePointerId=null,this._isDragging&&this._vertexAddHandler(e),2===this._committedVertices.length&&this._drawCompleteHandler(e),this._isDragging=!1)}),p.TOOL),this.view.on("key-down",(e=>{e.key===l.complete&&this._cursorScreenPoint?(this._abortSnapping(),this._vertexAddHandler(e),this._drawCompleteHandler(e)):e.key===l.pan&&(this._panEnabled=!0)}),p.TOOL),this.view.on("key-up",(e=>{e.key===l.pan&&(this._panEnabled=!1)}),p.TOOL),this.view.on("drag",(e=>{null!=this._activePointerId&&e.stopPropagation()}),p.TOOL),this.view.on("drag",["Shift"],(e=>{e.stopPropagation()}),p.TOOL)]}_getClickModeViewHandles(){return[this.view.on("pointer-down",(e=>{this._abortSnapping(),this._cursorScreenPoint=u(e),this._activePointerId=e.pointerId,this._isDragging=!1,"touch"===e.pointerType&&this._updateCursor()}),p.TOOL),this.view.on("pointer-move",(e=>{this._abortSnapping(),this._cursorScreenPoint=u(e),null==this._activePointerId&&"touch"!==e.pointerType&&this._updateCursor()}),p.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0)}),p.TOOL),this.view.on("pointer-up",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=null,e.stopPropagation(),this._isDragging||this._vertexAddHandler(e),2!==this.vertices.length||this._isDragging||this._drawCompleteHandler(e),this._isDragging=!1)}),p.TOOL),this.view.on("key-down",(e=>{e.key===l.vertexAdd&&this._cursorScreenPoint&&(this._vertexAddHandler(e),2===this.vertices.length&&this._drawCompleteHandler(e)),e.key===l.complete&&this._cursorScreenPoint&&2===this.vertices.length&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))}),p.TOOL)]}async _addDrawTool(){const[{DrawTool:e},t]=await Promise.all([import("./DrawTool.js"),g()]),i=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"segment",mode:this.mode,automaticLengthMeasurementUtils:t});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),this.addHandles([i.on("vertex-add",(e=>{1===e.vertices.length&&this.emit("vertex-add",new n(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))})),i.on("cursor-update",(e=>{1===e.vertices.length&&this.emit("cursor-update",new a(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))})),i.on("complete",(e=>{this.emit("draw-complete",new d(i.getVertexCoords())),this._removeDrawTool()})),this.view.on("key-down",(e=>{e.key!==l.vertexAdd||e.repeat||"click"!==this.mode?e.key!==l.complete||e.repeat||i.completeCreateOperation():i.drawOperation.numCommittedVertices>0?i.completeCreateOperation():i.drawOperation.commitStagedVertex()}),p.TOOL)]))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(t))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(t),1===this._committedVertices.length&&(this.viewAlignedCoordinateSystem=h(this.view,this._committedVertices[0]));const i=this._committedVertices.length-1,r=new n(this.view,i,this.vertices);this.emit("vertex-add",r)}_updateCursor(){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null!=e&&this._pushCursorVertex(e.vertex,(()=>this.emit("cursor-update",new a(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new r(this._stagedVertex):null))))}_completeDrawing(){if(this._drawTool)return this._drawTool.completeCreateOperation(),void this.removeAllHandles();if(this._activePointerId=null,this._popCursorVertex(),this._cursorScreenPoint=null,this._isDragging=!1,this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;const e=new d(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}_resetGeometry(){this._editGeometryOperations.destroy(),this._editGeometryOperations=new m(new c("polygon",this._coordinateHelper),s.Local),this._activeComponent=new _(this._coordinateHelper.spatialReference,s.Local),this._editGeometryOperations.data.components.push(this._activeComponent)}};e([t({type:v})],w.prototype,"mode",void 0),w=e([i("esri.views.draw.SegmentDrawAction")],w);const y=w;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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.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 p from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import d from"../../../geometry/Polyline.js";import{create as m}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as u}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as g}from"../../../geometry/support/coordsUtils.js";import y from"../../../geometry/support/rotate.js";import v from"../../../symbols/SimpleFillSymbol.js";import f from"../../../symbols/SimpleLineSymbol.js";import G from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as b,scale as x,getScaleRatio as w,getRotationAngle as S}from"./drawUtils.js";import k from"./GraphicMover.js";import R from"./HighlightHelper.js";import{addUniqueLayer as M}from"./layerUtils.js";import{settings as I}from"./settings.js";import C from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as H}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as O}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as j}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as T}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{autoDistanceBetweenPoints2D as E}from"../../support/automaticLengthMeasurementUtils.js";import{autoSize2D as L}from"../../support/extentUtils.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 N{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class B{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class Y{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=I.transformGraphics,V={centerIndicator:new G({style:"cross",size:D.center.size,color:D.center.color}),fill:{default:new v({color:D.fill.color,outline:{color:D.fill.outlineColor,join:"round",width:1}}),active:new v({color:D.fill.stagedColor,outline:{color:D.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new G({style:"square",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new G({style:"square",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotator:{default:new G({style:"circle",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotatorLine:new f({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.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=V,this.sketchOptions=new C,this.view=null,this._getBounds=(()=>{const t=m();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("multipoint"===s.type){const e=g(s);[i,o,r,a]=u(t,[e])}else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=g(s);[i,o,r,a]=u(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new R({view:t}),this._setup(),this.addHandles([r((()=>t?.ready),(()=>{const{layer:t,view:e}=this;M(e,t)}),{once:!0,initial:!0}),a((()=>this.preserveAspectRatio),(()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))})),a((()=>t?.scale),(()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()})),a((()=>this.graphics),(()=>this.refresh())),a((()=>this.layer),((t,e)=>{e&&this._resetGraphics(e),this.refresh()})),a((()=>[this.highlightsEnabled,this.highlightName]),(()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})),a((()=>this.sketchOptions.tooltips.effectiveEnabled),(e=>{this.tooltip=e?H((()=>({view:t,options:this.sketchOptions.tooltips}))):s(this.tooltip)}),h),a((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),c),this.on("move-start",(t=>this.callbacks?.onMoveStart?.(t))),this.on("move",(t=>this.callbacks?.onMove?.(t))),this.on("move-stop",(t=>this.callbacks?.onMoveStop?.(t))),this.on("rotate-start",(t=>this.callbacks?.onRotateStart?.(t))),this.on("rotate",(t=>this.callbacks?.onRotate?.(t))),this.on("rotate-stop",(t=>this.callbacks?.onRotateStop?.(t))),this.on("scale-start",(t=>this.callbacks?.onScaleStart?.(t))),this.on("scale",(t=>this.callbacks?.onScale?.(t))),this.on("scale-stop",(t=>this.callbacks?.onScaleStop?.(t)))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=b(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",new B(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=x(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 p(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=y(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",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.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new k({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(m()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map((t=>this._getGraphicInfo(t)))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(m(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h}=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 Y(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 N(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 B(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:_}=e,{resolution:d,transform:m}=o.state,u=i.indexOf(t);1!==u&&5!==u||this._updateX(t,r),3!==u&&7!==u||this._updateY(t,a);const{x:g,y}=t.geometry,v=m[0]*g+m[2]*y+m[4],f=m[1]*g+m[3]*y+m[5],G=h?.map((t=>t.geometry))??[],S=G.every((t=>"point"===t.type));if((0===_||0===c)&&S){const t=J((g-n)/d),i=J((l-y)/d);for(let e=0;e<G.length;e++)this.graphics[e].geometry=b(G[e],t,i,o,!0);return this._centerGraphic.geometry=new p(g,y,o.spatialReference),void(this._backgroundGraphic.geometry=b(e.box,t,i,o,!0))}if(s){const t=J(m[0]*r+m[2]*a+m[4],2),e=J(m[1]*r+m[3]*a+m[5],2),i=J(m[0]*n+m[2]*l+m[4],2),s=J(m[1]*n+m[3]*l+m[5],2);let o=w(t,e,i,s,v,f);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=x(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=g-n,i=l-y;if(1===u||5===u?t=0:3!==u&&7!==u||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let m=(_+(n>r?t:-1*t))/_,v=(c+(l<a?i:-1*i))/c;1!==u&&5!==u&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==u&&7!==u&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(s-r)/d,w=(h-a)/d,S=x(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=b(S,f,w,o,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),M=(k-r)/d,I=-1*(R-a)/d;for(const e of G){const t=G.indexOf(e),i=x(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=b(i,M,I,o,!0)}this._centerGraphic.geometry=new p(k,R,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new p(s,o,h),n=new p(e,i,h),l=t.geometry;this._angleOfRotation=S(c,l,n);const _=this._startInfo.graphicInfos?.map((t=>t.geometry))??[];for(const p of _){const t=_.indexOf(p),e=y(p,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=y(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=y(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=b(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=b(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach((t=>t.visible=!1))}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach(((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)}))}_updateBackgroundGraphic(){const t=this._getCoordinates().map((([t,e])=>[t,e]));this._backgroundGraphic.geometry=new _({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(m()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new p(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new p(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new d({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new p(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new p(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new p(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some((t=>null!=t?.geometry&&"extent"===t.geometry.type))}_getBoxBounds(t){const e=this.graphics.map((t=>t.geometry));return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(m());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new O({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o}=this;if(null==t)return;const r=this._getCoordinates(),a=L({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 j({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 T({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,a=s.toMap(t),h=s.toMap({x:e,y:i}),c=E(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,"highlightName",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:C})],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 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 p from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import d from"../../../geometry/Polyline.js";import{create as m}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as u}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as g}from"../../../geometry/support/coordsUtils.js";import y from"../../../geometry/support/rotate.js";import v from"../../../symbols/SimpleFillSymbol.js";import f from"../../../symbols/SimpleLineSymbol.js";import G from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as b,scale as w,getScaleRatio as x,getRotationAngle as S}from"./drawUtils.js";import k from"./GraphicMover.js";import R from"./HighlightHelper.js";import{addUniqueLayer as M}from"./layerUtils.js";import{settings as I}from"./settings.js";import C from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as H}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as O}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as j}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as T}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{autoSize2D as L}from"../../support/extentUtils.js";class E{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class z{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class B{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 Y{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 A{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale"}}class X{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-stop"}}const D=I.transformGraphics,F={centerIndicator:new G({style:"cross",size:D.center.size,color:D.center.color}),fill:{default:new v({color:D.fill.color,outline:{color:D.fill.outlineColor,join:"round",width:1}}),active:new v({color:D.fill.stagedColor,outline:{color:D.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new G({style:"square",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new G({style:"square",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotator:{default:new G({style:"circle",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotatorLine:new f({color:D.line.color,width:1})};let V=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.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=F,this.sketchOptions=new C,this.view=null,this._getBounds=(()=>{const t=m();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("multipoint"===s.type){const e=g(s);[i,o,r,a]=u(t,[e])}else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=g(s);[i,o,r,a]=u(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new R({view:t}),this._setup(),this.addHandles([r((()=>t?.ready),(()=>{const{layer:t,view:e}=this;M(e,t)}),{once:!0,initial:!0}),a((()=>this.preserveAspectRatio),(()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))})),a((()=>t?.scale),(()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()})),a((()=>this.graphics),(()=>this.refresh())),a((()=>this.layer),((t,e)=>{e&&this._resetGraphics(e),this.refresh()})),a((()=>[this.highlightsEnabled,this.highlightName]),(()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})),a((()=>this.sketchOptions.tooltips.effectiveEnabled),(e=>{this.tooltip=e?H((()=>({view:t,options:this.sketchOptions.tooltips}))):s(this.tooltip)}),h),a((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),c),this.on("move-start",(t=>this.callbacks?.onMoveStart?.(t))),this.on("move",(t=>this.callbacks?.onMove?.(t))),this.on("move-stop",(t=>this.callbacks?.onMoveStop?.(t))),this.on("rotate-start",(t=>this.callbacks?.onRotateStart?.(t))),this.on("rotate",(t=>this.callbacks?.onRotate?.(t))),this.on("rotate-stop",(t=>this.callbacks?.onRotateStop?.(t))),this.on("scale-start",(t=>this.callbacks?.onScaleStart?.(t))),this.on("scale",(t=>this.callbacks?.onScale?.(t))),this.on("scale-stop",(t=>this.callbacks?.onScaleStop?.(t)))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=b(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",new B(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=w(s,t,e);i.geometry=o}this.refresh(),this.emit("scale-stop",new X(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 p(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=y(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",new Y(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.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new k({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(m()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map((t=>this._getGraphicInfo(t)))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(m(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h}=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 E(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 A(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 z(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 Y(this.graphics,e,i))):h.includes(e)?this.emit("scale-stop",new X(this.graphics,e,r,a)):this.emit("move-stop",new B(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:_}=e,{resolution:d,transform:m}=o.state,u=i.indexOf(t);1!==u&&5!==u||this._updateX(t,r),3!==u&&7!==u||this._updateY(t,a);const{x:g,y}=t.geometry,v=m[0]*g+m[2]*y+m[4],f=m[1]*g+m[3]*y+m[5],G=h?.map((t=>t.geometry))??[],S=G.every((t=>"point"===t.type));if((0===_||0===c)&&S){const t=q((g-n)/d),i=q((l-y)/d);for(let e=0;e<G.length;e++)this.graphics[e].geometry=b(G[e],t,i,o,!0);return this._centerGraphic.geometry=new p(g,y,o.spatialReference),void(this._backgroundGraphic.geometry=b(e.box,t,i,o,!0))}if(s){const t=q(m[0]*r+m[2]*a+m[4],2),e=q(m[1]*r+m[3]*a+m[5],2),i=q(m[0]*n+m[2]*l+m[4],2),s=q(m[1]*n+m[3]*l+m[5],2);let o=x(t,e,i,s,v,f);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=w(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=g-n,i=l-y;if(1===u||5===u?t=0:3!==u&&7!==u||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let m=(_+(n>r?t:-1*t))/_,v=(c+(l<a?i:-1*i))/c;1!==u&&5!==u&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==u&&7!==u&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(s-r)/d,x=(h-a)/d,S=w(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=b(S,f,x,o,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),M=(k-r)/d,I=-1*(R-a)/d;for(const e of G){const t=G.indexOf(e),i=w(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=b(i,M,I,o,!0)}this._centerGraphic.geometry=new p(k,R,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new p(s,o,h),n=new p(e,i,h),l=t.geometry;this._angleOfRotation=S(c,l,n);const _=this._startInfo.graphicInfos?.map((t=>t.geometry))??[];for(const p of _){const t=_.indexOf(p),e=y(p,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=y(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=y(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=b(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=b(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=b(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach((t=>t.visible=!1))}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach(((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)}))}_updateBackgroundGraphic(){const t=this._getCoordinates().map((([t,e])=>[t,e]));this._backgroundGraphic.geometry=new _({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(m()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new p(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new p(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new d({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new p(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new p(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new p(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some((t=>null!=t?.geometry&&"extent"===t.geometry.type))}_getBoxBounds(t){const e=this.graphics.map((t=>t.geometry));return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(m());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new O({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o,automaticLengthMeasurementUtils:r}=this;if(null==t)return;const a=this._getCoordinates(),h=L({topLeft:a[0],topRight:a[1],bottomRight:a[2],bottomLeft:a[3],spatialReference:o.spatialReference,automaticLengthMeasurementUtils:r});if(null==h)return;const{xSize:c,ySize:n}=h,l=Math.abs(e),p=Math.abs(i);t.info=new j({sketchOptions:s,xScale:l,yScale:p,xSize:c,ySize:n})}_updateMoveTooltip(t){const{tooltip:e,sketchOptions:i,view:s,automaticLengthMeasurementUtils:r}=this;if(null==e)return;const a=new T({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,h=s.toMap(t),c=s.toMap({x:e,y:i}),n=r.autoDistanceBetweenPoints2D(c,h);a.distance=null!=n?n:o}e.info=a}};function q(t,e=2){return Number.parseFloat(t.toFixed(e))}t([n()],V.prototype,"tooltip",void 0),t([n({readOnly:!0})],V.prototype,"type",void 0),t([n()],V.prototype,"callbacks",void 0),t([n()],V.prototype,"enableMovement",void 0),t([n()],V.prototype,"enableRotation",void 0),t([n()],V.prototype,"enableScaling",void 0),t([n()],V.prototype,"graphics",void 0),t([n()],V.prototype,"highlightName",void 0),t([n()],V.prototype,"highlightsEnabled",void 0),t([n()],V.prototype,"layer",void 0),t([n()],V.prototype,"preserveAspectRatio",void 0),t([n()],V.prototype,"showCenterGraphic",void 0),t([n({readOnly:!0})],V.prototype,"state",null),t([n()],V.prototype,"symbols",void 0),t([n({type:C})],V.prototype,"sketchOptions",void 0),t([n({constructOnly:!0})],V.prototype,"view",void 0),t([n({constructOnly:!0})],V.prototype,"automaticLengthMeasurementUtils",void 0),V=t([l("esri.views.draw.support.Box")],V);const J=V;export{J 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.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,initial as m,sync as v}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import u from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as f,getMidpoint as x,geometryToCoordinates as G}from"../../../geometry/support/coordsUtils.js";import b from"../../../layers/GraphicsLayer.js";import V from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as M}from"../../ViewingMode.js";import{SnappingVisualizer2D as S}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as w}from"./drawUtils.js";import E from"./GraphicMover.js";import I from"./HighlightHelper.js";import{addUniqueLayer as O}from"./layerUtils.js";import{createTooltipInfos as k,connectTooltip as T,updateTranslateTooltipInfo as C,updateTranslateVertexTooltipInfo as H}from"./reshapeTooltipUtils.js";import{settings as j}from"./settings.js";import{ViewEventPriorities as R}from"../../input/InputManager.js";import{createCoordinateHelper as A}from"../../interactive/coordinateHelper.js";import{sketchKeys as U}from"../../interactive/keybindings.js";import{EditGeometryOperations as L}from"../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as D}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as F,enterInputModeIfAvailable as P}from"../../interactive/tooltip/tooltipCommonUtils.js";class N{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class Z{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class X{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class Y{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class K{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 $=j.reshapeGraphics,ee={vertices:{default:new V({style:"circle",size:$.vertex.size,color:$.vertex.color,outline:{color:$.vertex.outlineColor,width:1}}),hover:new V({style:"circle",size:$.vertex.hoverSize,color:$.vertex.hoverColor,outline:{color:$.vertex.hoverOutlineColor,width:1}}),selected:new V({style:"circle",size:$.selected.size,color:$.selected.color,outline:{color:$.selected.outlineColor,width:1}})},midpoints:{default:new V({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}}),hover:new V({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.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.midpointGraphics=new s,this.midpointSymbol=new V({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 z,this.type="reshape",this.vertexGraphics=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new I({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=c((()=>this.graphic?.geometry),(e=>{if(!e)return;const t=new Set(this.selectedVertices.map((e=>e.attributes?.pointIndex)));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter((e=>t.has(e.attributes.pointIndex))).forEach((e=>this._addToSelection(e)));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n}=this,h=n.concat(r).items;i&&h.push(o),s?.set("graphics",h)}),v),this.tooltip=F((()=>({view:e,options:this.sketchOptions.tooltips}))),this.tooltipInfos=k(this.sketchOptions),this.addHandles([l((()=>e?.ready),(()=>{const{layer:e,view:t}=this;O(t,e),this.addHandles(t.on("key-down",(e=>this._keyDownHandler(e)),R.TOOL))}),{once:!0,initial:!0}),d((()=>this.graphic),(()=>this.refresh())),d((()=>this.layer),((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),d((()=>[this.highlightsEnabled,this.highlightName]),(()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})),d((()=>this.enableMidpoints),(()=>this.refresh())),T(this.tooltip,(()=>this._tooltipsContext)),d((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),m),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this.tooltip=h(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??A(!!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)}}}get state(){const e=this.view.ready,t=!(!this.graphic||!this.layer);return e&&t?"active":e?"ready":"disabled"}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length>0&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedVertices:e}=this;e.length&&this._removeVertices(e)}_setup(){const{graphic:e,layer:t}=this;if(!t||null==e?.geometry)return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&f(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(null==e||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new u({paths:[e.points],spatialReference:e.spatialReference}):e;this._editGeometryOperations=L.fromGeometry(t,M.Local)}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new b({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;a(i),this._snappingContext=new D({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new S(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 E({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_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]=x(r,n),c=i.hasM()?0:void 0;return new g({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 g(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 g(this._stagedVertex),t,s,a),r())}))}else{const i=null!=this._stagedVertex?new g(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=G(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=w(r.geometry,i,s,this.view),p=G(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=G(e.geometry),c=0===a?h+1:a,l=G(o);return l[n].splice(c,0,p),e.attributes={...t,pathIndex:n,pointIndex:c,relatedGraphicIndices:[]},r.push({coordinates:l[n][c],componentIndex:n,vertexIndex:c}),this._updateGraphicGeometry(o),r}_addToSelection(e){const t=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&&P(e,this.tooltip)||U.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const t=this.graphic.geometry;if(null==t||"polygon"!==t.type&&"polyline"!==t.type)return;if("polygon"===t.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;const i=this.graphic.clone(),s=t.clone();let o=G(s);const r=[],n=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,C(i,o,t)):e&&this.selectedVertices.length>1&&(i=r.translateVertices,H(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 Y(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(e,t){const i=new K(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 N(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape-start",t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){const t=new Z(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape",t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){const t=new X(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=G(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}function 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()],te.prototype,"highlightName",void 0),e([y()],te.prototype,"highlightsEnabled",void 0),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:z})],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 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,initial as m,sync as v}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import u from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as f,getMidpoint as x,geometryToCoordinates as G}from"../../../geometry/support/coordsUtils.js";import b from"../../../layers/GraphicsLayer.js";import M from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as V}from"../../ViewingMode.js";import{SnappingVisualizer2D as S}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as w}from"./drawUtils.js";import E from"./GraphicMover.js";import O from"./HighlightHelper.js";import{addUniqueLayer as I}from"./layerUtils.js";import{createTooltipInfos as k,connectTooltip as C,updateTranslateTooltipInfo as T,updateTranslateVertexTooltipInfo as H}from"./reshapeTooltipUtils.js";import{settings as j}from"./settings.js";import{ViewEventPriorities as R}from"../../input/InputManager.js";import{createCoordinateHelper as A}from"../../interactive/coordinateHelper.js";import{sketchKeys as U}from"../../interactive/keybindings.js";import{EditGeometryOperations as L}from"../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as D}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as F,enterInputModeIfAvailable as P}from"../../interactive/tooltip/tooltipCommonUtils.js";class N{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class Z{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class X{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class Y{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class K{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 $=j.reshapeGraphics,ee={vertices:{default:new M({style:"circle",size:$.vertex.size,color:$.vertex.color,outline:{color:$.vertex.outlineColor,width:1}}),hover:new M({style:"circle",size:$.vertex.hoverSize,color:$.vertex.hoverColor,outline:{color:$.vertex.hoverOutlineColor,width:1}}),selected:new M({style:"circle",size:$.selected.size,color:$.selected.color,outline:{color:$.selected.outlineColor,width:1}})},midpoints:{default:new M({style:"circle",size:$.midpoint.size,color:$.midpoint.color,outline:{color:$.midpoint.outlineColor,width:1}}),hover:new M({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.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.midpointGraphics=new s,this.midpointSymbol=new M({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=new s,this.snappingManager=null,this.symbols=ee,this.sketchOptions=new z,this.type="reshape",this.vertexGraphics=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new O({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)}),v),this.tooltip=F((()=>({view:e,options:this.sketchOptions.tooltips}))),this.tooltipInfos=k(this.sketchOptions),this.addHandles([l((()=>e?.ready),(()=>{const{layer:e,view:t}=this;I(t,e),this.addHandles(t.on("key-down",(e=>this._keyDownHandler(e)),R.TOOL))}),{once:!0,initial:!0}),d((()=>this.graphic),(()=>this.refresh())),d((()=>this.layer),((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),d((()=>[this.highlightsEnabled,this.highlightName]),(()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})),d((()=>this.enableMidpoints),(()=>this.refresh())),C(this.tooltip,(()=>this._tooltipsContext)),d((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),m),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this.tooltip=h(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??A(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _selectedVertex(){return 1===this.selectedVertices.length?this.selectedVertices.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:e,automaticLengthMeasurementUtils:t,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedVertex,automaticAreaMeasurementUtils:e,automaticLengthMeasurementUtils:t,updateGeometry:(e,t,i,s,o)=>{this._setUpGeometryHelper();const r=e===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e);const n=!0;if(this._syncGeometryAfterVertexMove(e,t,s,o,n),r){const{view:e}=this,s=e.toScreen(i),o=e.toScreen(t),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e);this._editGeometryOperations=h(this._editGeometryOperations)}}}get state(){const e=this.view.ready,t=!(!this.graphic||!this.layer);return e&&t?"active":e?"ready":"disabled"}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length>0&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedVertices:e}=this;e.length&&this._removeVertices(e)}_setup(){const{graphic:e,layer:t}=this;if(!t||null==e?.geometry)return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&f(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(null==e||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new u({paths:[e.points],spatialReference:e.spatialReference}):e;this._editGeometryOperations=L.fromGeometry(t,V.Local)}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new b({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;a(i),this._snappingContext=new D({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new S(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 E({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_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]=x(r,n),c=i.hasM()?0:void 0;return new g({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 g(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 g(this._stagedVertex),t,s,a),r())}))}else{const i=null!=this._stagedVertex?new g(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=G(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=w(r.geometry,i,s,this.view),p=G(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=G(e.geometry),c=0===a?h+1:a,l=G(o);return l[n].splice(c,0,p),e.attributes={...t,pathIndex:n,pointIndex:c,relatedGraphicIndices:[]},r.push({coordinates:l[n][c],componentIndex:n,vertexIndex:c}),this._updateGraphicGeometry(o),r}_addToSelection(e){const t=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&&P(e,this.tooltip)||U.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const t=this.graphic.geometry;if(null==t||"polygon"!==t.type&&"polyline"!==t.type)return;if("polygon"===t.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;const i=this.graphic.clone(),s=t.clone();let o=G(s);const r=[],n=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,T(i,o,this._tooltipsContext,t)):e&&this.selectedVertices.length>1&&(i=r.translateVertices,H(i,o,n,this._tooltipsContext,t)),this.activeTooltipInfo=i}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){const i=new Y(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(e,t){const i=new K(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 N(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape-start",t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){const t=new Z(this.graphic,e,this.selectedVertices.toArray());this.emit("reshape",t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){const t=new X(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=G(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}function 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({constructOnly:!0})],te.prototype,"automaticAreaMeasurementUtils",void 0),e([y({constructOnly:!0})],te.prototype,"automaticLengthMeasurementUtils",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()],te.prototype,"highlightName",void 0),e([y()],te.prototype,"highlightsEnabled",void 0),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:z})],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};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{handlesGroup as t}from"../../../core/handleUtils.js";import{zeroMeters as e}from"../../../core/quantityUtils.js";import{watch as o,syncAndInitial as n,sync as i}from"../../../core/reactiveUtils.js";import{createScreenPoint as r}from"../../../core/screenUtils.js";import c from"../../../geometry/Point.js";import{connectPasteEvent as s,getXYZDeltasFromTooltipInfo as a}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as l}from"../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{SelectedVertexTooltipInfo as p}from"../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as f}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateVertexTooltipInfo as m}from"../../interactive/tooltip/infos/TranslateVertexTooltipInfo.js";import{autoArea2D as u}from"../../support/automaticAreaMeasurementUtils.js";import{autoLength2D as y,autoDistanceBetweenPoints2D as v}from"../../support/automaticLengthMeasurementUtils.js";import{elevationFromPoint as g}from"../../support/euclideanLengthMeasurementUtils.js";function h(t){const e={sketchOptions:t,viewType:"2d"};return{movePoint:new l(e),selectedVertex:new p(e),translateGraphic:new f(e),translateVertices:new m(e)}}function d(e,r){function c(){const t=r(),e=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let a=!1;function l(t){a||(a=!0,t(),a=!1)}return t([o((()=>{const t=c();return{context:t,geometry:t.graphic?.geometry,vertexGeometry:t.selectedVertex?.geometry}}),(({context:t})=>{l((()=>{x(t),e.info=t.activeTooltipInfo}))}),n),o((()=>{const t=c(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,key:e.key}}),((t,e)=>{t&&e&&t.key!==e.key&&l((()=>w(t.context)))}),i),s(e,{onBeforePaste:()=>{a=!0},onAfterPaste:()=>{w(c()),a=!1}})])}function x(t){const e=t.activeTooltipInfo;if(e){switch(e?.type){case"move-point":return T(e,t);case"selected-vertex":return j(e,t)}e.sketchOptions=t.sketchOptions}}function T(t,{graphic:e}){k(t,e,e?.geometry)}function j(t,{graphic:e,selectedVertex:o}){k(t,e,o?.geometry);const n=e?.geometry;switch(n?.type){case"polygon":t.geometryType="polygon",t.totalLength.visible=!1,t.area.actual=u(n);break;case"polyline":t.geometryType="polyline",t.totalLength.actual=y(n),t.area.visible=!1}}function k(t,e,o){e&&"point"===o?.type&&(t.setLocationFromPoint(o),t.elevation.actual=g(o),t.elevation.visible=!!e.geometry?.hasZ,t.elevation.readOnly=!1,t.elevation.showAsZ=!0)}function w(t){function e(e,o){const n=o?.geometry;if(!n||"point"!==n.type)return;const{dx:i,dy:r,dz:s}=a(e,n);if(0===i&&0===r&&0===s)return;const{x:l,y:p,z:f,m,spatialReference:u}=n,y=new c({x:l+i,y:p+r,z:null!=f?f+s:void 0,m,spatialReference:u});t.updateGeometry(o,y,n,i,r)}const{activeTooltipInfo:o,graphic:n,selectedVertex:i}=t;switch(o?.type){case"move-point":return e(o,n);case"selected-vertex":return e(o,i)}}function I(t,e,o){t.clear(),V(t,e,o)}function U(t,e,o,n){t.clear(),"polygon"===o?.type?t.area=u(o):"polyline"===o?.type&&(t.totalLength=y(o)),V(t,e,n)}function V(t,o,n){if(!n)return;const{x:i,y:c}=n.origin,s=o.toMap(n),a=o.toMap(r(i,c)),l=v(a,s);t.distance=null!=l?l:e}export{d as connectTooltip,h as createTooltipInfos,I as updateTranslateTooltipInfo,U as updateTranslateVertexTooltipInfo};
5
+ import{handlesGroup as t}from"../../../core/handleUtils.js";import{zeroMeters as e}from"../../../core/quantityUtils.js";import{watch as o,syncAndInitial as n,sync as i}from"../../../core/reactiveUtils.js";import{createScreenPoint as r}from"../../../core/screenUtils.js";import a from"../../../geometry/Point.js";import{connectPasteEvent as c,getXYZDeltasFromTooltipInfo as s}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as l}from"../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{SelectedVertexTooltipInfo as p}from"../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as m}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateVertexTooltipInfo as u}from"../../interactive/tooltip/infos/TranslateVertexTooltipInfo.js";import{elevationFromPoint as f}from"../../support/euclideanLengthMeasurementUtils.js";function y(t){const e={sketchOptions:t,viewType:"2d"};return{movePoint:new l(e),selectedVertex:new p(e),translateGraphic:new m(e),translateVertices:new u(e)}}function v(e,r){function a(){const t=r(),e=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let s=!1;function l(t){s||(s=!0,t(),s=!1)}return t([o((()=>{const t=a();return{context:t,geometry:t.graphic?.geometry,vertexGeometry:t.selectedVertex?.geometry}}),(({context:t})=>{l((()=>{g(t),e.info=t.activeTooltipInfo}))}),n),o((()=>{const t=a(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,key:e.key}}),((t,e)=>{t&&e&&t.key!==e.key&&l((()=>T(t.context)))}),i),c(e,{onBeforePaste:()=>{s=!0},onAfterPaste:()=>{T(a()),s=!1}})])}function g(t){const e=t.activeTooltipInfo;if(e){switch(e?.type){case"move-point":return h(e,t);case"selected-vertex":return d(e,t)}e.sketchOptions=t.sketchOptions}}function h(t,{graphic:e}){x(t,e,e?.geometry)}function d(t,{graphic:e,selectedVertex:o,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:i}){x(t,e,o?.geometry);const r=e?.geometry;switch(r?.type){case"polygon":t.geometryType="polygon",t.totalLength.visible=!1,t.area.actual=n.autoArea2D(r);break;case"polyline":t.geometryType="polyline",t.totalLength.actual=i.autoLength2D(r),t.area.visible=!1}}function x(t,e,o){e&&"point"===o?.type&&(t.setLocationFromPoint(o),t.elevation.actual=f(o),t.elevation.visible=!!e.geometry?.hasZ,t.elevation.readOnly=!1,t.elevation.showAsZ=!0)}function T(t){function e(e,o){const n=o?.geometry;if(!n||"point"!==n.type)return;const{dx:i,dy:r,dz:c}=s(e,n);if(0===i&&0===r&&0===c)return;const{x:l,y:p,z:m,m:u,spatialReference:f}=n,y=new a({x:l+i,y:p+r,z:null!=m?m+c:void 0,m:u,spatialReference:f});t.updateGeometry(o,y,n,i,r)}const{activeTooltipInfo:o,graphic:n,selectedVertex:i}=t;switch(o?.type){case"move-point":return e(o,n);case"selected-vertex":return e(o,i)}}function j(t,e,o,n){t.clear(),U(t,e,n,o)}function w(t,e,o,n,i){t.clear();const{automaticAreaMeasurementUtils:r,automaticLengthMeasurementUtils:a}=n;"polygon"===o?.type?t.area=r.autoArea2D(o):"polyline"===o?.type&&(t.totalLength=a.autoLength2D(o)),U(t,e,i,n)}function U(t,o,n,{automaticLengthMeasurementUtils:i}){if(!n)return;const{x:a,y:c}=n.origin,s=o.toMap(n),l=o.toMap(r(a,c)),p=i.autoDistanceBetweenPoints2D(l,s);t.distance=null!=p?p:e}export{v as connectTooltip,y as createTooltipInfos,j as updateTranslateTooltipInfo,w as updateTranslateVertexTooltipInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{valueInUnit as e,zeroSquareMeters as t,zeroMeters as o,createLength as n,zeroDegreesGeographic as i}from"../../../core/quantityUtils.js";import{getMetersPerVerticalUnitForSR as r}from"../../../core/unitUtils.js";import{absoluteHeightElevationInfo as l,getConvertedElevationFromXYZ as c}from"../../../support/elevationInfoUtils.js";import{getDrawHelpMessage as a}from"./helpMessageUtils.js";import{getDrawMeshHelpMessage as s}from"./helpMessageUtils3d.js";import{getConstraintContext as p}from"../../interactive/sketch/constraintUtils.js";import{updateTooltipInfoFromMeshTransform as u}from"../../interactive/tooltip/tooltipCommonUtils.js";import{DrawCircleTooltipInfo as d}from"../../interactive/tooltip/infos/DrawCircleTooltipInfo.js";import{DrawMeshTooltipInfo as m}from"../../interactive/tooltip/infos/DrawMeshTooltipInfo.js";import{DrawMultipointTooltipInfo as f}from"../../interactive/tooltip/infos/DrawMultipointTooltipInfo.js";import{DrawPointTooltipInfo as y}from"../../interactive/tooltip/infos/DrawPointTooltipInfo.js";import{DrawPolygonTooltipInfo as g}from"../../interactive/tooltip/infos/DrawPolygonTooltipInfo.js";import{DrawPolylineTooltipInfo as w}from"../../interactive/tooltip/infos/DrawPolylineTooltipInfo.js";import{DrawRectangleTooltipInfo as h}from"../../interactive/tooltip/infos/DrawRectangleTooltipInfo.js";import{directionForVertices as v}from"../../support/angularMeasurementUtils.js";import{autoArea2D as O}from"../../support/automaticAreaMeasurementUtils.js";import{autoLength2D as k,autoDistanceBetweenPoints2D as M}from"../../support/automaticLengthMeasurementUtils.js";import{elevationFromZ as x,elevationFromPoint as j}from"../../support/euclideanLengthMeasurementUtils.js";function T(e,t){return{point:new y({sketchOptions:t,viewType:e}),multipoint:new f({sketchOptions:t,viewType:e}),polyline:new w({sketchOptions:t,viewType:e}),polygon:new g({sketchOptions:t,viewType:e}),mesh:new m({sketchOptions:t,viewType:e}),rectangle:new h({sketchOptions:t}),circle:new d({sketchOptions:t})}}function b(e){const{directionOptions:t,geometryType:o,sketchOptions:n,tooltipInfos:i}=e,r=t=>{const o=N(e).mode,n=i[t].elevation;"relative-to-ground"===o||"relative-to-scene"===o||"on-the-ground"===o?n.lock(W(e)):n.unlock()},l=e=>{if(t){const o=i[e].direction;o.committed=t.angle,o.unlockOnVertexPlacement=!1,n.values.directionMode=t.mode}};switch(o){case"polygon":case"polyline":r(o),l(o);break;case"point":case"mesh":r(o)}}function I(e,t){const{drawOperation:o,view:n}=t,i=V(t),r=N(t);if("2d"===n.type||!e||"absolute-height"!==r.mode||1!==o?.numCommittedVertices||!i||"draw-polyline"!==i.type&&"draw-polygon"!==i.type||i.elevation.locked)return;const[l,c,a]=e,s=K(l,c,a,r,t);null!=s&&i.elevation.lock(s)}function U(e){V(e)?.allFields.forEach((e=>{e.unlockOnVertexPlacement&&e.unlock()}))}function V({geometryType:e,graphic:t,tooltipInfos:o}){return t?.geometry?.type!==P[e]?"circle"===e||"rectangle"===e?o[e]:null:o[e]}const P={point:"point",multipoint:"multipoint",mesh:"mesh",polyline:"polyline",polygon:"polygon",circle:"polygon",rectangle:"polygon",freehandPolygon:"polygon",freehandPolyline:"polyline"};function D(e,t){switch(e?.type){case"draw-point":G(e,t);break;case"draw-multipoint":L(e,t);break;case"draw-polyline":Z(e,t);break;case"draw-polygon":C(e,t);break;case"draw-rectangle":H(e,t);break;case"draw-circle":R(e,t);break;case"draw-mesh":z(e,t)}}function G(e,t){const o=t.graphic?.geometry;"point"===o?.type&&(S(e,o,t),e.helpMessage=a("point",o,t.drawOperation.drawingMode))}function L(e,t){const o=t.graphic?.geometry;"multipoint"===o?.type&&(S(e,o,t),e.helpMessage=a("multipoint",o,t.drawOperation.drawingMode))}function z(e,t){const{graphic:o,view:n}=t,i=o?.geometry;"3d"!==n.type||i&&"mesh"!==i.type||(S(e,i?.origin,t),i&&u(e,i),e.helpMessage=s(o,n))}function S(e,t,o){const{drawOperation:n,view:i,sketchOptions:r}=o,{cursorVertex:l}=n;e.sketchOptions=r,e.viewType=i.type;const c="multipoint"===t?.type?t.getPoint(t.points.length-1):t;if(e.setLocationFromPoint(c,Q(o)),q(e.elevation,o),!l)return void(n.constraints=void 0);const a=l;n.constraints={context:$(a,o),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:null,direction:null}}function Z(e,t){const{createOperationGeometry:n,drawOperation:i}=t,r=null!=n?n.full:null;r&&"polyline"!==r.type||(F(e,t),e.totalLength.actual=i.lastVertex?(r?k(r):null)??o:null,e.helpMessage=a("polyline",r,t.drawOperation.drawingMode))}function C(e,o){const{createOperationGeometry:n,drawOperation:i}=o,r=null!=n?n.full:null;r&&"polygon"!==r.type||(F(e,o),e.area.actual=i.lastVertex?(r?O(r):null)??t:null,e.helpMessage=a("polygon",r,o.drawOperation.drawingMode))}function F(e,t){const{drawOperation:n,sketchOptions:r,view:l}=t,{cursorVertex:c,lastVertex:a,secondToLastVertex:s}=n,p=r.values.effectiveDirectionMode;e.sketchOptions=r,e.viewType=l.type;const u=a&&c?M(a,c)??o:null;if(e.distance.actual=u,e.distance.readOnly=null==a,e.direction.actual=null,e.direction.readOnly=!0,a&&c&&("absolute"===p||s)){const t=v(s,a,c,p);e.direction.actual=t??i,e.direction.readOnly=!1}e.setLocationFromPoint(c,Q(t)),q(e.elevation,t);const d=A(a,t);e.xyMode=d,e.direction.visible="direction-distance"===d,e.distance.visible="direction-distance"===d,e.effectiveX.visible="coordinates"===d,e.effectiveY.visible="coordinates"===d;const m=c??a;n.constraints=m?{context:$(m,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:e.distance.committed,direction:e.direction.committed}:void 0}function A(e,{sketchOptions:t}){const o=t.tooltips.xyMode;return"auto"===o?e?"direction-distance":"coordinates":o}function H(e,t){e.sketchOptions=t.sketchOptions,e.xSize=X(t),e.ySize=Y(t),e.area=E(t),e.helpMessage=a("rectangle",t.graphic?.geometry,t.drawOperation.drawingMode)}function R(e,t){const{forceUniformSize:o,sketchOptions:n}=t;e.sketchOptions=n,e.radius=o?B(t):null,e.xSize=o?null:X(t),e.ySize=o?null:Y(t),e.area=E(t),e.helpMessage=a("circle",t.graphic?.geometry,t.drawOperation.drawingMode)}function q(e,t){const{drawOperation:o}=t,n=o?.cursorVertex??o?.lastVertex;e.actual=j(n)??W(t),e.visible=o.hasZ,e.readOnly=!1,e.showAsZ=!0}function E(e){const o=e.createOperationGeometry?.full;return"polygon"!==o?.type?t:O(o)??t}function X(e){const t=e.createOperationGeometry?.rectangle?.midpoints;return(null!=t?M(t.left,t.right):null)??o}function Y(e){const t=e.createOperationGeometry?.rectangle?.midpoints;return(null!=t?M(t.top,t.bottom):null)??o}function B({createOperationGeometry:e}){return(null!=e?.circle?.center&&null!=e.circle.edge?M(e.circle.center,e.circle.edge):null)??o}function J(t){const{geometryType:o,tooltipInfos:n}=t;switch(o){case"point":case"multipoint":case"mesh":case"polyline":case"polygon":{const i=n[o].elevation.committed;if(!i)return;return e(i,"meters")/r(Q(t))}default:return}}function K(e,t,o,n,i){const{view:r,drawOperation:l}=i;if("3d"!==r.type||!l)return;o??=0;const a=Q(i),s=N(i),p=c(r,e,t,o,a,s,n);return x(p,a)??W(i)}function N(e){return e.drawOperation.elevationInfo??l}function Q(e){return e.drawOperation.coordinateHelper.spatialReference}function W(e){const t=r(Q(e));return n(e.defaultZ*t,"meters")}function $(e,t){return p(e,t.view,Q(t),N(t),t.drawOperation.coordinateHelper.hasZ(),t.sketchOptions.values.effectiveDirectionMode)}export{T as createTooltipInfos,V as getActiveTooltipInfo,J as getConstraintZ,b as initializeConstraints,I as lockElevationOnVertexAdd,U as unlockConstraintsOnVertexAddOrRemove,D as updateTooltipInfo};
5
+ import{valueInUnit as e,zeroSquareMeters as t,zeroMeters as o,createLength as n,zeroDegreesGeographic as i}from"../../../core/quantityUtils.js";import{getMetersPerVerticalUnitForSR as r}from"../../../core/unitUtils.js";import{ensureType as a}from"../../../core/accessorSupport/ensureType.js";import c from"../../../geometry/Point.js";import{absoluteHeightElevationInfo as l,getConvertedElevationFromXYZ as s}from"../../../support/elevationInfoUtils.js";import{getDrawHelpMessage as p}from"./helpMessageUtils.js";import{getDrawMeshHelpMessage as u}from"./helpMessageUtils3d.js";import{getConstraintContext as m}from"../../interactive/sketch/constraintUtils.js";import{updateTooltipInfoFromMeshTransform as d}from"../../interactive/tooltip/tooltipCommonUtils.js";import{DrawCircleTooltipInfo as f}from"../../interactive/tooltip/infos/DrawCircleTooltipInfo.js";import{DrawMeshTooltipInfo as y}from"../../interactive/tooltip/infos/DrawMeshTooltipInfo.js";import{DrawMultipointTooltipInfo as g}from"../../interactive/tooltip/infos/DrawMultipointTooltipInfo.js";import{DrawPointTooltipInfo as w}from"../../interactive/tooltip/infos/DrawPointTooltipInfo.js";import{DrawPolygonTooltipInfo as h}from"../../interactive/tooltip/infos/DrawPolygonTooltipInfo.js";import{DrawPolylineTooltipInfo as v}from"../../interactive/tooltip/infos/DrawPolylineTooltipInfo.js";import{DrawRectangleTooltipInfo as O}from"../../interactive/tooltip/infos/DrawRectangleTooltipInfo.js";import{directionForVertices as k}from"../../support/angularMeasurementUtils.js";import{elevationFromZ as M,elevationFromPoint as x}from"../../support/euclideanLengthMeasurementUtils.js";function D(e,t){return{point:new w({sketchOptions:t,viewType:e}),multipoint:new g({sketchOptions:t,viewType:e}),polyline:new v({sketchOptions:t,viewType:e}),polygon:new h({sketchOptions:t,viewType:e}),mesh:new y({sketchOptions:t,viewType:e}),rectangle:new O({sketchOptions:t}),circle:new f({sketchOptions:t})}}function T(e){const{directionOptions:t,geometryType:o,sketchOptions:n,tooltipInfos:i}=e,r=t=>{const o=N(e).mode,n=i[t].elevation;"relative-to-ground"===o||"relative-to-scene"===o||"on-the-ground"===o?n.lock(W(e)):n.unlock()},a=e=>{if(t){const o=i[e].direction;o.committed=t.angle,o.unlockOnVertexPlacement=!1,n.values.directionMode=t.mode}};switch(o){case"polygon":case"polyline":r(o),a(o);break;case"point":case"mesh":r(o)}}function j(e,t){const{drawOperation:o,view:n}=t,i=b(t),r=N(t);if("2d"===n.type||!e||"absolute-height"!==r.mode||1!==o?.numCommittedVertices||!i||"draw-polyline"!==i.type&&"draw-polygon"!==i.type||i.elevation.locked)return;const[a,c,l]=e,s=K(a,c,l,r,t);null!=s&&i.elevation.lock(s)}function U(e){b(e)?.allFields.forEach((e=>{e.unlockOnVertexPlacement&&e.unlock()}))}function b({geometryType:e,graphic:t,tooltipInfos:o}){return t?.geometry?.type!==P[e]?"circle"===e||"rectangle"===e?o[e]:null:o[e]}const P={point:"point",multipoint:"multipoint",mesh:"mesh",polyline:"polyline",polygon:"polygon",circle:"polygon",rectangle:"polygon",freehandPolygon:"polygon",freehandPolyline:"polyline"};function I(e,t){switch(e?.type){case"draw-point":L(e,t);break;case"draw-multipoint":V(e,t);break;case"draw-polyline":z(e,t);break;case"draw-polygon":A(e,t);break;case"draw-rectangle":F(e,t);break;case"draw-circle":H(e,t);break;case"draw-mesh":G(e,t)}}function L(e,t){const o=t.graphic?.geometry;"point"===o?.type&&(S(e,o,t),e.helpMessage=p("point",o,t.drawOperation.drawingMode))}function V(e,t){const o=t.graphic?.geometry;"multipoint"===o?.type&&(S(e,o,t),e.helpMessage=p("multipoint",o,t.drawOperation.drawingMode))}function G(e,t){const{graphic:o,view:n}=t,i=o?.geometry;"3d"!==n.type||i&&"mesh"!==i.type||(S(e,i?.origin,t),i&&d(e,i),e.helpMessage=u(o,n))}function S(e,t,o){const{drawOperation:n,view:i,sketchOptions:r}=o,{cursorVertex:a}=n;e.sketchOptions=r,e.viewType=i.type;const c="multipoint"===t?.type?t.getPoint(t.points.length-1):t;if(e.setLocationFromPoint(c,Q(o)),R(e.elevation,o),!a)return void(n.constraints=void 0);const l=a;n.constraints={context:$(l,o),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:null,direction:null}}function z(e,t){const{createOperationGeometry:n,drawOperation:i,automaticLengthMeasurementUtils:r}=t,a=null!=n?n.full:null;a&&"polyline"!==a.type||(Z(e,t),e.totalLength.actual=i.lastVertex?(a?r.autoLength2D(a):null)??o:null,e.helpMessage=p("polyline",a,t.drawOperation.drawingMode))}function A(e,o){const{createOperationGeometry:n,drawOperation:i}=o,r=null!=n?n.full:null;r&&"polygon"!==r.type||(Z(e,o),e.area.actual=i.lastVertex?(r?o.automaticAreaMeasurementUtils.autoArea2D(r):null)??t:null,e.helpMessage=p("polygon",r,o.drawOperation.drawingMode))}const B=a(c);function Z(e,t){const{drawOperation:n,sketchOptions:r,view:a,automaticLengthMeasurementUtils:c}=t,{cursorVertex:l,lastVertex:s,secondToLastVertex:p}=n,u=r.values.effectiveDirectionMode;e.sketchOptions=r,e.viewType=a.type;const m=s&&l?c.autoDistanceBetweenPoints2D(B(s),B(l))??o:null;if(e.distance.actual=m,e.distance.readOnly=null==s,e.direction.actual=null,e.direction.readOnly=!0,s&&l&&("absolute"===u||p)){const t=k(p,s,l,u);e.direction.actual=t??i,e.direction.readOnly=!1}e.setLocationFromPoint(l,Q(t)),R(e.elevation,t);const d=C(s,t);e.xyMode=d,e.direction.visible="direction-distance"===d,e.distance.visible="direction-distance"===d,e.effectiveX.visible="coordinates"===d,e.effectiveY.visible="coordinates"===d;const f=l??s;n.constraints=f?{context:$(f,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:e.distance.committed,direction:e.direction.committed}:void 0}function C(e,{sketchOptions:t}){const o=t.tooltips.xyMode;return"auto"===o?e?"direction-distance":"coordinates":o}function F(e,t){e.sketchOptions=t.sketchOptions,e.xSize=E(t),e.ySize=X(t),e.area=q(t),e.helpMessage=p("rectangle",t.graphic?.geometry,t.drawOperation.drawingMode)}function H(e,t){const{forceUniformSize:o,sketchOptions:n}=t;e.sketchOptions=n,e.radius=o?Y(t):null,e.xSize=o?null:E(t),e.ySize=o?null:X(t),e.area=q(t),e.helpMessage=p("circle",t.graphic?.geometry,t.drawOperation.drawingMode)}function R(e,t){const{drawOperation:o}=t,n=o?.cursorVertex??o?.lastVertex;e.actual=x(n)??W(t),e.visible=o.hasZ,e.readOnly=!1,e.showAsZ=!0}function q(e){const o=e.createOperationGeometry?.full;return"polygon"!==o?.type?t:e.automaticAreaMeasurementUtils.autoArea2D(o)??t}function E({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.left,n.right):null)??o}function X({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.top,n.bottom):null)??o}function Y({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){return(null!=e?.circle?.center&&null!=e.circle.edge?t.autoDistanceBetweenPoints2D(e.circle.center,e.circle.edge):null)??o}function J(t){const{geometryType:o,tooltipInfos:n}=t;switch(o){case"point":case"multipoint":case"mesh":case"polyline":case"polygon":{const i=n[o].elevation.committed;if(!i)return;return e(i,"meters")/r(Q(t))}default:return}}function K(e,t,o,n,i){const{view:r,drawOperation:a}=i;if("3d"!==r.type||!a)return;o??=0;const c=Q(i),l=N(i),p=s(r,e,t,o,c,l,n);return M(p,c)??W(i)}function N(e){return e.drawOperation.elevationInfo??l}function Q(e){return e.drawOperation.coordinateHelper.spatialReference}function W(e){const t=r(Q(e));return n(e.defaultZ*t,"meters")}function $(e,t){return m(e,t.view,Q(t),N(t),t.drawOperation.coordinateHelper.hasZ(),t.sketchOptions.values.effectiveDirectionMode)}export{D as createTooltipInfos,b as getActiveTooltipInfo,J as getConstraintZ,T as initializeConstraints,j as lockElevationOnVertexAdd,U as unlockConstraintsOnVertexAddOrRemove,I as updateTooltipInfo};