@arcgis/core 4.32.0-next.20250203 → 4.32.0-next.20250205

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 (242) hide show
  1. package/WebScene.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{d3a8aabdbfb59dd433e3.js → 01c3507d78398baaf61b.js} +1 -1
  4. package/assets/esri/core/workers/chunks/06f693780f70e5a627c4.js +1 -0
  5. package/assets/esri/core/workers/chunks/1a2e1a414e651e988435.js +2 -0
  6. package/assets/esri/core/workers/chunks/{bf9bc52a3c559108c19a.js.LICENSE.txt → 1a2e1a414e651e988435.js.LICENSE.txt} +1 -1
  7. package/assets/esri/core/workers/chunks/{6e25742ceedea7fb1b97.js → 287362f9af132fafe4de.js} +1 -1
  8. package/assets/esri/core/workers/chunks/308ec51ff4a66f7fcb0d.js.LICENSE.txt +1 -1
  9. package/assets/esri/core/workers/chunks/354531dc2f0dea2ad96f.js +2 -0
  10. package/assets/esri/core/workers/chunks/{6e8905f20101c1f4509d.js.LICENSE.txt → 354531dc2f0dea2ad96f.js.LICENSE.txt} +1 -1
  11. package/assets/esri/core/workers/chunks/41cd1a5c99ab3bbd1fb4.js +1 -0
  12. package/assets/esri/core/workers/chunks/44abd2cd17aae3299ede.js +1 -0
  13. package/assets/esri/core/workers/chunks/{adfa126cea32298c28e9.js → 48ecc5a74fecbb2b9c6f.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{af2a70d33afb12bb536f.js → 4d0a6ccb8434f8898377.js} +44 -44
  15. package/assets/esri/core/workers/chunks/{e9f0402fa3ac5a249807.js → 5196c43dbce48d1b81ae.js} +1 -1
  16. package/assets/esri/core/workers/chunks/568bcf809fcfd4d9c713.js +1 -0
  17. package/assets/esri/core/workers/chunks/{f2fae056a81f12b56b04.js → 5e7f16b312077ca8c18d.js} +1 -1
  18. package/assets/esri/core/workers/chunks/61243217aed5de012e93.js +1 -0
  19. package/assets/esri/core/workers/chunks/6d5bfcc7856cafe7b043.js +2 -0
  20. package/assets/esri/core/workers/chunks/{7d3a441d2eb18d709ef9.js.LICENSE.txt → 6d5bfcc7856cafe7b043.js.LICENSE.txt} +1 -1
  21. package/assets/esri/core/workers/chunks/72cf9192292e5c85c6df.js.LICENSE.txt +1 -1
  22. package/assets/esri/core/workers/chunks/73d03c208242778e67bf.js +1 -0
  23. package/assets/esri/core/workers/chunks/{bc50585615f07d5ec1a9.js → 746c964cf07e4306f21f.js} +1 -1
  24. package/assets/esri/core/workers/chunks/77764ca90bdd13ee2167.js +2 -0
  25. package/assets/esri/core/workers/chunks/{25c8cc30faade043c8dc.js.LICENSE.txt → 77764ca90bdd13ee2167.js.LICENSE.txt} +1 -1
  26. package/assets/esri/core/workers/chunks/{07360fde6ea65664e6ca.js → 82d26884127ed772cc4b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{ba3c18d1efde46461231.js → 8438fba57e82e4cc7c11.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{d1678945cf6a58f76863.js → 858b191c078d04232342.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{0ef5b0f8aa8a09acd6e0.js → 8e90c5fee4ad7c7275dc.js} +1 -1
  30. package/assets/esri/core/workers/chunks/918bdba41fa470cf77fd.js +1 -0
  31. package/assets/esri/core/workers/chunks/{3ec51b75d1a86dad6cb1.js → 91d2bdfa6e34c10b7f50.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{12dd892cf61a76fb40ad.js → 991e0f619f1f81f94d56.js} +1 -1
  33. package/assets/esri/core/workers/chunks/9a27824d94df702e6e28.js +1 -0
  34. package/assets/esri/core/workers/chunks/9a2d7c98fa0c4f8a9fd5.js +314 -0
  35. package/assets/esri/core/workers/chunks/a2409d4921c02614169a.js +1 -0
  36. package/assets/esri/core/workers/chunks/{7810579a5a780933cdc9.js → ad3e692681b50bd1acc2.js} +1 -1
  37. package/assets/esri/core/workers/chunks/b21b152fa15896577242.js.LICENSE.txt +1 -1
  38. package/assets/esri/core/workers/chunks/{c7a94e569c905f97244a.js → b33122adfd1fb68f7c0f.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{da77eefaad83c0644380.js → b8fae500c69ca2cff62a.js} +1 -1
  40. package/assets/esri/core/workers/chunks/b9d9a1dc3c5d799e2685.js +1 -0
  41. package/assets/esri/core/workers/chunks/{79afe4674a0557eb26e4.js → bf26f58210755875748c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{5adeb979f178944b9ce5.js → c4c2b94e5cee7b824093.js} +1 -1
  43. package/assets/esri/core/workers/chunks/c7b6f237efaab333459e.js +1 -0
  44. package/assets/esri/core/workers/chunks/{3e872e5e528dca7bee0c.js → cc75bbfd779f409943a3.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{4c5279fedf982a174706.js → d175953337fa655dc6b0.js} +1 -1
  46. package/assets/esri/core/workers/chunks/d35efcbe439500bf18bc.js +1 -0
  47. package/assets/esri/core/workers/chunks/d3d1dcb440588a295eba.js +1 -0
  48. package/assets/esri/core/workers/chunks/e26dc0c1654316bb1558.js +1 -0
  49. package/assets/esri/core/workers/chunks/{448ee44c7f594e5b2551.js → e410a09650530d7aad10.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{2345344be4b0e487d3a6.js → f198f4ba7d3d52882d98.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{881ddbdeb40336208e90.js → f29715459ecd46180829.js} +1 -1
  52. package/assets/esri/core/workers/chunks/f4e48bbdbc9da10ec71a.js +1 -0
  53. package/assets/esri/themes/base/widgets/_Directions.scss +74 -17
  54. package/assets/esri/themes/dark/main.css +1 -1
  55. package/assets/esri/themes/light/main.css +1 -1
  56. package/assets/esri/themes/light/view.css +1 -1
  57. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  58. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  59. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  60. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  61. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  62. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  63. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  64. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  65. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  66. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  67. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  68. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  69. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  70. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  71. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  72. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  73. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  74. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  75. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  76. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  77. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  78. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  79. package/assets/esri/widgets/Directions/t9n/Directions_no.json +1 -1
  80. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  81. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  82. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  83. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  84. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  85. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  86. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  87. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  88. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  89. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  90. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  91. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  92. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  93. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  94. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  95. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  96. package/chunks/ColorMaterial.glsl.js +4 -5
  97. package/chunks/ComponentShader.glsl.js +30 -30
  98. package/chunks/DefaultMaterial.glsl.js +19 -19
  99. package/chunks/HUDMaterial.glsl.js +34 -34
  100. package/chunks/MeasurementArrow.glsl.js +6 -6
  101. package/chunks/NativeLine.glsl.js +4 -4
  102. package/chunks/Pattern.glsl.js +1 -1
  103. package/chunks/QuadraticBezier.js +1 -1
  104. package/chunks/RealisticTree.glsl.js +14 -14
  105. package/chunks/RibbonLine.glsl.js +32 -32
  106. package/chunks/Terrain.glsl.js +31 -31
  107. package/chunks/WaterSurface.glsl.js +15 -15
  108. package/copyright.txt +0 -29
  109. package/core/Collection.js +1 -1
  110. package/core/has.js +1 -1
  111. package/geometry/operators/projectOperator.js +1 -1
  112. package/geometry/operators/shapePreservingProjectOperator.js +1 -1
  113. package/geometry/support/centroid.js +1 -1
  114. package/interfaces.d.ts +120 -13
  115. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  116. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  117. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  118. package/layers/mixins/ArcGISImageService.js +1 -1
  119. package/layers/mixins/ImageryTileMixin.js +1 -1
  120. package/layers/ogc/wcsUtils.js +1 -1
  121. package/layers/support/RasterFunctionTemplate.js +1 -1
  122. package/layers/support/Sublayer.js +1 -1
  123. package/layers/support/capabilities.js +1 -1
  124. package/layers/support/featureLayerUtils.js +1 -1
  125. package/layers/support/labelUtils.js +1 -1
  126. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  127. package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
  128. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  129. package/layers/support/rasterDatasets/wcsCapabilitiesParser.js +1 -1
  130. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  131. package/package.json +4 -5
  132. package/popup/content/AttachmentsContent.js +1 -1
  133. package/popup/support/AttachmentsOrderByInfo.d.ts +4 -0
  134. package/popup/support/AttachmentsOrderByInfo.js +5 -0
  135. package/portal/schemas/definitions.js +1 -1
  136. package/rest/imageService/fetchRasterInfo.js +1 -1
  137. package/rest/query/operations/queryAttachments.js +1 -1
  138. package/rest/support/AttachmentQuery.js +1 -1
  139. package/support/revision.js +1 -1
  140. package/support/timeUtils.d.ts +0 -1
  141. package/support/timeUtils.js +1 -1
  142. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  143. package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
  144. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedShader.js +1 -1
  145. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  146. package/views/2d/engine/webgl/shaderGraph/techniques/line/gradientStrokeConstants.js +1 -1
  147. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
  148. package/views/2d/engine/webgl/util/LabelMatcher.js +1 -1
  149. package/views/2d/engine/webgl/util/createMatcher.js +1 -1
  150. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  151. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  152. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  153. package/views/2d/layers/LayerView2D.js +1 -1
  154. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  155. package/views/2d/layers/TileLayerView2D.js +1 -1
  156. package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
  157. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  158. package/views/2d/layers/support/util.js +1 -1
  159. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  160. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  161. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  164. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  165. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  167. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  168. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  169. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  170. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  171. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  172. package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
  173. package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
  174. package/views/3d/terrain/PatchRenderData.js +1 -1
  175. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  176. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  177. package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js +3 -3
  178. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  179. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  180. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  181. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  182. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  183. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  184. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  185. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  186. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  187. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  188. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  189. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  190. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  191. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  192. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  193. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  194. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  195. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  196. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +8 -8
  197. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  198. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  199. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  200. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  201. package/views/layers/FeatureLayerView.js +1 -1
  202. package/views/layers/ImageryTileLayerView.d.ts +4 -0
  203. package/views/layers/ImageryTileLayerView.js +1 -1
  204. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  205. package/webscene/spec-certification/index.js +1 -1
  206. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  207. package/widgets/BasemapLayerList.js +1 -1
  208. package/widgets/Directions/DirectionsViewModel.js +1 -1
  209. package/widgets/Directions.js +1 -1
  210. package/widgets/Editor/UpdateWorkflow.js +1 -1
  211. package/widgets/Editor/support/EditorItem.js +1 -1
  212. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  213. package/widgets/Feature/FeatureViewModel.js +1 -1
  214. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  215. package/widgets/LayerList.js +1 -1
  216. package/widgets/Legend/LegendViewModel.js +1 -1
  217. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  218. package/widgets/Legend.js +1 -1
  219. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  220. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  221. package/widgets/support/geolocationUtils.js +1 -1
  222. package/assets/esri/core/workers/chunks/06d72622590dbd38c5de.js +0 -1
  223. package/assets/esri/core/workers/chunks/0a19e1aec6a5502e391a.js +0 -1
  224. package/assets/esri/core/workers/chunks/12964a4b16113cdc9c93.js +0 -1
  225. package/assets/esri/core/workers/chunks/1e3ab66d0e8a7f160f33.js +0 -1
  226. package/assets/esri/core/workers/chunks/25c8cc30faade043c8dc.js +0 -2
  227. package/assets/esri/core/workers/chunks/34d464dacee52739c98c.js +0 -1
  228. package/assets/esri/core/workers/chunks/402de76b5de05615e111.js +0 -1
  229. package/assets/esri/core/workers/chunks/4263eee3247aaf4e64bf.js +0 -1
  230. package/assets/esri/core/workers/chunks/4cab082b8432ddc05345.js +0 -1
  231. package/assets/esri/core/workers/chunks/613db14d698741886753.js +0 -1
  232. package/assets/esri/core/workers/chunks/6e8905f20101c1f4509d.js +0 -2
  233. package/assets/esri/core/workers/chunks/7d3a441d2eb18d709ef9.js +0 -2
  234. package/assets/esri/core/workers/chunks/ba37ab9e560644dc1f18.js +0 -1
  235. package/assets/esri/core/workers/chunks/bf9bc52a3c559108c19a.js +0 -2
  236. package/assets/esri/core/workers/chunks/c4b0e3f7dcad6c7ea620.js +0 -314
  237. package/assets/esri/core/workers/chunks/c74441fbe0f63633796f.js +0 -1
  238. package/assets/esri/core/workers/chunks/dd46ec81cebe1a0a7b9c.js +0 -1
  239. package/assets/esri/core/workers/chunks/e444ec05a8a1dfbd21a8.js +0 -1
  240. package/assets/esri/core/workers/chunks/f8367c21fa91435c7c53.js +0 -1
  241. package/assets/esri/core/workers/chunks/ffa2b9d70830aed03a8f.js +0 -1
  242. /package/{views/3d/webgl-engine/core/shaderLibrary/util → webscene/support}/AlphaCutoff.js +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../request.js";import t from"../../geometry/Extent.js";import a from"../../geometry/Point.js";import l from"../../geometry/SpatialReference.js";import i from"../../layers/support/RasterInfo.js";import n from"../../layers/support/RasterStorageInfo.js";import{parseUrl as s,encode as r,asValidOptions as o}from"../utils.js";import u from"../support/FeatureSet.js";async function m(m,f,p){const c=s(m),{rasterFunction:d,sourceJSON:h}=f||{},g=d?JSON.stringify(d.rasterFunctionDefinition||d):null,y=r({...c.query,renderingRule:g,f:"json"}),x=o(y,p);m=c.path;const b=h||await e(m,x).then((e=>e.data)),v=b.hasRasterAttributeTable?e(`${m}/rasterAttributeTable`,x):null,S=b.hasColormap?e(`${m}/colormap`,x):null,V=b.hasHistograms?e(`${m}/histograms`,x):null,D=b.currentVersion>=10.3?e(`${m}/keyProperties`,x):null,I=b.hasMultidimensions?e(`${m}/multidimensionalInfo`,x):null,T=await Promise.allSettled([v,S,V,D,I]);let R=null;if(b.minValues&&b.minValues.length===b.bandCount){R=[];for(let e=0;e<b.minValues.length;e++)R.push({min:b.minValues[e],max:b.maxValues[e],avg:b.meanValues[e],stddev:b.stdvValues[e]})}const j=t.fromJSON(b.extent),w=Math.ceil(j.width/b.pixelSizeX-.1),M=Math.ceil(j.height/b.pixelSizeY-.1),N=l.fromJSON(b.spatialReference||b.extent.spatialReference),J="fulfilled"===T[0].status?T[0].value?.data:null,O=J?.features?.length?u.fromJSON(J):null,k="fulfilled"===T[1].status?T[1].value?.data.colormap:null,C=k?.length?k:null,P="fulfilled"===T[2].status?T[2].value?.data.histograms:null,z=P?.[0]?.counts?.length?P:null,F="fulfilled"===T[3].status?T[3].value?.data??{}:{},$="fulfilled"===T[4].status?T[4].value?.data.multidimensionalInfo:null,H=$?.variables?.length?$:null;H&&H.variables.forEach((e=>{e.statistics?.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))}));const{defaultVariable:L,serviceDataType:A}=b;L&&L!==F.DefaultVariable&&(F.DefaultVariable=L),A?.includes("esriImageServiceDataTypeVector")&&!A.includes(F.DataType)&&(F.DataType=A.replace("esriImageServiceDataType",""));let E=b.noDataValue;b.noDataValues?.length&&b.noDataValues.some((e=>e!==E))&&(E=b.noDataValues);const q=b.transposeInfo?new n({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new a({x:b.extent.xmin,y:b.extent.ymax,spatialReference:N}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(w,M))/Math.LN2-8)),transposeInfo:b.transposeInfo}):void 0;return new i({width:w,height:M,bandCount:b.bandCount,extent:t.fromJSON(b.extent),spatialReference:N,pixelSize:new a({x:b.pixelSizeX,y:b.pixelSizeY,spatialReference:N}),pixelType:b.pixelType.toLowerCase(),statistics:R,attributeTable:O,colormap:C,histograms:z,keyProperties:F,noDataValue:E,multidimensionalInfo:H,storageInfo:q})}function f(e,t,a){return m(e,{sourceJSON:t},a)}function p(e,t,a){return m(e,{rasterFunction:t},a)}function c(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}export{f as fetchServiceRasterInfo,p as generateRasterInfo,c as patchServiceInfo};
5
+ import e from"../../request.js";import t from"../../geometry/Extent.js";import a from"../../geometry/Point.js";import i from"../../geometry/SpatialReference.js";import l from"../../layers/support/RasterInfo.js";import n from"../../layers/support/RasterStorageInfo.js";import{parseUrl as s,encode as r,asValidOptions as o}from"../utils.js";import u from"../support/FeatureSet.js";async function m(m,f,p){const c=s(m),{rasterFunction:d,sourceJSON:h}=f||{},g=d?JSON.stringify(d.rasterFunctionDefinition||d):null,y=r({...c.query,renderingRule:g,f:"json"}),x=o(y,p);m=c.path;const S=h||await e(m,x).then((e=>e.data)),b=S.hasRasterAttributeTable?e(`${m}/rasterAttributeTable`,x):null,v=S.hasColormap?e(`${m}/colormap`,x):null,V=S.hasHistograms?e(`${m}/histograms`,x):null,D=S.currentVersion>=10.3?e(`${m}/keyProperties`,x):null,I=S.hasMultidimensions?e(`${m}/multidimensionalInfo`,x):null,T=await Promise.allSettled([b,v,V,D,I]);let R=null;if(S.minValues&&S.minValues.length===S.bandCount){R=[];for(let e=0;e<S.minValues.length;e++)R.push({min:S.minValues[e],max:S.maxValues[e],avg:S.meanValues[e],stddev:S.stdvValues[e]})}const j=t.fromJSON(S.extent),w=Math.ceil(j.width/S.pixelSizeX-.1),M=Math.ceil(j.height/S.pixelSizeY-.1),N=i.fromJSON(S.spatialReference||S.extent.spatialReference),O="fulfilled"===T[0].status?T[0].value?.data:null,J=O?.features?.length?u.fromJSON(O):null,k="fulfilled"===T[1].status?T[1].value?.data.colormap:null,C=k?.length?k:null,P="fulfilled"===T[2].status?T[2].value?.data.histograms:null,z=P?.[0]?.counts?.length?P:null,F="fulfilled"===T[3].status?T[3].value?.data??{}:{},$="fulfilled"===T[4].status?T[4].value?.data.multidimensionalInfo:null,E=$?.variables?.length?$:null;E&&E.variables.forEach((e=>{e.statistics?.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),e.dimensions?.forEach((e=>{"StdTime"!==e.name||e.recurring||e.unit||(e.unit="ISO8601")}))}));const{defaultVariable:H,serviceDataType:L}=S;H&&H!==F.DefaultVariable&&(F.DefaultVariable=H),L?.includes("esriImageServiceDataTypeVector")&&!L.includes(F.DataType)&&(F.DataType=L.replace("esriImageServiceDataType",""));let A=S.noDataValue;S.noDataValues?.length&&S.noDataValues.some((e=>e!==A))&&(A=S.noDataValues);const q=S.transposeInfo?new n({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new a({x:S.extent.xmin,y:S.extent.ymax,spatialReference:N}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(w,M))/Math.LN2-8)),transposeInfo:S.transposeInfo}):void 0;return new l({width:w,height:M,bandCount:S.bandCount,extent:t.fromJSON(S.extent),spatialReference:N,pixelSize:new a({x:S.pixelSizeX,y:S.pixelSizeY,spatialReference:N}),pixelType:S.pixelType.toLowerCase(),statistics:R,attributeTable:J,colormap:C,histograms:z,keyProperties:F,noDataValue:A,multidimensionalInfo:E,storageInfo:q})}function f(e,t,a){return m(e,{sourceJSON:t},a)}function p(e,t,a){return m(e,{rasterFunction:t},a)}function c(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}export{f as fetchServiceRasterInfo,p as generateRasterInfo,c as patchServiceInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{addTokenParameter as t}from"../../../kernel.js";import o from"../../../request.js";import{addProxy as e}from"../../../core/urlUtils.js";import{mapParameters as n}from"../../operations/urlUtils.js";import r from"../support/AttachmentInfo.js";function s(t){const o=t.toJSON();return o.attachmentTypes&&(o.attachmentTypes=o.attachmentTypes.join(",")),o.keywords&&(o.keywords=o.keywords.join(",")),o.globalIds&&(o.globalIds=o.globalIds.join(",")),o.objectIds&&(o.objectIds=o.objectIds.join(",")),o.size&&(o.size=o.size.join(",")),o}function a(o,n){const s={};for(const a of n){const{parentObjectId:n,parentGlobalId:c,attachmentInfos:m}=a;for(const a of m){const{id:m}=a,p=e(t(`${o.path}/${n}/attachments/${m}`)),i=r.fromJSON(a);i.set({url:p,parentObjectId:n,parentGlobalId:c}),s[n]?s[n].push(i):s[n]=[i]}}return s}function c(t,e,r){let a={query:n({...t.query,f:"json",...s(e)})};return r&&(a={...r,...a,query:{...r.query,...a.query}}),o(t.path+"/queryAttachments",a).then((t=>t.data.attachmentGroups))}async function m(t,e,n){const{objectIds:r}=e,s=[];for(const a of r)s.push(o(t.path+"/"+a+"/attachments",n));return Promise.all(s).then((t=>r.map(((o,e)=>({parentObjectId:o,attachmentInfos:t[e].data.attachmentInfos})))))}export{c as executeAttachmentQuery,m as fetchAttachments,a as processAttachmentQueryResult};
5
+ import{addTokenParameter as t}from"../../../kernel.js";import o from"../../../request.js";import{addProxy as e}from"../../../core/urlUtils.js";import{mapParameters as r}from"../../operations/urlUtils.js";import n from"../support/AttachmentInfo.js";function s(t){const o=t.toJSON();return o.attachmentTypes&&(o.attachmentTypes=o.attachmentTypes.join(",")),o.keywords&&(o.keywords=o.keywords.join(",")),o.globalIds&&(o.globalIds=o.globalIds.join(",")),o.objectIds&&(o.objectIds=o.objectIds.join(",")),o.size&&(o.size=o.size.join(",")),o.orderByFields&&(o.orderByFields=o.orderByFields.join(",")),o}function a(o,r){const s={};for(const a of r){const{parentObjectId:r,parentGlobalId:c,attachmentInfos:i}=a;for(const a of i){const{id:i}=a,d=e(t(`${o.path}/${r}/attachments/${i}`)),m=n.fromJSON(a);m.set({url:d,parentObjectId:r,parentGlobalId:c}),s[r]?s[r].push(m):s[r]=[m]}}return s}function c(t,e,n){let a={query:r({...t.query,f:"json",...s(e)})};return n&&(a={...n,...a,query:{...n.query,...a.query}}),o(t.path+"/queryAttachments",a).then((t=>t.data.attachmentGroups))}async function i(t,e,r){const{objectIds:n}=e,s=[];for(const a of n)s.push(o(t.path+"/"+a+"/attachments",r));return Promise.all(s).then((t=>n.map(((o,e)=>({parentObjectId:o,attachmentInfos:t[e].data.attachmentInfos})))))}export{c as executeAttachmentQuery,i as fetchAttachments,a as processAttachmentQueryResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as n}from"../../core/accessorSupport/decorators/writer.js";var a;let p=a=class extends e{constructor(t){super(t),this.attachmentTypes=null,this.attachmentsWhere=null,this.cacheHint=void 0,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10}clone(){return new a(r({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,cacheHint:this.cacheHint,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};t([o({type:[String],json:{write:!0}})],p.prototype,"attachmentTypes",void 0),t([o({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],p.prototype,"attachmentsWhere",void 0),t([o({type:Boolean,json:{write:!0}})],p.prototype,"cacheHint",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"keywords",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"globalIds",void 0),t([o({json:{write:!0}})],p.prototype,"name",void 0),t([o({type:Number,json:{read:{source:"resultRecordCount"}}})],p.prototype,"num",void 0),t([o({type:[Number],json:{write:!0}})],p.prototype,"objectIds",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],p.prototype,"returnMetadata",void 0),t([o({type:[Number],json:{write:!0}})],p.prototype,"size",void 0),t([o({type:Number,json:{read:{source:"resultOffset"}}})],p.prototype,"start",void 0),t([n("start"),n("num")],p.prototype,"writeStart",null),t([o({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],p.prototype,"where",void 0),p=a=t([i("esri.rest.support.AttachmentQuery")],p),p.from=s(p);const c=p;export{c as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as n}from"../../core/accessorSupport/decorators/writer.js";var a;let p=a=class extends e{constructor(t){super(t),this.attachmentTypes=null,this.attachmentsWhere=null,this.cacheHint=void 0,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.orderByFields=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10}clone(){return new a(r({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,cacheHint:this.cacheHint,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};t([o({type:[String],json:{write:!0}})],p.prototype,"attachmentTypes",void 0),t([o({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],p.prototype,"attachmentsWhere",void 0),t([o({type:Boolean,json:{write:!0}})],p.prototype,"cacheHint",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"keywords",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"globalIds",void 0),t([o({json:{write:!0}})],p.prototype,"name",void 0),t([o({type:Number,json:{read:{source:"resultRecordCount"}}})],p.prototype,"num",void 0),t([o({type:[Number],json:{write:!0}})],p.prototype,"objectIds",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"orderByFields",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],p.prototype,"returnMetadata",void 0),t([o({type:[Number],json:{write:!0}})],p.prototype,"size",void 0),t([o({type:Number,json:{read:{source:"resultOffset"}}})],p.prototype,"start",void 0),t([n("start"),n("num")],p.prototype,"writeStart",null),t([o({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],p.prototype,"where",void 0),p=a=t([i("esri.rest.support.AttachmentQuery")],p),p.from=s(p);const c=p;export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- const d="20250203",e="e492d27b68c928b298745dd02a8e98dfaf004fe0";export{d as buildDate,e as commitHash};
5
+ const c="20250205",a="8ca740ed187dfaced96f6d44fc8af03010c73a31";export{c as buildDate,a as commitHash};
@@ -2,4 +2,3 @@ import "../interfaces";
2
2
 
3
3
  export const getTimeExtentFromLayers: __esri.timeUtils["getTimeExtentFromLayers"];
4
4
  export const getTimeSliderSettingsFromWebDocument: __esri.timeUtils["getTimeSliderSettingsFromWebDocument"];
5
- export const getTimeSliderSettingsFromWebMap: __esri.timeUtils["getTimeSliderSettingsFromWebMap"];
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../core/arrayUtils.js";import{deprecatedFunction as e}from"../core/deprecate.js";import{clone as n}from"../core/lang.js";import i from"../core/Logger.js";import{offsetDate as r}from"../core/timeUtils.js";import s from"../time/TimeExtent.js";import{isWebMap as l}from"../webmap/utils.js";import{isWebScene as o}from"../webscene/utils.js";function m(t){return void 0!==t.timeInfo}async function u(t,e){return t.widgets?.timeSlider?.fullTimeExtent??f(t.allLayers,e)}function a(t){const e=t.numThumbs??2,n=t.currentTimeExtent;if(n){const{start:t,end:i}=n;return null!=t&&null!=i&&t.getTime()===i.getTime()?"instant":2===e?"time-window":null==t||0===t.getTime()?"cumulative-from-start":"cumulative-from-end"}return 2===e?"time-window":"cumulative-from-start"}function c(t){const{numStops:e,stopInterval:i,stops:r}=t;return r?{dates:n(r)}:i?{interval:i.clone()}:{count:e??5}}async function f(e,n){if(0===e.length)return s.allTime;await Promise.all(e.map((t=>t.load({signal:n}))));const i=e.filter(m),r=e.filter((t=>!m(t)&&null!=t.visibilityTimeExtent));if(0===i.length&&0===r.length)return s.allTime;const l=[],o=[];for(const t of i)"feature"!==t?.type&&"map-image"!==t?.type||!t.timeInfo?.hasLiveData?o.push(t):l.push(t);const u=t=>null==t||t.isAllTime,a=[...o.map((t=>{const e=t.timeInfo?.fullTimeExtent,{visibilityTimeExtent:n}=t;return e?.intersection(n)??n})),...r.map((t=>t.visibilityTimeExtent))];if(a.some(u))return s.allTime;const c=l.map((async t=>{const e=(await t.fetchRecomputedExtents({signal:n}))?.timeExtent??t.timeInfo?.fullTimeExtent,{visibilityTimeExtent:i}=t;return e?.intersection(i)??i})),f=(await Promise.allSettled(c)).map((t=>"fulfilled"===t.status?t.value:null));if(f.some(u))return s.allTime;const p=[...f,...a].filter(t);if(0===p.length)return s.allTime;return p.reduce(((t,e)=>t.union(e)))}function p(t,e){const n=t.currentTimeExtent;if(!n)return null;const{start:i,end:r}=n,l=i??r??null;switch(e){case"time-window":return new s({start:i,end:r});case"cumulative-from-start":return new s({start:null,end:l});case"cumulative-from-end":return new s({start:l,end:null});case"instant":return new s({start:l,end:l})}}async function d(t,n){return e(i.getLogger("esri.support.timeUtils.getTimeSliderSettingsFromWebMap"),"`timeUtils.getTimeSliderSettingsFromWebMap` is deprecated in favor of 'timeUtils.getTimeSliderSettingsFromWebDocument'",{replacement:"timeUtils.getTimeSliderSettingsFromWebDocument",version:"4.30",see:"https://developers.arcgis.com/javascript/latest/api-reference/esri-support-timeUtils.html#getTimeSliderSettingsFromWebDocument",warnOnce:!0}),null!=t&&l(t)?await g(t,n):null}async function g(t,e){if(!l(t)&&!o(t))return null;await t.load({signal:e});const n=t?.widgets?.timeSlider;if(!n)return null;const i=await u(t,e),r=n.loop,s=a(n);return{fullTimeExtent:i,loop:r,mode:s,playRate:n.stopDelay??2e3,stops:c(n),timeExtent:p(n,s)}}function T(t){if(!t)return t;const{start:e,end:n}=t;return new s({start:null!=e?r(e,-e.getTimezoneOffset(),"minutes"):e,end:null!=n?r(n,-n.getTimezoneOffset(),"minutes"):n})}function w(t){if(!t)return t;const{start:e,end:n}=t;return new s({start:null!=e?r(e,e.getTimezoneOffset(),"minutes"):e,end:null!=n?r(n,n.getTimezoneOffset(),"minutes"):n})}export{f as getTimeExtentFromLayers,g as getTimeSliderSettingsFromWebDocument,d as getTimeSliderSettingsFromWebMap,w as toLocalTimeExtent,T as toUTCTimeExtent};
5
+ import{isSome as t}from"../core/arrayUtils.js";import{clone as e}from"../core/lang.js";import{offsetDate as n}from"../core/timeUtils.js";import i from"../time/TimeExtent.js";import{isWebMap as r}from"../webmap/utils.js";import{isWebScene as l}from"../webscene/utils.js";function s(t){return void 0!==t.timeInfo}async function u(t,e){return t.widgets?.timeSlider?.fullTimeExtent??a(t.allLayers,e)}function o(t){const e=t.numThumbs??2,n=t.currentTimeExtent;if(n){const{start:t,end:i}=n;return null!=t&&null!=i&&t.getTime()===i.getTime()?"instant":2===e?"time-window":null==t||0===t.getTime()?"cumulative-from-start":"cumulative-from-end"}return 2===e?"time-window":"cumulative-from-start"}function m(t){const{numStops:n,stopInterval:i,stops:r}=t;return r?{dates:e(r)}:i?{interval:i.clone()}:{count:n??5}}async function a(e,n){if(0===e.length)return i.allTime;await Promise.all(e.map((t=>t.load({signal:n}))));const r=e.filter(s),l=e.filter((t=>!s(t)&&null!=t.visibilityTimeExtent));if(0===r.length&&0===l.length)return i.allTime;const u=[],o=[];for(const t of r)"feature"!==t?.type&&"map-image"!==t?.type||!t.timeInfo?.hasLiveData?o.push(t):u.push(t);const m=t=>null==t||t.isAllTime,a=[...o.map((t=>{const e=t.timeInfo?.fullTimeExtent,{visibilityTimeExtent:n}=t;return e?.intersection(n)??n})),...l.map((t=>t.visibilityTimeExtent))];if(a.some(m))return i.allTime;const f=u.map((async t=>{const e=(await t.fetchRecomputedExtents({signal:n}))?.timeExtent??t.timeInfo?.fullTimeExtent,{visibilityTimeExtent:i}=t;return e?.intersection(i)??i})),c=(await Promise.allSettled(f)).map((t=>"fulfilled"===t.status?t.value:null));if(c.some(m))return i.allTime;const d=[...c,...a].filter(t);if(0===d.length)return i.allTime;return d.reduce(((t,e)=>t.union(e)))}function f(t,e){const n=t.currentTimeExtent;if(!n)return null;const{start:r,end:l}=n,s=r??l??null;switch(e){case"time-window":return new i({start:r,end:l});case"cumulative-from-start":return new i({start:null,end:s});case"cumulative-from-end":return new i({start:s,end:null});case"instant":return new i({start:s,end:s})}}async function c(t,e){if(!r(t)&&!l(t))return null;await t.load({signal:e});const n=t?.widgets?.timeSlider;if(!n)return null;const i=await u(t,e),s=n.loop,a=o(n);return{fullTimeExtent:i,loop:s,mode:a,playRate:n.stopDelay??2e3,stops:m(n),timeExtent:f(n,a)}}function d(t){if(!t)return t;const{start:e,end:r}=t;return new i({start:null!=e?n(e,-e.getTimezoneOffset(),"minutes"):e,end:null!=r?n(r,-r.getTimezoneOffset(),"minutes"):r})}function p(t){if(!t)return t;const{start:e,end:r}=t;return new i({start:null!=e?n(e,e.getTimezoneOffset(),"minutes"):e,end:null!=r?n(r,r.getTimezoneOffset(),"minutes"):r})}export{a as getTimeExtentFromLayers,c as getTimeSliderSettingsFromWebDocument,p as toLocalTimeExtent,d as toUTCTimeExtent};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import r from"../../core/Logger.js";import{deg2rad as i}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{px2pt as o,pt2px as n}from"../../core/screenUtils.js";import{GeometryCursor as a}from"../../geometry/GeometryCursor.js";import{fromValues as l,create as h,empty as c,expandPointInPlace as m,center as f,width as u,height as d,diagonal as g}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as p}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{isPoint as y,isPolygon as P,isPolyline as S,isExtent as w,isMultipoint as x}from"../../geometry/support/jsonUtils.js";import{SimpleEffectCursor as M}from"./CIMEffects.js";import b from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as k,getPlacementOperator as C}from"./CIMOperators.js";import{Placement as v}from"./CIMPlacements.js";import{defaultCIMValues as I}from"./defaultCIMValues.js";import{LineCapStyle as T,LineJoinStyle as R}from"./enums.js";import{getFirstFrame as z}from"./imageUtils.js";import{rotate as L}from"./mathUtils.js";import{addColorStops as F}from"./rasterizingUtils.js";import U from"./Rect.js";import A from"./TextRasterizer.js";import{getNumericValue as j,isCIMFill as G,getSize as D,isSVGImage as H,getRelativeGradientSize as B,fromCIMFontDecoration as E,fromCIMFontStyle as X,fromCIMHorizontalAlignment as J,fromCIMVerticalAlignment as N,getFillColor as O,getStrokeColor as q,getStrokeWidth as V,getFontStyle as W,getFontWeight as Y}from"./utils.js";import{destroyHiddenSvg as $,createHiddenSvg as K,createSvgElement as Q}from"../../views/2d/engine/svgUtils.js";import{glyphSize as Z,magicLabelLineHeight as tt,hittestToleranceSmallSymbol as et,hittestSmallSymbolThreshold as rt}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as it}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as st,getLineWidth as ot}from"../../views/2d/layers/graphics/graphicsUtils.js";const nt=Math.PI/180,at=.5,lt=()=>r.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class ht{constructor(t){this._t=t}static createIdentity(){return new ht([1,0,0,0,1,0])}clone(){const t=this._t;return new ht(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new ht([t,0,0,0,e,0])}scale(t,e){const r=this._t;return r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=e,r[4]*=e,r[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new ht([0,0,t,0,0,e])}translate(t,e){const r=this._t;return r[2]+=t,r[5]+=e,this}static createRotate(t){const e=Math.cos(t),r=Math.sin(t);return new ht([e,-r,0,r,e,0])}rotate(t){return ht.multiply(this,ht.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],r=Math.sqrt(t*t+e*e);return[t/r,e/r]}static multiply(t,e,r){const i=t._t,s=e._t,o=i[0]*s[0]+i[3]*s[1],n=i[1]*s[0]+i[4]*s[1],a=i[2]*s[0]+i[5]*s[1]+s[2],l=i[0]*s[3]+i[3]*s[4],h=i[1]*s[3]+i[4]*s[4],c=i[2]*s[3]+i[5]*s[4]+s[5],m=r._t;return m[0]=o,m[1]=n,m[2]=a,m[3]=l,m[4]=h,m[5]=c,r}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new ht([0,0,0,0,0,0]);e=1/e;const r=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,o=-t[1]*e,n=-t[3]*e,a=t[0]*e;return new ht([s,o,r,n,a,i])}}class ct{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new s(v,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||ht.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||ht.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const r=e?t.scaleRatio():1;ht.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*r)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e,r){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,r)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const r=t.symbolLayers;if(!r)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(r,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(r,e)}executeEffects(t,e){const r=this._resourceManager.geometryEngine;let i=new M(a.fromJSONCIM(e));for(const s of t){const t=k(s);t&&(i=t.execute(i,s,this.geomUnitsPerPoint(),null,r))}return i}drawSymbolLayers(t,e){let r=t.length;for(;r--;){const i=t[r];if(!i||!1===i.enable)continue;const s=i.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const r=dt(e,t,this.geomUnitsPerPoint());r&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,r),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const r=t.markerPlacement;if(r){const i=C(r);if(i){const s="CIMMarkerPlacementInsidePolygon"===r.type||"CIMMarkerPlacementPolygonCenter"===r.type&&r.clipAtBoundary;s&&this.pushClipPath(e);const o=i.execute(a.fromJSONCIM(e),r,this.geomUnitsPerPoint(),null,this._resourceManager.geometryEngine);if(o){let e=null;for(;(e=o.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(y(e))r.tx=e.x,r.ty=e.y,this.drawMarker(t,r);else if(P(e)){const i=_(e);i&&([r.tx,r.ty]=i,this.drawMarker(t,r))}else for(const i of e.points)if(r.tx=i[0],r.ty=i[1],this.drawMarker(t,r),this._earlyReturn)break;this._placementPool.release(r)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const r=this._resourceManager.getResource(t.url),i=j(t.size,I.CIMPictureMarker.size);if(null==r||i<=0)return;const s=r.width,o=r.height;if(!s||!o)return;const n=s/o,a=j(t.scaleX,1),l=ht.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,r=h.y;"Absolute"!==t.anchorPointUnits&&(e*=i*n*a,r*=i),l.translate(-e,-r)}let c=j(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*nt);let m=j(t.offsetX),f=j(t.offsetY);if(m||f){if(this._mapRotation){const t=nt*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=m*r+f*e;m=m*e-f*r,f=i}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l,!1),this.drawImage(t,i),this.pop()}drawVectorMarker(t,e){if(!t)return;const r=t.markerGraphics;if(!r)return;const i=j(t.size,I.CIMVectorMarker.size),s=t.frame,o=s?s.ymax-s.ymin:0,n=i&&o?i/o:1,a=ht.createIdentity();s&&a.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,r=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,r*=s.ymax-s.ymin):(e/=n,r/=n),a.translate(-e,-r)}1!==n&&a.scale(n,n);let h=j(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&a.rotate(h*nt);let c=j(t.offsetX),m=j(t.offsetY);if(c||m){if(this._mapRotation){const t=nt*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=c*r+m*e;c=c*e-m*r,m=i}a.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&a.scale(f,f);const u=e.getAngle();u&&a.rotate(u),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const d of r){d?.symbol&&d.geometry||lt().error("Invalid marker graphic",d);let t=d.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(d.symbol,d.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,r){if(!t)return;if(!y(e))return;if(j(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity();let s=j(t.angle);s=-s,s&&i.rotate(s*nt);const o=j(t.offsetX),n=j(t.offsetY);(o||n)&&i.translate(o,n);const a=this.geomUnitsPerPoint();1!==a&&i.scale(a,a),i.translate(e.x,e.y),this.push(i,!1),this.drawText(t,r),this.pop()}}class mt extends ct{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new U(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return l(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(P(t))this._processPath(t.rings,0);else if(S(t))this._processPath(t.paths,0);else if(w(t)){const e=yt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,r){if(!t||this._clipCount>0||null==r||r<=0)return;const i=Math.max(.5*this.transformSize(j(r,I.CIMSolidStroke.width)),.5*at);if(P(t))this._processPath(t.rings,i);else if(S(t))this._processPath(t.paths,i);else if(w(t)){const e=yt(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){P(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:r}=t,i=j(t.scaleX,1);let s=i*e,o=e;const n=this._resourceManager.getResource(r);if(null!=n){const t=n.height/n.width;s=i*(e?t>1?e:e/t:n.width),o=e?t>1?e*t:e:n.height}this._merge(this.transformPt([-s/2,-o/2]),0),this._merge(this.transformPt([-s/2,o/2]),0),this._merge(this.transformPt([s/2,-o/2]),0),this._merge(this.transformPt([s/2,o/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new A);const r=St(t);let[i,s]=this._textRasterizer.computeTextSize(e,r);i=o(i),s=o(s);const n=this.transformSize(1)*this.reverseTransformScalar(1);i*=n,s*=n;let a=0;switch(t.horizontalAlignment){case"Left":a=i/2;break;case"Right":a=-i/2}let l=0;switch(t.verticalAlignment){case"Bottom":l=s/2;break;case"Top":l=-s/2;break;case"Baseline":l=s/6}this._merge(this.transformPt([-i/2+a,-s/2+l]),0),this._merge(this.transformPt([-i/2+a,s/2+l]),0),this._merge(this.transformPt([i/2+a,-s/2+l]),0),this._merge(this.transformPt([i/2+a,s/2+l]),0)}_processPath(t,e){if(t)for(const r of t){const t=r?r.length:0;if(t>1){this._merge(this.transformPt(r[0]),e);for(let i=1;i<t;i++)this._merge(this.transformPt(r[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class ft extends ct{constructor(){super(...arguments),this._searchPoint=[0,0],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=$(this._svg),this._path=null,this._canvas=null}hitTest(t,e,r,i,s,a){const l=a*n(1);this.setTransform(),this.setGeomUnitsPerPoint(l),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/l,this._textInfo=i;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type);if(this._mapRotation=h?s:0,!has("esri-mobile")){const t=o(et*window.devicePixelRatio),r=o(rt);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(G))&&"CIMMeshSymbol"!==e?.type&&(D(e)??0)<r&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,r),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,r){null!=r?this._hittestSvgPath(t,r,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,r,i,s,o,n){null!=n?this._hittestSvgPath(t,n,!1,r):this._hitTestStroke(t,r)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:r}=t,i=j(t.scaleX,1),s=this._resourceManager.getResource(r);if(null==s||0===s.height||0===e)return;const o=e*this.geomUnitsPerPoint(),n=o*i*(s.width/s.height),a=this.reverseTransformPt(this._searchPoint),l=this._searchDistPoint;Math.abs(a[0])<n/2+l&&Math.abs(a[1])<o/2+l&&(this._earlyReturn=!0)}drawText(t,e){const r=this._textInfo;if(!r)return;const i=r.get(t);if(!i)return;if(!i.glyphMosaicItems.glyphs.length)return;const s=st(j(t.height,I.CIMTextSymbol.height)),{lineGapType:o,lineGap:n}=t,a=o?Pt(o,j(n),s):0,l="CIMBackgroundCallout"===t.callout?.type,h=it(i.glyphMosaicItems,{scale:s/Z,angle:0,xOffset:0,yOffset:0,horizontalAlignment:t.horizontalAlignment,verticalAlignment:t.verticalAlignment,maxLineWidth:ot(t.lineWidth),lineHeight:tt*Math.max(.25,Math.min(a||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!0,hasBackground:l}),c=this.reverseTransformPt(this._searchPoint),m=c[0],f=c[1];for(const u of h.glyphs)if(m>u.xTopLeft&&m<u.xBottomRight&&f>-u.yBottomRight&&f<-u.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(w(t)){const r=t;e=[[[r.xmin,r.ymin],[r.xmin,r.ymax],[r.xmax,r.ymax],[r.xmax,r.ymin],[r.xmin,r.ymin]]]}else if(P(t))e=t.rings;else{if(!S(t))return;e=t.paths}const r=this.reverseTransformPt(this._searchPoint);if(gt(r,e)&&(this._earlyReturn=!0),!this._earlyReturn){pt(r,e,this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=K(),this._path??=Q("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,r,i=0){const s=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),o=this.reverseTransformPt(this._searchPoint),n=h();p(n,t);const a={x:n[0],y:n[1],width:n[2]-n[0],height:n[3]-n[1]},l=this._getSvgPath();l.setAttribute("d",e);const c=l.getBBox();let m=Math.max(c.width/a.width,c.height/a.height),f=1;const u=2*s*m;u<1&&(f=2/u,m*=f,c.x*=f,c.y*=f,c.width*=f,c.height*=f);const d=1+i*m/2,g=this._getCanvasContext(c.width+2*d,c.height+2*d);g.setTransform(f,0,0,f,-c.x+d,-c.y+d);const _=new Path2D(e);r?g.fill(_):(g.lineWidth=i*(m/f),g.stroke(_));const y=(a.width*m-c.width)/2,P=(a.height*m-c.height)/2,S=Math.floor((o[0]-a.x-s)*m-y+d),w=Math.floor((a.height-(o[1]-a.y)-s)*m+P+d),x=Math.ceil(2*s*m),M=Math.ceil(2*s*m),b=g.getImageData(S,w,x,M).data;for(let h=3;h<b.length;h+=4)if(b[h]>127.5)return void(this._earlyReturn=!0)}_hitTestStroke(t,e){let r=null;if(w(t)){const e=t;r=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(P(t))r=t.rings;else{if(!S(t))return;r=t.paths}pt(this.reverseTransformPt(this._searchPoint),r,j(e,I.CIMSolidStroke.width)*this.geomUnitsPerPoint()/2+this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}class ut extends ct{constructor(t,e,r,i){super(e,r),this._applyAdditionalRenderProps=i,this._colorSubstitutionHelper=new b,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(w(t))this._buildPath(yt(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const r=this._ctx;r.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",r.fill("evenodd")}drawSolidStroke(t,e,r,i,s,o){if(!t||!e||0===r)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!1);else{if(!w(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(yt(t).rings,!0)}const n=this._ctx;n.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",n.lineWidth=Math.max(this.transformSize(r),at),this._setCapStyle(i),this._setJoinStyle(s),n.miterLimit=o,n.stroke()}pushClipPath(t){if(this._ctx.save(),P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else{if(!w(t))return;this._buildPath(yt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:r,url:i,tintColor:s}=t,o=j(t.scaleX,1),n=this._resourceManager.getResource(i);if(null==n)return;let a=e*(n.width/n.height),l=e;e||(a=n.width,l=n.height);const h=H(i)||"src"in n&&H(n.src);let c="getFrame"in n?z(n):n;r&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,r)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),g=this._ctx;g.save(),g.setTransform({m11:o*d*f,m12:o*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-a/2,-l/2,a,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new A);const r=St(t,this.transformSize(o(1))),i=this._textRasterizer.rasterizeText(e,r);if(!i)return;const{size:s,anchorX:n,anchorY:a,canvas:l}=i,h=s[0]*(n+.5),c=s[1]*(a-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),g=1;m.save(),m.setTransform({m11:g*u,m12:g*d,m21:-1*d,m22:g*u,m41:f[0]-g*h,m42:f[1]+g*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:r,height:i,offsetX:s,offsetY:o,rotation:n,scaleX:a,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(w(t))this._buildPath(yt(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=H(h)||"src"in c&&H(c.src);let u,d="getFrame"in c?z(c):c;if(r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);n||(n=0),s?s*=t:s=0,o?o*=t:o=0,i&&(i*=t);const e=i?i/c.height:1,r=a&&i?a*i/c.width:1;if(0!==n||1!==e||1!==r||0!==s||0!==o){const t=new DOMMatrix;t.rotateSelf(0,0,-n).translateSelf(s,o).scaleSelf(r,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,r){if(!t)return;let{colorSubstitutions:i,capStyle:s,joinStyle:o,miterLimit:a,tintColor:l,url:h,width:c}=r;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(P(t))f=t.rings;else if(S(t))f=t.paths;else{if(!w(t))return x(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=H(h)||"src"in m&&H(m.src);let d="getFrame"in m?z(m):m;i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const g=Math.max(this.transformSize(n(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let M,b;_.save(),this._setCapStyle(s),this._setJoinStyle(o),void 0!==a&&(_.miterLimit=a),_.lineWidth=g;for(let n of f)if(n=e(n),xt(n),n&&!(n.length<=1)){M=this.transformPt(n[0]);for(let t=1;t<n.length;t++){b=this.transformPt(n[t]);const e=_t(M,b),r=new DOMMatrix;r.translateSelf(0,M[1]-g/2).scaleSelf(p,p,1).rotateSelf(0,0,90-e),y.setTransform(r),_.strokeStyle=y,_.beginPath(),_.moveTo(M[0],M[1]),_.lineTo(b[0],b[1]),_.stroke(),M=b}}_.restore()}drawGradientFill(t,e){if(!t)return;let r;if(P(t))r=t.rings;else if(S(t))r=t.paths;else{if(!w(t))return void lt().error("Unable to draw gradient fill");r=yt(t).rings}this._buildPath(r,!0);const{angle:s,gradientMethod:o,gradientSize:a,gradientSizeUnits:l}=e,h=I.CIMGradientFill,p=e.gradientType??h.gradientType,_=-i(s??0),y=c();for(const i of r){const t=i?i.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(i[e]);"Linear"!==o&&"Rectangular"!==o||(t=L(t,-_)),m(y,t)}}const[x,M,b,k]=y,C=this._ctx;switch(C.save(),o){case"Buffered":lt().error(`Gradient method "${o}" currently unsupported.`);break;case"Linear":{const t=(M+k)/2,r="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(b-x),[i,s]="Discrete"===p?[b,b-r]:[x+r,x],o=L([i,t],_),c=L([s,t],_),m=C.createLinearGradient(o[0],o[1],c[0],c[1]);F(m,e),C.fillStyle=m,C.fill("evenodd");break}case"Circular":{const t=f(y),r=g(y)/2,i="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*r,[s,o]="Discrete"===p?[r,r-i]:[i,0],c=C.createRadialGradient(t[0],t[1],s,t[0],t[1],o);F(c,e),C.fillStyle=c,C.fill("evenodd");break}case"Rectangular":{const r=f(y),i=r[0],s=r[1],o=L(r,_),c=(r,i,s,n,a,l,h,c)=>{C.save(),this.pushClipPath(t);const m=L([a,l],_),f=L([h,c],_);C.beginPath(),C.moveTo(o[0],o[1]),C.lineTo(m[0],m[1]),C.lineTo(f[0],f[1]),C.lineTo(o[0],o[1]),C.clip();const u=L([r,i],_),d=L([s,n],_),g=C.createLinearGradient(u[0],u[1],d[0],d[1]);F(g,e),C.fillStyle=g,C.fill("evenodd"),C.restore()};let m="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(u(y)/2),[g,P]="Discrete"===p?[b,b-m]:[i+m,i];c(g,s,P,s,b,M,b,k),[g,P]="Discrete"===p?[x,x+m]:[i-m,i],c(g,s,P,s,x,k,x,M),m="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(d(y)/2);let[S,w]="Discrete"===p?[k,k-m]:[s+m,s];c(i,S,i,w,b,k,x,k),[S,w]="Discrete"===p?[M,M+m]:[s-m,s],c(i,S,i,w,x,M,b,M);break}}C.restore()}drawGradientStroke(t,r){const{capStyle:i,gradientMethod:s,gradientSize:o,gradientSizeUnits:a,joinStyle:l,miterLimit:h,width:c}=r;if(!t||0===c)return;let m;if(P(t))m=t.rings;else if(S(t))m=t.paths;else{if(!w(t))return void lt().error("Unable to draw gradient stroke");m=yt(t).rings}const f=r.gradientType??I.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(n(c)),.5),d=this._ctx;let g,p;d.save(),this._setCapStyle(i),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),xt(_),!_||_.length<=1)continue;let t=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const r=p[0]-g[0],i=p[1]-g[1];t+=Math.sqrt(r*r+i*i),g=p}const i="Absolute"===a?this.transformSize(n(o)):B(o,I.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const o=p[0]-g[0],n=p[1]-g[1],a=Math.sqrt(o*o+n*n);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=L([o/a,n/a],-Math.PI/2),r=u/2,s="Discrete"===f?r:i-r;h=(g[0]+p[0])/2+t*s,c=(g[1]+p[1])/2+e*s,m=h-t*i,y=c-e*i;break}case"AlongLine":{const e=o/a,r=n/a;"Discrete"===f?(h=g[0]-e*l,c=g[1]-r*l,m=h+e*i,y=c+r*i):(m=g[0]+e*(t-l),y=g[1]+r*(t-l),h=m-e*i,c=y-r*i);break}default:return lt().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);F(P,r),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=a,g=p}}d.restore()}_buildPath(t,e){const r=this._ctx;if(r.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let s=this.transformPt(i[0]);r.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(i[e]),r.lineTo(s[0],s[1]);e&&r.closePath()}}}_setCapStyle(t){switch(t){case T.Butt:this._ctx.lineCap="butt";break;case T.Round:this._ctx.lineCap="round";break;case T.Square:this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case R.Bevel:this._ctx.lineJoin="bevel";break;case R.Round:this._ctx.lineJoin="round";break;case R.Miter:this._ctx.lineJoin="miter"}}}function dt(t,e,r){let i=j(t.separation,I.CIMHatchFill.separation)*r,s=j(t.rotation);if(0===i)return null;i<0&&(i=-i);let o=0;const n=.5*i;for(;o>n;)o-=i;for(;o<-n;)o+=i;const a=h();p(a,e),a[0]-=n,a[1]-=n,a[2]+=n,a[3]+=n;const l=[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const c=Math.cos(s*nt),m=Math.sin(s*nt),f=-i*m,u=i*c;let d,g,_,y;o=j(t.offsetX)*r*m-j(t.offsetY)*r*c,d=_=Number.MAX_VALUE,g=y=-Number.MAX_VALUE;for(const h of l){const t=h[0],e=h[1],r=c*t+m*e,i=-m*t+c*e;d=Math.min(d,r),_=Math.min(_,i),g=Math.max(g,r),y=Math.max(y,i)}_=Math.floor(_/i)*i;let P=c*d-m*_-f*o/i,S=m*d+c*_-u*o/i,w=c*g-m*_-f*o/i,x=m*g+c*_-u*o/i;const M=1+Math.round((y-_)/i),b=[];for(let h=0;h<M;h++)P+=f,S+=u,w+=f,x+=u,b.push([[P,S],[w,x]]);return{paths:b}}function gt(t,e){let r=0;for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],o=i[s];if(e[1]>t[1]==o[1]>t[1])continue;(o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0])>0?r++:r--}}return 0!==r}function pt(t,e,r){for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],o=i[s];let n=(o[0]-e[0])*(o[0]-e[0])+(o[1]-e[1])*(o[1]-e[1]);if(0===n)continue;n=Math.sqrt(n);const a=((o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0]))/n;if(Math.abs(a)<r){const i=((o[0]-e[0])*(t[0]-e[0])+(o[1]-e[1])*(t[1]-e[1]))/n;if(i>-r&&i<n+r)return!0}}}return!1}function _t(t,e){const r=e[0]-t[0],i=e[1]-t[1];return 180/Math.PI*Math.atan2(i,r)}const yt=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,Pt=(t,e,r)=>{switch(t){case"ExtraLeading":return 1+e/r;case"Multiple":return e;case"Exact":return e/r}};function St(e,r=1){const i=E(e),s=X(e.fontStyleName),o=e.fontFamilyName??t,{weight:n,style:a}=s,l=r*(e.height||5),h=J(e.horizontalAlignment),c=N(e.verticalAlignment),m=O(e),f=O(e.haloSymbol),u=null!=f?r*(e.haloSize??0):0,d=q(e.symbol),g=r*(V(e.symbol)||0),p="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=O(p),y=V(p),P=q(p);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:o,style:W(a),weight:Y(n),decoration:i},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:a},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const wt=1e-4;function xt(t){let e,r,i,s,o,n=t[0],a=1;for(;a<t.length;)e=t[a][0]-n[0],r=t[a][1]-n[1],s=0!==e?r/e:Math.PI/2,void 0!==i&&Math.abs(s-i)<=wt?(t.splice(a-1,1),n=o):(o=n,n=t[a],a++),i=s}export{ct as CIMSymbolDrawHelper,ut as CanvasDrawHelper,mt as EnvDrawHelper,ft as HittestDrawHelper,ht as Transformation,nt as cDegToRad,Pt as lineGapType2LineHeight};
5
+ import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import r from"../../core/Logger.js";import{deg2rad as i}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{px2pt as o,pt2px as n}from"../../core/screenUtils.js";import{GeometryCursor as a}from"../../geometry/GeometryCursor.js";import{fromValues as l,create as h,empty as c,expandPointInPlace as m,center as f,width as u,height as d,diagonal as g}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as p}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{isPoint as y,isPolygon as P,isPolyline as S,isExtent as w,isMultipoint as x}from"../../geometry/support/jsonUtils.js";import{SimpleEffectCursor as M}from"./CIMEffects.js";import b from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as k,getPlacementOperator as C}from"./CIMOperators.js";import{Placement as v}from"./CIMPlacements.js";import{defaultCIMValues as I}from"./defaultCIMValues.js";import{LineCapStyle as T,LineJoinStyle as R}from"./enums.js";import{getFirstFrame as z}from"./imageUtils.js";import{rotate as L}from"./mathUtils.js";import{addColorStops as F}from"./rasterizingUtils.js";import U from"./Rect.js";import A from"./TextRasterizer.js";import{getNumericValue as j,isCIMFill as G,getSize as D,isSVGImage as H,getRelativeGradientSize as B,fromCIMFontDecoration as E,fromCIMFontStyle as X,fromCIMHorizontalAlignment as J,fromCIMVerticalAlignment as N,getFillColor as O,getStrokeColor as q,getStrokeWidth as V,getFontStyle as W,getFontWeight as Y}from"./utils.js";import{destroyHiddenSvg as $,createHiddenSvg as K,createSvgElement as Q}from"../../views/2d/engine/svgUtils.js";import{glyphSize as Z,magicLabelLineHeight as tt,hittestToleranceSmallSymbol as et,hittestSmallSymbolThreshold as rt}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as it}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as st,getLineWidth as ot}from"../../views/2d/layers/graphics/graphicsUtils.js";const nt=Math.PI/180,at=.5,lt=()=>r.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class ht{constructor(t){this._t=t}static createIdentity(){return new ht([1,0,0,0,1,0])}clone(){const t=this._t;return new ht(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new ht([t,0,0,0,e,0])}scale(t,e){const r=this._t;return r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=e,r[4]*=e,r[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new ht([0,0,t,0,0,e])}translate(t,e){const r=this._t;return r[2]+=t,r[5]+=e,this}static createRotate(t){const e=Math.cos(t),r=Math.sin(t);return new ht([e,-r,0,r,e,0])}rotate(t){return ht.multiply(this,ht.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],r=Math.sqrt(t*t+e*e);return[t/r,e/r]}static multiply(t,e,r){const i=t._t,s=e._t,o=i[0]*s[0]+i[3]*s[1],n=i[1]*s[0]+i[4]*s[1],a=i[2]*s[0]+i[5]*s[1]+s[2],l=i[0]*s[3]+i[3]*s[4],h=i[1]*s[3]+i[4]*s[4],c=i[2]*s[3]+i[5]*s[4]+s[5],m=r._t;return m[0]=o,m[1]=n,m[2]=a,m[3]=l,m[4]=h,m[5]=c,r}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new ht([0,0,0,0,0,0]);e=1/e;const r=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,o=-t[1]*e,n=-t[3]*e,a=t[0]*e;return new ht([s,o,r,n,a,i])}}class ct{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new s(v,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||ht.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||ht.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const r=e?t.scaleRatio():1;ht.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*r)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e,r){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,r)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const r=t.symbolLayers;if(!r)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(r,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(r,e)}executeEffects(t,e){const r=this._resourceManager.geometryEngine;let i=new M(a.fromJSONCIM(e));for(const s of t){const t=k(s);t&&(i=t.execute(i,s,this.geomUnitsPerPoint(),null,r))}return i}drawSymbolLayers(t,e){let r=t.length;for(;r--;){const i=t[r];if(!i||!1===i.enable)continue;const s=i.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const r=dt(e,t,this.geomUnitsPerPoint());r&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,r),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const r=t.markerPlacement;if(r){const i=C(r);if(i){const s="CIMMarkerPlacementInsidePolygon"===r.type||"CIMMarkerPlacementPolygonCenter"===r.type&&r.clipAtBoundary;s&&this.pushClipPath(e);const o=i.execute(a.fromJSONCIM(e),r,this.geomUnitsPerPoint(),null,this._resourceManager.geometryEngine);if(o){let e=null;for(;(e=o.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(y(e))r.tx=e.x,r.ty=e.y,this.drawMarker(t,r);else if(P(e)){const i=_(e);i&&([r.tx,r.ty]=i,this.drawMarker(t,r))}else if(S(e)){for(const i of e.paths)for(const e of i)if(r.tx=e[0],r.ty=e[1],this.drawMarker(t,r),this._earlyReturn)break}else for(const i of e.points)if(r.tx=i[0],r.ty=i[1],this.drawMarker(t,r),this._earlyReturn)break;this._placementPool.release(r)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const r=this._resourceManager.getResource(t.url),i=j(t.size,I.CIMPictureMarker.size);if(null==r||i<=0)return;const s=r.width,o=r.height;if(!s||!o)return;const n=s/o,a=j(t.scaleX,1),l=ht.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,r=h.y;"Absolute"!==t.anchorPointUnits&&(e*=i*n*a,r*=i),l.translate(-e,-r)}let c=j(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*nt);let m=j(t.offsetX),f=j(t.offsetY);if(m||f){if(this._mapRotation){const t=nt*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=m*r+f*e;m=m*e-f*r,f=i}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l,!1),this.drawImage(t,i),this.pop()}drawVectorMarker(t,e){if(!t)return;const r=t.markerGraphics;if(!r)return;const i=j(t.size,I.CIMVectorMarker.size),s=t.frame,o=s?s.ymax-s.ymin:0,n=i&&o?i/o:1,a=ht.createIdentity();s&&a.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,r=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,r*=s.ymax-s.ymin):(e/=n,r/=n),a.translate(-e,-r)}1!==n&&a.scale(n,n);let h=j(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&a.rotate(h*nt);let c=j(t.offsetX),m=j(t.offsetY);if(c||m){if(this._mapRotation){const t=nt*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=c*r+m*e;c=c*e-m*r,m=i}a.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&a.scale(f,f);const u=e.getAngle();u&&a.rotate(u),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const d of r){d?.symbol&&d.geometry||lt().error("Invalid marker graphic",d);let t=d.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(d.symbol,d.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,r){if(!t)return;if(!y(e))return;if(j(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity();let s=j(t.angle);s=-s,s&&i.rotate(s*nt);const o=j(t.offsetX),n=j(t.offsetY);(o||n)&&i.translate(o,n);const a=this.geomUnitsPerPoint();1!==a&&i.scale(a,a),i.translate(e.x,e.y),this.push(i,!1),this.drawText(t,r),this.pop()}}class mt extends ct{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new U(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return l(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(P(t))this._processPath(t.rings,0);else if(S(t))this._processPath(t.paths,0);else if(w(t)){const e=yt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,r){if(!t||this._clipCount>0||null==r||r<=0)return;const i=Math.max(.5*this.transformSize(j(r,I.CIMSolidStroke.width)),.5*at);if(P(t))this._processPath(t.rings,i);else if(S(t))this._processPath(t.paths,i);else if(w(t)){const e=yt(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){P(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:r}=t,i=j(t.scaleX,1);let s=i*e,o=e;const n=this._resourceManager.getResource(r);if(null!=n){const t=n.height/n.width;s=i*(e?t>1?e:e/t:n.width),o=e?t>1?e*t:e:n.height}this._merge(this.transformPt([-s/2,-o/2]),0),this._merge(this.transformPt([-s/2,o/2]),0),this._merge(this.transformPt([s/2,-o/2]),0),this._merge(this.transformPt([s/2,o/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new A);const r=St(t);let[i,s]=this._textRasterizer.computeTextSize(e,r);i=o(i),s=o(s);const n=this.transformSize(1)*this.reverseTransformScalar(1);i*=n,s*=n;let a=0;switch(t.horizontalAlignment){case"Left":a=i/2;break;case"Right":a=-i/2}let l=0;switch(t.verticalAlignment){case"Bottom":l=s/2;break;case"Top":l=-s/2;break;case"Baseline":l=s/6}this._merge(this.transformPt([-i/2+a,-s/2+l]),0),this._merge(this.transformPt([-i/2+a,s/2+l]),0),this._merge(this.transformPt([i/2+a,-s/2+l]),0),this._merge(this.transformPt([i/2+a,s/2+l]),0)}_processPath(t,e){if(t)for(const r of t){const t=r?r.length:0;if(t>1){this._merge(this.transformPt(r[0]),e);for(let i=1;i<t;i++)this._merge(this.transformPt(r[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class ft extends ct{constructor(){super(...arguments),this._searchPoint=[0,0],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=$(this._svg),this._path=null,this._canvas=null}hitTest(t,e,r,i,s,a){const l=a*n(1);this.setTransform(),this.setGeomUnitsPerPoint(l),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/l,this._textInfo=i;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type);if(this._mapRotation=h?s:0,!has("esri-mobile")){const t=o(et*window.devicePixelRatio),r=o(rt);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(G))&&"CIMMeshSymbol"!==e?.type&&(D(e)??0)<r&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,r),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,r){null!=r?this._hittestSvgPath(t,r,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,r,i,s,o,n){null!=n?this._hittestSvgPath(t,n,!1,r):this._hitTestStroke(t,r)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:r}=t,i=j(t.scaleX,1),s=this._resourceManager.getResource(r);if(null==s||0===s.height||0===e)return;const o=e*this.geomUnitsPerPoint(),n=o*i*(s.width/s.height),a=this.reverseTransformPt(this._searchPoint),l=this._searchDistPoint;Math.abs(a[0])<n/2+l&&Math.abs(a[1])<o/2+l&&(this._earlyReturn=!0)}drawText(t,e){const r=this._textInfo;if(!r)return;const i=r.get(t);if(!i)return;if(!i.glyphMosaicItems.glyphs.length)return;const s=st(j(t.height,I.CIMTextSymbol.height)),{lineGapType:o,lineGap:n}=t,a=o?Pt(o,j(n),s):0,l="CIMBackgroundCallout"===t.callout?.type,h=it(i.glyphMosaicItems,{scale:s/Z,angle:0,xOffset:0,yOffset:0,horizontalAlignment:t.horizontalAlignment,verticalAlignment:t.verticalAlignment,maxLineWidth:ot(t.lineWidth),lineHeight:tt*Math.max(.25,Math.min(a||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!0,hasBackground:l}),c=this.reverseTransformPt(this._searchPoint),m=c[0],f=c[1];for(const u of h.glyphs)if(m>u.xTopLeft&&m<u.xBottomRight&&f>-u.yBottomRight&&f<-u.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(w(t)){const r=t;e=[[[r.xmin,r.ymin],[r.xmin,r.ymax],[r.xmax,r.ymax],[r.xmax,r.ymin],[r.xmin,r.ymin]]]}else if(P(t))e=t.rings;else{if(!S(t))return;e=t.paths}const r=this.reverseTransformPt(this._searchPoint);if(gt(r,e)&&(this._earlyReturn=!0),!this._earlyReturn){pt(r,e,this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=K(),this._path??=Q("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,r,i=0){const s=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),o=this.reverseTransformPt(this._searchPoint),n=h();p(n,t);const a={x:n[0],y:n[1],width:n[2]-n[0],height:n[3]-n[1]},l=this._getSvgPath();l.setAttribute("d",e);const c=l.getBBox();let m=Math.max(c.width/a.width,c.height/a.height),f=1;const u=2*s*m;u<1&&(f=2/u,m*=f,c.x*=f,c.y*=f,c.width*=f,c.height*=f);const d=1+i*m/2,g=this._getCanvasContext(c.width+2*d,c.height+2*d);g.setTransform(f,0,0,f,-c.x+d,-c.y+d);const _=new Path2D(e);r?g.fill(_):(g.lineWidth=i*(m/f),g.stroke(_));const y=(a.width*m-c.width)/2,P=(a.height*m-c.height)/2,S=Math.floor((o[0]-a.x-s)*m-y+d),w=Math.floor((a.height-(o[1]-a.y)-s)*m+P+d),x=Math.ceil(2*s*m),M=Math.ceil(2*s*m),b=g.getImageData(S,w,x,M).data;for(let h=3;h<b.length;h+=4)if(b[h]>127.5)return void(this._earlyReturn=!0)}_hitTestStroke(t,e){let r=null;if(w(t)){const e=t;r=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(P(t))r=t.rings;else{if(!S(t))return;r=t.paths}pt(this.reverseTransformPt(this._searchPoint),r,j(e,I.CIMSolidStroke.width)*this.geomUnitsPerPoint()/2+this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}class ut extends ct{constructor(t,e,r,i){super(e,r),this._applyAdditionalRenderProps=i,this._colorSubstitutionHelper=new b,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(w(t))this._buildPath(yt(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const r=this._ctx;r.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",r.fill("evenodd")}drawSolidStroke(t,e,r,i,s,o){if(!t||!e||0===r)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!1);else{if(!w(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(yt(t).rings,!0)}const n=this._ctx;n.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",n.lineWidth=Math.max(this.transformSize(r),at),this._setCapStyle(i),this._setJoinStyle(s),n.miterLimit=o,n.stroke()}pushClipPath(t){if(this._ctx.save(),P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else{if(!w(t))return;this._buildPath(yt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:r,url:i,tintColor:s}=t,o=j(t.scaleX,1),n=this._resourceManager.getResource(i);if(null==n)return;let a=e*(n.width/n.height),l=e;e||(a=n.width,l=n.height);const h=H(i)||"src"in n&&H(n.src);let c="getFrame"in n?z(n):n;r&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,r)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),g=this._ctx;g.save(),g.setTransform({m11:o*d*f,m12:o*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-a/2,-l/2,a,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new A);const r=St(t,this.transformSize(o(1))),i=this._textRasterizer.rasterizeText(e,r);if(!i)return;const{size:s,anchorX:n,anchorY:a,canvas:l}=i,h=s[0]*(n+.5),c=s[1]*(a-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),g=1;m.save(),m.setTransform({m11:g*u,m12:g*d,m21:-1*d,m22:g*u,m41:f[0]-g*h,m42:f[1]+g*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:r,height:i,offsetX:s,offsetY:o,rotation:n,scaleX:a,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(w(t))this._buildPath(yt(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=H(h)||"src"in c&&H(c.src);let u,d="getFrame"in c?z(c):c;if(r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);n||(n=0),s?s*=t:s=0,o?o*=t:o=0,i&&(i*=t);const e=i?i/c.height:1,r=a&&i?a*i/c.width:1;if(0!==n||1!==e||1!==r||0!==s||0!==o){const t=new DOMMatrix;t.rotateSelf(0,0,-n).translateSelf(s,o).scaleSelf(r,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,r){if(!t)return;let{colorSubstitutions:i,capStyle:s,joinStyle:o,miterLimit:a,tintColor:l,url:h,width:c}=r;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(P(t))f=t.rings;else if(S(t))f=t.paths;else{if(!w(t))return x(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=H(h)||"src"in m&&H(m.src);let d="getFrame"in m?z(m):m;i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const g=Math.max(this.transformSize(n(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let M,b;_.save(),this._setCapStyle(s),this._setJoinStyle(o),void 0!==a&&(_.miterLimit=a),_.lineWidth=g;for(let n of f)if(n=e(n),xt(n),n&&!(n.length<=1)){M=this.transformPt(n[0]);for(let t=1;t<n.length;t++){b=this.transformPt(n[t]);const e=_t(M,b),r=new DOMMatrix;r.translateSelf(0,M[1]-g/2).scaleSelf(p,p,1).rotateSelf(0,0,90-e),y.setTransform(r),_.strokeStyle=y,_.beginPath(),_.moveTo(M[0],M[1]),_.lineTo(b[0],b[1]),_.stroke(),M=b}}_.restore()}drawGradientFill(t,e){if(!t)return;let r;if(P(t))r=t.rings;else if(S(t))r=t.paths;else{if(!w(t))return void lt().error("Unable to draw gradient fill");r=yt(t).rings}this._buildPath(r,!0);const{angle:s,gradientMethod:o,gradientSize:a,gradientSizeUnits:l}=e,h=I.CIMGradientFill,p=e.gradientType??h.gradientType,_=-i(s??0),y=c();for(const i of r){const t=i?i.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(i[e]);"Linear"!==o&&"Rectangular"!==o||(t=L(t,-_)),m(y,t)}}const[x,M,b,k]=y,C=this._ctx;switch(C.save(),o){case"Buffered":lt().error(`Gradient method "${o}" currently unsupported.`);break;case"Linear":{const t=(M+k)/2,r="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(b-x),[i,s]="Discrete"===p?[b,b-r]:[x+r,x],o=L([i,t],_),c=L([s,t],_),m=C.createLinearGradient(o[0],o[1],c[0],c[1]);F(m,e),C.fillStyle=m,C.fill("evenodd");break}case"Circular":{const t=f(y),r=g(y)/2,i="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*r,[s,o]="Discrete"===p?[r,r-i]:[i,0],c=C.createRadialGradient(t[0],t[1],s,t[0],t[1],o);F(c,e),C.fillStyle=c,C.fill("evenodd");break}case"Rectangular":{const r=f(y),i=r[0],s=r[1],o=L(r,_),c=(r,i,s,n,a,l,h,c)=>{C.save(),this.pushClipPath(t);const m=L([a,l],_),f=L([h,c],_);C.beginPath(),C.moveTo(o[0],o[1]),C.lineTo(m[0],m[1]),C.lineTo(f[0],f[1]),C.lineTo(o[0],o[1]),C.clip();const u=L([r,i],_),d=L([s,n],_),g=C.createLinearGradient(u[0],u[1],d[0],d[1]);F(g,e),C.fillStyle=g,C.fill("evenodd"),C.restore()};let m="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(u(y)/2),[g,P]="Discrete"===p?[b,b-m]:[i+m,i];c(g,s,P,s,b,M,b,k),[g,P]="Discrete"===p?[x,x+m]:[i-m,i],c(g,s,P,s,x,k,x,M),m="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(d(y)/2);let[S,w]="Discrete"===p?[k,k-m]:[s+m,s];c(i,S,i,w,b,k,x,k),[S,w]="Discrete"===p?[M,M+m]:[s-m,s],c(i,S,i,w,x,M,b,M);break}}C.restore()}drawGradientStroke(t,r){const{capStyle:i,gradientMethod:s,gradientSize:o,gradientSizeUnits:a,joinStyle:l,miterLimit:h,width:c}=r;if(!t||0===c)return;let m;if(P(t))m=t.rings;else if(S(t))m=t.paths;else{if(!w(t))return void lt().error("Unable to draw gradient stroke");m=yt(t).rings}const f=r.gradientType??I.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(n(c)),.5),d=this._ctx;let g,p;d.save(),this._setCapStyle(i),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),xt(_),!_||_.length<=1)continue;let t=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const r=p[0]-g[0],i=p[1]-g[1];t+=Math.sqrt(r*r+i*i),g=p}const i="Absolute"===a?this.transformSize(n(o)):B(o,I.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const o=p[0]-g[0],n=p[1]-g[1],a=Math.sqrt(o*o+n*n);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=L([o/a,n/a],-Math.PI/2),r=u/2,s="Discrete"===f?r:i-r;h=(g[0]+p[0])/2+t*s,c=(g[1]+p[1])/2+e*s,m=h-t*i,y=c-e*i;break}case"AlongLine":{const e=o/a,r=n/a;"Discrete"===f?(h=g[0]-e*l,c=g[1]-r*l,m=h+e*i,y=c+r*i):(m=g[0]+e*(t-l),y=g[1]+r*(t-l),h=m-e*i,c=y-r*i);break}default:return lt().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);F(P,r),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=a,g=p}}d.restore()}_buildPath(t,e){const r=this._ctx;if(r.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let s=this.transformPt(i[0]);r.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(i[e]),r.lineTo(s[0],s[1]);e&&r.closePath()}}}_setCapStyle(t){switch(t){case T.Butt:this._ctx.lineCap="butt";break;case T.Round:this._ctx.lineCap="round";break;case T.Square:this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case R.Bevel:this._ctx.lineJoin="bevel";break;case R.Round:this._ctx.lineJoin="round";break;case R.Miter:this._ctx.lineJoin="miter"}}}function dt(t,e,r){let i=j(t.separation,I.CIMHatchFill.separation)*r,s=j(t.rotation);if(0===i)return null;i<0&&(i=-i);let o=0;const n=.5*i;for(;o>n;)o-=i;for(;o<-n;)o+=i;const a=h();p(a,e),a[0]-=n,a[1]-=n,a[2]+=n,a[3]+=n;const l=[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const c=Math.cos(s*nt),m=Math.sin(s*nt),f=-i*m,u=i*c;let d,g,_,y;o=j(t.offsetX)*r*m-j(t.offsetY)*r*c,d=_=Number.MAX_VALUE,g=y=-Number.MAX_VALUE;for(const h of l){const t=h[0],e=h[1],r=c*t+m*e,i=-m*t+c*e;d=Math.min(d,r),_=Math.min(_,i),g=Math.max(g,r),y=Math.max(y,i)}_=Math.floor(_/i)*i;let P=c*d-m*_-f*o/i,S=m*d+c*_-u*o/i,w=c*g-m*_-f*o/i,x=m*g+c*_-u*o/i;const M=1+Math.round((y-_)/i),b=[];for(let h=0;h<M;h++)P+=f,S+=u,w+=f,x+=u,b.push([[P,S],[w,x]]);return{paths:b}}function gt(t,e){let r=0;for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],o=i[s];if(e[1]>t[1]==o[1]>t[1])continue;(o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0])>0?r++:r--}}return 0!==r}function pt(t,e,r){for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],o=i[s];let n=(o[0]-e[0])*(o[0]-e[0])+(o[1]-e[1])*(o[1]-e[1]);if(0===n)continue;n=Math.sqrt(n);const a=((o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0]))/n;if(Math.abs(a)<r){const i=((o[0]-e[0])*(t[0]-e[0])+(o[1]-e[1])*(t[1]-e[1]))/n;if(i>-r&&i<n+r)return!0}}}return!1}function _t(t,e){const r=e[0]-t[0],i=e[1]-t[1];return 180/Math.PI*Math.atan2(i,r)}const yt=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,Pt=(t,e,r)=>{switch(t){case"ExtraLeading":return 1+e/r;case"Multiple":return e;case"Exact":return e/r}};function St(e,r=1){const i=E(e),s=X(e.fontStyleName),o=e.fontFamilyName??t,{weight:n,style:a}=s,l=r*(e.height||5),h=J(e.horizontalAlignment),c=N(e.verticalAlignment),m=O(e),f=O(e.haloSymbol),u=null!=f?r*(e.haloSize??0):0,d=q(e.symbol),g=r*(V(e.symbol)||0),p="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=O(p),y=V(p),P=q(p);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:o,style:W(a),weight:Y(n),decoration:i},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:a},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const wt=1e-4;function xt(t){let e,r,i,s,o,n=t[0],a=1;for(;a<t.length;)e=t[a][0]-n[0],r=t[a][1]-n[1],s=0!==e?r/e:Math.PI/2,void 0!==i&&Math.abs(s-i)<=wt?(t.splice(a-1,1),n=o):(o=n,n=t[a],a++),i=s}export{ct as CIMSymbolDrawHelper,ut as CanvasDrawHelper,mt as EnvDrawHelper,ft as HittestDrawHelper,ht as Transformation,nt as cDegToRad,Pt as lineGapType2LineHeight};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{AMeshFactory as e}from"./MeshFactory.js";import{createMatcher as t}from"../../util/createMatcher.js";class s extends e{static async create(e,o){const r=await t(e,o.symbology),c=o.labels?await t(e,o.labels):null;return new s(r,c)}constructor(e,t){super(),this._symbology=e,this._labels=t}destroy(){}async enqueueMatcherRequests(e,t){await Promise.all([this._symbology.fetchResources(e,t),this._labels?.fetchResources(e,t)])}enqueueWriterRequests(e,t,s,o){const r=this._symbology.match(t,s,o);if(r){for(const o of r)o.enqueueRequest(e,t,s);if(this._labels){const r=this._labels.match(t,s,o);if(!r)return;for(const o of r)o.enqueueRequest(e,t,s)}}}write(e,t,s,o,r,c){const a=this._symbology.match(s,o,r);if(!a)return;for(const n of a)n.write(e,t,s,o,c);if(e.entityRecordCount()>=1&&this._labels){const n=this._labels.match(s,o,r);if(!n)return;for(const r of n)r.setReferences(a),r.write(e,t,s,o,c)}}getSortKey(e,t){return this._symbology.getSortKey(e,t)}hasArcadeDependency(e){return this._symbology.hasArcadeDependency(e)}}export{s as FeatureMeshFactory};
5
+ import{AMeshFactory as e}from"./MeshFactory.js";import{createMatcher as t}from"../../util/createMatcher.js";class s extends e{static async create(e,o){const r=await t(e,o.symbology),c=o.labels?await t(e,o.labels):null;return new s(r,c)}constructor(e,t){super(),this._symbology=e,this._labels=t}destroy(){}async enqueueMatcherRequests(e,t){await Promise.all([this._symbology.fetchResources(e,t),this._labels?.fetchResources(e,t)])}enqueueWriterRequests(e,t,s,o){const r=this._symbology.match(t,s,o);if(r){for(const o of r)o.enqueueRequest(e,t,s);if(this._labels){const r=this._labels.match(t,s,o);if(!r)return;for(const o of r)o.enqueueRequest(e,t,s)}}}write(e,t,s,o,r,c){const a=this._symbology.match(s,o,r);if(!a)return;for(const n of a)n.write(e,t,s,o,c);if(e.entityRecordCount()>=1&&this._labels){const n=this._labels.match(s,o,r);if(!n)return;for(const r of n)r.setReferences(a),r.write(e,t,s,o,c)}}getSortKey(e,t){return this._symbology.getSortKey(e,t)}hasArcadeDependency(e){return!(!this._symbology.hasArcadeDependency(e)&&!this._labels?.hasArcadeDependency(e))}}export{s as FeatureMeshFactory};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../../../../chunks/tslib.es6.js";import{animationDebugFlags as t}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{generateVirtualMachineSource as o}from"../../../animations/instructions.js";import{location as e,uniform as r,option as a}from"../../GraphShaderModule.js";import{sin as s,cos as l,Float as n,Mat3 as m,Vec3 as u,lessThanEqual as p,cond as d,ifElse as c,equal as y,texture2D as f,clamp as h,abs as S,Vec2 as b,block as g,Vec4 as V}from"../../graph/glsl.js";import{AnimationUniformInfo as v}from"./AnimationUniformInfo.js";import{FeatureVertexInput as w,FeatureFragmentInput as x,AFeatureShader as j}from"../shaders/AFeatureShader.js";import{softEdgeRatio as z}from"../shaders/constants.js";import{MosaicInfo as T}from"../shaders/MosaicInfo.js";import{rgba2float as _}from"../shaders/utils.js";import{VisualVariableColor as I}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as C}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as O}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as M}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as P}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as D}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as F}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableAngle as R}from"../shaders/vvUtils.js";class A extends w{}i([e(3,V)],A.prototype,"animationPointerAndBaseSizeAndReferenceSize",void 0),i([e(4,b)],A.prototype,"zoomRange",void 0);class L extends x{}class U extends j{_getScreenPosition(i){const{pos:t,translation:o,rotation:e,scale:r,offset:a,id:p,vvScale:d}=i,c=R(this,p).multiply(Math.PI/180),y=o.x.multiply(4/3),f=o.y.multiply(-1).multiply(4/3),h=s(e.subtract(c)),S=l(e.subtract(c)),b=new n(0),g=new n(1),{pixelRatio:V}=this.animationInfo,v=new m(g,b,b,b,g,b,y.multiply(V),f.multiply(V),g),w=new m(S,h.multiply(-1),b,h,S,b,0,0,g),x=r.multiply(d).multiply(V).multiply(4/3),j=w.multiply(x),z=this.animationInfo.toScreen.multiply(new u(t,1)),T=v.multiply(z).xy,_=j.multiply(new u(a,0)).xy;return T.add(_)}_clip(i,o){let e=super.clip(i,o);const r=p(this._getLocalTimeOrigin(i),new n(0));return t.forceGlobalTimeOrigin||(e=e.add(d([r,()=>new n(2)],[!0,()=>new n(0)]))),e}_getLocalTimeOrigin(i){return this.storage.getLocalTimeOrigin(i)}_toNdc(i){return this.animationInfo.toNdc.multiply(new u(i,1)).xy}_getEvalParams(i,t){const{globalTime:o,animationTextureSize:e,animationTexture:r}=this.animationInfo;return{globalTime:o,localTimeOrigin:this._getLocalTimeOrigin(i.id),animationTextureSize:e,animationTexture:r,pixelDimensions:t}}_getColor(i,t){return c(y(t.isSDF,new n(1)),this._getSDFColor(i,t),this._getSpriteColor(i,t))}_getSpriteColor(i,t){return f(this.mosaicInfo.texture,i).multiply(t.color)}_getSDFColor(i,t){const o=f(this.mosaicInfo.texture,i),e=new n(.5).subtract(_(o)).multiply(t.distanceToPx).multiply(z),r=h(new n(.5).subtract(e),new n(0),new n(1)),a=t.color.multiply(r),s=t.outlineSize.multiply(.5),l=S(e).subtract(s),m=h(new n(.5).subtract(l),new n(0),new n(1)),u=t.outlineColor.multiply(m);return new n(1).subtract(u.a).multiply(a).add(u)}}function E(i,t,e){const r=i.add(new b(t,0)),a=f(e.animationTexture,r.add(.5).divide(e.animationTextureSize)).xy;return i=i.add(a),g({animationPointer:i,...e},V,null,(i=>{const{out:t}=i;if(!t)throw new Error("out is null");return o({...i,out:t})}))}i([r(T)],U.prototype,"mosaicInfo",void 0),i([r(v)],U.prototype,"animationInfo",void 0),i([a(I)],U.prototype,"visualVariableColor",void 0),i([a(C)],U.prototype,"visualVariableOpacity",void 0),i([a(M)],U.prototype,"visualVariableSizeMinMaxValue",void 0),i([a(P)],U.prototype,"visualVariableSizeScaleStops",void 0),i([a(D)],U.prototype,"visualVariableSizeStops",void 0),i([a(F)],U.prototype,"visualVariableSizeUnitValue",void 0),i([a(O)],U.prototype,"visualVariableRotation",void 0);export{L as AAnimatedFragmentInput,U as AAnimatedShader,A as AAnimatedVertexInput,E as getValue};
5
+ import{_ as i}from"../../../../../../../chunks/tslib.es6.js";import{animationDebugFlags as t}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{generateVirtualMachineSource as o}from"../../../animations/instructions.js";import{location as e,uniform as a,option as r}from"../../GraphShaderModule.js";import{sin as l,cos as s,negate as n,Float as m,Mat3 as u,Vec3 as p,lessThanEqual as d,cond as c,ifElse as y,equal as f,texture2D as h,clamp as S,abs as b,Vec2 as g,block as V,Vec4 as v}from"../../graph/glsl.js";import{AnimationUniformInfo as w}from"./AnimationUniformInfo.js";import{FeatureVertexInput as x,FeatureFragmentInput as j,AFeatureShader as z}from"../shaders/AFeatureShader.js";import{softEdgeRatio as T}from"../shaders/constants.js";import{MosaicInfo as _}from"../shaders/MosaicInfo.js";import{rgba2float as I}from"../shaders/utils.js";import{VisualVariableColor as C}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as O}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as M}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as P}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as D}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as F}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as R}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableAngle as A}from"../shaders/vvUtils.js";class L extends x{}i([e(3,v)],L.prototype,"animationPointerAndBaseSizeAndReferenceSize",void 0),i([e(4,g)],L.prototype,"zoomRange",void 0);class U extends j{}class E extends z{_getScreenPosition(i){const{pos:t,translation:o,rotation:e,scale:a,offset:r,id:d,vvScale:c}=i,y=A(this,d).multiply(Math.PI/180),f=o.x.multiply(4/3),h=o.y.multiply(-1).multiply(4/3),S=l(y),b=s(y),g=b.multiply(f).add(n(S).multiply(h)),V=S.multiply(f).add(b.multiply(h)),v=l(e.subtract(y)),w=s(e.subtract(y)),x=new m(0),j=new m(1),{pixelRatio:z}=this.animationInfo,T=new u(j,x,x,x,j,x,g.multiply(z),V.multiply(z),j),_=new u(w,v.multiply(-1),x,v,w,x,0,0,j),I=a.multiply(c).multiply(z).multiply(4/3),C=_.multiply(I),O=this.animationInfo.toScreen.multiply(new p(t,1)),M=T.multiply(O).xy,P=C.multiply(new p(r,0)).xy;return M.add(P)}_clip(i,o){let e=super.clip(i,o);const a=d(this._getLocalTimeOrigin(i),new m(0));return t.forceGlobalTimeOrigin||(e=e.add(c([a,()=>new m(2)],[!0,()=>new m(0)]))),e}_getLocalTimeOrigin(i){return this.storage.getLocalTimeOrigin(i)}_toNdc(i){return this.animationInfo.toNdc.multiply(new p(i,1)).xy}_getEvalParams(i,t){const{globalTime:o,animationTextureSize:e,animationTexture:a}=this.animationInfo;return{globalTime:o,localTimeOrigin:this._getLocalTimeOrigin(i.id),animationTextureSize:e,animationTexture:a,pixelDimensions:t}}_getColor(i,t){return y(f(t.isSDF,new m(1)),this._getSDFColor(i,t),this._getSpriteColor(i,t))}_getSpriteColor(i,t){return h(this.mosaicInfo.texture,i).multiply(t.color)}_getSDFColor(i,t){const o=h(this.mosaicInfo.texture,i),e=new m(.5).subtract(I(o)).multiply(t.distanceToPx).multiply(T),a=S(new m(.5).subtract(e),new m(0),new m(1)),r=t.color.multiply(a),l=t.outlineSize.multiply(.5),s=b(e).subtract(l),n=S(new m(.5).subtract(s),new m(0),new m(1)),u=t.outlineColor.multiply(n);return new m(1).subtract(u.a).multiply(r).add(u)}}function G(i,t,e){const a=i.add(new g(t,0)),r=h(e.animationTexture,a.add(.5).divide(e.animationTextureSize)).xy;return i=i.add(r),V({animationPointer:i,...e},v,null,(i=>{const{out:t}=i;if(!t)throw new Error("out is null");return o({...i,out:t})}))}i([a(_)],E.prototype,"mosaicInfo",void 0),i([a(w)],E.prototype,"animationInfo",void 0),i([r(C)],E.prototype,"visualVariableColor",void 0),i([r(O)],E.prototype,"visualVariableOpacity",void 0),i([r(P)],E.prototype,"visualVariableSizeMinMaxValue",void 0),i([r(D)],E.prototype,"visualVariableSizeScaleStops",void 0),i([r(F)],E.prototype,"visualVariableSizeStops",void 0),i([r(R)],E.prototype,"visualVariableSizeUnitValue",void 0),i([r(M)],E.prototype,"visualVariableRotation",void 0);export{U as AAnimatedFragmentInput,E as AAnimatedShader,L as AAnimatedVertexInput,G as getValue};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{FeatureSymbologyDrawOrder as e}from"../../../enums.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{resolveDynamicUniforms as r,getFeatureUniforms as s,getSelectionDefines as i,isHittest as o,isHighlight as a,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{TechniqueType as m}from"../TechniqueType.js";import{getAntialiasingControls as p}from"./utils.js";import{GradientStrokeShader as l}from"../shaders/GradientStrokeShader.js";import{FramebufferBit as c,CompareFunction as u,StencilOperation as f}from"../../../../../../webgl/enums.js";class E extends t{constructor(){super(...arguments),this.type=m.GradientStroke,this.shaders={geometry:new l},this.symbologyPlane=e.LINE}render(e,t){const{context:m,painter:l,pixelRatio:E}=e,d=t.instance.getInput();if(l.setShader({shader:this.shaders.geometry,uniforms:{...r(e,t.target,d.uniforms),...s(e,t.target),antialiasingControls:p(E),mosaicInfo:l.textureManager.getMosaicInfo(m,t.textureKey)},defines:{...i(e)},optionalAttributes:d.optionalAttributes,useComputeBuffer:o(e)}),o(e)||a(e)){const r=n(e);return l.setPipelineState(r),void l.submitDraw(e,t)}e.context.setClearDepth(1),e.context.clear(c.DEPTH);const h={color:!1,depth:{write:{zNear:0,zFar:1},test:u.LESS},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:u.EQUAL,mask:255,op:{fail:f.KEEP,zFail:f.KEEP,zPass:f.KEEP}}}};l.setPipelineState(h),l.submitDraw(e,t);const P={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:u.EQUAL},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:u.EQUAL,mask:255,op:{fail:f.KEEP,zFail:f.KEEP,zPass:f.KEEP}}}};l.setPipelineState(P),l.submitDraw(e,t)}}export{E as GradientStrokeTechnique};
5
+ import{FeatureSymbologyDrawOrder as e}from"../../../enums.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{isHittest as s,isHighlight as r,getFeaturePipelineState as i,resolveDynamicUniforms as o,getFeatureUniforms as a,getSelectionDefines as n}from"../featureTechniqueUtils.js";import{TechniqueType as m}from"../TechniqueType.js";import{getAntialiasingControls as u}from"./utils.js";import{GradientStrokeShader as l}from"../shaders/GradientStrokeShader.js";import{FramebufferBit as p,CompareFunction as c,StencilOperation as f}from"../../../../../../webgl/enums.js";class h extends t{constructor(){super(...arguments),this.type=m.GradientStroke,this.shaders={geometry:new l},this.symbologyPlane=e.LINE}render(e,t){const{context:m,painter:l,pixelRatio:h}=e,d=t.instance.getInput();if(s(e)||r(e)){const s=i(e);return l.setPipelineState(s),void l.submitDraw(e,t)}e.context.setClearDepth(1),e.context.clear(p.DEPTH);const E={color:!1,depth:{write:{zNear:0,zFar:1},test:c.LESS},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:c.EQUAL,mask:255,op:{fail:f.KEEP,zFail:f.KEEP,zPass:f.KEEP}}}};l.setShader({shader:this.shaders.geometry,uniforms:{...o(e,t.target,d.uniforms),...a(e,t.target),antialiasingControls:u(h),mosaicInfo:l.textureManager.getMosaicInfo(m,t.textureKey),technique:{isColorPass:0}},defines:{...n(e)},optionalAttributes:d.optionalAttributes,useComputeBuffer:s(e)}),l.setPipelineState(E),l.submitDraw(e,t);const g={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:c.LEQUAL},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:c.EQUAL,mask:255,op:{fail:f.KEEP,zFail:f.KEEP,zPass:f.KEEP}}}};l.setShader({shader:this.shaders.geometry,uniforms:{...o(e,t.target,d.uniforms),...a(e,t.target),antialiasingControls:u(h),mosaicInfo:l.textureManager.getMosaicInfo(m,t.textureKey),technique:{isColorPass:1}},defines:{...n(e)},optionalAttributes:d.optionalAttributes,useComputeBuffer:s(e)}),l.setPipelineState(g),l.submitDraw(e,t)}}export{h as GradientStrokeTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- const e={isAlongLine:0,isAbsoluteSize:1,isDiscrete:2},i=.01;export{e as bitset,i as interiorBias};
5
+ const e={isAlongLine:0,isAbsoluteSize:1,isDiscrete:2};export{e as bitset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{location as i,uniform as o,input as s}from"../../GraphShaderModule.js";import{ifElse as r,greaterThan as n,Float as a,dot as l,mix as d,Vec2 as p,clamp as m,texture2D as c,length as u,sign as g,Vec4 as h}from"../../graph/glsl.js";import{bitset as v,interiorBias as y}from"../line/gradientStrokeConstants.js";import{BaseHittestVertexInput as f}from"./AFeatureShader.js";import{LineVertexInput as b,LineFragmentInput as w,LineShader as x,getLineVertexData as L,getLineAntialiasing as S}from"./LineShader.js";import{MosaicInfo as j}from"./MosaicInfo.js";import{getBit as A,getBitBool as D,oneMinus as z}from"./utils.js";class F extends b{}t([i(9,a)],F.prototype,"accumulatedDistance",void 0),t([i(10,a)],F.prototype,"totalLength",void 0),t([i(11,a)],F.prototype,"gradientSize",void 0),t([i(12,p)],F.prototype,"segmentDirection",void 0),t([i(13,h)],F.prototype,"tlbr",void 0);class I extends w{}class G extends x{vertex(t,e){const{totalLength:i,gradientSize:o,segmentDirection:s,tlbr:d}=t,p=L(this,t),m=A(t.bitset,v.isAlongLine),c=i.divide(this.view.displayZoomFactor),u=r(D(t.bitset,v.isAbsoluteSize),(()=>{const t=r(n(m,new a(.5)),c,p.halfWidth);return o.divide(t)}),o),g=t.accumulatedDistance.divide(this.view.displayZoomFactor).add(l(s,p.scaledOffset)).divide(c),h=d.divide(this.mosaicInfo.size.xyxy);return{...p,tlbr:h,relativePositionAlongLine:g,relativeGradientSize:u,isAlongLine:A(t.bitset,v.isAlongLine),isDiscrete:A(t.bitset,v.isDiscrete),...this.maybeRunHittest(t,e,p.halfWidth)}}fragment(t){const{isAlongLine:e,isDiscrete:i,relativePositionAlongLine:o,relativeGradientSize:s,normal:l,tlbr:h}=t,v=S(t,this.antialiasingControls.blur),f=new a(.5).multiply(l.y).add(new a(.5)),b=r(n(e,new a(.5)),o,f),w=r(n(i,new a(.5)),s.subtract(1),new a(0)),x=z(b.add(w).divide(s)),L=d(h.xy,h.zw,new p(m(x,new a(0),new a(1)),.5)),j=c(this.mosaicInfo.texture,L),A=t.opacity.multiply(v),D=this.getFragmentOutput(j.multiply(A),t);return D.glFragDepth=u(l).add(g(l.y).multiply(y)),D}}t([o(j)],G.prototype,"mosaicInfo",void 0),t([e(0,s(F)),e(1,s(f))],G.prototype,"vertex",null);export{I as GradientStrokeFragmentInput,G as GradientStrokeShader,F as GradientStrokeVertexInput};
5
+ import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import has from"../../../../../../../core/has.js";import{location as i,uniform as o,UniformGroup as s,input as r}from"../../GraphShaderModule.js";import{ifElse as n,greaterThan as a,Float as l,dot as d,mix as p,Vec2 as m,clamp as c,texture2D as h,step as u,length as g,Vec4 as y}from"../../graph/glsl.js";import{bitset as v}from"../line/gradientStrokeConstants.js";import{BaseHittestVertexInput as f}from"./AFeatureShader.js";import{LineVertexInput as w,LineFragmentInput as b,LineShader as x,getLineVertexData as j,getLineAntialiasing as L}from"./LineShader.js";import{MosaicInfo as S}from"./MosaicInfo.js";import{getBit as A,getBitBool as D,oneMinus as z}from"./utils.js";class F extends w{}t([i(9,l)],F.prototype,"accumulatedDistance",void 0),t([i(10,l)],F.prototype,"totalLength",void 0),t([i(11,l)],F.prototype,"gradientSize",void 0),t([i(12,m)],F.prototype,"segmentDirection",void 0),t([i(13,y)],F.prototype,"tlbr",void 0);class C extends b{}class I extends s{}t([o(l)],I.prototype,"isColorPass",void 0);class P extends x{vertex(t,e){const{totalLength:i,gradientSize:o,segmentDirection:s,tlbr:r}=t,p=j(this,t),m=A(t.bitset,v.isAlongLine),c=i.divide(this.view.displayZoomFactor),h=n(D(t.bitset,v.isAbsoluteSize),(()=>{const t=n(a(m,new l(.5)),c,p.halfWidth);return o.divide(t)}),o),u=t.accumulatedDistance.divide(this.view.displayZoomFactor).add(d(s,p.scaledOffset)).divide(c),g=r.divide(this.mosaicInfo.size.xyxy);return{...p,tlbr:g,relativePositionAlongLine:u,relativeGradientSize:h,isAlongLine:A(t.bitset,v.isAlongLine),isDiscrete:A(t.bitset,v.isDiscrete),...this.maybeRunHittest(t,e,p.halfWidth)}}fragment(t){const{isAlongLine:e,isDiscrete:i,relativePositionAlongLine:o,relativeGradientSize:s,normal:r,tlbr:d}=t,y=L(t,this.antialiasingControls.blur),v=new l(.5).multiply(r.y).add(new l(.5)),f=n(a(e,new l(.5)),o,v),w=n(a(i,new l(.5)),s.subtract(1),new l(0)),b=z(f.add(w).divide(s)),x=p(d.xy,d.zw,new m(c(b,new l(0),new l(1)),.5)),j=h(this.mosaicInfo.texture,x),S=t.opacity.multiply(y),A=this.getFragmentOutput(j.multiply(S),t),D=u(new l(.5),this.technique.isColorPass).multiply(has("gradient-depth-epsilon")),F=u(new l(0),r.y).multiply(new l(has("gradient-depth-bias")).subtract(D));return A.glFragDepth=c(g(r).add(F),new l(0),new l(1)),A}}t([o(S)],P.prototype,"mosaicInfo",void 0),t([o(I)],P.prototype,"technique",void 0),t([e(0,r(F)),e(1,r(f))],P.prototype,"vertex",null);export{C as GradientStrokeFragmentInput,P as GradientStrokeShader,F as GradientStrokeVertexInput};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{FeatureMatcher as e}from"./Matcher.js";class a extends e{static async fromLabelSchema(e,s){const r=s.classes.map((async a=>{const s=await e.createMeshWriters(a.meshes);return{minScale:a.minScale,maxScale:a.maxScale,meshes:s,expression:null,where:await e.storage.createWhereClause(a.where)}})),t=await Promise.all(r);return new a(t)}constructor(e){super(),this._labels=e}match(e,a,s){if(!this._labels.length)return null;const r=this._getLabels(a.$view.scale),t=[];for(const l of r)l.where&&!l.where(e,s)||t.push(...l.meshes);return t}_getLabels(e){return this._labels.filter((a=>this._validForTileScale(a,e)))}_validForTileScale(e,a){const s=a-a/4,r=a+a/2;return(!e.minScale||e.minScale>=s)&&(!e.maxScale||e.maxScale<=r)}}export{a as LabelMatcher};
5
+ import{FeatureMatcher as e}from"./Matcher.js";class s extends e{static async fromLabelSchema(e,a){const r=a.classes.map((async s=>{const a=await e.createMeshWriters(s.meshes);return{minScale:s.minScale,maxScale:s.maxScale,meshes:a,expression:null,where:await e.storage.createWhereClause(s.where)}})),t=await Promise.all(r);return new s(t)}constructor(e){super(),this._labels=e}match(e,s,a){if(!this._labels.length)return null;const r=this._getLabels(s.$view.scale),t=[];for(const l of r)l.where&&!l.where(e,a)||t.push(...l.meshes);return t}hasArcadeDependency(e){return this._labels.some((s=>s.meshes.some((s=>s.hasArcadeDependency(e)))))}_getLabels(e){return this._labels.filter((s=>this._validForTileScale(s,e)))}_validForTileScale(e,s){const a=s-s/4,r=s+s/2;return(!e.minScale||e.minScale>=a)&&(!e.maxScale||e.maxScale<=r)}}export{s as LabelMatcher};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{internalTrackPartField as t,TrackPart as e}from"../../../../../layers/support/streamLayerUtils.js";import{DictionaryMatcher as r}from"./DictionaryMatcher.js";import{IntervalMatcher as a}from"./IntervalMatcher.js";import{LabelMatcher as s}from"./LabelMatcher.js";import{MapMatcher as c}from"./MapMatcher.js";import{FeatureMatcher as n}from"./Matcher.js";async function i(t,e){switch(e.type){case"simple":case"heatmap":case"dot-density":case"pie-chart":return n.from(t,e);case"interval":return a.fromIntervalSchema(t,e);case"dictionary":return r.fromDictionaryRenderer(t,e);case"label":return s.fromLabelSchema(t,e);case"map":return c.fromMatcherSchema(t,e);case"subtype":return o.fromSubtypes(t,e);case"cluster":return h.fromClusterSchema(t,e);case"track":return u.fromTrackSchema(t,e);default:throw new Error("Impl")}}class o extends n{constructor(t,e){super(),this._subMatchers=t,this._subtypeField=e}static async fromSubtypes(t,e){const r=new Map,a=[];for(const s in e.renderers){const c=parseInt(s,10),n=i(t,e.renderers[s]).then((t=>r.set(c,t)));a.push(n)}return await Promise.all(a),new o(r,e.subtypeField)}match(t,e,r){const a=t.readAttribute(this._subtypeField),s=this._subMatchers.get(a);return s?s.match(t,e,r):null}}class h extends n{static async fromClusterSchema(t,e){const[r,a]=await Promise.all([i(t,e.feature),i(t,e.cluster)]);return new h(r,a)}constructor(t,e){super(),this._featureMatcher=t,this._clusterMatcher=e}match(t,e,r){return 1===t.readAttribute("cluster_count")?this._featureMatcher.match(t,e,r):this._clusterMatcher.match(t,e,r)}}class u extends n{static async fromTrackSchema(t,e){const[r,a,s]=await Promise.all([i(t,e.previousObservation),i(t,e.latestObservation),i(t,e.trackLine)]);return new u(r,a,s)}constructor(t,e,r){super(),this._previousObservationMatcher=t,this._latestObservationMatcher=e,this._trackLineMatcher=r}match(r,a,s){switch(r.readAttribute(t)){case e.TrackLine:return this._trackLineMatcher.match(r,a,s);case e.LatestObservation:return this._latestObservationMatcher.match(r,a,s);case e.PreviousObservation:return this._previousObservationMatcher.match(r,a,s)}return null}}export{h as ClusterMatcher,o as SubtypeMatcher,i as createMatcher};
5
+ import{internalTrackPartField as e,TrackPart as t}from"../../../../../layers/support/streamLayerUtils.js";import{DictionaryMatcher as r}from"./DictionaryMatcher.js";import{IntervalMatcher as a}from"./IntervalMatcher.js";import{LabelMatcher as s}from"./LabelMatcher.js";import{MapMatcher as c}from"./MapMatcher.js";import{FeatureMatcher as n}from"./Matcher.js";async function i(e,t){switch(t.type){case"simple":case"heatmap":case"dot-density":case"pie-chart":return n.from(e,t);case"interval":return a.fromIntervalSchema(e,t);case"dictionary":return r.fromDictionaryRenderer(e,t);case"label":return s.fromLabelSchema(e,t);case"map":return c.fromMatcherSchema(e,t);case"subtype":return h.fromSubtypes(e,t);case"cluster":return o.fromClusterSchema(e,t);case"track":return u.fromTrackSchema(e,t);default:throw new Error("Impl")}}class h extends n{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=i(e,t.renderers[s]).then((e=>r.set(c,e)));a.push(n)}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 o extends n{static async fromClusterSchema(e,t){const[r,a]=await Promise.all([i(e,t.feature),i(e,t.cluster)]);return new o(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 u extends n{static async fromTrackSchema(e,t){const[r,a,s]=await Promise.all([i(e,t.previousObservation),i(e,t.latestObservation),i(e,t.trackLine)]);return new u(r,a,s)}constructor(e,t,r){super(),this._previousObservationMatcher=e,this._latestObservationMatcher=t,this._trackLineMatcher=r}match(r,a,s){switch(r.readAttribute(e)){case t.TrackLine:return this._trackLineMatcher.match(r,a,s);case t.LatestObservation:return this._latestObservationMatcher.match(r,a,s);case t.PreviousObservation:return this._previousObservationMatcher.match(r,a,s)}return null}hasArcadeDependency(e){return this._trackLineMatcher.hasArcadeDependency(e)||this._latestObservationMatcher.hasArcadeDependency(e)||this._previousObservationMatcher.hasArcadeDependency(e)}}export{o as ClusterMatcher,h as SubtypeMatcher,i as createMatcher};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import i from"../../../TrackGraphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as p}from"../../../core/object.js";import{createAbortError as d,createResolver as y,ignoreAbortErrors as g,throwIfNotAbortError as f,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import S from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as j}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as I}from"../../../layers/support/featureLayerUtils.js";import{packFields as x}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as E}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as k}from"../../../layers/support/timeSupport.js";import C from"../../../rest/support/AggregateFeatureSet.js";import V from"../../../rest/support/AttributeBinsFeatureSet.js";import q from"../../../rest/support/AttributeBinsQuery.js";import Q from"../../../rest/support/FeatureSet.js";import R from"../../../rest/support/Query.js";import{LayerView2DMixin as O}from"./LayerView2D.js";import{FeatureContainer as L}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as H}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as T}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as W}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as P}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as D}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as M}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as N}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as J}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as G}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as $}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as B}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as z}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import Z from"./support/FeatureCommandQueue.js";import{handleNoEngineError as K}from"./support/handleNoEngineError.js";import{HighlightCounter as X}from"./support/HighlightCounter.js";import{toJSONGeometryType as Y}from"./support/util.js";import{FeatureTileSubscriptionManager as ee}from"../tiling/FeatureTileSubscriptionManager.js";import te from"../../layers/FeatureLayerView.js";import re from"../../layers/LayerView.js";import ie from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as se}from"../../support/HighlightDefaults.js";function ae(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 oe=4294967294;function ne(e,t){return l(e.map((e=>w((()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t}),t))))}let ue=class extends(te(ie(O(re)))){constructor(){super(...arguments),this._commandsQueue=new Z({process:e=>{switch(e.type){case"override":return this._doOverride(e.message);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new X,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new T,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new S}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(d()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),g(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 n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===E(e)?.operations.supportsQuery)throw new n("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 H(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(d()),f(r)}}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 labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new D(this.layer):new P(this.layer);case"geojson":case"csv":case"wfs":return new D(this.layer);case"parquet":return new G(this.layer);case"subtype-group":return new B(this.layer);case"ogc-feature":return new N(this.layer);case"stream":return new $(this.layer);case"oriented-imagery":return new J(this.layer);case"knowledge-graph-sublayer":return new M(this.layer);case"catalog-footprint":return new W(this.layer);default:o(this.layer)}return null}get timeExtent(){return k(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t){let i;e instanceof r?i=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?i=[e]:a.isCollection(e)&&e.length>0?i=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(i="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=i?.filter(s);if(!o?.length)return u();const n=t?.name??se;return this._addHighlights(o,n),u((()=>this._removeHighlights(o,n)))}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,s){const a=await this.featureContainer.hitTest(s);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...l.map((t=>this._createGraphicHit(e,i.fromJSON(t)))),...n.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return K(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return K(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return K(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return K(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return K(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return K(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return K(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return K(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return K(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=Q.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await K(r,{features:[]}),s=Q.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await K(r,{features:[]}),s=C.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return K(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return K(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return K(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return K(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return K(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return K(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await K(r,{count:0,extent:null});return{count:i.count,extent:F.fromJSON(i.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),i=await K(r,{features:[]});return V.fromJSON(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._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),g(this._updatingHandles.addPromise(this._workerAttached.promise)),g(this._attachProxy()),this.featureContainer=new L(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new ee({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),g(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([ne([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilter?.where||null,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],(()=>this._update())),w((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),w((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),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._subscriptionManager=c(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),g(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const i of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(i));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 i={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 s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await z(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=R.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=q.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=R.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this.layer,r=e.historicMoment?.getTime()??null,i="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(i&&this._canEditByFeature(i)){const{adds:e,deletes:t,updates:s}=i.editedFeatures,a=this.layer.objectIdField,o=s.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.addOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0})}const[s,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]),n=[...s,...a];return this._commandsQueue.push({type:"override-by-id",updates:n,removed:o,historicMoment:r,isWeak:!0}).catch(f)}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%oe+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%oe+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.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 i="globalIdField"in this.layer&&this.layer.globalIdField,s=i&&this.availableFields.includes(i);if(r.length&&!s)return h.getLogger(this).error(new n("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${i} 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}async addOverrides(e){const t=!1,r=!1,i=Y(this.layer.geometryType),s=this.layer.objectIdField,a=[];for(const o of e.added){const e=j(o,i,t,r,s);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=j(o,i,t,r,s);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});return this._commandsQueue.push({type:"override",updates:a,removed:e.removed,release:[],isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null})}async removeOverrides(e){for(const t of e)if(null==t)throw new n("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:t});return this._commandsQueue.push({type:"override",updates:[],removed:[],release:e,isWeak:!1,historicMoment:null})}_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 _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),I(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=await this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=p(this._lastSchema?.source.mutable,s.source.mutable)||p(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onOverride(e),this.featureContainer.editEnd()}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=ae(this._lastAvailableFields,e);return this._lastAvailableFields=t,x(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[le(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilter?.where),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}}_addHighlights(e,t){this._highlightCounter.addGroup(e,t)&&this._commandsQueue.push({type:"highlight"})}_removeHighlights(e,t){this._highlightCounter.deleteGroup(e,t)&&this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=[];for(const i of this._highlightCounter.ids()){const t=this._highlightCounter.getHighlightNames(i),r=this._getHighlightBits(t);e.push({objectId:i,highlightFlags:r})}const t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{m(e)||h.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function le(e,t,r,i,s,a){s&&(s=s.clone());const o=null!=s?s.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(s??=new U,s.timeExtent=n),s=t.addFilters?.(s,e)??s,a&&(s??=new U,s.where=_(s.where,a));let u=s?.toJSON()??null;return i.size&&(u??=(new U).toJSON(),u.hiddenIds=Array.from(i)),u}e([v()],ue.prototype,"_commandsQueue",void 0),e([v()],ue.prototype,"_sourceRefreshVersion",void 0),e([v()],ue.prototype,"_displayRefreshVersion",void 0),e([v({readOnly:!0})],ue.prototype,"_pipelineUpdating",void 0),e([v()],ue.prototype,"_sourceUpdating",void 0),e([v({readOnly:!0})],ue.prototype,"dataUpdating",null),e([v({readOnly:!0})],ue.prototype,"hasAllFeatures",null),e([v({readOnly:!0})],ue.prototype,"hasAllFeaturesInView",null),e([v({readOnly:!0})],ue.prototype,"hasFullGeometries",null),e([v()],ue.prototype,"featureEffectView",void 0),e([v()],ue.prototype,"labelingCollisionInfos",null),e([v()],ue.prototype,"layerAdapter",null),e([v({readOnly:!0})],ue.prototype,"timeExtent",null),e([v()],ue.prototype,"updating",void 0),ue=e([b("esri.views.2d.layers.FeatureLayerView2D")],ue);const he=ue;export{he as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import i from"../../../TrackGraphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as p}from"../../../core/object.js";import{createAbortError as d,createResolver as y,ignoreAbortErrors as f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import S from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as j}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as x}from"../../../layers/support/featureLayerUtils.js";import{packFields as I}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as E}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as k}from"../../../layers/support/timeSupport.js";import V from"../../../rest/support/AggregateFeatureSet.js";import q from"../../../rest/support/AttributeBinsFeatureSet.js";import R from"../../../rest/support/AttributeBinsQuery.js";import C from"../../../rest/support/FeatureSet.js";import Q from"../../../rest/support/Query.js";import{LayerView2DMixin as O}from"./LayerView2D.js";import{FeatureContainer as L}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as T}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as W}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as P}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as D}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as H}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as M}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as N}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as J}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as G}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as $}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as B}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as z}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import Z from"./support/FeatureCommandQueue.js";import{handleNoEngineError as K}from"./support/handleNoEngineError.js";import{toJSONGeometryType as X}from"./support/util.js";import{FeatureTileSubscriptionManager as Y}from"../tiling/FeatureTileSubscriptionManager.js";import ee from"../../layers/FeatureLayerView.js";import te from"../../layers/LayerView.js";import re from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as ie}from"../../support/HighlightDefaults.js";function se(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 ae=4294967294;function oe(e,t){return l(e.map((e=>w((()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t}),t))))}let ne=class extends(ee(re(O(te)))){constructor(){super(...arguments),this._commandsQueue=new Z({process:e=>{switch(e.type){case"override":return this._doOverride(e.message);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new W,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new S}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(d()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),f(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 n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===E(e)?.operations.supportsQuery)throw new n("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 T(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(d()),g(r)}}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 labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new H(this.layer):new D(this.layer);case"geojson":case"csv":case"wfs":return new H(this.layer);case"parquet":return new G(this.layer);case"subtype-group":return new B(this.layer);case"ogc-feature":return new N(this.layer);case"stream":return new $(this.layer);case"oriented-imagery":return new J(this.layer);case"knowledge-graph-sublayer":return new M(this.layer);case"catalog-footprint":return new P(this.layer);default:o(this.layer)}return null}get timeExtent(){return k(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t){let i;e instanceof r?i=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?i=[e]:a.isCollection(e)&&e.length>0?i=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(i="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=i?.filter(s);if(!o?.length)return u();const n=t?.name??ie;return this._addHighlights(o,n),u((()=>!this.destroyed&&this._removeHighlights(o,n)))}async hitTest(e,s){const a=await this.featureContainer.hitTest(s);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...l.map((t=>this._createGraphicHit(e,i.fromJSON(t)))),...n.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return K(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return K(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return K(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return K(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return K(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return K(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return K(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return K(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return K(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=C.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await K(r,{features:[]}),s=C.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await K(r,{features:[]}),s=V.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return K(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return K(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return K(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return K(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return K(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return K(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await K(r,{count:0,extent:null});return{count:i.count,extent:F.fromJSON(i.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),i=await K(r,{features:[]});return q.fromJSON(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._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),f(this._updatingHandles.addPromise(this._workerAttached.promise)),f(this._attachProxy()),this.featureContainer=new L(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new Y({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),f(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([oe([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilter?.where||null,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],(()=>this._update())),w((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),w((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),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._subscriptionManager=c(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),f(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const i of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(i));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 i={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 s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await z(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=Q.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=R.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=Q.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this.layer,r=e.historicMoment?.getTime()??null,i="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(i&&this._canEditByFeature(i)){const{adds:e,deletes:t,updates:s}=i.editedFeatures,a=this.layer.objectIdField,o=s.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.addOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0})}const[s,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]),n=[...s,...a];return this._commandsQueue.push({type:"override-by-id",updates:n,removed:o,historicMoment:r,isWeak:!0}).catch(g)}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ae+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ae+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.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 i="globalIdField"in this.layer&&this.layer.globalIdField,s=i&&this.availableFields.includes(i);if(r.length&&!s)return h.getLogger(this).error(new n("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${i} 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}async addOverrides(e){const t=!1,r=!1,i=X(this.layer.geometryType),s=this.layer.objectIdField,a=[];for(const o of e.added){const e=j(o,i,t,r,s);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=j(o,i,t,r,s);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});return this._commandsQueue.push({type:"override",updates:a,removed:e.removed,release:[],isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null})}async removeOverrides(e){for(const t of e)if(null==t)throw new n("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:t});return this._commandsQueue.push({type:"override",updates:[],removed:[],release:e,isWeak:!1,historicMoment:null})}_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 _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),x(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=await this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=p(this._lastSchema?.source.mutable,s.source.mutable)||p(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onOverride(e),this.featureContainer.editEnd()}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=se(this._lastAvailableFields,e);return this._lastAvailableFields=t,I(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[ue(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilter?.where),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}}_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)||h.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function ue(e,t,r,i,s,a){s&&(s=s.clone());const o=null!=s?s.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(s??=new U,s.timeExtent=n),s=t.addFilters?.(s,e)??s,a&&(s??=new U,s.where=_(s.where,a));let u=s?.toJSON()??null;return i.size&&(u??=(new U).toJSON(),u.hiddenIds=Array.from(i)),u}e([v()],ne.prototype,"_commandsQueue",void 0),e([v()],ne.prototype,"_sourceRefreshVersion",void 0),e([v()],ne.prototype,"_displayRefreshVersion",void 0),e([v({readOnly:!0})],ne.prototype,"_pipelineUpdating",void 0),e([v()],ne.prototype,"_sourceUpdating",void 0),e([v({readOnly:!0})],ne.prototype,"dataUpdating",null),e([v({readOnly:!0})],ne.prototype,"hasAllFeatures",null),e([v({readOnly:!0})],ne.prototype,"hasAllFeaturesInView",null),e([v({readOnly:!0})],ne.prototype,"hasFullGeometries",null),e([v()],ne.prototype,"featureEffectView",void 0),e([v()],ne.prototype,"labelingCollisionInfos",null),e([v()],ne.prototype,"layerAdapter",null),e([v({readOnly:!0})],ne.prototype,"timeExtent",null),e([v()],ne.prototype,"updating",void 0),ne=e([b("esri.views.2d.layers.FeatureLayerView2D")],ne);const le=ne;export{le as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{isSome as e}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{when as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView2DMixin as g}from"./LayerView2D.js";import c from"./graphics/GraphicContainer.js";import l from"./graphics/GraphicsView2D.js";import{HighlightCounter as n}from"./support/HighlightCounter.js";import m from"../../layers/LayerView.js";import{defaultHighlightName as d}from"../../support/HighlightDefaults.js";let u=class extends(g(m)){constructor(){super(...arguments),this._highlightCounter=new n}attach(){this.graphicsView=new l({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this.layer.graphics,container:new c(this.view.featuresTilingScheme),layerId:this.layer.id}),this.container.addChild(this.graphicsView.container),this.addAttachHandles([this.layer.on("graphic-update",this.graphicsView.graphicUpdateHandler),a((()=>this.layer?.visible),(()=>{this.graphicsView.update({state:this.view.state}),this.graphicsView.pushUpdate()}))]),this._updateHighlights()}detach(){this.container.removeAllChildren(),this.graphicsView=h(this.graphicsView)}async hitTest(i){return this.graphicsView?this.graphicsView.hitTest(i).map((t=>({type:"graphic",graphic:t,mapPoint:i,layer:this.layer}))):null}queryGraphics(){return Promise.resolve(this.graphicsView.graphics)}update(i){this.graphicsView.processUpdate(i)}viewChange(){this.graphicsView.viewChange()}moveEnd(){}isUpdating(){return!this.graphicsView||this.graphicsView.updating}highlight(i,h){let a;"number"==typeof i?a=[i]:i instanceof t?a=[i.uid]:Array.isArray(i)&&i.length>0?a="number"==typeof i[0]?i:i.map((i=>i&&i.uid)):r.isCollection(i)&&i.length>0&&(a=i.map((i=>i&&i.uid)).toArray());const o=a?.filter(e);if(!o?.length)return s();const p=h?.name??d;return this._addHighlight(o,p),s((()=>this._removeHighlight(o,p)))}_addHighlight(i,t){this._highlightCounter.addGroup(i,t)&&this._updateHighlights()}_removeHighlight(i,t){this._highlightCounter.deleteGroup(i,t)&&this._updateHighlights()}_updateHighlights(){const i=[];for(const t of this._highlightCounter.ids()){const e=this._highlightCounter.getHighlightNames(t),r=this._getHighlightBits(e);i.push({objectId:t,highlightFlags:r})}this.graphicsView?.setHighlight(i)}};i([o()],u.prototype,"graphicsView",void 0),u=i([p("esri.views.2d.layers.GraphicsLayerView2D")],u);const w=u;export{w as default};
5
+ import{_ as i}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import{isSome as e}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{when as h}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView2DMixin as c}from"./LayerView2D.js";import g from"./graphics/GraphicContainer.js";import l from"./graphics/GraphicsView2D.js";import n from"../../layers/LayerView.js";import{defaultHighlightName as m}from"../../support/HighlightDefaults.js";let d=class extends(c(n)){attach(){this.graphicsView=new l({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this.layer.graphics,container:new g(this.view.featuresTilingScheme),layerId:this.layer.id}),this.container.addChild(this.graphicsView.container),this.addAttachHandles([this.layer.on("graphic-update",this.graphicsView.graphicUpdateHandler),h((()=>this.layer?.visible),(()=>{this.graphicsView.update({state:this.view.state}),this.graphicsView.pushUpdate()}))]),this._processHighlight()}detach(){this.container.removeAllChildren(),this.graphicsView=a(this.graphicsView)}async hitTest(i){return this.graphicsView?this.graphicsView.hitTest(i).map((r=>({type:"graphic",graphic:r,mapPoint:i,layer:this.layer}))):null}queryGraphics(){return Promise.resolve(this.graphicsView.graphics)}update(i){this.graphicsView.processUpdate(i)}viewChange(){this.graphicsView.viewChange()}moveEnd(){}isUpdating(){return!this.graphicsView||this.graphicsView.updating}highlight(i,a){let h;"number"==typeof i?h=[i]:i instanceof r?h=[i.uid]:Array.isArray(i)&&i.length>0?h="number"==typeof i[0]?i:i.map((i=>i&&i.uid)):s.isCollection(i)&&i.length>0&&(h=i.map((i=>i&&i.uid)).toArray());const o=h?.filter(e);if(!o?.length)return t();const p=a?.name??m;return this._addHighlights(o,p),t((()=>!this.destroyed&&this._removeHighlights(o,p)))}_processHighlight(){const i=this._getHighlights();this.graphicsView?.setHighlight(i)}};i([o()],d.prototype,"graphicsView",void 0),d=i([p("esri.views.2d.layers.GraphicsLayerView2D")],d);const w=d;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../Graphic.js";import t from"../../../core/Collection.js";import{makeHandle as r}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{watch as s,sync as a}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{GraphicsCollection as n}from"../../../support/GraphicsCollection.js";import l from"../engine/flow/FlowView2D.js";import{LayerView2DMixin as c}from"./LayerView2D.js";import w from"./graphics/GraphicsView2D.js";import p from"./graphics/HighlightGraphicContainer.js";import d from"./imagery/ImageryView2D.js";import m from"./imagery/VectorFieldView2D.js";import u from"../../layers/ImageryLayerView.js";import g from"../../layers/LayerView.js";import y from"../../layers/RefreshableLayerView.js";let v=class extends(u(y(c(g)))){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new n,this._highlightView=void 0,this.layer=null,this.subview=null}get pixelData(){const{subview:e}=this;return this.updating||!e?null:"getPixelData"in e?e.getPixelData():null}update(e){this.subview?.update(e)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new w({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new p(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([s((()=>this.layer.exportImageServiceParameters.version),(e=>{e&&this._exportImageVersion!==e&&(this._exportImageVersion=e,this.requestUpdate())}),a),s((()=>this.timeExtent),(e=>{const{subview:i}=this;i&&(i.timeExtent=e,"redraw"in i?this.requestUpdate():i.redrawOrRefetch())}),a),this.layer.on("redraw",(()=>{const{subview:e}=this;e&&("redraw"in e?e.redraw():e.redrawOrRefetch())})),s((()=>this.layer.renderer),(()=>this._setSubView()))])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}highlight(e,s){if(!((Array.isArray(e)?e[0]:t.isCollection(e)?e.at(0):e)instanceof i))return r();let a=[];return Array.isArray(e)||t.isCollection(e)?a=e.map((e=>e.clone())):e instanceof i&&(a=[e.clone()]),this._highlightGraphics.addMany(a),r((()=>this._highlightGraphics.removeMany(a)))}async doRefresh(){this.requestUpdate()}isUpdating(){const e=!this.subview||this.subview.updating||!!this._highlightView?.updating;return has("esri-2d-log-updating")&&console.log(`Updating ImageryLayerView2D (${this.layer.id}): ${e}\n-> subview ${!this.subview||this.subview.updating}\n-> higlightView ${this._highlightView?.updating}\n`),e}_setSubView(){if(!this.view)return;const e=this.layer.renderer?.type;let i="imagery";if("vector-field"===e?i="imageryVF":"flow"===e&&(i="flow"),this.subview){const{type:e}=this.subview;if(e===i)return this._attachSubview(this.subview),void("flow"===e?this.subview.redrawOrRefetch():"imagery"===e&&"lerc"===this.layer.format?this.subview.redraw():this.requestUpdate());this._detachSubview(this.subview),this.subview?.destroy()}this.subview="imagery"===i?new d({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):"imageryVF"===i?new m({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new l({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}};e([h()],v.prototype,"pixelData",null),e([h()],v.prototype,"subview",void 0),v=e([o("esri.views.2d.layers.ImageryLayerView2D")],v);const b=v;export{b as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../Graphic.js";import{isSome as t}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{makeHandle as r}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{watch as h,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{GraphicsCollection as n}from"../../../support/GraphicsCollection.js";import c from"../engine/flow/FlowView2D.js";import{LayerView2DMixin as g}from"./LayerView2D.js";import p from"./graphics/GraphicsView2D.js";import d from"./graphics/HighlightGraphicContainer.js";import w from"./imagery/ImageryView2D.js";import m from"./imagery/VectorFieldView2D.js";import u from"../../layers/ImageryLayerView.js";import v from"../../layers/LayerView.js";import y from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as f}from"../../support/HighlightDefaults.js";let b=class extends(u(y(g(v)))){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new n,this._highlightView=void 0,this.layer=null,this.subview=null}get pixelData(){const{subview:e}=this;return this.updating||!e?null:"getPixelData"in e?e.getPixelData():null}update(e){this.subview?.update(e)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new p({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new d(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([h((()=>this.layer.exportImageServiceParameters.version),(e=>{e&&this._exportImageVersion!==e&&(this._exportImageVersion=e,this.requestUpdate())}),a),h((()=>this.timeExtent),(e=>{const{subview:i}=this;i&&(i.timeExtent=e,"redraw"in i?this.requestUpdate():i.redrawOrRefetch())}),a),this.layer.on("redraw",(()=>{const{subview:e}=this;e&&("redraw"in e?e.redraw():e.redrawOrRefetch())})),h((()=>this.layer.renderer),(()=>this._setSubView()))])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}highlight(e,h){if(!((Array.isArray(e)?e[0]:s.isCollection(e)?e.at(0):e)instanceof i))return r();let a=[];Array.isArray(e)||s.isCollection(e)?a=e.map((e=>e.clone())):e instanceof i&&(a=[e.clone()]);const o=a?.filter(t);if(!o?.length)return r();const l=h?.name??f;return this._addHighlightGraphics(a,l),r((()=>!this.destroyed&&this._removeHighlightGraphics(a,l)))}_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)}async doRefresh(){this.requestUpdate()}isUpdating(){const e=!this.subview||this.subview.updating||!!this._highlightView?.updating;return has("esri-2d-log-updating")&&console.log(`Updating ImageryLayerView2D (${this.layer.id}): ${e}\n-> subview ${!this.subview||this.subview.updating}\n-> higlightView ${this._highlightView?.updating}\n`),e}_processHighlight(){const e=this._getHighlights();this._highlightView?.setHighlight(e)}_setSubView(){if(!this.view)return;const e=this.layer.renderer?.type;let i="imagery";if("vector-field"===e?i="imageryVF":"flow"===e&&(i="flow"),this.subview){const{type:e}=this.subview;if(e===i)return this._attachSubview(this.subview),void("flow"===e?this.subview.redrawOrRefetch():"imagery"===e&&"lerc"===this.layer.format?this.subview.redraw():this.requestUpdate());this._detachSubview(this.subview),this.subview?.destroy()}this.subview="imagery"===i?new w({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):"imageryVF"===i?new m({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new c({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}};e([o()],b.prototype,"pixelData",null),e([o()],b.prototype,"subview",void 0),b=e([l("esri.views.2d.layers.ImageryLayerView2D")],b);const _=b;export{_ as default};