@arcgis/core 5.0.0-next.121 → 5.0.0-next.123

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 (241) hide show
  1. package/applications/Components/SketchTooltipControls.d.ts +3 -2
  2. package/applications/Components/SketchTooltipControls.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/0184b4c0c92c76c60ab2.js +1 -0
  5. package/assets/esri/core/workers/chunks/{56a296cb5c1ae1ea5ab2.js → 08616877b58b518e7461.js} +1 -1
  6. package/assets/esri/core/workers/chunks/089cef7124173a5cd5f9.js +1 -0
  7. package/assets/esri/core/workers/chunks/{4d438627dd3509f65d5a.js → 0baa0d66003d23cc76a7.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0e216f0075fd531c3a2b.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d5314786df52b6be5307.js → 0e6ffb02a929130ddb50.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{4cb702d574c100483226.js → 0e8b4543e895b615c254.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{ae0a555b047b11aa68eb.js → 1219b588f983b4f35033.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{41fe4d8fe97388498f73.js → 13512a23655258fa77f4.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{ee34f14bbfe619b85a80.js → 13e913aa5f5113fceb16.js} +1 -1
  14. package/assets/esri/core/workers/chunks/1458ef3857be3b76be95.js +1 -0
  15. package/assets/esri/core/workers/chunks/{d621cdd0aef6d77986f0.js → 1469e6d1d0d4e310b8f8.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{b9e90875943703486227.js → 15ba0296403dd4152b88.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{7595c52b1647f092c61a.js → 16abc548724e428c325a.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{dddcae86e434d93b10c0.js → 189e22df73414a1a3989.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{90aeef17af12cfbecb36.js → 1d124a55f6804be19e09.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{63831996ad82bd3b1ca9.js → 1e29a114c1cfe21121c4.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{153a9d087e0fe7072af4.js → 1ede5fa7a16839ed9444.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{6b1e1fb4e9010873c171.js → 1f30558e3ad6ac68bdb8.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{9c06b803912fcafa7f52.js → 24dd404612c35f6a3fc3.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{b6e155b42a4a423139e7.js → 27d1f8279df34d8b15b5.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{401af6d07c9f458ae067.js → 2c69d8bb1c950b95278d.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{22d12c309af9c19a1a48.js → 2c7e5b78d94e5850537b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{120a5fa9b46084cd0c45.js → 2d376f82cdf020e1fca9.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{8c321c6bc344544ebb51.js → 2d52b137ee64469a46b2.js} +1 -1
  29. package/assets/esri/core/workers/chunks/2d67ab4927a968d5c8d4.js +1 -0
  30. package/assets/esri/core/workers/chunks/{5b3f2bad61a0d993bf16.js → 2e63e18df96e5a2461de.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{d4da3abbd3d88cd63cb9.js → 454150571b5b664b576a.js} +1 -1
  32. package/assets/esri/core/workers/chunks/4740d319f233b7f528fe.js +1 -0
  33. package/assets/esri/core/workers/chunks/{78ce6fcb72e97d3dc087.js → 499d594dc0d282dfe777.js} +1 -1
  34. package/assets/esri/core/workers/chunks/49d58bacb5b397246978.js +1 -0
  35. package/assets/esri/core/workers/chunks/4ba4aa6c75e3f8950e65.js +1 -0
  36. package/assets/esri/core/workers/chunks/{61ce373f00a0cad113ed.js → 4f2c29168c9de0b08741.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{5789898948cc0da78b8b.js → 552e5c413828e181f89a.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{5210bde0a05ab172ab28.js → 59f955c7d6b0589e7cc6.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{5fe0bed2a0a9f8eadb28.js → 5a347b1d87eb6f710136.js} +1 -1
  40. package/assets/esri/core/workers/chunks/5b97cdeb5949822fbef3.js +1 -0
  41. package/assets/esri/core/workers/chunks/{178c91fabf4a87bbb50b.js → 620d7cd0b0885122aa0f.js} +1 -1
  42. package/assets/esri/core/workers/chunks/6321680c8070dffa3b6c.js +1 -0
  43. package/assets/esri/core/workers/chunks/6997b4d5bcc9c4755375.js +1 -0
  44. package/assets/esri/core/workers/chunks/{b79cceeee3ed46f218a0.js → 69ab42b965bccc3bad4f.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{bb4c75479cfea67cf8a2.js → 6af14a0217077d9ab47f.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{672542d0435fbfd0647c.js → 6b3d8280a24f7a3aac40.js} +1 -1
  47. package/assets/esri/core/workers/chunks/6e0cfb76f9c2a9ec6530.js +1 -0
  48. package/assets/esri/core/workers/chunks/6e8989d61204b0b5ff52.js +1 -0
  49. package/assets/esri/core/workers/chunks/{3d78e9b3c97c0ce21d16.js → 7017c2e621236c7a7da4.js} +1 -1
  50. package/assets/esri/core/workers/chunks/7407a1e0cef508116a0b.js +1 -0
  51. package/assets/esri/core/workers/chunks/{da188d0e22ba1639928e.js → 75907e5d009b71ce723b.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{1ab4289195f5e46c6fe8.js → 78936c591fd49ff955a9.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{f0b8de5b3cfbe9223df6.js → 796f5265747ce8be910e.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{ac62411b9b4cf85a4722.js → 7a037fbfd91dd22e3bf0.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{50661f65a9c191f528bc.js → 7ee7529fcbd0d169047c.js} +1 -1
  56. package/assets/esri/core/workers/chunks/7f9b0ef7f9b3f3fd3df9.js +1 -0
  57. package/assets/esri/core/workers/chunks/804c31973f7d116523cb.js +1 -0
  58. package/assets/esri/core/workers/chunks/{82a446e8befe9d29c8f0.js → 822a115c7d718e4e3d2b.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{6789ddaa61e6d8f20d04.js → 8eea620f770576d18809.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{10c4f5afe14c0addc418.js → 9332db133a0925d522fe.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{bc87890d00d6dba979b2.js → 99c9f35a29f9f6c9e4ce.js} +1 -1
  62. package/assets/esri/core/workers/chunks/a4b422dbb6d3cb2505e1.js +1 -0
  63. package/assets/esri/core/workers/chunks/{455fbddd814e4681f0c0.js → a5e91cf150f6cf6a5d2a.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{eb4a2dc5efdb873a7f25.js → aef2832902b270f1a594.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{b5fc0a2480a229e8891a.js → b5f291e8ed7f7cac158d.js} +1 -1
  66. package/assets/esri/core/workers/chunks/bc32a4baeb0ecabb68cc.js +1 -0
  67. package/assets/esri/core/workers/chunks/bd05e68b00b9878d0266.js +1 -0
  68. package/assets/esri/core/workers/chunks/{9a43065e51df9c21c9fa.js → bdb4f216ae8881b98604.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{bf9b2aa2e67ca746ec7c.js → c15f0769a64863cccef0.js} +1 -1
  70. package/assets/esri/core/workers/chunks/c6e0ada6f2ad74fddfec.js +1 -0
  71. package/assets/esri/core/workers/chunks/cf09408cb7729126caae.js +1 -0
  72. package/assets/esri/core/workers/chunks/e0565849281ffbe8269e.js +1 -0
  73. package/assets/esri/core/workers/chunks/{4ef60a76eeca20bcafb1.js → e4f1e584f89ffb86206b.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{2889e782ed81bb05b9e5.js → e508f8e707eb3207cfcc.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{2216264b22a605a0f1ce.js → e60684918100666bb892.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{4550b7620932cd6de20e.js → e94448b371cd17d7a472.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{bb8530ade7c40a1ed7c4.js → eb9e913fe0dfcc71cf92.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{8f26e93eb539ee66c5ac.js → ec2dfd89e4ce6fda4971.js} +1 -1
  79. package/assets/esri/core/workers/chunks/ede1d1cc2f315a34f4ca.js +1 -0
  80. package/assets/esri/core/workers/chunks/{a5bd7e5d71cffde68f89.js → ee89564d11c077169b31.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{b3cc7f6d953bfbc3a70d.js → f62e37863a549f72093c.js} +1 -1
  82. package/assets/esri/core/workers/chunks/fc98b8351be567d3eb62.js +1 -0
  83. package/assets/esri/core/workers/chunks/{554f389f99db430b309c.js → ff961bb6d29ab3fe129d.js} +1 -1
  84. package/assets/esri/themes/base/widgets/_Attribution.scss +4 -2
  85. package/assets/esri/themes/dark/main.css +1 -1
  86. package/assets/esri/themes/light/main.css +1 -1
  87. package/assets/esri/themes/light/view.css +1 -1
  88. package/config.js +1 -1
  89. package/core/Logger.js +1 -1
  90. package/core/deprecate.js +1 -1
  91. package/core/has.js +1 -1
  92. package/core/types.d.ts +5 -0
  93. package/core/workers/workerFactory.js +1 -1
  94. package/editing/sharedTemplates/executor/builders/radialLines.js +1 -1
  95. package/editing/sharedTemplates/executor/builders/support/shapeUtils.js +1 -1
  96. package/geometry/projectionUtils.js +1 -1
  97. package/geometry/support/curves/curveUtils.js +1 -1
  98. package/kernel.js +1 -1
  99. package/layers/ImageryLayer.d.ts +1 -1
  100. package/layers/MapImageLayer.d.ts +1 -1
  101. package/layers/TileLayer.d.ts +1 -1
  102. package/layers/WebTileLayer.d.ts +1 -1
  103. package/layers/graphics/data/QueryEngineResult.js +1 -1
  104. package/layers/graphics/data/SnappingCandidate.js +1 -1
  105. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  106. package/layers/orientedImagery/transformations/utils.js +1 -1
  107. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  108. package/layers/support/ControlPointsGeoreference.d.ts +2 -2
  109. package/layers/support/ControlPointsGeoreference.js +1 -1
  110. package/layers/support/CornersGeoreference.d.ts +2 -2
  111. package/layers/support/CornersGeoreference.js +1 -1
  112. package/layers/support/ExtentAndRotationGeoreference.d.ts +2 -2
  113. package/layers/support/ExtentAndRotationGeoreference.js +1 -1
  114. package/layers/support/GeoreferenceBaseMixin.js +2 -0
  115. package/layers/support/mediaUtils.js +1 -1
  116. package/layers/support/relativeTimeQueryUtils.js +1 -1
  117. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  118. package/package.json +1 -1
  119. package/renderers/DotDensityRenderer.d.ts +43 -0
  120. package/renderers/DotDensityRenderer.js +1 -1
  121. package/rest/featureService/FeatureService.js +1 -1
  122. package/rest/print.js +1 -1
  123. package/rest/query/operations/pbfFlatFeatureSet.js +1 -1
  124. package/support/basemapUtils.js +1 -1
  125. package/support/revision.js +1 -1
  126. package/symbols/ExtrudeSymbol3DLayer.d.ts +20 -10
  127. package/symbols/FillSymbol3DLayer.d.ts +36 -16
  128. package/symbols/ObjectSymbol3DLayer.d.ts +28 -6
  129. package/symbols/PathSymbol3DLayer.d.ts +18 -6
  130. package/symbols/cim/CIMSymbolHelper.js +1 -1
  131. package/symbols/cim/rasterizingUtils.js +1 -1
  132. package/symbols/support/Symbol3DEmissive.d.ts +9 -9
  133. package/symbols/support/Symbol3DMaterial.d.ts +8 -8
  134. package/time/TimeExtent.d.ts +1 -1
  135. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  136. package/views/2d/interactive/SnappingVisualizer2D.js +1 -1
  137. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  138. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  139. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  140. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  141. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  142. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  143. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  144. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  145. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  146. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
  147. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  148. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  149. package/views/2d/layers/support/RouteLayerWaypointVisualization.js +1 -1
  150. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  151. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  152. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  153. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  154. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  155. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  156. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  157. package/views/Attribution.js +1 -1
  158. package/views/DOMContainer.js +1 -1
  159. package/views/LinkChartView.d.ts +1 -1
  160. package/views/MapView.d.ts +1 -1
  161. package/views/SceneView.d.ts +1 -1
  162. package/views/View.d.ts +1 -1
  163. package/views/input/types.d.ts +1 -1
  164. package/views/interactive/keybindings.js +1 -1
  165. package/views/interactive/snapping/candidates/EdgeSnappingCandidate.js +1 -1
  166. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  167. package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
  168. package/views/interactive/snapping/featureSources/snappingCandidateElevationAlignment.js +1 -1
  169. package/views/interactive/snapping/featureSources/snappingCandidateElevationFilter.js +1 -1
  170. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  171. package/views/layers/FeatureLikeLayerView.js +1 -1
  172. package/views/layers/support/WhereClauseVisitor.js +1 -1
  173. package/views/ui/DefaultUI.d.ts +5 -12
  174. package/views/ui/DefaultUI.js +1 -1
  175. package/views/ui/types.d.ts +1 -1
  176. package/webscene/Glow.d.ts +5 -0
  177. package/webscene/SunLighting.d.ts +20 -2
  178. package/webscene/VirtualLighting.d.ts +20 -2
  179. package/widgets/Attribution/AttributionViewModel.d.ts +1 -1
  180. package/widgets/Attribution.d.ts +1 -1
  181. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  182. package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
  183. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +1 -1
  184. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  185. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +2 -11
  186. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
  187. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  188. package/widgets/BatchAttributeForm/inputs/support/textElementInputUtils.js +2 -0
  189. package/widgets/BatchAttributeForm/templates/TextElementTemplate.js +1 -1
  190. package/widgets/BatchAttributeForm/templates/support/constants.js +2 -0
  191. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  192. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  193. package/widgets/BatchAttributeForm/templates/support/textElementTemplateUtils.js +2 -0
  194. package/widgets/Editor/components/Settings.js +1 -1
  195. package/widgets/Features/FeaturesViewModel.js +1 -1
  196. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  197. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
  198. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  199. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  200. package/widgets/OrientedImageryViewer/services/TransformationService.js +1 -1
  201. package/widgets/OrientedImageryViewer/support/dataCaptureUtils.js +1 -1
  202. package/widgets/OrientedImageryViewer/support/geometryUtils.js +1 -1
  203. package/widgets/OrientedImageryViewer/support/urlUtils.js +1 -1
  204. package/widgets/OrientedImageryViewer/utils.js +1 -1
  205. package/widgets/OrientedImageryViewer.js +1 -1
  206. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  207. package/widgets/PanoramicViewer/support/PanoramicMedia.js +1 -1
  208. package/widgets/Print/PrintViewModel.js +1 -1
  209. package/widgets/Sketch.js +1 -1
  210. package/widgets/TimeSlider/TimeSliderViewModel.d.ts +1 -2
  211. package/widgets/TimeSlider.d.ts +5 -6
  212. package/widgets/support/SketchTooltipControls.js +1 -1
  213. package/assets/esri/core/workers/chunks/00112f984698b31909d3.js +0 -1
  214. package/assets/esri/core/workers/chunks/0c8a676599821b9871c2.js +0 -1
  215. package/assets/esri/core/workers/chunks/2b7615cccbaeda1649f3.js +0 -1
  216. package/assets/esri/core/workers/chunks/2f0ea91afc9aa8ee9cad.js +0 -1
  217. package/assets/esri/core/workers/chunks/3a850b5e847b6b0ea53f.js +0 -1
  218. package/assets/esri/core/workers/chunks/449cf6ae6b6e6c2795e5.js +0 -1
  219. package/assets/esri/core/workers/chunks/4dcd5d5ea5875a08a7c7.js +0 -1
  220. package/assets/esri/core/workers/chunks/5058715f32ff026053a9.js +0 -1
  221. package/assets/esri/core/workers/chunks/529dbf16ffbbd39f3fa2.js +0 -1
  222. package/assets/esri/core/workers/chunks/58cf3d35771b87bd74e5.js +0 -1
  223. package/assets/esri/core/workers/chunks/652bb1b53782cdd3103c.js +0 -1
  224. package/assets/esri/core/workers/chunks/6acab23acf3b044f5215.js +0 -1
  225. package/assets/esri/core/workers/chunks/6c2a7bac3f8e32c83292.js +0 -1
  226. package/assets/esri/core/workers/chunks/6d26e5368e8952003669.js +0 -1
  227. package/assets/esri/core/workers/chunks/7cb6ccee9bcef449caea.js +0 -1
  228. package/assets/esri/core/workers/chunks/879e8439a513cb333b61.js +0 -1
  229. package/assets/esri/core/workers/chunks/98c3b7d8db53f0b12642.js +0 -1
  230. package/assets/esri/core/workers/chunks/a027da22acdaa6d6baa3.js +0 -1
  231. package/assets/esri/core/workers/chunks/a6006718fe22d9f2fa87.js +0 -1
  232. package/assets/esri/core/workers/chunks/b60337c471e2b855d02a.js +0 -1
  233. package/assets/esri/core/workers/chunks/bd1bbf1820e12d7a27f6.js +0 -1
  234. package/assets/esri/core/workers/chunks/c88101cb8301f095d037.js +0 -1
  235. package/assets/esri/core/workers/chunks/c9067667290e93407dd7.js +0 -1
  236. package/assets/esri/core/workers/chunks/e59c5bcf91984aa5be6d.js +0 -1
  237. package/assets/esri/core/workers/chunks/e71d08c6f545c2c70174.js +0 -1
  238. package/assets/esri/core/workers/chunks/f347dee99faa9ee5eef1.js +0 -1
  239. package/layers/support/GeoreferenceBase.d.ts +0 -4
  240. package/layers/support/GeoreferenceBase.js +0 -2
  241. package/widgets/BatchAttributeForm/inputs/support/textInputElementUtils.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import r from"../../../core/Error.js";import a from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{whenOrAbort as o}from"../../../core/promiseUtils.js";import i from"../../../core/ReactiveMap.js";import{property as n,subclass as l}from"../../../core/accessorSupport/decorators.js";import{DateOnly as u}from"../../../core/sql/DateOnly.js";import{TimeOnly as c}from"../../../core/sql/TimeOnly.js";import{makeUseId as p}from"../inputs/support/inputUtils.js";import{isGroupElementTemplate as d,isFieldElementTemplate as f}from"../templates/support/templateUtils.js";let h=null,m=class extends t{constructor(e){super(e),this.calculating=!1,this.arcadeContext=null,this._abortController=new AbortController,this.layerExpressionsModelMap=new Map,this.evaluatedExpressions=new i,this.expressionEvaluationFailed=!1}abort(){this._abortController.abort()}async runAllExpressions(e,t=!1){return this._evaluateSpecifiedComponentsForEachFeature(e,v,t)}async runGeometryDependentExpressions(e,t=!1){return this._evaluateSpecifiedComponentsForEachFeature(e,x,t)}async valueChanged(e,t,r=!0){try{this.calculating=!0;const a=t.map(t=>this.evaluateValueChangedForFeature(e,t,r));await Promise.all(a)}catch(s){a.getLogger(this).error(s),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}async evaluateValueChangedForFeature(e,t,r){if(this._abortController.signal.aborted)return;const a=this.layerExpressionsModelMap.get(t.layer);if(!a||0===a.components.length)return;const s=new Set,o=new Set([e]),i=new Set;for(;o.size>0;){const[e]=o;if(o.delete(e),s.has(e))continue;s.add(e);const n=a.fieldReferencesMap.get(e.toLowerCase());if(!n)continue;for(const t of n)i.has(t)&&n.delete(t);if(0===n.size)continue;const l=new Set;await this.evaluateAffectedComponents([...n],t,a,r,l);for(const t of n)i.add(t);for(const t of l)s.has(t)||o.add(t)}}async evaluateAffectedComponents(e,t,r,a,s){const o=new Map;for(const n of e)o.has(n)||o.set(n,this.createSccEvaluator(n,t,o,r));if(0===o.size)return;const i=[...o.values()].map(e=>e.evaluate(a,s));await Promise.all(i)}createSccEvaluator(e,t,r,a){const o=new g(e,t,this.arcadeContext,a,this.evaluatedExpressions,this._abortController);for(const i of e.adjacencyList)o.dependentEvaluators.push(s(r,i,()=>this.createSccEvaluator(i,t,r,a)));return o}async _evaluateSpecifiedComponentsForEachFeature(e,t,r=!1){this.calculating=!0;try{const a=[];for(const s of e){const e=this.layerExpressionsModelMap.get(s.layer);if(!e||0===e.components.length)continue;const o=new Set;a.push(this.evaluateAffectedComponents(t(e),s,e,r,o))}await o(Promise.all(a),this._abortController)}catch(s){a.getLogger(this).error(s),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}};e([n()],m.prototype,"calculating",void 0),e([n({constructOnly:!0})],m.prototype,"arcadeContext",void 0),e([n()],m.prototype,"_abortController",void 0),e([n()],m.prototype,"layerExpressionsModelMap",void 0),e([n()],m.prototype,"evaluatedExpressions",void 0),e([n()],m.prototype,"expressionEvaluationFailed",void 0),m=e([l("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager")],m);class g{constructor(e,t,r,a,s,o){this.scc=e,this.feature=t,this.arcadeContextInfo=r,this.expressionsModel=a,this.evaluatedExpressions=s,this._abortController=o,this.dependentEvaluators=[],this._evaluatorPromise=null}get baseContext(){const{editType:e,map:t,spatialReference:r,timeZone:a}=this.arcadeContextInfo,s=this.feature.layer,o="scene"===s?.type&&null!=s.associatedLayer?s.associatedLayer:s;return{variables:{$originalfeature:this.feature.original,$editcontext:{editType:e},$layer:o,$featureset:o,$datastore:o?.url,$feature:this.feature.plainGraphic,$map:t},executeContext:{rawOutput:!0,spatialReference:r??void 0,timeZone:a,abortSignal:this._abortController.signal}}}evaluate(e,t){return null==this._evaluatorPromise&&(this._evaluatorPromise=this._evaluate(e,t)),this._evaluatorPromise}async _evaluate(e,t){null===h&&(h=await import("../../../arcade/languageUtils.js"));const a=this.dependentEvaluators.map(r=>r.evaluate(e,t));await o(Promise.all(a),this._abortController);for(const o of this.scc.executors){const a=this.baseContext;if(this._abortController.signal.aborted)break;const l=this.expressionsModel.arcadeExecutorUses.get(o)??[],u=s(this.evaluatedExpressions,this.feature,()=>new i);let c=null,h=null;try{c=o.isAsync?await o.executeAsync(a.variables,a.executeContext):o.execute(a.variables,a.executeContext),h={result:c,status:"success"}}catch(n){h={error:n,status:"error"}}for(const r of l){const a=this.expressionsModel.elementTemplateMap.get(r.elementId);switch(r.executorPurpose){case"editable":case"required":u.set(p(r.elementId,r.executorPurpose),h);break;case"value":{if("error"===h?.status)continue;const e=a.getExpressionExecutorsForLayer(this.feature.layer);let r=!0;if(e?.editableExpression&&(r=!1===u.get(p(a.elementId,"editable"))?.result),r){const e=this.feature.getAttribute(a.fieldName)??null,r=y(h.result,this.feature,a.fieldName,this.arcadeContextInfo.timeZone);r!==e&&(this.feature.setAttribute(a.fieldName,r),t.add(a.fieldName))}}break;case"visibility":if(u.set(p(r.elementId,r.executorPurpose),h),!this.expressionsModel.preserveFieldValuesWhenHidden&&!1===h.result&&e)if(d(a)){for(const e of a.elements)if(f(e)){null!==this.feature.getAttribute(e.fieldName)&&t.add(e.fieldName),this.feature.setAttribute(e.fieldName,null)}}else if(f(a)){null!==this.feature.getAttribute(a.fieldName)&&t.add(a.fieldName),this.feature.setAttribute(a.fieldName,null)}}}if("error"===h?.status){const e=new Set;for(const t of l){const r=this.expressionsModel.elementTemplateMap.get(t.elementId);if(r)switch(t.executorPurpose){case"editable":e.add(r.label+" - Editable expression");break;case"required":e.add(r.label+" - Required expression");break;case"value":e.add(r.label+" - Value expression");break;case"visibility":e.add(r.label+" - Visibility expression")}}if(e.size>0)throw new r("expression-evaluation-failed","Arcade evaluation failed ("+[...e].join(",")+")");throw new r("expression-evaluation-failed","Arcade evaluation failed ")}}}}function y(e,t,a,s){if(null===e)return null;const o=t.layer.fieldsIndex.get(a);if(!o)throw new r("field-not-found","Unable set field value as the field cannot be found. ("+a+")");switch(o.type){case"big-integer":case"integer":case"long":case"oid":case"small-integer":case"single":case"double":return h.toNumber(e);case"global-id":case"guid":case"string":return h.toString(e);case"date":{if(h.isDate(e))return e.getTime();const t=h.toDate(e,s);if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type. ("+a+")");return t.getTime()}case"date-only":{if(h.isDateOnly(e))return e.toStorageFormat();if(h.isDate(e))return u.fromDateTime(e.toDateTime()).toStorageFormat();const t=u.fromString(h.toString(e));if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type.");return t.toStorageFormat()}case"time-only":{if(h.isTime(e))return e.toStorageString();if(h.isDate(e)){return c.fromDateTime(e.toDateTime()).toStorageString()}const t=c.fromString(h.toString(e));if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type.");return t.toStorageString()}case"timestamp-offset":{if(h.isDate(e))return e.toISOString(!1);const t=h.toDate(e,s);if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type. ("+a+")");return t.toISOString(!1)}}throw new r("unsupported-value-type","Arcade return type is not a supported field type. ("+a+")")}function v(e){return e.components}function x(e){return Array.from(e.geometryReferences)}export{m as ExpressionsManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import r from"../../../core/Error.js";import a from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{whenOrAbort as o}from"../../../core/promiseUtils.js";import i from"../../../core/ReactiveMap.js";import{property as n,subclass as l}from"../../../core/accessorSupport/decorators.js";import{DateOnly as u}from"../../../core/sql/DateOnly.js";import{TimeOnly as c}from"../../../core/sql/TimeOnly.js";import{makeUseId as p}from"../inputs/support/inputUtils.js";import{isGroupElementTemplate as d,isFieldElementTemplate as f}from"../templates/support/templateUtils.js";let h=null,m=class extends t{constructor(e){super(e),this.calculating=!1,this.arcadeContext=null,this._abortController=new AbortController,this.layerExpressionsModelMap=new Map,this.evaluatedExpressions=new i,this.expressionEvaluationFailed=!1}abort(){this._abortController.abort()}async runAllExpressions(e,t=!1){return this._evaluateSpecifiedComponentsForEachFeature(e,v,t)}async runGeometryDependentExpressions(e,t=!1){return this._evaluateSpecifiedComponentsForEachFeature(e,x,t)}async valueChanged(e,t,r=!0){try{this.calculating=!0;const a=t.map(t=>this.evaluateValueChangedForFeature(e,t,r));await Promise.all(a)}catch(s){a.getLogger(this).error(s),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}async evaluateValueChangedForFeature(e,t,r){if(this._abortController.signal.aborted)return;const a=this.layerExpressionsModelMap.get(t.layer);if(!a||0===a.components.length)return;const s=new Set,o=new Set([e]),i=new Set;for(;o.size>0;){const[e]=o;if(o.delete(e),s.has(e))continue;s.add(e);const n=a.fieldReferencesMap.get(e.toLowerCase());if(!n)continue;for(const t of n)i.has(t)&&n.delete(t);if(0===n.size)continue;const l=new Set;await this.evaluateAffectedComponents([...n],t,a,r,l);for(const t of n)i.add(t);for(const t of l)s.has(t)||o.add(t)}}async evaluateAffectedComponents(e,t,r,a,s){const o=new Map;for(const n of e)o.has(n)||o.set(n,this.createSccEvaluator(n,t,o,r));if(0===o.size)return;const i=[...o.values()].map(e=>e.evaluate(a,s));await Promise.all(i)}createSccEvaluator(e,t,r,a){const o=new g(e,t,this.arcadeContext,a,this.evaluatedExpressions,this._abortController);for(const i of e.adjacencyList)o.dependentEvaluators.push(s(r,i,()=>this.createSccEvaluator(i,t,r,a)));return o}async _evaluateSpecifiedComponentsForEachFeature(e,t,r=!1){this.calculating=!0;try{const a=[];for(const s of e){const e=this.layerExpressionsModelMap.get(s.layer);if(!e||0===e.components.length)continue;const o=new Set;a.push(this.evaluateAffectedComponents(t(e),s,e,r,o))}await o(Promise.all(a),this._abortController)}catch(s){a.getLogger(this).error(s),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}};e([n()],m.prototype,"calculating",void 0),e([n({constructOnly:!0})],m.prototype,"arcadeContext",void 0),e([n()],m.prototype,"_abortController",void 0),e([n()],m.prototype,"layerExpressionsModelMap",void 0),e([n()],m.prototype,"evaluatedExpressions",void 0),e([n()],m.prototype,"expressionEvaluationFailed",void 0),m=e([l("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager")],m);class g{constructor(e,t,r,a,s,o){this.scc=e,this.feature=t,this.arcadeContextInfo=r,this.expressionsModel=a,this.evaluatedExpressions=s,this._abortController=o,this.dependentEvaluators=[],this._evaluatorPromise=null}get baseContext(){const{editType:e,map:t,spatialReference:r,timeZone:a}=this.arcadeContextInfo,s=this.feature.layer,o="scene"===s?.type&&null!=s.associatedLayer?s.associatedLayer:s;return{variables:{$originalfeature:this.feature.original,$editcontext:{editType:e},$layer:o,$featureset:o,$datastore:o?.url,$feature:this.feature.plainGraphic,$map:t},executeContext:{rawOutput:!0,spatialReference:r??void 0,timeZone:a,abortSignal:this._abortController.signal}}}evaluate(e,t){return null==this._evaluatorPromise&&(this._evaluatorPromise=this._evaluate(e,t)),this._evaluatorPromise}async _evaluate(e,t){null===h&&(h=await import("../../../arcade/languageUtils.js"));const a=this.dependentEvaluators.map(r=>r.evaluate(e,t));await o(Promise.all(a),this._abortController);for(const o of this.scc.executors){const a=this.baseContext;if(this._abortController.signal.aborted)break;const l=this.expressionsModel.arcadeExecutorUses.get(o)??[],u=s(this.evaluatedExpressions,this.feature,()=>new i);let c=null,h=null;try{c=o.isAsync?await o.executeAsync(a.variables,a.executeContext):o.execute(a.variables,a.executeContext),h={result:c,status:"success"}}catch(n){h={error:n,status:"error"}}for(const r of l){const a=this.expressionsModel.elementTemplateMap.get(r.elementId);switch(r.executorPurpose){case"editable":case"required":case"text":u.set(p(r),h);break;case"value":{if("error"===h?.status)continue;const e=a.getExpressionExecutorsForLayer(this.feature.layer);let r=!0;if(e?.editableExpression&&(r=!1===u.get(p({elementId:a.elementId,executorPurpose:"editable"}))?.result),r){const e=this.feature.getAttribute(a.fieldName)??null,r=y(h.result,this.feature,a.fieldName,this.arcadeContextInfo.timeZone);r!==e&&(this.feature.setAttribute(a.fieldName,r),t.add(a.fieldName))}}break;case"visibility":if(u.set(p(r),h),!this.expressionsModel.preserveFieldValuesWhenHidden&&!1===h.result&&e)if(d(a)){for(const e of a.elements)if(f(e)){null!==this.feature.getAttribute(e.fieldName)&&t.add(e.fieldName),this.feature.setAttribute(e.fieldName,null)}}else if(f(a)){null!==this.feature.getAttribute(a.fieldName)&&t.add(a.fieldName),this.feature.setAttribute(a.fieldName,null)}}}if("error"===h?.status){const e=new Set;for(const t of l){const r=this.expressionsModel.elementTemplateMap.get(t.elementId);if(r)switch(t.executorPurpose){case"editable":e.add(r.label+" - Editable expression");break;case"required":e.add(r.label+" - Required expression");break;case"value":e.add(r.label+" - Value expression");break;case"visibility":e.add(r.label+" - Visibility expression")}}if(e.size>0)throw new r("expression-evaluation-failed","Arcade evaluation failed ("+[...e].join(",")+")");throw new r("expression-evaluation-failed","Arcade evaluation failed ")}}}}function y(e,t,a,s){if(null===e)return null;const o=t.layer.fieldsIndex.get(a);if(!o)throw new r("field-not-found","Unable set field value as the field cannot be found. ("+a+")");switch(o.type){case"big-integer":case"integer":case"long":case"oid":case"small-integer":case"single":case"double":return h.toNumber(e);case"global-id":case"guid":case"string":return h.toString(e);case"date":{if(h.isDate(e))return e.getTime();const t=h.toDate(e,s);if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type. ("+a+")");return t.getTime()}case"date-only":{if(h.isDateOnly(e))return e.toStorageFormat();if(h.isDate(e))return u.fromDateTime(e.toDateTime()).toStorageFormat();const t=u.fromString(h.toString(e));if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type.");return t.toStorageFormat()}case"time-only":{if(h.isTime(e))return e.toStorageString();if(h.isDate(e)){return c.fromDateTime(e.toDateTime()).toStorageString()}const t=c.fromString(h.toString(e));if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type.");return t.toStorageString()}case"timestamp-offset":{if(h.isDate(e))return e.toISOString(!1);const t=h.toDate(e,s);if(!t)throw new r("unsupported-value-type","Arcade return type is not a supported field type. ("+a+")");return t.toISOString(!1)}}throw new r("unsupported-value-type","Arcade return type is not a supported field type. ("+a+")")}function v(e){return e.components}function x(e){return Array.from(e.geometryReferences)}export{m as ExpressionsManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{isSome as e,pushIfSome as t}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as n}from"../../../core/MapUtils.js";import o from"../../../core/Queue.js";import{addMany as s,last as r}from"../../../core/SetUtils.js";import{isFieldElementTemplate as i}from"../templates/support/templateUtils.js";let c=0;class a{constructor(e){this.arcadeExecutorUses=new Map,this.components=[],this.preserveFieldValuesWhenHidden=!1,this.executorMap=e.executorMap,this.preserveFieldValuesWhenHidden=!0===e.preserveFieldValuesWhenHidden,this.elementTemplateMap=new Map;for(const t of this.executorMap.keys())this.elementTemplateMap.set(t.elementId,t);this._buildDependencyGraph()}_buildDependencyGraph(){const e=f(this.executorMap),t={components:[],arcadeExecutorUses:this.arcadeExecutorUses,elementTemplatesById:new Map([...this.executorMap.keys()].map(e=>[e.elementId,e])),executorMap:this.executorMap,fieldElementTemplateMap:u(this.executorMap),fieldReferencesMap:new Map,geometryReferences:new Set,nextIndex:0,nodeInfoMap:e,nodeStack:new o(r),shouldConsiderVisibility:!this.preserveFieldValuesWhenHidden};for(const o of this.executorMap.keys()){const e=this.executorMap.get(o);e.editableExpression&&n(this.arcadeExecutorUses,e.editableExpression,()=>[]).push({elementId:o.elementId,executorPurpose:"editable"}),e.valueExpression&&n(this.arcadeExecutorUses,e.valueExpression,()=>[]).push({elementId:o.elementId,executorPurpose:"value"}),e?.visibilityExpression&&n(this.arcadeExecutorUses,e.visibilityExpression,()=>[]).push({elementId:o.elementId,executorPurpose:"visibility"}),e?.requiredExpression&&n(this.arcadeExecutorUses,e.requiredExpression,()=>[]).push({elementId:o.elementId,executorPurpose:"required"})}for(const n of this.arcadeExecutorUses.values())n.sort(e=>"editable"===e.executorPurpose?-1:1);for(const n of e.values())-1===n.index&&p(n,t);this.dependencyGraphComponents=m(t.nodeInfoMap),this.fieldReferencesMap=x(t),this.geometryReferences=h(t),this.components=t.components}}function p(e,t){e.index=e.lowlink=t.nextIndex++,t.nodeStack.push(e);for(const n of l(e,t))-1===n.index?(p(n,t),e.lowlink=Math.min(e.lowlink,n.lowlink)):n.index<e.index&&t.nodeStack.contains(n)&&(e.lowlink=Math.min(e.lowlink,n.index)),t.nodeStack.contains(n)||e.crossLinkNeighbors.add(n);if(e.lowlink===e.index){const n=y();for(t.components.push(n);w(t.nodeStack)>=e.index;){const e=t.nodeStack.pop();if(null!=e){e.component=n,n.executors.add(e.executor);for(const t of e.crossLinkNeighbors)null!=t.component&&n.adjacencyList.add(t.component)}}}}function l({executor:t},o){const r=new Set;for(const e of t.fieldsUsed){const i=e.toLowerCase();n(o.fieldReferencesMap,i,()=>new Set).add(t),s(r,d(i,o))}t.geometryUsed&&o.geometryReferences.add(t);const i=o.arcadeExecutorUses.get(t)?.filter(e=>"value"===e.executorPurpose)??[];for(const e of i){const n=o.executorMap.get(o.elementTemplatesById.get(e.elementId));n?.editableExpression&&n.editableExpression!==t&&r.add(n.editableExpression)}return Array.from(r).map(e=>o.nodeInfoMap.get(e)).filter(e)}function d(e,{executorMap:n,fieldElementTemplateMap:o,shouldConsiderVisibility:s}){const r=[],i=o.get(e);if(null==i)return r;const c=n.get(i);if(null==c)return r;if(t(r,c.editableExpression),t(r,c.valueExpression),s){t(r,c?.visibilityExpression);const{group:e}=i;if(null!=e){const o=n.get(e)?.visibilityExpression;t(r,o)}}return r}function u(e){const t=new Map;for(const n of e.keys())i(n)&&t.set(n.fieldName.toLowerCase(),n);return t}function f(t){const n=Array.from(t.values()).filter(e),o=new Set(n.flatMap(e=>Array.from(Object.values(e)))),s=Array.from(o).map(e=>({component:null,crossLinkNeighbors:new Set,executor:e,index:-1,lowlink:-1,onStack:!1}));return new Map(s.map(e=>[e.executor,e]))}function m(e){return new Map([...e.values()].map(({component:e,executor:t})=>[t,e]))}function x({fieldReferencesMap:e,nodeInfoMap:t}){const n=new Map;for(const[o,s]of e.entries())n.set(o,M(s,t));return n}function h({geometryReferences:e,nodeInfoMap:t}){return M(e,t)}function M(e,t){const n=new Set;for(const o of e){const e=t.get(o);e?.component&&n.add(e.component)}return n}function y(){c++;const e=c.toString();return{executors:new Set,adjacencyList:new Set,componentId:e}}function w(e){return e.peek()?.index??-1}export{a as ExpressionsModel,l as getDirectDependencies};
2
+ import{isSome as e,addMany as t,pushIfSome as n}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import s from"../../../core/Queue.js";import{addMany as r,last as i}from"../../../core/SetUtils.js";import{isFieldElementTemplate as c}from"../templates/support/templateUtils.js";let a=0;class p{constructor(e){this.arcadeExecutorUses=new Map,this.components=[],this.preserveFieldValuesWhenHidden=!1,this.executorMap=e.executorMap,this.preserveFieldValuesWhenHidden=!0===e.preserveFieldValuesWhenHidden,this.elementTemplateMap=new Map;for(const t of this.executorMap.keys())this.elementTemplateMap.set(t.elementId,t);this._buildDependencyGraph()}_buildDependencyGraph(){const e=f(this.executorMap),t={components:[],arcadeExecutorUses:this.arcadeExecutorUses,elementTemplatesById:new Map([...this.executorMap.keys()].map(e=>[e.elementId,e])),executorMap:this.executorMap,fieldElementTemplateMap:x(this.executorMap),fieldReferencesMap:new Map,geometryReferences:new Set,nextIndex:0,nodeInfoMap:e,nodeStack:new s(i),shouldConsiderVisibility:!this.preserveFieldValuesWhenHidden};for(const n of this.executorMap.keys()){const e=this.executorMap.get(n);e.editableExpression&&o(this.arcadeExecutorUses,e.editableExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"editable"}),e.valueExpression&&o(this.arcadeExecutorUses,e.valueExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"value"}),e.visibilityExpression&&o(this.arcadeExecutorUses,e.visibilityExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"visibility"}),e.requiredExpression&&o(this.arcadeExecutorUses,e.requiredExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"required"}),e.textExpressions&&e.textExpressions.forEach((e,t)=>{o(this.arcadeExecutorUses,e,()=>[]).push({elementId:n.elementId,executorPurpose:"text",textExpressionIndex:t})})}for(const n of this.arcadeExecutorUses.values())n.sort(e=>"editable"===e.executorPurpose?-1:1);for(const n of e.values())-1===n.index&&d(n,t);this.dependencyGraphComponents=m(t.nodeInfoMap),this.fieldReferencesMap=h(t),this.geometryReferences=M(t),this.components=t.components}}function d(e,t){e.index=e.lowlink=t.nextIndex++,t.nodeStack.push(e);for(const n of l(e,t))-1===n.index?(d(n,t),e.lowlink=Math.min(e.lowlink,n.lowlink)):n.index<e.index&&t.nodeStack.contains(n)&&(e.lowlink=Math.min(e.lowlink,n.index)),t.nodeStack.contains(n)||e.crossLinkNeighbors.add(n);if(e.lowlink===e.index){const n=y();for(t.components.push(n);w(t.nodeStack)>=e.index;){const e=t.nodeStack.pop();if(null!=e){e.component=n,n.executors.add(e.executor);for(const t of e.crossLinkNeighbors)null!=t.component&&n.adjacencyList.add(t.component)}}}}function l({executor:t},n){const s=new Set;for(const e of t.fieldsUsed){const i=e.toLowerCase();o(n.fieldReferencesMap,i,()=>new Set).add(t),r(s,u(i,n))}t.geometryUsed&&n.geometryReferences.add(t);const i=n.arcadeExecutorUses.get(t)?.filter(e=>"value"===e.executorPurpose)??[];for(const e of i){const o=n.executorMap.get(n.elementTemplatesById.get(e.elementId));o?.editableExpression&&o.editableExpression!==t&&s.add(o.editableExpression)}return Array.from(s).map(e=>n.nodeInfoMap.get(e)).filter(e)}function u(e,{executorMap:t,fieldElementTemplateMap:o,shouldConsiderVisibility:s}){const r=[],i=o.get(e);if(null==i)return r;const c=t.get(i);if(null==c)return r;if(n(r,c.editableExpression),n(r,c.valueExpression),s){n(r,c.visibilityExpression);const{group:e}=i;if(null!=e){const o=t.get(e)?.visibilityExpression;n(r,o)}}return r}function x(e){const t=new Map;for(const n of e.keys())c(n)&&t.set(n.fieldName.toLowerCase(),n);return t}function f(n){const o=Array.from(n.values()).filter(e),s=new Set(o.flatMap(e=>{const{textExpressions:n,...o}=e,s=[];return n?.length&&t(s,n),t(s,Object.values(o)),s})),r=Array.from(s).map(e=>({component:null,crossLinkNeighbors:new Set,executor:e,index:-1,lowlink:-1,onStack:!1}));return new Map(r.map(e=>[e.executor,e]))}function m(e){return new Map([...e.values()].map(({component:e,executor:t})=>[t,e]))}function h({fieldReferencesMap:e,nodeInfoMap:t}){const n=new Map;for(const[o,s]of e.entries())n.set(o,E(s,t));return n}function M({geometryReferences:e,nodeInfoMap:t}){return E(e,t)}function E(e,t){const n=new Set;for(const o of e){const e=t.get(o);e?.component&&n.add(e.component)}return n}function y(){a++;const e=a.toString();return{executors:new Set,adjacencyList:new Set,componentId:e}}function w(e){return e.peek()?.index??-1}export{p as ExpressionsModel,l as getDirectDependencies};
@@ -10,7 +10,7 @@ import type { FieldInputDataTypes } from "../../support/forms/types.js";
10
10
  export interface FieldInputProperties extends EditableInputProperties {}
11
11
 
12
12
  /**
13
- * This is a read-only support class that represents a field input in a [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/).
13
+ * This is a read-only support class that represents a [field element](https://developers.arcgis.com/javascript/latest/references/core/form/elements/FieldElement/) in a [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/).
14
14
  *
15
15
  * @since 4.33
16
16
  * @see [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import i from"../../../core/Collection.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isAttributeFormSupportedLayerUnion as o}from"../batchAttributeFormUtils.js";import{visibilityCodeToBoolean as l,makeUseId as a}from"./support/inputUtils.js";let n=class extends t{constructor(e){super(e),this.existsInAllLayers=!0,this.features=new i}get description(){return this.template.description}get featuresHaveSameCalculatedVisibility(){const e=new Set;for(const t of this.features){if(null==this.template.getExpressionExecutorsForLayer(t.layer)?.visibilityExpression){e.add(!0);continue}const i=this._lookupEvaluatedExpression(t,"visibility");if("success"===i?.status){if(e.add(!0===i.result),e.size>1)return!1}else e.add(!1)}return e.size<=1}get updating(){return!1}get label(){return this.template.label}get layers(){return Array.from(new Set(this.features.map(e=>e.layer).filter(o)))}get visibilityCode(){return this._baseVisibilityCode}get visible(){return l(this.visibilityCode)}get _baseVisibilityCode(){return this.existsInAllLayers?this.featuresHaveSameCalculatedVisibility?!1===this._evaluatedVisibilityExpression?"hidden:visibility-expression:all-features":"visible":"hidden:visibility-expression:some-features":"hidden:not-in-all-layers"}get _evaluatedVisibilityExpression(){let e=!0,t=!0;for(const i of this.features){if(null==this.template.getExpressionExecutorsForLayer(i.layer)?.visibilityExpression){e=e&&!0;continue}t=!1;const s=this._lookupEvaluatedExpression(i,"visibility");"success"===s?.status?e=e&&!0===s.result:e=!1}return t?null:e}_lookupEvaluatedExpression(e,t){return this.expressionsManager.evaluatedExpressions.get(e)?.get(a(this.template.elementId,t))}};e([s({constructOnly:!0})],n.prototype,"expressionsManager",void 0),e([s()],n.prototype,"description",null),e([s()],n.prototype,"existsInAllLayers",void 0),e([s()],n.prototype,"features",void 0),e([s()],n.prototype,"featuresHaveSameCalculatedVisibility",null),e([s()],n.prototype,"updating",null),e([s()],n.prototype,"label",null),e([s()],n.prototype,"layers",null),e([s({constructOnly:!0})],n.prototype,"template",void 0),e([s()],n.prototype,"visibilityCode",null),e([s()],n.prototype,"visible",null),e([s()],n.prototype,"_baseVisibilityCode",null),e([s()],n.prototype,"_evaluatedVisibilityExpression",null),n=e([r("esri.widgets.BatchAttributeForm.inputs.InputBase")],n);const p=n;export{p as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import i from"../../../core/Collection.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isAttributeFormSupportedLayerUnion as o}from"../batchAttributeFormUtils.js";import{visibilityCodeToBoolean as l,makeUseId as a}from"./support/inputUtils.js";let n=class extends t{constructor(e){super(e),this.existsInAllLayers=!0,this.features=new i}get description(){return this.template.description}get featuresHaveSameCalculatedVisibility(){const e=new Set;for(const t of this.features){if(null==this.template.getExpressionExecutorsForLayer(t.layer)?.visibilityExpression){e.add(!0);continue}const i=this._lookupEvaluatedExpression(t,"visibility");if("success"===i?.status){if(e.add(!0===i.result),e.size>1)return!1}else e.add(!1)}return e.size<=1}get label(){return this.template.label}get layers(){return Array.from(new Set(this.features.map(e=>e.layer).filter(o)))}get visibilityCode(){return this._baseVisibilityCode}get visible(){return l(this.visibilityCode)}get _baseVisibilityCode(){return this.existsInAllLayers?this.featuresHaveSameCalculatedVisibility?!1===this._evaluatedVisibilityExpression?"hidden:visibility-expression:all-features":"visible":"hidden:visibility-expression:some-features":"hidden:not-in-all-layers"}get _evaluatedVisibilityExpression(){let e=!0,t=!0;for(const i of this.features){if(null==this.template.getExpressionExecutorsForLayer(i.layer)?.visibilityExpression){e=e&&!0;continue}t=!1;const s=this._lookupEvaluatedExpression(i,"visibility");"success"===s?.status?e=e&&!0===s.result:e=!1}return t?null:e}_lookupEvaluatedExpression(e,t,i){return this.expressionsManager.evaluatedExpressions.get(e)?.get(a({elementId:this.template.elementId,executorPurpose:t,textExpressionIndex:i}))}};e([s({constructOnly:!0})],n.prototype,"expressionsManager",void 0),e([s()],n.prototype,"description",null),e([s()],n.prototype,"existsInAllLayers",void 0),e([s()],n.prototype,"features",void 0),e([s()],n.prototype,"featuresHaveSameCalculatedVisibility",null),e([s()],n.prototype,"label",null),e([s()],n.prototype,"layers",null),e([s({constructOnly:!0})],n.prototype,"template",void 0),e([s()],n.prototype,"visibilityCode",null),e([s()],n.prototype,"visible",null),e([s()],n.prototype,"_baseVisibilityCode",null),e([s()],n.prototype,"_evaluatedVisibilityExpression",null),n=e([r("esri.widgets.BatchAttributeForm.inputs.InputBase")],n);const p=n;export{p as default};
@@ -1,13 +1,12 @@
1
1
  import type GroupInput from "./GroupInput.js";
2
2
  import type SingleFeatureInput from "./SingleFeatureInput.js";
3
- import type { TextFormatType } from "../../../portal/jsonTypes.js";
4
3
  import type { SingleFeatureInputProperties } from "./SingleFeatureInput.js";
5
4
 
6
5
  /** @since 5.0 */
7
6
  export interface TextElementInputProperties extends SingleFeatureInputProperties {}
8
7
 
9
8
  /**
10
- * A read-only class used within the [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/).
9
+ * This is a read-only support class that represents a [text element](https://developers.arcgis.com/javascript/latest/references/core/form/elements/TextElement/) in a [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/).
11
10
  *
12
11
  * @since 5.0
13
12
  * @see [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/)
@@ -23,19 +22,11 @@ export default class TextElementInput extends SingleFeatureInput<any> {
23
22
  */
24
23
  get group(): GroupInput | null;
25
24
  /**
26
- * The processed text, compiled and with template parameters replaced with
27
- * values.
25
+ * The processed text, compiled and with expressions replaced with values.
28
26
  *
29
27
  * @since 5.0
30
28
  */
31
29
  get text(): string;
32
- /**
33
- * Defines the format of the `text` property.
34
- *
35
- * @default "plain-text"
36
- * @since 5.0
37
- */
38
- get textFormat(): TextFormatType;
39
30
  /**
40
31
  * The type of input.
41
32
  *
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{renderingSanitizer as e}from"../../../core/sanitizerUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as r}from"../../../core/support/UpdatingHandles.js";import p from"./SingleFeatureInput.js";import{compileTextElementMarkdownToHTML as i}from"./support/textInputElementUtils.js";let a=class extends p{constructor(t){super(t),this.group=null,this.type="text",this._tempTextNoEvaluatedExpressions="",this._updatingHandles=new r}initialize(){const{rawText:t}=this;t?"markdown"===this.textFormat?this._updatingHandles.addPromise(i(t).then(t=>{this._tempTextNoEvaluatedExpressions=t})):this._tempTextNoEvaluatedExpressions=t:this._tempTextNoEvaluatedExpressions=""}get rawText(){return this.template.text}get text(){return e.sanitize(this._tempTextNoEvaluatedExpressions)}get textFormat(){return this.template.textFormat}get updating(){return this._updatingHandles.updating}};t([o()],a.prototype,"group",void 0),t([o()],a.prototype,"rawText",null),t([o()],a.prototype,"text",null),t([o()],a.prototype,"textFormat",null),t([o()],a.prototype,"type",void 0),t([o()],a.prototype,"updating",null),t([o()],a.prototype,"_tempTextNoEvaluatedExpressions",void 0),a=t([s("esri.widgets.BatchAttributeForm.inputs.TextElementInput")],a);const n=a;export{n as default};
2
+ import{__decorate as t}from"tslib";import{renderingSanitizer as e}from"../../../core/sanitizerUtils.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import o from"./SingleFeatureInput.js";import{assembleStringFromParts as i}from"./support/textElementInputUtils.js";let p=class extends o{constructor(t){super(t),this.group=null,this.type="text"}get text(){const{expressionParts:t,literalParts:s}=this.template,r=this.feature;if(!r)return e.sanitize(s.join(" "));const o=[];for(let e=0;e<t.length;e++){const t=this._lookupEvaluatedExpression(r,"text",e);"success"===t?.status?o.push(`${t.result}`):o.push("")}return e.sanitize(i(s,o))}};t([s()],p.prototype,"group",void 0),t([s()],p.prototype,"text",null),t([s()],p.prototype,"type",void 0),p=t([r("esri.widgets.BatchAttributeForm.inputs.TextElementInput")],p);const u=p;export{u as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- const t="esri_BatchAttributeForm_different_values";function n(t){return"visible"===t}function e(t){return"field"===t.type}function r(t){return"group"===t.type}function u(t){return"text"===t.type}function o(t,n){return`${t}:${n}`}const i=t=>null!=t&&(c(t,"combo-box")||c(t,"radio-buttons"));function c(t,n){return t?.type===n}export{t as differentValuesString,e as isFieldInput,i as isFieldInputWithShowNoValueOptionInput,r as isGroupInput,c as isInputWithInputType,u as isTextElementInput,o as makeUseId,n as visibilityCodeToBoolean};
2
+ const t="esri_BatchAttributeForm_different_values";function e(t){return"visible"===t}function n(t){return"field"===t.type}function r(t){return"group"===t.type}function o(t){return"text"===t.type}function u(t){const e=`${t.elementId}:${t.executorPurpose}`;return null!=t.textExpressionIndex?`${e}:${t.textExpressionIndex}`:e}const i=t=>null!=t&&(c(t,"combo-box")||c(t,"radio-buttons"));function c(t,e){return t?.type===e}export{t as differentValuesString,n as isFieldInput,i as isFieldInputWithShowNoValueOptionInput,r as isGroupInput,c as isInputWithInputType,o as isTextElementInput,u as makeUseId,e as visibilityCodeToBoolean};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
+ function t(t,c){return c.reduce((c,n,a)=>c.concat(t.at(a),n),"").concat(t.at(-1))}export{t as assembleStringFromParts};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as e,subclass as o}from"../../../core/accessorSupport/decorators.js";import{ElementTemplateBase as r}from"./ElementTemplateBase.js";let p=class extends r{constructor(t){super(t),this.group=null,this.text=null,this.textFormat="plain-text",this.type="text"}};t([e({clonable:!1})],p.prototype,"group",void 0),t([e()],p.prototype,"text",void 0),t([e()],p.prototype,"textFormat",void 0),t([e()],p.prototype,"type",void 0),p=t([o("esri.widgets.BatchAttributeForm.templates.TextElementTemplate")],p);export{p as TextElementTemplate};
2
+ import{__decorate as t}from"tslib";import{addMany as e}from"../../../core/arrayUtils.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import{extractSubstitutionTemplatesFromString as i}from"../../../layers/support/fieldUtils.js";import{ElementTemplateBase as o}from"./ElementTemplateBase.js";import{splitStringIntoParts as l,isExpressionReference as p,extractExpressionNameFromString as a,isLegacyFieldMapsExpressionReference as n}from"./support/textElementTemplateUtils.js";let h=class extends o{constructor(t){super(t),this.compiledText=null,this.fieldsIndex=null,this.group=null,this.type="text",this._literalParts=[],this._expressionParts=[]}initialize(){this.compiledText?this._initializeTextParts(this.compiledText):this._literalParts.push("")}get expressionParts(){return this._expressionParts}get literalParts(){return this._literalParts}_initializeTextParts(t){const{literals:s,templates:r}=l(t),o=[],h=[];for(let e=0;e<r.length;e++){const t=s[e],l=i(r[e])[0];if(p(l)){const e=a(l);o.push(t),h.push(e)}else if(n(l))o.push(t),h.push(l);else if(this.fieldsIndex?.has(l)){const e=`$feature["${this.fieldsIndex.normalizeFieldName(l)}"]`;o.push(t),h.push(e)}else s[e+1]=t.concat(l,s[e+1])}o.push(s.at(-1)),e(this._literalParts,o),e(this._expressionParts,h)}};t([s()],h.prototype,"compiledText",void 0),t([s()],h.prototype,"expressionParts",null),t([s({constructOnly:!0})],h.prototype,"fieldsIndex",void 0),t([s({clonable:!1})],h.prototype,"group",void 0),t([s()],h.prototype,"literalParts",null),t([s()],h.prototype,"type",void 0),t([s()],h.prototype,"_literalParts",void 0),t([s()],h.prototype,"_expressionParts",void 0),h=t([r("esri.widgets.BatchAttributeForm.templates.TextElementTemplate")],h);export{h as TextElementTemplate};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
+ const e="expression/",o="expr/";export{e as expressionReferencePrefix,o as fieldmapsExpressionNamePrefix};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{getEffectiveFieldAlias as r}from"../../../../editing/fieldUtils.js";import n from"../../../../form/ExpressionInfo.js";import{isFieldElement as o,isGroupElement as i,isTextElement as s}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as a,isFieldVisibleByDefault as l}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as m,isSubtypeGroupLayer as d}from"../../../../layers/support/layerUtils.js";import{unknown as p}from"../../../../time/constants.js";import{makeExpressionInfosMap as f,makeExecutorSetForFormElement as c}from"../../expressions/expressionUtils.js";import u from"../BatchFormTemplate.js";import{FieldElementTemplate as x}from"../FieldElementTemplate.js";import{GroupElementTemplate as y}from"../GroupElementTemplate.js";import{TextElementTemplate as w}from"../TextElementTemplate.js";const b="expression/dea57012-47ca4b55a000-8df62742ed0c",E=()=>t.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function T(e,t,r=e.formTemplate){return r?.elements&&r.elements.length>0?F(r,e,t):h(e,t)}async function h(e,{arcadeExecutorProvider:t,formTimeZone:r}){const n=new Set(a(e)),o={arcadeExecutorProvider:t,formTimeZone:r,layer:e},i=[];for(const a of e.fields)P(a,e,n)&&i.push(Z(a,o));const s=await Promise.all(i);return new u({elements:s,preserveFieldValuesWhenHidden:!0})}function v(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type){if(!1===r.editable&&!r.editableExpression)return!0;if(t.subtypeField&&(m(t)||d(t))&&r.fieldName?.toLowerCase()===t.subtypeField.toLowerCase())return!0}}else if(v(r.elements??[],t))return!0;return!1}async function F(e,t,r){let o=null;v(e.elements??[],t)&&(o=new n({title:"",name:b,expression:"false"}));const i=f(o?[...e.expressionInfos??[],o]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new u(s);const{arcadeExecutorProvider:l,formTimeZone:m}=r;for(const n of a){const e=await I(n,{arcadeExecutorProvider:l,expressionInfos:i,layer:t,formTimeZone:m});e&&s.elements.push(e)}return new u(s)}async function I(t,r){return o(t)?g(t,r):i(t)?j(t,r):s(t)?L(t,r):(E().warn(new e("batch-attribute-form:unsupported-element-type",`Form elements of type ${t.type} are not supported`)),null)}async function g(t,{arcadeExecutorProvider:r,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:s}=o,{description:a,domain:l,fieldName:p,hint:f,input:u,label:y}=t;if(null==p||!s.has(p))return E().warn(new e("batch-attribute-form:invalid-form-element-field",`Field element with label '${y}' does not refer to a valid field`)),null;const w={description:a,domain:l,field:s.get(p),hint:f,input:u,formTimeZone:i,layerTimeZone:U(o),label:y};!1!==t.editable||t.editableExpression||((t=t.clone()).editableExpression=b),o.subtypeField&&(m(o)||d(o))&&t.fieldName?.toLowerCase()===o.subtypeField.toLowerCase()&&((t=t.clone()).editableExpression=b);const T=new x(w),h=await c({element:t,expressionInfos:n,provider:r});return T.addLayer(o,h),T}async function j(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,l={description:i,elements:[],label:s,initialState:a??"expanded"};for(const p of e.elements){const e=await I(p,t);e&&l.elements.push(e)}const m=new y(l),d=await c({element:e,expressionInfos:n,provider:r});return m.addLayer(o,d),m}async function L(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){const{description:o,label:i,text:s,textFormat:a}=e,l=new w({description:o,label:i,text:s,textFormat:a}),m=await c({element:e,expressionInfos:r,provider:t});return l.addLayer(n,m),l}async function Z(e,{arcadeExecutorProvider:t,layer:n,formTimeZone:o}){const i=r(e,n)||e.name,s=new x({field:e,label:i,formTimeZone:o,layerTimeZone:U(n)}),a={},l=(d(n)||m(n))&&n.subtypeField&&n.subtypeField.toLowerCase()===e.name.toLowerCase();return!l&&e.editable&&n.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),l&&(a.editableExpression=await t.getArcadeExecutor("false")),s.addLayer(n,a),s}function P(e,t,r){return!r.has(e.name.toLowerCase())&&l(e,t)}function U(e){return m(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?p:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}export{T as createBatchFormTemplate,h as createBatchFormTemplateFromFields};
2
+ import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{getEffectiveFieldAlias as r}from"../../../../editing/fieldUtils.js";import n from"../../../../form/ExpressionInfo.js";import{isFieldElement as o,isGroupElement as i,isTextElement as s}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as a,isFieldVisibleByDefault as l}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as m,isSubtypeGroupLayer as d}from"../../../../layers/support/layerUtils.js";import{unknown as p}from"../../../../time/constants.js";import{makeExpressionInfosMap as f,makeExecutorSetForFormElement as c}from"../../expressions/expressionUtils.js";import u from"../BatchFormTemplate.js";import{FieldElementTemplate as x}from"../FieldElementTemplate.js";import{GroupElementTemplate as w}from"../GroupElementTemplate.js";import{TextElementTemplate as y}from"../TextElementTemplate.js";import{compileTextElementMarkdownToHTML as b}from"./textElementTemplateUtils.js";const E="expression/dea57012-47ca4b55a000-8df62742ed0c",T=()=>t.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function h(e,t,r=e.formTemplate){return r?.elements&&r.elements.length>0?I(r,e,t):v(e,t)}async function v(e,{arcadeExecutorProvider:t,formTimeZone:r}){const n=new Set(a(e)),o={arcadeExecutorProvider:t,formTimeZone:r,layer:e},i=[];for(const a of e.fields)U(a,e,n)&&i.push(P(a,o));const s=await Promise.all(i);return new u({elements:s,preserveFieldValuesWhenHidden:!0})}function g(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type){if(!1===r.editable&&!r.editableExpression)return!0;if(t.subtypeField&&(m(t)||d(t))&&r.fieldName?.toLowerCase()===t.subtypeField.toLowerCase())return!0}}else if(g(r.elements??[],t))return!0;return!1}async function I(e,t,r){let o=null;g(e.elements??[],t)&&(o=new n({title:"",name:E,expression:"false"}));const i=f(o?[...e.expressionInfos??[],o]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new u(s);const{arcadeExecutorProvider:l,formTimeZone:m}=r;for(const n of a){const e=await F(n,{arcadeExecutorProvider:l,expressionInfos:i,layer:t,formTimeZone:m});e&&s.elements.push(e)}return new u(s)}async function F(t,r){return o(t)?j(t,r):i(t)?L(t,r):s(t)?Z(t,r):(T().warn(new e("batch-attribute-form:unsupported-element-type",`Form elements of type ${t.type} are not supported`)),null)}async function j(t,{arcadeExecutorProvider:r,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:s}=o,{description:a,domain:l,fieldName:p,hint:f,input:u,label:w}=t;if(null==p||!s.has(p))return T().warn(new e("batch-attribute-form:invalid-form-element-field",`Field element with label '${w}' does not refer to a valid field`)),null;!1!==t.editable||t.editableExpression||((t=t.clone()).editableExpression=E),o.subtypeField&&(m(o)||d(o))&&t.fieldName?.toLowerCase()===o.subtypeField.toLowerCase()&&((t=t.clone()).editableExpression=E);const y=new x({description:a,domain:l,field:s.get(p),hint:f,input:u,formTimeZone:i,layerTimeZone:A(o),label:w}),b=await c({element:t,expressionInfos:n,provider:r});return y.addLayer(o,b),y}async function L(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,l=[];for(const p of e.elements){const e=await F(p,t);e&&l.push(e)}const m=new w({description:i,elements:l,label:s,initialState:a??"expanded"}),d=await c({element:e,expressionInfos:n,provider:r});return m.addLayer(o,d),m}async function Z(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){const{description:o,label:i,text:s,textFormat:a}=e,{fieldsIndex:l}=n,m=s&&"markdown"===a?await b(s):s,d=new y({compiledText:m,description:o,fieldsIndex:l,label:i}),p=await c({element:e,expressionInfos:r,provider:t}),{expressionParts:f}=d;if(f.length){const e=await Promise.all(f.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));p.textExpressions=e}return d.addLayer(n,p),d}async function P(e,{arcadeExecutorProvider:t,layer:n,formTimeZone:o}){const i=r(e,n)||e.name,s=new x({field:e,label:i,formTimeZone:o,layerTimeZone:A(n)}),a={},l=(d(n)||m(n))&&n.subtypeField&&n.subtypeField.toLowerCase()===e.name.toLowerCase();return!l&&e.editable&&n.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),l&&(a.editableExpression=await t.getArcadeExecutor("false")),s.addLayer(n,a),s}function U(e,t,r){return!r.has(e.name.toLowerCase())&&l(e,t)}function A(e){return m(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?p:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}export{h as createBatchFormTemplate,v as createBatchFormTemplateFromFields};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{numericHash as t}from"../../../../core/string.js";import{isBarcodeScannerInput as n,isComboBoxInput as e,isRadioButtonsInput as i,isDatePickerInput as r,isDateTimePickerInput as o,isDateTimeOffsetPickerInput as $,isSwitchInput as u,isTextAreaInput as f,isTextBoxInput as s,isTimePickerInput as c}from"../../../../form/elements/inputs/inputUtils.js";import{isFieldElementTemplate as l,isGroupElementTemplate as m,isTextElementTemplate as a,isExcludedFromSharedForm as p}from"./templateUtils.js";const g="",d="num:";function y(n){return l(n)?t(S(n)).toString():m(n)?t(V(n)).toString():a(n)?t(x(n)).toString():t(JSON.stringify(n)).toString()}function S(t){return`${b(t)}.${T(t.field)}.${j(t.domain)}.${t.hint??g}.${O(t.input)}.${t.layerTimeZone??""}`}function V(t){const n=b(t)+`.${t.initialState}`;let e=g;for(const i of t.elements)p(i)||(e+="."+y(i).toString());return`${n}${e}`}function x(t){const n=b(t),{text:e,textFormat:i}=t;return`${n}.${e??g}.${i}`}function b(t){return`${t.label??g}.${t.description??g}`}function O(t){if(!t)return g;const{type:l}=t;if(n(t))return l??g;if(e(t)||i(t)){const{showNoValueOption:n}=t;return`${l}.${n}.${t.noValueOptionLabel??g}`}if(r(t))return`${l}.${h(t)}`;if(o(t)){const n=t.min?.getTime(),e=t.max?.getTime(),{includeTime:i}=t;return`${l}.${n}.${e}.${i}`}if($(t)){const n=h(t),{includeTimeOffset:e,timeResolution:i}=t;return`${l}.${n}.${e}.${i}`}if(u(t)){const{offValue:n,onValue:e}=t;return`${l}.${J(n)}.${J(e)}`}if(f(t)||s(t)){return`${l}.${t.minLength?.toString()??g}.${t.maxLength?.toString()??g}`}if(c(t)){const n=h(t),{timeResolution:e}=t;return`${l}.${n}.${e}`}return JSON.stringify(t)}function h(t){return`${t.min??g}.${t.max??g}`}function T(t){const n=t.name,e=t.alias??g;return`${n}.${e===n?g:e}.${t.nullable}.${t.type}.${t.length??g}.${t.defaultValue??g}.${t.description??g}.${t.editable}.${t.visible}`}function j(t){return t?"coded-value"===t.type?N(t):"range"===t.type?L(t):JSON.stringify(t):g}function N(t){const{type:n}=t;return`${n}.${t.codedValues.map(({code:t,name:n})=>`${J(t)}.${n}`).sort().join(".")}`}function J(t){return"number"==typeof t?`${d}${t}`:t}function L(t){const{maxValue:n,minValue:e,type:i}=t;return`${i}.${e}.${n}`}export{y as hashElementTemplate};
2
+ import{numericHash as t}from"../../../../core/string.js";import{isBarcodeScannerInput as n,isComboBoxInput as e,isRadioButtonsInput as i,isDatePickerInput as r,isDateTimePickerInput as o,isDateTimeOffsetPickerInput as $,isSwitchInput as u,isTextAreaInput as f,isTextBoxInput as s,isTimePickerInput as c}from"../../../../form/elements/inputs/inputUtils.js";import{isFieldElementTemplate as l,isGroupElementTemplate as m,isTextElementTemplate as a,isExcludedFromSharedForm as p}from"./templateUtils.js";const g="",d="num:";function y(n){return l(n)?t(S(n)).toString():m(n)?t(V(n)).toString():a(n)?t(b(n)).toString():t(JSON.stringify(n)).toString()}function S(t){return`${x(t)}.${h(t.field)}.${j(t.domain)}.${t.hint??g}.${O(t.input)}.${t.layerTimeZone??""}`}function V(t){const n=x(t)+`.${t.initialState}`;let e=g;for(const i of t.elements)p(i)||(e+="."+y(i).toString());return`${n}${e}`}function b(t){const n=x(t),{compiledText:e}=t;return`${n}.${e??g}`}function x(t){return`${t.label??g}.${t.description??g}`}function O(t){if(!t)return g;const{type:l}=t;if(n(t))return l??g;if(e(t)||i(t)){const{showNoValueOption:n}=t;return`${l}.${n}.${t.noValueOptionLabel??g}`}if(r(t))return`${l}.${T(t)}`;if(o(t)){const n=t.min?.getTime(),e=t.max?.getTime(),{includeTime:i}=t;return`${l}.${n}.${e}.${i}`}if($(t)){const n=T(t),{includeTimeOffset:e,timeResolution:i}=t;return`${l}.${n}.${e}.${i}`}if(u(t)){const{offValue:n,onValue:e}=t;return`${l}.${J(n)}.${J(e)}`}if(f(t)||s(t)){return`${l}.${t.minLength?.toString()??g}.${t.maxLength?.toString()??g}`}if(c(t)){const n=T(t),{timeResolution:e}=t;return`${l}.${n}.${e}`}return JSON.stringify(t)}function T(t){return`${t.min??g}.${t.max??g}`}function h(t){const n=t.name,e=t.alias??g;return`${n}.${e===n?g:e}.${t.nullable}.${t.type}.${t.length??g}.${t.defaultValue??g}.${t.description??g}.${t.editable}.${t.visible}`}function j(t){return t?"coded-value"===t.type?N(t):"range"===t.type?L(t):JSON.stringify(t):g}function N(t){const{type:n}=t;return`${n}.${t.codedValues.map(({code:t,name:n})=>`${J(t)}.${n}`).sort().join(".")}`}function J(t){return"number"==typeof t?`${d}${t}`:t}function L(t){const{maxValue:n,minValue:e,type:i}=t;return`${i}.${e}.${n}`}export{y as hashElementTemplate};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
+ import t from"../../../../core/Logger.js";import{expressionReferencePrefix as e,fieldmapsExpressionNamePrefix as r}from"./constants.js";function n(t){const e=/{[^{]+?}/g,r=[...t.matchAll(e)];let n=0;const o=[],s=[];for(const i of r){const e=i[0];o.push(t.slice(n,i.index)),s.push(e),n=i.index+e.length}return o.push(t.slice(n)),{literals:o,templates:s}}function o(r){const[n,o]=r.split(e);return""===n&&o?o:(t.getLogger("esri.widgets.BatchAttributeForm/templates/support/textElementTemplateUtils").error("extractExpressionNameFromString:invalid-input",`The string ${r} is not a valid expression reference of the form '${e}/expressionName'`),"")}function s(t){return t.startsWith(e)}function i(t){return t.startsWith(r)}let a;const l=["blockquote","html","hr","checkbox","table","tablerow","tablecell","image"];async function c(t){return a||await u(),a.parse(t)}async function u(){const{Marked:t}=await import("marked"),e=function({href:t,title:e,tokens:r}){return`<a${null!=t?` href="${t}"`:""}${null!=e?` title="${e}"`:""} target="_blank">${this.parser.parseInline(r)}</a>`},r=()=>"",n={};for(const o of l)n[o]=r;a=new t({renderer:{link:e,...n}})}export{c as compileTextElementMarkdownToHTML,o as extractExpressionNameFromString,s as isExpressionReference,i as isLegacyFieldMapsExpressionReference,n as splitStringIntoParts};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{loadCalciteComponents as t}from"../../support/componentsUtils.js";import e from"../../support/SketchTooltipControls.js";import o from"../../support/SnappingControls.js";import{tsx as s}from"../../support/widget.js";import i from"../../support/SketchTooltipControls/VisibleElements.js";import n from"../../support/SnappingControls/VisibleElements.js";const p={settingsContainer:"esri-editor__settings"},r=()=>t({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item")});function c({editorViewModel:t,messagesCommon:r,visibleElements:c}){const{snappingOptions:a,sketchOptions:l,view:m,snappingManager:g}=t,d=[],u={directionModePicker:c.directionModePicker,labelsToggle:c.labelsToggle,tooltipsToggle:c.tooltipsToggle};return Object.values(u).includes(!0)&&d.push(s(e,{sketchOptions:l,visibleElements:new i(u)})),c.snappingControls&&d.push(s(o,{afterCreate:t=>t.layerListOpen=!1,snappingManager:g,snappingOptions:a,view:m,visibleElements:c.snappingControlsElements??new n})),0===d.length?null:s("calcite-accordion",{appearance:"transparent",class:p.settingsContainer,key:"settings"},s("calcite-accordion-item",{"data-testid":"settings",heading:r.settings,iconStart:"gear"},d))}export{c as Settings,p as css,r as loadSettingsComponents};
2
+ import{loadCalciteComponents as t}from"../../support/componentsUtils.js";import e from"../../support/SketchTooltipControls.js";import o from"../../support/SnappingControls.js";import{tsx as i}from"../../support/widget.js";import s from"../../support/SketchTooltipControls/VisibleElements.js";import n from"../../support/SnappingControls/VisibleElements.js";const p={settingsContainer:"esri-editor__settings"},r=()=>t({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item")});function c({editorViewModel:t,messagesCommon:r,visibleElements:c}){const{snappingOptions:a,sketchOptions:l,view:m,snappingManager:g}=t,d=[],u={directionModePicker:c.directionModePicker,labelsToggle:c.labelsToggle,tooltipsToggle:c.tooltipsToggle};return Object.values(u).includes(!0)&&d.push(i(e,{sketchOptions:l,viewType:m?.type,visibleElements:new s(u)})),c.snappingControls&&d.push(i(o,{afterCreate:t=>t.layerListOpen=!1,snappingManager:g,snappingOptions:a,view:m,visibleElements:c.snappingControlsElements??new n})),0===d.length?null:i("calcite-accordion",{appearance:"transparent",class:p.settingsContainer,key:"settings"},i("calcite-accordion-item",{"data-testid":"settings",heading:r.settings,iconStart:"gear"},d))}export{c as Settings,p as css,r as loadSettingsComponents};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import{EventedAccessor as r}from"../../core/Evented.js";import o from"../../core/Logger.js";import{debounce as a,isAbortError as n}from"../../core/promiseUtils.js";import l from"../../core/ReactiveSet.js";import{watch as u,when as h,sync as c}from"../../core/reactiveUtils.js";import{property as d,subclass as p}from"../../core/accessorSupport/decorators.js";import g from"../../geometry/Point.js";import{initializeProjection as f,project as m}from"../../geometry/projectionUtils.js";import y from"../../geometry/SpatialReference.js";import{getPointFromGeometry as w}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as F}from"../../geometry/support/webMercatorUtils.js";import{fallbackObjectIDAttribute as _}from"../../layers/LayerConstants.js";import v from"../../symbols/SimpleFillSymbol.js";import{getDisplayedSymbol as C}from"../../symbols/support/symbolUtils.js";import{system as b}from"../../time/constants.js";import{highlightsSupported as P}from"../../views/support/layerViewUtils.js";import L from"../Feature/FeatureViewModel.js";import{ActionsCollection as M,zoomToFeature as A,zoomToClusteredFeatures as E,browseClusteredFeatures as V}from"../Popup/actions.js";import{triggerAction as j,isClusterFeature as I,getSelectedTarget as R,removeClusteredFeaturesForBrowsing as x,displayClusterExtent as O,browseAggregateFeatures as T}from"../Popup/actionUtils.js";import{AnchorElementViewModelMixin as U}from"../support/AnchorElementViewModel.js";import{GoTo as S}from"../support/GoTo.js";const B="location-scale-handle",H=()=>[A.clone()],G=()=>[E.clone(),V.clone()];let Z=null;function z(e,t){return"building-scene"===e||"map-image"===e||"tile"===e||"imagery"===e||"2d"===t&&"imagery-tile"===e}let D=class extends(S(U(r))){constructor(e){super(e),this._pendingPromises=new l,this._fetchFeaturesController=null,this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._selectedClusterFeature=null,this.actions=new M,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureMenuTitle=null,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.initialDisplayMode="feature",this.selectedClusterBoundaryFeature=new t({symbol:new v({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=a(async e=>{this._cancelLocationUpdate();const t=new AbortController,{signal:i}=t;this._locationUpdateController=t,await this._locationUpdate(e,{signal:i}).finally(()=>{this._locationUpdateController===t&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([this.on("view-change",()=>this._autoClose()),u(()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view],()=>this._highlightSelectedFeature()),u(()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view],()=>this._highlightActiveFeature()),u(()=>this.view?.animation?.state,e=>this._animationStateChange(e)),u(()=>this.location,e=>this._locationChange(e)),u(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),u(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),u(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels],()=>this._setGraphicOnFeatureViewModels()),u(()=>this.featureViewModels,()=>this._featureViewModelsChange()),this.on("trigger-action",e=>j({event:e,viewModel:this,view:this.view})),h(()=>!this.waitingForResult,()=>this._waitingForResultChange(),c),u(()=>[this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureVMs()),u(()=>this.view?.scale,()=>this._viewScaleChange()),h(()=>!this.visible,()=>this.browseClusterEnabled=!1),u(()=>this.browseClusterEnabled,e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing())])}destroy(){this._cancelLocationUpdate(),this._cancelFetchingFeatures(),this._cancelCenterAtLocation(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new M;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,u=n?.overwriteActions?l:l?.concat(a)??a;return u?.filter(Boolean).forEach(t=>e.add(t)),e}get defaultActions(){const e=this._get("defaultActions")||new M;return e.removeAll(),e.addMany(I(this.selectedFeature)?G():H()),e}get featureCount(){return this.features.length}set features(e){if(this._get("features")===e)return;const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;"list"!==this.initialDisplayMode?o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1):(!o||o&&i===s)&&(this.selectedFeatureIndex=-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=F(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._get("promises")!==e&&(this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice()).forEach(e=>this._pendingPromises.add(e)),e.reduce((e,t)=>e.finally(()=>t.then(e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)}).finally(()=>this._pendingPromises.delete(t))),Promise.resolve())):this._set("promises",[]))}get screenLocation(){return super.screenLocation}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??b}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some(e=>e.waitingForContent)}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=R(this);this._cancelCenterAtLocation();const i=new AbortController,{signal:r}=i;return this._centerAtLocationController=i,t&&e?this.callGoTo({target:{target:t,scale:e.scale},options:{signal:r}}).catch(e=>{n(e)||o.getLogger(this).error(e)}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}disableClusterBrowsing(){x(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?I(t)?(await O(this),await T(this)):o.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):o.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}async handleViewClick(e){return this._fetchFeaturesAndOpen(e)}_getRoundRobinIndex(e,t){return(e+t)%t}_animationStateChange(e){this.zoomToLocation||(A.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(I(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&!this._locationUpdateController&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null==i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach((t,i)=>{t&&(t.graphic??=e[o+i])})}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(!e||!s)return;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),I(e))return;return e.symbol=await C(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}const r=e.sourceLayer?.type;if("map-image"!==r&&"imagery"!==r&&"imagery-tile"!==r||(e.symbol=await C(e)),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=w(e.geometry)}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(I(t[0])||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(),u=[];t.forEach((t,i)=>{if(!t)return;let h=null;if(l.some((e,i)=>(e&&e.graphic===t&&(h=e,l.splice(i,1)),!!h)),h)u[i]=h;else{const l=new L({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});u[i]=l}}),l.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await f(r,i,null,t),s.toScreen(e)):null}_cancelCenterAtLocation(){this._centerAtLocationController?.abort(),this._centerAtLocationController=null}_cancelFetchingFeatures(){this._fetchFeaturesController?.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.finally(()=>{this._fetchFeaturesController===s&&(this._fetchFeaturesController=null)}),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e;this.removeHandles(B),this.addHandles([u(()=>this.view?.scale,()=>this._debouncedLocationUpdate(t).catch(e=>{n(e)||o.getLogger(this).error(e)})),h(()=>!this.visible,()=>{this.removeHandles(B)},{once:!0})],B);const{pendingFeatures:s}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});return{location:t??void 0,promises:s}}async _locationUpdate(e,t){const{spatialReference:i}=this,s=this.selectedFeature?.geometry?.type,r=this.location??e;if(s&&"mesh"!==s&&i&&r&&this.selectedFeature)if("point"!==s)try{const e=this.selectedFeature;let s=e.geometry;const o=this._getHighlightLayer(e),a=e.getObjectId();if(!o||!this.view)return;if(a){const e=this.view?.allLayerViews.find(e=>e.layer.uid===o.uid);if(!e||!("queryFeatures"in e))return;const r=e.createQuery();r.outSpatialReference=i,r.objectIds=[a],r.returnGeometry=!0;const{features:n}=await e.queryFeatures(r,t);s=n[0]?.geometry}if(!s||"mesh"===s.type)return;s=m(s,i),Z||(Z=await Promise.all([import("../../geometry/operators/intersectsOperator.js"),import("../../geometry/operators/proximityOperator.js")]));const[n,l]=Z;if(!n.execute(s,r)){const t=l.getNearestCoordinate(s,r).coordinate??r;this.selectedFeature===e&&(this.location=t)}}catch(a){n(a)||o.getLogger(this).error(a)}else this.location=w(this.selectedFeature.geometry)??r}_cancelLocationUpdate(){this._locationUpdateController?.abort(),this._locationUpdateController=null}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t??i}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(z(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||_:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:s,view:r,visible:o}=this;if(!r||!s||!o)return;const a=this._getHighlightLayer(i);if(!a)return;const n=this._getHighlightLayerView(r,a);if(!n)return;this._highlightPromises[e]=n;const l=await n;if(!(l&&P(l)&&this._highlightPromises[e]===n&&this[t]&&this.highlightEnabled))return;const u=l.highlight(this._getHighlightTarget(i,a,r.type));this.addHandles(u,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=e.filter(e=>!t.includes(e));i?.length&&(this.features=t.concat(i))}};e([d()],D.prototype,"_fetchFeaturesController",void 0),e([d({type:M})],D.prototype,"actions",void 0),e([d({readOnly:!0})],D.prototype,"active",null),e([d()],D.prototype,"activeFeature",void 0),e([d({readOnly:!0})],D.prototype,"allActions",null),e([d()],D.prototype,"autoCloseEnabled",void 0),e([d()],D.prototype,"browseClusterEnabled",void 0),e([d()],D.prototype,"content",void 0),e([d({type:M,readOnly:!0})],D.prototype,"defaultActions",null),e([d({type:Boolean})],D.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],D.prototype,"featureCount",null),e([d()],D.prototype,"featurePage",void 0),e([d({value:[]})],D.prototype,"features",null),e([d()],D.prototype,"featuresPerPage",void 0),e([d()],D.prototype,"featureMenuOpen",void 0),e([d()],D.prototype,"featureMenuTitle",void 0),e([d()],D.prototype,"featureViewModelAbilities",void 0),e([d({readOnly:!0})],D.prototype,"featureViewModels",void 0),e([d()],D.prototype,"highlightEnabled",void 0),e([d()],D.prototype,"includeDefaultActions",void 0),e([d()],D.prototype,"initialDisplayMode",void 0),e([d({type:g})],D.prototype,"location",null),e([d()],D.prototype,"map",null),e([d({readOnly:!0})],D.prototype,"pendingPromisesCount",null),e([d({readOnly:!0})],D.prototype,"promiseCount",null),e([d()],D.prototype,"promises",null),e([d({readOnly:!0})],D.prototype,"selectedClusterBoundaryFeature",void 0),e([d({value:null,readOnly:!0})],D.prototype,"selectedFeature",null),e([d({value:-1})],D.prototype,"selectedFeatureIndex",null),e([d({readOnly:!0})],D.prototype,"selectedFeatureViewModel",null),e([d({type:y})],D.prototype,"spatialReference",null),e([d({readOnly:!0})],D.prototype,"state",null),e([d()],D.prototype,"timeZone",null),e([d()],D.prototype,"title",void 0),e([d()],D.prototype,"updateLocationEnabled",void 0),e([d()],D.prototype,"view",void 0),e([d()],D.prototype,"visible",void 0),e([d({readOnly:!0})],D.prototype,"waitingForContents",null),e([d({readOnly:!0})],D.prototype,"waitingForResult",null),e([d()],D.prototype,"zoomFactor",void 0),e([d()],D.prototype,"zoomToLocation",void 0),e([d()],D.prototype,"centerAtLocation",null),D=e([p("esri.widgets.Features.FeaturesViewModel")],D);export{D as default};
2
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import{EventedAccessor as r}from"../../core/Evented.js";import o from"../../core/Logger.js";import{debounce as a,isAbortError as n}from"../../core/promiseUtils.js";import l from"../../core/ReactiveSet.js";import{watch as u,when as h,sync as c}from"../../core/reactiveUtils.js";import{property as d,subclass as p}from"../../core/accessorSupport/decorators.js";import g from"../../geometry/Point.js";import{initializeProjection as f,project as m}from"../../geometry/projectionUtils.js";import y from"../../geometry/SpatialReference.js";import{getPointFromGeometry as w}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as F}from"../../geometry/support/webMercatorUtils.js";import{fallbackObjectIDAttribute as _}from"../../layers/LayerConstants.js";import v from"../../symbols/SimpleFillSymbol.js";import{getDisplayedSymbol as C}from"../../symbols/support/symbolUtils.js";import{system as b}from"../../time/constants.js";import{highlightsSupported as P}from"../../views/support/layerViewUtils.js";import L from"../Feature/FeatureViewModel.js";import{ActionsCollection as M,zoomToFeature as A,zoomToClusteredFeatures as E,browseClusteredFeatures as V}from"../Popup/actions.js";import{triggerAction as j,isClusterFeature as I,getSelectedTarget as R,removeClusteredFeaturesForBrowsing as x,displayClusterExtent as O,browseAggregateFeatures as T}from"../Popup/actionUtils.js";import{AnchorElementViewModelMixin as U}from"../support/AnchorElementViewModel.js";import{GoTo as S}from"../support/GoTo.js";const B="location-scale-handle",H=()=>[A.clone()],G=()=>[E.clone(),V.clone()];let Z=null;function z(e,t){return"building-scene"===e||"map-image"===e||"tile"===e||"imagery"===e||"2d"===t&&"imagery-tile"===e}let D=class extends(S(U(r))){constructor(e){super(e),this._pendingPromises=new l,this._fetchFeaturesController=null,this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._selectedClusterFeature=null,this.actions=new M,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureMenuTitle=null,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.initialDisplayMode="feature",this.selectedClusterBoundaryFeature=new t({symbol:new v({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=a(async e=>{this._cancelLocationUpdate();const t=new AbortController,{signal:i}=t;this._locationUpdateController=t,await this._locationUpdate(e,{signal:i}).catch(()=>{}).finally(()=>{this._locationUpdateController===t&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([this.on("view-change",()=>this._autoClose()),u(()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view],()=>this._highlightSelectedFeature()),u(()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view],()=>this._highlightActiveFeature()),u(()=>this.view?.animation?.state,e=>this._animationStateChange(e)),u(()=>this.location,e=>this._locationChange(e)),u(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),u(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),u(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels],()=>this._setGraphicOnFeatureViewModels()),u(()=>this.featureViewModels,()=>this._featureViewModelsChange()),this.on("trigger-action",e=>j({event:e,viewModel:this,view:this.view})),h(()=>!this.waitingForResult,()=>this._waitingForResultChange(),c),u(()=>[this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureVMs()),u(()=>this.view?.scale,()=>this._viewScaleChange()),h(()=>!this.visible,()=>this.browseClusterEnabled=!1),u(()=>this.browseClusterEnabled,e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing())])}destroy(){this._cancelLocationUpdate(),this._cancelFetchingFeatures(),this._cancelCenterAtLocation(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new M;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,u=n?.overwriteActions?l:l?.concat(a)??a;return u?.filter(Boolean).forEach(t=>e.add(t)),e}get defaultActions(){const e=this._get("defaultActions")||new M;return e.removeAll(),e.addMany(I(this.selectedFeature)?G():H()),e}get featureCount(){return this.features.length}set features(e){if(this._get("features")===e)return;const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;"list"!==this.initialDisplayMode?o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1):(!o||o&&i===s)&&(this.selectedFeatureIndex=-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=F(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._get("promises")!==e&&(this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice()).forEach(e=>this._pendingPromises.add(e)),e.reduce((e,t)=>e.finally(()=>t.then(e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)}).finally(()=>this._pendingPromises.delete(t)).catch(()=>{})),Promise.resolve())):this._set("promises",[]))}get screenLocation(){return super.screenLocation}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??b}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some(e=>e.waitingForContent)}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=R(this);this._cancelCenterAtLocation();const i=new AbortController,{signal:r}=i;return this._centerAtLocationController=i,t&&e?this.callGoTo({target:{target:t,scale:e.scale},options:{signal:r}}).catch(e=>{n(e)||o.getLogger(this).error(e)}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}disableClusterBrowsing(){x(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?I(t)?(await O(this),await T(this)):o.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):o.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}async handleViewClick(e){return this._fetchFeaturesAndOpen(e)}_getRoundRobinIndex(e,t){return(e+t)%t}_animationStateChange(e){this.zoomToLocation||(A.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(I(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&!this._locationUpdateController&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null==i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach((t,i)=>{t&&(t.graphic??=e[o+i])})}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(!e||!s)return;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),I(e))return;return e.symbol=await C(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}const r=e.sourceLayer?.type;if("map-image"!==r&&"imagery"!==r&&"imagery-tile"!==r||(e.symbol=await C(e)),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=w(e.geometry)}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(I(t[0])||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(),u=[];t.forEach((t,i)=>{if(!t)return;let h=null;if(l.some((e,i)=>(e&&e.graphic===t&&(h=e,l.splice(i,1)),!!h)),h)u[i]=h;else{const l=new L({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});u[i]=l}}),l.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await f(r,i,null,t),s.toScreen(e)):null}_cancelCenterAtLocation(){this._centerAtLocationController?.abort(),this._centerAtLocationController=null}_cancelFetchingFeatures(){this._fetchFeaturesController?.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.catch(()=>{}).finally(()=>{this._fetchFeaturesController===s&&(this._fetchFeaturesController=null)}),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e;this.removeHandles(B),this.addHandles([u(()=>this.view?.scale,()=>this._debouncedLocationUpdate(t).catch(e=>{n(e)||o.getLogger(this).error(e)})),h(()=>!this.visible,()=>{this.removeHandles(B)},{once:!0})],B);const{pendingFeatures:s}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});return{location:t??void 0,promises:s}}async _locationUpdate(e,t){const{spatialReference:i}=this,s=this.selectedFeature?.geometry?.type,r=this.location??e;if(s&&"mesh"!==s&&i&&r&&this.selectedFeature)if("point"!==s)try{const e=this.selectedFeature;let s=e.geometry;const o=this._getHighlightLayer(e),a=e.getObjectId();if(!o||!this.view)return;if(a){const e=this.view?.allLayerViews.find(e=>e.layer.uid===o.uid);if(!e||!("queryFeatures"in e))return;const r=e.createQuery();r.outSpatialReference=i,r.objectIds=[a],r.returnGeometry=!0;const{features:n}=await e.queryFeatures(r,t);s=n[0]?.geometry}if(!s||"mesh"===s.type)return;s=m(s,i),Z||(Z=await Promise.all([import("../../geometry/operators/intersectsOperator.js"),import("../../geometry/operators/proximityOperator.js")]));const[n,l]=Z;if(!n.execute(s,r)){const t=l.getNearestCoordinate(s,r).coordinate??r;this.selectedFeature===e&&(this.location=t)}}catch(a){n(a)||o.getLogger(this).error(a)}else this.location=w(this.selectedFeature.geometry)??r}_cancelLocationUpdate(){this._locationUpdateController?.abort(),this._locationUpdateController=null}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t??i}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(z(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||_:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:s,view:r,visible:o}=this;if(!r||!s||!o)return;const a=this._getHighlightLayer(i);if(!a)return;const n=this._getHighlightLayerView(r,a);if(!n)return;this._highlightPromises[e]=n;const l=await n;if(!(l&&P(l)&&this._highlightPromises[e]===n&&this[t]&&this.highlightEnabled))return;const u=l.highlight(this._getHighlightTarget(i,a,r.type));this.addHandles(u,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=e.filter(e=>!t.includes(e));i?.length&&(this.features=t.concat(i))}};e([d()],D.prototype,"_fetchFeaturesController",void 0),e([d({type:M})],D.prototype,"actions",void 0),e([d({readOnly:!0})],D.prototype,"active",null),e([d()],D.prototype,"activeFeature",void 0),e([d({readOnly:!0})],D.prototype,"allActions",null),e([d()],D.prototype,"autoCloseEnabled",void 0),e([d()],D.prototype,"browseClusterEnabled",void 0),e([d()],D.prototype,"content",void 0),e([d({type:M,readOnly:!0})],D.prototype,"defaultActions",null),e([d({type:Boolean})],D.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],D.prototype,"featureCount",null),e([d()],D.prototype,"featurePage",void 0),e([d({value:[]})],D.prototype,"features",null),e([d()],D.prototype,"featuresPerPage",void 0),e([d()],D.prototype,"featureMenuOpen",void 0),e([d()],D.prototype,"featureMenuTitle",void 0),e([d()],D.prototype,"featureViewModelAbilities",void 0),e([d({readOnly:!0})],D.prototype,"featureViewModels",void 0),e([d()],D.prototype,"highlightEnabled",void 0),e([d()],D.prototype,"includeDefaultActions",void 0),e([d()],D.prototype,"initialDisplayMode",void 0),e([d({type:g})],D.prototype,"location",null),e([d()],D.prototype,"map",null),e([d({readOnly:!0})],D.prototype,"pendingPromisesCount",null),e([d({readOnly:!0})],D.prototype,"promiseCount",null),e([d()],D.prototype,"promises",null),e([d({readOnly:!0})],D.prototype,"selectedClusterBoundaryFeature",void 0),e([d({value:null,readOnly:!0})],D.prototype,"selectedFeature",null),e([d({value:-1})],D.prototype,"selectedFeatureIndex",null),e([d({readOnly:!0})],D.prototype,"selectedFeatureViewModel",null),e([d({type:y})],D.prototype,"spatialReference",null),e([d({readOnly:!0})],D.prototype,"state",null),e([d()],D.prototype,"timeZone",null),e([d()],D.prototype,"title",void 0),e([d()],D.prototype,"updateLocationEnabled",void 0),e([d()],D.prototype,"view",void 0),e([d()],D.prototype,"visible",void 0),e([d({readOnly:!0})],D.prototype,"waitingForContents",null),e([d({readOnly:!0})],D.prototype,"waitingForResult",null),e([d()],D.prototype,"zoomFactor",void 0),e([d()],D.prototype,"zoomToLocation",void 0),e([d()],D.prototype,"centerAtLocation",null),D=e([p("esri.widgets.Features.FeaturesViewModel")],D);export{D as default};