@arcgis/core 4.27.0-next.20230521 → 4.27.0-next.20230523

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 (268) hide show
  1. package/Graphic.js +1 -1
  2. package/WebMap.js +1 -1
  3. package/arcade/featureset/actions/SpatialFilter.js +1 -1
  4. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  5. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  6. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  7. package/arcade/functions/featuresetbase.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/030b43764f945cb1f8b0.js +1 -0
  10. package/assets/esri/core/workers/chunks/0d02856e55d20b99fc8b.js +1 -0
  11. package/assets/esri/core/workers/chunks/{69242c66492717c7388c.js → 0fcb8d408696075338e2.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{b91c155de9a89e4e6971.js → 187c3b971ed0fc4363ef.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{85c6ce93aa41e6b65997.js → 18db07d739a713cc0465.js} +1 -1
  14. package/assets/esri/core/workers/chunks/1b6177e23327be645c8c.js +1 -0
  15. package/assets/esri/core/workers/chunks/28286014a575042619ee.js +1 -0
  16. package/assets/esri/core/workers/chunks/{692dfeb2e255fdc0ade2.js → 39288fa69561d21f04f8.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{2b9d3e60977934a6d471.js → 3bc6b5f0643364749ef8.js} +1 -1
  18. package/assets/esri/core/workers/chunks/45e5ad704d18dd0857ce.js +1 -0
  19. package/assets/esri/core/workers/chunks/4d24efa01d1accc5a5f0.js +1 -0
  20. package/assets/esri/core/workers/chunks/{6312783626bacf52df7a.js → 55486c644e8b01326a0d.js} +1 -1
  21. package/assets/esri/core/workers/chunks/5576858f56314afcb4d5.js +1 -0
  22. package/assets/esri/core/workers/chunks/{62d9d15f0d00a75da42c.js → 571dac507622948ac03e.js} +1 -1
  23. package/assets/esri/core/workers/chunks/59063d6abf70f6598425.js +1 -0
  24. package/assets/esri/core/workers/chunks/5a4c04bf4f57e74457c5.js +1 -0
  25. package/assets/esri/core/workers/chunks/5bf04c32e0ac89dcbf9f.js +1 -0
  26. package/assets/esri/core/workers/chunks/6a3d611e8842afbb50ab.js +2 -0
  27. package/assets/esri/core/workers/chunks/{55ca6ba8b40921025181.js.LICENSE.txt → 6a3d611e8842afbb50ab.js.LICENSE.txt} +1 -1
  28. package/assets/esri/core/workers/chunks/70d6e5edf05ef7079fa8.js +1 -0
  29. package/assets/esri/core/workers/chunks/71bdf8f10aee0077f681.js +1 -0
  30. package/assets/esri/core/workers/chunks/72b2c3c8e76da699690c.js +1 -0
  31. package/assets/esri/core/workers/chunks/78ce0b1af62435d8ebf4.js +1 -0
  32. package/assets/esri/core/workers/chunks/791f529e90135398b3d5.js +1 -0
  33. package/assets/esri/core/workers/chunks/8d3abfe6fdc5ac8d6cb7.js +1 -0
  34. package/assets/esri/core/workers/chunks/{1edc5c06874cb12c5478.js → 924e4a18d8403d1caea3.js} +1 -1
  35. package/assets/esri/core/workers/chunks/96d339abcd917f1f0ae1.js +1 -0
  36. package/assets/esri/core/workers/chunks/97cdbec7532cfcdf9ad2.js +1 -0
  37. package/assets/esri/core/workers/chunks/{f3f6035a17f7dcd19675.js → 9ab400a89dd701778d2c.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{1488b3d48232844b8bb4.js → 9fe349f43d5ff5a4ac2d.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{22396dd3717d17a5d235.js → a1c31bb8c12831539328.js} +1 -1
  40. package/assets/esri/core/workers/chunks/b0571b9e602218cdc7aa.js +1 -0
  41. package/assets/esri/core/workers/chunks/b1d88f8e528bf7092f35.js +1 -0
  42. package/assets/esri/core/workers/chunks/b4e2dc6b3d06b426e596.js +1 -0
  43. package/assets/esri/core/workers/chunks/{48abcb2d88f22e6e9fde.js → c2cb9fa18c77f0c5104e.js} +1 -1
  44. package/assets/esri/core/workers/chunks/cad7a2092ea7f51dbd8b.js +1 -0
  45. package/assets/esri/core/workers/chunks/d08800a30b1227591986.js +1 -0
  46. package/assets/esri/core/workers/chunks/d725dbbdeb05322e6d88.js +1 -0
  47. package/assets/esri/core/workers/chunks/df3e497d12ed77bae168.js +1 -0
  48. package/assets/esri/core/workers/chunks/fb080339bfaf32731ca6.js +1 -0
  49. package/assets/esri/core/workers/chunks/{56fc7924b4fb30239c19.js → fdf58386a67e54c09bfb.js} +1 -1
  50. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  51. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  52. package/assets/esri/themes/base/_core.scss +2 -0
  53. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +86 -96
  54. package/assets/esri/themes/base/widgets/_FloorFilter.scss +6 -0
  55. package/assets/esri/themes/base/widgets/_UtilityNetworkValidateTopology.scss +40 -0
  56. package/assets/esri/themes/dark/main.css +1 -1
  57. package/assets/esri/themes/light/main.css +1 -1
  58. package/assets/esri/themes/light/view.css +1 -1
  59. package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -1
  60. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -1
  61. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  62. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  63. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  64. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  65. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  66. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  67. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  68. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  69. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  70. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  71. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  72. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  73. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  74. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  75. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  76. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  77. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  78. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  79. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  80. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  81. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  82. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  84. package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
  85. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  86. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  87. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  88. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  89. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  90. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  91. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  92. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  93. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  94. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  95. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  96. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  97. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  98. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  99. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  100. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  101. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  102. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology.json +1 -1
  103. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ar.json +1 -1
  104. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bg.json +1 -1
  105. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bs.json +1 -1
  106. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ca.json +1 -1
  107. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_cs.json +1 -1
  108. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_da.json +1 -1
  109. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_de.json +1 -1
  110. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_el.json +1 -1
  111. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_en.json +1 -1
  112. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_es.json +1 -1
  113. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_et.json +1 -1
  114. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fi.json +1 -1
  115. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fr.json +1 -1
  116. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_he.json +1 -1
  117. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hr.json +1 -1
  118. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hu.json +1 -1
  119. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_id.json +1 -1
  120. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_it.json +1 -1
  121. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ja.json +1 -1
  122. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ko.json +1 -1
  123. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lt.json +1 -1
  124. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lv.json +1 -1
  125. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nb.json +1 -1
  126. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nl.json +1 -1
  127. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pl.json +1 -1
  128. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-BR.json +1 -1
  129. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-PT.json +1 -1
  130. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ro.json +1 -1
  131. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ru.json +1 -1
  132. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sk.json +1 -1
  133. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sl.json +1 -1
  134. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sr.json +1 -1
  135. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sv.json +1 -1
  136. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_th.json +1 -1
  137. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_tr.json +1 -1
  138. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_uk.json +1 -1
  139. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_vi.json +1 -1
  140. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-CN.json +1 -1
  141. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-HK.json +1 -1
  142. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-TW.json +1 -1
  143. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  144. package/chunks/arcgis-knowledge-client-core.js +1 -1
  145. package/chunks/mat4.js +1 -1
  146. package/core/accessorSupport/write.js +1 -1
  147. package/core/fontUtils.js +1 -1
  148. package/core/libs/gl-matrix-2/math/mat4.js +1 -1
  149. package/geometry/Mesh.js +1 -1
  150. package/geometry/support/MeshGeoreferencedRelativeVertexSpace.d.ts +4 -0
  151. package/geometry/support/MeshGeoreferencedRelativeVertexSpace.js +5 -0
  152. package/geometry/support/MeshGeoreferencedVertexSpace.d.ts +4 -0
  153. package/geometry/support/MeshGeoreferencedVertexSpace.js +5 -0
  154. package/geometry/support/MeshLocalVertexSpace.d.ts +4 -0
  155. package/geometry/support/MeshLocalVertexSpace.js +5 -0
  156. package/geometry/support/MeshTransform.d.ts +4 -0
  157. package/geometry/support/MeshTransform.js +1 -1
  158. package/geometry/support/meshUtils/ElevationSamplerWorker.js +1 -1
  159. package/geometry/support/meshUtils/centerAt.js +1 -1
  160. package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
  161. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  162. package/geometry/support/meshUtils/geographicUtils.js +1 -1
  163. package/geometry/support/meshUtils/georeference.js +1 -1
  164. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  165. package/geometry/support/meshUtils/merge.js +1 -1
  166. package/geometry/support/meshUtils/offset.js +1 -1
  167. package/geometry/support/meshUtils/primitives.js +1 -1
  168. package/geometry/support/meshUtils/rotate.js +1 -1
  169. package/geometry/support/meshUtils/scale.js +1 -1
  170. package/interfaces.d.ts +227 -25
  171. package/layers/LinkChartLayer.js +1 -1
  172. package/layers/VoxelWasmPerSceneView.js +1 -1
  173. package/layers/graphics/data/attributeSupport.js +1 -1
  174. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  175. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  176. package/layers/knowledgeGraph/SessionMemoryStorage.js +1 -1
  177. package/layers/support/SubtypeSublayer.js +1 -1
  178. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  179. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  180. package/layers/support/rasterFunctions/CompositeBandFunction.js +1 -1
  181. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  182. package/layers/support/rasterFunctions/ExtractBandFunctionArguments.js +1 -1
  183. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  184. package/networks/support/TopologyValidationJobInfo.js +1 -1
  185. package/package.json +2 -2
  186. package/popup/FieldInfo.js +1 -1
  187. package/portal/Portal.js +1 -1
  188. package/rest/support/FeatureSet.js +1 -1
  189. package/rest/support/meshFeatureSet.js +1 -1
  190. package/smartMapping/symbology/color.js +1 -1
  191. package/smartMapping/symbology/support/colors.js +1 -1
  192. package/support/revision.js +1 -1
  193. package/symbols/cim/cimAnalyzer.js +1 -1
  194. package/symbols/support/utils.js +1 -1
  195. package/views/2d/layers/StreamLayerView2D.js +1 -1
  196. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  197. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  198. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  199. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  200. package/views/3d/interactive/editingTools/meshFastUpdateUtils.js +1 -1
  201. package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
  202. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  203. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
  204. package/views/3d/interactive/editingTools/transformGraphic/undoRecords.js +1 -1
  205. package/views/3d/layers/StreamLayerView3D.js +1 -1
  206. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  207. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  208. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  209. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  210. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  211. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  212. package/views/3d/state/utils/navigationUtils.js +1 -1
  213. package/views/3d/support/DisplayQualityProfile.js +1 -1
  214. package/views/3d/support/QualitySettings.js +1 -1
  215. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  216. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  217. package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
  218. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  219. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  220. package/views/draw/DrawOperation.js +1 -1
  221. package/views/draw/support/helpMessageUtils.js +1 -1
  222. package/views/interactive/dragEventPipeline.js +1 -1
  223. package/views/layers/StreamLayerView.js +1 -1
  224. package/widgets/BasemapGallery/css.js +1 -1
  225. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  226. package/widgets/BasemapGallery.js +1 -1
  227. package/widgets/CoordinateConversion.js +1 -1
  228. package/widgets/Editor/EditorViewModel.js +1 -1
  229. package/widgets/Editor/Edits.js +1 -1
  230. package/widgets/Editor/Upload.js +1 -1
  231. package/widgets/Editor/workflowUtils.js +1 -1
  232. package/widgets/Editor.js +1 -1
  233. package/widgets/Feature/support/featureUtils.js +1 -1
  234. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  235. package/widgets/FeatureTable/FieldColumn.js +1 -1
  236. package/widgets/LayerList.js +1 -1
  237. package/widgets/Locate.js +1 -1
  238. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  239. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +5 -0
  240. package/widgets/UtilityNetworkValidateTopology.js +5 -0
  241. package/widgets/support/widgetUtils.js +1 -1
  242. package/assets/esri/core/workers/chunks/163bf2e13abbdd298374.js +0 -1
  243. package/assets/esri/core/workers/chunks/23f73f81aea461c0c6e6.js +0 -1
  244. package/assets/esri/core/workers/chunks/2640204c4655aa535ccb.js +0 -1
  245. package/assets/esri/core/workers/chunks/2bf42d060f877566b989.js +0 -1
  246. package/assets/esri/core/workers/chunks/34ec9623a1bece86a82b.js +0 -1
  247. package/assets/esri/core/workers/chunks/3bf52139340827794c3b.js +0 -1
  248. package/assets/esri/core/workers/chunks/3cebdd77a8401495097f.js +0 -1
  249. package/assets/esri/core/workers/chunks/48cb634255e39711a720.js +0 -1
  250. package/assets/esri/core/workers/chunks/4d5f71d84c85f45c97ea.js +0 -1
  251. package/assets/esri/core/workers/chunks/52d02021e858820bc4fa.js +0 -1
  252. package/assets/esri/core/workers/chunks/55ca6ba8b40921025181.js +0 -2
  253. package/assets/esri/core/workers/chunks/64b8f65e2ef6cbf08380.js +0 -1
  254. package/assets/esri/core/workers/chunks/662e479c370c11bcb8a7.js +0 -1
  255. package/assets/esri/core/workers/chunks/78aede1e114deefacb54.js +0 -1
  256. package/assets/esri/core/workers/chunks/7ef100158ca28631fcaf.js +0 -1
  257. package/assets/esri/core/workers/chunks/93ad67930aa7d4a4b0ac.js +0 -1
  258. package/assets/esri/core/workers/chunks/964795dfb57f0d0635d0.js +0 -1
  259. package/assets/esri/core/workers/chunks/99ce0a202dcd3d7dc290.js +0 -1
  260. package/assets/esri/core/workers/chunks/abe6c99a1a719543dbe8.js +0 -1
  261. package/assets/esri/core/workers/chunks/c3bf44146fddfe8990f7.js +0 -1
  262. package/assets/esri/core/workers/chunks/cbe817e966b57599bafd.js +0 -1
  263. package/assets/esri/core/workers/chunks/e15b5d7e46a834eacc57.js +0 -1
  264. package/assets/esri/core/workers/chunks/e1e0b3580e2c3098c9f4.js +0 -1
  265. package/assets/esri/core/workers/chunks/e305d20e4424451cab5b.js +0 -1
  266. package/assets/esri/core/workers/chunks/e6836c84470fb6bd25bf.js +0 -1
  267. package/assets/esri/core/workers/chunks/f924732902703233655e.js +0 -1
  268. package/assets/esri/core/workers/chunks/ff1c005eede0cf964332.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.27/esri/copyright.txt for details.
4
4
  */
5
- import o from"../../../../Color.js";import{loadFont as t}from"../../../../core/fontUtils.js";import r from"../../../../core/Logger.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{Z as i}from"../../../../chunks/vec4f64.js";class n{constructor(o){this.definition=o,this.key=JSON.stringify(o),this.haloSize=Math.round(o.halo.size),this.textStyle=this._colorToRGBA(o.color),this.haloStyle=this._colorToRGB(o.halo.color),this.backgroundStyle=0!==o.background.color[3]?this._colorToRGBA(o.background.color):null}fontString(o){const t=this.definition.font;return`${t.style} ${t.weight} ${o}px ${t.family}, sans-serif`}_colorToRGB(o){return`rgb(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()})`}_colorToRGBA(o){return`rgba(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()},${o[3]})`}static async fromSymbol(l,a){const c=l?.material?.color,f=o.toUnitRGBA(c)??i,u=null!=l.size?e(l.size):12,g=l.lineHeight,m=null!=l.background?o.toUnitRGBA(l.background.color):i,h={family:l.font?.family??"sans-serif",decoration:l.font?.decoration??"none",weight:l.font?.weight??"normal",style:l.font?.style??"normal"},d=l.halo,y=null!=d&&null!=d.color&&d.size>0?{size:e(d.size),color:o.toUnitRGBA(d.color)}:{size:0,color:i},b=new n({color:f,size:u,background:{color:m,padding:null!=l.background?[.65*u,.5*u]:[0,0],borderRadius:null!=l.background?u*(6/16):0},lineSpacingFactor:g,font:h,halo:y,pixelRatio:a});if(l.font){let o=!1;const e=b.fontString(u);try{o=(await document.fonts.load(e)).length>0}catch(p){r.getLogger("esri.views.3d.webgl-engine.lib.TextRenderParameters").warnOnce(`Failed to preload font '${e}'. Some text symbology may be rendered using the default browser font.`)}if(!o&&!s.has(l.font.family))try{await t(l.font),o=!0}catch(p){}}return b}}const s=new Set(["Arial","Times New Roman","Courier New","serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]);export{n as TextRenderParameters};
5
+ import o from"../../../../Color.js";import{isCachedFontFace as t,loadFont as r}from"../../../../core/fontUtils.js";import e from"../../../../core/Logger.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{Z as n}from"../../../../chunks/vec4f64.js";class s{constructor(o){this.definition=o,this.key=JSON.stringify(o),this.haloSize=Math.round(o.halo.size),this.textStyle=this._colorToRGBA(o.color),this.haloStyle=this._colorToRGB(o.halo.color),this.backgroundStyle=0!==o.background.color[3]?this._colorToRGBA(o.background.color):null}fontString(o){const t=this.definition.font;return`${t.style} ${t.weight} ${o}px ${t.family}, sans-serif`}_colorToRGB(o){return`rgb(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()})`}_colorToRGBA(o){return`rgba(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()},${o[3]})`}static async fromSymbol(a,c){const f=a?.material?.color,m=o.toUnitRGBA(f)??n,u=null!=a.size?i(a.size):12,g=a.lineHeight,h=null!=a.background?o.toUnitRGBA(a.background.color):n,d={family:a.font?.family??"sans-serif",decoration:a.font?.decoration??"none",weight:a.font?.weight??"normal",style:a.font?.style??"normal"},y=a.halo,b=null!=y&&null!=y.color&&y.size>0?{size:i(y.size),color:o.toUnitRGBA(y.color)}:{size:0,color:n},p=new s({color:m,size:u,background:{color:h,padding:null!=a.background?[.65*u,.5*u]:[0,0],borderRadius:null!=a.background?u*(6/16):0},lineSpacingFactor:g,font:d,halo:b,pixelRatio:c});if(a.font){let o=!1;const i=p.fontString(u);try{o=(await document.fonts.load(i)).some((o=>!t(o)))}catch(w){e.getLogger("esri.views.3d.webgl-engine.lib.TextRenderParameters").warnOnce(`Failed to preload font '${i}'. Some text symbology may be rendered using the default browser font.`)}if(!o&&!l.has(a.font.family))try{await r(a.font)}catch(w){}}return p}}const l=new Set(["Arial","Times New Roman","Courier New","serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]);export{s as TextRenderParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{HandleOwner as i}from"../../core/HandleOwner.js";import{clone as n}from"../../core/lang.js";import{destroyMaybe as r,applySome as o,equalsMaybe as s}from"../../core/maybe.js";import{ignoreAbortErrors as a}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as l}from"../../core/reactiveUtils.js";import{createScreenPoint as c}from"../../core/screenUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{diff as g}from"../../core/accessorSupport/diffUtils.js";import{pointEquals as m}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as u}from"../../support/elevationInfoUtils.js";import{ViewingMode as v}from"../ViewingMode.js";import{defaultDrawingMode as y}from"./DrawingMode.js";import{DrawManipulator as _}from"./DrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as V,Component as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as O}from"../interactive/editGeometry/EditGeometryOperations.js";import T from"../interactive/sketch/SketchLabelOptions.js";import b from"../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as P}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as D}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as C}from"../interactive/snapping/snappingUtils.js";let I=class extends(t.EventedMixin(i)){constructor(e){super(e),this._createOperationCompleted=!1,this._pointerDownStates=new Set,this._stagedScreenPoint=null,this._stagedPointerType=null,this.isDraped=!0,this.labelOptions=new T,this.tooltipOptions=new b,this.snapToSceneEnabled=null,this.lastVertex=null,null==e.elevationInfo&&(this.elevationInfo=u(!!e.hasZ))}initialize(){const{geometryType:e,view:t}=this,i=t.spatialReference,n="viewingMode"in t.state?t.state.viewingMode:v.Local,r="segment"===e||"multipoint"===e?"polyline":e;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new O(new V(r,this.coordinateHelper)),this._snappingOperation=new D({view:t,constrainResult:e=>null==e?e:this._getEffectiveDrawSurface()?.constrainZ(e)}),this.handles.add(p((()=>this.stagedVertex),(e=>{null!=e&&this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(e)}],operation:"apply",type:"vertex-update"})}),{sync:!0,equals:(e,t)=>s(e,t,m)}),p((()=>this.view.viewpoint),((e,t)=>{e&&t&&g(e,t)&&this._onViewpointChange()}))),this._activeComponent=new w(i,n),this._editGeometryOperations.data.components.push(this._activeComponent);const o=this.segmentLabels;null!=o&&(o.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.handles.add([p((()=>this.labelOptions.enabled),(e=>{o.visible=e}),l),this.on("cursor-update",(()=>{const e=this.stagedVertex;o.stagedVertex=null!=e?this.coordinateHelper.pointToVector(e):null}))])),this.handles.add(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],(e=>{const t=e.vertices.map((e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)}))),i=t.map((e=>e.coordinates));switch(e.type){case"vertex-add":this.emit(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this.emit(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this.emit(e.type,{...e,removed:i,vertices:t})}const n=this._activeComponent.getLastVertex(),r=null!=n?this.coordinateHelper.vectorToDehydratedPoint(n.pos):null;null!=r&&null!=this.lastVertex&&m(this.lastVertex,r)||(this.lastVertex=r)}))),this._manipulator=new _({grabbableForEvent:e=>"click"!==this.drawingMode||"touch"===e.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size}),this.manipulators.add(this._manipulator),this._manipulator.grabbable="point"!==e,this.handles.add([this._createManipulatorDragPipeline(this._manipulator),this._manipulator.events.on("immediate-click",(e=>this._onImmediateClick(e))),this._manipulator.events.on("immediate-double-click",(e=>this._onImmediateDoubleClick(e)))]),C(this,(()=>{const e=this.view.inputManager.latestPointerType??"mouse",t=this._getSnappingContext(e);null!=this.snappingManager&&this.updatingHandles.addPromise(a(this._snappingOperation.resnap(this.snappingManager,t)))}))}destroy(){r(this.segmentLabels),r(this._snappingOperation),this._editGeometryOperations=r(this._editGeometryOperations)}get _snappingEnabled(){return null!=this.snappingManager&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const e=this._getEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map((e=>this.coordinateHelper.vectorToArray(e.pos)))}set drawingMode(e){this._set("drawingMode",e??y)}set cursor(e){const t=this._manipulator;t&&(t.cursor=e),this._set("cursor",e)}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return null!=this.stagedVertex?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get snappingOptions(){return null!=this.snappingManager?this.snappingManager.options:null}get stagedVertex(){return this._snappingOperation.stagedPoint}set stagedVertex(e){this._snappingOperation.stagedPoint=n(e)}get updating(){return this.updatingHandles.updating}get vertices(){const e=this.committedVertices;return null!=this.stagedVertex&&e.push(this.coordinateHelper.pointToArray(this.stagedVertex)),e}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingOperation.abort(),null!=this.stagedVertex){const{stagedVertex:e}=this;this.stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e))}}complete(e){const t=e&&e.aborted||!1;this._snappingOperation.abort(),null!=this.snappingManager&&this.snappingManager.doneSnapping(),"segment"===this.geometryType||"point"===this.geometryType?this.commitStagedVertex():this.stagedVertex=null;const i="multipoint"===this.geometryType&&0===this.numVertices||"polyline"===this.geometryType&&this.numVertices<2||"polygon"===this.geometryType&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||t)&&this.emit("complete",{vertices:this.vertices.map(((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e}))),aborted:t,type:"complete"})}onInputEvent(e){switch(e.type){case"pointer-down":this._pointerDownStates.add(e.pointerId);break;case"pointer-up":this._pointerDownStates.delete(e.pointerId)}switch(e.type){case"pointer-move":return this._onPointerMove(e);case"hold":return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(e){const t=this._activeComponent;if("polygon"===this.geometryType&&t.vertices.length>2){if(this._vertexWithinPointerDistance(t.vertices[0].pos,e))return 0;if(this._vertexWithinPointerDistance(t.vertices[t.vertices.length-1].pos,e))return t.vertices.length-1}return null}_createManipulatorDragPipeline(e){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(e);case"freehand":return this._createManipulatorDragPipelineFreehand(e);case"hybrid":return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return f(e,((e,t,i,n)=>{const r="touch"===n&&this._snappingEnabled;if(this.isCompleted||!r)return;const{snappingStep:o,cancelSnapping:s}=P({predicate:()=>r,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:n,visualizer:this.snappingVisualizer}),updatingHandles:this.updatingHandles,useZ:!this._requiresScenePoint});i=i.next((e=>(r&&null!=this.snappingManager&&this.snappingManager.doneSnapping(),e))).next(s),t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(this.stagedVertex=e.mapStart,("segment"===this.geometryType||r&&0===this.numVertices)&&this.commitStagedVertex()),e))).next(S(this.view,this.elevationInfo)).next(...o).next((e=>(r&&(this.stagedVertex=e.mapEnd,"end"===e.action&&this.commitStagedVertex()),e))).next((e=>("end"===e.action&&("segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),e)))}))}_createManipulatorDragPipelineFreehand(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(null==this.stagedVertex&&(this.stagedVertex=e.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return e}))}))}_createManipulatorDragPipelineHybrid(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(null==this.stagedVertex&&(this.stagedVertex=e.mapStart),this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return e}))}))}get _drawAtFixedElevation(){return("segment"===this.geometryType||"polygon"===this.geometryType)&&this.numCommittedVertices>0}_getEffectiveDrawSurface(){if(null==this.elevationDrawSurface)return this.drawSurface;if(!this.coordinateHelper.hasZ())return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let e=this.defaultZ,t=!1;return null!=this.elevationInfo&&"absolute-height"===this.elevationInfo.mode&&(t=!0),null!=this.snapToSceneEnabled&&(t=this.snapToSceneEnabled),null!=this.elevationInfo&&"on-the-ground"===this.elevationInfo.mode&&(t=!1),this._drawAtFixedElevation&&(e=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),t=!1),t?this.drawSurface:(this.elevationDrawSurface.defaultZ=e,this.elevationDrawSurface)}_mapToScreen(e){return this._getEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===e.pointerType&&this._snappingEnabled&&(this.stagedVertex=e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if("mouse"===e.pointerType&&2===e.button||this._manipulator.dragging)return;const t=this._activeComponent;if(null!=this._closeOnClickVertexIndex(e.screenPoint))return e.stopPropagation(),void this.complete();const i=this._screenToMap(e.screenPoint);if(null!=i)switch(this.drawingMode){case"freehand":"point"===this.geometryType&&(null!=this.stagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),this.complete());break;case"click":case"hybrid":this._snappingOperation.abort(),null!=this.stagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),("point"===this.geometryType||"segment"===this.geometryType&&2===t.vertices.length||"segment"===this.geometryType&&"hybrid"===this.drawingMode&&1===t.vertices.length)&&this.complete()}e.stopPropagation()}_onImmediateDoubleClick(e){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),e.stopPropagation())}_onPointerMove(e){const t=c(e.x,e.y);this._stagedScreenPoint=t,this._stagedPointerType=e.pointerType;const i=this._snappingOperation;this._manipulator.dragging||this._pointerDownStates.has(e.pointerId)||this._manipulator.grabbing||!this._manipulator.interactive?i.abort():(e.stopPropagation(),this._updateStagedVertexOnPointerMove(t,e.pointerType))}_onViewpointChange(){this._stagedScreenPoint&&!this._manipulator.dragging&&!this._manipulator.grabbing&&this._manipulator.interactive?this._updateStagedVertexOnPointerMove(this._stagedScreenPoint,this._stagedPointerType??"mouse"):this._snappingOperation.abort()}_updateStagedVertexOnPointerMove(e,t){const i=this._snappingOperation,n=this._closeOnClickVertexIndex(e);if(null!=n)return this._closeOnVertex(n),void i.abort();const r=this._screenToMap(e),o=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(this.cursor??=null!=r?"crosshair":null,null==r)return void i.abort();const s=this.snappingManager;if(null==s)return this.stagedVertex=r,void i.abort();const p=this._getSnappingContext(t);this.updatingHandles.addPromise(a(i.snap({point:r,scenePoint:o},s,p)))}_closeOnVertex(e){this.stagedVertex=null;const t={componentIndex:0,vertexIndex:e,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[e].pos)};this.emit("cursor-update",{updated:null,vertices:[t],operation:"apply",type:"vertex-update"})}_screenToMap(e){return this._getEffectiveDrawSurface()?.screenToMap(e)}_screenToMapDragEventStep(){let e=null;return t=>{if("start"===t.action&&(e=this._screenToMap(t.screenStart)),null==e)return null;const i=this._screenToMap(t.screenEnd);return null!=i?{...t,mapStart:e,mapEnd:i}:null}}_vertexWithinPointerDistance(e,t){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return null!=n&&E(n,t,i)}_getSnappingContext(e){const t=this._drawAtFixedElevation?o(this.elevationDrawSurface,(({defaultZ:e})=>e)):null;return new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,visualizer:this.snappingVisualizer,selfSnappingZ:null!=t?{value:t,elevationInfo:this.elevationInfo}:null})}};function E(e,t,i){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=i}e([h()],I.prototype,"_snappingEnabled",null),e([h()],I.prototype,"defaultZ",void 0),e([h()],I.prototype,"isDraped",void 0),e([h({value:y})],I.prototype,"drawingMode",null),e([h({constructOnly:!0})],I.prototype,"elevationDrawSurface",void 0),e([h({constructOnly:!0})],I.prototype,"elevationInfo",void 0),e([h({constructOnly:!0,type:T})],I.prototype,"labelOptions",void 0),e([h({constructOnly:!0,type:b})],I.prototype,"tooltipOptions",void 0),e([h({constructOnly:!0})],I.prototype,"geometryType",void 0),e([h({constructOnly:!0})],I.prototype,"hasM",void 0),e([h({constructOnly:!0})],I.prototype,"hasZ",void 0),e([h()],I.prototype,"cursor",null),e([h({constructOnly:!0})],I.prototype,"manipulators",void 0),e([h({constructOnly:!0})],I.prototype,"drawSurface",void 0),e([h({constructOnly:!0})],I.prototype,"segmentLabels",void 0),e([h({constructOnly:!0})],I.prototype,"snappingManager",void 0),e([h({constructOnly:!0})],I.prototype,"snappingVisualizer",void 0),e([h()],I.prototype,"snapToSceneEnabled",void 0),e([h()],I.prototype,"_snappingOperation",void 0),e([h()],I.prototype,"stagedVertex",null),e([h()],I.prototype,"lastVertex",void 0),e([h()],I.prototype,"updating",null),e([h({constructOnly:!0})],I.prototype,"view",void 0),I=e([d("esri.views.draw.DrawOperation")],I);export{I as DrawOperation};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{HandleOwner as i}from"../../core/HandleOwner.js";import{clone as n}from"../../core/lang.js";import{destroyMaybe as r,applySome as o,equalsMaybe as s}from"../../core/maybe.js";import{ignoreAbortErrors as a}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as c}from"../../core/reactiveUtils.js";import{createScreenPoint as l}from"../../core/screenUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{diff as g}from"../../core/accessorSupport/diffUtils.js";import{pointEquals as u}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as m}from"../../support/elevationInfoUtils.js";import{ViewingMode as v}from"../ViewingMode.js";import{defaultDrawingMode as y}from"./DrawingMode.js";import{DrawManipulator as _}from"./DrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as V,Component as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as O}from"../interactive/editGeometry/EditGeometryOperations.js";import T from"../interactive/sketch/SketchLabelOptions.js";import b from"../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as P}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as D}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as C}from"../interactive/snapping/snappingUtils.js";let I=class extends(t.EventedMixin(i)){constructor(e){super(e),this._createOperationCompleted=!1,this._pointerDownStates=new Set,this._stagedScreenPoint=null,this._stagedPointerType=null,this.isDraped=!0,this.labelOptions=new T,this.tooltipOptions=new b,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.lastVertex=null,null==e.elevationInfo&&(this.elevationInfo=m(!!e.hasZ))}initialize(){const{geometryType:e,view:t}=this,i=t.spatialReference,n="viewingMode"in t.state?t.state.viewingMode:v.Local,r="segment"===e||"multipoint"===e?"polyline":e;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new O(new V(r,this.coordinateHelper)),this._snappingOperation=new D({view:t,constrainResult:e=>null==e?e:this._getEffectiveDrawSurface()?.constrainZ(e)}),this.addHandles([p((()=>this.stagedVertex),(e=>{null!=e&&this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(e)}],operation:"apply",type:"vertex-update"})}),{sync:!0,equals:(e,t)=>s(e,t,u)}),p((()=>this.view.viewpoint),((e,t)=>{e&&t&&g(e,t)&&this._onViewpointChange()}))]),this._activeComponent=new w(i,n),this._editGeometryOperations.data.components.push(this._activeComponent);const o=this.segmentLabels;null!=o&&(o.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles([p((()=>this.labelOptions.enabled),(e=>{o.visible=e}),c),this.on("cursor-update",(()=>{const e=this.stagedVertex;o.stagedVertex=null!=e?this.coordinateHelper.pointToVector(e):null}))])),this.addHandles(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],(e=>{const t=e.vertices.map((e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)}))),i=t.map((e=>e.coordinates));switch(e.type){case"vertex-add":this.emit(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this.emit(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this.emit(e.type,{...e,removed:i,vertices:t})}const n=this._activeComponent.getLastVertex(),r=null!=n?this.coordinateHelper.vectorToDehydratedPoint(n.pos):null;null!=r&&null!=this.lastVertex&&u(this.lastVertex,r)||(this.lastVertex=r)})));const l=this._manipulator=new _({grabbableForEvent:e=>"click"!==this.drawingMode||"touch"===e.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size});this.manipulators.add(l),l.grabbable="point"!==e,this.addHandles([this._createManipulatorDragPipeline(l),l.events.on("immediate-click",(e=>this._onImmediateClick(e))),l.events.on("immediate-double-click",(e=>this._onImmediateDoubleClick(e))),p((()=>({cursor:this.cursor,loading:this.loading})),(({cursor:e,loading:t})=>{l.cursor=t?"progress":e}),c)]),C(this,(()=>{const e=this.view.inputManager.latestPointerType??"mouse",t=this._getSnappingContext(e);null!=this.snappingManager&&this.updatingHandles.addPromise(a(this._snappingOperation.resnap(this.snappingManager,t)))}))}destroy(){r(this.segmentLabels),r(this._snappingOperation),this._editGeometryOperations=r(this._editGeometryOperations)}get _snappingEnabled(){return null!=this.snappingManager&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const e=this._getEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map((e=>this.coordinateHelper.vectorToArray(e.pos)))}set drawingMode(e){this._set("drawingMode",e??y)}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return null!=this.stagedVertex?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get snappingOptions(){return null!=this.snappingManager?this.snappingManager.options:null}get stagedVertex(){return this._snappingOperation.stagedPoint}set stagedVertex(e){this._snappingOperation.stagedPoint=n(e)}get updating(){return this.updatingHandles.updating}get vertices(){const e=this.committedVertices;return null!=this.stagedVertex&&e.push(this.coordinateHelper.pointToArray(this.stagedVertex)),e}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingOperation.abort(),null!=this.stagedVertex){const{stagedVertex:e}=this;this.stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e))}}complete(e){const t=e&&e.aborted||!1;this._snappingOperation.abort(),null!=this.snappingManager&&this.snappingManager.doneSnapping(),"segment"===this.geometryType||"point"===this.geometryType?this.commitStagedVertex():this.stagedVertex=null;const i="multipoint"===this.geometryType&&0===this.numVertices||"polyline"===this.geometryType&&this.numVertices<2||"polygon"===this.geometryType&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||t)&&this.emit("complete",{vertices:this.vertices.map(((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e}))),aborted:t,type:"complete"})}onInputEvent(e){switch(e.type){case"pointer-down":this._pointerDownStates.add(e.pointerId);break;case"pointer-up":this._pointerDownStates.delete(e.pointerId)}switch(e.type){case"pointer-move":return this._onPointerMove(e);case"hold":return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(e){const t=this._activeComponent;if("polygon"===this.geometryType&&t.vertices.length>2){if(this._vertexWithinPointerDistance(t.vertices[0].pos,e))return 0;if(this._vertexWithinPointerDistance(t.vertices[t.vertices.length-1].pos,e))return t.vertices.length-1}return null}_createManipulatorDragPipeline(e){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(e);case"freehand":return this._createManipulatorDragPipelineFreehand(e);case"hybrid":return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return f(e,((e,t,i,n)=>{const r="touch"===n&&this._snappingEnabled;if(this.isCompleted||!r)return;const{snappingStep:o,cancelSnapping:s}=P({predicate:()=>r,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:n,visualizer:this.snappingVisualizer}),updatingHandles:this.updatingHandles,useZ:!this._requiresScenePoint});i=i.next((e=>(r&&null!=this.snappingManager&&this.snappingManager.doneSnapping(),e))).next(s),t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(this.stagedVertex=e.mapStart,("segment"===this.geometryType||r&&0===this.numVertices)&&this.commitStagedVertex()),e))).next(S(this.view,this.elevationInfo)).next(...o).next((e=>(r&&(this.stagedVertex=e.mapEnd,"end"===e.action&&this.commitStagedVertex()),e))).next((e=>("end"===e.action&&("segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),e)))}))}_createManipulatorDragPipelineFreehand(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(null==this.stagedVertex&&(this.stagedVertex=e.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return e}))}))}_createManipulatorDragPipelineHybrid(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(null==this.stagedVertex&&(this.stagedVertex=e.mapStart),this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return e}))}))}get _drawAtFixedElevation(){return("segment"===this.geometryType||"polygon"===this.geometryType)&&this.numCommittedVertices>0}_getEffectiveDrawSurface(){if(null==this.elevationDrawSurface)return this.drawSurface;if(!this.coordinateHelper.hasZ())return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let e=this.defaultZ,t=!1;return null!=this.elevationInfo&&"absolute-height"===this.elevationInfo.mode&&(t=!0),null!=this.snapToSceneEnabled&&(t=this.snapToSceneEnabled),null!=this.elevationInfo&&"on-the-ground"===this.elevationInfo.mode&&(t=!1),this._drawAtFixedElevation&&(e=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),t=!1),t?this.drawSurface:(this.elevationDrawSurface.defaultZ=e,this.elevationDrawSurface)}_mapToScreen(e){return this._getEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===e.pointerType&&this._snappingEnabled&&(this.stagedVertex=e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if("mouse"===e.pointerType&&2===e.button||this._manipulator.dragging)return;const t=this._activeComponent;if(null!=this._closeOnClickVertexIndex(e.screenPoint))return e.stopPropagation(),void this.complete();const i=this._screenToMap(e.screenPoint);if(null!=i)switch(this.drawingMode){case"freehand":"point"===this.geometryType&&(null!=this.stagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),this.complete());break;case"click":case"hybrid":this._snappingOperation.abort(),null!=this.stagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),("point"===this.geometryType||"segment"===this.geometryType&&2===t.vertices.length||"segment"===this.geometryType&&"hybrid"===this.drawingMode&&1===t.vertices.length)&&this.complete()}e.stopPropagation()}_onImmediateDoubleClick(e){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),e.stopPropagation())}_onPointerMove(e){const t=l(e.x,e.y);this._stagedScreenPoint=t,this._stagedPointerType=e.pointerType;const i=this._snappingOperation,n=this._manipulator;n.dragging||this._pointerDownStates.has(e.pointerId)||n.grabbing||!n.interactive?i.abort():(e.stopPropagation(),this._updateStagedVertexOnPointerMove(t,e.pointerType))}_onViewpointChange(){const e=this._manipulator;this._stagedScreenPoint&&!e.dragging&&!e.grabbing&&e.interactive?this._updateStagedVertexOnPointerMove(this._stagedScreenPoint,this._stagedPointerType??"mouse"):this._snappingOperation.abort()}_updateStagedVertexOnPointerMove(e,t){const i=this._snappingOperation,n=this._closeOnClickVertexIndex(e);if(null!=n)return this._closeOnVertex(n),void i.abort();const r=this._screenToMap(e),o=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(null==r)return this.cursor=null,void i.abort();this.cursor="crosshair";const s=this.snappingManager;if(null==s)return this.stagedVertex=r,void i.abort();const p=this._getSnappingContext(t);this.updatingHandles.addPromise(a(i.snap({point:r,scenePoint:o},s,p)))}_closeOnVertex(e){this.stagedVertex=null;const t={componentIndex:0,vertexIndex:e,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[e].pos)};this.emit("cursor-update",{updated:null,vertices:[t],operation:"apply",type:"vertex-update"})}_screenToMap(e){return this._getEffectiveDrawSurface()?.screenToMap(e)}_screenToMapDragEventStep(){let e=null;return t=>{if("start"===t.action&&(e=this._screenToMap(t.screenStart)),null==e)return null;const i=this._screenToMap(t.screenEnd);return null!=i?{...t,mapStart:e,mapEnd:i}:null}}_vertexWithinPointerDistance(e,t){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return null!=n&&E(n,t,i)}_getSnappingContext(e){const t=this._drawAtFixedElevation?o(this.elevationDrawSurface,(({defaultZ:e})=>e)):null;return new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,visualizer:this.snappingVisualizer,selfSnappingZ:null!=t?{value:t,elevationInfo:this.elevationInfo}:null})}};function E(e,t,i){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=i}e([d()],I.prototype,"_snappingEnabled",null),e([d()],I.prototype,"defaultZ",void 0),e([d()],I.prototype,"isDraped",void 0),e([d({value:y})],I.prototype,"drawingMode",null),e([d({constructOnly:!0})],I.prototype,"elevationDrawSurface",void 0),e([d({constructOnly:!0})],I.prototype,"elevationInfo",void 0),e([d({constructOnly:!0,type:T})],I.prototype,"labelOptions",void 0),e([d({constructOnly:!0,type:b})],I.prototype,"tooltipOptions",void 0),e([d({constructOnly:!0})],I.prototype,"geometryType",void 0),e([d({constructOnly:!0})],I.prototype,"hasM",void 0),e([d({constructOnly:!0})],I.prototype,"hasZ",void 0),e([d()],I.prototype,"cursor",void 0),e([d()],I.prototype,"loading",void 0),e([d({constructOnly:!0})],I.prototype,"manipulators",void 0),e([d({constructOnly:!0})],I.prototype,"drawSurface",void 0),e([d({constructOnly:!0})],I.prototype,"segmentLabels",void 0),e([d({constructOnly:!0})],I.prototype,"snappingManager",void 0),e([d({constructOnly:!0})],I.prototype,"snappingVisualizer",void 0),e([d()],I.prototype,"snapToSceneEnabled",void 0),e([d()],I.prototype,"_snappingOperation",void 0),e([d()],I.prototype,"stagedVertex",null),e([d()],I.prototype,"lastVertex",void 0),e([d()],I.prototype,"updating",null),e([d({constructOnly:!0})],I.prototype,"view",void 0),I=e([h("esri.views.draw.DrawOperation")],I);export{I as DrawOperation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{getMetersPerVerticalUnitForSR as e}from"../../../arcade/functions/centroid.js";import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import{s as n}from"../../../chunks/vec3.js";import{c as o}from"../../../chunks/vec3f64.js";function r(e,t,n){switch(e){case"point":case"multipoint":return"point";case"polyline":return(null!=t&&"polyline"===t.type&&t.paths.length?t.paths[0].length:0)<2?"polylineZeroVertices":"polylineOneVertex";case"polygon":{const e=null!=t&&"polygon"===t.type&&t.rings.length?t.rings[0].length:0;return e<3?"polylineZeroVertices":e<4?"polygonOneVertex":"polygonTwoVertices"}case"mesh":return s(t,n);default:return}}function s(o,r){if("mesh"!==o?.type||"3d"!==r?.type)return;const{renderCoordsHelper:s}=r,{camera:p}=r.state,{width:a,height:h,zmin:m,zmax:u,center:y,spatialReference:f}=o.extent,d=(u??0)-(m??0),g=t(f),x=e(f),V=t(s.spatialReference),j=Math.max(a*g,h*g,d*x)/V;n(l,y.x,y.y,y.z??0),s.toRenderCoords(l,f,l);const w=j/p.computeScreenPixelSizeAt(l);return w>p.width*c?"meshTooClose":w<i?"meshTooFar":void 0}const i=20,c=1,l=o();export{r as getDrawHelpMessage};
5
+ import{getMetersPerVerticalUnitForSR as e}from"../../../arcade/functions/centroid.js";import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import{s as n}from"../../../chunks/vec3.js";import{c as o}from"../../../chunks/vec3f64.js";function r(e,t,n){switch(e){case"point":case"multipoint":return"point";case"polyline":return(null!=t&&"polyline"===t.type&&t.paths.length?t.paths[0].length:0)<2?"polylineZeroVertices":"polylineOneVertex";case"polygon":{const e=null!=t&&"polygon"===t.type&&t.rings.length?t.rings[0].length:0;return e<3?"polylineZeroVertices":e<4?"polygonOneVertex":"polygonTwoVertices"}case"mesh":return s(t,n);default:return}}function s(o,r){if("mesh"!==o?.type||"3d"!==r?.type)return;const{renderCoordsHelper:s}=r,{camera:p}=r.state,{width:a,height:h,zmin:m,zmax:u,center:y,spatialReference:f}=o.extent,g=(u??0)-(m??0),d=t(f),x=e(f),V=t(s.spatialReference),j=Math.max(a*d,h*d,g*x)/V;n(l,y.x,y.y,y.z??0),s.toRenderCoords(l,f,l);const w=j/p.computeScreenPixelSizeAt(l);return w>p.width*c?"meshTooClose":w<i?"meshTooFar":"mesh"}const i=20,c=1,l=o();export{r as getDrawHelpMessage};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import"../../geometry.js";import{isSome as n}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as t}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{f as a}from"../../chunks/vec3f64.js";import{project as o}from"../../geometry/projection.js";import{hydratedSpatialReference as l,clonePoint as s}from"../../layers/graphics/hydratedFeatures.js";import{MeshTransformUpdateAction as c}from"../../layers/graphics/sources/interfaces.js";import{getZForElevationMode as i}from"../../support/elevationInfoUtils.js";import{ViewingMode as u}from"../ViewingMode.js";import{move as m}from"../draw/support/drawUtils.js";import p from"../../geometry/Point.js";function f(n,t){let e=null,r=null;return a=>{if("cancel"===a.action)return void(null!=r&&(r.execute({action:"cancel"}),e=null,r=null));const o={action:a.action,screenStart:a.start,screenEnd:a.screenPoint};"start"===a.action&&null==e&&(e=new C,r=new C,t(n,e,r,a.pointerType,o)),null!=e&&e.execute(o),"end"===a.action&&null!=e&&(e=null,r=null)}}function d(n,t){return n.events.on("drag",f(n,t))}function y(n,t){const e=[n.x,n.y,n.z??0],r=t,a=[Math.cos(r),Math.sin(r)],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]);if(0===o)return null;a[0]/=o,a[1]/=o;const l=n=>{const t=(n.x-e[0])*a[0]+(n.y-e[1])*a[1];n.x=e[0]+t*a[0],n.y=e[1]+t*a[1]};return n=>(l(n.mapStart),l(n.mapEnd),{...n,axis:a})}function g(n,t){let e=null;return r=>{if("start"===r.action&&(e=h(n,r.mapStart.spatialReference,t)),null==e)return null;const a=r.mapEnd.x-r.mapStart.x,o=r.mapEnd.y-r.mapStart.y,l=r.mapEnd.z-r.mapStart.z;return e.move(a,o,l,r.action),{...r,translationX:a,translationY:o,translationZ:l}}}function x(n,t){return null==n?null:n.spatialReference.equals(t)?n.clone():o(n,t)}function h(n,t,e){const r=n.geometry,a=l(t);if(null==r)return null;if("mesh"===r.type)return E(n,r,a,e);const s=x(r,a),c=r.spatialReference;return null==s?null:{move:(t,e,r)=>{const a=m(s.clone(),t,e,r);a.spatialReference.equals(c)?n.geometry=a:n.geometry=o(a,c)}}}function E(n,t,e,r){if(null!=t.transform)return S(n,t,t.transform,e);if(!t.spatialReference.equals(e))return null;let a=0,o=0,l=0;return{move:(e,s,c)=>{const i=e-a,m=s-o,f=c-l;if(i||m||f){const d=new p(t.origin.x+i,t.origin.y+m,t.origin.z+f,t.origin.spatialReference);t.centerAt(d,{geographic:r===u.Global}),n.notifyGeometryChanged(),a=e,o=s,l=c}}}}function S(n,t,e,r){const l=x(e.getOriginPoint(t.spatialReference),r),s=t.spatialReference;return null==l?null:{move:(t,r,i,u)=>{const p=m(l.clone(),t,r,i);if(p.spatialReference.equals(s))e.origin=a(p.x,p.y,p.z);else{const n=o(p,s);null!=n&&(e.origin=a(n.x,n.y,n.z))}if(e.geographic){const t="end"===u;n.notifyMeshTransformChanged(t?{action:c.UpdateFastLocalOrigin}:{})}else n.notifyGeometryChanged()}}}function z(n,t=null,e){let r=null;const a=null==t||n.spatialReference?.equals(t)?n=>n:n=>null!=n?o(n,t):n,l={exclude:[],...e};return t=>{if("start"===t.action&&(r=a(n.toMap(t.screenStart,l))),null==r)return null;const e=a(n.toMap(t.screenEnd,l));return null!=e?{...t,mapStart:r,mapEnd:e}:null}}function j(t,e){const r=t.map((n=>g(n,e))).filter(n);return n=>{const t=n.mapEnd.x-n.mapStart.x,e=n.mapEnd.y-n.mapStart.y,a=n.mapEnd.z-n.mapStart.z;return r.forEach((t=>t(n))),{...n,translationX:t,translationY:e,translationZ:a}}}function v(n,e){const r=new Map;for(const a of e)r.set(a,t(n[a]));return t=>(r.forEach(((t,e)=>{n[e]=t})),t)}function R(n){return null!=n.geometry&&"mesh"===n.geometry.type?M(n,n.geometry):v(n,["geometry"])}function M(n,t){const e=null!=t.transform?t.transform.clone():null;if(e?.geographic)return r=>(t.transform=e,n.notifyMeshTransformChanged(),r);const r=t.vertexAttributes.clonePositional();return e=>(t.vertexAttributes=r,n.notifyGeometryChanged(),e)}function w(n){const t=n.map((n=>R(n))).filter((n=>null!=n));return n=>(t.forEach((t=>t(n))),n)}function P(){let n=0,t=0,e=0;return r=>{"start"===r.action&&(n=r.mapStart.x,t=r.mapStart.y,e=r.mapStart.z);const a=r.mapEnd.x-n,o=r.mapEnd.y-t,l=r.mapEnd.z-e;return n=r.mapEnd.x,t=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:a,mapDeltaY:o,mapDeltaZ:l,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function q(){let n=0,t=0;return e=>{"start"===e.action&&(n=e.screenStart.x,t=e.screenStart.y);const r=e.screenEnd.x-n,a=e.screenEnd.y-t;return n=e.screenEnd.x,t=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:a}}}function D(n,t){let a=null,o=0,l=0;return s=>{if("start"===s.action&&(a=n.toScreen?.(t),null!=a&&(a.x<0||a.x>n.width||a.y<0||a.y>n.height?a=null:(o=s.screenStart.x-a.x,l=s.screenStart.y-a.y))),null==a)return null;const c=e(s.screenEnd.x-o,0,n.width),i=e(s.screenEnd.y-l,0,n.height),u=r(c,i);return s.screenStart=a,s.screenEnd=u,s}}const U=()=>{};class C{constructor(){this.execute=U}next(n,t=new C){return null!=n&&(this.execute=e=>{const r=n(e);null!=r&&t.execute(r)}),t}}function G(n,t,e=[]){if("2d"===n.type)return n=>n;let r=null;return a=>{"start"===a.action&&(r=n.toMap(a.screenStart,{exclude:e}),null!=r&&(r.z=i(r,n,t)));const o=n.toMap(a.screenEnd,{exclude:e});null!=o&&(o.z=i(o,n,t));const l=null!=r&&null!=o?{sceneStart:r,sceneEnd:o}:null;return{...a,scenePoints:l}}}function X(n,t,e){const r=t.elevationProvider.getElevation(n.x,n.y,n.z??0,n.spatialReference,"scene")??0,a=s(n);return a.z=r,a.hasZ=!0,a.z=i(a,t,e),a}function Y(n,t){if("2d"===n.type)return n=>n;let e=null;return r=>{"start"===r.action&&(e=X(r.mapStart,n,t));const a=X(r.mapEnd,n,t),o=null!=e&&null!=a?{sceneStart:e,sceneEnd:a}:null;return{...r,scenePoints:o}}}export{C as EventPipeline,P as addMapDelta,q as addScreenDelta,y as constrainToMapAxis,f as createDragEventPipelineCallback,d as createManipulatorDragEventPipeline,D as dragAtLocation,g as dragGraphic,j as dragGraphicMany,R as resetGraphic,w as resetGraphicMany,v as resetProperties,G as sceneSnappingAtLocation,Y as sceneSnappingAtProjectedLocation,z as screenToMap};
5
+ import"../../geometry.js";import{isSome as e}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as t}from"../../core/lang.js";import{clamp as n}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{a}from"../../chunks/vec3f64.js";import{project as o}from"../../geometry/projection.js";import{hydratedSpatialReference as l,clonePoint as s}from"../../layers/graphics/hydratedFeatures.js";import{MeshTransformUpdateAction as c}from"../../layers/graphics/sources/interfaces.js";import{getZForElevationMode as i}from"../../support/elevationInfoUtils.js";import{ViewingMode as u}from"../ViewingMode.js";import{move as p}from"../draw/support/drawUtils.js";import m from"../../geometry/Point.js";function f(e,t){let n=null,r=null;return a=>{if("cancel"===a.action)return void(null!=r&&(r.execute({action:"cancel"}),n=null,r=null));const o={action:a.action,screenStart:a.start,screenEnd:a.screenPoint};"start"===a.action&&null==n&&(n=new U,r=new U,t(e,n,r,a.pointerType,o)),null!=n&&n.execute(o),"end"===a.action&&null!=n&&(n=null,r=null)}}function d(e,t){return e.events.on("drag",f(e,t))}function y(e,t){const n=[e.x,e.y,e.z??0],r=t,a=[Math.cos(r),Math.sin(r)],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]);if(0===o)return null;a[0]/=o,a[1]/=o;const l=e=>{const t=(e.x-n[0])*a[0]+(e.y-n[1])*a[1];e.x=n[0]+t*a[0],e.y=n[1]+t*a[1]};return e=>(l(e.mapStart),l(e.mapEnd),{...e,axis:a})}function x(e,t){let n=null;return r=>{if("start"===r.action&&(n=h(e,r.mapStart.spatialReference,t)),null==n)return null;const a=r.mapEnd.x-r.mapStart.x,o=r.mapEnd.y-r.mapStart.y,l=r.mapEnd.z-r.mapStart.z;return n.move(a,o,l,r.action),{...r,translationX:a,translationY:o,translationZ:l}}}function g(e,t){return null==e?null:e.spatialReference.equals(t)?e.clone():o(e,t)}function h(e,t,n){const r=e.geometry,a=l(t);if(null==r)return null;if("mesh"===r.type)return E(e,r,a,n);const s=g(r,a),c=r.spatialReference;return null==s?null:{move:(t,n,r)=>{const a=p(s.clone(),t,n,r);a.spatialReference.equals(c)?e.geometry=a:e.geometry=o(a,c)}}}function E(e,t,n,r){if(t.vertexSpace.isRelative)return S(e,t,t.vertexSpace,n);if(!t.spatialReference.equals(n))return null;let a=0,o=0,l=0;return{move:(n,s,c)=>{const i=n-a,p=s-o,f=c-l;if(i||p||f){const d=new m(t.origin.x+i,t.origin.y+p,(t.origin.z??0)+f,t.origin.spatialReference);t.centerAt(d,{geographic:t.vertexSpace.isRelative?void 0:r===u.Global}),e.notifyGeometryChanged(),a=n,o=s,l=c}}}}function S(e,t,n,r){const a=g(n.getOriginPoint(t.spatialReference),r),l=t.spatialReference;return null==a?null:{move:(t,r,s,i)=>{const u=p(a.clone(),t,r,s);if(u.spatialReference.equals(l))n.setOriginFormPoint(u);else{const e=o(u,l);null!=e&&n.setOriginFormPoint(e)}if(n.isGeoreferenced)e.notifyGeometryChanged();else{const t="end"===i;e.notifyMeshTransformChanged(t?{action:c.UpdateFastLocalOrigin}:{})}}}}function v(e,t=null,n){let r=null;const a=null==t||e.spatialReference?.equals(t)?e=>e:e=>null!=e?o(e,t):e,l={exclude:[],...n};return t=>{if("start"===t.action&&(r=a(e.toMap(t.screenStart,l))),null==r)return null;const n=a(e.toMap(t.screenEnd,l));return null!=n?{...t,mapStart:r,mapEnd:n}:null}}function j(t,n){const r=t.map((e=>x(e,n))).filter(e);return e=>{const t=e.mapEnd.x-e.mapStart.x,n=e.mapEnd.y-e.mapStart.y,a=e.mapEnd.z-e.mapStart.z;return r.forEach((t=>t(e))),{...e,translationX:t,translationY:n,translationZ:a}}}function R(e,n){const r=new Map;for(const a of n)r.set(a,t(e[a]));return t=>(r.forEach(((t,n)=>{e[n]=t})),t)}function z(e){return null!=e.geometry&&"mesh"===e.geometry.type?M(e,e.geometry):R(e,["geometry"])}function M(e,t){const{vertexSpace:n}=t;if(n.isGeoreferenced){const n=t.vertexAttributes.clonePositional();return r=>(t.vertexAttributes=n,e.notifyGeometryChanged(),r)}const r=a(n.origin),o=t.transform?.clone();return n=>(t.transform=o,t.vertexSpace.origin=r,e.notifyMeshTransformChanged(),n)}function w(e){const t=e.map((e=>z(e))).filter((e=>null!=e));return e=>(t.forEach((t=>t(e))),e)}function P(){let e=0,t=0,n=0;return r=>{"start"===r.action&&(e=r.mapStart.x,t=r.mapStart.y,n=r.mapStart.z);const a=r.mapEnd.x-e,o=r.mapEnd.y-t,l=r.mapEnd.z-n;return e=r.mapEnd.x,t=r.mapEnd.y,n=r.mapEnd.z,{...r,mapDeltaX:a,mapDeltaY:o,mapDeltaZ:l,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function q(){let e=0,t=0;return n=>{"start"===n.action&&(e=n.screenStart.x,t=n.screenStart.y);const r=n.screenEnd.x-e,a=n.screenEnd.y-t;return e=n.screenEnd.x,t=n.screenEnd.y,{...n,screenDeltaX:r,screenDeltaY:a}}}function D(e,t){let a=null,o=0,l=0;return s=>{if("start"===s.action&&(a=e.toScreen?.(t),null!=a&&(a.x<0||a.x>e.width||a.y<0||a.y>e.height?a=null:(o=s.screenStart.x-a.x,l=s.screenStart.y-a.y))),null==a)return null;const c=n(s.screenEnd.x-o,0,e.width),i=n(s.screenEnd.y-l,0,e.height),u=r(c,i);return s.screenStart=a,s.screenEnd=u,s}}const G=()=>{};class U{constructor(){this.execute=G}next(e,t=new U){return null!=e&&(this.execute=n=>{const r=e(n);null!=r&&t.execute(r)}),t}}function C(e,t,n=[]){if("2d"===e.type)return e=>e;let r=null;return a=>{"start"===a.action&&(r=e.toMap(a.screenStart,{exclude:n}),null!=r&&(r.z=i(r,e,t)));const o=e.toMap(a.screenEnd,{exclude:n});null!=o&&(o.z=i(o,e,t));const l=null!=r&&null!=o?{sceneStart:r,sceneEnd:o}:null;return{...a,scenePoints:l}}}function F(e,t,n){const r=t.elevationProvider.getElevation(e.x,e.y,e.z??0,e.spatialReference,"scene")??0,a=s(e);return a.z=r,a.hasZ=!0,a.z=i(a,t,n),a}function O(e,t){if("2d"===e.type)return e=>e;let n=null;return r=>{"start"===r.action&&(n=F(r.mapStart,e,t));const a=F(r.mapEnd,e,t),o=null!=n&&null!=a?{sceneStart:n,sceneEnd:a}:null;return{...r,scenePoints:o}}}export{U as EventPipeline,P as addMapDelta,q as addScreenDelta,y as constrainToMapAxis,f as createDragEventPipelineCallback,d as createManipulatorDragEventPipeline,D as dragAtLocation,x as dragGraphic,j as dragGraphicMany,z as resetGraphic,w as resetGraphicMany,R as resetProperties,C as sceneSnappingAtLocation,O as sceneSnappingAtProjectedLocation,v as screenToMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../chunks/tslib.es6.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 t}from"../../core/accessorSupport/decorators/subclass.js";import e from"../../layers/support/FeatureFilter.js";const s=s=>{let c=class extends s{constructor(...r){super(...r),this.connectionError=null,this.filter=null}get connectionStatus(){return this.controller?.isPaused?"paused":this.controller?.connection?.connectionStatus??"disconnected"}};return r([o({readOnly:!0})],c.prototype,"connectionError",void 0),r([o({readOnly:!0})],c.prototype,"connectionStatus",null),r([o({type:e})],c.prototype,"filter",void 0),c=r([t("esri.layers.mixins.StreamLayerView")],c),c};export{s as default};
5
+ import{_ as s}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import t from"../../layers/support/FeatureFilter.js";const o=o=>{let i=class extends o{resume(){this._isUserPaused=!1,this.suspended||this._doResume()}pause(){this._isUserPaused=!0,this.suspended||this._doPause()}constructor(...s){super(...s),this._isUserPaused=!1,this.filter=null}_onSuspendedChange(s){s?this._doPause():this._isUserPaused||this._doResume()}};return s([e({type:t})],i.prototype,"filter",void 0),i=s([r("esri.layers.mixins.StreamLayerView")],i),i};export{o 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.27/esri/copyright.txt for details.
4
4
  */
5
- const e="esri-basemap-gallery",i={base:`${e} esri-widget esri-widget--panel-height-only`,sourceLoading:`${e}--source-loading`,loader:`${e}__loader`,item:`${e}__item`,itemContainer:`${e}__item-container`,itemContent:`${e}__item-content`,itemTitle:`${e}__item-title`,itemTagsContainer:`${e}__item-tags-container`,itemThumbnail:`${e}__item-thumbnail`,selectedItem:`${e}__item--selected`,itemError:`${e}__item--error`,emptyMessage:"esri-widget__content--empty",widgetIcon:"esri-icon-basemap",disabled:"esri-disabled",loaderAnimation:"esri-widget__loader-animation"};export{i as CSS};
5
+ const e="esri-basemap-gallery",i={base:`${e} esri-widget esri-widget--panel-height-only`,sourceLoading:`${e}--source-loading`,layoutGrid:`${e}--grid`,narrowItems:`${e}--narrow-items`,loader:`${e}__loader`,item:`${e}__item`,itemContainer:`${e}__item-container`,itemContent:`${e}__item-content`,itemTitle:`${e}__item-title`,itemTagsContainer:`${e}__item-tags-container`,itemThumbnail:`${e}__item-thumbnail`,selectedItem:`${e}__item--selected`,itemError:`${e}__item--error`,emptyMessage:"esri-widget__content--empty",widgetIcon:"esri-icon-basemap",disabled:"esri-disabled",loaderAnimation:"esri-widget__loader-animation"};export{i as CSS};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import s from"../../../Basemap.js";import e from"../../../core/Collection.js";import a from"../../../core/Error.js";import r from"../../../core/Handles.js";import o from"../../../core/Loadable.js";import l from"../../../core/Logger.js";import{EsriPromiseMixin as i}from"../../../core/Promise.js";import{isAbortError as p}from"../../../core/promiseUtils.js";import{watch as n,initial as h}from"../../../core/reactiveUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import u from"../../../portal/Portal.js";import d from"./LocalBasemapsSource.js";const y=e.ofType(s);let f=class extends(o.LoadableMixin(i(d))){constructor(t){super(t),this._handles=new r,this._lastPortalBasemapFetchController=null,this.basemaps=new y,this.filterFunction=null,this.portal=u.getDefault(),this.query=null,this.updateBasemapsCallback=null,this.viewType=null}initialize(){this._handles.add([n((()=>[this.filterFunction,this.loadStatus,this.portal?.basemapGalleryGroupQuery,this.portal?.basemapGalleryGroupQuery3D,this.portal?.user,this.query,this.updateBasemapsCallback]),(()=>this.refresh()),h)])}destroy(){this._handles.destroy(),this._handles=null,this.filterFunction=null,this.portal=null}get state(){return"not-loaded"===this.loadStatus?"not-loaded":"loading"===this.loadStatus||this._lastPortalBasemapFetchController?"loading":"ready"}load(t){return this.addResolvingPromise(this.portal.load(t)),Promise.resolve(this)}async refresh(){if("loaded"!==this.loadStatus)return;this._lastPortalBasemapFetchController&&(this._lastPortalBasemapFetchController.abort(),this._lastPortalBasemapFetchController=null);const t=this.portal,s=new AbortController;this._lastPortalBasemapFetchController=s,this.notifyChange("state");const e="3d"===this.viewType;try{const a=await t.fetchBasemaps(this._toQueryString(this.query),{signal:s.signal,fetchBasemaps3D:e});await this._updateBasemaps(a)}catch(r){if(p(r))throw r;l.getLogger(this).warn(new a("basemap-source:fetch-basemaps-error","Could not fetch basemaps from portal.",{error:r})),await this._updateBasemaps()}this._lastPortalBasemapFetchController=null,this.notifyChange("state")}_toQueryString(t){return t&&"string"!=typeof t?Object.keys(t).map((s=>`${s}:${t[s]}`)).join(" AND "):t}async _updateBasemaps(t=[]){let s=await this._filterBasemaps(t);s=this.updateBasemapsCallback?this.updateBasemapsCallback(s):s,this.basemaps.removeAll(),this.basemaps.addMany(s)}async _filterBasemaps(t){if(!this.filterFunction)return t;const s=t.map(this.filterFunction),e=await Promise.all(s);return t.filter(((t,s)=>e[s]))}};t([m({readOnly:!0,type:y})],f.prototype,"basemaps",void 0),t([m()],f.prototype,"filterFunction",void 0),t([m({type:u})],f.prototype,"portal",void 0),t([m()],f.prototype,"query",void 0),t([m({readOnly:!0})],f.prototype,"state",null),t([m()],f.prototype,"updateBasemapsCallback",void 0),t([m()],f.prototype,"viewType",void 0),f=t([c("esri.widgets.BasemapGallery.support.PortalBasemapsSource")],f);const B=f;export{B as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../Basemap.js";import s from"../../../core/Collection.js";import a from"../../../core/Error.js";import r from"../../../core/Handles.js";import o from"../../../core/Loadable.js";import l from"../../../core/Logger.js";import{EsriPromiseMixin as i}from"../../../core/Promise.js";import{isAbortError as p}from"../../../core/promiseUtils.js";import{watch as n,initial as h}from"../../../core/reactiveUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import u from"../../../portal/Portal.js";import d from"./LocalBasemapsSource.js";const y=s.ofType(e);let f=class extends(o.LoadableMixin(i(d))){constructor(t){super(t),this._handles=new r,this._lastPortalBasemapFetchController=null,this.basemaps=new y,this.filterFunction=null,this.portal=u.getDefault(),this.query=null,this.updateBasemapsCallback=null,this.viewType=null}initialize(){this._handles.add([n((()=>[this.filterFunction,this.loadStatus,this.portal?.basemapGalleryGroupQuery,this.portal?.basemapGalleryGroupQuery3D,this.portal?.user,this.query,this.updateBasemapsCallback]),(()=>this.refresh()),h)])}destroy(){this._handles.destroy(),this._handles=null,this.filterFunction=null,this.portal=null}get state(){return"not-loaded"===this.loadStatus?"not-loaded":"loading"===this.loadStatus||this._lastPortalBasemapFetchController?"loading":"ready"}load(t){return this.addResolvingPromise(this.portal.load(t)),Promise.resolve(this)}async refresh(){if("loaded"!==this.loadStatus)return;this._lastPortalBasemapFetchController&&(this._lastPortalBasemapFetchController.abort(),this._lastPortalBasemapFetchController=null);const t=this.portal,e=new AbortController;this._lastPortalBasemapFetchController=e,this.notifyChange("state");try{const s=await t.fetchBasemaps(this._toQueryString(this.query),{signal:e.signal,include3d:"3d"===this.viewType||void 0});await this._updateBasemaps(s)}catch(s){if(p(s))throw s;l.getLogger(this).warn(new a("basemap-source:fetch-basemaps-error","Could not fetch basemaps from portal.",{error:s})),await this._updateBasemaps()}this._lastPortalBasemapFetchController=null,this.notifyChange("state")}_toQueryString(t){return t&&"string"!=typeof t?Object.keys(t).map((e=>`${e}:${t[e]}`)).join(" AND "):t}async _updateBasemaps(t=[]){let e=await this._filterBasemaps(t);e=this.updateBasemapsCallback?this.updateBasemapsCallback(e):e,this.basemaps.removeAll(),this.basemaps.addMany(e)}async _filterBasemaps(t){if(!this.filterFunction)return t;const e=t.map(this.filterFunction),s=await Promise.all(e);return t.filter(((t,e)=>s[e]))}};t([m({readOnly:!0,type:y})],f.prototype,"basemaps",void 0),t([m()],f.prototype,"filterFunction",void 0),t([m({type:u})],f.prototype,"portal",void 0),t([m()],f.prototype,"query",void 0),t([m({readOnly:!0})],f.prototype,"state",null),t([m()],f.prototype,"updateBasemapsCallback",void 0),t([m()],f.prototype,"viewType",void 0),f=t([c("esri.widgets.BasemapGallery.support.PortalBasemapsSource")],f);const B=f;export{B 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as s}from"../assets.js";import t from"../core/Handles.js";import{on as a,when as i,watch as r}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{isBasemap3D as n}from"../support/basemapUtils.js";import d from"./Widget.js";import p from"./BasemapGallery/BasemapGalleryViewModel.js";import{CSS as m}from"./BasemapGallery/css.js";import{loadCalciteComponents as c}from"./support/componentsUtils.js";import{Heading as h}from"./support/Heading.js";import{accessibleHandler as u}from"./support/decorators/accessibleHandler.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as v}from"./support/jsxFactory.js";import"./support/widgetUtils.js";let b=class extends d{constructor(e,s){super(e,s),this._handles=new t,this._focusBasemapItemEnabled=!1,this.disabled=!1,this.headingLevel=2,this.iconClass=m.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new p}initialize(){const e=this._handles;this.addHandles([a((()=>this.viewModel.items),"change",(s=>{const t="basemap-gallery-item-changes",{added:a,moved:i}=s;e.remove(t),e.add([...a,...i].map((e=>r((()=>e.state),(()=>this.scheduleRender())))),t),this.scheduleRender()})),i((()=>this.source),(()=>this.viewModel.load()),{initial:!0,once:!0})])}destroy(){this._handles.destroy()}loadDependencies(){return c({scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip.js")})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="loading"===this.source.state,s=this.disabled||"disabled"===this.viewModel.state,t=this.viewModel.items.map(((e,s)=>this._renderBasemapGalleryItem(e,s))).toArray(),a={[m.sourceLoading]:e,[m.disabled]:s},i=e?v("div",{class:m.loader,key:"esri-basemap-gallery__loader"}):null,r=e?null:t.length>0?v("ul",{bind:this,"aria-disabled":this.disabled,"aria-label":this.label,class:m.itemContainer,key:"esri-basemap-gallery__item-container",onkeydown:this._handleKeyDown,role:"radiogroup"},t):v("div",{class:m.emptyMessage,key:"esri-basemap-gallery__empty-message"},v(h,{level:this.headingLevel},this.messages.noBasemaps));return v("div",{class:this.classes(m.base,a)},i,r)}_getRoundRobinIndex(e,s){return(e+s)%s}_handleKeyDown(e){const{key:s}=e;if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(s))return;e.preventDefault();const{items:t,activeBasemapIndex:a}=this.viewModel,i="ArrowUp"===s||"ArrowLeft"===s?this._getRoundRobinIndex(Math.max(a-1,-1),t.length):this._getRoundRobinIndex(a+1,t.length),r=t.at(i);"ready"===r?.state&&(this.viewModel.activeBasemap=r.basemap),this._focusBasemapItemEnabled=!0}_focusBasemapItem(e){this._focusBasemapItemEnabled&&0===e.tabIndex&&(e.focus(),this._focusBasemapItemEnabled=!1)}_handleClick(e){const s=e.currentTarget["data-item"];"ready"===s.state&&(this.viewModel.activeBasemap=s.basemap)}_renderBasemapGalleryItem(e,t){const a=e.basemap.thumbnailUrl||s("esri/themes/base/images/basemap-toggle-64.svg"),i=e.basemap.title,r=e.basemap.portalItem?.snippet,o=e.error?.message||r||i,{viewModel:{state:l,activeBasemapIndex:d}}=this,p=this.disabled||"disabled"===l,c=d===t,h=c||-1===d&&0===t?0:-1,u="loading"===l,g={[m.selectedItem]:c,[m.itemError]:"error"===e.state},b=`basemapgallery-item-${e.uid}`;return v("li",{"aria-checked":c.toString(),"aria-disabled":p.toString(),"aria-labelledby":b,bind:this,class:this.classes(m.item,g),"data-item":e,onkeydown:this._handleClick,onclick:this._handleClick,role:"radio",tabIndex:h,afterUpdate:this._focusBasemapItem,title:o},v("img",{alt:"",class:m.itemThumbnail,src:a}),v("div",{class:m.itemContent},v("div",{class:m.itemTitle},v("span",{id:b},i)),n(e.basemap)?this._render3DTags():null),"loading"===e.state||c&&u?v("calcite-scrim",null,v("span",{"aria-hidden":"true",role:"presentation",class:m.loaderAnimation})):null)}_render3DTags(){const{messages:e}=this;return v("div",{class:m.itemTagsContainer},v("calcite-chip",{value:e.tag3D,scale:"s"},this.messages.tag3D),v("calcite-chip",{value:e.tagBeta,scale:"s",appearance:"outline-fill"},this.messages.tagBeta))}};e([o()],b.prototype,"activeBasemap",null),e([o()],b.prototype,"disabled",void 0),e([o()],b.prototype,"headingLevel",void 0),e([o()],b.prototype,"iconClass",void 0),e([o()],b.prototype,"icon",void 0),e([o()],b.prototype,"label",null),e([o(),g("esri/widgets/BasemapGallery/t9n/BasemapGallery")],b.prototype,"messages",void 0),e([o()],b.prototype,"source",null),e([o()],b.prototype,"view",null),e([o()],b.prototype,"viewModel",void 0),e([u()],b.prototype,"_handleClick",null),b=e([l("esri.widgets.BasemapGallery")],b);const y=b;export{y as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as s}from"../assets.js";import{when as t}from"../core/reactiveUtils.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 i}from"../core/accessorSupport/decorators/subclass.js";import{isBasemap3D as o}from"../support/basemapUtils.js";import r from"./Widget.js";import l from"./BasemapGallery/BasemapGalleryViewModel.js";import{CSS as d}from"./BasemapGallery/css.js";import{loadCalciteComponents as n}from"./support/componentsUtils.js";import{Heading as p}from"./support/Heading.js";import{accessibleHandler as m}from"./support/decorators/accessibleHandler.js";import{messageBundle as c}from"./support/decorators/messageBundle.js";import{tsx as h}from"./support/jsxFactory.js";import{onResize as u}from"./support/widgetUtils.js";const g={small:220,default:288,wide:430};let v=class extends r{constructor(e,s){super(e,s),this.disabled=!1,this.headingLevel=2,this.iconClass=d.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new l,this._focusBasemapItemEnabled=!1,this._width=0}initialize(){this.addHandles([u((()=>this.domNode),(({contentRect:e})=>{this._width=e.width})),t((()=>this.source),(()=>this.viewModel.load()),{initial:!0,once:!0})])}loadDependencies(){return n({scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip.js")})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="loading"===this.source.state,s=this.disabled||"disabled"===this.viewModel.state,t=this.viewModel.items.map(((e,s)=>this._renderBasemapGalleryItem(e,s))).toArray(),a={[d.sourceLoading]:e,[d.disabled]:s},i=this._width;i<g.small||i>g.wide?a[d.layoutGrid]=!0:i<g.default&&(a[d.narrowItems]=!0);const o=e?h("div",{class:d.loader,key:"esri-basemap-gallery__loader"}):null,r=e?null:t.length>0?h("ul",{bind:this,"aria-disabled":this.disabled,"aria-label":this.label,class:d.itemContainer,key:"esri-basemap-gallery__item-container",onkeydown:this._handleKeyDown,role:"radiogroup"},t):h("div",{class:d.emptyMessage,key:"esri-basemap-gallery__empty-message"},h(p,{level:this.headingLevel},this.messages.noBasemaps));return h("div",{class:this.classes(d.base,a)},o,r)}_getRoundRobinIndex(e,s){return(e+s)%s}_handleKeyDown(e){const{key:s}=e;if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(s))return;e.preventDefault();const{items:t,activeBasemapIndex:a}=this.viewModel,i="ArrowUp"===s||"ArrowLeft"===s?this._getRoundRobinIndex(Math.max(a-1,-1),t.length):this._getRoundRobinIndex(a+1,t.length),o=t.at(i);"ready"===o?.state&&(this.viewModel.activeBasemap=o.basemap),this._focusBasemapItemEnabled=!0}_focusBasemapItem(e){this._focusBasemapItemEnabled&&0===e.tabIndex&&(e.focus(),this._focusBasemapItemEnabled=!1)}_handleClick(e){const s=e.currentTarget["data-item"];"ready"===s.state&&(this.viewModel.activeBasemap=s.basemap)}_renderBasemapGalleryItem(e,t){const a=e.basemap.thumbnailUrl||s("esri/themes/base/images/basemap-toggle-64.svg"),i=e.basemap.title,r=e.basemap.portalItem?.snippet,l=e.error?.message||r||i,{viewModel:{state:n,activeBasemapIndex:p}}=this,m=this.disabled||"disabled"===n,c=p===t,u=c||-1===p&&0===t?0:-1,g="loading"===n,v={[d.selectedItem]:c,[d.itemError]:"error"===e.state},b=`basemapgallery-item-${e.uid}`;return h("li",{"aria-checked":c.toString(),"aria-disabled":m.toString(),"aria-labelledby":b,bind:this,class:this.classes(d.item,v),"data-item":e,onkeydown:this._handleClick,onclick:this._handleClick,role:"radio",tabIndex:u,afterUpdate:this._focusBasemapItem,title:l},h("img",{alt:"",class:d.itemThumbnail,src:a}),h("div",{class:d.itemContent},h("div",{class:d.itemTitle},h("span",{id:b},i)),o(e.basemap)?this._render3DTags():null),"loading"===e.state||c&&g?h("calcite-scrim",null,h("span",{"aria-hidden":"true",role:"presentation",class:d.loaderAnimation})):null)}_render3DTags(){const{messages:e}=this;return h("div",{class:d.itemTagsContainer},h("calcite-chip",{value:e.tag3D,scale:"s"},this.messages.tag3D),h("calcite-chip",{value:e.tagBeta,scale:"s",appearance:"outline-fill"},this.messages.tagBeta))}};e([a()],v.prototype,"activeBasemap",null),e([a()],v.prototype,"disabled",void 0),e([a()],v.prototype,"headingLevel",void 0),e([a()],v.prototype,"iconClass",void 0),e([a()],v.prototype,"icon",void 0),e([a()],v.prototype,"label",null),e([a(),c("esri/widgets/BasemapGallery/t9n/BasemapGallery")],v.prototype,"messages",void 0),e([a()],v.prototype,"source",null),e([a()],v.prototype,"view",null),e([a()],v.prototype,"viewModel",void 0),e([a()],v.prototype,"_focusBasemapItemEnabled",void 0),e([a()],v.prototype,"_width",void 0),e([m()],v.prototype,"_handleClick",null),v=e([i("esri.widgets.BasemapGallery")],v);const b=v;export{b 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{eventKey as t}from"../core/events.js";import o from"../core/Logger.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as s}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import a from"./CoordinateConversion/CoordinateConversionViewModel.js";import l from"./CoordinateConversion/support/Conversion.js";import{Heading as d}from"./support/Heading.js";import{accessibleHandler as p}from"./support/decorators/accessibleHandler.js";import{messageBundle as c}from"./support/decorators/messageBundle.js";import{tsx as u}from"./support/jsxFactory.js";import{storeNode as h,isRTL as _}from"./support/widgetUtils.js";const v={base:"esri-coordinate-conversion esri-widget",captureMode:"esri-coordinate-conversion--capture-mode",noBasemap:"esri-coordinate-conversion--no-basemap",popup:"esri-coordinate-conversion__popup",clipboardPopup:"esri-coordinate-conversion__clipboard-popup",conversionList:"esri-coordinate-conversion__conversion-list",conversionRow:"esri-coordinate-conversion__row",coordDisplay:"esri-coordinate-conversion__display",expanded:"esri-coordinate-conversion__conversions-view--expanded",expandDown:"esri-coordinate-conversion__conversions-view--expand-down",expandUp:"esri-coordinate-conversion__conversions-view--expand-up",conversionsView:"esri-coordinate-conversion__conversions-view",primarySelect:"esri-coordinate-conversion__select-primary",rowSelect:"esri-coordinate-conversion__select-row",toolDisplay:"esri-coordinate-conversion__tools",modeToggle:"esri-coordinate-conversion__mode-toggle",rowButton:"esri-coordinate-conversion__row-button",backButton:"esri-coordinate-conversion__back-button",convertButton:"esri-coordinate-conversion__button",convertButtonSpan:"esri-coordinate-conversion__convert-button-span",coordinateInput:"esri-coordinate-conversion__input-coordinate",inputForm:"esri-coordinate-conversion__input-form",inputFormGroup:"esri-coordinate-conversion__input-group",rejectInput:"esri-coordinate-conversion__input-coordinate--rejected",sectionHeading:"esri-coordinate-conversion__heading",patternInput:"esri-coordinate-conversion__pattern-input",settings:"esri-coordinate__settings",settingsFormGroup:"esri-coordinate-conversion__settings-group",settingsFormGroupHorizontal:"esri-coordinate-conversion__settings-group-horizontal",previewCoordinate:"esri-coordinate-conversion__preview-coordinate",disabled:"esri-disabled",input:"esri-input",button:"esri-button",header:"esri-widget__heading",widgetButton:"esri-widget--button",leftArrow:"esri-icon-left-arrow",rightArrow:"esri-icon-right-arrow",captureButton:"esri-icon-map-pin",collapseButton:"esri-icon-up",copyButton:"esri-icon-duplicate",editButton:"esri-icon-edit",esriSelect:"esri-select",expandButton:"esri-icon-down",goToButton:"esri-icon-locate",refresh:"esri-icon-refresh",removeConversion:"esri-icon-close",settingsButton:"esri-icon-settings2"},g={settingsButton:!0,inputButton:!0,captureButton:!0,expandButton:!0},m=750,b=2500;let w=class extends r{constructor(e,t){super(e,t),this._popupMessage=null,this._popupTimeoutId=void 0,this._clipboardPopupTimeoutId=void 0,this._coordinateInput=null,this._badInput=!1,this._goToEnabled=!1,this._conversionFormat=null,this._settingsFormat=null,this._previewConversion=null,this._expanded=!1,this._clipboardPopupVisible=!1,this._popupVisible=!1,this._settingsVisible=!1,this._inputVisible=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.orientation="auto",this.viewModel=new a,this.visibleElements={...g}}get conversions(){return this.viewModel.conversions}set conversions(e){this.viewModel.conversions=e}get currentLocation(){return this.viewModel.currentLocation}set currentLocation(e){this.viewModel.currentLocation=e}get formats(){return this.viewModel.formats}set formats(e){this.viewModel.formats=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}set multipleConversions(e){!1===e&&(this._expanded=!1,this.conversions.splice(1,this.conversions.length-1)),this._set("multipleConversions",e)}get multipleConversions(){const e=this._get("multipleConversions");return"boolean"!=typeof e||e}get locationSymbol(){return this.viewModel.locationSymbol}set locationSymbol(e){this.viewModel.locationSymbol=e}get storageEnabled(){return this.viewModel.storageEnabled}set storageEnabled(e){this.viewModel.storageEnabled=e}get storageType(){return this.viewModel.storageType}set storageType(e){this.viewModel.storageType=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...g,...e}}reverseConvert(e,t){return this.viewModel.reverseConvert(e,t)}render(){const e=this.get("viewModel.state"),t="disabled"===e?u("div",{key:"esri-coordinate__no-basemap"},this.messages?.noBasemap):null,o=!t&&this._inputVisible?this._renderInputForm():null,i=!t&&this._settingsVisible?this._renderSettings():null,s=t||o||i?null:this._renderConversionsView(),n=this._popupVisible?this._renderPopup():null,r={[v.captureMode]:"capture"===this.mode,[v.disabled]:"loading"===e,[v.noBasemap]:"disabled"===e};return u("div",{class:this.classes(v.base,r)},n,t,s,i,o)}_addConversion(e){const t=e.target,o=C(t.options[t.options.selectedIndex]),i=y(t);if(null==o||null==i)return;const s=new l({format:o});t.options.selectedIndex=0,i>=0&&this.conversions.removeAt(i),this.conversions.add(s,i)}_findSettingsFormat(){return this._settingsFormat||this.conversions.reduceRight(((e,t)=>{const o=t.format;return o?.hasDisplayProperties?o:e}),null)||this.formats.find((e=>e.hasDisplayProperties))}_hidePopup(){this._popupTimeoutId&&(clearTimeout(this._popupTimeoutId),this._popupTimeoutId=void 0),this._popupVisible=!1,this._popupMessage=null,this.scheduleRender()}_hideClipboardPopup(){this._clipboardPopupTimeoutId&&(clearTimeout(this._clipboardPopupTimeoutId),this._clipboardPopupTimeoutId=void 0),this._clipboardPopupVisible=!1,this.scheduleRender()}_onConvertComplete(){this._inputVisible=!1,this._coordinateInput.value=""}_onCopy(e){const t=f(e.currentTarget)?.displayCoordinate;null!=t&&(e.clipboardData?.setData("text/plain",t),this._showClipboardPopup(),e.preventDefault())}_processUserInput(e){const i=t(e),s=this.viewModel;if("Enter"!==i&&i)this._badInput&&(this._badInput=!1);else{const e=C(this._coordinateInput);if(!e)return;const t=this._coordinateInput.value;this._reverseConvert(t,e).then((e=>{"capture"===this.mode?s.resume():this.mode="capture",this.currentLocation=e,s.setLocation(e),this._onConvertComplete()})).catch((e=>{o.getLogger(this).error(e),this._showPopup(this.messages?.invalidCoordinate),this._badInput=!0}))}}async _reverseConvert(e,t){const i=this.viewModel,s=await t.reverseConvert(e);return this._goToEnabled&&s&&i.goToLocation(s).catch((e=>{o.getLogger(this).warn(e),this._showPopup(this.messages?.locationOffBasemap)})),s}_setInputFormat(e){const t=e.target,o=C(t[t.options.selectedIndex]);null!=o&&(this._conversionFormat=o)}_setPreviewConversion(){const e=this._findSettingsFormat(),t=this.viewModel;if(e){const o=this.conversions.find((t=>t.format===e));this._previewConversion=new l({format:e,position:{location:this.currentLocation,coordinate:o?.position?.coordinate}}),this._previewConversion.position?.coordinate||t.previewConversion(this._previewConversion)}}_setSettingsFormat(e){const t=e.target,o=C(t[t.options.selectedIndex]);null!=o&&(this._settingsFormat=o,this._setPreviewConversion())}_showClipboardPopup(){this._clipboardPopupVisible?clearTimeout(this._clipboardPopupTimeoutId):this._clipboardPopupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout((()=>{this._popupTimeoutId=void 0,this._hideClipboardPopup()}),m)}_showPopup(e,t=b){this._popupMessage=e,this._popupVisible?clearTimeout(this._popupTimeoutId):this._popupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout((()=>{this._popupTimeoutId=void 0,this._hidePopup()}),t)}_toggleGoTo(){this._goToEnabled=!this._goToEnabled}_updateCurrentPattern(e){e.stopPropagation();const t=e.target,o=this._findSettingsFormat();o&&(o.currentPattern=t.value)}_renderConversion(e,t){const{messages:o}=this;if(!o)return u("li",null);const{format:i}=e,s=i?.label??"",n=`${this.id}__list-item-${t}`,r=`${s} ${o.conversionOutputSuffix}`,a=0===t,l=a||this._expanded,d=a?this._renderFirstConversion(e):this._renderTools(t,e,n),p=a&&!e.displayCoordinate?o.noLocation:e.displayCoordinate,c=u("div",{"aria-label":p,class:v.coordDisplay,"data-conversion":e,role:"listitem",tabindex:"0",title:p??""},p),h=this._renderOptions(this.formats.filter((e=>e!==i)));return l?u("li",{"aria-label":r,class:v.conversionRow,id:n,key:e,role:"group",title:r,tabindex:"0"},u("select",{"aria-controls":n,"aria-label":o.selectFormat,class:this.classes(v.esriSelect,v.rowSelect),bind:this,"data-index":t,onchange:this._addConversion,title:o.selectFormat},u("option",{"aria-label":s,selected:!0,title:s},s.toUpperCase()),h),c,d):null}_renderCopyButton(e){const t=this._clipboardPopupVisible&&this._renderClipboardPopup(),{messagesCommon:o}=this;return o?u("li",{"aria-label":o.copy,bind:this,class:this.classes(v.widgetButton,v.rowButton),"data-conversion":e,onclick:this._copyCoordinateOutput,onkeydown:this._copyCoordinateOutput,oncopy:this._onCopy,role:"button",tabindex:"0",title:o.copy},t,u("span",{"aria-hidden":"true",class:v.copyButton})):u("li",null)}_renderFirstConversion(e){const t=this.id,o={[v.expandButton]:!this._expanded,[v.collapseButton]:this._expanded},{messages:i,messagesCommon:s,multipleConversions:n,visibleElements:r}=this;if(!s||!i)return u("ul",null);const a="live"===this.mode?i.captureMode:i.liveMode,l=this._expanded?s.collapse:s.expand,d=e.displayCoordinate&&"capture"===this.mode?this._renderCopyButton(e):null,p=n&&r.expandButton&&u("li",{"aria-controls":`${t}__${v.conversionList}`,"aria-label":l,bind:this,class:v.widgetButton,key:"esri-coordinate-conversion__expand-button",onclick:this._toggleExpand,onkeydown:this._toggleExpand,role:"button",tabindex:"0",title:l},u("span",{"aria-hidden":"true",class:this.classes(o)})),c=!n&&r.captureButton&&u("li",{"aria-label":a,bind:this,class:this.classes(v.widgetButton,v.modeToggle),key:"esri-coordinate-conversion__mode-toggle",onclick:this._toggleMode,onkeydown:this._toggleMode,role:"button",tabindex:"0",title:a},u("span",{"aria-hidden":"true",class:v.captureButton}));return u("ul",{class:v.toolDisplay},d,p,c)}_renderInputForm(){const e=this._conversionFormat||this.conversions.at(0).format,t=this.formats.findIndex((t=>t.name===e?.name)),o=this.id,i=`${o}__${v.coordinateInput}`,s=`${o}__${v.coordinateInput}__header`,n=this._renderOptions(this.formats,!0,t),r={[v.rejectInput]:this._badInput},{messages:a,messagesCommon:l,headingLevel:p}=this;return l&&a?u("div",{"aria-labelledby":s,class:v.inputForm,key:"esri-coordinate-conversion__input-form",role:"search"},u("div",{class:v.sectionHeading},u("div",{"aria-label":l.back,bind:this,class:this.classes(v.widgetButton,v.backButton),onclick:this._toggleInputVisibility,onkeydown:this._toggleInputVisibility,role:"button",tabindex:"0",title:l.back},this._renderBackIcon()),u(d,{level:p,class:v.header,id:s},a.inputCoordTitle)),u("div",{class:v.inputFormGroup},u("select",{"aria-controls":i,"aria-label":a.selectFormat,bind:this,class:this.classes(v.esriSelect,v.rowSelect),onchange:this._setInputFormat,title:a.selectFormat},n),u("input",{afterCreate:h,"aria-labelledby":s,"aria-required":"true",bind:this,class:this.classes(v.coordinateInput,v.input,r),"data-format":e,"data-node-ref":"_coordinateInput",id:i,onkeydown:this._processUserInput,placeholder:a.inputCoordTitle,role:"textbox",spellcheck:!1,title:a.inputCoordTitle,type:"text"})),u("div",{class:v.inputFormGroup},u("label",{"aria-label":a.goTo},u("input",{bind:this,checked:this._goToEnabled,onclick:this._toggleGoTo,title:a.goTo,type:"checkbox"}),a.goTo),u("button",{"aria-label":a.convert,bind:this,class:this.classes(v.convertButton,v.button),onclick:this._processUserInput,title:a.convert,type:"button"},u("span",{class:v.convertButtonSpan},a.convert)))):u("div",null)}_renderConversionsView(){const{messages:e}=this;if(!e)return u("div",null);const t=`${this.id}__${v.conversionList}`,o=this._renderPrimaryTools(),i=this._renderOptions(this.formats),s=this.conversions.map(((e,t)=>this._renderConversion(e,t))).toArray(),n=this._expanded?u("div",{class:v.conversionRow},u("select",{"aria-controls":t,"aria-label":e.addConversion,bind:this,class:this.classes(v.esriSelect,v.primarySelect),onchange:this._addConversion,title:e.addConversion},u("option",{disabled:!0,selected:!0,value:""},e.addConversion),i),o):null,r={[v.expanded]:this._expanded,[v.expandUp]:"expand-up"===this.orientation,[v.expandDown]:"expand-down"===this.orientation};return u("div",{class:this.classes(v.conversionsView,r),key:"esri-coordinate-conversion__main-view"},u("ul",{"aria-expanded":this._expanded?"true":"false",class:v.conversionList,id:t},s),n)}_renderOptions(e,t,o){const i=this.conversions.at(0),s=i.format?.name;return e.map(((e,n)=>{const r=!(t||!i)&&(s===e.name||this.conversions.map((e=>e.format?.name)).includes(e.name));return u("option",{"aria-label":e.label,"data-format":e,disabled:r,key:e.name??"unnamed-format",selected:n===o,value:e.label},e.label.toUpperCase())})).toArray()}_renderPopup(){return u("div",{class:v.popup,role:"alert"},this._popupMessage)}_renderClipboardPopup(){const{messages:e}=this;return e?u("div",{class:this.classes(v.popup,v.clipboardPopup),role:"alert"},e.copySuccessMessage):u("div",null)}_renderPrimaryTools(){const{messages:e,visibleElements:t}=this;if(!e)return u("ul",null);const o="live"===this.mode?e.captureMode:e.liveMode,i=t.inputButton&&u("li",{bind:this,class:v.widgetButton,onclick:this._toggleInputVisibility,onkeydown:this._toggleInputVisibility,role:"button",tabindex:"0",title:e.inputCoordTitle},u("span",{"aria-hidden":"true",class:v.editButton})),s=t.captureButton&&u("li",{bind:this,class:this.classes(v.widgetButton,v.modeToggle),onclick:this._toggleMode,onkeydown:this._toggleMode,role:"button",tabindex:"0",title:o},u("span",{"aria-hidden":"true",class:v.captureButton})),n=t.settingsButton&&u("li",{bind:this,class:v.widgetButton,onclick:this._toggleSettingsVisibility,onkeydown:this._toggleSettingsVisibility,role:"button",tabindex:"0",title:e.settingsTitle},u("span",{"aria-hidden":"true",class:v.settingsButton}));return u("ul",{class:v.toolDisplay},i,s,n)}_renderSettings(){const e=this.id,t=`${e}__${v.patternInput}`,o=`${e}__${v.patternInput}__header`,i=`${e}__${v.previewCoordinate}`,s=this.formats.filter((e=>e.hasDisplayProperties)),n=this._findSettingsFormat(),r=n?s.indexOf(n):-1,a=this._renderOptions(s,!0,r),l=n?.get("currentPattern"),{messages:p,messagesCommon:c,headingLevel:h}=this;return c&&p?u("div",{"aria-labelledby":o,class:v.settings,key:"esri-coordinate-conversion__settings"},u("div",{class:v.sectionHeading},u("div",{bind:this,class:this.classes(v.widgetButton,v.backButton),onclick:this._toggleSettingsVisibility,onkeydown:this._toggleSettingsVisibility,role:"button",tabindex:"0",title:c.back},this._renderBackIcon()),u(d,{level:h,class:v.header,id:o},p.settingsTitle)),u("div",{class:v.settingsFormGroup},u("label",{for:t},p.changeCoordinateDisplay),u("select",{"aria-label":p.selectFormat,class:v.esriSelect,bind:this,onchange:this._setSettingsFormat,title:p.selectFormat},a),u("div",{class:v.settingsFormGroupHorizontal},u("input",{"aria-controls":i,bind:this,class:this.classes(v.patternInput,v.input),id:t,oninput:this._updateCurrentPattern,spellcheck:!1,title:p.changeCoordinateDisplay,type:"text",value:l}),u("div",{"aria-controls":t,bind:this,class:v.widgetButton,onclick:this._setDefaultPattern,onkeydown:this._setDefaultPattern,role:"button",tabindex:"0",title:p.defaultPattern},u("span",{"aria-hidden":"true",class:v.refresh})))),u("div",{class:v.settingsFormGroup},u("label",null,c.preview,u("div",{class:v.previewCoordinate,id:i,tabindex:"0"},this._previewConversion?.displayCoordinate)))):u("div",null)}_renderBackIcon(){return u("span",{"aria-hidden":"true",class:_(this.container)?v.rightArrow:v.leftArrow})}_renderTools(e,t,o){const i=t.displayCoordinate&&"capture"===this.mode?this._renderCopyButton(t):null,{messages:s}=this;return s?u("ul",{class:v.toolDisplay,role:"listitem"},i,u("li",{"aria-controls":o,"aria-label":s.removeConversion,bind:this,class:this.classes(v.widgetButton,v.rowButton),"data-index":e,key:`${o}__${v.widgetButton}`,onclick:this._removeConversion,onkeydown:this._removeConversion,tabindex:"0",role:"button",title:s.removeConversion},u("span",{"aria-hidden":"true",class:v.removeConversion}))):u("ul",null)}_copyCoordinateOutput(e){const t=e.target;if(!("createTextRange"in document.body)){const e=window.getSelection(),o=document.createRange();o.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(o)}document.execCommand("copy")}_removeConversion(e){const t=y(e.currentTarget);null!=t&&this.conversions.removeAt(t)}_setDefaultPattern(e){e.stopPropagation();const t=this._findSettingsFormat();t&&(t.currentPattern=t.get("defaultPattern"))}_toggleExpand(){this._expanded=!this._expanded}_toggleInputVisibility(){this._inputVisible=!this._inputVisible,this._popupVisible&&this._hidePopup(),this._inputVisible?this.viewModel.pause():this.viewModel.resume()}_toggleMode(){this.mode="live"===this.mode?"capture":"live"}_toggleSettingsVisibility(){this._settingsVisible=!this._settingsVisible,this._popupVisible&&this._hidePopup(),this._settingsVisible?(this._setPreviewConversion(),this.viewModel.pause()):this.viewModel.resume()}};function y(e){return e["data-index"]}function C(e){return e["data-format"]}function f(e){return e["data-conversion"]}e([i()],w.prototype,"conversions",null),e([i()],w.prototype,"currentLocation",null),e([i()],w.prototype,"formats",null),e([i()],w.prototype,"goToOverride",null),e([i()],w.prototype,"headingLevel",void 0),e([i()],w.prototype,"label",null),e([i(),c("esri/widgets/CoordinateConversion/t9n/CoordinateConversion")],w.prototype,"messages",void 0),e([i(),c("esri/t9n/common")],w.prototype,"messagesCommon",void 0),e([i()],w.prototype,"mode",null),e([i()],w.prototype,"orientation",void 0),e([i()],w.prototype,"multipleConversions",null),e([i()],w.prototype,"locationSymbol",null),e([i()],w.prototype,"storageEnabled",null),e([i()],w.prototype,"storageType",null),e([i()],w.prototype,"view",null),e([i({type:a})],w.prototype,"viewModel",void 0),e([i()],w.prototype,"visibleElements",void 0),e([s("visibleElements")],w.prototype,"castVisibleElements",null),e([p()],w.prototype,"_copyCoordinateOutput",null),e([p()],w.prototype,"_removeConversion",null),e([p()],w.prototype,"_setDefaultPattern",null),e([p()],w.prototype,"_toggleExpand",null),e([p()],w.prototype,"_toggleInputVisibility",null),e([p()],w.prototype,"_toggleMode",null),e([p()],w.prototype,"_toggleSettingsVisibility",null),w=e([n("esri.widgets.CoordinateConversion")],w);const x=w;export{x as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{eventKey as t}from"../core/events.js";import o from"../core/Logger.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as s}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import a from"./CoordinateConversion/CoordinateConversionViewModel.js";import l from"./CoordinateConversion/support/Conversion.js";import{Heading as d}from"./support/Heading.js";import{accessibleHandler as p}from"./support/decorators/accessibleHandler.js";import{messageBundle as c}from"./support/decorators/messageBundle.js";import{tsx as u}from"./support/jsxFactory.js";import{storeNode as h,isRTL as _}from"./support/widgetUtils.js";const v={base:"esri-coordinate-conversion esri-widget",captureMode:"esri-coordinate-conversion--capture-mode",noBasemap:"esri-coordinate-conversion--no-basemap",popup:"esri-coordinate-conversion__popup",clipboardPopup:"esri-coordinate-conversion__clipboard-popup",conversionList:"esri-coordinate-conversion__conversion-list",conversionRow:"esri-coordinate-conversion__row",coordDisplay:"esri-coordinate-conversion__display",expanded:"esri-coordinate-conversion__conversions-view--expanded",expandDown:"esri-coordinate-conversion__conversions-view--expand-down",expandUp:"esri-coordinate-conversion__conversions-view--expand-up",conversionsView:"esri-coordinate-conversion__conversions-view",primarySelect:"esri-coordinate-conversion__select-primary",rowSelect:"esri-coordinate-conversion__select-row",toolDisplay:"esri-coordinate-conversion__tools",modeToggle:"esri-coordinate-conversion__mode-toggle",rowButton:"esri-coordinate-conversion__row-button",backButton:"esri-coordinate-conversion__back-button",convertButton:"esri-coordinate-conversion__button",convertButtonSpan:"esri-coordinate-conversion__convert-button-span",coordinateInput:"esri-coordinate-conversion__input-coordinate",inputForm:"esri-coordinate-conversion__input-form",inputFormGroup:"esri-coordinate-conversion__input-group",rejectInput:"esri-coordinate-conversion__input-coordinate--rejected",sectionHeading:"esri-coordinate-conversion__heading",patternInput:"esri-coordinate-conversion__pattern-input",settings:"esri-coordinate__settings",settingsFormGroup:"esri-coordinate-conversion__settings-group",settingsFormGroupHorizontal:"esri-coordinate-conversion__settings-group-horizontal",previewCoordinate:"esri-coordinate-conversion__preview-coordinate",disabled:"esri-disabled",input:"esri-input",button:"esri-button",header:"esri-widget__heading",widgetButton:"esri-widget--button",leftArrow:"esri-icon-left-arrow",rightArrow:"esri-icon-right-arrow",captureButton:"esri-icon-map-pin",collapseButton:"esri-icon-up",copyButton:"esri-icon-duplicate",editButton:"esri-icon-edit",esriSelect:"esri-select",expandButton:"esri-icon-down",goToButton:"esri-icon-locate",refresh:"esri-icon-refresh",removeConversion:"esri-icon-close",settingsButton:"esri-icon-settings2"},g={settingsButton:!0,inputButton:!0,captureButton:!0,expandButton:!0},m=750,b=2500;let w=class extends r{constructor(e,t){super(e,t),this._popupMessage=null,this._popupTimeoutId=void 0,this._clipboardPopupTimeoutId=void 0,this._coordinateInput=null,this._badInput=!1,this._goToEnabled=!1,this._conversionFormat=null,this._settingsFormat=null,this._previewConversion=null,this._expanded=!1,this._clipboardPopupVisible=!1,this._popupVisible=!1,this._settingsVisible=!1,this._inputVisible=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.orientation="auto",this.viewModel=new a,this.visibleElements={...g}}get conversions(){return this.viewModel.conversions}set conversions(e){this.viewModel.conversions=e}get currentLocation(){return this.viewModel.currentLocation}set currentLocation(e){this.viewModel.currentLocation=e}get formats(){return this.viewModel.formats}set formats(e){this.viewModel.formats=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}set multipleConversions(e){!1===e&&(this._expanded=!1,this.conversions.splice(1,this.conversions.length-1)),this._set("multipleConversions",e)}get multipleConversions(){const e=this._get("multipleConversions");return"boolean"!=typeof e||e}get locationSymbol(){return this.viewModel.locationSymbol}set locationSymbol(e){this.viewModel.locationSymbol=e}get storageEnabled(){return this.viewModel.storageEnabled}set storageEnabled(e){this.viewModel.storageEnabled=e}get storageType(){return this.viewModel.storageType}set storageType(e){this.viewModel.storageType=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...g,...e}}reverseConvert(e,t){return this.viewModel.reverseConvert(e,t)}render(){const e=this.get("viewModel.state"),t="disabled"===e?u("div",{key:"esri-coordinate__no-basemap"},this.messages?.noBasemap):null,o=!t&&this._inputVisible?this._renderInputForm():null,i=!t&&this._settingsVisible?this._renderSettings():null,s=t||o||i?null:this._renderConversionsView(),n=this._popupVisible?this._renderPopup():null,r={[v.captureMode]:"capture"===this.mode,[v.disabled]:"loading"===e,[v.noBasemap]:"disabled"===e};return u("div",{class:this.classes(v.base,r)},n,t,s,i,o)}_addConversion(e){const t=e.target,o=C(t.options[t.options.selectedIndex]),i=y(t);if(null==o||null==i)return;const s=new l({format:o});t.options.selectedIndex=0,i>=0?(this.conversions.removeAt(i),this.conversions.add(s,i)):this.conversions.add(s)}_findSettingsFormat(){return this._settingsFormat||this.conversions.reduceRight(((e,t)=>{const o=t.format;return o?.hasDisplayProperties?o:e}),null)||this.formats.find((e=>e.hasDisplayProperties))}_hidePopup(){this._popupTimeoutId&&(clearTimeout(this._popupTimeoutId),this._popupTimeoutId=void 0),this._popupVisible=!1,this._popupMessage=null,this.scheduleRender()}_hideClipboardPopup(){this._clipboardPopupTimeoutId&&(clearTimeout(this._clipboardPopupTimeoutId),this._clipboardPopupTimeoutId=void 0),this._clipboardPopupVisible=!1,this.scheduleRender()}_onConvertComplete(){this._inputVisible=!1,this._coordinateInput.value=""}_onCopy(e){const t=f(e.currentTarget)?.displayCoordinate;null!=t&&(e.clipboardData?.setData("text/plain",t),this._showClipboardPopup(),e.preventDefault())}_processUserInput(e){const i=t(e),s=this.viewModel;if("Enter"!==i&&i)this._badInput&&(this._badInput=!1);else{const e=C(this._coordinateInput);if(!e)return;const t=this._coordinateInput.value;this._reverseConvert(t,e).then((e=>{"capture"===this.mode?s.resume():this.mode="capture",this.currentLocation=e,s.setLocation(e),this._onConvertComplete()})).catch((e=>{o.getLogger(this).error(e),this._showPopup(this.messages?.invalidCoordinate),this._badInput=!0}))}}async _reverseConvert(e,t){const i=this.viewModel,s=await t.reverseConvert(e);return this._goToEnabled&&s&&i.goToLocation(s).catch((e=>{o.getLogger(this).warn(e),this._showPopup(this.messages?.locationOffBasemap)})),s}_setInputFormat(e){const t=e.target,o=C(t[t.options.selectedIndex]);null!=o&&(this._conversionFormat=o)}_setPreviewConversion(){const e=this._findSettingsFormat(),t=this.viewModel;if(e){const o=this.conversions.find((t=>t.format===e));this._previewConversion=new l({format:e,position:{location:this.currentLocation,coordinate:o?.position?.coordinate}}),this._previewConversion.position?.coordinate||t.previewConversion(this._previewConversion)}}_setSettingsFormat(e){const t=e.target,o=C(t[t.options.selectedIndex]);null!=o&&(this._settingsFormat=o,this._setPreviewConversion())}_showClipboardPopup(){this._clipboardPopupVisible?clearTimeout(this._clipboardPopupTimeoutId):this._clipboardPopupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout((()=>{this._popupTimeoutId=void 0,this._hideClipboardPopup()}),m)}_showPopup(e,t=b){this._popupMessage=e,this._popupVisible?clearTimeout(this._popupTimeoutId):this._popupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout((()=>{this._popupTimeoutId=void 0,this._hidePopup()}),t)}_toggleGoTo(){this._goToEnabled=!this._goToEnabled}_updateCurrentPattern(e){e.stopPropagation();const t=e.target,o=this._findSettingsFormat();o&&(o.currentPattern=t.value)}_renderConversion(e,t){const{messages:o}=this;if(!o)return u("li",null);const{format:i}=e,s=i?.label??"",n=`${this.id}__list-item-${t}`,r=`${s} ${o.conversionOutputSuffix}`,a=0===t,l=a||this._expanded,d=a?this._renderFirstConversion(e):this._renderTools(t,e,n),p=a&&!e.displayCoordinate?o.noLocation:e.displayCoordinate,c=u("div",{"aria-label":p,class:v.coordDisplay,"data-conversion":e,role:"listitem",tabindex:"0",title:p??""},p),h=this._renderOptions(this.formats.filter((e=>e!==i)));return l?u("li",{"aria-label":r,class:v.conversionRow,id:n,key:e,role:"group",title:r,tabindex:"0"},u("select",{"aria-controls":n,"aria-label":o.selectFormat,class:this.classes(v.esriSelect,v.rowSelect),bind:this,"data-index":t,onchange:this._addConversion,title:o.selectFormat},u("option",{"aria-label":s,selected:!0,title:s},s.toUpperCase()),h),c,d):null}_renderCopyButton(e){const t=this._clipboardPopupVisible&&this._renderClipboardPopup(),{messagesCommon:o}=this;return o?u("li",{"aria-label":o.copy,bind:this,class:this.classes(v.widgetButton,v.rowButton),"data-conversion":e,onclick:this._copyCoordinateOutput,onkeydown:this._copyCoordinateOutput,oncopy:this._onCopy,role:"button",tabindex:"0",title:o.copy},t,u("span",{"aria-hidden":"true",class:v.copyButton})):u("li",null)}_renderFirstConversion(e){const t=this.id,o={[v.expandButton]:!this._expanded,[v.collapseButton]:this._expanded},{messages:i,messagesCommon:s,multipleConversions:n,visibleElements:r}=this;if(!s||!i)return u("ul",null);const a="live"===this.mode?i.captureMode:i.liveMode,l=this._expanded?s.collapse:s.expand,d=e.displayCoordinate&&"capture"===this.mode?this._renderCopyButton(e):null,p=n&&r.expandButton&&u("li",{"aria-controls":`${t}__${v.conversionList}`,"aria-label":l,bind:this,class:v.widgetButton,key:"esri-coordinate-conversion__expand-button",onclick:this._toggleExpand,onkeydown:this._toggleExpand,role:"button",tabindex:"0",title:l},u("span",{"aria-hidden":"true",class:this.classes(o)})),c=!n&&r.captureButton&&u("li",{"aria-label":a,bind:this,class:this.classes(v.widgetButton,v.modeToggle),key:"esri-coordinate-conversion__mode-toggle",onclick:this._toggleMode,onkeydown:this._toggleMode,role:"button",tabindex:"0",title:a},u("span",{"aria-hidden":"true",class:v.captureButton}));return u("ul",{class:v.toolDisplay},d,p,c)}_renderInputForm(){const e=this._conversionFormat||this.conversions.at(0).format,t=this.formats.findIndex((t=>t.name===e?.name)),o=this.id,i=`${o}__${v.coordinateInput}`,s=`${o}__${v.coordinateInput}__header`,n=this._renderOptions(this.formats,!0,t),r={[v.rejectInput]:this._badInput},{messages:a,messagesCommon:l,headingLevel:p}=this;return l&&a?u("div",{"aria-labelledby":s,class:v.inputForm,key:"esri-coordinate-conversion__input-form",role:"search"},u("div",{class:v.sectionHeading},u("div",{"aria-label":l.back,bind:this,class:this.classes(v.widgetButton,v.backButton),onclick:this._toggleInputVisibility,onkeydown:this._toggleInputVisibility,role:"button",tabindex:"0",title:l.back},this._renderBackIcon()),u(d,{level:p,class:v.header,id:s},a.inputCoordTitle)),u("div",{class:v.inputFormGroup},u("select",{"aria-controls":i,"aria-label":a.selectFormat,bind:this,class:this.classes(v.esriSelect,v.rowSelect),onchange:this._setInputFormat,title:a.selectFormat},n),u("input",{afterCreate:h,"aria-labelledby":s,"aria-required":"true",bind:this,class:this.classes(v.coordinateInput,v.input,r),"data-format":e,"data-node-ref":"_coordinateInput",id:i,onkeydown:this._processUserInput,placeholder:a.inputCoordTitle,role:"textbox",spellcheck:!1,title:a.inputCoordTitle,type:"text"})),u("div",{class:v.inputFormGroup},u("label",{"aria-label":a.goTo},u("input",{bind:this,checked:this._goToEnabled,onclick:this._toggleGoTo,title:a.goTo,type:"checkbox"}),a.goTo),u("button",{"aria-label":a.convert,bind:this,class:this.classes(v.convertButton,v.button),onclick:this._processUserInput,title:a.convert,type:"button"},u("span",{class:v.convertButtonSpan},a.convert)))):u("div",null)}_renderConversionsView(){const{messages:e}=this;if(!e)return u("div",null);const t=`${this.id}__${v.conversionList}`,o=this._renderPrimaryTools(),i=this._renderOptions(this.formats),s=this.conversions.map(((e,t)=>this._renderConversion(e,t))).toArray(),n=this._expanded?u("div",{class:v.conversionRow},u("select",{"aria-controls":t,"aria-label":e.addConversion,bind:this,class:this.classes(v.esriSelect,v.primarySelect),"data-index":-1,onchange:this._addConversion,title:e.addConversion},u("option",{disabled:!0,selected:!0,value:""},e.addConversion),i),o):null,r={[v.expanded]:this._expanded,[v.expandUp]:"expand-up"===this.orientation,[v.expandDown]:"expand-down"===this.orientation};return u("div",{class:this.classes(v.conversionsView,r),key:"esri-coordinate-conversion__main-view"},u("ul",{"aria-expanded":this._expanded?"true":"false",class:v.conversionList,id:t},s),n)}_renderOptions(e,t,o){const i=this.conversions.at(0),s=i.format?.name;return e.map(((e,n)=>{const r=!(t||!i)&&(s===e.name||this.conversions.map((e=>e.format?.name)).includes(e.name));return u("option",{"aria-label":e.label,"data-format":e,disabled:r,key:e.name??"unnamed-format",selected:n===o,value:e.label},e.label.toUpperCase())})).toArray()}_renderPopup(){return u("div",{class:v.popup,role:"alert"},this._popupMessage)}_renderClipboardPopup(){const{messages:e}=this;return e?u("div",{class:this.classes(v.popup,v.clipboardPopup),role:"alert"},e.copySuccessMessage):u("div",null)}_renderPrimaryTools(){const{messages:e,visibleElements:t}=this;if(!e)return u("ul",null);const o="live"===this.mode?e.captureMode:e.liveMode,i=t.inputButton&&u("li",{bind:this,class:v.widgetButton,onclick:this._toggleInputVisibility,onkeydown:this._toggleInputVisibility,role:"button",tabindex:"0",title:e.inputCoordTitle},u("span",{"aria-hidden":"true",class:v.editButton})),s=t.captureButton&&u("li",{bind:this,class:this.classes(v.widgetButton,v.modeToggle),onclick:this._toggleMode,onkeydown:this._toggleMode,role:"button",tabindex:"0",title:o},u("span",{"aria-hidden":"true",class:v.captureButton})),n=t.settingsButton&&u("li",{bind:this,class:v.widgetButton,onclick:this._toggleSettingsVisibility,onkeydown:this._toggleSettingsVisibility,role:"button",tabindex:"0",title:e.settingsTitle},u("span",{"aria-hidden":"true",class:v.settingsButton}));return u("ul",{class:v.toolDisplay},i,s,n)}_renderSettings(){const e=this.id,t=`${e}__${v.patternInput}`,o=`${e}__${v.patternInput}__header`,i=`${e}__${v.previewCoordinate}`,s=this.formats.filter((e=>e.hasDisplayProperties)),n=this._findSettingsFormat(),r=n?s.indexOf(n):-1,a=this._renderOptions(s,!0,r),l=n?.get("currentPattern"),{messages:p,messagesCommon:c,headingLevel:h}=this;return c&&p?u("div",{"aria-labelledby":o,class:v.settings,key:"esri-coordinate-conversion__settings"},u("div",{class:v.sectionHeading},u("div",{bind:this,class:this.classes(v.widgetButton,v.backButton),onclick:this._toggleSettingsVisibility,onkeydown:this._toggleSettingsVisibility,role:"button",tabindex:"0",title:c.back},this._renderBackIcon()),u(d,{level:h,class:v.header,id:o},p.settingsTitle)),u("div",{class:v.settingsFormGroup},u("label",{for:t},p.changeCoordinateDisplay),u("select",{"aria-label":p.selectFormat,class:v.esriSelect,bind:this,onchange:this._setSettingsFormat,title:p.selectFormat},a),u("div",{class:v.settingsFormGroupHorizontal},u("input",{"aria-controls":i,bind:this,class:this.classes(v.patternInput,v.input),id:t,oninput:this._updateCurrentPattern,spellcheck:!1,title:p.changeCoordinateDisplay,type:"text",value:l}),u("div",{"aria-controls":t,bind:this,class:v.widgetButton,onclick:this._setDefaultPattern,onkeydown:this._setDefaultPattern,role:"button",tabindex:"0",title:p.defaultPattern},u("span",{"aria-hidden":"true",class:v.refresh})))),u("div",{class:v.settingsFormGroup},u("label",null,c.preview,u("div",{class:v.previewCoordinate,id:i,tabindex:"0"},this._previewConversion?.displayCoordinate)))):u("div",null)}_renderBackIcon(){return u("span",{"aria-hidden":"true",class:_(this.container)?v.rightArrow:v.leftArrow})}_renderTools(e,t,o){const i=t.displayCoordinate&&"capture"===this.mode?this._renderCopyButton(t):null,{messages:s}=this;return s?u("ul",{class:v.toolDisplay,role:"listitem"},i,u("li",{"aria-controls":o,"aria-label":s.removeConversion,bind:this,class:this.classes(v.widgetButton,v.rowButton),"data-index":e,key:`${o}__${v.widgetButton}`,onclick:this._removeConversion,onkeydown:this._removeConversion,tabindex:"0",role:"button",title:s.removeConversion},u("span",{"aria-hidden":"true",class:v.removeConversion}))):u("ul",null)}_copyCoordinateOutput(e){const t=e.target;if(!("createTextRange"in document.body)){const e=window.getSelection(),o=document.createRange();o.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(o)}document.execCommand("copy")}_removeConversion(e){const t=y(e.currentTarget);null!=t&&this.conversions.removeAt(t)}_setDefaultPattern(e){e.stopPropagation();const t=this._findSettingsFormat();t&&(t.currentPattern=t.get("defaultPattern"))}_toggleExpand(){this._expanded=!this._expanded}_toggleInputVisibility(){this._inputVisible=!this._inputVisible,this._popupVisible&&this._hidePopup(),this._inputVisible?this.viewModel.pause():this.viewModel.resume()}_toggleMode(){this.mode="live"===this.mode?"capture":"live"}_toggleSettingsVisibility(){this._settingsVisible=!this._settingsVisible,this._popupVisible&&this._hidePopup(),this._settingsVisible?(this._setPreviewConversion(),this.viewModel.pause()):this.viewModel.resume()}};function y(e){return e["data-index"]}function C(e){return e["data-format"]}function f(e){return e["data-conversion"]}e([i()],w.prototype,"conversions",null),e([i()],w.prototype,"currentLocation",null),e([i()],w.prototype,"formats",null),e([i()],w.prototype,"goToOverride",null),e([i()],w.prototype,"headingLevel",void 0),e([i()],w.prototype,"label",null),e([i(),c("esri/widgets/CoordinateConversion/t9n/CoordinateConversion")],w.prototype,"messages",void 0),e([i(),c("esri/t9n/common")],w.prototype,"messagesCommon",void 0),e([i()],w.prototype,"mode",null),e([i()],w.prototype,"orientation",void 0),e([i()],w.prototype,"multipleConversions",null),e([i()],w.prototype,"locationSymbol",null),e([i()],w.prototype,"storageEnabled",null),e([i()],w.prototype,"storageType",null),e([i()],w.prototype,"view",null),e([i({type:a})],w.prototype,"viewModel",void 0),e([i()],w.prototype,"visibleElements",void 0),e([s("visibleElements")],w.prototype,"castVisibleElements",null),e([p()],w.prototype,"_copyCoordinateOutput",null),e([p()],w.prototype,"_removeConversion",null),e([p()],w.prototype,"_setDefaultPattern",null),e([p()],w.prototype,"_toggleExpand",null),e([p()],w.prototype,"_toggleInputVisibility",null),e([p()],w.prototype,"_toggleMode",null),e([p()],w.prototype,"_toggleSettingsVisibility",null),w=e([n("esri.widgets.CoordinateConversion")],w);const x=w;export{x 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecated as r}from"../../core/deprecate.js";import i from"../../core/Error.js";import s from"../../core/Evented.js";import{HandleOwnerMixin as o}from"../../core/HandleOwner.js";import n from"../../core/Logger.js";import{abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as d}from"../../core/promiseUtils.js";import{watch as p,on as c,when as u,whenOnce as h,initial as w}from"../../core/reactiveUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../layers/GraphicsLayer.js";import{getOwningPortalUrl as k,getEffectiveLayerCapabilities as g}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as v}from"../../portal/support/urlUtils.js";import b from"../Attachments/AttachmentsViewModel.js";import W from"./CreateFeaturesWorkflow.js";import _ from"./CreateWorkflow.js";import{workflowDeprecation as F}from"./deprecationUtils.js";import C from"./UpdateWorkflow.js";import{whenEditorLayerView as E}from"./workflowUtils.js";import{formTemplateHasInvalidFields as I}from"../FeatureForm/featureFormUtils.js";import U from"../FeatureForm/FeatureFormViewModel.js";import A from"../FeatureTemplates/FeatureTemplatesViewModel.js";import O from"../Sketch/SketchViewModel.js";import V from"../Spinner/SpinnerViewModel.js";const M="esri.widgets.Editor.EditorViewModel",j=n.getLogger(M),T=["create","create-features","update"];function S(t,e,a){j.error(new i(t,e,a))}function L(t,e){return t?t.find((t=>t.layer===e)):void 0}let P=class extends(o(s.EventedAccessor)){constructor(t){super(t),this._editableItems=new a,this._sketchGraphicsLayer=new y({listMode:"hide",internal:!0}),this._unsupportedFieldTypes=["date-only","time-only","timestamp-offset"],this._updateEditableItemsTask=null,this.activeWorkflow=null,this._activityQueue=[],this.failures=[],this.attachmentsViewModel=new b({capabilities:{editing:!0}}),this.featureFormViewModel=new U,this.featureTemplatesViewModel=new A,this.sketchViewModel=new O({layer:this._sketchGraphicsLayer}),this.spinnerViewModel=new V,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.useDeprecatedCreateWorkflow=!1,this.back=async()=>{const t=this.activeWorkflow;t&&this.canGoBack&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelWorkflow({force:!0})))},this.saveAndResetWorkflow=async()=>{const{featureFormViewModel:t}=this;if(t.submit(),!t.submittable)return;const e=t.getValues();if(t.validateContingencyConstraints(e,{includeIncompleteViolations:!0}).length>0)return;const{activeWorkflow:a}=this;await(a?.commit()),a?.reset()},this.selectFeature=(t,e=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.edits.feature=t,e&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([p((()=>{const t=this.view?.map?.editableLayers.filter((({parent:t,visible:e})=>t&&"visible"in t?e&&t.visible:e)),e=this.view?.allLayerViews,a=e?.filter((e=>!!t?.includes(e.layer)&&!e.suspended));return[t,a,this.layerInfos,this.allowedWorkflows]}),(()=>this._updateEditableItems()),w),c((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),c((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),u((()=>this.view?.map),(t=>t.add(this._sketchGraphicsLayer)),w),p((()=>this._editableItems.toArray()),(()=>{const{activeWorkflow:t}=this;if(this.refreshCreationTemplates(),!t)return;const{stepId:e}=t;"create"!==t.type?"update"===t.type&&("awaiting-feature-to-update"===e&&!this.canUpdate||"awaiting-update-feature-candidate"===e&&!t.data.candidates.some((t=>{const e=this._editableItems.find((e=>e.layer===t.layer));return e&&e.supports.includes("update")})))&&this._cancelWorkflow():"awaiting-feature-creation-info"!==e||this.canCreate||this._cancelWorkflow()})),p((()=>this.page),((t,e)=>{const a=this.pageStack.slice(),r=a.indexOf(t);-1===r&&e?a.push(e):a.splice(r),this.pageStack=a})),u((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),c((()=>this.featureTemplatesViewModel),"select",(async({item:t,oldItem:e})=>{const{activeWorkflow:a}=this,r=!!t&&t.id===e?.id,i="create-features"===a?.type&&a.data.upload?.error;if(a)try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return this.featureTemplatesViewModel.select(e,{emit:!1})}if(!t||r&&!i)return;const s={layer:t.layer,template:t.template};if(t.supportsUpload)return this.startCreateFeaturesWorkflow(s);this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(s):this.startCreateFeaturesWorkflowAtFeatureCreation(s)})),c((()=>this.view),"key-down",(t=>{"Escape"===t.key&&this.activeWorkflow?.keyboardCancellationEnabled&&this.back()}))])}destroy(){this._cancelWorkflow().then((()=>{this.view?.map&&this.view.map.remove(this._sketchGraphicsLayer),this.view=null})),this._updateEditableItemsTask=l(this._updateEditableItemsTask)}get allowedWorkflows(){return this._get("allowedWorkflows")}set allowedWorkflows(t){t&&0!==t.length||(t=[...T]),this._set("allowedWorkflows",t)}get canCreate(){return this._editableItems.some((t=>t.supports.includes("create")))}get canUpdate(){return this._editableItems.some((({attachmentsOnUpdateEnabled:t,layer:e,supports:a})=>{const r=a.includes("update")||a.includes("delete")||t,i=e.parent,s=!(i&&"visible"in i)||!!i.visible;return e.visible&&s&&r}))}get editableItems(){return this._editableItems}get labelOptions(){return this.sketchViewModel.labelOptions}set labelOptions(t){this.sketchViewModel.labelOptions=t}set layerInfos(t){t?.some((t=>("allowAttachments"in t&&r(j,"Property: layerInfo.allowAttachments",{replacement:"layerInfo.attachmentsOnCreateEnabled or layerInfo.attachmentsOnUpdateEnabled",version:"4.26"}),!0))),this._set("layerInfos",t)}get snappingOptions(){return this.sketchViewModel.snappingOptions}set snappingOptions(t){this.sketchViewModel.snappingOptions=t}get state(){if(!this.get("view.ready")||0===this._editableItems.length)return"disabled";const t=this.attachmentsViewModel.mode;if("add"===t)return"adding-attachment";if("edit"===t)return"editing-attachment";const{activeWorkflow:e}=this;return e?e.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this.updatingHandles.updating}get tooltipOptions(){return this.sketchViewModel.tooltipOptions}set tooltipOptions(t){this.sketchViewModel.tooltipOptions=t}set view(t){this.sketchViewModel.view=t,this.spinnerViewModel.view=t,this._set("view",t)}get page(){const{activeWorkflow:t,state:e}=this;return"awaiting-feature-to-update"===e||"awaiting-feature-to-create"===e||"create-features"===t?.type&&0===t.numPendingFeatures?"ready":e??"disabled"}get selectedTemplateItem(){const{activeWorkflow:t}=this;if("create-features"===t?.type&&0===t.numPendingFeatures){const e=t.data.creationInfo?.template;if(!e)return;for(const t of this.featureTemplatesViewModel.items)if("findByTemplate"in t){const a=t.findByTemplate(e);if(a)return a}else if(t.template===e)return t}}get featureFormDisabled(){const{activeWorkflow:t}=this;return"update"===t?.type&&!1===t?.data.editableItem?.attributeUpdatesEnabled}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:t}=this;return!!t&&"update"===t.type&&t.data.editableItem.supports.includes("delete")}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}async startCreateWorkflowAtFeatureTypeSelection(){if(F(j,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),await h((()=>!this.updating)),!this.canCreate)return void S("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createCreateWorkflow();await t.start(),this._set("activeWorkflow",t)}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateWorkflowAtFeatureCreation(t){if(F(j,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),await h((()=>!this.updating)),!this.canCreate)return void S("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow("awaiting-feature-to-create");e.data.creationInfo=t,await e.start(),this._set("activeWorkflow",e)}async startCreateFeaturesWorkflowAtFeatureCreation(t){return this.startCreateFeaturesWorkflow(t,"creating-features")}async startCreateFeaturesWorkflow(t,e="awaiting-feature-creation-info"){if(await h((()=>!this.updating)),!this.canCreate)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(t,e);await a.start(),this._set("activeWorkflow",a)}async startCreateWorkflowAtFeatureEdit(t){if(F(j,"startCreateWorkflowAtFeatureEdit"),await h((()=>!this.updating)),!this.canCreate)return void S("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow("editing-new-feature");e.data.edits.feature=t,await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtFeatureSelection(){if(await h((()=>!this.updating)),!this.canUpdate)return void S("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createUpdateWorkflow();await t.start(),this._set("activeWorkflow",t)}async startUpdateWorkflowAtMultipleFeatureSelection(t){if(await h((()=>!this.updating)),!this.canUpdate)return void S("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow("awaiting-update-feature-candidate");e.data.candidates=t,await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtFeatureEdit(t){if(await h((()=>!this.updating)),!this.canUpdate)return void S("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature");e.data.edits.feature=t,await e.start(),this._set("activeWorkflow",e)}async deleteFeatureFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteFeature((async(t,e)=>this._applyEdits(t,e))):S("editing:unsupported-workflow","Deleting requires an active update workflow.")}async cancelWorkflow(t){return this._cancelWorkflow({warn:!0,...t})}findEditableItemForLayer(t){const e="subtype-sublayer"===t.type?t.parent:t;return this._editableItems.find((t=>t.layer===e))}itemHasInvalidFormTemplate(t){return!!t&&(this.findEditableItemForLayer(t.layer)?.hasInvalidFormTemplate??!1)}itemHasUnsupportedFields(t){return!!t&&(this.findEditableItemForLayer(t.layer)?.hasUnsupportedFields??!1)}refreshCreationTemplates(){const t=[];for(const{layer:e,supports:a}of this._editableItems)e.loaded&&a.includes("create")&&t.push(e);this.featureTemplatesViewModel.layers=t}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!1}):await this.startUpdateWorkflowAtFeatureSelection()))}async _updateEditableItems(){l(this._updateEditableItemsTask);const t=e((async t=>{const e=this.view?.allLayerViews,r=this.view?.map?.editableLayers;if(!e||!r)return;const i=new Set(r),s=r?.filter((t=>{const e=g(t)?.operations;return!(!t.visible||!e?.supportsAdd||e?.supportsQuery)})),o=e.filter((t=>i.has(t.layer))),n=[];for(const{layer:a,suspended:p}of o.reverse())if("subtype-group"===a.type){await a.loadAll(),d(t);for(let t=a.sublayers.length-1;t>=0;--t)n.push(this._makeEditableItemForLayer(a.sublayers.at(t),p))}else n.push(this._makeEditableItemForLayer(a,p));for(const a of s.reverse())if("subtype-group"===a.type){await a.loadAll(),d(t);for(const t of a.sublayers)n.push(this._makeEditableItemForLayer(t,!1))}else n.push(this._makeEditableItemForLayer(a,!1));if(t.aborted)return;const l=this._editableItems;this._editableItems=new a(n),l.destroy()}));this.updatingHandles.addPromise(t.promise),this._updateEditableItemsTask=t}async _cancelWorkflow(t){const e=this.activeWorkflow;if(!e)return void(t&&t.warn&&S("editing:no-active-workflow","There is no active workflow to cancel."));if(!t||!1!==t.force)return this.emit("workflow-cancel"),this._set("activeWorkflow",null),void await e.cancel(t);await e.cancel(t),this._set("activeWorkflow",null)}_createCreateFeaturesWorkflow(t,e){return W.create(this,t,e,((t,e,a)=>this._applyEdits(t,e,a)),((t,e)=>this._addAttachments(t,e)))}_createCreateWorkflow(t){return _.create(this,t,((t,e,a)=>this._applyEdits(t,e,a)))}_createUpdateWorkflow(t){return C.create(this,t,((t,e)=>this._applyEdits(t,e)))}_addAttachments(t,e){const a=e.map((e=>this._addAttachment(t,e.feature,e.attachment)))??[];return Promise.all(a)}async _addAttachment(t,e,a){let r=null;if("geojson"===t.type||"scene"===t.type||"oriented-imagery"===t.type)throw new i("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(r=await(t.addAttachment?.(e,a).catch((t=>{throw t?.error||t})))??null,r))),r}async _applyEdits(t,e,a){let r=null;const i=t.url?await k(t.url):null,s={returnServiceEditsOption:(!i||!v(i))&&!RegExp("/hosted/","i").test(t.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{if(g(t)?.operations.supportsQuery){const a=await E(this.view,t);return r=await t.applyEdits(e,s),await h((()=>!a.updating)),r}return r=await t.applyEdits(e,s),r})),r}_queueOperation(t){this._activityQueue.push(t),this.notifyChange("syncing");const e=(t,e)=>{const a=e.indexOf(t);a>-1&&e.splice(a,1)};return t().then((t=>{if("error"in t&&t.error)throw t.error;if("addFeatureResults"in t){const{addFeatureResults:e,deleteFeatureResults:a,updateFeatureResults:r}=t,i=e.find((t=>!!t.error))||r.find((t=>!!t.error))||a.find((t=>!!t.error));if(i)throw i.error}return t})).catch((a=>{S("editing:operation-error","An error occurred.",{error:a});const r={error:a,retry:()=>(e(r,this.failures),this._queueOperation(t)),cancel:()=>{e(r,this.failures)}};this._set("failures",[...this.failures,r])})).then((()=>{e(t,this._activityQueue),this.notifyChange("syncing")}))}_makeEditableItemForLayer(t,e=!0){const a=g(t),r=a?.operations,i=L(this.layerInfos,t),s=I(t),o=t.fields.some((({type:t})=>this._unsupportedFieldTypes.includes(t))),n=s||o,{allowedWorkflows:l}=this,d=l.includes("create")||l.includes("create-features"),p=l.includes("update"),c=t=>!i||!1!==i.enabled&&!1!==i[t],u=d&&!!r?.supportsAdd&&c("addEnabled"),h=p&&!!r?.supportsUpdate&&c("updateEnabled"),w=!n&&p&&!!r?.supportsDelete&&c("deleteEnabled"),f=[];e||(u&&f.push("create"),h&&f.push("update"),w&&f.push("delete"));const m=h&&!n&&(!i||!1!==i.attributeUpdatesEnabled),y=h&&!n&&!!a?.editing?.supportsGeometryUpdate&&(!i||!1!==i.geometryUpdatesEnabled),k=!(!a?.data?.supportsAttachment||i&&!1===i.allowAttachments);return{layer:t,supports:f,attributeUpdatesEnabled:m,geometryUpdatesEnabled:y,hasAttachments:k,attachmentsOnCreateEnabled:k&&d&&(!i||!1!==i.attachmentsOnCreateEnabled),attachmentsOnUpdateEnabled:!n&&k&&(!i||!1!==i.attachmentsOnUpdateEnabled),hasInvalidFormTemplate:s,hasUnsupportedFields:o}}};t([f()],P.prototype,"_editableItems",void 0),t([f({readOnly:!0})],P.prototype,"activeWorkflow",void 0),t([f({readOnly:!0})],P.prototype,"_activityQueue",void 0),t([f({value:[...T]})],P.prototype,"allowedWorkflows",null),t([f({readOnly:!0})],P.prototype,"canCreate",null),t([f({readOnly:!0})],P.prototype,"canUpdate",null),t([f()],P.prototype,"editableItems",null),t([f({readOnly:!0})],P.prototype,"failures",void 0),t([f()],P.prototype,"attachmentsViewModel",void 0),t([f()],P.prototype,"featureFormViewModel",void 0),t([f()],P.prototype,"featureTemplatesViewModel",void 0),t([f()],P.prototype,"labelOptions",null),t([f()],P.prototype,"layerInfos",null),t([f()],P.prototype,"sketchViewModel",void 0),t([f()],P.prototype,"snappingOptions",null),t([f()],P.prototype,"spinnerViewModel",void 0),t([f()],P.prototype,"state",null),t([f({readOnly:!0})],P.prototype,"syncing",null),t([f()],P.prototype,"updating",null),t([f()],P.prototype,"tooltipOptions",null),t([f()],P.prototype,"view",null),t([f()],P.prototype,"pageStack",void 0),t([f()],P.prototype,"showDiscardEditsPrompt",void 0),t([f()],P.prototype,"_candidateCommitted",void 0),t([f()],P.prototype,"page",null),t([f()],P.prototype,"selectedTemplateItem",null),t([f()],P.prototype,"featureFormDisabled",null),t([f()],P.prototype,"canGoBack",null),t([f()],P.prototype,"shouldShowDeleteButton",null),t([f()],P.prototype,"hasPendingEdits",null),t([f()],P.prototype,"useDeprecatedCreateWorkflow",void 0),P=t([m(M)],P);const D=P;export{D as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecated as r}from"../../core/deprecate.js";import i from"../../core/Error.js";import s from"../../core/Evented.js";import{HandleOwnerMixin as o}from"../../core/HandleOwner.js";import n from"../../core/Logger.js";import{abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as d}from"../../core/promiseUtils.js";import{watch as p,on as c,when as u,whenOnce as h,initial as w}from"../../core/reactiveUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../layers/GraphicsLayer.js";import{getOwningPortalUrl as k,getEffectiveLayerCapabilities as g}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as v}from"../../portal/support/urlUtils.js";import b from"../Attachments/AttachmentsViewModel.js";import W from"./CreateFeaturesWorkflow.js";import _ from"./CreateWorkflow.js";import{workflowDeprecation as F}from"./deprecationUtils.js";import C from"./UpdateWorkflow.js";import{whenEditorLayerView as E}from"./workflowUtils.js";import{formTemplateHasInvalidFields as I,unsupportedDateFieldTypes as U}from"../FeatureForm/featureFormUtils.js";import A from"../FeatureForm/FeatureFormViewModel.js";import O from"../FeatureTemplates/FeatureTemplatesViewModel.js";import V from"../Sketch/SketchViewModel.js";import M from"../Spinner/SpinnerViewModel.js";const j="esri.widgets.Editor.EditorViewModel",T=n.getLogger(j),S=["create","create-features","update"];function L(t,e,a){T.error(new i(t,e,a))}function P(t,e){return t?t.find((t=>t.layer===e)):void 0}let D=class extends(o(s.EventedAccessor)){constructor(t){super(t),this._editableItems=new a,this._sketchGraphicsLayer=new y({listMode:"hide",internal:!0}),this._updateEditableItemsTask=null,this.activeWorkflow=null,this._activityQueue=[],this.failures=[],this.attachmentsViewModel=new b({capabilities:{editing:!0}}),this.featureFormViewModel=new A,this.featureTemplatesViewModel=new O,this.sketchViewModel=new V({layer:this._sketchGraphicsLayer}),this.spinnerViewModel=new M,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.useDeprecatedCreateWorkflow=!1,this.back=async()=>{const t=this.activeWorkflow;t&&this.canGoBack&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelWorkflow({force:!0})))},this.saveAndResetWorkflow=async()=>{const{featureFormViewModel:t}=this;if(t.submit(),!t.submittable)return;const e=t.getValues();if(t.validateContingencyConstraints(e,{includeIncompleteViolations:!0}).length>0)return;const{activeWorkflow:a}=this;await(a?.commit()),a?.reset()},this.selectFeature=(t,e=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.edits.feature=t,e&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([p((()=>{const t=this.view?.map?.editableLayers.filter((({parent:t,visible:e})=>t&&"visible"in t?e&&t.visible:e)),e=this.view?.allLayerViews,a=e?.filter((e=>!!t?.includes(e.layer)&&!e.suspended));return[t,a,this.layerInfos,this.allowedWorkflows]}),(()=>this._updateEditableItems()),w),c((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),c((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),u((()=>this.view?.map),(t=>t.add(this._sketchGraphicsLayer)),w),p((()=>this._editableItems.toArray()),(()=>{const{activeWorkflow:t}=this;if(this.refreshCreationTemplates(),!t)return;const{stepId:e}=t;"create"!==t.type?"update"===t.type&&("awaiting-feature-to-update"===e&&!this.canUpdate||"awaiting-update-feature-candidate"===e&&!t.data.candidates.some((t=>{const e=this._editableItems.find((e=>e.layer===t.layer));return e&&e.supports.includes("update")})))&&this._cancelWorkflow():"awaiting-feature-creation-info"!==e||this.canCreate||this._cancelWorkflow()})),p((()=>this.page),((t,e)=>{const a=this.pageStack.slice(),r=a.indexOf(t);-1===r&&e?a.push(e):a.splice(r),this.pageStack=a})),u((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),c((()=>this.featureTemplatesViewModel),"select",(async({item:t,oldItem:e})=>{const{activeWorkflow:a}=this,r=!!t&&t.id===e?.id,i="create-features"===a?.type&&a.data.upload?.error;if(a)try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return this.featureTemplatesViewModel.select(e,{emit:!1})}if(!t||r&&!i)return;const s={layer:t.layer,template:t.template};if(t.supportsUpload)return this.startCreateFeaturesWorkflow(s);this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(s):this.startCreateFeaturesWorkflowAtFeatureCreation(s)})),c((()=>this.view),"key-down",(t=>{"Escape"===t.key&&this.activeWorkflow?.keyboardCancellationEnabled&&this.back()}))])}destroy(){this._cancelWorkflow().then((()=>{this.view?.map&&this.view.map.remove(this._sketchGraphicsLayer),this.view=null})),this._updateEditableItemsTask=l(this._updateEditableItemsTask)}get allowedWorkflows(){return this._get("allowedWorkflows")}set allowedWorkflows(t){t&&0!==t.length||(t=[...S]),this._set("allowedWorkflows",t)}get canCreate(){return this._editableItems.some((t=>t.supports.includes("create")))}get canUpdate(){return this._editableItems.some((({attachmentsOnUpdateEnabled:t,layer:e,supports:a})=>{const r=a.includes("update")||a.includes("delete")||t,i=e.parent,s=!(i&&"visible"in i)||!!i.visible;return e.visible&&s&&r}))}get editableItems(){return this._editableItems}get labelOptions(){return this.sketchViewModel.labelOptions}set labelOptions(t){this.sketchViewModel.labelOptions=t}set layerInfos(t){t?.some((t=>("allowAttachments"in t&&r(T,"Property: layerInfo.allowAttachments",{replacement:"layerInfo.attachmentsOnCreateEnabled or layerInfo.attachmentsOnUpdateEnabled",version:"4.26"}),!0))),this._set("layerInfos",t)}get snappingOptions(){return this.sketchViewModel.snappingOptions}set snappingOptions(t){this.sketchViewModel.snappingOptions=t}get state(){if(!this.get("view.ready")||0===this._editableItems.length)return"disabled";const t=this.attachmentsViewModel.mode;if("add"===t)return"adding-attachment";if("edit"===t)return"editing-attachment";const{activeWorkflow:e}=this;return e?e.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this.updatingHandles.updating}get tooltipOptions(){return this.sketchViewModel.tooltipOptions}set tooltipOptions(t){this.sketchViewModel.tooltipOptions=t}set view(t){this.sketchViewModel.view=t,this.spinnerViewModel.view=t,this._set("view",t)}get page(){const{activeWorkflow:t,state:e}=this;return"awaiting-feature-to-update"===e||"awaiting-feature-to-create"===e||"create-features"===t?.type&&0===t.numPendingFeatures?"ready":e??"disabled"}get selectedTemplateItem(){const{activeWorkflow:t}=this;if("create-features"===t?.type&&0===t.numPendingFeatures){const e=t.data.creationInfo?.template;if(!e)return;for(const t of this.featureTemplatesViewModel.items)if("findByTemplate"in t){const a=t.findByTemplate(e);if(a)return a}else if(t.template===e)return t}}get featureFormDisabled(){const{activeWorkflow:t}=this;return"update"===t?.type&&!1===t?.data.editableItem?.attributeUpdatesEnabled}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:t}=this;return!!t&&"update"===t.type&&t.data.editableItem.supports.includes("delete")}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}async startCreateWorkflowAtFeatureTypeSelection(){if(F(T,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),await h((()=>!this.updating)),!this.canCreate)return void L("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createCreateWorkflow();await t.start(),this._set("activeWorkflow",t)}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateWorkflowAtFeatureCreation(t){if(F(T,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),await h((()=>!this.updating)),!this.canCreate)return void L("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow("awaiting-feature-to-create");e.data.creationInfo=t,await e.start(),this._set("activeWorkflow",e)}async startCreateFeaturesWorkflowAtFeatureCreation(t){return this.startCreateFeaturesWorkflow(t,"creating-features")}async startCreateFeaturesWorkflow(t,e="awaiting-feature-creation-info"){if(await h((()=>!this.updating)),!this.canCreate)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(t,e);await a.start(),this._set("activeWorkflow",a)}async startCreateWorkflowAtFeatureEdit(t){if(F(T,"startCreateWorkflowAtFeatureEdit"),await h((()=>!this.updating)),!this.canCreate)return void L("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow("editing-new-feature");e.data.edits.feature=t,await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtFeatureSelection(){if(await h((()=>!this.updating)),!this.canUpdate)return void L("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createUpdateWorkflow();await t.start(),this._set("activeWorkflow",t)}async startUpdateWorkflowAtMultipleFeatureSelection(t){if(await h((()=>!this.updating)),!this.canUpdate)return void L("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow("awaiting-update-feature-candidate");e.data.candidates=t,await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtFeatureEdit(t){if(await h((()=>!this.updating)),!this.canUpdate)return void L("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature");e.data.edits.feature=t,await e.start(),this._set("activeWorkflow",e)}async deleteFeatureFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteFeature((async(t,e)=>this._applyEdits(t,e))):L("editing:unsupported-workflow","Deleting requires an active update workflow.")}async cancelWorkflow(t){return this._cancelWorkflow({warn:!0,...t})}findEditableItemForLayer(t){const e="subtype-sublayer"===t.type?t.parent:t;return this._editableItems.find((t=>t.layer===e))}itemHasInvalidFormTemplate(t){return!!t&&(this.findEditableItemForLayer(t.layer)?.hasInvalidFormTemplate??!1)}itemHasUnsupportedFields(t){return!!t&&(this.findEditableItemForLayer(t.layer)?.hasUnsupportedFields??!1)}refreshCreationTemplates(){const t=[];for(const{layer:e,supports:a}of this._editableItems)e.loaded&&a.includes("create")&&t.push(e);this.featureTemplatesViewModel.layers=t}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!1}):await this.startUpdateWorkflowAtFeatureSelection()))}async _updateEditableItems(){l(this._updateEditableItemsTask);const t=e((async t=>{const e=this.view?.allLayerViews,r=this.view?.map?.editableLayers;if(!e||!r)return;const i=new Set(r),s=r?.filter((t=>{const e=g(t)?.operations;return!(!t.visible||!e?.supportsAdd||e?.supportsQuery)})),o=e.filter((t=>i.has(t.layer))),n=[];for(const{layer:a,suspended:p}of o.reverse())if("subtype-group"===a.type){await a.loadAll(),d(t);for(let t=a.sublayers.length-1;t>=0;--t)n.push(this._makeEditableItemForLayer(a.sublayers.at(t),p))}else n.push(this._makeEditableItemForLayer(a,p));for(const a of s.reverse())if("subtype-group"===a.type){await a.loadAll(),d(t);for(const t of a.sublayers)n.push(this._makeEditableItemForLayer(t,!1))}else n.push(this._makeEditableItemForLayer(a,!1));if(t.aborted)return;const l=this._editableItems;this._editableItems=new a(n),l.destroy()}));this.updatingHandles.addPromise(t.promise),this._updateEditableItemsTask=t}async _cancelWorkflow(t){const e=this.activeWorkflow;if(!e)return void(t&&t.warn&&L("editing:no-active-workflow","There is no active workflow to cancel."));if(!t||!1!==t.force)return this.emit("workflow-cancel"),this._set("activeWorkflow",null),void await e.cancel(t);await e.cancel(t),this._set("activeWorkflow",null)}_createCreateFeaturesWorkflow(t,e){return W.create(this,t,e,((t,e,a)=>this._applyEdits(t,e,a)),((t,e)=>this._addAttachments(t,e)))}_createCreateWorkflow(t){return _.create(this,t,((t,e,a)=>this._applyEdits(t,e,a)))}_createUpdateWorkflow(t){return C.create(this,t,((t,e)=>this._applyEdits(t,e)))}_addAttachments(t,e){const a=e.map((e=>this._addAttachment(t,e.feature,e.attachment)))??[];return Promise.all(a)}async _addAttachment(t,e,a){let r=null;if("geojson"===t.type||"scene"===t.type||"oriented-imagery"===t.type)throw new i("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(r=await(t.addAttachment?.(e,a).catch((t=>{throw t?.error||t})))??null,r))),r}async _applyEdits(t,e,a){let r=null;const i=t.url?await k(t.url):null,s={returnServiceEditsOption:(!i||!v(i))&&!RegExp("/hosted/","i").test(t.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{if(g(t)?.operations.supportsQuery){const a=await E(this.view,t);return r=await t.applyEdits(e,s),await h((()=>!a.updating)),r}return r=await t.applyEdits(e,s),r})),r}_queueOperation(t){this._activityQueue.push(t),this.notifyChange("syncing");const e=(t,e)=>{const a=e.indexOf(t);a>-1&&e.splice(a,1)};return t().then((t=>{if("error"in t&&t.error)throw t.error;if("addFeatureResults"in t){const{addFeatureResults:e,deleteFeatureResults:a,updateFeatureResults:r}=t,i=e.find((t=>!!t.error))||r.find((t=>!!t.error))||a.find((t=>!!t.error));if(i)throw i.error}return t})).catch((a=>{L("editing:operation-error","An error occurred.",{error:a});const r={error:a,retry:()=>(e(r,this.failures),this._queueOperation(t)),cancel:()=>{e(r,this.failures)}};this._set("failures",[...this.failures,r])})).then((()=>{e(t,this._activityQueue),this.notifyChange("syncing")}))}_makeEditableItemForLayer(t,e=!0){const a=g(t),r=a?.operations,i=P(this.layerInfos,t),s=I(t),o=t.fields.some((({type:t})=>U.has(t))),n=s||o,{allowedWorkflows:l}=this,d=l.includes("create")||l.includes("create-features"),p=l.includes("update"),c=t=>!i||!1!==i.enabled&&!1!==i[t],u=d&&!!r?.supportsAdd&&c("addEnabled"),h=p&&!!r?.supportsUpdate&&c("updateEnabled"),w=!n&&p&&!!r?.supportsDelete&&c("deleteEnabled"),f=[];e||(u&&f.push("create"),h&&f.push("update"),w&&f.push("delete"));const m=h&&!n&&(!i||!1!==i.attributeUpdatesEnabled),y=h&&!n&&!!a?.editing?.supportsGeometryUpdate&&(!i||!1!==i.geometryUpdatesEnabled),k=!(!a?.data?.supportsAttachment||i&&!1===i.allowAttachments);return{layer:t,supports:f,attributeUpdatesEnabled:m,geometryUpdatesEnabled:y,hasAttachments:k,attachmentsOnCreateEnabled:k&&d&&(!i||!1!==i.attachmentsOnCreateEnabled),attachmentsOnUpdateEnabled:!n&&k&&(!i||!1!==i.attachmentsOnUpdateEnabled),hasInvalidFormTemplate:s,hasUnsupportedFields:o}}};t([f()],D.prototype,"_editableItems",void 0),t([f({readOnly:!0})],D.prototype,"activeWorkflow",void 0),t([f({readOnly:!0})],D.prototype,"_activityQueue",void 0),t([f({value:[...S]})],D.prototype,"allowedWorkflows",null),t([f({readOnly:!0})],D.prototype,"canCreate",null),t([f({readOnly:!0})],D.prototype,"canUpdate",null),t([f()],D.prototype,"editableItems",null),t([f({readOnly:!0})],D.prototype,"failures",void 0),t([f()],D.prototype,"attachmentsViewModel",void 0),t([f()],D.prototype,"featureFormViewModel",void 0),t([f()],D.prototype,"featureTemplatesViewModel",void 0),t([f()],D.prototype,"labelOptions",null),t([f()],D.prototype,"layerInfos",null),t([f()],D.prototype,"sketchViewModel",void 0),t([f()],D.prototype,"snappingOptions",null),t([f()],D.prototype,"spinnerViewModel",void 0),t([f()],D.prototype,"state",null),t([f({readOnly:!0})],D.prototype,"syncing",null),t([f()],D.prototype,"updating",null),t([f()],D.prototype,"tooltipOptions",null),t([f()],D.prototype,"view",null),t([f()],D.prototype,"pageStack",void 0),t([f()],D.prototype,"showDiscardEditsPrompt",void 0),t([f()],D.prototype,"_candidateCommitted",void 0),t([f()],D.prototype,"page",null),t([f()],D.prototype,"selectedTemplateItem",null),t([f()],D.prototype,"featureFormDisabled",null),t([f()],D.prototype,"canGoBack",null),t([f()],D.prototype,"shouldShowDeleteButton",null),t([f()],D.prototype,"hasPendingEdits",null),t([f()],D.prototype,"useDeprecatedCreateWorkflow",void 0),D=t([m(j)],D);const G=D;export{G 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{HandleOwnerMixin as r}from"../../core/HandleOwner.js";import{property as s}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";function o(t){return null==t?null:JSON.stringify(t)}let n=class extends(r(e)){constructor(t){super(t),this._baselineAttributesJSON=null,this._baselineGeometryJSON=null,this._stagedForDelete=!1,this.feature=null}get attributesModified(){const t=this.feature?.attributes;return null!=t&&this._baselineAttributesJSON!==this._stringifyAttributes(t)}get geometryModified(){const t=this.feature?.geometry;return null!=t&&this._baselineGeometryJSON!==this._stringifyGeometry(t)}get stagedForDelete(){return this._stagedForDelete}get modified(){return this.attributesModified||this.geometryModified||this._stagedForDelete}stageDelete(){this._stagedForDelete=!0}unstageDelete(){this._stagedForDelete=!1}trackChanges(){const{feature:t}=this;if(!t)return;const{attributes:e,geometry:r}=t;this._baselineAttributesJSON=this._stringifyAttributes(e),this._baselineGeometryJSON=this._stringifyGeometry(r),this.notifyChange("attributesModified"),this.notifyChange("geometryModified")}updateAttributes(t){const{feature:e}=this;e&&(e.attributes=t,this.notifyChange("attributesModified"))}updateGeometry(t){const{feature:e}=this;e&&(e.geometry=t,this.notifyChange("geometryModified"))}_stringifyAttributes(t){return o(t)}_stringifyGeometry(t){return o("mesh"===t?.type?{transform:t.transform}:t)}};t([s()],n.prototype,"_stagedForDelete",void 0),t([s()],n.prototype,"attributesModified",null),t([s()],n.prototype,"feature",void 0),t([s()],n.prototype,"geometryModified",null),t([s()],n.prototype,"modified",null),n=t([i("esri.widgets.Editor.Edits")],n);export{n as Edits};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{HandleOwnerMixin as r}from"../../core/HandleOwner.js";import{property as s}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";function o(t){return null==t?null:JSON.stringify(t)}let n=class extends(r(e)){constructor(t){super(t),this._baselineAttributesJSON=null,this._baselineGeometryJSON=null,this._stagedForDelete=!1,this.feature=null}get attributesModified(){const t=this.feature?.attributes;return null!=t&&this._baselineAttributesJSON!==this._stringifyAttributes(t)}get geometryModified(){const t=this.feature?.geometry;return null!=t&&this._baselineGeometryJSON!==this._stringifyGeometry(t)}get stagedForDelete(){return this._stagedForDelete}get modified(){return this.attributesModified||this.geometryModified||this._stagedForDelete}stageDelete(){this._stagedForDelete=!0}unstageDelete(){this._stagedForDelete=!1}trackChanges(){const{feature:t}=this;if(!t)return;const{attributes:e,geometry:r}=t;this._baselineAttributesJSON=this._stringifyAttributes(e),this._baselineGeometryJSON=this._stringifyGeometry(r),this.notifyChange("attributesModified"),this.notifyChange("geometryModified")}updateAttributes(t){const{feature:e}=this;e&&(e.attributes=t,this.notifyChange("attributesModified"))}updateGeometry(t){const{feature:e}=this;e&&(e.geometry=t,this.notifyChange("geometryModified"))}_stringifyAttributes(t){return o(t)}_stringifyGeometry(t){return o("mesh"===t?.type?{transform:t.transform,vertexSpace:t.vertexSpace}:t)}};t([s()],n.prototype,"_stagedForDelete",void 0),t([s()],n.prototype,"attributesModified",null),t([s()],n.prototype,"feature",void 0),t([s()],n.prototype,"geometryModified",null),t([s()],n.prototype,"modified",null),n=t([i("esri.widgets.Editor.Edits")],n);export{n as Edits};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{abortMaybe as s}from"../../core/maybe.js";import{isAbortError as n,throwIfAborted as i,createAbortError as a,throwIfNotAbortError as c,createResolver as l}from"../../core/promiseUtils.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 u}from"../../core/accessorSupport/decorators/subclass.js";import m from"../../geometry/Point.js";import{getFilePickerAcceptTypes as f,getSupportedExtensions as d}from"../../layers/support/infoFor3D.js";let h=class extends o{constructor(){super({}),this._uploadTask=null}destroy(){this.cancel()}get state(){const e=this._uploadTask;return e?e.finished?e.error?n(e.error)?"canceled":"error":"success":"pending":"default"}get result(){return this._uploadTask?.value??null}get error(){return this._uploadTask?.error??null}uploadTo(e){this.cancel(),this._uploadTask=r((async o=>{const r=await w(e);if(i(o),0===r.length)throw a();const s=(await import("../../geometry/Mesh.js")).default;i(o);const n=new m({x:0,y:0,z:0,spatialReference:e.spatialReference}),c=await s.createFromFiles(n,r,{layer:e,signal:o});if(i(o),!c)throw new t("editor:upload","could not upload or convert model");if(!c.transform){const e=await(await import("../../geometry/support/MeshTransform.js")).default;i(o),c.transform=new e({geographic:!0})}return c.load()}))}cancel(){this._uploadTask=s(this._uploadTask)}};e([p()],h.prototype,"state",null),e([p()],h.prototype,"result",null),e([p()],h.prototype,"error",null),e([p()],h.prototype,"_uploadTask",void 0),h=e([u("esri.widgets.Editor.Upload")],h);let y=null;async function w(e){return"showOpenFilePicker"in window&&!y?g(e):j(e)}async function g(e){try{const o=await window.showOpenFilePicker({multiple:!0,excludeAcceptAllOption:!0,types:f(e.infoFor3D)});return Promise.all(o.map((e=>e.getFile())))}catch(o){return c(o),[]}}async function j(e){const o=l();let r;const t=document.createElement("input");function s(){return t.files?Array.from(t.files):[]}function n(){i(),o.resolve(s())}function i(){clearTimeout(r),t.removeEventListener("change",n),window.removeEventListener("focus",a)}function a(){r=setTimeout((()=>{const e=s();0===e.length&&(i(),o.resolve(e))}),k)}return t.type="file",t.multiple=!0,t.accept=d(e.infoFor3D).join(","),t.addEventListener("change",n),window.addEventListener("focus",a,{once:!0}),y?y(t):t.click(),o.promise.finally(i)}function T(e){y=o=>{setTimeout((()=>{const r=new DataTransfer;e.forEach((e=>r.items.add(e))),o.files=r.files,o.dispatchEvent(new Event("change"))}))}}function v(){y=null}const k=5e3;export{h as Upload,v as clearPromptForFilesStub,T as simulateSelectingFiles};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{abortMaybe as s}from"../../core/maybe.js";import{isAbortError as n,throwIfAborted as i,createAbortError as c,throwIfNotAbortError as a,createResolver as l}from"../../core/promiseUtils.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 u}from"../../core/accessorSupport/decorators/subclass.js";import m from"../../geometry/Point.js";import{getFilePickerAcceptTypes as d,getSupportedExtensions as f}from"../../layers/support/infoFor3D.js";let h=class extends o{constructor(){super({}),this._uploadTask=null}destroy(){this.cancel()}get state(){const e=this._uploadTask;return e?e.finished?e.error?n(e.error)?"canceled":"error":"success":"pending":"default"}get result(){return this._uploadTask?.value??null}get error(){return this._uploadTask?.error??null}uploadTo(e){this.cancel(),this._uploadTask=r((async o=>{const r=await w(e);if(i(o),0===r.length)throw c();const s=(await import("../../geometry/Mesh.js")).default;i(o);const n=new m({x:0,y:0,z:0,spatialReference:e.spatialReference}),a=await s.createFromFiles(n,r,{layer:e,signal:o});if(i(o),!a)throw new t("editor:upload","could not upload or convert model");return a.load()}))}cancel(){this._uploadTask=s(this._uploadTask)}};e([p()],h.prototype,"state",null),e([p()],h.prototype,"result",null),e([p()],h.prototype,"error",null),e([p()],h.prototype,"_uploadTask",void 0),h=e([u("esri.widgets.Editor.Upload")],h);let y=null;async function w(e){return"showOpenFilePicker"in window&&!y?j(e):g(e)}async function j(e){try{const o=await window.showOpenFilePicker({multiple:!0,excludeAcceptAllOption:!0,types:d(e.infoFor3D)});return Promise.all(o.map((e=>e.getFile())))}catch(o){return a(o),[]}}async function g(e){const o=l();let r;const t=document.createElement("input");function s(){return t.files?Array.from(t.files):[]}function n(){i(),o.resolve(s())}function i(){clearTimeout(r),t.removeEventListener("change",n),window.removeEventListener("focus",c)}function c(){r=setTimeout((()=>{const e=s();0===e.length&&(i(),o.resolve(e))}),k)}return t.type="file",t.multiple=!0,t.accept=f(e.infoFor3D).join(","),t.addEventListener("change",n),window.addEventListener("focus",c,{once:!0}),y?y(t):t.click(),o.promise.finally(i)}function T(e){y=o=>{setTimeout((()=>{const r=new DataTransfer;e.forEach((e=>r.items.add(e))),o.files=r.files,o.dispatchEvent(new Event("change"))}))}}function v(){y=null}const k=5e3;export{h as Upload,v as clearPromptForFilesStub,T as simulateSelectingFiles};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Graphic.js";import{createTask as t}from"../../core/asyncUtils.js";import"../../core/has.js";import{handlesGroup as r,makeHandle as n}from"../../core/handleUtils.js";import{clone as i}from"../../core/lang.js";import{throwIfAborted as a,whenOrAbort as s,eachAlways as o}from"../../core/promiseUtils.js";import{watch as l,whenOnce as c}from"../../core/reactiveUtils.js";import{px2pt as u}from"../../core/screenUtils.js";import{diff as p}from"../../core/accessorSupport/diffUtils.js";import{calculateTolerance as y}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as f}from"../../renderers/support/lengthUtils.js";import{getTransformationType as d,TransformationType as m}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as g,getSize as h}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{sceneLayerEditingEnabled as b,i3sPatchingEnabled as w}from"../../support/featureFlags.js";import{to3D as v}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as S}from"../../symbols/support/symbolUtils.js";import{GraphicState as j}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as I}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as U,filterGraphicHits as V}from"../../views/support/hitTestSelectUtils.js";function F(e){const t=e.sourceLayer;if(!t||"feature"!==t.type||!A(t.renderer))return{rotation:null,size:null};let r=null,n=null;const i=t.renderer.getVisualVariablesForType("rotation").filter((t=>(!t.axis||"heading"===t.axis)&&t.field&&!t.valueExpression&&null!=g(t,e)));1===i.length&&(r=T(i[0],t));const a=t.renderer.getVisualVariablesForType("size").filter((t=>t.field&&!t.useSymbolValue&&!t.valueExpression&&d(t)===m.RealWorldSize&&null!=h(t,e)));return 1===a.length&&(n=L(a[0],t)),{rotation:r,size:n}}function T(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=e.field,i=t.fields&&t.fields.filter((e=>e.name===n)),a=i&&1===i.length?i[0].type:"double",s={initial:0,current:0};return{field:n,fieldType:a,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-r*e,E((s.current+360)%360,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function z(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 x(e,t,r){if(null==t)return 0;const{symbol:n}=v(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const i=n.symbolLayers.at(0);if(!i)return 0;switch(i.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return i.size||Math.min(Y.icon,(await e(i,Y.icon))[0])||Y.icon}case"text":return i.size||Y.text;case"line":return i.size||Y.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return z(await t(i,e.scale/Y.viewScaleSizeFactor),r)}case"path":return(null!=i.width?i.width:i.height)||e.scale/Y.viewScaleSizeFactor;case"extrude":return i.size||e.scale/Y.viewScaleSizeFactor;default:return 0}}function L(e,t){const r=e.field,n=e.axis,i=t.fields&&t.fields.filter((e=>e.name===r)),a=i&&1===i.length?i[0].type:"double",s={updating:!1,initial:0,current:0},o=f[e.valueUnit]??1;let l;return l="area"===e.valueRepresentation?e=>(e*o/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*o/2:e=>e*o,{field:r,fieldType:a,getDefault:async(e,t)=>E(l(await x(t,e,n)),a),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,E(s.current,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,displayUnit:re(e.valueUnit),axis:e.axis}}function E(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 A(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 M(e,t){const r=await S(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t});null!=p(e.symbol,r)&&(e.symbol=r)}function O(e){if(!e)throw new Error("no geometry type");return"multipatch"===e?"mesh":e}async function R(e,t,i,a){await k(e,t,a);const s=e.on("create",(async r=>{if("cancel"===r.state)return k(e,t,a);if("complete"===r.state){const e=r.graphic;e.sourceLayer||(e.sourceLayer=t.layer),e.attributes||(e.attributes={...t.template.prototype.attributes}),await M(e,a),i(e)}}));return r([s,n((()=>e.cancel()))])}async function k(e,t,r){const n=t.layer,i={...t.template.prototype.attributes};await G(e,n,i,r),e.layer.elevationInfo=n.elevationInfo,await e.create(O(n.geometryType),{graphicProperties:{attributes:i,sourceLayer:n},hasZ:n.capabilities.data.supportsZ,geometryToPlace:t.geometryToPlace??void 0})}async function G(t,r,n,i){const a=new e({sourceLayer:r,attributes:n}),{rotation:s,size:o}=F(a);let l=await S(a,{useSourceLayer:!0,webStyleCache:i}),c=!1;for(const e of[o,s]){if(null==e)continue;null==n[e.field]&&(n[e.field]=await e.getDefault(l,t.view),c=!0)}switch(c&&(l=await S(a,{useSourceLayer:!0,webStyleCache:i})),l?.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=l;break;case"simple-line":case"line-3d":t.polylineSymbol=l;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":t.pointSymbol=l}P(t.tooltipOptions,o,s)}function P(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 D(e,t){return e?e.find((e=>e.layer===t)):void 0}async function C(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.async((async()=>{const{results:i}=await s(U(t,r),n),a=new Map,o=e=>{const t=e.layer,r=a.get(t);if(!r){const e=new Array;return a.set(t,e),e}return r};V(i).forEach((({graphic:e})=>o(e).push(e)));const l=e.filter((({supports:e,layer:t})=>e.includes("update")&&a.has(t)));return 0!==l.length&&r.stopPropagation(),{updatable:l,graphicsByLayer:a}}));return s(o(i.map((async({layer:e})=>{const{objectIdField:t}=e,r="displayField"in e?e.displayField:null,i=[t];null!=r&&e.fieldsIndex.has(r)&&i.push(r);const s=a.get(e);if(!!s.some((e=>i.some((t=>!(t in e.attributes)))))){const t=e.createQuery();return t.outFields=i,t.returnGeometry=!1,t.objectIds=s.map((e=>e.getObjectId())),e.queryFeatures(t,{signal:n}).then((({features:e})=>e))}return s}))),n)}async function q(e,t,r,n){if(0===e.length)return[];let i=null;const a=await r.async((async()=>{const{results:a}=await s(t.hitTest(r),n);if(0===a.length)return[];const o=new Set;i=V(a),i.forEach((({graphic:e})=>e&&o.add(e.layer)));const l=e.items.filter((({layer:e,supports:t,attachmentsOnUpdateEnabled:r})=>o.has(e)&&(t.includes("update")||t.includes("delete")||r)));return l.length>0&&r.stopPropagation(),l}));return s(o(a.map((({layer:e})=>{const a=e.objectIdField,s="displayField"in e?e.displayField:null,o=[a];null!=s&&e.fieldsIndex.has(s)&&o.push(s);const l=e.createQuery();l.outFields=o,l.returnGeometry=!1;const c="renderer"in e?y({renderer:e.renderer,event:r}):0;return l.geometry=I(r.mapPoint,c,t),l.outSpatialReference=t.spatialReference,e.queryFeatures(l,{signal:n}).then((({features:t})=>(i?.forEach((({graphic:r})=>{r.layer!==e||t.some((e=>e.getObjectId()===r.getObjectId()))||t.push(r)})),t)))}))),n)}async function Z(e,t,r,n){switch(t.type){case"3d":return C(e,t,r,n);case"2d":return q(e,t,r,n)}}async function Q(e,t,r){const{sourceLayer:n}=e,i=n.createQuery();i.objectIds=[e.getAttribute(n.objectIdField)],i.outFields=["*"],i.outSpatialReference=t,i.returnM=n.capabilities.data.supportsM,i.returnZ=n.capabilities.data.supportsZ,b()&&w()&&"scene"===n.type&&null!=n.infoFor3D&&(i.returnGeometry=!0,i.formatOf3DObjects="3D_glb");const s=await n.queryFeatures(i,{signal:r});a(r);const o=s.features[0];if("mesh"===o.geometry?.type&&!o.geometry.transform){const e=(await import("../../geometry/support/MeshTransform.js")).default;a(r),o.geometry.transform=new e({geographic:!0})}return o}async function B(e,t,r,n,i){let a=!1;const{rotation:s,size:o}=n;[s,o].forEach((async r=>{if(null==r)return;const n=t.getAttribute(r.field);if(null!=n)r.initValue(n);else{const n=await r.getDefault(t.symbol,e.view);r.initValue(n),t.setAttribute(r.field,n),a=!0}})),a&&await M(t,i);const l={multipleSelectionEnabled:!1};return"point"===r.geometryType&&(l.enableRotation=null!=s,l.enableScaling=null!=o),P(e.tooltipOptions,o,s),e.layer.elevationInfo=r.elevationInfo,e.update(t,l)}function W(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function _(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function H(e,t,r,n,i){if(null==t.geometry||"point"!==t.geometry?.type)return;const a=n.rotation,s=W(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:n}=a;t.setAttribute(r,n(s.angle,e))}const o=n.size,l=_(r.toolEventInfo);if(null!=o&&null!=l)if("scale-stop"===l.type)o.isUpdatingInteractively=!1,o.initValue();else{o.isUpdatingInteractively=!0;const{field:r,getValue:n}=o;t.setAttribute(r,n(l.xScale,e))}await M(t,i)}async function J(e,t,i,a,s,o){const c=ue(e);await M(c,o),a.map.add(i.layer),i.layer.add(c);const u=e.sourceLayer,p=se(a,u);await X(a,c),await B(i,c,u,t,o);const y=K(i,e,c);let f=null;p.then((e=>f=e)).catch((()=>{}));const d=t.size,m=t.rotation,g=l((()=>e.attributes),(async e=>{let t=!1;for(const r in e){const n=e[r];n!==c.getAttribute(r)&&(c.setAttribute(r,n),null==d||d.isUpdatingInteractively||d.field!==r||d.initValue(n),null==m||m.isUpdatingInteractively||m.field!==r||m.initValue(n),(null==f||f.requiredFields.includes(r))&&(t=!0))}t&&await M(c,o)})),h=i.on("update",(async e=>{const r=e.graphics[0];if("complete"===e.state)return B(i,r,u,t,o);await H(a,r,e,t,o),s(ue(r),e)})),b=i.on(["undo","redo"],(async e=>{s(ue(e.graphics[0]),e)}));return{interactive:r([b,h,n((()=>i.cancel())),g]),visual:y}}function K(e,i,s){const o=e.view,l=i.sourceLayer,u=i.layer,p=i.getAttribute(u.objectIdField);let y=null;function f(e){y?.abort(),y=t((async t=>{const r=await se(o,l);a(t),r.setVisibility?.(p,e)}))}return f(!1),r([N(o,s,(e=>f(!e))),n((async()=>{f(!0);const t=await se(o,l);await c((()=>!t.updating)),e.layer.remove(s)}))])}function N(e,t,n){if("3d"===e.type){const i=new j({graphic:t});return r([e.trackGraphicState(i),l((()=>i.displaying),n)])}return l((()=>t.visible),n)}async function X(e,t){if("3d"===e.type){const r=new j({graphic:t}),n=e.trackGraphicState(r);await c((()=>r.displaying)),n.remove()}else await c((()=>t.visible))}const Y={icon:u(24),text:u(12),line:u(1),viewScaleSizeFactor:100};function $(e,t,r){let n=!1;return e.filter((e=>!!n||(n=e===t,n))).map((e=>r[e]()))}function ee(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 te(e,t){if(e.viewModel.refreshCreationTemplates(),"awaiting-feature-creation-info"===t[0].id){const r=ee(e.viewModel.featureTemplatesViewModel.items);null==r||r.supportsUpload||(e.creationInfo=r,t.shift())}return t}function re(e){switch(e){case"unknown":case"decimal-degrees":return null;default:return e}}function ne(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}function ie(e){const{creationInfo:t,viewModel:r}=e;if(!t)return!1;const{layer:n}=t,i=r.editableItems.find((e=>e.layer===n));if(i)return i.attachmentsOnCreateEnabled;const a=n.capabilities?.data,s=r.layerInfos?.find((e=>e.layer===n));return!(!(a&&"supportsAttachment"in a&&a.supportsAttachment)||s&&(!1===s.allowAttachments||!1===s.attachmentsOnUpdateEnabled))}const ae=e=>/-stop/.test(e)||/vertex-/.test(e),se=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function oe(e){return"createInteractiveEditSession"in e}const le=Symbol();function ce(e){return e&&"object"==typeof e&&le in e}function ue(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=i(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function pe(e){const t=e.cursor;return e.cursor="progress",n((()=>e.cursor=t))}export{le as UsesSketchViewModelSymbol,te as avoidFeatureTemplateSelectionWithOnlyOneItem,oe as canCreateInteractiveEditSession,ue as cloneGraphicExceptMesh,$ as createWorkflowSteps,Z as fetchCandidates,Q as fetchFullFeature,D as findLayerInfo,F as getVisualVariableAttributes,ae as isTerminalUpdateEventType,ne as prepareAttachmentsForCreateWorkflow,R as setUpFeatureAdd,J as setUpGeometryUpdate,ie as shouldShowAttachmentsForCreateWorkflow,pe as showProgressCursor,Y as sizeDefaults,re as sizeVariableUnitToLengthUnit,k as startCreatingNewFeature,B as startUpdatingFeature,M as updateGraphicSymbolWhenRequired,H as visualVariableInteractiveUpdate,se as whenEditorLayerView,X as whenGraphicDisplayed,ce as workflowUsesSketchViewModel};
5
+ import e from"../../Graphic.js";import{createTask as t}from"../../core/asyncUtils.js";import"../../core/has.js";import{handlesGroup as r,makeHandle as n}from"../../core/handleUtils.js";import{clone as i}from"../../core/lang.js";import{throwIfAborted as a,whenOrAbort as s,eachAlways as l}from"../../core/promiseUtils.js";import{watch as o,whenOnce as c}from"../../core/reactiveUtils.js";import{px2pt as u}from"../../core/screenUtils.js";import{diff as p}from"../../core/accessorSupport/diffUtils.js";import{getDisplayFieldName as y}from"../../layers/support/fieldUtils.js";import{calculateTolerance as f}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as d}from"../../renderers/support/lengthUtils.js";import{getTransformationType as m,TransformationType as g}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as h,getSize as b}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{sceneLayerEditingEnabled as w,i3sPatchingEnabled as v}from"../../support/featureFlags.js";import{to3D as S}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as j}from"../../symbols/support/symbolUtils.js";import{GraphicState as I}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as U}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as V,filterGraphicHits as F}from"../../views/support/hitTestSelectUtils.js";function T(e){const t=e.sourceLayer;if(!t||"feature"!==t.type||!O(t.renderer))return{rotation:null,size:null};let r=null,n=null;const i=t.renderer.getVisualVariablesForType("rotation").filter((t=>(!t.axis||"heading"===t.axis)&&t.field&&!t.valueExpression&&null!=h(t,e)));1===i.length&&(r=z(i[0],t));const a=t.renderer.getVisualVariablesForType("size").filter((t=>t.field&&!t.useSymbolValue&&!t.valueExpression&&m(t)===g.RealWorldSize&&null!=b(t,e)));return 1===a.length&&(n=E(a[0],t)),{rotation:r,size:n}}function z(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=e.field,i=t.fields&&t.fields.filter((e=>e.name===n)),a=i&&1===i.length?i[0].type:"double",s={initial:0,current:0};return{field:n,fieldType:a,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-r*e,A((s.current+360)%360,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function x(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 L(e,t,r){if(null==t)return 0;const{symbol:n}=S(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const i=n.symbolLayers.at(0);if(!i)return 0;switch(i.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return i.size||Math.min($.icon,(await e(i,$.icon))[0])||$.icon}case"text":return i.size||$.text;case"line":return i.size||$.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return x(await t(i,e.scale/$.viewScaleSizeFactor),r)}case"path":return(null!=i.width?i.width:i.height)||e.scale/$.viewScaleSizeFactor;case"extrude":return i.size||e.scale/$.viewScaleSizeFactor;default:return 0}}function E(e,t){const r=e.field,n=e.axis,i=t.fields&&t.fields.filter((e=>e.name===r)),a=i&&1===i.length?i[0].type:"double",s={updating:!1,initial:0,current:0},l=d[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)=>A(o(await L(t,e,n)),a),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,A(s.current,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,displayUnit:ne(e.valueUnit),axis:e.axis}}function A(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 O(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 M(e,t){const r=await j(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t});null!=p(e.symbol,r)&&(e.symbol=r)}function R(e){if(!e)throw new Error("no geometry type");return"multipatch"===e?"mesh":e}async function k(e,t,i,a){await G(e,t,a);const s=e.on("create",(async r=>{if("cancel"===r.state)return G(e,t,a);if("complete"===r.state){const e=r.graphic;e.sourceLayer||(e.sourceLayer=t.layer),e.attributes||(e.attributes={...t.template.prototype.attributes}),await M(e,a),i(e)}}));return r([s,n((()=>e.cancel()))])}async function G(e,t,r){const n=t.layer,i={...t.template.prototype.attributes};await P(e,n,i,r),e.layer.elevationInfo=n.elevationInfo,await e.create(R(n.geometryType),{graphicProperties:{attributes:i,sourceLayer:n},hasZ:n.capabilities.data.supportsZ,geometryToPlace:t.geometryToPlace??void 0})}async function P(t,r,n,i){const a=new e({sourceLayer:r,attributes:n}),{rotation:s,size:l}=T(a);let o=await j(a,{useSourceLayer:!0,webStyleCache:i}),c=!1;for(const e of[l,s]){if(null==e)continue;null==n[e.field]&&(n[e.field]=await e.getDefault(o,t.view),c=!0)}switch(c&&(o=await j(a,{useSourceLayer:!0,webStyleCache:i})),o?.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=o;break;case"simple-line":case"line-3d":t.polylineSymbol=o;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":t.pointSymbol=o}D(t.tooltipOptions,l,s)}function D(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 C(e,t){return e?e.find((e=>e.layer===t)):void 0}async function q(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.async((async()=>{const{results:i}=await s(V(t,r),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};F(i).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&&r.stopPropagation(),{updatable:o,graphicsByLayer:a}}));return s(l(i.map((async({layer:e})=>{const{objectIdField:t}=e,r="displayField"in e?e.displayField:null,i=[t];null!=r&&e.fieldsIndex.has(r)&&i.push(r);const s=a.get(e);if(!!s.some((e=>i.some((t=>!(t in e.attributes)))))){const t=e.createQuery();return t.outFields=i,t.returnGeometry=!1,t.objectIds=s.map((e=>e.getObjectId())),e.queryFeatures(t,{signal:n}).then((({features:e})=>e))}return s}))),n)}async function Z(e,t,r,n){if(0===e.length)return[];let i=null;const a=await r.async((async()=>{const{results:a}=await s(t.hitTest(r),n);if(0===a.length)return[];const l=new Set;i=F(a),i.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(l(a.map((({layer:e})=>{const a=e.objectIdField,s="displayField"in e?e.displayField:null,l=y({displayField:s,fields:e.fields}),o=[a];null!=l&&e.fieldsIndex.has(l)&&o.push(l);const c=e.createQuery();c.outFields=o,c.returnGeometry=!1;const u="renderer"in e?f({renderer:e.renderer,event:r}):0;return c.geometry=U(r.mapPoint,u,t),c.outSpatialReference=t.spatialReference,e.queryFeatures(c,{signal:n}).then((({features:t})=>(i?.forEach((({graphic:r})=>{r.layer!==e||t.some((e=>e.getObjectId()===r.getObjectId()))||t.push(r)})),t)))}))),n)}async function Q(e,t,r,n){switch(t.type){case"3d":return q(e,t,r,n);case"2d":return Z(e,t,r,n)}}async function B(e,t,r){const{sourceLayer:n}=e,i=n.createQuery();i.objectIds=[e.getAttribute(n.objectIdField)],i.outFields=["*"],i.outSpatialReference=t,i.returnM=n.capabilities.data.supportsM,i.returnZ=n.capabilities.data.supportsZ,w()&&v()&&"scene"===n.type&&null!=n.infoFor3D&&(i.returnGeometry=!0,i.formatOf3DObjects="3D_glb");const s=await n.queryFeatures(i,{signal:r});a(r);return s.features[0]}async function W(e,t,r,n,i){let a=!1;const{rotation:s,size:l}=n;[s,l].forEach((async r=>{if(null==r)return;const n=t.getAttribute(r.field);if(null!=n)r.initValue(n);else{const n=await r.getDefault(t.symbol,e.view);r.initValue(n),t.setAttribute(r.field,n),a=!0}})),a&&await M(t,i);const o={multipleSelectionEnabled:!1};return"point"===r.geometryType&&(o.enableRotation=null!=s,o.enableScaling=null!=l),D(e.tooltipOptions,l,s),e.layer.elevationInfo=r.elevationInfo,e.update(t,o)}function _(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function H(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function J(e,t,r,n,i){if(null==t.geometry||"point"!==t.geometry?.type)return;const a=n.rotation,s=_(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:n}=a;t.setAttribute(r,n(s.angle,e))}const l=n.size,o=H(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:n}=l;t.setAttribute(r,n(o.xScale,e))}await M(t,i)}async function K(e,t,i,a,s,l){const c=pe(e);await M(c,l),a.map.add(i.layer),i.layer.add(c);const u=e.sourceLayer,p=le(a,u);await Y(a,c),await W(i,c,u,t,l);const y=N(i,e,c);let f=null;p.then((e=>f=e)).catch((()=>{}));const d=t.size,m=t.rotation,g=o((()=>e.attributes),(async e=>{let t=!1;for(const r in e){const n=e[r];n!==c.getAttribute(r)&&(c.setAttribute(r,n),null==d||d.isUpdatingInteractively||d.field!==r||d.initValue(n),null==m||m.isUpdatingInteractively||m.field!==r||m.initValue(n),(null==f||f.requiredFields.includes(r))&&(t=!0))}t&&await M(c,l)})),h=i.on("update",(async e=>{const r=e.graphics[0];if("complete"===e.state)return W(i,r,u,t,l);await J(a,r,e,t,l),s(pe(r),e)})),b=i.on(["undo","redo"],(async e=>{s(pe(e.graphics[0]),e)}));return{interactive:r([b,h,n((()=>i.cancel())),g]),visual:y}}function N(e,i,s){const l=e.view,o=i.sourceLayer,u=i.layer,p=i.getAttribute(u.objectIdField);let y=null;function f(e){y?.abort(),y=t((async t=>{const r=await le(l,o);a(t),r.setVisibility?.(p,e)}))}return f(!1),r([X(l,s,(e=>f(!e))),n((async()=>{f(!0);const t=await le(l,o);await c((()=>!t.updating)),e.layer.remove(s)}))])}function X(e,t,n){if("3d"===e.type){const i=new I({graphic:t});return r([e.trackGraphicState(i),o((()=>i.displaying),n)])}return o((()=>t.visible),n)}async function Y(e,t){if("3d"===e.type){const r=new I({graphic:t}),n=e.trackGraphicState(r);await c((()=>r.displaying)),n.remove()}else await c((()=>t.visible))}const $={icon:u(24),text:u(12),line:u(1),viewScaleSizeFactor:100};function ee(e,t,r){let n=!1;return e.filter((e=>!!n||(n=e===t,n))).map((e=>r[e]()))}function te(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 re(e,t){if(e.viewModel.refreshCreationTemplates(),"awaiting-feature-creation-info"===t[0].id){const r=te(e.viewModel.featureTemplatesViewModel.items);null==r||r.supportsUpload||(e.creationInfo=r,t.shift())}return t}function ne(e){switch(e){case"unknown":case"decimal-degrees":return null;default:return e}}function ie(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}function ae(e){const{creationInfo:t,viewModel:r}=e;if(!t)return!1;const{layer:n}=t,i=r.editableItems.find((e=>e.layer===n));if(i)return i.attachmentsOnCreateEnabled;const a=n.capabilities?.data,s=r.layerInfos?.find((e=>e.layer===n));return!(!(a&&"supportsAttachment"in a&&a.supportsAttachment)||s&&(!1===s.allowAttachments||!1===s.attachmentsOnUpdateEnabled))}const se=e=>/-stop/.test(e)||/vertex-/.test(e),le=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function oe(e){return"createInteractiveEditSession"in e}const ce=Symbol();function ue(e){return e&&"object"==typeof e&&ce in e}function pe(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=i(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function ye(e){const t=e.cursor;return e.cursor="progress",n((()=>e.cursor=t))}export{ce as UsesSketchViewModelSymbol,re as avoidFeatureTemplateSelectionWithOnlyOneItem,oe as canCreateInteractiveEditSession,pe as cloneGraphicExceptMesh,ee as createWorkflowSteps,Q as fetchCandidates,B as fetchFullFeature,C as findLayerInfo,T as getVisualVariableAttributes,se as isTerminalUpdateEventType,ie as prepareAttachmentsForCreateWorkflow,k as setUpFeatureAdd,K as setUpGeometryUpdate,ae as shouldShowAttachmentsForCreateWorkflow,ye as showProgressCursor,$ as sizeDefaults,ne as sizeVariableUnitToLengthUnit,G as startCreatingNewFeature,W as startUpdatingFeature,M as updateGraphicSymbolWhenRequired,J as visualVariableInteractiveUpdate,le as whenEditorLayerView,Y as whenGraphicDisplayed,ue as workflowUsesSketchViewModel};