@arcgis/core 5.2.0-next.7 → 5.2.0-next.9

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 (489) hide show
  1. package/applications/SceneViewer/layerUtils.d.ts +9 -1
  2. package/applications/SceneViewer/layerUtils.js +1 -1
  3. package/arcgisGlobal.d.ts +4 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/07cc5743cb6a9fd68adb.js +1 -0
  6. package/assets/esri/core/workers/chunks/0cbd7f5fe24271942abd.js +1 -0
  7. package/assets/esri/core/workers/chunks/0ecc1bc1686844cdd60e.js +1 -0
  8. package/assets/esri/core/workers/chunks/0f75c19d8e296a32e329.js +1 -0
  9. package/assets/esri/core/workers/chunks/174cc2e69e5b5a13d880.js +1 -0
  10. package/assets/esri/core/workers/chunks/18f980465db5a86153d1.js +1 -0
  11. package/assets/esri/core/workers/chunks/1996f0a930abdd97b855.js +1 -0
  12. package/assets/esri/core/workers/chunks/1c8436b27a3d3cde5cfc.js +1 -0
  13. package/assets/esri/core/workers/chunks/1cb1f125dccbf8c8cac9.js +1 -0
  14. package/assets/esri/core/workers/chunks/1dd06335bb2d35c66339.js +1 -0
  15. package/assets/esri/core/workers/chunks/1f289aa69dd6b6be534a.js +1 -0
  16. package/assets/esri/core/workers/chunks/2185e8a52c5e29d46680.js +1 -0
  17. package/assets/esri/core/workers/chunks/{da29cf0e64065631a470.js → 24810c36ae09bb4e83dc.js} +1 -1
  18. package/assets/esri/core/workers/chunks/26583db2af1a1cc456e5.js +1 -0
  19. package/assets/esri/core/workers/chunks/274b82cb183ddd0042f3.js +1 -0
  20. package/assets/esri/core/workers/chunks/27c6def22c2b0791ce9e.js +1 -0
  21. package/assets/esri/core/workers/chunks/2d2895f1fdf44d212a4d.js +1 -0
  22. package/assets/esri/core/workers/chunks/2dbc2fd0f2dde505c465.js +1 -0
  23. package/assets/esri/core/workers/chunks/2dbcdfdf000226bfe746.js +1 -0
  24. package/assets/esri/core/workers/chunks/2e6382d50bf012064eae.js +1 -0
  25. package/assets/esri/core/workers/chunks/30f1909c5ef1835b8507.js +1 -0
  26. package/assets/esri/core/workers/chunks/31918a0d9886dedf385f.js +1 -0
  27. package/assets/esri/core/workers/chunks/{1c029b03ed836f393a50.js → 3248001d9dfb9153699e.js} +1 -1
  28. package/assets/esri/core/workers/chunks/3297658ccd8d4b9ce733.js +1 -0
  29. package/assets/esri/core/workers/chunks/{716a4d7e8b908b81870b.js → 32f26757e36704923286.js} +1 -1
  30. package/assets/esri/core/workers/chunks/3529afab0c2444275d91.js +1 -0
  31. package/assets/esri/core/workers/chunks/36dac6ab51d9dbdd091d.js +1 -0
  32. package/assets/esri/core/workers/chunks/390fda094fa8695d98cf.js +1 -0
  33. package/assets/esri/core/workers/chunks/39596715e84d0da2f803.js +30 -0
  34. package/assets/esri/core/workers/chunks/398eb3100a282e4736bb.js +1 -0
  35. package/assets/esri/core/workers/chunks/3b3f91a61e3f29af1fb2.js +1 -0
  36. package/assets/esri/core/workers/chunks/{f815106d439ff1f76e51.js → 3b837b512999e6ab24bc.js} +1 -1
  37. package/assets/esri/core/workers/chunks/3d20c86f1fe877bf884b.js +1 -0
  38. package/assets/esri/core/workers/chunks/3dc5fbecc427df1fd827.js +1 -0
  39. package/assets/esri/core/workers/chunks/3e65b4b18760bde8ceee.js +1 -0
  40. package/assets/esri/core/workers/chunks/3ff7aa216cd794d951e8.js +1 -0
  41. package/assets/esri/core/workers/chunks/{8e1865392681d390ab2e.js → 401ee7fa500adad77db1.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{60915a3708a34da1977e.js → 426156137f279d979ddd.js} +1 -1
  43. package/assets/esri/core/workers/chunks/434c1dd3f48e6f0802fc.js +1 -0
  44. package/assets/esri/core/workers/chunks/4517630bf869205bab87.js +1 -0
  45. package/assets/esri/core/workers/chunks/48f1c3a7c9f16d6896f6.js +1 -0
  46. package/assets/esri/core/workers/chunks/{cfd28eba44cf5a296c6d.js → 49308bdc36373555f1af.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{09d0e430c66788a2626f.js → 4a20f7a0700fd14a129f.js} +1 -1
  48. package/assets/esri/core/workers/chunks/5075e85e1eafd431a8c0.js +1 -0
  49. package/assets/esri/core/workers/chunks/5121768c70f1e03b685c.js +1 -0
  50. package/assets/esri/core/workers/chunks/5201105ca11a2d450460.js +1 -0
  51. package/assets/esri/core/workers/chunks/528ed0bd8dc149ead023.js +1 -0
  52. package/assets/esri/core/workers/chunks/52f354bf80ee5ab0379a.js +1 -0
  53. package/assets/esri/core/workers/chunks/538537f9bc866d9caa75.js +1 -0
  54. package/assets/esri/core/workers/chunks/58a7cdebc3d182c15ec6.js +1 -0
  55. package/assets/esri/core/workers/chunks/58ac245ff7fb57c1004f.js +1 -0
  56. package/assets/esri/core/workers/chunks/58acc18b92533166135d.js +1 -0
  57. package/assets/esri/core/workers/chunks/597aa39cdb5366ef9a74.js +1 -0
  58. package/assets/esri/core/workers/chunks/5bfae465872760e7af6d.js +1 -0
  59. package/assets/esri/core/workers/chunks/5cb274e5759f7ca0d4ed.js +1 -0
  60. package/assets/esri/core/workers/chunks/5d3ddbf94539cb4f493e.js +1 -0
  61. package/assets/esri/core/workers/chunks/{542f5469f7b42026b24f.js → 5d62d1920e3e35fc0192.js} +1 -1
  62. package/assets/esri/core/workers/chunks/5dd441db1e74dc9b56e9.js +1 -0
  63. package/assets/esri/core/workers/chunks/630ad47857de3cf726d1.js +1 -0
  64. package/assets/esri/core/workers/chunks/64114a7d2da162987958.js +1 -0
  65. package/assets/esri/core/workers/chunks/6821462e5c1e9c76010a.js +1 -0
  66. package/assets/esri/core/workers/chunks/684d3cb4fb233180b2d0.js +1 -0
  67. package/assets/esri/core/workers/chunks/686c51fd2144e132783e.js +1 -0
  68. package/assets/esri/core/workers/chunks/68f9b2da1fd08785320f.js +2 -0
  69. package/assets/esri/core/workers/chunks/69e98de578f467a35054.js +1 -0
  70. package/assets/esri/core/workers/chunks/6a3d207308b29651f397.js +1 -0
  71. package/assets/esri/core/workers/chunks/6aabde21b0b376d95888.js +1 -0
  72. package/assets/esri/core/workers/chunks/6d616b66fb32904b55a1.js +1 -0
  73. package/assets/esri/core/workers/chunks/{bcb021a167580bb1619f.js → 6ef3b8d67b498d655a99.js} +1 -1
  74. package/assets/esri/core/workers/chunks/6f125b4ed06c0022dee6.js +1 -0
  75. package/assets/esri/core/workers/chunks/6f4825c3ef1fe202ab82.js +1 -0
  76. package/assets/esri/core/workers/chunks/6f5d61f734ec40dafabb.js +1 -0
  77. package/assets/esri/core/workers/chunks/{fce7995c26953bfd8d3d.js → 70229007d594536ba6a3.js} +1 -1
  78. package/assets/esri/core/workers/chunks/71e55381fdff3fc2542e.js +1 -0
  79. package/assets/esri/core/workers/chunks/{90953a827bc89d0e6bd5.js → 72cfb186e50537bcdd19.js} +1 -1
  80. package/assets/esri/core/workers/chunks/72d67cc3a382e83bf1a2.js +1 -0
  81. package/assets/esri/core/workers/chunks/7748743d4be047094d67.js +1 -0
  82. package/assets/esri/core/workers/chunks/78c53aeb0a408ab3c80c.js +1 -0
  83. package/assets/esri/core/workers/chunks/7b5c1030a7cf0f382cc4.js +1 -0
  84. package/assets/esri/core/workers/chunks/7cee81c5aa1e6b7d2452.js +1 -0
  85. package/assets/esri/core/workers/chunks/7e89cb9ff615742e0894.js +1 -0
  86. package/assets/esri/core/workers/chunks/80f4f686ce403cb2693f.js +1 -0
  87. package/assets/esri/core/workers/chunks/{62dfbdc847be4800e833.js → 8103d06f760a2c79773d.js} +10 -14
  88. package/assets/esri/core/workers/chunks/{8477b5fdd99c6ac5c27b.js → 851705cf276eae8d4d37.js} +1 -1
  89. package/assets/esri/core/workers/chunks/89e09276086745aa21fa.js +1 -0
  90. package/assets/esri/core/workers/chunks/{4894997bfa438f66da36.js → 8a8c5e5ce457ca004687.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{b79428c5093614174e76.js → 8b0a01ebc86ab226f01f.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{452c01cecbbd1e370098.js → 8f93e6fc11a158d4f1ee.js} +1 -1
  93. package/assets/esri/core/workers/chunks/93bd56396b8cd020f965.js +1 -0
  94. package/assets/esri/core/workers/chunks/{359d3acb3953e64e5a78.js → 93ceb74ac88ef460fe5f.js} +1 -1
  95. package/assets/esri/core/workers/chunks/957f7b8de4aecb6f644e.js +1 -0
  96. package/assets/esri/core/workers/chunks/{875cce0be4f6c89f80f3.js → 9629601de5e44ffe90ea.js} +2 -2
  97. package/assets/esri/core/workers/chunks/976ab2be6c244768c08a.js +1 -0
  98. package/assets/esri/core/workers/chunks/{e785f76c1a75cb1d1e1f.js → 99101789035f1787c630.js} +1 -1
  99. package/assets/esri/core/workers/chunks/99e5296192ab98fd0d99.js +1 -0
  100. package/assets/esri/core/workers/chunks/9d5f7573bfe3b051daf1.js +1 -0
  101. package/assets/esri/core/workers/chunks/a0c00c6fe60db49b3ab9.js +1 -0
  102. package/assets/esri/core/workers/chunks/a2247f4c3116efb16c4f.js +1 -0
  103. package/assets/esri/core/workers/chunks/a4245bd4e67a428fd835.js +1 -0
  104. package/assets/esri/core/workers/chunks/a442534ac0956a68b769.js +1 -0
  105. package/assets/esri/core/workers/chunks/a4e9a17dacbb52444d75.js +1 -0
  106. package/assets/esri/core/workers/chunks/{8bdca6f06c8b5fedd917.js → a5abba59e738c3240c22.js} +1 -1
  107. package/assets/esri/core/workers/chunks/a9fc53ae040320e49834.js +1 -0
  108. package/assets/esri/core/workers/chunks/aa118c1bcd922b8ac328.js +1 -0
  109. package/assets/esri/core/workers/chunks/aae0049c2c3e15a813e8.js +1 -0
  110. package/assets/esri/core/workers/chunks/ac33b10fe65f9e9e824f.js +1 -0
  111. package/assets/esri/core/workers/chunks/adc32f6b45ea3026fc34.js +1 -0
  112. package/assets/esri/core/workers/chunks/af31e62499d45bdab3c3.js +1 -0
  113. package/assets/esri/core/workers/chunks/b22a1c98271c2e4d8808.js +1 -0
  114. package/assets/esri/core/workers/chunks/{9f4681713f03365a2a53.js → b666027b9022fa346a79.js} +1 -1
  115. package/assets/esri/core/workers/chunks/b73c146d3e550eaf07eb.js +1 -0
  116. package/assets/esri/core/workers/chunks/{0f3654c8157ec8f22869.js → b895674c0550826ecb28.js} +3 -3
  117. package/assets/esri/core/workers/chunks/c0cbc50e5afd68bd485c.js +1 -0
  118. package/assets/esri/core/workers/chunks/c2a65de34f6a6c89c652.js +1 -0
  119. package/assets/esri/core/workers/chunks/c357c0a08b99c1e7f290.js +1 -0
  120. package/assets/esri/core/workers/chunks/{4a23b27bfbcfa08fd9a7.js → c3cf9e6e91f71c9cc5f3.js} +1 -1
  121. package/assets/esri/core/workers/chunks/c3ff2ff0a86a9143d7a5.js +1 -0
  122. package/assets/esri/core/workers/chunks/{e545df5ea7c0ced92cee.js → c424a66f1546275e2bcb.js} +1 -1
  123. package/assets/esri/core/workers/chunks/c60b4f2dd5fccdf362a7.js +1 -0
  124. package/assets/esri/core/workers/chunks/c6d0b4875b6b8d6bc25a.js +1 -0
  125. package/assets/esri/core/workers/chunks/c80fc1b3048e8d58a1f8.js +1 -0
  126. package/assets/esri/core/workers/chunks/c911f0b5bdd43b66b731.js +1 -0
  127. package/assets/esri/core/workers/chunks/c9a4601073e1a3eee9d0.js +1 -0
  128. package/assets/esri/core/workers/chunks/ccffaba50674adba7a0f.js +1 -0
  129. package/assets/esri/core/workers/chunks/{24646a1176ce34039155.js → cdf6ad970dc1893dac58.js} +1 -1
  130. package/assets/esri/core/workers/chunks/d13e003c9293cb7e2852.js +1 -0
  131. package/assets/esri/core/workers/chunks/d24e027bb8b2c09f25c8.js +1 -0
  132. package/assets/esri/core/workers/chunks/d2df8c328054dc6cb7b7.js +1 -0
  133. package/assets/esri/core/workers/chunks/d5c35a75fd4c41def420.js +1 -0
  134. package/assets/esri/core/workers/chunks/{5e3e0d7b85dfd52d1c7d.js → d78b7cac322755e87eb8.js} +1 -1
  135. package/assets/esri/core/workers/chunks/d7be278aed1fb37ad5ec.js +1 -0
  136. package/assets/esri/core/workers/chunks/d9695794cfaa014a55b1.js +1 -0
  137. package/assets/esri/core/workers/chunks/da1e8b338ab9fe9e0a8e.js +1 -0
  138. package/assets/esri/core/workers/chunks/dd920a6f6422fa213eba.js +1 -0
  139. package/assets/esri/core/workers/chunks/e1bf87077541da6853c6.js +1 -0
  140. package/assets/esri/core/workers/chunks/e279bcbe4f10e87bde6c.js +1 -0
  141. package/assets/esri/core/workers/chunks/e4406baf206b9e4c7e4f.js +1 -0
  142. package/assets/esri/core/workers/chunks/e499252cb52f7aed49a0.js +1 -0
  143. package/assets/esri/core/workers/chunks/{e178cd0e9178d6716410.js → e5837e5ac6ef761f26a2.js} +1 -1
  144. package/assets/esri/core/workers/chunks/e6a7272b59a4c2e34dca.js +1 -0
  145. package/assets/esri/core/workers/chunks/e912b515704e20313e53.js +1 -0
  146. package/assets/esri/core/workers/chunks/eac683a37339aa558455.js +1 -0
  147. package/assets/esri/core/workers/chunks/ec1841e6e498d54012eb.js +1 -0
  148. package/assets/esri/core/workers/chunks/ed3d16a5b4084ef61f8a.js +1 -0
  149. package/assets/esri/core/workers/chunks/ee07f54bc77fe9f8575a.js +1 -0
  150. package/assets/esri/core/workers/chunks/{e094364e54981c91e1b4.js → eeea5710275c967e8d51.js} +1 -1
  151. package/assets/esri/core/workers/chunks/ef46ef4f0ee9f2aeaa4a.js +1 -0
  152. package/assets/esri/core/workers/chunks/efb4aa5886730ea377bd.js +1 -0
  153. package/assets/esri/core/workers/chunks/{485d20152495c27b8074.js → f2a268c69f2a5566381b.js} +1 -1
  154. package/assets/esri/core/workers/chunks/f590db684d88e72bd79b.js +1 -0
  155. package/assets/esri/core/workers/chunks/f69df22a5c64389ebe28.js +1 -0
  156. package/assets/esri/core/workers/chunks/{f60292d97bcdbf19165b.js → f6d047358d14328f3622.js} +1 -1
  157. package/assets/esri/core/workers/chunks/f7fca88d120d45bb782a.js +1 -0
  158. package/assets/esri/core/workers/chunks/f819854098d63fe4ccdb.js +1 -0
  159. package/assets/esri/core/workers/chunks/f8f3579d0c1b65762902.js +1 -0
  160. package/assets/esri/core/workers/chunks/f98118127469449ca145.js +1 -0
  161. package/assets/esri/core/workers/chunks/f9ed05d4ad1f44d033bb.js +1 -0
  162. package/assets/esri/core/workers/chunks/fb6605be0c5e36785543.js +1 -0
  163. package/assets/esri/core/workers/chunks/fbe7dae0b4bf2d172487.js +1 -0
  164. package/assets/esri/core/workers/chunks/fc4d9be62cf5e9758842.js +1 -0
  165. package/assets/esri/core/workers/chunks/fd70a25ffdf2cc6c5be2.js +1 -0
  166. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  167. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  168. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  169. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  170. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +38 -8
  171. package/assets/esri/themes/dark/main.css +1 -1
  172. package/assets/esri/themes/light/main.css +1 -1
  173. package/assets/esri/themes/light/view.css +1 -1
  174. package/chunks/GaussianSplatComposition.glsl.js +1 -1
  175. package/chunks/GlobalIllumination.glsl.js +1 -1
  176. package/chunks/GlowComposition.glsl.js +2 -2
  177. package/chunks/OITBlend.glsl.js +3 -3
  178. package/chunks/OITBlendEmission.glsl.js +2 -2
  179. package/chunks/OITDimOpaque.glsl.js +2 -2
  180. package/chunks/SlicePlaneMaterial.glsl.js +4 -4
  181. package/chunks/bundle2.js +1 -1
  182. package/chunks/lyr3DMain.js +1 -1
  183. package/chunks/lyr3DWorker.js +1 -1
  184. package/chunks/vxlLayer.js +1 -1
  185. package/config.js +1 -1
  186. package/core/has.js +1 -1
  187. package/core/screenUtils.js +1 -1
  188. package/core/sql.d.ts +1 -1
  189. package/geometry/Extent.d.ts +0 -13
  190. package/geometry/Geometry.d.ts +10 -8
  191. package/geometry/Multipoint.d.ts +9 -0
  192. package/geometry/Multipoint.js +1 -1
  193. package/geometry/Point.d.ts +15 -71
  194. package/geometry/Polygon.js +1 -1
  195. package/geometry/support/geometryUtils.js +1 -1
  196. package/graphic/AnnotationGraphicOrigin.d.ts +34 -0
  197. package/graphic/AnnotationGraphicOrigin.js +2 -0
  198. package/graphic/DimensionFeatureGraphicOrigin.d.ts +34 -0
  199. package/graphic/DimensionFeatureGraphicOrigin.js +2 -0
  200. package/identity/IdentityManagerBase.js +1 -1
  201. package/interfaces.d.ts +11 -0
  202. package/kernel.js +1 -1
  203. package/layers/AnnotationLayer.d.ts +263 -32
  204. package/layers/AnnotationLayer.js +1 -1
  205. package/layers/DimensionFeatureLayer.d.ts +263 -32
  206. package/layers/DimensionFeatureLayer.js +1 -1
  207. package/layers/FeatureLayer.d.ts +1 -1
  208. package/layers/GeoJSONLayer.d.ts +7 -7
  209. package/layers/ParquetLayer.d.ts +22 -2
  210. package/layers/SceneLayer.d.ts +4 -2
  211. package/layers/VideoLayer.d.ts +7 -1
  212. package/layers/VideoLayer.js +1 -1
  213. package/layers/catalog/CatalogFootprintLayer.d.ts +40 -10
  214. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  215. package/layers/graphics/sources/parquet/ParquetFileInfo.js +2 -0
  216. package/layers/graphics/sources/parquet/ParquetFileStatistics.js +2 -0
  217. package/layers/graphics/sources/parquet/PortalParquetFileProvider.js +1 -1
  218. package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
  219. package/layers/graphics/sources/parquet/UrlsFileProvider.js +1 -1
  220. package/layers/graphics/sources/parquet/createFileProvider.js +1 -1
  221. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  222. package/layers/mixins/FeatureLayerBase.d.ts +40 -16
  223. package/layers/mixins/TemporalLayer.d.ts +4 -2
  224. package/layers/support/AnnotationSublayer.d.ts +44 -0
  225. package/layers/support/AnnotationSublayer.js +2 -0
  226. package/layers/support/GeometryEncodingLocation.d.ts +1 -1
  227. package/layers/support/GeometryEncodingWkb.d.ts +3 -2
  228. package/layers/support/ParquetFilesData.d.ts +13 -3
  229. package/layers/support/ParquetPortalItemData.d.ts +12 -1
  230. package/layers/support/arcgisLayers.js +1 -1
  231. package/layers/support/commonProperties.js +1 -1
  232. package/layers/support/featureLayerUtils.js +1 -1
  233. package/layers/support/layerUtils.js +1 -1
  234. package/layers/support/parquetUtils.js +1 -1
  235. package/layers/support/tiles3DUtils.js +1 -1
  236. package/layers/support/timeSeriesUtils.js +1 -1
  237. package/layers/video/types.d.ts +61 -1
  238. package/libs/parquet/parquet.js +1 -1
  239. package/package.json +1 -1
  240. package/request/types.d.ts +18 -20
  241. package/rest/support/Query.d.ts +1 -0
  242. package/support/revision.js +1 -1
  243. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  244. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
  245. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
  246. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  247. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexOutlineFillShader.js +1 -1
  248. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
  249. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
  250. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  251. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  252. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  253. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  254. package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
  255. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  256. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  257. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  258. package/views/2d/layers/KMLLayerView2D.js +1 -1
  259. package/views/2d/layers/MapNotesLayerView2D.js +1 -1
  260. package/views/2d/layers/MediaLayerView2D.js +1 -1
  261. package/views/2d/layers/RouteLayerView2D.js +1 -1
  262. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  263. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  264. package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
  265. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  266. package/views/2d/layers/graphics/GraphicStore.js +1 -1
  267. package/views/2d/support/hitTestUtils.js +1 -1
  268. package/views/3d/analysis/LineOfSight/LineOfSightAggregateManipulatedObject3D.js +2 -0
  269. package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
  270. package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
  271. package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
  272. package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
  273. package/views/3d/analysis/LineOfSight/LineOfSightPlacementLeafPlugin.js +2 -0
  274. package/views/3d/analysis/LineOfSight/LineOfSightPlacementTool.js +1 -1
  275. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +2 -0
  276. package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
  277. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  278. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  279. package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
  280. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
  281. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  282. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  283. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  284. package/views/3d/interactive/editingTools/reshape/isSupportedObject.js +1 -1
  285. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
  286. package/views/3d/interactive/editingTools/visualElementUtils.js +1 -1
  287. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  288. package/views/3d/layers/FlowSubView3D.js +1 -1
  289. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  290. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  291. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  292. package/views/3d/terrain/OverlayManager.js +1 -1
  293. package/views/3d/terrain/TerrainRenderer.js +1 -1
  294. package/views/3d/webgl/RenderNode.d.ts +25 -4
  295. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  296. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  297. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  298. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  299. package/views/3d/webgl-engine/core/shaderLibrary/util/EmissionDimming.glsl.js +1 -1
  300. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  301. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  302. package/views/3d/webgl-engine/effects/emissive/emissions.js +1 -1
  303. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  304. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  305. package/views/3d/webgl-engine/effects/transparency/OITBlendTechniqueConfiguration.js +1 -1
  306. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  307. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  308. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  309. package/views/3d/webgl-engine/lib/RendererBase.js +1 -1
  310. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  311. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  312. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  313. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +2 -2
  314. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  315. package/views/3d/webgl-engine/shaders/ToneMapping.glsl.js +6 -10
  316. package/views/draw/plugins/PolygonPlugin.js +1 -1
  317. package/views/interactive/interactiveToolUtils.js +1 -1
  318. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  319. package/views/interactive/snapping/LineSnapper.js +1 -1
  320. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  321. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  322. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  323. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  324. package/views/interactive/snapping/SnappingManager.js +1 -1
  325. package/views/interactive/snapping/snappingUtils.js +1 -1
  326. package/views/layers/FeatureLikeLayerView.d.ts +25 -1
  327. package/views/layers/FeatureLikeLayerView.js +1 -1
  328. package/views/types.d.ts +4 -4
  329. package/views/webgl/RenderingContext.js +1 -1
  330. package/views/webgl/renderState.js +1 -1
  331. package/webdoc/support/webdocSaveUtils.js +1 -1
  332. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +10 -2
  333. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  334. package/widgets/BatchAttributeForm/ReactiveContingentValuesManager.js +1 -1
  335. package/widgets/BatchAttributeForm/attachmentUtils.d.ts +14 -0
  336. package/widgets/BatchAttributeForm/attachmentUtils.js +1 -1
  337. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  338. package/widgets/BatchAttributeForm/css.js +1 -1
  339. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +8 -6
  340. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  341. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  342. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  343. package/widgets/BatchAttributeForm/inputs/support/attachmentValidationCriteriaState.d.ts +5 -0
  344. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  345. package/widgets/BatchAttributeForm/inputs/types.d.ts +8 -1
  346. package/widgets/BatchAttributeForm/interfaceUtils.js +1 -1
  347. package/widgets/BatchAttributeForm/rendered-content/RelationshipDetails.js +1 -1
  348. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  349. package/widgets/BatchAttributeForm.d.ts +9 -1
  350. package/widgets/BatchAttributeForm.js +1 -1
  351. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  352. package/widgets/FeatureTable/Grid/Column.js +1 -1
  353. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  354. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  355. package/widgets/FeatureTable/Grid/GroupColumn.js +1 -1
  356. package/widgets/FeatureTable.js +1 -1
  357. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  358. package/widgets/Print/PrintViewModel.js +1 -1
  359. package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +7 -1
  360. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  361. package/widgets/support/ContingentValuesManager.js +1 -1
  362. package/assets/esri/core/workers/chunks/02aaeaa988e9e7d65a7f.js +0 -1
  363. package/assets/esri/core/workers/chunks/03354ad3d74d858173b4.js +0 -1
  364. package/assets/esri/core/workers/chunks/09a4139fc6d069ab6928.js +0 -1
  365. package/assets/esri/core/workers/chunks/0a510acf50915e00c62b.js +0 -1
  366. package/assets/esri/core/workers/chunks/0a780a883abfcdf0b900.js +0 -1
  367. package/assets/esri/core/workers/chunks/0fbf9bf52ecb4cd8293b.js +0 -1
  368. package/assets/esri/core/workers/chunks/119d352dd586f2bb61ec.js +0 -1
  369. package/assets/esri/core/workers/chunks/130784a27661de6b52a5.js +0 -1
  370. package/assets/esri/core/workers/chunks/145364aa20b4435294c2.js +0 -1
  371. package/assets/esri/core/workers/chunks/1595dc499a06b23b6a96.js +0 -1
  372. package/assets/esri/core/workers/chunks/16713986893adfbc9331.js +0 -1
  373. package/assets/esri/core/workers/chunks/179c9fe4ac83b42e5976.js +0 -1
  374. package/assets/esri/core/workers/chunks/19dcae83be0fc0aced02.js +0 -1
  375. package/assets/esri/core/workers/chunks/1c64e10f966e26af6fed.js +0 -1
  376. package/assets/esri/core/workers/chunks/1eabe746481e0b228498.js +0 -1
  377. package/assets/esri/core/workers/chunks/201007cf1a91e2b126fc.js +0 -1
  378. package/assets/esri/core/workers/chunks/20d0adc678f11981059c.js +0 -1
  379. package/assets/esri/core/workers/chunks/227eff8aa4a6f5f03bc2.js +0 -1
  380. package/assets/esri/core/workers/chunks/233ff588798c8a5eedf4.js +0 -1
  381. package/assets/esri/core/workers/chunks/238478cfe493fd4a6100.js +0 -1
  382. package/assets/esri/core/workers/chunks/24647e7424798dccdaf5.js +0 -1
  383. package/assets/esri/core/workers/chunks/249616ea2d90d40a8299.js +0 -1
  384. package/assets/esri/core/workers/chunks/24d9e4f1c7b8ff0d2cce.js +0 -1
  385. package/assets/esri/core/workers/chunks/2b36a54927f5a7281da3.js +0 -1
  386. package/assets/esri/core/workers/chunks/2bcd4d395bfe6a19ccc8.js +0 -1
  387. package/assets/esri/core/workers/chunks/2c8584ec1c3c9fd5aba2.js +0 -1
  388. package/assets/esri/core/workers/chunks/2d374cc8c54a722a7afe.js +0 -1
  389. package/assets/esri/core/workers/chunks/2e11b4e9d66474a60064.js +0 -1
  390. package/assets/esri/core/workers/chunks/2fa080539d039c92ce08.js +0 -1
  391. package/assets/esri/core/workers/chunks/3109b05fe4fc40d4f25b.js +0 -1
  392. package/assets/esri/core/workers/chunks/31442f25d550ead58fc4.js +0 -1
  393. package/assets/esri/core/workers/chunks/32323b0e0fcecd8f640e.js +0 -1
  394. package/assets/esri/core/workers/chunks/330da3828eefd8d72d3f.js +0 -1
  395. package/assets/esri/core/workers/chunks/33e0130e6a40fc768978.js +0 -1
  396. package/assets/esri/core/workers/chunks/343ba5ea459e96ba79c6.js +0 -1
  397. package/assets/esri/core/workers/chunks/388e71e8f2ec41bfa5a9.js +0 -1
  398. package/assets/esri/core/workers/chunks/3a5c1c501808352857bd.js +0 -1
  399. package/assets/esri/core/workers/chunks/3aacaa1be5efeac23a37.js +0 -1
  400. package/assets/esri/core/workers/chunks/3b765a8cac9e92f644f2.js +0 -1
  401. package/assets/esri/core/workers/chunks/3bf6d55511cd7722eb93.js +0 -1
  402. package/assets/esri/core/workers/chunks/3e012cd3ca4451f89f59.js +0 -1
  403. package/assets/esri/core/workers/chunks/3fbb6ff940156a981983.js +0 -1
  404. package/assets/esri/core/workers/chunks/40910c69307e2d2d3f28.js +0 -1
  405. package/assets/esri/core/workers/chunks/40c4e14e7bb505ef10a3.js +0 -1
  406. package/assets/esri/core/workers/chunks/4104fa1ede36bcee9be5.js +0 -1
  407. package/assets/esri/core/workers/chunks/423a9882abd4a6dadf86.js +0 -1
  408. package/assets/esri/core/workers/chunks/428561df7ba6f02e2d80.js +0 -1
  409. package/assets/esri/core/workers/chunks/45323491f9005629c602.js +0 -1
  410. package/assets/esri/core/workers/chunks/46d0a25d33b5b328cfce.js +0 -1
  411. package/assets/esri/core/workers/chunks/47dd2bfecc5c4b5f10f0.js +0 -1
  412. package/assets/esri/core/workers/chunks/4845df00f6ebcce6ea3e.js +0 -1
  413. package/assets/esri/core/workers/chunks/48fcc10768d93e95a04e.js +0 -1
  414. package/assets/esri/core/workers/chunks/4a9dd9f8aa98882218f3.js +0 -1
  415. package/assets/esri/core/workers/chunks/4bfffdfbe6d467f143a4.js +0 -1
  416. package/assets/esri/core/workers/chunks/518046d2b95a7590a092.js +0 -1
  417. package/assets/esri/core/workers/chunks/54dad475dc806a38c287.js +0 -1
  418. package/assets/esri/core/workers/chunks/552945a73a95cd2a9f54.js +0 -1
  419. package/assets/esri/core/workers/chunks/5553279998ae07b60f5f.js +0 -1
  420. package/assets/esri/core/workers/chunks/58155f24f8ed6aca7a21.js +0 -1
  421. package/assets/esri/core/workers/chunks/5838f46d341d2fde42ee.js +0 -1
  422. package/assets/esri/core/workers/chunks/592a599f514de373dead.js +0 -1
  423. package/assets/esri/core/workers/chunks/5aba23584e0b230c75f5.js +0 -1
  424. package/assets/esri/core/workers/chunks/5f9bacee6fbf9ac1bca0.js +0 -1
  425. package/assets/esri/core/workers/chunks/62206d5d497b95fc4caf.js +0 -1
  426. package/assets/esri/core/workers/chunks/624b1bb269744142b835.js +0 -1
  427. package/assets/esri/core/workers/chunks/62fc3c367f736c73b0d7.js +0 -1
  428. package/assets/esri/core/workers/chunks/643c33a98f2d30a92001.js +0 -1
  429. package/assets/esri/core/workers/chunks/64daa2a714e59d22bbd4.js +0 -1
  430. package/assets/esri/core/workers/chunks/65621650a53f69f7b05a.js +0 -1
  431. package/assets/esri/core/workers/chunks/6a5356ebed70e0f8f979.js +0 -1
  432. package/assets/esri/core/workers/chunks/6c9933f948efd7923aa1.js +0 -1
  433. package/assets/esri/core/workers/chunks/6cab67fc7044ee9b863b.js +0 -1
  434. package/assets/esri/core/workers/chunks/7014e73dfd3c8baa704c.js +0 -1
  435. package/assets/esri/core/workers/chunks/75839240022b280929f7.js +0 -1
  436. package/assets/esri/core/workers/chunks/76589434d573111a8fb4.js +0 -1
  437. package/assets/esri/core/workers/chunks/767ea5b455b3823afd09.js +0 -1
  438. package/assets/esri/core/workers/chunks/77859a61d059738d057f.js +0 -1
  439. package/assets/esri/core/workers/chunks/78aa5bc6af2758da20d0.js +0 -1
  440. package/assets/esri/core/workers/chunks/7b564226def99fcf79d8.js +0 -1
  441. package/assets/esri/core/workers/chunks/7bbffe07e62897928773.js +0 -1
  442. package/assets/esri/core/workers/chunks/7cadfd7444a2a05cf2fb.js +0 -1
  443. package/assets/esri/core/workers/chunks/7df94cb985db41815fad.js +0 -2
  444. package/assets/esri/core/workers/chunks/823789261ca3338f0fa8.js +0 -1
  445. package/assets/esri/core/workers/chunks/8419934bec7723b0feef.js +0 -1
  446. package/assets/esri/core/workers/chunks/84b0b6e099d949e0fea5.js +0 -1
  447. package/assets/esri/core/workers/chunks/9133c1b7cc1c9da27deb.js +0 -1
  448. package/assets/esri/core/workers/chunks/92ab5886aa2d8b9b179f.js +0 -1
  449. package/assets/esri/core/workers/chunks/9a6e62ef984e9c5babc4.js +0 -1
  450. package/assets/esri/core/workers/chunks/9b676606bf839b7aa433.js +0 -1
  451. package/assets/esri/core/workers/chunks/9d27cc631bab8aa7479e.js +0 -1
  452. package/assets/esri/core/workers/chunks/9dcfaca1f4fa8c8026ac.js +0 -1
  453. package/assets/esri/core/workers/chunks/9f23a61c60949459c14f.js +0 -30
  454. package/assets/esri/core/workers/chunks/a03c4c0bf138734a002e.js +0 -1
  455. package/assets/esri/core/workers/chunks/a0fa60a24e58f7a47e41.js +0 -1
  456. package/assets/esri/core/workers/chunks/a261f4c22224511fdfff.js +0 -1
  457. package/assets/esri/core/workers/chunks/a2ac139d0975085279a6.js +0 -1
  458. package/assets/esri/core/workers/chunks/a806ac351ef5da04c250.js +0 -1
  459. package/assets/esri/core/workers/chunks/ab94c9f62462d7a98f6a.js +0 -1
  460. package/assets/esri/core/workers/chunks/abdb05754c50776c3edd.js +0 -1
  461. package/assets/esri/core/workers/chunks/ad488985824fbb830ed6.js +0 -1
  462. package/assets/esri/core/workers/chunks/b0ac4b0b7aec70cfe6eb.js +0 -1
  463. package/assets/esri/core/workers/chunks/b23009d9f8eb7c20ce45.js +0 -1
  464. package/assets/esri/core/workers/chunks/bfbd1ca28ed2f263e58f.js +0 -1
  465. package/assets/esri/core/workers/chunks/c1b6de0d728d25d7905a.js +0 -1
  466. package/assets/esri/core/workers/chunks/c44be4aaba829e6d149d.js +0 -1
  467. package/assets/esri/core/workers/chunks/ca6907e14b1dde4d5c07.js +0 -1
  468. package/assets/esri/core/workers/chunks/cbbd94c53e75efc99876.js +0 -1
  469. package/assets/esri/core/workers/chunks/ce0e627a5e1cb78adce8.js +0 -1
  470. package/assets/esri/core/workers/chunks/cf7acf5acb6d322fd996.js +0 -1
  471. package/assets/esri/core/workers/chunks/d21480b078ec9680d4c4.js +0 -1
  472. package/assets/esri/core/workers/chunks/d81291dac1932350eccd.js +0 -1
  473. package/assets/esri/core/workers/chunks/da3c54e27a808f4fcc18.js +0 -1
  474. package/assets/esri/core/workers/chunks/dc6d50e1097a920ff820.js +0 -1
  475. package/assets/esri/core/workers/chunks/dd58286dde3b20356f84.js +0 -1
  476. package/assets/esri/core/workers/chunks/dfeddb7b17fa9eaae64c.js +0 -1
  477. package/assets/esri/core/workers/chunks/e4e0c5a45cf32973d5d5.js +0 -1
  478. package/assets/esri/core/workers/chunks/e638391801ad83fe4a68.js +0 -1
  479. package/assets/esri/core/workers/chunks/e755477dc78e9d6038d4.js +0 -1
  480. package/assets/esri/core/workers/chunks/e7712467db46e1385cf4.js +0 -1
  481. package/assets/esri/core/workers/chunks/ed2cb60e4f17f46fb78d.js +0 -1
  482. package/assets/esri/core/workers/chunks/edb55329305becdb204f.js +0 -1
  483. package/assets/esri/core/workers/chunks/f02fe24177e56a7e42b2.js +0 -1
  484. package/assets/esri/core/workers/chunks/f1fb2f12371f4c562079.js +0 -1
  485. package/assets/esri/core/workers/chunks/f3dfe1bd1146a6927407.js +0 -1
  486. package/assets/esri/core/workers/chunks/ff48334528d2554db4fe.js +0 -1
  487. package/views/3d/analysis/LineOfSight/LineOfSightAuthoringStore.js +0 -2
  488. /package/assets/esri/core/workers/chunks/{7df94cb985db41815fad.js.LICENSE.txt → 68f9b2da1fd08785320f.js.LICENSE.txt} +0 -0
  489. /package/assets/esri/core/workers/chunks/{875cce0be4f6c89f80f3.js.LICENSE.txt → 9629601de5e44ffe90ea.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as n,when as a}from"../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as r}from"../../../../support/elevationInfoUtils.js";import{LineOfSightDrawToolRenderer as l}from"./LineOfSightDrawToolRenderer.js";import{createLineOfSightRootPluginConfiguration as p}from"./LineOfSightRootPlugin.js";import{Manipulator3D as h}from"../../interactive/Manipulator3D.js";import{DrawTool as c}from"../../../draw/DrawTool.js";import{mouseButtons as u}from"../../../input/mouseButtons.js";import d from"../../../interactive/sketch/SketchOptions.js";import{acquire as v}from"../../../interactive/snapping/SnappingManagerPool.js";const g=Symbol("hiddenManipulatorHandle"),m=Symbol("snappingManagerHandle");let f=class extends c{constructor(e){super({...e,enableVertexVisuals:!1,sketchOptions:new d({tooltips:{enabled:!0}}),snappingManager:null,elevationInfo:null,hasZ:!0}),this.removeIncompleteOnCancel=!1,this.placementElevationInfo=null,this._snappingManagerResult=null,this.renderer=new l({view:e.view})}initialize(){this.addHandles([i(()=>[this.surfaceManager,this._snapToSceneEnabled],([e,t])=>{e&&(e.snapToSceneEnabled=t)},n),i(()=>this.manipulators.length,()=>this._hideManipulatorOnAppearance(),n),a(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},n),i(()=>this.analysisViewData.visible,e=>{this.visible=e},n),i(()=>this.parent.editable,e=>{this.editable=e},n),i(()=>this._sourceElevationInfo,e=>{this.elevationInfo=e,this.renderer.elevationInfo=e,this.renderer.refresh()},n),i(()=>this.analysis.valid,()=>this._syncCreatedState(),n)])}destroy(){this.removeHandles(g)}get state(){return this.active?"creating":null!=this.analysis.observer?.position?"created":"ready"}get _snapToSceneEnabled(){const e=this._sourceElevationInfo?.mode;return"relative-to-ground"!==e&&"on-the-ground"!==e&&null}get _defaultElevationInfo(){return this.placementElevationInfo}get _sourceElevationInfo(){return this.placementElevationInfo??r}deactivate(){super.deactivate(),this._releaseSnappingManager(),this.created||(this.analysis.clear(),this.analysisViewData.cursorTarget=null)}resetCreated(){this._set("created",!1),this._syncCreatedState()}_syncCreatedState(){this.analysis.valid&&this.finishToolCreation()}place(){this.begin([p({analysis:this.analysis,analysisViewData:this.analysisViewData,authoringStore:this.authoringStore,defaultElevationInfo:this._defaultElevationInfo,sourceElevationInfo:this._sourceElevationInfo,view:this.view})])}continue(){this._ensureSnappingManager(),this.view.activeTool!==this&&(this.view.activeTool=this),0===this.pluginStack.length&&this.place()}stop(){if(!this.active)return;const e=this.mostUpstreamPlugin;e&&this.lifecycleManager.cancel(e),this.view.activeTool===this&&(this.view.activeTool=null)}get testInfo(){}onInputEvent(e){if("immediate-click"===e.type&&"mouse"===e.pointerType){if(e.button===u.Right)return;if(e.native.detail>1)return}super.onInputEvent(e)}_hideManipulatorOnAppearance(){this.removeHandles(g),this.addHandles(this.manipulators.toArray().map(e=>e instanceof h?e.disableDisplay():null).filter(t),g)}_ensureSnappingManager(){if(this._snappingManagerResult)return;const e=v(this.view);this._snappingManagerResult=e,this.snappingManager=e.snappingManager,this.addHandles(e,m)}_releaseSnappingManager(){this._snappingManagerResult&&(this.snappingManager?.doneSnapping(),this.snappingManager=null,this.removeHandles(m),this._snappingManagerResult=null)}};e([s({constructOnly:!0})],f.prototype,"view",void 0),e([s({constructOnly:!0})],f.prototype,"analysis",void 0),e([s({constructOnly:!0})],f.prototype,"analysisViewData",void 0),e([s({constructOnly:!0})],f.prototype,"authoringStore",void 0),e([s({constructOnly:!0})],f.prototype,"parent",void 0),e([s()],f.prototype,"renderer",void 0),e([s()],f.prototype,"removeIncompleteOnCancel",void 0),e([s()],f.prototype,"placementElevationInfo",void 0),e([s()],f.prototype,"_snappingManagerResult",void 0),e([s()],f.prototype,"state",null),f=e([o("esri.views.3d.analysis.LineOfSight.LineOfSightPlacementTool")],f);export{f as LineOfSightPlacementTool};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as s,when as a}from"../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p,fromPoints as c}from"../../../../geometry/support/lineSegment.js";import{absoluteHeightElevationInfo as h}from"../../../../support/elevationInfoUtils.js";import{getLaserLineColors as u,laserLineConfiguration as d}from"./LineOfSightConfiguration.js";import{LineOfSightDrawToolRenderer as m}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as g}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as v}from"./LineOfSightRayIntersector.js";import{createLineOfSightRootPluginConfiguration as f}from"./LineOfSightRootPlugin.js";import{Manipulator3D as y}from"../../interactive/Manipulator3D.js";import{LaserlineVisualElement as _}from"../../interactive/visualElements/LaserlineVisualElement.js";import{DrawTool as P}from"../../../draw/DrawTool.js";import{mouseButtons as w}from"../../../input/mouseButtons.js";import S from"../../../interactive/sketch/SketchOptions.js";import{acquire as b}from"../../../interactive/snapping/SnappingManagerPool.js";import{createScreenPointFromEvent as E}from"../../../support/screenUtils.js";const M=Symbol("hiddenManipulatorHandle"),C=Symbol("snappingManagerHandle"),L=l(),I=l(),T=p();let V=class extends P{get cursor(){return this.active?"crosshair":null}constructor(e){super({...e,enableVertexVisuals:!1,sketchOptions:new S({tooltips:{enabled:!0}}),snappingManager:null,elevationInfo:null,hasZ:!0}),this.removeIncompleteOnCancel=!1,this._lastPlacementClickScreenPoint=null,this._lastPlacementClickPromise=null,this.placementElevationInfo=null,this._snappingManagerResult=null,this._laserlineVisualElement=null,this.renderer=new m({view:e.view}),this._intersector=new v({view:e.view})}initialize(){this._createLaserLine(),this.addHandles([n(()=>[this.surfaceManager,this._snapToSceneEnabled],([e,t])=>{e&&(e.snapToSceneEnabled=t)},s),n(()=>this.manipulators.length,()=>this._hideManipulatorOnAppearance(),s),a(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},s),n(()=>this.analysisViewData.visible,e=>{this.visible=e},s),n(()=>this.parent.editable,e=>{this.editable=e},s),n(()=>this._sourceElevationInfo,e=>{this.elevationInfo=e,this.renderer.elevationInfo=e,this.renderer.refresh()},s),n(()=>this.analysis.valid,()=>this._syncCreatedState(),s),n(()=>u(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:i})=>this._updateLaserLineStyle(e,t,i),s),n(()=>({active:this.active,cursorTargetPosition:this.analysisViewData.cursorTarget?.position,observerPosition:this.analysis.observer?.position,visible:this.visible}),()=>this._updateLaserLineRenderer(),s)])}destroy(){this._intersector.destroy(),this._releaseSnappingManager(),this._laserlineVisualElement=i(this._laserlineVisualElement),this.removeHandles(M)}get state(){return this.active?"creating":null!=this.analysis.observer?.position?"created":"ready"}get activeSnappingManager(){return this.active?this.snappingManager:null}get _snapToSceneEnabled(){const e=this._sourceElevationInfo?.mode;return"relative-to-ground"!==e&&"on-the-ground"!==e&&null}get _defaultElevationInfo(){return this.placementElevationInfo}get _sourceElevationInfo(){return this.placementElevationInfo??h}deactivate(){super.deactivate(),this._releaseSnappingManager(),this.created||(this.analysis.clear(),this.analysisViewData.cursorTarget=null)}resetCreated(){this._set("created",!1),this._syncCreatedState()}_syncCreatedState(){this.analysis.valid&&this.finishToolCreation()}_createLaserLine(){this._laserlineVisualElement=i(this._laserlineVisualElement);const{glowWidth:e,innerWidth:t}=d;this._laserlineVisualElement=new _({view:this.view,attached:!0,visible:!1,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_updateLaserLineRenderer(){const e=this._laserlineVisualElement,t=this.analysis.observer?.position,i=this.analysisViewData.cursorTarget?.position;null!=e&&this.active&&this.visible&&null!=t&&null!=i&&j(this.view,t,L)&&j(this.view,i,I)?(e.visible=!0,e.heightManifoldTarget=I,e.lineVerticalPlaneSegment=c(L,I,T)):this._hideLaserLine()}_hideLaserLine(){const e=this._laserlineVisualElement;null!=e&&(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_updateLaserLineStyle(e,t,i){const n=this._laserlineVisualElement;if(null==n)return;const s=n.style;n.style={...s,glowColor:e.toUnitRGB(),innerColor:t.toUnitRGB(),globalAlpha:i}}place(){this.begin([f({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultElevationInfo:this._defaultElevationInfo,sourceElevationInfo:this._sourceElevationInfo,view:this.view})])}continue(){this._ensureSnappingManager(),this.view.activeTool!==this&&(this.view.activeTool=this),0===this.pluginStack.length&&this.place()}stop(){if(!this.active)return;const e=this.mostUpstreamPlugin;e&&this.lifecycleManager.cancel(e),this.view.activeTool===this&&(this.view.activeTool=null)}get testInfo(){}onInputEvent(e){if("immediate-double-click"===e.type&&e.button!==w.Right){const t=E(e),i=this._isLastPlacementClick(t),n=i?null:this._intersector.getScreenPointIntersection(t),s=i?this._lastPlacementClickPromise:null!=n?.mapPoint?this._addPointFromClickEvent(e,t,n):null;return s?this.addPromise(s.finally(()=>this.stop())):this.stop(),void e.stopPropagation()}if("immediate-click"===e.type){const t=E(e);if(e.button===w.Right)return;if("mouse"===e.pointerType&&e.native.detail>1&&this._isLastPlacementClick(t))return void e.stopPropagation();const i=this._intersector.getScreenPointIntersection(t);return null==i?.mapPoint?void e.stopPropagation():void this._addPointFromClickEvent(e,t,i)}super.onInputEvent(e)}_addPointFromClickEvent(e,t,i){const n=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,e.pointerType);if(!this.editable||null==n)return null;this.lastScreenPosition=t,this._lastPlacementClickScreenPoint=t,this._setPreservedIntersection(i),e.stopPropagation();const s=this.addPromise(n.moveTo(t,{...this.movementCommandContext,pointerType:e.pointerType,skipSnapping:"touch"===e.pointerType}).then(()=>this.forceAddVertex()));return this._lastPlacementClickPromise=s,s}_setPreservedIntersection(e){const t=this.mostDownstreamPlugin;g(t)&&(t.preservedIntersection=e)}_isLastPlacementClick(e){const t=this._lastPlacementClickScreenPoint;return null!=t&&t.x===e.x&&t.y===e.y}_hideManipulatorOnAppearance(){this.removeHandles(M),this.addHandles(this.manipulators.toArray().map(e=>e instanceof y?e.disableDisplay():null).filter(t),M)}_ensureSnappingManager(){if(this._snappingManagerResult)return;const e=b(this.view);this._snappingManagerResult=e,this.snappingManager=e.snappingManager,this.addHandles(e,C)}_releaseSnappingManager(){this._snappingManagerResult&&(this.snappingManager?.doneSnapping(),this.snappingManager=null,this.removeHandles(C),this._snappingManagerResult=null)}};function j(e,t,i){return e.renderCoordsHelper.toRenderCoords(t,i)}e([r({constructOnly:!0})],V.prototype,"view",void 0),e([r({constructOnly:!0})],V.prototype,"analysis",void 0),e([r({constructOnly:!0})],V.prototype,"analysisViewData",void 0),e([r({constructOnly:!0})],V.prototype,"parent",void 0),e([r()],V.prototype,"renderer",void 0),e([r()],V.prototype,"removeIncompleteOnCancel",void 0),e([r()],V.prototype,"placementElevationInfo",void 0),e([r()],V.prototype,"cursor",null),e([r()],V.prototype,"_snappingManagerResult",void 0),e([r()],V.prototype,"state",null),V=e([o("esri.views.3d.analysis.LineOfSight.LineOfSightPlacementTool")],V);export{V as LineOfSightPlacementTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{create as o,fromPoints as l}from"../../../../geometry/support/lineSegment.js";import{LineOfSightAggregateManipulatedObject3D as h}from"./LineOfSightAggregateManipulatedObject3D.js";import{getLaserLineColors as p,laserLineConfiguration as u}from"./LineOfSightConfiguration.js";import{ReshapeTool3D as c}from"../../interactive/editingTools/reshape/ReshapeTool3D.js";import{LaserlineVisualElement as g}from"../../interactive/visualElements/LaserlineVisualElement.js";import d from"../../../interactive/sketch/SketchOptions.js";import{acquire as _}from"../../../interactive/snapping/SnappingManagerPool.js";const v=Symbol("line-of-sight-reshape-laser-line-manipulators"),b=Symbol("line-of-sight-reshape-tool-operations"),m=o();let L=class extends t{constructor(e){super(e),this.visible=!0,this._editing=!1,this._grabbedManipulator=null,this._laserlineVisualElement=null,this._snappingManagerResult=_(e.view),this._object=new h({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:e.intersector,view:e.view}),this._reshapeTool=new c({autoHideManipulators:!1,enableDeleteVertices:!0,enableEdgeOffset:!1,enableMidpoints:!1,enableMoveObject:!1,object:this._object,sketchOptions:new d({tooltips:{enabled:!0}}),snappingManager:this._snappingManagerResult.snappingManager,view:e.view})}initialize(){this.view.tools.add(this._reshapeTool),this._createLaserLine(),this.addHandles([this._snappingManagerResult,this._reshapeTool.events.on("manipulators-changed",()=>{this._syncLaserLineManipulatorHandles(),this._updateLaserLineRenderer()}),this._reshapeTool.events.on("reshape",e=>{"reshape-start"===e.type?this._editing=!0:"reshape-stop"===e.type&&(this._editing=!1,this._grabbedManipulator=null),this._updateLaserLineRenderer()}),this._reshapeTool.events.on("move",e=>{"move-start"===e.type?this._editing=!0:"move-stop"===e.type&&(this._editing=!1,this._grabbedManipulator=null),this._updateLaserLineRenderer()}),a(()=>this.active,e=>{e||this._cleanupAfterDeactivate()}),a(()=>p(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:i})=>this._updateLaserLineStyle(e,t,i),s),a(()=>({active:this.active,analysisVisible:this.analysisViewData.visible,targetCount:this.analysis.targets.length,visible:this.visible}),()=>{this._syncLaserLineManipulatorHandles(),this._updateLaserLineRenderer()},s),a(()=>this._object.operations,e=>{this.removeHandles(b),null!=e&&this.addHandles([e.on("can-redo-change",()=>this.notifyChange("canRedo")),e.on("can-undo-change",()=>this.notifyChange("canUndo"))],b),this.notifyChange("canUndo"),this.notifyChange("canRedo")},s)])}destroy(){this.stop(),this.removeHandles(v),this.view.tools.remove(this._reshapeTool),this._reshapeTool.destroy(),this._object.destroy(),this._laserlineVisualElement=i(this._laserlineVisualElement)}get active(){return this._reshapeTool.active}get canRedo(){return this._reshapeTool.canRedo}get canUndo(){return this._reshapeTool.canUndo}get updating(){return this._reshapeTool.updating}get snappingManager(){return this.active?this._reshapeTool.snappingManager:null}get laserLineVisualElement(){return this._laserlineVisualElement}activate(){this._reshapeTool.visible=this.visible,this.view.activeTool!==this._reshapeTool&&(this.view.activeTool=this._reshapeTool),this._reshapeTool.activate()}getTargetManipulator(e){return this._object.getTargetManipulator(e)}getObserverManipulator(){return this._object.getObserverManipulator()}redo(){this._reshapeTool.redo()}clearSelection(){this._reshapeTool.clearSelection()}applySelection(e){const t="observer"===e.type?this._object.getObserverManipulator():this._object.getTargetManipulator(e.target);return null!=t&&this._reshapeTool.selectManipulator(t)}setEditableFlag(e,t){this._reshapeTool.setEditableFlag(e,t)}stop(){this.view.activeTool===this._reshapeTool&&(this.view.activeTool=null),this._editing=!1,this._grabbedManipulator=null,this._hideLaserLine()}suspend(){this.clearSelection(),this.snappingManager?.doneSnapping(),this.stop()}undo(){this._reshapeTool.undo()}_cleanupAfterDeactivate(){this._editing=!1,this._grabbedManipulator=null,this._reshapeTool.snappingManager?.doneSnapping(),this._hideLaserLine()}_createLaserLine(){this._laserlineVisualElement=i(this._laserlineVisualElement);const{glowWidth:e,innerWidth:t}=u;this._laserlineVisualElement=new g({view:this.view,attached:!0,visible:!1,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_updateLaserLineRenderer(){const e=this._laserlineVisualElement,t=this._object.getObserverManipulator(),i=this._getLaserLineManipulator();null!=e&&this.active&&this.visible&&this.analysisViewData.visible&&null!=t&&null!=i?(e.visible=!0,e.heightManifoldTarget=i.renderLocation,e.lineVerticalPlaneSegment=i===t?null:l(t.renderLocation,i.renderLocation,m)):this._hideLaserLine()}_hideLaserLine(){const e=this._laserlineVisualElement;null!=e&&(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_updateLaserLineStyle(e,t,i){const a=this._laserlineVisualElement;if(null==a)return;const s=a.style;a.style={...s,glowColor:e.toUnitRGB(),innerColor:t.toUnitRGB(),globalAlpha:i}}_getLaserLineManipulator(){const e=this._grabbedManipulator;if(this._editing){const e=this._getSelectedManipulator();if(null!=e)return e}if(null!=e?.view)return e;for(const i of this.analysis.targets){const e=this._object.getTargetManipulator(i);if(y(e))return e}const t=this._object.getObserverManipulator();return y(t)?t:null}_getSelectedManipulator(){let e=null;for(const t of this._getLaserLineManipulators())if(t.selected){if(null!=e)return null;e=t}return e}_syncLaserLineManipulatorHandles(){this.removeHandles(v);const e=this._getLaserLineManipulators();null==this._grabbedManipulator||e.includes(this._grabbedManipulator)||(this._grabbedManipulator=null),this.addHandles(e.flatMap(e=>[e.events.on("grab-changed",t=>{"start"===t.action?this._grabbedManipulator=e:this._grabbedManipulator===e&&(this._grabbedManipulator=null),this._updateLaserLineRenderer()}),e.events.on("location-update",()=>this._updateLaserLineRenderer())]),v)}_getLaserLineManipulators(){return[this._object.getObserverManipulator(),...this.analysis.targets.toArray().map(e=>this._object.getTargetManipulator(e))].filter(e=>null!=e)}};function y(e){return null!=e&&e.grabbing}e([n({constructOnly:!0})],L.prototype,"analysisViewData",void 0),e([n({constructOnly:!0})],L.prototype,"analysis",void 0),e([n({constructOnly:!0})],L.prototype,"intersector",void 0),e([n({constructOnly:!0})],L.prototype,"view",void 0),e([n()],L.prototype,"visible",void 0),e([n()],L.prototype,"active",null),e([n()],L.prototype,"canRedo",null),e([n()],L.prototype,"canUndo",null),e([n()],L.prototype,"updating",null),L=e([r("esri.views.3d.analysis.LineOfSight.LineOfSightReshapeTool3D")],L);export{L as LineOfSightReshapeTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisObserver.js";import i from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{isPoint as r,isMultipoint as a}from"../../../../geometry/support/typeUtils.js";import{getLineOfSightMapPointIntersection as l,updateLineOfSightItemFromIntersection as u}from"./LineOfSightAuthoringUtils.js";import{isLineOfSightObserverPlugin as h,createLineOfSightObserverPluginConfiguration as c}from"./LineOfSightObserverPlugin.js";import{LineOfSightRayIntersector as g}from"./LineOfSightRayIntersector.js";import{isLineOfSightTargetPlugin as m,createLineOfSightTargetPluginConfiguration as p}from"./LineOfSightTargetPlugin.js";import{PluginBase as y}from"../../../draw/plugins/PluginBase.js";let d=class extends y{constructor(){super(...arguments),this.defaultElevationInfo=null,this.sourceElevationInfo=null,this._hadInitialObserver=!1,this._initialTargetCount=0,this._intersector=null,this._downstreamPlugin=null}initialize(){this._intersector=new g({view:this.view})}destroy(){this._intersector=s(this._intersector)}start(t){super.start(t),this.authoringStore.syncFromAnalysis(this.analysis),this._hadInitialObserver=null!=this.analysis.observer,this._initialTargetCount=this.authoringStore.targetItems.length,t.session.appendOrReplacePart(null,[]),this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}beforeAttachPlugin(t){return{geometryType:"point",useStandaloneSession:!0}}beforeComplete(){return{downstreamPluginCompletionMode:"cancel"}}attachPlugin(t){this._downstreamPlugin=t}afterUndoRedo(){this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}detachPlugin(t,s){if(this._downstreamPlugin===t&&(this._downstreamPlugin=null),m(t)&&this._clearCursorTarget(),"complete"!==s)return void this._syncAnalysisFromSession();const n=this._context?.getSession(t)?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"point"});if(!n||!r(n))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();const o=this._intersector&&l(this._intersector,this.view,n,this.sourceElevationInfo);if(!o)return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();if(this._truncateItemsToSession(),h(t)){const i=t.observer??new e;u(this.view,i,o,n,this.defaultElevationInfo,this.sourceElevationInfo),this.authoringStore.setObserver(i)}else if(m(t)){const e=t.target??new i;u(this.view,e,o,n,this.defaultElevationInfo,this.sourceElevationInfo),this.authoringStore.addTarget(e)}this._appendCommittedPoint(n),this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}_appendCommittedPoint(t){const e=this._session;e&&(e.appendOrReplacePoint(null,t),e.appendOrReplacePart(null,[]),e.automaticRestart=!1,e.groupGeometryChanges())}_clearCursorTarget(){this.analysisViewData.cursorTarget=s(this.analysisViewData.cursorTarget)}_truncateItemsToSession(){const t=this._getCommittedPointCount();this._hadInitialObserver||0!==t||this.authoringStore.setObserver(null),this.authoringStore.truncateTargets(this._initialTargetCount+this._getCommittedOperationTargetCount(t))}_restartDownstreamPlugin(){const t=null==this.analysis.observer,e=t?this._createObserverPluginConfiguration():this._createTargetPluginConfiguration();t&&h(this._downstreamPlugin)||!t&&m(this._downstreamPlugin)||this._context?.requestBeginDownstreamPlugin(e,{cancelExisting:!0})}_createObserverPluginConfiguration(t=null){return c({observer:t,defaultCaptureMode:t?"grabbable-object":"capture-always",inputMapPosition:t?.position??null})}_createTargetPluginConfiguration(t=null){return p({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultCaptureMode:t?"grabbable-object":"capture-always",defaultElevationInfo:this.defaultElevationInfo,inputMapPosition:t?.position??null,sourceElevationInfo:this.sourceElevationInfo,target:t,view:this.view})}_syncAnalysisFromSession(){const t=this._getCommittedPointCount();this.analysis.observer=this._getActiveObserver(t),this.authoringStore.syncTargetsToAnalysis(this.analysis,this._initialTargetCount+this._getCommittedOperationTargetCount(t))}_getActiveObserver(t){return this._hadInitialObserver||t>0?this.authoringStore.observerItem?.observer??null:null}_getCommittedOperationTargetCount(t){return Math.max(0,t-(this._hadInitialObserver?0:Math.min(t,1)))}_getCommittedPointCount(){const t=this._session?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"multipoint"});return t&&a(t)?t.points.length:0}};function _(t){return{uniqueId:Symbol("line-of-sight-root-plugin"),kind:["multipart"],geometryType:"multipoint",hidden:!0,localizationKey:"line-of-sight-root",icon:"point",create:()=>new d(t)}}t([n({constructOnly:!0})],d.prototype,"analysis",void 0),t([n({constructOnly:!0})],d.prototype,"analysisViewData",void 0),t([n({constructOnly:!0})],d.prototype,"view",void 0),t([n({constructOnly:!0})],d.prototype,"authoringStore",void 0),t([n({constructOnly:!0})],d.prototype,"defaultElevationInfo",void 0),t([n({constructOnly:!0})],d.prototype,"sourceElevationInfo",void 0),t([n()],d.prototype,"_hadInitialObserver",void 0),t([n()],d.prototype,"_initialTargetCount",void 0),t([n()],d.prototype,"_intersector",void 0),t([n()],d.prototype,"_downstreamPlugin",void 0),d=t([o("esri.views.3d.analysis.LineOfSight.LineOfSightRootPlugin")],d);export{d as LineOfSightRootPlugin,_ as createLineOfSightRootPluginConfiguration};
2
+ import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisObserver.js";import i from"../../../../analysis/LineOfSightAnalysisTarget.js";import s from"../../../../core/Collection.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{isPoint as a,isMultipoint as l}from"../../../../geometry/support/typeUtils.js";import{updateLineOfSightItemFromAuthoredPoint as u}from"./LineOfSightAuthoringUtils.js";import{isLineOfSightObserverPlugin as h,createLineOfSightObserverPluginConfiguration as c}from"./LineOfSightObserverPlugin.js";import{isLineOfSightPlacementLeafPlugin as g}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as p}from"./LineOfSightRayIntersector.js";import{isLineOfSightTargetPlugin as m,createLineOfSightTargetPluginConfiguration as _}from"./LineOfSightTargetPlugin.js";import{PluginBase as f}from"../../../draw/plugins/PluginBase.js";let d=class extends f{constructor(){super(...arguments),this.defaultElevationInfo=null,this.sourceElevationInfo=null,this._intersector=null,this._downstreamPlugin=null,this._initialObserver=null,this._operationObserver=null,this._initialTargets=new s,this._operationTargets=new s}initialize(){this._intersector=new p({view:this.view})}destroy(){this._intersector=n(this._intersector)}start(t){super.start(t),this._initialObserver=this.analysis.observer,this._operationObserver=this._initialObserver,y(this._initialTargets,this.analysis.targets.toArray()),this._operationTargets.removeAll(),t.session.appendOrReplacePart(null,[]),this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}beforeAttachPlugin(t){return{geometryType:"point",useStandaloneSession:!0}}beforeComplete(){return{downstreamPluginCompletionMode:"cancel"}}attachPlugin(t){this._downstreamPlugin=t}afterUndoRedo(){this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}detachPlugin(t,s){if(this._downstreamPlugin===t&&(this._downstreamPlugin=null),m(t)&&this._clearCursorTarget(),"complete"!==s)return void this._syncAnalysisFromSession();const n=this._context?.getSession(t)?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"point"});if(!n||!a(n))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._truncateItemsToSession();const r=g(t)?t.preservedIntersection:null,o=!!g(t)&&t.usesSnappedAbsoluteHeight;if(h(t)){const i=t.observer??this._operationObserver??new e;if(!this._intersector||!u(this.view,i,this._intersector,n,{defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,preservedIntersection:r,useSnappedAbsoluteHeight:o,preferPreservedIntersection:!0}))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._operationObserver=i}else if(m(t)){const e=t.target??new i;if(!this._intersector||!u(this.view,e,this._intersector,n,{defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,preservedIntersection:r,useSnappedAbsoluteHeight:o,preferPreservedIntersection:!0}))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._operationTargets.add(e)}this._appendCommittedPoint(n),this._syncAnalysisFromSession(),this._restartDownstreamPlugin(),this._clearCursorTarget()}_appendCommittedPoint(t){const e=this._session;e&&(e.appendOrReplacePoint(null,t),e.appendOrReplacePart(null,[]),e.automaticRestart=!1,e.groupGeometryChanges())}_clearCursorTarget(){this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget)}_truncateItemsToSession(){const t=this._getCommittedPointCount();null==this._initialObserver&&0===t&&(this._operationObserver=null),this._operationTargets.splice(this._getCommittedOperationTargetCount(t))}_restartDownstreamPlugin(){const t=null==this.analysis.observer,e=t?this._createObserverPluginConfiguration():this._createTargetPluginConfiguration();t&&h(this._downstreamPlugin)||!t&&m(this._downstreamPlugin)||this._context?.requestBeginDownstreamPlugin(e,{cancelExisting:!0})}_createObserverPluginConfiguration(t=null){return c({observer:t,defaultCaptureMode:t?"grabbable-object":"capture-always",inputMapPosition:t?.position??null})}_createTargetPluginConfiguration(t=null){return _({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultCaptureMode:t?"grabbable-object":"capture-always",defaultElevationInfo:this.defaultElevationInfo,inputMapPosition:t?.position??null,sourceElevationInfo:this.sourceElevationInfo,target:t,view:this.view})}_syncAnalysisFromSession(){const t=this._getCommittedPointCount(),e=this._getCommittedOperationTargetCount(t);this.analysis.observer=this._getActiveObserver(t),y(this.analysis.targets,this._initialTargets.toArray().concat(this._operationTargets.toArray().slice(0,e)))}_getActiveObserver(t){return null!=this._initialObserver?this._operationObserver??null:t>0?this._operationObserver:null}_getCommittedOperationTargetCount(t){return Math.max(0,t-(null!=this._initialObserver?0:Math.min(t,1)))}_getCommittedPointCount(){const t=this._session?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"multipoint"});return t&&l(t)?t.points.length:0}};function v(t){return{uniqueId:Symbol("line-of-sight-root-plugin"),kind:["multipart"],geometryType:"multipoint",hidden:!0,localizationKey:"line-of-sight-root",icon:"point",create:()=>new d(t)}}function y(t,e){let i=-1;for(let s=0;s<Math.min(t.length,e.length);s++)if(t.getItemAt(s)!==e[s]){i=s;break}if(-1===i){if(t.length===e.length)return;i=Math.min(t.length,e.length)}t.splice(i,t.length-i,...e.slice(i))}t([r({constructOnly:!0})],d.prototype,"analysis",void 0),t([r({constructOnly:!0})],d.prototype,"analysisViewData",void 0),t([r({constructOnly:!0})],d.prototype,"view",void 0),t([r({constructOnly:!0})],d.prototype,"defaultElevationInfo",void 0),t([r({constructOnly:!0})],d.prototype,"sourceElevationInfo",void 0),t([r()],d.prototype,"_intersector",void 0),t([r()],d.prototype,"_downstreamPlugin",void 0),d=t([o("esri.views.3d.analysis.LineOfSight.LineOfSightRootPlugin")],d);export{d as LineOfSightRootPlugin,v as createLineOfSightRootPluginConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as o,sync as r}from"../../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{getLineOfSightMapPointIntersection as n,updateLineOfSightItemFromIntersection as l}from"./LineOfSightAuthoringUtils.js";import{LineOfSightRayIntersector as p}from"./LineOfSightRayIntersector.js";import{PluginBase as c}from"../../../draw/plugins/PluginBase.js";var u;const h=Symbol("line-of-sight-target-vertex"),d=Symbol("line-of-sight-target-plugin-marker");let f=class extends c{constructor(){super(...arguments),this[u]=!0,this.target=null,this.defaultElevationInfo=null,this.defaultCaptureMode="capture-always",this.inputMapPosition=null,this.sourceElevationInfo=null,this._interactiveHandle=null,this._intersector=null}static{u=d}initialize(){this._intersector=new p({view:this.view})}destroy(){this._intersector=i(this._intersector)}start(t){super.start(t);const{positionOfLastUserInput:s,session:a}=t,p="grabbable-object"===this.defaultCaptureMode?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??s:this.inputMapPosition??s;!p||"grabbable-object"!==this.defaultCaptureMode&&this._interactiveHandle||a.appendOrReplacePoint(h,p),this._interactiveHandle&&this._clearCursorTarget(),this._interactiveHandle||(this._interactiveHandle=t.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:"grabbable-object"===this.defaultCaptureMode?p??void 0:void 0}),this.addHandles(o(()=>this._interactiveHandle?.outputMapPosition,t=>{if(!t||this._isComplete)return;const o=this.analysisViewData.cursorTarget??new e,r=this._intersector&&n(this._intersector,this.view,t,this.sourceElevationInfo);this._session?.appendOrReplacePoint(h,t),r?(this.analysisViewData.cursorTarget=o,l(this.view,o,r,t,this.defaultElevationInfo,this.sourceElevationInfo)):this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget)},r),this._ownHandlesKey))}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}_clearCursorTarget(){this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget)}};function v(t){return!!t&&d in t}function y(t){return{uniqueId:Symbol("line-of-sight-target-plugin"),kind:["vertex"],geometryType:"point",hidden:!0,localizationKey:"leaf-point-segment",icon:"point",create:()=>new f(t)}}t([s({constructOnly:!0})],f.prototype,"analysis",void 0),t([s({constructOnly:!0})],f.prototype,"analysisViewData",void 0),t([s({constructOnly:!0})],f.prototype,"view",void 0),t([s({constructOnly:!0})],f.prototype,"target",void 0),t([s({constructOnly:!0})],f.prototype,"defaultElevationInfo",void 0),t([s()],f.prototype,"defaultCaptureMode",void 0),t([s()],f.prototype,"inputMapPosition",void 0),t([s({constructOnly:!0})],f.prototype,"sourceElevationInfo",void 0),t([s()],f.prototype,"_interactiveHandle",void 0),t([s()],f.prototype,"_intersector",void 0),f=t([a("esri.views.3d.analysis.LineOfSight.LineOfSightTargetPlugin")],f);export{f as LineOfSightTargetPlugin,y as createLineOfSightTargetPluginConfiguration,v as isLineOfSightTargetPlugin,d as lineOfSightTargetPluginMarker};
2
+ import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as s,sync as o}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{updateLineOfSightItemFromIntersection as a,updateLineOfSightItemFromAuthoredPoint as l}from"./LineOfSightAuthoringUtils.js";import{LineOfSightRayIntersector as u}from"./LineOfSightRayIntersector.js";import{PluginBase as p}from"../../../draw/plugins/PluginBase.js";var c;const d=Symbol("line-of-sight-target-vertex"),h=Symbol("line-of-sight-target-plugin-marker");let v=class extends p{constructor(){super(...arguments),this[c]=!0,this.target=null,this.defaultElevationInfo=null,this.defaultCaptureMode="capture-always",this.inputMapPosition=null,this.preservedIntersection=null,this.sourceElevationInfo=null,this._interactiveHandle=null,this._intersector=null}static{c=h}initialize(){this._intersector=new u({view:this.view})}destroy(){this._intersector=i(this._intersector)}get usesSnappedAbsoluteHeight(){const t=this._interactiveHandle,e=t?.inputMapPosition,i=t?.outputMapPosition;return null!=e&&null!=i&&!e.equals(i)}start(t){super.start(t),this.preservedIntersection=null;const{positionOfLastUserInput:n,session:r}=t,u="grabbable-object"===this.defaultCaptureMode?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??n:this.inputMapPosition??n;!u||"grabbable-object"!==this.defaultCaptureMode&&this._interactiveHandle||r.appendOrReplacePoint(d,u);let p="capture-always"===this.defaultCaptureMode&&null!=u;this._interactiveHandle&&this._clearCursorTarget(),this._interactiveHandle||(this._interactiveHandle=t.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:"grabbable-object"===this.defaultCaptureMode?u??void 0:void 0}),this.addHandles(s(()=>this._interactiveHandle?.outputMapPosition,t=>{if(!t||this._isComplete)return;const s=this.analysisViewData.cursorTarget??new e,o=this.usesSnappedAbsoluteHeight,n=this._interactiveHandle?.screenPosition,r=n&&this._intersector?this._intersector.getScreenPointIntersection(n):null;return this._session?.appendOrReplacePoint(d,t),p?(p=!1,void this._clearCursorTarget()):null!=r?(this.analysisViewData.cursorTarget=s,void a(this.view,s,r,{snappedMapPoint:t,defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,useSnappedAbsoluteHeight:o})):null!=n&&null!=this.preservedIntersection?(this.analysisViewData.cursorTarget=s,void a(this.view,s,this.preservedIntersection,{snappedMapPoint:t,defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,useSnappedAbsoluteHeight:o})):void(null==n&&this._intersector&&l(this.view,s,this._intersector,t,{defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,preservedIntersection:this.preservedIntersection,useSnappedAbsoluteHeight:o,preferPreservedIntersection:!0})?this.analysisViewData.cursorTarget=s:this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget))},o),this._ownHandlesKey))}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}_clearCursorTarget(){this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget)}};function f(t){return!!t&&h in t}function g(t){return{uniqueId:Symbol("line-of-sight-target-plugin"),kind:["vertex"],geometryType:"point",hidden:!0,localizationKey:"leaf-point-segment",icon:"point",create:()=>new v(t)}}t([n({constructOnly:!0})],v.prototype,"analysis",void 0),t([n({constructOnly:!0})],v.prototype,"analysisViewData",void 0),t([n({constructOnly:!0})],v.prototype,"view",void 0),t([n({constructOnly:!0})],v.prototype,"target",void 0),t([n({constructOnly:!0})],v.prototype,"defaultElevationInfo",void 0),t([n()],v.prototype,"defaultCaptureMode",void 0),t([n()],v.prototype,"inputMapPosition",void 0),t([n()],v.prototype,"preservedIntersection",void 0),t([n({constructOnly:!0})],v.prototype,"sourceElevationInfo",void 0),t([n()],v.prototype,"_interactiveHandle",void 0),t([n()],v.prototype,"_intersector",void 0),v=t([r("esri.views.3d.analysis.LineOfSight.LineOfSightTargetPlugin")],v);export{v as LineOfSightTargetPlugin,g as createLineOfSightTargetPluginConfiguration,f as isLineOfSightTargetPlugin,h as lineOfSightTargetPluginMarker};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisObserver.js";import n from"../../../../analysis/LineOfSightAnalysisTarget.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import a from"../../../../core/Logger.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{memoize as s}from"../../../../core/memoize.js";import{ignoreAbortErrors as o}from"../../../../core/promiseUtils.js";import{when as l,syncAndInitial as p,initial as u}from"../../../../core/reactiveUtils.js";import{property as c,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{create as g,fromPoints as _}from"../../../../geometry/support/lineSegment.js";import{hydrateGeometry as m,clonePoint as v}from"../../../../layers/graphics/hydratedFeatures.js";import{absoluteHeightElevationInfo as b,getGraphicEffectiveElevationInfo as y,getConvertedElevation as f}from"../../../../support/elevationInfoUtils.js";import M from"../../../../symbols/support/ElevationInfo.js";import{getGaussianSplatOffsetPosition as T}from"./LineOfSightAuthoringUtils.js";import{getLaserLineColors as P,laserLineConfiguration as w}from"./LineOfSightConfiguration.js";import{LineOfSightTargetManipulator as S,LineOfSightObserverManipulator as L}from"./LineOfSightManipulators.js";import{LineOfSightRayIntersector as k}from"./LineOfSightRayIntersector.js";import{SnappingVisualizer3D as C}from"../../interactive/SnappingVisualizer3D.js";import{LaserlineVisualElement as O}from"../../interactive/visualElements/LaserlineVisualElement.js";import{mouseButtons as I}from"../../../input/mouseButtons.js";import{AnalysisToolBase as H}from"../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as j}from"../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as R}from"../../../interactive/dragEventPipeline.js";import{EditGeometry as E}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as V}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as D}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as x}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as G}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as A}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as F}from"../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as U}from"../../../support/screenUtils.js";let z=class extends H{constructor(e){super(e),this._creationMode=!1,this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._trackerIntersection=null,this._trackerMapPoint=null,this._snappingManagerResult=null,this._analysisHandles=new i,this._updatingHandles=new d,this._manipulatorHandles=new i,this._targetTrackerManipulator=null,this._getSnappingContext=s(e=>new D({elevationInfo:b,pointer:e,editGeometryOperations:new V(new E("point",j(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new C}))}initialize(){this._intersector=new k({view:this.view}),this._snappingOperation=new A({view:this.view}),F(this,()=>{const e=this.view.inputManager.latestPointerInfo?.type??"mouse",t=this._getSnappingContext(e);this._updatingHandles.consumePromise(o(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}),this.addHandles(l(()=>"created"===this.state,()=>this.finishToolCreation(),p)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData?.elevationAlignedObserver,e=>this._onObserverLocationChange(e),u),this._updatingHandles.add(()=>P(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:n})=>this._updateLaserLineStyle(e,t,n),u),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),u),this._updatingHandles.add(()=>({active:this.active,hasGrabbedManipulators:this.hasGrabbedManipulators}),({active:e,hasGrabbedManipulators:t})=>{this._creationMode=!!e&&(this._creationMode||!t)},u),this._updatingHandles.add(()=>({observerPosition:this.analysis.observer?.position,showTracker:this._showTracker,hasGrabbedManipulators:this.hasGrabbedManipulators,stagedPoint:this._snappingOperation.stagedPoint,trackerIntersection:this._trackerIntersection}),({observerPosition:e,showTracker:t,hasGrabbedManipulators:i,stagedPoint:a,trackerIntersection:r})=>{if(null==e||!t||i||null==r?.mapPoint)return;this.analysisViewData.cursorTarget??=new n;const s=null!=a?m(a):r.mapPoint,o=this._resolveIntersection(r,s);this._updateFromIntersection(this.analysisViewData.cursorTarget,o,s),this._updateLaserLineRenderer()},u)])}destroy(){this._updatingHandles=r(this._updatingHandles),this._manipulatorHandles=r(this._manipulatorHandles),this._analysisHandles=r(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._snappingOperation=r(this._snappingOperation),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?!this.hasGrabbedManipulators||this._creationMode?"creating":"created":null!=this.analysis.observer?.position?"created":"ready"}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return!!this.analysisViewData?.updating||!!this._snappingManager?.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&null!=this.analysis.observer?.position&&!this.hasGrabbedManipulators}get _snappingManager(){return this._snappingManagerResult?.snappingManager}get snappingOptions(){return this._snappingManager?.options}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:t}){for(const n of t)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_connectComputation(e){if(this.destroyed)return void a.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const n=this._createTargetManipulator(e.target);null==this._targetTrackerManipulator&&n.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=n,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([this._updatingHandles.add(()=>q(e),()=>B(n,e),u),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,e=>this._onTargetLocationChange(e,n),u)],e)}_disconnectComputation(e){if(this.destroyed)return void a.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);null!=t&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),null!=this._targetTrackerManipulator&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this._trackerIntersection=null,this._trackerMapPoint=null,this._resetSnappingState(),this.analysisViewData.cursorTarget=r(this.analysisViewData.cursorTarget)}_ensureSnappingManager(){if(null==this._snappingManagerResult){const e=G(this.view);this._snappingManagerResult=e,this.addHandles(e)}return this._snappingManagerResult.snappingManager}_createTargetManipulator(e){const t={target:e,type:"target"},n=new S(this.view,t);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(n),n.events.on("grab-changed",e=>this._manipulatorGrabChanged(n,e)),n.events.on("immediate-click",e=>this._manipulatorClick(n,e))],n),this.manipulators.add(n),null!=e.position?n.elevationAlignedLocation=e.position:n.available=!1,n}_getTargetManipulator(e){let t=null;return this.manipulators.forEach(n=>{const i=n.manipulator;null==t&&"target"===i.metadata.type&&i.metadata.target===e&&(t=i)}),t}_createObserverManipulator(){const e=new L(this.view,{type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",t=>this._manipulatorGrabChanged(e,t)),e.events.on("immediate-click",t=>this._manipulatorClick(e,t))],e),this.manipulators.add(e),e}_createTargetManipulatorDragPipeline(e){return R(e,(t,n,i,a)=>{const r=this._ensureSnappingManager(),{snappingStep:s,cancelSnapping:o}=x({snappingManager:r,snappingContext:this._getSnappingContext(a),updatingHandles:this._updatingHandles});n.next(this._screenToSnappingDragEvent()).next(...s).next(this._updateIntersectionFromSnappedPoint()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),i.next(W(e.metadata.target)).next(o).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return R(e,(e,t,n,i)=>{const a=this._ensureSnappingManager(),{snappingStep:r,cancelSnapping:s}=x({snappingManager:a,snappingContext:this._getSnappingContext(i),updatingHandles:this._updatingHandles});t.next(this._screenToSnappingDragEvent()).next(...r).next(this._updateIntersectionFromSnappedPoint()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),n.next(this._cancelObserverDragStep()).next(s).next(()=>this._updateLaserLineRenderer())})}_screenToSnappingDragEvent(){let e=null;return t=>{"start"===t.action&&(e=this._intersector.getScreenPointIntersection(t.screenStart));const n=this._intersector.getScreenPointIntersection(t.screenEnd);return null==e?.mapPoint||null==n?.mapPoint?null:{...t,intersection:n,mapStart:v(e.mapPoint),mapEnd:v(n.mapPoint)}}}_updateIntersectionFromSnappedPoint(){return e=>(e.intersection=this._resolveIntersection(e.intersection,e.mapEnd),e)}_updateObserverDragStep(){return e=>(this.analysis.observer??=new t,this._updateFromIntersection(this.analysis.observer,e.intersection,e.mapEnd),e)}_cancelObserverDragStep(){const e=null!=this.analysis.observer?.position?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>(this._updateFromIntersection(e.metadata.target,t.intersection,t.mapEnd),e.elevationAlignedLocation=t.mapEnd,t)}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:t,grabbedManipulator:n,shouldRenderTracker:i,observerPosition:a,visible:r}=e;if(null==t)return;const s=null!=n?n:i&&null!=a?this._targetTrackerManipulator:null;null!=s&&r?(t.visible=!0,t.heightManifoldTarget=s.renderLocation,s!==this._observerManipulator?t.lineVerticalPlaneSegment=_(this._observerManipulator.renderLocation,s.renderLocation,N):t.lineVerticalPlaneSegment=null):(t.visible=!1,t.heightManifoldTarget=null,t.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:t}=w;this._laserlineVisualElement=new O({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_removeLaserLine(){null!=this._laserlineVisualElement&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,t,n){const i=this._laserlineVisualElement;if(null==i)return;const a=i.style;i.style={...a,glowColor:e.toUnitRGB(),innerColor:t.toUnitRGB(),globalAlpha:n}}_onObserverLocationChange(e){null!=e?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,t){null!=e?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e,i){const a=this._getPlacementLocation(e,i);if(null==a)return;const{intersection:r,point:s}=a;if(null!=this.analysis.observer?.position){this._clearCursorTracker();const e=new n;this._updateFromIntersection(e,r,s),this.analysis.targets.add(e)}else{const e=new t;this._updateFromIntersection(e,r,s),this.analysis.observer=e}}_clickHandler(e){this.active&&e.button!==I.Right&&(this._addPointFromClickEvent(U(e),e.pointerType),e.stopPropagation())}_doubleClickHandler(e){this.active&&e.button!==I.Right&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this.hasGrabbedManipulators)return;if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker)return void this._clearCursorTracker();const t=U(e),n=this._intersector.getScreenPointIntersection(t),i=n?.mapPoint;null!=n?.mapPoint&&null!=i?(this._trackerIntersection=n,this._trackerMapPoint=i,this._updateHoverSnapping(i,e.pointerType)):this._clearCursorTracker()}_getPlacementLocation(e,t){const n=this._intersector.getScreenPointIntersection(e);if(null==n?.mapPoint)return null;const i=n.mapPoint;if(!this._shouldUsePlacementSnapping(t))return{intersection:n,point:i};const a=n.mapPoint,r=this._trackerMapPoint?.equals(a)?this._snappingOperation.stagedPoint:null,s=m(r??this._snappingOperation.update({point:a},this._ensureSnappingManager(),this._getSnappingContext(t)));return{intersection:this._resolveIntersection(n,s),point:s}}_shouldUsePlacementSnapping(e){return"touch"!==e}_updateHoverSnapping(e,t){const n=this._getSnappingContext(t);this._updatingHandles.consumePromise(o(this._snappingOperation.snap({point:e},this._ensureSnappingManager(),n)))}_updateFromIntersection(e,t,n=t.mapPoint){if(null==n)return e.position=null,e.elevationInfo=null,void(e.feature=null);const i=!t.mapPoint?.equals(n);switch(t.context?.type){case"graphic":{const n=t.context.graphic,i=y(n);"on-the-ground"===i.mode&&(i.mode="relative-to-ground",i.offset=0),e.elevationInfo=new M(i),e.feature=n}break;case"gaussian-splat":return e.elevationInfo=null,e.feature=null,void(e.position=T(this.view,n,e.elevationInfo,t.normal));case"ground":e.elevationInfo=new M({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}i&&(e.elevationInfo=null);const a=n.clone();a.z=f(this.view,a,b,e.elevationInfo),e.position=a}_manipulatorClick(e,t){if("observer"===e.metadata.type||e.grabbing||e.dragging||t.button!==I.Right||this.analysis.targets.length<=1)return;const{target:n}=e.metadata;this.analysis.targets.remove(n),t.stopPropagation()}get testInfo(){}_resetSnappingState(){this._snappingManager?.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_resolveIntersection(e,t){return e.mapPoint?.equals(t)?e:this._intersector.getMapPointIntersection(t)??e}};function W(e){const t=e.position?.clone();return n=>(e.position=t,n)}function B(e,t){const{isValid:n,isTargetVisible:i}=t.computationResult;e.state=n?i?16:32:64}function q(e){const{isValid:t,isTargetVisible:n}=e.computationResult;return{isValid:t,isTargetVisible:n}}e([c({constructOnly:!0})],z.prototype,"view",void 0),e([c({constructOnly:!0})],z.prototype,"analysis",void 0),e([c()],z.prototype,"_creationMode",void 0),e([c({readOnly:!0})],z.prototype,"state",null),e([c({readOnly:!0})],z.prototype,"cursor",null),e([c()],z.prototype,"removeIncompleteOnCancel",void 0),e([c({readOnly:!0})],z.prototype,"updating",null),e([c({constructOnly:!0})],z.prototype,"analysisViewData",void 0),e([c({readOnly:!0})],z.prototype,"_showTracker",null),e([c()],z.prototype,"_latestPointerMovePointerType",void 0),e([c()],z.prototype,"_shouldRenderTracker",null),e([c()],z.prototype,"_laserlineVisualElement",void 0),e([c()],z.prototype,"_grabbedManipulator",void 0),e([c()],z.prototype,"_trackerIntersection",void 0),e([c()],z.prototype,"_trackerMapPoint",void 0),e([c()],z.prototype,"_snappingManagerResult",void 0),z=e([h("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],z);const N=g();export{z as LineOfSightTool};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisObserver.js";import n from"../../../../analysis/LineOfSightAnalysisTarget.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import a from"../../../../core/Logger.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{memoize as s}from"../../../../core/memoize.js";import{ignoreAbortErrors as o}from"../../../../core/promiseUtils.js";import{when as l,syncAndInitial as p,initial as u}from"../../../../core/reactiveUtils.js";import{property as c,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{create as g,fromPoints as _}from"../../../../geometry/support/lineSegment.js";import{hydrateGeometry as m,clonePoint as v}from"../../../../layers/graphics/hydratedFeatures.js";import{absoluteHeightElevationInfo as b,getGraphicEffectiveElevationInfo as y,getConvertedElevation as f}from"../../../../support/elevationInfoUtils.js";import M from"../../../../symbols/support/ElevationInfo.js";import{getGaussianSplatOffsetPosition as T}from"./LineOfSightAuthoringUtils.js";import{getLaserLineColors as P,laserLineConfiguration as w}from"./LineOfSightConfiguration.js";import{LineOfSightTargetManipulator as S,LineOfSightObserverManipulator as L,LineOfSightTargetManipulatorState as k}from"./LineOfSightManipulators.js";import{LineOfSightRayIntersector as C}from"./LineOfSightRayIntersector.js";import{SnappingVisualizer3D as O}from"../../interactive/SnappingVisualizer3D.js";import{LaserlineVisualElement as I}from"../../interactive/visualElements/LaserlineVisualElement.js";import{mouseButtons as H}from"../../../input/mouseButtons.js";import{AnalysisToolBase as j}from"../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as R}from"../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as E}from"../../../interactive/dragEventPipeline.js";import{EditGeometry as V}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as D}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as x}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as G}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as A}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as F}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as U}from"../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as z}from"../../../support/screenUtils.js";let W=class extends j{constructor(e){super(e),this._creationMode=!1,this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._trackerIntersection=null,this._trackerMapPoint=null,this._snappingManagerResult=null,this._analysisHandles=new i,this._updatingHandles=new d,this._manipulatorHandles=new i,this._targetTrackerManipulator=null,this._getSnappingContext=s(e=>new x({elevationInfo:b,pointer:e,editGeometryOperations:new D(new V("point",R(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new O}))}initialize(){this._intersector=new C({view:this.view}),this._snappingOperation=new F({view:this.view}),U(this,()=>{const e=this.view.inputManager.latestPointerInfo?.type??"mouse",t=this._getSnappingContext(e);this._updatingHandles.consumePromise(o(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}),this.addHandles(l(()=>"created"===this.state,()=>this.finishToolCreation(),p)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData?.elevationAlignedObserver,e=>this._onObserverLocationChange(e),u),this._updatingHandles.add(()=>P(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:n})=>this._updateLaserLineStyle(e,t,n),u),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),u),this._updatingHandles.add(()=>({active:this.active,hasGrabbedManipulators:this.hasGrabbedManipulators}),({active:e,hasGrabbedManipulators:t})=>{this._creationMode=!!e&&(this._creationMode||!t)},u),this._updatingHandles.add(()=>({observerPosition:this.analysis.observer?.position,showTracker:this._showTracker,hasGrabbedManipulators:this.hasGrabbedManipulators,stagedPoint:this._snappingOperation.stagedPoint,trackerIntersection:this._trackerIntersection}),({observerPosition:e,showTracker:t,hasGrabbedManipulators:i,stagedPoint:a,trackerIntersection:r})=>{if(null==e||!t||i||null==r?.mapPoint)return;this.analysisViewData.cursorTarget??=new n;const s=null!=a?m(a):r.mapPoint,o=this._resolveIntersection(r,s);this._updateFromIntersection(this.analysisViewData.cursorTarget,o,s),this._updateLaserLineRenderer()},u)])}destroy(){this._updatingHandles=r(this._updatingHandles),this._manipulatorHandles=r(this._manipulatorHandles),this._analysisHandles=r(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._snappingOperation=r(this._snappingOperation),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?!this.hasGrabbedManipulators||this._creationMode?"creating":"created":null!=this.analysis.observer?.position?"created":"ready"}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return!!this.analysisViewData?.updating||!!this._snappingManager?.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&null!=this.analysis.observer?.position&&!this.hasGrabbedManipulators}get _snappingManager(){return this._snappingManagerResult?.snappingManager}get snappingOptions(){return this._snappingManager?.options}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:t}){for(const n of t)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_connectComputation(e){if(this.destroyed)return void a.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const n=this._createTargetManipulator(e.target);null==this._targetTrackerManipulator&&n.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=n,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([this._updatingHandles.add(()=>N(e),()=>q(n,e),u),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,e=>this._onTargetLocationChange(e,n),u)],e)}_disconnectComputation(e){if(this.destroyed)return void a.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);null!=t&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),null!=this._targetTrackerManipulator&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this._trackerIntersection=null,this._trackerMapPoint=null,this._resetSnappingState(),this.analysisViewData.cursorTarget=r(this.analysisViewData.cursorTarget)}_ensureSnappingManager(){if(null==this._snappingManagerResult){const e=A(this.view);this._snappingManagerResult=e,this.addHandles(e)}return this._snappingManagerResult.snappingManager}_createTargetManipulator(e){const t={deleting:!1,target:e,type:"target"},n=new S(this.view,t);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(n),n.events.on("grab-changed",e=>this._manipulatorGrabChanged(n,e)),n.events.on("immediate-click",e=>this._manipulatorClick(n,e))],n),this.manipulators.add(n),null!=e.position?n.elevationAlignedLocation=e.position:n.available=!1,n}_getTargetManipulator(e){let t=null;return this.manipulators.forEach(n=>{const i=n.manipulator;null==t&&"target"===i.metadata.type&&i.metadata.target===e&&(t=i)}),t}_createObserverManipulator(){const e=new L(this.view,{deleting:!1,type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",t=>this._manipulatorGrabChanged(e,t)),e.events.on("immediate-click",t=>this._manipulatorClick(e,t))],e),this.manipulators.add(e),e}_createTargetManipulatorDragPipeline(e){return E(e,(t,n,i,a)=>{const r=this._ensureSnappingManager(),{snappingStep:s,cancelSnapping:o}=G({snappingManager:r,snappingContext:this._getSnappingContext(a),updatingHandles:this._updatingHandles});n.next(this._screenToSnappingDragEvent()).next(...s).next(this._updateIntersectionFromSnappedPoint()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),i.next(B(e.metadata.target)).next(o).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return E(e,(e,t,n,i)=>{const a=this._ensureSnappingManager(),{snappingStep:r,cancelSnapping:s}=G({snappingManager:a,snappingContext:this._getSnappingContext(i),updatingHandles:this._updatingHandles});t.next(this._screenToSnappingDragEvent()).next(...r).next(this._updateIntersectionFromSnappedPoint()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),n.next(this._cancelObserverDragStep()).next(s).next(()=>this._updateLaserLineRenderer())})}_screenToSnappingDragEvent(){let e=null;return t=>{"start"===t.action&&(e=this._intersector.getScreenPointIntersection(t.screenStart));const n=this._intersector.getScreenPointIntersection(t.screenEnd);return null==e?.mapPoint||null==n?.mapPoint?null:{...t,intersection:n,mapStart:v(e.mapPoint),mapEnd:v(n.mapPoint)}}}_updateIntersectionFromSnappedPoint(){return e=>(e.intersection=this._resolveIntersection(e.intersection,e.mapEnd),e)}_updateObserverDragStep(){return e=>(this.analysis.observer??=new t,this._updateFromIntersection(this.analysis.observer,e.intersection,e.mapEnd),e)}_cancelObserverDragStep(){const e=null!=this.analysis.observer?.position?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>(this._updateFromIntersection(e.metadata.target,t.intersection,t.mapEnd),e.elevationAlignedLocation=t.mapEnd,t)}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:t,grabbedManipulator:n,shouldRenderTracker:i,observerPosition:a,visible:r}=e;if(null==t)return;const s=null!=n?n:i&&null!=a?this._targetTrackerManipulator:null;null!=s&&r?(t.visible=!0,t.heightManifoldTarget=s.renderLocation,s!==this._observerManipulator?t.lineVerticalPlaneSegment=_(this._observerManipulator.renderLocation,s.renderLocation,J):t.lineVerticalPlaneSegment=null):(t.visible=!1,t.heightManifoldTarget=null,t.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:t}=w;this._laserlineVisualElement=new I({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_removeLaserLine(){null!=this._laserlineVisualElement&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,t,n){const i=this._laserlineVisualElement;if(null==i)return;const a=i.style;i.style={...a,glowColor:e.toUnitRGB(),innerColor:t.toUnitRGB(),globalAlpha:n}}_onObserverLocationChange(e){null!=e?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,t){null!=e?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e,i){const a=this._getPlacementLocation(e,i);if(null==a)return;const{intersection:r,point:s}=a;if(null!=this.analysis.observer?.position){this._clearCursorTracker();const e=new n;this._updateFromIntersection(e,r,s),this.analysis.targets.add(e)}else{const e=new t;this._updateFromIntersection(e,r,s),this.analysis.observer=e}}_clickHandler(e){this.active&&e.button!==H.Right&&(this._addPointFromClickEvent(z(e),e.pointerType),e.stopPropagation())}_doubleClickHandler(e){this.active&&e.button!==H.Right&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this.hasGrabbedManipulators)return;if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker)return void this._clearCursorTracker();const t=z(e),n=this._intersector.getScreenPointIntersection(t),i=n?.mapPoint;null!=n?.mapPoint&&null!=i?(this._trackerIntersection=n,this._trackerMapPoint=i,this._updateHoverSnapping(i,e.pointerType)):this._clearCursorTracker()}_getPlacementLocation(e,t){const n=this._intersector.getScreenPointIntersection(e);if(null==n?.mapPoint)return null;const i=n.mapPoint;if(!this._shouldUsePlacementSnapping(t))return{intersection:n,point:i};const a=n.mapPoint,r=this._trackerMapPoint?.equals(a)?this._snappingOperation.stagedPoint:null,s=m(r??this._snappingOperation.update({point:a},this._ensureSnappingManager(),this._getSnappingContext(t)));return{intersection:this._resolveIntersection(n,s),point:s}}_shouldUsePlacementSnapping(e){return"touch"!==e}_updateHoverSnapping(e,t){const n=this._getSnappingContext(t);this._updatingHandles.consumePromise(o(this._snappingOperation.snap({point:e},this._ensureSnappingManager(),n)))}_updateFromIntersection(e,t,n=t.mapPoint){if(null==n)return e.position=null,e.elevationInfo=null,void(e.feature=null);const i=!t.mapPoint?.equals(n);switch(t.context?.type){case"graphic":{const n=t.context.graphic,i=y(n);"on-the-ground"===i.mode&&(i.mode="relative-to-ground",i.offset=0),e.elevationInfo=new M(i),e.feature=n}break;case"gaussian-splat":return e.elevationInfo=null,e.feature=null,void(e.position=T(this.view,n,e.elevationInfo,t.normal));case"ground":e.elevationInfo=new M({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}i&&(e.elevationInfo=null);const a=n.clone();a.z=f(this.view,a,b,e.elevationInfo),e.position=a}_manipulatorClick(e,t){if("observer"===e.metadata.type||e.grabbing||e.dragging||t.button!==H.Right||this.analysis.targets.length<=1)return;const{target:n}=e.metadata;this.analysis.targets.remove(n),t.stopPropagation()}get testInfo(){}_resetSnappingState(){this._snappingManager?.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_resolveIntersection(e,t){return e.mapPoint?.equals(t)?e:this._intersector.getMapPointIntersection(t)??e}};function B(e){const t=e.position?.clone();return n=>(e.position=t,n)}function q(e,t){const{isValid:n,isTargetVisible:i}=t.computationResult;e.state=n?i?k.visible:k.occluded:k.undefined}function N(e){const{isValid:t,isTargetVisible:n}=e.computationResult;return{isValid:t,isTargetVisible:n}}e([c({constructOnly:!0})],W.prototype,"view",void 0),e([c({constructOnly:!0})],W.prototype,"analysis",void 0),e([c()],W.prototype,"_creationMode",void 0),e([c({readOnly:!0})],W.prototype,"state",null),e([c({readOnly:!0})],W.prototype,"cursor",null),e([c()],W.prototype,"removeIncompleteOnCancel",void 0),e([c({readOnly:!0})],W.prototype,"updating",null),e([c({constructOnly:!0})],W.prototype,"analysisViewData",void 0),e([c({readOnly:!0})],W.prototype,"_showTracker",null),e([c()],W.prototype,"_latestPointerMovePointerType",void 0),e([c()],W.prototype,"_shouldRenderTracker",null),e([c()],W.prototype,"_laserlineVisualElement",void 0),e([c()],W.prototype,"_grabbedManipulator",void 0),e([c()],W.prototype,"_trackerIntersection",void 0),e([c()],W.prototype,"_trackerMapPoint",void 0),e([c()],W.prototype,"_snappingManagerResult",void 0),W=e([h("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],W);const J=g();export{W as LineOfSightTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import"../../../../core/has.js";import{onAbort as e}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as i,on as s}from"../../../../core/reactiveUtils.js";import{property as a,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightAuthoringStore as n}from"./LineOfSightAuthoringStore.js";import{LineOfSightPlacementTool as l}from"./LineOfSightPlacementTool.js";import{ExclusiveOperationManager as c}from"../../../analysis/ExclusiveOperationManager.js";import{AnalysisToolBase as p}from"../../../interactive/AnalysisToolBase.js";const h={ready:"ready",created:"created"};let m=class extends p{constructor(t){super(t),this._authoringStore=new n,this._operationManager=new c,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._placementTool=new l({...t,authoringStore:this._authoringStore,parent:this})}get active(){return this._placementTool.active}get state(){return this._placementTool.active?this._placementTool.state:null!=this.analysis.observer?.position?h.created:h.ready}get cursor(){return this._placementTool.cursor}get updating(){return this._placementTool.updating}initialize(){this.view.tools.add(this._placementTool),this.addHandles(o(()=>this.editable,t=>{this.analysisViewData.editable=t},i))}destroy(){this._operationManager.destroy(),this._placementTool.stop(),this.view.tools.remove(this._placementTool),this._placementTool.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,a)=>{const r=this.analysis.clone();let n=!1,l=!1;const c=()=>{l||(l=!0,this.stop(),a.aborted||!this.analysis.valid||this.analysis.equals(r)?t.reject():t.resolve({}))};t.handles.push(e(a,()=>this.stop()),s(()=>this._placementTool,"cancel",()=>c()),o(()=>this._placementTool.active,t=>{t?n=!0:n&&c()},i)),this.resetCreated(),this.continue()},t)}activate(){this.view.focus(),this.continue()}deactivate(){this.onDeactivate()}continue(){this._placementTool.continue()}stop(){this._placementTool.stop(),this.view.activeTool===this&&(this.view.activeTool=null)}resetCreated(){this._placementTool.resetCreated()}get testInfo(){}};t([a({constructOnly:!0})],m.prototype,"view",void 0),t([a({constructOnly:!0})],m.prototype,"analysis",void 0),t([a({constructOnly:!0})],m.prototype,"analysisViewData",void 0),t([a()],m.prototype,"active",null),t([a()],m.prototype,"state",null),t([a()],m.prototype,"cursor",null),t([a()],m.prototype,"updating",null),t([a()],m.prototype,"removeIncompleteOnCancel",void 0),m=t([r("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],m);export{m as LineOfSightTool2};
2
+ import{__decorate as t}from"tslib";import"../../../../core/has.js";import{onAbort as e}from"../../../../core/promiseUtils.js";import{watch as i,syncAndInitial as s,on as o}from"../../../../core/reactiveUtils.js";import{property as a,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightPlacementTool as l}from"./LineOfSightPlacementTool.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{LineOfSightReshapeTool3D as h}from"./LineOfSightReshapeTool3D.js";import{ExclusiveOperationManager as c}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as p}from"../../../input/InputManager.js";import{AnalysisToolBase as v}from"../../../interactive/AnalysisToolBase.js";import{deactivevateTool as d}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as y}from"../../../interactive/keybindings.js";const _={ready:"ready",created:"created"};let m=class extends v{constructor(t){super(t),this._operationManager=new c,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._reshapeIntersector=new r({view:t.view}),this._reshapeTool=new h({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._reshapeIntersector,view:t.view}),this._placementTool=new l({...t,parent:this})}get active(){return this._reshapeTool.active||this._placementTool.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementTool.active?this._placementTool.state:null!=this.analysis.observer?.position?_.created:_.ready}get cursor(){return this._placementTool.cursor}get updating(){return this._reshapeTool.updating||this._placementTool.updating}initialize(){this.view.tools.add(this._placementTool),this.addHandles([this.view.on("key-down",t=>this._onKeyDown(t),p.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementTool.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),s),i(()=>this.state===_.created,t=>{t?this.finishToolCreation():this._set("created",!1)},s),i(()=>this.analysisViewData.visible,t=>{this.visible=t},s),i(()=>{const{analysis:t}=this,{observer:e,targets:i}=t;return{observer:e,observerPosition:e?.position,observerElevationInfo:e?.elevationInfo,observerFeature:e?.feature,targets:i.toArray().map(t=>[t,t.position,t.elevationInfo,t.feature])}},()=>this._syncItemsFromAnalysis(),s),i(()=>this.editable,t=>{this.analysisViewData.editable=t},s)])}destroy(){this._operationManager.destroy(),this._reshapeTool.stop(),this._placementTool.stop(),this.view.tools.remove(this._placementTool),this._reshapeTool.destroy(),this._placementTool.destroy(),this._reshapeIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,a)=>{const n=this.analysis.clone();let l=!1,r=!1;const h=()=>{r||(r=!0,this.stop(),a.aborted||!this.analysis.valid||this.analysis.equals(n)?t.reject():t.resolve({}))};t.handles.push(e(a,()=>this.stop()),o(()=>this._placementTool,"cancel",()=>h()),i(()=>this._placementTool.active,t=>{t?l=!0:l&&h()},s)),this.resetCreated(),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementTool.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementTool.continue()}stop(){this._placementTool.stop(),this._placementTool.placementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}resetCreated(){this._placementTool.resetCreated()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}onEditableChange(){this.analysisViewData.editable=this.editable,this._reshapeTool.setEditableFlag(1,!0),this._reshapeTool.setEditableFlag(0,this.editable),this._placementTool.setEditableFlag(1,!0),this._placementTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideReshapeTool(){this._reshapeTool.suspend(),this._reshapeTool.visible=!1}_onKeyDown(t){const e=t.key;e===y.undo&&this.canUndo?(t.stopPropagation(),this.undo()):e===y.redo&&this.canRedo&&(t.stopPropagation(),this.redo())}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementTool.active||!this._canActivateReshapeTool?this._placementTool.active?this._placementTool:null:this._reshapeTool:null}get _canActivateReshapeTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const t=this.analysisViewData.interactive,e=this._canActivateReshapeTool;if(this._placementTool.visible=this.visible&&t,!t)return this._placementTool.stop(),this._hideReshapeTool(),this.analysisViewData.cursorTarget=null,void d(this.view,this);if(this._placementTool.active||!e)return this._hideReshapeTool(),void d(this.view,this);if(this._reshapeTool.visible=!0,this.analysisViewData.cursorTarget=null,!this._reshapeTool.active){const t=this.analysis.targets.at(-1);null!=t&&this._reshapeTool.applySelection({type:"target",target:t})}d(this.view,this)}finally{this._syncingActiveTool=!1}}}_syncItemsFromAnalysis(){this._syncActiveTool()}};t([a({constructOnly:!0})],m.prototype,"view",void 0),t([a({constructOnly:!0})],m.prototype,"analysis",void 0),t([a({constructOnly:!0})],m.prototype,"analysisViewData",void 0),t([a()],m.prototype,"active",null),t([a()],m.prototype,"canRedo",null),t([a()],m.prototype,"canUndo",null),t([a()],m.prototype,"state",null),t([a()],m.prototype,"cursor",null),t([a()],m.prototype,"updating",null),t([a()],m.prototype,"removeIncompleteOnCancel",void 0),t([a()],m.prototype,"_canActivateReshapeTool",null),m=t([n("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],m);export{m as LineOfSightTool2};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as n}from"tslib";import e from"../../../../core/Accessor.js";import{property as t,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as p}from"../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as r}from"../../interactive/SnappingVisualizer3D.js";import{SnappingContext as s}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as o}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as g}from"../../../interactive/snapping/SnappingManagerPool.js";let l=class extends e{constructor(n){super(n),this._updatingHandles=new a,this._snappingManagerResult=null}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get _snappingManager(){return this._snappingManagerResult?.snappingManager}destroy(){this._updatingHandles.destroy()}createObserverMoveSnappingPipeline(n,e,t){if(0!==n)return null;const i=new s({elevationInfo:p,pointer:t,editGeometryOperations:e,visualizer:new r});return o({snappingContext:i,snappingManager:this._ensureSnappingManager(),updatingHandles:this._updatingHandles})}_ensureSnappingManager(){if(null==this._snappingManagerResult){const n=g(this.view);this._snappingManagerResult=n,this.addHandles(n)}return this._snappingManagerResult.snappingManager}};n([t({constructOnly:!0})],l.prototype,"view",void 0),n([t()],l.prototype,"updating",null),n([t()],l.prototype,"_snappingManager",null),n([t()],l.prototype,"_snappingManagerResult",void 0),l=n([i("esri.views.3d.analysis.Viewshed.ViewshedSnappingController")],l);export{l as ViewshedSnappingController};
2
+ import{__decorate as n}from"tslib";import e from"../../../../core/Accessor.js";import{property as t,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as p}from"../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as r}from"../../interactive/SnappingVisualizer3D.js";import{SnappingContext as s}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as o}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as g}from"../../../interactive/snapping/SnappingManagerPool.js";let l=class extends e{constructor(n){super(n),this._updatingHandles=new a,this._snappingManagerResult=null}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get _snappingManager(){return this._snappingManagerResult?.snappingManager}destroy(){this._updatingHandles.destroy()}createObserverMoveSnappingPipeline(n,e,t){if(0!==n)return null;const i=new s({elevationInfo:p,pointer:t,editGeometryOperations:e,visualizer:new r});return o({snappingContext:i,snappingManager:this._ensureSnappingManager(),updatingHandles:this._updatingHandles,useZ:!1})}_ensureSnappingManager(){if(null==this._snappingManagerResult){const n=g(this.view);this._snappingManagerResult=n,this.addHandles(n)}return this._snappingManagerResult.snappingManager}};n([t({constructOnly:!0})],l.prototype,"view",void 0),n([t()],l.prototype,"updating",null),n([t()],l.prototype,"_snappingManager",null),n([t()],l.prototype,"_snappingManagerResult",void 0),l=n([i("esri.views.3d.analysis.Viewshed.ViewshedSnappingController")],l);export{l as ViewshedSnappingController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as n,Cyclical as o}from"../../../../core/Cyclical.js";import{handlesGroup as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as c,initial as v}from"../../../../core/reactiveUtils.js";import{property as g,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{sub as f,len as b,dot as M}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{viewingModeFromString as O}from"../../../ViewingMode.js";import{viewshedToolManipulatorConfiguration as V}from"./ViewshedConfiguration.js";import{ViewshedFieldOfViewManipulation as y,isSideHorizontal as T,flipSide as D}from"./ViewshedFieldOfViewManipulation.js";import{ViewshedScaleOrientManipulation as H}from"./ViewshedScaleOrientManipulation.js";import{ViewshedObserverManipulator as S}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as C}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as j}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as F,sceneSnappingAtLocation as x,dragManipulatedObject as A}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as P}from"../../../interactive/editGeometry/EditGeometryOperations.js";const k=Symbol("dragHandles"),E=Symbol("hideManipulators"),z=Symbol("hideFoVManipulators"),U=Symbol("hideObserverManipulator");let R=class extends i{constructor(e){super(e),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new y({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new H({view:this.view,tool:this.parentTool}),this._observerManipulator=new S(this.view,this.parentTool),this.addHandles([d(()=>this.elevationAlignedObserverRenderSpace,e=>{null!=e&&(this._moveManipulation.renderLocation=e,this._observerManipulator.renderLocation=e)},c),d(()=>this.viewshedComputedData?.heading,e=>{e&&(this._moveManipulation.angle=s(90-e))},v),d(()=>{const{viewshedComputedData:e}=this;return{viewshedComputedData:e,observer:this.elevationAlignedObserverRenderSpace}},({viewshedComputedData:e,observer:i},a)=>{this._grabbing&&i!==a?.observer||(this.removeHandles(k),e?.valid&&this.addHandles([this._buildObserverDragPipeline(e),this._buildFOVDragPipeline(e),this._buildScaleOrientDragPipeline(e)].filter(t),k))},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,target:e.elevationAlignedTargetRenderSpace,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorsTransform(e.viewshedCompData)},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView,tilt:e.tilt}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorVisuals(e.viewshedCompData)},v),d(()=>{const e=this.analysisViewData.visible&&(this.viewshedComputedData?.valid??!1),i=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData,{creating:t,isPlacingTarget:a}=this.parentTool;return{fovManipulationAvailable:e&&!a,nonFOVManipulationAvailable:e&&(!t||i)}},({fovManipulationAvailable:e,nonFOVManipulationAvailable:i})=>{this._moveManipulation.available=i,this._scaleOrientManipulation.available=i,this._observerManipulator.available=i,this._fieldOfViewManipulation.available=e},v),d(()=>{const e=this.viewshedComputedData;if(!e?.valid)return null;const{observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}=e;return{viewshedCompData:e,observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}},e=>{null!=e&&this._scaleOrientManipulation.updateManipulators(e.viewshedCompData)},v)]);const e=e=>{this.addHandles([e.events.on("focus-changed",()=>{const e=this._someManipulatorHovering();e&&this.parentTool.subToolHandles.forEach(({subTool:e})=>{e._resetHoveringTask()}),this._someManipulatorSelected()||e||(this._forceHoveringTask=a(async e=>{await(this._forceHoveringTestPromise??h(V.hoverTimeoutMilliseconds,e)),u(e),this._forceHoveringTask=null,this._updateManipulatorVisibility()}))}),e.events.on("grab-changed",i=>{this._grabbing="start"===i.action,"end"===i.action&&this.parentTool.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach(({subTool:e})=>{e!==this&&e._setInteractive(!this._grabbing)}),this._setInteractive(i=>i.hasManipulator(e)||!this._grabbing)}),e.events.on("drag",e=>{"start"===e.action&&this.parentTool.updateInteractionVisualsVisibility()})])};this._forEachManipulator(e)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get updating(){return null!=this._forceHoveringTask&&!this._forceHoveringTask.finished}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(e){const i=this.viewshed;null!=i&&(i.observer=e)}get elevationAlignedObserverRenderSpace(){return this.viewshedComputedData?.elevationAlignedObserverRenderSpace}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:e,grabbing:i}=this._moveManipulation;return{dragging:e,grabbing:i}}get scaleOrientInteractionState(){const{dragging:e,grabbing:i}=this._scaleOrientManipulation;return{dragging:e,grabbing:i}}_setInteractive(e){const i="boolean"==typeof e;this._forEachManipulation(t=>t.interactive=i?e:e(t))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(e){let i=!1;return this._forEachManipulator(t=>{i=i||t===e}),i}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new j({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:C})}_buildObserverDragPipeline(e){const i={mode:"absolute-height",offset:0},t=e.observer;if(null==t)return null;const a=this.view.spatialReference;return this._moveManipulation.createDragPipeline((n,o,r,s,l)=>{s=s.next(F(this,["observer"]));const p=w(t,a),h=w(e.elevationAlignedObserver,a);if(null==p||null==h)return{steps:r,cancel:s};const u=P.fromGeometry(p,O(this.view.viewingMode)),d=P.fromGeometry(h,O(this.view.viewingMode)),c=this.parentTool.createObserverMoveSnappingPipeline?.(n,d,l);if(null!=c){const{snappingStep:e,cancelSnapping:t}=c,{coordinateHelper:a}=d.data;s=s.next(t);return{steps:r.next(e=>({...e,snapOrigin:a.pointToVector(h)})).next(x(this.view,i)).next(...e).next(A({operations:u})).next(e=>(this.observer=u.data.geometry,e)),cancel:s}}return{steps:r.next(A({operations:u})).next(e=>(this.observer=u.data.geometry,e)),cancel:s}},i,a,void 0)}_buildFOVDragPipeline(e){let i=0,t=0;return this._fieldOfViewManipulation.createDragPipeline((a,o,r)=>{if(null==e)return{steps:o,cancel:r};const s=e.viewshed;let l=null;r=r.next(F(s,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:o.next(a=>{"start"===a.action&&(l=null,i=e.horizontalFieldOfView,t=e.verticalFieldOfView);const o=a.deltaAngle;if(null==l&&0!==o){const e="bottom"===a.side||"left"===a.side?o>0:o<0;l=T(a.side)?0===i&&e||360===i&&!e:0===t&&e}const r=l?D(a.side):a.side;let p=0;switch(r){case"left":p=i/2-o;break;case"right":p=i/2+o;break;case"top":p=t+2*o;break;case"bottom":p=t-2*o}return T(r)?(p=n.normalize(p),p=p>270?0:p>180?180:p,s.horizontalFieldOfView=2*p):s.verticalFieldOfView=p,a}),cancel:r}},e)}_buildScaleOrientDragPipeline(e){let i=0,t=0;const a=(i,t)=>(a,n,o)=>{if(null==e)return{steps:n,cancel:o};const r=e.viewshed;return o=o.next(F(r,[i])),{steps:n=n.next(t(r,e)),cancel:o}};return r([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",(i,a)=>a=>("start"===a.action&&(t=e.heading),i.heading=n.normalize(t+a.deltaAngle),a)),e),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",(t,a)=>a=>{"start"===a.action&&(i=e.tilt);let n=i+a.deltaAngle;return n<-90?n=180:n>270&&(n=0),t.tilt=G.clamp(n),a}),e),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",(e,i)=>t=>{const a=f(I,t.renderEnd,i.elevationAlignedObserverRenderSpace),n=b(a)*i.metersPerUnit,o=M(a,i.targetDirection)<0?V.scaleOrientMinDistance:n;return e.farDistance=o,t}),e)])}_updateManipulatorVisibility(){const e=this._someManipulatorSelected(),i=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let n=[];const o=e=>{n.push(e.disableDisplay())};e||!a&&i?this.removeHandles(E):(this._scaleOrientManipulation.forEachManipulator(o),this._moveManipulation.forEachManipulator(o),this.addHandles(n,E),n=[]),e||!a&&i||a&&t?this.removeHandles(z):(this._fieldOfViewManipulation.forEachManipulator(o),this.addHandles(n,z)),e||!a?this.removeHandles(U):this.addHandles(this._observerManipulator.disableDisplay(),U)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(e){this._forEachManipulation(i=>{i.forEachManipulator(e)}),e(this._observerManipulator)}_forEachManipulation(e){e(this._moveManipulation),e(this._fieldOfViewManipulation),e(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:e=>{this._forceHoveringTestPromise=e}}}};e([g({constructOnly:!0})],R.prototype,"analysis",void 0),e([g({constructOnly:!0})],R.prototype,"analysisViewData",void 0),e([g({constructOnly:!0})],R.prototype,"parentTool",void 0),e([g({constructOnly:!0,nonNullable:!0})],R.prototype,"view",void 0),e([g()],R.prototype,"_forceHoveringTask",void 0),e([g()],R.prototype,"updating",null),e([g()],R.prototype,"viewshed",null),e([g()],R.prototype,"_grabbing",void 0),e([g()],R.prototype,"grabbing",null),e([g()],R.prototype,"viewshedComputedData",void 0),e([g()],R.prototype,"observer",null),e([g()],R.prototype,"elevationAlignedObserverRenderSpace",null),R=e([m("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],R);const I=_(),G=new o(0,180);export{R as ViewshedSubTool};
2
+ import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as n,Cyclical as o}from"../../../../core/Cyclical.js";import{handlesGroup as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as c,initial as v}from"../../../../core/reactiveUtils.js";import{property as g,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{sub as f,len as b,dot as M}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{viewingModeFromString as O}from"../../../ViewingMode.js";import{viewshedToolManipulatorConfiguration as V}from"./ViewshedConfiguration.js";import{ViewshedFieldOfViewManipulation as y,isSideHorizontal as T,flipSide as D}from"./ViewshedFieldOfViewManipulation.js";import{ViewshedScaleOrientManipulation as H}from"./ViewshedScaleOrientManipulation.js";import{ViewshedObserverManipulator as S}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as C}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as j}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as F,sceneSnappingAtProjectedLocation as x,dragManipulatedObject as A}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as P}from"../../../interactive/editGeometry/EditGeometryOperations.js";const k=Symbol("dragHandles"),E=Symbol("hideManipulators"),z=Symbol("hideFoVManipulators"),U=Symbol("hideObserverManipulator");let R=class extends i{constructor(e){super(e),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new y({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new H({view:this.view,tool:this.parentTool}),this._observerManipulator=new S(this.view,this.parentTool),this.addHandles([d(()=>this.elevationAlignedObserverRenderSpace,e=>{null!=e&&(this._moveManipulation.renderLocation=e,this._observerManipulator.renderLocation=e)},c),d(()=>this.viewshedComputedData?.heading,e=>{e&&(this._moveManipulation.angle=s(90-e))},v),d(()=>{const{viewshedComputedData:e}=this;return{viewshedComputedData:e,observer:this.elevationAlignedObserverRenderSpace}},({viewshedComputedData:e,observer:i},a)=>{this._grabbing&&i!==a?.observer||(this.removeHandles(k),e?.valid&&this.addHandles([this._buildObserverDragPipeline(e),this._buildFOVDragPipeline(e),this._buildScaleOrientDragPipeline(e)].filter(t),k))},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,target:e.elevationAlignedTargetRenderSpace,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorsTransform(e.viewshedCompData)},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView,tilt:e.tilt}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorVisuals(e.viewshedCompData)},v),d(()=>{const e=this.analysisViewData.visible&&(this.viewshedComputedData?.valid??!1),i=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData,{creating:t,isPlacingTarget:a}=this.parentTool;return{fovManipulationAvailable:e&&!a,nonFOVManipulationAvailable:e&&(!t||i)}},({fovManipulationAvailable:e,nonFOVManipulationAvailable:i})=>{this._moveManipulation.available=i,this._scaleOrientManipulation.available=i,this._observerManipulator.available=i,this._fieldOfViewManipulation.available=e},v),d(()=>{const e=this.viewshedComputedData;if(!e?.valid)return null;const{observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}=e;return{viewshedCompData:e,observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}},e=>{null!=e&&this._scaleOrientManipulation.updateManipulators(e.viewshedCompData)},v)]);const e=e=>{this.addHandles([e.events.on("focus-changed",()=>{const e=this._someManipulatorHovering();e&&this.parentTool.subToolHandles.forEach(({subTool:e})=>{e._resetHoveringTask()}),this._someManipulatorSelected()||e||(this._forceHoveringTask=a(async e=>{await(this._forceHoveringTestPromise??h(V.hoverTimeoutMilliseconds,e)),u(e),this._forceHoveringTask=null,this._updateManipulatorVisibility()}))}),e.events.on("grab-changed",i=>{this._grabbing="start"===i.action,"end"===i.action&&this.parentTool.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach(({subTool:e})=>{e!==this&&e._setInteractive(!this._grabbing)}),this._setInteractive(i=>i.hasManipulator(e)||!this._grabbing)}),e.events.on("drag",e=>{"start"===e.action&&this.parentTool.updateInteractionVisualsVisibility()})])};this._forEachManipulator(e)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get updating(){return null!=this._forceHoveringTask&&!this._forceHoveringTask.finished}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(e){const i=this.viewshed;null!=i&&(i.observer=e)}get elevationAlignedObserverRenderSpace(){return this.viewshedComputedData?.elevationAlignedObserverRenderSpace}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:e,grabbing:i}=this._moveManipulation;return{dragging:e,grabbing:i}}get scaleOrientInteractionState(){const{dragging:e,grabbing:i}=this._scaleOrientManipulation;return{dragging:e,grabbing:i}}_setInteractive(e){const i="boolean"==typeof e;this._forEachManipulation(t=>t.interactive=i?e:e(t))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(e){let i=!1;return this._forEachManipulator(t=>{i=i||t===e}),i}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new j({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:C})}_buildObserverDragPipeline(e){const i={mode:"absolute-height",offset:0},t=e.observer;if(null==t)return null;const a=this.view.spatialReference;return this._moveManipulation.createDragPipeline((n,o,r,s,l)=>{s=s.next(F(this,["observer"]));const p=w(t,a),h=w(e.elevationAlignedObserver,a);if(null==p||null==h)return{steps:r,cancel:s};const u=P.fromGeometry(p,O(this.view.viewingMode)),d=P.fromGeometry(h,O(this.view.viewingMode)),c=this.parentTool.createObserverMoveSnappingPipeline?.(n,d,l);if(null!=c){const{snappingStep:e,cancelSnapping:t}=c,{coordinateHelper:a}=d.data;s=s.next(t);return{steps:r.next(e=>({...e,snapOrigin:a.pointToVector(h)})).next(x(this.view,i)).next(...e).next(A({operations:u})).next(e=>(this.observer=u.data.geometry,e)),cancel:s}}return{steps:r.next(A({operations:u})).next(e=>(this.observer=u.data.geometry,e)),cancel:s}},i,a,void 0)}_buildFOVDragPipeline(e){let i=0,t=0;return this._fieldOfViewManipulation.createDragPipeline((a,o,r)=>{if(null==e)return{steps:o,cancel:r};const s=e.viewshed;let l=null;r=r.next(F(s,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:o.next(a=>{"start"===a.action&&(l=null,i=e.horizontalFieldOfView,t=e.verticalFieldOfView);const o=a.deltaAngle;if(null==l&&0!==o){const e="bottom"===a.side||"left"===a.side?o>0:o<0;l=T(a.side)?0===i&&e||360===i&&!e:0===t&&e}const r=l?D(a.side):a.side;let p=0;switch(r){case"left":p=i/2-o;break;case"right":p=i/2+o;break;case"top":p=t+2*o;break;case"bottom":p=t-2*o}return T(r)?(p=n.normalize(p),p=p>270?0:p>180?180:p,s.horizontalFieldOfView=2*p):s.verticalFieldOfView=p,a}),cancel:r}},e)}_buildScaleOrientDragPipeline(e){let i=0,t=0;const a=(i,t)=>(a,n,o)=>{if(null==e)return{steps:n,cancel:o};const r=e.viewshed;return o=o.next(F(r,[i])),{steps:n=n.next(t(r,e)),cancel:o}};return r([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",(i,a)=>a=>("start"===a.action&&(t=e.heading),i.heading=n.normalize(t+a.deltaAngle),a)),e),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",(t,a)=>a=>{"start"===a.action&&(i=e.tilt);let n=i+a.deltaAngle;return n<-90?n=180:n>270&&(n=0),t.tilt=G.clamp(n),a}),e),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",(e,i)=>t=>{const a=f(I,t.renderEnd,i.elevationAlignedObserverRenderSpace),n=b(a)*i.metersPerUnit,o=M(a,i.targetDirection)<0?V.scaleOrientMinDistance:n;return e.farDistance=o,t}),e)])}_updateManipulatorVisibility(){const e=this._someManipulatorSelected(),i=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let n=[];const o=e=>{n.push(e.disableDisplay())};e||!a&&i?this.removeHandles(E):(this._scaleOrientManipulation.forEachManipulator(o),this._moveManipulation.forEachManipulator(o),this.addHandles(n,E),n=[]),e||!a&&i||a&&t?this.removeHandles(z):(this._fieldOfViewManipulation.forEachManipulator(o),this.addHandles(n,z)),e||!a?this.removeHandles(U):this.addHandles(this._observerManipulator.disableDisplay(),U)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(e){this._forEachManipulation(i=>{i.forEachManipulator(e)}),e(this._observerManipulator)}_forEachManipulation(e){e(this._moveManipulation),e(this._fieldOfViewManipulation),e(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:e=>{this._forceHoveringTestPromise=e}}}};e([g({constructOnly:!0})],R.prototype,"analysis",void 0),e([g({constructOnly:!0})],R.prototype,"analysisViewData",void 0),e([g({constructOnly:!0})],R.prototype,"parentTool",void 0),e([g({constructOnly:!0,nonNullable:!0})],R.prototype,"view",void 0),e([g()],R.prototype,"_forceHoveringTask",void 0),e([g()],R.prototype,"updating",null),e([g()],R.prototype,"viewshed",null),e([g()],R.prototype,"_grabbing",void 0),e([g()],R.prototype,"grabbing",null),e([g()],R.prototype,"viewshedComputedData",void 0),e([g()],R.prototype,"observer",null),e([g()],R.prototype,"elevationAlignedObserverRenderSpace",null),R=e([m("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],R);const I=_(),G=new o(0,180);export{R as ViewshedSubTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{handlesGroup as o,makeHandle as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{watch as d,initial as h,on as u,syncAndInitial as c,when as m,sync as g}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Point.js";import w from"../../../../../geometry/Polyline.js";import V from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as T}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterial as A,createManipulatorOutlineMaterial as P,placeAtObject as k}from"../../manipulatorUtils.js";import{RenderObject as C}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as L}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as z,convertToMapCoordinates as F}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as B}from"../manipulatorUtils.js";import{Settings as W}from"../settings.js";import{createVisualElements as N}from"../visualElementUtils.js";import{discRadiusSmall as q}from"../manipulations/config.js";import{MoveManipulation as X}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Y}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as K,createEdgeOffsetIntersectionPlane as J,createEdgeOffsetOperation as Q,edgeOffsetRotationMatrix as $,screenEdgeLengthSquared as ee,getDistanceInGeometrySR as te}from"./edgeOffsetUtils.js";import{createTooltipInfos as ie,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as ae,getUpdatedEdgeOffsetTooltipInfo as oe}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as re}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as le,createSphereGeometry as pe}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as de}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as he,addMapDelta as ue,createManipulatorDragEventPipeline as ce,dragAtLocation as me,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as fe}from"../../../../interactive/keybindings.js";import{SnappingContext as _e}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as ve}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Me,enterInputModeIfAvailable as be}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as xe}from"../../../../support/GeometryWorkerHandle.js";const ye=Symbol(),Oe=Symbol();let Ee=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new a,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new W({getTheme:()=>this.view.effectiveTheme}),this.events=new n,this.activeTooltipInfo=null,this._measurementWorker=new xe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ie(this._sketchOptions,e),this._vertexManipulatorMaterial=A(i.color.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorOutlineMaterial=P(i.outlineColor.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=P(i.hoverOutlineColor.toUnitRGBA(),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=A(n.color.toUnitRGBA(),n.renderOccluded),this._edgeManipulatorOutlineMaterial=P(n.outlineColor.toUnitRGBA(),n.renderOccluded);const a=t.edgeOffset;this._edgeOffsetManipulatorMaterial=A(a.color.toUnitRGBA(),a.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=A(a.hoverColor.toUnitRGBA(),a.renderOccluded,!1);const o=t.selected;this._selectedManipulatorMaterial=A(o.color.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorOutlineMaterial=P(o.outlineColor.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=P(o.hoverOutlineColor.toUnitRGBA(),o.renderOccluded),this.tooltip=Me(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([d(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:n})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),n.applyColor(this._selectedManipulatorMaterial),n.applyOutline(this._selectedManipulatorOutlineMaterial),n.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),d(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,we(t)&&(t.edgeManipulator.available=e)}),d(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),d(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},h),ne(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),d(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),u(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),u(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===fe.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!be(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:n,index:a}of this._operations.data.parts){const o=e?.byPartIndex.get(a);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of n)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const n=[],a=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&a;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||n.push(s),i++);this._moveVertices(n,t);if(n.length===i){if(this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(ye):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,ye)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:n}=e;if(!t&&!i&&!n)return;const a=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&a.push(o);this._moveVertices(a,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:n}=this;if(n){if(this._objectMoveManipulation=new Y({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,a)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=n.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._resetTooltip(),e=p(e))}),a.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:n,_operations:a}=this;if(!a)return;this._moveManipulation=new X({tool:i,view:n,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&B(t.operations,t.elevationInfo),snapToScene:!1,radius:X.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=a.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((n,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=ve({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new _e({editGeometryOperations:a,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(d),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(he(this.view,e,t.graphic??void 0)).next(...p).next(ue()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(n,e),e)),cancel:r}},e,s,t.graphic),d(()=>t.visible,()=>this._updateMoveManipulationPosition(),h),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),d(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Oe),e&&this.addHandles(re({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Oe)},h)])}_createVisualElements(){const{object:e,view:t}=this,i=N({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null);const n=this._outlineVisualElement;if(null!=n){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(u(()=>n.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,n=this._operations;if(e.part.vertices.length<=2||!n)return null;const a=n.data.spatialReference,s=this._settings.manipulators.edgeOffset,r=s.size/2,l=r+s.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=s,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=le(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=le(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new C(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new C(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new C(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new C(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],f=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||T(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:He(a)}),_=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:He(a)}),v={manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,s.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)}));const b=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(f,!0),this._watchAndUpdateGrabState(_,!0),ce(f,this._createEdgeOffsetPipeline(v,t,n)),ce(_,this._createEdgePipeline(v,t,n)),_.events.on("immediate-click",b),f.events.on("immediate-click",b),f.events.on("focus-changed",()=>this._resetTooltip()),f.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?K(e,this.view,this.object,v):null})],f),this._manipulatorInfos.push(v),this.manipulators.addMany([f,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,n=e.edgeManipulator,a=()=>{e.visibilityHandle=p(e.visibilityHandle);const a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=a&&null!=r&&ee(a.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!n.focused||l)&&(i.grabbable=!l,n.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),s(()=>{i.grabbable=!0,n.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",a),n.events.on("focus-changed",a),s(()=>{p(e.visibilityHandle),n.metadata.deleting=!0,this.manipulators.remove(n)})],i),a()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=J(this.view,e.manipulator.elevationAlignedLocation,Q(t,e.handle,e.manipulator.elevationInfo)),n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==n||null==a)return;const o=n.manipulator.renderLocation,s=a.manipulator.renderLocation,r=null!=i?$(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(De,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(n,a,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(n,a,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=n;a.next(e=>this._trackNumDragging(e)).next(me(this.view,r)).next(R(this.view,r,t,s,e)).next(ge()).next(ue()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&this._resetTooltip()}),o.next(()=>this._onDragCancel(!n.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(n,a,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);a.next(e=>this._trackNumDragging(e)).next(me(this.view,n.elevationAlignedLocation)).next(r).next(z(this.view)).next(F(this.view,i.data.spatialReference)).next(ue()).next(je()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),n.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,n){const{view:a,object:s}=this,r=Q(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),d=J(a,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=p(h)},c=this.events.on("undo",u);return h=o([this._initializeEdgeOffsetVisualElement(e,s,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{n.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==d?(u(),null):{...e,operation:r,plane:d},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,n){const a=()=>new w({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),s=new se({view:this.view,isDraped:t.isDraped,geometry:a(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=o([d(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{s.color=e.toUnitRGBA(),s.isDraped=t},c),t.on("committed",()=>{s.geometry=a()}),r(s)]);return s.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,n=e.handle.leftVertex,a=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(n.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,n.pos)<Te){const e=this._getManipulatorInfoFromHandle(n);null!=e&&l.push(e)}if(s.distance(n.pos,o.pos)<r||a&&s.distance(a.pos,o.pos)<Te){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!be(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(we).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:n}=i,a=Q(t.data.coordinateHelper,e.handle,n);this._selectEdgeOffsetArrow(e,a),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,n,t),this._connectEdgeOffsetTooltip(e,a,t,()=>{this.removeHandles(a),this._exitEdgeOffsetInputMode()})],a)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??K(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,n){const a=()=>this.tooltipInfos.edgeOffset.distance.actual,s=a=>{n(),queueMicrotask(()=>{this.view.focus();const n=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,te(a,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),n.remove()})},r=()=>{const e=a();null!=e?s(e):n()};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),g),this.tooltip.on("discard",n),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const n=this.view,a=this._operations,s=this._settings;if(!a)return null;const r=a.data.type,l=a.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ie(s.manipulators.vertex);this._vertexManipulatorGeometry=pe(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=pe(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ie(s.manipulators.edge);this._edgeManipulatorGeometry=pe(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=pe(this._edgeManipulatorOutlineMaterial,t,16,16)}const d="point"===r||"mesh"===r?[]:[new C(this._vertexManipulatorGeometry.instantiate(),4|Ge),new C(this._vertexManipulatorOutlineGeometry.instantiate(),5|Ge),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ge),new C(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&d.push(new C(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|Ae),new C(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ae),new C(this._edgeManipulatorGeometry.instantiate(),5|Ae),new C(this._edgeManipulatorOutlineGeometry.instantiate(),5|Ae));const h=new G({view:n,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:He(l)});h.selected=i,this._setTypeSpecificManipulatorSettings(h,e,t);const u="vertex"===e.type?{manipulator:h,handle:e,type:"vertex",selectedIndex:0}:{manipulator:h,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(h),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(u)))}u.locationUpdateHandle=o(e),this._manipulatorHandles.add(u.locationUpdateHandle,h)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(h,!0),h);const c=ce(h,(e,i,o,s)=>{let r=null;const{snappingStep:d,cancelSnapping:h}=ve({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new _e({editGeometryOperations:a,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(h);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&a&&(r=a.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}}).next(me(n,c)).next(R(n,c,t,l,m)).next(he(n,t,m)).next(...d).next(ue()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([c,h.events.on("immediate-click",e=>this._manipulatorClickCallback(e,u)),h.events.on("select-changed",()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),h.events.on("focus-changed",()=>{this._resetTooltip()})],h),this.events.emit("manipulators-changed"),u}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const n=this._settings;switch(t.type){case"vertex":{e.state=Ge,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:a}=n.manipulators.vertex;e.radius=t/2+a,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"line":{e.state=Ae,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:a}=n.manipulators.edge;e.radius=t/2+a,e.elevationInfo="on-the-ground"!==i.mode||T(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,n="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(0),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==n||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,we(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ve),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==n)return;const a=i.manipulator,o=n.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=a.location,n=o.location,s=.5,r=i.x+s*(n.x-i.x),l=i.y+s*(n.y-i.y),p=i.hasZ&&n.hasZ?0:void 0;e.manipulator.location=D(r,l,p,t.data.spatialReference)}else x(De,a.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=De}}_splitEdgeManipulator(e,t=.5){const i=this._operations,n=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const a=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(n)):(o=e,o.handle=n,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,a)),"line"===n.leftSegment?.type&&this._createVertexOrEdgeManipulator(n.leftSegment),"line"===n.rightSegment?.type&&this._createVertexOrEdgeManipulator(n.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(n.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:n.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(De,0,0,0);let t=0,i=!1,n=null,a=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==n||r.selectedIndex>n.selectedIndex?(a=n,n=r):(null==a||r.selectedIndex>a.selectedIndex)&&(a=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&B(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=X.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&B(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=n){const e=n.handle.pos,t=null!=a?a.handle.pos:n.handle.leftSegment?.leftVertex?n.handle.leftSegment.leftVertex.pos:null,o=null==a&&n.handle.rightSegment?.rightVertex?n.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Se(t,e):o&&(i=Se(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=q}0!==t&&i?(E(e,e,1/t),Ve.spatialReference=this._operations.data.spatialReference,Ve.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ve),this._moveManipulation.elevationAlignedLocation=Ve):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?k(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const n of e){const e=n.handle.part;if("vertex"===n.type&&i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightSegment));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),n=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(n&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const n=this._operations;if(n){e.length>0&&n.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const n=t.clone();n.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],n),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===de.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===de.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ae(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?oe(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function je(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Ie(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Se(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function He(e){return new H({x:0,y:0,z:0,spatialReference:e})}function we(e){return"edge"===e.type&&"edgeManipulator"in e}e([f()],Ee.prototype,"_numGrabbing",void 0),e([f()],Ee.prototype,"_numDragging",void 0),e([f()],Ee.prototype,"_pendingEdgeOffsetInfo",void 0),e([f()],Ee.prototype,"_operations",null),e([f()],Ee.prototype,"_segmentLabels",void 0),e([f({constructOnly:!0})],Ee.prototype,"tool",void 0),e([f()],Ee.prototype,"tooltip",void 0),e([f()],Ee.prototype,"activeTooltipInfo",void 0),e([f({readOnly:!0})],Ee.prototype,"updating",null),e([f()],Ee.prototype,"manipulators",null),e([f()],Ee.prototype,"view",null),e([f()],Ee.prototype,"object",null),e([f()],Ee.prototype,"enableZShape",null),e([f()],Ee.prototype,"enableDeleteVertices",null),e([f()],Ee.prototype,"enableZVertex",null),e([f()],Ee.prototype,"autoHideManipulators",null),e([f()],Ee.prototype,"enableMoveObject",null),e([f()],Ee.prototype,"enableMidpoints",null),e([f()],Ee.prototype,"enableEdgeOffset",null),e([f()],Ee.prototype,"_sketchOptions",null),e([f()],Ee.prototype,"_accentColor",null),e([f()],Ee.prototype,"_tooltipsContext",null),Ee=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Ee);const Ve=D(0,0,void 0,V.WGS84),De=I(),Te=1e-6,Ge=16,Ae=32;export{Ee as ReshapeOperation};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{handlesGroup as o,makeHandle as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{watch as h,initial as d,on as u,syncAndInitial as c,when as m,sync as f}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Point.js";import w from"../../../../../geometry/Polyline.js";import V from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as A}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as D}from"../../../../../symbols/support/utils.js";import{Manipulator3D as T}from"../../Manipulator3D.js";import{createManipulatorMaterial as G,createManipulatorOutlineMaterial as P,placeAtObject as k}from"../../manipulatorUtils.js";import{RenderObject as C}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as R}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as L,screenToRenderPlaneFromEvent as z,convertToMapCoordinates as F}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as B}from"../manipulatorUtils.js";import{Settings as W}from"../settings.js";import{createVisualElements as N}from"../visualElementUtils.js";import{discRadiusSmall as q}from"../manipulations/config.js";import{MoveManipulation as X}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Y}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as K,createEdgeOffsetIntersectionPlane as J,createEdgeOffsetOperation as Q,edgeOffsetRotationMatrix as $,screenEdgeLengthSquared as ee,getDistanceInGeometrySR as te}from"./edgeOffsetUtils.js";import{createTooltipInfos as ie,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as ae,getUpdatedEdgeOffsetTooltipInfo as oe}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as re}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as le,createSphereGeometry as pe}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as he}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as de,addMapDelta as ue,createManipulatorDragEventPipeline as ce,dragAtLocation as me,addScreenDelta as fe}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as ge}from"../../../../interactive/keybindings.js";import{SnappingContext as _e}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as ve}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Me,enterInputModeIfAvailable as be}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as xe}from"../../../../support/GeometryWorkerHandle.js";const ye=Symbol(),Oe=Symbol();let Ee=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new a,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new W({getTheme:()=>this.view.effectiveTheme}),this.events=new n,this.activeTooltipInfo=null,this._measurementWorker=new xe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ie(this._sketchOptions,e),this._vertexManipulatorMaterial=G(i.color.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorOutlineMaterial=P(i.outlineColor.toUnitRGBA(),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=P(i.hoverOutlineColor.toUnitRGBA(),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=G(n.color.toUnitRGBA(),n.renderOccluded),this._edgeManipulatorOutlineMaterial=P(n.outlineColor.toUnitRGBA(),n.renderOccluded);const a=t.edgeOffset;this._edgeOffsetManipulatorMaterial=G(a.color.toUnitRGBA(),a.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=G(a.hoverColor.toUnitRGBA(),a.renderOccluded,!1);const o=t.selected;this._selectedManipulatorMaterial=G(o.color.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorOutlineMaterial=P(o.outlineColor.toUnitRGBA(),o.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=P(o.hoverOutlineColor.toUnitRGBA(),o.renderOccluded),this.tooltip=Me(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([h(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:n})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),n.applyColor(this._selectedManipulatorMaterial),n.applyOutline(this._selectedManipulatorOutlineMaterial),n.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),h(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,we(t)&&(t.edgeManipulator.available=e)}),h(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),h(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},d),ne(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),h(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),u(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),u(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===ge.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!be(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}clearSelection(){let e=!1;for(const t of this._manipulatorInfos)if(t.manipulator.selected){e=!0;break}e&&(this._clearSelection(),this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed"))}selectManipulator(e){if(null==this._manipulatorInfos.find(t=>t.manipulator===e)||!e.selectable)return!1;let t=e.selected;for(const i of this._manipulatorInfos)if(i.manipulator!==e&&i.manipulator.selected){t=!1;break}return t||(this._clearSelection(),e.selected=!0,this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed")),!0}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:n,index:a}of this._operations.data.parts){const o=e?.byPartIndex.get(a);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of n)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const n=[],a=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&a;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||n.push(s),i++);this._moveVertices(n,t);if(n.length===i){if(this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(ye):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,ye)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:n}=e;if(!t&&!i&&!n)return;const a=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&a.push(o);this._moveVertices(a,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:n}=this;if(n){if(this._objectMoveManipulation=new Y({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,a)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=n.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._resetTooltip(),e=p(e))}),a.next(()=>this._onDragCancel(!0,()=>e=p(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:n,_operations:a}=this;if(!a)return;this._moveManipulation=new X({tool:i,view:n,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&B(t.operations,t.elevationInfo),snapToScene:!1,radius:X.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=a.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((n,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:h}=ve({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new _e({editGeometryOperations:a,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new R}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(h),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(de(this.view,e,t.graphic??void 0)).next(...p).next(ue()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(n,e),e)),cancel:r}},e,s,t.graphic),h(()=>t.visible,()=>this._updateMoveManipulationPosition(),d),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),h(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Oe),e&&this.addHandles(re({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Oe)},d)])}_createVisualElements(){const{object:e,view:t}=this,i=N({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null);const n=this._outlineVisualElement;if(null!=n){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(u(()=>n.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,n=this._operations;if(e.part.vertices.length<=2||!n)return null;const a=n.data.spatialReference,s=this._settings.manipulators.edgeOffset,r=s.size/2,l=r+s.collisionPadding,p=r/l,h=p/2,d=p*Math.sqrt(3)/2,{height:u,offset:c}=s,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=le(m,d,h,h,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=le(m,-d,h,h,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const f=[new C(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new C(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new C(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new C(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],g=new T({view:i,renderObjects:f,elevationInfo:"on-the-ground"!==t.mode||D(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:He(a)}),_=new T({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:He(a)}),v={manipulator:g,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,s.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)}));const b=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(g,!0),this._watchAndUpdateGrabState(_,!0),ce(g,this._createEdgeOffsetPipeline(v,t,n)),ce(_,this._createEdgePipeline(v,t,n)),_.events.on("immediate-click",b),g.events.on("immediate-click",b),g.events.on("focus-changed",()=>this._resetTooltip()),g.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?K(e,this.view,this.object,v):null})],g),this._manipulatorInfos.push(v),this.manipulators.addMany([g,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,n=e.edgeManipulator,a=()=>{e.visibilityHandle=p(e.visibilityHandle);const a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=a&&null!=r&&ee(a.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!n.focused||l)&&(i.grabbable=!l,n.grabbable=!l,e.visibilityHandle=o([i.disableDisplay(),s(()=>{i.grabbable=!0,n.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",a),n.events.on("focus-changed",a),s(()=>{p(e.visibilityHandle),n.metadata.deleting=!0,this.manipulators.remove(n)})],i),a()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=J(this.view,e.manipulator.elevationAlignedLocation,Q(t,e.handle,e.manipulator.elevationInfo)),n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==n||null==a)return;const o=n.manipulator.renderLocation,s=a.manipulator.renderLocation,r=null!=i?$(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(Ae,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(n,a,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(n,a,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=n;a.next(e=>this._trackNumDragging(e)).next(me(this.view,r)).next(L(this.view,r,t,s,e)).next(fe()).next(ue()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&this._resetTooltip()}),o.next(()=>this._onDragCancel(!n.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(n,a,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);a.next(e=>this._trackNumDragging(e)).next(me(this.view,n.elevationAlignedLocation)).next(r).next(z(this.view)).next(F(this.view,i.data.spatialReference)).next(ue()).next(je()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),n.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,n){const{view:a,object:s}=this,r=Q(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),h=J(a,e.manipulator.elevationAlignedLocation,r);let d;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),d=p(d)},c=this.events.on("undo",u);return d=o([this._initializeEdgeOffsetVisualElement(e,s,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{n.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==h?(u(),null):{...e,operation:r,plane:h},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,n){const a=()=>new w({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),s=new se({view:this.view,isDraped:t.isDraped,geometry:a(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=o([h(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{s.color=e.toUnitRGBA(),s.isDraped=t},c),t.on("committed",()=>{s.geometry=a()}),r(s)]);return s.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,n=e.handle.leftVertex,a=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(n.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,n.pos)<De){const e=this._getManipulatorInfoFromHandle(n);null!=e&&l.push(e)}if(s.distance(n.pos,o.pos)<r||a&&s.distance(a.pos,o.pos)<De){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!be(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(we).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:n}=i,a=Q(t.data.coordinateHelper,e.handle,n);this._selectEdgeOffsetArrow(e,a),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,n,t),this._connectEdgeOffsetTooltip(e,a,t,()=>{this.removeHandles(a),this._exitEdgeOffsetInputMode()})],a)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??K(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,n){const a=()=>this.tooltipInfos.edgeOffset.distance.actual,s=a=>{n(),queueMicrotask(()=>{this.view.focus();const n=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,te(a,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),n.remove()})},r=()=>{const e=a();null!=e?s(e):n()};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),f),this.tooltip.on("discard",n),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const n=this.view,a=this._operations,s=this._settings;if(!a)return null;const r=a.data.type,l=a.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ie(s.manipulators.vertex);this._vertexManipulatorGeometry=pe(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=pe(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ie(s.manipulators.edge);this._edgeManipulatorGeometry=pe(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=pe(this._edgeManipulatorOutlineMaterial,t,16,16)}const h="point"===r||"mesh"===r?[]:[new C(this._vertexManipulatorGeometry.instantiate(),4|Te),new C(this._vertexManipulatorOutlineGeometry.instantiate(),5|Te),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Te),new C(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new C(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&h.push(new C(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|Ge),new C(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ge),new C(this._edgeManipulatorGeometry.instantiate(),5|Ge),new C(this._edgeManipulatorOutlineGeometry.instantiate(),5|Ge));const d=()=>new T({view:n,renderObjects:h,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:He(l)});let u=null;"vertex"===e.type&&(u=this.object.createReshapeManipulator?.({vertex:e,defaultCreate:d,elevationInfo:t,selected:i})??null),u??=d(),u.selected=i,this._setTypeSpecificManipulatorSettings(u,e,t);const c="vertex"===e.type?{manipulator:u,handle:e,type:"vertex",selectedIndex:0}:{manipulator:u,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(c),this.manipulators.add(u),this._updateManipulatorPosition(c),"edge"===c.type){const e=[];for(const t of[c.handle.leftVertex,c.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(c)))}c.locationUpdateHandle=o(e),this._manipulatorHandles.add(c.locationUpdateHandle,u)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(u,!0),u);const m=ce(u,(e,i,o,s)=>{let r=null;const{snappingStep:h,cancelSnapping:d}=ve({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new _e({editGeometryOperations:a,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new R}),updatingHandles:this._updatingHandles,useZ:!1});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(d);const{elevationAlignedLocation:u}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&a&&(r=a.createUndoGroup()),"edge"===c.type){const t=this._splitEdgeManipulator(c);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:c,snapOrigin:c.handle.pos}}).next(me(n,u)).next(L(n,u,t,l,m)).next(de(n,t,m)).next(...h).next(ue()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([m,u.events.on("immediate-click",e=>this._manipulatorClickCallback(e,c)),u.events.on("select-changed",()=>{c.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),u.events.on("focus-changed",()=>{this._resetTooltip()})],u),this.events.emit("manipulators-changed"),c}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const n=this._settings;switch(t.type){case"vertex":{e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.elevationInfo=i;const t=this._operations?.data.type;if(e.interactive=null!=t&&"point"!==t&&"mesh"!==t,null==this.object.createReshapeManipulator){const{size:t,collisionPadding:i}=n.manipulators.vertex;e.radius=t/2+i,e.state=Te}break}case"line":{e.state=Ge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:a}=n.manipulators.edge;e.radius=t/2+a,e.elevationInfo="on-the-ground"!==i.mode||D(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,n="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(0),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==n||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,we(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ve),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==n)return;const a=i.manipulator,o=n.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=a.location,n=o.location,s=.5,r=i.x+s*(n.x-i.x),l=i.y+s*(n.y-i.y),p=i.hasZ&&n.hasZ?0:void 0;e.manipulator.location=A(r,l,p,t.data.spatialReference)}else x(Ae,a.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=Ae}}_splitEdgeManipulator(e,t=.5){const i=this._operations,n=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const a=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(n)):(o=e,o.handle=n,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,a)),"line"===n.leftSegment?.type&&this._createVertexOrEdgeManipulator(n.leftSegment),"line"===n.rightSegment?.type&&this._createVertexOrEdgeManipulator(n.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(n.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:n.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(Ae,0,0,0);let t=0,i=!1,n=null,a=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==n||r.selectedIndex>n.selectedIndex?(a=n,n=r):(null==a||r.selectedIndex>a.selectedIndex)&&(a=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&B(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=X.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&B(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=n){const e=n.handle.pos,t=null!=a?a.handle.pos:n.handle.leftSegment?.leftVertex?n.handle.leftSegment.leftVertex.pos:null,o=null==a&&n.handle.rightSegment?.rightVertex?n.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Se(t,e):o&&(i=Se(e,o))}const s=n?.handle,r=s?o.getReshapeMoveConfig?.({vertex:s,numSelected:t})??null:null;switch(r?.xyAxisMode){case"all":this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e;break;case"hidden":this._moveManipulation.xyAxisManipulation.available=!1,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=!1}this._moveManipulation.angle=r?.angle??i,this._moveManipulation.radius=q}0!==t&&i?(E(e,e,1/t),Ve.spatialReference=this._operations.data.spatialReference,Ve.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ve),this._moveManipulation.elevationAlignedLocation=Ve):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?k(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const n of e){const e=n.handle.part;if("vertex"===n.type&&i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightSegment));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),n=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(n&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const n=this._operations;if(n){e.length>0&&n.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const n=t.clone();n.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],n),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===he.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===he.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ae(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?oe(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"multipoint":case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function je(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Ie(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Se(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function He(e){return new H({x:0,y:0,z:0,spatialReference:e})}function we(e){return"edge"===e.type&&"edgeManipulator"in e}e([g()],Ee.prototype,"_numGrabbing",void 0),e([g()],Ee.prototype,"_numDragging",void 0),e([g()],Ee.prototype,"_pendingEdgeOffsetInfo",void 0),e([g()],Ee.prototype,"_operations",null),e([g()],Ee.prototype,"_segmentLabels",void 0),e([g({constructOnly:!0})],Ee.prototype,"tool",void 0),e([g()],Ee.prototype,"tooltip",void 0),e([g()],Ee.prototype,"activeTooltipInfo",void 0),e([g({readOnly:!0})],Ee.prototype,"updating",null),e([g()],Ee.prototype,"manipulators",null),e([g()],Ee.prototype,"view",null),e([g()],Ee.prototype,"object",null),e([g()],Ee.prototype,"enableZShape",null),e([g()],Ee.prototype,"enableDeleteVertices",null),e([g()],Ee.prototype,"enableZVertex",null),e([g()],Ee.prototype,"autoHideManipulators",null),e([g()],Ee.prototype,"enableMoveObject",null),e([g()],Ee.prototype,"enableMidpoints",null),e([g()],Ee.prototype,"enableEdgeOffset",null),e([g()],Ee.prototype,"_sketchOptions",null),e([g()],Ee.prototype,"_accentColor",null),e([g()],Ee.prototype,"_tooltipsContext",null),Ee=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Ee);const Ve=A(0,0,void 0,V.WGS84),Ae=I(),De=1e-6,Te=16,Ge=32;export{Ee as ReshapeOperation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ReshapeOperation as r}from"./ReshapeOperation.js";import{InteractiveToolBase as p}from"../../../../interactive/InteractiveToolBase.js";import{sketchKeys as a}from"../../../../interactive/keybindings.js";import s from"../../../../interactive/sketch/SketchOptions.js";let h=class extends p{constructor(e){super(e),this._reshapeOperation=null,this.events=new t,this.enableZShape=!0,this.enableZVertex=!0,this.enableMoveObject=!0,this.enableDeleteVertices=!0,this.autoHideManipulators=!1,this.enableMidpoints=!0,this.enableEdgeOffset=!1,this.type="reshape-3d",this.sketchOptions=new s,this.snappingManager=null,this.automaticManipulatorSelection=!1}initialize(){const e=this._reshapeOperation=new r({tool:this});this.addHandles([e.events.on("reshape",e=>this.events.emit("reshape",e)),e.events.on("move",e=>this.events.emit("move",e)),e.events.on("vertex-add",e=>this.events.emit("vertex-add",e)),e.events.on("vertex-remove",e=>this.events.emit("vertex-remove",e)),e.events.on("immediate-click",e=>this.events.emit("immediate-click",{...e,object:this.object})),this.view.on("pointer-down",["Shift"],e=>e.stopPropagation())]),this.finishToolCreation()}destroy(){this._reshapeOperation=o(this._reshapeOperation)}get updating(){return((this.object.updating??!1)||this._reshapeOperation?.updating||this.snappingManager?.updating)??!1}get activeTooltipInfo(){return this._reshapeOperation?.activeTooltipInfo??null}get tooltip(){return this._reshapeOperation?.tooltip??null}onManipulatorSelectionChanged(){this._reshapeOperation?.onManipulatorSelectionChanged()}recordUndo(e,t){this._reshapeOperation?.recordUndo({apply:e,undo:t,accumulate:()=>!1})}get canUndo(){return this._reshapeOperation?.canUndo??!1}undo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.undo()}get canRedo(){return this._reshapeOperation?.canRedo??!1}redo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.redo()}onInputEvent(e){const t=this._reshapeOperation;if(t&&!t.enterInputModeIfAvailable(e)&&this.enableDeleteVertices&&"key-down"===e.type&&a.delete.includes(e.key)){t.removeSelectedVertices()>0&&e.stopPropagation()}}reset(){}get test(){}};e([i()],h.prototype,"_reshapeOperation",void 0),e([i({constructOnly:!0})],h.prototype,"view",void 0),e([i({constructOnly:!0})],h.prototype,"object",void 0),e([i()],h.prototype,"enableZShape",void 0),e([i()],h.prototype,"enableZVertex",void 0),e([i()],h.prototype,"enableMoveObject",void 0),e([i()],h.prototype,"enableDeleteVertices",void 0),e([i()],h.prototype,"autoHideManipulators",void 0),e([i()],h.prototype,"enableMidpoints",void 0),e([i()],h.prototype,"enableEdgeOffset",void 0),e([i()],h.prototype,"type",void 0),e([i({type:s})],h.prototype,"sketchOptions",void 0),e([i()],h.prototype,"snappingManager",void 0),e([i()],h.prototype,"updating",null),e([i()],h.prototype,"activeTooltipInfo",null),e([i()],h.prototype,"tooltip",null),e([i()],h.prototype,"automaticManipulatorSelection",void 0),h=e([n("esri.views.3d.interactive.editingTools.reshape.ReshapeTool3D")],h);export{h as ReshapeTool3D};
2
+ import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ReshapeOperation as r}from"./ReshapeOperation.js";import{InteractiveToolBase as p}from"../../../../interactive/InteractiveToolBase.js";import{sketchKeys as a}from"../../../../interactive/keybindings.js";import s from"../../../../interactive/sketch/SketchOptions.js";let h=class extends p{constructor(e){super(e),this._reshapeOperation=null,this.events=new t,this.enableZShape=!0,this.enableZVertex=!0,this.enableMoveObject=!0,this.enableDeleteVertices=!0,this.autoHideManipulators=!1,this.enableMidpoints=!0,this.enableEdgeOffset=!1,this.type="reshape-3d",this.sketchOptions=new s,this.snappingManager=null,this.automaticManipulatorSelection=!1}initialize(){const e=this._reshapeOperation=new r({tool:this});this.addHandles([e.events.on("reshape",e=>this.events.emit("reshape",e)),e.events.on("move",e=>this.events.emit("move",e)),e.events.on("vertex-add",e=>this.events.emit("vertex-add",e)),e.events.on("vertex-remove",e=>this.events.emit("vertex-remove",e)),e.events.on("immediate-click",e=>this.events.emit("immediate-click",{...e,object:this.object})),this.view.on("pointer-down",["Shift"],e=>e.stopPropagation())]),this.finishToolCreation()}destroy(){this._reshapeOperation=o(this._reshapeOperation)}get updating(){return((this.object.updating??!1)||this._reshapeOperation?.updating||this.snappingManager?.updating)??!1}get activeTooltipInfo(){return this._reshapeOperation?.activeTooltipInfo??null}get tooltip(){return this._reshapeOperation?.tooltip??null}onManipulatorSelectionChanged(){this._reshapeOperation?.onManipulatorSelectionChanged()}clearSelection(){this._reshapeOperation?.clearSelection()}selectManipulator(e){return this._reshapeOperation?.selectManipulator(e)??!1}recordUndo(e,t){this._reshapeOperation?.recordUndo({apply:e,undo:t,accumulate:()=>!1})}get canUndo(){return this._reshapeOperation?.canUndo??!1}undo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.undo()}get canRedo(){return this._reshapeOperation?.canRedo??!1}redo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.redo()}onInputEvent(e){const t=this._reshapeOperation;if(t&&!t.enterInputModeIfAvailable(e)&&this.enableDeleteVertices&&"key-down"===e.type&&a.delete.includes(e.key)){t.removeSelectedVertices()>0&&e.stopPropagation()}}reset(){}get test(){}};e([i()],h.prototype,"_reshapeOperation",void 0),e([i({constructOnly:!0})],h.prototype,"view",void 0),e([i({constructOnly:!0})],h.prototype,"object",void 0),e([i()],h.prototype,"enableZShape",void 0),e([i()],h.prototype,"enableZVertex",void 0),e([i()],h.prototype,"enableMoveObject",void 0),e([i()],h.prototype,"enableDeleteVertices",void 0),e([i()],h.prototype,"autoHideManipulators",void 0),e([i()],h.prototype,"enableMidpoints",void 0),e([i()],h.prototype,"enableEdgeOffset",void 0),e([i()],h.prototype,"type",void 0),e([i({type:s})],h.prototype,"sketchOptions",void 0),e([i()],h.prototype,"snappingManager",void 0),e([i()],h.prototype,"updating",null),e([i()],h.prototype,"activeTooltipInfo",null),e([i()],h.prototype,"tooltip",null),e([i()],h.prototype,"automaticManipulatorSelection",void 0),h=e([n("esri.views.3d.interactive.editingTools.reshape.ReshapeTool3D")],h);export{h as ReshapeTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- function r(r){return t(r).result}function t(r){if(r.graphic&&"graphics"!==r.graphic.layer?.type)return{result:1};if(!r.operations)return{result:2};const t=r.operations.data.type,e=r.operations.data.geometry;return"point"===t||"mesh"===t||"polyline"===t||"polygon"===t?{result:0,geometry:e}:{result:3}}export{r as isSupportedObject};
2
+ function t(t){return r(t).result}function r(t){if(t.graphic&&"graphics"!==t.graphic.layer?.type)return{result:1};if(!t.operations)return{result:2};const r=t.operations.data.type,e=t.operations.data.geometry;return"point"===r||"multipoint"===r||"mesh"===r||"polyline"===r||"polygon"===r?{result:0,geometry:e}:{result:3}}export{t as isSupportedObject};