@arcgis/core 4.33.0-next.20250212 → 4.33.0-next.20250214

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 (290) hide show
  1. package/arcade/arcadeAsyncRuntime.js +1 -1
  2. package/arcade/arcadeCompiler.js +1 -1
  3. package/arcade/arcadeEnvironment.js +1 -1
  4. package/arcade/arcadeRuntime.js +1 -1
  5. package/arcade/featureSetUtils.js +1 -1
  6. package/arcade/featureset/actions/GroupBy.js +1 -1
  7. package/arcade/featureset/actions/OrderBy.js +1 -1
  8. package/arcade/functions/date.js +1 -1
  9. package/arcade/functions/feature.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/featuresetgeom.js +1 -1
  12. package/arcade/functions/featuresetstats.js +1 -1
  13. package/arcade/functions/featuresetstring.js +1 -1
  14. package/arcade/functions/fieldStats.js +1 -1
  15. package/arcade/functions/geomasync.js +1 -1
  16. package/arcade/functions/geometry.js +1 -1
  17. package/arcade/functions/geomsync.js +1 -1
  18. package/arcade/functions/knowledgegraph.js +1 -1
  19. package/arcade/functions/maths.js +1 -1
  20. package/arcade/functions/string.js +1 -1
  21. package/arcade/geometry/functions.js +1 -1
  22. package/arcade/languageUtils.js +1 -1
  23. package/arcade.js +1 -1
  24. package/assets/esri/core/workers/RemoteClient.js +1 -1
  25. package/assets/esri/core/workers/chunks/01f8f52a3f9e6fb72f64.js +1 -0
  26. package/assets/esri/core/workers/chunks/{8191dd3d7451b2e7b95e.js → 041eebac192855fbf919.js} +1 -1
  27. package/assets/esri/core/workers/chunks/09cbf45dc7b026957d3e.js +1 -0
  28. package/assets/esri/core/workers/chunks/{1a286d43daa3b811c30d.js → 1661ac4e1b6c6af6ee0f.js} +1 -1
  29. package/assets/esri/core/workers/chunks/197dc75a1c10c0fbf65a.js +1 -0
  30. package/assets/esri/core/workers/chunks/219b06cca6aa1e041f40.js +1 -0
  31. package/assets/esri/core/workers/chunks/238bcf6514a1f214cc8a.js +1 -0
  32. package/assets/esri/core/workers/chunks/{efded84870064c3d8210.js → 23a045fccc005079bd58.js} +1 -1
  33. package/assets/esri/core/workers/chunks/2dc35c1c5d83174a2c06.js +1 -0
  34. package/assets/esri/core/workers/chunks/{e4651d577d297386268e.js → 32035bc69ee18b19623d.js} +1 -1
  35. package/assets/esri/core/workers/chunks/32fee5446ee0b0a6c4bd.js +1 -0
  36. package/assets/esri/core/workers/chunks/{f429d95eb986f3d215f3.js → 391c200274bbeb92404c.js} +1 -1
  37. package/assets/esri/core/workers/chunks/39c595734a9e9cd67e41.js +1 -0
  38. package/assets/esri/core/workers/chunks/3c44b4bf7fe407ec1d70.js +1 -0
  39. package/assets/esri/core/workers/chunks/3eacb4d1275f2d87825f.js +1 -0
  40. package/assets/esri/core/workers/chunks/{c0af54cc5938176ce764.js → 3fe7be535affae31de7e.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{c061cad8323f0469e7e4.js → 42f21349f488a14198e4.js} +1 -1
  42. package/assets/esri/core/workers/chunks/48eb5cbb4555acc56984.js +1 -0
  43. package/assets/esri/core/workers/chunks/4927b33f7e9daf059765.js +1 -0
  44. package/assets/esri/core/workers/chunks/50bab11c32bf4001edd7.js +1 -0
  45. package/assets/esri/core/workers/chunks/544ad8fa4777ba8ec177.js +1 -0
  46. package/assets/esri/core/workers/chunks/5c9a7b1dedd146cc65d2.js +1 -0
  47. package/assets/esri/core/workers/chunks/5d8120c84e5a164cb1bc.js +1 -0
  48. package/assets/esri/core/workers/chunks/{7a9e1696dc6120df15b0.js → 60ca6a2e9f1e2c969aab.js} +1 -1
  49. package/assets/esri/core/workers/chunks/679cc23be07ededb3992.js +1 -0
  50. package/assets/esri/core/workers/chunks/{9f122278e917c9ce5f95.js → 67c1e2c17ea3ca27248c.js} +1 -1
  51. package/assets/esri/core/workers/chunks/69b55259f90e8e4bc2aa.js +1 -0
  52. package/assets/esri/core/workers/chunks/69e0ff74e44962d97049.js +1 -0
  53. package/assets/esri/core/workers/chunks/6c64ccf5f64b5025b239.js +1 -0
  54. package/assets/esri/core/workers/chunks/6ca4b5d1a076c6079472.js +1 -0
  55. package/assets/esri/core/workers/chunks/{7058001bf66f9f3d5d45.js → 6d02d66234a7b74e5c14.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{77bfd4f819096cb754ae.js → 6e92569a4a82592b95dc.js} +1 -1
  57. package/assets/esri/core/workers/chunks/6f007703662e714b2f0a.js +1 -0
  58. package/assets/esri/core/workers/chunks/744bdf2bb0cc38e6a7b1.js +1 -0
  59. package/assets/esri/core/workers/chunks/7bf9ebff90bb02bec8e7.js +1 -0
  60. package/assets/esri/core/workers/chunks/{8b6580329e1e35ea4190.js → 7c03489438f51a5170f3.js} +1 -1
  61. package/assets/esri/core/workers/chunks/7e77e4288ed205128b87.js +1 -0
  62. package/assets/esri/core/workers/chunks/80c3e933b43ea79b30de.js +1 -0
  63. package/assets/esri/core/workers/chunks/830844f7fb7557d30f34.js +1 -0
  64. package/assets/esri/core/workers/chunks/8a66d06132c8803033c9.js +1 -0
  65. package/assets/esri/core/workers/chunks/{e9993d4f2bfdc434fbcc.js → 8f4bcca8b0525e19374f.js} +1 -1
  66. package/assets/esri/core/workers/chunks/95047f145ebda65c3d8e.js +1 -0
  67. package/assets/esri/core/workers/chunks/9968c6654d048c9add0c.js +1 -0
  68. package/assets/esri/core/workers/chunks/{b50176897ffadc53573e.js → 9bbfa8dc4124b5273d28.js} +1 -1
  69. package/assets/esri/core/workers/chunks/9be12d0df67e2c4c3787.js +1 -0
  70. package/assets/esri/core/workers/chunks/a2b548fbfa2eb5e6f2a7.js +1 -0
  71. package/assets/esri/core/workers/chunks/a37825705e49b60e5d4b.js +1 -0
  72. package/assets/esri/core/workers/chunks/a80c3ada9e09b8832e9b.js +1 -0
  73. package/assets/esri/core/workers/chunks/a8457210711b663059f0.js +1 -0
  74. package/assets/esri/core/workers/chunks/aebbaa7ab7a6b3b1579c.js +314 -0
  75. package/assets/esri/core/workers/chunks/b90b7ffc1e9363ed18e0.js +1 -0
  76. package/assets/esri/core/workers/chunks/{a39977478a6c57d2e8fb.js → bd2dcc55ac3418421ee5.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{83fe9a8002a4fc96e534.js → bd38717780fffa49d36c.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{c77ade444aa2f3f2b599.js → bdc9dec6a359d2e3705c.js} +1 -1
  79. package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +1 -0
  80. package/assets/esri/core/workers/chunks/c3806be4a760735e6082.js +1 -0
  81. package/assets/esri/core/workers/chunks/cb3148cf11a420d6e9ab.js +1 -0
  82. package/assets/esri/core/workers/chunks/{8d8f5f08d730270e1165.js → cb9a27176bd5de2c34ca.js} +1 -1
  83. package/assets/esri/core/workers/chunks/cbba0b6bd41d16eacb5c.js +1 -0
  84. package/assets/esri/core/workers/chunks/cdf942020b7054628dc9.js +1 -0
  85. package/assets/esri/core/workers/chunks/d6c3df07cfaa6bb639e9.js +1 -0
  86. package/assets/esri/core/workers/chunks/ea4c7560e64335f155f9.js +1 -0
  87. package/assets/esri/core/workers/chunks/eac791e3a0bb056a28f3.js +1 -0
  88. package/assets/esri/core/workers/chunks/ed89a108b032b982b12f.js +1 -0
  89. package/assets/esri/core/workers/chunks/ee5b82873ff80cb4ba34.js +1 -0
  90. package/assets/esri/core/workers/chunks/{08980b1ad3d5d67c6390.js → f419aaf3bab086060894.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{d0656e9d30eb3a66a8db.js → f976233ad5e5b718ba83.js} +1 -1
  92. package/assets/esri/themes/base/widgets/_Directions.scss +30 -9
  93. package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
  94. package/assets/esri/themes/dark/main.css +1 -1
  95. package/assets/esri/themes/light/main.css +1 -1
  96. package/assets/esri/themes/light/view.css +1 -1
  97. package/chunks/ComponentShader.glsl.js +6 -6
  98. package/chunks/arcade.js +1 -1
  99. package/chunks/array.js +1 -1
  100. package/chunks/languageUtils.js +1 -1
  101. package/copyright.txt +26 -19
  102. package/core/colorUtils.js +1 -1
  103. package/core/deprecate.js +1 -1
  104. package/core/libs/gl-matrix-2/factories/mat2df32.js +1 -1
  105. package/core/libs/gl-matrix-2/factories/mat2df64.js +1 -1
  106. package/core/libs/gl-matrix-2/factories/mat2f32.js +1 -1
  107. package/core/libs/gl-matrix-2/factories/mat2f64.js +1 -1
  108. package/core/libs/gl-matrix-2/factories/mat3f32.js +1 -1
  109. package/core/libs/gl-matrix-2/factories/mat3f64.js +1 -1
  110. package/core/libs/gl-matrix-2/factories/mat4f32.js +1 -1
  111. package/core/libs/gl-matrix-2/factories/mat4f64.js +1 -1
  112. package/core/libs/gl-matrix-2/factories/quat2f64.js +1 -1
  113. package/core/libs/gl-matrix-2/factories/vec2f32.js +1 -1
  114. package/core/libs/gl-matrix-2/factories/vec2f64.js +1 -1
  115. package/core/libs/gl-matrix-2/factories/vec3f32.js +1 -1
  116. package/core/libs/gl-matrix-2/factories/vec3f64.js +1 -1
  117. package/core/libs/gl-matrix-2/factories/vec4f32.js +1 -1
  118. package/core/libs/gl-matrix-2/factories/vec4f64.js +1 -1
  119. package/editing/templateUtils.js +1 -1
  120. package/geohash/geohashUtils.js +1 -1
  121. package/interfaces.d.ts +634 -129
  122. package/intl/locale.js +1 -1
  123. package/layers/FeatureLayer.js +1 -1
  124. package/layers/GeoJSONLayer.js +1 -1
  125. package/layers/ImageryTileLayer.js +1 -1
  126. package/layers/OGCFeatureLayer.js +1 -1
  127. package/layers/RouteLayer.js +1 -1
  128. package/layers/SubtypeGroupLayer.js +1 -1
  129. package/layers/WFSLayer.js +1 -1
  130. package/layers/graphics/data/queryUtils.js +1 -1
  131. package/layers/mixins/ArcGISImageService.js +1 -1
  132. package/layers/mixins/ImageryTileMixin.js +1 -1
  133. package/layers/mixins/TrackableLayer.d.ts +4 -0
  134. package/layers/save/imageryUtils.js +1 -1
  135. package/layers/support/ExportImageServiceParameters.js +1 -1
  136. package/layers/support/SubtypeSublayer.js +1 -1
  137. package/layers/support/TitleCreator.js +5 -0
  138. package/layers/support/TrackInfo.d.ts +4 -0
  139. package/layers/support/TrackInfo.js +1 -1
  140. package/layers/support/TrackPartInfo.d.ts +4 -0
  141. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  142. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  143. package/layers/support/rasterDatasets/datasetUtils.js +5 -0
  144. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  145. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  146. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  147. package/layers/support/rasterFunctions/creators/createLocalFunctions.js +1 -1
  148. package/layers/support/rasterFunctions/creators/createStatisticsFunctions.js +1 -1
  149. package/networks/UtilityNetwork.js +1 -1
  150. package/networks/support/networkFieldUtils.js +5 -0
  151. package/package.json +1 -1
  152. package/renderers/support/rasterRendererHelper.js +1 -1
  153. package/rest/query/executeForIds.js +1 -1
  154. package/rest/support/BinParametersBase.js +1 -1
  155. package/support/arcadeUtils.js +1 -1
  156. package/support/revision.js +1 -1
  157. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  158. package/symbols/cim/rasterizingUtils.js +1 -1
  159. package/symbols/support/previewCIMSymbol.js +1 -1
  160. package/symbols/support/previewSymbol2D.js +1 -1
  161. package/symbols/support/symbolUtils.js +1 -1
  162. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  163. package/views/2d/layers/RouteLayerView2D.js +1 -1
  164. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  165. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  166. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  167. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  168. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  169. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  170. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  171. package/views/3d/environment/EnvironmentManager.js +1 -1
  172. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  173. package/views/3d/environment/Fog.js +1 -1
  174. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  175. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  176. package/views/3d/layers/I3SMeshView3D.js +1 -1
  177. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  178. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  179. package/views/3d/layers/i3s/BuildingFilterUtil.js +1 -1
  180. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  181. package/views/3d/layers/i3s/SymbologyInfo.js +5 -0
  182. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  183. package/views/3d/state/utils/navigationUtils.js +1 -1
  184. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  186. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +14 -14
  188. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  189. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  190. package/views/3d/webgl-engine/core/renderPasses/RenderPassIdentifier.js +5 -0
  191. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  192. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
  193. package/views/3d/webgl-engine/lib/AnimationTimer.js +1 -1
  194. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  195. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  196. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  197. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  198. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  199. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  200. package/views/SceneView.js +1 -1
  201. package/views/View.js +1 -1
  202. package/views/draw/DrawAction.js +1 -1
  203. package/views/layers/FeatureLayerView.js +1 -1
  204. package/views/layers/ImageryTileLayerView.js +1 -1
  205. package/views/support/RequiredFieldsOptions.js +5 -0
  206. package/views/webgl/Texture.js +1 -1
  207. package/widgets/BasemapGallery.js +1 -1
  208. package/widgets/BasemapToggle.js +1 -1
  209. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  210. package/widgets/BatchAttributeForm.js +1 -1
  211. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  212. package/widgets/Compass/CompassViewModel.js +1 -1
  213. package/widgets/DirectionalPad.js +1 -1
  214. package/widgets/Directions/DirectionsViewModel.js +1 -1
  215. package/widgets/Directions.js +1 -1
  216. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  217. package/widgets/Editor/EditorViewModel.js +1 -1
  218. package/widgets/Editor.js +1 -1
  219. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  220. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  221. package/widgets/Fullscreen.js +1 -1
  222. package/widgets/Home.js +1 -1
  223. package/widgets/LayerList/LayerListItem.js +1 -1
  224. package/widgets/LayerList/ListItem.js +1 -1
  225. package/widgets/LayerList/support/layerListUtils.js +1 -1
  226. package/widgets/Legend/LegendViewModel.js +1 -1
  227. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  228. package/widgets/Legend.js +1 -1
  229. package/widgets/Locate.js +1 -1
  230. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  231. package/widgets/OrientedImageryViewer/adapters/sketch/DigitizationAdapter.js +1 -1
  232. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  233. package/widgets/OrientedImageryViewer/constants.js +1 -1
  234. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  235. package/widgets/OrientedImageryViewer/symbols.js +1 -1
  236. package/widgets/OrientedImageryViewer.js +1 -1
  237. package/widgets/ScaleBar.js +1 -1
  238. package/widgets/Swipe.js +1 -1
  239. package/widgets/TableList/ListItem.js +1 -1
  240. package/widgets/TableList.js +1 -1
  241. package/widgets/Track.js +1 -1
  242. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  243. package/widgets/UtilityNetworkTrace.js +1 -1
  244. package/widgets/support/GoTo.js +1 -1
  245. package/widgets/support/goToUtils.js +5 -0
  246. package/assets/esri/core/workers/chunks/03f51ea011ffbcfb7c7d.js +0 -1
  247. package/assets/esri/core/workers/chunks/122ed10cac9f192e1eec.js +0 -1
  248. package/assets/esri/core/workers/chunks/1249fd2f83caeaefd8ce.js +0 -1
  249. package/assets/esri/core/workers/chunks/144e534d4ac1aafab60d.js +0 -1
  250. package/assets/esri/core/workers/chunks/177d4c2c10ef7369006f.js +0 -1
  251. package/assets/esri/core/workers/chunks/1d282700e76285a1684c.js +0 -1
  252. package/assets/esri/core/workers/chunks/35392bf8f21005ad6170.js +0 -1
  253. package/assets/esri/core/workers/chunks/37cfd102b6ab5b959f9d.js +0 -1
  254. package/assets/esri/core/workers/chunks/3ba85f1d660b8887f963.js +0 -314
  255. package/assets/esri/core/workers/chunks/3c8e5b5fb52611e30ed6.js +0 -1
  256. package/assets/esri/core/workers/chunks/5eceedac9b2b4d1ef133.js +0 -1
  257. package/assets/esri/core/workers/chunks/6a9a1cd8134a903dd05a.js +0 -1
  258. package/assets/esri/core/workers/chunks/73d03c208242778e67bf.js +0 -1
  259. package/assets/esri/core/workers/chunks/7485588bd24217669578.js +0 -1
  260. package/assets/esri/core/workers/chunks/74e0116ae84def626c87.js +0 -1
  261. package/assets/esri/core/workers/chunks/7e3b374f906441cd7fb0.js +0 -1
  262. package/assets/esri/core/workers/chunks/80d3aa3f27ad5b2b969b.js +0 -1
  263. package/assets/esri/core/workers/chunks/84c1c3336011a1b79669.js +0 -1
  264. package/assets/esri/core/workers/chunks/8939479cd433cc53f6c1.js +0 -1
  265. package/assets/esri/core/workers/chunks/8a2f3ce46eeac853b3a9.js +0 -1
  266. package/assets/esri/core/workers/chunks/8f31fbb1d549230ee3db.js +0 -1
  267. package/assets/esri/core/workers/chunks/91384398f01485631f70.js +0 -1
  268. package/assets/esri/core/workers/chunks/9421ae38fdf986b9b107.js +0 -1
  269. package/assets/esri/core/workers/chunks/94225d92afbdb10dfedb.js +0 -1
  270. package/assets/esri/core/workers/chunks/99c136b800e5fc7e04f4.js +0 -1
  271. package/assets/esri/core/workers/chunks/9b74635d80d029498da1.js +0 -1
  272. package/assets/esri/core/workers/chunks/9e7895e8201127ffe0a8.js +0 -1
  273. package/assets/esri/core/workers/chunks/a5e9ea13e844a62b2a7f.js +0 -1
  274. package/assets/esri/core/workers/chunks/a6ec3665bde2af8a96e6.js +0 -1
  275. package/assets/esri/core/workers/chunks/a9274c9132e7a2691abb.js +0 -1
  276. package/assets/esri/core/workers/chunks/af917f69d9c6e9937263.js +0 -1
  277. package/assets/esri/core/workers/chunks/bf0bf2b912d668575a9b.js +0 -1
  278. package/assets/esri/core/workers/chunks/ca6180e572e69540c183.js +0 -1
  279. package/assets/esri/core/workers/chunks/cccd215b0a4890551957.js +0 -1
  280. package/assets/esri/core/workers/chunks/d074c916b414432a7b6a.js +0 -1
  281. package/assets/esri/core/workers/chunks/d7b260d6187f29e0c136.js +0 -1
  282. package/assets/esri/core/workers/chunks/de638753a30c9aa41bad.js +0 -1
  283. package/assets/esri/core/workers/chunks/debfb75a94b66b58cbbc.js +0 -1
  284. package/assets/esri/core/workers/chunks/e490f70f192780d7ad50.js +0 -1
  285. package/assets/esri/core/workers/chunks/e6633f0326a44477f630.js +0 -1
  286. package/assets/esri/core/workers/chunks/e71b780d1e6a32f303b7.js +0 -1
  287. package/assets/esri/core/workers/chunks/eb0ce7937813d1be1284.js +0 -1
  288. package/assets/esri/core/workers/chunks/f285ed5425b31123d2bc.js +0 -1
  289. package/assets/esri/core/workers/chunks/f2cf05fbbb51d657d300.js +0 -1
  290. package/assets/esri/core/workers/chunks/f4ba823c8acd60c7c82d.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/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.33/esri/copyright.txt for details.
4
4
  */
5
- import{p as e,c as n,e as r,a as t,r as o,l as a,b as i,d as l,f as u,s,g as c}from"../chunks/arcade.js";export{h as arcade}from"../chunks/arcade.js";import{ArcadeDate as f}from"../arcade/ArcadeDate.js";import{toSymbolId as p}from"../arcade/arcadeEnvironment.js";import m from"../arcade/Dictionary.js";import d from"../arcade/Feature.js";import{m as y,g as v,n as x,p as g,o as j}from"../chunks/languageUtils.js";export{Voxel}from"../arcade/Voxel.js";import{clone as S}from"../core/lang.js";import{DateOnly as w}from"../core/sql/DateOnly.js";import{TimeOnly as $}from"../core/sql/TimeOnly.js";import b from"../geometry/Extent.js";import E from"../geometry/Multipoint.js";import A from"../geometry/Point.js";import F from"../geometry/Polygon.js";import P from"../geometry/Polyline.js";import{isArray as C,isString as R,isBoolean as D,isNumber as I}from"./guards.js";const M={vars:{$feature:"any",$view:"any"},spatialReference:null};function T(e){return e.replaceAll(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function z(e){return null==e?null:C(e)||y(e)?"array":v(e)?"date":R(e)?"text":D(e)?"boolean":I(e)?"number":e instanceof m?"dictionary":x(e)?"feature":e instanceof A?"point":e instanceof F?"polygon":e instanceof P?"polyline":e instanceof E?"multipoint":e instanceof b?"extent":e instanceof w?"dateOnly":e instanceof $?"time":g(e)?"featureSet":j(e)?"featureSetCollection":null}function k(n){if(!n)return null;try{return e(n)}catch(r){}return null}function J(e,r){const t="string"==typeof e?k(e):e;if(!t)return null;try{return r=r||S(M),n(t,r)}catch(o){}return null}function V(e,n,r){return{vars:{$feature:null==e?new d:d.createFromGraphic(e,r),$view:n?.view},spatialReference:n?.sr,timeZone:r??null}}function O(e,n,r){return d.createFromGraphicLikeObject(n,e,r,null)}function Z(e,n){null!=e.vars&&(e.vars.$feature=n)}function q(e,n){let t;try{t=r(e,n)}catch(o){t=null}return t}function G(e,n){let r;try{r=e?e(n):null}catch(t){r=null}return r}function L(e,n){try{return e?e(n):Promise.resolve(null)}catch(r){return Promise.resolve(null)}}const N=new Set(["$feature","$aggregatedFeatures","$voxel"].map((e=>p(e))));function U(e,n){if(!e)return[];const r="string"==typeof e?k(e):e;if(!r)return[];const o=t(r).filter((({varId:e})=>N.has(e))).map((({memberNamePattern:e})=>e)).flatMap((e=>{if(e.includes("*")){if(null==n)return[];const r=new RegExp(`^${e.split(/\*+/).map(T).join(".*")}$`,"i");return n.filter((e=>r.test(e)))}return e.toLowerCase()}));return[...new Set(o.sort())]}function B(e){return o(e,"$view")}function H(e,n){return!!e&&o(e,n)}function K(e){if(!e||null==e.spatialReference&&(null==e.scale||null==e.viewingMode))return;let n,r;const{timeProperties:t,timeZone:o}=e;if(null!=t){const{currentStart:e,currentEnd:a}=t;null!=o?(n=null!=e?f.dateJSAndZoneToArcadeDate(e,o):null,r=null!=a?f.dateJSAndZoneToArcadeDate(a,o):null):(n=null!=e?f.dateJSToArcadeDate(e):null,r=null!=a?f.dateJSToArcadeDate(a):null)}return{view:e.viewingMode&&null!=e.scale?new m({viewingMode:e.viewingMode,scale:e.scale,timeProperties:null!=n||null!=r?new m({currentStart:n,currentEnd:r,startIncluded:!0,endIncluded:!0}):null}):null,sr:e.spatialReference}}function Q({url:e,spatialReference:n,lrucache:r,interceptor:t}){const o=u();return o?o.createFeatureSetCollectionFromService(e,n,r,t):null}function W({layer:e,spatialReference:n,outFields:r,returnGeometry:t,lrucache:o,interceptor:a}){if(null===e)return null;const i=u();return i?i.constructFeatureSet(e,n,r,t??!0,o,a):null}function X(e){if(null===e?.map)return null;const n=u();return n?n.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function Y(e,n){return m.convertJsonToArcade(e,n)}function _(e,n,r=[]){return a(e,n,r)}function ee(){return i()}function ne(){return l()}function re(e){return"type"in e&&("class-breaks"===e.type||"dictionary"===e.type||"dot-density"===e.type||"pie-chart"===e.type||"simple"===e.type||"unique-value"===e.type)}function te(e){return"esri.layers.support.LabelClass"===e.declaredClass}function oe(e){return"esri.PopupTemplate"===e.declaredClass}function ae(e,n){if(!e)return!1;if("string"==typeof e)return n(e);const r=e;if(re(r)){if("dot-density"===r.type){const e=r.attributes?.some((e=>n(e.valueExpression)));if(e)return e}const e=r.visualVariables,t=!!e&&e.some((e=>{let r=n(e.valueExpression);return"size"===e.type&&(ce(e.minSize)&&(r=r||n(e.minSize.valueExpression)),ce(e.maxSize)&&(r=r||n(e.maxSize.valueExpression))),r}));return!(!("valueExpression"in r)||!n(r.valueExpression))||t}if(te(r)){const e=r.labelExpressionInfo?.expression;return!(!e||!n(e))||!1}return!!oe(r)&&(!!r.expressionInfos&&r.expressionInfos.some((e=>n(e.expression)))||Array.isArray(r.content)&&r.content.some((e=>"expression"===e.type&&n(e.expressionInfo?.expression))))}function ie(e){const n=k(e);return!!n&&s(n)}function le(e){return ae(e,ie)}function ue(e){const n=k(e);return!!n&&c(n)}function se(e){return ae(e,ue)}function ce(e){return e&&"esri.renderers.visualVariables.SizeVariable"===e.declaredClass}export{m as Dictionary,d as arcadeFeature,W as convertFeatureLayerToFeatureSet,Y as convertJsonToArcade,X as convertMapToFeatureSetCollection,Q as convertServiceUrlToWorkspace,V as createExecContext,O as createFeature,J as createFunction,k as createSyntaxTree,B as dependsOnView,ne as enableFeatureSetOperations,ee as enableGeometryOperations,q as evalSyntaxTree,L as executeAsyncFunction,G as executeFunction,U as extractFieldNames,z as getArcadeType,K as getViewInfo,le as hasGeometryFunctions,se as hasGeometryOperations,H as hasVariable,_ as loadScriptDependencies,Z as updateExecContext};
5
+ import{p as e,c as n,e as r,a as t,r as o,l as a,b as i,d as l,f as u,s,g as c}from"../chunks/arcade.js";export{h as arcade}from"../chunks/arcade.js";import{ArcadeDate as f}from"../arcade/ArcadeDate.js";import{toSymbolId as p}from"../arcade/arcadeEnvironment.js";import m from"../arcade/Dictionary.js";import d from"../arcade/Feature.js";import{m as y,g as v,n as x,p as g,o as j}from"../chunks/languageUtils.js";export{Voxel}from"../arcade/Voxel.js";import{clone as S}from"../core/lang.js";import{DateOnly as w}from"../core/sql/DateOnly.js";import{TimeOnly as $}from"../core/sql/TimeOnly.js";import b from"../geometry/Extent.js";import E from"../geometry/Multipoint.js";import A from"../geometry/Point.js";import F from"../geometry/Polygon.js";import P from"../geometry/Polyline.js";import{isArray as C,isString as D,isBoolean as I,isNumber as M}from"./guards.js";const R={vars:{$feature:"any",$view:"any"}};function T(e){return e.replaceAll(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function z(e){return null==e?null:C(e)||y(e)?"array":v(e)?"date":D(e)?"text":I(e)?"boolean":M(e)?"number":e instanceof m?"dictionary":x(e)?"feature":e instanceof A?"point":e instanceof F?"polygon":e instanceof P?"polyline":e instanceof E?"multipoint":e instanceof b?"extent":e instanceof w?"dateOnly":e instanceof $?"time":g(e)?"featureSet":j(e)?"featureSetCollection":null}function k(n){if(!n)return null;try{return e(n)}catch(r){}return null}function J(e,r){const t="string"==typeof e?k(e):e;if(!t)return null;try{return r=r||S(R),n(t,r)}catch(o){}return null}function V(e,n,r){return{vars:{$feature:null==e?new d:d.createFromGraphic(e,r),$view:n?.view},spatialReference:n?.sr,timeZone:r??null}}function O(e,n,r){return d.createFromGraphicLikeObject(n,e,r,null)}function Z(e,n){null!=e.vars&&(e.vars.$feature=n)}function q(e,n){let t;try{t=r(e,n)}catch(o){t=null}return t}function G(e,n){let r;try{r=e?e(n):null}catch(t){r=null}return r}function L(e,n){try{return e?e(n):Promise.resolve(null)}catch(r){return Promise.resolve(null)}}const N=new Set(["$feature","$aggregatedFeatures","$voxel"].map((e=>p(e))));function U(e,n){if(!e)return[];const r="string"==typeof e?k(e):e;if(!r)return[];const o=t(r).filter((({varId:e})=>N.has(e))).map((({memberNamePattern:e})=>e)).flatMap((e=>{if(e.includes("*")){if(null==n)return[];const r=new RegExp(`^${e.split(/\*+/).map(T).join(".*")}$`,"i");return n.filter((e=>r.test(e)))}return e.toLowerCase()}));return[...new Set(o.sort())]}function B(e){return o(e,"$view")}function H(e,n){return!!e&&o(e,n)}function K(e){if(!e||null==e.spatialReference&&(null==e.scale||null==e.viewingMode))return;let n,r;const{timeProperties:t,timeZone:o}=e;if(null!=t){const{currentStart:e,currentEnd:a}=t;null!=o?(n=null!=e?f.dateJSAndZoneToArcadeDate(e,o):null,r=null!=a?f.dateJSAndZoneToArcadeDate(a,o):null):(n=null!=e?f.dateJSToArcadeDate(e):null,r=null!=a?f.dateJSToArcadeDate(a):null)}return{view:e.viewingMode&&null!=e.scale?new m({viewingMode:e.viewingMode,scale:e.scale,timeProperties:null!=n||null!=r?new m({currentStart:n,currentEnd:r,startIncluded:!0,endIncluded:!0}):null}):null,sr:e.spatialReference}}function Q({url:e,spatialReference:n,lrucache:r,interceptor:t}){const o=u();return o?o.createFeatureSetCollectionFromService(e,n,r,t):null}function W({layer:e,spatialReference:n,outFields:r,returnGeometry:t,lrucache:o,interceptor:a}){if(null===e)return null;const i=u();return i?i.constructFeatureSet(e,n,r,t??!0,o,a):null}function X(e){if(null===e?.map)return null;const n=u();return n?n.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function Y(e,n){return m.convertJsonToArcade(e,n)}function _(e,n,r=[]){return a(e,n,r)}function ee(){return i()}function ne(){return l()}function re(e){return"type"in e&&("class-breaks"===e.type||"dictionary"===e.type||"dot-density"===e.type||"pie-chart"===e.type||"simple"===e.type||"unique-value"===e.type)}function te(e){return"esri.layers.support.LabelClass"===e.declaredClass}function oe(e){return"esri.PopupTemplate"===e.declaredClass}function ae(e,n){if(!e)return!1;if("string"==typeof e)return n(e);const r=e;if(re(r)){if("dot-density"===r.type){const e=r.attributes?.some((e=>n(e.valueExpression)));if(e)return e}const e=r.visualVariables,t=!!e&&e.some((e=>{let r=n(e.valueExpression);return"size"===e.type&&(ce(e.minSize)&&(r=r||n(e.minSize.valueExpression)),ce(e.maxSize)&&(r=r||n(e.maxSize.valueExpression))),r}));return!(!("valueExpression"in r)||!n(r.valueExpression))||t}if(te(r)){const e=r.labelExpressionInfo?.expression;return!(!e||!n(e))||!1}return!!oe(r)&&(!!r.expressionInfos&&r.expressionInfos.some((e=>n(e.expression)))||Array.isArray(r.content)&&r.content.some((e=>"expression"===e.type&&n(e.expressionInfo?.expression))))}function ie(e){const n=k(e);return!!n&&s(n)}function le(e){return ae(e,ie)}function ue(e){const n=k(e);return!!n&&c(n)}function se(e){return ae(e,ue)}function ce(e){return e&&"esri.renderers.visualVariables.SizeVariable"===e.declaredClass}export{m as Dictionary,d as arcadeFeature,W as convertFeatureLayerToFeatureSet,Y as convertJsonToArcade,X as convertMapToFeatureSetCollection,Q as convertServiceUrlToWorkspace,V as createExecContext,O as createFeature,J as createFunction,k as createSyntaxTree,B as dependsOnView,ne as enableFeatureSetOperations,ee as enableGeometryOperations,q as evalSyntaxTree,L as executeAsyncFunction,G as executeFunction,U as extractFieldNames,z as getArcadeType,K as getViewInfo,le as hasGeometryFunctions,se as hasGeometryOperations,H as hasVariable,_ as loadScriptDependencies,Z as updateExecContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const a="20250212",d="6abe58272ad20e4931dc719097d0466046ba3a17";export{a as buildDate,d as commitHash};
5
+ const f="20250214",b="7eca24f19ebcd164b4495a93d3f5f0d3860161bf";export{f as buildDate,b 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.33/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.33/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.33/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.33/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?.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.33/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.33/esri/copyright.txt for details.
4
4
  */
5
- import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{fromRotation as i,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as r}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{set as o,sub as n,normalize as a,add as l,scale as h}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as c}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as m}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{generalizeOptimizedGeometry as d,convertToGeometry as u}from"../../../../../../../layers/graphics/featureConversionUtils.js";import f from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{getXAnchorDirection as g,getYAnchorDirection as p}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as _}from"../../../definitions.js";import{getDisplayIdTexel as x}from"../../../DisplayId.js";import{LabelMetric as M}from"../../../collisions/LabelMetric.js";import{smoothPaths as y,pathDivide as b}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as v,processColorInput as P}from"../fill/meshWriterUtils.js";import{TextMeshWriter as w,maxLabelZoom as L}from"../text/TextMeshWriter.js";const B=1,S=0,z=128,A=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class I extends w{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();this._writePoint(e,i,s,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,r]=i.coords;this._writePoint(e,s,r,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_createLineLabelMetric(e,t,i,s){const r=x(e),o="right"===this.evaluatedMeshParams.horizontalAlignment?-1:1,n="bottom"===this.evaluatedMeshParams.verticalAlignment?-1:1,a=this.evaluatedMeshParams.scaleInfo?.maxScale??0,l=this.evaluatedMeshParams.scaleInfo?.minScale??0;return new M(r,t,i,o,n,a,l,s??null)}_writePoint(e,t,i,s){const r=this._getShaping();if(!r)return;const o=s.getDisplayId(),n=g(this.evaluatedMeshParams.horizontalAlignment),a=p(this.evaluatedMeshParams.verticalAlignment),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0,c=x(s.getDisplayId()),m=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new M(c,t,i,n,a,l,h,m)),this._writeGlyphs(e,o,t,i,r,0,m),e.metricBoxWrite(r.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:s}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,s)=>this._placeSubdivGlyphs(e,t,i,s),a=(o.bounds.width+r)/(1<<B);this._current={out:e,id:t.getDisplayId(),shaping:o,zoomRange:v(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null},this._verticalPlacement="bottom"===s?"above":"top"===s?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=r.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new f;d(a,n,!1,!1,"esriGeometryPolyline",1);const l=D(new f,a,o),h=D(new f,a,-o),c=u(h,"esriGeometryPolyline",!1,!1),m=u(l,"esriGeometryPolyline",!1,!1),g=y(m.paths,r.bounds.width),p=y(c.paths,r.bounds.width);this._current.offsetDirection="above";for(const d of g)b(d,i,t,!!s);this._current.offsetDirection="below";for(const d of p)b(d,i,t,!!s)}_writeCenterAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=y(e.readLegacyGeometryForDisplay().paths,r.bounds.width);for(const n of o)b(n,i,t,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:r,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=A(t),h=this._current.shaping.bounds.width/(1<<B),c=Math.sqrt(n||z)/(1<<B),m=Math.min(i,s-i),d=this._current.shaping.isMultiline?L:Math.log2(m/(c+h/2)),u=0===t?d:Math.min(l,d),f=Math.max(a,this._zoomLevel+B-u),g=this._zoomLevel-f,p=this._current.shaping.bounds.width/2*2**g;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f):r&&g<0?this._placeStraightAlong(e,a):"parallel"===o?this._placeStraightAlong(e,f):"curved"===o&&this._placeCurved(e,f,p)}_placeStraight(e,t){const{out:i,id:s,shaping:r,referenceBounds:o}=this._current,{x:n,y:a}=e;i.metricStart(this._createLineLabelMetric(s,n,a)),i.metricBoxWrite(r.boundsT);const l=e.angle*(180/Math.PI)%360,h=(e.angle*(180/Math.PI)+180)%360;this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:l,mapAligned:!0,isLineLabel:!0,minZoom:t}),this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t}),i.metricEnd()}_placeCurved(e,t,i){const{out:s,id:r}=this._current;s.metricStart(this._createLineLabelMetric(r,e.x,e.y));const o=e.clone(),n=e.angle*(180/Math.PI)%360,a=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(o,t,1,n),this._placeBack(e,o,t,i,1,n),this._placeForward(e,o,t,i,1,n)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(o,t,0,a),this._placeBack(e,o,t,i,0,a),this._placeForward(e,o,t,i,0,a)),s.metricEnd()}_placeStraightAlong(e,o){const{out:n,id:a,shaping:l,zoomRange:h,referenceBounds:m}=this._current,{boxBorderLineColor:d,boxBackgroundColor:u}=this.evaluatedMeshParams,f=e.clone(),g=e.angle*(180/Math.PI)%360,p=(e.angle*(180/Math.PI)+180)%360,_=l.glyphs.length>0&&!(!d&&!u);if(n.metricStart(this._createLineLabelMetric(a,e.x,e.y)),_){const d=Math.max(o,h[0],0),u=Math.min(L,h[1]),f=i(r(),-e.angle),_={minZoom:d,maxZoom:u,clipAngle:g,mapAligned:!0,isLineLabel:!0},x=t(this.evaluatedMeshParams.offsetX),M=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=c(x,-1*M),[i,o]=l.shapeBackground(s(r(),f,t));n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding);const h=2*Math.max(i.width,i.height);n.recordBounds(e.x+i.x,e.y+i.y,h,h),this._writeTextBox(n,a,e.x,e.y,o,m,_),n.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=c(x,M),[i,o]=l.shapeBackground(s(r(),f,t));_.clipAngle=p,n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding);const h=2*Math.max(i.width,i.height);n.recordBounds(e.x+i.x,e.y+i.y,h,h),this._writeTextBox(n,a,e.x,e.y,o,m,_),n.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(f,o,1,g,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(f,o,0,p,!0),n.metricEnd()}_placeBack(e,t,i,s,r,o){const n=e.clone();let a=e.backwardLength+S;for(;n.prev()&&!(a>=s);)this._placeOnSegment(n,t,a,i,-1,r,o),a+=n.length+S}_placeForward(e,t,i,s,r,o){const n=e.clone();let a=e.remainingLength+S;for(;n.next()&&!(a>=s);)this._placeOnSegment(n,t,a,i,1,r,o),a+=n.length+S}_placeFirst(e,t,i,s,r=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:h}=this._current,c=a.glyphs;for(const m of c){const c=m.x>a.bounds.x?i:1-i,d=c*e.remainingLength+(1-c)*e.backwardLength,u=Math.abs(m.x+m.width/2-a.bounds.x),f=Math.max(0,this._zoomLevel+Math.log2(u/(d+S))),g=Math.max(t,r?0:f);m.maxZoom=Math.min(l[1],L),m.angle=e.angle+(1-i)*Math.PI,m.minZoom=Math.max(l[0],g),this._writeLineGlyph(o,n,e.x,e.y,a.bounds,m,s,h,!0),(i||this._current.offsetDirection)&&this._isVisible(m.minZoom,m.maxZoom)&&o.metricBoxWrite(m.bounds)}}_placeOnSegment(e,t,i,s,r,o,n){const{out:a,id:l,shaping:h,referenceBounds:c}=this._current,m=h.glyphs,d=e.dx/e.length,u=e.dy/e.length,f={x:e.x+i*-r*d,y:e.y+i*-r*u};for(const g of m){const t=g.x>h.bounds.x?o:1-o;if(!(t&&1===r||!t&&-1===r))continue;const m=Math.abs(g.x+g.width/2-h.bounds.x),d=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),u=Math.max(s,this._zoomLevel+Math.log2(m/(i+e.length+S)));0!==d&&(g.angle=e.angle+(1-o)*Math.PI,g.minZoom=u,g.maxZoom=d,this._writeLineGlyph(a,l,f.x,f.y,h.bounds,g,n,c,!0),(o||this._current.offsetDirection)&&this._isVisible(g.minZoom,g.maxZoom)&&a.metricBoxWrite(g.bounds))}}_writeLineGlyph(e,t,i,s,r,o,n,a,l){const h=i+r.x,c=s+r.y,m=2*(this.evaluatedMeshParams.minPixelBuffer?this.evaluatedMeshParams.minPixelBuffer/this._textMeshTransformProps.fontSize:1),d=Math.max(r.width,r.height)*m;e.recordStart(this.instanceId,this.attributeLayout,o.textureBinding),e.recordBounds(h,c,d,d);const{texcoords:u,offsets:f}=o,{fontSize:g,haloSize:p,outlineSize:_}=this._textMeshTransformProps;this._writeQuad(e,t,i,s,{texcoords:u,offsets:f,fontSize:g,haloSize:p,outlineSize:_,color:P(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o.minZoom),maxZoom:Math.min(this._current.zoomRange[1],o.maxZoom),clipAngle:n,mapAligned:l,isLineLabel:!0}),e.recordEnd()}_isVisible(e,t){const i=Math.floor(this._zoomLevel*_)/_;return e<=i&&i<=t}}function D(e,t,i){const{coords:s,lengths:r}=t,c=m(),d=m(),u=m(),f=m(),g=m(),p=m(),_=2;let x=0;for(let m=0;m<r.length;m++){const t=r[m];for(let r=0;r<t;r++){const m=_*(r+x-1),M=_*(r+x),y=_*(r+x+1);r>0?o(c,s[m],s[m+1]):o(c,0,0),o(d,s[M],s[M+1]),r<t-1?o(u,s[y],s[y+1]):o(u,0,0),0===r?o(f,0,0):(n(f,d,c),a(f,f),o(f,f[1],-f[0])),r===t-1?o(g,0,0):(n(g,u,d),a(g,g),o(g,g[1],-g[0])),l(p,f,g),a(p,p);const b=p[0]*g[0]+p[1]*g[1];0!==b&&h(p,p,b),h(p,p,i),e.coords.push(d[0]+p[0],d[1]+p[1])}e.lengths.push(t),x+=t}return e}export{I as LabelMeshWriter};
5
+ import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{fromRotation as i,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as r}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as n,sub as a,normalize as l,add as h,scale as c}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{generalizeOptimizedGeometry as u,convertToGeometry as f}from"../../../../../../../layers/graphics/featureConversionUtils.js";import g from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{getXAnchorDirection as p,getYAnchorDirection as _}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as x}from"../../../definitions.js";import{getDisplayIdTexel as M}from"../../../DisplayId.js";import b from"../../../collisions/BoundingBox.js";import{LabelMetric as y}from"../../../collisions/LabelMetric.js";import{smoothPaths as v,pathDivide as P}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as w,processColorInput as L}from"../fill/meshWriterUtils.js";import{TextMeshWriter as B,maxLabelZoom as S}from"../text/TextMeshWriter.js";const z=1,A=0,D=128,I=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class G extends B{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();this._writePoint(e,i,s,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,r]=i.coords;this._writePoint(e,s,r,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,s){const r=M(e),[o,n]=this._getMetricDir(),a=this.evaluatedMeshParams.scaleInfo?.maxScale??0,l=this.evaluatedMeshParams.scaleInfo?.minScale??0;return new y(r,t,i,o,n,a,l,s??null)}_writePoint(e,t,i,s){const r=this._getShaping();if(!r)return;const o=s.getDisplayId(),n=p(this.evaluatedMeshParams.horizontalAlignment),a=_(this.evaluatedMeshParams.verticalAlignment),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0,c=M(s.getDisplayId()),m=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new y(c,t,i,n,a,l,h,m)),this._writeGlyphs(e,o,t,i,r,0,m),e.metricBoxWrite(r.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:s}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,s)=>this._placeSubdivGlyphs(e,t,i,s),a=(o.bounds.width+r)/(1<<z);this._current={out:e,id:t.getDisplayId(),shaping:o,zoomRange:w(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null},this._verticalPlacement="bottom"===s?"above":"top"===s?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=r.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new g;u(a,n,!1,!1,"esriGeometryPolyline",1);const l=j(new g,a,o),h=j(new g,a,-o),c=f(h,"esriGeometryPolyline",!1,!1),m=f(l,"esriGeometryPolyline",!1,!1),d=v(m.paths,r.bounds.width),p=v(c.paths,r.bounds.width);this._current.offsetDirection="above";for(const u of d)P(u,i,t,!!s);this._current.offsetDirection="below";for(const u of p)P(u,i,t,!!s)}_writeCenterAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=v(e.readLegacyGeometryForDisplay().paths,r.bounds.width);for(const n of o)P(n,i,t,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:r,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=I(t),h=this._current.shaping.bounds.width/(1<<z),c=Math.sqrt(n||D)/(1<<z),m=Math.min(i,s-i),d=this._current.shaping.isMultiline?S:Math.log2(m/(c+h/2)),u=0===t?d:Math.min(l,d),f=Math.max(a,this._zoomLevel+z-u),g=this._zoomLevel-f,p=this._current.shaping.bounds.width/2*2**g;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f):r&&g<0?this._placeStraightAlong(e,a):"parallel"===o?this._placeStraightAlong(e,f):"curved"===o&&this._placeCurved(e,f,p)}_placeStraight(e,t){const{out:i,id:s,shaping:r,referenceBounds:o}=this._current,{x:n,y:a}=e;i.metricStart(this._createLineLabelMetric(s,n,a)),i.metricBoxWrite(r.boundsT);const l=e.angle*(180/Math.PI)%360,h=(e.angle*(180/Math.PI)+180)%360;this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:l,mapAligned:!0,isLineLabel:!0,minZoom:t}),this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t}),i.metricEnd()}_placeCurved(e,t,i){const{out:s,id:r}=this._current;s.metricStart(this._createLineLabelMetric(r,e.x,e.y));const o=e.clone(),n=e.angle*(180/Math.PI)%360,a=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(o,t,1,n),this._placeBack(e,o,t,i,1,n),this._placeForward(e,o,t,i,1,n)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(o,t,0,a),this._placeBack(e,o,t,i,0,a),this._placeForward(e,o,t,i,0,a)),s.metricEnd()}_placeStraightAlong(e,o){const{out:n,id:a,shaping:l,zoomRange:h,referenceBounds:c}=this._current,{boxBorderLineColor:d,boxBackgroundColor:u}=this.evaluatedMeshParams,f=e.clone(),g=e.angle*(180/Math.PI)%360,p=(e.angle*(180/Math.PI)+180)%360,_=l.glyphs.length>0&&!(!d&&!u);if(n.metricStart(this._createLineLabelMetric(a,e.x,e.y)),_){const d=Math.max(o,h[0],0),u=Math.min(S,h[1]),f=i(r(),-e.angle),_={minZoom:d,maxZoom:u,clipAngle:g,mapAligned:!0,isLineLabel:!0},x=t(this.evaluatedMeshParams.offsetX),M=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=m(x,-1*M),[i,o]=l.shapeBackground(s(r(),f,t));n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding);const h=2*Math.max(i.width,i.height);n.recordBounds(e.x+i.x,e.y+i.y,h,h),this._writeTextBox(n,a,e.x,e.y,o,c,_),n.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=m(x,M),[i,o]=l.shapeBackground(s(r(),f,t));_.clipAngle=p,n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding);const h=2*Math.max(i.width,i.height);n.recordBounds(e.x+i.x,e.y+i.y,h,h),this._writeTextBox(n,a,e.x,e.y,o,c,_),n.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(f,o,1,g,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(f,o,0,p,!0),n.metricEnd()}_placeBack(e,t,i,s,r,o){const n=e.clone();let a=e.backwardLength+A;for(;n.prev()&&!(a>=s);)this._placeOnSegment(n,t,a,i,-1,r,o),a+=n.length+A}_placeForward(e,t,i,s,r,o){const n=e.clone();let a=e.remainingLength+A;for(;n.next()&&!(a>=s);)this._placeOnSegment(n,t,a,i,1,r,o),a+=n.length+A}_placeFirst(e,s,n,a,l=!1){const{out:h,id:c,shaping:d,zoomRange:u,referenceBounds:f}=this._current,g=d.glyphs,p=t(this.evaluatedMeshParams.offsetX),_=t(this.evaluatedMeshParams.offsetY),x=m(p,_),M=i(r(),-e.angle);o(x,x,M);for(const t of g){const i=t.x>d.bounds.x?n:1-n,r=i*e.remainingLength+(1-i)*e.backwardLength,o=Math.abs(t.x+t.width/2-d.bounds.x),m=Math.max(0,this._zoomLevel+Math.log2(o/(r+A))),g=Math.max(s,l?0:m);if(t.maxZoom=Math.min(u[1],S),t.angle=e.angle+(1-n)*Math.PI,t.minZoom=Math.max(u[0],g),this._writeLineGlyph(h,c,e.x,e.y,d.bounds,t,a,f,!0),(n||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom)){const e=new b(t.bounds.x+x[0],t.bounds.y+x[1],t.bounds.width,t.bounds.height);h.metricBoxWrite(e)}}}_placeOnSegment(e,s,n,a,l,h,c){const{out:d,id:u,shaping:f,referenceBounds:g}=this._current,p=f.glyphs,_=e.dx/e.length,x=e.dy/e.length,M={x:e.x+n*-l*_,y:e.y+n*-l*x},y=t(this.evaluatedMeshParams.offsetX),v=t(this.evaluatedMeshParams.offsetY),P=m(y,v),w=i(r(),-e.angle);o(P,P,w);for(const t of p){const i=t.x>f.bounds.x?h:1-h;if(!(i&&1===l||!i&&-1===l))continue;const s=Math.abs(t.x+t.width/2-f.bounds.x),r=Math.max(0,this._zoomLevel+Math.log2(s/n)-.1),o=Math.max(a,this._zoomLevel+Math.log2(s/(n+e.length+A)));if(0!==r&&(t.angle=e.angle+(1-h)*Math.PI,t.minZoom=o,t.maxZoom=r,this._writeLineGlyph(d,u,M.x,M.y,f.bounds,t,c,g,!0),(h||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom))){const e=new b(t.bounds.x+P[0],t.bounds.y+P[1],t.bounds.width,t.bounds.height);d.metricBoxWrite(e)}}}_writeLineGlyph(e,t,i,s,r,o,n,a,l){const h=i+r.x,c=s+r.y,m=2*(this.evaluatedMeshParams.minPixelBuffer?this.evaluatedMeshParams.minPixelBuffer/this._textMeshTransformProps.fontSize:1),d=Math.max(r.width,r.height)*m;e.recordStart(this.instanceId,this.attributeLayout,o.textureBinding),e.recordBounds(h,c,d,d);const{texcoords:u,offsets:f}=o,{fontSize:g,haloSize:p,outlineSize:_}=this._textMeshTransformProps;this._writeQuad(e,t,i,s,{texcoords:u,offsets:f,fontSize:g,haloSize:p,outlineSize:_,color:L(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o.minZoom),maxZoom:Math.min(this._current.zoomRange[1],o.maxZoom),clipAngle:n,mapAligned:l,isLineLabel:!0}),e.recordEnd()}_isVisible(e,t){const i=Math.floor(this._zoomLevel*x)/x;return e<=i&&i<=t}}function j(e,t,i){const{coords:s,lengths:r}=t,o=d(),m=d(),u=d(),f=d(),g=d(),p=d(),_=2;let x=0;for(let d=0;d<r.length;d++){const t=r[d];for(let r=0;r<t;r++){const d=_*(r+x-1),M=_*(r+x),b=_*(r+x+1);r>0?n(o,s[d],s[d+1]):n(o,0,0),n(m,s[M],s[M+1]),r<t-1?n(u,s[b],s[b+1]):n(u,0,0),0===r?n(f,0,0):(a(f,m,o),l(f,f),n(f,f[1],-f[0])),r===t-1?n(g,0,0):(a(g,u,m),l(g,g),n(g,g[1],-g[0])),h(p,f,g),l(p,p);const y=p[0]*g[0]+p[1]*g[1];0!==y&&c(p,p,y),c(p,p,i),e.coords.push(m[0]+p[0],m[1]+p[1])}e.lengths.push(t),x+=t}return e}export{G as LabelMeshWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/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.33/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as m}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as p,convertToGeometry as f,convertFromNestedArray as g}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,TrackPart as I,externalTrackLineOidPrefix as v,internalTimeReceivedField as F}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as k}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as j}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as S}from"./AAggregateStrategy.js";import{ASendState as T}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as x}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as R}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as L}from"../support/ComputedAttributeStorage.js";import w from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as A}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as G}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as D}from"../support/FeatureSetReaderJSON.js";let C;const P=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),M=32;class W{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class z{static getOid(t){return v+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new b}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes??{},aggregateId:this.objectId,[y]:I.TrackLine};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}stageObservation(t,e){this._nextObservationRecords.push(new W(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e){const r=new Set(this._nextObservationRecords.map((t=>t.objectId))),i=this._observationRecords.filter((t=>!r.has(t.objectId))).map((t=>t.objectId));let a,o;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort(((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0})),this._schema.timeField){case"startTimeField":a=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":a=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":a=this._isStream?F:null}o=this._isStream?e?.end??Date.now():e?.end??-1/0;const n=t.map((t=>t.reader.getCursor()));let l;for(let c=this._nextObservationRecords.length-1;c>=0&&!(this._observationRecords.length>=this._schema.maxDisplayObservations);c--){const t=this._nextObservationRecords[c],e=n[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=a?e.readAttributeAsTimestamp(a):null;(null!=r?o-r:0)>=this._schema.maxDisplayDuration||(this._commitObservation(t,e),l??=t)}if(null!=l){const{chunkIndex:t,featureIndex:e,objectId:r,displayId:i}=l,a=n[t];s(a),a.setIndex(e);const o=new _(a.readGeometryWorldSpace(),{...a.readAttributes(),[y]:I.LatestObservation},null,r,i);this._latestObservationFeature=o}else this._latestObservationFeature=null;return this._trackLineGeometry=E(this._trackLineGeometry,this._trackLinePath,this._spatialReference),this._bounds=Z(this._trackLineGeometry),this._nextObservationRecords=[],i}updateStatistics(t,e){this._statistics=j.create(this._fields);const r=t.map((t=>t.reader.getCursor()));for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,M))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=new b;p(a,r,!1,!1,this._metadata.geometryType,t.subscription.tile.transform);const o=l(1/0,1/0,-1/0,-1/0);X(a,((t,e)=>u(o,[t,e])));if(!c(o,l(0,0,k,k)))return null;return new _(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=new b;p(e,this._trackLineGeometry,!1,!1,"esriGeometryPolyline",t.subscription.tile.transform);return new _(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new _(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class U extends T{constructor(t){super(t),this.done=!1}}class q extends S{static async create(t,e,s,a,o,n){const l=new L({spatialReference:e}),c=await Promise.all(t.fields.map((async t=>O.create(l,t)))),d=t.featureFilter?await w.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then((([t,e,s])=>{C={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}})),new q(t,s,a,e,c,d,o,n)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=A.createFeature({geometryType:"esriGeometryPolyline",objectIdField:"aggregateId",fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}createState(t){return new U(t)}async*applyOverrideUpdate(t){P().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null==t)for(const e of a.observations()){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId)}}else{const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId)}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map((t=>t.reader.getCursor()));for(const a of this._tracks.values()){e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature());for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,attributes:{},...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),(t=>t.objectId));return[]}async*updateChunks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r].reader.getCursor();for(;i.next();){const t=i.readAttribute(e),a=i.getObjectId();if(null!=t&&null!=a&&(null===this._featureFilter||this._featureFilter.check(i,this._sqlOptions))){if(i.getDisplayId()||i.setDisplayId(this._attributeStore.createDisplayIdForObjectId(a)),!this._tracks.has(t)){const e=z.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new z(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,i),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,R(1,this._arcadeContextInfo))}else this._removeTrack(r);for(const r of this._sendStates.values())yield*this._update(r)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=D.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=D.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map((()=>[]));for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map(((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=G.from(i,s[r]);return a.setProcessorAttributes({[y]:I.PreviousObservation}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a})).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new x(e.subscription,a,!0,!1,{});for(const t of o)yield new x(e.subscription,t,!1,!1,{});yield new x(e.subscription,i,!1,e.done,{})}}function E(t,e,s){if(e.length<2)return g(t,[e],!1,!1);if(s.isWrappable){let r=!1;for(let t=1;t<e.length;t++){const i=e[t][0],a=h(i,e[t-1][0],s);i!==a&&(e[t][0]=a,r=!0)}if(r){const r=m({paths:[e],spatialReference:s});if(null!=r)return g(t,r.paths,!1,!1)}return g(t,[e],!1,!1)}const r=C.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),i=C.fromSpatialReference(s);if(null!=i){const e=a(r,1e6,i,o.geodesic);if(null!=e){const s=C.toGeometry(e,i);if(null!=s&&"paths"in s)return g(t,s.paths,!1,!1)}}return g(t,[e],!1,!1)}function X(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function Z(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{q as TrackStrategy};
5
+ import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as m}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as p,convertToGeometry as f,convertFromNestedArray as g}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,TrackPart as I,externalTrackLineOidPrefix as v,internalTimeReceivedField as k}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as F}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as j}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as x}from"./AAggregateStrategy.js";import{ASendState as T}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as S}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as R}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as D}from"../support/ComputedAttributeStorage.js";import L from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as w}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as A}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as G}from"../support/FeatureSetReaderJSON.js";let P;const C=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),M=32;class W{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class z{static getOid(t){return v+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new b}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes??{},aggregateId:this.objectId,[y]:I.TrackLine};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}stageObservation(t,e){this._nextObservationRecords.push(new W(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e){const r=new Set(this._nextObservationRecords.map((t=>t.objectId))),i=this._observationRecords.filter((t=>!r.has(t.objectId))).map((t=>t.objectId));let a,o;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort(((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0})),this._schema.timeField){case"startTimeField":a=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":a=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":a=this._isStream?k:null}o=this._isStream?e?.end??Date.now():e?.end??-1/0;const n=t.map((t=>t.reader.getCursor()));let l;for(let c=this._nextObservationRecords.length-1;c>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);c--){const t=this._nextObservationRecords[c],e=n[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=a?e.readAttributeAsTimestamp(a):null;(null!=r?o-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),l??=t)}if(null!=l){const{chunkIndex:t,featureIndex:e,objectId:r,displayId:i}=l,a=n[t];s(a),a.setIndex(e);const o=new _(a.readGeometryWorldSpace(),{...a.readAttributes(),[y]:I.LatestObservation},null,r,i);this._latestObservationFeature=o}else this._latestObservationFeature=null;return this._trackLineGeometry=E(this._trackLineGeometry,this._trackLinePath,this._spatialReference),this._bounds=Z(this._trackLineGeometry),this._nextObservationRecords=[],i}updateStatistics(t,e){this._statistics=j.create(this._fields);const r=t.map((t=>t.reader.getCursor()));for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,M))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=new b;p(a,r,!1,!1,this._metadata.geometryType,t.subscription.tile.transform);const o=l(1/0,1/0,-1/0,-1/0);X(a,((t,e)=>u(o,[t,e])));if(!c(o,l(0,0,F,F)))return null;return new _(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=new b;p(e,this._trackLineGeometry,!1,!1,"esriGeometryPolyline",t.subscription.tile.transform);return new _(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new _(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class U extends T{constructor(t){super(t),this.done=!1}}class q extends x{static async create(t,e,s,a,o,n){const l=new D({spatialReference:e}),c=await Promise.all(t.fields.map((async t=>O.create(l,t)))),d=t.featureFilter?await L.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then((([t,e,s])=>{P={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}})),new q(t,s,a,e,c,d,o,n)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=w.createFeature({geometryType:"esriGeometryPolyline",objectIdField:"aggregateId",fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}createState(t){return new U(t)}async*applyOverrideUpdate(t){C().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null==t)for(const e of a.observations()){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId)}}else{const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId)}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map((t=>t.reader.getCursor()));for(const a of this._tracks.values()){e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature());for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,attributes:{},...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),(t=>t.objectId));return[]}async*updateChunks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r].reader.getCursor();for(;i.next();){const t=i.readAttribute(e),a=i.getObjectId();if(null!=t&&null!=a&&(null===this._featureFilter||this._featureFilter.check(i,this._sqlOptions))){if(i.getDisplayId()||i.setDisplayId(this._attributeStore.createDisplayIdForObjectId(a)),!this._tracks.has(t)){const e=z.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new z(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,i),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,R(1,this._arcadeContextInfo))}else this._removeTrack(r);for(const r of this._sendStates.values())yield*this._update(r)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=G.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=G.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map((()=>[]));for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map(((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=A.from(i,s[r]);return a.setProcessorAttributes({[y]:I.PreviousObservation}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a})).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new S(e.subscription,a,!0,!1,{});for(const t of o)yield new S(e.subscription,t,!1,!1,{});yield new S(e.subscription,i,!1,e.done,{})}}function E(t,e,s){if(e.length<2)return g(t,[e],!1,!1);if(s.isWrappable){let r=!1;for(let t=1;t<e.length;t++){const i=e[t][0],a=h(i,e[t-1][0],s);i!==a&&(e[t][0]=a,r=!0)}if(r){const r=m({paths:[e],spatialReference:s});if(null!=r)return g(t,r.paths,!1,!1)}return g(t,[e],!1,!1)}const r=P.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),i=P.fromSpatialReference(s);if(null!=i){const e=a(r,1e6,i,o.geodesic);if(null!=e){const s=P.toGeometry(e,i);if(null!=s&&"paths"in s)return g(t,s.paths,!1,!1)}}return g(t,[e],!1,!1)}function X(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function Z(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{q as TrackStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{TechniqueType as t}from"../../../../engine/webgl/shaderGraph/techniques/TechniqueType.js";import{createLabelMatcherSchema as s}from"./LabelMatcherSchema.js";import{createMatcherSchema as i}from"./MatcherSchema.js";import{createStorageSchema as n,createTrackStorageSchema as a}from"./StorageSchema.js";import{createVisualVariableUniforms as o}from"./VisualVariablesSchema.js";async function l(e,r){const t=r.renderer,n=o(t);return{symbology:await i(e,t),labels:await s(e,r,n)}}async function u(e,r,t,s){const i=t.featureReduction;if(i)switch(i.type){case"binning":return p(i,e,r,t,s);case"cluster":return y(i,e,r,t,s)}if(t.trackInfo?.enabled)return b(t.trackInfo,e,r,t,s);const a=m(t.orderBy,t.renderer,t.objectIdField),o=n(t.renderer,r.filters),u=await l(e,t),c=g(u.symbology);return{storage:o,mesh:{properties:{sortKey:a,timeZone:r.timeZone,returnMeshObjectId:c,displayRefreshVersion:s,currentUser:r.currentUser},strategy:{type:"feature"},factory:u},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}function c(e,r){return e.fields.map((e=>({...e.toJSON(),type:f(e,r)})))}function f(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find((e=>e.name===s));return e?e.type:"esriFieldTypeString"}}}async function p(r,t,a,l,u){const f=c(r,l.fields),p=r.renderer,y=await i(t,p),b=n(p,[null,null]),m=o(p),d=await s(t,{geometryType:"polygon",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},m),v=g(y),h="geohash"===r.binType?{type:"geohash",fixBinLevel:r.fixedBinLevel??3}:{type:"grid",size:e(r.size),fixedBinLevel:r.fixedBinLevel};return{storage:b,mesh:{properties:{sortKey:null,timeZone:a.timeZone,returnMeshObjectId:v,displayRefreshVersion:u,currentUser:a.currentUser},strategy:{type:"binning",fields:f,index:h,featureFilter:a.filters[0]},factory:{labels:d,symbology:y}},expressionProperties:{timeExtent:a.timeExtent?.toJSON()}}}async function y(r,t,a,l,u){const f=c(r,l.fields),p={type:"cluster",feature:await i(t,r.effectiveFeatureRenderer),cluster:await i(t,r.effectiveClusterRenderer)},y=o(r.effectiveFeatureRenderer),b={type:"cluster",feature:await s(t,l,y),cluster:await s(t,{geometryType:"point",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},y)},m=n(r.effectiveFeatureRenderer,[null,null]),d=g(p);return{storage:m,mesh:{properties:{sortKey:null,timeZone:a.timeZone,displayRefreshVersion:u,returnMeshObjectId:d,currentUser:a.currentUser},strategy:{type:"cluster",fields:f,featureFilter:a.filters[0],clusterRadius:e(r.clusterRadius/2)},factory:{labels:b,symbology:p}},expressionProperties:{timeExtent:a.timeExtent?.toJSON()}}}async function b(e,r,t,n,l){const u=c(e,n.fields),f={type:"track",previousObservation:await i(r,e.previousObservations.renderer),latestObservation:await i(r,e.latestObservations.renderer),trackLine:await i(r,e.trackLines.renderer)},p={type:"track",previousObservation:await s(r,{geometryType:n.geometryType,labelingInfo:e.previousObservations.labelingInfo,labelsVisible:e.previousObservations.labelsVisible},o(e.previousObservations.renderer)),latestObservation:await s(r,{geometryType:n.geometryType,labelingInfo:e.latestObservations.labelingInfo,labelsVisible:e.latestObservations.labelsVisible},o(e.latestObservations.renderer)),trackLine:await s(r,{geometryType:"polyline",labelingInfo:e.trackLines.labelingInfo,labelsVisible:e.trackLines.labelsVisible},o(e.trackLines.renderer))},y=a(e,[null,null]),b=g(f);return{storage:y,mesh:{properties:{sortKey:null,timeZone:t.timeZone,returnMeshObjectId:b,displayRefreshVersion:l,currentUser:t.currentUser},strategy:{type:"track",featureFilter:t.filters[0],fields:u,maxDisplayDuration:e.maxDisplayDuration,maxDisplayObservations:e.maxDisplayObservations,showLatestObservation:e.latestObservations.visible,showPreviousObservations:e.previousObservations.visible,showTrackLine:e.trackLines.visible,timeField:e.timeField},factory:{labels:p,symbology:f}},expressionProperties:{timeExtent:t.timeExtent?.toJSON()}}}function m(e,t,s){const i=null!=t&&"unique-value"===t.type&&t.orderByClassesEnabled;if("default"!==e||i||(e=[new r({field:s,order:"descending"})]),"default"!==e&&e?.length){e.length;const r=e[0],t="ascending"===r.order?"asc":"desc";return r.field?{field:r.field,order:t}:r.valueExpression?{expression:r.valueExpression,order:t}:null}if(i){return{byRenderer:!0,order:"asc"}}return null}function d(e){return e.techniqueType===t.AnimatedMarker}function g(e){if("simple"===e.type&&e.meshes.some(d))return!0;if("interval"===e.type){if(e.intervals.some((e=>e.meshes.some(d))))return!0;if(e.backgroundFill.some(d))return!0}if("map"===e.type){if(e.map.some((e=>e.symbol.some(d))))return!0;if(e.backgroundFill.some(d))return!0}return!1}export{u as createSimpleProcessorSchema,c as getAggregateFields};
5
+ import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{TechniqueType as t}from"../../../../engine/webgl/shaderGraph/techniques/TechniqueType.js";import{createLabelMatcherSchema as s}from"./LabelMatcherSchema.js";import{createMatcherSchema as i}from"./MatcherSchema.js";import{createStorageSchema as n,createTrackStorageSchema as a}from"./StorageSchema.js";import{createVisualVariableUniforms as o}from"./VisualVariablesSchema.js";async function l(e,r){const t=r.renderer,n=o(t);return{symbology:await i(e,t),labels:await s(e,r,n)}}async function u(e,r,t,s){const i=t.featureReduction;if(i)switch(i.type){case"binning":return p(i,e,r,t,s);case"cluster":return y(i,e,r,t,s)}if(t.trackInfo?.enabled)return b(t.trackInfo,e,r,t,s);const a=m(t.orderBy,t.renderer,t.objectIdField),o=n(t.renderer,r.filters),u=await l(e,t),c=g(u.symbology);return{storage:o,mesh:{properties:{sortKey:a,timeZone:r.timeZone,returnMeshObjectId:c,displayRefreshVersion:s,currentUser:r.currentUser},strategy:{type:"feature"},factory:u},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}function c(e,r){return e.fields.map((e=>({...e.toJSON(),type:f(e,r)})))}function f(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find((e=>e.name===s));return e?e.type:"esriFieldTypeString"}}}async function p(r,t,a,l,u){const f=c(r,l.fields),p=r.renderer,y=await i(t,p),b=n(p,[null,null]),m=o(p),d=await s(t,{geometryType:"polygon",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},m),v=g(y),h="geohash"===r.binType?{type:"geohash",fixBinLevel:r.fixedBinLevel??3}:{type:"grid",size:e(r.size),fixedBinLevel:r.fixedBinLevel};return{storage:b,mesh:{properties:{sortKey:null,timeZone:a.timeZone,returnMeshObjectId:v,displayRefreshVersion:u,currentUser:a.currentUser},strategy:{type:"binning",fields:f,index:h,featureFilter:a.filters[0]},factory:{labels:d,symbology:y}},expressionProperties:{timeExtent:a.timeExtent?.toJSON()}}}async function y(r,t,a,l,u){const f=c(r,l.fields),p={type:"cluster",feature:await i(t,r.effectiveFeatureRenderer),cluster:await i(t,r.effectiveClusterRenderer)},y=o(r.effectiveFeatureRenderer),b={type:"cluster",feature:await s(t,l,y),cluster:await s(t,{geometryType:"point",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},y)},m=n(r.effectiveFeatureRenderer,[null,null]),d=g(p);return{storage:m,mesh:{properties:{sortKey:null,timeZone:a.timeZone,displayRefreshVersion:u,returnMeshObjectId:d,currentUser:a.currentUser},strategy:{type:"cluster",fields:f,featureFilter:a.filters[0],clusterRadius:e(r.clusterRadius/2)},factory:{labels:b,symbology:p}},expressionProperties:{timeExtent:a.timeExtent?.toJSON()}}}async function b(e,r,t,n,l){const u=c(e,n.fields),f={type:"track",previousObservation:await i(r,e.previousObservations.renderer),latestObservation:await i(r,e.latestObservations.renderer),trackLine:await i(r,e.trackLines.renderer)},p={type:"track",previousObservation:await s(r,{geometryType:n.geometryType,labelingInfo:e.previousObservations.labelingInfo,labelsVisible:e.previousObservations.labelsVisible},o(e.previousObservations.renderer)),latestObservation:await s(r,{geometryType:n.geometryType,labelingInfo:e.latestObservations.labelingInfo,labelsVisible:e.latestObservations.labelsVisible},o(e.latestObservations.renderer)),trackLine:await s(r,{geometryType:"polyline",labelingInfo:e.trackLines.labelingInfo,labelsVisible:e.trackLines.labelsVisible},o(e.trackLines.renderer))},y=a(e,[null,null]),b=g(f);return{storage:y,mesh:{properties:{sortKey:null,timeZone:t.timeZone,returnMeshObjectId:b,displayRefreshVersion:l,currentUser:t.currentUser},strategy:{type:"track",featureFilter:t.filters[0],fields:u,maxDisplayDuration:e.maxDisplayDuration?.toMilliseconds()??0,maxDisplayObservationsPerTrack:e.maxDisplayObservationsPerTrack,showLatestObservation:e.latestObservations.visible,showPreviousObservations:e.previousObservations.visible,showTrackLine:e.trackLines.visible,timeField:e.timeField},factory:{labels:p,symbology:f}},expressionProperties:{timeExtent:t.timeExtent?.toJSON()}}}function m(e,t,s){const i=null!=t&&"unique-value"===t.type&&t.orderByClassesEnabled;if("default"!==e||i||(e=[new r({field:s,order:"descending"})]),"default"!==e&&e?.length){e.length;const r=e[0],t="ascending"===r.order?"asc":"desc";return r.field?{field:r.field,order:t}:r.valueExpression?{expression:r.valueExpression,order:t}:null}if(i){return{byRenderer:!0,order:"asc"}}return null}function d(e){return e.techniqueType===t.AnimatedMarker}function g(e){if("simple"===e.type&&e.meshes.some(d))return!0;if("interval"===e.type){if(e.intervals.some((e=>e.meshes.some(d))))return!0;if(e.backgroundFill.some(d))return!0}if("map"===e.type){if(e.map.some((e=>e.symbol.some(d))))return!0;if(e.backgroundFill.some(d))return!0}return!1}export{u as createSimpleProcessorSchema,c as getAggregateFields};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";const s=1e4,r=1e3;class i{constructor(){this.modified=[],this.removed=[]}modify(e){this.modified.push(e)}remove(e){this.removed.push(e)}get isEmpty(){return 0===this.modified.length&&0===this.removed.length}}class o extends e{constructor(e){super(),this._reader=e,this.chunkId="override",this.normalizedChunkId="override"}static fromFeatures(e,s){const r=t.fromOptimizedFeatures(e,s);return new o(r)}get reader(){return this._reader}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}getTileReader(e){if(!this._reader.getSize())return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class n{constructor(e,t){this.inner=e,this.isWeak=t,this.lastWeak=null}}class a{constructor(){this._overrides=new Map,this._update=new i,this._lastCleanup=0}hasOverride(e){return this._overrides.has(e)}onChunkInsert(e){if(this._overrides.size){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId(),s=this._overrides.get(e);if(s?.lastWeak&&(s.lastWeak=null),s?.isWeak){const e=t.readOptimizedFeatureWorldSpace();s.inner=e,this._update.modify(e),this.invalidate()}}}e.registerOverrides(this)}apply(e,t){const{updateWeak:s,removeWeak:r,update:i,remove:o,release:a}=e.commands;this.invalidate();for(const d of s)this._overrides.set(d.objectId,new n(d,!0)),this._update.modify(d);for(const d of i){const e=new n(d,!1),t=this._overrides.get(d.objectId);t?.isWeak&&(e.lastWeak=t),this._overrides.set(d.objectId,e),this._update.modify(d)}for(const d of r)this._overrides.set(d,new n(null,!0)),this._update.remove(d);for(const d of o){const e=new n(null,!1),t=this._overrides.get(d);t?.isWeak&&(e.lastWeak=t),this._overrides.set(d,e),this._update.remove(d)}if(a.length){const e=new Set;for(const t of a){const s=this._overrides.get(t);s?.lastWeak?this._overrides.set(t,s.lastWeak):s&&!s.isWeak&&(this._overrides.delete(t),e.add(t))}t.forEachUnsafe((t=>{const s=t.getObjectId();e.has(s)&&(this._update.modify(t.readOptimizedFeatureWorldSpace()),e.delete(s))}));for(const t of e.values())this._update.remove(t)}}cleanup(e){if(this._overrides.size<s)return;const t=performance.now();if(t-this._lastCleanup<r)return;this._lastCleanup=t;const i=this._getWeakDeletions();if(!(i.size<s)){for(const t of e){const e=t.reader.withoutOverrides().getCursor();for(;e.next();){const t=e.getObjectId();i.delete(t)}}for(const e of i)this._overrides.delete(e)}}takeOverrideUpdate(){const e=this._update;return e.isEmpty?null:(this._update=new i,e)}asChunk(e){if(!this._chunk){const t=[];for(const e of this._overrides.values())null!=e.inner&&t.push(e.inner);this._chunk=o.fromFeatures(t,e)}return this._chunk}invalidate(){this._chunk=null}_getWeakDeletions(){const e=new Set;for(const[t,s]of this._overrides.entries())s.isWeak&&null==s.inner&&e.add(t);return e}}export{o as OverrideChunk,a as OverrideState,i as OverrideUpdate};
5
+ import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";const s=1e4,r=1e3;class i{constructor(){this.modified=[],this.removed=[]}modify(e){this.modified.push(e)}remove(e){this.removed.push(e)}get isEmpty(){return 0===this.modified.length&&0===this.removed.length}}class o extends e{constructor(e){super(),this._reader=e,this.chunkId="override",this.normalizedChunkId="override"}static fromFeatures(e,s){const r=t.fromOptimizedFeatures(e,s);return new o(r)}get reader(){return this._reader}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}getTileReader(e){if(!this._reader.getSize())return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class n{constructor(e,t){this.inner=e,this.isWeak=t,this.lastWeak=null}}class a{constructor(){this._overrides=new Map,this._update=new i,this._lastCleanup=0}hasOverride(e){return this._overrides.has(e)}onChunkInsert(e){if(this._overrides.size){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId(),s=this._overrides.get(e);if(s?.lastWeak&&(s.lastWeak=null),s?.isWeak){const e=t.readOptimizedFeatureWorldSpace();s.inner=e,this._update.modify(e),this.invalidate()}}}e.registerOverrides(this)}apply(e,t){const{updateWeak:s,removeWeak:r,update:i,remove:o,release:a}=e.commands;this.invalidate();for(const d of s)this._overrides.set(d.objectId,new n(d,!0)),this._update.modify(d);for(const d of i){const e=new n(d,!1),t=this._overrides.get(d.objectId);t?.isWeak&&(e.lastWeak=t),this._overrides.set(d.objectId,e),this._update.modify(d)}for(const d of r)this._overrides.set(d,new n(null,!0)),this._update.remove(d);for(const d of o){const e=new n(null,!1),t=this._overrides.get(d);t?.isWeak&&(e.lastWeak=t),this._overrides.set(d,e),this._update.remove(d)}if(a.length){const e=new Set;for(const t of a){const s=this._overrides.get(t);s?.lastWeak?this._overrides.set(t,s.lastWeak):s&&!s.isWeak&&(this._overrides.delete(t),e.add(t))}t.forEachUnsafe((t=>{const s=t.getObjectId();e.has(s)&&(this._update.modify(t.readOptimizedFeatureWorldSpace()),e.delete(s))}));for(const t of e.values())this._update.remove(t)}}clearWeakOverrides(){for(const[e,t]of this._overrides.entries())t.isWeak&&this._overrides.delete(e);this.invalidate()}cleanup(e){if(this._overrides.size<s)return;const t=performance.now();if(t-this._lastCleanup<r)return;this._lastCleanup=t;const i=this._getWeakDeletions();if(!(i.size<s)){for(const t of e){const e=t.reader.withoutOverrides().getCursor();for(;e.next();){const t=e.getObjectId();i.delete(t)}}for(const e of i)this._overrides.delete(e);i.size&&this.invalidate()}}takeOverrideUpdate(){const e=this._update;return e.isEmpty?null:(this._update=new i,e)}asChunk(e){if(!this._chunk){const t=[];for(const e of this._overrides.values())null!=e.inner&&t.push(e.inner);this._chunk=o.fromFeatures(t,e)}return this._chunk}invalidate(){this._chunk=null}_getWeakDeletions(){const e=new Set;for(const[t,s]of this._overrides.entries())s.isWeak&&null==s.inner&&e.add(t);return e}}export{o as OverrideChunk,a as OverrideState,i as OverrideUpdate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../../../core/Evented.js";import has from"../../../../../../../core/has.js";import{create as s}from"../../../../../../../geometry/support/aaBoundingBox.js";import{FeatureStoreQueryAdapter as t}from"../../../FeatureStoreQueryAdapter.js";import{OverrideState as o}from"./Overrides.js";class r{constructor(s){this._metadata=s,this._chunks=new Map,this._chunksToRemove=[],this._overrides=new o,this.events=new e,this.featureAdapter=new t}destroy(){this.clear()}clear(){for(const e of this._chunks.values())this._chunksToRemove.push(e);this._chunks.clear()}*chunks(){this._overrides&&(yield this._overrides.asChunk(this._metadata)),yield*this._chunks.values()}insert(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.insert`),this._overrides.onChunkInsert(e),this._chunks.set(e.chunkId,e),this.events.emit("changed")}remove(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`),this._chunks.delete(e.chunkId),this._chunksToRemove.push(e)}cleanup(){const e=this._chunksToRemove;return this._chunksToRemove=[],this._overrides.cleanup(this._chunks.values()),e}applyOverride(e){this._overrides.apply(e,this),this.events.emit("changed");for(const s of this._chunks.values())s.invalidate()}takeOverrideUpdate(){return this._overrides.takeOverrideUpdate()}refresh(){this.events.emit("refresh")}forEach(e){const s=new Set;for(const t of this.chunks()){const o=t.reader.getCursor();for(;o.next();){const t=o.getObjectId();s.has(t)||(e(o.copy()),s.add(t))}}}forEachUnsafe(e){const s=new Set;for(const t of this.chunks()){const o=t.reader.getCursor();for(;o.next();){const t=o.getObjectId();s.has(t)||(e(o),s.add(t))}}}forEachInBounds(e,s){const t=new Set;for(const o of this.chunks()){const r=o.queryFeaturesInBounds(e);for(;r.next();){const e=r.getObjectId();t.has(e)||(s(r.copy()),t.add(e))}}}forEachBounds(e,t){const o=s();for(const s of e){s.getBounds(o)&&t(o)}}}export{r as FeatureSourceChunkStore};
5
+ import e from"../../../../../../../core/Evented.js";import has from"../../../../../../../core/has.js";import{create as s}from"../../../../../../../geometry/support/aaBoundingBox.js";import{FeatureStoreQueryAdapter as t}from"../../../FeatureStoreQueryAdapter.js";import{OverrideState as r}from"./Overrides.js";class o{constructor(s){this._metadata=s,this._chunks=new Map,this._chunksToRemove=[],this._overrides=new r,this.events=new e,this.featureAdapter=new t}destroy(){this.clear()}clear(){for(const e of this._chunks.values())this._chunksToRemove.push(e);this._chunks.clear(),this._overrides.clearWeakOverrides()}*chunks(){this._overrides&&(yield this._overrides.asChunk(this._metadata)),yield*this._chunks.values()}insert(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.insert`),this._overrides.onChunkInsert(e),this._chunks.set(e.chunkId,e),this.events.emit("changed")}remove(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`),this._chunks.delete(e.chunkId),this._chunksToRemove.push(e)}cleanup(){const e=this._chunksToRemove;return this._chunksToRemove=[],this._overrides.cleanup(this._chunks.values()),e}applyOverride(e){this._overrides.apply(e,this),this.events.emit("changed");for(const s of this._chunks.values())s.invalidate()}takeOverrideUpdate(){return this._overrides.takeOverrideUpdate()}refresh(){this.events.emit("refresh")}forEach(e){const s=new Set;for(const t of this.chunks()){const r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();s.has(t)||(e(r.copy()),s.add(t))}}}forEachUnsafe(e){const s=new Set;for(const t of this.chunks()){const r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();s.has(t)||(e(r),s.add(t))}}}forEachInBounds(e,s){const t=new Set;for(const r of this.chunks()){const o=r.queryFeaturesInBounds(e);for(;o.next();){const e=o.getObjectId();t.has(e)||(s(o.copy()),t.add(e))}}}forEachBounds(e,t){const r=s();for(const s of e){s.getBounds(r)&&t(r)}}}export{o as FeatureSourceChunkStore};