@arcgis/core 6.0.0-next.15 → 6.0.0-next.16

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 (337) hide show
  1. package/analysis/LineOfSightAnalysis.d.ts +49 -32
  2. package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
  3. package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
  4. package/analysis/Viewshed.d.ts +23 -3
  5. package/analysis/ViewshedAnalysis.d.ts +33 -13
  6. package/arcade/geometry/operatorsWorkerConnection.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
  10. package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
  11. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
  12. package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
  14. package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
  15. package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
  16. package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +1 -0
  17. package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
  18. package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
  19. package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
  20. package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 36cbd614454581aaf334.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3baa4a9c52f41bfd6abb.js +1 -0
  24. package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
  25. package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
  26. package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
  27. package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
  28. package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
  29. package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
  30. package/assets/esri/core/workers/chunks/4bbe1f28f5f16a6bef05.js +1 -0
  31. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
  32. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
  33. package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
  34. package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
  35. package/assets/esri/core/workers/chunks/5acb422fe3cf693d9d4f.js +1 -0
  36. package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
  37. package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
  38. package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
  39. package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
  40. package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +1 -0
  41. package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
  42. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
  43. package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +1 -0
  47. package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
  48. package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
  55. package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +1 -0
  56. package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
  57. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
  58. package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
  60. package/assets/esri/core/workers/chunks/9b051745d24d1f43480b.js +1 -0
  61. package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
  62. package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 9f06ec95bdf0d0b52b41.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → a7bd5ba4d7d97411fd33.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
  68. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
  69. package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
  71. package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
  72. package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → bf35927979fc5e7e0478.js} +1 -1
  74. package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
  75. package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → c5a9e77977e867a75ff2.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → c79934cd6883307203f8.js} +1 -1
  77. package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
  78. package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
  79. package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +1 -0
  80. package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
  81. package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
  82. package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
  84. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
  85. package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
  86. package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
  87. package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
  88. package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
  89. package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
  90. package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
  91. package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
  92. package/assets/esri/core/workers/chunks/{ae31fd416bbb41a81392.js → f9c5aa0bbf23e780fecc.js} +1 -1
  93. package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +1 -0
  94. package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
  95. package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
  96. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  97. package/chunks/Envelope.js +1 -1
  98. package/chunks/MultiPathImpl.js +1 -1
  99. package/chunks/OperatorGeodeticArea.js +1 -1
  100. package/chunks/OperatorShapePreservingLength.js +1 -1
  101. package/chunks/OperatorShapePreservingProject.js +1 -1
  102. package/chunks/UnitFactory.js +1 -1
  103. package/chunks/basis_encoder.js +1 -1
  104. package/chunks/basis_transcoder.js +1 -1
  105. package/chunks/index.js +1 -1
  106. package/chunks/lclayout.js +1 -1
  107. package/config.d.ts +2 -0
  108. package/config.js +1 -1
  109. package/core/accessorSupport/DefaultsStore.js +1 -1
  110. package/core/accessorSupport/MultiOriginStore.js +1 -1
  111. package/core/accessorSupport/Store.js +1 -1
  112. package/core/accessorSupport/decorators/reader.js +1 -1
  113. package/core/accessorSupport/decorators/writer.js +1 -1
  114. package/core/workers/WorkerOwner.js +1 -1
  115. package/core/workers/workerFactory.js +1 -1
  116. package/core/workers/workers.js +2 -2
  117. package/core/workers.d.ts +9 -0
  118. package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
  119. package/geometry/Mesh.js +1 -1
  120. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  121. package/geometry/operators/gx/operatorOffset.js +1 -1
  122. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  123. package/geometry/operators/support/jsonConverter.js +1 -1
  124. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  125. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  126. package/geometry/support/meshUtils/merge.js +1 -1
  127. package/geometry/support/meshUtils/rotate.js +1 -1
  128. package/geometry/support/polygonExtentClipping.js +1 -1
  129. package/identity/Credential.js +1 -1
  130. package/kernel.js +1 -1
  131. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  132. package/layers/AnnotationFeatureLayer.js +1 -1
  133. package/layers/CatalogLayer.d.ts +2 -2
  134. package/layers/CatalogLayer.js +1 -1
  135. package/layers/DimensionFeatureLayer.d.ts +2 -2
  136. package/layers/DimensionFeatureLayer.js +1 -1
  137. package/layers/FeatureLayer.d.ts +4 -4
  138. package/layers/FeatureLayer.js +1 -1
  139. package/layers/ImageryTileLayer.js +1 -1
  140. package/layers/LineOfSightLayer.d.ts +10 -8
  141. package/layers/SceneLayer.js +1 -1
  142. package/layers/SubtypeGroupLayer.d.ts +2 -2
  143. package/layers/SubtypeGroupLayer.js +1 -1
  144. package/layers/ViewshedLayer.d.ts +1 -1
  145. package/layers/VoxelLayer.js +1 -1
  146. package/layers/WMSLayer.js +1 -1
  147. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  148. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
  149. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  150. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  151. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  152. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  153. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  154. package/layers/graphics/data/QueryEngineResult.js +1 -1
  155. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  156. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  157. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  158. package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
  159. package/layers/mixins/ReloadableLayer.js +2 -0
  160. package/layers/raster/datasets/BaseRaster.js +1 -1
  161. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  162. package/layers/raster/datasets/ImageAuxRaster.js +2 -2
  163. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  164. package/layers/raster/datasets/InMemoryRaster.js +1 -1
  165. package/layers/raster/datasets/MRFRaster.js +1 -1
  166. package/layers/raster/datasets/TIFFRaster.js +1 -1
  167. package/layers/raster/datasets/WCSRaster.js +1 -1
  168. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  169. package/layers/raster/formats/RasterCodec.js +1 -1
  170. package/layers/raster/formats/TiffDecoder.js +1 -1
  171. package/layers/raster/formats/Zlib.js +1 -1
  172. package/layers/raster/functions/stretchUtils.js +1 -1
  173. package/layers/raster/functions/vectorFieldUtils.js +1 -1
  174. package/layers/support/FieldsIndex.js +1 -1
  175. package/layers/support/RasterWorker.js +1 -1
  176. package/layers/support/featureReductionProperties.js +1 -1
  177. package/layers/support/kmlUtils.js +1 -1
  178. package/layers/video/VideoController.js +10 -10
  179. package/libs/maquette/projection.js +1 -1
  180. package/networks/UtilityNetworkTraceAnalysis.js +1 -1
  181. package/package.json +5 -5
  182. package/popup/FeatureModel.js +1 -1
  183. package/popup/FeaturesModel.js +1 -1
  184. package/portal/Portal.js +1 -1
  185. package/request/process.js +1 -1
  186. package/request/types.d.ts +7 -0
  187. package/rest/knowledgeGraphService.js +1 -1
  188. package/rest/networks/trace.js +1 -1
  189. package/rest/query/executeQuery.js +1 -1
  190. package/smartMapping/raster/renderers/shadedRelief.js +1 -1
  191. package/smartMapping/renderers/univariateColorSize.js +1 -1
  192. package/smartMapping/statistics/support/statsWorker.js +1 -1
  193. package/smartMapping/statistics/support/utils.js +1 -1
  194. package/smartMapping/support/clusterUtils.js +1 -1
  195. package/statistics/utils.js +1 -1
  196. package/symbols/cim/CIMCursor.js +1 -1
  197. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  198. package/symbols/cim/cimAnalyzer.js +1 -1
  199. package/symbols/support/ElevationInfo.d.ts +4 -3
  200. package/undoredo/support/Services.js +1 -1
  201. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
  202. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  203. package/views/2d/grid/GridView2D.js +1 -1
  204. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  205. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  206. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  207. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
  208. package/views/2d/viewpointUtils.js +1 -1
  209. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  210. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  211. package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
  212. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
  213. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  214. package/views/3d/analysis/Viewshed/types.d.ts +7 -0
  215. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
  216. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  217. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  218. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  219. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  220. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  221. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  222. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  223. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  225. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  226. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  227. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  228. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  229. package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
  230. package/views/3d/layers/i3s/I3SNode.js +1 -1
  231. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  232. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  233. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  234. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  235. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  236. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  237. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  238. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  239. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  240. package/views/3d/support/elevationUpdateUtils.js +1 -1
  241. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  242. package/views/3d/support/sphereExtentUtils.js +2 -0
  243. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  244. package/views/3d/terrain/OverlayRenderer.js +1 -1
  245. package/views/3d/terrain/PatchRenderData.js +1 -1
  246. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  247. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  248. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  249. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  250. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  251. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  252. package/views/SceneView.js +1 -1
  253. package/views/ToolViewManager.js +1 -1
  254. package/views/draw/DrawOperation.js +1 -1
  255. package/views/draw/support/InteractiveHandle.js +1 -1
  256. package/views/draw/support/Reshape.js +1 -1
  257. package/views/draw/support/createUtils.js +1 -1
  258. package/views/draw/support/editingSessionUtils.js +1 -1
  259. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  260. package/views/interactive/SegmentLabels.js +1 -1
  261. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  262. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  263. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  264. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  265. package/views/interactive/options/TooltipOptions.d.ts +2 -0
  266. package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
  267. package/views/interactive/sketch/constraintUtils.js +1 -1
  268. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  269. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  270. package/views/layers/LayerView.js +1 -1
  271. package/views/layers/LineOfSightLayerView.d.ts +35 -13
  272. package/views/layers/SketchLayerView.d.ts +1 -0
  273. package/views/layers/ViewshedLayerView.d.ts +36 -12
  274. package/views/webgl/Program.js +1 -1
  275. package/views/webgl/Texture.js +1 -1
  276. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  277. package/widgets/Directions.js +1 -1
  278. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  279. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  280. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  281. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  282. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  283. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  284. package/widgets/Print.js +1 -1
  285. package/widgets/Slice.js +1 -1
  286. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  287. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  288. package/widgets/support/SelectionList.js +1 -1
  289. package/widgets/support/componentsUtils.js +1 -1
  290. package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
  291. package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
  292. package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
  293. package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
  294. package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
  295. package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
  296. package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
  297. package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
  298. package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
  299. package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
  300. package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
  301. package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
  302. package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
  303. package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
  304. package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
  305. package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
  306. package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
  307. package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
  308. package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
  309. package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
  310. package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
  311. package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
  312. package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
  313. package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
  314. package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
  315. package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
  316. package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
  317. package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
  318. package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
  319. package/assets/esri/core/workers/chunks/94e427040edb469d58ad.js +0 -1
  320. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
  321. package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
  322. package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
  323. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
  324. package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
  325. package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
  326. package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
  327. package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
  328. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
  329. package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
  330. package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
  331. package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
  332. package/assets/esri/core/workers/chunks/ed8786fed345718ed684.js +0 -1
  333. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
  334. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
  335. package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
  336. package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
  337. package/layers/mixins/FeatureLayerReload.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{equals as r,isSome as i}from"../../../core/arrayUtils.js";import{createTask as a}from"../../../core/asyncUtils.js";import o from"../../../core/Collection.js";import s from"../../../core/Error.js";import{clone as c}from"../../../core/lang.js";import l from"../../../core/Logger.js";import{getOrCreateMapValue as u}from"../../../core/MapUtils.js";import{removeMaybe as d,abortMaybe as f}from"../../../core/maybe.js";import{debounce as p,ignoreAbortErrors as m,throwIfAborted as h}from"../../../core/promiseUtils.js";import g from"../../../core/ReactiveMap.js";import{watch as _,when as v,syncAndInitial as y,sync as b}from"../../../core/reactiveUtils.js";import{property as x,subclass as S}from"../../../core/accessorSupport/decorators.js";import{isInEffectiveScaleRange as C}from"../../../geometry/support/scaleUtils.js";import{geometryTypes as w}from"../../../geometry/support/typeUtils.js";import{isFeatureLayer as T,isSubtypeGroupLayer as E,isSubtypeSublayer as D}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as O}from"../../../layers/support/timeSupport.js";import k from"../../../rest/support/AttachmentQuery.js";import A from"../../../rest/support/RelationshipQuery.js";import j from"../../../time/TimeExtent.js";import M from"../../../views/SelectionManager.js";import{temporaryHighlightName as N}from"../../../views/support/HighlightDefaults.js";import{highlightsSupported as P}from"../../../views/support/layerViewUtils.js";import{isSelectableLayerWithObjectIds as F,isSelectableLayer as I}from"../../../views/support/selectionUtils.js";import{isIFeatureTableSupportedLayerWithAttachments as L,isIFeatureTableSupportedLayerWithAttachmentsEditing as R,isIFeatureTableSupportedLayerWithEditing as z,isIFeatureTableSupportedLayerWithRelationships as B,isPageIndexValid as V,findRelatedLayer as H}from"./tableUtils.js";import{ContingentValuesManager as U}from"../../support/ContingentValuesManager.js";let W=class extends n{constructor(e){super(e),this._attachmentsOperationQueue=new o,this._contingentValuesManager=new U,this._defaultOutFields=[`*`],this._editOperationQueue=new o,this.featureTitleMap=new g,this._loaded=!1,this._loadController=null,this._loadDebounced=p(()=>this._load()),this._loadError=!1,this._objectIdCache=new o,this._pendingEditsCache=new g,this._queryOperationInfos=new g,this._refreshDebounced=p(()=>this._refresh()),this._size=0,this._temporaryHighlight=null,this._temporaryHighlightAbortController=null,this.attachmentsEnabled=!1,this.autoSaveEnabled=!0,this.defaultSelectionManager=new M,this.editingEnabled=!1,this.failures=new o,this.filterByViewExtent=!1,this.filterByLayerScaleRange=!1,this.filterGeometry=null,this.highlightEnabled=!0,this.initialSize=null,this.layer=null,this.maxSize=null,this.objectIds=null,this.outFields=null,this.pageCache=new g,this.pageSize=50,this.paginationEnabled=!1,this.relationshipConfig=null,this.relatedRecordsEnabled=!1,this.returnGeometry=!1,this.returnZ=!1,this.returnM=!1,this.selectionManager=null,this.sortOrders=[],this.syncViewSelection=!1,this.temporaryHighlightId=void 0,this.timeExtent=null,this.timeZone=null,this.view=null,this.viewTimeEnabled=!1,this.where=null}initialize(){this.addHandles([_(()=>[this.effectiveTimeExtent,this.effectiveWhere,this.filterGeometry,this.layer,this.objectIds,this.outFields,this.pageSize,this.relationshipConfig,this.returnGeometry,this.returnM,this.returnZ,this.visibleAtCurrentScale],()=>this._reset()),_(()=>this.orderByFields,()=>this._clearCaches(),{equals:r}),v(()=>this.attachmentsEnabled,()=>this._reset()),v(()=>this.relatedRecordsEnabled,()=>this._reset()),_(()=>this._layerWithContingentValues,e=>{let t=this._contingentValuesManager;e&&!t.layers.includes(e)&&t.layers.add(e)}),_(()=>[this.view?.extent,this.view?.stationary,this.filterByViewExtent],([e,t,n])=>{n&&(e?t&&(this.filterGeometry=e):this.filterGeometry=null)},y),_(()=>this.maxSize,(e,t)=>{t===0&&this._reset()}),_(()=>[this.layer,this.view],()=>this.syncSelectionSources(),y),_(()=>this.highlightEnabled,e=>this.defaultSelectionManager.highlightEnabled=e,y),_(()=>this.temporaryHighlightId,e=>{this._temporaryHighlight=d(this._temporaryHighlight?.handle),this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController;let t=this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal);m(this.view?.addUpdatingPromise(t)??t)},b)])}destroy(){this.layer=null,this.itemCache.destroy(),this.failures.destroy(),this.defaultSelectionManager.destroy(),this._temporaryHighlight=d(this._temporaryHighlight?.handle),this._temporaryHighlightAbortController=f(this._temporaryHighlightAbortController)}get _capabilities(){let{layer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _canSavePendingEdits(){return this.supportsEditing&&this.hasPendingEdits&&!this.hasInvalidPendingEdits}get _effectiveReturnZ(){return this.returnZ&&this.supportsZ}get _effectiveReturnM(){return this.returnM&&this.supportsM}get _layerWithAttachments(){let{layer:e}=this;return!e||!this._capabilities||!this.attachmentsEnabled||!this.supportsAttachments||!L(e)?null:e}get _layerWithAttachmentsEditing(){let{_layerWithAttachments:e}=this;return!e||!R(e)||!this.supportsEditing?null:e}get _layerWithContingentValues(){let{layer:e}=this;return T(e)||E(e)?e:null}get _layerWithEditing(){let e=this.layer;return z(e)&&this.supportsEditing?e:null}get _layerWithRelationships(){let e=this.layer;return B(e)&&this.supportsQueryRelated?e:null}get _pendingEditsAreInvalid(){let e=this._pendingEditsCache,t=this._layerWithContingentValues;if(!t)return!1;for(let n of e.keys()){let r=e.get(n),i=this._getFeatureWithPendingEdits(n,r);for(let e of r.changes.keys())if(this._contingentValuesManager.getViolationForField(t,i,e))return!0}return!1}get _relatedLayer(){return this.relationshipConfig?.relatedLayer}get _relatedLayerCapabilities(){let{_relatedLayer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _relatedLayerSupportsCacheHint(){return!!this._relatedLayerCapabilities?.queryRelated?.supportsCacheHint}get _relatedLayerSupportsQuery(){return!!this._relatedLayerCapabilities?.operations.supportsQuery}get _relatedLayerSupportsQueryRelated(){let{_relatedLayerCapabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get _sortedFieldNames(){return this.sortOrders.map(({fieldName:e})=>e)}get _subtypeCode(){return this.layer?.subtypeCode??null}get _subtypeField(){let{layer:e}=this;return E(e?.parent)?e.subtypeField:null}get _canUseRelatedLayer(){return!!(this._relatedLayerSupportsQuery&&this._relatedLayerSupportsQueryRelated)}get cachedPageCount(){return this.pageCache.size}get canAddRelatedFeature(){let{state:e,relationship:t,supportsAdd:n,supportsEditing:r}=this;if(e!==`loaded`||!t||!n||!r)return!1;let{cardinality:i,role:a}=t,o=this.size>0;return!(i===`one-to-one`&&o||i===`one-to-many`&&a===`origin`&&o)}get effectiveFilterByLayerScaleRange(){return!!(this.view&&this.filterByLayerScaleRange)}get effectiveOutFields(){let{layer:e,outFields:t}=this;if(!e||!t?.length)return this._defaultOutFields;let n=[];t.forEach(t=>{let r=e.fieldsIndex.normalizeFieldName(t);r&&n.push(r)});let{objectIdField:r}=e,i=e.fieldsIndex.normalizeFieldName(r)??r;return i&&!n.includes(i)&&n.unshift(i),n}get effectiveSelectionManager(){let{layer:e,view:t}=this;return e&&this.syncViewSelection&&F(e)&&t?.selectionManager?.sources.includes(e)?t.selectionManager:this.selectionManager??this.defaultSelectionManager}get effectiveSize(){let{_size:e,maxSize:t}=this;return t==null?e:Math.min(t,e)}get effectiveTimeExtent(){let{layer:e,timeExtent:t,view:n,viewTimeEnabled:r}=this;return t||!e?t??void 0:!n||!r?e.timeExtent??void 0:O({datesInUnknownTimezone:e.datesInUnknownTimezone??void 0,timeExtent:e.timeExtent,timeInfo:e.timeInfo,timeOffset:e.timeOffset,useViewTime:e.useViewTime},n.timeExtent,this._get(`effectiveTimeExtent`))??void 0}get effectiveWhere(){let{layer:e,where:t}=this;return t!=null&&t!==``?t:D(e)&&e.parent?.definitionExpression?e.parent.definitionExpression:e?.definitionExpression||`1=1`}get fieldsWithContingentValues(){return this._contingentValuesManager.getFieldsWithContingentValues(this.layer)}get hasContingentValues(){return this.fieldsWithContingentValues.size>0}get hasInvalidPendingEdits(){return this.hasPendingEdits&&this._pendingEditsAreInvalid}get hasPendingEdits(){return this.pendingEditsCount>0}get highlightableLayerView(){let e=this.layerView;return P(e)?e:null}get isQuerying(){return this._queryOperationInfos.size>0}get isSyncing(){return this.isSyncingFeatureEdits||this.isSyncingAttachmentEdits}get isSyncingAttachmentEdits(){return this._attachmentsOperationQueue.length>0}get isSyncingFeatureEdits(){return this._editOperationQueue.length>0}get itemCache(){return new o({items:[...this.pageCache.values()].flat()})}get layerView(){let{layer:e,view:t}=this;if(!e||!t)return null;let n=e.type===`sublayer`||D(e)?e.parent:e;return t.allLayerViews.find(e=>e.layer===n)}get orderByFields(){let{_sortedFieldNames:e,layer:t,sortOrders:n}=this,r=n.filter(({fieldName:t,direction:n},r)=>e.indexOf(t)===r&&n!=null).map(({fieldName:e,direction:t})=>`${e} ${t?.toUpperCase()}`);if(t&&!r.length&&!t.objectIdField&&t.fields?.length){let e=t.fields.find(e=>e.name);if(e){let n=t.fieldsIndex.normalizeFieldName(e.name);n&&r.push(`${n} ASC`)}}return r}get pageCount(){let{effectiveSize:e,pageSize:t}=this;return e===0||t===0?1:Math.ceil(e/t)}get pageIndex(){return this._get(`pageIndex`)||0}set pageIndex(e){let{pageCount:t}=this;V(e,t)&&this._set(`pageIndex`,e)}get pendingEditsCount(){let e=0;return this._pendingEditsCache.forEach(t=>e+=t.changes.size),e}get relationship(){let{relationshipConfig:e}=this;return e?.relationshipId==null?null:this.relationships?.find(t=>t.id===e.relationshipId)}get relationshipIds(){return this.relationships?.map(e=>e.id)??[]}get relationshipInfos(){let{_layerWithRelationships:e,relatedRecordsEnabled:t,relationships:n,view:r}=this,i=[];return!t||!e?.loaded||!r?.map||!n?.length||n.forEach(t=>{let n=H(e,r,t);n&&(n.load().catch(()=>{}),i.push({layer:e,relatedLayer:n,relationshipId:t.id}))}),i}get relationships(){return this._layerWithRelationships?.relationships}get size(){return this._size}get state(){let{layer:e,_loaded:t,_loadError:n}=this;return!e||e.destroyed?`disabled`:n||e.loadError?`error`:this._loadController?`loading`:e.loadStatus===`loaded`&&t?`loaded`:`ready`}get supportsAdd(){return!!this._capabilities?.operations.supportsAdd}get supportsAddAttachments(){return!!(this._layerWithAttachmentsEditing&&(this.supportsAdd||this.supportsUpdate))}get supportsAttachments(){let{_capabilities:e}=this;return!!(e?.data?.supportsAttachment&&e?.operations.supportsQueryAttachments)}get supportsCacheHint(){return!!this._capabilities?.query?.supportsCacheHint}get supportsCacheHintQueryRelated(){return!!this._capabilities?.queryRelated?.supportsCacheHint}get supportsDelete(){return!!this._capabilities?.operations.supportsDelete}get supportsEditing(){return!!this._capabilities?.operations.supportsEditing}get supportsM(){return!!this.layer?.hasM&&!!this._capabilities?.data?.supportsM}get supportsOrderBy(){return!!this._capabilities?.query?.supportsOrderBy}get supportsPagination(){return!!this._capabilities?.query?.supportsPagination}get supportsQuery(){return!!this._capabilities?.operations.supportsQuery}get supportsQueryRelated(){let{_capabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get supportsResizeAttachments(){let{_capabilities:e}=this;return!!(this.supportsAttachments&&e?.attachment?.supportsResize)}get supportsUpdate(){return!!this._capabilities?.operations.supportsUpdate}get supportsUpdateAttachments(){return!!(this._layerWithAttachmentsEditing&&(this.supportsAdd||this.supportsUpdate))}get supportsZ(){return!!this.layer?.hasZ&&!!this._capabilities?.data?.supportsZ}get visibleAtCurrentScale(){let{layer:e}=this;return!e||!this.effectiveFilterByLayerScaleRange?!1:C(e.effectiveScaleRange,this.view?.scale)}async addAttachment(e,t){let{_layerWithAttachmentsEditing:n}=this;if(!n||!this.supportsAddAttachments)return{};let r=await this._queueAttachmentsOperation(e,()=>n.addAttachment(this._createBaseGraphic(n,e),t));return this._ensureArrayContent(r)}addPendingEdits(e){let t=this._ensureLayerAndUpdateSupport();this.editingEnabled?(this.autoSaveEnabled&&this._logWarning(`store:pending-edit`,`Edit will be cached, but 'autoSaveEnabled' is true.`,!0),this._stashPendingEdits(t,e)):this._logWarning(`store:editing-disabled`,`Editing is disabled.`)}async deleteAttachments(e,t){let{_layerWithAttachmentsEditing:n}=this;if(!n||!this.supportsUpdateAttachments||!t.length)return[];let r=await this._queueAttachmentsOperation(e,()=>n.deleteAttachments(this._createBaseGraphic(n,e),t));return this._ensureArray(r)}async deleteRowsByObjectId(e){let{_layerWithEditing:t}=this;if(!this.supportsDelete||!t)throw new s(`store:delete-error`,`Delete is not supported.`);let n=e.map(e=>this.getItemByObjectId(e)?.feature).filter(i),r=this._queueEditOperation(()=>t.applyEdits({deleteFeatures:n}));return e.forEach(e=>{this.featureTitleMap.delete(e),this._discardPendingEdit({objectId:e})}),r}discardPendingEdits(e){if(e?.length)e.forEach(e=>this._discardPendingEdit(e));else{for(let[e,t]of this._pendingEditsCache){let n=this.getItemByObjectId(e);n&&(n.feature=t.originalFeature)}this._pendingEditsCache.clear(),this._clearOptionsAndViolations()}}itemHasInvalidPendingEdits(e,t){if(!this.hasInvalidPendingEdits)return!1;let n=this._layerWithContingentValues,r=this._pendingEditsCache.get(e);if(!n||!r)return!1;let i=this._getFeatureWithPendingEdits(e,r),a=this._contingentValuesManager;return t?!!a.getViolationForField(n,i,t):!!a.getAllViolations(n,i)}itemHasPendingEdits(e,t){let n=this._pendingEditsCache.get(e);return n?!t||n.changes.has(t):!1}async getAttachmentsByObjectId(e,t){let n=this.getItemByObjectId(e)?.attachments??[];return!n.length&&t?(await this._queryAttachments([e]))[e]??[]:n}getCachedFeaturesByPageIndex(e){return this.pageCache.get(e)}getFieldValueOptions(e){return this._contingentValuesManager.getFieldValueOptions(e)}async getFeatureTitle(e,n=!1){let{layer:r}=this,i=this.featureTitleMap.get(e),a=`${e}`;if(!r)return i||a;if(i&&!n)return i;if(!(`getFeatureTitle`in r)||!r.getFeatureTitle)return a;let o=this.getItemByObjectId(e)?.feature;o||=new t({attributes:{[r.objectIdField]:e},origin:r.graphicOrigin});let s=await r.getFeatureTitle(o,{fetchMissingFields:!0,removeHTML:!0});return s?(this.featureTitleMap.set(e,s),s):a}getItemByObjectId(e){for(let t of this.pageCache.values())for(let n of t)if(n.objectId===e)return n}getItemIndexByObjectId(e){let{pageCache:t,pageSize:n}=this,r=t.entries(),i=-1;for(let[t,a]of r)if(a.some((r,a)=>{let o=r.objectId===e;return o&&(i=t*n+a),o}),i>-1)break;return i}async load(){await m(this._loadDebounced())}async queryPage(e){let{layer:t,state:n}=this;if(!t||n!==`loaded`||!this.supportsQuery||this.size===0||this.maxSize===0)return[];let{pageIndex:r}=e;if(!V(r,this.pageCount))return[];let i=e.pageSize??this.pageSize,a=r*i,o=a+i;return await m(this._query({layer:t,start:a,num:o,pageIndex:r,pageSize:i}))??[]}async refresh(){await m(this._refreshDebounced())}reset(){this._reset()}async savePendingEdits(){let e=this._ensureLayerAndUpdateSupport();if(!this.editingEnabled){this._logWarning(`store:editing-disabled`,`Editing is disabled.`);return}if(this.autoSaveEnabled&&this._logWarning(`store:pending-edit`,`Edit will be cached, but 'autoSaveEnabled' is true.`,!0),!this._canSavePendingEdits){this._logError(`store:update-error`,`An error occurred. Unable to save pending edits.`);return}let t=[];for(let[e]of this._pendingEditsCache){let n=this.getItemByObjectId(e);n?.feature&&t.push(n.feature)}(await this._update(e,t,!0)).updateFeatureResults.find(e=>e.error)&&this.discardPendingEdits(),this._clearOptionsAndViolations()}syncSelectionSources(){let{defaultSelectionManager:e,layer:t,view:n}=this;e.view=n,e.sources.removeAll(),I(t)&&(e.sources.items=[t])}async updateAttachment(e,t,n){let{_layerWithAttachmentsEditing:r}=this;if(!r||!this.supportsUpdateAttachments)return{};let i=await this._queueAttachmentsOperation(e,()=>r.updateAttachment(this._createBaseGraphic(r,e),t,n));return this._ensureArrayContent(i)}async updateItem(e){let t=this._ensureLayerAndUpdateSupport();if(!this.editingEnabled){this._logWarning(`store:editing-disabled`,`Editing is disabled.`);return}if(this.hasContingentValues){let t=e.updates.some(e=>this.fieldsWithContingentValues.has(e.fieldName)),n=this.itemHasPendingEdits(e.objectId);if(n||t){let t=this._layerWithContingentValues,r=this.getItemByObjectId(e.objectId)?.feature?.clone();if(r){let i=this._contingentValuesManager.getAllViolations(t,r);if(e.updates.forEach(({fieldName:e,value:n})=>{let i=t.getField(e);i&&(r.attributes[i.name]=n)}),this._contingentValuesManager.validateContingencyConstraints(t,r).length||i.length||n){this._stashPendingEdits(t,[e]),this._contingentValuesManager.resetOptionsForLayer(t);return}}}}if(!this.autoSaveEnabled){this._stashPendingEdits(t,[e]);return}let{_sortedFieldNames:n}=this,r=e.updates.map(({fieldName:e})=>e),i=this._prepareEditsForUpdate([e]);!(await this._update(t,i)).updateFeatureResults.find(e=>e.error)&&r.some(e=>n.includes(e))&&this._clearCaches()}async verifyFeaturesByObjectId(e){let{layer:t,state:n}=this;if(!t||n!==`loaded`)return[];let{objectIdField:r}=t,i=await this._queryFeaturesByObjectId(e);return e.map(e=>i.some(t=>e===(t.getObjectId()??t.attributes[r])))}async _load(){let{layer:e}=this;if(this._reset(),!e)return;let t=new AbortController;this._loadController=t;try{if(await e.load(),e.parent&&E(e.parent)&&await e.parent.loadAll(),await e.when(),t.signal.aborted)return;let n=this.initialSize;if(this.initialSize=null,this.effectiveFilterByLayerScaleRange&&(this.visibleAtCurrentScale||(n=0)),await m(this._refresh(t,n)),t.signal.aborted){this._loadController=null;return}this._loaded=!0,this._loadController=null}catch(e){throw this._reset(),this._loadError=!0,this._logError(`store:load-error`,`An error occurred.`),e}}async _refresh(e,t){this._clearCaches();let n=e?.signal,r=await this._getSize(n,t),i=await this._queryAllObjectIds(n);n?.aborted||(this._size=r,this._objectIdCache.removeAll(),i?.length&&this._objectIdCache.addMany(i),this._syncPendingEdits())}async _queryAllObjectIds(e){return this.supportsPagination?void 0:await this._queryObjectIds(e)}_clearCaches(){this.pageCache.clear(),this._objectIdCache.removeAll()}_createBaseGraphic(e,n){let r=new t({attributes:{[e.objectIdField]:n}});return this._subtypeField&&this._subtypeCode!=null&&(r.attributes[this._subtypeField]=this._subtypeCode),r}_ensureArray(e){return Array.isArray(e)?e:[e]}_ensureArrayContent(e){return Array.isArray(e)?e[0]:e}_getObjectIdsForFeatures(e,t){return e.map(e=>e.getObjectId()??e.attributes[t.objectIdField])}_getObjectIdsForPage(e,t){let n=this._objectIdCache.toArray();return n.length>=e+t?n.slice(e,e+t):n.slice(e)}_logError(e,t){l.getLogger(this).error(e,t)}_logWarning(e,t,n=!1){n?l.getLogger(this).warnOnce(e,t):l.getLogger(this).warn(e,t)}_reset(){this._clearCaches(),this._pendingEditsCache.clear(),this.failures.removeAll(),this._attachmentsOperationQueue.removeAll(),this._editOperationQueue.removeAll(),this.featureTitleMap.clear(),this._loadController=f(this._loadController),this._queryOperationInfos.forEach(e=>e.controller.abort()),this._queryOperationInfos.clear(),this._temporaryHighlight=d(this._temporaryHighlight?.handle),this._temporaryHighlightAbortController=f(this._temporaryHighlightAbortController),this._loaded=!1,this._loadError=!1,this._size=0}async _getSize(e,t){return this.maxSize===0?0:t??await this._queryCount(e)}async _queryFeaturesByObjectId(e){let{layer:t}=this;if(!t||!this.supportsQuery)throw new s(`store:query-error`,`Layer does not support query operation.`);let{effectiveTimeExtent:n,effectiveWhere:r,orderByFields:i,supportsCacheHint:a,supportsOrderBy:o}=this,c=t.createQuery();return c.where=r,c.timeExtent=n,c.returnGeometry=!1,c.objectIds=e.length?e:void 0,c.outFields=[t.objectIdField],o&&(c.orderByFields=i),a&&(c.cacheHint=!0),(await t.queryFeatures(c)).features}async _syncTemporaryHighlight(e,t){let{highlightEnabled:n,highlightableLayerView:r}=this;r&&n&&e!=null&&(h(t),this._temporaryHighlight={id:e,handle:r.highlight(e,{name:N})})}_ensureLayerAndUpdateSupport(){let e=this._layerWithEditing;if(!e||!this.supportsUpdate)throw new s(`store:update-error`,`Update is not supported.`);return e}_stashPendingEdits(e,t){t.forEach(({objectId:t,updates:n})=>{let r=this.getItemByObjectId(t)?.feature;if(!r)throw new s(`store:update-error`,`Feature with provided 'objectId' not found.`);let i=r.clone(),a=u(this._pendingEditsCache,t,()=>({originalFeature:i,changes:new g}));n.forEach(({fieldName:t,value:n})=>{let i=e.getField(t);i?(a.changes.set(i.name,n),r.attributes[i.name]=n):this._logWarning(`store:pending-edit-unknown-field`,`The provided field does not belong to this layer.`)}),a.changes.size>0&&this._pendingEditsCache.set(t,a)})}_syncPendingEdits(){for(let[e,t]of this._pendingEditsCache){let n=this.getItemByObjectId(e)?.feature;if(n){let e=n.clone();for(let[e,r]of t.changes)n.attributes[e]=r;t.originalFeature=e}}}_getFeatureWithPendingEdits(e,t){let n=this.getItemByObjectId(e)?.feature;if(!n){n=t.originalFeature.clone();for(let[e,r]of t.changes)n.attributes[e]=r}return n}_discardPendingEdit({objectId:e,fieldName:t}){let n=this._pendingEditsCache.get(e);if(!n){this._logWarning(`store:pending-edit-not-found`,`Could not find a pending edit with the given information`);return}let r=this.getItemByObjectId(e);t?(r&&(r.feature.attributes[t]=n.originalFeature.attributes[t]),n.changes.delete(t),n.changes.size===0&&this._pendingEditsCache.delete(e)):(r&&(r.feature=n.originalFeature),this._pendingEditsCache.delete(e))}_clearOptionsAndViolations(){let{_layerWithContingentValues:e,_contingentValuesManager:t}=this;e&&(t.resetOptionsForLayer(e),t.resetViolationsForLayer(e))}_prepareEditsForUpdate(e){let n=[];return e.forEach(({objectId:e,updates:r})=>{let i=this.getItemByObjectId(e)?.feature;if(!i)return;let a=c(i.attributes);r.forEach(({fieldName:e,value:t})=>a[e]=t),n.push(new t({attributes:a,sourceLayer:i.sourceLayer}))}),n}_update(e,t,n=!1){let r=e.applyEdits({updateFeatures:t}).then(n=>{let{updateFeatureResults:r}=n,i=r.find(e=>!!e.error);if(i)throw i.error;return t.forEach(t=>{let n=t.getObjectId()??t.attributes[e.objectIdField],r=this.getItemByObjectId(n)?.feature;r&&(r.attributes=t.attributes),this.featureTitleMap.has(n)&&this.getFeatureTitle(n,!0)}),n});return this._queueEditOperation(()=>r,n)}_createFeatureStoreItems(e){let{attachments:t,features:n,layer:r,relatedRecords:i}=e,a=r.objectIdField;return n.map(e=>{let n=e.getObjectId()??e.attributes[a],o=[];!e.layer&&!e.sourceLayer&&(e.layer=r,e.sourceLayer=r);let s=this._pendingEditsCache.get(n);if(s){let t=e.clone(),n=s.changes;for(let[t,r]of n)e.attributes[t]=r;s.originalFeature=t}return i.forEach((e,t)=>{o.push({relationshipId:t,count:e[n]??0})}),{objectId:n,feature:e,attachments:t[n]??null,relatedRecords:o}})}async _query(e){let{pageIndex:t,refresh:n}=e;n===!0&&await this._refresh();let r=this.pageCache.get(t);if(r)return r;let i=this._queryOperationInfos.get(t);if(i)return i.task.promise;let a=new AbortController,o=await this._queryPage(e,a);return a.signal.aborted||this.pageCache.set(t,o),o}_queryAttachments(e,t){let{_layerWithAttachments:n,effectiveWhere:r}=this;return n?e.some(e=>typeof e!=`number`)?Promise.reject(new s(`invalid-object-id`,`Only numeric object ids are valid to query attachments`)):n.queryAttachments(new k({objectIds:e,where:r,returnMetadata:!0}),{signal:t}):Promise.resolve({})}async _queryCount(e){let{_relatedLayerSupportsCacheHint:t,layer:n,relationshipConfig:r,supportsCacheHint:i}=this;if(!n)return 0;if(r&&this._canUseRelatedLayer){let{objectId:n,relatedLayer:i,relationshipId:a}=r;return(await i.queryRelatedFeaturesCount(new A({cacheHint:t,relationshipId:a,objectIds:[n]}),{signal:e}))[n]??0}let{effectiveTimeExtent:a,effectiveWhere:o,filterGeometry:s,objectIds:c}=this,l=n.createQuery();return l.geometry=s,l.returnGeometry=!1,l.where=o,l.timeExtent=a,l.objectIds=c?.length?c:void 0,i&&(l.cacheHint=!0),n.queryFeatureCount(l,{signal:e})}async _queryFeatures(e,t){let{relationshipConfig:n}=this;if(n&&this._canUseRelatedLayer)return this._queryRelatedFeatures(e,n);let{_effectiveReturnM:r,_effectiveReturnZ:i,effectiveOutFields:a,effectiveTimeExtent:o,effectiveWhere:s,filterGeometry:c,objectIds:l,orderByFields:u,pageSize:d,returnGeometry:f,supportsCacheHint:p,supportsOrderBy:m,supportsPagination:h}=this,{layer:g,start:_}=e,v=l?.length,y=g.createQuery();return y.returnGeometry=f,y.outFields=a,y.returnM=r,y.returnZ=i,h?(y.start=_,y.num=d,y.where=s,y.timeExtent=o,y.objectIds=v?l:void 0):y.objectIds=v?l:this._getObjectIdsForPage(_,d??0),m&&(y.orderByFields=u),c&&(y.geometry=c),p&&(y.cacheHint=!0),(await g.queryFeatures(y,{signal:t})).features}_queryObjectIds(e){let{effectiveTimeExtent:t,effectiveWhere:n,filterGeometry:r,layer:i,objectIds:a,orderByFields:o,supportsCacheHint:s,supportsOrderBy:c}=this;if(!i)return Promise.resolve([]);let l=i.createQuery();return l.geometry=r,l.outFields=[i.objectIdField],l.returnGeometry=!1,l.where=n,l.timeExtent=t,l.objectIds=a?.length?a:void 0,c&&(l.orderByFields=o),s&&(l.cacheHint=!0),i.queryObjectIds(l,{signal:e})}async _queryPage(e,t){return this._queueQueryOperation(e.pageIndex,{controller:t,task:a(async()=>this._queryPageData(e,t))})}async _queryPageData(e,t){let{layer:n}=e,{signal:r}=t,i=await this._queryFeatures(e,r);if(r.aborted)return[];let a=this._getObjectIdsForFeatures(i,n),[o,s]=await Promise.all([this._queryAttachments(a,r),this._queryRelatedCounts(a,r)]);return t.signal.aborted?[]:this._createFeatureStoreItems({layer:n,features:i,attachments:o,relatedRecords:s})||[]}async _queryRelatedCounts(e,t){let{_layerWithRelationships:n,relationshipIds:r,supportsCacheHintQueryRelated:i}=this,a=new Map;return!n||!e?.length||!r.length||await Promise.allSettled(r.map(async r=>{let o=await n.queryRelatedFeaturesCount(new A({cacheHint:i,relationshipId:r,objectIds:e}),{signal:t});a.set(r,o)})),a}async _queryRelatedFeatures(e,t){let{_defaultOutFields:n,_effectiveReturnM:r,_effectiveReturnZ:i,orderByFields:a,pageSize:o,returnGeometry:s,supportsCacheHint:c}=this,{layer:l,start:u}=e,{objectId:d,relatedLayer:f,relationshipId:p}=t,m=l.createQuery(),h=new A({cacheHint:c,num:o,objectIds:[d],orderByFields:a,outFields:n,relationshipId:p,returnGeometry:s,returnM:r,returnZ:i,start:u,where:m.where??void 0});return(await f.queryRelatedFeatures(h))[d]?.features||[]}_queueAttachmentsOperation(e,t){return this._attachmentsOperationQueue.push(t),t().then(async n=>{this._attachmentsOperationQueue.remove(t);let r=this._ensureArray(n),i=r.some(e=>e.error),a=this.getItemByObjectId(e);return a&&(!i||r.length>1)&&(a.attachments=(await this._queryAttachments([e]))[e]),n}).catch(async n=>{this._logError(`store:attachment-error`,`An error occurred.`);let r={error:n,retry:()=>{this.failures.remove(r),this._queueAttachmentsOperation(e,t)},cancel:()=>this.failures.remove(r)};throw this.failures.add(r),this._attachmentsOperationQueue.remove(t),n})}_queueEditOperation(e,t=!1){return this._editOperationQueue.push(e),e().then(n=>(this._editOperationQueue.remove(e),t&&this._pendingEditsCache.clear(),n)).catch(t=>{this._logError(`store:edit-error`,`An error occurred.`);let n={error:t,retry:()=>{this.failures.remove(n),this._queueEditOperation(e)},cancel:()=>this.failures.remove(n)};throw this.failures.add(n),this._editOperationQueue.remove(e),t})}async _queueQueryOperation(e,t){this._queryOperationInfos.set(e,t);let n=await t.task.promise;return this._queryOperationInfos.delete(e),n}};e([x()],W.prototype,`_attachmentsOperationQueue`,void 0),e([x({readOnly:!0})],W.prototype,`_capabilities`,null),e([x()],W.prototype,`_canSavePendingEdits`,null),e([x()],W.prototype,`_contingentValuesManager`,void 0),e([x()],W.prototype,`_defaultOutFields`,void 0),e([x()],W.prototype,`_editOperationQueue`,void 0),e([x()],W.prototype,`_effectiveReturnZ`,null),e([x()],W.prototype,`_effectiveReturnM`,null),e([x()],W.prototype,`featureTitleMap`,void 0),e([x({readOnly:!0})],W.prototype,`_layerWithAttachments`,null),e([x({readOnly:!0})],W.prototype,`_layerWithAttachmentsEditing`,null),e([x()],W.prototype,`_layerWithContingentValues`,null),e([x({readOnly:!0})],W.prototype,`_layerWithEditing`,null),e([x({readOnly:!0})],W.prototype,`_layerWithRelationships`,null),e([x()],W.prototype,`_loaded`,void 0),e([x()],W.prototype,`_loadController`,void 0),e([x()],W.prototype,`_loadError`,void 0),e([x()],W.prototype,`_objectIdCache`,void 0),e([x()],W.prototype,`_pendingEditsCache`,void 0),e([x()],W.prototype,`_pendingEditsAreInvalid`,null),e([x()],W.prototype,`_queryOperationInfos`,void 0),e([x({readOnly:!0})],W.prototype,`_relatedLayer`,null),e([x({readOnly:!0})],W.prototype,`_relatedLayerCapabilities`,null),e([x({readOnly:!0})],W.prototype,`_relatedLayerSupportsCacheHint`,null),e([x()],W.prototype,`_relatedLayerSupportsQuery`,null),e([x()],W.prototype,`_relatedLayerSupportsQueryRelated`,null),e([x()],W.prototype,`_size`,void 0),e([x()],W.prototype,`_sortedFieldNames`,null),e([x()],W.prototype,`_subtypeCode`,null),e([x()],W.prototype,`_subtypeField`,null),e([x()],W.prototype,`_canUseRelatedLayer`,null),e([x()],W.prototype,`attachmentsEnabled`,void 0),e([x()],W.prototype,`autoSaveEnabled`,void 0),e([x()],W.prototype,`cachedPageCount`,null),e([x()],W.prototype,`canAddRelatedFeature`,null),e([x()],W.prototype,`defaultSelectionManager`,void 0),e([x()],W.prototype,`editingEnabled`,void 0),e([x()],W.prototype,`effectiveFilterByLayerScaleRange`,null),e([x()],W.prototype,`effectiveOutFields`,null),e([x()],W.prototype,`effectiveSelectionManager`,null),e([x()],W.prototype,`effectiveSize`,null),e([x()],W.prototype,`effectiveTimeExtent`,null),e([x()],W.prototype,`effectiveWhere`,null),e([x({readOnly:!0})],W.prototype,`failures`,void 0),e([x()],W.prototype,`fieldsWithContingentValues`,null),e([x()],W.prototype,`filterByViewExtent`,void 0),e([x()],W.prototype,`filterByLayerScaleRange`,void 0),e([x({types:w})],W.prototype,`filterGeometry`,void 0),e([x()],W.prototype,`hasContingentValues`,null),e([x()],W.prototype,`hasInvalidPendingEdits`,null),e([x()],W.prototype,`hasPendingEdits`,null),e([x()],W.prototype,`highlightEnabled`,void 0),e([x()],W.prototype,`highlightableLayerView`,null),e([x()],W.prototype,`initialSize`,void 0),e([x({readOnly:!0})],W.prototype,`isQuerying`,null),e([x({readOnly:!0})],W.prototype,`isSyncing`,null),e([x({readOnly:!0})],W.prototype,`isSyncingAttachmentEdits`,null),e([x({readOnly:!0})],W.prototype,`isSyncingFeatureEdits`,null),e([x({readOnly:!0})],W.prototype,`itemCache`,null),e([x()],W.prototype,`layer`,void 0),e([x()],W.prototype,`layerView`,null),e([x()],W.prototype,`maxSize`,void 0),e([x()],W.prototype,`objectIds`,void 0),e([x()],W.prototype,`orderByFields`,null),e([x()],W.prototype,`outFields`,void 0),e([x({readOnly:!0})],W.prototype,`pageCache`,void 0),e([x()],W.prototype,`pageCount`,null),e([x()],W.prototype,`pageIndex`,null),e([x()],W.prototype,`pageSize`,void 0),e([x()],W.prototype,`paginationEnabled`,void 0),e([x()],W.prototype,`pendingEditsCount`,null),e([x()],W.prototype,`relationship`,null),e([x()],W.prototype,`relationshipConfig`,void 0),e([x()],W.prototype,`relationshipIds`,null),e([x()],W.prototype,`relationshipInfos`,null),e([x()],W.prototype,`relationships`,null),e([x()],W.prototype,`relatedRecordsEnabled`,void 0),e([x()],W.prototype,`returnGeometry`,void 0),e([x()],W.prototype,`returnZ`,void 0),e([x()],W.prototype,`returnM`,void 0),e([x()],W.prototype,`selectionManager`,void 0),e([x({readOnly:!0})],W.prototype,`size`,null),e([x()],W.prototype,`sortOrders`,void 0),e([x({readOnly:!0})],W.prototype,`state`,null),e([x()],W.prototype,`supportsAdd`,null),e([x()],W.prototype,`supportsAddAttachments`,null),e([x()],W.prototype,`supportsAttachments`,null),e([x()],W.prototype,`supportsCacheHint`,null),e([x()],W.prototype,`supportsCacheHintQueryRelated`,null),e([x()],W.prototype,`supportsDelete`,null),e([x()],W.prototype,`supportsEditing`,null),e([x()],W.prototype,`supportsM`,null),e([x()],W.prototype,`supportsOrderBy`,null),e([x()],W.prototype,`supportsPagination`,null),e([x()],W.prototype,`supportsQuery`,null),e([x()],W.prototype,`supportsQueryRelated`,null),e([x()],W.prototype,`supportsResizeAttachments`,null),e([x()],W.prototype,`supportsUpdate`,null),e([x()],W.prototype,`supportsUpdateAttachments`,null),e([x()],W.prototype,`supportsZ`,null),e([x()],W.prototype,`syncViewSelection`,void 0),e([x()],W.prototype,`temporaryHighlightId`,void 0),e([x({type:j})],W.prototype,`timeExtent`,void 0),e([x()],W.prototype,`timeZone`,void 0),e([x()],W.prototype,`view`,void 0),e([x()],W.prototype,`viewTimeEnabled`,void 0),e([x()],W.prototype,`visibleAtCurrentScale`,null),e([x()],W.prototype,`where`,void 0),W=e([S(`esri.widgets.FeatureTable.support.FeatureStore`)],W);const G=W;export{G as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{equals as r,isSome as i}from"../../../core/arrayUtils.js";import{createTask as a}from"../../../core/asyncUtils.js";import o from"../../../core/Collection.js";import s from"../../../core/Error.js";import{clone as c}from"../../../core/lang.js";import l from"../../../core/Logger.js";import{getOrCreateMapValue as u}from"../../../core/MapUtils.js";import{removeMaybe as d,abortMaybe as f}from"../../../core/maybe.js";import{debounce as p,ignoreAbortErrors as m,throwIfAborted as h}from"../../../core/promiseUtils.js";import g from"../../../core/ReactiveMap.js";import{watch as _,when as v,syncAndInitial as y,sync as b}from"../../../core/reactiveUtils.js";import{property as x,subclass as S}from"../../../core/accessorSupport/decorators.js";import{isInEffectiveScaleRange as C}from"../../../geometry/support/scaleUtils.js";import{geometryTypes as w}from"../../../geometry/support/typeUtils.js";import{isFeatureLayer as T,isSubtypeGroupLayer as E,isSubtypeSublayer as D}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as O}from"../../../layers/support/timeSupport.js";import k from"../../../rest/support/AttachmentQuery.js";import A from"../../../rest/support/RelationshipQuery.js";import j from"../../../time/TimeExtent.js";import M from"../../../views/SelectionManager.js";import{temporaryHighlightName as N}from"../../../views/support/HighlightDefaults.js";import{highlightsSupported as P}from"../../../views/support/layerViewUtils.js";import{isSelectableLayerWithObjectIds as F,isSelectableLayer as I}from"../../../views/support/selectionUtils.js";import{isIFeatureTableSupportedLayerWithAttachments as L,isIFeatureTableSupportedLayerWithAttachmentsEditing as R,isIFeatureTableSupportedLayerWithEditing as z,isIFeatureTableSupportedLayerWithRelationships as B,isPageIndexValid as V,findRelatedLayer as H}from"./tableUtils.js";import{ContingentValuesManager as U}from"../../support/ContingentValuesManager.js";let W=class extends n{constructor(e){super(e),this._attachmentsOperationQueue=new o,this._contingentValuesManager=new U,this._defaultOutFields=[`*`],this._editOperationQueue=new o,this.featureTitleMap=new g,this._loaded=!1,this._loadController=null,this._loadDebounced=p(()=>this._load()),this._loadError=!1,this._objectIdCache=new o,this._pendingEditsCache=new g,this._queryOperationInfos=new g,this._refreshDebounced=p(()=>this._refresh()),this._size=0,this._temporaryHighlight=null,this._temporaryHighlightAbortController=null,this.attachmentsEnabled=!1,this.autoSaveEnabled=!0,this.defaultSelectionManager=new M,this.editingEnabled=!1,this.failures=new o,this.filterByViewExtent=!1,this.filterByLayerScaleRange=!1,this.filterGeometry=null,this.highlightEnabled=!0,this.initialSize=null,this.layer=null,this.maxSize=null,this.objectIds=null,this.outFields=null,this.pageCache=new g,this.pageSize=50,this.paginationEnabled=!1,this.relationshipConfig=null,this.relatedRecordsEnabled=!1,this.returnGeometry=!1,this.returnZ=!1,this.returnM=!1,this.selectionManager=null,this.sortOrders=[],this.syncViewSelection=!1,this.temporaryHighlightId=void 0,this.timeExtent=null,this.timeZone=null,this.view=null,this.viewTimeEnabled=!1,this.where=null}initialize(){this.addHandles([_(()=>[this.effectiveTimeExtent,this.effectiveWhere,this.filterGeometry,this.layer,this.objectIds,this.outFields,this.pageSize,this.relationshipConfig,this.returnGeometry,this.returnM,this.returnZ,this.visibleAtCurrentScale],()=>this._reset()),_(()=>this.orderByFields,()=>this._clearCaches(),{equals:r}),v(()=>this.attachmentsEnabled,()=>this._reset()),v(()=>this.relatedRecordsEnabled,()=>this._reset()),_(()=>this._layerWithContingentValues,e=>{let t=this._contingentValuesManager;e&&!t.layers.includes(e)&&t.layers.add(e)}),_(()=>[this.view?.extent,this.view?.stationary,this.filterByViewExtent],([e,t,n])=>{n&&(e?t&&(this.filterGeometry=e):this.filterGeometry=null)},y),_(()=>this.maxSize,(e,t)=>{t===0&&this._reset()}),_(()=>[this.layer,this.view],()=>this.syncSelectionSources(),y),_(()=>this.highlightEnabled,e=>this.defaultSelectionManager.highlightEnabled=e,y),_(()=>this.temporaryHighlightId,e=>{this._temporaryHighlight=d(this._temporaryHighlight?.handle),this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController;let t=this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal);m(this.view?.addUpdatingPromise(t)??t)},b)])}destroy(){this.layer=null,this.itemCache.destroy(),this.failures.destroy(),this.defaultSelectionManager.destroy(),this._temporaryHighlight=d(this._temporaryHighlight?.handle),this._temporaryHighlightAbortController=f(this._temporaryHighlightAbortController)}get _capabilities(){let{layer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _canSavePendingEdits(){return this.supportsEditing&&this.hasPendingEdits&&!this.hasInvalidPendingEdits}get _effectiveReturnZ(){return this.returnZ&&this.supportsZ}get _effectiveReturnM(){return this.returnM&&this.supportsM}get _layerWithAttachments(){let{layer:e}=this;return!e||!this._capabilities||!this.attachmentsEnabled||!this.supportsAttachments||!L(e)?null:e}get _layerWithAttachmentsEditing(){let{_layerWithAttachments:e}=this;return!e||!R(e)||!this.supportsEditing?null:e}get _layerWithContingentValues(){let{layer:e}=this;return T(e)||E(e)?e:null}get _layerWithEditing(){let e=this.layer;return z(e)&&this.supportsEditing?e:null}get _layerWithRelationships(){let e=this.layer;return B(e)&&this.supportsQueryRelated?e:null}get _pendingEditsAreInvalid(){let e=this._pendingEditsCache,t=this._layerWithContingentValues;if(!t)return!1;for(let n of e.keys()){let r=e.get(n),i=this._getFeatureWithPendingEdits(n,r);for(let e of r.changes.keys())if(this._contingentValuesManager.getViolationForField(t,i,e))return!0}return!1}get _relatedLayer(){return this.relationshipConfig?.relatedLayer}get _relatedLayerCapabilities(){let{_relatedLayer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _relatedLayerSupportsCacheHint(){return!!this._relatedLayerCapabilities?.queryRelated?.supportsCacheHint}get _relatedLayerSupportsQuery(){return!!this._relatedLayerCapabilities?.operations.supportsQuery}get _relatedLayerSupportsQueryRelated(){let{_relatedLayerCapabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get _sortedFieldNames(){return this.sortOrders.map(({fieldName:e})=>e)}get _subtypeCode(){return this.layer?.subtypeCode??null}get _subtypeField(){let{layer:e}=this;return E(e?.parent)?e.subtypeField:null}get _canUseRelatedLayer(){return!!(this._relatedLayerSupportsQuery&&this._relatedLayerSupportsQueryRelated)}get cachedPageCount(){return this.pageCache.size}get canAddRelatedFeature(){let{state:e,relationship:t,supportsAdd:n,supportsEditing:r}=this;if(e!==`loaded`||!t||!n||!r)return!1;let{cardinality:i,role:a}=t,o=this.size>0;return!(i===`one-to-one`&&o||i===`one-to-many`&&a===`origin`&&o)}get effectiveFilterByLayerScaleRange(){return!!(this.view&&this.filterByLayerScaleRange)}get effectiveOutFields(){let{layer:e,outFields:t}=this;if(!e||!t?.length)return this._defaultOutFields;let n=[];t.forEach(t=>{let r=e.fieldsIndex.normalizeFieldName(t);r&&n.push(r)});let{objectIdField:r}=e,i=e.fieldsIndex.normalizeFieldName(r)??r;return i&&!n.includes(i)&&n.unshift(i),n}get effectiveSelectionManager(){let{layer:e,view:t}=this;return e&&this.syncViewSelection&&F(e)&&t?.selectionManager?.sources.includes(e)?t.selectionManager:this.selectionManager??this.defaultSelectionManager}get effectiveSize(){let{_size:e,maxSize:t}=this;return t==null?e:Math.min(t,e)}get effectiveTimeExtent(){let{layer:e,timeExtent:t,view:n,viewTimeEnabled:r}=this;return t||!e?t??void 0:!n||!r?e.timeExtent??void 0:O({datesInUnknownTimezone:e.datesInUnknownTimezone??void 0,timeExtent:e.timeExtent,timeInfo:e.timeInfo,timeOffset:e.timeOffset,useViewTime:e.useViewTime},n.timeExtent,this._get(`effectiveTimeExtent`))??void 0}get effectiveWhere(){let{layer:e,where:t}=this;return t!=null&&t!==``?t:D(e)&&e.parent?.definitionExpression?e.parent.definitionExpression:e?.definitionExpression||`1=1`}get fieldsWithContingentValues(){return this._contingentValuesManager.getFieldsWithContingentValues(this.layer)}get hasContingentValues(){return this.fieldsWithContingentValues.size>0}get hasInvalidPendingEdits(){return this.hasPendingEdits&&this._pendingEditsAreInvalid}get hasPendingEdits(){return this.pendingEditsCount>0}get highlightableLayerView(){let e=this.layerView;return P(e)?e:null}get isQuerying(){return this._queryOperationInfos.size>0}get isSyncing(){return this.isSyncingFeatureEdits||this.isSyncingAttachmentEdits}get isSyncingAttachmentEdits(){return this._attachmentsOperationQueue.length>0}get isSyncingFeatureEdits(){return this._editOperationQueue.length>0}get itemCache(){return new o({items:[...this.pageCache.values()].flat()})}get layerView(){let{layer:e,view:t}=this;if(!e||!t)return null;let n=e.type===`sublayer`||D(e)?e.parent:e;return t.allLayerViews.find(e=>e.layer===n)}get orderByFields(){let{_sortedFieldNames:e,layer:t,sortOrders:n}=this,r=n.filter(({fieldName:t,direction:n},r)=>e.indexOf(t)===r&&n!=null).map(({fieldName:e,direction:t})=>`${e} ${t?.toUpperCase()}`);if(t&&!r.length&&!t.objectIdField&&t.fields?.length){let e=t.fields.find(e=>e.name);if(e){let n=t.fieldsIndex.normalizeFieldName(e.name);n&&r.push(`${n} ASC`)}}return r}get pageCount(){let{effectiveSize:e,pageSize:t}=this;return e===0||t===0?1:Math.ceil(e/t)}get pageIndex(){return this._get(`pageIndex`)||0}set pageIndex(e){let{pageCount:t}=this;V(e,t)&&this._set(`pageIndex`,e)}get pendingEditsCount(){let e=0;return this._pendingEditsCache.forEach(t=>e+=t.changes.size),e}get relationship(){let{relationshipConfig:e}=this;return e?.relationshipId==null?null:this.relationships?.find(t=>t.id===e.relationshipId)}get relationshipIds(){return this.relationships?.map(e=>e.id)??[]}get relationshipInfos(){let{_layerWithRelationships:e,relatedRecordsEnabled:t,relationships:n,view:r}=this,i=[];return t&&e?.loaded&&r?.map&&n?.length&&n.forEach(t=>{let n=H(e,r,t);n&&(n.load().catch(()=>{}),i.push({layer:e,relatedLayer:n,relationshipId:t.id}))}),i}get relationships(){return this._layerWithRelationships?.relationships}get size(){return this._size}get state(){let{layer:e,_loaded:t,_loadError:n}=this;return!e||e.destroyed?`disabled`:n||e.loadError?`error`:this._loadController?`loading`:e.loadStatus===`loaded`&&t?`loaded`:`ready`}get supportsAdd(){return!!this._capabilities?.operations.supportsAdd}get supportsAddAttachments(){return!!(this._layerWithAttachmentsEditing&&(this.supportsAdd||this.supportsUpdate))}get supportsAttachments(){let{_capabilities:e}=this;return!!(e?.data?.supportsAttachment&&e?.operations.supportsQueryAttachments)}get supportsCacheHint(){return!!this._capabilities?.query?.supportsCacheHint}get supportsCacheHintQueryRelated(){return!!this._capabilities?.queryRelated?.supportsCacheHint}get supportsDelete(){return!!this._capabilities?.operations.supportsDelete}get supportsEditing(){return!!this._capabilities?.operations.supportsEditing}get supportsM(){return!!this.layer?.hasM&&!!this._capabilities?.data?.supportsM}get supportsOrderBy(){return!!this._capabilities?.query?.supportsOrderBy}get supportsPagination(){return!!this._capabilities?.query?.supportsPagination}get supportsQuery(){return!!this._capabilities?.operations.supportsQuery}get supportsQueryRelated(){let{_capabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get supportsResizeAttachments(){let{_capabilities:e}=this;return!!(this.supportsAttachments&&e?.attachment?.supportsResize)}get supportsUpdate(){return!!this._capabilities?.operations.supportsUpdate}get supportsUpdateAttachments(){return!!(this._layerWithAttachmentsEditing&&(this.supportsAdd||this.supportsUpdate))}get supportsZ(){return!!this.layer?.hasZ&&!!this._capabilities?.data?.supportsZ}get visibleAtCurrentScale(){let{layer:e}=this;return!e||!this.effectiveFilterByLayerScaleRange?!1:C(e.effectiveScaleRange,this.view?.scale)}async addAttachment(e,t){let{_layerWithAttachmentsEditing:n}=this;if(!n||!this.supportsAddAttachments)return{};let r=await this._queueAttachmentsOperation(e,()=>n.addAttachment(this._createBaseGraphic(n,e),t));return this._ensureArrayContent(r)}addPendingEdits(e){let t=this._ensureLayerAndUpdateSupport();this.editingEnabled?(this.autoSaveEnabled&&this._logWarning(`store:pending-edit`,`Edit will be cached, but 'autoSaveEnabled' is true.`,!0),this._stashPendingEdits(t,e)):this._logWarning(`store:editing-disabled`,`Editing is disabled.`)}async deleteAttachments(e,t){let{_layerWithAttachmentsEditing:n}=this;if(!n||!this.supportsUpdateAttachments||!t.length)return[];let r=await this._queueAttachmentsOperation(e,()=>n.deleteAttachments(this._createBaseGraphic(n,e),t));return this._ensureArray(r)}async deleteRowsByObjectId(e){let{_layerWithEditing:t}=this;if(!this.supportsDelete||!t)throw new s(`store:delete-error`,`Delete is not supported.`);let n=e.map(e=>this.getItemByObjectId(e)?.feature).filter(i),r=this._queueEditOperation(()=>t.applyEdits({deleteFeatures:n}));return e.forEach(e=>{this.featureTitleMap.delete(e),this._discardPendingEdit({objectId:e})}),r}discardPendingEdits(e){if(e?.length)e.forEach(e=>this._discardPendingEdit(e));else{for(let[e,t]of this._pendingEditsCache){let n=this.getItemByObjectId(e);n&&(n.feature=t.originalFeature)}this._pendingEditsCache.clear(),this._clearOptionsAndViolations()}}itemHasInvalidPendingEdits(e,t){if(!this.hasInvalidPendingEdits)return!1;let n=this._layerWithContingentValues,r=this._pendingEditsCache.get(e);if(!n||!r)return!1;let i=this._getFeatureWithPendingEdits(e,r),a=this._contingentValuesManager;return t?!!a.getViolationForField(n,i,t):!!a.getAllViolations(n,i)}itemHasPendingEdits(e,t){let n=this._pendingEditsCache.get(e);return n?!t||n.changes.has(t):!1}async getAttachmentsByObjectId(e,t){let n=this.getItemByObjectId(e)?.attachments??[];return!n.length&&t?(await this._queryAttachments([e]))[e]??[]:n}getCachedFeaturesByPageIndex(e){return this.pageCache.get(e)}getFieldValueOptions(e){return this._contingentValuesManager.getFieldValueOptions(e)}async getFeatureTitle(e,n=!1){let{layer:r}=this,i=this.featureTitleMap.get(e),a=`${e}`;if(!r)return i||a;if(i&&!n)return i;if(!(`getFeatureTitle`in r)||!r.getFeatureTitle)return a;let o=this.getItemByObjectId(e)?.feature;o||=new t({attributes:{[r.objectIdField]:e},origin:r.graphicOrigin});let s=await r.getFeatureTitle(o,{fetchMissingFields:!0,removeHTML:!0});return s?(this.featureTitleMap.set(e,s),s):a}getItemByObjectId(e){for(let t of this.pageCache.values())for(let n of t)if(n.objectId===e)return n}getItemIndexByObjectId(e){let{pageCache:t,pageSize:n}=this,r=t.entries(),i=-1;for(let[t,a]of r)if(a.some((r,a)=>{let o=r.objectId===e;return o&&(i=t*n+a),o}),i>-1)break;return i}async load(){await m(this._loadDebounced())}async queryPage(e){let{layer:t,state:n}=this;if(!t||n!==`loaded`||!this.supportsQuery||this.size===0||this.maxSize===0)return[];let{pageIndex:r}=e;if(!V(r,this.pageCount))return[];let i=e.pageSize??this.pageSize,a=r*i,o=a+i;return await m(this._query({layer:t,start:a,num:o,pageIndex:r,pageSize:i}))??[]}async refresh(){await m(this._refreshDebounced())}reset(){this._reset()}async savePendingEdits(){let e=this._ensureLayerAndUpdateSupport();if(!this.editingEnabled){this._logWarning(`store:editing-disabled`,`Editing is disabled.`);return}if(this.autoSaveEnabled&&this._logWarning(`store:pending-edit`,`Edit will be cached, but 'autoSaveEnabled' is true.`,!0),!this._canSavePendingEdits){this._logError(`store:update-error`,`An error occurred. Unable to save pending edits.`);return}let t=[];for(let[e]of this._pendingEditsCache){let n=this.getItemByObjectId(e);n?.feature&&t.push(n.feature)}(await this._update(e,t,!0)).updateFeatureResults.find(e=>e.error)&&this.discardPendingEdits(),this._clearOptionsAndViolations()}syncSelectionSources(){let{defaultSelectionManager:e,layer:t,view:n}=this;e.view=n,e.sources.removeAll(),I(t)&&(e.sources.items=[t])}async updateAttachment(e,t,n){let{_layerWithAttachmentsEditing:r}=this;if(!r||!this.supportsUpdateAttachments)return{};let i=await this._queueAttachmentsOperation(e,()=>r.updateAttachment(this._createBaseGraphic(r,e),t,n));return this._ensureArrayContent(i)}async updateItem(e){let t=this._ensureLayerAndUpdateSupport();if(!this.editingEnabled){this._logWarning(`store:editing-disabled`,`Editing is disabled.`);return}if(this.hasContingentValues){let t=e.updates.some(e=>this.fieldsWithContingentValues.has(e.fieldName)),n=this.itemHasPendingEdits(e.objectId);if(n||t){let t=this._layerWithContingentValues,r=this.getItemByObjectId(e.objectId)?.feature?.clone();if(r){let i=this._contingentValuesManager.getAllViolations(t,r);if(e.updates.forEach(({fieldName:e,value:n})=>{let i=t.getField(e);i&&(r.attributes[i.name]=n)}),this._contingentValuesManager.validateContingencyConstraints(t,r).length||i.length||n){this._stashPendingEdits(t,[e]),this._contingentValuesManager.resetOptionsForLayer(t);return}}}}if(!this.autoSaveEnabled){this._stashPendingEdits(t,[e]);return}let{_sortedFieldNames:n}=this,r=e.updates.map(({fieldName:e})=>e),i=this._prepareEditsForUpdate([e]);!(await this._update(t,i)).updateFeatureResults.find(e=>e.error)&&r.some(e=>n.includes(e))&&this._clearCaches()}async verifyFeaturesByObjectId(e){let{layer:t,state:n}=this;if(!t||n!==`loaded`)return[];let{objectIdField:r}=t,i=await this._queryFeaturesByObjectId(e);return e.map(e=>i.some(t=>e===(t.getObjectId()??t.attributes[r])))}async _load(){let{layer:e}=this;if(this._reset(),!e)return;let t=new AbortController;this._loadController=t;try{if(await e.load(),e.parent&&E(e.parent)&&await e.parent.loadAll(),await e.when(),t.signal.aborted)return;let n=this.initialSize;if(this.initialSize=null,this.effectiveFilterByLayerScaleRange&&(this.visibleAtCurrentScale||(n=0)),await m(this._refresh(t,n)),t.signal.aborted){this._loadController=null;return}this._loaded=!0,this._loadController=null}catch(e){throw this._reset(),this._loadError=!0,this._logError(`store:load-error`,`An error occurred.`),e}}async _refresh(e,t){this._clearCaches();let n=e?.signal,r=await this._getSize(n,t),i=await this._queryAllObjectIds(n);n?.aborted||(this._size=r,this._objectIdCache.removeAll(),i?.length&&this._objectIdCache.addMany(i),this._syncPendingEdits())}async _queryAllObjectIds(e){return this.supportsPagination?void 0:await this._queryObjectIds(e)}_clearCaches(){this.pageCache.clear(),this._objectIdCache.removeAll()}_createBaseGraphic(e,n){let r=new t({attributes:{[e.objectIdField]:n}});return this._subtypeField&&this._subtypeCode!=null&&(r.attributes[this._subtypeField]=this._subtypeCode),r}_ensureArray(e){return Array.isArray(e)?e:[e]}_ensureArrayContent(e){return Array.isArray(e)?e[0]:e}_getObjectIdsForFeatures(e,t){return e.map(e=>e.getObjectId()??e.attributes[t.objectIdField])}_getObjectIdsForPage(e,t){let n=this._objectIdCache.toArray();return n.length>=e+t?n.slice(e,e+t):n.slice(e)}_logError(e,t){l.getLogger(this).error(e,t)}_logWarning(e,t,n=!1){n?l.getLogger(this).warnOnce(e,t):l.getLogger(this).warn(e,t)}_reset(){this._clearCaches(),this._pendingEditsCache.clear(),this.failures.removeAll(),this._attachmentsOperationQueue.removeAll(),this._editOperationQueue.removeAll(),this.featureTitleMap.clear(),this._loadController=f(this._loadController),this._queryOperationInfos.forEach(e=>e.controller.abort()),this._queryOperationInfos.clear(),this._temporaryHighlight=d(this._temporaryHighlight?.handle),this._temporaryHighlightAbortController=f(this._temporaryHighlightAbortController),this._loaded=!1,this._loadError=!1,this._size=0}async _getSize(e,t){return this.maxSize===0?0:t??await this._queryCount(e)}async _queryFeaturesByObjectId(e){let{layer:t}=this;if(!t||!this.supportsQuery)throw new s(`store:query-error`,`Layer does not support query operation.`);let{effectiveTimeExtent:n,effectiveWhere:r,orderByFields:i,supportsCacheHint:a,supportsOrderBy:o}=this,c=t.createQuery();return c.where=r,c.timeExtent=n,c.returnGeometry=!1,c.objectIds=e.length?e:void 0,c.outFields=[t.objectIdField],o&&(c.orderByFields=i),a&&(c.cacheHint=!0),(await t.queryFeatures(c)).features}async _syncTemporaryHighlight(e,t){let{highlightEnabled:n,highlightableLayerView:r}=this;r&&n&&e!=null&&(h(t),this._temporaryHighlight={id:e,handle:r.highlight(e,{name:N})})}_ensureLayerAndUpdateSupport(){let e=this._layerWithEditing;if(!e||!this.supportsUpdate)throw new s(`store:update-error`,`Update is not supported.`);return e}_stashPendingEdits(e,t){t.forEach(({objectId:t,updates:n})=>{let r=this.getItemByObjectId(t)?.feature;if(!r)throw new s(`store:update-error`,`Feature with provided 'objectId' not found.`);let i=r.clone(),a=u(this._pendingEditsCache,t,()=>({originalFeature:i,changes:new g}));n.forEach(({fieldName:t,value:n})=>{let i=e.getField(t);i?(a.changes.set(i.name,n),r.attributes[i.name]=n):this._logWarning(`store:pending-edit-unknown-field`,`The provided field does not belong to this layer.`)}),a.changes.size>0&&this._pendingEditsCache.set(t,a)})}_syncPendingEdits(){for(let[e,t]of this._pendingEditsCache){let n=this.getItemByObjectId(e)?.feature;if(n){let e=n.clone();for(let[e,r]of t.changes)n.attributes[e]=r;t.originalFeature=e}}}_getFeatureWithPendingEdits(e,t){let n=this.getItemByObjectId(e)?.feature;if(!n){n=t.originalFeature.clone();for(let[e,r]of t.changes)n.attributes[e]=r}return n}_discardPendingEdit({objectId:e,fieldName:t}){let n=this._pendingEditsCache.get(e);if(!n){this._logWarning(`store:pending-edit-not-found`,`Could not find a pending edit with the given information`);return}let r=this.getItemByObjectId(e);t?(r&&(r.feature.attributes[t]=n.originalFeature.attributes[t]),n.changes.delete(t),n.changes.size===0&&this._pendingEditsCache.delete(e)):(r&&(r.feature=n.originalFeature),this._pendingEditsCache.delete(e))}_clearOptionsAndViolations(){let{_layerWithContingentValues:e,_contingentValuesManager:t}=this;e&&(t.resetOptionsForLayer(e),t.resetViolationsForLayer(e))}_prepareEditsForUpdate(e){let n=[];return e.forEach(({objectId:e,updates:r})=>{let i=this.getItemByObjectId(e)?.feature;if(!i)return;let a=c(i.attributes);r.forEach(({fieldName:e,value:t})=>a[e]=t),n.push(new t({attributes:a,sourceLayer:i.sourceLayer}))}),n}_update(e,t,n=!1){let r=e.applyEdits({updateFeatures:t}).then(n=>{let{updateFeatureResults:r}=n,i=r.find(e=>!!e.error);if(i)throw i.error;return t.forEach(t=>{let n=t.getObjectId()??t.attributes[e.objectIdField],r=this.getItemByObjectId(n)?.feature;r&&(r.attributes=t.attributes),this.featureTitleMap.has(n)&&this.getFeatureTitle(n,!0)}),n});return this._queueEditOperation(()=>r,n)}_createFeatureStoreItems(e){let{attachments:t,features:n,layer:r,relatedRecords:i}=e,a=r.objectIdField;return n.map(e=>{let n=e.getObjectId()??e.attributes[a],o=[];!e.layer&&!e.sourceLayer&&(e.layer=r,e.sourceLayer=r);let s=this._pendingEditsCache.get(n);if(s){let t=e.clone(),n=s.changes;for(let[t,r]of n)e.attributes[t]=r;s.originalFeature=t}return i.forEach((e,t)=>{o.push({relationshipId:t,count:e[n]??0})}),{objectId:n,feature:e,attachments:t[n]??null,relatedRecords:o}})}async _query(e){let{pageIndex:t,refresh:n}=e;n===!0&&await this._refresh();let r=this.pageCache.get(t);if(r)return r;let i=this._queryOperationInfos.get(t);if(i)return i.task.promise;let a=new AbortController,o=await this._queryPage(e,a);return a.signal.aborted||this.pageCache.set(t,o),o}_queryAttachments(e,t){let{_layerWithAttachments:n,effectiveWhere:r}=this;return n?e.some(e=>typeof e!=`number`)?Promise.reject(new s(`invalid-object-id`,`Only numeric object ids are valid to query attachments`)):n.queryAttachments(new k({objectIds:e,where:r,returnMetadata:!0}),{signal:t}):Promise.resolve({})}async _queryCount(e){let{_relatedLayerSupportsCacheHint:t,layer:n,relationshipConfig:r,supportsCacheHint:i}=this;if(!n)return 0;if(r&&this._canUseRelatedLayer){let{objectId:n,relatedLayer:i,relationshipId:a}=r;return(await i.queryRelatedFeaturesCount(new A({cacheHint:t,relationshipId:a,objectIds:[n]}),{signal:e}))[n]??0}let{effectiveTimeExtent:a,effectiveWhere:o,filterGeometry:s,objectIds:c}=this,l=n.createQuery();return l.geometry=s,l.returnGeometry=!1,l.where=o,l.timeExtent=a,l.objectIds=c?.length?c:void 0,i&&(l.cacheHint=!0),n.queryFeatureCount(l,{signal:e})}async _queryFeatures(e,t){let{relationshipConfig:n}=this;if(n&&this._canUseRelatedLayer)return this._queryRelatedFeatures(e,n);let{_effectiveReturnM:r,_effectiveReturnZ:i,effectiveOutFields:a,effectiveTimeExtent:o,effectiveWhere:s,filterGeometry:c,objectIds:l,orderByFields:u,pageSize:d,returnGeometry:f,supportsCacheHint:p,supportsOrderBy:m,supportsPagination:h}=this,{layer:g,start:_}=e,v=l?.length,y=g.createQuery();return y.returnGeometry=f,y.outFields=a,y.returnM=r,y.returnZ=i,h?(y.start=_,y.num=d,y.where=s,y.timeExtent=o,y.objectIds=v?l:void 0):y.objectIds=v?l:this._getObjectIdsForPage(_,d??0),m&&(y.orderByFields=u),c&&(y.geometry=c),p&&(y.cacheHint=!0),(await g.queryFeatures(y,{signal:t})).features}_queryObjectIds(e){let{effectiveTimeExtent:t,effectiveWhere:n,filterGeometry:r,layer:i,objectIds:a,orderByFields:o,supportsCacheHint:s,supportsOrderBy:c}=this;if(!i)return Promise.resolve([]);let l=i.createQuery();return l.geometry=r,l.outFields=[i.objectIdField],l.returnGeometry=!1,l.where=n,l.timeExtent=t,l.objectIds=a?.length?a:void 0,c&&(l.orderByFields=o),s&&(l.cacheHint=!0),i.queryObjectIds(l,{signal:e})}async _queryPage(e,t){return this._queueQueryOperation(e.pageIndex,{controller:t,task:a(async()=>this._queryPageData(e,t))})}async _queryPageData(e,t){let{layer:n}=e,{signal:r}=t,i=await this._queryFeatures(e,r);if(r.aborted)return[];let a=this._getObjectIdsForFeatures(i,n),[o,s]=await Promise.all([this._queryAttachments(a,r),this._queryRelatedCounts(a,r)]);return t.signal.aborted?[]:this._createFeatureStoreItems({layer:n,features:i,attachments:o,relatedRecords:s})||[]}async _queryRelatedCounts(e,t){let{_layerWithRelationships:n,relationshipIds:r,supportsCacheHintQueryRelated:i}=this,a=new Map;return n&&e?.length&&r.length&&await Promise.allSettled(r.map(async r=>{let o=await n.queryRelatedFeaturesCount(new A({cacheHint:i,relationshipId:r,objectIds:e}),{signal:t});a.set(r,o)})),a}async _queryRelatedFeatures(e,t){let{_defaultOutFields:n,_effectiveReturnM:r,_effectiveReturnZ:i,orderByFields:a,pageSize:o,returnGeometry:s,supportsCacheHint:c}=this,{layer:l,start:u}=e,{objectId:d,relatedLayer:f,relationshipId:p}=t,m=l.createQuery(),h=new A({cacheHint:c,num:o,objectIds:[d],orderByFields:a,outFields:n,relationshipId:p,returnGeometry:s,returnM:r,returnZ:i,start:u,where:m.where??void 0});return(await f.queryRelatedFeatures(h))[d]?.features||[]}_queueAttachmentsOperation(e,t){return this._attachmentsOperationQueue.push(t),t().then(async n=>{this._attachmentsOperationQueue.remove(t);let r=this._ensureArray(n),i=r.some(e=>e.error),a=this.getItemByObjectId(e);return a&&(!i||r.length>1)&&(a.attachments=(await this._queryAttachments([e]))[e]),n}).catch(async n=>{this._logError(`store:attachment-error`,`An error occurred.`);let r={error:n,retry:()=>{this.failures.remove(r),this._queueAttachmentsOperation(e,t)},cancel:()=>this.failures.remove(r)};throw this.failures.add(r),this._attachmentsOperationQueue.remove(t),n})}_queueEditOperation(e,t=!1){return this._editOperationQueue.push(e),e().then(n=>(this._editOperationQueue.remove(e),t&&this._pendingEditsCache.clear(),n)).catch(t=>{this._logError(`store:edit-error`,`An error occurred.`);let n={error:t,retry:()=>{this.failures.remove(n),this._queueEditOperation(e)},cancel:()=>this.failures.remove(n)};throw this.failures.add(n),this._editOperationQueue.remove(e),t})}async _queueQueryOperation(e,t){this._queryOperationInfos.set(e,t);let n=await t.task.promise;return this._queryOperationInfos.delete(e),n}};e([x()],W.prototype,`_attachmentsOperationQueue`,void 0),e([x({readOnly:!0})],W.prototype,`_capabilities`,null),e([x()],W.prototype,`_canSavePendingEdits`,null),e([x()],W.prototype,`_contingentValuesManager`,void 0),e([x()],W.prototype,`_defaultOutFields`,void 0),e([x()],W.prototype,`_editOperationQueue`,void 0),e([x()],W.prototype,`_effectiveReturnZ`,null),e([x()],W.prototype,`_effectiveReturnM`,null),e([x()],W.prototype,`featureTitleMap`,void 0),e([x({readOnly:!0})],W.prototype,`_layerWithAttachments`,null),e([x({readOnly:!0})],W.prototype,`_layerWithAttachmentsEditing`,null),e([x()],W.prototype,`_layerWithContingentValues`,null),e([x({readOnly:!0})],W.prototype,`_layerWithEditing`,null),e([x({readOnly:!0})],W.prototype,`_layerWithRelationships`,null),e([x()],W.prototype,`_loaded`,void 0),e([x()],W.prototype,`_loadController`,void 0),e([x()],W.prototype,`_loadError`,void 0),e([x()],W.prototype,`_objectIdCache`,void 0),e([x()],W.prototype,`_pendingEditsCache`,void 0),e([x()],W.prototype,`_pendingEditsAreInvalid`,null),e([x()],W.prototype,`_queryOperationInfos`,void 0),e([x({readOnly:!0})],W.prototype,`_relatedLayer`,null),e([x({readOnly:!0})],W.prototype,`_relatedLayerCapabilities`,null),e([x({readOnly:!0})],W.prototype,`_relatedLayerSupportsCacheHint`,null),e([x()],W.prototype,`_relatedLayerSupportsQuery`,null),e([x()],W.prototype,`_relatedLayerSupportsQueryRelated`,null),e([x()],W.prototype,`_size`,void 0),e([x()],W.prototype,`_sortedFieldNames`,null),e([x()],W.prototype,`_subtypeCode`,null),e([x()],W.prototype,`_subtypeField`,null),e([x()],W.prototype,`_canUseRelatedLayer`,null),e([x()],W.prototype,`attachmentsEnabled`,void 0),e([x()],W.prototype,`autoSaveEnabled`,void 0),e([x()],W.prototype,`cachedPageCount`,null),e([x()],W.prototype,`canAddRelatedFeature`,null),e([x()],W.prototype,`defaultSelectionManager`,void 0),e([x()],W.prototype,`editingEnabled`,void 0),e([x()],W.prototype,`effectiveFilterByLayerScaleRange`,null),e([x()],W.prototype,`effectiveOutFields`,null),e([x()],W.prototype,`effectiveSelectionManager`,null),e([x()],W.prototype,`effectiveSize`,null),e([x()],W.prototype,`effectiveTimeExtent`,null),e([x()],W.prototype,`effectiveWhere`,null),e([x({readOnly:!0})],W.prototype,`failures`,void 0),e([x()],W.prototype,`fieldsWithContingentValues`,null),e([x()],W.prototype,`filterByViewExtent`,void 0),e([x()],W.prototype,`filterByLayerScaleRange`,void 0),e([x({types:w})],W.prototype,`filterGeometry`,void 0),e([x()],W.prototype,`hasContingentValues`,null),e([x()],W.prototype,`hasInvalidPendingEdits`,null),e([x()],W.prototype,`hasPendingEdits`,null),e([x()],W.prototype,`highlightEnabled`,void 0),e([x()],W.prototype,`highlightableLayerView`,null),e([x()],W.prototype,`initialSize`,void 0),e([x({readOnly:!0})],W.prototype,`isQuerying`,null),e([x({readOnly:!0})],W.prototype,`isSyncing`,null),e([x({readOnly:!0})],W.prototype,`isSyncingAttachmentEdits`,null),e([x({readOnly:!0})],W.prototype,`isSyncingFeatureEdits`,null),e([x({readOnly:!0})],W.prototype,`itemCache`,null),e([x()],W.prototype,`layer`,void 0),e([x()],W.prototype,`layerView`,null),e([x()],W.prototype,`maxSize`,void 0),e([x()],W.prototype,`objectIds`,void 0),e([x()],W.prototype,`orderByFields`,null),e([x()],W.prototype,`outFields`,void 0),e([x({readOnly:!0})],W.prototype,`pageCache`,void 0),e([x()],W.prototype,`pageCount`,null),e([x()],W.prototype,`pageIndex`,null),e([x()],W.prototype,`pageSize`,void 0),e([x()],W.prototype,`paginationEnabled`,void 0),e([x()],W.prototype,`pendingEditsCount`,null),e([x()],W.prototype,`relationship`,null),e([x()],W.prototype,`relationshipConfig`,void 0),e([x()],W.prototype,`relationshipIds`,null),e([x()],W.prototype,`relationshipInfos`,null),e([x()],W.prototype,`relationships`,null),e([x()],W.prototype,`relatedRecordsEnabled`,void 0),e([x()],W.prototype,`returnGeometry`,void 0),e([x()],W.prototype,`returnZ`,void 0),e([x()],W.prototype,`returnM`,void 0),e([x()],W.prototype,`selectionManager`,void 0),e([x({readOnly:!0})],W.prototype,`size`,null),e([x()],W.prototype,`sortOrders`,void 0),e([x({readOnly:!0})],W.prototype,`state`,null),e([x()],W.prototype,`supportsAdd`,null),e([x()],W.prototype,`supportsAddAttachments`,null),e([x()],W.prototype,`supportsAttachments`,null),e([x()],W.prototype,`supportsCacheHint`,null),e([x()],W.prototype,`supportsCacheHintQueryRelated`,null),e([x()],W.prototype,`supportsDelete`,null),e([x()],W.prototype,`supportsEditing`,null),e([x()],W.prototype,`supportsM`,null),e([x()],W.prototype,`supportsOrderBy`,null),e([x()],W.prototype,`supportsPagination`,null),e([x()],W.prototype,`supportsQuery`,null),e([x()],W.prototype,`supportsQueryRelated`,null),e([x()],W.prototype,`supportsResizeAttachments`,null),e([x()],W.prototype,`supportsUpdate`,null),e([x()],W.prototype,`supportsUpdateAttachments`,null),e([x()],W.prototype,`supportsZ`,null),e([x()],W.prototype,`syncViewSelection`,void 0),e([x()],W.prototype,`temporaryHighlightId`,void 0),e([x({type:j})],W.prototype,`timeExtent`,void 0),e([x()],W.prototype,`timeZone`,void 0),e([x()],W.prototype,`view`,void 0),e([x()],W.prototype,`viewTimeEnabled`,void 0),e([x()],W.prototype,`visibleAtCurrentScale`,null),e([x()],W.prototype,`where`,void 0),W=e([S(`esri.widgets.FeatureTable.support.FeatureStore`)],W);const G=W;export{G as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"./AttachmentsColumnTemplate.js";import a from"./ColumnTemplate.js";import o from"./ColumnTemplateBase.js";import{isTemplateObjectWithType as s}from"./columnUtils.js";import c from"./FieldColumnTemplate.js";import l from"./RelationshipColumnTemplate.js";let u=class extends o{constructor(e){super(e),this.type=`group`}get columnTemplates(){return this._get(`columnTemplates`)}set columnTemplates(e){(!e||!Array.isArray(e))&&(e=[]);let n=[];e.forEach(e=>{if(e instanceof c||e instanceof a||e instanceof i||e instanceof l)n.push(e);else if(s(e)){let r=e.type;r===`field`?n.push(new c(e)):r===`group`?t.getLogger(this).warn(`A GroupColumnTemplate cannot contain other GroupColumn templates. Template removed from 'GroupColumnTemplate.columnTemplates'.`):r===`column`?n.push(new a(e)):r===`attachment`?n.push(new i(e)):r===`relationship`&&n.push(new l(e))}else t.getLogger(this).warn(`Property 'type' is missing from the provided template. Template removed from 'tableTemplate.columnTemplates'.`)}),this._set(`columnTemplates`,n)}};e([n({json:{write:!0}})],u.prototype,`columnTemplates`,null),e([n({type:String,json:{read:!1,write:!0}})],u.prototype,`type`,void 0),u=e([r(`esri.widgets.FeatureTable.support.GroupColumnTemplate`)],u);const d=u;export{d as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"./AttachmentsColumnTemplate.js";import a from"./ColumnTemplate.js";import o from"./ColumnTemplateBase.js";import{isTemplateObjectWithType as s}from"./columnUtils.js";import c from"./FieldColumnTemplate.js";import l from"./RelationshipColumnTemplate.js";let u=class extends o{constructor(e){super(e),this.type=`group`}get columnTemplates(){return this._get(`columnTemplates`)}set columnTemplates(e){e&&Array.isArray(e)||(e=[]);let n=[];e.forEach(e=>{if(e instanceof c||e instanceof a||e instanceof i||e instanceof l)n.push(e);else if(s(e)){let r=e.type;r===`field`?n.push(new c(e)):r===`group`?t.getLogger(this).warn(`A GroupColumnTemplate cannot contain other GroupColumn templates. Template removed from 'GroupColumnTemplate.columnTemplates'.`):r===`column`?n.push(new a(e)):r===`attachment`?n.push(new i(e)):r===`relationship`&&n.push(new l(e))}else t.getLogger(this).warn(`Property 'type' is missing from the provided template. Template removed from 'tableTemplate.columnTemplates'.`)}),this._set(`columnTemplates`,n)}};e([n({json:{write:!0}})],u.prototype,`columnTemplates`,null),e([n({type:String,json:{read:!1,write:!0}})],u.prototype,`type`,void 0),u=e([r(`esri.widgets.FeatureTable.support.GroupColumnTemplate`)],u);const d=u;export{d as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../../../core/Clonable.js";import{JSONSupport as n}from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"./AttachmentsColumnTemplate.js";import s from"./ColumnTemplate.js";import{isTemplateObjectWithType as c}from"./columnUtils.js";import l from"./FieldColumnTemplate.js";import u from"./GroupColumnTemplate.js";import d from"./RelationshipColumnTemplate.js";let f=class extends t(n){constructor(e){super(e),this.columnTemplates=[]}get columnTemplates(){return this._get(`columnTemplates`)}set columnTemplates(e){(!e||!Array.isArray(e))&&(e=[]);let t=[];e.forEach(e=>{if(e instanceof l||e instanceof u||e instanceof s||e instanceof o||e instanceof d)t.push(e);else if(c(e)){let n=e.type;n===`field`?t.push(new l(e)):n===`group`?t.push(new u(e)):n===`column`?t.push(new s(e)):n===`attachment`?t.push(new o(e)):n===`relationship`&&t.push(new d(e))}else r.getLogger(this).warn(`Property 'type' is missing from the provided template. Template removed from 'tableTemplate.columnTemplates'.`)}),this._set(`columnTemplates`,t)}};e([i()],f.prototype,`columnTemplates`,null),f=e([a(`esri.widgets.FeatureTable.support.TableTemplate`)],f);const p=f;export{p as default};
2
+ import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../../../core/Clonable.js";import{JSONSupport as n}from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"./AttachmentsColumnTemplate.js";import s from"./ColumnTemplate.js";import{isTemplateObjectWithType as c}from"./columnUtils.js";import l from"./FieldColumnTemplate.js";import u from"./GroupColumnTemplate.js";import d from"./RelationshipColumnTemplate.js";let f=class extends t(n){constructor(e){super(e),this.columnTemplates=[]}get columnTemplates(){return this._get(`columnTemplates`)}set columnTemplates(e){e&&Array.isArray(e)||(e=[]);let t=[];e.forEach(e=>{if(e instanceof l||e instanceof u||e instanceof s||e instanceof o||e instanceof d)t.push(e);else if(c(e)){let n=e.type;n===`field`?t.push(new l(e)):n===`group`?t.push(new u(e)):n===`column`?t.push(new s(e)):n===`attachment`?t.push(new o(e)):n===`relationship`&&t.push(new d(e))}else r.getLogger(this).warn(`Property 'type' is missing from the provided template. Template removed from 'tableTemplate.columnTemplates'.`)}),this._set(`columnTemplates`,t)}};e([i()],f.prototype,`columnTemplates`,null),f=e([a(`esri.widgets.FeatureTable.support.TableTemplate`)],f);const p=f;export{p as default};
package/widgets/Print.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{JSONMap as i}from"../core/jsonMap.js";import a from"../core/Logger.js";import{watch as o,on as s,whenOnce as c}from"../core/reactiveUtils.js";import{unitName as l}from"../core/unitFormatUtils.js";import{addProxy as u,hasSameOrigin as d}from"../core/urlUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureInteger as m}from"../core/accessorSupport/ensureType.js";import h from"../geometry/SpatialReference.js";import{isValid as g}from"../geometry/support/spatialReferenceUtils.js";import _ from"../portal/Portal.js";import{reArcGISOnlineDomain as v}from"../portal/support/urlUtils.js";import{findToken as y}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import x from"./Widget.js";import S from"./Print/FileLink.js";import C from"./Print/PrintViewModel.js";import w from"./Print/TemplateOptions.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{Heading as D}from"./support/Heading.js";import{legacyIcon as O}from"./support/legacyIcon.js";import{messageBundle as k,tsx as A,isRTL as j,tsxFragment as M,isActivationKey as N}from"./support/widget.js";const P=`map-only`,F=`esri-print`,I={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function L(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function R(e){return e?.toLowerCase()===P}function z(e){let{state:t,extension:n}=e;switch(t){case`pending`:return`spinner`;case`error`:return`exclamation-mark-circle`;default:return n?.toLowerCase()?.includes(`pdf`)?`file-pdf`:`file`}}const B=new i({inch:`inches`,foot:`feet`,yard:`yards`,mile:`miles`,"nautical-mile":`nautical-miles`,millimeter:`millimeters`,centimeter:`centimeters`,decimeter:`decimeters`,meter:`meters`,kilometer:`kilometers`}),V=new Map([[`a3-landscape`,`a3-landscape`],[`a3-portrait`,`a3-portrait`],[`a4-landscape`,`a4-landscape`],[`a4-portrait`,`a4-portrait`],[`letter-ansi-a-landscape`,`ansi-a-landscape`],[`letter-ansi-a-portrait`,`ansi-a-portrait`],[`tabloid-ansi-b-landscape`,`ansi-b-landscape`],[`tabloid-ansi-b-portrait`,`ansi-b-portrait`]]);let H=class extends x{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab=`layoutTab`,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new C,this._onInput=e=>{this._selectedTab===`layoutTab`?this.templateOptions.title=e.currentTarget.value:this._selectedTab===`mapOnlyTab`&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{let t=e.currentTarget[`data-item`];if(!t||t.state!==`ready`||!t.url)return;let n=y(this.viewModel.effectivePrintServiceUrl),r=t.url,i=document.createElement(`a`);if(i.target=`_blank`,i.href=r,i.rel=`noreferrer`,i.download=t.formattedName??``,!n){i.click(),e.stopPropagation();return}e.preventDefault();let a=new URL(r);a.searchParams.set(`token`,n),i.href=a.href,i.click(),i.href=r},r(a.getLogger(this),`Print`,`arcgis-print`,{version:`4.33`}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{let{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){let t=b.apiValues;this._formats=e.format.choiceList.map(e=>{let n=t.find(t=>RegExp(`\\b${t}\\b`,`i`).test(e))??e;return{value:n,label:e===n?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}let t=this._formats.some(({value:e})=>RegExp(`\\b${e}\\b`,`i`).test(this.templateOptions.format));if(e.format.defaultValue&&!t){let t=this._formats.find(({value:t})=>RegExp(`\\b${t}\\b`,`i`).test(e.format.defaultValue))?.value;t&&(this.templateOptions.format=t)}}),o(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{let{layout:e}=this.templateOptions;this._selectedTab=R(e)?`mapOnlyTab`:`layoutTab`,this._selectedTab===`layoutTab`&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),o(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),o(()=>this.viewModel.view?.scale,e=>{e&&(!this.templateOptions.scaleEnabled||!this.templateOptions.scale)&&(this.templateOptions.scale=e)}),s(()=>this.viewModel,`submit`,e=>this.emit(`submit`,e)),s(()=>this.viewModel,`complete`,e=>this.emit(`complete`,e))]);let{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;let n=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(n),this._awaitingServerResponse=!1},()=>{})}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),link:()=>import(`@esri/calcite-components/dist/components/calcite-link`)})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return`print`}set icon(e){this._overrideIfSome(`icon`,e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{messages:e,templateOptions:t,viewModel:n,view:r}=this,{attributionEnabled:i,author:a,copyright:o,dpi:s,format:c,height:l,layout:u,layoutItem:d,legendEnabled:f,northArrowEnabled:p,scaleBarEnabled:_,scaleEnabled:v,scale:y,width:b}=t,x=n.state!==`ready`||this._awaitingServerResponse||!(u||d),S=this._renderTitleOrFileNameSection(),C=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.fileFormatTitle,A(`calcite-combobox`,{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??`pdf`}},this._formats.map(({value:e,label:t},n)=>A(`calcite-combobox-item`,{heading:t,key:`file-format-${n}`,selected:e===this.templateOptions.format,value:e}))))),w=A(`calcite-label`,{layout:`inline`},A(`calcite-switch`,{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),T=A(`div`,null,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.template,A(`calcite-block`,{class:I.templateSelectContainer,description:this._getPageSizeLabel(this._selectedTemplate),expandable:!1,heading:this._getTemplateLabel(this._selectedTemplate,!0),key:`template-select-block`,label:e.template,loading:this._selectedTemplate?.state===`loading`,tabIndex:0,onclick:()=>this._showTemplates=!0,onkeydown:e=>{(e.key===`Enter`||e.key===` `)&&(this._showTemplates=!0)}},A(`calcite-icon`,{class:I.templateSelectIcon,icon:(this._selectedTemplate?.layout?V.get(this._selectedTemplate.layout):null)||`custom-print`,key:`template-select-icon`,scale:`l`,slot:`content-start`}),this._selectedTemplate?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-select-error`,scale:`s`,slot:`actions-end`}):null,A(`calcite-icon`,{class:I.templateSelectArrow,icon:j()?`chevron-left`:`chevron-right`,key:`template-select-arrow`,scale:`s`,slot:`actions-end`})))),w),k=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.dpi,A(`calcite-input-number`,{bind:this,"data-input-name":`dpi`,min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),M=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,A(`div`,{class:I.srLabel},e.outSpatialReference,A(`calcite-link`,{href:`https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/`,target:`_blank`},`(WKID)`)),A(`calcite-input-number`,{bind:this,"data-input-name":`outSpatialReference`,integer:!0,numberButtonType:`none`,value:n.outSpatialReference?.wkid?.toString()??``,onCalciteInputNumberInput:({currentTarget:e})=>{let t=m(e.value);n.outSpatialReference=Number.isNaN(t)||t==null?null:new h({wkid:t}),this._isValidSpatialReference=!n.outSpatialReference||g(n.outSpatialReference)}}),this._isValidSpatialReference?null:A(`div`,{class:I.invalidWkidText,key:`out-sr-${n.outSpatialReference?.wkid}`},e.invalidWkid))),N=A(`div`,{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:v,"data-option-name":`scaleEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),A(`div`,{class:I.scaleInputContainer},A(`calcite-input-number`,{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:I.scaleInput,"data-input-name":`scale`,disabled:!v,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),A(`calcite-button`,{appearance:`outline`,"aria-label":e.reset,bind:this,disabled:!v,iconStart:`refresh`,kind:`neutral`,onclick:this._resetToCurrentScale}))),P=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer,key:`advanced-section-for-layout`},N,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??!0?A(`div`,{class:I.formSectionContainer,key:`author-info`},A(`calcite-label`,null,e.author,A(`calcite-input`,{bind:this,"data-input-name":`author`,value:a??``,onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??!0?A(`div`,{class:I.formSectionContainer,key:`copyright-text`},A(`calcite-label`,null,e.copyright,A(`calcite-input`,{bind:this,"data-input-name":`copyright`,value:o??``,onCalciteInputInput:this._updateInputValue}))):null,k,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??!0?A(`div`,{class:I.formSectionContainer,key:`legend-info`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!f,"data-option-name":`legendEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?A(`div`,{class:I.formSectionContainer,key:`north-arrow`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!p,"data-option-name":`northArrowEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?A(`div`,{class:I.formSectionContainer,key:`scale-bar`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!_,"data-option-name":`scaleBarEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),F=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},N,k,M,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:i,"data-option-name":`attributionEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),L=this.exportedLinks.toArray(),R=this._renderExportedLinkItems(L),z={[I.exportSectionCentered]:!L.length},B=this._selectedTab===`layoutTab`?A(`section`,{"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,id:`${this.id}__layoutContent`,key:`esri-print__layoutContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??!0?S:null,T,this._selectedTab===`layoutTab`?C:null,A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),disabled:!(u||d?.id),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForLayout`,key:`advanced-options-for-layout`},P))):this._selectedTab===`mapOnlyTab`?A(`section`,{"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:`esri-print__mapOnlyContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},S,C,A(`div`,null,A(`div`,{class:this.classes(I.sizeContainer,I.formSectionContainer)},A(`calcite-label`,null,e.width,A(`calcite-input-number`,{bind:this,"data-input-name":`width`,value:`${b}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`calcite-label`,null,e.height,A(`calcite-input-number`,{bind:this,"data-input-name":`height`,value:`${l}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`button`,{"aria-label":e.swap,bind:this,class:this.classes(E.widgetButton,I.swapButton,O.swap),type:`button`,onclick:this._switchInput})),w),A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForMapOnly`,key:`advanced-options-for-map-only`},F))):A(`section`,{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(I.exportSection,z),id:`${this.id}__exportContent`,key:`esri-print__exportContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},A(`div`,{afterUpdate:this._scrollExportIntoView,bind:this,class:I.exportedFilesContainer},L.length===0?A(`div`,{class:I.exportedFilesEmpty},A(`calcite-icon`,{icon:`file`,scale:`l`}),A(`div`,null,A(D,{class:I.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),A(`div`,null,e.exportHint))):R))),H=r?.type!==`2d`,U=A(`div`,{class:I.panelError},r?H?e.sceneViewError:e.serviceError:e.noViewError),W=L.some(({state:e})=>e===`pending`),G=A(`div`,{class:I.content,key:`panel`},A(`div`,null,A(`ul`,{bind:this,class:I.layoutTabList,role:`tablist`,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown},A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`layoutTab`}`,class:I.layoutTab,"data-tab-id":`layoutTab`,id:`${this.id}__layoutTab`,role:`tab`,tabIndex:0},e.layoutTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`mapOnlyTab`}`,class:I.layoutTab,"data-tab-id":`mapOnlyTab`,id:`${this.id}__mapOnlyTab`,role:`tab`,tabIndex:0},e.mapOnlyTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`exportTab`}`,class:I.layoutTab,"data-tab-id":`exportTab`,id:`${this.id}__exportedFilesTab`,role:`tab`,tabIndex:0},W?A(`calcite-loader`,{inline:!0,label:`loading`,scale:`s`}):null,e.exportsTab)),B),this._selectedTab===`exportTab`?null:A(`div`,{class:this.classes(I.printButtonSection,!this.saveExportHidden&&this.portal?I.printButtonSectionDivider:null),key:`export-button-section`},!this.saveExportHidden&&this.portal?A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,A(`calcite-button`,{"aria-label":e.exportDescription,bind:this,class:this.classes(I.printButton),disabled:x||!(u||d?.id)&&!c,scale:`l`,width:`full`,onclick:this._handlePrintMap},e.export))),K=A(`calcite-flow`,{key:`root-flow`},A(`calcite-flow-item`,{bind:this,key:`root-flow-item`,selected:!this._showTemplates},A(`div`,{class:I.printWidgetContainer},this.headerVisible?A(`header`,{class:I.headerTitle},e.export):null,this.error||H||!r?U:G)),this._renderChooseTemplateFlowItem()),q=n.state===`initializing`,J=q?this._renderLoader():K,Y={[I.panelItemsCentered]:q};return A(`div`,{bind:this,class:this.classes(I.base,E.widget,E.panel,Y)},J)}_getPageSizeLabel(e){if(!e)return;let n=e.layoutTemplateInfo;if(!n)return;let r=B.fromJSON(n.pageUnits.toLowerCase());return`${t(n.pageSize[0])} \u00D7 ${t(n.pageSize[1])} ${l(this.messagesUnits,r,`abbr`)}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;let{label:n,layout:r,layoutItem:i}=e;return(r&&!i&&this.messages[r]?this.messages[r]:null)||((n??r??i?.id)?.replaceAll(`_`,` `)??this.messages.untitled)}_getPortalTemplates(){return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!!t?.id):[]}_getDefaultTemplates(){return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!t?.id):[]}_getPrintServiceTemplates(){return!this.includeDefaultTemplates||!this._getDefaultTemplates().length?this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!R(e)):[]}_renderLayoutTemplates(e,t=!1,n=!1){return t&&e.sort((e,t)=>(e.label??``)>(t.label??``)?1:-1),e.map(e=>A(`calcite-list-item`,{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??``,value:e},A(`calcite-icon`,{icon:(e.layout?V.get(e.layout):null)||`custom-print`,slot:`content-start`}),e.state===`loading`?A(`calcite-loader`,{inline:!0,key:`template-loader-${e.id}`,label:`loading`,scale:`s`,slot:`content-end`}):null,e?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-error-${e.id}`,scale:`s`,slot:`content-end`}):null,n?A(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:`delete`,onclick:()=>this.viewModel.removePortalTemplate(e)}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;let{messages:e}=this,t=v.test(this.portal?.url),n=this.viewModel.browseTemplates.toArray(),r=this._getPortalTemplates(),i=this._getDefaultTemplates(),a=this._getPrintServiceTemplates(),o=n.length+r.length+i.length+a.length>15,s=this.browseTemplateButtonOnClick?A(`calcite-button`,{appearance:`outline`,class:o?I.browseTemplateButtonContainerFilter:I.browseTemplateButtonContainer,iconStart:`folder`,key:`browse-template-button`,slot:o?`filter-actions-end`:`default`,onclick:this.browseTemplateButtonOnClick},o?null:e.browseTemplates):null;return A(`calcite-flow-item`,{bind:this,closable:!1,heading:e.chooseTemplate,key:`template-flow-item`,selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},A(`div`,{class:I.templateSelectFlowItemContainer},A(`div`,{class:I.templateSelectFlowItemContent},o?null:s,A(`calcite-list`,{filterEnabled:o,filterProps:[`label`],key:`template-list`,label:e.templateList,selectionMode:`single-persist`,onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},o?s:null,n.length?A(`div`,{key:`my-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.myTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(n,!0,!0)):null,r.length?A(`div`,{key:`org-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.organizationTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(r)):null,n.length||r.length?i.length?A(`div`,{key:`default-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(i,!0)):null:this._renderLayoutTemplates(i,!0),n.length||r.length?a.length?A(`div`,{key:`service-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(a)):null:this._renderLayoutTemplates(a))),A(`div`,{class:I.templateButtonContainer},A(`calcite-button`,{class:I.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){let{customTextElements:e}=this.templateOptions;return e?A(`div`,{class:I.formSectionContainer,key:`custom-text-elements`},e.map((e,t)=>{let[n,r]=Object.entries(e)[0];return n===`date`?null:A(`calcite-label`,{key:`custom-text-elements-${n}-${t}`},n,A(`calcite-input`,{bind:this,"data-input-custom":!0,"data-input-name":n,value:r??``,onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){let{title:e,fileName:t,titlePlaceHolder:n,fileNamePlaceHolder:r}=this.messages,i=this._selectedTab===`layoutTab`?e:t,a=this._selectedTab===`layoutTab`?n:r,o=this._selectedTab===`layoutTab`?this.templateOptions.title:this.templateOptions.fileName;return A(`div`,{class:I.formSectionContainer,key:i},A(`calcite-label`,null,i,A(`calcite-input`,{placeholder:a,value:o??``,onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;let t=e.getAttribute(`data-tab-id`);(t===`layoutTab`&&this._selectedTab===`layoutTab`||t===`mapOnlyTab`&&this._selectedTab===`mapOnlyTab`||t===`exportTab`&&this._selectedTab===`exportTab`)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){let e={[I.loader]:this._awaitingServerResponse};return A(`div`,{class:this.classes(e),key:`loader`})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,n){let r=e.find(e=>{let[n]=Object.entries(e)[0];return n===t});r[t]=n}_updateInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),r=!!t[`data-input-custom`],{templateOptions:i}=this;r?this._updateCustomTextElementValue(i.customTextElements,n,t.value):i[n]=t.value}_updateNumberInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),{templateOptions:r}=this,i=Number(t.value);L(i)?r[n]=i:t.value=`${r[n]}`}_handlePrintMap(){this._pendingExportScroll=!0;let{templateOptions:e}=this,t=this._selectedTab===`layoutTab`?e.title:e.fileName,{promise:n}=this.viewModel.export(t||this.messages.untitled);this._selectedTab=`exportTab`,n.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;let e=this._rootNode;if(!e)return;let{clientHeight:t,scrollHeight:n}=e,r=n-t;r>0&&(e.scrollTop=r)}_toggleInputValue(e){let t=e.target,n=t.getAttribute(`data-option-name`);this.templateOptions[n]=t.checked,n===`scaleEnabled`&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){let t=this.messages,n=e.formattedName??``,{state:r}=e,i=this.saveAsButtonCallback&&r!==`error`&&this._isFormatAllowedForSaving(e.extension);return r!==`pending`&&i?A(`calcite-popover`,{autoClose:!0,key:`${n}-popover`,label:`Popover`,offsetDistance:1,overlayPositioning:`fixed`,pointerDisabled:!0,referenceElement:`${n}-popover-button`,scale:`s`,topLayerDisabled:this.topLayerDisabled},A(`calcite-list`,{label:``},e.portalItem?A(`calcite-list-item`,{label:t.openItem,onCalciteListItemSelect:()=>{let t=e.portalItem;if(!t||!t.itemPageUrl)return;let n=document.createElement(`a`);n.target=`_blank`,n.href=t.itemPageUrl,n.rel=`noreferrer`,n.click()}},A(`calcite-icon`,{icon:`launch2`,key:`${n}-launch-icon`,scale:`s`,slot:`content-start`})):A(`calcite-list-item`,{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(c(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},A(`calcite-icon`,{icon:`save`,key:`${n}-save-icon`,scale:`s`,slot:`content-start`})),A(`calcite-list-item`,{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},A(`calcite-icon`,{icon:`trash`,key:`${n}-delete-icon`,scale:`s`,slot:`content-start`})))):null}_renderExportedLinkItemContent(e){let t=this.messages,{url:n,state:r,error:i}=e,a=e.formattedName??``,o=n||null;o&&=u(o);let s=d(o,location.href),c=r===`error`?i?.name===`print-task:cim-symbol-unsupported`?t.exportWebMapCIMError:t.exportWebMapError:null;return A(`div`,{class:I.exportedFile,"data-item":e,slot:`content`,onclick:this._handleLinkClick},A(`div`,null,A(`div`,{class:I.exportedFileLinkTitle},a),A(`div`,{class:I.exportedFileLinkDescription},r===`pending`?t.generatingExport:c||(s?t.ready:t.linkReady))),r===`ready`?A(`calcite-icon`,{"aria-label":`${a}. ${t.linkReady}`,icon:s?`download-to`:`launch`,key:`${a}-end-icon`,scale:`s`,slot:`content-end`}):null)}_renderExportedLinkItemIcon(e){let t=e.formattedName??``;return e.state===`pending`?A(`calcite-loader`,{class:I.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:`m`,slot:`content-start`}):A(`calcite-icon`,{icon:z(e),key:`${t}-start-icon`,scale:`s`,slot:`content-start`})}_renderExportedLinkItemAction(e){let{state:t}=e,n=e.formattedName??``,r=this.saveAsButtonCallback&&t!==`error`&&this._isFormatAllowedForSaving(e.extension);return t===`pending`?null:A(`calcite-action`,{icon:r?`ellipsis`:`x`,id:r?`${n}-popover-button`:void 0,key:r?`${n}-saveAs-action`:`${n}-action`,slot:`actions-end`,text:r?this.messagesCommon.options:this.messagesCommon.remove,onclick:r?void 0:()=>{this.exportedLinks.remove(e)}})}_renderExportedLinkItem(e){let t=e.formattedName??``;return A(M,null,A(`calcite-list-item`,{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return A(`calcite-list`,{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:`none`},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||this.allowedFormatsForSaving===`all`||!!(e&&this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){let t=e.target;this._toggleTab(t.getAttribute(`data-tab-id`))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===`mapOnlyTab`)this.viewModel.applyTemplate(P);else if(this._selectedTab===`layoutTab`){let e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){let{key:t}=e,n=e.target.getAttribute(`data-tab-id`);if(N(t))this._toggleTab(n),e.preventDefault(),e.stopPropagation();else if(t===`ArrowLeft`||t===`ArrowRight`){switch(n){case`layoutTab`:this._toggleTab(t===`ArrowLeft`?`exportTab`:`mapOnlyTab`);break;case`mapOnlyTab`:this._toggleTab(t===`ArrowLeft`?`layoutTab`:`exportTab`);break;case`exportTab`:this._toggleTab(t===`ArrowLeft`?`mapOnlyTab`:`layoutTab`)}e.preventDefault(),e.stopPropagation()}}};e([f()],H.prototype,`_showTemplates`,void 0),e([f()],H.prototype,`_isValidSpatialReference`,void 0),e([f()],H.prototype,`allowedFormats`,null),e([f()],H.prototype,`allowedFormatsForSaving`,void 0),e([f()],H.prototype,`allowedLayouts`,null),e([f()],H.prototype,`browseTemplateButtonOnClick`,void 0),e([f()],H.prototype,`error`,null),e([f({type:n.ofType(S)})],H.prototype,`exportedLinks`,null),e([f()],H.prototype,`extraParameters`,null),e([f()],H.prototype,`headerVisible`,void 0),e([f()],H.prototype,`headingLevel`,void 0),e([f()],H.prototype,`icon`,null),e([f()],H.prototype,`includeDefaultTemplates`,null),e([f()],H.prototype,`includeOrganizationTemplates`,void 0),e([f()],H.prototype,`label`,null),e([f(),k(`esri/widgets/Print/t9n/Print`)],H.prototype,`messages`,void 0),e([f(),k(`esri/t9n/common`)],H.prototype,`messagesCommon`,void 0),e([f(),k(`esri/core/t9n/Units`)],H.prototype,`messagesUnits`,void 0),e([f({type:h})],H.prototype,`outSpatialReference`,null),e([f({type:_})],H.prototype,`portal`,null),e([f()],H.prototype,`saveExportEnabled`,null),e([f()],H.prototype,`saveExportHidden`,void 0),e([f()],H.prototype,`showPrintAreaEnabled`,null),e([f()],H.prototype,`printServiceUrl`,null),e([f()],H.prototype,`saveAsButtonCallback`,void 0),e([f()],H.prototype,`templateCustomTextElements`,null),e([f({type:w})],H.prototype,`templateOptions`,null),e([f()],H.prototype,`view`,null),e([f({type:C})],H.prototype,`viewModel`,void 0),H=e([p(`esri.widgets.Print`)],H);const U=H;export{U as default};
2
+ import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{JSONMap as i}from"../core/jsonMap.js";import a from"../core/Logger.js";import{watch as o,on as s,whenOnce as c}from"../core/reactiveUtils.js";import{unitName as l}from"../core/unitFormatUtils.js";import{addProxy as u,hasSameOrigin as d}from"../core/urlUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureInteger as m}from"../core/accessorSupport/ensureType.js";import h from"../geometry/SpatialReference.js";import{isValid as g}from"../geometry/support/spatialReferenceUtils.js";import _ from"../portal/Portal.js";import{reArcGISOnlineDomain as v}from"../portal/support/urlUtils.js";import{findToken as y}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import x from"./Widget.js";import S from"./Print/FileLink.js";import C from"./Print/PrintViewModel.js";import w from"./Print/TemplateOptions.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{Heading as D}from"./support/Heading.js";import{legacyIcon as O}from"./support/legacyIcon.js";import{messageBundle as k,tsx as A,isRTL as j,tsxFragment as M,isActivationKey as N}from"./support/widget.js";const P=`map-only`,F=`esri-print`,I={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function L(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function R(e){return e?.toLowerCase()===P}function z(e){let{state:t,extension:n}=e;switch(t){case`pending`:return`spinner`;case`error`:return`exclamation-mark-circle`;default:return n?.toLowerCase()?.includes(`pdf`)?`file-pdf`:`file`}}const B=new i({inch:`inches`,foot:`feet`,yard:`yards`,mile:`miles`,"nautical-mile":`nautical-miles`,millimeter:`millimeters`,centimeter:`centimeters`,decimeter:`decimeters`,meter:`meters`,kilometer:`kilometers`}),V=new Map([[`a3-landscape`,`a3-landscape`],[`a3-portrait`,`a3-portrait`],[`a4-landscape`,`a4-landscape`],[`a4-portrait`,`a4-portrait`],[`letter-ansi-a-landscape`,`ansi-a-landscape`],[`letter-ansi-a-portrait`,`ansi-a-portrait`],[`tabloid-ansi-b-landscape`,`ansi-b-landscape`],[`tabloid-ansi-b-portrait`,`ansi-b-portrait`]]);let H=class extends x{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab=`layoutTab`,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new C,this._onInput=e=>{this._selectedTab===`layoutTab`?this.templateOptions.title=e.currentTarget.value:this._selectedTab===`mapOnlyTab`&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{let t=e.currentTarget[`data-item`];if(!t||t.state!==`ready`||!t.url)return;let n=y(this.viewModel.effectivePrintServiceUrl),r=t.url,i=document.createElement(`a`);if(i.target=`_blank`,i.href=r,i.rel=`noreferrer`,i.download=t.formattedName??``,!n){i.click(),e.stopPropagation();return}e.preventDefault();let a=new URL(r);a.searchParams.set(`token`,n),i.href=a.href,i.click(),i.href=r},r(a.getLogger(this),`Print`,`arcgis-print`,{version:`4.33`}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{let{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){let t=b.apiValues;this._formats=e.format.choiceList.map(e=>{let n=t.find(t=>RegExp(`\\b${t}\\b`,`i`).test(e))??e;return{value:n,label:e===n?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}let t=this._formats.some(({value:e})=>RegExp(`\\b${e}\\b`,`i`).test(this.templateOptions.format));if(e.format.defaultValue&&!t){let t=this._formats.find(({value:t})=>RegExp(`\\b${t}\\b`,`i`).test(e.format.defaultValue))?.value;t&&(this.templateOptions.format=t)}}),o(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{let{layout:e}=this.templateOptions;this._selectedTab=R(e)?`mapOnlyTab`:`layoutTab`,this._selectedTab===`layoutTab`&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),o(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),o(()=>this.viewModel.view?.scale,e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}),s(()=>this.viewModel,`submit`,e=>this.emit(`submit`,e)),s(()=>this.viewModel,`complete`,e=>this.emit(`complete`,e))]);let{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;let n=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(n),this._awaitingServerResponse=!1},()=>{})}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),link:()=>import(`@esri/calcite-components/dist/components/calcite-link`)})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return`print`}set icon(e){this._overrideIfSome(`icon`,e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{messages:e,templateOptions:t,viewModel:n,view:r}=this,{attributionEnabled:i,author:a,copyright:o,dpi:s,format:c,height:l,layout:u,layoutItem:d,legendEnabled:f,northArrowEnabled:p,scaleBarEnabled:_,scaleEnabled:v,scale:y,width:b}=t,x=n.state!==`ready`||this._awaitingServerResponse||!(u||d),S=this._renderTitleOrFileNameSection(),C=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.fileFormatTitle,A(`calcite-combobox`,{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??`pdf`}},this._formats.map(({value:e,label:t},n)=>A(`calcite-combobox-item`,{heading:t,key:`file-format-${n}`,selected:e===this.templateOptions.format,value:e}))))),w=A(`calcite-label`,{layout:`inline`},A(`calcite-switch`,{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),T=A(`div`,null,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.template,A(`calcite-block`,{class:I.templateSelectContainer,description:this._getPageSizeLabel(this._selectedTemplate),expandable:!1,heading:this._getTemplateLabel(this._selectedTemplate,!0),key:`template-select-block`,label:e.template,loading:this._selectedTemplate?.state===`loading`,tabIndex:0,onclick:()=>this._showTemplates=!0,onkeydown:e=>{(e.key===`Enter`||e.key===` `)&&(this._showTemplates=!0)}},A(`calcite-icon`,{class:I.templateSelectIcon,icon:(this._selectedTemplate?.layout?V.get(this._selectedTemplate.layout):null)||`custom-print`,key:`template-select-icon`,scale:`l`,slot:`content-start`}),this._selectedTemplate?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-select-error`,scale:`s`,slot:`actions-end`}):null,A(`calcite-icon`,{class:I.templateSelectArrow,icon:j()?`chevron-left`:`chevron-right`,key:`template-select-arrow`,scale:`s`,slot:`actions-end`})))),w),k=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.dpi,A(`calcite-input-number`,{bind:this,"data-input-name":`dpi`,min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),M=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,A(`div`,{class:I.srLabel},e.outSpatialReference,A(`calcite-link`,{href:`https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/`,target:`_blank`},`(WKID)`)),A(`calcite-input-number`,{bind:this,"data-input-name":`outSpatialReference`,integer:!0,numberButtonType:`none`,value:n.outSpatialReference?.wkid?.toString()??``,onCalciteInputNumberInput:({currentTarget:e})=>{let t=m(e.value);n.outSpatialReference=Number.isNaN(t)||t==null?null:new h({wkid:t}),this._isValidSpatialReference=!n.outSpatialReference||g(n.outSpatialReference)}}),this._isValidSpatialReference?null:A(`div`,{class:I.invalidWkidText,key:`out-sr-${n.outSpatialReference?.wkid}`},e.invalidWkid))),N=A(`div`,{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:v,"data-option-name":`scaleEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),A(`div`,{class:I.scaleInputContainer},A(`calcite-input-number`,{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:I.scaleInput,"data-input-name":`scale`,disabled:!v,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),A(`calcite-button`,{appearance:`outline`,"aria-label":e.reset,bind:this,disabled:!v,iconStart:`refresh`,kind:`neutral`,onclick:this._resetToCurrentScale}))),P=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer,key:`advanced-section-for-layout`},N,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??!0?A(`div`,{class:I.formSectionContainer,key:`author-info`},A(`calcite-label`,null,e.author,A(`calcite-input`,{bind:this,"data-input-name":`author`,value:a??``,onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??!0?A(`div`,{class:I.formSectionContainer,key:`copyright-text`},A(`calcite-label`,null,e.copyright,A(`calcite-input`,{bind:this,"data-input-name":`copyright`,value:o??``,onCalciteInputInput:this._updateInputValue}))):null,k,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??!0?A(`div`,{class:I.formSectionContainer,key:`legend-info`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!f,"data-option-name":`legendEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?A(`div`,{class:I.formSectionContainer,key:`north-arrow`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!p,"data-option-name":`northArrowEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?A(`div`,{class:I.formSectionContainer,key:`scale-bar`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!_,"data-option-name":`scaleBarEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),F=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},N,k,M,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:i,"data-option-name":`attributionEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),L=this.exportedLinks.toArray(),R=this._renderExportedLinkItems(L),z={[I.exportSectionCentered]:!L.length},B=this._selectedTab===`layoutTab`?A(`section`,{"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,id:`${this.id}__layoutContent`,key:`esri-print__layoutContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??!0?S:null,T,this._selectedTab===`layoutTab`?C:null,A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),disabled:!(u||d?.id),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForLayout`,key:`advanced-options-for-layout`},P))):this._selectedTab===`mapOnlyTab`?A(`section`,{"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:`esri-print__mapOnlyContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},S,C,A(`div`,null,A(`div`,{class:this.classes(I.sizeContainer,I.formSectionContainer)},A(`calcite-label`,null,e.width,A(`calcite-input-number`,{bind:this,"data-input-name":`width`,value:`${b}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`calcite-label`,null,e.height,A(`calcite-input-number`,{bind:this,"data-input-name":`height`,value:`${l}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`button`,{"aria-label":e.swap,bind:this,class:this.classes(E.widgetButton,I.swapButton,O.swap),type:`button`,onclick:this._switchInput})),w),A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForMapOnly`,key:`advanced-options-for-map-only`},F))):A(`section`,{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(I.exportSection,z),id:`${this.id}__exportContent`,key:`esri-print__exportContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},A(`div`,{afterUpdate:this._scrollExportIntoView,bind:this,class:I.exportedFilesContainer},L.length===0?A(`div`,{class:I.exportedFilesEmpty},A(`calcite-icon`,{icon:`file`,scale:`l`}),A(`div`,null,A(D,{class:I.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),A(`div`,null,e.exportHint))):R))),H=r?.type!==`2d`,U=A(`div`,{class:I.panelError},r?H?e.sceneViewError:e.serviceError:e.noViewError),W=L.some(({state:e})=>e===`pending`),G=A(`div`,{class:I.content,key:`panel`},A(`div`,null,A(`ul`,{bind:this,class:I.layoutTabList,role:`tablist`,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown},A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`layoutTab`}`,class:I.layoutTab,"data-tab-id":`layoutTab`,id:`${this.id}__layoutTab`,role:`tab`,tabIndex:0},e.layoutTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`mapOnlyTab`}`,class:I.layoutTab,"data-tab-id":`mapOnlyTab`,id:`${this.id}__mapOnlyTab`,role:`tab`,tabIndex:0},e.mapOnlyTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`exportTab`}`,class:I.layoutTab,"data-tab-id":`exportTab`,id:`${this.id}__exportedFilesTab`,role:`tab`,tabIndex:0},W?A(`calcite-loader`,{inline:!0,label:`loading`,scale:`s`}):null,e.exportsTab)),B),this._selectedTab===`exportTab`?null:A(`div`,{class:this.classes(I.printButtonSection,!this.saveExportHidden&&this.portal?I.printButtonSectionDivider:null),key:`export-button-section`},!this.saveExportHidden&&this.portal?A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,A(`calcite-button`,{"aria-label":e.exportDescription,bind:this,class:this.classes(I.printButton),disabled:x||!(u||d?.id)&&!c,scale:`l`,width:`full`,onclick:this._handlePrintMap},e.export))),K=A(`calcite-flow`,{key:`root-flow`},A(`calcite-flow-item`,{bind:this,key:`root-flow-item`,selected:!this._showTemplates},A(`div`,{class:I.printWidgetContainer},this.headerVisible?A(`header`,{class:I.headerTitle},e.export):null,this.error||H||!r?U:G)),this._renderChooseTemplateFlowItem()),q=n.state===`initializing`,J=q?this._renderLoader():K,Y={[I.panelItemsCentered]:q};return A(`div`,{bind:this,class:this.classes(I.base,E.widget,E.panel,Y)},J)}_getPageSizeLabel(e){if(!e)return;let n=e.layoutTemplateInfo;if(!n)return;let r=B.fromJSON(n.pageUnits.toLowerCase());return`${t(n.pageSize[0])} \u00D7 ${t(n.pageSize[1])} ${l(this.messagesUnits,r,`abbr`)}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;let{label:n,layout:r,layoutItem:i}=e;return(r&&!i&&this.messages[r]?this.messages[r]:null)||((n??r??i?.id)?.replaceAll(`_`,` `)??this.messages.untitled)}_getPortalTemplates(){return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!!t?.id):[]}_getDefaultTemplates(){return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!t?.id):[]}_getPrintServiceTemplates(){return!this.includeDefaultTemplates||!this._getDefaultTemplates().length?this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!R(e)):[]}_renderLayoutTemplates(e,t=!1,n=!1){return t&&e.sort((e,t)=>(e.label??``)>(t.label??``)?1:-1),e.map(e=>A(`calcite-list-item`,{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??``,value:e},A(`calcite-icon`,{icon:(e.layout?V.get(e.layout):null)||`custom-print`,slot:`content-start`}),e.state===`loading`?A(`calcite-loader`,{inline:!0,key:`template-loader-${e.id}`,label:`loading`,scale:`s`,slot:`content-end`}):null,e?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-error-${e.id}`,scale:`s`,slot:`content-end`}):null,n?A(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:`delete`,onclick:()=>this.viewModel.removePortalTemplate(e)}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;let{messages:e}=this,t=v.test(this.portal?.url),n=this.viewModel.browseTemplates.toArray(),r=this._getPortalTemplates(),i=this._getDefaultTemplates(),a=this._getPrintServiceTemplates(),o=n.length+r.length+i.length+a.length>15,s=this.browseTemplateButtonOnClick?A(`calcite-button`,{appearance:`outline`,class:o?I.browseTemplateButtonContainerFilter:I.browseTemplateButtonContainer,iconStart:`folder`,key:`browse-template-button`,slot:o?`filter-actions-end`:`default`,onclick:this.browseTemplateButtonOnClick},o?null:e.browseTemplates):null;return A(`calcite-flow-item`,{bind:this,closable:!1,heading:e.chooseTemplate,key:`template-flow-item`,selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},A(`div`,{class:I.templateSelectFlowItemContainer},A(`div`,{class:I.templateSelectFlowItemContent},o?null:s,A(`calcite-list`,{filterEnabled:o,filterProps:[`label`],key:`template-list`,label:e.templateList,selectionMode:`single-persist`,onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},o?s:null,n.length?A(`div`,{key:`my-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.myTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(n,!0,!0)):null,r.length?A(`div`,{key:`org-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.organizationTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(r)):null,n.length||r.length?i.length?A(`div`,{key:`default-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(i,!0)):null:this._renderLayoutTemplates(i,!0),n.length||r.length?a.length?A(`div`,{key:`service-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(a)):null:this._renderLayoutTemplates(a))),A(`div`,{class:I.templateButtonContainer},A(`calcite-button`,{class:I.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){let{customTextElements:e}=this.templateOptions;return e?A(`div`,{class:I.formSectionContainer,key:`custom-text-elements`},e.map((e,t)=>{let[n,r]=Object.entries(e)[0];return n===`date`?null:A(`calcite-label`,{key:`custom-text-elements-${n}-${t}`},n,A(`calcite-input`,{bind:this,"data-input-custom":!0,"data-input-name":n,value:r??``,onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){let{title:e,fileName:t,titlePlaceHolder:n,fileNamePlaceHolder:r}=this.messages,i=this._selectedTab===`layoutTab`?e:t,a=this._selectedTab===`layoutTab`?n:r,o=this._selectedTab===`layoutTab`?this.templateOptions.title:this.templateOptions.fileName;return A(`div`,{class:I.formSectionContainer,key:i},A(`calcite-label`,null,i,A(`calcite-input`,{placeholder:a,value:o??``,onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;let t=e.getAttribute(`data-tab-id`);(t===`layoutTab`&&this._selectedTab===`layoutTab`||t===`mapOnlyTab`&&this._selectedTab===`mapOnlyTab`||t===`exportTab`&&this._selectedTab===`exportTab`)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){let e={[I.loader]:this._awaitingServerResponse};return A(`div`,{class:this.classes(e),key:`loader`})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,n){let r=e.find(e=>{let[n]=Object.entries(e)[0];return n===t});r[t]=n}_updateInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),r=!!t[`data-input-custom`],{templateOptions:i}=this;r?this._updateCustomTextElementValue(i.customTextElements,n,t.value):i[n]=t.value}_updateNumberInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),{templateOptions:r}=this,i=Number(t.value);L(i)?r[n]=i:t.value=`${r[n]}`}_handlePrintMap(){this._pendingExportScroll=!0;let{templateOptions:e}=this,t=this._selectedTab===`layoutTab`?e.title:e.fileName,{promise:n}=this.viewModel.export(t||this.messages.untitled);this._selectedTab=`exportTab`,n.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;let e=this._rootNode;if(!e)return;let{clientHeight:t,scrollHeight:n}=e,r=n-t;r>0&&(e.scrollTop=r)}_toggleInputValue(e){let t=e.target,n=t.getAttribute(`data-option-name`);this.templateOptions[n]=t.checked,n===`scaleEnabled`&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){let t=this.messages,n=e.formattedName??``,{state:r}=e,i=this.saveAsButtonCallback&&r!==`error`&&this._isFormatAllowedForSaving(e.extension);return r!==`pending`&&i?A(`calcite-popover`,{autoClose:!0,key:`${n}-popover`,label:`Popover`,offsetDistance:1,overlayPositioning:`fixed`,pointerDisabled:!0,referenceElement:`${n}-popover-button`,scale:`s`,topLayerDisabled:this.topLayerDisabled},A(`calcite-list`,{label:``},e.portalItem?A(`calcite-list-item`,{label:t.openItem,onCalciteListItemSelect:()=>{let t=e.portalItem;if(!t||!t.itemPageUrl)return;let n=document.createElement(`a`);n.target=`_blank`,n.href=t.itemPageUrl,n.rel=`noreferrer`,n.click()}},A(`calcite-icon`,{icon:`launch2`,key:`${n}-launch-icon`,scale:`s`,slot:`content-start`})):A(`calcite-list-item`,{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(c(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},A(`calcite-icon`,{icon:`save`,key:`${n}-save-icon`,scale:`s`,slot:`content-start`})),A(`calcite-list-item`,{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},A(`calcite-icon`,{icon:`trash`,key:`${n}-delete-icon`,scale:`s`,slot:`content-start`})))):null}_renderExportedLinkItemContent(e){let t=this.messages,{url:n,state:r,error:i}=e,a=e.formattedName??``,o=n||null;o&&=u(o);let s=d(o,location.href),c=r===`error`?i?.name===`print-task:cim-symbol-unsupported`?t.exportWebMapCIMError:t.exportWebMapError:null;return A(`div`,{class:I.exportedFile,"data-item":e,slot:`content`,onclick:this._handleLinkClick},A(`div`,null,A(`div`,{class:I.exportedFileLinkTitle},a),A(`div`,{class:I.exportedFileLinkDescription},r===`pending`?t.generatingExport:c||(s?t.ready:t.linkReady))),r===`ready`?A(`calcite-icon`,{"aria-label":`${a}. ${t.linkReady}`,icon:s?`download-to`:`launch`,key:`${a}-end-icon`,scale:`s`,slot:`content-end`}):null)}_renderExportedLinkItemIcon(e){let t=e.formattedName??``;return e.state===`pending`?A(`calcite-loader`,{class:I.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:`m`,slot:`content-start`}):A(`calcite-icon`,{icon:z(e),key:`${t}-start-icon`,scale:`s`,slot:`content-start`})}_renderExportedLinkItemAction(e){let{state:t}=e,n=e.formattedName??``,r=this.saveAsButtonCallback&&t!==`error`&&this._isFormatAllowedForSaving(e.extension);return t===`pending`?null:A(`calcite-action`,{icon:r?`ellipsis`:`x`,id:r?`${n}-popover-button`:void 0,key:r?`${n}-saveAs-action`:`${n}-action`,slot:`actions-end`,text:r?this.messagesCommon.options:this.messagesCommon.remove,onclick:r?void 0:()=>{this.exportedLinks.remove(e)}})}_renderExportedLinkItem(e){let t=e.formattedName??``;return A(M,null,A(`calcite-list-item`,{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return A(`calcite-list`,{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:`none`},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||this.allowedFormatsForSaving===`all`||!!(e&&this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){let t=e.target;this._toggleTab(t.getAttribute(`data-tab-id`))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===`mapOnlyTab`)this.viewModel.applyTemplate(P);else if(this._selectedTab===`layoutTab`){let e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){let{key:t}=e,n=e.target.getAttribute(`data-tab-id`);if(N(t))this._toggleTab(n),e.preventDefault(),e.stopPropagation();else if(t===`ArrowLeft`||t===`ArrowRight`){switch(n){case`layoutTab`:this._toggleTab(t===`ArrowLeft`?`exportTab`:`mapOnlyTab`);break;case`mapOnlyTab`:this._toggleTab(t===`ArrowLeft`?`layoutTab`:`exportTab`);break;case`exportTab`:this._toggleTab(t===`ArrowLeft`?`mapOnlyTab`:`layoutTab`)}e.preventDefault(),e.stopPropagation()}}};e([f()],H.prototype,`_showTemplates`,void 0),e([f()],H.prototype,`_isValidSpatialReference`,void 0),e([f()],H.prototype,`allowedFormats`,null),e([f()],H.prototype,`allowedFormatsForSaving`,void 0),e([f()],H.prototype,`allowedLayouts`,null),e([f()],H.prototype,`browseTemplateButtonOnClick`,void 0),e([f()],H.prototype,`error`,null),e([f({type:n.ofType(S)})],H.prototype,`exportedLinks`,null),e([f()],H.prototype,`extraParameters`,null),e([f()],H.prototype,`headerVisible`,void 0),e([f()],H.prototype,`headingLevel`,void 0),e([f()],H.prototype,`icon`,null),e([f()],H.prototype,`includeDefaultTemplates`,null),e([f()],H.prototype,`includeOrganizationTemplates`,void 0),e([f()],H.prototype,`label`,null),e([f(),k(`esri/widgets/Print/t9n/Print`)],H.prototype,`messages`,void 0),e([f(),k(`esri/t9n/common`)],H.prototype,`messagesCommon`,void 0),e([f(),k(`esri/core/t9n/Units`)],H.prototype,`messagesUnits`,void 0),e([f({type:h})],H.prototype,`outSpatialReference`,null),e([f({type:_})],H.prototype,`portal`,null),e([f()],H.prototype,`saveExportEnabled`,null),e([f()],H.prototype,`saveExportHidden`,void 0),e([f()],H.prototype,`showPrintAreaEnabled`,null),e([f()],H.prototype,`printServiceUrl`,null),e([f()],H.prototype,`saveAsButtonCallback`,void 0),e([f()],H.prototype,`templateCustomTextElements`,null),e([f({type:w})],H.prototype,`templateOptions`,null),e([f()],H.prototype,`view`,null),e([f({type:C})],H.prototype,`viewModel`,void 0),H=e([p(`esri.widgets.Print`)],H);const U=H;export{U as default};
package/widgets/Slice.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../analysis/SliceAnalysis.js";import{deprecateWidget as n}from"../core/deprecate.js";import r from"../core/Logger.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{property as a,subclass as o}from"../core/accessorSupport/decorators.js";import s from"./Widget.js";import c from"./Slice/SliceViewModel.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{Heading as d}from"./support/Heading.js";import{messageBundle as f,tsx as p}from"./support/widget.js";const m=`esri-slice`,h={base:m,actions:`${m}__actions`,cancelButton:`${m}__cancel-button`,container:`${m}__container`,error:`${m}__error`,excludeButton:`${m}__exclude-button`,hint:`${m}__hint`,hintText:`${m}__hint-text`,layerItem:`${m}__layer-item`,layerList:`${m}__layer-list`,layerListHeading:`${m}__layer-list-title`,newSliceButton:`${m}__clear-button`};let g=class extends s{constructor(e,t){super(e,t),this.headingLevel=3,this.messages=null,this.viewModel=new c({suppressDeprecationWarning:!0}),this._onNewSliceClick=()=>{i(this.viewModel.start())},n(r.getLogger(this),`Slice`,`arcgis-slice`,{version:`4.33`})}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`)})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get icon(){return`slice`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get hasVoxelLayers(){let e=this.viewModel?.view;return e!=null&&e.allLayerViews.some(e=>e.type===`voxel-3d`)}render(){return p(`div`,{class:this.classes(h.base,u.widget,u.panel),role:`presentation`},this.visible?p(`div`,{class:h.container},this.viewModel.supported?[this._renderHint(),this._renderLayerList(),this._renderActions()]:this._renderUnsupported()):null)}_renderUnsupported(){return p(`div`,{class:h.error,key:`unsupported`},p(`p`,null,this.messages.unsupported))}_renderHint(){let{hasVoxelLayers:e,messages:t,viewModel:n}=this,{active:r,mode:i,state:a}=n,o=null;return r&&(i===`exclude`?o=t.excludeHint:a===`ready`&&(o=e?t.voxelHint:t.hint)),o?p(`div`,{class:h.hint,key:`hint`},p(`p`,{class:h.hintText},o),p(`p`,{class:h.hintText},t.verticalHint)):null}_renderLayerList(){let{excludedLayers:e,excludeGroundSurface:t,headingLevel:n,messages:r,viewModel:i}=this,{mode:a,state:o}=i,s=o===`slicing`||o===`sliced`,c=e?e.toArray().map(e=>this._renderLayerItem({uid:e.uid,title:e.title,onClick:()=>(this.excludedLayers.remove(e),!1)})):[];return t&&c.push(this._renderLayerItem({uid:`ground`,title:r.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)})),a===`exclude`||!s||c.length===0?null:p(`div`,{class:h.layerList,key:`settings`},p(d,{class:h.layerListHeading,level:n},r.excludedLayers),p(`calcite-list`,{label:r.excludedLayers,selectionMode:`none`},c))}_renderActions(){let{messages:e,viewModel:t}=this,{active:n,state:r}=t,i=r===`disabled`,a=r===`slicing`||r===`sliced`,o=t.mode===`exclude`,s=[];return(!n||a)&&!o&&s.push(p(`calcite-button`,{class:h.newSliceButton,disabled:i,key:`new-slice`,onclick:this._onNewSliceClick},e.newSlice)),a&&!o&&s.push(p(`calcite-button`,{appearance:`outline-fill`,class:h.excludeButton,disabled:i,key:`exclude`,onclick:()=>t.enterExcludeLayerMode()},e.excludeLayer)),n&&o&&s.push(p(`calcite-button`,{appearance:`outline-fill`,class:h.cancelButton,disabled:i,key:`cancel-exclude`,onclick:()=>t.exitExcludeLayerMode()},e.cancel)),s.length===0?null:p(`div`,{class:h.actions},s)}_renderLayerItem(e){let t=this.messages.includeLayer;return p(`calcite-list-item`,{class:h.layerItem,"data-testid":`list-item-${e.uid}`,key:e.uid,label:e.title??``},p(`calcite-action`,{icon:`x`,slot:`actions-end`,text:t,title:t,onclick:e.onClick}))}};e([a()],g.prototype,`active`,null),e([a({type:t,nonNullable:!0})],g.prototype,`analysis`,null),e([a()],g.prototype,`excludedLayers`,null),e([a()],g.prototype,`excludeGroundSurface`,null),e([a()],g.prototype,`headingLevel`,void 0),e([a()],g.prototype,`icon`,null),e([a()],g.prototype,`label`,null),e([a(),f(`esri/widgets/Slice/t9n/Slice`)],g.prototype,`messages`,void 0),e([a()],g.prototype,`view`,null),e([a({type:c})],g.prototype,`viewModel`,void 0),e([a()],g.prototype,`visible`,null),e([a()],g.prototype,`hasVoxelLayers`,null),g=e([o(`esri.widgets.Slice`)],g);const _=g;export{_ as default};
2
+ import{__decorate as e}from"tslib";import t from"../analysis/SliceAnalysis.js";import{deprecateWidget as n}from"../core/deprecate.js";import r from"../core/Logger.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{property as a,subclass as o}from"../core/accessorSupport/decorators.js";import s from"./Widget.js";import c from"./Slice/SliceViewModel.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{Heading as d}from"./support/Heading.js";import{messageBundle as f,tsx as p}from"./support/widget.js";const m=`esri-slice`,h={base:m,actions:`${m}__actions`,cancelButton:`${m}__cancel-button`,container:`${m}__container`,error:`${m}__error`,excludeButton:`${m}__exclude-button`,hint:`${m}__hint`,hintText:`${m}__hint-text`,layerItem:`${m}__layer-item`,layerList:`${m}__layer-list`,layerListHeading:`${m}__layer-list-title`,newSliceButton:`${m}__clear-button`};let g=class extends s{constructor(e,t){super(e,t),this.headingLevel=3,this.messages=null,this.viewModel=new c({suppressDeprecationWarning:!0}),this._onNewSliceClick=()=>{i(this.viewModel.start())},n(r.getLogger(this),`Slice`,`arcgis-slice`,{version:`4.33`})}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`)})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get icon(){return`slice`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get hasVoxelLayers(){let e=this.viewModel?.view;return e!=null&&e.allLayerViews.some(e=>e.type===`voxel-3d`)}render(){return p(`div`,{class:this.classes(h.base,u.widget,u.panel),role:`presentation`},this.visible?p(`div`,{class:h.container},this.viewModel.supported?[this._renderHint(),this._renderLayerList(),this._renderActions()]:this._renderUnsupported()):null)}_renderUnsupported(){return p(`div`,{class:h.error,key:`unsupported`},p(`p`,null,this.messages.unsupported))}_renderHint(){let{hasVoxelLayers:e,messages:t,viewModel:n}=this,{active:r,mode:i,state:a}=n,o=null;return r&&(i===`exclude`?o=t.excludeHint:a===`ready`&&(o=e?t.voxelHint:t.hint)),o?p(`div`,{class:h.hint,key:`hint`},p(`p`,{class:h.hintText},o),p(`p`,{class:h.hintText},t.verticalHint)):null}_renderLayerList(){let{excludedLayers:e,excludeGroundSurface:t,headingLevel:n,messages:r,viewModel:i}=this,{mode:a,state:o}=i,s=o===`slicing`||o===`sliced`,c=e?e.toArray().map(e=>this._renderLayerItem({uid:e.uid,title:e.title,onClick:()=>(this.excludedLayers.remove(e),!1)})):[];return t&&c.push(this._renderLayerItem({uid:`ground`,title:r.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)})),a===`exclude`||!s||c.length===0?null:p(`div`,{class:h.layerList,key:`settings`},p(d,{class:h.layerListHeading,level:n},r.excludedLayers),p(`calcite-list`,{label:r.excludedLayers,selectionMode:`none`},c))}_renderActions(){let{messages:e,viewModel:t}=this,{active:n,state:r}=t,i=r===`disabled`,a=r===`slicing`||r===`sliced`,o=t.mode===`exclude`,s=[];return n&&!a||o||s.push(p(`calcite-button`,{class:h.newSliceButton,disabled:i,key:`new-slice`,onclick:this._onNewSliceClick},e.newSlice)),a&&!o&&s.push(p(`calcite-button`,{appearance:`outline-fill`,class:h.excludeButton,disabled:i,key:`exclude`,onclick:()=>t.enterExcludeLayerMode()},e.excludeLayer)),n&&o&&s.push(p(`calcite-button`,{appearance:`outline-fill`,class:h.cancelButton,disabled:i,key:`cancel-exclude`,onclick:()=>t.exitExcludeLayerMode()},e.cancel)),s.length===0?null:p(`div`,{class:h.actions},s)}_renderLayerItem(e){let t=this.messages.includeLayer;return p(`calcite-list-item`,{class:h.layerItem,"data-testid":`list-item-${e.uid}`,key:e.uid,label:e.title??``},p(`calcite-action`,{icon:`x`,slot:`actions-end`,text:t,title:t,onclick:e.onClick}))}};e([a()],g.prototype,`active`,null),e([a({type:t,nonNullable:!0})],g.prototype,`analysis`,null),e([a()],g.prototype,`excludedLayers`,null),e([a()],g.prototype,`excludeGroundSurface`,null),e([a()],g.prototype,`headingLevel`,void 0),e([a()],g.prototype,`icon`,null),e([a()],g.prototype,`label`,null),e([a(),f(`esri/widgets/Slice/t9n/Slice`)],g.prototype,`messages`,void 0),e([a()],g.prototype,`view`,null),e([a({type:c})],g.prototype,`viewModel`,void 0),e([a()],g.prototype,`visible`,null),e([a()],g.prototype,`hasVoxelLayers`,null),g=e([o(`esri.widgets.Slice`)],g);const _=g;export{_ as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{deprecatedModule as n}from"../../core/deprecate.js";import r from"../../core/Error.js";import i from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../core/support/UpdatingHandles.js";import l from"../../layers/FeatureLayer.js";import{getOwningPortalUrl as u}from"../../layers/support/layerUtils.js";import d from"../../portal/Portal.js";import{hasUserTypeExtension as f}from"../../portal/support/utils.js";n(i.getLogger(`esri.widgets.UtilityNetworkTraceAnalysis.UtilityNetworkTraceAnalysisViewModel`),`UtilityNetworkTraceAnalysisViewModel`,{replacement:`Use esri/networks/UtilityNetworkTraceAnalysis instead`,version:`5.0`,warnOnce:!0});let p=class extends t{constructor(e){super(e),this._updatingHandlesLoad=new c,this._updatingHandlesExecute=new c}initialize(){this.addHandles([a(()=>[this.view,this.utilityNetwork],()=>{this._setUp()},{initial:!0})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get executionError(){return this._executionError}get loadError(){return this._loadError}get state(){return this._updatingHandlesLoad.updating?`loading`:this.loadError?`disabled`:this._updatingHandlesExecute.updating?`executing`:`ready`}get utilityNetwork(){return this._get(`utilityNetwork`)}set utilityNetwork(e){this._get(`utilityNetwork`)!==e&&this._set(`utilityNetwork`,e)}get view(){return this._get(`view`)}set view(e){this._get(`view`)!==e&&this._set(`view`,e)}async executeNamedTraceConfiguration(e){return this._updatingHandlesExecute.addPromise(this._executeNamedTraceConfiguration(e))}async executeTraceConfiguration(e){return this._updatingHandlesExecute.addPromise(this._executeTraceConfiguration(e))}async _executeNamedTraceConfiguration(e){if(this.state===`disabled`){let e=`trace-analysis-view-model:load-error`;throw this._logError(e,this.loadError),new r(e,this.loadError??``)}return this._executionError=null,await this.utilityNetwork.trace(e).catch(e=>{throw this._executionError=`trace-error`,this._logError(`trace-analysis-view-model:execution-error`,this.executionError),e})}async _executeTraceConfiguration(e){if(this.state===`disabled`){let e=`trace-analysis-view-model:load-error`;throw this._logError(e,this.loadError),new r(e,this.loadError??``)}return this._executionError=null,await this.utilityNetwork.trace(e).catch(e=>{throw this._executionError=`trace-error`,this._logError(`trace-analysis-view-model:execution-error`,this.executionError),e})}_logError(e,t){i.getLogger(this).error(new r(e,t??``))}async _setUp(){let{utilityNetwork:e,view:t}=this;this._updatingHandlesLoad.consumePromise((async()=>{if(this._loadError=null,!t){this._loadError=`no-view`;return}if(t.type!==`2d`){this._loadError=`sceneView-not-supported`;return}let n=t.map;await n.load();let r=n.utilityNetworks;r?.length?((!e||!r.includes(e))&&(this.utilityNetwork=r.getItemAt(0)??null),this.utilityNetwork?.type===`utility`?(this.utilityNetwork.loaded||await this.utilityNetwork.load().catch(()=>{this._loadError=`no-utility-network`}),await this._checkUserTypeExtension(this.utilityNetwork)):this._loadError=`no-utility-network`):this._loadError=`no-utility-network`})())}async _checkUserTypeExtension(e){let t=new l({url:e.networkSystemLayers.dirtyAreasLayerUrl});await t.load();let n=t.version;if(Number(n)<=11.1){let t=await u(e.layerUrl),n=new d({url:t});await n.load();let r=n.user?.username??``;await f(n,r,`utilityNetwork`)||(this._loadError=`no-user-type-extension`,this._logError(`trace-analysis-view-model:load-error`,this.loadError))}}};e([o()],p.prototype,`_executionError`,void 0),e([o()],p.prototype,`_loadError`,void 0),e([o()],p.prototype,`executionError`,null),e([o()],p.prototype,`loadError`,null),e([o({readOnly:!0})],p.prototype,`state`,null),e([o()],p.prototype,`utilityNetwork`,null),e([o()],p.prototype,`view`,null),p=e([s(`esri.widgets.UtilityNetworkTraceAnalysis.UtilityNetworkTraceAnalysisViewModel`)],p);const m=p;export{m as default};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{deprecatedModule as n}from"../../core/deprecate.js";import r from"../../core/Error.js";import i from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../core/support/UpdatingHandles.js";import l from"../../layers/FeatureLayer.js";import{getOwningPortalUrl as u}from"../../layers/support/layerUtils.js";import d from"../../portal/Portal.js";import{hasUserTypeExtension as f}from"../../portal/support/utils.js";n(i.getLogger(`esri.widgets.UtilityNetworkTraceAnalysis.UtilityNetworkTraceAnalysisViewModel`),`UtilityNetworkTraceAnalysisViewModel`,{replacement:`Use esri/networks/UtilityNetworkTraceAnalysis instead`,version:`5.0`,warnOnce:!0});let p=class extends t{constructor(e){super(e),this._updatingHandlesLoad=new c,this._updatingHandlesExecute=new c}initialize(){this.addHandles([a(()=>[this.view,this.utilityNetwork],()=>{this._setUp()},{initial:!0})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get executionError(){return this._executionError}get loadError(){return this._loadError}get state(){return this._updatingHandlesLoad.updating?`loading`:this.loadError?`disabled`:this._updatingHandlesExecute.updating?`executing`:`ready`}get utilityNetwork(){return this._get(`utilityNetwork`)}set utilityNetwork(e){this._get(`utilityNetwork`)!==e&&this._set(`utilityNetwork`,e)}get view(){return this._get(`view`)}set view(e){this._get(`view`)!==e&&this._set(`view`,e)}async executeNamedTraceConfiguration(e){return this._updatingHandlesExecute.addPromise(this._executeNamedTraceConfiguration(e))}async executeTraceConfiguration(e){return this._updatingHandlesExecute.addPromise(this._executeTraceConfiguration(e))}async _executeNamedTraceConfiguration(e){if(this.state===`disabled`){let e=`trace-analysis-view-model:load-error`;throw this._logError(e,this.loadError),new r(e,this.loadError??``)}return this._executionError=null,await this.utilityNetwork.trace(e).catch(e=>{throw this._executionError=`trace-error`,this._logError(`trace-analysis-view-model:execution-error`,this.executionError),e})}async _executeTraceConfiguration(e){if(this.state===`disabled`){let e=`trace-analysis-view-model:load-error`;throw this._logError(e,this.loadError),new r(e,this.loadError??``)}return this._executionError=null,await this.utilityNetwork.trace(e).catch(e=>{throw this._executionError=`trace-error`,this._logError(`trace-analysis-view-model:execution-error`,this.executionError),e})}_logError(e,t){i.getLogger(this).error(new r(e,t??``))}async _setUp(){let{utilityNetwork:e,view:t}=this;this._updatingHandlesLoad.consumePromise((async()=>{if(this._loadError=null,!t){this._loadError=`no-view`;return}if(t.type!==`2d`){this._loadError=`sceneView-not-supported`;return}let n=t.map;await n.load();let r=n.utilityNetworks;r?.length?(e&&r.includes(e)||(this.utilityNetwork=r.getItemAt(0)??null),this.utilityNetwork?.type===`utility`?(this.utilityNetwork.loaded||await this.utilityNetwork.load().catch(()=>{this._loadError=`no-utility-network`}),await this._checkUserTypeExtension(this.utilityNetwork)):this._loadError=`no-utility-network`):this._loadError=`no-utility-network`})())}async _checkUserTypeExtension(e){let t=new l({url:e.networkSystemLayers.dirtyAreasLayerUrl});await t.load();let n=t.version;if(Number(n)<=11.1){let t=await u(e.layerUrl),n=new d({url:t});await n.load();let r=n.user?.username??``;await f(n,r,`utilityNetwork`)||(this._loadError=`no-user-type-extension`,this._logError(`trace-analysis-view-model:load-error`,this.loadError))}}};e([o()],p.prototype,`_executionError`,void 0),e([o()],p.prototype,`_loadError`,void 0),e([o()],p.prototype,`executionError`,null),e([o()],p.prototype,`loadError`,null),e([o({readOnly:!0})],p.prototype,`state`,null),e([o()],p.prototype,`utilityNetwork`,null),e([o()],p.prototype,`view`,null),p=e([s(`esri.widgets.UtilityNetworkTraceAnalysis.UtilityNetworkTraceAnalysisViewModel`)],p);const m=p;export{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Collection.js";import r from"../../../core/Logger.js";import{removeMaybe as i,abortMaybe as a}from"../../../core/maybe.js";import{ignoreAbortErrors as o,debounce as s,whenOrTimeout as c}from"../../../core/promiseUtils.js";import{watch as l,on as u,sync as d,whenOnce as f}from"../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as h}from"../../../core/support/UpdatingHandles.js";import{isSubtypeGroupLayer as g,isGroupLayer as _,isSubtypeSublayer as v}from"../../../layers/support/layerUtils.js";import{isSelectableLayerViewWithHighlights as y,isSelectableLayerWithObjectIds as b,isSelectableLayerWithGraphics as x,isSelectableLayer as S,isSelectableLayerBaseWithEditing as C}from"../../../views/support/selectionUtils.js";import{goTo as w}from"../goToUtils.js";import T from"./GroupLayerItem.js";import E from"./LayerItem.js";import{computeEffectiveCount as D,getNestedLayerItems as O,isLayerItem as k,isGroupLayerItem as A,getNestedFeatureItems as j}from"./selectionListUtils.js";let M=class extends t{constructor(e){super(e),this._allLayerItems=null,this._groupItemCache=new Map,this._hoverHighlightHandle=null,this._layerEditAbortControllers=new Map,this._layerEditHandles=new n,this._layerItemCache=new Map,this._onChangeAbortController=null,this._updatingHandles=new h,this.filterText=void 0,this.layer=null,this.maxVisibleFeatureCountPerLayer=500,this.selectionManager=null,this._onSelectionChangeController=async()=>{this._cancelOnSelectionChange();let e=new AbortController;this._onChangeAbortController=e,await this._updatingHandles.addPromise(o(this._generateListItems(e))),this._onChangeAbortController===e&&(this._onChangeAbortController=null),(this.layer&&this.effectiveSelectionManager?.getSelection(this.layer))?.length||(this.layer=null)},this._cancelOnSelectionChange=()=>this._onChangeAbortController?.abort(),this._onSelectionChangeDebounced=s(this._onSelectionChangeController,100),this._cancelOnLayerEdit=e=>this._layerEditAbortControllers.get(e)?.abort()}initialize(){this.addHandles([l(()=>[this.view,this.effectiveSelectionManager,...this._sources],()=>{this._onSelectionChange(),this._refreshLayerEditHandles()}),u(()=>this.effectiveSelectionManager?.sources,`change`,()=>{this._onSelectionChange(),this._refreshLayerEditHandles()}),u(()=>this.effectiveSelectionManager,`selection-change`,e=>{this._onSelectionManagerSelectionChange(e),this._onSelectionChange()},d)])}destroy(){this._cancelOnSelectionChange(),this.removeTemporaryHighlight(),this._updatingHandles.destroy(),this._layerEditHandles.drain(i),this._layerEditAbortControllers.forEach(a)}get _sources(){return this.effectiveSelectionManager?.sources.toArray()??[]}get activeLayerItem(){let{layer:e}=this;return e&&this.findLayerItem(e)}get allLayerItems(){return this._allLayerItems??[]}get effectiveCount(){return D(this.allLayerItems)}get effectiveSelectionManager(){return this.selectionManager??this.view?.selectionManager}get isUpdating(){return!!(this._onChangeAbortController||this._updatingHandles.updating)}get layerItems(){return O(this.allLayerItems)}get layerViewMap(){let e=new Map,{view:t}=this;if(!t)return e;for(let n of t.allLayerViews)if(e.set(n.layer.id,n),g(n.layer))for(let t of n.layer.sublayers)e.set(t.id,n);return e}get maxVisibleFeatureCountExceeded(){return this.allLayerItems.some(e=>e.maxVisibleFeatureCountExceeded)}get state(){let{view:e}=this;return e?e.ready?this.effectiveSelectionManager?`ready`:`error`:`loading`:`disabled`}get viewLayersAndTables(){let{view:e}=this;return e?.map?[...e.map.layers.toArray().reverse(),...e.map.tables.toArray().reverse()]:[]}get visibleFeatureCount(){return this.activeLayerItem?.visibleTotal??this.visibleFeatureItems.length}get visibleFeatureItems(){return this.layerItems.flatMap(e=>e.featureItems.filter(e=>e.visible))}get visibleLayerCount(){let{effectiveSelectionManager:e}=this;return!e||e.count===0?0:e.count===1||this.activeLayerItem?1:this.layerItems.filter(e=>e.visible).length}addTemporaryHighlight(e){let{graphic:t,layerView:n}=e;this.removeTemporaryHighlight(),n&&t&&y(n)&&(this._hoverHighlightHandle=n.highlight(t,{name:`temporary`}))}collapseAll(){this._allLayerItems?.forEach(e=>e.expanded=!1)}clear(){this.effectiveSelectionManager?.clear()}deselectFeatureItem(e){let{layer:t,graphic:n,objectId:r}=e;b(t)&&r!=null?this.effectiveSelectionManager?.remove(t,[r]):x(t)&&this.effectiveSelectionManager?.remove(t,[n])}deselectGroupItem(e){e.items.forEach(e=>{k(e)?this.deselectLayerItem(e):this.deselectGroupItem(e)})}deselectLayerItem(e){let{layer:t}=e;this.replace({layer:t,selection:[]})}deselectItem(e){A(e)?this.deselectGroupItem(e):k(e)?this.deselectLayerItem(e):this.deselectFeatureItem(e)}expandAll(){this._allLayerItems?.forEach(e=>e.expanded=!0)}findLayerItem(e){return this.layerItems.find(t=>t.layer===e)}findParentItem(e){return this.allLayerItems.find(t=>t.layer===e)}goToItem(e){k(e)||A(e)?this._goTo(j([e]).map(e=>e.graphic)):this._goTo(e.graphic)}layersToItems(e){let{controller:t,groupLayerItem:n,layers:r,promises:i}=e,{_groupItemCache:a,_layerItemCache:o,effectiveSelectionManager:s,viewLayersAndTables:c}=this,l=r??c;if(!s||s.count===0)return[];let u=[];for(let e of l)switch(e.type){case`subtype-group`:case`knowledge-graph`:case`group`:{let n=a.get(e),r=n??new T({layer:e,viewModel:this});n||a.set(e,r),i.push(r.sync({controller:t,promises:i})),u.push(r)}break;default:if(S(e)){if(!s.getSelection(e)?.length)continue;let r=o.get(e),a=r??new E({groupLayerItem:n,layer:e,viewModel:this});r||o.set(e,a),i.push(a.sync({controller:t,promises:i})),u.push(a)}}return u}removeFromSelection(e){let{layer:t,selection:n}=e;(b(t)||x(t))&&this.effectiveSelectionManager?.remove(t,n)}removeTemporaryHighlight(){this._hoverHighlightHandle=i(this._hoverHighlightHandle)}selectSingleFeatureItem(e){let t=e.identifier;if(this.effectiveSelectionManager)for(let{layer:n}of this.effectiveSelectionManager.selections)this.replace({layer:n,selection:n===e.layer?[t]:[]})}selectSingleGroupItem(e){if(this.effectiveSelectionManager)for(let{layer:t,selection:n}of this.effectiveSelectionManager.selections)this.replace({layer:t,selection:t.parent===e.layer?n:[]})}selectSingleItem(e){A(e)?this.selectSingleGroupItem(e):k(e)?this.selectSingleLayerItem(e):this.selectSingleFeatureItem(e)}selectSingleLayerItem(e){if(this.effectiveSelectionManager)for(let{layer:t,selection:n}of this.effectiveSelectionManager.selections)this.replace({layer:t,selection:t===e.layer?n:[]})}replace(e){let{layer:t,selection:n}=e;(b(t)||x(t))&&this.effectiveSelectionManager?.replace(t,n)}async _goTo(e){let{view:t}=this;if(t)try{await w(t,e)}catch(e){e.name!==`AbortError`&&r.getLogger(this).warn(`Failed to go to feature(s)`,e)}}_onSelectionManagerSelectionChange(e){let{changes:t}=e,n=this.effectiveSelectionManager;n&&t.forEach(({layer:e})=>{let t=n.getSelection(e);(!t||t.length===0)&&this._expandParentItems(e)})}_expandParentItems(e){let t=this._layerItemCache.get(e);if(t&&(t.expanded=!0),_(e.parent)){let t=this._groupItemCache.get(e.parent);t&&(t.expanded=!0)}}async _generateListItems(e){try{this.removeTemporaryHighlight();let t=[],n=this.layersToItems({controller:e,promises:t});t.length>0&&await Promise.all(t),this._onChangeAbortController===e&&(this._allLayerItems=n)}catch(e){r.getLogger(this).warn(`Failed updating selection`,e)}}_onSelectionChange(){o(this._onSelectionChangeDebounced())}_refreshLayerEditHandles(){let{effectiveSelectionManager:e}=this;if(this._layerEditHandles.drain(i),!e?.sources.length)return;let t=new Set(e.sources.map(e=>v(e)?e.parent:e));for(let e of t)S(e)&&(x(e)?this._layerEditHandles.push(e.graphics.on(`change`,()=>void this._onLayerEdit(e))):C(e)&&this._layerEditHandles.push(e.on(`edits`,t=>void this._onLayerEdit(e,t))))}async _onLayerEdit(e,t){try{if(this.removeTemporaryHighlight(),this._cancelOnLayerEdit(e),t&&!t.updatedFeatures.some(e=>e.objectId!=null&&!e.error))return;let n=new AbortController;this._layerEditAbortControllers.set(e,n);let r=e.type===`subtype-group`||e.type===`knowledge-graph`?this.findParentItem(e):this.findLayerItem(e);if(r?.layerView){let e=r.layerView;if(await this._onLayerViewUpdate(e),n.signal.aborted)return;r.reset(),this._onSelectionChange()}this._layerEditAbortControllers.get(e)===n&&this._layerEditAbortControllers.delete(e)}catch(e){r.getLogger(this).warn(`Failed updating selected features`,e)}}async _onLayerViewUpdate(e){await c(f(()=>e.updating),2e3),await f(()=>!e.updating)}};e([p()],M.prototype,`_allLayerItems`,void 0),e([p()],M.prototype,`_groupItemCache`,void 0),e([p()],M.prototype,`_hoverHighlightHandle`,void 0),e([p()],M.prototype,`_layerEditAbortControllers`,void 0),e([p()],M.prototype,`_layerEditHandles`,void 0),e([p()],M.prototype,`_layerItemCache`,void 0),e([p()],M.prototype,`_onChangeAbortController`,void 0),e([p()],M.prototype,`_sources`,null),e([p()],M.prototype,`_updatingHandles`,void 0),e([p()],M.prototype,`activeLayerItem`,null),e([p()],M.prototype,`allLayerItems`,null),e([p()],M.prototype,`effectiveCount`,null),e([p()],M.prototype,`effectiveSelectionManager`,null),e([p()],M.prototype,`filterText`,void 0),e([p()],M.prototype,`isUpdating`,null),e([p()],M.prototype,`layer`,void 0),e([p()],M.prototype,`layerItems`,null),e([p()],M.prototype,`layerViewMap`,null),e([p()],M.prototype,`maxVisibleFeatureCountExceeded`,null),e([p()],M.prototype,`maxVisibleFeatureCountPerLayer`,void 0),e([p()],M.prototype,`selectionManager`,void 0),e([p()],M.prototype,`state`,null),e([p()],M.prototype,`view`,void 0),e([p()],M.prototype,`viewLayersAndTables`,null),e([p()],M.prototype,`visibleFeatureCount`,null),e([p()],M.prototype,`visibleFeatureItems`,null),e([p()],M.prototype,`visibleLayerCount`,null),M=e([m(`esri.widgets.support.SelectionList.SelectionListViewModel`)],M);const N=M;export{N as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Collection.js";import r from"../../../core/Logger.js";import{removeMaybe as i,abortMaybe as a}from"../../../core/maybe.js";import{ignoreAbortErrors as o,debounce as s,whenOrTimeout as c}from"../../../core/promiseUtils.js";import{watch as l,on as u,sync as d,whenOnce as f}from"../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as h}from"../../../core/support/UpdatingHandles.js";import{isSubtypeGroupLayer as g,isGroupLayer as _,isSubtypeSublayer as v}from"../../../layers/support/layerUtils.js";import{isSelectableLayerViewWithHighlights as y,isSelectableLayerWithObjectIds as b,isSelectableLayerWithGraphics as x,isSelectableLayer as S,isSelectableLayerBaseWithEditing as C}from"../../../views/support/selectionUtils.js";import{goTo as w}from"../goToUtils.js";import T from"./GroupLayerItem.js";import E from"./LayerItem.js";import{computeEffectiveCount as D,getNestedLayerItems as O,isLayerItem as k,isGroupLayerItem as A,getNestedFeatureItems as j}from"./selectionListUtils.js";let M=class extends t{constructor(e){super(e),this._allLayerItems=null,this._groupItemCache=new Map,this._hoverHighlightHandle=null,this._layerEditAbortControllers=new Map,this._layerEditHandles=new n,this._layerItemCache=new Map,this._onChangeAbortController=null,this._updatingHandles=new h,this.filterText=void 0,this.layer=null,this.maxVisibleFeatureCountPerLayer=500,this.selectionManager=null,this._onSelectionChangeController=async()=>{this._cancelOnSelectionChange();let e=new AbortController;this._onChangeAbortController=e,await this._updatingHandles.addPromise(o(this._generateListItems(e))),this._onChangeAbortController===e&&(this._onChangeAbortController=null),(this.layer&&this.effectiveSelectionManager?.getSelection(this.layer))?.length||(this.layer=null)},this._cancelOnSelectionChange=()=>this._onChangeAbortController?.abort(),this._onSelectionChangeDebounced=s(this._onSelectionChangeController,100),this._cancelOnLayerEdit=e=>this._layerEditAbortControllers.get(e)?.abort()}initialize(){this.addHandles([l(()=>[this.view,this.effectiveSelectionManager,...this._sources],()=>{this._onSelectionChange(),this._refreshLayerEditHandles()}),u(()=>this.effectiveSelectionManager?.sources,`change`,()=>{this._onSelectionChange(),this._refreshLayerEditHandles()}),u(()=>this.effectiveSelectionManager,`selection-change`,e=>{this._onSelectionManagerSelectionChange(e),this._onSelectionChange()},d)])}destroy(){this._cancelOnSelectionChange(),this.removeTemporaryHighlight(),this._updatingHandles.destroy(),this._layerEditHandles.drain(i),this._layerEditAbortControllers.forEach(a)}get _sources(){return this.effectiveSelectionManager?.sources.toArray()??[]}get activeLayerItem(){let{layer:e}=this;return e&&this.findLayerItem(e)}get allLayerItems(){return this._allLayerItems??[]}get effectiveCount(){return D(this.allLayerItems)}get effectiveSelectionManager(){return this.selectionManager??this.view?.selectionManager}get isUpdating(){return!!(this._onChangeAbortController||this._updatingHandles.updating)}get layerItems(){return O(this.allLayerItems)}get layerViewMap(){let e=new Map,{view:t}=this;if(!t)return e;for(let n of t.allLayerViews)if(e.set(n.layer.id,n),g(n.layer))for(let t of n.layer.sublayers)e.set(t.id,n);return e}get maxVisibleFeatureCountExceeded(){return this.allLayerItems.some(e=>e.maxVisibleFeatureCountExceeded)}get state(){let{view:e}=this;return e?e.ready?this.effectiveSelectionManager?`ready`:`error`:`loading`:`disabled`}get viewLayersAndTables(){let{view:e}=this;return e?.map?[...e.map.layers.toArray().reverse(),...e.map.tables.toArray().reverse()]:[]}get visibleFeatureCount(){return this.activeLayerItem?.visibleTotal??this.visibleFeatureItems.length}get visibleFeatureItems(){return this.layerItems.flatMap(e=>e.featureItems.filter(e=>e.visible))}get visibleLayerCount(){let{effectiveSelectionManager:e}=this;return!e||e.count===0?0:e.count===1||this.activeLayerItem?1:this.layerItems.filter(e=>e.visible).length}addTemporaryHighlight(e){let{graphic:t,layerView:n}=e;this.removeTemporaryHighlight(),n&&t&&y(n)&&(this._hoverHighlightHandle=n.highlight(t,{name:`temporary`}))}collapseAll(){this._allLayerItems?.forEach(e=>e.expanded=!1)}clear(){this.effectiveSelectionManager?.clear()}deselectFeatureItem(e){let{layer:t,graphic:n,objectId:r}=e;b(t)&&r!=null?this.effectiveSelectionManager?.remove(t,[r]):x(t)&&this.effectiveSelectionManager?.remove(t,[n])}deselectGroupItem(e){e.items.forEach(e=>{k(e)?this.deselectLayerItem(e):this.deselectGroupItem(e)})}deselectLayerItem(e){let{layer:t}=e;this.replace({layer:t,selection:[]})}deselectItem(e){A(e)?this.deselectGroupItem(e):k(e)?this.deselectLayerItem(e):this.deselectFeatureItem(e)}expandAll(){this._allLayerItems?.forEach(e=>e.expanded=!0)}findLayerItem(e){return this.layerItems.find(t=>t.layer===e)}findParentItem(e){return this.allLayerItems.find(t=>t.layer===e)}goToItem(e){k(e)||A(e)?this._goTo(j([e]).map(e=>e.graphic)):this._goTo(e.graphic)}layersToItems(e){let{controller:t,groupLayerItem:n,layers:r,promises:i}=e,{_groupItemCache:a,_layerItemCache:o,effectiveSelectionManager:s,viewLayersAndTables:c}=this,l=r??c;if(!s||s.count===0)return[];let u=[];for(let e of l)switch(e.type){case`subtype-group`:case`knowledge-graph`:case`group`:{let n=a.get(e),r=n??new T({layer:e,viewModel:this});n||a.set(e,r),i.push(r.sync({controller:t,promises:i})),u.push(r)}break;default:if(S(e)){if(!s.getSelection(e)?.length)continue;let r=o.get(e),a=r??new E({groupLayerItem:n,layer:e,viewModel:this});r||o.set(e,a),i.push(a.sync({controller:t,promises:i})),u.push(a)}}return u}removeFromSelection(e){let{layer:t,selection:n}=e;(b(t)||x(t))&&this.effectiveSelectionManager?.remove(t,n)}removeTemporaryHighlight(){this._hoverHighlightHandle=i(this._hoverHighlightHandle)}selectSingleFeatureItem(e){let t=e.identifier;if(this.effectiveSelectionManager)for(let{layer:n}of this.effectiveSelectionManager.selections)this.replace({layer:n,selection:n===e.layer?[t]:[]})}selectSingleGroupItem(e){if(this.effectiveSelectionManager)for(let{layer:t,selection:n}of this.effectiveSelectionManager.selections)this.replace({layer:t,selection:t.parent===e.layer?n:[]})}selectSingleItem(e){A(e)?this.selectSingleGroupItem(e):k(e)?this.selectSingleLayerItem(e):this.selectSingleFeatureItem(e)}selectSingleLayerItem(e){if(this.effectiveSelectionManager)for(let{layer:t,selection:n}of this.effectiveSelectionManager.selections)this.replace({layer:t,selection:t===e.layer?n:[]})}replace(e){let{layer:t,selection:n}=e;(b(t)||x(t))&&this.effectiveSelectionManager?.replace(t,n)}async _goTo(e){let{view:t}=this;if(t)try{await w(t,e)}catch(e){e.name!==`AbortError`&&r.getLogger(this).warn(`Failed to go to feature(s)`,e)}}_onSelectionManagerSelectionChange(e){let{changes:t}=e,n=this.effectiveSelectionManager;n&&t.forEach(({layer:e})=>{let t=n.getSelection(e);t&&t.length!==0||this._expandParentItems(e)})}_expandParentItems(e){let t=this._layerItemCache.get(e);if(t&&(t.expanded=!0),_(e.parent)){let t=this._groupItemCache.get(e.parent);t&&(t.expanded=!0)}}async _generateListItems(e){try{this.removeTemporaryHighlight();let t=[],n=this.layersToItems({controller:e,promises:t});t.length>0&&await Promise.all(t),this._onChangeAbortController===e&&(this._allLayerItems=n)}catch(e){r.getLogger(this).warn(`Failed updating selection`,e)}}_onSelectionChange(){o(this._onSelectionChangeDebounced())}_refreshLayerEditHandles(){let{effectiveSelectionManager:e}=this;if(this._layerEditHandles.drain(i),!e?.sources.length)return;let t=new Set(e.sources.map(e=>v(e)?e.parent:e));for(let e of t)S(e)&&(x(e)?this._layerEditHandles.push(e.graphics.on(`change`,()=>void this._onLayerEdit(e))):C(e)&&this._layerEditHandles.push(e.on(`edits`,t=>void this._onLayerEdit(e,t))))}async _onLayerEdit(e,t){try{if(this.removeTemporaryHighlight(),this._cancelOnLayerEdit(e),t&&!t.updatedFeatures.some(e=>e.objectId!=null&&!e.error))return;let n=new AbortController;this._layerEditAbortControllers.set(e,n);let r=e.type===`subtype-group`||e.type===`knowledge-graph`?this.findParentItem(e):this.findLayerItem(e);if(r?.layerView){let e=r.layerView;if(await this._onLayerViewUpdate(e),n.signal.aborted)return;r.reset(),this._onSelectionChange()}this._layerEditAbortControllers.get(e)===n&&this._layerEditAbortControllers.delete(e)}catch(e){r.getLogger(this).warn(`Failed updating selected features`,e)}}async _onLayerViewUpdate(e){await c(f(()=>e.updating),2e3),await f(()=>!e.updating)}};e([p()],M.prototype,`_allLayerItems`,void 0),e([p()],M.prototype,`_groupItemCache`,void 0),e([p()],M.prototype,`_hoverHighlightHandle`,void 0),e([p()],M.prototype,`_layerEditAbortControllers`,void 0),e([p()],M.prototype,`_layerEditHandles`,void 0),e([p()],M.prototype,`_layerItemCache`,void 0),e([p()],M.prototype,`_onChangeAbortController`,void 0),e([p()],M.prototype,`_sources`,null),e([p()],M.prototype,`_updatingHandles`,void 0),e([p()],M.prototype,`activeLayerItem`,null),e([p()],M.prototype,`allLayerItems`,null),e([p()],M.prototype,`effectiveCount`,null),e([p()],M.prototype,`effectiveSelectionManager`,null),e([p()],M.prototype,`filterText`,void 0),e([p()],M.prototype,`isUpdating`,null),e([p()],M.prototype,`layer`,void 0),e([p()],M.prototype,`layerItems`,null),e([p()],M.prototype,`layerViewMap`,null),e([p()],M.prototype,`maxVisibleFeatureCountExceeded`,null),e([p()],M.prototype,`maxVisibleFeatureCountPerLayer`,void 0),e([p()],M.prototype,`selectionManager`,void 0),e([p()],M.prototype,`state`,null),e([p()],M.prototype,`view`,void 0),e([p()],M.prototype,`viewLayersAndTables`,null),e([p()],M.prototype,`visibleFeatureCount`,null),e([p()],M.prototype,`visibleFeatureItems`,null),e([p()],M.prototype,`visibleLayerCount`,null),M=e([m(`esri.widgets.support.SelectionList.SelectionListViewModel`)],M);const N=M;export{N as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t,formatNumber as n}from"../../intl.js";import{isSome as r}from"../../core/arrayUtils.js";import{on as i,watch as a}from"../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../core/accessorSupport/decorators.js";import c from"../Widget.js";import{loadCalciteComponents as l}from"./componentsUtils.js";import{globalCss as u}from"./globalCss.js";import{messageBundle as d,tsx as f}from"./widget.js";import{isGroupLayerItem as p,isLayerItem as m,isFeatureItem as h}from"./SelectionList/selectionListUtils.js";import g from"./SelectionList/SelectionListViewModel.js";import _ from"./SelectionList/VisibleElements.js";const v=`esri-selection-list`,y=`${v}__list-item`,b={base:v,container:`${v}__container`,flowItem:`${v}__flow-item`,layerDropdown:`${v}__layer-dropdown`,listItemFeature:`${y}__feature`,listItemFeatureIcon:`${y}__feature-icon`,listItemIcon:`${y}__icon`,itemCount:`${v}__item-count`,notice:`${v}__notice`,panel:`${v}__panel`,totalCount:`${v}__total-count`};let x=class extends c{constructor(e,n){super(e,n),this._iconIntersectionObserver=new IntersectionObserver((e,n)=>{e.forEach(async e=>{if(e.isIntersecting){let r=e.target;if(this._hasIcon(r)){n.unobserve(r);return}let i=this._getListItem(r);if(!i)return;this._setHasIcon(r,!0);let a=i.title?t(this.messagesLegend.previewTemplateAriaLabel,{label:i.title}):this.messagesCommon.preview,o=i.thumbnail??await i.fetchThumbnail({ariaLabel:a}).catch(()=>(this._setHasIcon(r,!1),null));if(o==null)return;r.appendChild(o)}})}),this._itemWithOpenMenu=null,this.displayMode=`group`,this.highlightOnHoverEnabled=!0,this.itemActionConfigs=null,this.itemUnavailableFunction=null,this.menuScale=`m`,this.messages=null,this.messagesCommon=null,this.messagesLegend=null,this.onListItemSelect=null,this.scale=`s`,this.title=null,this.viewModel=new g,this.visibleElements=new _,this._afterItemCreate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)},this.clear=this.clear.bind(this),this.collapseAll=this.collapseAll.bind(this),this.removeTemporaryHighlight=this.removeTemporaryHighlight.bind(this)}initialize(){this.addHandles([i(()=>this.effectiveSelectionManager,`selection-change`,()=>this._closeItemMenu()),a(()=>this.highlightOnHoverEnabled,e=>{e||this.removeTemporaryHighlight()})])}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),dropdown:()=>import(`@esri/calcite-components/dist/components/calcite-dropdown`),"dropdown-group":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-group`),"dropdown-item":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`)})}get _effectiveTitle(){if(this.visibleElements.header)return this.title||this.messages?.selection}get _hasFilterText(){let{filterText:e}=this;return e!=null&&e!==``}get activeLayerItem(){return this.viewModel.activeLayerItem}get allLayerItems(){return this.viewModel.allLayerItems}get effectiveCount(){return this.viewModel.effectiveCount}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get filterText(){return this.viewModel.filterText}set filterText(e){this.viewModel.filterText=e}get icon(){return`selection`}set icon(e){this._overrideIfSome(`icon`,e)}get isUpdating(){return this.viewModel.isUpdating}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get layerItems(){return this.viewModel.layerItems}get layerViewMap(){return this.viewModel.layerViewMap}get maxVisibleFeatureCountExceeded(){return this.viewModel.maxVisibleFeatureCountExceeded}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}set maxVisibleFeatureCountPerLayer(e){this.viewModel.maxVisibleFeatureCountPerLayer=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get state(){return this.viewModel.state}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewLayersAndTables(){return this.viewModel.viewLayersAndTables}get visibleFeatureCount(){return this.viewModel.visibleFeatureCount}get visibleFeatureItems(){return this.viewModel.visibleFeatureItems}get visibleLayerCount(){return this.viewModel.visibleLayerCount}addTemporaryHighlight(e){this.viewModel.addTemporaryHighlight(e)}clear(){this.viewModel.clear()}deselectFeatureItem(e){this.viewModel.deselectFeatureItem(e)}deselectGroupItem(e){this.viewModel.deselectGroupItem(e)}deselectLayerItem(e){this.viewModel.deselectLayerItem(e)}deselectItem(e){this.viewModel.deselectItem(e)}collapseAll(){this.viewModel.collapseAll()}expandAll(){this.viewModel.expandAll()}goToItem(e){this.viewModel.goToItem(e)}removeFromSelection(e){this.viewModel.removeFromSelection(e)}removeTemporaryHighlight(){this.viewModel.removeTemporaryHighlight()}selectSingleFeatureItem(e){this.viewModel.selectSingleFeatureItem(e)}selectSingleGroupItem(e){this.viewModel.selectSingleGroupItem(e)}selectSingleItem(e){this.viewModel.selectSingleItem(e)}selectSingleLayerItem(e){this.viewModel.selectSingleLayerItem(e)}replace(e){this.viewModel.replace(e)}render(){return f(`div`,{class:this.classes(b.base,u.widget,u.panel)},f(`calcite-flow`,null,f(`calcite-flow-item`,{class:b.flowItem,heading:this._effectiveTitle,loading:this.state===`loading`,overlayPositioning:`fixed`,scale:this.scale,selected:!0},f(`calcite-panel`,{class:b.panel,overlayPositioning:`fixed`,scale:this.scale},f(`div`,{class:b.container},this._renderActiveLayerDropdown(),this._renderFilterInput(),this._renderList(),this._renderFilterNotice())),this._renderTotalChip(),this._renderMenuActions())))}_renderTotalChip(){let{visibleElements:e}=this;if(!e.totalCount||!e.header)return;let{effectiveCount:r}=this,i=n(r),a=t(this.messages.selectionCount,{count:i});return f(`calcite-chip`,{appearance:`outline`,class:b.totalCount,closable:r>0,closed:r===0,icon:this.maxVisibleFeatureCountExceeded?`exclamation-mark-triangle`:void 0,label:i,scale:this.scale,slot:`header-actions-end`,title:a,onCalciteChipClose:this.clear},i)}_renderMenuActions(){let{visibleElements:e}=this;if(!e.header||!e.menu)return;let{menuScale:t}=this,n=this.effectiveCount===0;return[f(`calcite-action`,{disabled:n,icon:`reset`,key:`clear-action`,scale:t,slot:`header-menu-actions`,text:this.messagesCommon.clear,textEnabled:!0,onclick:this.clear}),f(`calcite-action`,{disabled:n,icon:`folders`,key:`collapse-action`,scale:t,slot:`header-menu-actions`,text:this.messages.collapseAll,textEnabled:!0,onclick:this.collapseAll})]}_renderActiveLayerDropdown(){let{layerItems:e,messages:n}=this;if(!(this.effectiveCount===0||e.length<2||!this.visibleElements.layerFilter))return f(`calcite-combobox`,{class:b.layerDropdown,label:n.filterByLayer,overlayPositioning:`fixed`,placeholder:n.filterByLayer,scale:this.scale,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.filterText=void 0;let t=e.selectedItems[0]?.value??void 0;this.layer=t===`all-layers`?void 0:t}},f(`calcite-combobox-item`,{heading:t(n.allLayersCount,{count:e.length}),icon:`layers`,key:`all-layers`,selected:this.layer==null,value:`all-layers`}),this.layerItems.map(e=>this._renderActiveLayerDropdownItem(e)))}_renderFilterInput(){if(this.visibleElements.filter&&this.effectiveCount!==0)return f(`calcite-input`,{clearable:!0,icon:`search`,placeholder:this.messages.filter,scale:this.scale,value:this.filterText,onCalciteInputInput:({target:{value:e}})=>{this.filterText=e}})}_renderActiveLayerDropdownItem(e){let t=e.title||this.messages.untitledLayer;return f(`calcite-combobox-item`,{heading:t,icon:e.iconName,key:e.key,selected:e.layer===this.layer,value:e.layer})}_renderList(){let{messages:e}=this;if(this.visibleFeatureCount!==0)return f(`calcite-list`,{bind:this,displayMode:`nested`,interactionMode:`interactive`,label:e.widgetLabel,loading:this.isUpdating,scale:this.scale,selectionMode:`none`},this._renderListContent(this.allLayerItems))}_renderListContent(e){return this.activeLayerItem?this._renderLayerItem(this.activeLayerItem):e.map(e=>p(e)?this._renderGroupItem(e):m(e)?this._renderLayerItem(e):null).filter(r)}_renderFilterNotice(){let{visibleElements:e}=this;if(!(this.state===`disabled`||this.visibleFeatureCount>0||!e.filter||!e.filterNotice))return f(`calcite-notice`,{class:b.notice,icon:`exclamation-mark-triangle`,kind:`info`,open:!0,scale:this.scale,width:`full`},f(`div`,{slot:`message`},this.messages.noMatchingFeatures))}_renderItemCount(e){if(!this.visibleElements.itemCount)return;let{messages:r}=this,i=n(e.total),a=n(e.visibleTotal),o=t(r.selectionCount,{count:i});return!this._hasFilterText&&e.maxVisibleFeatureCountExceeded?f(`span`,{class:b.itemCount,slot:`content-end`,title:o},f(`calcite-icon`,{icon:`exclamation-mark-triangle`,scale:`s`,title:r.tooManyFeatures}),`${n(this.maxVisibleFeatureCountPerLayer)}+`):f(`span`,{class:b.itemCount,slot:`content-end`,title:o},a)}_renderItemActions(e){if(!this.visibleElements.itemMenus)return;let{messages:t,messagesCommon:n}=this,r=this._itemWithOpenMenu===e,i=h(e),a=m(e),o=p(e),s=i?t.deselectFeature:a?t.deselectLayer:t.deselectGroup;return[f(`calcite-dropdown`,{"data-testid":`selection-list-dropdown`,open:r,overlayPositioning:`fixed`,placement:`bottom-end`,scale:this.menuScale,slot:`actions-end`,topLayerDisabled:this.topLayerDisabled,width:`m`,onCalciteDropdownClose:()=>this._closeItemMenu(e),onCalciteDropdownOpen:()=>{this._itemWithOpenMenu=e}},f(`calcite-action`,{"data-testid":`selection-list-dropdown-trigger`,icon:`ellipsis`,scale:this.scale,slot:`trigger`,text:n.menu,textEnabled:!1}),r?f(`calcite-dropdown-group`,{selectionMode:`none`},this.visibleElements.zoomToButton?f(`calcite-dropdown-item`,{iconStart:`layer-zoom-to`,key:`zoom-to`,onCalciteDropdownItemSelect:()=>this.goToItem(e)},t.zoomTo):void 0,f(`calcite-dropdown-item`,{iconStart:`selection-filter`,key:`select-single`,onCalciteDropdownItemSelect:()=>this.selectSingleItem(e)},i?t.onlySelectFeature:t.onlySelectThis),f(`calcite-dropdown-item`,{iconStart:`selection-x`,key:`clear-selection`,onCalciteDropdownItemSelect:()=>this.deselectItem(e)},s),this.itemActionConfigs?.map(t=>{let{disabled:n,hidden:r,label:s,type:c}=t;if(!(typeof r==`function`?r({item:e}):r)&&(!c||c===`feature`&&i||c===`layer`&&a||c===`group`&&o))return f(`calcite-dropdown-item`,{disabled:typeof n==`function`?n({item:e}):!!n,iconStart:t.icon??void 0,key:`custom-action-${s}`,onCalciteDropdownItemSelect:()=>t.callback({item:e})},s)})):void 0)]}_renderGroupItem(e){let t=e.title||this.messages.untitledLayer;if(e.visibleTotal===0)return;let{displayMode:n}=this;if(n===`layer`||n===`feature`)return this._renderListContent(e.items);let{visibleElements:r}=this;return f(`calcite-list-item`,{bind:this,closable:!!r.itemCloseActions,"data-type":`group`,expanded:e.expanded,iconStart:r.itemIcons?e.iconName:void 0,key:e.key,label:t,unavailable:this._itemIsUnavailable(e),value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemCollapse:()=>e.expanded=!1,onCalciteListItemExpand:()=>e.expanded=!0,onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemActions(e),this._renderListContent(e.items))}_renderLayerItem(e){if(e.visibleTotal===0||!e.visible)return;if(this.displayMode===`feature`)return this._renderItems(e.featureItems);let{messages:t,visibleElements:n}=this,r=e.title||t.untitledLayer;return f(`calcite-list-item`,{bind:this,closable:!!n.itemCloseActions,"data-type":`layer`,expanded:e.expanded,iconStart:n.itemIcons?e.iconName:void 0,key:e.key,label:r,scale:this.scale,title:e.layerIsVisible?void 0:t.layerIsNotVisible,unavailable:this._itemIsUnavailable(e),value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemCollapse:()=>e.expanded=!1,onCalciteListItemExpand:()=>e.expanded=!0,onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemCount(e),this._renderItemActions(e),this._renderItems(e.featureItems),e.maxVisibleFeatureCountExceeded?f(`calcite-notice`,{class:b.notice,icon:`exclamation-mark-triangle`,kind:`info`,open:!0,scale:this.scale},f(`div`,{slot:`message`},t.tooManyFeatures)):void 0)}_renderItems(e){return e.map(e=>this._renderItem(e))}_renderItem(e){if(!e.visible)return;let{highlightOnHoverEnabled:t,messages:n,visibleElements:r}=this,i=e.title||n.untitledFeature,a=r.itemIcons&&this.displayMode!==`feature`,o=r.itemIcons&&e.supportsThumbnail;return f(`calcite-list-item`,{bind:this,class:a?b.listItemFeatureIcon:b.listItemFeature,closable:!!r.itemCloseActions,"data-item":e,"data-type":`feature`,iconStart:o?void 0:e.iconName,key:e.key,label:i,name:i,scale:this.scale,unavailable:this._itemIsUnavailable(e),value:i,onblur:t?()=>this.removeTemporaryHighlight():void 0,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemSelect:t=>this._onListItemSelect(e,t),onfocus:t?()=>this.addTemporaryHighlight(e):void 0,onpointerenter:t?()=>this.addTemporaryHighlight(e):void 0,onpointerleave:t?()=>this.removeTemporaryHighlight():void 0},this._renderItemIcon(e),this._renderItemActions(e))}_renderItemIcon(e){if(this.visibleElements.itemIcons&&e.supportsThumbnail)return f(`div`,{class:b.listItemIcon,key:`content-start`,slot:`content-start`},f(`span`,{afterCreate:this._afterItemCreate,afterRemoved:this._afterItemRemoved,"data-has-icon":!1,"data-item":e,key:e.thumbnailKey}))}_itemIsUnavailable(e){return this.itemUnavailableFunction?.({item:e})||!e.layerIsVisible}_getListItem(e){return e?.[`data-item`]}_hasIcon(e){return!!e?.[`data-has-icon`]}_setHasIcon(e,t){e&&(e[`data-has-icon`]=t)}_onListItemSelect(e,t){t.stopPropagation(),this._closeItemMenu(),this.onListItemSelect?.({item:e})}_closeItemMenu(e){(!e||e===this._itemWithOpenMenu)&&(this._itemWithOpenMenu=null)}};e([o()],x.prototype,`_effectiveTitle`,null),e([o()],x.prototype,`_hasFilterText`,null),e([o()],x.prototype,`_itemWithOpenMenu`,void 0),e([o()],x.prototype,`activeLayerItem`,null),e([o()],x.prototype,`allLayerItems`,null),e([o()],x.prototype,`displayMode`,void 0),e([o()],x.prototype,`effectiveCount`,null),e([o()],x.prototype,`effectiveSelectionManager`,null),e([o()],x.prototype,`filterText`,null),e([o()],x.prototype,`highlightOnHoverEnabled`,void 0),e([o()],x.prototype,`icon`,null),e([o()],x.prototype,`itemActionConfigs`,void 0),e([o()],x.prototype,`itemUnavailableFunction`,void 0),e([o()],x.prototype,`isUpdating`,null),e([o()],x.prototype,`label`,null),e([o()],x.prototype,`layer`,null),e([o()],x.prototype,`layerItems`,null),e([o()],x.prototype,`layerViewMap`,null),e([o()],x.prototype,`maxVisibleFeatureCountExceeded`,null),e([o()],x.prototype,`maxVisibleFeatureCountPerLayer`,null),e([o()],x.prototype,`menuScale`,void 0),e([o(),d(`esri/widgets/support/SelectionList/t9n/SelectionList`)],x.prototype,`messages`,void 0),e([o(),d(`esri/t9n/common`)],x.prototype,`messagesCommon`,void 0),e([o(),d(`esri/widgets/Legend/t9n/Legend`)],x.prototype,`messagesLegend`,void 0),e([o()],x.prototype,`onListItemSelect`,void 0),e([o()],x.prototype,`scale`,void 0),e([o()],x.prototype,`selectionManager`,null),e([o()],x.prototype,`state`,null),e([o()],x.prototype,`title`,void 0),e([o()],x.prototype,`view`,null),e([o()],x.prototype,`viewLayersAndTables`,null),e([o()],x.prototype,`viewModel`,void 0),e([o({type:_,nonNullable:!0})],x.prototype,`visibleElements`,void 0),e([o()],x.prototype,`visibleFeatureCount`,null),e([o()],x.prototype,`visibleFeatureItems`,null),e([o()],x.prototype,`visibleLayerCount`,null),x=e([s(`esri.widgets.support.SelectionList`)],x);const S=x;export{S as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t,formatNumber as n}from"../../intl.js";import{isSome as r}from"../../core/arrayUtils.js";import{on as i,watch as a}from"../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../core/accessorSupport/decorators.js";import c from"../Widget.js";import{loadCalciteComponents as l}from"./componentsUtils.js";import{globalCss as u}from"./globalCss.js";import{messageBundle as d,tsx as f}from"./widget.js";import{isGroupLayerItem as p,isLayerItem as m,isFeatureItem as h}from"./SelectionList/selectionListUtils.js";import g from"./SelectionList/SelectionListViewModel.js";import _ from"./SelectionList/VisibleElements.js";const v=`esri-selection-list`,y=`${v}__list-item`,b={base:v,container:`${v}__container`,flowItem:`${v}__flow-item`,layerDropdown:`${v}__layer-dropdown`,listItemFeature:`${y}__feature`,listItemFeatureIcon:`${y}__feature-icon`,listItemIcon:`${y}__icon`,itemCount:`${v}__item-count`,notice:`${v}__notice`,panel:`${v}__panel`,totalCount:`${v}__total-count`};let x=class extends c{constructor(e,n){super(e,n),this._iconIntersectionObserver=new IntersectionObserver((e,n)=>{e.forEach(async e=>{if(e.isIntersecting){let r=e.target;if(this._hasIcon(r)){n.unobserve(r);return}let i=this._getListItem(r);if(!i)return;this._setHasIcon(r,!0);let a=i.title?t(this.messagesLegend.previewTemplateAriaLabel,{label:i.title}):this.messagesCommon.preview,o=i.thumbnail??await i.fetchThumbnail({ariaLabel:a}).catch(()=>(this._setHasIcon(r,!1),null));if(o==null)return;r.appendChild(o)}})}),this._itemWithOpenMenu=null,this.displayMode=`group`,this.highlightOnHoverEnabled=!0,this.itemActionConfigs=null,this.itemUnavailableFunction=null,this.menuScale=`m`,this.messages=null,this.messagesCommon=null,this.messagesLegend=null,this.onListItemSelect=null,this.scale=`s`,this.title=null,this.viewModel=new g,this.visibleElements=new _,this._afterItemCreate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)},this.clear=this.clear.bind(this),this.collapseAll=this.collapseAll.bind(this),this.removeTemporaryHighlight=this.removeTemporaryHighlight.bind(this)}initialize(){this.addHandles([i(()=>this.effectiveSelectionManager,`selection-change`,()=>this._closeItemMenu()),a(()=>this.highlightOnHoverEnabled,e=>{e||this.removeTemporaryHighlight()})])}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),dropdown:()=>import(`@esri/calcite-components/dist/components/calcite-dropdown`),"dropdown-group":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-group`),"dropdown-item":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`)})}get _effectiveTitle(){if(this.visibleElements.header)return this.title||this.messages?.selection}get _hasFilterText(){let{filterText:e}=this;return e!=null&&e!==``}get activeLayerItem(){return this.viewModel.activeLayerItem}get allLayerItems(){return this.viewModel.allLayerItems}get effectiveCount(){return this.viewModel.effectiveCount}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get filterText(){return this.viewModel.filterText}set filterText(e){this.viewModel.filterText=e}get icon(){return`selection`}set icon(e){this._overrideIfSome(`icon`,e)}get isUpdating(){return this.viewModel.isUpdating}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get layerItems(){return this.viewModel.layerItems}get layerViewMap(){return this.viewModel.layerViewMap}get maxVisibleFeatureCountExceeded(){return this.viewModel.maxVisibleFeatureCountExceeded}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}set maxVisibleFeatureCountPerLayer(e){this.viewModel.maxVisibleFeatureCountPerLayer=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get state(){return this.viewModel.state}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewLayersAndTables(){return this.viewModel.viewLayersAndTables}get visibleFeatureCount(){return this.viewModel.visibleFeatureCount}get visibleFeatureItems(){return this.viewModel.visibleFeatureItems}get visibleLayerCount(){return this.viewModel.visibleLayerCount}addTemporaryHighlight(e){this.viewModel.addTemporaryHighlight(e)}clear(){this.viewModel.clear()}deselectFeatureItem(e){this.viewModel.deselectFeatureItem(e)}deselectGroupItem(e){this.viewModel.deselectGroupItem(e)}deselectLayerItem(e){this.viewModel.deselectLayerItem(e)}deselectItem(e){this.viewModel.deselectItem(e)}collapseAll(){this.viewModel.collapseAll()}expandAll(){this.viewModel.expandAll()}goToItem(e){this.viewModel.goToItem(e)}removeFromSelection(e){this.viewModel.removeFromSelection(e)}removeTemporaryHighlight(){this.viewModel.removeTemporaryHighlight()}selectSingleFeatureItem(e){this.viewModel.selectSingleFeatureItem(e)}selectSingleGroupItem(e){this.viewModel.selectSingleGroupItem(e)}selectSingleItem(e){this.viewModel.selectSingleItem(e)}selectSingleLayerItem(e){this.viewModel.selectSingleLayerItem(e)}replace(e){this.viewModel.replace(e)}render(){return f(`div`,{class:this.classes(b.base,u.widget,u.panel)},f(`calcite-flow`,null,f(`calcite-flow-item`,{class:b.flowItem,heading:this._effectiveTitle,loading:this.state===`loading`,overlayPositioning:`fixed`,scale:this.scale,selected:!0},f(`calcite-panel`,{class:b.panel,overlayPositioning:`fixed`,scale:this.scale},f(`div`,{class:b.container},this._renderActiveLayerDropdown(),this._renderFilterInput(),this._renderList(),this._renderFilterNotice())),this._renderTotalChip(),this._renderMenuActions())))}_renderTotalChip(){let{visibleElements:e}=this;if(!e.totalCount||!e.header)return;let{effectiveCount:r}=this,i=n(r),a=t(this.messages.selectionCount,{count:i});return f(`calcite-chip`,{appearance:`outline`,class:b.totalCount,closable:r>0,closed:r===0,icon:this.maxVisibleFeatureCountExceeded?`exclamation-mark-triangle`:void 0,label:i,scale:this.scale,slot:`header-actions-end`,title:a,onCalciteChipClose:this.clear},i)}_renderMenuActions(){let{visibleElements:e}=this;if(!e.header||!e.menu)return;let{menuScale:t}=this,n=this.effectiveCount===0;return[f(`calcite-action`,{disabled:n,icon:`reset`,key:`clear-action`,scale:t,slot:`header-menu-actions`,text:this.messagesCommon.clear,textEnabled:!0,onclick:this.clear}),f(`calcite-action`,{disabled:n,icon:`folders`,key:`collapse-action`,scale:t,slot:`header-menu-actions`,text:this.messages.collapseAll,textEnabled:!0,onclick:this.collapseAll})]}_renderActiveLayerDropdown(){let{layerItems:e,messages:n}=this;if(!(this.effectiveCount===0||e.length<2||!this.visibleElements.layerFilter))return f(`calcite-combobox`,{class:b.layerDropdown,label:n.filterByLayer,overlayPositioning:`fixed`,placeholder:n.filterByLayer,scale:this.scale,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.filterText=void 0;let t=e.selectedItems[0]?.value??void 0;this.layer=t===`all-layers`?void 0:t}},f(`calcite-combobox-item`,{heading:t(n.allLayersCount,{count:e.length}),icon:`layers`,key:`all-layers`,selected:this.layer==null,value:`all-layers`}),this.layerItems.map(e=>this._renderActiveLayerDropdownItem(e)))}_renderFilterInput(){if(this.visibleElements.filter&&this.effectiveCount!==0)return f(`calcite-input`,{clearable:!0,icon:`search`,placeholder:this.messages.filter,scale:this.scale,value:this.filterText,onCalciteInputInput:({target:{value:e}})=>{this.filterText=e}})}_renderActiveLayerDropdownItem(e){let t=e.title||this.messages.untitledLayer;return f(`calcite-combobox-item`,{heading:t,icon:e.iconName,key:e.key,selected:e.layer===this.layer,value:e.layer})}_renderList(){let{messages:e}=this;if(this.visibleFeatureCount!==0)return f(`calcite-list`,{bind:this,displayMode:`nested`,interactionMode:`interactive`,label:e.widgetLabel,loading:this.isUpdating,scale:this.scale,selectionMode:`none`},this._renderListContent(this.allLayerItems))}_renderListContent(e){return this.activeLayerItem?this._renderLayerItem(this.activeLayerItem):e.map(e=>p(e)?this._renderGroupItem(e):m(e)?this._renderLayerItem(e):null).filter(r)}_renderFilterNotice(){let{visibleElements:e}=this;if(!(this.state===`disabled`||this.visibleFeatureCount>0||!e.filter||!e.filterNotice))return f(`calcite-notice`,{class:b.notice,icon:`exclamation-mark-triangle`,kind:`info`,open:!0,scale:this.scale,width:`full`},f(`div`,{slot:`message`},this.messages.noMatchingFeatures))}_renderItemCount(e){if(!this.visibleElements.itemCount)return;let{messages:r}=this,i=n(e.total),a=n(e.visibleTotal),o=t(r.selectionCount,{count:i});return!this._hasFilterText&&e.maxVisibleFeatureCountExceeded?f(`span`,{class:b.itemCount,slot:`content-end`,title:o},f(`calcite-icon`,{icon:`exclamation-mark-triangle`,scale:`s`,title:r.tooManyFeatures}),`${n(this.maxVisibleFeatureCountPerLayer)}+`):f(`span`,{class:b.itemCount,slot:`content-end`,title:o},a)}_renderItemActions(e){if(!this.visibleElements.itemMenus)return;let{messages:t,messagesCommon:n}=this,r=this._itemWithOpenMenu===e,i=h(e),a=m(e),o=p(e),s=i?t.deselectFeature:a?t.deselectLayer:t.deselectGroup;return[f(`calcite-dropdown`,{"data-testid":`selection-list-dropdown`,open:r,overlayPositioning:`fixed`,placement:`bottom-end`,scale:this.menuScale,slot:`actions-end`,topLayerDisabled:this.topLayerDisabled,width:`m`,onCalciteDropdownClose:()=>this._closeItemMenu(e),onCalciteDropdownOpen:()=>{this._itemWithOpenMenu=e}},f(`calcite-action`,{"data-testid":`selection-list-dropdown-trigger`,icon:`ellipsis`,scale:this.scale,slot:`trigger`,text:n.menu,textEnabled:!1}),r?f(`calcite-dropdown-group`,{selectionMode:`none`},this.visibleElements.zoomToButton?f(`calcite-dropdown-item`,{iconStart:`layer-zoom-to`,key:`zoom-to`,onCalciteDropdownItemSelect:()=>this.goToItem(e)},t.zoomTo):void 0,f(`calcite-dropdown-item`,{iconStart:`selection-filter`,key:`select-single`,onCalciteDropdownItemSelect:()=>this.selectSingleItem(e)},i?t.onlySelectFeature:t.onlySelectThis),f(`calcite-dropdown-item`,{iconStart:`selection-x`,key:`clear-selection`,onCalciteDropdownItemSelect:()=>this.deselectItem(e)},s),this.itemActionConfigs?.map(t=>{let{disabled:n,hidden:r,label:s,type:c}=t;if(!(typeof r==`function`?r({item:e}):r)&&(!c||c===`feature`&&i||c===`layer`&&a||c===`group`&&o))return f(`calcite-dropdown-item`,{disabled:typeof n==`function`?n({item:e}):!!n,iconStart:t.icon??void 0,key:`custom-action-${s}`,onCalciteDropdownItemSelect:()=>t.callback({item:e})},s)})):void 0)]}_renderGroupItem(e){let t=e.title||this.messages.untitledLayer;if(e.visibleTotal===0)return;let{displayMode:n}=this;if(n===`layer`||n===`feature`)return this._renderListContent(e.items);let{visibleElements:r}=this;return f(`calcite-list-item`,{bind:this,closable:!!r.itemCloseActions,"data-type":`group`,expanded:e.expanded,iconStart:r.itemIcons?e.iconName:void 0,key:e.key,label:t,unavailable:this._itemIsUnavailable(e),value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemCollapse:()=>e.expanded=!1,onCalciteListItemExpand:()=>e.expanded=!0,onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemActions(e),this._renderListContent(e.items))}_renderLayerItem(e){if(e.visibleTotal===0||!e.visible)return;if(this.displayMode===`feature`)return this._renderItems(e.featureItems);let{messages:t,visibleElements:n}=this,r=e.title||t.untitledLayer;return f(`calcite-list-item`,{bind:this,closable:!!n.itemCloseActions,"data-type":`layer`,expanded:e.expanded,iconStart:n.itemIcons?e.iconName:void 0,key:e.key,label:r,scale:this.scale,title:e.layerIsVisible?void 0:t.layerIsNotVisible,unavailable:this._itemIsUnavailable(e),value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemCollapse:()=>e.expanded=!1,onCalciteListItemExpand:()=>e.expanded=!0,onCalciteListItemSelect:t=>this._onListItemSelect(e,t)},this._renderItemCount(e),this._renderItemActions(e),this._renderItems(e.featureItems),e.maxVisibleFeatureCountExceeded?f(`calcite-notice`,{class:b.notice,icon:`exclamation-mark-triangle`,kind:`info`,open:!0,scale:this.scale},f(`div`,{slot:`message`},t.tooManyFeatures)):void 0)}_renderItems(e){return e.map(e=>this._renderItem(e))}_renderItem(e){if(!e.visible)return;let{highlightOnHoverEnabled:t,messages:n,visibleElements:r}=this,i=e.title||n.untitledFeature,a=r.itemIcons&&this.displayMode!==`feature`,o=r.itemIcons&&e.supportsThumbnail;return f(`calcite-list-item`,{bind:this,class:a?b.listItemFeatureIcon:b.listItemFeature,closable:!!r.itemCloseActions,"data-item":e,"data-type":`feature`,iconStart:o?void 0:e.iconName,key:e.key,label:i,name:i,scale:this.scale,unavailable:this._itemIsUnavailable(e),value:i,onblur:t?()=>this.removeTemporaryHighlight():void 0,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)},onCalciteListItemSelect:t=>this._onListItemSelect(e,t),onfocus:t?()=>this.addTemporaryHighlight(e):void 0,onpointerenter:t?()=>this.addTemporaryHighlight(e):void 0,onpointerleave:t?()=>this.removeTemporaryHighlight():void 0},this._renderItemIcon(e),this._renderItemActions(e))}_renderItemIcon(e){if(this.visibleElements.itemIcons&&e.supportsThumbnail)return f(`div`,{class:b.listItemIcon,key:`content-start`,slot:`content-start`},f(`span`,{afterCreate:this._afterItemCreate,afterRemoved:this._afterItemRemoved,"data-has-icon":!1,"data-item":e,key:e.thumbnailKey}))}_itemIsUnavailable(e){return this.itemUnavailableFunction?.({item:e})||!e.layerIsVisible}_getListItem(e){return e?.[`data-item`]}_hasIcon(e){return!!e?.[`data-has-icon`]}_setHasIcon(e,t){e&&(e[`data-has-icon`]=t)}_onListItemSelect(e,t){t.stopPropagation(),this._closeItemMenu(),this.onListItemSelect?.({item:e})}_closeItemMenu(e){e&&e!==this._itemWithOpenMenu||(this._itemWithOpenMenu=null)}};e([o()],x.prototype,`_effectiveTitle`,null),e([o()],x.prototype,`_hasFilterText`,null),e([o()],x.prototype,`_itemWithOpenMenu`,void 0),e([o()],x.prototype,`activeLayerItem`,null),e([o()],x.prototype,`allLayerItems`,null),e([o()],x.prototype,`displayMode`,void 0),e([o()],x.prototype,`effectiveCount`,null),e([o()],x.prototype,`effectiveSelectionManager`,null),e([o()],x.prototype,`filterText`,null),e([o()],x.prototype,`highlightOnHoverEnabled`,void 0),e([o()],x.prototype,`icon`,null),e([o()],x.prototype,`itemActionConfigs`,void 0),e([o()],x.prototype,`itemUnavailableFunction`,void 0),e([o()],x.prototype,`isUpdating`,null),e([o()],x.prototype,`label`,null),e([o()],x.prototype,`layer`,null),e([o()],x.prototype,`layerItems`,null),e([o()],x.prototype,`layerViewMap`,null),e([o()],x.prototype,`maxVisibleFeatureCountExceeded`,null),e([o()],x.prototype,`maxVisibleFeatureCountPerLayer`,null),e([o()],x.prototype,`menuScale`,void 0),e([o(),d(`esri/widgets/support/SelectionList/t9n/SelectionList`)],x.prototype,`messages`,void 0),e([o(),d(`esri/t9n/common`)],x.prototype,`messagesCommon`,void 0),e([o(),d(`esri/widgets/Legend/t9n/Legend`)],x.prototype,`messagesLegend`,void 0),e([o()],x.prototype,`onListItemSelect`,void 0),e([o()],x.prototype,`scale`,void 0),e([o()],x.prototype,`selectionManager`,null),e([o()],x.prototype,`state`,null),e([o()],x.prototype,`title`,void 0),e([o()],x.prototype,`view`,null),e([o()],x.prototype,`viewLayersAndTables`,null),e([o()],x.prototype,`viewModel`,void 0),e([o({type:_,nonNullable:!0})],x.prototype,`visibleElements`,void 0),e([o()],x.prototype,`visibleFeatureCount`,null),e([o()],x.prototype,`visibleFeatureItems`,null),e([o()],x.prototype,`visibleLayerCount`,null),x=e([s(`esri.widgets.support.SelectionList`)],x);const S=x;export{S as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{assetPathChanged as e,setAssetPath as t}from"@esri/calcite-components/dist/components";import{getAssetUrl as n}from"../../assets.js";import"../../core/has.js";import{makeAbsolute as r}from"../../core/urlUtils.js";function i(){e||t(r(n(`components/assets`)))}function a(e){let t=[];for(let n of Object.keys(e))customElements.get(`calcite-${n}`)||t.push(e[n]?.());return t.length>0?Promise.all(t):null}function o(){let e=null;return{get trigger(){return e},storeTrigger(t){e=t},destroy(t){(!t||e===t)&&(e=null)},referenceTrigger(t){t.referenceElement=e}}}export{i as commitAssetPath,o as createDropdownReference,a as loadCalciteComponents};
2
+ import{assetPathChanged as e,setAssetPath as t}from"@esri/calcite-components/dist/components";import{getAssetUrl as n}from"../../assets.js";import"../../core/has.js";import{makeAbsolute as r}from"../../core/urlUtils.js";function i(){e||t(r(n(`components/assets`)))}function a(e){let t=[];for(let n of Object.keys(e))customElements.get(`calcite-${n}`)||t.push(e[n]?.());return t.length>0?Promise.all(t):null}function o(){let e=null;return{get trigger(){return e},storeTrigger(t){e=t},destroy(t){t&&e!==t||(e=null)},referenceTrigger(t){t.referenceElement=e}}}export{i as commitAssetPath,o as createDropdownReference,a as loadCalciteComponents};