@arcgis/core 5.1.0-next.106 → 5.1.0-next.108

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 (396) hide show
  1. package/analysis/ShadowCastAnalysis.d.ts +2 -1
  2. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  3. package/arcgisGlobal.d.ts +5 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{b7a81fd4994eabba1869.js → 0c8e6ccb5a8174718d62.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{be817be7c81fb630122f.js → 17604cbd4d24158e2c16.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{065dd2fdc834146423c7.js → 33ec193e6d7a0cb9d8dd.js} +1 -1
  8. package/assets/esri/core/workers/chunks/4e13d639419ac64f7563.js +1 -0
  9. package/assets/esri/core/workers/chunks/4f9ea7544b2d0e88a05c.js +1 -0
  10. package/assets/esri/core/workers/chunks/{15920af0c4f46773b06e.js → 502c3da8c49bf885f51d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/518046d2b95a7590a092.js +1 -0
  12. package/assets/esri/core/workers/chunks/{aaad0d3e82ed917d3886.js → 547dc6ccb989bd962661.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{bd59cb5abc67e46f1b2c.js → 55334ad3618899cdbf78.js} +2 -2
  14. package/assets/esri/core/workers/chunks/{d859c046a3ea42530bff.js → 56d9d3f108ff6e719dd4.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{770611659b38066a6228.js → 5a85cbc04c64091d7f46.js} +1 -1
  16. package/assets/esri/core/workers/chunks/75a7de23c05435ec7649.js +1 -0
  17. package/assets/esri/core/workers/chunks/7b66691d133dabd87ce6.js +1 -0
  18. package/assets/esri/core/workers/chunks/91c0de3950991d81b7f2.js +1 -0
  19. package/assets/esri/core/workers/chunks/9234a293d61e134f121f.js +1 -0
  20. package/assets/esri/core/workers/chunks/{a8ae00e06f98e04aee8e.js → ac408c62565e2c8b5975.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{f7fe17a22390a24d6df8.js → b69d1d528e271568cbd8.js} +2 -2
  22. package/assets/esri/core/workers/chunks/{0cc74bc3772be51cabc1.js → bbaf8baa3ca6195467e4.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{7ce60331f94ee0a5d674.js → beff5b4e15edee12bd4c.js} +33 -41
  24. package/assets/esri/core/workers/chunks/{b9850fe7dcdaed0c327c.js → cdb48d198145493f76f3.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{63ea4191d441efd2f146.js → d4014213c476bf8099af.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{740588250eaffb7301fd.js → e1340232962cf576d37e.js} +1 -1
  27. package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
  28. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  29. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  30. package/assets/esri/themes/base/widgets/_Sketch.scss +1 -24
  31. package/assets/esri/themes/dark/main.css +1 -1
  32. package/assets/esri/themes/light/main.css +1 -1
  33. package/assets/esri/themes/light/view.css +1 -1
  34. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ar.json +1 -1
  35. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_bg.json +1 -1
  36. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_bs.json +1 -1
  37. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ca.json +1 -1
  38. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_cs.json +1 -1
  39. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_da.json +1 -1
  40. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_de.json +1 -1
  41. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_el.json +1 -1
  42. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_es.json +1 -1
  43. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_et.json +1 -1
  44. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_fi.json +1 -1
  45. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_fr.json +1 -1
  46. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_he.json +1 -1
  47. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_hr.json +1 -1
  48. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_hu.json +1 -1
  49. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_id.json +1 -1
  50. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_it.json +1 -1
  51. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ja.json +1 -1
  52. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ko.json +1 -1
  53. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_lt.json +1 -1
  54. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_lv.json +1 -1
  55. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_nl.json +1 -1
  56. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_no.json +1 -1
  57. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_pl.json +1 -1
  58. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_pt-BR.json +1 -1
  59. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_pt-PT.json +1 -1
  60. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ro.json +1 -1
  61. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ru.json +1 -1
  62. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_sk.json +1 -1
  63. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_sl.json +1 -1
  64. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_sr.json +1 -1
  65. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_sv.json +1 -1
  66. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_th.json +1 -1
  67. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_tr.json +1 -1
  68. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_uk.json +1 -1
  69. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_vi.json +1 -1
  70. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_zh-CN.json +1 -1
  71. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_zh-HK.json +1 -1
  72. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_zh-TW.json +1 -1
  73. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ar.json +1 -1
  74. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_bg.json +1 -1
  75. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_bs.json +1 -1
  76. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ca.json +1 -1
  77. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_cs.json +1 -1
  78. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_da.json +1 -1
  79. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_de.json +1 -1
  80. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_el.json +1 -1
  81. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_es.json +1 -1
  82. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_et.json +1 -1
  83. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_fi.json +1 -1
  84. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_fr.json +1 -1
  85. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_he.json +1 -1
  86. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_hr.json +1 -1
  87. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_hu.json +1 -1
  88. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_id.json +1 -1
  89. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_it.json +1 -1
  90. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ja.json +1 -1
  91. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ko.json +1 -1
  92. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_lt.json +1 -1
  93. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_lv.json +1 -1
  94. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_nl.json +1 -1
  95. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_no.json +1 -1
  96. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_pl.json +1 -1
  97. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_pt-BR.json +1 -1
  98. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_pt-PT.json +1 -1
  99. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ro.json +1 -1
  100. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ru.json +1 -1
  101. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sk.json +1 -1
  102. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sl.json +1 -1
  103. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sr.json +1 -1
  104. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sv.json +1 -1
  105. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_th.json +1 -1
  106. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_tr.json +1 -1
  107. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_uk.json +1 -1
  108. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_vi.json +1 -1
  109. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_zh-CN.json +1 -1
  110. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_zh-HK.json +1 -1
  111. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_zh-TW.json +1 -1
  112. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  113. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  114. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  115. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  116. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  117. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  118. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  119. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  120. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  121. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  122. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  123. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  124. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  125. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  126. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  127. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  128. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  129. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  130. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  131. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  132. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  133. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  134. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  135. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  136. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  137. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  138. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  139. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  140. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  141. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  142. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  143. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  144. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  145. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  146. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  147. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  148. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  149. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  150. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  151. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  152. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  153. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  154. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  155. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  156. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  157. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  158. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  159. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  160. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  161. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  162. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  163. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  164. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  165. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  166. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  167. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  168. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  169. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  170. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  171. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  172. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  173. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  174. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  175. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  176. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  177. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  178. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  179. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  180. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  181. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  182. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  183. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  184. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  185. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  186. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  187. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  188. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  189. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  190. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  191. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  192. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  193. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  194. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  195. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  196. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  197. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  198. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  199. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  200. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  201. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  202. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  203. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  204. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  205. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  206. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  207. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  208. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  209. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  210. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  211. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  212. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  213. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  214. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  215. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  216. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  217. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  218. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  219. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  220. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  221. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  222. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  223. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  224. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  225. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  226. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  227. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  228. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  229. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  230. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  231. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  232. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  233. package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
  234. package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
  235. package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
  236. package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
  237. package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
  238. package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
  239. package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
  240. package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
  241. package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
  242. package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
  243. package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
  244. package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
  245. package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
  246. package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
  247. package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
  248. package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
  249. package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
  250. package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
  251. package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
  252. package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
  253. package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
  254. package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
  255. package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
  256. package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
  257. package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +1 -1
  258. package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
  259. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
  260. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
  261. package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
  262. package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
  263. package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
  264. package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
  265. package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
  266. package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
  267. package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
  268. package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
  269. package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
  270. package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
  271. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
  272. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
  273. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
  274. package/chunks/Fog.glsl.js +3 -3
  275. package/chunks/GlobalIllumination.glsl.js +12 -12
  276. package/chunks/GlowComposition.glsl.js +38 -56
  277. package/chunks/OITBlend.glsl.js +7 -7
  278. package/chunks/OITBlendEmission.glsl.js +4 -4
  279. package/chunks/OITDimOpaque.glsl.js +8 -3
  280. package/chunks/SimpleAtmosphere.glsl.js +3 -3
  281. package/chunks/lyr3DWorker.js +1 -1
  282. package/chunks/pe-wasm.js +1 -1
  283. package/config.js +1 -1
  284. package/core/workers/workers.js +1 -1
  285. package/geometry/support/WKIDUnitConversion.js +1 -1
  286. package/identity/IdentityManagerBase.js +1 -1
  287. package/kernel.js +1 -1
  288. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  289. package/layers/raster/datasets/MRFRaster.js +1 -1
  290. package/layers/video/VideoController.js +1 -1
  291. package/package.json +3 -3
  292. package/rest/networks/circuits/support/CircuitVerifyResult.js +1 -1
  293. package/rest/networks/circuits/support/VerifyCircuitsResult.js +1 -1
  294. package/support/revision.js +1 -1
  295. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  296. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  297. package/views/2d/layers/RouteLayerView2D.js +1 -1
  298. package/views/2d/layers/TileLayerView2D.js +1 -1
  299. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  300. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  301. package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
  302. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  303. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  304. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  305. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  306. package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +3 -1
  307. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  308. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  309. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  310. package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +2 -0
  311. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  312. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  313. package/views/3d/analysis/Viewshed/viewshedSubToolUtils.js +1 -1
  314. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  315. package/views/3d/environment/FoggyWeather.js +1 -1
  316. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  317. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  318. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  319. package/views/3d/layers/I3SMeshView3D.js +1 -1
  320. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  321. package/views/3d/layers/MapImageLayerView3D.js +1 -1
  322. package/views/3d/layers/TileLayerView3D.js +1 -1
  323. package/views/3d/layers/i3s/Intersector.js +1 -1
  324. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  325. package/views/3d/layers/support/SublayerPopupHighlightHelper3D.js +1 -1
  326. package/views/3d/support/ResourceController.js +1 -1
  327. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  328. package/views/3d/support/popupHitTest.js +1 -1
  329. package/views/3d/webgl-engine/collections/Component/ComponentDrawParameters.js +1 -1
  330. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  331. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  332. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  333. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  334. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +4 -12
  335. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  336. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  337. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  338. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  339. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +1 -1
  340. package/views/3d/webgl-engine/effects/transparency/OITBlend.glsl.js +1 -1
  341. package/views/3d/webgl-engine/effects/transparency/OITBlendEmission.glsl.js +1 -1
  342. package/views/3d/webgl-engine/effects/transparency/OITDimOpaque.glsl.js +1 -1
  343. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  344. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  345. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  346. package/views/PopupView.js +1 -1
  347. package/views/SceneView.js +1 -1
  348. package/views/View2D.js +1 -1
  349. package/views/draw/DrawTool.d.ts +77 -0
  350. package/views/draw/support/editingSessionUtils.js +1 -1
  351. package/views/draw/support/managers/PluginLifecycleManager.d.ts +10 -0
  352. package/views/interactive/InteractiveToolBase.d.ts +11 -0
  353. package/views/interactive/editGeometry/interfaces.d.ts +8 -0
  354. package/views/interactive/interfaces.d.ts +20 -0
  355. package/views/layers/FeatureLikeLayerView.js +1 -1
  356. package/views/layers/ImageryLayerView.js +1 -1
  357. package/views/layers/ImageryTileLayerView.js +1 -1
  358. package/views/layers/WMSLayerView.js +1 -1
  359. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  360. package/views/webgl/capabilities/load.js +1 -1
  361. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +26 -1
  362. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  363. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  364. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
  365. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +5 -44
  366. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  367. package/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput.js +1 -1
  368. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  369. package/widgets/BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js +2 -0
  370. package/widgets/BatchAttributeForm/types.d.ts +7 -0
  371. package/widgets/BatchAttributeForm.js +1 -1
  372. package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +9 -1
  373. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  374. package/widgets/FeatureForm.js +1 -1
  375. package/widgets/FeatureTable/Grid/Column.js +1 -1
  376. package/widgets/FeatureTable/Grid/types.d.ts +21 -1
  377. package/widgets/FeatureTable.js +1 -1
  378. package/widgets/Sketch/SketchViewModel.d.ts +67 -2
  379. package/widgets/Sketch/SketchViewModel.js +1 -1
  380. package/widgets/Sketch/VisibleElements.d.ts +19 -1
  381. package/widgets/Sketch/VisibleElements.js +1 -1
  382. package/widgets/Sketch/support/OperationHandle.js +1 -1
  383. package/widgets/Sketch/support/PluginManager.d.ts +12 -0
  384. package/widgets/Sketch/support/PluginManager.js +1 -1
  385. package/widgets/Sketch.js +1 -1
  386. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +81 -0
  387. package/widgets/support/SelectionToolbar/types.d.ts +4 -0
  388. package/assets/esri/core/workers/chunks/2a2e97918524e0f436d7.js +0 -1
  389. package/assets/esri/core/workers/chunks/2b3a8a53cd68f666676b.js +0 -1
  390. package/assets/esri/core/workers/chunks/2ecb21c402cdd8c82533.js +0 -1
  391. package/assets/esri/core/workers/chunks/7e02e5c6979090fe3ea7.js +0 -1
  392. package/assets/esri/core/workers/chunks/dcba6c766eee8b90381a.js +0 -1
  393. package/assets/esri/core/workers/chunks/f9324420f2c6ac240f63.js +0 -1
  394. package/assets/esri/core/workers/chunks/fae2c8f053927559fff0.js +0 -1
  395. /package/assets/esri/core/workers/chunks/{bd59cb5abc67e46f1b2c.js.LICENSE.txt → 55334ad3618899cdbf78.js.LICENSE.txt} +0 -0
  396. /package/assets/esri/core/workers/chunks/{f7fe17a22390a24d6df8.js.LICENSE.txt → b69d1d528e271568cbd8.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t,__decorate as o}from"tslib";import i from"../../Graphic.js";import{prefersReducedMotion as a}from"../../core/a11yUtils.js";import{isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as p}from"../../core/Evented.js";import{drainHandles as l,disposable as h,makeHandle as d,destroyHandle as c}from"../../core/handleUtils.js";import"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as m,abortMaybe as y}from"../../core/maybe.js";import{createAbortError as g,ignoreAbortErrors as v,whenOrAbort as f}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as b,on as w,when as G,whenOnce as T}from"../../core/reactiveUtils.js";import{property as O,subclass as S}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as A}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as E,isLoaded as M,load as k,project as H}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as P}from"../../geometry/support/coordsUtils.js";import{equals as I}from"../../geometry/support/spatialReferenceUtils.js";import D from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as j}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as U}from"../../support/elevationInfoUtils.js";import R from"../../symbols/CIMSymbol.js";import x from"../../symbols/FillSymbol3DLayer.js";import L from"../../symbols/MeshSymbol3D.js";import F from"../../symbols/SimpleFillSymbol.js";import V from"../../symbols/SimpleLineSymbol.js";import W from"../../symbols/SimpleMarkerSymbol.js";import K from"../../symbols/TextSymbol.js";import{symbolTypes as Z}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as q}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as N}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as z}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as B}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as $}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as Y}from"../../views/input/InputManager.js";import{sketchKeys as X}from"../../views/interactive/keybindings.js";import J from"../../views/interactive/sketch/SketchLabelOptions.js";import Q from"../../views/interactive/sketch/SketchOptions.js";import ee from"../../views/interactive/sketch/SketchTooltipOptions.js";import te from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as oe}from"../../views/interactive/snapping/SnappingManager.js";import ie from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as ae}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as re}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as se}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as ne}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as pe}from"../../views/support/screenUtils.js";import le from"./adapters/layer/GraphicsLayerAdapter.js";import he from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as de,DrawToolOperationHandle as ce,UpdateOperationHandle as ue}from"./support/OperationHandle.js";import{PluginManager as me}from"./support/PluginManager.js";import{SettingsManager as ye}from"./support/SettingsManager.js";import{getLegacyTool as ge,isCompletelyDegenerate as ve,graphicsHaveTooFewVerticesForBox as fe,getModeFromCreateOptions as _e,getDrawToolGeometryTypeFromCreateTool as be}from"./support/sketchUtils.js";const we={defaultZ:0},Ge={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:se},tool:"transform"},Te=Symbol(),Oe=Symbol();let Se=class extends p{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new D({listMode:"hide",internal:!0,title:"SVM Internal"}),this._pluginManager=new me({sketchViewModel:this}),this.settingsManager=new ye({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new C,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new re,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new W({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new F({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new V({color:[130,130,130,1],width:2}),this.meshSymbol=new L({symbolLayers:new s([new x])}),this.updateGraphics=new s,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new W({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new Q,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(Oe),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},b)].filter(r);this.addHandles(t,Oe)},this._originalPopupEnabled=null,this.defaultCreateOptions=we,this.defaultUpdateOptions=Ge,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new ie,this.textSymbol=new K({text:"text"})}initialize(){this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([w(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),b),_(()=>this.view,e=>{this._defaultSnappingManager=m(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new oe({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},b),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),ae(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=m(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._drawToolSimplifyAbortController=y(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new le(e);case"map-notes":return new he(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(r).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...we,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Ge,...e,reshapeOptions:{...Ge.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...Ge.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=m(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new oe({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(G(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},b),o),this._set("view",e),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(r)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=y(this._moduleLoaderAbortController),this._viewReadyAbortController=y(this._viewReadyAbortController),this._drawToolSimplifyAbortController=y(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),g();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");$(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=ge(e),s=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:r??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:s}=this;if("continuous"===s){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(v(this.create(e,t)))}else"update"===s&&o&&this._updatingHandles.consumePromise(v(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),g();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||je(s)||($(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||I(o.geometry.spatialReference,t.spatialReference)||(E(o.geometry.spatialReference,t.spatialReference)||M()||await k(),o.geometry=H(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return ne(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{j(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?A(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},Y.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(pe(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,r=ge(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,r??"polyline");if(e)return this._setupDrawToolOperationHandle(e,r??"point")}if(!r)return null;const s=await this._setupDrawGraphicTool(r,o,i);return null==s?null:(o.tools.add(s),o.activeTool=s,this._setupCreateOperationHandle(s,r))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=_e(p,e),d=be(e),c=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=c?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:d,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...c};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return je(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:Ee(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return je(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,r=e.centered,s=[o.on("key-down",t=>{if(t.key===X.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===X.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==X.vertexAdd||t.repeat)t.key===X.undo?(t.stopPropagation(),n.undo()):t.key===X.redo?(t.stopPropagation(),n.redo()):t.key!==X.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===X.center&&(t.repeat||(e.centered=!r,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},Y.WIDGET),o.on("key-up",t=>{t.key===X.pan?e.enabled=!0:t.key!==X.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===X.center&&(e.centered=r,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},Y.WIDGET),e.on("vertex-add",t=>{switch(i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?n&&n.cancel():n&&n.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],n=new de({activeComponent:e,type:"create",onEnd:()=>{l(s),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_setupDrawToolOperationHandle(o,i){const a=this.view;if(!a)return this._logMissingView(),null;let s=null;const n=[a.on("key-down",e=>{e.key===X.pan&&(e.stopPropagation(),e.repeat||(o.editable=!1))},Y.WIDGET),a.on("key-up",e=>{e.key===X.pan&&(o.editable=!0)},Y.WIDGET),o.on("before-vertex-add",e=>{const t=o.mostUpstreamPlugin?.configuration;if(t&&"legacyCreateTool"in t&&("point"===t?.legacyCreateTool||"text"===t.legacyCreateTool)){const t=e.detail.originalEvent;return void(t&&"key"in t&&t.key===X.vertexAdd&&e.preventDefault())}}),o.on("before-complete",e=>{const t=o.getGeometryIfCompleted();(!t||ve(t))&&e.preventDefault()}),o.on(["vertex-add","vertex-remove"],e=>{switch(this.createGraphic&&(this.createGraphic.geometry=o.getGeometryIfCompleted()),s=null==s&&"vertex-remove"!==e.type?"start":"active",e.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:s,tool:this.activeTool,toolEventInfo:e,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(r),tool:i});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(r),tool:i})}}),o.on("cursor-update",e=>{this.createGraphic&&(this.createGraphic.geometry=o.unprocessedGeometry),(e.vertices[0]?.vertexIndex>0||e.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:e.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),o.on("complete",async({geometry:i,isSimple:a})=>{const r=this.createGraphic;if(!!i&&"mesh"!==i.type&&"extent"!==i.type&&!a&&r){const a={stack:[],error:void 0,hasError:!1};try{const t=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=t;e(a,h(this._createDrawToolCompletionPreviewGraphic(o,i,r)),!1);await this._updatingHandles.addPromise(v(this._finalizeDrawToolCompletion({abortController:t,geometry:i,graphic:r,handle:p})))}catch(s){a.error=s,a.hasError=!0}finally{t(a)}}else r&&(r.geometry=i),p.complete()})],p=new ce({activeComponent:o,type:"create",onEnd:()=>{l(n),a.tools.remove(o)},undo:()=>o.undo(),redo:()=>o.redo(),canUndo:()=>o.canUndo,canRedo:()=>o.canRedo});return n.push(o.on("cancel",()=>{this._drawToolSimplifyAbortController=y(this._drawToolSimplifyAbortController),p.cancel()})),p}_createDrawToolCompletionPreviewGraphic(e,t,o){const a="polygon"===t?.type?this._createAnimatedPolygonPreviewSymbol():o?.symbol,r=t?e.simplifiedGeometryPreview??t:null;if(!r||!a)return d();const s=new i({geometry:r,symbol:a});return this._internalGraphicsLayer.add(s),d(()=>this._internalGraphicsLayer.remove(s))}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:o,handle:i}){const a=this.view?.acquireCursor("progress","high");a&&this.addHandles(a);const r=()=>!!e.signal.aborted&&(o&&this._layerAdapter?.remove(o),this._set("createGraphic",null),!0);try{const a=await this._geometryWorkerHandle.simplify(t,e.signal);if(r())return;o.geometry=a??t,i.complete()}finally{a?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_createAnimatedPolygonPreviewSymbol(){const e={type:"CIMAnimatedSymbolProperties",playAnimation:!a(),duration:1,repeatType:"Oscillate",easing:"EaseInOut"};return new R({data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[180,180,180,36],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]},{type:"CIMHatchFill",enable:!0,separation:6,rotation:-45,offsetX:0,offsetY:0,lineSymbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:.8,color:[100,100,100,110],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]}]}},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:1.8,color:[60,60,60,255],effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[6,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:70,animatedSymbolProperties:e}]}]}}})}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=i;let a=i.tool??Ge.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return fe(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(r))return r;const{ManipulatedObject3DGraphic:s,MoveTool3D:n}=r.module,p=new Map,h=()=>{p.forEach(e=>e.destroy()),p.clear()};for(const l of e){const e=new s({view:o,graphic:l}),t=N(e);if(0!==t)return h(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${q(t)}).`),null;p.set(l,e)}const d=new n({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),d.objects.addMany(Array.from(p.values())),a||this.updateGraphics.addMany(e);const c=[],u=new ue({activeComponent:d,tool:i,type:"update",onEnd:()=>{l(c),De(o,d),h()},undo:()=>{Pe(this.view,d),Me(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ke(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new s({view:o,graphic:e});p.set(e,t),d.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=p.get(e);o&&(d.objects.remove(o),o.destroy(),p.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!je(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return c.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},Y.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===B(e[0])){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(n))return n;const{TransformTool3D:p,ManipulatedObject3DGraphic:h}=n.module,d=new h({graphic:e,view:o}),c=new p({object:d,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),this.updateGraphics.add(e);const u=[],m=new ue({activeComponent:c,tool:i,type:"update",onEnd:()=>{l(u),De(o,c),d.destroy()},undo:()=>{Pe(this.view,c),Me(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ke(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));je(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},Y.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,h=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:c}=h.module,u=this.view?.inputManager?.isModifierKeyDown(X.constraint),m=new d({view:o,graphic:e}),y=new c({object:m,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:!!p!=!!u,sketchOptions:this.sketchOptions});o.tools.add(y),i||this.updateGraphics.add(e);const g=[],v=new ue({activeComponent:y,tool:a,type:"update",onEnd:()=>{l(g),De(o,y),m.destroy()},canUndo:()=>!y.destroyed&&y.canUndo,undo:()=>{y.destroyed||(y.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!y.destroyed&&y.canRedo,redo:()=>{y.destroyed||(y.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));je(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!je(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return g.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),Y.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),Y.WIDGET),o.on("key-down",e=>{e.key!==X.constraint||e.repeat||(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},Y.WIDGET),o.on("key-up",e=>{e.key===X.constraint&&(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},Y.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(je(a))return a;const r=new ue({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),l(p),l(n),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();Me(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ke(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1;const n=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==X.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Y.WIDGET),o.on("key-up",e=>{e.key===X.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Y.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(r))return r;const{ManipulatedObject3DGraphic:s,ReshapeTool3D:n}=r.module,p=new s({view:o,graphic:e}),h=z(p);if(0!==h)return p.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${q(h)}).`),null;const d=t.reshapeOptions,c=new n({view:o,object:p,enableZVertex:t.enableZ&&"move"===d?.vertexOperation,enableZShape:t.enableZ&&"move"===d?.shapeOperation,enableMoveObject:"move"===d?.shapeOperation||"move-xy"===d?.shapeOperation,enableMidpoints:"split"===d?.edgeOperation,enableEdgeOffset:"offset"===d?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),i||this.updateGraphics.add(p.graphic);const u=[],m=new ue({activeComponent:c,tool:a,type:"update",onEnd:()=>{l(u),De(o,c),p.destroy()},canUndo:()=>!c.destroyed&&c.canUndo,undo:()=>{c.destroyed||(c.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!c.destroyed&&c.canRedo,redo:()=>{c.destroyed||(c.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));je(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;m.onEnd(),m.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));je(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},Y.WIDGET)),m}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(je(a))return a;const r=new ue({activeComponent:a,type:"update",onEnd:()=>{l(n),l(s),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{Me(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{ke(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(je(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?r.complete():fe(o)?r.toggleTool():r.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&"point"===t.type||"transform"===r.tool&&"extent"===t.type))return;let a=null;const s={...this.defaultUpdateOptions,...o,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...o?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...o?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};"transform"===r.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],s,i)):"reshape"===r.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],s,i))),je(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(l(n),n=this._getHandlesForComponent(r,s)))}}),s=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),Y.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===X.constraint&&!e.repeat&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Y.WIDGET),i.on("key-up",e=>{if(e.key===X.constraint&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Y.WIDGET)];let n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return je(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(je(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(X.constraint),l=new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}});return l.addHandles(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,o])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=o??t.enableScaling??!0,l.refresh()},b)),l}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,r="split"===a?.edgeOperation,s="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return je(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>P(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>P(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(Ie(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Ie(t.graphics))),o.on("rotate-start",t=>e.addToHistory(Ie(t.graphics))),o.on("scale-start",t=>e.addToHistory(Ie(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Ie([t.mover]))),o.on("reshape-start",t=>e.addToHistory(Ie([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(Ie([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(Ie([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&this.hasGraphic(i)?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=pe(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void(this.updateOnGraphicClick&&e.complete());if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===X.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===X.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===X.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&X.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=m(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(Te)}_displayCursor(e){this.removeHandles(Te),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),Te)}_logError(e,t,o){u.getLogger(this).error(new n(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,t,o){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,r=await import("../../views/draw/DrawTool.js");await this.pluginManager.loadPlugins();const s=await this.pluginManager.makeRenderer({customSymbol:t.graphicSymbol,useTextSymbol:"text"===o}),n=new r.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??U("3d"===a.type),hasZ:!!t.hasZ,sketchOptions:this.sketchOptions,renderer:s,defaultZ:t.defaultZ??0,directionOptions:t.directionOptions,snappingManager:this.snappingManager,enableVertexVisuals:"rectangle"!==o&&"circle"!==o,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});n.addHandles(c(s));const p=new i({...t.graphicProperties,attributes:{...t.graphicProperties?.attributes},symbol:t.graphicSymbol??this._getGraphicSymbolFromTool(o)});return t.graphicSymbol||n.addHandles(_(()=>this._getGraphicSymbolFromTool(o),e=>p.symbol=e)),this._set("createGraphic",p),a.addAndActivateTool(n),n.begin(e),n}get test(){}wait(){return T(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(y(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await f(T(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",Ae("view"))}_logMissingLayer(){this._logError(Ce,Ae("layer"))}};o([O()],Se.prototype,"_defaultSnappingManager",void 0),o([O()],Se.prototype,"_layerAdapter",null),o([O()],Se.prototype,"_pluginManager",void 0),o([O({readOnly:!0})],Se.prototype,"settingsManager",void 0),o([O()],Se.prototype,"_operationHandle",void 0),o([O({readOnly:!0})],Se.prototype,"_updatingHandles",void 0),o([O()],Se.prototype,"_drawToolSimplifyAbortController",void 0),o([O({readOnly:!0})],Se.prototype,"activeTool",null),o([O()],Se.prototype,"geometrySimplificationInProgress",null),o([O({readOnly:!0})],Se.prototype,"activeCreateToolDrawMode",null),o([O()],Se.prototype,"activeTooltip",null),o([O({types:Z})],Se.prototype,"activeFillSymbol",void 0),o([O()],Se.prototype,"activeLineSymbol",void 0),o([O()],Se.prototype,"activeVertexSymbol",void 0),o([O()],Se.prototype,"allowDeleteKey",void 0),o([O({readOnly:!0})],Se.prototype,"createGraphic",null),o([O()],Se.prototype,"defaultCreateOptions",null),o([O()],Se.prototype,"defaultUpdateOptions",null),o([O()],Se.prototype,"activeUpdateOptions",void 0),o([O({type:J,nonNullable:!0})],Se.prototype,"labelOptions",null),o([O()],Se.prototype,"layer",void 0),o([O({types:Z})],Se.prototype,"pointSymbol",void 0),o([O({types:Z})],Se.prototype,"polygonSymbol",void 0),o([O({types:Z})],Se.prototype,"polylineSymbol",void 0),o([O()],Se.prototype,"meshSymbol",void 0),o([O({type:K})],Se.prototype,"textSymbol",null),o([O({type:ie,nonNullable:!0})],Se.prototype,"snappingOptions",null),o([O()],Se.prototype,"snappingManager",null),o([O({readOnly:!0})],Se.prototype,"state",null),o([O({type:ee,nonNullable:!0})],Se.prototype,"tooltipOptions",null),o([O({readOnly:!0})],Se.prototype,"updateGraphics",void 0),o([O()],Se.prototype,"updateOnGraphicClick",void 0),o([O()],Se.prototype,"updating",null),o([O()],Se.prototype,"creationMode",void 0),o([O({type:te,nonNullable:!0})],Se.prototype,"valueOptions",null),o([O({types:Z})],Se.prototype,"vertexSymbol",void 0),o([O({value:null})],Se.prototype,"view",null),o([O({constructOnly:!0,type:Q})],Se.prototype,"sketchOptions",void 0),o([O()],Se.prototype,"useLegacyCreateTools",void 0),o([O()],Se.prototype,"isUsingLegacyCreateTools",null),o([O()],Se.prototype,"pluginManager",null),o([O()],Se.prototype,"drawTool",null),o([O()],Se.prototype,"rootPlugins",null),o([O()],Se.prototype,"effectiveAvailablePlugins",null),o([O()],Se.prototype,"firstPluginWithSwappableLeaf",null),o([O()],Se.prototype,"multiplePluginsActive",null),Se=o([S("esri.widgets.Sketch.SketchViewModel")],Se);const Ce="sketch:missing-property",Ae=e=>`Property '${e}' is missing on SketchViewModel.`;function Ee(e){return"polygon"===e||"rectangle"===e||"circle"===e}function Me(e,t){He("undo",e.history.undo,e.history.redo,t)}function ke(e,t){He("redo",e.history.redo,e.history.undo,t)}function He(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))}),o.push({updates:s})}function Pe(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Ie(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function De(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function je(e){return"requireError"in e&&"aborted"===e.requireError}export{Se as default};
2
+ import{__addDisposableResource as e,__disposeResources as t,__decorate as o}from"tslib";import i from"../../Graphic.js";import{prefersReducedMotion as a}from"../../core/a11yUtils.js";import{isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as p}from"../../core/Evented.js";import{makeHandle as l,drainHandles as h,disposable as d,destroyHandle as c}from"../../core/handleUtils.js";import"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as y,abortMaybe as m}from"../../core/maybe.js";import{createAbortError as g,ignoreAbortErrors as v,whenOrAbort as f}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as b,on as w,when as T,whenOnce as G}from"../../core/reactiveUtils.js";import{property as O,subclass as S}from"../../core/accessorSupport/decorators.js";import{trackAccess as C}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as A}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{UpdatingHandles as E}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as M}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as k,isLoaded as H,load as P,project as I}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as D}from"../../geometry/support/coordsUtils.js";import{equals as j}from"../../geometry/support/spatialReferenceUtils.js";import U from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as R}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as x}from"../../support/elevationInfoUtils.js";import L from"../../symbols/CIMSymbol.js";import F from"../../symbols/FillSymbol3DLayer.js";import V from"../../symbols/MeshSymbol3D.js";import W from"../../symbols/SimpleFillSymbol.js";import K from"../../symbols/SimpleLineSymbol.js";import Z from"../../symbols/SimpleMarkerSymbol.js";import q from"../../symbols/TextSymbol.js";import{symbolTypes as N}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as z}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as B}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as $}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as Y}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as X}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as J}from"../../views/input/InputManager.js";import{sketchKeys as Q}from"../../views/interactive/keybindings.js";import ee from"../../views/interactive/sketch/SketchLabelOptions.js";import te from"../../views/interactive/sketch/SketchOptions.js";import oe from"../../views/interactive/sketch/SketchTooltipOptions.js";import ie from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as ae}from"../../views/interactive/snapping/SnappingManager.js";import re from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as se}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as ne}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as pe}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as le}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as he}from"../../views/support/screenUtils.js";import de from"./adapters/layer/GraphicsLayerAdapter.js";import ce from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ue,DrawToolOperationHandle as ye,UpdateOperationHandle as me}from"./support/OperationHandle.js";import{PluginManager as ge}from"./support/PluginManager.js";import{SettingsManager as ve}from"./support/SettingsManager.js";import{getLegacyTool as fe,isCompletelyDegenerate as _e,graphicsHaveTooFewVerticesForBox as be,getModeFromCreateOptions as we,getDrawToolGeometryTypeFromCreateTool as Te}from"./support/sketchUtils.js";const Ge={defaultZ:0},Oe={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:pe},tool:"transform"},Se=Symbol(),Ce=Symbol();let Ae=class extends p{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new U({listMode:"hide",internal:!0,title:"SVM Internal"}),this._pluginManager=new ge({sketchViewModel:this}),this.settingsManager=new ve({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new E,this._toolTransitionHandles=new E,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new ne,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new Z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new W({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new K({color:[130,130,130,1],width:2}),this.meshSymbol=new V({symbolLayers:new s([new F])}),this.updateGraphics=new s,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new Z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new te,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(Ce),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},b)].filter(r);this.addHandles(t,Ce)},this._originalPopupEnabled=null,this.defaultCreateOptions=Ge,this.defaultUpdateOptions=Oe,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new re,this.textSymbol=new q({text:"text"})}initialize(){this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([w(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),b),_(()=>this.view,e=>{this._defaultSnappingManager=y(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new ae({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},b),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),se(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=y(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new de(e);case"map-notes":return new ce(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(r).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...Ge,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Oe,...e,reshapeOptions:{...Oe.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...Oe.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=y(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new ae({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get toolTransitionInProgress(){return this._toolTransitionHandles.updating||!!this.drawTool?.lifecycleManager.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(T(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},b),o),this._set("view",e),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(r)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=m(this._moduleLoaderAbortController),this._viewReadyAbortController=m(this._viewReadyAbortController),this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){return this._toolTransitionHandles.addPromise(this._create(e,t))}async _create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),g();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");X(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=fe(e),s=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:r??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:s}=this;if("continuous"===s){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(v(this.create(e,t)))}else"update"===s&&o&&this._updatingHandles.consumePromise(v(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){return this._toolTransitionHandles.addPromise(this._update(e,t))}async _update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),g();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||Re(s)||(X(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||j(o.geometry.spatialReference,t.spatialReference)||(k(o.geometry.spatialReference,t.spatialReference)||H()||await P(),o.geometry=I(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return le(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{R(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?M(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},J.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(he(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,r=fe(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,r??"polyline");if(e)return this._setupDrawToolOperationHandle(e,r??"point")}if(!r)return null;const s=await this._setupDrawGraphicTool(r,o,i);return null==s?null:(o.tools.add(s),o.activeTool=s,this._setupCreateOperationHandle(s,r))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=we(p,e),d=Te(e),c=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=c?.preserveAspectRatio??l??"rectangle"!==e,y={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:d,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...c};return"2d"===t.type?this._makeDrawGraphicTool2D(y):this._makeDrawGraphicTool3D(y)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return Re(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ke(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return Re(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,r=e.centered,s=new A,n=[l(()=>s.destroy()),o.on("key-down",t=>{if(t.key===Q.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===Q.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==Q.vertexAdd||t.repeat)t.key===Q.undo?(t.stopPropagation(),p.undo()):t.key===Q.redo?(t.stopPropagation(),p.redo()):t.key!==Q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===Q.center&&(t.repeat||(e.centered=!r,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},J.WIDGET),o.on("key-up",t=>{t.key===Q.pan?e.enabled=!0:t.key!==Q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===Q.center&&(e.centered=r,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},J.WIDGET),e.on("vertex-update",()=>{s.notify()}),e.on("vertex-add",t=>{switch(s.notify(),i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(s.notify(),t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?p&&p.cancel():p&&p.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ue({activeComponent:e,type:"create",onEnd:()=>{h(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(C(s),e.canUndo),canRedo:()=>(C(s),e.canRedo)});return p}_setupDrawToolOperationHandle(o,i){const a=this.view;if(!a)return this._logMissingView(),null;let s=null;const n=[a.on("key-down",e=>{e.key===Q.pan&&(e.stopPropagation(),e.repeat||(o.editable=!1))},J.WIDGET),a.on("key-up",e=>{e.key===Q.pan&&(o.editable=!0)},J.WIDGET),o.on("before-vertex-add",e=>{const t=o.mostUpstreamPlugin?.configuration;if(t&&"legacyCreateTool"in t&&("point"===t?.legacyCreateTool||"text"===t.legacyCreateTool)){const t=e.detail.originalEvent;return void(t&&"key"in t&&t.key===Q.vertexAdd&&e.preventDefault())}}),o.on("before-complete",e=>{const t=o.getGeometryIfCompleted();(!t||_e(t))&&e.preventDefault()}),o.on(["vertex-add","vertex-remove"],e=>{switch(this.createGraphic&&(this.createGraphic.geometry=o.getGeometryIfCompleted()),s=null==s&&"vertex-remove"!==e.type?"start":"active",e.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:s,tool:this.activeTool,toolEventInfo:e,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(r),tool:i});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(r),tool:i})}}),o.on("cursor-update",e=>{this.createGraphic&&(this.createGraphic.geometry=o.unprocessedGeometry),(e.vertices[0]?.vertexIndex>0||e.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:e.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),o.on("complete",async({geometry:i,isSimple:a})=>{const r=this.createGraphic;if(!!i&&"mesh"!==i.type&&"extent"!==i.type&&!a&&r){const a={stack:[],error:void 0,hasError:!1};try{const t=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=t;e(a,d(this._createDrawToolCompletionPreviewGraphic(o,i,r)),!1);await this._updatingHandles.addPromise(v(this._finalizeDrawToolCompletion({abortController:t,geometry:i,graphic:r,handle:p})))}catch(s){a.error=s,a.hasError=!0}finally{t(a)}}else r&&(r.geometry=i),p.complete()})],p=new ye({activeComponent:o,type:"create",onEnd:()=>{h(n),a.tools.remove(o)},undo:()=>o.undo(),redo:()=>o.redo(),canUndo:()=>o.canUndo,canRedo:()=>o.canRedo});return n.push(o.on("cancel",()=>{this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),p.cancel()})),p}_createDrawToolCompletionPreviewGraphic(e,t,o){const a="polygon"===t?.type?this._createAnimatedPolygonPreviewSymbol():o?.symbol,r=t?e.simplifiedGeometryPreview??t:null;if(!r||!a)return l();const s=new i({geometry:r,symbol:a});return this._internalGraphicsLayer.add(s),l(()=>this._internalGraphicsLayer.remove(s))}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:o,handle:i}){const a=this.view?.acquireCursor("progress","high");a&&this.addHandles(a);const r=()=>!!e.signal.aborted&&(o&&this._layerAdapter?.remove(o),this._set("createGraphic",null),!0);try{const a=await this._geometryWorkerHandle.simplify(t,e.signal);if(r())return;o.geometry=a??t,i.complete()}finally{a?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_createAnimatedPolygonPreviewSymbol(){const e={type:"CIMAnimatedSymbolProperties",playAnimation:!a(),duration:1,repeatType:"Oscillate",easing:"EaseInOut"};return new L({data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[180,180,180,36],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]},{type:"CIMHatchFill",enable:!0,separation:6,rotation:-45,offsetX:0,offsetY:0,lineSymbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:.8,color:[100,100,100,110],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]}]}},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:1.8,color:[60,60,60,255],effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[6,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:70,animatedSymbolProperties:e}]}]}}})}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=i;let a=i.tool??Oe.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return be(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(r))return r;const{ManipulatedObject3DGraphic:s,MoveTool3D:n}=r.module,p=new Map,l=()=>{p.forEach(e=>e.destroy()),p.clear()};for(const h of e){const e=new s({view:o,graphic:h}),t=B(e);if(0!==t)return l(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${z(t)}).`),null;p.set(h,e)}const d=new n({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),d.objects.addMany(Array.from(p.values())),a||this.updateGraphics.addMany(e);const c=[],u=new me({activeComponent:d,tool:i,type:"update",onEnd:()=>{h(c),Ue(o,d),l()},undo:()=>{De(this.view,d),He(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Pe(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new s({view:o,graphic:e});p.set(e,t),d.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=p.get(e);o&&(d.objects.remove(o),o.destroy(),p.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!Re(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return c.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},J.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===Y(e[0])){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(n))return n;const{TransformTool3D:p,ManipulatedObject3DGraphic:l}=n.module,d=new l({graphic:e,view:o}),c=new p({object:d,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),this.updateGraphics.add(e);const u=[],y=new me({activeComponent:c,tool:i,type:"update",onEnd:()=>{h(u),Ue(o,c),d.destroy()},undo:()=>{De(this.view,c),He(y,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Pe(y,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Re(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(y,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)},J.WIDGET)),y}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,l=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(l))return l;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:c}=l.module,u=this.view?.inputManager?.isModifierKeyDown(Q.constraint),y=new d({view:o,graphic:e}),m=new c({object:y,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:!!p!=!!u,sketchOptions:this.sketchOptions});o.tools.add(m),i||this.updateGraphics.add(e);const g=[],v=new me({activeComponent:m,tool:a,type:"update",onEnd:()=>{h(g),Ue(o,m),y.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Re(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!Re(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return g.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),J.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),J.WIDGET),o.on("key-down",e=>{e.key!==Q.constraint||e.repeat||(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},J.WIDGET),o.on("key-up",e=>{e.key===Q.constraint&&(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},J.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(Re(a))return a;const r=new me({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),h(p),h(n),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();He(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();Pe(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1;const n=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==Q.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},J.WIDGET),o.on("key-up",e=>{e.key===Q.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},J.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(r))return r;const{ManipulatedObject3DGraphic:s,ReshapeTool3D:n}=r.module,p=new s({view:o,graphic:e}),l=$(p);if(0!==l)return p.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${z(l)}).`),null;const d=t.reshapeOptions,c=new n({view:o,object:p,enableZVertex:t.enableZ&&"move"===d?.vertexOperation,enableZShape:t.enableZ&&"move"===d?.shapeOperation,enableMoveObject:"move"===d?.shapeOperation||"move-xy"===d?.shapeOperation,enableMidpoints:"split"===d?.edgeOperation,enableEdgeOffset:"offset"===d?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),i||this.updateGraphics.add(p.graphic);const u=[],y=new me({activeComponent:c,tool:a,type:"update",onEnd:()=>{h(u),Ue(o,c),p.destroy()},canUndo:()=>!c.destroyed&&c.canUndo,undo:()=>{c.destroyed||(c.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!c.destroyed&&c.canRedo,redo:()=>{c.destroyed||(c.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Re(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;y.onEnd(),y.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));Re(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(y,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)},J.WIDGET)),y}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(Re(a))return a;const r=new me({activeComponent:a,type:"update",onEnd:()=>{h(n),h(s),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{He(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{Pe(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(Re(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?r.complete():be(o)?r.toggleTool():r.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&"point"===t.type||"transform"===r.tool&&"extent"===t.type))return;let a=null;const s={...this.defaultUpdateOptions,...o,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...o?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...o?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};"transform"===r.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],s,i)):"reshape"===r.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],s,i))),Re(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(h(n),n=this._getHandlesForComponent(r,s)))}}),s=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),J.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===Q.constraint&&!e.repeat&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},J.WIDGET),i.on("key-up",e=>{if(e.key===Q.constraint&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},J.WIDGET)];let n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Re(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(Re(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(Q.constraint),l=new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}});return l.addHandles(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,o])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=o??t.enableScaling??!0,l.refresh()},b)),l}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,r="split"===a?.edgeOperation,s="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return Re(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>D(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>D(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(je(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(je(t.graphics))),o.on("rotate-start",t=>e.addToHistory(je(t.graphics))),o.on("scale-start",t=>e.addToHistory(je(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(je([t.mover]))),o.on("reshape-start",t=>e.addToHistory(je([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(je([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(je([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&this.hasGraphic(i)?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=he(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void(this.updateOnGraphicClick&&e.complete());if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===Q.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===Q.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===Q.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&Q.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=y(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(Se)}_displayCursor(e){this.removeHandles(Se),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),Se)}_logError(e,t,o){u.getLogger(this).error(new n(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,t,o){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,r=await import("../../views/draw/DrawTool.js");await this.pluginManager.loadPlugins();const s=await this.pluginManager.makeRenderer({customSymbol:t.graphicSymbol,useTextSymbol:"text"===o}),n=new r.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??x("3d"===a.type),hasZ:!!t.hasZ,sketchOptions:this.sketchOptions,renderer:s,defaultZ:t.defaultZ??0,directionOptions:t.directionOptions,snappingManager:this.snappingManager,enableVertexVisuals:"rectangle"!==o&&"circle"!==o,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});n.addHandles(c(s));const p=new i({...t.graphicProperties,attributes:{...t.graphicProperties?.attributes},symbol:t.graphicSymbol??this._getGraphicSymbolFromTool(o)});return t.graphicSymbol||n.addHandles(_(()=>this._getGraphicSymbolFromTool(o),e=>p.symbol=e)),this._set("createGraphic",p),a.addAndActivateTool(n),n.begin(e),n}get test(){}wait(){return G(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(m(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await f(G(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",Me("view"))}_logMissingLayer(){this._logError(Ee,Me("layer"))}};o([O()],Ae.prototype,"_defaultSnappingManager",void 0),o([O()],Ae.prototype,"_layerAdapter",null),o([O()],Ae.prototype,"_pluginManager",void 0),o([O({readOnly:!0})],Ae.prototype,"settingsManager",void 0),o([O()],Ae.prototype,"_operationHandle",void 0),o([O({readOnly:!0})],Ae.prototype,"_updatingHandles",void 0),o([O({readOnly:!0})],Ae.prototype,"_toolTransitionHandles",void 0),o([O()],Ae.prototype,"_drawToolSimplifyAbortController",void 0),o([O({readOnly:!0})],Ae.prototype,"activeTool",null),o([O()],Ae.prototype,"geometrySimplificationInProgress",null),o([O({readOnly:!0})],Ae.prototype,"activeCreateToolDrawMode",null),o([O()],Ae.prototype,"activeTooltip",null),o([O({types:N})],Ae.prototype,"activeFillSymbol",void 0),o([O()],Ae.prototype,"activeLineSymbol",void 0),o([O()],Ae.prototype,"activeVertexSymbol",void 0),o([O()],Ae.prototype,"allowDeleteKey",void 0),o([O({readOnly:!0})],Ae.prototype,"createGraphic",null),o([O()],Ae.prototype,"defaultCreateOptions",null),o([O()],Ae.prototype,"defaultUpdateOptions",null),o([O()],Ae.prototype,"activeUpdateOptions",void 0),o([O({type:ee,nonNullable:!0})],Ae.prototype,"labelOptions",null),o([O()],Ae.prototype,"layer",void 0),o([O({types:N})],Ae.prototype,"pointSymbol",void 0),o([O({types:N})],Ae.prototype,"polygonSymbol",void 0),o([O({types:N})],Ae.prototype,"polylineSymbol",void 0),o([O()],Ae.prototype,"meshSymbol",void 0),o([O({type:q})],Ae.prototype,"textSymbol",null),o([O({type:re,nonNullable:!0})],Ae.prototype,"snappingOptions",null),o([O()],Ae.prototype,"snappingManager",null),o([O({readOnly:!0})],Ae.prototype,"state",null),o([O()],Ae.prototype,"toolTransitionInProgress",null),o([O({type:oe,nonNullable:!0})],Ae.prototype,"tooltipOptions",null),o([O({readOnly:!0})],Ae.prototype,"updateGraphics",void 0),o([O()],Ae.prototype,"updateOnGraphicClick",void 0),o([O()],Ae.prototype,"updating",null),o([O()],Ae.prototype,"creationMode",void 0),o([O({type:ie,nonNullable:!0})],Ae.prototype,"valueOptions",null),o([O({types:N})],Ae.prototype,"vertexSymbol",void 0),o([O({value:null})],Ae.prototype,"view",null),o([O({constructOnly:!0,type:te})],Ae.prototype,"sketchOptions",void 0),o([O()],Ae.prototype,"useLegacyCreateTools",void 0),o([O()],Ae.prototype,"isUsingLegacyCreateTools",null),o([O()],Ae.prototype,"pluginManager",null),o([O()],Ae.prototype,"drawTool",null),o([O()],Ae.prototype,"rootPlugins",null),o([O()],Ae.prototype,"effectiveAvailablePlugins",null),o([O()],Ae.prototype,"firstPluginWithSwappableLeaf",null),o([O()],Ae.prototype,"multiplePluginsActive",null),Ae=o([S("esri.widgets.Sketch.SketchViewModel")],Ae);const Ee="sketch:missing-property",Me=e=>`Property '${e}' is missing on SketchViewModel.`;function ke(e){return"polygon"===e||"rectangle"===e||"circle"===e}function He(e,t){Ie("undo",e.history.undo,e.history.redo,t)}function Pe(e,t){Ie("redo",e.history.redo,e.history.undo,t)}function Ie(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))}),o.push({updates:s})}function De(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function je(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function Ue(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Re(e){return"requireError"in e&&"aborted"===e.requireError}export{Ae as default};
@@ -7,7 +7,7 @@ import type { SelectionToolVisibilityMapProperties } from "./SelectionToolVisibi
7
7
  import type { SnappingControlsVisibleElementsProperties } from "../support/SnappingControls/VisibleElements.js";
8
8
 
9
9
  /** @since 5.0 */
10
- export interface VisibleElementsProperties extends Partial<Pick<VisibleElements, "deleteButton" | "duplicateButton" | "labelsToggle" | "selectionCountLabel" | "settingsMenu" | "snappingControls" | "tooltipsToggle" | "undoRedoMenu">> {
10
+ export interface VisibleElementsProperties extends Partial<Pick<VisibleElements, "deleteButton" | "duplicateButton" | "geometrySimplificationActivityIndicator" | "labelsToggle" | "selectionCountLabel" | "settingsMenu" | "snappingControls" | "tooltipsToggle" | "undoRedoMenu">> {
11
11
  /**
12
12
  * The available sketch tools within the widget.
13
13
  *
@@ -82,6 +82,24 @@ export default class VisibleElements extends Accessor {
82
82
  * @since 5.0
83
83
  */
84
84
  accessor duplicateButton: boolean;
85
+ /**
86
+ * Indicates whether to display the geometry simplification progress indicator while geometry simplification is in progress.
87
+ * Default value is `true`.
88
+ *
89
+ * When set to `false`, the progress indicator is not shown. You can use
90
+ * [SketchViewModel.geometrySimplificationInProgress](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#geometrySimplificationInProgress) to detect this state and implement
91
+ * alternative UI.
92
+ *
93
+ * @default true
94
+ * @remarks
95
+ * Before 5.1, simplification of geometries was done synchronously on the main thread. With the
96
+ * introduction of support for true curves, this simplification step can take some time (multiple seconds)
97
+ * in extreme cases. At 5.1, simplification is asynchronous and Sketch is disabled during simplification.
98
+ * If this process takes a significant amount of time, an activity indicator is shown.
99
+ * This property only affects rendering of that indicator.
100
+ * @since 5.1
101
+ */
102
+ accessor geometrySimplificationActivityIndicator: boolean;
85
103
  /**
86
104
  * Indicates whether to display the sketch labels toggle. Default value is `true`.
87
105
  *
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import e from"../../core/Accessor.js";import{property as t,subclass as l}from"../../core/accessorSupport/decorators.js";import n from"./CreateToolVisibilityMap.js";import i from"./SelectionToolVisibilityMap.js";import s from"../support/SnappingControls/VisibleElements.js";let p=class extends e{constructor(o){super(o),this.createTools=new n,this.directionModePicker=!1,this.duplicateButton=!0,this.deleteButton=!0,this.selectionCountLabel=!0,this.labelsToggle=!0,this.selectionTools=new i,this.settingsMenu=!0,this.singlePluginBackButton=!0,this.snappingControls=!0,this.snappingControlsElements=new s,this.tooltipsToggle=!0,this.undoRedoMenu=!0}};o([t({type:n,nonNullable:!0})],p.prototype,"createTools",void 0),o([t({type:Boolean,nonNullable:!0})],p.prototype,"directionModePicker",void 0),o([t({type:Boolean,nonNullable:!0})],p.prototype,"duplicateButton",void 0),o([t({type:Boolean,nonNullable:!0})],p.prototype,"deleteButton",void 0),o([t({type:Boolean,nonNullable:!0})],p.prototype,"selectionCountLabel",void 0),o([t({type:Boolean,nonNullable:!0})],p.prototype,"labelsToggle",void 0),o([t({type:i,nonNullable:!0})],p.prototype,"selectionTools",void 0),o([t({type:Boolean,nonNullable:!0})],p.prototype,"settingsMenu",void 0),o([t()],p.prototype,"singlePluginBackButton",void 0),o([t({type:Boolean,nonNullable:!0})],p.prototype,"snappingControls",void 0),o([t({type:s,nonNullable:!0})],p.prototype,"snappingControlsElements",void 0),o([t({type:Boolean,nonNullable:!0})],p.prototype,"tooltipsToggle",void 0),o([t({type:Boolean,nonNullable:!0})],p.prototype,"undoRedoMenu",void 0),p=o([l("esri.widgets.Sketch.VisibleElements")],p);const r=p;export{r as default};
2
+ import{__decorate as o}from"tslib";import t from"../../core/Accessor.js";import{property as e,subclass as l}from"../../core/accessorSupport/decorators.js";import n from"./CreateToolVisibilityMap.js";import i from"./SelectionToolVisibilityMap.js";import p from"../support/SnappingControls/VisibleElements.js";let s=class extends t{constructor(o){super(o),this.createTools=new n,this.directionModePicker=!1,this.duplicateButton=!0,this.deleteButton=!0,this.selectionCountLabel=!0,this.labelsToggle=!0,this.geometrySimplificationActivityIndicator=!0,this.selectionTools=new i,this.settingsMenu=!0,this.singlePluginBackButton=!0,this.snappingControls=!0,this.snappingControlsElements=new p,this.tooltipsToggle=!0,this.undoRedoMenu=!0}};o([e({type:n,nonNullable:!0})],s.prototype,"createTools",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"directionModePicker",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"duplicateButton",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"deleteButton",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"selectionCountLabel",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"labelsToggle",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"geometrySimplificationActivityIndicator",void 0),o([e({type:i,nonNullable:!0})],s.prototype,"selectionTools",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"settingsMenu",void 0),o([e()],s.prototype,"singlePluginBackButton",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"snappingControls",void 0),o([e({type:p,nonNullable:!0})],s.prototype,"snappingControlsElements",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"tooltipsToggle",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"undoRedoMenu",void 0),s=o([l("esri.widgets.Sketch.VisibleElements")],s);const r=s;export{r as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import{EventedAccessor as o}from"../../../core/Evented.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import{getLegacyTool as n}from"./sketchUtils.js";let i=class extends o{constructor(e){super(e),this.cancelled=!1,this.history={undo:[],redo:[]},this.type=null}get tool(){const{activeComponent:e}=this;if(!e)return null;switch(e.type){case"graphic-mover":case"move-3d":return"move";case"box":case"transform-3d":return"transform";case"reshape":case"reshape-3d":return"reshape";case"draw-2d":return"text"===e.graphicSymbol?.type?"text":e.geometryType;case"draw-3d":return e.geometryType;case"draw-2.0":return n(e.pluginStack.toArray().map(e=>e?.configuration).filter(t))??null}return null}addToHistory(e){this.history.redo=[],this.history.undo.push(e)}resetHistory(){this.history.redo=[],this.history.undo=[]}canUndo(){return this.history.undo.length>0}canRedo(){return this.history.redo.length>0}complete(){const{activeComponent:e}=this;e&&"reset"in e?e.reset():e&&"complete"in e&&e.mostUpstreamPlugin&&e.complete(e.mostUpstreamPlugin),this.onEnd(),this.emit("complete")}cancel(){this.cancelled=!0;const{activeComponent:e}=this;e&&"reset"in e&&e.reset(),this.onEnd(),this.emit("complete")}refreshComponent(){const e=this.activeComponent;e&&("box"!==e.type&&"reshape"!==e.type&&"graphic-mover"!==e.type||e.refresh())}set undo(e){this._set("undo",()=>{this.canUndo()&&e()})}set redo(e){this._set("redo",()=>{this.canRedo()&&e()})}};e([r()],i.prototype,"activeComponent",void 0),e([r()],i.prototype,"cancelled",void 0),e([r()],i.prototype,"history",void 0),e([r()],i.prototype,"tool",null),e([r()],i.prototype,"type",void 0),e([r()],i.prototype,"canUndo",null),e([r()],i.prototype,"canRedo",null),e([r()],i.prototype,"onEnd",void 0),e([r()],i.prototype,"undo",null),e([r()],i.prototype,"redo",null),e([r()],i.prototype,"toggleTool",void 0),e([r()],i.prototype,"addToSelection",void 0),e([r()],i.prototype,"removeFromSelection",void 0),i=e([s("esri.widgets.Sketch.support.OperationHandle")],i);let p=class extends i{};e([r()],p.prototype,"activeComponent",void 0),p=e([s("esri.widgets.Sketch.support.OperationHandle.CreateOperationHandle")],p);let a=class extends i{};e([r()],a.prototype,"activeComponent",void 0),a=e([s("esri.widgets.Sketch.support.OperationHandle.UpdateOperationHandle")],a);let d=class extends i{};e([r()],d.prototype,"activeComponent",void 0),d=e([s("esri.widgets.Sketch.support.OperationHandle.DrawToolOperationHandle")],d);export{p as CreateOperationHandle,d as DrawToolOperationHandle,i as OperationHandle,a as UpdateOperationHandle};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import o from"../../../core/Collection.js";import{EventedAccessor as r}from"../../../core/Evented.js";import{property as s,subclass as n}from"../../../core/accessorSupport/decorators.js";import{getLegacyTool as i}from"./sketchUtils.js";let p=class extends r{constructor(e){super(e),this.cancelled=!1,this.history={undo:new o,redo:new o},this.type=null}get tool(){const{activeComponent:e}=this;if(!e)return null;switch(e.type){case"graphic-mover":case"move-3d":return"move";case"box":case"transform-3d":return"transform";case"reshape":case"reshape-3d":return"reshape";case"draw-2d":return"text"===e.graphicSymbol?.type?"text":e.geometryType;case"draw-3d":return e.geometryType;case"draw-2.0":return i(e.pluginStack.toArray().map(e=>e?.configuration).filter(t))??null}return null}addToHistory(e){this.history.redo.removeAll(),this.history.undo.push(e)}resetHistory(){this.history.redo.removeAll(),this.history.undo.removeAll()}canUndo(){return this.history.undo.length>0}canRedo(){return this.history.redo.length>0}complete(){const{activeComponent:e}=this;e&&"reset"in e?e.reset():e&&"complete"in e&&e.mostUpstreamPlugin&&e.complete(e.mostUpstreamPlugin),this.onEnd(),this.emit("complete")}cancel(){this.cancelled=!0;const{activeComponent:e}=this;e&&"reset"in e&&e.reset(),this.onEnd(),this.emit("complete")}refreshComponent(){const e=this.activeComponent;e&&("box"!==e.type&&"reshape"!==e.type&&"graphic-mover"!==e.type||e.refresh())}set undo(e){this._set("undo",()=>{this.canUndo()&&e()})}set redo(e){this._set("redo",()=>{this.canRedo()&&e()})}};e([s()],p.prototype,"activeComponent",void 0),e([s()],p.prototype,"cancelled",void 0),e([s()],p.prototype,"history",void 0),e([s()],p.prototype,"tool",null),e([s()],p.prototype,"type",void 0),e([s()],p.prototype,"canUndo",null),e([s()],p.prototype,"canRedo",null),e([s()],p.prototype,"onEnd",void 0),e([s()],p.prototype,"undo",null),e([s()],p.prototype,"redo",null),e([s()],p.prototype,"toggleTool",void 0),e([s()],p.prototype,"addToSelection",void 0),e([s()],p.prototype,"removeFromSelection",void 0),p=e([n("esri.widgets.Sketch.support.OperationHandle")],p);let a=class extends p{};e([s()],a.prototype,"activeComponent",void 0),a=e([n("esri.widgets.Sketch.support.OperationHandle.CreateOperationHandle")],a);let l=class extends p{};e([s()],l.prototype,"activeComponent",void 0),l=e([n("esri.widgets.Sketch.support.OperationHandle.UpdateOperationHandle")],l);let c=class extends p{};e([s()],c.prototype,"activeComponent",void 0),c=e([n("esri.widgets.Sketch.support.OperationHandle.DrawToolOperationHandle")],c);export{a as CreateOperationHandle,c as DrawToolOperationHandle,p as OperationHandle,l as UpdateOperationHandle};
@@ -0,0 +1,12 @@
1
+ import type Accessor from "../../../core/Accessor.js";
2
+
3
+ /**
4
+ * Support object that manages the available plugin metadata
5
+ * for Sketch and SketchViewModel.
6
+ *
7
+ * Implements compatibility between legacy modes of configuring
8
+ * available create tools, symbology, etc.
9
+ *
10
+ * @internal
11
+ */
12
+ export abstract class PluginManager extends Accessor {}
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import i from"../../../core/Accessor.js";import{isSome as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import{handlesGroup as l}from"../../../core/handleUtils.js";import o from"../../../core/Logger.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{freehandSnappingEnabledSettingKey as g,bezierEnableSplineBehaviorSettingKey as c}from"../../../views/draw/support/types.js";let p=class extends i{constructor(e){super(e),this._pluginLoadPromise=null,this._pluginConstructors=null}get _freehandPluginSettings(){return{[g]:{titleLocalizationKey:"settings.freehandSnappingEnabledTitle",descriptionLocalizationKey:"settings.freehandSnappingEnabledDescription",type:"toggle",default:!0}}}get _simplePointPlugin(){const e=Symbol.for("esri-builtin-plugin-leaf-point");return{uniqueId:e,localizationKey:"leaf-point-segment",kind:["vertex"],geometryType:"point",icon:"line-straight",legacyCreateTool:"point",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Point"}}get _hybridSegmentPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{...this._simplePointPlugin,create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},settings:this._freehandPluginSettings,[Symbol.toStringTag]:"Hybrid Segment"}}get _pointLikeFreehandSegmentPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{...this._simplePointPlugin,create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},settings:this._freehandPluginSettings,[Symbol.toStringTag]:"Freehand Segment"}}get _effectiveConfiguredDrawingMode(){return this.sketchViewModel?.defaultCreateOptions?.mode??"click"}get _effectivePointLikePlugin(){switch(this._effectiveConfiguredDrawingMode){case"hybrid":return this._hybridSegmentPlugin;case"freehand":return this._pointLikeFreehandSegmentPlugin;default:return this._simplePointPlugin}}get _simplePointPluginRoot(){return{...this._simplePointPlugin,icon:"pin",localizationKey:"root-point",create:()=>{const e=this._createPlugin(this._simplePointPlugin.uniqueId);return e.enableHelpMessages=!0,e}}}get _textPointPlugin(){const e=Symbol.for("esri-builtin-plugin-text-point");return{uniqueId:e,localizationKey:"root-text",kind:["vertex"],geometryType:"point",icon:"add-text",legacyCreateTool:"text",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Text"}}get _multipointPlugin(){const e={...this._simplePointPlugin,localizationKey:"leaf-point",icon:"point",hidden:!0},i=Symbol.for("esri-builtin-plugin-multipoint");return{uniqueId:i,localizationKey:"root-multipoint",kind:["part"],geometryType:"multipoint",icon:"pins",legacyCreateTool:"multipoint",excludedViews:["3d"],create:()=>this._createPlugin(i),availableDownstreamPlugins:[e],defaultDownstreamPlugin:e,[Symbol.toStringTag]:"Multipoint"}}get _freehandPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{uniqueId:e,localizationKey:"leaf-freehand",kind:["vertex","section","part"],geometryType:"polyline",icon:"freehand",legacyCreateTool:"freehandPolyline",create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},settings:this._freehandPluginSettings,[Symbol.toStringTag]:"Freehand"}}get _bezierPlugin(){const e=Symbol.for("esri-builtin-plugin-bezier-segment");return{uniqueId:e,localizationKey:"leaf-bezier",kind:["vertex","section"],geometryType:"point",curveTypes:["cubic-bezier"],icon:"bezier-curve",excludedViews:["3d"],create:()=>this._createPlugin(e),settings:{[c]:{titleLocalizationKey:"settings.bezierEnableSplineBehaviorTitle",descriptionLocalizationKey:"settings.bezierEnableSplineBehaviorDescription",type:"toggle",default:!0}},[Symbol.toStringTag]:"Bezier"}}get _tangentArcPlugin(){const e=Symbol.for("esri-builtin-plugin-tangent-arc-segment");return{uniqueId:e,localizationKey:"leaf-tangent-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"arc-segment",excludedViews:["3d"],create:()=>this._createPlugin(e),availableDownstreamPlugins:[],[Symbol.toStringTag]:"Tangent Arc"}}get _endpointArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first");return{uniqueId:e,localizationKey:"leaf-endpoint-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"end-point-arc-segment",excludedViews:["3d"],create:()=>{const i=this._createPlugin(e);return i.arcDrawingMode="end-first",i},availableDownstreamPlugins:[],[Symbol.toStringTag]:"Endpoint Arc"}}get _interiorArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first");return{uniqueId:e,localizationKey:"leaf-circular-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"arc-segment",excludedViews:["3d"],create:()=>{const i=this._createPlugin(e);return i.arcDrawingMode="interior-first",i},availableDownstreamPlugins:[],[Symbol.toStringTag]:"Interior Arc"}}get _singlePartPolylinePlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline,n=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,l="freehand"===this._effectiveConfiguredDrawingMode&&i?this._simplePointPlugin:this._effectivePointLikePlugin,o=Symbol.for("esri-builtin-plugin-simple-polyline");return{uniqueId:o,localizationKey:"root-polyline",kind:["section","part"],geometryType:"polyline",legacyCreateTool:"polyline",icon:n?"line":"freehand",create:()=>this._createPlugin(o),availableDownstreamPlugins:n?[l,i?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:n?l:this._freehandPlugin,[Symbol.toStringTag]:"Polyline"}}get _singlePartPolygonPlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon,n=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,l="freehand"===this._effectiveConfiguredDrawingMode&&i?this._simplePointPlugin:this._effectivePointLikePlugin,o=Symbol.for("esri-builtin-plugin-simple-polygon");return{uniqueId:o,localizationKey:"root-polygon",kind:["section","part"],geometryType:"polygon",legacyCreateTool:"polygon",icon:n?"polygon":"freehand-area",create:()=>this._createPlugin(o),availableDownstreamPlugins:n?[l,i?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:n?l:this._freehandPlugin,[Symbol.toStringTag]:"Polygon"}}get _rectanglePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-rectangle");return{uniqueId:e,localizationKey:"root-rectangle",kind:["part"],geometryType:"polygon",icon:"rectangle",legacyCreateTool:"rectangle",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Rectangle"}}get _circlePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-ellipse");return{uniqueId:e,localizationKey:"root-circle",kind:["part"],geometryType:"polygon",icon:"circle",legacyCreateTool:"circle",create:()=>{const i=this._createPlugin(e);return i.shapeType="circle",i.defaultUniform=!0,i.defaultCentered=!0,i},[Symbol.toStringTag]:"Circle"}}set sketch(e){this._set("sketch",e)}set sketchViewModel(e){this._overrideIfSome("sketchViewModel",e)}get sketchViewModel(){return this.sketch?.viewModel}get effectiveRootPoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.point&&!this._isExcludedByAvailableCreateTools("point")?this._simplePointPluginRoot:null}get effectiveRootText(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.text&&!this._isExcludedByAvailableCreateTools("text")?this._textPointPlugin:null}get effectiveRootMultipoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.multipoint&&!this._isExcludedByAvailableCreateTools("multipoint")&&"3d"!==this.sketchViewModel?.view?.type?this._multipointPlugin:null}get effectiveRootPolyline(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,t=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline;return i||t?this._singlePartPolylinePlugin:null}get effectiveRootPolygon(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,t=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon;return i||t?this._singlePartPolygonPlugin:null}get effectiveRootRectangle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.rectangle&&!this._isExcludedByAvailableCreateTools("rectangle")?this._rectanglePlugin:null}get effectiveRootCircle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.circle&&!this._isExcludedByAvailableCreateTools("circle")?this._circlePlugin:null}get availablePlugins(){const e=[this.effectiveRootPoint,this.effectiveRootText,this.effectiveRootMultipoint,this.effectiveRootPolyline,this.effectiveRootPolygon,this.effectiveRootRectangle,this.effectiveRootCircle].filter(t),i=this.sketch?.availableCreateTools;if(!i)return e;const n=e=>{if(!e.legacyCreateTool)return Number.MAX_SAFE_INTEGER;const t=i.indexOf(e.legacyCreateTool);return-1===t?Number.MAX_SAFE_INTEGER:t};return e.map((e,i)=>({plugin:e,index:i,order:n(e)})).sort((e,i)=>e.order-i.order||e.index-i.index).map(({plugin:e})=>e)}get visiblePluginsFlat(){if(this.sketchViewModel?.isUsingLegacyCreateTools)return[];const e=this.sketchViewModel?.view?.type??"2d",i=new Set,t=[],n=l=>{l&&!l.excludedViews?.includes(e)&&(i.has(l.uniqueId)||(i.add(l.uniqueId),l.hidden||t.push(l)),l.availableDownstreamPlugins?.forEach(e=>n(e)))};return this.availablePlugins.forEach(e=>n(e)),t}get loaded(){return null!=this._pluginConstructors}getPluginsEquivalentToCreateTool(e,i){switch(e){case"text":return[this._textPointPlugin];case"point":return[this._simplePointPluginRoot];case"rectangle":return[this._rectanglePlugin];case"circle":return[this._circlePlugin];case"freehandPolyline":return[this._singlePartPolylinePlugin,this._freehandPlugin];case"freehandPolygon":return[this._singlePartPolygonPlugin,this._freehandPlugin];case"polyline":if("freehand"===i){const e=this.sketch?.viewModel?.defaultCreateOptions?.mode;return"freehand"!==e?[this._singlePartPolylinePlugin,this._freehandPlugin]:[this._singlePartPolylinePlugin,this._effectivePointLikePlugin]}return"hybrid"===i?[this._singlePartPolylinePlugin,this._hybridSegmentPlugin]:[this._singlePartPolylinePlugin,this._simplePointPlugin];case"polygon":if("freehand"===i){const e=this.sketch?.viewModel?.defaultCreateOptions?.mode;return"freehand"!==e?[this._singlePartPolygonPlugin,this._freehandPlugin]:[this._singlePartPolygonPlugin,this._effectivePointLikePlugin]}return"hybrid"===i?[this._singlePartPolygonPlugin,this._hybridSegmentPlugin]:[this._singlePartPolygonPlugin,this._simplePointPlugin];case"multipoint":return[this._multipointPlugin];default:return null}}getDrawingModeEquivalentToPluginStack(e){const i=e.at(-1);if(i===this._freehandPlugin)return"freehand";return i===this._hybridSegmentPlugin||i===this._rectanglePlugin||i===this._circlePlugin?"hybrid":"click"}async makeRenderer(e={}){const i=this.sketchViewModel;if(!i?.view)return null;const{abortOptions:t,useTextSymbol:n,customSymbol:l}=e;return"2d"===i.view.type?await this._makeDrawToolRenderer2D({view:i.view,svm:i,useTextSymbol:n,customSymbol:l,abortOptions:t}):await this._makeDrawToolRenderer3D({view:i.view,svm:i,useTextSymbol:n,abortOptions:t})}async loadPlugins(){if(!this.loaded)return this._pluginLoadPromise||(this._pluginLoadPromise=(async()=>{const[{PointPlugin:e},{MultipointPlugin:i},{PolylinePlugin:t},{PolygonPlugin:n},{FreehandSegmentPlugin:l},{BezierSegmentPlugin:o},{TangentArcSegmentPlugin:r},{CircularArcSegmentPlugin:s},{ShapePlugin:a}]=await Promise.all([import("../../../views/draw/plugins/PointPlugin.js"),import("../../../views/draw/plugins/MultipointPlugin.js"),import("../../../views/draw/plugins/PolylinePlugin.js"),import("../../../views/draw/plugins/PolygonPlugin.js"),import("../../../views/draw/plugins/FreehandSegmentPlugin.js"),import("../../../views/draw/plugins/BezierSegmentPlugin.js"),import("../../../views/draw/plugins/TangentArcSegmentPlugin.js"),import("../../../views/draw/plugins/CircularArcSegmentPlugin.js"),import("../../../views/draw/plugins/ShapePlugin.js")]);this._pluginConstructors=new Map([[Symbol.for("esri-builtin-plugin-leaf-point"),e],[Symbol.for("esri-builtin-plugin-text-point"),e],[Symbol.for("esri-builtin-plugin-multipoint"),i],[Symbol.for("esri-builtin-plugin-freehand"),l],[Symbol.for("esri-builtin-plugin-bezier-segment"),o],[Symbol.for("esri-builtin-plugin-tangent-arc-segment"),r],[Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first"),s],[Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first"),s],[Symbol.for("esri-builtin-plugin-simple-polyline"),t],[Symbol.for("esri-builtin-plugin-simple-polygon"),n],[Symbol.for("esri-builtin-plugin-simple-rectangle"),a],[Symbol.for("esri-builtin-plugin-simple-ellipse"),a]])})().catch(e=>{throw this._pluginLoadPromise=null,e})),this._pluginLoadPromise}_isExcludedByAvailableCreateTools(e){return!!this.sketch&&!this.sketch.availableCreateTools?.includes(e)}_createPlugin(e){const i=this._pluginConstructors?.get(e);if(!i)throw new n("Sketch:PluginManager","Plugin implementations are not loaded. Call loadPlugins() before creating plugins.");return new i}async _makeDrawToolRenderer2D(e){const{DrawToolRenderer2D:i}=await import("../../../views/2d/interactive/editingTools/draw/DrawToolRenderer2D.js"),{view:t,svm:n,useTextSymbol:l,abortOptions:o}=e;r(o);const s=l?n.textSymbol??n.pointSymbol:n.pointSymbol,a=new i({symbolOverrides:{polyline:{outputGeometry:{default:e.customSymbol??n.polylineSymbol},outline:{active:n.activeLineSymbol??void 0}},polygon:{outputGeometry:{default:e.customSymbol??n.activeFillSymbol??n.polygonSymbol}},point:{outputGeometry:{default:e.customSymbol??s},vertex:{default:n.vertexSymbol,active:n.activeVertexSymbol??void 0}}},view:t}),u=this._setupSymbolWatcher(a,n,!!l,!!e.customSymbol);return a.addHandles(u),a}async _makeDrawToolRenderer3D(e){const{view:i,svm:t,useTextSymbol:n,abortOptions:l}=e;return o.getLogger(this).warnOnce("Using DrawToolRenderer2D in 3D view. A 3D-specific implementation of DrawToolRenderer is not yet available."),this._makeDrawToolRenderer2D({view:i,svm:t,useTextSymbol:n,abortOptions:l})}_setupSymbolWatcher(e,i,t,n){const o=(i,t,n)=>(l,o)=>{l!==o&&e.overrideSymbol({symbol:l,geometryType:i,role:t,state:n})},r=[s(()=>i.activeLineSymbol,o("polyline","outline","active")),s(()=>i.vertexSymbol,o("point","vertex")),s(()=>i.activeVertexSymbol,o("point","vertex","active"))];return n||r.push(s(()=>i.polylineSymbol,o("polyline","outputGeometry")),s(()=>i.activeFillSymbol??i.polygonSymbol,o("polygon","outputGeometry")),s(()=>t?i.textSymbol??i.pointSymbol:i.pointSymbol,o("point","outputGeometry"))),l(r)}};e([a()],p.prototype,"_freehandPluginSettings",null),e([a()],p.prototype,"_simplePointPlugin",null),e([a()],p.prototype,"_hybridSegmentPlugin",null),e([a()],p.prototype,"_pointLikeFreehandSegmentPlugin",null),e([a()],p.prototype,"_effectiveConfiguredDrawingMode",null),e([a()],p.prototype,"_effectivePointLikePlugin",null),e([a()],p.prototype,"_simplePointPluginRoot",null),e([a()],p.prototype,"_textPointPlugin",null),e([a()],p.prototype,"_multipointPlugin",null),e([a()],p.prototype,"_freehandPlugin",null),e([a()],p.prototype,"_bezierPlugin",null),e([a()],p.prototype,"_tangentArcPlugin",null),e([a()],p.prototype,"_endpointArcPlugin",null),e([a()],p.prototype,"_interiorArcPlugin",null),e([a()],p.prototype,"_singlePartPolylinePlugin",null),e([a()],p.prototype,"_singlePartPolygonPlugin",null),e([a()],p.prototype,"_rectanglePlugin",null),e([a()],p.prototype,"_circlePlugin",null),e([a()],p.prototype,"sketch",null),e([a()],p.prototype,"sketchViewModel",null),e([a()],p.prototype,"effectiveRootPoint",null),e([a()],p.prototype,"effectiveRootText",null),e([a()],p.prototype,"effectiveRootMultipoint",null),e([a()],p.prototype,"effectiveRootPolyline",null),e([a()],p.prototype,"effectiveRootPolygon",null),e([a()],p.prototype,"effectiveRootRectangle",null),e([a()],p.prototype,"effectiveRootCircle",null),e([a()],p.prototype,"availablePlugins",null),e([a()],p.prototype,"visiblePluginsFlat",null),e([a()],p.prototype,"loaded",null),p=e([u("esri.widgets.Sketch.support.PluginManager")],p);export{p as PluginManager};
2
+ import{__decorate as e}from"tslib";import i from"../../../core/Accessor.js";import{isSome as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import{handlesGroup as l}from"../../../core/handleUtils.js";import o from"../../../core/Logger.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{freehandSnappingEnabledSettingKey as g,bezierEnableSplineBehaviorSettingKey as c}from"../../../views/draw/support/types.js";let p=class extends i{constructor(e){super(e),this._pluginLoadPromise=null,this._pluginConstructors=null}get _freehandPluginSettings(){return{[g]:{titleLocalizationKey:"settings.freehandSnappingEnabledTitle",descriptionLocalizationKey:"settings.freehandSnappingEnabledDescription",type:"toggle",default:!0}}}get _simplePointPlugin(){const e=Symbol.for("esri-builtin-plugin-leaf-point");return{uniqueId:e,localizationKey:"leaf-point-segment",kind:["vertex"],geometryType:"point",icon:"line-straight",legacyCreateTool:"point",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Point"}}get _hybridSegmentPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{...this._simplePointPlugin,create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},settings:this._freehandPluginSettings,[Symbol.toStringTag]:"Hybrid Segment"}}get _pointLikeFreehandSegmentPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{...this._simplePointPlugin,create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},settings:this._freehandPluginSettings,[Symbol.toStringTag]:"Freehand Segment"}}get _effectiveConfiguredDrawingMode(){return this.sketchViewModel?.defaultCreateOptions?.mode??"click"}get _effectivePointLikePlugin(){switch(this._effectiveConfiguredDrawingMode){case"hybrid":return this._hybridSegmentPlugin;case"freehand":return this._pointLikeFreehandSegmentPlugin;default:return this._simplePointPlugin}}get _simplePointPluginRoot(){return{...this._simplePointPlugin,icon:"pin",localizationKey:"root-point",create:()=>{const e=this._createPlugin(this._simplePointPlugin.uniqueId);return e.enableHelpMessages=!0,e}}}get _textPointPlugin(){const e=Symbol.for("esri-builtin-plugin-text-point");return{uniqueId:e,localizationKey:"root-text",kind:["vertex"],geometryType:"point",icon:"add-text",legacyCreateTool:"text",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Text"}}get _multipointPlugin(){const e={...this._simplePointPlugin,localizationKey:"leaf-point",icon:"point",hidden:!0},i=Symbol.for("esri-builtin-plugin-multipoint");return{uniqueId:i,localizationKey:"root-multipoint",kind:["part"],geometryType:"multipoint",icon:"pins",legacyCreateTool:"multipoint",excludedViews:["3d"],create:()=>this._createPlugin(i),availableDownstreamPlugins:[e],defaultDownstreamPlugin:e,[Symbol.toStringTag]:"Multipoint"}}get _freehandPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{uniqueId:e,localizationKey:"leaf-freehand",kind:["vertex","section","part"],geometryType:"polyline",icon:"freehand",legacyCreateTool:"freehandPolyline",create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},settings:this._freehandPluginSettings,[Symbol.toStringTag]:"Freehand"}}get _bezierPlugin(){const e=Symbol.for("esri-builtin-plugin-bezier-segment");return{uniqueId:e,localizationKey:"leaf-bezier",kind:["vertex","section"],geometryType:"point",curveTypes:["cubic-bezier"],icon:"bezier-curve",excludedViews:["3d"],create:()=>this._createPlugin(e),settings:{[c]:{titleLocalizationKey:"settings.bezierEnableSplineBehaviorTitle",descriptionLocalizationKey:"settings.bezierEnableSplineBehaviorDescription",type:"toggle",default:!0}},[Symbol.toStringTag]:"Bezier"}}get _tangentArcPlugin(){const e=Symbol.for("esri-builtin-plugin-tangent-arc-segment");return{uniqueId:e,localizationKey:"leaf-tangent-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"tangent-curve",excludedViews:["3d"],create:()=>this._createPlugin(e),availableDownstreamPlugins:[],[Symbol.toStringTag]:"Tangent Arc"}}get _endpointArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first");return{uniqueId:e,localizationKey:"leaf-endpoint-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"end-point-arc-segment",excludedViews:["3d"],create:()=>{const i=this._createPlugin(e);return i.arcDrawingMode="end-first",i},availableDownstreamPlugins:[],[Symbol.toStringTag]:"Endpoint Arc"}}get _interiorArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first");return{uniqueId:e,localizationKey:"leaf-circular-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"arc-segment",excludedViews:["3d"],create:()=>{const i=this._createPlugin(e);return i.arcDrawingMode="interior-first",i},availableDownstreamPlugins:[],[Symbol.toStringTag]:"Interior Arc"}}get _singlePartPolylinePlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline,n=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,l="freehand"===this._effectiveConfiguredDrawingMode&&i?this._simplePointPlugin:this._effectivePointLikePlugin,o=Symbol.for("esri-builtin-plugin-simple-polyline");return{uniqueId:o,localizationKey:"root-polyline",kind:["section","part"],geometryType:"polyline",legacyCreateTool:"polyline",icon:n?"line":"freehand",create:()=>this._createPlugin(o),availableDownstreamPlugins:n?[l,i?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:n?l:this._freehandPlugin,[Symbol.toStringTag]:"Polyline"}}get _singlePartPolygonPlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon,n=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,l="freehand"===this._effectiveConfiguredDrawingMode&&i?this._simplePointPlugin:this._effectivePointLikePlugin,o=Symbol.for("esri-builtin-plugin-simple-polygon");return{uniqueId:o,localizationKey:"root-polygon",kind:["section","part"],geometryType:"polygon",legacyCreateTool:"polygon",icon:n?"polygon":"freehand-area",create:()=>this._createPlugin(o),availableDownstreamPlugins:n?[l,i?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:n?l:this._freehandPlugin,[Symbol.toStringTag]:"Polygon"}}get _rectanglePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-rectangle");return{uniqueId:e,localizationKey:"root-rectangle",kind:["part"],geometryType:"polygon",icon:"rectangle",legacyCreateTool:"rectangle",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Rectangle"}}get _circlePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-ellipse");return{uniqueId:e,localizationKey:"root-circle",kind:["part"],geometryType:"polygon",icon:"circle",legacyCreateTool:"circle",create:()=>{const i=this._createPlugin(e);return i.shapeType="circle",i.defaultUniform=!0,i.defaultCentered=!0,i},[Symbol.toStringTag]:"Circle"}}set sketch(e){this._set("sketch",e)}set sketchViewModel(e){this._overrideIfSome("sketchViewModel",e)}get sketchViewModel(){return this.sketch?.viewModel}get effectiveRootPoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.point&&!this._isExcludedByAvailableCreateTools("point")?this._simplePointPluginRoot:null}get effectiveRootText(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.text&&!this._isExcludedByAvailableCreateTools("text")?this._textPointPlugin:null}get effectiveRootMultipoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.multipoint&&!this._isExcludedByAvailableCreateTools("multipoint")&&"3d"!==this.sketchViewModel?.view?.type?this._multipointPlugin:null}get effectiveRootPolyline(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,t=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline;return i||t?this._singlePartPolylinePlugin:null}get effectiveRootPolygon(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,t=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon;return i||t?this._singlePartPolygonPlugin:null}get effectiveRootRectangle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.rectangle&&!this._isExcludedByAvailableCreateTools("rectangle")?this._rectanglePlugin:null}get effectiveRootCircle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.circle&&!this._isExcludedByAvailableCreateTools("circle")?this._circlePlugin:null}get availablePlugins(){const e=[this.effectiveRootPoint,this.effectiveRootText,this.effectiveRootMultipoint,this.effectiveRootPolyline,this.effectiveRootPolygon,this.effectiveRootRectangle,this.effectiveRootCircle].filter(t),i=this.sketch?.availableCreateTools;if(!i)return e;const n=e=>{if(!e.legacyCreateTool)return Number.MAX_SAFE_INTEGER;const t=i.indexOf(e.legacyCreateTool);return-1===t?Number.MAX_SAFE_INTEGER:t};return e.map((e,i)=>({plugin:e,index:i,order:n(e)})).sort((e,i)=>e.order-i.order||e.index-i.index).map(({plugin:e})=>e)}get visiblePluginsFlat(){if(this.sketchViewModel?.isUsingLegacyCreateTools)return[];const e=this.sketchViewModel?.view?.type??"2d",i=new Set,t=[],n=l=>{l&&!l.excludedViews?.includes(e)&&(i.has(l.uniqueId)||(i.add(l.uniqueId),l.hidden||t.push(l)),l.availableDownstreamPlugins?.forEach(e=>n(e)))};return this.availablePlugins.forEach(e=>n(e)),t}get loaded(){return null!=this._pluginConstructors}getPluginsEquivalentToCreateTool(e,i){switch(e){case"text":return[this._textPointPlugin];case"point":return[this._simplePointPluginRoot];case"rectangle":return[this._rectanglePlugin];case"circle":return[this._circlePlugin];case"freehandPolyline":return[this._singlePartPolylinePlugin,this._freehandPlugin];case"freehandPolygon":return[this._singlePartPolygonPlugin,this._freehandPlugin];case"polyline":if("freehand"===i){const e=this.sketch?.viewModel?.defaultCreateOptions?.mode;return"freehand"!==e?[this._singlePartPolylinePlugin,this._freehandPlugin]:[this._singlePartPolylinePlugin,this._effectivePointLikePlugin]}return"hybrid"===i?[this._singlePartPolylinePlugin,this._hybridSegmentPlugin]:[this._singlePartPolylinePlugin,this._simplePointPlugin];case"polygon":if("freehand"===i){const e=this.sketch?.viewModel?.defaultCreateOptions?.mode;return"freehand"!==e?[this._singlePartPolygonPlugin,this._freehandPlugin]:[this._singlePartPolygonPlugin,this._effectivePointLikePlugin]}return"hybrid"===i?[this._singlePartPolygonPlugin,this._hybridSegmentPlugin]:[this._singlePartPolygonPlugin,this._simplePointPlugin];case"multipoint":return[this._multipointPlugin];default:return null}}getDrawingModeEquivalentToPluginStack(e){const i=e.at(-1);if(i===this._freehandPlugin)return"freehand";return i===this._hybridSegmentPlugin||i===this._rectanglePlugin||i===this._circlePlugin?"hybrid":"click"}async makeRenderer(e={}){const i=this.sketchViewModel;if(!i?.view)return null;const{abortOptions:t,useTextSymbol:n,customSymbol:l}=e;return"2d"===i.view.type?await this._makeDrawToolRenderer2D({view:i.view,svm:i,useTextSymbol:n,customSymbol:l,abortOptions:t}):await this._makeDrawToolRenderer3D({view:i.view,svm:i,useTextSymbol:n,abortOptions:t})}async loadPlugins(){if(!this.loaded)return this._pluginLoadPromise||(this._pluginLoadPromise=(async()=>{const[{PointPlugin:e},{MultipointPlugin:i},{PolylinePlugin:t},{PolygonPlugin:n},{FreehandSegmentPlugin:l},{BezierSegmentPlugin:o},{TangentArcSegmentPlugin:r},{CircularArcSegmentPlugin:s},{ShapePlugin:a}]=await Promise.all([import("../../../views/draw/plugins/PointPlugin.js"),import("../../../views/draw/plugins/MultipointPlugin.js"),import("../../../views/draw/plugins/PolylinePlugin.js"),import("../../../views/draw/plugins/PolygonPlugin.js"),import("../../../views/draw/plugins/FreehandSegmentPlugin.js"),import("../../../views/draw/plugins/BezierSegmentPlugin.js"),import("../../../views/draw/plugins/TangentArcSegmentPlugin.js"),import("../../../views/draw/plugins/CircularArcSegmentPlugin.js"),import("../../../views/draw/plugins/ShapePlugin.js")]);this._pluginConstructors=new Map([[Symbol.for("esri-builtin-plugin-leaf-point"),e],[Symbol.for("esri-builtin-plugin-text-point"),e],[Symbol.for("esri-builtin-plugin-multipoint"),i],[Symbol.for("esri-builtin-plugin-freehand"),l],[Symbol.for("esri-builtin-plugin-bezier-segment"),o],[Symbol.for("esri-builtin-plugin-tangent-arc-segment"),r],[Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first"),s],[Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first"),s],[Symbol.for("esri-builtin-plugin-simple-polyline"),t],[Symbol.for("esri-builtin-plugin-simple-polygon"),n],[Symbol.for("esri-builtin-plugin-simple-rectangle"),a],[Symbol.for("esri-builtin-plugin-simple-ellipse"),a]])})().catch(e=>{throw this._pluginLoadPromise=null,e})),this._pluginLoadPromise}_isExcludedByAvailableCreateTools(e){return!!this.sketch&&!this.sketch.availableCreateTools?.includes(e)}_createPlugin(e){const i=this._pluginConstructors?.get(e);if(!i)throw new n("Sketch:PluginManager","Plugin implementations are not loaded. Call loadPlugins() before creating plugins.");return new i}async _makeDrawToolRenderer2D(e){const{DrawToolRenderer2D:i}=await import("../../../views/2d/interactive/editingTools/draw/DrawToolRenderer2D.js"),{view:t,svm:n,useTextSymbol:l,abortOptions:o}=e;r(o);const s=l?n.textSymbol??n.pointSymbol:n.pointSymbol,a=new i({symbolOverrides:{polyline:{outputGeometry:{default:e.customSymbol??n.polylineSymbol},outline:{active:n.activeLineSymbol??void 0}},polygon:{outputGeometry:{default:e.customSymbol??n.activeFillSymbol??n.polygonSymbol}},point:{outputGeometry:{default:e.customSymbol??s},vertex:{default:n.vertexSymbol,active:n.activeVertexSymbol??void 0}}},view:t}),u=this._setupSymbolWatcher(a,n,!!l,!!e.customSymbol);return a.addHandles(u),a}async _makeDrawToolRenderer3D(e){const{view:i,svm:t,useTextSymbol:n,abortOptions:l}=e;return o.getLogger(this).warnOnce("Using DrawToolRenderer2D in 3D view. A 3D-specific implementation of DrawToolRenderer is not yet available."),this._makeDrawToolRenderer2D({view:i,svm:t,useTextSymbol:n,abortOptions:l})}_setupSymbolWatcher(e,i,t,n){const o=(i,t,n)=>(l,o)=>{l!==o&&e.overrideSymbol({symbol:l,geometryType:i,role:t,state:n})},r=[s(()=>i.activeLineSymbol,o("polyline","outline","active")),s(()=>i.vertexSymbol,o("point","vertex")),s(()=>i.activeVertexSymbol,o("point","vertex","active"))];return n||r.push(s(()=>i.polylineSymbol,o("polyline","outputGeometry")),s(()=>i.activeFillSymbol??i.polygonSymbol,o("polygon","outputGeometry")),s(()=>t?i.textSymbol??i.pointSymbol:i.pointSymbol,o("point","outputGeometry"))),l(r)}};e([a()],p.prototype,"_freehandPluginSettings",null),e([a()],p.prototype,"_simplePointPlugin",null),e([a()],p.prototype,"_hybridSegmentPlugin",null),e([a()],p.prototype,"_pointLikeFreehandSegmentPlugin",null),e([a()],p.prototype,"_effectiveConfiguredDrawingMode",null),e([a()],p.prototype,"_effectivePointLikePlugin",null),e([a()],p.prototype,"_simplePointPluginRoot",null),e([a()],p.prototype,"_textPointPlugin",null),e([a()],p.prototype,"_multipointPlugin",null),e([a()],p.prototype,"_freehandPlugin",null),e([a()],p.prototype,"_bezierPlugin",null),e([a()],p.prototype,"_tangentArcPlugin",null),e([a()],p.prototype,"_endpointArcPlugin",null),e([a()],p.prototype,"_interiorArcPlugin",null),e([a()],p.prototype,"_singlePartPolylinePlugin",null),e([a()],p.prototype,"_singlePartPolygonPlugin",null),e([a()],p.prototype,"_rectanglePlugin",null),e([a()],p.prototype,"_circlePlugin",null),e([a()],p.prototype,"sketch",null),e([a()],p.prototype,"sketchViewModel",null),e([a()],p.prototype,"effectiveRootPoint",null),e([a()],p.prototype,"effectiveRootText",null),e([a()],p.prototype,"effectiveRootMultipoint",null),e([a()],p.prototype,"effectiveRootPolyline",null),e([a()],p.prototype,"effectiveRootPolygon",null),e([a()],p.prototype,"effectiveRootRectangle",null),e([a()],p.prototype,"effectiveRootCircle",null),e([a()],p.prototype,"availablePlugins",null),e([a()],p.prototype,"visiblePluginsFlat",null),e([a()],p.prototype,"loaded",null),p=e([u("esri.widgets.Sketch.support.PluginManager")],p);export{p as PluginManager};