@arcgis/core 4.33.0-next.20250209 → 4.33.0-next.20250211

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 (279) hide show
  1. package/AttributeBinsGraphic.js +1 -1
  2. package/Graphic.js +1 -1
  3. package/Ground.js +1 -1
  4. package/WebMap.js +1 -1
  5. package/WebScene.js +1 -1
  6. package/arcade/ArcadeModuleResolver.js +1 -1
  7. package/arcade/featureset/actions/Adapted.js +1 -1
  8. package/arcade/featureset/support/FeatureSet.js +1 -1
  9. package/arcade/featureset/support/Guid.js +1 -1
  10. package/arcade/featureset/support/cache.js +1 -1
  11. package/assets/esri/core/workers/RemoteClient.js +1 -1
  12. package/assets/esri/core/workers/chunks/{d31f7598629f7cc50233.js → 004853abf357f865b4fa.js} +1 -1
  13. package/assets/esri/core/workers/chunks/00e374e3b4781c4f9a3e.js +1 -0
  14. package/assets/esri/core/workers/chunks/{746c964cf07e4306f21f.js → 03f51ea011ffbcfb7c7d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{ad3e692681b50bd1acc2.js → 03fac4c79641603d8cba.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{0167cf867d8e46c818b0.js → 09260bbe1fd6ce5a53e6.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{d1718ad93e3271b0525e.js → 0e4350fda5328862f2fb.js} +1 -1
  18. package/assets/esri/core/workers/chunks/12199e8abf377ffc27cd.js +1 -0
  19. package/assets/esri/core/workers/chunks/1a286d43daa3b811c30d.js +1 -0
  20. package/assets/esri/core/workers/chunks/{e5e3b6d00d27b5bb354f.js → 1d282700e76285a1684c.js} +1 -1
  21. package/assets/esri/core/workers/chunks/2130e0c8d2410c87f880.js +1 -0
  22. package/assets/esri/core/workers/chunks/2530e5d1f438db8a7b5c.js +1 -0
  23. package/assets/esri/core/workers/chunks/{dfaf1da323906ee60549.js → 2876419a32537e24b7da.js} +1 -1
  24. package/assets/esri/core/workers/chunks/2b733e8043659466e194.js +1 -0
  25. package/assets/esri/core/workers/chunks/311c85bd94d5fb28e272.js +1 -0
  26. package/assets/esri/core/workers/chunks/33c6fd524711efd8ef13.js +1 -0
  27. package/assets/esri/core/workers/chunks/{594d923400fd74881833.js → 35392bf8f21005ad6170.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{de1f3c4b8000c2d73013.js → 39dca492cc5f089e1609.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{5b85f9da022742f602e2.js → 3c8e5b5fb52611e30ed6.js} +1 -1
  30. package/assets/esri/core/workers/chunks/491effb2c681493cc3a6.js +1 -0
  31. package/assets/esri/core/workers/chunks/{e93dea6b112ce8e2779b.js → 4b47549614d53ce1e384.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{369a2b8484a8807bde38.js → 4be5e453fe54f5631659.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{2971266a49226e769360.js → 5e5045add6567588b90a.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{5721557a1d8eab23a55b.js → 5eceedac9b2b4d1ef133.js} +1 -1
  35. package/assets/esri/core/workers/chunks/6a9a1cd8134a903dd05a.js +1 -0
  36. package/assets/esri/core/workers/chunks/6c9bb00f33649ab59dab.js +314 -0
  37. package/assets/esri/core/workers/chunks/7485588bd24217669578.js +1 -0
  38. package/assets/esri/core/workers/chunks/74e0116ae84def626c87.js +1 -0
  39. package/assets/esri/core/workers/chunks/{c4374b6bc5c8dc6435c7.js → 7c81e08fc8a67dcd9dad.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{433576983754f690bcc7.js → 7e3b374f906441cd7fb0.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{8c32cee395da0a7b9a8e.js → 80d3aa3f27ad5b2b969b.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{de4384b5833a60e88e31.js → 84c1c3336011a1b79669.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{9d61590c4d21c7421925.js → 88a34690480d3658bad8.js} +1 -1
  44. package/assets/esri/core/workers/chunks/8939479cd433cc53f6c1.js +1 -0
  45. package/assets/esri/core/workers/chunks/{28dd172faa85080511c5.js → 8a2f3ce46eeac853b3a9.js} +1 -1
  46. package/assets/esri/core/workers/chunks/8b6580329e1e35ea4190.js +1 -0
  47. package/assets/esri/core/workers/chunks/8bfeef7cffe1e65c9dab.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b44cf0e4c2f93408cabc.js → 9205115bdb5bc03d0c02.js} +1 -1
  49. package/assets/esri/core/workers/chunks/92d76d59113b4139befe.js +1 -0
  50. package/assets/esri/core/workers/chunks/9421ae38fdf986b9b107.js +1 -0
  51. package/assets/esri/core/workers/chunks/99c136b800e5fc7e04f4.js +1 -0
  52. package/assets/esri/core/workers/chunks/{d339dee99c4820b63f39.js → 9b74635d80d029498da1.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{c2336d1f5b2b7bf6e7a7.js → 9bd6a4bf8150a6f618ea.js} +1 -1
  54. package/assets/esri/core/workers/chunks/9e7895e8201127ffe0a8.js +1 -0
  55. package/assets/esri/core/workers/chunks/{15e08e8a8a72b177d74c.js → a38cb1fff519bad8abe3.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{7b367bb0ed9c218ca595.js → a52690a27f8732739c02.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{cdd8983cf3a301805680.js → a52c282609a7e9c8ca9e.js} +1 -1
  58. package/assets/esri/core/workers/chunks/a56b3dffd9f38973f350.js +1 -0
  59. package/assets/esri/core/workers/chunks/a9274c9132e7a2691abb.js +1 -0
  60. package/assets/esri/core/workers/chunks/b253cf42e53f957b4b4e.js +1 -0
  61. package/assets/esri/core/workers/chunks/b50176897ffadc53573e.js +1 -0
  62. package/assets/esri/core/workers/chunks/{c26ffbff1115e76bcb0f.js → baee20c14763bef80b09.js} +1 -1
  63. package/assets/esri/core/workers/chunks/c3dc355d0f8d89b9b7b8.js +1 -0
  64. package/assets/esri/core/workers/chunks/c77ade444aa2f3f2b599.js +1 -0
  65. package/assets/esri/core/workers/chunks/c7927c2d5414f19defd5.js +1 -0
  66. package/assets/esri/core/workers/chunks/ca6180e572e69540c183.js +1 -0
  67. package/assets/esri/core/workers/chunks/{16f82e9d98371431b46d.js → cc085918c63da416e59d.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{8e90c5fee4ad7c7275dc.js → cccd215b0a4890551957.js} +1 -1
  69. package/assets/esri/core/workers/chunks/ce88224af357957dd83a.js +1 -0
  70. package/assets/esri/core/workers/chunks/{07c5f3fc475c57f5a7a7.js → cf00df122df3db3b0c23.js} +1 -1
  71. package/assets/esri/core/workers/chunks/d074c916b414432a7b6a.js +1 -0
  72. package/assets/esri/core/workers/chunks/d342c56558f164e9e786.js +1 -0
  73. package/assets/esri/core/workers/chunks/{3c591f76e7d6204b7780.js → d3f7ff03ab5b40062d89.js} +1 -1
  74. package/assets/esri/core/workers/chunks/e03e237e7e6ffc8b7f0d.js +1 -0
  75. package/assets/esri/core/workers/chunks/{0b62871b89dcb4c70457.js → e21941260bae30061c2c.js} +1 -1
  76. package/assets/esri/core/workers/chunks/e6633f0326a44477f630.js +1 -0
  77. package/assets/esri/core/workers/chunks/e71b780d1e6a32f303b7.js +1 -0
  78. package/assets/esri/core/workers/chunks/eac28b0f6fccfabcc3ca.js +1 -0
  79. package/assets/esri/core/workers/chunks/{01c3507d78398baaf61b.js → eb0ce7937813d1be1284.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{f198f4ba7d3d52882d98.js → efded84870064c3d8210.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{c8a0089e080140db9076.js → f285ed5425b31123d2bc.js} +1 -1
  82. package/assets/esri/core/workers/chunks/f4ba823c8acd60c7c82d.js +1 -0
  83. package/core/Accessor.js +1 -1
  84. package/core/Collection.js +1 -1
  85. package/core/Logger.js +1 -1
  86. package/core/ObjectPool.js +1 -1
  87. package/core/RandomLCG.js +1 -1
  88. package/core/XHRAdapter.js +1 -1
  89. package/core/accessorSupport/watch.js +1 -1
  90. package/core/pbf.js +1 -1
  91. package/core/sql/UnknownTimeZone.js +1 -1
  92. package/core/workers/RemoteClient.js +1 -1
  93. package/geometry/SpatialReference.js +1 -1
  94. package/geometry/support/MeshGeoreferencedVertexSpace.js +1 -1
  95. package/geometry/support/MeshTexture.js +1 -1
  96. package/geometry/support/MeshTransform.js +1 -1
  97. package/geometry/support/buffer/BufferPool.js +1 -1
  98. package/geometry/support/buffer/BufferView.js +1 -1
  99. package/geometry/support/buffer/internals/Mat3.js +1 -1
  100. package/geometry/support/buffer/internals/Mat4.js +1 -1
  101. package/geometry/support/buffer/internals/Scalar.js +1 -1
  102. package/geometry/support/buffer/internals/Vec2.js +1 -1
  103. package/geometry/support/buffer/internals/Vec3.js +1 -1
  104. package/geometry/support/buffer/internals/Vec4.js +1 -1
  105. package/geometry/support/meshUtils/exporters/gltf/glb.js +1 -1
  106. package/identity/OAuthInfo.js +1 -1
  107. package/interfaces.d.ts +7 -1
  108. package/layers/mixins/EditBusLayer.js +1 -1
  109. package/layers/mixins/PublishableLayer.js +1 -1
  110. package/layers/support/AggregateField.js +1 -1
  111. package/layers/support/CodedValueDomain.js +1 -1
  112. package/layers/support/Field.js +1 -1
  113. package/layers/support/ImageElement.js +1 -1
  114. package/layers/support/InheritedDomain.js +1 -1
  115. package/layers/support/LOD.js +1 -1
  116. package/layers/support/LabelClass.js +1 -1
  117. package/layers/support/LabelExpressionInfo.js +1 -1
  118. package/layers/support/OrderByInfo.js +1 -1
  119. package/layers/support/PurgeOptions.js +1 -1
  120. package/layers/support/RangeDomain.js +1 -1
  121. package/layers/support/Sublayer.js +1 -1
  122. package/layers/support/TileInfo.js +1 -1
  123. package/layers/support/TilemapCache.js +1 -1
  124. package/layers/support/VideoElement.js +1 -1
  125. package/layers/support/source/DataLayerSource.js +1 -1
  126. package/package.json +1 -1
  127. package/portal/Portal.js +1 -1
  128. package/rest/support/AttachmentQuery.js +1 -1
  129. package/rest/support/ClosestFacilityParameters.js +1 -1
  130. package/rest/support/DirectionLine.js +1 -1
  131. package/rest/support/DirectionPoint.js +1 -1
  132. package/rest/support/JobInfo.js +1 -1
  133. package/rest/support/NetworkFeatureSet.js +1 -1
  134. package/rest/support/PointBarrier.js +1 -1
  135. package/rest/support/PolygonBarrier.js +1 -1
  136. package/rest/support/PolylineBarrier.js +1 -1
  137. package/rest/support/Query.js +1 -1
  138. package/rest/support/RelationshipQuery.js +1 -1
  139. package/rest/support/RouteInfo.js +1 -1
  140. package/rest/support/RouteParameters.js +1 -1
  141. package/rest/support/ServiceAreaParameters.js +1 -1
  142. package/rest/support/Stop.js +1 -1
  143. package/rest/support/TopFeaturesQuery.js +1 -1
  144. package/support/revision.js +1 -1
  145. package/symbols/ExtrudeSymbol3DLayer.js +1 -1
  146. package/symbols/FillSymbol3DLayer.js +1 -1
  147. package/symbols/IconSymbol3DLayer.js +1 -1
  148. package/symbols/LineSymbol3DLayer.js +1 -1
  149. package/symbols/ObjectSymbol3DLayer.js +1 -1
  150. package/symbols/PathSymbol3DLayer.js +1 -1
  151. package/symbols/TextSymbol3DLayer.js +1 -1
  152. package/symbols/WaterSymbol3DLayer.js +1 -1
  153. package/symbols/cim/OverrideHelper.js +1 -1
  154. package/symbols/cim/effects/EffectAddControlPoints.js +1 -1
  155. package/symbols/cim/effects/EffectArrow.js +1 -1
  156. package/symbols/cim/effects/EffectBuffer.js +1 -1
  157. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  158. package/symbols/cim/effects/EffectCut.js +1 -1
  159. package/symbols/cim/effects/EffectDashes.js +1 -1
  160. package/symbols/cim/effects/EffectDonut.js +1 -1
  161. package/symbols/cim/effects/EffectJog.js +1 -1
  162. package/symbols/cim/effects/EffectMove.js +1 -1
  163. package/symbols/cim/effects/EffectOffset.js +1 -1
  164. package/symbols/cim/effects/EffectReverse.js +1 -1
  165. package/symbols/cim/effects/EffectRotate.js +1 -1
  166. package/symbols/cim/effects/EffectScale.js +1 -1
  167. package/symbols/cim/effects/EffectWave.js +1 -1
  168. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  169. package/symbols/cim/placements/PlacementAtExtremities.js +1 -1
  170. package/symbols/cim/placements/PlacementAtRatioPositions.js +1 -1
  171. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  172. package/symbols/cim/placements/PlacementOnLine.js +1 -1
  173. package/symbols/cim/placements/PlacementOnVertices.js +1 -1
  174. package/symbols/cim/placements/PlacementPolygonCenter.js +1 -1
  175. package/symbols/support/ElevationInfo.js +1 -1
  176. package/time/TimeExtent.js +1 -1
  177. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  178. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  179. package/views/2d/engine/vectorTiles/shaders/VTLBackgroundMaterial.js +1 -1
  180. package/views/2d/engine/vectorTiles/shaders/VTLCircleMaterial.js +1 -1
  181. package/views/2d/engine/vectorTiles/shaders/VTLFillMaterial.js +1 -1
  182. package/views/2d/engine/vectorTiles/shaders/VTLLineMaterial.js +1 -1
  183. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  184. package/views/2d/engine/vectorTiles/shaders/VTLSymbolMaterial.js +1 -1
  185. package/views/2d/engine/vectorTiles/style/StyleDefinition.js +1 -1
  186. package/views/2d/engine/webgl/DisplayEntity.js +1 -1
  187. package/views/2d/engine/webgl/DisplayRecord.js +1 -1
  188. package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
  189. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphNode.js +1 -1
  190. package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
  191. package/views/2d/layers/features/FeatureStoreQueryAdapter.js +1 -1
  192. package/views/2d/tiling/TileCoverage.js +1 -1
  193. package/views/2d/tiling/TileKey.js +1 -1
  194. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  195. package/views/3d/environment/SceneViewEnvironment.js +1 -1
  196. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  197. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  198. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  199. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  200. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  201. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  202. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  203. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  204. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  205. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  206. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandEncoder.js +1 -1
  207. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  208. package/views/3d/state/Frustum.js +1 -1
  209. package/views/3d/support/DisplayQualityProfile.js +1 -1
  210. package/views/3d/terrain/TerrainSurface.js +1 -1
  211. package/views/3d/terrain/TextureFader.js +1 -1
  212. package/views/3d/terrain/TilingScheme.js +1 -1
  213. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  214. package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
  215. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  216. package/views/3d/webgl-engine/lib/edgeRendering/edgeBufferWriters.js +1 -1
  217. package/views/SceneView.js +1 -1
  218. package/views/View.js +1 -1
  219. package/views/View2D.js +1 -1
  220. package/views/draw/DrawAction.js +1 -1
  221. package/views/draw/drawSurfaces.js +1 -1
  222. package/views/input/BrowserEventSource.js +1 -1
  223. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  224. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  225. package/views/support/imageReprojection.js +1 -1
  226. package/views/webgl/FramebufferObject.js +1 -1
  227. package/views/webgl/ShaderBuilder.js +1 -1
  228. package/views/webgl/Texture.js +1 -1
  229. package/webscene/Environment.js +1 -1
  230. package/webscene/SunLighting.js +1 -1
  231. package/webscene/VirtualLighting.js +1 -1
  232. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  233. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
  234. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  235. package/widgets/Feature/FeatureViewModel.js +1 -1
  236. package/widgets/LayerList/LayerListItem.js +1 -1
  237. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  238. package/widgets/ScaleRangeSlider/ScaleRanges.js +1 -1
  239. package/widgets/Search/SearchViewModel.js +1 -1
  240. package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
  241. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  242. package/widgets/Widget.js +1 -1
  243. package/widgets/support/forms/expressions/FormExpressionArcadeExecutor.js +1 -1
  244. package/assets/esri/core/workers/chunks/00e0c53d89e074399f04.js +0 -1
  245. package/assets/esri/core/workers/chunks/12d6baeffd55a98a7c75.js +0 -1
  246. package/assets/esri/core/workers/chunks/207c040b0e42358a5389.js +0 -1
  247. package/assets/esri/core/workers/chunks/21c12edc0632eb911e73.js +0 -1
  248. package/assets/esri/core/workers/chunks/24c94f97a76646d415ae.js +0 -1
  249. package/assets/esri/core/workers/chunks/2611adb4f328f95ee508.js +0 -1
  250. package/assets/esri/core/workers/chunks/26a2bd432e7a1b3870c3.js +0 -1
  251. package/assets/esri/core/workers/chunks/2def7db73a776e759dae.js +0 -1
  252. package/assets/esri/core/workers/chunks/2ff63a71213f618377d6.js +0 -1
  253. package/assets/esri/core/workers/chunks/44abd2cd17aae3299ede.js +0 -1
  254. package/assets/esri/core/workers/chunks/4b56c0c109e10d7409b8.js +0 -1
  255. package/assets/esri/core/workers/chunks/5660f13d78e9e4240034.js +0 -1
  256. package/assets/esri/core/workers/chunks/568bcf809fcfd4d9c713.js +0 -1
  257. package/assets/esri/core/workers/chunks/5e889a675cbaff03ad5a.js +0 -1
  258. package/assets/esri/core/workers/chunks/61795bde00f2e16d04f1.js +0 -1
  259. package/assets/esri/core/workers/chunks/62a1d60ad4bf6469c4dd.js +0 -1
  260. package/assets/esri/core/workers/chunks/6ea02ff25f051c08e6c3.js +0 -1
  261. package/assets/esri/core/workers/chunks/7bf08823f861628144a1.js +0 -1
  262. package/assets/esri/core/workers/chunks/86149b4a5a148744c7d1.js +0 -1
  263. package/assets/esri/core/workers/chunks/9b2fab133786e5d47631.js +0 -1
  264. package/assets/esri/core/workers/chunks/9bfb091cec7eed6c8111.js +0 -1
  265. package/assets/esri/core/workers/chunks/a2409d4921c02614169a.js +0 -1
  266. package/assets/esri/core/workers/chunks/b1baf39daf5725404be5.js +0 -1
  267. package/assets/esri/core/workers/chunks/b43d88b6e7dc4ab13599.js +0 -1
  268. package/assets/esri/core/workers/chunks/b9d9a1dc3c5d799e2685.js +0 -1
  269. package/assets/esri/core/workers/chunks/c1970657a287ec96001e.js +0 -1
  270. package/assets/esri/core/workers/chunks/cc75bbfd779f409943a3.js +0 -1
  271. package/assets/esri/core/workers/chunks/d35efcbe439500bf18bc.js +0 -1
  272. package/assets/esri/core/workers/chunks/d599ba865da87b487b1b.js +0 -1
  273. package/assets/esri/core/workers/chunks/da1157e288dbc6ba842a.js +0 -1
  274. package/assets/esri/core/workers/chunks/ddc30044f61a2c2df3fe.js +0 -1
  275. package/assets/esri/core/workers/chunks/e37e5d2e233d7f6ccd52.js +0 -314
  276. package/assets/esri/core/workers/chunks/f14b318bab5efcf43419.js +0 -1
  277. package/assets/esri/core/workers/chunks/f29715459ecd46180829.js +0 -1
  278. package/assets/esri/core/workers/chunks/f4e48bbdbc9da10ec71a.js +0 -1
  279. package/assets/esri/core/workers/chunks/f62f657f9fef28f492e0.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"./chunks/tslib.es6.js";import r from"./Graphic.js";import s from"./core/Clonable.js";import{clone as o}from"./core/lang.js";import{property as e}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/Logger.js";import{subclass as c}from"./core/accessorSupport/decorators/subclass.js";var i;let a=i=class extends(s.ClonableMixin(r)){constructor(t){super(t),this.stackedAttributes=null}cloneShallow(){return new i({...super.cloneShallow(),stackedAttributes:this.stackedAttributes})}toJSON(){return{...super.toJSON(),stackedAttributes:o(this.stackedAttributes)}}};t([e()],a.prototype,"stackedAttributes",void 0),a=i=t([c("esri.AttributeBinsGraphic")],a);const p=a;export{p as default};
5
+ import{_ as t}from"./chunks/tslib.es6.js";import r from"./Graphic.js";import s from"./core/Clonable.js";import{clone as o}from"./core/lang.js";import{property as e}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/Logger.js";import{subclass as c}from"./core/accessorSupport/decorators/subclass.js";var i;let a=class extends(s.ClonableMixin(r)){static{i=this}constructor(t){super(t),this.stackedAttributes=null}cloneShallow(){return new i({...super.cloneShallow(),stackedAttributes:this.stackedAttributes})}toJSON(){return{...super.toJSON(),stackedAttributes:o(this.stackedAttributes)}}};t([e()],a.prototype,"stackedAttributes",void 0),a=i=t([c("esri.AttributeBinsGraphic")],a);const p=a;export{p as default};
package/Graphic.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"./chunks/tslib.es6.js";import e from"./PopupTemplate.js";import r from"./core/Clonable.js";import{deprecatedConstructorSignature as i}from"./core/deprecate.js";import s from"./core/JSONSupport.js";import o from"./core/Logger.js";import{when as a}from"./core/reactiveUtils.js";import{generateUID as l}from"./core/uid.js";import{property as n}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/RandomLCG.js";import{subclass as p}from"./core/accessorSupport/decorators/subclass.js";import{fromJSON as h}from"./geometry/support/jsonUtils.js";import{geometryTypes as u}from"./geometry/support/typeUtils.js";import{symbolTypes as m}from"./symbols/support/typeUtils.js";var g;function y(t){if(!t)return null;const e={};for(const r in t){const i=h(t[r]);i&&(e[r]=i)}return 0!==Object.keys(e).length?e:null}function c(t){if(null==t)return null;const e={};for(const r in t){const i=t[r];i&&(e[r]=i.toJSON())}return 0!==Object.keys(e).length?e:null}let f=g=class extends(r.ClonableMixin(s)){constructor(t){super(t),this.isAggregate=!1,this.layer=null,this.origin=null,this.popupTemplate=null,this.sourceLayer=null,this._version=0,Object.defineProperty(this,"uid",{value:l(),configurable:!0}),Object.defineProperty(this,"_lastMeshTransform",{value:{},configurable:!0,writable:!0,enumerable:!1}),arguments.length>1&&i(o.getLogger(this),"Graphic",{version:"4.30"})}initialize(){this._watchMeshGeometryChanges()}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),"mesh"!==t?.type&&this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}get version(){return this._version}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}cloneShallow(){return new g({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible,origin:this.origin})}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;const e=this.origin&&"layer"in this.origin?this.origin.layer:null;for(const r of[e,this.sourceLayer,this.layer])if(r){if("popupTemplate"in r&&r.popupTemplate)return r.popupTemplate;if(t&&"defaultPopupTemplate"in r&&null!=r.defaultPopupTemplate)return r.defaultPopupTemplate}return null}getAttribute(t){return this.attributes?.[t]}setAttribute(t,e){if(this.attributes){const r=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",r,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){return{aggregateGeometries:c(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:s.isSerializable(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:this.popupTemplate?.toJSON()??null}}notifyMeshTransformChanged(t={}){const{geometry:e}=this;if("mesh"===e?.type){const r={origin:e.origin,transform:e.transform};this._notifyLayer("origin-transform",r,r,t.action)}}_notifyLayer(t,e,r,i){if(this._version++,!this.layer||!("graphicChanged"in this.layer))return;const s={graphic:this,property:t,oldValue:e,newValue:r};"origin-transform"===t&&(s.action=i),"attributes"===t&&(s.attributeName=i),this.layer.graphicChanged(s)}_watchMeshGeometryChanges(){this.addHandles([a((()=>"mesh"===this.geometry?.type&&this.geometry.vertexSpace.origin?{localMatrix:this.geometry.transform?.localMatrix,origin:this.geometry.vertexSpace.origin}:void 0),(({localMatrix:t,origin:e})=>{this._lastMeshTransform.localMatrix===t&&this._lastMeshTransform.origin===e||(this._lastMeshTransform.localMatrix=t,this._lastMeshTransform.origin=e,this.notifyMeshTransformChanged())})),a((()=>"mesh"===this.geometry?.type?{vertexAttributes:this.geometry.vertexAttributes}:void 0),(()=>{const t=this.geometry;"mesh"===t?.type&&t.vertexSpace.origin?(this._lastMeshTransform.localMatrix=t.transform?.localMatrix,this._lastMeshTransform.origin=t.vertexSpace.origin):(this._lastMeshTransform.localMatrix=void 0,this._lastMeshTransform.origin=void 0),this._notifyLayer("geometry",this.geometry,this.geometry)}),{equals:(t,e)=>t===e,sync:!0})])}};t([n({value:null,json:{read:y}})],f.prototype,"aggregateGeometries",null),t([n({value:null})],f.prototype,"attributes",null),t([n({value:null,types:u,json:{read:h}})],f.prototype,"geometry",null),t([n({type:Boolean})],f.prototype,"isAggregate",void 0),t([n({clonable:"reference"})],f.prototype,"layer",void 0),t([n({clonable:"reference"})],f.prototype,"origin",void 0),t([n({type:e})],f.prototype,"popupTemplate",void 0),t([n({clonable:"reference"})],f.prototype,"sourceLayer",void 0),t([n({value:null,types:m})],f.prototype,"symbol",null),t([n({clonable:!1,json:{read:!1,write:!1}})],f.prototype,"_version",void 0),t([n({type:Boolean,value:!0})],f.prototype,"visible",null),f=g=t([p("esri.Graphic")],f);const b=f;export{b as default};
5
+ import{_ as t}from"./chunks/tslib.es6.js";import e from"./PopupTemplate.js";import r from"./core/Clonable.js";import{deprecatedConstructorSignature as i}from"./core/deprecate.js";import s from"./core/JSONSupport.js";import o from"./core/Logger.js";import{when as a}from"./core/reactiveUtils.js";import{generateUID as l}from"./core/uid.js";import{property as n}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/RandomLCG.js";import{subclass as p}from"./core/accessorSupport/decorators/subclass.js";import{fromJSON as h}from"./geometry/support/jsonUtils.js";import{geometryTypes as u}from"./geometry/support/typeUtils.js";import{symbolTypes as m}from"./symbols/support/typeUtils.js";var g;function y(t){if(!t)return null;const e={};for(const r in t){const i=h(t[r]);i&&(e[r]=i)}return 0!==Object.keys(e).length?e:null}function c(t){if(null==t)return null;const e={};for(const r in t){const i=t[r];i&&(e[r]=i.toJSON())}return 0!==Object.keys(e).length?e:null}let f=class extends(r.ClonableMixin(s)){static{g=this}constructor(t){super(t),this.isAggregate=!1,this.layer=null,this.origin=null,this.popupTemplate=null,this.sourceLayer=null,this._version=0,Object.defineProperty(this,"uid",{value:l(),configurable:!0}),Object.defineProperty(this,"_lastMeshTransform",{value:{},configurable:!0,writable:!0,enumerable:!1}),arguments.length>1&&i(o.getLogger(this),"Graphic",{version:"4.30"})}initialize(){this._watchMeshGeometryChanges()}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),"mesh"!==t?.type&&this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}get version(){return this._version}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}cloneShallow(){return new g({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible,origin:this.origin})}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;const e=this.origin&&"layer"in this.origin?this.origin.layer:null;for(const r of[e,this.sourceLayer,this.layer])if(r){if("popupTemplate"in r&&r.popupTemplate)return r.popupTemplate;if(t&&"defaultPopupTemplate"in r&&null!=r.defaultPopupTemplate)return r.defaultPopupTemplate}return null}getAttribute(t){return this.attributes?.[t]}setAttribute(t,e){if(this.attributes){const r=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",r,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){return{aggregateGeometries:c(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:s.isSerializable(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:this.popupTemplate?.toJSON()??null}}notifyMeshTransformChanged(t={}){const{geometry:e}=this;if("mesh"===e?.type){const r={origin:e.origin,transform:e.transform};this._notifyLayer("origin-transform",r,r,t.action)}}_notifyLayer(t,e,r,i){if(this._version++,!this.layer||!("graphicChanged"in this.layer))return;const s={graphic:this,property:t,oldValue:e,newValue:r};"origin-transform"===t&&(s.action=i),"attributes"===t&&(s.attributeName=i),this.layer.graphicChanged(s)}_watchMeshGeometryChanges(){this.addHandles([a((()=>"mesh"===this.geometry?.type&&this.geometry.vertexSpace.origin?{localMatrix:this.geometry.transform?.localMatrix,origin:this.geometry.vertexSpace.origin}:void 0),(({localMatrix:t,origin:e})=>{this._lastMeshTransform.localMatrix===t&&this._lastMeshTransform.origin===e||(this._lastMeshTransform.localMatrix=t,this._lastMeshTransform.origin=e,this.notifyMeshTransformChanged())})),a((()=>"mesh"===this.geometry?.type?{vertexAttributes:this.geometry.vertexAttributes}:void 0),(()=>{const t=this.geometry;"mesh"===t?.type&&t.vertexSpace.origin?(this._lastMeshTransform.localMatrix=t.transform?.localMatrix,this._lastMeshTransform.origin=t.vertexSpace.origin):(this._lastMeshTransform.localMatrix=void 0,this._lastMeshTransform.origin=void 0),this._notifyLayer("geometry",this.geometry,this.geometry)}),{equals:(t,e)=>t===e,sync:!0})])}};t([n({value:null,json:{read:y}})],f.prototype,"aggregateGeometries",null),t([n({value:null})],f.prototype,"attributes",null),t([n({value:null,types:u,json:{read:h}})],f.prototype,"geometry",null),t([n({type:Boolean})],f.prototype,"isAggregate",void 0),t([n({clonable:"reference"})],f.prototype,"layer",void 0),t([n({clonable:"reference"})],f.prototype,"origin",void 0),t([n({type:e})],f.prototype,"popupTemplate",void 0),t([n({clonable:"reference"})],f.prototype,"sourceLayer",void 0),t([n({value:null,types:m})],f.prototype,"symbol",null),t([n({clonable:!1,json:{read:!1,write:!1}})],f.prototype,"_version",void 0),t([n({type:Boolean,value:!0})],f.prototype,"visible",null),f=g=t([p("esri.Graphic")],f);const b=f;export{b as default};
package/Ground.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"./chunks/tslib.es6.js";import e from"./Color.js";import o from"./core/Collection.js";import{referenceSetter as t}from"./core/collectionUtils.js";import{typeCast as s}from"./core/compilerUtils.js";import a from"./core/Error.js";import i from"./core/JSONSupport.js";import{clone as n}from"./core/lang.js";import l from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import c from"./core/Logger.js";import{destroyMaybe as y}from"./core/maybe.js";import{isAbortError as u,throwIfAborted as d}from"./core/promiseUtils.js";import{property as m}from"./core/accessorSupport/decorators/property.js";import{Integer as f}from"./core/accessorSupport/ensureType.js";import{subclass as h}from"./core/accessorSupport/decorators/subclass.js";import{writer as g}from"./core/accessorSupport/decorators/writer.js";import{NavigationConstraint as v}from"./ground/NavigationConstraint.js";import{GroundSymbol as j}from"./support/groundInstanceUtils.js";import{transparencyToOpacity as w,opacityToTransparency as S}from"./webdoc/support/opacityUtils.js";var C,I;let L=I=class extends(i.JSONSupportMixin(l)){constructor(r){super(r),this[C]=!0,this.opacity=1,this.surfaceColor=null,this.navigationConstraint=null,this.layers=new o;const e=r=>{r.parent&&r.parent!==this&&"remove"in r.parent&&r.parent.remove(r),r.parent=this,"elevation"!==r.type&&"base-elevation"!==r.type&&c.getLogger(this).error(`Layer '${r.title}, id:${r.id}' of type '${r.type}' is not supported as a ground layer and will therefore be ignored. Only layers of type 'elevation' are supported.`)},t=r=>{r.parent=null};this.addHandles([this.layers.on("after-add",(r=>e(r.item))),this.layers.on("after-remove",(r=>t(r.item)))])}initialize(){this.when().catch((r=>{u(r)||c.getLogger(this).error("#load()","Failed to load ground",r)})),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){const r=this.layers.removeAll();for(const e of r)y(e);this.layers.destroy()}normalizeCtorArgs(r){return r&&"resourceInfo"in r&&(this._set("resourceInfo",r.resourceInfo),delete(r={...r}).resourceInfo),r}get layers(){return this._get("layers")}set layers(r){this._set("layers",t(r,this._get("layers")))}writeLayers(r,e,o,t){const i=[];r?(t={...t,layerContainerType:"ground"},r.forEach((r=>{if("write"in r){const e={};s(r)().write(e,t)&&i.push(e)}else t?.messages&&t.messages.push(new a("layer:unsupported",`Layers (${r.title}, ${r.id}) of type '${r.declaredClass}' cannot be persisted in the ground`,{layer:r}))})),e.layers=i):e.layers=i}load(r){return this.addResolvingPromise(this._loadFromSource(r)),Promise.resolve(this)}loadAll(){return p(this,(r=>{r(this.layers)}))}async queryElevation(r,e){await this.load({signal:e?.signal});const{ElevationQuery:o}=await import("./layers/support/ElevationQuery.js");d(e);const t=new o,s=this.layers.filter(A).toArray();return t.queryAll(s,r,e)}async createElevationSampler(r,e){await this.load({signal:e?.signal});const{ElevationQuery:o}=await import("./layers/support/ElevationQuery.js");d(e);const t=new o,s=this.layers.filter(A).toArray();return t.createSamplerAll(s,r,e)}clone(){const r={opacity:this.opacity,surfaceColor:n(this.surfaceColor),navigationConstraint:n(this.navigationConstraint),layers:this.layers.slice()};return this.loaded&&(r.loadStatus="loaded"),new I({resourceInfo:this.resourceInfo}).set(r)}read(r,e){this.resourceInfo||this._set("resourceInfo",{data:r,context:e}),super.read(r,e)}_loadFromSource(r){const e=this.resourceInfo;return e?this._loadLayersFromJSON(e.data,e.context,r):Promise.resolve()}async _loadLayersFromJSON(r,e,o){const t=e?.origin||"web-scene",s=e?.portal||null,a=e?.url||null,{populateOperationalLayers:i}=await import("./layers/support/layersCreator.js");d(o);const n=[];if(r.layers&&Array.isArray(r.layers)){const e={context:{origin:t,url:a,portal:s,layerContainerType:"ground"},defaultLayerType:"ArcGISTiledElevationServiceLayer"};n.push(i(this.layers,r.layers,e))}await Promise.allSettled(n)}};function b(r){return r&&"createElevationSampler"in r}function A(r){return"elevation"===r.type||b(r)}C=j,r([m({json:{read:!1,write:{isRequired:!0}}})],L.prototype,"layers",null),r([g("layers")],L.prototype,"writeLayers",null),r([m({readOnly:!0})],L.prototype,"resourceInfo",void 0),r([m({type:Number,nonNullable:!0,range:{min:0,max:1},json:{type:f,read:{reader:w,source:"transparency"},write:{writer:(r,e)=>{e.transparency=S(r)},target:"transparency"}}})],L.prototype,"opacity",void 0),r([m({type:e,json:{type:[f],write:(r,e)=>{e.surfaceColor=r.toJSON().slice(0,3)}}})],L.prototype,"surfaceColor",void 0),r([m({type:v,json:{write:!0}})],L.prototype,"navigationConstraint",void 0),L=I=r([h("esri.Ground")],L);const E=L;export{E as default};
5
+ import{_ as r}from"./chunks/tslib.es6.js";import e from"./Color.js";import o from"./core/Collection.js";import{referenceSetter as t}from"./core/collectionUtils.js";import{typeCast as s}from"./core/compilerUtils.js";import a from"./core/Error.js";import i from"./core/JSONSupport.js";import{clone as n}from"./core/lang.js";import l from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import c from"./core/Logger.js";import{destroyMaybe as y}from"./core/maybe.js";import{isAbortError as u,throwIfAborted as d}from"./core/promiseUtils.js";import{property as m}from"./core/accessorSupport/decorators/property.js";import{Integer as f}from"./core/accessorSupport/ensureType.js";import{subclass as h}from"./core/accessorSupport/decorators/subclass.js";import{writer as g}from"./core/accessorSupport/decorators/writer.js";import{NavigationConstraint as v}from"./ground/NavigationConstraint.js";import{GroundSymbol as j}from"./support/groundInstanceUtils.js";import{transparencyToOpacity as w,opacityToTransparency as S}from"./webdoc/support/opacityUtils.js";var C,I;let L=I=class extends(i.JSONSupportMixin(l)){static{C=j}constructor(r){super(r),this[C]=!0,this.opacity=1,this.surfaceColor=null,this.navigationConstraint=null,this.layers=new o;const e=r=>{r.parent&&r.parent!==this&&"remove"in r.parent&&r.parent.remove(r),r.parent=this,"elevation"!==r.type&&"base-elevation"!==r.type&&c.getLogger(this).error(`Layer '${r.title}, id:${r.id}' of type '${r.type}' is not supported as a ground layer and will therefore be ignored. Only layers of type 'elevation' are supported.`)},t=r=>{r.parent=null};this.addHandles([this.layers.on("after-add",(r=>e(r.item))),this.layers.on("after-remove",(r=>t(r.item)))])}initialize(){this.when().catch((r=>{u(r)||c.getLogger(this).error("#load()","Failed to load ground",r)})),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){const r=this.layers.removeAll();for(const e of r)y(e);this.layers.destroy()}normalizeCtorArgs(r){return r&&"resourceInfo"in r&&(this._set("resourceInfo",r.resourceInfo),delete(r={...r}).resourceInfo),r}get layers(){return this._get("layers")}set layers(r){this._set("layers",t(r,this._get("layers")))}writeLayers(r,e,o,t){const i=[];r?(t={...t,layerContainerType:"ground"},r.forEach((r=>{if("write"in r){const e={};s(r)().write(e,t)&&i.push(e)}else t?.messages&&t.messages.push(new a("layer:unsupported",`Layers (${r.title}, ${r.id}) of type '${r.declaredClass}' cannot be persisted in the ground`,{layer:r}))})),e.layers=i):e.layers=i}load(r){return this.addResolvingPromise(this._loadFromSource(r)),Promise.resolve(this)}loadAll(){return p(this,(r=>{r(this.layers)}))}async queryElevation(r,e){await this.load({signal:e?.signal});const{ElevationQuery:o}=await import("./layers/support/ElevationQuery.js");d(e);const t=new o,s=this.layers.filter(A).toArray();return t.queryAll(s,r,e)}async createElevationSampler(r,e){await this.load({signal:e?.signal});const{ElevationQuery:o}=await import("./layers/support/ElevationQuery.js");d(e);const t=new o,s=this.layers.filter(A).toArray();return t.createSamplerAll(s,r,e)}clone(){const r={opacity:this.opacity,surfaceColor:n(this.surfaceColor),navigationConstraint:n(this.navigationConstraint),layers:this.layers.slice()};return this.loaded&&(r.loadStatus="loaded"),new I({resourceInfo:this.resourceInfo}).set(r)}read(r,e){this.resourceInfo||this._set("resourceInfo",{data:r,context:e}),super.read(r,e)}_loadFromSource(r){const e=this.resourceInfo;return e?this._loadLayersFromJSON(e.data,e.context,r):Promise.resolve()}async _loadLayersFromJSON(r,e,o){const t=e?.origin||"web-scene",s=e?.portal||null,a=e?.url||null,{populateOperationalLayers:i}=await import("./layers/support/layersCreator.js");d(o);const n=[];if(r.layers&&Array.isArray(r.layers)){const e={context:{origin:t,url:a,portal:s,layerContainerType:"ground"},defaultLayerType:"ArcGISTiledElevationServiceLayer"};n.push(i(this.layers,r.layers,e))}await Promise.allSettled(n)}};function b(r){return r&&"createElevationSampler"in r}function A(r){return"elevation"===r.type||b(r)}r([m({json:{read:!1,write:{isRequired:!0}}})],L.prototype,"layers",null),r([g("layers")],L.prototype,"writeLayers",null),r([m({readOnly:!0})],L.prototype,"resourceInfo",void 0),r([m({type:Number,nonNullable:!0,range:{min:0,max:1},json:{type:f,read:{reader:w,source:"transparency"},write:{writer:(r,e)=>{e.transparency=S(r)},target:"transparency"}}})],L.prototype,"opacity",void 0),r([m({type:e,json:{type:[f],write:(r,e)=>{e.surfaceColor=r.toJSON().slice(0,3)}}})],L.prototype,"surfaceColor",void 0),r([m({type:v,json:{write:!0}})],L.prototype,"navigationConstraint",void 0),L=I=r([h("esri.Ground")],L);const E=L;export{E as default};
package/WebMap.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"./chunks/tslib.es6.js";import t from"./WebDocument2D.js";import r from"./core/Collection.js";import e from"./core/Error.js";import{loadAll as s}from"./core/loadAll.js";import{property as i}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/Logger.js";import"./core/RandomLCG.js";import{subclass as p}from"./core/accessorSupport/decorators/subclass.js";import n from"./networks/UtilityNetwork.js";import m from"./webdoc/GeotriggersInfo.js";import a from"./webdoc/IPSInfo.js";import c from"./webmap/InitialViewProperties.js";import{currentVersion as l}from"./webmap/utils.js";import{Version as f}from"./webmap/Version.js";const u={currentVersion:l,createInitialViewProperties:()=>new c,parseVersion:f.parse,itemType:"Web Map",name:"webmap",origin:"web-map"},w=r.ofType(n);let y=class extends t{constructor(o){super(o),this.geotriggersInfo=null,this.ipsInfo=null,this.presentation=null,this.utilityNetworks=null}destroy(){if(this.utilityNetworks){const o=this.utilityNetworks.removeAll();for(const t of o)t.destroy();this.utilityNetworks.destroy()}}get context(){return u}loadAll(){return s(this,(o=>{o(this.ground,this.basemap,this.layers,this.tables,this.ipsInfo?.positioningService?.portalItem)}))}static fromJSON(o){if(o)return new this({resourceInfo:o});throw new e("webmap:empty-resource","Expected a JSON resource but got nothing")}};y.VERSION=l,o([i({type:m,json:{write:!0}})],y.prototype,"geotriggersInfo",void 0),o([i({type:a,json:{write:!0,name:"mapIPSInfo"}})],y.prototype,"ipsInfo",void 0),o([i({json:{write:!0}})],y.prototype,"presentation",void 0),o([i({type:w,json:{read:!0,write:!0}})],y.prototype,"utilityNetworks",void 0),y=o([p("esri.WebMap")],y);const j=y;export{j as default};
5
+ import{_ as o}from"./chunks/tslib.es6.js";import t from"./WebDocument2D.js";import r from"./core/Collection.js";import e from"./core/Error.js";import{loadAll as s}from"./core/loadAll.js";import{property as i}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/Logger.js";import"./core/RandomLCG.js";import{subclass as p}from"./core/accessorSupport/decorators/subclass.js";import n from"./networks/UtilityNetwork.js";import m from"./webdoc/GeotriggersInfo.js";import a from"./webdoc/IPSInfo.js";import c from"./webmap/InitialViewProperties.js";import{currentVersion as l}from"./webmap/utils.js";import{Version as f}from"./webmap/Version.js";const u={currentVersion:l,createInitialViewProperties:()=>new c,parseVersion:f.parse,itemType:"Web Map",name:"webmap",origin:"web-map"},w=r.ofType(n);let y=class extends t{constructor(o){super(o),this.geotriggersInfo=null,this.ipsInfo=null,this.presentation=null,this.utilityNetworks=null}destroy(){if(this.utilityNetworks){const o=this.utilityNetworks.removeAll();for(const t of o)t.destroy();this.utilityNetworks.destroy()}}get context(){return u}loadAll(){return s(this,(o=>{o(this.ground,this.basemap,this.layers,this.tables,this.ipsInfo?.positioningService?.portalItem)}))}static fromJSON(o){if(o)return new this({resourceInfo:o});throw new e("webmap:empty-resource","Expected a JSON resource but got nothing")}static{this.VERSION=l}};o([i({type:m,json:{write:!0}})],y.prototype,"geotriggersInfo",void 0),o([i({type:a,json:{write:!0,name:"mapIPSInfo"}})],y.prototype,"ipsInfo",void 0),o([i({json:{write:!0}})],y.prototype,"presentation",void 0),o([i({type:w,json:{read:!0,write:!0}})],y.prototype,"utilityNetworks",void 0),y=o([p("esri.WebMap")],y);const j=y;export{j as default};
package/WebScene.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import o from"./core/Collection.js";import s from"./core/Error.js";import{clone as a}from"./core/lang.js";import n from"./core/Loadable.js";import{loadAll as l}from"./core/loadAll.js";import p from"./core/Logger.js";import{destroyMaybe as c}from"./core/maybe.js";import{MultiOriginJSONMixin as d,MultiOriginJSONSupport as h}from"./core/MultiOriginJSONSupport.js";import m from"./core/Promise.js";import{debounce as u}from"./core/promiseUtils.js";import{on as y,watch as w}from"./core/reactiveUtils.js";import{urlToObject as f,addQueryParameter as g}from"./core/urlUtils.js";import b from"./core/Warning.js";import{property as v}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import{reader as S}from"./core/accessorSupport/decorators/reader.js";import{subclass as _}from"./core/accessorSupport/decorators/subclass.js";import{writer as A}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as I}from"./core/accessorSupport/originUtils.js";import{readLoadable as j}from"./core/accessorSupport/read.js";import L from"./geometry/Extent.js";import V from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as R}from"./geometry/projection.js";import E from"./geometry/SpatialReference.js";import{validateWebSceneError as P}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as M}from"./geometry/support/jsonUtils.js";import{isEarth as O}from"./geometry/support/spatialReferenceUtils.js";import U from"./portal/Portal.js";import C from"./portal/PortalItem.js";import{createForItemWrite as N}from"./portal/support/jsonContext.js";import{toggleTypeKeyword as T,typeKeyword as x}from"./portal/support/portalItemUtils.js";import{hasDeveloperBasemapLayer as G}from"./support/basemapUtils.js";import F from"./support/MapFloorInfo.js";import{WebSceneTag as W}from"./support/tagSymbols.js";import{createSchemaValidationError as J}from"./support/webSceneUtils.js";import $ from"./time/TimeExtent.js";import{ViewingMode as B}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as q}from"./views/support/spatialReferenceSupport.js";import{SaveOperationType as k}from"./webdoc/interfaces.js";import D from"./webdoc/Widgets.js";import{updateItemWithResources as H,saveResources as K}from"./webdoc/support/resourceUtils.js";import{evaluateWriteErrors as z}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as Q}from"./webdoc/support/thumbnailUtils.js";import{isCopyAllowed as X,initializeNewItem as Y}from"./webdoc/support/webdocSaveUtils.js";import Z from"./webscene/ApplicationProperties.js";import ee from"./webscene/Environment.js";import te from"./webscene/InitialViewProperties.js";import re from"./webscene/Presentation.js";import ie from"./webscene/TransportationNetwork.js";import{Version as oe}from"./webscene/Version.js";import{alphaCutoff as se}from"./webscene/support/AlphaCutoff.js";import{getLoader as ae}from"./webscene/support/schemaValidatorLoader.js";var ne;const le=new oe(1,36),pe=()=>{const e=8,t=[],r=le.major;for(let i=e;i<=le.minor;i++)t.push(`${r}.${i}`);return t},ce="Web Scene";let de=class extends(n.LoadableMixin(m.EsriPromiseMixin(d(r)))){constructor(e){super(e),this[ne]=!0,this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new re,this.initialViewProperties=new te,this.portalItem=null,this.resourceInfo=null,this.widgets=null,this._debouncedSaveOperations=u((async(e,t,r)=>{switch(e){case k.SAVE:return this._saveImpl(t);case k.SAVE_AS:return this._saveAsImpl(r,t)}})),this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{p.getLogger(this).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles(y((()=>this.allLayers),"change",(()=>this._scheduleLayersIdGC())))}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=c(this.portalItem)}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){t[r]=this._layersToJSON(e,"operational-layers",i)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new oe(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${le.major}.${le.minor}`}writeTables(e,t,r,i){const o=this._layersToJSON(e,"tables",i);o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem?.thumbnailUrl??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t){const r={};t.initialState?.environment&&(r.environment=ee.fromJSON(t.initialState.environment)),r.spatialReference=t.spatialReference?E.fromJSON(t.spatialReference):E.WebMercator,r.viewingMode=t.viewingMode??"global",t.initialState?.viewpoint&&(r.viewpoint=i.fromJSON(t.initialState.viewpoint));const o=t.initialState?.timeExtent;return null!=o&&(r.timeExtent=$.fromArray(o)),new te(r)}get spatialReference(){return this.initialViewProperties?.spatialReference??E.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){const t=this.ground;return this.addResolvingPromise(this._loadFromSource().then((()=>{t&&t!==this.ground&&t.destroy(),this._validateFeatureLayerSymbolVisibility()}))),Promise.resolve(this)}loadAll(){return l(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)),this.tables)}))}read(e,t){t={...t,origin:"web-scene"};const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(j(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion?.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=(e,t)=>e.visibleLayers.some((e=>e.id===t)),o=t.filter((e=>!r.some((t=>i(t,e.id)))));r.forEach((e=>{e.visibleLayers.addMany(o)}))}}_writeBasemapElevationLayers(e){const t=e.ground?.layers;!e.baseMap&&t?.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=a(t))}_layersToJSON(e,t,r){const i={...r,layerContainerType:t};return e.map((e=>this._verifyWritableLayer(e,r)?e.write({},i):null)).filter((e=>!!e)).toArray()}_verifyWritableLayer(e,t){return!!e.persistenceEnabled&&("write"in e||(t?.messages&&t.messages.push(new s("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1))}write(e,t){if("loaded"!==this.loadStatus){const e=new s("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw p.getLogger(this).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages?.filter((e=>"web-document-write:property-required"===e.name))??[];if(e.length){const t=new s("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw p.getLogger(this).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(k.SAVE,e)}async _saveImpl(e){if(!this.portalItem)throw new s("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(this.portalItem?.type!==ce)throw new s("webscene:portal-item-wrong-type",`Portal item needs to have type "${ce}"`);const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls(N(this.portalItem,"web-scene",!0)),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,k.SAVE,e),this._updateTypeKeywords(this.portalItem),await H(this.portalItem,i,this._resourceReferences,r),I(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(k.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=C.from(e);if(!r)throw new s("webscene:portal-item-required","saveAs requires a portal item to save to");r.id&&(r=r.clone(),r.id=null);const i=r.portal||U.getDefault();await this._ensureLoadBeforeSave(),r.type=ce,r.portal=i;const o=this._enableVerifyItemRelativeUrls(N(r,"web-scene",!0)),a=this.write({},o);await Promise.all(o.resources.pendingOperations),await this._verifySaveAs(a,o,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");this._updateTypeKeywords(r),await i.signIn();const p=this.portalItem,c={item:p,authenticated:!(!p?.id||!p.portal.user)},{copyAllowed:d,itemReloaded:m}=await X(c,i);if(c.authenticated||=m,!d)throw new s(`${o.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const u={...t,copyAllResources:!0};return await Y(r,c,a,u)&&(this._resourceReferences.portalItem=r),await K(this._resourceReferences,o),this.portalItem=r,h.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?f(r.itemUrl):void 0}),I(o),n&&(this.thumbnailUrl=l?g(n,"w","8192"):n),o.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}async _verifySave(e,t,r,i){if(!O(this.spatialReference))throw new s("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently.");const{ignoreUnsupported:o,requiredPropertyChecksDisabled:a,strictSchemaValidationEnabled:n}=i||{};z(t,{errorName:"webscene:save"},{ignoreUnsupported:o,supplementalUnsupportedErrors:["scenemodification:unsupported"],requiredPropertyChecksDisabled:a});const l=ae();if(n&&l){const t=(await l()).validate(e);if(!t.length)return;const i=`webscene did not validate:\n${t.join("\n")}`;p.getLogger(this).error(`${r===k.SAVE_AS?"saveAs":"save"}(): ${i}`);const o=t.map((e=>new s("webscene:schema-validation",e)));throw J(o)}}_verifySaveAs(e,t,r){return this._verifySave(e,t,k.SAVE_AS,r)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(){return!1}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=ee.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,this.initialViewProperties.timeExtent=e.timeExtent?.clone()??null,null!=e.clippingArea?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}if(!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this);(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this._updateFromThumbnail(e,t.thumbnailSize??void 0)}async _updateFromThumbnail(e,t){const r=Q(e,t),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-scene"}):this.portalItem?.id?this._loadFromItem(this.portalItem):this._loadObjectsWithLayers()}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion?.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion?.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}async _loadFromJSON(e,t){const r=new o;await this._validateSpatialReference(),await this._validateHeightModelInfo();const{populateOperationalLayers:i}=await import("./layers/support/layersCreator.js"),{operationalLayers:s,operationalElevationLayers:a,basemapElevationLayers:n}=this._extractOperationalLayers(e),l=[],p={context:{...t,layerContainerType:"operational-layers"}};if(this.portalItem&&(p.context.portal=this.portalItem.portal||U.getDefault()),n.length>0){const e={...p,context:{...p.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",l.push(i(this.ground.layers,n,e))}if(a.length>0){const e={...p,context:{...p.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",l.push(i(r,a,e))}s&&s.length>0&&l.push(i(this.layers,s,p)),e.tables?.length&&l.push(i(this.tables,e.tables,{...p,context:{...p.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"})),await Promise.allSettled(l),await this._loadObjectsWithLayers(),this.ground.layers.addMany(r.filter((e=>"base-elevation"===e.type||"elevation"===e.type)))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[],t=[...this.allLayers.items];for(const{basemap:r}of this.presentation.slides.items)r&&(t.push(...r.baseLayers.items),t.push(...r.referenceLayers.items));for(const r of t)if("beforeSave"in r&&"function"==typeof r.beforeSave){const t=r.beforeSave();t&&e.push(t)}await Promise.allSettled(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await Promise.allSettled(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new s("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new s("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r={origin:"web-scene",url:f(e.itemUrl),portal:e.portal||U.getDefault(),portalItem:e,readResourcePaths:[]};await this._readAndLoadFromJSON(t,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!q(t,B.Global))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||R(e,t)}else{if(!q(t,B.Local))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e?.camera?.position.spatialReference??e?.targetGeometry?.spatialReference,o=e.viewpoint,a=i(o);if(a&&!r(a))return Promise.reject(new s("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new s("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=P(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateFeatureLayerSymbolVisibility(){this.sourceVersion?.greaterEqual(1,35)||this.layers.forEach((e=>{"feature"===e.type&&e.addHandles(w((()=>e.loaded),(()=>{"on-the-ground"===e.elevationInfo?.mode&&"simple"===e.renderer?.type&&"polygon-3d"===e.renderer.symbol?.type&&e.renderer.symbol.symbolLayers.some((t=>"fill"===t.type&&null!=t.material&&((!t.material.color||t.material.color.a*e.opacity<se)&&(e.loadWarnings.push(new b("feature-layer:invisible-draped-symbols","FeatureLayer has fully transparent symbols which will no longer render or highlight",{layer:e})),!0))))}),{once:!0,sync:!0}))}))}_validateJSON(e){const t=oe.parse(e.version||"","webscene");return le.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=E.WebMercator.toJSON()),e}_updateTypeKeywords(e){T(e,x.LOCAL_SCENE,"local"===this.initialViewProperties.viewingMode),T(e,x.DEVELOPER_BASEMAP,G(this.basemap)||this.presentation.slides.some((({basemap:e})=>!!e&&G(e)))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||E.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem?.itemUrl?f(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties?.viewing?.search,t=e=>this.allLayers.some((t=>t.id===e&&t.persistenceEnabled));e?.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new s("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}};ne=W,de.version=`${le.major}.${le.minor}`,e([v({type:Z,json:{write:!0}})],de.prototype,"applicationProperties",void 0),e([v({type:L,json:{read:{source:"clippingArea.geometry",reader:M},write:{target:"clippingArea.geometry"}}})],de.prototype,"clippingArea",void 0),e([A("clippingArea")],de.prototype,"writeClippingArea",null),e([v({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],de.prototype,"clippingEnabled",void 0),e([S("clippingEnabled",["clippingArea"])],de.prototype,"readClippingEnabled",null),e([A("clippingEnabled")],de.prototype,"writeClippingEnabled",null),e([v({type:F,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],de.prototype,"floorInfo",void 0),e([v({type:V,json:{write:!0}})],de.prototype,"heightModelInfo",void 0),e([v({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],de.prototype,"layers",void 0),e([A("layers")],de.prototype,"writeLayers",null),e([v({readOnly:!0,type:oe,json:{type:pe(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],de.prototype,"sourceVersion",void 0),e([S("sourceVersion",["version"])],de.prototype,"readSourceVersion",null),e([A("sourceVersion")],de.prototype,"writeSourceVersion",null),e([v({json:{read:!1,write:{enabled:!0,ignoreOrigin:!0}}})],de.prototype,"tables",void 0),e([A("tables")],de.prototype,"writeTables",null),e([v()],de.prototype,"thumbnailUrl",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],de.prototype,"authoringApp",null),e([A("authoringApp")],de.prototype,"writeAuthoringApp",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],de.prototype,"authoringAppVersion",null),e([A("authoringAppVersion")],de.prototype,"writeAuthoringAppVersion",null),e([v({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],de.prototype,"ground",void 0),e([A("ground")],de.prototype,"writeGround",null),e([v({type:o.ofType(ie),json:{write:!0}})],de.prototype,"transportationNetworks",void 0),e([v({type:re,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],de.prototype,"presentation",void 0),e([v({type:te,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new te({viewingMode:"global",spatialReference:E.WebMercator})}})],de.prototype,"initialViewProperties",void 0),e([S("initialViewProperties",["initialState.timeExtent","initialState.environment","initialState.viewpoint","spatialReference","viewingMode"])],de.prototype,"readInitialViewProperties",null),e([v({type:E,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],de.prototype,"spatialReference",null),e([v({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],de.prototype,"viewingMode",null),e([v({type:C})],de.prototype,"portalItem",void 0),e([v()],de.prototype,"resourceInfo",void 0),e([v({type:D,json:{write:!0}})],de.prototype,"widgets",void 0),de=e([_("esri.WebScene")],de);const he=de;export{he as default};
5
+ import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import o from"./core/Collection.js";import s from"./core/Error.js";import{clone as a}from"./core/lang.js";import n from"./core/Loadable.js";import{loadAll as l}from"./core/loadAll.js";import p from"./core/Logger.js";import{destroyMaybe as c}from"./core/maybe.js";import{MultiOriginJSONMixin as d,MultiOriginJSONSupport as h}from"./core/MultiOriginJSONSupport.js";import m from"./core/Promise.js";import{debounce as u}from"./core/promiseUtils.js";import{on as y,watch as w}from"./core/reactiveUtils.js";import{urlToObject as f,addQueryParameter as g}from"./core/urlUtils.js";import b from"./core/Warning.js";import{property as v}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import{reader as S}from"./core/accessorSupport/decorators/reader.js";import{subclass as _}from"./core/accessorSupport/decorators/subclass.js";import{writer as A}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as I}from"./core/accessorSupport/originUtils.js";import{readLoadable as j}from"./core/accessorSupport/read.js";import L from"./geometry/Extent.js";import V from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as R}from"./geometry/projection.js";import E from"./geometry/SpatialReference.js";import{validateWebSceneError as P}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as M}from"./geometry/support/jsonUtils.js";import{isEarth as O}from"./geometry/support/spatialReferenceUtils.js";import U from"./portal/Portal.js";import C from"./portal/PortalItem.js";import{createForItemWrite as N}from"./portal/support/jsonContext.js";import{toggleTypeKeyword as T,typeKeyword as x}from"./portal/support/portalItemUtils.js";import{hasDeveloperBasemapLayer as G}from"./support/basemapUtils.js";import F from"./support/MapFloorInfo.js";import{WebSceneTag as W}from"./support/tagSymbols.js";import{createSchemaValidationError as J}from"./support/webSceneUtils.js";import $ from"./time/TimeExtent.js";import{ViewingMode as B}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as q}from"./views/support/spatialReferenceSupport.js";import{SaveOperationType as k}from"./webdoc/interfaces.js";import D from"./webdoc/Widgets.js";import{updateItemWithResources as H,saveResources as K}from"./webdoc/support/resourceUtils.js";import{evaluateWriteErrors as z}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as Q}from"./webdoc/support/thumbnailUtils.js";import{isCopyAllowed as X,initializeNewItem as Y}from"./webdoc/support/webdocSaveUtils.js";import Z from"./webscene/ApplicationProperties.js";import ee from"./webscene/Environment.js";import te from"./webscene/InitialViewProperties.js";import re from"./webscene/Presentation.js";import ie from"./webscene/TransportationNetwork.js";import{Version as oe}from"./webscene/Version.js";import{alphaCutoff as se}from"./webscene/support/AlphaCutoff.js";import{getLoader as ae}from"./webscene/support/schemaValidatorLoader.js";var ne;const le=new oe(1,36),pe=()=>{const e=8,t=[],r=le.major;for(let i=e;i<=le.minor;i++)t.push(`${r}.${i}`);return t},ce="Web Scene";let de=class extends(n.LoadableMixin(m.EsriPromiseMixin(d(r)))){static{ne=W}constructor(e){super(e),this[ne]=!0,this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new re,this.initialViewProperties=new te,this.portalItem=null,this.resourceInfo=null,this.widgets=null,this._debouncedSaveOperations=u((async(e,t,r)=>{switch(e){case k.SAVE:return this._saveImpl(t);case k.SAVE_AS:return this._saveAsImpl(r,t)}})),this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{p.getLogger(this).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles(y((()=>this.allLayers),"change",(()=>this._scheduleLayersIdGC())))}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=c(this.portalItem)}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){t[r]=this._layersToJSON(e,"operational-layers",i)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new oe(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${le.major}.${le.minor}`}writeTables(e,t,r,i){const o=this._layersToJSON(e,"tables",i);o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem?.thumbnailUrl??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t){const r={};t.initialState?.environment&&(r.environment=ee.fromJSON(t.initialState.environment)),r.spatialReference=t.spatialReference?E.fromJSON(t.spatialReference):E.WebMercator,r.viewingMode=t.viewingMode??"global",t.initialState?.viewpoint&&(r.viewpoint=i.fromJSON(t.initialState.viewpoint));const o=t.initialState?.timeExtent;return null!=o&&(r.timeExtent=$.fromArray(o)),new te(r)}get spatialReference(){return this.initialViewProperties?.spatialReference??E.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){const t=this.ground;return this.addResolvingPromise(this._loadFromSource().then((()=>{t&&t!==this.ground&&t.destroy(),this._validateFeatureLayerSymbolVisibility()}))),Promise.resolve(this)}loadAll(){return l(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)),this.tables)}))}read(e,t){t={...t,origin:"web-scene"};const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(j(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion?.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=(e,t)=>e.visibleLayers.some((e=>e.id===t)),o=t.filter((e=>!r.some((t=>i(t,e.id)))));r.forEach((e=>{e.visibleLayers.addMany(o)}))}}_writeBasemapElevationLayers(e){const t=e.ground?.layers;!e.baseMap&&t?.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=a(t))}_layersToJSON(e,t,r){const i={...r,layerContainerType:t};return e.map((e=>this._verifyWritableLayer(e,r)?e.write({},i):null)).filter((e=>!!e)).toArray()}_verifyWritableLayer(e,t){return!!e.persistenceEnabled&&("write"in e||(t?.messages&&t.messages.push(new s("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1))}write(e,t){if("loaded"!==this.loadStatus){const e=new s("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw p.getLogger(this).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages?.filter((e=>"web-document-write:property-required"===e.name))??[];if(e.length){const t=new s("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw p.getLogger(this).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(k.SAVE,e)}async _saveImpl(e){if(!this.portalItem)throw new s("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(this.portalItem?.type!==ce)throw new s("webscene:portal-item-wrong-type",`Portal item needs to have type "${ce}"`);const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls(N(this.portalItem,"web-scene",!0)),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,k.SAVE,e),this._updateTypeKeywords(this.portalItem),await H(this.portalItem,i,this._resourceReferences,r),I(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(k.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=C.from(e);if(!r)throw new s("webscene:portal-item-required","saveAs requires a portal item to save to");r.id&&(r=r.clone(),r.id=null);const i=r.portal||U.getDefault();await this._ensureLoadBeforeSave(),r.type=ce,r.portal=i;const o=this._enableVerifyItemRelativeUrls(N(r,"web-scene",!0)),a=this.write({},o);await Promise.all(o.resources.pendingOperations),await this._verifySaveAs(a,o,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");this._updateTypeKeywords(r),await i.signIn();const p=this.portalItem,c={item:p,authenticated:!(!p?.id||!p.portal.user)},{copyAllowed:d,itemReloaded:m}=await X(c,i);if(c.authenticated||=m,!d)throw new s(`${o.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const u={...t,copyAllResources:!0};return await Y(r,c,a,u)&&(this._resourceReferences.portalItem=r),await K(this._resourceReferences,o),this.portalItem=r,h.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?f(r.itemUrl):void 0}),I(o),n&&(this.thumbnailUrl=l?g(n,"w","8192"):n),o.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}async _verifySave(e,t,r,i){if(!O(this.spatialReference))throw new s("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently.");const{ignoreUnsupported:o,requiredPropertyChecksDisabled:a,strictSchemaValidationEnabled:n}=i||{};z(t,{errorName:"webscene:save"},{ignoreUnsupported:o,supplementalUnsupportedErrors:["scenemodification:unsupported"],requiredPropertyChecksDisabled:a});const l=ae();if(n&&l){const t=(await l()).validate(e);if(!t.length)return;const i=`webscene did not validate:\n${t.join("\n")}`;p.getLogger(this).error(`${r===k.SAVE_AS?"saveAs":"save"}(): ${i}`);const o=t.map((e=>new s("webscene:schema-validation",e)));throw J(o)}}_verifySaveAs(e,t,r){return this._verifySave(e,t,k.SAVE_AS,r)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(){return!1}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=ee.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,this.initialViewProperties.timeExtent=e.timeExtent?.clone()??null,null!=e.clippingArea?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}if(!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this);(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this._updateFromThumbnail(e,t.thumbnailSize??void 0)}async _updateFromThumbnail(e,t){const r=Q(e,t),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-scene"}):this.portalItem?.id?this._loadFromItem(this.portalItem):this._loadObjectsWithLayers()}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion?.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion?.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}async _loadFromJSON(e,t){const r=new o;await this._validateSpatialReference(),await this._validateHeightModelInfo();const{populateOperationalLayers:i}=await import("./layers/support/layersCreator.js"),{operationalLayers:s,operationalElevationLayers:a,basemapElevationLayers:n}=this._extractOperationalLayers(e),l=[],p={context:{...t,layerContainerType:"operational-layers"}};if(this.portalItem&&(p.context.portal=this.portalItem.portal||U.getDefault()),n.length>0){const e={...p,context:{...p.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",l.push(i(this.ground.layers,n,e))}if(a.length>0){const e={...p,context:{...p.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",l.push(i(r,a,e))}s&&s.length>0&&l.push(i(this.layers,s,p)),e.tables?.length&&l.push(i(this.tables,e.tables,{...p,context:{...p.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"})),await Promise.allSettled(l),await this._loadObjectsWithLayers(),this.ground.layers.addMany(r.filter((e=>"base-elevation"===e.type||"elevation"===e.type)))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[],t=[...this.allLayers.items];for(const{basemap:r}of this.presentation.slides.items)r&&(t.push(...r.baseLayers.items),t.push(...r.referenceLayers.items));for(const r of t)if("beforeSave"in r&&"function"==typeof r.beforeSave){const t=r.beforeSave();t&&e.push(t)}await Promise.allSettled(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await Promise.allSettled(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new s("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new s("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r={origin:"web-scene",url:f(e.itemUrl),portal:e.portal||U.getDefault(),portalItem:e,readResourcePaths:[]};await this._readAndLoadFromJSON(t,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!q(t,B.Global))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||R(e,t)}else{if(!q(t,B.Local))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e?.camera?.position.spatialReference??e?.targetGeometry?.spatialReference,o=e.viewpoint,a=i(o);if(a&&!r(a))return Promise.reject(new s("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new s("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=P(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateFeatureLayerSymbolVisibility(){this.sourceVersion?.greaterEqual(1,35)||this.layers.forEach((e=>{"feature"===e.type&&e.addHandles(w((()=>e.loaded),(()=>{"on-the-ground"===e.elevationInfo?.mode&&"simple"===e.renderer?.type&&"polygon-3d"===e.renderer.symbol?.type&&e.renderer.symbol.symbolLayers.some((t=>"fill"===t.type&&null!=t.material&&((!t.material.color||t.material.color.a*e.opacity<se)&&(e.loadWarnings.push(new b("feature-layer:invisible-draped-symbols","FeatureLayer has fully transparent symbols which will no longer render or highlight",{layer:e})),!0))))}),{once:!0,sync:!0}))}))}_validateJSON(e){const t=oe.parse(e.version||"","webscene");return le.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=E.WebMercator.toJSON()),e}_updateTypeKeywords(e){T(e,x.LOCAL_SCENE,"local"===this.initialViewProperties.viewingMode),T(e,x.DEVELOPER_BASEMAP,G(this.basemap)||this.presentation.slides.some((({basemap:e})=>!!e&&G(e)))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||E.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem?.itemUrl?f(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties?.viewing?.search,t=e=>this.allLayers.some((t=>t.id===e&&t.persistenceEnabled));e?.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new s("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}static{this.version=`${le.major}.${le.minor}`}};e([v({type:Z,json:{write:!0}})],de.prototype,"applicationProperties",void 0),e([v({type:L,json:{read:{source:"clippingArea.geometry",reader:M},write:{target:"clippingArea.geometry"}}})],de.prototype,"clippingArea",void 0),e([A("clippingArea")],de.prototype,"writeClippingArea",null),e([v({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],de.prototype,"clippingEnabled",void 0),e([S("clippingEnabled",["clippingArea"])],de.prototype,"readClippingEnabled",null),e([A("clippingEnabled")],de.prototype,"writeClippingEnabled",null),e([v({type:F,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],de.prototype,"floorInfo",void 0),e([v({type:V,json:{write:!0}})],de.prototype,"heightModelInfo",void 0),e([v({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],de.prototype,"layers",void 0),e([A("layers")],de.prototype,"writeLayers",null),e([v({readOnly:!0,type:oe,json:{type:pe(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],de.prototype,"sourceVersion",void 0),e([S("sourceVersion",["version"])],de.prototype,"readSourceVersion",null),e([A("sourceVersion")],de.prototype,"writeSourceVersion",null),e([v({json:{read:!1,write:{enabled:!0,ignoreOrigin:!0}}})],de.prototype,"tables",void 0),e([A("tables")],de.prototype,"writeTables",null),e([v()],de.prototype,"thumbnailUrl",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],de.prototype,"authoringApp",null),e([A("authoringApp")],de.prototype,"writeAuthoringApp",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],de.prototype,"authoringAppVersion",null),e([A("authoringAppVersion")],de.prototype,"writeAuthoringAppVersion",null),e([v({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],de.prototype,"ground",void 0),e([A("ground")],de.prototype,"writeGround",null),e([v({type:o.ofType(ie),json:{write:!0}})],de.prototype,"transportationNetworks",void 0),e([v({type:re,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],de.prototype,"presentation",void 0),e([v({type:te,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new te({viewingMode:"global",spatialReference:E.WebMercator})}})],de.prototype,"initialViewProperties",void 0),e([S("initialViewProperties",["initialState.timeExtent","initialState.environment","initialState.viewpoint","spatialReference","viewingMode"])],de.prototype,"readInitialViewProperties",null),e([v({type:E,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],de.prototype,"spatialReference",null),e([v({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],de.prototype,"viewingMode",null),e([v({type:C})],de.prototype,"portalItem",void 0),e([v()],de.prototype,"resourceInfo",void 0),e([v({type:D,json:{write:!0}})],de.prototype,"widgets",void 0),de=e([_("esri.WebScene")],de);const he=de;export{he as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../request.js";import{ModuleError as t,ModuleErrorCodes as r}from"./executionError.js";import{parseScript as o}from"./parser.js";import s from"./featureset/support/RecentlyUsedCache.js";import i from"../portal/Portal.js";class l{constructor(e){this.portalUri=e}normalizeModuleUri(e){const o=/^[a-z0-9A-Z]+(@[0-9]+\.[0-9]+\.[0-9]+)?([?|/].*)?$/gi,s=/(?<portalurl>.+)\/home\/item\.html\?id=(?<itemid>.+)$/gi,c=/(?<portalurl>.+)\/sharing\/rest\/content\/users\/[a-zA-Z0-9]+\/items\/(?<itemid>.+)$/gi,u=/(?<portalurl>.+)\/sharing\/rest\/content\/items\/(?<itemid>.+)$/gi,n=/(?<itemid>.*)@(?<versionstring>[0-9]+\.[0-9]+\.[0-9]+)([?|/].*)?$/gi;if(e.startsWith("portal+")){let l=e.slice(7),a="",m=l,d=!1;for(const e of[s,u,c]){const t=e.exec(l);if(null!==t){const e=t.groups;m=e.itemid,a=e.portalurl,d=!0;break}}if(!1===d){if(!o.test(l))throw new t(r.UnsupportedUriProtocol,{uri:e});m=l,a=this.portalUri}m.includes("/")&&(m=m.split("/")[0]),m.includes("?")&&(m=m.split("?")[0]);let h="current";const p=n.exec(m);if(null!==p){const e=p.groups;m=e.itemid,h=e.versionstring}return l=new i({url:a}).restUrl+"/content/items/"+m+"/resources/"+h+".arc",{url:l,scheme:"portal",uri:"PO:"+l}}if(e.startsWith("mock")){if("mock"===e){return{url:"",scheme:"mock",data:'\n export var hello = 1;\n export function helloWorld() {\n return "Hello World " + hello;\n }\n ',uri:"mock"}}const t=e.replace("mock:","");if(void 0!==l.mocks[t])return{url:"",scheme:"mock",data:l.mocks[t],uri:e}}throw new t(r.UnrecognizedUri,{uri:e})}async fetchModule(e){const t=l.cachedModules.getFromCache(e.uri);if(t)return t;const r=this.fetchSource(e);l.cachedModules.addToCache(e.uri,r);let o=null;try{o=await r}catch(s){throw l.cachedModules.removeFromCache(e.uri),s}return o}async fetchSource(s){if("portal"===s.scheme){const t=await e(s.url,{responseType:"text",query:{}});if(t.data)return o(t.data,[])}if("mock"===s.scheme)return o(s.data??"",[]);throw new t(r.UnsupportedUriProtocol)}static create(e){return new l(e)}static getDefault(){return this._default??(l._default=l._moduleResolverFactory())}static set moduleResolverClass(e){this._moduleResolverFactory=e,this._default=null}}l.mocks={},l.cachedModules=new s(30),l._default=null,l._moduleResolverFactory=()=>{const e=i.getDefault();return new l(e.url)};export{l as ArcadeModuleResolver};
5
+ import t from"../request.js";import{ModuleError as e,ModuleErrorCodes as r}from"./executionError.js";import{parseScript as o}from"./parser.js";import s from"./featureset/support/RecentlyUsedCache.js";import i from"../portal/Portal.js";class c{constructor(t){this.portalUri=t}static{this.mocks={}}static{this.cachedModules=new s(30)}normalizeModuleUri(t){const o=/^[a-z0-9A-Z]+(@[0-9]+\.[0-9]+\.[0-9]+)?([?|/].*)?$/gi,s=/(?<portalurl>.+)\/home\/item\.html\?id=(?<itemid>.+)$/gi,l=/(?<portalurl>.+)\/sharing\/rest\/content\/users\/[a-zA-Z0-9]+\/items\/(?<itemid>.+)$/gi,a=/(?<portalurl>.+)\/sharing\/rest\/content\/items\/(?<itemid>.+)$/gi,u=/(?<itemid>.*)@(?<versionstring>[0-9]+\.[0-9]+\.[0-9]+)([?|/].*)?$/gi;if(t.startsWith("portal+")){let c=t.slice(7),n="",m=c,d=!1;for(const t of[s,a,l]){const e=t.exec(c);if(null!==e){const t=e.groups;m=t.itemid,n=t.portalurl,d=!0;break}}if(!1===d){if(!o.test(c))throw new e(r.UnsupportedUriProtocol,{uri:t});m=c,n=this.portalUri}m.includes("/")&&(m=m.split("/")[0]),m.includes("?")&&(m=m.split("?")[0]);let h="current";const p=u.exec(m);if(null!==p){const t=p.groups;m=t.itemid,h=t.versionstring}return c=new i({url:n}).restUrl+"/content/items/"+m+"/resources/"+h+".arc",{url:c,scheme:"portal",uri:"PO:"+c}}if(t.startsWith("mock")){if("mock"===t){return{url:"",scheme:"mock",data:'\n export var hello = 1;\n export function helloWorld() {\n return "Hello World " + hello;\n }\n ',uri:"mock"}}const e=t.replace("mock:","");if(void 0!==c.mocks[e])return{url:"",scheme:"mock",data:c.mocks[e],uri:t}}throw new e(r.UnrecognizedUri,{uri:t})}async fetchModule(t){const e=c.cachedModules.getFromCache(t.uri);if(e)return e;const r=this.fetchSource(t);c.cachedModules.addToCache(t.uri,r);let o=null;try{o=await r}catch(s){throw c.cachedModules.removeFromCache(t.uri),s}return o}async fetchSource(s){if("portal"===s.scheme){const e=await t(s.url,{responseType:"text",query:{}});if(e.data)return o(e.data,[])}if("mock"===s.scheme)return o(s.data??"",[]);throw new e(r.UnsupportedUriProtocol)}static create(t){return new c(t)}static{this._default=null}static getDefault(){return this._default??(c._default=c._moduleResolverFactory())}static set moduleResolverClass(t){this._moduleResolverFactory=t,this._default=null}static{this._moduleResolverFactory=()=>{const t=i.getDefault();return new c(t.url)}}}export{c as ArcadeModuleResolver};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import{cloneGeometry as t}from"../../kernel.js";import{FeatureSetError as r,FeatureSetErrorCodes as s}from"../support/errorsupport.js";import a from"../support/FeatureSet.js";import i from"../support/IdSet.js";import{cloneField as l,FeatureServiceDatabaseType as n,isDate as o,isLuxonDate as u,isArcadeTime as h,isArcadeDate as c,isArcadeDateOnly as d,layerGeometryEsriConstants as p}from"../support/shared.js";import{reformulateWithoutField as f,toWhereClause as g,translateFunctionToDatabaseSpecific as N,convertColumnReferenceToSql as _,makeToday as S,makeSqlFromDateTimeParameter as m,makeTimeString as w,arcadeDateToSqlString as v,arcadeDateOnlyToSqlString as C,convertIntervalToSql as T,combine as F,scanForField as W}from"../support/sqlUtils.js";import{assertIsSome as y}from"../../../core/maybe.js";import{SqlError as A,SqlErrorCodes as E}from"../../../core/sql/errorSupport.js";import x from"../../../core/sql/WhereClause.js";import D from"../../../geometry/SpatialReference.js";class I{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class k extends I{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class b extends I{constructor(e,t,r){super(l(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=r}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:f(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class B extends I{constructor(e,t,r){super(e),this.codefield=t,this.lkp=r,this.reverseLkp={};for(const s in r)this.reverseLkp[r[s]]=s;this.sqlRewritable=!0}rewriteSql(e,t){const r=this.evaluateNodeToWhereClause(e.parseTree,n.Standardised,this.field.name,this.codefield instanceof x?g(this.codefield,n.Standardised):this.codefield,e.parameters);return r.includes(B.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:x.create(r,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,r=null,s=null,a){let i,l,n,p;switch(e.type){case"interval":return T(this.evaluateNodeToWhereClause(e.value,t,r,s,a),e.qualifier,e.op);case"case-expression":{let s=" CASE ";"simple"===e.format&&(s+=this.evaluateNodeToWhereClause(e.operand,t,r,B.BADNESS,a));for(let i=0;i<e.clauses.length;i++)s+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[i].operand,t,r,B.BADNESS,a)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[i].value,t,r,B.BADNESS,a);return null!==e.else&&(s+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,r,B.BADNESS,a)),s+=" END ",s}case"parameter":{const r=a[e.value.toLowerCase()];if("string"==typeof r)return"'"+r.toString().replaceAll("'","''")+"'";if(o(r))return m(r,t);if(u(r))return m(r,t);if(h(r))return w(r,t);if(c(r))return v(r,t);if(d(r))return C(r,t);if(Array.isArray(r)){const e=[];for(let s=0;s<r.length;s++)"string"==typeof r[s]?e.push("'"+r[s].toString().replaceAll("'","''")+"'"):o(r[s])||u(r[s])?e.push(m(r[s],t)):h(r[s])?e.push(w(r[s],t)):c(r[s])?e.push(v(r[s],t)):d(r[s])?e.push(C(r[s],t)):e.push(r[s].toString());return e}return r.toString()}case"expression-list":l=[];for(const i of e.value)l.push(this.evaluateNodeToWhereClause(i,t,r,s,a));return l;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,r,B.BADNESS,a)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" AND "+this.evaluateNodeToWhereClause(e.right,t,r,s,a)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" OR "+this.evaluateNodeToWhereClause(e.right,t,r,s,a)+") ";case"IS":if("null"!==e.right.type)throw new A(E.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new A(E.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IS NOT NULL )";case"IN":if(i=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const i=[];let l=!0;for(const t of e.right.value){if("string"!==t.type){l=!1;break}if(void 0===this.lkp[t.value]){l=!1;break}i.push(this.lkp[t.value].toString())}if(l)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IN ("+i.join(",")+")) "}return i=this.evaluateNodeToWhereClause(e.right,t,r,s,a)," ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IN ("+i.join(",")+")) "}return p=this.evaluateNodeToWhereClause(e.right,t,r,s,a),Array.isArray(p)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IN ("+p.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IN ("+p+")) ";case"NOT IN":if(i=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const i=[];let l=!0;for(const t of e.right.value){if("string"!==t.type){l=!1;break}if(void 0===this.lkp[t.value]){l=!1;break}i.push(this.lkp[t.value].toString())}if(l)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" NOT IN ("+i.join(",")+")) "}return i=this.evaluateNodeToWhereClause(e.right,t,r,s,a)," ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" NOT IN ("+i.join(",")+")) "}return p=this.evaluateNodeToWhereClause(e.right,t,r,s,a),Array.isArray(p)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" NOT IN ("+p.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" NOT IN ("+p+")) ";case"BETWEEN":return n=this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)," ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" BETWEEN "+n[0]+" AND "+n[1]+" ) ";case"NOTBETWEEN":return n=this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)," ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" NOT BETWEEN "+n[0]+" AND "+n[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+s+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return S(e.mode,t);case"current-user":return"CURRENT_USER";case"column-reference":return r&&r.toLowerCase()===e.column.toLowerCase()?"("+s+")":_(e.column);case"data-type":return e.value;case"function":{const s=this.evaluateNodeToWhereClause(e.args,t,r,B.BADNESS,a);return N(e.name,s,t)}}throw new A(E.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof x?this.reverseLkp[x.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}}B.BADNESS="_!!!_BAD_LKP_!!!!";class L extends I{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:f(e,this.field.name,g(this._sql,n.Standardised),t.getFieldsIndex())}}extractValue(e){return x.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class R extends a{static findField(e,t){for(const r of e)if(r.name.toLowerCase()===t.toString().toLowerCase())return r;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_initialiseFeatureSet(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new D({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=p.point,this.typeIdField="",this.types=null,this.subtypeField=null,this.subtypes=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await(this._parent?._getSet(e)),this._checkCancelled(e),y(t),this._wset=new i(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(r,s,a,l){const n=[];-1!==s&&void 0===this._featureCache[s]&&n.push(s);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(r,o))return await this._expandPagedSet(r,o,0,0,l),this._getFeatures(r,s,a,l);let u=0;for(let e=r._lastFetchedIndex;e<r._known.length&&(u++,u<=a&&(r._lastFetchedIndex+=1),!(void 0===this._featureCache[r._known[e]]&&(r._known[e]!==s&&n.push(r._known[e]),n.length>=o)));e++);if(0===n.length)return"success";r=new i([],n,r._ordered,null);const h=Math.min(n.length,a);await(this._parent?._getFeatures(r,-1,h,l)),this._checkCancelled(l);const c=[];for(let e=0;e<h;e++){const t=this._parent?._featureFromCache(n[e]);void 0!==t&&c.push({geometry:t.geometry,attributes:t.attributes,id:n[e]})}for(const i of c){const r=[];for(const e of this.adaptedFields)r[e.field.name]=e.extractValue(i);this._featureCache[i.id]=new e({attributes:r,geometry:t(i.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new r(s.NeverReach)}async _getFilteredSet(e,t,r,s,a){let l=!1;const n=this._reformulateWithoutAdaptions(r);l=n.cannot,r=n.where;let o=!1;if(null!==s){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof k)&&!0===s.scanForField(t.field.name)){if(!(t instanceof b)){s=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}s&&e.length>0&&(s=s.replaceFields(e))}null!==r?null!==this._extraFilter&&(r=F(this._extraFilter,r)):r=this._extraFilter,await this._ensureLoaded();const u=await this._parent._getFilteredSet(e,t,r,s,a);let h;return this._checkCancelled(a),h=!0===l?new i(u._candidates.slice().concat(u._known.slice()),[],!0===o&&u._ordered,this._clonePageDefinition(u.pagesDefinition)):new i(u._candidates.slice(),u._known.slice(),!0===o&&u._ordered,this._clonePageDefinition(u.pagesDefinition)),h}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const r of this.adaptedFields)if(!0===W(e,r.field.name)){const s=r.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}async _stat(e,t,r,s,a,i,l){let n=!1,o=this._reformulateWithoutAdaptions(t);if(n=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(a),n=n||o.cannot,null!==(a=o.where)?null!==this._extraFilter&&(a=F(this._extraFilter,a)):a=this._extraFilter,!0===n)return null===a&&""===r&&null===s?this._manualStat(e,t,i,l):{calculated:!1};const u=await this._parent._stat(e,t,r,s,a,i,l);return!1===u.calculated?null===a&&""===r&&null===s?this._manualStat(e,t,i,l):{calculated:!1}:u}async _canDoAggregates(e,t,r,s,a){if(null===this._parent)return!1;for(let n=0;n<e.length;n++)for(const t of this.adaptedFields)if(e[n].toLowerCase()===t.field.name.toLowerCase()&&!(t instanceof k))return!1;const i=[];for(let n=0;n<t.length;n++){const e=t[n];if(null!==e.workingexpr){const t=this._reformulateWithoutAdaptions(e.workingexpr);if(t.cannot)return!1;const r=e.clone();r.workingexpr=t.where,i.push(r)}else i.push(e)}const l=this._reformulateWithoutAdaptions(a);return!l.cannot&&(null!==(a=l.where)?null!==this._extraFilter&&(a=F(this._extraFilter,a)):a=this._extraFilter,this._parent._canDoAggregates(e,i,r,s,a))}async _getAggregatePagesDataSourceDefinition(e,t,a,i,l,n,o){if(null===this._parent)throw new r(s.NeverReach);const u=[];for(let c=0;c<t.length;c++){const e=t[c];if(null!==e.workingexpr){const t=this._reformulateWithoutAdaptions(e.workingexpr);if(t.cannot)throw new r(s.NeverReach);const a=e.clone();a.workingexpr=t.where,u.push(a)}else u.push(e)}const h=this._reformulateWithoutAdaptions(l);if(h.cannot)throw new r(s.NeverReach);return null!==(l=h.where)?null!==this._extraFilter&&(l=F(this._extraFilter,l)):l=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,u,a,i,l,n,o)}}export{R as AdaptedFeatureSet,I as AdaptedField,b as FieldRename,k as OriginalField,L as SqlExpressionAdapted,B as StringToCodeAdapted};
5
+ import e from"../../../Graphic.js";import{cloneGeometry as t}from"../../kernel.js";import{FeatureSetError as r,FeatureSetErrorCodes as s}from"../support/errorsupport.js";import a from"../support/FeatureSet.js";import i from"../support/IdSet.js";import{FeatureServiceDatabaseType as l,isDate as n,isLuxonDate as o,isArcadeTime as u,isArcadeDate as h,isArcadeDateOnly as c,cloneField as d,layerGeometryEsriConstants as p}from"../support/shared.js";import{toWhereClause as f,translateFunctionToDatabaseSpecific as g,convertColumnReferenceToSql as N,makeToday as _,makeSqlFromDateTimeParameter as S,makeTimeString as m,arcadeDateToSqlString as w,arcadeDateOnlyToSqlString as v,convertIntervalToSql as C,reformulateWithoutField as T,combine as F,scanForField as W}from"../support/sqlUtils.js";import{assertIsSome as y}from"../../../core/maybe.js";import{SqlError as A,SqlErrorCodes as E}from"../../../core/sql/errorSupport.js";import x from"../../../core/sql/WhereClause.js";import D from"../../../geometry/SpatialReference.js";class I{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class k extends I{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class b extends I{constructor(e,t,r){super(d(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=r}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:T(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class B extends I{constructor(e,t,r){super(e),this.codefield=t,this.lkp=r,this.reverseLkp={};for(const s in r)this.reverseLkp[r[s]]=s;this.sqlRewritable=!0}static{this.BADNESS="_!!!_BAD_LKP_!!!!"}rewriteSql(e,t){const r=this.evaluateNodeToWhereClause(e.parseTree,l.Standardised,this.field.name,this.codefield instanceof x?f(this.codefield,l.Standardised):this.codefield,e.parameters);return r.includes(B.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:x.create(r,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,r=null,s=null,a){let i,l,d,p;switch(e.type){case"interval":return C(this.evaluateNodeToWhereClause(e.value,t,r,s,a),e.qualifier,e.op);case"case-expression":{let s=" CASE ";"simple"===e.format&&(s+=this.evaluateNodeToWhereClause(e.operand,t,r,B.BADNESS,a));for(let i=0;i<e.clauses.length;i++)s+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[i].operand,t,r,B.BADNESS,a)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[i].value,t,r,B.BADNESS,a);return null!==e.else&&(s+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,r,B.BADNESS,a)),s+=" END ",s}case"parameter":{const r=a[e.value.toLowerCase()];if("string"==typeof r)return"'"+r.toString().replaceAll("'","''")+"'";if(n(r))return S(r,t);if(o(r))return S(r,t);if(u(r))return m(r,t);if(h(r))return w(r,t);if(c(r))return v(r,t);if(Array.isArray(r)){const e=[];for(let s=0;s<r.length;s++)"string"==typeof r[s]?e.push("'"+r[s].toString().replaceAll("'","''")+"'"):n(r[s])||o(r[s])?e.push(S(r[s],t)):u(r[s])?e.push(m(r[s],t)):h(r[s])?e.push(w(r[s],t)):c(r[s])?e.push(v(r[s],t)):e.push(r[s].toString());return e}return r.toString()}case"expression-list":l=[];for(const i of e.value)l.push(this.evaluateNodeToWhereClause(i,t,r,s,a));return l;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,r,B.BADNESS,a)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" AND "+this.evaluateNodeToWhereClause(e.right,t,r,s,a)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" OR "+this.evaluateNodeToWhereClause(e.right,t,r,s,a)+") ";case"IS":if("null"!==e.right.type)throw new A(E.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new A(E.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IS NOT NULL )";case"IN":if(i=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const i=[];let l=!0;for(const t of e.right.value){if("string"!==t.type){l=!1;break}if(void 0===this.lkp[t.value]){l=!1;break}i.push(this.lkp[t.value].toString())}if(l)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IN ("+i.join(",")+")) "}return i=this.evaluateNodeToWhereClause(e.right,t,r,s,a)," ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IN ("+i.join(",")+")) "}return p=this.evaluateNodeToWhereClause(e.right,t,r,s,a),Array.isArray(p)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IN ("+p.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" IN ("+p+")) ";case"NOT IN":if(i=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const i=[];let l=!0;for(const t of e.right.value){if("string"!==t.type){l=!1;break}if(void 0===this.lkp[t.value]){l=!1;break}i.push(this.lkp[t.value].toString())}if(l)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" NOT IN ("+i.join(",")+")) "}return i=this.evaluateNodeToWhereClause(e.right,t,r,s,a)," ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" NOT IN ("+i.join(",")+")) "}return p=this.evaluateNodeToWhereClause(e.right,t,r,s,a),Array.isArray(p)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" NOT IN ("+p.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,a)+" NOT IN ("+p+")) ";case"BETWEEN":return d=this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)," ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" BETWEEN "+d[0]+" AND "+d[1]+" ) ";case"NOTBETWEEN":return d=this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)," ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" NOT BETWEEN "+d[0]+" AND "+d[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+s+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,B.BADNESS,a)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,B.BADNESS,a)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return _(e.mode,t);case"current-user":return"CURRENT_USER";case"column-reference":return r&&r.toLowerCase()===e.column.toLowerCase()?"("+s+")":N(e.column);case"data-type":return e.value;case"function":{const s=this.evaluateNodeToWhereClause(e.args,t,r,B.BADNESS,a);return g(e.name,s,t)}}throw new A(E.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof x?this.reverseLkp[x.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}}class L extends I{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:T(e,this.field.name,f(this._sql,l.Standardised),t.getFieldsIndex())}}extractValue(e){return x.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class R extends a{static findField(e,t){for(const r of e)if(r.name.toLowerCase()===t.toString().toLowerCase())return r;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_initialiseFeatureSet(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new D({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=p.point,this.typeIdField="",this.types=null,this.subtypeField=null,this.subtypes=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await(this._parent?._getSet(e)),this._checkCancelled(e),y(t),this._wset=new i(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(r,s,a,l){const n=[];-1!==s&&void 0===this._featureCache[s]&&n.push(s);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(r,o))return await this._expandPagedSet(r,o,0,0,l),this._getFeatures(r,s,a,l);let u=0;for(let e=r._lastFetchedIndex;e<r._known.length&&(u++,u<=a&&(r._lastFetchedIndex+=1),!(void 0===this._featureCache[r._known[e]]&&(r._known[e]!==s&&n.push(r._known[e]),n.length>=o)));e++);if(0===n.length)return"success";r=new i([],n,r._ordered,null);const h=Math.min(n.length,a);await(this._parent?._getFeatures(r,-1,h,l)),this._checkCancelled(l);const c=[];for(let e=0;e<h;e++){const t=this._parent?._featureFromCache(n[e]);void 0!==t&&c.push({geometry:t.geometry,attributes:t.attributes,id:n[e]})}for(const i of c){const r=[];for(const e of this.adaptedFields)r[e.field.name]=e.extractValue(i);this._featureCache[i.id]=new e({attributes:r,geometry:t(i.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new r(s.NeverReach)}async _getFilteredSet(e,t,r,s,a){let l=!1;const n=this._reformulateWithoutAdaptions(r);l=n.cannot,r=n.where;let o=!1;if(null!==s){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof k)&&!0===s.scanForField(t.field.name)){if(!(t instanceof b)){s=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}s&&e.length>0&&(s=s.replaceFields(e))}null!==r?null!==this._extraFilter&&(r=F(this._extraFilter,r)):r=this._extraFilter,await this._ensureLoaded();const u=await this._parent._getFilteredSet(e,t,r,s,a);let h;return this._checkCancelled(a),h=!0===l?new i(u._candidates.slice().concat(u._known.slice()),[],!0===o&&u._ordered,this._clonePageDefinition(u.pagesDefinition)):new i(u._candidates.slice(),u._known.slice(),!0===o&&u._ordered,this._clonePageDefinition(u.pagesDefinition)),h}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const r of this.adaptedFields)if(!0===W(e,r.field.name)){const s=r.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}async _stat(e,t,r,s,a,i,l){let n=!1,o=this._reformulateWithoutAdaptions(t);if(n=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(a),n=n||o.cannot,null!==(a=o.where)?null!==this._extraFilter&&(a=F(this._extraFilter,a)):a=this._extraFilter,!0===n)return null===a&&""===r&&null===s?this._manualStat(e,t,i,l):{calculated:!1};const u=await this._parent._stat(e,t,r,s,a,i,l);return!1===u.calculated?null===a&&""===r&&null===s?this._manualStat(e,t,i,l):{calculated:!1}:u}async _canDoAggregates(e,t,r,s,a){if(null===this._parent)return!1;for(let n=0;n<e.length;n++)for(const t of this.adaptedFields)if(e[n].toLowerCase()===t.field.name.toLowerCase()&&!(t instanceof k))return!1;const i=[];for(let n=0;n<t.length;n++){const e=t[n];if(null!==e.workingexpr){const t=this._reformulateWithoutAdaptions(e.workingexpr);if(t.cannot)return!1;const r=e.clone();r.workingexpr=t.where,i.push(r)}else i.push(e)}const l=this._reformulateWithoutAdaptions(a);return!l.cannot&&(null!==(a=l.where)?null!==this._extraFilter&&(a=F(this._extraFilter,a)):a=this._extraFilter,this._parent._canDoAggregates(e,i,r,s,a))}async _getAggregatePagesDataSourceDefinition(e,t,a,i,l,n,o){if(null===this._parent)throw new r(s.NeverReach);const u=[];for(let c=0;c<t.length;c++){const e=t[c];if(null!==e.workingexpr){const t=this._reformulateWithoutAdaptions(e.workingexpr);if(t.cannot)throw new r(s.NeverReach);const a=e.clone();a.workingexpr=t.where,u.push(a)}else u.push(e)}const h=this._reformulateWithoutAdaptions(l);if(h.cannot)throw new r(s.NeverReach);return null!==(l=h.where)?null!==this._extraFilter&&(l=F(this._extraFilter,l)):l=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,u,a,i,l,n,o)}}export{R as AdaptedFeatureSet,I as AdaptedField,b as FieldRename,k as OriginalField,L as SqlExpressionAdapted,B as StringToCodeAdapted};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"./cache.js";import{FeatureSetError as t,FeatureSetErrorCodes as n}from"./errorsupport.js";import s from"./FeatureSetIterator.js";import i from"./IdSet.js";import{FeatureServiceDatabaseType as a,layerGeometryEsriConstants as r,IdState as l,esriFieldToJson as u,layerGeometryEsriRestConstants as h}from"./shared.js";import{max as o,min as c,sum as d,variance as f,stdev as _,mean as p,distinct as m,count as g}from"./stats.js";import{invokeRemoteGeometryOp as y}from"../../geometry/operatorsWorkerConnection.js";import{isPromiseLike as F}from"../../../core/promiseUtils.js";import I from"../../../core/sql/WhereClause.js";import T from"../../../geometry/SpatialReference.js";import{fromJSON as b}from"../../../geometry/support/jsonUtils.js";import w from"../../../layers/support/FieldsIndex.js";class S{constructor(e){this.recentlyUsedQueries=null,this.featureSetQueryInterceptor=null,this._idstates=[],this._parent=null,this._wset=null,this._mainSetInUse=null,this._maxProcessing=200,this._maxQuery=500,this._totalCount=-1,this._databaseType=a.NotEvaluated,this._databaseTypeProbed=null,this.declaredRootClass="esri.arcade.featureset.support.FeatureSet",this._featureCache=Object.create(null),this.typeIdField=null,this.types=null,this.subtypeField=null,this.subtypes=null,this.fields=null,this.geometryType="",this.objectIdField="",this.globalIdField="",this.spatialReference=null,this.hasM=!1,this.hasZ=!1,this._transparent=!1,this.loaded=!1,this._loadPromise=null,this._fieldsIndex=null,this.fsetInfo=null,e?.lrucache&&(this.recentlyUsedQueries=e.lrucache),e?.interceptor&&(this.featureSetQueryInterceptor=e.interceptor)}optimisePagingFeatureQueries(e){this._parent&&this._parent.optimisePagingFeatureQueries(e)}_hasMemorySource(){return!0}prop(e,t){return void 0===t?this[e]:(void 0!==this[e]&&(this[e]=t),this)}end(){return null!==this._parent&&!0===this._parent._transparent?this._parent.end():this._parent}_ensureLoaded(){return this.load()}load(){return null===this._loadPromise&&(this._loadPromise=this.loadImpl()),this._loadPromise}async loadImpl(){return!0===this._parent?.loaded?(this._initialiseFeatureSet(),this):(await(this._parent?.load()),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new T({wkid:4326}),this.geometryType=r.point)}getField(e,t){let n;return(t=t||this.fields)&&(e=e.toLowerCase(),t.some((t=>(t&&t.name.toLowerCase()===e&&(n=t),!!n)))),n}getFieldsIndex(){return null===this._fieldsIndex&&(this._fieldsIndex=w.fromLayer({timeInfo:this.timeInfo,editFieldsInfo:this.editFieldsInfo,dateFieldsTimeZone:this.dateFieldsTimeZone,datesInUnknownTimezone:this.datesInUnknownTimezone,fields:this.fields})),this._fieldsIndex}_maxProcessingRate(){return null!==this._parent?Math.min(this._maxProcessing,this._parent._maxProcessingRate()):Math.min(this._maxProcessing,this._maxQueryRate())}_maxQueryRate(){return null!==this._parent?Math.max(this._maxQuery,this._parent._maxQueryRate()):this._maxQuery}_checkCancelled(e){if(null!=e&&e.aborted)throw new t(n.Cancelled)}nativeCapabilities(){return this._parent.nativeCapabilities()}async _canDoAggregates(e,t,n,s,i){return null!==this._parent&&this._parent._canDoAggregates(e,t,n,s,i)}async _getAggregatePagesDataSourceDefinition(e,s,i,a,r,l,u){if(null===this._parent)throw new t(n.NeverReach);return this._parent._getAggregatePagesDataSourceDefinition(e,s,i,a,r,l,u)}async _getAgregagtePhysicalPage(e,s,i){if(null===this._parent)throw new t(n.NeverReach);return this._parent._getAgregagtePhysicalPage(e,s,i)}async databaseType(){if(this._databaseType===a.NotEvaluated){if(null!==e.applicationCache){const t=e.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());if(null!==t)return t}if(null!==this._databaseTypeProbed)return this._databaseTypeProbed;try{this._databaseTypeProbed=this._getDatabaseTypeImpl(),null!==e.applicationCache&&e.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(),this._databaseTypeProbed)}catch(t){throw null!==e.applicationCache&&e.applicationCache.clearDatabaseType(this._cacheableFeatureSetSourceKey()),t}return this._databaseTypeProbed}return this._databaseType}async _getDatabaseTypeImpl(){const e=[{thetype:a.SqlServer,testwhere:"(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0"},{thetype:a.Oracle,testwhere:"(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0"},{thetype:a.StandardisedNoInterval,testwhere:"(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0"}];for(const t of e){if(!0===await this._runDatabaseProbe(t.testwhere))return t.thetype}return a.StandardisedNoInterval}_cacheableFeatureSetSourceKey(){return"MUSTBESET"}async _runDatabaseProbe(e){if(null!==this._parent)return this._parent._runDatabaseProbe(e);throw new t(n.NotImplemented)}isTable(){return this._parent?.isTable()??!1}_featureFromCache(e){if(void 0!==this._featureCache[e])return this._featureCache[e]}_isInFeatureSet(e){return l.Unknown}_getSet(e){throw new t(n.NotImplemented)}async _getFeature(e,s,i){if(this._checkCancelled(i),void 0!==this._featureFromCache(s))return this._featureFromCache(s);if(await this._getFeatures(e,s,this._maxProcessingRate(),i),this._checkCancelled(i),void 0!==this._featureFromCache(s))return this._featureFromCache(s);throw new t(n.MissingFeatures)}async _getFeatureBatch(e,t){this._checkCancelled(t);const n=new i([],e,!1,null),s=[];await this._getFeatures(n,-1,e.length,t),this._checkCancelled(t);for(const i of e)void 0!==this._featureFromCache(i)&&s.push(this._featureFromCache(i));return s}async _getFeatures(e,t,n,s){return"success"}_getFilteredSet(e,s,i,a,r){throw new t(n.NotImplemented)}async _refineSetBlock(e,t,n){if(!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQueryRate()))return await this._expandPagedSet(e,this._maxQueryRate(),0,0,n),this._refineSetBlock(e,t,n);this._checkCancelled(n);const s=e._candidates.length;this._refineKnowns(e,t);let i=s-e._candidates.length;if(0===e._candidates.length)return e;if(i>=t)return e;if(await this._refineIfParentKnown(e,t-i,n),this._checkCancelled(n),this._refineKnowns(e,t-i),i=s-e._candidates.length,i<t&&e._candidates.length>0){const s=t-i,a=this._prepareFetchAndRefineSet(e._candidates);return await this._fetchAndRefineFeatures(a,a.length>s?s:e._candidates.length,n),this._checkCancelled(n),this._refineKnowns(e,t-i),e}return e}_fetchAndRefineFeatures(e,t,n){return null}_prepareFetchAndRefineSet(e){const t=[];for(let n=0;n<e.length;n++)this._isPhysicalFeature(e[n])&&t.push(e[n]);return t}_isPhysicalFeature(e){return null===this._parent||this._parent._isPhysicalFeature(e)}_refineKnowns(e,t){let n=0,s=null;const i=[];t=this._maxQueryRate();for(let a=0;a<e._candidates.length&&"GETPAGES"!==e._candidates[a];a++){let r=!1;const u=this._candidateIdTransform(e._candidates[a]);u!==e._candidates[a]&&(r=!0);const h=this._isInFeatureSet(u);if(h===l.InFeatureSet)!0===r?e._known.includes(u)||(e._known.push(u),n+=1):(e._known.push(e._candidates[a]),n+=1),null===s?s={start:a,end:a}:s.end===a-1?s.end=a:(i.push(s),s={start:a,end:a});else if(h===l.NotInFeatureSet)null===s?s={start:a,end:a}:s.end===a-1?s.end=a:(i.push(s),s={start:a,end:a}),n+=1;else if(h===l.Unknown&&(n+=1,!0===e._ordered))break;if(n>=t)break}null!==s&&i.push(s);for(let a=i.length-1;a>=0;a--)e._candidates.splice(i[a].start,i[a].end-i[a].start+1)}_refineIfParentKnown(e,t,n){const s=new i([],[],e._ordered,null);return s._candidates=e._candidates.slice(),this._parent._refineSetBlock(s,t,n)}_candidateIdTransform(e){return this._parent._candidateIdTransform(e)}_checkIfNeedToExpandKnownPage(e,t){if(null===e.pagesDefinition)return!1;let n=0;for(let s=e._lastFetchedIndex;s<e._known.length;s++){if("GETPAGES"===e._known[s])return!0;if(void 0===this._featureCache[e._known[s]]&&(n+=1,n>=t))break}return!1}_checkIfNeedToExpandCandidatePage(e,t){if(null===e.pagesDefinition)return!1;let n=0;for(let s=0;s<e._candidates.length;s++){if("GETPAGES"===e._candidates[s])return!0;if(n+=1,n>=t)break}return!1}async _expandPagedSet(e,s,i,a,r){if(null===this._parent)throw new t(n.NotImplemented);return this._parent._expandPagedSet(e,s,i,a,r)}async _expandPagedSetFeatureSet(e,t,n,s,i){if(e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]&&(s=1),0===s&&e._candidates.length>0&&"GETPAGES"===e._candidates[e._candidates.length-1]&&(s=2),0===s)return"finished";const a=await this._getPage(e,s,i);return n+a<t?this._expandPagedSet(e,t,n+a,0,i):"success"}async _getPage(e,t,n){const s=1===t?e._known:e._candidates;if(e.pagesDefinition.internal.set.length>e.pagesDefinition.resultOffset||!0===e.pagesDefinition.internal.fullyResolved){s.length=s.length-1;let t=0;for(let i=0;i<e.pagesDefinition.resultRecordCount&&!(e.pagesDefinition.resultOffset+i>=e.pagesDefinition.internal.set.length);i++)s[s.length]=e.pagesDefinition.internal.set[e.pagesDefinition.resultOffset+i],t++;e.pagesDefinition.resultOffset+=t;let n=!1;return!0===e.pagesDefinition.internal.fullyResolved&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset&&(n=!0),!1===n&&s.push("GETPAGES"),t}return await this._getPhysicalPage(e,t,n),this._getPage(e,t,n)}_getPhysicalPage(e,t,n){return null}_clonePageDefinition(e){return null===this._parent?null:this._parent._clonePageDefinition(e)}_first(e){return this.iterator(e).next()}first(e){return this._first(e)}async calculateStatistic(e,t,n,s){await this._ensureLoaded();let i=await this._stat(e,t,"",null,null,n,s);return!1===i.calculated&&(i=await this._manualStat(e,t,n,s)),i.result}async _manualStat(e,t,n,s){let i=null;switch(e.toLowerCase()){case"count":return i=await g(this,s),{calculated:!0,result:i};case"distinct":return i=await m(this,t,n,s),{calculated:!0,result:i};case"avg":case"mean":return i=await p(this,t,s),{calculated:!0,result:i};case"stdev":return i=await _(this,t,s),{calculated:!0,result:i};case"variance":return i=await f(this,t,s),{calculated:!0,result:i};case"sum":return i=await d(this,t,s),{calculated:!0,result:i};case"min":return i=await c(this,t,s),{calculated:!0,result:i};case"max":return i=await o(this,t,s),{calculated:!0,result:i};default:return{calculated:!0,result:0}}}async _stat(e,t,n,s,i,a,r){const l=await this._parent._stat(e,t,n,s,i,a,r);return!1===l.calculated?null===i&&""===n&&null===s?this._manualStat(e,t,a,r):{calculated:!1}:l}_unionAllGeomSelf(e){const t=this.iterator(this._defaultTracker(e)),n=[];return new Promise(((e,s)=>{this._unionShapeInBatches(n,t,e,s)}))}_unionAllGeom(e){return new Promise(((t,n)=>{const s=this.iterator(this._defaultTracker(e)),i=[];this._unionShapeInBatches(i,s,t,n)}))}_unionShapeInBatches(e,t,n,s){t.next().then((i=>{try{null!==i&&null!==i.geometry&&e.push(i.geometry),e.length>30||null===i&&e.length>1?y("union",[e.map((e=>e.toJSON()))]).then((a=>{try{null===i?n(a):(e=[b(a)],this._unionShapeInBatches(e,t,n,s))}catch(r){s(r)}}),s):null===i?1===e.length?n(e[0]):n(null):this._unionShapeInBatches(e,t,n,s)}catch(a){s(a)}}),s)}iterator(e){return new s(this,e)}intersection(e,t=!1){return S._featuresetFunctions.intersection.bind(this)(e,t)}difference(e,t=!1,n=!0){return S._featuresetFunctions.difference.bind(this)(e,t,n)}symmetricDifference(e,t=!1,n=!0){return S._featuresetFunctions.symmetricDifference.bind(this)(e,t,n)}morphShape(e,t,n="unknown",s=null){return S._featuresetFunctions.morphShape.bind(this)(e,t,n,s)}morphShapeAndAttributes(e,t,n="unknown"){return S._featuresetFunctions.morphShapeAndAttributes.bind(this)(e,t,n)}union(e,t=!1){return S._featuresetFunctions.union.bind(this)(e,t)}intersects(e){return S._featuresetFunctions.intersects.bind(this)(e)}envelopeIntersects(e){return S._featuresetFunctions.envelopeIntersects.bind(this)(e)}contains(e){return S._featuresetFunctions.contains.bind(this)(e)}overlaps(e){return S._featuresetFunctions.overlaps.bind(this)(e)}relate(e,t){return S._featuresetFunctions.relate.bind(this)(e,t)}within(e){return S._featuresetFunctions.within.bind(this)(e)}touches(e){return S._featuresetFunctions.touches.bind(this)(e)}top(e){return S._featuresetFunctions.top.bind(this)(e)}crosses(e){return S._featuresetFunctions.crosses.bind(this)(e)}buffer(e,t,n,s=!0){return S._featuresetFunctions.buffer.bind(this)(e,t,n,s)}filter(e,t=null){return S._featuresetFunctions.filter.bind(this)(e,t)}orderBy(e){return S._featuresetFunctions.orderBy.bind(this)(e)}dissolve(e,t){return S._featuresetFunctions.dissolve.bind(this)(e,t)}groupby(e,t){return S._featuresetFunctions.groupby.bind(this)(e,t)}reduce(e,t=null,n){return new Promise(((s,i)=>{this._reduceImpl(this.iterator(this._defaultTracker(n)),e,t,0,s,i,0)}))}_reduceImpl(e,t,n,s,i,a,r){try{if(++r>1e3)return void setTimeout((()=>{r=0,this._reduceImpl(e,t,n,s,i,a,r)}));e.next().then((l=>{try{if(null===l)i(n);else{const u=t(n,l,s,this);F(u)?u.then((n=>{this._reduceImpl(e,t,n,s+1,i,a,r)}),a):this._reduceImpl(e,t,u,s+1,i,a,r)}}catch(u){a(u)}}),a)}catch(l){a(l)}}removeField(e){return S._featuresetFunctions.removeField.bind(this)(e)}addField(e,t,n=null){return S._featuresetFunctions.addField.bind(this)(e,t,n)}async sumArea(e,t=!1,n){const s=this.iterator(n);let i,a=0;for(;null!=(i=await s.next());)null!=i.geometry&&(a+=t?await y("geodeticArea",[i.geometry.toJSON(),e]):await y("area",[i.geometry.toJSON(),e]));return a}async sumLength(e,t=!1,n){const s=this.iterator(n);let i,a=0;for(;null!=(i=await s.next());)null!=i.geometry&&(a+=t?await y("geodeticLength",[i.geometry.toJSON(),e]):await y("length",[i.geometry.toJSON(),e]));return a}async distinct(e,t=1e3,n=null,s){await this.load();const i=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(i,n),this.calculateStatistic("distinct",i,t,this._defaultTracker(s))}async min(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("min",s,-1,this._defaultTracker(n))}async max(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("max",s,-1,this._defaultTracker(n))}async avg(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("avg",s,-1,this._defaultTracker(n))}async sum(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("sum",s,-1,this._defaultTracker(n))}async stdev(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("stdev",s,-1,this._defaultTracker(n))}async variance(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("variance",s,-1,this._defaultTracker(n))}async count(e){return await this.load(),this.calculateStatistic("count",I.create("1",{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),-1,this._defaultTracker(e))}_defaultTracker(e){return e??{aborted:!1}}forEach(e,t){return new Promise(((n,s)=>{this._forEachImpl(this.iterator(this._defaultTracker(t)),e,this,n,s,0)}))}_forEachImpl(e,t,n,s,i,a){try{if(++a>1e3)return void setTimeout((()=>{a=0,this._forEachImpl(e,t,n,s,i,a)}),0);e.next().then((r=>{try{if(null===r)s(n);else{const l=t(r);null==l?this._forEachImpl(e,t,n,s,i,a):F(l)?l.then((()=>{try{this._forEachImpl(e,t,n,s,i,a)}catch(r){i(r)}}),i):this._forEachImpl(e,t,n,s,i,a)}}catch(l){i(l)}}),i)}catch(r){i(r)}}convertToJSON(e){const t={layerDefinition:{geometryType:this.geometryType,fields:[]},featureSet:{features:[],geometryType:this.geometryType}};for(let n=0;n<this.fields.length;n++)t.layerDefinition.fields.push(u(this.fields[n]));return this.reduce(((e,n)=>{const s={geometry:n.geometry?.toJSON(),attributes:{}};for(const t in n.attributes)s.attributes[t]=n.attributes[t];return t.featureSet.features.push(s),1}),0,e).then((()=>t))}castToText(e=!1){return"object, FeatureSet"}queryAttachments(e,t,n,s,i){return this._parent.queryAttachments(e,t,n,s,i)}serviceUrl(){return this._parent.serviceUrl()}subtypeMetaData(){return this.subtypeField&&this.subtypes?{subtypeField:this.subtypeField,subtypes:this.subtypes?this.subtypes.map((e=>({name:e.name,code:e.code}))):[]}:this.typeIdField?{subtypeField:this.typeIdField,subtypes:this.types?this.types.map((e=>({name:e.name,code:e.id}))):[]}:null}relationshipMetaData(){return this._parent.relationshipMetaData()}get gdbVersion(){return this._parent?this._parent.gdbVersion:""}schema(){const e=[];for(const t of this.fields)e.push(u(t));return{objectIdField:this.objectIdField,globalIdField:this.globalIdField,geometryType:void 0===h[this.geometryType]?"esriGeometryNull":h[this.geometryType],fields:e}}async convertToText(e,t){if("schema"===e)return await this._ensureLoaded(),JSON.stringify(this.schema());if("featureset"===e){await this._ensureLoaded();const e=[];await this.reduce(((t,n)=>{const s={geometry:n.geometry?n.geometry.toJSON():null,attributes:n.attributes};return null!==s.geometry&&s.geometry.spatialReference&&delete s.geometry.spatialReference,e.push(s),1}),0,t);const n=this.schema();return n.features=e,n.spatialReference=this.spatialReference.toJSON(),JSON.stringify(n)}return this.castToText()}getFeatureByObjectId(e,t){return this._parent.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._parent.getOwningSystemUrl()}getIdentityUser(){return this._parent.getIdentityUser()}getRootFeatureSet(){return null!==this._parent?this._parent.getRootFeatureSet():this}getDataSourceFeatureSet(){return null!==this._parent?this._parent.getDataSourceFeatureSet():this}castAsJson(e=null){return"keeptype"===e?.featureset?this:"none"===e?.featureset?null:{type:"FeatureSet"}}async castAsJsonAsync(e=null,t=null){if("keeptype"===t?.featureset)return this;if("schema"===t?.featureset)return await this._ensureLoaded(),JSON.parse(JSON.stringify(this.schema()));if("none"===t?.featureset)return null;await this._ensureLoaded();const n=[];await this.reduce(((e,s)=>{const i={geometry:s.geometry?!0===t?.keepGeometryType?s.geometry:s.geometry.toJSON():null,attributes:s.attributes};return null!==i.geometry&&i.geometry.spatialReference&&!0!==t?.keepGeometryType&&delete i.geometry.spatialReference,n.push(i),1}),0,e);const s=this.schema();return s.features=n,s.spatialReference=!0===t?.keepGeometryType?this.spatialReference:this.spatialReference?.toJSON(),s}fieldTimeZone(e){return this.getFieldsIndex().getTimeZone(e)}get preferredTimeZone(){return this._parent?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._parent?.dateFieldsTimeZone??null}get dateFieldsTimeZoneDefaultUTC(){if(this.datesInUnknownTimezone)return"unknown";const e=this.dateFieldsTimeZone??"UTC";return""===e?"UTC":e}get datesInUnknownTimezone(){return this._parent.datesInUnknownTimezone}get editFieldsInfo(){return this._parent?.editFieldsInfo??null}get timeInfo(){return this._parent?.timeInfo??null}set featureSetInfo(e){this.fsetInfo=e}async getFeatureSetInfo(){return this.fsetInfo??await(this._parent?.getFeatureSetInfo())??null}}function D(e,t){if(null!==t){const n={};for(const e in t)n[e.toLowerCase()]=t[e];e.parameters=n}}S._featuresetFunctions={};export{S as default};
5
+ import e from"./cache.js";import{FeatureSetError as t,FeatureSetErrorCodes as n}from"./errorsupport.js";import s from"./FeatureSetIterator.js";import i from"./IdSet.js";import{FeatureServiceDatabaseType as a,layerGeometryEsriConstants as r,IdState as l,esriFieldToJson as u,layerGeometryEsriRestConstants as h}from"./shared.js";import{max as o,min as c,sum as d,variance as f,stdev as _,mean as p,distinct as m,count as g}from"./stats.js";import{invokeRemoteGeometryOp as y}from"../../geometry/operatorsWorkerConnection.js";import{isPromiseLike as F}from"../../../core/promiseUtils.js";import I from"../../../core/sql/WhereClause.js";import T from"../../../geometry/SpatialReference.js";import{fromJSON as b}from"../../../geometry/support/jsonUtils.js";import w from"../../../layers/support/FieldsIndex.js";class S{constructor(e){this.recentlyUsedQueries=null,this.featureSetQueryInterceptor=null,this._idstates=[],this._parent=null,this._wset=null,this._mainSetInUse=null,this._maxProcessing=200,this._maxQuery=500,this._totalCount=-1,this._databaseType=a.NotEvaluated,this._databaseTypeProbed=null,this.declaredRootClass="esri.arcade.featureset.support.FeatureSet",this._featureCache=Object.create(null),this.typeIdField=null,this.types=null,this.subtypeField=null,this.subtypes=null,this.fields=null,this.geometryType="",this.objectIdField="",this.globalIdField="",this.spatialReference=null,this.hasM=!1,this.hasZ=!1,this._transparent=!1,this.loaded=!1,this._loadPromise=null,this._fieldsIndex=null,this.fsetInfo=null,e?.lrucache&&(this.recentlyUsedQueries=e.lrucache),e?.interceptor&&(this.featureSetQueryInterceptor=e.interceptor)}optimisePagingFeatureQueries(e){this._parent&&this._parent.optimisePagingFeatureQueries(e)}_hasMemorySource(){return!0}static{this._featuresetFunctions={}}prop(e,t){return void 0===t?this[e]:(void 0!==this[e]&&(this[e]=t),this)}end(){return null!==this._parent&&!0===this._parent._transparent?this._parent.end():this._parent}_ensureLoaded(){return this.load()}load(){return null===this._loadPromise&&(this._loadPromise=this.loadImpl()),this._loadPromise}async loadImpl(){return!0===this._parent?.loaded?(this._initialiseFeatureSet(),this):(await(this._parent?.load()),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new T({wkid:4326}),this.geometryType=r.point)}getField(e,t){let n;return(t=t||this.fields)&&(e=e.toLowerCase(),t.some((t=>(t&&t.name.toLowerCase()===e&&(n=t),!!n)))),n}getFieldsIndex(){return null===this._fieldsIndex&&(this._fieldsIndex=w.fromLayer({timeInfo:this.timeInfo,editFieldsInfo:this.editFieldsInfo,dateFieldsTimeZone:this.dateFieldsTimeZone,datesInUnknownTimezone:this.datesInUnknownTimezone,fields:this.fields})),this._fieldsIndex}_maxProcessingRate(){return null!==this._parent?Math.min(this._maxProcessing,this._parent._maxProcessingRate()):Math.min(this._maxProcessing,this._maxQueryRate())}_maxQueryRate(){return null!==this._parent?Math.max(this._maxQuery,this._parent._maxQueryRate()):this._maxQuery}_checkCancelled(e){if(null!=e&&e.aborted)throw new t(n.Cancelled)}nativeCapabilities(){return this._parent.nativeCapabilities()}async _canDoAggregates(e,t,n,s,i){return null!==this._parent&&this._parent._canDoAggregates(e,t,n,s,i)}async _getAggregatePagesDataSourceDefinition(e,s,i,a,r,l,u){if(null===this._parent)throw new t(n.NeverReach);return this._parent._getAggregatePagesDataSourceDefinition(e,s,i,a,r,l,u)}async _getAgregagtePhysicalPage(e,s,i){if(null===this._parent)throw new t(n.NeverReach);return this._parent._getAgregagtePhysicalPage(e,s,i)}async databaseType(){if(this._databaseType===a.NotEvaluated){if(null!==e.applicationCache){const t=e.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());if(null!==t)return t}if(null!==this._databaseTypeProbed)return this._databaseTypeProbed;try{this._databaseTypeProbed=this._getDatabaseTypeImpl(),null!==e.applicationCache&&e.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(),this._databaseTypeProbed)}catch(t){throw null!==e.applicationCache&&e.applicationCache.clearDatabaseType(this._cacheableFeatureSetSourceKey()),t}return this._databaseTypeProbed}return this._databaseType}async _getDatabaseTypeImpl(){const e=[{thetype:a.SqlServer,testwhere:"(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0"},{thetype:a.Oracle,testwhere:"(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0"},{thetype:a.StandardisedNoInterval,testwhere:"(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0"}];for(const t of e){if(!0===await this._runDatabaseProbe(t.testwhere))return t.thetype}return a.StandardisedNoInterval}_cacheableFeatureSetSourceKey(){return"MUSTBESET"}async _runDatabaseProbe(e){if(null!==this._parent)return this._parent._runDatabaseProbe(e);throw new t(n.NotImplemented)}isTable(){return this._parent?.isTable()??!1}_featureFromCache(e){if(void 0!==this._featureCache[e])return this._featureCache[e]}_isInFeatureSet(e){return l.Unknown}_getSet(e){throw new t(n.NotImplemented)}async _getFeature(e,s,i){if(this._checkCancelled(i),void 0!==this._featureFromCache(s))return this._featureFromCache(s);if(await this._getFeatures(e,s,this._maxProcessingRate(),i),this._checkCancelled(i),void 0!==this._featureFromCache(s))return this._featureFromCache(s);throw new t(n.MissingFeatures)}async _getFeatureBatch(e,t){this._checkCancelled(t);const n=new i([],e,!1,null),s=[];await this._getFeatures(n,-1,e.length,t),this._checkCancelled(t);for(const i of e)void 0!==this._featureFromCache(i)&&s.push(this._featureFromCache(i));return s}async _getFeatures(e,t,n,s){return"success"}_getFilteredSet(e,s,i,a,r){throw new t(n.NotImplemented)}async _refineSetBlock(e,t,n){if(!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQueryRate()))return await this._expandPagedSet(e,this._maxQueryRate(),0,0,n),this._refineSetBlock(e,t,n);this._checkCancelled(n);const s=e._candidates.length;this._refineKnowns(e,t);let i=s-e._candidates.length;if(0===e._candidates.length)return e;if(i>=t)return e;if(await this._refineIfParentKnown(e,t-i,n),this._checkCancelled(n),this._refineKnowns(e,t-i),i=s-e._candidates.length,i<t&&e._candidates.length>0){const s=t-i,a=this._prepareFetchAndRefineSet(e._candidates);return await this._fetchAndRefineFeatures(a,a.length>s?s:e._candidates.length,n),this._checkCancelled(n),this._refineKnowns(e,t-i),e}return e}_fetchAndRefineFeatures(e,t,n){return null}_prepareFetchAndRefineSet(e){const t=[];for(let n=0;n<e.length;n++)this._isPhysicalFeature(e[n])&&t.push(e[n]);return t}_isPhysicalFeature(e){return null===this._parent||this._parent._isPhysicalFeature(e)}_refineKnowns(e,t){let n=0,s=null;const i=[];t=this._maxQueryRate();for(let a=0;a<e._candidates.length&&"GETPAGES"!==e._candidates[a];a++){let r=!1;const u=this._candidateIdTransform(e._candidates[a]);u!==e._candidates[a]&&(r=!0);const h=this._isInFeatureSet(u);if(h===l.InFeatureSet)!0===r?e._known.includes(u)||(e._known.push(u),n+=1):(e._known.push(e._candidates[a]),n+=1),null===s?s={start:a,end:a}:s.end===a-1?s.end=a:(i.push(s),s={start:a,end:a});else if(h===l.NotInFeatureSet)null===s?s={start:a,end:a}:s.end===a-1?s.end=a:(i.push(s),s={start:a,end:a}),n+=1;else if(h===l.Unknown&&(n+=1,!0===e._ordered))break;if(n>=t)break}null!==s&&i.push(s);for(let a=i.length-1;a>=0;a--)e._candidates.splice(i[a].start,i[a].end-i[a].start+1)}_refineIfParentKnown(e,t,n){const s=new i([],[],e._ordered,null);return s._candidates=e._candidates.slice(),this._parent._refineSetBlock(s,t,n)}_candidateIdTransform(e){return this._parent._candidateIdTransform(e)}_checkIfNeedToExpandKnownPage(e,t){if(null===e.pagesDefinition)return!1;let n=0;for(let s=e._lastFetchedIndex;s<e._known.length;s++){if("GETPAGES"===e._known[s])return!0;if(void 0===this._featureCache[e._known[s]]&&(n+=1,n>=t))break}return!1}_checkIfNeedToExpandCandidatePage(e,t){if(null===e.pagesDefinition)return!1;let n=0;for(let s=0;s<e._candidates.length;s++){if("GETPAGES"===e._candidates[s])return!0;if(n+=1,n>=t)break}return!1}async _expandPagedSet(e,s,i,a,r){if(null===this._parent)throw new t(n.NotImplemented);return this._parent._expandPagedSet(e,s,i,a,r)}async _expandPagedSetFeatureSet(e,t,n,s,i){if(e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]&&(s=1),0===s&&e._candidates.length>0&&"GETPAGES"===e._candidates[e._candidates.length-1]&&(s=2),0===s)return"finished";const a=await this._getPage(e,s,i);return n+a<t?this._expandPagedSet(e,t,n+a,0,i):"success"}async _getPage(e,t,n){const s=1===t?e._known:e._candidates;if(e.pagesDefinition.internal.set.length>e.pagesDefinition.resultOffset||!0===e.pagesDefinition.internal.fullyResolved){s.length=s.length-1;let t=0;for(let i=0;i<e.pagesDefinition.resultRecordCount&&!(e.pagesDefinition.resultOffset+i>=e.pagesDefinition.internal.set.length);i++)s[s.length]=e.pagesDefinition.internal.set[e.pagesDefinition.resultOffset+i],t++;e.pagesDefinition.resultOffset+=t;let n=!1;return!0===e.pagesDefinition.internal.fullyResolved&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset&&(n=!0),!1===n&&s.push("GETPAGES"),t}return await this._getPhysicalPage(e,t,n),this._getPage(e,t,n)}_getPhysicalPage(e,t,n){return null}_clonePageDefinition(e){return null===this._parent?null:this._parent._clonePageDefinition(e)}_first(e){return this.iterator(e).next()}first(e){return this._first(e)}async calculateStatistic(e,t,n,s){await this._ensureLoaded();let i=await this._stat(e,t,"",null,null,n,s);return!1===i.calculated&&(i=await this._manualStat(e,t,n,s)),i.result}async _manualStat(e,t,n,s){let i=null;switch(e.toLowerCase()){case"count":return i=await g(this,s),{calculated:!0,result:i};case"distinct":return i=await m(this,t,n,s),{calculated:!0,result:i};case"avg":case"mean":return i=await p(this,t,s),{calculated:!0,result:i};case"stdev":return i=await _(this,t,s),{calculated:!0,result:i};case"variance":return i=await f(this,t,s),{calculated:!0,result:i};case"sum":return i=await d(this,t,s),{calculated:!0,result:i};case"min":return i=await c(this,t,s),{calculated:!0,result:i};case"max":return i=await o(this,t,s),{calculated:!0,result:i};default:return{calculated:!0,result:0}}}async _stat(e,t,n,s,i,a,r){const l=await this._parent._stat(e,t,n,s,i,a,r);return!1===l.calculated?null===i&&""===n&&null===s?this._manualStat(e,t,a,r):{calculated:!1}:l}_unionAllGeomSelf(e){const t=this.iterator(this._defaultTracker(e)),n=[];return new Promise(((e,s)=>{this._unionShapeInBatches(n,t,e,s)}))}_unionAllGeom(e){return new Promise(((t,n)=>{const s=this.iterator(this._defaultTracker(e)),i=[];this._unionShapeInBatches(i,s,t,n)}))}_unionShapeInBatches(e,t,n,s){t.next().then((i=>{try{null!==i&&null!==i.geometry&&e.push(i.geometry),e.length>30||null===i&&e.length>1?y("union",[e.map((e=>e.toJSON()))]).then((a=>{try{null===i?n(a):(e=[b(a)],this._unionShapeInBatches(e,t,n,s))}catch(r){s(r)}}),s):null===i?1===e.length?n(e[0]):n(null):this._unionShapeInBatches(e,t,n,s)}catch(a){s(a)}}),s)}iterator(e){return new s(this,e)}intersection(e,t=!1){return S._featuresetFunctions.intersection.bind(this)(e,t)}difference(e,t=!1,n=!0){return S._featuresetFunctions.difference.bind(this)(e,t,n)}symmetricDifference(e,t=!1,n=!0){return S._featuresetFunctions.symmetricDifference.bind(this)(e,t,n)}morphShape(e,t,n="unknown",s=null){return S._featuresetFunctions.morphShape.bind(this)(e,t,n,s)}morphShapeAndAttributes(e,t,n="unknown"){return S._featuresetFunctions.morphShapeAndAttributes.bind(this)(e,t,n)}union(e,t=!1){return S._featuresetFunctions.union.bind(this)(e,t)}intersects(e){return S._featuresetFunctions.intersects.bind(this)(e)}envelopeIntersects(e){return S._featuresetFunctions.envelopeIntersects.bind(this)(e)}contains(e){return S._featuresetFunctions.contains.bind(this)(e)}overlaps(e){return S._featuresetFunctions.overlaps.bind(this)(e)}relate(e,t){return S._featuresetFunctions.relate.bind(this)(e,t)}within(e){return S._featuresetFunctions.within.bind(this)(e)}touches(e){return S._featuresetFunctions.touches.bind(this)(e)}top(e){return S._featuresetFunctions.top.bind(this)(e)}crosses(e){return S._featuresetFunctions.crosses.bind(this)(e)}buffer(e,t,n,s=!0){return S._featuresetFunctions.buffer.bind(this)(e,t,n,s)}filter(e,t=null){return S._featuresetFunctions.filter.bind(this)(e,t)}orderBy(e){return S._featuresetFunctions.orderBy.bind(this)(e)}dissolve(e,t){return S._featuresetFunctions.dissolve.bind(this)(e,t)}groupby(e,t){return S._featuresetFunctions.groupby.bind(this)(e,t)}reduce(e,t=null,n){return new Promise(((s,i)=>{this._reduceImpl(this.iterator(this._defaultTracker(n)),e,t,0,s,i,0)}))}_reduceImpl(e,t,n,s,i,a,r){try{if(++r>1e3)return void setTimeout((()=>{r=0,this._reduceImpl(e,t,n,s,i,a,r)}));e.next().then((l=>{try{if(null===l)i(n);else{const u=t(n,l,s,this);F(u)?u.then((n=>{this._reduceImpl(e,t,n,s+1,i,a,r)}),a):this._reduceImpl(e,t,u,s+1,i,a,r)}}catch(u){a(u)}}),a)}catch(l){a(l)}}removeField(e){return S._featuresetFunctions.removeField.bind(this)(e)}addField(e,t,n=null){return S._featuresetFunctions.addField.bind(this)(e,t,n)}async sumArea(e,t=!1,n){const s=this.iterator(n);let i,a=0;for(;null!=(i=await s.next());)null!=i.geometry&&(a+=t?await y("geodeticArea",[i.geometry.toJSON(),e]):await y("area",[i.geometry.toJSON(),e]));return a}async sumLength(e,t=!1,n){const s=this.iterator(n);let i,a=0;for(;null!=(i=await s.next());)null!=i.geometry&&(a+=t?await y("geodeticLength",[i.geometry.toJSON(),e]):await y("length",[i.geometry.toJSON(),e]));return a}async distinct(e,t=1e3,n=null,s){await this.load();const i=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(i,n),this.calculateStatistic("distinct",i,t,this._defaultTracker(s))}async min(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("min",s,-1,this._defaultTracker(n))}async max(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("max",s,-1,this._defaultTracker(n))}async avg(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("avg",s,-1,this._defaultTracker(n))}async sum(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("sum",s,-1,this._defaultTracker(n))}async stdev(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("stdev",s,-1,this._defaultTracker(n))}async variance(e,t=null,n){await this.load();const s=I.create(e,{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC});return D(s,t),this.calculateStatistic("variance",s,-1,this._defaultTracker(n))}async count(e){return await this.load(),this.calculateStatistic("count",I.create("1",{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),-1,this._defaultTracker(e))}_defaultTracker(e){return e??{aborted:!1}}forEach(e,t){return new Promise(((n,s)=>{this._forEachImpl(this.iterator(this._defaultTracker(t)),e,this,n,s,0)}))}_forEachImpl(e,t,n,s,i,a){try{if(++a>1e3)return void setTimeout((()=>{a=0,this._forEachImpl(e,t,n,s,i,a)}),0);e.next().then((r=>{try{if(null===r)s(n);else{const l=t(r);null==l?this._forEachImpl(e,t,n,s,i,a):F(l)?l.then((()=>{try{this._forEachImpl(e,t,n,s,i,a)}catch(r){i(r)}}),i):this._forEachImpl(e,t,n,s,i,a)}}catch(l){i(l)}}),i)}catch(r){i(r)}}convertToJSON(e){const t={layerDefinition:{geometryType:this.geometryType,fields:[]},featureSet:{features:[],geometryType:this.geometryType}};for(let n=0;n<this.fields.length;n++)t.layerDefinition.fields.push(u(this.fields[n]));return this.reduce(((e,n)=>{const s={geometry:n.geometry?.toJSON(),attributes:{}};for(const t in n.attributes)s.attributes[t]=n.attributes[t];return t.featureSet.features.push(s),1}),0,e).then((()=>t))}castToText(e=!1){return"object, FeatureSet"}queryAttachments(e,t,n,s,i){return this._parent.queryAttachments(e,t,n,s,i)}serviceUrl(){return this._parent.serviceUrl()}subtypeMetaData(){return this.subtypeField&&this.subtypes?{subtypeField:this.subtypeField,subtypes:this.subtypes?this.subtypes.map((e=>({name:e.name,code:e.code}))):[]}:this.typeIdField?{subtypeField:this.typeIdField,subtypes:this.types?this.types.map((e=>({name:e.name,code:e.id}))):[]}:null}relationshipMetaData(){return this._parent.relationshipMetaData()}get gdbVersion(){return this._parent?this._parent.gdbVersion:""}schema(){const e=[];for(const t of this.fields)e.push(u(t));return{objectIdField:this.objectIdField,globalIdField:this.globalIdField,geometryType:void 0===h[this.geometryType]?"esriGeometryNull":h[this.geometryType],fields:e}}async convertToText(e,t){if("schema"===e)return await this._ensureLoaded(),JSON.stringify(this.schema());if("featureset"===e){await this._ensureLoaded();const e=[];await this.reduce(((t,n)=>{const s={geometry:n.geometry?n.geometry.toJSON():null,attributes:n.attributes};return null!==s.geometry&&s.geometry.spatialReference&&delete s.geometry.spatialReference,e.push(s),1}),0,t);const n=this.schema();return n.features=e,n.spatialReference=this.spatialReference.toJSON(),JSON.stringify(n)}return this.castToText()}getFeatureByObjectId(e,t){return this._parent.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._parent.getOwningSystemUrl()}getIdentityUser(){return this._parent.getIdentityUser()}getRootFeatureSet(){return null!==this._parent?this._parent.getRootFeatureSet():this}getDataSourceFeatureSet(){return null!==this._parent?this._parent.getDataSourceFeatureSet():this}castAsJson(e=null){return"keeptype"===e?.featureset?this:"none"===e?.featureset?null:{type:"FeatureSet"}}async castAsJsonAsync(e=null,t=null){if("keeptype"===t?.featureset)return this;if("schema"===t?.featureset)return await this._ensureLoaded(),JSON.parse(JSON.stringify(this.schema()));if("none"===t?.featureset)return null;await this._ensureLoaded();const n=[];await this.reduce(((e,s)=>{const i={geometry:s.geometry?!0===t?.keepGeometryType?s.geometry:s.geometry.toJSON():null,attributes:s.attributes};return null!==i.geometry&&i.geometry.spatialReference&&!0!==t?.keepGeometryType&&delete i.geometry.spatialReference,n.push(i),1}),0,e);const s=this.schema();return s.features=n,s.spatialReference=!0===t?.keepGeometryType?this.spatialReference:this.spatialReference?.toJSON(),s}fieldTimeZone(e){return this.getFieldsIndex().getTimeZone(e)}get preferredTimeZone(){return this._parent?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._parent?.dateFieldsTimeZone??null}get dateFieldsTimeZoneDefaultUTC(){if(this.datesInUnknownTimezone)return"unknown";const e=this.dateFieldsTimeZone??"UTC";return""===e?"UTC":e}get datesInUnknownTimezone(){return this._parent.datesInUnknownTimezone}get editFieldsInfo(){return this._parent?.editFieldsInfo??null}get timeInfo(){return this._parent?.timeInfo??null}set featureSetInfo(e){this.fsetInfo=e}async getFeatureSetInfo(){return this.fsetInfo??await(this._parent?.getFeatureSetInfo())??null}}function D(e,t){if(null!==t){const n={};for(const e in t)n[e.toLowerCase()]=t[e];e.parameters=n}}export{S as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const t=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i");function e(t){let e="";for(let r=0;r<t;r++)e+=(65536*(1+Math.random())|0).toString(16).slice(1);return e}class r{constructor(t){if(this._value="",!t)throw new TypeError("Invalid argument; `value` has no value.");this._value=r.EMPTY,t&&t instanceof r?this._value=t.toString():t&&"[object String]"===Object.prototype.toString.call(t)&&r.isGuid(t)&&(this._value=t)}equals(t){return r.isGuid(t)&&this._value===t}isEmpty(){return this._value===r.EMPTY}toString(){return this._value}toJSON(){return this._value}static isGuid(e){return e&&(e instanceof r||t.test(e.toString()))}static create(){return new r([e(2),e(1),e(1),e(1),e(3)].join("-"))}static raw(){return[e(2),e(1),e(1),e(1),e(3)].join("-")}}r.EMPTY="00000000-0000-0000-0000-000000000000";export{r as default};
5
+ const t=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i");function e(t){let e="";for(let i=0;i<t;i++)e+=(65536*(1+Math.random())|0).toString(16).slice(1);return e}class i{constructor(t){if(this._value="",!t)throw new TypeError("Invalid argument; `value` has no value.");this._value=i.EMPTY,t&&t instanceof i?this._value=t.toString():t&&"[object String]"===Object.prototype.toString.call(t)&&i.isGuid(t)&&(this._value=t)}equals(t){return i.isGuid(t)&&this._value===t}isEmpty(){return this._value===i.EMPTY}toString(){return this._value}toJSON(){return this._value}static{this.EMPTY="00000000-0000-0000-0000-000000000000"}static isGuid(e){return e&&(e instanceof i||t.test(e.toString()))}static create(){return new i([e(2),e(1),e(1),e(1),e(3)].join("-"))}static raw(){return[e(2),e(1),e(1),e(1),e(3)].join("-")}}export{i as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- class a{constructor(){this._databaseTypeMetaData={},this._layerInfo={}}clearDatabaseType(a){void 0===this._databaseTypeMetaData[a]&&delete this._databaseTypeMetaData[a]}getDatabaseType(a){return"MUSTBESET"===a||void 0===this._databaseTypeMetaData[a]?null:this._databaseTypeMetaData[a]}setDatabaseType(a,e){this._databaseTypeMetaData[a]=e}getLayerInfo(a){return void 0===this._layerInfo[a]?null:this._layerInfo[a]}setLayerInfo(a,e){this._layerInfo[a]=e}clearLayerInfo(a){void 0!==this._layerInfo[a]&&delete this._layerInfo[a]}}a.applicationCache=null;export{a as default};
5
+ class a{static{this.applicationCache=null}constructor(){this._databaseTypeMetaData={},this._layerInfo={}}clearDatabaseType(a){void 0===this._databaseTypeMetaData[a]&&delete this._databaseTypeMetaData[a]}getDatabaseType(a){return"MUSTBESET"===a||void 0===this._databaseTypeMetaData[a]?null:this._databaseTypeMetaData[a]}setDatabaseType(a,e){this._databaseTypeMetaData[a]=e}getLayerInfo(a){return void 0===this._layerInfo[a]?null:this._layerInfo[a]}setLayerInfo(a,e){this._layerInfo[a]=e}clearLayerInfo(a){void 0!==this._layerInfo[a]&&delete this._layerInfo[a]}}export{a as default};