@arcgis/core 4.24.0-next.20220329 → 4.24.0-next.20220401

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 (456) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/WebMap.js +1 -1
  3. package/WebScene.js +1 -1
  4. package/analysis/LineOfSightAnalysisObserver.js +1 -1
  5. package/analysis/LineOfSightAnalysisTarget.js +1 -1
  6. package/arcade/featureset/actions/Adapted.js +1 -1
  7. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  8. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  9. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  10. package/arcade/featureset/support/FeatureSet.js +1 -1
  11. package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
  12. package/arcade/featureset/support/shared.js +1 -1
  13. package/arcade/functions/convertdirection.js +1 -1
  14. package/arcade/lib/character.js +1 -1
  15. package/arcade/lib/scanner.js +1 -1
  16. package/arcade/lib/tokenizer.js +1 -1
  17. package/arcade/request.js +1 -1
  18. package/arcade/treeAnalysis.js +1 -1
  19. package/assets/esri/core/workers/RemoteClient.js +1 -1
  20. package/assets/esri/core/workers/chunks/0bfedb1dbdff8205e468.js +1 -0
  21. package/assets/esri/core/workers/chunks/{5e472c89a38d6a42b84d.js → 0e29250c24a3a7b1ce13.js} +1 -1
  22. package/assets/esri/core/workers/chunks/0eb9c9477d36cd212f8b.js +1 -0
  23. package/assets/esri/core/workers/chunks/10779a256841c37f2429.js +1 -0
  24. package/assets/esri/core/workers/chunks/10a119889d1ab13402a3.js +1 -0
  25. package/assets/esri/core/workers/chunks/125b14c2ccd96d7c20c2.js +1 -0
  26. package/assets/esri/core/workers/chunks/23ec33a30db201e8b2c3.js +1 -0
  27. package/assets/esri/core/workers/chunks/2530e8ccf6e12787ce76.js +1 -0
  28. package/assets/esri/core/workers/chunks/2d9e97ba5b50aec4dd01.js +1 -0
  29. package/assets/esri/core/workers/chunks/365dc146398420f13f82.js +1 -0
  30. package/assets/esri/core/workers/chunks/3ae2827e8d55d6713d20.js +1 -0
  31. package/assets/esri/core/workers/chunks/3e3eebaa0844742db2f2.js +1 -0
  32. package/assets/esri/core/workers/chunks/3fd5b2d6eccd9098d492.js +1 -0
  33. package/assets/esri/core/workers/chunks/404f1d7bce014c7e6965.js +1 -0
  34. package/assets/esri/core/workers/chunks/411b7777bb5e943c156f.js +1 -0
  35. package/assets/esri/core/workers/chunks/{12ca192a5233bb2875d0.js → 4312902ab6e42fbe119b.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{4ef07f50da39f8607c1c.js → 44e95e87bd9e820aeb53.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{4d4c5e535d8b9ceb865a.js → 4810edf605838d07e5c5.js} +1 -1
  38. package/assets/esri/core/workers/chunks/4bce446391176a9d4588.js +1 -0
  39. package/assets/esri/core/workers/chunks/52a0e387073ea264e194.js +1 -0
  40. package/assets/esri/core/workers/chunks/560234694f3e53802aff.js +1 -0
  41. package/assets/esri/core/workers/chunks/5633710daeb3bbb79bcf.js +1 -0
  42. package/assets/esri/core/workers/chunks/5682039666f874836451.js +1 -0
  43. package/assets/esri/core/workers/chunks/6f01905936396fe87865.js +1 -0
  44. package/assets/esri/core/workers/chunks/6f7917da7166e8c6854b.js +1 -0
  45. package/assets/esri/core/workers/chunks/7388824eac8da01ea03d.js +1 -0
  46. package/assets/esri/core/workers/chunks/7745efef7d5119d0b087.js +1 -0
  47. package/assets/esri/core/workers/chunks/794b47764ebb0257ed41.js +1 -0
  48. package/assets/esri/core/workers/chunks/{da64dedf9270b64f42b2.js → 79bdb26244ec7b4472fe.js} +1 -1
  49. package/assets/esri/core/workers/chunks/79ec28b3e3c57fe026aa.js +1 -0
  50. package/assets/esri/core/workers/chunks/81e9d860a044acec74ce.js +1 -0
  51. package/assets/esri/core/workers/chunks/831dc0187f71e658550c.js +1 -0
  52. package/assets/esri/core/workers/chunks/86ad6b020c01850d9095.js +1 -0
  53. package/assets/esri/core/workers/chunks/{fb7397da8d4ec2ae4587.js → 87458fbf395338511662.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{1a859be598ad96bb4719.js → 8771296b537f366596c4.js} +18 -18
  55. package/assets/esri/core/workers/chunks/8958cd555f4887526e8b.js +1 -0
  56. package/assets/esri/core/workers/chunks/{e57b71ba70f088a3a052.js → 90dcd86cdef90099abfa.js} +1 -1
  57. package/assets/esri/core/workers/chunks/93067e27eea5844edc6c.js +1 -0
  58. package/assets/esri/core/workers/chunks/{9fbee2d9bf50c4c148c6.js → 9a146c9e9b4bf7fba88f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/9b9821772b6cbe189fe0.js +1 -0
  60. package/assets/esri/core/workers/chunks/{6c4ce530b493c6f7c430.js → 9df2f9f7c28b31866be8.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{d0620ce99b620621d8bc.js → a0552044e123a3c51ddf.js} +1 -1
  62. package/assets/esri/core/workers/chunks/acc1a4acd57f5657e782.js +1 -0
  63. package/assets/esri/core/workers/chunks/b055ae7c54796751b64c.js +1 -0
  64. package/assets/esri/core/workers/chunks/{acc2cfb116fee7f82ae9.js → b26bd8fde2fc65bb67fb.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{9b45b94c4dbdc8d2c5fd.js → b34ba22c7a5adce8a7a2.js} +1 -1
  66. package/assets/esri/core/workers/chunks/b75665d0bf417c6ef24a.js +1 -0
  67. package/assets/esri/core/workers/chunks/bd50ec30688463b821d1.js +1 -0
  68. package/assets/esri/core/workers/chunks/c28f7ae4756ad1ba94bd.js +1 -0
  69. package/assets/esri/core/workers/chunks/c4f713959d4115b87c6c.js +1 -0
  70. package/assets/esri/core/workers/chunks/c58aa209492bd94b7aad.js +1 -0
  71. package/assets/esri/core/workers/chunks/{9b117097b7be0efd21d4.js → c59b0b58e24e6a60cf3e.js} +1 -1
  72. package/assets/esri/core/workers/chunks/c7bd5a4d318299388645.js +1 -0
  73. package/assets/esri/core/workers/chunks/c7cee13a962396b23a5e.js +1 -0
  74. package/assets/esri/core/workers/chunks/{3bbff5ea1ea0e955c592.js → cd3679fa86129ebabfdf.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{1a36dc0daffd536ea44d.js → cee7ce362860717713bf.js} +1 -1
  76. package/assets/esri/core/workers/chunks/cf463d6309f14df2f2fa.js +1 -0
  77. package/assets/esri/core/workers/chunks/{224c0e64160bdc170051.js → d076627bb7dadea89e89.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{fff4200bc61b82dd6193.js → d1d1c45243af614f2e74.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{1e0498dc9836658d9aba.js → d5fd12ea541c1a6b7fce.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{10322d990cda5aedf2f0.js → d6e32ca237ad9309c76a.js} +1 -1
  81. package/assets/esri/core/workers/chunks/e06ad3a3d71154fed654.js +1 -0
  82. package/assets/esri/core/workers/chunks/{7a77d4cd27c30f1a5cae.js → ee3387a43dfbb3df23e1.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{5d5fa2b1fc48a17eb9ab.js → f4fc165420d449e442b8.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{3d6d9906a534ddd8fa37.js → f5ee03f3fca7a75192de.js} +1 -1
  85. package/assets/esri/themes/base/widgets/_Daylight.scss +1 -1
  86. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +1 -1
  87. package/assets/esri/themes/base/widgets/_Weather.scss +1 -1
  88. package/assets/esri/themes/base/widgets/_Widget.scss +12 -0
  89. package/assets/esri/themes/dark/main.css +1 -1
  90. package/assets/esri/themes/dark-blue/main.css +1 -1
  91. package/assets/esri/themes/dark-green/main.css +1 -1
  92. package/assets/esri/themes/dark-purple/main.css +1 -1
  93. package/assets/esri/themes/dark-red/main.css +1 -1
  94. package/assets/esri/themes/light/main.css +1 -1
  95. package/assets/esri/themes/light/view.css +1 -1
  96. package/assets/esri/themes/light-blue/main.css +1 -1
  97. package/assets/esri/themes/light-green/main.css +1 -1
  98. package/assets/esri/themes/light-purple/main.css +1 -1
  99. package/assets/esri/themes/light-red/main.css +1 -1
  100. package/chunks/ComponentShader.glsl.js +25 -25
  101. package/chunks/HighlightApply.glsl.js +36 -0
  102. package/chunks/HighlightBlur.glsl.js +26 -0
  103. package/chunks/HighlightDownsample.glsl.js +12 -0
  104. package/chunks/ImageMaterial.glsl.js +8 -8
  105. package/chunks/LineCallout.glsl.js +1 -1
  106. package/chunks/Pattern.glsl.js +2 -2
  107. package/chunks/SimpleAtmosphere.glsl.js +7 -7
  108. package/chunks/Stars.glsl.js +1 -1
  109. package/chunks/arcade.js +1 -1
  110. package/chunks/color.js +1 -1
  111. package/chunks/languageUtils.js +1 -1
  112. package/chunks/mat3.js +1 -1
  113. package/copyright.txt +2 -2
  114. package/core/AsyncUpdate.js +1 -1
  115. package/core/Evented.js +1 -1
  116. package/core/PooledArray.js +1 -1
  117. package/core/accessorSupport/diffUtils.js +1 -1
  118. package/core/accessorSupport/get.js +1 -1
  119. package/core/accessorSupport/read.js +1 -1
  120. package/core/accessorSupport/set.js +1 -1
  121. package/core/accessorSupport/tracking.js +1 -1
  122. package/core/accessorSupport/utils.js +1 -1
  123. package/core/arrayUtils.js +1 -1
  124. package/core/libs/gl-matrix-2/mat3.js +1 -1
  125. package/core/libs/gl-matrix-2/math/mat3.js +1 -1
  126. package/core/number.js +1 -1
  127. package/core/object.js +1 -1
  128. package/core/string.js +1 -1
  129. package/core/unitUtils.js +1 -1
  130. package/core/watchUtils.js +1 -1
  131. package/core/workers/RemoteClient.js +1 -1
  132. package/exports/csv.js +1 -1
  133. package/geometry/support/heightModelInfoUtils.js +1 -1
  134. package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
  135. package/geometry/support/normalizeUtils.js +1 -1
  136. package/identity/IdentityManagerBase.js +1 -1
  137. package/interfaces.d.ts +155 -20
  138. package/layers/ImageryLayer.js +1 -1
  139. package/layers/MapImageLayer.js +1 -1
  140. package/layers/RouteLayer.js +1 -1
  141. package/layers/SceneLayer.js +1 -1
  142. package/layers/SubtypeGroupLayer.js +1 -1
  143. package/layers/TileLayer.js +1 -1
  144. package/layers/VectorTileLayer.js +1 -1
  145. package/layers/WMSLayer.js +1 -1
  146. package/layers/WMTSLayer.js +1 -1
  147. package/layers/WebTileLayer.js +1 -1
  148. package/layers/graphics/data/AttributesBuilder.js +1 -1
  149. package/layers/graphics/data/QueryEngine.js +1 -1
  150. package/layers/graphics/editingSupport.js +1 -1
  151. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  152. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  153. package/layers/graphics/sources/support/inferenceUtils.js +1 -1
  154. package/layers/mixins/ArcGISCachedService.js +1 -1
  155. package/layers/mixins/ArcGISImageService.js +1 -1
  156. package/layers/ogc/ogcFeatureUtils.js +1 -1
  157. package/layers/support/ExportImageServiceParameters.js +1 -1
  158. package/layers/support/PixelBlock.js +1 -1
  159. package/layers/support/RasterJobHandler.js +1 -1
  160. package/layers/support/SpriteSource.js +1 -1
  161. package/layers/support/Sublayer.js +1 -1
  162. package/layers/support/TilemapCache.js +1 -1
  163. package/layers/support/WMTSSublayer.js +1 -1
  164. package/layers/support/arcgisLayerUrl.js +1 -1
  165. package/layers/support/fieldUtils.js +1 -1
  166. package/layers/support/kmlUtils.js +1 -1
  167. package/layers/support/layerUtils.js +1 -1
  168. package/layers/support/rasterDatasets/ImageAuxRaster.js +1 -1
  169. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  170. package/layers/support/rasterDatasets/RasterFactory.js +1 -1
  171. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  172. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  173. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  174. package/layers/support/rasterDatasets/xmlUtilities.js +1 -1
  175. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  176. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  177. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  178. package/layers/support/vectorTileLayerLoader.js +1 -1
  179. package/layers/support/wmsUtils.js +1 -1
  180. package/layers/support/wmtsUtils.js +1 -1
  181. package/libs/i3s/I3SModule.js +1 -1
  182. package/libs/vxl/VxlModule.js +1 -1
  183. package/package.json +1 -1
  184. package/portal/Portal.js +1 -1
  185. package/portal/PortalItem.js +1 -1
  186. package/portal/schemas/definitions.js +1 -1
  187. package/portal/support/layersLoader.js +1 -1
  188. package/portal/support/portalItemUtils.js +1 -1
  189. package/portal/support/portalLayers.js +1 -1
  190. package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
  191. package/renderers/support/DictionaryLoader.js +1 -1
  192. package/renderers/support/RasterSymbolizer.js +1 -1
  193. package/renderers/support/numberUtils.js +1 -1
  194. package/renderers/support/rasterRendererHelper.js +1 -1
  195. package/renderers/support/utils.js +1 -1
  196. package/request.js +1 -1
  197. package/rest/imageService.js +1 -1
  198. package/rest/operations/find.js +1 -1
  199. package/rest/query/operations/query.js +1 -1
  200. package/rest/query/operations/queryRelatedRecords.js +1 -1
  201. package/rest/query/operations/queryTopFeatures.js +1 -1
  202. package/rest/support/DirectionLine.js +1 -1
  203. package/rest/support/DirectionPoint.js +1 -1
  204. package/rest/support/PointBarrier.js +1 -1
  205. package/rest/support/PolygonBarrier.js +1 -1
  206. package/rest/support/PolylineBarrier.js +1 -1
  207. package/rest/support/RouteInfo.js +1 -1
  208. package/rest/support/Stop.js +1 -1
  209. package/smartMapping/labels/clusters.js +1 -1
  210. package/smartMapping/popup/dotDensity.js +1 -1
  211. package/smartMapping/popup/support/clusterUtils.js +1 -1
  212. package/smartMapping/popup/support/utils.js +1 -1
  213. package/smartMapping/raster/support/utils.js +1 -1
  214. package/smartMapping/renderers/color.js +1 -1
  215. package/smartMapping/renderers/location.js +1 -1
  216. package/smartMapping/renderers/predominance.js +1 -1
  217. package/smartMapping/renderers/relationship.js +1 -1
  218. package/smartMapping/renderers/size.js +1 -1
  219. package/smartMapping/renderers/support/utils.js +1 -1
  220. package/smartMapping/renderers/type.js +1 -1
  221. package/smartMapping/renderers/univariateColorSize.js +1 -1
  222. package/smartMapping/statistics/summaryStatisticsForAge.js +1 -1
  223. package/smartMapping/statistics/support/ageUtils.js +1 -1
  224. package/smartMapping/statistics/support/utils.js +1 -1
  225. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  226. package/smartMapping/support/adapters/support/utils.js +1 -1
  227. package/smartMapping/support/utils.js +1 -1
  228. package/smartMapping/symbology/support/Theme.js +1 -1
  229. package/smartMapping/symbology/support/colorRamps.js +1 -1
  230. package/smartMapping/symbology/support/symbologyUtils.js +1 -1
  231. package/smartMapping/symbology/support/utils.js +1 -1
  232. package/statistics/utils.js +1 -1
  233. package/support/basemapDefinitions.js +1 -1
  234. package/support/basemapUtils.js +1 -1
  235. package/support/elevationInfoUtils.js +1 -1
  236. package/support/popupUtils.js +1 -1
  237. package/support/revision.js +1 -1
  238. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  239. package/symbols/cim/cimAnalyzer.js +1 -1
  240. package/symbols/cim/utils.js +1 -1
  241. package/symbols/support/previewSymbol3D.js +1 -1
  242. package/symbols/support/renderUtils.js +1 -1
  243. package/symbols/support/symbolLayerUtils.js +1 -1
  244. package/views/2d/engine/Bitmap.js +1 -1
  245. package/views/2d/engine/flow/FlowDisplayObject.js +1 -1
  246. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  247. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  248. package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
  249. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  250. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  251. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  252. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  253. package/views/2d/engine/webgl/Profiler.js +1 -1
  254. package/views/2d/engine/webgl/Utils.js +1 -1
  255. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  256. package/views/2d/engine/webgl/definitions.js +1 -1
  257. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  258. package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
  259. package/views/2d/engine/webgl/mesh/templates/WGLTemplateStore.js +1 -1
  260. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  261. package/views/2d/engine/webgl/util/Lock.js +1 -1
  262. package/views/2d/layers/RouteLayerView2D.js +1 -1
  263. package/views/2d/layers/features/schemaUtils.js +1 -1
  264. package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
  265. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  266. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  267. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  268. package/views/2d/layers/support/webStyleUtils.js +1 -1
  269. package/views/2d/support/Timeline.js +1 -1
  270. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  271. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  272. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  273. package/views/3d/analysis/Slice/SliceController.js +1 -1
  274. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  275. package/views/3d/environment/SceneViewAtmosphere.js +1 -1
  276. package/views/3d/environment/StarsTechnique.js +1 -1
  277. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  278. package/views/3d/glTF/loader.js +1 -1
  279. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  280. package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
  281. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  282. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  283. package/views/3d/layers/I3SMeshView3D.js +1 -1
  284. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  285. package/views/3d/layers/LayerView3D.js +1 -1
  286. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  287. package/views/3d/layers/RouteLayerView3D.js +1 -1
  288. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  289. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  290. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  291. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  292. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  293. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  294. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  295. package/views/3d/layers/i3s/IDBMockCache.js +5 -0
  296. package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
  297. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  298. package/views/3d/state/ViewStateManager.js +1 -1
  299. package/views/3d/state/controllers/RotateController.js +1 -1
  300. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  301. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  302. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  303. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  304. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  305. package/views/3d/support/HighlightOptions.js +1 -1
  306. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  307. package/views/3d/support/debugFlags.js +1 -1
  308. package/views/3d/support/orientedBoundingBox.js +1 -1
  309. package/views/3d/terrain/TerrainSurface.js +1 -1
  310. package/views/3d/webgl-engine/Stage.js +1 -1
  311. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  312. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  313. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +3 -3
  314. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +5 -5
  315. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  316. package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
  317. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  318. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  319. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  320. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderParameters.js +1 -1
  321. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  322. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  323. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  324. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  325. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  326. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  327. package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +5 -0
  328. package/views/3d/webgl-engine/shaders/HighlightApplyTechnique.js +5 -0
  329. package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.js +5 -0
  330. package/views/3d/webgl-engine/shaders/HighlightBlurTechnique.js +5 -0
  331. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +5 -0
  332. package/views/3d/webgl-engine/shaders/HighlightDownsampleTechnique.js +5 -0
  333. package/views/3d/webgl-engine/shaders/HighlightOptions.js +4 -0
  334. package/views/3d/webgl-engine/shaders/HighlightPassParameters.js +5 -0
  335. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  336. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  337. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  338. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  339. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +5 -7
  340. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +14 -14
  341. package/views/SceneView.js +1 -1
  342. package/views/draw/support/GraphicMover.js +1 -1
  343. package/views/input/InputHandler.js +1 -1
  344. package/views/input/InputManager.js +1 -1
  345. package/views/layers/ImageryTileLayerView.js +1 -1
  346. package/views/layers/MapImageLayerView.js +1 -1
  347. package/views/layers/TileLayerView.js +1 -1
  348. package/views/layers/support/popupUtils.js +1 -1
  349. package/views/support/DefaultsFromMap.js +1 -1
  350. package/views/support/Scheduler.js +1 -1
  351. package/views/support/screenshotUtils.js +1 -1
  352. package/views/ui/DefaultUI.js +1 -1
  353. package/views/webgl/ShaderTranspiler.js +1 -1
  354. package/webscene/Slide.js +1 -1
  355. package/webscene/spec-certification/spec.js +1 -1
  356. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  357. package/widgets/Attachments/support/attachmentUtils.js +1 -1
  358. package/widgets/Attachments.js +1 -1
  359. package/widgets/Attribution.js +1 -1
  360. package/widgets/BasemapLayerList.js +1 -1
  361. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  362. package/widgets/Bookmarks.js +1 -1
  363. package/widgets/BuildingExplorer/support/filterUtils.js +1 -1
  364. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  365. package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
  366. package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
  367. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  368. package/widgets/Directions/DirectionsViewModel.js +1 -1
  369. package/widgets/Directions.js +1 -1
  370. package/widgets/Editor/EditorViewModel.js +1 -1
  371. package/widgets/Editor/workflowUtils.js +1 -1
  372. package/widgets/Editor.js +1 -1
  373. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  374. package/widgets/Feature/FeatureMedia.js +1 -1
  375. package/widgets/Feature/support/featureUtils.js +1 -1
  376. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  377. package/widgets/FeatureForm/InputField.js +1 -1
  378. package/widgets/FeatureForm.js +1 -1
  379. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  380. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  381. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  382. package/widgets/FeatureTemplates.js +1 -1
  383. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  384. package/widgets/LayerList/ListItemPanel.js +1 -1
  385. package/widgets/LayerList.js +1 -1
  386. package/widgets/Legend/LegendViewModel.js +1 -1
  387. package/widgets/Legend/styles/Card.js +1 -1
  388. package/widgets/Legend/styles/Classic.js +1 -1
  389. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  390. package/widgets/Legend/support/colorRampUtils.js +1 -1
  391. package/widgets/Legend/support/relationshipRampUtils.js +1 -1
  392. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  393. package/widgets/Popup/PopupViewModel.js +1 -1
  394. package/widgets/Popup/actionUtils.js +1 -1
  395. package/widgets/Print/PrintViewModel.js +1 -1
  396. package/widgets/Print.js +1 -1
  397. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  398. package/widgets/Search/SearchViewModel.js +1 -1
  399. package/widgets/Search/support/layerSearchUtils.js +1 -1
  400. package/widgets/Slider.js +1 -1
  401. package/widgets/Swipe.js +1 -1
  402. package/widgets/TableList.js +1 -1
  403. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  404. package/widgets/TimeSlider.js +1 -1
  405. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  406. package/widgets/support/DatePicker.js +1 -1
  407. package/widgets/support/Popover.js +1 -1
  408. package/widgets/support/SnappingControls.js +1 -1
  409. package/widgets/support/TimePicker.js +1 -1
  410. package/widgets/support/timeWidgetUtils.js +1 -1
  411. package/assets/esri/core/workers/chunks/083a5d10f8e243641cb9.js +0 -1
  412. package/assets/esri/core/workers/chunks/0872812ce4d0ec8faf8f.js +0 -1
  413. package/assets/esri/core/workers/chunks/0bc26899780c33637746.js +0 -1
  414. package/assets/esri/core/workers/chunks/113362697da1b69deaed.js +0 -1
  415. package/assets/esri/core/workers/chunks/11a2f9708938eac98815.js +0 -1
  416. package/assets/esri/core/workers/chunks/11a45709b703be84caaf.js +0 -1
  417. package/assets/esri/core/workers/chunks/1c1294ff1ebbd8f774f7.js +0 -1
  418. package/assets/esri/core/workers/chunks/1c915cc9a9d5729b6f17.js +0 -1
  419. package/assets/esri/core/workers/chunks/31786756b3d44540f8c0.js +0 -1
  420. package/assets/esri/core/workers/chunks/36a6f34fe40785beff5d.js +0 -1
  421. package/assets/esri/core/workers/chunks/373c16f8b8093d001064.js +0 -1
  422. package/assets/esri/core/workers/chunks/382a331a592abb61267f.js +0 -1
  423. package/assets/esri/core/workers/chunks/3bf106fe34e3992032c4.js +0 -1
  424. package/assets/esri/core/workers/chunks/3dcec610f1c1497d87bc.js +0 -1
  425. package/assets/esri/core/workers/chunks/46495e726d8739260d44.js +0 -1
  426. package/assets/esri/core/workers/chunks/4a82a6a473b3d540d0be.js +0 -1
  427. package/assets/esri/core/workers/chunks/4b6719377a95ac10fa43.js +0 -1
  428. package/assets/esri/core/workers/chunks/4d2ef57ff3a5cfc1313f.js +0 -1
  429. package/assets/esri/core/workers/chunks/4fd2b8153d62592210a2.js +0 -1
  430. package/assets/esri/core/workers/chunks/56e6a1079269e2964b02.js +0 -1
  431. package/assets/esri/core/workers/chunks/5b4d9786c010d265346c.js +0 -1
  432. package/assets/esri/core/workers/chunks/604637e1c3937b376a0d.js +0 -1
  433. package/assets/esri/core/workers/chunks/60f83257e361f87fa6fd.js +0 -1
  434. package/assets/esri/core/workers/chunks/6d3f80be6fceb2c18b5d.js +0 -1
  435. package/assets/esri/core/workers/chunks/6f827a32646bab0a8777.js +0 -1
  436. package/assets/esri/core/workers/chunks/70bd2ab42e3801ef5974.js +0 -1
  437. package/assets/esri/core/workers/chunks/746222184b361b50d6ba.js +0 -1
  438. package/assets/esri/core/workers/chunks/7fb72b2d11e8d840f982.js +0 -1
  439. package/assets/esri/core/workers/chunks/85bb6a1a7704fcdcbec2.js +0 -1
  440. package/assets/esri/core/workers/chunks/8b4c76cebb100e6c06f8.js +0 -1
  441. package/assets/esri/core/workers/chunks/9586a6b320edb1922926.js +0 -1
  442. package/assets/esri/core/workers/chunks/99638697ffda9022ce92.js +0 -1
  443. package/assets/esri/core/workers/chunks/a9da1cb118ca62a9581d.js +0 -1
  444. package/assets/esri/core/workers/chunks/aaa41a5013eef713c032.js +0 -1
  445. package/assets/esri/core/workers/chunks/ac321f939dd488ff6ce4.js +0 -1
  446. package/assets/esri/core/workers/chunks/add6027a96398ecf69de.js +0 -1
  447. package/assets/esri/core/workers/chunks/b75206b46ba81606087c.js +0 -1
  448. package/assets/esri/core/workers/chunks/bf8456828e38a768eba3.js +0 -1
  449. package/assets/esri/core/workers/chunks/c0720d0d8adcba6738d4.js +0 -1
  450. package/assets/esri/core/workers/chunks/c5bb712d5cf8c05a4e13.js +0 -1
  451. package/assets/esri/core/workers/chunks/d343f05a3366f95e0494.js +0 -1
  452. package/assets/esri/core/workers/chunks/d8b1f00075983d769985.js +0 -1
  453. package/chunks/Highlight.glsl.js +0 -88
  454. package/views/3d/webgl-engine/shaders/Highlight.glsl.js +0 -5
  455. package/views/3d/webgl-engine/shaders/HighlightTechnique.js +0 -5
  456. package/views/3d/webgl-engine/shaders/HighlightTechniqueConfiguration.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../core/maybe.js";import{b as e,c as r,r as s,j as i,m as a}from"../../../../chunks/mat3.js";import{c as o}from"../../../../chunks/mat3f32.js";import{f as u}from"../../../../chunks/vec2f32.js";import{extractBands as n}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{DisplayObject as l}from"../DisplayObject.js";import{TextureSamplingMode as h}from"../../../webgl/enums.js";import{createTransformTexture as d,createRasterTexture as _,createColormapTexture as m}from"../../../webgl/rasterUtils.js";const x={bandCount:3,outMin:0,outMax:1,minCutOff:[0,0,0],maxCutOff:[255,255,255],factor:[1/255,1/255,1/255],useGamma:!1,gamma:[1,1,1],gammaCorrection:[1,1,1],colormap:null,colormapOffset:null,stretchType:"none",type:"stretch"};class p extends l{constructor(t=null,e=null,r=null){super(),this._textureInvalidated=!0,this._colormapTextureInvalidated=!0,this._supportsBilinearTexture=!0,this.stencilRef=0,this.coordScale=[1,1],this._symbolizerParameters=null,this.height=null,this.isRendereredSource=!1,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this.rawPixelData=null,this._suspended=!1,this._bandIds=null,this._interpolation=null,this._transformGrid=null,this.width=null,this.x=0,this.y=0,this.source=t,this.transformGrid=e,this.interpolation=r}destroy(){const t=this.getTextures();null==t||t.textures.forEach((t=>t.dispose())),this._rasterTexture=null,this._transformGridTexture=null,this._colormapTexture=null}get symbolizerParameters(){return this._symbolizerParameters||x}set symbolizerParameters(t){this._symbolizerParameters!==t&&(this._symbolizerParameters=t,this._colormapTextureInvalidated=!0)}get source(){return this._source}set source(t){this._source!==t&&(this._source=t,this._rasterTexture&&(this._rasterTexture.dispose(),this._rasterTexture=null,this._rasterTextureBandIds=null),this.invalidateTexture())}get suspended(){return this._suspended}set suspended(t){this._suspended&&!t&&this.stage&&(this.ready(),this.requestRender()),this._suspended=t}get bandIds(){return this._bandIds}set bandIds(t){this._bandIds=t,this._isBandIdschanged(t)&&this.invalidateTexture()}get interpolation(){return this._interpolation||"nearest"}set interpolation(t){this._interpolation=t,this._rasterTexture&&this._rasterTexture.setSamplingMode("bilinear"===this._getTextureSamplingMethod(t)?h.LINEAR:h.NEAREST)}get transformGrid(){return this._transformGrid}set transformGrid(t){this._transformGrid=t,this._transformGridTexture&&(this._transformGridTexture.dispose(),this._transformGridTexture=null)}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this.requestRender())}_createTransforms(){return{dvs:o()}}setTransform(t){const o=e(this.transforms.dvs),[n,l]=t.toScreenNoRotation([0,0],[this.x,this.y]),h=this.resolution/this.pixelRatio/t.resolution,d=h*this.width,_=h*this.height,m=Math.PI*this.rotation/180;r(o,o,u(n,l)),r(o,o,u(d/2,_/2)),s(o,o,-m),r(o,o,u(-d/2,-_/2)),i(o,o,u(d,_)),a(this.transforms.dvs,t.displayViewMat3,o)}getTextures(){if(!this._rasterTexture)return null;const t=[],e=[];return this._transformGridTexture&&(e.push(this._transformGridTexture),t.push("u_transformGrid")),this._rasterTexture&&(e.push(this._rasterTexture),t.push("u_image")),this._colormapTexture&&(e.push(this._colormapTexture),t.push("u_colormap")),{names:t,textures:e}}onAttach(){this.invalidateTexture()}onDetach(){this.invalidateTexture()}updateTexture({context:t}){var e,r,s;if(!this.stage)return null==(e=this._rasterTexture)||e.dispose(),null==(r=this._transformGridTexture)||r.dispose(),null==(s=this._colormapTexture)||s.dispose(),this._rasterTexture=null,this._rasterTextureBandIds=null,this._transformGridTexture=null,void(this._colormapTexture=null);const i=this._isValidSource(this.source);i&&this._colormapTextureInvalidated&&(this._colormapTextureInvalidated=!1,this._updateColormapTexture(t)),this._textureInvalidated&&(this._textureInvalidated=!1,this._createOrDestroyRasterTexture(t),this._rasterTexture&&(i?this.transformGrid&&!this._transformGridTexture&&(this._transformGridTexture=d(t,this.transformGrid)):this._rasterTexture.setData(null)),this.suspended||(this.ready(),this.requestRender()))}_createOrDestroyRasterTexture(e){var r,s;const i=t(this.source)?n(this.source,this.bandIds):null;if(!this._isValidSource(i))return void(this._rasterTexture&&(this._rasterTexture.dispose(),this._rasterTextureBandIds=null,this._rasterTexture=null));const a=!this._isBandIdschanged(this.bandIds);if(this._rasterTexture){if(a)return;this._rasterTexture.dispose(),this._rasterTextureBandIds=null,this._rasterTexture=null}this._supportsBilinearTexture=null==(r=e.capabilities.textureFloat)?void 0:r.textureFloatLinear;const o=this._getTextureSamplingMethod(this.interpolation),u=this.isRendereredSource||!(null!=(s=e.capabilities.textureFloat)&&s.textureFloat);this._rasterTexture=_(e,i,o,u),this._rasterTextureBandIds=this.bandIds?[...this.bandIds]:null}_isBandIdschanged(t){const e=this._rasterTextureBandIds;return!(null==e&&null==t||e&&t&&e.join("")===t.join(""))}_isValidSource(e){var r;return t(e)&&(null==(r=e.pixels)?void 0:r.length)>0}_getTextureSamplingMethod(e){const{type:r,colormap:s}=this.symbolizerParameters,i="lut"===r||"stretch"===r&&t(s);return!this._supportsBilinearTexture||i||"bilinear"!==e&&"cubic"!==e?"nearest":"bilinear"}_updateColormapTexture(t){const e=this._colormap,r=this.symbolizerParameters.colormap;return r?e?r.length!==e.length||r.some(((t,r)=>t!==e[r]))?(this._colormapTexture&&(this._colormapTexture.dispose(),this._colormapTexture=null),this._colormapTexture=m(t,r),void(this._colormap=r)):void 0:(this._colormapTexture=m(t,r),void(this._colormap=r)):(this._colormapTexture&&(this._colormapTexture.dispose(),this._colormapTexture=null),void(this._colormap=null))}}class c extends p{get source(){return this._source}}function T(e){return t(e.source)}export{p as RasterBitmap,c as RasterBitmapWithSource,T as hasSource};
5
+ import{isSome as t}from"../../../../core/maybe.js";import{b as e,c as r,r as s,h as i,m as a}from"../../../../chunks/mat3.js";import{c as o}from"../../../../chunks/mat3f32.js";import{f as u}from"../../../../chunks/vec2f32.js";import{extractBands as n}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{DisplayObject as l}from"../DisplayObject.js";import{TextureSamplingMode as h}from"../../../webgl/enums.js";import{createTransformTexture as d,createRasterTexture as _,createColormapTexture as m}from"../../../webgl/rasterUtils.js";const x={bandCount:3,outMin:0,outMax:1,minCutOff:[0,0,0],maxCutOff:[255,255,255],factor:[1/255,1/255,1/255],useGamma:!1,gamma:[1,1,1],gammaCorrection:[1,1,1],colormap:null,colormapOffset:null,stretchType:"none",type:"stretch"};class p extends l{constructor(t=null,e=null,r=null){super(),this._textureInvalidated=!0,this._colormapTextureInvalidated=!0,this._supportsBilinearTexture=!0,this.stencilRef=0,this.coordScale=[1,1],this._symbolizerParameters=null,this.height=null,this.isRendereredSource=!1,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this.rawPixelData=null,this._suspended=!1,this._bandIds=null,this._interpolation=null,this._transformGrid=null,this.width=null,this.x=0,this.y=0,this.source=t,this.transformGrid=e,this.interpolation=r}destroy(){const t=this.getTextures();null==t||t.textures.forEach((t=>t.dispose())),this._rasterTexture=null,this._transformGridTexture=null,this._colormapTexture=null}get symbolizerParameters(){return this._symbolizerParameters||x}set symbolizerParameters(t){this._symbolizerParameters!==t&&(this._symbolizerParameters=t,this._colormapTextureInvalidated=!0)}get source(){return this._source}set source(t){this._source!==t&&(this._source=t,this._rasterTexture&&(this._rasterTexture.dispose(),this._rasterTexture=null,this._rasterTextureBandIds=null),this.invalidateTexture())}get suspended(){return this._suspended}set suspended(t){this._suspended&&!t&&this.stage&&(this.ready(),this.requestRender()),this._suspended=t}get bandIds(){return this._bandIds}set bandIds(t){this._bandIds=t,this._isBandIdschanged(t)&&this.invalidateTexture()}get interpolation(){return this._interpolation||"nearest"}set interpolation(t){this._interpolation=t,this._rasterTexture&&this._rasterTexture.setSamplingMode("bilinear"===this._getTextureSamplingMethod(t)?h.LINEAR:h.NEAREST)}get transformGrid(){return this._transformGrid}set transformGrid(t){this._transformGrid=t,this._transformGridTexture&&(this._transformGridTexture.dispose(),this._transformGridTexture=null)}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this.requestRender())}_createTransforms(){return{dvs:o()}}setTransform(t){const o=e(this.transforms.dvs),[n,l]=t.toScreenNoRotation([0,0],[this.x,this.y]),h=this.resolution/this.pixelRatio/t.resolution,d=h*this.width,_=h*this.height,m=Math.PI*this.rotation/180;r(o,o,u(n,l)),r(o,o,u(d/2,_/2)),s(o,o,-m),r(o,o,u(-d/2,-_/2)),i(o,o,u(d,_)),a(this.transforms.dvs,t.displayViewMat3,o)}getTextures(){if(!this._rasterTexture)return null;const t=[],e=[];return this._transformGridTexture&&(e.push(this._transformGridTexture),t.push("u_transformGrid")),this._rasterTexture&&(e.push(this._rasterTexture),t.push("u_image")),this._colormapTexture&&(e.push(this._colormapTexture),t.push("u_colormap")),{names:t,textures:e}}onAttach(){this.invalidateTexture()}onDetach(){this.invalidateTexture()}updateTexture({context:t}){var e,r,s;if(!this.stage)return null==(e=this._rasterTexture)||e.dispose(),null==(r=this._transformGridTexture)||r.dispose(),null==(s=this._colormapTexture)||s.dispose(),this._rasterTexture=null,this._rasterTextureBandIds=null,this._transformGridTexture=null,void(this._colormapTexture=null);const i=this._isValidSource(this.source);i&&this._colormapTextureInvalidated&&(this._colormapTextureInvalidated=!1,this._updateColormapTexture(t)),this._textureInvalidated&&(this._textureInvalidated=!1,this._createOrDestroyRasterTexture(t),this._rasterTexture&&(i?this.transformGrid&&!this._transformGridTexture&&(this._transformGridTexture=d(t,this.transformGrid)):this._rasterTexture.setData(null)),this.suspended||(this.ready(),this.requestRender()))}_createOrDestroyRasterTexture(e){var r,s;const i=t(this.source)?n(this.source,this.bandIds):null;if(!this._isValidSource(i))return void(this._rasterTexture&&(this._rasterTexture.dispose(),this._rasterTextureBandIds=null,this._rasterTexture=null));const a=!this._isBandIdschanged(this.bandIds);if(this._rasterTexture){if(a)return;this._rasterTexture.dispose(),this._rasterTextureBandIds=null,this._rasterTexture=null}this._supportsBilinearTexture=null==(r=e.capabilities.textureFloat)?void 0:r.textureFloatLinear;const o=this._getTextureSamplingMethod(this.interpolation),u=this.isRendereredSource||!(null!=(s=e.capabilities.textureFloat)&&s.textureFloat);this._rasterTexture=_(e,i,o,u),this._rasterTextureBandIds=this.bandIds?[...this.bandIds]:null}_isBandIdschanged(t){const e=this._rasterTextureBandIds;return!(null==e&&null==t||e&&t&&e.join("")===t.join(""))}_isValidSource(e){var r;return t(e)&&(null==(r=e.pixels)?void 0:r.length)>0}_getTextureSamplingMethod(e){const{type:r,colormap:s}=this.symbolizerParameters,i="lut"===r||"stretch"===r&&t(s);return!this._supportsBilinearTexture||i||"bilinear"!==e&&"cubic"!==e?"nearest":"bilinear"}_updateColormapTexture(t){const e=this._colormap,r=this.symbolizerParameters.colormap;return r?e?r.length!==e.length||r.some(((t,r)=>t!==e[r]))?(this._colormapTexture&&(this._colormapTexture.dispose(),this._colormapTexture=null),this._colormapTexture=m(t,r),void(this._colormap=r)):void 0:(this._colormapTexture=m(t,r),void(this._colormap=r)):(this._colormapTexture&&(this._colormapTexture.dispose(),this._colormapTexture=null),void(this._colormap=null))}}class c extends p{get source(){return this._source}}function T(e){return t(e.source)}export{p as RasterBitmap,c as RasterBitmapWithSource,T as hasSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{isSome as t,isNone as e}from"../../../../core/maybe.js";import{b as s,c as a,r,j as i,m as o}from"../../../../chunks/mat3.js";import{c as n}from"../../../../chunks/mat3f32.js";import{f as l}from"../../../../chunks/vec2f32.js";import{createVFMesh as c,createVFMeshScalar as h}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{DisplayObject as m}from"../DisplayObject.js";import{createProgramDescriptor as u}from"../webgl/Utils.js";import{BufferObject as d}from"../../../webgl/BufferObject.js";import{Usage as v,DataType as f}from"../../../webgl/enums.js";import{VertexArrayObject as _}from"../../../webgl/VertexArrayObject.js";class y extends m{constructor(t=null){super(),this._source=null,this._symbolizerParameters=null,this._vaoInvalidated=!0,this.coordScale=[1,1],this.height=null,this.stencilRef=0,this.resolution=null,this.pixelRatio=1,this.x=0,this.y=0,this.rotation=0,this.rawPixelData=null,this.width=null,this.source=t}destroy(){var e,s;t(this.vaoData)&&(null==(e=this.vaoData.magdir)||e.vao.dispose(),null==(s=this.vaoData.scalar)||s.vao.dispose(),this.vaoData=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(t){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(t)&&(this._symbolizerParameters=t,this.invalidateVAO())}get source(){return this._source}set source(t){this._source=t,this.invalidateVAO()}invalidateVAO(){var e,s;!this._vaoInvalidated&&t(this.vaoData)&&(null==(e=this.vaoData.magdir)||e.vao.dispose(),null==(s=this.vaoData.scalar)||s.vao.dispose(),this.vaoData=null,this._vaoInvalidated=!0,this.requestRender())}updateVectorFieldVAO(s){if(this._vaoInvalidated){if(this._vaoInvalidated=!1,t(this.source)&&e(this.vaoData)){const{style:t}=this.symbolizerParameters;switch(t){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const t=c(this.source,this.symbolizerParameters),e=this._createVectorFieldVAO(s.context,t);this.vaoData={magdir:e}}break;case"simple_scalar":{const t=h(this.source,this.symbolizerParameters),e=this._createVectorFieldVAO(s.context,t);this.vaoData={scalar:e}}break;case"wind_speed":{const t=c(this.source,this.symbolizerParameters),e=this._createVectorFieldVAO(s.context,t),a=h(this.source,this.symbolizerParameters),r=this._createVectorFieldVAO(s.context,a);this.vaoData={magdir:e,scalar:r}}}}this.ready(),this.requestRender()}}_createTransforms(){return{dvs:n()}}setTransform(t){const e=s(this.transforms.dvs),[n,c]=t.toScreenNoRotation([0,0],[this.x,this.y]),h=this.resolution/this.pixelRatio/t.resolution,m=h*this.width,u=h*this.height,d=Math.PI*this.rotation/180;a(e,e,l(n,c)),a(e,e,l(m/2,u/2)),r(e,e,-d),a(e,e,l(-m/2,-u/2)),i(e,e,l(m,u)),o(this.transforms.dvs,t.displayViewMat3,e)}onAttach(){this.invalidateVAO()}onDetach(){this.invalidateVAO()}_createVectorFieldVAO(t,e){const{vertexData:s,indexData:a}=e,r=d.createVertex(t,v.STATIC_DRAW,new Float32Array(s)),i=d.createIndex(t,v.STATIC_DRAW,new Uint32Array(a)),o=u("vector-field",{geometry:[{location:0,name:"a_pos",count:2,type:f.FLOAT,normalized:!1},{location:1,name:"a_offset",count:2,type:f.FLOAT,normalized:!1},{location:2,name:"a_vv",count:2,type:f.FLOAT,normalized:!1}]});return{vao:new _(t,o.attributes,o.bufferLayouts,{geometry:r},i),elementCount:a.length}}}export{y as RasterVFDisplayObject};
5
+ import"../../../../core/has.js";import{isSome as t,isNone as e}from"../../../../core/maybe.js";import{b as s,c as a,r,h as i,m as o}from"../../../../chunks/mat3.js";import{c as n}from"../../../../chunks/mat3f32.js";import{f as l}from"../../../../chunks/vec2f32.js";import{createVFMesh as c,createVFMeshScalar as h}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{DisplayObject as m}from"../DisplayObject.js";import{createProgramDescriptor as u}from"../webgl/Utils.js";import{BufferObject as d}from"../../../webgl/BufferObject.js";import{Usage as v,DataType as f}from"../../../webgl/enums.js";import{VertexArrayObject as _}from"../../../webgl/VertexArrayObject.js";class y extends m{constructor(t=null){super(),this._source=null,this._symbolizerParameters=null,this._vaoInvalidated=!0,this.coordScale=[1,1],this.height=null,this.stencilRef=0,this.resolution=null,this.pixelRatio=1,this.x=0,this.y=0,this.rotation=0,this.rawPixelData=null,this.width=null,this.source=t}destroy(){var e,s;t(this.vaoData)&&(null==(e=this.vaoData.magdir)||e.vao.dispose(),null==(s=this.vaoData.scalar)||s.vao.dispose(),this.vaoData=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(t){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(t)&&(this._symbolizerParameters=t,this.invalidateVAO())}get source(){return this._source}set source(t){this._source=t,this.invalidateVAO()}invalidateVAO(){var e,s;!this._vaoInvalidated&&t(this.vaoData)&&(null==(e=this.vaoData.magdir)||e.vao.dispose(),null==(s=this.vaoData.scalar)||s.vao.dispose(),this.vaoData=null,this._vaoInvalidated=!0,this.requestRender())}updateVectorFieldVAO(s){if(this._vaoInvalidated){if(this._vaoInvalidated=!1,t(this.source)&&e(this.vaoData)){const{style:t}=this.symbolizerParameters;switch(t){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const t=c(this.source,this.symbolizerParameters),e=this._createVectorFieldVAO(s.context,t);this.vaoData={magdir:e}}break;case"simple_scalar":{const t=h(this.source,this.symbolizerParameters),e=this._createVectorFieldVAO(s.context,t);this.vaoData={scalar:e}}break;case"wind_speed":{const t=c(this.source,this.symbolizerParameters),e=this._createVectorFieldVAO(s.context,t),a=h(this.source,this.symbolizerParameters),r=this._createVectorFieldVAO(s.context,a);this.vaoData={magdir:e,scalar:r}}}}this.ready(),this.requestRender()}}_createTransforms(){return{dvs:n()}}setTransform(t){const e=s(this.transforms.dvs),[n,c]=t.toScreenNoRotation([0,0],[this.x,this.y]),h=this.resolution/this.pixelRatio/t.resolution,m=h*this.width,u=h*this.height,d=Math.PI*this.rotation/180;a(e,e,l(n,c)),a(e,e,l(m/2,u/2)),r(e,e,-d),a(e,e,l(-m/2,-u/2)),i(e,e,l(m,u)),o(this.transforms.dvs,t.displayViewMat3,e)}onAttach(){this.invalidateVAO()}onDetach(){this.invalidateVAO()}_createVectorFieldVAO(t,e){const{vertexData:s,indexData:a}=e,r=d.createVertex(t,v.STATIC_DRAW,new Float32Array(s)),i=d.createIndex(t,v.STATIC_DRAW,new Uint32Array(a)),o=u("vector-field",{geometry:[{location:0,name:"a_pos",count:2,type:f.FLOAT,normalized:!1},{location:1,name:"a_offset",count:2,type:f.FLOAT,normalized:!1},{location:2,name:"a_vv",count:2,type:f.FLOAT,normalized:!1}]});return{vao:new _(t,o.attributes,o.bufferLayouts,{geometry:r},i),elementCount:a.length}}}export{y as RasterVFDisplayObject};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isLineBreak as t,isWhiteSpace as e,allowsIdeographicBreak as i,hasVerticalOrientation as s}from"./ScriptUtils.js";import o from"../webgl/Rect.js";const c=24,h=17;class a{constructor(t,e,i,s,o,c,h){this._glyphItems=t,this._maxWidth=e,this._lineHeight=i,this._letterSpacing=s,this._hAnchor=o,this._vAnchor=c,this._justify=h}getShaping(o,c,h){const a=this._letterSpacing,l=this._lineHeight,r=this._justify,n=this._maxWidth,m=[];let f=0,p=0;const g=o.length;for(let t=0;t<g;t++){const e=o.charCodeAt(t),i=h&&s(e);let c;for(const t of this._glyphItems)if(c=t[e],c)break;m.push({codePoint:e,x:f,y:p,vertical:i,glyphMosaicItem:c}),c&&(f+=c.metrics.advance+a)}let y=f;if(n>0){y=f/Math.max(1,Math.ceil(f/n))}const d=o.indexOf("​")>=0,x=[];for(let e=0;e<g-1;e++){const s=m[e].codePoint,o=i(s);if(t(s)||o){let t=0;if(10===s)t-=1e4;else if(o&&d)t+=150;else{40!==s&&65288!==s||(t+=50);const i=m[e+1].codePoint;41!==i&&65289!==i||(t+=50)}x.push(this._buildBreak(e+1,m[e].x,y,x,t,!1))}}const M=this._optimalBreaks(this._buildBreak(g,f,y,x,0,!0));let u=0;const _=c?-l:l;let I=0;for(let t=0;t<M.length;t++){const i=M[t];let s=I;for(;s<i&&e(m[s].codePoint);)m[s].glyphMosaicItem=null,++s;let o=i-1;for(;o>s&&e(m[o].codePoint);)m[o].glyphMosaicItem=null,--o;if(s<=o){const t=m[s].x;for(let i=s;i<=o;i++)m[i].x-=t,m[i].y=p;let e=m[o].x;m[o].glyphMosaicItem&&(e+=m[o].glyphMosaicItem.metrics.advance),u=Math.max(e,u),r&&this._applyJustification(m,s,o)}I=i,p+=_}if(m.length>0){const t=M.length-1,e=(r-this._hAnchor)*u;let i=(-this._vAnchor*(t+1)+.5)*l;c&&t&&(i+=t*l);for(const s of m)s.x+=e,s.y+=i}return m.filter((t=>t.glyphMosaicItem))}static getTextBox(t,e){if(!t.length)return null;let i=1/0,s=1/0,o=0,c=0;for(const a of t){const t=a.glyphMosaicItem.metrics.advance,l=a.x,r=a.y-h,n=l+t,m=r+e;i=Math.min(i,l),o=Math.max(o,n),s=Math.min(s,r),c=Math.max(c,m)}return{x:i,y:s,width:o-i,height:c-s}}static getBox(t){if(!t.length)return null;let e=1/0,i=1/0,s=0,o=0;for(const c of t){const{height:t,left:h,top:a,width:l}=c.glyphMosaicItem.metrics,r=c.x,n=c.y-(t-Math.abs(a)),m=r+l+h,f=n+t;e=Math.min(e,r),s=Math.max(s,m),i=Math.min(i,n),o=Math.max(o,f)}return{x:e,y:i,width:s-e,height:o-i}}static addDecoration(t,e){const i=t.length;if(0===i)return;const s=3;let c=t[0].x+t[0].glyphMosaicItem.metrics.left,h=t[0].y;for(let l=1;l<i;l++){const i=t[l];if(i.y!==h){const a=t[l-1].x+t[l-1].glyphMosaicItem.metrics.left+t[l-1].glyphMosaicItem.metrics.width;t.push({codePoint:0,x:c,y:h+e-s,vertical:!1,glyphMosaicItem:{sdf:!0,rect:new o(4,0,4,8),metrics:{width:a-c,height:2+2*s,left:0,top:0,advance:0},page:0,code:0}}),h=i.y,c=i.x+i.glyphMosaicItem.metrics.left}}const a=t[i-1].x+t[i-1].glyphMosaicItem.metrics.left+t[i-1].glyphMosaicItem.metrics.width;t.push({codePoint:0,x:c,y:h+e-s,vertical:!1,glyphMosaicItem:{sdf:!0,rect:new o(4,0,4,8),metrics:{width:a-c,height:2+2*s,left:0,top:0,advance:0},page:0,code:0}})}_breakScore(t,e,i,s){const o=(t-e)*(t-e);return s?t<e?o/2:2*o:o+Math.abs(i)*i}_buildBreak(t,e,i,s,o,c){let h=null,a=this._breakScore(e,i,o,c);for(const l of s){const t=e-l.x,s=this._breakScore(t,i,o,c)+l.score;s<=a&&(h=l,a=s)}return{index:t,x:e,score:a,previousBreak:h}}_optimalBreaks(t){return t?this._optimalBreaks(t.previousBreak).concat(t.index):[]}_applyJustification(t,e,i){const s=t[i],o=s.vertical?c:s.glyphMosaicItem?s.glyphMosaicItem.metrics.advance:0,h=(s.x+o)*this._justify;for(let c=e;c<=i;c++)t[c].x-=h}}export{h as SDF_GLYPH_BASELINE,c as SDF_GLYPH_SIZE,a as TextShaping};
5
+ import{isLineBreak as t,isWhiteSpace as e,allowsIdeographicBreak as i,hasVerticalOrientation as s}from"./ScriptUtils.js";import o from"../webgl/Rect.js";const c=24,h=17;class a{constructor(t,e,i,s,o,c,h){this._glyphItems=t,this._maxWidth=e,this._lineHeight=i,this._letterSpacing=s,this._hAnchor=o,this._vAnchor=c,this._justify=h}getShaping(o,c,h){const a=this._letterSpacing,l=this._lineHeight,r=this._justify,n=this._maxWidth,m=[];let f=0,p=0;const g=o.length;for(let t=0;t<g;t++){const e=o.charCodeAt(t),i=h&&s(e);let c;for(const t of this._glyphItems)if(c=t[e],c)break;m.push({codePoint:e,x:f,y:p,vertical:i,glyphMosaicItem:c}),c&&(f+=c.metrics.advance+a)}let y=f;if(n>0){y=f/Math.max(1,Math.ceil(f/n))}const d=o.includes("​"),x=[];for(let e=0;e<g-1;e++){const s=m[e].codePoint,o=i(s);if(t(s)||o){let t=0;if(10===s)t-=1e4;else if(o&&d)t+=150;else{40!==s&&65288!==s||(t+=50);const i=m[e+1].codePoint;41!==i&&65289!==i||(t+=50)}x.push(this._buildBreak(e+1,m[e].x,y,x,t,!1))}}const M=this._optimalBreaks(this._buildBreak(g,f,y,x,0,!0));let u=0;const _=c?-l:l;let I=0;for(let t=0;t<M.length;t++){const i=M[t];let s=I;for(;s<i&&e(m[s].codePoint);)m[s].glyphMosaicItem=null,++s;let o=i-1;for(;o>s&&e(m[o].codePoint);)m[o].glyphMosaicItem=null,--o;if(s<=o){const t=m[s].x;for(let i=s;i<=o;i++)m[i].x-=t,m[i].y=p;let e=m[o].x;m[o].glyphMosaicItem&&(e+=m[o].glyphMosaicItem.metrics.advance),u=Math.max(e,u),r&&this._applyJustification(m,s,o)}I=i,p+=_}if(m.length>0){const t=M.length-1,e=(r-this._hAnchor)*u;let i=(-this._vAnchor*(t+1)+.5)*l;c&&t&&(i+=t*l);for(const s of m)s.x+=e,s.y+=i}return m.filter((t=>t.glyphMosaicItem))}static getTextBox(t,e){if(!t.length)return null;let i=1/0,s=1/0,o=0,c=0;for(const a of t){const t=a.glyphMosaicItem.metrics.advance,l=a.x,r=a.y-h,n=l+t,m=r+e;i=Math.min(i,l),o=Math.max(o,n),s=Math.min(s,r),c=Math.max(c,m)}return{x:i,y:s,width:o-i,height:c-s}}static getBox(t){if(!t.length)return null;let e=1/0,i=1/0,s=0,o=0;for(const c of t){const{height:t,left:h,top:a,width:l}=c.glyphMosaicItem.metrics,r=c.x,n=c.y-(t-Math.abs(a)),m=r+l+h,f=n+t;e=Math.min(e,r),s=Math.max(s,m),i=Math.min(i,n),o=Math.max(o,f)}return{x:e,y:i,width:s-e,height:o-i}}static addDecoration(t,e){const i=t.length;if(0===i)return;const s=3;let c=t[0].x+t[0].glyphMosaicItem.metrics.left,h=t[0].y;for(let l=1;l<i;l++){const i=t[l];if(i.y!==h){const a=t[l-1].x+t[l-1].glyphMosaicItem.metrics.left+t[l-1].glyphMosaicItem.metrics.width;t.push({codePoint:0,x:c,y:h+e-s,vertical:!1,glyphMosaicItem:{sdf:!0,rect:new o(4,0,4,8),metrics:{width:a-c,height:2+2*s,left:0,top:0,advance:0},page:0,code:0}}),h=i.y,c=i.x+i.glyphMosaicItem.metrics.left}}const a=t[i-1].x+t[i-1].glyphMosaicItem.metrics.left+t[i-1].glyphMosaicItem.metrics.width;t.push({codePoint:0,x:c,y:h+e-s,vertical:!1,glyphMosaicItem:{sdf:!0,rect:new o(4,0,4,8),metrics:{width:a-c,height:2+2*s,left:0,top:0,advance:0},page:0,code:0}})}_breakScore(t,e,i,s){const o=(t-e)*(t-e);return s?t<e?o/2:2*o:o+Math.abs(i)*i}_buildBreak(t,e,i,s,o,c){let h=null,a=this._breakScore(e,i,o,c);for(const l of s){const t=e-l.x,s=this._breakScore(t,i,o,c)+l.score;s<=a&&(h=l,a=s)}return{index:t,x:e,score:a,previousBreak:h}}_optimalBreaks(t){return t?this._optimalBreaks(t.previousBreak).concat(t.index):[]}_applyJustification(t,e,i){const s=t[i],o=s.vertical?c:s.glyphMosaicItem?s.glyphMosaicItem.metrics.advance:0,h=(s.x+o)*this._justify;for(let c=e;c<=i;c++)t[c].x-=h}}export{h as SDF_GLYPH_BASELINE,c as SDF_GLYPH_SIZE,a as TextShaping};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/pbf.js";import{isAborted as t}from"../../../../core/promiseUtils.js";import{loadLibtess as r}from"../../../../geometry/libtess.js";import s from"./Feature.js";import{TriangleIndexBuffer as i}from"./IndexMemoryBuffer.js";import o from"./SourceLayerData.js";import{FillVertexBuffer as n,OutlineVertexBuffer as c,LineVertexBuffer as l,CircleVertexBuffer as a,SymbolVertexBuffer as u}from"./VertexMemoryBuffer.js";import f from"./buckets/CircleBucket.js";import p from"./buckets/FillBucket.js";import h from"./buckets/LineBucket.js";import m from"./buckets/SymbolBucket.js";import{StyleLayerType as _}from"./style/StyleDefinition.js";import{TileClipper as y,SimpleBuilder as d}from"../webgl/TileClipper.js";import{TileStatus as k}from"../../tiling/enums.js";const T=8,g=14,w=5;class B{constructor(t,r,s,i,o){if(this._pbfTiles={},this._tileClippers={},this._client=s,this._tile=r,o){this._styleLayerUIDs=new Set;for(const e of o)this._styleLayerUIDs.add(e)}this._styleRepository=i,this._layers=this._styleRepository.layers;const[n,c,l]=r.tileKey.split("/").map(parseFloat);this._level=n;const a=T+Math.max((this._level-g)*w,0);for(const u of Object.keys(t)){const r=t[u];this._pbfTiles[u]=new e(new Uint8Array(r.protobuff),new DataView(r.protobuff));if(r.refKey){const[e]=r.refKey.split("/").map(parseFloat),t=n-e;if(t>0){const e=(1<<t)-1,r=c&e,s=l&e;this._tileClippers[u]=new y(t,r,s,8,a)}}this._tileClippers[u]||(this._tileClippers[u]=new d)}}_canParseStyleLayer(e){return!this._styleLayerUIDs||this._styleLayerUIDs.has(e)}async parse(e){const t=r(),s=this._initialize(e),{returnedBuckets:i}=s;this._processLayers(s),this._linkReferences(s),this._filterFeatures(s);const o=[],n=new Set,c=(e,t)=>{n.has(e)||(o.push({name:e,repeat:t}),n.add(e))},l={};for(const r of i)r.getResources(r.tileClipper,c,l);if(this._tile.status===k.INVALID)return Promise.resolve([]);const a=this._fetchResources(o,l,e);return Promise.all([...a,t]).then((()=>this._processFeatures(s.returnedBuckets)))}_initialize(e){return{signal:e&&e.signal,sourceNameToTileData:this._parseTileData(this._pbfTiles),layers:this._layers,zoom:this._level,sourceNameToTileClipper:this._tileClippers,sourceNameToUniqueSourceLayerBuckets:{},sourceNameToUniqueSourceLayers:{},returnedBuckets:[],layerIdToBucket:{},referencerUIDToReferencedId:new Map}}_processLayers(e){const{sourceNameToTileData:t,layers:r,zoom:s,sourceNameToTileClipper:i,sourceNameToUniqueSourceLayerBuckets:o,sourceNameToUniqueSourceLayers:n,returnedBuckets:c,layerIdToBucket:l,referencerUIDToReferencedId:a}=e;for(let u=r.length-1;u>=0;u--){const e=r[u];if(!this._canParseStyleLayer(e.uid)||e.minzoom&&s<Math.floor(e.minzoom)||e.maxzoom&&s>=e.maxzoom||e.type===_.BACKGROUND)continue;if(!t[e.source]||!i[e.source])continue;const f=t[e.source],p=i[e.source],h=e.sourceLayer,m=f[h];if(m){let t=n[e.source];if(t||(t=n[e.source]=new Set),t.add(e.sourceLayer),e.refLayerId)a.set(e.uid,e.refLayerId);else{const t=this._createBucket(e);if(t){t.layerUIDs=[e.uid],t.layerExtent=m.extent,t.tileClipper=p;let r=o[e.source];r||(r=o[e.source]={});let s=r[h];s||(s=r[h]=[]),s.push(t),c.push(t),l[e.id]=t}}}}}_linkReferences(e){const{layerIdToBucket:t,referencerUIDToReferencedId:r}=e;r.forEach(((e,r)=>{t[e=e]&&t[e].layerUIDs.push(r)}))}_filterFeatures(e){const{signal:r,sourceNameToTileData:i,sourceNameToUniqueSourceLayerBuckets:o,sourceNameToUniqueSourceLayers:n}=e,c=10*this._level,l=10*(this._level+1),a=[],u=[];for(const t of Object.keys(n)){n[t].forEach((e=>{a.push(e),u.push(t)}))}for(let f=0;f<a.length;f++){const e=u[f],n=a[f];if(!i[e]||!o[e])continue;const p=i[e][n],h=o[e][n];if(!h||0===h.length)continue;if(t(r))return;const m=p.getData();for(;m.nextTag(2);){const e=m.getMessage(),t=new s(e,p);e.release();const r=t.values;if(r){const e=r._minzoom;if(e&&e>=l)continue;const t=r._maxzoom;if(t&&t<=c)continue}for(const s of h)s.pushFeature(t)}}}_fetchResources(e,t,r){const s=[],i=this._tile.getWorkerTileHandler();let o,n;e.length>0&&(o=i.fetchSprites(e,this._client,r),s.push(o));for(const c in t){const e=t[c];e.size>0&&(n=i.fetchGlyphs(this._tile.tileKey,c,e,this._client,r),s.push(n))}return s}_processFeatures(e){const t=e.filter((e=>e.hasFeatures()||this._canParseStyleLayer(e.layer.uid)));for(const r of t)r.processFeatures(r.tileClipper);return t}_parseTileData(e){const t={};for(const r of Object.keys(e)){const s=e[r],i={};for(;s.next();)switch(s.tag()){case 3:{const e=s.getMessage(),t=new o(e);e.release(),i[t.name]=t;break}default:s.skip()}t[r]=i}return t}_createBucket(e){switch(e.type){case _.BACKGROUND:return null;case _.FILL:return this._createFillBucket(e);case _.LINE:return this._createLineBucket(e);case _.CIRCLE:return this._createCircleBucket(e);case _.SYMBOL:return this._createSymbolBucket(e)}}_createFillBucket(e){return new p(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new n(e.fillMaterial.getStride()),new i,new c(e.outlineMaterial.getStride()),new i)}_createLineBucket(e){return new h(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new l(e.lineMaterial.getStride()),new i)}_createCircleBucket(e){return new f(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new a(e.circleMaterial.getStride()),new i)}_createSymbolBucket(e){const t=this._tile;return new m(e,this._level,new u(e.iconMaterial.getStride()),new i,new u(e.textMaterial.getStride()),new i,t.placementEngine,t.getWorkerTileHandler())}}export{B as default};
5
+ import e from"../../../../core/pbf.js";import{isAborted as t}from"../../../../core/promiseUtils.js";import{loadLibtess as r}from"../../../../geometry/libtess.js";import s from"./Feature.js";import{TriangleIndexBuffer as i}from"./IndexMemoryBuffer.js";import o from"./SourceLayerData.js";import{FillVertexBuffer as n,OutlineVertexBuffer as c,LineVertexBuffer as l,CircleVertexBuffer as a,SymbolVertexBuffer as u}from"./VertexMemoryBuffer.js";import f from"./buckets/CircleBucket.js";import p from"./buckets/FillBucket.js";import h from"./buckets/LineBucket.js";import m from"./buckets/SymbolBucket.js";import{StyleLayerType as _}from"./style/StyleDefinition.js";import{TileClipper as y,SimpleBuilder as d}from"../webgl/TileClipper.js";import{TileStatus as k}from"../../tiling/enums.js";const T=8,g=14,w=5;class B{constructor(t,r,s,i,o){if(this._pbfTiles={},this._tileClippers={},this._client=s,this._tile=r,o){this._styleLayerUIDs=new Set;for(const e of o)this._styleLayerUIDs.add(e)}this._styleRepository=i,this._layers=this._styleRepository.layers;const[n,c,l]=r.tileKey.split("/").map(parseFloat);this._level=n;const a=T+Math.max((this._level-g)*w,0);for(const u of Object.keys(t)){const r=t[u];this._pbfTiles[u]=new e(new Uint8Array(r.protobuff),new DataView(r.protobuff));if(r.refKey){const[e]=r.refKey.split("/").map(parseFloat),t=n-e;if(t>0){const e=(1<<t)-1,r=c&e,s=l&e;this._tileClippers[u]=new y(t,r,s,8,a)}}this._tileClippers[u]||(this._tileClippers[u]=new d)}}_canParseStyleLayer(e){return!this._styleLayerUIDs||this._styleLayerUIDs.has(e)}async parse(e){const t=r(),s=this._initialize(e),{returnedBuckets:i}=s;this._processLayers(s),this._linkReferences(s),this._filterFeatures(s);const o=[],n=new Set,c=(e,t)=>{n.has(e)||(o.push({name:e,repeat:t}),n.add(e))},l={};for(const r of i)r.getResources(r.tileClipper,c,l);if(this._tile.status===k.INVALID)return[];const a=this._fetchResources(o,l,e);return Promise.all([...a,t]).then((()=>this._processFeatures(s.returnedBuckets)))}_initialize(e){return{signal:e&&e.signal,sourceNameToTileData:this._parseTileData(this._pbfTiles),layers:this._layers,zoom:this._level,sourceNameToTileClipper:this._tileClippers,sourceNameToUniqueSourceLayerBuckets:{},sourceNameToUniqueSourceLayers:{},returnedBuckets:[],layerIdToBucket:{},referencerUIDToReferencedId:new Map}}_processLayers(e){const{sourceNameToTileData:t,layers:r,zoom:s,sourceNameToTileClipper:i,sourceNameToUniqueSourceLayerBuckets:o,sourceNameToUniqueSourceLayers:n,returnedBuckets:c,layerIdToBucket:l,referencerUIDToReferencedId:a}=e;for(let u=r.length-1;u>=0;u--){const e=r[u];if(!this._canParseStyleLayer(e.uid)||e.minzoom&&s<Math.floor(e.minzoom)||e.maxzoom&&s>=e.maxzoom||e.type===_.BACKGROUND)continue;if(!t[e.source]||!i[e.source])continue;const f=t[e.source],p=i[e.source],h=e.sourceLayer,m=f[h];if(m){let t=n[e.source];if(t||(t=n[e.source]=new Set),t.add(e.sourceLayer),e.refLayerId)a.set(e.uid,e.refLayerId);else{const t=this._createBucket(e);if(t){t.layerUIDs=[e.uid],t.layerExtent=m.extent,t.tileClipper=p;let r=o[e.source];r||(r=o[e.source]={});let s=r[h];s||(s=r[h]=[]),s.push(t),c.push(t),l[e.id]=t}}}}}_linkReferences(e){const{layerIdToBucket:t,referencerUIDToReferencedId:r}=e;r.forEach(((e,r)=>{t[e=e]&&t[e].layerUIDs.push(r)}))}_filterFeatures(e){const{signal:r,sourceNameToTileData:i,sourceNameToUniqueSourceLayerBuckets:o,sourceNameToUniqueSourceLayers:n}=e,c=10*this._level,l=10*(this._level+1),a=[],u=[];for(const t of Object.keys(n)){n[t].forEach((e=>{a.push(e),u.push(t)}))}for(let f=0;f<a.length;f++){const e=u[f],n=a[f];if(!i[e]||!o[e])continue;const p=i[e][n],h=o[e][n];if(!h||0===h.length)continue;if(t(r))return;const m=p.getData();for(;m.nextTag(2);){const e=m.getMessage(),t=new s(e,p);e.release();const r=t.values;if(r){const e=r._minzoom;if(e&&e>=l)continue;const t=r._maxzoom;if(t&&t<=c)continue}for(const s of h)s.pushFeature(t)}}}_fetchResources(e,t,r){const s=[],i=this._tile.getWorkerTileHandler();let o,n;e.length>0&&(o=i.fetchSprites(e,this._client,r),s.push(o));for(const c in t){const e=t[c];e.size>0&&(n=i.fetchGlyphs(this._tile.tileKey,c,e,this._client,r),s.push(n))}return s}_processFeatures(e){const t=e.filter((e=>e.hasFeatures()||this._canParseStyleLayer(e.layer.uid)));for(const r of t)r.processFeatures(r.tileClipper);return t}_parseTileData(e){const t={};for(const r of Object.keys(e)){const s=e[r],i={};for(;s.next();)switch(s.tag()){case 3:{const e=s.getMessage(),t=new o(e);e.release(),i[t.name]=t;break}default:s.skip()}t[r]=i}return t}_createBucket(e){switch(e.type){case _.BACKGROUND:return null;case _.FILL:return this._createFillBucket(e);case _.LINE:return this._createLineBucket(e);case _.CIRCLE:return this._createCircleBucket(e);case _.SYMBOL:return this._createSymbolBucket(e)}}_createFillBucket(e){return new p(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new n(e.fillMaterial.getStride()),new i,new c(e.outlineMaterial.getStride()),new i)}_createLineBucket(e){return new h(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new l(e.lineMaterial.getStride()),new i)}_createCircleBucket(e){return new f(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new a(e.circleMaterial.getStride()),new i)}_createSymbolBucket(e){const t=this._tile;return new m(e,this._level,new u(e.iconMaterial.getStride()),new i,new u(e.textMaterial.getStride()),new i,t.placementEngine,t.getWorkerTileHandler())}}export{B 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.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/BidiEngine.js";import{numericHash as t}from"../../../../../core/string.js";import{BucketType as n}from"../enums.js";import{C_DEG_TO_RAD as i,log2 as s,interpolate as a}from"../GeometryUtils.js";import{TILE_PIXEL_RATIO as o,Anchor as r,TILE_COORD_SIZE as l}from"../Placement.js";import{SDF_GLYPH_SIZE as h,TextShaping as x}from"../TextShaping.js";import c from"./BaseBucket.js";import{TextTransform as d,SymbolPlacement as f,TextWritingMode as g,SymbolAnchor as y,TextJustification as m,RotationAlignment as u}from"../style/StyleDefinition.js";import{IconLayout as p,TextLayout as _}from"../style/StyleLayer.js";import{GeometryType as M,Point as P}from"../../webgl/Geometry.js";const I=10;function b(e,t){return e.iconMosaicItem&&t.iconMosaicItem?e.iconMosaicItem.page===t.iconMosaicItem.page?0:e.iconMosaicItem.page-t.iconMosaicItem.page:e.iconMosaicItem&&!t.iconMosaicItem?1:!e.iconMosaicItem&&t.iconMosaicItem?-1:0}class A extends c{constructor(e,t,i,s,a,o,r,l){super(e,t,l.getSpriteItems()),this.type=n.SYMBOL,this._markerMap=new Map,this._glyphMap=new Map,this._glyphBufferDataStorage=new Map,this._isIconSDF=!1,this._iconVertexBuffer=i,this._iconIndexBuffer=s,this._textVertexBuffer=a,this._textIndexBuffer=o,this._placementEngine=r,this._workerTileHandler=l}get markerPageMap(){return this._markerMap}get glyphsPageMap(){return this._glyphMap}get symbolInstances(){return this._symbolInstances}getResources(e,n,i){const s=this.layer,a=this.zoom;e&&e.setExtent(this.layerExtent);const o=s.getLayoutProperty("icon-image"),r=s.getLayoutProperty("text-field");let l=s.getLayoutProperty("text-transform"),h=s.getLayoutProperty("text-font");const x=[];let c,f,g,y;o&&!o.isDataDriven&&(c=o.getValue(a)),r&&!r.isDataDriven&&(f=r.getValue(a)),l&&l.isDataDriven||(g=s.getLayoutValue("text-transform",a),l=null),h&&h.isDataDriven||(y=s.getLayoutValue("text-font",a),h=null);for(const m of this._features){const u=m.getGeometry(e);if(!u||0===u.length)continue;let p,_;o&&(p=o.isDataDriven?o.getValue(a,m):this._replaceKeys(c,m.values),p&&n(p));let M=!1;if(r&&(_=r.isDataDriven?r.getValue(a,m):this._replaceKeys(f,m.values),_)){switch(_=_.replace(/\\n/g,"\n"),l&&(g=l.getValue(a,m)),g){case d.LOWERCASE:_=_.toLowerCase();break;case d.UPPERCASE:_=_.toUpperCase()}if(A._bidiEngine.hasBidiChar(_)){let e;e="rtl"===A._bidiEngine.checkContextual(_)?"IDNNN":"ICNNN",_=A._bidiEngine.bidiTransform(_,e,"VLYSN"),M=!0}const e=_.length;if(e>0){h&&(y=h.getValue(a,m));for(const t of y){let n=i[t];n||(n=i[t]=new Set);for(let t=0;t<e;t++){const e=_.charCodeAt(t);n.add(e)}}}}if(!p&&!_)continue;const P=s.getLayoutValue("symbol-sort-key",a,m),I={feature:m,sprite:p,label:_,rtl:M,geometry:u,hash:(_?t(_):0)^(p?t(p):0),priority:P,textFont:y};x.push(I)}this._symbolFeatures=x}processFeatures(e){e&&e.setExtent(this.layerExtent);const t=this.layer,n=this.zoom,s=t.getLayoutValue("symbol-placement",n),a=s!==f.POINT,c=t.getLayoutValue("symbol-spacing",n)*o,d=t.getLayoutProperty("icon-image"),P=t.getLayoutProperty("text-field"),I=d?new p(t,n,a):null,L=P?new _(t,n,a):null,V=this._workerTileHandler;let T;d&&(T=V.getSpriteItems()),this._iconIndexStart=3*this._iconIndexBuffer.index,this._textIndexStart=3*this._textIndexBuffer.index,this._iconIndexCount=0,this._textIndexCount=0,this._markerMap.clear(),this._glyphMap.clear();const w=[];let B=1;L&&L.size&&(B=L.size/h);const C=L?L.maxAngle*i:0,R=L?L.size*o:0;for(const i of this._symbolFeatures){let e;I&&T&&i.sprite&&(e=T[i.sprite],e&&e.sdf&&(this._isIconSDF=!0));let t;!!e&&I.update(n,i.feature);let d=0;const p=i.label;if(p){L.update(n,i.feature);const e=a?L.keepUpright:L.writingMode&&L.writingMode.indexOf(g.VERTICAL)>=0;let s=.5;switch(L.anchor){case y.TOP_LEFT:case y.LEFT:case y.BOTTOM_LEFT:s=0;break;case y.TOP_RIGHT:case y.RIGHT:case y.BOTTOM_RIGHT:s=1}let r=.5;switch(L.anchor){case y.TOP_LEFT:case y.TOP:case y.TOP_RIGHT:r=0;break;case y.BOTTOM_LEFT:case y.BOTTOM:case y.BOTTOM_RIGHT:r=1}let l=.5;switch(L.justify){case m.AUTO:l=s;break;case m.LEFT:l=0;break;case m.RIGHT:l=1}const c=L.letterSpacing*h,f=a?0:L.maxWidth*h,u=L.lineHeight*h,_=i.textFont.map((e=>V.getGlyphItems(e)));if(t=new x(_,f,u,c,s,r,l).getShaping(p,i.rtl,e),t&&t.length>0){let e=1e30,n=-1e30;for(const i of t)e=Math.min(e,i.x),n=Math.max(n,i.x);d=(n-e+2*h)*B*o}}for(let n of i.geometry){const h=[];if(s===f.LINE){if(t&&t.length>0&&L&&L.size){const e=L.size*o*(2+Math.min(2,4*Math.abs(L.offset[1])));n=A._smoothVertices(n,e)}A._pushAnchors(h,n,c,d)}else s===f.LINE_CENTER?A._pushCenterAnchor(h,n):i.feature.type===M.Polygon?A._pushCentroid(h,n):h.push(new r(n[0].x,n[0].y));for(const s of h){if(s.x<0||s.x>l||s.y<0||s.y>l)continue;if(a&&d>0&&L.rotationAlignment===u.MAP&&!A._honorsTextMaxAngle(n,s,d,C,R))continue;const o={shaping:t,line:n,iconMosaicItem:e,anchor:s,symbolFeature:i,textColliders:[],iconColliders:[],textVertexRanges:[],iconVertexRanges:[]};w.push(o),this._processFeature(o,I,L)}}}w.sort(b),this._addPlacedGlyphs(),this._symbolInstances=w}serialize(){let e=11;e+=this.layerUIDs.length,e+=3*this.markerPageMap.size,e+=3*this.glyphsPageMap.size,e+=A._symbolsSerializationLength(this._symbolInstances),e+=this._iconVertexBuffer.array.length,e+=this._iconIndexBuffer.array.length,e+=this._textVertexBuffer.array.length,e+=this._textIndexBuffer.array.length;const t=new Uint32Array(e),n=new Int32Array(t.buffer),i=new Float32Array(t.buffer);let s=0;t[s++]=this.type,t[s++]=this.layerUIDs.length;for(let a=0;a<this.layerUIDs.length;a++)t[s++]=this.layerUIDs[a];t[s++]=this._isIconSDF?1:0,t[s++]=this.markerPageMap.size;for(const[a,[o,r]]of this.markerPageMap)t[s++]=a,t[s++]=o,t[s++]=r;t[s++]=this.glyphsPageMap.size;for(const[a,[o,r]]of this.glyphsPageMap)t[s++]=a,t[s++]=o,t[s++]=r;t[s++]=this._iconVertexBuffer.index/4,t[s++]=this._textVertexBuffer.index/4,s=A.serializeSymbols(t,n,i,s,this._symbolInstances),t[s++]=this._iconVertexBuffer.array.length;for(let a=0;a<this._iconVertexBuffer.array.length;a++)n[s++]=this._iconVertexBuffer.array[a];t[s++]=this._iconIndexBuffer.array.length;for(let a=0;a<this._iconIndexBuffer.array.length;a++)t[s++]=this._iconIndexBuffer.array[a];t[s++]=this._textVertexBuffer.array.length;for(let a=0;a<this._textVertexBuffer.array.length;a++)n[s++]=this._textVertexBuffer.array[a];t[s++]=this._textIndexBuffer.array.length;for(let a=0;a<this._textIndexBuffer.array.length;a++)t[s++]=this._textIndexBuffer.array[a];return t.buffer}static _symbolsSerializationLength(e){let t=0;t+=1;for(const n of e||[]){t+=4,t+=1;for(const e of n.textColliders)t+=I;for(const e of n.iconColliders)t+=I;t+=1,t+=2*n.textVertexRanges.length,t+=1,t+=2*n.iconVertexRanges.length}return t}static serializeSymbols(e,t,n,i,s){s=s||[],t[i++]=s.length;for(const a of s){t[i++]=a.anchor.x,t[i++]=a.anchor.y,t[i++]=a.symbolFeature.hash,t[i++]=a.symbolFeature.priority,t[i++]=a.textColliders.length+a.iconColliders.length;for(const e of a.textColliders)t[i++]=e.xTile,t[i++]=e.yTile,t[i++]=e.dxPixels,t[i++]=e.dyPixels,t[i++]=e.hard?1:0,t[i++]=e.partIndex,n[i++]=e.minLod,n[i++]=e.maxLod,t[i++]=e.width,t[i++]=e.height;for(const e of a.iconColliders)t[i++]=e.xTile,t[i++]=e.yTile,t[i++]=e.dxPixels,t[i++]=e.dyPixels,t[i++]=e.hard?1:0,t[i++]=e.partIndex,n[i++]=e.minLod,n[i++]=e.maxLod,t[i++]=e.width,t[i++]=e.height;t[i++]=a.textVertexRanges.length;for(const[e,n]of a.textVertexRanges)t[i++]=e,t[i++]=n;t[i++]=a.iconVertexRanges.length;for(const[e,n]of a.iconVertexRanges)t[i++]=e,t[i++]=n}return i}_replaceKeys(e,t){return e.replace(/{([^{}]+)}/g,(function(e,n){return n in t?t[n]:""}))}_processFeature(e,t,n){const{line:i,iconMosaicItem:a,shaping:o,anchor:r}=e,l=this.zoom,h=this.layer,x=!!a;let c=!0;x&&(c=t.optional||!a);const d=o&&o.length>0;let f,g,y=!0;if(d&&(y=n.optional),x&&(f=this._placementEngine.getIconPlacement(r,a,t)),(f||c)&&(d&&(g=this._placementEngine.getTextPlacement(r,o,i,n)),g||y)){if(f&&g||(y||c?y||g?c||f||(g=null):f=null:(f=null,g=null)),g){const t=h.hasDataDrivenText?h.textMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._storePlacedGlyphs(e,g.shapes,l,n.rotationAlignment,t),g.textColliders){e.textColliders=g.textColliders;for(const e of g.textColliders){e.minLod=Math.max(l+s(e.minLod),0),e.maxLod=Math.min(l+s(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),i=Math.sin(t),s=e.dxPixels*n-e.dyPixels*i,a=e.dxPixels*i+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*i,r=(e.dxPixels+e.width)*i+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*i,h=e.dxPixels*i+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*i,c=(e.dxPixels+e.width)*i+(e.dyPixels+e.height)*n,d=Math.min(s,o,l,x),f=Math.max(s,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}if(f){const n=h.hasDataDrivenIcon?h.iconMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._addPlacedIcons(e,f.shapes,l,a.page,t.rotationAlignment===u.VIEWPORT,n),f.iconColliders){e.iconColliders=f.iconColliders;for(const e of f.iconColliders){e.minLod=Math.max(l+s(e.minLod),0),e.maxLod=Math.min(l+s(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),i=Math.sin(t),s=e.dxPixels*n-e.dyPixels*i,a=e.dxPixels*i+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*i,r=(e.dxPixels+e.width)*i+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*i,h=e.dxPixels*i+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*i,c=(e.dxPixels+e.width)*i+(e.dyPixels+e.height)*n,d=Math.min(s,o,l,x),f=Math.max(s,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}}}_addPlacedIcons(e,t,n,i,a,o){const r=Math.max(n-1,0),l=this._iconVertexBuffer,h=this._iconIndexBuffer,x=this._markerMap;for(const c of t){const t=a?0:Math.max(n+s(c.minzoom),r),d=a?25:Math.min(n+s(c.maxzoom),25);if(d<=t)continue;const f=c.tl,g=c.tr,y=c.bl,m=c.br,u=c.mosaicRect,p=c.labelAngle,_=c.minAngle,M=c.maxAngle,P=c.anchor,I=l.index,b=u.x,A=u.y,L=b+u.width,V=A+u.height,T=l.index;l.add(P.x,P.y,f.x,f.y,b,A,p,_,M,t,d,o),l.add(P.x,P.y,g.x,g.y,L,A,p,_,M,t,d,o),l.add(P.x,P.y,y.x,y.y,b,V,p,_,M,t,d,o),l.add(P.x,P.y,m.x,m.y,L,V,p,_,M,t,d,o),e.iconVertexRanges.length>0&&e.iconVertexRanges[0][0]+e.iconVertexRanges[0][1]===T?e.iconVertexRanges[0][1]+=4:e.iconVertexRanges.push([T,4]),h.add(I+0,I+1,I+2),h.add(I+1,I+2,I+3),x.has(i)?x.get(i)[1]+=6:x.set(i,[this._iconIndexStart+this._iconIndexCount,6]),this._iconIndexCount+=6}}_addPlacedGlyphs(){const e=this._textVertexBuffer,t=this._textIndexBuffer,n=this._glyphMap;for(const[i,s]of this._glyphBufferDataStorage)for(const a of s){const s=e.index,o=a.symbolInstance,r=a.ddAttributes,l=e.index;e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tl[0],a.tl[1],a.xmin,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tr[0],a.tr[1],a.xmax,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.bl[0],a.bl[1],a.xmin,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.br[0],a.br[1],a.xmax,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),o.textVertexRanges.length>0&&o.textVertexRanges[0][0]+o.textVertexRanges[0][1]===l?o.textVertexRanges[0][1]+=4:o.textVertexRanges.push([l,4]),t.add(s+0,s+1,s+2),t.add(s+1,s+2,s+3),n.has(i)?n.get(i)[1]+=6:n.set(i,[this._textIndexStart+this._textIndexCount,6]),this._textIndexCount+=6}this._glyphBufferDataStorage.clear()}_storePlacedGlyphs(e,t,n,i,a){const o=Math.max(n-1,0),r=i===u.VIEWPORT;let l,h,x,c,d,f,g,y,m,p,_;for(const u of t){if(l=r?0:Math.max(n+s(u.minzoom),o),h=r?25:Math.min(n+s(u.maxzoom),25),h<=l)continue;x=u.tl,c=u.tr,d=u.bl,f=u.br,g=u.labelAngle,y=u.minAngle,m=u.maxAngle,p=u.anchor,_=u.mosaicRect,this._glyphBufferDataStorage.has(u.page)||this._glyphBufferDataStorage.set(u.page,[]);this._glyphBufferDataStorage.get(u.page).push({glyphAnchor:[p.x,p.y],tl:[x.x,x.y],tr:[c.x,c.y],bl:[d.x,d.y],br:[f.x,f.y],xmin:_.x,ymin:_.y,xmax:_.x+_.width,ymax:_.y+_.height,labelAngle:g,minAngle:y,maxAngle:m,minLod:l,maxLod:h,placementLod:o,symbolInstance:e,ddAttributes:a})}}static _pushAnchors(e,t,n,i){n+=i;let s=0;const o=t.length-1;for(let a=0;a<o;a++)s+=P.distance(t[a],t[a+1]);let l=i||n;if(l*=.5,s<=l)return;const h=l/s;let x=0,c=-(n=s/Math.max(Math.round(s/n),1))/2;const d=t.length-1;for(let f=0;f<d;f++){const i=t[f],s=t[f+1],o=s.x-i.x,l=s.y-i.y,d=Math.sqrt(o*o+l*l);let g;for(;c+n<x+d;){c+=n;const t=(c-x)/d,y=a(i.x,s.x,t),m=a(i.y,s.y,t);void 0===g&&(g=Math.atan2(l,o)),e.push(new r(y,m,g,f,h))}x+=d}}static _pushCenterAnchor(e,t){let n=0;const i=t.length-1;for(let a=0;a<i;a++)n+=P.distance(t[a],t[a+1]);const s=n/2;let o=0;const l=t.length-1;for(let h=0;h<l;h++){const n=t[h],i=t[h+1],l=i.x-n.x,x=i.y-n.y,c=Math.sqrt(l*l+x*x);if(s<o+c){const t=(s-o)/c,d=a(n.x,i.x,t),f=a(n.y,i.y,t),g=Math.atan2(x,l);return void e.push(new r(d,f,g,h,0))}o+=c}}static _deviation(e,t,n){const i=(t.x-e.x)*(n.x-t.x)+(t.y-e.y)*(n.y-t.y),s=(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x);return Math.atan2(s,i)}static _honorsTextMaxAngle(e,t,n,i,s){let a=0;const o=n/2;let r=new P(t.x,t.y),l=t.segment+1;for(;a>-o;){if(--l,l<0)return!1;a-=P.distance(e[l],r),r=e[l]}a+=P.distance(e[l],e[l+1]);const h=[];let x=0;const c=e.length;for(;a<o;){const t=e[l];let n,o=l;do{if(++o,o===c)return!1;n=e[o]}while(n.isEqual(t));let r,d=o;do{if(++d,d===c)return!1;r=e[d]}while(r.isEqual(n));const f=this._deviation(t,n,r);for(h.push({deviation:f,distToAnchor:a}),x+=f;a-h[0].distToAnchor>s;)x-=h.shift().deviation;if(Math.abs(x)>i)return!1;a+=P.distance(n,r),l=o}return!0}static _smoothVertices(e,t){if(t<=0)return e;let n=e.length;if(n<3)return e;const i=[];let s=0,a=0;i.push(0);for(let g=1;g<n;g++){const t=P.distance(e[g],e[g-1]);t>0&&(s+=t,i.push(s),a++,a!==g&&(e[a]=e[g]))}if(n=a+1,n<3)return e;t=Math.min(t,.2*s);const o=e[0].x,r=e[0].y,l=e[n-1].x,h=e[n-1].y,x=P.sub(e[0],e[1]);x.normalize(),e[0].x+=t*x.x,e[0].y+=t*x.y,x.assignSub(e[n-1],e[n-2]),x.normalize(),e[n-1].x+=t*x.x,e[n-1].y+=t*x.y,i[0]-=t,i[n-1]+=t;const c=[];c.push(new P(o,r));const d=1e-6,f=.5*t;for(let g=1;g<n-1;g++){let s=0,a=0,o=0;for(let n=g-1;n>=0;n--){const r=f+i[n+1]-i[g];if(r<0)break;const l=i[n+1]-i[n],h=i[g]-i[n]<f?1:r/l;if(h<d)break;const x=h*h,c=h*r-.5*x*l,y=h*l/t,m=e[n+1],u=e[n].x-m.x,p=e[n].y-m.y;s+=y/c*(m.x*h*r+.5*x*(r*u-l*m.x)-x*h*l*u/3),a+=y/c*(m.y*h*r+.5*x*(r*p-l*m.y)-x*h*l*p/3),o+=y}for(let r=g+1;r<n;r++){const n=f-i[r-1]+i[g];if(n<0)break;const l=i[r]-i[r-1],h=i[r]-i[g]<f?1:n/l;if(h<d)break;const x=h*h,c=h*n-.5*x*l,y=h*l/t,m=e[r-1],u=e[r].x-m.x,p=e[r].y-m.y;s+=y/c*(m.x*h*n+.5*x*(n*u-l*m.x)-x*h*l*u/3),a+=y/c*(m.y*h*n+.5*x*(n*p-l*m.y)-x*h*l*p/3),o+=y}c.push(new P(s/o,a/o))}return c.push(new P(l,h)),e[0].x=o,e[0].y=r,e[n-1].x=l,e[n-1].y=h,c}static _pushCentroid(e,t){const n=0,i=0,s=4096,a=4096,o=t.length-1;let l=0,h=0,x=0,c=t[0].x,d=t[0].y;c>s&&(c=s),c<n&&(c=n),d>a&&(d=a),d<i&&(d=i);for(let r=1;r<o;r++){let e=t[r].x,o=t[r].y,f=t[r+1].x,g=t[r+1].y;e>s&&(e=s),e<n&&(e=n),o>a&&(o=a),o<i&&(o=i),f>s&&(f=s),f<n&&(f=n),g>a&&(g=a),g<i&&(g=i);const y=(e-c)*(g-d)-(f-c)*(o-d);l+=y*(c+e+f),h+=y*(d+o+g),x+=y}l/=3*x,h/=3*x,isNaN(l)||isNaN(h)||e.push(new r(l,h))}}A._bidiEngine=new e;export{A as default};
5
+ import e from"../../../../../core/BidiEngine.js";import{numericHash as t}from"../../../../../core/string.js";import{BucketType as n}from"../enums.js";import{C_DEG_TO_RAD as i,log2 as s,interpolate as a}from"../GeometryUtils.js";import{TILE_PIXEL_RATIO as o,Anchor as r,TILE_COORD_SIZE as l}from"../Placement.js";import{SDF_GLYPH_SIZE as h,TextShaping as x}from"../TextShaping.js";import c from"./BaseBucket.js";import{TextTransform as d,SymbolPlacement as g,TextWritingMode as f,SymbolAnchor as y,TextJustification as m,RotationAlignment as u}from"../style/StyleDefinition.js";import{IconLayout as p,TextLayout as _}from"../style/StyleLayer.js";import{GeometryType as M,Point as P}from"../../webgl/Geometry.js";const I=10;function b(e,t){return e.iconMosaicItem&&t.iconMosaicItem?e.iconMosaicItem.page===t.iconMosaicItem.page?0:e.iconMosaicItem.page-t.iconMosaicItem.page:e.iconMosaicItem&&!t.iconMosaicItem?1:!e.iconMosaicItem&&t.iconMosaicItem?-1:0}class A extends c{constructor(e,t,i,s,a,o,r,l){super(e,t,l.getSpriteItems()),this.type=n.SYMBOL,this._markerMap=new Map,this._glyphMap=new Map,this._glyphBufferDataStorage=new Map,this._isIconSDF=!1,this._iconVertexBuffer=i,this._iconIndexBuffer=s,this._textVertexBuffer=a,this._textIndexBuffer=o,this._placementEngine=r,this._workerTileHandler=l}get markerPageMap(){return this._markerMap}get glyphsPageMap(){return this._glyphMap}get symbolInstances(){return this._symbolInstances}getResources(e,n,i){const s=this.layer,a=this.zoom;e&&e.setExtent(this.layerExtent);const o=s.getLayoutProperty("icon-image"),r=s.getLayoutProperty("text-field");let l=s.getLayoutProperty("text-transform"),h=s.getLayoutProperty("text-font");const x=[];let c,g,f,y;o&&!o.isDataDriven&&(c=o.getValue(a)),r&&!r.isDataDriven&&(g=r.getValue(a)),l&&l.isDataDriven||(f=s.getLayoutValue("text-transform",a),l=null),h&&h.isDataDriven||(y=s.getLayoutValue("text-font",a),h=null);for(const m of this._features){const u=m.getGeometry(e);if(!u||0===u.length)continue;let p,_;o&&(p=o.isDataDriven?o.getValue(a,m):this._replaceKeys(c,m.values),p&&n(p));let M=!1;if(r&&(_=r.isDataDriven?r.getValue(a,m):this._replaceKeys(g,m.values),_)){switch(_=_.replace(/\\n/g,"\n"),l&&(f=l.getValue(a,m)),f){case d.LOWERCASE:_=_.toLowerCase();break;case d.UPPERCASE:_=_.toUpperCase()}if(A._bidiEngine.hasBidiChar(_)){let e;e="rtl"===A._bidiEngine.checkContextual(_)?"IDNNN":"ICNNN",_=A._bidiEngine.bidiTransform(_,e,"VLYSN"),M=!0}const e=_.length;if(e>0){h&&(y=h.getValue(a,m));for(const t of y){let n=i[t];n||(n=i[t]=new Set);for(let t=0;t<e;t++){const e=_.charCodeAt(t);n.add(e)}}}}if(!p&&!_)continue;const P=s.getLayoutValue("symbol-sort-key",a,m),I={feature:m,sprite:p,label:_,rtl:M,geometry:u,hash:(_?t(_):0)^(p?t(p):0),priority:P,textFont:y};x.push(I)}this._symbolFeatures=x}processFeatures(e){e&&e.setExtent(this.layerExtent);const t=this.layer,n=this.zoom,s=t.getLayoutValue("symbol-placement",n),a=s!==g.POINT,c=t.getLayoutValue("symbol-spacing",n)*o,d=t.getLayoutProperty("icon-image"),P=t.getLayoutProperty("text-field"),I=d?new p(t,n,a):null,L=P?new _(t,n,a):null,V=this._workerTileHandler;let T;d&&(T=V.getSpriteItems()),this._iconIndexStart=3*this._iconIndexBuffer.index,this._textIndexStart=3*this._textIndexBuffer.index,this._iconIndexCount=0,this._textIndexCount=0,this._markerMap.clear(),this._glyphMap.clear();const w=[];let B=1;L&&L.size&&(B=L.size/h);const C=L?L.maxAngle*i:0,R=L?L.size*o:0;for(const i of this._symbolFeatures){let e;I&&T&&i.sprite&&(e=T[i.sprite],e&&e.sdf&&(this._isIconSDF=!0));let t;!!e&&I.update(n,i.feature);let d=0;const p=i.label;if(p){L.update(n,i.feature);const e=a?L.keepUpright:L.writingMode&&L.writingMode.includes(f.VERTICAL);let s=.5;switch(L.anchor){case y.TOP_LEFT:case y.LEFT:case y.BOTTOM_LEFT:s=0;break;case y.TOP_RIGHT:case y.RIGHT:case y.BOTTOM_RIGHT:s=1}let r=.5;switch(L.anchor){case y.TOP_LEFT:case y.TOP:case y.TOP_RIGHT:r=0;break;case y.BOTTOM_LEFT:case y.BOTTOM:case y.BOTTOM_RIGHT:r=1}let l=.5;switch(L.justify){case m.AUTO:l=s;break;case m.LEFT:l=0;break;case m.RIGHT:l=1}const c=L.letterSpacing*h,g=a?0:L.maxWidth*h,u=L.lineHeight*h,_=i.textFont.map((e=>V.getGlyphItems(e)));if(t=new x(_,g,u,c,s,r,l).getShaping(p,i.rtl,e),t&&t.length>0){let e=1e30,n=-1e30;for(const i of t)e=Math.min(e,i.x),n=Math.max(n,i.x);d=(n-e+2*h)*B*o}}for(let n of i.geometry){const h=[];if(s===g.LINE){if(t&&t.length>0&&L&&L.size){const e=L.size*o*(2+Math.min(2,4*Math.abs(L.offset[1])));n=A._smoothVertices(n,e)}A._pushAnchors(h,n,c,d)}else s===g.LINE_CENTER?A._pushCenterAnchor(h,n):i.feature.type===M.Polygon?A._pushCentroid(h,n):h.push(new r(n[0].x,n[0].y));for(const s of h){if(s.x<0||s.x>l||s.y<0||s.y>l)continue;if(a&&d>0&&L.rotationAlignment===u.MAP&&!A._honorsTextMaxAngle(n,s,d,C,R))continue;const o={shaping:t,line:n,iconMosaicItem:e,anchor:s,symbolFeature:i,textColliders:[],iconColliders:[],textVertexRanges:[],iconVertexRanges:[]};w.push(o),this._processFeature(o,I,L)}}}w.sort(b),this._addPlacedGlyphs(),this._symbolInstances=w}serialize(){let e=11;e+=this.layerUIDs.length,e+=3*this.markerPageMap.size,e+=3*this.glyphsPageMap.size,e+=A._symbolsSerializationLength(this._symbolInstances),e+=this._iconVertexBuffer.array.length,e+=this._iconIndexBuffer.array.length,e+=this._textVertexBuffer.array.length,e+=this._textIndexBuffer.array.length;const t=new Uint32Array(e),n=new Int32Array(t.buffer),i=new Float32Array(t.buffer);let s=0;t[s++]=this.type,t[s++]=this.layerUIDs.length;for(let a=0;a<this.layerUIDs.length;a++)t[s++]=this.layerUIDs[a];t[s++]=this._isIconSDF?1:0,t[s++]=this.markerPageMap.size;for(const[a,[o,r]]of this.markerPageMap)t[s++]=a,t[s++]=o,t[s++]=r;t[s++]=this.glyphsPageMap.size;for(const[a,[o,r]]of this.glyphsPageMap)t[s++]=a,t[s++]=o,t[s++]=r;t[s++]=this._iconVertexBuffer.index/4,t[s++]=this._textVertexBuffer.index/4,s=A.serializeSymbols(t,n,i,s,this._symbolInstances),t[s++]=this._iconVertexBuffer.array.length;for(let a=0;a<this._iconVertexBuffer.array.length;a++)n[s++]=this._iconVertexBuffer.array[a];t[s++]=this._iconIndexBuffer.array.length;for(let a=0;a<this._iconIndexBuffer.array.length;a++)t[s++]=this._iconIndexBuffer.array[a];t[s++]=this._textVertexBuffer.array.length;for(let a=0;a<this._textVertexBuffer.array.length;a++)n[s++]=this._textVertexBuffer.array[a];t[s++]=this._textIndexBuffer.array.length;for(let a=0;a<this._textIndexBuffer.array.length;a++)t[s++]=this._textIndexBuffer.array[a];return t.buffer}static _symbolsSerializationLength(e){let t=0;t+=1;for(const n of e||[]){t+=4,t+=1;for(const e of n.textColliders)t+=I;for(const e of n.iconColliders)t+=I;t+=1,t+=2*n.textVertexRanges.length,t+=1,t+=2*n.iconVertexRanges.length}return t}static serializeSymbols(e,t,n,i,s){s=s||[],t[i++]=s.length;for(const a of s){t[i++]=a.anchor.x,t[i++]=a.anchor.y,t[i++]=a.symbolFeature.hash,t[i++]=a.symbolFeature.priority,t[i++]=a.textColliders.length+a.iconColliders.length;for(const e of a.textColliders)t[i++]=e.xTile,t[i++]=e.yTile,t[i++]=e.dxPixels,t[i++]=e.dyPixels,t[i++]=e.hard?1:0,t[i++]=e.partIndex,n[i++]=e.minLod,n[i++]=e.maxLod,t[i++]=e.width,t[i++]=e.height;for(const e of a.iconColliders)t[i++]=e.xTile,t[i++]=e.yTile,t[i++]=e.dxPixels,t[i++]=e.dyPixels,t[i++]=e.hard?1:0,t[i++]=e.partIndex,n[i++]=e.minLod,n[i++]=e.maxLod,t[i++]=e.width,t[i++]=e.height;t[i++]=a.textVertexRanges.length;for(const[e,n]of a.textVertexRanges)t[i++]=e,t[i++]=n;t[i++]=a.iconVertexRanges.length;for(const[e,n]of a.iconVertexRanges)t[i++]=e,t[i++]=n}return i}_replaceKeys(e,t){return e.replace(/{([^{}]+)}/g,(function(e,n){return n in t?t[n]:""}))}_processFeature(e,t,n){const{line:i,iconMosaicItem:a,shaping:o,anchor:r}=e,l=this.zoom,h=this.layer,x=!!a;let c=!0;x&&(c=t.optional||!a);const d=o&&o.length>0;let g,f,y=!0;if(d&&(y=n.optional),x&&(g=this._placementEngine.getIconPlacement(r,a,t)),(g||c)&&(d&&(f=this._placementEngine.getTextPlacement(r,o,i,n)),f||y)){if(g&&f||(y||c?y||f?c||g||(f=null):g=null:(g=null,f=null)),f){const t=h.hasDataDrivenText?h.textMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._storePlacedGlyphs(e,f.shapes,l,n.rotationAlignment,t),f.textColliders){e.textColliders=f.textColliders;for(const e of f.textColliders){e.minLod=Math.max(l+s(e.minLod),0),e.maxLod=Math.min(l+s(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),i=Math.sin(t),s=e.dxPixels*n-e.dyPixels*i,a=e.dxPixels*i+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*i,r=(e.dxPixels+e.width)*i+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*i,h=e.dxPixels*i+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*i,c=(e.dxPixels+e.width)*i+(e.dyPixels+e.height)*n,d=Math.min(s,o,l,x),g=Math.max(s,o,l,x),f=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=f,e.width=g-d,e.height=y-f}}}}if(g){const n=h.hasDataDrivenIcon?h.iconMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._addPlacedIcons(e,g.shapes,l,a.page,t.rotationAlignment===u.VIEWPORT,n),g.iconColliders){e.iconColliders=g.iconColliders;for(const e of g.iconColliders){e.minLod=Math.max(l+s(e.minLod),0),e.maxLod=Math.min(l+s(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),i=Math.sin(t),s=e.dxPixels*n-e.dyPixels*i,a=e.dxPixels*i+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*i,r=(e.dxPixels+e.width)*i+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*i,h=e.dxPixels*i+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*i,c=(e.dxPixels+e.width)*i+(e.dyPixels+e.height)*n,d=Math.min(s,o,l,x),g=Math.max(s,o,l,x),f=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=f,e.width=g-d,e.height=y-f}}}}}}_addPlacedIcons(e,t,n,i,a,o){const r=Math.max(n-1,0),l=this._iconVertexBuffer,h=this._iconIndexBuffer,x=this._markerMap;for(const c of t){const t=a?0:Math.max(n+s(c.minzoom),r),d=a?25:Math.min(n+s(c.maxzoom),25);if(d<=t)continue;const g=c.tl,f=c.tr,y=c.bl,m=c.br,u=c.mosaicRect,p=c.labelAngle,_=c.minAngle,M=c.maxAngle,P=c.anchor,I=l.index,b=u.x,A=u.y,L=b+u.width,V=A+u.height,T=l.index;l.add(P.x,P.y,g.x,g.y,b,A,p,_,M,t,d,o),l.add(P.x,P.y,f.x,f.y,L,A,p,_,M,t,d,o),l.add(P.x,P.y,y.x,y.y,b,V,p,_,M,t,d,o),l.add(P.x,P.y,m.x,m.y,L,V,p,_,M,t,d,o),e.iconVertexRanges.length>0&&e.iconVertexRanges[0][0]+e.iconVertexRanges[0][1]===T?e.iconVertexRanges[0][1]+=4:e.iconVertexRanges.push([T,4]),h.add(I+0,I+1,I+2),h.add(I+1,I+2,I+3),x.has(i)?x.get(i)[1]+=6:x.set(i,[this._iconIndexStart+this._iconIndexCount,6]),this._iconIndexCount+=6}}_addPlacedGlyphs(){const e=this._textVertexBuffer,t=this._textIndexBuffer,n=this._glyphMap;for(const[i,s]of this._glyphBufferDataStorage)for(const a of s){const s=e.index,o=a.symbolInstance,r=a.ddAttributes,l=e.index;e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tl[0],a.tl[1],a.xmin,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tr[0],a.tr[1],a.xmax,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.bl[0],a.bl[1],a.xmin,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.br[0],a.br[1],a.xmax,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),o.textVertexRanges.length>0&&o.textVertexRanges[0][0]+o.textVertexRanges[0][1]===l?o.textVertexRanges[0][1]+=4:o.textVertexRanges.push([l,4]),t.add(s+0,s+1,s+2),t.add(s+1,s+2,s+3),n.has(i)?n.get(i)[1]+=6:n.set(i,[this._textIndexStart+this._textIndexCount,6]),this._textIndexCount+=6}this._glyphBufferDataStorage.clear()}_storePlacedGlyphs(e,t,n,i,a){const o=Math.max(n-1,0),r=i===u.VIEWPORT;let l,h,x,c,d,g,f,y,m,p,_;for(const u of t){if(l=r?0:Math.max(n+s(u.minzoom),o),h=r?25:Math.min(n+s(u.maxzoom),25),h<=l)continue;x=u.tl,c=u.tr,d=u.bl,g=u.br,f=u.labelAngle,y=u.minAngle,m=u.maxAngle,p=u.anchor,_=u.mosaicRect,this._glyphBufferDataStorage.has(u.page)||this._glyphBufferDataStorage.set(u.page,[]);this._glyphBufferDataStorage.get(u.page).push({glyphAnchor:[p.x,p.y],tl:[x.x,x.y],tr:[c.x,c.y],bl:[d.x,d.y],br:[g.x,g.y],xmin:_.x,ymin:_.y,xmax:_.x+_.width,ymax:_.y+_.height,labelAngle:f,minAngle:y,maxAngle:m,minLod:l,maxLod:h,placementLod:o,symbolInstance:e,ddAttributes:a})}}static _pushAnchors(e,t,n,i){n+=i;let s=0;const o=t.length-1;for(let a=0;a<o;a++)s+=P.distance(t[a],t[a+1]);let l=i||n;if(l*=.5,s<=l)return;const h=l/s;let x=0,c=-(n=s/Math.max(Math.round(s/n),1))/2;const d=t.length-1;for(let g=0;g<d;g++){const i=t[g],s=t[g+1],o=s.x-i.x,l=s.y-i.y,d=Math.sqrt(o*o+l*l);let f;for(;c+n<x+d;){c+=n;const t=(c-x)/d,y=a(i.x,s.x,t),m=a(i.y,s.y,t);void 0===f&&(f=Math.atan2(l,o)),e.push(new r(y,m,f,g,h))}x+=d}}static _pushCenterAnchor(e,t){let n=0;const i=t.length-1;for(let a=0;a<i;a++)n+=P.distance(t[a],t[a+1]);const s=n/2;let o=0;const l=t.length-1;for(let h=0;h<l;h++){const n=t[h],i=t[h+1],l=i.x-n.x,x=i.y-n.y,c=Math.sqrt(l*l+x*x);if(s<o+c){const t=(s-o)/c,d=a(n.x,i.x,t),g=a(n.y,i.y,t),f=Math.atan2(x,l);return void e.push(new r(d,g,f,h,0))}o+=c}}static _deviation(e,t,n){const i=(t.x-e.x)*(n.x-t.x)+(t.y-e.y)*(n.y-t.y),s=(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x);return Math.atan2(s,i)}static _honorsTextMaxAngle(e,t,n,i,s){let a=0;const o=n/2;let r=new P(t.x,t.y),l=t.segment+1;for(;a>-o;){if(--l,l<0)return!1;a-=P.distance(e[l],r),r=e[l]}a+=P.distance(e[l],e[l+1]);const h=[];let x=0;const c=e.length;for(;a<o;){const t=e[l];let n,o=l;do{if(++o,o===c)return!1;n=e[o]}while(n.isEqual(t));let r,d=o;do{if(++d,d===c)return!1;r=e[d]}while(r.isEqual(n));const g=this._deviation(t,n,r);for(h.push({deviation:g,distToAnchor:a}),x+=g;a-h[0].distToAnchor>s;)x-=h.shift().deviation;if(Math.abs(x)>i)return!1;a+=P.distance(n,r),l=o}return!0}static _smoothVertices(e,t){if(t<=0)return e;let n=e.length;if(n<3)return e;const i=[];let s=0,a=0;i.push(0);for(let f=1;f<n;f++){const t=P.distance(e[f],e[f-1]);t>0&&(s+=t,i.push(s),a++,a!==f&&(e[a]=e[f]))}if(n=a+1,n<3)return e;t=Math.min(t,.2*s);const o=e[0].x,r=e[0].y,l=e[n-1].x,h=e[n-1].y,x=P.sub(e[0],e[1]);x.normalize(),e[0].x+=t*x.x,e[0].y+=t*x.y,x.assignSub(e[n-1],e[n-2]),x.normalize(),e[n-1].x+=t*x.x,e[n-1].y+=t*x.y,i[0]-=t,i[n-1]+=t;const c=[];c.push(new P(o,r));const d=1e-6,g=.5*t;for(let f=1;f<n-1;f++){let s=0,a=0,o=0;for(let n=f-1;n>=0;n--){const r=g+i[n+1]-i[f];if(r<0)break;const l=i[n+1]-i[n],h=i[f]-i[n]<g?1:r/l;if(h<d)break;const x=h*h,c=h*r-.5*x*l,y=h*l/t,m=e[n+1],u=e[n].x-m.x,p=e[n].y-m.y;s+=y/c*(m.x*h*r+.5*x*(r*u-l*m.x)-x*h*l*u/3),a+=y/c*(m.y*h*r+.5*x*(r*p-l*m.y)-x*h*l*p/3),o+=y}for(let r=f+1;r<n;r++){const n=g-i[r-1]+i[f];if(n<0)break;const l=i[r]-i[r-1],h=i[r]-i[f]<g?1:n/l;if(h<d)break;const x=h*h,c=h*n-.5*x*l,y=h*l/t,m=e[r-1],u=e[r].x-m.x,p=e[r].y-m.y;s+=y/c*(m.x*h*n+.5*x*(n*u-l*m.x)-x*h*l*u/3),a+=y/c*(m.y*h*n+.5*x*(n*p-l*m.y)-x*h*l*p/3),o+=y}c.push(new P(s/o,a/o))}return c.push(new P(l,h)),e[0].x=o,e[0].y=r,e[n-1].x=l,e[n-1].y=h,c}static _pushCentroid(e,t){const n=0,i=0,s=4096,a=4096,o=t.length-1;let l=0,h=0,x=0,c=t[0].x,d=t[0].y;c>s&&(c=s),c<n&&(c=n),d>a&&(d=a),d<i&&(d=i);for(let r=1;r<o;r++){let e=t[r].x,o=t[r].y,g=t[r+1].x,f=t[r+1].y;e>s&&(e=s),e<n&&(e=n),o>a&&(o=a),o<i&&(o=i),g>s&&(g=s),g<n&&(g=n),f>a&&(f=a),f<i&&(f=i);const y=(e-c)*(f-d)-(g-c)*(o-d);l+=y*(c+e+g),h+=y*(d+o+f),x+=y}l/=3*x,h/=3*x,isNaN(l)||isNaN(h)||e.push(new r(l,h))}}A._bidiEngine=new e;export{A 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.24/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../Color.js";import{toLCH as e,toRGB as r,toLAB as s}from"../../../../../core/colorUtils.js";import{unitBezier as n}from"../../../unitBezier.js";import{interpolate as a}from"../GeometryUtils.js";import{ValueType as o,StringType as i,ObjectType as l,NumberType as u,BooleanType as c,ColorType as h,typeToString as p,arrayType as g,getType as f,matchType as w,valueToString as m}from"./types.js";import{GeometryType as y}from"../../webgl/Geometry.js";class v{constructor(t){this.parent=t,this.vars={}}add(t,e){this.vars[t]=e}get(t){return this.vars[t]?this.vars[t]:this.parent?this.parent.get(t):null}}class b{constructor(){this.type=o}static parse(t){if(t.length>1)throw new Error('"id" does not expect arguments');return new b}evaluate(t,e){return null==t?void 0:t.id}}class d{constructor(){this.type=i}static parse(t){if(t.length>1)throw new Error('"geometry-type" does not expect arguments');return new d}evaluate(t,e){if(!t)return null;switch(t.type){case y.Point:return"Point";case y.LineString:return"LineString";case y.Polygon:return"Polygon";default:return null}}}class x{constructor(){this.type=l}static parse(t){if(t.length>1)throw new Error('"properties" does not expect arguments');return new x}evaluate(t,e){return null==t?void 0:t.values}}class E{constructor(){this.type=u}static parse(t){if(t.length>1)throw new Error('"zoom" does not expect arguments');return new E}evaluate(t,e){return e}}class ${constructor(t,e,r){this.lhs=t,this.rhs=e,this.compare=r,this.type=c}static parse(t,e,r){if(3!==t.length&&4!==t.length)throw new Error(`"${t[0]}" expects 2 or 3 arguments`);if(4===t.length)throw new Error(`"${t[0]}" collator not supported`);return new $(pt(t[1],e),pt(t[2],e),r)}evaluate(t,e){return this.compare(this.lhs.evaluate(t,e),this.rhs.evaluate(t,e))}}class M extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t===e))}}class k extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t!==e))}}class A extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t<e))}}class j extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t<=e))}}class q extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t>e))}}class _ extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t>=e))}}class N{constructor(t){this.arg=t,this.type=c}static parse(t,e){if(2!==t.length)throw new Error('"!" expects 1 argument');return new N(pt(t[1],e))}evaluate(t,e){return!this.arg.evaluate(t,e)}}class R{constructor(t){this.args=t,this.type=c}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new R(r)}evaluate(t,e){for(const r of this.args)if(!r.evaluate(t,e))return!1;return!0}}class C{constructor(t){this.args=t,this.type=c}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new C(r)}evaluate(t,e){for(const r of this.args)if(r.evaluate(t,e))return!0;return!1}}class z{constructor(t){this.args=t,this.type=c}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new z(r)}evaluate(t,e){for(const r of this.args)if(r.evaluate(t,e))return!1;return!0}}class I{constructor(t,e,r){this.type=t,this.args=e,this.fallback=r}static parse(t,e,r){if(t.length<4)throw new Error('"case" expects at least 3 arguments');if(t.length%2==1)throw new Error('"case" expects an odd number of arguments');let s;const n=[];for(let o=1;o<t.length-1;o+=2){const a=pt(t[o],e),i=pt(t[o+1],e,r);s||(s=i.type),n.push({condition:a,output:i})}const a=pt(t[t.length-1],e,r);return s||(s=a.type),new I(s,n,a)}evaluate(t,e){for(const r of this.args)if(r.condition.evaluate(t,e))return r.output.evaluate(t,e);return this.fallback.evaluate(t,e)}}class L{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)throw new Error('"coalesce" expects at least 1 argument');let r;const s=[];for(let n=1;n<t.length;n++){const a=pt(t[n],e);r||(r=a.type),s.push(a)}return new L(r,s)}evaluate(t,e){for(const r of this.args){const s=r.evaluate(t,e);if(null!==s)return s}return null}}class U{constructor(t,e,r,s,n){this.type=t,this.input=e,this.labels=r,this.outputs=s,this.fallback=n}static parse(t,e){if(t.length<3)throw new Error('"match" expects at least 3 arguments');if(t.length%2==0)throw new Error('"case" expects an even number of arguments');let r;const s=pt(t[1],e),n=[],a={};let o;for(let i=2;i<t.length-1;i+=2){let s=t[i];Array.isArray(s)||(s=[s]);for(const t of s){const e=typeof t;if("string"!==e&&"number"!==e)throw new Error('"match" requires string or number literal as labels');if(o){if(e!==o)throw new Error('"match" requires labels to have the same type')}else o=e;a[t]=n.length}const l=pt(t[i+1],e);r||(r=l.type),n.push(l)}return new U(r,s,a,n,pt(t[t.length-1],e))}evaluate(t,e){const r=this.input.evaluate(t,e);return(this.outputs[this.labels[r]]||this.fallback).evaluate(t,e)}}class P{constructor(t,e,r,s,n){this.operator=t,this.type=e,this.interpolation=r,this.input=s,this.stops=n}static parse(t,e,r){const s=t[0];if(t.length<5)throw new Error(`"${s}" expects at least 4 arguments`);const n=t[1];if(!Array.isArray(n)||0===n.length)throw new Error(`"${n}" is not a valid interpolation`);switch(n[0]){case"linear":if(1!==n.length)throw new Error("Linear interpolation cannot have parameters");break;case"exponential":if(2!==n.length||"number"!=typeof n[1])throw new Error("Exponential interpolation requires one numeric argument");break;case"cubic-bezier":if(5!==n.length)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1");for(let t=1;t<5;t++){const e=n[t];if("number"!=typeof e||e<0||e>1)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1")}break;default:throw new Error(`"${t[0]}" unknown interpolation type "${n[0]}"`)}if(t.length%2!=1)throw new Error(`"${s}" expects an even number of arguments`);const a=pt(t[2],e,u);let o;"interpolate-hcl"===s||"interpolate-lab"===s?o=h:r&&"value"!==r.kind&&(o=r);const i=[];for(let l=3;l<t.length;l+=2){const r=t[l];if("number"!=typeof r)throw new Error(`"${s}" requires stop inputs as literal numbers`);if(i.length&&i[i.length-1][0]>=r)throw new Error(`"${s}" requires strictly ascending stop inputs`);const n=pt(t[l+1],e,o);o||(o=n.type),i.push([r,n])}if(o&&o!==h&&o!==u&&("array"!==o.kind||o.itemType!==u))throw new Error(`"${s}" cannot interpolate type ${p(o)}`);return new P(s,o,n,a,i)}evaluate(n,o){const i=this.stops;if(1===i.length)return i[0][1].evaluate(n,o);const l=this.input.evaluate(n,o);if(l<=i[0][0])return i[0][1].evaluate(n,o);if(l>=i[i.length-1][0])return i[i.length-1][1].evaluate(n,o);let u=0;for(;++u<i.length&&!(l<i[u][0]););const c=i[u-1][0],h=i[u][0],g=P.interpolationRatio(this.interpolation,l,c,h),f=i[u-1][1].evaluate(n,o),w=i[u][1].evaluate(n,o);if("interpolate"===this.operator){if("array"===this.type.kind&&Array.isArray(f)&&Array.isArray(w))return f.map(((t,e)=>a(t,w[e],g)));if("color"===this.type.kind&&f instanceof t&&w instanceof t){const e=new t(f),r=new t(w);return new t([a(e.r,r.r,g),a(e.g,r.g,g),a(e.b,r.b,g),a(e.a,r.a,g)])}if("number"===this.type.kind&&"number"==typeof f&&"number"==typeof w)return a(f,w,g);throw new Error(`"${this.operator}" cannot interpolate type ${p(this.type)}`)}if("interpolate-hcl"===this.operator){const s=e(f),n=e(w),o=n.h-s.h,i=r({h:s.h+g*(o>180||o<-180?o-360*Math.round(o/360):o),c:a(s.c,n.c,g),l:a(s.l,n.l,g)});return new t({a:a(f.a,w.a,g),...i})}if("interpolate-lab"===this.operator){const e=s(f),n=s(w),o=r({l:a(e.l,n.l,g),a:a(e.a,n.a,g),b:a(e.b,n.b,g)});return new t({a:a(f.a,w.a,g),...o})}throw new Error(`Unexpected operator "${this.operator}"`)}interpolationUniformValue(t,e){const r=this.stops;if(1===r.length)return 0;if(t>=r[r.length-1][0])return 0;let s=0;for(;++s<r.length&&!(t<r[s][0]););const n=r[s-1][0],a=r[s][0];return P.interpolationRatio(this.interpolation,e,n,a)}getInterpolationRange(t){const e=this.stops;if(1===e.length){const t=e[0][0];return[t,t]}const r=e[e.length-1][0];if(t>=r)return[r,r];let s=0;for(;++s<e.length&&!(t<e[s][0]););return[e[s-1][0],e[s][0]]}static interpolationRatio(t,e,r,s){let a=0;if("linear"===t[0])a=P._exponentialInterpolationRatio(e,1,r,s);else if("exponential"===t[0])a=P._exponentialInterpolationRatio(e,t[1],r,s);else if("cubic-bezier"===t[0]){a=n(t[1],t[2],t[3],t[4])(P._exponentialInterpolationRatio(e,1,r,s),1e-5)}return a<0?a=0:a>1&&(a=1),a}static _exponentialInterpolationRatio(t,e,r,s){const n=s-r;if(0===n)return 0;const a=t-r;return 1===e?a/n:(e**a-1)/(e**n-1)}}class S{constructor(t,e,r){this.type=t,this.input=e,this.stops=r}static parse(t,e){if(t.length<5)throw new Error('"step" expects at least 4 arguments');if(t.length%2!=1)throw new Error('"step" expects an even number of arguments');const r=pt(t[1],e,u);let s;const n=[];n.push([-1/0,pt(t[2],e)]);for(let a=3;a<t.length;a+=2){const r=t[a];if("number"!=typeof r)throw new Error('"step" requires stop inputs as literal numbers');if(n.length&&n[n.length-1][0]>=r)throw new Error('"step" requires strictly ascending stop inputs');const o=pt(t[a+1],e);s||(s=o.type),n.push([r,o])}return new S(s,r,n)}evaluate(t,e){const r=this.stops;if(1===r.length)return r[0][1].evaluate(t,e);const s=this.input.evaluate(t,e);let n=0;for(;++n<r.length&&!(s<r[n][0]););return this.stops[n-1][1].evaluate(t,e)}}class B{constructor(t,e){this.type=t,this.output=e}static parse(t,e,r){if(t.length<4)throw new Error('"let" expects at least 3 arguments');if(t.length%2==1)throw new Error('"let" expects an odd number of arguments');const s=new v(e);for(let a=1;a<t.length-1;a+=2){const r=t[a];if("string"!=typeof r)throw new Error(`"let" requires a string to define variable names - found ${r}`);s.add(r,pt(t[a+1],e))}const n=pt(t[t.length-1],s,r);return new B(n.type,n)}evaluate(t,e){return this.output.evaluate(t,e)}}class O{constructor(t,e){this.type=t,this.output=e}static parse(t,e,r){if(2!==t.length||"string"!=typeof t[1])throw new Error('"var" requires just one literal string argument');const s=e.get(t[1]);if(!s)throw new Error(`${t[1]} must be defined before being used in a "var" expression`);return new O(r||o,s)}evaluate(t,e){return this.output.evaluate(t,e)}}class G{constructor(t,e,r){this.type=t,this.index=e,this.array=r}static parse(t,e){if(3!==t.length)throw new Error('"at" expects 2 arguments');const r=pt(t[1],e,u),s=pt(t[2],e);return new G(s.type.itemType,r,s)}evaluate(t,e){const r=this.index.evaluate(t,e),s=this.array.evaluate(t,e);if(r<0||r>=s.length)throw new Error('"at" index out of bounds');if(r!==Math.floor(r))throw new Error('"at" index must be an integer');return s[r]}}class T{constructor(t,e){this.key=t,this.obj=e,this.type=o}static parse(t,e){let r,s;switch(t.length){case 2:return r=pt(t[1],e),new T(r);case 3:return r=pt(t[1],e),s=pt(t[2],e),new T(r,s);default:throw new Error('"get" expects 1 or 2 arguments')}}evaluate(t,e){const r=this.key.evaluate(t,e);if(this.obj){return this.obj.evaluate(t,e)[r]}return null==t?void 0:t.values[r]}}class F{constructor(t,e){this.key=t,this.obj=e,this.type=c}static parse(t,e){let r,s;switch(t.length){case 2:return r=pt(t[1],e),new F(r);case 3:return r=pt(t[1],e),s=pt(t[2],e),new F(r,s);default:throw new Error('"has" expects 1 or 2 arguments')}}evaluate(t,e){const r=this.key.evaluate(t,e);if(this.obj){return r in this.obj.evaluate(t,e)}return!(null==t||!t.values[r])}}class V{constructor(t,e){this.key=t,this.vals=e,this.type=c}static parse(t,e){if(3!==t.length)throw new Error('"in" expects 2 arguments');return new V(pt(t[1],e),pt(t[2],e))}evaluate(t,e){const r=this.key.evaluate(t,e);return-1!==this.vals.evaluate(t,e).indexOf(r)}}class D{constructor(t,e,r){this.item=t,this.array=e,this.from=r,this.type=u}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"index-of" expects 3 or 4 arguments');const r=pt(t[1],e),s=pt(t[2],e);if(4===t.length){const n=pt(t[3],e,u);return new D(r,s,n)}return new D(r,s)}evaluate(t,e){const r=this.item.evaluate(t,e),s=this.array.evaluate(t,e);if(this.from){const n=this.from.evaluate(t,e);if(n!==Math.floor(n))throw new Error('"index-of" index must be an integer');return s.indexOf(r,n)}return s.indexOf(r)}}class H{constructor(t){this.arg=t,this.type=u}static parse(t,e){if(2!==t.length)throw new Error('"length" expects 2 arguments');const r=pt(t[1],e);return new H(r)}evaluate(t,e){const r=this.arg.evaluate(t,e);if("string"==typeof r)return r.length;if(Array.isArray(r))return r.length;throw new Error('"length" expects string or array')}}class J{constructor(t,e,r,s){this.type=t,this.array=e,this.from=r,this.to=s}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"slice" expects 2 or 3 arguments');const r=pt(t[1],e),s=pt(t[2],e,u);if(s.type!==u)throw new Error('"slice" index must return a number');if(4===t.length){const n=pt(t[3],e,u);if(n.type!==u)throw new Error('"slice" index must return a number');return new J(r.type,r,s,n)}return new J(r.type,r,s)}evaluate(t,e){const r=this.array.evaluate(t,e);if(!Array.isArray(r)&&"string"!=typeof r)throw new Error('"slice" input must be an array or a string');const s=this.from.evaluate(t,e);if(s<0||s>=r.length)throw new Error('"slice" index out of bounds');if(s!==Math.floor(s))throw new Error('"slice" index must be an integer');if(this.to){const n=this.to.evaluate(t,e);if(n<0||n>=r.length)throw new Error('"slice" index out of bounds');if(n!==Math.floor(n))throw new Error('"slice" index must be an integer');return r.slice(s,n)}return r.slice(s)}}class K{constructor(){this.type=c}static parse(t){if(1!==t.length)throw new Error('"has-id" expects no arguments');return new K}evaluate(t,e){return t&&void 0!==t.id}}class Q{constructor(t,e){this.args=t,this.calculate=e,this.type=u}static parse(t,e,r){const s=t.slice(1).map((t=>pt(t,e)));return new Q(s,r)}evaluate(t,e){let r;return this.args&&(r=this.args.map((r=>r.evaluate(t,e)))),this.calculate(r)}}class W extends Q{static parse(t,e){switch(t.length){case 2:return Q.parse(t,e,(t=>-t[0]));case 3:return Q.parse(t,e,(t=>t[0]-t[1]));default:throw new Error('"-" expects 1 or 2 arguments')}}}class X extends Q{static parse(t,e){return Q.parse(t,e,(t=>{let e=1;for(const r of t)e*=r;return e}))}}class Y extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]/t[1]));throw new Error('"/" expects 2 arguments')}}class Z extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]%t[1]));throw new Error('"%" expects 2 arguments')}}class tt extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]**t[1]));throw new Error('"^" expects 1 or 2 arguments')}}class et extends Q{static parse(t,e){return Q.parse(t,e,(t=>{let e=0;for(const r of t)e+=r;return e}))}}class rt{constructor(t,e){this.args=t,this.calculate=e,this.type=u}static parse(t,e){const r=t.slice(1).map((t=>pt(t,e)));return new rt(r,rt.ops[t[0]])}evaluate(t,e){let r;return this.args&&(r=this.args.map((r=>r.evaluate(t,e)))),this.calculate(r)}}rt.ops={abs:t=>Math.abs(t[0]),acos:t=>Math.acos(t[0]),asin:t=>Math.asin(t[0]),atan:t=>Math.atan(t[0]),ceil:t=>Math.ceil(t[0]),cos:t=>Math.cos(t[0]),e:()=>Math.E,floor:t=>Math.floor(t[0]),ln:t=>Math.log(t[0]),ln2:()=>Math.LN2,log10:t=>Math.log(t[0])/Math.LN10,log2:t=>Math.log(t[0])/Math.LN2,max:t=>Math.max(...t),min:t=>Math.min(...t),pi:()=>Math.PI,round:t=>Math.round(t[0]),sin:t=>Math.sin(t[0]),sqrt:t=>Math.sqrt(t[0]),tan:t=>Math.tan(t[0])};class st{constructor(t){this.args=t,this.type=i}static parse(t,e){return new st(t.slice(1).map((t=>pt(t,e))))}evaluate(t,e){return this.args.map((r=>r.evaluate(t,e))).join("")}}class nt{constructor(t,e){this.arg=t,this.calculate=e,this.type=i}static parse(t,e){if(2!==t.length)throw new Error(`${t[0]} expects 1 argument`);const r=pt(t[1],e);return new nt(r,nt.ops[t[0]])}evaluate(t,e){return this.calculate(this.arg.evaluate(t,e))}}nt.ops={downcase:t=>t.toLowerCase(),upcase:t=>t.toUpperCase()};class at{constructor(t){this.args=t,this.type=h}static parse(t,e){if(4!==t.length)throw new Error('"rgb" expects 3 arguments');const r=t.slice(1).map((t=>pt(t,e)));return new at(r)}evaluate(e,r){const s=this._validate(this.args[0].evaluate(e,r)),n=this._validate(this.args[1].evaluate(e,r)),a=this._validate(this.args[2].evaluate(e,r));return new t({r:s,g:n,b:a})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}}class ot{constructor(t){this.args=t,this.type=h}static parse(t,e){if(5!==t.length)throw new Error('"rgba" expects 4 arguments');const r=t.slice(1).map((t=>pt(t,e)));return new ot(r)}evaluate(e,r){const s=this._validate(this.args[0].evaluate(e,r)),n=this._validate(this.args[1].evaluate(e,r)),a=this._validate(this.args[2].evaluate(e,r)),o=this._validateAlpha(this.args[3].evaluate(e,r));return new t({r:s,g:n,b:a,a:o})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}_validateAlpha(t){if("number"!=typeof t||t<0||t>1)throw new Error(`${t}: invalid alpha color component`);return t}}class it{constructor(t){this.color=t,this.type=g(u,4)}static parse(t,e){if(2!==t.length)throw new Error('"to-rgba" expects 1 argument');const r=pt(t[1],e);return new it(r)}evaluate(e,r){return new t(this.color.evaluate(e,r)).toRgba()}}class lt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){const r=t[0];if(t.length<2)throw new Error(`${r} expects at least one argument`);let s,n=1;if("array"===r){if(t.length>2){switch(t[1]){case"string":s=i;break;case"number":s=u;break;case"boolean":s=c;break;default:throw new Error('"array" type argument must be string, number or boolean')}n++}else s=o;let e;if(t.length>3){if(e=t[2],null!==e&&("number"!=typeof e||e<0||e!==Math.floor(e)))throw new Error('"array" length argument must be a positive integer literal');n++}s=g(s,e)}else switch(r){case"string":s=i;break;case"number":s=u;break;case"boolean":s=c;break;case"object":s=l}const a=[];for(;n<t.length;n++){const r=pt(t[n],e);a.push(r)}return new lt(s,a)}evaluate(t,e){let r;for(const s of this.args){const n=s.evaluate(t,e);if(r=f(n),w(r,this.type))return n}throw new Error(`Expected ${p(this.type)} but got ${p(r)}`)}}class ut{constructor(t,e){this.type=t,this.args=e}static parse(t,e){const r=t[0],s=ut.types[r];if(s===c||s===i){if(2!==t.length)throw new Error(`${r} expects one argument`)}else if(t.length<2)throw new Error(`${r} expects at least one argument`);const n=[];for(let a=1;a<t.length;a++){const r=pt(t[a],e);n.push(r)}return new ut(s,n)}evaluate(e,r){if(this.type===c)return Boolean(this.args[0].evaluate(e,r));if(this.type===i)return m(this.args[0].evaluate(e,r));if(this.type===u){for(const t of this.args){const s=Number(t.evaluate(e,r));if(!isNaN(s))return s}return null}if(this.type===h){for(const s of this.args)try{const n=ut.toColor(s.evaluate(e,r));if(n instanceof t)return n}catch{}return null}}static toBoolean(t){return Boolean(t)}static toString(t){return m(t)}static toNumber(t){const e=Number(t);if(isNaN(e))throw new Error(`"${t}" is not a number`);return e}static toColor(e){if(e instanceof t)return e;if("string"==typeof e){const r=t.fromString(e);if(r)return r;throw new Error(`"${e}" is not a color`)}if(Array.isArray(e))return t.fromArray(e);throw new Error(`"${e}" is not a color`)}}ut.types={"to-boolean":c,"to-color":h,"to-number":u,"to-string":i};class ct{constructor(t){this.val=t,this.type=f(t)}static parse(t){if(2!==t.length)throw new Error('"literal" expects 1 argument');return new ct(t[1])}evaluate(t,e){return this.val}}class ht{constructor(t){this.arg=t,this.type=i}static parse(t,e){if(2!==t.length)throw new Error('"typeof" expects 1 argument');return new ht(pt(t[1],e))}evaluate(t,e){return p(f(this.arg.evaluate(t,e)))}}function pt(t,e,r){const s=typeof t;if("string"===s||"boolean"===s||"number"===s||null===t){if(r)switch(r.kind){case"string":"string"!==s&&(t=ut.toString(t));break;case"number":"number"!==s&&(t=ut.toNumber(t));break;case"color":t=ut.toColor(t)}t=["literal",t]}if(!Array.isArray(t)||0===t.length)throw new Error("Expression must be a non empty array");const n=t[0];if("string"!=typeof n)throw new Error("First element of expression must be a string");const a=gt[n];if(void 0===a)throw new Error(`Invalid expression operator "${n}"`);if(!a)throw new Error(`Unimplemented expression operator "${n}"`);return a.parse(t,e,r)}const gt={array:lt,boolean:lt,collator:null,format:null,image:null,literal:ct,number:lt,"number-format":null,object:lt,string:lt,"to-boolean":ut,"to-color":ut,"to-number":ut,"to-string":ut,typeof:ht,accumulated:null,"feature-state":null,"geometry-type":d,id:b,"line-progress":null,properties:x,at:G,get:T,has:F,in:V,"index-of":D,length:H,slice:J,"!":N,"!=":k,"<":A,"<=":j,"==":M,">":q,">=":_,all:R,any:C,case:I,coalesce:L,match:U,within:null,interpolate:P,"interpolate-hcl":P,"interpolate-lab":P,step:S,let:B,var:O,concat:st,downcase:nt,"is-supported-script":null,"resolved-locale":null,upcase:nt,rgb:at,rgba:ot,"to-rgba":it,"-":W,"*":X,"/":Y,"%":Z,"^":tt,"+":et,abs:rt,acos:rt,asin:rt,atan:rt,ceil:rt,cos:rt,e:rt,floor:rt,ln:rt,ln2:rt,log10:rt,log2:rt,max:rt,min:rt,pi:rt,round:rt,sin:rt,sqrt:rt,tan:rt,zoom:E,"heatmap-density":null,"has-id":K,none:z};export{R as ALL,C as ANY,et as Add,lt as Assert,G as At,rt as Calculate,I as Case,L as Coalesce,ut as Coerce,st as Concat,Y as Div,M as EQ,_ as GE,q as GT,d as GeomType,T as Get,F as Has,K as HasID,b as ID,V as In,D as IndexOf,P as Interpolate,j as LE,A as LT,H as Length,B as Let,ct as Literal,U as Match,Z as Mod,X as Mul,k as NE,z as NONE,N as NOT,tt as Pow,x as Properties,at as Rgb,ot as Rgba,J as Slice,S as Step,nt as String,W as Sub,it as ToRgba,ht as TypeOf,O as Var,E as Zoom,pt as createExpression,gt as ops};
5
+ import t from"../../../../../Color.js";import{toLCH as e,toRGB as r,toLAB as s}from"../../../../../core/colorUtils.js";import{unitBezier as n}from"../../../unitBezier.js";import{interpolate as a}from"../GeometryUtils.js";import{ValueType as o,StringType as i,ObjectType as l,NumberType as u,BooleanType as c,ColorType as h,typeToString as p,arrayType as g,getType as f,matchType as w,valueToString as m}from"./types.js";import{GeometryType as y}from"../../webgl/Geometry.js";class v{constructor(t){this.parent=t,this.vars={}}add(t,e){this.vars[t]=e}get(t){return this.vars[t]?this.vars[t]:this.parent?this.parent.get(t):null}}class b{constructor(){this.type=o}static parse(t){if(t.length>1)throw new Error('"id" does not expect arguments');return new b}evaluate(t,e){return null==t?void 0:t.id}}class d{constructor(){this.type=i}static parse(t){if(t.length>1)throw new Error('"geometry-type" does not expect arguments');return new d}evaluate(t,e){if(!t)return null;switch(t.type){case y.Point:return"Point";case y.LineString:return"LineString";case y.Polygon:return"Polygon";default:return null}}}class x{constructor(){this.type=l}static parse(t){if(t.length>1)throw new Error('"properties" does not expect arguments');return new x}evaluate(t,e){return null==t?void 0:t.values}}class E{constructor(){this.type=u}static parse(t){if(t.length>1)throw new Error('"zoom" does not expect arguments');return new E}evaluate(t,e){return e}}class ${constructor(t,e,r){this.lhs=t,this.rhs=e,this.compare=r,this.type=c}static parse(t,e,r){if(3!==t.length&&4!==t.length)throw new Error(`"${t[0]}" expects 2 or 3 arguments`);if(4===t.length)throw new Error(`"${t[0]}" collator not supported`);return new $(pt(t[1],e),pt(t[2],e),r)}evaluate(t,e){return this.compare(this.lhs.evaluate(t,e),this.rhs.evaluate(t,e))}}class M extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t===e))}}class k extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t!==e))}}class A extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t<e))}}class j extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t<=e))}}class q extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t>e))}}class _ extends ${static parse(t,e){return $.parse(t,e,((t,e)=>t>=e))}}class N{constructor(t){this.arg=t,this.type=c}static parse(t,e){if(2!==t.length)throw new Error('"!" expects 1 argument');return new N(pt(t[1],e))}evaluate(t,e){return!this.arg.evaluate(t,e)}}class R{constructor(t){this.args=t,this.type=c}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new R(r)}evaluate(t,e){for(const r of this.args)if(!r.evaluate(t,e))return!1;return!0}}class C{constructor(t){this.args=t,this.type=c}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new C(r)}evaluate(t,e){for(const r of this.args)if(r.evaluate(t,e))return!0;return!1}}class z{constructor(t){this.args=t,this.type=c}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new z(r)}evaluate(t,e){for(const r of this.args)if(r.evaluate(t,e))return!1;return!0}}class I{constructor(t,e,r){this.type=t,this.args=e,this.fallback=r}static parse(t,e,r){if(t.length<4)throw new Error('"case" expects at least 3 arguments');if(t.length%2==1)throw new Error('"case" expects an odd number of arguments');let s;const n=[];for(let o=1;o<t.length-1;o+=2){const a=pt(t[o],e),i=pt(t[o+1],e,r);s||(s=i.type),n.push({condition:a,output:i})}const a=pt(t[t.length-1],e,r);return s||(s=a.type),new I(s,n,a)}evaluate(t,e){for(const r of this.args)if(r.condition.evaluate(t,e))return r.output.evaluate(t,e);return this.fallback.evaluate(t,e)}}class L{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)throw new Error('"coalesce" expects at least 1 argument');let r;const s=[];for(let n=1;n<t.length;n++){const a=pt(t[n],e);r||(r=a.type),s.push(a)}return new L(r,s)}evaluate(t,e){for(const r of this.args){const s=r.evaluate(t,e);if(null!==s)return s}return null}}class U{constructor(t,e,r,s,n){this.type=t,this.input=e,this.labels=r,this.outputs=s,this.fallback=n}static parse(t,e){if(t.length<3)throw new Error('"match" expects at least 3 arguments');if(t.length%2==0)throw new Error('"case" expects an even number of arguments');let r;const s=pt(t[1],e),n=[],a={};let o;for(let i=2;i<t.length-1;i+=2){let s=t[i];Array.isArray(s)||(s=[s]);for(const t of s){const e=typeof t;if("string"!==e&&"number"!==e)throw new Error('"match" requires string or number literal as labels');if(o){if(e!==o)throw new Error('"match" requires labels to have the same type')}else o=e;a[t]=n.length}const l=pt(t[i+1],e);r||(r=l.type),n.push(l)}return new U(r,s,a,n,pt(t[t.length-1],e))}evaluate(t,e){const r=this.input.evaluate(t,e);return(this.outputs[this.labels[r]]||this.fallback).evaluate(t,e)}}class P{constructor(t,e,r,s,n){this.operator=t,this.type=e,this.interpolation=r,this.input=s,this.stops=n}static parse(t,e,r){const s=t[0];if(t.length<5)throw new Error(`"${s}" expects at least 4 arguments`);const n=t[1];if(!Array.isArray(n)||0===n.length)throw new Error(`"${n}" is not a valid interpolation`);switch(n[0]){case"linear":if(1!==n.length)throw new Error("Linear interpolation cannot have parameters");break;case"exponential":if(2!==n.length||"number"!=typeof n[1])throw new Error("Exponential interpolation requires one numeric argument");break;case"cubic-bezier":if(5!==n.length)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1");for(let t=1;t<5;t++){const e=n[t];if("number"!=typeof e||e<0||e>1)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1")}break;default:throw new Error(`"${t[0]}" unknown interpolation type "${n[0]}"`)}if(t.length%2!=1)throw new Error(`"${s}" expects an even number of arguments`);const a=pt(t[2],e,u);let o;"interpolate-hcl"===s||"interpolate-lab"===s?o=h:r&&"value"!==r.kind&&(o=r);const i=[];for(let l=3;l<t.length;l+=2){const r=t[l];if("number"!=typeof r)throw new Error(`"${s}" requires stop inputs as literal numbers`);if(i.length&&i[i.length-1][0]>=r)throw new Error(`"${s}" requires strictly ascending stop inputs`);const n=pt(t[l+1],e,o);o||(o=n.type),i.push([r,n])}if(o&&o!==h&&o!==u&&("array"!==o.kind||o.itemType!==u))throw new Error(`"${s}" cannot interpolate type ${p(o)}`);return new P(s,o,n,a,i)}evaluate(n,o){const i=this.stops;if(1===i.length)return i[0][1].evaluate(n,o);const l=this.input.evaluate(n,o);if(l<=i[0][0])return i[0][1].evaluate(n,o);if(l>=i[i.length-1][0])return i[i.length-1][1].evaluate(n,o);let u=0;for(;++u<i.length&&!(l<i[u][0]););const c=i[u-1][0],h=i[u][0],g=P.interpolationRatio(this.interpolation,l,c,h),f=i[u-1][1].evaluate(n,o),w=i[u][1].evaluate(n,o);if("interpolate"===this.operator){if("array"===this.type.kind&&Array.isArray(f)&&Array.isArray(w))return f.map(((t,e)=>a(t,w[e],g)));if("color"===this.type.kind&&f instanceof t&&w instanceof t){const e=new t(f),r=new t(w);return new t([a(e.r,r.r,g),a(e.g,r.g,g),a(e.b,r.b,g),a(e.a,r.a,g)])}if("number"===this.type.kind&&"number"==typeof f&&"number"==typeof w)return a(f,w,g);throw new Error(`"${this.operator}" cannot interpolate type ${p(this.type)}`)}if("interpolate-hcl"===this.operator){const s=e(f),n=e(w),o=n.h-s.h,i=r({h:s.h+g*(o>180||o<-180?o-360*Math.round(o/360):o),c:a(s.c,n.c,g),l:a(s.l,n.l,g)});return new t({a:a(f.a,w.a,g),...i})}if("interpolate-lab"===this.operator){const e=s(f),n=s(w),o=r({l:a(e.l,n.l,g),a:a(e.a,n.a,g),b:a(e.b,n.b,g)});return new t({a:a(f.a,w.a,g),...o})}throw new Error(`Unexpected operator "${this.operator}"`)}interpolationUniformValue(t,e){const r=this.stops;if(1===r.length)return 0;if(t>=r[r.length-1][0])return 0;let s=0;for(;++s<r.length&&!(t<r[s][0]););const n=r[s-1][0],a=r[s][0];return P.interpolationRatio(this.interpolation,e,n,a)}getInterpolationRange(t){const e=this.stops;if(1===e.length){const t=e[0][0];return[t,t]}const r=e[e.length-1][0];if(t>=r)return[r,r];let s=0;for(;++s<e.length&&!(t<e[s][0]););return[e[s-1][0],e[s][0]]}static interpolationRatio(t,e,r,s){let a=0;if("linear"===t[0])a=P._exponentialInterpolationRatio(e,1,r,s);else if("exponential"===t[0])a=P._exponentialInterpolationRatio(e,t[1],r,s);else if("cubic-bezier"===t[0]){a=n(t[1],t[2],t[3],t[4])(P._exponentialInterpolationRatio(e,1,r,s),1e-5)}return a<0?a=0:a>1&&(a=1),a}static _exponentialInterpolationRatio(t,e,r,s){const n=s-r;if(0===n)return 0;const a=t-r;return 1===e?a/n:(e**a-1)/(e**n-1)}}class S{constructor(t,e,r){this.type=t,this.input=e,this.stops=r}static parse(t,e){if(t.length<5)throw new Error('"step" expects at least 4 arguments');if(t.length%2!=1)throw new Error('"step" expects an even number of arguments');const r=pt(t[1],e,u);let s;const n=[];n.push([-1/0,pt(t[2],e)]);for(let a=3;a<t.length;a+=2){const r=t[a];if("number"!=typeof r)throw new Error('"step" requires stop inputs as literal numbers');if(n.length&&n[n.length-1][0]>=r)throw new Error('"step" requires strictly ascending stop inputs');const o=pt(t[a+1],e);s||(s=o.type),n.push([r,o])}return new S(s,r,n)}evaluate(t,e){const r=this.stops;if(1===r.length)return r[0][1].evaluate(t,e);const s=this.input.evaluate(t,e);let n=0;for(;++n<r.length&&!(s<r[n][0]););return this.stops[n-1][1].evaluate(t,e)}}class B{constructor(t,e){this.type=t,this.output=e}static parse(t,e,r){if(t.length<4)throw new Error('"let" expects at least 3 arguments');if(t.length%2==1)throw new Error('"let" expects an odd number of arguments');const s=new v(e);for(let a=1;a<t.length-1;a+=2){const r=t[a];if("string"!=typeof r)throw new Error(`"let" requires a string to define variable names - found ${r}`);s.add(r,pt(t[a+1],e))}const n=pt(t[t.length-1],s,r);return new B(n.type,n)}evaluate(t,e){return this.output.evaluate(t,e)}}class G{constructor(t,e){this.type=t,this.output=e}static parse(t,e,r){if(2!==t.length||"string"!=typeof t[1])throw new Error('"var" requires just one literal string argument');const s=e.get(t[1]);if(!s)throw new Error(`${t[1]} must be defined before being used in a "var" expression`);return new G(r||o,s)}evaluate(t,e){return this.output.evaluate(t,e)}}class O{constructor(t,e,r){this.type=t,this.index=e,this.array=r}static parse(t,e){if(3!==t.length)throw new Error('"at" expects 2 arguments');const r=pt(t[1],e,u),s=pt(t[2],e);return new O(s.type.itemType,r,s)}evaluate(t,e){const r=this.index.evaluate(t,e),s=this.array.evaluate(t,e);if(r<0||r>=s.length)throw new Error('"at" index out of bounds');if(r!==Math.floor(r))throw new Error('"at" index must be an integer');return s[r]}}class T{constructor(t,e){this.key=t,this.obj=e,this.type=o}static parse(t,e){let r,s;switch(t.length){case 2:return r=pt(t[1],e),new T(r);case 3:return r=pt(t[1],e),s=pt(t[2],e),new T(r,s);default:throw new Error('"get" expects 1 or 2 arguments')}}evaluate(t,e){const r=this.key.evaluate(t,e);if(this.obj){return this.obj.evaluate(t,e)[r]}return null==t?void 0:t.values[r]}}class F{constructor(t,e){this.key=t,this.obj=e,this.type=c}static parse(t,e){let r,s;switch(t.length){case 2:return r=pt(t[1],e),new F(r);case 3:return r=pt(t[1],e),s=pt(t[2],e),new F(r,s);default:throw new Error('"has" expects 1 or 2 arguments')}}evaluate(t,e){const r=this.key.evaluate(t,e);if(this.obj){return r in this.obj.evaluate(t,e)}return!(null==t||!t.values[r])}}class V{constructor(t,e){this.key=t,this.vals=e,this.type=c}static parse(t,e){if(3!==t.length)throw new Error('"in" expects 2 arguments');return new V(pt(t[1],e),pt(t[2],e))}evaluate(t,e){const r=this.key.evaluate(t,e);return this.vals.evaluate(t,e).includes(r)}}class D{constructor(t,e,r){this.item=t,this.array=e,this.from=r,this.type=u}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"index-of" expects 3 or 4 arguments');const r=pt(t[1],e),s=pt(t[2],e);if(4===t.length){const n=pt(t[3],e,u);return new D(r,s,n)}return new D(r,s)}evaluate(t,e){const r=this.item.evaluate(t,e),s=this.array.evaluate(t,e);if(this.from){const n=this.from.evaluate(t,e);if(n!==Math.floor(n))throw new Error('"index-of" index must be an integer');return s.indexOf(r,n)}return s.indexOf(r)}}class H{constructor(t){this.arg=t,this.type=u}static parse(t,e){if(2!==t.length)throw new Error('"length" expects 2 arguments');const r=pt(t[1],e);return new H(r)}evaluate(t,e){const r=this.arg.evaluate(t,e);if("string"==typeof r)return r.length;if(Array.isArray(r))return r.length;throw new Error('"length" expects string or array')}}class J{constructor(t,e,r,s){this.type=t,this.array=e,this.from=r,this.to=s}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"slice" expects 2 or 3 arguments');const r=pt(t[1],e),s=pt(t[2],e,u);if(s.type!==u)throw new Error('"slice" index must return a number');if(4===t.length){const n=pt(t[3],e,u);if(n.type!==u)throw new Error('"slice" index must return a number');return new J(r.type,r,s,n)}return new J(r.type,r,s)}evaluate(t,e){const r=this.array.evaluate(t,e);if(!Array.isArray(r)&&"string"!=typeof r)throw new Error('"slice" input must be an array or a string');const s=this.from.evaluate(t,e);if(s<0||s>=r.length)throw new Error('"slice" index out of bounds');if(s!==Math.floor(s))throw new Error('"slice" index must be an integer');if(this.to){const n=this.to.evaluate(t,e);if(n<0||n>=r.length)throw new Error('"slice" index out of bounds');if(n!==Math.floor(n))throw new Error('"slice" index must be an integer');return r.slice(s,n)}return r.slice(s)}}class K{constructor(){this.type=c}static parse(t){if(1!==t.length)throw new Error('"has-id" expects no arguments');return new K}evaluate(t,e){return t&&void 0!==t.id}}class Q{constructor(t,e){this.args=t,this.calculate=e,this.type=u}static parse(t,e,r){const s=t.slice(1).map((t=>pt(t,e)));return new Q(s,r)}evaluate(t,e){let r;return this.args&&(r=this.args.map((r=>r.evaluate(t,e)))),this.calculate(r)}}class W extends Q{static parse(t,e){switch(t.length){case 2:return Q.parse(t,e,(t=>-t[0]));case 3:return Q.parse(t,e,(t=>t[0]-t[1]));default:throw new Error('"-" expects 1 or 2 arguments')}}}class X extends Q{static parse(t,e){return Q.parse(t,e,(t=>{let e=1;for(const r of t)e*=r;return e}))}}class Y extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]/t[1]));throw new Error('"/" expects 2 arguments')}}class Z extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]%t[1]));throw new Error('"%" expects 2 arguments')}}class tt extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]**t[1]));throw new Error('"^" expects 1 or 2 arguments')}}class et extends Q{static parse(t,e){return Q.parse(t,e,(t=>{let e=0;for(const r of t)e+=r;return e}))}}class rt{constructor(t,e){this.args=t,this.calculate=e,this.type=u}static parse(t,e){const r=t.slice(1).map((t=>pt(t,e)));return new rt(r,rt.ops[t[0]])}evaluate(t,e){let r;return this.args&&(r=this.args.map((r=>r.evaluate(t,e)))),this.calculate(r)}}rt.ops={abs:t=>Math.abs(t[0]),acos:t=>Math.acos(t[0]),asin:t=>Math.asin(t[0]),atan:t=>Math.atan(t[0]),ceil:t=>Math.ceil(t[0]),cos:t=>Math.cos(t[0]),e:()=>Math.E,floor:t=>Math.floor(t[0]),ln:t=>Math.log(t[0]),ln2:()=>Math.LN2,log10:t=>Math.log(t[0])/Math.LN10,log2:t=>Math.log(t[0])/Math.LN2,max:t=>Math.max(...t),min:t=>Math.min(...t),pi:()=>Math.PI,round:t=>Math.round(t[0]),sin:t=>Math.sin(t[0]),sqrt:t=>Math.sqrt(t[0]),tan:t=>Math.tan(t[0])};class st{constructor(t){this.args=t,this.type=i}static parse(t,e){return new st(t.slice(1).map((t=>pt(t,e))))}evaluate(t,e){return this.args.map((r=>r.evaluate(t,e))).join("")}}class nt{constructor(t,e){this.arg=t,this.calculate=e,this.type=i}static parse(t,e){if(2!==t.length)throw new Error(`${t[0]} expects 1 argument`);const r=pt(t[1],e);return new nt(r,nt.ops[t[0]])}evaluate(t,e){return this.calculate(this.arg.evaluate(t,e))}}nt.ops={downcase:t=>t.toLowerCase(),upcase:t=>t.toUpperCase()};class at{constructor(t){this.args=t,this.type=h}static parse(t,e){if(4!==t.length)throw new Error('"rgb" expects 3 arguments');const r=t.slice(1).map((t=>pt(t,e)));return new at(r)}evaluate(e,r){const s=this._validate(this.args[0].evaluate(e,r)),n=this._validate(this.args[1].evaluate(e,r)),a=this._validate(this.args[2].evaluate(e,r));return new t({r:s,g:n,b:a})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}}class ot{constructor(t){this.args=t,this.type=h}static parse(t,e){if(5!==t.length)throw new Error('"rgba" expects 4 arguments');const r=t.slice(1).map((t=>pt(t,e)));return new ot(r)}evaluate(e,r){const s=this._validate(this.args[0].evaluate(e,r)),n=this._validate(this.args[1].evaluate(e,r)),a=this._validate(this.args[2].evaluate(e,r)),o=this._validateAlpha(this.args[3].evaluate(e,r));return new t({r:s,g:n,b:a,a:o})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}_validateAlpha(t){if("number"!=typeof t||t<0||t>1)throw new Error(`${t}: invalid alpha color component`);return t}}class it{constructor(t){this.color=t,this.type=g(u,4)}static parse(t,e){if(2!==t.length)throw new Error('"to-rgba" expects 1 argument');const r=pt(t[1],e);return new it(r)}evaluate(e,r){return new t(this.color.evaluate(e,r)).toRgba()}}class lt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){const r=t[0];if(t.length<2)throw new Error(`${r} expects at least one argument`);let s,n=1;if("array"===r){if(t.length>2){switch(t[1]){case"string":s=i;break;case"number":s=u;break;case"boolean":s=c;break;default:throw new Error('"array" type argument must be string, number or boolean')}n++}else s=o;let e;if(t.length>3){if(e=t[2],null!==e&&("number"!=typeof e||e<0||e!==Math.floor(e)))throw new Error('"array" length argument must be a positive integer literal');n++}s=g(s,e)}else switch(r){case"string":s=i;break;case"number":s=u;break;case"boolean":s=c;break;case"object":s=l}const a=[];for(;n<t.length;n++){const r=pt(t[n],e);a.push(r)}return new lt(s,a)}evaluate(t,e){let r;for(const s of this.args){const n=s.evaluate(t,e);if(r=f(n),w(r,this.type))return n}throw new Error(`Expected ${p(this.type)} but got ${p(r)}`)}}class ut{constructor(t,e){this.type=t,this.args=e}static parse(t,e){const r=t[0],s=ut.types[r];if(s===c||s===i){if(2!==t.length)throw new Error(`${r} expects one argument`)}else if(t.length<2)throw new Error(`${r} expects at least one argument`);const n=[];for(let a=1;a<t.length;a++){const r=pt(t[a],e);n.push(r)}return new ut(s,n)}evaluate(e,r){if(this.type===c)return Boolean(this.args[0].evaluate(e,r));if(this.type===i)return m(this.args[0].evaluate(e,r));if(this.type===u){for(const t of this.args){const s=Number(t.evaluate(e,r));if(!isNaN(s))return s}return null}if(this.type===h){for(const s of this.args)try{const n=ut.toColor(s.evaluate(e,r));if(n instanceof t)return n}catch{}return null}}static toBoolean(t){return Boolean(t)}static toString(t){return m(t)}static toNumber(t){const e=Number(t);if(isNaN(e))throw new Error(`"${t}" is not a number`);return e}static toColor(e){if(e instanceof t)return e;if("string"==typeof e){const r=t.fromString(e);if(r)return r;throw new Error(`"${e}" is not a color`)}if(Array.isArray(e))return t.fromArray(e);throw new Error(`"${e}" is not a color`)}}ut.types={"to-boolean":c,"to-color":h,"to-number":u,"to-string":i};class ct{constructor(t){this.val=t,this.type=f(t)}static parse(t){if(2!==t.length)throw new Error('"literal" expects 1 argument');return new ct(t[1])}evaluate(t,e){return this.val}}class ht{constructor(t){this.arg=t,this.type=i}static parse(t,e){if(2!==t.length)throw new Error('"typeof" expects 1 argument');return new ht(pt(t[1],e))}evaluate(t,e){return p(f(this.arg.evaluate(t,e)))}}function pt(t,e,r){const s=typeof t;if("string"===s||"boolean"===s||"number"===s||null===t){if(r)switch(r.kind){case"string":"string"!==s&&(t=ut.toString(t));break;case"number":"number"!==s&&(t=ut.toNumber(t));break;case"color":t=ut.toColor(t)}t=["literal",t]}if(!Array.isArray(t)||0===t.length)throw new Error("Expression must be a non empty array");const n=t[0];if("string"!=typeof n)throw new Error("First element of expression must be a string");const a=gt[n];if(void 0===a)throw new Error(`Invalid expression operator "${n}"`);if(!a)throw new Error(`Unimplemented expression operator "${n}"`);return a.parse(t,e,r)}const gt={array:lt,boolean:lt,collator:null,format:null,image:null,literal:ct,number:lt,"number-format":null,object:lt,string:lt,"to-boolean":ut,"to-color":ut,"to-number":ut,"to-string":ut,typeof:ht,accumulated:null,"feature-state":null,"geometry-type":d,id:b,"line-progress":null,properties:x,at:O,get:T,has:F,in:V,"index-of":D,length:H,slice:J,"!":N,"!=":k,"<":A,"<=":j,"==":M,">":q,">=":_,all:R,any:C,case:I,coalesce:L,match:U,within:null,interpolate:P,"interpolate-hcl":P,"interpolate-lab":P,step:S,let:B,var:G,concat:st,downcase:nt,"is-supported-script":null,"resolved-locale":null,upcase:nt,rgb:at,rgba:ot,"to-rgba":it,"-":W,"*":X,"/":Y,"%":Z,"^":tt,"+":et,abs:rt,acos:rt,asin:rt,atan:rt,ceil:rt,cos:rt,e:rt,floor:rt,ln:rt,ln2:rt,log10:rt,log2:rt,max:rt,min:rt,pi:rt,round:rt,sin:rt,sqrt:rt,tan:rt,zoom:E,"heatmap-density":null,"has-id":K,none:z};export{R as ALL,C as ANY,et as Add,lt as Assert,O as At,rt as Calculate,I as Case,L as Coalesce,ut as Coerce,st as Concat,Y as Div,M as EQ,_ as GE,q as GT,d as GeomType,T as Get,F as Has,K as HasID,b as ID,V as In,D as IndexOf,P as Interpolate,j as LE,A as LT,H as Length,B as Let,ct as Literal,U as Match,Z as Mod,X as Mul,k as NE,z as NONE,N as NOT,tt as Pow,x as Properties,at as Rgb,ot as Rgba,J as Slice,S as Step,nt as String,W as Sub,it as ToRgba,ht as TypeOf,G as Var,E as Zoom,pt as createExpression,gt as ops};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as t}from"../../../../../core/maybe.js";import e from"../MemoryBuffer.js";import{EncodingType as n,AttributeStatus as o}from"./enums.js";import{DataType as s}from"../../../../webgl/enums.js";import{VertexElementDescriptor as r}from"../../../../webgl/VertexElementDescriptor.js";class i{constructor(t){this._locations=new Map,this._key=t}get key(){return this._key}get type(){return 7&this._key}defines(){return[]}getStride(){return this._layoutInfo||this._buildAttributesInfo(),this._stride}getAttributeLocations(){return 0===this._locations.size&&this._buildAttributesInfo(),this._locations}getLayoutInfo(){return this._layoutInfo||this._buildAttributesInfo(),this._layoutInfo}getEncodingInfos(){return this._propertyEncodingInfo||this._buildAttributesInfo(),this._propertyEncodingInfo}getUniforms(){return this._uniforms||this._buildAttributesInfo(),this._uniforms}getShaderHeader(){return this._shaderHeader||this._buildAttributesInfo(),this._shaderHeader}getShaderMain(){return this._shaderMain||this._buildAttributesInfo(),this._shaderMain}setDataUniforms(t,e,n,o,s){const r=this.getUniforms();for(const i of r){const{name:r,type:a,getValue:c}=i,u=c(n,e,o,s);if(null!==u)switch(a){case"float":t.setUniform1f(r,u);break;case"vec2":t.setUniform2fv(r,u);break;case"vec4":t.setUniform4fv(r,u)}}}encodeAttributes(t,e,o,s){const r=this.attributesInfo(),i=this.getEncodingInfos(),a=[];let c=0,u=0;for(const _ of Object.keys(i)){var f;const h=i[_],{type:l,precisionFactor:d,isLayout:y}=r[_],I=y?o.getLayoutProperty(_):o.getPaintProperty(_),m=null==(f=I.interpolator)?void 0:f.getInterpolationRange(e);let E=0;for(const o of h){const{offset:r,bufferElementsToAdd:i}=o;if(i>0){for(let t=0;t<i;t++)a.push(0);c+=u,u=o.bufferElementsToAdd}const f=null!=s?s:I.getValue(m?m[E]:e,t);switch(l){case n.R8_SIGNED:case n.R8_UNSIGNED:a[c]|=this._encodeByte(f*(d||1),8*r);break;case n.R16_SIGNED:case n.R16_UNSIGNED:a[c]|=this._encodeShort(f*(d||1),8*r);break;case n.R8G8_SIGNED:case n.R8G8_UNSIGNED:a[c]|=this._encodeByte(f*(d||1),8*r),a[c]|=this._encodeByte(f*(d||1),8*r+8);break;case n.R16G16_SIGNED:case n.R16G16_UNSIGNED:a[c]|=this._encodeShort(f*(d||1),8*r),a[c]|=this._encodeShort(f*(d||1),8*r+16);break;case n.R8G8B8A8_SIGNED:case n.R8G8B8A8_UNSIGNED:a[c]|=this._encodeByte(f*(d||1),8*r),a[c]|=this._encodeByte(f*(d||1),8*r+8),a[c]|=this._encodeByte(f*(d||1),8*r+16),a[c]|=this._encodeByte(f*(d||1),8*r+24);break;case n.R8G8B8A8_COLOR:a[c]=this._encodeColor(f);break;case n.R16G16B16A16_DASHARRAY:case n.R16G16B16A16_PATTERN:this._encodePattern(c,a,f);break;default:throw new Error("Unsupported encoding type")}E++}}return a}getAtributeState(t){let e=0;const n=3+2*t;return e|=this._bit(n),e|=this._bit(n+1)<<1,e}_buildAttributesInfo(){const t=[],e={},n={};let r=-1;const a=this.attributesInfo(),c=this.attributes();let u=-1;for(const s of c){u++;const c=this.getAtributeState(u);if(c===o.UNIFORM||c===o.UNUSED)continue;const f=a[s],_=[];e[s]=_;const h=f.type;for(let e=0;e<c;e++){const{dataType:e,bytesPerElement:o,count:s,normalized:a}=i._encodingInfo[h],c=o*s;let u=n[e],f=0;if(!u||u.count+s>4)r++,u={dataIndex:r,count:0,offset:0},4!==s&&(n[e]=u),t.push({location:-1,name:"a_data_"+r,count:s,type:e,normalized:a}),f=Math.ceil(Math.max(c/4,1));else{const e=t[u.dataIndex];e.count+=s;f=Math.ceil(Math.max(e.count*o/4,1))-Math.ceil(Math.max(u.offset/4,1))}_.push({dataIndex:u.dataIndex,offset:u.offset,bufferElementsToAdd:f}),u.offset+=c,u.count+=s}}for(const o of t)switch(o.type){case s.BYTE:case s.UNSIGNED_BYTE:o.count=4;case s.SHORT:case s.UNSIGNED_SHORT:o.count+=o.count%2}this._buildVertexBufferLayout(t);let f=0;const _=this._layoutInfo.geometry;for(const o of _)this._locations.set(o.name,f++);const h=this._layoutInfo.opacity;if(h)for(const o of h)this._locations.set(o.name,f++);this._buildShaderInfo(t,e),this._propertyEncodingInfo=e}_buildVertexBufferLayout(t){const e={},n=this.geometryInfo();let o=n[0].stride;if(0===t.length)e.geometry=n;else{const s=[];let i=o;for(const e of t)o+=a(e.type)*e.count;for(const t of n){const e={...t};e.stride=o,s.push(e)}for(const e of t)s.push(new r(e.name,e.count,e.type,i,o)),i+=a(e.type)*e.count;e.geometry=s}this.opacityInfo()&&(e.opacity=this.opacityInfo()),this._layoutInfo=e,this._stride=o}_buildShaderInfo(e,s){let r="\n",a="\n";const u=[];for(const t of e)r+=`attribute ${this._getType(t.count)} ${t.name};\n`;const f=this.attributes(),_=this.attributesInfo();let h=-1;for(const l of f){h++;const{name:e,type:f,precisionFactor:d,isLayout:y}=_[l],I=d&&1!==d?" * "+1/d:"",{bytesPerElement:m,count:E}=i._encodingInfo[f],p=t=>`a_data_${t.dataIndex}${c(E,t.offset,m)}`;switch(this.getAtributeState(h)){case o.UNIFORM:{const o=this._getType(E),s=`u_${e}`;u.push({name:s,type:o,getValue:(e,o,s,r)=>{const i=y?e.getLayoutValue(l,o):e.getPaintValue(l,o);if(f===n.R16G16B16A16_DASHARRAY){const n=e.getDashKey(i,e.getLayoutValue("line-cap",o)),s=r.getMosaicItemPosition(n,!1);if(t(s))return null;const{tl:a,br:c}=s;return[a[0],c[1],c[0],a[1]]}if(f===n.R16G16B16A16_PATTERN){const e=r.getMosaicItemPosition(i,-1===l.indexOf("line-"));if(t(e))return null;const{tl:n,br:o}=e;return[n[0],o[1],o[0],n[1]]}if(f===n.R8G8B8A8_COLOR){const t=i[3];return[t*i[0],t*i[1],t*i[2],t]}return i}}),r+=`uniform ${o} ${s};\n`,a+=`${o} ${e} = ${s};\n`}break;case o.DATA_DRIVEN:{const t=p(s[l][0]);a+=`${this._getType(E)} ${e} = ${t}${I};\n`}break;case o.INTERPOLATED_DATA_DRIVEN:{const t=`u_t_${e}`;u.push({name:t,type:"float",getValue:(t,e,n,o)=>(y?t.getLayoutProperty(l):t.getPaintProperty(l)).interpolator.interpolationUniformValue(n,e)}),r+=`uniform float ${t};\n`;const n=p(s[l][0]),o=p(s[l][1]);a+=`${this._getType(E)} ${e} = mix(${n}${I}, ${o}${I}, ${t});\n`}}}this._shaderHeader=r,this._shaderMain=a,this._uniforms=u}_bit(t){return(this._key&1<<t)>>t}_getType(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4"}throw new Error("Invalid count")}_encodeColor(t){const n=255*t[3];return e.i8888to32(t[0]*n,t[1]*n,t[2]*n,n)}_encodePattern(t,e,n){if(!n||!n.rect)return;const o=2,s=n.rect,r=n.width,i=n.height;e[t]=this._encodeShort(s.x+o,0),e[t]|=this._encodeShort(s.y+o+i,16),e[t+1]=this._encodeShort(s.x+o+r,0),e[t+1]|=this._encodeShort(s.y+o,16)}_encodeByte(t,e){return(255&t)<<e}_encodeShort(t,e){return(65535&t)<<e}}i._encodingInfo={[n.R8_SIGNED]:{dataType:s.BYTE,bytesPerElement:1,count:1,normalized:!1},[n.R8_UNSIGNED]:{dataType:s.UNSIGNED_BYTE,bytesPerElement:1,count:1,normalized:!1},[n.R16_SIGNED]:{dataType:s.SHORT,bytesPerElement:2,count:1,normalized:!1},[n.R16_UNSIGNED]:{dataType:s.UNSIGNED_SHORT,bytesPerElement:2,count:1,normalized:!1},[n.R8G8_SIGNED]:{dataType:s.BYTE,bytesPerElement:1,count:2,normalized:!1},[n.R8G8_UNSIGNED]:{dataType:s.UNSIGNED_BYTE,bytesPerElement:1,count:2,normalized:!1},[n.R16G16_SIGNED]:{dataType:s.SHORT,bytesPerElement:2,count:2,normalized:!1},[n.R16G16_UNSIGNED]:{dataType:s.UNSIGNED_SHORT,bytesPerElement:2,count:2,normalized:!1},[n.R8G8B8A8_SIGNED]:{dataType:s.BYTE,bytesPerElement:1,count:4,normalized:!1},[n.R8G8B8A8_UNSIGNED]:{dataType:s.UNSIGNED_BYTE,bytesPerElement:1,count:4,normalized:!1},[n.R8G8B8A8_COLOR]:{dataType:s.UNSIGNED_BYTE,bytesPerElement:1,count:4,normalized:!0},[n.R16G16B16A16_DASHARRAY]:{dataType:s.UNSIGNED_SHORT,bytesPerElement:2,count:4,normalized:!1},[n.R16G16B16A16_PATTERN]:{dataType:s.UNSIGNED_SHORT,bytesPerElement:2,count:4,normalized:!1}};const a=t=>{switch(t){case s.FLOAT:case s.INT:case s.UNSIGNED_INT:return 4;case s.SHORT:case s.UNSIGNED_SHORT:return 2;case s.BYTE:case s.UNSIGNED_BYTE:return 1}},c=(t,e,n)=>{const o=e/n;if(1===t)switch(o){case 0:return".x";case 1:return".y";case 2:return".z";case 3:return".w"}else if(2===t)switch(o){case 0:return".xy";case 1:return".yz";case 2:return".zw"}else if(3===t)switch(o){case 0:return".xyz";case 1:return".yzw"}return""};export{i as VTLMaterial};
5
+ import{isNone as t}from"../../../../../core/maybe.js";import e from"../MemoryBuffer.js";import{EncodingType as n,AttributeStatus as o}from"./enums.js";import{DataType as s}from"../../../../webgl/enums.js";import{VertexElementDescriptor as r}from"../../../../webgl/VertexElementDescriptor.js";class i{constructor(t){this._locations=new Map,this._key=t}get key(){return this._key}get type(){return 7&this._key}defines(){return[]}getStride(){return this._layoutInfo||this._buildAttributesInfo(),this._stride}getAttributeLocations(){return 0===this._locations.size&&this._buildAttributesInfo(),this._locations}getLayoutInfo(){return this._layoutInfo||this._buildAttributesInfo(),this._layoutInfo}getEncodingInfos(){return this._propertyEncodingInfo||this._buildAttributesInfo(),this._propertyEncodingInfo}getUniforms(){return this._uniforms||this._buildAttributesInfo(),this._uniforms}getShaderHeader(){return this._shaderHeader||this._buildAttributesInfo(),this._shaderHeader}getShaderMain(){return this._shaderMain||this._buildAttributesInfo(),this._shaderMain}setDataUniforms(t,e,n,o,s){const r=this.getUniforms();for(const i of r){const{name:r,type:a,getValue:c}=i,u=c(n,e,o,s);if(null!==u)switch(a){case"float":t.setUniform1f(r,u);break;case"vec2":t.setUniform2fv(r,u);break;case"vec4":t.setUniform4fv(r,u)}}}encodeAttributes(t,e,o,s){const r=this.attributesInfo(),i=this.getEncodingInfos(),a=[];let c=0,u=0;for(const _ of Object.keys(i)){var f;const h=i[_],{type:l,precisionFactor:d,isLayout:y}=r[_],I=y?o.getLayoutProperty(_):o.getPaintProperty(_),m=null==(f=I.interpolator)?void 0:f.getInterpolationRange(e);let E=0;for(const o of h){const{offset:r,bufferElementsToAdd:i}=o;if(i>0){for(let t=0;t<i;t++)a.push(0);c+=u,u=o.bufferElementsToAdd}const f=null!=s?s:I.getValue(m?m[E]:e,t);switch(l){case n.R8_SIGNED:case n.R8_UNSIGNED:a[c]|=this._encodeByte(f*(d||1),8*r);break;case n.R16_SIGNED:case n.R16_UNSIGNED:a[c]|=this._encodeShort(f*(d||1),8*r);break;case n.R8G8_SIGNED:case n.R8G8_UNSIGNED:a[c]|=this._encodeByte(f*(d||1),8*r),a[c]|=this._encodeByte(f*(d||1),8*r+8);break;case n.R16G16_SIGNED:case n.R16G16_UNSIGNED:a[c]|=this._encodeShort(f*(d||1),8*r),a[c]|=this._encodeShort(f*(d||1),8*r+16);break;case n.R8G8B8A8_SIGNED:case n.R8G8B8A8_UNSIGNED:a[c]|=this._encodeByte(f*(d||1),8*r),a[c]|=this._encodeByte(f*(d||1),8*r+8),a[c]|=this._encodeByte(f*(d||1),8*r+16),a[c]|=this._encodeByte(f*(d||1),8*r+24);break;case n.R8G8B8A8_COLOR:a[c]=this._encodeColor(f);break;case n.R16G16B16A16_DASHARRAY:case n.R16G16B16A16_PATTERN:this._encodePattern(c,a,f);break;default:throw new Error("Unsupported encoding type")}E++}}return a}getAtributeState(t){let e=0;const n=3+2*t;return e|=this._bit(n),e|=this._bit(n+1)<<1,e}_buildAttributesInfo(){const t=[],e={},n={};let r=-1;const a=this.attributesInfo(),c=this.attributes();let u=-1;for(const s of c){u++;const c=this.getAtributeState(u);if(c===o.UNIFORM||c===o.UNUSED)continue;const f=a[s],_=[];e[s]=_;const h=f.type;for(let e=0;e<c;e++){const{dataType:e,bytesPerElement:o,count:s,normalized:a}=i._encodingInfo[h],c=o*s;let u=n[e],f=0;if(!u||u.count+s>4)r++,u={dataIndex:r,count:0,offset:0},4!==s&&(n[e]=u),t.push({location:-1,name:"a_data_"+r,count:s,type:e,normalized:a}),f=Math.ceil(Math.max(c/4,1));else{const e=t[u.dataIndex];e.count+=s;f=Math.ceil(Math.max(e.count*o/4,1))-Math.ceil(Math.max(u.offset/4,1))}_.push({dataIndex:u.dataIndex,offset:u.offset,bufferElementsToAdd:f}),u.offset+=c,u.count+=s}}for(const o of t)switch(o.type){case s.BYTE:case s.UNSIGNED_BYTE:o.count=4;case s.SHORT:case s.UNSIGNED_SHORT:o.count+=o.count%2}this._buildVertexBufferLayout(t);let f=0;const _=this._layoutInfo.geometry;for(const o of _)this._locations.set(o.name,f++);const h=this._layoutInfo.opacity;if(h)for(const o of h)this._locations.set(o.name,f++);this._buildShaderInfo(t,e),this._propertyEncodingInfo=e}_buildVertexBufferLayout(t){const e={},n=this.geometryInfo();let o=n[0].stride;if(0===t.length)e.geometry=n;else{const s=[];let i=o;for(const e of t)o+=a(e.type)*e.count;for(const t of n){const e={...t};e.stride=o,s.push(e)}for(const e of t)s.push(new r(e.name,e.count,e.type,i,o)),i+=a(e.type)*e.count;e.geometry=s}this.opacityInfo()&&(e.opacity=this.opacityInfo()),this._layoutInfo=e,this._stride=o}_buildShaderInfo(e,s){let r="\n",a="\n";const u=[];for(const t of e)r+=`attribute ${this._getType(t.count)} ${t.name};\n`;const f=this.attributes(),_=this.attributesInfo();let h=-1;for(const l of f){h++;const{name:e,type:f,precisionFactor:d,isLayout:y}=_[l],I=d&&1!==d?" * "+1/d:"",{bytesPerElement:m,count:E}=i._encodingInfo[f],p=t=>`a_data_${t.dataIndex}${c(E,t.offset,m)}`;switch(this.getAtributeState(h)){case o.UNIFORM:{const o=this._getType(E),s=`u_${e}`;u.push({name:s,type:o,getValue:(e,o,s,r)=>{const i=y?e.getLayoutValue(l,o):e.getPaintValue(l,o);if(f===n.R16G16B16A16_DASHARRAY){const n=e.getDashKey(i,e.getLayoutValue("line-cap",o)),s=r.getMosaicItemPosition(n,!1);if(t(s))return null;const{tl:a,br:c}=s;return[a[0],c[1],c[0],a[1]]}if(f===n.R16G16B16A16_PATTERN){const e=r.getMosaicItemPosition(i,!l.includes("line-"));if(t(e))return null;const{tl:n,br:o}=e;return[n[0],o[1],o[0],n[1]]}if(f===n.R8G8B8A8_COLOR){const t=i[3];return[t*i[0],t*i[1],t*i[2],t]}return i}}),r+=`uniform ${o} ${s};\n`,a+=`${o} ${e} = ${s};\n`}break;case o.DATA_DRIVEN:{const t=p(s[l][0]);a+=`${this._getType(E)} ${e} = ${t}${I};\n`}break;case o.INTERPOLATED_DATA_DRIVEN:{const t=`u_t_${e}`;u.push({name:t,type:"float",getValue:(t,e,n,o)=>(y?t.getLayoutProperty(l):t.getPaintProperty(l)).interpolator.interpolationUniformValue(n,e)}),r+=`uniform float ${t};\n`;const n=p(s[l][0]),o=p(s[l][1]);a+=`${this._getType(E)} ${e} = mix(${n}${I}, ${o}${I}, ${t});\n`}}}this._shaderHeader=r,this._shaderMain=a,this._uniforms=u}_bit(t){return(this._key&1<<t)>>t}_getType(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4"}throw new Error("Invalid count")}_encodeColor(t){const n=255*t[3];return e.i8888to32(t[0]*n,t[1]*n,t[2]*n,n)}_encodePattern(t,e,n){if(!n||!n.rect)return;const o=2,s=n.rect,r=n.width,i=n.height;e[t]=this._encodeShort(s.x+o,0),e[t]|=this._encodeShort(s.y+o+i,16),e[t+1]=this._encodeShort(s.x+o+r,0),e[t+1]|=this._encodeShort(s.y+o,16)}_encodeByte(t,e){return(255&t)<<e}_encodeShort(t,e){return(65535&t)<<e}}i._encodingInfo={[n.R8_SIGNED]:{dataType:s.BYTE,bytesPerElement:1,count:1,normalized:!1},[n.R8_UNSIGNED]:{dataType:s.UNSIGNED_BYTE,bytesPerElement:1,count:1,normalized:!1},[n.R16_SIGNED]:{dataType:s.SHORT,bytesPerElement:2,count:1,normalized:!1},[n.R16_UNSIGNED]:{dataType:s.UNSIGNED_SHORT,bytesPerElement:2,count:1,normalized:!1},[n.R8G8_SIGNED]:{dataType:s.BYTE,bytesPerElement:1,count:2,normalized:!1},[n.R8G8_UNSIGNED]:{dataType:s.UNSIGNED_BYTE,bytesPerElement:1,count:2,normalized:!1},[n.R16G16_SIGNED]:{dataType:s.SHORT,bytesPerElement:2,count:2,normalized:!1},[n.R16G16_UNSIGNED]:{dataType:s.UNSIGNED_SHORT,bytesPerElement:2,count:2,normalized:!1},[n.R8G8B8A8_SIGNED]:{dataType:s.BYTE,bytesPerElement:1,count:4,normalized:!1},[n.R8G8B8A8_UNSIGNED]:{dataType:s.UNSIGNED_BYTE,bytesPerElement:1,count:4,normalized:!1},[n.R8G8B8A8_COLOR]:{dataType:s.UNSIGNED_BYTE,bytesPerElement:1,count:4,normalized:!0},[n.R16G16B16A16_DASHARRAY]:{dataType:s.UNSIGNED_SHORT,bytesPerElement:2,count:4,normalized:!1},[n.R16G16B16A16_PATTERN]:{dataType:s.UNSIGNED_SHORT,bytesPerElement:2,count:4,normalized:!1}};const a=t=>{switch(t){case s.FLOAT:case s.INT:case s.UNSIGNED_INT:return 4;case s.SHORT:case s.UNSIGNED_SHORT:return 2;case s.BYTE:case s.UNSIGNED_BYTE:return 1}},c=(t,e,n)=>{const o=e/n;if(1===t)switch(o){case 0:return".x";case 1:return".y";case 2:return".z";case 3:return".w"}else if(2===t)switch(o){case 0:return".xy";case 1:return".yz";case 2:return".zw"}else if(3===t)switch(o){case 0:return".xyz";case 1:return".yzw"}return""};export{i as VTLMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/CircularArray.js";import s from"../../../../core/Evented.js";import t from"../../../../core/has.js";import{isSome as r}from"../../../../core/maybe.js";import{createDisjointTimerQuery as n}from"../../../webgl/capabilities/DisjointTimerQuery.js";const i=t("esri-2d-profiler");class o{constructor(t,r){if(this._events=new s,this._entries=new Map,this._timings=new e(10),!i)return;this._ext=n(t.gl,{}),this._debugOutput=r;const o=t.gl;if(this.enableCommandLogging)for(const e in o)if("function"==typeof o[e]){const s=o[e],t=-1!==e.indexOf("draw");o[e]=(...r)=>(this._events.emit("command",{container:this._currentContainer,pass:this._currentPass,brush:this._currentBrush,method:e,args:r,isDrawCommand:t}),this._currentSummary&&(this._currentSummary.commands++,t&&this._currentSummary.drawCommands++),s.apply(o,r))}}get enableCommandLogging(){return!("object"==typeof i&&i.disableCommands)}recordContainerStart(e){i&&(this._currentContainer=e)}recordContainerEnd(){i&&(this._currentContainer=null)}recordPassStart(e){i&&(this._currentPass=e,this._initSummary())}recordPassEnd(){i&&(this._currentPass=null,this._emitSummary())}recordBrushStart(e){i&&(this._currentBrush=e)}recordBrushEnd(){i&&(this._currentBrush=null)}recordStart(e){if(i&&r(this._ext)){if(this._entries.has(e)){const s=this._entries.get(e),t=this._ext.resultAvailable(s.query),n=this._ext.disjoint();if(t&&!n){const t=this._ext.getResult(s.query)/1e6;let n=0;if(r(this._timings.enqueue(t))){const e=this._timings.entries,s=e.length;let t=0;for(const r of e)t+=r;n=t/s}const i=t.toFixed(2),o=n?n.toFixed(2):"--";this.enableCommandLogging?(console.groupCollapsed(`Frame report for ${e}, ${i} ms (${o} last 10 avg)\n${s.commandsLen} Commands (${s.drawCommands} draw)`),console.log("RenderPass breakdown: "),console.table(s.summaries),console.log("Commands: ",s.commands),console.groupEnd()):console.log(`Frame report for ${e}, ${i} ms (${o} last 10 avg)`),this._debugOutput.innerHTML=`${i} (${o})`}for(const e of s.handles)e.remove();this._entries.delete(e)}const s={name:e,query:this._ext.createQuery(),commands:[],commandsLen:0,drawCommands:0,summaries:[],handles:[]};this.enableCommandLogging&&(s.handles.push(this._events.on("command",(e=>{s.commandsLen++,s.commands.push(e),e.isDrawCommand&&s.drawCommands++}))),s.handles.push(this._events.on("summary",(e=>{s.summaries.push(e)})))),this._ext.beginTimeElapsed(s.query),this._entries.set(e,s)}}recordEnd(e){i&&r(this._ext)&&this._entries.has(e)&&this._ext.endTimeElapsed()}_initSummary(){this.enableCommandLogging&&(this._currentSummary={container:this._currentContainer,pass:this._currentPass,drawCommands:0,commands:0})}_emitSummary(){this.enableCommandLogging&&this._events.emit("summary",this._currentSummary)}}export{o as Profiler};
5
+ import e from"../../../../core/CircularArray.js";import s from"../../../../core/Evented.js";import t from"../../../../core/has.js";import{isSome as r}from"../../../../core/maybe.js";import{createDisjointTimerQuery as n}from"../../../webgl/capabilities/DisjointTimerQuery.js";const i=t("esri-2d-profiler");class o{constructor(t,r){if(this._events=new s,this._entries=new Map,this._timings=new e(10),!i)return;this._ext=n(t.gl,{}),this._debugOutput=r;const o=t.gl;if(this.enableCommandLogging)for(const e in o)if("function"==typeof o[e]){const s=o[e],t=e.includes("draw");o[e]=(...r)=>(this._events.emit("command",{container:this._currentContainer,pass:this._currentPass,brush:this._currentBrush,method:e,args:r,isDrawCommand:t}),this._currentSummary&&(this._currentSummary.commands++,t&&this._currentSummary.drawCommands++),s.apply(o,r))}}get enableCommandLogging(){return!("object"==typeof i&&i.disableCommands)}recordContainerStart(e){i&&(this._currentContainer=e)}recordContainerEnd(){i&&(this._currentContainer=null)}recordPassStart(e){i&&(this._currentPass=e,this._initSummary())}recordPassEnd(){i&&(this._currentPass=null,this._emitSummary())}recordBrushStart(e){i&&(this._currentBrush=e)}recordBrushEnd(){i&&(this._currentBrush=null)}recordStart(e){if(i&&r(this._ext)){if(this._entries.has(e)){const s=this._entries.get(e),t=this._ext.resultAvailable(s.query),n=this._ext.disjoint();if(t&&!n){const t=this._ext.getResult(s.query)/1e6;let n=0;if(r(this._timings.enqueue(t))){const e=this._timings.entries,s=e.length;let t=0;for(const r of e)t+=r;n=t/s}const i=t.toFixed(2),o=n?n.toFixed(2):"--";this.enableCommandLogging?(console.groupCollapsed(`Frame report for ${e}, ${i} ms (${o} last 10 avg)\n${s.commandsLen} Commands (${s.drawCommands} draw)`),console.log("RenderPass breakdown: "),console.table(s.summaries),console.log("Commands: ",s.commands),console.groupEnd()):console.log(`Frame report for ${e}, ${i} ms (${o} last 10 avg)`),this._debugOutput.innerHTML=`${i} (${o})`}for(const e of s.handles)e.remove();this._entries.delete(e)}const s={name:e,query:this._ext.createQuery(),commands:[],commandsLen:0,drawCommands:0,summaries:[],handles:[]};this.enableCommandLogging&&(s.handles.push(this._events.on("command",(e=>{s.commandsLen++,s.commands.push(e),e.isDrawCommand&&s.drawCommands++}))),s.handles.push(this._events.on("summary",(e=>{s.summaries.push(e)})))),this._ext.beginTimeElapsed(s.query),this._entries.set(e,s)}}recordEnd(e){i&&r(this._ext)&&this._entries.has(e)&&this._ext.endTimeElapsed()}_initSummary(){this.enableCommandLogging&&(this._currentSummary={container:this._currentContainer,pass:this._currentPass,drawCommands:0,commands:0})}_emitSummary(){this.enableCommandLogging&&this._events.emit("summary",this._currentSummary)}}export{o as Profiler};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{isPowerOfTwo as r}from"../../../../core/mathUtils.js";import{pt2px as n}from"../../../../core/screenUtils.js";import{CapType as i,JoinType as o}from"../../../../symbols/cim/enums.js";import{copyAndPremultiply as s}from"./color.js";import{WGLGeometryType as a,VVType as c}from"./enums.js";import{TextProperties as u}from"./SymbolProperties.js";import{Usage as l,TextureType as m,PixelFormat as f,PixelType as d,TextureWrapMode as p,DataType as y,TextureSamplingMode as g}from"../../../webgl/enums.js";import{Texture as h}from"../../../webgl/Texture.js";import{VertexElementDescriptor as T}from"../../../webgl/VertexElementDescriptor.js";const w=t.getLogger("esri.views.2d.engine.webgl.Utils"),E="geometry",I="per_instance",S="per_instance_vv",A=[{name:E,strideInBytes:36}],L=[{name:E,strideInBytes:32}],N=[{name:E,strideInBytes:20}],D=[{name:E,strideInBytes:12}],M=[{name:E,strideInBytes:40}],v=[{name:E,strideInBytes:36}],U=[{name:E,strideInBytes:36}];function R(e){const t={};for(const r of e)t[r.name]=r.strideInBytes;return t}const _=R(A),B=R(L),b=R(N),C=R(D),O=R(M),F=R(v),x=R(U);function z(e,{fill:t}){switch(e){case a.MARKER:return _;case a.FILL:return"dot-density"===t?C:"simple"===t?b:B;case a.LINE:return O;case a.TEXT:return F;case a.LABEL:return x}}const j=[E],G=[E],P=[E],$=[E],V=[E];function Y(e){switch(e){case a.MARKER:return j;case a.FILL:return G;case a.LINE:return P;case a.TEXT:return $;case a.LABEL:return V}}function k(e){switch(e%4){case 0:case 2:return 4;case 1:case 3:return 1}}function q(e,t){switch(t%4){case 0:case 2:return new Uint32Array(Math.floor(e*t/4));case 1:case 3:return new Uint8Array(e*t)}}function H(e,t){switch(t%4){case 0:case 2:return new Uint32Array(e);case 1:case 3:return new Uint8Array(e)}}function X(e){return u.pool.acquire(e.color?s(e.color):[255,255,255,255],e.haloColor?s(e.haloColor):[255,255,255,255],n(e.haloSize),n(e.font.size),e.angle*Math.PI/180,e.xoffset/e.font.size,e.yoffset/e.font.size,"left"===e.horizontalAlignment?0:"right"===e.horizontalAlignment?1:.5,"top"===e.verticalAlignment?0:"bottom"===e.verticalAlignment?1:.5)}function K(e){return null!=e}function Z(e){return"number"==typeof e}function J(t){switch(t){case"butt":return i.BUTT;case"round":return i.ROUND;case"square":return i.SQUARE;default:return w.error(new e("mapview-invalid-type",`Cap type ${t} is not a valid option. Defaulting to round`)),i.ROUND}}function Q(t){switch(t){case"miter":return o.MITER;case"bevel":return o.BEVEL;case"round":return o.ROUND;default:return w.error(new e("mapview-invalid-type",`Join type ${t} is not a valid option. Defaulting to round`)),o.ROUND}}function W(e){switch(e){case"opacity":return c.OPACITY;case"color":return c.COLOR;case"rotation":return c.ROTATION;case"size":return c.SIZE;default:return w.error(`Cannot interpret unknown vv: ${e}`),null}}function ee(e){const{transform:t,hasZ:r,hasM:n}=e;return{transform:t,hasZ:r,hasM:n}}function te(e,t,r,n,i,o,s){for(const c in o){const t=o[c].stride,n=k(t),s=o[c].data,a=r[c].data,u=t*i.vertexCount/n,l=t*e/n,m=t*i.vertexFrom/n;for(let e=0;e<u;++e)a[e+l]=s[e+m]}const a=i.indexCount;for(let c=0;c<a;++c)n[c+t]=s[c+i.indexFrom]-i.vertexFrom+e}const re={[E]:l.STATIC_DRAW};function ne(e,t){const r=[];for(let n=0;n<5;++n){const i=Y(n),o={};for(const e of i)o[e]={data:t(n,e)};r.push({data:e(n),buffers:o})}return r}function ie(e,t){let n,i;return r(t.width)&&r(t.height)?(n=!0,i=g.LINEAR_MIPMAP_LINEAR):(n=!1,i=g.LINEAR),new h(e,{target:m.TEXTURE_2D,pixelFormat:f.RGBA,internalFormat:f.RGBA,dataType:d.UNSIGNED_BYTE,hasMipmap:n,samplingMode:i,wrapMode:p.CLAMP_TO_EDGE,flipped:!0},t)}function oe(e){return{vertexFrom:void 0,vertexTo:void 0,geometry:e}}function se(e){switch(e){case y.BYTE:case y.UNSIGNED_BYTE:return 1;case y.SHORT:case y.UNSIGNED_SHORT:return 2;case y.FLOAT:case y.INT:case y.UNSIGNED_INT:return 4}}function ae(t){switch(t){case d.UNSIGNED_BYTE:return 1;case d.UNSIGNED_SHORT_4_4_4_4:return 2;case d.FLOAT:return 4;default:return void w.error(new e("webgl-utils",`Unable to handle type ${t}`))}}function ce(t){switch(t){case d.UNSIGNED_BYTE:return Uint8Array;case d.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case d.FLOAT:return Float32Array;default:return void w.error(new e("webgl-utils",`Unable to handle type ${t}`))}}function ue(e){const t={};for(const r in e){const n=e[r];let i=0;t[r]=n.map((e=>{const t=new T(e.name,e.count,e.type,i,0,e.normalized||!1);return i+=e.count*se(e.type),t})),t[r].forEach((e=>e.stride=i))}return t}const le=e=>{const t=new Map;for(const r in e)for(const n of e[r])t.set(n.name,n.location);return t},me=e=>{const t={};for(const r in e){const n=e[r];t[r]=n.length?n[0].stride:0}return t},fe=new Map,de=(e,t)=>{if(!fe.has(e)){const r=ue(t),n={strides:me(r),bufferLayouts:r,attributes:le(t)};fe.set(e,n)}return fe.get(e)};function pe(e){e(a.FILL),e(a.LINE),e(a.MARKER),e(a.TEXT),e(a.LABEL)}const ye=e=>"path"in e&&De(e.path),ge=e=>"url"in e&&e.url||"imageData"in e&&e.imageData,he=e=>"imageData"in e&&e.imageData&&"contentType"in e&&e.contentType?`data:${e.contentType};base64,${e.imageData}`:"url"in e?e.url:null,Te=e=>"url"in e&&e.url&&e.url.includes(".gif")||"contentType"in e&&"image/gif"===e.contentType||"imageData"in e&&e.imageData.includes("data:image/gif"),we=e=>"url"in e&&e.url&&e.url.includes(".png")||"contentType"in e&&"image/png"===e.contentType||"imageData"in e&&e.imageData.includes("data:image/png"),Ee=e=>e.type&&-1!==e.type.toLowerCase().indexOf("3d");function Ie(e){switch(e.type){case"line":{const t=e;return"CIMSolidStroke"===t.cim.type&&!t.dashTemplate}case"fill":return"CIMSolidFill"===e.cim.type;case"esriSFS":return"esriSFSSolid"===e.style||"esriSFSNull"===e.style;case"esriSLS":return"esriSLSSolid"===e.style||"esriSLSNull"===e.style;default:return!1}}const Se=e=>e.includes("data:image/svg+xml");function Ae(e){switch("cim"in e?e.cim.type:e.type){case"esriSMS":case"esriPMS":case"CIMPointSymbol":case"CIMVectorMarker":case"CIMPictureMarker":case"CIMCharacterMarker":return!1;default:return!0}}function Le(e){const t="maxVVSize"in e&&e.maxVVSize,r="width"in e&&e.width||"size"in e&&e.size||0;return t||r}function Ne(e){const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return t}const De=e=>!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4));export{B as C_FILL_STRIDE_SPEC,C as C_FILL_STRIDE_SPEC_DD,b as C_FILL_STRIDE_SPEC_SIMPLE,L as C_FILL_VERTEX_DEF,D as C_FILL_VERTEX_DEF_DD,N as C_FILL_VERTEX_DEF_SIMPLE,_ as C_ICON_STRIDE_SPEC,A as C_ICON_VERTEX_DEF,x as C_LABEL_STRIDE_SPEC,U as C_LABEL_VERTEX_DEF,O as C_LINE_STRIDE_SPEC,M as C_LINE_VERTEX_DEF,F as C_TEXT_STRIDE_SPEC,v as C_TEXT_VERTEX_DEF,E as C_VBO_GEOMETRY,re as C_VBO_INFO,I as C_VBO_PERINSTANCE,S as C_VBO_PERINSTANCE_VV,q as allocateTypedArrayBuffer,H as allocateTypedArrayBufferwithData,Ne as charCodes,te as copyMeshData,ne as createGeometryData,de as createProgramDescriptor,ie as createTextureFromTexelData,pe as forEachGeometryType,oe as geometryToMappedGeometry,se as getBytes,J as getCapType,Q as getJoinType,Y as getNamedBuffers,Le as getPMSResourceSize,ce as getPixelArrayCtor,ae as getPixelBytes,z as getStrides,X as getTextProperties,ee as getTransformParams,he as getUrl,W as getVVType,Ee as is3D,K as isDefined,Te as isGIF,ge as isImageResource,Z as isNumber,we as isPNG,Se as isSVGImage,ye as isSVGResource,Ie as isSimple,De as isValidSVG,Ae as shouldRepeat,k as strideToPackingFactor};
5
+ import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{isPowerOfTwo as r}from"../../../../core/mathUtils.js";import{pt2px as n}from"../../../../core/screenUtils.js";import{CapType as i,JoinType as o}from"../../../../symbols/cim/enums.js";import{copyAndPremultiply as s}from"./color.js";import{WGLGeometryType as a,VVType as c}from"./enums.js";import{TextProperties as u}from"./SymbolProperties.js";import{Usage as l,TextureType as m,PixelFormat as f,PixelType as d,TextureWrapMode as p,DataType as y,TextureSamplingMode as g}from"../../../webgl/enums.js";import{Texture as h}from"../../../webgl/Texture.js";import{VertexElementDescriptor as T}from"../../../webgl/VertexElementDescriptor.js";const w=t.getLogger("esri.views.2d.engine.webgl.Utils"),E="geometry",I="per_instance",S="per_instance_vv",A=[{name:E,strideInBytes:36}],L=[{name:E,strideInBytes:32}],N=[{name:E,strideInBytes:20}],D=[{name:E,strideInBytes:12}],M=[{name:E,strideInBytes:40}],v=[{name:E,strideInBytes:36}],U=[{name:E,strideInBytes:36}];function R(e){const t={};for(const r of e)t[r.name]=r.strideInBytes;return t}const _=R(A),B=R(L),b=R(N),C=R(D),F=R(M),O=R(v),x=R(U);function z(e,{fill:t}){switch(e){case a.MARKER:return _;case a.FILL:return"dot-density"===t?C:"simple"===t?b:B;case a.LINE:return F;case a.TEXT:return O;case a.LABEL:return x}}const j=[E],G=[E],P=[E],$=[E],V=[E];function Y(e){switch(e){case a.MARKER:return j;case a.FILL:return G;case a.LINE:return P;case a.TEXT:return $;case a.LABEL:return V}}function k(e){switch(e%4){case 0:case 2:return 4;case 1:case 3:return 1}}function q(e,t){switch(t%4){case 0:case 2:return new Uint32Array(Math.floor(e*t/4));case 1:case 3:return new Uint8Array(e*t)}}function H(e,t){switch(t%4){case 0:case 2:return new Uint32Array(e);case 1:case 3:return new Uint8Array(e)}}function X(e){return u.pool.acquire(e.color?s(e.color):[255,255,255,255],e.haloColor?s(e.haloColor):[255,255,255,255],n(e.haloSize),n(e.font.size),e.angle*Math.PI/180,e.xoffset/e.font.size,e.yoffset/e.font.size,"left"===e.horizontalAlignment?0:"right"===e.horizontalAlignment?1:.5,"top"===e.verticalAlignment?0:"bottom"===e.verticalAlignment?1:.5)}function K(e){return null!=e}function Z(e){return"number"==typeof e}function J(t){switch(t){case"butt":return i.BUTT;case"round":return i.ROUND;case"square":return i.SQUARE;default:return w.error(new e("mapview-invalid-type",`Cap type ${t} is not a valid option. Defaulting to round`)),i.ROUND}}function Q(t){switch(t){case"miter":return o.MITER;case"bevel":return o.BEVEL;case"round":return o.ROUND;default:return w.error(new e("mapview-invalid-type",`Join type ${t} is not a valid option. Defaulting to round`)),o.ROUND}}function W(e){switch(e){case"opacity":return c.OPACITY;case"color":return c.COLOR;case"rotation":return c.ROTATION;case"size":return c.SIZE;default:return w.error(`Cannot interpret unknown vv: ${e}`),null}}function ee(e){const{transform:t,hasZ:r,hasM:n}=e;return{transform:t,hasZ:r,hasM:n}}function te(e,t,r,n,i,o,s){for(const c in o){const t=o[c].stride,n=k(t),s=o[c].data,a=r[c].data,u=t*i.vertexCount/n,l=t*e/n,m=t*i.vertexFrom/n;for(let e=0;e<u;++e)a[e+l]=s[e+m]}const a=i.indexCount;for(let c=0;c<a;++c)n[c+t]=s[c+i.indexFrom]-i.vertexFrom+e}const re={[E]:l.STATIC_DRAW};function ne(e,t){const r=[];for(let n=0;n<5;++n){const i=Y(n),o={};for(const e of i)o[e]={data:t(n,e)};r.push({data:e(n),buffers:o})}return r}function ie(e,t){let n,i;return r(t.width)&&r(t.height)?(n=!0,i=g.LINEAR_MIPMAP_LINEAR):(n=!1,i=g.LINEAR),new h(e,{target:m.TEXTURE_2D,pixelFormat:f.RGBA,internalFormat:f.RGBA,dataType:d.UNSIGNED_BYTE,hasMipmap:n,samplingMode:i,wrapMode:p.CLAMP_TO_EDGE,flipped:!0},t)}function oe(e){return{vertexFrom:void 0,vertexTo:void 0,geometry:e}}function se(e){switch(e){case y.BYTE:case y.UNSIGNED_BYTE:return 1;case y.SHORT:case y.UNSIGNED_SHORT:return 2;case y.FLOAT:case y.INT:case y.UNSIGNED_INT:return 4}}function ae(t){switch(t){case d.UNSIGNED_BYTE:return 1;case d.UNSIGNED_SHORT_4_4_4_4:return 2;case d.FLOAT:return 4;default:return void w.error(new e("webgl-utils",`Unable to handle type ${t}`))}}function ce(t){switch(t){case d.UNSIGNED_BYTE:return Uint8Array;case d.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case d.FLOAT:return Float32Array;default:return void w.error(new e("webgl-utils",`Unable to handle type ${t}`))}}function ue(e){const t={};for(const r in e){const n=e[r];let i=0;t[r]=n.map((e=>{const t=new T(e.name,e.count,e.type,i,0,e.normalized||!1);return i+=e.count*se(e.type),t})),t[r].forEach((e=>e.stride=i))}return t}const le=e=>{const t=new Map;for(const r in e)for(const n of e[r])t.set(n.name,n.location);return t},me=e=>{const t={};for(const r in e){const n=e[r];t[r]=n.length?n[0].stride:0}return t},fe=new Map,de=(e,t)=>{if(!fe.has(e)){const r=ue(t),n={strides:me(r),bufferLayouts:r,attributes:le(t)};fe.set(e,n)}return fe.get(e)};function pe(e){e(a.FILL),e(a.LINE),e(a.MARKER),e(a.TEXT),e(a.LABEL)}const ye=e=>"path"in e&&De(e.path),ge=e=>"url"in e&&e.url||"imageData"in e&&e.imageData,he=e=>"imageData"in e&&e.imageData&&"contentType"in e&&e.contentType?`data:${e.contentType};base64,${e.imageData}`:"url"in e?e.url:null,Te=e=>"url"in e&&e.url&&e.url.includes(".gif")||"contentType"in e&&"image/gif"===e.contentType||"imageData"in e&&e.imageData.includes("data:image/gif"),we=e=>"url"in e&&e.url&&e.url.includes(".png")||"contentType"in e&&"image/png"===e.contentType||"imageData"in e&&e.imageData.includes("data:image/png"),Ee=e=>e.type&&e.type.toLowerCase().includes("3d");function Ie(e){switch(e.type){case"line":{const t=e;return"CIMSolidStroke"===t.cim.type&&!t.dashTemplate}case"fill":return"CIMSolidFill"===e.cim.type;case"esriSFS":return"esriSFSSolid"===e.style||"esriSFSNull"===e.style;case"esriSLS":return"esriSLSSolid"===e.style||"esriSLSNull"===e.style;default:return!1}}const Se=e=>e.includes("data:image/svg+xml");function Ae(e){switch("cim"in e?e.cim.type:e.type){case"esriSMS":case"esriPMS":case"CIMPointSymbol":case"CIMVectorMarker":case"CIMPictureMarker":case"CIMCharacterMarker":return!1;default:return!0}}function Le(e){const t="maxVVSize"in e&&e.maxVVSize,r="width"in e&&e.width||"size"in e&&e.size||0;return t||r}function Ne(e){const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return t}const De=e=>!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4));export{B as C_FILL_STRIDE_SPEC,C as C_FILL_STRIDE_SPEC_DD,b as C_FILL_STRIDE_SPEC_SIMPLE,L as C_FILL_VERTEX_DEF,D as C_FILL_VERTEX_DEF_DD,N as C_FILL_VERTEX_DEF_SIMPLE,_ as C_ICON_STRIDE_SPEC,A as C_ICON_VERTEX_DEF,x as C_LABEL_STRIDE_SPEC,U as C_LABEL_VERTEX_DEF,F as C_LINE_STRIDE_SPEC,M as C_LINE_VERTEX_DEF,O as C_TEXT_STRIDE_SPEC,v as C_TEXT_VERTEX_DEF,E as C_VBO_GEOMETRY,re as C_VBO_INFO,I as C_VBO_PERINSTANCE,S as C_VBO_PERINSTANCE_VV,q as allocateTypedArrayBuffer,H as allocateTypedArrayBufferwithData,Ne as charCodes,te as copyMeshData,ne as createGeometryData,de as createProgramDescriptor,ie as createTextureFromTexelData,pe as forEachGeometryType,oe as geometryToMappedGeometry,se as getBytes,J as getCapType,Q as getJoinType,Y as getNamedBuffers,Le as getPMSResourceSize,ce as getPixelArrayCtor,ae as getPixelBytes,z as getStrides,X as getTextProperties,ee as getTransformParams,he as getUrl,W as getVVType,Ee as is3D,K as isDefined,Te as isGIF,ge as isImageResource,Z as isNumber,we as isPNG,Se as isSVGImage,ye as isSVGResource,Ie as isSimple,De as isValidSVG,Ae as shouldRepeat,k as strideToPackingFactor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{MIN_MAX_ZOOM_PRECISION_FACTOR as i,TEXTURE_BINDING_ATTRIBUTE_DATA_0 as s,TEXTURE_BINDING_ATTRIBUTE_DATA_1 as o,TEXTURE_BINDING_ATTRIBUTE_DATA_2 as a,TEXTURE_BINDING_ATTRIBUTE_DATA_3 as r}from"../definitions.js";import n from"./WGLBrush.js";import{BlendFactor as v,CompareFunction as u,DataType as f}from"../../../../webgl/enums.js";class m extends n{constructor(){super(...arguments),this._computeDesc=new Map}prepareState({context:t},e,i){const s=i&&-1!==i.indexOf("hittest");t.setBlendingEnabled(!s),t.setBlendFunctionSeparate(v.ONE,v.ONE_MINUS_SRC_ALPHA,v.ONE,v.ONE_MINUS_SRC_ALPHA),t.setColorMask(!0,!0,!0,!0),t.setStencilWriteMask(0),t.setStencilTestEnabled(!0),t.setStencilFunction(u.EQUAL,e.stencilRef,255)}draw(e,i,s){const o=this.getGeometryType();i.commit(e);const a=i.getGeometry(o);t(a)||(e.timeline.begin(this.name),e.attributeView.bindTextures(e.context),a.forEachCommand((t=>this.drawGeometry(e,i,t,s))))}_setSharedUniforms(t,n,v){const{displayLevel:u,pixelRatio:f,state:m,passOptions:l}=n;e(l)&&"hittest"===l.type&&(t.setUniform2fv("u_hittestPos",l.position),t.setUniform1f("u_hittestDist",l.distance)),t.setUniform1f("u_pixelRatio",f),t.setUniformMatrix3fv("u_tileMat3",v.transforms.tileMat3),t.setUniformMatrix3fv("u_viewMat3",m.viewMat3),t.setUniformMatrix3fv("u_dvsMat3",v.transforms.dvs),t.setUniformMatrix3fv("u_displayViewMat3",m.displayViewMat3),t.setUniform1f("u_currentZoom",Math.round(u*i)),t.setUniform1i("u_attributeTextureSize",n.attributeView.size),t.setUniform1i("u_attributeData0",s),t.setUniform1i("u_attributeData1",o),t.setUniform1i("u_attributeData2",a),t.setUniform1i("u_attributeData3",r)}_setSizeVVUniforms(t,e,i,s){if(t.vvSizeMinMaxValue&&e.setUniform4fv("u_vvSizeMinMaxValue",i.vvSizeMinMaxValue),t.vvSizeScaleStops&&e.setUniform1f("u_vvSizeScaleStopsValue",i.vvSizeScaleStopsValue),t.vvSizeFieldStops){const t=i.getSizeVVFieldStops(s.key.level);e.setUniform1fv("u_vvSizeFieldStopsValues",t.values),e.setUniform1fv("u_vvSizeFieldStopsSizes",t.sizes)}t.vvSizeUnitValue&&e.setUniform1f("u_vvSizeUnitValueWorldToPixelsRatio",i.vvSizeUnitValueToPixelsRatio)}_setColorAndOpacityVVUniforms(t,e,i){t.vvColor&&(e.setUniform1fv("u_vvColorValues",i.vvColorValues),e.setUniform4fv("u_vvColors",i.vvColors)),t.vvOpacity&&(e.setUniform1fv("u_vvOpacityValues",i.vvOpacityValues),e.setUniform1fv("u_vvOpacities",i.vvOpacities))}_setRotationVVUniforms(t,e,i){t.vvRotation&&e.setUniform1f("u_vvRotationType","geographic"===i.vvMaterialParameters.vvRotationType?0:1)}_getTriangleDesc(t,e){let i=this._computeDesc.get(t);if(!i){const s=e.strides,o=e.strides.geometry,a=new Map(e.attributes),r=e.bufferLayouts.geometry.map((t=>({...t}))),n=Math.max(...e.attributes.values()),v={geometry:r};v.geometry.push({count:2,name:"a_pos1",divisor:0,normalized:!1,offset:o,stride:o,type:f.SHORT}),v.geometry.push({count:2,name:"a_pos2",divisor:0,normalized:!1,offset:2*o,stride:o,type:f.SHORT}),a.set("a_pos1",n+1),a.set("a_pos2",n+2),i={bufferLayouts:v,attributes:a,strides:s},this._computeDesc.set(t,i)}return i}}export{m as default};
5
+ import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{MIN_MAX_ZOOM_PRECISION_FACTOR as i,TEXTURE_BINDING_ATTRIBUTE_DATA_0 as s,TEXTURE_BINDING_ATTRIBUTE_DATA_1 as o,TEXTURE_BINDING_ATTRIBUTE_DATA_2 as a,TEXTURE_BINDING_ATTRIBUTE_DATA_3 as r}from"../definitions.js";import n from"./WGLBrush.js";import{BlendFactor as v,CompareFunction as u,DataType as f}from"../../../../webgl/enums.js";class m extends n{constructor(){super(...arguments),this._computeDesc=new Map}prepareState({context:t},e,i){const s=i&&i.includes("hittest");t.setBlendingEnabled(!s),t.setBlendFunctionSeparate(v.ONE,v.ONE_MINUS_SRC_ALPHA,v.ONE,v.ONE_MINUS_SRC_ALPHA),t.setColorMask(!0,!0,!0,!0),t.setStencilWriteMask(0),t.setStencilTestEnabled(!0),t.setStencilFunction(u.EQUAL,e.stencilRef,255)}draw(e,i,s){const o=this.getGeometryType();i.commit(e);const a=i.getGeometry(o);t(a)||(e.timeline.begin(this.name),e.attributeView.bindTextures(e.context),a.forEachCommand((t=>this.drawGeometry(e,i,t,s))))}_setSharedUniforms(t,n,v){const{displayLevel:u,pixelRatio:f,state:m,passOptions:l}=n;e(l)&&"hittest"===l.type&&(t.setUniform2fv("u_hittestPos",l.position),t.setUniform1f("u_hittestDist",l.distance)),t.setUniform1f("u_pixelRatio",f),t.setUniformMatrix3fv("u_tileMat3",v.transforms.tileMat3),t.setUniformMatrix3fv("u_viewMat3",m.viewMat3),t.setUniformMatrix3fv("u_dvsMat3",v.transforms.dvs),t.setUniformMatrix3fv("u_displayViewMat3",m.displayViewMat3),t.setUniform1f("u_currentZoom",Math.round(u*i)),t.setUniform1i("u_attributeTextureSize",n.attributeView.size),t.setUniform1i("u_attributeData0",s),t.setUniform1i("u_attributeData1",o),t.setUniform1i("u_attributeData2",a),t.setUniform1i("u_attributeData3",r)}_setSizeVVUniforms(t,e,i,s){if(t.vvSizeMinMaxValue&&e.setUniform4fv("u_vvSizeMinMaxValue",i.vvSizeMinMaxValue),t.vvSizeScaleStops&&e.setUniform1f("u_vvSizeScaleStopsValue",i.vvSizeScaleStopsValue),t.vvSizeFieldStops){const t=i.getSizeVVFieldStops(s.key.level);e.setUniform1fv("u_vvSizeFieldStopsValues",t.values),e.setUniform1fv("u_vvSizeFieldStopsSizes",t.sizes)}t.vvSizeUnitValue&&e.setUniform1f("u_vvSizeUnitValueWorldToPixelsRatio",i.vvSizeUnitValueToPixelsRatio)}_setColorAndOpacityVVUniforms(t,e,i){t.vvColor&&(e.setUniform1fv("u_vvColorValues",i.vvColorValues),e.setUniform4fv("u_vvColors",i.vvColors)),t.vvOpacity&&(e.setUniform1fv("u_vvOpacityValues",i.vvOpacityValues),e.setUniform1fv("u_vvOpacities",i.vvOpacities))}_setRotationVVUniforms(t,e,i){t.vvRotation&&e.setUniform1f("u_vvRotationType","geographic"===i.vvMaterialParameters.vvRotationType?0:1)}_getTriangleDesc(t,e){let i=this._computeDesc.get(t);if(!i){const s=e.strides,o=e.strides.geometry,a=new Map(e.attributes),r=e.bufferLayouts.geometry.map((t=>({...t}))),n=Math.max(...e.attributes.values()),v={geometry:r};v.geometry.push({count:2,name:"a_pos1",divisor:0,normalized:!1,offset:o,stride:o,type:f.SHORT}),v.geometry.push({count:2,name:"a_pos2",divisor:0,normalized:!1,offset:2*o,stride:o,type:f.SHORT}),a.set("a_pos1",n+1),a.set("a_pos2",n+2),i={bufferLayouts:v,attributes:a,strides:s},this._computeDesc.set(t,i)}return i}}export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- const t=8,e=t-2,c=1e-30,h=64,i=4294967295,o=512,a=256,d=256/360,n=!1,p=128,r=8,s=29,f=1,g=16,l=16,m=o/p,v=8,w=50,x=10,b=24,j=8,k={metrics:{width:15,height:17,left:0,top:-7,advance:14}},q=1024,u=0,y=0,z=0,A=1,B=2,C=3,D=4,E=12,F=5,G=6,H=5,I=6,J=0,K=1,L=2,M=3,N=3,O=4,P=2,Q=1,R=2,S=4,T=!1,U=1.05,V=6,W=5,X=6,Y=1.15,Z=2,$=2,_=8,tt=500,et=4,ct=128,ht=10,it=2,ot=0,at=1,dt=4,nt=8,pt=4,rt=1;export{d as ANGLE_FACTOR_256,K as ATTRIBUTE_DATA_ANIMATION,N as ATTRIBUTE_DATA_DD0,O as ATTRIBUTE_DATA_DD1,J as ATTRIBUTE_DATA_FILTER_FLAGS,L as ATTRIBUTE_DATA_GPGPU,M as ATTRIBUTE_DATA_VV,q as ATTRIBUTE_STORE_TEXTURE_SIZE,k as AVERAGE_GLYPH_MOSAIC_ITEM,it as BITSET_GENERIC_LOCK_COLOR,pt as BITSET_LINE_SCALE_DASH,at as BITSET_MARKER_ALIGNMENT_MAP,ot as BITSET_MARKER_ALIGNMENT_SCREEN,dt as BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE,nt as BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY,rt as BITSET_TYPE_FILL_OUTLINE,ct as BUFFER_DATA_MINIMUM_SIZE,et as BUFFER_DATA_POOL_SIZE,l as COLLISION_BOX_PADDING,p as COLLISION_BUCKET_SIZE,g as COLLISION_EARLY_REJECT_BUCKET_SIZE,f as COLLISION_MAX_ZOOM_DELTA,v as COLLISION_PLACEMENT_PADDING,m as COLLISION_TILE_BOX_SIZE,n as DEBUG_LABELS,_ as DISPLAY_RECORD_INT_PER_ELEMENT,r as DOT_DENSITY_MAX_FIELDS,S as EFFECT_FLAG_0,T as ENABLE_EARLY_LABEL_DISCARD,h as EXTRUDE_SCALE,R as FILTER_FLAG_0,b as GLYPH_SIZE,x as HEURISTIC_GLYPHS_PER_FEATURE,w as HEURISTIC_GLYPHS_PER_LINE,Q as HIGHLIGHT_FLAG,V as HITTEST_SEARCH_SIZE,s as MAGIC_LABEL_LINE_HEIGHT,P as MAX_FILTERS,Z as MAX_GPU_UPLOADS_PER_FRAME,ht as MIN_MAX_ZOOM_PRECISION_FACTOR,c as NAN_MAGIC_NUMBER,tt as PATCH_PIXEL_BUFFER_ALLOC_SIZE,i as PICTURE_FILL_COLOR,a as RASTER_TILE_SIZE,$ as SPRITE_PADDING,A as TEXTURE_BINDING_ATTRIBUTE_DATA_0,B as TEXTURE_BINDING_ATTRIBUTE_DATA_1,C as TEXTURE_BINDING_ATTRIBUTE_DATA_2,D as TEXTURE_BINDING_ATTRIBUTE_DATA_3,z as TEXTURE_BINDING_BITMAP,y as TEXTURE_BINDING_GLYPH_ATLAS,E as TEXTURE_BINDING_GPGPU,F as TEXTURE_BINDING_HIGHLIGHT_0,G as TEXTURE_BINDING_HIGHLIGHT_1,H as TEXTURE_BINDING_RENDERER_0,I as TEXTURE_BINDING_RENDERER_1,u as TEXTURE_BINDING_SPRITE_ATLAS,j as TEXT_PLACEMENT_PADDING,U as THIN_LINE_HALF_WIDTH_THRESHOLD,o as TILE_SIZE,Y as VTL_HIGH_RES_CUTOFF,X as VTL_TEXTURE_BINDING_UNIT_GLYPHS,W as VTL_TEXTURE_BINDING_UNIT_SPRITES,e as WEBGL_MAX_INNER_STOPS,t as WEBGL_MAX_STOPS};
5
+ const t=8,e=t-2,c=1e-30,h=64,i=4294967295,o=512,a=256,d=256/360,n=!1,p=128,r=8,s=29,f=1,g=16,l=16,m=o/p,v=8,w=50,x=10,b=24,j=8,k={metrics:{width:15,height:17,left:0,top:-7,advance:14}},q=1024,u=0,y=0,z=0,A=1,B=2,C=3,D=4,E=12,F=5,G=6,H=5,I=6,J=0,K=1,L=2,M=3,N=3,O=4,P=2,Q=1,R=2,S=4,T=!1,U=1.05,V=3,W=5,X=6,Y=1.15,Z=2,$=2,_=8,tt=500,et=4,ct=128,ht=10,it=2,ot=0,at=1,dt=4,nt=8,pt=4,rt=1;export{d as ANGLE_FACTOR_256,K as ATTRIBUTE_DATA_ANIMATION,N as ATTRIBUTE_DATA_DD0,O as ATTRIBUTE_DATA_DD1,J as ATTRIBUTE_DATA_FILTER_FLAGS,L as ATTRIBUTE_DATA_GPGPU,M as ATTRIBUTE_DATA_VV,q as ATTRIBUTE_STORE_TEXTURE_SIZE,k as AVERAGE_GLYPH_MOSAIC_ITEM,it as BITSET_GENERIC_LOCK_COLOR,pt as BITSET_LINE_SCALE_DASH,at as BITSET_MARKER_ALIGNMENT_MAP,ot as BITSET_MARKER_ALIGNMENT_SCREEN,dt as BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE,nt as BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY,rt as BITSET_TYPE_FILL_OUTLINE,ct as BUFFER_DATA_MINIMUM_SIZE,et as BUFFER_DATA_POOL_SIZE,l as COLLISION_BOX_PADDING,p as COLLISION_BUCKET_SIZE,g as COLLISION_EARLY_REJECT_BUCKET_SIZE,f as COLLISION_MAX_ZOOM_DELTA,v as COLLISION_PLACEMENT_PADDING,m as COLLISION_TILE_BOX_SIZE,n as DEBUG_LABELS,_ as DISPLAY_RECORD_INT_PER_ELEMENT,r as DOT_DENSITY_MAX_FIELDS,S as EFFECT_FLAG_0,T as ENABLE_EARLY_LABEL_DISCARD,h as EXTRUDE_SCALE,R as FILTER_FLAG_0,b as GLYPH_SIZE,x as HEURISTIC_GLYPHS_PER_FEATURE,w as HEURISTIC_GLYPHS_PER_LINE,Q as HIGHLIGHT_FLAG,V as HITTEST_RADIUS,s as MAGIC_LABEL_LINE_HEIGHT,P as MAX_FILTERS,Z as MAX_GPU_UPLOADS_PER_FRAME,ht as MIN_MAX_ZOOM_PRECISION_FACTOR,c as NAN_MAGIC_NUMBER,tt as PATCH_PIXEL_BUFFER_ALLOC_SIZE,i as PICTURE_FILL_COLOR,a as RASTER_TILE_SIZE,$ as SPRITE_PADDING,A as TEXTURE_BINDING_ATTRIBUTE_DATA_0,B as TEXTURE_BINDING_ATTRIBUTE_DATA_1,C as TEXTURE_BINDING_ATTRIBUTE_DATA_2,D as TEXTURE_BINDING_ATTRIBUTE_DATA_3,z as TEXTURE_BINDING_BITMAP,y as TEXTURE_BINDING_GLYPH_ATLAS,E as TEXTURE_BINDING_GPGPU,F as TEXTURE_BINDING_HIGHLIGHT_0,G as TEXTURE_BINDING_HIGHLIGHT_1,H as TEXTURE_BINDING_RENDERER_0,I as TEXTURE_BINDING_RENDERER_1,u as TEXTURE_BINDING_SPRITE_ATLAS,j as TEXT_PLACEMENT_PADDING,U as THIN_LINE_HALF_WIDTH_THRESHOLD,o as TILE_SIZE,Y as VTL_HIGH_RES_CUTOFF,X as VTL_TEXTURE_BINDING_UNIT_GLYPHS,W as VTL_TEXTURE_BINDING_UNIT_SPRITES,e as WEBGL_MAX_INNER_STOPS,t as WEBGL_MAX_STOPS};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t,isNone as e}from"../../../../../core/maybe.js";import{HITTEST_SEARCH_SIZE as i,ATTRIBUTE_DATA_GPGPU as s}from"../definitions.js";import{Effect as o}from"./Effect.js";import{PixelFormat as n,PixelType as r}from"../../../../webgl/enums.js";class l extends o{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["hittest"]}dispose(){t(this._fbo)&&this._fbo.dispose()}createOptions({pixelRatio:t},e,s=i){if(!e.length)return null;const o=e.shift(),n=o.point.x,r=o.point.y;return this._outstanding=o,{type:"hittest",distance:s*t,position:[n,r]}}bind(t){const{context:i,attributeView:o}=t;if(!o.size)return;const n=o.getBlock(s);if(e(n))return;const r=n.getFBO(i);i.setViewport(0,0,o.size,o.size),i.bindFramebuffer(r),i.setColorMask(!0,!0,!0,!0),i.setClearColor(0,0,0,0),i.clear(i.gl.COLOR_BUFFER_BIT|i.gl.DEPTH_BUFFER_BIT)}unbind(t){}draw(t){const{context:i,attributeView:o}=t,l=o.getBlock(s);if(e(this._outstanding))return;const u=this._outstanding.resolver;if(e(l))return u.resolve([]),void(this._outstanding=null);const c=l.getFBO(i),h=new Uint8Array(c.width*c.height*4);c.readPixels(0,0,c.width,c.height,n.RGBA,r.UNSIGNED_BYTE,h);const a=[];for(let e=0;e<h.length;e+=4)h[e]&&a.push(e/4);this._outstanding=null,u.resolve(a)}}export{l as HittestEffect};
5
+ import{isSome as t,isNone as e}from"../../../../../core/maybe.js";import{HITTEST_RADIUS as i,ATTRIBUTE_DATA_GPGPU as s}from"../definitions.js";import{Effect as o}from"./Effect.js";import{PixelFormat as n,PixelType as r}from"../../../../webgl/enums.js";class l extends o{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["hittest"]}dispose(){t(this._fbo)&&this._fbo.dispose()}createOptions({pixelRatio:t},e,s=i){if(!e.length)return null;const o=e.shift(),n=o.point.x,r=o.point.y;return this._outstanding=o,{type:"hittest",distance:s*t,position:[n,r]}}bind(t){const{context:i,attributeView:o}=t;if(!o.size)return;const n=o.getBlock(s);if(e(n))return;const r=n.getFBO(i);i.setViewport(0,0,o.size,o.size),i.bindFramebuffer(r),i.setColorMask(!0,!0,!0,!0),i.setClearColor(0,0,0,0),i.clear(i.gl.COLOR_BUFFER_BIT|i.gl.DEPTH_BUFFER_BIT)}unbind(t){}draw(t){const{context:i,attributeView:o}=t,l=o.getBlock(s);if(e(this._outstanding))return;const u=this._outstanding.resolver;if(e(l))return u.resolve([]),void(this._outstanding=null);const c=l.getFBO(i),h=new Uint8Array(c.width*c.height*4);c.readPixels(0,0,c.width,c.height,n.RGBA,r.UNSIGNED_BYTE,h);const a=[];for(let e=0;e<h.length;e+=4)h[e]&&a.push(e/4);this._outstanding=null,u.resolve(a)}}export{l as HittestEffect};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/maybe.js";import{HITTEST_SEARCH_SIZE as e}from"../definitions.js";import{Effect as s}from"./Effect.js";import{PixelFormat as o,PixelType as r}from"../../../../webgl/enums.js";class i extends s{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["id"],this._lastSize=0}dispose(){t(this._fbo)&&this._fbo.dispose()}bind({context:t,painter:e}){const{width:s,height:o}=t.getViewport();this._boundFBO=t.getBoundFramebufferObject();const r=e.getFbos(s,o).effect0;t.bindFramebuffer(r),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(t.gl.COLOR_BUFFER_BIT)}unbind({context:t}){t.bindFramebuffer(this._boundFBO),this._boundFBO=null}draw({context:t,state:s,pixelRatio:i},n,f=e){const a=t.getBoundFramebufferObject(),h=s.size[1]*i,u=Math.round(f*i),b=u/2,c=u/2;this._ensureBuffer(u),n.forEach(((t,e)=>{const s=new Map,f=Math.floor(e.x*i-u/2),l=Math.floor(h-e.y*i-u/2);a.readPixels(f,l,u,u,o.RGBA,r.UNSIGNED_BYTE,this._buf);for(let o=0;o<this._buf32.length;o++){const t=this._buf32[o];if(4294967295!==t&&0!==t){const e=o%u,r=u-Math.floor(o/u),i=(b-e)*(b-e)+(c-r)*(c-r),n=s.has(t)?s.get(t):4294967295;s.set(t,Math.min(i,n))}}const d=Array.from(s).sort(((t,e)=>t[1]-e[1])).map((t=>t[0]));t.resolve(d),n.delete(e)}))}_ensureBuffer(t){this._lastSize!==t&&(this._lastSize=t,this._buf=new Uint8Array(4*t*t),this._buf32=new Uint32Array(this._buf.buffer))}}export{i as HittestEffectVTL};
5
+ import{isSome as t}from"../../../../../core/maybe.js";import{HITTEST_RADIUS as e}from"../definitions.js";import{Effect as s}from"./Effect.js";import{PixelFormat as o,PixelType as r}from"../../../../webgl/enums.js";class i extends s{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["id"],this._lastSize=0}dispose(){t(this._fbo)&&this._fbo.dispose()}bind({context:t,painter:e}){const{width:s,height:o}=t.getViewport();this._boundFBO=t.getBoundFramebufferObject();const r=e.getFbos(s,o).effect0;t.bindFramebuffer(r),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(t.gl.COLOR_BUFFER_BIT)}unbind({context:t}){t.bindFramebuffer(this._boundFBO),this._boundFBO=null}draw({context:t,state:s,pixelRatio:i},n,f=2*e){const a=t.getBoundFramebufferObject(),h=s.size[1]*i,u=Math.round(f*i),b=u/2,c=u/2;this._ensureBuffer(u),n.forEach(((t,e)=>{const s=new Map,f=Math.floor(e.x*i-u/2),l=Math.floor(h-e.y*i-u/2);a.readPixels(f,l,u,u,o.RGBA,r.UNSIGNED_BYTE,this._buf);for(let o=0;o<this._buf32.length;o++){const t=this._buf32[o];if(4294967295!==t&&0!==t){const e=o%u,r=u-Math.floor(o/u),i=(b-e)*(b-e)+(c-r)*(c-r),n=s.has(t)?s.get(t):4294967295;s.set(t,Math.min(i,n))}}const d=Array.from(s).sort(((t,e)=>t[1]-e[1])).map((t=>t[0]));t.resolve(d),n.delete(e)}))}_ensureBuffer(t){this._lastSize!==t&&(this._lastSize=t,this._buf=new Uint8Array(4*t*t),this._buf32=new Uint32Array(this._buf.buffer))}}export{i as HittestEffectVTL};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../../core/Error.js";import t from"../../../../../../core/Logger.js";import{isAbortError as r}from"../../../../../../core/promiseUtils.js";import{errorPointSymbolJSON as s,errorPolylineSymbolJSON as i,errorPolygonSymbolJSON as a}from"../../../../../../symbols/support/defaultsJSON.js";import{WGLGeometryType as o}from"../../enums.js";import{createMaterialKey as m}from"../../materialKey/MaterialKey.js";import l from"./WGLDynamicFillTemplate.js";import c from"./WGLDynamicLineTemplate.js";import n from"./WGLDynamicMarkerTemplate.js";import h from"./WGLDynamicTextTemplate.js";import p from"./WGLFillTemplate.js";import u from"./WGLLineTemplate.js";import _ from"./WGLMarkerTemplate.js";import f from"./WGLTextTemplate.js";import{Lock as M,withLock as T}from"../../util/Lock.js";import{ok as y}from"../../util/Result.js";import{codepoints as I}from"../../../../layers/features/textUtils.js";import{cimLayerToRasterizationInfo as d}from"../../../../layers/support/cimSymbolUtils.js";const g=t.getLogger("esri.views.2d.engine.webgl.mesh.templates.WGLTemplateStore"),S=new Array,w={isOutline:!1,isOutlinedFill:!1,placement:null,stride:{fill:"default"},vvFlags:0},k={...s,hash:JSON.stringify(s),materialKey:m(o.MARKER,w)},C={...i,hash:JSON.stringify(i),materialKey:m(o.LINE,w)},L={...a,hash:JSON.stringify(a),materialKey:m(o.FILL,w)};function b(e,t){const r=e.length;return e.push(null),t.then((t=>e[r]=t)),e}function G(e){return!!(1&e)}function E(e){return"worker:port-closed"===e.name}class j{constructor(e,t){this._idCounter=1,this._templateIdCounter=1,this._idToTemplateGroup=new Map,this._symbolToTemplate=new Map,this._fetchQueue=[],this._idToResolver=new Map,this._cimTemplateCache=new Map,this._cimAnalyses=[],this._lock=new M,this._fetchResource=e,this._tileInfo=t}get _markerError(){return this._errorTemplates.marker[0]}get _fillError(){return this._errorTemplates.fill[0]}get _lineError(){return this._errorTemplates.line[0]}get _textError(){return this._errorTemplates.line[0]}createTemplateGroup(e,t){this._initErrorTemplates();const r=e.hash;if(this._symbolToTemplate.has(r))return this._symbolToTemplate.get(r);const s=new Array;t&&this._createMeshTemplates(s,t,!0),this._createMeshTemplates(s,e,!1);const i=this._createGroupId("expanded-cim"===e.type&&x(e));return this._idToTemplateGroup.set(i,s),this._symbolToTemplate.set(r,i),i}getTemplateGroup(e){return this._idToTemplateGroup.has(e)?this._idToTemplateGroup.get(e):S}getDynamicTemplateGroup(e){return this._idToTemplateGroup.has(e)?(G(e)||g.error("mapview-template-store",`Id ${e} does not refer to a dynamic template`),this._idToTemplateGroup.get(e)):S}getMosaicItem(e,t){const r=this._createTemplateId(),s=new Promise((e=>this._idToResolver.set(r,e)));return this._fetchQueue.push({symbol:e,id:r,glyphIds:t}),s}finalize(e){return this._fetchQueue.length||this._lock.isHeld()?T(this._lock,this._fetchAllQueuedResources.bind(this),e):Promise.resolve()}_initErrorTemplates(){this._errorTemplates||(this._errorTemplates={fill:this._createMeshTemplates([],L,!1),marker:this._createMeshTemplates([],k,!1),line:this._createMeshTemplates([],C,!1)})}_fetchAllQueuedResources(t){if(!this._fetchQueue.length)return Promise.resolve();const s=this._fetchQueue,i=this._cimAnalyses;return this._fetchQueue=[],this._cimAnalyses=[],Promise.all(i).then((()=>this._fetchResource(s,t).then((e=>{for(const{id:t,mosaicItem:r}of e){this._idToResolver.get(t)(r),this._idToResolver.delete(t)}})))).catch((t=>{r(t)?this._fetchQueue=this._fetchQueue.concat(s):E(t)||g.error(new e("mapview-template-store","Unable to fetch requested texture resources",t))}))}_createGroupId(e){return this._idCounter++<<1|(e?1:0)}_createTemplateId(){return this._templateIdCounter++}async _createSMS(e){const{spriteMosaicItem:t}=await this.getMosaicItem(e);return y(t,g)?_.fromSimpleMarker(e,t):this._markerError}async _createPMS(e){const{spriteMosaicItem:t}=await this.getMosaicItem(e);return y(t,g)?_.fromPictureMarker(e,t):this._markerError}async _createSFS(e,t){const{spriteMosaicItem:r}=await this.getMosaicItem(e);return y(r,g)?p.fromSimpleFill(e,r,t):this._fillError}async _createPFS(e,t){const{spriteMosaicItem:r}=await this.getMosaicItem(e);return y(r,g)?p.fromPictureFill(e,r,t):this._fillError}async _createSLS(e,t){const{spriteMosaicItem:r}=await this.getMosaicItem(e);return y(r,g)?u.fromSimpleLine(e,r):this._lineError}async _createLMS(e){const{spriteMosaicItem:t}=await this.getMosaicItem(e);return y(t,g)?_.fromLineSymbolMarker(e,t):this._markerError}async _createTS(e){const{glyphMosaicItems:t}=await this.getMosaicItem(e);return f.fromText(e,t)}async _createCIMText(e){const{glyphMosaicItems:t}=await this.getMosaicItem(d(e),I(e.text));return y(t,g)?f.fromCIMText(e,t,this._tileInfo):this._textError}async _createCIMFill(e){const{spriteMosaicItem:t}=await this.getMosaicItem(d(e));return y(t,g)?p.fromCIMFill(e,t,this._tileInfo):this._fillError}async _createCIMLine(e){const{spriteMosaicItem:t}=await this.getMosaicItem(d(e));return y(t,g)?u.fromCIMLine(e,t,this._tileInfo):this._lineError}async _createCIMMarker(e){const{spriteMosaicItem:t}=await this.getMosaicItem(d(e));return y(t,g)?_.fromCIMMarker(e,t,this._tileInfo):this._markerError}async _createCIM(e){const t=e.templateHash;if(this._cimTemplateCache.has(t))return this._cimTemplateCache.get(t);let r;switch(e.type){case"marker":r=await this._createCIMMarker(e);break;case"line":r=await this._createCIMLine(e);break;case"fill":r=await this._createCIMFill(e);break;case"text":r=await this._createCIMText(e)}return this._cimTemplateCache.set(t,r),r}async _createDynamicCIM(e){const t=e.templateHash;if(this._cimTemplateCache.has(t))return this._cimTemplateCache.get(t);let r;switch(e.type){case"marker":r=n.fromCIMMarker(e,this._tileInfo);break;case"line":r=c.fromCIMLine(e,this._tileInfo);break;case"fill":r=l.fromCIMFill(e,this._tileInfo);break;case"text":r=h.fromCIMText(e,this._tileInfo)}return this._cimTemplateCache.set(t,r),r}_createPrimitiveMeshTemplates(e,t,r){switch(t.type){case"esriSMS":return b(e,this._createSMS(t));case"esriPMS":return b(e,this._createPMS(t));case"esriSFS":return b(e,this._createSFS(t,r));case"line-marker":return b(e,this._createLMS(t));case"esriPFS":return b(e,this._createPFS(t,r));case"esriSLS":return b(e,this._createSLS(t,!1));case"esriTS":return b(e,this._createTS(t));default:return g.error("Unable to create mesh template for unknown symbol type {: $ }{symbol.type}"),e}}_createMeshTemplates(e,t,r){if(-1!==t.type.indexOf("3d"))return g.error("3D symbols are not supported with MapView"),e;if("expanded-cim"===t.type){for(const r of t.layers)"function"==typeof r.materialHash?b(e,this._createDynamicCIM(r)):b(e,this._createCIM(r));return e}if("composite-symbol"===t.type){for(const s of t.layers)this._createPrimitiveMeshTemplates(e,s,r);return e}return"cim"===t.type||"label"===t.type||"web-style"===t.type?e:this._createPrimitiveMeshTemplates(e,t,r)}}const x=e=>{if(!e.layers)return!1;for(const t of e.layers)if("function"==typeof t.materialHash)return!0;return!1};export{j as WGLTemplateStore,k as errorPointSchema2D,L as errorPolygonSchema2D,C as errorPolylineSchema2D,G as isDynamicId};
5
+ import e from"../../../../../../core/Error.js";import t from"../../../../../../core/Logger.js";import{isAbortError as r}from"../../../../../../core/promiseUtils.js";import{errorPointSymbolJSON as s,errorPolylineSymbolJSON as i,errorPolygonSymbolJSON as a}from"../../../../../../symbols/support/defaultsJSON.js";import{WGLGeometryType as o}from"../../enums.js";import{createMaterialKey as m}from"../../materialKey/MaterialKey.js";import l from"./WGLDynamicFillTemplate.js";import c from"./WGLDynamicLineTemplate.js";import n from"./WGLDynamicMarkerTemplate.js";import h from"./WGLDynamicTextTemplate.js";import p from"./WGLFillTemplate.js";import u from"./WGLLineTemplate.js";import _ from"./WGLMarkerTemplate.js";import f from"./WGLTextTemplate.js";import{Lock as M,withLock as T}from"../../util/Lock.js";import{ok as y}from"../../util/Result.js";import{codepoints as I}from"../../../../layers/features/textUtils.js";import{cimLayerToRasterizationInfo as d}from"../../../../layers/support/cimSymbolUtils.js";const g=t.getLogger("esri.views.2d.engine.webgl.mesh.templates.WGLTemplateStore"),S=new Array,w={isOutline:!1,isOutlinedFill:!1,placement:null,stride:{fill:"default"},vvFlags:0},k={...s,hash:JSON.stringify(s),materialKey:m(o.MARKER,w)},C={...i,hash:JSON.stringify(i),materialKey:m(o.LINE,w)},L={...a,hash:JSON.stringify(a),materialKey:m(o.FILL,w)};function b(e,t){const r=e.length;return e.push(null),t.then((t=>e[r]=t)),e}function G(e){return!!(1&e)}function E(e){return"worker:port-closed"===e.name}class j{constructor(e,t){this._idCounter=1,this._templateIdCounter=1,this._idToTemplateGroup=new Map,this._symbolToTemplate=new Map,this._fetchQueue=[],this._idToResolver=new Map,this._cimTemplateCache=new Map,this._cimAnalyses=[],this._lock=new M,this._fetchResource=e,this._tileInfo=t}get _markerError(){return this._errorTemplates.marker[0]}get _fillError(){return this._errorTemplates.fill[0]}get _lineError(){return this._errorTemplates.line[0]}get _textError(){return this._errorTemplates.line[0]}createTemplateGroup(e,t){this._initErrorTemplates();const r=e.hash;if(this._symbolToTemplate.has(r))return this._symbolToTemplate.get(r);const s=new Array;t&&this._createMeshTemplates(s,t,!0),this._createMeshTemplates(s,e,!1);const i=this._createGroupId("expanded-cim"===e.type&&x(e));return this._idToTemplateGroup.set(i,s),this._symbolToTemplate.set(r,i),i}getTemplateGroup(e){return this._idToTemplateGroup.has(e)?this._idToTemplateGroup.get(e):S}getDynamicTemplateGroup(e){return this._idToTemplateGroup.has(e)?(G(e)||g.error("mapview-template-store",`Id ${e} does not refer to a dynamic template`),this._idToTemplateGroup.get(e)):S}getMosaicItem(e,t){const r=this._createTemplateId(),s=new Promise((e=>this._idToResolver.set(r,e)));return this._fetchQueue.push({symbol:e,id:r,glyphIds:t}),s}finalize(e){return this._fetchQueue.length||this._lock.isHeld()?T(this._lock,this._fetchAllQueuedResources.bind(this),e):Promise.resolve()}_initErrorTemplates(){this._errorTemplates||(this._errorTemplates={fill:this._createMeshTemplates([],L,!1),marker:this._createMeshTemplates([],k,!1),line:this._createMeshTemplates([],C,!1)})}_fetchAllQueuedResources(t){if(!this._fetchQueue.length)return Promise.resolve();const s=this._fetchQueue,i=this._cimAnalyses;return this._fetchQueue=[],this._cimAnalyses=[],Promise.all(i).then((()=>this._fetchResource(s,t).then((e=>{for(const{id:t,mosaicItem:r}of e){this._idToResolver.get(t)(r),this._idToResolver.delete(t)}})))).catch((t=>{r(t)?this._fetchQueue=this._fetchQueue.concat(s):E(t)||g.error(new e("mapview-template-store","Unable to fetch requested texture resources",t))}))}_createGroupId(e){return this._idCounter++<<1|(e?1:0)}_createTemplateId(){return this._templateIdCounter++}async _createSMS(e){const{spriteMosaicItem:t}=await this.getMosaicItem(e);return y(t,g)?_.fromSimpleMarker(e,t):this._markerError}async _createPMS(e){const{spriteMosaicItem:t}=await this.getMosaicItem(e);return y(t,g)?_.fromPictureMarker(e,t):this._markerError}async _createSFS(e,t){const{spriteMosaicItem:r}=await this.getMosaicItem(e);return y(r,g)?p.fromSimpleFill(e,r,t):this._fillError}async _createPFS(e,t){const{spriteMosaicItem:r}=await this.getMosaicItem(e);return y(r,g)?p.fromPictureFill(e,r,t):this._fillError}async _createSLS(e,t){const{spriteMosaicItem:r}=await this.getMosaicItem(e);return y(r,g)?u.fromSimpleLine(e,r):this._lineError}async _createLMS(e){const{spriteMosaicItem:t}=await this.getMosaicItem(e);return y(t,g)?_.fromLineSymbolMarker(e,t):this._markerError}async _createTS(e){const{glyphMosaicItems:t}=await this.getMosaicItem(e);return f.fromText(e,t)}async _createCIMText(e){const{glyphMosaicItems:t}=await this.getMosaicItem(d(e),I(e.text));return y(t,g)?f.fromCIMText(e,t,this._tileInfo):this._textError}async _createCIMFill(e){const{spriteMosaicItem:t}=await this.getMosaicItem(d(e));return y(t,g)?p.fromCIMFill(e,t,this._tileInfo):this._fillError}async _createCIMLine(e){const{spriteMosaicItem:t}=await this.getMosaicItem(d(e));return y(t,g)?u.fromCIMLine(e,t,this._tileInfo):this._lineError}async _createCIMMarker(e){const{spriteMosaicItem:t}=await this.getMosaicItem(d(e));return y(t,g)?_.fromCIMMarker(e,t,this._tileInfo):this._markerError}async _createCIM(e){const t=e.templateHash;if(this._cimTemplateCache.has(t))return this._cimTemplateCache.get(t);let r;switch(e.type){case"marker":r=await this._createCIMMarker(e);break;case"line":r=await this._createCIMLine(e);break;case"fill":r=await this._createCIMFill(e);break;case"text":r=await this._createCIMText(e)}return this._cimTemplateCache.set(t,r),r}async _createDynamicCIM(e){const t=e.templateHash;if(this._cimTemplateCache.has(t))return this._cimTemplateCache.get(t);let r;switch(e.type){case"marker":r=n.fromCIMMarker(e,this._tileInfo);break;case"line":r=c.fromCIMLine(e,this._tileInfo);break;case"fill":r=l.fromCIMFill(e,this._tileInfo);break;case"text":r=h.fromCIMText(e,this._tileInfo)}return this._cimTemplateCache.set(t,r),r}_createPrimitiveMeshTemplates(e,t,r){switch(t.type){case"esriSMS":return b(e,this._createSMS(t));case"esriPMS":return b(e,this._createPMS(t));case"esriSFS":return b(e,this._createSFS(t,r));case"line-marker":return b(e,this._createLMS(t));case"esriPFS":return b(e,this._createPFS(t,r));case"esriSLS":return b(e,this._createSLS(t,!1));case"esriTS":return b(e,this._createTS(t));default:return g.error("Unable to create mesh template for unknown symbol type {: $ }{symbol.type}"),e}}_createMeshTemplates(e,t,r){if(t.type.includes("3d"))return g.error("3D symbols are not supported with MapView"),e;if("expanded-cim"===t.type){for(const r of t.layers)"function"==typeof r.materialHash?b(e,this._createDynamicCIM(r)):b(e,this._createCIM(r));return e}if("composite-symbol"===t.type){for(const s of t.layers)this._createPrimitiveMeshTemplates(e,s,r);return e}return"cim"===t.type||"label"===t.type||"web-style"===t.type?e:this._createPrimitiveMeshTemplates(e,t,r)}}const x=e=>{if(!e.layers)return!1;for(const t of e.layers)if("function"==typeof t.materialHash)return!0;return!1};export{j as WGLTemplateStore,k as errorPointSchema2D,L as errorPolygonSchema2D,C as errorPolylineSchema2D,G as isDynamicId};