@arcgis/core 5.2.0-next.13 → 5.2.0-next.14

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 (303) hide show
  1. package/arcgisGlobal.d.ts +3 -3
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/03354e9256b2f77fd4f2.js +1 -0
  4. package/assets/esri/core/workers/chunks/0826d36dfbfa28442b70.js +1 -0
  5. package/assets/esri/core/workers/chunks/{87c2d4d58c2487324fb7.js → 0a8ba5cb857f61de40fb.js} +3 -3
  6. package/assets/esri/core/workers/chunks/152f1c08197955224ad3.js +1 -0
  7. package/assets/esri/core/workers/chunks/1a0903b1d2d5101977c6.js +1 -0
  8. package/assets/esri/core/workers/chunks/{de541ad390a8d258d2e6.js → 1d5db8746a4f1ed1d18f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/1effde6a39ef0d4af525.js +1 -0
  10. package/assets/esri/core/workers/chunks/{2a5176533e78a92d8e5b.js → 20c729fca2e4b4c6b28d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/23d50c4478f40a7d62bf.js +1 -0
  12. package/assets/esri/core/workers/chunks/2623cd08487fdc9a94f1.js +1 -0
  13. package/assets/esri/core/workers/chunks/2c3fc2805f6de0963789.js +1 -0
  14. package/assets/esri/core/workers/chunks/2c4f10eaf02ef090ee8f.js +1 -0
  15. package/assets/esri/core/workers/chunks/314bc1b356d43bfa72a8.js +1 -0
  16. package/assets/esri/core/workers/chunks/{34544c79ce568f30a094.js → 31762eb20a9a0ed3f8b0.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{26dca1d387183282276a.js → 318a2702632aaa4d3a63.js} +1 -1
  18. package/assets/esri/core/workers/chunks/3526ab3b1f87c24ae6f8.js +1 -0
  19. package/assets/esri/core/workers/chunks/{81808c3aead7dfac3049.js → 38cfedce779dd75bd217.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{5075e85e1eafd431a8c0.js → 39c994536ce6c1e5c956.js} +1 -1
  21. package/assets/esri/core/workers/chunks/3b74749db78bcba2bc16.js +1 -0
  22. package/assets/esri/core/workers/chunks/3d83ac791212b81c9d11.js +1 -0
  23. package/assets/esri/core/workers/chunks/3ecb906322a6a5c8c93b.js +1 -0
  24. package/assets/esri/core/workers/chunks/3f67162456a1f02190fa.js +1 -0
  25. package/assets/esri/core/workers/chunks/{ef46ef4f0ee9f2aeaa4a.js → 426b8e1e2eef2460851d.js} +1 -1
  26. package/assets/esri/core/workers/chunks/4376bc2934a996d8bc27.js +1 -0
  27. package/assets/esri/core/workers/chunks/44d0ca9d4c5f1722688c.js +1 -0
  28. package/assets/esri/core/workers/chunks/{e25bcfdd8f20f8a08b19.js → 4d57c771af4137f74bfb.js} +1 -1
  29. package/assets/esri/core/workers/chunks/4e4419282c4bf7ee4678.js +1 -0
  30. package/assets/esri/core/workers/chunks/4e788fc6cb2ea936f676.js +1 -0
  31. package/assets/esri/core/workers/chunks/4f51963815b0d53ffbd9.js +1 -0
  32. package/assets/esri/core/workers/chunks/5100b5a6a506c704dfaf.js +1 -0
  33. package/assets/esri/core/workers/chunks/52afd43bbe23e358efb5.js +1 -0
  34. package/assets/esri/core/workers/chunks/5aba23584e0b230c75f5.js +1 -0
  35. package/assets/esri/core/workers/chunks/{d3c760109a70a71448c5.js → 67773a9f031d9f1d672f.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6f7193b9ff5942c0d354.js +1 -0
  37. package/assets/esri/core/workers/chunks/70737052bab29fcaa120.js +1 -0
  38. package/assets/esri/core/workers/chunks/718d2d430c1a5a940b83.js +1 -0
  39. package/assets/esri/core/workers/chunks/71c996e1ae84d9daddf2.js +1 -0
  40. package/assets/esri/core/workers/chunks/753e0b21e57c12c742ee.js +1 -0
  41. package/assets/esri/core/workers/chunks/764c8ba14ab74b66b391.js +1 -0
  42. package/assets/esri/core/workers/chunks/{1996f0a930abdd97b855.js → 7a8ed08cd173963b3112.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{cc697c4d9cdc116373dc.js → 81726d997a2d34449bb2.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{74e1826ad9e2c4fd3b42.js → 81883bca8a79ee2ddb00.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{9fee0110dc7fee4c95e2.js → 854c320af09b6afc4b80.js} +2 -2
  46. package/assets/esri/core/workers/chunks/85505a8b8b0794656d06.js +1 -0
  47. package/assets/esri/core/workers/chunks/859bc873e7af911a518f.js +1 -0
  48. package/assets/esri/core/workers/chunks/{8407c91cce31e087b41b.js → 886ae23a1d8fa21e531f.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{3ff7aa216cd794d951e8.js → 8e99f937fd36cf2cd05f.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{c357c0a08b99c1e7f290.js → 9331969046f2b277d620.js} +1 -1
  51. package/assets/esri/core/workers/chunks/93d08d82ceab19e314f8.js +1 -0
  52. package/assets/esri/core/workers/chunks/97a654e8054302582a3b.js +1 -0
  53. package/assets/esri/core/workers/chunks/97d2bdbea39cbcf8fd0f.js +1 -0
  54. package/assets/esri/core/workers/chunks/a0208e35b217808777c4.js +1 -0
  55. package/assets/esri/core/workers/chunks/{f25bb204cf6727f6fdef.js → a0876a52a3c2ad849370.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{7ad09ac5793e8d47b4b2.js → a4b970a841b3085500fc.js} +1 -1
  57. package/assets/esri/core/workers/chunks/aa5f36d7ed59c625ba78.js +1 -0
  58. package/assets/esri/core/workers/chunks/b045bffb4f2eb9203183.js +1 -0
  59. package/assets/esri/core/workers/chunks/b590402170ae289290d7.js +1 -0
  60. package/assets/esri/core/workers/chunks/b9935cc8e2bd4045058a.js +1 -0
  61. package/assets/esri/core/workers/chunks/{1a527c0740d9f4fa0791.js → bc547cf814d6703cef59.js} +1 -1
  62. package/assets/esri/core/workers/chunks/bcc097271f5cdf0a97a7.js +1 -0
  63. package/assets/esri/core/workers/chunks/bdc66ef2b6ed783047d5.js +1 -0
  64. package/assets/esri/core/workers/chunks/be1d2c3a61e6447fbbc7.js +1 -0
  65. package/assets/esri/core/workers/chunks/bf6ae205fbfbfcd1a0ee.js +1 -0
  66. package/assets/esri/core/workers/chunks/bfd1aef8ac795e1ce227.js +1 -0
  67. package/assets/esri/core/workers/chunks/c148ad0ea9258046ac1f.js +1 -0
  68. package/assets/esri/core/workers/chunks/{0f75c19d8e296a32e329.js → c2cd80b712f29e8cbb8d.js} +1 -1
  69. package/assets/esri/core/workers/chunks/cc0efa716b8414a44398.js +1 -0
  70. package/assets/esri/core/workers/chunks/{8f6833671c071b522923.js → cd66bd30f654fe571e57.js} +1 -1
  71. package/assets/esri/core/workers/chunks/cf41a66fb97c1076fb34.js +1 -0
  72. package/assets/esri/core/workers/chunks/cf8ce21dc649021e97f6.js +1 -0
  73. package/assets/esri/core/workers/chunks/d3be4d914fc99a1d686c.js +1 -0
  74. package/assets/esri/core/workers/chunks/dbd2bfcbf3e0f86f07b8.js +1 -0
  75. package/assets/esri/core/workers/chunks/{6675d56f49d07a97dc40.js → dd0c1cf921369e2bc48b.js} +1 -1
  76. package/assets/esri/core/workers/chunks/df18b0a653b328d8d052.js +1 -0
  77. package/assets/esri/core/workers/chunks/df54e741db40b308c2dd.js +2 -0
  78. package/assets/esri/core/workers/chunks/{89e09276086745aa21fa.js → e4e2f479c0c45ae1b2c3.js} +1 -1
  79. package/assets/esri/core/workers/chunks/e656fd5ecf9ac059a87b.js +1 -0
  80. package/assets/esri/core/workers/chunks/{58a7cdebc3d182c15ec6.js → e77df11aee136d64ff0f.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{7a474ce61cf484df87b4.js → e80376832050a4b6d28a.js} +1 -1
  82. package/assets/esri/core/workers/chunks/f116331c6eca937aac8e.js +1 -0
  83. package/assets/esri/core/workers/chunks/{3b837b512999e6ab24bc.js → f148666308071bdb185a.js} +1 -1
  84. package/assets/esri/core/workers/chunks/f23e995320674b32e142.js +1 -0
  85. package/assets/esri/core/workers/chunks/f334bf192dff5af10a70.js +1 -0
  86. package/assets/esri/core/workers/chunks/f76b1fc36f5606cac2c8.js +1 -0
  87. package/assets/esri/core/workers/chunks/{893c0d28a5bf3f9f29f1.js → f93facf47aba9b128fcc.js} +1 -1
  88. package/assets/esri/core/workers/chunks/fa1336b60278017d2525.js +1 -0
  89. package/assets/esri/core/workers/chunks/{c911f0b5bdd43b66b731.js → fa3faec65882c5b6f1a0.js} +1 -1
  90. package/assets/esri/core/workers/chunks/fccc34b86454c56f27ab.js +1 -0
  91. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  92. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  93. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  94. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +5 -1
  95. package/assets/esri/themes/dark/main.css +1 -1
  96. package/assets/esri/themes/light/main.css +1 -1
  97. package/assets/esri/themes/light/view.css +1 -1
  98. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis.json +1 -1
  99. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_en.json +1 -1
  100. package/chunks/Component.glsl.js +6 -6
  101. package/chunks/GlobalIlluminationBlur.glsl.js +7 -7
  102. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  103. package/chunks/arcgis-knowledge-client-core.js +1 -1
  104. package/chunks/bundle2.js +1 -1
  105. package/config.js +1 -1
  106. package/core/promiseUtils.d.ts +1 -1
  107. package/core/promiseUtils.js +1 -1
  108. package/core/units.js +1 -1
  109. package/form/types.d.ts +1 -1
  110. package/geometry/Mesh.d.ts +220 -95
  111. package/geometry/operators/support/projectionZScaling.js +1 -1
  112. package/geometry/support/MeshGeoreferencedVertexSpace.d.ts +35 -13
  113. package/geometry/support/MeshLocalVertexSpace.d.ts +32 -8
  114. package/geometry/support/MeshVertexAttributes.d.ts +6 -2
  115. package/geometry/support/heightModelInfoUtils.js +1 -1
  116. package/geometry/support/zscale.js +1 -1
  117. package/graphic/{AnnotationGraphicOrigin.d.ts → AnnotationFeatureGraphicOrigin.d.ts} +9 -9
  118. package/graphic/{AnnotationGraphicOrigin.js → AnnotationFeatureGraphicOrigin.js} +1 -1
  119. package/interfaces.d.ts +3 -3
  120. package/kernel.js +1 -1
  121. package/layers/{AnnotationLayer.d.ts → AnnotationFeatureLayer.d.ts} +24 -24
  122. package/layers/AnnotationFeatureLayer.js +2 -0
  123. package/layers/GaussianSplatLayer.d.ts +4 -1
  124. package/layers/graphics/data/QueryEngine.js +1 -1
  125. package/layers/graphics/data/queryUtils.js +1 -1
  126. package/layers/graphics/sources/parquet/ParquetFileStatistics.js +1 -1
  127. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  128. package/layers/graphics/sources/support/parquetIdUtils.js +1 -1
  129. package/layers/save/featureLayerUtils.js +1 -1
  130. package/layers/support/AnnotationSublayer.d.ts +7 -7
  131. package/layers/support/FeatureEffect.d.ts +3 -2
  132. package/layers/support/arcgisLayers.js +1 -1
  133. package/layers/support/fetchService.js +1 -1
  134. package/layers/support/layerUtils.js +1 -1
  135. package/layers/support/layersLoader.js +1 -1
  136. package/layers/support/parquetUtils.js +1 -1
  137. package/layers/support/schemaValidator.js +1 -1
  138. package/layers/types.d.ts +1 -1
  139. package/networks/Network.js +1 -1
  140. package/networks/UtilityNetwork.js +1 -1
  141. package/networks/support/networkFieldUtils.js +1 -1
  142. package/package.json +2 -2
  143. package/portal/schemas/definitions.js +1 -1
  144. package/portal/schemas/gaussianSplatLayerItem.js +2 -0
  145. package/portal/schemas/integratedMesh3DTilesLayerItem.js +1 -1
  146. package/portal/support/loadUtils.js +1 -1
  147. package/renderers/support/types.d.ts +1 -1
  148. package/renderers/visualVariables/RotationVariable.d.ts +1 -16
  149. package/renderers/visualVariables/RotationVariable.js +1 -1
  150. package/rest/knowledgeGraph/ReplicaDefinition.d.ts +0 -2
  151. package/rest/knowledgeGraph/ServiceDefinition.d.ts +1 -1
  152. package/rest/knowledgeGraph/wasmInterface/replicaToWasmEncodedFactories.js +1 -1
  153. package/rest/knowledgeGraph/wasmInterface/wasmToReplicaFactories.js +1 -1
  154. package/rest/knowledgeGraphService.js +1 -1
  155. package/rest/networks/support/QueryAssociationsParameters.d.ts +2 -2
  156. package/rest/networks/support/SynthesizeAssociationGeometriesParameters.d.ts +2 -2
  157. package/rest/networks/support/TraceParameters.d.ts +2 -2
  158. package/rest/support/AttributeBinsQuery.js +1 -1
  159. package/rest/support/Query.js +1 -1
  160. package/rest/support/TopFeaturesQuery.js +1 -1
  161. package/support/revision.js +1 -1
  162. package/views/2d/engine/webgl/TextureManager.js +1 -1
  163. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  164. package/views/2d/engine/webgl/util/createMatcher.js +1 -1
  165. package/views/2d/layerViewModuleImportUtils.js +1 -1
  166. package/views/2d/layers/AnnotationFeatureLayerView2D.js +2 -0
  167. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  168. package/views/2d/layers/TileLayerView2D.js +1 -1
  169. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  170. package/views/2d/layers/support/annodime/annotationSchema.js +1 -1
  171. package/views/2d/types.d.ts +2 -2
  172. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  173. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  174. package/views/3d/layerViewModuleImportUtils.js +1 -1
  175. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  176. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  177. package/views/3d/support/GaussianSplatWorkerHandle.js +1 -1
  178. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  179. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  180. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  181. package/views/3d/terrain/Tile.js +1 -1
  182. package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
  183. package/views/3d/types.d.ts +1 -1
  184. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +7 -7
  185. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +29 -20
  186. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatTextureFetch.glsl.js +6 -8
  187. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TexelFormatInfo.js +2 -0
  188. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  189. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  190. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  191. package/views/layers/{AnnotationLayerView.d.ts → AnnotationFeatureLayerView.d.ts} +6 -6
  192. package/views/layers/FeatureLikeLayerView.d.ts +2 -2
  193. package/views/layers/FeatureLikeLayerView.js +1 -1
  194. package/webdoc/widgets/FloorFilter.d.ts +14 -1
  195. package/webdoc/widgets/FloorFilter.js +1 -1
  196. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  197. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +12 -4
  198. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  199. package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
  200. package/widgets/BatchAttributeForm/ValueChangeTransaction.js +2 -0
  201. package/widgets/BatchAttributeForm/VisibleElements.d.ts +8 -1
  202. package/widgets/BatchAttributeForm/VisibleElements.js +1 -1
  203. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  204. package/widgets/BatchAttributeForm/css.js +1 -1
  205. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  206. package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
  207. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.d.ts +3 -0
  208. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
  209. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  210. package/widgets/BatchAttributeForm/inputs/GroupInput.js +1 -1
  211. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  212. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  213. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  214. package/widgets/BatchAttributeForm/interfaceUtils.js +1 -1
  215. package/widgets/BatchAttributeForm/stringUtils.js +2 -0
  216. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  217. package/widgets/BatchAttributeForm/types.d.ts +19 -3
  218. package/widgets/BatchAttributeForm.js +1 -1
  219. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  220. package/widgets/Editor/AddAssociationWorkflowData.js +1 -1
  221. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  222. package/widgets/Editor/EditorViewModel.d.ts +1 -1
  223. package/widgets/Editor/EditorViewModel.js +1 -1
  224. package/widgets/Editor/MergeFeaturesWorkflow.d.ts +3 -3
  225. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  226. package/widgets/Editor/SplitFeatureWorkflow.d.ts +3 -3
  227. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  228. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  229. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  230. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  231. package/widgets/Editor/UpdateRecordWorkflowData.js +1 -1
  232. package/widgets/Editor/UpdateWorkflow.js +1 -1
  233. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  234. package/widgets/Editor/support/SketchController.js +1 -1
  235. package/widgets/Editor/workflowUtils.js +1 -1
  236. package/widgets/Editor.js +1 -1
  237. package/widgets/FloorFilter/FloorFilterViewModel.d.ts +10 -0
  238. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  239. package/assets/esri/core/workers/chunks/07cc5743cb6a9fd68adb.js +0 -1
  240. package/assets/esri/core/workers/chunks/0bb159ba0226122465cf.js +0 -1
  241. package/assets/esri/core/workers/chunks/160e5b99f1097a473e6b.js +0 -1
  242. package/assets/esri/core/workers/chunks/17e68828ca6ff6912d3e.js +0 -1
  243. package/assets/esri/core/workers/chunks/1e340536d3c5f94920b5.js +0 -1
  244. package/assets/esri/core/workers/chunks/24810c36ae09bb4e83dc.js +0 -1
  245. package/assets/esri/core/workers/chunks/274b82cb183ddd0042f3.js +0 -1
  246. package/assets/esri/core/workers/chunks/297ae764445e6f73a5ea.js +0 -1
  247. package/assets/esri/core/workers/chunks/29aba121db7f00e0cf81.js +0 -1
  248. package/assets/esri/core/workers/chunks/2a3145a595d19391bb8a.js +0 -1
  249. package/assets/esri/core/workers/chunks/3297658ccd8d4b9ce733.js +0 -1
  250. package/assets/esri/core/workers/chunks/38ca59db0e8f45bd7811.js +0 -1
  251. package/assets/esri/core/workers/chunks/3c5534c576528c1921d2.js +0 -1
  252. package/assets/esri/core/workers/chunks/40b3cdf81c79bbc44527.js +0 -2
  253. package/assets/esri/core/workers/chunks/41f12eb7c9b7086528d5.js +0 -1
  254. package/assets/esri/core/workers/chunks/426156137f279d979ddd.js +0 -1
  255. package/assets/esri/core/workers/chunks/4714241189c13d0db897.js +0 -1
  256. package/assets/esri/core/workers/chunks/537c5dd4cd0a067199d1.js +0 -1
  257. package/assets/esri/core/workers/chunks/538537f9bc866d9caa75.js +0 -1
  258. package/assets/esri/core/workers/chunks/5437a1c05c1bd2175981.js +0 -1
  259. package/assets/esri/core/workers/chunks/58ac245ff7fb57c1004f.js +0 -1
  260. package/assets/esri/core/workers/chunks/5c7aff9604b4576a0e1d.js +0 -1
  261. package/assets/esri/core/workers/chunks/5d3ddbf94539cb4f493e.js +0 -1
  262. package/assets/esri/core/workers/chunks/5eb9fdb076488de9cd83.js +0 -1
  263. package/assets/esri/core/workers/chunks/603177137eb680afe371.js +0 -1
  264. package/assets/esri/core/workers/chunks/629099f05ca5c9ca1973.js +0 -1
  265. package/assets/esri/core/workers/chunks/62f78fa455d556008f6a.js +0 -1
  266. package/assets/esri/core/workers/chunks/686c51fd2144e132783e.js +0 -1
  267. package/assets/esri/core/workers/chunks/6f0341cfa4c68e6e60b3.js +0 -1
  268. package/assets/esri/core/workers/chunks/70229007d594536ba6a3.js +0 -1
  269. package/assets/esri/core/workers/chunks/7e89cb9ff615742e0894.js +0 -1
  270. package/assets/esri/core/workers/chunks/890b7a1153b7f65eba9a.js +0 -1
  271. package/assets/esri/core/workers/chunks/9660ae52fb3951a19e9c.js +0 -1
  272. package/assets/esri/core/workers/chunks/a4245bd4e67a428fd835.js +0 -1
  273. package/assets/esri/core/workers/chunks/ac33b10fe65f9e9e824f.js +0 -1
  274. package/assets/esri/core/workers/chunks/b5937ce657c1fff3864f.js +0 -1
  275. package/assets/esri/core/workers/chunks/c3cf9e6e91f71c9cc5f3.js +0 -1
  276. package/assets/esri/core/workers/chunks/c80fc1b3048e8d58a1f8.js +0 -1
  277. package/assets/esri/core/workers/chunks/cc3e895cff019e811c07.js +0 -1
  278. package/assets/esri/core/workers/chunks/d122431f3b0b88dcb488.js +0 -1
  279. package/assets/esri/core/workers/chunks/d24e027bb8b2c09f25c8.js +0 -1
  280. package/assets/esri/core/workers/chunks/d2df8c328054dc6cb7b7.js +0 -1
  281. package/assets/esri/core/workers/chunks/d41caf20c26f80385265.js +0 -1
  282. package/assets/esri/core/workers/chunks/d468994822f9bc3d6279.js +0 -1
  283. package/assets/esri/core/workers/chunks/d63f532dd7d60ee8ef2c.js +0 -1
  284. package/assets/esri/core/workers/chunks/d64613209a9eb1eafb11.js +0 -1
  285. package/assets/esri/core/workers/chunks/d7be278aed1fb37ad5ec.js +0 -1
  286. package/assets/esri/core/workers/chunks/d8ec0afb2b91ccf32e55.js +0 -1
  287. package/assets/esri/core/workers/chunks/da1e8b338ab9fe9e0a8e.js +0 -1
  288. package/assets/esri/core/workers/chunks/dd920a6f6422fa213eba.js +0 -1
  289. package/assets/esri/core/workers/chunks/e279bcbe4f10e87bde6c.js +0 -1
  290. package/assets/esri/core/workers/chunks/e2de13810dce01b98520.js +0 -1
  291. package/assets/esri/core/workers/chunks/e5837e5ac6ef761f26a2.js +0 -1
  292. package/assets/esri/core/workers/chunks/e82488b9b3bb0c1dedb4.js +0 -1
  293. package/assets/esri/core/workers/chunks/f274a8e8c7ca4294e876.js +0 -1
  294. package/assets/esri/core/workers/chunks/f292c2c22a3822343118.js +0 -1
  295. package/assets/esri/core/workers/chunks/f4f642ddd4d5db7cbbb4.js +0 -1
  296. package/assets/esri/core/workers/chunks/f6d047358d14328f3622.js +0 -1
  297. package/assets/esri/core/workers/chunks/fb6605be0c5e36785543.js +0 -1
  298. package/assets/esri/core/workers/chunks/fd70a25ffdf2cc6c5be2.js +0 -1
  299. package/layers/AnnotationLayer.js +0 -2
  300. package/views/2d/layers/AnnotationLayerView2D.js +0 -2
  301. /package/assets/esri/core/workers/chunks/{9fee0110dc7fee4c95e2.js.LICENSE.txt → 854c320af09b6afc4b80.js.LICENSE.txt} +0 -0
  302. /package/assets/esri/core/workers/chunks/{40b3cdf81c79bbc44527.js.LICENSE.txt → df54e741db40b308c2dd.js.LICENSE.txt} +0 -0
  303. /package/views/layers/{AnnotationLayerView.js → AnnotationFeatureLayerView.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import o from"../../core/Error.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";import a from"./Edits.js";import{findEditorItemForLayer as s}from"./workflowUtils.js";var l;let d=l=class extends e{constructor(t){super(t),this.association=null,this.editorItem=null,this.edits=null,this.featureFormCallbacks=null,this.parent=null,this.readOnly=!1,this.viewModel=null}get attachmentsCapabilities(){const t=this.editorItem.capabilities.update.attachments.enabled;return{editing:!0,operations:{add:t,update:t,delete:t}}}get formTemplate(){return this.editorItem.formTemplate}static async create(t){const e=l._makeConstructorProps(t);return new l(e)}stageDelete(){this.edits.stageDelete()}static _makeConstructorProps(t){const{association:e,feature:r,parent:i,featureFormCallbacks:l,viewModel:d,readOnly:n}=t,p=s(d.editorItems,r.sourceLayer);if(!p)throw new o("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified Graphic's layer");return{association:e,editorItem:p,edits:new a({feature:r}),parent:i,featureFormCallbacks:l,viewModel:d,readOnly:n??!1}}};t([r()],d.prototype,"association",void 0),t([r()],d.prototype,"attachmentsCapabilities",null),t([r({constructOnly:!0})],d.prototype,"editorItem",void 0),t([r()],d.prototype,"edits",void 0),t([r()],d.prototype,"featureFormCallbacks",void 0),t([r()],d.prototype,"formTemplate",null),t([r()],d.prototype,"parent",void 0),t([r()],d.prototype,"readOnly",void 0),t([r()],d.prototype,"viewModel",void 0),d=l=t([i("esri.widgets.Editor.UpdateRecordWorkflowData")],d);const n=d;export{n as default};
2
+ import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import o from"../../core/Error.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";import s from"./Edits.js";import{findEditorItemForLayer as a}from"./workflowUtils.js";var l;let d=l=class extends e{constructor(t){super(t),this.association=null,this.editorItem=null,this.edits=null,this.formCallbacks=null,this.parent=null,this.readOnly=!1,this.viewModel=null}get attachmentsCapabilities(){const t=this.editorItem.capabilities.update.attachments.enabled;return{editing:!0,operations:{add:t,update:t,delete:t}}}get formTemplate(){return this.editorItem.formTemplate}static async create(t){const e=l._makeConstructorProps(t);return new l(e)}stageDelete(){this.edits.stageDelete()}static _makeConstructorProps(t){const{association:e,feature:r,parent:i,formCallbacks:l,viewModel:d,readOnly:n}=t,p=a(d.editorItems,r.sourceLayer);if(!p)throw new o("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified Graphic's layer");return{association:e,editorItem:p,edits:new s({feature:r}),parent:i,formCallbacks:l,viewModel:d,readOnly:n??!1}}};t([r()],d.prototype,"association",void 0),t([r()],d.prototype,"attachmentsCapabilities",null),t([r({constructOnly:!0})],d.prototype,"editorItem",void 0),t([r()],d.prototype,"edits",void 0),t([r()],d.prototype,"formCallbacks",void 0),t([r()],d.prototype,"formTemplate",null),t([r()],d.prototype,"parent",void 0),t([r()],d.prototype,"readOnly",void 0),t([r()],d.prototype,"viewModel",void 0),d=l=t([i("esri.widgets.Editor.UpdateRecordWorkflowData")],d);const n=d;export{n as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{remove as i}from"../../core/arrayUtils.js";import o from"../../core/Error.js";import{makeHandle as a}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{abortMaybe as s}from"../../core/maybe.js";import{onAbort as n,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,watch as w,sync as h,on as f,when as g}from"../../core/reactiveUtils.js";import{last as v}from"../../core/SetUtils.js";import{property as k,subclass as m}from"../../core/accessorSupport/decorators.js";import{getGraphicLayer as y}from"../../graphic/graphicOriginUtils.js";import{isEditableLayer as W}from"../../layers/support/editableLayers.js";import{isFeatureLayer as A,isSubtypeSublayer as _,isSubtypeGroupLayer as b,isTable as S}from"../../layers/support/layerUtils.js";import{findUtilityNetwork as C,isGraphicForRelatableFeatureSupportedLayer as M}from"../../popup/support/featureUtils.js";import{createFeatureServices as F}from"../../rest/featureService/utils.js";import R from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as U}from"../../views/input/InputManager.js";import{temporaryHighlightName as E}from"../../views/support/HighlightDefaults.js";import I from"./CreateFeaturesWorkflow.js";import j from"./MergeFeaturesWorkflow.js";import V from"./SplitFeatureWorkflow.js";import P from"./UpdateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as L}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as N}from"./UpdateRecordWorkflow.js";import O from"./UpdateWorkflowData.js";import T from"./Workflow.js";import{isFeatureFormViewModel as x,findEditorItemForLayer as D,isSplitFeatureWorkflow as H,workflowInfluencesOutcomeOfParent as z,isAnyUpdateLeafWorkflow as q,isUpdateRecordWorkflow as G,isParentWorkflow as Q,findEditorItemForLayerOrThrow as $,createWorkflowSteps as B,fetchCandidates as J,isUpdateFeaturesWorkflowOptions as K,toFeatureInfos as X,isMergeWorkflowOptions as Y,isSplitWorkflowOptions as Z}from"./workflowUtils.js";import{assertFeaturesAreFromSameLayer as ee}from"./support/errors.js";var te;let ie=te=class extends T{constructor(e){super(e),this._workflowStack=new p(v),this._sketchStack=new p(v),this.data=void 0,this.type="update"}destroy(){this._drainWorkflowStack(e=>e.cancel({force:!0}))}get formViewModel(){return this.activeWorkflow?.formViewModel}get activeUtilityNetworkAssociationAddAssociationViewModel(){return"add-association"===this.activeWorkflow?.type?this.activeWorkflow.utilityNetworkAssociationAddAssociationViewModel:null}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get canDeleteAssociation(){const{formViewModel:e}=this;if(!this.activeWorkflow||!this.data.viewModel.view?.map||!x(e))return!1;const{activeAssociation:t,feature:i}=e;return!(!t||!i?.sourceLayer||!A(i?.sourceLayer)&&!_(i?.sourceLayer))}get activeWorkflow(){return this._workflowStack.last()}getUpdating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){const e=this.activeWorkflow?.formViewModel;return this._stepIndex>0||this.nestedWorkflowCount>1||this.activeWorkflow?.hasPreviousStep||"view"!==this.data.viewModel.attachmentsViewModel.mode||x(e)&&(null!=e.relationshipId||null!=e.associationId||null!=e.associatedLayer)}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some(({layer:e})=>D(t.editorItems,e)?.supportsUpdateWorkflow)}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return this.activeWorkflow?.shouldShowAttachments??!1}get shouldAllowAttachmentEditing(){return this.activeWorkflow?.shouldAllowAttachmentEditing??!1}get hasPendingEdits(){return Array.from(this._workflowStack).some(e=>e.hasPendingEdits)}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get noticeMessage(){return this.activeWorkflow?.noticeMessage}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return this.activeWorkflow?.hasInvalidFormTemplate??!1}get curveResizeDisabled(){return this.activeWorkflow?.curveResizeDisabled??!1}get curveUpdatesDisabled(){return this.activeWorkflow?.curveUpdatesDisabled??!1}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this,i=t?.formViewModel;if(x(i)){if(i?.activeRelationshipInput){const e=i.activeRelationshipInput;if(e.activeCategory)return void(e.activeCategory=null);if(null!=i.relationshipId)return void(i.relationshipId=null);if(e.showAllEnabled)return void(e.showAllEnabled=!1)}if("add-association"===t?.type){const{activeUtilityNetworkAssociationAddAssociationViewModel:e}=this;if(e?.filterOptionsVisible)return void(e.filterOptionsVisible=!1);e?.featureSpatialItems.length&&e.reset()}if(null!=i?.associatedLayer)return void(i.associatedLayer=null);if(null!=i?.associationId)return void(i.associationId=null)}if("create-features"===t?.type&&t.hasPreviousStep)await t.previous({cancelCurrentStep:!0});else{if(H(t)&&t.hasPreviousStep)return await t.back();if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0})}}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflowAndReconcile()}async commit(){await this._drainWorkflowStack(e=>e.commit()),await super.commit()}static create(e){const{startAt:t,applyEdits:i,applyEditsFeatureService:o,...a}=e,r=new te({data:new O({applyEditsCallback:i,applyEditsFeatureServiceCallback:o,...a}),onCommit:async()=>{}});return r._set("steps",this._createWorkflowSteps(r,t)),r}async save(e){const{formViewModel:t}=this;if(t&&(await t.submit(),!t.submittable||x(t)&&ae(t)))return;if(this.nestedWorkflowCount<2)return await this.commit();const{activeWorkflow:i}=this;if(await(i?.commit(e)),!z(i))return void await this._popWorkflowAndReconcile();this._popWorkflow();const o=this._workflowStack.peek();if(o&&o===i?.parent&&(await o.cancel(),this._popWorkflow(),0===this.nestedWorkflowCount))return await this.commit();await this._reconcileWorkflowStack()}async startCreatingRelatedRecord(e){const t=this._makeUpdatingResolver();try{const t=this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflowAndReconcile(t)}catch(i){throw new o("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:i})}finally{t.resolve()}}async startMergingFeatures(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedMergeFeaturesWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-merging","Could not begin merging the provided features.",{error:a})}finally{i.resolve()}}async startSplittingFeature(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedSplitFeatureWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-splitting","Could not begin splitting the provided feature.",{error:a})}finally{i.resolve()}}async startUpdatingSingle(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedUpdateWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:a})}finally{i.resolve()}}async startUpdatingMultiple(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedUpdateFeaturesWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-updating","Could not begin updating the provided features or table records.",{error:a})}finally{i.resolve()}}async startAddAssociation(e,t,i){const a=this._makeUpdatingResolver();try{const o=await this._createNestedAddAssociationWorkflow(e,t,i);await this._pushWorkflowAndReconcile(o)}catch(r){throw new o("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:r})}finally{a.resolve()}}async deleteActiveFeatures(){const{activeWorkflow:e}=this;if(!e)throw new o("editor:nothing-to-delete","There is no feature to delete");const t=q(e);if(t){e.data.stageDelete();const t=G(e)?e.data.edits.feature?[e.data.edits.feature]:[]:e.data.features;this._removeFeaturesFromCandidates(t)}else await e.cancel();this.nestedWorkflowCount<2?t?await this.commit():await this.cancel({force:!0}):(t&&await e.commit(),await this._popWorkflowAndReconcile(),await this._returnToPageWithContent())}async deleteActiveAssociation(){if(!this.canDeleteAssociation)throw new o("editor:nothing-to-delete","There is no association to delete");await this._deleteActiveAssociation(),await this._popWorkflowAndReconcile(),await this._returnToPageWithContent()}async cancelAll(){await this._drainWorkflowStack(e=>e.cancel({force:!0}))}async _deleteActiveAssociation(){const{formViewModel:e}=this;if(!x(e))throw new o("editing:failed-to-delete-association","The active workflow does not support editing associations");const{activeAssociation:t,feature:i}=e,{applyEditsFeatureServiceCallback:a,viewModel:r}=this.data,{sourceLayer:s}=i,n=_(s)&&s.parent?s.parent:s,l=F([n]),d=l.values().next().value?.featureService;if(!d)throw new o("editor:failed-to-delete-association","Could not retrieve feature service needed to delete association");await(d?.load());const c=r.view.map,p=C(c,n);await(p?.networkSystemLayers.loadAssociationsTable());const u=p?.generateDeleteAssociations([t]);if(!u)throw new o("editor:failed-to-delete-association","Could not create payload needed to delete association");const w=p?.gdbVersion??void 0;await a(d,[u],{gdbVersion:w,globalIdUsed:!0})}_removeFeaturesFromCandidates(e){const{candidates:t}=this.data;if(0!==t.length&&0!==e.length)for(const o of e)i(t,o)}async _returnToPageWithContent(){const{formViewModel:e}=this;if(!x(e)||!e?.activeAssociationInput)return;const{activeAssociationInput:t,associationId:i}=e;await t.refresh(),t.associatedLayer&&!t.associatedFeatures?.length&&(e.associatedLayer=null),null==i||t.associatedFeatureInfos.size||(e.associationId=null)}_createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:i,applyEditsCallback:a,applyEditsFeatureServiceCallback:r,sketchOptions:s,snappingManager:n,viewModel:l}=this.data;if(!W(t))throw new o("editor:unsupported-layer","Editing is not supported on the provided layer");const d=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),c=d.template||d.initialFeature?"creating-features":"awaiting-feature-creation-info",p=Q(this.activeWorkflow)?this.activeWorkflow:void 0;return I.create({addAttachmentsCallback:i,applyEdits:a,applyEditsFeatureService:r,creationInfo:d,isNested:!0,parent:p,sketchOptions:s,snappingManager:n,startAt:c,viewModel:l})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:i}=e;if(!W(i)||b(i))throw new o("editor:unsupported-layer","Editing is not supported on the provided layer");const{viewModel:a}=this.data,r={layer:i,maxFeatures:1},s=this._makeRelatedRecordAttributes(e),n=a.getTemplatesForLayer(i);return n?.length>0?(r.attributeOverrides=s,1===n.length&&(r.template=n[0])):r.initialFeature=new t({sourceLayer:i,attributes:s}),r}async _createNestedUpdateWorkflow(e,t={}){const i=S(e.sourceLayer)?N:L,{applyEditsCallback:o,applyEditsFeatureServiceCallback:a,sketchOptions:r,snappingManager:s,viewModel:n}=this.data,l=Q(this.activeWorkflow)?this.activeWorkflow:void 0,d=await i.create({feature:e,parent:l,sketchOptions:r,snappingManager:s,viewModel:n,applyEdits:o,applyEditsFeatureService:a,featureFormCallbacks:{addRelatedRecord:e=>{this.startCreatingRelatedRecord(e)},editRelatedRecord:({relatedFeature:e,readOnly:t})=>{this.startUpdatingSingle(e,{readOnly:t})},selectAssociatedFeature:async({feature:e,association:t})=>await this.startUpdatingSingle(e,{association:t}),addAssociation:e=>{this.startAddAssociation(e.feature,e.utilityNetwork,e.associationType)}},...t});return await u(()=>!d.updating),d}async _createNestedUpdateFeaturesWorkflow(e,t={}){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,viewModel:a}=this.data,r=P.create({applyEdits:i,applyEditsFeatureService:o,featureInfos:e,viewModel:a,...t});return await u(()=>!r.updating),r}async _createNestedAddAssociationWorkflow(e,t,i){const{AddAssociationWorkflow:a}=await import("./AddAssociationWorkflow.js"),{applyEditsCallback:r,applyEditsFeatureServiceCallback:s,viewModel:n}=this.data,l=Q(this.activeWorkflow)?this.activeWorkflow:void 0,{formViewModel:d}=this,c=x(d)?d.activeAssociationInput:null;if(!c)throw new o("editing:unable-to-add-association","There is no active association input in the current workflow's form.");const p=await a.create({utilityNetwork:t,associationType:i,feature:e,parent:l,viewModel:n,associationInput:c,applyEdits:r,applyEditsFeatureService:s});return await u(()=>!p.updating),p}async _createNestedMergeFeaturesWorkflow(e,t){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,viewModel:a}=this.data;ee(e);const r=$(this.data.viewModel.editorItems,y(e[0])),s=Q(this.activeWorkflow)?this.activeWorkflow:void 0,n=await j.create({applyEdits:i,applyEditsFeatureService:o,editorItem:r,features:e,parent:s,viewModel:a,...t});return await u(()=>!n.updating),n}async _createNestedSplitFeatureWorkflow(e,t){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,sketchOptions:a,snappingManager:r,viewModel:s}=this.data,n=Q(this.activeWorkflow)?this.activeWorkflow:void 0,l=$(s.editorItems,e.sourceLayer),d=V.create({applyEdits:i,applyEditsFeatureService:o,editorItem:l,feature:e,parent:n,sketchOptions:a,snappingManager:r,viewModel:s,...t});return await u(()=>!d.updating),d}async _drainWorkflowStack(e){const t=this._workflowStack,i=[];for(const o of t){const t=e(o).finally(()=>o.destroy());this._updatingHandles.consumePromise(t),i.push(t)}await Promise.all(i),this._workflowStack.clear(),this._sketchStack.clear()}_makeUpdatingResolver(){const e=Promise.withResolvers();return this._updatingHandles.consumePromise(e.promise),e}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:i,relationshipId:o}=e;if(!M(t))return;const a=i.relationships?.find(e=>e.id===o);if(!a)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===a.role)return void this._logContinuingWithoutRelationshipWarning("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;a.relatedTableId!==r.layerId&&this._logContinuingWithoutRelationshipWarning("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const s=r.relationships?.find(e=>e.id===o);if(!s)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const n=oe(r,s),l=t.getAttribute(n);l||this._logContinuingWithoutRelationshipWarning("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=oe(i,a);return{[d]:l}}_popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop()}async _popWorkflowAndReconcile(){this._popWorkflow();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new o("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflowAndReconcile(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const i=this._sketchStack,a=await(e?.start()),r=i.peek();a?(r?.exit(),i.push(a)):i.push(this._cloneSketchController(r)),this._workflowStack.push(e);const s=await this._reconcileWorkflowStack();if(s.failureCount>0)throw new o("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",s)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const i=e.peek();return await(i?.enter()),await(t.peek()?.enter()),{activeWorkflow:i,failureCount:0}}catch(i){e.pop().destroy(),t.pop();const{activeWorkflow:o,failureCount:a}=await this._reconcileWorkflowStack();return{activeWorkflow:o,failureCount:a+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!S(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:i}=e;return B(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=i.viewModel,o=i.viewModel.view;o.activeTool=null;let r=null;e.addHandles(a(()=>{r=s(r)}),this.id),i.rootFeatures.removeAll(),i.candidates=[];const c=o.on("immediate-click",async a=>{const s=Promise.withResolvers();e._updatingHandles.consumePromise(s.promise);try{t.location=a.mapPoint,t.visible=!0,r?.abort();const{editorItems:s}=i.viewModel;r=new AbortController;const c=await a.defer(()=>new Promise((e,t)=>{n(r?.signal,()=>t(l())),e(J(s,o,a,r?.signal))}));if(d(r),i.candidates=c.filter(e=>"fulfilled"===e.status).flatMap(e=>e.value).filter(e=>!e.isAggregate),t.visible=1===i.candidates.length,0===i.candidates.length)return;if(a.stopPropagation(),1===i.candidates.length){const{rootFeatures:o}=i;o.removeAll(),o.add(i.candidates[0]),e.go("editing-existing-feature").catch(()=>{}).then(()=>t.visible=!1)}else e.next()}finally{s.resolve()}},U.TOOL),p=g(()=>null!=o.activeTool,()=>e.cancel({force:!0}),{once:!0});o.focus(),e.addHandles([c,p],this.id)},async tearDown(){0===i.candidates.length&&(i.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){i.rootFeatures.removeAll();const{view:t}=i.viewModel;if(!t)return;const o=new R({view:t,highlightName:E});e.addHandles([f(()=>i.rootFeatures,"change",({added:e,removed:t})=>{t.forEach(e=>o.remove(e)),e.forEach(e=>o.add(e))},h),a(()=>o.removeAll())],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){await re(e);const{data:t}=e;t.viewModel.spinnerViewModel.visible=!1;const i=c(async()=>{await u(()=>!e.updating),e.previous()});e.addHandles([w(()=>e.nestedWorkflowCount,(e,t)=>{0===e&&0!==t&&i()},h)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}})})}_logContinuingWithoutRelationshipWarning(e,t){r.getLogger(this).warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature.")}};function oe(e,{keyField:t}){return e.getField(t)?.name??t}function ae(e){if(e.pendingSubtypeChoice)return!0;const t=e.getValues();return e.validateContingencyConstraints(t,{includeIncompleteViolations:!0}).length>0}async function re(e){const{data:t}=e,{rootWorkflowOptions:i}=t;if(K(i)){const{rootFeatureInfos:a}=t,r=a.length>0?a:X(t.rootFeatures.toArray());if(0===r.length)throw new o("editing:invalid-parameter","Must supply `rootFeatureInfos` or `rootFeatures` when root workflow type is 'update-multiple'");return await e.startUpdatingMultiple(r,i.props)}const{rootFeatures:a}=t,r=a.getItemAt(0);if(!r)throw new o("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until one or more root features are provided");Y(i)?await e.startMergingFeatures(a.toArray(),i.props):Z(i)?await e.startSplittingFeature(r,i.props):await e.startUpdatingSingle(r)}e([k()],ie.prototype,"formViewModel",null),e([k()],ie.prototype,"activeUtilityNetworkAssociationAddAssociationViewModel",null),e([k()],ie.prototype,"activeSketchViewModel",null),e([k()],ie.prototype,"canDeleteAssociation",null),e([k()],ie.prototype,"activeWorkflow",null),e([k()],ie.prototype,"data",void 0),e([k()],ie.prototype,"hasPreviousStep",null),e([k()],ie.prototype,"hasUpdatableCandidates",null),e([k()],ie.prototype,"nestedWorkflowCount",null),e([k()],ie.prototype,"shouldShowAttachments",null),e([k()],ie.prototype,"shouldAllowAttachmentEditing",null),e([k()],ie.prototype,"hasPendingEdits",null),e([k()],ie.prototype,"helpMessage",null),e([k()],ie.prototype,"noticeMessage",null),e([k()],ie.prototype,"reliesOnOwnerAdminPrivileges",null),e([k()],ie.prototype,"hasInvalidFormTemplate",null),e([k()],ie.prototype,"curveResizeDisabled",null),e([k()],ie.prototype,"curveUpdatesDisabled",null),ie=te=e([m("esri.widgets.Editor.UpdateWorkflow")],ie);const se=ie;export{se as default};
2
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{remove as i}from"../../core/arrayUtils.js";import o from"../../core/Error.js";import{makeHandle as a}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{abortMaybe as s}from"../../core/maybe.js";import{onAbort as n,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,watch as w,sync as h,on as f,when as g}from"../../core/reactiveUtils.js";import{last as v}from"../../core/SetUtils.js";import{property as k,subclass as m}from"../../core/accessorSupport/decorators.js";import{getGraphicLayer as y}from"../../graphic/graphicOriginUtils.js";import{isEditableLayer as W}from"../../layers/support/editableLayers.js";import{isSubtypeSublayer as A,isSubtypeGroupLayer as _,isTable as b}from"../../layers/support/layerUtils.js";import{findUtilityNetwork as S,isGraphicForRelatableFeatureSupportedLayer as M}from"../../popup/support/featureUtils.js";import{createFeatureServices as C}from"../../rest/featureService/utils.js";import F from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as U}from"../../views/input/InputManager.js";import{temporaryHighlightName as R}from"../../views/support/HighlightDefaults.js";import{isAssociationsLayerUnion as E}from"../BatchAttributeForm/batchAttributeFormUtils.js";import I from"./CreateFeaturesWorkflow.js";import j from"./MergeFeaturesWorkflow.js";import P from"./SplitFeatureWorkflow.js";import V from"./UpdateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as N}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as O}from"./UpdateRecordWorkflow.js";import T from"./UpdateWorkflowData.js";import x from"./Workflow.js";import{findEditorItemForLayer as D,isSplitFeatureWorkflow as L,workflowInfluencesOutcomeOfParent as H,isAnyUpdateLeafWorkflow as z,isUpdateRecordWorkflow as B,isParentWorkflow as G,findEditorItemForLayerOrThrow as q,createWorkflowSteps as Q,fetchCandidates as $,isUpdateFeaturesWorkflowOptions as J,toFeatureInfos as K,isMergeWorkflowOptions as X,isSplitWorkflowOptions as Y}from"./workflowUtils.js";import{assertFeaturesAreFromSameLayer as Z}from"./support/errors.js";var ee;let te=ee=class extends x{constructor(e){super(e),this._workflowStack=new p(v),this._sketchStack=new p(v),this.data=void 0,this.type="update"}destroy(){this._drainWorkflowStack(e=>e.cancel({force:!0}))}get formViewModel(){return this.activeWorkflow?.formViewModel}get activeUtilityNetworkAssociationAddAssociationViewModel(){return"add-association"===this.activeWorkflow?.type?this.activeWorkflow.utilityNetworkAssociationAddAssociationViewModel:null}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get canDeleteAssociation(){const{formViewModel:e}=this;return!!(this.activeWorkflow&&this.data.viewModel.view?.map&&e)&&!(!e.activeAssociation||!E(e.activeFeature?.sourceLayer))}get activeWorkflow(){return this._workflowStack.last()}getUpdating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){return this._stepIndex>0||this.nestedWorkflowCount>1||this.activeWorkflow?.hasPreviousStep||"view"!==this.data.viewModel.attachmentsViewModel.mode||!!this.activeWorkflow?.formViewModel?.canGoBack}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some(({layer:e})=>D(t.editorItems,e)?.supportsUpdateWorkflow)}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return this.activeWorkflow?.shouldShowAttachments??!1}get shouldAllowAttachmentEditing(){return this.activeWorkflow?.shouldAllowAttachmentEditing??!1}get hasPendingEdits(){return Array.from(this._workflowStack).some(e=>e.hasPendingEdits)}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get noticeMessage(){return this.activeWorkflow?.noticeMessage}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return this.activeWorkflow?.hasInvalidFormTemplate??!1}get curveResizeDisabled(){return this.activeWorkflow?.curveResizeDisabled??!1}get curveUpdatesDisabled(){return this.activeWorkflow?.curveUpdatesDisabled??!1}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this,i=t?.formViewModel;if("add-association"===t?.type){const{activeUtilityNetworkAssociationAddAssociationViewModel:e}=this;if(e?.filterOptionsVisible)return void(e.filterOptionsVisible=!1);if(e?.featureSpatialItems.length)return void e.reset()}if(i?.canGoBack)await i.goBack();else if("create-features"===t?.type&&t.hasPreviousStep)await t.previous({cancelCurrentStep:!0});else{if(L(t)&&t.hasPreviousStep)return await t.back();if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0})}}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflowAndReconcile()}async commit(){await this._drainWorkflowStack(e=>e.commit()),await super.commit()}static create(e){const{startAt:t,applyEdits:i,applyEditsFeatureService:o,...a}=e,r=new ee({data:new T({applyEditsCallback:i,applyEditsFeatureServiceCallback:o,...a}),onCommit:async()=>{}});return r._set("steps",this._createWorkflowSteps(r,t)),r}async save(e){const{formViewModel:t}=this;if(t&&(await t.submit(),!t.valid))return;if(this.nestedWorkflowCount<2)return await this.commit();const{activeWorkflow:i}=this;if(await(i?.commit(e)),!H(i))return void await this._popWorkflowAndReconcile();this._popWorkflow();const o=this._workflowStack.peek();if(o&&o===i?.parent&&(await o.cancel(),this._popWorkflow(),0===this.nestedWorkflowCount))return await this.commit();await this._reconcileWorkflowStack()}async startCreatingRelatedRecord(e){const t=this._makeUpdatingResolver();try{const t=this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflowAndReconcile(t)}catch(i){throw new o("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:i})}finally{t.resolve()}}async startMergingFeatures(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedMergeFeaturesWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-merging","Could not begin merging the provided features.",{error:a})}finally{i.resolve()}}async startSplittingFeature(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedSplitFeatureWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-splitting","Could not begin splitting the provided feature.",{error:a})}finally{i.resolve()}}async startUpdatingSingle(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedUpdateWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:a})}finally{i.resolve()}}async startUpdatingMultiple(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedUpdateFeaturesWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-updating","Could not begin updating the provided features or table records.",{error:a})}finally{i.resolve()}}async startAddAssociation(e){const t=this._makeUpdatingResolver();try{const t=await this._createNestedAddAssociationWorkflow(e);await this._pushWorkflowAndReconcile(t)}catch(i){throw new o("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:i})}finally{t.resolve()}}async deleteActiveFeatures(){const{activeWorkflow:e}=this;if(!e)throw new o("editor:nothing-to-delete","There is no feature to delete");const t=z(e);if(t){e.data.stageDelete();const t=B(e)?e.data.edits.feature?[e.data.edits.feature]:[]:e.data.features;this._removeFeaturesFromCandidates(t)}else await e.cancel();this.nestedWorkflowCount<2?t?await this.commit():await this.cancel({force:!0}):(t&&await e.commit(),await this._popWorkflowAndReconcile(),await this._returnToPageWithContent())}async deleteActiveAssociation(){if(!this.canDeleteAssociation)throw new o("editor:nothing-to-delete","There is no association to delete");await this._deleteActiveAssociation(),await this._popWorkflowAndReconcile(),await this._returnToPageWithContent()}async cancelAll(){await this._drainWorkflowStack(e=>e.cancel({force:!0}))}async _deleteActiveAssociation(){const{formViewModel:e}=this;if(!e)throw new o("editing:failed-to-delete-association","The active workflow does not support editing associations");const{activeAssociation:t,activeFeature:i}=e,{applyEditsFeatureServiceCallback:a,viewModel:r}=this.data,{sourceLayer:s}=i,n=A(s)&&s.parent?s.parent:s,l=C([n]),d=l.values().next().value?.featureService;if(!d)throw new o("editor:failed-to-delete-association","Could not retrieve feature service needed to delete association");await(d?.load());const c=r.view.map,p=S(c,n);await(p?.networkSystemLayers.loadAssociationsTable());const u=p?.generateDeleteAssociations([t]);if(!u)throw new o("editor:failed-to-delete-association","Could not create payload needed to delete association");const w=p?.gdbVersion??void 0;await a(d,[u],{gdbVersion:w,globalIdUsed:!0})}_removeFeaturesFromCandidates(e){const{candidates:t}=this.data;if(0!==t.length&&0!==e.length)for(const o of e)i(t,o)}async _returnToPageWithContent(){const{formViewModel:e}=this;if(!e?.activeAssociationsInput)return;const{activeAssociationsInput:t}=e;await t.refresh(),t.associatedLayer&&!t.associatedFeatures?.length&&e.setActiveAssociationsLayer(null),t.associatedFeatureInfos.size||e.setActiveAssociationsInput(null)}_createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:i,applyEditsCallback:a,applyEditsFeatureServiceCallback:r,sketchOptions:s,snappingManager:n,viewModel:l}=this.data;if(!W(t))throw new o("editor:unsupported-layer","Editing is not supported on the provided layer");const d=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),c=d.template||d.initialFeature?"creating-features":"awaiting-feature-creation-info",p=G(this.activeWorkflow)?this.activeWorkflow:void 0;return I.create({addAttachmentsCallback:i,applyEdits:a,applyEditsFeatureService:r,creationInfo:d,isNested:!0,parent:p,sketchOptions:s,snappingManager:n,startAt:c,viewModel:l})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:i}=e;if(!W(i)||_(i))throw new o("editor:unsupported-layer","Editing is not supported on the provided layer");const{viewModel:a}=this.data,r={layer:i,maxFeatures:1},s=this._makeRelatedRecordAttributes(e),n=a.getTemplatesForLayer(i);return n?.length>0?(r.attributeOverrides=s,1===n.length&&(r.template=n[0])):r.initialFeature=new t({sourceLayer:i,attributes:s}),r}async _createNestedUpdateWorkflow(e,t={}){const i=b(e.sourceLayer)?O:N,{applyEditsCallback:o,applyEditsFeatureServiceCallback:a,sketchOptions:r,snappingManager:s,viewModel:n}=this.data,l=G(this.activeWorkflow)?this.activeWorkflow:void 0,d=await i.create({feature:e,parent:l,sketchOptions:r,snappingManager:s,viewModel:n,applyEdits:o,applyEditsFeatureService:a,formCallbacks:{addRelatedRecord:e=>{this.startCreatingRelatedRecord(e)},editRelatedRecord:({relatedFeature:e,readOnly:t})=>{this.startUpdatingSingle(e,{readOnly:t})},editAssociatedFeature:async({feature:e,association:t})=>await this.startUpdatingSingle(e,{association:t}),addAssociation:e=>{this.startAddAssociation(e)}},...t});return await u(()=>!d.updating),d}async _createNestedUpdateFeaturesWorkflow(e,t={}){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,viewModel:a}=this.data,r=V.create({applyEdits:i,applyEditsFeatureService:o,featureInfos:e,viewModel:a,...t});return await u(()=>!r.updating),r}async _createNestedAddAssociationWorkflow(e){const{feature:t,associationType:i,utilityNetwork:a}=e,{AddAssociationWorkflow:r}=await import("./AddAssociationWorkflow.js"),{applyEditsCallback:s,applyEditsFeatureServiceCallback:n,viewModel:l}=this.data,d=G(this.activeWorkflow)?this.activeWorkflow:void 0,{formViewModel:c}=this,p=c?.activeAssociationsInput;if(!p)throw new o("editing:unable-to-add-association","There is no active association input in the current workflow's form.");const w=await r.create({utilityNetwork:a,associationType:i,feature:t,parent:d,viewModel:l,associationsInput:p,applyEdits:s,applyEditsFeatureService:n});return await u(()=>!w.updating),w}async _createNestedMergeFeaturesWorkflow(e,t){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,viewModel:a}=this.data;Z(e);const r=q(this.data.viewModel.editorItems,y(e[0])),s=G(this.activeWorkflow)?this.activeWorkflow:void 0,n=await j.create({applyEdits:i,applyEditsFeatureService:o,editorItem:r,features:e,parent:s,viewModel:a,...t});return await u(()=>!n.updating),n}async _createNestedSplitFeatureWorkflow(e,t){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,sketchOptions:a,snappingManager:r,viewModel:s}=this.data,n=G(this.activeWorkflow)?this.activeWorkflow:void 0,l=q(s.editorItems,e.sourceLayer),d=P.create({applyEdits:i,applyEditsFeatureService:o,editorItem:l,feature:e,parent:n,sketchOptions:a,snappingManager:r,viewModel:s,...t});return await u(()=>!d.updating),d}async _drainWorkflowStack(e){const t=this._workflowStack,i=[];for(const o of t){const t=e(o).finally(()=>o.destroy());this._updatingHandles.consumePromise(t),i.push(t)}await Promise.all(i),this._workflowStack.clear(),this._sketchStack.clear()}_makeUpdatingResolver(){const e=Promise.withResolvers();return this._updatingHandles.consumePromise(e.promise),e}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:i,relationshipId:o}=e;if(!M(t))return;const a=i.relationships?.find(e=>e.id===o);if(!a)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===a.role)return void this._logContinuingWithoutRelationshipWarning("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;a.relatedTableId!==r.layerId&&this._logContinuingWithoutRelationshipWarning("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const s=r.relationships?.find(e=>e.id===o);if(!s)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const n=ie(r,s),l=t.getAttribute(n);l||this._logContinuingWithoutRelationshipWarning("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=ie(i,a);return{[d]:l}}_popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop()}async _popWorkflowAndReconcile(){this._popWorkflow();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new o("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflowAndReconcile(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const i=this._sketchStack,a=await(e?.start()),r=i.peek();a?(r?.exit(),i.push(a)):i.push(this._cloneSketchController(r)),this._workflowStack.push(e);const s=await this._reconcileWorkflowStack();if(s.failureCount>0)throw new o("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",s)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const i=e.peek();return await(i?.enter()),await(t.peek()?.enter()),{activeWorkflow:i,failureCount:0}}catch(i){e.pop().destroy(),t.pop();const{activeWorkflow:o,failureCount:a}=await this._reconcileWorkflowStack();return{activeWorkflow:o,failureCount:a+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!b(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:i}=e;return Q(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=i.viewModel,o=i.viewModel.view;o.activeTool=null;let r=null;e.addHandles(a(()=>{r=s(r)}),this.id),i.rootFeatures.removeAll(),i.candidates=[];const c=o.on("immediate-click",async a=>{const s=Promise.withResolvers();e._updatingHandles.consumePromise(s.promise);try{t.location=a.mapPoint,t.visible=!0,r?.abort();const{editorItems:s}=i.viewModel;r=new AbortController;const c=await a.defer(()=>new Promise((e,t)=>{n(r?.signal,()=>t(l())),e($(s,o,a,r?.signal))}));if(d(r),i.candidates=c.filter(e=>"fulfilled"===e.status).flatMap(e=>e.value).filter(e=>!e.isAggregate),t.visible=1===i.candidates.length,0===i.candidates.length)return;if(a.stopPropagation(),1===i.candidates.length){const{rootFeatures:o}=i;o.removeAll(),o.add(i.candidates[0]),e.go("editing-existing-feature").catch(()=>{}).then(()=>t.visible=!1)}else e.next()}finally{s.resolve()}},U.TOOL),p=g(()=>null!=o.activeTool,()=>e.cancel({force:!0}),{once:!0});o.focus(),e.addHandles([c,p],this.id)},async tearDown(){0===i.candidates.length&&(i.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){i.rootFeatures.removeAll();const{view:t}=i.viewModel;if(!t)return;const o=new F({view:t,highlightName:R});e.addHandles([f(()=>i.rootFeatures,"change",({added:e,removed:t})=>{t.forEach(e=>o.remove(e)),e.forEach(e=>o.add(e))},h),a(()=>o.removeAll())],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){await oe(e);const{data:t}=e;t.viewModel.spinnerViewModel.visible=!1;const i=c(async()=>{await u(()=>!e.updating),e.previous()});e.addHandles([w(()=>e.nestedWorkflowCount,(e,t)=>{0===e&&0!==t&&i()},h)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}})})}_logContinuingWithoutRelationshipWarning(e,t){r.getLogger(this).warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature.")}};function ie(e,{keyField:t}){return e.getField(t)?.name??t}async function oe(e){const{data:t}=e,{rootWorkflowOptions:i}=t;if(J(i)){const{rootFeatureInfos:a}=t,r=a.length>0?a:K(t.rootFeatures.toArray());if(0===r.length)throw new o("editing:invalid-parameter","Must supply `rootFeatureInfos` or `rootFeatures` when root workflow type is 'update-multiple'");return await e.startUpdatingMultiple(r,i.props)}const{rootFeatures:a}=t,r=a.getItemAt(0);if(!r)throw new o("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until one or more root features are provided");X(i)?await e.startMergingFeatures(a.toArray(),i.props):Y(i)?await e.startSplittingFeature(r,i.props):await e.startUpdatingSingle(r)}e([k()],te.prototype,"formViewModel",null),e([k()],te.prototype,"activeUtilityNetworkAssociationAddAssociationViewModel",null),e([k()],te.prototype,"activeSketchViewModel",null),e([k()],te.prototype,"canDeleteAssociation",null),e([k()],te.prototype,"activeWorkflow",null),e([k()],te.prototype,"data",void 0),e([k()],te.prototype,"hasPreviousStep",null),e([k()],te.prototype,"hasUpdatableCandidates",null),e([k()],te.prototype,"nestedWorkflowCount",null),e([k()],te.prototype,"shouldShowAttachments",null),e([k()],te.prototype,"shouldAllowAttachmentEditing",null),e([k()],te.prototype,"hasPendingEdits",null),e([k()],te.prototype,"helpMessage",null),e([k()],te.prototype,"noticeMessage",null),e([k()],te.prototype,"reliesOnOwnerAdminPrivileges",null),e([k()],te.prototype,"hasInvalidFormTemplate",null),e([k()],te.prototype,"curveResizeDisabled",null),e([k()],te.prototype,"curveUpdatesDisabled",null),te=ee=e([m("esri.widgets.Editor.UpdateWorkflow")],te);const ae=te;export{ae as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{substitute as e}from"../../../intl/substitute.js";import{css as t}from"../css.js";import{isCreateFeaturesWorkflow as o,isSplitFeatureWorkflow as i,isMergeFeaturesWorkflow as n,isUpdateFeaturesWorkflow as s,isBatchAttributeFormViewModel as a,isUpdateFeatureWorkflow as l}from"../workflowUtils.js";import{loadFooterActionsComponents as r,FooterActions as c}from"./FooterActions.js";import u from"./MergeFeaturesList.js";import{loadNoticesComponents as m,Notices as p}from"./Notices.js";import{loadPanelContentComponents as d,PanelContentSection as f,PanelContentSectionGroup as g,PanelContent as w}from"./PanelContent.js";import k from"./PendingFeatureList.js";import{loadCalciteComponents as b}from"../../support/componentsUtils.js";import{Heading as v,incrementHeadingLevel as h}from"../../support/Heading.js";import{tsx as F,tsxFragment as y}from"../../support/widget.js";import{classes as A}from"../../support/widgetUtils.js";const j=()=>Promise.all([b({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),action:()=>import("@esri/calcite-components/dist/components/calcite-action")}),r(),m(),d()]);function C(e){const{editorViewModel:l,headingLevel:r,messages:m,renderAttachments:d,renderFeatureForm:b,renderBatchAttributeForm:A,renderSketchToolbar:j}=e,{activeFeatureCount:C,activeLeafWorkflow:S,activeWorkflow:T,formViewModel:B}=l;if(!S||!T||!B)return null;const V=a(B),z=o(S)&&!S.data.selectedPendingFeature||i(S)&&!S.activeFeature,x=n(S),D=S.shouldShowAttachments&&!V&&!B.activeRelationshipInput&&!B.activeAssociationInput,I=V?B.activeForm.inputs:B.inputs,W=o(S)&&I.every(e=>!e.visible)&&!D,H=null!=l.featureFormViewModel?.activeAssociationInput,P=!z&&!W&&!H,U=W||o(S)&&!D&&!P&&!H,E=s(S)?A:b,N=W?F(f,null,F(k,{headingLevel:r,key:"pending-feature-list",workflow:S})):F(y,null,F(p,{activeFeatureCount:C,messages:m,workflow:T}),x?F(f,{class:t.mergeFeaturesListSection,key:"panel-section-merge"},F(u,{headingLevel:r,key:"merge-features-list",workflow:S})):void 0,F(f,{key:"panel-content-section-main"},F(g,null,z?F(k,{headingLevel:r,key:"pending-feature-list",workflow:S}):E(),D?F("div",{key:"attachments"},F(v,{level:h(r)},m.attachments),d()):null)));return F(y,null,P?M(S,e):void 0,U?j?.():void 0,F(w,{key:"attribute-panel-content"},N),F(c,{buttons:L(e)}))}function M(e,o){const i=[],n="3d"===o.editorViewModel.view?.type,{visibleElements:a}=o,r="s";if(a.zoomToButton&&o.editorViewModel.canZoomTo&&i.push(F("calcite-action",{alignment:"center",icon:"zoom-to-object",key:"zoom-to-button",scale:r,text:o.messages.zoomTo,title:o.messages.zoomTo,onclick:()=>o.editorViewModel.zoomTo()})),a.splitButton&&l(e)&&e.supportsSplitFeatureWorkflow&&!n&&o.onSplit){const{onSplit:e,messages:t}=o;i.push(F("calcite-action",{icon:"split-geometry",key:"split-button",scale:r,text:t.split,title:t.split,onclick:e}))}if(a.mergeButton&&s(e)&&e.supportsMergeFeaturesWorkflow&&!n&&o.onMerge){const{onMerge:e,messages:t}=o;i.push(F("calcite-action",{icon:"merge",key:"merge-button",scale:r,text:t.mergeFeatures,title:t.mergeFeatures,onclick:e}))}return i.length>0?F("calcite-action-bar",{class:A(t.sketchContainer,t.updateActionBar),"data-testid":"update-feature-panel-action-bar",expandDisabled:!0,layout:"horizontal",scale:r},i):void 0}function L({editorViewModel:t,messages:o,messagesCommon:i,onDelete:n,onDeleteAssociation:s,onSave:a}){const{activeFeatureCount:l,activeLeafWorkflow:r,syncing:c}=t;if(!r)return[];const{page:u}=t;if("viewing-associated-features"===u||"viewing-associated-layers"===u)return[{appearance:"outline",onClick:()=>{const{featureFormViewModel:e}=t;null!=e?.associationId&&(e.associationId=null)},disabled:c,label:i.cancel,type:"button"}];const m=[],p=l>1?o.multiFeature:o.singleFeature,d=!r.allowSave||c,f=e(p[r.saveActionLabel],{count:l});m.push({appearance:"solid",onClick:a,disabled:d,label:f,type:"button"});const g={appearance:"outline",disabled:c,kind:"danger",label:e(p.delete,{count:l}),type:"button"};return t.shouldShowDeleteButton&&!t.featureFormHasAssociation&&n&&m.push({...g,onClick:n}),t.featureFormHasAssociation&&!t.shouldShowDeleteButton&&s&&m.push({...g,onClick:s,label:o.deleteAssociationTitle}),t.featureFormHasAssociation&&t.shouldShowDeleteButton&&s&&n&&m.push({...g,primaryLabel:i.delete,primaryText:i.delete,onClick:n,dropdownItems:[{onClick:s,label:o.deleteAssociationTitle}],type:"split-button"}),m}export{C as UpdateFeaturePanelContent,j as loadUpdateFeaturePanelContentComponents};
2
+ import{substitute as e}from"../../../intl/substitute.js";import{css as t}from"../css.js";import{isCreateFeaturesWorkflow as o,isSplitFeatureWorkflow as i,isMergeFeaturesWorkflow as n,isUpdateFeatureWorkflow as s,isUpdateFeaturesWorkflow as a}from"../workflowUtils.js";import{loadFooterActionsComponents as l,FooterActions as r}from"./FooterActions.js";import c from"./MergeFeaturesList.js";import{loadNoticesComponents as u,Notices as p}from"./Notices.js";import{loadPanelContentComponents as m,PanelContentSection as d,PanelContentSectionGroup as f,PanelContent as g}from"./PanelContent.js";import k from"./PendingFeatureList.js";import{loadCalciteComponents as w}from"../../support/componentsUtils.js";import{Heading as b,incrementHeadingLevel as v}from"../../support/Heading.js";import{tsx as h,tsxFragment as y}from"../../support/widget.js";import{classes as F}from"../../support/widgetUtils.js";const j=()=>Promise.all([w({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),action:()=>import("@esri/calcite-components/dist/components/calcite-action")}),l(),u(),m()]);function A(e){const{editorViewModel:s,formWidget:a,headingLevel:l,messages:u,renderAttachments:m,renderSketchToolbar:w}=e,{activeFeatureCount:F,activeLeafWorkflow:j,activeWorkflow:A,formViewModel:L}=s;if(!j||!A||!L)return null;const S=o(j)&&!j.data.selectedPendingFeature||i(j)&&!j.activeFeature,B=n(j),T=j.shouldShowAttachments&&!L.activeRelationshipInput&&!L.activeAssociationsInput,V=L.activeForm.inputs,z=o(j)&&V.every(e=>!e.visible)&&!T,W=null!=s.formViewModel?.activeAssociationsInput,x=!S&&!z&&!W,D=z||o(j)&&!T&&!x&&!W,I=z?h(d,null,h(k,{headingLevel:l,key:"pending-feature-list",workflow:j})):h(y,null,h(p,{activeFeatureCount:F,messages:u,workflow:A}),B?h(d,{class:t.mergeFeaturesListSection,key:"panel-section-merge"},h(c,{headingLevel:l,key:"merge-features-list",workflow:j})):void 0,h(d,{key:"panel-content-section-main"},h(f,null,S?h(k,{headingLevel:l,key:"pending-feature-list",workflow:j}):a.render(),T?h("div",{key:"attachments"},h(b,{level:v(l)},u.attachments),m()):null)));return h(y,null,x?C(j,e):void 0,D?w?.():void 0,h(g,{key:"attribute-panel-content"},I),h(r,{buttons:M(e)}))}function C(e,o){const i=[],n="3d"===o.editorViewModel.view?.type,{visibleElements:l}=o,r="s";if(l.zoomToButton&&o.editorViewModel.canZoomTo&&i.push(h("calcite-action",{alignment:"center",icon:"zoom-to-object",key:"zoom-to-button",scale:r,text:o.messages.zoomTo,title:o.messages.zoomTo,onclick:()=>o.editorViewModel.zoomTo()})),l.splitButton&&s(e)&&e.supportsSplitFeatureWorkflow&&!n&&o.onSplit){const{onSplit:e,messages:t}=o;i.push(h("calcite-action",{icon:"split-geometry",key:"split-button",scale:r,text:t.split,title:t.split,onclick:e}))}if(l.mergeButton&&a(e)&&e.supportsMergeFeaturesWorkflow&&!n&&o.onMerge){const{onMerge:e,messages:t}=o;i.push(h("calcite-action",{icon:"merge",key:"merge-button",scale:r,text:t.mergeFeatures,title:t.mergeFeatures,onclick:e}))}return i.length>0?h("calcite-action-bar",{class:F(t.sketchContainer,t.updateActionBar),"data-testid":"update-feature-panel-action-bar",expandDisabled:!0,layout:"horizontal",scale:r},i):void 0}function M({editorViewModel:t,formWidget:o,messages:i,messagesCommon:n,onDelete:s,onDeleteAssociation:a,onSave:l}){const{activeFeatureCount:r,activeLeafWorkflow:c,syncing:u}=t;if(!c)return[];const{page:p}=t;if("viewing-associated-features"===p||"viewing-associated-layers"===p)return[{appearance:"outline",onClick:()=>{c.formViewModel?.goBack()},disabled:u,label:n.cancel,type:"button"}];const m=t.formViewModel,d=o.footerButtonInfos;if(m&&"default"!==m.page&&d.length)return d.map(({appearance:e,disabled:t,form:o,icon:i,kind:n,label:s,onclick:a})=>({appearance:e,disabled:t,form:o,icon:i,kind:n,label:s,onClick:a,type:"button"}));const f=[],g=r>1?i.multiFeature:i.singleFeature,k=!c.allowSave||u,w=e(g[c.saveActionLabel],{count:r});f.push({appearance:"solid",onClick:l,disabled:k,label:w,type:"button"});const b={appearance:"outline",disabled:u,kind:"danger",label:e(g.delete,{count:r}),type:"button"};return t.shouldShowDeleteButton&&!t.formHasAssociation&&s&&f.push({...b,onClick:s}),t.formHasAssociation&&!t.shouldShowDeleteButton&&a&&f.push({...b,onClick:a,label:i.deleteAssociationTitle}),t.formHasAssociation&&t.shouldShowDeleteButton&&a&&s&&f.push({...b,primaryLabel:n.delete,primaryText:n.delete,onClick:s,dropdownItems:[{onClick:a,label:i.deleteAssociationTitle}],type:"split-button"}),f}export{A as UpdateFeaturePanelContent,j as loadUpdateFeaturePanelContentComponents};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import{abortHandle as s}from"../../../core/handleUtils.js";import{debounce as a}from"../../../core/promiseUtils.js";import o from"../../../core/ReactiveMap.js";import{whenOnce as r,when as n,watch as l}from"../../../core/reactiveUtils.js";import{property as p,subclass as c}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../core/support/UpdatingHandles.js";import u from"../../../layers/GraphicsLayer.js";import{isSceneLayer as h}from"../../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as y,swapForEditingSession as m}from"../../../views/draw/support/editingSessionUtils.js";import v from"../../../views/interactive/sketch/SketchOptions.js";import{getVisualVariablesForLayer as g,setVisualVariablesAndElevationInfoForUpdate as f,visualVariableInteractiveUpdate as w,getSizeVariableAttribute as _,getRotationVariableAttribute as b}from"../workflowUtils.js";import k from"../../Sketch/SketchViewModel.js";const U=Symbol();let L=class extends t{constructor(e){super(e),this.features=[],this.onGeometriesUpdated=()=>{},this.onVisualVariableAttributesUpdated=()=>{},this.sketchOptions=new v,this.snappingManager=null,this.sourceLayer=null,this.view=null,this.viewModel=null,this.useLegacyCreateTools=!1,this._nextUpdateSubset=[],this._sketchGraphicsMap=new o,this._sketchLayer=null,this._updatingHandles=new d,this._visualVariableAttributes=new Map,this._visualVariablesForLayer=null,this._webStyleCache=new Map}async initialize(){this._visualVariablesForLayer=g(this.sourceLayer),this._nextUpdateSubset=this.features,this._initializeSketchGraphics(),this._initializeSketchLayer(),await this._updatingHandles.addPromise(this._initializeSketchViewModel())}destroy(){const{_sketchLayer:e,view:t}=this;t?.destroyed||t?.map.remove(e),this._updatingHandles.destroy(),e.destroy(),this.viewModel.destroy()}get defaultUpdateOptions(){const e=this.sourceLayer;return{multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!h(e)&&e.capabilities?.data.supportsTrueCurve}}}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",e)}get sketchGraphics(){return Array.from(this._sketchGraphicsMap.values())}get updating(){return this._updatingHandles.updating||!0===this.viewModel?.updating}async enter(){await this.startUpdatingFeatures(this._nextUpdateSubset)}async exit(){this._completeCurrentOperation()}notifyAttributesChanged({features:e,fieldName:t}){const i=this._webStyleCache,s=this.view.scale,a=this._updatingHandles;for(const o of e){const e=this._sketchGraphicsMap.get(o),r=o.getAttribute(t);if(!e||e.getAttribute(t)===r)continue;e.setAttribute(t,r);const n=this._visualVariableAttributes.get(o);null==n?.size||n.size.isUpdatingInteractively||n.size.field!==t||n.size.setInitialValue(r),null==n?.rotation||n.rotation.isUpdatingInteractively||n.rotation.field!==t||n.rotation.setInitialValue(r),a.consumePromise(y(e,i,s))}}async startUpdatingFeatures(e){const{onGeometriesUpdated:t,onVisualVariableAttributesUpdated:a,_sketchGraphicsMap:o,_sketchLayer:l,sourceLayer:p,view:c,viewModel:d,_webStyleCache:u}=this,h=e.map(e=>o.get(e)).filter(i),m={...this.defaultUpdateOptions};this._completeCurrentOperation();let v=null;if(1===e.length){const t=e[0],i=this._visualVariableAttributes.get(t);!(!i?.rotation&&!i?.size)&&(await f({graphic:h[0],sketchLayer:l,sketchViewModel:d,sourceLayer:p,visualVariables:i,webStyleCache:u}),"point"===p.geometryType&&(m.enableRotation=null!=i.rotation,m.enableScaling=null!=i.size,v=async e=>{const s=e.graphics[0];w(c,s,e,i)&&(a?.([{feature:t,attributes:s.attributes}],e),this._updatingHandles.consumePromise(y(s,u,"2d"===c.type?c.scale:null)))}))}else m.tool="move";const g=()=>d.update(h,m),_=d.on("update",a=>{if("complete"===a.state){if(null===c.activeTool)return void g();const e=new AbortController,t=s(e);return this.addHandles(t,U),void this._updatingHandles.consumePromise(r(()=>null===c.activeTool,e.signal).then(async()=>{e.signal.aborted||(e.abort(),await g())}))}const n=e.map(e=>{const t=o.get(e);return t?{feature:e,geometry:t.geometry}:null}).filter(i);t(n,a),v?.(a)});await g();const b=n(()=>null!=c.activeTool&&c.activeTool!==d.activeComponent,()=>d.cancel());this._nextUpdateSubset=this.features,this.addHandles([_,b],U),d.addHandles(b),d.addHandles(_)}_completeCurrentOperation(){this.removeHandles(U),this.viewModel.complete()}_initializeSketchGraphics(){const{features:e,_sketchGraphicsMap:t,sourceLayer:i,_visualVariableAttributes:s}=this,a=this._visualVariablesForLayer,o=a.rotation?.field,r=a.size?.field,n={rotation:o?i.getField(o):null,size:r?i.getField(r):null},l=!(!n.rotation&&!n.size);for(const p of e)t.set(p,p.clone()),l&&s.set(p,S(a,n))}_initializeSketchLayer(){const{view:e}=this,t=new u({elevationInfo:this.sourceLayer.elevationInfo,internal:!0,listMode:"hide",title:"SketchController layer"});this._sketchLayer=t,e.map.add(t),this._updatingHandles.consumePromise(e.whenLayerView(t))}async _initializeSketchViewModel(){const{defaultUpdateOptions:e,sketchOptions:t,snappingManager:i,useLegacyCreateTools:s,view:o,_sketchGraphicsMap:r,_sketchLayer:n,_webStyleCache:p}=this,c=Array.from(r.entries()),d=new k({allowDeleteKey:!1,defaultUpdateOptions:e,layer:n,sketchOptions:t,snappingManager:i,useLegacyCreateTools:s,updateOnGraphicClick:!1,view:o});this.viewModel=d;const u=a(e=>Promise.all(c.map(([,t])=>y(t,p,e))));await u("2d"===o.type?o.scale:null),"2d"===o.type&&this.addHandles(l(()=>o.scale,e=>u(e))),this.addHandles(await Promise.all(c.map(([e,t])=>m(n,o,e,t))))}};function S({rotation:e,size:t},i){return{rotation:e?b(e,i.rotation):null,size:t?_(t,i.size):null}}e([p()],L.prototype,"defaultUpdateOptions",null),e([p()],L.prototype,"features",void 0),e([p()],L.prototype,"onGeometriesUpdated",void 0),e([p()],L.prototype,"onVisualVariableAttributesUpdated",void 0),e([p()],L.prototype,"sketchGraphics",null),e([p()],L.prototype,"sketchOptions",void 0),e([p()],L.prototype,"snappingManager",void 0),e([p()],L.prototype,"sourceLayer",void 0),e([p()],L.prototype,"updating",null),e([p()],L.prototype,"view",void 0),e([p()],L.prototype,"viewModel",void 0),e([p()],L.prototype,"useLegacyCreateTools",void 0),e([p()],L.prototype,"_nextUpdateSubset",void 0),e([p()],L.prototype,"_sketchGraphicsMap",void 0),e([p()],L.prototype,"_sketchLayer",void 0),e([p()],L.prototype,"_visualVariablesForLayer",void 0),L=e([c("esri.widgets.Editor.support.SketchController")],L);export{L as SketchController};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import{abortHandle as s}from"../../../core/handleUtils.js";import{debounce as a}from"../../../core/promiseUtils.js";import o from"../../../core/ReactiveMap.js";import{whenOnce as r,when as n,watch as l}from"../../../core/reactiveUtils.js";import{property as p,subclass as c}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../core/support/UpdatingHandles.js";import u from"../../../layers/GraphicsLayer.js";import{isSceneLayer as h}from"../../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as y,swapForEditingSession as m}from"../../../views/draw/support/editingSessionUtils.js";import v from"../../../views/interactive/sketch/SketchOptions.js";import{getVisualVariablesForLayer as g,setVisualVariablesAndElevationInfoForUpdate as f,visualVariableInteractiveUpdate as w,getSizeVariableAttribute as _,getRotationVariableAttribute as b}from"../workflowUtils.js";import k from"../../Sketch/SketchViewModel.js";const U=Symbol();let L=class extends t{constructor(e){super(e),this.features=[],this.onGeometriesUpdated=()=>{},this.onVisualVariableAttributesUpdated=()=>{},this.sketchOptions=new v,this.snappingManager=null,this.sourceLayer=null,this.view=null,this.viewModel=null,this.useLegacyCreateTools=!1,this._nextUpdateSubset=[],this._sketchGraphicsMap=new o,this._sketchLayer=null,this._updatingHandles=new d,this._visualVariableAttributes=new Map,this._visualVariablesForLayer=null,this._webStyleCache=new Map}async initialize(){this._visualVariablesForLayer=g(this.sourceLayer),this._nextUpdateSubset=this.features,this._initializeSketchGraphics(),this._initializeSketchLayer(),await this._updatingHandles.addPromise(this._initializeSketchViewModel())}destroy(){const{_sketchLayer:e,view:t}=this;t?.destroyed||t?.map.remove(e),this._updatingHandles.destroy(),e.destroy(),this.viewModel.destroy()}get defaultUpdateOptions(){const e=this.sourceLayer;return{multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!h(e)&&e.capabilities?.data.supportsTrueCurve}}}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",e)}get sketchGraphics(){return Array.from(this._sketchGraphicsMap.values())}get updating(){return this._updatingHandles.updating||!0===this.viewModel?.updating}async enter(){await this.startUpdatingFeatures(this._nextUpdateSubset)}async exit(){this._completeCurrentOperation()}notifyAttributesChanged(e,t){const i=this._sketchGraphicsMap.get(e);if(!i)return;const s=this._webStyleCache,a=this.view.scale,o=this._updatingHandles;for(const{fieldName:r,value:n}of t){if(i.getAttribute(r)===n||"number"!=typeof n)continue;i.setAttribute(r,n);const t=this._visualVariableAttributes.get(e);null==t?.size||t.size.field!==r||t.size.isUpdatingInteractively||t.size.setInitialValue(n),null==t?.rotation||t.rotation.field!==r||t.rotation.isUpdatingInteractively||t.rotation.setInitialValue(n),o.consumePromise(y(i,s,a))}}async startUpdatingFeatures(e){const{onGeometriesUpdated:t,onVisualVariableAttributesUpdated:a,_sketchGraphicsMap:o,_sketchLayer:l,sourceLayer:p,view:c,viewModel:d,_webStyleCache:u}=this,h=e.map(e=>o.get(e)).filter(i),m={...this.defaultUpdateOptions};this._completeCurrentOperation();let v=null;if(1===e.length){const t=e[0],i=this._visualVariableAttributes.get(t);!(!i?.rotation&&!i?.size)&&(await f({graphic:h[0],sketchLayer:l,sketchViewModel:d,sourceLayer:p,visualVariables:i,webStyleCache:u}),"point"===p.geometryType&&(m.enableRotation=null!=i.rotation,m.enableScaling=null!=i.size,v=async e=>{const s=e.graphics[0];w(c,s,e,i)&&(a?.([{feature:t,attributes:s.attributes}],e),this._updatingHandles.consumePromise(y(s,u,"2d"===c.type?c.scale:null)))}))}else m.tool="move";const g=()=>d.update(h,m),_=d.on("update",a=>{if("complete"===a.state){if(null===c.activeTool)return void g();const e=new AbortController,t=s(e);return this.addHandles(t,U),void this._updatingHandles.consumePromise(r(()=>null===c.activeTool,e.signal).then(async()=>{e.signal.aborted||(e.abort(),await g())}))}const n=e.map(e=>{const t=o.get(e);return t?{feature:e,geometry:t.geometry}:null}).filter(i);t(n,a),v?.(a)});await g();const b=n(()=>null!=c.activeTool&&c.activeTool!==d.activeComponent,()=>d.cancel());this._nextUpdateSubset=this.features,this.addHandles([_,b],U),d.addHandles(b),d.addHandles(_)}_completeCurrentOperation(){this.removeHandles(U),this.viewModel.complete()}_initializeSketchGraphics(){const{features:e,_sketchGraphicsMap:t,sourceLayer:i,_visualVariableAttributes:s}=this,a=this._visualVariablesForLayer,o=a.rotation?.field,r=a.size?.field,n={rotation:o?i.getField(o):null,size:r?i.getField(r):null},l=!(!n.rotation&&!n.size);for(const p of e)t.set(p,p.clone()),l&&s.set(p,S(a,n))}_initializeSketchLayer(){const{view:e}=this,t=new u({elevationInfo:this.sourceLayer.elevationInfo,internal:!0,listMode:"hide",title:"SketchController layer"});this._sketchLayer=t,e.map.add(t),this._updatingHandles.consumePromise(e.whenLayerView(t))}async _initializeSketchViewModel(){const{defaultUpdateOptions:e,sketchOptions:t,snappingManager:i,useLegacyCreateTools:s,view:o,_sketchGraphicsMap:r,_sketchLayer:n,_webStyleCache:p}=this,c=Array.from(r.entries()),d=new k({allowDeleteKey:!1,defaultUpdateOptions:e,layer:n,sketchOptions:t,snappingManager:i,useLegacyCreateTools:s,updateOnGraphicClick:!1,view:o});this.viewModel=d;const u=a(e=>Promise.all(c.map(([,t])=>y(t,p,e))));await u("2d"===o.type?o.scale:null),"2d"===o.type&&this.addHandles(l(()=>o.scale,e=>u(e))),this.addHandles(await Promise.all(c.map(([e,t])=>m(n,o,e,t))))}};function S({rotation:e,size:t},i){return{rotation:e?b(e,i.rotation):null,size:t?_(t,i.size):null}}e([p()],L.prototype,"defaultUpdateOptions",null),e([p()],L.prototype,"features",void 0),e([p()],L.prototype,"onGeometriesUpdated",void 0),e([p()],L.prototype,"onVisualVariableAttributesUpdated",void 0),e([p()],L.prototype,"sketchGraphics",null),e([p()],L.prototype,"sketchOptions",void 0),e([p()],L.prototype,"snappingManager",void 0),e([p()],L.prototype,"sourceLayer",void 0),e([p()],L.prototype,"updating",null),e([p()],L.prototype,"view",void 0),e([p()],L.prototype,"viewModel",void 0),e([p()],L.prototype,"useLegacyCreateTools",void 0),e([p()],L.prototype,"_nextUpdateSubset",void 0),e([p()],L.prototype,"_sketchGraphicsMap",void 0),e([p()],L.prototype,"_sketchLayer",void 0),e([p()],L.prototype,"_visualVariablesForLayer",void 0),L=e([c("esri.widgets.Editor.support.SketchController")],L);export{L as SketchController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{handlesGroup as a,makeHandle as s,abortHandle as l}from"../../core/handleUtils.js";import{clone as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as d,isPromiseLike as f,whenOrAbort as y}from"../../core/promiseUtils.js";import{watch as m,on as h,whenOnce as g,when as b}from"../../core/reactiveUtils.js";import{px2pt as w}from"../../core/screenUtils.js";import{addMany as I}from"../../core/SetUtils.js";import{isSharedTemplateOrMetadata as v,isSharedGroupTemplate as T,getCreationAttributes as F,isSharedPresetTemplate as j}from"../../editing/templateUtils.js";import{isCurvedGeometry as S,hasUnsupportedCurve as k}from"../../geometry/support/curves/curveUtils.js";import A from"../../layers/GraphicsLayer.js";import{featureHasFields as O,fixFields as U,getDisplayFieldName as L}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as V}from"../../layers/support/layerUtils.js";import{calculateTolerance as M}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as x}from"../../renderers/support/lengthUtils.js";import{isRenderer as q}from"../../renderers/support/typeUtils.js";import{getTransformationType as z}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as P}from"../../support/graphicInstanceUtils.js";import E from"../../symbols/SimpleFillSymbol.js";import C from"../../symbols/SimpleLineSymbol.js";import R from"../../symbols/SimpleMarkerSymbol.js";import{to3D as D}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as G}from"../../symbols/support/symbolUtils.js";import{getServices as B}from"../../undoredo/support/Services.js";import{defaultDrawingMode as N}from"../../views/draw/drawingModes.js";import{updateGraphicSymbolWhenRequired as Z,fetchFullFeaturesByObjectId as W}from"../../views/draw/support/editingSessionUtils.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as Q,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as J}from"./support/dependencySort.js";import{isDrawGraphicTool as K,isDrawTool as X}from"../Sketch/support/sketchUtils.js";const Y=()=>u.getLogger("esri.widgets.Editor.workflowUtils");function _(e){return ie(e)||ne(e)}function ee(e){return!!e&&"features"in e}function te(e){return null!=e&&"create-features"===e.type}function re(e){return!!e&&"feature"in e}function ne(e){return null!=e&&"update-features"===e.type}function oe(e){return null!=e&&"update-feature"===e.type}function ie(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function ae(e){return null!=e&&"update"===e.type}function se(e){return null!=e&&"merge-features"===e.type}function le(e){return null!=e&&"split-feature"===e.type}function ce(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function ue(e){return"merge"===e?.type}function pe(e){return"split"===e?.type}function de(e){return se(e)||le(e)}function fe(e){return"update-multiple"===e?.type}function ye(e){const t=e&&"renderer"in e?e.renderer:null;if(!ve(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===z(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function me(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&ve(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=ye(t);let o=null,i=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=he(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;i=we(n,r)}return{rotation:o,size:i}}function he(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,Ie((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function ge(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 be(e,t,r){if(null==t)return 0;const{symbol:n}=D(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(ot.icon,(await e(o,ot.icon))[0])||ot.icon}case"text":return ot.text;case"line":return ot.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return ge(await t(o,e.scale/ot.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/ot.viewScaleSizeFactor;default:return 0}}function we(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},i=x[e.valueUnit]??1;let a;return a="area"===e.valueRepresentation?e=>(e*i/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*i/2:e=>e*i,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>Ie(a(await be(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,Ie(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:st(e.valueUnit),axis:e.axis}}function Ie(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 ve(e){if(!q(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}function Te(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:N,optionsPerTool:r};if(v(t)){const o=t.defaultTool,i=T(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===i?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===i?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function Fe(e,t,r,n){const{creationInfo:o,fullTemplate:a}=r;if(!o)throw new i("featureworkflow","No creation info provided.");const s=o.layer,l=F(a,o.attributeOverrides,o.layer),{view:c}=e,u="2d"===c?.type;T(a)||j(a)||await Ge(e,s,l,n,u?c.scale:null);const{capabilities:p}=s;t.elevationInfo=s.elevationInfo;const d=Te(s.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:l,sourceLayer:s},mode:d.createOptions.mode,optionsPerTool:d.createOptions.optionsPerTool,preserveAspectRatio:d.createOptions.preserveAspectRatio,hasZ:p.data.supportsZ,defaultZ:(u?p.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==o.geometryToPlace?await e.create(d.tool):await e.place(o.geometryToPlace,{graphicProperties:{attributes:l,sourceLayer:s}})}async function je(e){return a([Se(e),ke(e)])}function Se({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:o}){const{creationInfo:i}=t,{fullTemplate:a}=t;if(!i||"2d"!==n?.type||T(a)||j(a))return null;const s=d(t=>Ge(r,i.layer,e,o,t));return m(()=>n.scale,e=>s(e))}function ke({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const l=r.activeComponent;if(!n||!K(l)&&!X(l))return Y().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new A({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=o,d=n.theme?.accentColor??new e([255,165,0,1]);return a([h(()=>l,["cursor-update","vertex-add"],()=>{c.removeAll();const e=K(l)?l.graphic?.geometry:l.unprocessedGeometry;if(!e||!Ae(e))return;const t=u(e,"digitizing");if(!f(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Oe(e,d);t&&c.add(t)}}}),s(()=>{n.map.remove(c),c.destroy()})])}function Ae(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":{if(S(e))return e.curvePaths[0].length>1;const t=e.paths[0];return!!t&&t.length>1}case"polygon":{if(S(e))return e.curveRings[0].length>2;const t=e.rings[0];return!!t&&(n(t.at(0),t.at(-1))?t.length>2:t.length>1)}default:return!1}}function Oe(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new R({angle:0,color:r,outline:new C({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new E({color:r,outline:new C({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new C({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function Ue(e,t){const r=B(t),n=V(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function Le(e,t){const r=Ue(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function Ve(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Me(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:i}=e,a=xe(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=ze(t,a,i),p=Pe(l,qe(s,c),c);if(o&&Re(l,p,o),0===p.length)return t;const d=J(p,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=Ve(e):h.id!==e.layerId&&(m.push(h),h=Ve(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??Ve(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function xe(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function qe(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Ee(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(Ee(n,e),t.keyField);break}}return r}function ze(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function Pe(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:i}=o;for(const a of e){const e=a.keyField;if("origin"===a.role){const s=r.get(a.relatedTableId);if(!s||0===s.length)continue;const l=Ee(o.layer,a),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([i,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,i]):t.before.attributes[c]===o.after.attributes[e]&&n.push([i,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,i]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):n.push([r,i]):n.push([i,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,i]))}}}}return n}function Ee(e,t){return`${e.layerId}:${t.id}`}function Ce(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function Re(e,t,r){const n=[];for(const i of e)Ce(i.layer,r)&&n.push(i);if(0===n.length)return;let o=[];for(const i of n){const r=i.layer;switch(i.operationType){case"delete":o=[...De(i.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...De(i.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([i.uniqueId,e.uniqueId]);break;case"add":o=[...De(i.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...De(i.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,i.uniqueId])}}}function De(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}async function Ge(e,r,n,o,i){const a=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=me(a);let c=await G(a,{useSourceLayer:!0,webStyleCache:o,scale:i}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await G(a,{useSourceLayer:!0,webStyleCache:o,scale:i})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Be(e.tooltipOptions,l,s)}function Be(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 Ne(e,t){return e.find(e=>e.layer===t)}function Ze(e,t){const r=Ne(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function We(e,t){return e?.find(e=>e.layer===t)}async function $e(e,t,r,n){switch(t.type){case"3d":return Qe(e,t,r,n);case"2d":return He(e,t,r,n)}}async function Qe(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.defer(async()=>{const{results:o}=await y(H(t,r),n),i=new Map,a=e=>{const t=e.layer,r=i.get(t);if(!r){const e=new Array;return i.set(t,e),e}return r};Q(o).forEach(({graphic:e})=>a(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&i.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:i}});return y(Promise.allSettled(i.map(async({layer:e})=>{const t=a.get(e),r=Je(e);if(t.every(e=>O(e,r)))return t;const i=[];for(const n of t){i.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=i,s.outFields=U(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function He(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let i=null;const a=await r.defer(async()=>{const{results:o}=await y(t.hitTest(r),n);if(0===o.length)return[];const a=new Set;i=Q(o),i.forEach(({graphic:e})=>e&&a.add(e.layer));const s=e.filter(e=>a.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return y(Promise.allSettled(a.map(async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!0,a.outFields=Je(e);const s="renderer"in e?M({renderer:e.renderer,pointerType:r.pointerType}):0;a.geometry=$(o,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:n});return i?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function Je(e){return U(e.fieldsIndex,[e.objectIdField,L({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Ke(e,t,n,o){const i=e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r);return await W(i,t,n,o)}async function Xe(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,updateOptions:o,visualVariables:i}=e;await _e(e);const a={multipleSelectionEnabled:!1,...o};return"point"===n.geometryType&&(a.enableRotation=null!=i.rotation,a.enableScaling=null!=i.size),r.update(t,a)}function Ye(e,t){const{activeUpdateOptions:r}=e;r&&(e.activeUpdateOptions={...r,...t,reshapeOptions:{...r.reshapeOptions,...t.reshapeOptions},highlightOptions:{...r.highlightOptions,...t.highlightOptions}})}async function _e(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:i,webStyleCache:a}=e;let s=!1;const{rotation:l,size:c}=i;for(const u of[l,c]){if(null==u)continue;const e=t.getAttribute(u.field);if(null!=e)u.setInitialValue(e);else{const e=await u.getDefaultValue(t.symbol,n.view);u.setInitialValue(e),t.setAttribute(u.field,e),s=!0}}if(s){const e="2d"===n.view?.type?n.view.scale:null;await Z(t,a,e)}Be(n.tooltipOptions,c,l),r.elevationInfo=o.elevationInfo}function et(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function tt(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function rt(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let i=!1;const a=n.rotation,s=et(r.toolEventInfo);if(null!=a&&null!=s){const{field:r,getValue:n}=a;if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.setInitialValue(t.getAttribute(r));else{a.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),i=!0}}const l=n.size,c=tt(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const a=n(c.xScale,e);a!==o[r]&&t.setAttribute(r,a),i=!0}}return i}async function nt({feature:e,featureClone:t,sketchLayer:r,sketchViewModel:n,getUpdateOptions:o,view:i,visualVariableAttributes:c,webStyleCache:u,addHandle:p,addUpdatingPromise:f,onUpdate:y}){await Z(t,u,"2d"===i.type?i.scale:null);let h=null;if("2d"===n?.view?.type){const e=d(e=>Z(t,u,e));h=m(()=>n?.view?.scale,t=>e(t))}const w=t.sourceLayer,I=ut(i,w);await Xe({graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:w,updateOptions:o(),visualVariables:c,webStyleCache:u});let v=null;I.then(e=>v=e).catch(()=>{});const T=c.size,F=c.rotation,j=m(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==T||T.isUpdatingInteractively||T.field!==n||T.setInitialValue(o),null==F||F.isUpdatingInteractively||F.field!==n||F.setInitialValue(o),(null==v||v.requiredFields.includes(n))&&(r=!0))}r&&await Z(t,u,"2d"===i.type?i.scale:null)}),S=n.on("update",async e=>{const t=e.graphics[0],a={graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:w,updateOptions:o(),visualVariables:c,webStyleCache:u};if("complete"===e.state){if(null===i.activeTool)return Xe(a);const e=new AbortController,t=l(e);return p(t),f(g(()=>null===i.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),Xe(a)}))}rt(i,t,e,c)&&await Z(t,u,"2d"===i.type?i.scale:null),y(dt(t),e)}),k=b(()=>null!=i.activeTool&&i.activeTool!==n.activeComponent,()=>n.cancel()),A=n.on(["undo","redo"],e=>{y(dt(e.graphics[0]),e)});return a([A,S,k,s(()=>n.cancel()),j,h])}const ot={icon:w(24),text:w(12),line:w(1),viewScaleSizeFactor:100};function it(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function at(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function st(e){return"unknown"===e?null:e}function lt(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const ct=e=>e.includes("-stop")||e.includes("vertex-"),ut=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function pt(e){return"createInteractiveEditSession"in e}function dt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=c(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function ft(e){return e.acquireCursor("progress")}function yt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function mt(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>yt(e.relationships)),t.flatMap(e=>e.edits)):null}function ht(e){const t=ae(e)?e.activeWorkflow:e;if(null==t)return[];if(ne(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function gt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&I(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function bt(e){if(!wt(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function wt(e){return 0===e.length||P(e[0])}function It({drawTool:e},t){const r=e?.mostDownstreamPlugin?.configuration?.curveTypes;if(!t||!r||0===r.length)return!1;const n=new Set(t.capabilities.supportedCurveTypes);return r.some(e=>!n.has(e))}function vt(e,t){const r=new Set(t.capabilities.supportedCurveTypes);return e.some(({geometry:e})=>e&&S(e)&&k(e,r))}export{It as activeSketchToolDrawsUnsupportedCurve,Re as appendAllUtilityNetworkAssociationRelationships,at as avoidFeatureTemplateSelectionWithOnlyOneItem,pt as canCreateInteractiveEditSession,dt as cloneGraphicExceptMesh,vt as containsUnsupportedCurve,xe as createLayerIdMap,qe as createRelationshipKeyMap,Te as createToolFromGeometryType,it as createWorkflowSteps,$e as fetchCandidates,Ke as fetchFullFeatures,Pe as findAllDependencies,De as findChangesByGlobalId,Ne as findEditorItemForLayer,Ze as findEditorItemForLayerOrThrow,We as findLayerInfo,Ee as generateHashForRelationship,ht as getLayersFromWorkflow,he as getRotationVariableAttribute,mt as getServiceEditsFromWorkflowData,Ue as getServiceInfoForLayer,Le as getServiceLayersById,we as getSizeVariableAttribute,me as getVisualVariableAttributes,ye as getVisualVariablesForLayer,_ as isAnyUpdateLeafWorkflow,ee as isBatchAttributeFormViewModel,te as isCreateFeaturesWorkflow,re as isFeatureFormViewModel,wt as isGraphicsArray,se as isMergeFeaturesWorkflow,ue as isMergeWorkflowOptions,ce as isParentWorkflow,le as isSplitFeatureWorkflow,pe as isSplitWorkflowOptions,ct as isTerminalUpdateEventType,oe as isUpdateFeatureWorkflow,ne as isUpdateFeaturesWorkflow,fe as isUpdateFeaturesWorkflowOptions,ie as isUpdateRecordWorkflow,ae as isUpdateWorkflow,Ce as isUtilityNetworkAssociationsTable,gt as makeMinimalAttributes,Me as orderEditsByRelationshipDependencies,lt as prepareAttachmentsForCreateFeaturesWorkflow,yt as setRelationshipFields,nt as setUpGeometryUpdate,je as setUpSketchCreateWatchers,_e as setVisualVariablesAndElevationInfoForUpdate,ft as showProgressCursor,ot as sizeDefaults,st as sizeVariableUnitToLengthUnit,Fe as startCreatingNewFeature,Xe as startUpdatingFeatureGeometry,Ye as syncUpdateOptions,bt as toFeatureInfos,rt as visualVariableInteractiveUpdate,ut as whenEditorLayerView,de as workflowInfluencesOutcomeOfParent};
2
+ import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{handlesGroup as a,makeHandle as s,abortHandle as l}from"../../core/handleUtils.js";import{clone as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as d,isPromiseLike as f,whenOrAbort as y}from"../../core/promiseUtils.js";import{watch as m,on as h,whenOnce as g,when as b}from"../../core/reactiveUtils.js";import{px2pt as w}from"../../core/screenUtils.js";import{addMany as I}from"../../core/SetUtils.js";import{isSharedTemplateOrMetadata as v,isSharedGroupTemplate as T,getCreationAttributes as F,isSharedPresetTemplate as j}from"../../editing/templateUtils.js";import{isCurvedGeometry as S,hasUnsupportedCurve as k}from"../../geometry/support/curves/curveUtils.js";import A from"../../layers/GraphicsLayer.js";import{featureHasFields as O,fixFields as U,getDisplayFieldName as L}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as V}from"../../layers/support/layerUtils.js";import{calculateTolerance as M}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as x}from"../../renderers/support/lengthUtils.js";import{isRenderer as q}from"../../renderers/support/typeUtils.js";import{getTransformationType as z}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as E}from"../../support/graphicInstanceUtils.js";import P from"../../symbols/SimpleFillSymbol.js";import C from"../../symbols/SimpleLineSymbol.js";import R from"../../symbols/SimpleMarkerSymbol.js";import{to3D as D}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as G}from"../../symbols/support/symbolUtils.js";import{getServices as B}from"../../undoredo/support/Services.js";import{defaultDrawingMode as N}from"../../views/draw/drawingModes.js";import{updateGraphicSymbolWhenRequired as Z,fetchFullFeaturesByObjectId as W}from"../../views/draw/support/editingSessionUtils.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as Q,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as J}from"./support/dependencySort.js";import{isDrawGraphicTool as K,isDrawTool as X}from"../Sketch/support/sketchUtils.js";const Y=()=>u.getLogger("esri.widgets.Editor.workflowUtils");function _(e){return ie(e)||ne(e)}function ee(e){return!!e&&"features"in e}function te(e){return null!=e&&"create-features"===e.type}function re(e){return!!e&&"feature"in e}function ne(e){return null!=e&&"update-features"===e.type}function oe(e){return null!=e&&"update-feature"===e.type}function ie(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function ae(e){return null!=e&&"update"===e.type}function se(e){return null!=e&&"merge-features"===e.type}function le(e){return null!=e&&"split-feature"===e.type}function ce(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function ue(e){return"merge"===e?.type}function pe(e){return"split"===e?.type}function de(e){return se(e)||le(e)}function fe(e){return"update-multiple"===e?.type}function ye(e){const t=e&&"renderer"in e?e.renderer:null;if(!ve(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===z(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function me(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&ve(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=ye(t);let o=null,i=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=he(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;i=we(n,r)}return{rotation:o,size:i}}function he(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,Ie((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function ge(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 be(e,t,r){if(null==t)return 0;const{symbol:n}=D(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(ot.icon,(await e(o,ot.icon))[0])||ot.icon}case"text":return ot.text;case"line":return ot.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return ge(await t(o,e.scale/ot.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/ot.viewScaleSizeFactor;default:return 0}}function we(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},i=x[e.valueUnit]??1;let a;return a="area"===e.valueRepresentation?e=>(e*i/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*i/2:e=>e*i,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>Ie(a(await be(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,Ie(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:st(e.valueUnit),axis:e.axis}}function Ie(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 ve(e){if(!q(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}function Te(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:N,optionsPerTool:r};if(v(t)){const o=t.defaultTool,i=T(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===i?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===i?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function Fe(e,t,r,n){const{creationInfo:o,fullTemplate:a}=r;if(!o)throw new i("featureworkflow","No creation info provided.");const s=o.layer,l=F(a,o.attributeOverrides,o.layer),{view:c}=e,u="2d"===c?.type;T(a)||j(a)||await Ge(e,s,l,n,u?c.scale:null);const{capabilities:p}=s;t.elevationInfo=s.elevationInfo;const d=Te(s.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:l,sourceLayer:s},mode:d.createOptions.mode,optionsPerTool:d.createOptions.optionsPerTool,preserveAspectRatio:d.createOptions.preserveAspectRatio,hasZ:p.data.supportsZ,defaultZ:(u?p.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==o.geometryToPlace?await e.create(d.tool):await e.place(o.geometryToPlace,{graphicProperties:{attributes:l,sourceLayer:s}})}async function je(e){return a([Se(e),ke(e)])}function Se({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:o}){const{creationInfo:i}=t,{fullTemplate:a}=t;if(!i||"2d"!==n?.type||T(a)||j(a))return null;const s=d(t=>Ge(r,i.layer,e,o,t));return m(()=>n.scale,e=>s(e))}function ke({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const l=r.activeComponent;if(!n||!K(l)&&!X(l))return Y().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new A({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=o,d=n.theme?.accentColor??new e([255,165,0,1]);return a([h(()=>l,["cursor-update","vertex-add"],()=>{c.removeAll();const e=K(l)?l.graphic?.geometry:l.unprocessedGeometry;if(!e||!Ae(e))return;const t=u(e,"digitizing");if(!f(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Oe(e,d);t&&c.add(t)}}}),s(()=>{n.map.remove(c),c.destroy()})])}function Ae(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":{if(S(e))return e.curvePaths[0].length>1;const t=e.paths[0];return!!t&&t.length>1}case"polygon":{if(S(e))return e.curveRings[0].length>2;const t=e.rings[0];return!!t&&(n(t.at(0),t.at(-1))?t.length>2:t.length>1)}default:return!1}}function Oe(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new R({angle:0,color:r,outline:new C({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new P({color:r,outline:new C({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new C({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function Ue(e,t){const r=B(t),n=V(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function Le(e,t){const r=Ue(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function Ve(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Me(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:i}=e,a=xe(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=ze(t,a,i),p=Ee(l,qe(s,c),c);if(o&&Re(l,p,o),0===p.length)return t;const d=J(p,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=Ve(e):h.id!==e.layerId&&(m.push(h),h=Ve(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??Ve(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function xe(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function qe(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Pe(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(Pe(n,e),t.keyField);break}}return r}function ze(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function Ee(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:i}=o;for(const a of e){const e=a.keyField;if("origin"===a.role){const s=r.get(a.relatedTableId);if(!s||0===s.length)continue;const l=Pe(o.layer,a),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([i,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,i]):t.before.attributes[c]===o.after.attributes[e]&&n.push([i,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,i]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):n.push([r,i]):n.push([i,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,i]))}}}}return n}function Pe(e,t){return`${e.layerId}:${t.id}`}function Ce(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function Re(e,t,r){const n=[];for(const i of e)Ce(i.layer,r)&&n.push(i);if(0===n.length)return;let o=[];for(const i of n){const r=i.layer;switch(i.operationType){case"delete":o=[...De(i.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...De(i.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([i.uniqueId,e.uniqueId]);break;case"add":o=[...De(i.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...De(i.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,i.uniqueId])}}}function De(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}async function Ge(e,r,n,o,i){const a=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=me(a);let c=await G(a,{useSourceLayer:!0,webStyleCache:o,scale:i}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await G(a,{useSourceLayer:!0,webStyleCache:o,scale:i})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Be(e.tooltipOptions,l,s)}function Be(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 Ne(e,t){return e.find(e=>e.layer===t)}function Ze(e,t){const r=Ne(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function We(e,t){return e?.find(e=>e.layer===t)}async function $e(e,t,r,n){switch(t.type){case"3d":return Qe(e,t,r,n);case"2d":return He(e,t,r,n)}}async function Qe(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.defer(async()=>{const{results:o}=await y(H(t,r),n),i=new Map,a=e=>{const t=e.layer,r=i.get(t);if(!r){const e=new Array;return i.set(t,e),e}return r};Q(o).forEach(({graphic:e})=>a(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&i.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:i}});return y(Promise.allSettled(i.map(async({layer:e})=>{const t=a.get(e),r=Je(e);if(t.every(e=>O(e,r)))return t;const i=[];for(const n of t){i.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=i,s.outFields=U(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function He(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let i=null;const a=await r.defer(async()=>{const{results:o}=await y(t.hitTest(r),n);if(0===o.length)return[];const a=new Set;i=Q(o),i.forEach(({graphic:e})=>e&&a.add(e.layer));const s=e.filter(e=>a.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return y(Promise.allSettled(a.map(async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!0,a.outFields=Je(e);const s="renderer"in e?M({renderer:e.renderer,pointerType:r.pointerType}):0;a.geometry=$(o,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:n});return i?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function Je(e){return U(e.fieldsIndex,[e.objectIdField,L({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Ke(e,t,n,o){const i=e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r);return await W(i,t,n,o)}async function Xe(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,updateOptions:o,visualVariables:i}=e;await _e(e);const a={multipleSelectionEnabled:!1,...o};return"point"===n.geometryType&&(a.enableRotation=null!=i.rotation,a.enableScaling=null!=i.size),r.update(t,a)}function Ye(e,t){const{activeUpdateOptions:r}=e;r&&(e.activeUpdateOptions={...r,...t,reshapeOptions:{...r.reshapeOptions,...t.reshapeOptions},highlightOptions:{...r.highlightOptions,...t.highlightOptions}})}async function _e(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:i,webStyleCache:a}=e;let s=!1;const{rotation:l,size:c}=i;for(const u of[l,c]){if(null==u)continue;const e=t.getAttribute(u.field);if(null!=e)u.setInitialValue(e);else{const e=await u.getDefaultValue(t.symbol,n.view);u.setInitialValue(e),t.setAttribute(u.field,e),s=!0}}if(s){const e="2d"===n.view?.type?n.view.scale:null;await Z(t,a,e)}Be(n.tooltipOptions,c,l),r.elevationInfo=o.elevationInfo}function et(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function tt(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function rt(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let i=!1;const a=n.rotation,s=et(r.toolEventInfo);if(null!=a&&null!=s){const{field:r,getValue:n}=a;if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.setInitialValue(t.getAttribute(r));else{a.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),i=!0}}const l=n.size,c=tt(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const a=n(c.xScale,e);a!==o[r]&&t.setAttribute(r,a),i=!0}}return i}async function nt({feature:e,featureClone:t,sketchLayer:r,sketchViewModel:n,getUpdateOptions:o,view:i,visualVariableAttributes:c,webStyleCache:u,addHandle:p,addUpdatingPromise:f,onUpdate:y}){await Z(t,u,"2d"===i.type?i.scale:null);let h=null;if("2d"===n?.view?.type){const e=d(e=>Z(t,u,e));h=m(()=>n?.view?.scale,t=>e(t))}const w=t.sourceLayer,I=ut(i,w);await Xe({graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:w,updateOptions:o(),visualVariables:c,webStyleCache:u});let v=null;I.then(e=>v=e).catch(()=>{});const T=c.size,F=c.rotation,j=m(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==T||T.isUpdatingInteractively||T.field!==n||T.setInitialValue(o),null==F||F.isUpdatingInteractively||F.field!==n||F.setInitialValue(o),(null==v||v.requiredFields.includes(n))&&(r=!0))}r&&await Z(t,u,"2d"===i.type?i.scale:null)}),S=n.on("update",async e=>{const t=e.graphics[0],a={graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:w,updateOptions:o(),visualVariables:c,webStyleCache:u};if("complete"===e.state){if(null===i.activeTool)return Xe(a);const e=new AbortController,t=l(e);return p(t),f(g(()=>null===i.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),Xe(a)}))}rt(i,t,e,c)&&await Z(t,u,"2d"===i.type?i.scale:null),y(dt(t),e)}),k=b(()=>null!=i.activeTool&&i.activeTool!==n.activeComponent,()=>n.cancel()),A=n.on(["undo","redo"],e=>{y(dt(e.graphics[0]),e)});return a([A,S,k,s(()=>n.cancel()),j,h])}const ot={icon:w(24),text:w(12),line:w(1),viewScaleSizeFactor:100};function it(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function at(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function st(e){return"unknown"===e?null:e}function lt(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const ct=e=>e.includes("-stop")||e.includes("vertex-"),ut=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function pt(e){return"createInteractiveEditSession"in e}function dt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=c(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function ft(e){return e.acquireCursor("progress")}function yt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function mt(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>yt(e.relationships)),t.flatMap(e=>e.edits)):null}function ht(e){const t=ae(e)?e.activeWorkflow:e;if(null==t)return[];if(ne(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function gt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&I(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function bt(e){if(!wt(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function wt(e){return 0===e.length||E(e[0])}function It({drawTool:e},t){const r=e?.mostDownstreamPlugin?.configuration?.curveTypes;if(!t||!r||0===r.length)return!1;const n=new Set(t.capabilities.supportedCurveTypes);return r.some(e=>!n.has(e))}function vt(e,t){const r=new Set(t.capabilities.supportedCurveTypes);return e.some(({geometry:e})=>e&&S(e)&&k(e,r))}function Tt({filter:e,forEachFeature:t,forEachValueChange:r}){return n=>{for(const{feature:o,changes:i}of n.data)if(!e||e(o)){for(const{fieldName:e,value:t}of i)r?.(e,t,o);t?.(o,i)}}}export{It as activeSketchToolDrawsUnsupportedCurve,Re as appendAllUtilityNetworkAssociationRelationships,at as avoidFeatureTemplateSelectionWithOnlyOneItem,pt as canCreateInteractiveEditSession,dt as cloneGraphicExceptMesh,vt as containsUnsupportedCurve,xe as createLayerIdMap,qe as createRelationshipKeyMap,Te as createToolFromGeometryType,it as createWorkflowSteps,$e as fetchCandidates,Ke as fetchFullFeatures,Ee as findAllDependencies,De as findChangesByGlobalId,Ne as findEditorItemForLayer,Ze as findEditorItemForLayerOrThrow,We as findLayerInfo,Pe as generateHashForRelationship,ht as getLayersFromWorkflow,he as getRotationVariableAttribute,mt as getServiceEditsFromWorkflowData,Ue as getServiceInfoForLayer,Le as getServiceLayersById,we as getSizeVariableAttribute,me as getVisualVariableAttributes,ye as getVisualVariablesForLayer,Tt as handleFormValuesChangeEvent,_ as isAnyUpdateLeafWorkflow,ee as isBatchAttributeFormViewModel,te as isCreateFeaturesWorkflow,re as isFeatureFormViewModel,wt as isGraphicsArray,se as isMergeFeaturesWorkflow,ue as isMergeWorkflowOptions,ce as isParentWorkflow,le as isSplitFeatureWorkflow,pe as isSplitWorkflowOptions,ct as isTerminalUpdateEventType,oe as isUpdateFeatureWorkflow,ne as isUpdateFeaturesWorkflow,fe as isUpdateFeaturesWorkflowOptions,ie as isUpdateRecordWorkflow,ae as isUpdateWorkflow,Ce as isUtilityNetworkAssociationsTable,gt as makeMinimalAttributes,Me as orderEditsByRelationshipDependencies,lt as prepareAttachmentsForCreateFeaturesWorkflow,yt as setRelationshipFields,nt as setUpGeometryUpdate,je as setUpSketchCreateWatchers,_e as setVisualVariablesAndElevationInfoForUpdate,ft as showProgressCursor,ot as sizeDefaults,st as sizeVariableUnitToLengthUnit,Fe as startCreatingNewFeature,Xe as startUpdatingFeatureGeometry,Ye as syncUpdateOptions,bt as toFeatureInfos,rt as visualVariableInteractiveUpdate,ut as whenEditorLayerView,de as workflowInfluencesOutcomeOfParent};
package/widgets/Editor.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i,deprecatedFunction as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as r,abortMaybe as a,mappedFind as n}from"../core/maybe.js";import{watch as l,initial as c,on as d,when as h}from"../core/reactiveUtils.js";import{property as m,subclass as p}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../core/support/UpdatingHandles.js";import g from"../views/interactive/sketch/SketchLabelOptions.js";import w from"../views/interactive/sketch/SketchTooltipOptions.js";import v from"../views/interactive/sketch/SketchValueOptions.js";import _ from"../views/interactive/snapping/SnappingOptions.js";import f from"./Attachments.js";import y from"./BatchAttributeForm.js";import b from"./FeatureForm.js";import k from"./FeatureTemplates.js";import M from"./Spinner.js";import F from"./Widget.js";import A from"./BatchAttributeForm/VisibleElements.js";import{css as T}from"./Editor/css.js";import S from"./Editor/EditorViewModel.js";import{isModelUpload as C}from"./Editor/modelUploadUtils.js";import L from"./Editor/VisibleElements.js";import{findEditorItemForLayer as E,isFeatureFormViewModel as W,isUpdateWorkflow as I,isUpdateFeaturesWorkflow as P,isUpdateFeatureWorkflow as U,isBatchAttributeFormViewModel as j}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as V,CreateFeaturesPanelContent as D}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as B,FeatureList as x}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as O,FooterActions as N}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as H,Notice as G}from"./Editor/components/Notices.js";import{loadPanelContentComponents as R,PanelContent as z,PanelContentSection as q,PanelContentMessage as K}from"./Editor/components/PanelContent.js";import{PanelToolbar as Z,loadPanelToolbarComponents as $}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as J,Prompt as Q}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as X,UpdateFeaturePanelContent as Y}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as ee,UploadDetails as te}from"./Editor/components/UploadDetails.js";import ie from"./Sketch/CreateToolVisibilityMap.js";import se from"./Sketch/SelectionToolVisibilityMap.js";import oe from"./Sketch/VisibleElements.js";import{loadCalciteComponents as re}from"./support/componentsUtils.js";import{globalCss as ae}from"./support/globalCss.js";import{incrementHeadingLevel as ne,Heading as le}from"./support/Heading.js";import{renderItem as ce}from"./support/ItemList.js";import{connectDelayedLoading as de}from"./support/loaderUtils.js";import he from"./support/SelectionList.js";import me from"./support/SelectionToolbar.js";import{messageBundle as pe,vmEvent as ue,tsx as ge}from"./support/widget.js";import{isLayerItem as we}from"./support/SelectionList/selectionListUtils.js";import ve from"./support/SelectionList/VisibleElements.js";import _e from"./support/SelectionToolbar/VisibleElements.js";const fe=Symbol("sketch-setup-handles");let ye=class extends F{constructor(e,s){super(e,s),this._batchAttributeForm=new y({suppressDeprecationWarning:!0,visibleElements:new A({loadingIndicator:!1})}),this._featureForm=new b({suppressDeprecationWarning:!0}),this._sketchToolbar=null,this._attachments=new f({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1},suppressDeprecationWarning:!0}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new k({suppressDeprecationWarning:!0,enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?ge("calcite-icon",{class:T.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new M,this._loading=!1,this._selectionList=new he({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,itemUnavailableFunction:({item:e})=>!E(this.editorItems,e.layer)?.editable,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new ve({header:!1})}),this._selectionToolbar=new me({visibleElements:new _e({chip:!1})}),this._updatingHandles=new u,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=null,this.visibleElements=new L,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderBatchAttributeForm=()=>this._batchAttributeForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?ge("div",{class:T.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>ge("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return ge("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?ge(Z,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showConfirmationPrompt=e=>this._showPromptAndWait(this.messages[e]),this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&C(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&W(t.formViewModel)&&t.formViewModel.activeAssociation?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(I(e)){const t=e.activeWorkflow;P(t)&&e.startMergingFeatures(t.viewGraphics,{initialFeatures:t.data.initialFeatures})}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(I(e)){const t=e.activeWorkflow;if(U(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i,{initialFeature:t.data.edits.initialFeature??i})}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})},this.viewModel=e?.viewModel||new S({useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type}),this.announceDeprecation=()=>{i(o.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([l(()=>ne(this.headingLevel),e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},c),d(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),h(()=>this.viewModel.formViewModel,e=>{j(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.consumePromise(this._initializeAssociationItemList(e))},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),l(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,r])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=r,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt,e.showConfirmationPrompt=this._showConfirmationPrompt},c),l(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},c),l(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(e.attachments&&this._attachments.set(e.attachments),e.featureForm&&this._featureForm.set(e.featureForm),e.featureTemplates&&this._featureTemplates.set(e.featureTemplates),e.selectionToolbar&&this._selectionToolbar.set(e.selectionToolbar),e.sketch&&this.viewModel.sketchViewModel?.set(e.sketch))},c),h(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),h(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),h(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:r}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{r(),this._clearPrompt()}}}})}),l(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),l(()=>this.viewModel.featureFormDisabled,e=>this._featureForm.disabled=e),l(()=>this.visibleElements.sketch,()=>this._setupSketch(),c),l(()=>this.visibleElements.zoomToButton,e=>this._selectionList.visibleElements.zoomToButton=e,c),de({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=r(this._sketchToolbar),this._sketchImportAbortController=a(this._sketchImportAbortController)}loadDependencies(){return Promise.all([re({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),V(),B(),O(),H(),R(),$(),J(),X(),ee()])}get _hasInvalidBatchSelection(){return this._hasSelectionWithUneditableFeatures||this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _hasSelectionWithUneditableFeatures(){const e=this.editorItems;return this._selectionList.visibleFeatureItems.some(t=>!E(e,t.layer))}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e,visibleElements:t}=this,i=t?.mergeButton??!0;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",hidden:({item:e})=>!E(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",hidden:({item:e})=>!E(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",hidden:!i||(({item:e})=>{if(!we(e))return!0;const t=E(this.editorItems,e.layer);return!t||(!t.editable||!t.supportsMergeFeaturesWorkflow||e.visibleTotal<2)}),callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get editorItems(){return this.viewModel.editorItems}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}activateSelectionTool(e){return this.viewModel.activateSelectionTool(e)}cancelSelectionTool(){this.viewModel.cancelSelectionTool()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return s(o.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(T.base,ae.widget,ae.panel);if(!t)return ge("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,r=s.map((e,t)=>this._renderPage(e,t===o));return ge("div",{class:i,key:"base"},e.flow?ge("calcite-flow",{inert:!!this._prompt,key:"flow"},r):r,this._prompt?ge(Q,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return ge("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return ge(t,{heading:i.selectTemplate,key:"templates-panel",...e},ge(z,{key:"feature-templates"},ge(q,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?ge(t,{heading:s.createFeatures,key:"upload-details-panel",...e},ge(te,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:r,viewModel:a}=this;if(!i)return null;const n="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return ge(t,{heading:s.createFeatures,key:"create-features-panel",...e},n?ge(Y,{editorViewModel:a,headingLevel:r,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):ge(D,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return ge(t,{heading:a,key:"update-feature-panel",...e},ge(Y,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return ge(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},ge(D,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this;return ge(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},ge(Y,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(a);return ge(t,{heading:n,key:"viewing-associated-layers-panel",...e},ge(Y,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state||this.viewModel.featureFormDisabled;return t?ge(i,{heading:a,key:"add-association-select-feature",...e},ge(z,{key:"select-feature"},ge(q,null,t.render())),ge(N,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&(r?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):ge(i,{heading:a,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,r="add-association"===o?.type?o.sourceFeatureItem:null,a=i?.selectedFeature,n=i?.association,l=i?.utilityNetwork;r&&a&&n&&l&&(t.sourceFeature=r,t.targetFeature=a,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state;return ge(i,{heading:a,key:"add-association",...e},ge(z,{key:"add-association-content"},ge(q,null,t.render())),ge(N,{buttons:[{label:o.add,disabled:n||!r.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=n(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?ge(G,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return ge(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},ge(z,{key:"attachments"},this._renderAttachments()),ge(N,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:r,_visibleSelectionCount:a,messages:n,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=r;return ge(l,{heading:n.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?ge("div",{class:T.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,ge(z,{key:"selection-list"},ge(q,null,this._renderSelectionList())),ge(N,{buttons:[c?{label:t(n.batchEditing.editCount,{count:a}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:n.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:r}=this;return s?ge(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},ge(z,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?ge(N,{buttons:[{label:r.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:r.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,visibleElements:s}=this,o=this._helpMessage;return ge(t,{heading:i.widgetLabel,key:"landing-panel",...e},ge(z,{key:"landing-content"},this.editorItems.length?[s.editFeaturesSection?ge(q,{key:"edit-actions"},this._renderUpdateActions()):null,s.createFeaturesSection&&this.viewModel.canCreateVisible?ge(q,{key:"create-actions"},this._renderCreateActions()):null]:ge(K,{key:"no-content"},i.noEditableLayers)),o?ge("div",{class:T.helpMessage,key:"footer-actions",slot:"footer"},o):void 0)}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return ge("div",{class:T.updateActions,key:"update-actions"},ge(le,{level:ne(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?ge("div",{class:T.selectionToolbarContainer},this._renderSelectionToolbar()):ge("calcite-list",{class:T.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},ce({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return ge("div",{key:"create-actions"},ge(le,{level:ne(this.headingLevel)},this.messages.createFeatures),ge("div",{class:T.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const r=o.data.candidates,a=t(this.messages.multipleFeaturesTemplate,{total:r.length});return ge(i,{heading:a,key:"feature-list",...e},ge(x,{editorItems:this.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=Promise.withResolvers(),{view:r}=this,a=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),a&&r?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=a(this._sketchImportAbortController),this._sketchToolbar=r(this._sketchToolbar),void this.removeHandles(fe);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",suppressDeprecationWarning:!0,visibleElements:new oe({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,singlePluginBackButton:!1,createTools:new ie({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new se({"lasso-selection":!1,"rectangle-selection":!1})})}),this.addHandles([l(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},c),l(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},c),h(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},c),h(()=>this.viewModel.sketchViewModel?.pluginManager,e=>{e.sketch=this._sketchToolbar},c)],fe)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;if("curveToolDensifyWarning"===e)return t.curveToolDensifyWarning;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([m()],ye.prototype,"_batchAttributeForm",void 0),e([m()],ye.prototype,"_featureForm",void 0),e([m()],ye.prototype,"_sketchToolbar",void 0),e([m()],ye.prototype,"_attachments",void 0),e([m()],ye.prototype,"_associationItemList",void 0),e([m()],ye.prototype,"_associationSettings",void 0),e([m()],ye.prototype,"_featureTemplates",void 0),e([m()],ye.prototype,"_filterText",void 0),e([m()],ye.prototype,"_hasInvalidBatchSelection",null),e([m()],ye.prototype,"_hasSelectionFromMultipleLayers",null),e([m()],ye.prototype,"_hasSelectionWithUneditableFeatures",null),e([m()],ye.prototype,"_prompt",void 0),e([m()],ye.prototype,"_spinner",void 0),e([m()],ye.prototype,"_deleteButtonCommonInfo",null),e([m()],ye.prototype,"_loading",void 0),e([m()],ye.prototype,"_selectionCountExceedsMaximum",null),e([m()],ye.prototype,"_selectionList",void 0),e([m()],ye.prototype,"_selectionListItemActionConfigs",null),e([m()],ye.prototype,"_selectionToolbar",void 0),e([m()],ye.prototype,"_visibleSelectionCount",null),e([m({readOnly:!0})],ye.prototype,"activeWorkflow",null),e([m()],ye.prototype,"editorItems",null),e([m()],ye.prototype,"effectiveSelectionManager",null),e([m()],ye.prototype,"headingLevel",void 0),e([m()],ye.prototype,"hideTemplatesForInactiveLayers",null),e([m()],ye.prototype,"icon",null),e([m()],ye.prototype,"label",null),e([m({type:g})],ye.prototype,"labelOptions",null),e([m()],ye.prototype,"layerInfos",null),e([m(),pe("esri/widgets/Editor/t9n/Editor")],ye.prototype,"messages",void 0),e([m(),pe("esri/t9n/common")],ye.prototype,"messagesCommon",void 0),e([m(),pe("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],ye.prototype,"messagesTemplates",void 0),e([m(),pe("esri/widgets/Feature/t9n/Feature")],ye.prototype,"messagesFeature",void 0),e([m()],ye.prototype,"selectionManager",null),e([m({type:_})],ye.prototype,"snappingOptions",null),e([m()],ye.prototype,"syncWithViewSelectionManager",null),e([m()],ye.prototype,"syncViewSelection",null),e([m({type:w})],ye.prototype,"tooltipOptions",null),e([m()],ye.prototype,"supportingWidgetDefaults",void 0),e([m({type:v,nonNullable:!0})],ye.prototype,"valueOptions",null),e([m({value:!1})],ye.prototype,"useLegacyCreateTools",null),e([m()],ye.prototype,"isUsingLegacyCreateTools",null),e([m()],ye.prototype,"view",null),e([m({type:S}),ue(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],ye.prototype,"viewModel",void 0),e([m({type:L,nonNullable:!0})],ye.prototype,"visibleElements",void 0),e([m()],ye.prototype,"_helpMessage",null),e([m()],ye.prototype,"_noticeMessage",null),ye=e([p("esri.widgets.Editor")],ye);const be=ye;export{be as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i,deprecatedFunction as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as a,abortMaybe as n,mappedFind as r}from"../core/maybe.js";import{watch as l,initial as c,on as d,when as h}from"../core/reactiveUtils.js";import{property as m,subclass as p}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../core/support/UpdatingHandles.js";import g from"../views/interactive/sketch/SketchLabelOptions.js";import w from"../views/interactive/sketch/SketchTooltipOptions.js";import v from"../views/interactive/sketch/SketchValueOptions.js";import _ from"../views/interactive/snapping/SnappingOptions.js";import f from"./Attachments.js";import y from"./BatchAttributeForm.js";import b from"./FeatureForm.js";import k from"./FeatureTemplates.js";import M from"./Spinner.js";import F from"./Widget.js";import A from"./BatchAttributeForm/VisibleElements.js";import{css as T}from"./Editor/css.js";import S from"./Editor/EditorViewModel.js";import{isModelUpload as C}from"./Editor/modelUploadUtils.js";import L from"./Editor/VisibleElements.js";import{findEditorItemForLayer as W,isUpdateWorkflow as E,isUpdateFeaturesWorkflow as I,isUpdateFeatureWorkflow as P,isBatchAttributeFormViewModel as U}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as j,CreateFeaturesPanelContent as V}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as D,FeatureList as x}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as O,FooterActions as B}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as N,Notice as H}from"./Editor/components/Notices.js";import{loadPanelContentComponents as G,PanelContent as R,PanelContentSection as z,PanelContentMessage as q}from"./Editor/components/PanelContent.js";import{PanelToolbar as K,loadPanelToolbarComponents as Z}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as $,Prompt as J}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as Q,UpdateFeaturePanelContent as X}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as Y,UploadDetails as ee}from"./Editor/components/UploadDetails.js";import te from"./Sketch/CreateToolVisibilityMap.js";import ie from"./Sketch/SelectionToolVisibilityMap.js";import se from"./Sketch/VisibleElements.js";import{loadCalciteComponents as oe}from"./support/componentsUtils.js";import{globalCss as ae}from"./support/globalCss.js";import{incrementHeadingLevel as ne,Heading as re}from"./support/Heading.js";import{renderItem as le}from"./support/ItemList.js";import{connectDelayedLoading as ce}from"./support/loaderUtils.js";import de from"./support/SelectionList.js";import he from"./support/SelectionToolbar.js";import{messageBundle as me,vmEvent as pe,tsx as ue}from"./support/widget.js";import{isLayerItem as ge}from"./support/SelectionList/selectionListUtils.js";import we from"./support/SelectionList/VisibleElements.js";import ve from"./support/SelectionToolbar/VisibleElements.js";const _e=Symbol("sketch-setup-handles");let fe=class extends F{constructor(e,s){super(e,s),this._batchAttributeForm=new y({suppressDeprecationWarning:!0,visibleElements:new A({loadingIndicator:!1})}),this._featureForm=new b({suppressDeprecationWarning:!0}),this._sketchToolbar=null,this._attachments=new f({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1},suppressDeprecationWarning:!0}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new k({suppressDeprecationWarning:!0,enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?ue("calcite-icon",{class:T.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new M,this._loading=!1,this._selectionList=new de({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,itemUnavailableFunction:({item:e})=>!W(this.editorItems,e.layer)?.editable,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new we({header:!1})}),this._selectionToolbar=new he({visibleElements:new ve({chip:!1})}),this._updatingHandles=new u,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=null,this.visibleElements=new L,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?ue("div",{class:T.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>ue("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return ue("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?ue(K,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showConfirmationPrompt=e=>this._showPromptAndWait(this.messages[e]),this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&C(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.formViewModel?.activeAssociationsInput?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(E(e)){const t=e.activeWorkflow;I(t)&&e.startMergingFeatures(t.viewGraphics,{initialFeatures:t.data.initialFeatures})}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(E(e)){const t=e.activeWorkflow;if(P(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i,{initialFeature:t.data.edits.initialFeature??i})}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})},this.viewModel=e?.viewModel||new S({useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type}),this.announceDeprecation=()=>{i(o.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([l(()=>ne(this.headingLevel),e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},c),d(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),h(()=>this.viewModel.formViewModel,e=>{U(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.consumePromise(this._initializeAssociationItemList(e))},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),l(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,a])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=a,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt,e.showConfirmationPrompt=this._showConfirmationPrompt},c),l(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},c),l(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(e.attachments&&this._attachments.set(e.attachments),e.featureForm&&this._featureForm.set(e.featureForm),e.featureTemplates&&this._featureTemplates.set(e.featureTemplates),e.selectionToolbar&&this._selectionToolbar.set(e.selectionToolbar),e.sketch&&this.viewModel.sketchViewModel?.set(e.sketch))},c),h(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),h(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),h(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:a}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{a(),this._clearPrompt()}}}})}),l(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),l(()=>this.viewModel.formDisabled,e=>this._batchAttributeForm.readOnly=e),l(()=>this.visibleElements.sketch,()=>this._setupSketch(),c),l(()=>this.visibleElements.zoomToButton,e=>this._selectionList.visibleElements.zoomToButton=e,c),ce({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=a(this._sketchToolbar),this._sketchImportAbortController=n(this._sketchImportAbortController)}loadDependencies(){return Promise.all([oe({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),j(),D(),O(),N(),G(),Z(),$(),Q(),Y()])}get _hasInvalidBatchSelection(){return this._hasSelectionWithUneditableFeatures||this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _hasSelectionWithUneditableFeatures(){const e=this.editorItems;return this._selectionList.visibleFeatureItems.some(t=>!W(e,t.layer))}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e,visibleElements:t}=this,i=t?.mergeButton??!0;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",hidden:({item:e})=>!W(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",hidden:({item:e})=>!W(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",hidden:!i||(({item:e})=>{if(!ge(e))return!0;const t=W(this.editorItems,e.layer);return!t||(!t.editable||!t.supportsMergeFeaturesWorkflow||e.visibleTotal<2)}),callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get editorItems(){return this.viewModel.editorItems}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}activateSelectionTool(e){return this.viewModel.activateSelectionTool(e)}cancelSelectionTool(){this.viewModel.cancelSelectionTool()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return s(o.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(T.base,ae.widget,ae.panel);if(!t)return ue("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,a=s.map((e,t)=>this._renderPage(e,t===o));return ue("div",{class:i,key:"base"},e.flow?ue("calcite-flow",{inert:!!this._prompt,key:"flow"},a):a,this._prompt?ue(J,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return ue("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return ue(t,{heading:i.selectTemplate,key:"templates-panel",...e},ue(R,{key:"feature-templates"},ue(z,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?ue(t,{heading:s.createFeatures,key:"upload-details-panel",...e},ue(ee,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:a,viewModel:n}=this;if(!i)return null;const r="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return ue(t,{heading:s.createFeatures,key:"create-features-panel",...e},r?ue(X,{editorViewModel:n,formWidget:this._batchAttributeForm,headingLevel:a,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):ue(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this,n=a.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return ue(t,{heading:n,key:"update-feature-panel",...e},ue(X,{editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return ue(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},ue(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this;return ue(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},ue(X,{editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this,n=a.formViewModel?.activeAssociationType,r=this._getAssociationTypeTitle(n);return ue(t,{heading:r,key:"viewing-associated-layers-panel",...e},ue(X,{editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,a=s.utilityNetworkAssociationAddAssociationViewModel,n=this._getAddAssociationTypeTitle(a?.associationType),r="ready"!==a?.state||this.viewModel.formDisabled;return t?ue(i,{heading:n,key:"add-association-select-feature",...e},ue(R,{key:"select-feature"},ue(z,null,t.render())),ue(B,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:r,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:r,onClick:()=>{"update"===s.activeWorkflow?.type&&(a?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):ue(i,{heading:n,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,a="add-association"===o?.type?o.sourceFeatureItem:null,n=i?.selectedFeature,r=i?.association,l=i?.utilityNetwork;a&&n&&r&&l&&(t.sourceFeature=a,t.targetFeature=n,t.association=r,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const a=s.utilityNetworkAssociationAddAssociationViewModel,n=this._getAddAssociationTypeTitle(a?.associationType),r="ready"!==a?.state;return ue(i,{heading:n,key:"add-association",...e},ue(R,{key:"add-association-content"},ue(z,null,t.render())),ue(B,{buttons:[{label:o.add,disabled:r||!a.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:r,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=r(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?ue(H,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return ue(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},ue(R,{key:"attachments"},this._renderAttachments()),ue(B,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:a,_visibleSelectionCount:n,messages:r,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=a;return ue(l,{heading:r.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?ue("div",{class:T.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,ue(R,{key:"selection-list"},ue(z,null,this._renderSelectionList())),ue(B,{buttons:[c?{label:t(r.batchEditing.editCount,{count:n}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:r.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:a}=this;return s?ue(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},ue(R,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?ue(B,{buttons:[{label:a.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:a.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,visibleElements:s}=this,o=this._helpMessage;return ue(t,{heading:i.widgetLabel,key:"landing-panel",...e},ue(R,{key:"landing-content"},this.editorItems.length?[s.editFeaturesSection?ue(z,{key:"edit-actions"},this._renderUpdateActions()):null,s.createFeaturesSection&&this.viewModel.canCreateVisible?ue(z,{key:"create-actions"},this._renderCreateActions()):null]:ue(q,{key:"no-content"},i.noEditableLayers)),o?ue("div",{class:T.helpMessage,key:"footer-actions",slot:"footer"},o):void 0)}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return ue("div",{class:T.updateActions,key:"update-actions"},ue(re,{level:ne(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?ue("div",{class:T.selectionToolbarContainer},this._renderSelectionToolbar()):ue("calcite-list",{class:T.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},le({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return ue("div",{key:"create-actions"},ue(re,{level:ne(this.headingLevel)},this.messages.createFeatures),ue("div",{class:T.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const a=o.data.candidates,n=t(this.messages.multipleFeaturesTemplate,{total:a.length});return ue(i,{heading:n,key:"feature-list",...e},ue(x,{editorItems:this.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=Promise.withResolvers(),{view:a}=this,n=a?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),n&&a?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=n(this._sketchImportAbortController),this._sketchToolbar=a(this._sketchToolbar),void this.removeHandles(_e);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",suppressDeprecationWarning:!0,visibleElements:new se({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,singlePluginBackButton:!1,createTools:new te({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new ie({"lasso-selection":!1,"rectangle-selection":!1})})}),this.addHandles([l(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},c),l(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},c),h(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},c),h(()=>this.viewModel.sketchViewModel?.pluginManager,e=>{e.sketch=this._sketchToolbar},c)],_e)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;if("curveToolDensifyWarning"===e)return t.curveToolDensifyWarning;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([m()],fe.prototype,"_batchAttributeForm",void 0),e([m()],fe.prototype,"_featureForm",void 0),e([m()],fe.prototype,"_sketchToolbar",void 0),e([m()],fe.prototype,"_attachments",void 0),e([m()],fe.prototype,"_associationItemList",void 0),e([m()],fe.prototype,"_associationSettings",void 0),e([m()],fe.prototype,"_featureTemplates",void 0),e([m()],fe.prototype,"_filterText",void 0),e([m()],fe.prototype,"_hasInvalidBatchSelection",null),e([m()],fe.prototype,"_hasSelectionFromMultipleLayers",null),e([m()],fe.prototype,"_hasSelectionWithUneditableFeatures",null),e([m()],fe.prototype,"_prompt",void 0),e([m()],fe.prototype,"_spinner",void 0),e([m()],fe.prototype,"_deleteButtonCommonInfo",null),e([m()],fe.prototype,"_loading",void 0),e([m()],fe.prototype,"_selectionCountExceedsMaximum",null),e([m()],fe.prototype,"_selectionList",void 0),e([m()],fe.prototype,"_selectionListItemActionConfigs",null),e([m()],fe.prototype,"_selectionToolbar",void 0),e([m()],fe.prototype,"_visibleSelectionCount",null),e([m({readOnly:!0})],fe.prototype,"activeWorkflow",null),e([m()],fe.prototype,"editorItems",null),e([m()],fe.prototype,"effectiveSelectionManager",null),e([m()],fe.prototype,"headingLevel",void 0),e([m()],fe.prototype,"hideTemplatesForInactiveLayers",null),e([m()],fe.prototype,"icon",null),e([m()],fe.prototype,"label",null),e([m({type:g})],fe.prototype,"labelOptions",null),e([m()],fe.prototype,"layerInfos",null),e([m(),me("esri/widgets/Editor/t9n/Editor")],fe.prototype,"messages",void 0),e([m(),me("esri/t9n/common")],fe.prototype,"messagesCommon",void 0),e([m(),me("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],fe.prototype,"messagesTemplates",void 0),e([m(),me("esri/widgets/Feature/t9n/Feature")],fe.prototype,"messagesFeature",void 0),e([m()],fe.prototype,"selectionManager",null),e([m({type:_})],fe.prototype,"snappingOptions",null),e([m()],fe.prototype,"syncWithViewSelectionManager",null),e([m()],fe.prototype,"syncViewSelection",null),e([m({type:w})],fe.prototype,"tooltipOptions",null),e([m()],fe.prototype,"supportingWidgetDefaults",void 0),e([m({type:v,nonNullable:!0})],fe.prototype,"valueOptions",null),e([m({value:!1})],fe.prototype,"useLegacyCreateTools",null),e([m()],fe.prototype,"isUsingLegacyCreateTools",null),e([m()],fe.prototype,"view",null),e([m({type:S}),pe(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],fe.prototype,"viewModel",void 0),e([m({type:L,nonNullable:!0})],fe.prototype,"visibleElements",void 0),e([m()],fe.prototype,"_helpMessage",null),e([m()],fe.prototype,"_noticeMessage",null),fe=e([p("esri.widgets.Editor")],fe);const ye=fe;export{ye as default};
@@ -1,5 +1,6 @@
1
1
  import type Accessor from "../../core/Accessor.js";
2
2
  import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js";
3
+ import type { FloorVisibilityMode } from "../../webdoc/widgets/FloorFilter.js";
3
4
  import type { GoTo, GoToProperties } from "../support/GoTo.js";
4
5
 
5
6
  export interface FloorFilterViewModelProperties extends GoToProperties, Partial<Pick<FloorFilterViewModel, "facility" | "level" | "longNames" | "site" | "view">> {}
@@ -16,6 +17,15 @@ export default class FloorFilterViewModel extends FloorFilterViewModelSuperclass
16
17
  constructor(properties?: FloorFilterViewModelProperties);
17
18
  /** The currently selected facility. */
18
19
  accessor facility: string | null | undefined;
20
+ /**
21
+ * Indicates whether the floor filter should display the selected floor and all floors below it or only the selected floor.
22
+ *
23
+ * > [!NOTE]
24
+ * > Floor Visibility mode is only applicable in web scenes.
25
+ *
26
+ * @since 5.1
27
+ */
28
+ get floorVisibilityMode(): FloorVisibilityMode;
19
29
  /** The currently selected level. */
20
30
  accessor level: string | null | undefined;
21
31
  /**