@arcgis/core 5.2.0-next.13 → 5.2.0-next.14

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 (303) hide show
  1. package/arcgisGlobal.d.ts +3 -3
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/03354e9256b2f77fd4f2.js +1 -0
  4. package/assets/esri/core/workers/chunks/0826d36dfbfa28442b70.js +1 -0
  5. package/assets/esri/core/workers/chunks/{87c2d4d58c2487324fb7.js → 0a8ba5cb857f61de40fb.js} +3 -3
  6. package/assets/esri/core/workers/chunks/152f1c08197955224ad3.js +1 -0
  7. package/assets/esri/core/workers/chunks/1a0903b1d2d5101977c6.js +1 -0
  8. package/assets/esri/core/workers/chunks/{de541ad390a8d258d2e6.js → 1d5db8746a4f1ed1d18f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/1effde6a39ef0d4af525.js +1 -0
  10. package/assets/esri/core/workers/chunks/{2a5176533e78a92d8e5b.js → 20c729fca2e4b4c6b28d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/23d50c4478f40a7d62bf.js +1 -0
  12. package/assets/esri/core/workers/chunks/2623cd08487fdc9a94f1.js +1 -0
  13. package/assets/esri/core/workers/chunks/2c3fc2805f6de0963789.js +1 -0
  14. package/assets/esri/core/workers/chunks/2c4f10eaf02ef090ee8f.js +1 -0
  15. package/assets/esri/core/workers/chunks/314bc1b356d43bfa72a8.js +1 -0
  16. package/assets/esri/core/workers/chunks/{34544c79ce568f30a094.js → 31762eb20a9a0ed3f8b0.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{26dca1d387183282276a.js → 318a2702632aaa4d3a63.js} +1 -1
  18. package/assets/esri/core/workers/chunks/3526ab3b1f87c24ae6f8.js +1 -0
  19. package/assets/esri/core/workers/chunks/{81808c3aead7dfac3049.js → 38cfedce779dd75bd217.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{5075e85e1eafd431a8c0.js → 39c994536ce6c1e5c956.js} +1 -1
  21. package/assets/esri/core/workers/chunks/3b74749db78bcba2bc16.js +1 -0
  22. package/assets/esri/core/workers/chunks/3d83ac791212b81c9d11.js +1 -0
  23. package/assets/esri/core/workers/chunks/3ecb906322a6a5c8c93b.js +1 -0
  24. package/assets/esri/core/workers/chunks/3f67162456a1f02190fa.js +1 -0
  25. package/assets/esri/core/workers/chunks/{ef46ef4f0ee9f2aeaa4a.js → 426b8e1e2eef2460851d.js} +1 -1
  26. package/assets/esri/core/workers/chunks/4376bc2934a996d8bc27.js +1 -0
  27. package/assets/esri/core/workers/chunks/44d0ca9d4c5f1722688c.js +1 -0
  28. package/assets/esri/core/workers/chunks/{e25bcfdd8f20f8a08b19.js → 4d57c771af4137f74bfb.js} +1 -1
  29. package/assets/esri/core/workers/chunks/4e4419282c4bf7ee4678.js +1 -0
  30. package/assets/esri/core/workers/chunks/4e788fc6cb2ea936f676.js +1 -0
  31. package/assets/esri/core/workers/chunks/4f51963815b0d53ffbd9.js +1 -0
  32. package/assets/esri/core/workers/chunks/5100b5a6a506c704dfaf.js +1 -0
  33. package/assets/esri/core/workers/chunks/52afd43bbe23e358efb5.js +1 -0
  34. package/assets/esri/core/workers/chunks/5aba23584e0b230c75f5.js +1 -0
  35. package/assets/esri/core/workers/chunks/{d3c760109a70a71448c5.js → 67773a9f031d9f1d672f.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6f7193b9ff5942c0d354.js +1 -0
  37. package/assets/esri/core/workers/chunks/70737052bab29fcaa120.js +1 -0
  38. package/assets/esri/core/workers/chunks/718d2d430c1a5a940b83.js +1 -0
  39. package/assets/esri/core/workers/chunks/71c996e1ae84d9daddf2.js +1 -0
  40. package/assets/esri/core/workers/chunks/753e0b21e57c12c742ee.js +1 -0
  41. package/assets/esri/core/workers/chunks/764c8ba14ab74b66b391.js +1 -0
  42. package/assets/esri/core/workers/chunks/{1996f0a930abdd97b855.js → 7a8ed08cd173963b3112.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{cc697c4d9cdc116373dc.js → 81726d997a2d34449bb2.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{74e1826ad9e2c4fd3b42.js → 81883bca8a79ee2ddb00.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{9fee0110dc7fee4c95e2.js → 854c320af09b6afc4b80.js} +2 -2
  46. package/assets/esri/core/workers/chunks/85505a8b8b0794656d06.js +1 -0
  47. package/assets/esri/core/workers/chunks/859bc873e7af911a518f.js +1 -0
  48. package/assets/esri/core/workers/chunks/{8407c91cce31e087b41b.js → 886ae23a1d8fa21e531f.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{3ff7aa216cd794d951e8.js → 8e99f937fd36cf2cd05f.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{c357c0a08b99c1e7f290.js → 9331969046f2b277d620.js} +1 -1
  51. package/assets/esri/core/workers/chunks/93d08d82ceab19e314f8.js +1 -0
  52. package/assets/esri/core/workers/chunks/97a654e8054302582a3b.js +1 -0
  53. package/assets/esri/core/workers/chunks/97d2bdbea39cbcf8fd0f.js +1 -0
  54. package/assets/esri/core/workers/chunks/a0208e35b217808777c4.js +1 -0
  55. package/assets/esri/core/workers/chunks/{f25bb204cf6727f6fdef.js → a0876a52a3c2ad849370.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{7ad09ac5793e8d47b4b2.js → a4b970a841b3085500fc.js} +1 -1
  57. package/assets/esri/core/workers/chunks/aa5f36d7ed59c625ba78.js +1 -0
  58. package/assets/esri/core/workers/chunks/b045bffb4f2eb9203183.js +1 -0
  59. package/assets/esri/core/workers/chunks/b590402170ae289290d7.js +1 -0
  60. package/assets/esri/core/workers/chunks/b9935cc8e2bd4045058a.js +1 -0
  61. package/assets/esri/core/workers/chunks/{1a527c0740d9f4fa0791.js → bc547cf814d6703cef59.js} +1 -1
  62. package/assets/esri/core/workers/chunks/bcc097271f5cdf0a97a7.js +1 -0
  63. package/assets/esri/core/workers/chunks/bdc66ef2b6ed783047d5.js +1 -0
  64. package/assets/esri/core/workers/chunks/be1d2c3a61e6447fbbc7.js +1 -0
  65. package/assets/esri/core/workers/chunks/bf6ae205fbfbfcd1a0ee.js +1 -0
  66. package/assets/esri/core/workers/chunks/bfd1aef8ac795e1ce227.js +1 -0
  67. package/assets/esri/core/workers/chunks/c148ad0ea9258046ac1f.js +1 -0
  68. package/assets/esri/core/workers/chunks/{0f75c19d8e296a32e329.js → c2cd80b712f29e8cbb8d.js} +1 -1
  69. package/assets/esri/core/workers/chunks/cc0efa716b8414a44398.js +1 -0
  70. package/assets/esri/core/workers/chunks/{8f6833671c071b522923.js → cd66bd30f654fe571e57.js} +1 -1
  71. package/assets/esri/core/workers/chunks/cf41a66fb97c1076fb34.js +1 -0
  72. package/assets/esri/core/workers/chunks/cf8ce21dc649021e97f6.js +1 -0
  73. package/assets/esri/core/workers/chunks/d3be4d914fc99a1d686c.js +1 -0
  74. package/assets/esri/core/workers/chunks/dbd2bfcbf3e0f86f07b8.js +1 -0
  75. package/assets/esri/core/workers/chunks/{6675d56f49d07a97dc40.js → dd0c1cf921369e2bc48b.js} +1 -1
  76. package/assets/esri/core/workers/chunks/df18b0a653b328d8d052.js +1 -0
  77. package/assets/esri/core/workers/chunks/df54e741db40b308c2dd.js +2 -0
  78. package/assets/esri/core/workers/chunks/{89e09276086745aa21fa.js → e4e2f479c0c45ae1b2c3.js} +1 -1
  79. package/assets/esri/core/workers/chunks/e656fd5ecf9ac059a87b.js +1 -0
  80. package/assets/esri/core/workers/chunks/{58a7cdebc3d182c15ec6.js → e77df11aee136d64ff0f.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{7a474ce61cf484df87b4.js → e80376832050a4b6d28a.js} +1 -1
  82. package/assets/esri/core/workers/chunks/f116331c6eca937aac8e.js +1 -0
  83. package/assets/esri/core/workers/chunks/{3b837b512999e6ab24bc.js → f148666308071bdb185a.js} +1 -1
  84. package/assets/esri/core/workers/chunks/f23e995320674b32e142.js +1 -0
  85. package/assets/esri/core/workers/chunks/f334bf192dff5af10a70.js +1 -0
  86. package/assets/esri/core/workers/chunks/f76b1fc36f5606cac2c8.js +1 -0
  87. package/assets/esri/core/workers/chunks/{893c0d28a5bf3f9f29f1.js → f93facf47aba9b128fcc.js} +1 -1
  88. package/assets/esri/core/workers/chunks/fa1336b60278017d2525.js +1 -0
  89. package/assets/esri/core/workers/chunks/{c911f0b5bdd43b66b731.js → fa3faec65882c5b6f1a0.js} +1 -1
  90. package/assets/esri/core/workers/chunks/fccc34b86454c56f27ab.js +1 -0
  91. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  92. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  93. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  94. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +5 -1
  95. package/assets/esri/themes/dark/main.css +1 -1
  96. package/assets/esri/themes/light/main.css +1 -1
  97. package/assets/esri/themes/light/view.css +1 -1
  98. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis.json +1 -1
  99. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_en.json +1 -1
  100. package/chunks/Component.glsl.js +6 -6
  101. package/chunks/GlobalIlluminationBlur.glsl.js +7 -7
  102. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  103. package/chunks/arcgis-knowledge-client-core.js +1 -1
  104. package/chunks/bundle2.js +1 -1
  105. package/config.js +1 -1
  106. package/core/promiseUtils.d.ts +1 -1
  107. package/core/promiseUtils.js +1 -1
  108. package/core/units.js +1 -1
  109. package/form/types.d.ts +1 -1
  110. package/geometry/Mesh.d.ts +220 -95
  111. package/geometry/operators/support/projectionZScaling.js +1 -1
  112. package/geometry/support/MeshGeoreferencedVertexSpace.d.ts +35 -13
  113. package/geometry/support/MeshLocalVertexSpace.d.ts +32 -8
  114. package/geometry/support/MeshVertexAttributes.d.ts +6 -2
  115. package/geometry/support/heightModelInfoUtils.js +1 -1
  116. package/geometry/support/zscale.js +1 -1
  117. package/graphic/{AnnotationGraphicOrigin.d.ts → AnnotationFeatureGraphicOrigin.d.ts} +9 -9
  118. package/graphic/{AnnotationGraphicOrigin.js → AnnotationFeatureGraphicOrigin.js} +1 -1
  119. package/interfaces.d.ts +3 -3
  120. package/kernel.js +1 -1
  121. package/layers/{AnnotationLayer.d.ts → AnnotationFeatureLayer.d.ts} +24 -24
  122. package/layers/AnnotationFeatureLayer.js +2 -0
  123. package/layers/GaussianSplatLayer.d.ts +4 -1
  124. package/layers/graphics/data/QueryEngine.js +1 -1
  125. package/layers/graphics/data/queryUtils.js +1 -1
  126. package/layers/graphics/sources/parquet/ParquetFileStatistics.js +1 -1
  127. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  128. package/layers/graphics/sources/support/parquetIdUtils.js +1 -1
  129. package/layers/save/featureLayerUtils.js +1 -1
  130. package/layers/support/AnnotationSublayer.d.ts +7 -7
  131. package/layers/support/FeatureEffect.d.ts +3 -2
  132. package/layers/support/arcgisLayers.js +1 -1
  133. package/layers/support/fetchService.js +1 -1
  134. package/layers/support/layerUtils.js +1 -1
  135. package/layers/support/layersLoader.js +1 -1
  136. package/layers/support/parquetUtils.js +1 -1
  137. package/layers/support/schemaValidator.js +1 -1
  138. package/layers/types.d.ts +1 -1
  139. package/networks/Network.js +1 -1
  140. package/networks/UtilityNetwork.js +1 -1
  141. package/networks/support/networkFieldUtils.js +1 -1
  142. package/package.json +2 -2
  143. package/portal/schemas/definitions.js +1 -1
  144. package/portal/schemas/gaussianSplatLayerItem.js +2 -0
  145. package/portal/schemas/integratedMesh3DTilesLayerItem.js +1 -1
  146. package/portal/support/loadUtils.js +1 -1
  147. package/renderers/support/types.d.ts +1 -1
  148. package/renderers/visualVariables/RotationVariable.d.ts +1 -16
  149. package/renderers/visualVariables/RotationVariable.js +1 -1
  150. package/rest/knowledgeGraph/ReplicaDefinition.d.ts +0 -2
  151. package/rest/knowledgeGraph/ServiceDefinition.d.ts +1 -1
  152. package/rest/knowledgeGraph/wasmInterface/replicaToWasmEncodedFactories.js +1 -1
  153. package/rest/knowledgeGraph/wasmInterface/wasmToReplicaFactories.js +1 -1
  154. package/rest/knowledgeGraphService.js +1 -1
  155. package/rest/networks/support/QueryAssociationsParameters.d.ts +2 -2
  156. package/rest/networks/support/SynthesizeAssociationGeometriesParameters.d.ts +2 -2
  157. package/rest/networks/support/TraceParameters.d.ts +2 -2
  158. package/rest/support/AttributeBinsQuery.js +1 -1
  159. package/rest/support/Query.js +1 -1
  160. package/rest/support/TopFeaturesQuery.js +1 -1
  161. package/support/revision.js +1 -1
  162. package/views/2d/engine/webgl/TextureManager.js +1 -1
  163. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  164. package/views/2d/engine/webgl/util/createMatcher.js +1 -1
  165. package/views/2d/layerViewModuleImportUtils.js +1 -1
  166. package/views/2d/layers/AnnotationFeatureLayerView2D.js +2 -0
  167. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  168. package/views/2d/layers/TileLayerView2D.js +1 -1
  169. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  170. package/views/2d/layers/support/annodime/annotationSchema.js +1 -1
  171. package/views/2d/types.d.ts +2 -2
  172. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  173. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  174. package/views/3d/layerViewModuleImportUtils.js +1 -1
  175. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  176. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  177. package/views/3d/support/GaussianSplatWorkerHandle.js +1 -1
  178. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  179. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  180. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  181. package/views/3d/terrain/Tile.js +1 -1
  182. package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
  183. package/views/3d/types.d.ts +1 -1
  184. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +7 -7
  185. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +29 -20
  186. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatTextureFetch.glsl.js +6 -8
  187. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TexelFormatInfo.js +2 -0
  188. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  189. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  190. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  191. package/views/layers/{AnnotationLayerView.d.ts → AnnotationFeatureLayerView.d.ts} +6 -6
  192. package/views/layers/FeatureLikeLayerView.d.ts +2 -2
  193. package/views/layers/FeatureLikeLayerView.js +1 -1
  194. package/webdoc/widgets/FloorFilter.d.ts +14 -1
  195. package/webdoc/widgets/FloorFilter.js +1 -1
  196. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  197. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +12 -4
  198. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  199. package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
  200. package/widgets/BatchAttributeForm/ValueChangeTransaction.js +2 -0
  201. package/widgets/BatchAttributeForm/VisibleElements.d.ts +8 -1
  202. package/widgets/BatchAttributeForm/VisibleElements.js +1 -1
  203. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  204. package/widgets/BatchAttributeForm/css.js +1 -1
  205. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  206. package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
  207. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.d.ts +3 -0
  208. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
  209. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  210. package/widgets/BatchAttributeForm/inputs/GroupInput.js +1 -1
  211. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  212. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  213. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  214. package/widgets/BatchAttributeForm/interfaceUtils.js +1 -1
  215. package/widgets/BatchAttributeForm/stringUtils.js +2 -0
  216. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  217. package/widgets/BatchAttributeForm/types.d.ts +19 -3
  218. package/widgets/BatchAttributeForm.js +1 -1
  219. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  220. package/widgets/Editor/AddAssociationWorkflowData.js +1 -1
  221. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  222. package/widgets/Editor/EditorViewModel.d.ts +1 -1
  223. package/widgets/Editor/EditorViewModel.js +1 -1
  224. package/widgets/Editor/MergeFeaturesWorkflow.d.ts +3 -3
  225. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  226. package/widgets/Editor/SplitFeatureWorkflow.d.ts +3 -3
  227. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  228. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  229. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  230. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  231. package/widgets/Editor/UpdateRecordWorkflowData.js +1 -1
  232. package/widgets/Editor/UpdateWorkflow.js +1 -1
  233. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  234. package/widgets/Editor/support/SketchController.js +1 -1
  235. package/widgets/Editor/workflowUtils.js +1 -1
  236. package/widgets/Editor.js +1 -1
  237. package/widgets/FloorFilter/FloorFilterViewModel.d.ts +10 -0
  238. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  239. package/assets/esri/core/workers/chunks/07cc5743cb6a9fd68adb.js +0 -1
  240. package/assets/esri/core/workers/chunks/0bb159ba0226122465cf.js +0 -1
  241. package/assets/esri/core/workers/chunks/160e5b99f1097a473e6b.js +0 -1
  242. package/assets/esri/core/workers/chunks/17e68828ca6ff6912d3e.js +0 -1
  243. package/assets/esri/core/workers/chunks/1e340536d3c5f94920b5.js +0 -1
  244. package/assets/esri/core/workers/chunks/24810c36ae09bb4e83dc.js +0 -1
  245. package/assets/esri/core/workers/chunks/274b82cb183ddd0042f3.js +0 -1
  246. package/assets/esri/core/workers/chunks/297ae764445e6f73a5ea.js +0 -1
  247. package/assets/esri/core/workers/chunks/29aba121db7f00e0cf81.js +0 -1
  248. package/assets/esri/core/workers/chunks/2a3145a595d19391bb8a.js +0 -1
  249. package/assets/esri/core/workers/chunks/3297658ccd8d4b9ce733.js +0 -1
  250. package/assets/esri/core/workers/chunks/38ca59db0e8f45bd7811.js +0 -1
  251. package/assets/esri/core/workers/chunks/3c5534c576528c1921d2.js +0 -1
  252. package/assets/esri/core/workers/chunks/40b3cdf81c79bbc44527.js +0 -2
  253. package/assets/esri/core/workers/chunks/41f12eb7c9b7086528d5.js +0 -1
  254. package/assets/esri/core/workers/chunks/426156137f279d979ddd.js +0 -1
  255. package/assets/esri/core/workers/chunks/4714241189c13d0db897.js +0 -1
  256. package/assets/esri/core/workers/chunks/537c5dd4cd0a067199d1.js +0 -1
  257. package/assets/esri/core/workers/chunks/538537f9bc866d9caa75.js +0 -1
  258. package/assets/esri/core/workers/chunks/5437a1c05c1bd2175981.js +0 -1
  259. package/assets/esri/core/workers/chunks/58ac245ff7fb57c1004f.js +0 -1
  260. package/assets/esri/core/workers/chunks/5c7aff9604b4576a0e1d.js +0 -1
  261. package/assets/esri/core/workers/chunks/5d3ddbf94539cb4f493e.js +0 -1
  262. package/assets/esri/core/workers/chunks/5eb9fdb076488de9cd83.js +0 -1
  263. package/assets/esri/core/workers/chunks/603177137eb680afe371.js +0 -1
  264. package/assets/esri/core/workers/chunks/629099f05ca5c9ca1973.js +0 -1
  265. package/assets/esri/core/workers/chunks/62f78fa455d556008f6a.js +0 -1
  266. package/assets/esri/core/workers/chunks/686c51fd2144e132783e.js +0 -1
  267. package/assets/esri/core/workers/chunks/6f0341cfa4c68e6e60b3.js +0 -1
  268. package/assets/esri/core/workers/chunks/70229007d594536ba6a3.js +0 -1
  269. package/assets/esri/core/workers/chunks/7e89cb9ff615742e0894.js +0 -1
  270. package/assets/esri/core/workers/chunks/890b7a1153b7f65eba9a.js +0 -1
  271. package/assets/esri/core/workers/chunks/9660ae52fb3951a19e9c.js +0 -1
  272. package/assets/esri/core/workers/chunks/a4245bd4e67a428fd835.js +0 -1
  273. package/assets/esri/core/workers/chunks/ac33b10fe65f9e9e824f.js +0 -1
  274. package/assets/esri/core/workers/chunks/b5937ce657c1fff3864f.js +0 -1
  275. package/assets/esri/core/workers/chunks/c3cf9e6e91f71c9cc5f3.js +0 -1
  276. package/assets/esri/core/workers/chunks/c80fc1b3048e8d58a1f8.js +0 -1
  277. package/assets/esri/core/workers/chunks/cc3e895cff019e811c07.js +0 -1
  278. package/assets/esri/core/workers/chunks/d122431f3b0b88dcb488.js +0 -1
  279. package/assets/esri/core/workers/chunks/d24e027bb8b2c09f25c8.js +0 -1
  280. package/assets/esri/core/workers/chunks/d2df8c328054dc6cb7b7.js +0 -1
  281. package/assets/esri/core/workers/chunks/d41caf20c26f80385265.js +0 -1
  282. package/assets/esri/core/workers/chunks/d468994822f9bc3d6279.js +0 -1
  283. package/assets/esri/core/workers/chunks/d63f532dd7d60ee8ef2c.js +0 -1
  284. package/assets/esri/core/workers/chunks/d64613209a9eb1eafb11.js +0 -1
  285. package/assets/esri/core/workers/chunks/d7be278aed1fb37ad5ec.js +0 -1
  286. package/assets/esri/core/workers/chunks/d8ec0afb2b91ccf32e55.js +0 -1
  287. package/assets/esri/core/workers/chunks/da1e8b338ab9fe9e0a8e.js +0 -1
  288. package/assets/esri/core/workers/chunks/dd920a6f6422fa213eba.js +0 -1
  289. package/assets/esri/core/workers/chunks/e279bcbe4f10e87bde6c.js +0 -1
  290. package/assets/esri/core/workers/chunks/e2de13810dce01b98520.js +0 -1
  291. package/assets/esri/core/workers/chunks/e5837e5ac6ef761f26a2.js +0 -1
  292. package/assets/esri/core/workers/chunks/e82488b9b3bb0c1dedb4.js +0 -1
  293. package/assets/esri/core/workers/chunks/f274a8e8c7ca4294e876.js +0 -1
  294. package/assets/esri/core/workers/chunks/f292c2c22a3822343118.js +0 -1
  295. package/assets/esri/core/workers/chunks/f4f642ddd4d5db7cbbb4.js +0 -1
  296. package/assets/esri/core/workers/chunks/f6d047358d14328f3622.js +0 -1
  297. package/assets/esri/core/workers/chunks/fb6605be0c5e36785543.js +0 -1
  298. package/assets/esri/core/workers/chunks/fd70a25ffdf2cc6c5be2.js +0 -1
  299. package/layers/AnnotationLayer.js +0 -2
  300. package/views/2d/layers/AnnotationLayerView2D.js +0 -2
  301. /package/assets/esri/core/workers/chunks/{9fee0110dc7fee4c95e2.js.LICENSE.txt → 854c320af09b6afc4b80.js.LICENSE.txt} +0 -0
  302. /package/assets/esri/core/workers/chunks/{40b3cdf81c79bbc44527.js.LICENSE.txt → df54e741db40b308c2dd.js.LICENSE.txt} +0 -0
  303. /package/views/layers/{AnnotationLayerView.js → AnnotationFeatureLayerView.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getMetersPerVerticalUnitForSR as o}from"../../core/units.js";import{isSphericalPCPF as n}from"../ellipsoidUtils.js";import{equals as t}from"./spatialReferenceUtils.js";import{getEndpoint as e}from"./curves/curveUtils.js";function r(o,n,t){const e=i(n,t);if(1!==e)switch(o){case"point":case"esriGeometryPoint":return o=>s(o,e);case"polyline":case"esriGeometryPolyline":return o=>c(o,e);case"polygon":case"esriGeometryPolygon":return o=>f(o,e);case"multipoint":case"esriGeometryMultipoint":return o=>l(o,e);case"extent":case"esriGeometryEnvelope":return o=>u(o,e);default:return}}function i(e,r){if(null==e||null==r||r.vcsWkid||t(e,r)||n(e)||n(r))return 1;return o(e)/o(r)}function s(o,n){null!=o?.z&&(o.z*=n)}function f(o,n){if(o){if(o.curveRings)for(const t of o.curveRings)for(const o of t){const t=e(o);t.length>2&&(t[2]*=n)}if(o.rings)for(const t of o.rings)for(const o of t)o.length>2&&(o[2]*=n)}}function c(o,n){if(o){if(o.curvePaths)for(const t of o.curvePaths)for(const o of t){const t=e(o);t.length>2&&(t[2]*=n)}if(o.paths)for(const t of o.paths)for(const o of t)o.length>2&&(o[2]*=n)}}function l(o,n){if(o)for(const t of o.points)t.length>2&&(t[2]*=n)}function u(o,n){o&&null!=o.zmin&&null!=o.zmax&&(o.zmin*=n,o.zmax*=n)}export{r as getGeometryZScaler,i as zScale};
2
+ import{getMetersPerVerticalUnitForSR as o}from"../../core/units.js";import{isSphericalPCPF as n}from"../ellipsoidUtils.js";import{equals as t}from"./spatialReferenceUtils.js";import{getEndpoint as e}from"./curves/curveUtils.js";function r(o,n,t){const e=i(n,t);if(1!==e)switch(o){case"point":case"esriGeometryPoint":return o=>s(o,e);case"polyline":case"esriGeometryPolyline":return o=>c(o,e);case"polygon":case"esriGeometryPolygon":return o=>f(o,e);case"multipoint":case"esriGeometryMultipoint":return o=>l(o,e);case"extent":case"esriGeometryEnvelope":return o=>u(o,e);default:return}}function i(e,r){if(null==e||null==r||t(e,r)||n(e)||n(r))return 1;return o(e)/o(r)}function s(o,n){null!=o?.z&&(o.z*=n)}function f(o,n){if(o){if(o.curveRings)for(const t of o.curveRings)for(const o of t){const t=e(o);t.length>2&&(t[2]*=n)}if(o.rings)for(const t of o.rings)for(const o of t)o.length>2&&(o[2]*=n)}}function c(o,n){if(o){if(o.curvePaths)for(const t of o.curvePaths)for(const o of t){const t=e(o);t.length>2&&(t[2]*=n)}if(o.paths)for(const t of o.paths)for(const o of t)o.length>2&&(o[2]*=n)}}function l(o,n){if(o)for(const t of o.points)t.length>2&&(t[2]*=n)}function u(o,n){o&&null!=o.zmin&&null!=o.zmax&&(o.zmin*=n,o.zmax*=n)}export{r as getGeometryZScaler,i as zScale};
@@ -1,15 +1,15 @@
1
1
  import type GraphicOrigin from "./GraphicOrigin.js";
2
- import type AnnotationLayer from "../layers/AnnotationLayer.js";
2
+ import type AnnotationFeatureLayer from "../layers/AnnotationFeatureLayer.js";
3
3
 
4
4
  /**
5
- * Provides information about the [AnnotationLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/) from which a graphic originates.
5
+ * Provides information about the [AnnotationFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/) from which a graphic originates.
6
6
  * The [origin](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#origin) information may be available when a graphic is returned from methods such as
7
- * [hitTest()](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#hitTest) or [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/#queryFeatures).
7
+ * [hitTest()](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#hitTest) or [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#queryFeatures).
8
8
  *
9
9
  * @since 5.1
10
10
  * @see [MapView.hitTest()](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#hitTest)
11
11
  * @see [SceneView.hitTest()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#hitTest)
12
- * @see [AnnotationLayer.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/#queryFeatures)
12
+ * @see [AnnotationFeatureLayer.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#queryFeatures)
13
13
  * @example
14
14
  * // get a point from view's click event
15
15
  * view.on("click", async (event) => {
@@ -21,14 +21,14 @@ import type AnnotationLayer from "../layers/AnnotationLayer.js";
21
21
  * }
22
22
  * });
23
23
  */
24
- export default class AnnotationGraphicOrigin extends GraphicOrigin {
25
- constructor(layer: AnnotationLayer);
24
+ export default class AnnotationFeatureGraphicOrigin extends GraphicOrigin {
25
+ constructor(layer: AnnotationFeatureLayer);
26
26
  /** A layer from which a graphic originates. */
27
- readonly layer: AnnotationLayer;
27
+ readonly layer: AnnotationFeatureLayer;
28
28
  /**
29
29
  * Indicates the type of layer the graphic originated from.
30
30
  *
31
- * @default "annotation"
31
+ * @default "annotation-feature"
32
32
  */
33
- readonly type: AnnotationLayer["type"];
33
+ readonly type: AnnotationFeatureLayer["type"];
34
34
  }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{idFieldsProviderSymbol as r}from"./getIdFieldsProvider.js";import{popupProviderSymbol as t}from"./getPopupProvider.js";import{getSliceableContainerSymbol as e}from"./getSliceableContainer.js";import i from"./GraphicOrigin.js";class o extends i{get[t](){return this.layer}get[r](){return this.layer}get[e](){return this.layer}constructor(r){super(),this.type="annotation",this.layer=r}get id(){return this.layer.id}}export{o as default};
2
+ import{idFieldsProviderSymbol as r}from"./getIdFieldsProvider.js";import{popupProviderSymbol as t}from"./getPopupProvider.js";import{getSliceableContainerSymbol as e}from"./getSliceableContainer.js";import i from"./GraphicOrigin.js";class o extends i{get[t](){return this.layer}get[r](){return this.layer}get[e](){return this.layer}constructor(r){super(),this.type="annotation-feature",this.layer=r}get id(){return this.layer.id}}export{o as default};
package/interfaces.d.ts CHANGED
@@ -3375,7 +3375,7 @@ declare namespace __esri {
3375
3375
  export type LocationFunction = import("./intl/t9n.js").LocationFunction;
3376
3376
 
3377
3377
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
3378
- export type AnnotationLayerProperties = import("./layers/AnnotationLayer.js").AnnotationLayerProperties;
3378
+ export type AnnotationLayerProperties = import("./layers/AnnotationFeatureLayer.js").AnnotationFeatureLayerProperties;
3379
3379
 
3380
3380
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
3381
3381
  export type BaseDynamicLayerProperties = import("./layers/BaseDynamicLayer.js").BaseDynamicLayerProperties;
@@ -12251,8 +12251,8 @@ declare namespace __esri {
12251
12251
  export const SnappingOptions: typeof import("./views/interactive/snapping/SnappingOptions.js").default;
12252
12252
 
12253
12253
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
12254
- export type AnnotationLayerView = import("./views/layers/AnnotationLayerView.js").default;
12255
- export const AnnotationLayerView: typeof import("./views/layers/AnnotationLayerView.js").default;
12254
+ export type AnnotationFeatureLayerView = import("./views/layers/AnnotationFeatureLayerView.js").default;
12255
+ export const AnnotationFeatureLayerView: typeof import("./views/layers/AnnotationFeatureLayerView.js").default;
12256
12256
 
12257
12257
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
12258
12258
  export type BuildingComponentSublayerViewProperties = import("./views/layers/BuildingComponentSublayerView.js").BuildingComponentSublayerViewProperties;
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.13",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.14",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -23,77 +23,77 @@ import type { CreatePopupTemplateOptions } from "../support/popupUtils.js";
23
23
  import type { ObjectId } from "../views/types.js";
24
24
  import type { PopupTemplateProperties } from "../PopupTemplate.js";
25
25
 
26
- export interface AnnotationLayerProperties extends LayerProperties, APIKeyMixinProperties, CustomParametersMixinProperties, PortalLayerProperties, OperationalLayerProperties, RefreshableLayerProperties, ScaleRangeLayerProperties, TemporalLayerProperties, BlendLayerProperties, FeatureLayerBaseProperties, Partial<Pick<AnnotationLayer, "outFields" | "popupEnabled">> {
26
+ export interface AnnotationFeatureLayerProperties extends LayerProperties, APIKeyMixinProperties, CustomParametersMixinProperties, PortalLayerProperties, OperationalLayerProperties, RefreshableLayerProperties, ScaleRangeLayerProperties, TemporalLayerProperties, BlendLayerProperties, FeatureLayerBaseProperties, Partial<Pick<AnnotationFeatureLayer, "outFields" | "popupEnabled">> {
27
27
  /**
28
28
  * The popup template for the layer. When set on the layer, the `popupTemplate`
29
29
  * allows users to access attributes and display their values in the
30
30
  * view's Popup when a feature is selected
31
31
  * using text and/or charts. See the [PopupTemplate sample](https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/)
32
32
  * for an example of how [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) interacts with an
33
- * [AnnotationLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/).
33
+ * [AnnotationFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/).
34
34
  *
35
35
  * A default popup template is automatically used if no `popupTemplate` has been defined when
36
36
  * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled)
37
37
  * is set to `true`.
38
38
  *
39
- * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/#createPopupTemplate)
39
+ * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#createPopupTemplate)
40
40
  * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
41
41
  * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
42
42
  */
43
43
  popupTemplate?: PopupTemplateProperties | null;
44
44
  }
45
45
 
46
- export interface AnnotationLayerEvents extends EditBusLayerEvents, RefreshableLayerEvents, LayerEvents {}
46
+ export interface AnnotationFeatureLayerEvents extends EditBusLayerEvents, RefreshableLayerEvents, LayerEvents {}
47
47
 
48
- export default class AnnotationLayer extends AnnotationLayerSuperclass {
48
+ export default class AnnotationFeatureLayer extends AnnotationFeatureLayerSuperclass {
49
49
  /**
50
50
  * @deprecated
51
51
  * Do not directly reference this property.
52
52
  * Use EventNames and EventTypes helpers from \@arcgis/core/Evented
53
53
  */
54
- "@eventTypes": AnnotationLayerEvents;
54
+ "@eventTypes": AnnotationFeatureLayerEvents;
55
55
  /**
56
56
  * @example
57
57
  * // Create an annotation layer from a feature service layer URL.
58
58
  * ```js
59
- * const layer = new AnnotationLayer({
59
+ * const layer = new AnnotationFeatureLayer({
60
60
  * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/RiversAnnotation/FeatureServer/0"
61
61
  * });
62
62
  * ```
63
63
  */
64
- constructor(properties?: AnnotationLayerProperties);
64
+ constructor(properties?: AnnotationFeatureLayerProperties);
65
65
  /**
66
66
  * An array of fields in the layer.
67
67
  *
68
- * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/#objectIdField)
68
+ * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#objectIdField)
69
69
  */
70
70
  get fields(): Field[];
71
71
  /**
72
72
  * An array of field names from the service to include with each feature.
73
73
  * To fetch the values from all fields in the layer, use `["*"]`.
74
74
  * Set this property to include the fields that will be used for client-side
75
- * [queries](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationLayerView/#queryFeatures)
75
+ * [queries](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryFeatures)
76
76
  * if the fields are not part of required fields.
77
77
  *
78
- * @see [AnnotationLayerView.availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationLayerView/#availableFields)
78
+ * @see [AnnotationFeatureLayerView.availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#availableFields)
79
79
  * @see [fieldUtils](https://developers.arcgis.com/javascript/latest/references/core/layers/support/fieldUtils/)
80
80
  * @example
81
81
  * // Includes all fields from the service in the layer
82
82
  * layer.outFields = ["*"];
83
83
  * @example
84
84
  * // Get the specified fields from the service in the layer.
85
- * // These fields will be added to AnnotationLayerView.availableFields.
85
+ * // These fields will be added to AnnotationFeatureLayerView.availableFields.
86
86
  * // Use these fields for client-side filtering and querying.
87
87
  * layer.outFields = ["NAME", "POP_2010", "FIPS", "AREA"];
88
88
  */
89
89
  accessor outFields: string[] | null | undefined;
90
90
  /**
91
- * Indicates whether to display popups when features in the layer are clicked. The layer needs to have a [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/#popupTemplate) to define what
91
+ * Indicates whether to display popups when features in the layer are clicked. The layer needs to have a [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#popupTemplate) to define what
92
92
  * information should be displayed in the popup. Alternatively, a default popup template may be automatically used if
93
93
  * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) is set to `true`.
94
94
  *
95
95
  * @default true
96
- * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/#createPopupTemplate)
96
+ * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#createPopupTemplate)
97
97
  * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
98
98
  * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
99
99
  */
@@ -104,20 +104,20 @@ export default class AnnotationLayer extends AnnotationLayerSuperclass {
104
104
  * view's Popup when a feature is selected
105
105
  * using text and/or charts. See the [PopupTemplate sample](https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/)
106
106
  * for an example of how [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) interacts with an
107
- * [AnnotationLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/).
107
+ * [AnnotationFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/).
108
108
  *
109
109
  * A default popup template is automatically used if no `popupTemplate` has been defined when
110
110
  * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled)
111
111
  * is set to `true`.
112
112
  *
113
- * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/#createPopupTemplate)
113
+ * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#createPopupTemplate)
114
114
  * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
115
115
  * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
116
116
  */
117
117
  get popupTemplate(): PopupTemplate | null | undefined;
118
118
  set popupTemplate(value: PopupTemplateProperties | null | undefined);
119
119
  /** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */
120
- get type(): "annotation";
120
+ get type(): "annotation-feature";
121
121
  /**
122
122
  * Creates a popup template for the layer, populated with all the fields of the layer.
123
123
  *
@@ -142,7 +142,7 @@ export default class AnnotationLayer extends AnnotationLayerSuperclass {
142
142
  * >
143
143
  * > To query for the extent of features/graphics available to or visible in the
144
144
  * > [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) on the client rather than making a server-side query, you must use the
145
- * > [AnnotationLayerView.queryExtent()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationLayerView/#queryExtent) method.
145
+ * > [AnnotationFeatureLayerView.queryExtent()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryExtent) method.
146
146
  *
147
147
  * @param query - Specifies the attributes and spatial
148
148
  * filter of the query. If no parameters are specified, then the extent and count of all features
@@ -176,7 +176,7 @@ export default class AnnotationLayer extends AnnotationLayerSuperclass {
176
176
  * >
177
177
  * > To query for the count of features/graphics available to or visible in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/)
178
178
  * > on the client rather than making a server-side query, you must use the
179
- * > [AnnotationLayerView.queryFeatureCount()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationLayerView/#queryFeatureCount) method.
179
+ * > [AnnotationFeatureLayerView.queryFeatureCount()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryFeatureCount) method.
180
180
  *
181
181
  * @param query - Specifies the attributes and
182
182
  * spatial filter of the query. If no parameters are specified, the total number of features
@@ -205,12 +205,12 @@ export default class AnnotationLayer extends AnnotationLayerSuperclass {
205
205
  * > **Notes**
206
206
  * >
207
207
  * > To query features available to or visible in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) on the client rather than making a server-side query, you must
208
- * > use the [AnnotationLayerView.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationLayerView/#queryFeatures) method.
208
+ * > use the [AnnotationFeatureLayerView.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryFeatures) method.
209
209
  * >
210
210
  * > When querying a service with z-values and no [vertical coordinate system](https://doc.esri.com/en/arcgis-pro/latest/help/mapping/properties/vertical-coordinate-systems.html) information,
211
211
  * > the z-values will automatically be converted to match the [Query.outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outSpatialReference) units.
212
212
  * > Example: The service has a horizontal spatial reference using `feet` units and the query is made with `outSpatialReference`
213
- * > based on `meter` units, then [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationLayer/#queryFeatures) automatically converts the values from `feet` to `meter` units.
213
+ * > based on `meter` units, then [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/AnnotationFeatureLayer/#queryFeatures) automatically converts the values from `feet` to `meter` units.
214
214
  *
215
215
  * @param query - Specifies the attributes and spatial
216
216
  * filter of the query. If no parameters are specified, then all features satisfying the layer's
@@ -228,7 +228,7 @@ export default class AnnotationLayer extends AnnotationLayerSuperclass {
228
228
  * console.log(results.features);
229
229
  * });
230
230
  * @example
231
- * const layer = new AnnotationLayer({
231
+ * const layer = new AnnotationFeatureLayer({
232
232
  * url: fsUrl // points to a Feature Service layer url
233
233
  * });
234
234
  *
@@ -252,7 +252,7 @@ export default class AnnotationLayer extends AnnotationLayerSuperclass {
252
252
  * >
253
253
  * > To query for ObjectIDs of features available to or visible in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) on the client rather
254
254
  * > than making a server-side query, you must use the
255
- * > [AnnotationLayerView.queryObjectIds()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationLayerView/#queryObjectIds) method.
255
+ * > [AnnotationFeatureLayerView.queryObjectIds()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/AnnotationFeatureLayerView/#queryObjectIds) method.
256
256
  *
257
257
  * @param query - Specifies the attributes and spatial
258
258
  * filter of the query. If no parameters are specified, then the Object IDs of all features
@@ -270,4 +270,4 @@ export default class AnnotationLayer extends AnnotationLayerSuperclass {
270
270
  */
271
271
  queryObjectIds(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<ObjectId[]>;
272
272
  }
273
- declare const AnnotationLayerSuperclass: typeof Layer & typeof ClonableMixin & typeof APIKeyMixin & typeof CustomParametersMixin & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof TemporalLayer & typeof BlendLayer & typeof FeatureLayerBase
273
+ declare const AnnotationFeatureLayerSuperclass: typeof Layer & typeof ClonableMixin & typeof APIKeyMixin & typeof CustomParametersMixin & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof TemporalLayer & typeof BlendLayer & typeof FeatureLayerBase
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__addDisposableResource as e,__disposeResources as r,__decorate as t}from"tslib";import s from"../PopupTemplate.js";import i from"../request.js";import{ClonableMixin as o}from"../core/Clonable.js";import a from"../core/Collection.js";import n from"../core/Error.js";import{disposable as l,makeHandle as p}from"../core/handleUtils.js";import{MultiOriginJSONSupportMixin as u}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d,whenOrAbort as m,onAbort as y}from"../core/promiseUtils.js";import{watch as h,sync as c}from"../core/reactiveUtils.js";import{join as f}from"../core/urlUtils.js";import{property as b,subclass as g}from"../core/accessorSupport/decorators.js";import v from"../graphic/AnnotationFeatureGraphicOrigin.js";import j from"./Layer.js";import{APIKeyMixin as E}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as L}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{FeatureLayerBase as I}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as P}from"./mixins/OperationalLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as O}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as F}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as T}from"./mixins/TemporalLayer.js";import A from"./support/AnnotationSublayer.js";import{barrierWeight as _,popupEnabled as q}from"./support/commonProperties.js";import{ensureLayerCredential as C,createQuery as U,getFieldDomain as D,hasDataChanged as G}from"./support/featureLayerUtils.js";import{defineFieldProperties as N}from"./support/fieldProperties.js";import{fixTimeInfoFields as Q}from"./support/fieldUtils.js";import{serviceSupportsSpatialReference as H}from"./support/versionUtils.js";import J from"../rest/support/Query.js";import{createPopupTemplate as R}from"../support/popupUtils.js";import{reader as M}from"../core/accessorSupport/decorators/reader.js";const k="annotation-feature-layer",B=N(),K=a.ofType(A);let V=class extends(I(L(T(F(O(S(P(x(u(w(E(o(j))))))))))))){constructor(e){super(e),this.barrierWeight="high",this.fields=null,this.fieldsIndex=null,this.graphicOrigin=new v(this),this.operationalLayerType="ArcGISAnnotationLayer",this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.source=null,this.supportedSourceTypes=new Set(["Annotation Layer"]),this.type="annotation-feature",this._dataElementPromise=null,this.addHandles(h(()=>this.sublayers,(e,r)=>this._handleSublayersChange(e,r),c))}destroy(){this.source?.destroy()}load(e){const r=e?.signal,t=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(d).then(async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(r);null!=e&&(this.layerId=e)}if(!this.url)throw new n(`${k}:missing-url`,"AnnotationFeatureLayer must be created with a url");return this.initLayerProperties(await this.createGraphicsSource(r))}).then(()=>C(this,"load",e));return this.addResolvingPromise(t),Promise.resolve(this)}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get effectiveEditingEnabled(){return!1}get defaultPopupTemplate(){return this.createPopupTemplate()}readSublayers(e,r){const t=new K(r.subtypes.map(({code:e,name:r})=>new A({subtypeCode:e,title:r})).reverse());if(this.visibleLayers){const e=new Set(this.visibleLayers);t.forEach(r=>{r.visible=e.has(r.subtypeCode)})}return t}get visibleLayers(){return this.sublayers?Array.from(new Set(this.sublayers?.toArray().filter(e=>e.visible).map(e=>e.subtypeCode).sort((e,r)=>e-r)??null)):this._get("visibleLayers")??null}set visibleLayers(e){this._set("visibleLayers",e)}createPopupTemplate(e){return R(this,e)}async createGraphicsSource(t){const s={stack:[],error:void 0,hasError:!1};try{const{default:r}=await m(import("./graphics/sources/FeatureLayerSource.js"),t),i=new r({layer:this,supportedSourceTypes:this.supportedSourceTypes});e(s,l(y(t,()=>i.cancelLoad())??p()),!1);return await i.load({signal:t}),i}catch(i){s.error=i,s.hasError=!0}finally{r(s)}}createQuery(){const e=U(this);return e.where=this.definitionExpression||"1=1",e}async fetchDataElement(e){if(this._dataElementPromise)return this._dataElementPromise;if(!this.url)throw new Error("InternalError: A URL is required to retrieve the data element for this layer.");const r=f(this.url,"queryDataElements"),t={f:"json",layers:this.layerId};return this._dataElementPromise=i(r,{...e,responseType:"json",query:t}).then(e=>{const r=e.data.layerDataElements,t=this.layerId,s=r.find(e=>e.layerId===t);if(!s)throw new n("fetchDataElement:not-available","A data element for this layer could not be retrieved.");return s.dataElement}),this._dataElementPromise}getFieldDomain(e,r){return D(this,e,r,this.getField(e)?.domain??null)}async queryFeatures(e,r){const t=await this.load(),s=await t.source.queryFeatures(J.from(e)??t.createQuery(),r),i=this.graphicOrigin;if(s?.features)for(const o of s.features)o.layer=o.sourceLayer=t,o.origin=i;return s}async queryObjectIds(e,r){const t=await this.load();return t.source.queryObjectIds(J.from(e)??t.createQuery(),r)}async queryFeatureCount(e,r){const t=await this.load();return t.source.queryFeatureCount(J.from(e)??t.createQuery(),r)}async queryExtent(e,r){const t=await this.load();return t.source.queryExtent(J.from(e)??t.createQuery(),r)}serviceSupportsSpatialReference(e){return this.loaded&&H(this,e)}async initLayerProperties(e){this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),Q(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return G(this)}_fetchFirstValidLayerId(e){return i(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(e=>{const r=e.data;if(!r)return;this.applyPreferredHost(r);const t=[...r.layers||[],...r.tables||[]];return t.find(({type:e})=>!e||this.supportedSourceTypes.has(e))?.id})}_handleSublayersChange(e,r){r&&(r.forEach(e=>{e.parent=null}),this.removeHandles("sublayers-owner")),e&&(e.forEach(e=>{e.parent=this}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this}),e.on("after-remove",({item:e})=>{e.parent=null})],"sublayers-owner"))}};t([b(_)],V.prototype,"barrierWeight",void 0),t([b({json:{write:!0}})],V.prototype,"editingEnabled",null),t([b({readOnly:!0})],V.prototype,"effectiveEditingEnabled",null),t([b({...B.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],V.prototype,"fields",void 0),t([b(B.fieldsIndex)],V.prototype,"fieldsIndex",void 0),t([b({readOnly:!0,clonable:!1})],V.prototype,"graphicOrigin",void 0),t([b({type:["ArcGISAnnotationLayer"]})],V.prototype,"operationalLayerType",void 0),t([b(B.outFields)],V.prototype,"outFields",void 0),t([b(q)],V.prototype,"popupEnabled",void 0),t([b({type:s,json:{name:"popupInfo",write:!0}})],V.prototype,"popupTemplate",void 0),t([b({readOnly:!0})],V.prototype,"defaultPopupTemplate",null),t([b({clonable:!1,readOnly:!0})],V.prototype,"source",void 0),t([b({type:K})],V.prototype,"sublayers",void 0),t([M("service","sublayers",["subtypes"])],V.prototype,"readSublayers",null),t([b({json:{read:!1},value:"annotation-feature",readOnly:!0})],V.prototype,"type",void 0),t([b({type:[Number],json:{write:{ignoreOrigin:!0}}})],V.prototype,"visibleLayers",null),V=t([g("esri.layers.AnnotationFeatureLayer")],V);const W=V;export{W as default};
@@ -63,11 +63,14 @@ export interface GaussianSplatLayerProperties extends LayerProperties, APIKeyMix
63
63
  * Gaussian splats are optimized during a training process. When rendered together, Gaussian splats blend to form a smooth,
64
64
  * photorealistic 3D representation.
65
65
  *
66
+ * Unlike mesh-based representations, Gaussian Splat layers represent surfaces using a large set of semi-transparent 3D Gaussians. Depending on the source data and reconstruction, the resulting surface may contain minor outliers or holes. These artifacts are often not visually prominent, but can affect analytical tools.
67
+ *
66
68
  * > [!WARNING]
67
69
  * >
68
70
  * > **Known Limitations**
69
71
  * >
70
- * > * Currently, Elevation Profile, Viewshed, Line of Sight, Slice and Volume Measurement are not supported.
72
+ * > * Currently, Elevation Profile, Viewshed, Line of Sight and Volume Measurement are not supported.
73
+ * > * When using the [Slice component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slice/), the slice plane will, contrary to the behavior described in [`tiltEnabled`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slice/#tiltEnabled), not automatically align to the underlying surface of a Gaussian Splat layer due to the absence of surface normals.
71
74
  * > * Gaussian splat layers do not cast or receive shadows.
72
75
  * > * Gaussian splat layers are not guaranteed to always draw correctly in a local scene using WGS84 as spatial reference
73
76
  * > (WKID 4326).
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as u}from"../../../core/units.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,create as d,expandWithAABB as m,negativeInfinity as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{isExtent as _,isPolygon as F}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{getGeometry as E,cleanFromGeometryEngine as b}from"./geometryUtils.js";import{checkProjectionSupport as T,project as A,projectMany as v}from"./projectionSupport.js";import{QueryEngineCache as G}from"./QueryEngineCache.js";import{queryCapabilities as k}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeAttributeBinsQuery as P,normalizeQueryLike as q,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as U,validateQuery as B,validateStatisticsQuery as M}from"./queryValidationUtils.js";import{getSpatialQueryOperator as H,canQueryWithRBush as Z}from"./spatialQuerySupport.js";import{getTimeExtent as J,getTimeOperator as L}from"./timeSupport.js";import N from"../../support/FieldsIndex.js";import{ImmediateTask as V}from"../../../views/support/Scheduler.js";const D="unsupported-query";class K{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class W{constructor(e){this._changeHandle=null,this.capabilities={query:k},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new G,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:N.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=V}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(D,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=J(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return o(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==O)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===O)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===O)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await P(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==O)throw i;t=new C([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await q(l,this.definitionExpression,this.spatialReference),yield,l=await B(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const o=!S(i.spatialReference,this.spatialReference);o&&(await T(i.spatialReference,this.spatialReference),yield);const u="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=o?A(y,this.spatialReference):y;if(!h)return{candidates:[]};const d=(await Q(w(i),null,{signal:t}))[0];yield;const m=(await Q(w(h),null,{signal:t}))[0];if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(X(m.toJSON()));yield;const p=new C(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=o?A(x,this.spatialReference):x,_=o?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:_},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(d(),f);return await this.featureStore.forEachBounds(e,e=>m(r,e)),Y(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:A(a,s);if(!n)return null;const l=i||r,o=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const u=this.featureAdapter,c=await this._searchFeatures(X(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(u.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await H("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(u.getObjectId(e))||r(u.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new C(a,e,this);return await o(l)}if(!c.length)return new C([],e,this);if(this._canExecuteSinglePass(n,e))return await o(new C(c,e,this));const y=await H("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(u.getGeometry(e)));return yield,await o(new C(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,o=r?null:this._getCacheKey(i),u=o?this._cache.get(o):null;if(u)return new C(u,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:A(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(X(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await H(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new C(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new C([],i,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new C(p,i,this));const g=await H(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new C(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=L(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await H(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const o=r||s;return R(a)&&!S(this.spatialReference,a)&&o?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return Z(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await v(e.items.map(e=>E(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM),this.geometryType))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await M(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==O)throw i;return new C([],e,this)}}get test(){}}function X(e){if(Z(e)){if(_(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function Y(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:b(r)};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=A(a,t,i);if(n.spatialReference=b(i),n.xmax-n.xmin===0){const e=u(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=u(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=u(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{K as Feature,W as QueryEngine,Y as getQueryResultExtent};
2
+ import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as u}from"../../../core/units.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,create as d,expandWithAABB as m,negativeInfinity as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{isExtent as _,isPolygon as F}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{getGeometry as E,cleanFromGeometryEngine as b}from"./geometryUtils.js";import{checkProjectionSupport as T,project as A,projectMany as v}from"./projectionSupport.js";import{QueryEngineCache as G}from"./QueryEngineCache.js";import{queryCapabilities as k}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeAttributeBinsQuery as P,normalizeQueryLike as q,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as U,validateQuery as B,validateStatisticsQuery as M}from"./queryValidationUtils.js";import{getSpatialQueryOperator as H,canQueryWithRBush as Z}from"./spatialQuerySupport.js";import{getTimeExtent as J,getTimeOperator as L}from"./timeSupport.js";import N from"../../support/FieldsIndex.js";import{ImmediateTask as V}from"../../../views/support/Scheduler.js";const D="unsupported-query";class K{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class W{constructor(e){this._changeHandle=null,this.capabilities={query:k},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new G,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:N.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=V}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(D,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=J(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return o(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==O)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===O)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===O)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await P(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==O)throw i;t=new C([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await q(l,this.definitionExpression,this.spatialReference),yield,l=await B(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const o=!S(i.spatialReference,this.spatialReference);o&&(await T(i.spatialReference,this.spatialReference),yield);const u="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=o?A(y,this.spatialReference):y;if(!h)return{candidates:[]};const d=(await Q(w(i),null,{signal:t}))[0];yield;const m=(await Q(w(h),null,{signal:t}))[0];if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(X(m.toJSON()));yield;const p=new C(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=o?A(x,this.spatialReference):x,_=o?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:_},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(d(),f);return await this.featureStore.forEachBounds(e,e=>m(r,e)),Y(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:A(a,s);if(!n)return null;const l=i||r,o=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const u=this.featureAdapter,c=await this._searchFeatures(X(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(u.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await H("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(u.getObjectId(e))||r(u.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new C(a,e,this);return await o(l)}if(!c.length)return new C([],e,this);if(this._canExecuteSinglePass(n,e))return await o(new C(c,e,this));const y=await H("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(u.getGeometry(e)));return yield,await o(new C(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,o=r?null:this._getCacheKey(i),u=o?this._cache.get(o):null;if(u)return new C(u,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:A(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(X(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await H(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new C(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new C([],i,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new C(p,i,this));const g=await H(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new C(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=L(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await H(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const o=r||s;return R(a)&&!S(this.spatialReference,a)&&o?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return Z(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await v(e.items.map(e=>E(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM),this.geometryType))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await M(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==O)throw i;return new C([],e,this)}}get test(){}}function X(e){if(Z(e)){if(_(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function Y(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:b(r)};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=A(a,t,i);if(n.spatialReference=b(i),n.xmax-n.xmin===0){const e=u(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=u(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=u(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{K as Feature,W as QueryEngine,X as getQueryBBoxes,Y as getQueryResultExtent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../core/Error.js";import{JSONMap as e}from"../../../core/jsonMap.js";import{getUnitString as i}from"../../../core/units.js";import{canProjectWithoutEngine as r}from"../../../geometry/projectionUtils.js";import{getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{isPolygon as o,isExtent as s,isPolyline as a}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as l}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as m}from"../../../geometry/support/normalizeUtils.js";import{isGeographic as u,isWebMercator as c,wgs84 as p,equals as f}from"../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as y,project as d}from"./projectionSupport.js";const g=new e({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"}),S=Object.freeze({}),R="frequency";async function x(t,e,i){const r=t.bin;return r.onField&&(r.onField=r.onField.trim()),r.onExpression?.value&&(r.onExpression.value=r.onExpression.value.trim()),r.splitBy&&(r.splitBy.value&&(r.splitBy.value=r.splitBy.value.trim()),r.splitBy.outAlias&&(r.splitBy.outAlias=r.splitBy.outAlias.trim())),r.stackBy&&(r.stackBy.value&&(r.stackBy.value=r.stackBy.value.trim()),r.stackBy.outAlias&&(r.stackBy.outAlias=r.stackBy.outAlias.trim())),"normalizationField"in r.parameters&&r.parameters.normalizationField&&(r.parameters.normalizationField=r.parameters.normalizationField.trim()),t.outStatistics?.length||(t.outStatistics=[{statisticType:"count",onStatisticField:"1",outStatisticFieldName:R}]),j(t,e,i)}async function j(t,e,i){const{outFields:r,orderByFields:n,groupByFieldsForStatistics:o,outStatistics:s}=t;if(r)for(let a=0;a<r.length;a++)r[a]=r[a].trim();if(n)for(let a=0;a<n.length;a++)n[a]=n[a].trim();if(o)for(let a=0;a<o.length;a++)o[a]=o[a].trim();if(s)for(let a=0;a<s.length;a++)s[a].onStatisticField&&(s[a].onStatisticField=s[a].onStatisticField.trim());return t.geometry&&!t.outSR&&(t.outSR=t.geometry.spatialReference),w(t,e,i)}async function w(t,e,i){if(!t)return null;let{where:r}=t;if(t.where=r=r?.trim(),(!r||/^1 *= *1$/.test(r)||e&&e===r)&&(t.where=null),!t.geometry)return t;let o=await v(t);if(t.distance=0,t.units=null,"esriSpatialRelEnvelopeIntersects"===t.spatialRel){const{spatialReference:e}=t.geometry;o=n(o),o.spatialReference=e}if(o){await y(o.spatialReference,i),o=F(o,i);const e=(await m(l(o)))[0];if(null==e)throw S;const r="quantizationParameters"in t&&t.quantizationParameters?.tolerance||"maxAllowableOffset"in t&&t.maxAllowableOffset||0,n=r&&B(o,i)?{extendedParams:{densificationStep:8*r}}:void 0,s=e.toJSON(),a=d(s,s.spatialReference,i,n);if(!a)throw S;a.spatialReference=i,t.geometry=a}return t}function B(t,e){if(!t)return!1;const i=t.spatialReference;return(s(t)||o(t)||a(t))&&!f(i,e)&&!r(i,e)}function F(t,e){const i=t.spatialReference;return B(t,e)&&s(t)?{spatialReference:i,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:t}async function v(e){const{distance:r,units:n}=e,s=e.geometry;if(null==r||"vertexAttributes"in s)return s;const a=s.spatialReference,l=n?g.fromJSON(n):i(a),m=a&&(u(a)||c(a))?s:await y(a,p).then(()=>d(s,p)),f=await import("../../../geometry/operators/json/geodesicBufferOperator.js");await f.load();const S=f.execute(m,r||1,{unit:l})??void 0;if(!S||!o(S)||0===S.rings.length)throw new t("unsupported-query:invalid-parameters","Invalid parameters for query by distance");return S}function h(t,e){return null==t?null:"string"==typeof t?e?new Date(`1970-01-01T${t}Z`).getTime():new Date(t).getTime():t instanceof Date?t.getTime():t}export{h as getDateInNumber,x as normalizeAttributeBinsQuery,j as normalizeQuery,w as normalizeQueryLike,S as queryEngineEmptyResult,g as unitsKebabDict};
2
+ import t from"../../../core/Error.js";import{JSONMap as e}from"../../../core/jsonMap.js";import{getUnitString as i}from"../../../core/units.js";import{canProjectWithoutEngine as r}from"../../../geometry/projectionUtils.js";import{getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{isPolygon as o,isExtent as s,isPolyline as a}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as l}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as m}from"../../../geometry/support/normalizeUtils.js";import{isGeographic as u,isWebMercator as c,wgs84 as p,equals as f}from"../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as y,project as d}from"./projectionSupport.js";const g=new e({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"}),S=Object.freeze({}),R="frequency";async function x(t,e,i){const r=t.bin;return r.onField&&(r.onField=r.onField.trim()),r.onExpression?.value&&(r.onExpression.value=r.onExpression.value.trim()),r.splitBy&&(r.splitBy.value&&(r.splitBy.value=r.splitBy.value.trim()),r.splitBy.outAlias&&(r.splitBy.outAlias=r.splitBy.outAlias.trim())),r.stackBy&&(r.stackBy.value&&(r.stackBy.value=r.stackBy.value.trim()),r.stackBy.outAlias&&(r.stackBy.outAlias=r.stackBy.outAlias.trim())),"normalizationField"in r.parameters&&r.parameters.normalizationField&&(r.parameters.normalizationField=r.parameters.normalizationField.trim()),t.outStatistics?.length||(t.outStatistics=[{statisticType:"count",onStatisticField:"1",outStatisticFieldName:R}]),j(t,e,i)}async function j(t,e,i){const{outFields:r,orderByFields:n,groupByFieldsForStatistics:o,outStatistics:s}=t;if(r)for(let a=0;a<r.length;a++)r[a]=r[a].trim();if(n)for(let a=0;a<n.length;a++)n[a]=n[a].trim();if(o)for(let a=0;a<o.length;a++)o[a]=o[a].trim();if(s)for(let a=0;a<s.length;a++)s[a].onStatisticField&&(s[a].onStatisticField=s[a].onStatisticField.trim());return t.geometry&&!t.outSR&&(t.outSR=t.geometry.spatialReference),w(t,e,i)}async function w(t,e,i){if(!t)return null;let{where:r}=t;if(t.where=r=r?.trim(),(!r||/^1 *= *1$/.test(r)||e&&e===r)&&(t.where=null),!t.geometry)return t;let o=await v(t);if(t.distance=0,t.units=null,"esriSpatialRelEnvelopeIntersects"===t.spatialRel){const{spatialReference:e}=t.geometry;o=n(o),o.spatialReference=e}if(o){await y(o.spatialReference,i),o=F(o,i);const e=(await m(l(o)))[0];if(null==e)throw S;const r="quantizationParameters"in t&&t.quantizationParameters?.tolerance||"maxAllowableOffset"in t&&t.maxAllowableOffset||0,n=r&&B(o,i)?{extendedParams:{densificationStep:8*r}}:void 0,s=e.toJSON(),a=d(s,s.spatialReference,i,n);if(!a)throw S;a.spatialReference=i,t.geometry=a}return t}function B(t,e){if(!t)return!1;const i=t.spatialReference;return(s(t)||o(t)||a(t))&&!f(i,e)&&!r(i,e)}function F(t,e){const i=t.spatialReference;return B(t,e)&&s(t)?{spatialReference:i,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:t}async function v(e){const{distance:r,units:n}=e,s=e.geometry;if(!r||"vertexAttributes"in s)return s;const a=s.spatialReference,l=n?g.fromJSON(n):i(a),m=a&&(u(a)||c(a))?s:await y(a,p).then(()=>d(s,p)),f=await import("../../../geometry/operators/json/geodesicBufferOperator.js");await f.load();const S=f.execute(m,r||1,{unit:l})??void 0;if(!S||!o(S)||0===S.rings.length)throw new t("unsupported-query:invalid-parameters","Invalid parameters for query by distance");return S}function h(t,e){return null==t?null:"string"==typeof t?e?new Date(`1970-01-01T${t}Z`).getTime():new Date(t).getTime():t instanceof Date?t.getTime():t}export{h as getDateInNumber,x as normalizeAttributeBinsQuery,j as normalizeQuery,w as normalizeQueryLike,S as queryEngineEmptyResult,g as unitsKebabDict};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- function n(n){const u=new Map;for(const o of n.files){const n=t(o);u.set(o.name,n)}return u}function t(n){const t=new Map;for(const u of n.statistics??[]){const n=u.column.at(-1);null!=n&&t.set(n,{minValue:u.minValue,maxValue:u.maxValue,nullCount:u.nullCount??0,distinctCount:u.distinctCount??null})}return new u(0,0,t)}class u{static fromFile(n){const t=n.numRows(),o=n.byteLength(),l=new Map;for(const u of n.getColumnDescriptors()){const n=u.minValue(),t=u.maxValue(),o=u.distinctCount(),s=u.nullCount();null!=n&&null!=t&&null!=o&&null!=s&&l.set(u.name(),{minValue:n,maxValue:t,distinctCount:o,nullCount:s}),u.free()}return new u(t,o,l)}constructor(n,t,u){this.rowCount=n,this.byteSize=t,this.statistics=u}}export{u as FileStatistics,t as parseFileStatistics,n as parseFileStatisticsMap};
2
+ function n(n){const u=new Map;for(const o of n.files){const n=t(o);u.set(o.name,n)}return u}function t(n){const t=new Map;for(const u of n.statistics??[]){const n=u.column.at(-1);null!=n&&t.set(n,{minValue:u.minValue,maxValue:u.maxValue,nullCount:u.nullCount??0,distinctCount:u.distinctCount??null})}return new u(0,0,t)}class u{static fromFile(n){const t=n.numRows(),o=n.byteLength(),l=new Map;for(const u of n.getColumnDescriptors()){const n=u.minValue(),t=u.maxValue(),o=u.distinctCount()??null,s=u.nullCount()??null;null!=n&&null!=t&&l.set(u.name(),{minValue:n,maxValue:t,distinctCount:o,nullCount:s}),u.free()}return new u(t,o,l)}constructor(n,t,u){this.rowCount=n,this.byteSize=t,this.statistics=u}}export{u as FileStatistics,t as parseFileStatistics,n as parseFileStatisticsMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{parseWhereClause as u}from"../../../../core/sql.js";import l from"../../../../geometry/SpatialReference.js";import{set as p,create as c,expandWithAABB as d,expandWithRect as f,negativeInfinity as m}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as h,QueryEngine as y}from"../../data/QueryEngine.js";import{queryBinsCapabilities as g,queryCapabilities as _}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as w}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as x}from"../../data/queryUtils.js";import{createFileProvider as I}from"../parquet/createFileProvider.js";import{createDrawingInfo as F}from"./clientSideDefaults.js";import{getParquetFileId as S,getParquetRowId as R}from"./parquetIdUtils.js";import q from"../../../support/Field.js";import v from"../../../support/FieldsIndex.js";import{fromParquetGeometryEncodingJSON as C}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as E,fromParquetJSONGeometryType as O,toParquetJSONGeometryType as b}from"../../../support/parquetUtils.js";import{loadParquetModule as P}from"../../../../libs/parquet/loadParquetModule.js";import{FeatureStoreQueryAdapter as Q}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as T}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as j}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as N}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as A}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const M=new Q,B=4,G="__OBJECTID",D=new TextDecoder,z=8e3,k=8,V=2,W=20;class U{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){n(e),await this._fill(e);const t=await J(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,null!=t.chunk)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<k;){const t=this._getOrCreateNextStream(e);if(null==t)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){const t=this._resolvedCount>=k?k:V;if(this._fileIndex<this._files.length&&this._streams.length<t){const t=this._files[this._fileIndex++],r=new Z(t.id,this._createFileStream(t,e));return this._streams.push(r),r}return this._getNextStream()}_getNextStream(){const e=this._streams.length;for(let t=0;t<e;t++){const r=(this._streamIndex+t)%e,s=this._streams[r];if(s.canRead)return this._streamIndex=(r+1)%e,s}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function J(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class Z{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(e){this._readCount++;try{const t=await this._stream,r=await t.next(e);return null==r?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:r}}finally{this._readCount--}}}class L{constructor(){this._queue=new o({concurrency:B,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={}}async load(e){const t=e.spatialReference?l.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=e.customParameters,this._provider=I(e.provider,null,()=>this._customParameters);const r=await this._provider.getMetadata(),a=await E(r,{fields:e.fields?.map(e=>q.fromJSON(e)),geometryEncoding:e.geometryEncoding?C(e.geometryEncoding):null,geometryType:e.geometryType?O(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(!a.fields)throw new s("parquet:unsupported","Fields must be defined");let n;if(a.spatialReference&&a.geometryType){if(!a.spatialReference)throw new s("parquet:unsupported","SpatialReference must be defined");if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(i.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:a.spatialReference}),a.spatialReference=l.WGS84),n={geometry:a.geometryEncoding?{geometryType:b(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.geometryEncoding.toJSON()}:null,displayOptimization:a.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=a.displayOptimization,await this._provider.updateGeometryInfo(n),this._capabilities=ie(await this._getFileStatistics());const o=await this._provider.getFiles();if(!o.length)return{layerDefinition:{},capabilities:ie(null)};const u=await o[0].file;a.file=u;const{fields:p}=a;if(null==p)throw new s("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",p);p.push(new q({name:G,type:"oid",alias:G}));for(const s of p){const e=u.getColumnId(s.name);null!=e&&(this._indexMap[s.name]=e)}const c=new v(p.map(e=>e.toJSON()));this._fieldsIndex=c;const d=b(a.geometryType??"point");return this._metadata=N.createFeature({fieldsIndex:c.toJSON(),geometryType:d,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:d,featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:a.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(a),{capabilities:this._capabilities,layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:F(d),extent:this._fullExtent??void 0,geometryType:d,geometryEncoding:a.geometryEncoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:e}of this._streams.values())e.remove();this._streams.clear()}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._provider=I(e,this._provider.getGeometryInfo(),()=>this._customParameters)}async queryFeatures(e,t){this._validateQuery(e),ae(e)||(e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,z):z,e.resultOffset=e.resultOffset??0),(e.outStatistics||e.returnDistinctValues)&&(e.returnGeometry=void 0);return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){const r=await x(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!H(r))return this._getFeatureCount();r.outFields=void 0,r.returnGeometry=void 0;return(await this._enqueueQuery(r,t)).createQueryResponseForCount()}async queryObjectIds(e,t){const r=await x(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!H(r))return Array.from({length:await this._getFeatureCount()},(e,t)=>t);r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,8e3):8e3,r.resultOffset=r.resultOffset??0,r.returnGeometry=void 0,r.outFields=void 0;return(await this._enqueueQuery(r,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){const s=await x(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!H(s))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=r(this._metadata.spatialReference);s.returnGeometry=!0,s.outFields=void 0;const a=p(c(),m),n=c(),o=await this._enqueueQuery(s,t);let u=0;for(const r of o.items)r.getBounds(n)&&(d(a,n),u+=1);return{count:u,extent:h(a,i,s.outSR?r(s.outSR):i.toJSON(),i,!1)}}async queryStream(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=await this._getCandidateFiles(e),s=new U(r,async(t,r)=>{const s=await t.file,i=await this._createParquetQuery(s,e);return s.executeQuery(i,r)}),i=this._streamIdCounter++,n=a(t.signal,e=>{const t=this._streams.get(i);null!=t&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:s,handle:n}),i}async getStreamNext(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=this._streams.get(e);if(!r)return{result:null};const s=await r.stream.next(t.signal);if(null==s)return r.handle.remove(),this._streams.delete(e),{result:null};const i=s.chunk.serialize().buffer,a={fileId:s.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async createPatch(e,t,r,s,i){if(!i.signal)throw new Error("InternalError: AbortSignal must be passed");const a=await this._getFileInfoById(e),n=await a.file;return(await n.createChunkPatch(t,r,s,i.signal)).serialize().buffer}async _getCandidateFiles(e){const t=await this._provider.getFiles(),r=await this._getSpatialFilePruning(e);if(null==r)return t;const s=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,r));return"xz"===r.type?$(s,r):s}async _getSpatialFilePruning(e){if("tile"!==e.type)return null;const t=this._displayOptimization,r=t?.index;if(null==r)return null;const s=e.outSpatialReference.wkid;if(null==r.wkid||null==s)return null;const i=r.wkid,a=await P();switch(r.type){case"xz":return{type:"xz",fieldName:r.code,intersects:(t,n)=>a.queryIntersectsXZStatistics(r.fullExtent,e.extent,s,i,W,t,n)};case"z":return{type:"xy",xFieldName:r.xColumn,yFieldName:r.yColumn,intersects:(t,r,n,o)=>a.queryIntersectsXYStatistics(e.extent,s,i,t,r,n,o)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case"xz":{const r=X(e,t);return null==r||te(r,t)}case"xy":{const{xStatistics:r,yStatistics:s}=ee(e,t);return null==r||null==s||re(r,s,t)}}}async _tryDeriveParquetFullExtent(r){if(!r.spatialReference)return null;if(null==this._fullExtent&&"location"===r.geometryEncoding?.type){const i=await this._provider.getFiles(),{xField:a,yField:n}=r.geometryEncoding,o=p(c(),m);for(const r of i){const i=await r.file;for(const r of i.rowGroups()){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,r.columnDescriptorForAttribute(a),!1),s=e(i,r.columnDescriptorForAttribute(n),!1),u=[t.minValue(),s.minValue(),t.maxValue(),s.maxValue()];f(o,u),r.free()}catch(s){i.error=s,i.hasError=!0}finally{t(i)}}}return{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:r.spatialReference?.toJSON()}}return null}async _getFileInfoById(e){const t=await this._provider.getFiles();for(const r of t)if(r.id===e)return r;throw new Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t){const r=(await P()).Query.new();return"tile"===t.type&&(r.setExtent(t.extent),r.setQuantizationTransform(t.transform),r.setScale(t.scale)),r.setOutFields(t.outFields.filter(e=>null!=this._indexMap[e])),r.setOutSpatialReference(t.outSpatialReference.wkid),r.setReturnGeometry(t.returnGeometry),t.where&&await this._setWhereClause(r,e,t.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new s("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async _setWhereClause(e,t,r){const i=this._indexMap,a=this._fieldsIndex,n={getAttribute(e,r){const s=t.readAttribute(e.rowGroup,e.row,i[r]);if(null==s)return null;const n=a.get(r);return"esriFieldTypeString"===n.type||"esriFieldTypeDateOnly"===n.type||"esriFieldTypeTimeOnly"===n.type||"esriFieldTypeTimestampOffset"===n.type?D.decode(s):s}},o=await u(r,this._fieldsIndex);if(!o.isStandardized)throw new s("sql-parse-error","expression is not standardized");const l=(e,t)=>o.testFeatureCompiled({rowGroup:e,row:t},n,null);e.setWhere(r),e.setWhereEvaluator(l),e.setWhereFields(o.fieldNames)}async*_fetchChunks(e,t){const r=await P(),s=await this._provider.getFiles();for(const i of s){const s=await i.file,a=r.Query.new();a.setOutFields(e.fields),a.setReturnGeometry(e.returnGeometry),e.where&&await this._setWhereClause(a,s,e.where);const o=await s.executeQuery(a),u=[],l=o.next(t);for(let e=0;e<B;e++)u.push(o.next(t));let p=await l;for(;null!=p;){n(t);const e=new A(this._metadata,this._indexMap,p,i.id),r=Y([new T(e,null,0,!1)],this._queryEngineParams),s=u.shift();u.push(o.next(t)),yield r,p=await s}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const r=await this._getReadParams(e);if(e.where=void 0,e.objectIds?.length){const r=new Map;for(const t of e.objectIds){const e=S(t),s=R(t);let i=r.get(e);i||(i=[],r.set(e,i)),i.push(s)}const s=[];for(const[i,a]of r.entries()){const r=await this._executeFileIdQuery(e,i,a,t);for(const e of r)s.push(e)}return new w(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:M,featureIdInfo:this._queryEngineParams.featureIdInfo})}let s=e.resultRecordCount??await this._getFeatureCount(),i=e.resultOffset??0;e.resultRecordCount=void 0,e.resultOffset=void 0;const a=[];for await(const n of this._fetchChunks(r,t)){const r=await n.executeQueryForOpaqueFeatures(e,t);if(r.length>i){const t=r.slice(i,Math.min(i+s,r.length));for(const e of t)a.push(e);if(i=0,s-=t.length,0===s)return new w(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:M,featureIdInfo:this._queryEngineParams.featureIdInfo})}else i-=r.length}return new w(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:M,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,r,s){const i=await this._getReadParams(e),a=(await P()).Query.new();a.setOutFields(i.fields),a.setReturnGeometry(i.returnGeometry),a.setIds(new Uint32Array(r));const n=await this._getFile(t),o=await n.executeQuery(a,s);let u=await o.next(s),l=0;const p=[];for(;null!=u;){const e=new A(this._metadata,this._indexMap,u,t),r=new T(e,null,l++,!1);p.push(r),u=await o.next(s)}return Y(p,this._queryEngineParams).executeQueryForOpaqueFeatures(e,s)}async _getReadParams(e){const t=new Set;if(e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e]),returnGeometry:!!e.returnGeometry||!!e.geometry,where:e.where}}}function H(e){for(const t in e){const r=t;switch(r){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"objectIds":case"historicMoment":case"where":return null!=e[r]}}return!1}function Y(e,t){const r=new j;for(const s of e)r.insert(s);return new y({...t,featureStore:r})}function X(e,t){return e.statistics.statistics.get(t.fieldName)??null}function $(e,t){return e.slice().sort((e,r)=>{const s=K(e,t),i=K(r,t);return s===i?0:s<i?-1:1})}function K(e,t){const r=X(e,t);if(null==r)return Number.POSITIVE_INFINITY;const s=se(r.minValue),i=se(r.maxValue);return null==s||null==i||i<s?Number.POSITIVE_INFINITY:i-s}function ee(e,t){return{xStatistics:e.statistics.statistics.get(t.xFieldName)??null,yStatistics:e.statistics.statistics.get(t.yFieldName)??null}}function te(e,t){const r=se(e.minValue),s=se(e.maxValue);return null==r||null==s||t.intersects(r,s)}function re(e,t,r){const s=se(e.minValue),i=se(e.maxValue),a=se(t.minValue),n=se(t.maxValue);return null==s||null==i||null==a||null==n||r.intersects(s,i,a,n)}function se(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function ie(e){const t=e?.featureCount;let r=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{..._,maxRecordCount:z,supportsDistinct:r,supportsOrderBy:r,supportsStatistics:r,supportsSpatialAggregationStatistics:r,supportedSpatialAggregationStatistics:{envelope:r,centroid:r,convexHull:r}},queryAttributeBins:r?g:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function ae(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{L as default};
2
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as s}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as n,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{parseWhereClause as u}from"../../../../core/sql.js";import l from"../../../../geometry/SpatialReference.js";import{set as c,create as p,expandWithAABB as d,expandWithRect as f,negativeInfinity as m}from"../../../../geometry/support/aaBoundingBox.js";import{isWebMercator as y,isWGS84 as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getQueryResultExtent as g,getQueryBBoxes as _,QueryEngine as w}from"../../data/QueryEngine.js";import{queryCapabilities as x}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as F}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as S}from"../../data/queryUtils.js";import{createFileProvider as I}from"../parquet/createFileProvider.js";import{createDrawingInfo as v}from"./clientSideDefaults.js";import{getParquetFileId as q,getParquetRowId as R,getParquetObjectId as C}from"./parquetIdUtils.js";import b from"../../../support/Field.js";import E from"../../../support/FieldsIndex.js";import{isNumericField as O}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as T}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as Q,toParquetJSONGeometryType as j}from"../../../support/parquetUtils.js";import{loadParquetModule as N}from"../../../../libs/parquet/loadParquetModule.js";import{FeatureStoreQueryAdapter as A}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as M}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as D}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as G}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const z=new A,V=4,k="__OBJECTID",U=new TextDecoder,W=8e3,J=2e7,Z=8,L=2,H=20;class Y{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){a(e),await this._fill(e);const t=await X(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,null!=t.chunk)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<Z;){const t=this._getOrCreateNextStream(e);if(null==t)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){const t=this._resolvedCount>=Z?Z:L;if(this._fileIndex<this._files.length&&this._streams.length<t){const t=this._files[this._fileIndex++],s=new $(t.id,this._createFileStream(t,e));return this._streams.push(s),s}return this._getNextStream()}_getNextStream(){const e=this._streams.length;for(let t=0;t<e;t++){const s=(this._streamIndex+t)%e,r=this._streams[s];if(r.canRead)return this._streamIndex=(s+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function X(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class ${constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(e){this._readCount++;try{const t=await this._stream,s=await t.next(e);return null==s?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:s}}finally{this._readCount--}}}class K{constructor(){this._queue=new o({concurrency:V,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={}}async load(e){const t=e.spatialReference?l.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=e.customParameters,this._provider=I(e.provider,null,()=>this._customParameters);const s=await this._provider.getMetadata(),n=await P(s,{fields:e.fields?.map(e=>b.fromJSON(e)),geometryEncoding:e.geometryEncoding?T(e.geometryEncoding):null,geometryType:e.geometryType?Q(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(!n.fields)throw new r("parquet:unsupported","Fields must be defined");let a;if(n.spatialReference&&n.geometryType){if(!n.spatialReference)throw new r("parquet:unsupported","SpatialReference must be defined");if(!n.spatialReference.isGeographic&&!n.spatialReference.isWebMercator)throw new r("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");n.spatialReference.isGeographic&&!n.spatialReference.isWGS84&&(i.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:n.spatialReference}),n.spatialReference=l.WGS84),a={geometry:n.geometryEncoding?{geometryType:j(n.geometryType),spatialReference:n.spatialReference.toJSON(),encoding:n.geometryEncoding.toJSON()}:null,displayOptimization:n.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=n.displayOptimization,await this._provider.updateGeometryInfo(a),this._capabilities=he(await this._getFileStatistics());const o=await this._provider.getFiles();if(!o.length)return{layerDefinition:{},capabilities:he(null)};const u=await o[0].file;n.file=u;const{fields:c}=n;if(null==c)throw new r("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",c);c.push(new b({name:k,type:"oid",alias:k}));for(const r of c){const e=u.getColumnId(r.name);null!=e&&(this._indexMap[r.name]=e)}const p=new E(c.map(e=>e.toJSON()));this._fieldsIndex=p;const d=j(n.geometryType??"point");return this._metadata=D.createFeature({fieldsIndex:p.toJSON(),geometryType:d,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:n.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:d,featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:n.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=s?.extent?s.extent:await this._tryDeriveParquetFullExtent(n),{capabilities:this._capabilities,layerDefinition:{fields:n.fields?.map(e=>e.toJSON()),drawingInfo:v(d),extent:this._fullExtent??void 0,geometryType:d,geometryEncoding:n.geometryEncoding?.toJSON(),displayOptimization:n.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:e}of this._streams.values())e.remove();this._streams.clear()}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._provider=I(e,this._provider.getGeometryInfo(),()=>this._customParameters)}async queryFeatures(e,t){if(this._validateQuery(e),ge(e)||(e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,W):W,e.resultOffset=e.resultOffset??0),e.outStatistics)return this._queryStatistics(e,t);e.returnDistinctValues&&(e.returnGeometry=void 0);return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){const s=await S(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),!ee(s))return this._getFeatureCount();s.outFields=void 0,s.returnGeometry=void 0;return(await this._enqueueQuery(s,t)).createQueryResponseForCount()}async queryObjectIds(e,t){const s=await S(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),!ee(s))return Array.from({length:await this._getFeatureCount()},(e,t)=>t);s.resultRecordCount=s.resultRecordCount?Math.min(s.resultRecordCount,8e3):8e3,s.resultOffset=s.resultOffset??0,s.returnGeometry=void 0,s.outFields=void 0;return(await this._enqueueQuery(s,t)).items.map(e=>e.getObjectId())}async queryAttributeBins(e,t={}){throw new r("parquet:unsupported","queryAttributeBins not supported.")}async queryExtent(e,t){const r=await S(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!ee(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=s(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;const n=c(p(),m),a=p(),o=await this._enqueueQuery(r,t);let u=0;for(const s of o.items)s.getBounds(a)&&(d(n,a),u+=1);return{count:u,extent:g(n,i,r.outSR?s(r.outSR):i.toJSON(),i,!1)}}async queryStream(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const s=await this._getCandidateFiles(e),r=new Y(s,async(t,s)=>{const r=await t.file,i=await this._createParquetQuery(r,t.id,e);return r.executeQuery(i,s)}),i=this._streamIdCounter++,a=n(t.signal,e=>{const t=this._streams.get(i);null!=t&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const s=this._streams.get(e);if(!s)return{result:null};const r=await s.stream.next(t.signal);if(null==r)return s.handle.remove(),this._streams.delete(e),{result:null};const i=r.chunk.serialize().buffer,n={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:n,transferList:[i]}:{result:n}}async createPatch(e,t,s,r,i){if(!i.signal)throw new Error("InternalError: AbortSignal must be passed");const n=await this._getFileInfoById(e),a=await n.file;return(await a.createChunkPatch(t,s,r,i.signal)).serialize().buffer}async _getCandidateFiles(e){const t=await this._provider.getFiles(),s=await this._getSpatialFilePruning(e);if(null==s)return t;const r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,s));return"xz"===s.type?ce(r,s):r}async _queryStatistics(e,t){const s=await S({...e},null,this._queryEngineParams.spatialReference);if(s.returnGeometry=void 0,te(s,this._fieldsIndex)){const e=await this._getStatisticsFromFiles(s);if(e)return e}return(await this._enqueueQuery(s,t)).createQueryResponse()}async _getStatisticsFromFiles(e){const t=await this._provider.getFiles(),s={},r=[];for(const i of e.outStatistics??[]){const e=ie(i,t);if(!e.available)return null;s[i.outStatisticFieldName]=e.value,r.push(re(i,this._fieldsIndex))}return{fields:r,features:[{attributes:s}]}}async _getSpatialFilePruning(e){if("tile"!==e.type)return null;const t=this._displayOptimization,s=t?.index;if(null==s)return null;const r=e.outSpatialReference.wkid;if(null==s.wkid||null==r)return null;const i=s.wkid,n=await N();switch(s.type){case"xz":return{type:"xz",fieldName:s.code,intersects:(t,a)=>n.queryIntersectsXZStatistics(s.fullExtent,e.extent,r,i,H,t,a)};case"z":return{type:"xy",xFieldName:s.xColumn,yFieldName:s.yColumn,intersects:(t,s,a,o)=>n.queryIntersectsXYStatistics(e.extent,r,i,t,s,a,o)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case"xz":{const s=le(e,t);return null==s||fe(s,t)}case"xy":{const{xStatistics:s,yStatistics:r}=de(e,t);return null==s||null==r||me(s,r,t)}}}async _tryDeriveParquetFullExtent(s){if(!s.spatialReference)return null;if(null==this._fullExtent&&"location"===s.geometryEncoding?.type){const i=await this._provider.getFiles(),{xField:n,yField:a}=s.geometryEncoding,o=c(p(),m);for(const s of i){const i=await s.file;for(const s of i.rowGroups()){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,s.columnDescriptorForAttribute(n),!1),r=e(i,s.columnDescriptorForAttribute(a),!1),u=[t.minValue(),r.minValue(),t.maxValue(),r.maxValue()];f(o,u),s.free()}catch(r){i.error=r,i.hasError=!0}finally{t(i)}}}return{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:s.spatialReference?.toJSON()}}return null}async _getFileInfoById(e){const t=await this._provider.getFiles();for(const s of t)if(s.id===e)return s;throw new Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,s){const r=(await N()).Query.new();return"tile"===s.type&&(r.setExtent(s.extent),r.setQuantizationTransform(s.transform),r.setScale(s.scale)),r.setOutFields(s.outFields.filter(e=>null!=this._indexMap[e])),r.setOutSpatialReference(s.outSpatialReference.wkid),r.setReturnGeometry(s.returnGeometry),s.where&&await this._setWhereClause(r,e,t,s.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async _setWhereClause(e,t,s,i){const n=this._indexMap,a=this._fieldsIndex,o={getAttribute(e,r){const i=n[r];if(null==i){const t=a.get(r);if("__OBJECTID"===t?.name){const t=e.row+e.rowGroupStart;return C(s,t)}return null}const o=t.readAttribute(e.rowGroup,e.row,i);if(null==o)return null;const u=a.get(r);return"esriFieldTypeString"===u.type||"esriFieldTypeDateOnly"===u.type||"esriFieldTypeTimeOnly"===u.type||"esriFieldTypeTimestampOffset"===u.type?U.decode(o):o}},l=await u(i,this._fieldsIndex);if(!l.isStandardized)throw new r("sql-parse-error","expression is not standardized");const c=(e,t,s)=>l.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:s},o,null),p=l.fieldNames.map(e=>a.get(e)).filter(e=>e&&null!=this._indexMap[e?.name]);e.setWhere(i),e.setWhereEvaluator(c),e.setWhereFields(p.map(e=>e.name))}async*_queryChunks(e,t){const s=await N(),r=await this._provider.getFiles(),i=await this._getRequiredFields(e);for(const n of r){const r=await n.file,o=s.Query.new();o.setOutFields(i),o.setReturnGeometry(!!e.returnGeometry);const u=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=u.wkid;if(e.geometry&&(y(u)||h(u))){const t=p();for(const s of _(e.geometry))f(t,s);o.setOutSpatialReference(l),o.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}e.where&&await this._setWhereClause(o,r,n.id,e.where);const c=await r.executeQuery(o),d=[],m=c.next(t);for(let e=0;e<V;e++)d.push(c.next(t));let g=await m;for(;null!=g;){a(t);const e=new G(this._metadata,this._indexMap,g,n.id),s=ue([new B(e,null,0,!1)],this._queryEngineParams),r=d.shift();d.push(c.next(t)),yield s,g=await r}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){const s=new Map;for(const t of e.objectIds){const e=q(t),r=R(t);let i=s.get(e);i||(i=[],s.set(e,i)),i.push(r)}const r=[];for(const[i,n]of s.entries()){const s=await this._executeFileIdQuery(e,i,n,t);for(const e of s)r.push(e)}return new F(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:z,featureIdInfo:this._queryEngineParams.featureIdInfo})}let s=e.resultRecordCount??await this._getFeatureCount(),i=e.resultOffset??0;if(s>J)throw new r("parquet:cannot-execute-query","Unable to execute query, dataset is too large.");const n={...e};e.where=void 0,e.resultRecordCount=void 0,e.resultOffset=void 0;const a=[];for await(const r of this._queryChunks(n,t)){const n=await r.executeQueryForOpaqueFeatures(e,t);if(n.length>i){const t=n.slice(i,Math.min(i+s,n.length));for(const e of t)a.push(e);if(i=0,s-=t.length,0===s)return new F(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:z,featureIdInfo:this._queryEngineParams.featureIdInfo})}else i-=n.length}return new F(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:z,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,s,r){const i=await this._getRequiredFields(e),n=(await N()).Query.new();n.setOutFields(i),n.setReturnGeometry(!!e.returnGeometry),n.setIds(new Uint32Array(s));const a=await this._getFile(t),o=await a.executeQuery(n,r);let u=await o.next(r),l=0;const c=[];for(;null!=u;){const e=new G(this._metadata,this._indexMap,u,t),s=new B(e,null,l++,!1);c.push(s),u=await o.next(r)}return ue(c,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){const t=new Set;if(e.outStatistics)for(const s of e.outStatistics)null!=s.onStatisticField&&t.add(s.onStatisticField);else if(e.outFields)for(const s of e.outFields)t.add(s);return(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e])}}function ee(e){for(const t in e){const s=t;switch(s){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"objectIds":case"historicMoment":case"where":return null!=e[s]}}return!1}function te(e,t){return!!e.outStatistics?.length&&!ee(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>se(e,t))}function se(e,t){switch(e.statisticType){case"count":return"1"===e.onStatisticField||null!=t.get(e.onStatisticField);case"min":case"max":{const s=t.get(e.onStatisticField);return null!=s&&O(s)}default:return!1}}function re(e,t){const s="exceedslimit"!==e.statisticType?t.get(e.onStatisticField):null,r="min"!==e.statisticType&&"max"!==e.statisticType||"esriFieldTypeDate"!==s?.type?"esriFieldTypeDouble":s.type;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function ie(e,t){switch(e.statisticType){case"count":return ne(e,t);case"min":return ae(e,t,Math.min);case"max":return ae(e,t,Math.max);default:return{available:!1,value:null}}}function ne(e,t){if("count"!==e.statisticType)return{available:!1,value:null};if("1"===e.onStatisticField)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let s=0;for(const r of t){const t=r.statistics.statistics.get(e.onStatisticField);if(null==t||null==t.nullCount)return{available:!1,value:null};s+=r.statistics.rowCount-t.nullCount}return{available:!0,value:s}}function ae(e,t,s){if("min"!==e.statisticType&&"max"!==e.statisticType)return{available:!1,value:null};let r=null;const i="min"===e.statisticType?"minValue":"maxValue";for(const n of t){const t=n.statistics.statistics.get(e.onStatisticField);if(null==t)return{available:!1,value:null};const a=oe(t[i]);null!=a&&(r=null==r?a:s(r,a))}return{available:!0,value:r}}function oe(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function ue(e,t){const s=new M;for(const r of e)s.insert(r);return new w({...t,featureStore:s})}function le(e,t){return e.statistics.statistics.get(t.fieldName)??null}function ce(e,t){return e.slice().sort((e,s)=>{const r=pe(e,t),i=pe(s,t);return r===i?0:r<i?-1:1})}function pe(e,t){const s=le(e,t);if(null==s)return Number.POSITIVE_INFINITY;const r=ye(s.minValue),i=ye(s.maxValue);return null==r||null==i||i<r?Number.POSITIVE_INFINITY:i-r}function de(e,t){return{xStatistics:e.statistics.statistics.get(t.xFieldName)??null,yStatistics:e.statistics.statistics.get(t.yFieldName)??null}}function fe(e,t){const s=ye(e.minValue),r=ye(e.maxValue);return null==s||null==r||t.intersects(s,r)}function me(e,t,s){const r=ye(e.minValue),i=ye(e.maxValue),n=ye(t.minValue),a=ye(t.maxValue);return null==r||null==i||null==n||null==a||s.intersects(r,i,n,a)}function ye(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function he(e){const t=e?.featureCount;let s=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(s=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...x,maxRecordCount:W,supportsOrderBy:s,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function ge(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{K as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- function n(n){return n>>>24&255}function r(n){return 16777215&n}function t(n,r){return n<<24|r}export{n as getParquetFileId,t as getParquetObjectId,r as getParquetRowId};
2
+ const n=2**32,t=2**16;function r(r){return Math.floor(r/n)%t}function o(t){return t%n}function u(t,r){return t*n+r}export{r as getParquetFileId,u as getParquetObjectId,o as getParquetRowId};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e,equals as r,difference as a}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{updateOrigins as n}from"../../core/accessorSupport/originUtils.js";import{saveAs as s,save as o,getLayerJSON as l,getPortalItem as i,addItem as c,ensureLayerConfig as u,ensureItemConfig as y,setCommonItemProperties as p,createErrorMessage as f}from"./utils.js";import{parse as m}from"../support/arcgisLayerUrl.js";import{fetchFeatureService as d,getLayerModuleType as h}from"../support/fetchService.js";import{isLayerWithFeatureLayerSource as b}from"../support/layerUtils.js";import{createForItemWrite as w}from"../../portal/support/jsonContext.js";import{getWGS84ExtentForItem as T,toggleTypeKeyword as v,typeKeyword as L,removeTypeKeyword as S,hasTypeKeyword as I}from"../../portal/support/portalItemUtils.js";const g="Feature Service",E="feature-layer-utils",P=`${E}-save`,O=`${E}-save-as`,A=`${E}-saveall`,x=`${E}-saveall-as`;function j(e){return{isValid:b(e)&&(!("dynamicDataSource"in e)||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function N(e,r){const a=w(e,"portal-item");return r?.isTable&&(a.layerContainerType="tables"),a}function $(e){const r=N(e),a=N(e);return a.layerContainerType="tables",{forLayers:r,forTables:a}}function U(e){const r=[],a=[];for(const{layer:t,layerJSON:n}of e)R(t)?a.push(n):r.push(n);return{layers:r,tables:a}}function R(e,r){return e.isTable}function C(e){return U([e])}async function D(e,r){return/\/\d+\/?$/.test(e.url)?C(r[0]):F(r,e)}async function F(e,r){if(e.reverse(),!r)return U(e);const a=await J(r,e);for(const t of e)V(t.layer,t.layerJSON,a);return M(a,e),a}async function J(e,r){let a=await e.fetchData("json");if(G(a)&&!I(e,L.HOSTED_SERVICE))return a;a||={},_(a);const{layer:{url:t,customParameters:n,apiKey:s}}=r[0];return await B(a,{url:t??"",customParameters:n,apiKey:s},r.map(e=>e.layer.layerId)),a}function G(e){return!!(e&&Array.isArray(e.layers)&&Array.isArray(e.tables))}function _(e){e.layers||=[],e.tables||=[]}function M(e,r){const a=[],t=[];for(const{layer:n}of r){const{isTable:e,layerId:r}=n;e?t.push(r):a.push(r)}Y(e.layers,a),Y(e.tables,t)}function Y(e,a){if(e.length<2)return;const t=[];for(const{id:r}of e)t.push(r);r(t.sort(k),a.slice().sort(k))&&e.sort((e,r)=>{const t=a.indexOf(e.id),n=a.indexOf(r.id);return t<n?-1:t>n?1:0})}function k(e,r){return e<r?-1:e>r?1:0}async function B(e,r,a){const{url:t,customParameters:n,apiKey:s}=r,{serviceJSON:o,layersJSON:l}=await d(t,{customParameters:n,apiKey:s}),i=K(e.layers,o.layers,a),c=K(e.tables,o.tables,a);e.layers=i.itemResources,e.tables=c.itemResources;const u=[...i.added,...c.added],y=l?[...l.layers,...l.tables]:[];await z(e,u,t,y)}function K(e,r,t){const n=a(e,r,(e,r)=>e.id===r.id);e=e.filter(e=>!n.removed.some(r=>r.id===e.id));const s=n.added;return s.forEach(({id:r})=>{e.push({id:r})}),{itemResources:e,added:s.filter(({id:e})=>!t.includes(e))}}async function z(e,r,a,t){const n=await H(r),s=r.map(({id:e,type:r})=>new(n.get(r))({url:a,layerId:e,sourceJSON:t.find(({id:r})=>r===e)}));await Promise.allSettled(s.map(e=>e.load())),s.forEach(r=>{const{layerId:a,loaded:t,defaultPopupTemplate:n}=r;if(!t||null==n)return;const s={id:a,popupInfo:n.toJSON()};V(r,"ArcGISFeatureLayer"===r.operationalLayerType?s:{...s,layerType:r.operationalLayerType},e)})}async function H(e){const r=[];e.forEach(({type:e})=>{switch(h(e)){case"AnnotationLayer":r.push(import("../AnnotationLayer.js").then(e=>e.default));break;case"CatalogLayer":r.push(import("../CatalogLayer.js").then(e=>e.default));break;case"DimensionFeatureLayer":r.push(import("../DimensionFeatureLayer.js").then(e=>e.default));break;case"FeatureLayer":r.push(import("../FeatureLayer.js").then(e=>e.default));break;case"OrientedImageryLayer":r.push(import("../OrientedImageryLayer.js").then(e=>e.default))}});const a=await Promise.all(r),t=new Map;return e.forEach(({type:e},r)=>{t.set(e,a[r])}),t}function V(e,r,a){e.isTable?q(a.tables,r):q(a.layers,r)}function q(e,r){const a=e.findIndex(({id:e})=>e===r.id);-1===a?e.push(r):e[a]=r}function Q(e,r){if(!e.length)throw new t(`${r}:missing-parameters`,"'layers' array should contain at least one feature layer")}function W(e,r){const a=e.map(e=>e.portalItem.id);if(new Set(a).size>1)throw new t(`${r}:invalid-parameters`,"All layers in the 'layers' array should be loaded from the same portal item")}function X(e,r){const a=e.map(e=>e.layerId);if(new Set(a).size!==a.length)throw new t(`${r}:invalid-parameters`,"'layers' array should contain only one instance each of layer or table in a feature service")}async function Z(e){Q(e,A),await Promise.all(e.map(e=>e.load()));for(const r of e)u(r,A,j),y({layer:r,itemType:g,errorNamePrefix:A});W(e,A),X(e,A)}function ee(e){if(!("layerType"in e))return!!e.charts?.length;switch(e.layerType){case"OrientedImageryLayer":return!!e.charts?.length;case"SubtypeGroupLayer":return!!e.layers.some(e=>!!e.charts?.length);case"SubtypeGroupTable":return!!e.tables.some(e=>!!e.charts?.length);case"CatalogLayer":return!!e.footprintLayer?.charts?.length}}function re(e,r){let a=0,t=0,n=0,s=0;for(const o of[...r.layers,...r.tables])if(ee(o)&&s++,"layerType"in o)switch(o.layerType){case"OrientedImageryLayer":a++;break;case"SubtypeGroupLayer":t++;break;case"SubtypeGroupTable":n++}v(e,L.ORIENTED_IMAGERY_LAYER,a>0),v(e,L.SUBTYPE_GROUP_LAYER,t>0),v(e,L.SUBTYPE_GROUP_TABLE,n>0),v(e,L.CHARTS,s>0)}function ae(e,r,a){S(r,L.METADATA),v(r,L.MULTI_LAYER,e.length>1),v(r,L.SINGLE_LAYER,1===e.length),v(r,L.TABLE,a.tables.length>0&&0===a.layers.length),re(r,a)}function te(e,r,a){re(r,a)}async function ne(e,r,a){const{url:t,layerId:n,title:s,fullExtent:o,isTable:l}=e,i=m(t);r.url=("FeatureServer"===i?.serverType?t:`${t}/${n}`)??null,r.title||=s,r.extent=null,l||null==o||(r.extent=await T(o)),ae([e],r,a)}function se(e,r){for(const o of e){const a=o.parsedUrl.path,n=m(a),s=n?.url.path;if(!s)throw new t(`${r}:invalid-parameters`,f(o,`has unsupported url pattern: ${a}`),{layer:o});const l=n?.serverType;if("FeatureServer"!==l&&"MapServer"!==l)throw new t(`${r}:invalid-parameters`,f(o,`has unsupported server type: ${l}`),{layer:o});if("MapServer"===l&&e.length>1)throw new t(`${r}:invalid-parameters`,"Only one layer or table in a map service can be saved")}const a=m(e[0].parsedUrl.path),n=a?.url.path,s=e.every(e=>{const r=m(e.parsedUrl.path);return r?.url.path===n});if(!s)throw new t(`${r}:invalid-parameters`,"'layers' array should only contain layers or tables that belong to the same feature service")}async function oe(e){Q(e,x),await Promise.all(e.map(e=>e.load()));for(const r of e)u(r,x,j);se(e,x),X(e,x)}function le(e,r){re(e,r),p(e)}async function ie(r,a,t){let n=0;for(const{isTable:e}of r)e||n++;const s=r[0].parsedUrl.path,o=m(s);if(a.url="FeatureServer"===o?.serverType?o.url.path:s,a.title||=o.title,a.extent=null,n>0){const t=r.map(e=>e.fullExtent).filter(e).reduce((e,r)=>e.clone().union(r));t&&(a.extent=await T(t))}ae(r,a,t),p(a)}async function ce(e,r){return o({layer:e,itemType:g,validateLayer:j,createJSONContext:r=>N(r,e),createItemData:(e,r)=>D(r,[e]),errorNamePrefix:P,setItemProperties:te},r)}async function ue(e,r){await Z(e);const a=e[0].portalItem,t=$(a),s=await Promise.all(e.map(e=>l(e,e.isTable?t.forTables:t.forLayers,r))),o=await D(a,e.map((e,r)=>({layer:e,layerJSON:s[r]})));return le(a,o),await a.update({data:o}),await Promise.all(e.slice(1).map(e=>e.portalItem.reload())),n(t.forLayers),n(t.forTables),a.clone()}async function ye(e,r,a){return s({layer:e,itemType:g,validateLayer:j,createJSONContext:r=>N(r,e),createItemData:(e,r)=>Promise.resolve(C(e)),errorNamePrefix:O,newItem:r,setItemProperties:ne},a)}async function pe(e,r,a){await oe(e);const t=i({itemType:g,errorNamePrefix:x,newItem:r}),s=$(t),o=await Promise.all(e.map(e=>l(e,e.isTable?s.forTables:s.forLayers,a))),u=await F(e.map((e,r)=>({layer:e,layerJSON:o[r]})));await ie(e,t,u),await c(t,u,a);for(const n of e)n.portalItem=t.clone();return n(s.forLayers),n(s.forTables),t}export{ce as save,ue as saveAll,pe as saveAllAs,ye as saveAs};
2
+ import{isSome as e,equals as r,difference as a}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{updateOrigins as n}from"../../core/accessorSupport/originUtils.js";import{saveAs as s,save as o,getLayerJSON as l,getPortalItem as i,addItem as c,ensureLayerConfig as u,ensureItemConfig as y,setCommonItemProperties as p,createErrorMessage as f}from"./utils.js";import{parse as m}from"../support/arcgisLayerUrl.js";import{fetchFeatureService as d,getLayerModuleType as h}from"../support/fetchService.js";import{isLayerWithFeatureLayerSource as b}from"../support/layerUtils.js";import{createForItemWrite as w}from"../../portal/support/jsonContext.js";import{getWGS84ExtentForItem as T,toggleTypeKeyword as v,typeKeyword as L,removeTypeKeyword as S,hasTypeKeyword as I}from"../../portal/support/portalItemUtils.js";const g="Feature Service",E="feature-layer-utils",P=`${E}-save`,O=`${E}-save-as`,A=`${E}-saveall`,x=`${E}-saveall-as`;function j(e){return{isValid:b(e)&&(!("dynamicDataSource"in e)||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function N(e,r){const a=w(e,"portal-item");return r?.isTable&&(a.layerContainerType="tables"),a}function $(e){const r=N(e),a=N(e);return a.layerContainerType="tables",{forLayers:r,forTables:a}}function U(e){const r=[],a=[];for(const{layer:t,layerJSON:n}of e)R(t)?a.push(n):r.push(n);return{layers:r,tables:a}}function R(e,r){return e.isTable}function F(e){return U([e])}async function C(e,r){return/\/\d+\/?$/.test(e.url)?F(r[0]):D(r,e)}async function D(e,r){if(e.reverse(),!r)return U(e);const a=await J(r,e);for(const t of e)V(t.layer,t.layerJSON,a);return M(a,e),a}async function J(e,r){let a=await e.fetchData("json");if(G(a)&&!I(e,L.HOSTED_SERVICE))return a;a||={},_(a);const{layer:{url:t,customParameters:n,apiKey:s}}=r[0];return await B(a,{url:t??"",customParameters:n,apiKey:s},r.map(e=>e.layer.layerId)),a}function G(e){return!!(e&&Array.isArray(e.layers)&&Array.isArray(e.tables))}function _(e){e.layers||=[],e.tables||=[]}function M(e,r){const a=[],t=[];for(const{layer:n}of r){const{isTable:e,layerId:r}=n;e?t.push(r):a.push(r)}Y(e.layers,a),Y(e.tables,t)}function Y(e,a){if(e.length<2)return;const t=[];for(const{id:r}of e)t.push(r);r(t.sort(k),a.slice().sort(k))&&e.sort((e,r)=>{const t=a.indexOf(e.id),n=a.indexOf(r.id);return t<n?-1:t>n?1:0})}function k(e,r){return e<r?-1:e>r?1:0}async function B(e,r,a){const{url:t,customParameters:n,apiKey:s}=r,{serviceJSON:o,layersJSON:l}=await d(t,{customParameters:n,apiKey:s}),i=K(e.layers,o.layers,a),c=K(e.tables,o.tables,a);e.layers=i.itemResources,e.tables=c.itemResources;const u=[...i.added,...c.added],y=l?[...l.layers,...l.tables]:[];await z(e,u,t,y)}function K(e,r,t){const n=a(e,r,(e,r)=>e.id===r.id);e=e.filter(e=>!n.removed.some(r=>r.id===e.id));const s=n.added;return s.forEach(({id:r})=>{e.push({id:r})}),{itemResources:e,added:s.filter(({id:e})=>!t.includes(e))}}async function z(e,r,a,t){const n=await H(r),s=r.map(({id:e,type:r})=>new(n.get(r))({url:a,layerId:e,sourceJSON:t.find(({id:r})=>r===e)}));await Promise.allSettled(s.map(e=>e.load())),s.forEach(r=>{const{layerId:a,loaded:t,defaultPopupTemplate:n}=r;if(!t||null==n)return;const s={id:a,popupInfo:n.toJSON()};V(r,"ArcGISFeatureLayer"===r.operationalLayerType?s:{...s,layerType:r.operationalLayerType},e)})}async function H(e){const r=[];e.forEach(({type:e})=>{switch(h(e)){case"AnnotationFeatureLayer":r.push(import("../AnnotationFeatureLayer.js").then(e=>e.default));break;case"CatalogLayer":r.push(import("../CatalogLayer.js").then(e=>e.default));break;case"DimensionFeatureLayer":r.push(import("../DimensionFeatureLayer.js").then(e=>e.default));break;case"FeatureLayer":r.push(import("../FeatureLayer.js").then(e=>e.default));break;case"OrientedImageryLayer":r.push(import("../OrientedImageryLayer.js").then(e=>e.default))}});const a=await Promise.all(r),t=new Map;return e.forEach(({type:e},r)=>{t.set(e,a[r])}),t}function V(e,r,a){e.isTable?q(a.tables,r):q(a.layers,r)}function q(e,r){const a=e.findIndex(({id:e})=>e===r.id);-1===a?e.push(r):e[a]=r}function Q(e,r){if(!e.length)throw new t(`${r}:missing-parameters`,"'layers' array should contain at least one feature layer")}function W(e,r){const a=e.map(e=>e.portalItem.id);if(new Set(a).size>1)throw new t(`${r}:invalid-parameters`,"All layers in the 'layers' array should be loaded from the same portal item")}function X(e,r){const a=e.map(e=>e.layerId);if(new Set(a).size!==a.length)throw new t(`${r}:invalid-parameters`,"'layers' array should contain only one instance each of layer or table in a feature service")}async function Z(e){Q(e,A),await Promise.all(e.map(e=>e.load()));for(const r of e)u(r,A,j),y({layer:r,itemType:g,errorNamePrefix:A});W(e,A),X(e,A)}function ee(e){if(!("layerType"in e))return!!e.charts?.length;switch(e.layerType){case"OrientedImageryLayer":return!!e.charts?.length;case"SubtypeGroupLayer":return!!e.layers.some(e=>!!e.charts?.length);case"SubtypeGroupTable":return!!e.tables.some(e=>!!e.charts?.length);case"CatalogLayer":return!!e.footprintLayer?.charts?.length}}function re(e,r){let a=0,t=0,n=0,s=0;for(const o of[...r.layers,...r.tables])if(ee(o)&&s++,"layerType"in o)switch(o.layerType){case"OrientedImageryLayer":a++;break;case"SubtypeGroupLayer":t++;break;case"SubtypeGroupTable":n++}v(e,L.ORIENTED_IMAGERY_LAYER,a>0),v(e,L.SUBTYPE_GROUP_LAYER,t>0),v(e,L.SUBTYPE_GROUP_TABLE,n>0),v(e,L.CHARTS,s>0)}function ae(e,r,a){S(r,L.METADATA),v(r,L.MULTI_LAYER,e.length>1),v(r,L.SINGLE_LAYER,1===e.length),v(r,L.TABLE,a.tables.length>0&&0===a.layers.length),re(r,a)}function te(e,r,a){re(r,a)}async function ne(e,r,a){const{url:t,layerId:n,title:s,fullExtent:o,isTable:l}=e,i=m(t);r.url=("FeatureServer"===i?.serverType?t:`${t}/${n}`)??null,r.title||=s,r.extent=null,l||null==o||(r.extent=await T(o)),ae([e],r,a)}function se(e,r){for(const o of e){const a=o.parsedUrl.path,n=m(a),s=n?.url.path;if(!s)throw new t(`${r}:invalid-parameters`,f(o,`has unsupported url pattern: ${a}`),{layer:o});const l=n?.serverType;if("FeatureServer"!==l&&"MapServer"!==l)throw new t(`${r}:invalid-parameters`,f(o,`has unsupported server type: ${l}`),{layer:o});if("MapServer"===l&&e.length>1)throw new t(`${r}:invalid-parameters`,"Only one layer or table in a map service can be saved")}const a=m(e[0].parsedUrl.path),n=a?.url.path,s=e.every(e=>{const r=m(e.parsedUrl.path);return r?.url.path===n});if(!s)throw new t(`${r}:invalid-parameters`,"'layers' array should only contain layers or tables that belong to the same feature service")}async function oe(e){Q(e,x),await Promise.all(e.map(e=>e.load()));for(const r of e)u(r,x,j);se(e,x),X(e,x)}function le(e,r){re(e,r),p(e)}async function ie(r,a,t){let n=0;for(const{isTable:e}of r)e||n++;const s=r[0].parsedUrl.path,o=m(s);if(a.url="FeatureServer"===o?.serverType?o.url.path:s,a.title||=o.title,a.extent=null,n>0){const t=r.map(e=>e.fullExtent).filter(e).reduce((e,r)=>e.clone().union(r));t&&(a.extent=await T(t))}ae(r,a,t),p(a)}async function ce(e,r){return o({layer:e,itemType:g,validateLayer:j,createJSONContext:r=>N(r,e),createItemData:(e,r)=>C(r,[e]),errorNamePrefix:P,setItemProperties:te},r)}async function ue(e,r){await Z(e);const a=e[0].portalItem,t=$(a),s=await Promise.all(e.map(e=>l(e,e.isTable?t.forTables:t.forLayers,r))),o=await C(a,e.map((e,r)=>({layer:e,layerJSON:s[r]})));return le(a,o),await a.update({data:o}),await Promise.all(e.slice(1).map(e=>e.portalItem.reload())),n(t.forLayers),n(t.forTables),a.clone()}async function ye(e,r,a){return s({layer:e,itemType:g,validateLayer:j,createJSONContext:r=>N(r,e),createItemData:(e,r)=>Promise.resolve(F(e)),errorNamePrefix:O,newItem:r,setItemProperties:ne},a)}async function pe(e,r,a){await oe(e);const t=i({itemType:g,errorNamePrefix:x,newItem:r}),s=$(t),o=await Promise.all(e.map(e=>l(e,e.isTable?s.forTables:s.forLayers,a))),u=await D(e.map((e,r)=>({layer:e,layerJSON:o[r]})));await ie(e,t,u),await c(t,u,a);for(const n of e)n.portalItem=t.clone();return n(s.forLayers),n(s.forTables),t}export{ce as save,ue as saveAll,pe as saveAllAs,ye as saveAs};