@arcgis/core 5.2.0-next.27 → 5.2.0-next.29

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 (418) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/WebMap.js +1 -1
  3. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +40 -2
  4. package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
  5. package/arcade/Dictionary.js +1 -1
  6. package/arcade/Feature.js +1 -1
  7. package/arcade/Pixel.js +1 -1
  8. package/arcade/deepClone.js +1 -1
  9. package/arcade/featureset/support/FeatureSet.js +1 -1
  10. package/arcade/functions/geometry.js +1 -1
  11. package/arcade/languageUtils.js +1 -1
  12. package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
  13. package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
  14. package/assets/esri/core/workers/RemoteClient.js +1 -1
  15. package/assets/esri/core/workers/chunks/0197e459fdb04dfb28ef.js +1 -0
  16. package/assets/esri/core/workers/chunks/{f7344d855f1092383abe.js → 15aa9b85976069acf4f3.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{5ee887fc6e1e0e70e02f.js → 1664434dc7a67c8ce453.js} +1 -1
  18. package/assets/esri/core/workers/chunks/17b98787a0698f584882.js +1 -0
  19. package/assets/esri/core/workers/chunks/1837f97f720d255a1694.js +1 -0
  20. package/assets/esri/core/workers/chunks/1b9c68e8431bb4608209.js +1 -0
  21. package/assets/esri/core/workers/chunks/1bbf5f5da5842b93f638.js +1 -0
  22. package/assets/esri/core/workers/chunks/1bd7b7f4ee7ea6cb7ef9.js +1 -0
  23. package/assets/esri/core/workers/chunks/1e386475937e02b3f523.js +1 -0
  24. package/assets/esri/core/workers/chunks/209460f8aae3f9f8c9b8.js +1 -0
  25. package/assets/esri/core/workers/chunks/{316a3d5c7842b445e29e.js → 20ffeb09bb30400de110.js} +1 -1
  26. package/assets/esri/core/workers/chunks/21122f3f3e19a7fd7d33.js +1 -0
  27. package/assets/esri/core/workers/chunks/{25fd4d5d3af887536b3b.js → 2628136bf9f47d238a24.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{bf9eca7dd107bdb06614.js → 2665337e1b665e7e2b70.js} +1 -1
  29. package/assets/esri/core/workers/chunks/2b044c8fab2055a8818d.js +1 -0
  30. package/assets/esri/core/workers/chunks/2b2b042a6d6949b06127.js +1 -0
  31. package/assets/esri/core/workers/chunks/2c15c227d057292d4fa8.js +1 -0
  32. package/assets/esri/core/workers/chunks/2f02880a7f081eb210cd.js +1 -0
  33. package/assets/esri/core/workers/chunks/2fc3e43b64300014dddc.js +1 -0
  34. package/assets/esri/core/workers/chunks/{31c4128b23968575feca.js → 31d92ba9089617aa59ab.js} +1 -1
  35. package/assets/esri/core/workers/chunks/32740b075d7a890d7888.js +1 -0
  36. package/assets/esri/core/workers/chunks/38b69fba9ae4ccbae6b7.js +1 -0
  37. package/assets/esri/core/workers/chunks/390f2beee8e3f2a302e4.js +1 -0
  38. package/assets/esri/core/workers/chunks/3c342e662c13a05f4caf.js +1 -0
  39. package/assets/esri/core/workers/chunks/{d670e134348954ce465d.js → 3d1e5bfd88771d4a0bf6.js} +1 -1
  40. package/assets/esri/core/workers/chunks/3eee32db0e9a5086b9a8.js +1 -0
  41. package/assets/esri/core/workers/chunks/43847d66726fd0bcbbb7.js +1 -0
  42. package/assets/esri/core/workers/chunks/4545cf12ad0824ce6b41.js +1 -0
  43. package/assets/esri/core/workers/chunks/45e4b9069263adeae394.js +1 -0
  44. package/assets/esri/core/workers/chunks/47290f27375c76bcc9c7.js +1 -0
  45. package/assets/esri/core/workers/chunks/{4e16d7fa2e6f11d082b5.js → 4ba4fd8fa31169760fee.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{268ee59800e64baa9682.js → 4be0c64bbf2449d57ea5.js} +1 -1
  47. package/assets/esri/core/workers/chunks/5115059b012ef84407cf.js +1 -0
  48. package/assets/esri/core/workers/chunks/{e8e7cd26c43f231cdea2.js → 5189413a83faf3480e29.js} +1 -1
  49. package/assets/esri/core/workers/chunks/5c63b38160c7d063b8af.js +1 -0
  50. package/assets/esri/core/workers/chunks/5cccb8b06014ccef30f8.js +1 -0
  51. package/assets/esri/core/workers/chunks/{0098544169e429dd98d2.js → 689673173ca1c0e098fe.js} +1 -1
  52. package/assets/esri/core/workers/chunks/697e0ce10d77b90d4fee.js +1 -0
  53. package/assets/esri/core/workers/chunks/6991ba1b204668e7d4da.js +1 -0
  54. package/assets/esri/core/workers/chunks/{ccffaba50674adba7a0f.js → 6b56971783bf4c31a563.js} +1 -1
  55. package/assets/esri/core/workers/chunks/70c94bcfa20453134037.js +1 -0
  56. package/assets/esri/core/workers/chunks/{8f93e6fc11a158d4f1ee.js → 7335a762412bc8c15a2f.js} +1 -1
  57. package/assets/esri/core/workers/chunks/759686b896f51f0fe6a9.js +1 -0
  58. package/assets/esri/core/workers/chunks/7656900713e55036c3c1.js +1 -0
  59. package/assets/esri/core/workers/chunks/{b2b342b06d502fc61ea5.js → 76789f46b2c65d219cf9.js} +1 -1
  60. package/assets/esri/core/workers/chunks/774615303c1cc9a77e20.js +1 -0
  61. package/assets/esri/core/workers/chunks/7b290ac2e8a567ecae4a.js +1 -0
  62. package/assets/esri/core/workers/chunks/7ff37a4f315f7621462b.js +1 -0
  63. package/assets/esri/core/workers/chunks/8ad5e80e911419c1685a.js +1 -0
  64. package/assets/esri/core/workers/chunks/{a3ecde3794a7db3cf283.js → 8d90bef1091204fba0f1.js} +1 -1
  65. package/assets/esri/core/workers/chunks/8f16a358ed83d2264415.js +1 -0
  66. package/assets/esri/core/workers/chunks/{a454df829a72ab02c860.js → 8fd63cb38036f331a803.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{bbcad2fde838819ffc7b.js → 906f4c0fa8135e6c2f03.js} +1 -1
  68. package/assets/esri/core/workers/chunks/989937c120bdd676ec1e.js +1 -0
  69. package/assets/esri/core/workers/chunks/9ba705a6ddabca0f77b1.js +1 -0
  70. package/assets/esri/core/workers/chunks/{87011d2fe14c54e296af.js → 9fe71d49c888fd871312.js} +1 -1
  71. package/assets/esri/core/workers/chunks/a14e5607c5c091c77e3d.js +1 -0
  72. package/assets/esri/core/workers/chunks/a2be8784f2cfdbb42681.js +1 -0
  73. package/assets/esri/core/workers/chunks/a6379a8df8c08b729b9c.js +1 -0
  74. package/assets/esri/core/workers/chunks/a988fd54912969b812ce.js +1 -0
  75. package/assets/esri/core/workers/chunks/a9db775210ebeee41738.js +1 -0
  76. package/assets/esri/core/workers/chunks/acbc14395c31f6da509e.js +1 -0
  77. package/assets/esri/core/workers/chunks/{11d1af758e2140095b10.js → aec82b94787821153d2b.js} +1 -1
  78. package/assets/esri/core/workers/chunks/b18b6bb85e52b03b85e3.js +680 -0
  79. package/assets/esri/core/workers/chunks/b624796ff4a9d4c406bf.js +1 -0
  80. package/assets/esri/core/workers/chunks/b7458bd3a2f590f32111.js +1 -0
  81. package/assets/esri/core/workers/chunks/bb1fad01d9f070e7d795.js +1 -0
  82. package/assets/esri/core/workers/chunks/{a9d477f90e5046400dd5.js → bcb2092c87d8d21c6458.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{3e94ed4d57ee7d870cba.js → c6f5688074ae89c37add.js} +1 -1
  84. package/assets/esri/core/workers/chunks/caf150028aeac91b8d80.js +1 -0
  85. package/assets/esri/core/workers/chunks/cb30e8a66d6dcfebd439.js +1 -0
  86. package/assets/esri/core/workers/chunks/d7c0ab622caf495dbcef.js +1 -0
  87. package/assets/esri/core/workers/chunks/e181d0f5562878b3dc01.js +1 -0
  88. package/assets/esri/core/workers/chunks/{fd629872b5c07853f695.js → e4015870412edd69453c.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{d07068c44d560e4ce02e.js → e5d2fab228d54b18a8a8.js} +1 -1
  90. package/assets/esri/core/workers/chunks/e774303efefee31952d0.js +1 -0
  91. package/assets/esri/core/workers/chunks/e98a8f80023c6023e72c.js +1 -0
  92. package/assets/esri/core/workers/chunks/f10a339b16d84b650012.js +2 -0
  93. package/assets/esri/core/workers/chunks/f1d211904d5a1de93cb3.js +1 -0
  94. package/assets/esri/core/workers/chunks/f847a4846c427f671455.js +1 -0
  95. package/assets/esri/core/workers/chunks/fe42fa2144691b9186fd.js +1 -0
  96. package/assets/esri/images/portal/gaussiansplatlayer16.png +0 -0
  97. package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
  98. package/assets/esri/images/portal/propresentation16.png +0 -0
  99. package/assets/esri/images/portal/urbanproject16.png +0 -0
  100. package/assets/esri/images/support/loading-throb.gif +0 -0
  101. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  102. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  103. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  104. package/assets/esri/themes/base/icons/style.scss +0 -0
  105. package/assets/esri/themes/base/icons/variables.scss +0 -0
  106. package/assets/esri/themes/base/images/files/archive-32.svg +0 -0
  107. package/assets/esri/themes/base/images/files/cad-32.svg +0 -0
  108. package/assets/esri/themes/base/images/files/code-32.svg +0 -0
  109. package/assets/esri/themes/base/images/files/csv-32.svg +0 -0
  110. package/assets/esri/themes/base/images/files/excel-32.svg +0 -0
  111. package/assets/esri/themes/base/images/files/generic-32.svg +0 -0
  112. package/assets/esri/themes/base/images/files/gpx-32.svg +0 -0
  113. package/assets/esri/themes/base/images/files/image-32.svg +0 -0
  114. package/assets/esri/themes/base/images/files/pdf-32.svg +0 -0
  115. package/assets/esri/themes/base/images/files/report-32.svg +0 -0
  116. package/assets/esri/themes/base/images/files/sound-32.svg +0 -0
  117. package/assets/esri/themes/base/images/files/text-32.svg +0 -0
  118. package/assets/esri/themes/base/images/files/video-32.svg +0 -0
  119. package/assets/esri/themes/base/images/files/word-32.svg +0 -0
  120. package/assets/esri/themes/base/images/files/zip-32.svg +0 -0
  121. package/assets/esri/themes/base/images/loading-throb.gif +0 -0
  122. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +24 -0
  123. package/assets/esri/themes/base/widgets/_Bookmarks.scss +0 -0
  124. package/assets/esri/themes/dark/main.css +1 -1
  125. package/assets/esri/themes/light/main.css +1 -1
  126. package/assets/esri/themes/light/view.css +1 -1
  127. package/chunks/GlowComposition.glsl.js +5 -5
  128. package/chunks/OITBlend.glsl.js +1 -1
  129. package/chunks/languageUtils.js +1 -1
  130. package/config.js +1 -1
  131. package/core/AsyncUpdate.js +1 -1
  132. package/core/Loadable.js +1 -1
  133. package/core/colorUtils.js +1 -1
  134. package/core/date.js +1 -1
  135. package/core/has.js +1 -1
  136. package/core/workers/WorkerHandle.js +1 -1
  137. package/core/workers/workerFactory.js +1 -1
  138. package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
  139. package/form/elements/AttachmentElement.d.ts +4 -1
  140. package/form/elements/inputs/attachments/AttachmentInput.d.ts +1 -0
  141. package/form/elements/inputs/attachments/AudioInput.d.ts +1 -0
  142. package/form/elements/inputs/attachments/DocumentInput.d.ts +3 -0
  143. package/form/elements/inputs/attachments/ImageInput.d.ts +1 -0
  144. package/form/elements/inputs/attachments/VideoInput.d.ts +1 -0
  145. package/geometry/Mesh.js +1 -1
  146. package/geometry/support/meshUtils/loadExternal.js +1 -1
  147. package/identity/OAuthCredential.js +1 -1
  148. package/kernel.js +1 -1
  149. package/layers/AnnotationFeatureLayer.d.ts +2 -4
  150. package/layers/AnnotationFeatureLayer.js +1 -1
  151. package/layers/DimensionFeatureLayer.d.ts +0 -2
  152. package/layers/DimensionFeatureLayer.js +1 -1
  153. package/layers/LinkChartLayer.js +1 -1
  154. package/layers/ParquetLayer.js +1 -1
  155. package/layers/PointCloudLayer.js +1 -1
  156. package/layers/SceneLayer.js +1 -1
  157. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  158. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  159. package/layers/graphics/editingSupport.js +1 -1
  160. package/layers/graphics/sources/MemorySource.js +1 -1
  161. package/layers/graphics/sources/ParquetSource.js +1 -1
  162. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  163. package/layers/mixins/EditBusLayer.js +1 -1
  164. package/layers/mixins/SceneService.js +1 -1
  165. package/layers/support/KMLSublayer.js +1 -1
  166. package/layers/support/ParquetFilesData.js +1 -1
  167. package/layers/support/TitleCreator.js +1 -1
  168. package/layers/support/featureLayerUtils.js +1 -1
  169. package/layers/support/parquetUtils.js +1 -1
  170. package/linkChart/guards.js +2 -0
  171. package/linkChart/utils.js +1 -1
  172. package/networks/CircuitManager.d.ts +44 -0
  173. package/networks/support/CircuitExportJobInfo.d.ts +1 -1
  174. package/networks/support/CircuitVerifyJobInfo.d.ts +1 -1
  175. package/networks/support/jsonTypes.d.ts +2 -0
  176. package/package.json +5 -5
  177. package/rest/featureService/types.d.ts +4 -7
  178. package/rest/knowledgeGraph/ReplicaDefinition.d.ts +62 -6
  179. package/rest/networks/circuits/support/CircuitVerifyResult.d.ts +1 -1
  180. package/rest/networks/circuits/support/ExportCircuitsParameters.d.ts +1 -1
  181. package/rest/networks/circuits/support/VerifyCircuitsParameters.d.ts +17 -3
  182. package/rest/networks/unitIdentifiers/support/UnitQueryResult.d.ts +1 -1
  183. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  184. package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
  185. package/support/ArcadeExpression.js +1 -1
  186. package/support/basemapUtils.js +1 -1
  187. package/support/revision.js +1 -1
  188. package/symbols/cim/CIMOperators.js +1 -1
  189. package/symbols/cim/utils.js +1 -1
  190. package/symbols/support/cimSymbolUtils.js +1 -1
  191. package/versionManagement/VersionManagementService.js +1 -1
  192. package/versionManagement/VersionManager.js +1 -1
  193. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  194. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  195. package/views/2d/engine/ParentChildStage.js +1 -1
  196. package/views/2d/engine/Stage.js +1 -1
  197. package/views/2d/engine/ThrottledCanvas.js +2 -0
  198. package/views/2d/engine/webgl/Profiler.js +1 -1
  199. package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
  200. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  201. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  202. package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
  203. package/views/2d/engine/webgl/util/DictionaryMatcher.js +1 -1
  204. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  205. package/views/2d/engine/webgl/util/IntervalMatcher.js +1 -1
  206. package/views/2d/engine/webgl/util/LabelMatcher.js +1 -1
  207. package/views/2d/engine/webgl/util/MapMatcher.js +1 -1
  208. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  209. package/views/2d/engine/webgl/util/createMatcher.js +1 -1
  210. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  211. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  212. package/views/2d/layers/LayerView2D.js +1 -1
  213. package/views/2d/layers/MediaLayerView2D.js +1 -1
  214. package/views/2d/layers/TileLayerView2D.js +1 -1
  215. package/views/2d/layers/features/Processor.js +1 -1
  216. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  217. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  218. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  219. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  220. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  221. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  222. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  223. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  224. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  225. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  226. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  227. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  228. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  229. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  230. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  231. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  232. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  233. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  234. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  235. package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +2 -0
  236. package/views/2d/layers/support/annodime/PrivateDimensionEffect.js +1 -1
  237. package/views/2d/layers/support/annodime/PrivateMatcherGeometryOverrideEffect.js +2 -0
  238. package/views/2d/layers/support/annodime/TileObjectId.js +2 -0
  239. package/views/2d/layers/support/annodime/annotationGraphic.js +1 -1
  240. package/views/2d/layers/support/annodime/debugUtils.js +2 -0
  241. package/views/2d/layers/support/annodime/dimensionStyleDefaults.js +2 -0
  242. package/views/2d/layers/support/annodime/dimensionSymbols.js +1 -1
  243. package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
  244. package/views/2d/layers/support/annodime/utils.js +1 -1
  245. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  246. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  247. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  248. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  249. package/views/3d/camera/constraintUtils.js +1 -1
  250. package/views/3d/glTF/internal/Resource.js +1 -1
  251. package/views/3d/glTF/loader.js +1 -1
  252. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  253. package/views/3d/layers/I3SMeshView3D.js +1 -1
  254. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  255. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  256. package/views/3d/layers/SceneLayerWorkerHandle.js +1 -1
  257. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  258. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  259. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  260. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  261. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  262. package/views/3d/state/GoToOperation.js +1 -1
  263. package/views/3d/state/SurfaceCollisionConstraint.js +1 -1
  264. package/views/3d/state/ViewState.js +1 -1
  265. package/views/3d/state/ViewStateManager.js +1 -1
  266. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  267. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  268. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  269. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  270. package/views/3d/webgl/ManagedFBO.js +1 -1
  271. package/views/3d/webgl/RenderCamera.js +1 -1
  272. package/views/3d/webgl/RenderNode.js +1 -1
  273. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  274. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  275. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  276. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  277. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  278. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  279. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  280. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  281. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  282. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  283. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  284. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  285. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  286. package/views/3d/webgl-engine/effects/transparency/OITBlendTechniqueConfiguration.js +1 -1
  287. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  288. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  289. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  290. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  291. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  292. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  293. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  294. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  295. package/views/3d/webgl.js +1 -1
  296. package/views/VideoView.js +1 -1
  297. package/views/View2D.js +1 -1
  298. package/views/Viewport2DBaseMixin.js +1 -1
  299. package/views/analysis/ElevationProfile/ElevationProfileLineGroundComputation.js +1 -1
  300. package/views/draw/DrawTool.js +1 -1
  301. package/views/draw/support/editingSessionUtils.js +1 -1
  302. package/views/interactive/sketch/SketchLabelOptions.d.ts +0 -6
  303. package/views/layers/AnnotationFeatureLayerView.d.ts +0 -7
  304. package/views/layers/DimensionFeatureLayerView.d.ts +0 -7
  305. package/views/popupAdapter.js +1 -1
  306. package/views/support/LayerViewManager.js +1 -1
  307. package/views/webgl/BufferObject.js +1 -1
  308. package/webdoc/support/webdocSaveUtils.js +1 -1
  309. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  310. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  311. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  312. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  313. package/widgets/BatchAttributeForm/css.js +1 -1
  314. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  315. package/widgets/BatchAttributeForm/interfaceUtils.js +1 -1
  316. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  317. package/widgets/BatchAttributeForm.js +1 -1
  318. package/widgets/Directions/DirectionsViewModel.js +1 -1
  319. package/widgets/Directions.js +1 -1
  320. package/widgets/Editor/EditorViewModel.d.ts +1 -13
  321. package/widgets/Editor.d.ts +11 -13
  322. package/widgets/Editor.js +1 -1
  323. package/widgets/Feature/FeatureViewModel.js +1 -1
  324. package/widgets/Feature.js +1 -1
  325. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  326. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  327. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  328. package/widgets/FeatureTable.js +1 -1
  329. package/widgets/Features/FeaturesViewModel.js +1 -1
  330. package/widgets/Features.js +1 -1
  331. package/widgets/LayerList/LayerListViewModel.js +1 -1
  332. package/widgets/LinkChartLayoutSwitcher/LinkChartLayoutSwitcherViewModel.js +1 -1
  333. package/widgets/Locate/LocateViewModel.js +1 -1
  334. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  335. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
  336. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  337. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  338. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  339. package/widgets/OrientedImageryViewer/support/MediaPrefetcher.js +1 -1
  340. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  341. package/widgets/Popup/PopupViewModel.d.ts +0 -1
  342. package/widgets/Popup/PopupViewModel.js +1 -1
  343. package/widgets/Popup.js +1 -1
  344. package/widgets/Print/PrintViewModel.js +1 -1
  345. package/widgets/Print.js +1 -1
  346. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  347. package/widgets/Sketch/SketchViewModel.d.ts +0 -12
  348. package/widgets/Sketch.d.ts +0 -12
  349. package/widgets/TableList/ListItem.js +1 -1
  350. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  351. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  352. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  353. package/widgets/Widget.js +1 -1
  354. package/widgets/support/geolocationUtils.js +1 -1
  355. package/widgets/support/tests.js +1 -1
  356. package/assets/esri/core/workers/chunks/04070767356c12026369.js +0 -1
  357. package/assets/esri/core/workers/chunks/045f178fecc23839bfa8.js +0 -680
  358. package/assets/esri/core/workers/chunks/073ee52705ea326fecfb.js +0 -1
  359. package/assets/esri/core/workers/chunks/0e81b6aa64d5491870b2.js +0 -1
  360. package/assets/esri/core/workers/chunks/126a8c26618425790804.js +0 -1
  361. package/assets/esri/core/workers/chunks/1a7c0a1dc6ecc93ea03a.js +0 -1
  362. package/assets/esri/core/workers/chunks/1cb1f125dccbf8c8cac9.js +0 -1
  363. package/assets/esri/core/workers/chunks/1f03e34520746e432719.js +0 -1
  364. package/assets/esri/core/workers/chunks/292498a9c7d462d215c6.js +0 -1
  365. package/assets/esri/core/workers/chunks/2ed81f1e490cb7e73405.js +0 -1
  366. package/assets/esri/core/workers/chunks/32f26757e36704923286.js +0 -1
  367. package/assets/esri/core/workers/chunks/33e86dd1a54e447fa0e3.js +0 -1
  368. package/assets/esri/core/workers/chunks/35c87b0a4d4ee7ce302d.js +0 -1
  369. package/assets/esri/core/workers/chunks/36b904912cea1744d1c6.js +0 -1
  370. package/assets/esri/core/workers/chunks/3a35779cae6a11cde51b.js +0 -1
  371. package/assets/esri/core/workers/chunks/3b7060d264888bf298b1.js +0 -1
  372. package/assets/esri/core/workers/chunks/3df5394b17e9659ecb8f.js +0 -1
  373. package/assets/esri/core/workers/chunks/4adfe7f8a8efe2cd8e80.js +0 -1
  374. package/assets/esri/core/workers/chunks/511b9c12a7479d39dac0.js +0 -1
  375. package/assets/esri/core/workers/chunks/5396a894e6f8030ca088.js +0 -1
  376. package/assets/esri/core/workers/chunks/5728d8440aca205e4f53.js +0 -1
  377. package/assets/esri/core/workers/chunks/66392ff750c28064040a.js +0 -1
  378. package/assets/esri/core/workers/chunks/668d84dc512b3085a960.js +0 -1
  379. package/assets/esri/core/workers/chunks/6849282c4a5cd733779d.js +0 -1
  380. package/assets/esri/core/workers/chunks/6adc17e6e287a365ad8d.js +0 -1
  381. package/assets/esri/core/workers/chunks/6db5ee9c589265b23b60.js +0 -1
  382. package/assets/esri/core/workers/chunks/76ed8e455f6bd79e561c.js +0 -1
  383. package/assets/esri/core/workers/chunks/7c34eb94e2c74602aeab.js +0 -1
  384. package/assets/esri/core/workers/chunks/831455798b177678720c.js +0 -1
  385. package/assets/esri/core/workers/chunks/88b08b386926ec889573.js +0 -1
  386. package/assets/esri/core/workers/chunks/8bd4c43c34aacf3b07da.js +0 -1
  387. package/assets/esri/core/workers/chunks/8ca88cfc0b9f84dc5832.js +0 -1
  388. package/assets/esri/core/workers/chunks/928b18e13e015330d44b.js +0 -1
  389. package/assets/esri/core/workers/chunks/937e347d130d469518ce.js +0 -1
  390. package/assets/esri/core/workers/chunks/93b40245378ced43ca08.js +0 -1
  391. package/assets/esri/core/workers/chunks/98dfe31e8ed9b522eaff.js +0 -1
  392. package/assets/esri/core/workers/chunks/a18cb809dd56c5537b3b.js +0 -1
  393. package/assets/esri/core/workers/chunks/a195f569eada3a8736be.js +0 -1
  394. package/assets/esri/core/workers/chunks/a40ede4d3375184f21fe.js +0 -1
  395. package/assets/esri/core/workers/chunks/a8167ab9fd846d699be5.js +0 -1
  396. package/assets/esri/core/workers/chunks/af96cbc4fb7bef726635.js +0 -1
  397. package/assets/esri/core/workers/chunks/b87aca8ad281870ae970.js +0 -1
  398. package/assets/esri/core/workers/chunks/ceb5bd9f2afaa2ea0808.js +0 -1
  399. package/assets/esri/core/workers/chunks/d25c37f169577a33db46.js +0 -1
  400. package/assets/esri/core/workers/chunks/d374cb2d17a2d11c500f.js +0 -1
  401. package/assets/esri/core/workers/chunks/dadf85890961bcc205eb.js +0 -1
  402. package/assets/esri/core/workers/chunks/db279d5d9c7deec554bb.js +0 -1
  403. package/assets/esri/core/workers/chunks/de0c94defb90e1805081.js +0 -1
  404. package/assets/esri/core/workers/chunks/e1340232962cf576d37e.js +0 -1
  405. package/assets/esri/core/workers/chunks/e38d1ba15babc238b151.js +0 -1
  406. package/assets/esri/core/workers/chunks/e73bb7c8de7412d9975c.js +0 -1
  407. package/assets/esri/core/workers/chunks/f23351a04643c464be84.js +0 -1
  408. package/assets/esri/core/workers/chunks/f3d331da3c61af5c5a2f.js +0 -1
  409. package/assets/esri/core/workers/chunks/f5125925f83c979edde7.js +0 -2
  410. package/assets/esri/core/workers/chunks/f912c173c58ae4299cbe.js +0 -1
  411. package/assets/esri/core/workers/chunks/f93facf47aba9b128fcc.js +0 -1
  412. package/assets/esri/core/workers/chunks/fae147d03ed723ab234d.js +0 -1
  413. package/views/2d/engine/ManagedCanvas.js +0 -2
  414. package/views/2d/layers/features/support/FeatureSetReaderAnnotationJSON.js +0 -2
  415. package/views/2d/layers/features/support/FeatureSetReaderDimensionJSON.js +0 -2
  416. package/views/2d/layers/support/annodime/annotationUtils.js +0 -2
  417. package/views/3d/state/controllers/SurfaceCollisionCorrectionController.js +0 -2
  418. /package/assets/esri/core/workers/chunks/{f5125925f83c979edde7.js.LICENSE.txt → f10a339b16d84b650012.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import o from"../../request.js";import s from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import{LoadableMixin as a}from"../../core/Loadable.js";import n from"../../core/Logger.js";import{EsriPromiseMixin as p}from"../../core/Promise.js";import{property as l,subclass as y}from"../../core/accessorSupport/decorators.js";import u from"../../geometry/Extent.js";import d from"../../geometry/SpatialReference.js";import c from"../../graphic/BuildingGraphicOrigin.js";import h from"../FeatureLayer.js";import m from"./BuildingSublayer.js";import{zeroCapabilities as f}from"../support/capabilities.js";import{popupEnabled as g}from"../support/commonProperties.js";import{getFieldDomain as j}from"../support/featureLayerUtils.js";import{defineFieldProperties as v}from"../support/fieldProperties.js";import b from"../support/FieldsIndex.js";import{unpackFieldNames as L}from"../support/fieldUtils.js";import{fetchIndexInfo as I}from"../support/I3SIndexInfo.js";import{I3SNodePageDefinition as S,I3SMaterialDefinition as F,I3STextureSetDefinition as O,I3SGeometryDefinition as w}from"../support/I3SLayerDefinitions.js";import{webSceneRendererTypes as x}from"../../renderers/support/typeUtils.js";import P from"../../rest/support/Query.js";import{isNumber as q}from"../../support/guards.js";import{createPopupTemplate as T}from"../../support/popupUtils.js";import Q from"../../symbols/support/ElevationInfo.js";import{queryAttributesFromCachedAttributesId as U}from"../../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as E,getFetchPopupTemplate as D}from"../../views/layers/support/popupUtils.js";import{reader as R}from"../../core/accessorSupport/decorators/reader.js";import{enumeration as A}from"../../core/accessorSupport/decorators/enumeration.js";const _=v();let N=class extends(a(p(m))){constructor(e){super(e),this.type="building-component",this.nodePages=null,this.materialDefinitions=[],this.textureSetDefinitions=[],this.geometryDefinitions=[],this.indexInfo=null,this.serviceUpdateTimeStamp=null,this.store=null,this.attributeStorageInfo=[],this.fields=[],this.associatedLayer=null,this.outFields=null,this.listMode="show",this.renderer=null,this.definitionExpression=null,this.popupEnabled=!0,this.popupTemplate=null,this.layerType="3d-object"}initialize(){this._set("graphicOrigin",new c(this))}get parsedUrl(){return this.layer?{path:`${this.layer.parsedUrl?.path}/sublayers/${this.id}`,query:this.layer.parsedUrl?.query}:{path:""}}get fieldsIndex(){return new b(this.fields)}readAssociatedLayer(e,t){const r=this.layer.associatedFeatureServiceItem,o=t.associatedLayerID;return null!=r&&"number"==typeof o?new h({portalItem:r,customParameters:this.customParameters,layerId:o}):null}get objectIdField(){if(null!=this.fields)for(const e of this.fields)if("oid"===e.type)return e.name;return""}get globalIdField(){if(null!=this.fields)for(const e of this.fields)if("global-id"===e.type)return e.name;return""}get displayField(){return null!=this.associatedLayer?this.associatedLayer.displayField:void 0}get apiKey(){return this.layer.apiKey}get customParameters(){return this.layer.customParameters}get fullExtent(){return this.layer.fullExtent}get spatialReference(){return this.layer.spatialReference}get version(){return this.layer.version}get elevationInfo(){return this.layer.elevationInfo}get minScale(){return this.layer.minScale}get maxScale(){return this.layer.maxScale}get effectiveScaleRange(){return this.layer.effectiveScaleRange}get defaultPopupTemplate(){return this.createPopupTemplate()}load(e){const t=null!=e?e.signal:null,r=this._fetchService(t).then(()=>{this.indexInfo=I(this.parsedUrl.path,this.rootNode,this.nodePages,this.customParameters,this.apiKey,n.getLogger(this),t)});return this.addResolvingPromise(r),Promise.resolve(this)}createPopupTemplate(e){return T(this,e)}async _fetchService(e){const t=(await o(this.parsedUrl.path,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(t,{origin:"service",url:this.parsedUrl})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?j(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&null!=this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return null!=this.associatedLayer?this.associatedLayer.types??[]:[]}get typeIdField(){return null!=this.associatedLayer?this.associatedLayer.typeIdField:null}get geometryType(){return"3d-object"===this.layerType?"mesh":"point"}get profile(){return"3d-object"===this.layerType?"mesh-pyramids":"points"}get capabilities(){const e=null!=this.associatedLayer&&this.associatedLayer.capabilities?this.associatedLayer.capabilities:f,{query:t,operations:{supportsQuery:r},data:{supportsZ:o,supportsM:s,isVersioned:i}}=e;return{query:t,operations:{supportsQuery:r},data:{supportsZ:o,supportsM:s,isVersioned:i}}}createQuery(){const e=new P;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(const t of e.features)t.layer=this.layer,t.sourceLayer=this,t.origin=this.graphicOrigin;return e})}async queryObjectIds(e,t){const r=await this._getAssociatedLayerForQuery();return(await r.queryObjectIds(e||this.createQuery(),t)).filter(q)}async queryCachedAttributes(e,t){const r=L(this.fieldsIndex,await E(this,D(this)));return U(this.parsedUrl.path,this.attributeStorageInfo,e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const o=await this.queryCachedAttributes(e,[r]);if(!o||0===o.length)throw new s("scenelayer:feature-not-in-cached-data","Feature not found in cached data");return new t({attributes:o[0],layer:this,sourceLayer:this})}getFieldUsageInfo(e){return this.fieldsIndex.has(e)?{supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1}:{supportsLabelingInfo:!1,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:null!=this.associatedLayer}}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return null!=e&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),null==this.associatedLayer)throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer component layer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}};e([l({readOnly:!0})],N.prototype,"parsedUrl",null),e([l({type:S,readOnly:!0})],N.prototype,"nodePages",void 0),e([l({type:[F],readOnly:!0})],N.prototype,"materialDefinitions",void 0),e([l({type:[O],readOnly:!0})],N.prototype,"textureSetDefinitions",void 0),e([l({type:[w],readOnly:!0})],N.prototype,"geometryDefinitions",void 0),e([l({readOnly:!0})],N.prototype,"serviceUpdateTimeStamp",void 0),e([l({readOnly:!0})],N.prototype,"store",void 0),e([l({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],N.prototype,"rootNode",void 0),e([l({readOnly:!0})],N.prototype,"attributeStorageInfo",void 0),e([l(_.fields)],N.prototype,"fields",void 0),e([l({readOnly:!0})],N.prototype,"fieldsIndex",null),e([l({readOnly:!0,type:h})],N.prototype,"associatedLayer",void 0),e([R("service","associatedLayer",["associatedLayerID"])],N.prototype,"readAssociatedLayer",null),e([l(_.outFields)],N.prototype,"outFields",void 0),e([l({type:String,readOnly:!0})],N.prototype,"objectIdField",null),e([l({type:String,readOnly:!0})],N.prototype,"globalIdField",null),e([l({readOnly:!0,type:String,json:{read:!1}})],N.prototype,"displayField",null),e([l({readOnly:!0,type:String})],N.prototype,"apiKey",null),e([l({readOnly:!0,type:String})],N.prototype,"customParameters",null),e([l({readOnly:!0,type:u})],N.prototype,"fullExtent",null),e([l({readOnly:!0,type:d})],N.prototype,"spatialReference",null),e([l({readOnly:!0})],N.prototype,"version",null),e([l({readOnly:!0,type:Q})],N.prototype,"elevationInfo",null),e([l({readOnly:!0,type:Number})],N.prototype,"minScale",null),e([l({readOnly:!0,type:Number})],N.prototype,"maxScale",null),e([l({readOnly:!0,type:Number})],N.prototype,"effectiveScaleRange",null),e([l({type:["hide","show"],json:{write:!0}})],N.prototype,"listMode",void 0),e([l({types:x,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],N.prototype,"renderer",void 0),e([l({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],N.prototype,"definitionExpression",void 0),e([l(g)],N.prototype,"popupEnabled",void 0),e([l({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],N.prototype,"popupTemplate",void 0),e([l({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],N.prototype,"normalReferenceFrame",void 0),e([l({readOnly:!0,json:{read:!1}})],N.prototype,"defaultPopupTemplate",null),e([l({readOnly:!0})],N.prototype,"graphicOrigin",void 0),e([l()],N.prototype,"types",null),e([l()],N.prototype,"typeIdField",null),e([l({json:{write:!1}}),A(new i({"3DObject":"3d-object",Point:"point"}))],N.prototype,"layerType",void 0),e([l()],N.prototype,"geometryType",null),e([l()],N.prototype,"profile",null),e([l({readOnly:!0,json:{read:!1}})],N.prototype,"capabilities",null),e([l({readOnly:!0})],N.prototype,"statisticsInfo",void 0),N=e([y("esri.layers.buildingSublayers.BuildingComponentSublayer")],N);export{N as default};
2
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import o from"../../request.js";import i from"../../core/Error.js";import{JSONMap as s}from"../../core/jsonMap.js";import{LoadableMixin as a}from"../../core/Loadable.js";import n from"../../core/Logger.js";import{EsriPromiseMixin as p}from"../../core/Promise.js";import{property as l,subclass as y}from"../../core/accessorSupport/decorators.js";import u from"../../geometry/Extent.js";import d from"../../geometry/SpatialReference.js";import c from"../../graphic/BuildingGraphicOrigin.js";import h from"../FeatureLayer.js";import m from"./BuildingSublayer.js";import{zeroCapabilities as f}from"../support/capabilities.js";import{popupEnabled as g}from"../support/commonProperties.js";import{getFieldDomain as j}from"../support/featureLayerUtils.js";import{defineFieldProperties as v}from"../support/fieldProperties.js";import b from"../support/FieldsIndex.js";import{unpackFieldNames as L}from"../support/fieldUtils.js";import{fetchIndexInfo as I}from"../support/I3SIndexInfo.js";import{I3SNodePageDefinition as S,I3SMaterialDefinition as F,I3STextureSetDefinition as O,I3SGeometryDefinition as w}from"../support/I3SLayerDefinitions.js";import{webSceneRendererTypes as x}from"../../renderers/support/typeUtils.js";import P from"../../rest/support/Query.js";import{isNumber as q}from"../../support/guards.js";import{createPopupTemplate as T}from"../../support/popupUtils.js";import Q from"../../symbols/support/ElevationInfo.js";import{queryAttributesFromCachedAttributesId as U}from"../../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as E,getFetchPopupTemplate as D}from"../../views/layers/support/popupUtils.js";import{reader as R}from"../../core/accessorSupport/decorators/reader.js";import{enumeration as A}from"../../core/accessorSupport/decorators/enumeration.js";const _=v();let N=class extends(a(p(m))){constructor(e){super(e),this.type="building-component",this.nodePages=null,this.materialDefinitions=[],this.textureSetDefinitions=[],this.geometryDefinitions=[],this.indexInfo=null,this.serviceUpdateTimeStamp=null,this.store=null,this.attributeStorageInfo=[],this.fields=[],this.associatedLayer=null,this.outFields=null,this.listMode="show",this.renderer=null,this.definitionExpression=null,this.popupEnabled=!0,this.popupTemplate=null,this.layerType="3d-object"}initialize(){this._set("graphicOrigin",new c(this))}get parsedUrl(){return this.layer?{path:`${this.layer.parsedUrl?.path}/sublayers/${this.id}`,query:this.layer.parsedUrl?.query}:{path:""}}get fieldsIndex(){return new b(this.fields)}readAssociatedLayer(e,t){const r=this.layer.associatedFeatureServiceItem,o=t.associatedLayerID;return null!=r&&"number"==typeof o?new h({portalItem:r,customParameters:this.customParameters,layerId:o}):null}get objectIdField(){if(null!=this.fields)for(const e of this.fields)if("oid"===e.type)return e.name;return""}get globalIdField(){if(null!=this.fields)for(const e of this.fields)if("global-id"===e.type)return e.name;return""}get displayField(){return null!=this.associatedLayer?this.associatedLayer.displayField:void 0}get apiKey(){return this.layer.apiKey}get customParameters(){return this.layer.customParameters}get fullExtent(){return this.layer.fullExtent}get spatialReference(){return this.layer.spatialReference}get version(){return this.layer.version}get elevationInfo(){return this.layer.elevationInfo}get minScale(){return this.layer.minScale}get maxScale(){return this.layer.maxScale}get effectiveScaleRange(){return this.layer.effectiveScaleRange}get defaultPopupTemplate(){return this.createPopupTemplate()}load(e){const t=null!=e?e.signal:null,r=this._fetchService(t).then(()=>{this.indexInfo=I(this.parsedUrl.path,this.rootNode,this.nodePages,this.customParameters,this.apiKey,n.getLogger(this),t),this.indexInfo.catch(()=>{})});return this.addResolvingPromise(r),Promise.resolve(this)}createPopupTemplate(e){return T(this,e)}async _fetchService(e){const t=(await o(this.parsedUrl.path,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(t,{origin:"service",url:this.parsedUrl})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?j(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&null!=this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return null!=this.associatedLayer?this.associatedLayer.types??[]:[]}get typeIdField(){return null!=this.associatedLayer?this.associatedLayer.typeIdField:null}get geometryType(){return"3d-object"===this.layerType?"mesh":"point"}get profile(){return"3d-object"===this.layerType?"mesh-pyramids":"points"}get capabilities(){const e=null!=this.associatedLayer&&this.associatedLayer.capabilities?this.associatedLayer.capabilities:f,{query:t,operations:{supportsQuery:r},data:{supportsZ:o,supportsM:i,isVersioned:s}}=e;return{query:t,operations:{supportsQuery:r},data:{supportsZ:o,supportsM:i,isVersioned:s}}}createQuery(){const e=new P;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(const t of e.features)t.layer=this.layer,t.sourceLayer=this,t.origin=this.graphicOrigin;return e})}async queryObjectIds(e,t){const r=await this._getAssociatedLayerForQuery();return(await r.queryObjectIds(e||this.createQuery(),t)).filter(q)}async queryCachedAttributes(e,t){const r=L(this.fieldsIndex,await E(this,D(this)));return U(this.parsedUrl.path,this.attributeStorageInfo,e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const o=await this.queryCachedAttributes(e,[r]);if(!o||0===o.length)throw new i("scenelayer:feature-not-in-cached-data","Feature not found in cached data");return new t({attributes:o[0],layer:this,sourceLayer:this})}getFieldUsageInfo(e){return this.fieldsIndex.has(e)?{supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1}:{supportsLabelingInfo:!1,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:null!=this.associatedLayer}}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return null!=e&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),null==this.associatedLayer)throw new i("buildingscenelayer:query-not-available","BuildingSceneLayer component layer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new i("buildingscenelayer:query-not-available","BuildingSceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}};e([l({readOnly:!0})],N.prototype,"parsedUrl",null),e([l({type:S,readOnly:!0})],N.prototype,"nodePages",void 0),e([l({type:[F],readOnly:!0})],N.prototype,"materialDefinitions",void 0),e([l({type:[O],readOnly:!0})],N.prototype,"textureSetDefinitions",void 0),e([l({type:[w],readOnly:!0})],N.prototype,"geometryDefinitions",void 0),e([l({readOnly:!0})],N.prototype,"serviceUpdateTimeStamp",void 0),e([l({readOnly:!0})],N.prototype,"store",void 0),e([l({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],N.prototype,"rootNode",void 0),e([l({readOnly:!0})],N.prototype,"attributeStorageInfo",void 0),e([l(_.fields)],N.prototype,"fields",void 0),e([l({readOnly:!0})],N.prototype,"fieldsIndex",null),e([l({readOnly:!0,type:h})],N.prototype,"associatedLayer",void 0),e([R("service","associatedLayer",["associatedLayerID"])],N.prototype,"readAssociatedLayer",null),e([l(_.outFields)],N.prototype,"outFields",void 0),e([l({type:String,readOnly:!0})],N.prototype,"objectIdField",null),e([l({type:String,readOnly:!0})],N.prototype,"globalIdField",null),e([l({readOnly:!0,type:String,json:{read:!1}})],N.prototype,"displayField",null),e([l({readOnly:!0,type:String})],N.prototype,"apiKey",null),e([l({readOnly:!0,type:String})],N.prototype,"customParameters",null),e([l({readOnly:!0,type:u})],N.prototype,"fullExtent",null),e([l({readOnly:!0,type:d})],N.prototype,"spatialReference",null),e([l({readOnly:!0})],N.prototype,"version",null),e([l({readOnly:!0,type:Q})],N.prototype,"elevationInfo",null),e([l({readOnly:!0,type:Number})],N.prototype,"minScale",null),e([l({readOnly:!0,type:Number})],N.prototype,"maxScale",null),e([l({readOnly:!0,type:Number})],N.prototype,"effectiveScaleRange",null),e([l({type:["hide","show"],json:{write:!0}})],N.prototype,"listMode",void 0),e([l({types:x,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],N.prototype,"renderer",void 0),e([l({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],N.prototype,"definitionExpression",void 0),e([l(g)],N.prototype,"popupEnabled",void 0),e([l({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],N.prototype,"popupTemplate",void 0),e([l({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],N.prototype,"normalReferenceFrame",void 0),e([l({readOnly:!0,json:{read:!1}})],N.prototype,"defaultPopupTemplate",null),e([l({readOnly:!0})],N.prototype,"graphicOrigin",void 0),e([l()],N.prototype,"types",null),e([l()],N.prototype,"typeIdField",null),e([l({json:{write:!1}}),A(new s({"3DObject":"3d-object",Point:"point"}))],N.prototype,"layerType",void 0),e([l()],N.prototype,"geometryType",null),e([l()],N.prototype,"profile",null),e([l({readOnly:!0,json:{read:!1}})],N.prototype,"capabilities",null),e([l({readOnly:!0})],N.prototype,"statisticsInfo",void 0),N=e([y("esri.layers.buildingSublayers.BuildingComponentSublayer")],N);export{N as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as n,sync as o,initial as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as u}from"../../../core/accessorSupport/decorators.js";import{runUntracked as _}from"../../../core/accessorSupport/tracking.js";import{exactEquals as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UpdatingHandles as p}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as g}from"../../../geometry/projection/projectBoundingRect.js";import{create as m}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as y}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as f}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as x}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as N}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as b}from"../../../views/3d/layers/i3s/I3SIndex.js";import v from"../../../views/3d/layers/i3s/I3SLodHandling.js";import w from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as L,getIndexCrs as D,findIntersectingNodes as C}from"../../../views/3d/layers/i3s/I3SUtil.js";import V from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as I}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as M}from"../../../views/support/PromiseQueue.js";import{noBudget as F}from"../../../views/support/Scheduler.js";const O=100,q=2,P=1e4,R=1e-4,S=1.2,G=500,U=1.5;let H=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexRequester(){return new x(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new x(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return L(this.layer)}get crsIndex(){return D(this.layer)}get layer(){return this.layerView.layer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){return _(()=>{if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0})}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new p,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new M,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new v(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:c}),n(()=>r.quality,()=>this._setCameraDirty(),o),this._updatingHandles.add(()=>2===r.state.mode,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),N(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),o),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new V(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.groundView:r.elevationProvider,y(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new f(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new b(y(r.viewingMode),t,s,this.indexRequester,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,Q.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),null!=j&&(j.hide(),j=null),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=T(e,i),r=T(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();E(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=m();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(g(e,t,k,this.crsIndex),e=k);const s=this._elevationUpdateNodes;return s.clear(),C(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.calculateServiceMbsInRenderSRElevationAdjusted(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushAll(this._index.updates.missing));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>G){if(this._featureLOD<=R)return;this._featureLOD/=U,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=P||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*S||e&&i.estimate>t))return;if(this._featureLOD<=R)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(P,Math.max(R,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?O:q)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=q)&&(null==this.index||!this.dataRequester.isFull(this._index.urlPrefix))}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-I)/(.5-I)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenterAndUpdateMinmax(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new w(this.layer,this.dataRequester,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;Q.clear(),this.layerView.getLoadedNodeIndices(Q);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return Q.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),Q.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(Q,e,0),!(i&&this._lodDropFactor<1)&&(0===Q.length||(Q.clear(),!1))}markNodeToRemove(e){Q.push(e)}removeMarkedNodes(){this._removeNodes(Q,F,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=E(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!d(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&E(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=t=>this._clientNodeLoader.loadTextures(e,t),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const n=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,n,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:n,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).then(i=>this.schedule(()=>this.layerView.addNode(e,i,t),t)).finally(()=>this._downloadingCount--).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],H.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],H.prototype,"isGraphics3D",null),e([h({readOnly:!0})],H.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],H.prototype,"indexRequester",null),e([h({readOnly:!0})],H.prototype,"dataRequester",null),e([h({readOnly:!0})],H.prototype,"crsVertex",null),e([h({readOnly:!0})],H.prototype,"crsIndex",null),e([h()],H.prototype,"featureTarget",void 0),e([h()],H.prototype,"fixedFeatureTarget",void 0),e([h()],H.prototype,"layerView",void 0),e([h()],H.prototype,"layer",null),e([h()],H.prototype,"_updatingHandles",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"running",void 0),e([h()],H.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],H.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],H.prototype,"worker",void 0),e([h({readOnly:!0})],H.prototype,"rootNodeVisible",null),H=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],H);const Q=new r({deallocator:null});let j;function E(e,t){return null!=e&&e.length===t.length&&e.every(e=>T(t,e.name)>=0)}function T(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const k=m(),B=H;export{B as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as n,sync as o,initial as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as u}from"../../../core/accessorSupport/decorators.js";import{runUntracked as _}from"../../../core/accessorSupport/tracking.js";import{exactEquals as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UpdatingHandles as p}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as g}from"../../../geometry/projection/projectBoundingRect.js";import{create as m}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as y}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as f}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as x}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as N}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as b}from"../../../views/3d/layers/i3s/I3SIndex.js";import v from"../../../views/3d/layers/i3s/I3SLodHandling.js";import w from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as L,getIndexCrs as D,findIntersectingNodes as C}from"../../../views/3d/layers/i3s/I3SUtil.js";import V from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as I}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as M}from"../../../views/support/PromiseQueue.js";import{noBudget as F}from"../../../views/support/Scheduler.js";const O=100,q=2,P=1e4,R=1e-4,S=1.2,G=500,U=1.5;let H=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexRequester(){return new x(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new x(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return L(this.layer)}get crsIndex(){return D(this.layer)}get layer(){return this.layerView.layer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){return _(()=>{if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0})}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new p,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new M,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new v(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:c}),n(()=>r.quality,()=>this._setCameraDirty(),o),this._updatingHandles.add(()=>2===r.state.mode,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),N(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),o),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new V(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.groundView:r.elevationProvider,y(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new f(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new b(y(r.viewingMode),t,s,this.indexRequester,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,Q.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),null!=j&&(j.hide(),j=null),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=T(e,i),r=T(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();E(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=m();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(g(e,t,k,this.crsIndex),e=k);const s=this._elevationUpdateNodes;return s.clear(),C(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.calculateServiceMbsInRenderSRElevationAdjusted(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushAll(this._index.updates.missing));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>G){if(this._featureLOD<=R)return;this._featureLOD/=U,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=P||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*S||e&&i.estimate>t))return;if(this._featureLOD<=R)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(P,Math.max(R,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?O:q)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=q)&&(null==this.index||!this.dataRequester.isFull(this._index.urlPrefix))}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-I)/(.5-I)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenterAndUpdateMinmax(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new w(this.layer,this.dataRequester,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;Q.clear(),this.layerView.getLoadedNodeIndices(Q);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return Q.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),Q.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(Q,e,0),!(i&&this._lodDropFactor<1)&&(0===Q.length||(Q.clear(),!1))}markNodeToRemove(e){Q.push(e)}removeMarkedNodes(){this._removeNodes(Q,F,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=E(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(()=>{}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&E(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=t=>this._clientNodeLoader.loadTextures(e,t),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const n=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,n,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:n,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).then(i=>this.schedule(()=>this.layerView.addNode(e,i,t),t)).finally(()=>this._downloadingCount--).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],H.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],H.prototype,"isGraphics3D",null),e([h({readOnly:!0})],H.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],H.prototype,"indexRequester",null),e([h({readOnly:!0})],H.prototype,"dataRequester",null),e([h({readOnly:!0})],H.prototype,"crsVertex",null),e([h({readOnly:!0})],H.prototype,"crsIndex",null),e([h()],H.prototype,"featureTarget",void 0),e([h()],H.prototype,"fixedFeatureTarget",void 0),e([h()],H.prototype,"layerView",void 0),e([h()],H.prototype,"layer",null),e([h()],H.prototype,"_updatingHandles",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"running",void 0),e([h()],H.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],H.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],H.prototype,"worker",void 0),e([h({readOnly:!0})],H.prototype,"rootNodeVisible",null),H=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],H);const Q=new r({deallocator:null});let j;function E(e,t){return null!=e&&e.length===t.length&&e.every(e=>T(t,e.name)>=0)}function T(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const k=m(),B=H;export{B as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../Graphic.js";import t from"../../core/Collection.js";import a from"../../core/Error.js";import{clone as r}from"../../core/lang.js";import s from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{dataComponents as n}from"../../core/urlUtils.js";import{generateBracedUUID as o}from"../../core/uuid.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{isGeographic as l,equals as u,isWGS84 as p,isWebMercator as c}from"../../geometry/support/spatialReferenceUtils.js";import{densifyUnsupportedCurves as h}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{isEditBusLayer as m,emitApplyEditsEvent as f}from"../mixins/EditBusLayer.js";import{isValidFieldValue as y}from"../support/fieldUtils.js";import{isGlbSupportedEditFormat as g}from"../support/infoFor3D.js";import{getEffectiveEditingEnabled as w,getEffectiveLayerCapabilities as b}from"../support/layerUtils.js";function F(e){return null!=e?.applyEdits}const v=()=>s.getLogger("esri.layers.graphics.editingSupport"),A=new WeakMap;async function I(e,t,a,s={}){let i;const n="gdbVersion"in e?e.gdbVersion:null,o=s.gdbVersion??n;if(m(e)&&e.url)i=f(e.url,e.layerId,o,"original-and-current-features"===s.returnServiceEditsOption);else{i=Promise.withResolvers(),i.promise.then(t=>{(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length)&&e.emit("edits",t)});const t={result:i.promise};e.emit("apply-edits",t)}try{const{results:n,edits:o}=await $(e,t,a,s),d=e=>e.filter(e=>!e.error).map(r),l={edits:o,addedFeatures:d(n.addFeatureResults),updatedFeatures:d(n.updateFeatureResults),deletedFeatures:d(n.deleteFeatureResults),addedAttachments:d(n.addAttachmentResults),updatedAttachments:d(n.updateAttachmentResults),deletedAttachments:d(n.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:n.editMoment?new Date(n.editMoment):null,globalIdToObjectId:s.globalIdToObjectId};return n.editedFeatureResults?.length&&(l.editedFeatures=n.editedFeatureResults),i.resolve(l),n}catch(d){throw i.reject(d),d}}async function $(e,t,r,s){if(await e.load(),!F(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!w(e))throw new a(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:i,options:n}=await E(e,r,s);return i.addFeatures?.length||i.updateFeatures?.length||i.deleteFeatures?.length||i.addAttachments?.length||i.updateAttachments?.length||i.deleteAttachments?.length?{edits:i,results:await t.applyEdits(i,n)}:{edits:i,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function E(e,t,r){const s=b(e),n=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),o=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),d=null!=e.infoFor3D;if(D(t,s,r,!!n,!!o,`${e.type}-layer`),!s.data.isVersioned&&r?.gdbVersion)throw new a(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!s.editing.supportsRollbackOnFailure&&r?.rollbackOnFailureEnabled)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");const l={...r};if(null!=l.rollbackOnFailureEnabled||s.editing.supportsRollbackOnFailure||(l.rollbackOnFailureEnabled=!0),l.rollbackOnFailureEnabled||"original-and-current-features"!==l.returnServiceEditsOption||(!1===l.rollbackOnFailureEnabled&&v().warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwritten and set to true."),l.rollbackOnFailureEnabled=!0),!s.editing.supportsReturnServiceEditsInSourceSpatialReference&&l.returnServiceEditsInSourceSR)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(l.returnServiceEditsInSourceSR&&"original-and-current-features"!==l.returnServiceEditsOption)throw new a(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const u=M(t,s,`${e.type}-layer`),p=r?.globalIdUsed||d,c=e.fields.filter(e=>"big-integer"===e.type||"oid"===e.type&&(e.length||0)>=8);if(p){const{globalIdField:t}=e;if(null==t)throw new a(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");u.addFeatures.forEach(e=>L(e,t))}u.addFeatures.forEach(t=>O(t,e,p,c)),u.updateFeatures.forEach(t=>k(t,e,p,c)),u.deleteFeatures.forEach(t=>j(t,e,p,c)),u.addAttachments.forEach(t=>U(t,e)),u.updateAttachments.forEach(t=>U(t,e)),d&&await V(u,e);const h=i(A,e,()=>new Map);return{edits:await T(u,s.data.supportedCurveTypes??[],h),options:l}}function S(e,t,r,s){if(r){if("attributes"in e&&!e.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if(s.length&&"attributes"in e)for(const i of s){const r=e.attributes[i.name];if(void 0!==r&&!y(i,r))throw new a(`${t.type}-layer:invalid-parameter`,`Big-integer field '${i.name}' of the feature must be less than ${Number.MAX_SAFE_INTEGER}`,{feature:e})}if("geometry"in e&&null!=e.geometry){if(e.geometry.hasZ&&!1===t.capabilities?.data.supportsZ)throw new a(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&!1===t.capabilities?.data.supportsM)throw new a(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function R(e,t){if("geometry"in e&&"mesh"===e.geometry?.type&&null!=t.infoFor3D&&null!=t.spatialReference){const{geometry:r}=e,{spatialReference:s,vertexSpace:i}=r,n=t.spatialReference,o="local"===i.type,d=l(n),h=u(n,s),m=h||p(n)&&(p(s)||c(s));if(!(o&&d&&m||!o&&!d&&h))throw new a(`${t.type}-layer:mesh-unsupported`,`Uploading a mesh with a ${i.type} vertex space and a spatial reference wkid:${s.wkid} to a layer with a spatial reference wkid:${n.wkid} is not supported.`)}}function O(e,t,a,r){S(e,t,a,r),R(e,t)}function j(e,t,a,r){S(e,t,a,r)}function k(e,t,r,s){S(e,t,r,s),R(e,t);const i=b(t);if("geometry"in e&&null!=e.geometry&&!i?.editing.supportsGeometryUpdate)throw new a(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function U(e,t){const{feature:r,attachment:s}=e;if(!r||"attributes"in r&&!r.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in r)&&!r.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!s.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!s.data&&!s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(s.data instanceof File&&!!s.data.name)&&!s.name)throw new a(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!t.capabilities?.editing.supportsUploadWithItemId&&s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if("string"==typeof s.data){const e=n(s.data);if(e&&!e.isBase64)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function L(e,t){const{attributes:a}=e;null==a[t]&&(a[t]=o())}async function T(e,t,a){const r=e.addFeatures??[],s=e.updateFeatures??[],i=r.concat(s).map(e=>e.geometry),n=await h(i,t,a),o=await d(n),l=r.length,u=s.length;return o.slice(0,l).forEach((e,t)=>r[t].geometry=e),o.slice(l,l+u).forEach((e,t)=>s[t].geometry=e),e}function B(e){return{addFeatures:Array.from(e?.addFeatures??[]),updateFeatures:Array.from(e?.updateFeatures??[]),deleteFeatures:e&&t.isCollection(e.deleteFeatures)?e.deleteFeatures.toArray():e.deleteFeatures||[],addAttachments:e.addAttachments||[],updateAttachments:e.updateAttachments||[],deleteAttachments:e.deleteAttachments||[]}}function M(e,t,r){const s=B(e);if(s.addFeatures?.length&&!t.operations.supportsAdd)throw new a(`${r}:unsupported-operation`,"Layer does not support adding features.");if(s.updateFeatures?.length&&!t.operations.supportsUpdate)throw new a(`${r}:unsupported-operation`,"Layer does not support updating features.");if(s.deleteFeatures?.length&&!t.operations.supportsDelete)throw new a(`${r}:unsupported-operation`,"Layer does not support deleting features.");return s.addFeatures=s.addFeatures.map(G),s.updateFeatures=s.updateFeatures.map(G),s.addAssetFeatures=[],s}function D(e,t,r,s,i,n){if(!(e&&(s||i)||r?.usingTelecomOperations))throw new a(`${n}:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");const o=t.editing.supportsGlobalId||r?.usingFeatureServiceEndpoint;if(!o&&r?.globalIdUsed)throw new a(`${n}:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!o&&i)throw new a(`${n}:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!r?.globalIdUsed&&i)throw new a(`${n}:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true")}function G(t){const a=new e;return t.attributes||(t.attributes={}),a.geometry=t.geometry,a.attributes=t.attributes,a}async function V(e,t){const{infoFor3D:r}=t;if(null==r)return;if(!g(r))throw new a(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??=[];const{addAssetFeatures:s}=e;for(const a of e.addFeatures??[])x(a)&&s.push(a);for(const a of e.updateFeatures??[])x(a)&&s.push(a)}function x(e){return"mesh"===e?.geometry?.type}function z(e,t,r,s){if(!F(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new a(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(r,s)}export{I as applyEdits,D as checkEditingCapabilities,B as normalizeCollections,M as normalizeEdits,T as processGeometries,G as shallowCloneFeature,z as uploadAssets};
2
+ import e from"../../Graphic.js";import t from"../../core/Collection.js";import a from"../../core/Error.js";import{clone as r}from"../../core/lang.js";import s from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{dataComponents as n}from"../../core/urlUtils.js";import{generateBracedUUID as o}from"../../core/uuid.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{isGeographic as l,equals as u,isWGS84 as p,isWebMercator as c}from"../../geometry/support/spatialReferenceUtils.js";import{densifyUnsupportedCurves as h}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{isEditBusLayer as m,emitApplyEditsEvent as f}from"../mixins/EditBusLayer.js";import{isValidFieldValue as y}from"../support/fieldUtils.js";import{isGlbSupportedEditFormat as g}from"../support/infoFor3D.js";import{getEffectiveEditingEnabled as w,getEffectiveLayerCapabilities as b}from"../support/layerUtils.js";function F(e){return null!=e?.applyEdits}const v=()=>s.getLogger("esri.layers.graphics.editingSupport"),A=new WeakMap;async function I(e,t,a,s={}){let i;const n="gdbVersion"in e?e.gdbVersion:null,o=s.gdbVersion??n;if(m(e)&&e.url)i=f(e.url,e.layerId,o,"original-and-current-features"===s.returnServiceEditsOption);else{i=Promise.withResolvers(),i.promise.then(t=>{(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length)&&e.emit("edits",t)},()=>{});const t={result:i.promise};e.emit("apply-edits",t)}try{const{results:n,edits:o}=await $(e,t,a,s),d=e=>e.filter(e=>!e.error).map(r),l={edits:o,addedFeatures:d(n.addFeatureResults),updatedFeatures:d(n.updateFeatureResults),deletedFeatures:d(n.deleteFeatureResults),addedAttachments:d(n.addAttachmentResults),updatedAttachments:d(n.updateAttachmentResults),deletedAttachments:d(n.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:n.editMoment?new Date(n.editMoment):null,globalIdToObjectId:s.globalIdToObjectId};return n.editedFeatureResults?.length&&(l.editedFeatures=n.editedFeatureResults),i.resolve(l),n}catch(d){throw i.reject(d),d}}async function $(e,t,r,s){if(await e.load(),!F(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!w(e))throw new a(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:i,options:n}=await E(e,r,s);return i.addFeatures?.length||i.updateFeatures?.length||i.deleteFeatures?.length||i.addAttachments?.length||i.updateAttachments?.length||i.deleteAttachments?.length?{edits:i,results:await t.applyEdits(i,n)}:{edits:i,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function E(e,t,r){const s=b(e),n=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),o=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),d=null!=e.infoFor3D;if(D(t,s,r,!!n,!!o,`${e.type}-layer`),!s.data.isVersioned&&r?.gdbVersion)throw new a(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!s.editing.supportsRollbackOnFailure&&r?.rollbackOnFailureEnabled)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");const l={...r};if(null!=l.rollbackOnFailureEnabled||s.editing.supportsRollbackOnFailure||(l.rollbackOnFailureEnabled=!0),l.rollbackOnFailureEnabled||"original-and-current-features"!==l.returnServiceEditsOption||(!1===l.rollbackOnFailureEnabled&&v().warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwritten and set to true."),l.rollbackOnFailureEnabled=!0),!s.editing.supportsReturnServiceEditsInSourceSpatialReference&&l.returnServiceEditsInSourceSR)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(l.returnServiceEditsInSourceSR&&"original-and-current-features"!==l.returnServiceEditsOption)throw new a(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const u=M(t,s,`${e.type}-layer`),p=r?.globalIdUsed||d,c=e.fields.filter(e=>"big-integer"===e.type||"oid"===e.type&&(e.length||0)>=8);if(p){const{globalIdField:t}=e;if(null==t)throw new a(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");u.addFeatures.forEach(e=>L(e,t))}u.addFeatures.forEach(t=>O(t,e,p,c)),u.updateFeatures.forEach(t=>k(t,e,p,c)),u.deleteFeatures.forEach(t=>j(t,e,p,c)),u.addAttachments.forEach(t=>U(t,e)),u.updateAttachments.forEach(t=>U(t,e)),d&&await V(u,e);const h=i(A,e,()=>new Map);return{edits:await T(u,s.data.supportedCurveTypes??[],h),options:l}}function S(e,t,r,s){if(r){if("attributes"in e&&!e.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if(s.length&&"attributes"in e)for(const i of s){const r=e.attributes[i.name];if(void 0!==r&&!y(i,r))throw new a(`${t.type}-layer:invalid-parameter`,`Big-integer field '${i.name}' of the feature must be less than ${Number.MAX_SAFE_INTEGER}`,{feature:e})}if("geometry"in e&&null!=e.geometry){if(e.geometry.hasZ&&!1===t.capabilities?.data.supportsZ)throw new a(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&!1===t.capabilities?.data.supportsM)throw new a(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function R(e,t){if("geometry"in e&&"mesh"===e.geometry?.type&&null!=t.infoFor3D&&null!=t.spatialReference){const{geometry:r}=e,{spatialReference:s,vertexSpace:i}=r,n=t.spatialReference,o="local"===i.type,d=l(n),h=u(n,s),m=h||p(n)&&(p(s)||c(s));if(!(o&&d&&m||!o&&!d&&h))throw new a(`${t.type}-layer:mesh-unsupported`,`Uploading a mesh with a ${i.type} vertex space and a spatial reference wkid:${s.wkid} to a layer with a spatial reference wkid:${n.wkid} is not supported.`)}}function O(e,t,a,r){S(e,t,a,r),R(e,t)}function j(e,t,a,r){S(e,t,a,r)}function k(e,t,r,s){S(e,t,r,s),R(e,t);const i=b(t);if("geometry"in e&&null!=e.geometry&&!i?.editing.supportsGeometryUpdate)throw new a(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function U(e,t){const{feature:r,attachment:s}=e;if(!r||"attributes"in r&&!r.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in r)&&!r.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!s.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!s.data&&!s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(s.data instanceof File&&!!s.data.name)&&!s.name)throw new a(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!t.capabilities?.editing.supportsUploadWithItemId&&s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if("string"==typeof s.data){const e=n(s.data);if(e&&!e.isBase64)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function L(e,t){const{attributes:a}=e;null==a[t]&&(a[t]=o())}async function T(e,t,a){const r=e.addFeatures??[],s=e.updateFeatures??[],i=r.concat(s).map(e=>e.geometry),n=await h(i,t,a),o=await d(n),l=r.length,u=s.length;return o.slice(0,l).forEach((e,t)=>r[t].geometry=e),o.slice(l,l+u).forEach((e,t)=>s[t].geometry=e),e}function B(e){return{addFeatures:Array.from(e?.addFeatures??[]),updateFeatures:Array.from(e?.updateFeatures??[]),deleteFeatures:e&&t.isCollection(e.deleteFeatures)?e.deleteFeatures.toArray():e.deleteFeatures||[],addAttachments:e.addAttachments||[],updateAttachments:e.updateAttachments||[],deleteAttachments:e.deleteAttachments||[]}}function M(e,t,r){const s=B(e);if(s.addFeatures?.length&&!t.operations.supportsAdd)throw new a(`${r}:unsupported-operation`,"Layer does not support adding features.");if(s.updateFeatures?.length&&!t.operations.supportsUpdate)throw new a(`${r}:unsupported-operation`,"Layer does not support updating features.");if(s.deleteFeatures?.length&&!t.operations.supportsDelete)throw new a(`${r}:unsupported-operation`,"Layer does not support deleting features.");return s.addFeatures=s.addFeatures.map(G),s.updateFeatures=s.updateFeatures.map(G),s.addAssetFeatures=[],s}function D(e,t,r,s,i,n){if(!(e&&(s||i)||r?.usingTelecomOperations))throw new a(`${n}:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");const o=t.editing.supportsGlobalId||r?.usingFeatureServiceEndpoint;if(!o&&r?.globalIdUsed)throw new a(`${n}:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!o&&i)throw new a(`${n}:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!r?.globalIdUsed&&i)throw new a(`${n}:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true")}function G(t){const a=new e;return t.attributes||(t.attributes={}),a.geometry=t.geometry,a.attributes=t.attributes,a}async function V(e,t){const{infoFor3D:r}=t;if(null==r)return;if(!g(r))throw new a(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??=[];const{addAssetFeatures:s}=e;for(const a of e.addFeatures??[])x(a)&&s.push(a);for(const a of e.updateFeatures??[])x(a)&&s.push(a)}function x(e){return"mesh"===e?.geometry?.type}function z(e,t,r,s){if(!F(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new a(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(r,s)}export{I as applyEdits,D as checkEditingCapabilities,B as normalizeCollections,M as normalizeEdits,T as processGeometries,G as shallowCloneFeature,z as uploadAssets};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{LoadableMixin as o}from"../../../core/Loadable.js";import s from"../../../core/Logger.js";import{EsriPromiseMixin as n}from"../../../core/Promise.js";import{open as a}from"../../../core/workers.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{ensureType as d}from"../../../core/accessorSupport/ensureType.js";import p from"../../../geometry/Extent.js";import c from"../../../geometry/Polygon.js";import{typeKebabDictionary as y}from"../../../geometry/support/typeUtils.js";import{createFeatureIdFromLayer as h}from"../data/createFeatureId.js";import{unapplyEditsZUnitScaling as m}from"../../../rest/query/operations/editsZScale.js";import f from"../../../rest/support/FeatureSet.js";import{shared as g}from"../../../core/accessorSupport/decorators/shared.js";let _=0,F=class extends(o(n(r))){constructor(e){super(e),this._idToClientGeometry=null,this.type="memory"}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}get _workerGeometryType(){const e=this.layer?.geometryType;return e?this._geometryTypeRequiresClientGraphicMapping(e)?"polygon":e:null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}async queryFeatures(e,t={}){await this.load(t);const r=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t),i=f.fromJSON(r);if(!this._requiresClientGraphicMapping()||!this._idToClientGeometry)return i;const o=this.layer.objectIdField;for(const s of i.features){const e=s.attributes[o],t=this._idToClientGeometry.get(e);void 0!==t&&(s.geometry=t)}return i.geometryType=this.layer.geometryType,i}async queryFeaturesJSON(e,t={}){if(this._requiresClientGraphicMapping())throw new i("query-features-json:unsupported","Cannot query in JSON format for client only geometry types (mesh and extent)");await this.load(t);return await this._connection.invoke("queryFeatures",e?e.toJSON():null,t)}queryFeatureCount(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t))}queryObjectIds(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryObjectIds",e?e.toJSON():null,t))}queryExtent(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryExtent",e?e.toJSON():null,t)).then(e=>({count:e.count,extent:p.fromJSON(e.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke("querySnapping",e,t))}async queryAttributeBins(e,t={}){await this.load();const r=await this._connection.invoke("queryAttributeBins",e?.toJSON(),t);return(await import("../../../rest/support/AttributeBinsFeatureSet.js")).default.fromJSON(r)}async _applyEdits(e){if(!this._connection)throw new i("feature-layer-source:edit-failure","Memory source not loaded");const t=this.layer.objectIdField,r=this.layer.uniqueIdFields;let o=null;const s=[],n=[];await Promise.all([this._prepareClientMapping(e.addFeatures,null),this._prepareClientMapping(e.updateFeatures,null)]);const a=e=>r?.length&&"attributes"in e?h(e,this.layer):"objectId"in e&&null!=e.objectId?e.objectId:"attributes"in e&&null!=e.attributes[t]?e.attributes[t]:null;if(e.addFeatures&&(o=this._prepareAddFeatures(e.addFeatures)),e.deleteFeatures)for(const i of e.deleteFeatures){const e=a(i);null!=e&&s.push(e)}const l=e.updateFeatures&&this._idToClientGeometry?new Map:null;if(e.updateFeatures)for(const i of e.updateFeatures)if(n.push(this._serializeFeature(i)),l&&null!=i.geometry){const e=a(i);null!=e&&l.set(e,i)}m(o?o.features:null,n,this.layer.spatialReference);const{fullExtent:u,featureEditResults:d}=await this._connection.invoke("applyEdits",{adds:o?o.features:[],updates:n,deletes:s});return this.fullExtent=u,o&&o.finish(d.uidToObjectId),this._updateIdToClientGeometries(l,d),this._createEditsResult(d)}async _prepareClientMapping(e,t){if("mesh"!==this._layerOrSourceGeometryType||null==e)return;const r=[];for(const{geometry:i}of e)null==i||"mesh"!==i.type||i.hasExtent||i.loaded||r.push(i.load({signal:t}));r.length&&await Promise.all(r)}_updateIdToClientGeometries(e,t){if(this._idToClientGeometry){if(e)for(const r of t.updateResults){if(!r.success)continue;const t=e.get(r.objectId);null!=t&&this._addIdToClientGeometry(t)}for(const e of t.deleteResults)e.success&&this._idToClientGeometry.delete(e.objectId)}}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){const t=!0===e.success?null:e.error||{code:void 0,description:""};return{objectId:e.objectId,globalId:e.globalId,error:t?new i("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_prepareAddFeatures(e){const t=new Map,r=new Array(e.length);let i=null;for(let s=0;s<e.length;s++){const o=e[s],n=this._serializeFeature(o);i||null==o.geometry||(i=o.geometry.type),r[s]=n,t.set(`${n.uid}`,o)}const o=this;return{features:r,inferredGeometryType:i,finish(e){const r=o.sourceJSON.objectIdField;for(const i in e){const s=e[i],n=t.get(i);n&&(n.attributes||(n.attributes={}),-1===s?delete n.attributes[r]:n.attributes[r]=s,o._addIdToClientGeometry(n))}}}}_addIdToClientGeometry(e){if(!this._idToClientGeometry)return;const t=this.sourceJSON.objectIdField,r=e.attributes?.[t];null!=r&&this._idToClientGeometry.set(r,e.geometry??null)}get _layerOrSourceGeometryType(){return this.layer?.geometryType??this.sourceJSON?.geometryType}_requiresClientGraphicMapping(){return this._geometryTypeRequiresClientGraphicMapping(this._layerOrSourceGeometryType)}_geometryRequiresClientGraphicMapping(e){return this._geometryTypeRequiresClientGraphicMapping(e.type)}_geometryTypeRequiresClientGraphicMapping(e){return"mesh"===e||"multipatch"===e||"extent"===e}_serializeFeature(e){const{attributes:t}=e,r=this._geometryForSerialization(e),i=(_++).toString();return r?{uid:i,geometry:r.toJSON(),attributes:t}:{uid:i,attributes:t}}_geometryForSerialization(e){const{geometry:t}=e;if(null==t)return null;if(this._geometryRequiresClientGraphicMapping(t)){return t.extent?c.fromExtent(t.extent):null}return t}async _startWorker(e){this._connection=await a("MemorySourceWorker",{strategy:has("feature-layers-workers")?"dedicated":"local",signal:e,registryTarget:this});const{fields:t,spatialReference:r,objectIdField:i,hasM:o,hasZ:n,timeInfo:l,dateFieldsTimeZone:u}=this.layer,d="defaults"===this.layer.originOf("spatialReference");await this._prepareClientMapping(this.items,e);const p=this._prepareAddFeatures(this.items);this.addHandles(this.on("before-changes",e=>{s.getLogger(this).error("Source modifications will not propagate after layer has been loaded. Please use .applyEdits() instead"),e.preventDefault()}));const{uniqueIdFields:c}=this.layer,h=c?.length?{type:c.length>1?"composite":"simple",fields:c.slice(),OIDFieldContainsHashValue:!(1===c?.length&&c.at(0)===this.layer.objectIdField)}:void 0,m={features:p.features,fields:t?.map(e=>e.toJSON()),geometryType:y.toJSON(this._workerGeometryType),hasM:"mesh"!==this._layerOrSourceGeometryType&&o,hasZ:"mesh"===this._layerOrSourceGeometryType||n,objectIdField:i,spatialReference:d?null:r&&r.toJSON(),timeInfo:l?.toJSON()??null,dateFieldsTimeZone:u,uniqueIdInfo:h},f=await this._connection.invoke("load",m,{signal:e});for(const a of f.warnings)s.getLogger(this.layer).warn("#load()",`${a.message} (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{warning:a});f.featureErrors.length&&s.getLogger(this.layer).error("#load()",`Failed to load ${f.featureErrors.length} features due to errors. (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}').`,f.featureErrors.map(e=>"\n\n- "+e.error.description).join(""));const g=f.layerDefinition;this._geometryTypeRequiresClientGraphicMapping(p.inferredGeometryType)&&(g.geometryType=y.toJSON(p.inferredGeometryType)),this.sourceJSON=g,this._requiresClientGraphicMapping()&&(this._idToClientGeometry=new Map),p.finish(f.assignedObjectIds)}};e([g({Type:t,ensureType:d(t)})],F.prototype,"itemType",void 0),e([l()],F.prototype,"type",void 0),e([l({constructOnly:!0})],F.prototype,"layer",void 0),e([l({readOnly:!0})],F.prototype,"_workerGeometryType",null),e([l()],F.prototype,"sourceJSON",void 0),F=e([u("esri.layers.graphics.sources.MemorySource")],F);export{F as MemorySource};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{LoadableMixin as o}from"../../../core/Loadable.js";import s from"../../../core/Logger.js";import{EsriPromiseMixin as n}from"../../../core/Promise.js";import{isAborted as a,createAbortError as l}from"../../../core/promiseUtils.js";import{open as u}from"../../../core/workers.js";import{property as c,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ensureType as d}from"../../../core/accessorSupport/ensureType.js";import y from"../../../geometry/Extent.js";import h from"../../../geometry/Polygon.js";import{typeKebabDictionary as m}from"../../../geometry/support/typeUtils.js";import{createFeatureIdFromLayer as f}from"../data/createFeatureId.js";import{unapplyEditsZUnitScaling as g}from"../../../rest/query/operations/editsZScale.js";import _ from"../../../rest/support/FeatureSet.js";import{shared as F}from"../../../core/accessorSupport/decorators/shared.js";let T=0,w=class extends(o(n(r))){constructor(e){super(e),this._idToClientGeometry=null,this.type="memory"}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}get _workerGeometryType(){const e=this.layer?.geometryType;return e?this._geometryTypeRequiresClientGraphicMapping(e)?"polygon":e:null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}async queryFeatures(e,t={}){if(await this.load(t),a(t)||null==this._connection)throw l();const r=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t),i=_.fromJSON(r);if(!this._requiresClientGraphicMapping()||!this._idToClientGeometry)return i;const o=this.layer.objectIdField;for(const s of i.features){const e=s.attributes[o],t=this._idToClientGeometry.get(e);void 0!==t&&(s.geometry=t)}return i.geometryType=this.layer.geometryType,i}async queryFeaturesJSON(e,t={}){if(this._requiresClientGraphicMapping())throw new i("query-features-json:unsupported","Cannot query in JSON format for client only geometry types (mesh and extent)");if(await this.load(t),a(t)||null==this._connection)throw l();return await this._connection.invoke("queryFeatures",e?e.toJSON():null,t)}async queryFeatureCount(e,t={}){if(await this.load(t),a(t)||null==this._connection)throw l();return this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t)}async queryObjectIds(e,t={}){if(await this.load(t),a(t)||null==this._connection)throw l();return this._connection.invoke("queryObjectIds",e?e.toJSON():null,t)}async queryExtent(e,t={}){if(await this.load(t),a(t)||null==this._connection)throw l();const r=await this._connection.invoke("queryExtent",e?e.toJSON():null,t);return{count:r.count,extent:y.fromJSON(r.extent)}}async querySnapping(e,t={}){if(await this.load(t),a(t)||null==this._connection)throw l();return this._connection.invoke("querySnapping",e,t)}async queryAttributeBins(e,t={}){if(await this.load(t),a(t)||null==this._connection)throw l();const r=await this._connection.invoke("queryAttributeBins",e?.toJSON(),t);return(await import("../../../rest/support/AttributeBinsFeatureSet.js")).default.fromJSON(r)}async _applyEdits(e){if(!this._connection)throw new i("feature-layer-source:edit-failure","Memory source not loaded");const t=this.layer.objectIdField,r=this.layer.uniqueIdFields;let o=null;const s=[],n=[];await Promise.all([this._prepareClientMapping(e.addFeatures,null),this._prepareClientMapping(e.updateFeatures,null)]);const a=e=>r?.length&&"attributes"in e?f(e,this.layer):"objectId"in e&&null!=e.objectId?e.objectId:"attributes"in e&&null!=e.attributes[t]?e.attributes[t]:null;if(e.addFeatures&&(o=this._prepareAddFeatures(e.addFeatures)),e.deleteFeatures)for(const i of e.deleteFeatures){const e=a(i);null!=e&&s.push(e)}const l=e.updateFeatures&&this._idToClientGeometry?new Map:null;if(e.updateFeatures)for(const i of e.updateFeatures)if(n.push(this._serializeFeature(i)),l&&null!=i.geometry){const e=a(i);null!=e&&l.set(e,i)}g(o?o.features:null,n,this.layer.spatialReference);const{fullExtent:u,featureEditResults:c}=await this._connection.invoke("applyEdits",{adds:o?o.features:[],updates:n,deletes:s});return this.fullExtent=u,o&&o.finish(c.uidToObjectId),this._updateIdToClientGeometries(l,c),this._createEditsResult(c)}async _prepareClientMapping(e,t){if("mesh"!==this._layerOrSourceGeometryType||null==e)return;const r=[];for(const{geometry:i}of e)null==i||"mesh"!==i.type||i.hasExtent||i.loaded||r.push(i.load({signal:t}));r.length&&await Promise.all(r)}_updateIdToClientGeometries(e,t){if(this._idToClientGeometry){if(e)for(const r of t.updateResults){if(!r.success)continue;const t=e.get(r.objectId);null!=t&&this._addIdToClientGeometry(t)}for(const e of t.deleteResults)e.success&&this._idToClientGeometry.delete(e.objectId)}}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){const t=!0===e.success?null:e.error||{code:void 0,description:""};return{objectId:e.objectId,globalId:e.globalId,error:t?new i("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_prepareAddFeatures(e){const t=new Map,r=new Array(e.length);let i=null;for(let s=0;s<e.length;s++){const o=e[s],n=this._serializeFeature(o);i||null==o.geometry||(i=o.geometry.type),r[s]=n,t.set(`${n.uid}`,o)}const o=this;return{features:r,inferredGeometryType:i,finish(e){const r=o.sourceJSON.objectIdField;for(const i in e){const s=e[i],n=t.get(i);n&&(n.attributes||(n.attributes={}),-1===s?delete n.attributes[r]:n.attributes[r]=s,o._addIdToClientGeometry(n))}}}}_addIdToClientGeometry(e){if(!this._idToClientGeometry)return;const t=this.sourceJSON.objectIdField,r=e.attributes?.[t];null!=r&&this._idToClientGeometry.set(r,e.geometry??null)}get _layerOrSourceGeometryType(){return this.layer?.geometryType??this.sourceJSON?.geometryType}_requiresClientGraphicMapping(){return this._geometryTypeRequiresClientGraphicMapping(this._layerOrSourceGeometryType)}_geometryRequiresClientGraphicMapping(e){return this._geometryTypeRequiresClientGraphicMapping(e.type)}_geometryTypeRequiresClientGraphicMapping(e){return"mesh"===e||"multipatch"===e||"extent"===e}_serializeFeature(e){const{attributes:t}=e,r=this._geometryForSerialization(e),i=(T++).toString();return r?{uid:i,geometry:r.toJSON(),attributes:t}:{uid:i,attributes:t}}_geometryForSerialization(e){const{geometry:t}=e;if(null==t)return null;if(this._geometryRequiresClientGraphicMapping(t)){return t.extent?h.fromExtent(t.extent):null}return t}async _startWorker(e){this._connection=await u("MemorySourceWorker",{strategy:has("feature-layers-workers")?"dedicated":"local",signal:e,registryTarget:this});const{fields:t,spatialReference:r,objectIdField:i,hasM:o,hasZ:n,timeInfo:a,dateFieldsTimeZone:l}=this.layer,c="defaults"===this.layer.originOf("spatialReference");await this._prepareClientMapping(this.items,e);const p=this._prepareAddFeatures(this.items);this.addHandles(this.on("before-changes",e=>{s.getLogger(this).error("Source modifications will not propagate after layer has been loaded. Please use .applyEdits() instead"),e.preventDefault()}));const{uniqueIdFields:d}=this.layer,y=d?.length?{type:d.length>1?"composite":"simple",fields:d.slice(),OIDFieldContainsHashValue:!(1===d?.length&&d.at(0)===this.layer.objectIdField)}:void 0,h={features:p.features,fields:t?.map(e=>e.toJSON()),geometryType:m.toJSON(this._workerGeometryType),hasM:"mesh"!==this._layerOrSourceGeometryType&&o,hasZ:"mesh"===this._layerOrSourceGeometryType||n,objectIdField:i,spatialReference:c?null:r&&r.toJSON(),timeInfo:a?.toJSON()??null,dateFieldsTimeZone:l,uniqueIdInfo:y},f=await this._connection.invoke("load",h,{signal:e});for(const u of f.warnings)s.getLogger(this.layer).warn("#load()",`${u.message} (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{warning:u});f.featureErrors.length&&s.getLogger(this.layer).error("#load()",`Failed to load ${f.featureErrors.length} features due to errors. (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}').`,f.featureErrors.map(e=>"\n\n- "+e.error.description).join(""));const g=f.layerDefinition;this._geometryTypeRequiresClientGraphicMapping(p.inferredGeometryType)&&(g.geometryType=m.toJSON(p.inferredGeometryType)),this.sourceJSON=g,this._requiresClientGraphicMapping()&&(this._idToClientGeometry=new Map),p.finish(f.assignedObjectIds)}};e([F({Type:t,ensureType:d(t)})],w.prototype,"itemType",void 0),e([c()],w.prototype,"type",void 0),e([c({constructOnly:!0})],w.prototype,"layer",void 0),e([c({readOnly:!0})],w.prototype,"_workerGeometryType",null),e([c()],w.prototype,"sourceJSON",void 0),w=e([p("esri.layers.graphics.sources.MemorySource")],w);export{w as MemorySource};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{EventedMixin as r}from"../../../core/Evented.js";import{Loadable as s}from"../../../core/Loadable.js";import o from"../../../core/Logger.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as i}from"../../../core/reactiveUtils.js";import{open as n}from"../../../core/workers.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import y from"../../../geometry/Extent.js";import{createFileProviderSchema as l,toParquetJSONGeometryType as p}from"../../support/parquetUtils.js";import m from"../../../rest/support/FeatureSet.js";let d=class extends(r(s)){constructor(t){super(t),this.type="parquet"}load(t){const e=null!=t?t.signal:null;return this.addResolvingPromise(this._initialize(e)),this.addHandles([i(()=>this.layer.data,async t=>{t&&await this._proxy.updateFileProvider(await l(t))}),i(()=>this.layer.customParameters,t=>this._setCustomParameters(t))]),Promise.resolve(this)}async reload(t){const e=await this._createLoadParameters(t);return this._proxy.reload(e)}destroy(){this._connection?.destroy()}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeaturesJSON(t,e={}){return await this.load(e),this._proxy.queryFeatures(t.toJSON(),{signal:e?.signal})}async queryFeatures(t,e={}){const r=await this.queryFeaturesJSON(t,{signal:e?.signal});return m.fromJSON(r)}async queryObjectIds(t,e){return await this._proxy.queryObjectIds(t.toJSON(),{signal:e?.signal})}async queryFeatureCount(t,e){return this._proxy.queryFeatureCount(t.toJSON(),{signal:e?.signal})}async queryExtent(t,e){if(null==this.layer.geometryEncoding)return o.getLogger(this).warn("Tried to queryExtent, but source does not have a geometry. Returning null extent."),{count:0,extent:null};const r=await this._proxy.queryExtent(t.toJSON(),{signal:e?.signal});return{count:r.count,extent:y.fromJSON(r.extent)}}async _initialize(t){const e={onSourceChange:()=>this.emit("source-changed")};this._connection=await n("ParquetSourceWorker",{strategy:"dedicated",signal:t,registryTarget:this,client:e}),a(t),this._proxy=this._connection.createInvokeProxy();const r=await this._createLoadParameters(t),{layerDefinition:s,capabilities:o}=await this._proxy.load(r);a(t),this.sourceJSON=s,this.capabilities=o}async _createLoadParameters(t){if(!this.layer.data)throw new e("parquet:missing-data","A data source must be specified",this.layer);const r=await l(this.layer.data,{signal:t});return a(t),{provider:r,fields:this.layer.fields?.map(t=>t.toJSON()),geometryType:this.layer.geometryType?p(this.layer.geometryType):null,spatialReference:this.layer.spatialReference?.toJSON(),geometryEncoding:this.layer.geometryEncoding?.toJSON(),displayOptimization:this.layer.displayOptimization,customParameters:this.layer.customParameters}}_setCustomParameters(t){this._proxy.setCustomParameters(t).catch(()=>{o.getLogger(this).warn("Failed to update customParameters")})}_queryStream(t,e){return this._proxy.queryStream(t,e)}_getStreamNextFeatures(t,e){return this._proxy.getStreamNextFeatures(t,e)}};t([c()],d.prototype,"type",void 0),t([c({constructOnly:!0})],d.prototype,"layer",void 0),t([c()],d.prototype,"sourceJSON",void 0),t([c()],d.prototype,"capabilities",void 0),d=t([u("esri.layers.graphics.sources.ParquetSource")],d);export{d as ParquetSource};
2
+ import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{EventedMixin as r}from"../../../core/Evented.js";import{Loadable as s}from"../../../core/Loadable.js";import o from"../../../core/Logger.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as i}from"../../../core/reactiveUtils.js";import{open as n}from"../../../core/workers.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import y from"../../../geometry/Extent.js";import{createFileProviderSchema as l,toParquetJSONGeometryType as p}from"../../support/parquetUtils.js";import m from"../../../rest/support/FeatureSet.js";let h=class extends(r(s)){constructor(t){super(t),this.type="parquet"}load(t){const e=null!=t?t.signal:null;return this.addResolvingPromise(this._initialize(e)),this.addHandles([i(()=>this.layer.data,async t=>{if(t)try{await this._proxy.updateFileProvider(await l(t))}catch{}}),i(()=>this.layer.customParameters,t=>this._setCustomParameters(t))]),Promise.resolve(this)}async reload(t){const e=await this._createLoadParameters(t);return this._proxy.reload(e)}destroy(){this._connection?.destroy()}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeaturesJSON(t,e={}){return await this.load(e),this._proxy.queryFeatures(t.toJSON(),{signal:e?.signal})}async queryFeatures(t,e={}){const r=await this.queryFeaturesJSON(t,{signal:e?.signal});return m.fromJSON(r)}async queryObjectIds(t,e){return await this._proxy.queryObjectIds(t.toJSON(),{signal:e?.signal})}async queryFeatureCount(t,e){return this._proxy.queryFeatureCount(t.toJSON(),{signal:e?.signal})}async queryExtent(t,e){if(null==this.layer.geometryEncoding)return o.getLogger(this).warn("Tried to queryExtent, but source does not have a geometry. Returning null extent."),{count:0,extent:null};const r=await this._proxy.queryExtent(t.toJSON(),{signal:e?.signal});return{count:r.count,extent:y.fromJSON(r.extent)}}async _initialize(t){const e={onSourceChange:()=>this.emit("source-changed")};this._connection=await n("ParquetSourceWorker",{strategy:"dedicated",signal:t,registryTarget:this,client:e}),a(t),this._proxy=this._connection.createInvokeProxy();const r=await this._createLoadParameters(t),{layerDefinition:s,capabilities:o}=await this._proxy.load(r);a(t),this.sourceJSON=s,this.capabilities=o}async _createLoadParameters(t){if(!this.layer.data)throw new e("parquet:missing-data","A data source must be specified",this.layer);const r=await l(this.layer.data,{signal:t});return a(t),{provider:r,fields:this.layer.fields?.map(t=>t.toJSON()),geometryType:this.layer.geometryType?p(this.layer.geometryType):null,spatialReference:this.layer.spatialReference?.toJSON(),geometryEncoding:this.layer.geometryEncoding?.toJSON(),displayOptimization:this.layer.displayOptimization,customParameters:this.layer.customParameters}}_setCustomParameters(t){this._proxy.setCustomParameters(t).catch(()=>{o.getLogger(this).warn("Failed to update customParameters")})}_queryStream(t,e){return this._proxy.queryStream(t,e)}_getStreamNextFeatures(t,e){return this._proxy.getStreamNextFeatures(t,e)}};t([c()],h.prototype,"type",void 0),t([c({constructOnly:!0})],h.prototype,"layer",void 0),t([c()],h.prototype,"sourceJSON",void 0),t([c()],h.prototype,"capabilities",void 0),h=t([u("esri.layers.graphics.sources.ParquetSource")],h);export{h as ParquetSource};
@@ -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 i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as n,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import c from"../../../../geometry/SpatialReference.js";import{set as p,create as d,expandWithAABB as f,expandWithRect as m,negativeInfinity as y}from"../../../../geometry/support/aaBoundingBox.js";import{copy as h,negativeInfinity as g,create as _,expandWithRect as w}from"../../../../geometry/support/aaBoundingRect.js";import{getScaleForResolution as x}from"../../../../geometry/support/scaleUtils.js";import{isWebMercator as F,isWGS84 as S}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertToGeometry as I}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as v}from"../../data/attributeSupport.js";import{getQueryResultExtent as q,getQueryBoundingRects as R,QueryEngine as C}from"../../data/QueryEngine.js";import{queryCapabilities as b}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as O}from"../../data/queryUtils.js";import{createFileProvider as P}from"../parquet/createFileProvider.js";import{createDrawingInfo as T}from"./clientSideDefaults.js";import{getParquetFileId as j,getParquetRowId as Q,getParquetObjectId as M}from"./parquetIdUtils.js";import N from"../../../support/Field.js";import A from"../../../support/FieldsIndex.js";import{isNumericField as B}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as G}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as D,fromParquetJSONGeometryType as z,toParquetJSONGeometryType as V}from"../../../support/parquetUtils.js";import{loadParquetModule as W}from"../../../../libs/parquet/loadParquetModule.js";import{FeatureStoreQueryAdapter as U}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as k}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 Z}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as L}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const H=new U,Y=4,X="__OBJECTID",$=new TextDecoder,K=8e3,ee=2e7,te=8,re=2,se=20;class ie{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;){u(e),await this._fill(e);const t=await ae(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<te;){const t=this._getOrCreateNextStream(e);if(null==t)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){const t=this._resolvedCount>=te?te:re;if(this._fileIndex<this._files.length&&this._streams.length<t){const t=this._files[this._fileIndex++],r=new ne(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 ae(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class ne{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 ue{constructor(){this._queue=new o({concurrency:Y,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){const t=e.spatialReference?c.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=P(e.provider,null,()=>this._customParameters),this._handles.add(this._provider.events.on("sourceChanged",async()=>{await this.reload(e),await this._source.onSourceChange()}));const r=await this._provider.getMetadata(),i=await D(r,{fields:e.fields?.map(e=>N.fromJSON(e)),geometryEncoding:e.geometryEncoding?G(e.geometryEncoding):null,geometryType:e.geometryType?z(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(!i.fields)throw new s("parquet:unsupported","Fields must be defined");let n;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new s("parquet:unsupported","SpatialReference must be defined");if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:i.spatialReference}),i.spatialReference=c.WGS84),n={geometry:i.geometryEncoding?{geometryType:V(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(n),this._capabilities=Ee(await this._getFileStatistics());const u=await this._provider.getFiles();if(!u.length)return{layerDefinition:{},capabilities:Ee(null)};const o=await u[0].file;i.file=o;const{fields:l}=i;if(null==l)throw new s("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",l);l.push(new N({name:X,type:"oid",alias:X}));for(const s of l){const e=o.getColumnId(s.name);null!=e&&(this._indexMap[s.name]=e)}const p=new A(l.map(e=>e.toJSON()));this._fieldsIndex=p;const d=V(i.geometryType??"point");return this._metadata=Z.createFeature({fieldsIndex:p.toJSON(),geometryType:d,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:X},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:d,featureIdInfo:{type:"object-id",fieldName:X},hasM:!1,hasZ:!1,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:T(d),extent:this._fullExtent??void 0,geometryType:d,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy("")}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._provider=P(e,this._provider.getGeometryInfo(),()=>this._customParameters)}async queryFeatures(e,t){const r=await O(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),Oe(r)||(r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,K):K,r.resultOffset=r.resultOffset??0),r.outStatistics)return this._queryStatistics(r,t);r.returnDistinctValues&&(r.returnGeometry=void 0);return(await this._enqueueQuery(r,t)).createQueryResponse()}async queryFeatureCount(e,t){const r=await O(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!pe(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 O(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!pe(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 queryAttributeBins(e,t={}){throw new s("parquet:unsupported","queryAttributeBins not supported.")}async queryExtent(e,t){const s=await O(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!pe(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(d(),y),n=d(),u=await this._enqueueQuery(s,t);let o=0;for(const r of u.items)r.getBounds(n)&&(f(a,n),o+=1);return{count:o,extent:q(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 ie(r,async(t,r)=>{const s=await t.file,i=await this._createParquetDisplayQuery(s,t.id,e);return s.executeQuery(i,K,r)}),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:s,handle:a}),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 getStreamNextFeatures(e,t){const{result:r}=await this.getStreamNext(e,t);if(null==r)return null;const s=(await W()).ParquetChunk.deserialize(new Uint8Array(r.buffer)),i=new L(this._metadata,this._indexMap,s,r.fileId),a=[];for(;i.next();){const e=I(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features: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?Ie(s,r):s}async _queryStatistics(e,t){const r=await O({...e},null,this._queryEngineParams.spatialReference);if(r.returnGeometry=void 0,me(r,this._fieldsIndex)){const e=await this._getStatisticsFromFiles(r);if(e)return e}return(await this._enqueueQuery(r,t)).createQueryResponse()}async _getStatisticsFromFiles(e){const t=await this._provider.getFiles(),r={},s=[];for(const i of e.outStatistics??[]){const e=ge(i,t);if(!e.available)return null;r[i.outStatisticFieldName]=e.value,s.push(he(i,this._fieldsIndex))}return{fields:s,features:[{attributes:r}]}}async _getSpatialFilePruning(e){if("tile"!==e.type&&("arcade"!==e.type||null==e.extent))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 W();switch(r.type){case"xz":return{type:"xz",fieldName:r.code,intersects:(t,n)=>a.queryIntersectsXZStatistics(r.fullExtent,e.extent,s,i,se,t,n)};case"z":return{type:"xy",xFieldName:r.xColumn,yFieldName:r.yColumn,intersects:(t,r,n,u)=>a.queryIntersectsXYStatistics(e.extent,s,i,t,r,n,u)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case"xz":{const r=Se(e,t);return null==r||Re(r,t)}case"xy":{const{xStatistics:r,yStatistics:s}=qe(e,t);return null==r||null==s||Ce(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,u=p(d(),y);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),o=[t.minValue(),s.minValue(),t.maxValue(),s.maxValue()];m(u,o),r.free()}catch(s){i.error=s,i.hasError=!0}finally{t(i)}}}return{xmin:u[0],ymin:u[1],xmax:u[3],ymax:u[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,r,s,i){const a=(await W()).Query.new();null!=r&&a.setPreFilterStart(r),null!=s&&a.setPreFilterCount(s),null!=i&&a.setPostFilterCount(i);const n=await this._getRequiredFields(e);a.setOutFields(n),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0);const u=this._tryGetGeneralizedGeometryScale(e);null!=u&&a.setScale(u);const o=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=o.wkid;if(e.geometry&&(F(o)||S(o))){const t=h(_(),g);for(const r of R(e.geometry))w(t,r);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){const{id:r,file:s}=t;await this._setWhereClause(a,await s,r,e.where)}return a}async _createParquetDisplayQuery(e,t,r){const s=(await W()).Query.new();return"tile"===r.type?(s.setExtent(r.extent),s.setQuantizationTransform(r.transform),s.setScale(r.scale)):"arcade"===r.type&&null!=r.extent&&s.setExtent(r.extent),s.setOutFields(r.outFields.filter(e=>null!=this._indexMap[e])),s.setOutSpatialReference(r.outSpatialReference.wkid),s.setReturnGeometry(r.returnGeometry),r.where&&await this._setWhereClause(s,e,t,r.where),s}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,i){const a=this._indexMap,n=this._fieldsIndex,u={getAttribute(e,s){const i=a[s];if(null==i){const t=n.get(s);if("__OBJECTID"===t?.name){const t=e.row+e.rowGroupStart;return M(r,t)}return null}const u=t.readAttribute(e.rowGroup,e.row,i);if(null==u)return null;const o=n.get(s);return"esriFieldTypeString"===o.type||"esriFieldTypeDateOnly"===o.type||"esriFieldTypeTimeOnly"===o.type||"esriFieldTypeTimestampOffset"===o.type?$.decode(u):u}},o=await l(i,this._fieldsIndex);if(!o.isStandardized)throw new s("sql-parse-error","expression is not standardized");const c=(e,t,r)=>o.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:r},u,null),p=o.fieldNames.map(e=>n.get(e)).filter(e=>e&&null!=this._indexMap[e?.name]);e.setWhere(i),e.setWhereEvaluator(c),e.setWhereFields(p.map(e=>e.name))}async*_streamFeatures(e,t,r,s,i){const a=await this._provider.getFiles();let n=0;for(const u of a){const a=n,o=n+u.statistics.rowCount;if(n+=u.statistics.rowCount,null!=t&&t>=o)continue;const l=null!=t?Math.max(t-a,0):null;let c=r;if(null!=r){const e=t??0,s=e+r,i=Math.max(e,a),n=Math.min(s,o);c=Math.max(n-i,0)}if(0===c)continue;const p=await this._createParquetQuery(e,u,l,c,s),d=await u.file,f=await d.executeQuery(p,K),m=async()=>{const e=await f.next(i);if(!e)return null;const t=new L(this._metadata,this._indexMap,e,u.id);return Fe([new k(t,null,0,!1)],this._queryEngineParams)};let y=await m();for(;null!=y;)yield y,y=await m()}}async _queryFeaturesWithQueryEnginePagination(e,t){const r=[],s=this._streamFeatures(e,null,null,null,t);let i=await s.next();for(;!i.done;){const a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(const e of a)r.push(e);i=await s.next()}return r}async _queryFeaturesWithUpfrontPagination(e,t){let r,s,i,a=e.resultOffset??0,n=e.resultRecordCount??K;de(e)?fe(e)||(i=a+n):(a&&(r=a,a=0),s=e.resultRecordCount);const u=[],o=this._streamFeatures(e,r,s,i,t);let l=await o.next();for(;!l.done&&n>0;){const r=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(const e of r)if(a>0)a--;else if(u.push(e),--n<=0)return u;l=await o.next()}return u}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){const r=new Map;for(const t of e.objectIds){const e=j(t),s=Q(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 E(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:H,featureIdInfo:this._queryEngineParams.featureIdInfo})}if("1=1"===e.where&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>ee){if(!(this._displayOptimization&&e.geometry))throw new s("parquet:cannot-execute-query","Unable to execute query, dataset is too large.")}const r=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=r?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return r||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:H,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,r,s){const i=await this._getRequiredFields(e),a=(await W()).Query.new();a.setOutFields(i),a.setReturnGeometry(!!e.returnGeometry),a.setIds(new Uint32Array(r));const n=await this._getFile(t),u=await n.executeQuery(a,K,s);let o=await u.next(s),l=0;const c=[];for(;null!=o;){const e=new L(this._metadata,this._indexMap,o,t),r=new k(e,null,l++,!1);c.push(r),o=await u.next(s)}return Fe(c,this._queryEngineParams).executeQueryForOpaqueFeatures(e,s)}async _getRequiredFields(e){const t=new Set;if(e.outStatistics)for(const r of v(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(r);else if(e.outFields)for(const r of e.outFields)t.add(r);return(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e])}_tryGetGeneralizedGeometryScale(e){if(!this._displayOptimization)return null;const t=e.outSR??this._queryEngineParams.spatialReference;if(!F(t)&&!S(t))return null;const r=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return r?x(r,t):null}}function oe(e){switch(e){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":case"resultOffset":case"resultRecordCount":return!0;default:return!1}}function le(e){switch(e){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":return!0;default:return!1}}function ce(e){switch(e){case"fullText":case"having":case"timeExtent":return!0;case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"resultOffset":case"geometry":case"resultRecordCount":return!1}return!1}function pe(e){for(const t in e){const r=t;if(oe(r)&&null!==e[r])return!0}return!1}function de(e){for(const t in e){const r=t;if(le(r)&&null!==e[r])return!0}return!1}function fe(e){for(const t in e){const r=t;if(ce(r)&&null!==e[r])return!0}return!1}function me(e,t){return!!e.outStatistics?.length&&!pe(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case"count":return"1"===e.onStatisticField||null!=t.get(e.onStatisticField);case"min":case"max":{const r=t.get(e.onStatisticField);return null!=r&&B(r)}default:return!1}}function he(e,t){const r="exceedslimit"!==e.statisticType?t.get(e.onStatisticField):null,s="min"!==e.statisticType&&"max"!==e.statisticType||"esriFieldTypeDate"!==r?.type?"esriFieldTypeDouble":r.type;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:s}}function ge(e,t){switch(e.statisticType){case"count":return _e(e,t);case"min":return we(e,t,Math.min);case"max":return we(e,t,Math.max);default:return{available:!1,value:null}}}function _e(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 r=0;for(const s of t){const t=s.statistics.statistics.get(e.onStatisticField);if(null==t||null==t.nullCount)return{available:!1,value:null};r+=s.statistics.rowCount-t.nullCount}return{available:!0,value:r}}function we(e,t,r){if("min"!==e.statisticType&&"max"!==e.statisticType)return{available:!1,value:null};let s=null;const i="min"===e.statisticType?"minValue":"maxValue";for(const a of t){const t=a.statistics.statistics.get(e.onStatisticField);if(null==t)return{available:!1,value:null};const n=xe(t[i]);null!=n&&(s=null==s?n:r(s,n))}return{available:!0,value:s}}function xe(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function Fe(e,t){const r=new J;for(const s of e)r.insert(s);return new C({...t,featureStore:r})}function Se(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ie(e,t){return e.slice().sort((e,r)=>{const s=ve(e,t),i=ve(r,t);return s===i?0:s<i?-1:1})}function ve(e,t){const r=Se(e,t);if(null==r)return Number.POSITIVE_INFINITY;const s=be(r.minValue),i=be(r.maxValue);return null==s||null==i||i<s?Number.POSITIVE_INFINITY:i-s}function qe(e,t){return{xStatistics:e.statistics.statistics.get(t.xFieldName)??null,yStatistics:e.statistics.statistics.get(t.yFieldName)??null}}function Re(e,t){const r=be(e.minValue),s=be(e.maxValue);return null==r||null==s||t.intersects(r,s)}function Ce(e,t,r){const s=be(e.minValue),i=be(e.maxValue),a=be(t.minValue),n=be(t.maxValue);return null==s||null==i||null==a||null==n||r.intersects(s,i,a,n)}function be(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function Ee(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:{...b,maxRecordCount:K,supportsOrderBy:r,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 Oe(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{ue as default};
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 i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as n,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import c from"../../../../geometry/SpatialReference.js";import{set as p,create as d,expandWithAABB as f,expandWithRect as m,negativeInfinity as y}from"../../../../geometry/support/aaBoundingBox.js";import{copy as h,negativeInfinity as g,create as _,expandWithRect as w}from"../../../../geometry/support/aaBoundingRect.js";import{getScaleForResolution as x}from"../../../../geometry/support/scaleUtils.js";import{isWebMercator as F,isWGS84 as S}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertToGeometry as I}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as v}from"../../data/attributeSupport.js";import{getQueryResultExtent as q,getQueryBoundingRects as R,QueryEngine as C}from"../../data/QueryEngine.js";import{queryCapabilities as b}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as O}from"../../data/queryUtils.js";import{createFileProvider as P}from"../parquet/createFileProvider.js";import{createDrawingInfo as T}from"./clientSideDefaults.js";import{getParquetFileId as j,getParquetRowId as Q,getParquetObjectId as M}from"./parquetIdUtils.js";import N from"../../../support/Field.js";import A from"../../../support/FieldsIndex.js";import{isNumericField as B}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as G}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as D,fromParquetJSONGeometryType as z,toParquetJSONGeometryType as V}from"../../../support/parquetUtils.js";import{loadParquetModule as W}from"../../../../libs/parquet/loadParquetModule.js";import{FeatureStoreQueryAdapter as U}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as k}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 Z}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as L}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const H=new U,Y=4,X="__OBJECTID",$=new TextDecoder,K=8e3,ee=2e7,te=8,re=2,se=20;class ie{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;){u(e),await this._fill(e);const t=await ae(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<te;){const t=this._getOrCreateNextStream(e);if(null==t)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){const t=this._resolvedCount>=te?te:re;if(this._fileIndex<this._files.length&&this._streams.length<t){const t=this._files[this._fileIndex++],r=new ne(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 ae(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class ne{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 ue{constructor(){this._queue=new o({concurrency:Y,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){const t=e.spatialReference?c.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=P(e.provider,null,()=>this._customParameters),this._handles.add(this._provider.events.on("sourceChanged",async()=>{await this.reload(e),await this._source.onSourceChange()}));const r=await this._provider.getMetadata(),i=await D(r,{fields:e.fields?.map(e=>N.fromJSON(e)),geometryEncoding:e.geometryEncoding?G(e.geometryEncoding):null,geometryType:e.geometryType?z(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(!i.fields)throw new s("parquet:unsupported","Fields must be defined");let n;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new s("parquet:unsupported","SpatialReference must be defined");if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:i.spatialReference}),i.spatialReference=c.WGS84),n={geometry:i.geometryEncoding?{geometryType:V(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(n),this._capabilities=Ee(await this._getFileStatistics());const u=await this._provider.getFiles();if(!u.length)return{layerDefinition:{},capabilities:Ee(null)};const o=await u[0].file;i.file=o;const{fields:l}=i;if(null==l)throw new s("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",l);l.push(new N({name:X,type:"oid",alias:X}));for(const s of l){const e=o.getColumnId(s.name);null!=e&&(this._indexMap[s.name]=e)}const p=new A(l.map(e=>e.toJSON()));this._fieldsIndex=p;const d=V(i.geometryType??"point");return this._metadata=Z.createFeature({fieldsIndex:p.toJSON(),geometryType:d,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:X},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:d,featureIdInfo:{type:"object-id",fieldName:X},hasM:!1,hasZ:!1,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:T(d),extent:this._fullExtent??void 0,geometryType:d,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy("")}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._provider=P(e,this._provider.getGeometryInfo(),()=>this._customParameters)}async queryFeatures(e,t){const r=await O(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),Oe(r)||(r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,K):K,r.resultOffset=r.resultOffset??0),r.outStatistics)return this._queryStatistics(r,t);r.returnDistinctValues&&(r.returnGeometry=void 0);return(await this._enqueueQuery(r,t)).createQueryResponse()}async queryFeatureCount(e,t){const r=await O(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!pe(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 O(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!pe(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 queryAttributeBins(e,t={}){throw new s("parquet:unsupported","queryAttributeBins not supported.")}async queryExtent(e,t){const s=await O(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!pe(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(d(),y),n=d(),u=await this._enqueueQuery(s,t);let o=0;for(const r of u.items)r.getBounds(n)&&(f(a,n),o+=1);return{count:o,extent:q(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 ie(r,async(t,r)=>{const s=await t.file,i=await this._createParquetDisplayQuery(s,t.id,e);return s.executeQuery(i,K,r)}),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:s,handle:a}),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 getStreamNextFeatures(e,t){const{result:r}=await this.getStreamNext(e,t);if(null==r)return null;const s=(await W()).ParquetChunk.deserialize(new Uint8Array(r.buffer)),i=new L(this._metadata,this._indexMap,s,r.fileId),a=[];for(;i.next();){const e=I(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features: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?Ie(s,r):s}async _queryStatistics(e,t){const r=await O({...e},null,this._queryEngineParams.spatialReference);if(r.returnGeometry=void 0,me(r,this._fieldsIndex)){const e=await this._getStatisticsFromFiles(r);if(e)return e}return(await this._enqueueQuery(r,t)).createQueryResponse()}async _getStatisticsFromFiles(e){const t=await this._provider.getFiles(),r={},s=[];for(const i of e.outStatistics??[]){const e=ge(i,t);if(!e.available)return null;r[i.outStatisticFieldName]=e.value,s.push(he(i,this._fieldsIndex))}return{fields:s,features:[{attributes:r}]}}async _getSpatialFilePruning(e){if("tile"!==e.type&&("arcade"!==e.type||null==e.extent))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 W();switch(r.type){case"xz":return{type:"xz",fieldName:r.code,intersects:(t,n)=>a.queryIntersectsXZStatistics(r.fullExtent,e.extent,s,i,se,t,n)};case"z":return{type:"xy",xFieldName:r.xColumn,yFieldName:r.yColumn,intersects:(t,r,n,u)=>a.queryIntersectsXYStatistics(e.extent,s,i,t,r,n,u)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case"xz":{const r=Se(e,t);return null==r||Re(r,t)}case"xy":{const{xStatistics:r,yStatistics:s}=qe(e,t);return null==r||null==s||Ce(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,u=p(d(),y);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),o=[t.minValue(),s.minValue(),t.maxValue(),s.maxValue()];m(u,o),r.free()}catch(s){i.error=s,i.hasError=!0}finally{t(i)}}}return{xmin:u[0],ymin:u[1],xmax:u[3],ymax:u[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,r,s,i){const a=(await W()).Query.new();null!=r&&a.setPreFilterStart(r),null!=s&&a.setPreFilterCount(s),null!=i&&a.setPostFilterCount(i);const n=await this._getRequiredFields(e);a.setOutFields(n),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0);const u=this._tryGetGeneralizedGeometryScale(e);null!=u&&a.setScale(u);const o=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=o.wkid;if(e.geometry&&(F(o)||S(o))){const t=h(_(),g);for(const r of R(e.geometry))w(t,r);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){const{id:r,file:s}=t;await this._setWhereClause(a,await s,r,e.where)}return a}async _createParquetDisplayQuery(e,t,r){const s=(await W()).Query.new();return"tile"===r.type?(s.setExtent(r.extent),s.setQuantizationTransform(r.transform),s.setScale(r.scale)):"arcade"===r.type&&null!=r.extent&&s.setExtent(r.extent),s.setOutFields(r.outFields.filter(e=>null!=this._indexMap[e])),s.setOutSpatialReference(r.outSpatialReference.wkid),s.setReturnGeometry(r.returnGeometry),r.where&&await this._setWhereClause(s,e,t,r.where),s}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,i){const a=this._indexMap,n=this._fieldsIndex,u={getAttribute(e,s){const i=a[s];if(null==i){const t=n.get(s);if("__OBJECTID"===t?.name){const t=e.row+e.rowGroupStart;return M(r,t)}return null}const u=t.readAttribute(e.rowGroup,e.row,i);if(null==u)return null;const o=n.get(s);return"esriFieldTypeString"===o.type||"esriFieldTypeDateOnly"===o.type||"esriFieldTypeTimeOnly"===o.type||"esriFieldTypeTimestampOffset"===o.type?$.decode(u):u}},o=await l(i,this._fieldsIndex);if(!o.isStandardized)throw new s("sql-parse-error","expression is not standardized");const c=(e,t,r)=>o.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:r},u,null),p=o.fieldNames.map(e=>n.get(e)).filter(e=>e&&null!=this._indexMap[e?.name]);e.setWhere(i),e.setWhereEvaluator(c),e.setWhereFields(p.map(e=>e.name))}async*_streamFeatures(e,t,r,s,i){const a=await this._provider.getFiles();let n=0;for(const u of a){const a=n,o=n+u.statistics.rowCount;if(n+=u.statistics.rowCount,null!=t&&t>=o)continue;const l=null!=t?Math.max(t-a,0):null;let c=r;if(null!=r){const e=t??0,s=e+r,i=Math.max(e,a),n=Math.min(s,o);c=Math.max(n-i,0)}if(0===c)continue;const p=await this._createParquetQuery(e,u,l,c,s),d=await u.file,f=await d.executeQuery(p,K),m=async()=>{const e=await f.next(i);if(!e)return null;const t=new L(this._metadata,this._indexMap,e,u.id);return Fe([new k(t,null,0,!1)],this._queryEngineParams)};let y=await m();for(;null!=y;)yield y,y=await m()}}async _queryFeaturesWithQueryEnginePagination(e,t){const r=[],s=this._streamFeatures(e,null,null,null,t);let i=await s.next();for(;!i.done;){const a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(const e of a)r.push(e);i=await s.next()}return r}async _queryFeaturesWithUpfrontPagination(e,t){let r,s,i,a=e.resultOffset??0,n=e.resultRecordCount??K;de(e)?fe(e)||(i=a+n):(a&&(r=a,a=0),s=e.resultRecordCount);const u=[],o=this._streamFeatures(e,r,s,i,t);let l=await o.next();for(;!l.done&&n>0;){const r=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(const e of r)if(a>0)a--;else if(u.push(e),--n<=0)return u;l=await o.next()}return u}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){const r=new Map;for(const t of e.objectIds){const e=j(t),s=Q(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 E(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:H,featureIdInfo:this._queryEngineParams.featureIdInfo})}if("1=1"===e.where&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>ee){if(!(this._displayOptimization&&e.geometry))throw new s("parquet:cannot-execute-query","Unable to execute query, dataset is too large.")}const r=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=r?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return r||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:H,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,r,s){const i=await this._getRequiredFields(e),a=(await W()).Query.new();a.setOutFields(i),a.setReturnGeometry(!!e.returnGeometry),a.setIds(new Uint32Array(r));const n=await this._getFile(t),u=await n.executeQuery(a,K,s);let o=await u.next(s),l=0;const c=[];for(;null!=o;){const e=new L(this._metadata,this._indexMap,o,t),r=new k(e,null,l++,!1);c.push(r),o=await u.next(s)}return Fe(c,this._queryEngineParams).executeQueryForOpaqueFeatures(e,s)}async _getRequiredFields(e){const t=new Set;if(e.outStatistics)for(const r of v(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(r);else if(e.outFields)for(const r of e.outFields)t.add(r);return(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e])}_tryGetGeneralizedGeometryScale(e){if(!this._displayOptimization)return null;const t=e.outSR??this._queryEngineParams.spatialReference;if(!F(t)&&!S(t))return null;const r=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return r?x(r,t):null}}function oe(e){switch(e){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":case"resultOffset":case"resultRecordCount":return!0;default:return!1}}function le(e){switch(e){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":return!0;default:return!1}}function ce(e){switch(e){case"fullText":case"having":case"timeExtent":return!0;case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"resultOffset":case"geometry":case"resultRecordCount":return!1}return!1}function pe(e){for(const t in e){const r=t;if(oe(r)&&null!==e[r])return!0}return!1}function de(e){for(const t in e){const r=t;if(le(r)&&null!==e[r])return!0}return!1}function fe(e){for(const t in e){const r=t;if(ce(r)&&null!==e[r])return!0}return!1}function me(e,t){return!!e.outStatistics?.length&&!pe(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case"count":return"1"===e.onStatisticField||null!=t.get(e.onStatisticField);case"min":case"max":{const r=t.get(e.onStatisticField);return null!=r&&B(r)}default:return!1}}function he(e,t){const r="exceedslimit"!==e.statisticType?t.get(e.onStatisticField):null,s="min"!==e.statisticType&&"max"!==e.statisticType||"esriFieldTypeDate"!==r?.type?"esriFieldTypeDouble":r.type;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:s}}function ge(e,t){switch(e.statisticType){case"count":return _e(e,t);case"min":return we(e,t,Math.min);case"max":return we(e,t,Math.max);default:return{available:!1,value:null}}}function _e(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 r=0;for(const s of t){const t=s.statistics.statistics.get(e.onStatisticField);if(null==t||null==t.nullCount)return{available:!1,value:null};r+=s.statistics.rowCount-t.nullCount}return{available:!0,value:r}}function we(e,t,r){if("min"!==e.statisticType&&"max"!==e.statisticType)return{available:!1,value:null};let s=null;const i="min"===e.statisticType?"minValue":"maxValue";for(const a of t){const t=a.statistics.statistics.get(e.onStatisticField);if(null==t)return{available:!1,value:null};const n=xe(t[i]);null!=n&&(s=null==s?n:r(s,n))}return{available:!0,value:s}}function xe(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function Fe(e,t){const r=new J;for(const s of e)r.insert(s);return new C({...t,featureStore:r})}function Se(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ie(e,t){return e.slice().sort((e,r)=>{const s=ve(e,t),i=ve(r,t);return s===i?0:s<i?-1:1})}function ve(e,t){const r=Se(e,t);if(null==r)return Number.POSITIVE_INFINITY;const s=be(r.minValue),i=be(r.maxValue);return null==s||null==i||i<s?Number.POSITIVE_INFINITY:i-s}function qe(e,t){return{xStatistics:e.statistics.statistics.get(t.xFieldName)??null,yStatistics:e.statistics.statistics.get(t.yFieldName)??null}}function Re(e,t){const r=be(e.minValue),s=be(e.maxValue);return null==r||null==s||t.intersects(r,s)}function Ce(e,t,r){const s=be(e.minValue),i=be(e.maxValue),a=be(t.minValue),n=be(t.maxValue);return null==s||null==i||null==a||null==n||r.intersects(s,i,a,n)}function be(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function Ee(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:{...b,maxRecordCount:K,supportsOrderBy:r,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 Oe(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{ue as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{EventEmitter as e}from"../../core/Evented.js";import{clone as i}from"../../core/lang.js";import{property as s,subclass as d}from"../../core/accessorSupport/decorators.js";import{isVersionInEditSession as n,defaultVersionNameLookup as r}from"../../versionManagement/support/versionManagementUtils.js";const o=new e;function l(t){return o.on("apply-edits",new WeakRef(t))}function a(t){return o.on("update-moment",new WeakRef(t))}function h(t,e,i=null,s=!1){const d=Promise.withResolvers();return s=null==e||s,o.emit("apply-edits",{serviceUrl:t,layerId:e,gdbVersion:i,mayReceiveServiceEdits:s,result:d.promise}),d}function c(t,e,i=null,s){o.emit("update-moment",{serviceUrl:t,layerId:e,gdbVersion:i,moment:s})}const u=Symbol();function m(t){return null!=t&&"object"==typeof t&&u in t}function p(t){return null!=t&&"object"==typeof t&&"gdbVersion"in t}function b(t){return null!=t&&"object"==typeof t&&"historicMoment"in t}function g(t,e,i){const s=new URL(t).host,d=r.get(s),n=t=>!t||t===d;return n(e)&&n(i)||e===i}const F=e=>{var r;const o=e;let h=class extends o{static{r=u}constructor(...t){super(...t),this[r]=!0,this._applyEditsHandler=t=>{const{serviceUrl:e,layerId:s,gdbVersion:d,mayReceiveServiceEdits:n,result:r}=t,o=e===this.url,l=null!=s&&null!=this.layerId&&s===this.layerId,a=p(this),h=p(this)&&g(e,d,this.gdbVersion);if(!o||a&&!h||!l&&!n)return;const c=r.then(t=>{if(this.lastEditsEventDate=new Date,l&&(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length))return this.emit("edits",i(t)),t;const s=t.editedFeatures?.find(({layerId:t})=>t===this.layerId);if(s){const{adds:e,updates:d,deletes:n}=s.editedFeatures,r={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:e?e.map(({attributes:t})=>({objectId:this.objectIdField&&t[this.objectIdField],globalId:this.globalIdField&&t[this.globalIdField]})):[],deletedFeatures:n?n.map(({attributes:t})=>({objectId:this.objectIdField&&t[this.objectIdField],globalId:this.globalIdField&&t[this.globalIdField]})):[],updatedFeatures:d?d.map(({current:{attributes:t}})=>({objectId:this.objectIdField&&t[this.objectIdField],globalId:this.globalIdField&&t[this.globalIdField]})):[],editedFeatures:i(t.editedFeatures),exceededTransferLimit:!1,historicMoment:i(t.historicMoment)};return this.emit("edits",r),r}const n={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:[],deletedFeatures:[],updatedFeatures:[],editedFeatures:i(t.editedFeatures),exceededTransferLimit:!1,historicMoment:i(t.historicMoment)};return"historicMoment"in this&&this._shouldUpdateHistoricMoment(e,d,n.historicMoment)&&this.emit("edits",n),n}).then(t=>("historicMoment"in this&&this._shouldUpdateHistoricMoment(e,d,t.historicMoment)&&(this.historicMoment=t.historicMoment),t));this.emit("apply-edits",{result:c})},this._updateMomentHandler=t=>{const{serviceUrl:e,gdbVersion:i,moment:s}=t,d=e===this.url,n=p(this),r=p(this)&&g(e,i,this.gdbVersion),o=p(this)&&!g(e,this.gdbVersion,null);d&&n&&r&&o&&"historicMoment"in this&&this.historicMoment!==s&&(this.historicMoment=s)},this.when().then(()=>{this.addHandles(l(this._applyEditsHandler)),"historicMoment"in this&&this.addHandles(a(this._updateMomentHandler))},()=>{})}_shouldUpdateHistoricMoment(t,e,i){return"historicMoment"in this&&this.historicMoment!==i&&n(t,e)}};return t([s()],h.prototype,"lastEditsEventDate",void 0),h=t([d("esri.layers.mixins.EditBusLayer")],h),h};export{F as EditBusLayer,h as emitApplyEditsEvent,c as emitUpdateMomentEvent,m as isEditBusLayer,p as isLayerWithGDBVersion,b as isLayerWithHistoricMoment,l as onApplyEditsEvent,a as onUpdateMomentEvent,g as versionMatches};
2
+ import{__decorate as t}from"tslib";import{EventEmitter as e}from"../../core/Evented.js";import{clone as i}from"../../core/lang.js";import{property as s,subclass as d}from"../../core/accessorSupport/decorators.js";import{isVersionInEditSession as n,defaultVersionNameLookup as r}from"../../versionManagement/support/versionManagementUtils.js";const o=new e;function l(t){return o.on("apply-edits",new WeakRef(t))}function a(t){return o.on("update-moment",new WeakRef(t))}function h(t,e,i=null,s=!1){const d=Promise.withResolvers();return s=null==e||s,o.emit("apply-edits",{serviceUrl:t,layerId:e,gdbVersion:i,mayReceiveServiceEdits:s,result:d.promise}),d}function c(t,e,i=null,s){o.emit("update-moment",{serviceUrl:t,layerId:e,gdbVersion:i,moment:s})}const u=Symbol();function m(t){return null!=t&&"object"==typeof t&&u in t}function p(t){return null!=t&&"object"==typeof t&&"gdbVersion"in t}function b(t){return null!=t&&"object"==typeof t&&"historicMoment"in t}function g(t,e,i){const s=new URL(t).host,d=r.get(s),n=t=>!t||t===d;return n(e)&&n(i)||e===i}const F=e=>{var r;const o=e;let h=class extends o{static{r=u}constructor(...t){super(...t),this[r]=!0,this._applyEditsHandler=t=>{const{serviceUrl:e,layerId:s,gdbVersion:d,mayReceiveServiceEdits:n,result:r}=t,o=e===this.url,l=null!=s&&null!=this.layerId&&s===this.layerId,a=p(this),h=p(this)&&g(e,d,this.gdbVersion);if(!o||a&&!h||!l&&!n)return;const c=r.then(t=>{if(this.lastEditsEventDate=new Date,l&&(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length))return this.emit("edits",i(t)),t;const s=t.editedFeatures?.find(({layerId:t})=>t===this.layerId);if(s){const{adds:e,updates:d,deletes:n}=s.editedFeatures,r={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:e?e.map(({attributes:t})=>({objectId:this.objectIdField&&t[this.objectIdField],globalId:this.globalIdField&&t[this.globalIdField]})):[],deletedFeatures:n?n.map(({attributes:t})=>({objectId:this.objectIdField&&t[this.objectIdField],globalId:this.globalIdField&&t[this.globalIdField]})):[],updatedFeatures:d?d.map(({current:{attributes:t}})=>({objectId:this.objectIdField&&t[this.objectIdField],globalId:this.globalIdField&&t[this.globalIdField]})):[],editedFeatures:i(t.editedFeatures),exceededTransferLimit:!1,historicMoment:i(t.historicMoment)};return this.emit("edits",r),r}const n={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:[],deletedFeatures:[],updatedFeatures:[],editedFeatures:i(t.editedFeatures),exceededTransferLimit:!1,historicMoment:i(t.historicMoment)};return"historicMoment"in this&&this._shouldUpdateHistoricMoment(e,d,n.historicMoment)&&this.emit("edits",n),n}).then(t=>("historicMoment"in this&&this._shouldUpdateHistoricMoment(e,d,t.historicMoment)&&(this.historicMoment=t.historicMoment),t));c.catch(()=>{}),this.emit("apply-edits",{result:c})},this._updateMomentHandler=t=>{const{serviceUrl:e,gdbVersion:i,moment:s}=t,d=e===this.url,n=p(this),r=p(this)&&g(e,i,this.gdbVersion),o=p(this)&&!g(e,this.gdbVersion,null);d&&n&&r&&o&&"historicMoment"in this&&this.historicMoment!==s&&(this.historicMoment=s)},this.when().then(()=>{this.addHandles(l(this._applyEditsHandler)),"historicMoment"in this&&this.addHandles(a(this._updateMomentHandler))},()=>{})}_shouldUpdateHistoricMoment(t,e,i){return"historicMoment"in this&&this.historicMoment!==i&&n(t,e)}};return t([s()],h.prototype,"lastEditsEventDate",void 0),h=t([d("esri.layers.mixins.EditBusLayer")],h),h};export{F as EditBusLayer,h as emitApplyEditsEvent,c as emitUpdateMomentEvent,m as isEditBusLayer,p as isLayerWithGDBVersion,b as isLayerWithHistoricMoment,l as onApplyEditsEvent,a as onUpdateMomentEvent,g as versionMatches};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../request.js";import r from"../../core/Error.js";import i from"../../core/Logger.js";import{debounce as o}from"../../core/promiseUtils.js";import{property as s,subclass as a}from"../../core/accessorSupport/decorators.js";import{updateOrigins as n}from"../../core/accessorSupport/originUtils.js";import l from"../../geometry/Extent.js";import p from"../../geometry/HeightModelInfo.js";import c from"../../geometry/SpatialReference.js";import{titleFromUrlAndName as u,parse as d,cleanTitle as y,sanitizeUrlWithLayerId as m}from"../support/arcgisLayerUrl.js";import{id as h}from"../support/commonProperties.js";import{fetchIndexInfo as f}from"../support/I3SIndexInfo.js";import{urlProperty as v,normalizeParsedUrlObject as S}from"../support/multiLayerServiceUtils.js";import{getLoader as g}from"../support/schemaValidatorLoader.js";import w from"../../portal/Portal.js";import x from"../../portal/PortalItem.js";import{createForItemWrite as I}from"../../portal/support/jsonContext.js";import{saveResources as j,updateItemWithResources as b}from"../../webdoc/support/resourceUtils.js";import{evaluateWriteErrors as N}from"../../webdoc/support/saveUtils.js";import{reader as _}from"../../core/accessorSupport/decorators/reader.js";const R=m=>{const R=m;let E=class extends R{constructor(){super(...arguments),this.spatialReference=null,this.fullExtent=null,this.heightModelInfo=null,this.minScale=0,this.maxScale=0,this.version={major:Number.NaN,minor:Number.NaN,versionString:""},this.copyright=null,this.sublayerTitleMode="item-title",this.title=null,this.layerId=null,this.url=null,this.indexInfo=null,this._debouncedSaveOperations=o(async(e,t,r)=>{switch(e){case 0:return this._save(t);case 1:return this._saveAs(r,t)}})}readSpatialReference(e,t){return T(t)}readFullExtent(e,t,r){if(null!=e&&"object"==typeof e){const i=null==e.spatialReference?{...e,spatialReference:T(t)}:e;return l.fromJSON(i,r)}const i=t.store,o=T(t);return null==o||null==i?.extent||!Array.isArray(i.extent)||i.extent.some(e=>e<L)?null:new l({xmin:i.extent[0],ymin:i.extent[1],xmax:i.extent[2],ymax:i.extent[3],spatialReference:o})}parseVersionString(e){const t={major:Number.NaN,minor:Number.NaN,versionString:e},r=e.split(".");return r.length>=2&&(t.major=parseInt(r[0],10),t.minor=parseInt(r[1],10)),t}readVersion(e,t){const r=t.store,i=null!=r.version?r.version.toString():"";return this.parseVersionString(i)}readTitlePortalItem(e){return"item-title"!==this.sublayerTitleMode?void 0:e}readTitleService(e,t){if("item-title"===this.sublayerTitleMode)return this.url?u(this.url,t.name):t.name;let r=t.name;if(!r&&this.url){const e=d(this.url);null!=e&&(r=e.title)}const i=this.portalItem?.title;return"item-title-and-service-name"===this.sublayerTitleMode&&i&&(r=i+" - "+r),y(r)}get parsedUrl(){return S(this,{separator:"layers"})}async _fetchIndexAndUpdateExtent(e,t){this.indexInfo=f(this.parsedUrl?.path??"",this.rootNode,e,this.customParameters,this.apiKey,i.getLogger(this),t);const{fullExtent:r}=this;null==r||r.hasZ||this._updateExtent(r,await this.indexInfo)}_updateExtent(e,t){if("page"===t?.type){const r=t.rootIndex%t.pageSize,i=t.rootPage?.nodes?.[r];A(e,i?.obb)}else if("node"===t?.type){const r=t.rootNode?.mbs;if(!Array.isArray(r)||4!==r.length||r[0]<L)return;const i=r[2],o=r[3];e.zmin=i-o,e.zmax=i+o}}async _fetchService(e){if(null==this.url)throw new r("sceneservice:url-not-set","Scene service can not be loaded without valid portal item or url");if(null==this.layerId&&/SceneServer\/*$/i.test(this.url)){const t=await this._fetchFirstLayerId(e);null!=t&&(this.layerId=t)}return this._fetchServiceLayer(e)}async _fetchFirstLayerId(e){const r=await t(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});if(r.data&&Array.isArray(r.data.layers)&&r.data.layers.length>0)return r.data.layers[0].id}async _fetchServiceLayer(e){const r=await t(this.parsedUrl?.path??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});r.ssl&&this.url&&(this.url=this.url.replace(/^http:/i,"https:"));let i=!1;if(r.data.layerType&&"Voxel"===r.data.layerType&&(i=!0),i)return this._fetchVoxelServiceLayer();const o=r.data;this.read(o,this._getServiceContext()),this.validateLayer(o)}async _fetchVoxelServiceLayer(e){const r=(await t(this.parsedUrl?.path+"/layer",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(r,this._getServiceContext()),this.validateLayer(r)}_getServiceContext(){return{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}}async _ensureLoadBeforeSave(){await this.load(),"beforeSave"in this&&"function"==typeof this.beforeSave&&await this.beforeSave()}validateLayer(e){}async _saveAs(e,t){const i={...P,...t};let o=x.from(e);if(!o)throw new r("sceneservice:portal-item-required","_saveAs() requires a portal item to save to");o.id&&(o=o.clone(),o.id=null);const s=o.portal||w.getDefault();await this._ensureLoadBeforeSave(),o.type=U,o.portal=s;const a=I(o,"portal-item",!0),l={layers:[this.write({},a)]};return await Promise.all(a.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(l,a,i),this.url&&(o.url=this.url),o.title||(o.title=this.title),O(o,i,1),await s.signIn(),await s.user.addItem({item:o,folder:i?.folder,data:l}),await j(this.resourceReferences,a),this.portalItem=o,n(a),a.portalItem=o,o}async _save(e){const t={...P,...e};if(!this.portalItem)throw new r("sceneservice:portal-item-not-set","Portal item to save to has not been set on this SceneService");if(this.portalItem.type!==U)throw new r("sceneservice:portal-item-wrong-type",`Portal item needs to have type "${U}"`);await this._ensureLoadBeforeSave();const i=I(this.portalItem,"portal-item",!0),o=this.write({},i),s=await C(this.portalItem,o);await Promise.all(i.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(s,i,t);const a=q(this.portalItem,this.url);return a&&(this.portalItem.url=a),this.portalItem.title||(this.portalItem.title=this.title),O(this.portalItem,t,0),await b(this.portalItem,s,this.resourceReferences,i),n(i),this.portalItem}async _validateAgainstJSONSchema(e,t,o){const s=o?.validationOptions;N(t,{errorName:"sceneservice:save"},{ignoreUnsupported:s?.ignoreUnsupported,supplementalUnsupportedErrors:["scenemodification:unsupported"]});const a=s?.enabled,n=g();if(a&&n){const t=(await n()).validate(e,o.portalItemLayerType);if(!t.length)return;const a=`Layer item did not validate:\n${t.join("\n")}`;if(i.getLogger(this).error(`_validateAgainstJSONSchema(): ${a}`),"throw"===s.failPolicy){const e=t.map(e=>new r("sceneservice:schema-validation",e));throw new r("sceneservice-validate:error","Failed to save layer item due to schema validation, see `details.errors`.",{validationErrors:e})}}}};return e([s(h)],E.prototype,"id",void 0),e([s({type:c})],E.prototype,"spatialReference",void 0),e([_("spatialReference",["spatialReference","store.indexCRS","store.geographicCRS"])],E.prototype,"readSpatialReference",null),e([s({type:l})],E.prototype,"fullExtent",void 0),e([_("fullExtent",["fullExtent","store.extent","spatialReference","store.indexCRS","store.geographicCRS"])],E.prototype,"readFullExtent",null),e([s({readOnly:!0,type:p})],E.prototype,"heightModelInfo",void 0),e([s({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:{source:"minScale"},write:!1}}}})],E.prototype,"minScale",void 0),e([s({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:{source:"maxScale"},write:!1}}}})],E.prototype,"maxScale",void 0),e([s({readOnly:!0})],E.prototype,"version",void 0),e([_("version",["store.version"])],E.prototype,"readVersion",null),e([s({type:String,json:{read:{source:"copyrightText"}}})],E.prototype,"copyright",void 0),e([s({type:String,json:{read:!1}})],E.prototype,"sublayerTitleMode",void 0),e([s({type:String})],E.prototype,"title",void 0),e([_("portal-item","title")],E.prototype,"readTitlePortalItem",null),e([_("service","title",["name"])],E.prototype,"readTitleService",null),e([s({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{write:{target:"id",isRequired:!0,ignoreOrigin:!0},read:!1}}}})],E.prototype,"layerId",void 0),e([s(v({separator:"layers"}))],E.prototype,"url",void 0),e([s({readOnly:!0})],E.prototype,"parsedUrl",null),e([s({readOnly:!0})],E.prototype,"store",void 0),e([s({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],E.prototype,"rootNode",void 0),E=e([a("esri.layers.mixins.SceneService")],E),E},L=-1e38;function T(e){if(null!=e.spatialReference)return c.fromJSON(e.spatialReference);const t=e.store,r=t.indexCRS||t.geographicCRS,i=r&&parseInt(r.slice(r.lastIndexOf("/")+1),10);return null!=i?new c(i):null}function A(e,t){if(null==t?.center||null==t.halfSize)throw new r("sceneservice:invalid-node-page","Invalid node page.");if(t.center[0]<L)return;const i=t.halfSize,o=t.center[2],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);e.zmin=o-s,e.zmax=o+s}function O(e,t,r){e.typeKeywords||(e.typeKeywords=[]);const i=t.getTypeKeywords();for(const o of i)e.typeKeywords.push(o);e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter((e,t,r)=>r.indexOf(e)===t),1===r&&(e.typeKeywords=e.typeKeywords.filter(e=>"Hosted Service"!==e)))}const U="Scene Service",P={getTypeKeywords:()=>[],portalItemLayerType:"unknown",validationOptions:{enabled:!0,ignoreUnsupported:!1,failPolicy:"throw"}},E={layerId:null};function K(e,t){const r=e.findIndex(({id:e})=>e===t.id);-1===r?e.push(t):e[r]=t}async function C(e,t){const r=await e.fetchData("json")??{};return Array.isArray(r.layers)||(r.layers=await V(e,t)),K(r.layers,t),r}function q(e,t){return t&&M(e.url,t)?e.url:t}function M(e,t){const r=J(e);return!!r&&r===F(t).url}async function V(e,t){const r=await z(e).catch(()=>null);return r?.some(({id:e})=>e===t.id)?r:[t]}async function z(e){const r=J(e.url);if(!r)return null;const i=(await t(r,{query:{f:"json"},responseType:"json"})).data.layers;if(!Array.isArray(i))return null;const o=i.filter(({id:e})=>null!=e).map(({id:e})=>({id:e}));return o.length?o:null}function J(e){if(!e)return null;const t=F(e);if(null!=t.layerId)return null;const r=d(t.url);return null==r||"SceneServer"===r.serverType?t.url:null}function F(e){return m({layer:E,url:e,nonStandardUrlAllowed:!0})}export{R as SceneService,U as sceneServiceItemType,A as updateExtentFromPageObb};
2
+ import{__decorate as e}from"tslib";import t from"../../request.js";import r from"../../core/Error.js";import i from"../../core/Logger.js";import{debounce as o}from"../../core/promiseUtils.js";import{property as s,subclass as a}from"../../core/accessorSupport/decorators.js";import{updateOrigins as n}from"../../core/accessorSupport/originUtils.js";import l from"../../geometry/Extent.js";import p from"../../geometry/HeightModelInfo.js";import c from"../../geometry/SpatialReference.js";import{titleFromUrlAndName as u,parse as d,cleanTitle as y,sanitizeUrlWithLayerId as m}from"../support/arcgisLayerUrl.js";import{id as h}from"../support/commonProperties.js";import{fetchIndexInfo as f}from"../support/I3SIndexInfo.js";import{urlProperty as v,normalizeParsedUrlObject as S}from"../support/multiLayerServiceUtils.js";import{getLoader as g}from"../support/schemaValidatorLoader.js";import w from"../../portal/Portal.js";import x from"../../portal/PortalItem.js";import{createForItemWrite as I}from"../../portal/support/jsonContext.js";import{saveResources as j,updateItemWithResources as b}from"../../webdoc/support/resourceUtils.js";import{evaluateWriteErrors as N}from"../../webdoc/support/saveUtils.js";import{reader as _}from"../../core/accessorSupport/decorators/reader.js";const R=m=>{const R=m;let E=class extends R{constructor(){super(...arguments),this.spatialReference=null,this.fullExtent=null,this.heightModelInfo=null,this.minScale=0,this.maxScale=0,this.version={major:Number.NaN,minor:Number.NaN,versionString:""},this.copyright=null,this.sublayerTitleMode="item-title",this.title=null,this.layerId=null,this.url=null,this.indexInfo=null,this._debouncedSaveOperations=o(async(e,t,r)=>{switch(e){case 0:return this._save(t);case 1:return this._saveAs(r,t)}})}readSpatialReference(e,t){return T(t)}readFullExtent(e,t,r){if(null!=e&&"object"==typeof e){const i=null==e.spatialReference?{...e,spatialReference:T(t)}:e;return l.fromJSON(i,r)}const i=t.store,o=T(t);return null==o||null==i?.extent||!Array.isArray(i.extent)||i.extent.some(e=>e<L)?null:new l({xmin:i.extent[0],ymin:i.extent[1],xmax:i.extent[2],ymax:i.extent[3],spatialReference:o})}parseVersionString(e){const t={major:Number.NaN,minor:Number.NaN,versionString:e},r=e.split(".");return r.length>=2&&(t.major=parseInt(r[0],10),t.minor=parseInt(r[1],10)),t}readVersion(e,t){const r=t.store,i=null!=r.version?r.version.toString():"";return this.parseVersionString(i)}readTitlePortalItem(e){return"item-title"!==this.sublayerTitleMode?void 0:e}readTitleService(e,t){if("item-title"===this.sublayerTitleMode)return this.url?u(this.url,t.name):t.name;let r=t.name;if(!r&&this.url){const e=d(this.url);null!=e&&(r=e.title)}const i=this.portalItem?.title;return"item-title-and-service-name"===this.sublayerTitleMode&&i&&(r=i+" - "+r),y(r)}get parsedUrl(){return S(this,{separator:"layers"})}async _fetchIndexAndUpdateExtent(e,t){this.indexInfo=f(this.parsedUrl?.path??"",this.rootNode,e,this.customParameters,this.apiKey,i.getLogger(this),t),this.indexInfo.catch(()=>{});const{fullExtent:r}=this;null==r||r.hasZ||this._updateExtent(r,await this.indexInfo)}_updateExtent(e,t){if("page"===t?.type){const r=t.rootIndex%t.pageSize,i=t.rootPage?.nodes?.[r];A(e,i?.obb)}else if("node"===t?.type){const r=t.rootNode?.mbs;if(!Array.isArray(r)||4!==r.length||r[0]<L)return;const i=r[2],o=r[3];e.zmin=i-o,e.zmax=i+o}}async _fetchService(e){if(null==this.url)throw new r("sceneservice:url-not-set","Scene service can not be loaded without valid portal item or url");if(null==this.layerId&&/SceneServer\/*$/i.test(this.url)){const t=await this._fetchFirstLayerId(e);null!=t&&(this.layerId=t)}return this._fetchServiceLayer(e)}async _fetchFirstLayerId(e){const r=await t(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});if(r.data&&Array.isArray(r.data.layers)&&r.data.layers.length>0)return r.data.layers[0].id}async _fetchServiceLayer(e){const r=await t(this.parsedUrl?.path??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});r.ssl&&this.url&&(this.url=this.url.replace(/^http:/i,"https:"));let i=!1;if(r.data.layerType&&"Voxel"===r.data.layerType&&(i=!0),i)return this._fetchVoxelServiceLayer();const o=r.data;this.read(o,this._getServiceContext()),this.validateLayer(o)}async _fetchVoxelServiceLayer(e){const r=(await t(this.parsedUrl?.path+"/layer",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(r,this._getServiceContext()),this.validateLayer(r)}_getServiceContext(){return{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}}async _ensureLoadBeforeSave(){await this.load(),"beforeSave"in this&&"function"==typeof this.beforeSave&&await this.beforeSave()}validateLayer(e){}async _saveAs(e,t){const i={...P,...t};let o=x.from(e);if(!o)throw new r("sceneservice:portal-item-required","_saveAs() requires a portal item to save to");o.id&&(o=o.clone(),o.id=null);const s=o.portal||w.getDefault();await this._ensureLoadBeforeSave(),o.type=U,o.portal=s;const a=I(o,"portal-item",!0),l={layers:[this.write({},a)]};return await Promise.all(a.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(l,a,i),this.url&&(o.url=this.url),o.title||(o.title=this.title),O(o,i,1),await s.signIn(),await s.user.addItem({item:o,folder:i?.folder,data:l}),await j(this.resourceReferences,a),this.portalItem=o,n(a),a.portalItem=o,o}async _save(e){const t={...P,...e};if(!this.portalItem)throw new r("sceneservice:portal-item-not-set","Portal item to save to has not been set on this SceneService");if(this.portalItem.type!==U)throw new r("sceneservice:portal-item-wrong-type",`Portal item needs to have type "${U}"`);await this._ensureLoadBeforeSave();const i=I(this.portalItem,"portal-item",!0),o=this.write({},i),s=await C(this.portalItem,o);await Promise.all(i.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(s,i,t);const a=q(this.portalItem,this.url);return a&&(this.portalItem.url=a),this.portalItem.title||(this.portalItem.title=this.title),O(this.portalItem,t,0),await b(this.portalItem,s,this.resourceReferences,i),n(i),this.portalItem}async _validateAgainstJSONSchema(e,t,o){const s=o?.validationOptions;N(t,{errorName:"sceneservice:save"},{ignoreUnsupported:s?.ignoreUnsupported,supplementalUnsupportedErrors:["scenemodification:unsupported"]});const a=s?.enabled,n=g();if(a&&n){const t=(await n()).validate(e,o.portalItemLayerType);if(!t.length)return;const a=`Layer item did not validate:\n${t.join("\n")}`;if(i.getLogger(this).error(`_validateAgainstJSONSchema(): ${a}`),"throw"===s.failPolicy){const e=t.map(e=>new r("sceneservice:schema-validation",e));throw new r("sceneservice-validate:error","Failed to save layer item due to schema validation, see `details.errors`.",{validationErrors:e})}}}};return e([s(h)],E.prototype,"id",void 0),e([s({type:c})],E.prototype,"spatialReference",void 0),e([_("spatialReference",["spatialReference","store.indexCRS","store.geographicCRS"])],E.prototype,"readSpatialReference",null),e([s({type:l})],E.prototype,"fullExtent",void 0),e([_("fullExtent",["fullExtent","store.extent","spatialReference","store.indexCRS","store.geographicCRS"])],E.prototype,"readFullExtent",null),e([s({readOnly:!0,type:p})],E.prototype,"heightModelInfo",void 0),e([s({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:{source:"minScale"},write:!1}}}})],E.prototype,"minScale",void 0),e([s({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:{source:"maxScale"},write:!1}}}})],E.prototype,"maxScale",void 0),e([s({readOnly:!0})],E.prototype,"version",void 0),e([_("version",["store.version"])],E.prototype,"readVersion",null),e([s({type:String,json:{read:{source:"copyrightText"}}})],E.prototype,"copyright",void 0),e([s({type:String,json:{read:!1}})],E.prototype,"sublayerTitleMode",void 0),e([s({type:String})],E.prototype,"title",void 0),e([_("portal-item","title")],E.prototype,"readTitlePortalItem",null),e([_("service","title",["name"])],E.prototype,"readTitleService",null),e([s({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{write:{target:"id",isRequired:!0,ignoreOrigin:!0},read:!1}}}})],E.prototype,"layerId",void 0),e([s(v({separator:"layers"}))],E.prototype,"url",void 0),e([s({readOnly:!0})],E.prototype,"parsedUrl",null),e([s({readOnly:!0})],E.prototype,"store",void 0),e([s({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],E.prototype,"rootNode",void 0),E=e([a("esri.layers.mixins.SceneService")],E),E},L=-1e38;function T(e){if(null!=e.spatialReference)return c.fromJSON(e.spatialReference);const t=e.store,r=t.indexCRS||t.geographicCRS,i=r&&parseInt(r.slice(r.lastIndexOf("/")+1),10);return null!=i?new c(i):null}function A(e,t){if(null==t?.center||null==t.halfSize)throw new r("sceneservice:invalid-node-page","Invalid node page.");if(t.center[0]<L)return;const i=t.halfSize,o=t.center[2],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);e.zmin=o-s,e.zmax=o+s}function O(e,t,r){e.typeKeywords||(e.typeKeywords=[]);const i=t.getTypeKeywords();for(const o of i)e.typeKeywords.push(o);e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter((e,t,r)=>r.indexOf(e)===t),1===r&&(e.typeKeywords=e.typeKeywords.filter(e=>"Hosted Service"!==e)))}const U="Scene Service",P={getTypeKeywords:()=>[],portalItemLayerType:"unknown",validationOptions:{enabled:!0,ignoreUnsupported:!1,failPolicy:"throw"}},E={layerId:null};function K(e,t){const r=e.findIndex(({id:e})=>e===t.id);-1===r?e.push(t):e[r]=t}async function C(e,t){const r=await e.fetchData("json")??{};return Array.isArray(r.layers)||(r.layers=await V(e,t)),K(r.layers,t),r}function q(e,t){return t&&M(e.url,t)?e.url:t}function M(e,t){const r=J(e);return!!r&&r===F(t).url}async function V(e,t){const r=await z(e).catch(()=>null);return r?.some(({id:e})=>e===t.id)?r:[t]}async function z(e){const r=J(e.url);if(!r)return null;const i=(await t(r,{query:{f:"json"},responseType:"json"})).data.layers;if(!Array.isArray(i))return null;const o=i.filter(({id:e})=>null!=e).map(({id:e})=>({id:e}));return o.length?o:null}function J(e){if(!e)return null;const t=F(e);if(null!=t.layerId)return null;const r=d(t.url);return null==r||"SceneServer"===r.serverType?t.url:null}function F(e){return m({layer:E,url:e,nonStandardUrlAllowed:!0})}export{R as SceneService,U as sceneServiceItemType,A as updateExtentFromPageObb};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{EventedMixin as r}from"../../core/Evented.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import{Loadable as s}from"../../core/Loadable.js";import{on as o,sync as l,watch as a,whenOnce as n}from"../../core/reactiveUtils.js";import{stripHTML as p}from"../../core/string.js";import{property as u,subclass as h}from"../../core/accessorSupport/decorators.js";import{ensureType as y}from"../../core/accessorSupport/ensureType.js";import c from"../../geometry/Extent.js";import f from"../../graphic/KMLGraphicOrigin.js";import{computeExtent as d,sublayersFromJSON as m,fetchService as v,parseKML as b}from"./kmlUtils.js";import{reader as g}from"../../core/accessorSupport/decorators/reader.js";var j;let S=j=class extends(r(i(s))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.id=null,this.networkLink=null,this.parent=null,this.sublayers=null,this.title=null,this.sourceJSON=null,this.layer=null,this.addHandles([o(()=>this.sublayers,"after-add",({item:e})=>{e.parent=this,e.layer=this.layer},l),o(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},l),a(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=this,r.layer=this.layer},l),a(()=>this.layer,e=>{if(this.sublayers)for(const t of this.sublayers)t.layer=e},l)])}initialize(){n(()=>this.networkLink).then(()=>n(()=>!0===this.visible)).then(()=>this.load())}load(e){if(!this.networkLink)return;if(this.networkLink.viewFormat)return;const r=null!=e?e.signal:null,i=this._fetchService(this._get("networkLink")?.href??"",r).then(e=>{const r=d(e.sublayers);this.fullExtent=c.fromJSON(r),this.sourceJSON=e;const i=y(t.ofType(j),m(j,e));this.sublayers?this.sublayers.addMany(i):this.sublayers=i,this.layer?.emit("sublayer-update"),this.layer&&this.layer.notifyChange("visibleSublayers")});return this.addResolvingPromise(i),Promise.resolve(this)}get visible(){return this._get("visible")}set visible(e){this._get("visible")!==e&&(this._set("visible",e),this.layer&&this.layer.notifyChange("visibleSublayers"))}readVisible(e,t){return!!t.visibility}get origin(){return this.layer?new f(this.layer,this):null}_fetchService(e,t){return v(e,this.layer.outSpatialReference,this.layer.refreshInterval,t).then(e=>b(e.data))}};e([u()],S.prototype,"description",void 0),e([u({type:c})],S.prototype,"fullExtent",void 0),e([u()],S.prototype,"id",void 0),e([u({readOnly:!0,value:null})],S.prototype,"networkLink",void 0),e([u({json:{write:{allowNull:!0}}})],S.prototype,"parent",void 0),e([u({type:t.ofType(S),json:{write:{allowNull:!0}}})],S.prototype,"sublayers",void 0),e([u({value:null,json:{read:{source:"name",reader:e=>p(e)}}})],S.prototype,"title",void 0),e([u({value:!0})],S.prototype,"visible",null),e([g("visible",["visibility"])],S.prototype,"readVisible",null),e([u()],S.prototype,"sourceJSON",void 0),e([u()],S.prototype,"layer",void 0),e([u()],S.prototype,"origin",null),S=j=e([h("esri.layers.support.KMLSublayer")],S);export{S as default};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{EventedMixin as r}from"../../core/Evented.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import{Loadable as s}from"../../core/Loadable.js";import{on as o,sync as l,watch as a,whenOnce as n}from"../../core/reactiveUtils.js";import{stripHTML as p}from"../../core/string.js";import{property as u,subclass as h}from"../../core/accessorSupport/decorators.js";import{ensureType as y}from"../../core/accessorSupport/ensureType.js";import c from"../../geometry/Extent.js";import f from"../../graphic/KMLGraphicOrigin.js";import{computeExtent as d,sublayersFromJSON as m,fetchService as v,parseKML as b}from"./kmlUtils.js";import{reader as g}from"../../core/accessorSupport/decorators/reader.js";var j;let S=j=class extends(r(i(s))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.id=null,this.networkLink=null,this.parent=null,this.sublayers=null,this.title=null,this.sourceJSON=null,this.layer=null,this.addHandles([o(()=>this.sublayers,"after-add",({item:e})=>{e.parent=this,e.layer=this.layer},l),o(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},l),a(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=this,r.layer=this.layer},l),a(()=>this.layer,e=>{if(this.sublayers)for(const t of this.sublayers)t.layer=e},l)])}initialize(){n(()=>this.networkLink).then(()=>n(()=>!0===this.visible)).then(()=>this.load())}async load(e){if(!this.networkLink)return this;if(this.networkLink.viewFormat)return this;const r=null!=e?e.signal:null,i=this._fetchService(this._get("networkLink")?.href??"",r).then(e=>{const r=d(e.sublayers);this.fullExtent=c.fromJSON(r),this.sourceJSON=e;const i=y(t.ofType(j),m(j,e));this.sublayers?this.sublayers.addMany(i):this.sublayers=i,this.layer?.emit("sublayer-update"),this.layer&&this.layer.notifyChange("visibleSublayers")});return this.addResolvingPromise(i),this}get visible(){return this._get("visible")}set visible(e){this._get("visible")!==e&&(this._set("visible",e),this.layer&&this.layer.notifyChange("visibleSublayers"))}readVisible(e,t){return!!t.visibility}get origin(){return this.layer?new f(this.layer,this):null}_fetchService(e,t){return v(e,this.layer.outSpatialReference,this.layer.refreshInterval,t).then(e=>b(e.data))}};e([u()],S.prototype,"description",void 0),e([u({type:c})],S.prototype,"fullExtent",void 0),e([u()],S.prototype,"id",void 0),e([u({readOnly:!0,value:null})],S.prototype,"networkLink",void 0),e([u({json:{write:{allowNull:!0}}})],S.prototype,"parent",void 0),e([u({type:t.ofType(S),json:{write:{allowNull:!0}}})],S.prototype,"sublayers",void 0),e([u({value:null,json:{read:{source:"name",reader:e=>p(e)}}})],S.prototype,"title",void 0),e([u({value:!0})],S.prototype,"visible",null),e([g("visible",["visibility"])],S.prototype,"readVisible",null),e([u()],S.prototype,"sourceJSON",void 0),e([u()],S.prototype,"layer",void 0),e([u()],S.prototype,"origin",null),S=j=e([h("esri.layers.support.KMLSublayer")],S);export{S as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as r}from"tslib";import{Clonable as o}from"../../core/Clonable.js";import s from"../../core/Collection.js";import e from"../../core/Error.js";import{JSONSupportMixin as t}from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{t as l}from"../../chunks/persistableUrlUtils.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";let c=class extends(t(o)){constructor(r){super(r),this.type="files",this.urls=new s}writeUrls(r,o,s,t){const i=r.toArray().map(r=>l(r,t)).filter(r=>!!r);i.length?o.urls=i:t.messages?.push(new e("parquet-layer:missing-urls","Missing or empty 'urls'",{data:this}))}};r([i({type:["files"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],c.prototype,"type",void 0),r([i({type:s.ofType(String),json:{write:{isRequired:!0}}})],c.prototype,"urls",void 0),r([a("urls")],c.prototype,"writeUrls",null),c=r([p("esri.layers.support.ParquetFilesData")],c);export{c as default};
2
+ import{__decorate as r}from"tslib";import{Clonable as s}from"../../core/Clonable.js";import o from"../../core/Collection.js";import e from"../../core/Error.js";import{JSONSupportMixin as t}from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{t as l}from"../../chunks/persistableUrlUtils.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";let c=class extends(t(s)){constructor(r){super(r),this.type="files",this.urls=new o}writeUrls(r,s,o,t){const i=r.toArray().map(r=>l(r,t)).filter(r=>!!r);i.length?s.urls=i:t.messages?.push(new e("parquet-layer:missing-urls","Missing or empty 'urls'",{data:this}))}};r([i({type:["files"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],c.prototype,"type",void 0),r([i({type:o.ofType(String),json:{write:{isRequired:!0}}})],c.prototype,"urls",void 0),r([a("urls")],c.prototype,"writeUrls",null),c=r([p("esri.layers.support.ParquetFilesData")],c);export{c as default};