@arcgis/core 4.34.0-next.33 → 4.34.0-next.35

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 (254) hide show
  1. package/Graphic.js +1 -1
  2. package/arcade/ArcadeDate.js +1 -1
  3. package/arcade/ArcadeModuleResolver.js +1 -1
  4. package/arcade/featureset/actions/GroupBy.js +1 -1
  5. package/arcade/functions/date.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/{28e04ef3575f164f611a.js → 00870a35b254295bc408.js} +1 -1
  8. package/assets/esri/core/workers/chunks/017adbbb77c9c9b4d49f.js +1 -0
  9. package/assets/esri/core/workers/chunks/{c6edf028dd04d47d7580.js → 087ae1e3e767f0e678e5.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{b4b30a7f1b673461dc55.js → 0997e09fe5b0aba1f804.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{341507901f3858559c82.js → 125fdea50620d4db2678.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{9bc6d974b0fce9db64ef.js → 15a5a89cd228a9364332.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{847455bf4fc33d6e6efc.js → 1dc410bc070cabb7198d.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{971b16677b66c16fb6b9.js → 20aed6e1d9b6bf06a398.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{94a3474e3f45efa4a4fe.js → 2c816d3a737e39e6eb84.js} +1 -1
  16. package/assets/esri/core/workers/chunks/2de11a8e5d426c381991.js +1 -0
  17. package/assets/esri/core/workers/chunks/{fb71e533995c54cd806f.js → 319fe6a02ec630a827ea.js} +1 -1
  18. package/assets/esri/core/workers/chunks/3a7e43675163f7bed6ac.js +1 -0
  19. package/assets/esri/core/workers/chunks/{1aa6719be3afbdc7c880.js → 3cd1ab26396052f17832.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{359c282fd67148fda5fa.js → 3d5954478864a975e65e.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{2fdf457786d2d5d7414f.js → 3eb792863a789b97ec58.js} +1 -1
  22. package/assets/esri/core/workers/chunks/40b0c5368b8322498189.js +1 -0
  23. package/assets/esri/core/workers/chunks/{89999baefa341bd3329c.js → 4193691ca076948f4f90.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4778acd0cfaf0cebeec7.js → 439128f23fa091633d2d.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{057df92b981c9b311d68.js → 43fba9d6be5971ec20a9.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{74f3bc6c6b82de49d6ee.js → 4ac6bf9ff1cfbde87c7b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{0b3a200b97d790d08248.js → 4b9003ddfe61dc3729f4.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{5192f38682f1f9be7da0.js → 549e073fe276363a9896.js} +1 -1
  29. package/assets/esri/core/workers/chunks/6000a302369799ea42a6.js +1 -0
  30. package/assets/esri/core/workers/chunks/{5d0c92aaa5891e6cb8f0.js → 641ca71d7c1a07bde66a.js} +1 -1
  31. package/assets/esri/core/workers/chunks/646227b500b92999f2c8.js +1 -0
  32. package/assets/esri/core/workers/chunks/{50b0d96e1a5ccffeb803.js → 64fab4e1e28c06c83403.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{d3cb21cdc5b9483dd1f4.js → 69ae235423f0b1bdfcb4.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{3323646096474740fed5.js → 6c72e2c09ed62cb2fd79.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{63cb3dcd359e96733b1b.js → 6ce2f86b9b1d2f2b8675.js} +1 -1
  36. package/assets/esri/core/workers/chunks/752eabfbed7b8b65cf3f.js +1 -0
  37. package/assets/esri/core/workers/chunks/{98f6d4ea026ed96fd3f3.js → 773feb0e0fad26df57ef.js} +1 -1
  38. package/assets/esri/core/workers/chunks/7b1d14a921d30c95d68b.js +1 -0
  39. package/assets/esri/core/workers/chunks/{b78d00c4e493086741e1.js → 7d25f57299c642e727a6.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{3a0da512562ba492609d.js → 827bebb4bcdde23adc91.js} +1 -1
  41. package/assets/esri/core/workers/chunks/8b7f6f2d1692b6b6dbd5.js +1 -0
  42. package/assets/esri/core/workers/chunks/{9152d62c55d3396763bd.js → 8be81e1530b952c97936.js} +1 -1
  43. package/assets/esri/core/workers/chunks/90a0c1c5c851cc9b6d6d.js +1 -0
  44. package/assets/esri/core/workers/chunks/91d48c32bf11ad1405c8.js +1 -0
  45. package/assets/esri/core/workers/chunks/9228f760129e48585b54.js +1 -0
  46. package/assets/esri/core/workers/chunks/9a54c96b48e94d816881.js +1 -0
  47. package/assets/esri/core/workers/chunks/a36be186ad10200c420c.js +1 -0
  48. package/assets/esri/core/workers/chunks/{c18167a0790241f80bf7.js → a6767d75e718f2e1e714.js} +1 -1
  49. package/assets/esri/core/workers/chunks/aa12ba96fb8c91105473.js +1 -0
  50. package/assets/esri/core/workers/chunks/{ea240d9e594bfbd8af68.js → aaf696a1026de569c82d.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{b1ef40ef898a8c7f43a2.js → acb95ae6203f708d71b4.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{22f38cad0213f2112394.js → b1982490762972ae023d.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{bc0f5477b4491ab48b3a.js → b28855db6a30d4d4f348.js} +1 -1
  54. package/assets/esri/core/workers/chunks/b331543767c35e5edcc6.js +1 -0
  55. package/assets/esri/core/workers/chunks/{6ccd6171d3c572883034.js → b877142a275188a16e17.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{7d852617e91b51121ea7.js → ba29c535128c4e8ae2d3.js} +1 -1
  57. package/assets/esri/core/workers/chunks/bf60d4da0dff1e14da8e.js +1 -0
  58. package/assets/esri/core/workers/chunks/{39bff604d4b4a1295038.js → c038472cb7f60af9426e.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{ca46f78aac1133d127fa.js → c1e5e2a6e7e2d7a1d63c.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{1c3578d5e956a4587973.js → c30adbead0ba4722acf9.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{0260b33daf48fc207880.js → c9b11c7170c99f9e0e93.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{a809042fdce7ced2a415.js → cc3ca1729af33688c1e3.js} +1 -1
  63. package/assets/esri/core/workers/chunks/cde79c3644166d4798a8.js +1 -0
  64. package/assets/esri/core/workers/chunks/{181f8bbe670b4468307a.js → ce8f0ed9179c0d314df8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{58393ab52d0b8f718241.js → d3fd11da3a823e148957.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{ac30cf2f9a94597f7665.js → d6b2ab614f308db50c4a.js} +2 -2
  67. package/assets/esri/core/workers/chunks/{41d36b87e3dfc01be38d.js → d7b3e81cc313fd0a33b0.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{abe2cdfc2eda46b00812.js → d9045b964f536695840b.js} +1 -1
  69. package/assets/esri/core/workers/chunks/dde6000aa2f69f6ecad0.js +1 -0
  70. package/assets/esri/core/workers/chunks/dec9656997683ef01ba6.js +1 -0
  71. package/assets/esri/core/workers/chunks/{1e20e43d1dc5273708c7.js → e1472dbf0795d737d6f8.js} +1 -1
  72. package/assets/esri/core/workers/chunks/e18bb372457cedbf4f8c.js +1 -0
  73. package/assets/esri/core/workers/chunks/e892ed8b0b990d7eba28.js +1 -0
  74. package/assets/esri/core/workers/chunks/{dc5a8cf2a44a5ac201c5.js → ed05399f9a07fea66685.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{300a5257969d3835ceeb.js → f19426eb53d8430ded51.js} +1 -1
  76. package/assets/esri/core/workers/chunks/f3358b19af0f03f16543.js +1 -0
  77. package/assets/esri/core/workers/chunks/{1b5923dfd70d464dfb25.js → f4c38a9c01c29b5a6244.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{c854c3bb4440fd942c12.js → f6c1854f36b029fa6c37.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{039979cbf35a241ed0a4.js → fdc8300b6374ef2b8b3e.js} +1 -1
  80. package/chunks/Distance2DCalculator-CXhBP-8I.js +1 -1
  81. package/chunks/OperatorCrosses.js +1 -1
  82. package/chunks/OperatorGeodesicBuffer.js +1 -1
  83. package/chunks/OperatorIntersects.js +1 -1
  84. package/chunks/OperatorOverlaps.js +1 -1
  85. package/chunks/OperatorProximity.js +1 -1
  86. package/chunks/OperatorShapePreservingLength.js +1 -1
  87. package/chunks/OperatorShapePreservingProject.js +1 -1
  88. package/chunks/OperatorTouches.js +1 -1
  89. package/chunks/OperatorWithin.js +1 -1
  90. package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
  91. package/chunks/UnitFactory.js +1 -1
  92. package/chunks/equalsOperator.js +1 -1
  93. package/config.js +1 -1
  94. package/core/BidiEngine.js +1 -1
  95. package/core/Clonable.js +1 -1
  96. package/core/Promise.js +1 -1
  97. package/core/promiseUtils.js +1 -1
  98. package/core/sql/SqlInterval.js +1 -1
  99. package/core/sql/sqlDateParsingUtils.js +1 -1
  100. package/core/unitUtils.js +1 -1
  101. package/geometry/operators/gx/operatorDifference.js +1 -1
  102. package/geometry/operators/gx/operatorIntersection.js +1 -1
  103. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  104. package/geometry/support/coordinateSystem.js +1 -1
  105. package/graphic/BuildingGraphicOrigin.d.ts +4 -0
  106. package/graphic/BuildingGraphicOrigin.js +5 -0
  107. package/graphic/CSVGraphicOrigin.d.ts +4 -0
  108. package/graphic/CSVGraphicOrigin.js +5 -0
  109. package/graphic/CatalogGraphicOrigin.d.ts +4 -0
  110. package/graphic/CatalogGraphicOrigin.js +5 -0
  111. package/graphic/FeatureGraphicOrigin.d.ts +4 -0
  112. package/graphic/FeatureGraphicOrigin.js +5 -0
  113. package/graphic/GeoJSONGraphicOrigin.d.ts +4 -0
  114. package/graphic/GeoJSONGraphicOrigin.js +5 -0
  115. package/graphic/GraphicOrigin.d.ts +4 -0
  116. package/graphic/GraphicOrigin.js +5 -0
  117. package/graphic/IntegratedMesh3DTilesGraphicOrigin.d.ts +4 -0
  118. package/graphic/IntegratedMesh3DTilesGraphicOrigin.js +5 -0
  119. package/graphic/IntegratedMeshGraphicOrigin.d.ts +4 -0
  120. package/graphic/IntegratedMeshGraphicOrigin.js +5 -0
  121. package/graphic/OGCFeatureGraphicOrigin.d.ts +4 -0
  122. package/graphic/OGCFeatureGraphicOrigin.js +5 -0
  123. package/graphic/PointCloudGraphicOrigin.d.ts +4 -0
  124. package/graphic/PointCloudGraphicOrigin.js +5 -0
  125. package/graphic/SceneGraphicOrigin.d.ts +4 -0
  126. package/graphic/SceneGraphicOrigin.js +5 -0
  127. package/graphic/StreamGraphicOrigin.d.ts +4 -0
  128. package/graphic/StreamGraphicOrigin.js +5 -0
  129. package/graphic/VectorTileGraphicOrigin.d.ts +4 -0
  130. package/graphic/VectorTileGraphicOrigin.js +5 -0
  131. package/graphic/VoxelGraphicOrigin.d.ts +4 -0
  132. package/graphic/VoxelGraphicOrigin.js +5 -0
  133. package/graphic/WFSGraphicOrigin.d.ts +4 -0
  134. package/graphic/WFSGraphicOrigin.js +5 -0
  135. package/graphic/graphicOriginUtils.js +5 -0
  136. package/graphic/graphicOrigins.d.ts +14 -0
  137. package/graphic/graphicOrigins.js +5 -0
  138. package/graphic/isBuildingGraphicOrigin.js +5 -0
  139. package/graphic/isCSVGraphicOrigin.js +5 -0
  140. package/graphic/isCatalogGraphicOrigin.js +5 -0
  141. package/graphic/isFeatureGraphicOrigin.js +5 -0
  142. package/graphic/isGeoJSONGraphicOrigin.js +5 -0
  143. package/graphic/isIntegratedMesh3DTilesGraphicOrigin.js +5 -0
  144. package/graphic/isIntegratedMeshGraphicOrigin.js +5 -0
  145. package/graphic/isOGCFeatureGraphicOrigin.js +5 -0
  146. package/graphic/isPointCloudGraphicOrigin.js +5 -0
  147. package/graphic/isSceneGraphicOrigin.js +5 -0
  148. package/graphic/isStreamGraphicOrigin.js +5 -0
  149. package/graphic/isVectorTileGraphicOrigin.js +5 -0
  150. package/graphic/isVoxelGraphicOrigin.js +5 -0
  151. package/graphic/isWFSGraphicOrigin.js +5 -0
  152. package/interfaces.d.ts +354 -13
  153. package/kernel.js +1 -1
  154. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  155. package/layers/support/Field.js +1 -1
  156. package/layers/support/featurePopupQueryUtils.js +1 -1
  157. package/layers/voxel/NCTimeParser.js +1 -1
  158. package/package.json +3 -3
  159. package/rest/knowledgeGraphService.js +1 -1
  160. package/smartMapping/statistics/support/utils.js +1 -1
  161. package/support/arcadeExpressionUtils.js +1 -1
  162. package/support/revision.js +1 -1
  163. package/symbols/support/svgUtils.js +1 -1
  164. package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
  165. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  166. package/views/2d/engine/webgl/Painter.js +1 -1
  167. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  168. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  169. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  170. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  171. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  172. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  173. package/views/2d/layers/TileLayerView2D.js +1 -1
  174. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  175. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  176. package/views/3d/analysis/Slice/SliceController.js +1 -1
  177. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  178. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementComputation.js +5 -0
  179. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
  180. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  181. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  182. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  183. package/views/3d/layers/CSVLayerView3D.js +1 -1
  184. package/views/3d/layers/CatalogFootprintLayerView3D.js +1 -1
  185. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  186. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  187. package/views/3d/layers/FlowSubView3D.js +1 -1
  188. package/views/3d/layers/GeoJSONLayerView3D.js +1 -1
  189. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  190. package/views/3d/layers/GraphicsView3D.js +1 -1
  191. package/views/3d/layers/I3SMeshView3D.js +1 -1
  192. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  193. package/views/3d/layers/MediaLayerView3D.js +1 -1
  194. package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
  195. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  196. package/views/3d/layers/RouteLayerView3D.js +1 -1
  197. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  198. package/views/3d/layers/SceneLayerView3D.js +1 -1
  199. package/views/3d/layers/StreamLayerView3D.js +1 -1
  200. package/views/3d/layers/WFSLayerView3D.js +1 -1
  201. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  202. package/views/3d/layers/graphics/StreamController.js +1 -1
  203. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  204. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  205. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  206. package/views/3d/layers/support/FeatureTileDescriptor.js +1 -1
  207. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  208. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  209. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  210. package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
  211. package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
  212. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  213. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  214. package/views/3d/state/ConstraintsManager.js +1 -1
  215. package/views/3d/support/flow/geometryUtils.js +1 -1
  216. package/views/3d/terrain/OverlayManager.js +1 -1
  217. package/views/3d/terrain/TerrainSurface.js +1 -1
  218. package/views/3d/terrain/Tile.js +1 -1
  219. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  220. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  221. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  222. package/views/SceneView.js +1 -1
  223. package/views/interactive/Tooltip.js +1 -1
  224. package/views/layers/FeatureLayerView.js +1 -1
  225. package/views/layers/support/popupUtils.js +1 -1
  226. package/views/support/Scheduler.js +1 -1
  227. package/views/support/highlightOptionsUtils.js +1 -1
  228. package/views/webgl/FramebufferObject.js +1 -1
  229. package/views/webgl/RenderbufferDescriptor.js +1 -1
  230. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  231. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  232. package/assets/esri/core/workers/chunks/07b2cc0f6b064277632f.js +0 -1
  233. package/assets/esri/core/workers/chunks/0fc620d6d0c4ac282d72.js +0 -1
  234. package/assets/esri/core/workers/chunks/0fe32bdf2055bcd1e928.js +0 -1
  235. package/assets/esri/core/workers/chunks/13f9e92e7e5d44d9f95c.js +0 -1
  236. package/assets/esri/core/workers/chunks/140efe4735605258ecc9.js +0 -1
  237. package/assets/esri/core/workers/chunks/23eae849ee0ca7b3fd81.js +0 -1
  238. package/assets/esri/core/workers/chunks/2b76e716f478468b6798.js +0 -1
  239. package/assets/esri/core/workers/chunks/386ab72a45102c2d47f2.js +0 -1
  240. package/assets/esri/core/workers/chunks/3fb6146d914f9b410c2e.js +0 -1
  241. package/assets/esri/core/workers/chunks/432365fcd7becd508541.js +0 -1
  242. package/assets/esri/core/workers/chunks/439ce953a25b2776cb7f.js +0 -1
  243. package/assets/esri/core/workers/chunks/4c8d2334fcdb1354ff43.js +0 -1
  244. package/assets/esri/core/workers/chunks/5f321be63ed5447b04a1.js +0 -1
  245. package/assets/esri/core/workers/chunks/6006fbdb90c3bfc493a6.js +0 -1
  246. package/assets/esri/core/workers/chunks/7c35c61e3673cf94cdfd.js +0 -1
  247. package/assets/esri/core/workers/chunks/7c75876a0c6460585055.js +0 -1
  248. package/assets/esri/core/workers/chunks/949dc266ac6f3505d357.js +0 -1
  249. package/assets/esri/core/workers/chunks/99e3f7b3ea0bfe9b8d34.js +0 -1
  250. package/assets/esri/core/workers/chunks/a84af1b8b64b86b49bd3.js +0 -1
  251. package/assets/esri/core/workers/chunks/a9d83a442d8d7a376fc0.js +0 -1
  252. package/assets/esri/core/workers/chunks/ba1b21a90b257ac9a342.js +0 -1
  253. package/assets/esri/core/workers/chunks/c50c2f014e8567870686.js +0 -1
  254. package/assets/esri/core/workers/chunks/f9ad37dfbe1d14c6a352.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as e}from"../../core/promiseUtils.js";import{sqlAnd as t}from"../../core/sql.js";import{unpackFieldNames as o,featureHasFields as i}from"./fieldUtils.js";import{loadArcade as n}from"../../support/loadArcade.js";async function s(n,s,l,u){const c=new Array(s.length),a=new Map,d=new Map,p=o(n.fieldsIndex,l.outFields),f=u?.hasRequiredFields??i;for(let t=0;t<s.length;t++){const o=s[t];if(o.isAggregate){c[t]=o;continue}let i=!1;if(u?.getPopupTemplate){const t=o.origin?.layer??o.sourceLayer??o.layer,n=u.getPopupTemplate(t);if(null==n)continue;const s=await r(n);e(u),i=s&&s.arcadeUtils.hasGeometryOperations(n)}if(i||!f(o,p)){const e=o.getObjectId();if(null!=e){a.set(e,{graphic:o,index:t});continue}const i=o.getGlobalId();if(null!=i){d.set(i,{graphic:o,index:t});continue}}c[t]=o}if(!n.queryFeatures||0===a.size&&0===d.size)return c.filter(Boolean);const g=[],y=(e,t)=>{t&&(e.outFields??=[],e.outFields.includes(t)||e.outFields.push(t))};if(a.size>0){const e=l.clone();y(e,n.objectIdField),"uniqueIdFields"in n&&n.uniqueIdFields?.length&&(e.outFields??=[],e.outFields.push(...n.uniqueIdFields)),e.objectIds=Array.from(a.keys()),g.push({type:"object-id",query:e,map:a})}const m="globalIdField"in n?n.globalIdField:null;if(null!=m&&d.size>0){const e=l.clone();y(e,m);const o=Array.from(d.keys());e.where=t(l.where,`${m} IN (${o.map(e=>`'${e}'`).join(",")})`),g.push({type:"global-id",query:e,map:d})}const b=u?.updateSourceAttributes??!1;for(const{type:e,query:t,map:o}of g)try{const i=await n.queryFeatures(t,u);for(const t of i.features){const i="object-id"===e?t.getObjectId():t.getGlobalId();if(null==i)continue;const n=o.get(i);if(!n)continue;const{graphic:s,index:r}=n;if(b&&t.attributes){s.attributes??={};for(const e of p)e in t.attributes&&(s.attributes[e]=t.attributes[e])}const{geometry:l,origin:u}=s;t.geometry||=l,t.origin=u,c[r]=t}}catch{}return c.filter(Boolean)}async function r(e){if(e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some(e=>"expression"===e.type))return n()}export{s as fetchFeaturePopupFeatures,r as loadFeaturePopupArcadeModules};
5
+ import{throwIfAborted as e}from"../../core/promiseUtils.js";import{sqlAnd as t}from"../../core/sql.js";import{unpackFieldNames as o,featureHasFields as i}from"./fieldUtils.js";import{loadArcade as n}from"../../support/loadArcade.js";async function r(n,r,l,u){const c=new Array(r.length),a=new Map,d=new Map,p=o(n.fieldsIndex,l.outFields),f=u?.hasRequiredFields??i;for(let t=0;t<r.length;t++){const o=r[t];if(o.isAggregate){c[t]=o;continue}let i=!1;if(u?.getPopupTemplate){const t=(o.origin&&"object"==typeof o.origin&&"layer"in o.origin?o.origin.layer:null)??o.sourceLayer??o.layer,n=u.getPopupTemplate(t);if(null==n)continue;const r=await s(n);e(u),i=r&&r.arcadeUtils.hasGeometryOperations(n)}if(i||!f(o,p)){const e=o.getObjectId();if(null!=e){a.set(e,{graphic:o,index:t});continue}const i=o.getGlobalId();if(null!=i){d.set(i,{graphic:o,index:t});continue}}c[t]=o}if(!n.queryFeatures||0===a.size&&0===d.size)return c.filter(Boolean);const g=[],y=(e,t)=>{t&&(e.outFields??=[],e.outFields.includes(t)||e.outFields.push(t))};if(a.size>0){const e=l.clone();y(e,n.objectIdField),"uniqueIdFields"in n&&n.uniqueIdFields?.length&&(e.outFields??=[],e.outFields.push(...n.uniqueIdFields)),e.objectIds=Array.from(a.keys()),g.push({type:"object-id",query:e,map:a})}const m="globalIdField"in n?n.globalIdField:null;if(null!=m&&d.size>0){const e=l.clone();y(e,m);const o=Array.from(d.keys());e.where=t(l.where,`${m} IN (${o.map(e=>`'${e}'`).join(",")})`),g.push({type:"global-id",query:e,map:d})}const b=u?.updateSourceAttributes??!1;for(const{type:e,query:t,map:o}of g)try{const i=await n.queryFeatures(t,u);for(const t of i.features){const i="object-id"===e?t.getObjectId():t.getGlobalId();if(null==i)continue;const n=o.get(i);if(!n)continue;const{graphic:r,index:s}=n;if(b&&t.attributes){r.attributes??={};for(const e of p)e in t.attributes&&(r.attributes[e]=t.attributes[e])}const{geometry:l,origin:u}=r;t.geometry||=l,t.origin=u,c[s]=t}}catch{}return c.filter(Boolean)}async function s(e){if(e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some(e=>"expression"===e.type))return n()}export{r as fetchFeaturePopupFeatures,s as loadFeaturePopupArcadeModules};
@@ -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
- function r(r){const e=/^(days?|hours?|minutes?|seconds?|d|h|m|s) since (\d{1,4})-(\d{1,2})-(\d{1,2})[ |T](\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[\s|Z]?(([+|\-|\s?])(\d{1,2}):(\d{1,2}))?$/i.exec(r);if(null==e)return{didParse:!1};const[,t,s,a,d,n,i,u,N,o,c,f,p]=e;let $="seconds";const P=t.charAt(0).toLowerCase();"d"===P?$="days":"h"===P?$="hours":"m"===P&&($="minutes");const m=parseInt(s,10);if(Number.isNaN(m))return{didParse:!1};const b=parseInt(a,10);if(Number.isNaN(b)||b<1||b>12)return{didParse:!1};const I=parseInt(d,10);if(Number.isNaN(I)||I<1||I>31)return{didParse:!1};if(2===b){const r=m%4==0&&(m%100!=0||m%400==0);if(r&&I>29||!r&&I>28)return{didParse:!1}}else if((4===b||6===b||9===b||11===b)&&I>30)return{didParse:!1};const S=parseInt(n,10);if(Number.isNaN(S)||S<0||S>23)return{didParse:!1};const l=parseInt(i,10);if(Number.isNaN(l)||l<0||l>59)return{didParse:!1};const h=parseInt(u,10);if(Number.isNaN(h)||h<0||h>59)return{didParse:!1};let w=1,x=0,y=0;if(c&&(w="-"===c?-1:1),f){if(x=parseInt(f,10),Number.isNaN(x)||x<0)return{didParse:!1};if(0!==x){const r=w*x;if(r<-12||r>14)return{didParse:!1}}}if(p&&(y=parseInt(p,10),Number.isNaN(y)||y<0||y>59))return{didParse:!1};const T=`${m}`.padStart(4,"0"),Z=`${b}`.padStart(2,"0"),A=`${I}`.padStart(2,"0"),C=`${S}`.padStart(2,"0"),D=`${l}`.padStart(2,"0"),L=`${h}`.padStart(2,"0");let g="Z";0===x&&0===y||(g=""+(w>0?"+":"-"),g+=`${x}`.padStart(2,"0"),g+=":",g+=`${y}`.padStart(2,"0"));return{didParse:!0,unit:$,reference:new Date(`${T}-${Z}-${A}T${C}:${D}:${L}.000${g}`)}}export{r as parseTimeDimensionUnit};
5
+ function r(r){const e=/^(days?|hours?|minutes?|seconds?|d|h|m|s) since (\d{1,4})-(\d{1,2})-(\d{1,2})[ |T](\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[\s|Z]?(([+|\-\s?])(\d{1,2}):(\d{1,2}))?$/i.exec(r);if(null==e)return{didParse:!1};const[,t,s,a,d,n,i,u,N,o,c,f,p]=e;let $="seconds";const P=t.charAt(0).toLowerCase();"d"===P?$="days":"h"===P?$="hours":"m"===P&&($="minutes");const m=parseInt(s,10);if(Number.isNaN(m))return{didParse:!1};const b=parseInt(a,10);if(Number.isNaN(b)||b<1||b>12)return{didParse:!1};const I=parseInt(d,10);if(Number.isNaN(I)||I<1||I>31)return{didParse:!1};if(2===b){const r=m%4==0&&(m%100!=0||m%400==0);if(r&&I>29||!r&&I>28)return{didParse:!1}}else if((4===b||6===b||9===b||11===b)&&I>30)return{didParse:!1};const S=parseInt(n,10);if(Number.isNaN(S)||S<0||S>23)return{didParse:!1};const l=parseInt(i,10);if(Number.isNaN(l)||l<0||l>59)return{didParse:!1};const h=parseInt(u,10);if(Number.isNaN(h)||h<0||h>59)return{didParse:!1};let w=1,x=0,y=0;if(c&&(w="-"===c?-1:1),f){if(x=parseInt(f,10),Number.isNaN(x)||x<0)return{didParse:!1};if(0!==x){const r=w*x;if(r<-12||r>14)return{didParse:!1}}}if(p&&(y=parseInt(p,10),Number.isNaN(y)||y<0||y>59))return{didParse:!1};const T=`${m}`.padStart(4,"0"),Z=`${b}`.padStart(2,"0"),A=`${I}`.padStart(2,"0"),C=`${S}`.padStart(2,"0"),D=`${l}`.padStart(2,"0"),L=`${h}`.padStart(2,"0");let g="Z";0===x&&0===y||(g=""+(w>0?"+":"-"),g+=`${x}`.padStart(2,"0"),g+=":",g+=`${y}`.padStart(2,"0"));return{didParse:!0,unit:$,reference:new Date(`${T}-${Z}-${A}T${C}:${D}:${L}.000${g}`)}}export{r as parseTimeDimensionUnit};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.34.0-next.33",
3
+ "version": "4.34.0-next.35",
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": [
@@ -27,8 +27,8 @@
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.1.0",
29
29
  "@esri/calcite-components": "^3.2.1",
30
- "@vaadin/grid": "~24.8.2",
31
- "@zip.js/zip.js": "~2.7.62",
30
+ "@vaadin/grid": "~24.8.3",
31
+ "@zip.js/zip.js": "~2.7.63",
32
32
  "luxon": "~3.6.1",
33
33
  "marked": "~16.0.0",
34
34
  "tslib": "^2.8.1"
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.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/services/System`,{query:{f:"pjson"}})).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/services/System`,{query:{f:"pjson"}})).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 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};
@@ -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 e from"../../../core/Error.js";import{pt2px as t}from"../../../core/screenUtils.js";import{millisecondsPerTimeUnit as n}from"../../../core/timeUtils.js";import r from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import{quantizePoint as i}from"../../../geometry/support/quantizationUtils.js";import{isWrappable as s,getInfo as l}from"../../../geometry/support/spatialReferenceUtils.js";import{isTimeOnlyField as a,isNumericField as u,numericTypes as f}from"../../../layers/support/fieldUtils.js";import{createValueFunction as c,evaluateDensityKernel as m}from"../../../renderers/support/heatmapUtils.js";import{isAnyDateField as p}from"../../support/utils.js";import{processNullValue as d,getNormalizedValue as h}from"../../../statistics/utils.js";import{loadArcade as y}from"../../../support/loadArcade.js";let $=null;const g=/^(?<hh>([0-1][0-9])|([2][0-3])):(?<mm>[0-5][0-9])(:(?<ss>[0-5][0-9]))?([.](?<ms>\d+))?$/;function j(e,t,n){return e.x<0?e.x+=t:e.x>n&&(e.x-=t),e}function x(e,t,n,o){const a=s(n)?l(n):null,u=a?Math.round((a.valid[1]-a.valid[0])/t.scale[0]):null;return e.map(e=>{const n=new r(e.geometry);return i(t,n,n),e.geometry=a?j(n,u??0,o[0]):n,e})}function w(e,n=18,r,o,i){const s=new Float64Array(o*i);n=Math.round(t(n));let l=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;const u=c(r);for(const{geometry:t,attributes:f}of e){const{x:e,y:r}=t,c=Math.max(0,e-n),p=Math.max(0,r-n),d=Math.min(i,r+n),h=Math.min(o,e+n),y=+u(f);for(let t=p;t<d;t++)for(let i=c;i<h;i++){const u=t*o+i,f=m(i-e,t-r,n)*y,c=s[u]+=f;l=Math.min(l,c),a=Math.max(a,c)}}return{min:l,max:a}}function I(e){const t=g.exec(e);if(!t)return null;const{hh:r,mm:o,ss:i,ms:s}=t.groups;return Number(r)*n.hours+Number(o)*n.minutes+Number(i)*n.seconds+Number(s||0)}async function b(e,t,n=!0){if(!t)return[];const{field:r,field2:i,field3:s,fieldDelimiter:l,fieldInfos:u,timeZone:f}=e,c=r&&u?.find(e=>e.name.toLowerCase()===r.toLowerCase()),m=!!c&&a(c),g=!!c&&p(c),j=e.valueExpression,x=e.normalizationType,w=e.normalizationField,b=e.normalizationTotal,F=[],N=e.viewInfoParams;let E=null,v=null;if(j){if(!$){const{arcadeUtils:e}=await y();$=e}$.hasGeometryOperations(j)&&await $.enableGeometryOperations(),E=$.createFunction(j),v=N?$.getViewInfo({viewingMode:N.viewingMode,scale:N.scale,spatialReference:new o(N.spatialReference)}):null}const U=e.fieldInfos,M=!(t[0]&&"declaredClass"in t[0]&&"esri.Graphic"===t[0].declaredClass)&&U?{fields:U}:null;return t.forEach(e=>{const t=e.attributes;let o;if(j){const t=M?{...e,layer:M}:e,n=$.createExecContext(t,v,f);o=$.executeFunction(E,n)}else t&&(o=t[r],i?(o=`${d(o)}${l}${d(t[i])}`,s&&(o=`${o}${l}${d(t[s])}`)):"string"==typeof o&&n&&(g?o=o?new Date(o).getTime():null:m&&(o=o?I(o):null)));if(x&&"number"==typeof o&&isFinite(o)){const e=t&&parseFloat(t[w]);o=h(o,x,e,b)}F.push(o)}),F}function F(e){const t=e.field,n=e.normalizationType,r=e.normalizationField;let o;return"field"===n?o="(NOT "+r+" = 0)":"log"!==n&&"natural-log"!==n&&"square-root"!==n||(o=`(${t} > 0)`),o}function N(e,t,n){const r=null!=t?e+" >= "+t:"",o=null!=n?e+" <= "+n:"";let i="";return i=r&&o?U(r,o):r||o,i?"("+i+")":""}function E(t,n,r,o){let i;return n?n.name!==t.objectIdField&&o.includes(n.type)||(i=new e(r,"'field' should be one of these types: "+o.join(","))):i=new e(r,"'field' is not defined in the layer schema"),i}function v(t,n,r){let o;return n?n.name!==t.objectIdField&&u(n)||(o=new e(r,"'field' should be one of these numeric types: "+f.join(","))):o=new e(r,"'field' is not defined in the layer schema"),o}function U(e,t){let n=null!=e?e:"";return null!=t&&t&&(n=n?"("+n+") AND ("+t+")":t),n}function M(t,n){if(t&&"intersects"!==t.spatialRelationship)return new e(n,"Only 'intersects' spatialRelationship is supported for featureFilter")}function T(t,n,r){const o=z({layer:t,fields:n});if(o.length)return new e(r,"Unknown fields: "+o.join(", ")+". You can only use fields defined in the layer schema");const i=R({layer:t,fields:n});return i.length?new e(r,"Unsupported fields: "+i.join(", ")+". You can only use fields that can be fetched i.e. AdapterFieldUsageInfo.supportsStatistics must be true"):void 0}function z(e){const t=e.layer;return e.fields.filter(e=>!t.getField(e))}function R(e){const t=e.layer;return e.fields.filter(e=>{const n=t.getFieldUsageInfo(e);return!n||!n.supportsStatistics})}function A(e,t,n){const r=[],o=[],i=[],s=[],l=[];e.forEach((e,t)=>{const a=e.field?"field":"expression",u=e.field||e.valueExpression;e.field?(l.push(u),o.push(`var ${a}${t} = Number($feature["${u}"]);`)):(r.push(`function getValueForExpr${t}() {\n ${u} \n}`),o.push(`var ${a}${t} = Number(getValueForExpr${t}());`)),n||i.push(`${a}${t} = IIf(${a}${t} < 0, 0, ${a}${t});`),s.push(`${a}${t}`)});const a=r.length?null:l.reduce((e,t)=>`${e} + ${t}`);let u=null;t||n?t?n||a&&(u=`(( ${a} ) >= 0)`):a&&(u=`(( ${a} ) <> 0)`):a&&(u=`(( ${a} ) > 0)`);return{valueExpression:[r.length?r.join("\n"):"",o.join("\n"),i.join("\n"),`var total = ${s.join(" + ")};`,"return total;"].filter(Boolean).join("\n\n"),sqlExpression:a,sqlWhere:u}}export{w as calculateHeatmapStats,b as getDataValues,N as getRangeExpr,F as getSQLFilterForNormalization,A as getSumOfAttributesExpr,U as mergeWhereClauses,x as quantizeFeatures,I as timeOnlyToMilliseconds,T as verifyBasicFieldValidity,E as verifyFieldType,M as verifyFilterValidity,v as verifyNumericField};
5
+ import e from"../../../core/Error.js";import{pt2px as t}from"../../../core/screenUtils.js";import{millisecondsPerTimeUnit as n}from"../../../core/timeUtils.js";import r from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import{quantizePoint as i}from"../../../geometry/support/quantizationUtils.js";import{isWrappable as s,getInfo as l}from"../../../geometry/support/spatialReferenceUtils.js";import{isTimeOnlyField as a,isNumericField as u,numericTypes as f}from"../../../layers/support/fieldUtils.js";import{createValueFunction as c,evaluateDensityKernel as m}from"../../../renderers/support/heatmapUtils.js";import{isAnyDateField as p}from"../../support/utils.js";import{processNullValue as d,getNormalizedValue as h}from"../../../statistics/utils.js";import{loadArcade as y}from"../../../support/loadArcade.js";let $=null;const g=/^(?<hh>([01][0-9])|(2[0-3])):(?<mm>[0-5][0-9])(:(?<ss>[0-5][0-9]))?(\.(?<ms>\d+))?$/;function j(e,t,n){return e.x<0?e.x+=t:e.x>n&&(e.x-=t),e}function x(e,t,n,o){const a=s(n)?l(n):null,u=a?Math.round((a.valid[1]-a.valid[0])/t.scale[0]):null;return e.map(e=>{const n=new r(e.geometry);return i(t,n,n),e.geometry=a?j(n,u??0,o[0]):n,e})}function w(e,n=18,r,o,i){const s=new Float64Array(o*i);n=Math.round(t(n));let l=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;const u=c(r);for(const{geometry:t,attributes:f}of e){const{x:e,y:r}=t,c=Math.max(0,e-n),p=Math.max(0,r-n),d=Math.min(i,r+n),h=Math.min(o,e+n),y=+u(f);for(let t=p;t<d;t++)for(let i=c;i<h;i++){const u=t*o+i,f=m(i-e,t-r,n)*y,c=s[u]+=f;l=Math.min(l,c),a=Math.max(a,c)}}return{min:l,max:a}}function I(e){const t=g.exec(e);if(!t)return null;const{hh:r,mm:o,ss:i,ms:s}=t.groups;return Number(r)*n.hours+Number(o)*n.minutes+Number(i)*n.seconds+Number(s||0)}async function b(e,t,n=!0){if(!t)return[];const{field:r,field2:i,field3:s,fieldDelimiter:l,fieldInfos:u,timeZone:f}=e,c=r&&u?.find(e=>e.name.toLowerCase()===r.toLowerCase()),m=!!c&&a(c),g=!!c&&p(c),j=e.valueExpression,x=e.normalizationType,w=e.normalizationField,b=e.normalizationTotal,F=[],N=e.viewInfoParams;let E=null,v=null;if(j){if(!$){const{arcadeUtils:e}=await y();$=e}$.hasGeometryOperations(j)&&await $.enableGeometryOperations(),E=$.createFunction(j),v=N?$.getViewInfo({viewingMode:N.viewingMode,scale:N.scale,spatialReference:new o(N.spatialReference)}):null}const U=e.fieldInfos,M=!(t[0]&&"declaredClass"in t[0]&&"esri.Graphic"===t[0].declaredClass)&&U?{fields:U}:null;return t.forEach(e=>{const t=e.attributes;let o;if(j){const t=M?{...e,layer:M}:e,n=$.createExecContext(t,v,f);o=$.executeFunction(E,n)}else t&&(o=t[r],i?(o=`${d(o)}${l}${d(t[i])}`,s&&(o=`${o}${l}${d(t[s])}`)):"string"==typeof o&&n&&(g?o=o?new Date(o).getTime():null:m&&(o=o?I(o):null)));if(x&&"number"==typeof o&&isFinite(o)){const e=t&&parseFloat(t[w]);o=h(o,x,e,b)}F.push(o)}),F}function F(e){const t=e.field,n=e.normalizationType,r=e.normalizationField;let o;return"field"===n?o="(NOT "+r+" = 0)":"log"!==n&&"natural-log"!==n&&"square-root"!==n||(o=`(${t} > 0)`),o}function N(e,t,n){const r=null!=t?e+" >= "+t:"",o=null!=n?e+" <= "+n:"";let i="";return i=r&&o?U(r,o):r||o,i?"("+i+")":""}function E(t,n,r,o){let i;return n?n.name!==t.objectIdField&&o.includes(n.type)||(i=new e(r,"'field' should be one of these types: "+o.join(","))):i=new e(r,"'field' is not defined in the layer schema"),i}function v(t,n,r){let o;return n?n.name!==t.objectIdField&&u(n)||(o=new e(r,"'field' should be one of these numeric types: "+f.join(","))):o=new e(r,"'field' is not defined in the layer schema"),o}function U(e,t){let n=null!=e?e:"";return null!=t&&t&&(n=n?"("+n+") AND ("+t+")":t),n}function M(t,n){if(t&&"intersects"!==t.spatialRelationship)return new e(n,"Only 'intersects' spatialRelationship is supported for featureFilter")}function T(t,n,r){const o=z({layer:t,fields:n});if(o.length)return new e(r,"Unknown fields: "+o.join(", ")+". You can only use fields defined in the layer schema");const i=R({layer:t,fields:n});return i.length?new e(r,"Unsupported fields: "+i.join(", ")+". You can only use fields that can be fetched i.e. AdapterFieldUsageInfo.supportsStatistics must be true"):void 0}function z(e){const t=e.layer;return e.fields.filter(e=>!t.getField(e))}function R(e){const t=e.layer;return e.fields.filter(e=>{const n=t.getFieldUsageInfo(e);return!n||!n.supportsStatistics})}function A(e,t,n){const r=[],o=[],i=[],s=[],l=[];e.forEach((e,t)=>{const a=e.field?"field":"expression",u=e.field||e.valueExpression;e.field?(l.push(u),o.push(`var ${a}${t} = Number($feature["${u}"]);`)):(r.push(`function getValueForExpr${t}() {\n ${u} \n}`),o.push(`var ${a}${t} = Number(getValueForExpr${t}());`)),n||i.push(`${a}${t} = IIf(${a}${t} < 0, 0, ${a}${t});`),s.push(`${a}${t}`)});const a=r.length?null:l.reduce((e,t)=>`${e} + ${t}`);let u=null;t||n?t?n||a&&(u=`(( ${a} ) >= 0)`):a&&(u=`(( ${a} ) <> 0)`):a&&(u=`(( ${a} ) > 0)`);return{valueExpression:[r.length?r.join("\n"):"",o.join("\n"),i.join("\n"),`var total = ${s.join(" + ")};`,"return total;"].filter(Boolean).join("\n\n"),sqlExpression:a,sqlWhere:u}}export{w as calculateHeatmapStats,b as getDataValues,N as getRangeExpr,F as getSQLFilterForNormalization,A as getSumOfAttributesExpr,U as mergeWhereClauses,x as quantizeFeatures,I as timeOnlyToMilliseconds,T as verifyBasicFieldValidity,E as verifyFieldType,M as verifyFilterValidity,v as verifyNumericField};
@@ -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
- function t(t){if(!t)return;const e=t.match(o);return e?.groups?e.groups.doubleQuoted??e.groups.singleQuoted??e.groups.dotNotation:void 0}const o=/^(\$feature\[(?:"(?<doubleQuoted>[^"]+)"|'(?<singleQuoted>[^']+)')\]|\$feature\.(?<dotNotation>[a-zA-Z_][a-zA-Z0-9_]*))$/i;function e(t){return t.match(u)?.[1]?.replace(/\\'/g,"'")??null}const u=/^hash\(\$feature\['((\\'|[^'])+)'\]\) \* 8\.381e-8$/;export{t as getFieldNameFromSimpleExpression,e as matchRandomRotationExpression};
5
+ function t(t){if(!t)return;const e=t.match(o);return e?.groups?e.groups.doubleQuoted??e.groups.singleQuoted??e.groups.dotNotation:void 0}const o=/^(\$feature\[(?:"(?<doubleQuoted>[^"]+)"|'(?<singleQuoted>[^']+)')\]|\$feature\.(?<dotNotation>[a-z_][a-z0-9_]*))$/i;function e(t){return t.match(u)?.[1]?.replace(/\\'/g,"'")??null}const u=/^hash\(\$feature\['((\\'|[^'])+)'\]\) \* 8\.381e-8$/;export{t as getFieldNameFromSimpleExpression,e as matchRandomRotationExpression};
@@ -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 e="20250707",a="bf57eca1f17e3bedba7a924fe3c96b050122d2a7";export{e as buildDate,a as commitHash};
5
+ const d="20250709",f="d8f5981a5d5d5e6a6ff2648a1c215d341987f894";export{d as buildDate,f as commitHash};
@@ -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 t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/mat2df32.js";import{multiply as r,scale as n,identity as o,translate as a,rotate as s}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{getDashArray as l}from"./gfxUtils.js";import{nextBloomId as h,nextPatternId as f,nextLinearGradientId as c}from"./svgGlobalState.js";import"../../widgets/support/widgetUtils.js";import{tsx as u}from"../../widgets/support/jsxFactory.js";const d="http://www.w3.org/2000/svg",y=has("android"),p=has("chrome")||y&&y>=4?"auto":"optimizeLegibility",g={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},m=/([A-DF-Za-df-z])|([-+]?\d*[.]?\d+(?:[eE][-+]?\d+)?)/g;let x={},w={};const k=Math.PI;function b(t,e){const i=t*(k/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function j(t){return t.map(t=>`${t.command} ${t.values.join(" ")}`).join(" ").trim()}function M(t,i,r,n,o){if(t){if("circle"===t.type)return u("circle",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",r:t.r,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-dashoffset":r.dashOffset,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("ellipse"===t.type)return u("ellipse",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("rect"===t.type)return u("rect",{fill:i,"fill-rule":"evenodd",height:t.height,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,width:t.width,x:t.x,y:t.y});if("image"===t.type)return u("image",{alt:o||"image",height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if("path"===t.type){const e="string"!=typeof t.path?j(t.path):t.path;return u("path",{d:e,fill:i,"fill-rule":"evenodd",stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width})}if("text"===t.type)return e(n),u("text",{"dominant-baseline":n.dominantBaseline,fill:i,"fill-rule":"evenodd","font-family":n.font.family,"font-size":n.font.size,"font-style":n.font.style,"font-variant":n.font.variant,"font-weight":n.font.weight,kerning:n.kerning,rotate:n.rotate,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,"text-anchor":n.align,"text-decoration":n.decoration,"text-rendering":p,x:t.x,y:t.y},t.text)}return null}function v(e){if(!e)return{fill:"none",pattern:null,linearGradient:null};if(!("type"in e))return{fill:new t(e).toString(),pattern:null,linearGradient:null};if("pattern"===e.type){const t=`patternId-${f()}`;return{fill:`url(#${t})`,pattern:{id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}},linearGradient:null}}const i=`linearGradientId-${c()}`;return{fill:`url(#${i})`,pattern:null,linearGradient:{id:i,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map(e=>({offset:e.offset,color:e.color&&new t(e.color).toString()}))}}}function S(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};return e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashoffset&&(i.dashOffset=e.dashoffset),e.style&&!e.dashArray&&(i.dashArray=l(e).join(",")||"none")),i}function $(t,i){const r={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const n=t.alignBaseline,o="baseline"===n?"auto":"top"===n?"text-top":"bottom"===n?"hanging":n;r.align=t.align,r.dominantBaseline=o,r.decoration=t.decoration,r.kerning=t.kerning?"auto":"0",r.rotate=t.rotated?"90":"0",e(i),r.font.style=i.style||"normal",r.font.variant=i.variant||"normal",r.font.weight=i.weight||"normal",r.font.size=i.size&&i.size.toString()||"10pt",r.font.family=i.family||"serif"}return r}function A(t){const{pattern:e,linearGradient:i}=t;if(e)return u("pattern",{height:e.height,id:e.id,patternUnits:"userSpaceOnUse",width:e.width,x:e.x,y:e.y},u("image",{height:e.image.height,href:e.image.href,width:e.image.width,x:e.image.x,y:e.image.y}));if(i){const t=i.stops.map((t,e)=>u("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color}));return u("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},t)}return null}function G(t,e){if(!t||0===t.length)return null;const i=[];for(const r of t){const{shape:t,fill:e,stroke:n,font:o}=r,a=v(e),s=S(n),l="text"===t.type?$(t,o):null,h=M(t,a.fill,s,l);h&&i.push(h)}return u("mask",{id:e,maskUnits:"userSpaceOnUse"},u("g",null,i))}function N(t,e,i){return a(t,o(t),[e,i])}function z(t,e,i,r,a){return n(t,o(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-a*i+a,t}function B(t,e,i,r){const n=e%360*Math.PI/180;s(t,o(t),n);const a=Math.cos(n),l=Math.sin(n),h=t[4],f=t[5];return t[4]=h*a-f*l+r*l-i*a+i,t[5]=f*a+h*l-i*l-r*a+r,t}function I(t,e){x&&"left"in x?(null!=x.left&&x.left>t&&(x.left=t),(null==x.right||x.right<t)&&(x.right=t),(null==x.top||x.top>e)&&(x.top=e),(null==x.bottom||x.bottom<e)&&(x.bottom=e)):x={left:t,bottom:e,right:t,top:e}}function U(t){const e=t.args,i=e.length;let r;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(r=0;r<i;r+=2)I(e[r],e[r+1]);w.x=e[i-2],w.y=e[i-1];break;case"H":for(r=0;r<i;++r)I(e[r],w.y);w.x=e[i-1];break;case"V":for(r=0;r<i;++r)I(w.x,e[r]);w.y=e[i-1];break;case"m":{let t=0;"x"in w||(I(w.x=e[0],w.y=e[1]),t=2);for(r=t;r<i;r+=2)I(w.x+=e[r],w.y+=e[r+1]);break}case"l":case"t":for(r=0;r<i;r+=2)I(w.x+=e[r],w.y+=e[r+1]);break;case"h":for(r=0;r<i;++r)I(w.x+=e[r],w.y);break;case"v":for(r=0;r<i;++r)I(w.x,w.y+=e[r]);break;case"c":for(r=0;r<i;r+=6)I(w.x+e[r],w.y+e[r+1]),I(w.x+e[r+2],w.y+e[r+3]),I(w.x+=e[r+4],w.y+=e[r+5]);break;case"s":case"q":for(r=0;r<i;r+=4)I(w.x+e[r],w.y+e[r+1]),I(w.x+=e[r+2],w.y+=e[r+3]);break;case"A":for(r=0;r<i;r+=7)I(e[r+5],e[r+6]);w.x=e[i-2],w.y=e[i-1];break;case"a":for(r=0;r<i;r+=7)I(w.x+=e[r+5],w.y+=e[r+6])}}function F(t,e,i){const r=g[t.toLowerCase()];let n;"number"==typeof r&&(r?e.length>=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),U(n)):(n={action:t,args:[]},i.push(n),U(n)))}function O(t){const e=("string"!=typeof t.path?j(t.path):t.path).match(m),i=[];if(x={},w={},!e)return null;let r="",n=[];const o=e.length;for(let s=0;s<o;++s){const t=e[s],o=parseFloat(t);isNaN(o)?(r&&F(r,n,i),n=[],r=t):n.push(o)}F(r,n,i);const a={x:0,y:0,width:0,height:0};return x&&"left"in x&&(a.x=x.left,a.y=x.top,a.width=x.right-x.left,a.height=x.bottom-x.top),a}function E(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=O(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function T(t){const e={x:0,y:0,width:0,height:0};let i=null,r=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),r=Math.max(r,o.x+o.width),n=Math.max(n,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,r=o.x+o.width,n=o.y+o.height);return i&&(i.width=r-i.x,i.height=n-i.y),i}function L(t,e,n,o,a,s,l,h,f){let c=(l&&s?b(s,e):e)/2,u=(l&&s?b(s,n):n)/2;if(f){const t=f[0],e=f[1];c=(l&&s?b(s,t):t)/2,u=(l&&s?b(s,e):e)/2}const d=t.width+o,y=t.height+o,p=i(),g=i();let m=!1;if(a&&0!==d&&0!==y){const t=e!==n?e/n:d/y,i=e>n?e:n;let o=1,a=1;isNaN(i)||(t>1?(o=i/d,a=i/t/y):(a=i/y,o=i*t/d)),r(g,g,z(p,o,a,c,u)),m=!0}const x=t.x+(d-o)/2,w=t.y+(y-o)/2;if(r(g,g,N(p,c-x,u-w)),!m&&(d>e||y>n)){const t=d/e>y/n,i=(t?e:n)/(t?d:y);r(g,g,z(p,i,i,x,w))}return h&&r(g,g,N(p,h[0],h[1])),s&&r(g,g,B(p,s,x,w)),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function R(t,e,i){const r=t?.effects.find(t=>"bloom"===t.type);if(!r)return null;const{strength:n,radius:o}=r,a=n>0?o:0,s=(n+a)*e,l=4*n+1;return u("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},u("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*a)*(5**(e/100)*(.4+e/100)),result:"dilate"}),u("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:s/25}),u("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:s/50}),u("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},u("feFuncR",{slope:l,type:"linear"}),u("feFuncG",{slope:l,type:"linear"}),u("feFuncB",{slope:l,type:"linear"})),u("feMerge",null,u("feMergeNode",{in:"intensityBlur"}),u("feMergeNode",{in:"intensityBrightness"}),u("feGaussianBlur",{stdDeviation:n/10})))}function V(t,i,r,n={}){const o=[],a=[],s=h(),l=R(n.effectView,i,s);let f=null;if(l){const t=n.effectView?.effects.find(t=>"bloom"===t.type),e=n.clipBloomEffect||!t.strength?0:(t.strength+t.radius/2)/3,o=i+i*e,a=r+r*e;f=[Math.max(o,10),Math.max(a,10)]}let c=i,y=r;if(n.useRotationSize)for(let e=0;e<t.length;e++){const t=n.rotations?.[e]??0;c=Math.max(b(t,i),c),y=Math.max(b(t,r),y)}for(let e=0;e<t.length;e++){const s=t[e],l=[],h=[];let d=0,p=0,g=0;for(const t of s){const{shape:e,fill:i,stroke:r,font:a,offset:s}=t;n.ignoreStrokeWidth||"text"===e.type||(d+=r?.width||0);const f=v(i),c=S(r),u="text"===e.type?$(e,a):null;o.push(A(f)),l.push(M(e,f.fill,c,u,n.ariaLabel)),h.push(E(e)),s&&(p+=s[0],g+=s[1])}const m=n.rotations?.[e]??0;n.useRotationSize&&(p+=(c-b(m,i))/2,g+=(y-b(m,r))/2);const x=L(T(h),i,r,d,n.scale??!1,m,n.useRotationSize??!1,[p,g],f);let w=null;if(n.masking){const t=`mask-${e}`,i=n.masking[e];o.push(G(i,t)),w=`url(#${t})`}a.push(w?u("g",{mask:w},u("g",{transform:x},l)):u("g",{transform:x},l))}l&&(e(f),c=f[0],y=f[1]);const p="display: block;";return u("svg",{"aria-label":n.ariaLabel,focusable:!1,height:y,role:"img",style:p,width:c,xmlns:d},l,u("defs",null,o),l?u("g",{filter:`url(#bloom${s})`},a):a)}export{T as computeBBox,v as generateFillAttributes,S as generateStrokeAttributes,$ as generateTextAttributes,E as getBoundingBox,L as getTransformMatrix,A as renderDef,V as renderSVG,M as renderShape};
5
+ import t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/mat2df32.js";import{multiply as r,scale as n,identity as o,translate as a,rotate as s}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{getDashArray as l}from"./gfxUtils.js";import{nextBloomId as h,nextPatternId as f,nextLinearGradientId as c}from"./svgGlobalState.js";import"../../widgets/support/widgetUtils.js";import{tsx as u}from"../../widgets/support/jsxFactory.js";const d="http://www.w3.org/2000/svg",y=has("android"),p=has("chrome")||y&&y>=4?"auto":"optimizeLegibility",g={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},m=/([A-DF-Za-df-z])|([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/g;let x={},w={};const k=Math.PI;function b(t,e){const i=t*(k/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function j(t){return t.map(t=>`${t.command} ${t.values.join(" ")}`).join(" ").trim()}function M(t,i,r,n,o){if(t){if("circle"===t.type)return u("circle",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",r:t.r,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-dashoffset":r.dashOffset,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("ellipse"===t.type)return u("ellipse",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("rect"===t.type)return u("rect",{fill:i,"fill-rule":"evenodd",height:t.height,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,width:t.width,x:t.x,y:t.y});if("image"===t.type)return u("image",{alt:o||"image",height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if("path"===t.type){const e="string"!=typeof t.path?j(t.path):t.path;return u("path",{d:e,fill:i,"fill-rule":"evenodd",stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width})}if("text"===t.type)return e(n),u("text",{"dominant-baseline":n.dominantBaseline,fill:i,"fill-rule":"evenodd","font-family":n.font.family,"font-size":n.font.size,"font-style":n.font.style,"font-variant":n.font.variant,"font-weight":n.font.weight,kerning:n.kerning,rotate:n.rotate,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,"text-anchor":n.align,"text-decoration":n.decoration,"text-rendering":p,x:t.x,y:t.y},t.text)}return null}function v(e){if(!e)return{fill:"none",pattern:null,linearGradient:null};if(!("type"in e))return{fill:new t(e).toString(),pattern:null,linearGradient:null};if("pattern"===e.type){const t=`patternId-${f()}`;return{fill:`url(#${t})`,pattern:{id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}},linearGradient:null}}const i=`linearGradientId-${c()}`;return{fill:`url(#${i})`,pattern:null,linearGradient:{id:i,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map(e=>({offset:e.offset,color:e.color&&new t(e.color).toString()}))}}}function S(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};return e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashoffset&&(i.dashOffset=e.dashoffset),e.style&&!e.dashArray&&(i.dashArray=l(e).join(",")||"none")),i}function $(t,i){const r={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const n=t.alignBaseline,o="baseline"===n?"auto":"top"===n?"text-top":"bottom"===n?"hanging":n;r.align=t.align,r.dominantBaseline=o,r.decoration=t.decoration,r.kerning=t.kerning?"auto":"0",r.rotate=t.rotated?"90":"0",e(i),r.font.style=i.style||"normal",r.font.variant=i.variant||"normal",r.font.weight=i.weight||"normal",r.font.size=i.size&&i.size.toString()||"10pt",r.font.family=i.family||"serif"}return r}function A(t){const{pattern:e,linearGradient:i}=t;if(e)return u("pattern",{height:e.height,id:e.id,patternUnits:"userSpaceOnUse",width:e.width,x:e.x,y:e.y},u("image",{height:e.image.height,href:e.image.href,width:e.image.width,x:e.image.x,y:e.image.y}));if(i){const t=i.stops.map((t,e)=>u("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color}));return u("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},t)}return null}function G(t,e){if(!t||0===t.length)return null;const i=[];for(const r of t){const{shape:t,fill:e,stroke:n,font:o}=r,a=v(e),s=S(n),l="text"===t.type?$(t,o):null,h=M(t,a.fill,s,l);h&&i.push(h)}return u("mask",{id:e,maskUnits:"userSpaceOnUse"},u("g",null,i))}function N(t,e,i){return a(t,o(t),[e,i])}function z(t,e,i,r,a){return n(t,o(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-a*i+a,t}function B(t,e,i,r){const n=e%360*Math.PI/180;s(t,o(t),n);const a=Math.cos(n),l=Math.sin(n),h=t[4],f=t[5];return t[4]=h*a-f*l+r*l-i*a+i,t[5]=f*a+h*l-i*l-r*a+r,t}function I(t,e){x&&"left"in x?(null!=x.left&&x.left>t&&(x.left=t),(null==x.right||x.right<t)&&(x.right=t),(null==x.top||x.top>e)&&(x.top=e),(null==x.bottom||x.bottom<e)&&(x.bottom=e)):x={left:t,bottom:e,right:t,top:e}}function U(t){const e=t.args,i=e.length;let r;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(r=0;r<i;r+=2)I(e[r],e[r+1]);w.x=e[i-2],w.y=e[i-1];break;case"H":for(r=0;r<i;++r)I(e[r],w.y);w.x=e[i-1];break;case"V":for(r=0;r<i;++r)I(w.x,e[r]);w.y=e[i-1];break;case"m":{let t=0;"x"in w||(I(w.x=e[0],w.y=e[1]),t=2);for(r=t;r<i;r+=2)I(w.x+=e[r],w.y+=e[r+1]);break}case"l":case"t":for(r=0;r<i;r+=2)I(w.x+=e[r],w.y+=e[r+1]);break;case"h":for(r=0;r<i;++r)I(w.x+=e[r],w.y);break;case"v":for(r=0;r<i;++r)I(w.x,w.y+=e[r]);break;case"c":for(r=0;r<i;r+=6)I(w.x+e[r],w.y+e[r+1]),I(w.x+e[r+2],w.y+e[r+3]),I(w.x+=e[r+4],w.y+=e[r+5]);break;case"s":case"q":for(r=0;r<i;r+=4)I(w.x+e[r],w.y+e[r+1]),I(w.x+=e[r+2],w.y+=e[r+3]);break;case"A":for(r=0;r<i;r+=7)I(e[r+5],e[r+6]);w.x=e[i-2],w.y=e[i-1];break;case"a":for(r=0;r<i;r+=7)I(w.x+=e[r+5],w.y+=e[r+6])}}function F(t,e,i){const r=g[t.toLowerCase()];let n;"number"==typeof r&&(r?e.length>=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),U(n)):(n={action:t,args:[]},i.push(n),U(n)))}function O(t){const e=("string"!=typeof t.path?j(t.path):t.path).match(m),i=[];if(x={},w={},!e)return null;let r="",n=[];const o=e.length;for(let s=0;s<o;++s){const t=e[s],o=parseFloat(t);isNaN(o)?(r&&F(r,n,i),n=[],r=t):n.push(o)}F(r,n,i);const a={x:0,y:0,width:0,height:0};return x&&"left"in x&&(a.x=x.left,a.y=x.top,a.width=x.right-x.left,a.height=x.bottom-x.top),a}function E(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=O(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function T(t){const e={x:0,y:0,width:0,height:0};let i=null,r=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),r=Math.max(r,o.x+o.width),n=Math.max(n,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,r=o.x+o.width,n=o.y+o.height);return i&&(i.width=r-i.x,i.height=n-i.y),i}function L(t,e,n,o,a,s,l,h,f){let c=(l&&s?b(s,e):e)/2,u=(l&&s?b(s,n):n)/2;if(f){const t=f[0],e=f[1];c=(l&&s?b(s,t):t)/2,u=(l&&s?b(s,e):e)/2}const d=t.width+o,y=t.height+o,p=i(),g=i();let m=!1;if(a&&0!==d&&0!==y){const t=e!==n?e/n:d/y,i=e>n?e:n;let o=1,a=1;isNaN(i)||(t>1?(o=i/d,a=i/t/y):(a=i/y,o=i*t/d)),r(g,g,z(p,o,a,c,u)),m=!0}const x=t.x+(d-o)/2,w=t.y+(y-o)/2;if(r(g,g,N(p,c-x,u-w)),!m&&(d>e||y>n)){const t=d/e>y/n,i=(t?e:n)/(t?d:y);r(g,g,z(p,i,i,x,w))}return h&&r(g,g,N(p,h[0],h[1])),s&&r(g,g,B(p,s,x,w)),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function R(t,e,i){const r=t?.effects.find(t=>"bloom"===t.type);if(!r)return null;const{strength:n,radius:o}=r,a=n>0?o:0,s=(n+a)*e,l=4*n+1;return u("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},u("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*a)*(5**(e/100)*(.4+e/100)),result:"dilate"}),u("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:s/25}),u("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:s/50}),u("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},u("feFuncR",{slope:l,type:"linear"}),u("feFuncG",{slope:l,type:"linear"}),u("feFuncB",{slope:l,type:"linear"})),u("feMerge",null,u("feMergeNode",{in:"intensityBlur"}),u("feMergeNode",{in:"intensityBrightness"}),u("feGaussianBlur",{stdDeviation:n/10})))}function V(t,i,r,n={}){const o=[],a=[],s=h(),l=R(n.effectView,i,s);let f=null;if(l){const t=n.effectView?.effects.find(t=>"bloom"===t.type),e=n.clipBloomEffect||!t.strength?0:(t.strength+t.radius/2)/3,o=i+i*e,a=r+r*e;f=[Math.max(o,10),Math.max(a,10)]}let c=i,y=r;if(n.useRotationSize)for(let e=0;e<t.length;e++){const t=n.rotations?.[e]??0;c=Math.max(b(t,i),c),y=Math.max(b(t,r),y)}for(let e=0;e<t.length;e++){const s=t[e],l=[],h=[];let d=0,p=0,g=0;for(const t of s){const{shape:e,fill:i,stroke:r,font:a,offset:s}=t;n.ignoreStrokeWidth||"text"===e.type||(d+=r?.width||0);const f=v(i),c=S(r),u="text"===e.type?$(e,a):null;o.push(A(f)),l.push(M(e,f.fill,c,u,n.ariaLabel)),h.push(E(e)),s&&(p+=s[0],g+=s[1])}const m=n.rotations?.[e]??0;n.useRotationSize&&(p+=(c-b(m,i))/2,g+=(y-b(m,r))/2);const x=L(T(h),i,r,d,n.scale??!1,m,n.useRotationSize??!1,[p,g],f);let w=null;if(n.masking){const t=`mask-${e}`,i=n.masking[e];o.push(G(i,t)),w=`url(#${t})`}a.push(w?u("g",{mask:w},u("g",{transform:x},l)):u("g",{transform:x},l))}l&&(e(f),c=f[0],y=f[1]);const p="display: block;";return u("svg",{"aria-label":n.ariaLabel,focusable:!1,height:y,role:"img",style:p,width:c,xmlns:d},l,u("defs",null,o),l?u("g",{filter:`url(#bloom${s})`},a):a)}export{T as computeBBox,v as generateFillAttributes,S as generateStrokeAttributes,$ as generateTextAttributes,E as getBoundingBox,L as getTransformMatrix,A as renderDef,V as renderSVG,M as renderShape};
@@ -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 e from"../../../../Graphic.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import s from"../../../../core/pbf.js";import{PooledRBush as r}from"../../../../core/libs/rbush/PooledRBush.js";import{tilePixelSize as i,tileCoordSize as o,tilePixelRatio as l}from"./constants.js";import n from"./Feature.js";import{getTileMargins as a}from"./GeometryUtils.js";import y from"./SourceLayerData.js";import{IndexItem as c}from"./style/StyleLayer.js";const u=(e,t)=>{const s=e.vtlSymbol.sourceTile,r=t.vtlSymbol.sourceTile;return s.level!==r.level?s.level-r.level:s.row!==r.row?s.row-r.row:s.col!==r.col?s.col-r.col:e.styleLayerUID-t.styleLayerUID};class h{constructor(e,t,s,r,i){this.tileKey=e,this._tileLayerData=t,this._styleRepository=s,this._tileHandler=r,this._parentLayer=i,this._index=null,this._tileKeyToPBF=new Map}static create(e,t,s,r,i){return new h(e,t,s,r,i)}clear(){this._index?.clear(),this._tileKeyToPBF.clear()}async queryAttributes(e,t,s,i,o){if(0===this._tileLayerData.size||!this._styleRepository||!this._tileHandler)return[];null===this._index&&(this._index=new r(100,d),await this._indexLayers());const l=[];return this._queryIndex(l,e,t,s,this.tileKey.level,i),o&&o?.length>0&&await this._getSymbolsAttributes(l,o),l}async _indexLayers(){const e=this.tileKey,t=this._styleRepository.layers,s=await this._getTilePayload(e);for(const[r,i]of this._tileLayerData){const o=t[r],l=s.find(e=>e.sourceName===o.source);if(!l)continue;const{protobuff:n,key:a}=l;if(3!==i.type){const t=1<<e.level-a.level,s=e.row-a.row*t,r=e.col-a.col*t;this._indexLayer(o,n,e.level,t,s,r)}}}_indexLayer(e,t,r,l,u,h){const d=e.sourceLayer,m=e.getFeatureFilter(),f=r,_=r+1,p=a(f),g=new s(new Uint8Array(t),new DataView(t));for(;g.next();)switch(g.tag()){case 3:{const t=g.getMessage(),s=new y(t);if(t.release(),s.name!==d)continue;const a=s.getData(),w=s.extent/l,b=w*h-p,x=w*u-p,L=b+w+2*p,v=x+w+2*p,I=w/i,D=o/w,T=w*h,P=w*u;for(;a.nextTag(2);){const t=a.getMessage(),i=new n(t,s);if(t.release(),m&&!m.filter(i,r))continue;const o=i.values||{},l=o._minzoom,y=o._maxzoom;if(l&&l>=10*_||y&&y<=10*f)continue;const u=e.getFeatureInflatedBounds(i,f,s.extent,I);null==u||u[0]>L||u[1]>v||u[2]<b||u[3]<x||(u[0]=(u[0]-T)*D,u[1]=(u[1]-P)*D,u[2]=(u[2]-T)*D,u[3]=(u[3]-P)*D,this._index.insert(new c(e,i,u,D,T,P)))}break}default:g.skip()}g.release()}async _getSymbolsAttributes(e,t){if(!t||0===t.length)return e;const s=[];if(t.sort(u),t.length>0){let e=0,{styleLayerUID:r}=t[0];for(let o=1;o<t.length;o++){const{styleLayerUID:i}=t[o];i!==r&&(s.push({from:e,to:o,styleLayerUID:r,sourceTileKey:t[o-1].vtlSymbol.sourceTile}),e=o,r=i)}const i=t.length-1;s.push({from:e,to:t.length,styleLayerUID:r,sourceTileKey:t[i].vtlSymbol.sourceTile})}const r=this._styleRepository.layers;for(const i of s){const s=await this._getTilePayload(i.sourceTileKey),o=r[i.styleLayerUID],l=!!o&&s.find(e=>e.sourceName===o.source);l&&this._addSymbolsAttributes(e,t.slice(i.from,i.to).map(e=>e.vtlSymbol.featureIndex),i.styleLayerUID,l)}return e}_addSymbolsAttributes(t,s,r,i){const o=this._styleRepository.layers,l=i.key,n=this.tileKey,a=1<<n.level-l.level,y=n.row-l.row*a,c=n.col-l.col*a;this._getSymbolAttributes(i.protobuff,s,r,a,y,c).forEach(s=>{const{attributes:i,tilePoint:l}=s;t.push({layerId:o[r].id,layerIndex:r,graphic:new e({attributes:i,origin:{type:"vector-tile",layerId:o[r].id,layerIndex:r,layer:this._parentLayer}}),tilePoint:l})})}_getSymbolAttributes(e,t,r,i,l,a){const c=[],u=this._styleRepository.layers;let h=0;t.sort((e,t)=>e-t);const d=new s(new Uint8Array(e),new DataView(e));for(;d.next();)switch(d.tag()){case 3:{const e=d.getMessage(),s=new y(e);if(e.release(),s.name!==u[r].sourceLayer)continue;const m=s.getData(),f=s.extent/i,_=o/f,p=f*a,g=f*l;let w=0;for(;m.nextTag(2);){const e=m.getMessage();if(w++===t[h]){const t=new n(e,s),r=t.values,i=t.getGeometry(),o=null!=i?[_*(i[0][0].x-p),_*(i[0][0].y-g)]:null;c.push({attributes:r,tilePoint:o}),h++}if(e.release(),h===t.length)return c}break}default:d.skip()}return d.release(),c}_queryIndex(t,s,r,i,o,n){const a=l*i*(window.devicePixelRatio||1);return this._index?.search({minX:s-a,minY:r-a,maxX:s+a,maxY:r+a},l=>{const{layer:a,feature:y}=l;a.isIntersectingFeature(s,r,i,y,o,n,l)&&t.push({layerId:a.id,layerIndex:a.uid,tilePoint:null,graphic:new e({attributes:y.values,origin:{type:"vector-tile",layerId:l.layer.id,layerIndex:l.layer.uid,layer:this._parentLayer}})})}),t}async _getTilePayload(e){return t(this._tileKeyToPBF,e.id,()=>this._tileHandler.fetchTilePBFs(e)).then(e=>e)}}const d=e=>({minX:e.bounds[0],minY:e.bounds[1],maxX:e.bounds[2],maxY:e.bounds[3]});export{h as default};
5
+ import e from"../../../../Graphic.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import s from"../../../../core/pbf.js";import{PooledRBush as r}from"../../../../core/libs/rbush/PooledRBush.js";import i from"../../../../graphic/VectorTileGraphicOrigin.js";import{tilePixelSize as o,tileCoordSize as l,tilePixelRatio as n}from"./constants.js";import a from"./Feature.js";import{getTileMargins as y}from"./GeometryUtils.js";import c from"./SourceLayerData.js";import{IndexItem as u}from"./style/StyleLayer.js";const h=(e,t)=>{const s=e.vtlSymbol.sourceTile,r=t.vtlSymbol.sourceTile;return s.level!==r.level?s.level-r.level:s.row!==r.row?s.row-r.row:s.col!==r.col?s.col-r.col:e.styleLayerUID-t.styleLayerUID};class m{constructor(e,t,s,r,i){this.tileKey=e,this._tileLayerData=t,this._styleRepository=s,this._tileHandler=r,this._parentLayer=i,this._index=null,this._tileKeyToPBF=new Map}static create(e,t,s,r,i){return new m(e,t,s,r,i)}clear(){this._index?.clear(),this._tileKeyToPBF.clear()}async queryAttributes(e,t,s,i,o){if(0===this._tileLayerData.size||!this._styleRepository||!this._tileHandler)return[];null===this._index&&(this._index=new r(100,f),await this._indexLayers());const l=[];return this._queryIndex(l,e,t,s,this.tileKey.level,i),o&&o?.length>0&&await this._getSymbolsAttributes(l,o),l}async _indexLayers(){const e=this.tileKey,t=this._styleRepository.layers,s=await this._getTilePayload(e);for(const[r,i]of this._tileLayerData){const o=t[r],l=s.find(e=>e.sourceName===o.source);if(!l)continue;const{protobuff:n,key:a}=l;if(3!==i.type){const t=1<<e.level-a.level,s=e.row-a.row*t,r=e.col-a.col*t;this._indexLayer(o,n,e.level,t,s,r)}}}_indexLayer(e,t,r,i,n,h){const m=e.sourceLayer,f=e.getFeatureFilter(),d=r,_=r+1,p=y(d),g=new s(new Uint8Array(t),new DataView(t));for(;g.next();)switch(g.tag()){case 3:{const t=g.getMessage(),s=new c(t);if(t.release(),s.name!==m)continue;const y=s.getData(),w=s.extent/i,b=w*h-p,x=w*n-p,L=b+w+2*p,v=x+w+2*p,I=w/o,T=l/w,D=w*h,P=w*n;for(;y.nextTag(2);){const t=y.getMessage(),i=new a(t,s);if(t.release(),f&&!f.filter(i,r))continue;const o=i.values||{},l=o._minzoom,n=o._maxzoom;if(l&&l>=10*_||n&&n<=10*d)continue;const c=e.getFeatureInflatedBounds(i,d,s.extent,I);null==c||c[0]>L||c[1]>v||c[2]<b||c[3]<x||(c[0]=(c[0]-D)*T,c[1]=(c[1]-P)*T,c[2]=(c[2]-D)*T,c[3]=(c[3]-P)*T,this._index.insert(new u(e,i,c,T,D,P)))}break}default:g.skip()}g.release()}async _getSymbolsAttributes(e,t){if(!t||0===t.length)return e;const s=[];if(t.sort(h),t.length>0){let e=0,{styleLayerUID:r}=t[0];for(let o=1;o<t.length;o++){const{styleLayerUID:i}=t[o];i!==r&&(s.push({from:e,to:o,styleLayerUID:r,sourceTileKey:t[o-1].vtlSymbol.sourceTile}),e=o,r=i)}const i=t.length-1;s.push({from:e,to:t.length,styleLayerUID:r,sourceTileKey:t[i].vtlSymbol.sourceTile})}const r=this._styleRepository.layers;for(const i of s){const s=await this._getTilePayload(i.sourceTileKey),o=r[i.styleLayerUID],l=!!o&&s.find(e=>e.sourceName===o.source);l&&this._addSymbolsAttributes(e,t.slice(i.from,i.to).map(e=>e.vtlSymbol.featureIndex),i.styleLayerUID,l)}return e}_addSymbolsAttributes(t,s,r,o){const l=this._styleRepository.layers,n=o.key,a=this.tileKey,y=1<<a.level-n.level,c=a.row-n.row*y,u=a.col-n.col*y;this._getSymbolAttributes(o.protobuff,s,r,y,c,u).forEach(s=>{const{attributes:o,tilePoint:n}=s;t.push({layerId:l[r].id,layerIndex:r,graphic:new e({attributes:o,origin:new i(this._parentLayer,l[r].id,r)}),tilePoint:n})})}_getSymbolAttributes(e,t,r,i,o,n){const y=[],u=this._styleRepository.layers;let h=0;t.sort((e,t)=>e-t);const m=new s(new Uint8Array(e),new DataView(e));for(;m.next();)switch(m.tag()){case 3:{const e=m.getMessage(),s=new c(e);if(e.release(),s.name!==u[r].sourceLayer)continue;const f=s.getData(),d=s.extent/i,_=l/d,p=d*n,g=d*o;let w=0;for(;f.nextTag(2);){const e=f.getMessage();if(w++===t[h]){const t=new a(e,s),r=t.values,i=t.getGeometry(),o=null!=i?[_*(i[0][0].x-p),_*(i[0][0].y-g)]:null;y.push({attributes:r,tilePoint:o}),h++}if(e.release(),h===t.length)return y}break}default:m.skip()}return m.release(),y}_queryIndex(t,s,r,o,l,a){const y=n*o*(window.devicePixelRatio||1);return this._index?.search({minX:s-y,minY:r-y,maxX:s+y,maxY:r+y},n=>{const{layer:y,feature:c}=n;y.isIntersectingFeature(s,r,o,c,l,a,n)&&t.push({layerId:y.id,layerIndex:y.uid,tilePoint:null,graphic:new e({attributes:c.values,origin:new i(this._parentLayer,n.layer.id,n.layer.uid)})})}),t}async _getTilePayload(e){return t(this._tileKeyToPBF,e.id,()=>this._tileHandler.fetchTilePBFs(e)).then(e=>e)}}const f=e=>({minX:e.bounds[0],minY:e.bounds[1],maxX:e.bounds[2],maxY:e.bounds[3]});export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{List as t}from"./cpuMapped/FreeList.js";import{isHittest as e}from"./shaderGraph/techniques/featureTechniqueUtils.js";import{PrimitiveType as n,DataType as i}from"../../../webgl/enums.js";function a(t,e){return t<<16|255&e}function s(t){return 255&t}class r{constructor(t,e,n,i,a){this.instance=t,this.materialKey=e,this.target=n,this.start=i,this.count=a}get textureKey(){return s(this.materialKey)}get indexEnd(){return this.start+this.count}extend(t){this.count+=t}render(t){this.instance.techniqueRef.render(t,this)}getStencilReference(){return this.target.stencilRef}getAttributePrecisionPackFactors(){const t=this.instance.instanceId;return this.target.getMesh(t).getAttributePrecisionPackFactors()}draw(t,n){e(t)?this.drawCompute(t.context,n):this.drawGeometry(t.context,n)}drawCompute(t,e){const a=this.instance.instanceId,s=this.target.getMesh(a).getComputeVAO(t,e),r=this.start*Uint32Array.BYTES_PER_ELEMENT/3;t.bindVAO(s),t.drawElements(n.POINTS,this.count/3,i.UNSIGNED_INT,r),t.bindVAO(null)}drawGeometry(t,e){const a=this.instance.instanceId,s=this.target.getMesh(a).getGeometryVAO(t,e),r=this.start*Uint32Array.BYTES_PER_ELEMENT;t.bindVAO(s),t.drawElements(n.TRIANGLES,this.count,i.UNSIGNED_INT,r),t.bindVAO(null)}}class d{constructor(){this._length=0,this._minOrderedLength=0,this._materialKeys=new Set}static fromDisplayEntities(t,e,n,i){const s=new d;for(const r of t.values())for(const t of r.records){const r=n.getInstance(t.instanceId),d=a(r.instanceId,t.textureKey);s.addRecord(r,d,t.indexStart,t.indexCount,t.vertexStart,t.vertexCount,e,i)}return s}get length(){return this._length}get minOrderedLength(){return this._minOrderedLength}get minUnorderedLength(){return this._materialKeys.size}render(t,e){const{drawPhase:n}=t;for(const i of this.infos()){const a=i.instance.techniqueRef;a.drawPhase&n&&(null==e||a.type===e)&&i.render(t)}}addRecord(e,n,i,a,s,d,h,l){let o=i,c=a;if(c||(o=s,c=d),!c)return;if(null==this._head){const i=new r(e,n,h,o,c);return this._head=new t(i),this._tail=this._head,this._length++,void this._minOrderedLength++}if(1===l)return this._insert(e,n,h,o,c,this._tail,null);let u=null,_=this._head;const g=e.instanceId,m=e.techniqueRef.symbologyPlane;if(2===l&&(2===m||3===m))return this._insert(e,n,h,o,c,this._tail,null);for(;_;){const t=_.data.instance,i=t.instanceId,a=t.techniqueRef.symbologyPlane,s=u?.data.instance.instanceId;if(m<a||g===s&&g!==i)return this._insert(e,n,h,o,c,u,_);u=_,_=_.next}this._insert(e,n,h,o,c,u,null)}*infos(){if(null!=this._head)for(const t of this._head.values())yield t}_insert(e,n,i,a,s,d,h){if(null==d&&null==h){const d=new r(e,n,i,a,s);return this._head=new t(d),this._tail=this._head,this._length++,void this._minOrderedLength++}return n!==this._tail.data.materialKey&&this._minOrderedLength++,this._materialKeys.add(n),null==d&&null!=h?this._insertAtHead(e,n,i,a,s,h):null!=d&&null==h?this._insertAtEnd(e,n,i,a,s,d):null!=d&&null!=h?this._insertAtMiddle(e,n,i,a,s,d,h):void 0}_insertAtHead(e,n,i,a,s,d){const h=a+s;if(n===d.data.materialKey&&i===d.data.target&&h===d.data.start)d.data.start=a,d.data.count+=s;else{const h=new r(e,n,i,a,s);this._head=new t(h),this._head.next=d,this._length++}}_insertAtEnd(e,n,i,a,s,d){if(d.data.materialKey===n&&d.data.indexEnd===a)d.data.count+=s;else{const h=new r(e,n,i,a,s);this._tail=new t(h),d.next=this._tail,this._length++}}_insertAtMiddle(e,n,i,a,s,d,h){const l=a+s;if(d.data.materialKey===n&&d.data.target===i&&d.data.indexEnd===a)d.data.count+=s,d.data.materialKey===h.data.materialKey&&d.data.target===h.data.target&&d.data.indexEnd===h.data.start&&(d.data.count+=h.data.count,d.next=h.next,this._length--);else if(n===h.data.materialKey&&i===h.data.target&&l===h.data.start)h.data.start=a,h.data.count+=s;else{const l=new r(e,n,i,a,s),o=new t(l);d.next=o,o.next=h,this._length++}}}export{d as DisplayList,r as DisplayListInfo};
5
+ import"../../../../core/has.js";import{List as t}from"./cpuMapped/FreeList.js";import{isHittest as e}from"./shaderGraph/techniques/featureTechniqueUtils.js";import{PrimitiveType as n,DataType as i}from"../../../webgl/enums.js";function a(t,e){return t<<16|255&e}function s(t){return 255&t}class r{constructor(t,e,n,i,a){this.instance=t,this.materialKey=e,this.target=n,this.start=i,this.count=a}get textureKey(){return s(this.materialKey)}get indexEnd(){return this.start+this.count}extend(t){this.count+=t}render(t){this.instance.techniqueRef.render(t,this)}get key(){return this.target.key}getStencilReference(){return this.target.stencilRef}getAttributePrecisionPackFactors(){const t=this.instance.instanceId;return this.target.getMesh(t).getAttributePrecisionPackFactors()}draw(t,n){e(t)?this.drawCompute(t.context,n):this.drawGeometry(t.context,n)}drawCompute(t,e){const a=this.instance.instanceId,s=this.target.getMesh(a).getComputeVAO(t,e),r=this.start*Uint32Array.BYTES_PER_ELEMENT/3;t.bindVAO(s),t.drawElements(n.POINTS,this.count/3,i.UNSIGNED_INT,r),t.bindVAO(null)}drawGeometry(t,e){const a=this.instance.instanceId,s=this.target.getMesh(a).getGeometryVAO(t,e),r=this.start*Uint32Array.BYTES_PER_ELEMENT;t.bindVAO(s),t.drawElements(n.TRIANGLES,this.count,i.UNSIGNED_INT,r),t.bindVAO(null)}}class d{constructor(){this._length=0,this._minOrderedLength=0,this._materialKeys=new Set}static fromDisplayEntities(t,e,n,i){const s=new d;for(const r of t.values())for(const t of r.records){const r=n.getInstance(t.instanceId),d=a(r.instanceId,t.textureKey);s.addRecord(r,d,t.indexStart,t.indexCount,t.vertexStart,t.vertexCount,e,i)}return s}get length(){return this._length}get minOrderedLength(){return this._minOrderedLength}get minUnorderedLength(){return this._materialKeys.size}render(t,e){const{drawPhase:n}=t;for(const i of this.infos()){const a=i.instance.techniqueRef;a.drawPhase&n&&(null==e||a.type===e)&&i.render(t)}}addRecord(e,n,i,a,s,d,h,l){let o=i,c=a;if(c||(o=s,c=d),!c)return;if(null==this._head){const i=new r(e,n,h,o,c);return this._head=new t(i),this._tail=this._head,this._length++,void this._minOrderedLength++}if(1===l)return this._insert(e,n,h,o,c,this._tail,null);let u=null,_=this._head;const g=e.instanceId,m=e.techniqueRef.symbologyPlane;if(2===l&&(2===m||3===m))return this._insert(e,n,h,o,c,this._tail,null);for(;_;){const t=_.data.instance,i=t.instanceId,a=t.techniqueRef.symbologyPlane,s=u?.data.instance.instanceId;if(m<a||g===s&&g!==i)return this._insert(e,n,h,o,c,u,_);u=_,_=_.next}this._insert(e,n,h,o,c,u,null)}*infos(){if(null!=this._head)for(const t of this._head.values())yield t}_insert(e,n,i,a,s,d,h){if(null==d&&null==h){const d=new r(e,n,i,a,s);return this._head=new t(d),this._tail=this._head,this._length++,void this._minOrderedLength++}return n!==this._tail.data.materialKey&&this._minOrderedLength++,this._materialKeys.add(n),null==d&&null!=h?this._insertAtHead(e,n,i,a,s,h):null!=d&&null==h?this._insertAtEnd(e,n,i,a,s,d):null!=d&&null!=h?this._insertAtMiddle(e,n,i,a,s,d,h):void 0}_insertAtHead(e,n,i,a,s,d){const h=a+s;if(n===d.data.materialKey&&i===d.data.target&&h===d.data.start)d.data.start=a,d.data.count+=s;else{const h=new r(e,n,i,a,s);this._head=new t(h),this._head.next=d,this._length++}}_insertAtEnd(e,n,i,a,s,d){if(d.data.materialKey===n&&d.data.indexEnd===a)d.data.count+=s;else{const h=new r(e,n,i,a,s);this._tail=new t(h),d.next=this._tail,this._length++}}_insertAtMiddle(e,n,i,a,s,d,h){const l=a+s;if(d.data.materialKey===n&&d.data.target===i&&d.data.indexEnd===a)d.data.count+=s,d.data.materialKey===h.data.materialKey&&d.data.target===h.data.target&&d.data.indexEnd===h.data.start&&(d.data.count+=h.data.count,d.next=h.next,this._length--);else if(n===h.data.materialKey&&i===h.data.target&&l===h.data.start)h.data.start=a,h.data.count+=s;else{const l=new r(e,n,i,a,s),o=new t(l);d.next=o,o.next=h,this._length++}}}export{d as DisplayList,r as DisplayListInfo};
@@ -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"../../../../core/has.js";import{disposeMaybe as e,destroyMaybe as t}from"../../../../core/maybe.js";import{brushes as s}from"../brushes.js";import r from"../vectorTiles/shaders/VTLMaterialManager.js";import{BitBlitRenderer as i}from"./BitBlitRenderer.js";import{backbufferStencilVisible as n}from"./definitions.js";import a from"./MaterialManager.js";import o from"./TextureManager.js";import{TextureUploadManager as l}from"./TextureUploadManager.js";import{WorldExtentRenderer as h}from"./WorldExtentClipRenderer.js";import{BlendEffect as f}from"./effects/BlendEffect.js";import{FeatureEffect as c}from"./effects/FeatureEffect.js";import d from"./effects/HighlightEffect.js";import{HittestEffect as u}from"./effects/HittestEffect.js";import{EffectManager as p}from"./effects/post-processing/EffectManager.js";import{SimpleMesh as b}from"./meshing/SimpleMesh.js";import m from"./painter/RenderPass.js";import{TechniqueProgramCache as _}from"./shaderGraph/techniques/TechniqueProgramCache.js";import{SizedDepthStencilFormat as g}from"../../../webgl/enums.js";import{FramebufferObject as S}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as M}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as E}from"../../../webgl/TextureDescriptor.js";class P{constructor(e,t){this.context=e,this._currentPipelineStateNeedsUpdate=!1,this._blitRenderer=new i,this._worldExtentRenderer=new h,this._brushCache=new Map,this._lastWidth=null,this._lastHeight=null,this._vtlMaterialManager=new r,this._blendEffect=new f,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new d,hittest:new u,insideEffect:new c("inside"),outsideEffect:new c("outside")},this._programCache=new _,this._shaderState={shader:null,uniforms:null,defines:null,optionalAttributes:null,useComputeBuffer:!1},this.materialManager=new a(e),this.textureManager=new o(t),this.textureUploadManager=new l(t),this._effectsManager=new p,this._quadMesh=b.fromVertexStream(e,[0,0,1,0,0,1,1,1])}dispose(){if(this._programCache.destroy(),this.materialManager.dispose(),this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitRenderer=e(this._blitRenderer),this._worldExtentRenderer=e(this._worldExtentRenderer),this._quadMesh=t(this._quadMesh),this._brushCache&&(this._brushCache.forEach(e=>e.dispose()),this._brushCache.clear(),this._brushCache=null),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._vtlMaterialManager=e(this._vtlMaterialManager)}clearShaderCache(){this._programCache.destroy(),this._programCache=new _}get blitRenderer(){return this._blitRenderer}get vectorTilesMaterialManager(){return this._vtlMaterialManager}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let s;if(this._fboPool.length>0)s=this._fboPool.pop();else{const r=new E(e,t);r.samplingMode=9728,r.wrapMode=33071,s=new S(this.context,r,this._stencilBuf)}return s.width===e&&s.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,s){const{context:r}=e;this._worldExtentRenderer.render(e,t,s);const{width:i,height:n}=r.getViewport();if(this.updateFBOs(i,n),this._prevFBO=r.getBoundFramebufferObject(),r.bindFramebuffer(this.getFbos().output),r.setColorMask(!0,!0,!0,!0),null!=t){const{r:e,g:s,b:i,a:n}=t;r.setClearColor(n*e/255,n*s/255,n*i/255,n)}else r.setClearColor(0,0,0,0);r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),t.setStencilFunction(514,n,255),t.setStencilTestEnabled(!0),t.setDepthTestEnabled(!1),this.blitTexture(t,this.getFbos().output.colorTexture,9728)}beforeRenderLayer(e,t,s){const{context:r,blendMode:i,effects:n,drawPhase:a,requireFBO:o}=e;if(r.setClearColor(0,0,0,0),o||C(a,i,n,s)){const e=r.getBoundFramebufferObject();this._prevBeforeLayerFBOStack.push(e);const{width:t,height:s}=r.getViewport(),i=this.acquireFbo(t,s);r.bindFramebuffer(i),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setClearStencil(t),r.setStencilWriteMask(255),r.clear(1024)}afterRenderLayer(e,t){const{context:s,blendMode:r,effects:i,requireFBO:n,drawPhase:a}=e;if(n||C(a,r,i,t)){const n=s.getBoundFramebufferObject();null!=i&&i.length>0&&1===a&&(s.setColorMask(!0,!0,!0,!0),this._applyEffects(e,i,n)),s.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),s.setStencilTestEnabled(!1),s.setStencilWriteMask(0),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(1,771,1,771),s.setColorMask(!0,!0,!0,!0);const o=null==r||16===a||2===a?"normal":r;this._blendEffect.draw(e,n.colorTexture,9728,o,t),this.releaseFbo(n)}}renderObject(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.prepareState(e),a.draw(e,t,i)}renderObjects(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.drawMany(e,t,i)}registerRenderPass(e){const t=e.brushes.map(e=>(this._brushCache.has(e)||this._brushCache.set(e,new e),this._brushCache.get(e)));return new m(t,e)}blitTexture(e,t,s,r=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(1,771,1,771),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,s,r),this._currentPipelineStateNeedsUpdate=!0}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const s=new E(e,t);s.samplingMode=9728,s.wrapMode=33071;const r=new M(g.DEPTH24_STENCIL8,e,t);this._stencilBuf=new w(this.context,r),this._fbos={output:new S(this.context,s,this._stencilBuf),effect0:new S(this.context,s,this._stencilBuf)}}}_applyEffects(e,t,s){const{context:r}=e,i=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingEffect:n,effect:a}of i)r.bindFramebuffer(s),n.draw(e,s,a);this._currentPipelineStateNeedsUpdate=!0}setShader(e){this._shaderState.shader=e.shader,this._shaderState.uniforms=e.uniforms,this._shaderState.defines=e.defines,this._shaderState.optionalAttributes=e.optionalAttributes,this._shaderState.useComputeBuffer=e.useComputeBuffer??!1}setPipelineState(e){e!==this._currentPipelineState&&(this._currentPipelineState=e,this._currentPipelineStateNeedsUpdate=!0)}submitDraw(e,t){const{shader:s,uniforms:r,defines:i,optionalAttributes:n}=this._shaderState,a=e.context,o=t.getAttributePrecisionPackFactors(),l=this._programCache.getProgram(s,o,r,i??{},n??{});return l.setUniforms(r),l.bind(a),this.updatePipelineState(a),this.setStencilRef(a,t),t.draw(e,s.locationInfo),l.cleanupTemporaryTextures(),{vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}submitDrawMesh(e,t,s,r){this.submitDrawMeshUntyped(e,t,s,r)}submitDrawMeshUntyped(e,t,s,r){this.setShader(t);const{shader:i,uniforms:n,defines:a,optionalAttributes:o}=this._shaderState,l=this._programCache.getProgram(i,{},n,a??{},o??{});if(l.setUniforms(n),l.bind(e),this.updatePipelineState(e),r)for(const h of r)s.bind(e,t.shader.locationInfo,h),s.draw(e);else for(let h=0;h<s.parts.length;h++)s.bind(e,t.shader.locationInfo,h),s.draw(e);s.unbind(e),l.cleanupTemporaryTextures()}updatePipelineState(e){this._currentPipelineStateNeedsUpdate&&(this._currentPipelineStateNeedsUpdate=!1,this._updatePipelineState(e))}_updatePipelineState(e){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{color:t,depth:s,stencil:r}=this._currentPipelineState;if(t){const{blendMode:s,write:r}=t;switch(e.setColorMask(...r),e.setBlendingEnabled(!0),e.setBlendEquation(32774),s){case"composite":e.setBlendFunctionSeparate(1,771,1,771);break;case"additive":e.setBlendFunctionSeparate(1,1,1,1);break;case"custom":{const{blendParameters:s}=t,{dstAlpha:r,dstRGB:i,srcAlpha:n,srcRGB:a}=s;e.setBlendFunctionSeparate(a,i,n,r);break}case"delete":e.setBlendEquation(32779),e.setBlendFunctionSeparate(1,771,1,771)}}else e.setColorMask(!1,!1,!1,!1);if(s){const{test:t,write:r}=s;r?(e.setDepthWriteEnabled(!0),e.setDepthRange(r.zNear,r.zFar)):e.setDepthWriteEnabled(!1),t?(e.setDepthTestEnabled(!0),e.setDepthFunction(t)):e.setDepthTestEnabled(!1)}else e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1);if(r){const{test:t,write:s}=r;if(t){const{compare:s,mask:r,op:i,ref:n}=t;e.setStencilTestEnabled(!0),"function"!=typeof n&&e.setStencilFunctionSeparate(1032,s,n,r),e.setStencilOpSeparate(1032,i.fail,i.zFail,i.zPass)}else e.setStencilTestEnabled(!1);if(s){const{mask:t}=s;e.setStencilWriteMask(t)}else e.setStencilWriteMask(0)}else e.setStencilTestEnabled(!1),e.setStencilWriteMask(0)}setStencilRef(e,t){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{stencil:s}=this._currentPipelineState;if(s){const{test:r}=s;if(r){const{compare:s,mask:i,ref:n}=r;if("function"==typeof n){const r=t.getStencilReference();if(null===r)throw new Error("InternalError: Stencil reference expected for target but not defined");e.setStencilFunctionSeparate(1032,s,r,i)}}}}}function C(e,t,s,r){return 4!==e&&2!==e&&16!==e&&(1!==r||null!=t&&"normal"!==t||null!=s&&s.length>0)}export{P as default};
5
+ import"../../../../core/has.js";import{disposeMaybe as e,destroyMaybe as t}from"../../../../core/maybe.js";import{brushes as s}from"../brushes.js";import r from"../vectorTiles/shaders/VTLMaterialManager.js";import{BitBlitRenderer as i}from"./BitBlitRenderer.js";import{backbufferStencilVisible as n}from"./definitions.js";import a from"./MaterialManager.js";import o from"./TextureManager.js";import{TextureUploadManager as l}from"./TextureUploadManager.js";import{WorldExtentRenderer as h}from"./WorldExtentClipRenderer.js";import{BlendEffect as f}from"./effects/BlendEffect.js";import{FeatureEffect as c}from"./effects/FeatureEffect.js";import d from"./effects/HighlightEffect.js";import{HittestEffect as u}from"./effects/HittestEffect.js";import{EffectManager as p}from"./effects/post-processing/EffectManager.js";import{SimpleMesh as b}from"./meshing/SimpleMesh.js";import m from"./painter/RenderPass.js";import{TechniqueProgramCache as _}from"./shaderGraph/techniques/TechniqueProgramCache.js";import{SizedDepthStencilFormat as g}from"../../../webgl/enums.js";import{FramebufferObject as S}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as M}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as E}from"../../../webgl/TextureDescriptor.js";class P{constructor(e,t){this.context=e,this._currentPipelineStateNeedsUpdate=!1,this._blitRenderer=new i,this._worldExtentRenderer=new h,this._brushCache=new Map,this._lastWidth=null,this._lastHeight=null,this._vtlMaterialManager=new r,this._blendEffect=new f,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new d,hittest:new u,insideEffect:new c("inside"),outsideEffect:new c("outside")},this._programCache=new _,this._shaderState={shader:null,uniforms:null,defines:null,optionalAttributes:null,useComputeBuffer:!1},this.materialManager=new a(e),this.textureManager=new o(t),this.textureUploadManager=new l(t),this._effectsManager=new p,this._quadMesh=b.fromVertexStream(e,[0,0,1,0,0,1,1,1])}dispose(){if(this._programCache.destroy(),this.materialManager.dispose(),this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitRenderer=e(this._blitRenderer),this._worldExtentRenderer=e(this._worldExtentRenderer),this._quadMesh=t(this._quadMesh),this._brushCache&&(this._brushCache.forEach(e=>e.dispose()),this._brushCache.clear(),this._brushCache=null),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._vtlMaterialManager=e(this._vtlMaterialManager)}clearShaderCache(){this._programCache.destroy(),this._programCache=new _}get blitRenderer(){return this._blitRenderer}get vectorTilesMaterialManager(){return this._vtlMaterialManager}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let s;if(this._fboPool.length>0)s=this._fboPool.pop();else{const r=new E(e,t);r.samplingMode=9728,r.wrapMode=33071,s=new S(this.context,r,this._stencilBuf)}return s.width===e&&s.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,s){const{context:r}=e;this._worldExtentRenderer.render(e,t,s);const{width:i,height:n}=r.getViewport();if(this.updateFBOs(i,n),this._prevFBO=r.getBoundFramebufferObject(),r.bindFramebuffer(this.getFbos().output),r.setColorMask(!0,!0,!0,!0),null!=t){const{r:e,g:s,b:i,a:n}=t;r.setClearColor(n*e/255,n*s/255,n*i/255,n)}else r.setClearColor(0,0,0,0);r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),t.setStencilFunction(514,n,255),t.setStencilTestEnabled(!0),t.setDepthTestEnabled(!1),this.blitTexture(t,this.getFbos().output.colorTexture,9728)}beforeRenderLayer(e,t,s){const{context:r,blendMode:i,effects:n,drawPhase:a,requireFBO:o}=e;if(r.setClearColor(0,0,0,0),o||C(a,i,n,s)){const e=r.getBoundFramebufferObject();this._prevBeforeLayerFBOStack.push(e);const{width:t,height:s}=r.getViewport(),i=this.acquireFbo(t,s);r.bindFramebuffer(i),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setClearStencil(t),r.setStencilWriteMask(255),r.clear(1024)}afterRenderLayer(e,t){const{context:s,blendMode:r,effects:i,requireFBO:n,drawPhase:a}=e;if(n||C(a,r,i,t)){const n=s.getBoundFramebufferObject();null!=i&&i.length>0&&1===a&&(s.setColorMask(!0,!0,!0,!0),this._applyEffects(e,i,n)),s.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),s.setStencilTestEnabled(!1),s.setStencilWriteMask(0),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(1,771,1,771),s.setColorMask(!0,!0,!0,!0);const o=null==r||16===a||2===a?"normal":r;this._blendEffect.draw(e,n.colorTexture,9728,o,t),this.releaseFbo(n)}}renderObject(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.prepareState(e),a.draw(e,t,i)}renderObjects(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.drawMany(e,t,i)}registerRenderPass(e){const t=e.brushes.map(e=>(this._brushCache.has(e)||this._brushCache.set(e,new e),this._brushCache.get(e)));return new m(t,e)}blitTexture(e,t,s,r=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(1,771,1,771),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,s,r),this._currentPipelineStateNeedsUpdate=!0}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const s=new E(e,t);s.samplingMode=9728,s.wrapMode=33071;const r=new M(g.DEPTH24_STENCIL8,e,t);this._stencilBuf=new w(this.context,r),this._fbos={output:new S(this.context,s,this._stencilBuf),effect0:new S(this.context,s,this._stencilBuf)}}}_applyEffects(e,t,s){const{context:r}=e,i=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingEffect:n,effect:a}of i)r.bindFramebuffer(s),n.draw(e,s,a);this._currentPipelineStateNeedsUpdate=!0}setShader(e){this._shaderState.shader=e.shader,this._shaderState.uniforms=e.uniforms,this._shaderState.defines=e.defines,this._shaderState.optionalAttributes=e.optionalAttributes,this._shaderState.useComputeBuffer=e.useComputeBuffer??!1}setPipelineState(e){e!==this._currentPipelineState&&(this._currentPipelineState=e,this._currentPipelineStateNeedsUpdate=!0)}submitDraw(e,t){const{shader:s,uniforms:r,defines:i,optionalAttributes:n}=this._shaderState,a=e.context,o=t.getAttributePrecisionPackFactors(),l=this._programCache.getProgram(s,o,r,i??{},n??{});return l.setUniforms(r),l.bind(a),this.updatePipelineState(a),this.setStencilRef(a,t),t.draw(e,s.locationInfo),l.cleanupTemporaryTextures(),{vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}submitDrawMesh(e,t,s,r){this.submitDrawMeshUntyped(e,t,s,r)}submitDrawMeshUntyped(e,t,s,r){this.setShader(t);const{shader:i,uniforms:n,defines:a,optionalAttributes:o}=this._shaderState,l=this._programCache.getProgram(i,{},n,a??{},o??{});if(l.setUniforms(n),l.bind(e),this.updatePipelineState(e),r)for(const h of r)s.bind(e,t.shader.locationInfo,h),s.draw(e);else for(let h=0;h<s.parts.length;h++)s.bind(e,t.shader.locationInfo,h),s.draw(e);s.unbind(e),l.cleanupTemporaryTextures()}updatePipelineState(e){this._currentPipelineStateNeedsUpdate&&(this._currentPipelineStateNeedsUpdate=!1,this._updatePipelineState(e))}_updatePipelineState(e){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{color:t,depth:s,stencil:r}=this._currentPipelineState;if(t){const{blendMode:s,write:r}=t;switch(e.setColorMask(...r),e.setBlendingEnabled(!0),e.setBlendEquation(32774),s){case"composite":e.setBlendFunctionSeparate(1,771,1,771);break;case"additive":e.setBlendFunctionSeparate(1,1,1,1);break;case"custom":{const{blendParameters:s}=t,{dstAlpha:r,dstRGB:i,srcAlpha:n,srcRGB:a}=s;e.setBlendFunctionSeparate(a,i,n,r);break}case"delete":e.setBlendEquation(32779),e.setBlendFunctionSeparate(1,771,1,771)}}else e.setColorMask(!1,!1,!1,!1);if(s){const{test:t,write:r}=s;r?(e.setDepthWriteEnabled(!0),e.setDepthRange(r.zNear,r.zFar)):e.setDepthWriteEnabled(!1),t?(e.setDepthTestEnabled(!0),e.setDepthFunction(t)):e.setDepthTestEnabled(!1)}else e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1);if(r){const{test:t,write:s}=r;if(t){const{compare:s,mask:r,op:i,ref:n}=t;e.setStencilTestEnabled(!0),"function"!=typeof n&&e.setStencilFunctionSeparate(1032,s,n,r),e.setStencilOpSeparate(1032,i.fail,i.zFail,i.zPass)}else e.setStencilTestEnabled(!1);if(s){const{mask:t}=s;e.setStencilWriteMask(t)}else e.setStencilWriteMask(0)}else e.setStencilTestEnabled(!1),e.setStencilWriteMask(0)}setStencilRef(e,t){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{stencil:s}=this._currentPipelineState;if(s){const{test:r}=s;if(r){const{compare:s,mask:i,ref:n}=r;let a=null;if("function"==typeof n?a=n(t):"number"==typeof n&&(a=n),null==a&&(a=t.getStencilReference()),null==a)throw new Error("InternalError: Stencil reference expected for target but not defined");e.setStencilFunctionSeparate(1032,s,a,i)}}}}function C(e,t,s,r){return 4!==e&&2!==e&&16!==e&&(1!==r||null!=t&&"normal"!==t||null!=s&&s.length>0)}export{P 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{tileSize as t}from"../../definitions.js";function e(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function n(t,e){return Math.sqrt(t*t+e*e)}function s(t){const e=n(t[0],t[1]);t[0]/=e,t[1]/=e}function i(t,e){return n(t[0]-e[0],t[1]-e[1])}function r(t,e){return t[e+1]}function h(t){return t.length-1}function a(t){let e=0;for(let n=0;n<h(t);n++)e+=d(t,n);return e}function d(t,e,n=1){let[s,i]=r(t,e);return[s,i]=[Math.round(s),Math.round(i)],Math.sqrt(s*s+i*i)*n}class u{constructor(t,e,n,s,i){this._segments=t,this._index=e,this._distance=n,this._xStart=s,this._yStart=i,this._done=!1}static create(t){return new u(t,0,0,t[0][0],t[0][1])}clone(){return new u(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(t){return this._index===t._index||t._index===this._index-1&&(0===this._distance||1===t._distance)||t._index===this._index+1&&(1===this._distance||0===t._distance)}leq(t){return this._index<t._index||this._index===t._index&&this._distance<=t._distance}geq(t){return this._index>t._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let n=Math.acos(e);return t>0&&(n=2*Math.PI-n),n}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<h(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(t,e){const n=this.backwardLength;if(t<=n)return this._distance=(n-t)/this.length,this;let s=this.backwardLength;for(;this.prev();){if(s+this.length>t)return this._seekBackwards(t-s);s+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let n=this.remainingLength;for(;this.next();){if(n+this.length>t)return this.seek(t-n,e);n+=this.length}return this._distance=1,e?this:null}}function c(e,n,s,i=!0){const r=a(e),h=u.create(e),d=r/2;if(!i)return h.seek(d),void(h.x<t&&h.y<t&&h.x>0&&h.y>0&&s(h.clone(),0,d+0*n,r));const c=Math.max((r-n)/2,0),o=Math.floor(c/n),_=d-o*n;h.seek(_);for(let a=-o;a<=o;a++)h.x<t&&h.y<t&&h.x>0&&h.y>0&&s(h.clone(),a,d+a*n,r),h.seek(n)}function o(t,e,n){_(n,e,a(t),u.create(t),0)}function _(t,e,n,s,i){if(n<e)return;const r=s.clone().seek(n/2);if(null==r)return;t(r.clone(),n,i),n=(n-e)/2;const h=r.seek(e/2);_(t,e,n,s,i+1),_(t,e,n,h,i+1)}function l(t,e){const n=e;for(let s=0;s<t.length;s++){let e=t[s];x(e,n);const i=[];i.push(e[0]);for(let t=1;t<e.length;t++){const[n,s]=e[t-1],[r,h]=e[t],a=r-n,d=h-s;i.push([a,d])}t[s]=i,e=i}return t}function x(t,n){const r=1e-6;if(n<=0)return;const h=t.length;if(h<3)return;const a=[];let d=0;a.push(0);for(let e=1;e<h;e++)d+=i(t[e],t[e-1]),a.push(d);n=Math.min(n,.2*d);const u=[];u.push(t[0][0]),u.push(t[0][1]);const c=t[h-1][0],o=t[h-1][1],_=e([0,0],t[0],t[1]);s(_),t[0][0]+=n*_[0],t[0][1]+=n*_[1],e(_,t[h-1],t[h-2]),s(_),t[h-1][0]+=n*_[0],t[h-1][1]+=n*_[1];for(let e=1;e<h;e++)a[e]+=n;a[h-1]+=n;const l=.5*n;for(let e=1;e<h-1;e++){let s=0,i=0,d=0;for(let h=e-1;h>=0&&!(a[h+1]<a[e]-l);h--){const u=l+a[h+1]-a[e],c=a[h+1]-a[h],o=a[e]-a[h]<l?1:u/c;if(Math.abs(o)<r)break;const _=o*o,x=o*u-.5*_*c,g=o*c/n,f=t[h+1],y=t[h][0]-f[0],k=t[h][1]-f[1];s+=g/x*(f[0]*o*u+.5*_*(u*y-c*f[0])-_*o*c*y/3),i+=g/x*(f[1]*o*u+.5*_*(u*k-c*f[1])-_*o*c*k/3),d+=g}for(let u=e+1;u<h&&!(a[u-1]>a[e]+l);u++){const h=l-a[u-1]+a[e],c=a[u]-a[u-1],o=a[u]-a[e]<l?1:h/c;if(Math.abs(o)<r)break;const _=o*o,x=o*h-.5*_*c,g=o*c/n,f=t[u-1],y=t[u][0]-f[0],k=t[u][1]-f[1];s+=g/x*(f[0]*o*h+.5*_*(h*y-c*f[0])-_*o*c*y/3),i+=g/x*(f[1]*o*h+.5*_*(h*k-c*f[1])-_*o*c*k/3),d+=g}u.push(s/d),u.push(i/d)}u.push(c),u.push(o);for(let e=0,s=0;e<h;e++)t[e][0]=u[s++],t[e][1]=u[s++]}export{u as SegmentCursor,c as pathDivide,a as pathLength,o as pathSubdivide,r as segmentAt,h as segmentCount,d as segmentLength,l as smoothPaths};
5
+ import{tileSize as t}from"../../definitions.js";function e(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function n(t,e){return Math.sqrt(t*t+e*e)}function s(t){const e=n(t[0],t[1]);t[0]/=e,t[1]/=e}function i(t,e){return n(t[0]-e[0],t[1]-e[1])}function r(t,e){return t[e+1]}function h(t){return t.length-1}function a(t){let e=0;for(let n=0;n<h(t);n++)e+=d(t,n);return e}function d(t,e,n=1){let[s,i]=r(t,e);return[s,i]=[Math.round(s),Math.round(i)],Math.sqrt(s*s+i*i)*n}class u{constructor(t,e,n,s,i){this._segments=t,this._index=e,this._distance=n,this._xStart=s,this._yStart=i,this._done=!1}static create(t){return new u(t,0,0,t[0][0],t[0][1])}clone(){return new u(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(t){return this._index===t._index||t._index===this._index-1&&(0===this._distance||1===t._distance)||t._index===this._index+1&&(1===this._distance||0===t._distance)}leq(t){return this._index<t._index||this._index===t._index&&this._distance<=t._distance}geq(t){return this._index>t._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let n=Math.acos(e);return t>0&&(n=2*Math.PI-n),n}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<h(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(t,e){const n=this.backwardLength;if(t<=n)return this._distance=(n-t)/this.length,this;let s=this.backwardLength;for(;this.prev();){if(s+this.length>t)return this._seekBackwards(t-s);s+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let n=this.remainingLength;for(;this.next();){if(n+this.length>t)return this.seek(t-n,e);n+=this.length}return this._distance=1,e?this:null}}function c(e,n,s,i=!0){const r=a(e),h=u.create(e),d=r/2;if(!i)return h.seek(d),void(h.x<t&&h.y<t&&h.x>=0&&h.y>=0&&s(h.clone(),0,d+0*n,r));const c=Math.max((r-n)/2,0),o=Math.floor(c/n),_=d-o*n;h.seek(_);for(let a=-o;a<=o;a++)h.x<t&&h.y<t&&h.x>=0&&h.y>=0&&s(h.clone(),a,d+a*n,r),h.seek(n)}function o(t,e,n){_(n,e,a(t),u.create(t),0)}function _(t,e,n,s,i){if(n<e)return;const r=s.clone().seek(n/2);if(null==r)return;t(r.clone(),n,i),n=(n-e)/2;const h=r.seek(e/2);_(t,e,n,s,i+1),_(t,e,n,h,i+1)}function l(t,e){const n=e;for(let s=0;s<t.length;s++){let e=t[s];x(e,n);const i=[];i.push(e[0]);for(let t=1;t<e.length;t++){const[n,s]=e[t-1],[r,h]=e[t],a=r-n,d=h-s;i.push([a,d])}t[s]=i,e=i}return t}function x(t,n){const r=1e-6;if(n<=0)return;const h=t.length;if(h<3)return;const a=[];let d=0;a.push(0);for(let e=1;e<h;e++)d+=i(t[e],t[e-1]),a.push(d);n=Math.min(n,.2*d);const u=[];u.push(t[0][0]),u.push(t[0][1]);const c=t[h-1][0],o=t[h-1][1],_=e([0,0],t[0],t[1]);s(_),t[0][0]+=n*_[0],t[0][1]+=n*_[1],e(_,t[h-1],t[h-2]),s(_),t[h-1][0]+=n*_[0],t[h-1][1]+=n*_[1];for(let e=1;e<h;e++)a[e]+=n;a[h-1]+=n;const l=.5*n;for(let e=1;e<h-1;e++){let s=0,i=0,d=0;for(let h=e-1;h>=0&&!(a[h+1]<a[e]-l);h--){const u=l+a[h+1]-a[e],c=a[h+1]-a[h],o=a[e]-a[h]<l?1:u/c;if(Math.abs(o)<r)break;const _=o*o,x=o*u-.5*_*c,g=o*c/n,f=t[h+1],y=t[h][0]-f[0],k=t[h][1]-f[1];s+=g/x*(f[0]*o*u+.5*_*(u*y-c*f[0])-_*o*c*y/3),i+=g/x*(f[1]*o*u+.5*_*(u*k-c*f[1])-_*o*c*k/3),d+=g}for(let u=e+1;u<h&&!(a[u-1]>a[e]+l);u++){const h=l-a[u-1]+a[e],c=a[u]-a[u-1],o=a[u]-a[e]<l?1:h/c;if(Math.abs(o)<r)break;const _=o*o,x=o*h-.5*_*c,g=o*c/n,f=t[u-1],y=t[u][0]-f[0],k=t[u][1]-f[1];s+=g/x*(f[0]*o*h+.5*_*(h*y-c*f[0])-_*o*c*y/3),i+=g/x*(f[1]*o*h+.5*_*(h*k-c*f[1])-_*o*c*k/3),d+=g}u.push(s/d),u.push(i/d)}u.push(c),u.push(o);for(let e=0,s=0;e<h;e++)t[e][0]=u[s++],t[e][1]=u[s++]}export{u as SegmentCursor,c as pathDivide,a as pathLength,o as pathSubdivide,r as segmentAt,h as segmentCount,d as segmentLength,l as smoothPaths};
@@ -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{FeatureTechnique as e}from"../FeatureTechnique.js";import{getSelectionDefines as t,getFeaturePipelineState as s,isHittest as r,getFeatureUniforms as a,resolveDynamicUniforms as i}from"../featureTechniqueUtils.js";import{TextShader as n}from"../text/TextShader.js";class o extends e{constructor(){super(...arguments),this.type=14,this.shaders={geometry:new n},this.drawPhase=14,this.symbologyPlane=3}render(e,n){const{context:o,painter:u}=e,d=t(e),m={...s(e),stencil:!1},h=n.instance.getInput(),p={shader:this.shaders.geometry,uniforms:{...i(e,n.target,h.uniforms),...a(e,n.target),mosaicInfo:u.textureManager.getMosaicInfo(o,n.textureKey)},defines:{...d,textRenderPassType:0,isBackgroundPass:!0,isLabel:!0},optionalAttributes:h.optionalAttributes,useComputeBuffer:r(e)};u.setPipelineState(m),u.setShader(p),u.submitDraw(e,n),u.setShader({...p,defines:{...d,textRenderPassType:2,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,n),u.setShader({...p,defines:{...d,textRenderPassType:0,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,n)}}export{o as LabelTechnique};
5
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{getSelectionDefines as t,getFeaturePipelineState as s,isHittest as r,getFeatureUniforms as a,resolveDynamicUniforms as i}from"../featureTechniqueUtils.js";import{TextShader as n}from"../text/TextShader.js";class o extends e{constructor(){super(...arguments),this.type=14,this.shaders={geometry:new n},this.drawPhase=14,this.symbologyPlane=3}render(e,n){const{context:o,painter:u}=e,d=t(e),m={...s(e),stencil:{write:!1,test:{ref:()=>255,compare:516,mask:255,op:{fail:7680,zFail:7680,zPass:7680}}}},p=n.instance.getInput(),c={shader:this.shaders.geometry,uniforms:{...i(e,n.target,p.uniforms),...a(e,n.target),mosaicInfo:u.textureManager.getMosaicInfo(o,n.textureKey)},defines:{...d,textRenderPassType:0,isBackgroundPass:!0,isLabel:!0},optionalAttributes:p.optionalAttributes,useComputeBuffer:r(e)};u.setPipelineState(m),u.setShader(c),u.submitDraw(e,n),u.setShader({...c,defines:{...d,textRenderPassType:2,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,n),u.setShader({...c,defines:{...d,textRenderPassType:0,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,n)}}export{o as LabelTechnique};