@arcgis/core 5.1.0-next.114 → 5.1.0-next.115

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 (294) hide show
  1. package/Map.js +1 -1
  2. package/analysis/ShadowCast/MinDurationOptions.d.ts +3 -5
  3. package/analysis/ShadowCastAnalysis.d.ts +1 -1
  4. package/arcgisGlobal.d.ts +4 -0
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/05c47ca3a266a271974b.js +1 -0
  7. package/assets/esri/core/workers/chunks/{29bbc0d6d847b065d10e.js → 062aadf426fe97a76bbb.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0954e82f739d25001bcb.js +1 -0
  9. package/assets/esri/core/workers/chunks/0aaee272520c6e5bb617.js +1 -0
  10. package/assets/esri/core/workers/chunks/{12053c1213465d07d2f6.js → 0b445c1cf281f158c1f1.js} +1 -1
  11. package/assets/esri/core/workers/chunks/102ff3710db4ba5f083d.js +1 -0
  12. package/assets/esri/core/workers/chunks/163ce1be8bfe20e77f97.js +1 -0
  13. package/assets/esri/core/workers/chunks/{e87d02af6d6b05e19d93.js → 16713986893adfbc9331.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{9bd713d96502ddc2ce25.js → 1765042635084f75d2b3.js} +1 -1
  15. package/assets/esri/core/workers/chunks/185c670eb99474906836.js +1 -0
  16. package/assets/esri/core/workers/chunks/18ebf1d3ed05c8057f7d.js +1 -0
  17. package/assets/esri/core/workers/chunks/1da2c34743897d1b6a24.js +1 -0
  18. package/assets/esri/core/workers/chunks/22d4521637806a8b828f.js +1 -0
  19. package/assets/esri/core/workers/chunks/233ff588798c8a5eedf4.js +1 -0
  20. package/assets/esri/core/workers/chunks/24d9e4f1c7b8ff0d2cce.js +1 -0
  21. package/assets/esri/core/workers/chunks/2562d8905bd05ef6fd07.js +1 -0
  22. package/assets/esri/core/workers/chunks/{e5d969214d9eda5c0b4c.js → 2a5dbed88bbd96cfac9f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/2bcd4d395bfe6a19ccc8.js +1 -0
  24. package/assets/esri/core/workers/chunks/3192586ec7fc73ed1165.js +1 -0
  25. package/assets/esri/core/workers/chunks/38ca59db0e8f45bd7811.js +1 -0
  26. package/assets/esri/core/workers/chunks/3b10a962e4ff2f3da5bc.js +1 -0
  27. package/assets/esri/core/workers/chunks/3e9709e61015993b1c7d.js +1 -0
  28. package/assets/esri/core/workers/chunks/425c04b26a6ec6d04b08.js +1 -0
  29. package/assets/esri/core/workers/chunks/4364a3e706294bb6ae41.js +1 -0
  30. package/assets/esri/core/workers/chunks/44e52fe98ffafe6a2807.js +1 -0
  31. package/assets/esri/core/workers/chunks/4cecc582513b8a83f194.js +1 -0
  32. package/assets/esri/core/workers/chunks/5022413f5a41b5d435ea.js +1 -0
  33. package/assets/esri/core/workers/chunks/{8ade869fa9bae446266a.js → 51816d79c6be15e4bfcf.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{cf9b0ba30a75c030ca92.js → 5524a71d1abc9568ce26.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{ba31616de9d73d83d867.js → 557e39e5156b313597f9.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{5ef37f37e405b3bb5450.js → 59dafa1e1340ea4043e6.js} +1 -1
  37. package/assets/esri/core/workers/chunks/624b1bb269744142b835.js +1 -0
  38. package/assets/esri/core/workers/chunks/{39987c06636e757d1f00.js → 62b5972d0ef9bf173308.js} +1 -1
  39. package/assets/esri/core/workers/chunks/641b8622fbb93c84671d.js +1 -0
  40. package/assets/esri/core/workers/chunks/643c7506f8fe8e06acd2.js +1 -0
  41. package/assets/esri/core/workers/chunks/65f02eca694cc1c9f5a7.js +1 -0
  42. package/assets/esri/core/workers/chunks/6d696beddcc5fbed5875.js +1 -0
  43. package/assets/esri/core/workers/chunks/728ad5bbbcbf88d6249f.js +1 -0
  44. package/assets/esri/core/workers/chunks/{0d2bc1be5802681666a4.js → 77859a61d059738d057f.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{03a4543b94f9adeb1852.js → 7a3b05e25de2ff150f38.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7bbffe07e62897928773.js +1 -0
  47. package/assets/esri/core/workers/chunks/{14a241b07baa67743248.js → 7c292f7b181f3b93352b.js} +1 -1
  48. package/assets/esri/core/workers/chunks/7c2d7df4ef4d775cd648.js +1 -0
  49. package/assets/esri/core/workers/chunks/{6d20d741b8ae1a45b422.js → 7dc2c21d61ba66a3f461.js} +1 -1
  50. package/assets/esri/core/workers/chunks/7df05c3c82cd27b77300.js +1 -0
  51. package/assets/esri/core/workers/chunks/7eb94fc75926bc739233.js +1 -0
  52. package/assets/esri/core/workers/chunks/8461f50e9875db4ccfec.js +1 -0
  53. package/assets/esri/core/workers/chunks/{71e12db99589c98a4357.js → 8477b5fdd99c6ac5c27b.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{be1e4c3ec53fc92a26f1.js → 8598997340682113a2a5.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{548c34ea88f113d03c93.js → 86229634bf008f53dad4.js} +1 -1
  56. package/assets/esri/core/workers/chunks/86443e47ad99e555753a.js +1 -0
  57. package/assets/esri/core/workers/chunks/87a40e7f79f97ca637a9.js +1 -0
  58. package/assets/esri/core/workers/chunks/{27d6ad4ca5ab8c9d62cd.js → 8c443c52c846a096a250.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{86161025b53b916328ff.js → 8ca88cfc0b9f84dc5832.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{340f2c996f62f7f5ceae.js → 8e7ce4835b3106349684.js} +1 -1
  61. package/assets/esri/core/workers/chunks/90b0fe5584fb6fc99766.js +1 -0
  62. package/assets/esri/core/workers/chunks/9133c1b7cc1c9da27deb.js +1 -0
  63. package/assets/esri/core/workers/chunks/{d4749eb8a47869477037.js → 9250615c78f8570a9cda.js} +1 -1
  64. package/assets/esri/core/workers/chunks/92a7735973b2f82a66ce.js +1 -0
  65. package/assets/esri/core/workers/chunks/94a5a834e32fc6cc6ed4.js +1 -0
  66. package/assets/esri/core/workers/chunks/986d8c3907aeeb18c4f6.js +1 -0
  67. package/assets/esri/core/workers/chunks/98e489c2b85feded7776.js +1 -0
  68. package/assets/esri/core/workers/chunks/{271e42b7cd3c3441839e.js → 9eab1e1535494ff2050d.js} +10 -22
  69. package/assets/esri/core/workers/chunks/{466c250537415f12eb59.js → a01f0ffbe555f690bdca.js} +1 -1
  70. package/assets/esri/core/workers/chunks/a03c4c0bf138734a002e.js +1 -0
  71. package/assets/esri/core/workers/chunks/a814069325125466506b.js +1 -0
  72. package/assets/esri/core/workers/chunks/{e4b2120d7ee1c998b1fc.js → aa03f770178693167aa0.js} +1 -1
  73. package/assets/esri/core/workers/chunks/aea439d4c2308f88b295.js +1 -0
  74. package/assets/esri/core/workers/chunks/{7995e6983456c779adf9.js → b002304a45856b024b46.js} +1 -1
  75. package/assets/esri/core/workers/chunks/b0c242c4f5412e4cce73.js +1 -0
  76. package/assets/esri/core/workers/chunks/b44f1d08784f2e50c853.js +1 -0
  77. package/assets/esri/core/workers/chunks/c1b6de0d728d25d7905a.js +1 -0
  78. package/assets/esri/core/workers/chunks/{f8b884b529064df4a30a.js → caf80facb0322be054ab.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{25d795a1697803d77e56.js → ce0e627a5e1cb78adce8.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{63378b0b4265a547656b.js → d8ec0afb2b91ccf32e55.js} +1 -1
  81. package/assets/esri/core/workers/chunks/d97c0c18202b8c578f8c.js +1 -0
  82. package/assets/esri/core/workers/chunks/{2f99a95facddc44319a9.js → da3c54e27a808f4fcc18.js} +1 -1
  83. package/assets/esri/core/workers/chunks/db012650fb34c10cecd0.js +1 -0
  84. package/assets/esri/core/workers/chunks/dc6d50e1097a920ff820.js +1 -0
  85. package/assets/esri/core/workers/chunks/dce37324a2382d2eef0d.js +1 -0
  86. package/assets/esri/core/workers/chunks/e0bd550b10dd402c48f1.js +1 -0
  87. package/assets/esri/core/workers/chunks/e2ba57f7119b7182ba02.js +279 -0
  88. package/assets/esri/core/workers/chunks/e755477dc78e9d6038d4.js +1 -0
  89. package/assets/esri/core/workers/chunks/ea4057090cf15d602585.js +1 -0
  90. package/assets/esri/core/workers/chunks/ea8f642b1db933d2c26f.js +1 -0
  91. package/assets/esri/core/workers/chunks/eabd4a78221b7e733793.js +1 -0
  92. package/assets/esri/core/workers/chunks/eb16976b4eb7f1300f4a.js +1 -0
  93. package/assets/esri/core/workers/chunks/efae58f746b108163a50.js +1 -0
  94. package/assets/esri/core/workers/chunks/f231548c8ac7ecb59927.js +1 -0
  95. package/assets/esri/core/workers/chunks/fe2325efd0d8ad8369ed.js +1 -0
  96. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +26 -3
  97. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +4 -13
  98. package/assets/esri/themes/dark/main.css +1 -1
  99. package/assets/esri/themes/light/main.css +1 -1
  100. package/assets/esri/themes/light/view.css +1 -1
  101. package/chunks/GlobalIllumination.glsl.js +22 -34
  102. package/config.js +1 -1
  103. package/core/screenUtils.js +1 -1
  104. package/core/typedArrayUtil.js +1 -1
  105. package/editing/templates/TemplateListing.d.ts +32 -0
  106. package/editing/templates/TemplateListing.js +2 -0
  107. package/geometry/support/buffer/BufferView.js +1 -1
  108. package/geometry/support/heightModelInfoUtils.js +1 -1
  109. package/interfaces.d.ts +14 -0
  110. package/kernel.js +1 -1
  111. package/layers/AnnotationLayer.d.ts +42 -0
  112. package/layers/AnnotationLayer.js +2 -0
  113. package/layers/DimensionFeatureLayer.d.ts +36 -1
  114. package/layers/DimensionFeatureLayer.js +1 -1
  115. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  116. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  117. package/layers/types.d.ts +1 -1
  118. package/networks/support/networkFieldUtils.js +1 -1
  119. package/package.json +1 -1
  120. package/rest/support/OutDistance.js +1 -1
  121. package/rest/support/Query.js +1 -1
  122. package/support/basemapEnsureType.js +1 -1
  123. package/support/revision.js +1 -1
  124. package/symbols/cim/CIMOperators.js +1 -1
  125. package/symbols/cim/CIMSymbolHelper.js +1 -1
  126. package/symbols/cim/utils.js +1 -1
  127. package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
  128. package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
  129. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  130. package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
  132. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  133. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  134. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js +1 -1
  136. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  138. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  139. package/views/2d/engine/webgl/util/AnnotationMatcher.js +2 -0
  140. package/views/2d/engine/webgl/util/DimensionMatcher.js +2 -0
  141. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  142. package/views/2d/engine/webgl/util/createMatcher.js +1 -1
  143. package/views/2d/layerViewModuleImportUtils.js +1 -1
  144. package/views/2d/layers/AnnotationLayerView2D.js +2 -0
  145. package/views/2d/layers/{DimensionLayerView2D.js → DimensionFeatureLayerView2D.js} +1 -1
  146. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  147. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  148. package/views/2d/layers/RouteLayerView2D.js +1 -1
  149. package/views/2d/layers/TileLayerView2D.js +1 -1
  150. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  151. package/views/2d/layers/features/FeatureContainer.js +1 -1
  152. package/views/2d/layers/features/Processor.js +1 -1
  153. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +2 -0
  154. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  155. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  156. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  157. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  158. package/views/2d/layers/features/support/FeatureSetReaderAnnotationJSON.js +2 -0
  159. package/views/2d/layers/features/support/FeatureSetReaderDimensionJSON.js +2 -0
  160. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  161. package/views/2d/layers/support/annodime/DimensionInfo.js +2 -0
  162. package/views/2d/layers/support/annodime/DimensionMatcherSchema.js +2 -0
  163. package/views/2d/layers/support/annodime/PrivateDimensionEffect.js +2 -0
  164. package/views/2d/layers/support/annodime/PrivatePlacementMultipoint.js +2 -0
  165. package/views/2d/layers/support/annodime/annotationGraphic.js +2 -0
  166. package/views/2d/layers/support/annodime/annotationSchema.js +2 -0
  167. package/views/2d/layers/support/annodime/annotationUtils.js +2 -0
  168. package/views/2d/layers/support/annodime/cimAnnotations.js +2 -0
  169. package/views/2d/layers/support/annodime/dimensionSchema.js +2 -0
  170. package/views/2d/layers/support/annodime/dimensionSymbols.js +2 -0
  171. package/views/2d/layers/support/annodime/dimensionUtils.js +2 -0
  172. package/views/2d/layers/support/annodime/fields.js +2 -0
  173. package/views/2d/layers/support/annodime/unsupported.js +2 -0
  174. package/views/2d/layers/support/annodime/utils.js +2 -0
  175. package/views/2d/layers/support/annodime/virtualFields.js +2 -0
  176. package/views/2d/support/clippingUtils.js +1 -1
  177. package/views/2d/support/hitTestUtils.js +1 -1
  178. package/views/2d/types.d.ts +5 -1
  179. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  180. package/views/3d/layerViewModuleImportUtils.js +1 -1
  181. package/views/3d/layers/MapImageLayerView3D.js +1 -1
  182. package/views/3d/layers/TileLayerView3D.js +1 -1
  183. package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
  184. package/views/3d/types.d.ts +2 -0
  185. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  186. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  187. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +8 -8
  188. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathEvaluate.glsl.js +53 -61
  189. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +23 -32
  190. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  191. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  192. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  193. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  194. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  195. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  196. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  197. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  198. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  199. package/views/3d/webgl-engine/materials/PathLayouts.js +1 -1
  200. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  201. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  202. package/views/3d/webgl-engine/shaders/ditherNoise.glsl.js +18 -1
  203. package/views/PopupView.d.ts +3 -3
  204. package/views/PopupView.js +1 -1
  205. package/views/SceneView.js +1 -1
  206. package/views/View2D.js +1 -1
  207. package/views/layers/AnnotationLayerView.d.ts +18 -0
  208. package/views/layers/AnnotationLayerView.js +2 -0
  209. package/views/layers/DimensionFeatureLayerView.d.ts +18 -0
  210. package/views/layers/DimensionFeatureLayerView.js +2 -0
  211. package/views/layers/FeatureLikeLayerView.d.ts +2 -1
  212. package/views/layers/FeatureLikeLayerView.js +1 -1
  213. package/views/layers/ImageryLayerView.js +1 -1
  214. package/views/layers/ImageryTileLayerView.js +1 -1
  215. package/views/layers/WMSLayerView.js +1 -1
  216. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  217. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  218. package/widgets/BatchAttributeForm/css.js +1 -1
  219. package/widgets/BatchAttributeForm/rendered-content/RelationshipDetails.js +2 -0
  220. package/widgets/BatchAttributeForm.js +1 -1
  221. package/widgets/FeatureForm.js +1 -1
  222. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  223. package/widgets/OrientedImageryViewer/css.js +1 -1
  224. package/widgets/OrientedImageryViewer.js +1 -1
  225. package/widgets/support/iconUtils.js +1 -1
  226. package/assets/esri/core/workers/chunks/0175098da590a7109539.js +0 -1
  227. package/assets/esri/core/workers/chunks/019a4fe7e085b2fc6ae9.js +0 -1
  228. package/assets/esri/core/workers/chunks/023837e5d9d2b6af66d8.js +0 -1
  229. package/assets/esri/core/workers/chunks/03c46880b69ce75a010f.js +0 -1
  230. package/assets/esri/core/workers/chunks/040884cec4b84dd1bb17.js +0 -1
  231. package/assets/esri/core/workers/chunks/04ea806b933d4dd41609.js +0 -1
  232. package/assets/esri/core/workers/chunks/0e549d942d6cba1608cf.js +0 -1
  233. package/assets/esri/core/workers/chunks/13a8346abe5509167578.js +0 -1
  234. package/assets/esri/core/workers/chunks/13d43a0683c42b94feb6.js +0 -1
  235. package/assets/esri/core/workers/chunks/179ffa2168c42615ccf2.js +0 -1
  236. package/assets/esri/core/workers/chunks/1ebb613bbe09fcf274d8.js +0 -1
  237. package/assets/esri/core/workers/chunks/27d7c701306efeea6b82.js +0 -1
  238. package/assets/esri/core/workers/chunks/2b9661700743d1f9717e.js +0 -1
  239. package/assets/esri/core/workers/chunks/2bdfae998371e3aa9f2d.js +0 -1
  240. package/assets/esri/core/workers/chunks/2f0a3b22fc46d832e240.js +0 -1
  241. package/assets/esri/core/workers/chunks/3835097520296b0517af.js +0 -1
  242. package/assets/esri/core/workers/chunks/4605a68e40c5c3ac6e3e.js +0 -1
  243. package/assets/esri/core/workers/chunks/4b130db9b7b4e2e32ea4.js +0 -1
  244. package/assets/esri/core/workers/chunks/4bfeac7338df9e0b7ce1.js +0 -1
  245. package/assets/esri/core/workers/chunks/4c5cdd2712c938fafc5d.js +0 -1
  246. package/assets/esri/core/workers/chunks/4fa3840672c33adb9171.js +0 -1
  247. package/assets/esri/core/workers/chunks/4ffcca40e7aa24c8cc35.js +0 -1
  248. package/assets/esri/core/workers/chunks/534dd93c72ea448ee908.js +0 -1
  249. package/assets/esri/core/workers/chunks/5ea0096a282e87a269bd.js +0 -1
  250. package/assets/esri/core/workers/chunks/66fe1634c6e8f72fc653.js +0 -1
  251. package/assets/esri/core/workers/chunks/6920e7f700a9ba280dba.js +0 -1
  252. package/assets/esri/core/workers/chunks/6b1f2b36bdc6b2ff2ea5.js +0 -1
  253. package/assets/esri/core/workers/chunks/6b66a6f69aa03338c346.js +0 -1
  254. package/assets/esri/core/workers/chunks/6d59a9cf533ebc590f70.js +0 -1
  255. package/assets/esri/core/workers/chunks/75dfdd85abbac26ac899.js +0 -1
  256. package/assets/esri/core/workers/chunks/798c4d3201fcc9f2a42b.js +0 -1
  257. package/assets/esri/core/workers/chunks/817fd88fe9a48caf69fb.js +0 -1
  258. package/assets/esri/core/workers/chunks/825db2ea15308ee6e5dc.js +0 -1
  259. package/assets/esri/core/workers/chunks/82f7d83a2073d1b0111c.js +0 -1
  260. package/assets/esri/core/workers/chunks/89250d268dc2554a9ece.js +0 -1
  261. package/assets/esri/core/workers/chunks/8c8fed53c12fb80ef2ed.js +0 -1
  262. package/assets/esri/core/workers/chunks/8ff83c59462dea6e3427.js +0 -1
  263. package/assets/esri/core/workers/chunks/961995d8da45a9203255.js +0 -1
  264. package/assets/esri/core/workers/chunks/a9c9c00432ee41ec91ba.js +0 -1
  265. package/assets/esri/core/workers/chunks/af762422a65c551dcd54.js +0 -1
  266. package/assets/esri/core/workers/chunks/b041c22885193bdd3004.js +0 -1
  267. package/assets/esri/core/workers/chunks/b3e8ab68fc38306f13c6.js +0 -1
  268. package/assets/esri/core/workers/chunks/b684ff4bc93bd60d6a19.js +0 -1
  269. package/assets/esri/core/workers/chunks/bb2f6b0fcdfb8b158e26.js +0 -1
  270. package/assets/esri/core/workers/chunks/c5ab346a226df1894302.js +0 -1
  271. package/assets/esri/core/workers/chunks/cd2b2babcdc130b4c368.js +0 -1
  272. package/assets/esri/core/workers/chunks/cedf3e316d6f89cf7005.js +0 -1
  273. package/assets/esri/core/workers/chunks/d39f5590022d910ee951.js +0 -1
  274. package/assets/esri/core/workers/chunks/d412a43060441d347fb4.js +0 -1
  275. package/assets/esri/core/workers/chunks/d41b847d08c42e5329d6.js +0 -262
  276. package/assets/esri/core/workers/chunks/d52172439db02a349542.js +0 -1
  277. package/assets/esri/core/workers/chunks/d8c2bed12f937228c763.js +0 -1
  278. package/assets/esri/core/workers/chunks/de916dd0c11aefb6832e.js +0 -1
  279. package/assets/esri/core/workers/chunks/ecf4d07917efc97eb991.js +0 -1
  280. package/assets/esri/core/workers/chunks/eda51e512eff551ad858.js +0 -1
  281. package/assets/esri/core/workers/chunks/f14e3693cd644265f909.js +0 -1
  282. package/assets/esri/core/workers/chunks/f52c6efc5a2abf5ac845.js +0 -1
  283. package/assets/esri/core/workers/chunks/f635a8e3b0bfeda99ed5.js +0 -1
  284. package/assets/esri/core/workers/chunks/f9f331c76c96743d8522.js +0 -1
  285. package/assets/esri/core/workers/chunks/fcbacca99c5a3ee5b69a.js +0 -1
  286. package/symbols/dimensions/effects/LinearDimensionArrowEffect.js +0 -2
  287. package/symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js +0 -2
  288. package/symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js +0 -2
  289. package/symbols/dimensions/effects/LinearDimensionLineEffect.js +0 -2
  290. package/symbols/dimensions/effects/LinearDimensionPointEffect.js +0 -2
  291. package/symbols/dimensions/effects/LinearDimensionTextEffect.js +0 -2
  292. package/views/2d/layers/features/support/FeatureSetReaderDimension.js +0 -2
  293. package/views/3d/webgl-engine/effects/globalIllumination/BlueNoise.js +0 -2
  294. package/views/layers/support/dimensionUtils.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- class t{constructor(){this._defaultResult=null,this._backgroundFillResult=null}static async from(e,s){const l=new t;return l.setDefault(await e.createMeshWriters(s.meshes)),l}size(){return 1}getDefault(){return this._defaultResult}setDefault(t){this._defaultResult=t}getBackgroundFill(){return this._backgroundFillResult}setBackgroundFill(t){this._backgroundFillResult=t}hasArcadeDependency(t){return this._defaultResult?.some(e=>e.hasArcadeDependency(t))??!1}match(t,e,s){const l=this.doMatch(t,e)||this.getDefault();if(l&&l.length>0){const t=this.getBackgroundFill();if(t)return[...t,...l]}return l}getSortKey(t,e){return 0}doMatch(t,e){return null}async fetchResources(t,e){}}export{t as FeatureMatcher};
2
+ class t{constructor(){this._defaultResult=null,this._backgroundFillResult=null}static async from(e,s){const l=new t;return l.setDefault(await e.createMeshWriters(s.meshes)),l}size(){return 1}getDefault(){return this._defaultResult}setDefault(t){this._defaultResult=t}getBackgroundFill(){return this._backgroundFillResult}setBackgroundFill(t){this._backgroundFillResult=t}hasArcadeDependency(t){return this._defaultResult?.some(e=>e.hasArcadeDependency(t))??!1}match(t,e,s){const l=this.doMatch(t,e)||this.getDefault();if(l&&l.length>0){const t=this.getBackgroundFill();if(t)return[...t,...l]}return l}cleanup(t,e,s,l,u){}getSortKey(t,e){return 0}doMatch(t,e){return null}async fetchResources(t,e,s,l){}}export{t as FeatureMatcher};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{internalTrackPartField as e}from"../../../../../layers/support/streamLayerUtils.js";import{DictionaryMatcher as t}from"./DictionaryMatcher.js";import{IntervalMatcher as r}from"./IntervalMatcher.js";import{LabelMatcher as a}from"./LabelMatcher.js";import{MapMatcher as s}from"./MapMatcher.js";import{FeatureMatcher as c}from"./Matcher.js";async function n(e,n){switch(n.type){case"simple":case"heatmap":case"dot-density":case"pie-chart":return c.from(e,n);case"interval":return r.fromIntervalSchema(e,n);case"dictionary":return t.fromDictionaryRenderer(e,n);case"label":return a.fromLabelSchema(e,n);case"map":return s.fromMatcherSchema(e,n);case"subtype":return h.fromSubtypes(e,n);case"cluster":return i.fromClusterSchema(e,n);case"track":return o.fromTrackSchema(e,n);default:throw new Error("Impl")}}class h extends c{constructor(e,t){super(),this._subMatchers=e,this._subtypeField=t}static async fromSubtypes(e,t){const r=new Map,a=[];for(const s in t.renderers){const c=parseInt(s,10),h=n(e,t.renderers[s]).then(e=>r.set(c,e));a.push(h)}return await Promise.all(a),new h(r,t.subtypeField)}match(e,t,r){const a=e.readAttribute(this._subtypeField),s=this._subMatchers.get(a);return s?s.match(e,t,r):null}hasArcadeDependency(e){for(const t of this._subMatchers.values())if(t.hasArcadeDependency(e))return!0;return!1}}class i extends c{static async fromClusterSchema(e,t){const[r,a]=await Promise.all([n(e,t.feature),n(e,t.cluster)]);return new i(r,a)}constructor(e,t){super(),this._featureMatcher=e,this._clusterMatcher=t}match(e,t,r){return 1===e.readAttribute("cluster_count")?this._featureMatcher.match(e,t,r):this._clusterMatcher.match(e,t,r)}hasArcadeDependency(e){return this._featureMatcher.hasArcadeDependency(e)||this._clusterMatcher.hasArcadeDependency(e)}}class o extends c{static async fromTrackSchema(e,t){const[r,a,s]=await Promise.all([n(e,t.previousObservation),n(e,t.latestObservation),n(e,t.trackLine)]);return new o(r,a,s)}constructor(e,t,r){super(),this._previousObservationMatcher=e,this._latestObservationMatcher=t,this._trackLineMatcher=r}match(t,r,a){switch(t.readAttribute(e)){case 0:return this._trackLineMatcher.match(t,r,a);case 1:return this._latestObservationMatcher.match(t,r,a);case 2:return this._previousObservationMatcher.match(t,r,a)}return null}hasArcadeDependency(e){return this._trackLineMatcher.hasArcadeDependency(e)||this._latestObservationMatcher.hasArcadeDependency(e)||this._previousObservationMatcher.hasArcadeDependency(e)}}export{i as ClusterMatcher,h as SubtypeMatcher,n as createMatcher};
2
+ import{internalTrackPartField as e}from"../../../../../layers/support/streamLayerUtils.js";import{AnnotationMatcher as t}from"./AnnotationMatcher.js";import{DictionaryMatcher as r}from"./DictionaryMatcher.js";import{DimensionMatcher as a}from"./DimensionMatcher.js";import{IntervalMatcher as s}from"./IntervalMatcher.js";import{LabelMatcher as c}from"./LabelMatcher.js";import{MapMatcher as n}from"./MapMatcher.js";import{FeatureMatcher as i}from"./Matcher.js";async function h(e,h){switch(h.type){case"annotation":return t.fromAnnotationSchema(e,h);case"dimension-feature":return a.fromDimensionSchema(e,h);case"simple":case"heatmap":case"dot-density":case"pie-chart":return i.from(e,h);case"interval":return s.fromIntervalSchema(e,h);case"dictionary":return r.fromDictionaryRenderer(e,h);case"label":return c.fromLabelSchema(e,h);case"map":return n.fromMatcherSchema(e,h);case"subtype":return o.fromSubtypes(e,h);case"cluster":return u.fromClusterSchema(e,h);case"track":return m.fromTrackSchema(e,h);default:throw new Error("Impl")}}class o extends i{constructor(e,t){super(),this._subMatchers=e,this._subtypeField=t}static async fromSubtypes(e,t){const r=new Map,a=[];for(const s in t.renderers){const c=parseInt(s,10),n=h(e,t.renderers[s]).then(e=>r.set(c,e));a.push(n)}return await Promise.all(a),new o(r,t.subtypeField)}match(e,t,r){const a=e.readAttribute(this._subtypeField),s=this._subMatchers.get(a);return s?s.match(e,t,r):null}hasArcadeDependency(e){for(const t of this._subMatchers.values())if(t.hasArcadeDependency(e))return!0;return!1}}class u extends i{static async fromClusterSchema(e,t){const[r,a]=await Promise.all([h(e,t.feature),h(e,t.cluster)]);return new u(r,a)}constructor(e,t){super(),this._featureMatcher=e,this._clusterMatcher=t}match(e,t,r){return 1===e.readAttribute("cluster_count")?this._featureMatcher.match(e,t,r):this._clusterMatcher.match(e,t,r)}hasArcadeDependency(e){return this._featureMatcher.hasArcadeDependency(e)||this._clusterMatcher.hasArcadeDependency(e)}}class m extends i{static async fromTrackSchema(e,t){const[r,a,s]=await Promise.all([h(e,t.previousObservation),h(e,t.latestObservation),h(e,t.trackLine)]);return new m(r,a,s)}constructor(e,t,r){super(),this._previousObservationMatcher=e,this._latestObservationMatcher=t,this._trackLineMatcher=r}match(t,r,a){switch(t.readAttribute(e)){case 0:return this._trackLineMatcher.match(t,r,a);case 1:return this._latestObservationMatcher.match(t,r,a);case 2:return this._previousObservationMatcher.match(t,r,a)}return null}hasArcadeDependency(e){return this._trackLineMatcher.hasArcadeDependency(e)||this._latestObservationMatcher.hasArcadeDependency(e)||this._previousObservationMatcher.hasArcadeDependency(e)}}export{u as ClusterMatcher,o as SubtypeMatcher,h as createMatcher};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../core/Error.js";let r=null;function t(){return r??=Promise.all([import("./webglDeps.js"),import("./mapViewDeps.js")]),r}const a=()=>t().then(()=>import("./layers/TileLayerView2D.js")),i={"base-dynamic":()=>t().then(()=>import("./layers/BaseDynamicLayerView2D.js")),"base-tile":a,"bing-maps":a,catalog:()=>t().then(()=>import("./layers/CatalogLayerView2D.js")),"catalog-dynamic-group":()=>t().then(()=>import("./layers/CatalogDynamicGroupLayerView2D.js")),"catalog-footprint":()=>t().then(()=>import("./layers/CatalogFootprintLayerView2D.js")),csv:()=>t().then(()=>import("./layers/CSVLayerView2D.js")),"geo-rss":()=>t().then(()=>import("./layers/GeoRSSLayerView2D.js")),feature:()=>t().then(()=>import("./layers/FeatureLayerView2D.js")),"dimension-feature":()=>t().then(()=>import("./layers/DimensionLayerView2D.js")),geojson:()=>t().then(()=>import("./layers/GeoJSONLayerView2D.js")),graphics:()=>t().then(()=>import("./layers/GraphicsLayerView2D.js")),group:()=>t().then(()=>import("./layers/GroupLayerView2D.js")),imagery:()=>t().then(()=>import("./layers/ImageryLayerView2D.js")),"imagery-tile":()=>t().then(()=>import("./layers/ImageryTileLayerView2D.js")),kml:()=>t().then(()=>import("./layers/KMLLayerView2D.js")),"knowledge-graph":()=>t().then(()=>import("./layers/KnowledgeGraphLayerView2D.js")),"link-chart":()=>t().then(()=>import("./layers/KnowledgeGraphLayerView2D.js")),"knowledge-graph-sublayer":()=>t().then(()=>import("./layers/KnowledgeGraphSublayerView2D.js")),"map-image":()=>t().then(()=>import("./layers/MapImageLayerView2D.js")),"map-notes":()=>t().then(()=>import("./layers/MapNotesLayerView2D.js")),media:()=>t().then(()=>import("./layers/MediaLayerView2D.js")),"ogc-feature":()=>t().then(()=>import("./layers/OGCFeatureLayerView2D.js")),"open-street-map":a,"oriented-imagery":()=>t().then(()=>import("./layers/OrientedImageryLayerView2D.js")),parquet:()=>t().then(()=>import("./layers/ParquetLayerView2D.js")),route:()=>t().then(()=>import("./layers/RouteLayerView2D.js")),stream:()=>t().then(()=>import("./layers/StreamLayerView2D.js")),"subtype-group":()=>t().then(()=>import("./layers/SubtypeGroupLayerView2D.js")),tile:a,"vector-tile":()=>t().then(()=>import("./layers/VectorTileLayerView2D.js")),video:()=>t().then(()=>import("./layers/VideoLayerView2D.js")),wcs:()=>t().then(()=>import("./layers/ImageryTileLayerView2D.js")),"web-tile":a,wfs:()=>t().then(()=>import("./layers/WFSLayerView2D.js")),wms:()=>t().then(()=>import("./layers/WMSLayerView2D.js")),wmts:()=>t().then(()=>import("./layers/WMTSLayerView2D.js")),"base-elevation":null,"building-scene":null,dimension:null,elevation:null,"gaussian-splat":null,"integrated-mesh-3dtiles":null,"integrated-mesh":null,"line-of-sight":null,"point-cloud":null,scene:null,unknown:null,unsupported:null,viewshed:null,voxel:null};function s(r){const t=r.declaredClass?r.declaredClass.slice(r.declaredClass.lastIndexOf(".")+1):"Unknown",a=t.replaceAll(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return new e(`${a}:view-not-supported`,`${t} is not supported in 2D`)}const l=new Map,n={hasLayerViewModule:e=>null!=i[e.type],importLayerView:e=>{const r=l.get(e.type);if(r)return r;const t=i[e.type];if(null==t)throw s(e);const a=t(e);return l.set(e.type,a),a}};export{n as layerView2DImporter};
2
+ import e from"../../core/Error.js";let r=null;function t(){return r??=Promise.all([import("./webglDeps.js"),import("./mapViewDeps.js")]),r}const a=()=>t().then(()=>import("./layers/TileLayerView2D.js")),i={annotation:()=>t().then(()=>import("./layers/AnnotationLayerView2D.js")),"base-dynamic":()=>t().then(()=>import("./layers/BaseDynamicLayerView2D.js")),"base-tile":a,"bing-maps":a,catalog:()=>t().then(()=>import("./layers/CatalogLayerView2D.js")),"catalog-dynamic-group":()=>t().then(()=>import("./layers/CatalogDynamicGroupLayerView2D.js")),"catalog-footprint":()=>t().then(()=>import("./layers/CatalogFootprintLayerView2D.js")),csv:()=>t().then(()=>import("./layers/CSVLayerView2D.js")),"geo-rss":()=>t().then(()=>import("./layers/GeoRSSLayerView2D.js")),feature:()=>t().then(()=>import("./layers/FeatureLayerView2D.js")),"dimension-feature":()=>t().then(()=>import("./layers/DimensionFeatureLayerView2D.js")),geojson:()=>t().then(()=>import("./layers/GeoJSONLayerView2D.js")),graphics:()=>t().then(()=>import("./layers/GraphicsLayerView2D.js")),group:()=>t().then(()=>import("./layers/GroupLayerView2D.js")),imagery:()=>t().then(()=>import("./layers/ImageryLayerView2D.js")),"imagery-tile":()=>t().then(()=>import("./layers/ImageryTileLayerView2D.js")),kml:()=>t().then(()=>import("./layers/KMLLayerView2D.js")),"knowledge-graph":()=>t().then(()=>import("./layers/KnowledgeGraphLayerView2D.js")),"link-chart":()=>t().then(()=>import("./layers/KnowledgeGraphLayerView2D.js")),"knowledge-graph-sublayer":()=>t().then(()=>import("./layers/KnowledgeGraphSublayerView2D.js")),"map-image":()=>t().then(()=>import("./layers/MapImageLayerView2D.js")),"map-notes":()=>t().then(()=>import("./layers/MapNotesLayerView2D.js")),media:()=>t().then(()=>import("./layers/MediaLayerView2D.js")),"ogc-feature":()=>t().then(()=>import("./layers/OGCFeatureLayerView2D.js")),"open-street-map":a,"oriented-imagery":()=>t().then(()=>import("./layers/OrientedImageryLayerView2D.js")),parquet:()=>t().then(()=>import("./layers/ParquetLayerView2D.js")),route:()=>t().then(()=>import("./layers/RouteLayerView2D.js")),stream:()=>t().then(()=>import("./layers/StreamLayerView2D.js")),"subtype-group":()=>t().then(()=>import("./layers/SubtypeGroupLayerView2D.js")),tile:a,"vector-tile":()=>t().then(()=>import("./layers/VectorTileLayerView2D.js")),video:()=>t().then(()=>import("./layers/VideoLayerView2D.js")),wcs:()=>t().then(()=>import("./layers/ImageryTileLayerView2D.js")),"web-tile":a,wfs:()=>t().then(()=>import("./layers/WFSLayerView2D.js")),wms:()=>t().then(()=>import("./layers/WMSLayerView2D.js")),wmts:()=>t().then(()=>import("./layers/WMTSLayerView2D.js")),"base-elevation":null,"building-scene":null,dimension:null,elevation:null,"gaussian-splat":null,"integrated-mesh-3dtiles":null,"integrated-mesh":null,"line-of-sight":null,"point-cloud":null,scene:null,unknown:null,unsupported:null,viewshed:null,voxel:null};function s(r){const t=r.declaredClass?r.declaredClass.slice(r.declaredClass.lastIndexOf(".")+1):"Unknown",a=t.replaceAll(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return new e(`${a}:view-not-supported`,`${t} is not supported in 2D`)}const n=new Map,l={hasLayerViewModule:e=>null!=i[e.type],importLayerView:e=>{const r=n.get(e.type);if(r)return r;const t=i[e.type];if(null==t)throw s(e);const a=t(e);return n.set(e.type,a),a}};export{l as layerView2DImporter};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import{FeatureLikeLayerView2D as o}from"./FeatureLikeLayerView2D.js";import s from"../../layers/FeatureLayerView.js";let t=class extends(o(s)){};t=e([r("esri.views.2d.layers.AnnotationLayerView2D")],t);const a=t;export{a as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import{FeatureLikeLayerView2D as s}from"./FeatureLikeLayerView2D.js";import o from"../../layers/FeatureLayerView.js";let t=class extends(s(o)){};t=e([r("esri.views.2d.layers.DimensionLayerView2D")],t);const i=t;export{i as default};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import{FeatureLikeLayerView2D as s}from"./FeatureLikeLayerView2D.js";import o from"../../layers/FeatureLayerView.js";let t=class extends(s(o)){};t=e([r("esri.views.2d.layers.DimensionFeatureLayerView2D")],t);const a=t;export{a as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{makeHandle as n,handlesGroup as u}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import l from"../../../core/Logger.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{notDeepEqual as c}from"../../../core/object.js";import{createAbortError as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as m,initial as f,sync as w}from"../../../core/reactiveUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{getMetersPerUnitForSR as _}from"../../../core/units.js";import{property as b,subclass as S}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import{fromJSON as j}from"../../../geometry/support/jsonUtils.js";import x from"../../../geometry/support/rotate.js";import{isCurvedGeometry as I}from"../../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as E}from"../../../geometry/support/curves/densifyCurvedGeometry.js";import k from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as R}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as O}from"../../../layers/support/featureLayerUtils.js";import{packFields as q}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as Q}from"../../../layers/support/timeSupport.js";import L from"../../../rest/support/AggregateFeatureSet.js";import V from"../../../rest/support/AttributeBinsFeatureSet.js";import H from"../../../rest/support/AttributeBinsQuery.js";import P from"../../../rest/support/FeatureSet.js";import M from"../../../rest/support/Query.js";import{HittestDrawHelper as T}from"../../../symbols/cim/CIMSymbolDrawHelper.js";import{symbolToCIM as W}from"../../../symbols/cim/CIMSymbolHelper.js";import{getDisplayedSymbol as D}from"../../../symbols/support/symbolUtils.js";import{LayerView2D as G}from"./LayerView2D.js";import{FeatureContainer as N}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as J}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as B}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as z}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{DimensionLayerAdapter as Z}from"./features/layerAdapters/DimensionLayerAdapter.js";import{FeatureLayerAdapter as K}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as $}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as X}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Y}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as ee}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as te}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as re}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as se}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as ie}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as ae}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as oe}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as ne}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as ue}from"./support/handleNoEngineError.js";import{toJSONGeometryType as le}from"./support/util.js";import{getMapPointsFromScreen as he,isScreenRect as ce}from"../support/hitTestUtils.js";import{FeatureTileSubscriptionManager as pe}from"../tiling/FeatureTileSubscriptionManager.js";import{RefreshableLayerView as de}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ye}from"../../support/highlightOptionsUtils.js";function ge(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const me=4294967294;function fe(e,t){return u(e.map(e=>m(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t,w)))}function we(e){if(!e.geometry)return e;if(!I(e.geometry))return e;const t=.001/_(e.geometry.spatialReference),r=100;return{geometry:E(e.geometry,{maxSegmentsPerCurve:12e3,maxSegmentLength:r*t,maxDeviation:0}),attributes:e.attributes}}const ve=u=>{const w=de(G(u));let _=class extends w{constructor(){super(...arguments),this._commandsQueue=new ne({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this._lastRequiredLevel=0,this.eventLog=new B,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._hittestDrawHelper=null,this._sourceUpdating=!1,this.featureEffectView=new k}destroy(){this._editUpdatingHandles.destroy(),this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy(),this._hittestDrawHelper?.destroy()}initialize(){this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===C(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await J(t)}async _attachProxy(){const e=x(this.view.extent,this.view.rotation,this.view.center),t=this.view.featuresTilingScheme.getClosestInfoForScale(this.view.scale).level;t!==this._lastRequiredLevel&&(this._lastRequiredLevel=t);const r={tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON(),initialViewExtent:e.toJSON(),requiredLevel:t,requiredScale:this.view.scale};try{await this._workerProxy.pipeline.onAttach(r),this._workerAttached.resolve()}catch(s){this._workerAttached.reject(p()),y(s)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new X(this.layer):new K(this.layer);case"geojson":case"csv":case"wfs":return new X(this.layer);case"parquet":return new re(this.layer);case"subtype-group":return new ie(this.layer);case"ogc-feature":return new ee(this.layer);case"stream":return new se(this.layer);case"oriented-imagery":return new te(this.layer);case"knowledge-graph-sublayer":return new Y(this.layer);case"catalog-footprint":return new z(this.layer);case"dimension-feature":return new Z(this.layer);default:this.layer}return null}get timeExtent(){return Q(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}get usedMemory(){return this.container.usedMemory+this.eventLog.pipelineStatistics.usedMemory}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=s?.filter(i);if(!o?.length)return n();const u=ye(t);return this._addHighlights(o,u),n(()=>!this.destroyed&&this._removeHighlights(o,u))}async hitTest(e,i){const a=ce(i),{trueHitIds:o,candidateHitIds:n}=await this.featureContainer.hitTest(i),u=await this.getWorker(),[l,h]=await Promise.all([u.pipeline.getDisplayFeatures(n),u.pipeline.getDisplayFeatures(o)]),{features:c,aggregates:p,tracks:d}=l,{features:y,aggregates:m,tracks:f}=h,w=[];if(a&&this.hasRenderer()){const e=new Map,t=new r;for(const r of c){t.attributes=r.attributes,t.geometry=j(r.geometry),t.symbol=null;const s=this.layerAdapter.getRenderer(t);if(!s){w.push(r);continue}const i=await D(t,{renderer:s,scale:this.view.scale,resolution:this.view.resolution,spatialReference:this.view.spatialReference,viewingMode:"2d",timeZone:this.view.timeZone});if(!i)continue;let a=null;const o=W(i);if("web-style"===o.type)try{const e=W(await o.fetchSymbol({acceptedFormats:["cim","web"]}));a="web-style"===e.type?null:e.symbol}catch(x){g(x),0;continue}else a=o.symbol;a&&e.set(r,a)}e.size>0&&!this._hittestDrawHelper&&(this._hittestDrawHelper=new T(this.view.stage.painter.textureManager.resourceManager));const{resolution:s,rotation:a}=this.view.state,o=he(this.view,i);for(const[r,i]of e){if(!r)continue;this._hittestDrawHelper.hitTest(o,i,r.geometry,null,a,s,0,"rect")&&w.push(r)}}else w.push(...c);const v=[...y,...w],_=[...m,...p],b=[...f,...d],S=this.featureContainer.getSortKeys(v.map(e=>e.displayId)),A=({displayId:e},{displayId:t})=>S.has(e)&&S.has(t)?S.get(e)-S.get(t):e-t;v.sort(A).reverse(),_.sort(A).reverse();const F=has("parquetlayer-hittest-max-feature-count")??1;return"parquet"===this.layer.type&&v.length>F&&(v.length=F),[..._.map(r=>this._createAggregateGraphicHit(e,t.fromJSON(r))),...b.map(t=>this._createTrackGraphicHit(e,s.fromJSON(t))),...v.map(t=>this._createFeatureGraphicHit(a?null:e,r.fromJSON(t)))]}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return ue(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return ue(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return ue(a,{uniqueValueInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return ue(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return ue(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return ue(r,0)}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return ue(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return ue(r,[])}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return ue(r,{features:[]})}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await ue(r,{features:[]});return V.fromJSON(s)}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await ue(r,{features:[]}),i=L.fromJSON(s);return i.features.forEach(e=>this.layerAdapter.setAggregateGraphicOrigin?.(e)),i}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return ue(a,{classBreakInfos:[]})}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await ue(r,{count:0,extent:null});return{count:s.count,extent:F.fromJSON(s.extent)}}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return ue(r,0)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=P.fromJSON(e);return t.features.forEach(e=>this._setOriginForFeature(e)),t})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return ue(r,{features:[]})}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return ue(r,[])}async queryStatistics(){const e=await this.getWorker();return ue(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return ue(a,{})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await ue(r,{features:[]}),i=P.fromJSON(s);return i.features.forEach(e=>this._setOriginForFeature(e)),i}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptions)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.featureContainer.getPresenting(),r=this._subscriptions.update(e.targetState,this._lastTargetState,t);r&&(this.featureContainer.updateSubscriptions(r),d(this._updatingHandles.addPromise(this.getWorker().then(e=>e.pipeline.updateSubscriptions(r))))),this._subscriptions.coverage&&this.featureContainer.setCoverage(this._subscriptions.coverage)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new N(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptions=new pe(this.view.featuresTilingScheme),this.requestUpdate(),this.addAttachHandles([fe([()=>this._displayRefreshVersion,()=>"displayFilterInfo"in this.layer&&this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),m(()=>this.updateSuspended,e=>{e||this._subscriptions.resume(this.featureContainer.getPresenting())}),m(()=>this.view.scale,async e=>{const t=this.view.featuresTilingScheme.getClosestInfoForScale(e).level;if(t!==this._lastRequiredLevel){this._lastRequiredLevel=t;(await this.getWorker()).pipeline.updateRequiredLevel(t,e)}},f),m(()=>this.view.stationary,async e=>{if(e){const e=await this.getWorker(),t=x(this.view.extent,this.view.rotation,this.view.center);e.pipeline.updateStationaryExtent(t.toJSON(),this.featureContainer.requiresRefresh)}})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptions=h(this._subscriptions),this._workerProxy.pipeline.onDetach(),this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}onProxyClientEvent(e){}hasRenderer(){return"renderer"in this.layer&&null!=this.layer.renderer}isUpdating(){const e=this.hasRenderer(),t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updating;return this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating}_createClientOptions(){const e=this;return{updateSchemaStart:()=>e.updateSchemaStart(),updateSchemaEnd:t=>e.updateSchemaEnd(t),openMemoryPorts:async()=>{if(this.layerAdapter?.openMessagePorts){const e=await this.layerAdapter.openMessagePorts();return{result:e,transferList:e}}throw new Error("InternalError: Layer adapter does not support opening message ports")},get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.onProxyClientEvent(e)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const i=r.visualVariableUniforms,a=le(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await ae({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=M.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),"returnZ"in this.layer&&(t.returnZ??=this.layer.returnZ),"returnM"in this.layer&&(t.returnM??=this.layer.returnM),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=H.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=M.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%me+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%me+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?l.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return l.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=le(this.layer.geometryType),i=$(this.layer),a=[];for(const n of e.added){const e=R(we(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=R(we(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async updateSchemaStart(){const e=this.layer;"featureReduction"in e&&e.featureReduction&&e.featureReduction!==this._lastFeatureReduction&&(e.featureReduction=e.featureReduction?.clone(),this._lastFeatureReduction=e.featureReduction);try{if(await Promise.allSettled([this._handleChange(),O(e)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptions)return null;const t=this.featureContainer.updateStart("subtype-group"===e.type);this._lastFeatureEffect=this.featureEffect;const r={store:t,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this._createViewSchemaConfig(),i={source:await this.layerAdapter.createSourceSchema(s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)};return c(this._lastSchema?.source.strategy,i.source.strategy)||c(this._lastSchema?.processor,i.processor)?(this._lastSchema=i,this._fields=null,i):null}catch(t){}return null}async updateSchemaEnd(e){try{this.featureEffectView.featureEffect=this._lastFeatureEffect,e&&this.featureEffectView.endTransition(),await this.featureContainer.updateEnd(this._lastSchema.processor,this.layerAdapter.getLabelingDeconflictionInfo(),e),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.updateEnd")}catch(t){}}async _doUpdate(){const e=Math.round(performance.now()),t=await this.getWorker();await t.pipeline.updateSchema(e),this.requestUpdate()}async _doOverride(e){const t=await this.getWorker();try{let r=new oe;for(const s of e.messages)switch(s.type){case"edit":r.tryAdd(await this._resolveEdit(s.event))||(await t.pipeline.onOverride(r.toMessage()),r=new oe,r.tryAdd(await this._resolveEdit(s.event)));break;case"override":r.tryAdd(this._resolveOverrides(s.options))||(await t.pipeline.onOverride(r.toMessage()),r=new oe,r.tryAdd(this._resolveOverrides(s.options)));break}await t.pipeline.onOverride(r.toMessage())}catch(r){g(r),0}}_getEffectiveAvailableFields(e){const t=ge(this._lastAvailableFields,e);return this._lastAvailableFields=t,q(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[I(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e,spatialReference:this.view.spatialReference,extent:this.view.extent,returnZ:this.hasZ,returnM:this.hasM}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{g(e)||l.getLogger(this).error(e)});this._updatingHandles.consumePromise(r)}_setOriginForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createFeatureGraphicHit(e,t){return this._setOriginForFeature(t),this._createGraphicHit(e,t)}_createTrackGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setTrackGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createAggregateGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setAggregateGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createGraphicHit(e,t){return null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function I(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new U,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new U,i.where=v(i.where,a));let u=i?.toJSON()??null;return s.size&&(u??=(new U).toJSON(),u.hiddenIds=Array.from(s)),u}return e([b()],_.prototype,"_commandsQueue",void 0),e([b()],_.prototype,"_sourceRefreshVersion",void 0),e([b()],_.prototype,"_displayRefreshVersion",void 0),e([b({readOnly:!0})],_.prototype,"_pipelineUpdating",void 0),e([b()],_.prototype,"_sourceUpdating",void 0),e([b({readOnly:!0})],_.prototype,"dataUpdating",null),e([b({readOnly:!0})],_.prototype,"hasAllFeatures",null),e([b({readOnly:!0})],_.prototype,"hasAllFeaturesInView",null),e([b({readOnly:!0})],_.prototype,"hasFullGeometries",null),e([b()],_.prototype,"featureEffectView",void 0),e([b()],_.prototype,"layerAdapter",null),e([b({readOnly:!0})],_.prototype,"timeExtent",null),_=e([S("esri.views.2d.layers.FeatureLikeLayerView2D")],_),_};export{ve as FeatureLikeLayerView2D};
2
+ import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{makeHandle as n,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{notDeepEqual as c}from"../../../core/object.js";import{createAbortError as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as g,initial as f,sync as w}from"../../../core/reactiveUtils.js";import{isScreenRect as v}from"../../../core/screenUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{getMetersPerUnitForSR as b}from"../../../core/units.js";import{property as S,subclass as A}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as F}from"../../../core/support/UpdatingHandles.js";import j from"../../../geometry/Extent.js";import{fromJSON as x}from"../../../geometry/support/jsonUtils.js";import R from"../../../geometry/support/rotate.js";import{isCurvedGeometry as E}from"../../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as I}from"../../../geometry/support/curves/densifyCurvedGeometry.js";import k from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as O}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as q}from"../../../layers/support/featureLayerUtils.js";import{packFields as C}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as V}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as Q}from"../../../layers/support/timeSupport.js";import L from"../../../rest/support/AggregateFeatureSet.js";import M from"../../../rest/support/AttributeBinsFeatureSet.js";import H from"../../../rest/support/AttributeBinsQuery.js";import P from"../../../rest/support/FeatureSet.js";import T from"../../../rest/support/Query.js";import{HittestDrawHelper as W}from"../../../symbols/cim/CIMSymbolDrawHelper.js";import{symbolToCIM as D}from"../../../symbols/cim/CIMSymbolHelper.js";import{getDisplayedSymbol as G}from"../../../symbols/support/symbolUtils.js";import{LayerView2D as N}from"./LayerView2D.js";import{FeatureContainer as J}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as z}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as B}from"./features/FeatureSourceEventLog.js";import{AnnotationLayerAdapter as Z}from"./features/layerAdapters/AnnotationLayerAdapter.js";import{CatalogFootprintLayerAdapter as K}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{DimensionLayerAdapter as $}from"./features/layerAdapters/DimensionLayerAdapter.js";import{FeatureLayerAdapter as X}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as Y}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as ee}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as te}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as re}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as se}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as ie}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as ae}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as oe}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as ne}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as le}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as ue}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as he}from"./support/handleNoEngineError.js";import{toJSONGeometryType as ce}from"./support/util.js";import{getMapPointsFromScreen as pe}from"../support/hitTestUtils.js";import{FeatureTileSubscriptionManager as de}from"../tiling/FeatureTileSubscriptionManager.js";import{RefreshableLayerView as ye}from"../../layers/RefreshableLayerView.js";import{getHighlightName as me}from"../../support/highlightOptionsUtils.js";function ge(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const fe=4294967294;function we(e,t){return l(e.map(e=>g(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t,w)))}function ve(e){if(!e.geometry)return e;if(!E(e.geometry))return e;const t=.001/b(e.geometry.spatialReference),r=100;return{geometry:I(e.geometry,{maxSegmentsPerCurve:12e3,maxSegmentLength:r*t,maxDeviation:0}),attributes:e.attributes}}const _e=l=>{const w=ye(N(l));let b=class extends w{constructor(){super(...arguments),this._commandsQueue=new ue({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this._lastRequiredLevel=0,this.eventLog=new B,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new F,this._fields=null,this._hittestDrawHelper=null,this._sourceUpdating=!1,this.featureEffectView=new k}destroy(){this._editUpdatingHandles.destroy(),this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy(),this._hittestDrawHelper?.destroy()}initialize(){this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===V(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await z(t)}async _attachProxy(){const e=R(this.view.extent,this.view.rotation,this.view.center),t=this.view.featuresTilingScheme.getClosestInfoForScale(this.view.scale).level;t!==this._lastRequiredLevel&&(this._lastRequiredLevel=t);const r={tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON(),initialViewExtent:e.toJSON(),requiredLevel:t,requiredScale:this.view.scale};try{await this._workerProxy.pipeline.onAttach(r),this._workerAttached.resolve()}catch(s){this._workerAttached.reject(p()),y(s)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get layerAdapter(){switch(this.layer.type){case"annotation":return new Z(this.layer);case"dimension-feature":return new $(this.layer);case"feature":return"memory"===this.layer.source.type?new ee(this.layer):new X(this.layer);case"geojson":case"csv":case"wfs":return new ee(this.layer);case"parquet":return new ie(this.layer);case"subtype-group":return new oe(this.layer);case"ogc-feature":return new re(this.layer);case"stream":return new ae(this.layer);case"oriented-imagery":return new se(this.layer);case"knowledge-graph-sublayer":return new te(this.layer);case"catalog-footprint":return new K(this.layer);default:this.layer}return null}get timeExtent(){return Q(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}get usedMemory(){return this.container.usedMemory+this.eventLog.pipelineStatistics.usedMemory}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=s?.filter(i);if(!o?.length)return n();const l=me(t);return this._addHighlights(o,l),n(()=>!this.destroyed&&this._removeHighlights(o,l))}async hitTest(e,i){const a=v(i),{trueHitIds:o,candidateHitIds:n}=await this.featureContainer.hitTest(i),l=await this.getWorker(),[u,h]=await Promise.all([l.pipeline.getDisplayFeatures(n),l.pipeline.getDisplayFeatures(o)]),{features:c,aggregates:p,tracks:d}=u,{features:y,aggregates:g,tracks:f}=h,w=[];if(a&&this.hasRenderer()){const e=new Map,t=new r;for(const r of c){t.attributes=r.attributes,t.geometry=x(r.geometry),t.symbol=null;const s=this.layerAdapter.getRenderer(t);if(!s){w.push(r);continue}const i=await G(t,{renderer:s,scale:this.view.scale,resolution:this.view.resolution,spatialReference:this.view.spatialReference,viewingMode:"2d",timeZone:this.view.timeZone});if(!i)continue;let a=null;const o=D(i);if("web-style"===o.type)try{const e=D(await o.fetchSymbol({acceptedFormats:["cim","web"]}));a="web-style"===e.type?null:e.symbol}catch(R){m(R),0;continue}else a=o.symbol;a&&e.set(r,a)}e.size>0&&!this._hittestDrawHelper&&(this._hittestDrawHelper=new W(this.view.stage.painter.textureManager.resourceManager));const{resolution:s,rotation:a}=this.view.state,o=pe(this.view,i);for(const[r,i]of e){if(!r)continue;this._hittestDrawHelper.hitTest(o,i,r.geometry,null,a,s,0,"rect")&&w.push(r)}}else w.push(...c);const _=[...y,...w],b=[...g,...p],S=[...f,...d],A=this.featureContainer.getSortKeys(_.map(e=>e.displayId)),F=({displayId:e},{displayId:t})=>A.has(e)&&A.has(t)?A.get(e)-A.get(t):e-t;_.sort(F).reverse(),b.sort(F).reverse();const j=has("parquetlayer-hittest-max-feature-count")??1;return"parquet"===this.layer.type&&_.length>j&&(_.length=j),[...b.map(r=>this._createAggregateGraphicHit(e,t.fromJSON(r))),...S.map(t=>this._createTrackGraphicHit(e,s.fromJSON(t))),..._.map(t=>this._createFeatureGraphicHit(a?null:e,r.fromJSON(t)))]}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return he(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return he(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return he(a,{uniqueValueInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return he(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return he(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return he(r,0)}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return he(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return he(r,[])}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return he(r,{features:[]})}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await he(r,{features:[]});return M.fromJSON(s)}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await he(r,{features:[]}),i=L.fromJSON(s);return i.features.forEach(e=>this.layerAdapter.setAggregateGraphicOrigin?.(e)),i}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return he(a,{classBreakInfos:[]})}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await he(r,{count:0,extent:null});return{count:s.count,extent:j.fromJSON(s.extent)}}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return he(r,0)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=P.fromJSON(e);return t.features.forEach(e=>this._setOriginForFeature(e)),t})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return he(r,{features:[]})}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return he(r,[])}async queryStatistics(){const e=await this.getWorker();return he(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return he(a,{})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await he(r,{features:[]}),i=P.fromJSON(s);return i.features.forEach(e=>this._setOriginForFeature(e)),i}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptions)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.featureContainer.getPresenting(),r=this._subscriptions.update(e.targetState,this._lastTargetState,t);r&&(this.featureContainer.updateSubscriptions(r),d(this._updatingHandles.addPromise(this.getWorker().then(e=>e.pipeline.updateSubscriptions(r))))),this._subscriptions.coverage&&this.featureContainer.setCoverage(this._subscriptions.coverage)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new J(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptions=new de(this.view.featuresTilingScheme),this.requestUpdate(),this.addAttachHandles([we([()=>this._displayRefreshVersion,()=>"displayFilterInfo"in this.layer&&this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),g(()=>this.updateSuspended,e=>{e||this._subscriptions.resume(this.featureContainer.getPresenting())}),g(()=>this.view.scale,async e=>{const t=this.view.featuresTilingScheme.getClosestInfoForScale(e).level;if(t!==this._lastRequiredLevel){this._lastRequiredLevel=t;(await this.getWorker()).pipeline.updateRequiredLevel(t,e)}},f),g(()=>this.view.stationary,async e=>{if(e){const e=await this.getWorker(),t=R(this.view.extent,this.view.rotation,this.view.center);e.pipeline.updateStationaryExtent(t.toJSON(),this.featureContainer.requiresRefresh)}})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptions=h(this._subscriptions),this._workerProxy.pipeline.onDetach(),this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}onProxyClientEvent(e){}hasRenderer(){return"renderer"in this.layer&&null!=this.layer.renderer}isUpdating(){const e=this.hasRenderer(),t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updating;return this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating}_createClientOptions(){const e=this;return{updateSchemaStart:()=>e.updateSchemaStart(),updateSchemaEnd:t=>e.updateSchemaEnd(t),openMemoryPorts:async()=>{if(this.layerAdapter?.openMessagePorts){const e=await this.layerAdapter.openMessagePorts();return{result:e,transferList:e}}throw new Error("InternalError: Layer adapter does not support opening message ports")},get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.onProxyClientEvent(e)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e))),fetchMesh:e=>Promise.all(e.map(e=>this._fetchMeshRequest(e)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const i=r.visualVariableUniforms,a=ce(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await ne({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}async _fetchMeshRequest(e){const{layer:t}=this;try{const r={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:null};this._fields||(this._fields=t.fields.map(e=>e.toJSON()));return{type:"mesh-response",meshes:await ne({...e.symbolReference,hasTextStringTemplates:!0},{path:"anno-like",schemaOptions:r,uniforms:{visualVariableColor:null,visualVariableOpacity:null,visualVariableRotation:null,visualVariableSizeStops:null,visualVariableSizeScaleStops:null,visualVariableSizeOutlineScaleStops:null,visualVariableSizeUnitValue:null,visualVariableSizeMinMaxValue:null}})}}catch(r){return{type:"mesh-response",meshes:[]}}}_cleanUpQuery(e){const t=T.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),"returnZ"in this.layer&&(t.returnZ??=this.layer.returnZ),"returnM"in this.layer&&(t.returnM??=this.layer.returnM),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=H.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=T.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%fe+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%fe+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?u.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=ce(this.layer.geometryType),i=Y(this.layer),a=[];for(const n of e.added){const e=O(ve(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=O(ve(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),l=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:l,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async updateSchemaStart(){const e=this.layer;"featureReduction"in e&&e.featureReduction&&e.featureReduction!==this._lastFeatureReduction&&(e.featureReduction=e.featureReduction?.clone(),this._lastFeatureReduction=e.featureReduction);try{if(await Promise.allSettled([this._handleChange(),q(e)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptions)return null;const t=this.featureContainer.updateStart("subtype-group"===e.type);this._lastFeatureEffect=this.featureEffect;const r={store:t,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this._createViewSchemaConfig(),i={source:await this.layerAdapter.createSourceSchema(s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)};return c(this._lastSchema?.source.strategy,i.source.strategy)||c(this._lastSchema?.processor,i.processor)?(this._lastSchema=i,this._fields=null,i):null}catch(t){}return null}async updateSchemaEnd(e){try{this.featureEffectView.featureEffect=this._lastFeatureEffect,e&&this.featureEffectView.endTransition(),await this.featureContainer.updateEnd(this._lastSchema.processor,this.layerAdapter.getLabelingDeconflictionInfo(),e),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.updateEnd")}catch(t){}}async _doUpdate(){const e=Math.round(performance.now()),t=await this.getWorker();await t.pipeline.updateSchema(e),this.requestUpdate()}async _doOverride(e){const t=await this.getWorker();try{let r=new le;for(const s of e.messages)switch(s.type){case"edit":r.tryAdd(await this._resolveEdit(s.event))||(await t.pipeline.onOverride(r.toMessage()),r=new le,r.tryAdd(await this._resolveEdit(s.event)));break;case"override":r.tryAdd(this._resolveOverrides(s.options))||(await t.pipeline.onOverride(r.toMessage()),r=new le,r.tryAdd(this._resolveOverrides(s.options)));break}await t.pipeline.onOverride(r.toMessage())}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=ge(this._lastAvailableFields,e);return this._lastAvailableFields=t,C(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[E(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e,spatialReference:this.view.spatialReference,extent:this.view.extent,returnZ:this.hasZ,returnM:this.hasM}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{m(e)||u.getLogger(this).error(e)});this._updatingHandles.consumePromise(r)}_setOriginForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createFeatureGraphicHit(e,t){return this._setOriginForFeature(t),this._createGraphicHit(e,t)}_createTrackGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setTrackGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createAggregateGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setAggregateGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createGraphicHit(e,t){return null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function E(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new U,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new U,i.where=_(i.where,a));let l=i?.toJSON()??null;return s.size&&(l??=(new U).toJSON(),l.hiddenIds=Array.from(s)),l}return e([S()],b.prototype,"_commandsQueue",void 0),e([S()],b.prototype,"_sourceRefreshVersion",void 0),e([S()],b.prototype,"_displayRefreshVersion",void 0),e([S({readOnly:!0})],b.prototype,"_pipelineUpdating",void 0),e([S()],b.prototype,"_sourceUpdating",void 0),e([S({readOnly:!0})],b.prototype,"dataUpdating",null),e([S({readOnly:!0})],b.prototype,"hasAllFeatures",null),e([S({readOnly:!0})],b.prototype,"hasAllFeaturesInView",null),e([S({readOnly:!0})],b.prototype,"hasFullGeometries",null),e([S()],b.prototype,"featureEffectView",void 0),e([S()],b.prototype,"layerAdapter",null),e([S({readOnly:!0})],b.prototype,"timeExtent",null),b=e([A("esri.views.2d.layers.FeatureLikeLayerView2D")],b),b};export{_e as FeatureLikeLayerView2D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import e from"../../../core/Logger.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{watch as h}from"../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../core/accessorSupport/decorators.js";import{GraphicsCollection as p}from"../../../support/GraphicsCollection.js";import{BitmapContainer as o}from"../engine/BitmapContainer.js";import{LayerView2D as g}from"./LayerView2D.js";import l from"./graphics/GraphicsView2D.js";import n from"./graphics/HighlightGraphicContainer.js";import m from"./support/ExportStrategy.js";import d from"../../layers/LayerView.js";import c from"../../layers/MapImageLayerView.js";import{RefreshableLayerView as u}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as f}from"../../layers/support/highlightUtils.js";import{MapServiceLayerViewHelper as y}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as _}from"../../support/drapedUtils.js";import{getHighlightName as H}from"../../support/highlightOptionsUtils.js";let w=class extends(c(u(g(d)))){constructor(){super(...arguments),this._highlightGraphics=new p,this._updateHash=""}fetchPopupFeaturesAtTarget(t,i){return this._popupHighlightHelper.fetchPopupFeaturesAtTarget(t,i)}update(t){const i=`${this.exportImageVersion}/${t.state.id}/${t.pixelRatio}/${t.stationary}`;this._updateHash!==i&&(this._updateHash=i,this.strategy.update(t).catch(t=>{r(t)||e.getLogger(this).error(t)}),t.stationary&&this._popupHighlightHelper.updateHighlightedFeatures(t.state.resolution)),this._highlightView.processUpdate(t)}attach(){const{imageMaxWidth:t,imageMaxHeight:i,version:e}=this.layer,r=e>=10.3,s=e>=10;this._bitmapContainer=new o,this.container.addChild(this._bitmapContainer),this._highlightView=new l({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new n(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1}),this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new y({createFetchPopupFeaturesQueryGeometry:(t,i)=>_(t,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:t,property:i})=>this._highlightView.graphicUpdateHandler({graphic:t,property:i}),layerView:this,updatingHandles:this._updatingHandles}),this.strategy=new m({container:this._bitmapContainer,fetchSource:(t,i,e,r)=>this.fetchImageBitmap(t,i,e,r).then(({bitmap:t})=>t),requestUpdate:this.requestUpdate.bind(this),imageMaxWidth:t,imageMaxHeight:i,imageRotationSupported:r,imageNormalizationSupported:s,hidpi:!0}),this.addAttachHandles(h(()=>this.exportImageVersion,()=>this.requestUpdate())),this.requestUpdate()}detach(){this.strategy.destroy(),this.container.removeAllChildren(),this._bitmapContainer.removeAllChildren(),this._highlightView.destroy(),this._popupHighlightHelper.destroy()}viewChange(){}moveEnd(){this.requestUpdate()}supportsSpatialReference(t){return this.layer.serviceSupportsSpatialReference(t)}async doRefresh(){this._updateHash="",this.requestUpdate()}isUpdating(){return this.strategy.updating||this.updateRequested}fetchImage(t,i,e,r){return this.layer.fetchImage(t,i,e,{timeExtent:this.timeExtent,floors:this.floors,...r})}fetchImageBitmap(t,i,e,r){return this.layer.fetchImageBitmap(t,i,e,{timeExtent:this.timeExtent,floors:this.floors,...r})}highlight(t,e){const r=f(t);if(0===r.length)return i();const h=H(e);return this._addHighlightGraphics(r,h),i(()=>!this.destroyed&&this._removeHighlightGraphics(r,h))}_processHighlight(){const t=this._getHighlights();this._highlightView?.setHighlight(t)}_addHighlightGraphics(t,i){this._highlightGraphics.addMany(t),this._addHighlights(t.map(t=>t.uid),i)}_removeHighlightGraphics(t,i){this._highlightGraphics.removeMany(t),this._removeHighlights(t.map(t=>t.uid),i)}};t([s()],w.prototype,"strategy",void 0),w=t([a("esri.views.2d.layers.MapImageLayerView2D")],w);const j=w;export{j as default};
2
+ import{__decorate as t}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import e from"../../../core/Logger.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{watch as h}from"../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../core/accessorSupport/decorators.js";import{GraphicsCollection as p}from"../../../support/GraphicsCollection.js";import{BitmapContainer as o}from"../engine/BitmapContainer.js";import{LayerView2D as g}from"./LayerView2D.js";import l from"./graphics/GraphicsView2D.js";import n from"./graphics/HighlightGraphicContainer.js";import m from"./support/ExportStrategy.js";import d from"../../layers/LayerView.js";import c from"../../layers/MapImageLayerView.js";import{RefreshableLayerView as u}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as f}from"../../layers/support/highlightUtils.js";import{MapServiceLayerViewHelper as y}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as _}from"../../support/drapedUtils.js";import{getHighlightName as H}from"../../support/highlightOptionsUtils.js";let w=class extends(c(u(g(d)))){constructor(){super(...arguments),this._highlightGraphics=new p,this._updateHash=""}fetchPopupFeaturesAtTarget(t,i,e){return this._popupHighlightHelper.fetchPopupFeaturesAtTarget(i,e)}update(t){const i=`${this.exportImageVersion}/${t.state.id}/${t.pixelRatio}/${t.stationary}`;this._updateHash!==i&&(this._updateHash=i,this.strategy.update(t).catch(t=>{r(t)||e.getLogger(this).error(t)}),t.stationary&&this._popupHighlightHelper.updateHighlightedFeatures(t.state.resolution)),this._highlightView.processUpdate(t)}attach(){const{imageMaxWidth:t,imageMaxHeight:i,version:e}=this.layer,r=e>=10.3,s=e>=10;this._bitmapContainer=new o,this.container.addChild(this._bitmapContainer),this._highlightView=new l({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new n(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1}),this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new y({createFetchPopupFeaturesQueryGeometry:(t,i)=>_(t,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:t,property:i})=>this._highlightView.graphicUpdateHandler({graphic:t,property:i}),layerView:this,updatingHandles:this._updatingHandles}),this.strategy=new m({container:this._bitmapContainer,fetchSource:(t,i,e,r)=>this.fetchImageBitmap(t,i,e,r).then(({bitmap:t})=>t),requestUpdate:this.requestUpdate.bind(this),imageMaxWidth:t,imageMaxHeight:i,imageRotationSupported:r,imageNormalizationSupported:s,hidpi:!0}),this.addAttachHandles(h(()=>this.exportImageVersion,()=>this.requestUpdate())),this.requestUpdate()}detach(){this.strategy.destroy(),this.container.removeAllChildren(),this._bitmapContainer.removeAllChildren(),this._highlightView.destroy(),this._popupHighlightHelper.destroy()}viewChange(){}moveEnd(){this.requestUpdate()}supportsSpatialReference(t){return this.layer.serviceSupportsSpatialReference(t)}async doRefresh(){this._updateHash="",this.requestUpdate()}isUpdating(){return this.strategy.updating||this.updateRequested}fetchImage(t,i,e,r){return this.layer.fetchImage(t,i,e,{timeExtent:this.timeExtent,floors:this.floors,...r})}fetchImageBitmap(t,i,e,r){return this.layer.fetchImageBitmap(t,i,e,{timeExtent:this.timeExtent,floors:this.floors,...r})}highlight(t,e){const r=f(t);if(0===r.length)return i();const h=H(e);return this._addHighlightGraphics(r,h),i(()=>!this.destroyed&&this._removeHighlightGraphics(r,h))}_processHighlight(){const t=this._getHighlights();this._highlightView?.setHighlight(t)}_addHighlightGraphics(t,i){this._highlightGraphics.addMany(t),this._addHighlights(t.map(t=>t.uid),i)}_removeHighlightGraphics(t,i){this._highlightGraphics.removeMany(t),this._removeHighlights(t.map(t=>t.uid),i)}};t([s()],w.prototype,"strategy",void 0),w=t([a("esri.views.2d.layers.MapImageLayerView2D")],w);const j=w;export{j as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{isSome as e}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/CollectionFlattener.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{watch as o,syncAndInitial as a,initial as n}from"../../../core/reactiveUtils.js";import{property as h,subclass as p}from"../../../core/accessorSupport/decorators.js";import c from"../../../rest/support/DirectionLine.js";import l from"../../../rest/support/DirectionPoint.js";import u from"../../../rest/support/PointBarrier.js";import d from"../../../rest/support/PolygonBarrier.js";import _ from"../../../rest/support/PolylineBarrier.js";import m from"../../../rest/support/RouteInfo.js";import g from"../../../rest/support/Stop.js";import{LayerView2D as w}from"./LayerView2D.js";import y from"./graphics/GraphicContainer.js";import f from"./graphics/GraphicsView2D.js";import{RouteLayerInteractiveOptions as v}from"./support/RouteLayerInteractiveOptions.js";import k from"../../layers/LayerView.js";import{getHighlightName as M}from"../../support/highlightOptionsUtils.js";const F=["route-info","direction-line","direction-point","polygon-barrier","polyline-barrier","point-barrier","stop"],I={graphic:null,property:null,oldValue:null,newValue:null};function V(t){return t instanceof c||t instanceof l||t instanceof u||t instanceof d||t instanceof _||t instanceof m||t instanceof g}function G(t){return r.isCollection(t)&&t.length&&V(t.at(0))}function j(t){return Array.isArray(t)&&t.length>0&&V(t[0])}let P=class extends(w(k)){constructor(){super(...arguments),this._graphics=new r,this._networkFeatureMap=new Map,this._networkGraphicMap=new Map,this._interaction=null,this._loadInteractionPromise=null,this.interactive=!1,this.interactiveOptions=new v}get _routeItems(){return new i({getCollections:()=>this.layer&&!this.destroyed?[this.layer.routeInfo?new r([this.layer.routeInfo]):null,this.layer.directionLines,this.layer.directionPoints,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.pointBarriers,this.layer.stops]:[]})}initialize(){this.addHandles(o(()=>{const{interactive:t,suspended:e}=this;return{interactive:t,suspended:e}},({interactive:t,suspended:e})=>{const r=t&&!e;r&&this._getInteractionLoadPromise().then(t=>{t.enabled=this.interactive&&!this.suspended}),this._interaction&&(this._interaction.enabled=r)},a)),this._updatingHandles.addOnCollectionChange(()=>this._routeItems,t=>this._routeItemsChanged(t),n)}destroy(){this._networkFeatureMap.clear(),this._networkGraphicMap.clear(),this._graphics.removeAll(),this._get("_routeItems")?.destroy()}attach(){this._createGraphicsView()}detach(){this._destroyGraphicsView(),this._interaction?.enabled&&(this._interaction.enabled=!1)}get selectedNetworkFeatures(){return this._interaction?.selectedNetworkFeatures??null}async create(t){return this._interaction?.create(t)}delete(){this._interaction?.delete()}async fetchPopupFeaturesAtTarget(t,e){const r=this.view.toScreen(t);return r?this._graphicsView.hitTest(this.view,r).filter(({popupTemplate:t})=>!!t):(console.warn("Invalid screen point",t),[])}highlight(t,r){let i;i=V(t)?[this._getNetworkFeatureUid(t)]:j(t)?t.map(t=>this._getNetworkFeatureUid(t)):G(t)?t.map(t=>this._getNetworkFeatureUid(t)).toArray():[t.uid];const o=i.filter(e);if(!o.length)return s();const a=M(r);return this._addHighlights(o,a),s(()=>this._removeHighlights(o,a))}async hitTest(t,r){if(this.suspended)return null;const i=this._graphicsView.hitTest(this.view,r).filter(e).map(t=>this._networkGraphicMap.get(t));if(!i.length)return null;const{layer:s}=this;return i.reverse().map(e=>({type:"route",layer:s,mapPoint:t,networkFeature:e}))}isUpdating(){return this._graphicsView.updating}moveEnd(){}remove(t){this._interaction?.remove(t)}update(t){this._graphicsView.processUpdate(t)}viewChange(){this._graphicsView.viewChange()}_createGraphic(t){const e=t.toGraphic();return e.layer=this.layer,e.sourceLayer=this.layer,e}_createGraphicsView(){const t=this.view,e=()=>this.requestUpdate(),r=new y(t.featuresTilingScheme);this._graphicsView=new f({container:r,graphics:this._graphics,requestUpdateCallback:e,view:t}),this.container.addChild(r),this._processHighlight()}_destroyGraphicsView(){this.container.removeChild(this._graphicsView.container),this._graphicsView.destroy()}_getDrawOrder(t){const e=this._networkGraphicMap.get(t);return F.indexOf(e.type)}_getInteractionLoadPromise(){return this._loadInteractionPromise||(this._loadInteractionPromise=this._loadInteraction(),this._updatingHandles.consumePromise(this._loadInteractionPromise)),this._loadInteractionPromise}_getNetworkFeatureUid(t){return this._networkFeatureMap.has(t)?this._networkFeatureMap.get(t).uid:null}async _loadInteraction(){const{interactiveOptions:t,layer:e,view:r}=this,{RouteLayerInteraction:i}=await import("./support/RouteLayerInteraction.js");return this._interaction=new i({interactiveOptions:t,layer:e,view:r}),this._interaction}_routeItemsChanged(t){if(t.removed.length){this._graphics.removeMany(t.removed.map(t=>{const e=this._networkFeatureMap.get(t);return this._networkFeatureMap.delete(t),this._networkGraphicMap.delete(e),e}));for(const e of t.removed)this.removeHandles(e)}if(t.added.length){this._graphics.addMany(t.added.map(t=>{const e=this._createGraphic(t);return null==e.symbol?null:(this._networkFeatureMap.set(t,e),this._networkGraphicMap.set(e,t),e)}).filter(e));for(const e of t.added)this.addHandles([o(()=>e.geometry,(t,r)=>{this._updateGraphic(e,"geometry",t,r)}),o(()=>e.symbol,(t,r)=>{this._updateGraphic(e,"symbol",t,r)}),o(()=>e.popupTemplate,t=>{this._networkFeatureMap.has(e)&&(this._networkFeatureMap.get(e).popupTemplate=t)}),o(()=>e.toGraphic().attributes,t=>{this._networkFeatureMap.has(e)&&(this._networkFeatureMap.get(e).attributes=t)})],e);this._graphics.sort((t,e)=>this._getDrawOrder(t)-this._getDrawOrder(e))}}_updateGraphic(t,e,r,i){if(!this._networkFeatureMap.has(t)){const e=this._createGraphic(t);return this._networkFeatureMap.set(t,e),this._networkGraphicMap.set(e,t),void this._graphics.add(e)}const s=this._networkFeatureMap.get(t);s[e]=r,I.graphic=s,I.property=e,I.oldValue=i,I.newValue=r,this._graphicsView.graphicUpdateHandler(I)}_processHighlight(){const t=this._getHighlights();this._graphicsView?.setHighlight(t)}};t([h()],P.prototype,"_routeItems",null),t([h()],P.prototype,"_interaction",void 0),t([h()],P.prototype,"interactive",void 0),t([h({readOnly:!0})],P.prototype,"interactiveOptions",void 0),t([h({readOnly:!0})],P.prototype,"selectedNetworkFeatures",null),P=t([p("esri.views.2d.layers.RouteLayerView2D")],P);const b=P;export{b as default};
2
+ import{__decorate as t}from"tslib";import{isSome as e}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/CollectionFlattener.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{watch as o,syncAndInitial as a,initial as n}from"../../../core/reactiveUtils.js";import{property as h,subclass as p}from"../../../core/accessorSupport/decorators.js";import c from"../../../rest/support/DirectionLine.js";import l from"../../../rest/support/DirectionPoint.js";import u from"../../../rest/support/PointBarrier.js";import d from"../../../rest/support/PolygonBarrier.js";import _ from"../../../rest/support/PolylineBarrier.js";import m from"../../../rest/support/RouteInfo.js";import g from"../../../rest/support/Stop.js";import{LayerView2D as w}from"./LayerView2D.js";import y from"./graphics/GraphicContainer.js";import f from"./graphics/GraphicsView2D.js";import{RouteLayerInteractiveOptions as v}from"./support/RouteLayerInteractiveOptions.js";import k from"../../layers/LayerView.js";import{getHighlightName as M}from"../../support/highlightOptionsUtils.js";const F=["route-info","direction-line","direction-point","polygon-barrier","polyline-barrier","point-barrier","stop"],V={graphic:null,property:null,oldValue:null,newValue:null};function G(t){return t instanceof c||t instanceof l||t instanceof u||t instanceof d||t instanceof _||t instanceof m||t instanceof g}function I(t){return r.isCollection(t)&&t.length&&G(t.at(0))}function j(t){return Array.isArray(t)&&t.length>0&&G(t[0])}let P=class extends(w(k)){constructor(){super(...arguments),this._graphics=new r,this._networkFeatureMap=new Map,this._networkGraphicMap=new Map,this._interaction=null,this._loadInteractionPromise=null,this.interactive=!1,this.interactiveOptions=new v}get _routeItems(){return new i({getCollections:()=>this.layer&&!this.destroyed?[this.layer.routeInfo?new r([this.layer.routeInfo]):null,this.layer.directionLines,this.layer.directionPoints,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.pointBarriers,this.layer.stops]:[]})}initialize(){this.addHandles(o(()=>{const{interactive:t,suspended:e}=this;return{interactive:t,suspended:e}},({interactive:t,suspended:e})=>{const r=t&&!e;r&&this._getInteractionLoadPromise().then(t=>{t.enabled=this.interactive&&!this.suspended}),this._interaction&&(this._interaction.enabled=r)},a)),this._updatingHandles.addOnCollectionChange(()=>this._routeItems,t=>this._routeItemsChanged(t),n)}destroy(){this._networkFeatureMap.clear(),this._networkGraphicMap.clear(),this._graphics.removeAll(),this._get("_routeItems")?.destroy()}attach(){this._createGraphicsView()}detach(){this._destroyGraphicsView(),this._interaction?.enabled&&(this._interaction.enabled=!1)}get selectedNetworkFeatures(){return this._interaction?.selectedNetworkFeatures??null}async create(t){return this._interaction?.create(t)}delete(){this._interaction?.delete()}async fetchPopupFeaturesAtTarget(t,e,r){return this._graphicsView.hitTest(this.view,t).filter(({popupTemplate:t})=>!!t)}highlight(t,r){let i;i=G(t)?[this._getNetworkFeatureUid(t)]:j(t)?t.map(t=>this._getNetworkFeatureUid(t)):I(t)?t.map(t=>this._getNetworkFeatureUid(t)).toArray():[t.uid];const o=i.filter(e);if(!o.length)return s();const a=M(r);return this._addHighlights(o,a),s(()=>this._removeHighlights(o,a))}async hitTest(t,r){if(this.suspended)return null;const i=this._graphicsView.hitTest(this.view,r).filter(e).map(t=>this._networkGraphicMap.get(t));if(!i.length)return null;const{layer:s}=this;return i.reverse().map(e=>({type:"route",layer:s,mapPoint:t,networkFeature:e}))}isUpdating(){return this._graphicsView.updating}moveEnd(){}remove(t){this._interaction?.remove(t)}update(t){this._graphicsView.processUpdate(t)}viewChange(){this._graphicsView.viewChange()}_createGraphic(t){const e=t.toGraphic();return e.layer=this.layer,e.sourceLayer=this.layer,e}_createGraphicsView(){const t=this.view,e=()=>this.requestUpdate(),r=new y(t.featuresTilingScheme);this._graphicsView=new f({container:r,graphics:this._graphics,requestUpdateCallback:e,view:t}),this.container.addChild(r),this._processHighlight()}_destroyGraphicsView(){this.container.removeChild(this._graphicsView.container),this._graphicsView.destroy()}_getDrawOrder(t){const e=this._networkGraphicMap.get(t);return F.indexOf(e.type)}_getInteractionLoadPromise(){return this._loadInteractionPromise||(this._loadInteractionPromise=this._loadInteraction(),this._updatingHandles.consumePromise(this._loadInteractionPromise)),this._loadInteractionPromise}_getNetworkFeatureUid(t){return this._networkFeatureMap.has(t)?this._networkFeatureMap.get(t).uid:null}async _loadInteraction(){const{interactiveOptions:t,layer:e,view:r}=this,{RouteLayerInteraction:i}=await import("./support/RouteLayerInteraction.js");return this._interaction=new i({interactiveOptions:t,layer:e,view:r}),this._interaction}_routeItemsChanged(t){if(t.removed.length){this._graphics.removeMany(t.removed.map(t=>{const e=this._networkFeatureMap.get(t);return this._networkFeatureMap.delete(t),this._networkGraphicMap.delete(e),e}));for(const e of t.removed)this.removeHandles(e)}if(t.added.length){this._graphics.addMany(t.added.map(t=>{const e=this._createGraphic(t);return null==e.symbol?null:(this._networkFeatureMap.set(t,e),this._networkGraphicMap.set(e,t),e)}).filter(e));for(const e of t.added)this.addHandles([o(()=>e.geometry,(t,r)=>{this._updateGraphic(e,"geometry",t,r)}),o(()=>e.symbol,(t,r)=>{this._updateGraphic(e,"symbol",t,r)}),o(()=>e.popupTemplate,t=>{this._networkFeatureMap.has(e)&&(this._networkFeatureMap.get(e).popupTemplate=t)}),o(()=>e.toGraphic().attributes,t=>{this._networkFeatureMap.has(e)&&(this._networkFeatureMap.get(e).attributes=t)})],e);this._graphics.sort((t,e)=>this._getDrawOrder(t)-this._getDrawOrder(e))}}_updateGraphic(t,e,r,i){if(!this._networkFeatureMap.has(t)){const e=this._createGraphic(t);return this._networkFeatureMap.set(t,e),this._networkGraphicMap.set(e,t),void this._graphics.add(e)}const s=this._networkFeatureMap.get(t);s[e]=r,V.graphic=s,V.property=e,V.oldValue=i,V.newValue=r,this._graphicsView.graphicUpdateHandler(V)}_processHighlight(){const t=this._getHighlights();this._graphicsView?.setHighlight(t)}};t([h()],P.prototype,"_routeItems",null),t([h()],P.prototype,"_interaction",void 0),t([h()],P.prototype,"interactive",void 0),t([h({readOnly:!0})],P.prototype,"interactiveOptions",void 0),t([h({readOnly:!0})],P.prototype,"selectedNetworkFeatures",null),P=t([p("esri.views.2d.layers.RouteLayerView2D")],P);const b=P;export{b as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s,waitTick as r}from"../../../core/promiseUtils.js";import{property as h,subclass as a}from"../../../core/accessorSupport/decorators.js";import{equals as o}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as l}from"../../../support/GraphicsCollection.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/Accessor.js";import"../../../core/has.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/RandomLCG.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import p from"./graphics/GraphicsView2D.js";import"../../../layers/effects/EffectView.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/GpuMeshState.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{BitmapTileLayerView2D as n}from"./BitmapTileLayerView2D.js";import{LayerView2D as c}from"./LayerView2D.js";import g from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as m,resampleImage as u}from"./support/imageUtils.js";import d from"../tiling/TileInfoView.js";import f from"../tiling/TileKey.js";import y from"../tiling/TileQueue.js";import w from"../tiling/TileStrategy.js";import j from"../../layers/LayerView.js";import{RefreshableLayerView as _}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as T}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as b,MapServiceLayerViewHelper as V}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as v}from"../../support/drapedUtils.js";import{getHighlightName as U}from"../../support/highlightOptionsUtils.js";import{TaskPriority as H}from"../../support/Scheduler.js";const I=[0,0];let q=class extends(_(n(c(j)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new l,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}get tilemapCache(){return"tilemapCache"in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null,i=this.tilemapCache;if(this._tileInfoView=new d(this.layer.tileInfo,this.layer.fullExtent,i?.effectiveMinLOD,i?.effectiveMaxLOD),this._fetchQueue=new y({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i),scheduler:this.scheduler,priority:H.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new w({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),b(this,this.layer)){const e=this._highlightView=new p({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new g(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new V({createFetchPopupFeaturesQueryGeometry:(e,i)=>v(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:i,property:t})=>e.graphicUpdateHandler({graphic:i,property:t}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtTarget(e,i){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtTarget(e,i):[]}highlight(e,t){const s=T(e);if(0===s.length)return i();const r=U(t);return this._addHighlightGraphics(s,r),i(()=>!this.destroyed&&this._removeHighlightGraphics(s,r))}_processHighlight(){const e=this._getHighlights();this._highlightView?.setHighlight(e)}_addHighlightGraphics(e,i){this._highlightGraphics.addMany(e),this._addHighlights(e.map(e=>e.uid),i)}_removeHighlightGraphics(e,i){this._highlightGraphics.removeMany(e),this._removeHighlights(e.map(e=>e.uid),i)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return o(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){if(this.attached){if(this.suspended)return this._tileStrategy.clear(),void this.requestUpdate();this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))}}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(I,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(i)),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",()=>e.destroy()),this.requestUpdate()}async fetchTile(e,i={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,i):this._fetchTileWithoutTilemapCache(e,i)}async _fetchTileWithoutTilemapCache(e,i={}){const{signal:t,resamplingLevel:r=0}=i;try{return await this._fetchImage(e,t)}catch(h){if(s(h))throw h;if(!this.resampling)return m(this._tileInfoView.size);if(r<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const s=new f(t),h=await this._fetchTileWithoutTilemapCache(s,{...i,resamplingLevel:r+1});return u(this._tileInfoView,h,s,e)}}return m(this._tileInfoView.size)}}async _fetchTileWithTilemapCache(e,i={}){const t=this.tilemapCache,{signal:h,resamplingLevel:a=0}=i,o=new f(0,0,0,0);let l,p=null;try{if(p=await t.fetchAvailabilityUpsample(e.level,e.row,e.col,o,{signal:h}),!this.resampling&&o.level!==e.level)return await r(i),m(this._tileInfoView.size);l=await this._fetchImage(o,h)}catch(n){if(s(n))throw n;if(this.resampling&&"unknown"===p&&a<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){o.set(t);try{l=await this._fetchTileWithTilemapCache(o,{...i,resamplingLevel:a+1})}catch{}}}}return l?this.resampling?u(this._tileInfoView,l,o,e):l:m(this._tileInfoView.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once("attach",()=>this.requestUpdate()),e.once("isReady",()=>this.requestUpdate())}catch(i){s(i)||t.getLogger(this).error(i)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i}).then(({bitmap:e})=>e)}};e([h()],q.prototype,"resampling",null),e([h()],q.prototype,"tilemapCache",null),q=e([a("esri.views.2d.layers.TileLayerView2D")],q);const S=q;export{S as default};
2
+ import{__decorate as e}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s,waitTick as r}from"../../../core/promiseUtils.js";import{property as h,subclass as a}from"../../../core/accessorSupport/decorators.js";import{equals as o}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as l}from"../../../support/GraphicsCollection.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/Accessor.js";import"../../../core/has.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/RandomLCG.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import p from"./graphics/GraphicsView2D.js";import"../../../layers/effects/EffectView.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/GpuMeshState.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{BitmapTileLayerView2D as n}from"./BitmapTileLayerView2D.js";import{LayerView2D as c}from"./LayerView2D.js";import g from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as m,resampleImage as u}from"./support/imageUtils.js";import d from"../tiling/TileInfoView.js";import f from"../tiling/TileKey.js";import y from"../tiling/TileQueue.js";import w from"../tiling/TileStrategy.js";import j from"../../layers/LayerView.js";import{RefreshableLayerView as _}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as T}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as b,MapServiceLayerViewHelper as V}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as v}from"../../support/drapedUtils.js";import{getHighlightName as U}from"../../support/highlightOptionsUtils.js";import{TaskPriority as H}from"../../support/Scheduler.js";const I=[0,0];let q=class extends(_(n(c(j)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new l,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}get tilemapCache(){return"tilemapCache"in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null,i=this.tilemapCache;if(this._tileInfoView=new d(this.layer.tileInfo,this.layer.fullExtent,i?.effectiveMinLOD,i?.effectiveMaxLOD),this._fetchQueue=new y({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i),scheduler:this.scheduler,priority:H.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new w({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),b(this,this.layer)){const e=this._highlightView=new p({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new g(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new V({createFetchPopupFeaturesQueryGeometry:(e,i)=>v(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:i,property:t})=>e.graphicUpdateHandler({graphic:i,property:t}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtTarget(e,i,t){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtTarget(i,t):[]}highlight(e,t){const s=T(e);if(0===s.length)return i();const r=U(t);return this._addHighlightGraphics(s,r),i(()=>!this.destroyed&&this._removeHighlightGraphics(s,r))}_processHighlight(){const e=this._getHighlights();this._highlightView?.setHighlight(e)}_addHighlightGraphics(e,i){this._highlightGraphics.addMany(e),this._addHighlights(e.map(e=>e.uid),i)}_removeHighlightGraphics(e,i){this._highlightGraphics.removeMany(e),this._removeHighlights(e.map(e=>e.uid),i)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return o(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){if(this.attached){if(this.suspended)return this._tileStrategy.clear(),void this.requestUpdate();this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))}}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(I,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(i)),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",()=>e.destroy()),this.requestUpdate()}async fetchTile(e,i={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,i):this._fetchTileWithoutTilemapCache(e,i)}async _fetchTileWithoutTilemapCache(e,i={}){const{signal:t,resamplingLevel:r=0}=i;try{return await this._fetchImage(e,t)}catch(h){if(s(h))throw h;if(!this.resampling)return m(this._tileInfoView.size);if(r<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const s=new f(t),h=await this._fetchTileWithoutTilemapCache(s,{...i,resamplingLevel:r+1});return u(this._tileInfoView,h,s,e)}}return m(this._tileInfoView.size)}}async _fetchTileWithTilemapCache(e,i={}){const t=this.tilemapCache,{signal:h,resamplingLevel:a=0}=i,o=new f(0,0,0,0);let l,p=null;try{if(p=await t.fetchAvailabilityUpsample(e.level,e.row,e.col,o,{signal:h}),!this.resampling&&o.level!==e.level)return await r(i),m(this._tileInfoView.size);l=await this._fetchImage(o,h)}catch(n){if(s(n))throw n;if(this.resampling&&"unknown"===p&&a<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){o.set(t);try{l=await this._fetchTileWithTilemapCache(o,{...i,resamplingLevel:a+1})}catch{}}}}return l?this.resampling?u(this._tileInfoView,l,o,e):l:m(this._tileInfoView.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once("attach",()=>this.requestUpdate()),e.once("isReady",()=>this.requestUpdate())}catch(i){s(i)||t.getLogger(this).error(i)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i}).then(({bitmap:e})=>e)}};e([h()],q.prototype,"resampling",null),e([h()],q.prototype,"tilemapCache",null),q=e([a("esri.views.2d.layers.TileLayerView2D")],q);const S=q;export{S as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{createScreenPoint as a,pt2px as l}from"../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../core/accessorSupport/decorators.js";import{diff as h,hasDiff as y}from"../../../core/accessorSupport/diffUtils.js";import u from"../../../geometry/Point.js";import{create as c}from"../../../geometry/support/aaBoundingRect.js";import{equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{isVectorTileGraphicOrigin as p}from"../../../graphic/isVectorTileGraphicOrigin.js";import{tileSizeInTileUnits as _,tileSizeInPixels as f}from"../engine/vectorTiles/constants.js";import{TileHandler as g}from"../engine/vectorTiles/TileHandler.js";import{TileManager as m}from"../engine/vectorTiles/TileManager.js";import{VectorTile as T}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as C}from"../engine/vectorTiles/VectorTileContainer.js";import v from"../engine/vectorTiles/VectorTileFeatureIndex.js";import w from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2D as R}from"./LayerView2D.js";import{isScreenRect as H}from"../support/hitTestUtils.js";import I from"../tiling/TileInfoViewPOT.js";import Q from"../tiling/TileQueue.js";import S from"../../layers/VectorTileLayerView.js";import{TaskPriority as P}from"../../support/Scheduler.js";const b=2.5;let V=class extends(R(S)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return(this._vectorTileContainer?.fading||this._tileManager?.isFading())??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=[];if(H(t)){const e=t;r=[a(e.x,e.y+e.height),a(e.x+e.width,e.y+e.height),a(e.x+e.width,e.y),a(e.x,e.y)]}else r=[t];const n=has("esri-vtl-search-tolerance")??0,o=n>0?n:b,h=this.view.state,{rotation:y,pixelRatio:u}=this.view.state,c=l(o)*u;let d=null;const p=this._vectorTileContainer?.symbolRepository;p&&(d=p.querySymbols(r[0],c,s.decluttererOffset,{}));const _=this._tileManager.getIntersectingTiles(r[0].x,r[0].y,c,h,d);if(d=d?.filter(e=>this._styleRepository.getStyleLayerVisibility(e.styleLayerUID)),(!_||0===_.length)&&0===d?.length)return null;e=e.clone().normalize();const f=[],g=[];for(const a of _)f.push(this._queryTile(g,e,c,y,a,d?.filter(e=>e.tileKey.id===a.id)));return await Promise.all(f),g}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new w(e),this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new C(this._tileInfoView),this._tileHandler=new g(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=h(i.layout,e.layout);if(null!=s){if(y(s,"visibility")&&1===D(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return d(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.consumePromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new m({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:P.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:P.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(o){i.getLogger(this).error("error applying vector-tiles style update",o.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set,r=new Set;for(const i of e){if(3!==i.type&&2!==i.type)continue;const e=2===i.type?i.data.layer.id:i.data.layer,a=t.getLayerById(e);a&&(s.add(a.uid),3===a.type&&r.add(a.uid))}const a=this._vectorTileContainer.children,l=this._vectorTileContainer?.symbolFader?.symbolRepository;l&&r.size>0&&l.deleteStyleLayers(Array.from(r));const n=new Set;if(e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&n.add(e.uid)}}),s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),n.size>0){const e=Array.from(n),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new w(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new m({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(c(),e),i=this._tileInfoView.getTileResolution(e.level);return new T(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),[n,o,h,y]=this._tileInfoView.getTileBounds(c(),r.key,!0),u=_*((t.x-n)/(h-n)),d=_*(1-(t.y-o)/(y-o)),g=i*(_/f),m=await l.queryAttributes(u,d,g,s,a);for(const c of m)c.graphic.geometry=this._tileToMapPoint(c.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:c.graphic,mapPoint:t.clone()});e.sort((e,t)=>(p(t.graphic.origin)?t.graphic.origin.layerIndex:0)-(p(e.graphic.origin)?e.graphic.origin.layerIndex:0))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new u({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=v.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function D(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([n()],V.prototype,"_isTileHandlerReady",void 0),V=e([o("esri.views.2d.layers.VectorTileLayerView2D")],V);const j=V;export{j as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{createScreenPoint as a,isScreenRect as l,pt2px as n}from"../../../core/screenUtils.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{diff as y,hasDiff as u}from"../../../core/accessorSupport/diffUtils.js";import c from"../../../geometry/Point.js";import{create as d}from"../../../geometry/support/aaBoundingRect.js";import{equals as p}from"../../../geometry/support/spatialReferenceUtils.js";import{isVectorTileGraphicOrigin as _}from"../../../graphic/isVectorTileGraphicOrigin.js";import{tileSizeInTileUnits as f,tileSizeInPixels as g}from"../engine/vectorTiles/constants.js";import{TileHandler as m}from"../engine/vectorTiles/TileHandler.js";import{TileManager as T}from"../engine/vectorTiles/TileManager.js";import{VectorTile as C}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as v}from"../engine/vectorTiles/VectorTileContainer.js";import w from"../engine/vectorTiles/VectorTileFeatureIndex.js";import R from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2D as H}from"./LayerView2D.js";import I from"../tiling/TileInfoViewPOT.js";import Q from"../tiling/TileQueue.js";import S from"../../layers/VectorTileLayerView.js";import{TaskPriority as P}from"../../support/Scheduler.js";const b=2.5;let V=class extends(H(S)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return(this._vectorTileContainer?.fading||this._tileManager?.isFading())??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=[];if(l(t)){const e=t;r=[a(e.x,e.y+e.height),a(e.x+e.width,e.y+e.height),a(e.x+e.width,e.y),a(e.x,e.y)]}else r=[t];const o=has("esri-vtl-search-tolerance")??0,h=o>0?o:b,y=this.view.state,{rotation:u,pixelRatio:c}=this.view.state,d=n(h)*c;let p=null;const _=this._vectorTileContainer?.symbolRepository;_&&(p=_.querySymbols(r[0],d,s.decluttererOffset,{}));const f=this._tileManager.getIntersectingTiles(r[0].x,r[0].y,d,y,p);if(p=p?.filter(e=>this._styleRepository.getStyleLayerVisibility(e.styleLayerUID)),(!f||0===f.length)&&0===p?.length)return null;e=e.clone().normalize();const g=[],m=[];for(const a of f)g.push(this._queryTile(m,e,d,u,a,p?.filter(e=>e.tileKey.id===a.id)));return await Promise.all(g),m}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new R(e),this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new v(this._tileInfoView),this._tileHandler=new m(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=y(i.layout,e.layout);if(null!=s){if(u(s,"visibility")&&1===D(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return p(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.consumePromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:P.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:P.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(o){i.getLogger(this).error("error applying vector-tiles style update",o.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set,r=new Set;for(const i of e){if(3!==i.type&&2!==i.type)continue;const e=2===i.type?i.data.layer.id:i.data.layer,a=t.getLayerById(e);a&&(s.add(a.uid),3===a.type&&r.add(a.uid))}const a=this._vectorTileContainer.children,l=this._vectorTileContainer?.symbolFader?.symbolRepository;l&&r.size>0&&l.deleteStyleLayers(Array.from(r));const n=new Set;if(e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&n.add(e.uid)}}),s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),n.size>0){const e=Array.from(n),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new R(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(d(),e),i=this._tileInfoView.getTileResolution(e.level);return new C(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),[n,o,h,y]=this._tileInfoView.getTileBounds(d(),r.key,!0),u=f*((t.x-n)/(h-n)),c=f*(1-(t.y-o)/(y-o)),p=i*(f/g),m=await l.queryAttributes(u,c,p,s,a);for(const d of m)d.graphic.geometry=this._tileToMapPoint(d.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:d.graphic,mapPoint:t.clone()});e.sort((e,t)=>(_(t.graphic.origin)?t.graphic.origin.layerIndex:0)-(_(e.graphic.origin)?e.graphic.origin.layerIndex:0))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new c({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=w.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function D(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([o()],V.prototype,"_isTileHandlerReady",void 0),V=e([h("esri.views.2d.layers.VectorTileLayerView2D")],V);const j=V;export{j as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{effectFlag0 as i,filterFlag0 as n}from"../../engine/webgl/definitions.js";import a from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as o}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as h}from"./FeatureTilePresentStrategy.js";import{RenderState as u}from"./RenderState.js";import{renderHighlight as l}from"../support/util.js";import{createHittestQuery as d}from"../../support/hitTestUtils.js";class c{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class p{constructor(e,t){this.id=e,this.version=t}}class f extends r{constructor(e){super(e.view.featuresTilingScheme),this._updatingChildren=s(!1),this._hitTestsRequests=[],this._renderState=s(null),this._renderStateNext=s(null),this._store=new a,this._subscriptions=new Map,this._presentation=new h,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value)}get batching(){return has("featurelayer-strict-draw-order")?1:has("featurelayer-force-marker-text-draw-order")?2:0}get updating(){const e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,s=!!this._renderStateNext.value,r=this.attributeView.updating;return e||t||s||r}subscriptions(){return this._subscriptions.values()}get hasLabels(){return null!==this.labelSchema}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw new Error("InternalError: DeconflictionInfo not defined. Was update called?");return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&o.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(_(t))return t;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){const e=new Set;for(const t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(const t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(const e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 16:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&"dictionary"!==this._schema?.mesh.factory.symbology.type,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,s){return this._updateResolver=new c({schema:e,deconflictionInfo:t,invalidateMesh:s}),this.requestRender(),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this.requestDeclutter()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe){if(!this._subscriptions.has(t)){const e=new p(t,s);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=s}for(const t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){const t=this.attributeView.getFilterFlags(e),s=t&n,r=null==this._layerView.featureEffectView.featureEffect||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&i;return!(s&&r)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw new Error("InternalError: renderStateNext already exists");has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new u(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this,this.tilingScheme)}async swapRenderState(){if(!this._renderStateNext.value)throw new Error("InternalError: renderStateNext not yet created");if(this._renderStateSwapResolver)throw new Error("InternalError: renderState swap already in progress");this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,s){t(s);const r=e.inner;if(!this._subscriptions.has(r.id))return;const i=this._subscriptions.get(r.id);if(i.version!==r.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${r.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${r.id}] FeatureContainer - Dropping message, outdated version]`,r)}return}const n=this._renderStateNext.value??this._renderState.value;if(!n)throw new Error("InternalError: No renderState defined");n.version!==r.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${r.version}]`),n.enqueueUpdate(e),this.requestRender()}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}hitTest(e){const t=d(e);if(!t)return console.warn("Unexpected hittest input:",e),Promise.resolve({trueHitIds:[],candidateHitIds:[]});let s=this._hitTestsRequests.find(({query:e})=>t.hittestType===e.hittestType&&t.input===e.input);const r=Promise.withResolvers();return s?s.resolvers.push(r):(s={query:t,resolvers:[r]},this._hitTestsRequests.push(s)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach((e,t)=>s.set(t,e)),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layerView.layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=o.heatmap.getStencilReference(t)}_finializeUpdate(){if(!this._updateResolver)return;const{schema:e,deconflictionInfo:t,invalidateMesh:s}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),s&&(this.restartAllAnimations(),this.swapRenderState());const r="heatmap"===e.mesh.factory.symbology.type?"target-defer":"eager";this._presentation.updateStrategy(r),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);const e=this._renderState.value,t=new Set,s=new Set;for(const r of e?.tiles()??[])r.decluttering&&t.add(r.id),r.presenting&&s.add(r.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(const r of this._renderState.value.tiles())t.has(r.id)&&(r.decluttering=!0),s.has(r.id)&&(r.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&l(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.boundFramebuffer,i=t.getViewport(),n=e.passOptions,a=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=8;const{distance:o,smallSymbolDistance:h}=e.passOptions,u=Math.max(o,h),l=e.passOptions.hittestType;for(const d of this.children)d.visible&&("rect"===l?d.containsScreenRect(e.state,e.passOptions.tlbr)&&this._renderTile(d,e,0):d.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(d,e,0));s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(i),e.passOptions=n,e.drawPhase=a}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,19);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){t.selection=s,e.getDisplayList()?.render(t,r)}}function _(e){return 19===e.techniqueRef.type}export{f as FeatureContainer};
2
+ import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{effectFlag0 as i,filterFlag0 as n}from"../../engine/webgl/definitions.js";import a from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as o}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as h}from"./FeatureTilePresentStrategy.js";import{RenderState as u}from"./RenderState.js";import{renderHighlight as l}from"../support/util.js";import{createHittestQuery as d}from"../../support/hitTestUtils.js";class c{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class p{constructor(e,t){this.id=e,this.version=t}}class f extends r{constructor(e){super(e.view.featuresTilingScheme),this.referenceScale=null,this._updatingChildren=s(!1),this._hitTestsRequests=[],this._renderState=s(null),this._renderStateNext=s(null),this._store=new a,this._subscriptions=new Map,this._presentation=new h,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value)}get batching(){return has("featurelayer-strict-draw-order")?1:has("featurelayer-force-marker-text-draw-order")?2:0}get updating(){const e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,s=!!this._renderStateNext.value,r=this.attributeView.updating;return e||t||s||r}subscriptions(){return this._subscriptions.values()}get hasLabels(){return null!==this.labelSchema}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw new Error("InternalError: DeconflictionInfo not defined. Was update called?");return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&o.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(_(t))return t;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){const e=new Set;for(const t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(const t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(const e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 16:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&"dictionary"!==this._schema?.mesh.factory.symbology.type,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,s){return this._updateResolver=new c({schema:e,deconflictionInfo:t,invalidateMesh:s}),this.requestRender(),e.mesh.factory.referenceScale&&(this.referenceScale=e.mesh.factory.referenceScale),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this.requestDeclutter()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe){if(!this._subscriptions.has(t)){const e=new p(t,s);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=s}for(const t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){const t=this.attributeView.getFilterFlags(e),s=t&n,r=null==this._layerView.featureEffectView.featureEffect||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&i;return!(s&&r)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw new Error("InternalError: renderStateNext already exists");has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new u(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this,this.tilingScheme)}async swapRenderState(){if(!this._renderStateNext.value)throw new Error("InternalError: renderStateNext not yet created");if(this._renderStateSwapResolver)throw new Error("InternalError: renderState swap already in progress");this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,s){t(s);const r=e.inner;if(!this._subscriptions.has(r.id))return;const i=this._subscriptions.get(r.id);if(i.version!==r.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${r.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${r.id}] FeatureContainer - Dropping message, outdated version]`,r)}return}const n=this._renderStateNext.value??this._renderState.value;if(!n)throw new Error("InternalError: No renderState defined");n.version!==r.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${r.version}]`),n.enqueueUpdate(e),this.requestRender()}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}hitTest(e){const t=d(e);if(!t)return console.warn("Unexpected hittest input:",e),Promise.resolve({trueHitIds:[],candidateHitIds:[]});let s=this._hitTestsRequests.find(({query:e})=>t.hittestType===e.hittestType&&t.input===e.input);const r=Promise.withResolvers();return s?s.resolvers.push(r):(s={query:t,resolvers:[r]},this._hitTestsRequests.push(s)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach((e,t)=>s.set(t,e)),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layerView.layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=o.heatmap.getStencilReference(t)}createRenderParams(e){const t=super.createRenderParams(e);return t.referenceScale=this.referenceScale,t}_finializeUpdate(){if(!this._updateResolver)return;const{schema:e,deconflictionInfo:t,invalidateMesh:s}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),s&&(this.restartAllAnimations(),this.swapRenderState());const r="heatmap"===e.mesh.factory.symbology.type?"target-defer":"eager";this._presentation.updateStrategy(r),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);const e=this._renderState.value,t=new Set,s=new Set;for(const r of e?.tiles()??[])r.decluttering&&t.add(r.id),r.presenting&&s.add(r.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(const r of this._renderState.value.tiles())t.has(r.id)&&(r.decluttering=!0),s.has(r.id)&&(r.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&l(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.boundFramebuffer,i=t.getViewport(),n=e.passOptions,a=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=8;const{distance:o,smallSymbolDistance:h}=e.passOptions,u=Math.max(o,h),l=e.passOptions.hittestType;for(const d of this.children)d.visible&&("rect"===l?d.containsScreenRect(e.state,e.passOptions.tlbr)&&this._renderTile(d,e,0):d.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(d,e,0));s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(i),e.passOptions=n,e.drawPhase=a}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,19);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){t.selection=s,e.getDisplayList()?.render(t,r)}}function _(e){return 19===e.techniqueRef.type}export{f as FeatureContainer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{notDeepEqual as t}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r,after as i}from"../../../../core/promiseUtils.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as o}from"../../../../core/workers/utils.js";import{normalizeTransform as n,quantizeX as c,quantizeY as h}from"../../../../geometry/support/quantizationUtils.js";import{MultiTileMeshData as u}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as g}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as p}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as y}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as d}from"../../engine/webgl/util/MatcherContext.js";import{ProcessorTileMessageQueue as _}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as l}from"./processor/BinningStrategy.js";import{ClusterStrategy as m}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as f}from"./processor/FeatureUpdateStrategy.js";import{TrackStrategy as b}from"./processor/TrackStrategy.js";import{AttributeStore as w}from"./support/AttributeStore.js";import{ComputedAttributeStorage as S}from"./support/ComputedAttributeStorage.js";class j{constructor(e,t,s,r){this._connection=e,this._source=t,this._requiredLevel=s,this._requiredScale=r,this._version=1,this._registry=new y,this._proxy=new p({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t)}),this._attributeStore=new w({isLocal:!1,update:e=>o(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get hasClusters(){return"cluster"===this._schema?.mesh.strategy.type}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let e=0;return e+=this._attributeStore.usedMemory,this._strategy&&(e+=this._strategy.usedMemory),e}get version(){return this._version}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[],tracks:[]}}getDisplayIds(e){const t={};return this._strategy?(this._strategy.displayMap(e,e=>e,(e,s,r)=>{t[r]=e}),t):t}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}requiresInvalidation(e){return this._strategy?.requiresInvalidation(e)??!1}updateRequiredLevel(e,t){this._strategy?.updateRequiredLevel(e,t),this._requiredLevel=e,this._requiredScale=t}async update(e,s,r,i,o){const n=e.processor,c=t(this._schema?.storage,n.storage),h=t(this._schema?.mesh.properties,n.mesh.properties),u=t(this._schema?.mesh.factory,n.mesh.factory),p=t(this._schema?.mesh.strategy,n.mesh.strategy),y=I(this._schema?.expressionProperties,n.expressionProperties),_=y.some(e=>this._attributeStore.hasArcadeDependency(e)),l=y.some(e=>this._factory?.hasArcadeDependency(e)??!1),m=y.some(e=>this._strategy?.hasArcadeDependency(e))||this._strategy?.isAggregate&&_,f=l||m,b=h||u||p;if(!(c||b||(l||_||m))&&!i)return!1;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:a(this._schema,n),schema:n}),this._schema=n;const w=new S({fields:this._source.metadata.fieldsIndex,spatialReference:this._source.metadata.outSpatialReference}),j={currentUser:n.mesh.properties.currentUser};if((c||b||_)&&(await this._attributeStore.update(n.storage,w,this._source.metadata,s),this._strategy?.invalidateAttributeData(v(n))),!i&&!b&&!f)return!1;(p||h||f)&&await this._updateStrategy(n.mesh.strategy,o,v(n),j),this._updateSortKey(w,"sortKey"in n.mesh.properties?n.mesh.properties.sortKey:null);const x="dictionary"===n.mesh.factory.symbology.type?n.mesh.factory.symbology.fieldMap:null,M=new d(w,this._proxy,r,this._registry,x);return(u||"dictionary"===n.mesh.factory.symbology.type)&&(this._factory=await g.create(M,n.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(e,t){if(!this._strategy)return;const s=this._strategy.applyOverrideUpdate(e);for await(const i of s)try{await this._process(i,t)}catch(r){}}async updateChunks(e,t,s){await this._doUpdateChunks(e,t,s),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(e.map(({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1})),e);const t=this._strategy.displayMap(e,({objectId:e})=>e,(e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t}));this._attributeStore.setHighlight(t,e)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(e,t,r){if(!this._strategy)return;const i=this._strategy.updateChunks(e,t),a=[],o=new Map;for await(const c of i){let e=o.get(c.id);null==e&&(e=new _({concurrency:16,process:e=>this._process(e,r)}),o.set(c.id,e));const t=e.push(c).catch(e=>s(e));a.push(t)}try{await Promise.all(a)}catch(n){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(e,t,s,r){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new f(this._source,this._attributeStore,s,r);break;case"binning":this._strategy=await l.create(e,this._source,this._attributeStore,s,r);break;case"cluster":this._strategy=await m.create(this._connection,e,this._source,this._attributeStore,s,r,this._requiredLevel,this._requiredScale);break;case"track":this._strategy=await b.create(e,this._source,this._attributeStore,s,r)}for(const i of t)this._strategy.onSubscribe(i)}async _updateSortKey(t,s){if(this._sortInfo=e(this._sortInfo?.computed),null!=s){const e=s.byRenderer?null:await t.createComputedField(s);this._sortInfo={...s,computed:e}}}async _process(e,t){const s=e.subscription;if(has("esri-2d-update-debug")){const t=s.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${e.end}] Processor._process`)}const i={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(e,i),r(s.signal);const a=await this._write(e,s.tile.createArcadeEvaluationOptions(v(this._schema)),i,t),o=s.tile.tileInfoView.getLODInfoAt(s.tile.key);r(s.signal);const{message:n,transferList:c}=a.serialize(o),h={objectIdMap:null,inner:e.createMessage(n,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){h.objectIdMap={};const t=e.reader?.getCursor();if(t)for(;t.next();)h.objectIdMap[t.getDisplayId()]=t.getObjectId()}if(r(s.signal),await this._connection.container.onMessage(h,{signal:s.signal,transferList:c}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const t=s.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${e.end}] Processor._process.await`)}}async _fetchResources(e,t){await this._fetchMatcherResources(e),await this._fetchWriterResources(e,t)}async _fetchMatcherResources(e){if(e.reader)return this._factory.enqueueMatcherRequests(this._proxy,e.reader)}async _fetchWriterResources(e,t){if(!e.reader)return;const s=e.reader.getCursor(),r=e.subscription.tile.createArcadeEvaluationOptions(v(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,t);await this._proxy.fetchEnqueuedResources()}async _write(e,t,s,a){const o=e.subscription.tile,n=e.reader?.getCursor(),c=n?.getSize()??0,h=o.tileInfoView.tileInfo.isWrappable,g=o.tileInfoView.spatialReference.isWGS84,p=new u(o.key,this._strategy.enablePixelBuffering,h,g,c);if(!n)return p;const y=x(o.transform,a),d=o.createArcadeEvaluationOptions(v(this._schema));let _=0;for(;n.next();){++_%1e3||(await i(0),r(e.subscription));const a=this._getSortKeyValue(n,t);p.entityStart(n.getDisplayId(),a);try{this._factory.write(p,this._proxy,n,d,s,o.level,y)}catch(l){}p.entityEnd()}return p}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function I(e,t){const s=[];return e?.timeExtent?.start===t.timeExtent?.start&&e?.timeExtent?.end===t.timeExtent?.end||s.push("timeProperties"),s}function v(e){const{timeZone:t}=e?.mesh.properties??{},{timeExtent:s}=e?.expressionProperties??{};return{timeZone:t,timeExtent:s}}function x(e,t){const s=n(e),r=[];for(const i of t.rings){const e=[];for(const t of i)e.push([c(s,t[0]),h(s,t[1])]);r.push(e)}return{rings:r}}export{j as default};
2
+ import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{notDeepEqual as t}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r,after as i}from"../../../../core/promiseUtils.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as o}from"../../../../core/workers/utils.js";import{normalizeTransform as n,quantizeX as c,quantizeY as h}from"../../../../geometry/support/quantizationUtils.js";import{MultiTileMeshData as u}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as p}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as g}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as d}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as y}from"../../engine/webgl/util/MatcherContext.js";import{ProcessorTileMessageQueue as _}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as l}from"./processor/BinningStrategy.js";import{ClusterStrategy as m}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as f}from"./processor/FeatureUpdateStrategy.js";import{TrackStrategy as b}from"./processor/TrackStrategy.js";import{AttributeStore as w}from"./support/AttributeStore.js";import{ComputedAttributeStorage as S}from"./support/ComputedAttributeStorage.js";class j{constructor(e,t,s,r){this._connection=e,this._source=t,this._requiredLevel=s,this._requiredScale=r,this._version=1,this._registry=new d,this._proxy=new g({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t),fetchMesh:(e,t)=>this._connection.layerView.fetchMesh(e,t)}),this._attributeStore=new w({isLocal:!1,update:e=>o(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get hasClusters(){return"cluster"===this._schema?.mesh.strategy.type}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let e=0;return e+=this._attributeStore.usedMemory,this._strategy&&(e+=this._strategy.usedMemory),e}get version(){return this._version}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[],tracks:[]}}getDisplayIds(e){const t={};return this._strategy?(this._strategy.displayMap(e,e=>e,(e,s,r)=>{t[r]=e}),t):t}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}requiresInvalidation(e){return this._strategy?.requiresInvalidation(e)??!1}updateRequiredLevel(e,t){this._strategy?.updateRequiredLevel(e,t),this._requiredLevel=e,this._requiredScale=t}async update(e,s,r,i,o){const n=e.processor,c=t(this._schema?.storage,n.storage),h=t(this._schema?.mesh.properties,n.mesh.properties),u=t(this._schema?.mesh.factory,n.mesh.factory),g=t(this._schema?.mesh.strategy,n.mesh.strategy),d=v(this._schema?.expressionProperties,n.expressionProperties),_=d.some(e=>this._attributeStore.hasArcadeDependency(e)),l=d.some(e=>this._factory?.hasArcadeDependency(e)??!1),m=d.some(e=>this._strategy?.hasArcadeDependency(e))||this._strategy?.isAggregate&&_,f=l||m,b=h||u||g;if(!(c||b||(l||_||m))&&!i)return!1;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:a(this._schema,n),schema:n}),this._schema=n;const w=new S({fields:this._source.metadata.fieldsIndex,spatialReference:this._source.metadata.outSpatialReference}),j={currentUser:n.mesh.properties.currentUser};if((c||b||_)&&(await this._attributeStore.update(n.storage,w,this._source.metadata,s),this._strategy?.invalidateAttributeData(I(n))),!i&&!b&&!f)return!1;(g||h||f)&&await this._updateStrategy(n.mesh.strategy,o,I(n),j),this._updateSortKey(w,"sortKey"in n.mesh.properties?n.mesh.properties.sortKey:null);const M="dictionary"===n.mesh.factory.symbology.type?n.mesh.factory.symbology.fieldMap:null,x=new y(w,this._proxy,r,this._registry,M);return(u||"dictionary"===n.mesh.factory.symbology.type)&&(this._factory=await p.create(x,n.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(e,t){if(!this._strategy)return;const s=this._strategy.applyOverrideUpdate(e);for await(const i of s)try{await this._process(i,t)}catch(r){}}async updateChunks(e,t,s){await this._doUpdateChunks(e,t,s),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(e.map(({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1})),e);const t=this._strategy.displayMap(e,({objectId:e})=>e,(e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t}));this._attributeStore.setHighlight(t,e)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(e,t,r){if(!this._strategy)return;const i=this._strategy.updateChunks(e,t),a=[],o=new Map;for await(const c of i){let e=o.get(c.id);null==e&&(e=new _({concurrency:16,process:e=>this._process(e,r)}),o.set(c.id,e));const t=e.push(c).catch(e=>s(e));a.push(t)}try{await Promise.all(a)}catch(n){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(e,t,s,r){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new f(this._source,this._attributeStore,s,r);break;case"binning":this._strategy=await l.create(e,this._source,this._attributeStore,s,r);break;case"cluster":this._strategy=await m.create(this._connection,e,this._source,this._attributeStore,s,r,this._requiredLevel,this._requiredScale);break;case"track":this._strategy=await b.create(e,this._source,this._attributeStore,s,r)}for(const i of t)this._strategy.onSubscribe(i)}async _updateSortKey(t,s){if(this._sortInfo=e(this._sortInfo?.computed),null!=s){const e=s.byRenderer?null:await t.createComputedField(s);this._sortInfo={...s,computed:e}}}async _process(e,t){const s=e.subscription;if(has("esri-2d-update-debug")){const t=s.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${e.end}] Processor._process`)}const i={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(e,i),r(s.signal);const a=await this._write(e,s.tile.createArcadeEvaluationOptions(I(this._schema)),i,t),o=s.tile.tileInfoView.getLODInfoAt(s.tile.key);r(s.signal);const{message:n,transferList:c}=a.serialize(o),h={objectIdMap:null,inner:e.createMessage(n,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){h.objectIdMap={};const t=e.reader?.getCursor();if(t)for(;t.next();)h.objectIdMap[t.getDisplayId()]=t.getObjectId()}if(r(s.signal),await this._connection.container.onMessage(h,{signal:s.signal,transferList:c}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const t=s.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${e.end}] Processor._process.await`)}}async _fetchResources(e,t){await this._fetchMatcherResources(e),await this._fetchWriterResources(e,t)}async _fetchMatcherResources(e){if(!e.reader)return;const t=e.subscription.tile.createArcadeEvaluationOptions(I(this._schema));return this._factory.enqueueMatcherRequests(this._proxy,e.reader,{scale:t.$view.scale,viewingMode:"2d"},e.id)}async _fetchWriterResources(e,t){if(!e.reader)return;const s=e.reader.getCursor(),r=e.subscription.tile.createArcadeEvaluationOptions(I(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,t);await this._proxy.fetchEnqueuedResources()}async _write(e,t,s,a){const o=e.subscription.tile,n=e.reader?.getCursor(),c=n?.getSize()??0,h=o.tileInfoView.tileInfo.isWrappable,p=o.tileInfoView.spatialReference.isWGS84,g=this._schema?.mesh.factory.referenceScale,d=new u(o.key,this._strategy.enablePixelBuffering,h,p,c);if(!n)return d;const y=M(o.transform,a),_=o.createArcadeEvaluationOptions(I(this._schema));let l=0;for(;n.next();){++l%1e3||(await i(0),r(e.subscription));const a=this._getSortKeyValue(n,t);d.entityStart(n.getDisplayId(),a);try{this._factory.write(d,this._proxy,n,_,s,o.level,y,g)}catch(m){}d.entityEnd()}return d}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function v(e,t){const s=[];return e?.timeExtent?.start===t.timeExtent?.start&&e?.timeExtent?.end===t.timeExtent?.end||s.push("timeProperties"),s}function I(e){const{timeZone:t}=e?.mesh.properties??{},{timeExtent:s}=e?.expressionProperties??{};return{timeZone:t,timeExtent:s}}function M(e,t){const s=n(e),r=[];for(const i of t.rings){const e=[];for(const t of i)e.push([c(s,t[0]),h(s,t[1])]);r.push(e)}return{rings:r}}export{j as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{clone as e}from"../../../../../core/lang.js";import{sqlAnd as t}from"../../../../../core/sql.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{createFeatureIdInfo as s}from"./featureServiceUtils.js";import{getServiceGeometryType as i}from"./geometryUtils.js";import{ExceedsLimitCache as a}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as o,createFeatureSourceSchema as n}from"../schema/SourceSchema.js";import{getSortKey as l}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as c}from"../schema/processor/StorageSchema.js";import{getAnnotationMatcherSchema as p}from"../../support/annodime/annotationSchema.js";import{annotationRealFields as y,annotationVirtualFields as u}from"../../support/annodime/fields.js";import{getReferenceScale as d}from"../../support/annodime/utils.js";class m{constructor(e){this.layer=e,this._cache=new a}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,r){const s=this._createServiceInfo(e),i=null!=this.layer.editingInfo?.lastEditDate,a=this.layer.refreshInterval>0,l=!i&&a,c=o("isSourceHosted"in s&&s.isSourceHosted,l,this.layer.capabilities,s.metadata.geometryType,e.extent,this.layer.fullExtent),p=null!=this.layer.subtypeCode?`${this.layer.subtypeField} = ${this.layer.subtypeCode}`:null,u=t(this.layer.definitionExpression,p);let d=[];return d=e.availableFields.concat(...y),n(s,c,{definitionExpression:u,queryScaleRanges:[],displayFilterEnabled:e.displayFilterEnabled,displayFilterInfo:this.layer.displayFilterInfo,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:r,availableFields:d,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{meshes:s,referenceScale:i}=await this._fetchAnnotationDataElementRequest(e,{type:"annotation-data-element-request"}),{orderBy:a,objectIdField:o}=this.layer,n=l(a,null,o);return{storage:c(null,t.filters),mesh:{properties:{sortKey:n,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:s,labels:{type:"label",classes:[]},referenceScale:i}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e){return e}getUpdateHashProperties(){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.outFields,()=>this.layer.renderer,()=>this.layer.subtypeCode,()=>this.layer.trackInfo]}getRenderer(){return this.layer.renderer}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}setAggregateGraphicOrigin(e){e.origin=this.layer.aggregateGraphicOrigin}setTrackGraphicOrigin(e){e.origin=this.layer.trackGraphicOrigin}_createServiceInfo(t){const a=this.layer,o=a.fieldsIndex.toJSON();if(o.fields.push(...u),"memory"===a.source.type)throw new Error(`InternalError: Memory source is not supported for ${this.layer.type}.`);const{capabilities:n,editingInfo:l,typeIdField:c,globalIdField:p,datesInUnknownTimezone:y,dateFieldsTimeZone:d,orderBy:m,subtypeField:h}=a,f=i(a),g=a.timeInfo?.toJSON(),S=a.spatialReference.toJSON(),b=a.types?.map(e=>e.toJSON()),F=e(this.layer.parsedUrl);this.layer.dynamicDataSource&&(F.query={layer:JSON.stringify({source:this.layer.dynamicDataSource})});let I=this.layer.objectIdField;if(m?.length){const e=!m[0].valueExpression&&m[0].field;e&&(I=e)}const R=r(F.path),x=t.spatialReference.toJSON();return{type:"feature-service",source:F,isSourceHosted:R,orderByFields:I,outSpatialReference:x,metadata:{typeIdField:c??void 0,types:b,timeReferenceUnknownClient:y,dateFieldsTimeZone:d,subtypeField:h,globalIdField:p,fieldsIndex:o,geometryType:f,featureIdInfo:s(a),timeInfo:g,spatialReference:S,outSpatialReference:x,subtypes:this.layer.subtypes?.map(e=>e.toJSON()),layerType:a.type,hasM:!1,hasZ:!1},queryMetadata:{supportsFormatPBF:!1,supportsQuantization:!1,maxRecordCount:n.query.maxRecordCount,tileMaxRecordCount:n.query.tileMaxRecordCount,supportsCompactGeometry:n.query.supportsCompactGeometry,supportsDefaultSpatialReference:n.query.supportsDefaultSpatialReference,supportsMaxRecordCountFactor:n.query.supportsMaxRecordCountFactor,supportsCentroidOnDegeneratedQuantizedGeometry:n.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:n.query.supportsDegeneratedQuantizedGeometry,lastEditDate:l?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:n.query.supportsReturnExceededLimitGeometries}}}async _fetchAnnotationDataElementRequest(e,t){const r={cimAnalyzer:e.cimAnalyzer,cimResourceManager:e.cimResourceManager,store:e.store,scaleExpression:null},s=this.layer,i=await s.fetchDataElement(),a=d(i);return{type:"annotation-data-element-response",dataElement:i,meshes:await p(i,r),referenceScale:a}}}export{m as AnnotationLayerAdapter};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clone as e}from"../../../../../core/lang.js";import{sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{canConvertSqlRelativeTime as i,sqlRelativeTimeToAbsolute as s}from"../../../../../layers/support/relativeTimeQueryUtils.js";import{getUtilityNetworkFields as a}from"../../../../../networks/support/networkFieldUtils.js";import{getEffectiveFeatureReduction as o}from"./featureReductionUtils.js";import{createFeatureIdInfo as l}from"./featureServiceUtils.js";import{addFloorFilter as n,hasFloorFilter as y}from"./floorFilterUtils.js";import{getServiceGeometryType as d}from"./geometryUtils.js";import{createLabelVVEvaluator as p}from"./labelingUtils.js";import{ExceedsLimitCache as u}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as c,createFeatureSourceSchema as m}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as h}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as f}from"../support/rendererUtils.js";class g{constructor(e){this.layer=e,this._cache=new u}getLabelingDeconflictionInfo(){return[{vvEvaluators:{0:p(this.layer.renderer)}}]}async createSourceSchema(e,t){const a=this._createServiceInfo(e),o=null!=this.layer.editingInfo?.lastEditDate,l=this.layer.refreshInterval>0,n=!o&&l,y=c(a.isSourceHosted,n,this.layer.capabilities,a.metadata.geometryType,e.extent,this.layer.fullExtent),d=null!=this.layer.subtypeCode?`${this.layer.subtypeField} = ${this.layer.subtypeCode}`:null,p=r(this.layer.definitionExpression,d),u=i(p)?await s(this.layer.fieldsIndex,p,this.layer.capabilities.query.relativeTimeBinWindow):p,h=p!==u?{where:p}:null,{gdbVersion:f,apiKey:g,historicMoment:b,timeExtent:F,customParameters:I,displayFilterInfo:S}=this.layer;return m(a,y,{definitionExpression:u,returnZ:e.returnZ,returnM:e.returnM,postQueryFilter:h,queryScaleRanges:[],displayFilterEnabled:e.displayFilterEnabled,displayFilterInfo:S,customParameters:I,gdbVersion:f,historicMoment:b,timeExtent:F,apiKey:g,sourceRefreshVersion:t,availableFields:e.availableFields,cache:this._cache})}createProcessorSchema(e,r,t){const{fields:i,renderer:s,geometryType:a,labelingInfo:l,labelsVisible:n,orderBy:y,objectIdField:d,trackInfo:p,symbolLayerDrawing:u}=this.layer,c={fields:i.map(e=>e.toJSON()),renderer:s?.clone(),labelingInfoSource:this.layer.id,featureReduction:o(this.layer,r),geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:d,orderBy:y??"default",trackInfo:p,symbolLayerDrawing:u};return h(e,r,c,t)}get hasRequiredSupport(){return f(this.layer.renderer)}get timeOptions(){return this.layer}addFilters(e,r){return n(this.layer,e,r)}getUpdateHashProperties(e){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>o(this.layer,e),()=>y(this.layer,e)?e.floors:null,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.outFields,()=>this.layer.renderer,()=>this.layer.subtypeCode,()=>this.layer.trackInfo,()=>this.layer.symbolLayerDrawing?.drawOrder,()=>this.layer.symbolLayerDrawing?.enabled,()=>e?.requiredFieldsOptions?.featureTitleFields&&this.layer.featureTitleFields,()=>e?.requiredFieldsOptions?.utilityNetworkFields&&a(e,this.layer)]}getRenderer(){return this.layer.renderer}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}setAggregateGraphicOrigin(e){e.origin=this.layer.aggregateGraphicOrigin}setTrackGraphicOrigin(e){e.origin=this.layer.trackGraphicOrigin}_createServiceInfo(r){const i=this.layer,{capabilities:s,editingInfo:a,typeIdField:o,globalIdField:n,datesInUnknownTimezone:y,dateFieldsTimeZone:p,orderBy:u,subtypeField:c}=i,m=i.fieldsIndex.toJSON(),h=d(i),{hasZ:f,hasM:g}=i,b=i.timeInfo?.toJSON(),F=i.spatialReference.toJSON(),I=i.types?.map(e=>e.toJSON()),S=e(this.layer.parsedUrl);this.layer.dynamicDataSource&&(S.query={layer:JSON.stringify({source:this.layer.dynamicDataSource})});let R=this.layer.objectIdField;if(u?.length){const e=!u[0].valueExpression&&u[0].field;e&&(R=e)}const x=t(S.path),O=r.spatialReference.toJSON();return{type:"feature-service",source:S,isSourceHosted:x,orderByFields:R,outSpatialReference:O,metadata:{typeIdField:o??void 0,types:I,timeReferenceUnknownClient:y,dateFieldsTimeZone:p,subtypeField:c,globalIdField:n,fieldsIndex:m,geometryType:h,hasZ:f,hasM:g,featureIdInfo:l(i),timeInfo:b,spatialReference:F,outSpatialReference:O,subtypes:this.layer.subtypes?.map(e=>e.toJSON())},queryMetadata:{maxRecordCount:s.query.maxRecordCount,tileMaxRecordCount:s.query.tileMaxRecordCount,supportsCompactGeometry:s.query.supportsCompactGeometry,supportsDefaultSpatialReference:s.query.supportsDefaultSpatialReference,supportsFormatPBF:s.query.supportsFormatPBF,supportsMaxRecordCountFactor:s.query.supportsMaxRecordCountFactor,supportsQuantization:s.query.supportsQuantization,supportsCentroidOnDegeneratedQuantizedGeometry:s.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:s.query.supportsDegeneratedQuantizedGeometry,lastEditDate:a?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:s.query.supportsReturnExceededLimitGeometries}}}}export{g as DimensionLayerAdapter};
2
+ import{clone as e}from"../../../../../core/lang.js";import{sqlAnd as t}from"../../../../../core/sql.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{createFeatureIdInfo as s}from"./featureServiceUtils.js";import{getServiceGeometryType as i}from"./geometryUtils.js";import{ExceedsLimitCache as a}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as o,createFeatureSourceSchema as n}from"../schema/SourceSchema.js";import{getSortKey as l}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as c}from"../schema/processor/StorageSchema.js";import{getDimensionMatcherSchema as p}from"../../support/annodime/dimensionSchema.js";import{dimensionRealFields as y,dimensionVirtualFields as u}from"../../support/annodime/fields.js";import{getReferenceScale as d}from"../../support/annodime/utils.js";class m{constructor(e){this.layer=e,this._cache=new a}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,r){const s=this._createServiceInfo(e),i=null!=this.layer.editingInfo?.lastEditDate,a=this.layer.refreshInterval>0,l=!i&&a,c=o("isSourceHosted"in s&&s.isSourceHosted,l,this.layer.capabilities,s.metadata.geometryType,e.extent,this.layer.fullExtent),p=null!=this.layer.subtypeCode?`${this.layer.subtypeField} = ${this.layer.subtypeCode}`:null,u=t(this.layer.definitionExpression,p);let d=[];return d=e.availableFields.concat(...y),n(s,c,{definitionExpression:u,queryScaleRanges:[],displayFilterEnabled:e.displayFilterEnabled,displayFilterInfo:this.layer.displayFilterInfo,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:r,availableFields:d,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{meshes:s,referenceScale:i}=await this._fetchDimensionDataElementRequest(e,{type:"dimension-data-element-request"}),{orderBy:a,objectIdField:o}=this.layer,n=l(a,null,o);return{storage:c(null,t.filters),mesh:{properties:{sortKey:n,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:s,labels:{type:"label",classes:[]},referenceScale:i}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e){return e}getUpdateHashProperties(){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.outFields,()=>this.layer.renderer,()=>this.layer.subtypeCode,()=>this.layer.trackInfo]}getRenderer(){return this.layer.renderer}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}setAggregateGraphicOrigin(e){e.origin=this.layer.aggregateGraphicOrigin}setTrackGraphicOrigin(e){e.origin=this.layer.trackGraphicOrigin}_createServiceInfo(t){const a=this.layer,o=a.fieldsIndex.toJSON();if(o.fields.push(...u),"memory"===a.source.type)throw new Error(`InternalError: Memory source is not supported for ${this.layer.type}.`);const{capabilities:n,editingInfo:l,typeIdField:c,globalIdField:p,datesInUnknownTimezone:y,dateFieldsTimeZone:d,orderBy:m,subtypeField:h}=a,f=i(a),g=a.timeInfo?.toJSON(),S=a.spatialReference.toJSON(),b=a.types?.map(e=>e.toJSON()),F=e(this.layer.parsedUrl);this.layer.dynamicDataSource&&(F.query={layer:JSON.stringify({source:this.layer.dynamicDataSource})});let I=this.layer.objectIdField;if(m?.length){const e=!m[0].valueExpression&&m[0].field;e&&(I=e)}const R=r(F.path),x=t.spatialReference.toJSON();return{type:"feature-service",source:F,isSourceHosted:R,orderByFields:I,outSpatialReference:x,metadata:{typeIdField:c??void 0,types:b,timeReferenceUnknownClient:y,dateFieldsTimeZone:d,subtypeField:h,globalIdField:p,fieldsIndex:o,geometryType:f,featureIdInfo:s(a),timeInfo:g,spatialReference:S,outSpatialReference:x,subtypes:this.layer.subtypes?.map(e=>e.toJSON()),layerType:a.type,hasM:!1,hasZ:!1},queryMetadata:{supportsFormatPBF:!1,supportsQuantization:!1,maxRecordCount:n.query.maxRecordCount,tileMaxRecordCount:n.query.tileMaxRecordCount,supportsCompactGeometry:n.query.supportsCompactGeometry,supportsDefaultSpatialReference:n.query.supportsDefaultSpatialReference,supportsMaxRecordCountFactor:n.query.supportsMaxRecordCountFactor,supportsCentroidOnDegeneratedQuantizedGeometry:n.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:n.query.supportsDegeneratedQuantizedGeometry,lastEditDate:l?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:n.query.supportsReturnExceededLimitGeometries}}}async _fetchDimensionDataElementRequest(e,t){const r={cimAnalyzer:e.cimAnalyzer,cimResourceManager:e.cimResourceManager,store:e.store,scaleExpression:null},s=this.layer,i=await s.fetchDataElement(),a=d(i);return{type:"dimension-data-element-response",dataElement:i,meshes:await p(i,r),referenceScale:a}}}export{m as DimensionLayerAdapter};