@arcgis/core 5.0.0-next.43 → 5.0.0-next.45

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 (329) hide show
  1. package/applications/Components/imageryUtils.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{f97a7cb367634353177d.js → 001a7a4cf6fe74432ed6.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{324d66962aeec17d3e28.js → 1e0e7cef7ef947894bbe.js} +1 -1
  5. package/assets/esri/core/workers/chunks/20ad34f9d45c64392022.js +1 -0
  6. package/assets/esri/core/workers/chunks/23396a6318edf9264c1f.js +1 -0
  7. package/assets/esri/core/workers/chunks/{ad891ac388fa6c1c9b94.js → 2b34a010f76e5f289868.js} +1 -1
  8. package/assets/esri/core/workers/chunks/2ef4c0092c59a98a5532.js +1 -0
  9. package/assets/esri/core/workers/chunks/35272810c2ed04eb403d.js +1 -0
  10. package/assets/esri/core/workers/chunks/{d1f4152b2b8d47cbf586.js → 72fbee59d5d909615408.js} +1 -1
  11. package/assets/esri/core/workers/chunks/75c66e38bdc1c786c599.js +1 -0
  12. package/assets/esri/core/workers/chunks/7d3c2a063598bdd015e2.js +1 -0
  13. package/assets/esri/core/workers/chunks/897ce6fc9cefb1e14a64.js +1 -0
  14. package/assets/esri/core/workers/chunks/992e9bbdf9d3787ddb0e.js +1 -0
  15. package/assets/esri/core/workers/chunks/a2442549c5daf3653eb4.js +1 -0
  16. package/assets/esri/core/workers/chunks/a7cd795042ebb8585906.js +1 -0
  17. package/assets/esri/core/workers/chunks/bf5f9da0837ed09729c6.js +316 -0
  18. package/assets/esri/core/workers/chunks/{385cfd3087f00dbd1146.js → ca1c65eb7f5900c60170.js} +1 -1
  19. package/assets/esri/core/workers/chunks/cddce67919e13e2f365e.js +1 -0
  20. package/assets/esri/core/workers/chunks/{7c08c0824ad354177787.js → d7878fba02814adaf19f.js} +1 -1
  21. package/assets/esri/core/workers/chunks/e6784251bbb8b71ead93.js +1 -0
  22. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  23. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  24. package/chunks/GaussianSplat.glsl.js +2 -2
  25. package/config.js +1 -1
  26. package/core/urlUtils.d.ts +1 -0
  27. package/core/workers/workerFactory.js +1 -1
  28. package/interfaces.d.ts +104 -9
  29. package/kernel.js +1 -1
  30. package/layers/ImageryTileLayer.js +1 -1
  31. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  32. package/layers/WCSLayer.js +1 -1
  33. package/layers/mixins/ArcGISImageService.js +1 -1
  34. package/layers/mixins/ImageryTileMixin.js +1 -1
  35. package/layers/mixins/RasterJobHandlerMixin.js +1 -1
  36. package/layers/ogc/wcsUtils.js +1 -1
  37. package/layers/raster/datasets/BaseRaster.js +5 -0
  38. package/layers/raster/datasets/CovJSONRaster.js +5 -0
  39. package/layers/raster/datasets/FunctionRaster.js +5 -0
  40. package/layers/raster/datasets/ImageAuxRaster.js +5 -0
  41. package/layers/raster/datasets/ImageServerRaster.js +5 -0
  42. package/layers/raster/datasets/InMemoryRaster.js +5 -0
  43. package/layers/raster/datasets/MRFRaster.js +5 -0
  44. package/layers/raster/datasets/RawBlockCache.js +5 -0
  45. package/layers/raster/datasets/TIFFRaster.js +5 -0
  46. package/layers/raster/datasets/WCSRaster.js +5 -0
  47. package/layers/raster/datasets/covJSONParser.js +5 -0
  48. package/layers/raster/datasets/multidimensionalUtils.js +5 -0
  49. package/layers/raster/datasets/pamParser.js +5 -0
  50. package/layers/raster/datasets/pixelReader.js +5 -0
  51. package/layers/raster/datasets/wcsCoverageParser.js +5 -0
  52. package/layers/raster/formats/Lerc.js +5 -0
  53. package/layers/raster/formats/Qb3.js +5 -0
  54. package/layers/raster/formats/RasterCodec.js +5 -0
  55. package/layers/raster/formats/TiffDecoder.js +5 -0
  56. package/layers/raster/functions/ArithmeticFunction.js +5 -0
  57. package/layers/{support/rasterFunctions → raster/functions}/ArithmeticFunctionArguments.js +1 -1
  58. package/layers/{support/rasterFunctions → raster/functions}/AspectFunction.js +1 -1
  59. package/layers/{support/rasterFunctions → raster/functions}/AspectFunctionArguments.js +1 -1
  60. package/layers/raster/functions/BandArithmeticFunction.js +5 -0
  61. package/layers/{support/rasterFunctions → raster/functions}/BandArithmeticFunctionArguments.js +1 -1
  62. package/layers/{support/rasterFunctions → raster/functions}/BaseFunctionArguments.js +1 -1
  63. package/layers/raster/functions/BaseRasterFunction.js +5 -0
  64. package/layers/{support/rasterFunctions → raster/functions}/ClipFunction.js +1 -1
  65. package/layers/{support/rasterFunctions → raster/functions}/ClipFunctionArguments.js +1 -1
  66. package/layers/raster/functions/ColormapFunction.js +5 -0
  67. package/layers/{support/rasterFunctions → raster/functions}/ColormapFunctionArguments.js +1 -1
  68. package/layers/raster/functions/ColormapToRGBFunction.js +5 -0
  69. package/layers/{support/rasterFunctions → raster/functions}/ColormapToRGBFunctionArguments.js +1 -1
  70. package/layers/raster/functions/CompositeBandFunction.js +5 -0
  71. package/layers/raster/functions/CompositeBandFunctionArguments.js +5 -0
  72. package/layers/raster/functions/ComputeChangeFunction.js +5 -0
  73. package/layers/{support/rasterFunctions → raster/functions}/ComputeChangeFunctionArguments.js +1 -1
  74. package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunction.js +1 -1
  75. package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunctionArguments.js +1 -1
  76. package/layers/raster/functions/ConvolutionFunction.js +5 -0
  77. package/layers/raster/functions/ConvolutionFunctionArguments.js +5 -0
  78. package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunction.js +1 -1
  79. package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunctionArguments.js +1 -1
  80. package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunction.js +1 -1
  81. package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunctionArguments.js +1 -1
  82. package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunction.js +1 -1
  83. package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunctionArguments.js +1 -1
  84. package/layers/raster/functions/HillshadeFunction.js +5 -0
  85. package/layers/{support/rasterFunctions → raster/functions}/HillshadeFunctionArguments.js +1 -1
  86. package/layers/raster/functions/LocalFunction.js +5 -0
  87. package/layers/{support/rasterFunctions → raster/functions}/LocalFunctionArguments.js +1 -1
  88. package/layers/{support/rasterFunctions → raster/functions}/MaskFunction.js +1 -1
  89. package/layers/{support/rasterFunctions → raster/functions}/MaskFunctionArguments.js +1 -1
  90. package/layers/{support/rasterFunctions → raster/functions}/NDVIFunction.js +1 -1
  91. package/layers/{support/rasterFunctions → raster/functions}/NDVIFunctionArguments.js +1 -1
  92. package/layers/raster/functions/RemapFunction.js +5 -0
  93. package/layers/{support/rasterFunctions → raster/functions}/RemapFunctionArguments.js +1 -1
  94. package/layers/raster/functions/ShadedReliefFunction.js +5 -0
  95. package/layers/{support/rasterFunctions → raster/functions}/ShadedReliefFunctionArguments.js +1 -1
  96. package/layers/raster/functions/SlopeFunction.js +5 -0
  97. package/layers/{support/rasterFunctions → raster/functions}/SlopeFunctionArguments.js +1 -1
  98. package/layers/raster/functions/StatisticsFunction.js +5 -0
  99. package/layers/{support/rasterFunctions → raster/functions}/StatisticsFunctionArguments.js +1 -1
  100. package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunction.js +1 -1
  101. package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunctionArguments.js +1 -1
  102. package/layers/raster/functions/StretchFunction.js +5 -0
  103. package/layers/{support/rasterFunctions → raster/functions}/StretchFunctionArguments.js +1 -1
  104. package/layers/{support/rasterFunctions → raster/functions}/TableFunction.js +1 -1
  105. package/layers/{support/rasterFunctions → raster/functions}/TableFunctionArguments.js +1 -1
  106. package/layers/raster/functions/bandIndexUtils.js +5 -0
  107. package/layers/raster/functions/changeDetectionUtils.js +5 -0
  108. package/layers/raster/functions/clipUtils.js +5 -0
  109. package/layers/raster/functions/conversionUtils.js +5 -0
  110. package/layers/raster/functions/convolutionUtils.js +5 -0
  111. package/layers/raster/functions/creators/createDataManagementFunctions.js +5 -0
  112. package/layers/raster/functions/creators/utils.js +5 -0
  113. package/layers/raster/functions/focalStatUtils.js +5 -0
  114. package/layers/raster/functions/localUtils.js +5 -0
  115. package/layers/raster/functions/pixelTransformUtils.js +5 -0
  116. package/layers/raster/functions/pixelUtils.js +5 -0
  117. package/layers/raster/functions/stretchUtils.js +5 -0
  118. package/layers/raster/functions/surfaceUtils.js +5 -0
  119. package/layers/raster/functions/vectorFieldUtils.js +5 -0
  120. package/layers/raster/transforms/BaseRasterTransform.js +5 -0
  121. package/layers/{support/rasterTransforms → raster/transforms}/GCSShiftTransform.js +1 -1
  122. package/layers/{support/rasterTransforms → raster/transforms}/IdentityTransform.js +1 -1
  123. package/layers/{support/rasterTransforms → raster/transforms}/PolynomialTransform.js +1 -1
  124. package/layers/save/imageryUtils.js +1 -1
  125. package/layers/support/PixelBlock.js +1 -1
  126. package/layers/support/RasterWorker.js +1 -1
  127. package/layers/support/imageryRendererUtils.js +1 -1
  128. package/layers/support/rasterFunctionUtils.js +1 -1
  129. package/package.json +2 -2
  130. package/renderers/VectorFieldRenderer.js +1 -1
  131. package/renderers/support/RasterSymbolizer.js +1 -1
  132. package/renderers/support/rasterRendererHelper.js +1 -1
  133. package/rest/locator/addressToLocations.js +1 -1
  134. package/rest/locator/addressesToLocations.js +1 -1
  135. package/rest/locator/suggestLocations.js +1 -1
  136. package/rest/networks/support/Association.js +1 -1
  137. package/rest/print.js +1 -1
  138. package/rest/support/LegendLayer.js +1 -1
  139. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  140. package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
  141. package/support/revision.js +1 -1
  142. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  143. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +1 -1
  144. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
  145. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
  146. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
  147. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  148. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  149. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  150. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  151. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  152. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  153. package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
  154. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  155. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  156. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  159. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  160. package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
  161. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  162. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  163. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  164. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  165. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  166. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  167. package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
  168. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  169. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  170. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  171. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  172. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  173. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  174. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  175. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  176. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  177. package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
  178. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  179. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  180. package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
  181. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  182. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  183. package/views/3d/webgl-engine/shaders/GaussianSplatColorTechnique.js +5 -0
  184. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +5 -0
  185. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  186. package/views/DOMContainer.js +1 -1
  187. package/views/GroundView.js +1 -1
  188. package/views/layers/ImageryLayerViewMixin.js +1 -1
  189. package/views/layers/ImageryTileLayerViewMixin.js +1 -1
  190. package/views/support/imageReprojection.js +1 -1
  191. package/widgets/BatchAttributeForm.js +1 -1
  192. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  193. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  194. package/widgets/CoordinateConversion.js +1 -1
  195. package/widgets/DirectLineMeasurement3D.js +1 -1
  196. package/widgets/DistanceMeasurement2D.js +1 -1
  197. package/widgets/Editor/EditorViewModel.js +1 -1
  198. package/widgets/Editor.js +1 -1
  199. package/widgets/ElevationProfile.js +1 -1
  200. package/widgets/Feature.js +1 -1
  201. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  202. package/widgets/FeatureForm.js +1 -1
  203. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  204. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  205. package/widgets/FeatureTable/Grid/Column.js +1 -1
  206. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  207. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  208. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  209. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  210. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  211. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  212. package/widgets/FeatureTable.js +1 -1
  213. package/widgets/FeatureTemplates.js +1 -1
  214. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  215. package/widgets/Legend.js +1 -1
  216. package/widgets/LineOfSight.js +1 -1
  217. package/widgets/Locate.js +1 -1
  218. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  219. package/widgets/OrientedImageryViewer/services/DepthImageService.js +1 -1
  220. package/widgets/PanoramicViewer/support/importUtils.js +1 -1
  221. package/widgets/Print/CustomTemplate.js +1 -1
  222. package/widgets/Print/PrintViewModel.js +1 -1
  223. package/widgets/Print/TemplateOptions.js +1 -1
  224. package/widgets/Print.js +1 -1
  225. package/widgets/ScaleBar.js +1 -1
  226. package/widgets/ScaleRangeSlider.js +1 -1
  227. package/widgets/Search/SearchResultRenderer.js +1 -1
  228. package/widgets/Search/SearchViewModel.js +1 -1
  229. package/widgets/Search/types.js +1 -1
  230. package/widgets/Search.js +1 -1
  231. package/widgets/ShadowCast.js +1 -1
  232. package/widgets/Sketch/SketchViewModel.js +1 -1
  233. package/widgets/Sketch.js +1 -1
  234. package/assets/esri/core/workers/chunks/1f6ead46b723630db897.js +0 -1
  235. package/assets/esri/core/workers/chunks/3a16347e17312556e02c.js +0 -1
  236. package/assets/esri/core/workers/chunks/478def691ae6763686f3.js +0 -1
  237. package/assets/esri/core/workers/chunks/4c4a55be41ba105c091c.js +0 -1
  238. package/assets/esri/core/workers/chunks/4cbf5a97b2b3c6553f6f.js +0 -1
  239. package/assets/esri/core/workers/chunks/646f58b69d2354f1ef27.js +0 -1
  240. package/assets/esri/core/workers/chunks/93d11075f65a5b6625ea.js +0 -1
  241. package/assets/esri/core/workers/chunks/96f798ee286b59396131.js +0 -316
  242. package/assets/esri/core/workers/chunks/9f2a8445a5848502c7e7.js +0 -1
  243. package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +0 -1
  244. package/assets/esri/core/workers/chunks/ba59568e748f0ba53b78.js +0 -1
  245. package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +0 -1
  246. package/assets/esri/core/workers/chunks/f93f0586ce10cb5d98b3.js +0 -1
  247. package/layers/support/rasterDatasets/BaseRaster.js +0 -5
  248. package/layers/support/rasterDatasets/CovJSONRaster.js +0 -5
  249. package/layers/support/rasterDatasets/FunctionRaster.js +0 -5
  250. package/layers/support/rasterDatasets/ImageAuxRaster.js +0 -5
  251. package/layers/support/rasterDatasets/ImageServerRaster.js +0 -5
  252. package/layers/support/rasterDatasets/InMemoryRaster.js +0 -5
  253. package/layers/support/rasterDatasets/MRFRaster.js +0 -5
  254. package/layers/support/rasterDatasets/RawBlockCache.js +0 -5
  255. package/layers/support/rasterDatasets/TIFFRaster.js +0 -5
  256. package/layers/support/rasterDatasets/WCSRaster.js +0 -5
  257. package/layers/support/rasterDatasets/covJSONParser.js +0 -5
  258. package/layers/support/rasterDatasets/multidimensionalUtils.js +0 -5
  259. package/layers/support/rasterDatasets/pamParser.js +0 -5
  260. package/layers/support/rasterDatasets/pixelReader.js +0 -5
  261. package/layers/support/rasterDatasets/wcsCoverageParser.js +0 -5
  262. package/layers/support/rasterFormats/Lerc.js +0 -5
  263. package/layers/support/rasterFormats/Qb3.js +0 -5
  264. package/layers/support/rasterFormats/RasterCodec.js +0 -5
  265. package/layers/support/rasterFormats/TiffDecoder.js +0 -5
  266. package/layers/support/rasterFunctions/ArithmeticFunction.js +0 -5
  267. package/layers/support/rasterFunctions/BandArithmeticFunction.js +0 -5
  268. package/layers/support/rasterFunctions/BaseRasterFunction.js +0 -5
  269. package/layers/support/rasterFunctions/ColormapFunction.js +0 -5
  270. package/layers/support/rasterFunctions/ColormapToRGBFunction.js +0 -5
  271. package/layers/support/rasterFunctions/CompositeBandFunction.js +0 -5
  272. package/layers/support/rasterFunctions/CompositeBandFunctionArguments.js +0 -5
  273. package/layers/support/rasterFunctions/ComputeChangeFunction.js +0 -5
  274. package/layers/support/rasterFunctions/ConvolutionFunction.js +0 -5
  275. package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +0 -5
  276. package/layers/support/rasterFunctions/HillshadeFunction.js +0 -5
  277. package/layers/support/rasterFunctions/LocalFunction.js +0 -5
  278. package/layers/support/rasterFunctions/RemapFunction.js +0 -5
  279. package/layers/support/rasterFunctions/ShadedReliefFunction.js +0 -5
  280. package/layers/support/rasterFunctions/SlopeFunction.js +0 -5
  281. package/layers/support/rasterFunctions/StatisticsFunction.js +0 -5
  282. package/layers/support/rasterFunctions/StretchFunction.js +0 -5
  283. package/layers/support/rasterFunctions/bandIndexUtils.js +0 -5
  284. package/layers/support/rasterFunctions/changeDetectionUtils.js +0 -5
  285. package/layers/support/rasterFunctions/clipUtils.js +0 -5
  286. package/layers/support/rasterFunctions/conversionUtils.js +0 -5
  287. package/layers/support/rasterFunctions/convolutionUtils.js +0 -5
  288. package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +0 -5
  289. package/layers/support/rasterFunctions/creators/utils.js +0 -5
  290. package/layers/support/rasterFunctions/focalStatUtils.js +0 -5
  291. package/layers/support/rasterFunctions/localUtils.js +0 -5
  292. package/layers/support/rasterFunctions/pixelTransformUtils.js +0 -5
  293. package/layers/support/rasterFunctions/pixelUtils.js +0 -5
  294. package/layers/support/rasterFunctions/stretchUtils.js +0 -5
  295. package/layers/support/rasterFunctions/surfaceUtils.js +0 -5
  296. package/layers/support/rasterFunctions/vectorFieldUtils.js +0 -5
  297. package/layers/support/rasterTransforms/BaseRasterTransform.js +0 -5
  298. /package/assets/esri/layers/{support/rasterFormats → raster/formats}/lerc-wasm.wasm +0 -0
  299. /package/assets/esri/layers/{support/rasterFormats → raster/formats}/qb3-wasm.wasm +0 -0
  300. /package/layers/{support/rasterDatasets → raster/datasets}/DBFParser.js +0 -0
  301. /package/layers/{support/rasterDatasets → raster/datasets}/EphemeralBlockCache.js +0 -0
  302. /package/layers/{support/rasterDatasets → raster/datasets}/RasterFactory.js +0 -0
  303. /package/layers/{support/rasterDatasets → raster/datasets}/byteStreamUtils.js +0 -0
  304. /package/layers/{support/rasterDatasets → raster/datasets}/datasetUtils.js +0 -0
  305. /package/layers/{support/rasterDatasets → raster/datasets}/multipartParser.js +0 -0
  306. /package/layers/{support/rasterDatasets → raster/datasets}/wcsCapabilitiesParser.js +0 -0
  307. /package/layers/{support/rasterDatasets → raster/datasets}/xmlUtilities.js +0 -0
  308. /package/layers/{support/rasterFormats → raster/formats}/ImageCanvasDecoder.js +0 -0
  309. /package/layers/{support/rasterFormats → raster/formats}/JpgPlus.js +0 -0
  310. /package/layers/{support/rasterFormats → raster/formats}/Lzw.js +0 -0
  311. /package/layers/{support/rasterFormats → raster/formats}/Raw.js +0 -0
  312. /package/layers/{support/rasterFormats → raster/formats}/pixelRangeUtils.js +0 -0
  313. /package/layers/{support/rasterFormats → raster/formats}/tiffTag.js +0 -0
  314. /package/layers/{support/rasterFormats → raster/formats}/utils.js +0 -0
  315. /package/layers/{support/rasterFunctions → raster/functions}/colormaps.js +0 -0
  316. /package/layers/{support/rasterFunctions → raster/functions}/creators/createAppearenceFunctions.js +0 -0
  317. /package/layers/{support/rasterFunctions → raster/functions}/creators/createBandIndexFunctions.js +0 -0
  318. /package/layers/{support/rasterFunctions → raster/functions}/creators/createChangeFunctions.js +0 -0
  319. /package/layers/{support/rasterFunctions → raster/functions}/creators/createConversionFunctions.js +0 -0
  320. /package/layers/{support/rasterFunctions → raster/functions}/creators/createLocalFunctions.js +0 -0
  321. /package/layers/{support/rasterFunctions → raster/functions}/creators/createMultiRasterAnalysisFunctions.js +0 -0
  322. /package/layers/{support/rasterFunctions → raster/functions}/creators/createStatisticsFunctions.js +0 -0
  323. /package/layers/{support/rasterFunctions → raster/functions}/creators/createSurfaceFunctions.js +0 -0
  324. /package/layers/{support/rasterFunctions → raster/functions}/customBandIndexUtils.js +0 -0
  325. /package/layers/{support/rasterFunctions → raster/functions}/mirror.js +0 -0
  326. /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionHelper.js +0 -0
  327. /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionSchema.js +0 -0
  328. /package/layers/{support/rasterFunctions → raster/functions}/rasterProjectionHelper.js +0 -0
  329. /package/layers/{support/rasterTransforms → raster/transforms}/utils.js +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as s,filterInPlace as n}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{getOrCreateMapValue as r}from"../../../../../core/MapUtils.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import a from"../../../../../core/PooledArray.js";import{nullUid as i}from"../../../../../core/uid.js";import{property as l,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{assert as d}from"../../lib/Util.js";import{BufferRange as u,mergeAdjacentRanges as f}from"./BufferRange.js";import{Instance as h}from"./Instance.js";import{PerBaseInstanceData as m}from"./PerBaseInstanceData.js";import{PerBufferData as p,getTargetBuffer as g,hasVao as y}from"./PerBufferData.js";import{PerOriginData as v}from"./PerOriginData.js";import{VaoWriter as _}from"./VaoWriter.js";let B=class extends t{constructor(e){super(e),this._vaoWriter=null,this._useMetalWorkaround=!1,this._hasOccludees=!1}destroy(){this.uninitializeRenderContext()}initializeRenderContext(e){this._useMetalWorkaround=e.renderContext.rctx.isAssumedMetalDriver,this._vaoWriter=new _(this.material,e.renderContext.rctx)}uninitializeRenderContext(){this._useMetalWorkaround=!1,this._vaoWriter=null}get hasOccludees(){return this._hasOccludees}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this.dataByBaseInstance.values())for(const t of e.dataByOrigin.values())if(t.buffers.some(e=>e.holes.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const n of this.dataByBaseInstance.values())for(const r of n.dataByOrigin.values()){const o=new Array;for(let t=0;t<r.buffers.length&&!e.done;){const n=r.buffers[t];n.holes.length<=1?++t:(n.instances.forEach(({geometry:e})=>o.push(e)),this._vaoWriter?.deleteBuffer(n),s(r.buffers,n,void 0,{last:t}),e.madeProgress())}if(o.length>0){const{baseInstanceData:e}=n;r.buffers.forEach(t=>this._applyAdds(e,t,o));const s=g(null!=e);for(;o.length>0;)r.buffers.push(this._applyAndRebuild(e,new p(s),o,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e;for(const t of this.dataByBaseInstance.values())for(const s of t.dataByOrigin.values())for(const t of s.buffers)t.updateHighlights(e)}_applyUpdates(e,t){const n=this._vaoWriter;if(null==n)return void e.clearUpdates();let r;const o=this._useMetalWorkaround?(e,t)=>{r??=new Map;let s=r.get(t);s||(s=[],r.set(t,s)),s.push(e)}:(e,t)=>n.updateInstance(e,t);for(const a of e.updates){if(t.done)return;const{renderGeometry:n,updateType:r}=a;s(e.pending.updates,a),t.madeProgress();const l=this.dataByBaseInstance.get(n.geometry.baseGeometry?.id??i),c=l?.dataByOrigin.get(n.localOrigin.id)?.findBuffer(n.id);if(null==c)return;const d=c.instances.get(n.id);6&r&&o(d,c),25&r&&(c.drawCommandsDirty=!0)}r&&n.updateInstancesMetal(r)}_computeDeltas(e,t){const s=new Map;for(const n of e){const e=n.localOrigin;if(null==e)continue;const t=n.geometry.baseGeometry,o=r(s,t??null,M);let a=o.get(e,null);null==a&&(a=new b(e.vec3,t),o.set(e,null,a)),a.changes.push(n)}for(const n of t){const e=n.localOrigin;if(null==e)continue;const t=n.geometry.baseGeometry,o=this.dataByBaseInstance.get(t?.id??i),a=o?.dataByOrigin.get(e.id)?.findBuffer(n.id);if(null==a)continue;const l=r(s,t??null,M);let c=l.get(e,a);null==c&&(c=new b(e.vec3,t),l.set(e,a,c)),c.changes.push(n)}return s}_applyAddsAndRemoves(e){const{_vaoWriter:t,dataByBaseInstance:n}=this;if(null==t)return void e.clearAddsAndRemoves();const o=this._computeDeltas(e.adds,e.removes);for(const[a,l]of o){const e=r(n,a?.id??i,()=>new m(t.createBaseInstanceData(a))),o=null!=a;for(const[n,a]of l.outerMap()){const i=a.get(null),c=i?.changes??[];l.delete(n,null);const u=r(e.dataByOrigin,n.id,()=>new v(n.vec3,o));for(const[r,o]of a){if(l.delete(n,r),null==r&&d(!1,"No VAO for removed geometries"),r.instances.size===o.changes.length){t.deleteBuffer(r),s(u.buffers,r),0===u.buffers.length&&0===c.length&&e.dataByOrigin.delete(n.id);continue}const a=r.numElements;switch(t.evaluateBufferAllocation(a,c,o.changes,r)){case 0:o.changes.forEach(({id:e})=>r.deleteInstance(e)),r.instances.forEach(({geometry:e})=>c.push(e)),t.deleteBuffer(r),s(u.buffers,r);break;case 1:this._applyAndRebuild(e.baseInstanceData,r,c,o);break;case 2:this._applyRemoves(r,o)}}if(c.length>0){const{baseInstanceData:t}=e,s=g(o);for(const e of u.buffers)this._applyAdds(t,e,c);for(;c.length>0;)u.buffers.push(this._applyAndRebuild(t,new p(s),c,null))}}0===e.dataByOrigin.size&&(e.dispose(),n.delete(e.id))}e.clearAddsAndRemoves()}_updateDrawCommands(){this._hasOccludees=!1;for(const e of this.dataByBaseInstance.values())for(const t of e.dataByOrigin.values())for(const e of t.buffers)e.updateIfDrawCommandsDirty(this.highlightOrderMap),this._hasOccludees||=e.hasOccludees}_applyAndRebuild(e,t,s,n){if(n)for(const c of n.changes)t.deleteInstance(c.id);const r=this._vaoWriter,o=r.maxElements(t.targetBuffer);let a=t.numElements;for(;s.length>0;){const e=s.pop(),n=r.elementCount(e.geometry);if(a+n>o&&a>0){s.push(e);break}a+=n;const i=new h(e,0,0,this.highlightOrderMap);d(null==t.instances.get(e.id)),t.addInstance(e.id,i)}t.resetInstanceSummary(),t.vao=r.reallocateBuffer(e,t,a),t.vaoEndElement=r.endElement(t);const i=r.rebuildInstances(a,t.writeableInstances.values(),t);t.updateInstances(),t.holes.clear();const l=t.holes.pushNew();return l.from=i,l.to=t.vaoEndElement,t.updateDrawCommands(this.highlightOrderMap),t}_applyRemoves(e,t){const{_vaoWriter:s}=this;if(0===t.changes.length||null==s)return;let n=1/0,r=-1/0;for(const o of t.changes){const t=o.id,s=e.instances.get(t);if(!s)continue;e.deleteInstance(t),this._useMetalWorkaround&&(n=Math.min(n,s.from),r=Math.max(r,s.to));const a=I.back();if(a){if(a.to===s.from){a.to=s.to;continue}if(a.from===s.to){a.from=s.from;continue}}const i=I.pushNew();i.from=s.from,i.to=s.to}f(I),this._useMetalWorkaround?s.clearHolesMetal(e.instances.values(),n,r,e):s.clearHoles(I,e),e.holes.pushArray(I.data,I.length),I.forAll((e,t)=>I.data[t]=null),I.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t,s){if(0===s.length||null==this._vaoWriter)return;if(!y(t))return void this._applyAndRebuild(e,t,s,null);const r=this._vaoWriter,o=t.numElements,a=s.reduce((e,{geometry:t})=>e+r.elementCount(t),0),i=Math.min(o+a,r.maxElements(t.targetBuffer));if(r.canGrow(t,i))return void this._applyAndRebuild(e,t,s,null);f(t.holes);const l=new Array;let c=1/0,d=-1/0;for(const{geometry:n}of s){const e=r.elementCount(n),s=w(t.holes,e);l.push(s),this._useMetalWorkaround&&null!=s&&(c=Math.min(s,c),d=Math.max(s+e,d))}const u=this._addInstances(s,t,l);if(this._useMetalWorkaround){for(const e of u);r.writeInstanceRangeMetal(d,c,t.instances.values(),t)}else r.writeRandomInstances(i,u,t);n(s,(e,t)=>null==l[t])}*_addInstances(e,t,s){const n=e.length,r=this._vaoWriter;for(let o=0;o<n;++o){const n=s[o];if(null==n)continue;const a=e[o],i=r.elementCount(a.geometry),l=new h(a,n,n+i,this.highlightOrderMap);d(null==t.instances.get(a.id)),t.addInstance(a.id,l),t.drawCommandsDirty=!0,yield l}}static prune(){_.prune()}get test(){}};e([l({constructOnly:!0})],B.prototype,"dataByBaseInstance",void 0),e([l({constructOnly:!0})],B.prototype,"material",void 0),e([l()],B.prototype,"highlightOrderMap",void 0),B=e([c("esri.views.3d.webgl-engine.materials.renderers.MergedBuffer")],B);class b{constructor(e,t){this.origin=e,this.baseInstance=t,this.changes=new Array}}function w(e,t){const s=e.find(e=>e.numElements>=t);if(null==s)return null;const n=s.from;return s.from+=t,s.from>=s.to&&e.removeUnordered(s),n}const I=new a({allocator:e=>e||new u,deallocator:null});function M(){return new o}export{B as MergedBuffer};
5
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as n,filterInPlace as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{getOrCreateMapValue as r}from"../../../../../core/MapUtils.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import a from"../../../../../core/PooledArray.js";import{nullUid as l}from"../../../../../core/uid.js";import{property as i,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{assert as c}from"../../lib/Util.js";import{BufferRange as d,mergeAdjacentRanges as f}from"./BufferRange.js";import{Instance as m}from"./Instance.js";import{PerBaseInstanceData as h}from"./PerBaseInstanceData.js";import{PerBufferData as p,hasVao as g}from"./PerBufferData.js";import{PerOriginData as y}from"./PerOriginData.js";import{VaoWriter as v}from"./VaoWriter.js";let x=class extends t{constructor(e){super(e),this._vaoWriter=null,this._useMetalWorkaround=!1,this._hasOccludees=!1}destroy(){this.uninitializeRenderContext()}initializeRenderContext(e){this._useMetalWorkaround=e.renderContext.rctx.isAssumedMetalDriver,this._vaoWriter=new v(this.material,e.renderContext.rctx)}uninitializeRenderContext(){this._useMetalWorkaround=!1,this._vaoWriter=null}get hasOccludees(){return this._hasOccludees}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this.dataByBaseInstance.values())for(const t of e.dataByOrigin.values())if(t.buffers.some(e=>e.holesVertex.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const s of this.dataByBaseInstance.values())for(const r of s.dataByOrigin.values()){const o=new Array;for(let t=0;t<r.buffers.length&&!e.done;){const s=r.buffers[t];s.holesVertex.length<=1?++t:(s.instances.forEach(({geometry:e})=>o.push(e)),this._vaoWriter?.deleteBuffer(s),n(r.buffers,s,void 0,{last:t}),e.madeProgress())}if(o.length>0){const{baseInstanceData:e}=s;r.buffers.forEach(t=>this._applyAdds(e,t,o));const n=null!=e;for(;o.length>0;)r.buffers.push(this._applyAndRebuild(e,new p(n),o,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e;for(const t of this.dataByBaseInstance.values())for(const n of t.dataByOrigin.values())for(const t of n.buffers)t.updateHighlights(e)}_applyUpdates(e,t){const s=this._vaoWriter;if(null==s)return void e.clearUpdates();let r;const o=this._useMetalWorkaround?(e,t)=>{r??=new Map;let n=r.get(t);n||(n=[],r.set(t,n)),n.push(e)}:(e,t)=>s.updateInstance(e,t);for(const a of e.updates){if(t.done)return;const{renderGeometry:s,updateType:r}=a;n(e.pending.updates,a),t.madeProgress();const i=this.dataByBaseInstance.get(s.geometry.baseGeometry?.id??l),u=i?.dataByOrigin.get(s.localOrigin.id)?.findBuffer(s.id);if(null==u)return;const c=u.instances.get(s.id);6&r&&o(c,u),25&r&&(u.drawCommandsDirty=!0)}r&&s.updateInstancesMetal(r)}_computeDeltas(e,t){const n=new Map;for(const s of e){const e=s.localOrigin;if(null==e)continue;const t=s.geometry.baseGeometry,o=r(n,t??null,M);let a=o.get(e,null);null==a&&(a=new _(e.vec3,t),o.set(e,null,a)),a.changes.push(s)}for(const s of t){const e=s.localOrigin;if(null==e)continue;const t=s.geometry.baseGeometry,o=this.dataByBaseInstance.get(t?.id??l),a=o?.dataByOrigin.get(e.id)?.findBuffer(s.id);if(null==a)continue;const i=r(n,t??null,M);let u=i.get(e,a);null==u&&(u=new _(e.vec3,t),i.set(e,a,u)),u.changes.push(s)}return n}_applyAddsAndRemoves(e){const{_vaoWriter:t,dataByBaseInstance:s}=this;if(null==t)return void e.clearAddsAndRemoves();const o=this._computeDeltas(e.adds,e.removes);for(const[a,i]of o){const e=r(s,a?.id??l,()=>new h(t.createBaseInstanceData(a)));for(const[s,o]of i.outerMap()){const a=o.get(null),l=a?.changes??[];i.delete(s,null);const u=r(e.dataByOrigin,s.id,()=>new y(s.vec3));for(const[r,d]of o){if(i.delete(s,r),null==r&&c(!1,"No VAO for removed geometries"),r.instances.size===d.changes.length){t.deleteBuffer(r),n(u.buffers,r),0===u.buffers.length&&0===l.length&&e.dataByOrigin.delete(s.id);continue}const o=r.numElementsVertex;switch(t.evaluateBufferAllocation(o,l,d.changes,r)){case 0:d.changes.forEach(({id:e})=>r.deleteInstance(e)),r.instances.forEach(({geometry:e})=>l.push(e)),t.deleteBuffer(r),n(u.buffers,r);break;case 1:this._applyAndRebuild(e.baseInstanceData,r,l,d);break;case 2:this._applyRemoves(r,d)}}if(l.length>0){const{baseInstanceData:t}=e,n=null!=t;for(const e of u.buffers)this._applyAdds(t,e,l);for(;l.length>0;)u.buffers.push(this._applyAndRebuild(t,new p(n),l,null))}}0===e.dataByOrigin.size&&(e.dispose(),s.delete(e.id))}e.clearAddsAndRemoves()}_updateDrawCommands(){this._hasOccludees=!1;for(const e of this.dataByBaseInstance.values())for(const t of e.dataByOrigin.values())for(const e of t.buffers)e.updateIfDrawCommandsDirty(this.highlightOrderMap),this._hasOccludees||=e.hasOccludees}_applyAndRebuild(e,t,n,s){if(s)for(const c of s.changes)t.deleteInstance(c.id);const r=this._vaoWriter,o=r.maxElements("geometry"),a=r.maxElements("texture");let l=t.numElementsVertex,i=t.numElementsTexture;for(;n.length>0;){const e=n.pop(),s=r.vertexElementCount(e.geometry),u=r.textureElementCount(e.geometry);if(l+s>o&&l>0||i+u>a&&i>0){n.push(e);break}l+=s,i+=u;const d=new m(e,0,0,0,0,this.highlightOrderMap);c(null==t.instances.get(e.id)),t.addInstance(e.id,d)}t.resetInstanceSummary(),t.vao=r.reallocateBuffer(e,t,l),t.textureBuffer=r.reallocateTextureBuffer(t,i),t.vaoEndElement=r.endVertexElement(t),t.textureEndElement=r.endTextureElement(t);const[u,d]=r.rebuildInstances(l,i,t.writeableInstances.values(),t);t.updateInstances(),t.holesVertex.clear();const f=t.holesVertex.pushNew(),h=t.holesTexture.pushNew();return f.from=u,f.to=t.vaoEndElement,h.from=d,h.to=t.textureEndElement,t.updateDrawCommands(this.highlightOrderMap),t}_applyRemoves(e,t){const{_vaoWriter:n}=this;if(0===t.changes.length||null==n)return;let s=1/0,r=-1/0,o=1/0,a=-1/0;for(const l of t.changes){const t=l.id,n=e.instances.get(t);if(!n)continue;const{vertexBufferRange:i,textureBufferRange:u}=n;e.deleteInstance(t),this._useMetalWorkaround&&(s=Math.min(s,i.from),r=Math.max(r,i.to),o=Math.min(o,u.from),a=Math.max(a,u.to));const c=w.back();if(c&&c.to===i.from)c.to=i.to;else if(c&&c.from===i.to)c.from=i.from;else{const e=w.pushNew();e.from=i.from,e.to=i.to}const d=b.back();if(d&&d.to===u.from)d.to=u.to;else if(d&&d.from===u.to)d.from=u.from;else{const e=b.pushNew();e.from=u.from,e.to=u.to}}f(w),f(b),this._useMetalWorkaround?n.clearHolesMetal(e.instances.values(),s,r,o,a,e):(n.clearVertexHoles(w,e),n.clearTextureHoles(b,e)),e.holesVertex.pushArray(w.data,w.length),e.holesTexture.pushArray(b.data,b.length),w.forAll((e,t)=>w.data[t]=null),w.clear(),b.forAll((e,t)=>w.data[t]=null),b.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t,n){if(0===n.length||null==this._vaoWriter)return;if(!g(t))return void this._applyAndRebuild(e,t,n,null);const r=this._vaoWriter,o=t.numElementsVertex,a=n.reduce((e,{geometry:t})=>e+r.vertexElementCount(t),0),l=Math.min(o+a,r.maxElements("geometry")),i=t.numElementsTexture,u=n.reduce((e,{geometry:t})=>e+r.textureElementCount(t),0),c=Math.min(i+u,r.maxElements("texture"));if(r.canGrow(t,l,c))return void this._applyAndRebuild(e,t,n,null);f(t.holesVertex),f(t.holesTexture);const d=new Array,m=new Array;let h=1/0,p=-1/0,y=1/0,v=-1/0;for(const{geometry:s}of n){const e=r.vertexElementCount(s),n=r.textureElementCount(s),o=B(t.holesVertex,e),a=B(t.holesTexture,n);null!=o&&null!=a?(d.push(o),m.push(a),this._useMetalWorkaround&&(h=Math.min(h,o),p=Math.max(p,o+e),y=Math.min(y,a),v=Math.max(v,a+n))):(d.push(null),m.push(null))}const x=this._addInstances(n,t,d,m);if(this._useMetalWorkaround){for(const e of x);r.writeInstanceRangeMetal(p,h,v,y,t.instances.values(),t)}else r.writeRandomInstances(l,c,x,t);s(n,(e,t)=>null==d[t]||null==m[t])}*_addInstances(e,t,n,s){const r=e.length,o=this._vaoWriter;for(let a=0;a<r;++a){const r=n[a],l=s[a];if(null==r||null==l)continue;const i=e[a],u=o.vertexElementCount(i.geometry),d=o.textureElementCount(i.geometry),f=new m(i,r,r+u,l,l+d,this.highlightOrderMap);c(null==t.instances.get(i.id)),t.addInstance(i.id,f),t.drawCommandsDirty=!0,yield f}}static prune(){v.prune()}get test(){}};e([i({constructOnly:!0})],x.prototype,"dataByBaseInstance",void 0),e([i({constructOnly:!0})],x.prototype,"material",void 0),e([i()],x.prototype,"highlightOrderMap",void 0),x=e([u("esri.views.3d.webgl-engine.materials.renderers.MergedBuffer")],x);class _{constructor(e,t){this.origin=e,this.baseInstance=t,this.changes=new Array}}function B(e,t){if(0===t)return 0;const n=e.find(e=>e.numElements>=t);if(null==n)return null;const s=n.from;return n.from+=t,n.numElements<=0&&e.removeUnordered(n),s}const w=new a({allocator:e=>e??new d,deallocator:null}),b=new a({allocator:e=>e??new d,deallocator:null});function M(){return new o}export{x as MergedBuffer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import t from"../../../../../core/PooledArray.js";import{BufferRange as e}from"./BufferRange.js";import{DrawCommand as n}from"./DrawCommand.js";import{InstancedCommandVAO as a}from"./InstancedCommandVAO.js";import{InstancedCommandVAOs as i}from"./InstancedCommandVAOs.js";import{defaultHighlightName as o}from"../../../../support/HighlightDefaults.js";class h{constructor(s){this.targetBuffer=s,this.vaoEndElement=0,this._numElements=0,this._instances=new Map,this.holes=new t({allocator:s=>s||new e,deallocator:null}),this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=d(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=d(),this.drawCommandsShadowHighlightRest=d(),this._instancedCommandVAOs=null}get numElements(){return this._numElements}get instances(){return this._instances}get writeableInstances(){return this._instances}get hasHighlights(){return this.highlightNames.size>0}get instancedCommandVAOs(){return this._instancedCommandVAOs}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateIfDrawCommandsDirty(s){if(this.drawCommandsDirty){this.resetInstanceSummary();for(const s of this.instances.values())this.updateDrawState(s);this.updateDrawCommands(s)}}addInstance(s,t){this.deleteInstance(s),this._instances.set(s,t),this._numElements+=t.numElements}deleteInstance(s){const t=this._instances.get(s);t&&(this._numElements-=t.numElements,this._instances.delete(s))}updateInstances(){let s=0;for(const t of this._instances.values())s+=t.numElements,this.updateDrawState(t);this._numElements=s}updateDrawState(s){if(s.isVisible){const{highlightName:t}=s;t&&this.highlightNames.add(t),s.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(s){this._updateDrawCommands(s),this._updateInstancedCommandVAOs()}_updateDrawCommands(s){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,0===this._instances.size)return;const{sortedInstances:t}=this;if(this._updateHighlightDrawCommands(s,t),!this.needsMultipleCommands){const s=this.drawCommandsDefault.pushNew(),t=this.holes.front();return this.vao&&1===this.holes.length&&t.to===this.vaoEndElement?(s.first=0,void(s.count=t.from)):(s.first=1/0,s.count=0,this._instances.forEach(t=>{s.first=Math.min(s.first,t.from),s.count=Math.max(s.count,t.to)}),void(s.count-=s.first))}for(const e of t)e.isVisible&&c(e.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,e)}get sortedInstances(){return Array.from(this._instances.values()).sort((s,t)=>s.from===t.from?s.to-t.to:s.from-t.from)}updateHighlights(s){this.highlightNames.clear();const t=this.sortedInstances;for(const e of t)e.updateHighlightOptions(s),e.isVisible&&e.highlightName&&this.highlightNames.add(e.highlightName);this._updateHighlightDrawCommands(s),this._updateInstancedCommandVAOs()}_updateHighlightDrawCommands(t,e=this.sortedInstances){const{drawCommandsHighlights:n,drawCommandsShadowHighlightRest:a}=this;n.clear(),a.clear();for(const i of e){if(i.updateHighlightOptions(t),!i.isVisible)continue;const{highlightName:e}=i;if(e){this.highlightNames.add(e);c(s(n,e,d),i)}e&&e===o||c(a,i)}}_updateInstancedCommandVAOs(){const s=this.vao;if("geometry"===this.targetBuffer||null==s)return;this._instancedCommandVAOs??=new i;const t=this._instancedCommandVAOs,e=t.commandVAOs.copy();t.clear();const n=t.commandVAOs,o=(t,i)=>{for(const o of t){const{first:t,count:h}=o,m=n.get(t,h)??e.pop(t,h)??new a(s.shallowCloneWithBaseInstances(new Map([["instances",o.first]])),o.count);n.set(t,h,m),i.push(m)}};o(this.drawCommandsDefault,t.drawCommandsDefault);for(const[a,i]of this.drawCommandsHighlights){const s=new Array;o(i,s),t.drawCommandsHighlights.set(a,s)}o(this.drawCommandsOccludees,t.drawCommandsOccludees),o(this.drawCommandsShadowHighlightRest,t.drawCommandsShadowHighlightRest);for(const a of e.values())a.dispose();e.clear()}get needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}}function m(s){return null!=s.vao}function r(s){return s?"instances":"geometry"}function d(){return new t({allocator:s=>s||new n,deallocator:s=>s})}function c(s,t){const e=s.back();if(null==e){const e=s.pushNew();return e.first=t.from,void(e.count=t.numElements)}if(l(e,t)){const s=t.from-e.first+t.numElements;e.count=s}else{const e=s.pushNew();e.first=t.from,e.count=t.numElements}}function l(s,t){return s.first+s.count>=t.from}export{h as PerBufferData,r as getTargetBuffer,m as hasVao};
5
+ import{getOrCreateMapValue as t}from"../../../../../core/MapUtils.js";import e from"../../../../../core/PooledArray.js";import{BufferRange as s}from"./BufferRange.js";import{DrawCommand as n}from"./DrawCommand.js";import{InstancedCommandVAO as a}from"./InstancedCommandVAO.js";import{InstancedCommandVAOs as i}from"./InstancedCommandVAOs.js";import{defaultHighlightName as r}from"../../../../support/HighlightDefaults.js";class o{constructor(t){this.isInstanced=t,this.vao=null,this.textureBuffer=null,this.vaoEndElement=0,this.textureEndElement=0,this._numElementsVertex=0,this._numElementsTexture=0,this._instances=new Map,this.holesVertex=new e({allocator:t=>t??new s,deallocator:null}),this.holesTexture=new e({allocator:t=>t??new s,deallocator:null}),this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=m(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=m(),this.drawCommandsShadowHighlightRest=m(),this._instancedCommandVAOs=null}dispose(){this.isInstanced?(this.vao?.buffer("geometry")?.dispose(),this.vao?.disposeVAOOnly(),this.instancedCommandVAOs?.dispose()):this.vao?.dispose(),this.textureBuffer?.dispose()}get numElementsVertex(){return this._numElementsVertex}get numElementsTexture(){return this._numElementsTexture}get instances(){return this._instances}get writeableInstances(){return this._instances}get hasHighlights(){return this.highlightNames.size>0}get instancedCommandVAOs(){return this._instancedCommandVAOs}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateIfDrawCommandsDirty(t){if(this.drawCommandsDirty){this.resetInstanceSummary();for(const t of this.instances.values())this.updateDrawState(t);this.updateDrawCommands(t)}}addInstance(t,e){this.deleteInstance(t),this._instances.set(t,e),this._numElementsVertex+=e.vertexBufferRange.numElements,this._numElementsTexture+=e.textureBufferRange.numElements}deleteInstance(t){const e=this._instances.get(t);e&&(this._numElementsVertex-=e.vertexBufferRange.numElements,this._numElementsTexture-=e.textureBufferRange.numElements,this._instances.delete(t))}updateInstances(){let t=0,e=0;for(const s of this._instances.values())t+=s.vertexBufferRange.numElements,e+=s.textureBufferRange.numElements,this.updateDrawState(s);this._numElementsVertex=t,this._numElementsTexture=e}updateDrawState(t){if(t.isVisible){const{highlightName:e}=t;e&&this.highlightNames.add(e),t.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(t){this._updateDrawCommands(t),this._updateInstancedCommandVAOs()}_updateDrawCommands(t){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,0===this._instances.size)return;const{sortedInstances:e}=this;if(this._updateHighlightDrawCommands(t,e),!this.needsMultipleCommands){const t=this.drawCommandsDefault.pushNew(),e=this.holesVertex.front();return this.vao&&1===this.holesVertex.length&&e.to===this.vaoEndElement?(t.first=0,void(t.count=e.from)):(t.first=1/0,t.count=0,this._instances.forEach(e=>{t.first=Math.min(t.first,e.vertexBufferRange.from),t.count=Math.max(t.count,e.vertexBufferRange.to)}),void(t.count-=t.first))}for(const s of e)s.isVisible&&d(s.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,s)}get sortedInstances(){return Array.from(this._instances.values()).sort(({vertexBufferRange:t},{vertexBufferRange:e})=>t.from===e.from?t.to-e.to:t.from-e.from)}updateHighlights(t){this.highlightNames.clear();const e=this.sortedInstances;for(const s of e)s.updateHighlightOptions(t),s.isVisible&&s.highlightName&&this.highlightNames.add(s.highlightName);this._updateHighlightDrawCommands(t,e),this._updateInstancedCommandVAOs()}_updateHighlightDrawCommands(e,s){const{drawCommandsHighlights:n,drawCommandsShadowHighlightRest:a}=this;n.clear(),a.clear();for(const i of s){if(i.updateHighlightOptions(e),!i.isVisible)continue;const{highlightName:s}=i;if(s){this.highlightNames.add(s);d(t(n,s,m),i)}s&&s===r||d(a,i)}}_updateInstancedCommandVAOs(){const t=this.vao;if(!this.isInstanced||null==t)return;this._instancedCommandVAOs??=new i;const e=this._instancedCommandVAOs,s=e.commandVAOs.copy();e.clear();const n=e.commandVAOs,r=(e,i)=>{for(const r of e){const{first:e,count:o}=r,h=n.get(e,o)??s.pop(e,o)??new a(t.shallowCloneWithBaseInstances(new Map([["geometry",r.first]])),r.count);n.set(e,o,h),i.push(h)}};r(this.drawCommandsDefault,e.drawCommandsDefault);for(const[a,i]of this.drawCommandsHighlights){const t=new Array;r(i,t),e.drawCommandsHighlights.set(a,t)}r(this.drawCommandsOccludees,e.drawCommandsOccludees),r(this.drawCommandsShadowHighlightRest,e.drawCommandsShadowHighlightRest);for(const a of s.values())a.dispose();s.clear()}get needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}}function h(t){return null!=t.vao}function m(){return new e({allocator:t=>t||new n,deallocator:t=>t})}function d(t,{vertexBufferRange:e}){const s=t.back();if(null==s){const s=t.pushNew();return s.first=e.from,void(s.count=e.numElements)}if(u(s,e)){const t=e.from-s.first+e.numElements;s.count=t}else{const s=t.pushNew();s.first=e.from,s.count=e.numElements}}function u(t,e){return t.first+t.count>=e.from}export{o as PerBufferData,h as hasVao};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- class s{constructor(s,e){this.origin=s,this.isInstanced=e,this.buffers=new Array}dispose(){if(this.isInstanced)for(const s of this.buffers)s.vao.buffer("instances")?.dispose(),s.vao.disposeVAOOnly(),s.instancedCommandVAOs?.dispose();else for(const s of this.buffers)s.vao.dispose();this.buffers.length=0}findBuffer(s){return this.buffers.find(e=>e.instances.has(s))}}export{s as PerOriginData};
5
+ class s{constructor(s){this.origin=s,this.buffers=new Array}dispose(){for(const s of this.buffers)s.dispose();this.buffers.length=0}findBuffer(s){return this.buffers.find(f=>f.instances.has(s))}}export{s as PerOriginData};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{property as i,subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{GLMaterials as r}from"../../lib/GLMaterials.js";import{DrawParameters as n}from"../DrawParameters.js";import{defaultHighlightName as o}from"../../../../support/HighlightDefaults.js";let h=class extends e{constructor(t){super(t),this._glMaterials=null,this._drawParameters=new n,this._highlightNames=new Set,this._produces=new Map}initialize(){this._updateProduces()}destroy(){this.uninitializeRenderContext()}get _hasHighlights(){return this._highlightNames.size>0}hasHighlight(t){return this._highlightNames.has(t)}get produces(){return this._produces}_updateProduces(){this.material.produces.forEach((t,e)=>{this._produces.set(e,e=>!(0===this.dataByBaseInstance.size||!(8!==e&&4!==e||this._hasHighlights))&&t(e))})}initializeRenderContext(t){this._glMaterials=new r(this.material,t.materials)}uninitializeRenderContext(){this._glMaterials=s(this._glMaterials)}acquireTechniques(t){if(!this.material.shouldRender(t))return null;const{output:e,bind:s}=t,i=this.material.produces.get(s.slot);if(!i?.(e))return null;const{highlight:a,slot:r}=s,n=4===e,h=8===e,l=h||n,d=a?.name;if(l&&(0===this._highlightNames.size||h&&d&&!this._highlightNames.has(d)))return null;const u=t=>h&&!!d&&!t.has(d),c=5===e,g=!(l||c);for(const m of this.dataByBaseInstance.values())for(const i of m.dataByOrigin.values())for(const a of i.buffers){if(u(a.highlightNames))continue;const i=n?a.drawCommandsHighlights.get(o):l?d?a.drawCommandsHighlights.get(d):a.drawCommandsHighlights.size>0:((c&&a.needsMultipleCommands?a.drawCommandsShadowHighlightRest:a.drawCommandsDefault)||null)?.length??!1,h=g&&a.drawCommandsOccludees||null;if(i||h?.length){const i=this._glMaterials.load(t.rctx,r,e),a=i?.beginSlot(s);if(a)return a}}return null}render(t,e){const{output:s,bind:i}=t,{highlight:a}=i,r=8===s,n=a?.name??"";if(r&&!a)return;const h=4===s,g=r||h,m=5===s,w=!(g||m),{rctx:_}=t;_.runAppleAmdDriverHelper();const C=_.bindTechnique(e,i,this.material.parameters);for(const b of this.dataByBaseInstance.values()){const{baseInstanceData:t}=b,s=null!=t,a=s?c:u,y=s?d:l;for(const l of b.dataByOrigin.values()){this._drawParameters.origin=l.origin;for(const s of l.buffers){if(r&&(!s.hasHighlights||!s.drawCommandsHighlights.has(n)))continue;if(h&&(!s.hasHighlights||!s.drawCommandsHighlights.has(o)))continue;const l=y(s),d=f(l,s.needsMultipleCommands,n,h,g,m),u=p(l,w);(d?.length||u?.length)&&(C.bindDraw(i,this.material.parameters,this._drawParameters),a(_,s,t,e,d,u,i))}}}}updateHighlights(){const{_highlightNames:t}=this;t.clear();for(const e of this.dataByBaseInstance.values())for(const s of e.dataByOrigin.values())for(const e of s.buffers)for(const s of e.highlightNames)t.add(s);this._updateProduces()}get test(){}};t([i({constructOnly:!0})],h.prototype,"material",void 0),t([i({constructOnly:!0})],h.prototype,"dataByBaseInstance",void 0),h=t([a("esri.views.3d.webgl-engine.materials.renderers.VaoRenderer")],h);const l=t=>t,d=t=>t.instancedCommandVAOs,u=(t,{vao:e},s,i,a,r,n)=>{i.ensureAttributeLocations(e),t.bindVAO(e),g(t,i,a,n,!1),g(t,i,r,n,!0)},c=(t,e,{baseCommand:s},i,a,r,n)=>{m(t,i,s,a,n,!1),m(t,i,s,r,n,!0)};function g(t,e,s,i,a){if(s?.length){t.setPipelineState(e.getPipeline(i,a));for(const i of s)t.drawArrays(e.primitiveType,i.first,i.count)}}function m(t,e,{first:s,count:i},a,r,n){if(a?.length){t.setPipelineState(e.getPipeline(r,n));for(const{vao:r,instanceCount:n}of a)e.ensureAttributeLocations(r),t.bindVAO(r),t.drawArraysInstanced(e.primitiveType,s,i,n)}}function f(t,e,s,i,a,r){const n=a&&!i?t.drawCommandsHighlights.get(s)??null:null;return i?t.drawCommandsHighlights.get(o):a?n:r&&e?t.drawCommandsShadowHighlightRest:t.drawCommandsDefault}function p(t,e){return e&&t.drawCommandsOccludees||null}export{h as VaoRenderer};
5
+ import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{property as i,subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{GLMaterials as r}from"../../lib/GLMaterials.js";import{DrawParameters as n}from"../DrawParameters.js";import{defaultHighlightName as o}from"../../../../support/HighlightDefaults.js";let h=class extends e{constructor(t){super(t),this._glMaterials=null,this._drawParameters=new n,this._highlightNames=new Set,this._produces=new Map}initialize(){this._updateProduces()}destroy(){this.uninitializeRenderContext()}get _hasHighlights(){return this._highlightNames.size>0}hasHighlight(t){return this._highlightNames.has(t)}get produces(){return this._produces}_updateProduces(){this.material.produces.forEach((t,e)=>{this._produces.set(e,e=>!(0===this.dataByBaseInstance.size||!(8!==e&&4!==e||this._hasHighlights))&&t(e))})}initializeRenderContext(t){this._glMaterials=new r(this.material,t.materials)}uninitializeRenderContext(){this._glMaterials=s(this._glMaterials)}acquireTechniques(t){if(!this.material.shouldRender(t))return null;const{output:e,bind:s}=t,i=this.material.produces.get(s.slot);if(!i?.(e))return null;const{highlight:a,slot:r}=s,n=4===e,h=8===e,l=h||n,d=a?.name;if(l&&(0===this._highlightNames.size||h&&d&&!this._highlightNames.has(d)))return null;const u=t=>h&&!!d&&!t.has(d),c=5===e,g=!(l||c);for(const m of this.dataByBaseInstance.values())for(const i of m.dataByOrigin.values())for(const a of i.buffers){if(u(a.highlightNames))continue;const i=n?a.drawCommandsHighlights.get(o):l?d?a.drawCommandsHighlights.get(d):a.drawCommandsHighlights.size>0:((c&&a.needsMultipleCommands?a.drawCommandsShadowHighlightRest:a.drawCommandsDefault)||null)?.length??!1,h=g&&a.drawCommandsOccludees||null;if(i||h?.length){const i=this._glMaterials.load(t.rctx,r,e),a=i?.beginSlot(s);if(a)return a}}return null}render(t,e){const{output:s,bind:i}=t,{highlight:a}=i,r=8===s,n=a?.name??"";if(r&&!a)return;const h=4===s,g=r||h,m=5===s,w=!(g||m),{rctx:_}=t;_.runAppleAmdDriverHelper();const C=_.bindTechnique(e,i,this.material.parameters);for(const b of this.dataByBaseInstance.values()){const{baseInstanceData:t}=b,s=null!=t,a=s?c:u,y=s?d:l;for(const l of b.dataByOrigin.values()){this._drawParameters.origin=l.origin;for(const s of l.buffers){if(r&&(!s.hasHighlights||!s.drawCommandsHighlights.has(n)))continue;if(h&&(!s.hasHighlights||!s.drawCommandsHighlights.has(o)))continue;this._drawParameters.textureBuffer=s.textureBuffer?.texture;const l=y(s),d=f(l,s.needsMultipleCommands,n,h,g,m),u=p(l,w);(d?.length||u?.length)&&(C.bindDraw(i,this.material.parameters,this._drawParameters),a(_,s,t,e,d,u,i)),this._drawParameters.textureBuffer=null}}}}updateHighlights(){const{_highlightNames:t}=this;t.clear();for(const e of this.dataByBaseInstance.values())for(const s of e.dataByOrigin.values())for(const e of s.buffers)for(const s of e.highlightNames)t.add(s);this._updateProduces()}get test(){}};t([i({constructOnly:!0})],h.prototype,"material",void 0),t([i({constructOnly:!0})],h.prototype,"dataByBaseInstance",void 0),h=t([a("esri.views.3d.webgl-engine.materials.renderers.VaoRenderer")],h);const l=t=>t,d=t=>t.instancedCommandVAOs,u=(t,{vao:e},s,i,a,r,n)=>{i.ensureAttributeLocations(e),t.bindVAO(e),g(t,i,a,n,!1),g(t,i,r,n,!0)},c=(t,e,{baseCommand:s},i,a,r,n)=>{m(t,i,s,a,n,!1),m(t,i,s,r,n,!0)};function g(t,e,s,i,a){if(s?.length){t.setPipelineState(e.getPipeline(i,a));for(const i of s)t.drawArrays(e.primitiveType,i.first,i.count)}}function m(t,e,{first:s,count:i},a,r,n){if(a?.length){t.setPipelineState(e.getPipeline(r,n));for(const{vao:r,instanceCount:n}of a)e.ensureAttributeLocations(r),t.bindVAO(r),t.drawArraysInstanced(e.primitiveType,s,i,n)}}function f(t,e,s,i,a,r){const n=a&&!i?t.drawCommandsHighlights.get(s)??null:null;return i?t.drawCommandsHighlights.get(o):a?n:r&&e?t.drawCommandsShadowHighlightRest:t.drawCommandsDefault}function p(t,e){return e&&t.drawCommandsOccludees||null}export{h as VaoRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{nextHighestPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{copy as e,invert as r,transpose as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as n}from"../../../support/buffer/glUtil.js";import{assert as o}from"../../lib/Util.js";import{VertexArrayObject as i}from"../../lib/VertexArrayObject.js";import{DrawCommand as f}from"./DrawCommand.js";import{BaseInstanceData as u}from"./PerBaseInstanceData.js";import{VertexBuffer as c}from"../../../../webgl/VertexBuffer.js";class l{constructor(t,e){this._rctx=e,this._bufferWriter=t.createBufferWriter(),this._vaoCache=e.getVaoCache(n(this._bufferWriter.layout))}maxElements(t){return Math.floor(b/this._targetStrideBytes(t))}_targetStrideBytes(t){return this._targetLayout(t)?.stride??0}_targetLayout(t){return"geometry"===t?this._bufferWriter.layout:this._bufferWriter.instanceLayout}endElement(t){return Math.floor((t.vao?.getByteLength(t.targetBuffer)??0)/this._targetStrideBytes(t.targetBuffer))}evaluateBufferAllocation(t,e,r,a){const s=this._targetStrideBytes(a.targetBuffer),n=e.reduce((t,{geometry:e})=>t+this.elementCount(e),0),o=r.reduce((t,{geometry:e})=>t+this.elementCount(e),0),i=Math.min((t+n-o)*s,b),f=a.vao?.buffer(a.targetBuffer),u=f?.sizeBytes??0;return i>h&&i<u/2?0:i>u?1:2}deleteBuffer(t){if("instances"===t.targetBuffer)return t.instancedCommandVAOs?.dispose(),t.vao?.buffer("instances")?.dispose(),t.vao?.disposeVAOOnly(),void(t.vao=null);this._vaoCache.deleteVao(t.vao)}createBaseInstanceData(t){const{_bufferWriter:e}=this;if(null==t||null==e.writeBaseInstance||null==e.elementCountBaseInstance)return null;const r=e.layout,a=e.elementCountBaseInstance(t.attributes),s=a*this._targetStrideBytes("geometry"),o=new c(this._rctx,n(r));o.setSize(Math.ceil(s));const i=B(s),l=r.createView(i.buffer);e.writeBaseInstance(t.attributes,l),o.setSubData(i,0,0,s);const m=new f;return m.first=0,m.count=a,new u(t,o,m)}_allocateInstanceBuffer(t){const e=this._bufferWriter.instanceLayout;o(null!=e,"Trying to allocate an instance buffer, but the BufferWriter does not support instancing");const r=t*this._targetStrideBytes("instances"),a=new c(this._rctx,n(e,1));return a.setSize(d(r)),a}_createInstancedVao(t,e){return new i(this._rctx,new Map([["geometry",t],["instances",e]]))}reallocateBuffer(t,e,r){if(this.deleteBuffer(e),null!=t){const e=t.baseInstanceBuffer,a=this._allocateInstanceBuffer(r);return this._createInstancedVao(e,a)}const a=r*this._targetStrideBytes("geometry");return this._vaoCache.newVao(d(a))}elementCount(t){return this._bufferWriter.elementCount(t.attributes)}canGrow(t,e){const{targetBuffer:r,vao:a}=t;if(null==a)return!0;const s=e*this._targetStrideBytes(r);return a.getByteLength(r)<d(b-h)&&s>a.getByteLength(r)}clearHoles(t,{vao:e,targetBuffer:r}){const a=this._targetStrideBytes(r),s=t.reduce((t,e)=>Math.max(t,e.numElements),0)*a,n=B(s);n.fill(0,0,s);const o=e.buffer(r);for(const i of t)o?.setSubData(n,i.from*a,0,i.numElements*a)}clearHolesMetal(t,e,r,{vao:a,targetBuffer:s}){const n=this._targetStrideBytes(s),o=(r-e)*n,i=B(o),f=this._targetLayout(s).createView(i.buffer);i.fill(0,0,o);for(const u of t){if(!(u.from>=e&&u.to<=r))continue;const t=u.from-e;this._writeGeometry(u.geometry,f,t)}a.buffer(s)?.setSubData(i,e*n,0,o)}writeRandomInstances(t,e,{vao:r,targetBuffer:a}){const s=this._targetStrideBytes(a),n=B(t*s),o=this._targetLayout(a).createView(n.buffer);let i=0,f=0,u=0;const c=r.buffer(a);for(const m of e){if(!(u===m.from)){const t=u-f;t>0&&c?.setSubData(n,f*s,0,t*s),f=m.from,i=0}this._writeGeometry(m.geometry,o,i),i+=m.numElements,u=m.to}const l=u-f;l>0&&c?.setSubData(n,f*s,0,l*s)}writeInstanceRangeMetal(t,e,r,{vao:a,targetBuffer:s}){const n=this._targetStrideBytes(s),o=t-e,i=o*n,f=B(i),u=this._targetLayout(s).createView(f.buffer);f.fill(0,0,i);for(const c of r){if(!(c.from>=e&&c.to<=t))continue;const r=c.from-e;this._writeGeometry(c.geometry,u,r)}o>0&&a.buffer(s)?.setSubData(f,e*n,0,i)}rebuildInstances(t,e,{vao:r,targetBuffer:a}){const s=this._targetStrideBytes(a),n=B(t*s),o=this._targetLayout(a).createView(n.buffer);let i=0;for(const f of e){this._writeGeometry(f.geometry,o,i);const t=i;i+=this.elementCount(f.geometry.geometry),f.from=t,f.to=i}return r?.buffer(a)?.setSubData(n,0,0,i*s),i}updateInstance(t,{vao:e,targetBuffer:r}){const{_bufferWriter:a}=this,s=this._targetStrideBytes(r),n=B(a.elementCount(t.geometry.geometry.attributes)*s),o=this._targetLayout(r).createView(n.buffer);this._writeGeometry(t.geometry,o,0),e.buffer(r)?.setSubData(n,t.from*s,0,t.numElements*s)}updateInstancesMetal(t){for(const[e,r]of t){let t=1/0,a=-1/0;for(const e of r)t=Math.min(t,e.from),a=Math.max(a,e.to);this.writeInstanceRangeMetal(a,t,e.instances.values(),e)}}_writeGeometry(t,s,n){const{_bufferWriter:o}=this;null!=o&&(e(m,t.transformation),m[12]-=t.localOrigin.vec3[0],m[13]-=t.localOrigin.vec3[1],m[14]-=t.localOrigin.vec3[2],r(g,m),a(g,g),o.write(m,g,t.geometry.attributes,t.geometry.olidColor,s,n))}static prune(){_=new Uint8Array(h)}}const m=s(),g=s(),h=262144,y=1024,b=16777216;let _=new Uint8Array(h);function B(t){return _.byteLength<t&&(_=new Uint8Array(t)),_}function d(e){return e<=y?y:e<h?t(e):Math.max(Math.min(Math.ceil(1.5*e/h)*h,b),e)}export{l as VaoWriter};
5
+ import{nextHighestPowerOfTwo as e}from"../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{copy as r,invert as o,transpose as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as n}from"../../../support/buffer/glUtil.js";import{VertexArrayObject as s}from"../../lib/VertexArrayObject.js";import{getMaxItemCount as f,getMaxByteSize as i}from"../../lib/TextureBackedBuffer/TextureBackedBufferUtils.js";import{TextureBuffer as m}from"../../lib/TextureBackedBuffer/TextureBuffer.js";import{DrawCommand as c}from"./DrawCommand.js";import{BaseInstanceData as l}from"./PerBaseInstanceData.js";import{VertexBuffer as g}from"../../../../webgl/VertexBuffer.js";class y{constructor(e,t){this._rctx=t,this._bufferWriter=e.createBufferWriter(),this._vaoCache=t.getVaoCache(n(this._bufferWriter.layout))}maxElements(e){if("texture"===e){const e=this._targetLayout("texture");return null==e?0:f(this._rctx,e)}return Math.floor(_/this._targetStrideBytes(e))}_targetStrideBytes(e){return this._targetLayout(e)?.stride??0}_targetLayout(e){return"geometry"===e?this._bufferWriter.layout:"baseInstance"===e?this._bufferWriter.baseInstanceLayout:this._bufferWriter.textureBufferLayout}endVertexElement(e){return Math.floor((e.vao?.getByteLength("geometry")??0)/this._targetStrideBytes("geometry"))}endTextureElement({textureBuffer:e}){return e?.itemCount??0}evaluateBufferAllocation(e,t,r,o){const a=this._targetStrideBytes("geometry"),u=t.reduce((e,{geometry:t})=>e+this.vertexElementCount(t),0),n=r.reduce((e,{geometry:t})=>e+this.vertexElementCount(t),0),s=Math.min((e+u-n)*a,_),f=o.vao?.buffer("geometry"),i=f?.sizeBytes??0;return s>b&&s<i/2?0:s>i?1:2}deleteBuffer(e){if(e.isInstanced)return e.instancedCommandVAOs?.dispose(),e.vao?.buffer("geometry")?.dispose(),e.vao?.disposeVAOOnly(),void(e.vao=null);this._vaoCache.deleteVao(e.vao),e.vaoEndElement=0}deleteTextureBuffer(e){e.textureBuffer=t(e.textureBuffer),e.textureEndElement=0}createBaseInstanceData(e){const{_bufferWriter:t}=this;if(null==e||null==t.baseInstanceLayout||null==t.writeBaseInstance||null==t.elementCountBaseInstance)return null;const r=this._targetLayout("baseInstance"),o=t.elementCountBaseInstance(e.attributes),a=o*r.stride,u=new g(this._rctx,n(r));u.setSize(Math.ceil(a));const s=w(a),f=r.createView(s.buffer);t.writeBaseInstance(e.attributes,f),u.setSubData(s,0,0,a);const i=new c;return i.first=0,i.count=o,new l(e,u,i)}_allocateInstanceBuffer(e){const t=this._bufferWriter.layout,r=e*this._targetStrideBytes("geometry"),o=new g(this._rctx,n(t,1));return o.setSize(S(r)),o}_createInstancedVao(e,t){return new s(this._rctx,new Map([["baseInstance",e],["geometry",t]]))}reallocateBuffer(e,t,r){if(this.deleteBuffer(t),null!=e){const t=e.baseInstanceBuffer,o=this._allocateInstanceBuffer(r);return this._createInstancedVao(t,o)}const o=r*this._targetStrideBytes("geometry");return this._vaoCache.newVao(S(o))}reallocateTextureBuffer(e,t){this.deleteTextureBuffer(e);const r=this._targetLayout("texture");return null!=r?new m(this._rctx,r,t):null}vertexElementCount(e){return this._bufferWriter.elementCount(e.attributes)}textureElementCount(e){return this._bufferWriter.elementCountTextureBuffer?.(e.attributes)??0}canGrow(e,t,r){const{vao:o,textureBuffer:a}=e;if(null==o)return!0;const u=t*this._targetStrideBytes("geometry"),n=o.getByteLength("geometry")<S(_-b)&&u>o.getByteLength("geometry"),s=this._targetLayout("texture");if(!n||null==s||null==a)return n;const f=r*s.byteStride,m=a.byteLength;return m<i(this._rctx,s)&&f>m}clearVertexHoles(e,{vao:t}){const r=this._targetStrideBytes("geometry"),o=e.reduce((e,t)=>Math.max(e,t.numElements),0)*r,a=w(o);a.fill(0,0,o);const u=t.buffer("geometry");for(const n of e)u?.setSubData(a,n.from*r,0,n.numElements*r)}clearTextureHoles(e,{textureBuffer:t}){const r=this._targetLayout("texture");if(null==t||null==r)return;const o=r.byteStride,a=e.reduce((e,t)=>Math.max(e,t.numElements),0)*o,u=w(a);u.fill(0,0,a);for(const n of e)t.setSubData(u.buffer,n.from,0,n.numElements)}clearHolesMetal(e,t,r,o,a,{vao:u,textureBuffer:n}){const s=this._targetLayout("geometry"),f=this._targetStrideBytes("geometry"),i=(r-t)*f,m=this._targetLayout("texture"),c=(a-o)*this._targetStrideBytes("texture"),l=i+c,g=i,y=w(l),h=s.createView(y.buffer),x=m?.createView(y.buffer,g);y.fill(0,0,l);for(const b of e){const{vertexBufferRange:e,textureBufferRange:a}=b;if(!(e.from>=t&&e.to<=r))continue;const u=e.from-t,n=a.from-o;this._writeGeometry(b.geometry,h,x,u,n,a)}u.buffer("geometry")?.setSubData(y,t*f,0,i),n?.setSubData(y.buffer,o,g,c)}writeRandomInstances(e,t,r,{vao:o,textureBuffer:a}){const u=this._targetStrideBytes("geometry"),n=e*u,s=t*this._targetStrideBytes("texture"),f=this._targetLayout("geometry"),i=this._targetLayout("texture"),m=n,c=w(n+s),l=f.createView(c.buffer),g=i?.createView(c.buffer,m);let y=0,h=0,x=0,b=0,B=0,_=0;const d=o.buffer("geometry");for(const w of r){const{vertexBufferRange:e,textureBufferRange:t}=w;if(!(b===e.from)){const t=b-x;t>0&&d?.setSubData(c,x*u,0,t*u),x=e.from,y=0}if(!(_===t.from)&&null!=a){const e=_-B;e>0&&a.setSubData(c.buffer,B,m,e),B=t.from,h=0}this._writeGeometry(w.geometry,l,g,y,h,t),y+=e.numElements,b=e.to,h+=t.numElements,_=t.to}const S=b-x;S>0&&d?.setSubData(c,x*u,0,S*u);const v=_-B;v>0&&null!=a&&a.setSubData(c.buffer,B,m,v)}writeInstanceRangeMetal(e,t,r,o,a,{vao:u,textureBuffer:n}){const s=this._targetLayout("geometry"),f=this._targetStrideBytes("geometry"),i=(e-t)*f,m=this._targetLayout("texture"),c=(r-o)*this._targetStrideBytes("texture"),l=i+c,g=i,y=w(l),h=s.createView(y.buffer),x=m?.createView(y.buffer,g);y.fill(0,0,l);for(const b of a){const{vertexBufferRange:r,textureBufferRange:a}=b;if(!(r.from>=t&&r.to<=e))continue;const u=r.from-t,n=a.from-o;this._writeGeometry(b.geometry,h,x,u,n,a)}i>0&&u.buffer("geometry")?.setSubData(y,t*f,0,i),c>0&&null!=n&&n.setSubData(y.buffer,o,g,c)}rebuildInstances(e,t,r,{vao:o,textureBuffer:a}){const u=this._targetStrideBytes("geometry"),n=e*u,s=n,f=w(n+t*this._targetStrideBytes("texture")),i=this._targetLayout("geometry").createView(f.buffer),m=this._targetLayout("texture")?.createView(f.buffer,s);let c=0,l=0;for(const g of r){const e=c,t=l;c+=this.vertexElementCount(g.geometry.geometry),l+=this.textureElementCount(g.geometry.geometry),g.vertexBufferRange.from=e,g.vertexBufferRange.to=c,g.textureBufferRange.from=t,g.textureBufferRange.to=l,this._writeGeometry(g.geometry,i,m,e,t,g.textureBufferRange)}return o?.buffer("geometry")?.setSubData(f,0,0,c*u),a?.setSubData(f.buffer,0,s,l),[c,l]}updateInstance(e,{vao:t,textureBuffer:r}){const o=this._targetStrideBytes("geometry"),a=this._targetStrideBytes("texture"),u=this.vertexElementCount(e.geometry.geometry)*o,n=u,s=w(u+this.textureElementCount(e.geometry.geometry)*a),f=this._targetLayout("geometry").createView(s.buffer),i=this._targetLayout("texture")?.createView(s.buffer,n);this._writeGeometry(e.geometry,f,i,0,0,e.textureBufferRange);const{vertexBufferRange:m,textureBufferRange:c}=e;t.buffer("geometry")?.setSubData(s,m.from*o,0,m.numElements*o),r?.setSubData(s.buffer,c.from,n,c.numElements)}updateInstancesMetal(e){for(const[t,r]of e){let e=1/0,o=-1/0,a=1/0,u=-1/0;for(const t of r){const{vertexBufferRange:r,textureBufferRange:n}=t;e=Math.min(e,r.from),o=Math.max(o,r.to),a=Math.min(a,n.from),u=Math.max(u,n.to)}this.writeInstanceRangeMetal(o,e,o,e,t.instances.values(),t)}}_writeGeometry(e,t,u,n,s,f){const{_bufferWriter:i}=this;null!=i&&(r(h,e.transformation),h[12]-=e.localOrigin.vec3[0],h[13]-=e.localOrigin.vec3[1],h[14]-=e.localOrigin.vec3[2],o(x,h),a(x,x),i.write(h,x,e.geometry.attributes,e.geometry.olidColor,t,n,f),null!=u&&i.writeTextureBuffer&&i.writeTextureBuffer(h,x,e.geometry.attributes,u,s))}static prune(){d=new Uint8Array(b)}}const h=u(),x=u(),b=262144,B=1024,_=16777216;let d=new Uint8Array(b);function w(e){return d.byteLength<e&&(d=new Uint8Array(e)),d}function S(t){return t<=B?B:t<b?e(t):Math.max(Math.min(Math.ceil(1.5*t/b)*b,_),t)}export{y as VaoWriter};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../chunks/GaussianSplat.glsl.js";import{makePipelineState as t,defaultColorWrite as a,separateBlendingParams as n}from"../../../webgl/renderState.js";let l=class extends o{constructor(){super(...arguments),this.shader=new s(i,()=>import("./GaussianSplat.glsl.js"))}initializePipeline(){return t({blending:n(773,773,1,1,32774,32774),depthTest:{func:515},colorWrite:a})}};l=e([r("esri.views.3d.webgl-engine.shaders.GaussianSplatColorTechnique")],l);export{l as GaussianSplatColorTechnique};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{a as t}from"../../../../chunks/GaussianSplat.glsl.js";import{makePipelineState as o,defaultColorWrite as a,separateBlendingParams as n}from"../../../webgl/renderState.js";let l=class extends i{constructor(){super(...arguments),this.shader=new s(t,()=>import("./GaussianSplat.glsl.js"))}initializePipeline(){return o({blending:n(773,773,772,1,32774,32774),depthTest:{func:515},colorWrite:a})}};l=e([r("esri.views.3d.webgl-engine.shaders.GaussianSplatDepthTechnique")],l);export{l as GaussianSplatDepthTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{ShaderTechniqueConfiguration as e,parameter as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class o extends e{constructor(t){super(),this.spherical=t,this.alphaCutoff=1,this.fadingEnabled=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.occlusionPass=!1,this.receiveAmbientOcclusion=!1,this.pbrMode=0,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!0}}function r(t){switch(t){case 2:return.005;case 0:return.05;default:return.01}}t([i({count:3})],o.prototype,"alphaCutoff",void 0),t([i()],o.prototype,"fadingEnabled",void 0),t([i()],o.prototype,"terrainDepthTest",void 0),t([i()],o.prototype,"cullAboveTerrain",void 0),t([i()],o.prototype,"receiveAmbientOcclusion",void 0);export{o as GaussianSplatTechniqueConfiguration,r as getGaussianSplatAlphaCutoffValue};
5
+ import{__decorate as t}from"tslib";import{ShaderTechniqueConfiguration as e,parameter as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class o extends e{constructor(t,e=!1,i=!1){super(),this.spherical=t,this.colorOnlyPass=e,this.dephtOnlyPass=i,this.alphaCutoff=1,this.fadingEnabled=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.occlusionPass=!1,this.receiveAmbientOcclusion=!1,this.pbrMode=0,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!0}}function s(t){switch(t){case 2:return.005;case 0:return.05;default:return.01}}t([i({count:3})],o.prototype,"alphaCutoff",void 0),t([i()],o.prototype,"fadingEnabled",void 0),t([i()],o.prototype,"terrainDepthTest",void 0),t([i()],o.prototype,"cullAboveTerrain",void 0),t([i()],o.prototype,"receiveAmbientOcclusion",void 0);export{o as GaussianSplatTechniqueConfiguration,s as getGaussianSplatAlphaCutoffValue};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{byId as e,reparent as i}from"../core/domUtils.js";import{on as s}from"../core/events.js";import{makeHandle as r}from"../core/handleUtils.js";import n from"../core/Logger.js";import{destroyMaybe as o,removeMaybe as a}from"../core/maybe.js";import{watch as h,initial as l,syncAndInitial as d,sync as u}from"../core/reactiveUtils.js";import{addFrameTask as c}from"../core/scheduling.js";import{property as p,subclass as m}from"../core/accessorSupport/decorators.js";import{Attribution as f}from"./Attribution.js";import _ from"./overlay/ViewOverlay.js";const y=[0,0];function g(t){const e=(t.ownerDocument||window.document).defaultView,i=t.getBoundingClientRect();return y[0]=i.left+(e?.pageXOffset??0),y[1]=i.top+(e?.pageYOffset??0),y}function v(t){t&&(t.textContent="",t.parentNode&&t.parentNode.removeChild(t))}const b=16,w=750,C=512,H=2,O=y=>{const O=y;let z=class extends O{constructor(...t){super(...t),this._freqInfo={freq:b,time:w},this._overlayRenderTaskHandle=null,this.aria={},this.height=0,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([h(()=>this.cursor,t=>{const{surface:e}=this;e&&e.setAttribute("data-cursor",t)}),h(()=>this.navigating,t=>{const{surface:e}=this;e&&e.setAttribute("data-navigating",t.toString())}),h(()=>[this.aria,this.surface],()=>this._updateAria(),{initial:!0})])}initialize(){const t=this;this.addHandles([h(()=>this.ui,(t,e)=>this._handleUIChange(t,e),l),t.on("focus",()=>this.notifyChange("focused")),t.on("blur",()=>this.notifyChange("focused"))])}destroy(){this.destroyed||(this.ui?.destroy(),this.container=null)}get container(){return this._get("container")??null}set container(t){const s=this._get("container"),r=e(t);if(r||"string"!=typeof t||n.getLogger(this).error("#container",`element with id '${t}' not found`),s===r)return;if(this._stopMeasuring(),this.removeHandles("container"),s&&(s.classList.remove("esri-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this._attribution=o(this._attribution),this.root&&(v(this.root),this._set("root",null)),this.userContent&&(i(this.userContent,s),v(this.userContent),this._set("userContent",null))),!r)return this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),void this._set("container",null);r.classList.add("esri-view");const l=document.createElement("div");l.className="esri-view-user-storage",i(r,l),r.appendChild(l),this._set("userContent",l);const p=document.createElement("div");p.className="esri-view-root",r.insertBefore(p,r.firstChild),this._set("root",p);const m=document.createElement("div");m.className="esri-view-surface",m.setAttribute("role","application"),m.tabIndex=0,p.appendChild(m),this._set("surface",m);const y=new _;p.appendChild(y.surface),this._set("overlay",y),this.addHandles(h(()=>y.needsRender,t=>{t&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=c({render:()=>this.overlay?.render()}):this._overlayRenderTaskHandle=a(this._overlayRenderTaskHandle)}),"container"),this.addHandles([h(()=>this.attributionVisible,t=>{t?!this._attribution&&t&&(this._attribution=new f({attributionItems:this.attributionItems}),p.appendChild(this._attribution.surface)):this._attribution=o(this._attribution)},d),h(()=>this.attributionItems,t=>{this._attribution&&(this._attribution.attributionItems=t)},u)],"container"),this.forceDOMReadyCycle(),this._set("container",r),this._startMeasuring()}get focused(){const t=document.activeElement===this.surface;return document.hasFocus()&&t}get size(){return[this.width,this.height]}set ui(t){const e=this._get("ui");e!==t&&e?.destroy(),this._set("ui",t)}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(t,e,i){const s=this.position;return t-=s?s[0]:0,e-=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}containerToPage(t,e,i){const s=this.position;return t+=s?s[0]:0,e+=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}_updateAria(){const{surface:t,aria:e}=this;t&&(t.ariaLabelledByElements=e?.labelledByElements??null,t.ariaDescribedByElements=e?.describedByElements??null,t.ariaLabel=e?.label??null,t.ariaDescription=e?.description??null)}_handleUIChange(t,e){this.removeHandles("ui"),e&&e!==t&&e.destroy(),t&&(t.view=this,this.addHandles(h(()=>this.root,e=>{if(e){const i=document.createElement("div");e.insertBefore(i,this._attribution?.surface??null),t.container=i}else t.container=null},l),"ui")),this._set("ui",t)}_stopMeasuring(){this.removeHandles("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const t=this._freqInfo;t.freq=b,t.time=w;const e=c({prepare:t=>{const i=this._measure(),s=this._freqInfo;if(s.time+=t.deltaTime,i&&(s.freq=b,this._get("resizing")||this._set("resizing",!0)),s.time<s.freq)return;s.time=0;const r=this._position();s.freq=r||i?b:Math.min(w,s.freq*H),!i&&s.freq>=C&&(e.pause(),this._get("resizing")&&this._set("resizing",!1))}}),i=new ResizeObserver(i=>{t.freq=b,t.time=w,e.resume()});null!=this.container&&i.observe(this.container);const n=r(()=>i.disconnect());this.addHandles([s(window,"resize",()=>{t.freq=b,t.time=w,e.resume()}),n,e],"measuring"),this._measure(),this._position()}_measure(){const t=this.container,e=t?t.clientWidth:0,i=t?t.clientHeight:0;if(0===e||0===i)return this.suspended||this._set("suspended",!0),!1;const s=this.width,r=this.height;if(e===s&&i===r)return this.suspended&&this._set("suspended",!1),!1;this._set("width",e),this._set("height",i),this.suspended&&this._set("suspended",!1);return this.emit("resize",{oldWidth:s,oldHeight:r,width:e,height:i}),!0}_position(){const t=this.container,e=this.position,i=t&&g(t);return!!i&&((!e||i[0]!==e[0]||i[1]!==e[1])&&(this._set("position",[i[0],i[1]]),!0))}forceDOMReadyCycle(){}};return t([p()],z.prototype,"aria",void 0),t([p()],z.prototype,"container",null),t([p({readOnly:!0})],z.prototype,"focused",null),t([p({readOnly:!0})],z.prototype,"height",void 0),t([p()],z.prototype,"messagesCommon",void 0),t([p({type:_})],z.prototype,"overlay",void 0),t([p({readOnly:!0})],z.prototype,"position",void 0),t([p({readOnly:!0})],z.prototype,"resizing",void 0),t([p({readOnly:!0})],z.prototype,"root",void 0),t([p({value:null,readOnly:!0})],z.prototype,"size",null),t([p({readOnly:!0})],z.prototype,"surface",void 0),t([p({readOnly:!0})],z.prototype,"suspended",void 0),t([p({nonNullable:!0})],z.prototype,"ui",null),t([p({readOnly:!0})],z.prototype,"userContent",void 0),t([p({readOnly:!0})],z.prototype,"width",void 0),t([p()],z.prototype,"widthBreakpoint",void 0),z=t([m("esri.views.DOMContainer")],z),z};export{O as DOMContainer};
5
+ import{__decorate as t}from"tslib";import{byId as e,reparent as i}from"../core/domUtils.js";import{on as s}from"../core/events.js";import{makeHandle as r}from"../core/handleUtils.js";import n from"../core/Logger.js";import{destroyMaybe as o,removeMaybe as a}from"../core/maybe.js";import{watch as h,initial as l,syncAndInitial as d,sync as u}from"../core/reactiveUtils.js";import{addFrameTask as c}from"../core/scheduling.js";import{property as p,subclass as m}from"../core/accessorSupport/decorators.js";import{Attribution as f}from"./Attribution.js";import _ from"./overlay/ViewOverlay.js";const y=[0,0];function g(t){const e=(t.ownerDocument||window.document).defaultView,i=t.getBoundingClientRect();return y[0]=i.left+(e?.pageXOffset??0),y[1]=i.top+(e?.pageYOffset??0),y}function v(t){t&&(t.textContent="",t.parentNode&&t.parentNode.removeChild(t))}const b=16,w=750,C=512,H=2,O=y=>{const O=y;let z=class extends O{constructor(...t){super(...t),this._freqInfo={freq:b,time:w},this._overlayRenderTaskHandle=null,this.aria={},this.height=0,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([h(()=>this.cursor,t=>{const{surface:e}=this;e&&e.setAttribute("data-cursor",t)}),h(()=>this.navigating,t=>{const{surface:e}=this;e&&e.setAttribute("data-navigating",t.toString())}),h(()=>[this.aria,this.surface],()=>this._updateAria(),{initial:!0})])}initialize(){const t=this;this.addHandles([h(()=>this.ui,(t,e)=>this._handleUIChange(t,e),l),t.on("focus",()=>this.notifyChange("focused")),t.on("blur",()=>this.notifyChange("focused"))])}destroy(){this.destroyed||(this.ui?.destroy(),this.container=null)}get container(){return this._get("container")??null}set container(t){const s=this._get("container"),r=e(t);if(r||"string"!=typeof t||n.getLogger(this).error("#container",`element with id '${t}' not found`),s===r)return;if(this._stopMeasuring(),this.removeHandles("container"),s&&(s.classList.remove("esri-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this._attribution=o(this._attribution),this.root&&(v(this.root),this._set("root",null)),this.userContent&&(i(this.userContent,s),v(this.userContent),this._set("userContent",null))),!r)return this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),void this._set("container",null);r.classList.add("esri-view");const l=document.createElement("div");l.className="esri-view-user-storage",i(r,l),r.appendChild(l),this._set("userContent",l);const p=document.createElement("div");p.className="esri-view-root",r.insertBefore(p,r.firstChild),this._set("root",p);const m=document.createElement("div");m.className="esri-view-surface",m.setAttribute("role","application"),m.tabIndex=0,p.appendChild(m),this._set("surface",m);const y=new _;p.appendChild(y.surface),this._set("overlay",y),this.addHandles(h(()=>y.needsRender,t=>{t&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=c({render:()=>this.overlay?.render()}):this._overlayRenderTaskHandle=a(this._overlayRenderTaskHandle)}),"container"),this.addHandles([h(()=>this.attributionVisible,t=>{t?!this._attribution&&t&&(this._attribution=new f({attributionItems:this.attributionItems}),p.appendChild(this._attribution.surface)):this._attribution=o(this._attribution)},d),h(()=>this.attributionItems,t=>{this._attribution&&(this._attribution.attributionItems=t)},u)],"container"),this.forceDOMReadyCycle(),this._set("container",r),this._startMeasuring()}get focused(){const t=document.activeElement===this.surface;return document.hasFocus()&&t}get size(){return[this.width,this.height]}get ui(){return this._get("ui")}set ui(t){const e=this._get("ui");e!==t&&e?.destroy(),this._set("ui",t)}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(t,e,i){const s=this.position;return t-=s?s[0]:0,e-=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}containerToPage(t,e,i){const s=this.position;return t+=s?s[0]:0,e+=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}_updateAria(){const{surface:t,aria:e}=this;t&&(t.ariaLabelledByElements=e?.labelledByElements??null,t.ariaDescribedByElements=e?.describedByElements??null,t.ariaLabel=e?.label??null,t.ariaDescription=e?.description??null)}_handleUIChange(t,e){this.removeHandles("ui"),e&&e!==t&&e.destroy(),t&&(t.view=this,this.addHandles(h(()=>this.root,e=>{if(e){const i=document.createElement("div");e.insertBefore(i,this._attribution?.surface??null),t.container=i}else t.container=null},l),"ui")),this._set("ui",t)}_stopMeasuring(){this.removeHandles("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const t=this._freqInfo;t.freq=b,t.time=w;const e=c({prepare:t=>{const i=this._measure(),s=this._freqInfo;if(s.time+=t.deltaTime,i&&(s.freq=b,this._get("resizing")||this._set("resizing",!0)),s.time<s.freq)return;s.time=0;const r=this._position();s.freq=r||i?b:Math.min(w,s.freq*H),!i&&s.freq>=C&&(e.pause(),this._get("resizing")&&this._set("resizing",!1))}}),i=new ResizeObserver(i=>{t.freq=b,t.time=w,e.resume()});null!=this.container&&i.observe(this.container);const n=r(()=>i.disconnect());this.addHandles([s(window,"resize",()=>{t.freq=b,t.time=w,e.resume()}),n,e],"measuring"),this._measure(),this._position()}_measure(){const t=this.container,e=t?t.clientWidth:0,i=t?t.clientHeight:0;if(0===e||0===i)return this.suspended||this._set("suspended",!0),!1;const s=this.width,r=this.height;if(e===s&&i===r)return this.suspended&&this._set("suspended",!1),!1;this._set("width",e),this._set("height",i),this.suspended&&this._set("suspended",!1);return this.emit("resize",{oldWidth:s,oldHeight:r,width:e,height:i}),!0}_position(){const t=this.container,e=this.position,i=t&&g(t);return!!i&&((!e||i[0]!==e[0]||i[1]!==e[1])&&(this._set("position",[i[0],i[1]]),!0))}forceDOMReadyCycle(){}};return t([p()],z.prototype,"aria",void 0),t([p()],z.prototype,"container",null),t([p({readOnly:!0})],z.prototype,"focused",null),t([p({readOnly:!0})],z.prototype,"height",void 0),t([p()],z.prototype,"messagesCommon",void 0),t([p({type:_})],z.prototype,"overlay",void 0),t([p({readOnly:!0})],z.prototype,"position",void 0),t([p({readOnly:!0})],z.prototype,"resizing",void 0),t([p({readOnly:!0})],z.prototype,"root",void 0),t([p({value:null,readOnly:!0})],z.prototype,"size",null),t([p({readOnly:!0})],z.prototype,"surface",void 0),t([p({readOnly:!0})],z.prototype,"suspended",void 0),t([p({nonNullable:!0})],z.prototype,"ui",null),t([p({readOnly:!0})],z.prototype,"userContent",void 0),t([p({readOnly:!0})],z.prototype,"width",void 0),t([p()],z.prototype,"widthBreakpoint",void 0),z=t([m("esri.views.DOMContainer")],z),z};export{O as DOMContainer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import r from"../core/Accessor.js";import t from"../core/Collection.js";import{when as i,watch as s}from"../core/reactiveUtils.js";import{property as a,subclass as n}from"../core/accessorSupport/decorators.js";import o from"./3d/layers/IntegratedMesh3DTilesLayerView3D.js";import{toExtent as l}from"./3d/support/cameraUtils.js";import{GroundElevationSampler as p}from"./support/GroundElevationSampler.js";import{IntegratedMeshElevationSampler as d}from"./support/IntegratedMeshElevationSampler.js";let u=class extends r{constructor(e){super(e),this.view=null,this.layerViews=new t}initialize(){this.addHandles([i(()=>this.view?.map?.ground,async e=>e.load()),s(()=>this.view.map?.basemap,()=>this._groundLayersChanged(),{initial:!0}),s(()=>this.view.map?.basemap?.groundLayers,e=>{this._groundLayersChanged(),e?.on("after-changes",()=>this._groundLayersChanged())},{initial:!0}),s(()=>this.view.basemapView?.groundLayerViews,e=>{this._groundLayersChanged(),e?.on("after-changes",()=>this._groundLayersChanged())},{initial:!0}),i(()=>"3d"===this.view.type&&(this.view?.basemapTerrain??!1),()=>this._groundLayersChanged())])}_groundLayersChanged(){const{view:e}=this;if(null!=e&&"3d"===e.type){const r=e.basemapTerrain;if(r){const t=e.map?.basemap?.groundLayers.some(r=>(!!e.basemapView?.groundLayerViews.find(e=>e.layer===r||e instanceof o&&e.canRecycleWith(r))||e.layerViewManager.isRecyclingLayerViewForLayer(r))&&"replacesTerrain"in r&&r.replacesTerrain);r.enable(!t)}}}get ground(){return this.view?.map?.ground}destroy(){this._set("view",null),this.layerViews.destroyAll()}get elevationSampler(){return"3d"===this.view.type?new p({view:this.view}):null}get integratedMeshElevationSampler(){return this.view?new d({view:this.view}):null}get extent(){const{view:e}=this;return e?.ready?l(e,e.state.camera,e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation):null}get updating(){return!this.suspended&&this.layerViews.some(({updating:e})=>e)}get suspended(){return this.view?.suspended??!0}};e([a({readOnly:!0})],u.prototype,"elevationSampler",null),e([a({readOnly:!0})],u.prototype,"integratedMeshElevationSampler",null),e([a({readOnly:!0})],u.prototype,"extent",null),e([a({type:Boolean,readOnly:!0})],u.prototype,"updating",null),e([a({constructOnly:!0})],u.prototype,"view",void 0),e([a({type:t,readOnly:!0})],u.prototype,"layerViews",void 0),e([a({readOnly:!0})],u.prototype,"suspended",null),u=e([n("esri.views.GroundView")],u);const y=u;export{y as default};
5
+ import{__decorate as e}from"tslib";import r from"../core/Accessor.js";import t from"../core/Collection.js";import{when as i,watch as n}from"../core/reactiveUtils.js";import{property as s,subclass as a}from"../core/accessorSupport/decorators.js";import o from"./3d/layers/IntegratedMesh3DTilesLayerView3D.js";import{toExtent as l}from"./3d/support/cameraUtils.js";import{GroundElevationSampler as p}from"./support/GroundElevationSampler.js";import{IntegratedMeshElevationSampler as d}from"./support/IntegratedMeshElevationSampler.js";let u=class extends r{constructor(e){super(e),this.view=null,this.layerViews=new t}initialize(){this.addHandles([i(()=>this.view?.map?.ground,async e=>e.load()),n(()=>!this.hasTerrainReplacement,e=>{this.view?.basemapTerrain?.enable(e)})])}get hasTerrainReplacement(){const{view:e}=this;if("3d"!==e?.type||!e.map?.basemap)return!1;return!!e.map.basemap.groundLayers.some(r=>(!!e.basemapView?.groundLayerViews.find(e=>e instanceof o&&e.ready&&(e.layer===r||e.canRecycleWith(r)))||e.layerViewManager.isRecyclingLayerViewForLayer(r))&&"replacesTerrain"in r&&r.replacesTerrain)}get ground(){return this.view?.map?.ground}destroy(){this._set("view",null),this.layerViews.destroyAll()}get elevationSampler(){return"3d"===this.view.type?new p({view:this.view}):null}get integratedMeshElevationSampler(){return this.view?new d({view:this.view}):null}get extent(){const{view:e}=this;return e?.ready?l(e,e.state.camera,e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation):null}get updating(){return!this.suspended&&this.layerViews.some(({updating:e})=>e)}get suspended(){return this.view?.suspended??!0}};e([s()],u.prototype,"hasTerrainReplacement",null),e([s({readOnly:!0})],u.prototype,"elevationSampler",null),e([s({readOnly:!0})],u.prototype,"integratedMeshElevationSampler",null),e([s({readOnly:!0})],u.prototype,"extent",null),e([s({type:Boolean,readOnly:!0})],u.prototype,"updating",null),e([s({constructOnly:!0})],u.prototype,"view",void 0),e([s({type:t,readOnly:!0})],u.prototype,"layerViews",void 0),e([s({readOnly:!0})],u.prototype,"suspended",null),u=e([a("esri.views.GroundView")],u);const m=u;export{m 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{property as s,subclass as o}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import a from"../../layers/support/FieldsIndex.js";import{rasterFieldPrefix as n}from"../../layers/support/rasterFieldUtils.js";import{combineTimeExtent as p}from"../../layers/support/timeSupport.js";import{load as l,getSourceScale as m}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import u from"../../rest/support/Query.js";import{getFetchPopupTemplate as c}from"./support/popupUtils.js";const y=y=>{const d=y;let f=class extends d{constructor(...e){super(...e),this.view=null}get timeExtent(){return p(this.layer,this.view?.timeExtent,this._get("timeExtent"))}async fetchPopupFeaturesAtLocation(e,s){const{layer:o}=this;if(!e)throw new t("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:o});const{popupEnabled:p}=o,l=c(o,s);if(!p||null==l)return[];const m=await l.getRequiredFields(null,{index:new a(o.rasterFields),partitions:new Map([["$pixel",o.rasterFields.filter(e=>e.name.startsWith(n)).map(e=>e.name)],["$imageCollectionItem",o.fields.map(e=>e.name)]])});r(s);const y=new u;y.timeExtent=this.timeExtent,y.geometry=e,y.outFields=m,y.outSpatialReference=e.spatialReference;const{resolution:d,spatialReference:f}=this.view,w="2d"===this.view.type?new i(d,d,f):new i(.5*d,.5*d,f),{returnTopmostRaster:h,showNoDataRecords:R}=l.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},x={returnDomainValues:!0,returnTopmostRaster:h,pixelSize:w,showNoDataRecords:R,signal:s?.signal};return o.queryVisibleRasters(y,x)}async getSourceScale(){return await l(),await this.layer.load(),m(this.layer.serviceRasterInfo,this.view.spatialReference)}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}};return e([s()],f.prototype,"layer",void 0),e([s()],f.prototype,"suspended",void 0),e([s({readOnly:!0})],f.prototype,"timeExtent",null),e([s()],f.prototype,"view",void 0),f=e([o("esri.views.layers.ImageryLayerViewMixin")],f),f};export{y as ImageryLayerViewMixin};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{property as s,subclass as o}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import{load as a,getSourceScale as n}from"../../layers/raster/functions/rasterProjectionHelper.js";import p from"../../layers/support/FieldsIndex.js";import{rasterFieldPrefix as l}from"../../layers/support/rasterFieldUtils.js";import{combineTimeExtent as m}from"../../layers/support/timeSupport.js";import u from"../../rest/support/Query.js";import{getFetchPopupTemplate as c}from"./support/popupUtils.js";const y=y=>{const d=y;let f=class extends d{constructor(...e){super(...e),this.view=null}get timeExtent(){return m(this.layer,this.view?.timeExtent,this._get("timeExtent"))}async fetchPopupFeaturesAtLocation(e,s){const{layer:o}=this;if(!e)throw new t("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:o});const{popupEnabled:a}=o,n=c(o,s);if(!a||null==n)return[];const m=await n.getRequiredFields(null,{index:new p(o.rasterFields),partitions:new Map([["$pixel",o.rasterFields.filter(e=>e.name.startsWith(l)).map(e=>e.name)],["$imageCollectionItem",o.fields.map(e=>e.name)]])});r(s);const y=new u;y.timeExtent=this.timeExtent,y.geometry=e,y.outFields=m,y.outSpatialReference=e.spatialReference;const{resolution:d,spatialReference:f}=this.view,w="2d"===this.view.type?new i(d,d,f):new i(.5*d,.5*d,f),{returnTopmostRaster:h,showNoDataRecords:R}=n.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},x={returnDomainValues:!0,returnTopmostRaster:h,pixelSize:w,showNoDataRecords:R,signal:s?.signal};return o.queryVisibleRasters(y,x)}async getSourceScale(){return await a(),await this.layer.load(),n(this.layer.serviceRasterInfo,this.view.spatialReference)}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}};return e([s()],f.prototype,"layer",void 0),e([s()],f.prototype,"suspended",void 0),e([s({readOnly:!0})],f.prototype,"timeExtent",null),e([s()],f.prototype,"view",void 0),f=e([o("esri.views.layers.ImageryLayerViewMixin")],f),f};export{y as ImageryLayerViewMixin};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../Graphic.js";import r from"../../core/Error.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{addMultidimensionalFieldValues as s,commonRasterFieldNames as n,rasterFieldPrefix as l}from"../../layers/support/rasterFieldUtils.js";import{combineTimeExtent as o}from"../../layers/support/timeSupport.js";import{isFunctionRaster as u}from"../../layers/support/rasterDatasets/datasetUtils.js";import{getDefaultDatumTransformationForDataset as p,projectDatasetExtent as c,getSourceScale as m}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as y}from"./support/popupUtils.js";const f=f=>{const h=f;let d=class extends h{constructor(...t){super(...t),this.layer=null,this.tileInfo=null}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}get timeExtent(){return o(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){const{renderer:t}=this.layer;return!!("raster-stretch"===t?.type&&t.dynamicRangeAdjustment&&!("min-max"===t.stretchType||"standard-deviation"===t.stretchType))}get datumTransformation(){try{return this.layer.loaded?p(this.layer.fullExtent,this.view.spatialReference,!0):null}catch{return null}}supportsSpatialReference(t){try{return!this.layer.loaded||!!c(this.layer.serviceRasterInfo,t)}catch{return!1}}async fetchPopupFeaturesAtLocation(t,i){const{layer:a}=this;if(!t)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:a});const{popupEnabled:o}=a,p=y(a,i);if(!o||null==p)return[];const c=[],{value:m,magdirValue:f,processedValue:h}=await a.identify(t,{timeExtent:this.timeExtent,signal:i?.signal});let d="";if(m?.length){d="imagery-tile"===a.type&&a.hasStandardTime()&&null!=m[0]?m.map(t=>a.getStandardTimeValue(t)).join(", "):m.join(", ");const t={ObjectId:0};t[n.servicePixelValue]="imagery-tile"===a.type&&u(a.raster)?h?.join(", "):d,t[n.rawServicePixelValue]=d;const r=a.raster?.rasterInfo??a.serviceRasterInfo,i=r?.attributeTable;if(null!=i){const{fields:e,features:r}=i,a=e.find(({name:t})=>"value"===t.toLowerCase()),s=t[n.servicePixelValue],o=a?r.find(t=>String(t.attributes[a.name])===s):null;if(o)for(const i in o.attributes)if(o.attributes.hasOwnProperty(i)){t[l+i]=o.attributes[i]}}const o=r?.dataType;"vector-magdir"!==o&&"vector-uv"!==o||(t[n.magnitude]=f?.[0],t[n.direction]=f?.[1]);const{multidimensionalDefinition:p}=this.layer.normalizeRasterFetchOptions({timeExtent:this.timeExtent});s(a.rasterFields,t,p);const{graphicOrigin:y}=a,g=new e({geometry:this.fullExtent?.clone(),attributes:t,layer:a,origin:y,sourceLayer:a});c.push(g)}return c}async getSourceScale(){return await this.layer.load(),m(this.layer.serviceRasterInfo,this.view.spatialReference)}_getFullExtent(){return c(this.layer.serviceRasterInfo,this.view.spatialReference)}};return t([i()],d.prototype,"fullExtent",null),t([i()],d.prototype,"layer",void 0),t([i({readOnly:!0})],d.prototype,"timeExtent",null),t([i()],d.prototype,"tileInfo",void 0),t([i({readOnly:!0})],d.prototype,"hasTilingEffects",null),t([i()],d.prototype,"datumTransformation",null),d=t([a("esri.views.layers.ImageryTileLayerViewMixin")],d),d};export{f as ImageryTileLayerViewMixin};
5
+ import{__decorate as t}from"tslib";import e from"../../Graphic.js";import r from"../../core/Error.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{isFunctionRaster as s}from"../../layers/raster/datasets/datasetUtils.js";import{getDefaultDatumTransformationForDataset as n,projectDatasetExtent as l,getSourceScale as o}from"../../layers/raster/functions/rasterProjectionHelper.js";import{addMultidimensionalFieldValues as u,commonRasterFieldNames as c,rasterFieldPrefix as p}from"../../layers/support/rasterFieldUtils.js";import{combineTimeExtent as m}from"../../layers/support/timeSupport.js";import{getFetchPopupTemplate as y}from"./support/popupUtils.js";const f=f=>{const h=f;let d=class extends h{constructor(...t){super(...t),this.layer=null,this.tileInfo=null}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}get timeExtent(){return m(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){const{renderer:t}=this.layer;return!!("raster-stretch"===t?.type&&t.dynamicRangeAdjustment&&!("min-max"===t.stretchType||"standard-deviation"===t.stretchType))}get datumTransformation(){try{return this.layer.loaded?n(this.layer.fullExtent,this.view.spatialReference,!0):null}catch{return null}}supportsSpatialReference(t){try{return!this.layer.loaded||!!l(this.layer.serviceRasterInfo,t)}catch{return!1}}async fetchPopupFeaturesAtLocation(t,i){const{layer:a}=this;if(!t)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:a});const{popupEnabled:n}=a,l=y(a,i);if(!n||null==l)return[];const o=[],{value:m,magdirValue:f,processedValue:h}=await a.identify(t,{timeExtent:this.timeExtent,signal:i?.signal});let d="";if(m?.length){d="imagery-tile"===a.type&&a.hasStandardTime()&&null!=m[0]?m.map(t=>a.getStandardTimeValue(t)).join(", "):m.join(", ");const t={ObjectId:0};t[c.servicePixelValue]="imagery-tile"===a.type&&s(a.raster)?h?.join(", "):d,t[c.rawServicePixelValue]=d;const r=a.raster?.rasterInfo??a.serviceRasterInfo,i=r?.attributeTable;if(null!=i){const{fields:e,features:r}=i,a=e.find(({name:t})=>"value"===t.toLowerCase()),s=t[c.servicePixelValue],n=a?r.find(t=>String(t.attributes[a.name])===s):null;if(n)for(const i in n.attributes)if(n.attributes.hasOwnProperty(i)){t[p+i]=n.attributes[i]}}const n=r?.dataType;"vector-magdir"!==n&&"vector-uv"!==n||(t[c.magnitude]=f?.[0],t[c.direction]=f?.[1]);const{multidimensionalDefinition:l}=this.layer.normalizeRasterFetchOptions({timeExtent:this.timeExtent});u(a.rasterFields,t,l);const{graphicOrigin:y}=a,g=new e({geometry:this.fullExtent?.clone(),attributes:t,layer:a,origin:y,sourceLayer:a});o.push(g)}return o}async getSourceScale(){return await this.layer.load(),o(this.layer.serviceRasterInfo,this.view.spatialReference)}_getFullExtent(){return l(this.layer.serviceRasterInfo,this.view.spatialReference)}};return t([i()],d.prototype,"fullExtent",null),t([i()],d.prototype,"layer",void 0),t([i({readOnly:!0})],d.prototype,"timeExtent",null),t([i()],d.prototype,"tileInfo",void 0),t([i({readOnly:!0})],d.prototype,"hasTilingEffects",null),t([i()],d.prototype,"datumTransformation",null),d=t([a("esri.views.layers.ImageryTileLayerViewMixin")],d),d};export{f as ImageryTileLayerViewMixin};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../request.js";import e from"../../geometry/Point.js";import{execute as r}from"../../geometry/operators/projectOperator.js";import{projectResolution as i,getProjectionOffsetGrid as a,load as s}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{isImageSource as n,rasterize as o}from"../2d/engine/Bitmap.js";import m from"../2d/engine/webgl/VertexStream.js";import{createProgramTemplate as c}from"../2d/engine/webgl/shaders/MaterialPrograms.js";import{PixelType as p}from"../webgl/enums.js";import{FramebufferObject as h}from"../webgl/FramebufferObject.js";import{createTransformTexture as x}from"../webgl/rasterUtils.js";import{RenderingContext as u}from"../webgl/RenderingContext.js";import{RenderingContextOptions as d}from"../webgl/RenderingContextOptions.js";import{Texture as g}from"../webgl/Texture.js";import{TextureDescriptor as _}from"../webgl/TextureDescriptor.js";class f{static{this._instanceRefCount=0}constructor(t){if(this._ownsRctx=!1,t)this._ownsRctx=!1,this._rctx=t;else{if(f._instance)return f._instanceRefCount++,f._instance;f._instanceRefCount=1,f._instance=this,this._ownsRctx=!0;const t=document.createElement("canvas").getContext("webgl2");t.getExtension("OES_texture_float"),this._rctx=new u(t,new d)}this._quad=new m(this._rctx,[0,0,1,0,0,1,1,1]);const e=c("raster/reproject","raster/reproject",{applyProjection:!0,bilinear:!1,bicubic:!1});this._program=this._rctx.programCache.acquire(e.vertexShader,e.fragmentShader,this._quad.locations),this._rctx.useProgram(this._program),this._program.setUniform1f("u_opacity",1),this._program.setUniform1i("u_image",0),this._program.setUniform1i("u_flipY",0),this._program.setUniform1i("u_transformGrid",1)}reprojectTexture(t,s,n=!1){const o=r(t.extent,s),m=new e({x:(t.extent.xmax-t.extent.xmin)/t.texture.descriptor.width,y:(t.extent.ymax-t.extent.ymin)/t.texture.descriptor.height,spatialReference:t.extent.spatialReference}),{x:c,y:u}=i(m,s,t.extent);let d=(c+u)/2;const g=Math.round((o.xmax-o.xmin)/d),f=Math.round((o.ymax-o.ymin)/d);d=(o.width/g+o.height/f)/2;const l=new e({x:d,y:d,spatialReference:o.spatialReference}),w=a({projectedExtent:o,srcBufferExtent:t.extent,pixelSize:l,hasWrapAround:!0,spacing:[16,16]}),b=x(this._rctx,w),j=new _(g,f);j.wrapMode=33071;const D=new h(this._rctx,j);this._rctx.bindFramebuffer(D),this._rctx.setViewport(0,0,g,f),this._rctx.useProgram(this._program),this._rctx.bindTexture(t.texture,0),this._rctx.bindTexture(b,1),this._quad.bind();const{width:R=0,height:y=0}=t.texture.descriptor;if(this._program.setUniform2f("u_srcImageSize",R,y),this._program.setUniform2fv("u_transformSpacing",w.spacing),this._program.setUniform2fv("u_transformGridSize",w.size),this._program.setUniform2f("u_targetImageSize",g,f),this._quad.draw(),this._quad.unbind(),this._rctx.useProgram(null),this._rctx.bindFramebuffer(null),b.dispose(),n){const{width:t,height:e}=D,r=new ImageData(t??0,e??0);D.readPixels(0,0,t??0,e??0,6408,p.UNSIGNED_BYTE,r.data);const i=D.detachColorTexture();return D.dispose(),{texture:i,extent:o,imageData:r}}const C=D.detachColorTexture();return D.dispose(),{texture:C,extent:o}}reprojectBitmapData(t,e){const r=n(t.bitmapData)?o(t.bitmapData):t.bitmapData,i=new _(t.bitmapData.width,t.bitmapData.height);i.wrapMode=33071;const a=new g(this._rctx,i,r),s=this.reprojectTexture({texture:a,extent:t.extent},e,!0);s.texture.dispose();const m=document.createElement("canvas"),c=s.imageData;m.width=c.width,m.height=c.height;return m.getContext("2d").putImageData(c,0,0),{bitmapData:m,extent:s.extent}}async loadAndReprojectBitmapData(e,r,i){const[a]=await Promise.all([t(e,{responseType:"image"}).then(t=>t.data),s()]),n=document.createElement("canvas");n.width=a.width,n.height=a.height;const o=n.getContext("2d");o.drawImage(a,0,0);const m=o.getImageData(0,0,n.width,n.height);if(r.spatialReference.equals(i))return{bitmapData:m,extent:r};const c=this.reprojectBitmapData({bitmapData:m,extent:r},i);return{bitmapData:c.bitmapData,extent:c.extent}}destroy(){this._ownsRctx?(f._instanceRefCount--,0===f._instanceRefCount&&(this._quad.dispose(),this._program.dispose(),this._rctx.dispose(),f._instance=null)):(this._quad.dispose(),this._program.dispose())}}export{f as ImageReprojector};
5
+ import t from"../../request.js";import e from"../../geometry/Point.js";import{execute as r}from"../../geometry/operators/projectOperator.js";import{projectResolution as i,getProjectionOffsetGrid as a,load as s}from"../../layers/raster/functions/rasterProjectionHelper.js";import{isImageSource as n,rasterize as o}from"../2d/engine/Bitmap.js";import m from"../2d/engine/webgl/VertexStream.js";import{createProgramTemplate as c}from"../2d/engine/webgl/shaders/MaterialPrograms.js";import{PixelType as p}from"../webgl/enums.js";import{FramebufferObject as h}from"../webgl/FramebufferObject.js";import{createTransformTexture as x}from"../webgl/rasterUtils.js";import{RenderingContext as d}from"../webgl/RenderingContext.js";import{RenderingContextOptions as u}from"../webgl/RenderingContextOptions.js";import{Texture as g}from"../webgl/Texture.js";import{TextureDescriptor as _}from"../webgl/TextureDescriptor.js";class f{static{this._instanceRefCount=0}constructor(t){if(this._ownsRctx=!1,t)this._ownsRctx=!1,this._rctx=t;else{if(f._instance)return f._instanceRefCount++,f._instance;f._instanceRefCount=1,f._instance=this,this._ownsRctx=!0;const t=document.createElement("canvas").getContext("webgl2");t.getExtension("OES_texture_float"),this._rctx=new d(t,new u)}this._quad=new m(this._rctx,[0,0,1,0,0,1,1,1]);const e=c("raster/reproject","raster/reproject",{applyProjection:!0,bilinear:!1,bicubic:!1});this._program=this._rctx.programCache.acquire(e.vertexShader,e.fragmentShader,this._quad.locations),this._rctx.useProgram(this._program),this._program.setUniform1f("u_opacity",1),this._program.setUniform1i("u_image",0),this._program.setUniform1i("u_flipY",0),this._program.setUniform1i("u_transformGrid",1)}reprojectTexture(t,s,n=!1){const o=r(t.extent,s),m=new e({x:(t.extent.xmax-t.extent.xmin)/t.texture.descriptor.width,y:(t.extent.ymax-t.extent.ymin)/t.texture.descriptor.height,spatialReference:t.extent.spatialReference}),{x:c,y:d}=i(m,s,t.extent);let u=(c+d)/2;const g=Math.round((o.xmax-o.xmin)/u),f=Math.round((o.ymax-o.ymin)/u);u=(o.width/g+o.height/f)/2;const l=new e({x:u,y:u,spatialReference:o.spatialReference}),w=a({projectedExtent:o,srcBufferExtent:t.extent,pixelSize:l,hasWrapAround:!0,spacing:[16,16]}),b=x(this._rctx,w),j=new _(g,f);j.wrapMode=33071;const D=new h(this._rctx,j);this._rctx.bindFramebuffer(D),this._rctx.setViewport(0,0,g,f),this._rctx.useProgram(this._program),this._rctx.bindTexture(t.texture,0),this._rctx.bindTexture(b,1),this._quad.bind();const{width:R=0,height:y=0}=t.texture.descriptor;if(this._program.setUniform2f("u_srcImageSize",R,y),this._program.setUniform2fv("u_transformSpacing",w.spacing),this._program.setUniform2fv("u_transformGridSize",w.size),this._program.setUniform2f("u_targetImageSize",g,f),this._quad.draw(),this._quad.unbind(),this._rctx.useProgram(null),this._rctx.bindFramebuffer(null),b.dispose(),n){const{width:t,height:e}=D,r=new ImageData(t??0,e??0);D.readPixels(0,0,t??0,e??0,6408,p.UNSIGNED_BYTE,r.data);const i=D.detachColorTexture();return D.dispose(),{texture:i,extent:o,imageData:r}}const C=D.detachColorTexture();return D.dispose(),{texture:C,extent:o}}reprojectBitmapData(t,e){const r=n(t.bitmapData)?o(t.bitmapData):t.bitmapData,i=new _(t.bitmapData.width,t.bitmapData.height);i.wrapMode=33071;const a=new g(this._rctx,i,r),s=this.reprojectTexture({texture:a,extent:t.extent},e,!0);s.texture.dispose();const m=document.createElement("canvas"),c=s.imageData;m.width=c.width,m.height=c.height;return m.getContext("2d").putImageData(c,0,0),{bitmapData:m,extent:s.extent}}async loadAndReprojectBitmapData(e,r,i){const[a]=await Promise.all([t(e,{responseType:"image"}).then(t=>t.data),s()]),n=document.createElement("canvas");n.width=a.width,n.height=a.height;const o=n.getContext("2d");o.drawImage(a,0,0);const m=o.getImageData(0,0,n.width,n.height);if(r.spatialReference.equals(i))return{bitmapData:m,extent:r};const c=this.reprojectBitmapData({bitmapData:m,extent:r},i);return{bitmapData:c.bitmapData,extent:c.extent}}destroy(){this._ownsRctx?(f._instanceRefCount--,0===f._instanceRefCount&&(this._quad.dispose(),this._program.dispose(),this._rctx.dispose(),f._instance=null)):(this._quad.dispose(),this._program.dispose())}}export{f as ImageReprojector};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import"../core/has.js";import{getOrCreateMapValue as i}from"../core/MapUtils.js";import{watch as o,on as n}from"../core/reactiveUtils.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import{isIntegerField as r}from"../layers/support/fieldUtils.js";import{isString as l}from"../support/guards.js";import d from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as u,getVisibleFieldInputValidationErrorMessage as p,isElementTemplateWithInputType as m}from"./BatchAttributeForm/batchAttributeFormUtils.js";import c from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as h}from"./BatchAttributeForm/css.js";import{VisibleElements as v}from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as b,isFieldInput as f,differentValuesString as C}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as _,getIntlOptionsForField as y,prepareISOFieldValueForDateComponents as F,prepareUnixFieldValueForDateComponents as w,normalizeTimeOnlyString as I,getISOFieldValueFromDateComponents as x,getUnixFieldValueFromDateComponents as M}from"./support/dateUtils.js";import{globalCss as k}from"./support/globalCss.js";import{messageBundle as O,vmEvent as T,tsx as V}from"./support/widget.js";import{setFocus as D}from"./support/widgetUtils.js";import{isEmptyValue as U}from"./support/forms/formUtils.js";const S="data-element-id";let E=class extends d{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new c,this.visibleElements=new v,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([o(()=>this.features,()=>{this._dateComponentMap.clear()}),o(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear()}),n(()=>this.viewModel,"submit",()=>{this.valid||this.goToClosestError()})])}loadDependencies(){return g({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToClosestError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):V("div",{class:this.classes(h.base,k.widget,k.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?V("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:o}=e.dataset,n=i(this._dateComponentMap,`${o}`,()=>({}));switch(t){case"date":n.date=e;break;case"time":n.time=e;break;case"timeZone":n.timeZone=e}}_renderErrorNotice(e){return V("div",{class:this.classes(h.base,k.widget,k.panel)},V("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},V("div",{slot:"message"},e)))}_renderForm(){return V("form",{onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let o;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(o=u(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?o+=` (${e.map(e=>e.label).join(", ")})`:o=null}else o+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return o?V("calcite-notice",{class:h.noticeError,icon:!0,kind:"danger",open:!0},V("div",{slot:"message"},o)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[V("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},V("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return b(e)?this._renderGroupInput(e):f(e)?this._renderLabeledField(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:o}=e,n=t.filter(e=>e.visible),a=i.label??"";return V("calcite-block",{class:this.classes(h.group,"sequential"===this.groupDisplay?h.groupSequential:null,this.disabled?h.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:o,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:o,required:n,dataType:a}=e,s=n?t(this.messages.requiredFieldLabel,{name:o}):o;return V("calcite-label",{"aria-label":s,class:h.label,key:`field--${i}`},V("div",{class:h.labelTextContent,key:"labelTextContainer"},o,n?V("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==a?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:o}=e,n=!o&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?p(e,t,this.messages):null;return n?V("calcite-input-message",{icon:!0,status:"invalid"},n):i?V("calcite-input-message",{class:h.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,o=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:o.flat(),props:t});default:return this._renderComboBoxComponent({options:o,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===C||e.value===C)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[S]:t[S]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:C,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return V("calcite-switch",{...t,checked:!!m(e.template,"switch")&&e.value===e.template.input.onValue,class:h.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:o,dropdown:n,group:a}=i;return V("calcite-dropdown",{...n,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},V("calcite-button",{...o},e===C?this.messages.differentValuesPlaceholder:e),V("calcite-dropdown-group",{selectionMode:a.mode},t.map(t=>V("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const o="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),a=o&&e.showNoValueOptionEnabled&&!n?()=>{}:i.onblur,s={...i,onblur:a};return V("calcite-combobox",{...s,selectionMode:"single",value:i.placeholder===this.messages.differentValuesPlaceholder?C:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==C&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[o,n]=t.map(e=>e.map(({name:e,value:t})=>V("calcite-combobox-item",{key:`#${t}`,selected:i.value===t,textLabel:e,value:`${t}`}))),a=[...o];n.length>0&&a.push(V("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},n));const s=i.placeholder===this.messages.differentValuesPlaceholder,r=!s&&U(i.value);return e.showNoValueOptionEnabled&&a.unshift(V("calcite-combobox-item",{key:"empty-option",selected:r,textLabel:e.showNoValueLabel||this.messages.empty,value:""})),s&&a.unshift(V("calcite-combobox-item",{key:C,selected:!0,textLabel:this.messages.differentValuesPlaceholder,value:C})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const o=t.map(({name:t,value:o})=>this._renderRadioButtons({label:t,value:o,selected:o===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",n=e.showNoValueLabel||this.messages.empty,a=U(e.value);o.unshift(this._renderRadioButtons({label:n,value:t,selected:a,props:i}))}return V("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:h.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},o,i.placeholder===this.messages.differentValuesPlaceholder?V("calcite-label",{class:h.placeholderRadio,key:i.label,layout:"inline"},V("calcite-radio-button",{checked:!0,class:h.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:o}){return V("calcite-label",{class:h.inputRadioLabel,key:o.label,layout:"inline"},V("calcite-radio-button",{...o,afterCreate:void 0,afterUpdate:void 0,checked:t,class:h.inputRadio,disabled:o.readOnly,name:o.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?V("calcite-text-area",{...t,class:this.classes(h.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):V("calcite-input",{...t,class:this.classes(h.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=r(e.field);return V("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return V("calcite-input",{...i,class:this.classes(h.fieldInput,h.inputDisabled,h.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let o;switch(i.type){case"date":o=this._renderDateFieldComponents(e,t);break;case"date-only":o=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":o=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":o=this._renderTimestampOffsetFieldComponents(e,t);break;default:o=this._renderReadOnlyComponent(e,_(i,t.value,{timeZone:e.effectiveTimeZone,...y(e.template.field)}))}return e.value===C?[o,V("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:o}_renderDateOnlyFieldComponent(e,t){const{class:i,key:o,readOnly:n}=t,{rawMax:a,rawMin:s}=e.range;return V("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[S],key:`${o}-date-input`,max:l(a)?a:void 0,min:l(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:n,value:e.value===C?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:o,readOnly:n}=t;return V("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[S],key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:n,value:e.value===C?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:o,readOnly:n}=t,{rawMax:a,rawMin:s}=e.range,r=F(a),l=F(s),d=F(e.value===C?"":e.value),u=e.includeTimeOffset,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[S]:t[S],onfocus:this._onComponentFocus};return V("div",{class:h.dateInputContainer,key:`${o}-date-time-container`},V("calcite-input-date-picker",{...p,class:i,"data-date-part":"date",key:`${o}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),V("calcite-input-time-picker",{...p,class:i,"data-date-part":"time",key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?V("calcite-input-time-zone",{...p,class:i,clearable:e.value===C||null==e.value,"data-date-part":"timeZone",key:`${o}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:o,readOnly:n,min:a,max:s}=t,r=e.effectiveTimeZone,l=w(e.value===C?"":e.value,r),d=w(s,r),u=w(a,r),p=e.includeTime,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[S]:t[S],onfocus:this._onComponentFocus};return V("div",{class:h.dateInputContainer,key:`${o}-date-time-container`},V("calcite-input-date-picker",{...m,class:i,"data-date-part":"date",key:`${o}-date-input`,max:d?.date??void 0,min:u?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?V("calcite-input-time-picker",{...m,"data-date-part":"time",key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}getCommonInputProps(e){const{template:t,valid:i,value:o,minLength:n,maxLength:a,required:s,fieldName:r,editable:l,userHasChangedValue:d,range:{max:u,min:p}}=e,m=!l||this.readOnly,c=!m&&this._effectiveDisabled;let v=t.hint??void 0,b=!1;return o===C&&(v=this.messages.differentValuesPlaceholder,b=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(h.fieldInput,m?h.inputDisabled:null),status:!d&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:a&&a>-1?a:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:r,name:r,max:null!=u?u:void 0,min:null!=p?p:void 0,disabled:c,readOnly:m,onblur:this._onComponentBlur,required:s,placeholder:v,value:b?"":o??"",[S]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(S))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,D(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(m(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:o}=t.template;if(!t)return;const n=t?.value;if(m(t.template,"switch")&&"single"!==this.viewModel.mode){const e=i(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?n:e)}const a=this._parseValue(e,t);a!==n&&this.viewModel.setValue(o,a)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,o=e.field.type,n=this._dateComponentMap.get(`${i}`);if(!n)return;const a=e.effectiveTimeZone;let s=e.value===C?void 0:e.value,r=null;"date-only"===o?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===o?(s=I(s),r=I(t.value)):r="timestamp-offset"===o?null!=t.value?x({dateComponent:n.date,timeComponent:n.time,oldValue:s,timeZoneComponent:n.timeZone,defaultTimeZone:a}):null:null!=t.value?M({oldValue:s,dateComponent:n.date,timeZone:a,timeComponent:n.time?.value===C?void 0:n.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([a()],E.prototype,"activeFeatureIndex",null),e([a()],E.prototype,"disabled",null),e([a()],E.prototype,"_effectiveDisabled",null),e([a()],E.prototype,"features",null),e([a()],E.prototype,"map",null),e([a()],E.prototype,"maximumFeatureCount",null),e([a()],E.prototype,"maximumFeatureCountWithComplexForms",null),e([a()],E.prototype,"spatialReference",null),e([a()],E.prototype,"layerInfos",null),e([a()],E.prototype,"timeZone",null),e([a()],E.prototype,"headingLevel",void 0),e([a()],E.prototype,"icon",null),e([a(),O("esri/t9n/common")],E.prototype,"messagesCommon",void 0),e([a(),O("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],E.prototype,"messages",void 0),e([a(),O("esri/widgets/FeatureForm/t9n/FeatureForm")],E.prototype,"featureFormMessages",void 0),e([a()],E.prototype,"readOnly",null),e([a()],E.prototype,"valid",null),e([a(),T(["value-change","submit"])],E.prototype,"viewModel",void 0),e([a({type:v,nonNullable:!0})],E.prototype,"visibleElements",void 0),e([a()],E.prototype,"groupDisplay",void 0),E=e([s("esri.widgets.BatchAttributeForm")],E);const R=E;export{R as default};
5
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import"../core/has.js";import{getOrCreateMapValue as i}from"../core/MapUtils.js";import{watch as o,on as n}from"../core/reactiveUtils.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import{isIntegerField as r}from"../layers/support/fieldUtils.js";import{isString as l}from"../support/guards.js";import d from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as p,getVisibleFieldInputValidationErrorMessage as u,isElementTemplateWithInputType as m}from"./BatchAttributeForm/batchAttributeFormUtils.js";import c from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as h}from"./BatchAttributeForm/css.js";import{VisibleElements as v}from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as b,isFieldInput as f,differentValuesString as C}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as _,getIntlOptionsForField as y,prepareISOFieldValueForDateComponents as F,prepareUnixFieldValueForDateComponents as w,normalizeTimeOnlyString as I,getISOFieldValueFromDateComponents as x,getUnixFieldValueFromDateComponents as M}from"./support/dateUtils.js";import{globalCss as k}from"./support/globalCss.js";import{messageBundle as O,vmEvent as T,tsx as V}from"./support/widget.js";import{setFocus as D}from"./support/widgetUtils.js";import{isEmptyValue as U}from"./support/forms/formUtils.js";const S="data-element-id";let E=class extends d{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new c,this.visibleElements=new v,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([o(()=>this.features,()=>{this._dateComponentMap.clear()}),o(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear()}),n(()=>this.viewModel,"submit",()=>{this.valid||this.goToClosestError()})])}loadDependencies(){return g({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToClosestError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):V("div",{class:this.classes(h.base,k.widget,k.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?V("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:o}=e.dataset,n=i(this._dateComponentMap,`${o}`,()=>({}));switch(t){case"date":n.date=e;break;case"time":n.time=e;break;case"timeZone":n.timeZone=e}}_renderErrorNotice(e){return V("div",{class:this.classes(h.base,k.widget,k.panel)},V("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},V("div",{slot:"message"},e)))}_renderForm(){return V("form",{onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let o;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(o=p(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?o+=` (${e.map(e=>e.label).join(", ")})`:o=null}else o+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return o?V("calcite-notice",{class:h.noticeError,icon:!0,kind:"danger",open:!0},V("div",{slot:"message"},o)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[V("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},V("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return b(e)?this._renderGroupInput(e):f(e)?this._renderLabeledField(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:o}=e,n=t.filter(e=>e.visible),a=i.label??"";return V("calcite-block",{class:this.classes(h.group,"sequential"===this.groupDisplay?h.groupSequential:null,this.disabled?h.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:o,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:o,required:n,dataType:a}=e,s=n?t(this.messages.requiredFieldLabel,{name:o}):o;return V("calcite-label",{"aria-label":s,class:h.label,key:`field--${i}`},V("div",{class:h.labelTextContent,key:"labelTextContainer"},o,n?V("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==a?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:o}=e,n=!o&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?u(e,t,this.messages):null;return n?V("calcite-input-message",{icon:!0,status:"invalid"},n):i?V("calcite-input-message",{class:h.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,o=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:o.flat(),props:t});default:return this._renderComboBoxComponent({options:o,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===C||e.value===C)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[S]:t[S]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:C,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return V("calcite-switch",{...t,checked:!!m(e.template,"switch")&&e.value===e.template.input.onValue,class:h.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:o,dropdown:n,group:a}=i;return V("calcite-dropdown",{...n,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},V("calcite-button",{...o},e===C?this.messages.differentValuesPlaceholder:e),V("calcite-dropdown-group",{selectionMode:a.mode},t.map(t=>V("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const o="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),a=o&&e.showNoValueOptionEnabled&&!n?()=>{}:i.onblur,s={...i,onblur:a};return V("calcite-combobox",{...s,selectionMode:"single",value:i.placeholder===this.messages.differentValuesPlaceholder?C:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==C&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[o,n]=t.map(e=>e.map(({name:e,value:t})=>V("calcite-combobox-item",{key:`#${t}`,selected:i.value===t,textLabel:e,value:`${t}`}))),a=[...o];n.length>0&&a.push(V("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},n));const s=i.placeholder===this.messages.differentValuesPlaceholder,r=!s&&U(i.value);return e.showNoValueOptionEnabled&&a.unshift(V("calcite-combobox-item",{key:"empty-option",selected:r,textLabel:e.showNoValueLabel||this.messages.empty,value:""})),s&&a.unshift(V("calcite-combobox-item",{key:C,selected:!0,textLabel:this.messages.differentValuesPlaceholder,value:C})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const o=t.map(({name:t,value:o})=>this._renderRadioButtons({label:t,value:o,selected:o===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",n=e.showNoValueLabel||this.messages.empty,a=U(e.value);o.unshift(this._renderRadioButtons({label:n,value:t,selected:a,props:i}))}return V("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:h.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},o,i.placeholder===this.messages.differentValuesPlaceholder?V("calcite-label",{class:h.placeholderRadio,key:i.label,layout:"inline"},V("calcite-radio-button",{checked:!0,class:h.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:o}){return V("calcite-label",{class:h.inputRadioLabel,key:o.label,layout:"inline"},V("calcite-radio-button",{...o,afterCreate:void 0,afterUpdate:void 0,checked:t,class:h.inputRadio,disabled:o.readOnly,name:o.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?V("calcite-text-area",{...t,class:this.classes(h.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):V("calcite-input",{...t,class:this.classes(h.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=r(e.field);return V("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return V("calcite-input",{...i,class:this.classes(h.fieldInput,h.inputDisabled,h.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let o;switch(i.type){case"date":o=this._renderDateFieldComponents(e,t);break;case"date-only":o=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":o=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":o=this._renderTimestampOffsetFieldComponents(e,t);break;default:o=this._renderReadOnlyComponent(e,_(i,t.value,{timeZone:e.effectiveTimeZone,...y(e.template.field)}))}return e.value===C?[o,V("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:o}_renderDateOnlyFieldComponent(e,t){const{class:i,key:o,readOnly:n}=t,{rawMax:a,rawMin:s}=e.range;return V("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[S],key:`${o}-date-input`,max:l(a)?a:void 0,min:l(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:n,value:e.value===C?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:o,readOnly:n}=t;return V("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[S],key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:n,value:e.value===C?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:o,readOnly:n}=t,{rawMax:a,rawMin:s}=e.range,r=F(a),l=F(s),d=F(e.value===C?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[S]:t[S],onfocus:this._onComponentFocus};return V("div",{class:h.dateInputContainer,key:`${o}-date-time-container`},V("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${o}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),V("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?V("calcite-input-time-zone",{...u,class:i,clearable:e.value===C||null==e.value,"data-date-part":"timeZone",key:`${o}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:o,readOnly:n,min:a,max:s}=t,r=e.effectiveTimeZone,l=w(e.value===C?"":e.value,r),d=w(s,r),p=w(a,r),u=e.includeTime,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[S]:t[S],onfocus:this._onComponentFocus};return V("div",{class:h.dateInputContainer,key:`${o}-date-time-container`},V("calcite-input-date-picker",{...m,class:i,"data-date-part":"date",key:`${o}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?V("calcite-input-time-picker",{...m,"data-date-part":"time",key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}getCommonInputProps(e){const{template:t,valid:i,value:o,minLength:n,maxLength:a,required:s,fieldName:r,editable:l,userHasChangedValue:d,range:{max:p,min:u}}=e,m=!l||this.readOnly,c=!m&&this._effectiveDisabled;let v=t.hint??void 0,b=!1;return o===C&&(v=this.messages.differentValuesPlaceholder,b=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(h.fieldInput,m?h.inputDisabled:null),status:!d&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:a&&a>-1?a:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:r,name:r,max:null!=p?p:void 0,min:null!=u?u:void 0,disabled:c,readOnly:m,onblur:this._onComponentBlur,required:s,placeholder:v,value:b?"":o??"",[S]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(S))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,D(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(m(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:o}=t.template;if(!t)return;const n=t?.value;if(m(t.template,"switch")&&"single"!==this.viewModel.mode){const e=i(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?n:e)}const a=this._parseValue(e,t);a!==n&&this.viewModel.setValue(o,a)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,o=e.field.type,n=this._dateComponentMap.get(`${i}`);if(!n)return;const a=e.effectiveTimeZone;let s=e.value===C?void 0:e.value,r=null;"date-only"===o?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===o?(s=I(s),r=I(t.value)):r="timestamp-offset"===o?null!=t.value?x({dateComponent:n.date,timeComponent:n.time,oldValue:s,timeZoneComponent:n.timeZone,defaultTimeZone:a}):null:null!=t.value?M({oldValue:s,dateComponent:n.date,timeZone:a,timeComponent:n.time?.value===C?void 0:n.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([a()],E.prototype,"activeFeatureIndex",null),e([a()],E.prototype,"disabled",null),e([a()],E.prototype,"_effectiveDisabled",null),e([a()],E.prototype,"features",null),e([a()],E.prototype,"map",null),e([a()],E.prototype,"maximumFeatureCount",null),e([a()],E.prototype,"maximumFeatureCountWithComplexForms",null),e([a()],E.prototype,"spatialReference",null),e([a()],E.prototype,"layerInfos",null),e([a()],E.prototype,"timeZone",null),e([a()],E.prototype,"headingLevel",void 0),e([a()],E.prototype,"icon",null),e([a(),O("esri/t9n/common")],E.prototype,"messagesCommon",void 0),e([a(),O("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],E.prototype,"messages",void 0),e([a(),O("esri/widgets/FeatureForm/t9n/FeatureForm")],E.prototype,"featureFormMessages",void 0),e([a()],E.prototype,"readOnly",null),e([a()],E.prototype,"valid",null),e([a({type:c}),T(["value-change","submit"])],E.prototype,"viewModel",void 0),e([a({type:v,nonNullable:!0})],E.prototype,"visibleElements",void 0),e([a()],E.prototype,"groupDisplay",void 0),E=e([s("esri.widgets.BatchAttributeForm")],E);const R=E;export{R 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import s from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import{deprecateUnnecessaryViewModel as r}from"../../core/deprecate.js";import l from"../../core/Logger.js";import{isAbortError as o}from"../../core/promiseUtils.js";import{watch as a,whenOnce as n}from"../../core/reactiveUtils.js";import{property as p,subclass as d}from"../../core/accessorSupport/decorators.js";import y from"../../layers/BuildingSceneLayer.js";import h from"../../layers/support/BuildingFilter.js";import c from"./BuildingDisciplinesViewModel.js";import u from"./BuildingLevel.js";import g from"./BuildingPhase.js";import{showFullModel as m}from"./support/buildingLayerUtils.js";import{setFilterOnLayers as f,getFilterBlockSolid as v,getFilterBlockXRay as w,generateFilterId as j}from"./support/filterUtils.js";import{createLoadLayersFunction as _}from"./support/layerUtils.js";let L=class extends t{constructor(e){super(e),this.view=null,this.state="disabled",this.level=new u({isDefaultViewModel:!0}),this.phase=new g({isDefaultViewModel:!0}),this.disciplines=new c,this._loadLayers=_(),e?.isDefaultViewModel||r(l.getLogger(this),"Building Explorer","arcgis-building-explorer",{version:"5.0"}),this.layers=new s}normalizeCtorArgs(e){const{isDefaultViewModel:t,...s}=e??{};return s}initialize(){this.addHandles([this.layers.on("change",()=>this._onLayersChange()),a(()=>({state:this.state,layers:this.layers,filter:this._filter}),({state:e,layers:t,filter:s})=>{"ready"===e&&f(t,s)},{initial:!0})]),this._onLayersChange()}destroy(){this.level.destroyed||this.level.destroy(),this.phase.destroyed||this.phase.destroy(),this.disciplines.destroyed||this.disciplines.destroy()}get isSupported(){return"3d"===this.view?.type}get layers(){return this._get("layers")}set layers(e){const t=e.filter(e=>e instanceof y);t.length!==e.length&&l.getLogger(this).error("Some layers are not BuildingSceneLayers but only BuildingSceneLayers can be passed to the widget."),this._set("layers",i(t,this._get("layers")))}get _filter(){const e=this.level.filterExpressions,t=this.phase.filterExpressions,s=[],i=v([e.solid,t.solid]);null!=i&&s.push(i);const r=w([e.xRay,t.xRay]);return null!=r&&s.push(r),0===s.length?null:new h({id:j(),name:"Building Explorer Filter",filterBlocks:s})}async _onLayersChange(){const e=this.layers;if(this.level.layers=e,this.phase.layers=e,this.disciplines.layers=e,0!==e.length){this._set("state","loading");try{await this._loadLayers(e),await Promise.all([n(()=>"ready"===this.level.state),n(()=>"ready"===this.phase.state),n(()=>"ready"===this.disciplines.state)]),e.forEach(m),this._set("state","ready")}catch(t){o(t)||this._set("state","failed")}}else this._set("state","disabled")}};e([p({value:null})],L.prototype,"view",void 0),e([p()],L.prototype,"isSupported",null),e([p({type:s,nonNullable:!0})],L.prototype,"layers",null),e([p({readOnly:!0})],L.prototype,"state",void 0),e([p({readOnly:!0,type:u})],L.prototype,"level",void 0),e([p({readOnly:!0,type:g})],L.prototype,"phase",void 0),e([p({readOnly:!0,type:c})],L.prototype,"disciplines",void 0),e([p()],L.prototype,"_filter",null),L=e([d("esri.widgets.BuildingExplorer.BuildingExplorerViewModel")],L);const B=L;export{B as default};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import s from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import{deprecateUnnecessaryViewModel as r}from"../../core/deprecate.js";import l from"../../core/Logger.js";import{isAbortError as o}from"../../core/promiseUtils.js";import{watch as a,whenOnce as n}from"../../core/reactiveUtils.js";import{property as p,subclass as d}from"../../core/accessorSupport/decorators.js";import y from"../../layers/BuildingSceneLayer.js";import h from"../../layers/support/BuildingFilter.js";import c from"./BuildingDisciplinesViewModel.js";import u from"./BuildingLevel.js";import g from"./BuildingPhase.js";import{showFullModel as m}from"./support/buildingLayerUtils.js";import{setFilterOnLayers as f,getFilterBlockSolid as v,getFilterBlockXRay as w,generateFilterId as j}from"./support/filterUtils.js";import{createLoadLayersFunction as _}from"./support/layerUtils.js";let L=class extends t{constructor(e){super(e),this.view=null,this.state="disabled",this.level=new u({isDefaultViewModel:!0}),this.phase=new g({isDefaultViewModel:!0}),this.disciplines=new c,this._loadLayers=_(),e?.isDefaultViewModel||r(l.getLogger(this),"Building Explorer","arcgis-building-explorer",{version:"5.0"}),this.layers=new s}normalizeCtorArgs(e){const{isDefaultViewModel:t,...s}=e??{};return s}initialize(){this.addHandles([this.layers.on("change",()=>this._onLayersChange()),a(()=>({state:this.state,layers:this.layers,filter:this._filter}),({state:e,layers:t,filter:s})=>{"ready"===e&&f(t,s)},{initial:!0})]),this._onLayersChange()}destroy(){this.level.destroyed||this.level.destroy(),this.phase.destroyed||this.phase.destroy(),this.disciplines.destroyed||this.disciplines.destroy()}get isSupported(){return"3d"===this.view?.type}get layers(){return this._get("layers")}set layers(e){const t=e.filter(e=>e instanceof y);t.length!==e.length&&l.getLogger(this).error("Some layers are not BuildingSceneLayers but only BuildingSceneLayers can be passed to the widget."),this._set("layers",i(t,this._get("layers")))}get _filter(){const e=this.level.filterExpressions,t=this.phase.filterExpressions,s=[],i=v([e.solid,t.solid]);null!=i&&s.push(i);const r=w([e.xRay,t.xRay]);return null!=r&&s.push(r),0===s.length?null:new h({id:j(),name:"Building Explorer Filter",filterBlocks:s})}async _onLayersChange(){const e=this.layers;if(this.level.layers=e,this.phase.layers=e,this.disciplines.layers=e,0!==e.length){this._set("state","loading");try{await this._loadLayers(e),await Promise.all([n(()=>"ready"===this.level.state),n(()=>"ready"===this.phase.state),n(()=>"ready"===this.disciplines.state)]),e.forEach(m),this._set("state","ready")}catch(t){o(t)||this._set("state","failed")}}else this._set("state","disabled")}};e([p({value:null})],L.prototype,"view",void 0),e([p()],L.prototype,"isSupported",null),e([p({type:s.ofType(y),nonNullable:!0})],L.prototype,"layers",null),e([p({readOnly:!0})],L.prototype,"state",void 0),e([p({readOnly:!0,type:u})],L.prototype,"level",void 0),e([p({readOnly:!0,type:g})],L.prototype,"phase",void 0),e([p({readOnly:!0,type:c})],L.prototype,"disciplines",void 0),e([p()],L.prototype,"_filter",null),L=e([d("esri.widgets.BuildingExplorer.BuildingExplorerViewModel")],L);const B=L;export{B 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{getAssetUrl as e}from"../../assets.js";import o from"../../Graphic.js";import{fetchMessageBundle as i,onLocaleChange as s,getLocale as n}from"../../intl.js";import r from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as h}from"../../core/Evented.js";import c from"../../core/Logger.js";import{watch as d,initial as l,when as m}from"../../core/reactiveUtils.js";import{property as v,cast as p,subclass as u}from"../../core/accessorSupport/decorators.js";import f from"../../geometry/Point.js";import{load as g}from"../../geometry/projectionUtils.js";import w from"../../symbols/PictureMarkerSymbol.js";import{pointSymbolTypes as _}from"../../symbols/support/typeUtils.js";import y from"./support/Conversion.js";import{isValidPoint as C,isSupportedNotation as b}from"./support/coordinateConversionUtils.js";import L from"./support/Format.js";import{generateDefaultFormats as M,setDefaultPatterns as P}from"./support/formatUtils.js";import{GoTo as S}from"../support/GoTo.js";const j=new f([0,0,500]),H="xy",F=["mgrs","utm","usng","dd","dms","ddm"],G="esri__coordinateConversionWidgetState",x={conversions:"conversions",formats:"formats",view:"view",viewChange:"view-change",cursor:"cursor"},E="esri/images/search/search-symbol-32.png";let T=class extends(S(h)){constructor(t){super(t),this._conversionPromise=null,this._locationGraphic=null,this._pointerCount=0,this.conversions=new r,this.formats=new r,this.formatterAvailable=!1,this.messages=null,this.filteredFormats=new r,this.locationSymbol=new w({url:e(E),width:24,height:24}),this.storageEnabled=!0,this.storageType="session",this.view=null,this._saveWidgetState=this._saveWidgetState.bind(this),this._handleFormatChange=this._handleFormatChange.bind(this),this._handleConversionChange=this._handleConversionChange.bind(this),this._handleViewChange=this._handleViewChange.bind(this),this._onClick=this._onClick.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this)}initialize(){const t=async()=>this.messages=await i("esri/widgets/CoordinateConversion/t9n/CoordinateConversion");this.formats.addMany(M()),t().then(()=>{if(!this.destroyed&&(P(this.messages,this.formats),this.storageEnabled&&this._loadWidgetState(),this.formats.forEach(t=>{t.viewModel=this,this.addHandles(d(()=>t.currentPattern,this._saveWidgetState),t.name??"unnamed-format")}),this.addHandles(this.conversions.on("change",this._handleConversionChange),x.conversions),this.addHandles(this.formats.on("change",this._handleFormatChange),x.formats),this.addHandles(s(()=>{t().then(()=>{P(this.messages,this.formats)})})),g().then(()=>{this.formatterAvailable=!0}).catch(t=>{c.getLogger(this).error(new a("coordinate-conversion:projection-load-failed","Failed to load the projection module.",{error:t})),this.formatterAvailable=!1,this._filterFormatsAndConversions()}).then(()=>this.addHandles(d(()=>this.view,this._handleViewChange,l),x.viewChange)),0===this.conversions.length)){const t=this.formats.find(t=>t.name===H)||this.formats.at(0);this.conversions.add(new y({format:t}))}})}destroy(){this.removeHandles(),this._cleanUpView(this.view),this.view=null}castConversions(t){return this._castToConversions(t)}set currentLocation(t){this._set("currentLocation",t),this._updateConversions()}get currentLocation(){return this._get("currentLocation")||null}set mode(t){switch(t){case"capture":this.currentLocation=null,this._startCaptureMode(),this._set("mode",t);break;case"live":this._startLiveMode(),this._set("mode",t)}}get mode(){return this._get("mode")||"live"}get state(){const{messages:t,view:e}=this,o=e?.ready;return t?o?"ready":e?"loading":"disabled":"disabled"}get storage(){const{storageType:t}=this;return"session"===t?sessionStorage:localStorage}get waitingForConversions(){return null!=this._conversionPromise}setLocation(t){if(this._locationGraphic&&this.view?.graphics.remove(this._locationGraphic),!t)return;const e=t.clone();e.hasZ&&(e.z=void 0),this._locationGraphic=new o({geometry:e,symbol:this.locationSymbol}),this.view?.graphics.add(this._locationGraphic)}async convert(t,e){if(!C(e))throw new a("coordinate-conversion:invalid-point","Invalid point cannot be converted.",{point:e});return Promise.resolve().then(()=>t.convert(e))}async goToLocation(t){const{view:e}=this;if(!e)throw new a("coordinate-conversion:go-to-failed","no view");const o="3d"===e.type?e.clippingArea:null,i=e.map?.basemap?.baseLayers;if(o||(i?.length??0)>0){const e=o??i?.at(0)?.fullExtent;if(null!=e&&!e.contains(t))throw new a("coordinate-conversion:go-to-failed","Point outside basemap extent.",{point:t})}return this.callGoTo({target:t})}pause(){this.currentLocation=null,this.removeHandles(x.view),this.view&&(this.removeHandles(x.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic))}async previewConversion(t,e=this.currentLocation||j){return(await W(t,e)).displayCoordinate}resume(){"capture"===this.mode?this._startCaptureMode():this._startLiveMode()}reverseConvert(t,e){return e.reverseConvert(t)}async updateConversions(t,e){if("point"!==e?.type)throw this._clearConversions(this.conversions),new a("coordinate-conversion:invalid-input-point","Point is invalid, conversions cannot be updated.",{point:e});return this._convertMany(t,e)}_castToConversions(t){const e=new r;return t.forEach(t=>{let o=null;if(t instanceof y)o=t;else if("string"==typeof t){const e=this.formats.find(e=>e.name===t);e&&(o=new y({format:e}))}o&&e.add(o)}),e}_cleanUpView(t){t&&(this._locationGraphic&&t.graphics.remove(this._locationGraphic),this.removeHandles(x.view),this.removeHandles(x.cursor))}_clearConversions(t){t.forEach(t=>{t.position={location:null,coordinate:null}})}async _convertMany(t,e){return Promise.all(t.map(t=>W(t,e)))}_handleConversionChange(t){for(const e of t.added){const{format:t}=e;t&&(t.viewModel=this,this.currentLocation&&(this._set("waitingForConversions",!0),this.convert(t,this.currentLocation).then(t=>{e.position=t,this._set("waitingForConversions",!1)})))}this._saveWidgetState()}_handleFormatChange(t){t.added.forEach(t=>{this.addHandles(d(()=>t.currentPattern,this._saveWidgetState),t.name??"unnamed-format"),t.viewModel=this}),t.removed.forEach(t=>{t.viewModel=null;const e=this.conversions.filter(e=>e.format===t);this.conversions.removeMany(e),t.name&&this.removeHandles(t.name)})}_loadWidgetState(){try{const t=JSON.parse(this.storage.getItem(G));t&&this._setWidgetState(t)}catch(t){c.getLogger(this).error(new a("coordinate-conversion:invalid-session-storage-json","Could not read from storage.",{error:t}))}}_startCaptureMode(){this.removeHandles(x.view),this.view&&(this.currentLocation&&this.setLocation(this.currentLocation),this.removeHandles(x.cursor),this.addHandles(this.view.acquireCursor("crosshair","high"),x.cursor),this.addHandles(this.view.on("click",this._onClick),x.view))}_startLiveMode(){this._pointerCount=0,this.removeHandles(x.view),this.view&&(this.removeHandles(x.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic),this.addHandles([this.view.on("pointer-down",this._onPointerDown),this.view.on("pointer-up",this._onPointerUp),this.view.on("pointer-move",this._onPointerMove)],x.view))}_handleViewChange(t,e){e&&e!==t&&this._cleanUpView(e),t&&("capture"===this.mode?this._startCaptureMode():this._startLiveMode(),e&&this._filterFormatsAndConversions())}_onClick(t){if(0===t.button){const e=this.view?.toMap(t),o=e?.normalize();this.setLocation(o),this.currentLocation=o}}_onPointerDown(t){const{pointerType:e}=t;if(this._pointerCount++,("touch"===e||"pen"===e)&&1===this._pointerCount){const e=this.view?.toMap(t);this.currentLocation=e?.normalize()}}_onPointerMove(t){const{pointerType:e}=t;if("mouse"===e||1===this._pointerCount){const e=this.view?.toMap(t);this.currentLocation=e?.normalize()}}_onPointerUp(){this._pointerCount--}_setWidgetState(t){try{t.formats.forEach(e=>{const o=this.formats.find(t=>t.name===e.name);o&&t.locale===n()&&e.currentPattern&&(o.currentPattern=e.currentPattern),o&&e.index>=0&&this.conversions.add(new y({format:o}))})}catch(e){c.getLogger(this).warn(new a("coordinate-conversion:session-storage-read-error","Could not get state from stored JSON.",{error:e}))}}_saveWidgetState(){if(!this.storageEnabled)return;const t=this._toJSON();try{this.storage.setItem(G,JSON.stringify({formats:t,locale:n()}))}catch(e){c.getLogger(this).error(new a("coordinate-conversion:local-storage-write-error","Could not write to localStorage.",{error:e}))}}async _updateConversions(){try{await this.updateConversions(this.conversions.toArray(),this.currentLocation)}catch{}}_toJSON(){return this.formats.filter(t=>{const e=t.name;return"xy"===e||"basemap"===e||b(e)}).map(t=>({name:t.name,currentPattern:t.currentPattern,defaultPattern:t.defaultPattern,index:this.conversions.findIndex(e=>e.format===t)})).sort((t,e)=>t.index-e.index).toArray()}_filterFormatsAndConversions(){const{formatterAvailable:t,conversions:e,formats:o}=this;t||this.addHandles(m(()=>this.view?.spatialReference,t=>{const i=t.isWebMercator||t.isWGS84,s=o.filter(t=>{const{name:e}=t;return!!U(e)||"xy"===e&&!i}),n=this.filteredFormats.filter(t=>"xy"===t.name&&i&&!this.formats.includes(t)),r=e.filter(t=>s.includes(t.format));o.removeMany(s),e.removeMany(r),this.filteredFormats.addMany(s.filter(t=>!this.filteredFormats.includes(t))),o.addMany(n)},{once:!0,initial:!0}),x.view)}};async function W(t,e){try{t.position=await(t.format?.convert(e))}catch(o){t.position=null}return t}function U(t){return F.includes(t)}t([v({type:r.ofType(y)})],T.prototype,"conversions",void 0),t([p("conversions")],T.prototype,"castConversions",null),t([v({type:f})],T.prototype,"currentLocation",null),t([v({type:r.ofType(L)})],T.prototype,"formats",void 0),t([v()],T.prototype,"messages",void 0),t([v()],T.prototype,"mode",null),t([v()],T.prototype,"filteredFormats",void 0),t([v({readOnly:!0})],T.prototype,"state",null),t([v({types:_})],T.prototype,"locationSymbol",void 0),t([v({readOnly:!0,dependsOn:["storageType"]})],T.prototype,"storage",null),t([v()],T.prototype,"storageEnabled",void 0),t([v()],T.prototype,"storageType",void 0),t([v({readOnly:!0})],T.prototype,"waitingForConversions",null),t([v()],T.prototype,"view",void 0),T=t([u("esri.widgets.CoordinateConversion.CoordinateConversionViewModel")],T);const A=T;export{A as default};
5
+ import{__decorate as t}from"tslib";import{getAssetUrl as e}from"../../assets.js";import o from"../../Graphic.js";import{fetchMessageBundle as i,onLocaleChange as s,getLocale as r}from"../../intl.js";import n from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as h}from"../../core/Evented.js";import c from"../../core/Logger.js";import{watch as d,initial as l,when as m}from"../../core/reactiveUtils.js";import{property as v,subclass as p}from"../../core/accessorSupport/decorators.js";import{ensureType as u}from"../../core/accessorSupport/ensureType.js";import g from"../../geometry/Point.js";import{load as f}from"../../geometry/projectionUtils.js";import w from"../../symbols/PictureMarkerSymbol.js";import{pointSymbolTypes as _}from"../../symbols/support/typeUtils.js";import y from"./support/Conversion.js";import{isValidPoint as C,isSupportedNotation as b}from"./support/coordinateConversionUtils.js";import L from"./support/Format.js";import{generateDefaultFormats as M,setDefaultPatterns as P}from"./support/formatUtils.js";import{GoTo as S}from"../support/GoTo.js";const j=new g([0,0,500]),H="xy",F=["mgrs","utm","usng","dd","dms","ddm"],G="esri__coordinateConversionWidgetState",x={conversions:"conversions",formats:"formats",view:"view",viewChange:"view-change",cursor:"cursor"},E="esri/images/search/search-symbol-32.png";let W=class extends(S(h)){constructor(t){super(t),this._conversionPromise=null,this._locationGraphic=null,this._pointerCount=0,this.formats=new n,this.formatterAvailable=!1,this.messages=null,this.filteredFormats=new n,this.locationSymbol=new w({url:e(E),width:24,height:24}),this.storageEnabled=!0,this.storageType="session",this.view=null,this._saveWidgetState=this._saveWidgetState.bind(this),this._handleFormatChange=this._handleFormatChange.bind(this),this._handleConversionChange=this._handleConversionChange.bind(this),this._handleViewChange=this._handleViewChange.bind(this),this._onClick=this._onClick.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this.conversions=new n}initialize(){const t=async()=>this.messages=await i("esri/widgets/CoordinateConversion/t9n/CoordinateConversion");this.formats.addMany(M()),t().then(()=>{if(!this.destroyed&&(P(this.messages,this.formats),this.storageEnabled&&this._loadWidgetState(),this.formats.forEach(t=>{t.viewModel=this,this.addHandles(d(()=>t.currentPattern,this._saveWidgetState),t.name??"unnamed-format")}),this.addHandles(this.conversions.on("change",this._handleConversionChange),x.conversions),this.addHandles(this.formats.on("change",this._handleFormatChange),x.formats),this.addHandles(s(()=>{t().then(()=>{P(this.messages,this.formats)})})),f().then(()=>{this.formatterAvailable=!0}).catch(t=>{c.getLogger(this).error(new a("coordinate-conversion:projection-load-failed","Failed to load the projection module.",{error:t})),this.formatterAvailable=!1,this._filterFormatsAndConversions()}).then(()=>this.addHandles(d(()=>this.view,this._handleViewChange,l),x.viewChange)),0===this.conversions.length)){const t=this.formats.find(t=>t.name===H)||this.formats.at(0);this.conversions.add(new y({format:t}))}})}destroy(){this.removeHandles(),this._cleanUpView(this.view),this.view=null}get conversions(){return this._get("conversions")}set conversions(t){const e=new n;t.forEach(t=>{let o=null;if("string"==typeof t){const e=this.formats.find(e=>e.name===t);e&&(o=new y({format:e}))}else o=u(y,t);o&&e.add(o)}),this._set("conversions",e)}set currentLocation(t){this._set("currentLocation",t),this._updateConversions()}get currentLocation(){return this._get("currentLocation")||null}set mode(t){switch(t){case"capture":this.currentLocation=null,this._startCaptureMode(),this._set("mode",t);break;case"live":this._startLiveMode(),this._set("mode",t)}}get mode(){return this._get("mode")||"live"}get state(){const{messages:t,view:e}=this,o=e?.ready;return t?o?"ready":e?"loading":"disabled":"disabled"}get storage(){const{storageType:t}=this;return"session"===t?sessionStorage:localStorage}get waitingForConversions(){return null!=this._conversionPromise}setLocation(t){if(this._locationGraphic&&this.view?.graphics.remove(this._locationGraphic),!t)return;const e=t.clone();e.hasZ&&(e.z=void 0),this._locationGraphic=new o({geometry:e,symbol:this.locationSymbol}),this.view?.graphics.add(this._locationGraphic)}async convert(t,e){if(!C(e))throw new a("coordinate-conversion:invalid-point","Invalid point cannot be converted.",{point:e});return Promise.resolve().then(()=>t.convert(e))}async goToLocation(t){const{view:e}=this;if(!e)throw new a("coordinate-conversion:go-to-failed","no view");const o="3d"===e.type?e.clippingArea:null,i=e.map?.basemap?.baseLayers;if(o||(i?.length??0)>0){const e=o??i?.at(0)?.fullExtent;if(null!=e&&!e.contains(t))throw new a("coordinate-conversion:go-to-failed","Point outside basemap extent.",{point:t})}return this.callGoTo({target:t})}pause(){this.currentLocation=null,this.removeHandles(x.view),this.view&&(this.removeHandles(x.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic))}async previewConversion(t,e=this.currentLocation||j){return(await U(t,e)).displayCoordinate}resume(){"capture"===this.mode?this._startCaptureMode():this._startLiveMode()}reverseConvert(t,e){return e.reverseConvert(t)}async updateConversions(t,e){if("point"!==e?.type)throw this._clearConversions(this.conversions),new a("coordinate-conversion:invalid-input-point","Point is invalid, conversions cannot be updated.",{point:e});return this._convertMany(t,e)}_cleanUpView(t){t&&(this._locationGraphic&&t.graphics.remove(this._locationGraphic),this.removeHandles(x.view),this.removeHandles(x.cursor))}_clearConversions(t){t.forEach(t=>{t.position={location:null,coordinate:null}})}async _convertMany(t,e){return Promise.all(t.map(t=>U(t,e)))}_handleConversionChange(t){for(const e of t.added){const{format:t}=e;t&&(t.viewModel=this,this.currentLocation&&(this._set("waitingForConversions",!0),this.convert(t,this.currentLocation).then(t=>{e.position=t,this._set("waitingForConversions",!1)})))}this._saveWidgetState()}_handleFormatChange(t){t.added.forEach(t=>{this.addHandles(d(()=>t.currentPattern,this._saveWidgetState),t.name??"unnamed-format"),t.viewModel=this}),t.removed.forEach(t=>{t.viewModel=null;const e=this.conversions.filter(e=>e.format===t);this.conversions.removeMany(e),t.name&&this.removeHandles(t.name)})}_loadWidgetState(){try{const t=JSON.parse(this.storage.getItem(G));t&&this._setWidgetState(t)}catch(t){c.getLogger(this).error(new a("coordinate-conversion:invalid-session-storage-json","Could not read from storage.",{error:t}))}}_startCaptureMode(){this.removeHandles(x.view),this.view&&(this.currentLocation&&this.setLocation(this.currentLocation),this.removeHandles(x.cursor),this.addHandles(this.view.acquireCursor("crosshair","high"),x.cursor),this.addHandles(this.view.on("click",this._onClick),x.view))}_startLiveMode(){this._pointerCount=0,this.removeHandles(x.view),this.view&&(this.removeHandles(x.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic),this.addHandles([this.view.on("pointer-down",this._onPointerDown),this.view.on("pointer-up",this._onPointerUp),this.view.on("pointer-move",this._onPointerMove)],x.view))}_handleViewChange(t,e){e&&e!==t&&this._cleanUpView(e),t&&("capture"===this.mode?this._startCaptureMode():this._startLiveMode(),e&&this._filterFormatsAndConversions())}_onClick(t){if(0===t.button){const e=this.view?.toMap(t),o=e?.normalize();this.setLocation(o),this.currentLocation=o}}_onPointerDown(t){const{pointerType:e}=t;if(this._pointerCount++,("touch"===e||"pen"===e)&&1===this._pointerCount){const e=this.view?.toMap(t);this.currentLocation=e?.normalize()}}_onPointerMove(t){const{pointerType:e}=t;if("mouse"===e||1===this._pointerCount){const e=this.view?.toMap(t);this.currentLocation=e?.normalize()}}_onPointerUp(){this._pointerCount--}_setWidgetState(t){try{t.formats.forEach(e=>{const o=this.formats.find(t=>t.name===e.name);o&&t.locale===r()&&e.currentPattern&&(o.currentPattern=e.currentPattern),o&&e.index>=0&&this.conversions.add(new y({format:o}))})}catch(e){c.getLogger(this).warn(new a("coordinate-conversion:session-storage-read-error","Could not get state from stored JSON.",{error:e}))}}_saveWidgetState(){if(!this.storageEnabled)return;const t=this._toJSON();try{this.storage.setItem(G,JSON.stringify({formats:t,locale:r()}))}catch(e){c.getLogger(this).error(new a("coordinate-conversion:local-storage-write-error","Could not write to localStorage.",{error:e}))}}async _updateConversions(){try{await this.updateConversions(this.conversions.toArray(),this.currentLocation)}catch{}}_toJSON(){return this.formats.filter(t=>{const e=t.name;return"xy"===e||"basemap"===e||b(e)}).map(t=>({name:t.name,currentPattern:t.currentPattern,defaultPattern:t.defaultPattern,index:this.conversions.findIndex(e=>e.format===t)})).sort((t,e)=>t.index-e.index).toArray()}_filterFormatsAndConversions(){const{formatterAvailable:t,conversions:e,formats:o}=this;t||this.addHandles(m(()=>this.view?.spatialReference,t=>{const i=t.isWebMercator||t.isWGS84,s=o.filter(t=>{const{name:e}=t;return!!T(e)||"xy"===e&&!i}),r=this.filteredFormats.filter(t=>"xy"===t.name&&i&&!this.formats.includes(t)),n=e.filter(t=>s.includes(t.format));o.removeMany(s),e.removeMany(n),this.filteredFormats.addMany(s.filter(t=>!this.filteredFormats.includes(t))),o.addMany(r)},{once:!0,initial:!0}),x.view)}};async function U(t,e){try{t.position=await(t.format?.convert(e))}catch(o){t.position=null}return t}function T(t){return F.includes(t)}t([v()],W.prototype,"conversions",null),t([v({type:g})],W.prototype,"currentLocation",null),t([v({type:n.ofType(L)})],W.prototype,"formats",void 0),t([v()],W.prototype,"messages",void 0),t([v()],W.prototype,"mode",null),t([v()],W.prototype,"filteredFormats",void 0),t([v({readOnly:!0})],W.prototype,"state",null),t([v({types:_})],W.prototype,"locationSymbol",void 0),t([v({readOnly:!0,dependsOn:["storageType"]})],W.prototype,"storage",null),t([v()],W.prototype,"storageEnabled",void 0),t([v()],W.prototype,"storageType",void 0),t([v({readOnly:!0})],W.prototype,"waitingForConversions",null),t([v()],W.prototype,"view",void 0),W=t([p("esri.widgets.CoordinateConversion.CoordinateConversionViewModel")],W);const A=W;export{A as default};