@arcgis/core 4.23.0-next.20220131 → 4.23.0-next.20220205

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 (402) hide show
  1. package/Graphic.js +1 -1
  2. package/TimeExtent.js +1 -1
  3. package/assets/components/assets/calcite-date-picker/nls/pt-BR.json +31 -0
  4. package/assets/components/assets/calcite-date-picker/nls/pt-PT.json +3 -3
  5. package/assets/components/assets/calcite-icon/clipboard16.json +1 -0
  6. package/assets/components/assets/calcite-icon/clipboard24.json +1 -0
  7. package/assets/components/assets/calcite-icon/clipboard32.json +1 -0
  8. package/assets/components/assets/calcite-icon/folders16.json +1 -0
  9. package/assets/components/assets/calcite-icon/folders24.json +1 -0
  10. package/assets/components/assets/calcite-icon/folders32.json +1 -0
  11. package/assets/components/assets/calcite-icon/initiative16.json +1 -0
  12. package/assets/components/assets/calcite-icon/initiative24.json +1 -0
  13. package/assets/components/assets/calcite-icon/initiative32.json +1 -0
  14. package/assets/components/assets/calcite-icon/initiativeTemplate16.json +1 -0
  15. package/assets/components/assets/calcite-icon/initiativeTemplate24.json +1 -0
  16. package/assets/components/assets/calcite-icon/initiativeTemplate32.json +1 -0
  17. package/assets/components/assets/calcite-icon/multipleVariables16.json +1 -0
  18. package/assets/components/assets/calcite-icon/multipleVariables24.json +1 -0
  19. package/assets/components/assets/calcite-icon/multipleVariables32.json +1 -0
  20. package/assets/components/assets/calcite-icon/paletteCheck16.json +1 -0
  21. package/assets/components/assets/calcite-icon/paletteCheck24.json +1 -0
  22. package/assets/components/assets/calcite-icon/paletteCheck32.json +1 -0
  23. package/assets/components/assets/calcite-icon/pentagon16.json +1 -0
  24. package/assets/components/assets/calcite-icon/pentagon24.json +1 -0
  25. package/assets/components/assets/calcite-icon/pentagon32.json +1 -0
  26. package/assets/components/assets/calcite-icon/puzzlePiece16.json +1 -0
  27. package/assets/components/assets/calcite-icon/puzzlePiece24.json +1 -0
  28. package/assets/components/assets/calcite-icon/puzzlePiece32.json +1 -0
  29. package/assets/components/assets/calcite-icon/ribbonRosette16.json +1 -0
  30. package/assets/components/assets/calcite-icon/ribbonRosette24.json +1 -0
  31. package/assets/components/assets/calcite-icon/ribbonRosette32.json +1 -0
  32. package/assets/components/assets/calcite-icon/speechBubbleExclamation16.json +1 -0
  33. package/assets/components/assets/calcite-icon/speechBubbleExclamation24.json +1 -0
  34. package/assets/components/assets/calcite-icon/speechBubbleExclamation32.json +1 -0
  35. package/assets/components/assets/calcite-icon/survey16.json +1 -0
  36. package/assets/components/assets/calcite-icon/survey24.json +1 -0
  37. package/assets/components/assets/calcite-icon/survey32.json +1 -0
  38. package/assets/esri/core/workers/RemoteClient.js +1 -1
  39. package/assets/esri/core/workers/chunks/{7a5f5acfbd4ca1a5c1f3.js → 06116433eb6e669f146b.js} +1 -1
  40. package/assets/esri/core/workers/chunks/0a4401a148c3cb73d6ff.js +1 -0
  41. package/assets/esri/core/workers/chunks/{83d00afae4406ec78bc9.js → 0c6be307709523eb8a05.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{e0c8d61c7a85ce15499a.js → 0d9adefd00c44585be2e.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{44f0c3663b293afbd172.js → 0e09691edb44641de5f0.js} +1 -1
  44. package/assets/esri/core/workers/chunks/0e215fa28a0448169132.js +1 -0
  45. package/assets/esri/core/workers/chunks/{391e96192d1ec4e55ce2.js → 101b4f02f0572afb666f.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{db3c729ce0c0b2690dc9.js → 1180ffd523c6292bc04e.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{826c983100569586b61f.js → 1571e8213feb518ff100.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{929c9b7cdab7c4ca3d87.js → 17c51f5a13f471e6656a.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{37c03cfc19086ce631c6.js → 18a8b9e2f6bd89827189.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{ed0bcc66fb1e0ee75a4b.js → 1f34957ef42e5b5977d0.js} +1 -1
  51. package/assets/esri/core/workers/chunks/236de5f0476f6080ee62.js +1 -0
  52. package/assets/esri/core/workers/chunks/288ca064cd0472439276.js +1 -0
  53. package/assets/esri/core/workers/chunks/29aa6046534a43d7ce19.js +1 -0
  54. package/assets/esri/core/workers/chunks/2e1291cd831592216446.js +1 -0
  55. package/assets/esri/core/workers/chunks/{68a59ce98177d8513337.js → 3403cb53e4e60923c5fc.js} +1 -1
  56. package/assets/esri/core/workers/chunks/34bed896b68993cabaa1.js +1 -0
  57. package/assets/esri/core/workers/chunks/{99619fcb772807c74f3b.js → 444829a840b8ded16fd7.js} +1 -1
  58. package/assets/esri/core/workers/chunks/467b5faa1c90d9821609.js +1 -0
  59. package/assets/esri/core/workers/chunks/49353182a16218a84251.js +1 -0
  60. package/assets/esri/core/workers/chunks/{fc046a15466c25d081ff.js → 4a2e93b12d60e8d92491.js} +1 -1
  61. package/assets/esri/core/workers/chunks/4de996ebc432f5e149bc.js +1 -0
  62. package/assets/esri/core/workers/chunks/50976921acf7bd636123.js +1 -0
  63. package/assets/esri/core/workers/chunks/5144ef135e0deb48c7bf.js +1 -0
  64. package/assets/esri/core/workers/chunks/584bbb675ed225f68171.js +1 -0
  65. package/assets/esri/core/workers/chunks/5a90d121ba79613cc2aa.js +1 -0
  66. package/assets/esri/core/workers/chunks/5b286f3f3deea10bdd91.js +1 -0
  67. package/assets/esri/core/workers/chunks/{0463ba46df855a92b9c0.js → 65ccd204ec3053687a77.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{1f8c6a179e39fd4c5e6f.js → 6a2b8d6a9bada45ab66d.js} +1 -1
  69. package/assets/esri/core/workers/chunks/6be326edd9829781d926.js +1 -0
  70. package/assets/esri/core/workers/chunks/6ea99a6e21b09674f6b3.js +1 -0
  71. package/assets/esri/core/workers/chunks/{5bcb3240b3c005e5fe72.js → 7215af7810d15e89aa5a.js} +1 -1
  72. package/assets/esri/core/workers/chunks/7509c1693ffedc0fa018.js +1 -0
  73. package/assets/esri/core/workers/chunks/7b0b75878370b3475fe5.js +1 -0
  74. package/assets/esri/core/workers/chunks/{bfedd6ebff817c9b31c0.js → 7b618c449d793aacd874.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{2460f3b6ada6ae900dec.js → 7c0ff01f081c7e9050d2.js} +1 -1
  76. package/assets/esri/core/workers/chunks/806a7db0084214a53c79.js +1 -0
  77. package/assets/esri/core/workers/chunks/{8fa0a14165d43ffe87a5.js → 8325b577f52936f86cff.js} +1 -1
  78. package/assets/esri/core/workers/chunks/84d8e77d78d0d5134083.js +1 -0
  79. package/assets/esri/core/workers/chunks/{dd13772a5e2eccc6a2bc.js → 8598f762f15ca68d52b7.js} +1 -1
  80. package/assets/esri/core/workers/chunks/85b1ae51da3689bccf92.js +1 -0
  81. package/assets/esri/core/workers/chunks/873b0cbd343dc71755ed.js +1 -0
  82. package/assets/esri/core/workers/chunks/8804b8489eeab888275b.js +1 -0
  83. package/assets/esri/core/workers/chunks/{5ec98f4ddac707d0fbd1.js → 88815d533808aabb1fa9.js} +1 -1
  84. package/assets/esri/core/workers/chunks/8c8c0ecdf44fdbb56000.js +1 -0
  85. package/assets/esri/core/workers/chunks/{f2124f4d0f2b8a91f0ea.js → 90c5edcd8a609224ce55.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{bac9fc90e6756e211160.js → 94d9951509c0db09547a.js} +1 -1
  87. package/assets/esri/core/workers/chunks/996d6ae7f2e2273f9bce.js +1 -0
  88. package/assets/esri/core/workers/chunks/{c1135cb02ec46c491459.js → 9ce961bc390202c87941.js} +1 -1
  89. package/assets/esri/core/workers/chunks/9fbc7d2e0326be41b382.js +1 -0
  90. package/assets/esri/core/workers/chunks/a363fb40096679b011f6.js +1 -0
  91. package/assets/esri/core/workers/chunks/a41522b0a853b85c8269.js +1 -0
  92. package/assets/esri/core/workers/chunks/a763c11d2b02b3ec36ad.js +1 -0
  93. package/assets/esri/core/workers/chunks/{aeaa1667c2d9f1b3366b.js → a85ed251d3d3668e474f.js} +1 -1
  94. package/assets/esri/core/workers/chunks/{69fd99b7c76e9992ccf3.js → b32bf9808cb4be3a6bd0.js} +1 -1
  95. package/assets/esri/core/workers/chunks/b33a6fbbc8de2969b1ca.js +1 -0
  96. package/assets/esri/core/workers/chunks/b548e6b3add4154ac4e6.js +1 -0
  97. package/assets/esri/core/workers/chunks/b6c55bdd8c957b062bc1.js +1 -0
  98. package/assets/esri/core/workers/chunks/b90509b2088fd444fc39.js +1 -0
  99. package/assets/esri/core/workers/chunks/{b9e9cb354822c6d995a4.js → bea473dba8e57617a71d.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{0d02c6ad1f4688bfa374.js → bf7c44644fe7b0aa60cf.js} +1 -1
  101. package/assets/esri/core/workers/chunks/c1a70f025e90d97fac6d.js +1 -0
  102. package/assets/esri/core/workers/chunks/{d72488db62fcf39447b6.js → c23d965a55215168a1a2.js} +1 -1
  103. package/assets/esri/core/workers/chunks/c3192cfe115ce354ffbc.js +1 -0
  104. package/assets/esri/core/workers/chunks/c3d768801f2f6cb9d5d0.js +1 -0
  105. package/assets/esri/core/workers/chunks/d09a0b2dc3a6fc10fa41.js +1 -0
  106. package/assets/esri/core/workers/chunks/d21526570300597aa6ae.js +1 -0
  107. package/assets/esri/core/workers/chunks/d2ffb0f21363c0d3d2a9.js +1 -0
  108. package/assets/esri/core/workers/chunks/{ec10151a2a95e95a0bb5.js → d304fe0ac836afd46e3d.js} +1 -1
  109. package/assets/esri/core/workers/chunks/{37a7bd30352b1309b8f8.js → d3f05b8e4bd53eb1eb9d.js} +1 -1
  110. package/assets/esri/core/workers/chunks/{17de7a324dfa7f57ad5d.js → d780e946149b1c3d1246.js} +1 -1
  111. package/assets/esri/core/workers/chunks/dc037f1496bb4aa40d10.js +1 -0
  112. package/assets/esri/core/workers/chunks/{8cbb04a9065aa3756638.js → dc04a8ba6c770bdc2bd4.js} +1 -1
  113. package/assets/esri/core/workers/chunks/dd5a71818a989a6edb00.js +1 -0
  114. package/assets/esri/core/workers/chunks/{89820b200ee44e678af5.js → dd891a98105904f8a06b.js} +1 -1
  115. package/assets/esri/core/workers/chunks/e17edd48179d41ddf1e7.js +1 -0
  116. package/assets/esri/core/workers/chunks/e323086de328a164f7f0.js +1 -0
  117. package/assets/esri/core/workers/chunks/ea50a6a994e5ee578d97.js +1 -0
  118. package/assets/esri/core/workers/chunks/{655b55ac0cd533d7e9d7.js → ecf074743183c1749581.js} +1 -1
  119. package/assets/esri/core/workers/chunks/f067b4fc65b835437afd.js +1 -0
  120. package/assets/esri/core/workers/chunks/f0e5c82e9c4fbe3c9d0a.js +1 -0
  121. package/assets/esri/core/workers/chunks/f96b24c075771d028e20.js +1 -0
  122. package/assets/esri/core/workers/chunks/{5790d171072b3c7d108f.js → f9a6de00c628538f07f6.js} +1 -1
  123. package/assets/esri/core/workers/chunks/{2c607d30ff8ca1b61286.js → fe0c3b7c9b428d9c3f25.js} +1 -1
  124. package/assets/esri/core/workers/chunks/{49a1a633bb0d93764aae.js → fffea9587ec14c6d34e8.js} +1 -1
  125. package/assets/esri/themes/base/_mixins.scss +1 -1
  126. package/assets/esri/themes/base/widgets/_Directions.scss +0 -6
  127. package/assets/esri/themes/base/widgets/_Legend.scss +8 -7
  128. package/assets/esri/themes/dark/main.css +1 -1
  129. package/assets/esri/themes/dark-blue/main.css +1 -1
  130. package/assets/esri/themes/dark-green/main.css +1 -1
  131. package/assets/esri/themes/dark-purple/main.css +1 -1
  132. package/assets/esri/themes/dark-red/main.css +1 -1
  133. package/assets/esri/themes/light/main.css +1 -1
  134. package/assets/esri/themes/light/view.css +1 -1
  135. package/assets/esri/themes/light-blue/main.css +1 -1
  136. package/assets/esri/themes/light-green/main.css +1 -1
  137. package/assets/esri/themes/light-purple/main.css +1 -1
  138. package/assets/esri/themes/light-red/main.css +1 -1
  139. package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
  140. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  141. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  142. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  143. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  144. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  145. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  146. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  147. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  148. package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
  149. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  150. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  151. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  152. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  153. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  154. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  155. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  156. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  157. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  158. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  159. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  160. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  161. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  162. package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
  163. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  164. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  165. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  166. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  167. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  168. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  169. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  170. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  171. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  172. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  173. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  174. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  175. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  176. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  177. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  178. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  179. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  180. package/chunks/Fog.glsl.js +12 -24
  181. package/chunks/Heatmap.glsl.js +10 -0
  182. package/chunks/HeatmapDensity.glsl.js +21 -0
  183. package/chunks/Precipitation.glsl.js +2 -2
  184. package/core/maybe.js +1 -1
  185. package/core/promiseUtils.js +1 -1
  186. package/interfaces.d.ts +2432 -231
  187. package/layers/ImageryTileLayer.js +1 -1
  188. package/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js +1 -1
  189. package/layers/graphics/featureConversionUtils.js +1 -1
  190. package/layers/mixins/ArcGISImageService.js +1 -1
  191. package/layers/support/imageryRendererUtils.js +1 -1
  192. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  193. package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
  194. package/package.json +2 -2
  195. package/rasterRenderers.js +1 -1
  196. package/renderers/DictionaryRenderer.js +1 -1
  197. package/renderers/FlowRenderer.d.ts +4 -0
  198. package/renderers/FlowRenderer.js +5 -0
  199. package/renderers/support/DictionaryLoader.js +5 -0
  200. package/renderers/support/RasterSymbolizer.js +1 -1
  201. package/renderers/support/rasterRendererHelper.js +1 -1
  202. package/renderers/support/rendererConversion.js +1 -1
  203. package/rest/geoprocessor/GPOptions.js +1 -1
  204. package/rest/print.js +1 -1
  205. package/rest/support/DirectionLine.js +1 -1
  206. package/rest/support/DirectionPoint.js +1 -1
  207. package/rest/support/FeatureSet.js +1 -1
  208. package/rest/support/LegendLayer.js +1 -1
  209. package/rest/support/LinearUnit.js +1 -1
  210. package/rest/support/PointBarrier.js +1 -1
  211. package/rest/support/PolygonBarrier.js +1 -1
  212. package/rest/support/PolylineBarrier.js +1 -1
  213. package/rest/support/RasterData.js +1 -1
  214. package/smartMapping/raster/renderers/flow.js +5 -0
  215. package/smartMapping/raster/support/utils.js +1 -1
  216. package/support/basemapUtils.js +1 -1
  217. package/support/featureFlags.js +1 -1
  218. package/support/revision.js +1 -1
  219. package/symbols/TextSymbol3DLayer.js +1 -1
  220. package/symbols/cim/effects/EffectArrow.js +1 -1
  221. package/symbols/support/Symbol3DHalo.js +1 -1
  222. package/symbols/support/Symbol3DTextBackground.js +5 -0
  223. package/symbols/support/previewSymbol2D.js +1 -1
  224. package/symbols/support/svgUtils.js +1 -1
  225. package/tasks/Geoprocessor.js +1 -1
  226. package/views/2d/FrameTask.js +1 -1
  227. package/views/2d/ViewState.js +1 -1
  228. package/views/2d/constraints/GeometryConstraint.js +1 -1
  229. package/views/2d/engine/BitmapTileContainer.js +1 -1
  230. package/views/2d/engine/DisplayObject.js +1 -1
  231. package/views/2d/engine/RasterTileContainer.js +1 -1
  232. package/views/2d/engine/RasterVFContainer.js +5 -0
  233. package/views/2d/engine/RasterVFDisplayObject.js +1 -1
  234. package/views/2d/engine/RasterVFTileContainer.js +1 -1
  235. package/views/2d/engine/Stage.js +1 -1
  236. package/views/2d/engine/flow/BrushFlow.js +1 -1
  237. package/views/2d/engine/flow/FlowDisplayData.js +1 -1
  238. package/views/2d/engine/flow/FlowGLResources.js +1 -1
  239. package/views/2d/engine/flow/FlowStyle.js +1 -1
  240. package/views/2d/engine/flow/FlowView2D.js +5 -0
  241. package/views/2d/engine/flow/dataUtils.js +1 -1
  242. package/views/2d/engine/flow/flowRendererUtils.js +5 -0
  243. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  244. package/views/2d/engine/webgl/brushes/raster/BrushVectorField.js +1 -1
  245. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  246. package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
  247. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  248. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  249. package/views/2d/input/handlers/DragPan.js +1 -1
  250. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  251. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  252. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  253. package/views/2d/layers/KMLLayerView2D.js +1 -1
  254. package/views/2d/layers/LayerView2D.js +1 -1
  255. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  256. package/views/2d/layers/TileLayerView2D.js +1 -1
  257. package/views/2d/layers/WMSLayerView2D.js +1 -1
  258. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  259. package/views/2d/layers/features/Pipeline.js +1 -1
  260. package/views/2d/layers/features/createSymbolSchema.js +5 -0
  261. package/views/2d/layers/features/processors/HeatmapProcessor.js +1 -1
  262. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  263. package/views/2d/layers/features/schemaUtils.js +1 -1
  264. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  265. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  266. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  267. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  268. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  269. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  270. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  271. package/views/2d/layers/imagery/ImageryVFStrategy.js +5 -0
  272. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  273. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  274. package/views/2d/layers/imagery/VectorFieldView2D.js +5 -0
  275. package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
  276. package/views/2d/navigation/MapViewNavigation.js +1 -1
  277. package/views/2d/navigation/actions/Pan.js +1 -1
  278. package/views/2d/viewpointUtils.js +1 -1
  279. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  280. package/views/3d/environment/Fog.js +1 -1
  281. package/views/3d/environment/Precipitation.js +1 -1
  282. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  283. package/views/3d/environment/SceneViewEnvironment.js +1 -1
  284. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  285. package/views/3d/environment/weather.js +1 -1
  286. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  287. package/views/3d/layerViewModuleImportUtils.js +1 -1
  288. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  289. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  290. package/views/3d/layers/IRouteLayerView3D.js +4 -0
  291. package/views/3d/layers/RouteLayerView3D.js +5 -0
  292. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  293. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  294. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  295. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  296. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  297. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  298. package/views/3d/layers/graphics/Labeler.js +1 -1
  299. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  300. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  301. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  302. package/views/3d/terrain/OverlayRenderer.js +1 -1
  303. package/views/3d/terrain/terrainUtils.js +1 -1
  304. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +5 -0
  305. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  306. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  307. package/views/3d/webgl-engine/lib/TextTexture.js +1 -1
  308. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +5 -0
  309. package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +5 -0
  310. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +5 -0
  311. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +5 -0
  312. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +5 -0
  313. package/views/MapView.js +1 -1
  314. package/views/ToolViewManager.js +1 -1
  315. package/views/View.js +1 -1
  316. package/views/draw/support/Box.js +1 -1
  317. package/views/draw/support/GraphicMover.js +1 -1
  318. package/views/draw/support/HighlightHelper.js +5 -0
  319. package/views/draw/support/Reshape.js +1 -1
  320. package/views/draw/support/layerUtils.js +1 -1
  321. package/views/interactive/InteractiveToolBase.js +1 -1
  322. package/views/support/WatchUpdatingTracking.js +1 -1
  323. package/views/support/projectionUtils.js +1 -1
  324. package/views/webgl/RenderingContext.js +1 -1
  325. package/views/webgl/enums.js +1 -1
  326. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  327. package/widgets/BasemapGallery/support/BasemapGalleryItem.js +1 -1
  328. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  329. package/widgets/BasemapToggle.js +1 -1
  330. package/widgets/Directions/support/resources.js +1 -1
  331. package/widgets/Directions.js +1 -1
  332. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  333. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  334. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  335. package/widgets/FeatureTable.js +1 -1
  336. package/widgets/Legend/styles/Card.js +1 -1
  337. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  338. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  339. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  340. package/widgets/Sketch/SketchViewModel.js +1 -1
  341. package/widgets/Sketch.js +1 -1
  342. package/widgets/TimeSlider.js +1 -1
  343. package/widgets/Weather/WeatherViewModel.js +1 -1
  344. package/widgets/Weather.js +1 -1
  345. package/widgets/Widget.js +1 -1
  346. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  347. package/widgets/support/vnodeCache.js +5 -0
  348. package/widgets/support/widgetUtils.js +1 -1
  349. package/assets/esri/core/workers/chunks/0453fad5cb819797b4f6.js +0 -1
  350. package/assets/esri/core/workers/chunks/0c15d77d8e817cf45a9a.js +0 -1
  351. package/assets/esri/core/workers/chunks/0cd0a6eef51fc5b9ea61.js +0 -1
  352. package/assets/esri/core/workers/chunks/0d684f16f37d5dc385dd.js +0 -1
  353. package/assets/esri/core/workers/chunks/16b6d0f8378582c051c3.js +0 -1
  354. package/assets/esri/core/workers/chunks/1877ab1b6a115dbba1c5.js +0 -1
  355. package/assets/esri/core/workers/chunks/197ec52641aed20029c6.js +0 -1
  356. package/assets/esri/core/workers/chunks/1b2a961f776a0b57e57a.js +0 -1
  357. package/assets/esri/core/workers/chunks/1b3fd66577b19aa5f2b6.js +0 -1
  358. package/assets/esri/core/workers/chunks/1c733b7db092a2a88ef3.js +0 -1
  359. package/assets/esri/core/workers/chunks/2629adf79e7fd9f25f07.js +0 -1
  360. package/assets/esri/core/workers/chunks/27474b007988855bea9d.js +0 -1
  361. package/assets/esri/core/workers/chunks/2b25fc7945a187c2bb9d.js +0 -1
  362. package/assets/esri/core/workers/chunks/34b59d7099904dcb28b5.js +0 -1
  363. package/assets/esri/core/workers/chunks/422537fc3df707bb62c9.js +0 -1
  364. package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +0 -1
  365. package/assets/esri/core/workers/chunks/4ba6de8aa7e2960bad49.js +0 -1
  366. package/assets/esri/core/workers/chunks/4be35af7d6babbfe9d84.js +0 -1
  367. package/assets/esri/core/workers/chunks/5457962a70bd3c557a75.js +0 -1
  368. package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +0 -1
  369. package/assets/esri/core/workers/chunks/57b349d1dbc0bed75b79.js +0 -1
  370. package/assets/esri/core/workers/chunks/5d11b97b667921d67ae7.js +0 -1
  371. package/assets/esri/core/workers/chunks/5dbe555a5a662ff3d9ce.js +0 -1
  372. package/assets/esri/core/workers/chunks/64b7e8d812ea8fcf269e.js +0 -1
  373. package/assets/esri/core/workers/chunks/75d812955a473d0e8960.js +0 -1
  374. package/assets/esri/core/workers/chunks/94515fb3ef38067eeadd.js +0 -1
  375. package/assets/esri/core/workers/chunks/952980635afc7ec81804.js +0 -1
  376. package/assets/esri/core/workers/chunks/96f148a556a2418038de.js +0 -1
  377. package/assets/esri/core/workers/chunks/9876a1bae350795fab36.js +0 -1
  378. package/assets/esri/core/workers/chunks/a1930e4f035bc9aa1ae5.js +0 -1
  379. package/assets/esri/core/workers/chunks/a8692bffb76444c34760.js +0 -1
  380. package/assets/esri/core/workers/chunks/b3f5e91116112b0b612a.js +0 -1
  381. package/assets/esri/core/workers/chunks/ba762bcfd74af0bb8218.js +0 -1
  382. package/assets/esri/core/workers/chunks/be588873c16770ceb9ef.js +0 -1
  383. package/assets/esri/core/workers/chunks/bf6dda4a2af14c4b7716.js +0 -1
  384. package/assets/esri/core/workers/chunks/c2253a9f29c1aabb2b75.js +0 -1
  385. package/assets/esri/core/workers/chunks/c984b3040e120e502b11.js +0 -1
  386. package/assets/esri/core/workers/chunks/cdbc005eebec1503b99d.js +0 -1
  387. package/assets/esri/core/workers/chunks/d04fca5d46cca02500b7.js +0 -1
  388. package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +0 -1
  389. package/assets/esri/core/workers/chunks/d98dab12b71912fa397b.js +0 -1
  390. package/assets/esri/core/workers/chunks/dedc333a61081772ca7b.js +0 -1
  391. package/assets/esri/core/workers/chunks/e218bde41ffbcc5194f5.js +0 -1
  392. package/assets/esri/core/workers/chunks/e287f49184d076af17e2.js +0 -1
  393. package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +0 -1
  394. package/assets/esri/core/workers/chunks/ea595b0df5050eda2a13.js +0 -1
  395. package/assets/esri/core/workers/chunks/eb82ff10cef2bde6e57f.js +0 -1
  396. package/assets/esri/core/workers/chunks/ee6e0db58dc64410e687.js +0 -1
  397. package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +0 -1
  398. package/renderers/AnimatedFlowRenderer.d.ts +0 -4
  399. package/renderers/AnimatedFlowRenderer.js +0 -5
  400. package/views/2d/engine/flow/AnimatedFlowView2D.js +0 -5
  401. package/views/2d/engine/flow/animatedFlowRendererUtils.js +0 -5
  402. package/views/2d/layers/imagery/ImageryGraphicsView2D.js +0 -5
package/views/MapView.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import e from"../Graphic.js";import i from"../Viewpoint.js";import s from"../core/Collection.js";import n from"../core/CollectionFlattener.js";import r from"../core/Error.js";import a from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{isSome as h,unwrap as p,isNone as d}from"../core/maybe.js";import{throwIfAborted as c}from"../core/promiseUtils.js";import{watch as u,whenOnce as m,sync as g,syncAndInitial as y}from"../core/reactiveUtils.js";import{createScreenPoint as w}from"../core/screenUtils.js";import{initialize as f}from"../core/workers/workers.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import V from"../geometry/Extent.js";import T from"../geometry/Point.js";import{load as b,canProjectWithoutEngine as j,project as S,isLoaded as M}from"../geometry/projection.js";import x from"../layers/support/TileInfo.js";import{BreakpointsOwner as O}from"./BreakpointsOwner.js";import{DOMContainer as R}from"./DOMContainer.js";import{PopupView as k}from"./PopupView.js";import L from"./View.js";import z from"./ViewAnimation.js";import E from"./2d/AnimationManager.js";import P from"./2d/FrameTask.js";import{layerView2DImporter as C}from"./2d/layerViewModuleImportUtils.js";import G from"./2d/MapViewConstraints.js";import q from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import N from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as D,setExtent as U,rotateTo as I,scaleTo as A,copy as W,create as F,extentToScale as H,resize as $}from"./2d/viewpointUtils.js";import B from"./2d/input/MapViewInputManager.js";import Q from"./2d/layers/features/support/TileStore.js";import Z from"./2d/support/HighlightOptions.js";import{Timeline as K}from"./2d/support/Timeline.js";import J from"./support/createScreenshotPlan.js";import{getMaximumResolutionScale as X,getFormatAndQuality as Y}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as tt,createScreenPointFromSupportedEvent as et}from"./support/screenUtils.js";import{check as it}from"./support/WebGLRequirements.js";import st from"./ui/2d/DefaultUI2D.js";import nt from"../webmap/background/ColorBackground.js";const rt=l.getLogger("esri.views.MapView");let at,ot,lt,ht,pt,dt;async function ct(){const[,{GraphicsView2D:t,GraphicContainer:e,LabelManager:i,MapViewNavigation:s,MagnifierView2D:n,Stage:r}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);ot=t,lt=e,ht=i,pt=s,dt=n,at=r}const ut=160;function mt(t){return t&&"esri.Viewpoint"===t.declaredClass}let gt=class extends(O(R(k(L)))){constructor(t){super(t),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new n({getCollections:()=>{var t,e;return[null==(t=this.basemapView)?void 0:t.baseLayerViews,this.layerViews,null==(e=this.basemapView)?void 0:e.referenceLayerViews]},getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.rendering=!1,this.supersampleScreenshotsEnabled=!1,this.supportsGround=!1,this._stationaryTimer=null,this.frameTask=new P(this),this._pePromise=null,this.floors=new s,this.highlightOptions=new Z,this.inputManager=new B({view:this}),this.map=null,this.resizeAlign="center",this.spatialReferenceLocked=!0,this.timeline=new K,this.type="2d",this.ui=new st,this.constraints=new G,this.padding={top:0,right:0,bottom:0,left:0},this.handles.add([u((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(ut)}),g),this.on("resize",(t=>this._resizeHandler(t))),u((()=>{var t;return null==(t=this.animationManager)?void 0:t.animation}),(t=>{this.animation=t}))]),f()}destroy(){this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null,this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new Q(this.featuresTilingScheme)}get initialExtentRequired(){var t;const{scale:e,constraints:i,center:s,viewpoint:n,extent:r}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&null!=(t=this.map.initialViewProperties)&&t.viewpoint)&&(!r&&(null!=i&&i.effectiveLODs||(a=-1),(!s||0===e&&-1===a)&&(!n||!h(n.targetGeometry)||"extent"!==n.targetGeometry.type&&!n.scale)))}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get _projectionEngineLoaded(){return!!M()||(this._pePromise||(this._pePromise=b().finally((()=>{this._pePromise=null}))),!1)}get typeSpecificPreconditionsReady(){const t=this._getDefaultViewpoint();if(!t)return!1;const e=this.spatialReference,i=p(t.targetGeometry);return!!j(i.spatialReference,e)||this._projectionEngineLoaded}set animation(t){const e=this._get("animation");if(t===e)return;if(e&&e.stop(),!t||t.isFulfilled())return void this._set("animation",null);this._set("animation",t),this.frameTask.animationInProgress=!0;const i=()=>{t===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};t.when(i,i)}get background(){return this.get("map.initialViewProperties.background")||null}set background(t){void 0===t?this._clearOverride("background"):this._override("background",t)}get center(){if(!this.ready)return this._get("center");const{center:t,spatialReference:e}=this.state.paddedViewState;return new T({x:t[0],y:t[1],spatialReference:e})}set center(t){if(null==t)return;if(!this.ready)return this._set("center",t),void this.notifyChange("initialExtentRequired");let e;try{e=this._project(t,this.spatialReference)}catch(s){rt.error(new r("mapview:invalid-center","could not project the value in the view's spatial reference",{error:s}))}const i=this.viewpoint;D(i,i,e),this.viewpoint=i}set constraints(t){const e=this._get("constraints");e&&(this.handles.remove("map-view-constraints"),e.destroy()),this._set("constraints",t),t&&(t.view=this,this.ready&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint)),this.handles.add(u((()=>t.version),(()=>{this.ready&&this.state&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint))}),g),"map-view-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(t){if(null==t)return;if(!t.width||!t.height)return void rt.error(new r("mapview:invalid-extent","invalid extent size"));if(!this.ready)return this._set("extent",t),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");let e;try{e=this._project(t,this.spatialReference)}catch(s){rt.error(new r("mapview:invalid-extent","could not project the value in the view's spatial reference",{error:s}))}const i=this.viewpoint;U(i,i,e,this.size,{constraints:this.constraints}),this.viewpoint=i}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(t){this.ready?(this.state.padding=t,this._set("padding",this.state.padding)):this._set("padding",t)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(t){if(isNaN(t))return;if(!this.ready)return void this._set("rotation",t);const e=this.viewpoint;I(e,e,t),this.viewpoint=e}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(t){if(!t||isNaN(t))return;if(!this.ready){this._set("scale",t),this._set("zoom",-1);const e=this._get("extent");return e&&(this._set("extent",null),this._set("center",e.center)),void this.notifyChange("initialExtentRequired")}const e=this.viewpoint;A(e,e,t),this.viewpoint=e}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){return!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((t=>!t.destroyed&&!("layerViews"in t)&&!0===t.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const t=this.state.paddedViewState;return t&&t.viewpoint.clone()}set viewpoint(t){if(null==t)return;if(!this.ready)return this._set("viewpoint",t),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");let e,s;try{e=this._project(t,this.spatialReference),!t.scale||isNaN(t.scale)?s=new r("mapview:invalid-viewpoint",`invalid scale value of ${t.scale}`):d(t.targetGeometry)&&(s=new r("mapview:invalid-viewpoint","geometry not defined"))}catch(a){s=new r("mapview:invalid-viewpoint","could not project the value in the view's spatial reference",{error:a})}if(s)return void rt.error(s);const n=new i({targetGeometry:new T,scale:0,rotation:0});W(n,e),this.constraints.constrain(n,this.state.paddedViewState.viewpoint),this.state.viewpoint=n,this.frameTask.requestFrame(),this._set("viewpoint",n)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(t){if(null==t)return;if(!this.ready){this.notifyChange("initialExtentRequired"),this._set("zoom",t),this._set("scale",0);const e=this._get("extent");e&&(this._set("extent",null),this._set("center",e.center))}if(!this.constraints.effectiveLODs)return;const e=this.viewpoint;A(e,e,this.constraints.zoomToScale(t)),this.viewpoint=e,this._set("zoom",this.constraints.scaleToZoom(this.scale))}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(t,e){if(t)return this.animation&&(this.animation=null),this._createAnimation(),m((()=>this.ready),e).then((()=>{const i={animate:!0,...e},s=F(t,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));rt.error("#goTo()","target cannot be null or undefined")}async hitTest(t,e){const i=tt(t)?et(this,t):t;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,n=!1,r=null,a=null;null!=e&&e.include?vt(e.include,ft(this,(t=>s.add(t)),(t=>{r||(r=new Set),r.add(t)}),(t=>s.add(t)),(()=>n=!0))):(n=!0,s=new Set(this.allLayerViews)),null!=e&&e.exclude&&vt(e.exclude,ft(this,(t=>s.delete(t)),(t=>{a||(a=new Set),a.add(t)})));const o=this.allLayerViews.filter((t=>!t.suspended&&s.has(t))).reverse(),l=this.toMap(i);let p=(await Promise.all([n?this.graphicsView.hitTest(l):null,...o.map((t=>t.hitTest(l,i)))])).filter(h).flat();return r&&(p=p.filter((t=>r.has(wt(t))))),a&&(p=p.filter((t=>!a.has(wt(t))))),{screenPoint:i,results:p.map((t=>({mapPoint:l,graphic:t})))}}takeScreenshot(t){t=t||{};const e=this.supersampleScreenshotsEnabled?Math.min(4,X(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;t.layers?(i=[],t.layers.forEach((t=>{const e=this.allLayerViews.find((e=>e.layer.id===t.id));e&&"container"in e&&e.container&&i.push(e.container)}))):i=this._stage.children;const{format:s,quality:n}=Y(t.format,t.quality),r=J(t,e,this.size,this.padding,s,n,i,t.rotation);return this._stage.takeScreenshot(r)}toMap(t){if(!this.ready)return null;const e=tt(t)?et(this,t):t,i=[0,0],[s,n]=this.state.toMap(i,[e.x,e.y]),r=this.spatialReference;return new T({x:s,y:n,spatialReference:r})}toScreen(t){if(!this.ready)return null;const e=this._project(t,this.spatialReference),i=[e.x,e.y];return this.state.toScreen(i,i),w(i[0],i[1])}on(t,e,i,s){const n=this.inputManager&&this.viewEvents.on(t,e,i,s);return n||super.on(t,e)}hasEventListener(t){return super.hasEventListener(t)||this.viewEvents.hasHandler(t)}whenLayerView(t){return super.whenLayerView(t)}graphicChanged(t){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(t)}}whenReady(){return new Promise((t=>{this.ready?t(this):this._resolveWhenReady.push(t)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var t,e,i;return this.map&&"initialViewProperties"in this.map&&(null==(t=this.map)||null==(e=t.initialViewProperties)?void 0:e.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||null}hasLayerViewModule(t){return C.hasLayerViewModule(t)}importLayerView(t){return C.importLayerView(t)}pixelSizeAt(){return this.ready?this.state.resolution:(rt.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(t){return this.hitTest(t).then((e=>({...e,mapPoint:this.toMap(t)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let t=it(this.type);return a("safari")&&a("safari")<9&&(t=new r("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),h(t)?(rt.warn("#validate()",t.message),Promise.reject(t)):ct()}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new z),this.animation}_cancellableGoTo(t,e,i){const s=()=>t===this._gotoTask,n=i.then((()=>{s()&&(this.animation=null)})).catch((t=>{throw s()&&(this.animation=null,e.done||(e.stop(),this.frameTask.animationInProgress=!1)),t})),r=new Promise((t=>t(n)));return e.when().catch((()=>{s()&&r.cancel&&r.cancel()})),r}_gotoImmediate(t,e){const i=this._gotoTask,s=this.animation,n=t.then((t=>{if(c(e),i!==this._gotoTask)throw new r("view:goto-interrupted","Goto was interrupted");this.viewpoint=s.target=t,s.finish()}));return this._cancellableGoTo(i,s,n)}_flipStationary(t){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const t=performance.now()-this._lastStationaryEventTimestamp;t<ut&&(this._stationaryTimer=this._flipStationary(t))}),t)),this._stationaryTimer}_getDefaultViewpoint(){var t,e,s,n;const{constraints:r,initialExtent:a,map:o}=this;if(!r)return null;const l=o&&"initialViewProperties"in o&&o.initialViewProperties,d={zoom:this._get("zoom"),scale:this._get("scale"),center:this._get("center"),extent:this._get("extent"),rotation:this._get("rotation"),viewpoint:this._get("viewpoint"),spatialReference:this._userSpatialReference};r.effectiveLODs?-1!==d.zoom&&(d.scale=r.zoomToScale(d.zoom)):d.zoom=-1;let c=null,u=null,m=0;const g=d.viewpoint&&d.viewpoint.rotation,y=d.viewpoint&&d.viewpoint.targetGeometry;h(y)&&("extent"===y.type?c=y:"point"===y.type&&(u=y,m=d.viewpoint.scale));const w=d.extent||c||(null==(t=p(null==l||null==(e=l.viewpoint)?void 0:e.targetGeometry))?void 0:t.extent)||a,f=d.center||u||(null==w?void 0:w.center),v=d.scale||m||(null==l||null==(s=l.viewpoint)?void 0:s.scale)||w&&H(w,this.size),_=d.rotation||g||(null==l||null==(n=l.viewpoint)?void 0:n.rotation)||0;return f&&v?new i({targetGeometry:f,scale:v,rotation:_}):null}_gotoAnimated(t,e){const i=this._gotoTask,s=this.animation,n=t.then((t=>{if(c(e),i!==this._gotoTask)throw new r("view:goto-interrupted","Goto was interrupted");return s.update(t),this.animationManager.animate(s,this.viewpoint,e),s.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(i,s,n)}_project(t,e){const i=t&&t.targetGeometry||t;return e?i?e.equals(i.spatialReference)?t:mt(t)?(t.targetGeometry=S(i,e),t):S(i,e):null:t}_resizeHandler(t){if(!this.ready)return;const e=this.state;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();e.size=[t.width,t.height],$(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){this.timeline.begin("MapView Startup");const t=this._getDefaultViewpoint();t.targetGeometry=S(t.targetGeometry,this.spatialReference),this.constraints.view=this,this.constraints.fit(t),this._set("animationManager",new E({view:this})),this._set("state",new q({padding:this._get("padding"),size:this.size,viewpoint:t})),this._set("featuresTilingScheme",new N(x.create({spatialReference:this.spatialReference,size:512,numLODs:36}))),this._set("ready",!0),this.frameTask&&this.frameTask.start(),this.graphics.owner=this;const e={disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},i=new at(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:e,renderingOptions:this.renderingOptions,timeline:this.timeline}),s=new ot({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new lt(this.featuresTilingScheme)}),n=new pt({view:this,animationManager:this.animationManager}),r=new ht({view:this});this._magnifierView=new dt,this._magnifierView.magnifier=this.magnifier,this._stage=i,this.frameTask.graphicsView=s,this._set("graphicsView",s),this._set("mapViewNavigation",n),this._set("labelManager",r),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),i.on("post-render",(()=>this._set("rendering",i.renderRequested))),i.on("will-render",(()=>this._set("rendering",i.renderRequested))),i.on("webgl-error",(t=>this.fatalError=t.error)),u((()=>this.stationary),(t=>i.stationary=t),y),u((()=>this.state.id),(()=>i.state=this.state),y),u((()=>this.background),(t=>{i.background=t,this._magnifierView.background=t}),y),u((()=>this.magnifier),(t=>this._magnifierView.magnifier=t),y),u((()=>this.renderingOptions),(t=>i.renderingOptions=t),y),u((()=>this.highlightOptions),(t=>i.highlightOptions=t),y)],"map-view"),i.state=this.state,this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((t=>t(this))),this.timeline.end("MapView Startup")}_teardown(){this.handles.remove("map-view"),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy();this.graphicsView.destroy(),this.mapViewNavigation.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask&&this.frameTask.stop(),this._set("ready",!1),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null);const{center:[t,e],spatialReference:i,rotation:s,scale:n}=this.state.paddedViewState,r=new T({x:t,y:e,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",r),this._set("zoom",-1),this._set("rotation",s),this._set("scale",n),this._set("spatialReference",i),this.constraints.view=null,this.animationManager.destroy(),this._set("animationManager",null),this._set("state",null),this.animation=null}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((t=>{this._stage.addChild(t.container)}));const t=this.graphicsView;this._stage.addChild(t.container),this._stage.addChild(this._magnifierView)}};t([v({readOnly:!0})],gt.prototype,"animationManager",void 0),t([v({constructOnly:!0})],gt.prototype,"deactivatedWebGLExtensions",void 0),t([v({constructOnly:!0})],gt.prototype,"debugWebGLExtensions",void 0),t([v({readOnly:!0})],gt.prototype,"featuresTilingScheme",void 0),t([v({readOnly:!0})],gt.prototype,"fullOpacity",void 0),t([v({readOnly:!0})],gt.prototype,"graphicsTileStore",null),t([v()],gt.prototype,"graphicsView",void 0),t([v({readOnly:!0})],gt.prototype,"state",void 0),t([v()],gt.prototype,"initialExtentRequired",null),t([v()],gt.prototype,"labelManager",void 0),t([v({readOnly:!0})],gt.prototype,"resourceManager",null),t([v({readOnly:!0})],gt.prototype,"textureManager",null),t([v({readOnly:!0})],gt.prototype,"mapViewNavigation",void 0),t([v({constructOnly:!0})],gt.prototype,"renderCanvas",void 0),t([v()],gt.prototype,"renderingOptions",void 0),t([v({readOnly:!0})],gt.prototype,"rendering",void 0),t([v({constructOnly:!0})],gt.prototype,"supersampleScreenshotsEnabled",void 0),t([v({readOnly:!0})],gt.prototype,"supportsGround",void 0),t([v()],gt.prototype,"_stationaryTimer",void 0),t([v()],gt.prototype,"_defaultsFromMapSettings",null),t([v()],gt.prototype,"_pePromise",void 0),t([v({readOnly:!0})],gt.prototype,"typeSpecificPreconditionsReady",null),t([v()],gt.prototype,"animation",null),t([v({type:nt})],gt.prototype,"background",null),t([v({value:null,type:T,dependsOn:["state.id","ready"]})],gt.prototype,"center",null),t([v({type:G})],gt.prototype,"constraints",null),t([v({value:null,type:V,dependsOn:["state.id","ready"]})],gt.prototype,"extent",null),t([v()],gt.prototype,"floors",void 0),t([v({type:Z})],gt.prototype,"highlightOptions",void 0),t([v({readOnly:!0})],gt.prototype,"inputManager",void 0),t([v()],gt.prototype,"map",void 0),t([v({value:{top:0,right:0,bottom:0,left:0},cast:t=>({top:0,right:0,bottom:0,left:0,...t})})],gt.prototype,"padding",null),t([v()],gt.prototype,"resizeAlign",void 0),t([v({readOnly:!0,dependsOn:["state.id"]})],gt.prototype,"resolution",null),t([v({value:0,type:Number,dependsOn:["state.id","ready"]})],gt.prototype,"rotation",null),t([v({value:0,type:Number,dependsOn:["state.id","ready"]})],gt.prototype,"scale",null),t([v({constructOnly:!0})],gt.prototype,"spatialReferenceLocked",void 0),t([v()],gt.prototype,"stationary",null),t([v({type:K,readOnly:!0})],gt.prototype,"timeline",void 0),t([v({readOnly:!0})],gt.prototype,"type",void 0),t([v({readOnly:!0})],gt.prototype,"updating",null),t([v({value:null,type:i,dependsOn:["state.id","ready"]})],gt.prototype,"viewpoint",null),t([v({value:-1,dependsOn:["state.id"]})],gt.prototype,"zoom",null),t([v({type:Boolean})],gt.prototype,"navigating",null),t([v({type:st})],gt.prototype,"ui",void 0),gt=t([_("esri.views.MapView")],gt);const yt=gt;function wt(t){const e=t.getObjectId();var i,s,n,r;return e?`${null!=(i=null!=(s=null==(n=t.layer)?void 0:n.uid)?s:null==(r=t.sourceLayer)?void 0:r.uid)?i:"MapView"}/${e}`:`"MapView/${t.uid}`}function ft(t,i,s,n,r){return a=>{if(a instanceof e){if(a.layer===t)null==r||r();else{const e=t.allLayerViews.find((t=>t.layer===a.layer));e&&(null==n||n(e))}s(wt(a))}else{const e=t.allLayerViews.find((t=>t.layer===a));e&&i(e)}}}function vt(t,e){if(t)if(o(t))for(const i of t)if(o(i))for(const t of i)e(t);else e(i);else e(t)}export{yt as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import i from"../Viewpoint.js";import s from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import n from"../core/Error.js";import a from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{isSome as p,unwrap as h,isNone as d}from"../core/maybe.js";import{throwIfAborted as c}from"../core/promiseUtils.js";import{watch as u,whenOnce as m,sync as g,syncAndInitial as w}from"../core/reactiveUtils.js";import{createScreenPoint as y}from"../core/screenUtils.js";import{initialize as f}from"../core/workers/workers.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import V from"../geometry/Extent.js";import T from"../geometry/Point.js";import{load as S,canProjectWithoutEngine as j,project as b,isLoaded as x}from"../geometry/projection.js";import{equals as M}from"../geometry/support/spatialReferenceUtils.js";import R from"../layers/support/TileInfo.js";import{BreakpointsOwner as O}from"./BreakpointsOwner.js";import{DOMContainer as k}from"./DOMContainer.js";import{PopupView as L}from"./PopupView.js";import z from"./View.js";import P from"./ViewAnimation.js";import E from"./2d/AnimationManager.js";import C from"./2d/FrameTask.js";import{layerView2DImporter as G}from"./2d/layerViewModuleImportUtils.js";import D from"./2d/MapViewConstraints.js";import q from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import N from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as U,setExtent as A,rotateTo as I,scaleTo as F,copy as W,create as H,extentToScale as $,resize as B}from"./2d/viewpointUtils.js";import Q from"./2d/input/MapViewInputManager.js";import Z from"./2d/layers/features/support/TileStore.js";import J from"./2d/support/HighlightOptions.js";import{Timeline as K}from"./2d/support/Timeline.js";import X from"./support/createScreenshotPlan.js";import{getMaximumResolutionScale as Y,getFormatAndQuality as ee}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as te,createScreenPointFromSupportedEvent as ie}from"./support/screenUtils.js";import{check as se}from"./support/WebGLRequirements.js";import re from"./ui/2d/DefaultUI2D.js";import ne from"../webmap/background/ColorBackground.js";const ae=l.getLogger("esri.views.MapView");let oe,le,pe,he,de,ce;async function ue(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:s,MagnifierView2D:r,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);le=e,pe=t,he=i,de=s,ce=r,oe=n}const me=160;function ge(e){return e&&"esri.Viewpoint"===e.declaredClass}let we=class extends(O(k(L(z)))){constructor(e){super(e),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>{var e,t;return[null==(e=this.basemapView)?void 0:e.baseLayerViews,this.layerViews,null==(t=this.basemapView)?void 0:t.referenceLayerViews]},getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.rendering=!1,this.supersampleScreenshotsEnabled=!1,this.supportsGround=!1,this._stationaryTimer=null,this.frameTask=new C(this),this._pePromise=null,this.floors=new s,this.highlightOptions=new J,this.inputManager=new Q({view:this}),this.map=null,this.resizeAlign="center",this.spatialReferenceLocked=!1,this.timeline=new K,this.type="2d",this.ui=new re,this.constraints=new D,this.padding={top:0,right:0,bottom:0,left:0},this.handles.add([u((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(me)}),g),this.on("resize",(e=>this._resizeHandler(e))),u((()=>{var e;return null==(e=this.animationManager)?void 0:e.animation}),(e=>{this.animation=e}))]),f()}destroy(){this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null,this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new Z(this.featuresTilingScheme)}get initialExtentRequired(){var e;const{scale:t,constraints:i,center:s,viewpoint:r,extent:n}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&null!=(e=this.map.initialViewProperties)&&e.viewpoint)&&(!n&&(null!=i&&i.effectiveLODs||(a=-1),(!s||0===t&&-1===a)&&(!r||!p(r.targetGeometry)||"extent"!==r.targetGeometry.type&&!r.scale)))}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get _projectionEngineLoaded(){return!!x()||(this._pePromise||(this._pePromise=S().finally((()=>{this._pePromise=null}))),!1)}get typeSpecificPreconditionsReady(){if(this._get("ready"))return!0;const e=this._getDefaultViewpoint();if(!e)return!1;const t=this.spatialReference,i=h(e.targetGeometry);return!!j(i.spatialReference,t)||this._projectionEngineLoaded}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),!e||e.isFulfilled())return void this._set("animation",null);this._set("animation",e),this.frameTask.animationInProgress=!0;const i=()=>{e===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};e.when(i,i)}get background(){return this.get("map.initialViewProperties.background")||null}set background(e){void 0===e?this._clearOverride("background"):this._override("background",e)}get center(){if(!this.ready)return this._get("center");const{center:e,spatialReference:t}=this.state.paddedViewState;return new T({x:e[0],y:e[1],spatialReference:t})}set center(e){if(null==e)return;if(!this.ready)return this._set("center",e),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){return void ae.error(new n("mapview:invalid-center","could not project the value in the view's spatial reference",{input:e,error:s}))}const i=this.viewpoint;U(i,i,t),this.viewpoint=i}set constraints(e){const t=this._get("constraints");t&&(this.handles.remove("map-view-constraints"),t.destroy()),this._set("constraints",e),e&&(e.view=this,this.ready&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint)),this.handles.add(u((()=>e.version),(()=>{this.ready&&this.state&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint))}),g),"map-view-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(e){if(null==e)return;if(!e.width||!e.height)return void ae.error(new n("mapview:invalid-extent","invalid extent size"));if(!this.ready)return this._set("extent",e),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){ae.error(new n("mapview:invalid-extent","could not project the value in the view's spatial reference",{error:s}))}const i=this.viewpoint;A(i,i,t,this.size,{constraints:this.constraints}),this.viewpoint=i}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(e){this.ready?(this.state.padding=e,this._set("padding",this.state.padding)):this._set("padding",e)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(e){if(isNaN(e))return;if(!this.ready)return void this._set("rotation",e);const t=this.viewpoint;I(t,t,e),this.viewpoint=t}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(e){if(!e||isNaN(e))return;if(!this.ready){this._set("scale",e),this._set("zoom",-1);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}const t=this.viewpoint;F(t,t,e),this.viewpoint=t}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){return!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const e=this.state.paddedViewState;return e&&e.viewpoint.clone()}set viewpoint(e){if(null==e)return;if(!this.ready)return this._set("viewpoint",e),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");let t,s;try{t=this._project(e,this.spatialReference),!e.scale||isNaN(e.scale)?s=new n("mapview:invalid-viewpoint",`invalid scale value of ${e.scale}`):d(e.targetGeometry)&&(s=new n("mapview:invalid-viewpoint","geometry not defined"))}catch(a){s=new n("mapview:invalid-viewpoint","could not project the value in the view's spatial reference",{error:a})}if(s)return void ae.error(s);const r=new i({targetGeometry:new T,scale:0,rotation:0});W(r,t),this.constraints.constrain(r,this.state.paddedViewState.viewpoint),this.state.viewpoint=r,this.frameTask.requestFrame(),this._set("viewpoint",r)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(e){if(null==e)return;if(!this.ready){this._set("zoom",e),this._set("scale",0);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}if(!this.constraints.effectiveLODs)return void this._set("zoom",-1);const t=this.viewpoint;F(t,t,this.constraints.zoomToScale(e)),this.viewpoint=t,this._set("zoom",this.constraints.scaleToZoom(this.scale))}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(e,t){if(e)return this.animation&&(this.animation=null),this._createAnimation(),m((()=>this.ready),t).then((()=>{const i={animate:!0,...t},s=H(e,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));ae.error("#goTo()","target cannot be null or undefined")}async hitTest(e,t){const i=te(e)?ie(this,e):e;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,r=!1,n=null,a=null;null!=t&&t.include?_e(t.include,ve(this,(e=>s.add(e)),(e=>{n||(n=new Set),n.add(e)}),(e=>s.add(e)),(()=>r=!0))):(r=!0,s=new Set(this.allLayerViews)),null!=t&&t.exclude&&_e(t.exclude,ve(this,(e=>s.delete(e)),(e=>{a||(a=new Set),a.add(e)})));const o=this.allLayerViews.filter((e=>!e.suspended&&s.has(e))).reverse(),l=this.toMap(i);let h=(await Promise.all([r?this.graphicsView.hitTest(l):null,...o.map((e=>e.hitTest(l,i)))])).filter(p).flat();return n&&(h=h.filter((e=>n.has(fe(e))))),a&&(h=h.filter((e=>!a.has(fe(e))))),{screenPoint:i,results:h.map((e=>({mapPoint:l,graphic:e})))}}takeScreenshot(e){e=e||{};const t=this.supersampleScreenshotsEnabled?Math.min(4,Y(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;e.layers?(i=[],e.layers.forEach((e=>{const t=this.allLayerViews.find((t=>t.layer.id===e.id));t&&"container"in t&&t.container&&i.push(t.container)}))):i=this._stage.children;const{format:s,quality:r}=ee(e.format,e.quality),n=X(e,t,this.size,this.padding,s,r,i,e.rotation);return this._stage.takeScreenshot(n)}toMap(e){if(!this.ready)return null;const t=te(e)?ie(this,e):e,i=[0,0],[s,r]=this.state.toMap(i,[t.x,t.y]),n=this.spatialReference;return new T({x:s,y:r,spatialReference:n})}toScreen(e){if(!this.ready)return null;const t=this._project(e,this.spatialReference),i=[t.x,t.y];return this.state.toScreen(i,i),y(i[0],i[1])}on(e,t,i,s){const r=this.inputManager&&this.viewEvents.on(e,t,i,s);return r||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var e,t,i;return this.map&&"initialViewProperties"in this.map&&(null==(e=this.map)||null==(t=e.initialViewProperties)?void 0:t.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||null}hasLayerViewModule(e){return G.hasLayerViewModule(e)}importLayerView(e){return G.importLayerView(e)}pixelSizeAt(){return this.ready?this.state.resolution:(ae.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(e){return this.hitTest(e).then((t=>({...t,mapPoint:this.toMap(e)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let e=se(this.type);return a("safari")&&a("safari")<9&&(e=new n("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),p(e)?(ae.warn("#validate()",e.message),Promise.reject(e)):ue()}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new P),this.animation}_cancellableGoTo(e,t,i){const s=()=>e===this._gotoTask,r=i.then((()=>{s()&&(this.animation=null)})).catch((e=>{throw s()&&(this.animation=null,t.done||(t.stop(),this.frameTask.animationInProgress=!1)),e})),n=new Promise((e=>e(r)));return t.when().catch((()=>{s()&&n.cancel&&n.cancel()})),n}_gotoImmediate(e,t){const i=this._gotoTask,s=this.animation,r=e.then((e=>{if(c(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");this.viewpoint=s.target=e,s.finish()}));return this._cancellableGoTo(i,s,r)}_flipStationary(e){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const e=performance.now()-this._lastStationaryEventTimestamp;e<me&&(this._stationaryTimer=this._flipStationary(e))}),e)),this._stationaryTimer}_getDefaultViewpoint(){var e,t,s,r;const{constraints:n,initialExtent:a,map:o}=this;if(!n)return null;const l=o&&"initialViewProperties"in o&&o.initialViewProperties,d={zoom:this._get("zoom"),scale:this._get("scale"),center:this._get("center"),extent:this._get("extent"),rotation:this._get("rotation"),viewpoint:this._get("viewpoint"),spatialReference:this._userSpatialReference};n.effectiveLODs?-1!==d.zoom&&(d.scale=n.zoomToScale(d.zoom)):d.zoom=-1;let c=null,u=null,m=0;const g=d.viewpoint&&d.viewpoint.rotation,w=d.viewpoint&&d.viewpoint.targetGeometry;p(w)&&("extent"===w.type?c=w:"point"===w.type&&(u=w,m=d.viewpoint.scale));const y=d.extent||c||(null==(e=h(null==l||null==(t=l.viewpoint)?void 0:t.targetGeometry))?void 0:e.extent)||a,f=d.center||u||(null==y?void 0:y.center),v=d.scale||m||(null==l||null==(s=l.viewpoint)?void 0:s.scale)||y&&$(y,this.size),_=d.rotation||g||(null==l||null==(r=l.viewpoint)?void 0:r.rotation)||0;return f&&v?new i({targetGeometry:f,scale:v,rotation:_}):null}_gotoAnimated(e,t){const i=this._gotoTask,s=this.animation,r=e.then((e=>{if(c(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");return s.update(e),this.animationManager.animate(s,this.viewpoint,t),s.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(i,s,r)}_project(e,t){const i=e&&e.targetGeometry||e;if(!t)return e;if(!i)return null;if(M(t,i.spatialReference))return e;const s=b(i,t);if(!s)throw new n("mapview:projection-not-possible","projecting input geometry to target spatial reference returned a null value",{geometry:i,spatialReference:t});return ge(e)?(e.targetGeometry=s,e):s}_resizeHandler(e){if(!this.ready)return;const t=this.state;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();t.size=[e.width,e.height],B(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){var e;this.timeline.begin("MapView Startup");const t=this._getDefaultViewpoint();t.targetGeometry=b(t.targetGeometry,this.spatialReference),null==(e=this.constraints)||e.fit(t),this._set("state",new q({padding:this._get("padding"),size:this.size,viewpoint:t})),this.graphics.owner=this;const i=new oe(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this._stage=i,this._magnifierView=new ce,this._magnifierView.magnifier=this.magnifier;const s=new he({view:this});this._set("labelManager",s);const r=new E({view:this});this._set("animationManager",r);const n=new de({view:this,animationManager:r});this._set("mapViewNavigation",n),this._setupSpatialReferenceDependentProperties(),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),i.on("post-render",(()=>this._set("rendering",i.renderRequested))),i.on("will-render",(()=>this._set("rendering",i.renderRequested))),i.on("webgl-error",(e=>this.fatalError=e.error)),u((()=>this.stationary),(e=>i.stationary=e),w),u((()=>this.background),(e=>{i.background=e,this._magnifierView.background=e}),w),u((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),w),u((()=>this.renderingOptions),(e=>i.renderingOptions=e),w),u((()=>this.highlightOptions),(e=>i.highlightOptions=e),w),u((()=>this.state.id),(()=>i.state=this.state),w)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask&&this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.handles.remove("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask&&this.frameTask.stop(),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null),this._set("ready",!1);const{center:[e,t],spatialReference:i,rotation:s,scale:r}=this.state.paddedViewState,n=new T({x:e,y:t,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",n),this._set("zoom",-1),this._set("rotation",s),this._set("scale",r),this._set("spatialReference",i),this._set("state",null),this.animation=null}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this._stage.addChild(e.container)}));const e=this.graphicsView;this._stage.addChild(e.container),this._stage.addChild(this._magnifierView)}_setupSpatialReferenceDependentProperties(){const e=new N(R.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new le({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new pe(e)});this.frameTask.graphicsView=t,this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),this.frameTask.graphicsView=null,e.destroy(),this._set("featuresTilingScheme",null)}_spatialReferenceChanged(e){if(!this.ready)return;this.frameTask.stop();for(const i of this.allLayerViews)i.processDetach();this._destroySpatialReferenceDependentProperties();let t=null;try{t=this._project(this.center,e)}catch(r){x()||ae.warn(new n("mapview:spatial-reference-change","could not project the view's center to the new spatial reference",{center:this.center.toJSON(),spatialReference:e,error:r}))}t||(t=new T({x:0,y:0,spatialReference:e}));const s=U(new i({targetGeometry:new T,scale:0,rotation:0}),this.viewpoint,t);this._get("constraints").constrain(s,null),this._get("state").viewpoint=s,this._setupSpatialReferenceDependentProperties();for(const i of this.allLayerViews)i.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}};e([v({readOnly:!0})],we.prototype,"animationManager",void 0),e([v({constructOnly:!0})],we.prototype,"deactivatedWebGLExtensions",void 0),e([v({constructOnly:!0})],we.prototype,"debugWebGLExtensions",void 0),e([v({readOnly:!0})],we.prototype,"featuresTilingScheme",void 0),e([v({readOnly:!0})],we.prototype,"fullOpacity",void 0),e([v({readOnly:!0})],we.prototype,"graphicsTileStore",null),e([v()],we.prototype,"graphicsView",void 0),e([v({readOnly:!0})],we.prototype,"state",void 0),e([v()],we.prototype,"initialExtentRequired",null),e([v()],we.prototype,"labelManager",void 0),e([v({readOnly:!0})],we.prototype,"resourceManager",null),e([v({readOnly:!0})],we.prototype,"textureManager",null),e([v({readOnly:!0})],we.prototype,"mapViewNavigation",void 0),e([v({constructOnly:!0})],we.prototype,"renderCanvas",void 0),e([v()],we.prototype,"renderingOptions",void 0),e([v({readOnly:!0})],we.prototype,"rendering",void 0),e([v({constructOnly:!0})],we.prototype,"supersampleScreenshotsEnabled",void 0),e([v({readOnly:!0})],we.prototype,"supportsGround",void 0),e([v()],we.prototype,"_stationaryTimer",void 0),e([v()],we.prototype,"_defaultsFromMapSettings",null),e([v()],we.prototype,"_pePromise",void 0),e([v({readOnly:!0})],we.prototype,"typeSpecificPreconditionsReady",null),e([v()],we.prototype,"animation",null),e([v({type:ne})],we.prototype,"background",null),e([v({value:null,type:T,dependsOn:["state.id","ready"]})],we.prototype,"center",null),e([v({type:D})],we.prototype,"constraints",null),e([v({value:null,type:V,dependsOn:["state.id","ready"]})],we.prototype,"extent",null),e([v()],we.prototype,"floors",void 0),e([v({type:J})],we.prototype,"highlightOptions",void 0),e([v({readOnly:!0})],we.prototype,"inputManager",void 0),e([v()],we.prototype,"map",void 0),e([v({value:{top:0,right:0,bottom:0,left:0},cast:e=>({top:0,right:0,bottom:0,left:0,...e})})],we.prototype,"padding",null),e([v()],we.prototype,"resizeAlign",void 0),e([v({readOnly:!0,dependsOn:["state.id"]})],we.prototype,"resolution",null),e([v({value:0,type:Number,dependsOn:["state.id","ready"]})],we.prototype,"rotation",null),e([v({value:0,type:Number,dependsOn:["state.id","ready"]})],we.prototype,"scale",null),e([v({constructOnly:!0})],we.prototype,"spatialReferenceLocked",void 0),e([v()],we.prototype,"stationary",null),e([v({type:K,readOnly:!0})],we.prototype,"timeline",void 0),e([v({readOnly:!0})],we.prototype,"type",void 0),e([v({readOnly:!0})],we.prototype,"updating",null),e([v({value:null,type:i,dependsOn:["state.id","ready"]})],we.prototype,"viewpoint",null),e([v({value:-1,dependsOn:["state.id"]})],we.prototype,"zoom",null),e([v({type:Boolean})],we.prototype,"navigating",null),e([v({type:re})],we.prototype,"ui",void 0),we=e([_("esri.views.MapView")],we);const ye=we;function fe(e){const t=e.getObjectId();var i,s,r,n;return t?`${null!=(i=null!=(s=null==(r=e.layer)?void 0:r.uid)?s:null==(n=e.sourceLayer)?void 0:n.uid)?i:"MapView"}/${t}`:`"MapView/${e.uid}`}function ve(e,i,s,r,n){return a=>{if(a instanceof t){if(a.layer===e)null==n||n();else{const t=e.allLayerViews.find((e=>e.layer===a.layer));t&&(null==r||r(t))}s(fe(a))}else{const t=e.allLayerViews.find((e=>e.layer===a));t&&i(t)}}}function _e(e,t){if(e)if(o(e))for(const i of e)if(o(i))for(const e of i)t(e);else t(i);else t(e)}export{ye as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import o from"../core/Accessor.js";import e from"../core/Collection.js";import{HandleOwner as i}from"../core/HandleOwner.js";import{makeHandle as r}from"../core/handleUtils.js";import s from"../core/Logger.js";import{isSome as a,isNone as l,destroyMaybe as n}from"../core/maybe.js";import{watch as h}from"../core/watchUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{TextureCollection as u}from"./3d/support/TextureCollection.js";import{ViewEventPriorities as v}from"./input/InputManager.js";import{eventTypes as d}from"./input/ViewEvents.js";import{getToolCollectionHandles as m,areToolManipulatorsEditable as f}from"./interactive/interactiveToolUtils.js";import{EditableFlag as T}from"./interactive/interfaces.js";import _ from"./interactive/ToolViewManagerManipulatorState.js";const E=s.getLogger("esri.views.ToolViewManager"),w="attached",g="tools";let y=class extends i{constructor(t){super(t),this._manipulatorState=new _,this.tools=new e,this.cursor=null,this._forEachTool=t=>{for(const o of this.tools.items)if(t(o))return}}initialize(){this.handles.add([this.view.on(d,(t=>{this._handleInputEvent(t)}),v.TOOL),...m(this.tools),this.tools.on("before-remove",(({item:t})=>{this._manipulatorState.clearPointers(t,this._forEachTool)})),this.tools.on("change",(()=>{this._refreshToolWatchers()}))])}destroy(){this.detach(),this.handles.removeAll()}set activeTool(t){if(a(t)&&!this.view.ready)return void E.error("Cannot set active tool while view is not ready.");if(t===this.activeTool)return void(a(t)&&E.warn("Tool is already active - ignoring activation request."));a(this.activeTool)&&this.activeTool.deactivate(),a(t)&&t.activate(),this._set("activeTool",t),this._removeIncompleteTools(t);const o=l(this.activeTool);for(const e of this.tools){e.setEditableFlag(T.MANAGER,o||e===this.activeTool);const t=f(e);!o&&t||this._manipulatorState.clearPointers(e,this._forEachTool,!t)}this._updateCursor()}get updating(){return this.updatingHandles.updating||this.tools.some((t=>t.updating))}attach(){"3d"===this.view.type?(this._set("textures",new u(this.view._stage,this.view.resourceController.scheduler)),this.handles.add([this.view.state.watch("camera",(()=>{this._forEachManipulator((t=>{null!=t.onViewChange&&t.onViewChange()}))})),this.view.elevationProvider.on("elevation-change",(t=>{this._forEachManipulator((o=>{null!=o.onElevationChange&&o.onElevationChange(t)}))})),r((()=>this._set("textures",n(this.textures))))],w)):this.handles.add(this.view.watch("extent",(()=>{this._forEachManipulator((t=>{null!=t.onViewChange&&t.onViewChange()}))})))}detach(){a(this.activeTool)&&(this.activeTool=null),this.tools.removeAll(),this.handles.remove(w)}_forEachManipulator(t){this._forEachTool((o=>{o.manipulators&&o.manipulators.forEach((({manipulator:e})=>t(e,o)))}))}_handleInputEvent(t){let o=!1;const e={...t,stopPropagation:()=>{o=!0,t.stopPropagation()}};a(this.activeTool)?this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(e):this._forEachTool((t=>{!o&&t.visible&&t.handleInputEvent(e)})),!o&&"key-down"===t.type&&"Escape"===t.key&&this.activeTool&&(t.stopPropagation(),this.activeTool=null),this._manipulatorState.handleInputEvent(e,{forEachTool:this._forEachTool,activeTool:this.activeTool,setActiveTool:t=>{this.activeTool=t},view:this.view}),!o&&a(this.activeTool)&&this.activeTool.handleInputEventAfter(e),this._manipulatorState.handleHoverEvent(e,this._forEachTool),this._updateCursor()}_refreshToolWatchers(){this.handles.remove(g),this._forEachTool((t=>{if(t instanceof o){const o=h(t,["cursor","visible","editable"],(()=>{f(t)||this._manipulatorState.clearPointers(t,this._forEachTool),this._updateCursor()}));this.handles.add(o,g)}t.manipulators&&this.handles.add(t.manipulators.on("change",(o=>{o.removed.forEach((({id:o})=>{this._manipulatorState.clearPointers(t,this._forEachTool,!0,o)})),this._manipulatorState.updateHoveredStateFromKnownPointers(this._forEachTool),this._updateCursor()})),g)})),this._manipulatorState.updateHoveredStateFromKnownPointers(this._forEachTool),this._updateCursor()}_updateCursor(){let t=this._manipulatorState.cursor;this._forEachTool((o=>!(!a(o.cursor)||!o.visible)&&(t=o.cursor,!0))),this._get("cursor")!==t&&this._set("cursor",t)}_removeIncompleteTools(t){this.tools.filter((o=>(l(t)||o!==t)&&!o.created)).forEach((t=>{this.tools.remove(t)}))}};t([c({constructOnly:!0,nonNullable:!0})],y.prototype,"view",void 0),t([c({readOnly:!0,nonNullable:!0})],y.prototype,"textures",void 0),t([c({value:null})],y.prototype,"activeTool",null),t([c({readOnly:!0,type:e})],y.prototype,"tools",void 0),t([c({readOnly:!0})],y.prototype,"cursor",void 0),t([c({readOnly:!0})],y.prototype,"updating",null),y=t([p("esri.views.ToolViewManager")],y);const j=y;export{j as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import o from"../core/Accessor.js";import e from"../core/Collection.js";import{HandleOwner as i}from"../core/HandleOwner.js";import{makeHandle as r}from"../core/handleUtils.js";import s from"../core/Logger.js";import{isSome as a,isNone as l,destroyMaybe as n}from"../core/maybe.js";import{watch as h}from"../core/watchUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{TextureCollection as u}from"./3d/support/TextureCollection.js";import{ViewEventPriorities as v}from"./input/InputManager.js";import{eventTypes as d}from"./input/ViewEvents.js";import{getToolCollectionHandles as m,areToolManipulatorsEditable as f}from"./interactive/interactiveToolUtils.js";import{EditableFlag as T}from"./interactive/interfaces.js";import _ from"./interactive/ToolViewManagerManipulatorState.js";const E=s.getLogger("esri.views.ToolViewManager"),w="attached",g="tools";let y=class extends i{constructor(t){super(t),this._manipulatorState=new _,this.tools=new e,this.cursor=null,this._forEachTool=t=>{for(const o of this.tools.items)if(t(o))return}}initialize(){this.handles.add([this.view.on(d,(t=>{this._handleInputEvent(t)}),v.TOOL),...m(this.tools),this.tools.on("before-remove",(({item:t})=>{this._manipulatorState.clearPointers(t,this._forEachTool)})),this.tools.on("change",(()=>{this._refreshToolWatchers()}))])}destroy(){this.detach(),this.handles.removeAll()}set activeTool(t){if(a(t)&&!this.view.ready)return void E.error("Cannot set active tool while view is not ready.");if(t===this.activeTool)return void(a(t)&&E.warn("Tool is already active - ignoring activation request."));const o=this.activeTool;this._set("activeTool",t),a(o)&&o.deactivate(),a(t)&&t.activate(),this._removeIncompleteTools(t);const e=l(this.activeTool);for(const i of this.tools){i.setEditableFlag(T.MANAGER,e||i===this.activeTool);const t=f(i);!e&&t||this._manipulatorState.clearPointers(i,this._forEachTool,!t)}this._updateCursor()}get updating(){return this.updatingHandles.updating||this.tools.some((t=>t.updating))}attach(){"3d"===this.view.type?(this._set("textures",new u(this.view._stage,this.view.resourceController.scheduler)),this.handles.add([this.view.state.watch("camera",(()=>{this._forEachManipulator((t=>{null!=t.onViewChange&&t.onViewChange()}))})),this.view.elevationProvider.on("elevation-change",(t=>{this._forEachManipulator((o=>{null!=o.onElevationChange&&o.onElevationChange(t)}))})),r((()=>this._set("textures",n(this.textures))))],w)):this.handles.add(this.view.watch("extent",(()=>{this._forEachManipulator((t=>{null!=t.onViewChange&&t.onViewChange()}))})))}detach(){a(this.activeTool)&&(this.activeTool=null),this.tools.removeAll(),this.handles.remove(w)}_forEachManipulator(t){this._forEachTool((o=>{o.manipulators&&o.manipulators.forEach((({manipulator:e})=>t(e,o)))}))}_handleInputEvent(t){let o=!1;const e={...t,stopPropagation:()=>{o=!0,t.stopPropagation()}};a(this.activeTool)?this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(e):this._forEachTool((t=>{!o&&t.visible&&t.handleInputEvent(e)})),!o&&"key-down"===t.type&&"Escape"===t.key&&this.activeTool&&(t.stopPropagation(),this.activeTool=null),this._manipulatorState.handleInputEvent(e,{forEachTool:this._forEachTool,activeTool:this.activeTool,setActiveTool:t=>{this.activeTool=t},view:this.view}),!o&&a(this.activeTool)&&this.activeTool.handleInputEventAfter(e),this._manipulatorState.handleHoverEvent(e,this._forEachTool),this._updateCursor()}_refreshToolWatchers(){this.handles.remove(g),this._forEachTool((t=>{if(t instanceof o){const o=h(t,["cursor","visible","editable"],(()=>{f(t)||this._manipulatorState.clearPointers(t,this._forEachTool),this._updateCursor()}));this.handles.add(o,g)}t.manipulators&&this.handles.add(t.manipulators.on("change",(o=>{o.removed.forEach((({id:o})=>{this._manipulatorState.clearPointers(t,this._forEachTool,!0,o)})),this._manipulatorState.updateHoveredStateFromKnownPointers(this._forEachTool),this._updateCursor()})),g)})),this._manipulatorState.updateHoveredStateFromKnownPointers(this._forEachTool),this._updateCursor()}_updateCursor(){let t=this._manipulatorState.cursor;this._forEachTool((o=>!(!a(o.cursor)||!o.visible)&&(t=o.cursor,!0))),this._get("cursor")!==t&&this._set("cursor",t)}_removeIncompleteTools(t){this.tools.filter((o=>(l(t)||o!==t)&&!o.created)).forEach((t=>{this.tools.remove(t)}))}};t([c({constructOnly:!0,nonNullable:!0})],y.prototype,"view",void 0),t([c({readOnly:!0,nonNullable:!0})],y.prototype,"textures",void 0),t([c({value:null})],y.prototype,"activeTool",null),t([c({readOnly:!0,type:e})],y.prototype,"tools",void 0),t([c({readOnly:!0})],y.prototype,"cursor",void 0),t([c({readOnly:!0})],y.prototype,"updating",null),y=t([p("esri.views.ToolViewManager")],y);const j=y;export{j as default};
package/views/View.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../TimeExtent.js";import r from"../core/Accessor.js";import a from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import o from"../core/Error.js";import n from"../core/Evented.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import{makeHandle as p}from"../core/handleUtils.js";import d from"../core/Loadable.js";import h from"../core/Logger.js";import{isSome as y,destroyMaybe as u,abortMaybe as c}from"../core/maybe.js";import{EsriPromiseMixin as m}from"../core/Promise.js";import{createTask as f,after as g}from"../core/promiseUtils.js";import{watch as w}from"../core/reactiveUtils.js";import{whenOnce as v,whenFalseOnce as M}from"../core/watchUtils.js";import{aliasOf as V}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as S}from"../core/support/OwningCollection.js";import j from"../geometry/Extent.js";import F from"../geometry/HeightModelInfo.js";import O from"../geometry/SpatialReference.js";import{AnalysesCollection as L}from"../support/AnalysesCollection.js";import{GraphicsCollection as E}from"../support/GraphicsCollection.js";import{BasemapView as b}from"./BasemapView.js";import C from"./LayerViewManager.js";import x from"./Magnifier.js";import I from"./ToolViewManager.js";import q from"./input/Input.js";import{ViewEvents as D}from"./input/ViewEvents.js";import T from"./navigation/Navigation.js";import k from"./support/DefaultsFromMap.js";var z;const P=h.getLogger("esri.views.View");let U=z=class extends(l(n.EventedMixin(m(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new s({getCollections:()=>{var e,t,i;return[null==(e=this.basemapView)?void 0:e.baseLayerViews,null==(t=this.groundView)?void 0:t.layerViews,this.layerViews,null==(i=this.basemapView)?void 0:i.referenceLayerViews]},getChildrenFunction:e=>e.layerViews}),this.groundView=null,this.animation=null,this.basemapView=null,this.fatalError=null,this.extent=null,this.graphics=new E,this.analyses=new L,this.navigating=!1,this.typeSpecificPreconditionsReady=!0,this.layerViews=new a,this.magnifier=new x,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new q,this.navigation=new T,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new D(this),this.persistableViewModels=new a,this._isValid=!1,this._readyCycleForced=!1,this.handles.add(this.watch("preconditionsReady",(e=>{var t,i;(e?(this._currentSpatialReference=this.spatialReference,z.views.add(this)):(this._currentSpatialReference=null,z.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready)?(null==(t=this.layerViewManager)||t.clear(),null==(i=this.toolViewManager)||i.detach(),y(this.analysisViewManager)&&this.analysisViewManager.detach(),this._teardown()):e&&!this.ready&&(y(this.analysisViewManager)&&this.analysisViewManager.attach(),this._startup(),this.toolViewManager.attach())}),!0))}initialize(){this.addResolvingPromise(this.validate().then((()=>(this._isValid=!0,v(this,"ready"))))),this.basemapView=new b({view:this}),this.layerViewManager=new C({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new I({view:this}),this._setupSpatialReferenceLogger(),this.handles.add([w((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),{sync:!0,initial:!0}),w((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),{sync:!0}),w((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let e=null;this.handles.add([w((()=>{var e;return null==(e=this.defaultsFromMap)?void 0:e.ready}),(t=>{var i;const r=(null==(i=this.map)?void 0:i.allLayers.length)>0;if(t&&!this.spatialReference&&r){if(y(e))return;const t=p((()=>e=c(e)));e=f((async t=>{try{await g(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}P.warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),this.handles.add(t,"spatial-reference-logger-task")}else this.handles.remove("spatial-reference-logger-task")}),{sync:!0})])}destroy(){if(this.destroyed)return;this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=u(this.graphics),this.analyses=u(this.analyses),this.handles.remove("defaultsFromMap"),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.toolViewManager=u(this.toolViewManager),this.layerViewManager=u(this.layerViewManager),this.basemapView=u(this.basemapView),this.invalidate(),this._emitter.clear(),this.handles.removeAll();const e=this.map;this.map=null,null==e||e.destroy()}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return P.error("#toMap()","Not implemented on this instance of View"),null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new k({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:e=>this.getSpatialReferenceSupport(e),...this._defaultsFromMapSettings})}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get preconditionsReady(){var e;return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||d.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!(this._currentSpatialReference||null!=(e=this.defaultsFromMap)&&e.ready)||!this.typeSpecificPreconditionsReady)}set map(e){var t;e!==this._get("map")&&(null!=(t=e)&&t.destroyed&&(P.warn("#map","The provided map is already destroyed",{map:e}),e=null),d.isLoadable(e)&&e.load().catch((()=>{})),this.initialized&&(this.forceReadyCycle(),this._currentSpatialReference=null),this._set("map",e))}get spatialReference(){var e,t;let i=this._userSpatialReference||this._currentSpatialReference||this.getDefaultSpatialReference()||null;return i&&null!=(e=this.defaultsFromMap)&&null!=(t=e.required)&&t.heightModelInfo&&(i=i.clone(),i.vcsWkid=this.defaultsFromMap.vcsWkid,i.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),i}set spatialReference(e){this._userSpatialReference=e,this._set("spatialReference",e)}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get initialExtent(){var e;return null==(e=this.defaultsFromMap)?void 0:e.extent}get cursor(){const e=this.toolViewManager?this.toolViewManager.cursor:null;return y(e)?e:this._cursor||"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}whenLayerView(e){return this.layerViewManager.whenLayerView(e)}getDefaultSpatialReference(){var e;return null==(e=this.defaultsFromMap)?void 0:e.spatialReference}getDefaultHeightModelInfo(){var e,t,i;return null!=(e=null!=(t=this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)?t:null==(i=this.defaultsFromMap)?void 0:i.heightModelInfo)?e:null}importLayerView(e){throw new o("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{}}_validateSpatialReference(e){return y(this.getSpatialReferenceSupport({spatialReference:e}))}when(e,t){return this.isResolved()&&!this.ready&&P.warn("#when()",'Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use watchUtils.whenOnce(view, "ready").then(...) instead.'),super.when(e,t)}forceReadyCycle(){this.ready&&(M(this,"preconditionsReady",(()=>this._readyCycleForced=!1)),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};U.views=new a,e([R()],U.prototype,"_userSpatialReference",void 0),e([V("toolViewManager.activeTool")],U.prototype,"activeTool",void 0),e([R({readOnly:!0})],U.prototype,"allLayerViews",void 0),e([R()],U.prototype,"groundView",void 0),e([R()],U.prototype,"animation",void 0),e([R()],U.prototype,"basemapView",void 0),e([R({readOnly:!0})],U.prototype,"_defaultsFromMapSettings",null),e([R()],U.prototype,"defaultsFromMap",null),e([R()],U.prototype,"fatalError",void 0),e([R({type:j})],U.prototype,"extent",void 0),e([R(S(E,"graphics"))],U.prototype,"graphics",void 0),e([R(S(L,"analyses"))],U.prototype,"analyses",void 0),e([R({readOnly:!0,type:F})],U.prototype,"heightModelInfo",null),e([R({readOnly:!0})],U.prototype,"interacting",null),e([R({readOnly:!0})],U.prototype,"navigating",void 0),e([R({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_currentSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],U.prototype,"preconditionsReady",null),e([R({readOnly:!0})],U.prototype,"typeSpecificPreconditionsReady",void 0),e([R({type:a,readOnly:!0})],U.prototype,"layerViews",void 0),e([R({type:x})],U.prototype,"magnifier",void 0),e([R({value:null,type:t})],U.prototype,"map",null),e([R()],U.prototype,"padding",void 0),e([R({readOnly:!0})],U.prototype,"ready",void 0),e([R({type:O})],U.prototype,"spatialReference",null),e([R()],U.prototype,"spatialReferenceWarningDelay",void 0),e([R()],U.prototype,"stationary",null),e([R({readOnly:!0})],U.prototype,"supportsGround",void 0),e([R({type:i})],U.prototype,"timeExtent",void 0),e([V("toolViewManager.tools")],U.prototype,"tools",void 0),e([R()],U.prototype,"toolViewManager",void 0),e([R({readOnly:!0})],U.prototype,"type",void 0),e([R({type:Number})],U.prototype,"scale",void 0),e([R({readOnly:!0})],U.prototype,"updating",void 0),e([R({readOnly:!0})],U.prototype,"initialExtentRequired",void 0),e([R({readOnly:!0})],U.prototype,"initialExtent",null),e([R()],U.prototype,"cursor",null),e([R({readOnly:!0})],U.prototype,"input",void 0),e([R({type:T,nonNullable:!0})],U.prototype,"navigation",void 0),e([R()],U.prototype,"layerViewManager",void 0),e([R()],U.prototype,"analysisViewManager",void 0),e([R()],U.prototype,"width",void 0),e([R()],U.prototype,"height",void 0),e([R({readOnly:!0})],U.prototype,"resizing",void 0),e([R({value:null,readOnly:!0})],U.prototype,"size",null),e([R({readOnly:!0})],U.prototype,"suspended",void 0),e([R({readOnly:!0})],U.prototype,"viewEvents",void 0),e([R({readOnly:!0})],U.prototype,"persistableViewModels",void 0),e([R()],U.prototype,"_isValid",void 0),e([R()],U.prototype,"_readyCycleForced",void 0),e([R()],U.prototype,"_currentSpatialReference",void 0),U=z=e([_("esri.views.View")],U);const W=U;export{W as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../TimeExtent.js";import r from"../core/Accessor.js";import a from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import o from"../core/Error.js";import n from"../core/Evented.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import{makeHandle as p}from"../core/handleUtils.js";import d from"../core/Loadable.js";import h from"../core/Logger.js";import{isSome as y,destroyMaybe as u,abortMaybe as c}from"../core/maybe.js";import{EsriPromiseMixin as m}from"../core/Promise.js";import{createTask as f,after as g}from"../core/promiseUtils.js";import{watch as w}from"../core/reactiveUtils.js";import{whenOnce as v,whenFalseOnce as M}from"../core/watchUtils.js";import{aliasOf as V}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as S}from"../core/support/OwningCollection.js";import j from"../geometry/Extent.js";import F from"../geometry/HeightModelInfo.js";import O from"../geometry/SpatialReference.js";import{equals as L}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as E}from"../support/AnalysesCollection.js";import{GraphicsCollection as b}from"../support/GraphicsCollection.js";import{BasemapView as C}from"./BasemapView.js";import x from"./LayerViewManager.js";import I from"./Magnifier.js";import q from"./ToolViewManager.js";import D from"./input/Input.js";import{ViewEvents as T}from"./input/ViewEvents.js";import U from"./navigation/Navigation.js";import k from"./support/DefaultsFromMap.js";var z;const P=h.getLogger("esri.views.View");let W=z=class extends(l(n.EventedMixin(m(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new s({getCollections:()=>{var e,t,i;return[null==(e=this.basemapView)?void 0:e.baseLayerViews,null==(t=this.groundView)?void 0:t.layerViews,this.layerViews,null==(i=this.basemapView)?void 0:i.referenceLayerViews]},getChildrenFunction:e=>e.layerViews}),this.groundView=null,this.animation=null,this.basemapView=null,this.fatalError=null,this.extent=null,this.graphics=new b,this.analyses=new E,this.navigating=!1,this.typeSpecificPreconditionsReady=!0,this.layerViews=new a,this.magnifier=new I,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new D,this.navigation=new U,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new T(this),this.persistableViewModels=new a,this._isValid=!1,this._readyCycleForced=!1,this.handles.add(this.watch("preconditionsReady",(e=>{var t,i;(e?(this._currentSpatialReference=this.spatialReference,z.views.add(this)):(this._currentSpatialReference=null,z.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready)?(null==(t=this.layerViewManager)||t.clear(),null==(i=this.toolViewManager)||i.detach(),y(this.analysisViewManager)&&this.analysisViewManager.detach(),this._teardown()):e&&!this.ready&&(y(this.analysisViewManager)&&this.analysisViewManager.attach(),this._startup(),this.toolViewManager.attach())}),!0))}initialize(){this.addResolvingPromise(this.validate().then((()=>(this._isValid=!0,v(this,"ready"))))),this.basemapView=new C({view:this}),this.layerViewManager=new x({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new q({view:this}),this._setupSpatialReferenceLogger(),this.handles.add([w((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),{sync:!0,initial:!0}),w((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),{sync:!0}),w((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let e=null;this.handles.add([w((()=>{var e;return null==(e=this.defaultsFromMap)?void 0:e.ready}),(t=>{var i;const r=(null==(i=this.map)?void 0:i.allLayers.length)>0;if(t&&!this.spatialReference&&r){if(y(e))return;const t=p((()=>e=c(e)));e=f((async t=>{try{await g(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}P.warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),this.handles.add(t,"spatial-reference-logger-task")}else this.handles.remove("spatial-reference-logger-task")}),{sync:!0})])}destroy(){if(this.destroyed)return;this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=u(this.graphics),this.analyses=u(this.analyses),this.handles.remove("defaultsFromMap"),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.toolViewManager=u(this.toolViewManager),this.layerViewManager=u(this.layerViewManager),this.basemapView=u(this.basemapView),this.invalidate(),this._emitter.clear(),this.handles.removeAll();const e=this.map;this.map=null,null==e||e.destroy()}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return P.error("#toMap()","Not implemented on this instance of View"),null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new k({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:e=>this.getSpatialReferenceSupport(e),...this._defaultsFromMapSettings})}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get preconditionsReady(){var e;return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||d.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!(this._currentSpatialReference||null!=(e=this.defaultsFromMap)&&e.ready)||!this.typeSpecificPreconditionsReady)}set map(e){var t;e!==this._get("map")&&(null!=(t=e)&&t.destroyed&&(P.warn("#map","The provided map is already destroyed",{map:e}),e=null),d.isLoadable(e)&&e.load().catch((()=>{})),this.initialized&&(this.forceReadyCycle(),this._currentSpatialReference=null),this._set("map",e))}get spatialReference(){var e,t;let i=this._userSpatialReference||this._currentSpatialReference||this.getDefaultSpatialReference()||null;return i&&null!=(e=this.defaultsFromMap)&&null!=(t=e.required)&&t.heightModelInfo&&(i=i.clone(),i.vcsWkid=this.defaultsFromMap.vcsWkid,i.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),i}set spatialReference(e){const t=!L(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get initialExtent(){var e;return null==(e=this.defaultsFromMap)?void 0:e.extent}get cursor(){const e=this.toolViewManager?this.toolViewManager.cursor:null;return y(e)?e:this._cursor||"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}whenLayerView(e){return this.layerViewManager.whenLayerView(e)}getDefaultSpatialReference(){var e;return null==(e=this.defaultsFromMap)?void 0:e.spatialReference}getDefaultHeightModelInfo(){var e,t,i;return null!=(e=null!=(t=this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)?t:null==(i=this.defaultsFromMap)?void 0:i.heightModelInfo)?e:null}importLayerView(e){throw new o("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{}}_validateSpatialReference(e){return y(this.getSpatialReferenceSupport({spatialReference:e}))}when(e,t){return this.isResolved()&&!this.ready&&P.warn("#when()",'Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use watchUtils.whenOnce(view, "ready").then(...) instead.'),super.when(e,t)}forceReadyCycle(){this.ready&&(M(this,"preconditionsReady",(()=>this._readyCycleForced=!1)),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};W.views=new a,e([R()],W.prototype,"_userSpatialReference",void 0),e([V("toolViewManager.activeTool")],W.prototype,"activeTool",void 0),e([R({readOnly:!0})],W.prototype,"allLayerViews",void 0),e([R()],W.prototype,"groundView",void 0),e([R()],W.prototype,"animation",void 0),e([R()],W.prototype,"basemapView",void 0),e([R({readOnly:!0})],W.prototype,"_defaultsFromMapSettings",null),e([R()],W.prototype,"defaultsFromMap",null),e([R()],W.prototype,"fatalError",void 0),e([R({type:j})],W.prototype,"extent",void 0),e([R(S(b,"graphics"))],W.prototype,"graphics",void 0),e([R(S(E,"analyses"))],W.prototype,"analyses",void 0),e([R({readOnly:!0,type:F})],W.prototype,"heightModelInfo",null),e([R({readOnly:!0})],W.prototype,"interacting",null),e([R({readOnly:!0})],W.prototype,"navigating",void 0),e([R({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_currentSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],W.prototype,"preconditionsReady",null),e([R({readOnly:!0})],W.prototype,"typeSpecificPreconditionsReady",void 0),e([R({type:a,readOnly:!0})],W.prototype,"layerViews",void 0),e([R({type:I})],W.prototype,"magnifier",void 0),e([R({value:null,type:t})],W.prototype,"map",null),e([R()],W.prototype,"padding",void 0),e([R({readOnly:!0})],W.prototype,"ready",void 0),e([R({type:O})],W.prototype,"spatialReference",null),e([R()],W.prototype,"spatialReferenceWarningDelay",void 0),e([R()],W.prototype,"stationary",null),e([R({readOnly:!0})],W.prototype,"supportsGround",void 0),e([R({type:i})],W.prototype,"timeExtent",void 0),e([V("toolViewManager.tools")],W.prototype,"tools",void 0),e([R()],W.prototype,"toolViewManager",void 0),e([R({readOnly:!0})],W.prototype,"type",void 0),e([R({type:Number})],W.prototype,"scale",void 0),e([R({readOnly:!0})],W.prototype,"updating",void 0),e([R({readOnly:!0})],W.prototype,"initialExtentRequired",void 0),e([R({readOnly:!0})],W.prototype,"initialExtent",null),e([R()],W.prototype,"cursor",null),e([R({readOnly:!0})],W.prototype,"input",void 0),e([R({type:U,nonNullable:!0})],W.prototype,"navigation",void 0),e([R()],W.prototype,"layerViewManager",void 0),e([R()],W.prototype,"analysisViewManager",void 0),e([R()],W.prototype,"width",void 0),e([R()],W.prototype,"height",void 0),e([R({readOnly:!0})],W.prototype,"resizing",void 0),e([R({value:null,readOnly:!0})],W.prototype,"size",null),e([R({readOnly:!0})],W.prototype,"suspended",void 0),e([R({readOnly:!0})],W.prototype,"viewEvents",void 0),e([R({readOnly:!0})],W.prototype,"persistableViewModels",void 0),e([R()],W.prototype,"_isValid",void 0),e([R()],W.prototype,"_readyCycleForced",void 0),e([R()],W.prototype,"_currentSpatialReference",void 0),W=z=e([_("esri.views.View")],W);const A=W;export{A as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import e from"../../../Graphic.js";import i from"../../../core/Evented.js";import s from"../../../core/Handles.js";import{destroyMaybe as r,isSome as a}from"../../../core/maybe.js";import{whenOnce as o,pausable as h}from"../../../core/watchUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{create as l}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as p}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as d}from"../../../geometry/support/coordsUtils.js";import m from"../../../geometry/support/rotate.js";import u from"../../../symbols/SimpleFillSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import _ from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as v,scale as y,getScaleRatio as G,getRotationAngle as f}from"./drawUtils.js";import b from"./GraphicMover.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as w}from"./settings.js";import k from"../../../geometry/Point.js";import x from"../../../geometry/Polygon.js";import R from"../../../geometry/Polyline.js";class M{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class I{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class C{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class E{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-start"}}class O{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate"}}class j{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-stop"}}class L{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-start"}}class B{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale"}}class Y{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-stop"}}const z=w.transformGraphics,N={centerIndicator:new _({style:"cross",size:z.center.size,color:z.center.color}),fill:{default:new u({color:z.fill.color,outline:{color:z.fill.outlineColor,join:"round",width:1}}),active:new u({color:z.fill.stagedColor,outline:{color:z.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new _({style:"square",size:z.vertex.size,color:z.vertex.color,outline:{color:z.vertex.outlineColor,width:1}}),hover:new _({style:"square",size:z.vertex.hoverSize,color:z.vertex.hoverColor,outline:{color:z.vertex.hoverOutlineColor,width:1}})},rotator:{default:new _({style:"circle",size:z.vertex.size,color:z.vertex.color,outline:{color:z.vertex.outlineColor,width:1}}),hover:new _({style:"circle",size:z.vertex.hoverSize,color:z.vertex.hoverColor,outline:{color:z.vertex.hoverOutlineColor,width:1}})},rotatorLine:new g({color:z.line.color,width:1})};let P=class extends i.EventedAccessor{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._handles=new s,this._mover=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.centerGraphic=null,this.backgroundGraphic=null,this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.handleGraphics=[],this.layer=null,this.preserveAspectRatio=!1,this.rotateGraphic=null,this.showCenterGraphic=!0,this.view=null,this._getBounds=(()=>{const t=l();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,r,a,o;if("point"===s.type)i=a=s.x,r=o=s.y;else if("multipoint"===s.type){const e=d(s);[i,r,a,o]=p(t,[e])}else if("extent"===s.type)[i,r,a,o]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=d(s);[i,r,a,o]=p(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(r,e[1]),e[2]=Math.max(a,e[2]),e[3]=Math.max(o,e[3])}return e}})()}initialize(){this._setup(),this._handles.add([o(this,"view.ready",(()=>{const{layer:t,view:e}=this;S(e,t)})),h(this,"preserveAspectRatio",(()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics())})),h(this,"view.scale",(()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()})),h(this,"graphics",(()=>this.refresh())),h(this,"layer",((t,e)=>{e&&this._resetGraphics(e),this.refresh()}))])}destroy(){this._reset(),this._handles=r(this._handles)}get state(){const t=!!this.get("view.ready"),e=!(!this.get("graphics.length")||!this.get("layer"));return t&&e?"active":t?"ready":"disabled"}set symbols(t){const{centerIndicator:e=N.centerIndicator,fill:i=N.fill,handles:s=N.handles,rotator:r=N.rotator,rotatorLine:a=N.rotatorLine}=t||{};this._set("symbols",{centerIndicator:e,fill:i,handles:s,rotator:r,rotatorLine:a})}isUIGraphic(t){let e=[];return this.handleGraphics.length&&(e=e.concat(this.handleGraphics)),this.backgroundGraphic&&e.push(this.backgroundGraphic),this.centerGraphic&&e.push(this.centerGraphic),this.rotateGraphic&&e.push(this.rotateGraphic),this._rotateLineGraphic&&e.push(this._rotateLineGraphic),e.length&&e.includes(t)}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,r=v(s,t,e,this.view);i.geometry=r}this.refresh(),this._emitMoveStopEvent(t,e,null)}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,r=y(s,t,e);i.geometry=r}this.refresh(),this._emitScaleStopEvent(t,e,null)}}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this.handleGraphics[1].geometry.x,i=this.handleGraphics[3].geometry.y;e=new k(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,r=m(s,t,e);i.geometry=r}this.refresh(),this._emitRotateStopEvent(t,null)}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._resetGraphicStateVars(),this._resetGraphics(),this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){const e=t||this.layer;e&&(e.removeMany(this.handleGraphics),e.remove(this.backgroundGraphic),e.remove(this.centerGraphic),e.remove(this.rotateGraphic),e.remove(this._rotateLineGraphic));for(const i of this.handleGraphics)i.destroy();this._set("handleGraphics",[]),this.backgroundGraphic&&(this.backgroundGraphic.destroy(),this._set("backgroundGraphic",null)),this.centerGraphic&&(this.centerGraphic.destroy(),this._set("centerGraphic",null)),this.rotateGraphic&&(this.rotateGraphic.destroy(),this._set("rotateGraphic",null)),this._rotateLineGraphic&&(this._rotateLineGraphic.destroy(),this._rotateLineGraphic=null)}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this.handleGraphics)),this.enableMovement&&(t=t.concat(this.graphics,this.backgroundGraphic)),this.enableRotation&&t.push(this.rotateGraphic),this.showCenterGraphic&&t.push(this.centerGraphic),this._mover=new b({enableMoveAllGraphics:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_getStartInfo(t){const[e,i,s,r]=this._getBoxBounds(l()),a=Math.abs(s-e),o=Math.abs(r-i),h=(s+e)/2,c=(r+i)/2,{x:n,y:p}=t.geometry;return{width:a,height:o,centerX:h,centerY:c,startX:n,startY:p,graphicInfos:this._getGraphicInfos(),box:this.backgroundGraphic.geometry,rotate:this.rotateGraphic.geometry}}_getGraphicInfos(){return this.graphics.map((t=>this._getGraphicInfo(t)))}_getGraphicInfo(t){const e=t.geometry,[i,s,r,a]=this._getBounds(l(),[e]);return{width:Math.abs(r-i),height:Math.abs(a-s),centerX:(r+i)/2,centerY:(a+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,backgroundGraphic:r,handleGraphics:a,rotateGraphic:o,symbols:h}=this,c=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),r.symbol=h.fill.active,this._startInfo=this._getStartInfo(c),c===o?(this.view.cursor="grabbing",this._emitRotateStartEvent(e,c)):a.includes(c)?(this._activeHandleGraphic=c,this._emitScaleStartEvent(i,s,c)):this._emitMoveStartEvent(t.dx,t.dy,c)}_onGraphicMoveCallback(t){const e=t.graphic;if(this._startInfo)if(this.handleGraphics.includes(e))this._scaleGraphic(e),this._emitScaleEvent(this._xScale,this._yScale,e);else if(e===this.rotateGraphic)this._rotateGraphic(e),this._emitRotateEvent(this._angleOfRotation,e);else{const i=t.dx,s=t.dy;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._emitMoveEvent(i,s,e)}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:r,_xScale:a,_yScale:o,handleGraphics:h,rotateGraphic:c}=this;this.refresh(),e===c?(this.view.cursor="pointer",this._emitRotateStopEvent(i,e)):h.includes(e)?this._emitScaleStopEvent(a,o,e):this._emitMoveStopEvent(s,r,e)}_onGraphicPointerOverCallback(t){const{backgroundGraphic:e,handleGraphics:i,graphics:s,rotateGraphic:r,symbols:a,view:o}=this,h=t.graphic;if(h===r)return r.symbol=a.rotator.hover,void(o.cursor="pointer");if(s.includes(h)||h===e)return void(o.cursor="move");if(!i.includes(h))return void(o.cursor="pointer");t.graphic.symbol=a.handles.hover;const c=o.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}o.cursor=n}_onGraphicPointerOutCallback(t){const{handleGraphics:e,rotateGraphic:i,symbols:s,view:r}=this;t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),r.cursor="default"}_scaleGraphic(t){const{_startInfo:e,handleGraphics:i,preserveAspectRatio:s,view:r}=this,{centerX:a,centerY:o,startX:h,startY:c}=e,{resolution:n,transform:l}=r.state,p=i.indexOf(t);1!==p&&5!==p||this._updateX(t,a),3!==p&&7!==p||this._updateY(t,o);const{x:d,y:m}=t.geometry,u=l[0]*d+l[2]*m+l[4],g=l[1]*d+l[3]*m+l[5],_=e.graphicInfos.map((t=>t.geometry));if(s){const t=l[0]*a+l[2]*o+l[4],e=l[1]*a+l[3]*o+l[5],i=l[0]*h+l[2]*c+l[4],s=l[1]*h+l[3]*c+l[5];this._xScale=this._yScale=G(t,e,i,s,u,g);for(const r of _){const t=_.indexOf(r);this.graphics[t].geometry=y(r,this._xScale,this._yScale,[a,o])}this._updateBackgroundGraphic()}else{const{width:t,height:i}=e;let s=d-h,l=c-m;if(1===p||5===p?s=0:3!==p&&7!==p||(l=0),0===s&&0===l)return;const u=t+(h>a?s:-1*s),g=i+(c<o?l:-1*l),G=a+s/2,f=o+l/2;this._xScale=u/t||1,this._yScale=g/i||1,1===p||5===p?this._xScale=1:3!==p&&7!==p||(this._yScale=1);const b=(G-a)/n,S=(f-o)/n,w=y(e.box,this._xScale,this._yScale);this.backgroundGraphic.geometry=v(w,b,S,r,!0);const{centerX:x,centerY:R}=this._getGraphicInfo(this.backgroundGraphic),M=(x-a)/n,I=-1*(R-o)/n;for(const e of _){const t=_.indexOf(e),i=y(e,this._xScale,this._yScale,[a,o]);this.graphics[t].geometry=v(i,M,I,r,!0)}this.centerGraphic.geometry=new k(x,R,r.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:r,box:a,rotate:o}=this._startInfo,h=new k(s,r,this.view.spatialReference),c=new k(e,i,this.view.spatialReference),n=t.geometry;this._angleOfRotation=f(h,n,c);const l=this._startInfo.graphicInfos.map((t=>t.geometry));for(const p of l){const t=l.indexOf(p),e=m(p,this._angleOfRotation,c);this.graphics[t].geometry=e}this.backgroundGraphic.geometry=m(a,this._angleOfRotation,c),this.rotateGraphic.geometry=m(o,this._angleOfRotation,c)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this.backgroundGraphic.geometry;this.backgroundGraphic.geometry=v(s,e,i,this.view);for(const r of this.graphics)r!==t&&(r.geometry=v(r.geometry,e,i,this.view))}else if(t===this.centerGraphic){const t=this.backgroundGraphic.geometry;this.backgroundGraphic.geometry=v(t,e,i,this.view)}if(t===this.backgroundGraphic||t===this.centerGraphic)for(const s of this.graphics)s.geometry=v(s.geometry,e,i,this.view)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._set("centerGraphic",new e(null,i.centerIndicator,t)),this.showCenterGraphic&&this.layer.add(this.centerGraphic),this._set("backgroundGraphic",new e(null,i.fill.default,t)),this.layer.add(this.backgroundGraphic),this._rotateLineGraphic=new e(null,i.rotatorLine,t),this._set("rotateGraphic",new e(null,i.rotator.default,t)),this.enableRotation&&!this._hasExtentGraphic()&&(this.layer.add(this._rotateLineGraphic),this.layer.add(this.rotateGraphic));for(let s=0;s<8;s++)this.handleGraphics.push(new e(null,i.handles.default,t));this.enableScaling&&this.layer.addMany(this.handleGraphics)}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this.centerGraphic.visible=!1,this.rotateGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this.handleGraphics.forEach((t=>t.visible=!1))}_updateHandleGraphics(){const t=this._getCoordinates(!0);this.handleGraphics.forEach(((e,i)=>{const[s,r]=t[i];this._updateXY(e,s,r)}))}_updateBackgroundGraphic(){const t=this._getCoordinates();this.backgroundGraphic.geometry=new x({rings:t,spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(l()),r=(i+t)/2,a=(s+e)/2;this.centerGraphic.geometry=new k(r,a,this.view.spatialReference)}_updateRotateGraphic(){if(!this.handleGraphics.length)return;const{x:t,y:e}=this.handleGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this.rotateGraphic.geometry=new k(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this.handleGraphics.length||!this.rotateGraphic||!this.rotateGraphic.geometry)return;const t=this.handleGraphics[1].geometry,e=this.rotateGraphic.geometry;this._rotateLineGraphic.geometry=new R({paths:[[t.x,t.y],[e.x,e.y]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new k(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new k(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new k(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some((t=>t&&a(t.geometry)&&"extent"===t.geometry.type))}_getBoxBounds(t){const e=this.graphics.map((t=>t.geometry));return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,r]=this._getBoxBounds(l());if(t){const t=(e+s)/2,a=(r+i)/2;return[[e,r],[t,r],[s,r],[s,a],[s,i],[t,i],[e,i],[e,a]]}return[[e,r],[s,r],[s,i],[e,i]]}_emitMoveStartEvent(t,e,i){const s=new M(this.graphics,i,t,e);this.emit("move-start",s),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(s)}_emitMoveEvent(t,e,i){const s=new I(this.graphics,i,t,e);this.emit("move",s),this.callbacks.onMove&&this.callbacks.onMove(s)}_emitMoveStopEvent(t,e,i){const s=new C(this.graphics,i,t,e);this.emit("move-stop",s),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(s)}_emitRotateStartEvent(t,e){const i=new E(this.graphics,e,t);this.emit("rotate-start",i),this.callbacks.onRotateStart&&this.callbacks.onRotateStart(i)}_emitRotateEvent(t,e){const i=new O(this.graphics,e,t);this.emit("rotate",i),this.callbacks.onRotate&&this.callbacks.onRotate(i)}_emitRotateStopEvent(t,e){const i=new j(this.graphics,e,t);this.emit("rotate-stop",i),this.callbacks.onRotateStop&&this.callbacks.onRotateStop(i)}_emitScaleStartEvent(t,e,i){const s=new L(this.graphics,i,t,e);this.emit("scale-start",s),this.callbacks.onScaleStart&&this.callbacks.onScaleStart(s)}_emitScaleEvent(t,e,i){const s=new B(this.graphics,i,t,e);this.emit("scale",s),this.callbacks.onScale&&this.callbacks.onScale(s)}_emitScaleStopEvent(t,e,i){const s=new Y(this.graphics,i,t,e);this.emit("scale-stop",s),this.callbacks.onScaleStop&&this.callbacks.onScaleStop(s)}};t([c()],P.prototype,"_rotateLineGraphic",void 0),t([c({readOnly:!0})],P.prototype,"type",void 0),t([c()],P.prototype,"callbacks",void 0),t([c({readOnly:!0})],P.prototype,"centerGraphic",void 0),t([c({readOnly:!0})],P.prototype,"backgroundGraphic",void 0),t([c()],P.prototype,"enableMovement",void 0),t([c()],P.prototype,"enableRotation",void 0),t([c()],P.prototype,"enableScaling",void 0),t([c()],P.prototype,"graphics",void 0),t([c({readOnly:!0})],P.prototype,"handleGraphics",void 0),t([c()],P.prototype,"layer",void 0),t([c()],P.prototype,"preserveAspectRatio",void 0),t([c({readOnly:!0})],P.prototype,"rotateGraphic",void 0),t([c()],P.prototype,"showCenterGraphic",void 0),t([c({readOnly:!0})],P.prototype,"state",null),t([c({value:N})],P.prototype,"symbols",null),t([c()],P.prototype,"view",void 0),P=t([n("esri.views.draw.support.Box")],P);const X=P;export{X as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import e from"../../../Graphic.js";import i from"../../../core/Evented.js";import s from"../../../core/Handles.js";import{destroyMaybe as r,isSome as a}from"../../../core/maybe.js";import{whenOnce as o,pausable as h}from"../../../core/watchUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{create as l}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as p}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as d}from"../../../geometry/support/coordsUtils.js";import g from"../../../geometry/support/rotate.js";import m from"../../../symbols/SimpleFillSymbol.js";import u from"../../../symbols/SimpleLineSymbol.js";import _ from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as v,scale as y,getScaleRatio as G,getRotationAngle as f}from"./drawUtils.js";import b from"./GraphicMover.js";import S from"./HighlightHelper.js";import{addUniqueLayer as w}from"./layerUtils.js";import{settings as k}from"./settings.js";import x from"../../../geometry/Point.js";import R from"../../../geometry/Polygon.js";import M from"../../../geometry/Polyline.js";class I{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class E{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class C{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class O{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-start"}}class j{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate"}}class L{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-stop"}}class B{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-start"}}class H{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale"}}class Y{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-stop"}}const z=k.transformGraphics,N={centerIndicator:new _({style:"cross",size:z.center.size,color:z.center.color}),fill:{default:new m({color:z.fill.color,outline:{color:z.fill.outlineColor,join:"round",width:1}}),active:new m({color:z.fill.stagedColor,outline:{color:z.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new _({style:"square",size:z.vertex.size,color:z.vertex.color,outline:{color:z.vertex.outlineColor,width:1}}),hover:new _({style:"square",size:z.vertex.hoverSize,color:z.vertex.hoverColor,outline:{color:z.vertex.hoverOutlineColor,width:1}})},rotator:{default:new _({style:"circle",size:z.vertex.size,color:z.vertex.color,outline:{color:z.vertex.outlineColor,width:1}}),hover:new _({style:"circle",size:z.vertex.hoverSize,color:z.vertex.hoverColor,outline:{color:z.vertex.hoverOutlineColor,width:1}})},rotatorLine:new u({color:z.line.color,width:1})};let A=class extends i.EventedAccessor{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._handles=new s,this._mover=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.centerGraphic=null,this.backgroundGraphic=null,this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.handleGraphics=[],this.layer=null,this.preserveAspectRatio=!1,this.rotateGraphic=null,this.showCenterGraphic=!0,this.view=null,this._getBounds=(()=>{const t=l();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,r,a,o;if("point"===s.type)i=a=s.x,r=o=s.y;else if("multipoint"===s.type){const e=d(s);[i,r,a,o]=p(t,[e])}else if("extent"===s.type)[i,r,a,o]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=d(s);[i,r,a,o]=p(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(r,e[1]),e[2]=Math.max(a,e[2]),e[3]=Math.max(o,e[3])}return e}})()}initialize(){this._highlightHelper=new S({view:this.view}),this._setup(),this._handles.add([o(this,"view.ready",(()=>{const{layer:t,view:e}=this;w(e,t)})),h(this,"preserveAspectRatio",(()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics())})),h(this,"view.scale",(()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()})),h(this,"graphics",(()=>this.refresh())),h(this,"layer",((t,e)=>{e&&this._resetGraphics(e),this.refresh()}))])}destroy(){this._reset(),this._handles=r(this._handles)}set highlightsEnabled(t){var e;null==(e=this._highlightHelper)||e.removeAll(),this._set("highlightsEnabled",t),this._setUpHighlights()}get state(){const t=!!this.get("view.ready"),e=!(!this.get("graphics.length")||!this.get("layer"));return t&&e?"active":t?"ready":"disabled"}set symbols(t){const{centerIndicator:e=N.centerIndicator,fill:i=N.fill,handles:s=N.handles,rotator:r=N.rotator,rotatorLine:a=N.rotatorLine}=t||{};this._set("symbols",{centerIndicator:e,fill:i,handles:s,rotator:r,rotatorLine:a})}isUIGraphic(t){let e=[];return this.handleGraphics.length&&(e=e.concat(this.handleGraphics)),this.backgroundGraphic&&e.push(this.backgroundGraphic),this.centerGraphic&&e.push(this.centerGraphic),this.rotateGraphic&&e.push(this.rotateGraphic),this._rotateLineGraphic&&e.push(this._rotateLineGraphic),e.length&&e.includes(t)}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,r=v(s,t,e,this.view);i.geometry=r}this.refresh(),this._emitMoveStopEvent(t,e,null)}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,r=y(s,t,e);i.geometry=r}this.refresh(),this._emitScaleStopEvent(t,e,null)}}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this.handleGraphics[1].geometry.x,i=this.handleGraphics[3].geometry.y;e=new x(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,r=g(s,t,e);i.geometry=r}this.refresh(),this._emitRotateStopEvent(t,null)}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){const e=t||this.layer;e&&(e.removeMany(this.handleGraphics),e.remove(this.backgroundGraphic),e.remove(this.centerGraphic),e.remove(this.rotateGraphic),e.remove(this._rotateLineGraphic));for(const i of this.handleGraphics)i.destroy();this._set("handleGraphics",[]),this.backgroundGraphic&&(this.backgroundGraphic.destroy(),this._set("backgroundGraphic",null)),this.centerGraphic&&(this.centerGraphic.destroy(),this._set("centerGraphic",null)),this.rotateGraphic&&(this.rotateGraphic.destroy(),this._set("rotateGraphic",null)),this._rotateLineGraphic&&(this._rotateLineGraphic.destroy(),this._rotateLineGraphic=null)}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this.handleGraphics)),this.enableMovement&&(t=t.concat(this.graphics,this.backgroundGraphic)),this.enableRotation&&t.push(this.rotateGraphic),this.showCenterGraphic&&t.push(this.centerGraphic),this._mover=new b({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_getStartInfo(t){const[e,i,s,r]=this._getBoxBounds(l()),a=Math.abs(s-e),o=Math.abs(r-i),h=(s+e)/2,c=(r+i)/2,{x:n,y:p}=t.geometry;return{width:a,height:o,centerX:h,centerY:c,startX:n,startY:p,graphicInfos:this._getGraphicInfos(),box:this.backgroundGraphic.geometry,rotate:this.rotateGraphic.geometry}}_getGraphicInfos(){return this.graphics.map((t=>this._getGraphicInfo(t)))}_getGraphicInfo(t){const e=t.geometry,[i,s,r,a]=this._getBounds(l(),[e]);return{width:Math.abs(r-i),height:Math.abs(a-s),centerX:(r+i)/2,centerY:(a+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,backgroundGraphic:r,handleGraphics:a,rotateGraphic:o,symbols:h}=this,c=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),r.symbol=h.fill.active,this._startInfo=this._getStartInfo(c),c===o?(this.view.cursor="grabbing",this._emitRotateStartEvent(e,c)):a.includes(c)?(this._activeHandleGraphic=c,this._emitScaleStartEvent(i,s,c)):this._emitMoveStartEvent(t.dx,t.dy,c)}_onGraphicMoveCallback(t){const e=t.graphic;if(this._startInfo)if(this.handleGraphics.includes(e))this._scaleGraphic(e),this._emitScaleEvent(this._xScale,this._yScale,e);else if(e===this.rotateGraphic)this._rotateGraphic(e),this._emitRotateEvent(this._angleOfRotation,e);else{const i=t.dx,s=t.dy;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._emitMoveEvent(i,s,e)}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:r,_xScale:a,_yScale:o,handleGraphics:h,rotateGraphic:c}=this;this.refresh(),e===c?(this.view.cursor="pointer",this._emitRotateStopEvent(i,e)):h.includes(e)?this._emitScaleStopEvent(a,o,e):this._emitMoveStopEvent(s,r,e)}_onGraphicPointerOverCallback(t){const{backgroundGraphic:e,handleGraphics:i,graphics:s,rotateGraphic:r,symbols:a,view:o}=this,h=t.graphic;if(h===r)return r.symbol=a.rotator.hover,void(o.cursor="pointer");if(s.includes(h)||h===e)return void(o.cursor="move");if(!i.includes(h))return void(o.cursor="pointer");t.graphic.symbol=a.handles.hover;const c=o.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}o.cursor=n}_onGraphicPointerOutCallback(t){const{handleGraphics:e,rotateGraphic:i,symbols:s,view:r}=this;t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),r.cursor="default"}_scaleGraphic(t){const{_startInfo:e,handleGraphics:i,preserveAspectRatio:s,view:r}=this,{centerX:a,centerY:o,startX:h,startY:c}=e,{resolution:n,transform:l}=r.state,p=i.indexOf(t);1!==p&&5!==p||this._updateX(t,a),3!==p&&7!==p||this._updateY(t,o);const{x:d,y:g}=t.geometry,m=l[0]*d+l[2]*g+l[4],u=l[1]*d+l[3]*g+l[5],_=e.graphicInfos.map((t=>t.geometry));if(s){const t=l[0]*a+l[2]*o+l[4],e=l[1]*a+l[3]*o+l[5],i=l[0]*h+l[2]*c+l[4],s=l[1]*h+l[3]*c+l[5];this._xScale=this._yScale=G(t,e,i,s,m,u);for(const r of _){const t=_.indexOf(r);this.graphics[t].geometry=y(r,this._xScale,this._yScale,[a,o])}this._updateBackgroundGraphic()}else{const{width:t,height:i}=e;let s=d-h,l=c-g;if(1===p||5===p?s=0:3!==p&&7!==p||(l=0),0===s&&0===l)return;const m=t+(h>a?s:-1*s),u=i+(c<o?l:-1*l),G=a+s/2,f=o+l/2;this._xScale=m/t||1,this._yScale=u/i||1,1===p||5===p?this._xScale=1:3!==p&&7!==p||(this._yScale=1);const b=(G-a)/n,S=(f-o)/n,w=y(e.box,this._xScale,this._yScale);this.backgroundGraphic.geometry=v(w,b,S,r,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this.backgroundGraphic),M=(k-a)/n,I=-1*(R-o)/n;for(const e of _){const t=_.indexOf(e),i=y(e,this._xScale,this._yScale,[a,o]);this.graphics[t].geometry=v(i,M,I,r,!0)}this.centerGraphic.geometry=new x(k,R,r.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:r,box:a,rotate:o}=this._startInfo,h=new x(s,r,this.view.spatialReference),c=new x(e,i,this.view.spatialReference),n=t.geometry;this._angleOfRotation=f(h,n,c);const l=this._startInfo.graphicInfos.map((t=>t.geometry));for(const p of l){const t=l.indexOf(p),e=g(p,this._angleOfRotation,c);this.graphics[t].geometry=e}this.backgroundGraphic.geometry=g(a,this._angleOfRotation,c),this.rotateGraphic.geometry=g(o,this._angleOfRotation,c)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this.backgroundGraphic.geometry;this.backgroundGraphic.geometry=v(s,e,i,this.view);for(const r of this.graphics)r!==t&&(r.geometry=v(r.geometry,e,i,this.view))}else if(t===this.centerGraphic){const t=this.backgroundGraphic.geometry;this.backgroundGraphic.geometry=v(t,e,i,this.view)}if(t===this.backgroundGraphic||t===this.centerGraphic)for(const s of this.graphics)s.geometry=v(s.geometry,e,i,this.view)}_setUpHighlights(){var t,e;this.highlightsEnabled&&null!=(t=this.graphics)&&t.length&&(null==(e=this._highlightHelper)||e.add(this.graphics))}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._set("centerGraphic",new e(null,i.centerIndicator,t)),this.showCenterGraphic&&this.layer.add(this.centerGraphic),this._set("backgroundGraphic",new e(null,i.fill.default,t)),this.layer.add(this.backgroundGraphic),this._rotateLineGraphic=new e(null,i.rotatorLine,t),this._set("rotateGraphic",new e(null,i.rotator.default,t)),this.enableRotation&&!this._hasExtentGraphic()&&(this.layer.add(this._rotateLineGraphic),this.layer.add(this.rotateGraphic));for(let s=0;s<8;s++)this.handleGraphics.push(new e(null,i.handles.default,t));this.enableScaling&&this.layer.addMany(this.handleGraphics)}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this.centerGraphic.visible=!1,this.rotateGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this.handleGraphics.forEach((t=>t.visible=!1))}_updateHandleGraphics(){const t=this._getCoordinates(!0);this.handleGraphics.forEach(((e,i)=>{const[s,r]=t[i];this._updateXY(e,s,r)}))}_updateBackgroundGraphic(){const t=this._getCoordinates();this.backgroundGraphic.geometry=new R({rings:t,spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(l()),r=(i+t)/2,a=(s+e)/2;this.centerGraphic.geometry=new x(r,a,this.view.spatialReference)}_updateRotateGraphic(){if(!this.handleGraphics.length)return;const{x:t,y:e}=this.handleGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this.rotateGraphic.geometry=new x(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this.handleGraphics.length||!this.rotateGraphic||!this.rotateGraphic.geometry)return;const t=this.handleGraphics[1].geometry,e=this.rotateGraphic.geometry;this._rotateLineGraphic.geometry=new M({paths:[[t.x,t.y],[e.x,e.y]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new x(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new x(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new x(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some((t=>t&&a(t.geometry)&&"extent"===t.geometry.type))}_getBoxBounds(t){const e=this.graphics.map((t=>t.geometry));return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,r]=this._getBoxBounds(l());if(t){const t=(e+s)/2,a=(r+i)/2;return[[e,r],[t,r],[s,r],[s,a],[s,i],[t,i],[e,i],[e,a]]}return[[e,r],[s,r],[s,i],[e,i]]}_emitMoveStartEvent(t,e,i){const s=new I(this.graphics,i,t,e);this.emit("move-start",s),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(s)}_emitMoveEvent(t,e,i){const s=new E(this.graphics,i,t,e);this.emit("move",s),this.callbacks.onMove&&this.callbacks.onMove(s)}_emitMoveStopEvent(t,e,i){const s=new C(this.graphics,i,t,e);this.emit("move-stop",s),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(s)}_emitRotateStartEvent(t,e){const i=new O(this.graphics,e,t);this.emit("rotate-start",i),this.callbacks.onRotateStart&&this.callbacks.onRotateStart(i)}_emitRotateEvent(t,e){const i=new j(this.graphics,e,t);this.emit("rotate",i),this.callbacks.onRotate&&this.callbacks.onRotate(i)}_emitRotateStopEvent(t,e){const i=new L(this.graphics,e,t);this.emit("rotate-stop",i),this.callbacks.onRotateStop&&this.callbacks.onRotateStop(i)}_emitScaleStartEvent(t,e,i){const s=new B(this.graphics,i,t,e);this.emit("scale-start",s),this.callbacks.onScaleStart&&this.callbacks.onScaleStart(s)}_emitScaleEvent(t,e,i){const s=new H(this.graphics,i,t,e);this.emit("scale",s),this.callbacks.onScale&&this.callbacks.onScale(s)}_emitScaleStopEvent(t,e,i){const s=new Y(this.graphics,i,t,e);this.emit("scale-stop",s),this.callbacks.onScaleStop&&this.callbacks.onScaleStop(s)}};t([c()],A.prototype,"_rotateLineGraphic",void 0),t([c({readOnly:!0})],A.prototype,"type",void 0),t([c()],A.prototype,"callbacks",void 0),t([c({readOnly:!0})],A.prototype,"centerGraphic",void 0),t([c({readOnly:!0})],A.prototype,"backgroundGraphic",void 0),t([c()],A.prototype,"enableMovement",void 0),t([c()],A.prototype,"enableRotation",void 0),t([c()],A.prototype,"enableScaling",void 0),t([c()],A.prototype,"graphics",void 0),t([c({readOnly:!0})],A.prototype,"handleGraphics",void 0),t([c({value:!0})],A.prototype,"highlightsEnabled",null),t([c()],A.prototype,"layer",void 0),t([c()],A.prototype,"preserveAspectRatio",void 0),t([c({readOnly:!0})],A.prototype,"rotateGraphic",void 0),t([c()],A.prototype,"showCenterGraphic",void 0),t([c({readOnly:!0})],A.prototype,"state",null),t([c({value:N})],A.prototype,"symbols",null),t([c()],A.prototype,"view",void 0),A=t([n("esri.views.draw.support.Box")],A);const P=A;export{P as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Evented.js";import e from"../../../core/Handles.js";import{clone as s}from"../../../core/lang.js";import{destroyMaybe as r,isSome as a,isNone as o}from"../../../core/maybe.js";import{watch as h}from"../../../core/reactiveUtils.js";import{watch as c,whenOnce as n}from"../../../core/watchUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import d from"../../../layers/GraphicsLayer.js";import{cloneMove as m}from"./drawUtils.js";import{addUniqueLayer as v}from"./layerUtils.js";import{GraphicClickEvent as y,GraphicDoubleClickEvent as _,GraphicPointerDownEvent as f,GraphicPointerUpEvent as u,GraphicPointerOutEvent as g,GraphicMoveStartEvent as G,GraphicMoveEvent as w,GraphicMoveStopEvent as b,GraphicPointerOverEvent as k}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as O}from"../../input/InputManager.js";import{GraphicManipulator as M}from"../../interactive/GraphicManipulator.js";import{createScreenPointFromEvent as x}from"../../support/screenUtils.js";import E from"../../../symbols/SimpleMarkerSymbol.js";import j from"../../../symbols/SimpleLineSymbol.js";import H from"../../../symbols/SimpleFillSymbol.js";const P="indicator-symbols";let U=class extends t.EventedAccessor{constructor(i){super(i),this._activeGraphic=null,this._indicators=[],this._dragEvent=null,this._handles=new e,this._hoverGraphic=null,this._initialDragGeometry=null,this._viewHandles=new e,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.indicatorsEnabled=!0,this.layer=new d({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.view=null}initialize(){v(this.view,this.layer),this.refresh(),this._handles.add([c(this,["graphics","graphics.length"],(()=>this.refresh())),n(this,"view.ready",(()=>{this._viewHandles.add([this.view.on("immediate-click",(i=>this._clickHandler(i)),O.TOOL),this.view.on("double-click",(i=>this._doubleClickHandler(i)),O.TOOL),this.view.on("pointer-down",(i=>this._pointerDownHandler(i)),O.TOOL),this.view.on("pointer-move",(i=>this._pointerMoveHandler(i)),O.TOOL),this.view.on("pointer-up",(i=>this._pointerUpHandler(i)),O.TOOL),this.view.on("drag",(i=>this._dragHandler(i)),O.TOOL),this.view.on("key-down",(i=>this._keyDownHandler(i)),O.TOOL)])}))])}destroy(){var i;this._removeIndicators(),null==(i=this.view.map)||i.remove(this.layer),this.layer.destroy(),this.reset(),this._manipulators.forEach((i=>i.destroy())),this._manipulators=null,this._handles=r(this._handles),this._viewHandles=r(this._viewHandles)}get state(){const i=!!this.get("view.ready"),t=!!this.get("graphics.length"),e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_clickHandler(i){const t=this._findTargetGraphic(x(i));if(t){const e=new y(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(x(i));if(t){const e=new _(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick&&this.callbacks.onGraphicDoubleClick(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(x(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new f(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown&&this.callbacks.onGraphicPointerDown(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new u(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp&&this.callbacks.onGraphicPointerUp(r)}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(x(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),a=new g(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",a),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(a)}const r=this.graphics.indexOf(t),a=new k(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",a),void(this.callbacks.onGraphicPointerOver&&this.callbacks.onGraphicPointerOver(a))}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new g(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic||!this._activeGraphic.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:e,y:r}=i,a=this.graphics.indexOf(this._activeGraphic),o=this._dragEvent?e-this._dragEvent.x:0,h=this._dragEvent?r-this._dragEvent.y:0,c=e-i.origin.x,n=r-i.origin.y,l="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,p=m(l,c,n,this.view);if(this._activeGraphic.geometry=p,this.enableMoveAllGraphics&&this.graphics.forEach((i=>{i!==this._activeGraphic&&(i.geometry=m(i.geometry,o,h,this.view))})),this._dragEvent=i,"start"===t){this._initialDragGeometry=s(l);const t=new G(this._activeGraphic,this.graphics,a,e,r,o,h,c,n,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart&&this.callbacks.onGraphicMoveStart(t),t.defaultPrevented&&this._activeGraphic.set("geometry",l)}else if("update"===t){const t=new w(this._activeGraphic,this.graphics,a,e,r,o,h,c,n,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove&&this.callbacks.onGraphicMove(t),t.defaultPrevented&&(this._activeGraphic.geometry=l)}else{const t=new b(this._activeGraphic,this.graphics,a,e,r,o,h,c,n,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop&&this.callbacks.onGraphicMoveStop(t),t.defaultPrevented&&(this.graphics[a].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i);let e=null,s=Number.MAX_VALUE;this._syncLayerViews();const r=this._layerViews.flatMap((i=>"graphicsViews"in i?Array.from(i.graphicsViews(),(i=>i.hitTest(t))).flat():i.graphicsView.hitTest(t))).filter((i=>this.graphics.indexOf(i)>-1));return r.length?r[0]:(this._manipulators.forEach((t=>{const r=t.intersectionDistance(i);a(r)&&r<s&&(s=r,e=t.graphic)})),e)}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=this.view.allLayerViews.find((i=>{const e=i.layer;return"sublayers"in e&&a(e.sublayers)&&!!e.sublayers.find((i=>i===t.layer))||e===t.layer}));e&&i.add(e)}this._layerViews=[...i]}_setUpManipulators(){const{graphics:i,view:t}=this;this._manipulators.forEach((i=>i.destroy())),this._manipulators=null!=i&&i.length?i.map((i=>new M({graphic:i,view:t}))):[]}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=this._getSymbolForIndicator(i),this._indicators.push(t),this._handles.add(h((()=>i.symbol),(()=>this._setUpIndicators())),P)}this.layer.addMany(this._indicators)}}_removeIndicators(){this._handles.remove(P),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach((i=>i.destroy())),this._indicators=[])}_getSymbolForIndicator(i){const t=12;if(o(i.symbol))return null;switch(i.symbol.type){case"cim":return new E({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,a=s===r?r:Math.max(s,r);return new E({xoffset:t,yoffset:e,size:a,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new E({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new H({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new j({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new E({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}};i([l()],U.prototype,"_activeGraphic",void 0),i([l({readOnly:!0})],U.prototype,"type",void 0),i([l()],U.prototype,"callbacks",void 0),i([l()],U.prototype,"enableMoveAllGraphics",void 0),i([l()],U.prototype,"graphics",void 0),i([l()],U.prototype,"indicatorsEnabled",void 0),i([l()],U.prototype,"layer",void 0),i([l({readOnly:!0})],U.prototype,"state",null),i([l()],U.prototype,"view",void 0),U=i([p("esri.views.draw.support.GraphicMover")],U);const S=U;export{S as default};
5
+ import{_ as i}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Evented.js";import e from"../../../core/Handles.js";import{clone as s}from"../../../core/lang.js";import{destroyMaybe as r,isNone as h,isSome as a}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{watch as c,whenOnce as n}from"../../../core/watchUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import d from"../../../layers/GraphicsLayer.js";import{cloneMove as v}from"./drawUtils.js";import g from"./HighlightHelper.js";import{addUniqueLayer as m,findLayerView as _}from"./layerUtils.js";import{GraphicClickEvent as y,GraphicDoubleClickEvent as u,GraphicPointerDownEvent as f,GraphicPointerUpEvent as w,GraphicPointerOutEvent as G,GraphicMoveStartEvent as b,GraphicMoveEvent as k,GraphicMoveStopEvent as O,GraphicPointerOverEvent as H}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as M}from"../../input/InputManager.js";import{GraphicManipulator as x}from"../../interactive/GraphicManipulator.js";import{createScreenPointFromEvent as E}from"../../support/screenUtils.js";import j from"../../../symbols/SimpleMarkerSymbol.js";import U from"../../../symbols/SimpleLineSymbol.js";import P from"../../../symbols/SimpleFillSymbol.js";const S="indicator-symbols";let D=class extends t.EventedAccessor{constructor(i){super(i),this._activeGraphic=null,this._dragEvent=null,this._handles=new e,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._viewHandles=new e,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.indicatorsEnabled=!1,this.layer=new d({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.view=null}initialize(){m(this.view,this.layer),this._highlightHelper=new g({view:this.view}),this.refresh(),this._handles.add([c(this,["graphics","graphics.length"],(()=>this.refresh())),n(this,"view.ready",(()=>{this._viewHandles.add([this.view.on("immediate-click",(i=>this._clickHandler(i)),M.TOOL),this.view.on("double-click",(i=>this._doubleClickHandler(i)),M.TOOL),this.view.on("pointer-down",(i=>this._pointerDownHandler(i)),M.TOOL),this.view.on("pointer-move",(i=>this._pointerMoveHandler(i)),M.TOOL),this.view.on("pointer-up",(i=>this._pointerUpHandler(i)),M.TOOL),this.view.on("drag",(i=>this._dragHandler(i)),M.TOOL),this.view.on("key-down",(i=>this._keyDownHandler(i)),M.TOOL)])})),o((()=>this.view),(i=>{this._highlightHelper.removeAll(),this._highlightHelper.view=i}))])}destroy(){var i;this._removeIndicators(),null==(i=this.view.map)||i.remove(this.layer),this.layer.destroy(),this.reset(),this._manipulators.forEach((i=>i.destroy())),this._manipulators=null,this._handles=r(this._handles),this._viewHandles=r(this._viewHandles)}set highlightsEnabled(i){var t,e;(null==(t=this._highlightHelper)||t.removeAll(),this._set("highlightsEnabled",i),i)&&(null==(e=this._highlightHelper)||e.add(this.graphics))}get state(){const i=!!this.get("view.ready"),t=!!this.get("graphics.length"),e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}_clickHandler(i){const t=this._findTargetGraphic(E(i));if(t){const e=new y(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(E(i));if(t){const e=new u(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick&&this.callbacks.onGraphicDoubleClick(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(E(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new f(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown&&this.callbacks.onGraphicPointerDown(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new w(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp&&this.callbacks.onGraphicPointerUp(r)}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(E(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),h=new G(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",h),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(h)}const r=this.graphics.indexOf(t),h=new H(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",h),void(this.callbacks.onGraphicPointerOver&&this.callbacks.onGraphicPointerOver(h))}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new G(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic||!this._activeGraphic.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:e,y:r}=i,h=this.graphics.indexOf(this._activeGraphic),a=this._dragEvent?e-this._dragEvent.x:0,o=this._dragEvent?r-this._dragEvent.y:0,c=e-i.origin.x,n=r-i.origin.y,l="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,p=v(l,c,n,this.view);if(this._activeGraphic.geometry=p,this.enableMoveAllGraphics&&this.graphics.forEach((i=>{i!==this._activeGraphic&&(i.geometry=v(i.geometry,a,o,this.view))})),this._dragEvent=i,"start"===t){this._initialDragGeometry=s(l);const t=new b(this._activeGraphic,this.graphics,h,e,r,a,o,c,n,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart&&this.callbacks.onGraphicMoveStart(t),t.defaultPrevented&&this._activeGraphic.set("geometry",l)}else if("update"===t){const t=new k(this._activeGraphic,this.graphics,h,e,r,a,o,c,n,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove&&this.callbacks.onGraphicMove(t),t.defaultPrevented&&(this._activeGraphic.geometry=l)}else{const t=new O(this._activeGraphic,this.graphics,h,e,r,a,o,c,n,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop&&this.callbacks.onGraphicMoveStop(t),t.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i);let e=null,s=Number.MAX_VALUE;this._syncLayerViews();const r=this._layerViews.flatMap((i=>"graphicsViews"in i?Array.from(i.graphicsViews(),(i=>i.hitTest(t))).flat():i.graphicsView.hitTest(t))).filter((i=>this.graphics.indexOf(i)>-1));return r.length?r[0]:(this._manipulators.forEach((t=>{const r=t.intersectionDistance(i);a(r)&&r<s&&(s=r,e=t.graphic)})),e)}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=_(this.view,t.layer);e&&i.add(e)}this._layerViews=[...i]}_setUpManipulators(){const{graphics:i,view:t}=this;this._manipulators.forEach((i=>i.destroy())),this._manipulators=null!=i&&i.length?i.map((i=>new x({graphic:i,view:t}))):[]}_setUpHighlights(){this.highlightsEnabled&&this._highlightHelper.add(this.graphics)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=this._getSymbolForIndicator(i),this._indicators.push(t),this._handles.add(o((()=>i.symbol),(()=>this._setUpIndicators())),S)}this.layer.addMany(this._indicators)}}_removeIndicators(){this._handles.remove(S),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach((i=>i.destroy())),this._indicators=[])}_getSymbolForIndicator(i){const t=12;if(h(i.symbol))return null;switch(i.symbol.type){case"cim":return new j({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,h=s===r?r:Math.max(s,r);return new j({xoffset:t,yoffset:e,size:h,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new j({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new P({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new U({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new j({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}};i([l()],D.prototype,"_activeGraphic",void 0),i([l({readOnly:!0})],D.prototype,"type",void 0),i([l()],D.prototype,"callbacks",void 0),i([l()],D.prototype,"enableMoveAllGraphics",void 0),i([l()],D.prototype,"graphics",void 0),i([l({value:!1})],D.prototype,"highlightsEnabled",null),i([l()],D.prototype,"indicatorsEnabled",void 0),i([l()],D.prototype,"layer",void 0),i([l({readOnly:!0})],D.prototype,"state",null),i([l()],D.prototype,"view",void 0),D=i([p("esri.views.draw.support.GraphicMover")],D);const T=D;export{T as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
5
+ import{_ as r}from"../../../chunks/tslib.es6.js";import{HandleOwner as e}from"../../../core/HandleOwner.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{findLayerView as o}from"./layerUtils.js";import{highlightsSupported as i}from"../../support/layerViewUtils.js";let l=class extends e{constructor(r){super(r),this.view=null}get count(){return this.handles.size}add(r){const e=Array.isArray(r)?r:[r];null!=r&&e&&e.length&&e.forEach((r=>this._highlight(r)))}remove(r){const e=Array.isArray(r)?r:[r];null!=r&&e&&e.length&&e.forEach((r=>this._unhighlight(r)))}removeAll(){this.handles.removeAll()}_highlight(r){const e=o(this.view,r.layer);i(e)&&this.handles.add(e.highlight(r),`feature-${r.getObjectId()}`)}_unhighlight(r){r&&this.handles.remove(`feature-${r.getObjectId()}`)}};r([t({readOnly:!0})],l.prototype,"count",null),r([t()],l.prototype,"view",void 0),r([t()],l.prototype,"add",null),l=r([s("esri.views.draw.support.HighlightHelper")],l);const h=l;export{h as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import r from"../../../core/Evented.js";import o from"../../../core/Handles.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,isNone as h,isSome as c,abortMaybe as p,get as l}from"../../../core/maybe.js";import{createTask as d}from"../../../core/promiseUtils.js";import{whenOnce as m,pausable as v}from"../../../core/watchUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{geometryToCoordinates as g,getMidpoint as u}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import f from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as G}from"../../ViewingMode.js";import{SnappingVisualizer2D as b}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as V}from"./drawUtils.js";import M from"./GraphicMover.js";import{addUniqueLayer as w}from"./layerUtils.js";import{settings as S}from"./settings.js";import{ViewEventPriorities as k}from"../../input/InputManager.js";import{SKETCH_KEYS as E}from"../../interactive/keybindings.js";import{EditGeometryOperations as I}from"../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as O}from"../../interactive/snapping/SnappingContext.js";import C from"../../../geometry/Polyline.js";import R from"../../../geometry/Point.js";class j{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class H{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class A{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class T{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class U{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class D{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class F{constructor(e){this.added=e,this.type="vertex-select"}}class z{constructor(e){this.removed=e,this.type="vertex-deselect"}}class L{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class P{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const K=S.reshapeGraphics,N={vertices:{default:new f({style:"circle",size:K.vertex.size,color:K.vertex.color,outline:{color:K.vertex.outlineColor,width:1}}),hover:new f({style:"circle",size:K.vertex.hoverSize,color:K.vertex.hoverColor,outline:{color:K.vertex.hoverOutlineColor,width:1}}),selected:new f({style:"circle",size:K.selected.size,color:K.selected.color,outline:{color:K.selected.outlineColor,width:1}})},midpoints:{default:new f({style:"circle",size:K.midpoint.size,color:K.midpoint.color,outline:{color:K.midpoint.outlineColor,width:1}}),hover:new f({style:"circle",size:K.midpoint.size,color:K.midpoint.color,outline:{color:K.midpoint.outlineColor,width:1}})}},q="esri.views.draw.support.Reshape",B=n.getLogger(q);let J=class extends r.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._handles=new o,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingTask=null,this._stagedVertex=null,this._viewHandles=new o,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.vertexGraphics=new i,this.layer=null,this.midpointGraphics=new i,this.midpointSymbol=new f({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.type="reshape",this.view=null}initialize(){this._setup(),this._handles.add([m(this,"view.ready",(()=>{const{layer:e,view:t}=this;w(t,e),this._viewHandles.add([t.on("key-down",(e=>this._keyDownHandler(e)),k.TOOL)])})),v(this,"graphic",(()=>this.refresh())),v(this,"layer",((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),v(this,"enableMidpoints",(()=>{this.refresh()}))])}destroy(){var e;this._reset(),null==(e=this._mover)||e.destroy(),this._mover=null,this._handles=a(this._handles),this._viewHandles=a(this._viewHandles)}get state(){const e=!!this.get("view.ready"),t=!(!this.get("graphic")||!this.get("layer"));return e&&t?"active":e?"ready":"disabled"}set symbols(e){const{midpoints:t=N.midpoints,vertices:i=N.vertices}=e||{};this._set("symbols",{midpoints:t,vertices:i})}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||!e||h(e.geometry))return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?(this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpGeometryHelper(){const e=this.graphic.geometry;if(h(e)||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new C({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=I.fromGeometry(t,G.Local)}_saveSnappingContextForHandle(e,t){var i;this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new O({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:(null==(i=t.viewEvent)?void 0:i.pointerType)||"mouse",excludeFeature:this.graphic,visualizer:new b(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){c(this.snappingManager)&&this.snappingManager.doneSnapping(),c(this._snappingGraphicsLayer)&&(this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=a(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_getCoordinatesForUI(e){const t=g(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}_setupGraphics(){const e=this.graphic.geometry;if(c(e)&&("polyline"===e.type||"polygon"===e.type)){const t=this._getCoordinatesForUI(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((e,a)=>{var h;const[c,p]=e;o.push(new t({geometry:new R({x:c,y:p,spatialReference:r}),symbol:null==s||null==(h=s.vertices)?void 0:h.default,attributes:{...i,pathIndex:n,pointIndex:a}}))}))})),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((a,h)=>{const[c,p]=a,d=e[h+1]?h+1:0;if("polygon"===l(this.graphic.geometry,"type")||0!==d){const[a,l]=e[d],[m,v]=u([c,p],[a,l]);o.push(new t({geometry:new R({x:m,y:v,spatialReference:r}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:h,pointIndexEnd:d}}))}}))})),o}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const r=t[i],o=t[e];r.x===o.x&&r.y===o.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:r}=this,o=l(t.geometry,"type"),n="point"===o||"multipoint"===o,a=s.concat(i).items;e&&a.push(t),this._mover=new M({enableMoveAllGraphics:!1,indicatorsEnabled:n,graphics:a,view:r,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,r=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:r?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const t=e.graphic,{dx:i,dy:s}=e;if(t===this.graphic)return this._clearSelection(),this._resetGraphics(),this._setUpOperation(e),this._emitMoveStartEvent(i,s),void("point"===this._editGeometryOperations.data.type&&this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))));if(!this.selectedVertices.includes(t)){if(this._clearSelection(),this._isMidpoint(t)){const e=this.graphic.clone(),i=this._createVertexFromMidpoint(t);this._emitVertexAddEvent([t],e,i)}this._addToSelection(t)}this._setUpOperation(e),this._emitReshapeStartEvent(t),this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s;const{operationType:r}=this._activeOperationInfo;"move"===r?"point"===this._editGeometryOperations.data.type?this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))):this._emitMoveEvent(i,s):this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveStopCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s,t===this.graphic?(this._emitMoveStopEvent(),this.refresh()):(this._onHandleMove(t,i,s,e,(()=>this._emitReshapeStopEvent(t))),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._isMidpoint(t)&&this.refresh())}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:r}=t.attributes,[o,n]=e[i][s],[a,h]=e[i][r],[c,p]=u([o,n],[a,h]);t.geometry=new R({x:c,y:p,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:e}){return[(null==e?void 0:e.pathIndex)||0,(null==e?void 0:e.pointIndex)||0]}_getVertexFromEditGeometry(e){const[t,i]=this._getIndicesForVertexGraphic(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,i,s,r){if(p(this._snappingTask),!this._snappingContext)return;const o=e.geometry,n="graphic-move-stop"===s.type;if(c(this.snappingManager)&&this.selectedVertices.length<2&&!n){const s=this.snappingManager;this._stagedVertex=s.update(o,this._snappingContext),this._syncGeometryAfterVertexMove(e,new R(this._stagedVertex),t,i,n),r(),this._snappingTask=d((async a=>{const h=await s.snap(o,this._snappingContext,a);h.valid&&(this._stagedVertex=h.apply(),this._syncGeometryAfterVertexMove(e,new R(this._stagedVertex),t,i,n),r())}))}else{const s=c(this._stagedVertex)?new R(this._stagedVertex):o;this._syncGeometryAfterVertexMove(e,s,t,i,n),r()}}async _syncGeometryAfterVertexMove(e,t,i,s,r=!1){const o=this._editGeometryOperations.data.geometry;if("point"===o.type)e.geometry=t;else{const{x:n,y:a}=t,[h,c]=this._getIndicesForVertexGraphic(e);let p=g(o);const l=p[h].length-1;p[h][c]=[n,a],"polygon"===o.type&&(0===c?p[h][l]=[n,a]:c===l&&(p[h][0]=[n,a])),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,n,a),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===o.type),this._updateMidpointGraphicLocations(p)),this.graphic.geometry=o.clone();const d=this._getVertexFromEditGeometry(e),m=n-d.pos[0],v=a-d.pos[1];this._editGeometryOperations.moveVertices([d],m,v,0),r&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i,s){const{relatedGraphicIndices:r}=t.attributes;for(const o of r){const r=this.vertexGraphics.getItemAt(o),{pathIndex:n,pointIndex:a}=r.attributes;e[n][a]=[i,s],r.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,r){for(const o of this.selectedVertices)if(o!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:a}=o.attributes,h=V(o.geometry,i,s,this.view),c=e[t].length-1;e[t][n]=[h.x,h.y],o.geometry=h,r&&(0===n?e[t][c]=[h.x,h.y]:n===c&&(e[t][0]=[h.x,h.y]));for(const i of a){const t=this.vertexGraphics.getItemAt(i),{pathIndex:s,pointIndex:r}=t.attributes;e[s][r]=[h.x,h.y],t.geometry=h}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default"}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(h(s)||"polygon"!==s.type&&"polyline"!==s.type)return[];const r=s.clone(),o=[],{pathIndex:n,pointIndexStart:a,pointIndexEnd:c}=e.attributes,{x:p,y:l}=e.geometry,d=0===c?a+1:c,m=g(r);return m[n].splice(d,0,[p,l]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},o.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=r,o}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,r=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",r);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){E.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(h(i)||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),r=i.clone();let o=g(r);const n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<o.length;t++){const s=o[t];for(let r=0;r<s.length;r++){const[a,h]=s[r];e===a&&i===h&&(n.push({coordinates:o[t][r],componentIndex:t,vertexIndex:r}),o[t].splice(Number(r),1))}}}if("polygon"===r.type)o=o.filter((e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,r]=e[e.length-1];return(2!==e.length||t!==s||i!==r)&&(t===s&&i===r||e.push(e[0]),!0)})),r.rings=o;else{for(const e of o)1===e.length&&o.splice(o.indexOf(e),1);r.paths=o}this.graphic.geometry=r,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_emitMoveStartEvent(e,t){const i=new T(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new U(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const{totalDx:e,totalDy:t}=this._activeOperationInfo,i=new D(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(i)}_emitReshapeStartEvent(e){const t=new j(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new H(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new A(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new F(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new z(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new L(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new P(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){B.error(new s("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};e([y()],J.prototype,"callbacks",void 0),e([y()],J.prototype,"enableMidpoints",void 0),e([y()],J.prototype,"enableMovement",void 0),e([y()],J.prototype,"enableVertices",void 0),e([y()],J.prototype,"graphic",void 0),e([y({readOnly:!0})],J.prototype,"vertexGraphics",void 0),e([y()],J.prototype,"layer",void 0),e([y({readOnly:!0})],J.prototype,"midpointGraphics",void 0),e([y()],J.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],J.prototype,"selectedVertices",void 0),e([y()],J.prototype,"snappingManager",void 0),e([y({readOnly:!0})],J.prototype,"state",null),e([y({value:N})],J.prototype,"symbols",null),e([y({readOnly:!0})],J.prototype,"type",void 0),e([y()],J.prototype,"view",void 0),J=e([_(q)],J);const Q=J;export{Q as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import r from"../../../core/Evented.js";import o from"../../../core/Handles.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,isNone as h,isSome as c,abortMaybe as p,get as l}from"../../../core/maybe.js";import{createTask as d}from"../../../core/promiseUtils.js";import{whenOnce as m,pausable as v}from"../../../core/watchUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{geometryToCoordinates as g,getMidpoint as u}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import f from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as G}from"../../ViewingMode.js";import{SnappingVisualizer2D as b}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as V}from"./drawUtils.js";import M from"./GraphicMover.js";import w from"./HighlightHelper.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as k}from"./settings.js";import{ViewEventPriorities as E}from"../../input/InputManager.js";import{SKETCH_KEYS as I}from"../../interactive/keybindings.js";import{EditGeometryOperations as O}from"../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as C}from"../../interactive/snapping/SnappingContext.js";import R from"../../../geometry/Polyline.js";import j from"../../../geometry/Point.js";class H{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class A{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class U{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class T{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class D{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class F{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class z{constructor(e){this.added=e,this.type="vertex-select"}}class L{constructor(e){this.removed=e,this.type="vertex-deselect"}}class P{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class K{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const N=k.reshapeGraphics,q={vertices:{default:new f({style:"circle",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new f({style:"circle",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}}),selected:new f({style:"circle",size:N.selected.size,color:N.selected.color,outline:{color:N.selected.outlineColor,width:1}})},midpoints:{default:new f({style:"circle",size:N.midpoint.size,color:N.midpoint.color,outline:{color:N.midpoint.outlineColor,width:1}}),hover:new f({style:"circle",size:N.midpoint.size,color:N.midpoint.color,outline:{color:N.midpoint.outlineColor,width:1}})}},B="esri.views.draw.support.Reshape",J=n.getLogger(B);let Q=class extends r.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._handles=new o,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingTask=null,this._stagedVertex=null,this._viewHandles=new o,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new i,this.midpointSymbol=new f({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.type="reshape",this.vertexGraphics=new i,this.view=null}initialize(){this._highlightHelper=new w({view:this.view}),this._setup(),this._handles.add([m(this,"view.ready",(()=>{const{layer:e,view:t}=this;S(t,e),this._viewHandles.add([t.on("key-down",(e=>this._keyDownHandler(e)),E.TOOL)])})),v(this,"graphic",(()=>this.refresh())),v(this,"layer",((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),v(this,"enableMidpoints",(()=>{this.refresh()}))])}destroy(){var e;this._reset(),null==(e=this._mover)||e.destroy(),this._mover=null,this._handles=a(this._handles),this._viewHandles=a(this._viewHandles)}set highlightsEnabled(e){var t;null==(t=this._highlightHelper)||t.removeAll(),this._set("highlightsEnabled",e),this._setUpHighlights()}get state(){const e=!!this.get("view.ready"),t=!(!this.get("graphic")||!this.get("layer"));return e&&t?"active":e?"ready":"disabled"}set symbols(e){const{midpoints:t=q.midpoints,vertices:i=q.vertices}=e||{};this._set("symbols",{midpoints:t,vertices:i})}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||!e||h(e.geometry))return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?(this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper.add(this.graphic)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(h(e)||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new R({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=O.fromGeometry(t,G.Local)}_saveSnappingContextForHandle(e,t){var i;this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new C({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:(null==(i=t.viewEvent)?void 0:i.pointerType)||"mouse",excludeFeature:this.graphic,visualizer:new b(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper.removeAll(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){c(this.snappingManager)&&this.snappingManager.doneSnapping(),c(this._snappingGraphicsLayer)&&(this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=a(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_getCoordinatesForUI(e){const t=g(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}_setupGraphics(){const e=this.graphic.geometry;if(c(e)&&("polyline"===e.type||"polygon"===e.type)){const t=this._getCoordinatesForUI(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((e,a)=>{var h;const[c,p]=e;o.push(new t({geometry:new j({x:c,y:p,spatialReference:r}),symbol:null==s||null==(h=s.vertices)?void 0:h.default,attributes:{...i,pathIndex:n,pointIndex:a}}))}))})),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((a,h)=>{const[c,p]=a,d=e[h+1]?h+1:0;if("polygon"===l(this.graphic.geometry,"type")||0!==d){const[a,l]=e[d],[m,v]=u([c,p],[a,l]);o.push(new t({geometry:new j({x:m,y:v,spatialReference:r}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:h,pointIndexEnd:d}}))}}))})),o}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const r=t[i],o=t[e];r.x===o.x&&r.y===o.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:r}=this,o=s.concat(i).items;e&&o.push(t),this._mover=new M({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:o,view:r,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,r=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:r?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const t=e.graphic,{dx:i,dy:s}=e;if(t===this.graphic)return this._clearSelection(),this._resetGraphics(),this._setUpOperation(e),this._emitMoveStartEvent(i,s),void("point"===this._editGeometryOperations.data.type&&this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))));if(!this.selectedVertices.includes(t)){if(this._clearSelection(),this._isMidpoint(t)){const e=this.graphic.clone(),i=this._createVertexFromMidpoint(t);this._emitVertexAddEvent([t],e,i)}this._addToSelection(t)}this._setUpOperation(e),this._emitReshapeStartEvent(t),this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s;const{operationType:r}=this._activeOperationInfo;"move"===r?"point"===this._editGeometryOperations.data.type?this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))):this._emitMoveEvent(i,s):this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveStopCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s,t===this.graphic?(this._emitMoveStopEvent(),this.refresh()):(this._onHandleMove(t,i,s,e,(()=>this._emitReshapeStopEvent(t))),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._isMidpoint(t)&&this.refresh())}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:r}=t.attributes,[o,n]=e[i][s],[a,h]=e[i][r],[c,p]=u([o,n],[a,h]);t.geometry=new j({x:c,y:p,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:e}){return[(null==e?void 0:e.pathIndex)||0,(null==e?void 0:e.pointIndex)||0]}_getVertexFromEditGeometry(e){const[t,i]=this._getIndicesForVertexGraphic(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,i,s,r){if(p(this._snappingTask),!this._snappingContext)return;const o=e.geometry,n="graphic-move-stop"===s.type;if(c(this.snappingManager)&&this.selectedVertices.length<2&&!n){const s=this.snappingManager;this._stagedVertex=s.update(o,this._snappingContext),this._syncGeometryAfterVertexMove(e,new j(this._stagedVertex),t,i,n),r(),this._snappingTask=d((async a=>{const h=await s.snap(o,this._snappingContext,a);h.valid&&(this._stagedVertex=h.apply(),this._syncGeometryAfterVertexMove(e,new j(this._stagedVertex),t,i,n),r())}))}else{const s=c(this._stagedVertex)?new j(this._stagedVertex):o;this._syncGeometryAfterVertexMove(e,s,t,i,n),r()}}async _syncGeometryAfterVertexMove(e,t,i,s,r=!1){const o=this._editGeometryOperations.data.geometry;if("point"===o.type)e.geometry=t;else{const{x:n,y:a}=t,[h,c]=this._getIndicesForVertexGraphic(e);let p=g(o);const l=p[h].length-1;p[h][c]=[n,a],"polygon"===o.type&&(0===c?p[h][l]=[n,a]:c===l&&(p[h][0]=[n,a])),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,n,a),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===o.type),this._updateMidpointGraphicLocations(p)),this.graphic.geometry=o.clone();const d=this._getVertexFromEditGeometry(e),m=n-d.pos[0],v=a-d.pos[1];this._editGeometryOperations.moveVertices([d],m,v,0),r&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i,s){const{relatedGraphicIndices:r}=t.attributes;for(const o of r){const r=this.vertexGraphics.getItemAt(o),{pathIndex:n,pointIndex:a}=r.attributes;e[n][a]=[i,s],r.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,r){for(const o of this.selectedVertices)if(o!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:a}=o.attributes,h=V(o.geometry,i,s,this.view),c=e[t].length-1;e[t][n]=[h.x,h.y],o.geometry=h,r&&(0===n?e[t][c]=[h.x,h.y]:n===c&&(e[t][0]=[h.x,h.y]));for(const i of a){const t=this.vertexGraphics.getItemAt(i),{pathIndex:s,pointIndex:r}=t.attributes;e[s][r]=[h.x,h.y],t.geometry=h}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default"}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(h(s)||"polygon"!==s.type&&"polyline"!==s.type)return[];const r=s.clone(),o=[],{pathIndex:n,pointIndexStart:a,pointIndexEnd:c}=e.attributes,{x:p,y:l}=e.geometry,d=0===c?a+1:c,m=g(r);return m[n].splice(d,0,[p,l]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},o.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=r,o}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,r=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",r);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){I.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(h(i)||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),r=i.clone();let o=g(r);const n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<o.length;t++){const s=o[t];for(let r=0;r<s.length;r++){const[a,h]=s[r];e===a&&i===h&&(n.push({coordinates:o[t][r],componentIndex:t,vertexIndex:r}),o[t].splice(Number(r),1))}}}if("polygon"===r.type)o=o.filter((e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,r]=e[e.length-1];return(2!==e.length||t!==s||i!==r)&&(t===s&&i===r||e.push(e[0]),!0)})),r.rings=o;else{for(const e of o)1===e.length&&o.splice(o.indexOf(e),1);r.paths=o}this.graphic.geometry=r,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_emitMoveStartEvent(e,t){const i=new T(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new D(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const{totalDx:e,totalDy:t}=this._activeOperationInfo,i=new F(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(i)}_emitReshapeStartEvent(e){const t=new H(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new A(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new U(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new z(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new L(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new P(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new K(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){J.error(new s("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};e([y()],Q.prototype,"callbacks",void 0),e([y()],Q.prototype,"enableMidpoints",void 0),e([y()],Q.prototype,"enableMovement",void 0),e([y()],Q.prototype,"enableVertices",void 0),e([y()],Q.prototype,"graphic",void 0),e([y({value:!0})],Q.prototype,"highlightsEnabled",null),e([y()],Q.prototype,"layer",void 0),e([y({readOnly:!0})],Q.prototype,"midpointGraphics",void 0),e([y()],Q.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],Q.prototype,"selectedVertices",void 0),e([y()],Q.prototype,"snappingManager",void 0),e([y({readOnly:!0})],Q.prototype,"state",null),e([y({value:q})],Q.prototype,"symbols",null),e([y({readOnly:!0})],Q.prototype,"type",void 0),e([y({readOnly:!0})],Q.prototype,"vertexGraphics",void 0),e([y()],Q.prototype,"view",void 0),Q=e([_(B)],Q);const W=Q;export{W as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- function r(r,e,n){if(!e||!r||!r.map)return;const{map:a}=r,d=a.layers.find((r=>r===e));d||a.add(e,n),null!=n&&a.layers.reorder(d,n)}export{r as addUniqueLayer};
5
+ import{isSome as r}from"../../../core/maybe.js";function e(r,e,n){if(!e||!r||!r.map)return;const{map:a}=r,s=a.layers.find((r=>r===e));s||a.add(e,n),null!=n&&a.layers.reorder(s,n)}function n(e,n){return e.allLayerViews.find((e=>{const a=e.layer;return"sublayers"in a&&r(a.sublayers)&&!!a.sublayers.find((r=>r===n))||a===n}))}export{e as addUniqueLayer,n as findLayerView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import i from"../../core/Logger.js";import{isNone as o}from"../../core/maybe.js";import{createResolver as s}from"../../core/promiseUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{isDOMContainer as n}from"../DOMContainer.js";import{EditableFlag as l}from"./interfaces.js";import{ManipulatorCollection as h}from"./ManipulatorCollection.js";const c=i.getLogger("esri.views.interactive.InteractiveToolBase");let p=class extends e{constructor(t){super(t),this.manipulators=new h,this.updating=!1,this.automaticManipulatorSelection=!0,this._editableFlags=new Map([[l.MANAGER,!0],[l.USER,!0]]),this._creationStartedResolver=s(),this._creationFinishedResolver=s()}set toolState(t){this._set("toolState",t),this._syncVisible()}get active(){return null!=this.view&&this.view.activeTool===this}set visible(t){this._get("visible")!==t&&(this._set("visible",t),this._syncVisible())}get editable(){return this.getEditableFlag(l.USER)}set editable(t){this.setEditableFlag(l.USER,t)}get created(){return"created"===this.toolState}get cursor(){return null}initialize(){this._syncVisible()}destroy(){this.manipulators.destroy(),this._set("view",null)}activate(){o(this.view)?c.error("Can't activate tool if view is not defined."):this.active?c.warn("Tool is already active, ignoring activation request."):(n(this.view)&&this.view.focus(),this.onActivate())}deactivate(){this.active?this.onDeactivate():c.warn("Tool is not active, ignoring deactivation request.")}handleInputEvent(t){this.onInputEvent(t)}handleInputEventAfter(t){this.onInputEventAfter(t)}setEditableFlag(t,e){this._editableFlags.set(t,e),this.manipulators.isToolEditable=this.internallyEditable,this._updateManipulatorAttachment(),t===l.USER&&this.notifyChange("editable"),this.onEditableChange()}getEditableFlag(t){return this._editableFlags.get(t)}whenCreationStarted(){return this._creationStartedResolver.promise}whenCreated(){return this._creationFinishedResolver.promise}rejectCreation(t){"pending"!==this.toolState&&"creating"!==this.toolState||this._creationStartedResolver.resolve(this),this._creationFinishedResolver.reject(t)}onActivate(){}onDeactivate(){}onShow(){}onHide(){}onEditableChange(){}onInputEvent(t){}onInputEventAfter(t){}get internallyEditable(){return this.getEditableFlag(l.USER)&&this.getEditableFlag(l.MANAGER)}startToolCreation(){if("pending"===this.toolState)return this._creationStartedResolver.resolve(this),void(this.toolState="creating");throw new Error(`Unexpected tool state ${this.toolState}`)}finishToolCreation(){switch(this.toolState){case"pending":this.startToolCreation();case"creating":this.created||this._creationFinishedResolver.resolve(this),this.toolState="created";break;case"created":break;default:throw new Error(`Unexpected tool state ${this.toolState}`)}}_syncVisible(){if("pending"!==this.toolState)if(this.visible)this._show();else if(this._hide(),this.active)return void(this.view.activeTool=null)}_show(){this._updateManipulatorAttachment(),this.onShow()}_hide(){this._updateManipulatorAttachment(),this.onHide()}_updateManipulatorAttachment(){this.visible?this.manipulators.attach():this.manipulators.detach()}};t([a({value:"pending"})],p.prototype,"toolState",null),t([a({constructOnly:!0})],p.prototype,"view",void 0),t([a({readOnly:!0})],p.prototype,"active",null),t([a({value:!0})],p.prototype,"visible",null),t([a({value:!0})],p.prototype,"editable",null),t([a({readOnly:!0})],p.prototype,"created",null),t([a({readOnly:!0})],p.prototype,"manipulators",void 0),t([a({readOnly:!0})],p.prototype,"updating",void 0),t([a()],p.prototype,"cursor",null),t([a()],p.prototype,"automaticManipulatorSelection",void 0),p=t([r("esri.views.interactive.InteractiveToolBase")],p);export{p as InteractiveToolBase};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import i from"../../core/Logger.js";import{isNone as o}from"../../core/maybe.js";import{createResolver as s}from"../../core/promiseUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{isDOMContainer as n}from"../DOMContainer.js";import{EditableFlag as l}from"./interfaces.js";import{ManipulatorCollection as h}from"./ManipulatorCollection.js";const c=i.getLogger("esri.views.interactive.InteractiveToolBase");let p=class extends e{constructor(t){super(t),this.manipulators=new h,this.updating=!1,this.automaticManipulatorSelection=!0,this._editableFlags=new Map([[l.MANAGER,!0],[l.USER,!0]]),this._creationStartedResolver=s(),this._creationFinishedResolver=s()}set toolState(t){this._set("toolState",t),this._syncVisible()}get active(){return null!=this.view&&this.view.activeTool===this}set visible(t){this._get("visible")!==t&&(this._set("visible",t),this._syncVisible())}get editable(){return this.getEditableFlag(l.USER)}set editable(t){this.setEditableFlag(l.USER,t)}get created(){return"created"===this.toolState}get cursor(){return null}initialize(){this._syncVisible()}destroy(){this.manipulators.destroy(),this._set("view",null)}activate(){o(this.view)?c.error("Can't activate tool if view is not defined."):(n(this.view)&&this.view.focus(),this.onActivate())}deactivate(){this.onDeactivate()}handleInputEvent(t){this.onInputEvent(t)}handleInputEventAfter(t){this.onInputEventAfter(t)}setEditableFlag(t,e){this._editableFlags.set(t,e),this.manipulators.isToolEditable=this.internallyEditable,this._updateManipulatorAttachment(),t===l.USER&&this.notifyChange("editable"),this.onEditableChange()}getEditableFlag(t){return this._editableFlags.get(t)}whenCreationStarted(){return this._creationStartedResolver.promise}whenCreated(){return this._creationFinishedResolver.promise}rejectCreation(t){"pending"!==this.toolState&&"creating"!==this.toolState||this._creationStartedResolver.resolve(this),this._creationFinishedResolver.reject(t)}onActivate(){}onDeactivate(){}onShow(){}onHide(){}onEditableChange(){}onInputEvent(t){}onInputEventAfter(t){}get internallyEditable(){return this.getEditableFlag(l.USER)&&this.getEditableFlag(l.MANAGER)}startToolCreation(){if("pending"===this.toolState)return this._creationStartedResolver.resolve(this),void(this.toolState="creating");throw new Error(`Unexpected tool state ${this.toolState}`)}finishToolCreation(){switch(this.toolState){case"pending":this.startToolCreation();case"creating":this.created||this._creationFinishedResolver.resolve(this),this.toolState="created";break;case"created":break;default:throw new Error(`Unexpected tool state ${this.toolState}`)}}_syncVisible(){if("pending"!==this.toolState)if(this.visible)this._show();else if(this._hide(),this.active)return void(this.view.activeTool=null)}_show(){this._updateManipulatorAttachment(),this.onShow()}_hide(){this._updateManipulatorAttachment(),this.onHide()}_updateManipulatorAttachment(){this.visible?this.manipulators.attach():this.manipulators.detach()}};t([r({value:"pending"})],p.prototype,"toolState",null),t([r({constructOnly:!0})],p.prototype,"view",void 0),t([r({readOnly:!0})],p.prototype,"active",null),t([r({value:!0})],p.prototype,"visible",null),t([r({value:!0})],p.prototype,"editable",null),t([r({readOnly:!0})],p.prototype,"created",null),t([r({readOnly:!0})],p.prototype,"manipulators",void 0),t([r({readOnly:!0})],p.prototype,"updating",void 0),t([r()],p.prototype,"cursor",null),t([r()],p.prototype,"automaticManipulatorSelection",void 0),p=t([a("esri.views.interactive.InteractiveToolBase")],p);export{p as InteractiveToolBase};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import t from"../../core/Handles.js";import{isNone as i}from"../../core/maybe.js";import{watch as n,on as d,sync as r}from"../../core/reactiveUtils.js";import{schedule as a}from"../../core/scheduling.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";let c=class extends s{constructor(){super(...arguments),this.updating=!1,this.handleId=0,this.handles=new t,this.scheduleHandleId=0,this.pendingPromises=new Set}destroy(){this.removeAll(),this.handles.destroy()}add(e,s,t={}){const i=++this.handleId;t.sync||this._installSyncUpdatingWatch(e,i);const d=n(e,s,t);return this.handles.add(d,i),{remove:()=>this.handles.remove(i)}}addOnCollectionChange(e,s,{initial:t=!1}={}){const i=++this.handleId;return this.handles.add([d(e,"after-changes",this._createSyncUpdatingCallback(),r),d(e,"change",s,{onListenerAdd:t?e=>s({added:e.toArray(),removed:[]}):void 0})],i),{remove:()=>this.handles.remove(i)}}addPromise(e){if(i(e))return e;const s=++this.handleId;this.handles.add({remove:()=>{this.pendingPromises.delete(e)&&(0!==this.pendingPromises.size||this.handles.has(l)||this._set("updating",!1))}},s),this.pendingPromises.add(e),this._set("updating",!0);const t=()=>this.handles.remove(s);return e.then(t,t),e}removeAll(){this.pendingPromises.clear(),this.handles.removeAll(),this._set("updating",!1)}_installSyncUpdatingWatch(e,s){const t=this._createSyncUpdatingCallback(),i=n(e,t,{sync:!0,equals:()=>!1});return this.handles.add(i,s),i}_createSyncUpdatingCallback(){return()=>{this.handles.remove(l),++this.scheduleHandleId;const e=this.scheduleHandleId;this._get("updating")||this._set("updating",!0),this.handles.add(a((()=>{e===this.scheduleHandleId&&(this._set("updating",this.pendingPromises.size>0),this.handles.remove(l))})),l)}}};e([o({readOnly:!0})],c.prototype,"updating",void 0),c=e([h("esri.views.support.WatchUpdatingTracking")],c);const l=-42;var p;!function(e){e[e.NONE=0]="NONE",e[e.SYNC=1]="SYNC",e[e.INIT=2]="INIT"}(p||(p={}));export{p as WatchFlags,c as WatchUpdatingTracking};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import t from"../../core/Handles.js";import{isNone as i}from"../../core/maybe.js";import{watch as n,when as d,on as r,sync as a}from"../../core/reactiveUtils.js";import{schedule as h}from"../../core/scheduling.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";let c=class extends s{constructor(){super(...arguments),this.updating=!1,this.handleId=0,this.handles=new t,this.scheduleHandleId=0,this.pendingPromises=new Set}destroy(){this.removeAll(),this.handles.destroy()}add(e,s,t={}){return this._installWatch(e,s,t,n)}addWhen(e,s,t={}){return this._installWatch(e,s,t,d)}addOnCollectionChange(e,s,{initial:t=!1}={}){const i=++this.handleId;return this.handles.add([r(e,"after-changes",this._createSyncUpdatingCallback(),a),r(e,"change",s,{onListenerAdd:t?e=>s({added:e.toArray(),removed:[]}):void 0})],i),{remove:()=>this.handles.remove(i)}}addPromise(e){if(i(e))return e;const s=++this.handleId;this.handles.add({remove:()=>{this.pendingPromises.delete(e)&&(0!==this.pendingPromises.size||this.handles.has(p)||this._set("updating",!1))}},s),this.pendingPromises.add(e),this._set("updating",!0);const t=()=>this.handles.remove(s);return e.then(t,t),e}removeAll(){this.pendingPromises.clear(),this.handles.removeAll(),this._set("updating",!1)}_installWatch(e,s,t={},i){const n=++this.handleId;t.sync||this._installSyncUpdatingWatch(e,n);const d=i(e,s,t);return this.handles.add(d,n),{remove:()=>this.handles.remove(n)}}_installSyncUpdatingWatch(e,s){const t=this._createSyncUpdatingCallback(),i=n(e,t,{sync:!0,equals:()=>!1});return this.handles.add(i,s),i}_createSyncUpdatingCallback(){return()=>{this.handles.remove(p),++this.scheduleHandleId;const e=this.scheduleHandleId;this._get("updating")||this._set("updating",!0),this.handles.add(h((()=>{e===this.scheduleHandleId&&(this._set("updating",this.pendingPromises.size>0),this.handles.remove(p))})),p)}}};e([o({readOnly:!0})],c.prototype,"updating",void 0),c=e([l("esri.views.support.WatchUpdatingTracking")],c);const p=-42;var m;!function(e){e[e.NONE=0]="NONE",e[e.SYNC=1]="SYNC",e[e.INIT=2]="INIT"}(m||(m={}));export{m as WatchFlags,c as WatchUpdatingTracking};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as r}from"../../core/promiseUtils.js";import{i as e}from"../../chunks/pe.js";import{canProjectWithoutEngine as t,project as o,load as i}from"../../geometry/projection.js";let n,s=null;async function p(e){s||(s=import("../../portal/support/geometryServiceUtils.js").then((r=>n=r))),await s,r(e)}async function c(r,s,m,a){if(!r)return null;const l=r.spatialReference;return e()||t(l,s)?o(r,s):n?n.projectGeometry(r,s,m,a):(await Promise.race([p(a),i(a)]),c(r,s,m,a))}export{c as projectWithEngineOrService};
5
+ import{throwIfAborted as e}from"../../core/promiseUtils.js";import{isLoaded as r,canProjectWithoutEngine as t,project as o,load as i}from"../../geometry/projection.js";let n,s=null;async function c(r){s||(s=import("../../portal/support/geometryServiceUtils.js").then((e=>n=e))),await s,e(r)}async function p(e,s,a,m){if(!e)return null;const l=e.spatialReference;return r()||t(l,s)?o(e,s):n?n.projectGeometry(e,s,a,m):(await Promise.race([c(m),i(m)]),p(e,s,a,m))}export{p as projectWithEngineOrService};