@arcgis/core 4.34.0-next.53 → 4.34.0-next.55

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 (340) hide show
  1. package/analysis/ElevationProfile/ElevationProfileGroundLine.d.ts +4 -0
  2. package/analysis/ElevationProfile/ElevationProfileGroundLine.js +5 -0
  3. package/analysis/ElevationProfile/ElevationProfileInputLine.d.ts +4 -0
  4. package/analysis/ElevationProfile/ElevationProfileInputLine.js +5 -0
  5. package/analysis/ElevationProfile/ElevationProfileLine.d.ts +4 -0
  6. package/analysis/ElevationProfile/ElevationProfileLine.js +5 -0
  7. package/analysis/ElevationProfile/ElevationProfileLineChartOptions.d.ts +4 -0
  8. package/analysis/ElevationProfile/{LineChartOptions.js → ElevationProfileLineChartOptions.js} +1 -1
  9. package/analysis/ElevationProfile/ElevationProfileLineViewOptions.d.ts +4 -0
  10. package/analysis/ElevationProfile/{LineViewOptions.js → ElevationProfileLineViewOptions.js} +1 -1
  11. package/analysis/ElevationProfile/ElevationProfileQueryLine.d.ts +4 -0
  12. package/analysis/ElevationProfile/ElevationProfileQueryLine.js +5 -0
  13. package/analysis/ElevationProfile/ElevationProfileSceneLine.d.ts +4 -0
  14. package/analysis/ElevationProfile/ElevationProfileSceneLine.js +5 -0
  15. package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +4 -0
  16. package/analysis/ElevationProfile/{Units.js → ElevationProfileUnits.js} +1 -1
  17. package/analysis/ElevationProfile/ElevationProfileViewOptions.d.ts +4 -0
  18. package/analysis/ElevationProfile/{ViewOptions.js → ElevationProfileViewOptions.js} +1 -1
  19. package/analysis/ElevationProfile/elevationProfileLineTypes.js +1 -1
  20. package/analysis/ElevationProfileAnalysis.js +1 -1
  21. package/applications/Components/formatUtils.d.ts +3 -0
  22. package/applications/Components/formatUtils.js +5 -0
  23. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  24. package/assets/esri/core/workers/RemoteClient.js +1 -1
  25. package/assets/esri/core/workers/chunks/01e8b9dc77a57d1c2a52.js +1 -0
  26. package/assets/esri/core/workers/chunks/027cfcde29fe87aa2ffe.js +1 -0
  27. package/assets/esri/core/workers/chunks/{e58336aafe8c95bb6831.js → 0eb728cee6e40cb30c01.js} +1 -1
  28. package/assets/esri/core/workers/chunks/18ceea59e469a0f2721b.js +1 -0
  29. package/assets/esri/core/workers/chunks/199a17b0a0f75cbaed16.js +1 -0
  30. package/assets/esri/core/workers/chunks/1eee7cf11df01a52c1bf.js +1 -0
  31. package/assets/esri/core/workers/chunks/{ac41b882f9cbf8d56f0c.js → 222f981e876f60ae282f.js} +1 -1
  32. package/assets/esri/core/workers/chunks/22334a464f798b5279b2.js +1 -0
  33. package/assets/esri/core/workers/chunks/{99b9392946d776a62997.js → 23e600e368ac829680b5.js} +1 -1
  34. package/assets/esri/core/workers/chunks/23f54b49742098def8ae.js +1 -0
  35. package/assets/esri/core/workers/chunks/24ac204d8a045aa821be.js +1 -0
  36. package/assets/esri/core/workers/chunks/252ee00fd6c4ae0ee7fa.js +1 -0
  37. package/assets/esri/core/workers/chunks/27197b0a2ffb2b6104ea.js +1 -0
  38. package/assets/esri/core/workers/chunks/{93af38d29d066f27ed28.js → 2cb14d040e67a261b31c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{0021118bafefd1e47ff7.js → 31c088966ccfff2ea1db.js} +1 -1
  40. package/assets/esri/core/workers/chunks/3b51b61a7b8a1ef87c9b.js +1 -0
  41. package/assets/esri/core/workers/chunks/3d800fbc449bea18b1cd.js +1 -0
  42. package/assets/esri/core/workers/chunks/435169b455fd2846799b.js +1 -0
  43. package/assets/esri/core/workers/chunks/4874aabdb5c60ca66216.js +1 -0
  44. package/assets/esri/core/workers/chunks/4d2473e680324dc17cfa.js +1 -0
  45. package/assets/esri/core/workers/chunks/{2da12a64d3baef4aaaa1.js → 4f8dab492331c9a2d67a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/527557b603400189d49a.js +1 -0
  47. package/assets/esri/core/workers/chunks/{4bd92232928b832dea76.js → 5900dde7a201a7d47469.js} +1 -1
  48. package/assets/esri/core/workers/chunks/62ade6f18b375795ddfd.js +1 -0
  49. package/assets/esri/core/workers/chunks/63f3e46bfa820436161c.js +1 -0
  50. package/assets/esri/core/workers/chunks/{b0ee061747bef6729bb9.js → 6801b92bce7a918fda6f.js} +1 -1
  51. package/assets/esri/core/workers/chunks/6940bb6524938894a246.js +1 -0
  52. package/assets/esri/core/workers/chunks/69e6000044bfb03776ac.js +1 -0
  53. package/assets/esri/core/workers/chunks/6b11476b2004b4db576e.js +1 -0
  54. package/assets/esri/core/workers/chunks/71cac356874b36f9a383.js +1 -0
  55. package/assets/esri/core/workers/chunks/{69dc5a7abc1fda2474ad.js → 722931d1a60be461e521.js} +1 -1
  56. package/assets/esri/core/workers/chunks/79ab06fb4c91ac8da323.js +1 -0
  57. package/assets/esri/core/workers/chunks/{0a4357af5b8c0532b439.js → 7bdfc7c7ce1d94c00745.js} +1 -1
  58. package/assets/esri/core/workers/chunks/813efde41e90e652b7db.js +1 -0
  59. package/assets/esri/core/workers/chunks/82404ff7c298493ff6f4.js +1 -0
  60. package/assets/esri/core/workers/chunks/{0ce671588de2858516d2.js → 83737d86584bf1b32368.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{98ea12c7a000a30f3dc0.js → 87f68c2b9361bd3f8cac.js} +1 -1
  62. package/assets/esri/core/workers/chunks/97ae2fdb6cb98249f5fa.js +1 -0
  63. package/assets/esri/core/workers/chunks/9a20390602126995f831.js +1 -0
  64. package/assets/esri/core/workers/chunks/9cdeead9d444e8d95477.js +1 -0
  65. package/assets/esri/core/workers/chunks/a778a72456fefdf40115.js +1 -0
  66. package/assets/esri/core/workers/chunks/a999f804fc2f00b2e7ae.js +1 -0
  67. package/assets/esri/core/workers/chunks/ae73ac81bd10614c2b53.js +1 -0
  68. package/assets/esri/core/workers/chunks/c7d4c296011c5393bcaa.js +1 -0
  69. package/assets/esri/core/workers/chunks/c86e339e45900c54c9f5.js +1 -0
  70. package/assets/esri/core/workers/chunks/{a1d3f1c221389eb6090c.js → c95e6bef8c97cf647869.js} +1 -1
  71. package/assets/esri/core/workers/chunks/cbec768cd98caff212f2.js +1 -0
  72. package/assets/esri/core/workers/chunks/d81c4afad4abe2d1d0b9.js +1 -0
  73. package/assets/esri/core/workers/chunks/dd120d562b63618e71c0.js +1 -0
  74. package/assets/esri/core/workers/chunks/dfb12f42b8d319ffa5fc.js +1 -0
  75. package/assets/esri/core/workers/chunks/e04951ee32f041faaeca.js +1 -0
  76. package/assets/esri/core/workers/chunks/e982cf44906eb26164f2.js +1 -0
  77. package/assets/esri/core/workers/chunks/{081b22fa73ef7b696409.js → ead1acf95c3385630da8.js} +2 -2
  78. package/assets/esri/core/workers/chunks/f1c50f37a81c672263a1.js +1 -0
  79. package/assets/esri/core/workers/chunks/fe5c37c69da3ec1e56ac.js +1 -0
  80. package/assets/esri/core/workers/chunks/ff323db554c9e09749e8.js +1 -0
  81. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  82. package/chunks/Laserlines.glsl.js +1 -1
  83. package/chunks/LineSeries.js +1 -1
  84. package/chunks/Theme.js +1 -1
  85. package/chunks/boundedPlane.js +1 -1
  86. package/chunks/bundle.js +1 -1
  87. package/chunks/chartUtilsAm5.js +1 -1
  88. package/chunks/sphere.js +1 -1
  89. package/chunks/vec42.js +1 -1
  90. package/config.js +1 -1
  91. package/core/ArrayPool.js +1 -1
  92. package/core/Collection.js +1 -1
  93. package/core/ObjectPool.js +1 -1
  94. package/core/accessorSupport/Properties.js +1 -1
  95. package/core/accessorSupport/watch.js +1 -1
  96. package/core/arrayUtils.js +1 -1
  97. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  98. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  99. package/core/pbf.js +1 -1
  100. package/core/typedArrayUtil.js +1 -1
  101. package/geohash/GeohashCell.js +1 -1
  102. package/geohash/GeohashTree.js +1 -1
  103. package/geometry/operators/json/graphicBufferOperator.js +5 -0
  104. package/geometry/support/DoubleArray.js +1 -1
  105. package/geometry/support/boundedPlane.js +1 -1
  106. package/geometry/support/coordinateSystem.js +1 -1
  107. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  108. package/geometry/support/sphere.js +1 -1
  109. package/interfaces.d.ts +232 -322
  110. package/kernel.js +1 -1
  111. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  112. package/layers/graphics/sources/ParquetSource.js +1 -1
  113. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  114. package/networks/support/typeUtils.js +1 -1
  115. package/package.json +1 -1
  116. package/rest/knowledgeGraphService.js +1 -1
  117. package/rest/networks/support/Circuit.js +5 -0
  118. package/rest/networks/support/CircuitSection.js +1 -1
  119. package/rest/networks/support/Subcircuit.js +1 -1
  120. package/rest/print.js +1 -1
  121. package/support/revision.js +1 -1
  122. package/symbols/cim/CIMEffects.js +1 -1
  123. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  124. package/symbols/cim/effects/EffectOffset.js +1 -1
  125. package/views/2d/analysisViewModuleImportUtils.js +5 -0
  126. package/views/2d/engine/Container.js +1 -1
  127. package/views/2d/engine/DisplayObject.js +1 -1
  128. package/views/2d/engine/flow/dataUtils.js +1 -1
  129. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  130. package/views/2d/engine/webgl/DisplayEntity.js +1 -1
  131. package/views/2d/engine/webgl/DisplayRecord.js +1 -1
  132. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  133. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  134. package/views/2d/engine/webgl/PooledUint32Array.js +1 -1
  135. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  136. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  138. package/views/2d/input/MapViewInputManager.js +1 -1
  139. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  140. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  141. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  142. package/views/2d/layers/LayerView2D.js +1 -1
  143. package/views/2d/layers/features/FeatureContainer.js +1 -1
  144. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  145. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  146. package/views/2d/layers/features/FeatureSpatialIndex.js +1 -1
  147. package/views/2d/layers/features/Processor.js +1 -1
  148. package/views/2d/layers/features/RenderState.js +1 -1
  149. package/views/2d/layers/features/aggregation/AccumulatedStatistics.js +1 -1
  150. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  151. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  152. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  153. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  154. package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
  155. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  156. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  157. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  158. package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
  159. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  160. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  161. package/views/2d/layers/features/support/DisplayIdGenerator.js +1 -1
  162. package/views/2d/layers/features/support/FeatureSetCache.js +1 -1
  163. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  164. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  165. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  166. package/views/2d/layers/features/support/StaticBitSet.js +1 -1
  167. package/views/2d/tiling/TileCoverage.js +1 -1
  168. package/views/2d/tiling/TileKey.js +1 -1
  169. package/views/3d/FocusAreasView.js +1 -1
  170. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  171. package/views/3d/analysis/ElevationProfile/{HoveredPointVisualization.js → ElevationProfileHoveredPointVisualization.js} +1 -1
  172. package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +5 -0
  173. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization.js +5 -0
  174. package/views/3d/analysis/ElevationProfile/ElevationProfileLinesVisualization.js +5 -0
  175. package/views/3d/analysis/ElevationProfile/ElevationProfileSceneLineComputation.js +5 -0
  176. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization.js +5 -0
  177. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  178. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  179. package/views/3d/analysis/Slice/SliceController.js +1 -1
  180. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  181. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  182. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  183. package/views/3d/analysisViewModuleImportUtils.js +5 -0
  184. package/views/3d/camera/constraintUtils/distance.js +1 -1
  185. package/views/3d/input/SceneInputManager.js +1 -1
  186. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  187. package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
  188. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  189. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  190. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  191. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  192. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  193. package/views/3d/layers/I3SMeshView3D.js +1 -1
  194. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  195. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  196. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  197. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  198. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  199. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  200. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  201. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  202. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  203. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  204. package/views/3d/layers/i3s/I3SNode.js +1 -1
  205. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  206. package/views/3d/state/ViewState.js +1 -1
  207. package/views/3d/state/ViewStateManager.js +1 -1
  208. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  209. package/views/3d/support/ViewSlice.js +1 -1
  210. package/views/3d/support/orientedBoundingBox.js +1 -1
  211. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  212. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  213. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  214. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  215. package/views/3d/terrain/ScaleRangeQueries.js +1 -1
  216. package/views/3d/terrain/SphericalPatch.js +1 -1
  217. package/views/3d/terrain/TerrainRenderer.js +1 -1
  218. package/views/3d/terrain/TerrainSurface.js +1 -1
  219. package/views/3d/terrain/Tile.js +1 -1
  220. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  221. package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
  222. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  223. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  224. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  225. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  226. package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
  227. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  228. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  229. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  230. package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
  231. package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
  232. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  233. package/views/SceneView.js +1 -1
  234. package/views/ToolViewManager.js +1 -1
  235. package/views/View.js +1 -1
  236. package/views/View2D.js +1 -1
  237. package/views/analysis/ElevationProfile/ElevationProfileController.js +5 -0
  238. package/views/analysis/ElevationProfile/{ProfileGenerationError.js → ElevationProfileGenerationError.js} +1 -1
  239. package/views/analysis/ElevationProfile/ElevationProfileGroundLineComputation.js +5 -0
  240. package/views/analysis/ElevationProfile/ElevationProfileInputLineComputation.js +5 -0
  241. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +5 -0
  242. package/views/analysis/ElevationProfile/ElevationProfileQueryLineComputation.js +5 -0
  243. package/views/analysis/ElevationProfile/ElevationProfileResult.d.ts +4 -0
  244. package/views/analysis/ElevationProfile/ElevationProfileResult.js +5 -0
  245. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +5 -0
  246. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +5 -0
  247. package/views/draw/DrawGraphicTool.js +1 -1
  248. package/views/draw/DrawOperation.js +1 -1
  249. package/views/draw/LegacyDrawManipulator.js +1 -1
  250. package/views/input/InputManager.js +1 -1
  251. package/views/input/handlers/LatestPointer.js +1 -1
  252. package/views/interactive/InteractiveToolBase.js +1 -1
  253. package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
  254. package/views/interactive/Tooltip.js +1 -1
  255. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  256. package/views/interactive/sketch/constraints.js +1 -1
  257. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  258. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  259. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  260. package/views/layers/FeatureLayerView.js +1 -1
  261. package/views/support/AnalysisViewManager.js +5 -0
  262. package/views/support/PropertiesPool.js +1 -1
  263. package/widgets/ElevationProfile/ElevationProfileLine.d.ts +2 -2
  264. package/widgets/Feature/FeatureViewModel.js +1 -1
  265. package/widgets/Sketch/SketchViewModel.js +1 -1
  266. package/analysis/ElevationProfile/GroundLine.d.ts +0 -4
  267. package/analysis/ElevationProfile/GroundLine.js +0 -5
  268. package/analysis/ElevationProfile/InputLine.d.ts +0 -4
  269. package/analysis/ElevationProfile/InputLine.js +0 -5
  270. package/analysis/ElevationProfile/Line.d.ts +0 -4
  271. package/analysis/ElevationProfile/Line.js +0 -5
  272. package/analysis/ElevationProfile/LineChartOptions.d.ts +0 -4
  273. package/analysis/ElevationProfile/LineViewOptions.d.ts +0 -4
  274. package/analysis/ElevationProfile/QueryLine.d.ts +0 -4
  275. package/analysis/ElevationProfile/QueryLine.js +0 -5
  276. package/analysis/ElevationProfile/SceneLine.d.ts +0 -4
  277. package/analysis/ElevationProfile/SceneLine.js +0 -5
  278. package/analysis/ElevationProfile/Units.d.ts +0 -4
  279. package/analysis/ElevationProfile/ViewOptions.d.ts +0 -4
  280. package/assets/esri/core/workers/chunks/14c6ae4feb4859cfa7c5.js +0 -1
  281. package/assets/esri/core/workers/chunks/20a2b3d1f826e9059884.js +0 -1
  282. package/assets/esri/core/workers/chunks/250b1629becca0410f2a.js +0 -1
  283. package/assets/esri/core/workers/chunks/2b75212c31145cc07d16.js +0 -1
  284. package/assets/esri/core/workers/chunks/2efa4d8fe5454f8b2a05.js +0 -1
  285. package/assets/esri/core/workers/chunks/3149a86cd25684dcb0b3.js +0 -1
  286. package/assets/esri/core/workers/chunks/38f84294fb2fb4663ba5.js +0 -1
  287. package/assets/esri/core/workers/chunks/3eb3af0b6cf3c2f28131.js +0 -1
  288. package/assets/esri/core/workers/chunks/43bd338bb0de375b9bb7.js +0 -1
  289. package/assets/esri/core/workers/chunks/4622a3e64d3c4aafa56b.js +0 -1
  290. package/assets/esri/core/workers/chunks/47f2e905ef42e36897aa.js +0 -1
  291. package/assets/esri/core/workers/chunks/4c6862ad3af947c704f7.js +0 -1
  292. package/assets/esri/core/workers/chunks/50e9eafb118d2a221f10.js +0 -1
  293. package/assets/esri/core/workers/chunks/55588e668b6acb6aa390.js +0 -1
  294. package/assets/esri/core/workers/chunks/5b112471dca94b2e8462.js +0 -1
  295. package/assets/esri/core/workers/chunks/5dfe1aed10095385c066.js +0 -1
  296. package/assets/esri/core/workers/chunks/5fc414fc2cfc68828c5b.js +0 -1
  297. package/assets/esri/core/workers/chunks/7389841fabe0f319f1e5.js +0 -1
  298. package/assets/esri/core/workers/chunks/781b59ba0cabe78bc122.js +0 -1
  299. package/assets/esri/core/workers/chunks/8e0559cc6295008fcdf7.js +0 -1
  300. package/assets/esri/core/workers/chunks/944fa8261aad94ae0542.js +0 -1
  301. package/assets/esri/core/workers/chunks/9e479e7e2e51476c3d27.js +0 -1
  302. package/assets/esri/core/workers/chunks/a1e179dd6de9c8769b02.js +0 -1
  303. package/assets/esri/core/workers/chunks/a6493607b98783bf1ef2.js +0 -1
  304. package/assets/esri/core/workers/chunks/a829969ed44cdb814f27.js +0 -1
  305. package/assets/esri/core/workers/chunks/b2a035befeeff1a55ad8.js +0 -1
  306. package/assets/esri/core/workers/chunks/b4251e10621fb3ad03a3.js +0 -1
  307. package/assets/esri/core/workers/chunks/b877142a275188a16e17.js +0 -1
  308. package/assets/esri/core/workers/chunks/b9f5672093727c6f92c9.js +0 -1
  309. package/assets/esri/core/workers/chunks/ba45dccb4dab5a74d224.js +0 -1
  310. package/assets/esri/core/workers/chunks/cc0cb4906e4419f7c4a9.js +0 -1
  311. package/assets/esri/core/workers/chunks/cda27c0fafd687dfa72e.js +0 -1
  312. package/assets/esri/core/workers/chunks/ddd6597a66ec6b972f9c.js +0 -1
  313. package/assets/esri/core/workers/chunks/e28d3ed65c3a76a044c8.js +0 -1
  314. package/assets/esri/core/workers/chunks/e3f68f7b408a08d7cd5d.js +0 -1
  315. package/assets/esri/core/workers/chunks/e9716995ce0c3683eafc.js +0 -1
  316. package/assets/esri/core/workers/chunks/ed25bf087f52e5d3e71b.js +0 -1
  317. package/assets/esri/core/workers/chunks/f75ddd79be506423be09.js +0 -1
  318. package/assets/esri/core/workers/chunks/f8505bf69795f5293a79.js +0 -1
  319. package/assets/esri/core/workers/chunks/f92e608931b1c168cb45.js +0 -1
  320. package/assets/esri/core/workers/chunks/fb4950995f6780f6c22a.js +0 -1
  321. package/views/3d/analysis/AnalysisViewManager3D.js +0 -5
  322. package/views/3d/analysis/ElevationProfile/HoveredPointsVisualization.js +0 -5
  323. package/views/3d/analysis/ElevationProfile/InputVisualization.js +0 -5
  324. package/views/3d/analysis/ElevationProfile/ProfileLinesVisualization.js +0 -5
  325. package/views/3d/analysis/ElevationProfile/SceneLineComputation.js +0 -5
  326. package/views/3d/analysis/ElevationProfile/Visualization.js +0 -5
  327. package/views/analysis/ElevationProfile/Controller.js +0 -5
  328. package/views/analysis/ElevationProfile/GroundLineComputation.js +0 -5
  329. package/views/analysis/ElevationProfile/InputLineComputation.js +0 -5
  330. package/views/analysis/ElevationProfile/LineComputation.js +0 -5
  331. package/views/analysis/ElevationProfile/QueryLineComputation.js +0 -5
  332. package/views/analysis/ElevationProfile/Result.d.ts +0 -4
  333. package/views/analysis/ElevationProfile/Result.js +0 -5
  334. package/views/analysis/ElevationProfile/geometryUtils.js +0 -5
  335. package/views/analysis/ElevationProfile/profileGenerationUtils.js +0 -5
  336. /package/views/analysis/ElevationProfile/{elevationQuerySourceUtils.js → elevationProfileQuerySourceUtils.js} +0 -0
  337. /package/views/analysis/ElevationProfile/{statisticsUtils.js → elevationProfileStatisticsUtils.js} +0 -0
  338. /package/views/analysis/ElevationProfile/{traversalUtils.js → elevationProfileTraversalUtils.js} +0 -0
  339. /package/views/analysis/ElevationProfile/{unitUtils.js → elevationProfileUnitUtils.js} +0 -0
  340. /package/views/analysis/ElevationProfile/{visualizationUtils.js → elevationProfileVisualizationUtils.js} +0 -0
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.53",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.55",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- 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 o,initial as n,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as _}from"../../../geometry/projection/projectBoundingRect.js";import{create as c}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as p}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as g}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as m}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as y}from"../../../views/3d/layers/i3s/I3SIndex.js";import x from"../../../views/3d/layers/i3s/I3SLodHandling.js";import f from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as N}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as b,getIndexCrs as w,findIntersectingNodes as v}from"../../../views/3d/layers/i3s/I3SUtil.js";import C from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{maxDownloadSlots as L}from"../../../views/3d/support/downloadSlots.js";import{toBoundingRect as D}from"../../../views/3d/support/extentUtils.js";import{minQuality as V}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as A}from"../../../views/support/PromiseQueue.js";import{noBudget as I}from"../../../views/support/Scheduler.js";const S=100,M=2,F=1e4,O=1e-4,P=1.2,U=500,q=1.5;let G=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 indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(2);return new N(e,this.layer.customParameters,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(3);return new N(e,this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return b(this.layer)}get crsIndex(){return w(this.layer)}get layer(){return this.layerView.i3slayer}get running(){return this.updating}get rootNodeVisible(){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.updating=!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._idleStateCallbacks=null,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 A,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 x(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,{resourceController:d}=r;if(this._setClippingArea(r.clippingArea),this.addHandles([o(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),n),o(()=>r.quality,()=>this._setCameraDirty(),l),o(()=>e.contentVisible,e=>{const t=e?()=>this._updateIdleState(!0):()=>this._updateViewData(),i=e?()=>this._updateIdleState(!1):()=>{};e&&null!=this._index&&this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(e||this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=d.scheduler.registerIdleStateCallbacks(t,i)},n),m(e.view.resourceController.scheduler,this),o(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),o(()=>r.state?.contentCamera,()=>this._setCameraDirty()),o(()=>t.elevationInfo,e=>this._elevationInfoChanged(e)),o(()=>e.lodFactor,()=>this._setCameraDirty()),o(()=>e.availableFields,()=>this._requiredFieldsChange()),o(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new C(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.basemapTerrain:r.elevationProvider,p(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new g(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new y(p(r.viewingMode),t,s,this.indexStreamController,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),()=>!this.indexStreamController.busy,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._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._nodeLoader=null,Q.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),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=k(e,i),r=k(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();j(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=c();D(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.progressiveLoadPenalty=T.distancePenalty*this._viewportQueries.distCameraToPOI(),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._evaluateUpdating()}_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._evaluateUpdating(),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)||(_(e,t,R,this.crsIndex),e=R);const s=this._elevationUpdateNodes;return s.clear(),v(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.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}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._evaluateUpdating(),-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._evaluateUpdating())}_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.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));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>U){if(this._featureLOD<=O)return;this._featureLOD/=q,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=F||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*P||e&&i.estimate>t))return;if(this._featureLOD<=O)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(F,Math.max(O,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?S:M)-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>=M)&&(this._downloadingCount<L&&!this.dataStreamController.busy)}_evaluateUpdating(){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.updating=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.progressiveLoadPenalty=T.distancePenalty*this._viewportQueries.distCameraToPOI(),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)-V)/(.5-V)}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.calcCameraDistanceToCenter(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 f(this.layer,this.dataStreamController,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._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_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,I,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._evaluateUpdating();try{const i=this.layerView.getLoadedAttributes(e.index),s=j(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._evaluateUpdating()}_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._evaluateUpdating(),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._evaluateUpdating()})}_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&&j(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}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,i)=>this._clientNodeLoader.loadTextures(e,t,i),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const o=this._requiredAttributes,n=await this.reschedule(()=>this._loadAttributes(e,o,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:o,attributeData:n},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).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,null!=this._index&&this._index.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&null!=this._index&&this._index.resetFailedNodes())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],G.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],G.prototype,"isGraphics3D",null),e([h({readOnly:!0})],G.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],G.prototype,"indexStreamController",null),e([h({readOnly:!0})],G.prototype,"dataStreamController",null),e([h({readOnly:!0})],G.prototype,"crsVertex",null),e([h({readOnly:!0})],G.prototype,"crsIndex",null),e([h()],G.prototype,"featureTarget",void 0),e([h()],G.prototype,"fixedFeatureTarget",void 0),e([h()],G.prototype,"layerView",void 0),e([h()],G.prototype,"layer",null),e([h()],G.prototype,"updating",void 0),e([h({readOnly:!0})],G.prototype,"running",null),e([h()],G.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],G.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],G.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],G.prototype,"rootNodeVisible",null),G=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],G);const Q=new r({deallocator:null});function j(e,t){return null!=e&&e.length===t.length&&e.every(e=>k(t,e.name)>=0)}function k(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 T={distancePenalty:10},R=c();export{G as default};
5
+ 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 o,sync as n,initial as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{q as _}from"../../../chunks/vec32.js";import{projectBoundingRect as c}from"../../../geometry/projection/projectBoundingRect.js";import{create as p}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as g}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as m}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as y}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import f from"../../../views/3d/layers/i3s/I3SLodHandling.js";import N from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as b}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as w,getIndexCrs as v,findIntersectingNodes as C}from"../../../views/3d/layers/i3s/I3SUtil.js";import L from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{maxDownloadSlots as D}from"../../../views/3d/support/downloadSlots.js";import{toBoundingRect as V}from"../../../views/3d/support/extentUtils.js";import{minQuality as A}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as I}from"../../../views/support/PromiseQueue.js";import{noBudget as S}from"../../../views/support/Scheduler.js";const M=100,F=2,O=1e4,P=1e-4,U=1.2,q=500,G=1.5;let Q=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 indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(2);return new b(e,this.layer.customParameters,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(3);return new b(e,this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return w(this.layer)}get crsIndex(){return v(this.layer)}get layer(){return this.layerView.i3slayer}get running(){return this.updating}get rootNodeVisible(){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.updating=!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._idleStateCallbacks=null,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 I,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 f(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,{resourceController:d}=r;if(this._setClippingArea(r.clippingArea),this.addHandles([o(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:_}),o(()=>r.quality,()=>this._setCameraDirty(),n),o(()=>e.contentVisible,e=>{const t=e?()=>this._updateIdleState(!0):()=>this._updateViewData(),i=e?()=>this._updateIdleState(!1):()=>{};e&&null!=this._index&&this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(e||this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=d.scheduler.registerIdleStateCallbacks(t,i)},l),y(e.view.resourceController.scheduler,this),o(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),o(()=>r.state?.contentCamera,()=>this._setCameraDirty()),o(()=>t.elevationInfo,e=>this._elevationInfoChanged(e)),o(()=>e.lodFactor,()=>this._setCameraDirty()),o(()=>e.availableFields,()=>this._requiredFieldsChange()),o(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new L(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.basemapTerrain:r.elevationProvider,g(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new m(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new x(g(r.viewingMode),t,s,this.indexStreamController,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),()=>!this.indexStreamController.busy,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._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._nodeLoader=null,j.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),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();k(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=p();V(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.progressiveLoadPenalty=R.distancePenalty*this._viewportQueries.distCameraToPOI(),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._evaluateUpdating()}_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._evaluateUpdating(),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)||(c(e,t,E,this.crsIndex),e=E);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.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}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._evaluateUpdating(),-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._evaluateUpdating())}_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.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));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>q){if(this._featureLOD<=P)return;this._featureLOD/=G,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=O||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*U||e&&i.estimate>t))return;if(this._featureLOD<=P)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(O,Math.max(P,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?M:F)-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>=F)&&(this._downloadingCount<D&&!this.dataStreamController.busy)}_evaluateUpdating(){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.updating=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.progressiveLoadPenalty=R.distancePenalty*this._viewportQueries.distCameraToPOI(),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)-A)/(.5-A)}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.calcCameraDistanceToCenter(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 N(this.layer,this.dataStreamController,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._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;j.clear(),this.layerView.getLoadedNodeIndices(j);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return j.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),j.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(j,e,0),!(i&&this._lodDropFactor<1)&&(0===j.length||(j.clear(),!1))}markNodeToRemove(e){j.push(e)}removeMarkedNodes(){this._removeNodes(j,S,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._evaluateUpdating();try{const i=this.layerView.getLoadedAttributes(e.index),s=k(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._evaluateUpdating()}_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._evaluateUpdating(),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._evaluateUpdating()})}_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&&k(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}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,i)=>this._clientNodeLoader.loadTextures(e,t,i),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const o=this._requiredAttributes,n=await this.reschedule(()=>this._loadAttributes(e,o,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:o,attributeData:n},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).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,null!=this._index&&this._index.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&null!=this._index&&this._index.resetFailedNodes())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],Q.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],Q.prototype,"isGraphics3D",null),e([h({readOnly:!0})],Q.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],Q.prototype,"indexStreamController",null),e([h({readOnly:!0})],Q.prototype,"dataStreamController",null),e([h({readOnly:!0})],Q.prototype,"crsVertex",null),e([h({readOnly:!0})],Q.prototype,"crsIndex",null),e([h()],Q.prototype,"featureTarget",void 0),e([h()],Q.prototype,"fixedFeatureTarget",void 0),e([h()],Q.prototype,"layerView",void 0),e([h()],Q.prototype,"layer",null),e([h()],Q.prototype,"updating",void 0),e([h({readOnly:!0})],Q.prototype,"running",null),e([h()],Q.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],Q.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],Q.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],Q.prototype,"rootNodeVisible",null),Q=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],Q);const j=new r({deallocator:null});function k(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 R={distancePenalty:10},E=p();export{Q as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{Loadable as r}from"../../../core/Loadable.js";import o from"../../../core/Logger.js";import{open as s}from"../../../core/workers/workers.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Extent.js";import l from"../../support/FieldsIndex.js";import{toParquetJSONGeometryType as u}from"../../support/parquetUtils.js";import p from"../../../rest/support/FeatureSet.js";let c=class extends r{constructor(e){super(e),this.type="parquet",this.urls=null,this.fields=null,this.objectIdField=null,this.spatialReference=null}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this._initialize(t)),Promise.resolve(this)}destroy(){this._connection.destroy()}setCustomParameters(e){this.customParameters=e,this._proxy.setCustomParameters(this.customParameters).catch(()=>{o.getLogger(this).warn("Failed to update customParameters")})}async queryFeaturesJSON(e,t={}){return await this.load(t),this._proxy.queryFeatures(e.toJSON(),t)}async queryFeatures(e,t={}){const r=await this.queryFeaturesJSON(e,t);return p.fromJSON(r)}async queryObjectIds(e,t){return await this._proxy.queryObjectIds(e.toJSON(),t)}async queryFeatureCount(e,t){return this._proxy.queryFeatureCount(e.toJSON(),t)}async queryExtent(e,t){if(null==this.encoding)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(e.toJSON(),t);return{count:r.count,extent:a.fromJSON(r.extent)}}async _initialize(e){let r;if(this._connection=await s("ParquetSourceWorker",{strategy:"dedicated"}),this._proxy=this._connection.createInvokeProxy(),this.geometryType&&this.encoding){if(!this.spatialReference)throw new t("parquet:unsupported","SpatialReference must be defined");r={geometryType:u(this.geometryType),spatialReference:this.spatialReference.toJSON(),encoding:this.encoding.toJSON(),displayOptimization:this.displayOptimization}}const o=new l(this.fields).toJSON(),{extent:i}=await this._proxy.load({urls:this.urls,metadata:{fieldsIndex:o,geometryType:r?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:r?.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null},geometryInfo:r,customParameters:this.customParameters});this.fullExtent=i?a.fromJSON(i):null}};e([i()],c.prototype,"type",void 0),e([i()],c.prototype,"urls",void 0),e([i()],c.prototype,"fields",void 0),e([i()],c.prototype,"encoding",void 0),e([i()],c.prototype,"geometryType",void 0),e([i()],c.prototype,"objectIdField",void 0),e([i()],c.prototype,"spatialReference",void 0),e([i()],c.prototype,"file",void 0),e([i()],c.prototype,"customParameters",void 0),e([i()],c.prototype,"displayOptimization",void 0),e([i()],c.prototype,"fullExtent",void 0),c=e([n("esri.layers.graphics.sources.ParquetSource")],c);export{c as ParquetSource};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{Loadable as r}from"../../../core/Loadable.js";import o from"../../../core/Logger.js";import{open as s}from"../../../core/workers/workers.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Extent.js";import l from"../../support/FieldsIndex.js";import{toParquetJSONGeometryType as u}from"../../support/parquetUtils.js";import p from"../../../rest/support/FeatureSet.js";let c=class extends r{constructor(e){super(e),this.type="parquet",this.urls=null,this.fields=null,this.objectIdField=null,this.spatialReference=null}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this._initialize(t)),Promise.resolve(this)}destroy(){this._connection.destroy()}setCustomParameters(e){this.customParameters=e,this._proxy.setCustomParameters(this.customParameters).catch(()=>{o.getLogger(this).warn("Failed to update customParameters")})}async queryFeaturesJSON(e,t={}){return await this.load(t),this._proxy.queryFeatures(e.toJSON(),{signal:t?.signal})}async queryFeatures(e,t={}){const r=await this.queryFeaturesJSON(e,{signal:t?.signal});return p.fromJSON(r)}async queryObjectIds(e,t){return await this._proxy.queryObjectIds(e.toJSON(),{signal:t?.signal})}async queryFeatureCount(e,t){return this._proxy.queryFeatureCount(e.toJSON(),{signal:t?.signal})}async queryExtent(e,t){if(null==this.encoding)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(e.toJSON(),{signal:t?.signal});return{count:r.count,extent:a.fromJSON(r.extent)}}async _initialize(e){let r;if(this._connection=await s("ParquetSourceWorker",{strategy:"dedicated"}),this._proxy=this._connection.createInvokeProxy(),this.geometryType&&this.encoding){if(!this.spatialReference)throw new t("parquet:unsupported","SpatialReference must be defined");r={geometryType:u(this.geometryType),spatialReference:this.spatialReference.toJSON(),encoding:this.encoding.toJSON(),displayOptimization:this.displayOptimization}}const o=new l(this.fields).toJSON(),{extent:i}=await this._proxy.load({urls:this.urls,metadata:{fieldsIndex:o,geometryType:r?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:r?.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null},geometryInfo:r,customParameters:this.customParameters});this.fullExtent=i?a.fromJSON(i):null}};e([i()],c.prototype,"type",void 0),e([i()],c.prototype,"urls",void 0),e([i()],c.prototype,"fields",void 0),e([i()],c.prototype,"encoding",void 0),e([i()],c.prototype,"geometryType",void 0),e([i()],c.prototype,"objectIdField",void 0),e([i()],c.prototype,"spatialReference",void 0),e([i()],c.prototype,"file",void 0),e([i()],c.prototype,"customParameters",void 0),e([i()],c.prototype,"displayOptimization",void 0),e([i()],c.prototype,"fullExtent",void 0),c=e([n("esri.layers.graphics.sources.ParquetSource")],c);export{c as ParquetSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import{assertIsSome as o}from"../../../../core/maybe.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import a from"../../../../geometry/SpatialReference.js";import{set as i,create as u,expandWithRect as l,expandWithAABB as f,negativeInfinity as c,fromRect as d}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as m,QueryEngine as h}from"../../data/QueryEngine.js";import{QueryEngineResult as y}from"../../data/QueryEngineResult.js";import p from"../../../support/FieldsIndex.js";import{collectSQLFieldNames as _}from"../../../support/fieldUtils.js";import{createParquetFile as g,readGeoMetadata as x}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as w}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as R}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as F}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as I}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as C}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const q=new w,j=8e3;class b{constructor(){this._files=[],this._queue=new n({concurrency:1,process:(e,t)=>this._executeQuery(e,t)})}async load(r){this.setCustomParameters(r.customParameters),this._files=await Promise.all(r.urls.map(e=>g(e,{geometryInfo:r.geometryInfo,outSpatialReference:null,getCustomParameters:()=>this._customParameters}))),this._metadata=I.createFeature(r.metadata),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:r.geometryInfo?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:a.fromJSON(r.geometryInfo?.spatialReference),aggregateAdapter:null,timeInfo:null,definitionExpression:null};const s=this._files[0];if(!s)return{extent:null};const{fields:o,timeZoneByFieldName:n}=r.metadata.fieldsIndex,f=o.map(e=>({...e,column:s.columnForFieldName(e.name)})),d=p.fromJSON({fields:f,timeZoneByFieldName:n});if(this._fieldsIndex=d,r.metadata.spatialReference&&(this._fullExtent=v(this._files,r.metadata.spatialReference)),null==this._fullExtent&&"location"===r.geometryInfo?.encoding.type){const{latitudeFieldName:s,longitudeFieldName:o}=r.geometryInfo.encoding,n=this._fieldsIndex.get(s)?.column,a=this._fieldsIndex.get(o)?.column,f=i(u(),c);for(const r of this._files)for(const s of r.rowGroups()){const r={stack:[],error:void 0,hasError:!1};try{const t=e(r,s.columnDescriptorForAttribute(n),!1),o=e(r,s.columnDescriptorForAttribute(a),!1),i=[o.minValue(),t.minValue(),o.maxValue(),t.maxValue()];l(f,i),s.free()}catch(m){r.error=m,r.hasError=!0}finally{t(r)}}this._fullExtent={xmin:f[0],ymin:f[1],xmax:f[3],ymax:f[4],spatialReference:r.metadata.spatialReference}}return{extent:this._fullExtent}}destroy(){for(const e of this._files)e.free();this._queue.destroy()}setCustomParameters(e){this._customParameters=e}async queryFeatures(e,t){this._validateQuery(e),e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0;return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){if(this._validateQuery(e),!Q(e))return this._getFeatureCount();e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.resultOffset=e.resultOffset??0,delete e.outFields,delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponseForCount()}async queryObjectIds(e,t){if(this._validateQuery(e),!Q(e))return Array.from({length:this._getFeatureCount()},(e,t)=>t);e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0,delete e.returnGeometry,delete e.outFields;return(await this._enqueueQuery(e,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){if(this._validateQuery(e),this._fullExtent&&!Q(e))return{count:this._getFeatureCount(),extent:this._fullExtent};const s=r(this._metadata.spatialReference);e.resultOffset=e.resultOffset??0,e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.returnGeometry=!0,delete e.outFields;const o=i(u(),c),n=u(),a=await this._enqueueQuery(e,t);let l=0;for(const r of a.items)r.getBounds(n)&&(f(o,n),l+=1);return{count:l,extent:m(o,s,e.outSR?r(e.outSR):s,s,!1)}}_getFeatureCount(){return this._files.reduce((e,t)=>e+t.numRows(),0)}_validateQuery(e){if(e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e})}async*_fetchChunks(e,t){const r=this._files[0].numRows(),s=Math.ceil(r/j);for(let o=0;o<s;o++){const r=o*j,s=await this._files[0].readChunk(r,j,e.fields,e.returnGeometry,t);for(const e of s){const t=new C(this._metadata,this._fieldsIndex,e,0),r=new R(t,null,0,!1),s=O(this._metadata,r,this._queryEngineParams);yield s}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){let r=e.resultRecordCount,s=e.resultOffset;o(r),o(s),delete e.resultRecordCount,delete e.resultOffset;const n=await this._getReadParams(e),a=[];for await(const o of this._fetchChunks(n,t)){const n=await o.executeQueryForOpaqueFeatures(e,t);if(n.length>s){const t=n.slice(s,Math.min(s+r,n.length));for(const e of t)a.push(e);if(s=0,r-=t.length,0===r)return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}else s-=n.length}return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}async _getReadParams(e){const t=new Set;if(e.where&&await _(t,this._fieldsIndex,e.where),e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:this._getAttributeIds(Array.from(t)),returnGeometry:!!e.returnGeometry||!!e.geometry}}_getAttributeIds(e){if(null==e)return new Uint32Array;if(e.includes("*"))return new Uint32Array(this._fieldsIndex.fields.map(e=>e.column).filter(e=>null!=e));const t=[];for(const r of e){const e=this._fieldsIndex.get(r);if(null==e)throw new s("unknown-field",`Field ${r} does not exist`);null==e.column||t.push(e.column)}return new Uint32Array(t)}}function Q(e){return Object.keys(e).some(e=>S(e))}function S(e){switch(e){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"where":case"objectIds":case"historicMoment":return!0;default:return!1}}function O(e,t,r){const s=new F(e);return s.insert(t),new h({...r,featureStore:s})}function E(e){switch(e.length){case 4:return d(u(),e);case 6:return e;default:throw new s("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function v(e,t){const r=i(u(),c);for(const s of e){const e=x(s);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const o=E(t.bbox);f(r,o)}return{xmin:r[0],ymin:r[1],xmax:r[3],ymax:r[4],spatialReference:t}}export{b as default};
5
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import{assertIsSome as o}from"../../../../core/maybe.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import a from"../../../../geometry/SpatialReference.js";import{set as i,create as u,expandWithRect as l,expandWithAABB as f,negativeInfinity as d,fromRect as c}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as m,QueryEngine as h}from"../../data/QueryEngine.js";import{QueryEngineResult as y}from"../../data/QueryEngineResult.js";import p from"../../../support/FieldsIndex.js";import{collectSQLFieldNames as _}from"../../../support/fieldUtils.js";import{createParquetFile as g,readGeoMetadata as w}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as x}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as I}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as R}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as F}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as C}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const q=new x,j=8e3;class b{constructor(){this._files=[],this._queue=new n({concurrency:1,process:(e,t)=>this._executeQuery(e,t)})}async load(r){this.setCustomParameters(r.customParameters),this._files=await Promise.all(r.urls.map(e=>g(e,{geometryInfo:r.geometryInfo,outSpatialReference:null,getCustomParameters:()=>this._customParameters}))),this._metadata=F.createFeature(r.metadata),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:r.geometryInfo?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:a.fromJSON(r.geometryInfo?.spatialReference),aggregateAdapter:null,timeInfo:null,definitionExpression:null};const s=this._files[0];if(!s)return{extent:null};const{fields:o,timeZoneByFieldName:n}=r.metadata.fieldsIndex,f=o.map(e=>({...e,column:s.columnForFieldName(e.name)})),c=p.fromJSON({fields:f,timeZoneByFieldName:n});if(this._fieldsIndex=c,r.metadata.spatialReference&&(this._fullExtent=A(this._files,r.metadata.spatialReference)),null==this._fullExtent&&"location"===r.geometryInfo?.encoding.type){const{latitudeFieldName:s,longitudeFieldName:o}=r.geometryInfo.encoding,n=this._fieldsIndex.get(s)?.column,a=this._fieldsIndex.get(o)?.column,f=i(u(),d);for(const r of this._files)for(const s of r.rowGroups()){const r={stack:[],error:void 0,hasError:!1};try{const t=e(r,s.columnDescriptorForAttribute(n),!1),o=e(r,s.columnDescriptorForAttribute(a),!1),i=[o.minValue(),t.minValue(),o.maxValue(),t.maxValue()];l(f,i),s.free()}catch(m){r.error=m,r.hasError=!0}finally{t(r)}}this._fullExtent={xmin:f[0],ymin:f[1],xmax:f[3],ymax:f[4],spatialReference:r.metadata.spatialReference}}return{extent:this._fullExtent}}destroy(){for(const e of this._files)e.free();this._queue.destroy()}setCustomParameters(e){this._customParameters=e}async queryFeatures(e,t){if(this._validateQuery(e),e.objectIds?.length){return(await this._enqueueQuery(e,t)).createQueryResponse()}e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0;return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){if(this._validateQuery(e),!Q(e))return this._getFeatureCount();e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.resultOffset=e.resultOffset??0,delete e.outFields,delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponseForCount()}async queryObjectIds(e,t){if(this._validateQuery(e),!Q(e))return Array.from({length:this._getFeatureCount()},(e,t)=>t);e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0,delete e.returnGeometry,delete e.outFields;return(await this._enqueueQuery(e,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){if(this._validateQuery(e),this._fullExtent&&!Q(e))return{count:this._getFeatureCount(),extent:this._fullExtent};const s=r(this._metadata.spatialReference);e.resultOffset=e.resultOffset??0,e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.returnGeometry=!0,delete e.outFields;const o=i(u(),d),n=u(),a=await this._enqueueQuery(e,t);let l=0;for(const r of a.items)r.getBounds(n)&&(f(o,n),l+=1);return{count:l,extent:m(o,s,e.outSR?r(e.outSR):s,s,!1)}}_getFeatureCount(){return this._files.reduce((e,t)=>e+t.numRows(),0)}_validateQuery(e){if(e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e})}async*_fetchChunks(e,t){const r=this._files[0].numRows(),s=Math.ceil(r/j);for(let o=0;o<s;o++){const r=o*j,s=await this._files[0].readChunk(r,j,e.fields,e.returnGeometry,t);for(const e of s){const t=new C(this._metadata,this._fieldsIndex,e,0),r=new I(t,null,0,!1),s=O(this._metadata,[r],this._queryEngineParams);yield s}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const r=await this._getReadParams(e);if(e.objectIds?.length){const s=[],o=(await this._files[0].readChunksByRowId(new Uint32Array(e.objectIds),r.fields,r.returnGeometry,t)).map((e,t)=>new C(this._metadata,this._fieldsIndex,e,t)).map((e,t)=>new I(e,null,t,!1)),n=O(this._metadata,o,this._queryEngineParams),a=await n.executeQueryForOpaqueFeatures(e,t);for(const e of a)s.push(e);return new y(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}let s=e.resultRecordCount,n=e.resultOffset;o(s),o(n),delete e.resultRecordCount,delete e.resultOffset;const a=[];for await(const o of this._fetchChunks(r,t)){const r=await o.executeQueryForOpaqueFeatures(e,t);if(r.length>n){const t=r.slice(n,Math.min(n+s,r.length));for(const e of t)a.push(e);if(n=0,s-=t.length,0===s)return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}else n-=r.length}return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}async _getReadParams(e){const t=new Set;if(e.where&&await _(t,this._fieldsIndex,e.where),e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:this._getAttributeIds(Array.from(t)),returnGeometry:!!e.returnGeometry||!!e.geometry}}_getAttributeIds(e){if(null==e)return new Uint32Array;if(e.includes("*"))return new Uint32Array(this._fieldsIndex.fields.map(e=>e.column).filter(e=>null!=e));const t=[];for(const r of e){const e=this._fieldsIndex.get(r);if(null==e)throw new s("unknown-field",`Field ${r} does not exist`);null==e.column||t.push(e.column)}return new Uint32Array(t)}}function Q(e){return Object.keys(e).some(e=>S(e))}function S(e){switch(e){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"where":case"objectIds":case"historicMoment":return!0;default:return!1}}function O(e,t,r){const s=new R(e);for(const o of t)s.insert(o);return new h({...r,featureStore:s})}function E(e){switch(e.length){case 4:return c(u(),e);case 6:return e;default:throw new s("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function A(e,t){const r=i(u(),d);for(const s of e){const e=w(s);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const o=E(t.bbox);f(r,o)}return{xmin:r[0],ymin:r[1],xmax:r[3],ymax:r[4],spatialReference:t}}export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{JSONMap as n}from"../../core/jsonMap.js";const t=new n({Physical:"physical",Virtual:"virtual"}),o=new n({"Start and end":"start-and-end",Start:"start",Midspan:"midspan",End:"end"}),i=new n({connected:"connected",upstream:"upstream",downstream:"downstream",shortestPath:"shortest-path",subnetwork:"subnetwork",subnetworkController:"subnetwork-controller",loops:"loops",isolation:"isolation",path:"path",circuit:"circuit"}),e=new n({junctionJunctionConnectivity:"junction-junction-connectivity",connectivity:"connectivity",attachment:"attachment",containment:"containment",junctionEdgeFromConnectivity:"junction-edge-from-connectivity",junctionEdgeMidspanConnectivity:"junction-edge-midspan-connectivity",junctionEdgeToConnectivity:"junction-edge-to-connectivity"}),c={connectivity:1,"junction-junction-connectivity":1,containment:2,attachment:3,"junction-edge-from-connectivity":4,"junction-edge-midspan-connectivity":5,"junction-edge-to-connectivity":6},a=new n({normal:"normal",rebuild:"rebuild",forceRebuild:"force-rebuild"});export{c as AssociationTypeEnum,o as CircuitSectionRoleKebabDict,t as CircuitTypeKebabDict,e as associationTypeKebabDict,i as traceTypeKebabDict,a as validationTypeKebabDict};
5
+ import{JSONMap as n}from"../../core/jsonMap.js";const t=new n({Clean:"clean",Dirty:"dirty"}),i=new n({Physical:"physical",Virtual:"virtual"}),e=new n({"Start and end":"start-and-end",Start:"start",Midspan:"midspan",End:"end"}),o=new n({connected:"connected",upstream:"upstream",downstream:"downstream",shortestPath:"shortest-path",subnetwork:"subnetwork",subnetworkController:"subnetwork-controller",loops:"loops",isolation:"isolation",path:"path",circuit:"circuit"}),c=new n({junctionJunctionConnectivity:"junction-junction-connectivity",connectivity:"connectivity",attachment:"attachment",containment:"containment",junctionEdgeFromConnectivity:"junction-edge-from-connectivity",junctionEdgeMidspanConnectivity:"junction-edge-midspan-connectivity",junctionEdgeToConnectivity:"junction-edge-to-connectivity"}),a={connectivity:1,"junction-junction-connectivity":1,containment:2,attachment:3,"junction-edge-from-connectivity":4,"junction-edge-midspan-connectivity":5,"junction-edge-to-connectivity":6},r=new n({normal:"normal",rebuild:"rebuild",forceRebuild:"force-rebuild"});export{a as AssociationTypeEnum,e as CircuitSectionRoleKebabDict,t as CircuitStatusKebabDict,i as CircuitTypeKebabDict,c as associationTypeKebabDict,o as traceTypeKebabDict,r as validationTypeKebabDict};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.34.0-next.53",
3
+ "version": "4.34.0-next.55",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../kernel.js";import t from"../request.js";import r from"../core/Error.js";import a from"../core/Logger.js";import{isAbortError as n}from"../core/promiseUtils.js";import o from"../geometry/Geometry.js";import d from"../geometry/SpatialReference.js";import{submitJob as i}from"./geoprocessor/submitJob.js";import s from"./knowledgeGraph/GraphQueryResult.js";import p from"./knowledgeGraph/GraphQueryResultHeader.js";import c from"./knowledgeGraph/GraphQueryStreamingResult.js";import l from"./knowledgeGraph/KnowledgeGraph.js";import u from"./knowledgeGraph/ServiceDefinition.js";import{encodeClientDataAtKeysRequest as h}from"./knowledgeGraph/wasmInterface/clientDataToWasmEncodedFactories.js";import{getWasmInterface as w}from"./knowledgeGraph/wasmInterface/knowledgeWasmAccess.js";import{bindParamArrayToWasm as g,setInputQuantizationParametersOnEncoder as y,setOutputQuantizationParametersOnEncoder as f,setProvenanceBehaviorOnEncoder as m,geometryToWasm as _,bindParamObjectToWasm as k}from"./knowledgeGraph/wasmInterface/queryToWasmEncodedFactories.js";import{updateSearchPropertiesToWasm as G,fieldIndexToWasm as b,updateGraphPropertyToWasm as x,graphPropertyToWasm as T,updateEntityTypeToWasm as v,updateRelationshipTypeToWasm as A,entityTypeToWasm as S,relationshipTypeToWasm as P,inputQuantizationParametersToWasmFormat as D,namedObjectToWasm as R}from"./knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js";import{wasmClientDataAllKeysResponseToClientDataKeys as E,wasmClientDataFetchResponseToClientData as I}from"./knowledgeGraph/wasmInterface/wasmToClientDataFactories.js";import{decoderToAddNamedTypesResult as q,decoderToDeleteNamedTypeResult as C,decoderToUpdateNamedTypesResult as F,decoderToAddGraphPropertiesResult as M,decoderToDeleteGraphPropertiesResult as j,decoderToUpdateGraphPropertiesResult as U,decoderToGraphAddIndexResult as N,decoderToGraphDeleteIndexResult as K,decoderToGraphUpdateSearchIndexResult as Q}from"./knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js";import{wasmToDataModel as $}from"./knowledgeGraph/wasmInterface/wasmToDataModelFactories.js";import{wasmToGraphQueryResponseHeader as L,decodedWasmObjToQueryResponseObj as O}from"./knowledgeGraph/wasmInterface/wasmToQueryResponseObjFactories.js";import{decoderToApplyEditsResponse as W}from"./knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js";import{checkWasmError as H}from"./knowledgeGraph/wasmInterface/wasmUtils.js";const z=new Map,B=()=>new Map(z.entries()),J={fetchKnowledgeGraph:async e=>{const t=new l({url:e}),r=[];return r.push(he(t)),r.push(we(t)),await Promise.all(r),t},refreshDataModel:async e=>{e.dataModel=await Ye(e)},refreshServiceDefinition:async e=>{const r=(await t(e.url,{query:{f:"json"}})).data;return r.capabilities=r?.capabilities?.split(","),r.supportedQueryFormats=r?.supportedQueryFormats?.split(","),e.serviceDefinition=new u(r),e.serviceDefinition},executeFindPathsAsynchronous:async(e,t)=>{const a=e.inKnowledgeGraphUrl.split("/rest/services");if(a.length<2)throw new r("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /rest/services/");const n=a[0],o=(await Ge(`${n}/rest/info`,{query:{f:"json"}})).data.currentVersion,d=`/rest/services/${o&&o<12?"System":"Utilities"}/KnowledgeGraphServerToolsAsync/GPServer/ServerFilteredFindPaths`;return await ke(`${n}${d}`,{in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:e.config.toJSON(),result_type:"STRING"},{},t)},executeFindPaths:async(e,t)=>{const a=e.inKnowledgeGraphUrl.split("/rest/services");if(a.length<2)throw new r("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /rest/services/");const n=a[0],o=(await Ge(`${n}/rest/info`,{query:{f:"json"}})).data.currentVersion,d=`/rest/services/${o&&o<12?"System":"Utilities"}/KnowledgeGraphServerTools/GPServer/ServerFilteredFindPaths/execute`,i=await Ge(`${n}${d}`,{method:"post",query:{f:"pjson",in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:JSON.stringify(e.config),result_type:"STRING"},...t});if(i.data.results.length<1)throw new r("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results returned",i);let s;for(const r of i.data.results)if("out_results_string"===r.paramName){s=r.value;break}if(!s)throw new r("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results were returned on the expected paramater out_results_string",i);return s},fetchAsynchronousFindPathsResultData:async(e,t)=>(await e.fetchResultData("out_results_string",null,t)).value,executeQueryStreaming:async(e,t,a)=>{const n="include",o=`${e.url}/graph/query`;await be(e);const d=await Fe(o,a);if(!e.serviceDefinition?.supportsProvenance&&t.provenanceBehavior===n)throw new r("knowledge-graph:provenance-not-supported","The Knowledge Graph Service definition indicated that provenance is not supported");d.data.body=await qe(t,e);const i=await _e(d.data.url,d.data);if(e.dataModel){const t=await Ve(i,e.dataModel);return new c({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},executeApplyEdits:async(e,t,a)=>{if(e.serviceDefinition?.dataEditingNotSupported)throw new r("knowledge-graph:data-editing-not-supported","The Knowledge Graph Service definition indicated that data editing is not supported");const n=`${e.url}/graph/applyEdits`;await be(e);const o=await Fe(n,a);o.data.body=await Te(t,e);return je(await _e(o.data.url,o.data))},executeAddNamedTypes:async(e,t,a)=>{if(!t.newEntityTypes?.length&&!t.newRelationshipTypes?.length)throw new r("knowledge-graph:no-arguments","The operation to add types to the data model contained no values");const n=`${e.url}/dataModel/edit/namedTypes/add`;await be(e);const o=await Fe(n,a);o.data.body=await ve(t);const d=await _e(o.data.url,o.data),i=await Ue(d);return i.updatedKnowledgeGraph=await ue(e.url),i},executeDeleteNamedType:async(e,t,a)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to delete a named type from the data model contained no value");const n=`${e.url}/dataModel/edit/namedTypes/${t}/delete`;await be(e);const o=await Fe(n,a);o.data.body="";const d=await _e(o.data.url,o.data),i=await Ne(d);return i.updatedKnowledgeGraph=await ue(e.url),i},executeUpdateNamedType:async(e,t,a,n)=>{if(!t&&!Object.keys(a).length)throw new r("knowledge-graph:no-arguments","The operation to update types in the data model contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/update`;await be(e);const d=await Fe(o,n);d.data.body=await Ae(a,t,e.dataModel);const i=await _e(d.data.url,d.data),s=await Ke(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeAddGraphProperties:async(e,t,a,n)=>{if(!t&&!a.length)throw new r("knowledge-graph:no-arguments","The operation to add properties to the data model contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/fields/add`;await be(e);const d=await Fe(o,n);d.data.body=await Se(a);const i=await _e(d.data.url,d.data),s=await Qe(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeDeleteGraphProperty:async(e,t,a,n)=>{if(!t&&!a)throw new r("knowledge-graph:no-arguments","The operation to delete property contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/fields/delete`;await be(e);const d=await Fe(o,n);d.data.body=await Pe(a);const i=await _e(d.data.url,d.data),s=await $e(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeUpdateGraphProperty:async(e,t,a,n,o)=>{if(!t&&!a&&!Object.keys(n).length)throw new r("knowledge-graph:no-arguments","The operation to update properties in the data model contained missing or empty values");const d=`${e.url}/dataModel/edit/namedTypes/${t}/fields/update`;await be(e);const i=await Fe(d,o);i.data.body=await De(a,n);const s=await _e(i.data.url,i.data),p=await Le(s);return p.updatedKnowledgeGraph=await ue(e.url),p},executeAddGraphFieldIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!a?.length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty field index values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/indexes/add`;await be(e);const d=await Fe(o,n);d.data.body=await Re(a);const i=await _e(d.data.url,d.data),s=await Oe(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeDeleteGraphFieldIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!a?.length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty field index values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/indexes/delete`;await be(e);const d=await Fe(o,n);d.data.body=await Ee(a);const i=await _e(d.data.url,d.data),s=await We(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeUpdateSearchIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!Object.keys(a.addSearchProperties??{}).length&&!Object.keys(a.removeSearchProperties??{}).length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty properties values");const o=`${e.url}/dataModel/searchIndex/update`;await be(e);const d=await Fe(o,n);d.data.body=await Ie(t,a);const i=await _e(d.data.url,d.data),s=await He(i);return s.updatedKnowledgeGraph=await ue(e.url),s},executeQuery:async(e,a,n)=>{const o=`${e.url}/graph/query`,d=await t(o,{responseType:"array-buffer",query:{f:"pbf",openCypherQuery:a.openCypherQuery,...n?.query},signal:n?.signal,timeout:n?.timeout}),i=d.getHeader?.("content-type"),p=d.data;if(i?.includes("application/x-protobuf")){const t=new((await w()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=Je({wasmQueryDecoder:t,newArrayBufferToParse:p,dataModel:e.dataModel});return new s({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:i,data:d.data})},executeSearch:async(e,a,n)=>{const o=a.typeCategoryFilter,d=`${e.url}/graph/search`,i=await t(d,{responseType:"array-buffer",query:{f:"pbf",searchQuery:`"${a.searchQuery}"`,typeCategoryFilter:o,...n?.query},signal:n?.signal,timeout:n?.timeout}),p=i.getHeader?.("content-type"),c=i.data;if(p?.includes("application/x-protobuf")){const t=new((await w()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=Je({wasmQueryDecoder:t,newArrayBufferToParse:c,dataModel:e.dataModel});return new s({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:p,data:i.data})},executeSearchStreaming:async(e,t,a)=>{const n=`${e.url}/graph/search`;await be(e);const o=await Fe(n,a);o.data.body=await Ce(t);const d=await _e(o.data.url,o.data);if(e.dataModel){const t=await Ve(d,e.dataModel);return new c({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},fetchClientDataAtKeys:async(e,t,a={ignoreCache:!1})=>{if(!t.length)return new Map;let n=z.get(e.url||"");n||(n=new Map,z.set(e.url||"",n));const o=new Map(n.entries()),d=`${e.url}/clientData/fetch`;t=Array.from(new Set(t));const i=await w(),s=h(t,n,i,a.ignoreCache),p=await Fe(d,a.requestOptions);p.data.body=s;const c=await _e(p.data.url,p.data),l=c.headers.get("content-type");if(l?.includes("application/x-protobuf")){const e=new i.ClientDataFetchResponseDecoder;e.deleteLater();const t=await c.arrayBuffer();return e.decode(new Uint8Array(t)),e.has_error()&&H(e.error,"knowledge-graph:fetchClientDataAtKeys-decoding-error","An error occurred while decoding the client data keys response"),I(e,n,o,a.ignoreCache)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response when fetching client data",{responseType:l,data:c})},fetchAllClientDataKeys:async(e,a)=>{const n=`${e.url}/clientData`,o=await t(n,{responseType:"array-buffer",query:{f:"pbf"},signal:a?.signal,timeout:a?.timeout}),d=o.getHeader?.("content-type"),i=o.data;if(d?.includes("application/x-protobuf")){const e=new((await w()).ClientDataKeysResponseDecoder);return e.deleteLater(),e.decode(new Uint8Array(i)),e.has_error()&&H(e.error,"knowledge-graph:fetchAllClientDataKeys-decoding-error","An error occurred while decoding the client data keys response"),E(e)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:d,data:o.data})},clearClientDataCache:()=>z.clear(),_fetchWrapper:async(e,t)=>fetch(e,t),_submitJobWrapper:async(e,t,r,a)=>i(e,t,r,a),_esriRequestWrapper:async(e,r)=>t(e,r)};async function V(e,t,r){return J.executeApplyEdits(e,t,r)}async function Y(e,t,r){return J.executeAddNamedTypes(e,t,r)}async function X(e,t,r){return J.executeDeleteNamedType(e,t,r)}async function Z(e,t,r,a){return J.executeUpdateNamedType(e,t,r,a)}async function ee(e,t,r,a){return J.executeAddGraphProperties(e,t,r,a)}async function te(e,t,r,a){return J.executeDeleteGraphProperty(e,t,r,a)}async function re(e,t,r,a,n){return J.executeUpdateGraphProperty(e,t,r,a,n)}async function ae(e,t,r,a){return J.executeAddGraphFieldIndex(e,t,r,a)}async function ne(e,t,r,a){return J.executeDeleteGraphFieldIndex(e,t,r,a)}async function oe(e,t,r,a){return J.executeUpdateSearchIndex(e,t,r,a)}async function de(e,t,r){return J.executeQuery(e,t,r)}async function ie(e,t,r){return J.executeQueryStreaming(e,t,r)}async function se(e,t,r){return J.executeSearch(e,t,r)}async function pe(e,t,r){return J.executeSearchStreaming(e,t,r)}function ce(e,t){return J.fetchAllClientDataKeys(e,t)}function le(e,t,r){return J.fetchClientDataAtKeys(e,t,r)}async function ue(e){return J.fetchKnowledgeGraph(e)}async function he(e){return J.refreshDataModel(e)}async function we(e){return J.refreshServiceDefinition(e)}async function ge(e,t){return J.executeFindPathsAsynchronous(e,t)}async function ye(e,t){return J.executeFindPaths(e,t)}async function fe(e,t){return J.fetchAsynchronousFindPathsResultData(e,t)}function me(){return J.clearClientDataCache()}async function _e(e,t){return J._fetchWrapper(e,t)}async function ke(e,t,r,a){return J._submitJobWrapper(e,t,r,a)}async function Ge(e,t){return J._esriRequestWrapper(e,t)}async function be(t){const r=e?.findCredential(t.url);r||(t.dataModel?await Ye(t):await he(t))}function xe(e,t,r,a){null==t?r.set_param_key_value(e,""):"object"!=typeof t||t instanceof Date?r.set_param_key_value(e,t):t instanceof o?r.set_param_key_value(e,_(t,a)):Array.isArray(t)?r.set_param_key_value(e,g(t,a)):r.set_param_key_value(e,k(t,a))}async function Te(e,t){if(t.dataModel||await he(t),!t.dataModel)throw new r("knowledge-graph:data-model-undefined","Encoding could not proceed because a data model was not provided and it could not be determined from the service");const a=await w(),n=!!e.options?.cascadeDelete,o=new a.GraphApplyEditsEncoder(a.SpatialReferenceUtil.WGS84(),e.options?.inputQuantizationParameters?D(e.options?.inputQuantizationParameters):a.InputQuantizationUtil.WGS84_lossless());o.deleteLater(),o.cascade_delete=n;try{let t;e.entityAdds?.forEach(e=>{t=o.add_entity(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),e.relationshipAdds?.forEach(e=>{if(!e.originId||!e.destinationId)throw new r("knowledge-graph:relationship-origin-destination-missing","When adding a new relationship, you must provide both an origin and destination id on the appropriate class property");t=o.add_relationship(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),e.entityUpdates?.forEach(e=>{if(!e.id)throw new r("knowledge-graph:entity-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=o.update_entity(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),e.relationshipUpdates?.forEach(e=>{if(!e.id)throw new r("knowledge-graph:relationship-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=o.update_relationship(R(e,a)),H(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),e.entityDeletes?.forEach(e=>{if(!e.typeName)throw new r("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=o.make_delete_helper(e.typeName,!0);t.deleteLater(),e.ids?.forEach(e=>{t.delete_by_id(e)})}),e.relationshipDeletes?.forEach(e=>{if(!e.typeName)throw new r("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=o.make_delete_helper(e.typeName,!1);e.ids?.forEach(e=>{t.delete_by_id(e)})}),o.encode()}catch(i){throw new r("knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed",{error:i})}const d=o.get_encoding_result();return H(d.error,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed"),structuredClone(d.get_byte_buffer())}async function ve(e){const t=await w(),a=new t.GraphNamedObjectTypeAddsRequestEncoder;a.deleteLater(),e.newEntityTypes?.forEach(e=>{a.add_entity_type(S(e,t))}),e.newRelationshipTypes?.forEach(e=>{a.add_relationship_type(P(e,t))});try{a.encode()}catch(o){throw new r("knowledge-graph:addNamedTypes-encoding-failed","Attempting to encode the addNamedTypes failed",{error:o})}const n=a.get_encoding_result();return H(n.error,"knowledge-graph:addNamedTypes-encoding-failed","Attempting to encode the addNamedTypes failed"),structuredClone(n.get_byte_buffer())}async function Ae(e,t,a){const n=await w(),o=new n.GraphNamedObjectTypeUpdateRequestEncoder;o.deleteLater();if(a.entityTypes.some(e=>e.name===t))o.update_entity_type(v(e,n));else{if(!a.relationshipTypes.some(e=>e.name===t))throw new r("knowledge-graph:updateNamedType-encoding-failed","The named type you are trying to update does not exist in the data model");o.update_relationship_type(A(e,n))}o.update_alias=e.hasOwnProperty("alias");try{o.encode()}catch(i){throw new r("knowledge-graph:updateNamedType-encoding-failed","Attempting to encode the updateNamedType failed",{error:i})}const d=o.get_encoding_result();return H(d.error,"knowledge-graph:updateNamedType-encoding-failed","Attempting to encode the updateNamedType failed"),structuredClone(d.get_byte_buffer())}async function Se(e){const t=await w(),a=new t.GraphPropertyAddsRequestEncoder;a.deleteLater(),e.forEach(e=>{a.add_graph_property(T(e,t))});try{a.encode()}catch(o){throw new r("knowledge-graph:addGraphProperties-encoding-failed","Attempting to encode the addGraphProperties failed",{error:o})}const n=a.get_encoding_result();return H(n.error,"knowledge-graph:addGraphProperties-encoding-failed","Attempting to encode the addGraphProperties failed"),structuredClone(n.get_byte_buffer())}async function Pe(e){const t=new((await w()).GraphPropertyDeleteRequestEncoder);t.deleteLater(),t.field_name=e;try{t.encode()}catch(n){throw new r("knowledge-graph:deleteGraphProperty-encoding-failed","Attempting to encode the deleteGraphProperty failed",{error:n})}const a=t.get_encoding_result();return H(a.error,"knowledge-graph:deleteGraphProperty-encoding-failed","Attempting to encode the deleteGraphProperty failed"),structuredClone(a.get_byte_buffer())}async function De(e,t){const a=await w(),n=new a.GraphPropertyUpdateRequestEncoder;n.deleteLater(),n.update_graph_property(x(t,a)),n.set_property_name(e),n.update_alias=t.hasOwnProperty("alias"),n.update_editable=t.hasOwnProperty("editable"),n.update_required=t.hasOwnProperty("required"),n.update_visible=t.hasOwnProperty("defaultVisibility"),n.update_default_value=t.hasOwnProperty("defaultValue");try{n.encode()}catch(d){throw new r("knowledge-graph:updateGraphProperty-encoding-failed","Attempting to encode the updateGraphProperty failed",{error:d})}const o=n.get_encoding_result();return H(o.error,"knowledge-graph:updateGraphProperty-encoding-failed","Attempting to encode the updateGraphProperty failed"),structuredClone(o.get_byte_buffer())}async function Re(e){const t=await w(),a=new t.GraphIndexAddsRequestEncoder;a.deleteLater(),e.forEach(e=>{a.add_field_index(b(e,t))});try{a.encode()}catch(o){throw new r("knowledge-graph:addGraphFieldIndex-encoding-failed","Attempting to encode the addGraphFieldIndex failed",{error:o})}const n=a.get_encoding_result();return H(n.error,"knowledge-graph:addGraphFieldIndex-encoding-failed","Attempting to encode the addGraphFieldIndex failed"),structuredClone(n.get_byte_buffer())}async function Ee(e){const t=new((await w()).GraphIndexDeleteRequestEncoder);t.deleteLater(),e.forEach(e=>{t.add_index_name(e)});try{t.encode()}catch(n){throw new r("knowledge-graph:deleteGraphFieldIndex-encoding-failed","Attempting to encode the deleteGraphFieldIndex failed",{error:n})}const a=t.get_encoding_result();return H(a.error,"knowledge-graph:deleteGraphFieldIndex-encoding-failed","Attempting to encode the deleteGraphFieldIndex failed"),structuredClone(a.get_byte_buffer())}async function Ie(e,t){const a=await w(),n=new a.GraphUpdateSearchIndexRequestEncoder;n.deleteLater(),t.hasOwnProperty("addSearchProperties")&&n.insert_add_search_property(e,G(t.addSearchProperties,a)),t.hasOwnProperty("removeSearchProperties")&&n.insert_delete_search_property(e,G(t.removeSearchProperties,a));try{n.encode()}catch(d){throw new r("knowledge-graph:updateSearchIndex-encoding-failed","Attempting to encode the updateSearchIndex failed",{error:d})}const o=n.get_encoding_result();return H(o.error,"knowledge-graph:updateSearchIndex-encoding-failed","Attempting to encode the updateSearchIndex failed"),structuredClone(o.get_byte_buffer())}async function qe(e,t){const a=await w(),n=new a.GraphQueryRequestEncoder;if(n.deleteLater(),e.outputSpatialReference?n.output_spatial_reference={wkid:e.outputSpatialReference.wkid,latestWkid:e.outputSpatialReference.latestWkid,vcsWkid:e.outputSpatialReference.vcsWkid,latestVcsWkid:e.outputSpatialReference.latestVcsWkid,wkt:e.outputSpatialReference.wkt??""}:n.output_spatial_reference=a.SpatialReferenceUtil.WGS84(),n.open_cypher_query=e.openCypherQuery,e.bindParameters)for(const[r,i]of Object.entries(e.bindParameters))xe(r,i,n,a);if(e.bindGeometryQuantizationParameters)y(e.bindGeometryQuantizationParameters,n);else{if(t.dataModel||await he(t),4326!==t.dataModel?.spatialReference?.wkid)throw new r("knowledge-graph:SR-quantization-mismatch","If the DataModel indicates a coordinate system other than WGS84, inputQuantizationParameters must be provided to the query encoder");n.input_quantization_parameters=a.InputQuantizationUtil.WGS84_lossless()}e.outputQuantizationParameters&&f(e.outputQuantizationParameters,n,a),e.provenanceBehavior&&m(e.provenanceBehavior,n);try{n.encode()}catch(d){throw new r("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{error:d})}const o=n.get_encoding_result();if(0!==o.error.error_code)throw new r("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{errorCode:o.error.error_code,errorMessage:o.error.error_message});return structuredClone(o.get_byte_buffer())}async function Ce(e){const t=await w(),a=new t.GraphSearchRequestEncoder;if(a.deleteLater(),a.search_query=e.searchQuery,a.type_category_filter=t.esriNamedTypeCategory[e.typeCategoryFilter],!0===e.returnSearchContext&&(a.return_search_context=e.returnSearchContext),null!=e.start&&e.start>0&&(a.start_index=e.start),null!=e.num&&(a.max_num_results=e.num),null!=e.idsFilter&&Array.isArray(e.idsFilter)&&e.idsFilter.length>0)try{a.set_ids_filter(g(e.idsFilter,t))}catch(o){throw new r("knowledge-graph:ids-format-error","Attempting to set ids filter failed. This is usually caused by an incorrectly formatted UUID string",{error:o})}e.namedTypesFilter?.forEach(e=>{a.add_named_type_filter(e)});try{a.encode()}catch(o){throw new r("knowledge-graph:search-encoding-failed","Attempting to encode the search failed",{error:o})}const n=a.get_encoding_result();if(0!==n.error.error_code)throw new r("knowledge-graph:search-encoding-failed","Attempting to get encoding result from the query failed",{errorCode:n.error.error_code,errorMessage:n.error.error_message});return structuredClone(n.get_byte_buffer())}async function Fe(e,r){return t(e,{responseType:"native-request-init",method:"post",query:{f:"pbf",...r?.query},body:"x",headers:{"Content-Type":"application/octet-stream"},signal:r?.signal,timeout:r?.timeout})}async function Me(e,t,a){const n=e.headers.get("content-type");if(n?.includes("application/x-protobuf")){const r=await e.arrayBuffer(),n=new t;try{return n.decode(new Uint8Array(r)),a(n)}finally{n.deleteLater()}}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:n,data:await e.text()})}async function je(e){return Me(e,(await w()).GraphApplyEditsDecoder,W)}async function Ue(e){return Me(e,(await w()).GraphNamedObjectTypeAddsResponseDecoder,q)}async function Ne(e){return Me(e,(await w()).GraphNamedObjectTypeDeleteResponseDecoder,C)}async function Ke(e){return Me(e,(await w()).GraphNamedObjectTypeUpdateResponseDecoder,F)}async function Qe(e){return Me(e,(await w()).GraphPropertyAddsResponseDecoder,M)}async function $e(e){return Me(e,(await w()).GraphPropertyDeleteResponseDecoder,j)}async function Le(e){return Me(e,(await w()).GraphPropertyUpdateResponseDecoder,U)}async function Oe(e){return Me(e,(await w()).GraphIndexAddsResponseDecoder,N)}async function We(e){return Me(e,(await w()).GraphIndexDeleteResponseDecoder,K)}async function He(e){return Me(e,(await w()).GraphUpdateSearchIndexResponseDecoder,Q)}let ze=50;function Be(e){ze=e}function Je({wasmQueryDecoder:e,newArrayBufferToParse:t,dataModel:a,decodedHeader:n,limitMaxProcessingTime:o=!1}){t&&e.push_buffer(new Uint8Array(t));const i=[];let s,p,c=0;const l=Date.now();let u=!0;for(;e.next_row();){s&&p||(s=n??L(e),p=s.outSpatialReference??new d({wkid:4326})),c||(c=e.get_header_keys().size());const t=new Array(c);for(let r=0;r<c;r++){const n=e.get_value(r);t[r]=O(n,a,p)}if(i.push(t),o&&Date.now()-l>ze){u=!1;break}}if(e.has_error())throw new r("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - inner row decoding",{errorCode:e.error.error_code,errorMessage:e.error.error_message});return{resultHeader:s,resultRows:i,parsedAllResultsFromBuffer:u}}async function Ve(e,t){const o=e.headers.get("content-type");if(e.headers.get("content-length")&&a.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").warnOnce("Found `Content-Length` header when expecting a streaming HTTP response! Please investigate whether all intermediate HTTP proxies and/or load balancers are configured such that they don't forcefully buffer the entire response before returning it to the client. A valid HTTP streaming response should use Chunked Transfer Encoding and not have a Content Length defined."),o?.includes("application/x-protobuf")){const o=e.body?.getReader(),d=new((await w()).GraphQueryDecoder);let i,s,c;d.deleteLater();const l=new Promise((e,t)=>{s=e,c=t});let u=!1,h=null;const g=new ReadableStream({pull:async function e(l){if(!o){const e=new r("knowledge-graph:stream-decoding-error","Error reading from stream - reader is undefined");throw c(e),e}const{done:w,value:g}=h?{done:!1,value:null}:await o.read().catch(e=>{throw c(e),o.releaseLock(),e});g&&(h=g);try{if(w){let e;if(d.has_error()?e=new r("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - query stream done",{errorCode:d.error.error_code,errorMessage:d.error.error_message}):u||s(new p),o.releaseLock(),e)throw l.error(e),c(e),e;return void l.close()}const{resultHeader:a,resultRows:n,parsedAllResultsFromBuffer:y}=Je({wasmQueryDecoder:d,newArrayBufferToParse:g,dataModel:t,decodedHeader:i,limitMaxProcessingTime:!0});return y&&(h=null),!i&&a&&(i=a,s(a),u=!0),n.length>0?void l.enqueue(n):await e(l)}catch(y){throw a.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").error(y),c(y),o.releaseLock(),n(y)?y:new r("knowledge-graph:unexpected-server-response","Error inside streaming data return parsing",{error:y})}}});return{readableStream:g,resultHeader:await l}}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:e.text()})}async function Ye(e){const a=`${e.url}/dataModel/queryDataModel`,n=await t(a,{responseType:"array-buffer",query:{f:"pbf"}}),o=n.getHeader?.("content-type"),d=n.data;if(o?.includes("application/x-protobuf")){const e=(await w()).decode_data_model_from_protocol_buffer(new Uint8Array(d));if(!e)throw new r("knowledge-graph:data-model-decode-failure","The server responded to the data model query, but the response failed to be decoded. This typically occurs when the Knowledge JS API (4.26 or later) is used with an unsupported backend (11.0 or earlier)");return $(e)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:n.data})}export{be as _checkAuthentication,Ge as _esriRequestWrapper,_e as _fetchWrapper,B as _getClientDataCacheCopy,Be as _setMaxQueryParsingDurationForTesting,ke as _submitJobWrapper,me as clearClientDataCache,z as clientDataCache,ae as executeAddGraphFieldIndex,ee as executeAddGraphProperties,Y as executeAddNamedTypes,V as executeApplyEdits,ne as executeDeleteGraphFieldIndex,te as executeDeleteGraphProperty,X as executeDeleteNamedType,ye as executeFindPaths,ge as executeFindPathsAsynchronous,de as executeQuery,ie as executeQueryStreaming,se as executeSearch,pe as executeSearchStreaming,re as executeUpdateGraphProperty,Z as executeUpdateNamedType,oe as executeUpdateSearchIndex,ce as fetchAllClientDataKeys,fe as fetchAsynchronousFindPathsResultData,le as fetchClientDataAtKeys,ue as fetchKnowledgeGraph,J as kgRestServices,he as refreshDataModel,we as refreshServiceDefinition};
5
+ import{id as e}from"../kernel.js";import t from"../request.js";import r from"../core/Error.js";import a from"../core/Logger.js";import{isAbortError as n}from"../core/promiseUtils.js";import{asArrayBuffer as o}from"../core/typedArrayUtil.js";import d from"../geometry/Geometry.js";import i from"../geometry/SpatialReference.js";import{submitJob as s}from"./geoprocessor/submitJob.js";import p from"./knowledgeGraph/GraphQueryResult.js";import c from"./knowledgeGraph/GraphQueryResultHeader.js";import l from"./knowledgeGraph/GraphQueryStreamingResult.js";import u from"./knowledgeGraph/KnowledgeGraph.js";import h from"./knowledgeGraph/ServiceDefinition.js";import{encodeClientDataAtKeysRequest as w}from"./knowledgeGraph/wasmInterface/clientDataToWasmEncodedFactories.js";import{getWasmInterface as g}from"./knowledgeGraph/wasmInterface/knowledgeWasmAccess.js";import{bindParamArrayToWasm as y,setInputQuantizationParametersOnEncoder as f,setOutputQuantizationParametersOnEncoder as m,setProvenanceBehaviorOnEncoder as _,geometryToWasm as k,bindParamObjectToWasm as G}from"./knowledgeGraph/wasmInterface/queryToWasmEncodedFactories.js";import{updateSearchPropertiesToWasm as b,fieldIndexToWasm as x,updateGraphPropertyToWasm as T,graphPropertyToWasm as v,updateEntityTypeToWasm as A,updateRelationshipTypeToWasm as S,entityTypeToWasm as P,relationshipTypeToWasm as D,inputQuantizationParametersToWasmFormat as R,namedObjectToWasm as E}from"./knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js";import{wasmClientDataAllKeysResponseToClientDataKeys as I,wasmClientDataFetchResponseToClientData as q}from"./knowledgeGraph/wasmInterface/wasmToClientDataFactories.js";import{decoderToAddNamedTypesResult as C,decoderToDeleteNamedTypeResult as F,decoderToUpdateNamedTypesResult as M,decoderToAddGraphPropertiesResult as j,decoderToDeleteGraphPropertiesResult as U,decoderToUpdateGraphPropertiesResult as N,decoderToGraphAddIndexResult as K,decoderToGraphDeleteIndexResult as Q,decoderToGraphUpdateSearchIndexResult as $}from"./knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js";import{wasmToDataModel as L}from"./knowledgeGraph/wasmInterface/wasmToDataModelFactories.js";import{wasmToGraphQueryResponseHeader as O,decodedWasmObjToQueryResponseObj as W}from"./knowledgeGraph/wasmInterface/wasmToQueryResponseObjFactories.js";import{decoderToApplyEditsResponse as H}from"./knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js";import{checkWasmError as z}from"./knowledgeGraph/wasmInterface/wasmUtils.js";const B=new Map,J=()=>new Map(B.entries()),V={fetchKnowledgeGraph:async e=>{const t=new u({url:e}),r=[];return r.push(we(t)),r.push(ge(t)),await Promise.all(r),t},refreshDataModel:async e=>{e.dataModel=await Xe(e)},refreshServiceDefinition:async e=>{const r=(await t(e.url,{query:{f:"json"}})).data;return r.capabilities=r?.capabilities?.split(","),r.supportedQueryFormats=r?.supportedQueryFormats?.split(","),e.serviceDefinition=new h(r),e.serviceDefinition},executeFindPathsAsynchronous:async(e,t)=>{const a=e.inKnowledgeGraphUrl.split("/rest/services");if(a.length<2)throw new r("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /rest/services/");const n=a[0],o=(await be(`${n}/rest/info`,{query:{f:"json"}})).data.currentVersion,d=`/rest/services/${o&&o<12?"System":"Utilities"}/KnowledgeGraphServerToolsAsync/GPServer/ServerFilteredFindPaths`;return await Ge(`${n}${d}`,{in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:e.config.toJSON(),result_type:"STRING"},{},t)},executeFindPaths:async(e,t)=>{const a=e.inKnowledgeGraphUrl.split("/rest/services");if(a.length<2)throw new r("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /rest/services/");const n=a[0],o=(await be(`${n}/rest/info`,{query:{f:"json"}})).data.currentVersion,d=`/rest/services/${o&&o<12?"System":"Utilities"}/KnowledgeGraphServerTools/GPServer/ServerFilteredFindPaths/execute`,i=await be(`${n}${d}`,{method:"post",query:{f:"pjson",in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:JSON.stringify(e.config),result_type:"STRING"},...t});if(i.data.results.length<1)throw new r("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results returned",i);let s;for(const r of i.data.results)if("out_results_string"===r.paramName){s=r.value;break}if(!s)throw new r("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results were returned on the expected paramater out_results_string",i);return s},fetchAsynchronousFindPathsResultData:async(e,t)=>(await e.fetchResultData("out_results_string",null,t)).value,executeQueryStreaming:async(e,t,a)=>{const n="include",o=`${e.url}/graph/query`;await xe(e);const d=await Me(o,a);if(!e.serviceDefinition?.supportsProvenance&&t.provenanceBehavior===n)throw new r("knowledge-graph:provenance-not-supported","The Knowledge Graph Service definition indicated that provenance is not supported");d.data.body=await Ce(t,e);const i=await ke(d.data.url,d.data);if(e.dataModel){const t=await Ye(i,e.dataModel);return new l({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},executeApplyEdits:async(e,t,a)=>{if(e.serviceDefinition?.dataEditingNotSupported)throw new r("knowledge-graph:data-editing-not-supported","The Knowledge Graph Service definition indicated that data editing is not supported");const n=`${e.url}/graph/applyEdits`;await xe(e);const o=await Me(n,a);o.data.body=await ve(t,e);return Ue(await ke(o.data.url,o.data))},executeAddNamedTypes:async(e,t,a)=>{if(!t.newEntityTypes?.length&&!t.newRelationshipTypes?.length)throw new r("knowledge-graph:no-arguments","The operation to add types to the data model contained no values");const n=`${e.url}/dataModel/edit/namedTypes/add`;await xe(e);const o=await Me(n,a);o.data.body=await Ae(t);const d=await ke(o.data.url,o.data),i=await Ne(d);return i.updatedKnowledgeGraph=await he(e.url),i},executeDeleteNamedType:async(e,t,a)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to delete a named type from the data model contained no value");const n=`${e.url}/dataModel/edit/namedTypes/${t}/delete`;await xe(e);const o=await Me(n,a);o.data.body="";const d=await ke(o.data.url,o.data),i=await Ke(d);return i.updatedKnowledgeGraph=await he(e.url),i},executeUpdateNamedType:async(e,t,a,n)=>{if(!t&&!Object.keys(a).length)throw new r("knowledge-graph:no-arguments","The operation to update types in the data model contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/update`;await xe(e);const d=await Me(o,n);d.data.body=await Se(a,t,e.dataModel);const i=await ke(d.data.url,d.data),s=await Qe(i);return s.updatedKnowledgeGraph=await he(e.url),s},executeAddGraphProperties:async(e,t,a,n)=>{if(!t&&!a.length)throw new r("knowledge-graph:no-arguments","The operation to add properties to the data model contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/fields/add`;await xe(e);const d=await Me(o,n);d.data.body=await Pe(a);const i=await ke(d.data.url,d.data),s=await $e(i);return s.updatedKnowledgeGraph=await he(e.url),s},executeDeleteGraphProperty:async(e,t,a,n)=>{if(!t&&!a)throw new r("knowledge-graph:no-arguments","The operation to delete property contained missing or empty values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/fields/delete`;await xe(e);const d=await Me(o,n);d.data.body=await De(a);const i=await ke(d.data.url,d.data),s=await Le(i);return s.updatedKnowledgeGraph=await he(e.url),s},executeUpdateGraphProperty:async(e,t,a,n,o)=>{if(!t&&!a&&!Object.keys(n).length)throw new r("knowledge-graph:no-arguments","The operation to update properties in the data model contained missing or empty values");const d=`${e.url}/dataModel/edit/namedTypes/${t}/fields/update`;await xe(e);const i=await Me(d,o);i.data.body=await Re(a,n);const s=await ke(i.data.url,i.data),p=await Oe(s);return p.updatedKnowledgeGraph=await he(e.url),p},executeAddGraphFieldIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!a?.length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty field index values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/indexes/add`;await xe(e);const d=await Me(o,n);d.data.body=await Ee(a);const i=await ke(d.data.url,d.data),s=await We(i);return s.updatedKnowledgeGraph=await he(e.url),s},executeDeleteGraphFieldIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!a?.length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty field index values");const o=`${e.url}/dataModel/edit/namedTypes/${t}/indexes/delete`;await xe(e);const d=await Me(o,n);d.data.body=await Ie(a);const i=await ke(d.data.url,d.data),s=await He(i);return s.updatedKnowledgeGraph=await he(e.url),s},executeUpdateSearchIndex:async(e,t,a,n)=>{if(!t)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing named type");if(!Object.keys(a.addSearchProperties??{}).length&&!Object.keys(a.removeSearchProperties??{}).length)throw new r("knowledge-graph:no-arguments","The operation to update search index in the data model contained missing or empty properties values");const o=`${e.url}/dataModel/searchIndex/update`;await xe(e);const d=await Me(o,n);d.data.body=await qe(t,a);const i=await ke(d.data.url,d.data),s=await ze(i);return s.updatedKnowledgeGraph=await he(e.url),s},executeQuery:async(e,a,n)=>{const o=`${e.url}/graph/query`,d=await t(o,{responseType:"array-buffer",query:{f:"pbf",openCypherQuery:a.openCypherQuery,...n?.query},signal:n?.signal,timeout:n?.timeout}),i=d.getHeader?.("content-type"),s=d.data;if(i?.includes("application/x-protobuf")){const t=new((await g()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=Ve({wasmQueryDecoder:t,newArrayBufferToParse:s,dataModel:e.dataModel});return new p({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:i,data:d.data})},executeSearch:async(e,a,n)=>{const o=a.typeCategoryFilter,d=`${e.url}/graph/search`,i=await t(d,{responseType:"array-buffer",query:{f:"pbf",searchQuery:`"${a.searchQuery}"`,typeCategoryFilter:o,...n?.query},signal:n?.signal,timeout:n?.timeout}),s=i.getHeader?.("content-type"),c=i.data;if(s?.includes("application/x-protobuf")){const t=new((await g()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=Ve({wasmQueryDecoder:t,newArrayBufferToParse:c,dataModel:e.dataModel});return new p({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:s,data:i.data})},executeSearchStreaming:async(e,t,a)=>{const n=`${e.url}/graph/search`;await xe(e);const o=await Me(n,a);o.data.body=await Fe(t);const d=await ke(o.data.url,o.data);if(e.dataModel){const t=await Ye(d,e.dataModel);return new l({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new r("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},fetchClientDataAtKeys:async(e,t,a={ignoreCache:!1})=>{if(!t.length)return new Map;let n=B.get(e.url||"");n||(n=new Map,B.set(e.url||"",n));const o=new Map(n.entries()),d=`${e.url}/clientData/fetch`;t=Array.from(new Set(t));const i=await g(),s=w(t,n,i,a.ignoreCache),p=await Me(d,a.requestOptions);p.data.body=s;const c=await ke(p.data.url,p.data),l=c.headers.get("content-type");if(l?.includes("application/x-protobuf")){const e=new i.ClientDataFetchResponseDecoder;e.deleteLater();const t=await c.arrayBuffer();return e.decode(new Uint8Array(t)),e.has_error()&&z(e.error,"knowledge-graph:fetchClientDataAtKeys-decoding-error","An error occurred while decoding the client data keys response"),q(e,n,o,a.ignoreCache)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response when fetching client data",{responseType:l,data:c})},fetchAllClientDataKeys:async(e,a)=>{const n=`${e.url}/clientData`,o=await t(n,{responseType:"array-buffer",query:{f:"pbf"},signal:a?.signal,timeout:a?.timeout}),d=o.getHeader?.("content-type"),i=o.data;if(d?.includes("application/x-protobuf")){const e=new((await g()).ClientDataKeysResponseDecoder);return e.deleteLater(),e.decode(new Uint8Array(i)),e.has_error()&&z(e.error,"knowledge-graph:fetchAllClientDataKeys-decoding-error","An error occurred while decoding the client data keys response"),I(e)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:d,data:o.data})},clearClientDataCache:()=>B.clear(),_fetchWrapper:async(e,t)=>fetch(e,t),_submitJobWrapper:async(e,t,r,a)=>s(e,t,r,a),_esriRequestWrapper:async(e,r)=>t(e,r)};async function Y(e,t,r){return V.executeApplyEdits(e,t,r)}async function X(e,t,r){return V.executeAddNamedTypes(e,t,r)}async function Z(e,t,r){return V.executeDeleteNamedType(e,t,r)}async function ee(e,t,r,a){return V.executeUpdateNamedType(e,t,r,a)}async function te(e,t,r,a){return V.executeAddGraphProperties(e,t,r,a)}async function re(e,t,r,a){return V.executeDeleteGraphProperty(e,t,r,a)}async function ae(e,t,r,a,n){return V.executeUpdateGraphProperty(e,t,r,a,n)}async function ne(e,t,r,a){return V.executeAddGraphFieldIndex(e,t,r,a)}async function oe(e,t,r,a){return V.executeDeleteGraphFieldIndex(e,t,r,a)}async function de(e,t,r,a){return V.executeUpdateSearchIndex(e,t,r,a)}async function ie(e,t,r){return V.executeQuery(e,t,r)}async function se(e,t,r){return V.executeQueryStreaming(e,t,r)}async function pe(e,t,r){return V.executeSearch(e,t,r)}async function ce(e,t,r){return V.executeSearchStreaming(e,t,r)}function le(e,t){return V.fetchAllClientDataKeys(e,t)}function ue(e,t,r){return V.fetchClientDataAtKeys(e,t,r)}async function he(e){return V.fetchKnowledgeGraph(e)}async function we(e){return V.refreshDataModel(e)}async function ge(e){return V.refreshServiceDefinition(e)}async function ye(e,t){return V.executeFindPathsAsynchronous(e,t)}async function fe(e,t){return V.executeFindPaths(e,t)}async function me(e,t){return V.fetchAsynchronousFindPathsResultData(e,t)}function _e(){return V.clearClientDataCache()}async function ke(e,t){return V._fetchWrapper(e,t)}async function Ge(e,t,r,a){return V._submitJobWrapper(e,t,r,a)}async function be(e,t){return V._esriRequestWrapper(e,t)}async function xe(t){const r=e?.findCredential(t.url);r||(t.dataModel?await Xe(t):await we(t))}function Te(e,t,r,a){null==t?r.set_param_key_value(e,""):"object"!=typeof t||t instanceof Date?r.set_param_key_value(e,t):t instanceof d?r.set_param_key_value(e,k(t,a)):Array.isArray(t)?r.set_param_key_value(e,y(t,a)):r.set_param_key_value(e,G(t,a))}async function ve(e,t){if(t.dataModel||await we(t),!t.dataModel)throw new r("knowledge-graph:data-model-undefined","Encoding could not proceed because a data model was not provided and it could not be determined from the service");const a=await g(),n=!!e.options?.cascadeDelete,d=new a.GraphApplyEditsEncoder(a.SpatialReferenceUtil.WGS84(),e.options?.inputQuantizationParameters?R(e.options?.inputQuantizationParameters):a.InputQuantizationUtil.WGS84_lossless());d.deleteLater(),d.cascade_delete=n;try{let t;e.entityAdds?.forEach(e=>{t=d.add_entity(E(e,a)),z(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),e.relationshipAdds?.forEach(e=>{if(!e.originId||!e.destinationId)throw new r("knowledge-graph:relationship-origin-destination-missing","When adding a new relationship, you must provide both an origin and destination id on the appropriate class property");t=d.add_relationship(E(e,a)),z(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),e.entityUpdates?.forEach(e=>{if(!e.id)throw new r("knowledge-graph:entity-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=d.update_entity(E(e,a)),z(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),e.relationshipUpdates?.forEach(e=>{if(!e.id)throw new r("knowledge-graph:relationship-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=d.update_relationship(E(e,a)),z(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),e.entityDeletes?.forEach(e=>{if(!e.typeName)throw new r("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=d.make_delete_helper(e.typeName,!0);t.deleteLater(),e.ids?.forEach(e=>{t.delete_by_id(e)})}),e.relationshipDeletes?.forEach(e=>{if(!e.typeName)throw new r("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=d.make_delete_helper(e.typeName,!1);e.ids?.forEach(e=>{t.delete_by_id(e)})}),d.encode()}catch(s){throw new r("knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed",{error:s})}const i=d.get_encoding_result();return z(i.error,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed"),o(structuredClone(i.get_byte_buffer()))}async function Ae(e){const t=await g(),a=new t.GraphNamedObjectTypeAddsRequestEncoder;a.deleteLater(),e.newEntityTypes?.forEach(e=>{a.add_entity_type(P(e,t))}),e.newRelationshipTypes?.forEach(e=>{a.add_relationship_type(D(e,t))});try{a.encode()}catch(d){throw new r("knowledge-graph:addNamedTypes-encoding-failed","Attempting to encode the addNamedTypes failed",{error:d})}const n=a.get_encoding_result();return z(n.error,"knowledge-graph:addNamedTypes-encoding-failed","Attempting to encode the addNamedTypes failed"),o(structuredClone(n.get_byte_buffer()))}async function Se(e,t,a){const n=await g(),d=new n.GraphNamedObjectTypeUpdateRequestEncoder;d.deleteLater();if(a.entityTypes.some(e=>e.name===t))d.update_entity_type(A(e,n));else{if(!a.relationshipTypes.some(e=>e.name===t))throw new r("knowledge-graph:updateNamedType-encoding-failed","The named type you are trying to update does not exist in the data model");d.update_relationship_type(S(e,n))}d.update_alias=e.hasOwnProperty("alias");try{d.encode()}catch(s){throw new r("knowledge-graph:updateNamedType-encoding-failed","Attempting to encode the updateNamedType failed",{error:s})}const i=d.get_encoding_result();return z(i.error,"knowledge-graph:updateNamedType-encoding-failed","Attempting to encode the updateNamedType failed"),o(structuredClone(i.get_byte_buffer()))}async function Pe(e){const t=await g(),a=new t.GraphPropertyAddsRequestEncoder;a.deleteLater(),e.forEach(e=>{a.add_graph_property(v(e,t))});try{a.encode()}catch(d){throw new r("knowledge-graph:addGraphProperties-encoding-failed","Attempting to encode the addGraphProperties failed",{error:d})}const n=a.get_encoding_result();return z(n.error,"knowledge-graph:addGraphProperties-encoding-failed","Attempting to encode the addGraphProperties failed"),o(structuredClone(n.get_byte_buffer()))}async function De(e){const t=new((await g()).GraphPropertyDeleteRequestEncoder);t.deleteLater(),t.field_name=e;try{t.encode()}catch(n){throw new r("knowledge-graph:deleteGraphProperty-encoding-failed","Attempting to encode the deleteGraphProperty failed",{error:n})}const a=t.get_encoding_result();return z(a.error,"knowledge-graph:deleteGraphProperty-encoding-failed","Attempting to encode the deleteGraphProperty failed"),o(structuredClone(a.get_byte_buffer()))}async function Re(e,t){const a=await g(),n=new a.GraphPropertyUpdateRequestEncoder;n.deleteLater(),n.update_graph_property(T(t,a)),n.set_property_name(e),n.update_alias=t.hasOwnProperty("alias"),n.update_editable=t.hasOwnProperty("editable"),n.update_required=t.hasOwnProperty("required"),n.update_visible=t.hasOwnProperty("defaultVisibility"),n.update_default_value=t.hasOwnProperty("defaultValue");try{n.encode()}catch(i){throw new r("knowledge-graph:updateGraphProperty-encoding-failed","Attempting to encode the updateGraphProperty failed",{error:i})}const d=n.get_encoding_result();return z(d.error,"knowledge-graph:updateGraphProperty-encoding-failed","Attempting to encode the updateGraphProperty failed"),o(structuredClone(d.get_byte_buffer()))}async function Ee(e){const t=await g(),a=new t.GraphIndexAddsRequestEncoder;a.deleteLater(),e.forEach(e=>{a.add_field_index(x(e,t))});try{a.encode()}catch(d){throw new r("knowledge-graph:addGraphFieldIndex-encoding-failed","Attempting to encode the addGraphFieldIndex failed",{error:d})}const n=a.get_encoding_result();return z(n.error,"knowledge-graph:addGraphFieldIndex-encoding-failed","Attempting to encode the addGraphFieldIndex failed"),o(structuredClone(n.get_byte_buffer()))}async function Ie(e){const t=new((await g()).GraphIndexDeleteRequestEncoder);t.deleteLater(),e.forEach(e=>{t.add_index_name(e)});try{t.encode()}catch(n){throw new r("knowledge-graph:deleteGraphFieldIndex-encoding-failed","Attempting to encode the deleteGraphFieldIndex failed",{error:n})}const a=t.get_encoding_result();return z(a.error,"knowledge-graph:deleteGraphFieldIndex-encoding-failed","Attempting to encode the deleteGraphFieldIndex failed"),o(structuredClone(a.get_byte_buffer()))}async function qe(e,t){const a=await g(),n=new a.GraphUpdateSearchIndexRequestEncoder;n.deleteLater(),t.hasOwnProperty("addSearchProperties")&&n.insert_add_search_property(e,b(t.addSearchProperties,a)),t.hasOwnProperty("removeSearchProperties")&&n.insert_delete_search_property(e,b(t.removeSearchProperties,a));try{n.encode()}catch(i){throw new r("knowledge-graph:updateSearchIndex-encoding-failed","Attempting to encode the updateSearchIndex failed",{error:i})}const d=n.get_encoding_result();return z(d.error,"knowledge-graph:updateSearchIndex-encoding-failed","Attempting to encode the updateSearchIndex failed"),o(structuredClone(d.get_byte_buffer()))}async function Ce(e,t){const a=await g(),n=new a.GraphQueryRequestEncoder;if(n.deleteLater(),e.outputSpatialReference?n.output_spatial_reference={wkid:e.outputSpatialReference.wkid,latestWkid:e.outputSpatialReference.latestWkid,vcsWkid:e.outputSpatialReference.vcsWkid,latestVcsWkid:e.outputSpatialReference.latestVcsWkid,wkt:e.outputSpatialReference.wkt??""}:n.output_spatial_reference=a.SpatialReferenceUtil.WGS84(),n.open_cypher_query=e.openCypherQuery,e.bindParameters)for(const[r,o]of Object.entries(e.bindParameters))Te(r,o,n,a);if(e.bindGeometryQuantizationParameters)f(e.bindGeometryQuantizationParameters,n);else{if(t.dataModel||await we(t),4326!==t.dataModel?.spatialReference?.wkid)throw new r("knowledge-graph:SR-quantization-mismatch","If the DataModel indicates a coordinate system other than WGS84, inputQuantizationParameters must be provided to the query encoder");n.input_quantization_parameters=a.InputQuantizationUtil.WGS84_lossless()}e.outputQuantizationParameters&&m(e.outputQuantizationParameters,n,a),e.provenanceBehavior&&_(e.provenanceBehavior,n);try{n.encode()}catch(i){throw new r("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{error:i})}const d=n.get_encoding_result();if(0!==d.error.error_code)throw new r("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{errorCode:d.error.error_code,errorMessage:d.error.error_message});return o(structuredClone(d.get_byte_buffer()))}async function Fe(e){const t=await g(),a=new t.GraphSearchRequestEncoder;if(a.deleteLater(),a.search_query=e.searchQuery,a.type_category_filter=t.esriNamedTypeCategory[e.typeCategoryFilter],!0===e.returnSearchContext&&(a.return_search_context=e.returnSearchContext),null!=e.start&&e.start>0&&(a.start_index=e.start),null!=e.num&&(a.max_num_results=e.num),null!=e.idsFilter&&Array.isArray(e.idsFilter)&&e.idsFilter.length>0)try{a.set_ids_filter(y(e.idsFilter,t))}catch(d){throw new r("knowledge-graph:ids-format-error","Attempting to set ids filter failed. This is usually caused by an incorrectly formatted UUID string",{error:d})}e.namedTypesFilter?.forEach(e=>{a.add_named_type_filter(e)});try{a.encode()}catch(d){throw new r("knowledge-graph:search-encoding-failed","Attempting to encode the search failed",{error:d})}const n=a.get_encoding_result();if(0!==n.error.error_code)throw new r("knowledge-graph:search-encoding-failed","Attempting to get encoding result from the query failed",{errorCode:n.error.error_code,errorMessage:n.error.error_message});return o(structuredClone(n.get_byte_buffer()))}async function Me(e,r){return t(e,{responseType:"native-request-init",method:"post",query:{f:"pbf",...r?.query},body:"x",headers:{"Content-Type":"application/octet-stream"},signal:r?.signal,timeout:r?.timeout})}async function je(e,t,a){const n=e.headers.get("content-type");if(n?.includes("application/x-protobuf")){const r=await e.arrayBuffer(),n=new t;try{return n.decode(new Uint8Array(r)),a(n)}finally{n.deleteLater()}}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:n,data:await e.text()})}async function Ue(e){return je(e,(await g()).GraphApplyEditsDecoder,H)}async function Ne(e){return je(e,(await g()).GraphNamedObjectTypeAddsResponseDecoder,C)}async function Ke(e){return je(e,(await g()).GraphNamedObjectTypeDeleteResponseDecoder,F)}async function Qe(e){return je(e,(await g()).GraphNamedObjectTypeUpdateResponseDecoder,M)}async function $e(e){return je(e,(await g()).GraphPropertyAddsResponseDecoder,j)}async function Le(e){return je(e,(await g()).GraphPropertyDeleteResponseDecoder,U)}async function Oe(e){return je(e,(await g()).GraphPropertyUpdateResponseDecoder,N)}async function We(e){return je(e,(await g()).GraphIndexAddsResponseDecoder,K)}async function He(e){return je(e,(await g()).GraphIndexDeleteResponseDecoder,Q)}async function ze(e){return je(e,(await g()).GraphUpdateSearchIndexResponseDecoder,$)}let Be=50;function Je(e){Be=e}function Ve({wasmQueryDecoder:e,newArrayBufferToParse:t,dataModel:a,decodedHeader:n,limitMaxProcessingTime:o=!1}){t&&e.push_buffer(new Uint8Array(t));const d=[];let s,p,c=0;const l=Date.now();let u=!0;for(;e.next_row();){s&&p||(s=n??O(e),p=s.outSpatialReference??new i({wkid:4326})),c||(c=e.get_header_keys().size());const t=new Array(c);for(let r=0;r<c;r++){const n=e.get_value(r);t[r]=W(n,a,p)}if(d.push(t),o&&Date.now()-l>Be){u=!1;break}}if(e.has_error())throw new r("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - inner row decoding",{errorCode:e.error.error_code,errorMessage:e.error.error_message});return{resultHeader:s,resultRows:d,parsedAllResultsFromBuffer:u}}async function Ye(e,t){const o=e.headers.get("content-type");if(e.headers.get("content-length")&&a.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").warnOnce("Found `Content-Length` header when expecting a streaming HTTP response! Please investigate whether all intermediate HTTP proxies and/or load balancers are configured such that they don't forcefully buffer the entire response before returning it to the client. A valid HTTP streaming response should use Chunked Transfer Encoding and not have a Content Length defined."),o?.includes("application/x-protobuf")){const o=e.body?.getReader(),d=new((await g()).GraphQueryDecoder);let i,s,p;d.deleteLater();const l=new Promise((e,t)=>{s=e,p=t});let u=!1,h=null;const w=new ReadableStream({pull:async function e(l){if(!o){const e=new r("knowledge-graph:stream-decoding-error","Error reading from stream - reader is undefined");throw p(e),e}const{done:w,value:g}=h?{done:!1,value:null}:await o.read().catch(e=>{throw p(e),o.releaseLock(),e});g&&(h=g);try{if(w){let e;if(d.has_error()?e=new r("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - query stream done",{errorCode:d.error.error_code,errorMessage:d.error.error_message}):u||s(new c),o.releaseLock(),e)throw l.error(e),p(e),e;return void l.close()}const{resultHeader:a,resultRows:n,parsedAllResultsFromBuffer:y}=Ve({wasmQueryDecoder:d,newArrayBufferToParse:g,dataModel:t,decodedHeader:i,limitMaxProcessingTime:!0});return y&&(h=null),!i&&a&&(i=a,s(a),u=!0),n.length>0?void l.enqueue(n):await e(l)}catch(y){throw a.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").error(y),p(y),o.releaseLock(),n(y)?y:new r("knowledge-graph:unexpected-server-response","Error inside streaming data return parsing",{error:y})}}});return{readableStream:w,resultHeader:await l}}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:e.text()})}async function Xe(e){const a=`${e.url}/dataModel/queryDataModel`,n=await t(a,{responseType:"array-buffer",query:{f:"pbf"}}),o=n.getHeader?.("content-type"),d=n.data;if(o?.includes("application/x-protobuf")){const e=(await g()).decode_data_model_from_protocol_buffer(new Uint8Array(d));if(!e)throw new r("knowledge-graph:data-model-decode-failure","The server responded to the data model query, but the response failed to be decoded. This typically occurs when the Knowledge JS API (4.26 or later) is used with an unsupported backend (11.0 or earlier)");return L(e)}throw new r("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:n.data})}export{xe as _checkAuthentication,be as _esriRequestWrapper,ke as _fetchWrapper,J as _getClientDataCacheCopy,Je as _setMaxQueryParsingDurationForTesting,Ge as _submitJobWrapper,_e as clearClientDataCache,B as clientDataCache,ne as executeAddGraphFieldIndex,te as executeAddGraphProperties,X as executeAddNamedTypes,Y as executeApplyEdits,oe as executeDeleteGraphFieldIndex,re as executeDeleteGraphProperty,Z as executeDeleteNamedType,fe as executeFindPaths,ye as executeFindPathsAsynchronous,ie as executeQuery,se as executeQueryStreaming,pe as executeSearch,ce as executeSearchStreaming,ae as executeUpdateGraphProperty,ee as executeUpdateNamedType,de as executeUpdateSearchIndex,le as fetchAllClientDataKeys,me as fetchAsynchronousFindPathsResultData,ue as fetchClientDataAtKeys,he as fetchKnowledgeGraph,V as kgRestServices,we as refreshDataModel,ge as refreshServiceDefinition};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as t}from"tslib";import{isSome as o}from"../../../core/arrayUtils.js";import{JSONSupport as e}from"../../../core/JSONSupport.js";import s from"../../../core/Logger.js";import{watch as i,initial as r}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{reader as c}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../../core/accessorSupport/decorators/writer.js";import{CircuitTypeKebabDict as l,CircuitStatusKebabDict as u}from"../../../networks/support/typeUtils.js";import d from"./CircuitLocation.js";import h from"./CircuitSection.js";import y from"./Subcircuit.js";let m=class extends e{constructor(t){super(t),this._sectionIdLookup=new Map,this.circuitType="physical",this.globalId=null,this.isDeleted=!1,this.lastExportedTime=null,this.lastVerifiedTime=null,this.name=null,this.sections=null,this.startLocation=null,this.status="dirty",this.stopLocation=null,this.subcircuits=[]}initialize(){this.addHandles([i(()=>this.sections,t=>{this._sectionIdLookup.clear(),null!=t&&Array.from(t.keys()).forEach(t=>this._sectionIdLookup.set(t.sectionId,t))},r)])}normalizeCtorArgs(t){if(void 0===t)return t;const{name:o,startLocation:e,stopLocation:i,sections:r}=t;return(e||i)&&r?(delete t.startLocation,delete t.stopLocation,s.getLogger(this).warn("Cannot instantiate Circuit with both start/stop locations and sections.",`Circuit '${o}' was defaulted to having sections only.`)):(e&&!i||!e&&i)&&!r&&s.getLogger(this).warn(`Non-sectioned circuit '${o}' must have both start and stop locations.`,"Create/alter operations involving this circuit will fail unless both are populated."),t}get isSectioned(){return null==this.startLocation&&null==this.stopLocation&&null!=this.sections}readSections(t,e){const{sectionOrder:s,sections:i}=e,r=new Map;if(null==s||null==i)return r;i.forEach(t=>{this._sectionIdLookup.set(t.sectionId,h.fromJSON(t))});for(const[n,c]of Object.entries(s)){const t=Number(n),e=this._sectionIdLookup.get(t);if(null==e)continue;const s=c.map(t=>this._sectionIdLookup.get(t)).filter(o);r.set(e,s)}return r}writeSections(t,o){const e={},s=[];t?.forEach((t,o)=>{const i=o.sectionId.toString(),r=t.map(t=>t.sectionId);e[i]=r,s.push(o.toJSON())}),o.sectionOrder=e,o.sections=s}getSectionById(t){return this._sectionIdLookup.get(t)??null}setStartStopLocations(t,o){this.startLocation=t,this.stopLocation=o,this.sections=null}setSections(t){this.sections=t,this.startLocation=null,this.stopLocation=null}};t([n({type:l.apiValues,json:{type:l.jsonValues,read:l.read,write:l.write}})],m.prototype,"circuitType",void 0),t([n({type:String,json:{write:!0}})],m.prototype,"globalId",void 0),t([n({type:Boolean,readOnly:!0})],m.prototype,"isDeleted",void 0),t([n({type:Boolean,json:{write:!0},readOnly:!0})],m.prototype,"isSectioned",null),t([n({type:Date,json:{read:{reader:t=>"number"==typeof t?new Date(t):null}},readOnly:!0})],m.prototype,"lastExportedTime",void 0),t([n({type:Date,json:{read:{reader:t=>"number"==typeof t?new Date(t):null}},readOnly:!0})],m.prototype,"lastVerifiedTime",void 0),t([n({type:String,json:{write:!0}})],m.prototype,"name",void 0),t([n({json:{read:{source:["sectionOrder","sections"]},write:!0}})],m.prototype,"sections",void 0),t([c("sections")],m.prototype,"readSections",null),t([p("sections")],m.prototype,"writeSections",null),t([n({type:d,json:{write:!0}})],m.prototype,"startLocation",void 0),t([n({type:u.apiValues,json:{type:u.jsonValues,read:u.read}})],m.prototype,"status",void 0),t([n({type:d,json:{write:!0}})],m.prototype,"stopLocation",void 0),t([n({type:[y],json:{write:!0}})],m.prototype,"subcircuits",void 0),m=t([a("esri.rest.networks.support.Circuit")],m);const f=m;export{f as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{CircuitSectionRoleKebabDict as s,CircuitTypeKebabDict as i}from"../../../networks/support/typeUtils.js";import p from"./CircuitLocation.js";import c from"./CircuitPath.js";import a from"./Subcircuit.js";let n=class extends o{constructor(t){super(t),this.sectionId=null,this.role="start-and-end",this.sectionType="physical",this.startLocation=null,this.stopLocation=null,this.subcircuit=null,this.path=null}};t([r({type:Number,json:{write:!0}})],n.prototype,"sectionId",void 0),t([r({type:s.apiValues,json:{type:s.jsonValues,read:s.read},readOnly:!0})],n.prototype,"role",void 0),t([r({type:i.apiValues,json:{type:i.jsonValues,read:i.read,write:i.write}})],n.prototype,"sectionType",void 0),t([r({type:p,json:{write:!0}})],n.prototype,"startLocation",void 0),t([r({type:p,json:{write:!0}})],n.prototype,"stopLocation",void 0),t([r({type:a,json:{write:!0}})],n.prototype,"subcircuit",void 0),t([r({type:c,readOnly:!0})],n.prototype,"path",void 0),n=t([e("esri.rest.networks.support.CircuitSection")],n);const u=n;export{u as default};
5
+ import{__decorate as t}from"tslib";import{JSONSupport as o}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{CircuitSectionRoleKebabDict as e,CircuitTypeKebabDict as a}from"../../../networks/support/typeUtils.js";import n from"./CircuitLocation.js";import c from"./CircuitPath.js";import p from"./Subcircuit.js";let u=class extends o{constructor(t){super(t),this.sectionId=null,this.role="start-and-end",this.sectionType="physical",this.startLocation=null,this.stopLocation=null,this.subcircuit=null,this.path=null}normalizeCtorArgs(t){if(void 0===t)return t;const{sectionId:o,startLocation:r,stopLocation:s,subcircuit:e}=t;return(r||s)&&e?(delete t.startLocation,delete t.stopLocation,i.getLogger(this).warn("Cannot instantiate CircuitSection with both start/stop locations and subcircuit.",`CircuitSection with ID '${o}' was defaulted to having a subcircuit only.`)):(r&&!s||!r&&s)&&!e&&i.getLogger(this).warn(`CircuitSection with ID '${o}' must have both start and stop locations.`,"Create/alter operations involving this section will fail unless both are populated."),t}setStartStopLocations(t,o){this.startLocation=t,this.stopLocation=o,this.subcircuit=null}setSubcircuit(t){this.subcircuit=t,this.startLocation=null,this.stopLocation=null}};t([r({type:Number,json:{write:!0}})],u.prototype,"sectionId",void 0),t([r({type:e.apiValues,json:{type:e.jsonValues,read:e.read},readOnly:!0})],u.prototype,"role",void 0),t([r({type:a.apiValues,json:{type:a.jsonValues,read:a.read,write:a.write}})],u.prototype,"sectionType",void 0),t([r({type:n,json:{write:!0}})],u.prototype,"startLocation",void 0),t([r({type:n,json:{write:!0}})],u.prototype,"stopLocation",void 0),t([r({type:p,json:{write:!0}})],u.prototype,"subcircuit",void 0),t([r({type:c,readOnly:!0})],u.prototype,"path",void 0),u=t([s("esri.rest.networks.support.CircuitSection")],u);const l=u;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends r{constructor(o){super(o),this.name=null,this.globalId=null,this.providerId=null,this.consumerId=null,this.isReserved=!1}};o([t({type:String,json:{write:!0}})],s.prototype,"name",void 0),o([t({type:String,json:{write:!0}})],s.prototype,"globalId",void 0),o([t({type:String,readOnly:!0})],s.prototype,"providerId",void 0),o([t({type:String,readOnly:!0})],s.prototype,"consumerId",void 0),o([t({type:Boolean,json:{write:!0}})],s.prototype,"isReserved",void 0),s=o([e("esri.rest.networks.support.Subcircuit")],s);const p=s;export{p as default};
5
+ import{__decorate as o}from"tslib";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends r{constructor(o){super(o),this.name=null,this.globalId=null,this.providerId=null,this.consumerId=null,this.isReserved=!1}};o([t({type:String,json:{write:!0}})],s.prototype,"name",void 0),o([t({type:String,json:{write:!0}})],s.prototype,"globalId",void 0),o([t({type:String})],s.prototype,"providerId",void 0),o([t({type:String})],s.prototype,"consumerId",void 0),o([t({type:Boolean,json:{write:!0}})],s.prototype,"isReserved",void 0),s=o([e("esri.rest.networks.support.Subcircuit")],s);const p=s;export{p as default};
package/rest/print.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as a}from"../core/jsonMap.js";import{createScreenPoint as i,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{dataComponents as o,normalize as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,findToken as f}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{formatJsonMap as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isBlendLayer as x,getCopyright as I,getSelectionSymbol as v,createPointLayer as D,createPolygonLayer as T,createPolylineLayer as L,createMultipointLayer as O,getContextBoundingBox as E}from"./support/printTaskUtils.js";import P from"./support/PrintTemplate.js";import{toJSON as M}from"./support/reportTemplate.js";const V={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},F=new a({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),k=new a({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),N=new Map;async function R(e,t,a){const i=await U(e,a),r=await _(t,i);if("sync"===await J(e,a)){const{results:t}=await d(e,r,void 0,a);return t?.[0]?.value}const n=await m(e,r,void 0,a);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,a);return o}async function U(e,a){const i=$(e),r=N.get(i)??{gpServerUrl:i,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(i,p({f:"json"},a))).data,r.cimVersion=r.gpMetadata.cimVersion,N.set(i,r),r}async function J(e,t){return we(await U(e,t))}async function j(e,a){const i=await U(e,a),r=i.gpMetadata.tasks,n=i.gpServerUrl;return i.taskInfos||(i.taskInfos={},await Promise.all(r?.map(async e=>{const r=(await t(`${n}/${e}`,p({f:"json"},a))).data,o=r.name.startsWith("GetLayoutTemplatesInfo")?"GetLayoutTemplatesInfo":r.name.startsWith("ExportWebMap")?"ExportWebMap":null;o&&(i.taskInfos[o]??=r)})??[])),i.taskInfos}async function A(e,t,a){return(await j(e,a))[t]??null}async function C(e,t,a){const i=await A(e,t,a);return i?.executionType?k.fromJSON(i.executionType):"sync"}async function _(t,a){a=a||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const i=t.template||new P;null==i.showLabels&&(i.showLabels=!0);const r=i.exportOptions;let n;const o=h(i.layout);if(r){if(n={dpi:r.dpi},"map_only"===o?.toLowerCase()||""===o){const{width:e,height:t}=r;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=i.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:e||t?{metricUnit:F.toJSON(e)??void 0,metricLabel:e?V[e]:void 0,nonMetricUnit:F.toJSON(t)??void 0,nonMetricLabel:t?V[t]:void 0}:void 0}}let c=null;s?.legendLayers&&(c=s.legendLayers.map(e=>{const t=e.layerId;a.legendLayerNameMap[t]=e.title;const i={id:t};return e.subLayerIds&&(i.subLayerIds=e.subLayerIds),i}));const u=await z(t,i,a);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,a=a=>{const i=a.text,r=a.font,n=r?.family?.toLowerCase();i&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(i)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(i)&&(r.family="Arial Unicode MS"))};for(const i of u.operationalLayers)if(i.featureCollection?.layers)for(const e of i.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&a(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&a(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:a.legendLayers.slice()}}),a.legendLayers.length=0,N.set(a.gpServerUrl,a);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g.toJSON(i.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:M(i.report),Report_Item_ID:void 0};if(i.layoutItem){delete y.Layout_Template;const t=i.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(i.reportItem){delete y.Report_Template;const t=i.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function z(e,t,a){const i=e.view;let r=i.spatialReference;const n={operationalLayers:await W(i,t,a)};t.includeTables&&(n.tables=await se(i));let o=e.extent||a.ssExtent||i.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},a.ssExtent=null,i.background&&(n.background=i.background.toJSON()),i.rotation&&(n.mapOptions.rotation=-i.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||i.scale),null!=i.timeExtent){const e=null!=i.timeExtent.start?i.timeExtent.start.getTime():null,t=null!=i.timeExtent.end?i.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function $(e){let t=e;const a=t.lastIndexOf("/GPServer/");return a>0&&(t=t.slice(0,a+9)),t}async function W(e,t,a){const i=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;r.layerView=s,t=w(s)?await re(e,r,a):S(e)?q(e):"csv"===e?.type?await K(e,r,a):"catalog-footprint"===e?.type?await B(e,r,a):"feature"===e?.type?await Q(e,r,a):"geojson"===e?.type?await H(e,r,a):"graphics"===e?.type?await X(e,r,a):"imagery"===e?.type?Y(e,a):"imagery-tile"===e?.type?await Z(e,r,a):"kml"===e?.type?await ee(e,r,a):"map-image"===e?.type?te(e,r,a):"map-notes"===e?.type?await ae(r,a):"open-street-map"===e?.type?ie():"stream"===e?.type?await ne(e,r,a):"subtype-group"===e?.type?await oe(e,a):"tile"===e?.type?le(e,a):"vector-tile"===e?.type?await ce(e,r,a):"web-tile"===e?.type?ue(e):"wfs"===e?.type?await ye(e,r,a):"wms"===e?.type?pe(e,a):"wmts"===e?.type?fe(e):await re(e,r,a),t&&(Array.isArray(t)?i.push(...t):(t.id=e.id,t.title=a.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,x(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),i.push(t)))}if(n)for(const s of i)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await G(null,e.graphics,t,a);r&&i.push(r)}return i}function q(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function B(e,{layerView:t,printTemplate:a},i){if(parseFloat(i.cimVersion)<3.1){return G(e,await he(t),a,i)}const r=e.parent,n={id:(o=be(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return de(n,r),n}async function K(e,t,a){e.legendEnabled&&a.legendLayers.push({id:e.id});const i=t.layerView,r=t.printTemplate;if(!(i.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=be(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return G(e,await he(i),r,a)}async function G(e,t,a,i){let r;const n=T(),o=L(),s=D(),u=O(),y=D();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=i.legendLayerNameMap[e.id]||e.arcgisProps?.title||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),a=n.layerDefinition.drawingInfo;a&&(a.renderer=t);const i=o.layerDefinition.drawingInfo;i&&(i.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(a.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=be(e,"web-map"),a=t.layerDefinition?.drawingInfo?.labelingInfo;if(a){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=a);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=a);const i=s.layerDefinition.drawingInfo;i&&(i.labelingInfo=a);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=a)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;r&&await c(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const a=f.fields.map(e=>e.toJSON());n.layerDefinition.fields=a,o.layerDefinition.fields=a,s.layerDefinition.fields=a,u.layerDefinition.fields=a}const m=t?.length;let g;for(let c=0;c<m;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,Se(g.symbol)?g.symbol=await me(g.symbol,i):g.symbol.text&&delete g.attributes),(!a||!a.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter(e=>e.featureSet.features.length>0);for(const l of h){const e=l.featureSet.features.every(e=>e.symbol);if(e&&(!a||!a.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await ge(l.layerDefinition.drawingInfo.renderer,i)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function Q(e,t,a){let i;const r=e.renderer,n=parseFloat(a.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(n<2.9||"pie-chart"===e.featureReduction.renderer?.type)||"pie-chart"===r?.type&&n<3.1||"dot-density"===r?.type&&n<2.6)return re(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await he(o);i=await G(e,t,s,a)}else{if(i={id:(p=be(e)).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},s.attributionVisible&&(i.credits=I(e)),i.showLabels=s.showLabels&&e.labelsVisible,de(i,e),delete i.layerDefinition?.featureReduction?.disablePopup,delete i.layerDefinition?.featureReduction?.popupInfo,o.displayFilterEnabled||delete i.layerDefinition?.displayFilterInfo,i.layerDefinition?.drawingInfo?.renderer&&(delete i.layerDefinition.minScale,delete i.layerDefinition.maxScale,await ge(i.layerDefinition.drawingInfo.renderer,a),"visualVariables"in r&&r.visualVariables?.[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);i.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,i.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(i.layerDefinition??={},i.layerDefinition.definitionExpression=i.layerDefinition.definitionExpression?`(${i.layerDefinition.definitionExpression}) AND (${t})`:t),e.gdbVersion&&(i.layerDefinition??={},i.layerDefinition.gdbVersion=e.gdbVersion),o.hasHighlight&&"highlightIds"in o){const t=o;i.selectionObjectIds=t.highlightIds,i.selectionSymbol=v(e.geometryType,t.highlightOptions??l.highlightOptions)}}var p;return i}async function H(e,t,a){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return re(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});return G(e,await he(t.layerView),t.printTemplate,a)}async function X(e,{printTemplate:t},a){return G(e,null,t,a)}function Y(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=be(e)).layerType,customParameters:i.customParameters};var i;return a.bandIds=e.bandIds,a.compressionQuality=e.compressionQuality,a.format=e.format,a.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(a.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(a.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(a.layerDefinition??={},a.layerDefinition.drawingInfo??={},a.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),de(a,e),a}async function Z(e,t,a){if("flow"===e.renderer?.type)return re(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const i={bandIds:(r=be(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return i.layerType="ArcGISImageServiceLayer",de(i,e),i}async function ee(e,t,a){const i=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=be(e,"web-map");return t.type="kml",delete t.layerType,t.url=s(e.url),t}const r=[],n=t.layerView,o="data:image/png;base64,";n.allVisibleMapImages.forEach((t,a)=>{const i={id:`${e.id}_image${a}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};t.href.startsWith(o)?i.imageData=t.href.slice(o.length):i.url=t.href,r.push(i)});const l=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],c={id:e.id,...await G(null,l,i,a)};return r.push(c),r}function te(e,{printTemplate:t,view:a},i){let r;const n={id:e.id,subLayerIds:[]};let o=[];const s=a.scale,l=e=>{const t=0===s,a=0===e.minScale||s<=e.minScale,i=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||a&&i))if(e.sublayers)e.sublayers.forEach(l);else{const t=e.toExportImageJSON(),a={id:e.id,name:e.title,layerDefinition:{definitionExpression:t.definitionExpression,drawingInfo:t.drawingInfo,orderBy:t.orderBy,source:t.source}};o.unshift(a),n.subLayerIds.push(e.id)}};var c;return e.sublayers?.forEach(l),o.length&&(o=o.map(({id:e,name:t,layerDefinition:a})=>({id:e,name:t,layerDefinition:a})),r={layerType:(c=be(e)).layerType,customParameters:c.customParameters},r.layers=o,r.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:n.subLayerIds,t.attributionVisible&&(r.credits=I(e)),e.gdbVersion&&(r.gdbVersion=e.gdbVersion),de(r,e),e.legendEnabled&&i.legendLayers.push(n)),r}async function ae({layerView:e,printTemplate:t},a){const i=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await G(n,n.source,t,a);e&&i.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await G(null,n.graphics,t,a);e&&i.push(...e.featureCollection.layers)}return{featureCollection:{layers:i}}}function ie(){return{type:"OpenStreetMap"}}async function re(e,{printTemplate:t,view:a},r){const n={type:"image"},s={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==a.rotation&&(s.rotation=0);const l=r.ssExtent||a.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==a.width%2),null!=e.height&&e.height>0&&(y=e.height%2==a.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===a.scale)&&96===c&&(!u||!y)&&a.state.extent.equals(a.extent)&&(s.area={x:0,y:0,width:a.width,height:a.height},u||(s.area.width-=1),y||(s.area.height-=1),!r.ssExtent)){const e=a.toMap(i(s.area.width,s.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await a.takeScreenshot(s);return n.imageData=o(p.dataUrl)?.data,n}async function ne(e,{layerView:t,printTemplate:a},i){e.legendEnabled&&i.legendLayers.push({id:e.id});return G(e,await he(t),a,i)}async function oe(e,t){if(e.legendEnabled)for(const r of e.sublayers)r.legendEnabled&&t.legendLayers.push({id:r.id});const a={customParameters:(i=be(e)).customParameters,effect:i.effect,layerDefinition:i.layerDefinition,layerType:i.layerType,layers:i.layers,url:i.url};var i;if(de(a,e),Array.isArray(a.layers)){for(const e of a.layers)delete e.popupInfo;a.token&&a.layers.length>0&&(a.layers[a.layers.length-1].token=a.token,delete a.token)}return a}async function se(e){const t=[],a=[];for(const i of e.map.allTables)"feature"!==i.type||i.loaded||a.push(i.load());a.length&&await Promise.allSettled(a);for(const i of e.map.allTables)if("feature"===i.type&&i.loaded&&i.isTable&&"feature-layer"===i.source?.type){const e=(e=>({id:e.id,title:e.title,customParameters:e.customParameters,layerDefinition:{definitionExpression:e.layerDefinition?.definitionExpression},url:e.url}))(be(i));de(e,i),t.push(e)}return t.length?t:void 0}function le(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=be(e)).layerType,customParameters:i.customParameters};var i;return de(a,e),a}async function ce(e,t,a){const i=t.layerView;if(e.serviceUrl&&e.styleUrl&&!i.spriteSourceChanged&&!i.styleChanged){const t=f(e.styleUrl,e.apiKey),i=f(e.serviceUrl,e.apiKey);if(!t&&!i||"2.1.0"!==a.cimVersion){const a={type:"VectorTileLayer"};return a.styleUrl=s(e.styleUrl),a.token=t,i!==t&&(a.additionalTokens=[{url:e.serviceUrl,token:i}]),a}}return re(e,t,a)}function ue(e){const t=e.urlTemplate?.replace(/\${/g,"{"),a={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(a.subDomains=e.subDomains),a}async function ye(e,t,a){return parseFloat(a.cimVersion)<3.5?re(e,t,a):(e.legendEnabled&&a.legendLayers.push({id:e.id}),{layerType:(i=be(e,"web-map")).layerType,layerDefinition:i.layerDefinition,url:i.url,wfsInfo:i.wfsInfo});var i}function pe(e,t){let a;const i=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&i.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),i.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:i}),a={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:i,url:s(e.url),version:e.version}),a}function fe(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:s(e.url)}}function de(e,t){t.url&&(e.url=s(e.url||t.url),e.token=f(e.url,t.apiKey))}async function me(e,a){a.canvas||(a.canvas=document.createElement("canvas"));const i=1024;a.canvas.width=i,a.canvas.height=i;const o=a.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const a=E(o);if(!a)return null;o.clearRect(0,0,i,i);const n=r(e.size)/Math.max(a.width,a.height);o.scale(n,n);const c=i/n,u=c/2-a.width/2-a.x,y=c/2-a.height/2-a.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const i=e.outline;o.lineWidth=r(i.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${i.color[0]},${i.color[1]},${i.color[2]},${i.color[3]/255})`,o.stroke(t),a.width+=o.lineWidth,a.height+=o.lineWidth}a.width*=n,a.height*=n;const p=o.getImageData(i/2-a.width/2,i/2-a.height/2,Math.ceil(a.width),Math.ceil(a.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const a="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,i=(await t(a,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(i,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").slice(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function ge(e,t){const a=e.type;if("simple"===a&&Se(e.symbol))e.symbol=await me(e.symbol,t);else if("uniqueValue"===a||"classBreaks"===a){Se(e.defaultSymbol)&&(e.defaultSymbol=await me(e.defaultSymbol,t));const i=e["uniqueValue"===a?"uniqueValueInfos":"classBreakInfos"];if(i)for(const e of i)Se(e.symbol)&&(e.symbol=await me(e.symbol,t))}}async function he(e){return e.queryFeatures(e.createQuery()).then(e=>e.features)}function be(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function we(e){return e.gpMetadata?.executionType?k.fromJSON(e.gpMetadata.executionType):"sync"}function Se(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{R as execute,_ as getGpPrintParams,$ as getGpServerUrl,J as getMode,C as getTaskExecutionMode,A as getTaskInfo,j as getTaskInfos,N as printCacheMap};
5
+ import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as i}from"../core/jsonMap.js";import{createScreenPoint as a,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{dataComponents as o,normalize as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,findToken as f}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{formatJsonMap as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isBlendLayer as x,getCopyright as I,getSelectionSymbol as v,createPointLayer as D,createPolygonLayer as T,createPolylineLayer as L,createMultipointLayer as O,getContextBoundingBox as E}from"./support/printTaskUtils.js";import P from"./support/PrintTemplate.js";import{toJSON as M}from"./support/reportTemplate.js";import{getDefaultHighlightOptions as V}from"../views/2d/support/highlightOptionsUtils.js";import F from"../views/support/HighlightOptions.js";const k={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},N=new i({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),U=new i({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),R=new Map;async function j(e,t,i){const a=await J(e,i),r=await $(t,a);if("sync"===await A(e,i)){const{results:t}=await d(e,r,void 0,i);return t?.[0]?.value}const n=await m(e,r,void 0,i);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,i);return o}async function J(e,i){const a=q(e),r=R.get(a)??{gpServerUrl:a,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(a,p({f:"json"},i))).data,r.cimVersion=r.gpMetadata.cimVersion,R.set(a,r),r}async function A(e,t){return xe(await J(e,t))}async function C(e,i){const a=await J(e,i),r=a.gpMetadata.tasks,n=a.gpServerUrl;return a.taskInfos||(a.taskInfos={},await Promise.all(r?.map(async e=>{const r=(await t(`${n}/${e}`,p({f:"json"},i))).data,o=r.name.startsWith("GetLayoutTemplatesInfo")?"GetLayoutTemplatesInfo":r.name.startsWith("ExportWebMap")?"ExportWebMap":null;o&&(a.taskInfos[o]??=r)})??[])),a.taskInfos}async function _(e,t,i){return(await C(e,i))[t]??null}async function z(e,t,i){const a=await _(e,t,i);return a?.executionType?U.fromJSON(a.executionType):"sync"}async function $(t,i){i=i||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const a=t.template||new P;null==a.showLabels&&(a.showLabels=!0);const r=a.exportOptions;let n;const o=h(a.layout);if(r){if(n={dpi:r.dpi},"map_only"===o?.toLowerCase()||""===o){const{width:e,height:t}=r;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=a.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:e||t?{metricUnit:N.toJSON(e)??void 0,metricLabel:e?k[e]:void 0,nonMetricUnit:N.toJSON(t)??void 0,nonMetricLabel:t?k[t]:void 0}:void 0}}let c=null;s?.legendLayers&&(c=s.legendLayers.map(e=>{const t=e.layerId;i.legendLayerNameMap[t]=e.title;const a={id:t};return e.subLayerIds&&(a.subLayerIds=e.subLayerIds),a}));const u=await W(t,a,i);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,i=i=>{const a=i.text,r=i.font,n=r?.family?.toLowerCase();a&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(a)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(a)&&(r.family="Arial Unicode MS"))};for(const a of u.operationalLayers)if(a.featureCollection?.layers)for(const e of a.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&i(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&i(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:i.legendLayers.slice()}}),i.legendLayers.length=0,R.set(i.gpServerUrl,i);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g.toJSON(a.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:M(a.report),Report_Item_ID:void 0};if(a.layoutItem){delete y.Layout_Template;const t=a.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(a.reportItem){delete y.Report_Template;const t=a.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function W(e,t,i){const a=e.view;let r=a.spatialReference;const n={operationalLayers:await B(a,t,i)};t.includeTables&&(n.tables=await ce(a));let o=e.extent||i.ssExtent||a.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,a.background&&(n.background=a.background.toJSON()),a.rotation&&(n.mapOptions.rotation=-a.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||a.scale),null!=a.timeExtent){const e=null!=a.timeExtent.start?a.timeExtent.start.getTime():null,t=null!=a.timeExtent.end?a.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function q(e){let t=e;const i=t.lastIndexOf("/GPServer/");return i>0&&(t=t.slice(0,i+9)),t}async function B(e,t,i){const a=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;r.layerView=s,t=w(s)?await oe(e,r,i):S(e)?K(e):"csv"===e?.type?await H(e,r,i):"catalog-footprint"===e?.type?await G(e,r,i):"feature"===e?.type?await X(e,r,i):"geojson"===e?.type?await Y(e,r,i):"graphics"===e?.type?await Z(e,r,i):"imagery"===e?.type?ee(e,i):"imagery-tile"===e?.type?await te(e,r,i):"kml"===e?.type?await ie(e,r,i):"map-image"===e?.type?ae(e,r,i):"map-notes"===e?.type?await re(r,i):"open-street-map"===e?.type?ne():"stream"===e?.type?await se(e,r,i):"subtype-group"===e?.type?await le(e,i):"tile"===e?.type?ue(e,i):"vector-tile"===e?.type?await ye(e,r,i):"web-tile"===e?.type?pe(e):"wfs"===e?.type?await fe(e,r,i):"wms"===e?.type?de(e,i):"wmts"===e?.type?me(e):await oe(e,r,i),t&&(Array.isArray(t)?a.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,x(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),a.push(t)))}if(n)for(const s of a)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await Q(null,e.graphics,t,i);r&&a.push(r)}return a}function K(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function G(e,{layerView:t,printTemplate:i},a){if(parseFloat(a.cimVersion)<3.1){return Q(e,await we(t),i,a)}const r=e.parent,n={id:(o=Se(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return ge(n,r),n}async function H(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const a=t.layerView,r=t.printTemplate;if(!(a.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=Se(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return Q(e,await we(a),r,i)}async function Q(e,t,i,a){let r;const n=T(),o=L(),s=D(),u=O(),y=D();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=a.legendLayerNameMap[e.id]||e.arcgisProps?.title||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),i=n.layerDefinition.drawingInfo;i&&(i.renderer=t);const a=o.layerDefinition.drawingInfo;a&&(a.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=Se(e,"web-map"),i=t.layerDefinition?.drawingInfo?.labelingInfo;if(i){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=i);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=i);const a=s.layerDefinition.drawingInfo;a&&(a.labelingInfo=i);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=i)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;r&&await c(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const i=f.fields.map(e=>e.toJSON());n.layerDefinition.fields=i,o.layerDefinition.fields=i,s.layerDefinition.fields=i,u.layerDefinition.fields=i}const m=t?.length;let g;for(let c=0;c<m;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,Ie(g.symbol)?g.symbol=await he(g.symbol,a):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter(e=>e.featureSet.features.length>0);for(const l of h){const e=l.featureSet.features.every(e=>e.symbol);if(e&&(!i||!i.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await be(l.layerDefinition.drawingInfo.renderer,a)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function X(e,t,i){let a;const r=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(n<2.9||"pie-chart"===e.featureReduction.renderer?.type)||"pie-chart"===r?.type&&n<3.1||"dot-density"===r?.type&&n<2.6)return oe(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await we(o);a=await Q(e,t,s,i)}else{if(a={id:(p=Se(e)).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},s.attributionVisible&&(a.credits=I(e)),a.showLabels=s.showLabels&&e.labelsVisible,ge(a,e),delete a.layerDefinition?.featureReduction?.disablePopup,delete a.layerDefinition?.featureReduction?.popupInfo,o.displayFilterEnabled||delete a.layerDefinition?.displayFilterInfo,a.layerDefinition?.drawingInfo?.renderer&&(delete a.layerDefinition.minScale,delete a.layerDefinition.maxScale,await be(a.layerDefinition.drawingInfo.renderer,i),"visualVariables"in r&&r.visualVariables?.[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);a.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,a.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(a.layerDefinition??={},a.layerDefinition.definitionExpression=a.layerDefinition.definitionExpression?`(${a.layerDefinition.definitionExpression}) AND (${t})`:t),e.gdbVersion&&(a.layerDefinition??={},a.layerDefinition.gdbVersion=e.gdbVersion),o.hasHighlight&&"highlightIds"in o){const t=o;a.selectionObjectIds=t.highlightIds;const i=V(t)||V(l)||new F;a.selectionSymbol=v(e.geometryType,i)}}var p;return a}async function Y(e,t,i){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return oe(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});return Q(e,await we(t.layerView),t.printTemplate,i)}async function Z(e,{printTemplate:t},i){return Q(e,null,t,i)}function ee(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=Se(e)).layerType,customParameters:a.customParameters};var a;return i.bandIds=e.bandIds,i.compressionQuality=e.compressionQuality,i.format=e.format,i.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(i.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(i.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(i.layerDefinition??={},i.layerDefinition.drawingInfo??={},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),ge(i,e),i}async function te(e,t,i){if("flow"===e.renderer?.type)return oe(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const a={bandIds:(r=Se(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return a.layerType="ArcGISImageServiceLayer",ge(a,e),a}async function ie(e,t,i){const a=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=Se(e,"web-map");return t.type="kml",delete t.layerType,t.url=s(e.url),t}const r=[],n=t.layerView,o="data:image/png;base64,";n.allVisibleMapImages.forEach((t,i)=>{const a={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};t.href.startsWith(o)?a.imageData=t.href.slice(o.length):a.url=t.href,r.push(a)});const l=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],c={id:e.id,...await Q(null,l,a,i)};return r.push(c),r}function ae(e,{printTemplate:t,view:i},a){let r;const n={id:e.id,subLayerIds:[]};let o=[];const s=i.scale,l=e=>{const t=0===s,i=0===e.minScale||s<=e.minScale,a=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||i&&a))if(e.sublayers)e.sublayers.forEach(l);else{const t=e.toExportImageJSON(),i={id:e.id,name:e.title,layerDefinition:{definitionExpression:t.definitionExpression,drawingInfo:t.drawingInfo,orderBy:t.orderBy,source:t.source}};o.unshift(i),n.subLayerIds.push(e.id)}};var c;return e.sublayers?.forEach(l),o.length&&(o=o.map(({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i})),r={layerType:(c=Se(e)).layerType,customParameters:c.customParameters},r.layers=o,r.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:n.subLayerIds,t.attributionVisible&&(r.credits=I(e)),e.gdbVersion&&(r.gdbVersion=e.gdbVersion),ge(r,e),e.legendEnabled&&a.legendLayers.push(n)),r}async function re({layerView:e,printTemplate:t},i){const a=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await Q(n,n.source,t,i);e&&a.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await Q(null,n.graphics,t,i);e&&a.push(...e.featureCollection.layers)}return{featureCollection:{layers:a}}}function ne(){return{type:"OpenStreetMap"}}async function oe(e,{printTemplate:t,view:i},r){const n={type:"image"},s={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==i.rotation&&(s.rotation=0);const l=r.ssExtent||i.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==i.width%2),null!=e.height&&e.height>0&&(y=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===c&&(!u||!y)&&i.state.extent.equals(i.extent)&&(s.area={x:0,y:0,width:i.width,height:i.height},u||(s.area.width-=1),y||(s.area.height-=1),!r.ssExtent)){const e=i.toMap(a(s.area.width,s.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await i.takeScreenshot(s);return n.imageData=o(p.dataUrl)?.data,n}async function se(e,{layerView:t,printTemplate:i},a){e.legendEnabled&&a.legendLayers.push({id:e.id});return Q(e,await we(t),i,a)}async function le(e,t){if(e.legendEnabled)for(const r of e.sublayers)r.legendEnabled&&t.legendLayers.push({id:r.id});const i={customParameters:(a=Se(e)).customParameters,effect:a.effect,layerDefinition:a.layerDefinition,layerType:a.layerType,layers:a.layers,url:a.url};var a;if(ge(i,e),Array.isArray(i.layers)){for(const e of i.layers)delete e.popupInfo;i.token&&i.layers.length>0&&(i.layers[i.layers.length-1].token=i.token,delete i.token)}return i}async function ce(e){const t=[],i=[];for(const a of e.map.allTables)"feature"!==a.type||a.loaded||i.push(a.load());i.length&&await Promise.allSettled(i);for(const a of e.map.allTables)if("feature"===a.type&&a.loaded&&a.isTable&&"feature-layer"===a.source?.type){const e=(e=>({id:e.id,title:e.title,customParameters:e.customParameters,layerDefinition:{definitionExpression:e.layerDefinition?.definitionExpression},url:e.url}))(Se(a));ge(e,a),t.push(e)}return t.length?t:void 0}function ue(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=Se(e)).layerType,customParameters:a.customParameters};var a;return ge(i,e),i}async function ye(e,t,i){const a=t.layerView;if(e.serviceUrl&&e.styleUrl&&!a.spriteSourceChanged&&!a.styleChanged){const t=f(e.styleUrl,e.apiKey),a=f(e.serviceUrl,e.apiKey);if(!t&&!a||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=s(e.styleUrl),i.token=t,a!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:a}]),i}}return oe(e,t,i)}function pe(e){const t=e.urlTemplate?.replace(/\${/g,"{"),i={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(i.subDomains=e.subDomains),i}async function fe(e,t,i){return parseFloat(i.cimVersion)<3.5?oe(e,t,i):(e.legendEnabled&&i.legendLayers.push({id:e.id}),{layerType:(a=Se(e,"web-map")).layerType,layerDefinition:a.layerDefinition,url:a.url,wfsInfo:a.wfsInfo});var a}function de(e,t){let i;const a=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&a.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),a.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:a}),i={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:a,url:s(e.url),version:e.version}),i}function me(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:s(e.url)}}function ge(e,t){t.url&&(e.url=s(e.url||t.url),e.token=f(e.url,t.apiKey))}async function he(e,i){i.canvas||(i.canvas=document.createElement("canvas"));const a=1024;i.canvas.width=a,i.canvas.height=a;const o=i.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const i=E(o);if(!i)return null;o.clearRect(0,0,a,a);const n=r(e.size)/Math.max(i.width,i.height);o.scale(n,n);const c=a/n,u=c/2-i.width/2-i.x,y=c/2-i.height/2-i.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const a=e.outline;o.lineWidth=r(a.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${a.color[0]},${a.color[1]},${a.color[2]},${a.color[3]/255})`,o.stroke(t),i.width+=o.lineWidth,i.height+=o.lineWidth}i.width*=n,i.height*=n;const p=o.getImageData(a/2-i.width/2,a/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const i="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,a=(await t(i,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(a,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").slice(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function be(e,t){const i=e.type;if("simple"===i&&Ie(e.symbol))e.symbol=await he(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){Ie(e.defaultSymbol)&&(e.defaultSymbol=await he(e.defaultSymbol,t));const a=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(a)for(const e of a)Ie(e.symbol)&&(e.symbol=await he(e.symbol,t))}}async function we(e){return e.queryFeatures(e.createQuery()).then(e=>e.features)}function Se(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function xe(e){return e.gpMetadata?.executionType?U.fromJSON(e.gpMetadata.executionType):"sync"}function Ie(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{j as execute,$ as getGpPrintParams,q as getGpServerUrl,A as getMode,z as getTaskExecutionMode,_ as getTaskInfo,C as getTaskInfos,R as printCacheMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- const d="20250805",f="edff5657618a02da36d541b6f6c56f103d597713";export{d as buildDate,f as commitHash};
5
+ const c="20250807",e="64cc533f44803135373e0050983e83a9fec0d226";export{c as buildDate,e as commitHash};