@arcgis/core 4.28.0-next.20231002 → 4.28.0-rc.0

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 (257) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/02120d192eafd7612475.js +1 -0
  3. package/assets/esri/core/workers/chunks/{4d967e98d229f18d61f5.js → 09e8babe75407c2e64c4.js} +1 -1
  4. package/assets/esri/core/workers/chunks/0beebbb0c6dad0e742d7.js +1 -0
  5. package/assets/esri/core/workers/chunks/0d8ca51043c7784aed96.js +1 -0
  6. package/assets/esri/core/workers/chunks/112e89da628bdea5355c.js +1 -0
  7. package/assets/esri/core/workers/chunks/{5e9edd06e624f385fa4b.js → 121a9e148509f2fe2210.js} +1 -1
  8. package/assets/esri/core/workers/chunks/1856d16d738f44f58084.js +1 -0
  9. package/assets/esri/core/workers/chunks/{0526d623d0b4c12929bd.js → 18ab9cc85a1a7988fdfd.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{7c960a2694c4c3123acf.js → 1a36703ebe934749646e.js} +1 -1
  11. package/assets/esri/core/workers/chunks/24a0cf405195421c0d06.js +1 -0
  12. package/assets/esri/core/workers/chunks/24ff267cf253feac22de.js +1 -0
  13. package/assets/esri/core/workers/chunks/{3c8613596659801fd6ab.js → 29cab345819ec02ed60a.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{169a61c6e128b8a16021.js → 2c560a075d9ef2069ed1.js} +1 -1
  15. package/assets/esri/core/workers/chunks/2f8e71dac98135bbc3e6.js +1 -0
  16. package/assets/esri/core/workers/chunks/341fb51b2165522963b3.js +1 -0
  17. package/assets/esri/core/workers/chunks/{ad8e0f82cb1feafa9e2f.js → 36ab90fb34b9716a9983.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{2688213bbff536da7917.js → 3ea0b872436fce84b927.js} +1 -1
  19. package/assets/esri/core/workers/chunks/40633064c290dc2af9ea.js +1 -0
  20. package/assets/esri/core/workers/chunks/42ec4c80b0c2944cd65c.js +1 -0
  21. package/assets/esri/core/workers/chunks/44b870cb53ba68b17c32.js +1 -0
  22. package/assets/esri/core/workers/chunks/{8a7fa4e8b0d14da7c9eb.js → 4cc680fe4c9c39d2f853.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{6730c9f0890191a95fdb.js → 4d81aa50d90f5701a343.js} +1 -1
  24. package/assets/esri/core/workers/chunks/4e0bf30da4281070e453.js +1 -0
  25. package/assets/esri/core/workers/chunks/4e6bf1efe3b0b474cbb4.js +1 -0
  26. package/assets/esri/core/workers/chunks/52cef7cd3aaaa4f45c94.js +1 -0
  27. package/assets/esri/core/workers/chunks/{4e04242e707c0eb3aa4a.js → 5a3ccc0a19ac8fa9e524.js} +1 -1
  28. package/assets/esri/core/workers/chunks/5e907ec0ee1565b5fbbc.js +1 -0
  29. package/assets/esri/core/workers/chunks/66ba749ab0a631bbfdec.js +1 -0
  30. package/assets/esri/core/workers/chunks/6b14d89d689a21014aec.js +1 -0
  31. package/assets/esri/core/workers/chunks/6b1856303d1562f05100.js +1 -0
  32. package/assets/esri/core/workers/chunks/{576269fd1f9049876aa1.js → 6b7b5544ed1f9a84623f.js} +1 -1
  33. package/assets/esri/core/workers/chunks/710a6268de62003af825.js +1 -0
  34. package/assets/esri/core/workers/chunks/77923afde29ae1ff10ca.js +1 -0
  35. package/assets/esri/core/workers/chunks/784ffd52315a4d55d683.js +1 -0
  36. package/assets/esri/core/workers/chunks/7cf7f2b991a7cbdad2ce.js +1 -0
  37. package/assets/esri/core/workers/chunks/{70dffbf49b0633b1a5f1.js → 8f3680fee85a05839489.js} +1 -1
  38. package/assets/esri/core/workers/chunks/97aecf210938015cc7a3.js +1 -0
  39. package/assets/esri/core/workers/chunks/{c7ebd5d431fb996bfcee.js → 9f8207c82a17508a87a8.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{557305b91f77569ce664.js → a01ffe03b1465c21b9e6.js} +1 -1
  41. package/assets/esri/core/workers/chunks/a298c9031962951e55a9.js +1 -0
  42. package/assets/esri/core/workers/chunks/{329669a9beda89b028dd.js → a5a7bbdd8298016535bc.js} +1 -1
  43. package/assets/esri/core/workers/chunks/a877a4826cd6a46ec99b.js +1 -0
  44. package/assets/esri/core/workers/chunks/ad38e456a7cee940a165.js +1 -0
  45. package/assets/esri/core/workers/chunks/adfbc168be8c49b51e1b.js +1 -0
  46. package/assets/esri/core/workers/chunks/b0526633a93ef69ec47b.js +1 -0
  47. package/assets/esri/core/workers/chunks/b99bc08a01e9250b0a31.js +1 -0
  48. package/assets/esri/core/workers/chunks/{36c4b4c3eca57417da2c.js → c260ad3434bb00ba64a7.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{39922ce232338de076ae.js → c459c8d8630eb4b955b1.js} +1 -1
  50. package/assets/esri/core/workers/chunks/c92e75b79aff7b505b31.js +1 -0
  51. package/assets/esri/core/workers/chunks/ca85e88dad30b5f2956b.js +1 -0
  52. package/assets/esri/core/workers/chunks/{8e56d40691b6bf75d7cc.js → ce409944221a784ddb61.js} +1 -1
  53. package/assets/esri/core/workers/chunks/d13f75f233cf313e5a1d.js +1 -0
  54. package/assets/esri/core/workers/chunks/d60d5f006375f7fcc88c.js +1 -0
  55. package/assets/esri/core/workers/chunks/{77958089748dc31757cf.js → d6ded127949160103f69.js} +1 -1
  56. package/assets/esri/core/workers/chunks/d8c696da42f8f8919b83.js +1 -0
  57. package/assets/esri/core/workers/chunks/{304c81f6297ecba3a324.js → d95eed98316e59f8f35d.js} +1 -1
  58. package/assets/esri/core/workers/chunks/df7267892b6e0493e1d7.js +1 -0
  59. package/assets/esri/core/workers/chunks/{52dca349e1a45555954d.js → e52d5a48e83d8df36f92.js} +1 -1
  60. package/assets/esri/core/workers/chunks/e8688b6cc3b3c1010b43.js +1 -0
  61. package/assets/esri/core/workers/chunks/e8c7cc974420c0b92d0e.js +1 -0
  62. package/assets/esri/core/workers/chunks/{b7ef554b1213307499fc.js → e93442c6d92229f3a4b0.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{ef5772ca1848d6d01b88.js → eda86faa708cfe4c9f9a.js} +1 -1
  64. package/assets/esri/core/workers/chunks/f2718e260f594537f7fd.js +1 -0
  65. package/assets/esri/core/workers/chunks/f6b7036114b1d754fdd9.js +1 -0
  66. package/assets/esri/core/workers/chunks/{c4631241dc777ca77aaa.js → f6c0680c535c5a3c73ee.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{a0ea1d3e22d52b8a59a8.js → fa6103e3d4e857b0035b.js} +9 -9
  68. package/assets/esri/core/workers/chunks/fac3e57784d7f37053af.js +1 -0
  69. package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
  70. package/assets/esri/t9n/common.json +1 -1
  71. package/assets/esri/t9n/common_ar.json +1 -1
  72. package/assets/esri/t9n/common_bg.json +1 -1
  73. package/assets/esri/t9n/common_bs.json +1 -1
  74. package/assets/esri/t9n/common_ca.json +1 -1
  75. package/assets/esri/t9n/common_cs.json +1 -1
  76. package/assets/esri/t9n/common_da.json +1 -1
  77. package/assets/esri/t9n/common_de.json +1 -1
  78. package/assets/esri/t9n/common_el.json +1 -1
  79. package/assets/esri/t9n/common_en.json +1 -1
  80. package/assets/esri/t9n/common_es.json +1 -1
  81. package/assets/esri/t9n/common_et.json +1 -1
  82. package/assets/esri/t9n/common_fi.json +1 -1
  83. package/assets/esri/t9n/common_fr.json +1 -1
  84. package/assets/esri/t9n/common_he.json +1 -1
  85. package/assets/esri/t9n/common_hr.json +1 -1
  86. package/assets/esri/t9n/common_hu.json +1 -1
  87. package/assets/esri/t9n/common_id.json +1 -1
  88. package/assets/esri/t9n/common_it.json +1 -1
  89. package/assets/esri/t9n/common_ja.json +1 -1
  90. package/assets/esri/t9n/common_ko.json +1 -1
  91. package/assets/esri/t9n/common_lt.json +1 -1
  92. package/assets/esri/t9n/common_lv.json +1 -1
  93. package/assets/esri/t9n/common_nb.json +1 -1
  94. package/assets/esri/t9n/common_nl.json +1 -1
  95. package/assets/esri/t9n/common_pl.json +1 -1
  96. package/assets/esri/t9n/common_pt-BR.json +1 -1
  97. package/assets/esri/t9n/common_pt-PT.json +1 -1
  98. package/assets/esri/t9n/common_ro.json +1 -1
  99. package/assets/esri/t9n/common_ru.json +1 -1
  100. package/assets/esri/t9n/common_sk.json +1 -1
  101. package/assets/esri/t9n/common_sl.json +1 -1
  102. package/assets/esri/t9n/common_sr.json +1 -1
  103. package/assets/esri/t9n/common_sv.json +1 -1
  104. package/assets/esri/t9n/common_th.json +1 -1
  105. package/assets/esri/t9n/common_tr.json +1 -1
  106. package/assets/esri/t9n/common_uk.json +1 -1
  107. package/assets/esri/t9n/common_vi.json +1 -1
  108. package/assets/esri/t9n/common_zh-CN.json +1 -1
  109. package/assets/esri/t9n/common_zh-HK.json +1 -1
  110. package/assets/esri/t9n/common_zh-TW.json +1 -1
  111. package/assets/esri/themes/base/widgets/_DirectionalPad.scss +2 -1
  112. package/assets/esri/themes/base/widgets/_FeatureForm.scss +0 -1
  113. package/assets/esri/themes/dark/main.css +1 -1
  114. package/assets/esri/themes/light/main.css +1 -1
  115. package/assets/esri/themes/light/view.css +1 -1
  116. package/chunks/pe-wasm.js +1 -1
  117. package/config.js +1 -1
  118. package/core/pbf.js +1 -1
  119. package/geometry/support/WKIDUnitConversion.js +1 -1
  120. package/geometry/support/plane.js +1 -1
  121. package/interfaces.d.ts +37 -39
  122. package/kernel.js +1 -1
  123. package/layers/GroupLayer.js +1 -1
  124. package/layers/SceneLayer.js +1 -1
  125. package/layers/graphics/data/QueryEngine.js +1 -1
  126. package/layers/graphics/data/QueryEngineResult.js +1 -1
  127. package/layers/graphics/editingSupport.js +1 -1
  128. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  129. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  130. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  131. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  132. package/layers/mixins/OperationalLayer.js +1 -1
  133. package/layers/save/featureLayerUtils.js +1 -1
  134. package/layers/save/groupLayerUtils.js +5 -0
  135. package/layers/save/utils.js +1 -1
  136. package/layers/support/LayerLoadContext.js +5 -0
  137. package/layers/support/featureLayerUtils.js +1 -1
  138. package/layers/support/labelFormatUtils.js +1 -1
  139. package/layers/support/layersCreator.js +1 -1
  140. package/layers/support/versionUtils.js +1 -1
  141. package/networks/UtilityNetwork.js +1 -1
  142. package/package.json +1 -1
  143. package/portal/schemas/definitions.js +1 -1
  144. package/portal/support/jsonContext.js +1 -1
  145. package/portal/support/layersLoader.js +1 -1
  146. package/portal/support/loadUtils.js +5 -0
  147. package/portal/support/portalItemUtils.js +1 -1
  148. package/portal/support/portalLayers.js +1 -1
  149. package/renderers/support/RasterSymbolizer.js +1 -1
  150. package/rest/print.js +1 -1
  151. package/support/basemapUtils.js +1 -1
  152. package/support/revision.js +1 -1
  153. package/symbols/PolygonSymbol3D.js +1 -1
  154. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  155. package/views/2d/engine/imagery/colorizer/shadedrelief.js +1 -1
  156. package/views/2d/engine/imagery/colorizer/stretch.js +1 -1
  157. package/views/2d/input/handlers/KeyPan.js +1 -1
  158. package/views/2d/input/handlers/KeyRotate.js +1 -1
  159. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  160. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  161. package/views/2d/layers/features/support/FeatureSetReaderPBFIndirect.js +1 -1
  162. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  163. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  164. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  165. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  167. package/views/3d/layers/i3s/featureEditing.js +1 -1
  168. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  169. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  170. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  171. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  172. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  173. package/views/DOMContainer.js +1 -1
  174. package/views/draw/DrawGraphicTool.js +1 -1
  175. package/views/draw/DrawOperation.js +1 -1
  176. package/views/draw/support/Box.js +1 -1
  177. package/views/draw/support/Reshape.js +1 -1
  178. package/views/input/VisibilityChange.js +5 -0
  179. package/views/interactive/sketch/constraints.js +1 -1
  180. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  181. package/views/interactive/snapping/FeatureSnappingSourceInfo.js +5 -0
  182. package/views/interactive/snapping/SnappingContext.js +1 -1
  183. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  184. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  185. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  186. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorkerHandle.js +1 -1
  187. package/views/interactive/snapping/snappingUtils.js +1 -1
  188. package/webdoc/support/saveUtils.js +1 -1
  189. package/webdoc/webdocSaveUtils.js +1 -1
  190. package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
  191. package/widgets/DirectionalPad/constants.js +1 -1
  192. package/widgets/DirectionalPad.js +1 -1
  193. package/widgets/Editor/Upload.js +1 -1
  194. package/widgets/Editor/workflowUtils.js +1 -1
  195. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  196. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  197. package/widgets/FeatureForm/FieldInput.js +1 -1
  198. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  199. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  200. package/widgets/FeatureForm.js +1 -1
  201. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  202. package/widgets/FeatureTable/FieldColumn.js +1 -1
  203. package/widgets/FeatureTable/Grid/Column.js +1 -1
  204. package/widgets/FeatureTable.js +1 -1
  205. package/widgets/ScaleRangeSlider.js +1 -1
  206. package/widgets/support/DatePicker.js +1 -1
  207. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  208. package/widgets/support/Selector2D/SelectionOperation2D.js +1 -1
  209. package/widgets/support/Selector2D.js +1 -1
  210. package/widgets/support/TimePicker.js +1 -1
  211. package/widgets/support/dateUtils.js +1 -1
  212. package/assets/esri/core/workers/chunks/027f8b57565c65fbccda.js +0 -1
  213. package/assets/esri/core/workers/chunks/048265fb5953350e3e33.js +0 -1
  214. package/assets/esri/core/workers/chunks/0b9cf14f8aafb76c578b.js +0 -1
  215. package/assets/esri/core/workers/chunks/0ebf58c927bfc4c9d4fe.js +0 -1
  216. package/assets/esri/core/workers/chunks/10fd951bd296b2beeeba.js +0 -1
  217. package/assets/esri/core/workers/chunks/1224475f3eefdfd59c76.js +0 -1
  218. package/assets/esri/core/workers/chunks/162b0220e24e9ba72655.js +0 -1
  219. package/assets/esri/core/workers/chunks/1e611cad53b745ee146f.js +0 -1
  220. package/assets/esri/core/workers/chunks/24b1bf1a5d80f43a6c9a.js +0 -1
  221. package/assets/esri/core/workers/chunks/29ed31fd4f9d5cf53686.js +0 -1
  222. package/assets/esri/core/workers/chunks/2b6d1c8e4ed759767827.js +0 -1
  223. package/assets/esri/core/workers/chunks/34b44b0fab88f838885c.js +0 -1
  224. package/assets/esri/core/workers/chunks/364f55294a1d7bf163d7.js +0 -1
  225. package/assets/esri/core/workers/chunks/3714ab435dd5ccf9e694.js +0 -1
  226. package/assets/esri/core/workers/chunks/3788009a5ece453011f3.js +0 -1
  227. package/assets/esri/core/workers/chunks/3aafe8160b3bfbaa6935.js +0 -1
  228. package/assets/esri/core/workers/chunks/41c002e4c42c581cda8d.js +0 -1
  229. package/assets/esri/core/workers/chunks/47be4c75dd6372b96fe4.js +0 -1
  230. package/assets/esri/core/workers/chunks/4e8d1e6051f6654a5e83.js +0 -1
  231. package/assets/esri/core/workers/chunks/53746e9976758630159b.js +0 -1
  232. package/assets/esri/core/workers/chunks/5449fdd69e12e5cbd12a.js +0 -1
  233. package/assets/esri/core/workers/chunks/57ce4ece0147afb0d43c.js +0 -1
  234. package/assets/esri/core/workers/chunks/5e83d21400a5dec05c81.js +0 -1
  235. package/assets/esri/core/workers/chunks/6047f4487dcd37cca98e.js +0 -1
  236. package/assets/esri/core/workers/chunks/6967d2b3721678b38774.js +0 -1
  237. package/assets/esri/core/workers/chunks/6ac5ca7de651e3d672a1.js +0 -1
  238. package/assets/esri/core/workers/chunks/6b7ee9164149428edb9e.js +0 -1
  239. package/assets/esri/core/workers/chunks/6c495077cc79e1898927.js +0 -1
  240. package/assets/esri/core/workers/chunks/6d43648d5326e01b4474.js +0 -1
  241. package/assets/esri/core/workers/chunks/74fb07de0f990d45af89.js +0 -1
  242. package/assets/esri/core/workers/chunks/8e9a52062ce059153a89.js +0 -1
  243. package/assets/esri/core/workers/chunks/919a57d372419785cd5e.js +0 -1
  244. package/assets/esri/core/workers/chunks/939f0a1a7d605e389e45.js +0 -1
  245. package/assets/esri/core/workers/chunks/9932f23ba6589df14a3d.js +0 -1
  246. package/assets/esri/core/workers/chunks/a25a38c9f338e0beffef.js +0 -1
  247. package/assets/esri/core/workers/chunks/a97581e584336b46ede7.js +0 -1
  248. package/assets/esri/core/workers/chunks/b1cb932cfadc4dc3f1e4.js +0 -1
  249. package/assets/esri/core/workers/chunks/be3fb6113b0b27b94537.js +0 -1
  250. package/assets/esri/core/workers/chunks/c37119f5692e19aa1ce2.js +0 -1
  251. package/assets/esri/core/workers/chunks/c685f16435d9861bbbd0.js +0 -1
  252. package/assets/esri/core/workers/chunks/d5dfc03673aec8aa57e2.js +0 -1
  253. package/assets/esri/core/workers/chunks/e6416a2684866d677b3e.js +0 -1
  254. package/assets/esri/core/workers/chunks/eb01f4cdb9b918cc61e7.js +0 -1
  255. package/assets/esri/core/workers/chunks/eb4aed4fdb44495a4fe6.js +0 -1
  256. package/assets/esri/core/workers/chunks/ec8258c9dc1491e97fc8.js +0 -1
  257. package/assets/esri/core/workers/chunks/eeac53da496de4cd4182.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{g as n,c as r,k as s}from"../../../chunks/vec2.js";import{a as i}from"../../../chunks/vec2f64.js";import{j as o,c as u,g as c,q as a,h as f,a as l,u as h,m as d,s as p,f as m,G as L}from"../../../chunks/vec3.js";import{c as k,g,f as P,d as T}from"../../../chunks/vec3f64.js";import{create as y,intersectLine as q,distance as x,intersectPlanes as z,signedDistance as v,projectPoint as j,fromPositionAndNormal as w,fromPoints as E,normal as A}from"../../../geometry/support/plane.js";import{create as M}from"../../../geometry/support/ray.js";import{k as N,l as Z,p as I,m as G}from"../../../chunks/sphere.js";import{fromVec3 as S,clone as O,fromValues as U}from"./normalizedPoint.js";import{vectorsHaveCloseZ as b,isClose as C,intersectLineLikeAndCircle as F,pointsInsidePlane as H,intersectVerticalPlaneAndVerticalCylinder as R,isPointInsidePlane as Y,projectPointToLineLike as _,projectPointToVerticalCylinder as B,projectPointToVerticalPlane as D,VerticalPlaneType as J,intersectLineLikes as K,intersectVerticalPlaneAndLineLike as Q,intersectLineLikeAndVerticalCylinder as V,intersectVerticalPlanes as W,intersectVerticalCylinders as X,intersectVerticalPlaneAndPoint as $}from"../../support/geometry3dUtils.js";import{LineType as tt}from"../../support/geometry2dUtils.js";class et{intersect(t){return zt(this,t)}closestPoints(t){return[this.closestTo(t)]}}class nt extends et{constructor(t){super(),this.point=t}equals(t){return this===t||Xt(t)&&f(this.point,t.point)}closestTo(){return O(this.point)}}class rt extends et{constructor(t,e,n){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:n}}equals(t){return this===t||$t(t)&&this.lineLike.type===t.lineLike.type&&f(this.start,t.start)&&f(this.end,t.end)}closestTo(t){const e=_(t,this.lineLike);return S(e)}}class st extends rt{constructor(t,e){super(t,e,tt.LINE)}}class it extends rt{constructor(t,e){super(t,e,tt.RAY)}}class ot extends et{constructor(t){super(),this.constraints=t}equals(t){return this===t||Wt(t)&&e(this.constraints,t.constraints,((t,e)=>t.equals(e)))}closestTo(t){let e,n=1/0;for(const r of this.constraints){const s=r.closestTo(t),i=l(t,s);i<n&&(n=i,e=s)}return e?O(e):t}closestPoints(t){return this.constraints.flatMap((e=>e===this?[]:e.closestPoints(t)))}}class ut extends et{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||ne(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=B(t,this.center,this.radius);return S(e)}}class ct extends et{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||re(t)&&f(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=B(t,this.center,this.radius);return e[2]=this.center[2],S(e)}asCircle(){return new at(O(this.center),this.radius,U(0,0,1))}}class at extends et{constructor(t,e,n,r=void 0){super(),this.center=t,this.radius=e,this.normal=n,this.slicePlane=r}equals(t){return this===t||se(t)&&f(this.center,t.center)&&f(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:n}=this;j(this.getPlane(lt),t,ft);const r=h(ft,ft,e),s=d(r);if(C(s,0))return O(t);const i=n/Math.sqrt(s),o=a(k(),e,r,i),{slicePlane:u}=this;if(u&&!Y(u,o)){const e=Et(u,this);return e?.closestTo(t)??O(t)}return S(o)}getPlane(t=y()){return w(this.center,this.normal,t)}}const ft=k(),lt=y();class ht extends et{constructor(t){super(),this.z=t}equals(t){return this===t||te(t)&&this.z===t.z}closestTo(t){return S(P(t[0],t[1],this.z))}getPlane(t=y()){return p(dt,0,0,this.z),w(dt,T,t)}}const dt=k();class pt extends et{constructor(t,e,n){super(),this.start=t,this.end=e,this.planeLike={start:t,end:e,type:n}}equals(t){return this===t||ee(t)&&this.planeLike.type===t.planeLike.type&&f(this.start,t.start)&&f(this.end,t.end)}closestTo(t){return S(D(t,this.planeLike))}closestEndTo(t){const{start:e,end:s}=this;return Math.sign(n(r(mt,s,e),r(Lt,t,e)))>0?s:e}getPlane(t=y()){const e=u(kt,this.end);return e[2]+=1,E(this.start,this.end,e,t)}getSlicePlane(t=y()){const{start:e,end:n,type:r}=this.planeLike;if(r===J.PLANE)return;const s=p(kt,e[0],e[1],0),i=p(gt,n[0],n[1],0),o=m(gt,i,s);return w(s,o,t),t}}const mt=i(),Lt=i(),kt=k(),gt=k();class Pt extends pt{constructor(t,e){super(t,e,J.HALF_PLANE)}}class Tt extends pt{constructor(t,e){super(t,e,J.PLANE)}}class yt extends et{constructor(t,e){super(),this.sphere=N(t,e)}equals(t){return this===t||ie(t)&&Z(this.sphere,t.sphere)}closestTo(t){const e=I(this.sphere,t,k());return S(e)}get center(){return this.sphere}get radius(){return this.sphere[3]}}class qt extends et{constructor(t,e,n){super(),this.start=t,this.end=e,this.getZ=n,this.planeLike={start:t,end:e,type:J.PLANE}}equals(t){return this===t||oe(t)&&f(this.start,t.start)&&f(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return xt(this,t)}addIfOnTheGround(t,e){for(const n of e){const e=this.getZ(n[0],n[1],n[2])??0;C(n[2],e)&&(n[2]=e,t.push(n))}}}function xt(t,e){const n=D(e,t.planeLike);return n[2]=t.getZ(e[0],e[1],e[2])??ue,S(n)}function zt(t,e){if(Wt(t)){const n=[];for(const r of t.constraints){const t=r.intersect(e);t&&n.push(t)}return Vt(n)}if(Wt(e))return zt(e,t);if(oe(t))return Dt(t,e);if(oe(e))return Dt(e,t);if(Xt(t)){const{point:n}=t,r=e.closestTo(n);return L(r,n)?t:void 0}if($t(t)){if(Xt(e))return zt(e,t);if($t(e))return Kt(K(t.lineLike,e.lineLike));if(te(e))return vt(t,e);if(ee(e))return Kt(Q(e.planeLike,t.lineLike));if(ne(e))return Kt(V(t.lineLike,e.center,e.radius));if(se(e))return Kt(F(t.lineLike,e));if(re(e))return jt(t,e);if(ie(e))return wt(t,e)}else if(te(t)){if(Xt(e)||$t(e))return zt(e,t);if(te(e))return At(t,e);if(ee(e))return Mt(t,e);if(ne(e))return Nt(t,e);if(se(e))return It(t,e);if(re(e))return Zt(t,e);if(ie(e))return Gt(t,e)}else if(ee(t)){if(Xt(e)||$t(e)||te(e))return zt(e,t);if(ee(e))return Jt(W(t.planeLike,e.planeLike));if(ne(e))return Jt(R(t.planeLike,e.center,e.radius));if(se(e))return Ot(t,e);if(re(e))return St(t,e);if(ie(e))return Ut(t,e)}else if(ne(t)){if(Xt(e)||$t(e)||te(e)||ee(e))return zt(e,t);if(ne(e))return Jt(X(t.center,t.radius,e.center,e.radius));if(se(e))return bt();if(re(e))return Ct(t,e);if(ie(e))return Ft()}else if(se(t)){if(Xt(e)||$t(e)||te(e)||ee(e)||ne(e))return zt(e,t);if(se(e))return Ht();if(re(e))return Ht(e.asCircle());if(ie(e))return Rt()}else if(re(t)){if(Xt(e)||$t(e)||te(e)||ee(e)||ne(e)||se(e))return zt(e,t);if(re(e))return Yt(e,t);if(ie(e))return _t()}else if(ie(t)){if(Xt(e)||$t(e)||te(e)||ee(e)||ne(e)||re(e))return zt(e,t);if(ie(e))return Bt()}}const vt=(()=>{const t=y();return(e,n)=>{const{start:r,end:s}=e;if(b(r,s)&&C(r[2],n.z))return e;const i=k();return q(n.getPlane(t),r,s,i)?new nt(S(i)):void 0}})();function jt({lineLike:t},{center:e,radius:n}){const r=e[2];return Kt(V(t,e,n).filter((t=>C(t[2],r))))}function wt({lineLike:t},{sphere:e}){return Kt(G(e,t.start,t.end))}const Et=(()=>{const t=M(),e=y(),n={start:k(),end:k(),type:tt.LINE};return(r,s,i)=>{const a=s.normal,f=s.center;if(C(o(a,A(r)),1)){return C(x(r,f),0)?s:void 0}if(!z(r,s.getPlane(e),t))return;u(n.start,t.origin),c(n.end,t.origin,t.direction);const l=F(n,s);return Kt(i?H(i,l):l)}})();function At(t,e){return C(t.z,e.z)?t:void 0}function Mt({z:t},{planeLike:e}){const[n,r]=e.start,[s,i]=e.end,o=U(n,r,t),u=U(s,i,t);return e.type===J.PLANE?new st(o,u):new it(o,u)}function Nt(t,e){const[n,r]=e.center;return new ct(U(n,r,t.z),e.radius)}function Zt(t,e){return C(e.center[2],t.z)?e:void 0}const It=(()=>{const t=y();return(e,n)=>Et(e.getPlane(t),n)})();function Gt(t,{center:e,radius:n}){const r=Math.abs(e[2]-t.z);if(r>n&&!C(r,n))return;const s=U(e[0],e[1],t.z),i=Math.sqrt(n**2-r**2);return C(i,0)?void 0:new ct(s,i)}const St=(()=>{const t=y();return(e,{center:n,radius:r})=>{const s=R(e.planeLike,n,r),i=n[2];e.getSlicePlane(t);const o=[];for(const[u,c]of s){const e=[u,c,i];Y(t,e)&&o.push(e)}return Kt(o)}})(),Ot=(()=>{const t=y(),e=y();return(n,r)=>Et(n.getPlane(t),r,n.getSlicePlane(e))})(),Ut=(()=>{const t=y();return(e,{center:n,radius:r})=>{const s=e.getPlane(t),i=v(s,n),o=Math.abs(i);if(o>r&&!C(o,r))return;const u=g(A(s)),c=a(k(),n,u,i),f=Math.sqrt(r**2-i**2);return C(f,0)?new nt(S(j(s,n,k()))):new at(S(c),f,u,e.getSlicePlane())}})();function bt(t,e){}function Ct(t,e){const n=s(t.center,e.center);if(C(n,0)&&C(t.radius,e.radius))return e;return Qt(X(t.center,t.radius,e.center,e.radius),e.center[2])}function Ft(t,e){}function Ht(t,e){}function Rt(t,e){}function Yt(t,e){if(!b(t.center,e.center))return;const n=s(t.center,e.center);if(C(n,0)&&C(t.radius,e.radius))return t;return Qt(X(t.center,t.radius,e.center,e.radius),t.center[2])}function _t(t,e){}function Bt(t,e){}function Dt(t,e){const{planeLike:n,getZ:r}=t,s=[];if(Xt(e))t.addIfOnTheGround(s,$(n,e.point));else if($t(e))t.addIfOnTheGround(s,Q(n,e.lineLike));else if(ne(e))for(const[i,o]of R(n,e.center,e.radius)){const t=r(i,o,0);null!=t&&s.push(P(i,o,t))}else if(ee(e)||oe(e))for(const[i,o]of W(n,e.planeLike)){const t=r(i,o,0)??ue;s.push(P(i,o,t))}return Kt(s)}function Jt(t){return Vt(t.map((([t,e])=>{const n=U(t,e,0),r=U(t,e,1);return new st(n,r)})))}function Kt(t){return Vt(t.map((t=>t?new nt(S(t)):void 0)))}function Qt(t,e){return Kt(t.map((([t,n])=>[t,n,e])))}function Vt(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new ot(e.filter(t))}function Wt(t){return t instanceof ot}function Xt(t){return t instanceof nt}function $t(t){return t instanceof rt}function te(t){return t instanceof ht}function ee(t){return t instanceof pt}function ne(t){return t instanceof ut}function re(t){return t instanceof ct}function se(t){return t instanceof at}function ie(t){return t instanceof yt}function oe(t){return t instanceof qt}const ue=0;export{at as CircleConstraint,et as Constraint,qt as DrapedLineConstraint,ct as HorizontalCircleConstraint,ht as HorizontalPlaneConstraint,st as LineConstraint,rt as LineLikeConstraint,nt as PointConstraint,it as RayConstraint,ot as SetConstraint,yt as SphereConstraint,ut as VerticalCylinderConstraint,Pt as VerticalHalfPlaneConstraint,Tt as VerticalPlaneConstraint,pt as VerticalPlaneLikeConstraint};
5
+ import{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{g as n,c as r,k as s}from"../../../chunks/vec2.js";import{a as i}from"../../../chunks/vec2f64.js";import{j as o,c as u,g as c,q as a,h as f,a as l,u as h,m as d,s as p,f as m,G as L}from"../../../chunks/vec3.js";import{c as k,g,f as P,d as T}from"../../../chunks/vec3f64.js";import{create as y,intersectLine as q,distance as x,isVertical as v,intersectPlanes as z,signedDistance as j,projectPoint as w,fromPositionAndNormal as E,fromPoints as A,normal as M}from"../../../geometry/support/plane.js";import{create as N}from"../../../geometry/support/ray.js";import{k as Z,l as I,p as G,m as S}from"../../../chunks/sphere.js";import{fromVec3 as O,clone as U,fromValues as b}from"./normalizedPoint.js";import{vectorsHaveCloseZ as C,isClose as F,isPointInsidePlane as H,intersectLineLikeAndCircle as R,pointsInsidePlane as Y,intersectVerticalPlaneAndVerticalCylinder as _,projectPointToLineLike as B,projectPointToVerticalCylinder as D,projectPointToVerticalPlane as J,VerticalPlaneType as K,intersectLineLikes as Q,intersectVerticalPlaneAndLineLike as V,intersectLineLikeAndVerticalCylinder as W,intersectVerticalPlanes as X,intersectVerticalCylinders as $,intersectVerticalPlaneAndPoint as tt}from"../../support/geometry3dUtils.js";import{LineType as et}from"../../support/geometry2dUtils.js";class nt{intersect(t){return zt(this,t)}closestPoints(t){return[this.closestTo(t)]}}class rt extends nt{constructor(t){super(),this.point=t}equals(t){return this===t||$t(t)&&f(this.point,t.point)}closestTo(){return U(this.point)}}class st extends nt{constructor(t,e,n){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:n}}equals(t){return this===t||te(t)&&this.lineLike.type===t.lineLike.type&&f(this.start,t.start)&&f(this.end,t.end)}closestTo(t){const e=B(t,this.lineLike);return O(e)}}class it extends st{constructor(t,e){super(t,e,et.LINE)}}class ot extends st{constructor(t,e){super(t,e,et.RAY)}}class ut extends nt{constructor(t){super(),this.constraints=t}equals(t){return this===t||Xt(t)&&e(this.constraints,t.constraints,((t,e)=>t.equals(e)))}closestTo(t){let e,n=1/0;for(const r of this.constraints){const s=r.closestTo(t),i=l(t,s);i<n&&(n=i,e=s)}return e?U(e):t}closestPoints(t){return this.constraints.flatMap((e=>e===this?[]:e.closestPoints(t)))}}class ct extends nt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||re(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=D(t,this.center,this.radius);return O(e)}}class at extends nt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||se(t)&&f(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=D(t,this.center,this.radius);return e[2]=this.center[2],O(e)}asCircle(){return new ft(U(this.center),this.radius,b(0,0,1))}}class ft extends nt{constructor(t,e,n,r=void 0){super(),this.center=t,this.radius=e,this.normal=n,this.slicePlane=r}equals(t){return this===t||ie(t)&&f(this.center,t.center)&&f(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:n}=this;w(this.getPlane(ht),t,lt);const r=h(lt,lt,e),s=d(r);if(F(s,0))return U(t);const i=n/Math.sqrt(s),o=a(k(),e,r,i),{slicePlane:u}=this;if(u&&!H(u,o)){const e=At(u,this);return e?.closestTo(t)??U(t)}return O(o)}getPlane(t=y()){return E(this.center,this.normal,t)}}const lt=k(),ht=y();class dt extends nt{constructor(t){super(),this.z=t}equals(t){return this===t||ee(t)&&this.z===t.z}closestTo(t){return O(P(t[0],t[1],this.z))}getPlane(t=y()){return p(pt,0,0,this.z),E(pt,T,t)}}const pt=k();class mt extends nt{constructor(t,e,n){super(),this.start=t,this.end=e,this.planeLike={start:t,end:e,type:n}}equals(t){return this===t||ne(t)&&this.planeLike.type===t.planeLike.type&&f(this.start,t.start)&&f(this.end,t.end)}closestTo(t){return O(J(t,this.planeLike))}closestEndTo(t){const{start:e,end:s}=this;return Math.sign(n(r(Lt,s,e),r(kt,t,e)))>0?s:e}getPlane(t=y()){const e=u(gt,this.end);return e[2]+=1,A(this.start,this.end,e,t)}getSlicePlane(t=y()){const{start:e,end:n,type:r}=this.planeLike;if(r===K.PLANE)return;const s=p(gt,e[0],e[1],0),i=p(Pt,n[0],n[1],0),o=m(Pt,i,s);return E(s,o,t),t}}const Lt=i(),kt=i(),gt=k(),Pt=k();class Tt extends mt{constructor(t,e){super(t,e,K.HALF_PLANE)}}class yt extends mt{constructor(t,e){super(t,e,K.PLANE)}}class qt extends nt{constructor(t,e){super(),this.sphere=Z(t,e)}equals(t){return this===t||oe(t)&&I(this.sphere,t.sphere)}closestTo(t){const e=G(this.sphere,t,k());return O(e)}get center(){return this.sphere}get radius(){return this.sphere[3]}}class xt extends nt{constructor(t,e,n){super(),this.start=t,this.end=e,this.getZ=n,this.planeLike={start:t,end:e,type:K.PLANE}}equals(t){return this===t||ue(t)&&f(this.start,t.start)&&f(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return vt(this,t)}addIfOnTheGround(t,e){for(const n of e){const e=this.getZ(n[0],n[1],n[2])??0;F(n[2],e)&&(n[2]=e,t.push(n))}}}function vt(t,e){const n=J(e,t.planeLike);return n[2]=t.getZ(e[0],e[1],e[2])??ce,O(n)}function zt(t,e){if(Xt(t)){const n=[];for(const r of t.constraints){const t=r.intersect(e);t&&n.push(t)}return Wt(n)}if(Xt(e))return zt(e,t);if(ue(t))return Jt(t,e);if(ue(e))return Jt(e,t);if($t(t)){const{point:n}=t,r=e.closestTo(n);return L(r,n)?t:void 0}if(te(t)){if($t(e))return zt(e,t);if(te(e))return Qt(Q(t.lineLike,e.lineLike));if(ee(e))return jt(t,e);if(ne(e))return Qt(V(e.planeLike,t.lineLike));if(re(e))return Qt(W(t.lineLike,e.center,e.radius));if(ie(e))return Qt(R(t.lineLike,e));if(se(e))return wt(t,e);if(oe(e))return Et(t,e)}else if(ee(t)){if($t(e)||te(e))return zt(e,t);if(ee(e))return Mt(t,e);if(ne(e))return Nt(t,e);if(re(e))return Zt(t,e);if(ie(e))return Gt(t,e);if(se(e))return It(t,e);if(oe(e))return St(t,e)}else if(ne(t)){if($t(e)||te(e)||ee(e))return zt(e,t);if(ne(e))return Kt(X(t.planeLike,e.planeLike));if(re(e))return Kt(_(t.planeLike,e.center,e.radius));if(ie(e))return Ut(t,e);if(se(e))return Ot(t,e);if(oe(e))return bt(t,e)}else if(re(t)){if($t(e)||te(e)||ee(e)||ne(e))return zt(e,t);if(re(e))return Kt($(t.center,t.radius,e.center,e.radius));if(ie(e))return Ct();if(se(e))return Ft(t,e);if(oe(e))return Ht()}else if(ie(t)){if($t(e)||te(e)||ee(e)||ne(e)||re(e))return zt(e,t);if(ie(e))return Rt();if(se(e))return Rt(e.asCircle());if(oe(e))return Yt()}else if(se(t)){if($t(e)||te(e)||ee(e)||ne(e)||re(e)||ie(e))return zt(e,t);if(se(e))return _t(e,t);if(oe(e))return Bt()}else if(oe(t)){if($t(e)||te(e)||ee(e)||ne(e)||re(e)||se(e))return zt(e,t);if(oe(e))return Dt()}}const jt=(()=>{const t=y();return(e,n)=>{const{start:r,end:s}=e;if(C(r,s)&&F(r[2],n.z))return e;const i=k();return q(n.getPlane(t),r,s,i)?new rt(O(i)):void 0}})();function wt({lineLike:t},{center:e,radius:n}){const r=e[2];return Qt(W(t,e,n).filter((t=>F(t[2],r))))}function Et({lineLike:t},{sphere:e}){return Qt(S(e,t.start,t.end))}const At=(()=>{const t=N(),e=y(),n={start:k(),end:k(),type:et.LINE};return(r,s,i)=>{const{normal:a,center:f,radius:l}=s,h=o(a,M(r)),d=F(x(r,f),0);if(F(h,1))return d?s:void 0;if(s.getPlane(e),d&&F(h,0)&&v(r)&&v(e)){if(F(l,0))return!i||H(i,f)?new rt(U(f)):void 0;const t=g(f);t[2]+=l;const e=g(f);e[2]-=l;const n=[];return i&&!H(i,t)||n.push(t),i&&!H(i,e)||n.push(e),Qt(n)}if(!z(r,e,t))return;u(n.start,t.origin),c(n.end,t.origin,t.direction);const p=R(n,s);return Qt(i?Y(i,p):p)}})();function Mt(t,e){return F(t.z,e.z)?t:void 0}function Nt({z:t},{planeLike:e}){const[n,r]=e.start,[s,i]=e.end,o=b(n,r,t),u=b(s,i,t);return e.type===K.PLANE?new it(o,u):new ot(o,u)}function Zt(t,e){const[n,r]=e.center;return new at(b(n,r,t.z),e.radius)}function It(t,e){return F(e.center[2],t.z)?e:void 0}const Gt=(()=>{const t=y();return(e,n)=>At(e.getPlane(t),n)})();function St(t,{center:e,radius:n}){const r=Math.abs(e[2]-t.z);if(r>n&&!F(r,n))return;const s=b(e[0],e[1],t.z),i=Math.sqrt(n**2-r**2);return F(i,0)?void 0:new at(s,i)}const Ot=(()=>{const t=y();return(e,{center:n,radius:r})=>{const s=_(e.planeLike,n,r),i=n[2];e.getSlicePlane(t);const o=[];for(const[u,c]of s){const e=[u,c,i];H(t,e)&&o.push(e)}return Qt(o)}})(),Ut=(()=>{const t=y(),e=y();return(n,r)=>At(n.getPlane(t),r,n.getSlicePlane(e))})(),bt=(()=>{const t=y();return(e,{center:n,radius:r})=>{const s=e.getPlane(t),i=j(s,n),o=Math.abs(i);if(o>r&&!F(o,r))return;const u=g(M(s)),c=a(k(),n,u,i),f=Math.sqrt(r**2-i**2);return F(f,0)?new rt(O(w(s,n,k()))):new ft(O(c),f,u,e.getSlicePlane())}})();function Ct(t,e){}function Ft(t,e){const n=s(t.center,e.center);if(F(n,0)&&F(t.radius,e.radius))return e;return Vt($(t.center,t.radius,e.center,e.radius),e.center[2])}function Ht(t,e){}function Rt(t,e){}function Yt(t,e){}function _t(t,e){if(!C(t.center,e.center))return;const n=s(t.center,e.center);if(F(n,0)&&F(t.radius,e.radius))return t;return Vt($(t.center,t.radius,e.center,e.radius),t.center[2])}function Bt(t,e){}function Dt(t,e){}function Jt(t,e){const{planeLike:n,getZ:r}=t,s=[];if($t(e))t.addIfOnTheGround(s,tt(n,e.point));else if(te(e))t.addIfOnTheGround(s,V(n,e.lineLike));else if(re(e))for(const[i,o]of _(n,e.center,e.radius)){const t=r(i,o,0);null!=t&&s.push(P(i,o,t))}else if(ne(e)||ue(e))for(const[i,o]of X(n,e.planeLike)){const t=r(i,o,0)??ce;s.push(P(i,o,t))}return Qt(s)}function Kt(t){return Wt(t.map((([t,e])=>{const n=b(t,e,0),r=b(t,e,1);return new it(n,r)})))}function Qt(t){return Wt(t.map((t=>t?new rt(O(t)):void 0)))}function Vt(t,e){return Qt(t.map((([t,n])=>[t,n,e])))}function Wt(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new ut(e.filter(t))}function Xt(t){return t instanceof ut}function $t(t){return t instanceof rt}function te(t){return t instanceof st}function ee(t){return t instanceof dt}function ne(t){return t instanceof mt}function re(t){return t instanceof ct}function se(t){return t instanceof at}function ie(t){return t instanceof ft}function oe(t){return t instanceof qt}function ue(t){return t instanceof xt}const ce=0;export{ft as CircleConstraint,nt as Constraint,xt as DrapedLineConstraint,at as HorizontalCircleConstraint,dt as HorizontalPlaneConstraint,it as LineConstraint,st as LineLikeConstraint,rt as PointConstraint,ot as RayConstraint,ut as SetConstraint,qt as SphereConstraint,ct as VerticalCylinderConstraint,Tt as VerticalHalfPlaneConstraint,yt as VerticalPlaneConstraint,mt as VerticalPlaneLikeConstraint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{destroyHandle as r}from"../../../core/handleUtils.js";import{allSettledValues as n,throwIfAborted as i}from"../../../core/promiseUtils.js";import{mapCollectionAsync as s,watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{sqlAnd as c}from"../../../core/sql.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{k as p}from"../../../chunks/vec2.js";import{a as d,c as h}from"../../../chunks/vec3.js";import{c as m}from"../../../chunks/vec3f64.js";import{g as y}from"../../../chunks/common.js";import{UpdatingHandles as g}from"../../../core/support/UpdatingHandles.js";import S from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as f}from"../../../layers/support/floorFilterUtils.js";import{absoluteHeightElevationInfo as v}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as w}from"../sketch/constraints.js";import{fromAnyMapPoint as _}from"../sketch/normalizedPoint.js";import{SnappingDomain as j}from"./SnappingDomain.js";import{sortCandidatesInPlace as F,screenDistance as C}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as x}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as b}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as H}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as M,OtherVertexType as R}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as I}from"../support/viewUtils.js";let L=class extends t{get updating(){return this._snappingSources.some((e=>null==e||e.valid&&e.snappingSource.updating))||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=j.FEATURE,this._updatingHandles=new g,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){const e=s((()=>this.options?.featureSources),((e,t)=>this._createSourceInfo(e,t)));this._snappingSources=e,this.addHandles(r(e))}destroy(){this._set("options",null),this._updatingHandles.destroy()}async fetchCandidates(e,t,r,s){if(!(t&this._domain&&null!=this.options&&this.options.effectiveFeatureEnabled))return[];const a=[],o=this._computeScreenSizeDistanceParameters(e,r);for(const n of this._snappingSources){if(null==n||!n.valid||!n.snappingSource.layerSource.enabled||n.layerView?.suspended)continue;const{layerView:t,snappingSource:i}=n,c=this._mergeFetchCandidatesParameters({distance:o,mode:this.view?.type??"2d",point:e,coordinateHelper:r.coordinateHelper,...this._types},t&&"filter"in t?t.filter:null,n&&"floorFilter"in n?n.floorFilter:null);a.push(i.fetchCandidates(c,s).then((e=>e.filter((e=>!this._candidateIsExcluded(i,e,r.excludeFeature))))))}const c=(await n(a)).flat();return this._addRightAngleCandidates(c,e,o,r),i(s),F(e,c),c}_mergeFetchCandidatesParameters(e,t,r){return e.filter=t,r?(e.filter?.where?e.filter.where=c(e.filter.where,r):e.filter=new S({where:r}),e):e}_addRightAngleCandidates(e,t,r,n){const i=null!=n.vertexHandle?n.vertexHandle.rightEdge?.rightVertex?.pos:null!=n.editGeometryOperations&&"polygon"===n.editGeometryOperations.data.type?n.editGeometryOperations.data.components[0]?.getFirstVertex()?.pos:null,s=null!=n.vertexHandle?n.vertexHandle.leftEdge?.leftVertex?.pos:null!=n.editGeometryOperations?n.editGeometryOperations.data.components[0]?.getLastVertex()?.pos:null,{view:a}=this,o=_(i,a,n),c=_(s,a,n),l=e.length;for(let u=0;u<l;u++)this._addRightAngleCandidate(e[u],c,t,r,e),this._addRightAngleCandidate(e[u],o,t,r,e)}_addRightAngleCandidate(e,t,r,n,i){if(null==t||!V(e))return;const s=e.constraint.closestTo(t),a=(s[0]-r[0])/n.x,o=(s[1]-r[1])/n.y,{start:c,end:l}=e.constraint;if(a*a+o*o<=1){const r=new M({targetPoint:s,otherVertex:t,otherVertexType:R.NEXT,previousVertex:p(s,c)>p(s,l)?c:l,constraint:new w(t,s),objectId:e.objectId,isDraped:e.isDraped});i.push(r)}}_computeScreenSizeDistanceParameters(e,t){let r=null!=this.options?this.options.distance*("touch"===t.pointer?this.options.touchSensitivityMultiplier:1):0;return null==this.view?{x:r,y:r,z:r,distance:r}:"2d"===this.view.type?(r*=this.view.resolution,{x:r,y:r,z:r,distance:r}):this._computeScreenSizeDistanceParameters3D(e,r,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,r,n){const{spatialReference:i}=n;r.renderCoordsHelper.toRenderCoords(e,i,z);const s=r.state.camera.computeScreenPixelSizeAt(z),a=s*r.renderCoordsHelper.unitInMeters/r.mapCoordsHelper.unitInMeters,o=t*a,c=I(e,i,v,r),l=c?G(c,e,a,0,0,r,n):0,u=c?G(c,e,0,a,0,r,n):0,p=c?G(c,e,0,0,a,r,n):0;return{x:0===l?0:o/l,y:0===u?0:o/u,z:0===p?0:o/p,distance:s*t}}get _types(){return{returnEdge:!0,returnVertex:!0}}_candidateIsExcluded(e,t,r){if(null==r)return!1;const n=this._getCandidateObjectId(t);if(null==n)return!1;const i=e.layerSource.layer;return"graphics"===i.type?r.uid===n:r.sourceLayer===i&&(!(!r.attributes||!("objectIdField"in i))&&r.attributes[i.objectIdField]===n)}_getCandidateObjectId(e){return e instanceof H?e.objectId:null}async _createSourceInfo(e,t){const r=e.layer;r.loaded||(await r.load(),i(t));const{view:n}=this,s=await this._createFeatureSnappingSourceType(e);return i(t),null==s?O:new P({snappingSource:s,view:n,layer:r})}async _createFeatureSnappingSourceType(e){switch(e.layer.type){case"feature":case"geojson":case"csv":case"oriented-imagery":case"subtype-group":case"wfs":return this._createFeatureSnappingSourceFeatureLayer(e);case"graphics":return this._createFeatureSnappingSourceGraphicsLayer(e);case"map-notes":return this._createFeatureSnappingSourceMapNotesLayer(e);case"scene":case"building-scene":return this._createFeatureSnappingSourceSceneLayer(e)}return null}async _createFeatureSnappingSourceSceneLayer(e){const{view:t}=this;if(null==t||"3d"!==t.type)return null;return new((await this._getSourceModule("scene")).SceneLayerSnappingSource)({layerSource:e,view:t})}async _createFeatureSnappingSourceFeatureLayer(e){switch(e.layer.source?.type){case"feature-layer":case"oriented-imagery":return new((await this._getSourceModule("featureService")).FeatureServiceSnappingSource)({spatialReference:this.spatialReference,view:this.view,layerSource:e});case"memory":case"csv":case"geojson":case"wfs":if("mesh"===e.layer.geometryType)return null;return new((await this._getSourceModule("featureCollection")).FeatureCollectionSnappingSource)({layerSource:e,view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(e){return new((await this._getSourceModule("graphics")).GraphicsSnappingSource)({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _createFeatureSnappingSourceMapNotesLayer(e){return new((await this._getSourceModule("notes")).GraphicsSnappingSource)({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _getSourceModule(e){const t=this._sourceModules[e];if(null==t.loader){const t=this._loadSourceModule(e),r={module:null,loader:t};this._sourceModules[e]=r;const n=await t,i={module:n,loader:t};return this._sourceModules[e]=i,n}return null==t.module?t.loader:t.module}_loadSourceModule(e){const t=this._updatingHandles;switch(e){case"featureService":return t.addPromise(import("./featureSources/FeatureServiceSnappingSource.js"));case"featureCollection":return t.addPromise(import("./featureSources/FeatureCollectionSnappingSource.js"));case"graphics":case"notes":return t.addPromise(import("./featureSources/GraphicsSnappingSource.js"));case"scene":return t.addPromise(import("./featureSources/SceneLayerSnappingSource.js"))}}get test(){return{snappingSources:this._snappingSources}}};e([l({constructOnly:!0})],L.prototype,"spatialReference",void 0),e([l({constructOnly:!0})],L.prototype,"view",void 0),e([l()],L.prototype,"options",void 0),e([l({readOnly:!0})],L.prototype,"updating",null),e([l()],L.prototype,"_snappingSources",void 0),L=e([u("esri.views.interactive.snapping.FeatureSnappingEngine")],L);const O={valid:!1,remove(){}};let P=class extends t{get layerView(){return this.view?.allLayerViews?.find((e=>e.layer===this.layer))}get floorFilter(){const{view:e,layer:t}=this;return e&&t?f({view:e,layer:t}):null}constructor(e){super(e),this.valid=!0}initialize(){const{layer:e,snappingSource:t}=this;if("refresh"in e){const r=e;this.addHandles(r.on("refresh",(()=>t.refresh())))}this.addHandles([a((()=>t.updating),(e=>t.layerSource.updating=e),o),a((()=>t.availability),(e=>t.layerSource.availability=e),o)])}remove(){this.destroy()}destroy(){this.snappingSource.destroy()}};function V(e){return(e instanceof b||e instanceof x)&&!E(e)}function E({constraint:{start:e,end:t}}){const r=d(e,t),n=p(e,t);return r<y()||n/r<D}function G(e,t,r,n,i,s,{spatialReference:a}){const o=h(A,t);o[0]+=r,o[1]+=n,o[2]+=i;const c=I(o,a,v,s);return c?C(c,e):1/0}e([l({constructOnly:!0})],P.prototype,"layer",void 0),e([l({constructOnly:!0})],P.prototype,"snappingSource",void 0),e([l({constructOnly:!0})],P.prototype,"view",void 0),e([l()],P.prototype,"layerView",null),e([l()],P.prototype,"floorFilter",null),P=e([u("esri.views.interactive.snapping.SourceInfoImpl")],P);const z=m(),A=m(),D=1e-4;export{L as FeatureSnappingEngine};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{destroyHandle as r}from"../../../core/handleUtils.js";import{allSettledValues as n,throwIfAborted as a}from"../../../core/promiseUtils.js";import{mapCollectionAsync as s}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{k as c}from"../../../chunks/vec2.js";import{a as u,c as p}from"../../../chunks/vec3.js";import{c as l}from"../../../chunks/vec3f64.js";import{g as d}from"../../../chunks/common.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as h}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as m}from"../sketch/constraints.js";import{fromAnyMapPoint as g}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as f}from"./FeatureSnappingSourceInfo.js";import{SnappingDomain as y}from"./SnappingDomain.js";import{sortCandidatesInPlace as _,screenDistance as v}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as w}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as j}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as F}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as C,OtherVertexType as x}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as M}from"../support/viewUtils.js";let R=class extends t{get updating(){return this._snappingSources.some((e=>null==e||e.valid&&e.snappingSource.updating))||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=y.FEATURE,this._updatingHandles=new S,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){const e=s((()=>this.options?.featureSources),((e,t)=>this._createSourceInfo(e,t)));this._snappingSources=e,this.addHandles(r(e))}destroy(){this._set("options",null),this._updatingHandles.destroy()}async fetchCandidates(e,t,r,s){if(!(t&this._domain&&null!=this.options&&this.options.effectiveFeatureEnabled))return[];const o=[],i=this._computeScreenSizeDistanceParameters(e,r);for(const n of this._snappingSources){if(null==n||!n.valid||!n.snappingSource.layerSource.enabled||n.layerView?.suspended)continue;const t=n.getFetchCandidatesParameters(e,r,i);for(const e of t)o.push(n.snappingSource.fetchCandidates(e,s).then((e=>e.filter((e=>!this._candidateIsExcluded(n.snappingSource,e,r.excludeFeature))))))}const c=(await n(o)).flat();return this._addRightAngleCandidates(c,e,i,r),a(s),_(e,c),c}_addRightAngleCandidates(e,t,r,n){const a=null!=n.vertexHandle?n.vertexHandle.rightEdge?.rightVertex?.pos:null!=n.editGeometryOperations&&"polygon"===n.editGeometryOperations.data.type?n.editGeometryOperations.data.components[0]?.getFirstVertex()?.pos:null,s=null!=n.vertexHandle?n.vertexHandle.leftEdge?.leftVertex?.pos:null!=n.editGeometryOperations?n.editGeometryOperations.data.components[0]?.getLastVertex()?.pos:null,{view:o}=this,i=g(a,o,n),c=g(s,o,n),u=e.length;for(let p=0;p<u;p++)this._addRightAngleCandidate(e[p],c,t,r,e),this._addRightAngleCandidate(e[p],i,t,r,e)}_addRightAngleCandidate(e,t,r,n,a){if(null==t||!b(e))return;const s=e.constraint.closestTo(t),o=(s[0]-r[0])/n.x,i=(s[1]-r[1])/n.y,{start:u,end:p}=e.constraint;if(o*o+i*i<=1){const r=new C({targetPoint:s,otherVertex:t,otherVertexType:x.NEXT,previousVertex:c(s,u)>c(s,p)?u:p,constraint:new m(t,s),objectId:e.objectId,isDraped:e.isDraped});a.push(r)}}_computeScreenSizeDistanceParameters(e,t){let r=null!=this.options?this.options.distance*("touch"===t.pointer?this.options.touchSensitivityMultiplier:1):0;return null==this.view?{x:r,y:r,z:r,distance:r}:"2d"===this.view.type?(r*=this.view.resolution,{x:r,y:r,z:r,distance:r}):this._computeScreenSizeDistanceParameters3D(e,r,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,r,n){const{spatialReference:a}=n;r.renderCoordsHelper.toRenderCoords(e,a,H);const s=r.state.camera.computeScreenPixelSizeAt(H),o=s*r.renderCoordsHelper.unitInMeters/r.mapCoordsHelper.unitInMeters,i=t*o,c=M(e,a,h,r),u=c?L(c,e,o,0,0,r,n):0,p=c?L(c,e,0,o,0,r,n):0,l=c?L(c,e,0,0,o,r,n):0;return{x:0===u?0:i/u,y:0===p?0:i/p,z:0===l?0:i/l,distance:s*t}}_candidateIsExcluded(e,t,r){if(null==r)return!1;const n=this._getCandidateObjectId(t);if(null==n)return!1;const a=e.layerSource.layer;return"graphics"===a.type?r.uid===n:r.sourceLayer===a&&(!(!r.attributes||!("objectIdField"in a))&&r.attributes[a.objectIdField]===n)}_getCandidateObjectId(e){return e instanceof F?e.objectId:null}async _createSourceInfo(e,t){const r=e.layer;r.loaded||(await r.load(),a(t));const{view:n}=this,s=await this._createFeatureSnappingSourceType(e);return a(t),new f(null==s?{}:{snappingSource:s,view:n,layer:r})}async _createFeatureSnappingSourceType(e){switch(e.layer.type){case"feature":case"geojson":case"csv":case"oriented-imagery":case"subtype-group":case"wfs":return this._createFeatureSnappingSourceFeatureLayer(e);case"graphics":return this._createFeatureSnappingSourceGraphicsLayer(e);case"map-notes":return this._createFeatureSnappingSourceMapNotesLayer(e);case"scene":case"building-scene":return this._createFeatureSnappingSourceSceneLayer(e)}return null}async _createFeatureSnappingSourceSceneLayer(e){const{view:t}=this;if(null==t||"3d"!==t.type)return null;return new((await this._getSourceModule("scene")).SceneLayerSnappingSource)({layerSource:e,view:t})}async _createFeatureSnappingSourceFeatureLayer(e){switch(e.layer.source?.type){case"feature-layer":case"oriented-imagery":return new((await this._getSourceModule("featureService")).FeatureServiceSnappingSource)({spatialReference:this.spatialReference,view:this.view,layerSource:e});case"memory":case"csv":case"geojson":case"wfs":if("mesh"===e.layer.geometryType)return null;return new((await this._getSourceModule("featureCollection")).FeatureCollectionSnappingSource)({layerSource:e,view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(e){return new((await this._getSourceModule("graphics")).GraphicsSnappingSource)({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _createFeatureSnappingSourceMapNotesLayer(e){return new((await this._getSourceModule("notes")).GraphicsSnappingSource)({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _getSourceModule(e){const t=this._sourceModules[e];if(null==t.loader){const t=this._loadSourceModule(e),r={module:null,loader:t};this._sourceModules[e]=r;const n=await t,a={module:n,loader:t};return this._sourceModules[e]=a,n}return null==t.module?t.loader:t.module}_loadSourceModule(e){const t=this._updatingHandles;switch(e){case"featureService":return t.addPromise(import("./featureSources/FeatureServiceSnappingSource.js"));case"featureCollection":return t.addPromise(import("./featureSources/FeatureCollectionSnappingSource.js"));case"graphics":case"notes":return t.addPromise(import("./featureSources/GraphicsSnappingSource.js"));case"scene":return t.addPromise(import("./featureSources/SceneLayerSnappingSource.js"))}}get test(){return{snappingSources:this._snappingSources}}};function b(e){return(e instanceof j||e instanceof w)&&!I(e)}function I({constraint:{start:e,end:t}}){const r=u(e,t),n=c(e,t);return r<d()||n/r<P}function L(e,t,r,n,a,s,{spatialReference:o}){const i=p(G,t);i[0]+=r,i[1]+=n,i[2]+=a;const c=M(i,o,h,s);return c?v(c,e):1/0}e([o({constructOnly:!0})],R.prototype,"spatialReference",void 0),e([o({constructOnly:!0})],R.prototype,"view",void 0),e([o()],R.prototype,"options",void 0),e([o({readOnly:!0})],R.prototype,"updating",null),e([o()],R.prototype,"_snappingSources",void 0),R=e([i("esri.views.interactive.snapping.FeatureSnappingEngine")],R);const H=l(),G=l(),P=1e-4;export{R as FeatureSnappingEngine};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Logger.js";import{watch as i,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{sqlAnd as s}from"../../../core/sql.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as p}from"../../../layers/support/floorFilterUtils.js";import{isSubtypeGroupLayer as u,isFeatureLayer as d}from"../../../layers/support/layerUtils.js";import{isUtilityNetworkWebMap as c}from"./snappingUtils.js";let y=class extends r{get layerView(){return this.view?.allLayerViews?.find((e=>e.layer===this.layer))}get valid(){return this._valid}get subtypeFilter(){const{layer:e}=this;if(!u(e)||!e.subtypes?.length)return{mode:"not-in-use",filter:null};const r=e.fieldsIndex.get(e.subtypeField)?.name??e.subtypeField,t=e.sublayers.filter((e=>e.visible)).map((e=>e.subtypeCode));return t.length?t.length===e.subtypes.length?{mode:"all-visible",filter:null}:1===t.length?{mode:"in-use",filter:`${r} = ${t.getItemAt(0)}`}:{mode:"in-use",filter:`${r} IN (${t.join(", ")})`}:{mode:"none-visible",filter:null}}get floorFilter(){const{view:e,layer:r}=this;return e&&r?p({view:e,layer:r}):null}constructor(e){super(e),this.rulesTable=null,this._valid=!1}initialize(){if(!this.snappingSource||!this.layer)return;const{layer:e,snappingSource:r}=this;if("refresh"in e){const t=e;this.addHandles(t.on("refresh",(()=>r.refresh())))}this.loadRules(),this.addHandles([i((()=>r.updating),(e=>r.layerSource.updating=e),l),i((()=>r.availability),(e=>r.layerSource.availability=e),l)])}getFetchCandidatesParameters(e,r,t){if(!this.valid)return[];const{layer:i,layerView:l,floorFilter:o,rulesTable:n,subtypeFilter:p}=this,u={distance:t,mode:this.view?.type??"2d",point:e,coordinateHelper:r.coordinateHelper,...this._types,filter:l&&"filter"in l?l.filter:null};if(o&&(u.filter=f(u.filter,o)),"not-in-use"!==p.mode&&"all-visible"!==p.mode){if("none-visible"===p.mode)return[];u.filter?u.filter.where=s(u.filter.where,p.mode):u.filter=new a({where:p.filter})}if(n){const e=r.feature,t=e?.sourceLayer;if(!(e&&d(i)&&i.layerId&&d(t)&&"loaded"===n.loadStatus))return[];const l=[],s=i.layerId,o=n.getFeatureSQL(t,e)?.[s];if(!o)return[];const a=o.anyVertex;let p=o.endVertex;return p&&a&&p===a&&(p=""),p&&l.push({...u,returnEdge:!1,vertexMode:"ends",filter:f(u.filter,p)}),a&&l.push({...u,returnEdge:!1,vertexMode:"all",filter:f(u.filter,a)}),l}return[u]}async loadRules(){const{layer:e,view:r}=this;if(e&&r&&c(r?.map)&&d(e)){const l=r.map.utilityNetworks?.find((r=>r.isUtilityLayer(e)));if(l)try{this.rulesTable=await l.getRulesTable(),await(this.rulesTable?.load()),this._valid=!0}catch(i){return void t.getLogger("esri.views.interactive.snapping.FeatureSnappingSourceInfo").error("Failed to load rules table for snapping source",e.title)}}else this._valid=!0}get _types(){return{returnEdge:!0,vertexMode:"all"}}remove(){this.destroy()}destroy(){this.snappingSource?.destroy()}};function f(e,r){return null==e?new a({where:r}):e.where?new a({where:s(e.where,r)}):new a({where:r})}e([o({constructOnly:!0})],y.prototype,"layer",void 0),e([o({constructOnly:!0})],y.prototype,"snappingSource",void 0),e([o({constructOnly:!0})],y.prototype,"view",void 0),e([o()],y.prototype,"layerView",null),e([o()],y.prototype,"rulesTable",void 0),e([o()],y.prototype,"valid",null),e([o()],y.prototype,"subtypeFilter",null),e([o()],y.prototype,"floorFilter",null),e([o()],y.prototype,"_valid",void 0),y=e([n("esri.views.interactive.snapping.FeatureSnappingSourceInfo")],y);export{y as FeatureSnappingSourceInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- class e{constructor(e){this.vertexHandle=null,this.excludeFeature=null,this.visualizer=null,this.selfSnappingZ=null,this.editGeometryOperations=e.editGeometryOperations,this.elevationInfo=e.elevationInfo,this.pointer=e.pointer,this.vertexHandle=e.vertexHandle,this.excludeFeature=e.excludeFeature,this.visualizer=e.visualizer,this.selfSnappingZ=e.selfSnappingZ}get coordinateHelper(){return this.editGeometryOperations.data.coordinateHelper}get spatialReference(){return this.coordinateHelper.spatialReference}}export{e as SnappingContext};
5
+ class e{constructor(e){this.vertexHandle=null,this.excludeFeature=null,this.visualizer=null,this.selfSnappingZ=null,this.editGeometryOperations=e.editGeometryOperations,this.elevationInfo=e.elevationInfo,this.pointer=e.pointer,this.vertexHandle=e.vertexHandle,this.excludeFeature=e.excludeFeature,this.feature=e.feature,this.visualizer=e.visualizer,this.selfSnappingZ=e.selfSnappingZ}get coordinateHelper(){return this.editGeometryOperations.data.coordinateHelper}get spatialReference(){return this.coordinateHelper.spatialReference}}export{e as SnappingContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{abortMaybe as n,removeMaybe as e}from"../../../core/maybe.js";import{ignoreAbortErrors as t,debounce as o}from"../../../core/promiseUtils.js";import{watch as i}from"../../../core/reactiveUtils.js";import{pointEquals as r}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{clonePoint as l}from"../../../layers/graphics/hydratedFeatures.js";import{absoluteHeightElevationInfo as a}from"../../../support/elevationInfoUtils.js";import{EventPipeline as s}from"../dragEventPipeline.js";import{SnappingContext as u}from"./SnappingContext.js";import{TaskPriority as c,ImmediateTask as p}from"../../support/Scheduler.js";function f({predicate:o=(()=>!0),snappingManager:r,snappingContext:l,updatingHandles:u,useZ:c=!0}){const p=new s;if(null==r)return{snappingStep:[y,p],cancelSnapping:y};let f,Z=null,j=null,z=null;const T=()=>{Z=n(Z),r.doneSnapping(),j?.frameTask.remove(),j=null,f=e(f),z=null},k=d(r,c,p);let w=null,I=null,U=null;return{snappingStep:[n=>{if(!o(n))return n;const{action:e}=n;if("start"===e){const{info:e}=n,t=m(r.view);if(j=g(l,n,t),j.context.selfSnappingZ=null,!c&&null!=e){const n=S(l.coordinateHelper,e.handle.component);null!=n&&(j.context.selfSnappingZ={value:n,elevationInfo:l.elevationInfo??a})}}if(null!=j){const{context:o,originalScenePos:l,originalPos:a}=j,{mapEnd:s,mapStart:p,scenePoints:d}=n,m=x(a,v(s,p)),g=v(p,a),S={...n,action:"update"},y=j.context,T=P(l,d),C=r.update({point:m,scenePoint:T,context:o});if(U=C,h(s,C,g,c),w=m,I=T,"end"!==e){const{frameTask:n}=j;null==Z&&(Z=new AbortController),z=e=>{u.addPromise(t(k({frameTask:n,event:S,context:y,point:m,scenePoint:T,delta:g,getLastState:()=>({point:w,scenePoint:I,updatePoint:e.forceUpdate?null:U})},Z.signal)))},z({forceUpdate:!1}),null==f&&(f=i((()=>r.options.effectiveEnabled),(()=>z?.({forceUpdate:!0}))))}}return"end"===e&&T(),n},p],cancelSnapping:n=>(T(),n)}}function d(n,e,t){return o((async({frameTask:o,point:i,scenePoint:l,context:a,event:s,delta:u,getLastState:c},p)=>{const f=await o.schedule((()=>n.snap({point:i,scenePoint:l,context:a,signal:p})),p);if(f.valid){let l=await o.schedule((()=>f.apply()),p);const d=c();null!=d.point&&i!==d.point&&(l=n.update({point:d.point,scenePoint:d.scenePoint,context:a})),null!=d.updatePoint&&r(l,d.updatePoint)||(h(s.mapEnd,l,u,e),t.execute(s))}}))}function m(n){return"3d"===n.type?n.resourceController.scheduler.registerTask(c.SNAPPING):p}function g(n,e,t){return{context:new u({editGeometryOperations:n.editGeometryOperations,elevationInfo:n.elevationInfo,pointer:n.pointer,vertexHandle:null!=e.info?e.info.handle:null,excludeFeature:n.excludeFeature,visualizer:n.visualizer}),originalPos:null!=e.snapOrigin?n.coordinateHelper.vectorToDehydratedPoint(e.snapOrigin):e.mapStart,originalScenePos:null!=e.scenePoints?e.scenePoints.sceneStart:null,frameTask:t}}function x(n,[e,t,o]){const i=l(n);return i.x+=e,i.y+=t,i.hasZ&&(i.z+=o),i}function P(n,e){return null==n||null==e?null:x(n,v(e.sceneEnd,e.sceneStart))}function v(n,e){const t=n.hasZ&&e.hasZ?n.z-e.z:0;return[n.x-e.x,n.y-e.y,t]}function h(n,e,[t,o,i],r){n.x=e.x+t,n.y=e.y+o,r&&n.hasZ&&e.hasZ&&(n.z=e.z+i)}function S(n,e){if(!n.hasZ())return null;const t=e.vertices;let o=null;for(const i of t){const e=n.getZ(i.pos);if(null!=o&&null!=e&&Math.abs(e-o)>1e-6)return null;null==o&&(o=e)}return o}function y(n){return n}export{f as createSnapDragEventPipelineStep};
5
+ import{abortMaybe as n,removeMaybe as e}from"../../../core/maybe.js";import{ignoreAbortErrors as t,debounce as o}from"../../../core/promiseUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{pointEquals as i}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{clonePoint as l}from"../../../layers/graphics/hydratedFeatures.js";import{absoluteHeightElevationInfo as a}from"../../../support/elevationInfoUtils.js";import{EventPipeline as s}from"../dragEventPipeline.js";import{SnappingContext as u}from"./SnappingContext.js";import{TaskPriority as c,ImmediateTask as p}from"../../support/Scheduler.js";function f({predicate:o=(()=>!0),snappingManager:i,snappingContext:l,updatingHandles:u,useZ:c=!0}){const p=new s;if(null==i)return{snappingStep:[y,p],cancelSnapping:y};let f,Z=null,j=null,z=null;const T=()=>{Z=n(Z),i.doneSnapping(),j?.frameTask.remove(),j=null,f=e(f),z=null},k=d(i,c,p);let w=null,I=null,U=null;return{snappingStep:[n=>{if(!o(n))return n;const{action:e}=n;if("start"===e){const{info:e}=n,t=m(i.view);if(j=g(l,n,t),j.context.selfSnappingZ=null,!c&&null!=e){const n=S(l.coordinateHelper,e.handle.component);null!=n&&(j.context.selfSnappingZ={value:n,elevationInfo:l.elevationInfo??a})}}if(null!=j){const{context:o,originalScenePos:l,originalPos:a}=j,{mapEnd:s,mapStart:p,scenePoints:d}=n,m=x(a,v(s,p)),g=v(p,a),S={...n,action:"update"},y=j.context,T=P(l,d),C=i.update({point:m,scenePoint:T,context:o});if(U=C,h(s,C,g,c),w=m,I=T,"end"!==e){const{frameTask:n}=j;null==Z&&(Z=new AbortController),z=e=>{u.addPromise(t(k({frameTask:n,event:S,context:y,point:m,scenePoint:T,delta:g,getLastState:()=>({point:w,scenePoint:I,updatePoint:e.forceUpdate?null:U})},Z.signal)))},z({forceUpdate:!1}),null==f&&(f=r((()=>i.options.effectiveEnabled),(()=>z?.({forceUpdate:!0}))))}}return"end"===e&&T(),n},p],cancelSnapping:n=>(T(),n)}}function d(n,e,t){return o((async({frameTask:o,point:r,scenePoint:l,context:a,event:s,delta:u,getLastState:c},p)=>{const f=await o.schedule((()=>n.snap({point:r,scenePoint:l,context:a,signal:p})),p);if(f.valid){let l=await o.schedule((()=>f.apply()),p);const d=c();null!=d.point&&r!==d.point&&(l=n.update({point:d.point,scenePoint:d.scenePoint,context:a})),null!=d.updatePoint&&i(l,d.updatePoint)||(h(s.mapEnd,l,u,e),t.execute(s))}}))}function m(n){return"3d"===n.type?n.resourceController.scheduler.registerTask(c.SNAPPING):p}function g(n,e,t){return{context:new u({editGeometryOperations:n.editGeometryOperations,elevationInfo:n.elevationInfo,pointer:n.pointer,vertexHandle:null!=e.info?e.info.handle:null,excludeFeature:n.excludeFeature,feature:n.feature,visualizer:n.visualizer}),originalPos:null!=e.snapOrigin?n.coordinateHelper.vectorToDehydratedPoint(e.snapOrigin):e.mapStart,originalScenePos:null!=e.scenePoints?e.scenePoints.sceneStart:null,frameTask:t}}function x(n,[e,t,o]){const r=l(n);return r.x+=e,r.y+=t,r.hasZ&&(r.z+=o),r}function P(n,e){return null==n||null==e?null:x(n,v(e.sceneEnd,e.sceneStart))}function v(n,e){const t=n.hasZ&&e.hasZ?n.z-e.z:0;return[n.x-e.x,n.y-e.y,t]}function h(n,e,[t,o,r],i){n.x=e.x+t,n.y=e.y+o,i&&n.hasZ&&e.hasZ&&(n.z=e.z+r)}function S(n,e){if(!n.hasZ())return null;const t=e.vertices;let o=null;for(const r of t){const e=n.getZ(r.pos);if(null!=o&&null!=e&&Math.abs(e-o)>1e-6)return null;null==o&&(o=e)}return o}function y(n){return n}export{f as createSnapDragEventPipelineStep};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyHandle as r}from"../../../../core/handleUtils.js";import{throwIfAborted as i,ignoreAbortErrors as s}from"../../../../core/promiseUtils.js";import{watch as o,initial as a,on as n,sync as l,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import{elevationContextAffectsAlignment as y}from"../../../../support/elevationInfoUtils.js";import{FeatureServiceTiles2D as h}from"../../../2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js";import{FeatureServiceTiles3D as g}from"../../../3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js";import{collectOutFieldsForLayerViewFilter as _,collectOutFieldsForFloorFilter as f}from"../snappingUtils.js";import{convertSnappingCandidate as m,makeGetGroundElevation as S}from"./queryEngineUtils.js";import{WorkerTileTreeDebugger as v}from"./WorkerTileTreeDebugger.js";import{FeatureServiceSnappingSourceWorkerHandle as w}from"./featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js";import{FeatureServiceTilesSimple as b}from"./featureServiceSource/FeatureServiceTilesSimple.js";import H from"../../../support/debugFlags.js";let I=class extends t{get _updateTilesParameters(){return{tiles:this._tilesOfInterest.tiles,tileInfo:this._tilesOfInterest.tileInfo,tileSize:this._tilesOfInterest.tileSize}}get _layerView(){return this.view?.allLayerViews.find((e=>e.layer===this._layer))}get _isSuspended(){return!!this.view&&(!1!==this._layerView?.suspended||!this.layerSource.enabled)}get updating(){return this._workerHandle?.updating||this._updatingHandles.updating}get _outFields(){const{view:e,_layerView:t,layerSource:r}=this,{layer:i}=r,s=_(t,i);return f(i,e,s)}get configuration(){const{view:e}=this,t=null!=e?e.type:"2d";return{filter:this._layer.createQuery(),customParameters:this._layer.customParameters,viewType:t}}get availability(){return this._workerHandle?.availability??0}get _layer(){return this.layerSource.layer}constructor(e){super(e),this._updatingHandles=new c,this._workerHandle=null,this._debug=null}initialize(){let e;const t=this.view;if(null!=t)switch(t.type){case"2d":this._tilesOfInterest=new h({view:t,layer:this._layer}),e=this._workerHandle=new w;break;case"3d":{const{resourceController:r}=t,l=this._layer;this._tilesOfInterest=new g({view:t}),e=this._workerHandle=new w({schedule:e=>r.immediate.schedule(e),hasZ:this._layer.hasZ&&(this._layer.returnZ??!0),elevationAlignPointsInFeatures:async(e,r)=>{const s=await t.whenLayerView(l);return i(r),s.elevationAlignPointsInFeatures(e,r)},queryForSymbologySnapping:async(e,r)=>{const s=await t.whenLayerView(l);return i(r),s.queryForSymbologySnapping(e,r)}}),this.addHandles([t.elevationProvider.on("elevation-change",(({context:t})=>{const{elevationInfo:r}=l;y(t,r)&&s(e.notifyElevationSourceChange())})),o((()=>l.elevationInfo),(()=>s(e.notifyElevationSourceChange())),a),o((()=>this._layerView?.processor?.renderer),(()=>s(e.notifySymbologyChange())),a),o((()=>this._layerView?.symbologySnappingSupported??!1),(t=>s(e.setSymbologySnappingSupported(t))),a),n((()=>this._layerView?.layer),["edits","apply-edits","graphic-update"],(()=>e.notifySymbologyChange()))]);break}}else this._tilesOfInterest=new b({layer:this._layer}),e=this._workerHandle=new w;this.addHandles([r(e)]),s(e.setup({layer:this._layer,spatialReference:this.spatialReference,configuration:this.configuration},null)),this._updatingHandles.add((()=>this._updateTilesParameters),(()=>s(e.updateTiles(this._updateTilesParameters,null))),a),this.addHandles([o((()=>this.configuration),(t=>s(e.configure(t,null))),l),o((()=>this._outFields),(t=>s(e.updateOutFields(t))),a),o((()=>this._isSuspended),(t=>s(e.setSuspended(t))),u)]),null!=t&&this.addHandles(o((()=>H.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES),(i=>{i&&!this._debug?(this._debug=new v({view:t,handle:e}),this.addHandles(r(this._debug),"debug")):!i&&this._debug&&this.removeHandles("debug")}),a)),this.addHandles(this.layerSource.layer.on("apply-edits",(t=>{s(e.applyEdits(t,null))})))}destroy(){this._updatingHandles.destroy()}refresh(){this._workerHandle?.refresh(null)}async fetchCandidates(e,t){const{coordinateHelper:r,point:i}=e;this._tilesOfInterest.pointOfInterest=r.arrayToPoint(i);const s=this._getGroundElevation;return(await this._workerHandle.fetchCandidates({...e},t)).candidates.map((e=>m(e,s)))}getDebugInfo(e){return this._workerHandle.getDebugInfo(e)}get _getGroundElevation(){return S(this.view)}};e([p({constructOnly:!0})],I.prototype,"spatialReference",void 0),e([p({constructOnly:!0})],I.prototype,"layerSource",void 0),e([p({constructOnly:!0})],I.prototype,"view",void 0),e([p()],I.prototype,"_tilesOfInterest",void 0),e([p({readOnly:!0})],I.prototype,"_updateTilesParameters",null),e([p()],I.prototype,"_layerView",null),e([p()],I.prototype,"_isSuspended",null),e([p({readOnly:!0})],I.prototype,"updating",null),e([p()],I.prototype,"_outFields",null),e([p({readOnly:!0})],I.prototype,"configuration",null),e([p({readOnly:!0})],I.prototype,"availability",null),e([p()],I.prototype,"_getGroundElevation",null),I=e([d("esri.views.interactive.snapping.featureSources.FeatureServiceSnappingSource")],I);export{I as FeatureServiceSnappingSource};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{destroyHandle as i}from"../../../../core/handleUtils.js";import{throwIfAborted as s,ignoreAbortErrors as o}from"../../../../core/promiseUtils.js";import{watch as a,initial as n,on as l,sync as u,syncAndInitial as d}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import{isSubtypeGroupLayer as y}from"../../../../layers/support/layerUtils.js";import{elevationContextAffectsAlignment as f}from"../../../../support/elevationInfoUtils.js";import{FeatureServiceTiles2D as g}from"../../../2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js";import{FeatureServiceTiles3D as m}from"../../../3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js";import{isUtilityNetworkWebMap as _}from"../snappingUtils.js";import{convertSnappingCandidate as w,makeGetGroundElevation as S}from"./queryEngineUtils.js";import{WorkerTileTreeDebugger as v}from"./WorkerTileTreeDebugger.js";import{FeatureServiceSnappingSourceWorkerHandle as b}from"./featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js";import{FeatureServiceTilesSimple as I}from"./featureServiceSource/FeatureServiceTilesSimple.js";import H from"../../../support/debugFlags.js";let j=class extends t{get _updateTilesParameters(){return{tiles:this._tilesOfInterest.tiles,tileInfo:this._tilesOfInterest.tileInfo,tileSize:this._tilesOfInterest.tileSize}}get _layerView(){return this.view?.allLayerViews.find((e=>e.layer===this._layer))}get _isSuspended(){if(y(this._layer)){if(!this._layer.sublayers.find((e=>e.visible)))return!0}return!!this.view&&(!1!==this._layerView?.suspended||!this.layerSource.enabled)}get updating(){return this._workerHandle?.updating||this._updatingHandles.updating}get _outFields(){const{view:e,_layerView:t,layerSource:r}=this,{layer:i}=r,{fieldsIndex:s,timeInfo:o,floorInfo:a,subtypeField:n}=i,l=t&&"filter"in t?t.filter:null,u=l?.where&&"1=1"!==l.where?this._getOrLoadWhereFields(l.where,s):[];if(l?.timeExtent&&o){const{startField:e,endField:t}=o,r=s.get(e)?.name??e,i=s.get(t)?.name??t;r&&u.push(r),i&&u.push(i)}if(e?.map&&_(e.map)&&e.map.utilityNetworks?.find((e=>e.isUtilityLayer(i)))){const e=i.fieldsIndex.get("assetGroup")?.name,t=i.fieldsIndex.get("assetType")?.name;e&&t&&(u.push(e),u.push(t))}if(i&&a?.floorField&&e?.floors?.length){const e=s.get(a.floorField)?.name??a.floorField;e&&u.push(e)}if(n){const e=s.get(n)?.name??n;e&&u.push(e)}return new Set(u)}get configuration(){const{view:e}=this,t=null!=e?e.type:"2d";return{filter:this._layer.createQuery(),customParameters:this._layer.customParameters,viewType:t}}get availability(){return this._workerHandle?.availability??0}get _layer(){return this.layerSource.layer}constructor(e){super(e),this._updatingHandles=new c,this._workerHandle=null,this._debug=null}initialize(){let e;const t=this.view;if(null!=t)switch(t.type){case"2d":this._tilesOfInterest=new g({view:t,layer:this._layer}),e=this._workerHandle=new b;break;case"3d":{const{resourceController:r}=t,i=this._layer;this._tilesOfInterest=new m({view:t}),e=this._workerHandle=new b({schedule:e=>r.immediate.schedule(e),hasZ:this._layer.hasZ&&(this._layer.returnZ??!0),elevationAlignPointsInFeatures:async(e,r)=>{const o=await t.whenLayerView(i);return s(r),o.elevationAlignPointsInFeatures(e,r)},queryForSymbologySnapping:async(e,r)=>{const o=await t.whenLayerView(i);return s(r),o.queryForSymbologySnapping(e,r)}}),this.addHandles([t.elevationProvider.on("elevation-change",(({context:t})=>{const{elevationInfo:r}=i;f(t,r)&&o(e.notifyElevationSourceChange())})),a((()=>i.elevationInfo),(()=>o(e.notifyElevationSourceChange())),n),a((()=>this._layerView?.processor?.renderer),(()=>o(e.notifySymbologyChange())),n),a((()=>this._layerView?.symbologySnappingSupported??!1),(t=>o(e.setSymbologySnappingSupported(t))),n),l((()=>this._layerView?.layer),["edits","apply-edits","graphic-update"],(()=>e.notifySymbologyChange()))]);break}}else this._tilesOfInterest=new I({layer:this._layer}),e=this._workerHandle=new b;this.addHandles([i(e)]),o(e.setup({layer:this._layer,spatialReference:this.spatialReference,configuration:this.configuration},null)),this._updatingHandles.add((()=>this._updateTilesParameters),(()=>o(e.updateTiles(this._updateTilesParameters,null))),n),this.addHandles([a((()=>this.configuration),(t=>o(e.configure(t,null))),u),a((()=>this._outFields),(t=>o(e.updateOutFields(t))),n),a((()=>this._isSuspended),(t=>o(e.setSuspended(t))),d)]),null!=t&&this.addHandles(a((()=>H.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES),(r=>{r&&!this._debug?(this._debug=new v({view:t,handle:e}),this.addHandles(i(this._debug),"debug")):!r&&this._debug&&this.removeHandles("debug")}),n)),this.addHandles(this.layerSource.layer.on("apply-edits",(t=>{o(e.applyEdits(t,null))})))}destroy(){this._updatingHandles.destroy()}refresh(){this._workerHandle?.refresh(null)}async fetchCandidates(e,t){const{coordinateHelper:r,point:i}=e;this._tilesOfInterest.pointOfInterest=r.arrayToPoint(i);const s=this._getGroundElevation;return(await this._workerHandle.fetchCandidates({...e},t)).candidates.map((e=>w(e,s)))}getDebugInfo(e){return this._workerHandle.getDebugInfo(e)}get _getGroundElevation(){return S(this.view)}_getOrLoadWhereFields(e,t){const{_whereModule:i}=this;if(!this._loadWhereModuleTask&&!i){const e=r((async()=>{const e=await import("../../../../core/sql/WhereClause.js");return this._whereModule=e.WhereClause,this._whereModule}));return this._loadWhereModuleTask=e,this._updatingHandles.addPromise(e.promise),[]}if(!i)return[];try{return i.create(e,t).fieldNames}catch(s){return[]}}};e([p({constructOnly:!0})],j.prototype,"spatialReference",void 0),e([p({constructOnly:!0})],j.prototype,"layerSource",void 0),e([p({constructOnly:!0})],j.prototype,"view",void 0),e([p()],j.prototype,"_tilesOfInterest",void 0),e([p({readOnly:!0})],j.prototype,"_updateTilesParameters",null),e([p()],j.prototype,"_layerView",null),e([p()],j.prototype,"_isSuspended",null),e([p({readOnly:!0})],j.prototype,"updating",null),e([p()],j.prototype,"_outFields",null),e([p({readOnly:!0})],j.prototype,"configuration",null),e([p({readOnly:!0})],j.prototype,"availability",null),e([p()],j.prototype,"_getGroundElevation",null),e([p()],j.prototype,"_loadWhereModuleTask",void 0),e([p()],j.prototype,"_whereModule",void 0),j=e([h("esri.views.interactive.snapping.featureSources.FeatureServiceSnappingSource")],j);export{j as FeatureServiceSnappingSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import t from"../../../../../core/Evented.js";import{createResolver as i,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{watch as r,whenOnce as n,sync as a}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../../../core/support/UpdatingHandles.js";import p from"../../../../../geometry/SpatialReference.js";import u from"../../../../../layers/graphics/data/FeatureStore.js";import{QueryEngine as c}from"../../../../../layers/graphics/data/QueryEngine.js";import h from"../../../../../layers/support/TileInfo.js";import f from"../../../../../rest/support/Query.js";import g from"../../../../../symbols/support/ElevationInfo.js";import{getSnappingCandidateElevationAligner as m}from"../snappingCandidateElevationAlignment.js";import{getSnappingCandidateElevationFilter as y}from"../snappingCandidateElevationFilter.js";import{getSymbologySnappingCandidatesFetcher as _}from"../symbologySnappingCandidates.js";import{FeatureServiceTiledFetcher as S}from"./FeatureServiceTiledFetcher.js";import{FeatureServiceTileStore as F}from"./FeatureServiceTileStore.js";import{fromJSON as v}from"../../../../../geometry/support/jsonUtils.js";let w=class extends t.EventedAccessor{constructor(){super(...arguments),this._isInitializing=!0,this.remoteClient=null,this._whenSetup=i(),this._elevationAligner=m(),this._elevationFilter=y(),this._symbologyCandidatesFetcher=_(),this._updatingHandles=new d,this._editsUpdatingHandles=new d,this._pendingApplyEdits=new Map,this._alignPointsInFeatures=async(e,t)=>{const i={points:e},r=await this.remoteClient.invoke("alignElevation",i,{signal:t});return s(t),r},this._getSymbologyCandidates=async(e,t)=>{const i={candidates:e,spatialReference:this._spatialReference.toJSON()},r=await this.remoteClient.invoke("getSymbologyCandidates",i,{signal:t});return s(t),r}}get updating(){return this.updatingExcludingEdits||this._editsUpdatingHandles.updating||this._featureFetcher.updating}get updatingExcludingEdits(){return this._featureFetcher.updatingExcludingEdits||this._isInitializing||this._updatingHandles.updating}destroy(){this._featureFetcher?.destroy(),this._queryEngine?.destroy(),this._featureStore?.clear()}async setup(e){if(this.destroyed)return{result:{}};const{geometryType:t,objectIdField:i,timeInfo:s,fieldsIndex:n}=e.serviceInfo,{hasZ:o}=e,l=p.fromJSON(e.spatialReference);this._spatialReference=l,this._featureStore=new u({...e.serviceInfo,hasZ:o,hasM:!1}),this._queryEngine=new c({spatialReference:e.spatialReference,featureStore:this._featureStore,geometryType:t,fieldsIndex:n,hasZ:o,hasM:!1,objectIdField:i,timeInfo:s}),this._featureFetcher=new S({store:new F({featureStore:this._featureStore}),url:e.serviceInfo.url,objectIdField:e.serviceInfo.objectIdField,globalIdField:e.serviceInfo.globalIdField,capabilities:e.serviceInfo.capabilities,spatialReference:l,sourceSpatialReference:p.fromJSON(e.serviceInfo.spatialReference)});const d="3d"===e.configuration.viewType;return this._elevationAligner=m(d,{elevationInfo:null!=e.elevationInfo?g.fromJSON(e.elevationInfo):null,alignPointsInFeatures:this._alignPointsInFeatures,spatialReference:l}),this._elevationFilter=y(d),this.addHandles([r((()=>this._featureFetcher.availability),(e=>this.emit("notify-availability",{availability:e})),a),r((()=>this.updating),(()=>this._notifyUpdating()))]),this._whenSetup.resolve(),this._isInitializing=!1,this.configure(e.configuration)}async configure(e){return await this._updatingHandles.addPromise(this._whenSetup.promise),this._updateFeatureFetcherConfiguration(e),j}async setSuspended(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),this._featureFetcher.suspended=e,j}async updateOutFields(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),this._featureFetcher.outFields=new Set(e??[]),j}async fetchCandidates(e,t){await this._whenSetup.promise,s(t);const i=b(e),r=null!=t?t.signal:null,n=await this._queryEngine.executeQueryForSnapping(i,r);s(r);const a=await this._elevationAligner.alignCandidates(n.candidates,r);s(r);const o=await this._symbologyCandidatesFetcher.fetch(a,r);s(r);const l=0===o.length?a:a.concat(o);return{result:{candidates:this._elevationFilter.filter(i,l)}}}async updateTiles(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),this._featureFetcher.tileSize=e.tileSize,this._featureFetcher.tilesOfInterest=e.tiles,this._featureFetcher.tileInfo=null!=e.tileInfo?h.fromJSON(e.tileInfo):null,j}async refresh(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),this._featureFetcher.refresh(),j}async whenNotUpdating(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),await n((()=>!this.updatingExcludingEdits),t),s(t),j}async getDebugInfo(e,t){return s(t),{result:this._featureFetcher.debugInfo}}async beginApplyEdits(e,t){this._updatingHandles.addPromise(this._whenSetup.promise),s(t);const r=i();return this._pendingApplyEdits.set(e.id,r),this._featureFetcher.applyEdits(r.promise),this._editsUpdatingHandles.addPromise(r.promise),j}async endApplyEdits(e,t){const i=this._pendingApplyEdits.get(e.id);return i&&i.resolve(e.edits),s(t),j}async notifyElevationSourceChange(e,t){return this._elevationAligner.notifyElevationSourceChange(),j}async notifySymbologyChange(e,t){return this._symbologyCandidatesFetcher.notifySymbologyChange(),j}async setSymbologySnappingSupported(e){return this._symbologyCandidatesFetcher=_(e,this._getSymbologyCandidates),j}_updateFeatureFetcherConfiguration(e){this._featureFetcher.filter=null!=e.filter?f.fromJSON(e.filter):null,this._featureFetcher.customParameters=e.customParameters}_notifyUpdating(){this.emit("notify-updating",{updating:this.updating})}};e([o({readOnly:!0})],w.prototype,"updating",null),e([o({readOnly:!0})],w.prototype,"updatingExcludingEdits",null),e([o()],w.prototype,"_isInitializing",void 0),w=e([l("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")],w);const I=w;function b(e){if(!e.filter)return{...e,query:{where:"1=1"}};const{distance:t,units:i,spatialRel:s,where:r,timeExtent:n,objectIds:a}=e.filter,o={geometry:e.filter.geometry?v(e.filter.geometry):void 0,distance:t,units:i,spatialRel:s,timeExtent:n,objectIds:a,where:r??"1=1"};return{...e,query:o}}const j={result:{}};export{I as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import t from"../../../../../core/Evented.js";import{createResolver as i,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{watch as r,whenOnce as n,sync as a}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../../../core/support/UpdatingHandles.js";import p from"../../../../../geometry/SpatialReference.js";import u from"../../../../../layers/graphics/data/FeatureStore.js";import{QueryEngine as c}from"../../../../../layers/graphics/data/QueryEngine.js";import h from"../../../../../layers/support/TileInfo.js";import f from"../../../../../rest/support/Query.js";import g from"../../../../../symbols/support/ElevationInfo.js";import{getSnappingCandidateElevationAligner as m}from"../snappingCandidateElevationAlignment.js";import{getSnappingCandidateElevationFilter as y}from"../snappingCandidateElevationFilter.js";import{getSymbologySnappingCandidatesFetcher as _}from"../symbologySnappingCandidates.js";import{FeatureServiceTiledFetcher as S}from"./FeatureServiceTiledFetcher.js";import{FeatureServiceTileStore as F}from"./FeatureServiceTileStore.js";import{fromJSON as v}from"../../../../../geometry/support/jsonUtils.js";let w=class extends t.EventedAccessor{constructor(){super(...arguments),this._isInitializing=!0,this.remoteClient=null,this._whenSetup=i(),this._elevationAligner=m(),this._elevationFilter=y(),this._symbologyCandidatesFetcher=_(),this._updatingHandles=new d,this._editsUpdatingHandles=new d,this._pendingApplyEdits=new Map,this._alignPointsInFeatures=async(e,t)=>{const i={points:e},r=await this.remoteClient.invoke("alignElevation",i,{signal:t});return s(t),r},this._getSymbologyCandidates=async(e,t)=>{const i={candidates:e,spatialReference:this._spatialReference.toJSON()},r=await this.remoteClient.invoke("getSymbologyCandidates",i,{signal:t});return s(t),r}}get updating(){return this.updatingExcludingEdits||this._editsUpdatingHandles.updating||this._featureFetcher.updating}get updatingExcludingEdits(){return this._featureFetcher.updatingExcludingEdits||this._isInitializing||this._updatingHandles.updating}destroy(){this._featureFetcher?.destroy(),this._queryEngine?.destroy(),this._featureStore?.clear()}async setup(e){if(this.destroyed)return{result:{}};const{geometryType:t,objectIdField:i,timeInfo:s,fieldsIndex:n}=e.serviceInfo,{hasZ:o}=e,l=p.fromJSON(e.spatialReference);this._spatialReference=l,this._featureStore=new u({...e.serviceInfo,hasZ:o,hasM:!1}),this._queryEngine=new c({spatialReference:e.spatialReference,featureStore:this._featureStore,geometryType:t,fieldsIndex:n,hasZ:o,hasM:!1,objectIdField:i,timeInfo:s}),this._featureFetcher=new S({store:new F({featureStore:this._featureStore}),url:e.serviceInfo.url,objectIdField:e.serviceInfo.objectIdField,globalIdField:e.serviceInfo.globalIdField,capabilities:e.serviceInfo.capabilities,spatialReference:l,sourceSpatialReference:p.fromJSON(e.serviceInfo.spatialReference)});const d="3d"===e.configuration.viewType;return this._elevationAligner=m(d,{elevationInfo:null!=e.elevationInfo?g.fromJSON(e.elevationInfo):null,alignPointsInFeatures:this._alignPointsInFeatures,spatialReference:l}),this._elevationFilter=y(d),this.addHandles([r((()=>this._featureFetcher.availability),(e=>this.emit("notify-availability",{availability:e})),a),r((()=>this.updating),(()=>this._notifyUpdating()))]),this._whenSetup.resolve(),this._isInitializing=!1,this.configure(e.configuration)}async configure(e){return await this._updatingHandles.addPromise(this._whenSetup.promise),this._updateFeatureFetcherConfiguration(e),j}async setSuspended(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),this._featureFetcher.suspended=e,j}async updateOutFields(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),this._featureFetcher.outFields=new Set(e??[]),j}async fetchCandidates(e,t){await this._whenSetup.promise,s(t);const i=b(e),r=t?.signal,n=await this._queryEngine.executeQueryForSnapping(i,r);s(r);const a=await this._elevationAligner.alignCandidates(n.candidates,r);s(r);const o=await this._symbologyCandidatesFetcher.fetch(a,r);s(r);const l=0===o.length?a:a.concat(o);return{result:{candidates:this._elevationFilter.filter(i,l)}}}async updateTiles(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),this._featureFetcher.tileSize=e.tileSize,this._featureFetcher.tilesOfInterest=e.tiles,this._featureFetcher.tileInfo=null!=e.tileInfo?h.fromJSON(e.tileInfo):null,j}async refresh(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),this._featureFetcher.refresh(),j}async whenNotUpdating(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),s(t),await n((()=>!this.updatingExcludingEdits),t),s(t),j}async getDebugInfo(e,t){return s(t),{result:this._featureFetcher.debugInfo}}async beginApplyEdits(e,t){this._updatingHandles.addPromise(this._whenSetup.promise),s(t);const r=i();return this._pendingApplyEdits.set(e.id,r),this._featureFetcher.applyEdits(r.promise),this._editsUpdatingHandles.addPromise(r.promise),j}async endApplyEdits(e,t){const i=this._pendingApplyEdits.get(e.id);return i&&i.resolve(e.edits),s(t),j}async notifyElevationSourceChange(e,t){return this._elevationAligner.notifyElevationSourceChange(),j}async notifySymbologyChange(e,t){return this._symbologyCandidatesFetcher.notifySymbologyChange(),j}async setSymbologySnappingSupported(e){return this._symbologyCandidatesFetcher=_(e,this._getSymbologyCandidates),j}_updateFeatureFetcherConfiguration(e){this._featureFetcher.filter=null!=e.filter?f.fromJSON(e.filter):null,this._featureFetcher.customParameters=e.customParameters}_notifyUpdating(){this.emit("notify-updating",{updating:this.updating})}};e([o({readOnly:!0})],w.prototype,"updating",null),e([o({readOnly:!0})],w.prototype,"updatingExcludingEdits",null),e([o()],w.prototype,"_isInitializing",void 0),w=e([l("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")],w);const I=w;function b(e){if(!e.filter)return{...e,query:{where:"1=1"}};const{distance:t,units:i,spatialRel:s,where:r,timeExtent:n,objectIds:a}=e.filter,o={geometry:e.filter.geometry?v(e.filter.geometry):void 0,distance:t,units:i,spatialRel:s,timeExtent:n,objectIds:a,where:r??"1=1"};return{...e,query:o}}const j={result:{}};export{I 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as s}from"../../../../../chunks/vec3f64.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import{f as i}from"../../../../../chunks/sphere.js";import{fromVec3 as a}from"../../../sketch/normalizedPoint.js";import{EdgeSnappingCandidate as d}from"../../candidates/EdgeSnappingCandidate.js";import{VertexSnappingCandidate as c}from"../../candidates/VertexSnappingCandidate.js";let p=class extends t{constructor(e){super(e),this.availability=0,this._ids=new Set}destroy(){this._workerHandle.destroy(),this._workerHandle=null}initialize(){this._workerHandle=new l(this.schedule,{fetchAllEdgeLocations:(e,t)=>this._fetchAllEdgeLocations(e,t)})}async fetchCandidates(e,t){const r=e.coordinateHelper,{point:o}=e,s=h;this.renderCoordsHelper.toRenderCoords(o,r.spatialReference,s);const n=e.distance,a="number"==typeof n?n:n.distance,d=await this._workerHandle.invoke({bounds:i(s[0],s[1],s[2],a),returnEdge:e.returnEdge,returnVertex:e.returnVertex},t);return d.candidates.sort(((e,t)=>e.distance-t.distance)),d.candidates.map((e=>this._convertCandidate(r,e)))}async add(e,t){this._ids.add(e.id),await this._workerHandle.invokeMethod("add",e,t)}async remove(e,t){this._ids.delete(e.id),await this._workerHandle.invokeMethod("remove",e,t)}_convertCandidate(e,t){switch(t.type){case"edge":return new d({objectId:t.objectId,targetPoint:this._convertRenderCoordinate(e,t.target),edgeStart:this._convertRenderCoordinate(e,t.start),edgeEnd:this._convertRenderCoordinate(e,t.end),isDraped:!1});case"vertex":return new c({objectId:t.objectId,targetPoint:this._convertRenderCoordinate(e,t.target),isDraped:!1})}}_convertRenderCoordinate({spatialReference:e},t){const r=s();return this.renderCoordsHelper.fromRenderCoords(t,r,e),a(r)}async _fetchAllEdgeLocations(e,t){const r=[],o=[];for(const{id:s,uid:n}of e.components)this._ids.has(s)&&r.push((async()=>{const e=await this.fetchEdgeLocations(s,t.signal),r=e.locations.buffer;return o.push(r),{id:s,uid:n,objectIds:e.objectIds,locations:r,origin:e.origin,type:e.type}})());return{result:{components:(await Promise.all(r)).filter((({id:e})=>this._ids.has(e)))},transferList:o}}};e([r({constructOnly:!0})],p.prototype,"renderCoordsHelper",void 0),e([r({constructOnly:!0})],p.prototype,"fetchEdgeLocations",void 0),e([r({constructOnly:!0})],p.prototype,"schedule",void 0),e([r({readOnly:!0})],p.prototype,"availability",void 0),p=e([o("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")],p);class l extends n{constructor(e,t){super("SceneLayerSnappingSourceWorker","fetchCandidates",{},e,{strategy:"dedicated",client:t})}}const h=s();export{p as SceneLayerSnappingSourceWorkerHandle};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as s}from"../../../../../chunks/vec3f64.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import{f as i}from"../../../../../chunks/sphere.js";import{fromVec3 as a}from"../../../sketch/normalizedPoint.js";import{EdgeSnappingCandidate as d}from"../../candidates/EdgeSnappingCandidate.js";import{VertexSnappingCandidate as c}from"../../candidates/VertexSnappingCandidate.js";let p=class extends t{constructor(e){super(e),this.availability=0,this._ids=new Set}destroy(){this._workerHandle.destroy(),this._workerHandle=null}initialize(){this._workerHandle=new l(this.schedule,{fetchAllEdgeLocations:(e,t)=>this._fetchAllEdgeLocations(e,t)})}async fetchCandidates(e,t){const r=e.coordinateHelper,{point:o}=e,s=h;this.renderCoordsHelper.toRenderCoords(o,r.spatialReference,s);const n=e.distance,a="number"==typeof n?n:n.distance,d=await this._workerHandle.invoke({bounds:i(s[0],s[1],s[2],a),returnEdge:e.returnEdge,returnVertex:"none"!==e.vertexMode},t);return d.candidates.sort(((e,t)=>e.distance-t.distance)),d.candidates.map((e=>this._convertCandidate(r,e)))}async add(e,t){this._ids.add(e.id),await this._workerHandle.invokeMethod("add",e,t)}async remove(e,t){this._ids.delete(e.id),await this._workerHandle.invokeMethod("remove",e,t)}_convertCandidate(e,t){switch(t.type){case"edge":return new d({objectId:t.objectId,targetPoint:this._convertRenderCoordinate(e,t.target),edgeStart:this._convertRenderCoordinate(e,t.start),edgeEnd:this._convertRenderCoordinate(e,t.end),isDraped:!1});case"vertex":return new c({objectId:t.objectId,targetPoint:this._convertRenderCoordinate(e,t.target),isDraped:!1})}}_convertRenderCoordinate({spatialReference:e},t){const r=s();return this.renderCoordsHelper.fromRenderCoords(t,r,e),a(r)}async _fetchAllEdgeLocations(e,t){const r=[],o=[];for(const{id:s,uid:n}of e.components)this._ids.has(s)&&r.push((async()=>{const e=await this.fetchEdgeLocations(s,t.signal),r=e.locations.buffer;return o.push(r),{id:s,uid:n,objectIds:e.objectIds,locations:r,origin:e.origin,type:e.type}})());return{result:{components:(await Promise.all(r)).filter((({id:e})=>this._ids.has(e)))},transferList:o}}};e([r({constructOnly:!0})],p.prototype,"renderCoordsHelper",void 0),e([r({constructOnly:!0})],p.prototype,"fetchEdgeLocations",void 0),e([r({constructOnly:!0})],p.prototype,"schedule",void 0),e([r({readOnly:!0})],p.prototype,"availability",void 0),p=e([o("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")],p);class l extends n{constructor(e,t){super("SceneLayerSnappingSourceWorker","fetchCandidates",{},e,{strategy:"dedicated",client:t})}}const h=s();export{p as SceneLayerSnappingSourceWorkerHandle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Logger.js";import{watch as t,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{intersection as n}from"../../../core/SetUtils.js";import{sqlAnd as o}from"../../../core/sql.js";import{mergeTimeExtents as i}from"../../../core/timeUtils.js";import{a as s}from"../../../chunks/vec3.js";import{WhereClause as l}from"../../../core/sql/WhereClause.js";import{makeDehydratedPoint as a}from"../../../layers/graphics/dehydratedPoint.js";import{collectFields as f}from"../../../layers/support/fieldUtils.js";import d from"../../../rest/support/Query.js";import{ViewEventPriorities as c}from"../../input/InputManager.js";import{snappingKeys as p}from"../keybindings.js";import{fromAnyMapPoint as m}from"../sketch/normalizedPoint.js";function u(e,t){const r=e.length===t.length&&e[0]===t[0]&&e[1]===t[1];switch(e.length){case 2:return r;case 3:return r&&e[2]===t[2];case 4:return r&&e[2]===t[2]&&e[3]===t[3]}return!1}function g(e,t){const r=e.x-t.x,n=e.y-t.y;return r*r+n*n}function E(e,t){return Math.sqrt(g(e,t))}function h(e,t){t.sort(((t,r)=>s(t.targetPoint,e)-s(r.targetPoint,e)))}var y;function w({point:e,distance:t,returnEdge:r,returnVertex:n,coordinateHelper:{spatialReference:s},filter:l},f,c){return c=null!=c?c.clone():new d({where:"1=1"}),l&&(c.geometry=l.geometry,c.distance=l.distance,c.spatialRelationship=l.spatialRelationship,c.where=o(c.where,l.where),c.timeExtent=i(c.timeExtent,l.timeExtent),c.objectIds=I(c.objectIds,l.objectIds)),{point:a(e[0],e[1],e[2],s.toJSON()),mode:f,distance:t,returnEdge:r,returnVertex:n,query:c.toJSON()}}function I(e,t){return e||t?t?e?Array.from(n(new Set(e),new Set(t))):t:e:null}function j(t,r,n=new Set){if(!(r&&t&&"filter"in t&&t.filter))return n;const{where:o,timeExtent:i}=t.filter;if(i&&"timeInfo"in r&&r.timeInfo&&f(n,r.fieldsIndex,[r.timeInfo.startField,r.timeInfo.endField]),o)try{const{isStandardized:e,fieldNames:t}=l.create(o,r.fieldsIndex);e&&f(n,r.fieldsIndex,t)}catch(s){e.getLogger("esri.views.interactive.snapping.snappingUtils").error(`Invalid where clause defined on view filter for layer: ${r.title}. Feature snapping may not work for this layer.`,`where: ${o}`)}return n}function x(e,t,r=new Set){return e&&t&&e?.floorInfo?.floorField&&t?.floors?.length&&f(r,e.fieldsIndex,[e.floorInfo.floorField]),r}function v(e,t,r){return{left:m(e.leftVertex.pos,t,r),right:m(e.rightVertex.pos,t,r)}}function R(e){return e.createQuery()}function N(e,n=(()=>{})){const o=t((()=>({view:e.view,snappingOptions:e.snappingOptions})),(({view:t,snappingOptions:r})=>{const o="snapping-toggle",i=c.TOOL;if(e.removeHandles(o),t&&null!=r){const s=[t.on("key-down",(e=>{e.key!==p.toggle||e.repeat||(r.enabledToggled=!0,n())}),i),t.on("key-up",(e=>{e.key===p.toggle&&(r.enabledToggled=!1,n())}),i),t.on("pointer-move",(e=>{const t=e.native.ctrlKey;r.enabledToggled!==t&&(r.enabledToggled=t,n())}),i)];e.addHandles(s,o)}}),r);e.addHandles(o)}!function(e){e[e.TARGET=0]="TARGET",e[e.REFERENCE=1]="REFERENCE",e[e.REFERENCE_EXTENSION=2]="REFERENCE_EXTENSION"}(y||(y={}));export{y as LineSegmentHintType,x as collectOutFieldsForFloorFilter,j as collectOutFieldsForLayerViewFilter,v as editEdgeToSnappingEdge,R as makeFilter,w as makeSnappingQuery,u as objectEqual,E as screenDistance,N as setupSnappingToggleHandles,h as sortCandidatesInPlace,g as squaredScreenDistance};
5
+ import{watch as e,syncAndInitial as t}from"../../../core/reactiveUtils.js";import{intersection as n}from"../../../core/SetUtils.js";import{sqlAnd as r}from"../../../core/sql.js";import{mergeTimeExtents as o}from"../../../core/timeUtils.js";import{a as i}from"../../../chunks/vec3.js";import{makeDehydratedPoint as s}from"../../../layers/graphics/dehydratedPoint.js";import a from"../../../rest/support/Query.js";import{ViewEventPriorities as l}from"../../input/InputManager.js";import{snappingKeys as c}from"../keybindings.js";import{fromAnyMapPoint as p}from"../sketch/normalizedPoint.js";function d(e,t){const n=e.length===t.length&&e[0]===t[0]&&e[1]===t[1];switch(e.length){case 2:return n;case 3:return n&&e[2]===t[2];case 4:return n&&e[2]===t[2]&&e[3]===t[3]}return!1}function u(e,t){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function g(e,t){return Math.sqrt(u(e,t))}function m(e,t){t.sort(((t,n)=>i(t.targetPoint,e)-i(n.targetPoint,e)))}var f;function E({point:e,distance:t,returnEdge:n,vertexMode:i,coordinateHelper:{spatialReference:l},filter:c},p,d){return d=null!=d?d.clone():new a({where:"1=1"}),c&&(d.geometry=c.geometry,d.distance=c.distance,d.spatialRelationship=c.spatialRelationship,d.where=r(d.where,c.where),d.timeExtent=o(d.timeExtent,c.timeExtent),d.objectIds=y(d.objectIds,c.objectIds)),{point:s(e[0],e[1],e[2],l.toJSON()),mode:p,distance:t,returnEdge:n,vertexMode:i,query:d.toJSON()}}function y(e,t){return e||t?t?e?Array.from(n(new Set(e),new Set(t))):t:e:null}function h(e,t,n){return{left:p(e.leftVertex.pos,t,n),right:p(e.rightVertex.pos,t,n)}}function j(e){return e.createQuery()}function w(n,r=(()=>{})){const o=e((()=>({view:n.view,snappingOptions:n.snappingOptions})),(({view:e,snappingOptions:t})=>{const o="snapping-toggle",i=l.TOOL;if(n.removeHandles(o),e&&null!=t){const s=[e.on("key-down",(e=>{e.key!==c.toggle||e.repeat||(t.enabledToggled=!0,r())}),i),e.on("key-up",(e=>{e.key===c.toggle&&(t.enabledToggled=!1,r())}),i),e.on("pointer-move",(e=>{const n=e.native.ctrlKey;t.enabledToggled!==n&&(t.enabledToggled=n,r())}),i)];n.addHandles(s,o)}}),t);n.addHandles(o)}function R(e){return null!=e&&"object"==typeof e&&"declaredClass"in e&&"esri.WebMap"===e.declaredClass&&"utilityNetworks"in e&&!!e?.utilityNetworks?.length}!function(e){e[e.TARGET=0]="TARGET",e[e.REFERENCE=1]="REFERENCE",e[e.REFERENCE_EXTENSION=2]="REFERENCE_EXTENSION"}(f||(f={}));export{f as LineSegmentHintType,h as editEdgeToSnappingEdge,R as isUtilityNetworkWebMap,j as makeFilter,E as makeSnappingQuery,d as objectEqual,g as screenDistance,w as setupSnappingToggleHandles,m as sortCandidatesInPlace,u as squaredScreenDistance};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{result as r}from"../../core/asyncUtils.js";import e from"../../core/Error.js";import{allSettledErrors as o,throwIfAborted as t,eachAlways as s}from"../../core/promiseUtils.js";import{generateUUID as a}from"../../core/uuid.js";import{getSiblingOfSameTypeI as c,contentToBlob as n}from"../../portal/support/resourceUtils.js";async function u(r,e,o=null){const t=await i(r,e,o);await h(t,e,o)}async function p(r,e,o,t,s=null){const a=await i(o,t,s);await r.update({data:e}),await h(a,t,s)}async function i(r,s,n=null){if(!s?.resources)return;const u=s.portalItem===r.portalItem?new Set(r.paths):new Set;r.paths.length=0,r.portalItem=s.portalItem;const p=new Set(s.resources.toKeep.map((r=>r.resource.path))),i=new Set,h=[];p.forEach((e=>{u.delete(e),r.paths.push(e)}));for(const e of s.resources.toUpdate)if(u.delete(e.resource.path),p.has(e.resource.path)||i.has(e.resource.path)){const{resource:o,content:t,finish:s,error:u}=e,p=c(o,a());r.paths.push(p.path),h.push(l({resource:p,content:t,compress:e.compress,finish:s,error:u},n))}else r.paths.push(e.resource.path),h.push(f(e,n)),i.add(e.resource.path);for(const e of s.resources.toAdd)r.paths.push(e.resource.path),u.has(e.resource.path)?u.delete(e.resource.path):h.push(l(e,n));if(0===h.length)return u;const m=await o(h);if(t(n),m.length>0)throw new e("save:resources","Failed to save one or more resources",{errors:m});return u}async function h(r,e,o=null){if(!r||!e.portalItem)return;const t=[];for(const s of r){const r=e.portalItem.resourceFromPath(s);t.push(r.portalItem.removeResource(r,o))}await s(t)}async function l(e,o){const t={...null!=o?o:{},compress:e.compress},s=await r(e.resource.portalItem.addResource(e.resource,await n(e.content),t));if(!0!==s.ok)throw e.error?.(s.error),s.error;e.finish?.(e.resource)}async function f(e,o){const t=await r(e.resource.update(await n(e.content),o));if(!0!==t.ok)throw e.error?.(t.error),t.error;e.finish?.(e.resource)}export{u as saveResources,p as updateItemWithResources};
5
+ import{result as e}from"../../core/asyncUtils.js";import r from"../../core/Error.js";import{allSettledErrors as o,throwIfAborted as t,eachAlways as s}from"../../core/promiseUtils.js";import{generateUUID as a}from"../../core/uuid.js";import{getSiblingOfSameTypeI as c,contentToBlob as n}from"../../portal/support/resourceUtils.js";async function u(e,r,o=null){const t=await i(e,r,o);await h(t,r,o)}async function p(e,r,o,t,s=null){const a=await i(o,t,s);await e.update({data:r}),await h(a,t,s)}async function i(e,s,n=null){if(!s?.resources)return;const u=s.portalItem===e.portalItem?new Set(e.paths):new Set;e.paths.length=0,e.portalItem=s.portalItem;const p=new Set(s.resources.toKeep.map((e=>e.resource.path))),i=new Set,h=[];p.forEach((r=>{u.delete(r),e.paths.push(r)}));for(const r of s.resources.toUpdate)if(u.delete(r.resource.path),p.has(r.resource.path)||i.has(r.resource.path)){const{resource:o,content:t,finish:s,error:u}=r,p=c(o,a());e.paths.push(p.path),h.push(f({resource:p,content:t,compress:r.compress,finish:s,error:u},n))}else e.paths.push(r.resource.path),h.push(l(r,n)),i.add(r.resource.path);for(const r of s.resources.toAdd)e.paths.push(r.resource.path),u.has(r.resource.path)?u.delete(r.resource.path):h.push(f(r,n));if(0===h.length)return u;const m=await o(h);if(t(n),m.length>0)throw new r("save:resources","Failed to save one or more resources",{errors:m});return u}async function h(e,r,o=null){if(!e||!r.portalItem)return;const t=[];for(const s of e){const e=r.portalItem.resourceFromPath(s);t.push(e.portalItem.removeResource(e,o))}await s(t)}async function f(r,o){const t={...null!=o?o:{},compress:r.compress},s=await e(r.resource.portalItem.addResource(r.resource,await n(r.content),t));if(!0!==s.ok)throw r.error?.(s.error),s.error;r.finish?.(r.resource)}async function l(r,o){const t=await e(r.resource.update(await n(r.content),o));if(!0!==t.ok)throw r.error?.(t.error),t.error;r.finish?.(r.resource)}async function m(e){const r=[];for(const o of e.allLayers)if("beforeSave"in o&&"function"==typeof o.beforeSave){const e=o.beforeSave();e&&r.push(e)}await Promise.allSettled(r)}export{m as beforeSave,u as saveResources,p as updateItemWithResources};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../core/Error.js";import{MultiOriginJSONSupport as t}from"../core/MultiOriginJSONSupport.js";import{whenOnce as r}from"../core/reactiveUtils.js";import{urlToObject as o,hasSameCanonicalPortal as a}from"../core/urlUtils.js";import{updateOrigins as i}from"../core/accessorSupport/originUtils.js";import n from"../geometry/SpatialReference.js";import{equals as s}from"../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as l}from"../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as p}from"../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as c,isFeatureCollectionLayer as u}from"../layers/support/layerUtils.js";import m from"../portal/Portal.js";import d from"../portal/PortalItem.js";import{TypeKeyword as f,removeTypeKeyword as w,addTypeKeyword as y,hasTypeKeyword as g}from"../portal/support/portalItemUtils.js";import{project as h}from"../rest/geometryService/project.js";import b from"../rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as v,findSpatialReference as _,isDeveloperBasemapLayer as R}from"../support/basemapUtils.js";import{validateSaveAPIKey as P}from"./saveAPIKeyUtils.js";import{saveResources as U}from"./support/saveUtils.js";const S=["NatGeo_World_Map","Ocean_Basemap","USA_Topo_Maps","World_Imagery","World_Street_Map","World_Terrain_Base","World_Topo_Map","World_Hillshade","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Reference/World_Boundaries_and_Places","Reference/World_Reference_Overlay","Reference/World_Transportation"].map((e=>e.toLowerCase()));async function W(e,t,a){a??={},j(e,t),await r((()=>!t.updatingFromView)),await t.load(),await M(t),await k(t),await O(e,t);const i=t.portalItem,n=o(i.itemUrl),s={origin:"web-map",messages:[],writtenProperties:[],url:n,portal:i.portal||m.getDefault(),portalItem:i,verifyItemRelativeUrls:n?{rootPath:n.path,writtenUrls:[]}:null,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},l=t.write({},s);return await Promise.all(s.resources.pendingOperations),D(e,s,a),await E(t,i),await ue(e,t,i,l,s),await Promise.all([t.updateItemThumbnail(),U(t.resourceReferences,s,null)]),i}async function I(e,t,o,a){a??={};const i=T(e,o);await r((()=>!t.updatingFromView)),await t.load(),await M(t),await k(t),await O(e,t);const n={origin:"web-map",messages:[],writtenProperties:[],url:null,portal:i.portal,portalItem:i,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},s=t.write({},n);await Promise.all(n.resources.pendingOperations),D(e,n,a),await z(t,i);const l=t.getThumbnailState();return await me(e,t,i,s,n,a)&&(t.resourceReferences.portalItem=i),t.restoreThumbnailFromState(l),await Promise.all([t.updateItemThumbnail(),U(t.resourceReferences,n,null)]),i}function j(t,r){if(!r.portalItem)throw new e(`${t.name}:portal-item-not-set`,"Portal item to save to has not been set on the WebMap");P(r.portalItem),A(t,r.portalItem)}function A(t,r){if(r.type!==t.itemType)throw new e(`${t.name}:portal-item-wrong-type`,`Portal item needs to have type "${t.itemType}"`)}async function O(t,o){if(!o.basemap?.baseLayers.length)throw new e(`${t.name}:save`,"Map does not have a valid basemap with a base layer.");let a=null;if(await r((()=>{const e=_(o.initialViewProperties,o.basemap);return a=e.spatialReference,!e.updating})),!s(a,o.initialViewProperties.spatialReference))throw new e(`${t.name}:save`,"The spatial reference of the basemap is not compatible with the one from the map.",{expected:o.initialViewProperties.spatialReference,actual:a})}function T(e,t){let r=d.from(t);return r.id&&(r=r.clone(),r.id=null),r.type||(r.type=e.itemType),r.portal||(r.portal=m.getDefault()),P(r),A(e,r),r}function M(e){const t=[];return e.basemap&&t.push(e.basemap.load()),e.ground&&t.push(e.ground.load()),Promise.allSettled(t).then((()=>{}))}async function k(e){const t=[];for(const r of e.allLayers)if("beforeSave"in r&&"function"==typeof r.beforeSave){const e=r.beforeSave();e&&t.push(e)}await Promise.allSettled(t)}function D(t,r,o){let a=(r.messages??[]).filter((e=>"error"===e.type)).map((t=>new e(t.name,t.message,t.details)));if(r.blockedRelativeUrls&&(a=a.concat(r.blockedRelativeUrls.map((t=>new e("url:unsupported",`Relative url '${t}' is not supported in Web Map`))))),o.ignoreUnsupported&&(a=a.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name))),a.length>0)throw new e(`${t.name}:save`,"Failed to save webmap due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:a})}async function E(e,t){t.extent=await ne(e.portalItem,e.initialViewProperties.viewpoint.targetGeometry),await Q(e,t)}const V=f.JSAPI,C="CollectorDisabled",L="Collector",G="Data Editing",$="OfflineDisabled",B="Offline",K="Workforce Project",x="Workforce Worker",F="Workforce Dispatcher",N="Offline Map Areas",H="FieldMapsDisabled",J=f.DEVELOPER_BASEMAP,q="UtilityNetwork";async function z(e,t){w(t,C),w(t,H),w(t,f.METADATA),w(t,$),w(t,N),w(t,F),w(t,K),w(t,x),await E(e,t)}async function Q(e,t){y(t,V),await X(e),te(e,t),re(e,t),oe(e,t),ae(e,t),ie(e,t),t.typeKeywords&&(t.typeKeywords=t.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}function X(e){const t=Y(e).map((e=>e.load())).toArray();return Promise.allSettled(t).then((()=>{}))}function Y(e){return e.allLayers.concat(e.allTables)}function Z(e){return Y(e).some((e=>e.loaded&&c(e)&&e.capabilities.operations.supportsEditing&&e.editingEnabled&&("subtype-group"!==e.type||e.sublayers.some((e=>e.editingEnabled)))))}function ee(e){return Y(e).filter((e=>"group"!==e.type)).every((t=>t.loaded&&pe(e,t)))}function te(e,t){g(t,C)||g(t,K)||g(t,x)||g(t,F)||!Z(e)?w(t,L):y(t,L)}function re(e,t){Z(e)?y(t,G):w(t,G)}function oe(e,t){!g(t,$)&&ee(e)?y(t,B):w(t,B)}function ae(e,t){v(e.basemap)?y(t,J):w(t,J)}function ie(e,t){e.utilityNetworks?.length?y(t,q):w(t,q)}async function ne(e,t){const r=t.clone().normalize();let o;if(r.length>1)for(const a of r)o?a.width>o.width&&(o=a):o=a;else o=r[0];return se(e,o)}async function se(e,t){const r=t.spatialReference;if(r.isWGS84)return t.clone();if(r.isWebMercator)return l(t);const{getGeometryServiceURL:o}=await import("../portal/support/geometryServiceUtils.js"),a=await o(e),i=new b;i.geometries=[t],i.outSpatialReference=n.WGS84;return(await h(a,i))[0]}function le(e){return u(e)||"map-notes"===e.type||"route"===e.type}function pe(e,t){return c(t)&&t.capabilities.operations.supportsSync||le(t)&&!t.portalItem||("tile"===t.type||"vector-tile"===t.type)&&(t.capabilities.operations.supportsExportTiles||ce(t)||R(t))&&t.spatialReference.equals(e.initialViewProperties.spatialReference)}function ce(e){return"tile"===e.type&&(p(e.url)&&S.some((t=>e.url?.toLowerCase().includes("/"+t+"/"))))}async function ue(e,t,r,o,a){await r.update({data:o}),we(e,t,r,o,a)}async function me(t,r,o,a,i,n){const s=r.portalItem,l={item:s,authenticated:!(!s?.id||!s.portal.user)},p=o.portal;await p.signIn();const{copyAllowed:c,itemReloaded:u}=await de(l,p);if(l.authenticated||=u,!c)throw new e(`${t.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const m=await fe(o,l,a,n);return r.portalItem=o,we(t,r,o,a,i),m}async function de(e,t){const{item:r,authenticated:o}=e;return r?.id&&r.typeKeywords?.includes("useOnly")?r.portal.portalHostname!==t.portalHostname?{copyAllowed:!1,itemReloaded:!1}:(o||await r.reload(),{copyAllowed:"admin"===r.itemControl||"update"===r.itemControl,itemReloaded:!0}):{copyAllowed:!0,itemReloaded:!1}}async function fe(e,t,r,o){const i=e.portal,{item:n}=t,{folder:s,copyAllResources:l}=o;let p=!1;if(l&&n?.id&&a(n.portal.url,i.url)&&parseInt(n.portal.currentVersion,10)>=2023){const{total:e}=await n.fetchResources();p=!!e}if(p){const t=await n.copy({copyResources:"all",folder:s});e.id=t.id,e.portal=t.portal;const o=e.toJSON();await e.load(),e.read(o),await e.update({data:r})}else await(i.user?.addItem({item:e,folder:s,data:r}));return p}function we(e,r,a,n,s){t.prototype.read.call(r,{version:n.version,authoringApp:n.authoringApp,authoringAppVersion:n.authoringAppVersion},{origin:e.origin,ignoreDefaults:!0,url:a.itemUrl?o(a.itemUrl):void 0}),i(s),r.resourceInfo=n}export{W as save,I as saveAs};
5
+ import e from"../core/Error.js";import{MultiOriginJSONSupport as t}from"../core/MultiOriginJSONSupport.js";import{whenOnce as r}from"../core/reactiveUtils.js";import{urlToObject as o,hasSameCanonicalPortal as a}from"../core/urlUtils.js";import{updateOrigins as i}from"../core/accessorSupport/originUtils.js";import n from"../geometry/SpatialReference.js";import{equals as s}from"../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as l}from"../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as p}from"../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as c,isFeatureCollectionLayer as u}from"../layers/support/layerUtils.js";import m from"../portal/Portal.js";import d from"../portal/PortalItem.js";import{TypeKeyword as f,removeTypeKeyword as w,addTypeKeyword as y,hasTypeKeyword as g}from"../portal/support/portalItemUtils.js";import{project as h}from"../rest/geometryService/project.js";import b from"../rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as _,findSpatialReference as v,isDeveloperBasemapLayer as R}from"../support/basemapUtils.js";import{validateSaveAPIKey as U}from"./saveAPIKeyUtils.js";import{beforeSave as P,saveResources as W}from"./support/saveUtils.js";const I=["NatGeo_World_Map","Ocean_Basemap","USA_Topo_Maps","World_Imagery","World_Street_Map","World_Terrain_Base","World_Topo_Map","World_Hillshade","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Reference/World_Boundaries_and_Places","Reference/World_Reference_Overlay","Reference/World_Transportation"].map((e=>e.toLowerCase()));async function j(e,t,a){a??={},S(e,t),await r((()=>!t.updatingFromView)),await t.load(),await k(t),await P(t),await T(e,t);const i=t.portalItem,n=o(i.itemUrl),s={origin:"web-map",messages:[],writtenProperties:[],url:n,portal:i.portal||m.getDefault(),portalItem:i,verifyItemRelativeUrls:n?{rootPath:n.path,writtenUrls:[]}:null,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},l=t.write({},s);return await Promise.all(s.resources.pendingOperations),D(e,s,a),await E(t,i),await ue(e,t,i,l,s),await Promise.all([t.updateItemThumbnail(),W(t.resourceReferences,s,null)]),i}async function A(e,t,o,a){a??={};const i=M(e,o);await r((()=>!t.updatingFromView)),await t.load(),await k(t),await P(t),await T(e,t);const n={origin:"web-map",messages:[],writtenProperties:[],url:null,portal:i.portal,portalItem:i,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},s=t.write({},n);await Promise.all(n.resources.pendingOperations),D(e,n,a),await z(t,i);const l=t.getThumbnailState();return await me(e,t,i,s,n,a)&&(t.resourceReferences.portalItem=i),t.restoreThumbnailFromState(l),await Promise.all([t.updateItemThumbnail(),W(t.resourceReferences,n,null)]),i}function S(t,r){if(!r.portalItem)throw new e(`${t.name}:portal-item-not-set`,"Portal item to save to has not been set on the WebMap");U(r.portalItem),O(t,r.portalItem)}function O(t,r){if(r.type!==t.itemType)throw new e(`${t.name}:portal-item-wrong-type`,`Portal item needs to have type "${t.itemType}"`)}async function T(t,o){if(!o.basemap?.baseLayers.length)throw new e(`${t.name}:save`,"Map does not have a valid basemap with a base layer.");let a=null;if(await r((()=>{const e=v(o.initialViewProperties,o.basemap);return a=e.spatialReference,!e.updating})),!s(a,o.initialViewProperties.spatialReference))throw new e(`${t.name}:save`,"The spatial reference of the basemap is not compatible with the one from the map.",{expected:o.initialViewProperties.spatialReference,actual:a})}function M(e,t){let r=d.from(t);return r.id&&(r=r.clone(),r.id=null),r.type||(r.type=e.itemType),r.portal||(r.portal=m.getDefault()),U(r),O(e,r),r}function k(e){const t=[];return e.basemap&&t.push(e.basemap.load()),e.ground&&t.push(e.ground.load()),Promise.allSettled(t).then((()=>{}))}function D(t,r,o){let a=(r.messages??[]).filter((e=>"error"===e.type)).map((t=>new e(t.name,t.message,t.details)));if(r.blockedRelativeUrls&&(a=a.concat(r.blockedRelativeUrls.map((t=>new e("url:unsupported",`Relative url '${t}' is not supported in Web Map`))))),o.ignoreUnsupported&&(a=a.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name))),a.length>0)throw new e(`${t.name}:save`,"Failed to save webmap due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:a})}async function E(e,t){t.extent=await ne(e.portalItem,e.initialViewProperties.viewpoint.targetGeometry),await Q(e,t)}const V=f.JSAPI,C="CollectorDisabled",G="Collector",L="Data Editing",$="OfflineDisabled",B="Offline",K="Workforce Project",x="Workforce Worker",F="Workforce Dispatcher",N="Offline Map Areas",H="FieldMapsDisabled",J=f.DEVELOPER_BASEMAP,q="UtilityNetwork";async function z(e,t){w(t,C),w(t,H),w(t,f.METADATA),w(t,$),w(t,N),w(t,F),w(t,K),w(t,x),await E(e,t)}async function Q(e,t){y(t,V),await X(e),te(e,t),re(e,t),oe(e,t),ae(e,t),ie(e,t),t.typeKeywords&&(t.typeKeywords=t.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}function X(e){const t=Y(e).map((e=>e.load())).toArray();return Promise.allSettled(t).then((()=>{}))}function Y(e){return e.allLayers.concat(e.allTables)}function Z(e){return Y(e).some((e=>e.loaded&&c(e)&&e.capabilities.operations.supportsEditing&&e.editingEnabled&&("subtype-group"!==e.type||e.sublayers.some((e=>e.editingEnabled)))))}function ee(e){return Y(e).filter((e=>"group"!==e.type)).every((t=>t.loaded&&pe(e,t)))}function te(e,t){g(t,C)||g(t,K)||g(t,x)||g(t,F)||!Z(e)?w(t,G):y(t,G)}function re(e,t){Z(e)?y(t,L):w(t,L)}function oe(e,t){!g(t,$)&&ee(e)?y(t,B):w(t,B)}function ae(e,t){_(e.basemap)?y(t,J):w(t,J)}function ie(e,t){e.utilityNetworks?.length?y(t,q):w(t,q)}async function ne(e,t){const r=t.clone().normalize();let o;if(r.length>1)for(const a of r)o?a.width>o.width&&(o=a):o=a;else o=r[0];return se(e,o)}async function se(e,t){const r=t.spatialReference;if(r.isWGS84)return t.clone();if(r.isWebMercator)return l(t);const{getGeometryServiceURL:o}=await import("../portal/support/geometryServiceUtils.js"),a=await o(e),i=new b;i.geometries=[t],i.outSpatialReference=n.WGS84;return(await h(a,i))[0]}function le(e){return u(e)||"map-notes"===e.type||"route"===e.type}function pe(e,t){return c(t)&&t.capabilities.operations.supportsSync||le(t)&&!t.portalItem||("tile"===t.type||"vector-tile"===t.type)&&(t.capabilities.operations.supportsExportTiles||ce(t)||R(t))&&t.spatialReference.equals(e.initialViewProperties.spatialReference)}function ce(e){return"tile"===e.type&&(p(e.url)&&I.some((t=>e.url?.toLowerCase().includes("/"+t+"/"))))}async function ue(e,t,r,o,a){await r.update({data:o}),we(e,t,r,o,a)}async function me(t,r,o,a,i,n){const s=r.portalItem,l={item:s,authenticated:!(!s?.id||!s.portal.user)},p=o.portal;await p.signIn();const{copyAllowed:c,itemReloaded:u}=await de(l,p);if(l.authenticated||=u,!c)throw new e(`${t.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const m=await fe(o,l,a,n);return r.portalItem=o,we(t,r,o,a,i),m}async function de(e,t){const{item:r,authenticated:o}=e;return r?.id&&r.typeKeywords?.includes("useOnly")?r.portal.portalHostname!==t.portalHostname?{copyAllowed:!1,itemReloaded:!1}:(o||await r.reload(),{copyAllowed:"admin"===r.itemControl||"update"===r.itemControl,itemReloaded:!0}):{copyAllowed:!0,itemReloaded:!1}}async function fe(e,t,r,o){const i=e.portal,{item:n}=t,{folder:s,copyAllResources:l}=o;let p=!1;if(l&&n?.id&&a(n.portal.url,i.url)&&parseInt(n.portal.currentVersion,10)>=2023){const{total:e}=await n.fetchResources();p=!!e}if(p){const t=await n.copy({copyResources:"all",folder:s});e.id=t.id,e.portal=t.portal;const o=e.toJSON();await e.load(),e.read(o),await e.update({data:r})}else await(i.user?.addItem({item:e,folder:s,data:r}));return p}function we(e,r,a,n,s){t.prototype.read.call(r,{version:n.version,authoringApp:n.authoringApp,authoringAppVersion:n.authoringAppVersion},{origin:e.origin,ignoreDefaults:!0,url:a.itemUrl?o(a.itemUrl):void 0}),i(s),r.resourceInfo=n}export{j as save,A as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{directionalPadMoveOnceDuration as s}from"./constants.js";import{css as n}from"./css.js";import{angleToUnitVector as r,toUnitVector as v,vectorToClosestAngle as m}from"./utils.js";import{GoToMixin as a}from"../support/GoTo.js";let d=class extends(a(e.EventedAccessor)){constructor(t){super(t),this._initialAngle=void 0,this._movementVector=void 0,this._widgetCenter=void 0,this._anyAngleMovementEnabled=!1,this._movementTimeout=void 0,this._disabled=!1,this._moveOnceDuration=s,this.angle=void 0,this.speed=1,this.beginFollowingPointer=(t,e)=>{if(this.disabled)return;this._widgetCenter=e;const o=this._pointerLocationToVector(t);if(void 0===o)return;const i=this._resolveClosestAngle(t,o);void 0!==i&&(this._emitMove(r(i)),this.angle=i,this._initialAngle=i,this._setMovementTimeout((()=>{void 0===this._widgetCenter&&this._stopMovement()})),document.addEventListener("pointermove",this._onPointerMove,{passive:!0}),document.addEventListener("pointerup",this._onPointerUp,{passive:!0,once:!0}))},this.moveOnce=t=>{const e=r(t);this._emitMove(e),this._setMovementTimeout(this._stopMovement)},this._pointerLocationToVector=t=>{if(void 0===this._widgetCenter)return;const{x:e,y:o}=v(this._widgetCenter,t);return{x:e,y:-o}},this._resolveClosestAngle=(t,e)=>{const o=t.target,i=o?.getAttribute?.("data-angle"),s=o?.classList?.contains(n.compassButton);if(s)return;const r=Number.parseInt(i??"",10);return Number.isNaN(r)?m(e):r},this._onPointerMove=t=>{if(0===t.buttons)return void this._stopMovement();const e=this._pointerLocationToVector(t);if(void 0===e)return;this._setMovementTimeout(void 0);const o=this._resolveClosestAngle(t,e);if(void 0===o)return void this._emitStop();const i=r(o),s=null!=this._initialAngle&&this._initialAngle!==o;this._anyAngleMovementEnabled||=s;const n=this._anyAngleMovementEnabled?e:i;(n.x!==this._movementVector?.x||n.y!==this._movementVector?.y)&&(this.angle=o,this._emitMove(n))},this._onPointerUp=()=>{void 0===this._movementTimeout?this._stopMovement():this._widgetCenter=void 0},this._stopMovement=()=>{this._emitStop(),this._widgetCenter=void 0,this._initialAngle=void 0,this._anyAngleMovementEnabled=!1,document.removeEventListener("pointermove",this._onPointerMove),document.removeEventListener("pointerup",this._stopMovement),this._setMovementTimeout(void 0)},this.on("move-start",(()=>this.view?.mapViewNavigation.begin())),this.on("move-direction-change",(({vector:{x:t,y:e}})=>this.view?.mapViewNavigation.continuousPanVector({x:t*this.speed,y:e*this.speed}))),this.on("move-stop",(()=>this.view?.mapViewNavigation.stop()))}destroy(){this._stopMovement()}get disabled(){const{view:t,_disabled:e,supported:o}=this;return!1===t?.ready||e||!o}set disabled(t){this._disabled=t}get rotation(){return this.view?.rotation??this._get("rotation")??0}set rotation(t){this.view?this.view.constraints.rotationEnabled&&this.callGoTo({target:{rotation:t}}):this._set("rotation",t)}get supported(){return null==this.view||"2d"===this.view.type}get state(){const{disabled:t,angle:e}=this;return t?"disabled":null!=e?"moving":"ready"}_setMovementTimeout(t){clearTimeout(this._movementTimeout),this._movementTimeout=void 0===t?void 0:setTimeout((()=>{this._movementTimeout=void 0,t()}),this._moveOnceDuration)}_emitMove(t){null==this._movementVector&&this._emitMoveStartEvent({vector:t});const e=this._movementVector;this._movementVector=t,this._emitMoveDirectionChangeEvent({vector:t,oldVector:e})}_emitStop(){this.angle=void 0,void 0!==this._movementVector&&(this._emitMoveStopEvent({oldVector:this._movementVector}),this._movementVector=void 0)}_emitMoveStartEvent(t){this.emit("move-start",{...t,type:"move-start"})}_emitMoveDirectionChangeEvent(t){this.emit("move-direction-change",{...t,type:"move-direction-change"})}_emitMoveStopEvent(t){this.emit("move-stop",{...t,type:"move-stop"})}};t([o()],d.prototype,"_initialAngle",void 0),t([o()],d.prototype,"_movementVector",void 0),t([o()],d.prototype,"_widgetCenter",void 0),t([o()],d.prototype,"_anyAngleMovementEnabled",void 0),t([o()],d.prototype,"_movementTimeout",void 0),t([o()],d.prototype,"_disabled",void 0),t([o()],d.prototype,"_moveOnceDuration",void 0),t([o()],d.prototype,"disabled",null),t([o()],d.prototype,"angle",void 0),t([o({type:Number,range:{min:0,max:100}})],d.prototype,"speed",void 0),t([o()],d.prototype,"rotation",null),t([o()],d.prototype,"supported",null),t([o({readOnly:!0})],d.prototype,"state",null),t([o()],d.prototype,"view",void 0),d=t([i("esri.widgets.DirectionalPad.DirectionalPadViewModel")],d);const h=d;export{h as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{directionalPadMoveOnceDuration as s}from"./constants.js";import{css as n}from"./css.js";import{angleToUnitVector as r,toUnitVector as v,vectorToClosestAngle as m}from"./utils.js";import{GoToMixin as a}from"../support/GoTo.js";let d=class extends(a(e.EventedAccessor)){constructor(t){super(t),this._initialAngle=void 0,this._movementVector=void 0,this._widgetCenter=void 0,this._anyAngleMovementEnabled=!1,this._movementTimeout=void 0,this._disabled=!1,this._moveOnceDuration=s,this.angle=void 0,this.speed=1,this.beginFollowingPointer=(t,e)=>{if(this.disabled)return;this._widgetCenter=e;const o=this._pointerLocationToVector(t);if(void 0===o)return;const i=this._resolveClosestAngle(t,o);void 0!==i&&(this._emitMove(r(i)),this.angle=i,this._initialAngle=i,this._setMovementTimeout((()=>{void 0===this._widgetCenter&&this._stopMovement()})),document.addEventListener("pointermove",this._onPointerMove,{passive:!0}),document.addEventListener("pointerup",this._onPointerUp,{passive:!0,once:!0}))},this.moveOnce=t=>{const e=r(t);this._emitMove(e),this._setMovementTimeout(this._stopMovement)},this._pointerLocationToVector=t=>{if(void 0===this._widgetCenter)return;const{x:e,y:o}=v(this._widgetCenter,t);return{x:e,y:-o}},this._resolveClosestAngle=(t,e)=>{const o=t.target,i=o?.getAttribute?.("data-angle"),s=o?.classList?.contains(n.compassButton);if(s)return;const r=Number.parseInt(i??"",10);return Number.isNaN(r)?m(e):r},this._onPointerMove=t=>{if(0===t.buttons)return void this._stopMovement();const e=this._pointerLocationToVector(t);if(void 0===e)return;this._setMovementTimeout(void 0);const o=this._resolveClosestAngle(t,e);if(void 0===o)return void this._emitStop();const i=r(o),s=null!=this._initialAngle&&this._initialAngle!==o;this._anyAngleMovementEnabled||=s;const n=this._anyAngleMovementEnabled?e:i;(n.x!==this._movementVector?.x||n.y!==this._movementVector?.y)&&(this.angle=o,this._emitMove(n))},this._onPointerUp=()=>{void 0===this._movementTimeout?this._stopMovement():this._widgetCenter=void 0},this._stopMovement=()=>{this._emitStop(),this._widgetCenter=void 0,this._initialAngle=void 0,this._anyAngleMovementEnabled=!1,document.removeEventListener("pointermove",this._onPointerMove),document.removeEventListener("pointerup",this._stopMovement),this._setMovementTimeout(void 0)},this.on("move-start",(()=>this.view?.mapViewNavigation.begin())),this.on("move-direction-change",(({vector:{x:t,y:e}})=>this.view?.mapViewNavigation.continuousPanVector({x:t*this.speed,y:e*this.speed}))),this.on("move-stop",(()=>this.view?.mapViewNavigation.stop()))}destroy(){this._stopMovement()}get disabled(){const{view:t,_disabled:e,supported:o}=this;return!1===t?.ready||e||!o}set disabled(t){this._disabled=t}get rotation(){return this.view?.rotation??this._get("rotation")??0}set rotation(t){this.view?this.view.constraints.rotationEnabled&&this.callGoTo({target:{rotation:t},options:{animate:0===t}}):this._set("rotation",t)}get supported(){return null==this.view||"2d"===this.view.type}get state(){const{disabled:t,angle:e}=this;return t?"disabled":null!=e?"moving":"ready"}_setMovementTimeout(t){clearTimeout(this._movementTimeout),this._movementTimeout=void 0===t?void 0:setTimeout((()=>{this._movementTimeout=void 0,t()}),this._moveOnceDuration)}_emitMove(t){null==this._movementVector&&this._emitMoveStartEvent({vector:t});const e=this._movementVector;this._movementVector=t,this._emitMoveDirectionChangeEvent({vector:t,oldVector:e})}_emitStop(){this.angle=void 0,void 0!==this._movementVector&&(this._emitMoveStopEvent({oldVector:this._movementVector}),this._movementVector=void 0)}_emitMoveStartEvent(t){this.emit("move-start",{...t,type:"move-start"})}_emitMoveDirectionChangeEvent(t){this.emit("move-direction-change",{...t,type:"move-direction-change"})}_emitMoveStopEvent(t){this.emit("move-stop",{...t,type:"move-stop"})}};t([o()],d.prototype,"_initialAngle",void 0),t([o()],d.prototype,"_movementVector",void 0),t([o()],d.prototype,"_widgetCenter",void 0),t([o()],d.prototype,"_anyAngleMovementEnabled",void 0),t([o()],d.prototype,"_movementTimeout",void 0),t([o()],d.prototype,"_disabled",void 0),t([o()],d.prototype,"_moveOnceDuration",void 0),t([o()],d.prototype,"disabled",null),t([o()],d.prototype,"angle",void 0),t([o({type:Number,range:{min:0,max:100}})],d.prototype,"speed",void 0),t([o()],d.prototype,"rotation",null),t([o()],d.prototype,"supported",null),t([o({readOnly:!0})],d.prototype,"state",null),t([o()],d.prototype,"view",void 0),d=t([i("esri.widgets.DirectionalPad.DirectionalPadViewModel")],d);const h=d;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.28/esri/copyright.txt for details.
4
4
  */
5
- const o=[-45,0,45,-90,90,-135,180,135],n=[...o,-180],e={0:{label:"north",iconName:"chevron-up"},45:{label:"northEast",iconName:"chevron-up",iconRotation:45},90:{label:"east",iconName:"chevron-right"},135:{label:"southEast",iconName:"chevron-down",iconRotation:-45},180:{label:"south",iconName:"chevron-down"},"-135":{label:"southWest",iconName:"chevron-down",iconRotation:45},"-90":{label:"west",iconName:"chevron-left"},"-45":{label:"northWest",iconName:"chevron-up",iconRotation:-45}},t=200,a="";export{o as directionalPadAngles,e as directionalPadArrows,a as directionalPadCenterAngle,n as directionalPadCyclicalAngles,t as directionalPadMoveOnceDuration};
5
+ const e=[-45,0,45,-90,90,-135,180,135],o=[...e,-180],n={0:{label:"north",iconName:"chevron-up"},45:{label:"northEast",iconName:"chevron-up-right"},90:{label:"east",iconName:"chevron-right"},135:{label:"southEast",iconName:"chevron-down-right"},180:{label:"south",iconName:"chevron-down"},"-135":{label:"southWest",iconName:"chevron-down-left"},"-90":{label:"west",iconName:"chevron-left"},"-45":{label:"northWest",iconName:"chevron-up-left"}},t=200,a="";export{e as directionalPadAngles,n as directionalPadArrows,a as directionalPadCenterAngle,o as directionalPadCyclicalAngles,t as directionalPadMoveOnceDuration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import{eventKey as e}from"../core/events.js";import{watch as i}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import{canShowNorth as r}from"./Compass/utils.js";import{directionalPadAngles as a,directionalPadArrows as l}from"./DirectionalPad/constants.js";import{css as c}from"./DirectionalPad/css.js";import d from"./DirectionalPad/DirectionalPadViewModel.js";import{findElementCenter as p}from"./DirectionalPad/utils.js";import u from"./DirectionalPad/VisibleElements.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import{isActivationKey as v}from"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{tsx as _}from"./support/jsxFactory.js";const g="esri.widgets.DirectionalPad";let w=class extends n{constructor(t,i){super(t,i),this._buttonsContainer=null,this._buttons={},this.iconClass=c.widgetIcon,this.icon=null,this.messages=null,this.visibleElements=new u,this.viewModel=new d,this.visualScale="s",this._rotateIcon=t=>({"--rotation":`rotate(${t}deg)`}),this._afterButtonContainerCreate=t=>{this._buttonsContainer=t,this._buttonsContainer.addEventListener("contextmenu",this._onContextMenu,{capture:!0})},this._afterButtonContainerRemoved=()=>{this._buttonsContainer?.removeEventListener("contextmenu",this._onContextMenu,{capture:!0}),this._buttonsContainer=null},this._afterButtonCreate=(t,e)=>{this._buttons[t]=e},this._afterButtonRemoved=t=>{this._buttons[t]=void 0},this._onContextMenu=t=>t.preventDefault(),this._onButtonPointerDown=t=>{if(null===this._buttonsContainer)return;const e=t.target,i=e?.shadowRoot?.querySelector("button");i?.hasPointerCapture(t.pointerId)&&i.releasePointerCapture(t.pointerId);const o=p(this._buttonsContainer);this.viewModel.beginFollowingPointer(t,o)},this._onKeyDown=(t,i)=>{const o=e(i);v(o)&&this.viewModel.moveOnce(t)},this._onSliderInput=({target:t})=>{"number"==typeof t.value&&(this.viewModel.rotation=t.value)},this._onRotationReset=()=>{this.viewModel.rotation=0}}loadDependencies(){return h({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-pad":()=>import("@esri/calcite-components/dist/components/calcite-action-pad.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider.js")})}initialize(){this.addHandles(i((()=>this.viewModel.angle),(()=>{const t=this._buttonsContainer?.contains(document.activeElement);t&&(null==this.viewModel.angle?this.container?.focus():this._buttons[this.viewModel.angle]?.setFocus())})))}get disabled(){return this.viewModel.disabled}set disabled(t){this.viewModel.disabled=t}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get speed(){return this.viewModel.speed}set speed(t){this.viewModel.speed=t}get _rotationEnabled(){return!this.view?.ready||this.view.constraints.rotationEnabled}render(){const{label:t,disabled:e,viewModel:i}=this,o=this.classes(c.base,m.widget,e?m.disabled:null);return _("div",{"aria-label":t,class:o,tabIndex:-1},i.supported?this._renderContent():this._renderUnsupportedMessage)}_renderUnsupportedMessage(){return _("section",{class:c.error,key:"unsupported"},_("p",null,this.messages.unsupported))}_renderContent(){return[this.visibleElements.directionalButtons?this._renderDirectionalButtons():void 0,this.visibleElements.rotationSlider?this._renderRotation():void 0]}_renderDirectionalButtons(){return _("calcite-action-pad",{expandDisabled:!0,key:"directional-buttons-container",layout:"grid"},_("calcite-action-group",{afterCreate:this._afterButtonContainerCreate,afterRemoved:this._afterButtonContainerRemoved,class:c.buttonsContainer},a.slice(0,4).map((t=>this._renderButton(t))),this._renderCompass(),a.slice(4).map((t=>this._renderButton(t)))))}_renderButton(t){const{label:e,iconName:i,iconRotation:o=0}=l[t];return _("calcite-action",{active:this.viewModel.angle===t,afterCreate:this._afterButtonCreate.bind(this,t),afterRemoved:this._afterButtonRemoved.bind(this,t),alignment:"center",class:c.button,"data-angle":t.toString(),disabled:this.disabled,key:t,onkeydown:this._onKeyDown.bind(void 0,t),onpointerdown:this._onButtonPointerDown,scale:this.visualScale,styles:this._rotateIcon(o),text:this.messages[e]},_("calcite-icon",{icon:i,scale:this.visualScale}))}_renderCompass(){const t=this.disabled||r(this.view)?"compass-needle":"arrow-up",e=0===this.viewModel.rotation;return _("calcite-action",{alignment:"center",class:c.compassButton,disabled:this.disabled||!this._rotationEnabled||e,key:"compass",onclick:this._onRotationReset,scale:this.visualScale,styles:this._rotateIcon(this.viewModel.rotation),text:this.messages.resetHeading},!e&&_("calcite-icon",{icon:t,scale:this.visualScale}))}_renderRotation(){return _("calcite-action-pad",{expandDisabled:!0,key:"slider-container",layout:"horizontal"},_("calcite-action-group",{class:c.rotationContainer},this.visibleElements.rotationResetButton?this._renderRotationResetButton():null,this._renderRotationSlider()))}_renderRotationResetButton(){return _("calcite-action",{alignment:"center",class:c.rotationReset,disabled:this.disabled||!this._rotationEnabled,onclick:this._onRotationReset,scale:this.visualScale,text:this.messages.resetHeading},_("calcite-icon",{flipRtl:!0,icon:"rotate",scale:this.visualScale}))}_renderRotationSlider(){return _("div",{class:c.rotationSliderContainer},_("calcite-slider",{"aria-label":this.messages.heading,disabled:this.disabled||!this._rotationEnabled,labelHandles:!0,max:360,min:0,required:!0,scale:this.visualScale,value:Math.round(this.viewModel.rotation),onCalciteSliderInput:this._onSliderInput}))}};t([o()],w.prototype,"_buttonsContainer",void 0),t([o()],w.prototype,"_buttons",void 0),t([o()],w.prototype,"disabled",null),t([o()],w.prototype,"iconClass",void 0),t([o()],w.prototype,"icon",void 0),t([o()],w.prototype,"label",null),t([o(),b("esri/widgets/DirectionalPad/t9n/DirectionalPad")],w.prototype,"messages",void 0),t([o({type:u,nonNullable:!0})],w.prototype,"visibleElements",void 0),t([o()],w.prototype,"view",null),t([o()],w.prototype,"viewModel",void 0),t([o()],w.prototype,"visualScale",void 0),t([o()],w.prototype,"speed",null),t([o({readOnly:!0})],w.prototype,"_rotationEnabled",null),w=t([s(g)],w);const f=w;export{f as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import{eventKey as e}from"../core/events.js";import{watch as i}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import{canShowNorth as r}from"./Compass/utils.js";import{directionalPadAngles as a,directionalPadArrows as l}from"./DirectionalPad/constants.js";import{css as c}from"./DirectionalPad/css.js";import d from"./DirectionalPad/DirectionalPadViewModel.js";import{findElementCenter as p}from"./DirectionalPad/utils.js";import u from"./DirectionalPad/VisibleElements.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import{isActivationKey as v}from"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{tsx as _}from"./support/jsxFactory.js";const g="esri.widgets.DirectionalPad";let w=class extends n{constructor(t,i){super(t,i),this._buttonsContainer=null,this._buttons={},this.iconClass=c.widgetIcon,this.icon=null,this.messages=null,this.visibleElements=new u,this.viewModel=new d,this.visualScale="s",this._rotateIcon=t=>({"--rotation":`rotate(${t}deg)`}),this._afterButtonContainerCreate=t=>{this._buttonsContainer=t,this._buttonsContainer.addEventListener("contextmenu",this._onContextMenu,{capture:!0})},this._afterButtonContainerRemoved=()=>{this._buttonsContainer?.removeEventListener("contextmenu",this._onContextMenu,{capture:!0}),this._buttonsContainer=null},this._afterButtonCreate=(t,e)=>{this._buttons[t]=e},this._afterButtonRemoved=t=>{this._buttons[t]=void 0},this._onContextMenu=t=>t.preventDefault(),this._onButtonPointerDown=t=>{if(null===this._buttonsContainer)return;const e=t.target,i=e?.shadowRoot?.querySelector("button");i?.hasPointerCapture(t.pointerId)&&i.releasePointerCapture(t.pointerId);const o=p(this._buttonsContainer);this.viewModel.beginFollowingPointer(t,o)},this._onKeyDown=(t,i)=>{const o=e(i);v(o)&&this.viewModel.moveOnce(t)},this._onSliderInput=({target:t})=>{"number"==typeof t.value&&(this.viewModel.rotation=t.value)},this._onRotationReset=()=>{this.viewModel.rotation=0}}loadDependencies(){return h({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-pad":()=>import("@esri/calcite-components/dist/components/calcite-action-pad.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider.js")})}initialize(){this.addHandles(i((()=>this.viewModel.angle),(()=>{const t=this._buttonsContainer?.contains(document.activeElement);t&&(null==this.viewModel.angle?this.container?.focus():this._buttons[this.viewModel.angle]?.setFocus())})))}get disabled(){return this.viewModel.disabled}set disabled(t){this.viewModel.disabled=t}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get speed(){return this.viewModel.speed}set speed(t){this.viewModel.speed=t}get _rotationEnabled(){return!this.view?.ready||this.view.constraints.rotationEnabled}render(){const{label:t,disabled:e,viewModel:i}=this,o=this.classes(c.base,m.widget,e?m.disabled:null);return _("div",{"aria-label":t,class:o,tabIndex:-1},i.supported?this._renderContent():this._renderUnsupportedMessage)}_renderUnsupportedMessage(){return _("section",{class:c.error,key:"unsupported"},_("p",null,this.messages.unsupported))}_renderContent(){return[this.visibleElements.directionalButtons?this._renderDirectionalButtons():void 0,this.visibleElements.rotationSlider?this._renderRotation():void 0]}_renderDirectionalButtons(){return _("calcite-action-pad",{expandDisabled:!0,key:"directional-buttons-container",layout:"grid"},_("calcite-action-group",{afterCreate:this._afterButtonContainerCreate,afterRemoved:this._afterButtonContainerRemoved,class:c.buttonsContainer},a.slice(0,4).map((t=>this._renderButton(t))),this._renderCompass(),a.slice(4).map((t=>this._renderButton(t)))))}_renderButton(t){const{label:e,iconName:i}=l[t];return _("calcite-action",{active:this.viewModel.angle===t,afterCreate:this._afterButtonCreate.bind(this,t),afterRemoved:this._afterButtonRemoved.bind(this,t),alignment:"center",class:c.button,"data-angle":t.toString(),disabled:this.disabled,key:t,onkeydown:this._onKeyDown.bind(void 0,t),onpointerdown:this._onButtonPointerDown,scale:this.visualScale,text:this.messages[e]},_("calcite-icon",{icon:i,scale:this.visualScale}))}_renderCompass(){const t=this.disabled||r(this.view)?"compass-needle":"arrow-up",e=0===this.viewModel.rotation;return _("calcite-action",{alignment:"center",class:c.compassButton,disabled:this.disabled||!this._rotationEnabled||e,key:"compass",onclick:this._onRotationReset,scale:this.visualScale,styles:this._rotateIcon(this.viewModel.rotation),text:this.messages.resetHeading},!e&&_("calcite-icon",{icon:t,scale:this.visualScale}))}_renderRotation(){return _("calcite-action-pad",{expandDisabled:!0,key:"slider-container",layout:"horizontal"},_("calcite-action-group",{class:c.rotationContainer},this.visibleElements.rotationResetButton?this._renderRotationResetButton():null,this._renderRotationSlider()))}_renderRotationResetButton(){return _("calcite-action",{alignment:"center",class:c.rotationReset,disabled:this.disabled||!this._rotationEnabled,onclick:this._onRotationReset,scale:this.visualScale,text:this.messages.resetHeading},_("calcite-icon",{flipRtl:!0,icon:"rotate",scale:this.visualScale}))}_renderRotationSlider(){return _("div",{class:c.rotationSliderContainer},_("calcite-slider",{"aria-label":this.messages.heading,disabled:this.disabled||!this._rotationEnabled,labelHandles:!0,max:360,min:0,required:!0,scale:this.visualScale,value:Math.round(this.viewModel.rotation),onCalciteSliderInput:this._onSliderInput}))}};t([o()],w.prototype,"_buttonsContainer",void 0),t([o()],w.prototype,"_buttons",void 0),t([o()],w.prototype,"disabled",null),t([o()],w.prototype,"iconClass",void 0),t([o()],w.prototype,"icon",void 0),t([o()],w.prototype,"label",null),t([o(),b("esri/widgets/DirectionalPad/t9n/DirectionalPad")],w.prototype,"messages",void 0),t([o({type:u,nonNullable:!0})],w.prototype,"visibleElements",void 0),t([o()],w.prototype,"view",null),t([o()],w.prototype,"viewModel",void 0),t([o()],w.prototype,"visualScale",void 0),t([o()],w.prototype,"speed",null),t([o({readOnly:!0})],w.prototype,"_rotationEnabled",null),w=t([s(g)],w);const f=w;export{f as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Error.js";import{on as t}from"../../core/events.js";import{throwIfAborted as i,createResolver as l}from"../../core/promiseUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import n from"../../geometry/Point.js";import{uploadProgressWeights as c}from"../../layers/graphics/sources/support/uploadProgressWeights.js";import{getSupportedExtensions as u}from"../../layers/support/infoFor3D.js";import{makeProgressManager as m,estimatedTransferTime as d}from"../../support/progressUtils.js";let f=class extends e{constructor(){super({}),this.files=[],this.progress=0,this._uploadTask=null,this._layer=null}destroy(){this.cancel(),this.files=[],this._layer=null,this._uploadTask=null}get state(){const r=this._uploadTask;return r&&0!==this.files.length?r.finished?r.error?"error":"success":"pending":"default"}get result(){return this._uploadTask?.value??null}get error(){return this._uploadTask?.error??null}uploadTo(r){this.cancel(),this.files=[],this._layer=r,this._uploadTask=o((async e=>{const o=await y(r);i(e),this.progress=0,this.files=o;const t=m(c.upload,(r=>{this.progress=r}),"Upload.uploadTo");if(0===o.length)return null;const{default:l}=await import("../../geometry/Mesh.js");i(e);const a=await l.extractAndFilterFiles(o,r);i(e),a.length>0&&(this.files=a);const p=new n({x:0,y:0,z:0,spatialReference:r.spatialReference}),u=await l.createFromFiles(p,a,{layer:r,signal:e,onProgress:t.makeOnProgress("createFromFiles")});if(i(e),!u)throw new s("editor:upload","could not upload or convert model");const f=a.reduce(((r,e)=>r+e.size),0),h=t.simulate("loadMesh",d(f));try{await u.load()}finally{h.remove()}return u}))}retry(){this._layer&&this.uploadTo(this._layer)}cancel(){this._uploadTask?.abort()}};r([a()],f.prototype,"files",void 0),r([a()],f.prototype,"progress",void 0),r([a()],f.prototype,"state",null),r([a()],f.prototype,"result",null),r([a()],f.prototype,"error",null),r([a()],f.prototype,"_uploadTask",void 0),r([a()],f.prototype,"_layer",void 0),f=r([p("esri.widgets.Editor.Upload")],f);let h=null;async function y(r){const{resolve:e,promise:o}=l(),s=document.createElement("input");s.type="file",s.multiple=!0,s.accept=[...u(r.infoFor3D),".zip"].join(",");const i=t(s,"change",(()=>e(s.files?Array.from(s.files):[])));return h?h(s):s.click(),o.finally((()=>i.remove()))}function g(r){h=e=>{Promise.resolve().then((()=>r)).then((r=>{if(!h)return;const o=new DataTransfer;r.forEach((r=>o.items.add(r))),e.files=o.files,e.dispatchEvent(new Event("change"))}))}}function j(){h=null}export{f as Upload,j as clearPromptForFilesStub,g as stubFilePickerToSelect};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Error.js";import{on as t}from"../../core/events.js";import{throwIfAborted as i,createResolver as l}from"../../core/promiseUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Point.js";import{uploadProgressWeights as c}from"../../layers/graphics/sources/support/uploadProgressWeights.js";import{getSupportedExtensions as u}from"../../layers/support/infoFor3D.js";import{makeProgressManager as d,estimatedTransferTime as m}from"../../support/progressUtils.js";let f=class extends r{constructor(){super({}),this.files=[],this.progress=0,this._uploadTask=null,this._layer=null}destroy(){this.cancel(),this.files=[],this._layer=null,this._uploadTask=null}get state(){const e=this._uploadTask;return e&&0!==this.files.length?e.finished?e.error?"error":"success":"pending":"default"}get result(){return this._uploadTask?.value??null}get error(){return this._uploadTask?.error??null}uploadTo(e){this.cancel(),this.files=[],this._layer=e,this._uploadTask=o((async r=>{const o=await y(e);i(r),this.progress=0,this.files=o;const t=d(c.upload,(e=>{this.progress=e}),"Upload.uploadTo");if(0===o.length)return null;const{default:l}=await import("../../geometry/Mesh.js");i(r);const a=await l.extractAndFilterFiles(o,e);i(r),a.length>0&&(this.files=a);const n=new p({x:0,y:0,z:0,spatialReference:e.spatialReference}),u=await l.createFromFiles(n,a,{layer:e,signal:r,onProgress:t.makeOnProgress("createFromFiles")});if(i(r),!u)throw new s("editor:upload","could not upload or convert model");const f=a.reduce(((e,r)=>e+r.size),0),h=t.simulate("loadMesh",m(f));try{await u.load()}finally{h.remove()}return u}))}retry(){this._layer&&this.uploadTo(this._layer)}cancel(){this._uploadTask?.abort()}};e([a()],f.prototype,"files",void 0),e([a()],f.prototype,"progress",void 0),e([a()],f.prototype,"state",null),e([a()],f.prototype,"result",null),e([a()],f.prototype,"error",null),e([a()],f.prototype,"_uploadTask",void 0),e([a()],f.prototype,"_layer",void 0),f=e([n("esri.widgets.Editor.Upload")],f);let h=null;async function y(e){const{resolve:r,promise:o}=l(),s=document.createElement("input");s.type="file",s.multiple=!1,s.accept=[...u(e.infoFor3D),".zip"].join(","),s.style.display="none",document.body.appendChild(s);const i=t(s,"change",(()=>r(s.files?Array.from(s.files):[])));return h?h(s):s.click(),o.finally((()=>{i.remove(),s.remove()}))}function g(e){h=r=>{Promise.resolve().then((()=>e)).then((e=>{if(!h)return;const o=new DataTransfer;e.forEach((e=>o.items.add(e))),r.files=o.files,r.dispatchEvent(new Event("change"))}))}}function j(){h=null}export{f as Upload,j as clearPromptForFilesStub,g as stubFilePickerToSelect};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Graphic.js";import{addMany as t}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import"../../core/has.js";import{handlesGroup as i,makeHandle as n}from"../../core/handleUtils.js";import{clone as a}from"../../core/lang.js";import{whenOrAbort as s,throwIfAborted as l,debounce as o}from"../../core/promiseUtils.js";import{watch as c,whenOnce as u}from"../../core/reactiveUtils.js";import{px2pt as p}from"../../core/screenUtils.js";import{diff as y}from"../../core/accessorSupport/diffUtils.js";import{featureHasFields as d,fixFields as f,getDisplayFieldName as m}from"../../layers/support/fieldUtils.js";import{calculateTolerance as h}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as g}from"../../renderers/support/lengthUtils.js";import{getTransformationType as b,TransformationType as w}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as v,getSize as S}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{sceneLayerEditingEnabled as j,i3sPatchingEnabled as U}from"../../support/featureFlags.js";import{to3D as I}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as V}from"../../symbols/support/symbolUtils.js";import{GraphicState as F}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as L}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as T,filterGraphicHits as z}from"../../views/support/hitTestSelectUtils.js";function x(e){const t=e.sourceLayer;if(!t||"feature"!==t.type||!P(t.renderer))return{rotation:null,size:null};let r=null,i=null;const n=t.renderer.getVisualVariablesForType("rotation").filter((t=>(!t.axis||"heading"===t.axis)&&t.field&&!t.valueExpression&&null!=v(t,e)));1===n.length&&(r=E(n[0],t));const a=t.renderer.getVisualVariablesForType("size").filter((t=>t.field&&!t.useSymbolValue&&!t.valueExpression&&b(t)===w.RealWorldSize&&null!=S(t,e)));return 1===a.length&&(i=M(a[0],t)),{rotation:r,size:i}}function E(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,i=e.field,n=t.fields&&t.fields.filter((e=>e.name===i)),a=n&&1===n.length?n[0].type:"double",s={initial:0,current:0};return{field:i,fieldType:a,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-r*e,O((s.current+360)%360,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function k(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function A(e,t,r){if(null==t)return 0;const{symbol:i}=I(t);if(null==i||"web-style"===i.type||"cim"===i.type)return 0;const n=i.symbolLayers.at(0);if(!n)return 0;switch(n.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return n.size||Math.min(ie.icon,(await e(n,ie.icon))[0])||ie.icon}case"text":return n.size||ie.text;case"line":return n.size||ie.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return k(await t(n,e.scale/ie.viewScaleSizeFactor),r)}case"path":return(null!=n.width?n.width:n.height)||e.scale/ie.viewScaleSizeFactor;case"extrude":return n.size||e.scale/ie.viewScaleSizeFactor;default:return 0}}function M(e,t){const r=e.field,i=e.axis,n=t.fields&&t.fields.filter((e=>e.name===r)),a=n&&1===n.length?n[0].type:"double",s={updating:!1,initial:0,current:0},l=g[e.valueUnit]??1;let o;return o="area"===e.valueRepresentation?e=>(e*l/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*l/2:e=>e*l,{field:r,fieldType:a,getDefault:async(e,t)=>O(o(await A(t,e,i)),a),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,O(s.current,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,displayUnit:le(e.valueUnit),axis:e.axis}}function O(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function P(e){switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function R(e,t,r){const i=await V(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=y(e.symbol,i)&&(e.symbol=i)}function C(e){if(!e)throw new Error("no geometry type");return"multipatch"===e?"mesh":e}async function G(e,t,r,a){(await D(e,t,a)).remove();const s=e.on("create",(async i=>{if("cancel"===i.state){(await D(e,t,a)).remove()}if("complete"===i.state){const n=i.graphic;n.sourceLayer||(n.sourceLayer=t.layer),n.attributes||(n.attributes={...t.template?.prototype.attributes});const s="2d"===e.view?.type?e.view?.scale:null;await R(n,a,s),r(n)}}));return i([s,n((()=>e.cancel()))])}async function D(e,t,r){const i=t.layer,a={...t.template?.prototype.attributes,...t.attributeOverrides};let s=null;const{view:l}=e,u="2d"===l?.type;if(await q(e,i,a,r,u?l.scale:null),u){const t=o((t=>q(e,i,a,r,t)));s=c((()=>l.scale),(e=>t(e)))}return e.layer.elevationInfo=i.elevationInfo,await e.create(C(i.geometryType),{graphicProperties:{attributes:a,sourceLayer:i},hasZ:i.capabilities.data.supportsZ,geometryToPlace:t.geometryToPlace??void 0}),s??n()}async function q(t,r,i,n,a){const s=new e({sourceLayer:r,attributes:i}),{rotation:l,size:o}=x(s);let c=await V(s,{useSourceLayer:!0,webStyleCache:n,scale:a}),u=!1;for(const e of[o,l]){if(null==e)continue;null==i[e.field]&&(i[e.field]=await e.getDefault(c,t.view),u=!0)}switch(u&&(c=await V(s,{useSourceLayer:!0,webStyleCache:n,scale:a})),c?.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=c;break;case"simple-line":case"line-3d":t.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":t.pointSymbol=c;break;case"mesh-3d":t.meshSymbol=c}Z(t.tooltipOptions,o,l)}function Z(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Q(e,t){return e?e.find((e=>e.layer===t)):void 0}async function B(e,t,r,i){switch(t.type){case"3d":return W(e,t,r,i);case"2d":return _(e,t,r,i)}}async function W(e,r,i,n){if(0===e.length)return[];const{updatable:a,graphicsByLayer:l}=await i.async((async()=>{const{results:t}=await s(T(r,i),n),a=new Map,l=e=>{const t=e.layer,r=a.get(t);if(!r){const e=new Array;return a.set(t,e),e}return r};z(t).forEach((({graphic:e})=>l(e).push(e)));const o=e.filter((({supports:e,layer:t})=>e.includes("update")&&a.has(t)));return 0!==o.length&&i.stopPropagation(),{updatable:o,graphicsByLayer:a}}));return s(Promise.allSettled(a.map((async({layer:e})=>{const r=l.get(e),i=H(e);if(r.every((e=>d(i,e))))return r;const a=[];for(const n of r){a.push(n.getObjectId());const e=Object.keys(n.attributes);t(i,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=a,s.outFields=f(e.fieldsIndex,i),e.queryFeatures(s,{signal:n}).then((({features:e})=>e))}))),n)}async function _(e,t,r,i){if(0===e.length)return[];let n=null;const a=await r.async((async()=>{const{results:a}=await s(t.hitTest(r),i);if(0===a.length)return[];const l=new Set;n=z(a),n.forEach((({graphic:e})=>e&&l.add(e.layer)));const o=e.items.filter((({layer:e,supports:t,attachmentsOnUpdateEnabled:r})=>l.has(e)&&(t.includes("update")||t.includes("delete")||r)));return o.length>0&&r.stopPropagation(),o}));return s(Promise.allSettled(a.map((async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!1,a.outFields=H(e);const s="renderer"in e?h({renderer:e.renderer,event:r}):0;a.geometry=L(r.mapPoint,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:i});return n?.forEach((({graphic:t})=>{t.layer!==e||l.some((e=>e.getObjectId()===t.getObjectId()))||l.push(t)})),l}))),i)}function H(e){return f(e.fieldsIndex,[e.objectIdField,m({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function J(e,t,r){const{sourceLayer:i}=e,n=i.createQuery();n.objectIds=[e.getAttribute(i.objectIdField)],n.outFields=["*"],n.outSpatialReference=t,n.returnM=i.capabilities.data.supportsM,n.returnZ=i.capabilities.data.supportsZ,j()&&U()&&"scene"===i.type&&null!=i.infoFor3D&&(n.returnGeometry=!0,n.formatOf3DObjects="3D_glb");const a=await i.queryFeatures(n,{signal:r});l(r);return a.features[0]}async function K(e){const{graphic:t,sketchViewModel:r,sourceLayer:i,visualVariables:n,webStyleCache:a}=e;let s=!1;const{rotation:l,size:o}=n;if([l,o].forEach((async e=>{if(null==e)return;const i=t.getAttribute(e.field);if(null!=i)e.initValue(i);else{const i=await e.getDefault(t.symbol,r.view);e.initValue(i),t.setAttribute(e.field,i),s=!0}})),s){const e="2d"===r.view?.type?r.view.scale:null;await R(t,a,e)}const c={multipleSelectionEnabled:!1};return"point"===i.geometryType&&(c.enableRotation=null!=l,c.enableScaling=null!=o),Z(r.tooltipOptions,o,l),r.layer.elevationInfo=i.elevationInfo,r.update(t,c)}function N(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function X(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function Y(e,t,r,i,n){if(null==t.geometry||"point"!==t.geometry?.type)return;const a=i.rotation,s=N(r.toolEventInfo);if(null!=a&&null!=s)if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.initValue();else{a.isUpdatingInteractively=!0;const{field:r,getValue:i}=a;t.setAttribute(r,i(s.angle,e))}const l=i.size,o=X(r.toolEventInfo);if(null!=l&&null!=o)if("scale-stop"===o.type)l.isUpdatingInteractively=!1,l.initValue();else{l.isUpdatingInteractively=!0;const{field:r,getValue:i}=l;t.setAttribute(r,i(o.xScale,e))}await R(t,n,"2d"===e.type?e.scale:null)}async function $(e,t,r,a,s,l){await R(e,l,"2d"===a.type?a.scale:null);let u=null;if("2d"===r?.view?.type){const t=o((t=>R(e,l,t)));u=c((()=>r?.view?.scale),(e=>t(e)))}a.map.add(r.layer);const p=e.sourceLayer,y=pe(a,p);await re(a,e),await K({graphic:e,sketchViewModel:r,sourceLayer:p,visualVariables:t,webStyleCache:l});let d=null;y.then((e=>d=e)).catch((()=>{}));const f=t.size,m=t.rotation,h=c((()=>e.attributes),(async t=>{let r=!1;for(const i in t){const n=t[i];n!==e.getAttribute(i)&&(e.setAttribute(i,n),null==f||f.isUpdatingInteractively||f.field!==i||f.initValue(n),null==m||m.isUpdatingInteractively||m.field!==i||m.initValue(n),(null==d||d.requiredFields.includes(i))&&(r=!0))}r&&await R(e,l,"2d"===a.type?a.scale:null)})),g=r.on("update",(async e=>{const i=e.graphics[0];if("complete"===e.state)return K({graphic:i,sketchViewModel:r,sourceLayer:p,visualVariables:t,webStyleCache:l});await Y(a,i,e,t,l),s(fe(i),e)})),b=r.on(["undo","redo"],(async e=>{s(fe(e.graphics[0]),e)}));return i([b,g,n((()=>r.cancel())),h,u])}function ee(e,t,a){const s=e.view;e.layer.add(a);const o=t.sourceLayer,c=t.layer,p=t.getAttribute(c.objectIdField);let y=null;function d(e){y?.abort(),y=r((async t=>{const r=await pe(s,o);l(t),r.setVisibility?.(p,e)}))}return d(!1),i([te(s,a,(e=>d(!e))),n((async()=>{d(!0);try{const e=await pe(s,o);await u((()=>!e.updating))}finally{e.layer.remove(a)}}))])}function te(e,t,r){if("3d"===e.type){const n=new F({graphic:t});return i([e.trackGraphicState(n),c((()=>n.displaying),r)])}return c((()=>t.visible),r)}async function re(e,t){if("3d"===e.type){const r=new F({graphic:t}),i=e.trackGraphicState(r);await u((()=>r.displaying)),i.remove()}else await u((()=>t.visible))}const ie={icon:p(24),text:p(12),line:p(1),viewScaleSizeFactor:100};function ne(e,t,r){let i=!1;return e.filter((e=>!!i||(i=e===t,i))).map((e=>r[e]()))}function ae(e){if(1!==e.length)return null;const t=e[0];if("items"in t){const e=t;return 1===e.items.length?e.items[0]:null}return t}function se(e,t){if(e.viewModel.syncFeatureTemplates(),"awaiting-feature-creation-info"===t[0].id){const r=ae(e.viewModel.featureTemplatesViewModel.items);null==r||r.supportsUpload||(e.creationInfo=r,t.shift())}return t}function le(e){switch(e){case"unknown":case"decimal-degrees":return null;default:return e}}function oe(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}function ce(e){const{creationInfo:t,viewModel:r}=e;if(!t)return!1;const{layer:i}=t,n=r.editableItems.find((e=>e.layer===i));if(n)return n.attachmentsOnCreateEnabled;const a=i.capabilities?.data,s=r.layerInfos?.find((e=>e.layer===i));return!(!(a&&"supportsAttachment"in a&&a.supportsAttachment)||s&&(!1===s.allowAttachments||!1===s.attachmentsOnUpdateEnabled))}const ue=e=>/-stop/.test(e)||/vertex-/.test(e),pe=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function ye(e){return"createInteractiveEditSession"in e}const de=Symbol();function fe(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=a(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function me(e){const t=e.cursor;return e.cursor="progress",n((()=>e.cursor=t))}export{de as UsesSketchViewModelSymbol,se as avoidFeatureTemplateSelectionWithOnlyOneItem,ye as canCreateInteractiveEditSession,fe as cloneGraphicExceptMesh,ne as createWorkflowSteps,B as fetchCandidates,J as fetchFullFeature,Q as findLayerInfo,x as getVisualVariableAttributes,ue as isTerminalUpdateEventType,oe as prepareAttachmentsForCreateWorkflow,G as setUpFeatureAdd,$ as setUpGeometryUpdate,ce as shouldShowAttachmentsForCreateWorkflow,me as showProgressCursor,ie as sizeDefaults,le as sizeVariableUnitToLengthUnit,D as startCreatingNewFeature,K as startUpdatingFeature,ee as swapForEditingSession,R as updateGraphicSymbolWhenRequired,Y as visualVariableInteractiveUpdate,pe as whenEditorLayerView,re as whenGraphicDisplayed};
5
+ import e from"../../Graphic.js";import{addMany as t}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import"../../core/has.js";import{handlesGroup as i,makeHandle as n}from"../../core/handleUtils.js";import{clone as a}from"../../core/lang.js";import{whenOrAbort as s,throwIfAborted as l,debounce as o}from"../../core/promiseUtils.js";import{watch as c,whenOnce as u}from"../../core/reactiveUtils.js";import{px2pt as p}from"../../core/screenUtils.js";import{diff as y}from"../../core/accessorSupport/diffUtils.js";import{featureHasFields as d,fixFields as f,getDisplayFieldName as m}from"../../layers/support/fieldUtils.js";import{calculateTolerance as g}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as h}from"../../renderers/support/lengthUtils.js";import{getTransformationType as b,TransformationType as w}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as v,getSize as S}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{sceneLayerEditingEnabled as j,i3sPatchingEnabled as U}from"../../support/featureFlags.js";import{to3D as I}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as V}from"../../symbols/support/symbolUtils.js";import{GraphicState as z}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as F}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as L,filterGraphicHits as T}from"../../views/support/hitTestSelectUtils.js";function x(e){const t=e.sourceLayer;if(!t||"feature"!==t.type||!P(t.renderer))return{rotation:null,size:null};let r=null,i=null;const n=t.renderer.getVisualVariablesForType("rotation").filter((t=>(!t.axis||"heading"===t.axis)&&t.field&&!t.valueExpression&&null!=v(t,e)));1===n.length&&(r=E(n[0],t));const a=t.renderer.getVisualVariablesForType("size").filter((t=>t.field&&!t.useSymbolValue&&!t.valueExpression&&b(t)===w.RealWorldSize&&null!=S(t,e)));return 1===a.length&&(i=A(a[0],t)),{rotation:r,size:i}}function E(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,i=e.field,n=t.fields&&t.fields.filter((e=>e.name===i)),a=n&&1===n.length?n[0].type:"double",s={initial:0,current:0};return{field:i,fieldType:a,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-r*e,M((s.current+360)%360,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function k(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function O(e,t,r){if(null==t)return 0;const{symbol:i}=I(t);if(null==i||"web-style"===i.type||"cim"===i.type)return 0;const n=i.symbolLayers.at(0);if(!n)return 0;switch(n.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return n.size||Math.min(ie.icon,(await e(n,ie.icon))[0])||ie.icon}case"text":return n.size||ie.text;case"line":return n.size||ie.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return k(await t(n,e.scale/ie.viewScaleSizeFactor),r)}case"path":return(null!=n.width?n.width:n.height)||e.scale/ie.viewScaleSizeFactor;case"extrude":return n.size||e.scale/ie.viewScaleSizeFactor;default:return 0}}function A(e,t){const r=e.field,i=e.axis,n=t.fields&&t.fields.filter((e=>e.name===r)),a=n&&1===n.length?n[0].type:"double",s={updating:!1,initial:0,current:0},l=h[e.valueUnit]??1;let o;return o="area"===e.valueRepresentation?e=>(e*l/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*l/2:e=>e*l,{field:r,fieldType:a,getDefault:async(e,t)=>M(o(await O(t,e,i)),a),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,M(s.current,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,displayUnit:le(e.valueUnit),axis:e.axis}}function M(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function P(e){switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function R(e,t,r){const i=await V(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=y(e.symbol,i)&&(e.symbol=i)}function C(e){if(!e)throw new Error("no geometry type");return"multipatch"===e?"mesh":e}async function D(e,t,r,a){(await G(e,t,a)).remove();const s=e.on("create",(async i=>{if("cancel"===i.state){(await G(e,t,a)).remove()}if("complete"===i.state){const n=i.graphic;n.sourceLayer||(n.sourceLayer=t.layer),n.attributes||(n.attributes={...t.template?.prototype.attributes});const s="2d"===e.view?.type?e.view?.scale:null;await R(n,a,s),r(n)}}));return i([s,n((()=>e.cancel()))])}async function G(e,t,r){const i=t.layer,a={...t.template?.prototype.attributes,...t.attributeOverrides};let s=null;const{view:l}=e,u="2d"===l?.type;if(await Z(e,i,a,r,u?l.scale:null),u){const t=o((t=>Z(e,i,a,r,t)));s=c((()=>l.scale),(e=>t(e)))}const{data:p,editing:y}=i.capabilities;return e.layer.elevationInfo=i.elevationInfo,await e.create(C(i.geometryType),{graphicProperties:{attributes:a,sourceLayer:i},hasZ:p.supportsZ,defaultZ:y.zDefault??e.defaultCreateOptions.defaultZ,geometryToPlace:t.geometryToPlace??void 0}),s??n()}async function Z(t,r,i,n,a){const s=new e({sourceLayer:r,attributes:i}),{rotation:l,size:o}=x(s);let c=await V(s,{useSourceLayer:!0,webStyleCache:n,scale:a}),u=!1;for(const e of[o,l]){if(null==e)continue;null==i[e.field]&&(i[e.field]=await e.getDefault(c,t.view),u=!0)}switch(u&&(c=await V(s,{useSourceLayer:!0,webStyleCache:n,scale:a})),c?.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=c;break;case"simple-line":case"line-3d":t.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":t.pointSymbol=c;break;case"mesh-3d":t.meshSymbol=c}q(t.tooltipOptions,o,l)}function q(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Q(e,t){return e?e.find((e=>e.layer===t)):void 0}async function B(e,t,r,i){switch(t.type){case"3d":return W(e,t,r,i);case"2d":return _(e,t,r,i)}}async function W(e,r,i,n){if(0===e.length)return[];const{updatable:a,graphicsByLayer:l}=await i.async((async()=>{const{results:t}=await s(L(r,i),n),a=new Map,l=e=>{const t=e.layer,r=a.get(t);if(!r){const e=new Array;return a.set(t,e),e}return r};T(t).forEach((({graphic:e})=>l(e).push(e)));const o=e.filter((({supports:e,layer:t})=>e.includes("update")&&a.has(t)));return 0!==o.length&&i.stopPropagation(),{updatable:o,graphicsByLayer:a}}));return s(Promise.allSettled(a.map((async({layer:e})=>{const r=l.get(e),i=H(e);if(r.every((e=>d(i,e))))return r;const a=[];for(const n of r){a.push(n.getObjectId());const e=Object.keys(n.attributes);t(i,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=a,s.outFields=f(e.fieldsIndex,i),e.queryFeatures(s,{signal:n}).then((({features:e})=>e))}))),n)}async function _(e,t,r,i){if(0===e.length)return[];let n=null;const a=await r.async((async()=>{const{results:a}=await s(t.hitTest(r),i);if(0===a.length)return[];const l=new Set;n=T(a),n.forEach((({graphic:e})=>e&&l.add(e.layer)));const o=e.items.filter((({layer:e,supports:t,attachmentsOnUpdateEnabled:r})=>l.has(e)&&(t.includes("update")||t.includes("delete")||r)));return o.length>0&&r.stopPropagation(),o}));return s(Promise.allSettled(a.map((async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!1,a.outFields=H(e);const s="renderer"in e?g({renderer:e.renderer,event:r}):0;a.geometry=F(r.mapPoint,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:i});return n?.forEach((({graphic:t})=>{t.layer!==e||l.some((e=>e.getObjectId()===t.getObjectId()))||l.push(t)})),l}))),i)}function H(e){return f(e.fieldsIndex,[e.objectIdField,m({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function J(e,t,r){const{sourceLayer:i}=e,n=i.createQuery();n.objectIds=[e.getAttribute(i.objectIdField)],n.outFields=["*"],n.outSpatialReference=t,n.returnM=i.capabilities.data.supportsM,n.returnZ=i.capabilities.data.supportsZ,j()&&U()&&"scene"===i.type&&null!=i.infoFor3D&&(n.returnGeometry=!0,n.formatOf3DObjects="3D_glb");const a=await i.queryFeatures(n,{signal:r});l(r);return a.features[0]}async function K(e){const{graphic:t,sketchViewModel:r,sourceLayer:i,visualVariables:n,webStyleCache:a}=e;let s=!1;const{rotation:l,size:o}=n;if([l,o].forEach((async e=>{if(null==e)return;const i=t.getAttribute(e.field);if(null!=i)e.initValue(i);else{const i=await e.getDefault(t.symbol,r.view);e.initValue(i),t.setAttribute(e.field,i),s=!0}})),s){const e="2d"===r.view?.type?r.view.scale:null;await R(t,a,e)}const c={multipleSelectionEnabled:!1};return"point"===i.geometryType&&(c.enableRotation=null!=l,c.enableScaling=null!=o),q(r.tooltipOptions,o,l),r.layer.elevationInfo=i.elevationInfo,r.update(t,c)}function N(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function X(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function Y(e,t,r,i,n){if(null==t.geometry||"point"!==t.geometry?.type)return;const a=i.rotation,s=N(r.toolEventInfo);if(null!=a&&null!=s)if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.initValue();else{a.isUpdatingInteractively=!0;const{field:r,getValue:i}=a;t.setAttribute(r,i(s.angle,e))}const l=i.size,o=X(r.toolEventInfo);if(null!=l&&null!=o)if("scale-stop"===o.type)l.isUpdatingInteractively=!1,l.initValue();else{l.isUpdatingInteractively=!0;const{field:r,getValue:i}=l;t.setAttribute(r,i(o.xScale,e))}await R(t,n,"2d"===e.type?e.scale:null)}async function $(e,t,r,a,s,l){await R(e,l,"2d"===a.type?a.scale:null);let u=null;if("2d"===r?.view?.type){const t=o((t=>R(e,l,t)));u=c((()=>r?.view?.scale),(e=>t(e)))}a.map.add(r.layer);const p=e.sourceLayer,y=pe(a,p);await re(a,e),await K({graphic:e,sketchViewModel:r,sourceLayer:p,visualVariables:t,webStyleCache:l});let d=null;y.then((e=>d=e)).catch((()=>{}));const f=t.size,m=t.rotation,g=c((()=>e.attributes),(async t=>{let r=!1;for(const i in t){const n=t[i];n!==e.getAttribute(i)&&(e.setAttribute(i,n),null==f||f.isUpdatingInteractively||f.field!==i||f.initValue(n),null==m||m.isUpdatingInteractively||m.field!==i||m.initValue(n),(null==d||d.requiredFields.includes(i))&&(r=!0))}r&&await R(e,l,"2d"===a.type?a.scale:null)})),h=r.on("update",(async e=>{const i=e.graphics[0];if("complete"===e.state)return K({graphic:i,sketchViewModel:r,sourceLayer:p,visualVariables:t,webStyleCache:l});await Y(a,i,e,t,l),s(fe(i),e)})),b=r.on(["undo","redo"],(async e=>{s(fe(e.graphics[0]),e)}));return i([b,h,n((()=>r.cancel())),g,u])}function ee(e,t,a){const s=e.view;e.layer.add(a);const o=t.sourceLayer,c=t.layer,p=t.getAttribute(c.objectIdField);let y=null;function d(e){y?.abort(),y=r((async t=>{const r=await pe(s,o);l(t),r.setVisibility?.(p,e)}))}return d(!1),i([te(s,a,(e=>d(!e))),n((async()=>{d(!0);try{const e=await pe(s,o);await u((()=>!e.updating))}finally{e.layer.remove(a)}}))])}function te(e,t,r){if("3d"===e.type){const n=new z({graphic:t});return i([e.trackGraphicState(n),c((()=>n.displaying),r)])}return c((()=>t.visible),r)}async function re(e,t){if("3d"===e.type){const r=new z({graphic:t}),i=e.trackGraphicState(r);await u((()=>r.displaying)),i.remove()}else await u((()=>t.visible))}const ie={icon:p(24),text:p(12),line:p(1),viewScaleSizeFactor:100};function ne(e,t,r){let i=!1;return e.filter((e=>!!i||(i=e===t,i))).map((e=>r[e]()))}function ae(e){if(1!==e.length)return null;const t=e[0];if("items"in t){const e=t;return 1===e.items.length?e.items[0]:null}return t}function se(e,t){if(e.viewModel.syncFeatureTemplates(),"awaiting-feature-creation-info"===t[0].id){const r=ae(e.viewModel.featureTemplatesViewModel.items);null==r||r.supportsUpload||(e.creationInfo=r,t.shift())}return t}function le(e){switch(e){case"unknown":case"decimal-degrees":return null;default:return e}}function oe(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}function ce(e){const{creationInfo:t,viewModel:r}=e;if(!t)return!1;const{layer:i}=t,n=r.editableItems.find((e=>e.layer===i));if(n)return n.attachmentsOnCreateEnabled;const a=i.capabilities?.data,s=r.layerInfos?.find((e=>e.layer===i));return!(!(a&&"supportsAttachment"in a&&a.supportsAttachment)||s&&(!1===s.allowAttachments||!1===s.attachmentsOnUpdateEnabled))}const ue=e=>/-stop/.test(e)||/vertex-/.test(e),pe=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function ye(e){return"createInteractiveEditSession"in e}const de=Symbol();function fe(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=a(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function me(e){const t=e.cursor;return e.cursor="progress",n((()=>e.cursor=t))}export{de as UsesSketchViewModelSymbol,se as avoidFeatureTemplateSelectionWithOnlyOneItem,ye as canCreateInteractiveEditSession,fe as cloneGraphicExceptMesh,ne as createWorkflowSteps,B as fetchCandidates,J as fetchFullFeature,Q as findLayerInfo,x as getVisualVariableAttributes,ue as isTerminalUpdateEventType,oe as prepareAttachmentsForCreateWorkflow,D as setUpFeatureAdd,$ as setUpGeometryUpdate,ce as shouldShowAttachmentsForCreateWorkflow,me as showProgressCursor,ie as sizeDefaults,le as sizeVariableUnitToLengthUnit,G as startCreatingNewFeature,K as startUpdatingFeature,ee as swapForEditingSession,R as updateGraphicSymbolWhenRequired,Y as visualVariableInteractiveUpdate,pe as whenEditorLayerView,re as whenGraphicDisplayed};