@arcgis/core 4.22.0-next.20211021 → 4.22.0-next.20211025

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 (440) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/00ac1ce56f9885a8be83.js +1 -0
  3. package/assets/esri/core/workers/chunks/01c9afe41ab4ccc597c9.js +1 -0
  4. package/assets/esri/core/workers/chunks/02a3d14adc504a51fa24.js +1 -0
  5. package/assets/esri/core/workers/chunks/035a9ab0202d5386b782.js +1 -0
  6. package/assets/esri/core/workers/chunks/062bace5505f13689c7d.js +1 -0
  7. package/assets/esri/core/workers/chunks/06c7745d813bcb540ce8.js +1 -0
  8. package/assets/esri/core/workers/chunks/0950b488a60b2abc21fc.js +1 -0
  9. package/assets/esri/core/workers/chunks/0af396f2e0de681113ef.js +1 -0
  10. package/assets/esri/core/workers/chunks/131838059f0f81d8eaee.js +1 -0
  11. package/assets/esri/core/workers/chunks/146cba0d172ec2f4eba2.js +1 -0
  12. package/assets/esri/core/workers/chunks/17e49c0dfa5a5a6213e2.js +1 -0
  13. package/assets/esri/core/workers/chunks/1a0b08190274725dc956.js +1 -0
  14. package/assets/esri/core/workers/chunks/1add7f0779accdf8d204.js +1 -0
  15. package/assets/esri/core/workers/chunks/20b81d11e6286d347bfc.js +1 -0
  16. package/assets/esri/core/workers/chunks/{e596bd3de960d1dc1c57.js → 2207580a78ee292ed9b8.js} +1 -1
  17. package/assets/esri/core/workers/chunks/2d3646a83465c75986f9.js +1 -0
  18. package/assets/esri/core/workers/chunks/2d38ee3ef3ebe32a1194.js +1 -0
  19. package/assets/esri/core/workers/chunks/3737dcc3c0dea3ca05d5.js +1 -0
  20. package/assets/esri/core/workers/chunks/3e2042e70647c1afa6aa.js +1 -0
  21. package/assets/esri/core/workers/chunks/3ebfaab2855a2236a95d.js +1 -0
  22. package/assets/esri/core/workers/chunks/{d6fe616192a8efbfbc3e.js → 440f8101402a4c0d7019.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4587d770767966985e22.js +1 -0
  24. package/assets/esri/core/workers/chunks/487b8892fae85810a8c0.js +1 -0
  25. package/assets/esri/core/workers/chunks/4901a78f32c3ea6b823b.js +1 -0
  26. package/assets/esri/core/workers/chunks/496fe47fc4d28e1a716d.js +1 -0
  27. package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js → 4c010119c24510ea31bb.js} +2 -2
  28. package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js.LICENSE.txt → 4c010119c24510ea31bb.js.LICENSE.txt} +0 -0
  29. package/assets/esri/core/workers/chunks/4f5076e1f2b18ce8156d.js +1 -0
  30. package/assets/esri/core/workers/chunks/{f291ebc4b089bd1f0a3f.js → 50e86a6bb13042b1dbac.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{64d9a062c1f1ac08a3ac.js → 565020b1c02a8cb33c2b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{d78c60a22f76df7c48c7.js → 59640d78295e2e363f18.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{a0356f320a1b2fbd03f0.js → 5ac2b2598245aa17cdbd.js} +1 -1
  34. package/assets/esri/core/workers/chunks/5b4a8cce5601cc92c8a3.js +1 -0
  35. package/assets/esri/core/workers/chunks/5b92d5d4049622531109.js +1 -0
  36. package/assets/esri/core/workers/chunks/{751c1a2838b54a74a9a6.js → 5f3caa0ddb215342c728.js} +2 -2
  37. package/assets/esri/core/workers/chunks/615e995d5ce8fa044b09.js +1 -0
  38. package/assets/esri/core/workers/chunks/62a2453699e0dd2393b9.js +1 -0
  39. package/assets/esri/core/workers/chunks/67013547be1a7ae1670a.js +1 -0
  40. package/assets/esri/core/workers/chunks/67eddf4808f8888faeb4.js +1 -0
  41. package/assets/esri/core/workers/chunks/695dbedff2340aa019ba.js +1 -0
  42. package/assets/esri/core/workers/chunks/6a7e388c94206d2f61ff.js +1 -0
  43. package/assets/esri/core/workers/chunks/6e22b69d55e791ab3d9a.js +1 -0
  44. package/assets/esri/core/workers/chunks/71e6c0c5ef0aa7eb1703.js +1 -0
  45. package/assets/esri/core/workers/chunks/7a74e230439c5111f852.js +1 -0
  46. package/assets/esri/core/workers/chunks/7e76a8e6fa67e607d09e.js +1 -0
  47. package/assets/esri/core/workers/chunks/7fe4985ca0cb3e6d35c6.js +1 -0
  48. package/assets/esri/core/workers/chunks/8027330714ff5ffb020e.js +1 -0
  49. package/assets/esri/core/workers/chunks/844b564d1a422a17f6ac.js +1 -0
  50. package/assets/esri/core/workers/chunks/856f9281a08cb032238e.js +1 -0
  51. package/assets/esri/core/workers/chunks/89b4983de872780e9aa1.js +1 -0
  52. package/assets/esri/core/workers/chunks/8f3bc0cd2c2b01ab80cd.js +1 -0
  53. package/assets/esri/core/workers/chunks/8fd912e325ccd48b98a9.js +1 -0
  54. package/assets/esri/core/workers/chunks/901907a5c01f0fd1478f.js +1 -0
  55. package/assets/esri/core/workers/chunks/92a0b88a14c92239df8a.js +1 -0
  56. package/assets/esri/core/workers/chunks/972e9aeb3c29c9bf441a.js +1 -0
  57. package/assets/esri/core/workers/chunks/9758c34ce61c3714515a.js +1 -0
  58. package/assets/esri/core/workers/chunks/{457ea4feaa006d60c6b1.js → 9a04d087a29f0f3937a3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/9b0bb171224b35ce2031.js +1 -0
  60. package/assets/esri/core/workers/chunks/9cbe7afdaef8720dfc8d.js +1 -0
  61. package/assets/esri/core/workers/chunks/9ccde5b6562f0007fe45.js +1 -0
  62. package/assets/esri/core/workers/chunks/9d320bbeedeea15522ab.js +1 -0
  63. package/assets/esri/core/workers/chunks/a001b3b4527817548094.js +1 -0
  64. package/assets/esri/core/workers/chunks/{197b72bca45065e0eb4a.js → a0c580d4a1915ddd3fe4.js} +1 -1
  65. package/assets/esri/core/workers/chunks/a4a9c15929b43d83701f.js +1 -0
  66. package/assets/esri/core/workers/chunks/a54d11f44721f808b82f.js +1 -0
  67. package/assets/esri/core/workers/chunks/a646a11673d513c00e7a.js +1 -0
  68. package/assets/esri/core/workers/chunks/a792e2bc7cafdc29f05e.js +1 -0
  69. package/assets/esri/core/workers/chunks/acae1771697034f265b1.js +1 -0
  70. package/assets/esri/core/workers/chunks/af2ee804a9c63eea610c.js +1 -0
  71. package/assets/esri/core/workers/chunks/b28b487047da3aeef3fd.js +1 -0
  72. package/assets/esri/core/workers/chunks/b3e57824a5855cb37a96.js +1 -0
  73. package/assets/esri/core/workers/chunks/b89449ead32e4cd21edd.js +1 -0
  74. package/assets/esri/core/workers/chunks/b99891ed5a02cab02173.js +1 -0
  75. package/assets/esri/core/workers/chunks/bac84bc621be73a7a4bc.js +1 -0
  76. package/assets/esri/core/workers/chunks/{25037dcf8a0c72b7b647.js → bbe068388167e9dd0c11.js} +1 -1
  77. package/assets/esri/core/workers/chunks/c271a1857bcc4e9a36dd.js +1 -0
  78. package/assets/esri/core/workers/chunks/{eb3035e49a45ecc82575.js → c5030664720fcdc6d85e.js} +1 -1
  79. package/assets/esri/core/workers/chunks/c534ed122f8a1202d3a3.js +1 -0
  80. package/assets/esri/core/workers/chunks/c5ef2e28b0c539ddb6a7.js +1 -0
  81. package/assets/esri/core/workers/chunks/c65e5ccfae03d148d82b.js +1 -0
  82. package/assets/esri/core/workers/chunks/c91660f3982be4e03705.js +1 -0
  83. package/assets/esri/core/workers/chunks/ce93113b99bdbeddd07b.js +1 -0
  84. package/assets/esri/core/workers/chunks/cf2d408e669cfa2c65be.js +1 -0
  85. package/assets/esri/core/workers/chunks/d08f63ffeecefa02ad91.js +1 -0
  86. package/assets/esri/core/workers/chunks/{8d33644192c01e5416b4.js → d1a71b58ef62e71979c5.js} +1 -1
  87. package/assets/esri/core/workers/chunks/d30eade5afecd334f6cb.js +1 -0
  88. package/assets/esri/core/workers/chunks/d8782d0856b9d815cb6c.js +1 -0
  89. package/assets/esri/core/workers/chunks/db16c21b650001502e6c.js +1 -0
  90. package/assets/esri/core/workers/chunks/db18110c57253a31ac96.js +1 -0
  91. package/assets/esri/core/workers/chunks/dbaa5fb466d6c0214f24.js +1 -0
  92. package/assets/esri/core/workers/chunks/deae370788a7aacf4dd5.js +1 -0
  93. package/assets/esri/core/workers/chunks/e6ca132e1eeea3aa174e.js +1 -0
  94. package/assets/esri/core/workers/chunks/e878ccc431729ef3360f.js +1 -0
  95. package/assets/esri/core/workers/chunks/eb124f15ad4b9193f00a.js +1 -0
  96. package/assets/esri/core/workers/chunks/ebc71c06c1c22aaef54e.js +1 -0
  97. package/assets/esri/core/workers/chunks/f183da283af0836421ab.js +1 -0
  98. package/assets/esri/core/workers/chunks/f42bdc2a134833d33b4e.js +1 -0
  99. package/assets/esri/core/workers/chunks/{736d628cda4e02d40337.js → f8612c2fc5739e98be58.js} +1 -1
  100. package/assets/esri/core/workers/chunks/f965e3e5f6f4f9ba54ac.js +1 -0
  101. package/assets/esri/core/workers/chunks/fa4089640f480b69962e.js +1 -0
  102. package/assets/esri/core/workers/chunks/fb219563e5169ea67d68.js +1 -0
  103. package/assets/esri/libs/i3s/i3s.wasm +0 -0
  104. package/chunks/ChapmanAtmosphere.glsl.js +56 -77
  105. package/chunks/Clouds.glsl.js +1 -1
  106. package/chunks/Pattern.glsl.js +9 -11
  107. package/chunks/RibbonLine.glsl.js +60 -68
  108. package/chunks/i3s.js +1 -1
  109. package/chunks/mat4.js +1 -1
  110. package/chunks/vec3.js +1 -1
  111. package/core/Collection.js +1 -1
  112. package/core/Loadable.js +1 -1
  113. package/core/accessorSupport/ensureType.js +1 -1
  114. package/core/promiseUtils.js +1 -1
  115. package/core/support/OwningCollection.js +1 -1
  116. package/core/workers/RemoteClient.js +1 -1
  117. package/core/workers/WorkerOwner.js +1 -1
  118. package/core/workers/workers.js +2 -2
  119. package/geometry/projection.js +1 -1
  120. package/identity/IdentityManagerBase.js +1 -1
  121. package/interfaces.d.ts +205 -497
  122. package/layers/ElevationLayer.js +1 -1
  123. package/layers/GeoJSONLayer.js +1 -1
  124. package/layers/ImageryTileLayer.js +1 -1
  125. package/layers/VectorTileLayer.js +1 -1
  126. package/layers/VoxelWasmPerScene.js +1 -1
  127. package/layers/WCSLayer.js +1 -1
  128. package/layers/analyses/AreaMeasurement3D.js +1 -1
  129. package/layers/analyses/DirectLineMeasurement3D.js +1 -1
  130. package/layers/analyses/Slice.js +1 -1
  131. package/layers/effects/EffectList.js +1 -1
  132. package/layers/effects/effects.js +1 -1
  133. package/layers/effects/jsonUtils.js +1 -1
  134. package/layers/effects/parser.js +1 -1
  135. package/layers/effects/utils.js +5 -0
  136. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  137. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  138. package/layers/graphics/data/QueryEngine.js +1 -1
  139. package/layers/graphics/data/QueryEngineResult.js +1 -1
  140. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  141. package/layers/mixins/ImageryTileMixin.js +1 -1
  142. package/layers/support/RasterWorker.js +1 -1
  143. package/layers/support/TilemapCache.js +1 -1
  144. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  145. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  146. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  147. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  148. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  149. package/package.json +2 -2
  150. package/portal/support/portalLayers.js +1 -1
  151. package/request.js +1 -1
  152. package/smartMapping/renderers/support/utils.js +1 -1
  153. package/smartMapping/statistics/support/WorkerClient.js +1 -1
  154. package/smartMapping/statistics/support/statsWorker.js +1 -1
  155. package/smartMapping/statistics/support/utils.js +1 -1
  156. package/smartMapping/support/adapters/CSVLayerAdapter.js +1 -1
  157. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  158. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  159. package/smartMapping/support/adapters/support/utils.js +1 -1
  160. package/statistics/utils.js +1 -1
  161. package/support/GraphicsCollection.js +1 -1
  162. package/support/revision.js +1 -1
  163. package/symbols/FillSymbol3DLayer.js +1 -1
  164. package/symbols/IconSymbol3DLayer.js +1 -1
  165. package/symbols/LineSymbol3DLayer.js +1 -1
  166. package/symbols/patterns/LinePattern3D.js +5 -0
  167. package/symbols/patterns/LineStylePattern3D.d.ts +4 -0
  168. package/symbols/patterns/LineStylePattern3D.js +5 -0
  169. package/symbols/patterns/StylePattern3D.js +1 -1
  170. package/symbols/patterns/lineStyles.js +5 -0
  171. package/symbols/patterns/utils.js +1 -1
  172. package/symbols/support/Symbol3DFillMaterial.js +1 -1
  173. package/symbols/support/Symbol3DIconOutline.js +5 -0
  174. package/symbols/support/Symbol3DMaterial.js +1 -1
  175. package/symbols/support/Symbol3DOutline.js +1 -1
  176. package/symbols/support/defaults3D.js +1 -1
  177. package/symbols/support/previewSymbol3D.js +1 -1
  178. package/symbols/support/symbolLayerUtils3D.js +1 -1
  179. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  180. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  181. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  182. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  183. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  184. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  185. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  186. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  187. package/views/2d/layers/features/controllers/EditsQueue.js +1 -1
  188. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  189. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  190. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  191. package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
  192. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  193. package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
  194. package/views/3d/environment/CloudsGenerator.js +1 -1
  195. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  196. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  197. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  198. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  199. package/views/3d/externalRenderers.js +1 -1
  200. package/views/3d/interactive/Manipulator3D.js +1 -1
  201. package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
  202. package/views/3d/interactive/analysisTools/slice/images/Factory.js +5 -0
  203. package/views/3d/interactive/analysisTools/slice/sliceToolConfig.js +1 -1
  204. package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
  205. package/views/3d/interactive/editingTools/settings.js +1 -1
  206. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  207. package/views/3d/interactive/graphics/Slice/SliceController.js +1 -1
  208. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  209. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  210. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  211. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  212. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  213. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  214. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  215. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  216. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  217. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  218. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  219. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  220. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  221. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  222. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  223. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  224. package/views/3d/layers/I3SMeshView3D.js +1 -1
  225. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  226. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  227. package/views/3d/layers/analyses/AreaMeasurement3D/AreaMeasurementView3D.js +1 -1
  228. package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementPathHelper.js +1 -1
  229. package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementVisualization.js +1 -1
  230. package/views/3d/layers/analyses/DirectLineMeasurement3D/DirectLineMeasurementView3D.js +1 -1
  231. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  232. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  233. package/views/3d/layers/graphics/ElevationQuery.js +1 -1
  234. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  235. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  236. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  237. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  238. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  239. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  240. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  241. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  242. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  243. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  244. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  245. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  246. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  247. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  248. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  249. package/views/3d/layers/graphics/Labeler.js +1 -1
  250. package/views/3d/layers/graphics/Loadable.js +1 -1
  251. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  252. package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
  253. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  254. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  255. package/views/3d/layers/graphics/pointUtils.js +1 -1
  256. package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
  257. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  258. package/views/3d/layers/i3s/I3SStreamDataController.js +1 -1
  259. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  260. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  261. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  262. package/views/3d/layers/support/patternUtils.js +1 -1
  263. package/views/3d/state/GoToOperation.js +1 -1
  264. package/views/3d/state/ViewStateManager.js +1 -1
  265. package/views/3d/support/LaserLineRenderer.js +1 -1
  266. package/views/3d/support/SharedSymbolResources.js +1 -1
  267. package/views/3d/support/StreamDataLoader.js +1 -1
  268. package/views/3d/support/StreamTextureCollection.js +5 -0
  269. package/views/3d/support/TextureCollection.js +1 -1
  270. package/views/3d/support/debugFlags.js +1 -1
  271. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  272. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  273. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  274. package/views/3d/terrain/OverlayManager.js +1 -1
  275. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  276. package/views/3d/terrain/OverlayRenderer.js +1 -1
  277. package/views/3d/terrain/Tile.js +1 -1
  278. package/views/3d/webgl-engine/Stage.js +1 -1
  279. package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
  280. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +13 -12
  281. package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +1 -1
  282. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -3
  283. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  284. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  285. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  286. package/views/3d/webgl-engine/lib/GLMaterialTexture.js +1 -1
  287. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  288. package/views/3d/webgl-engine/lib/Material.js +1 -1
  289. package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
  290. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  291. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  292. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  293. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  294. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  295. package/views/3d/webgl-engine/lib/TextTexture.js +1 -1
  296. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  297. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  298. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  299. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  300. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  301. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  302. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  303. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  304. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  305. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  306. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  307. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  308. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  309. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  310. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  311. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  312. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  313. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  314. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  315. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  316. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  317. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  318. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  319. package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
  320. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  321. package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
  322. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  323. package/views/3d/webgl-engine/parts/Model.js +1 -1
  324. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  325. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  326. package/views/LayerViewManager.js +1 -1
  327. package/views/SceneView.js +1 -1
  328. package/views/ToolViewManager.js +1 -1
  329. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  330. package/views/support/AllocationTracer.js +1 -1
  331. package/views/support/DefaultsFromMap.js +1 -1
  332. package/views/support/QueueProcessor.js +1 -1
  333. package/views/webgl/capabilities/load.js +1 -1
  334. package/webscene/Slide.js +1 -1
  335. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  336. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  337. package/widgets/BuildingExplorer/support/layerUtils.js +1 -1
  338. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  339. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  340. package/widgets/Editor/UpdateWorkflow.js +1 -1
  341. package/widgets/Feature/FeatureViewModel.js +1 -1
  342. package/widgets/Home/HomeViewModel.js +1 -1
  343. package/widgets/Locate/LocateViewModel.js +1 -1
  344. package/widgets/Popup/PopupViewModel.js +1 -1
  345. package/widgets/Search/SearchViewModel.js +1 -1
  346. package/widgets/Search.js +1 -1
  347. package/widgets/Sketch/SketchViewModel.js +1 -1
  348. package/widgets/Slice/SliceViewModel.js +1 -1
  349. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  350. package/assets/esri/core/workers/chunks/0283801d442984997abe.js +0 -1
  351. package/assets/esri/core/workers/chunks/0419e14a520b8fcf3e7a.js +0 -1
  352. package/assets/esri/core/workers/chunks/05318446b6a40caea361.js +0 -1
  353. package/assets/esri/core/workers/chunks/09e714d4381649348ac9.js +0 -1
  354. package/assets/esri/core/workers/chunks/0cecd668b9d5d3f83293.js +0 -1
  355. package/assets/esri/core/workers/chunks/13a73a88efd4f464173e.js +0 -1
  356. package/assets/esri/core/workers/chunks/1576727e8174d672555b.js +0 -1
  357. package/assets/esri/core/workers/chunks/1a3cbeb0a53d03a51dad.js +0 -1
  358. package/assets/esri/core/workers/chunks/1b8524b617bfc6fe422c.js +0 -1
  359. package/assets/esri/core/workers/chunks/1dc1d750046912ff6cef.js +0 -1
  360. package/assets/esri/core/workers/chunks/21fa174c114640be5e40.js +0 -1
  361. package/assets/esri/core/workers/chunks/2a3f6e56079620421a02.js +0 -1
  362. package/assets/esri/core/workers/chunks/2a5bcc73e55986ad93fe.js +0 -1
  363. package/assets/esri/core/workers/chunks/2a6f2e3d639aae491171.js +0 -1
  364. package/assets/esri/core/workers/chunks/2c17d1bad17bcee53f7d.js +0 -1
  365. package/assets/esri/core/workers/chunks/2cea27a0d07aa9a88ad4.js +0 -1
  366. package/assets/esri/core/workers/chunks/2e193d97d199b29b00c2.js +0 -1
  367. package/assets/esri/core/workers/chunks/2eb41fdf0d0a3b0c3232.js +0 -1
  368. package/assets/esri/core/workers/chunks/2f09ea639ca5d1d6ca7e.js +0 -1
  369. package/assets/esri/core/workers/chunks/2fb847ab1440bd1bdf15.js +0 -1
  370. package/assets/esri/core/workers/chunks/402d22ebbae608760b4f.js +0 -1
  371. package/assets/esri/core/workers/chunks/44daef7f0cbc6f6af09f.js +0 -1
  372. package/assets/esri/core/workers/chunks/46899156159e398c693f.js +0 -1
  373. package/assets/esri/core/workers/chunks/46bf8921db25845c63c0.js +0 -1
  374. package/assets/esri/core/workers/chunks/4eb23554e375350f73b5.js +0 -1
  375. package/assets/esri/core/workers/chunks/551917be63a513dfa4de.js +0 -1
  376. package/assets/esri/core/workers/chunks/564f6f5484bcb13ebb2b.js +0 -1
  377. package/assets/esri/core/workers/chunks/61df67ae47b7fb5875d9.js +0 -1
  378. package/assets/esri/core/workers/chunks/62642a8fc7bafe339984.js +0 -1
  379. package/assets/esri/core/workers/chunks/6304f4e53027df04eb8f.js +0 -1
  380. package/assets/esri/core/workers/chunks/6331987617ad166ea098.js +0 -1
  381. package/assets/esri/core/workers/chunks/6b13fcbc71c0088d317e.js +0 -1
  382. package/assets/esri/core/workers/chunks/6f7a6841e7269d2764ad.js +0 -1
  383. package/assets/esri/core/workers/chunks/70110efd2de23d9a5263.js +0 -1
  384. package/assets/esri/core/workers/chunks/7eae3f0588cde44fce39.js +0 -1
  385. package/assets/esri/core/workers/chunks/80d3c7a429c6412f1a8d.js +0 -1
  386. package/assets/esri/core/workers/chunks/80deebdf54bea04a0889.js +0 -1
  387. package/assets/esri/core/workers/chunks/81aa5fe7dcb4fdeb0974.js +0 -1
  388. package/assets/esri/core/workers/chunks/840d08b41913cad4df89.js +0 -1
  389. package/assets/esri/core/workers/chunks/85d154aeb511c5d70bb1.js +0 -1
  390. package/assets/esri/core/workers/chunks/8681e99e2bc9ece61c43.js +0 -1
  391. package/assets/esri/core/workers/chunks/8e5ef967f6518f4c93b1.js +0 -1
  392. package/assets/esri/core/workers/chunks/8edd7f70c8b95c34125c.js +0 -1
  393. package/assets/esri/core/workers/chunks/9044a7b90a53312b6392.js +0 -1
  394. package/assets/esri/core/workers/chunks/905b4dfc1ce57a225fa4.js +0 -1
  395. package/assets/esri/core/workers/chunks/945f90b31ebfae623ea0.js +0 -1
  396. package/assets/esri/core/workers/chunks/9943fd69b67cd1871d68.js +0 -1
  397. package/assets/esri/core/workers/chunks/9ad91c23480ffb656030.js +0 -1
  398. package/assets/esri/core/workers/chunks/9d103681372ab01a4147.js +0 -1
  399. package/assets/esri/core/workers/chunks/9d3230f59b4c4d1b2713.js +0 -1
  400. package/assets/esri/core/workers/chunks/9db75bc0980d16b730a1.js +0 -1
  401. package/assets/esri/core/workers/chunks/a0659b8bdc067da7badd.js +0 -1
  402. package/assets/esri/core/workers/chunks/a480ee9a994410177961.js +0 -1
  403. package/assets/esri/core/workers/chunks/a9b279975d7df0f295d7.js +0 -1
  404. package/assets/esri/core/workers/chunks/aa3abaa5ad4a5a3bcb84.js +0 -1
  405. package/assets/esri/core/workers/chunks/aa8e607f908297786675.js +0 -1
  406. package/assets/esri/core/workers/chunks/ab5a302b5f62d38293f9.js +0 -1
  407. package/assets/esri/core/workers/chunks/abd6a84396e0eb3f01ad.js +0 -1
  408. package/assets/esri/core/workers/chunks/abe9f8516b03a3fb0477.js +0 -1
  409. package/assets/esri/core/workers/chunks/aff6aa5c7f75f8e052d9.js +0 -1
  410. package/assets/esri/core/workers/chunks/b601cc5304b132536239.js +0 -1
  411. package/assets/esri/core/workers/chunks/b85f614ddbddd3c3007e.js +0 -1
  412. package/assets/esri/core/workers/chunks/b944f4ab25a691b3e611.js +0 -1
  413. package/assets/esri/core/workers/chunks/bbdacddb61e651ca0098.js +0 -1
  414. package/assets/esri/core/workers/chunks/c2fa728e805637a1783e.js +0 -1
  415. package/assets/esri/core/workers/chunks/c901f5f85d962254fc2c.js +0 -1
  416. package/assets/esri/core/workers/chunks/ca173b908d89a4e334f6.js +0 -1
  417. package/assets/esri/core/workers/chunks/cc2ef3bfa1f614d7452c.js +0 -1
  418. package/assets/esri/core/workers/chunks/cdb32a9ac9f5804c4212.js +0 -1
  419. package/assets/esri/core/workers/chunks/ce9a4997973da80141a5.js +0 -1
  420. package/assets/esri/core/workers/chunks/d0674b50a358d3bb9db2.js +0 -1
  421. package/assets/esri/core/workers/chunks/d18b7b4b3b9bea7204b0.js +0 -1
  422. package/assets/esri/core/workers/chunks/d2ce983f7babdf18a0ed.js +0 -1
  423. package/assets/esri/core/workers/chunks/d38a0d867dc6cecdc551.js +0 -1
  424. package/assets/esri/core/workers/chunks/e39ca33e9e463c1d6060.js +0 -1
  425. package/assets/esri/core/workers/chunks/e471d103205018a5cf7f.js +0 -1
  426. package/assets/esri/core/workers/chunks/e542fb044fc96f7e8af2.js +0 -1
  427. package/assets/esri/core/workers/chunks/e94e00a28591337b2def.js +0 -1
  428. package/assets/esri/core/workers/chunks/eb2709ccbc001f42ac1b.js +0 -1
  429. package/assets/esri/core/workers/chunks/f905511ca5f9b59fc17f.js +0 -1
  430. package/assets/esri/core/workers/chunks/f910e80dd87727af5184.js +0 -1
  431. package/assets/esri/core/workers/chunks/f9300a24305b0af1d227.js +0 -1
  432. package/assets/esri/core/workers/chunks/fa1e1ac5b3ef7bdf8a78.js +0 -1
  433. package/assets/esri/core/workers/chunks/fce76a84c7d25d8d47e8.js +0 -1
  434. package/assets/esri/core/workers/chunks/fef4f97fbe861a1b60e8.js +0 -1
  435. package/layers/AreaMeasurementLayer.d.ts +0 -4
  436. package/layers/DirectLineMeasurementLayer.d.ts +0 -4
  437. package/symbols/support/symbolPreview.d.ts +0 -4
  438. package/symbols/support/symbolPreview.js +0 -5
  439. package/views/3d/layers/AreaMeasurementLayerView3D.d.ts +0 -4
  440. package/views/3d/layers/DirectLineMeasurementLayerView3D.d.ts +0 -4
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{createAbortController as a,throwIfAborted as t}from"../../../core/promiseUtils.js";function i(){let i=a();return async o=>{i.abort(),i=a();const r={signal:i.signal},l=o.toArray().map((a=>s(a,r)));await Promise.all(l),t(r)}}async function s(a,i){await a.load(i),await a.loadAll(),t(i),a.summaryStatistics&&await a.summaryStatistics.load(i)}export{i as createLoadLayersFunction};
5
+ import{throwIfAborted as t}from"../../../core/promiseUtils.js";function a(){let a=new AbortController;return async r=>{a.abort(),a=new AbortController;const i={signal:a.signal},l=r.toArray().map((t=>o(t,i)));await Promise.all(l),t(i)}}async function o(a,o){await a.load(o),await a.loadAll(),t(o),a.summaryStatistics&&await a.summaryStatistics.load(o)}export{a as createLoadLayersFunction};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Handles.js";import i from"../../core/Logger.js";import{isSome as s,destroyMaybe as r,isNone as n}from"../../core/maybe.js";import{react as o,syncAndInitial as a}from"../../core/reactiveUtils.js";import{measurementLengthUnits as l}from"../../core/unitUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{DirectLineMeasurement3D as d}from"../../layers/analyses/DirectLineMeasurement3D.js";import{defaultUnitPropertyMetadata as h}from"../../properties/defaultUnit.js";import p from"../../views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js";import{InteractiveToolViewModel as m}from"../support/InteractiveToolViewModel.js";const y=i.getLogger("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel");let f=class extends m{constructor(t){super(t),this.logger=y,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views.",this.usesAnalysisLayer=!0,this._handles=new e,this._userUnitOptions=null,this._userUnit=null,this.ready=!1,this.analysis=new d}initialize(){this._handles.add([o((()=>this.unit),(t=>{s(this.tool)&&(this.tool.unit=t)}),a)])}destroy(){this.analysis.destroy(),this._handles=r(this._handles)}get state(){return this.disabled?"disabled":n(this.tool)?"ready":this.tool.state}get measurement(){if(n(this.tool))return null;const t={mode:"euclidean",directDistance:{text:null,state:"unavailable"},horizontalDistance:{text:null,state:"unavailable"},verticalDistance:{text:null,state:"unavailable"}},e=this.tool.measurementView.analysisView;if(n(e))return t;const i=e.actualVisualizedMeasurement,r=this.tool.measurementView,o=s(e.result)?"available":"unavailable";switch(i){case 1:return{mode:"euclidean",directDistance:{text:r.directLabelText,state:o},horizontalDistance:{text:r.horizontalLabelText,state:o},verticalDistance:{text:r.verticalLabelText,state:o}};case 2:return{mode:"geodesic",directDistance:{text:null,state:"unavailable"},horizontalDistance:{text:r.horizontalLabelText,state:o},verticalDistance:{text:r.verticalLabelText,state:o}};default:return t}}set unitOptions(t){this._userUnitOptions=t,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(t){this._userUnit=t?this._findSelectableUnit(t,this._userUnit):null,this.notifyChange("unit")}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}start(){return this.createTool()}clear(){this.removeTool()}createToolParams(){return{toolConstructor:p,constructorArguments:()=>({unit:this.unit})}}_findSelectableUnit(t,e){const i=this.unitOptions;return-1!==i.indexOf(t)?t:e?this._findSelectableUnit(e):i[0]}_filteredOrAllUnits(t){if(!t)return l.slice();const e=t.filter((t=>-1!==l.indexOf(t)));return 0===e.length?l.slice():e}onConnectToAnalysisView(){s(this.view)&&this.view.ready&&(this.ready=!0)}onDisconnectFromAnalysisView(){this.ready=!1}};t([u()],f.prototype,"ready",void 0),t([u({readOnly:!0})],f.prototype,"state",null),t([u({readOnly:!0})],f.prototype,"measurement",null),t([u(h)],f.prototype,"defaultUnit",void 0),t([u()],f.prototype,"unitOptions",null),t([u()],f.prototype,"unit",null),t([u()],f.prototype,"analysis",void 0),f=t([c("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel")],f);const D=f;export{D as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Handles.js";import i from"../../core/Logger.js";import{isSome as s,destroyMaybe as r,isNone as n}from"../../core/maybe.js";import{react as o,syncAndInitial as a}from"../../core/reactiveUtils.js";import{measurementLengthUnits as l}from"../../core/unitUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../layers/analyses/DirectLineMeasurement3D.js";import{defaultUnitPropertyMetadata as h}from"../../properties/defaultUnit.js";import p from"../../views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js";import{InteractiveToolViewModel as m}from"../support/InteractiveToolViewModel.js";const y=i.getLogger("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel");let f=class extends m{constructor(t){super(t),this.logger=y,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views.",this.usesAnalysisLayer=!0,this._handles=new e,this._userUnitOptions=null,this._userUnit=null,this.ready=!1,this.analysis=new d}initialize(){this._handles.add([o((()=>this.unit),(t=>{s(this.tool)&&(this.tool.unit=t)}),a)])}destroy(){this.analysis.destroy(),this._handles=r(this._handles)}get state(){return this.disabled?"disabled":n(this.tool)?"ready":this.tool.state}get measurement(){if(n(this.tool))return null;const t={mode:"euclidean",directDistance:{text:null,state:"unavailable"},horizontalDistance:{text:null,state:"unavailable"},verticalDistance:{text:null,state:"unavailable"}},e=this.tool.measurementView.analysisView;if(n(e))return t;const i=e.actualVisualizedMeasurement,r=this.tool.measurementView,o=s(e.result)?"available":"unavailable";switch(i){case 1:return{mode:"euclidean",directDistance:{text:r.directLabelText,state:o},horizontalDistance:{text:r.horizontalLabelText,state:o},verticalDistance:{text:r.verticalLabelText,state:o}};case 2:return{mode:"geodesic",directDistance:{text:null,state:"unavailable"},horizontalDistance:{text:r.horizontalLabelText,state:o},verticalDistance:{text:r.verticalLabelText,state:o}};default:return t}}set unitOptions(t){this._userUnitOptions=t,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(t){this._userUnit=t?this._findSelectableUnit(t,this._userUnit):null,this.notifyChange("unit")}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}start(){return this.createTool()}clear(){this.removeTool()}createToolParams(){return{toolConstructor:p,constructorArguments:()=>({unit:this.unit})}}_findSelectableUnit(t,e){const i=this.unitOptions;return-1!==i.indexOf(t)?t:e?this._findSelectableUnit(e):i[0]}_filteredOrAllUnits(t){if(!t)return l.slice();const e=t.filter((t=>-1!==l.indexOf(t)));return 0===e.length?l.slice():e}onConnectToAnalysisView(){s(this.view)&&this.view.ready&&(this.ready=!0)}onDisconnectFromAnalysisView(){this.ready=!1}};t([u()],f.prototype,"ready",void 0),t([u({readOnly:!0})],f.prototype,"state",null),t([u({readOnly:!0})],f.prototype,"measurement",null),t([u(h)],f.prototype,"defaultUnit",void 0),t([u()],f.prototype,"unitOptions",null),t([u()],f.prototype,"unit",null),t([u()],f.prototype,"analysis",void 0),f=t([c("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel")],f);const D=f;export{D as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../intl.js";import"../../symbols.js";import s from"../../core/Handles.js";import{destroyMaybe as i}from"../../core/maybe.js";import{formatDecimal as r,formatImperialLength as o,formatMetricLength as a}from"../../core/unitFormatUtils.js";import{convertUnit as n}from"../../core/unitUtils.js";import{init as l}from"../../core/watchUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{geodesicLength as c,geodesicDensify as p,planarLength as d}from"../../geometry/geometryEngine.js";import{isLoaded as u,load as y,project as _,isSupported as v}from"../../geometry/projection.js";import{isSupported as f,geodesicLengths as w,geodesicDensify as g}from"../../geometry/support/geodesicUtils.js";import b from"../../layers/GraphicsLayer.js";import j from"../../layers/GroupLayer.js";import S from"../../views/draw/Draw.js";import{createManipulatorDragEventPipeline as L,screenToMap as A,dragGraphic as C}from"../../views/interactive/dragEventPipeline.js";import{GraphicManipulator as x}from"../../views/interactive/GraphicManipulator.js";import{InteractiveToolBase as I}from"../../views/interactive/InteractiveToolBase.js";import{fetchMessageBundle as M}from"../../intl/messages.js";import{onLocaleChange as D}from"../../intl/locale.js";import k from"../../geometry/Point.js";import T from"../../symbols/CIMSymbol.js";import G from"../../symbols/TextSymbol.js";import R from"../../symbols/Font.js";import P from"../../symbols/SimpleMarkerSymbol.js";import W from"../../geometry/Polyline.js";import E from"../../geometry/SpatialReference.js";const U=1e5;let z=class extends I{constructor(){super(...arguments),this._drawActive=!1,this._handles=new s,this._polylineLayer=new b,this._manipulatorLayer=new b,this._groupLayer=new j({layers:[this._polylineLayer,this._manipulatorLayer],listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){M("esri/core/t9n/Units").then((e=>{this.messages=e})),this._handles.add(D((async()=>{this.messages=await M("esri/core/t9n/Units")}))),this.startToolCreation()}destroy(){this._draw=i(this._draw),this._handles=i(this._handles),this._polylineLayer=i(this._polylineLayer),this._manipulatorLayer=i(this._manipulatorLayer)}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||0!==this._vertices.length||this._startSketch()}onAttach(){const e=this.view;this._draw=new S({view:e}),e.map.add(this._groupLayer),e.focus(),this._handles.add([l(this,["unit","geodesicDistanceThreshold","palette","messages"],(()=>{this._vertices.length>0&&this._updatePolylines()})),l(this,"view.spatialReference",(e=>{H(e)&&!u()&&y()}))]),this.finishToolCreation()}onDetach(){const{map:e}=this.view;this._draw.view=null,this._draw=i(this._draw),e.remove(this._groupLayer),this._handles.removeAll(),this._polylineLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null)}onShow(){this._groupLayer.visible=!0}onHide(){this._groupLayer.visible=!1}reset(){this._vertices=[],this._polylineLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._draw.reset(),this._drawActive=!1,this._updateSketch([])}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],(e=>this._updateSketch(e.vertices))),e.on("draw-complete",(()=>{this._stopSketch()}))}_stopSketch(){this.manipulators.forEach((e=>{e.manipulator.interactive=!0})),this._drawActive=!1,this.complete()}_updateSketch(e){if(H(this.view.spatialReference)&&!u())return;if(e.length<2)return this._vertices=[],this.manipulators.removeAll(),void this._polylineLayer.removeAll();this.finishToolCreation();const{spatialReference:t}=this.view;for(;this._vertices.length>e.length;){const{manipulatorId:e}=this._vertices.pop();this.manipulators.remove(e)}for(let n=this._vertices.length;n<e.length;n++){const[s,i]=e[n],r=B(new k({x:s,y:i,spatialReference:t}),this.view,this._manipulatorLayer,this.palette),o=this.manipulators.add(r);L(r,((e,t)=>{t.next(A(this.view)).next(C(e.graphic,2)).next((()=>{const t=e.graphic.geometry;this._vertices[n].coord=[t.x,t.y],this._updatePolylines()}))})),this._vertices.push({manipulatorId:o,coord:[s,i]})}const s=this._vertices.length-1,i=this._vertices[s],[r,o]=e[s];if(i.coord[0]!==r||i.coord[1]!==o){i.coord=[r,o];const e=new k({x:r,y:o,spatialReference:t});this.manipulators.findById(i.manipulatorId).graphic.geometry=e}const a=this._drawActive?this._vertices[s].manipulatorId:null;this.manipulators.forEach((e=>{e.manipulator.interactive=null==a||e.id!==a})),this._updatePolylines()}_updatePolylines(){const e=this._vertices.map((e=>e.coord)),{measurement:s,drawing:i,original:r}=F(e,this.view.spatialReference,this.geodesicDistanceThreshold);this._set("measurement",s);const o=N(this.messages,s,this.unit);let a,n;this._set("measurementLabel",o);const{graphics:l}=this._polylineLayer;if(2===l.length)a=l.getItemAt(0),n=l.getItemAt(1);else{const{pathPrimaryColor:e,pathSecondaryColor:s,pathWidth:i}=this.palette;a=new t({symbol:new T({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[14,12],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:i-1.5,color:s},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:i,color:e}]}}})}),n=new t({symbol:new G({color:[255,255,255,1],haloColor:[0,0,0,.5],haloSize:2,font:new R({size:14,family:"sans-serif"})})}),l.removeAll(),l.addMany([a,n])}a.geometry=i,n.geometry=r.extent.center,n.symbol.text=o}};function B(e,s,i,r){const o=new P({style:"circle",color:r.handleColor,size:r.handleWidth,outline:{type:"simple-line",width:0}}),a=new P({style:"circle",color:r.handleColor,size:1.5*r.handleWidth,outline:{type:"simple-line",width:0}}),n=new t({geometry:e,symbol:o});return new x({view:s,layer:i,graphic:n,focusedSymbol:a})}function F(e,t,s){const i=new W({paths:[e],spatialReference:t});let r,o;if(t.isGeographic)if(f(t))r=w([i],"meters")[0],o=g(i,U);else{const e=_(i,E.WGS84),s=g(e,U);r=w([e],"meters")[0],o=_(s,t)}else if(t.isWebMercator)r=c(i,"meters"),o=p(i,U,"meters");else{const e=d(i,"meters");if(e>=s){const e=_(i,E.WGS84),s=g(e,U);r=w([e],"meters")[0],o=_(s,t)}else r=e,o=i}return{measurement:{geometry:o,length:r},original:i,drawing:o}}function O(e){return null!=e&&(!H(e)||v())}function H(e){if(!e)return!1;const{isGeographic:t,isWebMercator:s,isWGS84:i}=e;return t&&!i&&!f(e)||!t&&!s}function N(e,t,s){if(!t||!e)return null;switch(s){case"metric":return a(e,t.length,"meters");case"imperial":return o(e,t.length,"meters");default:return r(e,n(t.length,"meters",s),s)}}e([m()],z.prototype,"_drawActive",void 0),e([m()],z.prototype,"cursor",null),e([m({value:!0})],z.prototype,"editable",null),e([m({type:Number})],z.prototype,"geodesicDistanceThreshold",void 0),e([m({readOnly:!0})],z.prototype,"measurement",void 0),e([m({readOnly:!0})],z.prototype,"measurementLabel",void 0),e([m()],z.prototype,"messages",void 0),e([m()],z.prototype,"palette",void 0),e([m()],z.prototype,"unit",void 0),e([m({constructOnly:!0})],z.prototype,"view",void 0),z=e([h("esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DTool")],z);const q=z;export{F as createDistanceMeasurementInfo2D,N as createDistanceMeasurementLabel,q as default,O as isSupported};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../intl.js";import"../../symbols.js";import s from"../../core/Handles.js";import{destroyMaybe as i}from"../../core/maybe.js";import{formatDecimal as r,formatImperialLength as o,formatMetricLength as a}from"../../core/unitFormatUtils.js";import{convertUnit as n}from"../../core/unitUtils.js";import{init as l}from"../../core/watchUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{geodesicLength as c,geodesicDensify as p,planarLength as d}from"../../geometry/geometryEngine.js";import{isLoaded as u,load as y,project as _}from"../../geometry/projection.js";import{isSupported as v,geodesicLengths as f,geodesicDensify as w}from"../../geometry/support/geodesicUtils.js";import g from"../../layers/GraphicsLayer.js";import b from"../../layers/GroupLayer.js";import j from"../../views/draw/Draw.js";import{createManipulatorDragEventPipeline as S,screenToMap as L,dragGraphic as A}from"../../views/interactive/dragEventPipeline.js";import{GraphicManipulator as C}from"../../views/interactive/GraphicManipulator.js";import{InteractiveToolBase as x}from"../../views/interactive/InteractiveToolBase.js";import{fetchMessageBundle as I}from"../../intl/messages.js";import{onLocaleChange as M}from"../../intl/locale.js";import D from"../../geometry/Point.js";import k from"../../symbols/CIMSymbol.js";import T from"../../symbols/TextSymbol.js";import G from"../../symbols/Font.js";import R from"../../symbols/SimpleMarkerSymbol.js";import P from"../../geometry/Polyline.js";import W from"../../geometry/SpatialReference.js";const E=1e5;let U=class extends x{constructor(){super(...arguments),this._drawActive=!1,this._handles=new s,this._polylineLayer=new g,this._manipulatorLayer=new g,this._groupLayer=new b({layers:[this._polylineLayer,this._manipulatorLayer],listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){I("esri/core/t9n/Units").then((e=>{this.messages=e})),this._handles.add(M((async()=>{this.messages=await I("esri/core/t9n/Units")}))),this.startToolCreation()}destroy(){this._draw=i(this._draw),this._handles=i(this._handles),this._polylineLayer=i(this._polylineLayer),this._manipulatorLayer=i(this._manipulatorLayer)}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||0!==this._vertices.length||this._startSketch()}onAttach(){const e=this.view;this._draw=new j({view:e}),e.map.add(this._groupLayer),e.focus(),this._handles.add([l(this,["unit","geodesicDistanceThreshold","palette","messages"],(()=>{this._vertices.length>0&&this._updatePolylines()})),l(this,"view.spatialReference",(e=>{O(e)&&!u()&&y()}))]),this.finishToolCreation()}onDetach(){const{map:e}=this.view;this._draw.view=null,this._draw=i(this._draw),e.remove(this._groupLayer),this._handles.removeAll(),this._polylineLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null)}onShow(){this._groupLayer.visible=!0}onHide(){this._groupLayer.visible=!1}reset(){this._vertices=[],this._polylineLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._draw.reset(),this._drawActive=!1,this._updateSketch([])}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],(e=>this._updateSketch(e.vertices))),e.on("draw-complete",(()=>{this._stopSketch()}))}_stopSketch(){this.manipulators.forEach((e=>{e.manipulator.interactive=!0})),this._drawActive=!1,this.complete()}_updateSketch(e){if(O(this.view.spatialReference)&&!u())return;if(e.length<2)return this._vertices=[],this.manipulators.removeAll(),void this._polylineLayer.removeAll();this.finishToolCreation();const{spatialReference:t}=this.view;for(;this._vertices.length>e.length;){const{manipulatorId:e}=this._vertices.pop();this.manipulators.remove(e)}for(let n=this._vertices.length;n<e.length;n++){const[s,i]=e[n],r=z(new D({x:s,y:i,spatialReference:t}),this.view,this._manipulatorLayer,this.palette),o=this.manipulators.add(r);S(r,((e,t)=>{t.next(L(this.view)).next(A(e.graphic,2)).next((()=>{const t=e.graphic.geometry;this._vertices[n].coord=[t.x,t.y],this._updatePolylines()}))})),this._vertices.push({manipulatorId:o,coord:[s,i]})}const s=this._vertices.length-1,i=this._vertices[s],[r,o]=e[s];if(i.coord[0]!==r||i.coord[1]!==o){i.coord=[r,o];const e=new D({x:r,y:o,spatialReference:t});this.manipulators.findById(i.manipulatorId).graphic.geometry=e}const a=this._drawActive?this._vertices[s].manipulatorId:null;this.manipulators.forEach((e=>{e.manipulator.interactive=null==a||e.id!==a})),this._updatePolylines()}_updatePolylines(){const e=this._vertices.map((e=>e.coord)),{measurement:s,drawing:i,original:r}=B(e,this.view.spatialReference,this.geodesicDistanceThreshold);this._set("measurement",s);const o=H(this.messages,s,this.unit);let a,n;this._set("measurementLabel",o);const{graphics:l}=this._polylineLayer;if(2===l.length)a=l.getItemAt(0),n=l.getItemAt(1);else{const{pathPrimaryColor:e,pathSecondaryColor:s,pathWidth:i}=this.palette;a=new t({symbol:new k({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[14,12],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:i-1.5,color:s},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:i,color:e}]}}})}),n=new t({symbol:new T({color:[255,255,255,1],haloColor:[0,0,0,.5],haloSize:2,font:new G({size:14,family:"sans-serif"})})}),l.removeAll(),l.addMany([a,n])}a.geometry=i,n.geometry=r.extent.center,n.symbol.text=o}};function z(e,s,i,r){const o=new R({style:"circle",color:r.handleColor,size:r.handleWidth,outline:{type:"simple-line",width:0}}),a=new R({style:"circle",color:r.handleColor,size:1.5*r.handleWidth,outline:{type:"simple-line",width:0}}),n=new t({geometry:e,symbol:o});return new C({view:s,layer:i,graphic:n,focusedSymbol:a})}function B(e,t,s){const i=new P({paths:[e],spatialReference:t});let r,o;if(t.isGeographic)if(v(t))r=f([i],"meters")[0],o=w(i,E);else{const e=_(i,W.WGS84),s=w(e,E);r=f([e],"meters")[0],o=_(s,t)}else if(t.isWebMercator)r=c(i,"meters"),o=p(i,E,"meters");else{const e=d(i,"meters");if(e>=s){const e=_(i,W.WGS84),s=w(e,E);r=f([e],"meters")[0],o=_(s,t)}else r=e,o=i}return{measurement:{geometry:o,length:r},original:i,drawing:o}}function F(e){return null!=e}function O(e){if(!e)return!1;const{isGeographic:t,isWebMercator:s,isWGS84:i}=e;return t&&!i&&!v(e)||!t&&!s}function H(e,t,s){if(!t||!e)return null;switch(s){case"metric":return a(e,t.length,"meters");case"imperial":return o(e,t.length,"meters");default:return r(e,n(t.length,"meters",s),s)}}e([m()],U.prototype,"_drawActive",void 0),e([m()],U.prototype,"cursor",null),e([m({value:!0})],U.prototype,"editable",null),e([m({type:Number})],U.prototype,"geodesicDistanceThreshold",void 0),e([m({readOnly:!0})],U.prototype,"measurement",void 0),e([m({readOnly:!0})],U.prototype,"measurementLabel",void 0),e([m()],U.prototype,"messages",void 0),e([m()],U.prototype,"palette",void 0),e([m()],U.prototype,"unit",void 0),e([m({constructOnly:!0})],U.prototype,"view",void 0),U=e([h("esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DTool")],U);const N=U;export{B as createDistanceMeasurementInfo2D,H as createDistanceMeasurementLabel,N as default,F as isSupported};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{makeHandle as t}from"../../core/handleUtils.js";import{isSome as i}from"../../core/maybe.js";import{createAbortController as a,onAbort as s,createAbortError as o,throwIfAborted as r,isAborted as d}from"../../core/promiseUtils.js";import{watch as n}from"../../core/watchUtils.js";import"../../core/Logger.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/set.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{highlightsSupported as c}from"../../views/support/layerViewUtils.js";import{Edits as u}from"./Edits.js";import m from"./UpdateWorkflowData.js";import h from"./Workflow.js";import{createWorkflowSteps as f,fetchCandidates as g,fetchFullFeature as w,findLayerInfo as p,getVisualVariableAttributes as v,setUpGeometryUpdate as y}from"./workflowUtils.js";var b;const M="candidate-highlight";let V=b=class extends h{constructor(e){super(e),this.type="update"}static create(e,t,i){const a=new b({data:new m({edits:new u,viewModel:e}),onCommit:async e=>{const t=e.edits.feature,a=t.sourceLayer,s=t.clone();if(!e.edits.attributesModified){const{objectIdField:e}=a;s.attributes={[e]:t.getAttribute(e)}}e.edits.geometryModified||(s.geometry=null),await i(a,{updateFeatures:[s]})}});return a._set("steps",this._createWorkflowSteps(a,t)),a}highlight(e){const{data:{viewModel:{view:t}}}=this,i=e&&t.allLayerViews.items.find((({layer:t})=>t===e.layer));c(i)&&this.handles.add(i.highlight(e),M)}unhighlight(){this.handles.remove(M)}static _createWorkflowSteps(e,l="awaiting-feature-to-update"){const{data:c,handles:u}=e;return f(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],l,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:e,view:t}=c.viewModel;let i=null;u.add({remove(){i&&(i.abort(),i=null)}},this.id),c.edits.feature=null;const d=t.on("immediate-click",(d=>{e.location=d.mapPoint,e.visible=!0,i&&i.abort();const{editableItems:n}=c.viewModel;i=a(),new Promise(((e,a)=>{s(i.signal,(()=>a(o()))),e(g(n,t,d,i.signal))})).then((e=>{if(r(i),c.candidates=e.reduce(((e,t)=>t.error?e:[...e,...t.value]),[]),c.viewModel.spinnerViewModel.visible=1===c.candidates.length,0!==c.candidates.length)if(1===c.candidates.length){const e=c.candidates[0];c.edits.feature=e,c.viewModel.activeWorkflow.go("editing-existing-feature").catch((()=>{})).then((()=>c.viewModel.spinnerViewModel.visible=!1))}else c.viewModel.activeWorkflow.next()}))}));u.add(d,this.id)},async tearDown(){u.remove(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){const{edits:t}=c;t.feature=null,u.add(n(t,"feature",(t=>{e.unhighlight(),e.highlight(t)})),this.id)},async tearDown(){e.unhighlight(),u.remove(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){const s=c.edits.feature,o=c.viewModel;c.editableItem=o.editableItems.find((e=>e.layer===s.layer));const r=a();u.add({remove:()=>r.abort()},this.id);const n=o.view.whenLayerView(s.layer),l=w(s,o.view,r.signal),m=await n,h=await l;if(d(r))return;c.edits.updateGeometry(h.geometry),c.edits.updateAttributes(h.attributes),c.edits.trackChanges();const f=h.sourceLayer,g=p(o.layerInfos,f),b=g&&g.fieldConfig;o.attachmentsViewModel.set({graphic:h,mode:"view"}),o.featureFormViewModel.set({feature:h,fieldConfig:b});const M="createInteractiveEditSession"in m?m.createInteractiveEditSession(s):null,V=[o.featureFormViewModel.on("value-change",(e=>{c.edits.updateAttributes(o.featureFormViewModel.getValues()),h.attributes=c.edits.feature.attributes,M&&M.setAttribute(e.fieldName,e.value)})),o.attachmentsViewModel.watch("mode",(e=>{"add"===e&&c.viewModel.activeWorkflow.go("adding-attachment"),"edit"===e&&c.viewModel.activeWorkflow.go("editing-attachment")}))];M&&(V.push(t((()=>M.rollback()))),u.add(t((()=>M.commit())),e._handleKeys.afterCommit));const{supportsGeometryUpdate:j}=f.capabilities.editing;if(j){o.sketchViewModel.allowDeleteKey=!1;const t=v(h),{interactive:a,visual:s}=await y(h,t,o.sketchViewModel,o.view,(({geometry:e,attributes:a})=>{if(i(t.rotation)){const{field:e}=t.rotation;o.featureFormViewModel.setValue(e,a[e])}if(i(t.size)){const{field:e}=t.size;o.featureFormViewModel.setValue(e,a[e])}c.edits.updateAttributes(a),c.edits.updateGeometry(e)}));V.push(a,s),u.add(a,e._handleKeys.beforeCommit),u.add(s,e._handleKeys.afterCommit)}else e.highlight(h);u.add(V,this.id)},async tearDown(){e.unhighlight(),u.remove(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){}})})}};V=b=e([l("esri.widgets.Editor.UpdateWorkflow")],V);const j=V;export{j as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{makeHandle as t}from"../../core/handleUtils.js";import{isSome as i}from"../../core/maybe.js";import{onAbort as a,createAbortError as s,throwIfAborted as o,isAborted as r}from"../../core/promiseUtils.js";import{watch as d}from"../../core/watchUtils.js";import"../../core/Logger.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/set.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{highlightsSupported as l}from"../../views/support/layerViewUtils.js";import{Edits as c}from"./Edits.js";import u from"./UpdateWorkflowData.js";import m from"./Workflow.js";import{createWorkflowSteps as h,fetchCandidates as w,fetchFullFeature as f,findLayerInfo as g,getVisualVariableAttributes as p,setUpGeometryUpdate as v}from"./workflowUtils.js";var y;const b="candidate-highlight";let M=y=class extends m{constructor(e){super(e),this.type="update"}static create(e,t,i){const a=new y({data:new u({edits:new c,viewModel:e}),onCommit:async e=>{const t=e.edits.feature,a=t.sourceLayer,s=t.clone();if(!e.edits.attributesModified){const{objectIdField:e}=a;s.attributes={[e]:t.getAttribute(e)}}e.edits.geometryModified||(s.geometry=null),await i(a,{updateFeatures:[s]})}});return a._set("steps",this._createWorkflowSteps(a,t)),a}highlight(e){const{data:{viewModel:{view:t}}}=this,i=e&&t.allLayerViews.items.find((({layer:t})=>t===e.layer));l(i)&&this.handles.add(i.highlight(e),b)}unhighlight(){this.handles.remove(b)}static _createWorkflowSteps(e,n="awaiting-feature-to-update"){const{data:l,handles:c}=e;return h(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],n,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:e,view:t}=l.viewModel;let i=null;c.add({remove(){i&&(i.abort(),i=null)}},this.id),l.edits.feature=null;const r=t.on("immediate-click",(r=>{e.location=r.mapPoint,e.visible=!0,i&&i.abort();const{editableItems:d}=l.viewModel;i=new AbortController,new Promise(((e,o)=>{a(i.signal,(()=>o(s()))),e(w(d,t,r,i.signal))})).then((e=>{if(o(i),l.candidates=e.reduce(((e,t)=>t.error?e:[...e,...t.value]),[]),l.viewModel.spinnerViewModel.visible=1===l.candidates.length,0!==l.candidates.length)if(1===l.candidates.length){const e=l.candidates[0];l.edits.feature=e,l.viewModel.activeWorkflow.go("editing-existing-feature").catch((()=>{})).then((()=>l.viewModel.spinnerViewModel.visible=!1))}else l.viewModel.activeWorkflow.next()}))}));c.add(r,this.id)},async tearDown(){c.remove(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){const{edits:t}=l;t.feature=null,c.add(d(t,"feature",(t=>{e.unhighlight(),e.highlight(t)})),this.id)},async tearDown(){e.unhighlight(),c.remove(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){const a=l.edits.feature,s=l.viewModel;l.editableItem=s.editableItems.find((e=>e.layer===a.layer));const o=new AbortController;c.add({remove:()=>o.abort()},this.id);const d=s.view.whenLayerView(a.layer),n=f(a,s.view,o.signal),u=await d,m=await n;if(r(o))return;l.edits.updateGeometry(m.geometry),l.edits.updateAttributes(m.attributes),l.edits.trackChanges();const h=m.sourceLayer,w=g(s.layerInfos,h),y=w&&w.fieldConfig;s.attachmentsViewModel.set({graphic:m,mode:"view"}),s.featureFormViewModel.set({feature:m,fieldConfig:y});const b="createInteractiveEditSession"in u?u.createInteractiveEditSession(a):null,M=[s.featureFormViewModel.on("value-change",(e=>{l.edits.updateAttributes(s.featureFormViewModel.getValues()),m.attributes=l.edits.feature.attributes,b&&b.setAttribute(e.fieldName,e.value)})),s.attachmentsViewModel.watch("mode",(e=>{"add"===e&&l.viewModel.activeWorkflow.go("adding-attachment"),"edit"===e&&l.viewModel.activeWorkflow.go("editing-attachment")}))];b&&(M.push(t((()=>b.rollback()))),c.add(t((()=>b.commit())),e._handleKeys.afterCommit));const{supportsGeometryUpdate:V}=h.capabilities.editing;if(V){s.sketchViewModel.allowDeleteKey=!1;const t=p(m),{interactive:a,visual:o}=await v(m,t,s.sketchViewModel,s.view,(({geometry:e,attributes:a})=>{if(i(t.rotation)){const{field:e}=t.rotation;s.featureFormViewModel.setValue(e,a[e])}if(i(t.size)){const{field:e}=t.size;s.featureFormViewModel.setValue(e,a[e])}l.edits.updateAttributes(a),l.edits.updateGeometry(e)}));M.push(a,o),c.add(a,e._handleKeys.beforeCommit),c.add(o,e._handleKeys.afterCommit)}else e.highlight(m);c.add(M,this.id)},async tearDown(){e.unhighlight(),c.remove(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){}})})}};M=y=e([n("esri.widgets.Editor.UpdateWorkflow")],M);const V=M;export{V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as r}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import i from"../../core/Accessor.js";import o from"../../core/Handles.js";import s from"../../core/Logger.js";import{isSome as a}from"../../core/maybe.js";import{createAbortController as n,isAbortError as l,eachAlways as p}from"../../core/promiseUtils.js";import{throttle as c}from"../../core/throttle.js";import{init as d}from"../../core/watchUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as f}from"../../core/accessorSupport/decorators/cast.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import m from"../../popup/content/TextContent.js";import _ from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import y from"./FeatureContent/FeatureContentViewModel.js";import g from"./FeatureFields/FeatureFieldsViewModel.js";import b from"./FeatureMedia/FeatureMediaViewModel.js";import{createCompiledExpressions as v}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as I,preRequestCallback as A,createfieldInfoMap as w,getAllFieldInfos as M,getSourceLayer as C,substituteFieldsInLinksAndAttributes as T,isExpressionField as x,isRelatedField as F,formatEditInfo as j,graphicCallback as V,queryUpdatedFeature as P,formatAttributes as L}from"./support/featureUtils.js";import{queryLayerInfos as E,queryRelatedFeatures as R,setRelatedFeatures as O,getRelatedFieldInfo as S,createRelatedInfo as k,updateRelatedInfo as U}from"./support/relatedFeatureUtils.js";var N;const q=1,D="esri.widgets.FeatureViewModel",Q=s.getLogger(D),B={attachmentsContent:!0,customContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0};let G=N=class extends i{constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this.graphicChangedThrottled=c(this.graphicChanged,q,this),this._expressionAttributes=null,this.abilities={...B},this.content=null,this.contentViewModels=[],this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&t.attachmentsContent||"custom"===e.type&&t.customContent||"fields"===e.type&&t.fieldsContent||"media"===e.type&&t.mediaContent||"text"===e.type&&t.textContent},this._handles.add(d(this,["graphic","_effectivePopupTemplate","abilities"],(()=>this.graphicChangedThrottled())))}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this._handles=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return a(this.graphic)?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return w(M(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return C(this.graphic)}castAbilities(e){return{...B,...e}}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.get("view.spatialReference")||null}set spatialReference(e){void 0!==e?this._override("spatialReference",e):this._clearOverride("spatialReference")}get map(){return this.get("view.map")||null}set map(e){void 0!==e?this._override("map",e):this._clearOverride("map")}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const r=this.contentViewModels[e];r instanceof b&&r.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof b&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof b&&t.previous()}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=n();this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(r){l(r)||(this._error=r,Q.error("error","The popupTemplate could not be displayed for this feature.",{error:r,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):void 0)):"string"==typeof e?this._compileText(new m({text:e}),0).text:e}_destroyContentViewModels(){this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_compileAttachments(e,t){const{graphic:r}=this,{description:i,title:o}=e;return this.contentViewModels[t]=new _({graphic:r,...this._compileTitleAndDesc({title:o,description:i})}),e}_compileCustom(e,t){const{graphic:r}=this,{creator:i,destroyer:o}=e;return this.contentViewModels[t]=new y({graphic:r,creator:i,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:r,_sourceLayer:i,graphic:o,formattedAttributes:s,_expressionAttributes:a}=this,{attributes:n}=o,l=s.global;return{title:T({attributes:n,fieldInfoMap:r,globalAttributes:l,expressionAttributes:a,layer:i,text:e}),description:T({attributes:n,fieldInfoMap:r,globalAttributes:l,expressionAttributes:a,layer:i,text:t})}}_compileFields(e,t){const{_effectivePopupTemplate:r,formattedAttributes:i}=this,o=e.clone(),s={...i.global,...i.content[t]},a=(null==e?void 0:e.fieldInfos)||(null==r?void 0:r.fieldInfos),n=null==a?void 0:a.filter((({fieldName:e})=>x(e)||F(e)||s.hasOwnProperty(e))),l=null==r?void 0:r.expressionInfos,{description:p,title:c}=o,d=new g({attributes:s,expressionInfos:l,fieldInfos:n,...this._compileTitleAndDesc({title:c,description:p})});return this.contentViewModels[t]=d,o.fieldInfos=d.formattedFieldInfos.slice(0),o}_compileMedia(e,t){const{graphic:r,_fieldInfoMap:i,_effectivePopupTemplate:o,relatedInfos:s,_sourceLayer:a,_expressionAttributes:n}=this,{attributes:l}=r,p=this.formattedAttributes.global,c=e.clone(),{description:d,mediaInfos:u,title:f}=c,h=new b({activeMediaInfoIndex:c.activeMediaInfoIndex||0,attributes:l,layer:a,fieldInfoMap:i,formattedAttributes:p,expressionAttributes:n,mediaInfos:u,popupTemplate:o,relatedInfos:s,...this._compileTitleAndDesc({title:f,description:d})});return c.mediaInfos=h.formattedMediaInfos.slice(0),this.contentViewModels[t]=h,c}_compileText(e,t){const r=e.clone(),{graphic:i,_fieldInfoMap:o,_sourceLayer:s,_expressionAttributes:a}=this;if(r&&r.text){const{attributes:e}=i,t=this.formattedAttributes.global;r.text=T({attributes:e,fieldInfoMap:o,globalAttributes:t,expressionAttributes:a,layer:s,text:r.text})}return this.contentViewModels[t]=new y({graphic:i,creator:r.text}),r}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:r}=this;if(!e)return;const{lastEditInfoEnabled:i}=e,o=null==t?void 0:t.editFieldsInfo;return i&&o?j(o,r.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:r,graphic:i,_expressionAttributes:o}=this,{attributes:s}=i,a=this.formattedAttributes.global;return T({attributes:s,fieldInfoMap:t,globalAttributes:a,expressionAttributes:o,layer:r,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.title;return V(r,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.content;return V(r,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:r,graphic:i,_effectivePopupTemplate:o,spatialReference:s,map:a,view:n}=this,{content:{value:l},title:{value:c}}=await p({content:this._getContent(),title:this._getTitle()});if(t!==this._featureAbortController||!i)return;await P({graphic:i,popupTemplate:o,layer:r,spatialReference:s},e);const{expressionAttributes:{value:d}}=await p({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:v({popupTemplate:this._effectivePopupTemplate,spatialReference:s,graphic:i,map:a,interceptor:N.interceptor,view:n})});t===this._featureAbortController&&i&&(this._expressionAttributes=d,this._set("formattedAttributes",this._createFormattedAttributes(l,d)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(l)||null))}_createFormattedAttributes(e,t){const{_effectivePopupTemplate:r,graphic:i,relatedInfos:o,_sourceLayer:s,_fieldInfoMap:a}=this,n=null==r?void 0:r.fieldInfos,l={...i.attributes,...t},p={global:L({fieldInfos:n,graphic:i,attributes:l,layer:s,fieldInfoMap:a,relatedInfos:o}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&e.fieldInfos&&(p.content[t]=L({fieldInfos:e.fieldInfos,graphic:i,attributes:l,layer:s,fieldInfoMap:a,relatedInfos:o}))})),p}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:r}=this;return this._queryRelatedInfos(t,M(r),e)}async _queryRelatedInfos(e,t,r){const{relatedInfos:i,_sourceLayer:o}=this;i.clear();const s=a(o.associatedLayer)?await o.associatedLayer.load(r):o;if(!s)return;const n=t.filter((e=>e&&F(e.fieldName)));if(!n||!n.length)return;t.forEach((e=>this._configureRelatedInfo(e,s)));const l=await E({relatedInfos:i,layer:s},r);Object.keys(l).forEach((e=>{var t;const r=i.get(e.toString()),o=null==(t=l[e])?void 0:t.value;r&&o&&(r.layerInfo=o.data)}));const p=await R({graphic:e,relatedInfos:i,layer:s},r);Object.keys(p).forEach((e=>{var t;O(null==(t=p[e])?void 0:t.value,i.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:r}=this,i=S(e.fieldName);if(!i)return;const{layerId:o,fieldName:s}=i;if(!o)return;const a=r.get(o.toString())||k(o,t);a&&(U({relatedInfo:a,fieldName:s,fieldInfo:e}),this.relatedInfos.set(o,a))}};G.interceptor=new r(I,A),e([u()],G.prototype,"_error",void 0),e([u()],G.prototype,"_featureAbortController",void 0),e([u({readOnly:!0})],G.prototype,"_effectivePopupTemplate",null),e([u({readOnly:!0})],G.prototype,"_fieldInfoMap",null),e([u({readOnly:!0})],G.prototype,"_sourceLayer",null),e([u()],G.prototype,"abilities",void 0),e([f("abilities")],G.prototype,"castAbilities",null),e([u({readOnly:!0})],G.prototype,"content",void 0),e([u({readOnly:!0})],G.prototype,"contentViewModels",void 0),e([u({type:Boolean})],G.prototype,"defaultPopupTemplateEnabled",void 0),e([u({readOnly:!0})],G.prototype,"state",null),e([u({readOnly:!0})],G.prototype,"formattedAttributes",void 0),e([u({type:t,value:null})],G.prototype,"graphic",null),e([u({readOnly:!0})],G.prototype,"lastEditInfo",void 0),e([u()],G.prototype,"relatedInfos",void 0),e([u()],G.prototype,"spatialReference",null),e([u({readOnly:!0})],G.prototype,"title",void 0),e([u()],G.prototype,"map",null),e([u({readOnly:!0})],G.prototype,"waitingForContent",null),e([u()],G.prototype,"view",void 0),G=N=e([h(D)],G);const H=G;export{H as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as r}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import i from"../../core/Accessor.js";import o from"../../core/Handles.js";import s from"../../core/Logger.js";import{isSome as a}from"../../core/maybe.js";import{isAbortError as n,eachAlways as l}from"../../core/promiseUtils.js";import{throttle as p}from"../../core/throttle.js";import{init as c}from"../../core/watchUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as u}from"../../core/accessorSupport/decorators/cast.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../popup/content/TextContent.js";import m from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import _ from"./FeatureContent/FeatureContentViewModel.js";import y from"./FeatureFields/FeatureFieldsViewModel.js";import g from"./FeatureMedia/FeatureMediaViewModel.js";import{createCompiledExpressions as b}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as v,preRequestCallback as I,createfieldInfoMap as A,getAllFieldInfos as w,getSourceLayer as M,substituteFieldsInLinksAndAttributes as C,isExpressionField as T,isRelatedField as x,formatEditInfo as F,graphicCallback as j,queryUpdatedFeature as V,formatAttributes as P}from"./support/featureUtils.js";import{queryLayerInfos as L,queryRelatedFeatures as E,setRelatedFeatures as R,getRelatedFieldInfo as O,createRelatedInfo as S,updateRelatedInfo as k}from"./support/relatedFeatureUtils.js";var U;const N=1,q="esri.widgets.FeatureViewModel",D=s.getLogger(q),Q={attachmentsContent:!0,customContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0};let B=U=class extends i{constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this.graphicChangedThrottled=p(this.graphicChanged,N,this),this._expressionAttributes=null,this.abilities={...Q},this.content=null,this.contentViewModels=[],this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&t.attachmentsContent||"custom"===e.type&&t.customContent||"fields"===e.type&&t.fieldsContent||"media"===e.type&&t.mediaContent||"text"===e.type&&t.textContent},this._handles.add(c(this,["graphic","_effectivePopupTemplate","abilities"],(()=>this.graphicChangedThrottled())))}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this._handles=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return a(this.graphic)?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return A(w(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return M(this.graphic)}castAbilities(e){return{...Q,...e}}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.get("view.spatialReference")||null}set spatialReference(e){void 0!==e?this._override("spatialReference",e):this._clearOverride("spatialReference")}get map(){return this.get("view.map")||null}set map(e){void 0!==e?this._override("map",e):this._clearOverride("map")}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const r=this.contentViewModels[e];r instanceof g&&r.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.previous()}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(r){n(r)||(this._error=r,D.error("error","The popupTemplate could not be displayed for this feature.",{error:r,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):void 0)):"string"==typeof e?this._compileText(new h({text:e}),0).text:e}_destroyContentViewModels(){this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_compileAttachments(e,t){const{graphic:r}=this,{description:i,title:o}=e;return this.contentViewModels[t]=new m({graphic:r,...this._compileTitleAndDesc({title:o,description:i})}),e}_compileCustom(e,t){const{graphic:r}=this,{creator:i,destroyer:o}=e;return this.contentViewModels[t]=new _({graphic:r,creator:i,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:r,_sourceLayer:i,graphic:o,formattedAttributes:s,_expressionAttributes:a}=this,{attributes:n}=o,l=s.global;return{title:C({attributes:n,fieldInfoMap:r,globalAttributes:l,expressionAttributes:a,layer:i,text:e}),description:C({attributes:n,fieldInfoMap:r,globalAttributes:l,expressionAttributes:a,layer:i,text:t})}}_compileFields(e,t){const{_effectivePopupTemplate:r,formattedAttributes:i}=this,o=e.clone(),s={...i.global,...i.content[t]},a=(null==e?void 0:e.fieldInfos)||(null==r?void 0:r.fieldInfos),n=null==a?void 0:a.filter((({fieldName:e})=>T(e)||x(e)||s.hasOwnProperty(e))),l=null==r?void 0:r.expressionInfos,{description:p,title:c}=o,d=new y({attributes:s,expressionInfos:l,fieldInfos:n,...this._compileTitleAndDesc({title:c,description:p})});return this.contentViewModels[t]=d,o.fieldInfos=d.formattedFieldInfos.slice(0),o}_compileMedia(e,t){const{graphic:r,_fieldInfoMap:i,_effectivePopupTemplate:o,relatedInfos:s,_sourceLayer:a,_expressionAttributes:n}=this,{attributes:l}=r,p=this.formattedAttributes.global,c=e.clone(),{description:d,mediaInfos:u,title:f}=c,h=new g({activeMediaInfoIndex:c.activeMediaInfoIndex||0,attributes:l,layer:a,fieldInfoMap:i,formattedAttributes:p,expressionAttributes:n,mediaInfos:u,popupTemplate:o,relatedInfos:s,...this._compileTitleAndDesc({title:f,description:d})});return c.mediaInfos=h.formattedMediaInfos.slice(0),this.contentViewModels[t]=h,c}_compileText(e,t){const r=e.clone(),{graphic:i,_fieldInfoMap:o,_sourceLayer:s,_expressionAttributes:a}=this;if(r&&r.text){const{attributes:e}=i,t=this.formattedAttributes.global;r.text=C({attributes:e,fieldInfoMap:o,globalAttributes:t,expressionAttributes:a,layer:s,text:r.text})}return this.contentViewModels[t]=new _({graphic:i,creator:r.text}),r}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:r}=this;if(!e)return;const{lastEditInfoEnabled:i}=e,o=null==t?void 0:t.editFieldsInfo;return i&&o?F(o,r.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:r,graphic:i,_expressionAttributes:o}=this,{attributes:s}=i,a=this.formattedAttributes.global;return C({attributes:s,fieldInfoMap:t,globalAttributes:a,expressionAttributes:o,layer:r,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.title;return j(r,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.content;return j(r,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:r,graphic:i,_effectivePopupTemplate:o,spatialReference:s,map:a,view:n}=this,{content:{value:p},title:{value:c}}=await l({content:this._getContent(),title:this._getTitle()});if(t!==this._featureAbortController||!i)return;await V({graphic:i,popupTemplate:o,layer:r,spatialReference:s},e);const{expressionAttributes:{value:d}}=await l({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:b({popupTemplate:this._effectivePopupTemplate,spatialReference:s,graphic:i,map:a,interceptor:U.interceptor,view:n})});t===this._featureAbortController&&i&&(this._expressionAttributes=d,this._set("formattedAttributes",this._createFormattedAttributes(p,d)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(p)||null))}_createFormattedAttributes(e,t){const{_effectivePopupTemplate:r,graphic:i,relatedInfos:o,_sourceLayer:s,_fieldInfoMap:a}=this,n=null==r?void 0:r.fieldInfos,l={...i.attributes,...t},p={global:P({fieldInfos:n,graphic:i,attributes:l,layer:s,fieldInfoMap:a,relatedInfos:o}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&e.fieldInfos&&(p.content[t]=P({fieldInfos:e.fieldInfos,graphic:i,attributes:l,layer:s,fieldInfoMap:a,relatedInfos:o}))})),p}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:r}=this;return this._queryRelatedInfos(t,w(r),e)}async _queryRelatedInfos(e,t,r){const{relatedInfos:i,_sourceLayer:o}=this;i.clear();const s=a(o.associatedLayer)?await o.associatedLayer.load(r):o;if(!s)return;const n=t.filter((e=>e&&x(e.fieldName)));if(!n||!n.length)return;t.forEach((e=>this._configureRelatedInfo(e,s)));const l=await L({relatedInfos:i,layer:s},r);Object.keys(l).forEach((e=>{var t;const r=i.get(e.toString()),o=null==(t=l[e])?void 0:t.value;r&&o&&(r.layerInfo=o.data)}));const p=await E({graphic:e,relatedInfos:i,layer:s},r);Object.keys(p).forEach((e=>{var t;R(null==(t=p[e])?void 0:t.value,i.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:r}=this,i=O(e.fieldName);if(!i)return;const{layerId:o,fieldName:s}=i;if(!o)return;const a=r.get(o.toString())||S(o,t);a&&(k({relatedInfo:a,fieldName:s,fieldInfo:e}),this.relatedInfos.set(o,a))}};B.interceptor=new r(v,I),e([d()],B.prototype,"_error",void 0),e([d()],B.prototype,"_featureAbortController",void 0),e([d({readOnly:!0})],B.prototype,"_effectivePopupTemplate",null),e([d({readOnly:!0})],B.prototype,"_fieldInfoMap",null),e([d({readOnly:!0})],B.prototype,"_sourceLayer",null),e([d()],B.prototype,"abilities",void 0),e([u("abilities")],B.prototype,"castAbilities",null),e([d({readOnly:!0})],B.prototype,"content",void 0),e([d({readOnly:!0})],B.prototype,"contentViewModels",void 0),e([d({type:Boolean})],B.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],B.prototype,"state",null),e([d({readOnly:!0})],B.prototype,"formattedAttributes",void 0),e([d({type:t,value:null})],B.prototype,"graphic",null),e([d({readOnly:!0})],B.prototype,"lastEditInfo",void 0),e([d()],B.prototype,"relatedInfos",void 0),e([d()],B.prototype,"spatialReference",null),e([d({readOnly:!0})],B.prototype,"title",void 0),e([d()],B.prototype,"map",null),e([d({readOnly:!0})],B.prototype,"waitingForContent",null),e([d()],B.prototype,"view",void 0),B=U=e([f(q)],B);const G=B;export{G as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../Viewpoint.js";import e from"../../core/Error.js";import i from"../../core/Evented.js";import{createAbortController as s}from"../../core/promiseUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{GoToMixin as l}from"../support/GoTo.js";let p=class extends(l(i.EventedAccessor)){constructor(o){super(o),this._initialViewpoint=null,this._goingHomeController=null,this.go=this.go.bind(this)}destroy(){this._cancelGo(),this.view=null}get state(){return this.get("view.ready")?this._goingHomeController?"going-home":"ready":"disabled"}set view(o){this._initialViewpoint=null,this._set("view",o),o&&o.when().then((()=>{this.view===o&&(this._initialViewpoint=o.viewpoint.clone(),this.notifyChange("viewpoint"))}))}get viewpoint(){return this._get("viewpoint")||this._initialViewpoint}set viewpoint(o){this._set("viewpoint",o)}async go(){if(!this.get("view.ready"))throw new e("home:disabled-state","Cannot go when disabled.");this._cancelGo(),this.emit("go");const o=s();this._goingHomeController=o;try{await this.view.when(),await this.callGoTo({target:this.viewpoint,options:{signal:o.signal}})}catch(t){}this._goingHomeController=null}cancelGo(){this._cancelGo()}_cancelGo(){const{_goingHomeController:o}=this;o&&o.abort(),this._goingHomeController=null}};o([r()],p.prototype,"_goingHomeController",void 0),o([r({readOnly:!0})],p.prototype,"state",null),o([r()],p.prototype,"view",null),o([r({type:t})],p.prototype,"viewpoint",null),o([r()],p.prototype,"go",null),o([r()],p.prototype,"cancelGo",null),p=o([n("esri.widgets.Home.HomeViewModel")],p);const a=p;export{a as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../Viewpoint.js";import e from"../../core/Error.js";import i from"../../core/Evented.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{GoToMixin as n}from"../support/GoTo.js";let l=class extends(n(i.EventedAccessor)){constructor(o){super(o),this._initialViewpoint=null,this._goingHomeController=null,this.go=this.go.bind(this)}destroy(){this._cancelGo(),this.view=null}get state(){return this.get("view.ready")?this._goingHomeController?"going-home":"ready":"disabled"}set view(o){this._initialViewpoint=null,this._set("view",o),o&&o.when().then((()=>{this.view===o&&(this._initialViewpoint=o.viewpoint.clone(),this.notifyChange("viewpoint"))}))}get viewpoint(){return this._get("viewpoint")||this._initialViewpoint}set viewpoint(o){this._set("viewpoint",o)}async go(){if(!this.get("view.ready"))throw new e("home:disabled-state","Cannot go when disabled.");this._cancelGo(),this.emit("go");const o=new AbortController;this._goingHomeController=o;try{await this.view.when(),await this.callGoTo({target:this.viewpoint,options:{signal:o.signal}})}catch(t){}this._goingHomeController=null}cancelGo(){this._cancelGo()}_cancelGo(){const{_goingHomeController:o}=this;o&&o.abort(),this._goingHomeController=null}};o([r()],l.prototype,"_goingHomeController",void 0),o([r({readOnly:!0})],l.prototype,"state",null),o([r()],l.prototype,"view",null),o([r({type:t})],l.prototype,"viewpoint",null),o([r()],l.prototype,"go",null),o([r()],l.prototype,"cancelGo",null),l=o([s("esri.widgets.Home.HomeViewModel")],l);const p=l;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import e from"../../PopupTemplate.js";import o from"../../core/Error.js";import a from"../../core/Handles.js";import{createAbortController as i}from"../../core/promiseUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{removeSelectedFeature as s}from"../Popup/actions.js";import c from"../support/GeolocationPositioning.js";import{getCurrentPosition as p}from"../support/geolocationUtils.js";import{onLocaleChange as n}from"../../intl/locale.js";import{fetchMessageBundle as d}from"../../intl/messages.js";async function h(){const t=await d("esri/widgets/Locate/t9n/Locate");return new e({title:t.currentLocation,fieldInfos:[{fieldName:"timestamp",label:t.timestamp,format:{dateFormat:"short-date-short-time"}},{fieldName:"latitude",label:t.latitude,format:{places:4,digitSeparator:!0}},{fieldName:"longitude",label:t.longitude,format:{places:4,digitSeparator:!0}},{fieldName:"accuracy",label:t.accuracy,format:{places:0,digitSeparator:!0}},{fieldName:"altitude",label:t.altitude,format:{places:0,digitSeparator:!0}},{fieldName:"altitudeAccuracy",label:t.altitudeAccuracy,format:{places:0,digitSeparator:!0}},{fieldName:"heading",label:t.heading,format:{places:0,digitSeparator:!0}},{fieldName:"speed",label:t.speed,format:{places:0,digitSeparator:!0}}],actions:[s.clone()],content:[{type:"fields"}]})}let u=class extends c{constructor(t){super(t),this._locateController=null,this._handles=new a,this.popupEnabled=!0,this.locate=this.locate.bind(this)}initialize(){this._handles.add([n((()=>{var t;const{graphic:e,view:o}=this;(null==o||null==(t=o.graphics)?void 0:t.includes(e))&&this._updatePopupTemplate(e)}))])}destroy(){this.cancelLocate(),this._handles.destroy(),this._handles=null}get state(){return this._geolocationUsable?this.get("view.ready")?this._locateController?"locating":"ready":"disabled":"feature-unsupported"}async locate(){if(this.cancelLocate(),"disabled"===this.state)throw new o("locate:disabled-state","Cannot locate when disabled.");if("feature-unsupported"===this.state)throw new o("locate:feature-unsupported-state","Cannot locate in unsecure domain.");const t=i();this._locateController=t;try{let e=await p(this.geolocationOptions);return e=await this._setPosition(e,{signal:t.signal}),this._locateController!==t?null:(this.graphic&&(this.graphic=this.graphic.clone(),await this._updatePopupTemplate(this.graphic),this.view.graphics.push(this.graphic)),this.emit("locate",{position:e}),this._locateController=null,e)}catch(e){throw this._locateController=null,this.emit("locate-error",{error:e}),e}}cancelLocate(){this._clear(),this._locateController&&this._locateController.abort(),this._locateController=null}async _updatePopupTemplate(t){if(!this.popupEnabled)return;const e=await h(),o=t!==this.graphic;this.destroyed||o||(t.popupTemplate=e)}};t([r()],u.prototype,"_locateController",void 0),t([r()],u.prototype,"popupEnabled",void 0),t([r({readOnly:!0})],u.prototype,"state",null),t([r()],u.prototype,"locate",null),t([r()],u.prototype,"cancelLocate",null),u=t([l("esri.widgets.Locate.LocateViewModel")],u);const m=u;export{m as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import e from"../../PopupTemplate.js";import o from"../../core/Error.js";import a from"../../core/Handles.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{removeSelectedFeature as l}from"../Popup/actions.js";import s from"../support/GeolocationPositioning.js";import{getCurrentPosition as c}from"../support/geolocationUtils.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as n}from"../../intl/messages.js";async function d(){const t=await n("esri/widgets/Locate/t9n/Locate");return new e({title:t.currentLocation,fieldInfos:[{fieldName:"timestamp",label:t.timestamp,format:{dateFormat:"short-date-short-time"}},{fieldName:"latitude",label:t.latitude,format:{places:4,digitSeparator:!0}},{fieldName:"longitude",label:t.longitude,format:{places:4,digitSeparator:!0}},{fieldName:"accuracy",label:t.accuracy,format:{places:0,digitSeparator:!0}},{fieldName:"altitude",label:t.altitude,format:{places:0,digitSeparator:!0}},{fieldName:"altitudeAccuracy",label:t.altitudeAccuracy,format:{places:0,digitSeparator:!0}},{fieldName:"heading",label:t.heading,format:{places:0,digitSeparator:!0}},{fieldName:"speed",label:t.speed,format:{places:0,digitSeparator:!0}}],actions:[l.clone()],content:[{type:"fields"}]})}let h=class extends s{constructor(t){super(t),this._locateController=null,this._handles=new a,this.popupEnabled=!0,this.locate=this.locate.bind(this)}initialize(){this._handles.add([p((()=>{var t;const{graphic:e,view:o}=this;(null==o||null==(t=o.graphics)?void 0:t.includes(e))&&this._updatePopupTemplate(e)}))])}destroy(){this.cancelLocate(),this._handles.destroy(),this._handles=null}get state(){return this._geolocationUsable?this.get("view.ready")?this._locateController?"locating":"ready":"disabled":"feature-unsupported"}async locate(){if(this.cancelLocate(),"disabled"===this.state)throw new o("locate:disabled-state","Cannot locate when disabled.");if("feature-unsupported"===this.state)throw new o("locate:feature-unsupported-state","Cannot locate in unsecure domain.");const t=new AbortController;this._locateController=t;try{let e=await c(this.geolocationOptions);return e=await this._setPosition(e,{signal:t.signal}),this._locateController!==t?null:(this.graphic&&(this.graphic=this.graphic.clone(),await this._updatePopupTemplate(this.graphic),this.view.graphics.push(this.graphic)),this.emit("locate",{position:e}),this._locateController=null,e)}catch(e){throw this._locateController=null,this.emit("locate-error",{error:e}),e}}cancelLocate(){this._clear(),this._locateController&&this._locateController.abort(),this._locateController=null}async _updatePopupTemplate(t){if(!this.popupEnabled)return;const e=await d(),o=t!==this.graphic;this.destroyed||o||(t.popupTemplate=e)}};t([r()],h.prototype,"_locateController",void 0),t([r()],h.prototype,"popupEnabled",void 0),t([r({readOnly:!0})],h.prototype,"state",null),t([r()],h.prototype,"locate",null),t([r()],h.prototype,"cancelLocate",null),h=t([i("esri.widgets.Locate.LocateViewModel")],h);const u=h;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import o from"../../core/Handles.js";import r from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{createAbortController as l}from"../../core/promiseUtils.js";import{init as u,watch as h,whenFalse as c}from"../../core/watchUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as g}from"../../geometry/support/webMercatorUtils.js";import f from"../../layers/Layer.js";import m from"../../support/actions/ActionBase.js";import y from"../../support/actions/ActionButton.js";import w from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as F}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as v}from"../../views/input/InputManager.js";import{highlightsSupported as _}from"../../views/support/layerViewUtils.js";import b from"../Feature/FeatureViewModel.js";import{zoomToClusteredFeatures as C,browseClusteredFeatures as P,zoomToFeature as E}from"./actions.js";import{triggerAction as j,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as V,displayClusterExtent as M,browseAggregateFeatures as x}from"./actionUtils.js";import O from"../support/AnchorElementViewModel.js";import{GoToMixin as I}from"../support/GoTo.js";import L from"../../symbols/SimpleFillSymbol.js";import T from"../../geometry/Point.js";const S=s.ofType({key:"type",defaultKeyValue:"button",base:m,typeMap:{button:y,toggle:w}}),B=()=>[E.clone()],R=()=>[C.clone(),P.clone()],G="esri.widgets.Popup.PopupViewModel",z=r.getLogger(G);let U=class extends(I(O)){constructor(e){super(e),this._handles=new o,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new S,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new L({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}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([u(this,["autoOpenEnabled","view"],(()=>this._autoOpenEnabledChange())),this.on("view-change",(()=>this._autoClose())),h(this,["highlightEnabled","selectedFeature","visible","view"],(()=>this._highlightFeature())),h(this,"view.animation.state",(e=>this._animationStateChange(e))),h(this,"location",(e=>this._locationChange(e))),h(this,"selectedFeature",(e=>this._selectedFeatureChange(e))),h(this,["selectedFeatureIndex","featureCount","featuresPerPage"],(()=>this._selectedFeatureIndexChange())),h(this,["featurePage","selectedFeatureIndex","featureCount","featuresPerPage, featureViewModels"],(()=>this._setGraphicOnFeatureViewModels())),h(this,"featureViewModels",(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>j({event:e,view:this.view}))),c(this,"waitingForResult",(()=>this._waitingForResultChange()),!0),h(this,["features","view","view.map","view.spatialReference"],(()=>this._updateFeatureVMs())),h(this,["view.scale"],this._viewScaleChange),c(this,"visible",(()=>this.browseClusterEnabled=!1)),h(this,"browseClusterEnabled",(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new S;e.removeAll();const{actions:t,defaultActions:s,defaultPopupTemplateEnabled:i,includeDefaultActions:o,selectedFeature:r}=this,n=o?s.concat(t):t,a=r&&("function"==typeof r.getEffectivePopupTemplate&&r.getEffectivePopupTemplate(i)||r.popupTemplate),l=a&&a.actions,u=a&&a.overwriteActions?l:l?l.concat(n):n;return u&&u.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){var e;const t=this._get("defaultActions")||new S;return t.removeAll(),t.addMany(null!=(e=this.selectedFeature)&&e.isAggregate?R():B()),t}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:s,promiseCount:i,selectedFeatureIndex:o}=this,r=i&&t.length;r&&s&&-1===o?this.selectedFeatureIndex=0:r&&-1!==o||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=g(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},s=()=>this._updatePendingPromises(e);e.then(t,s)})),this.notifyChange("pendingPromisesCount")}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;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);if(!t){const s=new i("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e});return z.error(s),Promise.reject(s)}return this.callGoTo({target:{target:t,scale:e.scale}})}clear(){this.set({promises:[],features:[],content:null,title:null,location:null})}fetchFeatures(e,t){const{view:s}=this;if(!s||!e){const t=new i("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:s});return z.error(t),Promise.reject(t)}return s.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:s}=t;delete t.fetchFeatures,s&&this._setFetchFeaturesPromises(t.location),this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){V(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){await M(this),await x(this)}_animationStateChange(e){this.zoomToLocation||(E.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){var e;const t=null==(e=this.view)?void 0:e.graphics;t&&(t.remove(this.selectedClusterBoundaryFeature),t.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){var e;(null!=(e=this.selectedFeature)&&e.isAggregate||this.browseClusterEnabled)&&(this.browseClusterEnabled=!1,this.visible=!1)}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:s}=this;s&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:s,featuresPerPage:i,featureViewModels:o}=this;if(null===s)return;const r=((s-1)*i+t)%t,n=r+i;o.slice(r,n).forEach(((t,s)=>{t&&!t.graphic&&(t.graphic=e[r+s])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:s,view:i}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(i.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),e.isAggregate)return;return e.symbol=await F(e),this._selectedClusterFeature=e,void i.graphics.add(this._selectedClusterFeature)}!s&&t||!e.geometry?s&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=i.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:s}=e,i=Promise.resolve(t),o=s.map((e=>e.promise));this.promises=[i,...o]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:s}=this;if(null!=e&&e.isAggregate||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const i=s.slice(0),o=[];t.forEach(((t,s)=>{if(!t)return;let r=null;if(i.some(((e,s)=>(e&&e.graphic===t&&(r=e,i.splice(s,1)),!!r))),r)o[s]=r;else{var n,a;const i=new b({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:null==(n=this.view)?void 0:n.spatialReference,graphic:t===e?t:null,map:null==(a=this.view)?void 0:a.map,view:this.view});o[s]=i}})),i.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",o)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:s}=this;if(t.remove(e),s&&this.view){const s=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),v.WIDGET);t.add(s,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const s=l(),{signal:i}=s;this._fetchFeaturesController=s,this.notifyChange("waitingForResult");const o=this.fetchFeatures(e,{signal:i,event:t});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),o}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:s}=e,{view:i}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:o,location:r}=e,n=[Promise.resolve(t),...o.map((e=>e.promise))];return i.popup.open({location:r||s,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}async _highlightFeature(){const e="highlight";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:s,view:i,visible:o}=this;if(!(t&&i&&s&&o))return;let{layer:r,sourceLayer:n}=t;if("map-notes"!==(null==n?void 0:n.type)&&"subtype-group"!==(null==n?void 0:n.type)||(r=n),!(r&&r instanceof f))return;const a=this._getLayerView(i,r);this._highlightPromise=a;const l=await a;if(!(l&&_(l)&&this._highlightPromise===a&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const u="objectIdField"in r&&r.objectIdField,h=t.attributes,c=h&&u&&h[u],p=l.highlight(c||t);this._handles.add(p,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const s=e.filter((e=>-1===t.indexOf(e)));this.features=t.concat(s)}};e([p()],U.prototype,"featurePage",void 0),e([p()],U.prototype,"isLoadingFeature",null),e([p({type:S})],U.prototype,"actions",void 0),e([p({readOnly:!0})],U.prototype,"active",null),e([p({readOnly:!0})],U.prototype,"allActions",null),e([p({type:Boolean})],U.prototype,"defaultPopupTemplateEnabled",void 0),e([p()],U.prototype,"autoCloseEnabled",void 0),e([p()],U.prototype,"autoOpenEnabled",void 0),e([p()],U.prototype,"browseClusterEnabled",void 0),e([p()],U.prototype,"content",void 0),e([p({type:S,readOnly:!0})],U.prototype,"defaultActions",null),e([p({readOnly:!0})],U.prototype,"featureCount",null),e([p()],U.prototype,"features",null),e([p()],U.prototype,"featuresPerPage",void 0),e([p()],U.prototype,"featureViewModelAbilities",void 0),e([p({readOnly:!0})],U.prototype,"featureViewModels",void 0),e([p()],U.prototype,"highlightEnabled",void 0),e([p()],U.prototype,"includeDefaultActions",void 0),e([p({type:T})],U.prototype,"location",null),e([p({readOnly:!0})],U.prototype,"pendingPromisesCount",null),e([p({readOnly:!0})],U.prototype,"selectedClusterBoundaryFeature",void 0),e([p({readOnly:!0})],U.prototype,"waitingForResult",null),e([p({readOnly:!0})],U.prototype,"promiseCount",null),e([p()],U.prototype,"promises",null),e([p({value:null,readOnly:!0})],U.prototype,"selectedFeature",null),e([p({value:-1})],U.prototype,"selectedFeatureIndex",null),e([p({readOnly:!0})],U.prototype,"selectedFeatureViewModel",null),e([p({readOnly:!0})],U.prototype,"state",null),e([p()],U.prototype,"title",void 0),e([p()],U.prototype,"updateLocationEnabled",void 0),e([p()],U.prototype,"view",void 0),e([p()],U.prototype,"visible",void 0),e([p()],U.prototype,"zoomFactor",void 0),e([p()],U.prototype,"zoomToLocation",void 0),e([p()],U.prototype,"centerAtLocation",null),U=e([d(G)],U);const W=U;export{W as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import o from"../../core/Handles.js";import r from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{init as l,watch as u,whenFalse as h}from"../../core/watchUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as d}from"../../geometry/support/webMercatorUtils.js";import g from"../../layers/Layer.js";import f from"../../support/actions/ActionBase.js";import m from"../../support/actions/ActionButton.js";import y from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as F}from"../../views/input/InputManager.js";import{highlightsSupported as v}from"../../views/support/layerViewUtils.js";import _ from"../Feature/FeatureViewModel.js";import{zoomToClusteredFeatures as b,browseClusteredFeatures as C,zoomToFeature as P}from"./actions.js";import{triggerAction as E,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as j,displayClusterExtent as V,browseAggregateFeatures as M}from"./actionUtils.js";import x from"../support/AnchorElementViewModel.js";import{GoToMixin as O}from"../support/GoTo.js";import I from"../../symbols/SimpleFillSymbol.js";import L from"../../geometry/Point.js";const T=s.ofType({key:"type",defaultKeyValue:"button",base:f,typeMap:{button:m,toggle:y}}),S=()=>[P.clone()],B=()=>[b.clone(),C.clone()],R="esri.widgets.Popup.PopupViewModel",G=r.getLogger(R);let z=class extends(O(x)){constructor(e){super(e),this._handles=new o,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new T,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new I({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}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([l(this,["autoOpenEnabled","view"],(()=>this._autoOpenEnabledChange())),this.on("view-change",(()=>this._autoClose())),u(this,["highlightEnabled","selectedFeature","visible","view"],(()=>this._highlightFeature())),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","featureCount","featuresPerPage"],(()=>this._selectedFeatureIndexChange())),u(this,["featurePage","selectedFeatureIndex","featureCount","featuresPerPage, featureViewModels"],(()=>this._setGraphicOnFeatureViewModels())),u(this,"featureViewModels",(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>E({event:e,view:this.view}))),h(this,"waitingForResult",(()=>this._waitingForResultChange()),!0),u(this,["features","view","view.map","view.spatialReference"],(()=>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._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new T;e.removeAll();const{actions:t,defaultActions:s,defaultPopupTemplateEnabled:i,includeDefaultActions:o,selectedFeature:r}=this,n=o?s.concat(t):t,a=r&&("function"==typeof r.getEffectivePopupTemplate&&r.getEffectivePopupTemplate(i)||r.popupTemplate),l=a&&a.actions,u=a&&a.overwriteActions?l:l?l.concat(n):n;return u&&u.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){var e;const t=this._get("defaultActions")||new T;return t.removeAll(),t.addMany(null!=(e=this.selectedFeature)&&e.isAggregate?B():S()),t}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:s,promiseCount:i,selectedFeatureIndex:o}=this,r=i&&t.length;r&&s&&-1===o?this.selectedFeatureIndex=0:r&&-1!==o||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=d(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},s=()=>this._updatePendingPromises(e);e.then(t,s)})),this.notifyChange("pendingPromisesCount")}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;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);if(!t){const s=new i("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e});return G.error(s),Promise.reject(s)}return this.callGoTo({target:{target:t,scale:e.scale}})}clear(){this.set({promises:[],features:[],content:null,title:null,location:null})}fetchFeatures(e,t){const{view:s}=this;if(!s||!e){const t=new i("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:s});return G.error(t),Promise.reject(t)}return s.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:s}=t;delete t.fetchFeatures,s&&this._setFetchFeaturesPromises(t.location),this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){j(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){await V(this),await M(this)}_animationStateChange(e){this.zoomToLocation||(P.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){var e;const t=null==(e=this.view)?void 0:e.graphics;t&&(t.remove(this.selectedClusterBoundaryFeature),t.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){var e;(null!=(e=this.selectedFeature)&&e.isAggregate||this.browseClusterEnabled)&&(this.browseClusterEnabled=!1,this.visible=!1)}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:s}=this;s&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:s,featuresPerPage:i,featureViewModels:o}=this;if(null===s)return;const r=((s-1)*i+t)%t,n=r+i;o.slice(r,n).forEach(((t,s)=>{t&&!t.graphic&&(t.graphic=e[r+s])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:s,view:i}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(i.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),e.isAggregate)return;return e.symbol=await w(e),this._selectedClusterFeature=e,void i.graphics.add(this._selectedClusterFeature)}!s&&t||!e.geometry?s&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=i.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:s}=e,i=Promise.resolve(t),o=s.map((e=>e.promise));this.promises=[i,...o]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:s}=this;if(null!=e&&e.isAggregate||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const i=s.slice(0),o=[];t.forEach(((t,s)=>{if(!t)return;let r=null;if(i.some(((e,s)=>(e&&e.graphic===t&&(r=e,i.splice(s,1)),!!r))),r)o[s]=r;else{var n,a;const i=new _({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:null==(n=this.view)?void 0:n.spatialReference,graphic:t===e?t:null,map:null==(a=this.view)?void 0:a.map,view:this.view});o[s]=i}})),i.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",o)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:s}=this;if(t.remove(e),s&&this.view){const s=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),F.WIDGET);t.add(s,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const s=new AbortController,{signal:i}=s;this._fetchFeaturesController=s,this.notifyChange("waitingForResult");const o=this.fetchFeatures(e,{signal:i,event:t});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),o}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:s}=e,{view:i}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:o,location:r}=e,n=[Promise.resolve(t),...o.map((e=>e.promise))];return i.popup.open({location:r||s,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}async _highlightFeature(){const e="highlight";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:s,view:i,visible:o}=this;if(!(t&&i&&s&&o))return;let{layer:r,sourceLayer:n}=t;if("map-notes"!==(null==n?void 0:n.type)&&"subtype-group"!==(null==n?void 0:n.type)||(r=n),!(r&&r instanceof g))return;const a=this._getLayerView(i,r);this._highlightPromise=a;const l=await a;if(!(l&&v(l)&&this._highlightPromise===a&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const u="objectIdField"in r&&r.objectIdField,h=t.attributes,c=h&&u&&h[u],p=l.highlight(c||t);this._handles.add(p,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const s=e.filter((e=>-1===t.indexOf(e)));this.features=t.concat(s)}};e([c()],z.prototype,"featurePage",void 0),e([c()],z.prototype,"isLoadingFeature",null),e([c({type:T})],z.prototype,"actions",void 0),e([c({readOnly:!0})],z.prototype,"active",null),e([c({readOnly:!0})],z.prototype,"allActions",null),e([c({type:Boolean})],z.prototype,"defaultPopupTemplateEnabled",void 0),e([c()],z.prototype,"autoCloseEnabled",void 0),e([c()],z.prototype,"autoOpenEnabled",void 0),e([c()],z.prototype,"browseClusterEnabled",void 0),e([c()],z.prototype,"content",void 0),e([c({type:T,readOnly:!0})],z.prototype,"defaultActions",null),e([c({readOnly:!0})],z.prototype,"featureCount",null),e([c()],z.prototype,"features",null),e([c()],z.prototype,"featuresPerPage",void 0),e([c()],z.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],z.prototype,"featureViewModels",void 0),e([c()],z.prototype,"highlightEnabled",void 0),e([c()],z.prototype,"includeDefaultActions",void 0),e([c({type:L})],z.prototype,"location",null),e([c({readOnly:!0})],z.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],z.prototype,"selectedClusterBoundaryFeature",void 0),e([c({readOnly:!0})],z.prototype,"waitingForResult",null),e([c({readOnly:!0})],z.prototype,"promiseCount",null),e([c()],z.prototype,"promises",null),e([c({value:null,readOnly:!0})],z.prototype,"selectedFeature",null),e([c({value:-1})],z.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],z.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],z.prototype,"state",null),e([c()],z.prototype,"title",void 0),e([c()],z.prototype,"updateLocationEnabled",void 0),e([c()],z.prototype,"view",void 0),e([c()],z.prototype,"visible",void 0),e([c()],z.prototype,"zoomFactor",void 0),e([c()],z.prototype,"zoomToLocation",void 0),e([c()],z.prototype,"centerAtLocation",null),z=e([p(R)],z);const U=z;export{U as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{getAssetUrl as t}from"../../assets.js";import s from"../../config.js";import r from"../../Graphic.js";import o from"../../PopupTemplate.js";import"../../symbols.js";import l from"../../core/Accessor.js";import i from"../../core/Collection.js";import{deprecatedProperty as a}from"../../core/deprecate.js";import n from"../../core/Error.js";import u from"../../core/Evented.js";import c from"../../core/Handles.js";import h from"../../core/has.js";import p from"../../core/Logger.js";import{unwrap as d,isSome as g}from"../../core/maybe.js";import{eachAlways as m,after as y,createAbortController as f}from"../../core/promiseUtils.js";import{on as S,init as v,whenFalseOnce as _,whenOnce as b}from"../../core/watchUtils.js";import{property as w}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as x}from"../../core/accessorSupport/decorators/subclass.js";import I from"../../geometry/Point.js";import j from"../../geometry/SpatialReference.js";import{onLocaleChange as P}from"../../intl/locale.js";import{fetchMessageBundle as T}from"../../intl/messages.js";import R from"../../portal/Portal.js";import{highlightsSupported as L}from"../../views/support/layerViewUtils.js";import E from"./LayerSearchSource.js";import C from"./LocatorSearchSource.js";import F from"./SearchSource.js";import{getPointFromGeometry as O,getPointWithElevation as G}from"./support/geometryUtils.js";import{isArcGISWorldGeocoder as A,meteredArcGISLocatorUrl as N,isProxiedArcGISWorldGeocoder as D,isMeteredArcGISWorldGeocoder as M}from"./support/locatorUtils.js";import{supported as V,getCurrentPosition as k,positionToPoint as B}from"../support/geolocationUtils.js";import{GoToMixin as J}from"../support/GoTo.js";import U from"../../symbols/PictureMarkerSymbol.js";import H from"../../symbols/SimpleLineSymbol.js";import Q from"../../symbols/SimpleFillSymbol.js";import Z from"../../symbols/TextSymbol.js";function q(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const z=()=>T("esri/widgets/Search/t9n/Search"),K="esri.widgets.Search.SearchViewModel",W=p.getLogger(K),X="highlight",Y=i.ofType({key:e=>e.layer?"layer":"locator",base:F,typeMap:{layer:E,locator:C}}),$=j.WGS84,ee="esri/images/search/search-symbol-32.svg",te="esri/images/search/search-symbol-32.png",se=/<(?:.|\s)*?>/g,re=-1;let oe=class extends(J(u.EventedMixin(l))){constructor(e){super(e),this._handles=new c,this._gotoController=null,this._searching=null,this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new Y,this.defaultSymbols={point:new U({url:t(h("trident")?te:ee),size:24,width:24,height:24}),polyline:new H({color:[130,130,130,1],width:2}),polygon:new Q({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=R.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new Y,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await z();this.messages=e,this.defaultPopupTemplate=new o({title:e.searchResult,content:"{Match_addr}"})};e(),this._handles.add([S(this,["defaultSources","sources"],"change",(()=>this.notifyChange("allSources"))),v(this,["includeDefaultSources","view","portal"],(()=>this._update())),P(e)])}destroy(){this._abortGoTo(),this.clearGraphics(),this._handles.destroy(),this._handles=null}get activeSource(){return this.allSources.getItemAt(this.activeSourceIndex)||null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:re}set activeSourceIndex(e){void 0!==e?this._override("activeSourceIndex",e):this._clearOverride("activeSourceIndex")}get allPlaceholder(){var e;return null==(e=this.messages)?void 0:e.allPlaceholder}set allPlaceholder(e){e?this._override("allPlaceholder",e):this._clearOverride("allPlaceholder")}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:s}=this,r="function"==typeof s?s.call(null,{sources:e,defaultSources:t}):s?t.concat(e):e,o=this._get("allSources")||new Y;return o.removeAll(),o.addMany(r.filter(Boolean)),o}get defaultSymbol(){return a(W,"defaultSymbol",{replacement:"defaultSymbols",version:"4.22"}),this._get("defaultSymbol")}set defaultSymbol(e){a(W,"defaultSymbol",{replacement:"defaultSymbols",version:"4.22"}),this._set("defaultSymbol",e)}get locationEnabled(){return this._get("locationEnabled")||V()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=V();if(e&&!t){const e=new n("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});W.error(e)}this._override("locationEnabled",e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:s}=this;if(t===re)return s;const r=e.getItemAt(t);return r?r.placeholder:""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup(),this.view&&this.view.graphics.remove(this.resultGraphic),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const s=this._createSuggestionForSearch(e),r=this.when().then((()=>this._getResultsFromSources(s,t).then((e=>{var r;if(null!=(r=d(null==t?void 0:t.signal))&&r.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:s.text,numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(o,e,s);const l=this._getFirstResult(o.results),i=(s.location&&l?l.name:s.text).replace(se,"");return this._set("searchTerm",i),(s.key&&"number"==typeof s.sourceIndex||s.location)&&this._set("selectedSuggestion",s),this._set("results",o.results),this._set("resultCount",o.results.reduce(((e,t)=>e+t.results.length),0)),this.emit("search-complete",o),this._selectFirstResult(l).then((()=>o))})))).then((e=>(this._clearSearching(),e)),(e=>{throw this._clearSearching(),e}));return this._searching=r,this.notifyChange("state"),r}searchNearby(e){if(!this.locationEnabled){const e=new n("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});return W.error(e),Promise.reject(e)}const t=k().then((t=>B({position:t,view:this.view},e))).then((t=>this.search(t,e)));return this._searching=t,this.notifyChange("state"),t.catch((()=>{})).then((()=>this._clearSearching())),t}select(e){if(this.clearGraphics(),!e){const t=new n("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});return W.error(t),Promise.reject(t)}const{view:t}=this,s=q(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=this.allSources.getItemAt(s);if(!o){const e=new n("select:missing-source","Cannot select without a source.",{source:o});return W.error(e),Promise.reject(e)}const l=o instanceof E?this._getLayerSourcePopupTemplate(o):o.popupTemplate,i=o.resultSymbol||this._getDefaultSymbol(e),a=q(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,u=q(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,c=q(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,h=c?l||this.popupTemplate||this.defaultPopupTemplate:null,{feature:p}=e;if(!p){const e=new n("select:missing-feature","Cannot select without a feature.",{feature:p});return W.error(e),Promise.reject(e)}const{attributes:d,geometry:y,layer:f,sourceLayer:S}=p,v=O(y),_={layerViewQuery:this._getLayerView(p),elevationQuery:t&&g(v)?G(v,t).catch((()=>v)):Promise.resolve(v)};return m(_).then((l=>{const n=l.layerViewQuery.value,m=l.elevationQuery.value;i instanceof Z&&(i.text=e.name);const v=t&&u?e.target||e.extent:null;return(g(v)?this._goToSearchResult(v):Promise.resolve()).then((()=>{var l;const u=n?p:new r({geometry:y,symbol:i,attributes:d,layer:f,sourceLayer:S,popupTemplate:h}),g=c&&(null==(l=this.view)?void 0:l.popup),v=g&&u.getEffectivePopupTemplate(g.defaultPopupTemplateEnabled);return v&&t.popup.open({features:[u],location:m}),n&&L(n)&&!v&&this._highlightFeature({graphic:u,layerView:n}),!n&&a&&t&&t.graphics.push(u),this._set("selectedResult",e),this._set("resultGraphic",u),this.emit("select-result",{result:e,source:o,sourceIndex:s}),e}))}))}suggest(e,t,s){const r=e||this.searchTerm;return this.emit("suggest-start",{searchTerm:r}),this._suggestTimer(t,s).then((()=>this._suggestImmediate(r,s).then((e=>(this._set("suggestions",e.results),this._set("suggestionCount",e.results.reduce(((e,t)=>e+t.results.length),0)),this.emit("suggest-complete",e),e)))))}async when(){await _(this,"updating")}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const s=this._updatingPromise=m([null==e?void 0:e.load(),null==t?void 0:t.when()]);if(this.destroyed)return;if(this.notifyChange("updating"),await s,s!==this._updatingPromise)return}this._updatingPromise=null,this.notifyChange("updating");const s=b(this,"messages");this.destroyed||(this._handles.add(s),await s,this._updateDefaultSources())}_clearSearching(){this._searching=null,this.notifyChange("state")}_convertHelperServices(){var e,t;const r=null==(e=this.portal)||null==(t=e.helperServices)?void 0:t.geocode;if(!r)return[];return r.map((e=>{if(!1===e.placefinding)return;const t=s.apiKey&&A(e.url)?{url:N}:null,r=C.fromJSON({...e,...t}),o=r.url;if(A(o)||D(o)||M(o)){const e=r.outFields||["Addr_type","Match_addr","StAddr","City"],t=r.placeholder||this.messages.placeholder,s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.set({singleLineFieldName:"SingleLine",outFields:e,placeholder:t,defaultZoomScale:s})}return r.singleLineFieldName?r:void 0})).filter(Boolean)}_getLayerSources(e,t){var s;const r=null==(s=this.view)?void 0:s.map;return e.map((e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),l=E.fromJSON(o);return l.placeholder=t,this._getLayer(s,o).then((e=>{l.layer=e})),l})).filter(Boolean).toArray()}_getTableSources(e,t){var s;const r=null==(s=this.view)?void 0:s.map;return e.map((e=>{const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),l=E.fromJSON(o);return l.placeholder=t,this._getLayer(s,o).then((e=>{l.layer=e})),l})).filter(Boolean).toArray()}_convertApplicationProperties(){var e,t,s;const r=null==(e=this.view)?void 0:e.map,o=null==r||null==(t=r.applicationProperties)||null==(s=t.viewing)?void 0:s.search;if(!o)return[];const{enabled:l,hintText:i,layers:a,tables:n}=o;if(!l)return[];return[...this._getLayerSources(a,i),...this._getTableSources(n,i)]}_getSubLayer(e,t){return e.load().then((()=>{if(!e.allSublayers)return Promise.reject();const s=e.allSublayers.find((e=>e.id===t.subLayer));return s?s.createFeatureLayer():Promise.reject()}))}async _getBuildingSubLayer(e,t){await e.load();const s=e.allSublayers.find((e=>e.id===t.subLayer));return"building-component"!==(null==s?void 0:s.type)?Promise.reject():(await s.load(),null==s.associatedLayer?Promise.reject():(await s.associatedLayer.load(),s))}_getLayer(e,t){return"feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type?Promise.resolve(e):"map-image"===e.type?this._getSubLayer(e,t).catch((()=>{const t=new n("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return W.error(t),null})):"building-scene"===e.type?this._getBuildingSubLayer(e,t):Promise.resolve(null)}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()]),this.notifyChange("allSources")}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){var e;const t=null==(e=this.view)?void 0:e.popup,{resultGraphic:s}=this;if(!t||!s)return;const{selectedFeature:r}=t;r&&r===s&&t.close()}_suggestTimer(e,t){const s=null!=e?e:this.suggestionDelay;return y(s,null,t&&t.signal)}_createLocationForSearch(e){return e instanceof r?O(e.geometry):e instanceof I?e:Array.isArray(e)&&2===e.length?new I({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&q(e,"key")&&q(e,"text")&&q(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),s="string"==typeof e?e:this.searchTerm,{selectedSuggestion:r,selectedResult:o}=this,l=!e&&r&&o,i=l&&r.key===o.key&&r.sourceIndex===o.sourceIndex,a=l&&r.location;return i||a?r:{location:d(t),text:t?"":s,sourceIndex:null,key:null}}_getFirstResult(e){let t=null;return e&&e.some((e=>{const{results:s}=e,r=s[0],o=!!r;return o&&(t=r),o})),t}_selectFirstResult(e){return this.autoSelect&&e?this.select(e):Promise.resolve(null)}_suggestImmediate(e,t){return this.when().then((()=>this._getSuggestionsFromSources(e,t))).then((s=>{var r;if(null!=(r=d(null==t?void 0:t.signal))&&r.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:e,numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(o,s),o}))}_formatSourceResponse(e,t,s){const r=t&&t.value||[],o=t&&t.error,l=this.allSources.getItemAt(s);if(o){const t={sourceIndex:s,source:l,error:o};e.errors.push(t),W.error(o),e.numErrors++}else{const t={sourceIndex:s,source:l,results:r};e.results.push(t),e.numResults+=r.length}}_formatResponse(e,t,s){if(t)if(e.activeSourceIndex===re){const r=s&&q(s,"sourceIndex")&&-1!==s.sourceIndex?s.sourceIndex:void 0;t.forEach(((t,s)=>{const o=void 0!==r?r:s;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}_getResultsFromSources(e,t){const{allSources:s}=this,r=!e.location&&q(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!s.length){const e=new n("search:no-sources-defined","At least one source is required.",{allSources:s});return W.error(e),Promise.reject(e)}return r===re?s.forEach(((s,r)=>{o.push(this._getResultsFromSource(e,r,t))})):o.push(this._getResultsFromSource(e,r,t)),m(o)}_getSuggestionsFromSources(e,t){const{allSources:s,activeSourceIndex:r}=this,o=[];if(!s.length){const e=new n("suggest:no-sources-defined","At least one source is required.",{allSources:s});return W.error(e),Promise.reject(e)}return r===re?s.forEach(((s,r)=>{o.push(this._getSuggestionsFromSource(e,r,t))})):o.push(this._getSuggestionsFromSource(e,r,t)),m(o)}_getResultsFromSource(e,t,s){var r;const o=this.allSources.getItemAt(t),{location:l=null}=e,i=(null==(r=this.view)?void 0:r.spatialReference)||$,a=q(o,"maxResults")?o.maxResults:this.maxResults,n=!!(o instanceof E&&q(o,"exactMatch"))&&o.exactMatch,{view:u}=this;return o.getResults({view:u,sourceIndex:t,location:l,suggestResult:e,spatialReference:i,exactMatch:n,maxResults:a},s)}_getSuggestionsFromSource(e,t,s){const r=this.allSources.getItemAt(t),o=q(r,"suggestionsEnabled")?r.suggestionsEnabled:this.suggestionsEnabled,l=e.length,i=q(r,"minSuggestCharacters")?r.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&l>=i){var a;const o=(null==(a=this.view)?void 0:a.spatialReference)||$,l=q(r,"maxSuggestions")?r.maxSuggestions:this.maxSuggestions,{view:i}=this,n=!!(r instanceof E&&q(r,"exactMatch"))&&r.exactMatch;return r.getSuggestions({view:i,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:l,exactMatch:n},s)}return Promise.resolve(null)}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return q(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){const t=this.results;let s=null;return t.some((t=>t.results.some((r=>r===e&&(s=t.sourceIndex,!0))))),s}async _goToSearchResult(e){const t=!!e;this._abortGoTo();const s=f();this._gotoController=s;const r={target:{target:e},options:{animate:t,signal:s.signal}};await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){var t;const{defaultSymbols:s}=this,r=null==(t=e.feature)?void 0:t.geometry;if(!g(r))return null;const o=this._get("defaultSymbol");if(o&&("point"===r.type||"multipoint"===r.type))return o;switch(r.type){case"point":case"multipoint":return s.point;case"polyline":return s.polyline;case"extent":case"polygon":return s.polygon;default:return null}}_removeHighlight(){this._handles.remove(X)}async _getLayerView(e){const{view:t}=this;if(!e||!t||"building-component"===e.layer.type||"subtype-sublayer"===e.layer.type)return Promise.resolve(null);const{layer:s}=e;return await t.when(),t.whenLayerView(s)}_highlightFeature(e){const{graphic:t,layerView:s}=e,{attributes:r,layer:o}=t,{objectIdField:l}=o,i=r&&r[l],a=s.highlight(i||t);this._handles.add(a,X)}};oe.ALL_INDEX=re,e([w({readOnly:!0,value:null})],oe.prototype,"activeSource",null),e([w()],oe.prototype,"activeSourceIndex",null),e([w()],oe.prototype,"allPlaceholder",null),e([w({readOnly:!0,dependsOn:["defaultSources.length","sources.length","includeDefaultSources"]})],oe.prototype,"allSources",null),e([w()],oe.prototype,"autoNavigate",void 0),e([w()],oe.prototype,"autoSelect",void 0),e([w()],oe.prototype,"defaultPopupTemplate",void 0),e([w({readOnly:!0})],oe.prototype,"defaultSources",void 0),e([w()],oe.prototype,"defaultSymbol",null),e([w()],oe.prototype,"defaultSymbols",void 0),e([w()],oe.prototype,"includeDefaultSources",void 0),e([w()],oe.prototype,"locationEnabled",null),e([w()],oe.prototype,"maxInputLength",void 0),e([w()],oe.prototype,"maxResults",void 0),e([w()],oe.prototype,"maxSuggestions",void 0),e([w()],oe.prototype,"messages",void 0),e([w()],oe.prototype,"minSuggestCharacters",void 0),e([w({readOnly:!0})],oe.prototype,"placeholder",null),e([w()],oe.prototype,"popupEnabled",void 0),e([w({type:o})],oe.prototype,"popupTemplate",void 0),e([w({type:R})],oe.prototype,"portal",void 0),e([w()],oe.prototype,"resultCount",void 0),e([w()],oe.prototype,"resultGraphicEnabled",void 0),e([w({readOnly:!0})],oe.prototype,"resultGraphic",void 0),e([w({readOnly:!0})],oe.prototype,"results",void 0),e([w({readOnly:!0})],oe.prototype,"selectedSuggestion",void 0),e([w()],oe.prototype,"searchAllEnabled",void 0),e([w({readOnly:!0})],oe.prototype,"selectedResult",void 0),e([w()],oe.prototype,"searchTerm",null),e([w({type:Y})],oe.prototype,"sources",void 0),e([w({readOnly:!0,dependsOn:["allSources.length","updating"]})],oe.prototype,"state",null),e([w()],oe.prototype,"suggestionDelay",void 0),e([w()],oe.prototype,"suggestionCount",void 0),e([w({readOnly:!0})],oe.prototype,"suggestions",void 0),e([w()],oe.prototype,"suggestionsEnabled",void 0),e([w({readOnly:!0})],oe.prototype,"updating",null),e([w()],oe.prototype,"view",void 0),e([w()],oe.prototype,"clear",null),oe=e([x(K)],oe);const le=oe;export{le as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{getAssetUrl as t}from"../../assets.js";import s from"../../config.js";import r from"../../Graphic.js";import o from"../../PopupTemplate.js";import"../../symbols.js";import l from"../../core/Accessor.js";import i from"../../core/Collection.js";import{deprecatedProperty as a}from"../../core/deprecate.js";import n from"../../core/Error.js";import u from"../../core/Evented.js";import c from"../../core/Handles.js";import h from"../../core/has.js";import p from"../../core/Logger.js";import{unwrap as d,isSome as g}from"../../core/maybe.js";import{eachAlways as m,after as y}from"../../core/promiseUtils.js";import{on as f,init as S,whenFalseOnce as v,whenOnce as _}from"../../core/watchUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as w}from"../../core/accessorSupport/decorators/subclass.js";import x from"../../geometry/Point.js";import I from"../../geometry/SpatialReference.js";import{onLocaleChange as j}from"../../intl/locale.js";import{fetchMessageBundle as P}from"../../intl/messages.js";import T from"../../portal/Portal.js";import{highlightsSupported as R}from"../../views/support/layerViewUtils.js";import L from"./LayerSearchSource.js";import E from"./LocatorSearchSource.js";import C from"./SearchSource.js";import{getPointFromGeometry as F,getPointWithElevation as O}from"./support/geometryUtils.js";import{isArcGISWorldGeocoder as A,meteredArcGISLocatorUrl as G,isProxiedArcGISWorldGeocoder as N,isMeteredArcGISWorldGeocoder as D}from"./support/locatorUtils.js";import{supported as M,getCurrentPosition as V,positionToPoint as k}from"../support/geolocationUtils.js";import{GoToMixin as B}from"../support/GoTo.js";import J from"../../symbols/PictureMarkerSymbol.js";import U from"../../symbols/SimpleLineSymbol.js";import H from"../../symbols/SimpleFillSymbol.js";import Q from"../../symbols/TextSymbol.js";function Z(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const q=()=>P("esri/widgets/Search/t9n/Search"),z="esri.widgets.Search.SearchViewModel",K=p.getLogger(z),W="highlight",X=i.ofType({key:e=>e.layer?"layer":"locator",base:C,typeMap:{layer:L,locator:E}}),Y=I.WGS84,$="esri/images/search/search-symbol-32.svg",ee="esri/images/search/search-symbol-32.png",te=/<(?:.|\s)*?>/g,se=-1;let re=class extends(B(u.EventedMixin(l))){constructor(e){super(e),this._handles=new c,this._gotoController=null,this._searching=null,this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new X,this.defaultSymbols={point:new J({url:t(h("trident")?ee:$),size:24,width:24,height:24}),polyline:new U({color:[130,130,130,1],width:2}),polygon:new H({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=T.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new X,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await q();this.messages=e,this.defaultPopupTemplate=new o({title:e.searchResult,content:"{Match_addr}"})};e(),this._handles.add([f(this,["defaultSources","sources"],"change",(()=>this.notifyChange("allSources"))),S(this,["includeDefaultSources","view","portal"],(()=>this._update())),j(e)])}destroy(){this._abortGoTo(),this.clearGraphics(),this._handles.destroy(),this._handles=null}get activeSource(){return this.allSources.getItemAt(this.activeSourceIndex)||null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:se}set activeSourceIndex(e){void 0!==e?this._override("activeSourceIndex",e):this._clearOverride("activeSourceIndex")}get allPlaceholder(){var e;return null==(e=this.messages)?void 0:e.allPlaceholder}set allPlaceholder(e){e?this._override("allPlaceholder",e):this._clearOverride("allPlaceholder")}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:s}=this,r="function"==typeof s?s.call(null,{sources:e,defaultSources:t}):s?t.concat(e):e,o=this._get("allSources")||new X;return o.removeAll(),o.addMany(r.filter(Boolean)),o}get defaultSymbol(){return a(K,"defaultSymbol",{replacement:"defaultSymbols",version:"4.22"}),this._get("defaultSymbol")}set defaultSymbol(e){a(K,"defaultSymbol",{replacement:"defaultSymbols",version:"4.22"}),this._set("defaultSymbol",e)}get locationEnabled(){return this._get("locationEnabled")||M()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=M();if(e&&!t){const e=new n("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});K.error(e)}this._override("locationEnabled",e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:s}=this;if(t===se)return s;const r=e.getItemAt(t);return r?r.placeholder:""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup(),this.view&&this.view.graphics.remove(this.resultGraphic),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const s=this._createSuggestionForSearch(e),r=this.when().then((()=>this._getResultsFromSources(s,t).then((e=>{var r;if(null!=(r=d(null==t?void 0:t.signal))&&r.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:s.text,numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(o,e,s);const l=this._getFirstResult(o.results),i=(s.location&&l?l.name:s.text).replace(te,"");return this._set("searchTerm",i),(s.key&&"number"==typeof s.sourceIndex||s.location)&&this._set("selectedSuggestion",s),this._set("results",o.results),this._set("resultCount",o.results.reduce(((e,t)=>e+t.results.length),0)),this.emit("search-complete",o),this._selectFirstResult(l).then((()=>o))})))).then((e=>(this._clearSearching(),e)),(e=>{throw this._clearSearching(),e}));return this._searching=r,this.notifyChange("state"),r}searchNearby(e){if(!this.locationEnabled){const e=new n("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});return K.error(e),Promise.reject(e)}const t=V().then((t=>k({position:t,view:this.view},e))).then((t=>this.search(t,e)));return this._searching=t,this.notifyChange("state"),t.catch((()=>{})).then((()=>this._clearSearching())),t}select(e){if(this.clearGraphics(),!e){const t=new n("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});return K.error(t),Promise.reject(t)}const{view:t}=this,s=Z(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=this.allSources.getItemAt(s);if(!o){const e=new n("select:missing-source","Cannot select without a source.",{source:o});return K.error(e),Promise.reject(e)}const l=o instanceof L?this._getLayerSourcePopupTemplate(o):o.popupTemplate,i=o.resultSymbol||this._getDefaultSymbol(e),a=Z(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,u=Z(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,c=Z(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,h=c?l||this.popupTemplate||this.defaultPopupTemplate:null,{feature:p}=e;if(!p){const e=new n("select:missing-feature","Cannot select without a feature.",{feature:p});return K.error(e),Promise.reject(e)}const{attributes:d,geometry:y,layer:f,sourceLayer:S}=p,v=F(y),_={layerViewQuery:this._getLayerView(p),elevationQuery:t&&g(v)?O(v,t).catch((()=>v)):Promise.resolve(v)};return m(_).then((l=>{const n=l.layerViewQuery.value,m=l.elevationQuery.value;i instanceof Q&&(i.text=e.name);const v=t&&u?e.target||e.extent:null;return(g(v)?this._goToSearchResult(v):Promise.resolve()).then((()=>{var l;const u=n?p:new r({geometry:y,symbol:i,attributes:d,layer:f,sourceLayer:S,popupTemplate:h}),g=c&&(null==(l=this.view)?void 0:l.popup),v=g&&u.getEffectivePopupTemplate(g.defaultPopupTemplateEnabled);return v&&t.popup.open({features:[u],location:m}),n&&R(n)&&!v&&this._highlightFeature({graphic:u,layerView:n}),!n&&a&&t&&t.graphics.push(u),this._set("selectedResult",e),this._set("resultGraphic",u),this.emit("select-result",{result:e,source:o,sourceIndex:s}),e}))}))}suggest(e,t,s){const r=e||this.searchTerm;return this.emit("suggest-start",{searchTerm:r}),this._suggestTimer(t,s).then((()=>this._suggestImmediate(r,s).then((e=>(this._set("suggestions",e.results),this._set("suggestionCount",e.results.reduce(((e,t)=>e+t.results.length),0)),this.emit("suggest-complete",e),e)))))}async when(){await v(this,"updating")}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const s=this._updatingPromise=m([null==e?void 0:e.load(),null==t?void 0:t.when()]);if(this.destroyed)return;if(this.notifyChange("updating"),await s,s!==this._updatingPromise)return}this._updatingPromise=null,this.notifyChange("updating");const s=_(this,"messages");this.destroyed||(this._handles.add(s),await s,this._updateDefaultSources())}_clearSearching(){this._searching=null,this.notifyChange("state")}_convertHelperServices(){var e,t;const r=null==(e=this.portal)||null==(t=e.helperServices)?void 0:t.geocode;if(!r)return[];return r.map((e=>{if(!1===e.placefinding)return;const t=s.apiKey&&A(e.url)?{url:G}:null,r=E.fromJSON({...e,...t}),o=r.url;if(A(o)||N(o)||D(o)){const e=r.outFields||["Addr_type","Match_addr","StAddr","City"],t=r.placeholder||this.messages.placeholder,s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.set({singleLineFieldName:"SingleLine",outFields:e,placeholder:t,defaultZoomScale:s})}return r.singleLineFieldName?r:void 0})).filter(Boolean)}_getLayerSources(e,t){var s;const r=null==(s=this.view)?void 0:s.map;return e.map((e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),l=L.fromJSON(o);return l.placeholder=t,this._getLayer(s,o).then((e=>{l.layer=e})),l})).filter(Boolean).toArray()}_getTableSources(e,t){var s;const r=null==(s=this.view)?void 0:s.map;return e.map((e=>{const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),l=L.fromJSON(o);return l.placeholder=t,this._getLayer(s,o).then((e=>{l.layer=e})),l})).filter(Boolean).toArray()}_convertApplicationProperties(){var e,t,s;const r=null==(e=this.view)?void 0:e.map,o=null==r||null==(t=r.applicationProperties)||null==(s=t.viewing)?void 0:s.search;if(!o)return[];const{enabled:l,hintText:i,layers:a,tables:n}=o;if(!l)return[];return[...this._getLayerSources(a,i),...this._getTableSources(n,i)]}_getSubLayer(e,t){return e.load().then((()=>{if(!e.allSublayers)return Promise.reject();const s=e.allSublayers.find((e=>e.id===t.subLayer));return s?s.createFeatureLayer():Promise.reject()}))}async _getBuildingSubLayer(e,t){await e.load();const s=e.allSublayers.find((e=>e.id===t.subLayer));return"building-component"!==(null==s?void 0:s.type)?Promise.reject():(await s.load(),null==s.associatedLayer?Promise.reject():(await s.associatedLayer.load(),s))}_getLayer(e,t){return"feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type?Promise.resolve(e):"map-image"===e.type?this._getSubLayer(e,t).catch((()=>{const t=new n("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return K.error(t),null})):"building-scene"===e.type?this._getBuildingSubLayer(e,t):Promise.resolve(null)}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()]),this.notifyChange("allSources")}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){var e;const t=null==(e=this.view)?void 0:e.popup,{resultGraphic:s}=this;if(!t||!s)return;const{selectedFeature:r}=t;r&&r===s&&t.close()}_suggestTimer(e,t){const s=null!=e?e:this.suggestionDelay;return y(s,null,t&&t.signal)}_createLocationForSearch(e){return e instanceof r?F(e.geometry):e instanceof x?e:Array.isArray(e)&&2===e.length?new x({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&Z(e,"key")&&Z(e,"text")&&Z(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),s="string"==typeof e?e:this.searchTerm,{selectedSuggestion:r,selectedResult:o}=this,l=!e&&r&&o,i=l&&r.key===o.key&&r.sourceIndex===o.sourceIndex,a=l&&r.location;return i||a?r:{location:d(t),text:t?"":s,sourceIndex:null,key:null}}_getFirstResult(e){let t=null;return e&&e.some((e=>{const{results:s}=e,r=s[0],o=!!r;return o&&(t=r),o})),t}_selectFirstResult(e){return this.autoSelect&&e?this.select(e):Promise.resolve(null)}_suggestImmediate(e,t){return this.when().then((()=>this._getSuggestionsFromSources(e,t))).then((s=>{var r;if(null!=(r=d(null==t?void 0:t.signal))&&r.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:e,numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(o,s),o}))}_formatSourceResponse(e,t,s){const r=t&&t.value||[],o=t&&t.error,l=this.allSources.getItemAt(s);if(o){const t={sourceIndex:s,source:l,error:o};e.errors.push(t),K.error(o),e.numErrors++}else{const t={sourceIndex:s,source:l,results:r};e.results.push(t),e.numResults+=r.length}}_formatResponse(e,t,s){if(t)if(e.activeSourceIndex===se){const r=s&&Z(s,"sourceIndex")&&-1!==s.sourceIndex?s.sourceIndex:void 0;t.forEach(((t,s)=>{const o=void 0!==r?r:s;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}_getResultsFromSources(e,t){const{allSources:s}=this,r=!e.location&&Z(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!s.length){const e=new n("search:no-sources-defined","At least one source is required.",{allSources:s});return K.error(e),Promise.reject(e)}return r===se?s.forEach(((s,r)=>{o.push(this._getResultsFromSource(e,r,t))})):o.push(this._getResultsFromSource(e,r,t)),m(o)}_getSuggestionsFromSources(e,t){const{allSources:s,activeSourceIndex:r}=this,o=[];if(!s.length){const e=new n("suggest:no-sources-defined","At least one source is required.",{allSources:s});return K.error(e),Promise.reject(e)}return r===se?s.forEach(((s,r)=>{o.push(this._getSuggestionsFromSource(e,r,t))})):o.push(this._getSuggestionsFromSource(e,r,t)),m(o)}_getResultsFromSource(e,t,s){var r;const o=this.allSources.getItemAt(t),{location:l=null}=e,i=(null==(r=this.view)?void 0:r.spatialReference)||Y,a=Z(o,"maxResults")?o.maxResults:this.maxResults,n=!!(o instanceof L&&Z(o,"exactMatch"))&&o.exactMatch,{view:u}=this;return o.getResults({view:u,sourceIndex:t,location:l,suggestResult:e,spatialReference:i,exactMatch:n,maxResults:a},s)}_getSuggestionsFromSource(e,t,s){const r=this.allSources.getItemAt(t),o=Z(r,"suggestionsEnabled")?r.suggestionsEnabled:this.suggestionsEnabled,l=e.length,i=Z(r,"minSuggestCharacters")?r.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&l>=i){var a;const o=(null==(a=this.view)?void 0:a.spatialReference)||Y,l=Z(r,"maxSuggestions")?r.maxSuggestions:this.maxSuggestions,{view:i}=this,n=!!(r instanceof L&&Z(r,"exactMatch"))&&r.exactMatch;return r.getSuggestions({view:i,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:l,exactMatch:n},s)}return Promise.resolve(null)}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return Z(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){const t=this.results;let s=null;return t.some((t=>t.results.some((r=>r===e&&(s=t.sourceIndex,!0))))),s}async _goToSearchResult(e){const t=!!e;this._abortGoTo();const s=new AbortController;this._gotoController=s;const r={target:{target:e},options:{animate:t,signal:s.signal}};await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){var t;const{defaultSymbols:s}=this,r=null==(t=e.feature)?void 0:t.geometry;if(!g(r))return null;const o=this._get("defaultSymbol");if(o&&("point"===r.type||"multipoint"===r.type))return o;switch(r.type){case"point":case"multipoint":return s.point;case"polyline":return s.polyline;case"extent":case"polygon":return s.polygon;default:return null}}_removeHighlight(){this._handles.remove(W)}async _getLayerView(e){const{view:t}=this;if(!e||!t||"building-component"===e.layer.type||"subtype-sublayer"===e.layer.type)return Promise.resolve(null);const{layer:s}=e;return await t.when(),t.whenLayerView(s)}_highlightFeature(e){const{graphic:t,layerView:s}=e,{attributes:r,layer:o}=t,{objectIdField:l}=o,i=r&&r[l],a=s.highlight(i||t);this._handles.add(a,W)}};re.ALL_INDEX=se,e([b({readOnly:!0,value:null})],re.prototype,"activeSource",null),e([b()],re.prototype,"activeSourceIndex",null),e([b()],re.prototype,"allPlaceholder",null),e([b({readOnly:!0,dependsOn:["defaultSources.length","sources.length","includeDefaultSources"]})],re.prototype,"allSources",null),e([b()],re.prototype,"autoNavigate",void 0),e([b()],re.prototype,"autoSelect",void 0),e([b()],re.prototype,"defaultPopupTemplate",void 0),e([b({readOnly:!0})],re.prototype,"defaultSources",void 0),e([b()],re.prototype,"defaultSymbol",null),e([b()],re.prototype,"defaultSymbols",void 0),e([b()],re.prototype,"includeDefaultSources",void 0),e([b()],re.prototype,"locationEnabled",null),e([b()],re.prototype,"maxInputLength",void 0),e([b()],re.prototype,"maxResults",void 0),e([b()],re.prototype,"maxSuggestions",void 0),e([b()],re.prototype,"messages",void 0),e([b()],re.prototype,"minSuggestCharacters",void 0),e([b({readOnly:!0})],re.prototype,"placeholder",null),e([b()],re.prototype,"popupEnabled",void 0),e([b({type:o})],re.prototype,"popupTemplate",void 0),e([b({type:T})],re.prototype,"portal",void 0),e([b()],re.prototype,"resultCount",void 0),e([b()],re.prototype,"resultGraphicEnabled",void 0),e([b({readOnly:!0})],re.prototype,"resultGraphic",void 0),e([b({readOnly:!0})],re.prototype,"results",void 0),e([b({readOnly:!0})],re.prototype,"selectedSuggestion",void 0),e([b()],re.prototype,"searchAllEnabled",void 0),e([b({readOnly:!0})],re.prototype,"selectedResult",void 0),e([b()],re.prototype,"searchTerm",null),e([b({type:X})],re.prototype,"sources",void 0),e([b({readOnly:!0,dependsOn:["allSources.length","updating"]})],re.prototype,"state",null),e([b()],re.prototype,"suggestionDelay",void 0),e([b()],re.prototype,"suggestionCount",void 0),e([b({readOnly:!0})],re.prototype,"suggestions",void 0),e([b()],re.prototype,"suggestionsEnabled",void 0),e([b({readOnly:!0})],re.prototype,"updating",null),e([b()],re.prototype,"view",void 0),e([b()],re.prototype,"clear",null),re=e([w(z)],re);const oe=re;export{oe as default};
package/widgets/Search.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{eventKey as t}from"../core/events.js";import s from"../core/Handles.js";import{createAbortController as i}from"../core/promiseUtils.js";import{escapeRegExpString as r}from"../core/string.js";import{watch as n,on as o,init as a}from"../core/watchUtils.js";import{aliasOf as u}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import h from"./Search/SearchResultRenderer.js";import g from"./Search/SearchViewModel.js";import{storeNode as p,keepMenuItemWithinView as m,isActivationKey as _}from"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as I}from"./support/jsxFactory.js";import{substitute as S}from"../intl/substitute.js";const w={base:"esri-search esri-widget",loader:"esri-widget__loader",loaderText:"esri-widget__loader-text",loaderAnimation:"esri-widget__loader-animation",esriInput:"esri-input",hasMultipleSources:"esri-search--multiple-sources",isLoading:"esri-search--loading",isSearching:"esri-search--searching",showSuggestions:"esri-search--show-suggestions",showSources:"esri-search--sources",showWarning:"esri-search--warning",container:"esri-search__container",input:"esri-search__input",inputContainer:"esri-search__input-container",form:"esri-search__form",submitButton:"esri-search__submit-button",sourcesButton:"esri-search__sources-button",clearButton:"esri-search__clear-button",sourceName:"esri-search__source-name",suggestionsMenu:"esri-search__suggestions-menu",suggestionList:"esri-search__suggestions-list",suggestionListCurrentLocation:"esri-search__suggestions-list--current-location",sourcesMenu:"esri-search__sources-menu",source:"esri-search__source",warningMenu:"esri-search__warning-menu",warningMenuBody:"esri-search__warning-body",warningMenuHeader:"esri-search__warning-header",warningMenuText:"esri-search__warning-text",noValueText:"esri-search__no-value-text",esriWidgetDisabled:"esri-widget--disabled",button:"esri-widget--button",fallbackText:"esri-icon-font-fallback-text",header:"esri-widget__heading",locate:"esri-icon-locate-circled",menu:"esri-menu",menuList:"esri-menu__list",menuItem:"esri-menu__list-item",menuItemActive:"esri-menu__list-item--active",menuItemFocus:"esri-menu__list-item--focus",menuHeader:"esri-menu__header",loadingIcon:"esri-icon-loading-indicator esri-rotating",searchIcon:"esri-icon-search",dropdownIcon:"esri-icon-down-arrow esri-search__sources-button--down",dropupIcon:"esri-icon-up-arrow esri-search__sources-button--up",clearIcon:"esri-icon-close",noticeIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-search",disabled:"esri-disabled"},b=/<[a-z/][\s\S]*>/i;let y=class extends d{constructor(e,t){super(e,t),this._activeMenuItemIndex=-1,this._handles=new s,this._inputNode=null,this._menuItemCount=0,this._sourceMenuButtonNode=null,this._sourceListNode=null,this._suggestionListNode=null,this._searchResultRenderer=new h,this._locateFailed=null,this._container=null,this.activeMenu="none",this.activeSource=null,this.activeSourceIndex=null,this.allPlaceholder=null,this.allSources=null,this.autoNavigate=null,this.autoSelect=null,this.defaultSources=null,this.disabled=!1,this.goToOverride=null,this.iconClass=w.widgetIcon,this.includeDefaultSources=null,this.label=void 0,this.locationEnabled=null,this.maxResults=null,this.maxSuggestions=null,this.messages=null,this.messagesCommon=null,this.minSuggestCharacters=null,this.popupEnabled=null,this.popupTemplate=null,this.portal=null,this.resultGraphic=null,this.resultGraphicEnabled=null,this.results=null,this.searchAllEnabled=null,this.searchTerm=null,this.selectedResult=null,this.sources=null,this.suggestions=null,this.suggestionsEnabled=null,this.view=null,this.viewModel=new g,this._clearActiveMenu=()=>{this.activeMenu="none"},this._removeActiveMenu=e=>{var t;const s=e.relatedTarget;s&&null!=(t=this._container)&&t.contains(s)||this._clearActiveMenu()},this.own(n(this,"searchTerm",(e=>{(e&&"warning"===this.activeMenu||!e&&!this.get("viewModel.selectedSuggestion.location"))&&this._clearActiveMenu()})),o(this,"viewModel.allSources","change",(()=>this._watchSourceChanges())),a(this,"activeMenu",(()=>this._resetActiveMenuItemIndex())),a(this,"viewModel.defaultPopupTemplate",(e=>{e&&(e.content=this._renderSearchResultsContent.bind(this))})))}destroy(){this._handles.destroy(),this._handles=null,this._cancelSuggest(),this._cancelSearch(),this._searchResultRenderer&&(this._searchResultRenderer.viewModel=null,this._searchResultRenderer.destroy(),this._searchResultRenderer=null)}get displayedSearchTerm(){return`${this.viewModel.searchTerm}`.trim()}get inputId(){return this._buildId("input")}get suggestionsMenuId(){return this._buildId("suggest-menu")}get sourceMenuId(){return this._buildId("source-menu")}get sourceMenuButtonId(){return this._buildId("source-menu-button")}clear(){}focus(){var e;null==(e=this._inputNode)||e.focus(),this.emit("search-focus")}blur(){var e;null==(e=this._inputNode)||e.blur(),this.emit("search-blur")}search(e){this._clearActiveMenu(),this._cancelSuggest(),this._cancelSearch();const t=i(),{signal:s}=t;return this._searchController=t,this.viewModel.search(e,{signal:s}).catch((e=>{if(this._searchController===t)return this._clearActiveMenu(),this._searchController=null,e})).then((e=>{if(this._searchController===t)return this.activeMenu=e.numResults?"none":"warning",this._searchController=null,e}))}suggest(e){this._cancelSuggest();const t=i(),{signal:s}=t;return this._suggestController=t,this.viewModel.suggest(e,null,{signal:s}).then((e=>{if(this._suggestController===t)return this._suggestController=null,e.numResults&&this._openSuggestionMenu(),this._scrollToTopSuggestion(),e})).catch((()=>{if(this._suggestController===t)return this._suggestController=null,null}))}render(){const{state:e}=this.viewModel,t={[w.disabled]:"disabled"===e,[w.esriWidgetDisabled]:this.disabled};return I("div",{class:this.classes(w.base,t)},"loading"===e?this.renderLoader():this.renderContainer())}renderSubmitButton(){const{messages:e}=this;return I("button",{"aria-label":e.searchButtonTitle,bind:this,class:this.classes(w.submitButton,w.button),key:"esri-search__submit-button",onclick:this._handleSearchButtonClick,title:e.searchButtonTitle},I("span",{"aria-hidden":"true",class:w.searchIcon}))}renderWarningMenu(){return I("div",{key:"esri-search__error-menu",class:this.classes(w.menu,w.warningMenu)},I("div",{class:w.warningMenuBody},this.renderWarning()))}renderSourceMenuButton(){const{messages:e,activeMenu:t,sourceMenuId:s,sourceMenuButtonId:i}=this,{activeSourceIndex:r,allSources:n}=this.viewModel;return n.length>1?I("button",{id:i,key:"esri-search__source-menu-button",bind:this,"aria-label":e.searchIn,title:e.searchIn,"aria-haspopup":"true","aria-expanded":("source"===t).toString(),"aria-controls":s,class:this.classes(w.sourcesButton,w.button),onclick:this._handleSourcesMenuToggleClick,onfocus:this._clearActiveMenu,afterCreate:p,"data-node-ref":"_sourceMenuButtonNode"},I("span",{"aria-hidden":"true",class:w.dropdownIcon}),I("span",{"aria-hidden":"true",class:w.dropupIcon}),I("span",{class:w.sourceName},this._getSourceName(r))):null}renderSourcesList(){const{allSources:e,searchAllEnabled:t}=this.viewModel,{_activeMenuItemIndex:s,activeMenu:i,sourceMenuId:r,sourceMenuButtonId:n}=this,o="source"===i&&s>-1?this._buildId("source-item",s):null;return e.length>1?I("ul",{"aria-activedescendant":o,"aria-labelledby":n,id:r,role:"menu",bind:this,afterCreate:p,onkeydown:this._handleSourceMenuKeydown,onkeyup:this._handleSourceMenuKeyup,"data-node-ref":"_sourceListNode",class:w.menuList,tabIndex:-1},t?this.renderSource(g.ALL_INDEX):null,e.map(((e,t)=>this.renderSource(t))).toArray()):null}renderSourcesMenu(){const{allSources:e}=this.viewModel;return e.length>1?I("div",{key:"esri-search__source-menu",class:this.classes(w.menu,w.sourcesMenu)},this.renderSourcesList()):null}renderLoader(){const{messages:e,messagesCommon:t}=this;return I("div",{class:w.loader,key:"base-loader"},I("span",{"aria-hidden":"true",class:w.loaderAnimation}),I("span",{class:w.fallbackText},e.searchButtonTitle),I("span",{class:w.loaderText},t.loading))}renderContainer(){const{allSources:e,state:t}=this.viewModel,{activeMenu:s}=this,i={[w.hasMultipleSources]:e.length>1,[w.isLoading]:"loading"===t,[w.isSearching]:"searching"===t,[w.showWarning]:"warning"===s,[w.showSources]:"source"===s,[w.showSuggestions]:"suggestion"===s};return I("div",{tabIndex:-1,afterCreate:e=>{this._container=e,e.addEventListener("focusout",this._removeActiveMenu)},afterRemoved:e=>{e.removeEventListener("focusout",this._removeActiveMenu)},class:this.classes(i,w.container),key:"base-container"},this.renderSourceMenuButton(),this.renderSourcesMenu(),this.renderInputContainer(),this.renderSubmitButton(),this.renderWarningMenu())}renderClearButton(){return this.searchTerm?I("button",{bind:this,class:this.classes(w.clearButton,w.button),key:"esri-search__clear-button",onclick:this._handleClearButtonClick,onfocus:this._clearActiveMenu,title:this.messages.clearButtonTitle},I("span",{"aria-hidden":"true",class:w.clearIcon})):null}renderLocationGroup(){const{messages:e,locationEnabled:t,displayedSearchTerm:s}=this,i=t&&!s,r="suggestion"===this.activeMenu&&0===this._activeMenuItemIndex;return i?I("ul",{role:"group",key:"esri-search__suggestion-list-current-location",class:this.classes(w.menuList,w.suggestionList,w.suggestionListCurrentLocation)},I("li",{bind:this,"data-current-location-item":!0,onclick:this._handleUseCurrentLocationClick,id:this._buildId("suggestion-item",0),"aria-selected":("suggestion"===this.activeMenu&&0===this._activeMenuItemIndex).toString(),role:"option",class:this.classes(w.menuItem,r?w.menuItemFocus:null)},I("span",{"aria-hidden":"true",class:w.locate})," ",e.useCurrentLocation)):null}renderInput(){const{activeMenu:e,locationEnabled:t,displayedSearchTerm:s,messages:i,suggestionsMenuId:r,inputId:n,_activeMenuItemIndex:o}=this,{maxInputLength:a,placeholder:u,searchTerm:l,suggestionCount:c}=this.viewModel,d=!(!(t&&!s)&&!c),h="suggestion"===e&&o>-1?this._buildId("suggestion-item",o):null;return I("input",{"aria-activedescendant":h,"aria-autocomplete":"list","aria-expanded":(d&&"suggestion"===e).toString(),"aria-controls":d?r:null,"aria-haspopup":"listbox","aria-label":i.searchButtonTitle,bind:this,placeholder:u,maxlength:a,autocomplete:"off",type:"text",class:this.classes(w.esriInput,w.input),value:l,id:n,role:"combobox",onkeyup:this._handleInputKeyup,onclick:this._openSuggestionMenu,oninput:this._handleInputPaste,onpaste:this._handleInputPaste,afterCreate:p,"data-node-ref":"_inputNode",onfocus:this.focus,onblur:this.blur,title:l?"":u})}renderForm(){return I("form",{key:"esri-search__form",bind:this,class:w.form,onsubmit:this._formSubmit,role:"search"},this.renderInput())}renderSuggestList(e){const{sourceIndex:t}=e,s=e.results.length,i=e.results;return s?I("ul",{role:"group",key:`esri-search__suggestion-list-${t}`,class:this.classes(w.menuList,w.suggestionList)},i.map((e=>this.renderSuggestion(e,this._menuItemCount++)))):null}renderSuggestionsGroup(){const{suggestions:e}=this.viewModel;return e?e.map((e=>[this.renderSuggestionHeader(e),this.renderSuggestList(e)])):null}renderSuggestionsMenu(){const{displayedSearchTerm:e,locationEnabled:t,suggestionsMenuId:s,inputId:i}=this,{suggestionCount:r}=this.viewModel,n=t&&!e||r;return this._menuItemCount=0,n?I("div",{id:s,key:"esri-search__suggestions-menu",class:this.classes(w.menu,w.suggestionsMenu),role:"listbox","aria-labelledby":i,bind:this,afterCreate:p,"data-node-ref":"_suggestionListNode"},this.renderLocationGroup(),this.renderSuggestionsGroup()):null}renderInputContainer(){return I("div",{key:"esri-search__input-container",class:w.inputContainer},this.renderForm(),this.renderSuggestionsMenu(),this.renderClearButton())}renderSuggestionHeader(e){const{allSources:t,activeSourceIndex:s}=this.viewModel,{sourceIndex:i}=e,r=e.results.length,n=t.length>1&&s===g.ALL_INDEX;return r&&n?I("div",{key:`esri-search__suggestion-header-${i}`,class:w.menuHeader},this._getSourceName(i)):null}renderSuggestion(e,t){const{_activeMenuItemIndex:s,messages:i}=this,{searchTerm:r}=this.viewModel;if(r){const{text:n}=e,o=n||i.untitledResult,a=b.test(o),u=[];if(a)u.push(I("div",{innerHTML:o}));else{const e=this._splitResult(o,r),t=r.toLowerCase();e.forEach(((e,s)=>{e&&e.length&&(e.toLowerCase()===t?u.push(I("strong",{key:s},e)):u.push(e))}))}const l="suggestion"===this.activeMenu&&s===t;return I("li",{bind:this,id:this._buildId("suggestion-item",t),"aria-selected":("suggestion"===this.activeMenu&&this._activeMenuItemIndex===t).toString(),onclick:this._handleSuggestionClick,key:`esri-search__suggestion_${t}`,"data-suggestion":e,role:"option",class:this.classes(w.menuItem,l?w.menuItemFocus:null)},u)}}renderSource(e){const{activeSourceIndex:t,searchAllEnabled:s}=this.viewModel,i={[w.menuItemActive]:e===t,[w.menuItemFocus]:"source"===this.activeMenu&&e===(s?this._activeMenuItemIndex-1:this._activeMenuItemIndex)},r=s?e+1:e;return I("li",{bind:this,key:`esri-search__source-${e}`,id:this._buildId("source-item",r),"aria-checked":(e===t).toString(),onclick:this._handleSourceClick,"data-source-index":e,role:"menuitemradio",class:this.classes(w.source,w.menuItem,i)},this._getSourceName(e))}renderNoResultsWarning(e){const{messages:t}=this,s=e?S(t.noResultsFoundForValue,{value:`"${e}"`}):t.noResultsFound;return I("div",{key:"esri-search__no_results"},I("div",{class:w.warningMenuHeader},t.noResults),I("div",{class:w.warningMenuText},s))}renderEmptySearchWarning(){const{messages:e}=this;return I("div",{key:"esri-search__empty-search"},I("span",{"aria-hidden":"true",class:w.noticeIcon}),I("span",{class:w.noValueText},e.emptyValue))}renderLocateWarning(){const{messages:e}=this;return I("div",{key:"esri-search__locate-error"},I("span",{"aria-hidden":"true",class:w.noticeIcon}),I("span",{class:w.noValueText},e.locateError))}renderWarning(){var e;const{displayedSearchTerm:t,_locateFailed:s}=this,{viewModel:i}=this;return s?this.renderLocateWarning():null!=(e=i.selectedSuggestion)&&e.location||t?this.renderNoResultsWarning(t):this.renderEmptySearchWarning()}_resetActiveMenuItemIndex(){this._activeMenuItemIndex=-1}_buildId(e,t){return`${this.id}-${e}${void 0===t?"":`-${t}`}`}_watchSourceChanges(){const{_handles:e,viewModel:{allSources:t}}=this,s="sources";e.remove(s),t.forEach((t=>e.add(n(t,"name",(()=>this.scheduleRender())),s)))}_handleSourcesMenuToggleClick(){const e="source"===this.activeMenu;var t;(this.activeMenu=e?"none":"source",this.renderNow(),"source"===this.activeMenu)&&(null==(t=this._sourceListNode)||t.focus())}_handleClearButtonClick(){this.viewModel.clear(),this._focus()}_handleSearchButtonClick(){this.search()}_handleSuggestionClick(e){const t=e.currentTarget["data-suggestion"];t&&(this._focus(),this.search(t))}_handleUseCurrentLocationClick(){this._useCurrentLocation()}_useCurrentLocation(){this._focus("none"),this._cancelSuggest(),this._cancelSearch();const e=i(),{signal:t}=e;this._searchController=e,this.viewModel.searchNearby({signal:t}).catch((()=>{this._locateFailed=!0,this.activeMenu="warning"})).then((()=>{this._searchController=null}))}_handleSourceClick(e){this._setSourceFromMenuItem(e.currentTarget)}_setSourceFromMenuItem(e){var t;if(!e)return;const s=e["data-source-index"];this.viewModel.activeSourceIndex=s,this._clearActiveMenu(),null==(t=this._sourceMenuButtonNode)||t.focus()}_cancelSuggest(){this._suggestController&&(this._suggestController.abort(),this._suggestController=null)}_cancelSearch(){this._searchController&&(this._searchController.abort(),this._searchController=null),this._locateFailed=!1}_handleInputKeyup(e){var s;const i=t(e);if(e.ctrlKey||e.metaKey||"Copy"===i||"ArrowLeft"===i||"ArrowRight"===i||"Shift"===i)return;if("Tab"===i||"Escape"===i||e.shiftKey&&"Tab"===i)return this._cancelSuggest(),void("Escape"===i&&this._clearActiveMenu());const r="Home"===i||"End"===i||"ArrowUp"===i||"ArrowDown"===i;if("Enter"===i&&this._activeMenuItemIndex<0)return void this._cancelSuggest();const n=null==(s=this._suggestionListNode)?void 0:s.getElementsByTagName("li");if(null!=n&&n.length){if("suggestion"!==this.activeMenu&&this._openSuggestionMenu(),r)return e.preventDefault(),this._cancelSuggest(),void this.handleItemNavigation(i,n,this._suggestionListNode);const t=n[this._activeMenuItemIndex];if("Enter"===i&&t){const e=t["data-suggestion"];return void(e?(this._focus(),this.search(e)):t["data-current-location-item"]&&this._useCurrentLocation())}}this.viewModel.searchTerm&&this.suggest()}handleItemNavigation(e,t,s){const i=this._activeMenuItemIndex;"Home"===e&&(this._activeMenuItemIndex=0),"End"===e&&(this._activeMenuItemIndex=t.length-1),"ArrowUp"===e&&(this._activeMenuItemIndex=this._activeMenuItemIndex<=0?t.length-1:this._activeMenuItemIndex-1),"ArrowDown"===e&&(this._activeMenuItemIndex=this._activeMenuItemIndex===t.length-1?0:this._activeMenuItemIndex+1),i!==this._activeMenuItemIndex&&m(t[this._activeMenuItemIndex],s)}_scrollToTopSuggestion(){this._suggestionListNode&&(this._suggestionListNode.scrollTop=0)}_openSuggestionMenu(){this.activeMenu="suggestion"}_handleInputPaste(e){const t=e.target;this.viewModel.searchTerm!==t.value&&(this.viewModel.searchTerm=t.value),this.viewModel.searchTerm&&this.suggest()}_handleSourceMenuKeydown(e){const s=t(e);if(_(s)){e.preventDefault();const t=this._sourceListNode.getElementsByTagName("li")[this._activeMenuItemIndex];this._setSourceFromMenuItem(t)}else"ArrowUp"!==s&&"ArrowDown"!==s&&"End"!==s&&"Home"!==s||e.preventDefault()}_handleSourceMenuKeyup(e){var s;const i=t(e),r="ArrowUp"===i||"ArrowDown"===i||"End"===i||"Home"===i;var n;if(r&&e.preventDefault(),"Escape"===i)return this._clearActiveMenu(),void(null==(n=this._sourceMenuButtonNode)||n.focus());const o=null==(s=this._sourceListNode)?void 0:s.getElementsByTagName("li");return o&&0!==o.length&&r?("source"!==this.activeMenu&&(this.activeMenu="source"),void this.handleItemNavigation(i,o,this._sourceListNode.parentElement)):void 0}_focus(e){this.focus(),e&&(this.activeMenu=e)}_formSubmit(e){e.preventDefault(),-1===this._activeMenuItemIndex&&this.search()}_getSourceName(e){const{messages:t}=this,s=this.viewModel,{allSources:i}=s,r=i.getItemAt(e);return e===g.ALL_INDEX?t.all:r&&r.name||t.untitledSource}_splitResult(e,t){const s=r(t);return e.replace(new RegExp(`(^|)(${s})(|$)`,"ig"),"$1|$2|$3").split("|")}_renderSearchResultsContent(){return this._searchResultRenderer.showMoreResultsOpen=!1,this._searchResultRenderer.viewModel=this.viewModel,this._searchResultRenderer}};e([l()],y.prototype,"_activeMenuItemIndex",void 0),e([l()],y.prototype,"displayedSearchTerm",null),e([l({readOnly:!0})],y.prototype,"inputId",null),e([l({readOnly:!0})],y.prototype,"suggestionsMenuId",null),e([l({readOnly:!0})],y.prototype,"sourceMenuId",null),e([l({readOnly:!0})],y.prototype,"sourceMenuButtonId",null),e([l()],y.prototype,"activeMenu",void 0),e([u("viewModel.activeSource")],y.prototype,"activeSource",void 0),e([u("viewModel.activeSourceIndex")],y.prototype,"activeSourceIndex",void 0),e([u("viewModel.allPlaceholder")],y.prototype,"allPlaceholder",void 0),e([u("viewModel.allSources")],y.prototype,"allSources",void 0),e([u("viewModel.autoNavigate")],y.prototype,"autoNavigate",void 0),e([u("viewModel.autoSelect")],y.prototype,"autoSelect",void 0),e([u("viewModel.defaultSources")],y.prototype,"defaultSources",void 0),e([l()],y.prototype,"disabled",void 0),e([u("viewModel.goToOverride")],y.prototype,"goToOverride",void 0),e([l()],y.prototype,"iconClass",void 0),e([u("viewModel.includeDefaultSources")],y.prototype,"includeDefaultSources",void 0),e([l({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],y.prototype,"label",void 0),e([u("viewModel.locationEnabled")],y.prototype,"locationEnabled",void 0),e([u("viewModel.maxResults")],y.prototype,"maxResults",void 0),e([u("viewModel.maxSuggestions")],y.prototype,"maxSuggestions",void 0),e([l(),v("esri/widgets/Search/t9n/Search")],y.prototype,"messages",void 0),e([l(),v("esri/t9n/common")],y.prototype,"messagesCommon",void 0),e([u("viewModel.minSuggestCharacters")],y.prototype,"minSuggestCharacters",void 0),e([u("viewModel.popupEnabled")],y.prototype,"popupEnabled",void 0),e([u("viewModel.popupTemplate")],y.prototype,"popupTemplate",void 0),e([u("viewModel.portal")],y.prototype,"portal",void 0),e([u("viewModel.resultGraphic")],y.prototype,"resultGraphic",void 0),e([u("viewModel.resultGraphicEnabled")],y.prototype,"resultGraphicEnabled",void 0),e([u("viewModel.results")],y.prototype,"results",void 0),e([u("viewModel.searchAllEnabled")],y.prototype,"searchAllEnabled",void 0),e([u("viewModel.searchTerm")],y.prototype,"searchTerm",void 0),e([u("viewModel.selectedResult")],y.prototype,"selectedResult",void 0),e([u("viewModel.sources")],y.prototype,"sources",void 0),e([u("viewModel.suggestions")],y.prototype,"suggestions",void 0),e([u("viewModel.suggestionsEnabled")],y.prototype,"suggestionsEnabled",void 0),e([u("viewModel.view")],y.prototype,"view",void 0),e([M(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),l({type:g})],y.prototype,"viewModel",void 0),e([u("viewModel.clear")],y.prototype,"clear",null),y=e([c("esri.widgets.Search")],y);const f=y;export{f as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{eventKey as t}from"../core/events.js";import s from"../core/Handles.js";import{escapeRegExpString as i}from"../core/string.js";import{watch as r,on as n,init as o}from"../core/watchUtils.js";import{aliasOf as a}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import d from"./Search/SearchResultRenderer.js";import h from"./Search/SearchViewModel.js";import{storeNode as g,keepMenuItemWithinView as p,isActivationKey as _}from"./support/widgetUtils.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";import{substitute as I}from"../intl/substitute.js";const w={base:"esri-search esri-widget",loader:"esri-widget__loader",loaderText:"esri-widget__loader-text",loaderAnimation:"esri-widget__loader-animation",esriInput:"esri-input",hasMultipleSources:"esri-search--multiple-sources",isLoading:"esri-search--loading",isSearching:"esri-search--searching",showSuggestions:"esri-search--show-suggestions",showSources:"esri-search--sources",showWarning:"esri-search--warning",container:"esri-search__container",input:"esri-search__input",inputContainer:"esri-search__input-container",form:"esri-search__form",submitButton:"esri-search__submit-button",sourcesButton:"esri-search__sources-button",clearButton:"esri-search__clear-button",sourceName:"esri-search__source-name",suggestionsMenu:"esri-search__suggestions-menu",suggestionList:"esri-search__suggestions-list",suggestionListCurrentLocation:"esri-search__suggestions-list--current-location",sourcesMenu:"esri-search__sources-menu",source:"esri-search__source",warningMenu:"esri-search__warning-menu",warningMenuBody:"esri-search__warning-body",warningMenuHeader:"esri-search__warning-header",warningMenuText:"esri-search__warning-text",noValueText:"esri-search__no-value-text",esriWidgetDisabled:"esri-widget--disabled",button:"esri-widget--button",fallbackText:"esri-icon-font-fallback-text",header:"esri-widget__heading",locate:"esri-icon-locate-circled",menu:"esri-menu",menuList:"esri-menu__list",menuItem:"esri-menu__list-item",menuItemActive:"esri-menu__list-item--active",menuItemFocus:"esri-menu__list-item--focus",menuHeader:"esri-menu__header",loadingIcon:"esri-icon-loading-indicator esri-rotating",searchIcon:"esri-icon-search",dropdownIcon:"esri-icon-down-arrow esri-search__sources-button--down",dropupIcon:"esri-icon-up-arrow esri-search__sources-button--up",clearIcon:"esri-icon-close",noticeIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-search",disabled:"esri-disabled"},S=/<[a-z/][\s\S]*>/i;let b=class extends c{constructor(e,t){super(e,t),this._activeMenuItemIndex=-1,this._handles=new s,this._inputNode=null,this._menuItemCount=0,this._sourceMenuButtonNode=null,this._sourceListNode=null,this._suggestionListNode=null,this._searchResultRenderer=new d,this._locateFailed=null,this._container=null,this.activeMenu="none",this.activeSource=null,this.activeSourceIndex=null,this.allPlaceholder=null,this.allSources=null,this.autoNavigate=null,this.autoSelect=null,this.defaultSources=null,this.disabled=!1,this.goToOverride=null,this.iconClass=w.widgetIcon,this.includeDefaultSources=null,this.label=void 0,this.locationEnabled=null,this.maxResults=null,this.maxSuggestions=null,this.messages=null,this.messagesCommon=null,this.minSuggestCharacters=null,this.popupEnabled=null,this.popupTemplate=null,this.portal=null,this.resultGraphic=null,this.resultGraphicEnabled=null,this.results=null,this.searchAllEnabled=null,this.searchTerm=null,this.selectedResult=null,this.sources=null,this.suggestions=null,this.suggestionsEnabled=null,this.view=null,this.viewModel=new h,this._clearActiveMenu=()=>{this.activeMenu="none"},this._removeActiveMenu=e=>{var t;const s=e.relatedTarget;s&&null!=(t=this._container)&&t.contains(s)||this._clearActiveMenu()},this.own(r(this,"searchTerm",(e=>{(e&&"warning"===this.activeMenu||!e&&!this.get("viewModel.selectedSuggestion.location"))&&this._clearActiveMenu()})),n(this,"viewModel.allSources","change",(()=>this._watchSourceChanges())),o(this,"activeMenu",(()=>this._resetActiveMenuItemIndex())),o(this,"viewModel.defaultPopupTemplate",(e=>{e&&(e.content=this._renderSearchResultsContent.bind(this))})))}destroy(){this._handles.destroy(),this._handles=null,this._cancelSuggest(),this._cancelSearch(),this._searchResultRenderer&&(this._searchResultRenderer.viewModel=null,this._searchResultRenderer.destroy(),this._searchResultRenderer=null)}get displayedSearchTerm(){return`${this.viewModel.searchTerm}`.trim()}get inputId(){return this._buildId("input")}get suggestionsMenuId(){return this._buildId("suggest-menu")}get sourceMenuId(){return this._buildId("source-menu")}get sourceMenuButtonId(){return this._buildId("source-menu-button")}clear(){}focus(){var e;null==(e=this._inputNode)||e.focus(),this.emit("search-focus")}blur(){var e;null==(e=this._inputNode)||e.blur(),this.emit("search-blur")}search(e){this._clearActiveMenu(),this._cancelSuggest(),this._cancelSearch();const t=new AbortController,{signal:s}=t;return this._searchController=t,this.viewModel.search(e,{signal:s}).catch((e=>{if(this._searchController===t)return this._clearActiveMenu(),this._searchController=null,e})).then((e=>{if(this._searchController===t)return this.activeMenu=e.numResults?"none":"warning",this._searchController=null,e}))}suggest(e){this._cancelSuggest();const t=new AbortController,{signal:s}=t;return this._suggestController=t,this.viewModel.suggest(e,null,{signal:s}).then((e=>{if(this._suggestController===t)return this._suggestController=null,e.numResults&&this._openSuggestionMenu(),this._scrollToTopSuggestion(),e})).catch((()=>{if(this._suggestController===t)return this._suggestController=null,null}))}render(){const{state:e}=this.viewModel,t={[w.disabled]:"disabled"===e,[w.esriWidgetDisabled]:this.disabled};return M("div",{class:this.classes(w.base,t)},"loading"===e?this.renderLoader():this.renderContainer())}renderSubmitButton(){const{messages:e}=this;return M("button",{"aria-label":e.searchButtonTitle,bind:this,class:this.classes(w.submitButton,w.button),key:"esri-search__submit-button",onclick:this._handleSearchButtonClick,title:e.searchButtonTitle},M("span",{"aria-hidden":"true",class:w.searchIcon}))}renderWarningMenu(){return M("div",{key:"esri-search__error-menu",class:this.classes(w.menu,w.warningMenu)},M("div",{class:w.warningMenuBody},this.renderWarning()))}renderSourceMenuButton(){const{messages:e,activeMenu:t,sourceMenuId:s,sourceMenuButtonId:i}=this,{activeSourceIndex:r,allSources:n}=this.viewModel;return n.length>1?M("button",{id:i,key:"esri-search__source-menu-button",bind:this,"aria-label":e.searchIn,title:e.searchIn,"aria-haspopup":"true","aria-expanded":("source"===t).toString(),"aria-controls":s,class:this.classes(w.sourcesButton,w.button),onclick:this._handleSourcesMenuToggleClick,onfocus:this._clearActiveMenu,afterCreate:g,"data-node-ref":"_sourceMenuButtonNode"},M("span",{"aria-hidden":"true",class:w.dropdownIcon}),M("span",{"aria-hidden":"true",class:w.dropupIcon}),M("span",{class:w.sourceName},this._getSourceName(r))):null}renderSourcesList(){const{allSources:e,searchAllEnabled:t}=this.viewModel,{_activeMenuItemIndex:s,activeMenu:i,sourceMenuId:r,sourceMenuButtonId:n}=this,o="source"===i&&s>-1?this._buildId("source-item",s):null;return e.length>1?M("ul",{"aria-activedescendant":o,"aria-labelledby":n,id:r,role:"menu",bind:this,afterCreate:g,onkeydown:this._handleSourceMenuKeydown,onkeyup:this._handleSourceMenuKeyup,"data-node-ref":"_sourceListNode",class:w.menuList,tabIndex:-1},t?this.renderSource(h.ALL_INDEX):null,e.map(((e,t)=>this.renderSource(t))).toArray()):null}renderSourcesMenu(){const{allSources:e}=this.viewModel;return e.length>1?M("div",{key:"esri-search__source-menu",class:this.classes(w.menu,w.sourcesMenu)},this.renderSourcesList()):null}renderLoader(){const{messages:e,messagesCommon:t}=this;return M("div",{class:w.loader,key:"base-loader"},M("span",{"aria-hidden":"true",class:w.loaderAnimation}),M("span",{class:w.fallbackText},e.searchButtonTitle),M("span",{class:w.loaderText},t.loading))}renderContainer(){const{allSources:e,state:t}=this.viewModel,{activeMenu:s}=this,i={[w.hasMultipleSources]:e.length>1,[w.isLoading]:"loading"===t,[w.isSearching]:"searching"===t,[w.showWarning]:"warning"===s,[w.showSources]:"source"===s,[w.showSuggestions]:"suggestion"===s};return M("div",{tabIndex:-1,afterCreate:e=>{this._container=e,e.addEventListener("focusout",this._removeActiveMenu)},afterRemoved:e=>{e.removeEventListener("focusout",this._removeActiveMenu)},class:this.classes(i,w.container),key:"base-container"},this.renderSourceMenuButton(),this.renderSourcesMenu(),this.renderInputContainer(),this.renderSubmitButton(),this.renderWarningMenu())}renderClearButton(){return this.searchTerm?M("button",{bind:this,class:this.classes(w.clearButton,w.button),key:"esri-search__clear-button",onclick:this._handleClearButtonClick,onfocus:this._clearActiveMenu,title:this.messages.clearButtonTitle},M("span",{"aria-hidden":"true",class:w.clearIcon})):null}renderLocationGroup(){const{messages:e,locationEnabled:t,displayedSearchTerm:s}=this,i=t&&!s,r="suggestion"===this.activeMenu&&0===this._activeMenuItemIndex;return i?M("ul",{role:"group",key:"esri-search__suggestion-list-current-location",class:this.classes(w.menuList,w.suggestionList,w.suggestionListCurrentLocation)},M("li",{bind:this,"data-current-location-item":!0,onclick:this._handleUseCurrentLocationClick,id:this._buildId("suggestion-item",0),"aria-selected":("suggestion"===this.activeMenu&&0===this._activeMenuItemIndex).toString(),role:"option",class:this.classes(w.menuItem,r?w.menuItemFocus:null)},M("span",{"aria-hidden":"true",class:w.locate})," ",e.useCurrentLocation)):null}renderInput(){const{activeMenu:e,locationEnabled:t,displayedSearchTerm:s,messages:i,suggestionsMenuId:r,inputId:n,_activeMenuItemIndex:o}=this,{maxInputLength:a,placeholder:u,searchTerm:l,suggestionCount:c}=this.viewModel,d=!(!(t&&!s)&&!c),h="suggestion"===e&&o>-1?this._buildId("suggestion-item",o):null;return M("input",{"aria-activedescendant":h,"aria-autocomplete":"list","aria-expanded":(d&&"suggestion"===e).toString(),"aria-controls":d?r:null,"aria-haspopup":"listbox","aria-label":i.searchButtonTitle,bind:this,placeholder:u,maxlength:a,autocomplete:"off",type:"text",class:this.classes(w.esriInput,w.input),value:l,id:n,role:"combobox",onkeyup:this._handleInputKeyup,onclick:this._openSuggestionMenu,oninput:this._handleInputPaste,onpaste:this._handleInputPaste,afterCreate:g,"data-node-ref":"_inputNode",onfocus:this.focus,onblur:this.blur,title:l?"":u})}renderForm(){return M("form",{key:"esri-search__form",bind:this,class:w.form,onsubmit:this._formSubmit,role:"search"},this.renderInput())}renderSuggestList(e){const{sourceIndex:t}=e,s=e.results.length,i=e.results;return s?M("ul",{role:"group",key:`esri-search__suggestion-list-${t}`,class:this.classes(w.menuList,w.suggestionList)},i.map((e=>this.renderSuggestion(e,this._menuItemCount++)))):null}renderSuggestionsGroup(){const{suggestions:e}=this.viewModel;return e?e.map((e=>[this.renderSuggestionHeader(e),this.renderSuggestList(e)])):null}renderSuggestionsMenu(){const{displayedSearchTerm:e,locationEnabled:t,suggestionsMenuId:s,inputId:i}=this,{suggestionCount:r}=this.viewModel,n=t&&!e||r;return this._menuItemCount=0,n?M("div",{id:s,key:"esri-search__suggestions-menu",class:this.classes(w.menu,w.suggestionsMenu),role:"listbox","aria-labelledby":i,bind:this,afterCreate:g,"data-node-ref":"_suggestionListNode"},this.renderLocationGroup(),this.renderSuggestionsGroup()):null}renderInputContainer(){return M("div",{key:"esri-search__input-container",class:w.inputContainer},this.renderForm(),this.renderSuggestionsMenu(),this.renderClearButton())}renderSuggestionHeader(e){const{allSources:t,activeSourceIndex:s}=this.viewModel,{sourceIndex:i}=e,r=e.results.length,n=t.length>1&&s===h.ALL_INDEX;return r&&n?M("div",{key:`esri-search__suggestion-header-${i}`,class:w.menuHeader},this._getSourceName(i)):null}renderSuggestion(e,t){const{_activeMenuItemIndex:s,messages:i}=this,{searchTerm:r}=this.viewModel;if(r){const{text:n}=e,o=n||i.untitledResult,a=S.test(o),u=[];if(a)u.push(M("div",{innerHTML:o}));else{const e=this._splitResult(o,r),t=r.toLowerCase();e.forEach(((e,s)=>{e&&e.length&&(e.toLowerCase()===t?u.push(M("strong",{key:s},e)):u.push(e))}))}const l="suggestion"===this.activeMenu&&s===t;return M("li",{bind:this,id:this._buildId("suggestion-item",t),"aria-selected":("suggestion"===this.activeMenu&&this._activeMenuItemIndex===t).toString(),onclick:this._handleSuggestionClick,key:`esri-search__suggestion_${t}`,"data-suggestion":e,role:"option",class:this.classes(w.menuItem,l?w.menuItemFocus:null)},u)}}renderSource(e){const{activeSourceIndex:t,searchAllEnabled:s}=this.viewModel,i={[w.menuItemActive]:e===t,[w.menuItemFocus]:"source"===this.activeMenu&&e===(s?this._activeMenuItemIndex-1:this._activeMenuItemIndex)},r=s?e+1:e;return M("li",{bind:this,key:`esri-search__source-${e}`,id:this._buildId("source-item",r),"aria-checked":(e===t).toString(),onclick:this._handleSourceClick,"data-source-index":e,role:"menuitemradio",class:this.classes(w.source,w.menuItem,i)},this._getSourceName(e))}renderNoResultsWarning(e){const{messages:t}=this,s=e?I(t.noResultsFoundForValue,{value:`"${e}"`}):t.noResultsFound;return M("div",{key:"esri-search__no_results"},M("div",{class:w.warningMenuHeader},t.noResults),M("div",{class:w.warningMenuText},s))}renderEmptySearchWarning(){const{messages:e}=this;return M("div",{key:"esri-search__empty-search"},M("span",{"aria-hidden":"true",class:w.noticeIcon}),M("span",{class:w.noValueText},e.emptyValue))}renderLocateWarning(){const{messages:e}=this;return M("div",{key:"esri-search__locate-error"},M("span",{"aria-hidden":"true",class:w.noticeIcon}),M("span",{class:w.noValueText},e.locateError))}renderWarning(){var e;const{displayedSearchTerm:t,_locateFailed:s}=this,{viewModel:i}=this;return s?this.renderLocateWarning():null!=(e=i.selectedSuggestion)&&e.location||t?this.renderNoResultsWarning(t):this.renderEmptySearchWarning()}_resetActiveMenuItemIndex(){this._activeMenuItemIndex=-1}_buildId(e,t){return`${this.id}-${e}${void 0===t?"":`-${t}`}`}_watchSourceChanges(){const{_handles:e,viewModel:{allSources:t}}=this,s="sources";e.remove(s),t.forEach((t=>e.add(r(t,"name",(()=>this.scheduleRender())),s)))}_handleSourcesMenuToggleClick(){const e="source"===this.activeMenu;var t;(this.activeMenu=e?"none":"source",this.renderNow(),"source"===this.activeMenu)&&(null==(t=this._sourceListNode)||t.focus())}_handleClearButtonClick(){this.viewModel.clear(),this._focus()}_handleSearchButtonClick(){this.search()}_handleSuggestionClick(e){const t=e.currentTarget["data-suggestion"];t&&(this._focus(),this.search(t))}_handleUseCurrentLocationClick(){this._useCurrentLocation()}_useCurrentLocation(){this._focus("none"),this._cancelSuggest(),this._cancelSearch();const e=new AbortController,{signal:t}=e;this._searchController=e,this.viewModel.searchNearby({signal:t}).catch((()=>{this._locateFailed=!0,this.activeMenu="warning"})).then((()=>{this._searchController=null}))}_handleSourceClick(e){this._setSourceFromMenuItem(e.currentTarget)}_setSourceFromMenuItem(e){var t;if(!e)return;const s=e["data-source-index"];this.viewModel.activeSourceIndex=s,this._clearActiveMenu(),null==(t=this._sourceMenuButtonNode)||t.focus()}_cancelSuggest(){this._suggestController&&(this._suggestController.abort(),this._suggestController=null)}_cancelSearch(){this._searchController&&(this._searchController.abort(),this._searchController=null),this._locateFailed=!1}_handleInputKeyup(e){var s;const i=t(e);if(e.ctrlKey||e.metaKey||"Copy"===i||"ArrowLeft"===i||"ArrowRight"===i||"Shift"===i)return;if("Tab"===i||"Escape"===i||e.shiftKey&&"Tab"===i)return this._cancelSuggest(),void("Escape"===i&&this._clearActiveMenu());const r="Home"===i||"End"===i||"ArrowUp"===i||"ArrowDown"===i;if("Enter"===i&&this._activeMenuItemIndex<0)return void this._cancelSuggest();const n=null==(s=this._suggestionListNode)?void 0:s.getElementsByTagName("li");if(null!=n&&n.length){if("suggestion"!==this.activeMenu&&this._openSuggestionMenu(),r)return e.preventDefault(),this._cancelSuggest(),void this.handleItemNavigation(i,n,this._suggestionListNode);const t=n[this._activeMenuItemIndex];if("Enter"===i&&t){const e=t["data-suggestion"];return void(e?(this._focus(),this.search(e)):t["data-current-location-item"]&&this._useCurrentLocation())}}this.viewModel.searchTerm&&this.suggest()}handleItemNavigation(e,t,s){const i=this._activeMenuItemIndex;"Home"===e&&(this._activeMenuItemIndex=0),"End"===e&&(this._activeMenuItemIndex=t.length-1),"ArrowUp"===e&&(this._activeMenuItemIndex=this._activeMenuItemIndex<=0?t.length-1:this._activeMenuItemIndex-1),"ArrowDown"===e&&(this._activeMenuItemIndex=this._activeMenuItemIndex===t.length-1?0:this._activeMenuItemIndex+1),i!==this._activeMenuItemIndex&&p(t[this._activeMenuItemIndex],s)}_scrollToTopSuggestion(){this._suggestionListNode&&(this._suggestionListNode.scrollTop=0)}_openSuggestionMenu(){this.activeMenu="suggestion"}_handleInputPaste(e){const t=e.target;this.viewModel.searchTerm!==t.value&&(this.viewModel.searchTerm=t.value),this.viewModel.searchTerm&&this.suggest()}_handleSourceMenuKeydown(e){const s=t(e);if(_(s)){e.preventDefault();const t=this._sourceListNode.getElementsByTagName("li")[this._activeMenuItemIndex];this._setSourceFromMenuItem(t)}else"ArrowUp"!==s&&"ArrowDown"!==s&&"End"!==s&&"Home"!==s||e.preventDefault()}_handleSourceMenuKeyup(e){var s;const i=t(e),r="ArrowUp"===i||"ArrowDown"===i||"End"===i||"Home"===i;var n;if(r&&e.preventDefault(),"Escape"===i)return this._clearActiveMenu(),void(null==(n=this._sourceMenuButtonNode)||n.focus());const o=null==(s=this._sourceListNode)?void 0:s.getElementsByTagName("li");return o&&0!==o.length&&r?("source"!==this.activeMenu&&(this.activeMenu="source"),void this.handleItemNavigation(i,o,this._sourceListNode.parentElement)):void 0}_focus(e){this.focus(),e&&(this.activeMenu=e)}_formSubmit(e){e.preventDefault(),-1===this._activeMenuItemIndex&&this.search()}_getSourceName(e){const{messages:t}=this,s=this.viewModel,{allSources:i}=s,r=i.getItemAt(e);return e===h.ALL_INDEX?t.all:r&&r.name||t.untitledSource}_splitResult(e,t){const s=i(t);return e.replace(new RegExp(`(^|)(${s})(|$)`,"ig"),"$1|$2|$3").split("|")}_renderSearchResultsContent(){return this._searchResultRenderer.showMoreResultsOpen=!1,this._searchResultRenderer.viewModel=this.viewModel,this._searchResultRenderer}};e([u()],b.prototype,"_activeMenuItemIndex",void 0),e([u()],b.prototype,"displayedSearchTerm",null),e([u({readOnly:!0})],b.prototype,"inputId",null),e([u({readOnly:!0})],b.prototype,"suggestionsMenuId",null),e([u({readOnly:!0})],b.prototype,"sourceMenuId",null),e([u({readOnly:!0})],b.prototype,"sourceMenuButtonId",null),e([u()],b.prototype,"activeMenu",void 0),e([a("viewModel.activeSource")],b.prototype,"activeSource",void 0),e([a("viewModel.activeSourceIndex")],b.prototype,"activeSourceIndex",void 0),e([a("viewModel.allPlaceholder")],b.prototype,"allPlaceholder",void 0),e([a("viewModel.allSources")],b.prototype,"allSources",void 0),e([a("viewModel.autoNavigate")],b.prototype,"autoNavigate",void 0),e([a("viewModel.autoSelect")],b.prototype,"autoSelect",void 0),e([a("viewModel.defaultSources")],b.prototype,"defaultSources",void 0),e([u()],b.prototype,"disabled",void 0),e([a("viewModel.goToOverride")],b.prototype,"goToOverride",void 0),e([u()],b.prototype,"iconClass",void 0),e([a("viewModel.includeDefaultSources")],b.prototype,"includeDefaultSources",void 0),e([u({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],b.prototype,"label",void 0),e([a("viewModel.locationEnabled")],b.prototype,"locationEnabled",void 0),e([a("viewModel.maxResults")],b.prototype,"maxResults",void 0),e([a("viewModel.maxSuggestions")],b.prototype,"maxSuggestions",void 0),e([u(),m("esri/widgets/Search/t9n/Search")],b.prototype,"messages",void 0),e([u(),m("esri/t9n/common")],b.prototype,"messagesCommon",void 0),e([a("viewModel.minSuggestCharacters")],b.prototype,"minSuggestCharacters",void 0),e([a("viewModel.popupEnabled")],b.prototype,"popupEnabled",void 0),e([a("viewModel.popupTemplate")],b.prototype,"popupTemplate",void 0),e([a("viewModel.portal")],b.prototype,"portal",void 0),e([a("viewModel.resultGraphic")],b.prototype,"resultGraphic",void 0),e([a("viewModel.resultGraphicEnabled")],b.prototype,"resultGraphicEnabled",void 0),e([a("viewModel.results")],b.prototype,"results",void 0),e([a("viewModel.searchAllEnabled")],b.prototype,"searchAllEnabled",void 0),e([a("viewModel.searchTerm")],b.prototype,"searchTerm",void 0),e([a("viewModel.selectedResult")],b.prototype,"selectedResult",void 0),e([a("viewModel.sources")],b.prototype,"sources",void 0),e([a("viewModel.suggestions")],b.prototype,"suggestions",void 0),e([a("viewModel.suggestionsEnabled")],b.prototype,"suggestionsEnabled",void 0),e([a("viewModel.view")],b.prototype,"view",void 0),e([v(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),u({type:h})],b.prototype,"viewModel",void 0),e([a("viewModel.clear")],b.prototype,"clear",null),b=e([l("esri.widgets.Search")],b);const y=b;export{y as default};