@arcgis/core 4.32.0-next.20250211 → 4.32.0-next.20250213

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 (251) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/04f9fb33fb2e33712290.js +1 -0
  3. package/assets/esri/core/workers/chunks/0b8bf1966653c326e95a.js +1 -0
  4. package/assets/esri/core/workers/chunks/{a4a9b4f792d47566fbf4.js → 17213c3fc63f580e5b73.js} +1 -1
  5. package/assets/esri/core/workers/chunks/1a6b6d43eda7986d2349.js +1 -0
  6. package/assets/esri/core/workers/chunks/{12d6baeffd55a98a7c75.js → 1bf646c9fc352f98d1ca.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1c357cdb067e28aff3f0.js +1 -0
  8. package/assets/esri/core/workers/chunks/{9a237b396518b1c67f19.js → 24964548c6a3e2eb527d.js} +1 -1
  9. package/assets/esri/core/workers/chunks/272662e4e28341419b4f.js +1 -0
  10. package/assets/esri/core/workers/chunks/31f0dd191602b93c02c2.js +1 -0
  11. package/assets/esri/core/workers/chunks/{74844334b3a2100220fc.js → 37cfd102b6ab5b959f9d.js} +1 -1
  12. package/assets/esri/core/workers/chunks/3835c2884c55e73dc202.js +1 -0
  13. package/assets/esri/core/workers/chunks/{f429d95eb986f3d215f3.js → 391c200274bbeb92404c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{8ddd4e2e50b8206564a7.js → 3ebdd0701e77bb28c75d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{c0af54cc5938176ce764.js → 3fe7be535affae31de7e.js} +1 -1
  16. package/assets/esri/core/workers/chunks/401b731c0601f4d84ead.js +1 -0
  17. package/assets/esri/core/workers/chunks/4565cfc85f60960e3ea1.js +1 -0
  18. package/assets/esri/core/workers/chunks/4848a3e31632d15dc4ce.js +1 -0
  19. package/assets/esri/core/workers/chunks/4a4739cda8aac510004b.js +1 -0
  20. package/assets/esri/core/workers/chunks/{d0656e9d30eb3a66a8db.js → 4be39bc2d2edd94bdb75.js} +1 -1
  21. package/assets/esri/core/workers/chunks/5328b2de0d1ac2536ecf.js +1 -0
  22. package/assets/esri/core/workers/chunks/{62a1d60ad4bf6469c4dd.js → 584216b52413cf85fecc.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{76794184ba8c2e66745e.js → 629f4621ba6ffdcaa2f9.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{8191dd3d7451b2e7b95e.js → 637e996209e0d241fbf7.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{77bfd4f819096cb754ae.js → 6e92569a4a82592b95dc.js} +1 -1
  26. package/assets/esri/core/workers/chunks/6f007703662e714b2f0a.js +1 -0
  27. package/assets/esri/core/workers/chunks/{50ae86c23efe709f41cc.js → 6fa1f1e431aae1794ce3.js} +1 -1
  28. package/assets/esri/core/workers/chunks/744bdf2bb0cc38e6a7b1.js +1 -0
  29. package/assets/esri/core/workers/chunks/802a390c67f4cdf3d8d9.js +1 -0
  30. package/assets/esri/core/workers/chunks/82facb23dfaba2819bc7.js +1 -0
  31. package/assets/esri/core/workers/chunks/{c26ffbff1115e76bcb0f.js → 86f3a004addc087ad6c6.js} +1 -1
  32. package/assets/esri/core/workers/chunks/8722d05ae9b0aa5162a4.js +1 -0
  33. package/assets/esri/core/workers/chunks/8de4280080296adb1757.js +1 -0
  34. package/assets/esri/core/workers/chunks/9306bfe7ab58e71b75ea.js +1 -0
  35. package/assets/esri/core/workers/chunks/95047f145ebda65c3d8e.js +1 -0
  36. package/assets/esri/core/workers/chunks/{1f443b99653708470f31.js → 96d7f47ea8fbf345101c.js} +1 -1
  37. package/assets/esri/core/workers/chunks/a01213d446be33d203e3.js +1 -0
  38. package/assets/esri/core/workers/chunks/a490a988896b0b02f96b.js +1 -0
  39. package/assets/esri/core/workers/chunks/a60db83cabdf689b923b.js +1 -0
  40. package/assets/esri/core/workers/chunks/{df3d1a8d3f11d52eb30d.js → afdbdc1569b56489c14d.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{89e3f7880abd014a62c0.js → b42d26123784997c66e8.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{b9d9a1dc3c5d799e2685.js → bd3487b587851b20ff2a.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{94490937dca566fe2640.js → bd5e0a11d2a688a65d23.js} +1 -1
  44. package/assets/esri/core/workers/chunks/c3806be4a760735e6082.js +1 -0
  45. package/assets/esri/core/workers/chunks/c9aed9a43d9935e7c768.js +314 -0
  46. package/assets/esri/core/workers/chunks/{8d8f5f08d730270e1165.js → cb9a27176bd5de2c34ca.js} +1 -1
  47. package/assets/esri/core/workers/chunks/ceb648604a4b6d316f4b.js +1 -0
  48. package/assets/esri/core/workers/chunks/d31e25a63f967fedb149.js +1 -0
  49. package/assets/esri/core/workers/chunks/{da1157e288dbc6ba842a.js → d3d0c7624eb139994213.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{f198f4ba7d3d52882d98.js → de8044dfab4ad253b126.js} +1 -1
  51. package/assets/esri/core/workers/chunks/ecd66dbc4ff446c64984.js +1 -0
  52. package/assets/esri/core/workers/chunks/f78b63620386b2676f1f.js +1 -0
  53. package/assets/esri/core/workers/chunks/{1cbeac3301b6943bb28a.js → fc07d47d44c04f123650.js} +1 -1
  54. package/assets/esri/core/workers/chunks/fca056536e46aeb98e98.js +1 -0
  55. package/assets/esri/themes/base/_core.scss +4 -0
  56. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +0 -5
  57. package/assets/esri/themes/base/widgets/_Directions.scss +30 -9
  58. package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
  59. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +80 -0
  60. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationList.scss +14 -0
  61. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +41 -0
  62. package/assets/esri/themes/base/widgets/_FilterBuilder.scss +1 -6
  63. package/assets/esri/themes/dark/main.css +1 -1
  64. package/assets/esri/themes/light/main.css +1 -1
  65. package/assets/esri/themes/light/view.css +1 -1
  66. package/chunks/Bufferer-B-V7yYm-.js +5 -0
  67. package/chunks/ComponentShader.glsl.js +6 -6
  68. package/chunks/Distance2DCalculator-Coa0qAFt.js +5 -0
  69. package/chunks/Envelope.js +1 -1
  70. package/chunks/{GeodeticDistanceCalculator-BsWHOuqE.js → GeodeticDistanceCalculator-D4iQ-_NX.js} +1 -1
  71. package/chunks/Geometry.js +1 -1
  72. package/chunks/OperatorClip.js +1 -1
  73. package/chunks/OperatorCut.js +1 -1
  74. package/chunks/OperatorGeneralize.js +1 -1
  75. package/chunks/OperatorGeodesicBuffer.js +1 -1
  76. package/chunks/OperatorGeodeticArea.js +1 -1
  77. package/chunks/OperatorGeodeticDistance.js +1 -1
  78. package/chunks/OperatorProximityGeodesic.js +1 -1
  79. package/chunks/OperatorShapePreservingLength.js +1 -1
  80. package/chunks/OperatorShapePreservingProject.js +1 -1
  81. package/chunks/Point2D.js +1 -1
  82. package/chunks/ProjectionTransformation.js +1 -1
  83. package/chunks/QuadraticBezier.js +1 -1
  84. package/chunks/ShadowHighlight.glsl.js +2 -4
  85. package/chunks/distanceOperator.js +1 -1
  86. package/core/deprecate.js +1 -1
  87. package/editing/templateUtils.js +1 -1
  88. package/geometry/operators/extendOperator.js +1 -1
  89. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  90. package/geometry/operators/gx/operatorBuffer.js +1 -1
  91. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  92. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  93. package/geometry/operators/gx/operatorOffset.js +1 -1
  94. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  95. package/geometry/operators/isNearOperator.js +1 -1
  96. package/geometry/operators/projectOperator.js +1 -1
  97. package/geometry/operators/shapePreservingProjectOperator.js +1 -1
  98. package/geometry/operators/support/jsonConverter.js +1 -1
  99. package/interfaces.d.ts +616 -122
  100. package/layers/FeatureLayer.js +1 -1
  101. package/layers/GeoJSONLayer.js +1 -1
  102. package/layers/OGCFeatureLayer.js +1 -1
  103. package/layers/RouteLayer.js +1 -1
  104. package/layers/SubtypeGroupLayer.js +1 -1
  105. package/layers/WFSLayer.js +1 -1
  106. package/layers/graphics/data/queryUtils.js +1 -1
  107. package/layers/mixins/TrackableLayer.d.ts +4 -0
  108. package/layers/support/SubtypeSublayer.js +1 -1
  109. package/layers/support/TitleCreator.js +5 -0
  110. package/layers/support/TrackInfo.d.ts +4 -0
  111. package/layers/support/TrackPartInfo.d.ts +4 -0
  112. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  113. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  114. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  115. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  116. package/networks/Network.js +1 -1
  117. package/networks/RulesTable.js +1 -1
  118. package/networks/UtilityNetwork.js +1 -1
  119. package/networks/support/networkFieldUtils.js +5 -0
  120. package/networks/support/typeUtils.js +1 -1
  121. package/package.json +1 -1
  122. package/rest/query/executeForIds.js +1 -1
  123. package/rest/support/BinParametersBase.js +1 -1
  124. package/support/revision.js +1 -1
  125. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  126. package/symbols/cim/rasterizingUtils.js +1 -1
  127. package/symbols/support/previewCIMSymbol.js +1 -1
  128. package/symbols/support/previewSymbol2D.js +1 -1
  129. package/symbols/support/symbolUtils.js +1 -1
  130. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  131. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  132. package/views/2d/layers/RouteLayerView2D.js +1 -1
  133. package/views/2d/layers/features/FeatureContainer.js +1 -1
  134. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  135. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  136. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  137. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  138. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  139. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  140. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  141. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  142. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  143. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  144. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  145. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  146. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  147. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  148. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  149. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  150. package/views/SceneView.js +1 -1
  151. package/views/View.js +1 -1
  152. package/views/layers/FeatureLayerView.js +1 -1
  153. package/views/support/RequiredFieldsOptions.js +5 -0
  154. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  155. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
  156. package/widgets/AreaMeasurement2D.js +1 -1
  157. package/widgets/BasemapGallery.js +1 -1
  158. package/widgets/BasemapToggle.js +1 -1
  159. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  160. package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
  161. package/widgets/BatchAttributeForm/inputs/EditableInput.js +1 -1
  162. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  163. package/widgets/BatchAttributeForm/inputs/GroupInput.js +1 -1
  164. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  165. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  166. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  167. package/widgets/BatchAttributeForm.js +1 -1
  168. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  169. package/widgets/Compass/CompassViewModel.js +1 -1
  170. package/widgets/DirectionalPad.js +1 -1
  171. package/widgets/Directions/DirectionsViewModel.js +1 -1
  172. package/widgets/Directions.js +1 -1
  173. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  174. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  175. package/widgets/DistanceMeasurement2D.js +1 -1
  176. package/widgets/Editor/AddAssociationWorkflow.js +5 -0
  177. package/widgets/Editor/AddAssociationWorkflowData.js +5 -0
  178. package/widgets/Editor/EditorViewModel.js +1 -1
  179. package/widgets/Editor/UpdateWorkflow.js +1 -1
  180. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  181. package/widgets/Editor.js +1 -1
  182. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  183. package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
  184. package/widgets/Feature/FeatureViewModel.js +1 -1
  185. package/widgets/Feature/support/featureUtils.js +1 -1
  186. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  187. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +5 -0
  188. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +5 -0
  189. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  190. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +5 -0
  191. package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
  192. package/widgets/FeatureForm.js +1 -1
  193. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  194. package/widgets/Fullscreen.js +1 -1
  195. package/widgets/Home.js +1 -1
  196. package/widgets/Legend/LegendViewModel.js +1 -1
  197. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  198. package/widgets/Legend.js +1 -1
  199. package/widgets/Locate.js +1 -1
  200. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  201. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  202. package/widgets/OrientedImageryViewer/symbols.js +1 -1
  203. package/widgets/ScaleBar.js +1 -1
  204. package/widgets/Swipe.js +1 -1
  205. package/widgets/Track.js +1 -1
  206. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.d.ts +2 -2
  207. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  208. package/widgets/UtilityNetworkTrace.js +1 -1
  209. package/widgets/support/FilterBuilder/FilterBuilderViewModel.js +1 -1
  210. package/widgets/support/FilterBuilder.js +1 -1
  211. package/widgets/support/FilterCondition/FilterConditionViewModel.js +1 -1
  212. package/widgets/support/FilterCondition.js +1 -1
  213. package/widgets/support/GoTo.js +1 -1
  214. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +5 -0
  215. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
  216. package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
  217. package/widgets/support/goToUtils.js +5 -0
  218. package/assets/esri/core/workers/chunks/01c3507d78398baaf61b.js +0 -1
  219. package/assets/esri/core/workers/chunks/0ac1399d252f2df670b6.js +0 -1
  220. package/assets/esri/core/workers/chunks/177d4c2c10ef7369006f.js +0 -1
  221. package/assets/esri/core/workers/chunks/26a2bd432e7a1b3870c3.js +0 -1
  222. package/assets/esri/core/workers/chunks/3d5442055e01493efcb2.js +0 -1
  223. package/assets/esri/core/workers/chunks/44abd2cd17aae3299ede.js +0 -1
  224. package/assets/esri/core/workers/chunks/594d923400fd74881833.js +0 -1
  225. package/assets/esri/core/workers/chunks/61795bde00f2e16d04f1.js +0 -1
  226. package/assets/esri/core/workers/chunks/7058001bf66f9f3d5d45.js +0 -1
  227. package/assets/esri/core/workers/chunks/746c964cf07e4306f21f.js +0 -1
  228. package/assets/esri/core/workers/chunks/74f42e46bf551aab14dc.js +0 -1
  229. package/assets/esri/core/workers/chunks/7bf08823f861628144a1.js +0 -1
  230. package/assets/esri/core/workers/chunks/8c32cee395da0a7b9a8e.js +0 -1
  231. package/assets/esri/core/workers/chunks/91384398f01485631f70.js +0 -1
  232. package/assets/esri/core/workers/chunks/946a9890f3621d1dfbc5.js +0 -1
  233. package/assets/esri/core/workers/chunks/9fb45c006d790273e8c1.js +0 -1
  234. package/assets/esri/core/workers/chunks/a2409d4921c02614169a.js +0 -1
  235. package/assets/esri/core/workers/chunks/a6be1105a5e1f9597c5e.js +0 -1
  236. package/assets/esri/core/workers/chunks/af917f69d9c6e9937263.js +0 -1
  237. package/assets/esri/core/workers/chunks/cc75bbfd779f409943a3.js +0 -1
  238. package/assets/esri/core/workers/chunks/d0e9874eb304010305c6.js +0 -1
  239. package/assets/esri/core/workers/chunks/d27a199fd8e2ade69254.js +0 -1
  240. package/assets/esri/core/workers/chunks/d339dee99c4820b63f39.js +0 -1
  241. package/assets/esri/core/workers/chunks/d35efcbe439500bf18bc.js +0 -1
  242. package/assets/esri/core/workers/chunks/d44d210e94406509e980.js +0 -314
  243. package/assets/esri/core/workers/chunks/e5e3b6d00d27b5bb354f.js +0 -1
  244. package/assets/esri/core/workers/chunks/f14b318bab5efcf43419.js +0 -1
  245. package/assets/esri/core/workers/chunks/f29715459ecd46180829.js +0 -1
  246. package/assets/esri/core/workers/chunks/f9070edd8e0b2a57af79.js +0 -1
  247. package/chunks/Bufferer-DjC-SKTJ.js +0 -5
  248. package/chunks/Distance2DCalculator-8-JrFGHH.js +0 -5
  249. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationSettings.js +0 -5
  250. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.d.ts +0 -4
  251. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +0 -5
@@ -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{parseUrl as o}from"../utils.js";import{executeQueryForIds as r}from"./operations/query.js";import t from"../support/Query.js";async function s(s,i,m){const p=o(s),{data:a}=await r(p,t.from(i),m);return a.objectIds}export{s as executeForIds};
5
+ import{parseUrl as o}from"../utils.js";import{executeQueryForIds as r}from"./operations/query.js";import t from"../support/Query.js";async function s(s,i,m){const p=o(s),{data:a}=await r(p,t.from(i),m);return a.objectIds??[]}export{s as executeForIds};
@@ -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 o from"../../core/Clonable.js";import{JSONMap as t}from"../../core/jsonMap.js";import r from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as p}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{kebabDict as n}from"../../layers/support/fieldType.js";import l from"./AttributeBinsGrouping.js";const a=new t({naturalLog:"natural-log",squareRoot:"square-root"});let y=class extends(o.ClonableMixin(r)){constructor(e){super(e),this.expression=null,this.expressionValueType=null,this.field=null,this.firstDayOfWeek=null,this.hideUpperBound=null,this.splitBy=null,this.stackBy=null,this.transformation=null}};e([s({type:String,json:{name:"onExpression.value",write:!0}})],y.prototype,"expression",void 0),e([p(n,{name:"onExpression.valueType"})],y.prototype,"expressionValueType",void 0),e([s({type:String,json:{name:"onField",write:!0}})],y.prototype,"field",void 0),e([s({type:String,json:{write:!0}})],y.prototype,"firstDayOfWeek",void 0),e([s({type:String,json:{write:!0}})],y.prototype,"hideUpperBound",void 0),e([s({type:l,json:{write:{overridePolicy(){return{enabled:null!=this.splitBy?.value||null!=this.splitBy?.type}}}}})],y.prototype,"splitBy",void 0),e([s({type:l,json:{write:{target:{stackBy:{type:l},jsonStyle:{type:String}},writer:(e,o)=>{e&&(o.stackBy=e.toJSON(),null!=e.responseType&&(o.jsonStyle=e.responseType))},overridePolicy(){return{enabled:null!=this.stackBy?.value||null!=this.stackBy?.type}}},read:{source:["stackBy","jsonStyle"],reader:(e,o)=>l.fromJSON({...o.stackBy,responseType:o.jsonStyle})}}})],y.prototype,"stackBy",void 0),e([p(a)],y.prototype,"transformation",void 0),y=e([i("esri.rest.support.BinParametersBase")],y);const u=y;export{u as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Clonable.js";import{JSONMap as o}from"../../core/jsonMap.js";import r from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import n from"./AttributeBinsGrouping.js";const l=new o({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeDate:"date",esriFieldTypeDateOnly:"date-only",esriFieldTypeTimeOnly:"time-only",esriFieldTypeTimestampOffset:"timestamp-offset"}),a=new o({naturalLog:"natural-log",squareRoot:"square-root"});let y=class extends(t.ClonableMixin(r)){constructor(e){super(e),this.expression=null,this.expressionValueType=null,this.field=null,this.firstDayOfWeek=null,this.hideUpperBound=null,this.splitBy=null,this.stackBy=null,this.transformation=null}};e([s({type:String,json:{name:"onExpression.value",write:!0}})],y.prototype,"expression",void 0),e([i(l,{name:"onExpression.valueType"})],y.prototype,"expressionValueType",void 0),e([s({type:String,json:{name:"onField",write:!0}})],y.prototype,"field",void 0),e([s({type:String,json:{write:!0}})],y.prototype,"firstDayOfWeek",void 0),e([s({type:String,json:{write:!0}})],y.prototype,"hideUpperBound",void 0),e([s({type:n,json:{write:{overridePolicy(){return{enabled:null!=this.splitBy?.value||null!=this.splitBy?.type}}}}})],y.prototype,"splitBy",void 0),e([s({type:n,json:{write:{target:{stackBy:{type:n},jsonStyle:{type:String}},writer:(e,t)=>{e&&(t.stackBy=e.toJSON(),null!=e.responseType&&(t.jsonStyle=e.responseType))},overridePolicy(){return{enabled:null!=this.stackBy?.value||null!=this.stackBy?.type}}},read:{source:["stackBy","jsonStyle"],reader:(e,t)=>n.fromJSON({...t.stackBy,responseType:t.jsonStyle})}}})],y.prototype,"stackBy",void 0),e([i(a)],y.prototype,"transformation",void 0),y=e([p("esri.rest.support.BinParametersBase")],y);const u=y;export{u 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 a="20250211",c="ac20391bad78bd70c529154a03836e3337515348";export{a as buildDate,c as commitHash};
5
+ const e="20250213",c="427891cfd72455729e0fe08217549e2040035a2c";export{e as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"./CIMResourceManager.js";import{Transformation as t,CanvasDrawHelper as i}from"./CIMSymbolDrawHelper.js";import{CIMSymbolHelper as r}from"./CIMSymbolHelper.js";import{OverrideHelper as a}from"./OverrideHelper.js";import{mapCIMSymbolToGeometryType as s}from"./utils.js";const n=96/72;class h{constructor(t){this._spatialReference=t,this._imageDataCanvas=null,this._cimResourceManager=new e}get _canvas(){return this._imageDataCanvas||(this._imageDataCanvas=document.createElement("canvas")),this._imageDataCanvas}get resourceManager(){return this._cimResourceManager}async rasterizeCIMSymbolAsync(e,t,i,n,h,l,c,m,g){if(!e)return null;const{data:y}=e;if(!y||"CIMSymbolReference"!==y.type||!y.symbol)return null;const{symbol:d}=y;l||(l=s(d));const u=await a.resolveSymbolOverrides(y,t,this._spatialReference,h,l,c,m),w=this._cimResourceManager,p=[];r.fetchResources(u,w,p),r.fetchFonts(u,w,p),p.length>0&&await Promise.all(p);const{width:b,height:f}=i,M=o(l,b,f,n),C=r.getEnvelope(u,M,w);if(!C)return null;C.x===1/0&&(C.x=b+2),C.y===1/0&&(C.y=-f/2),C.width===-1/0&&(C.width=b),C.height===-1/0&&(C.height=f);let R=1,v=0,x=0;switch(d.type){case"CIMPointSymbol":case"CIMTextSymbol":{let e=1;C.width>b&&(e=b/C.width);let t=1;C.height>f&&(t=f/C.height),"preview"===n&&(C.width<b&&(e=b/C.width),C.height<f&&(t=f/C.height)),R=Math.min(e,t),v=C.x+C.width/2,x=C.y+C.height/2}break;case"CIMLineSymbol":{(g||C.height>f)&&(R=f/C.height),x=C.y+C.height/2;const e=C.x*R+b/2,t=(C.x+C.width)*R+b/2,{paths:i}=M;i[0][0][0]-=e/R,i[0][2][0]-=(t-b)/R}break;case"CIMPolygonSymbol":{v=C.x+C.width/2,x=C.y+C.height/2;const e=C.x*R+b/2,t=(C.x+C.width)*R+b/2,i=C.y*R+f/2,r=(C.y+C.height)*R+f/2,{rings:a}=M;e<0&&(a[0][0][0]-=e,a[0][3][0]-=e,a[0][4][0]-=e),i<0&&(a[0][0][1]+=i,a[0][1][1]+=i,a[0][4][1]+=i),t>b&&(a[0][1][0]-=t-b,a[0][2][0]-=t-b),r>f&&(a[0][2][1]+=r-f,a[0][3][1]+=r-f)}}const I={type:"cim",data:{type:"CIMSymbolReference",symbol:u}};return this.rasterize(I,b,f,v,x,R,l,1,M)}rasterize(e,r,a,h,l,c,m,g=0,y=null,d=window.devicePixelRatio||1){const{data:u}=e;if(!u||"CIMSymbolReference"!==u.type||!u.symbol)return null;const{symbol:w}=u,p=this._canvas,b=d*n;p.width=r*b,p.height=a*b,m||(m=s(w)),y||(y=o(m,r,a,"legend")),p.width+=2*g,p.height+=2*g;const f=p.getContext("2d",{willReadFrequently:!0}),M=t.createIdentity();M.translate(-h,-l),M.scale(c*b,-c*b),M.translate(r*b/2+g,a*b/2+g),f.clearRect(0,0,p.width,p.height);return new i(f,this._cimResourceManager,M,!0).drawSymbol(w,y),f.getImageData(0,0,p.width,p.height)}}function o(e,t,i,r){const a=1,s=-t/2+a,n=t/2-a,h=i/2-a,o=-i/2+a;switch(e){case"esriGeometryPoint":return{x:0,y:0};case"esriGeometryPolyline":return{paths:[[[s,0],[0,0],[n,0]]]};default:return"legend"===r?{rings:[[[s,h],[n,0],[n,o],[s,o],[s,h]]]}:{rings:[[[s,h],[n,h],[n,o],[s,o],[s,h]]]}}}export{h as CIMSymbolRasterizer};
5
+ import e from"./CIMResourceManager.js";import{Transformation as t,CanvasDrawHelper as i}from"./CIMSymbolDrawHelper.js";import{CIMSymbolHelper as h}from"./CIMSymbolHelper.js";import{OverrideHelper as r}from"./OverrideHelper.js";import{scale as n,translate as s}from"./rasterizingUtils.js";import{mapCIMSymbolToGeometryType as a}from"./utils.js";const o=96/72;class l{constructor(t){this._spatialReference=t,this._imageDataCanvas=null,this._cimResourceManager=new e}get _canvas(){return this._imageDataCanvas||(this._imageDataCanvas=document.createElement("canvas")),this._imageDataCanvas}get resourceManager(){return this._cimResourceManager}async rasterizeCIMSymbolAsync(e,t,i,s,o,l,m,g,y,d){if(!e)return null;const{data:w}=e;if(!w||"CIMSymbolReference"!==w.type||!w.symbol)return null;const{symbol:u}=w;l||(l=a(u));const x=await r.resolveSymbolOverrides(w,t,this._spatialReference,o,l,m,g),f=this._cimResourceManager,p=[];h.fetchResources(x,f,p),h.fetchFonts(x,f,p),p.length>0&&await Promise.all(p);const{width:b,height:M}=i;let C=c(l,b,M,s,d);const R=h.getEnvelope(x,C,f);if(!R)return null;R.x===1/0&&(R.x=b+2),R.y===1/0&&(R.y=-M/2),R.width===-1/0&&(R.width=b),R.height===-1/0&&(R.height=M);let v=1,I=0,S=0;switch(u.type){case"CIMPointSymbol":case"CIMTextSymbol":{let e=1;R.width>b&&(e=b/R.width);let t=1;R.height>M&&(t=M/R.height),"preview"===s&&(R.width<b&&(e=b/R.width),R.height<M&&(t=M/R.height)),v=Math.min(e,t),I=R.x+R.width/2,S=R.y+R.height/2}break;case"CIMLineSymbol":if(d){S=R.y+R.height/2,I=R.x+R.width/2;const e=R.width-b,t=R.height-M;C={paths:n(C.paths,{xmin:-1*R.width/2+e,xmax:R.width/2-e,ymin:-1*R.height/2+t,ymax:R.height/2-t,width:R.width-2*e,height:R.height-2*t})}}else{(y||R.height>M)&&(v=M/R.height),S=R.y+R.height/2;const e=R.x*v+b/2,t=(R.x+R.width)*v+b/2,{paths:i}=C;i[0][0][0]-=e/v,i[0][2][0]-=(t-b)/v}break;case"CIMPolygonSymbol":if(d){S=R.y+R.height/2,I=R.x+R.width/2;const e=R.width-b,t=R.height-M;C={paths:n(C.rings,{xmin:-1*R.width/2+e,xmax:R.width/2-e,ymin:-1*R.height/2+t,ymax:R.height/2-t,width:R.width-2*e,height:R.height-2*t})}}else{I=R.x+R.width/2,S=R.y+R.height/2;const e=R.x*v+b/2,t=(R.x+R.width)*v+b/2,i=R.y*v+M/2,h=(R.y+R.height)*v+M/2,{rings:r}=C;e<0&&(r[0][0][0]-=e,r[0][3][0]-=e,r[0][4][0]-=e),i<0&&(r[0][0][1]+=i,r[0][1][1]+=i,r[0][4][1]+=i),t>b&&(r[0][1][0]-=t-b,r[0][2][0]-=t-b),h>M&&(r[0][2][1]+=h-M,r[0][3][1]+=h-M)}}const _={type:"cim",data:{type:"CIMSymbolReference",symbol:x}};return this.rasterize(_,b,M,I,S,v,l,1,C)}rasterize(e,h,r,n,s,l,m,g=0,y=null,d=window.devicePixelRatio||1){const{data:w}=e;if(!w||"CIMSymbolReference"!==w.type||!w.symbol)return null;const{symbol:u}=w,x=this._canvas,f=d*o;x.width=h*f,x.height=r*f,m||(m=a(u)),y||(y=c(m,h,r,"legend")),x.width+=2*g,x.height+=2*g;const p=x.getContext("2d",{willReadFrequently:!0}),b=t.createIdentity();b.translate(-n,-s),b.scale(l*f,-l*f),b.translate(h*f/2+g,r*f/2+g),p.clearRect(0,0,x.width,x.height);return new i(p,this._cimResourceManager,b,!0).drawSymbol(u,y),p.getImageData(0,0,x.width,x.height)}}function m(e,t,i,h){if("esriGeometryPolygon"===t){return{rings:s(n(e.rings,{xmin:0,ymin:0,xmax:i,ymax:h,width:i,height:h}),-1*i/2,-1*h/2)}}if("esriGeometryPolyline"===t){return{paths:s(n(e.paths,{xmin:0,ymin:0,xmax:i,ymax:h,width:i,height:h}),-1*i/2,-1*h/2)}}return null}function c(e,t,i,h,r){const n=1,s=-t/2+n,a=t/2-n,o=i/2-n,l=-i/2+n;if(r&&("esriGeometryPolygon"===e||"esriGeometryPolyline"===e)){const h=m(r,e,t,i);if(h)return h}switch(e){case"esriGeometryPoint":return{x:0,y:0};case"esriGeometryPolyline":return{paths:[[[s,0],[0,0],[a,0]]]};default:return"legend"===h?{rings:[[[s,o],[a,0],[a,l],[s,l],[s,o]]]}:{rings:[[[s,o],[a,o],[a,l],[s,l],[s,o]]]}}}export{l as CIMSymbolRasterizer};
@@ -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{packFloatRGBA as o}from"../../core/floatRGBA.js";import t from"../../core/Logger.js";import{nextPowerOfTwo as r}from"../../core/mathUtils.js";import{dashSdfRasterizationScale as e,dashSdfDistanceNormalization as n,dashRadius as a}from"./constants.js";import{defaultCIMValues as s}from"./defaultCIMValues.js";import{gradientTextureExternalPadding as l}from"../../views/2d/engine/webgl/definitions.js";const i=()=>t.getLogger("esri.symbols.cim.rasterizingUtils"),c=32,f=o=>"vertical"===o||"horizontal"===o||"cross"===o||"esriSFSCross"===o||"esriSFSVertical"===o||"esriSFSHorizontal"===o;function u(o,t,e){const n=t.style,a=r(Math.ceil(e)),s=f(n)?8*a:16*a,l=2*a;o.width=s,o.height=s;const i=o.getContext("2d");i.strokeStyle="#ffffff",i.lineWidth=a,i.beginPath(),"vertical"!==n&&"cross"!==n&&"esriSFSCross"!==n&&"esriSFSVertical"!==n||(i.moveTo(s/2,-l),i.lineTo(s/2,s+l)),"horizontal"!==n&&"cross"!==n&&"esriSFSCross"!==n&&"esriSFSHorizontal"!==n||(i.moveTo(-l,s/2),i.lineTo(s+l,s/2)),"backward-diagonal"!==n&&"diagonal-cross"!==n&&"esriSFSDiagonalCross"!==n&&"esriSFSBackwardDiagonal"!==n||(i.moveTo(-l,-l),i.lineTo(s+l,s+l),i.moveTo(s-l,-l),i.lineTo(s+l,l),i.moveTo(-l,s-l),i.lineTo(l,s+l)),"forward-diagonal"!==n&&"diagonal-cross"!==n&&"esriSFSForwardDiagonal"!==n&&"esriSFSDiagonalCross"!==n||(i.moveTo(s+l,-l),i.lineTo(-l,s+l),i.moveTo(l,-l),i.lineTo(-l,l),i.moveTo(s+l,s-l),i.lineTo(s-l,s+l)),i.stroke();const c=i.getImageData(0,0,o.width,o.height),u=new Uint8Array(c.data);let h;for(let r=0;r<u.length;r+=4)h=u[r+3]/255,u[r]=u[r]*h,u[r+1]=u[r+1]*h,u[r+2]=u[r+2]*h;return[u,o.width,o.height,a]}function h(t){t.length%2==1&&(t=[...t,...t]);const r=t.reduce(((o,t)=>o+t),0),a=Math.round(r*e),s=1,l=new Float32Array(a*s);let i=0,c=0,f=.5,u=!0;for(const o of t){for(i=c,c+=o*e;f<=c;){const o=f-.5,t=Math.min(Math.abs(f-i),Math.abs(f-c));l[o]=u?-t:t,f++}u=!u}const h=l.length,m=new Uint8Array(4*h);for(let g=0;g<h;++g){const t=l[g]/e;o(t/n*.5+.5,m,4*g)}return[m,a,s]}function m(t,r){null==t&&(t=[]);const e="Butt"===r,n="Square"===r,s=!e&&!n;t.length%2==1&&(t=[...t,...t]);const l=a,i=2*l;let c=0;for(const o of t)c+=o;const f=Math.round(c*l),u=new Float32Array(f*i),h=.5*l;let m=0,g=0,C=.5,d=!0;for(const o of t){for(m=g,g+=o*l;C<=g;){let o=.5;for(;o<i;){const t=(o-.5)*f+C-.5,r=s?(o-l)*(o-l):Math.abs(o-l);u[t]=d?e?Math.max(Math.max(m+h-C,r),Math.max(C-g+h,r)):r:s?Math.min((C-m)*(C-m)+r,(C-g)*(C-g)+r):n?Math.min(Math.max(C-m,r),Math.max(g-C,r)):Math.min(Math.max(C-m+h,r),Math.max(g+h-C,r)),o++}C++}d=!d}const p=u.length,M=new Uint8Array(4*p);for(let a=0;a<p;++a){const t=(s?Math.sqrt(u[a]):u[a])/l;o(t,M,4*a)}return[M,f,i]}function g(o,t){const{colorRamp:r,gradientType:e}=t,n="CIMFixedColorRamp"===r.type,a=t.interval||s.CIMGradientFill.interval;let l=p(r);return n&&(l=M(l,a)),"Discrete"===e||n?w(o,l,a):S(o,l)}let C;function d(o,t){const{colorRamp:r,gradientType:e}=t,n=p(r),a="CIMFixedColorRamp"===r.type;if("Continuous"===e&&!a)return y(o,n);const l=t.interval??s.CIMGradientFill.interval;if(a){return y(o,M(n,l))}const i=[];C??=document.createElement("canvas"),F(C,n,l,1,0);const c=C.getContext("2d").getImageData(0,0,l,1).data;for(let s=0,f=0;s<l;s++,f=4*s){const o=[c[f+0],c[f+1],c[f+2],c[f+3]];i.push({offset:s/l,color:o}),i.push({offset:(s+1)/l,color:o})}return y(o,i)}function p(o){const t=[];switch(o.type){case"CIMPolarContinuousColorRamp":case"CIMLinearContinuousColorRamp":{"CIMPolarContinuousColorRamp"===o.type&&i().warnOnce("CIMPolarContinuousColorRamp is currently unsupported. Falling back to CIMLinearContinuousColorRamp.");const r=o;t.push({offset:0,color:[r.fromColor[0],r.fromColor[1],r.fromColor[2],r.fromColor[3]/255]}),t.push({offset:1,color:[r.toColor[0],r.toColor[1],r.toColor[2],r.toColor[3]/255]});break}case"CIMFixedColorRamp":{const r=o,e=1/(r.colors.length-1);let n=0;for(const o of r.colors)t.push({offset:n,color:[o[0],o[1],o[2],o[3]/255]}),n+=e;break}case"CIMMultipartColorRamp":{const r=o,e=r.weights.reduce(((o,t)=>o+t),0);let n=0;for(let o=0;o<r.colorRamps.length;o++){const a=r.colorRamps[o],s=r.weights[o],l=p(a);for(const o of l)t.push({offset:(n+o.offset*s)/e,color:o.color});n+=s}break}default:i().error(`Color ramp "${o.type}" currently unsupported.`)}return t}function M(o,t){const r=[],e=(o.length-1)/(t-1);for(let n=0;n<t;n++){const a=o[Math.round(n*e)].color;r.push({offset:n/t,color:a}),r.push({offset:(n+1)/t,color:a})}return r}function S(o,t){return F(o,t,c,1,l),T(o)}function w(o,t,r){return F(o,t,r,1,l),T(o)}function y(o,t,r=0){for(const{offset:e,color:n}of t)o.addColorStop(Math.min(Math.max(e,r),1-r),`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${n[3]})`)}function F(o,t,r,e,n){const a=r+2*n;o.width=a,o.height=e;const s=(n+1)/a,l=o.getContext("2d",{willReadFrequently:!0});if(t.length>0){const o=l.createLinearGradient(0,0,a,e);y(o,t,s),l.fillStyle=o}else l.fillStyle="rgba(128, 128, 128, 1)";l.fillRect(0,0,a,e)}function T(o){const{width:t,height:r}=o,e=o.getContext("2d").getImageData(0,0,t,r),n=new Uint8Array(e.data);for(let a=0;a<n.length;a+=4){const o=n[a+3]/255;n[a]*=o,n[a+1]*=o,n[a+2]*=o}return[n,t,r]}export{d as addColorStops,m as rasterizeDash,h as rasterizeDash1D,u as rasterizeFillStyle,g as rasterizeGradient};
5
+ import{packFloatRGBA as o}from"../../core/floatRGBA.js";import t from"../../core/Logger.js";import{nextPowerOfTwo as e}from"../../core/mathUtils.js";import{dashSdfRasterizationScale as r,dashSdfDistanceNormalization as n,dashRadius as a}from"./constants.js";import{defaultCIMValues as s}from"./defaultCIMValues.js";import{gradientTextureExternalPadding as i}from"../../views/2d/engine/webgl/definitions.js";const l=()=>t.getLogger("esri.symbols.cim.rasterizingUtils"),c=32,h=o=>"vertical"===o||"horizontal"===o||"cross"===o||"esriSFSCross"===o||"esriSFSVertical"===o||"esriSFSHorizontal"===o;function f(o,t,r){const n=t.style,a=e(Math.ceil(r)),s=h(n)?8*a:16*a,i=2*a;o.width=s,o.height=s;const l=o.getContext("2d");l.strokeStyle="#ffffff",l.lineWidth=a,l.beginPath(),"vertical"!==n&&"cross"!==n&&"esriSFSCross"!==n&&"esriSFSVertical"!==n||(l.moveTo(s/2,-i),l.lineTo(s/2,s+i)),"horizontal"!==n&&"cross"!==n&&"esriSFSCross"!==n&&"esriSFSHorizontal"!==n||(l.moveTo(-i,s/2),l.lineTo(s+i,s/2)),"backward-diagonal"!==n&&"diagonal-cross"!==n&&"esriSFSDiagonalCross"!==n&&"esriSFSBackwardDiagonal"!==n||(l.moveTo(-i,-i),l.lineTo(s+i,s+i),l.moveTo(s-i,-i),l.lineTo(s+i,i),l.moveTo(-i,s-i),l.lineTo(i,s+i)),"forward-diagonal"!==n&&"diagonal-cross"!==n&&"esriSFSForwardDiagonal"!==n&&"esriSFSDiagonalCross"!==n||(l.moveTo(s+i,-i),l.lineTo(-i,s+i),l.moveTo(i,-i),l.lineTo(-i,i),l.moveTo(s+i,s-i),l.lineTo(s-i,s+i)),l.stroke();const c=l.getImageData(0,0,o.width,o.height),f=new Uint8Array(c.data);let m;for(let e=0;e<f.length;e+=4)m=f[e+3]/255,f[e]=f[e]*m,f[e+1]=f[e+1]*m,f[e+2]=f[e+2]*m;return[f,o.width,o.height,a]}function m(t){t.length%2==1&&(t=[...t,...t]);const e=t.reduce(((o,t)=>o+t),0),a=Math.round(e*r),s=1,i=new Float32Array(a*s);let l=0,c=0,h=.5,f=!0;for(const o of t){for(l=c,c+=o*r;h<=c;){const o=h-.5,t=Math.min(Math.abs(h-l),Math.abs(h-c));i[o]=f?-t:t,h++}f=!f}const m=i.length,u=new Uint8Array(4*m);for(let g=0;g<m;++g){const t=i[g]/r;o(t/n*.5+.5,u,4*g)}return[u,a,s]}function u(t,e){null==t&&(t=[]);const r="Butt"===e,n="Square"===e,s=!r&&!n;t.length%2==1&&(t=[...t,...t]);const i=a,l=2*i;let c=0;for(const o of t)c+=o;const h=Math.round(c*i),f=new Float32Array(h*l),m=.5*i;let u=0,g=0,d=.5,p=!0;for(const o of t){for(u=g,g+=o*i;d<=g;){let o=.5;for(;o<l;){const t=(o-.5)*h+d-.5,e=s?(o-i)*(o-i):Math.abs(o-i);f[t]=p?r?Math.max(Math.max(u+m-d,e),Math.max(d-g+m,e)):e:s?Math.min((d-u)*(d-u)+e,(d-g)*(d-g)+e):n?Math.min(Math.max(d-u,e),Math.max(g-d,e)):Math.min(Math.max(d-u+m,e),Math.max(g+m-d,e)),o++}d++}p=!p}const C=f.length,M=new Uint8Array(4*C);for(let a=0;a<C;++a){const t=(s?Math.sqrt(f[a]):f[a])/i;o(t,M,4*a)}return[M,h,l]}function g(o,t){const{colorRamp:e,gradientType:r}=t,n="CIMFixedColorRamp"===e.type,a=t.interval||s.CIMGradientFill.interval;let i=C(e);return n&&(i=M(i,a)),"Discrete"===r||n?w(o,i,a):x(o,i)}let d;function p(o,t){const{colorRamp:e,gradientType:r}=t,n=C(e),a="CIMFixedColorRamp"===e.type;if("Continuous"===r&&!a)return y(o,n);const i=t.interval??s.CIMGradientFill.interval;if(a){return y(o,M(n,i))}const l=[];d??=document.createElement("canvas"),S(d,n,i,1,0);const c=d.getContext("2d").getImageData(0,0,i,1).data;for(let s=0,h=0;s<i;s++,h=4*s){const o=[c[h+0],c[h+1],c[h+2],c[h+3]];l.push({offset:s/i,color:o}),l.push({offset:(s+1)/i,color:o})}return y(o,l)}function C(o){const t=[];switch(o.type){case"CIMPolarContinuousColorRamp":case"CIMLinearContinuousColorRamp":{"CIMPolarContinuousColorRamp"===o.type&&l().warnOnce("CIMPolarContinuousColorRamp is currently unsupported. Falling back to CIMLinearContinuousColorRamp.");const e=o;t.push({offset:0,color:[e.fromColor[0],e.fromColor[1],e.fromColor[2],e.fromColor[3]/255]}),t.push({offset:1,color:[e.toColor[0],e.toColor[1],e.toColor[2],e.toColor[3]/255]});break}case"CIMFixedColorRamp":{const e=o,r=1/(e.colors.length-1);let n=0;for(const o of e.colors)t.push({offset:n,color:[o[0],o[1],o[2],o[3]/255]}),n+=r;break}case"CIMMultipartColorRamp":{const e=o,r=e.weights.reduce(((o,t)=>o+t),0);let n=0;for(let o=0;o<e.colorRamps.length;o++){const a=e.colorRamps[o],s=e.weights[o],i=C(a);for(const o of i)t.push({offset:(n+o.offset*s)/r,color:o.color});n+=s}break}default:l().error(`Color ramp "${o.type}" currently unsupported.`)}return t}function M(o,t){const e=[],r=(o.length-1)/(t-1);for(let n=0;n<t;n++){const a=o[Math.round(n*r)].color;e.push({offset:n/t,color:a}),e.push({offset:(n+1)/t,color:a})}return e}function x(o,t){return S(o,t,c,1,i),F(o)}function w(o,t,e){return S(o,t,e,1,i),F(o)}function y(o,t,e=0){for(const{offset:r,color:n}of t)o.addColorStop(Math.min(Math.max(r,e),1-e),`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${n[3]})`)}function S(o,t,e,r,n){const a=e+2*n;o.width=a,o.height=r;const s=(n+1)/a,i=o.getContext("2d",{willReadFrequently:!0});if(t.length>0){const o=i.createLinearGradient(0,0,a,r);y(o,t,s),i.fillStyle=o}else i.fillStyle="rgba(128, 128, 128, 1)";i.fillRect(0,0,a,r)}function F(o){const{width:t,height:e}=o,r=o.getContext("2d").getImageData(0,0,t,e),n=new Uint8Array(r.data);for(let a=0;a<n.length;a+=4){const o=n[a+3]/255;n[a]*=o,n[a+1]*=o,n[a+2]*=o}return[n,t,e]}function v(o){const t=o[0]?.[0]?.[0]??0,e=o[0]?.[0]?.[1]??0,r={ymin:e,xmin:t,ymax:e,xmax:t,width:0,height:0};for(let n=0;n<o.length;n++){const t=o[n];for(let o=0;o<t.length;o++){const e=t[o][0],n=t[o][1];e<r.xmin&&(r.xmin=e),e>r.xmax&&(r.xmax=e),n<r.ymin&&(r.ymin=n),n>r.ymax&&(r.ymax=n)}}return r.width=Math.abs(r.xmax-r.xmin),r.height=Math.abs(r.ymax-r.ymin),r}function T(o,t){const e=v(o),r=0===e.width?1:e.width,n=0===e.height?1:e.height,a=[];for(let s=0;s<o.length;s++){const i=o[s],l=[];for(let o=0;o<i.length;o++){let a=Math.round(i[o][0]-e.xmin),s=Math.round(i[o][1]-e.ymin);if(a=t.xmin+a*t.width/r,s=t.ymin+s*t.height/n,isNaN(a)||isNaN(s))throw new Error("Scaled shape has NaN values");l.push([a,s])}a.push(l)}return a}function R(o,t,e){const r=[];for(let n=0;n<o.length;n++){const a=o[n],s=[];for(let o=0;o<a.length;o++){const r=a[o][0]+t,n=a[o][1]+e;if(isNaN(r)||isNaN(n))throw new Error("Scaled shape has NaN values");s.push([r,n])}r.push(s)}return r}export{p as addColorStops,u as rasterizeDash,m as rasterizeDash1D,f as rasterizeFillStyle,g as rasterizeGradient,T as scale,R as translate};
@@ -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{px2pt as e,pt2px as i}from"../../core/screenUtils.js";import{CIMSymbolHelper as t}from"../cim/CIMSymbolHelper.js";import{CIMSymbolRasterizer as l}from"../cim/CIMSymbolRasterizer.js";import{OverrideHelper as a}from"../cim/OverrideHelper.js";import{mapCIMSymbolToGeometryType as r}from"../cim/utils.js";import{SymbolSizeDefaults as n}from"./previewUtils.js";import{renderSymbol as o}from"./renderUtils.js";const s=new l(null),m=e(n.size),c=e(n.maxSize),u=e(n.lineWidth),f=1;async function h(e,i,t){const l=i?.size;let a=null!=l&&"object"==typeof l&&"width"in l?l.width:l,r=null!=l&&"object"==typeof l&&"height"in l?l.height:l;if(null==a||null==r)if("esriGeometryPolygon"===t)a=r=i.maxSize?Math.min(i.maxSize,m):m;else{const l=await y(e,i,t);l&&(a=l.width,r=l.height),"esriGeometryPolyline"===t&&(a=i.maxSize?Math.min(i.maxSize,u):u),a=null!=a&&isFinite(a)?Math.min(a,c):m,r=null!=r&&isFinite(r)?Math.max(Math.min(r,c),f):m}return"legend"===i.style&&"esriGeometryPolyline"===t&&(a=u),{width:a,height:r}}async function y(e,i,l){const{feature:r,fieldMap:n,viewParams:o}=i.cimOptions||i,m=await a.resolveSymbolOverrides(e.data,r,null,n,l,null,o);if(!m)return null;(e=e.clone()).data={type:"CIMSymbolReference",symbol:m},e.data.primitiveOverrides=void 0;const c=[];return t.fetchResources(m,s.resourceManager,c),t.fetchFonts(m,s.resourceManager,c),c.length>0&&await Promise.all(c),t.getEnvelope(m,null,s.resourceManager)}async function p(e,t={}){const{node:l,opacity:a,symbolConfig:n}=t,m=null!=n&&"object"==typeof n&&"isSquareFill"in n&&n.isSquareFill,c=t.cimOptions||t,u=c.geometryType||r(e?.data?.symbol),f=await h(e,t,u),{feature:y,fieldMap:p}=c,d=m||"esriGeometryPolygon"!==u?"preview":"legend",g=await s.rasterizeCIMSymbolAsync(e,y,f,d,p,u,null,c.viewParams,c.allowScalingUp);if(!g)return null;const{width:w,height:b}=g,M=document.createElement("canvas");M.width=w,M.height=b;M.getContext("2d").putImageData(g,0,0);const S=i(f.width),v=i(f.height),j=new Image(S,v);j.src=M.toDataURL(),j.ariaLabel=t.ariaLabel??null,j.alt=t.ariaLabel??"",null!=a&&(j.style.opacity=`${a}`);let x=j;if(null!=t.effectView){const e={shape:{type:"image",x:0,y:0,width:S,height:v,src:j.src},fill:null,stroke:null,offset:[0,0]};x=o([[e]],[S,v],{effectView:t.effectView,ariaLabel:t.ariaLabel})}return l&&x&&l.appendChild(x),x}export{p as previewCIMSymbol};
5
+ import{px2pt as e,pt2px as t}from"../../core/screenUtils.js";import{CIMSymbolHelper as i}from"../cim/CIMSymbolHelper.js";import{CIMSymbolRasterizer as l}from"../cim/CIMSymbolRasterizer.js";import{OverrideHelper as r}from"../cim/OverrideHelper.js";import{mapCIMSymbolToGeometryType as o}from"../cim/utils.js";import{SymbolSizeDefaults as n}from"./previewUtils.js";import{renderSymbol as a}from"./renderUtils.js";const s=new l(null),m=e(n.size),h=e(n.maxSize),c=e(n.lineWidth),y=1;async function u(e,t,i){const l=t?.size;let r=null!=l&&"object"==typeof l&&"width"in l?l.width:l,o=null!=l&&"object"==typeof l&&"height"in l?l.height:l;if(null==r||null==o)if("esriGeometryPolygon"===i)r=o=t.maxSize?Math.min(t.maxSize,m):m;else{const l=await f(e,t,i);l&&(r=l.width,o=l.height),"esriGeometryPolyline"===i&&(r=t.maxSize?Math.min(t.maxSize,c):c),r=null!=r&&isFinite(r)?Math.min(r,h):m,o=null!=o&&isFinite(o)?Math.max(Math.min(o,h),y):m}return"legend"===t.style&&"esriGeometryPolyline"===i&&(r=c),{width:r,height:o}}async function f(e,t,l){const{feature:o,fieldMap:n,viewParams:a}=t.cimOptions||t,m=await r.resolveSymbolOverrides(e.data,o,null,n,l,null,a);if(!m)return null;(e=e.clone()).data={type:"CIMSymbolReference",symbol:m},e.data.primitiveOverrides=void 0;const h=[];return i.fetchResources(m,s.resourceManager,h),i.fetchFonts(m,s.resourceManager,h),h.length>0&&await Promise.all(h),i.getEnvelope(m,null,s.resourceManager)}async function g(i,l={}){const{node:r,opacity:n,symbolConfig:m}=l,h=null!=m&&"object"==typeof m&&"isSquareFill"in m&&m.isSquareFill,c=l.cimOptions||l,y=c.geometryType||o(i?.data?.symbol),f=await u(i,l,y),{feature:g,fieldMap:d}=c,p=l?.geometry||h||"esriGeometryPolygon"!==y?"preview":"legend";let w=f;const b=f;if(l?.geometry&&("esriGeometryPolygon"===y||"esriGeometryPolyline"===y)){const i=200;if(t(f.width)<i||t(f.height)<i){const t=f.width>f.height?e(i)*f.height/f.width:e(i);w={width:f.width>f.height?e(i):e(i)*f.width/f.height,height:t}}}const M=await s.rasterizeCIMSymbolAsync(i,g,w,p,d,y,null,c.viewParams,c.allowScalingUp,l?.geometry?.toJSON());if(!M)return null;const{width:S,height:v}=M,j=document.createElement("canvas");j.width=S,j.height=v;j.getContext("2d").putImageData(M,0,0);const x=t(b.width),z=t(b.height),P=new Image(x,z);P.src=j.toDataURL(),P.ariaLabel=l.ariaLabel??null,P.alt=l.ariaLabel??"",null!=n&&(P.style.opacity=`${n}`);let C=P;if(null!=l.effectView){const e={shape:{type:"image",x:0,y:0,width:x,height:z,src:P.src},fill:null,stroke:null,offset:[0,0]};C=a([[e]],[x,z],{effectView:l.effectView,ariaLabel:l.ariaLabel})}return r&&C&&r.appendChild(C),C}export{g as previewCIMSymbol};
@@ -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"../../Color.js";import{getColorLuminance as t}from"../../core/colorUtils.js";import a from"../../core/Error.js";import{loadFont as i}from"../../core/fontUtils.js";import{pt2px as o}from"../../core/screenUtils.js";import{getFill as l,getStroke as n,getDashArray as s,getPatternUrlWithColor as h}from"./gfxUtils.js";import{SymbolSizeDefaults as r,shapes as c,adjustColorBrightness as m}from"./previewUtils.js";import{renderSymbol as u}from"./renderUtils.js";import{backgroundPadding as p}from"./textUtils.js";const d="picture-fill",f="picture-marker",y="simple-fill",g="simple-line",w="simple-marker",x="text",v="Aa",b=r.size,M=r.maxSize,k=r.maxOutlineSize,z=r.lineWidth,L=225,j=document.createElement("canvas");function C(e,t){const a=j.getContext("2d"),i=[];t&&(t.weight&&i.push(t.weight),t.size&&i.push(t.size+"px"),t.family&&i.push(t.family)),a.font=i.join(" ");const{width:o,actualBoundingBoxLeft:l,actualBoundingBoxRight:n,actualBoundingBoxAscent:s,actualBoundingBoxDescent:h}=a.measureText(e);return{width:Math.ceil(Math.max(o,l+n)),height:Math.ceil(s+h),x:Math.floor(l),y:Math.floor((s-h)/2)}}function S(e){const t=e?.size;return{width:null!=t&&"object"==typeof t&&"width"in t?o(t.width):null,height:null!=t&&"object"==typeof t&&"height"in t?o(t.height):null}}async function B(e,t){const a=t.fill,i=e.color;if("pattern"===a?.type&&i&&e.type!==d){const e=await h(a.src,i.toCss(!0));a.src=e,t.fill=a}}async function U(e,t,a,o){if(!("font"in e)||!e.font||"text"!==t.shape.type)return;try{await i(e.font)}catch{}const{width:l,height:n}=S(o);if(!/[\uE600-\uE6FF]/.test(t.shape.text)){const{width:i,height:s,x:h,y:r}=C(t.shape.text,{weight:t.font?.weight,size:t.font?.size,family:t.font?.family});a[0]=l??i,a[1]=n??s,t.shape.x=h,t.shape.y=r;let c="angle"in e?e.angle:null;if(null!=o?.rotation&&(c=(c??0)+o.rotation),c){const e=c*(Math.PI/180),t=Math.abs(Math.sin(e)),i=Math.abs(Math.cos(e));a[1]=a[0]*t+a[1]*i}}}function E(e,t,a,i,l){if(null!=e.haloColor&&null!=e.haloSize){l.masking??=a.map((()=>[]));const n=o(e.haloSize);i[0]+=n,i[1]+=n,a.unshift([{...t,fill:null,stroke:{color:e.haloColor,width:2*n,join:"round",cap:"round"}}]),l.masking.unshift([{shape:{type:"rect",x:0,y:0,width:i[0]+2*p,height:i[1]+2*p},fill:[255,255,255],stroke:null},{...t,fill:[0,0,0,0],stroke:null}])}null==e.backgroundColor&&null==e.borderLineColor||(i[0]+=2*p,i[1]+=2*p,a.unshift([{shape:{type:"rect",x:0,y:0,width:i[0],height:i[1]},fill:e.backgroundColor,stroke:{color:e.borderLineColor,width:o(e.borderLineSize)}}]),l.masking?.unshift([]))}function F(e,t){return e>t?"dark":"light"}function D(e,t){const a="number"==typeof t?.size?t?.size:null,i=null!=a?o(a):null,h=null!=t?.maxSize?o(t.maxSize):null;let r="angle"in e?e.angle:null;null!=t?.rotation&&(r=(r??0)+t.rotation);const m=l(e);let u=n(e);"dark"!==A(e,245)||t?.ignoreWhiteSymbols||(u={width:.75,...u,color:"#bdc3c7"});const p={shape:null,fill:m,stroke:u,offset:[0,0]};u?.width&&(u.width=Math.min(u.width,k));const L=u?.width||0;let j=null!=t?.size&&(null==t?.scale||t?.scale),B=0,U=0,E=!1;switch(e.type){case w:{const a=e.style,{width:l,height:n}=S(t),s=l===n&&null!=l?l:null!=i?i:Math.min(o(e.size),h||M);switch(B=s,U=s,a){case"circle":p.shape={type:"circle",cx:0,cy:0,r:.5*s},j||(B+=L,U+=L);break;case"cross":p.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[B,.5*U]},{command:"M",values:[.5*B,0]},{command:"L",values:[.5*B,U]}]};break;case"diamond":p.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[.5*B,0]},{command:"L",values:[B,.5*U]},{command:"L",values:[.5*B,U]},{command:"Z",values:[]}]},j||(B+=L,U+=L);break;case"square":p.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[B,0]},{command:"L",values:[B,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},j||(B+=L,U+=L),r&&(E=!0);break;case"triangle":p.shape={type:"path",path:[{command:"M",values:[.5*B,0]},{command:"L",values:[B,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},j||(B+=L,U+=L),r&&(E=!0);break;case"x":p.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[B,U]},{command:"M",values:[B,0]},{command:"L",values:[0,U]}]},r&&(E=!0);break;case"path":p.shape={type:"path",path:e.path||""},j||(B+=L,U+=L),r&&(E=!0),j=!0}break}case g:{const{width:e,height:a}=S(t),o=s(u).reduce(((e,t)=>e+t),0),l=o&&Math.ceil(z/o),n=a??i??L,h=e??(o*l||z);u&&(u.width=n),B=null!=t?.maxSize?Math.min(h,t.maxSize):h,U=n,j=!0,p.shape={type:"path",path:[{command:"M",values:[n/2,U/2]},{command:"L",values:[B-n/2,U/2]}]};break}case d:case y:{const e="object"==typeof t?.symbolConfig&&!!t?.symbolConfig?.isSquareFill,{width:a,height:o}=S(t);B=!e&&a!==o||null==a?null!=i?i:b:a,U=!e&&a!==o||null==o?B:o,j||(B+=L,U+=L),j=!0,p.shape=e?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[B,0]},{command:"L",values:[B,U]},{command:"L",values:[0,U]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:c.fill[0];break}case f:{const a=Math.min(o(e.width),h||M),l=Math.min(o(e.height),h||M),{width:n,height:s}=S(t),c=n===s&&null!=n?n:null!=i?i:Math.max(a,l),m=e.width/e.height;B=m<=1?Math.ceil(c*m):c,U=m<=1?c:Math.ceil(c/m),p.shape={type:"image",x:-Math.round(B/2),y:-Math.round(U/2),width:B,height:U,src:e.url||""},r&&(E=!0);break}case x:{const a=e,l=t?.overrideText||a.text||v,n=a.font,{width:s,height:r}=S(t),c=null!=r?r:null!=i?i:Math.min(o(n.size),h||M),{width:m,height:u}=C(l,{weight:n.weight,size:c,family:n.family}),d=/[\uE600-\uE6FF]/.test(l);B=s??(d?c:m),U=d?c:u;let f=.5*(d?c:u);d&&(f+=5),p.shape={type:"text",text:l,x:a.xoffset||0,y:a.yoffset||f,align:"middle",alignBaseline:a.verticalAlignment,decoration:n&&n.decoration,rotated:a.rotated,kerning:a.kerning},p.font=n&&{size:c,style:n.style,decoration:n.decoration,weight:n.weight,family:n.family};break}}return{shapeDescriptor:p,size:[B,U],renderOptions:{node:t?.node,scale:j,opacity:t?.opacity,rotations:[r],useRotationSize:E,effectView:t?.effectView,ariaLabel:t?.ariaLabel}}}async function Z(e,t){const{shapeDescriptor:i,size:o,renderOptions:l}=D(e,t);if(!i.shape)throw new a("symbolPreview: renderPreviewHTML2D","symbol not supported.");await B(e,i),await U(e,i,o,t);const n=[[i]];if("object"==typeof t?.symbolConfig&&t?.symbolConfig?.applyColorModulation){const e=.6*o[0];n.unshift([{...i,offset:[-e,0],fill:m(i.fill,-.3)}]),n.push([{...i,offset:[e,0],fill:m(i.fill,.3)}]),o[0]+=2*e,l.scale=!1}return"text"===e.type&&E(e,i,n,o,l),u(n,o,l)}function A(a,i=L){const o=l(a),s=n(a),h=!o||"type"in o?null:new e(o),r=s?.color?new e(s?.color):null,c=h?F(t(h),i):null,m=r?F(t(r),i):null;return m?c?c===m?c:i>=L?"light":"dark":m:c}export{A as getContrastingBackgroundTheme,D as getRenderSymbolParameters,Z as previewSymbol2D};
5
+ import t from"../../Color.js";import{getColorLuminance as e}from"../../core/colorUtils.js";import i from"../../core/Error.js";import{loadFont as o}from"../../core/fontUtils.js";import{pt2px as n}from"../../core/screenUtils.js";import{quantizePolygon as a,quantizePolyline as l}from"../../geometry/support/quantizationUtils.js";import{getFill as s,getStroke as r,getDashArray as h,getPatternUrlWithColor as c}from"./gfxUtils.js";import{SymbolSizeDefaults as m,shapes as u,adjustColorBrightness as p}from"./previewUtils.js";import{renderSymbol as d}from"./renderUtils.js";import{backgroundPadding as g}from"./textUtils.js";const f="picture-fill",y="picture-marker",w="simple-fill",x="simple-line",b="simple-marker",v="text",M="Aa",S=m.size,z=m.maxSize,k=m.maxOutlineSize,L=m.lineWidth,C=225,$=document.createElement("canvas");function j(t,e,i){if("polygon"===t.type){const o=t.extent,n=0===o.width?1:o.width,l=0===o.height?1:o.height;t=a({originPosition:"upperLeft",scale:[n/e,l/i],translate:[o.xmin,o.ymax]},{},t);let s="";for(let e=0;e<t.rings.length;e++){const i=t.rings[e];for(let t=0;t<i.length;t++){const e=i[t][0],o=i[t][1];let n="";0===t?(n=`M${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n):t===i.length-1?(n=`l${e.toString()} ${o.toString()} Z`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}if("polyline"===t.type){const o=t.extent,n=0===o.width?1:o.width,a=0===o.height?1:o.height;t=l({originPosition:"lowerLeft",scale:[n/e,a/i],translate:[o.xmin,o.ymax]},{},t);let s="";for(let e=0;e<t.paths.length;e++){const i=t.paths[e];for(let t=0;t<i.length;t++){const e=i[t][0],o=i[t][1];let n="";0===t?(n=`M${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}return""}function B(t,e){const i=$.getContext("2d"),o=[];e&&(e.weight&&o.push(e.weight),e.size&&o.push(e.size+"px"),e.family&&o.push(e.family)),i.font=o.join(" ");const{width:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:l,actualBoundingBoxAscent:s,actualBoundingBoxDescent:r}=i.measureText(t);return{width:Math.ceil(Math.max(n,a+l)),height:Math.ceil(s+r),x:Math.floor(a),y:Math.floor((s-r)/2)}}function P(t){const e=t?.size;return{width:null!=e&&"object"==typeof e&&"width"in e?n(e.width):null,height:null!=e&&"object"==typeof e&&"height"in e?n(e.height):null}}async function U(t,e){const i=e.fill,o=t.color;if("pattern"===i?.type&&o&&t.type!==f){const t=await c(i.src,o.toCss(!0));i.src=t,e.fill=i}}async function A(t,e,i,n){if(!("font"in t)||!t.font||"text"!==e.shape.type)return;try{await o(t.font)}catch{}const{width:a,height:l}=P(n);if(!/[\uE600-\uE6FF]/.test(e.shape.text)){const{width:o,height:s,x:r,y:h}=B(e.shape.text,{weight:e.font?.weight,size:e.font?.size,family:e.font?.family});i[0]=a??o,i[1]=l??s,e.shape.x=r,e.shape.y=h;let c="angle"in t?t.angle:null;if(null!=n?.rotation&&(c=(c??0)+n.rotation),c){const t=c*(Math.PI/180),e=Math.abs(Math.sin(t)),o=Math.abs(Math.cos(t));i[1]=i[0]*e+i[1]*o}}}function E(t,e,i,o,a){if(null!=t.haloColor&&null!=t.haloSize){a.masking??=i.map((()=>[]));const l=n(t.haloSize);o[0]+=l,o[1]+=l,i.unshift([{...e,fill:null,stroke:{color:t.haloColor,width:2*l,join:"round",cap:"round"}}]),a.masking.unshift([{shape:{type:"rect",x:0,y:0,width:o[0]+2*g,height:o[1]+2*g},fill:[255,255,255],stroke:null},{...e,fill:[0,0,0,0],stroke:null}])}null==t.backgroundColor&&null==t.borderLineColor||(o[0]+=2*g,o[1]+=2*g,i.unshift([{shape:{type:"rect",x:0,y:0,width:o[0],height:o[1]},fill:t.backgroundColor,stroke:{color:t.borderLineColor,width:n(t.borderLineSize)}}]),a.masking?.unshift([]))}function F(t,e){return t>e?"dark":"light"}function Z(t,e){const i="number"==typeof e?.size?e?.size:null,o=null!=i?n(i):null,a=null!=e?.maxSize?n(e.maxSize):null;let l="angle"in t?t.angle:null;null!=e?.rotation&&(l=(l??0)+e.rotation);const c=s(t);let m=r(t);"dark"!==q(t,245)||e?.ignoreWhiteSymbols||(m={width:.75,...m,color:"#bdc3c7"});let p=null;const d={shape:null,fill:c,stroke:m,offset:[0,0]};m?.width&&(m.width=Math.min(m.width,k));const g=m?.width||0;let C=null!=e?.size&&(null==e?.scale||e?.scale),$=0,U=0,A=!1;switch(t.type){case b:{const i=t.style,{width:s,height:r}=P(e);let h=s===r&&null!=s?s:null!=o?o:Math.min(n(t.size),a||z);if(!0===e?.useMarkerSymbolSize&&null!==s&&null!==r){const e=Math.min(n(t.size),a||z);h=e>s&&e>r?Math.min(s,r):e}switch($=h,U=h,i){case"circle":d.shape={type:"circle",cx:0,cy:0,r:.5*h},C||($+=g,U+=g);break;case"cross":d.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[$,.5*U]},{command:"M",values:[.5*$,0]},{command:"L",values:[.5*$,U]}]};break;case"diamond":d.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[.5*$,0]},{command:"L",values:[$,.5*U]},{command:"L",values:[.5*$,U]},{command:"Z",values:[]}]},C||($+=g,U+=g);break;case"square":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,0]},{command:"L",values:[$,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},C||($+=g,U+=g),l&&(A=!0);break;case"triangle":d.shape={type:"path",path:[{command:"M",values:[.5*$,0]},{command:"L",values:[$,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},C||($+=g,U+=g),l&&(A=!0);break;case"x":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,U]},{command:"M",values:[$,0]},{command:"L",values:[0,U]}]},l&&(A=!0);break;case"path":d.shape={type:"path",path:t.path||""},C||($+=g,U+=g),l&&(A=!0),C=!0}break}case x:{const{width:t,height:i}=P(e),n=h(m).reduce(((t,e)=>t+e),0),a=n&&Math.ceil(L/n),l=i??o??g,s=t??(n*a||L);if(C=!0,"polyline"===e?.geometry?.type&&e?.geometry?.extent){$=s,U=i??$;const t=1e3,o=.15*t;p=[$,U],U=p[0]>p[1]?t*p[1]/p[0]:t,$=p[0]>p[1]?t:t*p[0]/p[1],m?.width&&(m.width=m.width*t/(p[1]>p[0]?p[1]:p[0]),m.width>o&&(m.width=o)),d.shape={type:"path",path:j(e.geometry,$,U)}}else $=null!=e?.maxSize?Math.min(s,e.maxSize):s,U=l,m&&(m.width=l),d.shape={type:"path",path:[{command:"M",values:[l/2,U/2]},{command:"L",values:[$-l/2,U/2]}]};break}case f:case w:{const t="object"==typeof e?.symbolConfig&&!!e?.symbolConfig?.isSquareFill,{width:i,height:n}=P(e);$=!t&&i!==n||null==i?null!=o?o:S:i,U=!t&&i!==n||null==n?$:n,C||($+=g,U+=g),C=!0,e?.geometry&&e?.geometry?.extent&&"polygon"===e?.geometry?.type?(p=[$,U],U=p[0]>p[1]?1e3*p[1]/p[0]:1e3,$=p[0]>p[1]?1e3:1e3*p[0]/p[1],d.shape={type:"path",path:j(e.geometry,$,U)}):d.shape=t?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,0]},{command:"L",values:[$,U]},{command:"L",values:[0,U]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:u.fill[0];break}case y:{const i=Math.min(n(t.width),a||z),s=Math.min(n(t.height),a||z),{width:r,height:h}=P(e),c=r===h&&null!=r?r:null!=o?o:Math.max(i,s),m=t.width/t.height;$=m<=1?Math.ceil(c*m):c,U=m<=1?c:Math.ceil(c/m),d.shape={type:"image",x:-Math.round($/2),y:-Math.round(U/2),width:$,height:U,src:t.url||""},l&&(A=!0);break}case v:{const i=t,l=e?.overrideText||i.text||M,s=i.font,{width:r,height:h}=P(e),c=null!=h?h:null!=o?o:Math.min(n(s.size),a||z),{width:m,height:u}=B(l,{weight:s.weight,size:c,family:s.family}),p=/[\uE600-\uE6FF]/.test(l);$=r??(p?c:m),U=p?c:u;let g=.5*(p?c:u);p&&(g+=5),d.shape={type:"text",text:l,x:i.xoffset||0,y:i.yoffset||g,align:"middle",alignBaseline:i.verticalAlignment,decoration:s&&s.decoration,rotated:i.rotated,kerning:i.kerning},d.font=s&&{size:c,style:s.style,decoration:s.decoration,weight:s.weight,family:s.family};break}}return{shapeDescriptor:d,size:[$,U],outputSize:p,renderOptions:{node:e?.node,scale:C,opacity:e?.opacity,rotations:[l],useRotationSize:A,effectView:e?.effectView,ariaLabel:e?.ariaLabel}}}async function D(t,e){const{shapeDescriptor:o,size:n,renderOptions:a,outputSize:l}=Z(t,e);if(!o.shape)throw new i("symbolPreview: renderPreviewHTML2D","symbol not supported.");await U(t,o),await A(t,o,n,e);const s=[[o]];if("object"==typeof e?.symbolConfig&&e?.symbolConfig?.applyColorModulation){const t=.6*n[0];s.unshift([{...o,offset:[-t,0],fill:p(o.fill,-.3)}]),s.push([{...o,offset:[t,0],fill:p(o.fill,.3)}]),n[0]+=2*t,a.scale=!1}"text"===t.type&&E(t,o,s,n,a);const r=d(s,n,a);if(l&&r){const t="img"===r.nodeName.toLowerCase()?r:r.firstChild;"svg"===t.nodeName.toLowerCase()&&t.setAttribute("viewBox",`0 0 ${n[0].toString()} ${n[1].toString()}`),t.setAttribute("width",l[0].toString()),t.setAttribute("height",l[1].toString()),l.length>2&&(t.style.setProperty("padding-left",l[2]?.toString()+"px"),t.style.setProperty("padding-right",l[2]?.toString()+"px"),t.style.setProperty("padding-top",l[3]?.toString()+"px"),t.style.setProperty("padding-bottom",l[3]?.toString()+"px"),t.style.setProperty("box-sizing","border-box"))}return r}function q(i,o=C){const n=s(i),a=r(i),l=!n||"type"in n?null:new t(n),h=a?.color?new t(a?.color):null,c=l?F(e(l),o):null,m=h?F(e(h),o):null;return m?c?c===m?c:o>=C?"light":"dark":m:c}export{q as getContrastingBackgroundTheme,Z as getRenderSymbolParameters,D as previewSymbol2D};
@@ -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"../../core/has.js";import{loadArcade as e}from"../../support/arcadeOnDemand.js";import{getStroke as t}from"./gfxUtils.js";import{SymbolSizeDefaults as l}from"./previewUtils.js";import{renderSymbol as a,renderOnce as i}from"./renderUtils.js";import{getCSSFilterFromEffectList as s,applyColorToSymbol as r,applySizesToSymbol as n,applyRotationToSymbol as o,getColorFromSymbol as c,applyOpacityToColor as u}from"./utils.js";import{defaultAcceptedFormats as f}from"./webStyleAcceptedFormats.js";import{renderRelationshipRamp as p}from"../../widgets/Legend/styles/support/relationshipUtils.js";import{getRelationshipRampElement as h}from"../../widgets/Legend/support/relationshipRampUtils.js";let y=null;const d=[255,255,255];function m(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function b(e,t,a){const{backgroundColor:i,outline:s,dotSize:r}=e,n=a?.swatchSize||l.size,o=.8,c=Math.round(n*n/Math.max(r,.5)**2*o),u=window.devicePixelRatio,f=document.createElement("canvas"),p=n*u;f.width=p,f.height=p,f.style.width=f.width/u+"px",f.style.height=f.height/u+"px";const h=f.getContext("2d");if(i&&(h.fillStyle=i.toCss(!0),h.fillRect(0,0,p,p),h.fill()),h.fillStyle=t?.toCss(!0)??"",y&&y.length/2===c)for(let l=0;l<2*c;l+=2){const e=y[l],t=y[l+1];h.fillRect(e,t,r*u,r*u),h.fill()}else{y=[];for(let e=0;e<2*c;e+=2){const e=m(0,p),t=m(0,p);y.push(e,t),h.fillRect(e,t,r*u,r*u),h.fill()}}s&&(s.color&&(h.strokeStyle=s.color.toCss(!0)),h.lineWidth=s.width,h.strokeRect(0,0,p,p));const d=new Image(n,n);return d.src=f.toDataURL(),d.ariaLabel=a?.ariaLabel??null,d.alt=a?.ariaLabel??"",d}function g(e,l={}){const i=l.radius||40,s=2*Math.PI*i,r=e.length,n=s/r,o=[],c=t(l.outline);null!=c?.width&&(c.width*=2),(c||l.backgroundColor)&&o.push({shape:{type:"circle",cx:i,cy:i,r:i},fill:l.backgroundColor,stroke:c,offset:[0,0]});const u=l.values,f=u&&u.length===r&&100===u.reduce(((e,t)=>e+t),0),p=[0];for(let t=0;t<r;t++){let l=null;f&&(l=u[t]*s/100,p.push(l+p[t])),o.push({shape:{type:"circle",cx:i,cy:i,r:i/2},fill:[0,0,0,0],stroke:{width:i,dashArray:`${(l??n)/2} ${s}`,dashoffset:"-"+(f?p[t]/2:t*(n/2)),color:e[t]},offset:[0,0]})}let h=null;const y=2*i+(c?.width||0),m=l.holePercentage;if(m){c&&o.push({shape:{type:"circle",cx:i,cy:i,r:i*m},fill:null,stroke:c,offset:[0,0]});const e=y/2;h=[[{shape:{type:"circle",cx:e,cy:e,r:e},fill:d,stroke:c?{...c,color:d}:null,offset:[0,0]},{shape:{type:"circle",cx:e,cy:e,r:i*m},fill:[0,0,0],stroke:null,offset:[0,0]}]]}return a([o],[y,y],{effectView:l.effectList,ignoreStrokeWidth:!0,masking:h,rotations:[-90],ariaLabel:l.ariaLabel})}function w(e,t={}){const l=e?.authoringInfo;if(!("relationship"===l?.type)||!l?.numClasses||!e.uniqueValueInfos)return null;const{focus:a,numClasses:s}=l,r=h({focus:a,numClasses:s,infos:e.uniqueValueInfos}),n=t?.node||document.createElement("div");return i(n,(()=>p(r,t.id||"relationship",{opacity:t.opacity||1,effectList:t.effectList,ariaLabel:t.ariaLabel}))),n}function v(e,t={}){const l=24,a=75,i="horizontal"===t.align,s=i?a:l,r=i?l:a,n=t.width??s,o=t.height??r,c=t.gradient??!0,u=window.devicePixelRatio,f=n*u,p=o*u,h=document.createElement("canvas");h.width=f,h.height=p,h.ariaLabel=t.ariaLabel??null,h.style.width=`${n}px`,h.style.height=`${o}px`;const y=h.getContext("2d"),d=i?f:0,m=i?0:p;if(c){const t=y.createLinearGradient(0,0,d,m),l=e.length,a=1===l?0:1/(l-1);e.forEach(((e,l)=>t.addColorStop(l*a,e.toString()))),y.fillStyle=t,y.fillRect(0,0,f,p)}else{const t=i?f/e.length:f,l=i?p:p/e.length;let a=0,s=0;for(const r of e)y.fillStyle=r.toString(),y.fillRect(a,s,t,l),a=i?a+t:0,s=i?0:s+l}const b=document.createElement("div");return b.style.width=`${n}px`,b.style.height=`${o}px`,S(b,t?.effectList),b.appendChild(h),b}function S(e,t){if(!t)return;e.style.filter=s(t);const l=t.effects;if(l)for(const a of l)if("drop-shadow"===a?.type){a.offsetX<0?e.style.marginLeft=`${Math.abs(a.offsetX)}px`:e.style.marginRight=`${a.offsetX}px`;break}}async function V(e,t){switch(e.type){case"web-style":{const{previewWebStyleSymbol:l}=await import("./previewWebStyleSymbol.js");return l(e,V,t)}case"label-3d":case"line-3d":case"mesh-3d":case"point-3d":case"polygon-3d":{const{previewSymbol3D:l}=await import("./previewSymbol3D.js");return l(e,t)}case"simple-marker":case"simple-line":case"simple-fill":case"picture-marker":case"picture-fill":case"text":{const{previewSymbol2D:l}=await import("./previewSymbol2D.js");return l(e,t)}case"cim":{const{previewCIMSymbol:l}=await import("./previewCIMSymbol.js");return l(e,t)}default:return}}function k(e){return e&&"opacity"in e?e.opacity*k(e.parent):1}async function L(t,l){if(!t)return;const a=t.sourceLayer,i=(null!=l&&l.useSourceLayer?a:t.layer)??a,s=k(i);if(null!=t.symbol&&(null==l||!0!==l.ignoreGraphicSymbol)){const e="web-style"===t.symbol.type?await t.symbol.fetchSymbol({...l,acceptedFormats:["web","cim"],cache:null!=l?l.webStyleCache:null}):t.symbol.clone();return r(e,null,s),e}const c=l?.renderer??C(i);let u=c&&"getSymbolAsync"in c?await c.getSymbolAsync(t,l):null;if(!u)return;if(u="web-style"===u.type?await u.fetchSymbol({...l,cache:null!=l?l.webStyleCache:null}):u.clone(),!c||!("visualVariables"in c)||!c.visualVariables?.length)return r(u,null,s),u;if("arcadeRequiredForVisualVariables"in c&&c.arcadeRequiredForVisualVariables&&null==l?.arcade){const t={...l};t.arcade=await e(),l=t}const{getColor:f,getOpacity:p,getAllSizes:h,getRotationAngle:y}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),d=[],m=[],b=[],g=[];for(const e of c.visualVariables)switch(e.type){case"color":d.push(e);break;case"opacity":m.push(e);break;case"rotation":g.push(e);break;case"size":e.target||b.push(e)}const w=!!d.length&&d[d.length-1],v=w?f(w,t,l):null,S=!!m.length&&m[m.length-1];let V=S?p(S,t,l):null;if(null!=s&&(V=null!=V?V*s:s),r(u,v,V),b.length){const e=h(b,t,l);await n(u,e)}for(const e of g)o(u,y(e,t,l),e.axis);return u}async function x(t,l){if(!t)return;const{layer:a,sourceLayer:i}=t,s=k(a??i);if(null!=t.symbol&&(null==l||!0!==l.ignoreGraphicSymbol)){const e="web-style"===t.symbol.type?await t.symbol.fetchSymbol({...l,acceptedFormats:f}):t.symbol.clone();return c(e,s)}const r=l?.renderer??C(a)??C(i);let n=r&&"getSymbolAsync"in r?await r.getSymbolAsync(t,l):void 0;if(!n)return;n="web-style"===n.type?await n.fetchSymbol({...l,acceptedFormats:f}):n.clone();const o=c(n,s);if(!r||!("visualVariables"in r)||"visualVariables"in r&&!r.visualVariables||"visualVariables"in r&&!r.visualVariables?.length)return o;if("arcadeRequiredForVisualVariables"in r&&r.arcadeRequiredForVisualVariables&&null==l?.arcade){const t={...l};t.arcade=await e(),l=t}const{getColor:p,getOpacity:h}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),y=[],d=[];if(r.visualVariables)for(const e of r.visualVariables)switch(e.type){case"color":y.push(e);break;case"opacity":d.push(e)}const m=y.length>0?y[y.length-1]:null,b=m?p(m,t,l):o,g=d.length>0?d[d.length-1]:null;let w=g?h(g,t,l):null;return null!=s&&(w=null!=w?w*s:s),b?u(b,w):null}function C(e){if(e)return"renderer"in e?e.renderer:void 0}async function R(e,t,l){if(!e)return;const{layer:a,sourceLayer:i}=e,s=l?.renderer??C(a)??C(i);if(!s)return null;if("visualVariables"in s&&s.visualVariables?.length){const{getRampStops:i}=await import("../../widgets/Legend/support/colorRampUtils.js"),{getRampStops:r}=await import("../../widgets/Legend/support/sizeRampUtils.js"),{getDateFormatOptions:n}=await import("../../widgets/Legend/support/utils.js");let o=null;for(const c of s.visualVariables){const u=t?n(a,c,t.timeZone):null;let f=null;switch(c.type){case"color":f=await i(c,null,u);break;case"opacity":f=await i(c);break;case"size":c.target||(f=await r(s,c,null,l?.scale||t?.scale,t,u))}if(f?.length){const t=f.find(((t,l)=>{const a=e.attributes[c.field];return 0===l?a>=t.value:l===f?.length-1?a<=t.value:t.value===a}));if(t){o=t.label;break}}}if(o)return o}switch(s.type){case"class-breaks":{const t="getClassBreakInfo"in s?await s.getClassBreakInfo(e,l):null;return t?.label??(t&&s.classBreakInfos?.length>1)?`${t.minValue} - ${t.maxValue}`:null}case"unique-value":{const t="getUniqueValueInfo"in s?await s.getUniqueValueInfo(e,l):null;return t?.label}}return null}export{x as getDisplayedColor,L as getDisplayedSymbol,R as getLegendLabel,v as renderColorRampPreviewHTML,b as renderDotDensityPreviewHTML,g as renderPieChartPreviewHTML,V as renderPreviewHTML,w as renderRelationshipRampPreviewHTML};
5
+ import"../../core/has.js";import{px2pt as e}from"../../core/screenUtils.js";import{isSubtypeGroupLayer as t}from"../../layers/support/layerUtils.js";import{loadArcade as l}from"../../support/arcadeOnDemand.js";import{getStroke as a}from"./gfxUtils.js";import{SymbolSizeDefaults as i}from"./previewUtils.js";import{renderSymbol as r,renderOnce as s}from"./renderUtils.js";import{getCSSFilterFromEffectList as n,applyColorToSymbol as o,applySizesToSymbol as c,applyRotationToSymbol as u,getColorFromSymbol as f,applyOpacityToColor as p}from"./utils.js";import{defaultAcceptedFormats as y}from"./webStyleAcceptedFormats.js";import{renderRelationshipRamp as h}from"../../widgets/Legend/styles/support/relationshipUtils.js";import{getRelationshipRampElement as m}from"../../widgets/Legend/support/relationshipRampUtils.js";let b=null;const d=[255,255,255];function g(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function w(e,t,l){const{backgroundColor:a,outline:r,dotSize:s}=e,n=l?.swatchSize||i.size,o=.8,c=Math.round(n*n/Math.max(s,.5)**2*o),u=window.devicePixelRatio,f=document.createElement("canvas"),p=n*u;f.width=p,f.height=p,f.style.width=f.width/u+"px",f.style.height=f.height/u+"px";const y=f.getContext("2d");if(a&&(y.fillStyle=a.toCss(!0),y.fillRect(0,0,p,p),y.fill()),y.fillStyle=t?.toCss(!0)??"",b&&b.length/2===c)for(let i=0;i<2*c;i+=2){const e=b[i],t=b[i+1];y.fillRect(e,t,s*u,s*u),y.fill()}else{b=[];for(let e=0;e<2*c;e+=2){const e=g(0,p),t=g(0,p);b.push(e,t),y.fillRect(e,t,s*u,s*u),y.fill()}}r&&(r.color&&(y.strokeStyle=r.color.toCss(!0)),y.lineWidth=r.width,y.strokeRect(0,0,p,p));const h=new Image(n,n);return h.src=f.toDataURL(),h.ariaLabel=l?.ariaLabel??null,h.alt=l?.ariaLabel??"",h}function S(e,t={}){const l=t.radius||40,i=2*Math.PI*l,s=e.length,n=i/s,o=[],c=a(t.outline);null!=c?.width&&(c.width*=2),(c||t.backgroundColor)&&o.push({shape:{type:"circle",cx:l,cy:l,r:l},fill:t.backgroundColor,stroke:c,offset:[0,0]});const u=t.values,f=u&&u.length===s&&100===u.reduce(((e,t)=>e+t),0),p=[0];for(let a=0;a<s;a++){let t=null;f&&(t=u[a]*i/100,p.push(t+p[a])),o.push({shape:{type:"circle",cx:l,cy:l,r:l/2},fill:[0,0,0,0],stroke:{width:l,dashArray:`${(t??n)/2} ${i}`,dashoffset:"-"+(f?p[a]/2:a*(n/2)),color:e[a]},offset:[0,0]})}let y=null;const h=2*l+(c?.width||0),m=t.holePercentage;if(m){c&&o.push({shape:{type:"circle",cx:l,cy:l,r:l*m},fill:null,stroke:c,offset:[0,0]});const e=h/2;y=[[{shape:{type:"circle",cx:e,cy:e,r:e},fill:d,stroke:c?{...c,color:d}:null,offset:[0,0]},{shape:{type:"circle",cx:e,cy:e,r:l*m},fill:[0,0,0],stroke:null,offset:[0,0]}]]}return r([o],[h,h],{effectView:t.effectList,ignoreStrokeWidth:!0,masking:y,rotations:[-90],ariaLabel:t.ariaLabel})}function v(e,t={}){const l=e?.authoringInfo;if(!("relationship"===l?.type)||!l?.numClasses||!e.uniqueValueInfos)return null;const{focus:a,numClasses:i}=l,r=m({focus:a,numClasses:i,infos:e.uniqueValueInfos}),n=t?.node||document.createElement("div");return s(n,(()=>h(r,t.id||"relationship",{opacity:t.opacity||1,effectList:t.effectList,ariaLabel:t.ariaLabel}))),n}function V(e,t={}){const l=24,a=75,i="horizontal"===t.align,r=i?a:l,s=i?l:a,n=t.width??r,o=t.height??s,c=t.gradient??!0,u=window.devicePixelRatio,f=n*u,p=o*u,y=document.createElement("canvas");y.width=f,y.height=p,y.ariaLabel=t.ariaLabel??null,y.style.width=`${n}px`,y.style.height=`${o}px`;const h=y.getContext("2d"),m=i?f:0,b=i?0:p;if(c){const t=h.createLinearGradient(0,0,m,b),l=e.length,a=1===l?0:1/(l-1);e.forEach(((e,l)=>t.addColorStop(l*a,e.toString()))),h.fillStyle=t,h.fillRect(0,0,f,p)}else{const t=i?f/e.length:f,l=i?p:p/e.length;let a=0,r=0;for(const s of e)h.fillStyle=s.toString(),h.fillRect(a,r,t,l),a=i?a+t:0,r=i?0:r+l}const d=document.createElement("div");return d.style.width=`${n}px`,d.style.height=`${o}px`,k(d,t?.effectList),d.appendChild(y),d}function k(e,t){if(!t)return;e.style.filter=n(t);const l=t.effects;if(l)for(const a of l)if("drop-shadow"===a?.type){a.offsetX<0?e.style.marginLeft=`${Math.abs(a.offsetX)}px`:e.style.marginRight=`${a.offsetX}px`;break}}async function L(e,t){switch(e.type){case"web-style":{const{previewWebStyleSymbol:l}=await import("./previewWebStyleSymbol.js");return l(e,L,t)}case"label-3d":case"line-3d":case"mesh-3d":case"point-3d":case"polygon-3d":{const{previewSymbol3D:l}=await import("./previewSymbol3D.js");return l(e,t)}case"simple-marker":case"simple-line":case"simple-fill":case"picture-marker":case"picture-fill":case"text":{const{previewSymbol2D:l}=await import("./previewSymbol2D.js");return l(e,t)}case"cim":{const{previewCIMSymbol:l}=await import("./previewCIMSymbol.js");return l(e,t)}default:return}}function x(e){return e&&"opacity"in e?e.opacity*x(e.parent):1}async function R(e,t){if(!e)return;const a=e.sourceLayer,i=(null!=t&&t.useSourceLayer?a:e.layer)??a,r=t?.ignoreOpacity?1:x(i);if(null!=e.symbol&&(null==t||!0!==t.ignoreGraphicSymbol)){const l="web-style"===e.symbol.type?await e.symbol.fetchSymbol({...t,acceptedFormats:["web","cim"],cache:null!=t?t.webStyleCache:null}):e.symbol.clone();return o(l,null,r),l}const s=t?.renderer??j(i);let n=s&&"getSymbolAsync"in s?await s.getSymbolAsync(e,t):null;if(!n)return;if(n="web-style"===n.type?await n.fetchSymbol({...t,cache:null!=t?t.webStyleCache:null}):n.clone(),!s||!("visualVariables"in s)||!s.visualVariables?.length)return o(n,null,r),n;if("arcadeRequiredForVisualVariables"in s&&s.arcadeRequiredForVisualVariables&&null==t?.arcade){const e={...t};e.arcade=await l(),t=e}const{getColor:f,getOpacity:p,getAllSizes:y,getRotationAngle:h}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),m=[],b=[],d=[],g=[];for(const l of s.visualVariables)switch(l.type){case"color":m.push(l);break;case"opacity":b.push(l);break;case"rotation":g.push(l);break;case"size":l.target||d.push(l)}const w=!!m.length&&m[m.length-1],S=w?f(w,e,t):null,v=!!b.length&&b[b.length-1];let V=v?p(v,e,t):null;if(null!=r&&(V=null!=V?V*r:r),t?.ignoreOpacity&&(V=1),o(n,S,V),d.length&&!0!==t?.ignoreSizeVariables){const l=y(d,e,t);await c(n,l)}if(!0!==t?.ignoreRotationVariables)for(const l of g)u(n,h(l,e,t),l.axis);return n}async function C(e,t){if(!e)return;const{layer:a,sourceLayer:i}=e,r=x(a??i);if(null!=e.symbol&&(null==t||!0!==t.ignoreGraphicSymbol)){const l="web-style"===e.symbol.type?await e.symbol.fetchSymbol({...t,acceptedFormats:y}):e.symbol.clone();return f(l,r)}const s=t?.renderer??j(a)??j(i);let n=s&&"getSymbolAsync"in s?await s.getSymbolAsync(e,t):void 0;if(!n)return;n="web-style"===n.type?await n.fetchSymbol({...t,acceptedFormats:y}):n.clone();const o=f(n,r);if(!s||!("visualVariables"in s)||"visualVariables"in s&&!s.visualVariables||"visualVariables"in s&&!s.visualVariables?.length)return o;if("arcadeRequiredForVisualVariables"in s&&s.arcadeRequiredForVisualVariables&&null==t?.arcade){const e={...t};e.arcade=await l(),t=e}const{getColor:c,getOpacity:u}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),h=[],m=[];if(s.visualVariables)for(const l of s.visualVariables)switch(l.type){case"color":h.push(l);break;case"opacity":m.push(l)}const b=h.length>0?h[h.length-1]:null,d=b?c(b,e,t):o,g=m.length>0?m[m.length-1]:null;let w=g?u(g,e,t):null;return null!=r&&(w=null!=w?w*r:r),d?p(d,w):null}function j(e){if(e)return"renderer"in e?e.renderer:void 0}async function z(e,t,l){if(!e)return;const{layer:a,sourceLayer:i}=e,r=l?.renderer??j(a)??j(i);if(!r)return null;if("visualVariables"in r&&r.visualVariables?.length){const{getRampStops:i}=await import("../../widgets/Legend/support/colorRampUtils.js"),{getRampStops:s}=await import("../../widgets/Legend/support/sizeRampUtils.js"),{getDateFormatOptions:n}=await import("../../widgets/Legend/support/utils.js");let o=null;for(const c of r.visualVariables){const u=t?n(a,c,t.timeZone):null;let f=null;switch(c.type){case"color":f=await i(c,null,u);break;case"opacity":f=await i(c);break;case"size":c.target||(f=await s(r,c,null,l?.scale||t?.scale,t,u))}if(f?.length){const t=f.find(((t,l)=>{const a=e.attributes[c.field];return 0===l?a>=t.value:l===f?.length-1?a<=t.value:t.value===a}));if(t){o=t.label;break}}}if(o)return o}switch(r.type){case"class-breaks":{const t="getClassBreakInfo"in r?await r.getClassBreakInfo(e,l):null;return t?.label??(t&&r.classBreakInfos?.length>1)?`${t.minValue} - ${t.maxValue}`:null}case"unique-value":{const t="getUniqueValueInfo"in r?await r.getUniqueValueInfo(e,l):null;return t?.label}}return null}async function I(l,a){l?.layer&&t(l.layer)&&((l=l.cloneShallow()).layer=l.layer.findSublayerForFeature(l)??null);const i=null===l?a?.fallbackSymbol??null:await R(l,{ignoreGraphicSymbol:!!l.layer,ignoreOpacity:a?.ignoreOpacity??!0,ignoreRotationVariables:a?.ignoreRotationVariables??!0,ignoreSizeVariables:a?.ignoreSizeVariables??!0})??a?.fallbackSymbol??null;if(!i)return null;const r=await L(i,{geometry:a.useGeometryForShape?l?.geometry??null:null,useMarkerSymbolSize:!1!==a.useMarkerSymbolSize,size:{width:e(a.widthInPixels??16),height:e(a.heightInPixels??16)},..."cim"===i?.type?{cimOptions:{feature:{attributes:l?.attributes??{}}}}:{}});if(!r)return null;return"element"===(a?.format??"element")?r:r.outerHTML}export{C as getDisplayedColor,R as getDisplayedSymbol,z as getLegendLabel,I as previewGraphic,V as renderColorRampPreviewHTML,w as renderDotDensityPreviewHTML,S as renderPieChartPreviewHTML,L as renderPreviewHTML,v as renderRelationshipRampPreviewHTML};
@@ -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 t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{AttributeDataType as i,filterFlagsUnit as s,animationUnit as r,gpgpuUnit as a,localTimeOriginUnit as n,visualVariableUnit as u,dataDrivenUnit0 as h,dataDrivenUnit1 as o,dataDrivenUnit2 as l}from"./definitions.js";import{getDisplayIdTexel as d}from"./DisplayId.js";import{getPixelArrayCtor as g,getPixelBytes as _}from"./Utils.js";import{TextureWrapMode as p,TextureSamplingMode as c}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const T=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class m{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=g(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b;return t.wrapMode=p.CLAMP_TO_EDGE,t.samplingMode=c.NEAREST,t.dataType=this.pixelType,t.width=this.size,t.height=this.size,t}setData(t,e,i){const s=d(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=d(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new x(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,l=h,d=this.size,_=o,p=h*this.size*u,c=(d+_*this.size)*u-p,x=g(this.pixelType),f=new x(a,p*x.BYTES_PER_ELEMENT,c),b=this.size,m=_-l+1;if(m>this.size)return void T().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,l,b,m,f)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=g(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new f(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=_(r),h=new(g(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.getBoundFramebufferObject(),{x:l,y:d,width:p,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(l,d,p,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class y{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._locked=!1}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map(((t,e)=>null!=t?new m(t,this.size,e):null));else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new m(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,i.FilterFlags,1,e)}setLocalTimeOrigin(t,e){this.setData(t,i.LocalTimeOrigin,0,e)}getLabelMinZoom(t){return this.getData(t,i.FilterFlags,1,255)}getFilterFlags(t){return this.getData(t,i.FilterFlags,0,0)}getVisualVariableData(t,e){return this.getData(t,i.VV,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}update(){if(this._locked)return;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];for(const e of t){const{blockData:t,initArgs:i,sendUpdateEpoch:s,version:r}=e;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=i&&this._initialize(i);const a=this._data;for(let e=0;e<t.length;e++){const i=t[e],s=a[e];null!=s&&null!=i&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${e}] AttributeStoreView.update`,{block:i}),s.update(i))}}}getUniforms(t){return{filterFlags:{texture:this._getTexture(t,i.FilterFlags),unit:s},animation:{texture:this._getTexture(t,i.Animation),unit:r},gpgpu:{texture:this._getTexture(t,i.GPGPU),unit:a},localTimeOrigin:{texture:this._getTexture(t,i.LocalTimeOrigin),unit:n},visualVariableData:{texture:this._getTexture(t,i.VV),unit:u},dataDriven0:{texture:this._getTexture(t,i.DD0),unit:h},dataDriven1:{texture:this._getTexture(t,i.DD1),unit:o},dataDriven2:{texture:this._getTexture(t,i.DD2),unit:l},size:this.size}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new b;e.wrapMode=p.CLAMP_TO_EDGE,e.samplingMode=c.NEAREST,e.width=1,e.height=1,this._defaultTexture=new f(t,e,new Uint8Array(4))}return this._defaultTexture}}export{y as AttributeStoreView};
5
+ import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{AttributeDataType as i,filterFlagsUnit as s,animationUnit as r,gpgpuUnit as a,localTimeOriginUnit as n,visualVariableUnit as u,dataDrivenUnit0 as h,dataDrivenUnit1 as o,dataDrivenUnit2 as l}from"./definitions.js";import{getDisplayIdTexel as d}from"./DisplayId.js";import{getPixelArrayCtor as g,getPixelBytes as _}from"./Utils.js";import{TextureWrapMode as p,TextureSamplingMode as c}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const T=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class m{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=g(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b;return t.wrapMode=p.CLAMP_TO_EDGE,t.samplingMode=c.NEAREST,t.dataType=this.pixelType,t.width=this.size,t.height=this.size,t}setData(t,e,i){const s=d(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=d(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new x(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,l=h,d=this.size,_=o,p=h*this.size*u,c=(d+_*this.size)*u-p,x=g(this.pixelType),f=new x(a,p*x.BYTES_PER_ELEMENT,c),b=this.size,m=_-l+1;if(m>this.size)return void T().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,l,b,m,f)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=g(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new f(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=_(r),h=new(g(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.getBoundFramebufferObject(),{x:l,y:d,width:p,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(l,d,p,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class y{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._locked=!1}get locked(){return this._locked}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map(((t,e)=>null!=t?new m(t,this.size,e):null));else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new m(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,i.FilterFlags,1,e)}setLocalTimeOrigin(t,e){this.setData(t,i.LocalTimeOrigin,0,e)}getLabelMinZoom(t){return this.getData(t,i.FilterFlags,1,255)}getFilterFlags(t){return this.getData(t,i.FilterFlags,0,0)}getVisualVariableData(t,e){return this.getData(t,i.VV,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}update(){if(this._locked)return;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];for(const e of t){const{blockData:t,initArgs:i,sendUpdateEpoch:s,version:r}=e;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=i&&this._initialize(i);const a=this._data;for(let e=0;e<t.length;e++){const i=t[e],s=a[e];null!=s&&null!=i&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${e}] AttributeStoreView.update`,{block:i}),s.update(i))}}}getUniforms(t){return{filterFlags:{texture:this._getTexture(t,i.FilterFlags),unit:s},animation:{texture:this._getTexture(t,i.Animation),unit:r},gpgpu:{texture:this._getTexture(t,i.GPGPU),unit:a},localTimeOrigin:{texture:this._getTexture(t,i.LocalTimeOrigin),unit:n},visualVariableData:{texture:this._getTexture(t,i.VV),unit:u},dataDriven0:{texture:this._getTexture(t,i.DD0),unit:h},dataDriven1:{texture:this._getTexture(t,i.DD1),unit:o},dataDriven2:{texture:this._getTexture(t,i.DD2),unit:l},size:this.size}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new b;e.wrapMode=p.CLAMP_TO_EDGE,e.samplingMode=c.NEAREST,e.width=1,e.height=1,this._defaultTexture=new f(t,e,new Uint8Array(4))}return this._defaultTexture}}export{y as AttributeStoreView};
@@ -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 f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlOr as _,sqlIn as v,sqlAnd as b}from"../../../core/sql.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import{subclass as A}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import j from"../../../geometry/Extent.js";import U from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as I}from"../../../layers/graphics/featureConversionUtils.js";import x from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as E}from"../../../layers/support/featureLayerUtils.js";import{packFields as k}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as V}from"../../../layers/support/timeSupport.js";import q from"../../../rest/support/AggregateFeatureSet.js";import R from"../../../rest/support/AttributeBinsFeatureSet.js";import Q from"../../../rest/support/AttributeBinsQuery.js";import O from"../../../rest/support/FeatureSet.js";import L from"../../../rest/support/Query.js";import{LayerView2DMixin as T}from"./LayerView2D.js";import{FeatureContainer as W}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as D}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as P}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as H}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as M}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as N}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as J}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as G}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as $}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as B}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as z}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as Z}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as K}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import X from"./support/FeatureCommandQueue.js";import{handleNoEngineError as Y}from"./support/handleNoEngineError.js";import{toJSONGeometryType as ee}from"./support/util.js";import{FeatureTileSubscriptionManager as te}from"../tiling/FeatureTileSubscriptionManager.js";import re from"../../layers/FeatureLayerView.js";import ie from"../../layers/LayerView.js";import se from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as ae}from"../../support/HighlightDefaults.js";function oe(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 ne=4294967294;function ue(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 le=class extends(re(se(T(ie)))){constructor(){super(...arguments),this._commandsQueue=new X({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 P,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new S,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new U}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===C(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 D(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 effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?_(e,v(this.layer.objectIdField,this.highlightIds)):e}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 N(this.layer):new M(this.layer);case"geojson":case"csv":case"wfs":return new N(this.layer);case"parquet":return new B(this.layer);case"subtype-group":return new Z(this.layer);case"ogc-feature":return new G(this.layer);case"stream":return new z(this.layer);case"oriented-imagery":return new $(this.layer);case"knowledge-graph-sublayer":return new J(this.layer);case"catalog-footprint":return new H(this.layer);default:o(this.layer)}return null}get timeExtent(){return V(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??ae;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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=O.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 Y(r,{features:[]}),s=O.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 Y(r,{features:[]}),s=q.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 Y(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return Y(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return Y(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return Y(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return Y(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return Y(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await Y(r,{count:0,extent:null});return{count:i.count,extent:j.fromJSON(i.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),i=await Y(r,{features:[]});return R.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 W(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new te({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([ue([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],(()=>this._update())),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 K(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=L.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=L.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)%ne+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ne+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=ee(this.layer.geometryType),s=this.layer.objectIdField,a=[];for(const o of e.added){const e=I(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=I(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(),E(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=oe(this._lastAvailableFields,e);return this._lastAvailableFields=t,k(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[he(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e}}_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 he(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 x,s.timeExtent=n),s=t.addFilters?.(s,e)??s,a&&(s??=new x,s.where=b(s.where,a));let u=s?.toJSON()??null;return i.size&&(u??=(new x).toJSON(),u.hiddenIds=Array.from(i)),u}e([F()],le.prototype,"_commandsQueue",void 0),e([F()],le.prototype,"_sourceRefreshVersion",void 0),e([F()],le.prototype,"_displayRefreshVersion",void 0),e([F({readOnly:!0})],le.prototype,"_pipelineUpdating",void 0),e([F()],le.prototype,"_sourceUpdating",void 0),e([F({readOnly:!0})],le.prototype,"dataUpdating",null),e([F({readOnly:!0})],le.prototype,"effectiveDisplayFilterClause",null),e([F({readOnly:!0})],le.prototype,"hasAllFeatures",null),e([F({readOnly:!0})],le.prototype,"hasAllFeaturesInView",null),e([F({readOnly:!0})],le.prototype,"hasFullGeometries",null),e([F()],le.prototype,"featureEffectView",void 0),e([F()],le.prototype,"labelingCollisionInfos",null),e([F()],le.prototype,"layerAdapter",null),e([F({readOnly:!0})],le.prototype,"timeExtent",null),e([F()],le.prototype,"updating",void 0),le=e([A("esri.views.2d.layers.FeatureLayerView2D")],le);const ce=le;export{ce 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{sqlOr as _,sqlIn as v,sqlAnd as b}from"../../../core/sql.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import{subclass as A}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import j from"../../../geometry/Extent.js";import U from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as I}from"../../../layers/graphics/featureConversionUtils.js";import x from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as E}from"../../../layers/support/featureLayerUtils.js";import{packFields as k}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as V}from"../../../layers/support/timeSupport.js";import q from"../../../rest/support/AggregateFeatureSet.js";import R from"../../../rest/support/AttributeBinsFeatureSet.js";import Q from"../../../rest/support/AttributeBinsQuery.js";import O from"../../../rest/support/FeatureSet.js";import L from"../../../rest/support/Query.js";import{LayerView2DMixin as T}from"./LayerView2D.js";import{FeatureContainer as W}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as D}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as P}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as H}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as M}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as N}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as J}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as G}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as $}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as B}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as z}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as Z}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as K}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import X from"./support/FeatureCommandQueue.js";import{handleNoEngineError as Y}from"./support/handleNoEngineError.js";import{toJSONGeometryType as ee}from"./support/util.js";import{FeatureTileSubscriptionManager as te}from"../tiling/FeatureTileSubscriptionManager.js";import re from"../../layers/FeatureLayerView.js";import ie from"../../layers/LayerView.js";import se from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as ae}from"../../support/HighlightDefaults.js";function oe(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 ne=4294967294;function ue(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 le=class extends(re(se(T(ie)))){constructor(){super(...arguments),this._commandsQueue=new X({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 P,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new S,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new U}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===C(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 D(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 effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?_(e,v(this.layer.objectIdField,this.highlightIds)):e}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 N(this.layer):new M(this.layer);case"geojson":case"csv":case"wfs":return new N(this.layer);case"parquet":return new B(this.layer);case"subtype-group":return new Z(this.layer);case"ogc-feature":return new G(this.layer);case"stream":return new z(this.layer);case"oriented-imagery":return new $(this.layer);case"knowledge-graph-sublayer":return new J(this.layer);case"catalog-footprint":return new H(this.layer);default:o(this.layer)}return null}get timeExtent(){return V(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??ae;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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=O.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 Y(r,{features:[]}),s=O.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 Y(r,{features:[]}),s=q.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 Y(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return Y(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return Y(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return Y(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return Y(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return Y(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await Y(r,{count:0,extent:null});return{count:i.count,extent:j.fromJSON(i.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),i=await Y(r,{features:[]});return R.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 W(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new te({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([ue([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],(()=>this._update())),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 K(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=L.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=L.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)%ne+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ne+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=ee(this.layer.geometryType),s=this.layer.objectIdField,a=[];for(const o of e.added){const e=I(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=I(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(),E(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{await t.pipeline.onOverride(e)}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=oe(this._lastAvailableFields,e);return this._lastAvailableFields=t,k(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[he(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e}}_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 he(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 x,s.timeExtent=n),s=t.addFilters?.(s,e)??s,a&&(s??=new x,s.where=b(s.where,a));let u=s?.toJSON()??null;return i.size&&(u??=(new x).toJSON(),u.hiddenIds=Array.from(i)),u}e([F()],le.prototype,"_commandsQueue",void 0),e([F()],le.prototype,"_sourceRefreshVersion",void 0),e([F()],le.prototype,"_displayRefreshVersion",void 0),e([F({readOnly:!0})],le.prototype,"_pipelineUpdating",void 0),e([F()],le.prototype,"_sourceUpdating",void 0),e([F({readOnly:!0})],le.prototype,"dataUpdating",null),e([F({readOnly:!0})],le.prototype,"effectiveDisplayFilterClause",null),e([F({readOnly:!0})],le.prototype,"hasAllFeatures",null),e([F({readOnly:!0})],le.prototype,"hasAllFeaturesInView",null),e([F({readOnly:!0})],le.prototype,"hasFullGeometries",null),e([F()],le.prototype,"featureEffectView",void 0),e([F()],le.prototype,"labelingCollisionInfos",null),e([F()],le.prototype,"layerAdapter",null),e([F({readOnly:!0})],le.prototype,"timeExtent",null),e([F()],le.prototype,"updating",void 0),le=e([A("esri.views.2d.layers.FeatureLayerView2D")],le);const ce=le;export{ce 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 t}from"../../../chunks/tslib.es6.js";import{isSome as e}from"../../../core/arrayUtils.js";import i from"../../../core/Collection.js";import r from"../../../core/CollectionFlattener.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{watch as o,initial as a,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as h}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 c from"../../../rest/support/DirectionLine.js";import l from"../../../rest/support/DirectionPoint.js";import d from"../../../rest/support/PointBarrier.js";import u from"../../../rest/support/PolygonBarrier.js";import g from"../../../rest/support/PolylineBarrier.js";import _ from"../../../rest/support/RouteInfo.js";import m from"../../../rest/support/Stop.js";import{LayerView2DMixin as w}from"./LayerView2D.js";import y from"./graphics/GraphicContainer.js";import f from"./graphics/GraphicsView2D.js";import I from"../../layers/LayerView.js";const v=["route-info","direction-line","direction-point","polygon-barrier","polyline-barrier","point-barrier","stop"],k={graphic:null,property:null,oldValue:null,newValue:null};function j(t){return t instanceof c||t instanceof l||t instanceof d||t instanceof u||t instanceof g||t instanceof _||t instanceof m}function M(t){return i.isCollection(t)&&t.length&&j(t.at(0))}function V(t){return Array.isArray(t)&&t.length>0&&j(t[0])}const F=new Set(["default"]);let G=class extends(w(I)){constructor(){super(...arguments),this._graphics=new i,this._highlightIds=new Map,this._networkFeatureMap=new Map,this._networkGraphicMap=new Map,this._interaction=null,this._loadInteractionPromise=null,this.interactive=!1}get _routeItems(){return new r({getCollections:()=>null==this.layer||this.destroyed?[]:[null!=this.layer.routeInfo?new i([this.layer.routeInfo]):null,this.layer.directionLines,this.layer.directionPoints,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.pointBarriers,this.layer.stops]})}initialize(){this.addHandles(o((()=>{const{interactive:t,suspended:e}=this;return{interactive:t,suspended:e}}),(({interactive:t,suspended:e})=>{const i=t&&!e;i&&this._getInteractionLoadPromise().then((t=>{t.enabled=this.interactive&&!this.suspended})),this._interaction&&(this._interaction.enabled=i)}),n)),this._updatingHandles.addOnCollectionChange((()=>this._routeItems),(t=>this._routeItemsChanged(t)),a)}destroy(){this._networkFeatureMap.clear(),this._networkGraphicMap.clear(),this._graphics.removeAll(),this._get("_routeItems")?.destroy()}attach(){this._createGraphicsView()}detach(){this._destroyGraphicsView()}get selectedNetworkFeatures(){return this._interaction?.selectedNetworkFeatures??null}async create(t){if(!this.interactive)return;return(await this._getInteractionLoadPromise()).create(t)}delete(){this._interaction?.delete()}async fetchPopupFeaturesAtLocation(t,e){return this._graphicsView.hitTest(t).filter((({popupTemplate:t})=>!!t))}highlight(t){let i;i=j(t)?[this._getNetworkFeatureUid(t)]:V(t)?t.map((t=>this._getNetworkFeatureUid(t))):M(t)?t.map((t=>this._getNetworkFeatureUid(t))).toArray():[t.uid];const r=i.filter(e);return r.length?(this._addHighlight(r),s((()=>this._removeHighlight(r)))):s()}async hitTest(t,i){if(this.suspended)return null;const r=this._graphicsView.hitTest(t).filter(e).map((t=>this._networkGraphicMap.get(t)));if(!r.length)return null;const{layer:s}=this;return r.reverse().map((e=>({type:"route",layer:s,mapPoint:t,networkFeature:e})))}isUpdating(){return this._graphicsView.updating}moveEnd(){}update(t){this._graphicsView.processUpdate(t)}viewChange(){this._graphicsView.viewChange()}_addHighlight(t){for(const e of t)if(this._highlightIds.has(e)){const t=this._highlightIds.get(e);this._highlightIds.set(e,t+1)}else this._highlightIds.set(e,1);this._updateHighlight()}_createGraphic(t){const e=t.toGraphic();return e.layer=this.layer,e.sourceLayer=this.layer,e}_createGraphicsView(){const t=this.view,e=()=>this.requestUpdate(),i=new y(t.featuresTilingScheme);this._graphicsView=new f({container:i,graphics:this._graphics,requestUpdateCallback:e,view:t}),this.container.addChild(i),this._updateHighlight()}_destroyGraphicsView(){this.container.removeChild(this._graphicsView.container),this._graphicsView.destroy()}_getDrawOrder(t){const e=this._networkGraphicMap.get(t);return v.indexOf(e.type)}_getInteractionLoadPromise(){return this._loadInteractionPromise||(this._loadInteractionPromise=this._loadInteraction(),this._updatingHandles.addPromise(this._loadInteractionPromise)),this._loadInteractionPromise}_getNetworkFeatureUid(t){return this._networkFeatureMap.has(t)?this._networkFeatureMap.get(t).uid:null}async _loadInteraction(){const{layer:t,view:e}=this,{RouteLayerInteraction:i}=await import("./support/RouteLayerInteraction.js");return this._interaction=new i({view:e,layer:t}),this._interaction}_removeHighlight(t){for(const e of t)if(this._highlightIds.has(e)){const t=this._highlightIds.get(e)-1;0===t?this._highlightIds.delete(e):this._highlightIds.set(e,t)}this._updateHighlight()}_routeItemsChanged(t){if(t.removed.length){this._graphics.removeMany(t.removed.map((t=>{const e=this._networkFeatureMap.get(t);return this._networkFeatureMap.delete(t),this._networkGraphicMap.delete(e),e})));for(const e of t.removed)this.removeHandles(e)}if(t.added.length){this._graphics.addMany(t.added.map((t=>{const e=this._createGraphic(t);return null==e.symbol?null:(this._networkFeatureMap.set(t,e),this._networkGraphicMap.set(e,t),e)})).filter(e));for(const e of t.added)this.addHandles([o((()=>e.geometry),((t,i)=>{this._updateGraphic(e,"geometry",t,i)})),o((()=>e.symbol),((t,i)=>{this._updateGraphic(e,"symbol",t,i)}))],e);this._graphics.sort(((t,e)=>this._getDrawOrder(t)-this._getDrawOrder(e)))}}_updateGraphic(t,e,i,r){if(!this._networkFeatureMap.has(t)){const e=this._createGraphic(t);return this._networkFeatureMap.set(t,e),this._networkGraphicMap.set(e,t),void this._graphics.add(e)}const s=this._networkFeatureMap.get(t);s[e]=i,k.graphic=s,k.property=e,k.oldValue=r,k.newValue=i,this._graphicsView.graphicUpdateHandler(k)}_updateHighlight(){const t=Array.from(this._highlightIds.keys()),e=this._getHighlightBits(F.values());this._graphicsView.setHighlight(t.map((t=>({objectId:t,highlightFlags:e}))))}};t([h()],G.prototype,"_graphics",void 0),t([h()],G.prototype,"_routeItems",null),t([h()],G.prototype,"_interaction",void 0),t([h()],G.prototype,"interactive",void 0),t([h({readOnly:!0})],G.prototype,"selectedNetworkFeatures",null),G=t([p("esri.views.2d.layers.RouteLayerView2D")],G);const H=G;export{H as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{isSome as e}from"../../../core/arrayUtils.js";import i from"../../../core/Collection.js";import r from"../../../core/CollectionFlattener.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{watch as o,initial as a,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as h}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 c from"../../../rest/support/DirectionLine.js";import l from"../../../rest/support/DirectionPoint.js";import d from"../../../rest/support/PointBarrier.js";import u from"../../../rest/support/PolygonBarrier.js";import g from"../../../rest/support/PolylineBarrier.js";import _ from"../../../rest/support/RouteInfo.js";import m from"../../../rest/support/Stop.js";import{LayerView2DMixin as w}from"./LayerView2D.js";import y from"./graphics/GraphicContainer.js";import f from"./graphics/GraphicsView2D.js";import v from"../../layers/LayerView.js";const I=["route-info","direction-line","direction-point","polygon-barrier","polyline-barrier","point-barrier","stop"],k={graphic:null,property:null,oldValue:null,newValue:null};function j(t){return t instanceof c||t instanceof l||t instanceof d||t instanceof u||t instanceof g||t instanceof _||t instanceof m}function M(t){return i.isCollection(t)&&t.length&&j(t.at(0))}function V(t){return Array.isArray(t)&&t.length>0&&j(t[0])}const F=new Set(["default"]);let G=class extends(w(v)){constructor(){super(...arguments),this._graphics=new i,this._highlightIds=new Map,this._networkFeatureMap=new Map,this._networkGraphicMap=new Map,this._interaction=null,this._loadInteractionPromise=null,this.interactive=!1}get _routeItems(){return new r({getCollections:()=>null==this.layer||this.destroyed?[]:[null!=this.layer.routeInfo?new i([this.layer.routeInfo]):null,this.layer.directionLines,this.layer.directionPoints,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.pointBarriers,this.layer.stops]})}initialize(){this.addHandles(o((()=>{const{interactive:t,suspended:e}=this;return{interactive:t,suspended:e}}),(({interactive:t,suspended:e})=>{const i=t&&!e;i&&this._getInteractionLoadPromise().then((t=>{t.enabled=this.interactive&&!this.suspended})),this._interaction&&(this._interaction.enabled=i)}),n)),this._updatingHandles.addOnCollectionChange((()=>this._routeItems),(t=>this._routeItemsChanged(t)),a)}destroy(){this._networkFeatureMap.clear(),this._networkGraphicMap.clear(),this._graphics.removeAll(),this._get("_routeItems")?.destroy()}attach(){this._createGraphicsView()}detach(){this._destroyGraphicsView(),this._interaction?.enabled&&(this._interaction.enabled=!1)}get selectedNetworkFeatures(){return this._interaction?.selectedNetworkFeatures??null}async create(t){if(!this.interactive)return;return(await this._getInteractionLoadPromise()).create(t)}async fetchPopupFeaturesAtLocation(t,e){return this._graphicsView.hitTest(t).filter((({popupTemplate:t})=>!!t))}highlight(t){let i;i=j(t)?[this._getNetworkFeatureUid(t)]:V(t)?t.map((t=>this._getNetworkFeatureUid(t))):M(t)?t.map((t=>this._getNetworkFeatureUid(t))).toArray():[t.uid];const r=i.filter(e);return r.length?(this._addHighlight(r),s((()=>this._removeHighlight(r)))):s()}async hitTest(t,i){if(this.suspended)return null;const r=this._graphicsView.hitTest(t).filter(e).map((t=>this._networkGraphicMap.get(t)));if(!r.length)return null;const{layer:s}=this;return r.reverse().map((e=>({type:"route",layer:s,mapPoint:t,networkFeature:e})))}isUpdating(){return this._graphicsView.updating}moveEnd(){}remove(t){this._interaction?.remove(t)}update(t){this._graphicsView.processUpdate(t)}viewChange(){this._graphicsView.viewChange()}_addHighlight(t){for(const e of t)if(this._highlightIds.has(e)){const t=this._highlightIds.get(e);this._highlightIds.set(e,t+1)}else this._highlightIds.set(e,1);this._updateHighlight()}_createGraphic(t){const e=t.toGraphic();return e.layer=this.layer,e.sourceLayer=this.layer,e}_createGraphicsView(){const t=this.view,e=()=>this.requestUpdate(),i=new y(t.featuresTilingScheme);this._graphicsView=new f({container:i,graphics:this._graphics,requestUpdateCallback:e,view:t}),this.container.addChild(i),this._updateHighlight()}_destroyGraphicsView(){this.container.removeChild(this._graphicsView.container),this._graphicsView.destroy()}_getDrawOrder(t){const e=this._networkGraphicMap.get(t);return I.indexOf(e.type)}_getInteractionLoadPromise(){return this._loadInteractionPromise||(this._loadInteractionPromise=this._loadInteraction(),this._updatingHandles.addPromise(this._loadInteractionPromise)),this._loadInteractionPromise}_getNetworkFeatureUid(t){return this._networkFeatureMap.has(t)?this._networkFeatureMap.get(t).uid:null}async _loadInteraction(){const{layer:t,view:e}=this,{RouteLayerInteraction:i}=await import("./support/RouteLayerInteraction.js");return this._interaction=new i({view:e,layer:t}),this._interaction}_removeHighlight(t){for(const e of t)if(this._highlightIds.has(e)){const t=this._highlightIds.get(e)-1;0===t?this._highlightIds.delete(e):this._highlightIds.set(e,t)}this._updateHighlight()}_routeItemsChanged(t){if(t.removed.length){this._graphics.removeMany(t.removed.map((t=>{const e=this._networkFeatureMap.get(t);return this._networkFeatureMap.delete(t),this._networkGraphicMap.delete(e),e})));for(const e of t.removed)this.removeHandles(e)}if(t.added.length){this._graphics.addMany(t.added.map((t=>{const e=this._createGraphic(t);return null==e.symbol?null:(this._networkFeatureMap.set(t,e),this._networkGraphicMap.set(e,t),e)})).filter(e));for(const e of t.added)this.addHandles([o((()=>e.geometry),((t,i)=>{this._updateGraphic(e,"geometry",t,i)})),o((()=>e.symbol),((t,i)=>{this._updateGraphic(e,"symbol",t,i)}))],e);this._graphics.sort(((t,e)=>this._getDrawOrder(t)-this._getDrawOrder(e)))}}_updateGraphic(t,e,i,r){if(!this._networkFeatureMap.has(t)){const e=this._createGraphic(t);return this._networkFeatureMap.set(t,e),this._networkGraphicMap.set(e,t),void this._graphics.add(e)}const s=this._networkFeatureMap.get(t);s[e]=i,k.graphic=s,k.property=e,k.oldValue=r,k.newValue=i,this._graphicsView.graphicUpdateHandler(k)}_updateHighlight(){const t=Array.from(this._highlightIds.keys()),e=this._getHighlightBits(F.values());this._graphicsView.setHighlight(t.map((t=>({objectId:t,highlightFlags:e}))))}};t([h()],G.prototype,"_graphics",void 0),t([h()],G.prototype,"_routeItems",null),t([h()],G.prototype,"_interaction",void 0),t([h()],G.prototype,"interactive",void 0),t([h({readOnly:!0})],G.prototype,"selectedNetworkFeatures",null),G=t([p("esri.views.2d.layers.RouteLayerView2D")],G);const H=G;export{H 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 has from"../../../../core/has.js";import{throwIfAborted as e,createResolver as t}from"../../../../core/promiseUtils.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{WGLDrawPhase as i,FeatureSelection as n,FeatureBatchingStrategy as a}from"../../engine/webgl/enums.js";import o from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as h}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{TechniqueType as d}from"../../engine/webgl/shaderGraph/techniques/TechniqueType.js";import{RenderState as l}from"./RenderState.js";import{renderHighlight as u}from"../support/util.js";class c{constructor(e,s){this.id=e,this.version=s,this._resolver=t(),this._done=!1}get done(){return this._done}get promise(){return this._resolver.promise}end(){this._resolver.resolve(),this._done=!0}destroy(){this._resolver.reject()}}class p extends r{constructor(e){super(e.view.featuresTilingScheme),this.updatingHandles=new s,this._hitTestsRequests=[],this._store=new o,this._visibleTiles=new Set,this._subscriptions=new Map,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}renderChildren(e){if(this._updateAttributeView(),this._renderState?.update(this.attributeView.currentEpoch),this._renderState){const e=Array.from(this._renderState.tiles()).filter((e=>e.needsUpload));if(e.length){e[Math.floor(Math.random()*e.length)].upload(),e.length>=2&&this.requestRender()}for(const t of this._renderState.tiles())t.tryReady(this.attributeView.currentEpoch)&&(this._subscriptions.get(t.key.id)?.end(),this._layerView.requestUpdate(),this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this.requestRender())}for(const t of this.children)t.setTransform(e.state);switch(super.renderChildren(e),e.drawPhase){case i.MAP:return this._renderMapPhase(e);case i.HIGHLIGHT:return this._renderHighlightPhase(e);case i.LABEL:return this._renderLabelPhase(e)}}subscriptions(){return this._subscriptions.values()}get _instanceStore(){return this._store}get instanceStore(){return this._store}get layerView(){return this._layerView}get hasLabels(){return this._layerView.labelingCollisionInfos.length>0}get hasHighlight(){return this._layerView.hasHighlight}get _layer(){return this._layerView.layer}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&h.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(_(t))return t;return null}get children(){return this._renderState?Array.from(this._renderState.tiles()).filter((e=>this._visibleTiles.has(e.key.id))):[]}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this._layerView.view.labelManager.requestUpdate()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe)if(this._subscriptions.has(t))this._subscriptions.get(t).version=s;else{const e=new c(t,s);this._subscriptions.set(t,e),this.updatingHandles.addPromise(e.promise)}for(const t of e.unsubscribe){const e=this._subscriptions.get(t);e?.destroy(),this._subscriptions.delete(t),this.removeTile(t)}}isDone(e){return!!this._renderState&&this._renderState.isTileDone(e)}async updateRenderState(e){has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext=new l((()=>this._stage),(e=>this._subscriptions.get(e)?.version),e,this.tileInfoView)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}editStart(){this._renderState?.lockUploads(),this.attributeView.lockTextureUploads(),this._lockStatisticUpdates=!0}editEnd(){this._renderState?.unlockUploads(),this.attributeView.unlockTextureUploads(),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState?.flush(),this.requestRender()}trySwapRenderState(){this._renderStateNext&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.version}] FeatureContainer.update.swapRenderState`),this._renderState?.destroy(),this._renderState=this._renderStateNext,this._renderState.flush(),this._renderStateNext=null),this.requestRender()}setVisibleTiles(e){this._visibleTiles=e}async onMessage(t,s){e(s);const r=t.inner;if(!this._subscriptions.has(r.id))return;const i=this._subscriptions.get(r.id);if(i.version!==r.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${r.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${r.id}] FeatureContainer - Dropping message, outdated version]`,r)}return}const n=this._renderStateNext??this._renderState;if(!n)throw new Error("InternalError: No renderState defined");n.version!==r.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${r.version}]`),n.enqueueUpdate(t),this.requestRender(),this._layerView.view.labelManager.requestUpdate(),this._layerView.requestUpdate()}removeTile(e){(this._renderState||this._renderStateNext)&&(this._renderState&&this._renderState.removeTile(e),this._renderStateNext&&this._renderStateNext.removeTile(e))}hitTest(e){let s=this._hitTestsRequests.find((({x:t,y:s})=>t===e.x&&s===e.y));const r=t();return s?s.resolvers.push(r):(s={x:e.x,y:e.y,resolvers:[r]},this._hitTestsRequests.push(s)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach(((e,t)=>s.set(t,e))),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}afterRender(e){super.afterRender(e),this._hitTestsRequests.length&&this.requestRender()}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=h.heatmap.getStencilReference(t)}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,n.All),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&u(e,!1,(e=>{this._renderFeatures(e,n.Highlight)}))}_renderLabelPhase(e){this._renderFeatures(e,n.All)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,n.InsideEffect),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,n.OutsideEffect),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.getBoundFramebufferObject(),a=t.getViewport(),o=e.passOptions,h=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=i.HITTEST;const{distance:d,smallSymbolDistance:l}=e.passOptions,u=Math.max(d,l);for(const i of this.children)i.visible&&i.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(i,e,n.All);s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(a),e.passOptions=o,e.drawPhase=h}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,d.Heatmap);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){const i=has("featurelayer-strict-draw-order")?a.STRICT_ORDER:has("featurelayer-force-marker-text-draw-order")?a.STRICT_MARKERS_AND_TEXT:a.BATCHING,n=e.getDisplayList(this._instanceStore,i);t.selection=s,n?.render(t,r)}}function _(e){return e.techniqueRef.type===d.Heatmap}export{p as FeatureContainer};
5
+ import has from"../../../../core/has.js";import{throwIfAborted as e,createResolver as t}from"../../../../core/promiseUtils.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{WGLDrawPhase as i,FeatureSelection as n,FeatureBatchingStrategy as a}from"../../engine/webgl/enums.js";import o from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as h}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{TechniqueType as d}from"../../engine/webgl/shaderGraph/techniques/TechniqueType.js";import{RenderState as l}from"./RenderState.js";import{renderHighlight as u}from"../support/util.js";class c{constructor(e,s){this.id=e,this.version=s,this._resolver=t(),this._done=!1}get done(){return this._done}get promise(){return this._resolver.promise}end(){this._resolver.resolve(),this._done=!0}destroy(){this._resolver.reject()}}class _ extends r{constructor(e){super(e.view.featuresTilingScheme),this.updatingHandles=new s,this._hitTestsRequests=[],this._store=new o,this._visibleTiles=new Set,this._subscriptions=new Map,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}renderChildren(e){if(this._updateAttributeView(),this._renderState?.update(this.attributeView.currentEpoch),this._renderState){const e=Array.from(this._renderState.tiles()).filter((e=>e.needsUpload));if(e.length){e[Math.floor(Math.random()*e.length)].upload(),e.length>=2&&this.requestRender()}for(const t of this._renderState.tiles())t.tryReady(this.attributeView.currentEpoch)&&(this._subscriptions.get(t.key.id)?.end(),this._layerView.requestUpdate(),this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this.requestRender())}for(const t of this.children)t.setTransform(e.state);switch(super.renderChildren(e),e.drawPhase){case i.MAP:return this._renderMapPhase(e);case i.HIGHLIGHT:return this._renderHighlightPhase(e);case i.LABEL:return this._renderLabelPhase(e)}}subscriptions(){return this._subscriptions.values()}get _instanceStore(){return this._store}get instanceStore(){return this._store}get layerView(){return this._layerView}get hasLabels(){return this._layerView.labelingCollisionInfos.length>0}get hasHighlight(){return this._layerView.hasHighlight}get _layer(){return this._layerView.layer}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&h.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(p(t))return t;return null}get children(){return this._renderState?Array.from(this._renderState.tiles()).filter((e=>this._visibleTiles.has(e.key.id))):[]}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this._layerView.view.labelManager.requestUpdate()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe)if(this._subscriptions.has(t))this._subscriptions.get(t).version=s;else{const e=new c(t,s);this._subscriptions.set(t,e),this.updatingHandles.addPromise(e.promise)}for(const t of e.unsubscribe){const e=this._subscriptions.get(t);e?.destroy(),this._subscriptions.delete(t),this.removeTile(t)}}isDone(e){return!!this._renderState&&this._renderState.isTileDone(e)}async updateRenderState(e){has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext=new l((()=>this._stage),(e=>this._subscriptions.get(e)?.version),e,this.tileInfoView)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}lockForOverrides(){this._renderState?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState?.flush(),this.requestRender()}trySwapRenderState(){this._renderStateNext&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.version}] FeatureContainer.update.swapRenderState`),this._renderState?.destroy(),this._renderState=this._renderStateNext,this._renderState.flush(),this._renderStateNext=null),this.requestRender()}setVisibleTiles(e){this._visibleTiles=e}async onMessage(t,s){e(s);const r=t.inner;if(!this._subscriptions.has(r.id))return;const i=this._subscriptions.get(r.id);if(i.version!==r.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${r.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${r.id}] FeatureContainer - Dropping message, outdated version]`,r)}return}const n=this._renderStateNext??this._renderState;if(!n)throw new Error("InternalError: No renderState defined");n.version!==r.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${r.version}]`),n.enqueueUpdate(t),this.requestRender(),this._layerView.view.labelManager.requestUpdate(),this._layerView.requestUpdate()}removeTile(e){(this._renderState||this._renderStateNext)&&(this._renderState&&this._renderState.removeTile(e),this._renderStateNext&&this._renderStateNext.removeTile(e))}hitTest(e){let s=this._hitTestsRequests.find((({x:t,y:s})=>t===e.x&&s===e.y));const r=t();return s?s.resolvers.push(r):(s={x:e.x,y:e.y,resolvers:[r]},this._hitTestsRequests.push(s)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach(((e,t)=>s.set(t,e))),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}afterRender(e){super.afterRender(e),this._hitTestsRequests.length&&this.requestRender()}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=h.heatmap.getStencilReference(t)}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,n.All),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&u(e,!1,(e=>{this._renderFeatures(e,n.Highlight)}))}_renderLabelPhase(e){this._renderFeatures(e,n.All)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,n.InsideEffect),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,n.OutsideEffect),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.getBoundFramebufferObject(),a=t.getViewport(),o=e.passOptions,h=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=i.HITTEST;const{distance:d,smallSymbolDistance:l}=e.passOptions,u=Math.max(d,l);for(const i of this.children)i.visible&&i.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(i,e,n.All);s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(a),e.passOptions=o,e.drawPhase=h}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,d.Heatmap);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){const i=has("featurelayer-strict-draw-order")?a.STRICT_ORDER:has("featurelayer-force-marker-text-draw-order")?a.STRICT_MARKERS_AND_TEXT:a.BATCHING,n=e.getDisplayList(this._instanceStore,i);t.selection=s,n?.render(t,r)}}function p(e){return e.techniqueRef.type===d.Heatmap}export{_ as FeatureContainer};