@arcgis/core 4.27.0-next.20230317 → 4.27.0-next.20230321

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 (300) hide show
  1. package/TimeExtent.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/05e47e78e258dd5ab6ea.js +1 -0
  4. package/assets/esri/core/workers/chunks/{b661d2c785333429aad3.js → 0b005e3502dd97562701.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{8812629e07e5bf46caa7.js → 1d2271a36641f6834401.js} +1 -1
  6. package/assets/esri/core/workers/chunks/1d65a2bc91774fdbd690.js +1 -0
  7. package/assets/esri/core/workers/chunks/273a894ab44b76ee4488.js +1 -0
  8. package/assets/esri/core/workers/chunks/29ee4f14602caf6967e4.js +1 -0
  9. package/assets/esri/core/workers/chunks/{56ddde83f40cda0a8a5c.js → 2c0775541cfec9d43acb.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{48a1b8be3c2a59c4c925.js → 32f9b488915a4a8864e5.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{790d62ea3c90ca076095.js → 403c18eaa30673b096fe.js} +1 -1
  12. package/assets/esri/core/workers/chunks/41bbf58417f4085657f4.js +1 -0
  13. package/assets/esri/core/workers/chunks/{c36efbdd0a84fe851bbb.js → 433686dfda9e2ff1f98b.js} +1 -1
  14. package/assets/esri/core/workers/chunks/4be7647605300e07e843.js +1 -0
  15. package/assets/esri/core/workers/chunks/5cc99e9e974fec32b597.js +1 -0
  16. package/assets/esri/core/workers/chunks/6062bc79ebd5047a473a.js +1 -0
  17. package/assets/esri/core/workers/chunks/{57aa75a10fb8bb3fa517.js → 622139ef8f7181e48cd0.js} +1 -1
  18. package/assets/esri/core/workers/chunks/6b14673a4afd6ef81487.js +1 -0
  19. package/assets/esri/core/workers/chunks/70ea44365021b665c213.js +1 -0
  20. package/assets/esri/core/workers/chunks/{7727e6a4338c831f272f.js → 7570ec6a64a88ddc0fdd.js} +1 -1
  21. package/assets/esri/core/workers/chunks/81a6f4b43e047c3395c0.js +1 -0
  22. package/assets/esri/core/workers/chunks/87edeb09a948122fa030.js +1 -0
  23. package/assets/esri/core/workers/chunks/8daa0523d49653cc5861.js +1 -0
  24. package/assets/esri/core/workers/chunks/{3ff3d67f1bc6e2b2f48e.js → 90e12cff7672f3d92ced.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{f150bd21c3b9e098da57.js → 92951b85676df776961f.js} +56 -56
  26. package/assets/esri/core/workers/chunks/983b26414cc46d9c3105.js +1 -0
  27. package/assets/esri/core/workers/chunks/{19355af765993931a7c0.js → 9b196a726c6d175ca60f.js} +1 -1
  28. package/assets/esri/core/workers/chunks/a27951dbe83c63f9d01a.js +1 -0
  29. package/assets/esri/core/workers/chunks/bc002e4dff8859571a7a.js +1 -0
  30. package/assets/esri/core/workers/chunks/bfc2b40f1892970281c6.js +1 -0
  31. package/assets/esri/core/workers/chunks/c162d1e27e779732d494.js +1 -0
  32. package/assets/esri/core/workers/chunks/c5d872adce711ec61ede.js +1 -0
  33. package/assets/esri/core/workers/chunks/c5dd23d11fa91b0f318e.js +1 -0
  34. package/assets/esri/core/workers/chunks/{e97c4beb3a6cf1d91310.js → c6c2f771bca0e303b5c0.js} +1 -1
  35. package/assets/esri/core/workers/chunks/c8f019d13f6b22481f2e.js +1 -0
  36. package/assets/esri/core/workers/chunks/d34dbb49508a95588423.js +1 -0
  37. package/assets/esri/core/workers/chunks/e637e47000f4dc48054d.js +1 -0
  38. package/assets/esri/core/workers/chunks/e7093d27a31345953dca.js +1 -0
  39. package/assets/esri/core/workers/chunks/f1ab86dbbd5b04e2a96c.js +1 -0
  40. package/assets/esri/core/workers/chunks/f85a01429959e60a8713.js +1 -0
  41. package/assets/esri/core/workers/chunks/ff9efa829497557ec26a.js +1 -0
  42. package/assets/esri/themes/base/widgets/_Bookmarks.scss +3 -0
  43. package/assets/esri/themes/base/widgets/_Editor.scss +18 -0
  44. package/assets/esri/themes/base/widgets/_ItemList.scss +13 -33
  45. package/assets/esri/themes/dark/main.css +1 -1
  46. package/assets/esri/themes/light/main.css +1 -1
  47. package/assets/esri/themes/light/view.css +1 -1
  48. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  49. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  50. package/assets/esri/widgets/Slice/t9n/Slice_ar.json +1 -1
  51. package/assets/esri/widgets/Slice/t9n/Slice_bg.json +1 -1
  52. package/assets/esri/widgets/Slice/t9n/Slice_bs.json +1 -1
  53. package/assets/esri/widgets/Slice/t9n/Slice_ca.json +1 -1
  54. package/assets/esri/widgets/Slice/t9n/Slice_cs.json +1 -1
  55. package/assets/esri/widgets/Slice/t9n/Slice_da.json +1 -1
  56. package/assets/esri/widgets/Slice/t9n/Slice_de.json +1 -1
  57. package/assets/esri/widgets/Slice/t9n/Slice_el.json +1 -1
  58. package/assets/esri/widgets/Slice/t9n/Slice_es.json +1 -1
  59. package/assets/esri/widgets/Slice/t9n/Slice_et.json +1 -1
  60. package/assets/esri/widgets/Slice/t9n/Slice_fi.json +1 -1
  61. package/assets/esri/widgets/Slice/t9n/Slice_fr.json +1 -1
  62. package/assets/esri/widgets/Slice/t9n/Slice_he.json +1 -1
  63. package/assets/esri/widgets/Slice/t9n/Slice_hr.json +1 -1
  64. package/assets/esri/widgets/Slice/t9n/Slice_hu.json +1 -1
  65. package/assets/esri/widgets/Slice/t9n/Slice_id.json +1 -1
  66. package/assets/esri/widgets/Slice/t9n/Slice_it.json +1 -1
  67. package/assets/esri/widgets/Slice/t9n/Slice_ja.json +1 -1
  68. package/assets/esri/widgets/Slice/t9n/Slice_ko.json +1 -1
  69. package/assets/esri/widgets/Slice/t9n/Slice_lt.json +1 -1
  70. package/assets/esri/widgets/Slice/t9n/Slice_lv.json +1 -1
  71. package/assets/esri/widgets/Slice/t9n/Slice_nb.json +1 -1
  72. package/assets/esri/widgets/Slice/t9n/Slice_nl.json +1 -1
  73. package/assets/esri/widgets/Slice/t9n/Slice_pl.json +1 -1
  74. package/assets/esri/widgets/Slice/t9n/Slice_pt-BR.json +1 -1
  75. package/assets/esri/widgets/Slice/t9n/Slice_pt-PT.json +1 -1
  76. package/assets/esri/widgets/Slice/t9n/Slice_ro.json +1 -1
  77. package/assets/esri/widgets/Slice/t9n/Slice_ru.json +1 -1
  78. package/assets/esri/widgets/Slice/t9n/Slice_sk.json +1 -1
  79. package/assets/esri/widgets/Slice/t9n/Slice_sl.json +1 -1
  80. package/assets/esri/widgets/Slice/t9n/Slice_sr.json +1 -1
  81. package/assets/esri/widgets/Slice/t9n/Slice_sv.json +1 -1
  82. package/assets/esri/widgets/Slice/t9n/Slice_th.json +1 -1
  83. package/assets/esri/widgets/Slice/t9n/Slice_tr.json +1 -1
  84. package/assets/esri/widgets/Slice/t9n/Slice_uk.json +1 -1
  85. package/assets/esri/widgets/Slice/t9n/Slice_vi.json +1 -1
  86. package/assets/esri/widgets/Slice/t9n/Slice_zh-CN.json +1 -1
  87. package/assets/esri/widgets/Slice/t9n/Slice_zh-HK.json +1 -1
  88. package/assets/esri/widgets/Slice/t9n/Slice_zh-TW.json +1 -1
  89. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ar.json +1 -1
  90. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bg.json +1 -1
  91. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bs.json +1 -1
  92. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ca.json +1 -1
  93. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_cs.json +1 -1
  94. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_da.json +1 -1
  95. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_de.json +1 -1
  96. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_el.json +1 -1
  97. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_es.json +1 -1
  98. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_et.json +1 -1
  99. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fi.json +1 -1
  100. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fr.json +1 -1
  101. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_he.json +1 -1
  102. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hr.json +1 -1
  103. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hu.json +1 -1
  104. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_id.json +1 -1
  105. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_it.json +1 -1
  106. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ja.json +1 -1
  107. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ko.json +1 -1
  108. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lt.json +1 -1
  109. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lv.json +1 -1
  110. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nb.json +1 -1
  111. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nl.json +1 -1
  112. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pl.json +1 -1
  113. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-BR.json +1 -1
  114. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-PT.json +1 -1
  115. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ro.json +1 -1
  116. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ru.json +1 -1
  117. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sk.json +1 -1
  118. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sl.json +1 -1
  119. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sr.json +1 -1
  120. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sv.json +1 -1
  121. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_th.json +1 -1
  122. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_tr.json +1 -1
  123. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_uk.json +1 -1
  124. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_vi.json +1 -1
  125. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-CN.json +1 -1
  126. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-HK.json +1 -1
  127. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-TW.json +1 -1
  128. package/chunks/ColorMaterial.glsl.js +16 -14
  129. package/core/domUtils.js +1 -1
  130. package/core/maybe.js +1 -1
  131. package/core/urlUtils.js +1 -1
  132. package/geohash/GeohashTree.js +1 -1
  133. package/interfaces.d.ts +12 -214
  134. package/layers/SceneLayer.js +1 -1
  135. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  136. package/layers/support/FieldsIndex.js +1 -1
  137. package/layers/support/fieldType.js +1 -1
  138. package/layers/support/fieldUtils.js +1 -1
  139. package/layers/support/rasterFunctionConstants.js +1 -1
  140. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  141. package/layers/support/rasterFunctions/CurvatureFunction.js +5 -0
  142. package/layers/support/rasterFunctions/CurvatureFunctionArguments.js +5 -0
  143. package/layers/support/rasterFunctions/SlopeFunction.js +1 -1
  144. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  145. package/layers/support/rasterFunctions/surfaceUtils.js +1 -1
  146. package/package.json +1 -1
  147. package/portal/schemas/definitions.js +1 -1
  148. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  149. package/support/revision.js +1 -1
  150. package/views/2d/engine/imagery/processor/curvatureProcessor.js +5 -0
  151. package/views/2d/engine/imagery/processor/rasterProcessor.js +1 -1
  152. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  153. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  154. package/views/2d/layers/features/support/BinStore.js +1 -1
  155. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  156. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  157. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  158. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  159. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  160. package/views/2d/layers/features/support/FeatureSetReaderPBFIndirect.js +1 -1
  161. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  162. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  163. package/views/3d/environment/CloudsData.js +1 -1
  164. package/views/3d/environment/CloudsGenerator.js +1 -1
  165. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  166. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  167. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  168. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
  169. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  170. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  171. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  172. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  173. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  174. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  175. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  176. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  177. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  178. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  179. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  180. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  181. package/views/3d/layers/graphics/interfaces.js +1 -1
  182. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  183. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  184. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  185. package/views/3d/support/buffer/glUtil.js +1 -1
  186. package/views/3d/support/buffer/workerHelper.js +1 -1
  187. package/views/3d/support/engineContent/line.js +1 -1
  188. package/views/3d/terrain/PatchRenderData.js +1 -1
  189. package/views/3d/terrain/TerrainSurface.js +1 -1
  190. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +2 -2
  191. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  192. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  193. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  194. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  195. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  196. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  197. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  198. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  199. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  200. package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
  201. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  202. package/views/interactive/tooltip/TransformTooltipInfos.js +1 -1
  203. package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
  204. package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
  205. package/widgets/Bookmarks/css.js +1 -1
  206. package/widgets/Bookmarks.js +1 -1
  207. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  208. package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
  209. package/widgets/Editor/EditorViewModel.js +1 -1
  210. package/widgets/Editor/Upload.js +5 -0
  211. package/widgets/Editor/UploadState.js +4 -0
  212. package/widgets/Editor/workflowUtils.js +1 -1
  213. package/widgets/Editor.js +1 -1
  214. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  215. package/widgets/FeatureForm/{InputField.js → FieldInput.js} +1 -1
  216. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  217. package/widgets/FeatureForm/GroupInput.js +5 -0
  218. package/widgets/FeatureForm/css.js +1 -1
  219. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  220. package/widgets/FeatureForm.js +1 -1
  221. package/widgets/FeatureTable/FieldColumn.js +1 -1
  222. package/widgets/FeatureTemplates/ItemList.js +1 -1
  223. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  224. package/widgets/FeatureTemplates.js +1 -1
  225. package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
  226. package/widgets/LayerList/LayerListViewModel.js +1 -1
  227. package/widgets/LayerList.js +1 -1
  228. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  229. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  230. package/assets/esri/core/workers/chunks/009348f65fab440f7752.js +0 -1
  231. package/assets/esri/core/workers/chunks/075ecd53fb229dfee53c.js +0 -1
  232. package/assets/esri/core/workers/chunks/1c77b92063ee36421914.js +0 -1
  233. package/assets/esri/core/workers/chunks/1ee774c3f29d8074da12.js +0 -1
  234. package/assets/esri/core/workers/chunks/262b6de5a29c713b4010.js +0 -1
  235. package/assets/esri/core/workers/chunks/281c0f936b5645a673ab.js +0 -1
  236. package/assets/esri/core/workers/chunks/2883a59fc1fc9e4d71af.js +0 -1
  237. package/assets/esri/core/workers/chunks/2e032a58ac6717313227.js +0 -1
  238. package/assets/esri/core/workers/chunks/4d4cbfe72835c0460b09.js +0 -1
  239. package/assets/esri/core/workers/chunks/5504dff4113dd74d2fa7.js +0 -1
  240. package/assets/esri/core/workers/chunks/5bded2588008117d0c35.js +0 -1
  241. package/assets/esri/core/workers/chunks/6caf8a0b49bd01906f32.js +0 -1
  242. package/assets/esri/core/workers/chunks/9cab04c71d8bccf0156d.js +0 -1
  243. package/assets/esri/core/workers/chunks/9f02a0670ad73718d8f9.js +0 -1
  244. package/assets/esri/core/workers/chunks/a265e454461edb306e2d.js +0 -1
  245. package/assets/esri/core/workers/chunks/a50ca44a62434bf18664.js +0 -1
  246. package/assets/esri/core/workers/chunks/bd090f9ec6cfe08e19a3.js +0 -1
  247. package/assets/esri/core/workers/chunks/c3338bdce8368731c4e9.js +0 -1
  248. package/assets/esri/core/workers/chunks/c54df59b2b3f73828a44.js +0 -1
  249. package/assets/esri/core/workers/chunks/ddebf3b5a131a6da5419.js +0 -1
  250. package/assets/esri/core/workers/chunks/de461c30aa24ec8bb212.js +0 -1
  251. package/assets/esri/core/workers/chunks/e23f56bee694a38da5b9.js +0 -1
  252. package/assets/esri/core/workers/chunks/ec73d16ef169adfc34fb.js +0 -1
  253. package/assets/esri/core/workers/chunks/ef884e2833868234c13c.js +0 -1
  254. package/assets/esri/core/workers/chunks/f3c99525fb1b0f719fe0.js +0 -1
  255. package/assets/esri/core/workers/chunks/fe314feede84dd688010.js +0 -1
  256. package/assets/esri/core/workers/chunks/ff15557dc7b74162ed75.js +0 -1
  257. package/assets/esri/widgets/Directions/t9n/Printout.json +0 -1
  258. package/assets/esri/widgets/Directions/t9n/Printout_ar.json +0 -1
  259. package/assets/esri/widgets/Directions/t9n/Printout_bg.json +0 -1
  260. package/assets/esri/widgets/Directions/t9n/Printout_bs.json +0 -1
  261. package/assets/esri/widgets/Directions/t9n/Printout_ca.json +0 -1
  262. package/assets/esri/widgets/Directions/t9n/Printout_cs.json +0 -1
  263. package/assets/esri/widgets/Directions/t9n/Printout_da.json +0 -1
  264. package/assets/esri/widgets/Directions/t9n/Printout_de.json +0 -1
  265. package/assets/esri/widgets/Directions/t9n/Printout_el.json +0 -1
  266. package/assets/esri/widgets/Directions/t9n/Printout_en.json +0 -1
  267. package/assets/esri/widgets/Directions/t9n/Printout_es.json +0 -1
  268. package/assets/esri/widgets/Directions/t9n/Printout_et.json +0 -1
  269. package/assets/esri/widgets/Directions/t9n/Printout_fi.json +0 -1
  270. package/assets/esri/widgets/Directions/t9n/Printout_fr.json +0 -1
  271. package/assets/esri/widgets/Directions/t9n/Printout_he.json +0 -1
  272. package/assets/esri/widgets/Directions/t9n/Printout_hr.json +0 -1
  273. package/assets/esri/widgets/Directions/t9n/Printout_hu.json +0 -1
  274. package/assets/esri/widgets/Directions/t9n/Printout_id.json +0 -1
  275. package/assets/esri/widgets/Directions/t9n/Printout_it.json +0 -1
  276. package/assets/esri/widgets/Directions/t9n/Printout_ja.json +0 -1
  277. package/assets/esri/widgets/Directions/t9n/Printout_ko.json +0 -1
  278. package/assets/esri/widgets/Directions/t9n/Printout_lt.json +0 -1
  279. package/assets/esri/widgets/Directions/t9n/Printout_lv.json +0 -1
  280. package/assets/esri/widgets/Directions/t9n/Printout_nb.json +0 -1
  281. package/assets/esri/widgets/Directions/t9n/Printout_nl.json +0 -1
  282. package/assets/esri/widgets/Directions/t9n/Printout_pl.json +0 -1
  283. package/assets/esri/widgets/Directions/t9n/Printout_pt-BR.json +0 -1
  284. package/assets/esri/widgets/Directions/t9n/Printout_pt-PT.json +0 -1
  285. package/assets/esri/widgets/Directions/t9n/Printout_ro.json +0 -1
  286. package/assets/esri/widgets/Directions/t9n/Printout_ru.json +0 -1
  287. package/assets/esri/widgets/Directions/t9n/Printout_sk.json +0 -1
  288. package/assets/esri/widgets/Directions/t9n/Printout_sl.json +0 -1
  289. package/assets/esri/widgets/Directions/t9n/Printout_sr.json +0 -1
  290. package/assets/esri/widgets/Directions/t9n/Printout_sv.json +0 -1
  291. package/assets/esri/widgets/Directions/t9n/Printout_th.json +0 -1
  292. package/assets/esri/widgets/Directions/t9n/Printout_tr.json +0 -1
  293. package/assets/esri/widgets/Directions/t9n/Printout_uk.json +0 -1
  294. package/assets/esri/widgets/Directions/t9n/Printout_vi.json +0 -1
  295. package/assets/esri/widgets/Directions/t9n/Printout_zh-CN.json +0 -1
  296. package/assets/esri/widgets/Directions/t9n/Printout_zh-HK.json +0 -1
  297. package/assets/esri/widgets/Directions/t9n/Printout_zh-TW.json +0 -1
  298. package/widgets/FeatureForm/InputField.d.ts +0 -4
  299. package/widgets/FeatureForm/InputFieldGroup.d.ts +0 -4
  300. package/widgets/FeatureForm/InputFieldGroup.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{neverReached as t}from"../core/compilerUtils.js";import{watch as i}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{getDomainRange as a}from"../layers/support/domainUtils.js";import{getFieldRange as s}from"../layers/support/fieldUtils.js";import r from"./Widget.js";import{CSS as o}from"./FeatureForm/css.js";import{isGroupField as u,isFieldElementWithInputType as d}from"./FeatureForm/featureFormUtils.js";import p from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as c}from"./support/componentsUtils.js";import{Heading as m,incrementHeadingLevel as h}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{vmEvent as g}from"./support/decorators/vmEvent.js";import{tsx as b}from"./support/jsxFactory.js";import{DateTime as v}from"luxon";import{getLocale as _}from"../intl/locale.js";const I="TT",F="data-field-name",y="latn",w=e=>"valueAsDate"in e;let V=class extends r{constructor(e,t){super(e,t),this._dateInputFieldMap=new Map,this._activeInputName="",this._activeNumberFieldEdit=null,this._fieldFocusNeeded=!1,this._fieldToInitialIncompatibleDomainValue=new Map,this._switchFieldsWithInitialIncompatibleValue=new Set,this._userUpdatedInputFieldNames=new Set,this.disabled=!1,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesTemplates=null,this.viewModel=new p,this._handleInputInput=e=>{this._commitInputValue(e.currentTarget)},this._handleFormKeyDown=this._handleFormKeyDown.bind(this),this._handleInputBlur=this._handleInputBlur.bind(this),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this),this._handleInputKeyDown=this._handleInputKeyDown.bind(this),this._handleOptionChange=this._handleOptionChange.bind(this),this._handleGroupClick=this._handleGroupClick.bind(this),this._handleSubmit=this._handleSubmit.bind(this),this._afterInputCreateOrUpdate=this._afterInputCreateOrUpdate.bind(this),this._afterDateInputCreateOrUpdate=this._afterDateInputCreateOrUpdate.bind(this)}initialize(){this.addHandles([i((()=>this.feature),(()=>{const e=this._getFocusableInput("forward");this._activeInputName=e?.name||"",this._userUpdatedInputFieldNames.clear(),this._fieldToInitialIncompatibleDomainValue.clear(),this._switchFieldsWithInitialIncompatibleValue.clear(),this._dateInputFieldMap.clear(),this._fieldFocusNeeded=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._userUpdatedInputFieldNames.add(e))),this._activeInputName=t,this._fieldFocusNeeded=!0,this.scheduleRender()}}))])}loadDependencies(){return c({combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js")})}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}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 spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return b("div",{class:this.classes(o.base,o.widget,o.panel)},"ready"===e?this.renderForm():null)}renderForm(){const e=this.viewModel,t=null!=e.formTitle&&b(m,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&b("p",{class:o.description,key:"description"},e.formDescription),l=t||i?b("div",{class:o.formHeader},t,i):null;return b("form",{class:o.form,novalidate:!0,onsubmit:this._handleSubmit,onkeydown:this._handleFormKeyDown},l,this.renderFields())}renderFields(){const{viewModel:{inputFields:e}}=this;return e.filter((e=>e.visible)).map(((e,t)=>u(e)?this.renderGroup(e,t):this.renderLabeledField(e)))}renderGroup(e,t){const{formTemplate:i,disabled:l}=this,{description:n,inputFields:a,label:s,state:r}=e,u=a.filter((e=>e.visible)),d=this.viewModel.findField(this._activeInputName),p=!(!d||d.group!==e),c=`${this.id}_group_${t}`,f=`${this.id}_group-label_${t}`,g=`${this.id}_group-description_${t}`,v=n?b("p",{class:this.classes(o.groupDescription,o.description),id:g},n):null,_="sequential"===this.groupDisplay,I=_?p:"expanded"===r,F=I?o.collapseIcon:o.expandIcon;return b("fieldset",{"aria-expanded":I.toString(),"aria-labelledby":f,"aria-describedby":n?g:"",class:this.classes(o.group,_?o.groupSequential:null,I?null:o.groupCollapsed,p?o.groupActive:null,l?o.inputDisabled:null),disabled:l,"data-group":e,id:c,key:t,onclick:this._handleGroupClick},b("button",{role:_?"presentation":void 0,class:o.groupHeader,type:"button",tabIndex:_?-1:0},b("div",{class:o.groupTitle},b(m,{class:o.groupLabel,id:f,level:null!=i&&i.title?h(this.headingLevel):this.headingLevel},s),v),_?null:b("span",{class:this.classes(F,o.groupToggleIcon)})),u.map((e=>this.renderLabeledField(e))))}_getFocusableInput(e,t){const i=this.viewModel.allInputFields,l="forward"===e?i:i.slice().reverse();let n;if(t)if(u(t))n=l.indexOf(t.inputFields[0]);else{let i;if(this._isInputFieldInGroup(t)&&"collapsed"===t.group.state){const{inputFields:l}=t.group;i="forward"===e?l[l.length-1]:l[0]}else i=t;n=l.indexOf(i)+1}else n=0;for(let a=n;a<l.length;a++){const e=l[a];if(e.visible)return e}return null}renderLabeledField(e){const{feature:t,label:i,layer:l,type:n}=e;return b("label",{key:`${l.id}-${t.uid}-${e.name}`,class:o.label},[i,"unsupported"!==n?this.renderInputField(e):this.renderUnsupportedField(e),this.renderAuxiliaryText(e)])}renderInputField(e){const{domain:t,name:i,type:l,updating:n,value:a}=e,s=this.getCommonInputProps(e);if("coded-value"===t?.type){if(d(e.fieldElement,"switch")){const{fieldElement:t}=e;if(!(this._switchFieldsWithInitialIncompatibleValue.has(i)||null==a||t.input.onValue!==a&&t.input.offValue!==a))return this.renderSwitchInputField(e,s);this._switchFieldsWithInitialIncompatibleValue.add(i)}return"radio-buttons"===e.inputType?this.renderRadioButtonsInputField(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),s):this.renderSelectInputField(e,this._getFieldValueOptions(i,t),s)}if("datetime-picker"===e.inputType||"date"===l)return this.renderDateInputField(e,s);const r="number"===l?b("input",{type:"number",...s,value:null!=this._activeNumberFieldEdit&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${s.value}`}):"text-area"===e.inputType?b("textarea",{...s}):b("input",{type:"text",...s});return n?b("div",{class:o.inputFieldWrapper},r,b("div",{class:o.inputFieldLoader},b("calcite-progress",{type:"indeterminate"}))):r}renderDateInputField(e,t){const{includeTime:i,label:l,name:n,valid:a,value:s}=e,{readOnly:r,required:u}=t,{date:d,time:p}=this._formatValueForDateInputs(s),c=null!=t.max?this._formatValueForDateInputs(t.max):void 0,m=null!=t.min?this._formatValueForDateInputs(t.min):void 0,h=c?.date??void 0,f=m?.date??void 0,g={afterCreate:this._afterDateInputCreate,afterUpdate:this._afterDateInputCreateOrUpdate,"aria-invalid":!a,label:l,numberingSystem:y,overlayPositioning:"fixed",readOnly:r,required:u,tabIndex:0,[F]:n};return b("div",{key:`${t.key}-date-time-container`,class:o.dateInputContainer},b("calcite-input-date-picker",{bind:this,...g,class:this.classes(t.class,o.inputDate),"data-date-part":"date",key:`${t.key}-date-input`,valueAsDate:d??void 0,maxAsDate:h,minAsDate:f,onCalciteInputDatePickerChange:e=>this._commitDateChanges(e.target),onblur:e=>this._commitDateChanges(e.target,!0)}),i?b("calcite-input-time-picker",{bind:this,...g,class:this.classes(t.class,o.inputTime),"data-date-part":"time",key:`${t.key}-time-input`,value:p??void 0,step:1,onCalciteInputTimePickerChange:e=>this._commitDateChanges(e.target),onfocus:e=>{e.target.calciteTimePickerEl&&(e.target.calciteTimePickerEl.showSecond=!0)},onblur:e=>this._commitDateChanges(e.target,!0)}):null)}renderUnsupportedField(e){const t=this.getCommonInputProps(e);return b("input",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,class:this.classes(o.input,o.inputField,o.inputDisabled),onfocus:t.onfocus,readOnly:!0,tabIndex:t.tabIndex,type:"text",value:t.value,[F]:t[F]})}renderSelectInputField(e,t,i){const{value:l}=e,{messages:n,messagesTemplates:a}=this,s=t.map((e=>e.map((e=>b("calcite-combobox-item",{value:`${e.value}`,textLabel:e.name,key:`#${e.value}`,selected:l===e.value}))))),[r,o]=s;this._registerIncompatibleValue(l,t.flat(),e,(e=>{o.unshift(b("calcite-combobox-item",{value:`${e}`,textLabel:`${e}`,key:"incompatible-option",readOnly:!0}))}));const u=o.length>0?[b("calcite-combobox-item-group",{key:"recommended",label:n.recommended},r),b("calcite-combobox-item-group",{key:"other",label:a.other},o)]:r,p=null==e.fieldElement||d(e.fieldElement,"combo-box")&&e.fieldElement.input.showNoValueOption;if(!e.required&&p){const t="",i=d(e.fieldElement,"combo-box")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty;u.unshift(b("calcite-combobox-item",{value:t,textLabel:this.messages.empty,key:"empty-option"},i))}return b("calcite-combobox",{...i,selectionMode:"single",disabled:i.readOnly,allowCustomValues:!1,onCalciteComboboxChange:e=>this._handleOptionChange(e.target)},u)}_registerIncompatibleValue(e,t,i,l){const n=this._fieldToInitialIncompatibleDomainValue,a=n.has(i.name);(a||null!=e&&""!==e&&!t.some((t=>t.value===e)))&&(a||n.set(i.name,e),l?.(e))}renderRadioButtonsInputField(e,t,i){const{value:l}=e,n=t.map((t=>this.renderRadioButton({key:t.name,label:t.name,name:e.name,value:t.value,selected:t.value===l,props:i})));this._registerIncompatibleValue(l,t,e);const a=null==e.fieldElement||d(e.fieldElement,"radio-buttons")&&e.fieldElement.input.showNoValueOption;if(!e.required&&a){const t="",a=d(e.fieldElement,"radio-buttons")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty,s=l===t||null===l;n.unshift(this.renderRadioButton({key:"empty-option",label:a,name:e.name,value:t,selected:s,props:i}))}return b("div",{key:`${i.key}-radio`,class:o.inputRadioGroup},n)}renderSwitchInputField(e,t){const{value:i}=e,l=!!d(e.fieldElement,"switch")&&i===e.fieldElement.input.onValue;return b("calcite-switch",{...t,class:o.inputSwitch,onCalciteSwitchChange:e=>this._commitInputValue(e.target),checked:l,disabled:t.readOnly})}renderRadioButton({key:e,name:t,value:i,selected:l,label:n,props:a}){return b("label",{key:e,class:o.inputRadioLabel},b("input",{...a,class:o.inputRadio,name:t,type:"radio",value:i,checked:l,disabled:a.readOnly,onchange:e=>this._commitInputValue(e.target)}),n)}renderAuxiliaryText(e){const t=this._userUpdatedInputFieldNames.has(e.name)&&!e.valid?e.errorMessage:null!=this.viewModel.contingencyConstraintViolations.get(e.name)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=t?b("calcite-input-message",{status:"invalid",icon:!0},t):e.description?b("div",{key:"description",class:o.description},e.description):null}getCommonInputProps(e){const{disabled:t,groupDisplay:i}=this,{editable:l,group:n,hint:a,label:s,maxLength:r,minLength:u,name:d,required:p,type:c,valid:m,value:h}=e,f=this._userUpdatedInputFieldNames.has(d),g=!l||t,b="all"===i&&null!=n&&"collapsed"===n.state;return{afterCreate:this._afterInputCreateOrUpdate,afterUpdate:this._afterInputCreateOrUpdate,"aria-invalid":m?"false":"true",class:this.classes(o.input,o.inputField,g?o.inputDisabled:null,f&&!m?o.inputInvalid:null),key:d,label:s,minlength:u>-1?`${u}`:"",maxlength:r>-1?`${r}`:"",...this._getNumberFieldConstraints(e),readOnly:g,value:null==h?"":`${h}`,[F]:d,onfocus:this._handleInputFocus,oninput:this._handleInputInput,onblur:this._handleInputBlur,onkeydown:this._handleInputKeyDown,onmousedown:"number"===c?this._handleNumberInputMouseDown:void 0,placeholder:"number"===c||"text"===c?a??void 0:"",required:p,tabIndex:b?-1:0}}_isInputFieldInGroup(e){return!u(e)&&null!=e.group}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldValueOptions(e,t){const i=t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),l=this.viewModel.fieldsWithContingentValues.has(e)?this._getContingentValueOptions(e):[];if(l.length>0){const e=new Set(l.map((e=>e.value)));return[l,i.filter((t=>!e.has(t.value)))]}return[i,[]]}_getContingentValueOptions(e){const t={};for(const n of this.viewModel.allInputFields){const{name:i,value:l}=n;null!=l&&i!==e&&this.viewModel.fieldsWithContingentValues.has(i)&&(t[i]=l)}const i=this.viewModel.joinedContingentValues.slice(),l=new Map;for(const n of i){const i=n.values[e];if(null==i||"code"!==i.objectType&&"null"!==i.objectType)continue;const{code:a,name:s}=i.codedValue&&"null"!==i.objectType?i.codedValue:{code:"",name:this.messages.empty};if(l.has(a))continue;Object.entries(t).every((([e,t])=>!n.values.hasOwnProperty(e)||this._valueIsValidContingentValue(t,n.values[e])))&&l.set(a,{name:s,value:a})}return[...l.values()]}_getInputFieldFromInput(e){return this.viewModel.findField(e.getAttribute(F))}_getNumberFieldConstraints(e){const t=a(e.domain)||s(e.field);return t&&t.max!==Number.MAX_VALUE&&t.min!==Number.MIN_VALUE?t:{min:null,max:null}}async _afterDateInputCreate(e){!w(e)&&null!=e.value&&"setValue"in e&&e.setValue({value:e.value,origin:"external"}),this._afterDateInputCreateOrUpdate(e)}_afterDateInputCreateOrUpdate(e){const{name:t}=this._getInputFieldFromInput(e),i=this._dateInputFieldMap.get(t),l=w(e);null!=i?l?i.date=e:i.time=e:this._dateInputFieldMap.set(t,{[l?"date":"time"]:e}),this._afterInputCreateOrUpdate(e)}_afterInputCreateOrUpdate(e){const{viewModel:t}=this,i=this._getInputFieldFromInput(e),l=t.findField(this._activeInputName),n=this._fieldToInitialIncompatibleDomainValue.get(i.name)===i.value;this._fieldFocusNeeded&&l===i&&("radio-buttons"!==i.inputType||n||e.checked)&&(this._fieldFocusNeeded=!1,this._isInputFieldInGroup(i)&&(i.group.state="expanded"),e.focus())}_handleInputFocus(e){const t=e.target,i=this._getInputFieldFromInput(t);this._activeInputName=i.name,this._isNumberInputField(i)&&(this._activeNumberFieldEdit={fieldName:i.name,input:t,value:t.value})}_isNumberInputField({domain:e,inputType:t="text-box",type:i}){return"number"===i&&"text-box"===t&&(!e||"coded-value"!==e.type)}_handleInputBlur(e){const t=e.target,i=this._getInputFieldFromInput(t);"number"===i.type&&null!=this._activeNumberFieldEdit&&(this._activeNumberFieldEdit.input.value=`${i.value}`,this._activeNumberFieldEdit=null),this._commitInputValue(t),this.scheduleRender()}_commitDateChanges(e,t=!1){const{name:i}=this._getInputFieldFromInput(e);if(!this._dateInputFieldMap.has(i))return;const l=this._dateInputFieldMap.get(i);if(!l||!l.date)return;const n=this._getFieldValueFromDateInput(e),a=this._getFieldValueFromDateInputs(l.date,l.time);this.viewModel.getValue(i)!==a&&(null!==n&&null!==a?this._updateFieldValue(i,a):t&&this._updateFieldValue(i,null))}_commitInputValue(e){const t=this._getInputFieldFromInput(e);null!=this._activeNumberFieldEdit&&this._isNumberInputField(t)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(t.name,this._parseValue(e))}_handleInputKeyDown(e){const{key:t,altKey:i,ctrlKey:l,metaKey:n}=e,a=this._getInputFieldFromInput(e.target);if("Enter"===t)this._isInputFieldInGroup(a)&&"collapsed"===a.group.state&&(a.group.state="expanded");else{const{type:s}=a.field,r="single"===s||"double"===s;if(("integer"===s||"small-integer"===s||r)&&(!i&&!l&&!n)&&1===t.length){const i=Number(t),l=["-","+"],n=["e","."],a=r?[...l,...n]:l;isNaN(i)&&!a.includes(t)&&e.preventDefault()}}}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._userUpdatedInputFieldNames.add(e),this.viewModel.fieldsWithContingentValues.has(e)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}}_parseValue(e){const t=this._getInputFieldFromInput(e),i=e.value;if(d(t.fieldElement,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.fieldElement.input.onValue:t.fieldElement.input.offValue;if("radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked)return t.value;const{type:l}=t;return"number"===l?i?parseFloat(i):null:i}_handleOptionChange(e){this._commitInputValue(e),this.scheduleRender()}_handleGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,l="sequential"===this.groupDisplay,n=`.${o.groupHeader}`;if(!(i&&!e.target.closest(n))){if(this._activeInputName=this._getFocusableInput("forward",t)?.name||"",l){const l=e.target.closest(n);if(i&&!l)return;this.viewModel.inputFields.forEach((e=>{u(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._fieldFocusNeeded=l,this.scheduleRender()}}_handleSubmit(e){e.preventDefault()}_handleFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_getDefaultLocaleOptions(){return{locale:_(),numberingSystem:y}}_getFieldValueFromDateInputs(e,t){const i=this._getDateTimeFromInput(e),l=this._getDateTimeFromInput(t);if(!i&&!l)return null;const n=this._getInputFieldFromInput(e),a=this._getNumberFieldConstraints(n),s=Date.now(),r=null!=a.max&&a.max<s?a.max:s,o=v.fromMillis(r,this._getDefaultLocaleOptions()),u=i||o,{year:d,month:p,day:c}=u,{hour:m,minute:h,second:f}=l||o,g=u.set({year:d,month:p,day:c,hour:m,minute:h,second:f});return g.isValid?g.toMillis():null}_getDateTimeFromInput(e){if(!e)return null;let t=null;if(w(e)){const i=e.valueAsDate;if(!i||Array.isArray(i))return null;t=v.fromJSDate(i)}else{if(!e.value)return null;t=v.fromFormat(e.value,I,this._getDefaultLocaleOptions())}return t??null}_getFieldValueFromDateInput(e){return this._dateTimeToFieldValue(this._getDateTimeFromInput(e))}_dateTimeToFieldValue(e){return e?.isValid?e.toMillis():null}_dateTimeFromFieldValue(e){return null===e?null:v.fromMillis(e,this._getDefaultLocaleOptions())}_formatValueForDateInputs(e){if(null==e||isNaN(e))return{date:null,time:null};const t=this._dateTimeFromFieldValue(e);return t?{date:t.toJSDate(),time:t.toFormat(I,this._getDefaultLocaleOptions())}:{date:null,time:null}}_valueIsValidContingentValue(e,i){switch(i.objectType){case"any":return!0;case"null":return null==e;case"code":return e===i.codedValue?.code;case"range":return null!=e&&null!=i.minValue&&null!=i.maxValue&&+e>=i.minValue&&+e<=i.maxValue;default:return t(i.objectType),!1}}};e([l()],V.prototype,"disabled",void 0),e([l()],V.prototype,"feature",null),e([l()],V.prototype,"formTemplate",null),e([l()],V.prototype,"groupDisplay",void 0),e([l()],V.prototype,"headingLevel",void 0),e([l()],V.prototype,"label",null),e([l()],V.prototype,"layer",null),e([l(),f("esri/widgets/FeatureForm/t9n/FeatureForm")],V.prototype,"messages",void 0),e([l(),f("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],V.prototype,"messagesTemplates",void 0),e([l()],V.prototype,"spatialReference",null),e([l()],V.prototype,"strict",null),e([l()],V.prototype,"view",null),e([l(),g(["value-change","submit"])],V.prototype,"viewModel",void 0),V=e([n("esri.widgets.FeatureForm")],V);const D=V;export{D as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{neverReached as t}from"../core/compilerUtils.js";import{watch as i}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{getDomainRange as a}from"../layers/support/domainUtils.js";import{getFieldRange as s}from"../layers/support/fieldUtils.js";import r from"./Widget.js";import{CSS as o}from"./FeatureForm/css.js";import{isGroupInput as u,isFieldElementWithInputType as d}from"./FeatureForm/featureFormUtils.js";import p from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{Heading as c,incrementHeadingLevel as h}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{vmEvent as g}from"./support/decorators/vmEvent.js";import{tsx as b}from"./support/jsxFactory.js";import{DateTime as v}from"luxon";import{getLocale as _}from"../intl/locale.js";const I="TT",F="data-field-name",y="latn",w=e=>"valueAsDate"in e;let V=class extends r{constructor(e,t){super(e,t),this._dateFieldInputMap=new Map,this._activeInputName="",this._activeNumberFieldEdit=null,this._fieldFocusNeeded=!1,this._fieldToInitialIncompatibleDomainValue=new Map,this._switchFieldsWithInitialIncompatibleValue=new Set,this._userUpdatedFieldInputNames=new Set,this.disabled=!1,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesTemplates=null,this.viewModel=new p,this._handleInputInput=e=>{this._commitInputValue(e.currentTarget)},this._handleFormKeyDown=this._handleFormKeyDown.bind(this),this._handleInputBlur=this._handleInputBlur.bind(this),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this),this._handleInputKeyDown=this._handleInputKeyDown.bind(this),this._handleOptionChange=this._handleOptionChange.bind(this),this._handleGroupClick=this._handleGroupClick.bind(this),this._handleSubmit=this._handleSubmit.bind(this),this._afterInputCreateOrUpdate=this._afterInputCreateOrUpdate.bind(this),this._afterDateInputCreateOrUpdate=this._afterDateInputCreateOrUpdate.bind(this)}initialize(){this.addHandles([i((()=>this.feature),(()=>{const e=this._getFocusableInput("forward");this._activeInputName=e?.name||"",this._userUpdatedFieldInputNames.clear(),this._fieldToInitialIncompatibleDomainValue.clear(),this._switchFieldsWithInitialIncompatibleValue.clear(),this._dateFieldInputMap.clear(),this._fieldFocusNeeded=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._userUpdatedFieldInputNames.add(e))),this._activeInputName=t,this._fieldFocusNeeded=!0,this.scheduleRender()}}))])}loadDependencies(){return m({combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js")})}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}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 spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return b("div",{class:this.classes(o.base,o.widget,o.panel)},"ready"===e?this.renderForm():null)}renderForm(){const e=this.viewModel,t=null!=e.formTitle&&b(c,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&b("p",{class:o.description,key:"description"},e.formDescription),l=t||i?b("div",{class:o.formHeader},t,i):null;return b("form",{class:o.form,novalidate:!0,onsubmit:this._handleSubmit,onkeydown:this._handleFormKeyDown},l,this.renderInputs())}renderInputs(){const{viewModel:{inputs:e}}=this;return e.filter((e=>e.visible)).map(((e,t)=>u(e)?this.renderGroup(e,t):this.renderLabeledField(e)))}renderGroup(e,t){const{formTemplate:i,disabled:l}=this,{description:n,inputs:a,label:s,state:r}=e,u=a.filter((e=>e.visible)),d=this.viewModel.findField(this._activeInputName),p=!(!d||d.group!==e),m=`${this.id}_group_${t}`,f=`${this.id}_group-label_${t}`,g=`${this.id}_group-description_${t}`,v=n?b("p",{class:this.classes(o.groupDescription,o.description),id:g},n):null,_="sequential"===this.groupDisplay,I=_?p:"expanded"===r,F=I?o.collapseIcon:o.expandIcon;return b("fieldset",{"aria-expanded":I.toString(),"aria-labelledby":f,"aria-describedby":n?g:"",class:this.classes(o.group,_?o.groupSequential:null,I?null:o.groupCollapsed,p?o.groupActive:null,l?o.inputDisabled:null),disabled:l,"data-group":e,id:m,key:t,onclick:this._handleGroupClick},b("button",{role:_?"presentation":void 0,class:o.groupHeader,type:"button",tabIndex:_?-1:0},b("div",{class:o.groupTitle},b(c,{class:o.groupLabel,id:f,level:null!=i&&i.title?h(this.headingLevel):this.headingLevel},s),v),_?null:b("span",{class:this.classes(F,o.groupToggleIcon)})),u.map((e=>this.renderLabeledField(e))))}_getFocusableInput(e,t){const i=this.viewModel.allFieldInputs,l="forward"===e?i:i.slice().reverse();let n;if(t)if(u(t))n=l.indexOf(t.inputs[0]);else{let i;if(this._isFieldInputInGroup(t)&&"collapsed"===t.group.state){const{inputs:l}=t.group;i="forward"===e?l[l.length-1]:l[0]}else i=t;n=l.indexOf(i)+1}else n=0;for(let a=n;a<l.length;a++){const e=l[a];if(e.visible)return e}return null}renderLabeledField(e){const{feature:t,label:i,layer:l,type:n}=e;return b("label",{key:`${l.id}-${t.uid}-${e.name}`,class:o.label},[i,"unsupported"!==n?this.renderFieldInput(e):this.renderUnsupportedField(e),this.renderAuxiliaryText(e)])}renderFieldInput(e){const{domain:t,name:i,type:l,updating:n,value:a}=e,s=this.getCommonInputProps(e);if("coded-value"===t?.type){if(d(e.fieldElement,"switch")){const{fieldElement:t}=e;if(!(this._switchFieldsWithInitialIncompatibleValue.has(i)||null==a||t.input.onValue!==a&&t.input.offValue!==a))return this.renderSwitchFieldInput(e,s);this._switchFieldsWithInitialIncompatibleValue.add(i)}return"radio-buttons"===e.inputType?this.renderRadioButtonsFieldInput(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),s):this.renderSelectFieldInput(e,this._getFieldValueOptions(i,t),s)}if("datetime-picker"===e.inputType||"date"===l)return this.renderDateFieldInput(e,s);const r="number"===l?b("input",{type:"number",...s,value:null!=this._activeNumberFieldEdit&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${s.value}`}):"text-area"===e.inputType?b("textarea",{...s}):b("input",{type:"text",...s});return n?b("div",{class:o.fieldInputWrapper},r,b("div",{class:o.fieldInputLoader},b("calcite-progress",{type:"indeterminate"}))):r}renderDateFieldInput(e,t){const{includeTime:i,label:l,name:n,valid:a,value:s}=e,{readOnly:r,required:u}=t,{date:d,time:p}=this._formatValueForDateInputs(s),m=null!=t.max?this._formatValueForDateInputs(t.max):void 0,c=null!=t.min?this._formatValueForDateInputs(t.min):void 0,h=m?.date??void 0,f=c?.date??void 0,g={afterCreate:this._afterDateInputCreate,afterUpdate:this._afterDateInputCreateOrUpdate,"aria-invalid":!a,label:l,numberingSystem:y,overlayPositioning:"fixed",readOnly:r,required:u,tabIndex:0,[F]:n};return b("div",{key:`${t.key}-date-time-container`,class:o.dateInputContainer},b("calcite-input-date-picker",{bind:this,...g,class:this.classes(t.class,o.inputDate),"data-date-part":"date",key:`${t.key}-date-input`,valueAsDate:d??void 0,maxAsDate:h,minAsDate:f,onCalciteInputDatePickerChange:e=>this._commitDateChanges(e.target),onblur:e=>this._commitDateChanges(e.target,!0)}),i?b("calcite-input-time-picker",{bind:this,...g,class:this.classes(t.class,o.inputTime),"data-date-part":"time",key:`${t.key}-time-input`,value:p??void 0,step:1,onCalciteInputTimePickerChange:e=>this._commitDateChanges(e.target),onfocus:e=>{e.target.calciteTimePickerEl&&(e.target.calciteTimePickerEl.showSecond=!0)},onblur:e=>this._commitDateChanges(e.target,!0)}):null)}renderUnsupportedField(e){const t=this.getCommonInputProps(e);return b("input",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,class:this.classes(o.input,o.fieldInput,o.inputDisabled),onfocus:t.onfocus,readOnly:!0,tabIndex:t.tabIndex,type:"text",value:t.value,[F]:t[F]})}renderSelectFieldInput(e,t,i){const{value:l}=e,{messages:n,messagesTemplates:a}=this,s=t.map((e=>e.map((e=>b("calcite-combobox-item",{value:`${e.value}`,textLabel:e.name,key:`#${e.value}`,selected:l===e.value}))))),[r,o]=s;this._registerIncompatibleValue(l,t.flat(),e,(e=>{o.unshift(b("calcite-combobox-item",{value:`${e}`,textLabel:`${e}`,key:"incompatible-option",readOnly:!0}))}));const u=o.length>0?[b("calcite-combobox-item-group",{key:"recommended",label:n.recommended},r),b("calcite-combobox-item-group",{key:"other",label:a.other},o)]:r,p=null==e.fieldElement||d(e.fieldElement,"combo-box")&&e.fieldElement.input.showNoValueOption;if(!e.required&&p){const t="",i=d(e.fieldElement,"combo-box")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty;u.unshift(b("calcite-combobox-item",{value:t,textLabel:this.messages.empty,key:"empty-option"},i))}return b("calcite-combobox",{...i,selectionMode:"single",disabled:i.readOnly,allowCustomValues:!1,onCalciteComboboxChange:e=>this._handleOptionChange(e.target)},u)}_registerIncompatibleValue(e,t,i,l){const n=this._fieldToInitialIncompatibleDomainValue,a=n.has(i.name);(a||null!=e&&""!==e&&!t.some((t=>t.value===e)))&&(a||n.set(i.name,e),l?.(e))}renderRadioButtonsFieldInput(e,t,i){const{value:l}=e,n=t.map((t=>this.renderRadioButton({key:t.name,label:t.name,name:e.name,value:t.value,selected:t.value===l,props:i})));this._registerIncompatibleValue(l,t,e);const a=null==e.fieldElement||d(e.fieldElement,"radio-buttons")&&e.fieldElement.input.showNoValueOption;if(!e.required&&a){const t="",a=d(e.fieldElement,"radio-buttons")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty,s=l===t||null===l;n.unshift(this.renderRadioButton({key:"empty-option",label:a,name:e.name,value:t,selected:s,props:i}))}return b("div",{key:`${i.key}-radio`,class:o.inputRadioGroup},n)}renderSwitchFieldInput(e,t){const{value:i}=e,l=!!d(e.fieldElement,"switch")&&i===e.fieldElement.input.onValue;return b("calcite-switch",{...t,class:o.inputSwitch,onCalciteSwitchChange:e=>this._commitInputValue(e.target),checked:l,disabled:t.readOnly})}renderRadioButton({key:e,name:t,value:i,selected:l,label:n,props:a}){return b("label",{key:e,class:o.inputRadioLabel},b("input",{...a,class:o.inputRadio,name:t,type:"radio",value:i,checked:l,disabled:a.readOnly,onchange:e=>this._commitInputValue(e.target)}),n)}renderAuxiliaryText(e){const t=this._userUpdatedFieldInputNames.has(e.name)&&!e.valid?e.errorMessage:null!=this.viewModel.contingencyConstraintViolations.get(e.name)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=t?b("calcite-input-message",{status:"invalid",icon:!0},t):e.description?b("div",{key:"description",class:o.description},e.description):null}getCommonInputProps(e){const{disabled:t,groupDisplay:i}=this,{editable:l,group:n,hint:a,label:s,maxLength:r,minLength:u,name:d,required:p,type:m,valid:c,value:h}=e,f=this._userUpdatedFieldInputNames.has(d),g=!l||t,b="all"===i&&null!=n&&"collapsed"===n.state;return{afterCreate:this._afterInputCreateOrUpdate,afterUpdate:this._afterInputCreateOrUpdate,"aria-invalid":c?"false":"true",class:this.classes(o.input,o.fieldInput,g?o.inputDisabled:null,f&&!c?o.inputInvalid:null),key:d,label:s,minlength:u>-1?`${u}`:"",maxlength:r>-1?`${r}`:"",...this._getNumberFieldConstraints(e),readOnly:g,value:null==h?"":`${h}`,[F]:d,onfocus:this._handleInputFocus,oninput:this._handleInputInput,onblur:this._handleInputBlur,onkeydown:this._handleInputKeyDown,onmousedown:"number"===m?this._handleNumberInputMouseDown:void 0,placeholder:"number"===m||"text"===m?a??void 0:"",required:p,tabIndex:b?-1:0}}_isFieldInputInGroup(e){return!u(e)&&null!=e.group}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldValueOptions(e,t){const i=t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),l=this.viewModel.fieldsWithContingentValues.has(e)?this._getContingentValueOptions(e):[];if(l.length>0){const e=new Set(l.map((e=>e.value)));return[l,i.filter((t=>!e.has(t.value)))]}return[i,[]]}_getContingentValueOptions(e){const t={};for(const n of this.viewModel.allFieldInputs){const{name:i,value:l}=n;null!=l&&i!==e&&this.viewModel.fieldsWithContingentValues.has(i)&&(t[i]=l)}const i=this.viewModel.joinedContingentValues.slice(),l=new Map;for(const n of i){const i=n.values[e];if(null==i||"code"!==i.objectType&&"null"!==i.objectType)continue;const{code:a,name:s}=i.codedValue&&"null"!==i.objectType?i.codedValue:{code:"",name:this.messages.empty};if(l.has(a))continue;Object.entries(t).every((([e,t])=>!n.values.hasOwnProperty(e)||this._valueIsValidContingentValue(t,n.values[e])))&&l.set(a,{name:s,value:a})}return[...l.values()]}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(F))}_getNumberFieldConstraints(e){const t=a(e.domain)||s(e.field);return t&&t.max!==Number.MAX_VALUE&&t.min!==Number.MIN_VALUE?t:{min:null,max:null}}async _afterDateInputCreate(e){!w(e)&&null!=e.value&&"setValue"in e&&e.setValue({value:e.value,origin:"external"}),this._afterDateInputCreateOrUpdate(e)}_afterDateInputCreateOrUpdate(e){const{name:t}=this._getFieldInputFromHTMLElement(e),i=this._dateFieldInputMap.get(t),l=w(e);null!=i?l?i.date=e:i.time=e:this._dateFieldInputMap.set(t,{[l?"date":"time"]:e}),this._afterInputCreateOrUpdate(e)}_afterInputCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),l=t.findField(this._activeInputName),n=this._fieldToInitialIncompatibleDomainValue.get(i.name)===i.value;this._fieldFocusNeeded&&l===i&&("radio-buttons"!==i.inputType||n||e.checked)&&(this._fieldFocusNeeded=!1,this._isFieldInputInGroup(i)&&(i.group.state="expanded"),e.focus())}_handleInputFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._activeInputName=i.name,this._isNumberFieldInput(i)&&(this._activeNumberFieldEdit={fieldName:i.name,input:t,value:t.value})}_isNumberFieldInput({domain:e,inputType:t="text-box",type:i}){return"number"===i&&"text-box"===t&&(!e||"coded-value"!==e.type)}_handleInputBlur(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);"number"===i.type&&null!=this._activeNumberFieldEdit&&(this._activeNumberFieldEdit.input.value=`${i.value}`,this._activeNumberFieldEdit=null),this._commitInputValue(t),this.scheduleRender()}_commitDateChanges(e,t=!1){const{name:i}=this._getFieldInputFromHTMLElement(e);if(!this._dateFieldInputMap.has(i))return;const l=this._dateFieldInputMap.get(i);if(!l||!l.date)return;const n=this._getFieldValueFromDateInput(e),a=this._getFieldValueFromDateInputs(l.date,l.time);this.viewModel.getValue(i)!==a&&(null!==n&&null!==a?this._updateFieldValue(i,a):t&&this._updateFieldValue(i,null))}_commitInputValue(e){const t=this._getFieldInputFromHTMLElement(e);null!=this._activeNumberFieldEdit&&this._isNumberFieldInput(t)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(t.name,this._parseValue(e))}_handleInputKeyDown(e){const{key:t,altKey:i,ctrlKey:l,metaKey:n}=e,a=this._getFieldInputFromHTMLElement(e.target);if("Enter"===t)this._isFieldInputInGroup(a)&&"collapsed"===a.group.state&&(a.group.state="expanded");else{const{type:s}=a.field,r="single"===s||"double"===s;if(("integer"===s||"small-integer"===s||r)&&(!i&&!l&&!n)&&1===t.length){const i=Number(t),l=["-","+"],n=["e","."],a=r?[...l,...n]:l;isNaN(i)&&!a.includes(t)&&e.preventDefault()}}}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._userUpdatedFieldInputNames.add(e),this.viewModel.fieldsWithContingentValues.has(e)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;if(d(t.fieldElement,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.fieldElement.input.onValue:t.fieldElement.input.offValue;if("radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked)return t.value;const{type:l}=t;return"number"===l?i?parseFloat(i):null:i}_handleOptionChange(e){this._commitInputValue(e),this.scheduleRender()}_handleGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,l="sequential"===this.groupDisplay,n=`.${o.groupHeader}`;if(!(i&&!e.target.closest(n))){if(this._activeInputName=this._getFocusableInput("forward",t)?.name||"",l){const l=e.target.closest(n);if(i&&!l)return;this.viewModel.inputs.forEach((e=>{u(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._fieldFocusNeeded=l,this.scheduleRender()}}_handleSubmit(e){e.preventDefault()}_handleFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_getDefaultLocaleOptions(){return{locale:_(),numberingSystem:y}}_getFieldValueFromDateInputs(e,t){const i=this._getDateTimeFromInput(e),l=this._getDateTimeFromInput(t);if(!i&&!l)return null;const n=this._getFieldInputFromHTMLElement(e),a=this._getNumberFieldConstraints(n),s=Date.now(),r=null!=a.max&&a.max<s?a.max:s,o=v.fromMillis(r,this._getDefaultLocaleOptions()),u=i||o,{year:d,month:p,day:m}=u,{hour:c,minute:h,second:f}=l||o,g=u.set({year:d,month:p,day:m,hour:c,minute:h,second:f});return g.isValid?g.toMillis():null}_getDateTimeFromInput(e){if(!e)return null;let t=null;if(w(e)){const i=e.valueAsDate;if(!i||Array.isArray(i))return null;t=v.fromJSDate(i)}else{if(!e.value)return null;t=v.fromFormat(e.value,I,this._getDefaultLocaleOptions())}return t??null}_getFieldValueFromDateInput(e){return this._dateTimeToFieldValue(this._getDateTimeFromInput(e))}_dateTimeToFieldValue(e){return e?.isValid?e.toMillis():null}_dateTimeFromFieldValue(e){return null===e?null:v.fromMillis(e,this._getDefaultLocaleOptions())}_formatValueForDateInputs(e){if(null==e||isNaN(e))return{date:null,time:null};const t=this._dateTimeFromFieldValue(e);return t?{date:t.toJSDate(),time:t.toFormat(I,this._getDefaultLocaleOptions())}:{date:null,time:null}}_valueIsValidContingentValue(e,i){switch(i.objectType){case"any":return!0;case"null":return null==e;case"code":return e===i.codedValue?.code;case"range":return null!=e&&null!=i.minValue&&null!=i.maxValue&&+e>=i.minValue&&+e<=i.maxValue;default:return t(i.objectType),!1}}};e([l()],V.prototype,"disabled",void 0),e([l()],V.prototype,"feature",null),e([l()],V.prototype,"formTemplate",null),e([l()],V.prototype,"groupDisplay",void 0),e([l()],V.prototype,"headingLevel",void 0),e([l()],V.prototype,"label",null),e([l()],V.prototype,"layer",null),e([l(),f("esri/widgets/FeatureForm/t9n/FeatureForm")],V.prototype,"messages",void 0),e([l(),f("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],V.prototype,"messagesTemplates",void 0),e([l()],V.prototype,"spatialReference",null),e([l()],V.prototype,"strict",null),e([l()],V.prototype,"view",null),e([l(),g(["value-change","submit"])],V.prototype,"viewModel",void 0),V=e([n("esri.widgets.FeatureForm")],V);const D=V;export{D as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{watch as t}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as o,convertDateFormatToIntlOptions as r}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as l,formatNumber as a}from"../../intl/number.js";import s from"../../layers/support/CodedValueDomain.js";import{isEditableLayer as u}from"../../layers/support/editableLayers.js";import{isNumericField as d,isStringField as p}from"../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as c}from"../../layers/support/layerUtils.js";import m from"../FeatureForm/InputField.js";import h from"./Grid/EditorColumn.js";import f from"../support/DatePicker.js";import g from"../support/TimePicker.js";import{renderingSanitizer as y}from"../support/widgetUtils.js";const v={cancelEdit:"Escape"},b="esri-field-column",_={headerContent:`${b}__header-content`,headerLabel:`${b}__header-label`,input:`${b}__cell-input`,inputContainer:`${b}__cell__input-container`,dateInputContainer:`${b}__cell__date-input-container`,dateInputWrapper:`${b}__cell__date-input-wrapper`,button:`${b}__button`,saveIcon:"esri-icon-save",trashIcon:"esri-icon-trash",locked:"esri-icon-locked"},F=r("short-date-short-time"),C=r("short-date"),E={useGrouping:!0,maximumFractionDigits:20};let I=class extends h{constructor(e){super(e),this._inputField=null,this.cellValueFormatFunction=({rowData:e,value:t})=>{if(this.formatFunction){const{config:e,field:n}=this;return this.formatFunction({config:e,field:n,value:y.sanitize(t)})}if(null===t)return"&nbsp;";const{config:n,field:i}=this,r=e?.item?.feature,s=this._getDomainForFeature(r);if(s)return this._getComputedDomain(t,s);if("date"===i.type){const e=this._getDateFormatOptions(),n="feature"===this.layer?.type&&this.layer.datesInUnknownTimezone?{timeZone:"UTC"}:null;return t?o(t,{...e,...n}):null}if(d(i)){const e=n?.format?l(n.format):E;return a(parseFloat(t),e)}return y.sanitize(t)},this.cellValueValidatorFunction=({oldValue:e,value:t})=>!(this._inputField&&!this._inputField.valid)&&((!this.required||null!=t&&""!==t)&&e!==t),this.config=null,this.editingEnabled=!1,this.expressionInfos=null,this.field=null,this.formatFunction=null,this.headerRenderFunction=e=>{const{root:t}=e,{editable:n,editingEnabled:i,headerMenuEnabled:o,sortable:r}=this;if(this.removeCellContent(t),t.classList.add(_.headerContent),i&&!n&&t.appendChild(this.createLockedElement()),r)this.headerSorterRenderFunction(e);else{const e=document.createElement("div");e.classList.add(_.headerLabel),e.textContent=this.label,t.appendChild(e)}o&&this.headerMenuRenderFunction(e)},this.inputRenderFunction=({root:e,column:t,rowData:n})=>{if(this.activeEditInfo?.updating)return;if(!this.editable)return;const i=this.getCellValue(t,n),o=this.createInputElement({root:e,column:t,rowData:n,value:i});if(this._set("activeEditInfo",{column:t,input:o,root:e,rowData:n,updating:!0,oldValue:i}),"date"===this.field.type)return void this._renderDateEditors(i,e,o);const r=this.createInputContainer();r.appendChild(o),this.removeCellContent(e),e.appendChild(r),o.focus(),o instanceof HTMLInputElement&&o.select(),this.grid?.notifyResize()},this.layer=null,this.parseInputValueFunction=({input:e})=>{const t=this._inputField;if(!t)return null;const n=e.value,{required:i,type:o}=t;return i||""!==n?"number"===o||"date"===o?parseFloat(n):"text"===o?n.trim():n:null},this.store=null,this.template=null,this.updateRowItemFunction=({rowData:e,column:t,value:n})=>{e&&(e.item.feature.attributes[t.path]=n)},this.updateStoreItemFunction=async({rowData:e,column:t,value:n})=>{if(!e||!this.store)return;const i=e.item.objectId,o=this.store.getObjectIdIndex(i)??e.index;await this.store.updateItem({index:o,name:t.path,value:n})}}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get description(){return this.template?.description??this.config?.description??this.field?.description??null}get editable(){const{config:e,editingEnabled:t,field:n,layer:i,template:o}=this;if(null==n||null==i)return!1;const r=u(i),l=c(i),a=l?.operations.supportsUpdate;return!!(n.editable&&r&&a)&&(t?!(!1===o?.editable||!1===e?.editable):!(!o?.editable&&!e?.editable))}get header(){return this.template?.label||this.config?.label||this.alias||this.path||null}get hidden(){const{config:e}=this;return!1===e?.visible||this._get("hidden")||!1}set hidden(e){this._set("hidden",e)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,config:t,template:n}=this,i=e?.length,o=n?.input&&"maxLength"in n.input?n.input.maxLength:t?.maxLength;return null!=o&&!isNaN(o)&&o>=-1&&(-1===i||o<=i)?o:i}get minLength(){const{config:e,template:t,maxLength:n}=this,i=t?.input&&"minLength"in t.input?t.input.minLength:e?.minLength||null;return n&&i<=n?i:null}get name(){return this.field?.name}get nullable(){return this.field?.nullable??!1}get path(){return this.field?.name}get required(){const{config:e,field:t,template:n}=this,i=t?.nullable,o=e?.required,r=n?.required;return this.editable&&(!i||!0===o||!0===r)}get sortable(){return this.template?!1!==this.template?.sortable:!1!==this.config?.sortable}createInputElement({rowData:e,value:t}){const n=e?.item;if(!n||!n.feature)return null;this._inputField=this._setUpInputField(n.feature,t);const{field:i,maxLength:o,minLength:r,required:l}=this,{domain:a}=this._inputField;let s;"coded-value"===a?.type?(s=this._createSelectElement(t,a.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),this._inputField),s.onchange=()=>{s.onblur=null,p()}):(s=document.createElement("input"),s.type=d(i)?"number":"text",o>-1&&(s.maxLength=o),r>0&&(s.minLength=r)),s.classList.add(_.input),s.value=t,s.required=l;let u=!1;s.onkeydown=e=>{u=e.key===v.cancelEdit},s.onblur=()=>{s.onblur=null,p()};const p=()=>{u?this.cancel():this.submit(),this._inputField=null};return s}createInputContainer(){const e=document.createElement("div");return e.classList.add(_.inputContainer),e}createLockedElement(){const e=document.createElement("div");return e.classList.add(_.locked),e}getCellValue({path:e},t){return t?.item?.feature?.attributes?.[e]??null}_renderDateEditors(e,n,i){const{config:o,messagesCommon:r,template:l}=this,a=e?new Date(e):new Date(Date.now()),s=new f({dateInputEnabled:!0,value:a}),u=new g({value:a});i.value=a.getTime().toString();let d=!e;const p=()=>{d=!0;const e=this._getCombinedDateTime(s.value,u.value);i.value=e.getTime().toString()},c=()=>{d?this.submit():this.cancel()},m=()=>{i.value=null,this.submit()};t((()=>[s.value,u.value]),(()=>p()));const h=document.createElement("div"),y=document.createElement("div");s.container=h,u.container=y;const v=document.createElement("button");v.classList.add(_.button,_.saveIcon),v.onclick=()=>c(),v.title=r?.save;const b=document.createElement("button");b.classList.add(_.button,_.trashIcon),b.onclick=()=>m(),b.title=r?.clear;const F=document.createElement("div");F.classList.add(_.dateInputWrapper),F.appendChild(h),(l&&l.input&&"datetime-picker"===l.input.type&&!1!==l.input.includeTime||o&&!1!==o.includeTime)&&F.appendChild(y);const C=document.createElement("div");C.classList.add(_.dateInputContainer),C.appendChild(F),C.appendChild(v),C.appendChild(b),s.when((()=>this.grid?.notifyResize())),u.when((()=>this.grid?.notifyResize())),this.removeCellContent(n),n.appendChild(C),this.grid?.notifyResize()}_createSelectElement(e,t,n){let i=!1;const o=t.map((t=>{t.value===e&&(i=!0);const n=document.createElement("option");return n.text=t.name,n.value=t.value,n}));if(null!=e&&""!==e&&!i){const t=document.createElement("option");t.text=e,t.value=e,o.unshift(t)}if(!n.required&&null==n.value){const e=document.createElement("option");e.value="",o.unshift(e)}const r=document.createElement("select");return o.forEach((e=>r.add(e))),r.value=e,r}_setUpInputField(e,t){const{config:n,field:i,layer:o}=this,r=new m({config:n,feature:e,initialFeature:e.clone(),field:i,layer:o,group:null,messages:null});return r.set("value",t),r}_isDomainCompatible(e){const{field:t}=this;if(e&&"coded-value"===e.type){const n=typeof e.codedValues[0].code;if("string"===n&&p(t)||"number"===n&&d(t))return!0}return!(!e||"range"!==e.type||!d(t))}_getDomainForFeature(e){const{config:t,layer:n,name:i,template:o}=this;if(!n)return null;if("wfs"===n.type||"geojson"===n.type||"csv"===n.type)return null;if(o?.domain&&this._isDomainCompatible(o.domain))return o.domain;const{typeIdField:r}=n,l=r===i,a=this.field.domain;if(l&&!a)return new s({name:"__internal-type-based-coded-value-domain__",codedValues:n.types?.map((({id:e,name:t})=>({code:e,name:t})))});const u=r&&null!=i&&n.getFieldDomain(i,{feature:e})||a,d=t?.domain;return this._isDomainCompatible(d)?d:u}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const n=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return n&&n.length?n[0].name:e}return null}_getCombinedDateTime(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds())}_getDateFormatOptions(){const{config:e,template:t}=this,n=t?.format?.dateFormat||e?.format?.dateFormat;return n?r(n):t&&t.input&&"includeTime"in t.input==!1||!1===e?.includeTime?C:F}};e([n({readOnly:!0})],I.prototype,"alias",null),e([n()],I.prototype,"cellValueFormatFunction",void 0),e([n()],I.prototype,"cellValueValidatorFunction",void 0),e([n()],I.prototype,"config",void 0),e([n({readOnly:!0})],I.prototype,"defaultValue",null),e([n({readOnly:!0})],I.prototype,"description",null),e([n({readOnly:!0})],I.prototype,"editable",null),e([n()],I.prototype,"editingEnabled",void 0),e([n()],I.prototype,"expressionInfos",void 0),e([n()],I.prototype,"field",void 0),e([n()],I.prototype,"formatFunction",void 0),e([n({readOnly:!0})],I.prototype,"header",null),e([n()],I.prototype,"hidden",null),e([n()],I.prototype,"headerRenderFunction",void 0),e([n()],I.prototype,"inputRenderFunction",void 0),e([n()],I.prototype,"layer",void 0),e([n({readOnly:!0})],I.prototype,"loadingMessage",null),e([n()],I.prototype,"maxLength",null),e([n()],I.prototype,"minLength",null),e([n({readOnly:!0})],I.prototype,"name",null),e([n({readOnly:!0})],I.prototype,"nullable",null),e([n()],I.prototype,"parseInputValueFunction",void 0),e([n({readOnly:!0})],I.prototype,"path",null),e([n({readOnly:!0})],I.prototype,"required",null),e([n()],I.prototype,"sortable",null),e([n()],I.prototype,"store",void 0),e([n()],I.prototype,"template",void 0),e([n()],I.prototype,"updateRowItemFunction",void 0),e([n()],I.prototype,"updateStoreItemFunction",void 0),I=e([i("esri.widgets.FeatureTable.FieldColumn")],I);const L=I;export{L as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{watch as t}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as o,convertDateFormatToIntlOptions as r}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as l,formatNumber as a}from"../../intl/number.js";import s from"../../layers/support/CodedValueDomain.js";import{isEditableLayer as u}from"../../layers/support/editableLayers.js";import{isNumericField as d,isStringField as p}from"../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as c}from"../../layers/support/layerUtils.js";import m from"../FeatureForm/FieldInput.js";import h from"./Grid/EditorColumn.js";import f from"../support/DatePicker.js";import g from"../support/TimePicker.js";import{renderingSanitizer as y}from"../support/widgetUtils.js";const v={cancelEdit:"Escape"},b="esri-field-column",_={headerContent:`${b}__header-content`,headerLabel:`${b}__header-label`,input:`${b}__cell-input`,inputContainer:`${b}__cell__input-container`,dateInputContainer:`${b}__cell__date-input-container`,dateInputWrapper:`${b}__cell__date-input-wrapper`,button:`${b}__button`,saveIcon:"esri-icon-save",trashIcon:"esri-icon-trash",locked:"esri-icon-locked"},F=r("short-date-short-time"),C=r("short-date"),E={useGrouping:!0,maximumFractionDigits:20};let I=class extends h{constructor(e){super(e),this._inputField=null,this.cellValueFormatFunction=({rowData:e,value:t})=>{if(this.formatFunction){const{config:e,field:n}=this;return this.formatFunction({config:e,field:n,value:y.sanitize(t)})}if(null===t)return"&nbsp;";const{config:n,field:i}=this,r=e?.item?.feature,s=this._getDomainForFeature(r);if(s)return this._getComputedDomain(t,s);if("date"===i.type){const e=this._getDateFormatOptions(),n="feature"===this.layer?.type&&this.layer.datesInUnknownTimezone?{timeZone:"UTC"}:null;return t?o(t,{...e,...n}):null}if(d(i)){const e=n?.format?l(n.format):E;return a(parseFloat(t),e)}return y.sanitize(t)},this.cellValueValidatorFunction=({oldValue:e,value:t})=>!(this._inputField&&!this._inputField.valid)&&((!this.required||null!=t&&""!==t)&&e!==t),this.config=null,this.editingEnabled=!1,this.expressionInfos=null,this.field=null,this.formatFunction=null,this.headerRenderFunction=e=>{const{root:t}=e,{editable:n,editingEnabled:i,headerMenuEnabled:o,sortable:r}=this;if(this.removeCellContent(t),t.classList.add(_.headerContent),i&&!n&&t.appendChild(this.createLockedElement()),r)this.headerSorterRenderFunction(e);else{const e=document.createElement("div");e.classList.add(_.headerLabel),e.textContent=this.label,t.appendChild(e)}o&&this.headerMenuRenderFunction(e)},this.inputRenderFunction=({root:e,column:t,rowData:n})=>{if(this.activeEditInfo?.updating)return;if(!this.editable)return;const i=this.getCellValue(t,n),o=this.createInputElement({root:e,column:t,rowData:n,value:i});if(this._set("activeEditInfo",{column:t,input:o,root:e,rowData:n,updating:!0,oldValue:i}),"date"===this.field.type)return void this._renderDateEditors(i,e,o);const r=this.createInputContainer();r.appendChild(o),this.removeCellContent(e),e.appendChild(r),o.focus(),o instanceof HTMLInputElement&&o.select(),this.grid?.notifyResize()},this.layer=null,this.parseInputValueFunction=({input:e})=>{const t=this._inputField;if(!t)return null;const n=e.value,{required:i,type:o}=t;return i||""!==n?"number"===o||"date"===o?parseFloat(n):"text"===o?n.trim():n:null},this.store=null,this.template=null,this.updateRowItemFunction=({rowData:e,column:t,value:n})=>{e&&(e.item.feature.attributes[t.path]=n)},this.updateStoreItemFunction=async({rowData:e,column:t,value:n})=>{if(!e||!this.store)return;const i=e.item.objectId,o=this.store.getObjectIdIndex(i)??e.index;await this.store.updateItem({index:o,name:t.path,value:n})}}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get description(){return this.template?.description??this.config?.description??this.field?.description??null}get editable(){const{config:e,editingEnabled:t,field:n,layer:i,template:o}=this;if(null==n||null==i)return!1;const r=u(i),l=c(i),a=l?.operations.supportsUpdate;return!!(n.editable&&r&&a)&&(t?!(!1===o?.editable||!1===e?.editable):!(!o?.editable&&!e?.editable))}get header(){return this.template?.label||this.config?.label||this.alias||this.path||null}get hidden(){const{config:e}=this;return!1===e?.visible||this._get("hidden")||!1}set hidden(e){this._set("hidden",e)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,config:t,template:n}=this,i=e?.length,o=n?.input&&"maxLength"in n.input?n.input.maxLength:t?.maxLength;return null!=o&&!isNaN(o)&&o>=-1&&(-1===i||o<=i)?o:i}get minLength(){const{config:e,template:t,maxLength:n}=this,i=t?.input&&"minLength"in t.input?t.input.minLength:e?.minLength||null;return n&&i<=n?i:null}get name(){return this.field?.name}get nullable(){return this.field?.nullable??!1}get path(){return this.field?.name}get required(){const{config:e,field:t,template:n}=this,i=t?.nullable,o=e?.required,r=n?.required;return this.editable&&(!i||!0===o||!0===r)}get sortable(){return this.template?!1!==this.template?.sortable:!1!==this.config?.sortable}createInputElement({rowData:e,value:t}){const n=e?.item;if(!n||!n.feature)return null;this._inputField=this._setUpInputField(n.feature,t);const{field:i,maxLength:o,minLength:r,required:l}=this,{domain:a}=this._inputField;let s;"coded-value"===a?.type?(s=this._createSelectElement(t,a.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),this._inputField),s.onchange=()=>{s.onblur=null,p()}):(s=document.createElement("input"),s.type=d(i)?"number":"text",o>-1&&(s.maxLength=o),r>0&&(s.minLength=r)),s.classList.add(_.input),s.value=t,s.required=l;let u=!1;s.onkeydown=e=>{u=e.key===v.cancelEdit},s.onblur=()=>{s.onblur=null,p()};const p=()=>{u?this.cancel():this.submit(),this._inputField=null};return s}createInputContainer(){const e=document.createElement("div");return e.classList.add(_.inputContainer),e}createLockedElement(){const e=document.createElement("div");return e.classList.add(_.locked),e}getCellValue({path:e},t){return t?.item?.feature?.attributes?.[e]??null}_renderDateEditors(e,n,i){const{config:o,messagesCommon:r,template:l}=this,a=e?new Date(e):new Date(Date.now()),s=new f({dateInputEnabled:!0,value:a}),u=new g({value:a});i.value=a.getTime().toString();let d=!e;const p=()=>{d=!0;const e=this._getCombinedDateTime(s.value,u.value);i.value=e.getTime().toString()},c=()=>{d?this.submit():this.cancel()},m=()=>{i.value=null,this.submit()};t((()=>[s.value,u.value]),(()=>p()));const h=document.createElement("div"),y=document.createElement("div");s.container=h,u.container=y;const v=document.createElement("button");v.classList.add(_.button,_.saveIcon),v.onclick=()=>c(),v.title=r?.save;const b=document.createElement("button");b.classList.add(_.button,_.trashIcon),b.onclick=()=>m(),b.title=r?.clear;const F=document.createElement("div");F.classList.add(_.dateInputWrapper),F.appendChild(h),(l&&l.input&&"datetime-picker"===l.input.type&&!1!==l.input.includeTime||o&&!1!==o.includeTime)&&F.appendChild(y);const C=document.createElement("div");C.classList.add(_.dateInputContainer),C.appendChild(F),C.appendChild(v),C.appendChild(b),s.when((()=>this.grid?.notifyResize())),u.when((()=>this.grid?.notifyResize())),this.removeCellContent(n),n.appendChild(C),this.grid?.notifyResize()}_createSelectElement(e,t,n){let i=!1;const o=t.map((t=>{t.value===e&&(i=!0);const n=document.createElement("option");return n.text=t.name,n.value=t.value,n}));if(null!=e&&""!==e&&!i){const t=document.createElement("option");t.text=e,t.value=e,o.unshift(t)}if(!n.required&&null==n.value){const e=document.createElement("option");e.value="",o.unshift(e)}const r=document.createElement("select");return o.forEach((e=>r.add(e))),r.value=e,r}_setUpInputField(e,t){const{config:n,field:i,layer:o}=this,r=new m({config:n,feature:e,initialFeature:e.clone(),field:i,layer:o,group:null,messages:null});return r.set("value",t),r}_isDomainCompatible(e){const{field:t}=this;if(e&&"coded-value"===e.type){const n=typeof e.codedValues[0].code;if("string"===n&&p(t)||"number"===n&&d(t))return!0}return!(!e||"range"!==e.type||!d(t))}_getDomainForFeature(e){const{config:t,layer:n,name:i,template:o}=this;if(!n)return null;if("wfs"===n.type||"geojson"===n.type||"csv"===n.type)return null;if(o?.domain&&this._isDomainCompatible(o.domain))return o.domain;const{typeIdField:r}=n,l=r===i,a=this.field.domain;if(l&&!a)return new s({name:"__internal-type-based-coded-value-domain__",codedValues:n.types?.map((({id:e,name:t})=>({code:e,name:t})))});const u=r&&null!=i&&n.getFieldDomain(i,{feature:e})||a,d=t?.domain;return this._isDomainCompatible(d)?d:u}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const n=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return n&&n.length?n[0].name:e}return null}_getCombinedDateTime(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds())}_getDateFormatOptions(){const{config:e,template:t}=this,n=t?.format?.dateFormat||e?.format?.dateFormat;return n?r(n):t&&t.input&&"includeTime"in t.input==!1||!1===e?.includeTime?C:F}};e([n({readOnly:!0})],I.prototype,"alias",null),e([n()],I.prototype,"cellValueFormatFunction",void 0),e([n()],I.prototype,"cellValueValidatorFunction",void 0),e([n()],I.prototype,"config",void 0),e([n({readOnly:!0})],I.prototype,"defaultValue",null),e([n({readOnly:!0})],I.prototype,"description",null),e([n({readOnly:!0})],I.prototype,"editable",null),e([n()],I.prototype,"editingEnabled",void 0),e([n()],I.prototype,"expressionInfos",void 0),e([n()],I.prototype,"field",void 0),e([n()],I.prototype,"formatFunction",void 0),e([n({readOnly:!0})],I.prototype,"header",null),e([n()],I.prototype,"hidden",null),e([n()],I.prototype,"headerRenderFunction",void 0),e([n()],I.prototype,"inputRenderFunction",void 0),e([n()],I.prototype,"layer",void 0),e([n({readOnly:!0})],I.prototype,"loadingMessage",null),e([n()],I.prototype,"maxLength",null),e([n()],I.prototype,"minLength",null),e([n({readOnly:!0})],I.prototype,"name",null),e([n({readOnly:!0})],I.prototype,"nullable",null),e([n()],I.prototype,"parseInputValueFunction",void 0),e([n({readOnly:!0})],I.prototype,"path",null),e([n({readOnly:!0})],I.prototype,"required",null),e([n()],I.prototype,"sortable",null),e([n()],I.prototype,"store",void 0),e([n()],I.prototype,"template",void 0),e([n()],I.prototype,"updateRowItemFunction",void 0),e([n()],I.prototype,"updateStoreItemFunction",void 0),I=e([i("esri.widgets.FeatureTable.FieldColumn")],I);const L=I;export{L as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{Heading as e}from"../support/Heading.js";import{classes as t,isActivationKey as n}from"../support/widgetUtils.js";import{tsx as i}from"../support/jsxFactory.js";const o="esri-item-list",l={base:o,list:`${o}__list`,group:`${o}__group`,scroller:`${o}__scroller`,groupHeader:`${o}__group__header`,item:`${o}__list-item`,itemSelected:`${o}__list-item--selected`,itemContainer:`${o}__list-item-container`,itemLabel:`${o}__list-item-label`,itemIcon:`${o}__list-item-icon`,noMatchesMessage:`${o}__no-matches-message`,noItemsMessage:`${o}__no-items-message`,filterContainer:`${o}__filter-container`,filterContainerSticky:`${o}__filter-container--sticky`,filterPlaceholder:`${o}__filter-placeholder`,filterInput:`${o}__filter-input`,filterPlaceholderText:`${o}__filter-placeholder-text`,searchIcon:"esri-icon-search",widget:"esri-widget",input:"esri-input"},r=4;function s(e){const{filterEnabled:t=!0,filterText:n="",headingLevel:o=r,id:l,identify:s,items:a,messages:d,onFilterChange:u,onItemMouseEnter:I,onItemMouseLeave:f,onItemSelect:g,renderIcon:p,selectedItem:_,selectionMode:v="none"}=e,h=e.enableListScroll??!0;return i("div",{key:l},i("calcite-list",{selectionMode:v,selectionAppearance:"border"},t?m({filterText:n,messages:d,onFilterChange:u,id:l}):null,c({enableListScroll:h,identify:s,items:a,selectedItem:_,messages:d,filterText:n,headingLevel:o,renderIcon:p,onItemMouseLeave:f,onItemMouseEnter:I,onItemSelect:g})))}function a(e){return!!e.items}function c(e){const{headingLevel:t,identify:n,items:o,renderIcon:r,filterText:s,onItemMouseLeave:c,onItemMouseEnter:m,onItemSelect:u,selectedItem:I}=e,g=e.enableListScroll?l.scroller:void 0;return 0===o.length?i("div",{class:l.noMatchesMessage,key:"no-matches"},e.messages.noMatches):i("div",{class:g,key:"item-container"},o.map((e=>a(e)?f({group:e,filterText:s,headingLevel:t,identify:n,onItemMouseLeave:c,onItemMouseEnter:m,onItemSelect:u,renderIcon:r,selectedItem:I}):d({item:e,identify:n,grouped:!0,onItemMouseLeave:c,onItemMouseEnter:m,onItemSelect:u,renderIcon:r,filterText:s,selectedItem:I}))))}function m(e){const{messages:t,filterText:n,enableListScroll:o}=e;return i("div",{key:"filter",class:o?void 0:l.filterContainerSticky},i("calcite-input",{onCalciteInputInput:t=>{const n=t.currentTarget;e.onFilterChange&&e.onFilterChange(n.value)},placeholder:t.filterPlaceholder,value:n,type:"search"}))}function d({grouped:e,identify:o,item:r,onItemMouseEnter:s,onItemMouseLeave:a,onItemSelect:c,renderIcon:m,selectedItem:d}){const f=u(r,o),g=f===u(d,o);return i("calcite-list-item",{"aria-level":e?"2":"",class:t(l.item,g?l.itemSelected:""),"data-item":r,key:f,label:r.label??void 0,selected:g,tabIndex:0,onCalciteListItemSelect:e=>c?.(I(e)),onmouseenter:e=>s?.(I(e)),onkeydown:e=>n(e.key)&&c?.(I(e)),onmouseleave:e=>a?.(I(e))},i("div",{class:l.itemIcon,slot:"content-start"},m?.({item:r})))}function u(e,t){return e?`${t?.(e)||e.id}__${e.label}`:""}function I(e){return e.currentTarget["data-item"]}function f(t){const{group:n,headingLevel:o=r,...s}=t;return i("div",{class:l.group,key:n.label??void 0},i(e,{level:o,class:l.groupHeader},n.label),n.items.map((e=>d({...s,item:e,grouped:!0}))))}export{s as ItemList,f as renderGroup,d as renderItem};
5
+ import{Heading as e}from"../support/Heading.js";import{classes as t,isActivationKey as n}from"../support/widgetUtils.js";import{tsx as i}from"../support/jsxFactory.js";const r="esri-item-list",l={base:r,list:`${r}__list`,group:`${r}__group`,scroller:`${r}__scroller`,scrollerEnabled:`${r}__scroller--enabled`,groupHeader:`${r}__group__header`,item:`${r}__list-item`,itemIcon:`${r}__list-item-icon`,itemIconSuccess:`${r}__list-item-icon--success`,itemIconError:`${r}__list-item-icon--error`,itemContentEnd:`${r}__list-item-content-end`,itemLoader:`${r}__list-item-loader`,noMatchesMessage:`${r}__no-matches-message`,noItemsMessage:`${r}__no-items-message`,filterContainer:`${r}__filter-container`,filterContainerSticky:`${r}__filter-container--sticky`,filterPlaceholder:`${r}__filter-placeholder`,filterInput:`${r}__filter-input`,filterPlaceholderText:`${r}__filter-placeholder-text`,searchIcon:"esri-icon-search",widget:"esri-widget",input:"esri-input"},o=4;function s(e){const{filterText:t="",id:n,messages:r,onFilterChange:l,...o}=e;return i("div",{key:n},e.filterEnabled??1?d({filterText:t,id:n,messages:r,onFilterChange:l}):null,a({...o,enableListScroll:e.enableListScroll??!0,filterText:t,messages:r}))}function c(e){return!!e.items}function a(e){const{headingLevel:n,items:r,...o}=e;return 0===r.length?i("div",{class:l.noMatchesMessage,key:"no-matches"},e.messages.noMatches):i("div",{class:t({[l.scroller]:!0,[l.scrollerEnabled]:!!e.enableListScroll}),key:"item-container"},r.map((e=>c(e)?p({...o,group:e,headingLevel:n}):m({...o,grouped:!0,item:e}))))}function d(e){const{messages:t,filterText:n,enableListScroll:r}=e;return i("div",{key:"filter",class:r?void 0:l.filterContainerSticky},i("calcite-input",{onCalciteInputInput:t=>{const n=t.currentTarget;e.onFilterChange&&e.onFilterChange(n.value)},placeholder:t.filterPlaceholder,value:n,type:"search"}))}function m({grouped:e,identify:t,item:r,onItemMouseEnter:o,onItemMouseLeave:s,onItemSelect:c,renderIcon:a,renderItemContent:d,renderItemContentEnd:m,renderItemLabel:p,renderItemDescription:g,selectedItem:f}){const h=u(r,t),v=h===u(f,t),I=d?.(r),$=m?.(r);return i("calcite-list-item",{"aria-level":e?"2":"",class:l.item,"data-item":r,key:h,label:I?void 0:p?.(r)??r.label??void 0,description:I?void 0:g?.(r)??void 0,selected:v,tabIndex:0,afterUpdate:e=>{e.selected=v},onCalciteListItemSelect:e=>c?.(_(e)),onmouseenter:e=>o?.(_(e)),onkeydown:e=>n(e.key)&&c?.(_(e)),onmouseleave:e=>s?.(_(e))},i("div",{key:"content-start",class:l.itemIcon,slot:"content-start"},a?.(r)),I?i("div",{key:"content",slot:"content"},I):null,$?i("div",{key:"content-end",class:l.itemContentEnd,slot:"content-end"},$):null)}function u(e,t){return e?`${t?.(e)||e.id}__${e.label}`:""}function _(e){return e.currentTarget["data-item"]}function p(t){const{group:n,headingLevel:r=o,selectionMode:s="none",...c}=t;return i("div",{class:l.group,key:n.label??void 0},i(e,{level:r,class:l.groupHeader},n.label),i("calcite-list",{selectionMode:s,selectionAppearance:"border"},n.items.map((e=>m({...c,item:e,grouped:!0})))))}export{s as ItemList,p as renderGroup,m as renderItem};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Accessor.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{watch as s,initial as l}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{renderPreviewHTML as a}from"../../symbols/support/symbolUtils.js";var p;const m="esri.widgets.FeatureTemplates.TemplateItem";let u=p=class extends(i(r)){constructor(t){super(t),this._activeFetchInfo={id:null,request:null},this.layer=null,this.template=null,this.thumbnail=null}initialize(){this.handles.add(s((()=>{const{layer:t}=this;return[t&&"renderer"in t?t.renderer:null,this.template]}),(()=>{this._activeFetchInfo.id=null,this._activeFetchInfo.request=null,this._set("thumbnail",null)}),l))}get description(){return this.template?.description}set description(t){this.template&&(this.template.description=t)}get label(){return this.template?.name}set label(t){this.template&&(this.template.name=t)}get id(){return`${this.label??""}–${this.layer?.id}`}clone(){const t=null!=this.thumbnail?this.thumbnail.cloneNode(!0):null,e=new p({layer:this.layer,template:this.template});return e._set("thumbnail",t),e}static async fetchThumbnail(t,e){const r=await c(t,e);if(null==r)return null;const i={maxSize:36};"dictionary"===t.renderer?.type&&(i.fieldMap=t.renderer.fieldMap??void 0,i.feature={attributes:e.prototype.attributes??{}});return await a(r,i)}};async function c(t,r){const{renderer:i}=t;if(i){const t=new e({attributes:r.prototype.attributes}),s=await i.getSymbolAsync(t);if(s)return s}return h(t)}async function h(t){const{geometryType:e}=t,r="point"===e||"multipoint"===e?await import("../../symbols/SimpleMarkerSymbol.js"):"polyline"===e?await import("../../symbols/SimpleLineSymbol.js"):"polygon"===e||"mesh"===e||"multipatch"===e?await import("../../symbols/SimpleFillSymbol.js"):null;return r?new r.default:null}t([o()],u.prototype,"description",null),t([o()],u.prototype,"label",null),t([o()],u.prototype,"layer",void 0),t([o()],u.prototype,"template",void 0),t([o({readOnly:!0})],u.prototype,"thumbnail",void 0),t([o()],u.prototype,"id",null),u=p=t([n(m)],u);const y=u;export{y as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Accessor.js";import{watch as s,initial as l}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{renderPreviewHTML as n}from"../../symbols/support/symbolUtils.js";var a;const p="esri.widgets.FeatureTemplates.TemplateItem";let u=a=class extends r{constructor(t){super(t),this._activeFetchInfo={id:null,request:null},this.layer=null,this.template=null,this.thumbnail=null}initialize(){this.addHandles(s((()=>{const{layer:t}=this;return[t&&"renderer"in t?t.renderer:null,this.template]}),(()=>{this._activeFetchInfo.id=null,this._activeFetchInfo.request=null,this._set("thumbnail",null)}),l))}get description(){return this.template?.description}set description(t){this.template&&(this.template.description=t)}get label(){return this.template?.name}set label(t){this.template&&(this.template.name=t)}get id(){return`${this.label??""}–${this.layer?.id}`}get supportsUpload(){return"scene"===this.layer.type}clone(){const t=null!=this.thumbnail?this.thumbnail.cloneNode(!0):null,e=new a({layer:this.layer,template:this.template});return e._set("thumbnail",t),e}static async fetchThumbnail(t,e){const r=await m(t,e);if(null==r)return null;const s={maxSize:36};"dictionary"===t.renderer?.type&&(s.fieldMap=t.renderer.fieldMap??void 0,s.feature={attributes:e.prototype.attributes??{}});return await n(r,s)}};async function m(t,r){const{renderer:s}=t;if(s){const t=new e({attributes:r.prototype.attributes}),l=await s.getSymbolAsync(t);if(l)return l}return c(t)}async function c(t){const{geometryType:e}=t,r="point"===e||"multipoint"===e?await import("../../symbols/SimpleMarkerSymbol.js"):"polyline"===e?await import("../../symbols/SimpleLineSymbol.js"):"polygon"===e||"mesh"===e||"multipatch"===e?await import("../../symbols/SimpleFillSymbol.js"):null;return r?new r.default:null}t([i()],u.prototype,"description",null),t([i()],u.prototype,"label",null),t([i()],u.prototype,"layer",void 0),t([i()],u.prototype,"template",void 0),t([i({readOnly:!0})],u.prototype,"thumbnail",void 0),t([i()],u.prototype,"id",null),t([i()],u.prototype,"supportsUpload",null),u=a=t([o(p)],u);const y=u;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{watch as r,initial as s}from"../core/reactiveUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import a from"./FeatureTemplates/FeatureTemplatesViewModel.js";import{ItemList as c}from"./FeatureTemplates/ItemList.js";import d from"./FeatureTemplates/TemplateItem.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import{vmEvent as u}from"./support/decorators/vmEvent.js";import{tsx as h}from"./support/jsxFactory.js";const f="esri-feature-templates",v={base:f,loader:`${f}__loader`,widget:"esri-widget"};function b(e){return"items"in e}function I(e){return e.length>0&&b(e[0])}function g(e){return e.id}const y={filter:!0};let w=class extends(t(n)){constructor(e,t){super(e,t),this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const r=e.target;if(r["data-has-icon"])return void t.unobserve(r);const s=r["data-item"],{layer:i,template:o}=s;r["data-has-icon"]=!0;const l=await d.fetchThumbnail(i,o).catch((()=>(r["data-has-icon"]=!1,null)));if(null==l)return;r.appendChild(l)}}))})),this.enableListScroll=!0,this.filterText="",this.headingLevel=4,this.messages=null,this.viewModel=new a,this.visibleElements={...y},this.renderItemIcon=this.renderItemIcon.bind(this),this._afterItemCreateOrUpdate=this._afterItemCreateOrUpdate.bind(this),this._afterItemRemoved=this._afterItemRemoved.bind(this)}initialize(){const e=({label:e})=>!this.filterText||!!e?.toLowerCase().includes(this.filterText.toLowerCase());this.addHandles(r((()=>this.viewModel),((t,r)=>{t&&!t.filterFunction&&(this.filterFunction=e),r&&r!==t&&r.filterFunction===e&&(r.filterFunction=null)}),s))}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return m({input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js")})}get filterFunction(){return this.viewModel.filterFunction}set filterFunction(e){this.viewModel.filterFunction=e}get groupBy(){return this.viewModel.groupBy}set groupBy(e){this.viewModel.groupBy=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get selectedItem(){return this.viewModel.selectedItem}castVisibleElements(e){return{...y,...e}}select(e,t){return this.viewModel.select(e,t)}render(){const{enableListScroll:e,filterText:t,headingLevel:r,messages:s,viewModel:{items:i,numberOfFeatureTemplates:o,selectedItem:l,state:n}}=this,d=this.visibleElements.filter&&o>1;if(I(i)){const e=i.find((e=>e.label===a.nullGroupBy.label));e&&(e.label=s.other)}return h("div",{class:this.classes(v.base,v.widget),"aria-label":s.widgetLabel},"loading"===n?this.renderLoader():"ready"===n?h(c,{id:this.id,identify:g,filterText:t,items:i,headingLevel:r,selectionMode:"single",messages:{filterPlaceholder:s.filterPlaceholder,noItems:s.noItems,noMatches:s.noMatches},filterEnabled:d,onItemSelect:e=>this.viewModel.select(e),onFilterChange:e=>{this.filterText=e,this.viewModel.refresh()},renderIcon:this.renderItemIcon,selectedItem:l??void 0,enableListScroll:e}):null)}renderItemIcon({item:e}){return h("span",{key:"icon",afterCreate:this._afterItemCreateOrUpdate,afterUpdate:this._afterItemCreateOrUpdate,afterRemoved:this._afterItemRemoved,"data-item":e,"data-has-icon":!1})}renderLoader(){return h("div",{class:v.loader,key:"loader"})}_afterItemCreateOrUpdate(e){this._iconIntersectionObserver?.observe(e)}_afterItemRemoved(e){this._iconIntersectionObserver?.unobserve(e)}};e([i()],w.prototype,"enableListScroll",void 0),e([i()],w.prototype,"filterFunction",null),e([i()],w.prototype,"filterText",void 0),e([i()],w.prototype,"groupBy",null),e([i()],w.prototype,"headingLevel",void 0),e([i()],w.prototype,"label",null),e([i()],w.prototype,"layers",null),e([i(),p("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],w.prototype,"messages",void 0),e([i({readOnly:!0})],w.prototype,"selectedItem",null),e([i(),u("select")],w.prototype,"viewModel",void 0),e([i()],w.prototype,"visibleElements",void 0),e([o("visibleElements")],w.prototype,"castVisibleElements",null),w=e([l("esri.widgets.FeatureTemplates")],w);const j=w;export{j as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{watch as r,initial as s}from"../core/reactiveUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import l from"./Widget.js";import a from"./FeatureTemplates/FeatureTemplatesViewModel.js";import{ItemList as d}from"./FeatureTemplates/ItemList.js";import c from"./FeatureTemplates/TemplateItem.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import{vmEvent as u}from"./support/decorators/vmEvent.js";import{tsx as h}from"./support/jsxFactory.js";const f="esri-feature-templates",v={base:f,loader:`${f}__loader`,widget:"esri-widget"};function I(e){return"items"in e}function b(e){return e.length>0&&I(e[0])}function y(e){return e.id}const g={filter:!0};let w=class extends(t(l)){constructor(e,t){super(e,t),this.enableListScroll=!0,this.filterText="",this.headingLevel=4,this.messages=null,this.viewModel=new a,this.visibleElements={...g},this.renderItemLabel=()=>null,this.renderItemDescription=()=>null,this.renderItemContent=e=>null,this.renderItemContentEnd=e=>null,this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const r=e.target;if(r["data-has-icon"])return void t.unobserve(r);const s=r["data-item"],{layer:i,template:o}=s;r["data-has-icon"]=!0;const n=await c.fetchThumbnail(i,o).catch((()=>(r["data-has-icon"]=!1,null)));if(null==n)return;r.appendChild(n)}}))})),this.renderItemIcon=e=>h("span",{key:"icon",afterCreate:this._afterItemCreateOrUpdate,afterUpdate:this._afterItemCreateOrUpdate,afterRemoved:this._afterItemRemoved,"data-item":e,"data-has-icon":!1}),this._afterItemCreateOrUpdate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)}}initialize(){const e=({label:e})=>!this.filterText||!!e?.toLowerCase().includes(this.filterText.toLowerCase());this.addHandles(r((()=>this.viewModel),((t,r)=>{t&&!t.filterFunction&&(this.filterFunction=e),r&&r!==t&&r.filterFunction===e&&(r.filterFunction=null)}),s))}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return m({input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js")})}get filterFunction(){return this.viewModel.filterFunction}set filterFunction(e){this.viewModel.filterFunction=e}get groupBy(){return this.viewModel.groupBy}set groupBy(e){this.viewModel.groupBy=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get selectedItem(){return this.viewModel.selectedItem}castVisibleElements(e){return{...g,...e}}select(e,t){return this.viewModel.select(e,t)}render(){const{enableListScroll:e,filterText:t,headingLevel:r,messages:s,viewModel:{items:i,numberOfFeatureTemplates:o,selectedItem:n,state:l}}=this,c=this.visibleElements.filter&&o>1;if(b(i)){const e=i.find((e=>e.label===a.nullGroupBy.label));e&&(e.label=s.other)}return h("div",{class:this.classes(v.base,v.widget),"aria-label":s.widgetLabel},"loading"===l?this.renderLoader():"ready"===l?h(d,{enableListScroll:e,filterEnabled:c,filterText:t,headingLevel:r,id:this.id,identify:y,items:i,messages:{filterPlaceholder:s.filterPlaceholder,noItems:s.noItems,noMatches:s.noMatches},renderIcon:this.renderItemIcon,renderItemContent:this.renderItemContent,renderItemContentEnd:this.renderItemContentEnd,renderItemDescription:this.renderItemDescription,renderItemLabel:this.renderItemLabel,selectedItem:n??void 0,selectionMode:"single",onItemSelect:e=>this.viewModel.select(e),onFilterChange:e=>{this.filterText=e,this.viewModel.refresh()}}):null)}renderLoader(){return h("div",{class:v.loader,key:"loader"})}};e([i()],w.prototype,"enableListScroll",void 0),e([i()],w.prototype,"filterFunction",null),e([i()],w.prototype,"filterText",void 0),e([i()],w.prototype,"groupBy",null),e([i()],w.prototype,"headingLevel",void 0),e([i()],w.prototype,"label",null),e([i()],w.prototype,"layers",null),e([i(),p("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],w.prototype,"messages",void 0),e([i({readOnly:!0})],w.prototype,"selectedItem",null),e([i(),u("select")],w.prototype,"viewModel",void 0),e([i()],w.prototype,"visibleElements",void 0),e([o("visibleElements")],w.prototype,"castVisibleElements",null),e([i()],w.prototype,"renderItemLabel",void 0),e([i()],w.prototype,"renderItemDescription",void 0),e([i()],w.prototype,"renderItemContent",void 0),e([i()],w.prototype,"renderItemContentEnd",void 0),w=e([n("esri.widgets.FeatureTemplates")],w);const j=w;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";let l=class extends t{constructor(e){super(e),this._vendorInfo=null,this._fullscreenStyle="width: 100%; height: 100%;",this.view=null,this._errorHandler=this._errorHandler.bind(this),this._stateHandler=this._stateHandler.bind(this)}destroy(){this._removeFullscreenListeners(),this.view=null}get element(){return this.view?.container??null}set element(e){this._override("element",e)}get state(){return this.element?this._isSupported()?this._isActive()?"active":"ready":"feature-unsupported":"disabled"}enter(){this._enterFullscreen()}exit(){this._exitFullscreen()}toggle(){this._isActive()?this._exitFullscreen():this._enterFullscreen()}_isSupported(){this._removeFullscreenListeners();const e=this._getVendorInfo(this.element);return this._addFullscreenListeners(e),this._vendorInfo=e,!!e}_isActive(){return!!this._vendorInfo&&!!document[this._vendorInfo.propertyName]}_stateHandler(){this.notifyChange("state"),"active"===this.state?this._addStyle():this._removeStyle()}_errorHandler(e){r.getLogger(this.declaredClass).error("fullscreen request failed",e)}_getVendorInfo(e){if(e)return e.requestFullscreen?{enterName:"requestFullscreen",exitName:"exitFullscreen",errorEventName:"fullscreenerror",changeEventName:"fullscreenchange",propertyName:"fullscreen"}:e.webkitRequestFullScreen?{enterName:"webkitRequestFullscreen",exitName:"webkitCancelFullScreen",errorEventName:"webkitfullscreenerror",changeEventName:"webkitfullscreenchange",propertyName:"webkitIsFullScreen"}:e.mozRequestFullScreen?{enterName:"mozRequestFullScreen",exitName:"mozCancelFullScreen",errorEventName:"mozfullscreenerror",changeEventName:"mozfullscreenchange",propertyName:"mozFullScreen"}:e.msRequestFullscreen?{enterName:"msRequestFullscreen",exitName:"msExitFullscreen",errorEventName:"MSFullscreenError",changeEventName:"MSFullscreenChange",propertyName:"msFullscreenElement"}:void 0}_enterFullscreen(){if("feature-unsupported"===this.state)return void r.getLogger(this.declaredClass).warn("The fullscreen API is not supported in this browser.");const{element:e}=this;e&&(this._vendorInfo&&e[this._vendorInfo.enterName].call(e),this.notifyChange("state"))}_addStyle(){const{element:e}=this;e&&e.setAttribute("style",this._fullscreenStyle)}_removeStyle(){const{element:e}=this;e&&e.removeAttribute("style")}_exitFullscreen(){if("feature-unsupported"===this.state)return;const{element:e}=this;e&&(this._vendorInfo&&document[this._vendorInfo.exitName].call(document),this.notifyChange("state"))}_addFullscreenListeners(e){e&&(document.addEventListener(e.changeEventName,this._stateHandler),document.addEventListener(e.errorEventName,this._errorHandler))}_removeFullscreenListeners(){const{_vendorInfo:e}=this;e&&(document.removeEventListener(e.changeEventName,this._stateHandler),document.removeEventListener(e.errorEventName,this._errorHandler))}};e([s()],l.prototype,"element",null),e([s({readOnly:!0})],l.prototype,"state",null),e([s()],l.prototype,"view",void 0),e([s()],l.prototype,"enter",null),e([s()],l.prototype,"exit",null),e([s()],l.prototype,"toggle",null),l=e([n("esri.widgets.Fullscreen.FullscreenViewModel")],l);const o=l;export{o as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";let l=class extends t{constructor(e){super(e),this._vendorInfo=null,this._fullscreenStyle="width: 100%; height: 100%;",this.view=null,this._errorHandler=this._errorHandler.bind(this),this._stateHandler=this._stateHandler.bind(this)}destroy(){this._removeFullscreenListeners(),this.view=null}get element(){return this.view?.container??null}set element(e){this._override("element",e)}get state(){return this.element?this._isSupported()?this._isActive()?"active":"ready":"feature-unsupported":"disabled"}enter(){this._enterFullscreen()}exit(){this._exitFullscreen()}toggle(){this._isActive()?this._exitFullscreen():this._enterFullscreen()}_isSupported(){this._removeFullscreenListeners();const e=this._getVendorInfo(this.element);return this._addFullscreenListeners(e),this._vendorInfo=e,!!e}_isActive(){return!!this._vendorInfo&&!!document[this._vendorInfo.propertyName]}_stateHandler(){this.notifyChange("state"),"active"===this.state?this._addStyle():this._removeStyle()}_errorHandler(e){r.getLogger(this.declaredClass).error("fullscreen request failed",e)}_getVendorInfo(e){if(e)return e.requestFullscreen?{enterName:"requestFullscreen",exitName:"exitFullscreen",errorEventName:"fullscreenerror",changeEventName:"fullscreenchange",propertyName:"fullscreen"}:e.webkitRequestFullScreen?{enterName:"webkitRequestFullscreen",exitName:"webkitCancelFullScreen",errorEventName:"webkitfullscreenerror",changeEventName:"webkitfullscreenchange",propertyName:"webkitIsFullScreen"}:e.mozRequestFullScreen?{enterName:"mozRequestFullScreen",exitName:"mozCancelFullScreen",errorEventName:"mozfullscreenerror",changeEventName:"mozfullscreenchange",propertyName:"mozFullScreen"}:void 0}_enterFullscreen(){if("feature-unsupported"===this.state)return void r.getLogger(this.declaredClass).warn("The fullscreen API is not supported in this browser.");const{element:e}=this;e&&(this._vendorInfo&&e[this._vendorInfo.enterName].call(e),this.notifyChange("state"))}_addStyle(){const{element:e}=this;e&&e.setAttribute("style",this._fullscreenStyle)}_removeStyle(){const{element:e}=this;e&&e.removeAttribute("style")}_exitFullscreen(){if("feature-unsupported"===this.state)return;const{element:e}=this;e&&(this._vendorInfo&&document[this._vendorInfo.exitName].call(document),this.notifyChange("state"))}_addFullscreenListeners(e){e&&(document.addEventListener(e.changeEventName,this._stateHandler),document.addEventListener(e.errorEventName,this._errorHandler))}_removeFullscreenListeners(){const{_vendorInfo:e}=this;e&&(document.removeEventListener(e.changeEventName,this._stateHandler),document.removeEventListener(e.errorEventName,this._errorHandler))}};e([s()],l.prototype,"element",null),e([s({readOnly:!0})],l.prototype,"state",null),e([s()],l.prototype,"view",void 0),e([s()],l.prototype,"enter",null),e([s()],l.prototype,"exit",null),e([s()],l.prototype,"toggle",null),l=e([n("esri.widgets.Fullscreen.FullscreenViewModel")],l);const o=l;export{o as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import s from"../../core/Evented.js";import{watch as i,initial as r}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import l from"./ListItem.js";import{getItemLayers as n,findLayerListMode as c}from"./support/layerListUtils.js";const d={view:"view",viewLayers:"view-layers",mapLayers:"map-layers",layerViews:"layer-views",layerListMode:"layer-list-mode"},m="hide",h=t.ofType(l);let p=class extends s.EventedAccessor{constructor(e){super(e),this.checkPublishStatusEnabled=!1,this.listItemCreatedFunction=null,this.operationalItems=new h,this.view=null}initialize(){this.addHandles([i((()=>[this.view,this.view?.ready]),(()=>this._viewHandles()),r),i((()=>[this.listItemCreatedFunction,this.checkPublishStatusEnabled]),(()=>this._recompileList()))],d.view)}destroy(){this.removeAllHandles(),this.view=null,this.operationalItems.removeAll()}get state(){const e=this.get("view");return this.get("view.ready")?"ready":e?"loading":"disabled"}triggerAction(e,t){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:t})}moveListItem(e,t,s,i){const r=e?.layer;if(!r)return;const a=this.view?.map?.layers,o=t?n(t):a,l=s?n(s):a;if(!o||!l)return;const{operationalItems:c}=this,d=t?.children||c,m=s?.children||c,h=l.length-i;e.parent=s||null,d.includes(e)&&d.remove(e),o.includes(r)&&o.remove(r),m.includes(e)||m.add(e,h),l.includes(r)||l.add(r,h)}_createLayerViewHandles(e){this.removeHandles(d.layerViews),this._compileList(),e&&this.addHandles(e.on("change",(()=>this._compileList())),d.layerViews)}_createMapLayerHandles(e){this.removeHandles(d.mapLayers),this._compileList(),e&&this.addHandles(e.on("change",(()=>this._compileList())),d.mapLayers)}_createListItem(e){const{view:t,listItemCreatedFunction:s,checkPublishStatusEnabled:i}=this;return new l({checkPublishStatusEnabled:i,layer:e,listItemCreatedFunction:s,view:t})}_removeAllItems(){this.operationalItems.removeAll()}_getViewableLayers(e){if(e)return e.filter((e=>c(e)!==m))}_watchLayersListMode(e){this.removeHandles(d.layerListMode),e&&e.forEach((e=>{"listMode"in e&&this.addHandles(i((()=>e.listMode),(()=>this._compileList())),d.layerListMode)}))}_compileList(){const e=this.get("view.map.layers");this._watchLayersListMode(e);const t=this._getViewableLayers(e);t&&t.length?(this._createNewItems(t),this._removeItems(t),this._sortItems(t)):this._removeAllItems()}_createNewItems(e){const{operationalItems:t}=this;e.forEach((e=>{t.find((t=>t.layer===e))||t.add(this._createListItem(e))}))}_removeItems(e){const{operationalItems:t}=this,s=[];t.forEach((t=>{t&&e&&e.includes(t.layer)||s.push(t)})),t.removeMany(s)}_sortItems(e){const{operationalItems:t}=this;t.sort(((t,s)=>{const i=e.indexOf(t.layer),r=e.indexOf(s.layer);return i>r?-1:i<r?1:0}))}_recompileList(){this._removeAllItems(),this._compileList()}_viewHandles(){const{view:e}=this;this.removeHandles([d.mapLayers,d.layerViews,d.viewLayers]),this._compileList(),e&&e.ready&&this.addHandles([i((()=>this.view?.map?.allLayers),(e=>this._createMapLayerHandles(e)),r),i((()=>this.view?.allLayerViews),(e=>this._createLayerViewHandles(e)),r)],d.viewLayers)}};e([a()],p.prototype,"checkPublishStatusEnabled",void 0),e([a()],p.prototype,"listItemCreatedFunction",void 0),e([a({type:h})],p.prototype,"operationalItems",void 0),e([a({readOnly:!0})],p.prototype,"state",null),e([a()],p.prototype,"view",void 0),p=e([o("esri.widgets.LayerList.LayerListViewModel")],p);const y=p;export{y as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import s from"../../core/Evented.js";import{watch as i,initial as r}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import l from"./ListItem.js";import{getItemLayers as n,findLayerListMode as c}from"./support/layerListUtils.js";const d={view:"view",viewLayers:"view-layers",mapLayers:"map-layers",layerViews:"layer-views",layerListMode:"layer-list-mode"},m="hide",h=t.ofType(l);let p=class extends s.EventedAccessor{constructor(e){super(e),this.checkPublishStatusEnabled=!1,this.listItemCreatedFunction=null,this.operationalItems=new h,this.view=null}initialize(){this.addHandles([i((()=>[this.view,this.view?.ready]),(()=>this._viewHandles()),r),i((()=>[this.listItemCreatedFunction,this.checkPublishStatusEnabled]),(()=>this._recompileList()))],d.view)}destroy(){this.removeAllHandles(),this.view=null,this.operationalItems.removeAll()}get state(){const e=this.get("view");return this.get("view.ready")?"ready":e?"loading":"disabled"}triggerAction(e,t){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:t})}moveListItem(e,t,s,i){const r=e?.layer;if(!r)return;const a=this.view?.map?.layers,o=t?n(t):a,l=s?n(s):a;if(!o||!l)return;const{operationalItems:c}=this,d=t?.children||c,m=s?.children||c,h=l.length-i;e.parent=s||null,d.includes(e)&&d.remove(e),o.includes(r)&&o.remove(r),m.includes(e)||m.add(e,h),l.includes(r)||l.add(r,h)}_createLayerViewHandles(e){this.removeHandles(d.layerViews),this._compileList(),e&&this.addHandles(e.on("change",(()=>this._compileList())),d.layerViews)}_createMapLayerHandles(e){this.removeHandles(d.mapLayers),this._compileList(),e&&this.addHandles(e.on("change",(()=>this._compileList())),d.mapLayers)}_createListItem(e){const{view:t,listItemCreatedFunction:s,checkPublishStatusEnabled:i}=this;return new l({checkPublishStatusEnabled:i,layer:e,listItemCreatedFunction:s,view:t})}_removeAllItems(){this.operationalItems.removeAll()}_getViewableLayers(e){if(e)return e.filter((e=>c(e)!==m))}_watchLayersListMode(e){this.removeHandles(d.layerListMode),e&&e.forEach((e=>{"listMode"in e&&this.addHandles(i((()=>e.listMode),(()=>this._compileList())),d.layerListMode)}))}_compileList(){const e=this.get("view.map.layers");this._watchLayersListMode(e);const t=this._getViewableLayers(e);t&&t.length?(this._createNewItems(t),this._removeItems(t),this._sortItems(t)):this._removeAllItems()}_createNewItems(e){const{operationalItems:t}=this;e.forEach((e=>{t.find((t=>t.layer===e))||t.add(this._createListItem(e))}))}_removeItems(e){const{operationalItems:t}=this,s=[];t.forEach((t=>{t&&e&&e.includes(t.layer)||s.push(t)})),t.removeMany(s)}_sortItems(e){const{operationalItems:t}=this;t.sort(((t,s)=>{const i=e.indexOf(t.layer),r=e.indexOf(s.layer);return i>r?-1:i<r?1:0}))}_recompileList(){this._removeAllItems(),this._compileList()}_viewHandles(){const{view:e}=this;this.removeHandles([d.mapLayers,d.layerViews,d.viewLayers]),this._recompileList(),e&&e.ready&&this.addHandles([i((()=>this.view?.map?.allLayers),(e=>this._createMapLayerHandles(e)),r),i((()=>this.view?.allLayerViews),(e=>this._createLayerViewHandles(e)),r)],d.viewLayers)}};e([a()],p.prototype,"checkPublishStatusEnabled",void 0),e([a()],p.prototype,"listItemCreatedFunction",void 0),e([a({type:h})],p.prototype,"operationalItems",void 0),e([a({readOnly:!0})],p.prototype,"state",null),e([a()],p.prototype,"view",void 0),p=e([o("esri.widgets.LayerList.LayerListViewModel")],p);const y=p;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{eventKey as i}from"../core/events.js";import has from"../core/has.js";import{on as s,watch as n,initial as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{cast as a}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import h from"./LayerList/LayerListViewModel.js";import g from"./LayerList/ListItem.js";import{findSelectedItem as m,sortLayersToIds as u,sortChildLayersToIds as p,canSortSublayers as b}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{accessibleHandler as y}from"./support/decorators/accessibleHandler.js";import{messageBundle as I}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import C from"sortablejs";function w(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const A="esri-layerlist-new-ui",S=t.ofType(g),$="data-sort-filter",k="data-layer-uid",L="layerUid",M="esri-layer-list",T=`${M}__item`,E={base:`${M} esri-widget esri-widget--panel`,newUI:`${M}--new-ui`,noItems:`${M}__no-items`,list:`${M}__list`,listRoot:`${M}__list--root`,listExclusive:`${M}__list--exclusive`,listInherited:`${M}__list--inherited`,listIndependent:`${M}__list--independent`,item:T,itemContent:`${T}-content`,itemMessage:`${T}--has-message`,itemInvisible:`${T}--invisible`,itemInvisibleAtScale:`${T}--invisible-at-scale`,itemChildren:`${T}--has-children`,itemSelectable:`${T}--selectable`,itemContainer:`${T}-container`,actionsMenu:`${T}-actions-menu`,actionsMenuItem:`${T}-actions-menu-item`,actionsMenuItemActive:`${T}-actions-menu-item--active`,actions:`${T}-actions`,actionsList:`${T}-actions-list`,action:`${T}-action`,actionIcon:`${T}-action-icon`,actionImage:`${T}-action-image`,actionTitle:`${T}-action-title`,actionToggle:`${M}__action-toggle`,actionToggleOn:`${M}__action-toggle--on`,label:`${T}-label`,message:`${T}-message`,title:`${T}-title`,statusIndicator:`${M}__status-indicator`,publishing:`${M}__publishing`,updating:`${M}__updating`,connectionStatus:`${M}__connection-status`,connectionStatusConnected:`${M}__connection-status--connected`,toggleVisible:`${T}-toggle`,toggleVisibleIcon:`${T}-toggle-icon`,toggleIcon:`${T}-toggle-icon`,radioIcon:`${T}-radio-icon`,childToggle:`${M}__child-toggle`,childToggleOpen:`${M}__child-toggle--open`,childOpened:`${M}__child-toggle-icon--opened`,childClosed:`${M}__child-toggle-icon--closed`,childClosed_RTL:`${M}__child-toggle-icon--closed-rtl`,sortableChosen:`${M}--chosen`,disabled:"esri-disabled",disabledElement:"esri-disabled-element",hidden:"esri-hidden",rotating:"esri-rotating",iconEllipses:"esri-icon-handle-horizontal",iconVisible:"esri-icon-visible",iconInvisible:"esri-icon-non-visible",iconRadioSelected:"esri-icon-radio-checked",iconRadioUnselected:"esri-icon-radio-unchecked",iconNoticeTriangle:"esri-icon-notice-triangle",iconChildrenOpen:"esri-icon-down-arrow",iconDownArrow:"esri-icon-down-arrow",iconRightArrow:"esri-icon-right-triangle-arrow",iconLeftArrow:"esri-icon-left-triangle-arrow",iconLoading:"esri-icon-loading-indicator",iconDefaultAction:"esri-icon-default-action",widgetIcon:"esri-icon-layers"},R={actions:"actions",actionSection:"action-section",items:"items"},x={exclusive:"exclusive",inherited:"inherited",independent:"independent"};function U(e){const{actionsOpen:t,children:i}=e;t&&(e.actionsOpen=!1),i.forEach((e=>U(e)))}const N="root",O={statusIndicators:!0,errors:!1};let j=class extends d{constructor(e,i){super(e,i),this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._newUI=has(A),this._tooltipReferenceMap=new Map,this.visibleItems=new t,this.iconClass=E.widgetIcon,this.icon=null,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.selectionEnabled=!1,this.selectedItems=new S,this.viewModel=new h,this.visibleElements={...O},this._onSortableSort=({to:e,from:t,item:i,newIndex:s})=>{t&&e&&(t===e?this._sortLayers(this._sortableMap.get(t.dataset.group)):this._moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}))},this._sortableCanSort=(e,t)=>!(!e.el.dataset.group||!t.el.dataset.group),this._sortableCanPull=(e,t,i)=>{const{listItemCanGiveFunction:s}=this,n={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,n)},this._sortableCanPut=(e,t,i)=>{const{listItemCanReceiveFunction:s}=this,n={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,n)},this._onSortableEnd=({oldIndex:e,from:t,to:i,item:s})=>{t!==i&&t.insertBefore(s,t.children[e])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.addHandles([s((()=>this.operationalItems),"change",(()=>this._itemsChanged(e))),n((()=>this.visibleElements),(()=>this._itemsChanged(e))),n((()=>this.selectionEnabled),(()=>this._toggleAllSorting()),o)])}loadDependencies(){return _({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this.removeAllHandles(),this._destroySortables(),this._tooltipReferenceMap.clear()}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...O,...e}}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{visibleItems:e,_newUI:t}=this,i=this.viewModel?.state,s={[E.newUI]:t,[E.hidden]:"loading"===i,[E.disabled]:"disabled"===i},n=this.renderItemTooltips(),o=this.renderItems();return f("div",{class:this.classes(E.base,s)},0!==e.length?[n,o]:this.renderNoItems())}renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?f("calcite-tooltip",{label:i?.layerIncompatible??"",referenceElement:t.get(e.uid)},i?.layerIncompatibleTooltip):null}renderItemTooltipNodes(e){const{incompatible:t,children:i}=e;return[t?this.renderItemTooltip(e):null,...!t&&i?i.toArray().map((e=>this.renderItemTooltipNodes(e))):[]]}renderItemTooltips(){return this.visibleItems.toArray().map((e=>this.renderItemTooltipNodes(e)))??[]}renderNoItems(){return f("div",{class:E.noItems},this.messages?.noItemsToDisplay)}renderItems(){const{visibleItems:e,selectionEnabled:t,messages:i}=this;return f("ul",{"aria-label":i?.widgetLabel,role:t?"listbox":void 0,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,"data-group":N,bind:this,class:this.classes(E.list,E.listRoot,E.listIndependent)},e.map((e=>this.renderItem(e,null))).toArray())}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[E.actionsMenuItemActive]:e.actionsOpen};return f("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(E.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i?.options,title:i?.options},f("span",{"aria-hidden":"true",class:E.iconEllipses}))}renderActionsMenu(e,t,i,s){const{panel:n}=e,o=n&&n.visible?this.renderPanelButton(n):null,l=1===i&&this._getSingleActionButton(t),r=l?this.renderAction({item:e,action:l,singleAction:!0}):null,a=!l&&i?this.renderActionsMenuIcon(e,s):null;return a||o||l?f("div",{key:"actions-menu",class:E.actionsMenu},o,r,a):null}renderChildList(e,t){const{selectionEnabled:i}=this,{visibilityMode:s,children:n}=e,o=this._hasChildren(e),l=!o&&i&&"group"===e.layer?.type,{exclusive:r,inherited:a}=x,c={[E.listExclusive]:s===r,[E.listInherited]:s===a,[E.listIndependent]:s!==a&&s!==r};return o||l?f("ul",{bind:this,key:"list-items",id:t,"data-group":e.uid,"data-item":e,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,class:this.classes(E.list,c),"aria-expanded":e.open?"true":"false",role:i?"listbox":s===r?"radiogroup":"group",hidden:!e.open&&!l||null},n?.map((t=>this.renderItem(t,e))).toArray()):null}renderChildrenToggle(e,t){const{messagesCommon:i}=this,s=this._hasChildren(e),n={[E.childToggleOpen]:e.open},o=e.open?i?.collapse:i?.expand;return s?f("span",{onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,"data-item":e,key:"toggle-children",class:this.classes(E.childToggle,n),tabindex:"0",role:"button","aria-controls":t,"aria-label":o,title:o},f("span",{"aria-hidden":"true",class:this.classes(E.childClosed,E.iconRightArrow)}),f("span",{"aria-hidden":"true",class:this.classes(E.childOpened,E.iconDownArrow)}),f("span",{"aria-hidden":"true",class:this.classes(E.childClosed_RTL,E.iconLeftArrow)})):null}renderItemMessage(e){return e.error?f("div",{key:"esri-layer-list__error",class:E.message,role:"alert"},f("span",{"aria-hidden":"true",class:E.iconNoticeTriangle}),this.messages?.layerError):e.incompatible?f("div",{key:"esri-layer-list__incompatible",class:E.message,role:"alert"},f("span",{bind:this,tabIndex:0,"aria-hidden":"true",class:E.iconNoticeTriangle,afterCreate:t=>this._setTooltipReference(t,e)}),this.messages?.layerIncompatible):null}renderItemContent(e,t,i){const{id:s}=this,n=`${s}_${e.uid}`,o=`${n}_actions`,l=`${n}__list`,{panel:r}=e,a=this._filterActions(e.actionsSections),c=this._countActions(a);return[f("div",{key:"list-item-container",class:E.itemContainer},this.renderChildrenToggle(e,l),this.renderLabel(e,t,i),this.renderActionsMenu(e,a,c,o)),this.renderItemMessage(e),c?this.renderActionsSections(e,a,o):null,r&&r.open&&!r.disabled?r.render():null,this.renderChildList(e,l)]}renderItem(e,t){const{_newUI:i,id:s,selectionEnabled:n,selectedItems:o}=this,l=`${`${s}_${e.uid}`}__title`,r=this._hasMessage(e),a=this._hasChildren(e),c={[E.itemChildren]:a,[E.itemMessage]:!!r,[E.itemInvisible]:i&&!e.visible,[E.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[E.itemSelectable]:n};if(n){const i={[k]:e.layer?.uid,[$]:(!e.sortable).toString()};return f("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(E.item,c),"aria-labelledby":l,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,"data-group":t?t.uid:N,tabIndex:0,"aria-selected":m(e,o)?"true":"false",role:"option",...i},this.renderItemContent(e,t,l))}return f("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(E.item,c),"aria-labelledby":l},this.renderItemContent(e,t,l))}renderConnectionIcon(e){const{connectionStatus:t}=e;return null!=t?f("calcite-icon",{icon:"connected"===t?"check-circle":"offline",scale:"s"}):null}renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:s,publishing:n,updating:o}=e,l=o&&!t,r=!!s;return f("span",{class:this.classes({[E.statusIndicator]:!0,[E.publishing]:n,[E.updating]:l,[E.connectionStatus]:r,[E.connectionStatusConnected]:r&&"connected"===s}),key:"layer-item-status"},this.renderConnectionIcon(e))}renderItemTitle(e,t){const{messages:i}=this;if(!e)return null;const s=e.title||i?.untitledLayer,n=e.visibleAtCurrentScale?s:`${s} (${i?.layerInvisibleAtScale??""})`;return f("span",{key:"layer-title-container",id:t,title:n,"aria-label":n,class:E.title},s)}renderItemToggleIcon(e,t){const{_newUI:i}=this,{exclusive:s}=x,n=t?.visibilityMode,o={[E.toggleVisibleIcon]:i,[E.toggleIcon]:i&&n!==s,[E.radioIcon]:i&&n===s,[E.iconRadioSelected]:n===s&&e.visible,[E.iconRadioUnselected]:n===s&&!e.visible,[E.iconVisible]:n!==s&&e.visible,[E.iconInvisible]:n!==s&&!e.visible};return f("span",{key:"item-toggle-icon",class:this.classes(o),"aria-hidden":"true"})}renderItemToggle(e,t,i){const{selectionEnabled:s,messages:n}=this,{exclusive:o}=x,l=t?.visibilityMode,r=l===o?"radio":"switch";return f("span",s?{key:"item-toggle-selection-enabled",class:E.toggleVisible,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":l,tabIndex:0,title:e.visible?n?.hideLayer:n?.showLayer,"aria-checked":e.visible?"true":"false",role:r,"aria-labelledby":i}:{key:"item-toggle",class:E.toggleVisible},this.renderItemToggleIcon(e,t))}renderLabel(e,t,i){const{selectionEnabled:s,_newUI:n,messages:o}=this,{inherited:l,exclusive:r}=x,a=t?.visibilityMode,c=a===r?"radio":"switch",d=n?[this.renderItemTitle(e,i),this.renderItemStatus(e,t),this.renderItemToggle(e,t,i)]:[this.renderItemToggle(e,t,i),this.renderItemTitle(e,i),this.renderItemStatus(e,t)],h=f("div",s?{key:`item-label-no-selection-${e.uid}`,class:E.label}:{key:`item-label-with-selection-${e.uid}`,class:E.label,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":a,tabIndex:0,"aria-checked":e.visible?"true":"false",title:e.visible?o?.hideLayer:o?.showLayer,role:c,"aria-labelledby":i},d);return a===l||e.error?f("div",{key:`item-label-container-${e.uid}`,class:E.label},this.renderItemTitle(e,i),this.renderItemStatus(e,t)):h}renderPanelButton(e){const{className:t,open:i,title:s,image:n}=e,o=n||t?t:E.iconDefaultAction,l=this._getIconImageStyles(e),r={[E.actionsMenuItemActive]:i},a={[E.actionImage]:!!l["background-image"],[E.disabledElement]:e.disabled};return o&&(a[o]=!!o),f("div",{"aria-disabled":e.disabled.toString(),key:`panel-${e.uid}`,bind:this,"data-panel":e,onclick:this._triggerPanel,onkeydown:this._triggerPanel,class:this.classes(E.actionsMenuItem,r),role:"button",tabindex:e.disabled?null:0,title:s,"aria-label":s},f("span",{class:this.classes(a),styles:l}))}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>f("ul",{key:`${e}-action-section-${i}`,class:E.actionsList},this.renderActionSection(e,t))));return f("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:E.actions,hidden:!e.actionsOpen||null},s)}renderActionSection(e,t){return(t&&t.toArray()).map((t=>this.renderAction({item:e,action:t})))}renderActionIcon(e){const{active:t,className:i}=e,s=this._getIconImageStyles(e),n="button"!==e.type||e.image||i?i:E.iconDefaultAction,o={[E.actionImage]:!t&&!!s["background-image"],[E.iconLoading]:t,[E.rotating]:t};return n&&!t&&(o[n]=!0),f("span",{key:"action-icon","aria-hidden":"true",class:this.classes(E.actionIcon,o),styles:s})}renderActionTitle(e,t){return t?null:f("span",{key:"action-title",class:E.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:n,disabled:o,title:l}=i,r={[E.actionsMenuItem]:s&&"button"===i.type,[E.action]:n||!s&&"toggle"!==i.type,[E.actionToggle]:!n&&"toggle"===i.type,[E.actionToggleOn]:!n&&"toggle"===i.type&&i.value,[E.disabledElement]:o},a=[this.renderActionIcon(i),this.renderActionTitle(l,s)];return s?f("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",title:l??void 0,"aria-label":l??void 0},a):f("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",role:"button",title:l??void 0,"aria-label":l??void 0},a)}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:t}=this,i=e.dataset.group,s=t.get(i);s&&s.destroy(),t.delete(i)}_destroySortables(){const{_sortableMap:e,_sortableNodes:t}=this;e.forEach((e=>e&&e.destroy())),e.clear(),t.clear()}_moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}){const n=i["data-item"],o=e["data-item"],l=t["data-item"];this.viewModel.moveListItem(n,l,o,s)}_sortLayers(e){if(!e)return;const t=e.el["data-item"],i=e.toArray();t?p(t,i):u(this.view?.map?.layers,i)}_toggleSorting(e,t){const{_sortableMap:i,selectionEnabled:s}=this,n=i.get(t),o=e["data-item"],l=(t===N||o.childrenSortable&&b(o))&&s;if(n)n.option("disabled",!l);else if(l){const s=C.create(e,{dataIdAttr:k,group:{name:t,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${$}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!l,chosenClass:E.sortableChosen});i.set(t,s)}}_toggleAllSorting(){this._sortableNodes.forEach(((e,t)=>this._toggleSorting(e,t)))}_sortNodeCreated(e){const t=e.dataset.group;t&&(this._sortableNodes.set(t,e),this._toggleSorting(e,t))}_setVisibleItems(e){this.visibleItems=e.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).getItemAt(0)}_focusListItem(e){const{_focusSortUid:t}=this;if(!e||!t)return;const i=e["data-item"];i.layer?.uid===t&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e,t){const i=R.actionSection+t;this.addHandles(e.on("change",this.scheduleRender.bind(this)),i),e.forEach((e=>this._renderOnActionChanges(e,t)))}_renderOnActionChanges(e,t){const i=R.actions+t;"toggle"!==e.type?"slider"!==e.type?this.addHandles(n((()=>[e?.className,e?.image,e?.id,e?.title,e?.visible]),(()=>this.scheduleRender()),o),i):this.addHandles(n((()=>[e?.className,e?.id,e?.title,e?.visible,e?.value,e?.displayValueEnabled,e?.max,e?.min,e?.step]),(()=>this.scheduleRender()),o),i):this.addHandles(n((()=>[e?.className,e?.image,e?.id,e?.title,e?.visible,e?.value]),(()=>this.scheduleRender()),o),i)}_renderOnItemChanges(e){const t=e.uid,i=R.items+t;this.addHandles([n((()=>[e?.actionsOpen,e?.visible,e?.open,e?.updating,e?.connectionStatus,e?.publishing,e?.title,e?.visibleAtCurrentScale,e?.error,e?.visibilityMode,e?.panel,e?.panel?.title,e?.panel?.content,e?.panel?.className,e?.sortable,e?.childrenSortable]),(()=>this.scheduleRender()),l),n((()=>[e?.hidden,e?.error]),(()=>this._setVisibleItems(this.operationalItems))),e.actionsSections.on("change",(()=>this.scheduleRender())),e.children.on("change",(()=>this.scheduleRender()))],i),e.children.forEach((e=>this._renderOnItemChanges(e))),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e,t)))}_itemsChanged(e){this.removeAllHandles(),e.forEach((e=>this._renderOnItemChanges(e))),this._tooltipReferenceMap.clear(),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="esri.widgets.LayerList.ListItemPanel"===e.declaredClass||"esri.support.Action.ActionButton"===e.declaredClass||"esri.support.Action.ActionToggle"===e.declaredClass?e.image:null;return{"background-image":t?`url("${t}")`:void 0}}_selectionKeydown(e){const t=["ArrowDown","ArrowUp"],s=i(e);if(!t.includes(s))return void this._toggleSelection(e);e.stopPropagation();const n=e.currentTarget,o=n["data-item"],{_sortableMap:l,selectedItems:r}=this,a=n.dataset.group,c=l.get(a);if(!c)return;const d=m(o,r),h=c.toArray(),g=e.target,u=h.indexOf(g.dataset[L]);if(-1!==u){if("ArrowDown"===s){const e=u+1;if(e>=h.length)return;d?(w(h,u,e),c.sort(h),this._sortLayers(c),this._focusSortUid=o.layer?.uid):(this._focusSortUid=o.layer?.uid,this.scheduleRender())}if("ArrowUp"===s){const e=u-1;if(e<=-1)return;d?(w(h,u,e),c.sort(h),this._sortLayers(c),this._focusSortUid=o.layer?.uid):(this._focusSortUid=o.layer?.uid,this.scheduleRender())}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.operationalItems.forEach((e=>U(e))),t.actionsOpen=s,e.stopPropagation()}_triggerPanel(e){const t=e.currentTarget["data-panel"];e.stopPropagation(),t&&!t.disabled&&(t.open=!t.open)}_triggerAction(e){const t=e.currentTarget,i=t["data-action"],s=t["data-item"];"toggle"===i.type&&(i.value=!i.value),this.triggerAction(i,s),e.stopPropagation()}_toggleVisibility(e){const t=e.currentTarget,i=t.getAttribute("data-parent-visibility"),s=t["data-item"];i===x.exclusive&&s.visible||(s.visible=!s.visible),e.stopPropagation()}_toggleChildrenClick(e){const t=e.currentTarget["data-item"];t.open=!t.open,e.stopPropagation()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=e.currentTarget["data-item"],n=m(s,i),{length:o}=i;if(!t)return o&&!(n&&1===o)?(i.removeAll(),void i.add(s)):void(n?i.remove?.(n):i.add(s));n?i.remove?.(n):i.add(s)}};e([r()],j.prototype,"visibleItems",void 0),e([r()],j.prototype,"iconClass",void 0),e([r()],j.prototype,"icon",void 0),e([r()],j.prototype,"label",null),e([r()],j.prototype,"listItemCanGiveFunction",void 0),e([r()],j.prototype,"listItemCanReceiveFunction",void 0),e([r()],j.prototype,"listItemCreatedFunction",null),e([r(),I("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([r(),I("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([r()],j.prototype,"multipleSelectionEnabled",void 0),e([r()],j.prototype,"operationalItems",null),e([r()],j.prototype,"selectionEnabled",void 0),e([r()],j.prototype,"selectedItems",void 0),e([r()],j.prototype,"view",null),e([v("trigger-action"),r({type:h})],j.prototype,"viewModel",void 0),e([r()],j.prototype,"visibleElements",void 0),e([a("visibleElements")],j.prototype,"castVisibleElements",null),e([y()],j.prototype,"_toggleActionsOpen",null),e([y()],j.prototype,"_triggerPanel",null),e([y()],j.prototype,"_triggerAction",null),e([y()],j.prototype,"_toggleVisibility",null),e([y()],j.prototype,"_toggleChildrenClick",null),e([y()],j.prototype,"_toggleSelection",null),j=e([c("esri.widgets.LayerList")],j);const V=j;export{V as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{eventKey as i}from"../core/events.js";import has from"../core/has.js";import{on as s,watch as n,initial as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{cast as a}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import h from"./LayerList/LayerListViewModel.js";import m from"./LayerList/ListItem.js";import{findSelectedItem as g,sortLayersToIds as u,sortChildLayersToIds as p,canSortSublayers as b}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{accessibleHandler as y}from"./support/decorators/accessibleHandler.js";import{messageBundle as I}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import C from"sortablejs";function w(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const A="esri-layerlist-new-ui",S=t.ofType(m),$="data-sort-filter",k="data-layer-uid",L="layerUid",M="esri-layer-list",T=`${M}__item`,E={base:`${M} esri-widget esri-widget--panel`,newUI:`${M}--new-ui`,noItems:`${M}__no-items`,list:`${M}__list`,listRoot:`${M}__list--root`,listExclusive:`${M}__list--exclusive`,listInherited:`${M}__list--inherited`,listIndependent:`${M}__list--independent`,item:T,itemContent:`${T}-content`,itemMessage:`${T}--has-message`,itemInvisible:`${T}--invisible`,itemInvisibleAtScale:`${T}--invisible-at-scale`,itemChildren:`${T}--has-children`,itemSelectable:`${T}--selectable`,itemContainer:`${T}-container`,actionsMenu:`${T}-actions-menu`,actionsMenuItem:`${T}-actions-menu-item`,actionsMenuItemActive:`${T}-actions-menu-item--active`,actions:`${T}-actions`,actionsList:`${T}-actions-list`,action:`${T}-action`,actionIcon:`${T}-action-icon`,actionImage:`${T}-action-image`,actionTitle:`${T}-action-title`,actionToggle:`${M}__action-toggle`,actionToggleOn:`${M}__action-toggle--on`,label:`${T}-label`,message:`${T}-message`,title:`${T}-title`,statusIndicator:`${M}__status-indicator`,publishing:`${M}__publishing`,updating:`${M}__updating`,connectionStatus:`${M}__connection-status`,connectionStatusConnected:`${M}__connection-status--connected`,toggleVisible:`${T}-toggle`,toggleVisibleIcon:`${T}-toggle-icon`,toggleIcon:`${T}-toggle-icon`,radioIcon:`${T}-radio-icon`,childToggle:`${M}__child-toggle`,childToggleOpen:`${M}__child-toggle--open`,childOpened:`${M}__child-toggle-icon--opened`,childClosed:`${M}__child-toggle-icon--closed`,childClosed_RTL:`${M}__child-toggle-icon--closed-rtl`,sortableChosen:`${M}--chosen`,disabled:"esri-disabled",disabledElement:"esri-disabled-element",hidden:"esri-hidden",rotating:"esri-rotating",iconEllipses:"esri-icon-handle-horizontal",iconVisible:"esri-icon-visible",iconInvisible:"esri-icon-non-visible",iconRadioSelected:"esri-icon-radio-checked",iconRadioUnselected:"esri-icon-radio-unchecked",iconNoticeTriangle:"esri-icon-notice-triangle",iconChildrenOpen:"esri-icon-down-arrow",iconDownArrow:"esri-icon-down-arrow",iconRightArrow:"esri-icon-right-triangle-arrow",iconLeftArrow:"esri-icon-left-triangle-arrow",iconLoading:"esri-icon-loading-indicator",iconDefaultAction:"esri-icon-default-action",widgetIcon:"esri-icon-layers"},R={actions:"actions",actionSection:"action-section",items:"items"},x={exclusive:"exclusive",inherited:"inherited",independent:"independent"};function U(e){const{actionsOpen:t,children:i}=e;t&&(e.actionsOpen=!1),i.forEach((e=>U(e)))}const N="root",O={statusIndicators:!0,errors:!1};let j=class extends d{constructor(e,t){super(e,t),this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._newUI=has(A),this._tooltipReferenceMap=new Map,this.visibleItems=null,this.iconClass=E.widgetIcon,this.icon=null,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.selectionEnabled=!1,this.selectedItems=new S,this.viewModel=new h,this.visibleElements={...O},this._onSortableSort=({to:e,from:t,item:i,newIndex:s})=>{t&&e&&(t===e?this._sortLayers(this._sortableMap.get(t.dataset.group)):this._moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}))},this._sortableCanSort=(e,t)=>!(!e.el.dataset.group||!t.el.dataset.group),this._sortableCanPull=(e,t,i)=>{const{listItemCanGiveFunction:s}=this,n={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,n)},this._sortableCanPut=(e,t,i)=>{const{listItemCanReceiveFunction:s}=this,n={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,n)},this._onSortableEnd=({oldIndex:e,from:t,to:i,item:s})=>{t!==i&&t.insertBefore(s,t.children[e])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.addHandles([s((()=>this.operationalItems),"change",(()=>this._itemsChanged(e))),n((()=>this.visibleElements),(()=>this._itemsChanged(e))),n((()=>this.selectionEnabled),(()=>this._toggleAllSorting()),o)])}loadDependencies(){return _({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this.removeAllHandles(),this._destroySortables(),this._tooltipReferenceMap.clear()}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...O,...e}}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{visibleItems:e,_newUI:t}=this,i=this.viewModel?.state,s={[E.newUI]:t,[E.hidden]:"loading"===i,[E.disabled]:"disabled"===i},n=this.renderItemTooltips(),o=this.renderItems();return f("div",{class:this.classes(E.base,s)},e.length?[n,o]:this.renderNoItems())}renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?f("calcite-tooltip",{label:i.layerIncompatible,referenceElement:t.get(e.uid)},i.layerIncompatibleTooltip):null}renderItemTooltipNodes(e){const{incompatible:t,children:i}=e;return[t?this.renderItemTooltip(e):null,...!t&&i?i.toArray().map((e=>this.renderItemTooltipNodes(e))):[]]}renderItemTooltips(){return this.visibleItems.toArray().map((e=>this.renderItemTooltipNodes(e)))??[]}renderNoItems(){return f("div",{class:E.noItems},this.messages.noItemsToDisplay)}renderItems(){const{visibleItems:e,selectionEnabled:t,messages:i}=this;return f("ul",{"aria-label":i.widgetLabel,role:t?"listbox":void 0,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,"data-group":N,bind:this,class:this.classes(E.list,E.listRoot,E.listIndependent)},e.map((e=>this.renderItem(e,null))).toArray())}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[E.actionsMenuItemActive]:e.actionsOpen};return f("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(E.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i.options,title:i.options},f("span",{"aria-hidden":"true",class:E.iconEllipses}))}renderActionsMenu(e,t,i,s){const{panel:n}=e,o=n&&n.visible?this.renderPanelButton(n):null,l=1===i&&this._getSingleActionButton(t),r=l?this.renderAction({item:e,action:l,singleAction:!0}):null,a=!l&&i?this.renderActionsMenuIcon(e,s):null;return a||o||l?f("div",{key:"actions-menu",class:E.actionsMenu},o,r,a):null}renderChildList(e,t){const{selectionEnabled:i}=this,{visibilityMode:s,children:n}=e,o=this._hasChildren(e),l=!o&&i&&"group"===e.layer?.type,{exclusive:r,inherited:a}=x,c={[E.listExclusive]:s===r,[E.listInherited]:s===a,[E.listIndependent]:s!==a&&s!==r};return o||l?f("ul",{bind:this,key:"list-items",id:t,"data-group":e.uid,"data-item":e,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,class:this.classes(E.list,c),"aria-expanded":e.open?"true":"false",role:i?"listbox":s===r?"radiogroup":"group",hidden:!e.open&&!l||null},n?.map((t=>this.renderItem(t,e))).toArray()):null}renderChildrenToggle(e,t){const{messagesCommon:i}=this,s=this._hasChildren(e),n={[E.childToggleOpen]:e.open},o=e.open?i.collapse:i.expand;return s?f("span",{onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,"data-item":e,key:"toggle-children",class:this.classes(E.childToggle,n),tabindex:"0",role:"button","aria-controls":t,"aria-label":o,title:o},f("span",{"aria-hidden":"true",class:this.classes(E.childClosed,E.iconRightArrow)}),f("span",{"aria-hidden":"true",class:this.classes(E.childOpened,E.iconDownArrow)}),f("span",{"aria-hidden":"true",class:this.classes(E.childClosed_RTL,E.iconLeftArrow)})):null}renderItemMessage(e){return e.error?f("div",{key:"esri-layer-list__error",class:E.message,role:"alert"},f("span",{"aria-hidden":"true",class:E.iconNoticeTriangle}),this.messages.layerError):e.incompatible?f("div",{key:"esri-layer-list__incompatible",class:E.message,role:"alert"},f("span",{bind:this,tabIndex:0,"aria-hidden":"true",class:E.iconNoticeTriangle,afterCreate:t=>this._setTooltipReference(t,e)}),this.messages.layerIncompatible):null}renderItemContent(e,t,i){const{id:s}=this,n=`${s}_${e.uid}`,o=`${n}_actions`,l=`${n}__list`,{panel:r}=e,a=this._filterActions(e.actionsSections),c=this._countActions(a);return[f("div",{key:"list-item-container",class:E.itemContainer},this.renderChildrenToggle(e,l),this.renderLabel(e,t,i),this.renderActionsMenu(e,a,c,o)),this.renderItemMessage(e),c?this.renderActionsSections(e,a,o):null,r&&r.open&&!r.disabled?r.render():null,this.renderChildList(e,l)]}renderItem(e,t){const{_newUI:i,id:s,selectionEnabled:n,selectedItems:o}=this,l=`${`${s}_${e.uid}`}__title`,r=this._hasMessage(e),a=this._hasChildren(e),c={[E.itemChildren]:a,[E.itemMessage]:!!r,[E.itemInvisible]:i&&!e.visible,[E.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[E.itemSelectable]:n};if(n){const i={[k]:e.layer?.uid,[$]:(!e.sortable).toString()};return f("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(E.item,c),"aria-labelledby":l,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,"data-group":t?t.uid:N,tabIndex:0,"aria-selected":g(e,o)?"true":"false",role:"option",...i},this.renderItemContent(e,t,l))}return f("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(E.item,c),"aria-labelledby":l},this.renderItemContent(e,t,l))}renderConnectionIcon(e){const{connectionStatus:t}=e;return null!=t?f("calcite-icon",{icon:"connected"===t?"check-circle":"offline",scale:"s"}):null}renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:s,publishing:n,updating:o}=e,l=o&&!t,r=!!s;return f("span",{class:this.classes({[E.statusIndicator]:!0,[E.publishing]:n,[E.updating]:l,[E.connectionStatus]:r,[E.connectionStatusConnected]:r&&"connected"===s}),key:"layer-item-status"},this.renderConnectionIcon(e))}renderItemTitle(e,t){const{messages:i}=this;if(!e)return null;const s=e.title||i.untitledLayer,n=e.visibleAtCurrentScale?s:`${s} (${i.layerInvisibleAtScale})`;return f("span",{key:"layer-title-container",id:t,title:n,"aria-label":n,class:E.title},s)}renderItemToggleIcon(e,t){const{_newUI:i}=this,{exclusive:s}=x,n=t?.visibilityMode,o={[E.toggleVisibleIcon]:i,[E.toggleIcon]:i&&n!==s,[E.radioIcon]:i&&n===s,[E.iconRadioSelected]:n===s&&e.visible,[E.iconRadioUnselected]:n===s&&!e.visible,[E.iconVisible]:n!==s&&e.visible,[E.iconInvisible]:n!==s&&!e.visible};return f("span",{key:"item-toggle-icon",class:this.classes(o),"aria-hidden":"true"})}renderItemToggle(e,t,i){const{selectionEnabled:s,messages:n}=this,{exclusive:o}=x,l=t?.visibilityMode,r=l===o?"radio":"switch";return f("span",s?{key:"item-toggle-selection-enabled",class:E.toggleVisible,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":l,tabIndex:0,title:e.visible?n.hideLayer:n.showLayer,"aria-checked":e.visible?"true":"false",role:r,"aria-labelledby":i}:{key:"item-toggle",class:E.toggleVisible},this.renderItemToggleIcon(e,t))}renderLabel(e,t,i){const{selectionEnabled:s,_newUI:n,messages:o}=this,{inherited:l,exclusive:r}=x,a=t?.visibilityMode,c=a===r?"radio":"switch",d=n?[this.renderItemTitle(e,i),this.renderItemStatus(e,t),this.renderItemToggle(e,t,i)]:[this.renderItemToggle(e,t,i),this.renderItemTitle(e,i),this.renderItemStatus(e,t)],h=f("div",s?{key:`item-label-no-selection-${e.uid}`,class:E.label}:{key:`item-label-with-selection-${e.uid}`,class:E.label,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":a,tabIndex:0,"aria-checked":e.visible?"true":"false",title:e.visible?o.hideLayer:o.showLayer,role:c,"aria-labelledby":i},d);return a===l||e.error?f("div",{key:`item-label-container-${e.uid}`,class:E.label},this.renderItemTitle(e,i),this.renderItemStatus(e,t)):h}renderPanelButton(e){const{className:t,open:i,title:s,image:n}=e,o=n||t?t:E.iconDefaultAction,l=this._getIconImageStyles(e),r={[E.actionsMenuItemActive]:i},a={[E.actionImage]:!!l["background-image"],[E.disabledElement]:e.disabled};return o&&(a[o]=!!o),f("div",{"aria-disabled":e.disabled.toString(),key:`panel-${e.uid}`,bind:this,"data-panel":e,onclick:this._triggerPanel,onkeydown:this._triggerPanel,class:this.classes(E.actionsMenuItem,r),role:"button",tabindex:e.disabled?null:0,title:s,"aria-label":s},f("span",{class:this.classes(a),styles:l}))}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>f("ul",{key:`${e}-action-section-${i}`,class:E.actionsList},this.renderActionSection(e,t))));return f("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:E.actions,hidden:!e.actionsOpen||null},s)}renderActionSection(e,t){return(t&&t.toArray()).map((t=>this.renderAction({item:e,action:t})))}renderActionIcon(e){const{active:t,className:i}=e,s=this._getIconImageStyles(e),n="button"!==e.type||e.image||i?i:E.iconDefaultAction,o={[E.actionImage]:!t&&!!s["background-image"],[E.iconLoading]:t,[E.rotating]:t};return n&&!t&&(o[n]=!0),f("span",{key:"action-icon","aria-hidden":"true",class:this.classes(E.actionIcon,o),styles:s})}renderActionTitle(e,t){return t?null:f("span",{key:"action-title",class:E.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:n,disabled:o,title:l}=i,r={[E.actionsMenuItem]:s&&"button"===i.type,[E.action]:n||!s&&"toggle"!==i.type,[E.actionToggle]:!n&&"toggle"===i.type,[E.actionToggleOn]:!n&&"toggle"===i.type&&i.value,[E.disabledElement]:o},a=[this.renderActionIcon(i),this.renderActionTitle(l,s)];return s?f("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",title:l??void 0,"aria-label":l??void 0},a):f("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",role:"button",title:l??void 0,"aria-label":l??void 0},a)}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:t}=this,i=e.dataset.group,s=t.get(i);s&&s.destroy(),t.delete(i)}_destroySortables(){const{_sortableMap:e,_sortableNodes:t}=this;e.forEach((e=>e&&e.destroy())),e.clear(),t.clear()}_moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}){const n=i["data-item"],o=e["data-item"],l=t["data-item"];this.viewModel.moveListItem(n,l,o,s)}_sortLayers(e){if(!e)return;const t=e.el["data-item"],i=e.toArray();t?p(t,i):u(this.view?.map?.layers,i)}_toggleSorting(e,t){const{_sortableMap:i,selectionEnabled:s}=this,n=i.get(t),o=e["data-item"],l=(t===N||o.childrenSortable&&b(o))&&s;if(n)n.option("disabled",!l);else if(l){const s=C.create(e,{dataIdAttr:k,group:{name:t,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${$}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!l,chosenClass:E.sortableChosen});i.set(t,s)}}_toggleAllSorting(){this._sortableNodes.forEach(((e,t)=>this._toggleSorting(e,t)))}_sortNodeCreated(e){const t=e.dataset.group;t&&(this._sortableNodes.set(t,e),this._toggleSorting(e,t))}_setVisibleItems(e){this.visibleItems=e.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).getItemAt(0)}_focusListItem(e){const{_focusSortUid:t}=this;if(!e||!t)return;const i=e["data-item"];i.layer?.uid===t&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e){this.addHandles(e.on("change",this.scheduleRender.bind(this)),R.actionSection),e.forEach((e=>this._renderOnActionChanges(e)))}_renderOnActionChanges(e){"toggle"!==e.type?"slider"!==e.type?this.addHandles(n((()=>[e?.className,e?.image,e?.id,e?.title,e?.visible]),(()=>this.scheduleRender()),o),R.actions):this.addHandles(n((()=>[e?.className,e?.id,e?.title,e?.visible,e?.value,e?.displayValueEnabled,e?.max,e?.min,e?.step]),(()=>this.scheduleRender()),o),R.actions):this.addHandles(n((()=>[e?.className,e?.image,e?.id,e?.title,e?.visible,e?.value]),(()=>this.scheduleRender()),o),R.actions)}_renderOnItemChanges(e){this.addHandles([n((()=>[e?.actionsOpen,e?.visible,e?.open,e?.updating,e?.connectionStatus,e?.publishing,e?.title,e?.visibleAtCurrentScale,e?.error,e?.visibilityMode,e?.panel,e?.panel?.title,e?.panel?.content,e?.panel?.className,e?.sortable,e?.childrenSortable]),(()=>this.scheduleRender()),l),n((()=>[e?.hidden,e?.error]),(()=>this._setVisibleItems(this.operationalItems))),e.actionsSections.on("change",(()=>this.scheduleRender())),e.children.on("change",(()=>this.scheduleRender()))],R.items),e.children.forEach((e=>this._renderOnItemChanges(e))),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e)))}_itemsChanged(e){this.removeHandles(R.items),this.removeHandles(R.actions),this.removeHandles(R.actionSection),e.forEach((e=>this._renderOnItemChanges(e))),this._tooltipReferenceMap.clear(),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="esri.widgets.LayerList.ListItemPanel"===e.declaredClass||"esri.support.Action.ActionButton"===e.declaredClass||"esri.support.Action.ActionToggle"===e.declaredClass?e.image:null;return{"background-image":t?`url("${t}")`:void 0}}_selectionKeydown(e){const t=["ArrowDown","ArrowUp"],s=i(e);if(!t.includes(s))return void this._toggleSelection(e);e.stopPropagation();const n=e.currentTarget,o=n["data-item"],{_sortableMap:l,selectedItems:r}=this,a=n.dataset.group,c=l.get(a);if(!c)return;const d=g(o,r),h=c.toArray(),m=e.target,u=h.indexOf(m.dataset[L]);if(-1!==u){if("ArrowDown"===s){const e=u+1;if(e>=h.length)return;d?(w(h,u,e),c.sort(h),this._sortLayers(c),this._focusSortUid=o.layer?.uid):(this._focusSortUid=o.layer?.uid,this.scheduleRender())}if("ArrowUp"===s){const e=u-1;if(e<=-1)return;d?(w(h,u,e),c.sort(h),this._sortLayers(c),this._focusSortUid=o.layer?.uid):(this._focusSortUid=o.layer?.uid,this.scheduleRender())}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.operationalItems.forEach((e=>U(e))),t.actionsOpen=s,e.stopPropagation()}_triggerPanel(e){const t=e.currentTarget["data-panel"];e.stopPropagation(),t&&!t.disabled&&(t.open=!t.open)}_triggerAction(e){const t=e.currentTarget,i=t["data-action"],s=t["data-item"];"toggle"===i.type&&(i.value=!i.value),this.triggerAction(i,s),e.stopPropagation()}_toggleVisibility(e){const t=e.currentTarget,i=t.getAttribute("data-parent-visibility"),s=t["data-item"];i===x.exclusive&&s.visible||(s.visible=!s.visible),e.stopPropagation()}_toggleChildrenClick(e){const t=e.currentTarget["data-item"];t.open=!t.open,e.stopPropagation()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=e.currentTarget["data-item"],n=g(s,i),{length:o}=i;if(!t)return o&&!(n&&1===o)?(i.removeAll(),void i.add(s)):void(n?i.remove?.(n):i.add(s));n?i.remove?.(n):i.add(s)}get test(){return{visibleItems:this.visibleItems}}};e([r()],j.prototype,"visibleItems",void 0),e([r()],j.prototype,"iconClass",void 0),e([r()],j.prototype,"icon",void 0),e([r()],j.prototype,"label",null),e([r()],j.prototype,"listItemCanGiveFunction",void 0),e([r()],j.prototype,"listItemCanReceiveFunction",void 0),e([r()],j.prototype,"listItemCreatedFunction",null),e([r(),I("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([r(),I("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([r()],j.prototype,"multipleSelectionEnabled",void 0),e([r()],j.prototype,"operationalItems",null),e([r()],j.prototype,"selectionEnabled",void 0),e([r()],j.prototype,"selectedItems",void 0),e([r()],j.prototype,"view",null),e([v("trigger-action"),r({type:h})],j.prototype,"viewModel",void 0),e([r()],j.prototype,"visibleElements",void 0),e([a("visibleElements")],j.prototype,"castVisibleElements",null),e([y()],j.prototype,"_toggleActionsOpen",null),e([y()],j.prototype,"_triggerPanel",null),e([y()],j.prototype,"_triggerAction",null),e([y()],j.prototype,"_toggleVisibility",null),e([y()],j.prototype,"_toggleChildrenClick",null),e([y()],j.prototype,"_toggleSelection",null),j=e([c("esri.widgets.LayerList")],j);const V=j;export{V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{isProjectedWKT as i}from"../../core/unitUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{isSupported as n,geodesicLengths as a}from"../../geometry/support/geodesicUtils.js";import{straightLineDensify as l}from"../../geometry/support/normalizeUtils.js";import{isValid as c,getInfo as m}from"../../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as p}from"../../geometry/support/webMercatorUtils.js";import u from"../../geometry/support/WKIDUnitConversion.js";import d from"../../geometry/SpatialReference.js";import f from"../../geometry/Polyline.js";import g from"../../geometry/Point.js";function h(e){const{wkid:t,wkt:r}=e;if(null!=t&&null!=u[t])return u.values[u[t]];if(null!=r){const e=r.lastIndexOf(",")+1,t=r.lastIndexOf("]]");return parseFloat(r.substring(e,t))}return 1}function w(e,t){const{x:r,y:i}="decimal-degrees"===e?p(t,!0):t;return[r,i]}function y({state:{paddedViewState:e},spatialReference:t,width:r}){return t.isWrappable&&e.worldScreenWidth<r}let j=class extends t{constructor(e){super(e),this.scaleComputedFrom=r(),this.view=null}get state(){return this.view?.ready&&"2d"===this.view?.type?"ready":"disabled"}getScaleBarProperties(e,t){if("disabled"===this.state||isNaN(e)||!t||null==this.view)return null;const r=this._getDistanceInKm(this.view,this.scaleComputedFrom);if(null==r)return null;if("metric"===t)return this._getScaleBarProps(e,r,"metric");const i=r/1.609;return this._getScaleBarProps(e,i,"imperial")}_getLocationUnit(){const e=this.view,{spatialReference:t}=e,{isWebMercator:r,wkid:s,wkt:o}=t;return r||o?.includes("WGS_1984_Web_Mercator")?"decimal-degrees":c(t)&&(null!=s&&u[s]||null!=o&&i(o))?"linear-unit":"unknown"}_getDistanceInKm(e,t){const{state:r,spatialReference:i}=e,s=this._getLocationUnit();if("linear-unit"===s){const e=1e3;return r.extent.width*h(i)/e}const[o,c]=this._getScaleMeasuringPoints(e,t),m="decimal-degrees"===s||i.isGeographic&&!n(i)?d.WGS84:i,p=new f({paths:[[w(s,o),w(s,c)]],spatialReference:m}),u=l(p,10);let g;try{[g]=a([u],"kilometers")}catch{return null}return g}_getScaleMeasuringPoints(e,t){const{width:i,height:s,position:o,spatialReference:n}=e;if(y(e)){const e=m(n),{valid:t}=e;return[new g(t[0],0,n),new g(t[1],0,n)]}let a=t.y-o[1];a>s?a=s:a<0&&(a=0);const l=r(0,a),c=r(i,a);return[e.toMap(l),e.toMap(c)]}_getScaleBarProps(e,t,r){const i=this.view;let s=e*t/(y(i)?i.state.paddedViewState.worldScreenWidth:i.width),o="metric"===r?"kilometer":"mile";if(s<.1)if("mile"===o){s*=5280,o="foot"}else if("kilometer"===o){s*=1e3,o="meter"}let n=0;for(;s>=1;)s/=10,n++;const a=this._getConstraints(s);if(!a)return null;const{min:l,max:c}=a,m=c/s>=s/l?l:c;return{length:e*(m/s),value:10**n*m,unit:o}}_getConstraints(e){return e>.5?{min:.5,max:1}:e>.3?{min:.3,max:.5}:e>.2?{min:.2,max:.3}:e>.15?{min:.15,max:.2}:e>=.1?{min:.15,max:.1}:null}};e([s()],j.prototype,"scaleComputedFrom",void 0),e([s({readOnly:!0})],j.prototype,"state",null),e([s()],j.prototype,"view",void 0),j=e([o("esri.widgets.Scalebar.ScaleBarViewModel")],j);const S=j;export{S as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{convertUnit as s}from"../../core/unitUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{isSupported as n,geodesicLengths as a}from"../../geometry/support/geodesicUtils.js";import{straightLineDensify as c}from"../../geometry/support/normalizeUtils.js";import{isValid as l,getInfo as m}from"../../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as u}from"../../geometry/support/webMercatorUtils.js";import p from"../../geometry/support/WKIDUnitConversion.js";import d from"../../geometry/SpatialReference.js";import f from"../../geometry/Polyline.js";import h from"../../geometry/Point.js";function g(e,t){switch(t){case"metric":return e>100?{distance:s(e,"meters","kilometers"),unit:"kilometer"}:e>.1?{distance:e,unit:"meter"}:{distance:s(e,"meters","centimeters"),unit:"centimeter"};case"imperial":case"non-metric":return e>160.9344?{distance:s(e,"meters","miles"),unit:"mile"}:e>.03048?{distance:s(e,"meters","feet"),unit:"foot"}:{distance:s(e,"meters","inches"),unit:"inch"}}}function w(e){const{isWebMercator:t,wkt:r}=e;return t||(r?.includes("WGS_1984_Web_Mercator")??!1)}function y(e){const{wkid:t,wkt:r}=e;if(null!=t&&null!=p[t])return p.values[p[t]];if(null!=r){const e=r.lastIndexOf(",")+1,t=r.lastIndexOf("]]");return parseFloat(r.substring(e,t))}return 1}function j(e,t){const{x:r,y:s}=e?u(t,!0):t;return[r,s]}function S({state:{paddedViewState:e},spatialReference:t,width:r}){return t.isWrappable&&e.worldScreenWidth<r}let v=class extends t{constructor(e){super(e),this.scaleComputedFrom=r(),this.view=null}get state(){return this.view?.ready&&"2d"===this.view?.type?"ready":"disabled"}getScaleBarProperties(e,t){if("disabled"===this.state||isNaN(e)||!t||null==this.view)return null;const r=this._getDistanceInMeters(this.view,this.scaleComputedFrom);return null==r?null:this._getScaleBarProps(e,r,t)}_getDistanceInMeters(e,t){const{state:r,spatialReference:s}=e;if(!l(s))return null;const{isGeographic:i}=s,o=w(s);if(!i&&!o){return r.extent.width*y(s)}const[m,u]=this._getScaleMeasuringPoints(e,t),p=o||i&&!n(s)?d.WGS84:s,h=new f({paths:[[j(o,m),j(o,u)]],spatialReference:p}),g=c(h,10);let S;try{[S]=a([g],"meters")}catch{return null}return S}_getScaleMeasuringPoints(e,t){const{width:s,height:i,position:o,spatialReference:n}=e;if(S(e)){const e=m(n),{valid:t}=e;return[new h(t[0],0,n),new h(t[1],0,n)]}let a=t.y-o[1];a>i?a=i:a<0&&(a=0);const c=r(0,a),l=r(s,a);return[e.toMap(c),e.toMap(l)]}_getScaleBarProps(e,t,r){const s=this.view,i=g(e*t/(S(s)?s.state.paddedViewState.worldScreenWidth:s.width),r),{unit:o}=i;let n=i.distance,a=0;for(;n>=1;)n/=10,a++;const c=this._getConstraints(n);if(!c)return null;const{min:l,max:m}=c,u=m/n>=n/l?l:m;return{length:e*(u/n),value:10**a*u,unit:o}}_getConstraints(e){return e>.5?{min:.5,max:1}:e>.3?{min:.3,max:.5}:e>.2?{min:.2,max:.3}:e>.15?{min:.15,max:.2}:e>=.1?{min:.15,max:.1}:null}};e([i()],v.prototype,"scaleComputedFrom",void 0),e([i({readOnly:!0})],v.prototype,"state",null),e([i()],v.prototype,"view",void 0),v=e([o("esri.widgets.Scalebar.ScaleBarViewModel")],v);const x=v;export{x as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import i from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import"../../core/has.js";import s from"../../core/Handles.js";import{abortMaybe as o,destroyMaybe as n,mapOr as a,applySome as l,isSome as u}from"../../core/maybe.js";import{after as p,throwIfAborted as d}from"../../core/promiseUtils.js";import{watch as c,syncAndInitial as h}from"../../core/reactiveUtils.js";import{createScreenPointArray as m,createRenderScreenPointArray as f}from"../../core/screenUtils.js";import{convertTime as _,offsetDateUTC as v}from"../../core/timeUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as w}from"../../core/accessorSupport/decorators/subclass.js";import{c as g}from"../../chunks/vec3f64.js";import{longitudeToTimezone as T}from"../../views/3d/support/earthUtils.js";import{computeDirectionsOverTime as D}from"../../views/3d/support/sunUtils.js";import{ShadowCastVisualization as P}from"../../views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js";import b from"./DiscreteOptions.js";import{DurationMode as O}from"./DurationMode.js";import j from"./DurationOptions.js";import{ShadowCastState as z}from"./ShadowCastState.js";import{ShadowTooltipViewModel as U}from"./ShadowTooltipViewModel.js";import{ShadowVisualizationType as C}from"./ShadowVisualizationType.js";import V from"./ThresholdOptions.js";import{breadthFirstBinaryPartitioning as E}from"../support/traversalUtils.js";const S=[],A=g(),R=[],N=255,x=_(1,"hours","milliseconds"),M=500;let k=class extends i{constructor(e){super(e),this.view=null,this.tooltip=new U({getDuration:(e,t)=>this.getDuration(e,t)}),this.startTimeOfDay=_(10,"hours","milliseconds"),this.endTimeOfDay=_(16,"hours","milliseconds"),this.visualizationType=C.Threshold,this.thresholdOptions=new V,this.durationOptions=new j,this.discreteOptions=new b,this._running=!0,this._handles=new s,this._stopPreviewingTask=null,this._forcePreview=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,this.date=new Date}initialize(){this._handles.add([c((()=>({view:this.view,tooltipEnabled:this._tooltipEnabled})),(({view:e,tooltipEnabled:t})=>{this.tooltip.view=e,this.tooltip.enabled=t}),h),c((()=>this._forcePreviewDependencies),(()=>{o(this._stopPreviewingTask),this._forcePreview=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=r((async e=>{await p(M,e),d(e),this._forcePreview=!1})))}),h),c((()=>({renderer:this.renderer,parameters:this._visualizationParameters})),(e=>F(e.renderer,e.parameters)),h),c((()=>({renderer:this.renderer,parameters:{lightDirections:this._lightDirections}})),(e=>F(e.renderer,e.parameters)),h),c((()=>({renderer:this.renderer,parameters:{enabled:this._running}})),(e=>F(e.renderer,e.parameters)),h),c((()=>({renderer:this.renderer,parameters:{previewing:this._previewing}})),(e=>F(e.renderer,e.parameters)),h)])}destroy(){this.stop(),this._handles=n(this._handles),n(this.tooltip)}get state(){return null!=this.view&&this.view.ready&&null!=this._referencePosition?z.Ready:z.Disabled}set date(e){const t=new Date(e);t.setHours(0,0,0,0),this._set("date",t)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(e){this._utcOffset=e}get testData(){return{setAutoRestoreForcedPreviewEnabled:e=>{this._autoRestoreForcePreviewEnabled=e},setForcedPreview:e=>{this._forcePreview=e},isPreviewing:()=>this._previewing}}get _previewing(){const{view:e}=this;return null==e||null==e.allLayerViews||(this._forcePreview||!e.stationary||e.allLayerViews.some((e=>G(e)&&e.updating)))}get _utcOffsetAuto(){const e=this._referencePosition;return a(e,0,(e=>T(e[0],!1)))}get _dateUTCOffset(){let e=this.date;return e=v(e,-e.getTimezoneOffset(),"minutes"),e=v(e,-this.utcOffset,"hours"),e}get _startDateTimeUTC(){return v(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return v(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){return l(this.view,(e=>l(e.environmentManager,(e=>e.referencePositionWGS84Comparable))))}get _interval(){const e=this._duration>0?Math.floor(this._duration/N):N,t=this.discreteOptions.interval;switch(this.visualizationType){case C.Threshold:case C.Duration:return e;case C.Discrete:return t>0?t:e}}get _sampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){const{view:e}=this;if(null==e)return S;const t="global"===e.viewingMode?A:this._referencePosition;if(null==t)return S;const i=this._interval,r=D(this._startDateTimeUTC,this._endDateTimeUTC,i,t,e.state.viewingMode),s=r.length;R.length=0;const o=E(0,s,R),n=new Array(s);for(let a=0;a<s;++a)n[a]=r[o[a]];return n}get _tooltipEnabled(){return this.state===z.Ready&&this.visualizationType!==C.Discrete&&this._running&&!this._previewing}get _visualizationParameters(){if(!this._running)return null;switch(this.visualizationType){case C.Threshold:return this._thresholdVisualizationParameters;case C.Duration:return this._durationVisualizationParameters;case C.Discrete:return this._discreteVisualizationParameters}}get _thresholdVisualizationParameters(){const{value:e,color:i}=this.thresholdOptions,r=this._duration;return{visualization:P.Threshold,color:t.toUnitRGBA(i),threshold:r>0?e/this._duration:0}}get _durationVisualizationParameters(){const{color:e,mode:i}=this.durationOptions,r=this._duration,s=r>0&&i===O.Hourly?x/r:0;return{color:t.toUnitRGBA(e),visualization:P.Gradient,bandsEnabled:s>0,bandSize:s}}get _discreteVisualizationParameters(){return{color:t.toUnitRGBA(this.discreteOptions.color),visualization:P.Gradient,bandsEnabled:!1,bandSize:0}}get _forcePreviewDependencies(){const{view:e}=this;if(null==e)return null;const t=e.slicePlane,i=e.allLayerViews.toArray().filter(G),r=i.map((e=>e.layer)).filter(u),s=i.map((e=>e.visible)),o=r.map((e=>e.visible)),n=r.map((e=>e.opacity)),a=r.filter((e=>"definitionExpression"in e)).map((e=>e.definitionExpression)),l=i.filter((e=>"filter"in e)).map((e=>e.filter));return{slicePlane:t,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewVisibilities:s,layerVisibilities:o,layerOpacities:n,filters:l,definitionExpressions:a}}get renderer(){const{view:e}=this;if(null==e)return null;const t=e._stage;return null==t?null:t.renderer}start(){this._running=!0}stop(){this._running=!1}setRunning(e){this._running=e}async getDuration(e,t){const{view:i,renderer:r}=this;if(null==i||null==r)return 0;const s=i.state.camera.screenToRender(m(e.x,e.y),f()),o=r.readAccumulatedShadow(s),n=this._sampleCount;if(0===n)return 0;return o*n*(this._duration/n)}};function F(e,t){null!=e&&null!=t&&e.setParameters({shadowCastOptions:t})}function G(e){if(e.suspended)return!1;switch(e.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"graphics-3d":case"integrated-mesh-3d":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":return!0;case"base-dynamic-3d":case"dimension-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":default:return!1;case"group":return e.layerViews.toArray().some((e=>G(e)))}}e([y()],k.prototype,"state",null),e([y()],k.prototype,"view",void 0),e([y()],k.prototype,"tooltip",void 0),e([y({nonNullable:!0})],k.prototype,"date",null),e([y({nonNullable:!0})],k.prototype,"utcOffset",null),e([y({nonNullable:!0})],k.prototype,"startTimeOfDay",void 0),e([y({nonNullable:!0})],k.prototype,"endTimeOfDay",void 0),e([y({nonNullable:!0})],k.prototype,"visualizationType",void 0),e([y({type:V,nonNullable:!0})],k.prototype,"thresholdOptions",void 0),e([y({type:j,nonNullable:!0})],k.prototype,"durationOptions",void 0),e([y({type:b,nonNullable:!0})],k.prototype,"discreteOptions",void 0),e([y()],k.prototype,"_running",void 0),e([y()],k.prototype,"_handles",void 0),e([y()],k.prototype,"_stopPreviewingTask",void 0),e([y()],k.prototype,"_forcePreview",void 0),e([y()],k.prototype,"_autoRestoreForcePreviewEnabled",void 0),e([y()],k.prototype,"_previewing",null),e([y()],k.prototype,"_utcOffset",void 0),e([y()],k.prototype,"_utcOffsetAuto",null),e([y()],k.prototype,"_dateUTCOffset",null),e([y()],k.prototype,"_startDateTimeUTC",null),e([y()],k.prototype,"_endDateTimeUTC",null),e([y()],k.prototype,"_referencePosition",null),e([y()],k.prototype,"_interval",null),e([y()],k.prototype,"_sampleCount",null),e([y()],k.prototype,"_duration",null),e([y()],k.prototype,"_lightDirections",null),e([y()],k.prototype,"_tooltipEnabled",null),e([y()],k.prototype,"_visualizationParameters",null),e([y()],k.prototype,"_thresholdVisualizationParameters",null),e([y()],k.prototype,"_durationVisualizationParameters",null),e([y()],k.prototype,"_discreteVisualizationParameters",null),e([y()],k.prototype,"_forcePreviewDependencies",null),e([y()],k.prototype,"renderer",null),k=e([w("esri.widgets.ShadowCast.ShadowCastViewModel")],k);const B=k;export{B as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import i from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import"../../core/has.js";import s from"../../core/Handles.js";import{abortMaybe as o,destroyMaybe as n,applySome as a,isSome as l}from"../../core/maybe.js";import{after as u,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as d,syncAndInitial as c}from"../../core/reactiveUtils.js";import{createScreenPointArray as h,createRenderScreenPointArray as m}from"../../core/screenUtils.js";import{convertTime as f,offsetDateUTC as _}from"../../core/timeUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{c as w}from"../../chunks/vec3f64.js";import{longitudeToTimezone as g}from"../../views/3d/support/earthUtils.js";import{computeDirectionsOverTime as T}from"../../views/3d/support/sunUtils.js";import{ShadowCastVisualization as D}from"../../views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js";import P from"./DiscreteOptions.js";import{DurationMode as b}from"./DurationMode.js";import O from"./DurationOptions.js";import{ShadowCastState as j}from"./ShadowCastState.js";import{ShadowTooltipViewModel as z}from"./ShadowTooltipViewModel.js";import{ShadowVisualizationType as U}from"./ShadowVisualizationType.js";import C from"./ThresholdOptions.js";import{breadthFirstBinaryPartitioning as V}from"../support/traversalUtils.js";const E=[],S=w(),A=[],R=255,N=f(1,"hours","milliseconds"),x=500;let M=class extends i{constructor(e){super(e),this.view=null,this.tooltip=new z({getDuration:(e,t)=>this.getDuration(e,t)}),this.startTimeOfDay=f(10,"hours","milliseconds"),this.endTimeOfDay=f(16,"hours","milliseconds"),this.visualizationType=U.Threshold,this.thresholdOptions=new C,this.durationOptions=new O,this.discreteOptions=new P,this._running=!0,this._handles=new s,this._stopPreviewingTask=null,this._forcePreview=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,this.date=new Date}initialize(){this._handles.add([d((()=>({view:this.view,tooltipEnabled:this._tooltipEnabled})),(({view:e,tooltipEnabled:t})=>{this.tooltip.view=e,this.tooltip.enabled=t}),c),d((()=>this._forcePreviewDependencies),(()=>{o(this._stopPreviewingTask),this._forcePreview=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=r((async e=>{await u(x,e),p(e),this._forcePreview=!1})))}),c),d((()=>({renderer:this.renderer,parameters:this._visualizationParameters})),(e=>k(e.renderer,e.parameters)),c),d((()=>({renderer:this.renderer,parameters:{lightDirections:this._lightDirections}})),(e=>k(e.renderer,e.parameters)),c),d((()=>({renderer:this.renderer,parameters:{enabled:this._running}})),(e=>k(e.renderer,e.parameters)),c),d((()=>({renderer:this.renderer,parameters:{previewing:this._previewing}})),(e=>k(e.renderer,e.parameters)),c)])}destroy(){this.stop(),this._handles=n(this._handles),n(this.tooltip)}get state(){return null!=this.view&&this.view.ready&&null!=this._referencePosition?j.Ready:j.Disabled}set date(e){const t=new Date(e);t.setHours(0,0,0,0),this._set("date",t)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(e){this._utcOffset=e}get testData(){return{setAutoRestoreForcedPreviewEnabled:e=>{this._autoRestoreForcePreviewEnabled=e},setForcedPreview:e=>{this._forcePreview=e},isPreviewing:()=>this._previewing}}get _previewing(){const{view:e}=this;return null==e||null==e.allLayerViews||(this._forcePreview||!e.stationary||e.allLayerViews.some((e=>F(e)&&e.updating)))}get _utcOffsetAuto(){const e=this._referencePosition;return null!=e?g(e[0],!1):0}get _dateUTCOffset(){let e=this.date;return e=_(e,-e.getTimezoneOffset(),"minutes"),e=_(e,-this.utcOffset,"hours"),e}get _startDateTimeUTC(){return _(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return _(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){return a(this.view,(e=>a(e.environmentManager,(e=>e.referencePositionWGS84Comparable))))}get _interval(){const e=this._duration>0?Math.floor(this._duration/R):R,t=this.discreteOptions.interval;switch(this.visualizationType){case U.Threshold:case U.Duration:return e;case U.Discrete:return t>0?t:e}}get _sampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){const{view:e}=this;if(null==e)return E;const t="global"===e.viewingMode?S:this._referencePosition;if(null==t)return E;const i=this._interval,r=T(this._startDateTimeUTC,this._endDateTimeUTC,i,t,e.state.viewingMode),s=r.length;A.length=0;const o=V(0,s,A),n=new Array(s);for(let a=0;a<s;++a)n[a]=r[o[a]];return n}get _tooltipEnabled(){return this.state===j.Ready&&this.visualizationType!==U.Discrete&&this._running&&!this._previewing}get _visualizationParameters(){if(!this._running)return null;switch(this.visualizationType){case U.Threshold:return this._thresholdVisualizationParameters;case U.Duration:return this._durationVisualizationParameters;case U.Discrete:return this._discreteVisualizationParameters}}get _thresholdVisualizationParameters(){const{value:e,color:i}=this.thresholdOptions,r=this._duration;return{visualization:D.Threshold,color:t.toUnitRGBA(i),threshold:r>0?e/this._duration:0}}get _durationVisualizationParameters(){const{color:e,mode:i}=this.durationOptions,r=this._duration,s=r>0&&i===b.Hourly?N/r:0;return{color:t.toUnitRGBA(e),visualization:D.Gradient,bandsEnabled:s>0,bandSize:s}}get _discreteVisualizationParameters(){return{color:t.toUnitRGBA(this.discreteOptions.color),visualization:D.Gradient,bandsEnabled:!1,bandSize:0}}get _forcePreviewDependencies(){const{view:e}=this;if(null==e)return null;const t=e.slicePlane,i=e.allLayerViews.toArray().filter(F),r=i.map((e=>e.layer)).filter(l),s=i.map((e=>e.visible)),o=r.map((e=>e.visible)),n=r.map((e=>e.opacity)),a=r.filter((e=>"definitionExpression"in e)).map((e=>e.definitionExpression)),u=i.filter((e=>"filter"in e)).map((e=>e.filter));return{slicePlane:t,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewVisibilities:s,layerVisibilities:o,layerOpacities:n,filters:u,definitionExpressions:a}}get renderer(){const{view:e}=this;if(null==e)return null;const t=e._stage;return null==t?null:t.renderer}start(){this._running=!0}stop(){this._running=!1}setRunning(e){this._running=e}async getDuration(e,t){const{view:i,renderer:r}=this;if(null==i||null==r)return 0;const s=i.state.camera.screenToRender(h(e.x,e.y),m()),o=r.readAccumulatedShadow(s),n=this._sampleCount;if(0===n)return 0;return o*n*(this._duration/n)}};function k(e,t){null!=e&&null!=t&&e.setParameters({shadowCastOptions:t})}function F(e){if(e.suspended)return!1;switch(e.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"graphics-3d":case"integrated-mesh-3d":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":return!0;case"base-dynamic-3d":case"dimension-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":default:return!1;case"group":return e.layerViews.toArray().some((e=>F(e)))}}e([v()],M.prototype,"state",null),e([v()],M.prototype,"view",void 0),e([v()],M.prototype,"tooltip",void 0),e([v({nonNullable:!0})],M.prototype,"date",null),e([v({nonNullable:!0})],M.prototype,"utcOffset",null),e([v({nonNullable:!0})],M.prototype,"startTimeOfDay",void 0),e([v({nonNullable:!0})],M.prototype,"endTimeOfDay",void 0),e([v({nonNullable:!0})],M.prototype,"visualizationType",void 0),e([v({type:C,nonNullable:!0})],M.prototype,"thresholdOptions",void 0),e([v({type:O,nonNullable:!0})],M.prototype,"durationOptions",void 0),e([v({type:P,nonNullable:!0})],M.prototype,"discreteOptions",void 0),e([v()],M.prototype,"_running",void 0),e([v()],M.prototype,"_handles",void 0),e([v()],M.prototype,"_stopPreviewingTask",void 0),e([v()],M.prototype,"_forcePreview",void 0),e([v()],M.prototype,"_autoRestoreForcePreviewEnabled",void 0),e([v()],M.prototype,"_previewing",null),e([v()],M.prototype,"_utcOffset",void 0),e([v()],M.prototype,"_utcOffsetAuto",null),e([v()],M.prototype,"_dateUTCOffset",null),e([v()],M.prototype,"_startDateTimeUTC",null),e([v()],M.prototype,"_endDateTimeUTC",null),e([v()],M.prototype,"_referencePosition",null),e([v()],M.prototype,"_interval",null),e([v()],M.prototype,"_sampleCount",null),e([v()],M.prototype,"_duration",null),e([v()],M.prototype,"_lightDirections",null),e([v()],M.prototype,"_tooltipEnabled",null),e([v()],M.prototype,"_visualizationParameters",null),e([v()],M.prototype,"_thresholdVisualizationParameters",null),e([v()],M.prototype,"_durationVisualizationParameters",null),e([v()],M.prototype,"_discreteVisualizationParameters",null),e([v()],M.prototype,"_forcePreviewDependencies",null),e([v()],M.prototype,"renderer",null),M=e([y("esri.widgets.ShadowCast.ShadowCastViewModel")],M);const G=M;export{G as default};