@arcgis/core 4.34.0-next.33 → 4.34.0-next.35

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 (254) hide show
  1. package/Graphic.js +1 -1
  2. package/arcade/ArcadeDate.js +1 -1
  3. package/arcade/ArcadeModuleResolver.js +1 -1
  4. package/arcade/featureset/actions/GroupBy.js +1 -1
  5. package/arcade/functions/date.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/{28e04ef3575f164f611a.js → 00870a35b254295bc408.js} +1 -1
  8. package/assets/esri/core/workers/chunks/017adbbb77c9c9b4d49f.js +1 -0
  9. package/assets/esri/core/workers/chunks/{c6edf028dd04d47d7580.js → 087ae1e3e767f0e678e5.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{b4b30a7f1b673461dc55.js → 0997e09fe5b0aba1f804.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{341507901f3858559c82.js → 125fdea50620d4db2678.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{9bc6d974b0fce9db64ef.js → 15a5a89cd228a9364332.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{847455bf4fc33d6e6efc.js → 1dc410bc070cabb7198d.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{971b16677b66c16fb6b9.js → 20aed6e1d9b6bf06a398.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{94a3474e3f45efa4a4fe.js → 2c816d3a737e39e6eb84.js} +1 -1
  16. package/assets/esri/core/workers/chunks/2de11a8e5d426c381991.js +1 -0
  17. package/assets/esri/core/workers/chunks/{fb71e533995c54cd806f.js → 319fe6a02ec630a827ea.js} +1 -1
  18. package/assets/esri/core/workers/chunks/3a7e43675163f7bed6ac.js +1 -0
  19. package/assets/esri/core/workers/chunks/{1aa6719be3afbdc7c880.js → 3cd1ab26396052f17832.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{359c282fd67148fda5fa.js → 3d5954478864a975e65e.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{2fdf457786d2d5d7414f.js → 3eb792863a789b97ec58.js} +1 -1
  22. package/assets/esri/core/workers/chunks/40b0c5368b8322498189.js +1 -0
  23. package/assets/esri/core/workers/chunks/{89999baefa341bd3329c.js → 4193691ca076948f4f90.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4778acd0cfaf0cebeec7.js → 439128f23fa091633d2d.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{057df92b981c9b311d68.js → 43fba9d6be5971ec20a9.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{74f3bc6c6b82de49d6ee.js → 4ac6bf9ff1cfbde87c7b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{0b3a200b97d790d08248.js → 4b9003ddfe61dc3729f4.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{5192f38682f1f9be7da0.js → 549e073fe276363a9896.js} +1 -1
  29. package/assets/esri/core/workers/chunks/6000a302369799ea42a6.js +1 -0
  30. package/assets/esri/core/workers/chunks/{5d0c92aaa5891e6cb8f0.js → 641ca71d7c1a07bde66a.js} +1 -1
  31. package/assets/esri/core/workers/chunks/646227b500b92999f2c8.js +1 -0
  32. package/assets/esri/core/workers/chunks/{50b0d96e1a5ccffeb803.js → 64fab4e1e28c06c83403.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{d3cb21cdc5b9483dd1f4.js → 69ae235423f0b1bdfcb4.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{3323646096474740fed5.js → 6c72e2c09ed62cb2fd79.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{63cb3dcd359e96733b1b.js → 6ce2f86b9b1d2f2b8675.js} +1 -1
  36. package/assets/esri/core/workers/chunks/752eabfbed7b8b65cf3f.js +1 -0
  37. package/assets/esri/core/workers/chunks/{98f6d4ea026ed96fd3f3.js → 773feb0e0fad26df57ef.js} +1 -1
  38. package/assets/esri/core/workers/chunks/7b1d14a921d30c95d68b.js +1 -0
  39. package/assets/esri/core/workers/chunks/{b78d00c4e493086741e1.js → 7d25f57299c642e727a6.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{3a0da512562ba492609d.js → 827bebb4bcdde23adc91.js} +1 -1
  41. package/assets/esri/core/workers/chunks/8b7f6f2d1692b6b6dbd5.js +1 -0
  42. package/assets/esri/core/workers/chunks/{9152d62c55d3396763bd.js → 8be81e1530b952c97936.js} +1 -1
  43. package/assets/esri/core/workers/chunks/90a0c1c5c851cc9b6d6d.js +1 -0
  44. package/assets/esri/core/workers/chunks/91d48c32bf11ad1405c8.js +1 -0
  45. package/assets/esri/core/workers/chunks/9228f760129e48585b54.js +1 -0
  46. package/assets/esri/core/workers/chunks/9a54c96b48e94d816881.js +1 -0
  47. package/assets/esri/core/workers/chunks/a36be186ad10200c420c.js +1 -0
  48. package/assets/esri/core/workers/chunks/{c18167a0790241f80bf7.js → a6767d75e718f2e1e714.js} +1 -1
  49. package/assets/esri/core/workers/chunks/aa12ba96fb8c91105473.js +1 -0
  50. package/assets/esri/core/workers/chunks/{ea240d9e594bfbd8af68.js → aaf696a1026de569c82d.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{b1ef40ef898a8c7f43a2.js → acb95ae6203f708d71b4.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{22f38cad0213f2112394.js → b1982490762972ae023d.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{bc0f5477b4491ab48b3a.js → b28855db6a30d4d4f348.js} +1 -1
  54. package/assets/esri/core/workers/chunks/b331543767c35e5edcc6.js +1 -0
  55. package/assets/esri/core/workers/chunks/{6ccd6171d3c572883034.js → b877142a275188a16e17.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{7d852617e91b51121ea7.js → ba29c535128c4e8ae2d3.js} +1 -1
  57. package/assets/esri/core/workers/chunks/bf60d4da0dff1e14da8e.js +1 -0
  58. package/assets/esri/core/workers/chunks/{39bff604d4b4a1295038.js → c038472cb7f60af9426e.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{ca46f78aac1133d127fa.js → c1e5e2a6e7e2d7a1d63c.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{1c3578d5e956a4587973.js → c30adbead0ba4722acf9.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{0260b33daf48fc207880.js → c9b11c7170c99f9e0e93.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{a809042fdce7ced2a415.js → cc3ca1729af33688c1e3.js} +1 -1
  63. package/assets/esri/core/workers/chunks/cde79c3644166d4798a8.js +1 -0
  64. package/assets/esri/core/workers/chunks/{181f8bbe670b4468307a.js → ce8f0ed9179c0d314df8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{58393ab52d0b8f718241.js → d3fd11da3a823e148957.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{ac30cf2f9a94597f7665.js → d6b2ab614f308db50c4a.js} +2 -2
  67. package/assets/esri/core/workers/chunks/{41d36b87e3dfc01be38d.js → d7b3e81cc313fd0a33b0.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{abe2cdfc2eda46b00812.js → d9045b964f536695840b.js} +1 -1
  69. package/assets/esri/core/workers/chunks/dde6000aa2f69f6ecad0.js +1 -0
  70. package/assets/esri/core/workers/chunks/dec9656997683ef01ba6.js +1 -0
  71. package/assets/esri/core/workers/chunks/{1e20e43d1dc5273708c7.js → e1472dbf0795d737d6f8.js} +1 -1
  72. package/assets/esri/core/workers/chunks/e18bb372457cedbf4f8c.js +1 -0
  73. package/assets/esri/core/workers/chunks/e892ed8b0b990d7eba28.js +1 -0
  74. package/assets/esri/core/workers/chunks/{dc5a8cf2a44a5ac201c5.js → ed05399f9a07fea66685.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{300a5257969d3835ceeb.js → f19426eb53d8430ded51.js} +1 -1
  76. package/assets/esri/core/workers/chunks/f3358b19af0f03f16543.js +1 -0
  77. package/assets/esri/core/workers/chunks/{1b5923dfd70d464dfb25.js → f4c38a9c01c29b5a6244.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{c854c3bb4440fd942c12.js → f6c1854f36b029fa6c37.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{039979cbf35a241ed0a4.js → fdc8300b6374ef2b8b3e.js} +1 -1
  80. package/chunks/Distance2DCalculator-CXhBP-8I.js +1 -1
  81. package/chunks/OperatorCrosses.js +1 -1
  82. package/chunks/OperatorGeodesicBuffer.js +1 -1
  83. package/chunks/OperatorIntersects.js +1 -1
  84. package/chunks/OperatorOverlaps.js +1 -1
  85. package/chunks/OperatorProximity.js +1 -1
  86. package/chunks/OperatorShapePreservingLength.js +1 -1
  87. package/chunks/OperatorShapePreservingProject.js +1 -1
  88. package/chunks/OperatorTouches.js +1 -1
  89. package/chunks/OperatorWithin.js +1 -1
  90. package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
  91. package/chunks/UnitFactory.js +1 -1
  92. package/chunks/equalsOperator.js +1 -1
  93. package/config.js +1 -1
  94. package/core/BidiEngine.js +1 -1
  95. package/core/Clonable.js +1 -1
  96. package/core/Promise.js +1 -1
  97. package/core/promiseUtils.js +1 -1
  98. package/core/sql/SqlInterval.js +1 -1
  99. package/core/sql/sqlDateParsingUtils.js +1 -1
  100. package/core/unitUtils.js +1 -1
  101. package/geometry/operators/gx/operatorDifference.js +1 -1
  102. package/geometry/operators/gx/operatorIntersection.js +1 -1
  103. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  104. package/geometry/support/coordinateSystem.js +1 -1
  105. package/graphic/BuildingGraphicOrigin.d.ts +4 -0
  106. package/graphic/BuildingGraphicOrigin.js +5 -0
  107. package/graphic/CSVGraphicOrigin.d.ts +4 -0
  108. package/graphic/CSVGraphicOrigin.js +5 -0
  109. package/graphic/CatalogGraphicOrigin.d.ts +4 -0
  110. package/graphic/CatalogGraphicOrigin.js +5 -0
  111. package/graphic/FeatureGraphicOrigin.d.ts +4 -0
  112. package/graphic/FeatureGraphicOrigin.js +5 -0
  113. package/graphic/GeoJSONGraphicOrigin.d.ts +4 -0
  114. package/graphic/GeoJSONGraphicOrigin.js +5 -0
  115. package/graphic/GraphicOrigin.d.ts +4 -0
  116. package/graphic/GraphicOrigin.js +5 -0
  117. package/graphic/IntegratedMesh3DTilesGraphicOrigin.d.ts +4 -0
  118. package/graphic/IntegratedMesh3DTilesGraphicOrigin.js +5 -0
  119. package/graphic/IntegratedMeshGraphicOrigin.d.ts +4 -0
  120. package/graphic/IntegratedMeshGraphicOrigin.js +5 -0
  121. package/graphic/OGCFeatureGraphicOrigin.d.ts +4 -0
  122. package/graphic/OGCFeatureGraphicOrigin.js +5 -0
  123. package/graphic/PointCloudGraphicOrigin.d.ts +4 -0
  124. package/graphic/PointCloudGraphicOrigin.js +5 -0
  125. package/graphic/SceneGraphicOrigin.d.ts +4 -0
  126. package/graphic/SceneGraphicOrigin.js +5 -0
  127. package/graphic/StreamGraphicOrigin.d.ts +4 -0
  128. package/graphic/StreamGraphicOrigin.js +5 -0
  129. package/graphic/VectorTileGraphicOrigin.d.ts +4 -0
  130. package/graphic/VectorTileGraphicOrigin.js +5 -0
  131. package/graphic/VoxelGraphicOrigin.d.ts +4 -0
  132. package/graphic/VoxelGraphicOrigin.js +5 -0
  133. package/graphic/WFSGraphicOrigin.d.ts +4 -0
  134. package/graphic/WFSGraphicOrigin.js +5 -0
  135. package/graphic/graphicOriginUtils.js +5 -0
  136. package/graphic/graphicOrigins.d.ts +14 -0
  137. package/graphic/graphicOrigins.js +5 -0
  138. package/graphic/isBuildingGraphicOrigin.js +5 -0
  139. package/graphic/isCSVGraphicOrigin.js +5 -0
  140. package/graphic/isCatalogGraphicOrigin.js +5 -0
  141. package/graphic/isFeatureGraphicOrigin.js +5 -0
  142. package/graphic/isGeoJSONGraphicOrigin.js +5 -0
  143. package/graphic/isIntegratedMesh3DTilesGraphicOrigin.js +5 -0
  144. package/graphic/isIntegratedMeshGraphicOrigin.js +5 -0
  145. package/graphic/isOGCFeatureGraphicOrigin.js +5 -0
  146. package/graphic/isPointCloudGraphicOrigin.js +5 -0
  147. package/graphic/isSceneGraphicOrigin.js +5 -0
  148. package/graphic/isStreamGraphicOrigin.js +5 -0
  149. package/graphic/isVectorTileGraphicOrigin.js +5 -0
  150. package/graphic/isVoxelGraphicOrigin.js +5 -0
  151. package/graphic/isWFSGraphicOrigin.js +5 -0
  152. package/interfaces.d.ts +354 -13
  153. package/kernel.js +1 -1
  154. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  155. package/layers/support/Field.js +1 -1
  156. package/layers/support/featurePopupQueryUtils.js +1 -1
  157. package/layers/voxel/NCTimeParser.js +1 -1
  158. package/package.json +3 -3
  159. package/rest/knowledgeGraphService.js +1 -1
  160. package/smartMapping/statistics/support/utils.js +1 -1
  161. package/support/arcadeExpressionUtils.js +1 -1
  162. package/support/revision.js +1 -1
  163. package/symbols/support/svgUtils.js +1 -1
  164. package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
  165. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  166. package/views/2d/engine/webgl/Painter.js +1 -1
  167. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  168. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  169. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  170. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  171. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  172. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  173. package/views/2d/layers/TileLayerView2D.js +1 -1
  174. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  175. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  176. package/views/3d/analysis/Slice/SliceController.js +1 -1
  177. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  178. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementComputation.js +5 -0
  179. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
  180. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  181. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  182. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  183. package/views/3d/layers/CSVLayerView3D.js +1 -1
  184. package/views/3d/layers/CatalogFootprintLayerView3D.js +1 -1
  185. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  186. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  187. package/views/3d/layers/FlowSubView3D.js +1 -1
  188. package/views/3d/layers/GeoJSONLayerView3D.js +1 -1
  189. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  190. package/views/3d/layers/GraphicsView3D.js +1 -1
  191. package/views/3d/layers/I3SMeshView3D.js +1 -1
  192. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  193. package/views/3d/layers/MediaLayerView3D.js +1 -1
  194. package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
  195. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  196. package/views/3d/layers/RouteLayerView3D.js +1 -1
  197. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  198. package/views/3d/layers/SceneLayerView3D.js +1 -1
  199. package/views/3d/layers/StreamLayerView3D.js +1 -1
  200. package/views/3d/layers/WFSLayerView3D.js +1 -1
  201. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  202. package/views/3d/layers/graphics/StreamController.js +1 -1
  203. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  204. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  205. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  206. package/views/3d/layers/support/FeatureTileDescriptor.js +1 -1
  207. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  208. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  209. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  210. package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
  211. package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
  212. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  213. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  214. package/views/3d/state/ConstraintsManager.js +1 -1
  215. package/views/3d/support/flow/geometryUtils.js +1 -1
  216. package/views/3d/terrain/OverlayManager.js +1 -1
  217. package/views/3d/terrain/TerrainSurface.js +1 -1
  218. package/views/3d/terrain/Tile.js +1 -1
  219. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  220. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  221. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  222. package/views/SceneView.js +1 -1
  223. package/views/interactive/Tooltip.js +1 -1
  224. package/views/layers/FeatureLayerView.js +1 -1
  225. package/views/layers/support/popupUtils.js +1 -1
  226. package/views/support/Scheduler.js +1 -1
  227. package/views/support/highlightOptionsUtils.js +1 -1
  228. package/views/webgl/FramebufferObject.js +1 -1
  229. package/views/webgl/RenderbufferDescriptor.js +1 -1
  230. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  231. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  232. package/assets/esri/core/workers/chunks/07b2cc0f6b064277632f.js +0 -1
  233. package/assets/esri/core/workers/chunks/0fc620d6d0c4ac282d72.js +0 -1
  234. package/assets/esri/core/workers/chunks/0fe32bdf2055bcd1e928.js +0 -1
  235. package/assets/esri/core/workers/chunks/13f9e92e7e5d44d9f95c.js +0 -1
  236. package/assets/esri/core/workers/chunks/140efe4735605258ecc9.js +0 -1
  237. package/assets/esri/core/workers/chunks/23eae849ee0ca7b3fd81.js +0 -1
  238. package/assets/esri/core/workers/chunks/2b76e716f478468b6798.js +0 -1
  239. package/assets/esri/core/workers/chunks/386ab72a45102c2d47f2.js +0 -1
  240. package/assets/esri/core/workers/chunks/3fb6146d914f9b410c2e.js +0 -1
  241. package/assets/esri/core/workers/chunks/432365fcd7becd508541.js +0 -1
  242. package/assets/esri/core/workers/chunks/439ce953a25b2776cb7f.js +0 -1
  243. package/assets/esri/core/workers/chunks/4c8d2334fcdb1354ff43.js +0 -1
  244. package/assets/esri/core/workers/chunks/5f321be63ed5447b04a1.js +0 -1
  245. package/assets/esri/core/workers/chunks/6006fbdb90c3bfc493a6.js +0 -1
  246. package/assets/esri/core/workers/chunks/7c35c61e3673cf94cdfd.js +0 -1
  247. package/assets/esri/core/workers/chunks/7c75876a0c6460585055.js +0 -1
  248. package/assets/esri/core/workers/chunks/949dc266ac6f3505d357.js +0 -1
  249. package/assets/esri/core/workers/chunks/99e3f7b3ea0bfe9b8d34.js +0 -1
  250. package/assets/esri/core/workers/chunks/a84af1b8b64b86b49bd3.js +0 -1
  251. package/assets/esri/core/workers/chunks/a9d83a442d8d7a376fc0.js +0 -1
  252. package/assets/esri/core/workers/chunks/ba1b21a90b257ac9a342.js +0 -1
  253. package/assets/esri/core/workers/chunks/c50c2f014e8567870686.js +0 -1
  254. package/assets/esri/core/workers/chunks/f9ad37dfbe1d14c6a352.js +0 -1
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1934],{563:(t,e,s)=>{s.d(e,{QueueProcessor:()=>l});var i=s(97768),r=s(74887),n=s(9775),o=s(32587),a=s(11932),h=s(44794);class c{constructor(t,e){this.item=t,this.controller=e,this.promise=null}}class l{constructor(t){this._schedule=null,this._deferreds=new o.A,this._controllers=new o.A,this._processingItems=new o.A,this._pausedSignal=(0,h.v)(!1),this.concurrency=1,t.concurrency&&(this.concurrency=t.concurrency),this._queue=new n.A(t.peeker),this.process=t.process}destroy(){this.clear(),this._schedule=(0,i.xt)(this._schedule)}get updating(){return this.running}get length(){return this._processingItems.size+this._queue.length}get running(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}abort(t){const e=this._controllers.get(t);e&&e.abort()}clear(){this._queue.clear();const t=[];this._controllers.forEach(e=>t.push(e)),this._controllers.clear(),t.forEach(t=>t.abort()),this._processingItems.clear(),this._cancelNext()}forEach(t){this._deferreds.forEach((e,s)=>t(s))}get(t){const e=this._deferreds.get(t);return e?e.promise:void 0}isOngoing(t){return this._processingItems.has(t)}has(t){return this._deferreds.has(t)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(t,e){const s=this.get(t);if(s)return s;const i=new AbortController;let n=null;e&&(n=(0,r.u7)(e,()=>i.abort()));const o=()=>{a.remove(),null!=n&&n.remove(),this._removeItem(t),this._queue.remove(t),this._scheduleNext()},a=(0,r.NY)(i.signal,()=>{const e=this._processingItems.get(t);e&&e.controller.abort(),o(),h.reject((0,r.NK)())}),h=(0,r.Tw)();return this._deferreds.set(t,h),this._controllers.set(t,i),h.promise.then(o,o),this._queue.push(t),this._scheduleNext(),h.promise}last(){return this._queue.last()}lastPromise(){const t=this.last();return t?this.get(t):null}peek(){return this._queue.peek()}popLast(){const t=this._queue.popLast();return t&&(this._deferreds.get(t)?.reject((0,r.NK)()),this._removeItem(t)),t}reset(){const t=Array.from(this._processingItems.values());this._processingItems.clear();for(const e of t)this._queue.push(e.item),e.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const t=[];for(;this._queue.length;)t.push(this._queue.pop());return this.clear(),t}_removeItem(t){this._deferreds.delete(t),this._controllers.delete(t),this._processingItems.delete(t)}_scheduleNext(){this._pausedSignal.value||this._schedule||(this._schedule=(0,a._)(()=>{this._schedule=null,this._next()}))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).resolve(e))}_processError(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).reject(e))}_canProcessFulfillment(t){return!!this._deferreds.get(t.item)&&this._processingItems.get(t.item)===t}_process(t){if(null==t)return;let e;const s=new AbortController,i=new c(t,s);this._processingItems.set(t,i);try{e=this.process(t,s.signal)}catch(t){this._processError(i,t)}(0,r.$X)(e)?(i.promise=e,e.then(t=>this._processResult(i,t),t=>this._processError(i,t))):this._processResult(i,e)}}},2733:(t,e,s)=>{s.r(e),s.d(e,{default:()=>Nl});var i=s(49186),r=s(36563),n=s(44208),o=s(26390),a=s(74887),h=s(87811),c=s(36708),l=s(90629),u=s(8341),d=s(87045),_=s(76213);class p{constructor(t){this._client=t,this.layerView=this._client.createInvokeProxy(""),this.container=this._client.createInvokeProxy("container"),this._eventLog=this._client.createInvokeProxy("eventLog")}onEvent(t){(0,u.oV)(this._eventLog.onEvent(t))}}var f=s(97768),m=s(93637),g=s(6797),y=s(16930),x=s(21325),b=s(44159);function w(t,e){return[t,e]}function v(t,e,s){return t[0]=e,t[1]=s,t}const I=new b.A("0/0/0/0");class S{static create(t,e,s=null){const i=(0,x.Vp)(t.spatialReference),r=e.origin||w(t.origin.x,t.origin.y),n=w(t.size[0]*e.resolution,t.size[1]*e.resolution),o=w(-1/0,-1/0),a=w(1/0,1/0),h=w(1/0,1/0);null!=s&&(v(o,Math.max(0,Math.floor((s.xmin-r[0])/n[0])),Math.max(0,Math.floor((r[1]-s.ymax)/n[1]))),v(a,Math.max(0,Math.floor((s.xmax-r[0])/n[0])),Math.max(0,Math.floor((r[1]-s.ymin)/n[1]))),v(h,a[0]-o[0]+1,a[1]-o[1]+1));const{cols:c,rows:l}=e;let u,d,_,p;return!s&&c&&l&&(v(o,c[0],l[0]),v(a,c[1],l[1]),v(h,c[1]-c[0]+1,l[1]-l[0]+1)),t.isWrappable?(u=w(Math.ceil(Math.round((i.valid[1]-i.valid[0])/e.resolution)/t.size[0]),h[1]),d=!0,_=i.origin,p=i.valid):(u=h,d=!1),new S(e.level,e.resolution,e.scale,r,o,a,h,n,u,d,_,p)}constructor(t,e,s,i,r,n,o,a,h,c,l,u){this.level=t,this.resolution=e,this.scale=s,this.origin=i,this.first=r,this.last=n,this.size=o,this.norm=a,this.worldSize=h,this.wrap=c,this._spatialReferenceOrigin=l,this._spatialReferenceValid=u}normalizeCol(t){if(!this.wrap)return t;const e=this.worldSize[0];return t<0?e-1-Math.abs((t+1)%e):t%e}normalizeKey(t){if(!this.wrap)return;const e=this.worldSize[0],s=t.col;s<0?(t.col=s+e,t.world-=1):s>=e&&(t.col=s-e,t.world+=1)}denormalizeCol(t,e){return this.wrap?this.worldSize[0]*e+t:t}getWorldForColumn(t){return this.wrap?Math.floor(t/this.worldSize[0]):0}getFirstColumnForWorld(t){return t*this.worldSize[0]+this.first[0]}getLastColumnForWorld(t){return t*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(t){return(t-this.origin[0])/this.norm[0]}getXForColumn(t){const e=this.origin[0]+t*this.norm[0],s=this._spatialReferenceOrigin,i=this._spatialReferenceValid;return this.wrap&&s&&i?e===s[0]?i[0]:this.origin[0]===s[0]&&t===this.worldSize[0]?i[1]:e:e}getRowForY(t){return(this.origin[1]-t)/this.norm[1]}getYForRow(t){return this.origin[1]-t*this.norm[1]}getTileBounds(t,e,s=!1){I.set(e);const i=s?I.col:this.denormalizeCol(I.col,I.world),r=I.row;return function(t,e,s,i,r){t[0]=e,t[1]=s,t[2]=i,t[3]=r}(t,this.getXForColumn(i),this.getYForRow(r+1),this.getXForColumn(i+1),this.getYForRow(r)),t}getTileCoords(t,e,s=!1){I.set(e);const i=s?I.col:this.denormalizeCol(I.col,I.world);return Array.isArray(t)?v(t,this.getXForColumn(i),this.getYForRow(I.row)):(t.x=this.getXForColumn(i),t.y=this.getYForRow(I.row)),t}}var P=s(93687);class M{constructor(){this.spans=[]}static{this.pool=new P.A(M)}acquire(t){this.lodInfo=t}release(){this.lodInfo=null,this.spans.length=0}*keys(){const t=this.lodInfo;for(const{row:e,colFrom:s,colTo:i}of this.spans)for(let r=s;r<=i;r++){const s=t.getWorldForColumn(r);yield new b.A(t.level,e,t.normalizeCol(r),s)}}forEach(t,e){const{spans:s,lodInfo:i}=this,{level:r}=i;if(0!==s.length)for(const{row:n,colFrom:o,colTo:a}of s)for(let s=o;s<=a;s++)t.call(e,r,n,i.normalizeCol(s),i.getWorldForColumn(s))}}class C{constructor(t,e,s){this.row=t,this.colFrom=e,this.colTo=s}}const A=new b.A("0/0/0/0");class T{static create(t,e){t[1]>e[1]&&([t,e]=[e,t]);const[s,i]=t,[r,n]=e,o=r-s,a=n-i,h=0!==a?o/a:0,c=(Math.ceil(i)-i)*h,l=(Math.floor(i)-i)*h;return new T(s,Math.floor(i),Math.ceil(n),h,o<0?c:l,o<0?l:c,o<0?r:s,o<0?s:r)}constructor(t,e,s,i,r,n,o,a){this.x=t,this.ymin=e,this.ymax=s,this.invM=i,this.leftAdjust=r,this.rightAdjust=n,this.leftBound=o,this.rightBound=a}incrRow(){this.x+=this.invM}getLeftCol(){return Math.max(this.x+this.leftAdjust,this.leftBound)}getRightCol(){return Math.min(this.x+this.rightAdjust,this.rightBound)}}const k=[[0,0],[0,0],[0,0],[0,0]];class F{constructor(t,e=null,s=t.lods[0].level,i=t.lods[t.lods.length-1].level){this.tileInfo=t,this.fullExtent=e,this.scales=[],this._infoByScale={},this._infoByLevel={};const r=t.lods.filter(t=>t.level>=s&&t.level<=i);this.minScale=r[0].scale,this.maxScale=r[r.length-1].scale;const n=this._lodInfos=r.map(s=>S.create(t,s,e));r.forEach((t,e)=>{this._infoByLevel[t.level]=n[e],this._infoByScale[t.scale]=n[e],this.scales[e]=t.scale},this),this._wrap=t.isWrappable}get spatialReference(){return this.tileInfo.spatialReference}getLODInfoAt(t){return this._infoByLevel["number"==typeof t?t:t.level]}getTileBounds(t,e,s=!1){A.set(e);const i=this._infoByLevel[A.level];return i?i.getTileBounds(t,A,s):t}getTileCoords(t,e,s=!1){A.set(e);const i=this._infoByLevel[A.level];return i?i.getTileCoords(t,A,s):t}getTileCoverage(t,e=192,s=!0,i="closest"){if(!s&&(t.scale>this.minScale||t.scale<this.maxScale))return null;const r="closest"===i?this.getClosestInfoForScale(t.scale):this.getSmallestInfoForScale(t.scale),n=M.pool.acquire(r),o=this._wrap;let a,h,c,l=1/0,u=-1/0;const d=n.spans;k[0][0]=k[0][1]=k[1][1]=k[3][0]=-e,k[1][0]=k[2][0]=t.size[0]+e,k[2][1]=k[3][1]=t.size[1]+e;for(const e of k)t.toMap(e,e),e[0]=r.getColumnForX(e[0]),e[1]=r.getRowForY(e[1]);const _=[];let p=3;for(let t=0;t<4;t++){if(k[t][1]===k[p][1]){p=t;continue}const e=T.create(k[t],k[p]);l=Math.min(e.ymin,l),u=Math.max(e.ymax,u),void 0===_[e.ymin]&&(_[e.ymin]=[]),_[e.ymin].push(e),p=t}if(null==l||null==u||u-l>100)return null;let f=[];for(a=l;a<u;){null!=_[a]&&(f=f.concat(_[a])),h=1/0,c=-1/0;for(let t=f.length-1;t>=0;t--){const e=f[t];h=Math.min(h,e.getLeftCol()),c=Math.max(c,e.getRightCol())}if(h=Math.floor(h),c=Math.floor(c),a>=r.first[1]&&a<=r.last[1])if(o)if(r.size[0]<r.worldSize[0]){const t=Math.floor(c/r.worldSize[0]);for(let e=Math.floor(h/r.worldSize[0]);e<=t;e++)d.push(new C(a,Math.max(r.getFirstColumnForWorld(e),h),Math.min(r.getLastColumnForWorld(e),c)))}else d.push(new C(a,h,c));else h>r.last[0]||c<r.first[0]||(h=Math.max(h,r.first[0]),c=Math.min(c,r.last[0]),d.push(new C(a,h,c)));a+=1;for(let t=f.length-1;t>=0;t--){const e=f[t];e.ymax>=a?e.incrRow():f.splice(t,1)}}return n}getTileParentId(t){A.set(t);const e=this._infoByLevel[A.level],s=this._lodInfos.indexOf(e)-1;return s<0?null:(this._getTileIdAtLOD(A,this._lodInfos[s],A),A.id)}getTileResolution(t){const e=this._infoByLevel["object"==typeof t?t.level:t];return e?e.resolution:-1}getTileScale(t){const e=this._infoByLevel[t.level];return e?e.scale:-1}intersects(t,e){A.set(e);const s=this._infoByLevel[A.level],i=t.lodInfo;if(i.resolution>s.resolution){this._getTileIdAtLOD(A,i,A);const e=i.denormalizeCol(A.col,A.world);for(const s of t.spans)if(s.row===A.row&&s.colFrom<=e&&s.colTo>=e)return!0}if(i.resolution<s.resolution){const[e,r,n,o]=t.spans.reduce((t,e)=>(t[0]=Math.min(t[0],e.row),t[1]=Math.max(t[1],e.row),t[2]=Math.min(t[2],e.colFrom),t[3]=Math.max(t[3],e.colTo),t),[1/0,-1/0,1/0,-1/0]),a=s.denormalizeCol(A.col,A.world),h=i.getColumnForX(s.getXForColumn(a)),c=i.getRowForY(s.getYForRow(A.row)),l=i.getColumnForX(s.getXForColumn(a+1))-1,u=i.getRowForY(s.getYForRow(A.row+1))-1;return!(h>o||l<n||c>r||u<e)}const r=i.denormalizeCol(A.col,A.world);return t.spans.some(t=>t.row===A.row&&t.colFrom<=r&&t.colTo>=r)}normalizeBounds(t,e,s){if(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._wrap){const e=(0,x.Vp)(this.tileInfo.spatialReference),i=-s*(e.valid[1]-e.valid[0]);t[0]+=i,t[2]+=i}return t}getSmallestInfoForScale(t){const e=this.scales;if(this._infoByScale[t])return this._infoByScale[t];if(t>e[0])return this._infoByScale[e[0]];for(let s=1;s<e.length-1;s++)if(t>e[s]+1e-6)return this._infoByScale[e[s-1]];return this._infoByScale[e[e.length-1]]}getClosestInfoForScale(t){const e=this.scales;return this._infoByScale[t]||(t=e.reduce((e,s)=>Math.abs(s-t)<Math.abs(e-t)?s:e,e[0])),this._infoByScale[t]}scaleToLevel(t){const e=this.scales;if(this._infoByScale[t])return this._infoByScale[t].level;for(let s=e.length-1;s>=0;s--)if(t<e[s])return s===e.length-1?this._infoByScale[e[e.length-1]].level:this._infoByScale[e[s]].level+(e[s]-t)/(e[s]-e[s+1]);return this._infoByScale[e[0]].level}scaleToZoom(t){return this.tileInfo.scaleToZoom(t)}zoomToScale(t){return this.tileInfo.zoomToScale(t)}_getTileIdAtLOD(t,e,s){const i=this._infoByLevel[s.level];return t.set(s),e.resolution<i.resolution?null:(e.resolution===i.resolution||(t.level=e.level,t.col=Math.floor(s.col*i.resolution/e.resolution+.01),t.row=Math.floor(s.row*i.resolution/e.resolution+.01)),t)}}var E=s(31635),R=s(69622),z=s(91869),O=s(3483),L=s(10107),D=s(53966),G=s(40608),N=s(37585),B=s(9775),q=s(32587),W=s(11932),U=s(44794);class Y{constructor(t,e){this.item=t,this.controller=e,this.promise=null}}class j{constructor(t){this._schedule=null,this._task=null,this._deferreds=new q.A,this._controllers=new q.A,this._processingItems=new q.A,this._pausedSignal=(0,U.v)(!1),this.concurrency=1,t.concurrency&&(this.concurrency=t.concurrency),this._queue=new B.A(t.peeker),this.process=t.process;const e=t.scheduler;t.priority&&e&&(this._task=e.registerTask(t.priority,this))}destroy(){this.clear(),this._schedule=(0,f.xt)(this._schedule),this._task=(0,f.xt)(this._task)}get updating(){return!!this._task?.updating||this.running}get length(){return this._processingItems.size+this._queue.length}abort(t){const e=this._controllers.get(t);e&&e.abort()}clear(){this._queue.clear();const t=[];this._controllers.forEach(e=>t.push(e)),this._controllers.clear(),t.forEach(t=>t.abort()),this._processingItems.clear(),this._cancelNext()}forEach(t){this._deferreds.forEach((e,s)=>t(s))}get(t){const e=this._deferreds.get(t);return e?e.promise:void 0}isOngoing(t){return this._processingItems.has(t)}has(t){return this._deferreds.has(t)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(t,e){const s=this.get(t);if(s)return s;const i=new AbortController;let r=null;e&&(r=(0,a.u7)(e,()=>i.abort()));const n=()=>{o.remove(),null!=r&&r.remove(),this._removeItem(t),this._queue.remove(t),this._scheduleNext()},o=(0,a.NY)(i.signal,()=>{const e=this._processingItems.get(t);e&&e.controller.abort(),n(),h.reject((0,a.NK)())}),h=(0,a.Tw)();return this._deferreds.set(t,h),this._controllers.set(t,i),h.promise.then(n,n),this._queue.push(t),this._scheduleNext(),h.promise}last(){return this._queue.last()}lastPromise(){const t=this.last();return t?this.get(t):null}peek(){return this._queue.peek()}popLast(){const t=this._queue.popLast();return t&&(this._deferreds.get(t)?.reject((0,a.NK)()),this._removeItem(t)),t}reset(){const t=Array.from(this._processingItems.values());this._processingItems.clear();for(const e of t)this._queue.push(e.item),e.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const t=[];for(;this._queue.length;)t.push(this._queue.pop());return this.clear(),t}get running(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(t){for(;!t.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),t.madeProgress()}_removeItem(t){this._deferreds.delete(t),this._controllers.delete(t),this._processingItems.delete(t)}_scheduleNext(){this._task||this._pausedSignal.value||this._schedule||(this._schedule=(0,W._)(()=>{this._schedule=null,this._next()}))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).resolve(e))}_processError(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).reject(e))}_canProcessFulfillment(t){return!!this._deferreds.get(t.item)&&this._processingItems.get(t.item)===t}_process(t){if(null==t)return;let e;const s=new AbortController,i=new Y(t,s);this._processingItems.set(t,i);try{e=this.process(t,s.signal)}catch(t){this._processError(i,t)}(0,a.$X)(e)?(i.promise=e,e.then(t=>this._processResult(i,t),t=>this._processError(i,t))):this._processResult(i,e)}get test(){}}const V=[0,0];let X=class extends R.A{constructor(t){super(t),this._keyToItem=new Map,this._tilesByScale=new Map,this.concurrency=6}initialize(){const{concurrency:t,process:e,scheduler:s,priority:i}=this;this._queue=new j({concurrency:t,scheduler:s,priority:i,process:(t,s)=>{const i=this._keyToItem.get(t);return e(i,{signal:s})},peeker:t=>this._peek(t)})}destroy(){this.clear(),this._queue=(0,f.pR)(this._queue)}get length(){return this._queue?this._queue.length:0}abort(t){const e="string"==typeof t?t:t.id;this._queue.abort(e)}clear(){this._queue.clear(),this._keyToItem.clear(),this._tilesByScale.clear()}has(t){return"string"==typeof t?this._keyToItem.has(t):this._keyToItem.has(t.id)}pause(){this._queue.pause()}push(t){const e=t.key.id;if(this._queue.has(e))return this._queue.get(e);const s=this._queue.push(e),i=this.tileInfoView.getTileScale(t.key),r=(0,z.tE)(this._tilesByScale,i,()=>new Set),n=()=>{r.delete(t.key),0===r.size&&this._tilesByScale.delete(i),this._keyToItem.delete(e)};return r.add(t.key),this._keyToItem.set(e,t),s.then(n,n),s}reset(){this._queue.reset()}resume(){this._queue.resume()}_peek(t){if(!this.state)return t.values().next().value;const e=new Set;for(const s of t)e.add(this._keyToItem.get(s).key);const s=this.state.scale;let i,r=Number.POSITIVE_INFINITY;for(const[t,n]of this._tilesByScale)if((0,O.bw)(n,t=>e.has(t))){const e=Math.abs(t-s);e<r&&(i=n,r=e)}return this._getClosestTileKey(i,t).id}_getClosestTileKey(t,e){const s=this.tileInfoView,i=this.state.center;let r,n=Number.POSITIVE_INFINITY;for(const o of t)if(e.has(o.id)){s.getTileCoords(V,o);const t=(0,N.Io)(V,i);t<n&&(n=t,r=o)}return r}};(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],X.prototype,"concurrency",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],X.prototype,"priority",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],X.prototype,"process",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],X.prototype,"scheduler",void 0),(0,E.Cg)([(0,L.MZ)()],X.prototype,"state",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],X.prototype,"tileInfoView",void 0),X=(0,E.Cg)([(0,G.$)("esri.views.2d.tiling.TileQueue")],X);var H=s(19419);new b.A(0,0,0,0),new Map;class Z{static{this.byteSizeHint=7*Uint32Array.BYTES_PER_ELEMENT}constructor(t,e,s,i,r,n,o){this.instanceId=t,this.textureKey=e,this.indexStart=s,this.indexCount=i,this.vertexStart=r,this.vertexCount=n,this.overlaps=o}updateBaseOffsets(t){this.vertexStart+=t.vertexFrom,this.indexStart+=t.indexFrom}clone(){return new Z(this.instanceId,this.textureKey,this.indexStart,this.indexCount,this.vertexStart,this.vertexCount,this.overlaps)}static write(t,e,s,i,r,n,o,a){t.push(e),t.push(s),t.push(i),t.push(r),t.push(n),t.push(o),t.push(a)}serialize(t){return t.push(this.instanceId),t.push(this.textureKey),t.push(this.indexStart),t.push(this.indexCount),t.push(this.vertexStart),t.push(this.vertexCount),t.push(this.overlaps),t}static deserialize(t){const e=t.readInt32(),s=t.readInt32(),i=t.readInt32(),r=t.readInt32(),n=t.readInt32(),o=t.readInt32(),a=t.readInt32();return new Z(e,s,i,r,n,o,a)}}function $(t,e){if(null!==e){t.push(e.length);for(const s of e)s.serialize(t);return t}t.push(0)}function Q(t,e,s){const i=t.readInt32(),r=new Array(i);for(let i=0;i<r.length;i++)r[i]=e.deserialize(t,s);return r}class J{static{this.byteSizeHint=2*Uint32Array.BYTES_PER_ELEMENT+Z.byteSizeHint}constructor(t,e){this.id=t,this.sortKey=e,this.records=[]}serialize(t){return t.push(this.id),t.writeF32(this.sortKey),$(t,this.records),t}static deserialize(t){const e=t.readInt32(),s=t.readF32(),i=new J(e,s);return i.records=Q(t,Z)??[],i}}class K{get length(){return this._pos}constructor(t,e){this._pos=0;const s=e?this._roundToNearest(e,t.BYTES_PER_ELEMENT):40;this._array=new ArrayBuffer(s),this._buffer=new t(this._array),this._ctor=t,this._i16View=new Int16Array(this._array)}_roundToNearest(t,e){const s=Math.round(t);return 1===e?s:s+(e-s%e)}_ensureSize(t){if(this._pos+t>=this._buffer.length){const e=this._roundToNearest(1.25*(this._array.byteLength+t*this._buffer.BYTES_PER_ELEMENT),this._buffer.BYTES_PER_ELEMENT),s=new ArrayBuffer(e),i=new this._ctor(s);i.set(this._buffer,0),this._array=s,this._buffer=i,this._i16View=new Int16Array(this._array)}}ensureSize(t){this._ensureSize(t)}writeF32(t){this._ensureSize(1);const e=this._pos;return new Float32Array(this._array,4*this._pos,1)[0]=t,this._pos++,e}push(t){this._ensureSize(1);const e=this._pos;return this._buffer[this._pos++]=t,e}writeFixed(t){this._buffer[this._pos++]=t}setValue(t,e){this._buffer[t]=e}i1616Add(t,e,s){this._i16View[2*t]+=e,this._i16View[2*t+1]+=s}getValue(t){return this._buffer[t]}getValueF32(t){return new Float32Array(this._array,4*t,1)[0]}incr(t){if(this._buffer.length<t)throw new Error("Increment index overflows the target buffer");this._buffer[t]++}decr(t){this._buffer[t]--}writeRegion(t){this._ensureSize(t.length);const e=this._pos;return this._buffer.set(t,this._pos),this._pos+=t.length,e}writeManyFrom(t,e,s){this._ensureSize(s-e);for(let i=e;i!==s;i++)this.writeFixed(t._buffer[i])}buffer(){const t=this._array.slice(0,4*this._pos);return this.destroy(),t}toArray(){return[...this._buffer]}seek(t){this._pos=t}destroy(){this._array=null,this._buffer=null}}class tt{constructor(t,e,s=0){const i=6*s*Uint32Array.BYTES_PER_ELEMENT,r=4*s*e.stride,n=e.stride/4,o=e.attributes.find(t=>"pos"===t.name||"position"===t.name);if(!o)throw new Error("InternalError: Unable to find position attribute");this.layout={...e,position:o},this._indices=new K(Uint32Array,i),this._vertices=new K(Uint32Array,r),this._metrics=new K(Uint32Array,0),this._metricCountOffset=this._metrics.push(0),this._strideInt=n,this._instanceId=t}serialize(t){const e=this._indices.buffer(),s=this._vertices.buffer(),i=this._metrics.length?this._metrics.buffer():null;return t.push(e,s),{instanceId:this._instanceId,layout:this.layout,indices:e,vertices:s,metrics:i}}get strideInt(){return this._strideInt}get vertexCount(){return this._vertices.length/this._strideInt}get indexCount(){return this._indices.length}get indexWriter(){return this._indices}get vertexWriter(){return this._vertices}get metricWriter(){return this._metrics}vertexEnsureSize(t){this._vertices.ensureSize(t)}indexEnsureSize(t){this._indices.ensureSize(t)}writeIndex(t){this._indices.push(t)}writeVertex(t){this._vertices.push(t)}writeVertexRegion(t){this._vertices.writeRegion(t)}writeVertexF32(t){this._vertices.writeF32(t)}writeMetric(t){this._metrics.incr(this._metricCountOffset),t.serialize(this._metrics)}}class et{constructor(t,e=0){this._id=t,this._sizeHint=e,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._didEntityStart=!1,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new K(Uint32Array,this._sizeHint*J.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],s=this._entities.buffer();for(const s of this._instanceIdToVertexData.values())e.push(s.serialize(t));return{message:{data:e,entities:s},transferList:t}}vertexStart(){return this._current.vertexStart??0}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,s,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t,this._current.metric.recordStart=this.recordCount()}metricEnd(){const t=this._current.writer;this._current.metric&&(this._current.metric.recordCount=this.recordCount()-this._current.metric.recordStart),this._current.metric?.bounds.length&&this._current.metric?.recordCount?(t.writeMetric(this._current.metric),this._current.metric=null):this._current.metric=null}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0),this._didEntityStart=!0}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){this._didEntityStart&&(0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset),this._didEntityStart=!1)}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,s=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=s}recordEnd(t=0){const e=this._current.vertexStart,s=this._current.writer.vertexCount-e;if(!s)return!1;const i=this._current.indexStart,r=this._current.writer.indexCount-i;return this._recordIndexStart=i,this._recordIndexCount=r,this._recordVertexStart=e,this._recordVertexCount=s,this._entities.incr(this._entityRecordCountOffset),Z.write(this._entities,this._current.instanceId,this._current.textureKey,i,r,e,s,t),!0}copyLast(t,e){const s=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),Z.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,s,this._recordVertexCount,0);const i=this._current.writer.indexWriter,r=this._current.writer.vertexWriter,n=this._recordIndexStart+this._recordIndexCount,o=this._recordVertexCount;for(let t=this._recordIndexStart;t!==n;t++){const e=i.getValue(t);i.push(e+o)}const a=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,h=this._recordVertexStart*a,c=(this._recordVertexStart+this._recordVertexCount)*a;for(let t=h;t!==c;t++){const e=r.getValue(t);r.push(e)}const l=this._current.writer.layout.position,u=l.packPrecisionFactor??1,d=l.offset/Uint32Array.BYTES_PER_ELEMENT,_=t*u,p=e*u;for(let t=s*a;t<=r.length;t+=a)r.i1616Add(t+d,_,p)}copyLastFrom(t,e,s){const i=t._entities.getValue(t._entityIdIndex);if(i!==this._entities.getValue(this._entityIdIndex)){const e=t._entities.getValueF32(t._entitySortKeyIndex);this.entityStart(i,e)}this.recordStart(t._current.instanceId,t._current.writer.layout,t._current.textureKey);const r=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,n=this._current.vertexStart,o=t._current.vertexStart-n,a=this._current.writer.indexWriter,h=this._current.writer.vertexWriter,c=t._current.writer.indexWriter,l=t._current.writer.vertexWriter;for(let e=t._current.indexStart;e!==c.length;e++){const t=c.getValue(e);a.push(t-o)}for(let e=t._current.vertexStart*r;e!==l.length;e++){const t=l.getValue(e);h.push(t)}const u=this._current.writer.layout.position,d=u.packPrecisionFactor??1,_=u.offset/Uint32Array.BYTES_PER_ELEMENT,p=e*d,f=s*d;for(let t=n*r;t<=h.length;t+=r)h.i1616Add(t+_,p,f);this.recordEnd()}_getVertexWriter(t,e){const s=this._instanceIdToVertexData;return s.has(t)||s.set(t,new tt(t,e,this._sizeHint)),s.get(t)}}function st(t){switch(t){case 1:case 8:case 32:return-1;case 2:case 64:return 0;case 4:case 16:case 128:return 1}}function it(t){switch(t){case 1:case 2:case 4:return-1;case 8:case 16:return 0;case 32:case 64:case 128:return 1}}class rt{constructor(t,e,s,i,r=0){this.tileKey=t,this._bufferingEnabled=e,this._sizeHint=r,this._meshes={self:new et(this.id,this._sizeHint),neighbors:new Array},this._currentRecordOverlaps=0,this._currentEntityOverlaps=0;const n=i?1:0;this._copyBufferedDataIntoSelf=s&&this._bufferingEnabled&&t.level===n}get id(){return this.tileKey.id}vertexStart(){return this._meshes.self.vertexStart()??0}vertexCount(){return this._meshes.self.vertexCount()}indexCount(){return this._meshes.self.indexCount()}indexEnsureSize(t){this._meshes.self.indexEnsureSize(t)}entityStart(t,e=t){this._currentEntityOverlaps=0,this._meshes.self.entityStart(t,e)}entityRecordCount(){return this._meshes.self.entityRecordCount()}entityEnd(){if(this._meshes.self.entityEnd(),this._bufferingEnabled){if(this._copyBufferedDataIntoSelf)return;for(let t=0;t<8;t++){const e=1<<t;this._currentEntityOverlaps&e&&this._meshes.neighbors[t].entityEnd()}}}recordStart(t,e,s){this._currentRecordOverlaps=0,this._meshes.self.recordStart(t,e,s)}recordEnd(t=0){const e=this._meshes.self.recordEnd(this._currentRecordOverlaps);return e&&0!==this._currentRecordOverlaps?(this._copyIntoNeighbors(),this._currentEntityOverlaps|=this._currentRecordOverlaps,!0):e}recordBounds(t,e,s,i){this._bufferingEnabled&&this._addOverlap(t,e,s,i)}recordCount(){return this._meshes.self.recordCount()}metricStart(t){this._meshes.self.metricStart(t)}metricBoxWrite(t){this._meshes.self.metricBoxWrite(t)}metricEnd(){this._meshes.self.metricEnd()}vertexWrite(t){this._meshes.self.vertexWrite(t)}vertexWriteF32(t){this._meshes.self.vertexWriteF32(t)}vertexWriteRegion(t){this._meshes.self.vertexWriteRegion(t)}indexWrite(t){this._meshes.self.indexWrite(t)}serialize(t){const e={message:[],transferList:[]},s=this._meshes.self.serialize();return e.message.push({tileId:this.tileKey.id,...s.message}),e.transferList.push(...s.transferList),this._meshes.neighbors.forEach((s,i)=>{const r=s.serialize(),n=1<<i,o=st(n),a=it(n),h=new b.A(this.tileKey).getNormalizedNeighbor(o,a,t);e.message.push({tileId:h.id,...r.message}),e.transferList.push(...r.transferList)}),e}_addOverlap(t,e,s,i){const r=Math.min(_.CQ/2,s),n=Math.min(_.CQ/2,i),o=255^((t<0+r?148:t>=_.CQ-r?41:189)|(e<0+n?224:e>=_.CQ-n?7:231));this._currentRecordOverlaps|=o}_copyIntoNeighbors(){for(let t=0;t<8;t++){const e=1<<t;if(this._currentRecordOverlaps&e){if(this._copyBufferedDataIntoSelf){const t=-st(e)*_.CQ,s=-it(e)*_.CQ;if(0!==s)continue;this._meshes.self.copyLast(t,s);continue}if(!this._meshes.neighbors[t]){const s=Math.floor(this._sizeHint/16);this._meshes.neighbors[t]=new et(e,s)}const s=this._meshes.neighbors[t],i=-st(e)*_.CQ,r=-it(e)*_.CQ;s.copyLastFrom(this._meshes.self,i,r)}}}}class nt{}var ot=s(72691),at=s(73681);class ht{constructor(){this._defaultResult=null,this._backgroundFillResult=null}static async from(t,e){const s=new ht;return s.setDefault(await t.createMeshWriters(e.meshes)),s}size(){return 1}getDefault(){return this._defaultResult}setDefault(t){this._defaultResult=t}getBackgroundFill(){return this._backgroundFillResult}setBackgroundFill(t){this._backgroundFillResult=t}hasArcadeDependency(t){return this._defaultResult?.some(e=>e.hasArcadeDependency(t))??!1}match(t,e,s){const i=this.doMatch(t,e)||this.getDefault();if(i&&i.length>0){const t=this.getBackgroundFill();if(t)return[...t,...i]}return i}getSortKey(t,e){return 0}doMatch(t,e){return null}async fetchResources(t,e){}}class ct extends ht{static async fromDictionaryRenderer(t,e){const s=await at.n.from(e.dictionaryInfo,e.userConfig,e.fieldMap);return new ct(t,s)}constructor(t,e){super(),this._context=t,this._evaluator=e,this._controlStringToPromise=new Map,this._controlStringToGroup=new Map}async fetchResources(t,e){const s=e.getCursor(),i=new Set;for(;s.next();){const t=this._evaluateControlString(s);t&&i.add(t)}const r=Array.from(i.values()).map(e=>this._ensureGroup(t,e));await Promise.all(r)}match(t,e){const s=this._evaluateControlString(t);return s?this._controlStringToGroup.get(s):null}_evaluateControlString(t){const e=t.readLegacyFeatureWorldSpace();return this._evaluator.evaluate(e,0,t.fields,null)}_ensureGroup(t,e){let s=this._controlStringToPromise.get(e);return null==s&&(s=this._fetchGroup(t,e),this._controlStringToPromise.set(e,s)),s}async _fetchGroup(t,e){const s=await t.fetchDictionaryResourceImmediate({type:"dictionary-request",controlString:e});if(!s)return;const i=await this._context.createMeshWriters(s.meshes);this._controlStringToGroup.set(e,i)}}class lt extends ht{constructor(t,e){super(),this._intervals=[],this._isMaxInclusive=e,this._field=t}static async fromIntervalSchema(t,e){const s=await t.storage.createComputedField(e),i=new lt(s,e.isMaxInclusive);await Promise.all(e.intervals.map(async e=>{const s=await t.createMeshWriters(e.meshes);i.add(e,s)}));const r=await t.createMeshWriters(e.defaultSymbol);i.setDefault(r);const n=await t.createMeshWriters(e.backgroundFill);return i.setBackgroundFill(n),i}add(t,e){this._intervals.push({interval:t,result:e}),this._intervals.sort((t,e)=>t.interval.min-e.interval.min)}size(){return super.size()+this._intervals.length}hasArcadeDependency(t){return this._field?.hasArcadeDependency(t)||this._intervals.some(e=>e.result.some(e=>e.hasArcadeDependency(t)))}doMatch(t,e){const s=this._field?.read(t,e);if(null==s||isNaN(s)||s===1/0||s===-1/0)return null;for(let t=0;t<this._intervals.length;t++){const{interval:e,result:i}=this._intervals[t],r=s>=e.min,n=this._isMaxInclusive?s<=e.max:s<e.max;if(r&&n)return i}return null}}class ut extends ht{static async fromLabelSchema(t,e){const s=e.classes.map(async e=>{const s=await t.createMeshWriters(e.meshes);return{minScale:e.minScale,maxScale:e.maxScale,meshes:s,expression:null,where:await t.storage.createWhereClause(e.where)}}),i=await Promise.all(s);return new ut(i)}constructor(t){super(),this._labels=t}match(t,e,s){if(!this._labels.length)return null;const i=this._getLabels(e.$view.scale),r=[];for(const e of i)e.where&&!e.where(t,s)||r.push(...e.meshes);return r}hasArcadeDependency(t){return this._labels.some(e=>e.meshes.some(e=>e.hasArcadeDependency(t)))}_getLabels(t){return this._labels.filter(e=>this._validForTileScale(e,t))}_validForTileScale(t,e){const s=e-e/4,i=e+e/2;return(!t.minScale||t.minScale>=s)&&(!t.maxScale||t.maxScale<=i)}}class dt extends ht{constructor(t,e){super(),this._defaultSymbolSortKey=0,this._nullResult=null,this._resultsMap=new Map,this._fields=[],this._fields=t,this._separator=e||""}static async fromMatcherSchema(t,e){const s=e.expression?[t.storage.createComputedField({expression:e.expression})]:[e.field?t.storage.createComputedField({field:e.field}):null,e.field2?t.storage.createComputedField({field:e.field2}):null,e.field3?t.storage.createComputedField({field:e.field3}):null],i=(await Promise.all(s)).filter(t=>!!t),r=new dt(i,e.fieldDelimiter),n=await t.createMeshWriters(e.defaultSymbol);r.setDefault(n);const o=await t.createMeshWriters(e.backgroundFill);return r.setBackgroundFill(o),await Promise.all(e.map.map(async(e,s)=>{const i=await t.createMeshWriters(e.symbol);"<Null>"===e.value?r.setNullResult(i):r.add(e.value,i,s+1)})),r}setNullResult(t){this._nullResult=t}getSortKey(t,e){const s=this._getValueFromFields(t,e);if(null==s||""===s||"<Null>"===s)return 0;const i=this._resultsMap.get(s.toString());return i?i.sortKey:this._defaultSymbolSortKey}add(t,e,s){this._resultsMap.set(t.toString(),{meshWriters:e,sortKey:s}),this._defaultSymbolSortKey=Math.max(this._defaultSymbolSortKey,s+1)}size(){return super.size()+this._resultsMap.size}hasArcadeDependency(t){return this._fields.some(e=>e.hasArcadeDependency(t))||[...this._resultsMap.values()].some(e=>e.meshWriters.some(e=>e.hasArcadeDependency(t)))||this._nullResult?.some(e=>e.hasArcadeDependency(t))||!1}doMatch(t,e){const s=this._getValueFromFields(t,e);if(null!==this._nullResult&&(null==s||""===s||"<Null>"===s))return this._nullResult;if(null==s)return null;const i=s.toString();return this._resultsMap.get(i)?.meshWriters}_getValueFromFields(t,e){const s=[];for(const i of this._fields){const r=i.read(t,e);null==r||""===r?s.push("<Null>"):s.push(r)}return s.join(this._separator)}}async function _t(t,e){switch(e.type){case"simple":case"heatmap":case"dot-density":case"pie-chart":return ht.from(t,e);case"interval":return lt.fromIntervalSchema(t,e);case"dictionary":return ct.fromDictionaryRenderer(t,e);case"label":return ut.fromLabelSchema(t,e);case"map":return dt.fromMatcherSchema(t,e);case"subtype":return pt.fromSubtypes(t,e);case"cluster":return ft.fromClusterSchema(t,e);case"track":return mt.fromTrackSchema(t,e);default:throw new Error("Impl")}}class pt extends ht{constructor(t,e){super(),this._subMatchers=t,this._subtypeField=e}static async fromSubtypes(t,e){const s=new Map,i=[];for(const r in e.renderers){const n=parseInt(r,10),o=_t(t,e.renderers[r]).then(t=>s.set(n,t));i.push(o)}return await Promise.all(i),new pt(s,e.subtypeField)}match(t,e,s){const i=t.readAttribute(this._subtypeField),r=this._subMatchers.get(i);return r?r.match(t,e,s):null}hasArcadeDependency(t){for(const e of this._subMatchers.values())if(e.hasArcadeDependency(t))return!0;return!1}}class ft extends ht{static async fromClusterSchema(t,e){const[s,i]=await Promise.all([_t(t,e.feature),_t(t,e.cluster)]);return new ft(s,i)}constructor(t,e){super(),this._featureMatcher=t,this._clusterMatcher=e}match(t,e,s){return 1===t.readAttribute("cluster_count")?this._featureMatcher.match(t,e,s):this._clusterMatcher.match(t,e,s)}hasArcadeDependency(t){return this._featureMatcher.hasArcadeDependency(t)||this._clusterMatcher.hasArcadeDependency(t)}}class mt extends ht{static async fromTrackSchema(t,e){const[s,i,r]=await Promise.all([_t(t,e.previousObservation),_t(t,e.latestObservation),_t(t,e.trackLine)]);return new mt(s,i,r)}constructor(t,e,s){super(),this._previousObservationMatcher=t,this._latestObservationMatcher=e,this._trackLineMatcher=s}match(t,e,s){switch(t.readAttribute(ot.EA)){case 0:return this._trackLineMatcher.match(t,e,s);case 1:return this._latestObservationMatcher.match(t,e,s);case 2:return this._previousObservationMatcher.match(t,e,s)}return null}hasArcadeDependency(t){return this._trackLineMatcher.hasArcadeDependency(t)||this._latestObservationMatcher.hasArcadeDependency(t)||this._previousObservationMatcher.hasArcadeDependency(t)}}class gt extends nt{static async create(t,e){const s=await _t(t,e.symbology),i=e.labels?await _t(t,e.labels):null;return new gt(s,i)}constructor(t,e){super(),this._symbology=t,this._labels=e}destroy(){}async enqueueMatcherRequests(t,e){await Promise.all([this._symbology.fetchResources(t,e),this._labels?.fetchResources(t,e)])}enqueueWriterRequests(t,e,s,i){const r=this._symbology.match(e,s,i);if(r){for(const i of r)i.enqueueRequest(t,e,s);if(this._labels){const r=this._labels.match(e,s,i);if(!r)return;for(const i of r)i.enqueueRequest(t,e,s)}}}write(t,e,s,i,r,n){const o=this._symbology.match(s,i,r);if(o){for(const r of o)r.write(t,e,s,i,n);if(t.entityRecordCount()>=1&&this._labels){const a=this._labels.match(s,i,r);if(!a)return;for(const r of a)r.setReferences(o),r.write(t,e,s,i,n)}}}getSortKey(t,e){return this._symbology.getSortKey(t,e)}hasArcadeDependency(t){return!(!this._symbology.hasArcadeDependency(t)&&!this._labels?.hasArcadeDependency(t))}}var yt=s(799);class xt{}class bt extends xt{constructor(t){super(),this._fetcher=t,this._controller=new AbortController,this._pendingIds=new Set,this._pendingRequests=[],this._resourceIdToResource=new Map}destroy(){this._controller.abort()}get _abortOptions(){return{signal:this._controller.signal}}enqueueRequest(t){const e=function(t){return"url"in t&&"urlHash"in t?{...t,url:""}:t}(t.resource),s=(0,yt.Wm)(JSON.stringify(e));return this._pendingIds.has(s)||(this._pendingIds.add(s),this._pendingRequests.push({...t,resourceId:s})),s}async fetchEnqueuedResources(){const t=this._pendingRequests;if(this._pendingIds.clear(),this._pendingRequests=[],0===t.length)return;const e=await this._fetcher.fetch(t,this._abortOptions);for(let s=0;s<e.length;s++){const i=t[s].resourceId;this._resourceIdToResource.set(i,e[s])}}async fetchResourceImmediate(t){const e=await this._fetcher.fetch([t]);if(1!==e.length)throw new Error("FeaturePipelineResourceProxy: failed to fetch resources");return e[0]}async fetchDictionaryResourceImmediate(t){const e=await this._fetcher.fetchDictionary([t]);if(1!==e.length)throw new Error("FeaturePipelineResourceProxy: failed to fetch dictionary resources");return e[0]}getResource(t){return this._resourceIdToResource.get(t)}}var wt=s(4718),vt=s(51118),It=s(65864),St=s(92722);class Pt{static fromOptimized(t,e,s=!1,i=!1,r=1){return(new Mt).initialize(t,e,s,i,r)}static fromJSON(t,e=!1,s=!1){const[i,r]=At(t);return(new Tt).initialize(i,r,e,s,1)}static fromOptimizedCIM(t,e,s=!1,i=!1,r=1){return(new kt).initialize(t,e,s,i,r)}static fromJSONCIM(t,e=!1,s=!1,i=1){const[r,n]=At(t);return(new Ft).initialize(r,n,e,s,i)}static fromFeatureSetReader(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimized(e,s):null}static fromFeatureSetReaderCIM(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimizedCIM(e,s):null}static createEmptyOptimized(t,e=!1,s=!1,i=1){return(new Mt).initialize(new St.A,t,e,s,i)}static createEmptyJSON(t,e=!1,s=!1){return(new Tt).initialize([],t,e,s,1)}static createEmptyOptimizedCIM(t,e=!1,s=!1,i=1){return(new kt).initialize(new St.A,t,e,s,i)}static createEmptyJSONCIM(t,e=!1,s=!1,i=1){return(new Ft).initialize([],t,e,s,i)}asJSON(){const t=(0,vt.x)(this);return"esriGeometryEnvelope"===this.geometryType?{xmin:t[0][0][0],ymin:t[0][0][1],xmax:t[0][2][0],ymax:t[0][2][1]}:"esriGeometryMultipoint"===this.geometryType?{points:t.flat()}:"esriGeometryPoint"===this.geometryType?{x:t[0][0][0],y:t[0][0][1]}:"esriGeometryPolygon"===this.geometryType?{rings:t}:{paths:t}}getCurrentRingArea(){if(this.pathSize<3)return 0;let t,e,s=0;if(this.seekPathStart(),!this.nextPoint())return 0;t=this.x,e=this.y;const i=t,r=e;for(;this.nextPoint();)s+=(t-this.x)*(e+this.y),t=this.x,e=this.y;return s+=(t-i)*(e+r),-.5*s}invertY(){this.yFactor*=-1}}class Mt extends Pt{constructor(){super(...arguments),this._end=-1}initialize(t,e,s,i,r){return this.hasZ=s,this.hasM=i,this.geometryType=e,this._stride=2+Number(s)+Number(i),this._geometry=t,this._pathIndex=-1,this._pathOffset=0,this._pointOffset=-this._stride,this._end=-1,this.yFactor=r,this}reset(){this.initialize(this._geometry,this.geometryType,this.hasZ,this.hasM,this.yFactor)}seekPath(t){if(t>=0&&t<this.totalSize){if(this._pathIndex<t)for(;this._pathIndex<t&&this.nextPath(););else if(this._pathIndex>t)for(;this._pathIndex>t&&this.prevPath(););return!0}return!1}seekPathStart(){this._pointOffset=this._pathOffset-this._stride}seekPathEnd(){this._pointOffset=this._end}seekInPath(t){const e=this._pathOffset+t*this._stride;return e>=0&&e<this._end&&(this._pointOffset=e,!0)}nextPoint(){return(this._pointOffset+=this._stride)<this._end}prevPoint(){return(this._pointOffset-=this._stride)>=this._pathOffset}nextPath(){return!(this.pathIndex>=this.totalSize-1||(this._pathIndex>=0&&(this._pathOffset+=this._stride*this.pathSize),this._pathIndex++,this._pointOffset=this._pathOffset-this._stride,this._end=this._pointOffset+this._stride+this._stride*this.pathSize,0))}prevPath(){return!(this.pathIndex<=0||(this._pathIndex--,this._end=this._pathOffset,this._pathOffset-=this._stride*this.pathSize,this._pointOffset=this._pathOffset-this._stride,0))}getCurrentPath(){const t=this._end,e=this._geometry.coords,s=this._pathOffset;return(new Mt).initialize(new St.A([this.pathSize],e.slice(s,t)),this.geometryType,this.hasZ,this.hasM,this.yFactor)}pathLength(){const t=this._end,e=this._stride,s=this._geometry.coords;let i=0;for(let r=this._pathOffset+e;r<t;r+=e){const t=s[r-e],n=s[r-e+1],o=s[r]-t,a=s[r+1]-n;i+=Math.sqrt(o*o+a*a)}return i}startPath(){this._geometry.lengths.push(0)}pushPath(t){this.startPath(),this.pushPoints(t)}pushPoint(t){for(let e=0;e<this._stride;++e)this._geometry.coords.push(t[e]);this._geometry.lengths[this.totalSize-1]++}pushXY(t,e){this._geometry.coords.push(t,e),this._geometry.lengths[this.totalSize-1]++}pushPoints(t){for(const e of t)for(let t=0;t<this._stride;++t)this._geometry.coords.push(e[t]);this._geometry.lengths[this.totalSize-1]+=t.length}pushCursor(t){const e=t.asOptimized();this._geometry.coords.push(...e.coords),this._geometry.lengths.push(...e.lengths)}asOptimized(){const t=this._geometry.clone();if(1!==this.yFactor)for(let e=1;e<t.coords.length;e+=this._stride)t.coords[e]*=this.yFactor;return"esriGeometryPoint"===this.geometryType&&(t.lengths.length=0),t}isClosed(){const t=this._geometry.coords,e=this._pathOffset,s=this._end-this._stride;for(let i=0;i<this._stride;i++)if(t[e+i]!==t[s+i])return!1;return!0}clone(){return(new Mt).initialize(this._geometry.clone(),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get totalPoints(){return this._geometry.isPoint?1:this._geometry.lengths.reduce((t,e)=>t+e)}get pathSize(){const{lengths:t}=this._geometry;return this._geometry.isPoint?1:this._pathIndex<0||this._pathIndex>t.length-1?0:t[this._pathIndex]}get totalSize(){return this._geometry.isPoint?1:this._geometry.lengths.length}get x(){return this._geometry.coords[this._pointOffset]}set x(t){this._geometry.coords[this._pointOffset]=t}get y(){return this.yFactor*this._geometry.coords[this._pointOffset+1]}set y(t){this._geometry.coords[this._pointOffset+1]=this.yFactor*t}get z(){return this._geometry.coords[this._pointOffset+2]}set z(t){this._geometry.coords[this._pointOffset+2]=t}get m(){const t=this.hasZ?3:2;return this._geometry.coords[this._pointOffset+t]}set m(t){this._geometry.coords[this._pointOffset+3]=t}get pathIndex(){return this._pathIndex}get _coordIndex(){return this._pointOffset/this._stride}}function Ct(t){const e=[t.x,t.y];return t.z&&e.push(t.z),t.m&&e.push(t.m),e}function At(t){return(0,It.Bi)(t)?[t.rings,"esriGeometryPolygon"]:(0,It.Rg)(t)?[t.paths,"esriGeometryPolyline"]:(0,It.U9)(t)?[[t.points],"esriGeometryMultipoint"]:(0,It.ZC)(t)?[[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]],"esriGeometryEnvelope"]:(0,It.fT)(t)?[[[Ct(t)]],"esriGeometryPoint"]:[[],"esriGeometryPolyline"]}class Tt extends Pt{initialize(t,e,s,i,r){return this._paths=t,this.geometryType=e,this.hasZ=s,this.hasM=i,this._pathIndex=this._pointIndex=-1,this.yFactor=r,this._mIndex=this.hasZ?3:2,this}reset(){this._pathIndex=this._pointIndex=-1}seekPath(t){return this._pathIndex=t,this._pointIndex=-1,t>=0&&t<this.totalSize&&(this._currentPath=this._paths[t],!0)}seekPathStart(){this._pointIndex=-1}seekPathEnd(){this._pointIndex=this._currentPath.length}seekInPath(t){return t>=0&&t<this._currentPath.length&&(this._pointIndex=t,this._currentPoint=this._currentPath[this._pointIndex],!0)}nextPoint(){return this._currentPoint=this._currentPath[++this._pointIndex],this._pointIndex<this._currentPath.length}prevPoint(){return this._currentPoint=this._currentPath[--this._pointIndex],this._pointIndex>=0}nextPath(){return this._pointIndex=-1,this._currentPath=this._paths[++this._pathIndex],this._pathIndex<this.totalSize}prevPath(){return this.pathIndex>0&&(this._pointIndex=-1,this._pathIndex--,this._currentPath=this._paths[this._pathIndex],!0)}pathLength(){const t=this._currentPath.length,e=this._currentPath;let s=0;for(let i=1;i<t;i++){const t=e[i-1],r=e[i],n=t[0],o=t[1],a=r[0]-n,h=r[1]-o;s+=Math.sqrt(a*a+h*h)}return s}startPath(){this._paths.push([])}getCurrentPath(){return(new Tt).initialize([this._currentPath],this.geometryType,this.hasZ,this.hasM,this.yFactor)}pushPath(t){this._paths.push(t)}pushPoint(t){this._paths[this.totalSize-1].push(t)}pushXY(t,e){this._paths[this.totalSize-1].push([t,e])}pushPoints(t){this._paths[this.totalSize-1].push(...t)}pushCursor(t){const e=(0,vt.x)(t);for(const t of e)this.pushPath(t)}asOptimized(){const t=new St.A;if("esriGeometryPoint"===this.geometryType)t.coords.push(...this._paths[0][0]),t.lengths.length=0;else for(const e of this._paths){for(const s of e)t.coords.push(s[0]),t.coords.push(s[1]*this.yFactor),this.hasZ&&t.coords.push(s[2]),this.hasM&&t.coords.push(s[this._mIndex]);t.lengths.push(e.length)}return t}isClosed(){const t=this._currentPath[0],e=this._currentPath[this._currentPath.length-1];for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0}clone(){return(new Tt).initialize((0,wt.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get totalPoints(){return this._paths.map(t=>t.length).reduce((t,e)=>t+e)}get pathSize(){return this._pathIndex<0||this._pathIndex>this.totalSize-1?-1:this._paths[this._pathIndex].length}get totalSize(){return this._paths.length}get x(){return this._currentPoint[0]}set x(t){this._currentPoint[0]=t}get y(){return this.yFactor*this._currentPoint[1]}set y(t){this._currentPoint[1]=this.yFactor*t}get z(){return this._currentPoint[2]}set z(t){this._currentPoint[2]=t}get m(){return this._currentPoint[this._mIndex]}set m(t){this._currentPoint[this._mIndex]=t}get pathIndex(){return this._pathIndex}}class kt extends Mt{initialize(t,e,s,i,r){return super.initialize(t,e,s,i,r),this._controlPoints||(this._controlPoints=this._controlPoints=new Array(this.totalSize).fill(void 0).map(t=>new Set)),this}startPath(){super.startPath(),this._controlPoints.push(new Set)}clone(){const t=(new kt).initialize(this._geometry.clone(),this.geometryType,this.hasZ,this.hasM,this.yFactor);return t._controlPoints=this._controlPoints,t}setControlPoint(){this._controlPoints[this.pathIndex].add(this._coordIndex)}getControlPoint(){return this._controlPoints[this.pathIndex].has(this._coordIndex)}setControlPointAt(t){this._controlPoints[this.pathIndex].add(t)}getControlPointAt(t){return this._controlPoints[this.pathIndex].has(t)}}class Ft extends Tt{initialize(t,e,s,i,r){return super.initialize(t,e,s,i,r)}clone(){return(new Ft).initialize((0,wt.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}setControlPoint(){this._paths[this.pathIndex][this._pointIndex][4]=1}getControlPoint(){return 1===this._paths[this.pathIndex][this._pointIndex][4]}setControlPointAt(t){this._paths[this.pathIndex][t][4]=1}getControlPointAt(t){return 1===this._paths[this.pathIndex][t][4]}}var Et=s(28076);const Rt=1024;Et.D.CIMSolidStroke.capstyle,Et.D.CIMSolidStroke.joinstyle,Et.D.CIMSolidStroke.miterlimit;class zt{static{this.instance=null}static local(){return null===zt.instance&&(zt.instance=new zt),zt.instance}execute(t,e,s,i){return new Ot(t,e)}}class Ot{constructor(t,e){this._inputGeometries=t,this._angleTolerance=void 0!==e.angleTolerance?e.angleTolerance:120,this._maxCosAngle=Math.cos((1-Math.abs(this._angleTolerance)/180)*Math.PI)}next(){let t=this._inputGeometries.next();if(!t)return null;for(;t;){if("esriGeometryPolygon"===t.geometryType)this._isClosed=!0;else if("esriGeometryPolyline"===t.geometryType)this._isClosed=!1;else{if("esriGeometryEnvelope"!==t.geometryType){t=this._inputGeometries.next();continue}if(this._maxCosAngle)return t;this._isClosed=!0}for(;t.nextPath();)this._processPath(t);return t.reset(),t}return null}_processPath(t){if(t.nextPoint()){const e=t.x,s=t.y;let i=e,r=s,n=t.pathSize,o=0,a=0,h=0,c=0,l=0,u=0;this._isClosed&&++n;for(let d=1;t.nextPoint()||d<n;++d){let _,p;this._isClosed&&d===n-1?(_=e,p=s):(_=t.x,p=t.y);const f=_-i,m=p-r,g=Math.sqrt(f*f+m*m);d>1&&g>0&&h>0&&(o*f+a*m)/g/h<=this._maxCosAngle&&t.setControlPointAt(d-1),1===d&&(c=f,l=m,u=g),g>0&&(i=_,r=p,o=f,a=m,h=g)}this._isClosed&&h>0&&u>0&&(o*c+a*l)/u/h<=this._maxCosAngle&&t.setControlPointAt(0)}}}class Lt{constructor(){this.setIdentity()}getAngle(){return(null==this.rz||0===this.rz&&1!==this.rzCos&&0!==this.rzSin)&&(this.rz=Math.atan2(this.rzSin,this.rzCos)),this.rz}setIdentity(){this.tx=0,this.ty=0,this.tz=0,this.s=1,this.rx=0,this.ry=0,this.rz=0,this.rzCos=1,this.rzSin=0}setTranslate(t,e){this.tx=t,this.ty=e}setTranslateZ(t){this.tz=t}setRotateCS(t,e){this.rz=void 0,this.rzCos=t,this.rzSin=e}setRotate(t){this.rz=t,this.rzCos=void 0,this.rzSin=void 0}setRotateY(t){this.ry=t}setScale(t){this.s=t}setMeasure(t){this.m=t}}function Dt(t,e){t[4]=e}class Gt{constructor(t,e=!0,s=!0,i=0){this.isClosed=!1,this.geometryCursor=null,this.geometryCursor=!e&&"esriGeometryPolygon"===t.geometryType||!s&&"esriGeometryPolyline"===t.geometryType?null:t,this.geomUnitsPerPoint=i,this.iterateMultiPath=!1,this.iteratePath=!1,this.internalPlacement=new Lt}next(){if(!this.geometryCursor)return null;const t=this.processMultiPath(this.geometryCursor);return this.iterateMultiPath&&t||(this.geometryCursor=null),t}processMultiPath(t){for(;this.iteratePath||t.pathIndex<t.totalSize-1;){this.iteratePath||t.nextPath(),this.iterateMultiPath=!0;const e=this.processPath(t);if(e)return e}return this.iterateMultiPath=!1,null}}class Nt{constructor(t,e,s,i=0){this.isClosed=!1,this.inputGeometries=t,this.acceptPolygon=e,this.acceptPolyline=s,this.geomUnitsPerPoint=i,this.iteratePath=!1,this.multiPathCursor=null}next(){for(;;){if(!this.multiPathCursor){let t=this.inputGeometries.next();for(;t&&(this.isClosed=this.acceptPolygon&&"esriGeometryPolygon"===t.geometryType||"esriGeometryEnvelope"===t.geometryType,this.multiPathCursor=t,!this.multiPathCursor);)t=this.inputGeometries.next();if(!this.multiPathCursor)return null}for(;this.iteratePath||this.multiPathCursor.nextPath();){this.multiPathCursor.seekPathStart();const t=this.processPath(this.multiPathCursor);if(t)return t}this.multiPathCursor=null}}}const Bt=.03;class qt{constructor(t=0,e=!1){}isEmpty(t){if(!t.nextPoint())return!0;let e,s,i,r;for(e=t.x,s=t.y;t.nextPoint();e=s,s=r)if(i=t.x,r=t.y,i!==e||r!==s)return t.seekPathStart(),!1;return t.seekPathStart(),!0}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);0!==e&&(t[0]/=e,t[1]/=e)}getLength(t,e,s,i){const r=s-t,n=i-e;return Math.sqrt(r*r+n*n)}getSegLength(t){const[[e,s],[i,r]]=t;return this.getLength(e,s,i,r)}getCoord2D(t,e,s,i,r){return[t+(s-t)*r,e+(i-e)*r]}getSegCoord2D(t,e){const[[s,i],[r,n]]=t;return this.getCoord2D(s,i,r,n,e)}getAngle(t,e,s,i,r){const n=s-t,o=i-e;return Math.atan2(o,n)}getAngleCS(t,e,s,i,r,n){null==t&&(t=[0,0]);const o=i-e,a=r-s,h=Math.sqrt(o*o+a*a);return 0!==h?(t[0]=o/h,t[1]=a/h,t):(t[0]=1,t[1]=0,t)}getSegAngleCS(t,e,s){const[[i,r],[n,o]]=e;return this.getAngleCS(t,i,r,n,o,s)}cut(t,e,s,i,r,n){return[r<=0?[t,e]:this.getCoord2D(t,e,s,i,r),n>=1?[s,i]:this.getCoord2D(t,e,s,i,n)]}getSubCurve(t,e,s){const i=Pt.createEmptyOptimizedCIM("esriGeometryPolyline");return this.appendSubCurve(i,t,e,s)?i:null}appendSubCurve(t,e,s,i){t.startPath(),e.seekPathStart();let r=0,n=!0;if(!e.nextPoint())return!1;let o=e.x,a=e.y;for(;e.nextPoint();){const h=this.getLength(o,a,e.x,e.y);if(0!==h){if(n){if(r+h>s){const c=(s-r)/h;let l=1,u=!1;r+h>=i&&(l=(i-r)/h,u=!0);const d=this.cut(o,a,e.x,e.y,c,l);if(d&&t.pushPoints(d),u)break;n=!1}}else{if(r+h>i){const s=this.cut(o,a,e.x,e.y,0,(i-r)/h);s&&t.pushPoint(s[1]);break}t.pushXY(e.x,e.y)}r+=h,o=e.x,a=e.y}else o=e.x,a=e.y}return!0}getCIMPointAlong(t,e){if(!t.nextPoint())return null;let s,i,r,n,o=0;for(s=t.x,i=t.y;t.nextPoint();s=r,i=n){r=t.x,n=t.y;const a=this.getLength(s,i,r,n);if(0!==a){if(o+a>e){const t=(e-o)/a;return this.getCoord2D(s,i,r,n,t)}o+=a}}return null}offset(t,e,s,i,r){if(!t||t.length<2)return null;let n=0,o=t[n++],a=n;for(;n<t.length;){const e=t[n];e[0]===o[0]&&e[1]===o[1]||(n!==a&&(t[a]=t[n]),o=t[a++]),n++}const h=t[0][0]===t[a-1][0]&&t[0][1]===t[a-1][1];if(h&&--a,a<(h?3:2))return null;const c=[];o=h?t[a-1]:null;let l=t[0];for(let r=0;r<a;r++){const n=r===a-1?h?t[0]:null:t[r+1];if(o)if(n){const t=[n[0]-l[0],n[1]-l[1]];this.normalize(t);const r=[l[0]-o[0],l[1]-o[1]];this.normalize(r);const a=r[0]*t[1]-r[1]*t[0],h=r[0]*t[0]+r[1]*t[1];if(0===a&&1===h){l=n;continue}if(a>=0==e<=0){if(h<1){const s=[t[0]-r[0],t[1]-r[1]];this.normalize(s);const n=Math.sqrt((1+h)/2);if(n>1/i){const t=-Math.abs(e)/n;c.push([l[0]-s[0]*t,l[1]-s[1]*t])}}}else switch(s){case"Mitered":{const s=Math.sqrt((1+h)/2);if(s>0&&1/s<i){const i=[t[0]-r[0],t[1]-r[1]];this.normalize(i);const n=Math.abs(e)/s;c.push([l[0]-i[0]*n,l[1]-i[1]*n]);break}}case"Bevelled":c.push([l[0]+r[1]*e,l[1]-r[0]*e]),c.push([l[0]+t[1]*e,l[1]-t[0]*e]);break;case"Rounded":if(h<1){c.push([l[0]+r[1]*e,l[1]-r[0]*e]);const s=Math.floor(2.5*(1-h));if(s>0){const i=1/s;let n=i;for(let o=1;o<s;o++,n+=i){const s=[r[1]*(1-n)+t[1]*n,-r[0]*(1-n)-t[0]*n];this.normalize(s),c.push([l[0]+s[0]*e,l[1]+s[1]*e])}}c.push([l[0]+t[1]*e,l[1]-t[0]*e])}break;default:if(a<0)c.push([l[0]+(r[1]+r[0])*e,l[1]+(r[1]-r[0])*e]),c.push([l[0]+(t[1]-t[0])*e,l[1]-(t[0]+t[1])*e]);else{const s=Math.sqrt((1+Math.abs(h))/2),i=[t[0]-r[0],t[1]-r[1]];this.normalize(i);const n=e/s;c.push([l[0]-i[0]*n,l[1]-i[1]*n])}}}else{const t=[l[0]-o[0],l[1]-o[1]];this.normalize(t),c.push([l[0]+t[1]*e,l[1]-t[0]*e])}else{const t=[n[0]-l[0],n[1]-l[1]];this.normalize(t),c.push([l[0]+t[1]*e,l[1]-t[0]*e])}o=l,l=n}return c.length<(h?3:2)?null:(h&&c.push([c[0][0],c[0][1]]),c)}}class Wt{static{this.instance=null}static local(){return null===Wt.instance&&(Wt.instance=new Wt),Wt.instance}execute(t,e,s,i,r){return new Ut(t,e,s)}}class Ut extends Nt{constructor(t,e,s){super(t,!1,!0),this._curveHelper=new qt,this._width=(void 0!==e.width?e.width:5)*s,this._arrowType=void 0!==e.geometricEffectArrowType?e.geometricEffectArrowType:void 0!==e.arrowType?e.arrowType:"OpenEnded",this._offsetFlattenError=Bt*s}processPath(t){const e=Pt.createEmptyOptimizedCIM(t.geometryType);switch(this._arrowType){case"OpenEnded":default:this._constructSimpleArrow(e,t,!0);break;case"Block":this._constructSimpleArrow(e,t,!1);break;case"Crossed":this._constructCrossedArrow(e,t)}return e}_constructSimpleArrow(t,e,s){const i=e.pathLength();let r=this._width;i<2*r&&(r=i/2);const n=this._curveHelper.getSubCurve(e,0,i-r);if(!n||!n.nextPath())return;n.seekPathStart();const o=r/2;if(this._curveHelper.isEmpty(n))return;const a=(0,vt.A)(n),h=this._constructOffset(a,-o);if(!h)return;const c=this._constructOffset(a,o);if(!c)return;const l=this._constructArrowBasePoint(h,-o/2);if(!l)return;const u=this._constructArrowBasePoint(c,o/2);if(!u)return;e.seekInPath(e.pathSize-1);const d=[e.x,e.y];t.pushPath(c),t.nextPath(),t.nextPoint(),t.setControlPoint(),t.pushPoint(u),t.nextPoint(),t.setControlPoint(),t.pushPoint(d),t.nextPoint(),t.setControlPoint(),t.pushPoint(l),t.nextPoint(),t.setControlPoint(),t.pushPoints(h.reverse()),t.setControlPoint(),s||(t.setControlPointAt(0),t.setControlPointAt(t.pathSize-1),t.pushPoint(c[0])),t.reset()}_constructCrossedArrow(t,e){const s=e.pathLength();let i=this._width;s<3.732050807568877*i&&(i=s/3.732050807568877),e.seekPathStart();const r=this._curveHelper.getSubCurve(e,0,s-2.732050807568877*i);if(!r)return;r.nextPath();const n=i/2;if(this._curveHelper.isEmpty(r))return;const o=(0,vt.A)(r),a=this._constructOffset(o,n);if(!a)return;const h=this._constructOffset(o,-n);if(!h)return;const c=this._curveHelper.getSubCurve(e,0,s-i);if(!c)return;if(c.nextPath(),this._curveHelper.isEmpty(c))return;const l=(0,vt.A)(c),u=this._constructOffset(l,n);if(!u)return;const d=this._constructOffset(l,-n);if(!d)return;const _=u[u.length-1],p=this._constructArrowBasePoint(u,n/2);if(!p)return;const f=d[d.length-1],m=this._constructArrowBasePoint(d,-n/2);if(!m)return;e.seekInPath(e.pathSize-1);const g=[e.x,e.y];t.pushPath(a),t.nextPath(),t.nextPoint(),t.setControlPoint(),t.pushPoint(f),t.nextPoint(),t.setControlPoint(),t.pushPoint(m),t.nextPoint(),t.setControlPoint(),t.pushPoint(g),t.nextPoint(),t.setControlPoint(),t.pushPoint(p),t.nextPoint(),t.setControlPoint(),t.pushPoint(_),t.nextPoint(),t.setControlPoint(),t.pushPoints(h.reverse()),t.nextPoint(),t.setControlPoint(),t.reset()}_constructOffset(t,e){return this._curveHelper.offset(t,e,"Rounded",4,this._offsetFlattenError)}_constructArrowBasePoint(t,e){if(!t||t.length<2)return null;const s=t[t.length-2],i=t[t.length-1],r=[i[0]-s[0],i[1]-s[1]];return this._curveHelper.normalize(r),[i[0]+r[1]*e,i[1]-r[0]*e]}}var Yt=s(6774);let jt;class Vt{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}}function Xt(t,e,s){if(!t)return null;jt||(jt=new Yt.O3(0,0,0,1));const i=s?-1:1,r="esriGeometryPolygon"===t.geometryType,n=r?3:2,o=r?3:2;let a,h;for(jt.reset(n),jt.setPixelMargin(e+1),jt.setExtent(512);t.nextPath();)if(!(t.pathSize<o)){for(t.nextPoint(),a=t.x,h=i*t.y,jt.moveTo(a,h);t.nextPoint();)a=t.x,h=i*t.y,jt.lineTo(a,h);r&&jt.close()}const c=jt.result(!1);if(c){const e=Pt.createEmptyOptimizedCIM(t.geometryType);for(const t of c){e.startPath();for(const s of t)e.pushXY(s.x,i*s.y)}return e.reset(),e}return null}class Ht{static{this.instance=null}static local(){return null===Ht.instance&&(Ht.instance=new Ht),Ht.instance}execute(t,e,s,i,r,n,o){return new Zt(t,e,s,i,r,n,o)}}class Zt{constructor(t,e,s,i,r,n,o){this._preventClipping=o,this._inputGeometries=t,this._tileKey=i,this._geometryEngine=r,this._curveHelper=new qt,this._size=(void 0!==e.size?e.size:1)*s,this._maxInflateSize=n*s,this._offsetFlattenError=Bt*s}next(){let t;for(;t=this._inputGeometries.next();){if(0===this._size)return t;if("esriGeometryEnvelope"===t.geometryType)if(this._size>0){const e=Pt.createEmptyOptimizedCIM(t.geometryType),s=(0,vt.x)(t)[0],i=this._curveHelper.offset(s,this._size,"Rounded",4,this._offsetFlattenError);if(i)return e.pushPath(i),e}else if(this._size<0){const e=t.asJSON();if(Math.min(e.xmax-e.xmin,e.ymax-e.ymin)+2*this._size>0)return Pt.fromJSONCIM({xmin:e.xmin-this._size,xmax:e.xmax+this._size,ymin:e.ymin-this._size,ymax:e.ymax+this._size})}const e=this._geometryEngine;if(null==e)return null;const s=!this._preventClipping&&this._tileKey?Xt(t,this._maxInflateSize,!0):t;if(!s)continue;const i=e.buffer(y.A.WebMercator,s.asJSON(),this._size,1);return i?Pt.fromJSONCIM(i):null}return null}}var $t=s(95108);class Qt{static{this.instance=null}static local(){return null===Qt.instance&&(Qt.instance=new Qt),Qt.instance}execute(t,e,s,i,r){return new Jt(t,e,s)}}class Jt{constructor(t,e,s){this._defaultPointSize=20,this._inputGeometries=t,this._geomUnitsPerPoint=s,this._rule=e.rule??"FullGeometry",this._defaultSize=this._defaultPointSize*s}next(){let t;for(;t=this._inputGeometries.next();){const e=this._processGeom((0,vt.x)(t));if(e?.length)return Pt.fromJSONCIM({paths:e})}return null}_clone(t){return[t[0],t[1]]}_mid(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}_mix(t,e,s,i){return[t[0]*e+s[0]*i,t[1]*e+s[1]*i]}_add(t,e){return[t[0]+e[0],t[1]+e[1]]}_add2(t,e,s){return[t[0]+e,t[1]+s]}_sub(t,e){return[t[0]-e[0],t[1]-e[1]]}_dist(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}_norm(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}_normalize(t,e=1){const s=e/this._norm(t);t[0]*=s,t[1]*=s}_leftPerpendicular(t){const e=-t[1],s=t[0];t[0]=e,t[1]=s}_leftPerp(t){return[-t[1],t[0]]}_rightPerpendicular(t){const e=t[1],s=-t[0];t[0]=e,t[1]=s}_rightPerp(t){return[t[1],-t[0]]}_dotProduct(t,e){return t[0]*e[0]+t[1]*e[1]}_crossProduct(t,e){return t[0]*e[1]-t[1]*e[0]}_rotateDirect(t,e,s){const i=t[0]*e-t[1]*s,r=t[0]*s+t[1]*e;t[0]=i,t[1]=r}_makeCtrlPt(t){const e=[t[0],t[1]];return Dt(e,1),e}_addAngledTicks(t,e,s,i){const r=this._sub(s,e);this._normalize(r);const n=this._crossProduct(r,this._sub(i,e));let o;o=n>0?this._rightPerp(r):this._leftPerp(r);const a=Math.abs(n)/2,h=[];h.push([e[0]+(o[0]-r[0])*a,e[1]+(o[1]-r[1])*a]),h.push(e),h.push(s),h.push([s[0]+(o[0]+r[0])*a,s[1]+(o[1]+r[1])*a]),t.push(h)}_addBezier2(t,e,s,i,r){if(0===r--)return void t.push(i);const n=this._mid(e,s),o=this._mid(s,i),a=this._mid(n,o);this._addBezier2(t,e,n,a,r),this._addBezier2(t,a,o,i,r)}_addBezier3(t,e,s,i,r,n){if(0===n--)return void t.push(r);const o=this._mid(e,s),a=this._mid(s,i),h=this._mid(i,r),c=this._mid(o,a),l=this._mid(a,h),u=this._mid(c,l);this._addBezier3(t,e,o,c,u,n),this._addBezier3(t,u,l,h,r,n)}_add90DegArc(t,e,s,i,r){const n=r??this._crossProduct(this._sub(s,e),this._sub(i,e))>0,o=this._mid(e,s),a=this._sub(o,e);n?this._leftPerpendicular(a):this._rightPerpendicular(a),o[0]+=a[0],o[1]+=a[1],this._addBezier3(t,e,this._mix(e,.33333,o,.66667),this._mix(s,.33333,o,.66667),s,4)}_addArrow(t,e,s){const i=e[0],r=e[1],n=e[e.length-1],o=this._sub(i,r),a=this._norm(o);this._normalize(o);const h=Math.abs(this._crossProduct(o,this._sub(n,r)));let c=this._dotProduct(o,this._sub(n,r));c<.05*a?c=.05*a:c>.95*a&&(c=.95*a);const l=.5*h,u=this._leftPerp(o),d=[r[0]+o[0]*c,r[1]+o[1]*c],_=e.length-1,p=[];p.push(s?[-u[0],-u[1]]:u);let f=[-o[0],-o[1]];for(let t=1;t<_-1;t++){const s=this._sub(e[t+1],e[t]);this._normalize(s);const i=this._dotProduct(s,f),r=this._crossProduct(s,f),n=Math.sqrt((1+i)/2),o=this._sub(s,f);this._normalize(o),o[0]/=n,o[1]/=n,p.push(r<0?[-o[0],-o[1]]:o),f=s}p.push(this._rightPerp(f));for(let s=p.length-1;s>0;s--)t.push([e[s][0]+p[s][0]*l,e[s][1]+p[s][1]*l]);t.push([d[0]+p[0][0]*l,d[1]+p[0][1]*l]),t.push([d[0]+p[0][0]*h,d[1]+p[0][1]*h]),t.push(i),t.push([d[0]-p[0][0]*h,d[1]-p[0][1]*h]),t.push([d[0]-p[0][0]*l,d[1]-p[0][1]*l]);for(let s=1;s<p.length;s++)t.push([e[s][0]-p[s][0]*l,e[s][1]-p[s][1]*l])}_addDash(t,e,s){const i=this._norm(s)/7;this._normalize(s);let r=[];for(let n=0;n<=7;n++)r.push([e[0]+s[0]*n*i,e[1]+s[1]*n*i]),1&n&&(t.push(r),r=[])}_cp2(t,e,s){return t.length>=2?t[1]:this._add2(t[0],e*this._defaultSize,s*this._defaultSize)}_cp3(t,e,s,i){if(t.length>=3)return t[2];const r=this._mix(t[0],1-s,e,s),n=this._sub(e,t[0]);return this._normalize(n),this._rightPerpendicular(n),[r[0]+n[0]*i*this._defaultSize,r[1]+n[1]*i*this._defaultSize]}_arrowPath(t){if(t.length>2)return t;const e=t[0],s=this._cp2(t,-4,0),i=this._sub(e,s);this._normalize(i);const r=this._rightPerp(i);return[e,s,[e[0]+(r[0]-i[0])*this._defaultSize,e[1]+(r[1]-i[1])*this._defaultSize]]}_arrowLastSeg(t){const e=t[0],s=this._cp2(t,-4,0);let i;if(t.length>=3)i=t[t.length-1];else{const t=this._sub(e,s);this._normalize(t);const r=this._rightPerp(t);i=[e[0]+(r[0]-t[0])*this._defaultSize,e[1]+(r[1]-t[1])*this._defaultSize]}return[s,i]}_processGeom(t){if(!t)return null;const e=[];for(const s of t){const t=s.length>1&&(0,$t.Yl)(s)<this._defaultSize;if(!s||0===s.length||t)continue;const i=s.length;let r=s[0];switch(this._rule){case"PerpendicularFromFirstSegment":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,4),n=[];n.push(i),n.push(this._mid(r,t)),e.push(n);break}case"ReversedFirstSegment":{const t=this._cp2(s,0,-1);e.push([t,r]);break}case"PerpendicularToSecondSegment":{if(s.length<3)return[];const t=this._cp2(s,-4,1),i=this._cp3(s,t,.882353,-1.94),n=[];n.push(this._mid(t,i)),n.push(r),e.push(n);break}case"SecondSegmentWithTicks":{if(s.length<3)return[];const t=this._cp2(s,-4,1),i=this._cp3(s,t,.882353,-1.94),n=this._sub(i,t);let o;o=this._crossProduct(n,this._sub(r,t))>0?this._rightPerp(n):this._leftPerp(n);const a=[];a.push([t[0]+(o[0]-n[0])/3,t[1]+(o[1]-n[1])/3]),a.push(t),a.push(i),a.push([i[0]+(o[0]+n[0])/3,i[1]+(o[1]+n[1])/3]),e.push(a);break}case"DoublePerpendicular":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,3),n=this._mid(r,t),o=this._sub(n,i);this._normalize(o);const a=this._crossProduct(o,this._sub(r,i));this._leftPerpendicular(o);const h=[];h.push(r),h.push([i[0]+o[0]*a,i[1]+o[1]*a]),e.push(h);const c=[];c.push([i[0]-o[0]*a,i[1]-o[1]*a]),c.push(t),e.push(c);break}case"OppositeToFirstSegment":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,3),n=this._mid(r,t),o=this._sub(n,i);this._normalize(o);const a=this._crossProduct(o,this._sub(r,i));this._leftPerpendicular(o);const h=[];h.push([i[0]+o[0]*a,i[1]+o[1]*a]),h.push([i[0]-o[0]*a,i[1]-o[1]*a]),e.push(h);break}case"TriplePerpendicular":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,4),n=this._mid(r,t),o=this._sub(n,i);this._normalize(o);const a=this._crossProduct(o,this._sub(r,i));this._leftPerpendicular(o);const h=[];h.push([i[0]+o[0]*a*.8,i[1]+o[1]*a*.8]),h.push([n[0]+.8*(r[0]-n[0]),n[1]+.8*(r[1]-n[1])]),e.push(h),e.push([i,n]);const c=[];c.push([i[0]-o[0]*a*.8,i[1]-o[1]*a*.8]),c.push([n[0]+.8*(t[0]-n[0]),n[1]+.8*(t[1]-n[1])]),e.push(c);break}case"HalfCircleFirstSegment":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,4),n=this._mid(r,t);let o=this._sub(t,r);const a=Math.cos(Math.PI/18),h=Math.sin(Math.PI/18),c=Math.sqrt((1+a)/2),l=Math.sqrt((1-a)/2),u=[];let d;this._crossProduct(o,this._sub(i,r))>0?(u.push(r),o=this._sub(r,n),d=t):(u.push(t),o=this._sub(t,n),d=r),this._rotateDirect(o,c,l),o[0]/=c,o[1]/=c;for(let t=1;t<=18;t++)u.push(this._add(n,o)),this._rotateDirect(o,a,h);u.push(d),e.push(u);break}case"HalfCircleSecondSegment":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,1,-1);let n=this._sub(r,t);this._normalize(n);const o=this._crossProduct(n,this._sub(i,t))/2;this._leftPerpendicular(n);const a=[t[0]+n[0]*o,t[1]+n[1]*o];n=this._sub(t,a);const h=Math.cos(Math.PI/18);let c=Math.sin(Math.PI/18);o>0&&(c=-c);const l=[t];for(let t=1;t<=18;t++)this._rotateDirect(n,h,c),l.push(this._add(a,n));e.push(l);break}case"HalfCircleExtended":{const t=this._cp2(s,0,-2),n=this._cp3(s,t,1,-1);let o;if(i>=4)o=s[3];else{const e=this._sub(r,t);o=this._add(n,e)}const a=this._dist(t,n)/2/.75,h=this._sub(t,r);this._normalize(h,a);const c=this._sub(n,o);this._normalize(c,a);const l=[o,n];e.push(l);const u=[this._clone(n)];this._addBezier3(u,n,this._add(n,c),this._add(t,h),t,4),u.push(r),e.push(u);break}case"OpenCircle":{const t=this._cp2(s,-2,0),i=this._sub(t,r),n=Math.cos(Math.PI/18),o=-Math.sin(Math.PI/18),a=[t];for(let t=1;t<=33;t++)this._rotateDirect(i,n,o),a.push(this._add(r,i));e.push(a);break}case"CoverageEdgesWithTicks":{const t=this._cp2(s,0,-1);let n,o;if(i>=3)n=s[2];else{const e=this._sub(t,r),s=this._leftPerp(e);n=[r[0]+s[0]-.25*e[0],r[1]+s[1]-.25*e[1]]}if(i>=4)o=s[3];else{const e=this._mid(r,t),s=this._sub(r,t);this._normalize(s),this._leftPerpendicular(s);const i=this._crossProduct(s,this._sub(n,e));this._rightPerpendicular(s),o=[n[0]+s[0]*i*2,n[1]+s[1]*i*2]}const a=this._sub(t,r);let h,c;h=this._crossProduct(a,this._sub(n,r))>0?this._rightPerp(a):this._leftPerp(a),c=[],c.push(n),c.push(r),c.push([r[0]+(h[0]-a[0])/3,r[1]+(h[1]-a[1])/3]),e.push(c),h=this._crossProduct(a,this._sub(o,t))>0?this._rightPerp(a):this._leftPerp(a),c=[],c.push([t[0]+(h[0]+a[0])/3,t[1]+(h[1]+a[1])/3]),c.push(t),c.push(o),e.push(c);break}case"GapExtentWithDoubleTicks":{const t=this._cp2(s,0,2),n=this._cp3(s,t,0,1);let o;if(i>=4)o=s[3];else{const e=this._sub(t,r);o=this._add(n,e)}this._addAngledTicks(e,r,t,this._mid(n,o)),this._addAngledTicks(e,n,o,this._mid(r,t));break}case"GapExtentMidline":{const t=this._cp2(s,2,0),n=this._cp3(s,t,0,1);let o;if(i>=4)o=s[3];else{const e=this._sub(t,r);o=this._add(n,e)}const a=[];a.push(this._mid(r,n)),a.push(this._mid(t,o)),e.push(a);break}case"Chevron":{const t=this._cp2(s,-1,-1);let n;if(i>=3)n=s[2];else{const e=this._sub(t,r);this._leftPerpendicular(e),n=this._add(r,e)}e.push([t,this._makeCtrlPt(r),n]);break}case"PerpendicularWithArc":{const t=this._cp2(s,0,-2),n=this._cp3(s,t,.5,-1),o=this._sub(t,r),a=this._norm(o);o[0]/=a,o[1]/=a;const h=this._crossProduct(o,this._sub(n,r));let c=this._dotProduct(o,this._sub(n,r));c<.05*a?c=.05*a:c>.95*a&&(c=.95*a);const l=[r[0]+o[0]*c,r[1]+o[1]*c];let u=this._leftPerp(o),d=[];if(d.push([l[0]-u[0]*h,l[1]-u[1]*h]),d.push([l[0]+u[0]*h,l[1]+u[1]*h]),e.push(d),i>=4){const t=s[3];let i=this._dotProduct(o,this._sub(t,r));i<.1*a?i=.1*a:i>.9*a&&(i=.9*a);const n=[r[0]+o[0]*i,r[1]+o[1]*i],h=this._crossProduct(o,this._sub(t,r)),c=[];c.push([n[0]-u[0]*h,n[1]-u[1]*h]),c.push([n[0]+u[0]*h,n[1]+u[1]*h]),e.push(c)}const _=[t[0]+u[0]*h,t[1]+u[1]*h];u=this._sub(t,_);const p=Math.cos(Math.PI/18);let f=Math.sin(Math.PI/18);h<0&&(f=-f),d=[r,t];for(let t=1;t<=9;t++)this._rotateDirect(u,p,f),d.push(this._add(_,u));e.push(d);break}case"ClosedHalfCircle":{const t=this._cp2(s,2,0),i=this._mid(r,t),n=this._sub(t,i),o=Math.cos(Math.PI/18),a=Math.sin(Math.PI/18),h=[r,t];for(let t=1;t<=18;t++)this._rotateDirect(n,o,a),h.push(this._add(i,n));e.push(h);break}case"TripleParallelExtended":{const t=this._cp2(s,0,-2),i=this._cp3(s,t,1,-2),n=this._mid(r,t),o=this._sub(i,t);this._normalize(o);const a=Math.abs(this._crossProduct(o,this._sub(n,t)))/2,h=this._dist(t,i),c=[t,r];c.push([r[0]+o[0]*h*.5,r[1]+o[1]*h*.5]),e.push(c);const l=[];l.push([n[0]-o[0]*a,n[1]-o[1]*a]),l.push([n[0]+o[0]*h*.375,n[1]+o[1]*h*.375]),Dt(l[l.length-1],1),l.push([n[0]+o[0]*h*.75,n[1]+o[1]*h*.75]),e.push(l);const u=[t,i];e.push(u);break}case"ParallelWithTicks":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(i,t);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n),this._addAngledTicks(e,r,t,i),this._addAngledTicks(e,this._mix(r,1,n,o),this._mix(t,1,n,o),this._mid(r,t));break}case"Parallel":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(t,r);this._normalize(n);const o=this._leftPerp(n),a=this._crossProduct(n,this._sub(i,r));let h=[r,t];e.push(h),h=[],h.push([r[0]+o[0]*a,r[1]+o[1]*a]),h.push([t[0]+o[0]*a,t[1]+o[1]*a]),e.push(h);break}case"PerpendicularToFirstSegment":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._mid(r,t),o=this._sub(t,r);this._normalize(o);const a=this._crossProduct(o,this._sub(i,r));this._leftPerpendicular(o);const h=[];h.push([n[0]-o[0]*a*.25,n[1]-o[1]*a*.25]),h.push([n[0]+o[0]*a*1.25,n[1]+o[1]*a*1.25]),e.push(h);break}case"ParallelOffset":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(t,r);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n);const a=[];a.push([r[0]-n[0]*o,r[1]-n[1]*o]),a.push([t[0]-n[0]*o,t[1]-n[1]*o]),e.push(a);const h=[];h.push([r[0]+n[0]*o,r[1]+n[1]*o]),h.push([t[0]+n[0]*o,t[1]+n[1]*o]),e.push(h);break}case"OffsetOpposite":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(t,r);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n);const a=[];a.push([r[0]-n[0]*o,r[1]-n[1]*o]),a.push([t[0]-n[0]*o,t[1]-n[1]*o]),e.push(a);break}case"OffsetSame":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(t,r);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n);const a=[];a.push([r[0]+n[0]*o,r[1]+n[1]*o]),a.push([t[0]+n[0]*o,t[1]+n[1]*o]),e.push(a);break}case"CircleWithArc":{let t=this._cp2(s,3,0);const n=this._cp3(s,t,.5,-1);let o,a;if(i>=4)o=s[3],a=this._crossProduct(this._sub(o,t),this._sub(n,t))>0;else{o=t,a=this._crossProduct(this._sub(o,r),this._sub(n,r))>0;const e=24*this._geomUnitsPerPoint,s=this._sub(o,r);this._normalize(s,e);const i=Math.sqrt(2)/2;this._rotateDirect(s,i,a?i:-i),t=this._add(r,s)}const h=this._sub(t,r),c=Math.cos(Math.PI/18),l=Math.sin(Math.PI/18),u=[t];for(let t=1;t<=36;t++)this._rotateDirect(h,c,l),u.push(this._add(r,h));this._add90DegArc(u,t,o,n,a),Dt(u[u.length-8],1),e.push(u);break}case"DoubleJog":{let t,n=this._cp2(s,-3,1),o=this._cp3(s,n,-1,-.5);if(i>=4)t=s[3];else{const e=r;r=n,t=o;const s=this._dist(r,e),i=this._dist(t,e);let a=30*this._geomUnitsPerPoint;.5*s<a&&(a=.5*s),.5*i<a&&(a=.5*i),n=this._mix(r,a/s,e,(s-a)/s),o=this._mix(t,a/i,e,(i-a)/i)}const a=this._mid(r,n),h=this._mid(t,o),c=this._dist(r,n),l=this._dist(o,t);let u=Math.min(c,l)/8;u=Math.min(u,24*this._geomUnitsPerPoint);const d=Math.cos(Math.PI/4);let _=this._sub(r,n);this._normalize(_,u),this._crossProduct(_,this._sub(t,n))>0?this._rotateDirect(_,d,-d):this._rotateDirect(_,d,d);let p=[];p.push(n),p.push(this._add(a,_)),p.push(this._sub(a,_)),p.push(r),e.push(p),_=this._sub(t,o),this._normalize(_,u),this._crossProduct(_,this._sub(r,o))<0?this._rotateDirect(_,d,d):this._rotateDirect(_,d,-d),p=[],p.push(o),p.push(this._add(h,_)),p.push(this._sub(h,_)),p.push(t),e.push(p);break}case"PerpendicularOffset":{const t=this._cp2(s,-4,1),i=this._cp3(s,t,.882353,-1.94),n=this._sub(i,t);this._crossProduct(n,this._sub(r,t))>0?this._rightPerpendicular(n):this._leftPerpendicular(n);const o=[n[0]/8,n[1]/8],a=this._sub(this._mid(t,i),o);e.push([a,r]);break}case"LineExcludingLastSegment":{const t=this._arrowPath(s),i=[];let r=t.length-2;for(;r--;)i.push(t[r]);e.push(i);break}case"MultivertexArrow":{const t=this._arrowPath(s),i=[];this._addArrow(i,t,!1),e.push(i);break}case"CrossedArrow":{const t=this._arrowPath(s),i=[];this._addArrow(i,t,!0),e.push(i);break}case"ChevronArrow":{const[t,i]=this._arrowLastSeg(s),n=10*this._geomUnitsPerPoint,o=this._sub(r,t),a=this._norm(o);this._normalize(o);const h=this._crossProduct(o,this._sub(i,t));let c=this._dotProduct(o,this._sub(i,t));c<.05*a?c=.05*a:c>.95*a-n&&(c=.95*a-n);const l=[t[0]+o[0]*c,t[1]+o[1]*c],u=this._leftPerp(o),d=[];d.push([l[0]+u[0]*h+o[0]*n,l[1]+u[1]*h+o[1]*n]),d.push(r),d.push([l[0]-u[0]*h+o[0]*n,l[1]-u[1]*h+o[1]*n]),e.push(d);break}case"ChevronArrowOffset":{const[t,i]=this._arrowLastSeg(s),n=this._sub(r,t),o=this._norm(n);this._normalize(n);const a=this._crossProduct(n,this._sub(i,t));let h=this._dotProduct(n,this._sub(i,t));h<.05*o?h=.05*o:h>.95*o&&(h=.95*o);const c=[t[0]+n[0]*h,t[1]+n[1]*h];this._leftPerpendicular(n);const l=[];l.push([c[0]+n[0]*a*.5,c[1]+n[1]*a*.5]),l.push(this._mid(c,r)),l.push([c[0]-n[0]*a*.5,c[1]-n[1]*a*.5]),e.push(l);break}case"PartialFirstSegment":{const[t,i]=this._arrowLastSeg(s),n=this._sub(r,t),o=this._norm(n);this._normalize(n);let a=this._dotProduct(n,this._sub(i,t));a<.05*o?a=.05*o:a>.95*o&&(a=.95*o);const h=[t[0]+n[0]*a,t[1]+n[1]*a];e.push([t,h]);break}case"Arch":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,1),n=this._sub(r,t),o=this._mix(i,1,n,.55),a=this._mix(i,1,n,-.55),h=[r];this._addBezier2(h,r,o,i,4),this._addBezier2(h,i,a,t,4),e.push(h);break}case"CurvedParallelTicks":{const t=this._cp2(s,-4,1),i=this._cp3(s,t,.882353,-1.94),n=this._sub(i,t);this._crossProduct(n,this._sub(r,t))>0?this._rightPerpendicular(n):this._leftPerpendicular(n);const o=[n[0]/8,n[1]/8],a=this._sub(this._mid(t,i),o),h=this._sub(this._mix(t,.75,i,.25),o),c=this._sub(this._mix(t,.25,i,.75),o),l=[t];this._addBezier2(l,t,h,a,3),this._addBezier2(l,a,c,i,3),e.push(l);for(let t=0;t<8;t++){const s=l[2*t+1],i=[this._clone(s)];i.push(this._add(s,[n[0]/4,n[1]/4])),e.push(i)}break}case"Arc90Degrees":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,1),n=[t];this._add90DegArc(n,t,r,i),e.push(n);break}case"TipWithPerpendicularAndTicks":{const[t,i]=this._arrowLastSeg(s),n=10*this._geomUnitsPerPoint,o=this._sub(r,t),a=this._norm(o);this._normalize(o);let h=this._crossProduct(o,this._sub(i,t)),c=this._dotProduct(o,this._sub(i,t));c<.05*a?c=.05*a:c>.95*a-n&&(c=.95*a-n);const l=this._leftPerp(o),u=[r[0]-o[0]*n,r[1]-o[1]*n],d=.5*Math.max(a-c-n,n);h=Math.abs(h);const _=[];_.push([u[0]+l[0]*(h+d)-o[0]*d,u[1]+l[1]*(h+d)-o[1]*d]),_.push([u[0]+l[0]*h,u[1]+l[1]*h]),_.push([u[0]-l[0]*h,u[1]-l[1]*h]),_.push([u[0]-l[0]*(h+d)-o[0]*d,u[1]-l[1]*(h+d)-o[1]*d]),e.push(_),e.push([u,r]);break}case"ConcentricCircles":{const t=this._cp2(s,1,0),n=this._cp3(s,t,2,0),o=Math.cos(Math.PI/18),a=Math.sin(Math.PI/18);let h=this._dist(t,r),c=[h,0],l=[];for(let t=0;t<=36;t++)l.push(this._add(r,c)),this._rotateDirect(c,o,a);if(e.push(l),i>=4){l=[];const t=s[3];h=this._dist(t,r),c=[h,0];for(let t=0;t<=36;t++)l.push(this._add(r,c)),0===t&&(l.push(this._add(r,c)),Dt(l[1],1)),this._rotateDirect(c,o,a);e.push(l)}l=[],h=this._dist(n,r),c=[h,0];for(let t=0;t<=36;t++)l.push(this._add(r,c)),this._rotateDirect(c,o,a);e.push(l);break}case"DoubleJogArrow":{r=this._arrowPath(s)[0];const[t,i]=this._arrowLastSeg(s),n=this._sub(r,t),o=this._norm(n);this._normalize(n);const a=Math.abs(this._crossProduct(n,this._sub(i,r)));let h=Math.abs(this._dotProduct(n,this._sub(i,r)));h<.05*o?h=.05*o:h>.95*o&&(h=.95*o);const c=Math.max(a,h),l=this._leftPerp(n);let u=[];const d=[r[0]-n[0]*h*.5+l[0]*a*.5,r[1]-n[1]*h*.5+l[1]*a*.5];u.push([d[0],d[1]]),d[0]+=n[0]*c*.5+l[0]*c*.4,d[1]+=n[1]*c*.5+l[1]*c*.4,u.push([d[0],d[1]]),d[0]-=l[0]*c*.25,d[1]-=l[1]*c*.25,u.push([d[0],d[1]]),d[0]+=n[0]*c*.5+l[0]*c*.4,d[1]+=n[1]*c*.5+l[1]*c*.4,u.push([d[0],d[1]]),e.push(u),u=[],d[0]=r[0]-n[0]*h*.5-l[0]*a*.5,d[1]=r[1]-n[1]*h*.5-l[1]*a*.5,u.push([d[0],d[1]]),d[0]+=n[0]*c*.5-l[0]*c*.4,d[1]+=n[1]*c*.5-l[1]*c*.4,u.push([d[0],d[1]]),d[0]+=l[0]*c*.25,d[1]+=l[1]*c*.25,u.push([d[0],d[1]]),d[0]+=n[0]*c*.5-l[0]*c*.4,d[1]+=n[1]*c*.5-l[1]*c*.4,u.push([d[0],d[1]]),e.push(u);break}case"LinkedChevrons":{const t=this._cp2(s,-5,0),i=this._cp3(s,t,-.2,1),n=this._sub(r,t);this._normalize(n);const o=this._leftPerp(n),a=Math.abs(this._crossProduct(n,this._sub(i,t)));e.push([t,r]);const h=[];h.push([r[0]-n[0]*a+o[0]*a,r[1]-n[1]*a+o[1]*a]),h.push(r),h.push([r[0]-n[0]*a-o[0]*a,r[1]-n[1]*a-o[1]*a]),e.push(h),this._addDash(e,t,[-n[0]*a+o[0]*a,-n[1]*a+o[1]*a]),this._addDash(e,t,[-n[0]*a-o[0]*a,-n[1]*a-o[1]*a]);break}case"SegmentThenHalfCircle":{const t=this._cp2(s,2,0),n=this._cp3(s,t,1.5,0);let o;o=i>=4?s[3]:this._cp3(s,t,1.25,-.5);const a=this._sub(t,r);this._normalize(a);const h=.5*this._dist(t,n),c=this._crossProduct(a,this._sub(o,r))>0,l=Math.cos(Math.PI/18);let u=Math.sin(Math.PI/18);c&&(u=-u);const d=[r,t];a[0]*=h,a[1]*=h;const _=this._add(t,a);a[0]=-a[0],a[1]=-a[1];for(let t=1;t<=18;t++)this._rotateDirect(a,l,u),d.push(this._add(_,a));e.push(d);break}case"LineWithStraightTicks":{const t=this._cp2(s,-2,1),i=this._cp3(s,t,-1,-.5),n=this._sub(i,t);this._normalize(n);const o=this._dotProduct(n,this._sub(t,r)),a=this._dotProduct(n,this._sub(i,r));let h=[r];h.push([r[0]+n[0]*o,r[1]+n[1]*o]),h.push(t),e.push(h),h=[r],h.push([r[0]+n[0]*a,r[1]+n[1]*a]),h.push(i),e.push(h);break}case"DoubleCurve":{const t=this._cp2(s,-5,-1),i=this._cp3(s,t,2,0),n=Math.atan2(1,5),o=Math.cos(n),a=Math.sin(n),h=this._sub(t,r),c=this._dist(r,t);this._normalize(h),this._rotateDirect(h,o,-a);const l=[r];l.push([r[0]+h[0]*c*.5,r[1]+h[1]*c*.5]),Dt(l[1],1),l.push([r[0]+h[0]*c*.8,r[1]+h[1]*c*.8]),this._addBezier2(l,l[2],[r[0]+h[0]*c,r[1]+h[1]*c],t,3);const u=this._sub(i,t),d=this._dist(t,i);this._normalize(u),this._rotateDirect(u,o,-a),this._addBezier2(l,t,[i[0]-u[0]*d,i[1]-u[1]*d],[i[0]-u[0]*d*.8,i[1]-u[1]*d*.8],3),l.push(i),e.push(l);break}case"ParallelWithTicksByWidth":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,3),n=this._sub(t,r);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n),o>0?(this._addAngledTicks(e,r,[r[0]+n[0]*o,r[1]+n[1]*o],t),this._addAngledTicks(e,t,[t[0]+n[0]*o,t[1]+n[1]*o],r)):(this._addAngledTicks(e,[r[0]+n[0]*o,r[1]+n[1]*o],r,t),this._addAngledTicks(e,[t[0]+n[0]*o,t[1]+n[1]*o],r,t));break}case"EnclosingRoundedRectangle":{const t=this._cp2(s,3,-2),e=[Math.min(r[0],t[0]),Math.max(r[1],t[1])],i=[Math.max(r[0],t[0]),Math.min(r[1],t[1])],n=i[0]-e[0],o=e[1]-i[1],a=Math.min(n,o)/10,h=[];h.push([e[0]+a+.75*(n-2*a),e[1]]),h.push([i[0]-a,e[1]]),this._add90DegArc(h,[i[0]-a,e[1]],[i[0],e[1]-a],[i[0],e[1]]),h.push([i[0],i[1]+a]),this._add90DegArc(h,[i[0],i[1]+a],[i[0]-a,i[1]],i),h.push([e[0]+a,i[1]]),this._add90DegArc(h,[e[0]+a,i[1]],[e[0],i[1]+a],[e[0],i[1]]),h.push([e[0],e[1]-a]),this._add90DegArc(h,[e[0],e[1]-a],[e[0]+a,e[1]],e),h.push([e[0]+a+.75*(n-2*a),e[1]]);break}default:e.push(s)}}return e}}class Kt{static{this.instance=null}static local(){return null===Kt.instance&&(Kt.instance=new Kt),Kt.instance}execute(t,e,s,i,r){return new te(t,e,s)}}class te extends Nt{constructor(t,e,s){super(t,!0,!0),this._curveHelper=new qt,this._beginCut=(void 0!==e.beginCut?e.beginCut:1)*s,this._endCut=(void 0!==e.endCut?e.endCut:1)*s,this._middleCut=(void 0!==e.middleCut?e.middleCut:0)*s,this._invert=void 0!==e.invert&&e.invert,this._beginCut<0&&(this._beginCut=0),this._endCut<0&&(this._endCut=0),this._middleCut<0&&(this._middleCut=0)}processPath(t){const{_beginCut:e,_endCut:s,_middleCut:i}=this,r=t.pathLength(),n=Pt.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._invert){if(0!==e||0!==s||0!==i)if(e+s+i>=r)for(n.startPath();t.nextPoint();)n.pushXY(t.x,t.y);else this._curveHelper.appendSubCurve(n,t,0,e),this._curveHelper.appendSubCurve(n,t,.5*(r-i),.5*(r+i)),this._curveHelper.appendSubCurve(n,t,r-s,s)}else if(0===e&&0===s&&0===i)for(n.startPath();t.nextPoint();)n.pushXY(t.x,t.y);else e+s+i<r&&(0===i?this._curveHelper.appendSubCurve(n,t,e,r-s):(this._curveHelper.appendSubCurve(n,t,e,.5*(r-i)),this._curveHelper.appendSubCurve(n,t,.5*(r+i),r-s)));return 0===n.totalSize?null:n}}class ee{constructor(){this._values=[],this.extPtGap=0,this.ctrlPtGap=0,this._length=0,this._currentValue=0}isEmpty(){return 0===this._values.length}size(){return this._values.length}init(t,e,s=!0){if(this._setEmpty(),!t||0===t.length)return!1;for(let e=0;e<t.length;e++){let i=Math.abs(t[e]);s&&i<1e-7&&(i=1e-7),this._values.push(i),this._length+=i}return e&&1&t.length&&(this._length*=2),0!==this._length&&(this.ctrlPtGap=this.extPtGap=0,this._currentValue=-1,!0)}scale(t){const e=this._values?this._values.length:0;for(let s=0;s<e;++s)this._values[s]*=t;this._length*=t,this.extPtGap*=t,this.ctrlPtGap*=t}addValue(t){this._length+=t,this._values.push(t)}firstValue(){return this._values[0]}lastValue(){return this._values[this._values.length-1]}nextValue(){return this._currentValue++,this._currentValue===this._values.length&&(this._currentValue=0),this._values[this._currentValue]}reset(){this._currentValue=-1}length(){return this._length}_setEmpty(){this.extPtGap=this.ctrlPtGap=this._length=0,this._currentValue=-1,this._values.length=0}}class se{constructor(){this.pt=null,this.ca=0,this.sa=0}}class ie{constructor(){this.reset()}reset(){this.segment=null,this.segmentLength=0,this.abscissa=0,this.isPathEnd=!1,this.isPartEnd=!1}isValid(){return null!==this.segment}copyTo(t){t.segment=this.segment,t.segmentLength=this.segmentLength,t.abscissa=this.abscissa,t.isPathEnd=this.isPathEnd,t.isPartEnd=this.isPartEnd}}class re extends qt{constructor(t=0,e=!1){super(t,e),this._tempPos=new ie,this._tempPt=[0,0],this._tolerance=Bt,this._currentPosition=new ie}updateTolerance(t){this._tolerance=Bt*t}init(t,e,s=!0){return s?(this._patternLength=e.length(),this._partExtPtGap=e.extPtGap,this._partCtrlPtGap=e.ctrlPtGap):(this._patternLength=0,this._partExtPtGap=0,this._partCtrlPtGap=0),this._currentPosition.reset(),this._partSegCount=0,this._pathCursor=t,this._seg=-1,this._setPosAtNextPart()}curPositionIsValid(){return this._currentPosition.isValid()}nextPosition(t,e=0){const s=new ie;return!!this._nextPosition(t,s,null,e)&&(s.copyTo(this._currentPosition),!0)}curPointAndAngle(t){t.pt=this._getPoint(this._currentPosition);const[e,s]=this._getAngleCS(this._tempPt,this._currentPosition);t.ca=e,t.sa=s}nextPointAndAngle(t,e,s=0){const i=this._tempPos;if(!this._nextPosition(t,i,null,s))return!1;i.copyTo(this._currentPosition),e.pt=this._getPoint(i);const[r,n]=this._getAngleCS(this._tempPt,i);return e.ca=r,e.sa=n,!0}nextCurve(t){if(0===t)return null;const e=Pt.createEmptyOptimizedCIM("esriGeometryPolyline");e.startPath(),e.nextPath();const s=new ie;return this._nextPosition(t,s,e,1)?(s.copyTo(this._currentPosition),e):null}isPathEnd(){return this._currentPosition.isPathEnd}getPathEnd(){return this._currentPosition.segment[1]}getPt(t){return this._pathCursor.seekInPath(t),[this._pathCursor.x,this._pathCursor.y]}getSeg(t){return[this.getPt(t),this.getPt(t+1)]}_nextPosition(t,e,s,i){if(this._currentPosition.isPathEnd)return!1;let r=this._currentPosition.abscissa;for(this._currentPosition.segmentLength>0&&(r/=this._currentPosition.segmentLength),this._currentPosition.copyTo(e);e.abscissa+t*this._partLengthRatio>e.segmentLength+this._tolerance;){if(s){if(0===s.pathSize)if(0===r){const t=e.segment[0];s.pushXY(t[0],t[1])}else s.pushPoint(this.getSegCoord2D(e.segment,r));const t=e.segment[1];s.pushXY(t[0],t[1])}if(r=0,t-=(e.segmentLength-e.abscissa)/this._partLengthRatio,this._partSegCount)e.segment=this._nextSegment(),e.segmentLength=this.getSegLength(e.segment),e.abscissa=0,this._partSegCount--;else{if(!this._setPosAtNextPart())return 0!==i&&(e.segmentLength=this.getSegLength(e.segment),e.isPartEnd=!0,1===i?(e.abscissa=e.segmentLength,e.isPathEnd=!0):e.abscissa=e.segmentLength+t,!0);this._currentPosition.copyTo(e)}}if(e.abscissa+=t*this._partLengthRatio,s){0===s.pathSize&&(0===r?s.pushPoint(e.segment[0]):s.pushPoint(this.getSegCoord2D(e.segment,r)));const t=e.abscissa/e.segmentLength;1===t?s.pushPoint(e.segment[1]):s.pushPoint(this.getSegCoord2D(e.segment,t))}return this._partSegCount||Math.abs(e.abscissa-e.segmentLength)<this._tolerance&&(e.isPathEnd=this._partIsLast,e.isPartEnd=!0),!0}_getPoint(t){const e=t.segmentLength<=0?0:t.abscissa/t.segmentLength;return this.getSegCoord2D(this._currentPosition.segment,e)}_getAngleCS(t,e){const s=e.segmentLength<=0?0:e.abscissa/e.segmentLength;return this.getSegAngleCS(t,this._currentPosition.segment,s)}_setPosAtNextPart(){for(;this._partSegCount;)this._hasNextSegment()&&this._nextSegment(),this._partSegCount--;if(!this._hasNextSegment())return!1;for(this._partLength=0,this._partIsLast=!0,this._partSegCount=0;this._hasNextSegment();)if(this._partLength+=this.getSegLength(this._nextSegment()),this._partSegCount++,this._pathCursor.getControlPointAt(this._getEndPointIndex())){this._partIsLast=!this._hasNextSegment();break}let t=this._partSegCount;for(;t;)this._previousSegment(),--t;this._currentPosition.segment=this._nextSegment(),this._currentPosition.segmentLength=this.getSegLength(this._currentPosition.segment),this._currentPosition.abscissa=0,this._currentPosition.isPathEnd=this._currentPosition.isPartEnd=!1,--this._partSegCount;const e=this._getStartPointIndex();this._ctrlPtBegin=this._pathCursor.getControlPointAt(e);let s=e+this._partSegCount+1;if(s>=this._pathCursor.pathSize&&(s=0),this._ctrlPtEnd=this._pathCursor.getControlPointAt(s),this._patternLength>0){const t=this._ctrlPtBegin?this._partCtrlPtGap:this._partExtPtGap,e=this._ctrlPtEnd?this._partCtrlPtGap:this._partExtPtGap;let s=Math.round((this._partLength-(t+e))/this._patternLength);s<=0&&(s=t+e>0?0:1),this._partLengthRatio=this._partLength/(t+e+s*this._patternLength),this._partLengthRatio<.01&&(this._partLengthRatio=1)}else this._partLengthRatio=1;return!0}_hasNextSegment(){return this._seg<this._pathCursor.pathSize-2}_previousSegment(){return this.getSeg(--this._seg)}_nextSegment(){return this.getSeg(++this._seg)}_getStartPointIndex(){return this._seg}_getEndPointIndex(){return this._seg+1}}var ne=s(93397);class oe{static{this.instance=null}static local(){return null===oe.instance&&(oe.instance=new oe),oe.instance}execute(t,e,s,i,r){return new ae(t,e,s)}}class ae extends Nt{constructor(t,e,s){super(t,!0,!0),this._firstCurve=null,this._walker=new re,this._walker.updateTolerance(s),this._endings=e.lineDashEnding,this._customDashPos=-(e.offsetAlongLine??0)*s,this._offsetAtEnd=(e.customEndingOffset??0)*s;let i=(0,ne.FH)(e).dashTemplate;null==i&&(i=[]),i.length%2&&(i=[...i,...i]),this._pattern=new ee,this._pattern.init(i,!0),this._pattern.scale(s)}processPath(t){if(0===this._pattern.length()){this.iteratePath=!1;const e=(0,vt.A)(t);return Pt.fromJSONCIM({paths:[e]})}if(!this.iteratePath){let e=!0;switch(this._endings){case"HalfPattern":case"HalfGap":default:this._pattern.extPtGap=0;break;case"FullPattern":this.isClosed||(this._pattern.extPtGap=.5*this._pattern.firstValue());break;case"FullGap":this.isClosed||(this._pattern.extPtGap=.5*this._pattern.lastValue());break;case"NoConstraint":this.isClosed||(e=!1);break;case"Custom":this.isClosed||(this._pattern.extPtGap=.5*this._offsetAtEnd)}const s=t.pathLength();if(this._pattern.isEmpty()||s<.1*this._pattern.length()){const e=(0,vt.A)(t);return Pt.fromJSONCIM({paths:[e]})}if(!this._walker.init(t,this._pattern,e)){const e=(0,vt.A)(t);return Pt.fromJSONCIM({paths:[e]})}}let e;if(this.iteratePath)e=this._pattern.nextValue();else{let t;switch(this._endings){case"HalfPattern":default:t=.5*this._pattern.firstValue();break;case"HalfGap":t=.5*-this._pattern.lastValue();break;case"FullGap":t=-this._pattern.lastValue();break;case"FullPattern":t=0;break;case"NoConstraint":case"Custom":t=-this._customDashPos}let s=t/this._pattern.length();s-=Math.floor(s),t=s*this._pattern.length(),this._pattern.reset(),e=this._pattern.nextValue();let i=!1;for(;t>=e;)t-=e,e=this._pattern.nextValue(),i=!i;e-=t,i?(this._walker.nextPosition(e),e=this._pattern.nextValue()):this.isClosed&&(this._firstCurve=this._walker.nextCurve(e),e=this._pattern.nextValue(),this._walker.nextPosition(e),e=this._pattern.nextValue())}let s=this._walker.nextCurve(e);if(s)if(this._walker.isPathEnd()){if(this.iteratePath=!1,this._firstCurve){for(this._firstCurve.nextPath();this._firstCurve.nextPoint();)s.pushXY(this._firstCurve.x,this._firstCurve.y);this._firstCurve=null}}else e=this._pattern.nextValue(),!this._walker.nextPosition(e)||this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(s.pushCursor(this._firstCurve),this._firstCurve=null)):this.iteratePath=!0;else this.iteratePath=!1,s=this._firstCurve,this._firstCurve=null;return s?.reset(),s}}class he{static{this.instance=null}static local(){return null===he.instance&&(he.instance=new he),he.instance}execute(t,e,s,i,r,n,o){return new ce(t,e,s,i,r,n,o)}}class ce{constructor(t,e,s,i,r,n,o){this._preventClipping=o,this._inputGeometries=t,this._tileKey=i,this._geometryEngine=r,this._maxInflateSize=n*s,this._width=(void 0!==e.width?e.width:2)*s,e.method,this._option=e.option}next(){let t;for(;t=this._inputGeometries.next();){if("esriGeometryEnvelope"===t.geometryType&&this._width>0){const e=t.asJSON();return Math.min(e.xmax-e.xmin,e.ymax-e.ymin)-2*this._width<0?t:Pt.fromJSONCIM({paths:[[[e.xmin+this._width,e.ymin+this._width],[e.xmax-this._width,e.ymin+this._width],[e.xmax-this._width,e.ymax-this._width],[e.xmin+this._width,e.ymax-this._width],[e.xmin+this._width,e.ymin+this._width]],[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]})}if("esriGeometryPolygon"===t.geometryType){if(0===this._width)return t.clone();const e=this._geometryEngine;if(null==e)return null;const s=!this._preventClipping&&this._tileKey?Xt(t,this._maxInflateSize,!0):t.clone();if(!s)continue;const i=e.buffer(y.A.WebMercator,s.asJSON(),-this._width,1);if(i)for(const t of i.rings)if(t){s.startPath();for(const e of t.reverse())s.pushXY(e[0],s.yFactor*e[1])}return s}}return null}}var le=s(537);class ue{static{this.instance=null}static local(){return null===ue.instance&&(ue.instance=new ue),ue.instance}execute(t,e,s,i,r){return new de(t,e,s,r)}}class de{constructor(t,e,s,i){this._inputGeometries=t,this._medhod=e.method,this._geometryEngine=i}next(){let t=this._inputGeometries.next();const e=this._medhod;for(;null!=t;){if(t.totalSize>0)switch(e){case"RectangularBox":return _e(t);case"ConvexHull":return this._constructConvexHull(t);default:return pe(t)}t=this._inputGeometries.next()}return null}_constructConvexHull(t){switch(t.geometryType){case"esriGeometryPolyline":case"esriGeometryPolygon":{const e=this._geometryEngine;if(null==e)return null;const s=e.convexHull(y.A.WebMercator,t.asJSON());return s?Pt.fromJSONCIM(s):null}case"esriGeometryEnvelope":return t;default:return null}}}function _e(t){const e=(0,le.z8)(t),s={xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3]};return Pt.fromJSONCIM(s)}function pe(t){switch(t.geometryType){case"esriGeometryPolyline":{const e=[];for(;t.nextPath();)fe(t,e);return Pt.fromJSONCIM({rings:e})}case"esriGeometryPolygon":case"esriGeometryEnvelope":return t;default:return null}}function fe(t,e){if(t.seekPathStart(),!t.nextPoint())return;const s=t.x,i=t.y,r=[[s,i]];for(e.push(r);t.nextPoint();)r.push([t.x,t.y]);r.push([s,i])}class me{static{this.instance=null}static local(){return null===me.instance&&(me.instance=new me),me.instance}execute(t,e,s,i,r){return new ge(t,e,s)}}class ge extends Nt{constructor(t,e,s){super(t,!1,!0),this._curveHelper=new qt,this._length=(void 0!==e.length?e.length:20)*s,this._angle=void 0!==e.angle?e.angle:225,this._position=void 0!==e.position?e.position:50,this._length<0&&(this._length=-this._length),this._position<20&&(this._position=20),this._position>80&&(this._position=80),this._mirror=!1}processPath(t){const e=Pt.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._curveHelper.isEmpty(t))return null;t.seekInPath(0);const s=t.x,i=t.y;t.seekInPath(t.pathSize-1);const r=t.x,n=t.y,o=[r-s,n-i];this._curveHelper.normalize(o);const a=s+(r-s)*this._position/100,h=i+(n-i)*this._position/100,c=Math.cos((90-this._angle)/180*Math.PI);let l=Math.sin((90-this._angle)/180*Math.PI);this._mirror&&(l=-l),this._mirror=!this._mirror;const u=[a-this._length/2*c,h-this._length/2*l],d=[a+this._length/2*c,h+this._length/2*l];return e.pushPath([[s,i],u,d,[r,n]]),e}}class ye{static{this.instance=null}static local(){return null===ye.instance&&(ye.instance=new ye),ye.instance}execute(t,e,s,i,r){return new xe(t,e,s)}}class xe{constructor(t,e,s){this._inputGeometries=t,this._offsetX=void 0!==e.offsetX?e.offsetX*s:0,this._offsetY=void 0!==e.offsetY?e.offsetY*s:0}next(){let t=this._inputGeometries.next();for(;t;){if(t.totalSize>0)return this._move(t.clone(),this._offsetX,this._offsetY);t=this._inputGeometries.next()}return null}_move(t,e,s){for(;t.nextPath();)for(;t.nextPoint();)t.x=t.x+e,t.y=t.y+s;return t.reset(),t}}class be{static{this.instance=null}static local(){return null===be.instance&&(be.instance=new be),be.instance}execute(t,e,s,i,r,n,o){return new we(t,e,s,i,r,n,o)}}class we{constructor(t,e,s,i,r,n,o){this._preventClipping=o,this._inputGeometries=t,this._tileKey=i,this._geometryEngine=r,this._curveHelper=new qt,this._offset=(e.offset??1)*s,this._method=e.method,this._maxInflateSize=Math.max(Math.abs(n*s),10),this._option=e.option,this._offsetFlattenError=Bt*s}next(){let t;for(;t=this._inputGeometries.next();){if(0===this._offset)return t.clone();if("esriGeometryEnvelope"===t.geometryType){if("Rounded"===this._method&&this._offset>0){const e=(0,vt.A)(t),s=this._curveHelper.offset(e,-this._offset,this._method,4,this._offsetFlattenError);if(s){const e=Pt.createEmptyOptimizedCIM(t.geometryType);return e.pushPath(s),e}return null}const e=t.asJSON();if((0,It.ZC)(e)&&Math.min(e.xmax-e.xmin,e.ymax-e.ymin)+2*this._offset>0)return Pt.fromJSONCIM({xmin:e.xmin-this._offset,xmax:e.xmax+this._offset,ymin:e.ymin-this._offset,ymax:e.ymax+this._offset})}const e=this._geometryEngine;if(null==e)continue;const s=!this._preventClipping&&this._tileKey?Xt(t,this._maxInflateSize,!0):t.clone();if(!s)continue;const i=e.offset(y.A.WebMercator,s.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return i?Pt.fromJSONCIM(i):null}return null}}var ve=s(12359);class Ie{static{this.instance=null}static local(){return null===Ie.instance&&(Ie.instance=new Ie),Ie.instance}execute(t,e,s,i,r){return new Se(t,e,s)}}class Se{constructor(t,e,s){this._inputGeometries=t,this._length=(void 0!==e.length?e.length:Et.D.CIMGeometricEffectRadial.length)*s,this._angle=void 0!==e.angle?e.angle*Math.PI/180:Et.D.CIMGeometricEffectRadial.angle,this._lx=Math.cos(this._angle)*this._length,this._ly=Math.sin(this._angle)*this._length}next(){let t=this._inputGeometries.next();for(;t;){if("esriGeometryPoint"===t.geometryType||"esriGeometryMultipoint"===t.geometryType){const e=Pt.createEmptyOptimizedCIM("esriGeometryPolyline");return t.nextPath()&&t.nextPoint()&&e.pushPath([[t.x,t.y],[t.x+this._lx,t.y+this._ly]]),e}if("esriGeometryPolygon"===t.geometryType){const e=(0,ve.IK)(t);if(!e)return null;const s=Pt.createEmptyOptimizedCIM("esriGeometryPolyline");return s.pushPath([[e[0],e[1]],[e[0]+this._lx,e[1]+this._ly]]),s}t=this._inputGeometries.next()}return null}}class Pe{static{this.instance=null}static local(){return null===Pe.instance&&(Pe.instance=new Pe),Pe.instance}execute(t,e,s,i,r){return new Me(t,e,s)}}class Me{constructor(t,e,s){this._inputGeometries=t,this._reverse=void 0===e.reverse||e.reverse}next(){let t=this._inputGeometries.next();for(;t;){if(!this._reverse)return t;if("esriGeometryPolyline"===t.geometryType)return Ce(t.clone());t=this._inputGeometries.next()}return null}}function Ce(t){for(;t.nextPath();)for(let e=0;e<t.pathSize/2;e++){t.seekInPath(e);const s=t.x,i=t.y;t.seekInPath(t.pathSize-e-1);const r=t.x,n=t.y;t.x=s,t.y=i,t.seekInPath(e),t.x=r,t.y=n}return t.reset(),t}class Ae{static{this.instance=null}static local(){return null===Ae.instance&&(Ae.instance=new Ae),Ae.instance}execute(t,e,s,i,r){return new Te(t,e,s)}}class Te{constructor(t,e,s){this._inputGeometries=t,this._rotateAngle=void 0!==e.angle?e.angle*Math.PI/180:0}next(){let t=this._inputGeometries.next();for(;t;){if(0===this._rotateAngle||"esriGeometryPoint"===t.geometryType)return t;if(t.totalSize>0){const e=(0,le.z8)(t),s=(e[2]+e[0])/2,i=(e[3]+e[1])/2;return t.reset(),this._rotate(t.clone(),s,i)}t=this._inputGeometries.next()}return null}_rotate(t,e,s){const i=Math.cos(this._rotateAngle),r=Math.sin(this._rotateAngle);for(;t.nextPath();)for(;t.nextPoint();){const n=t.x-e,o=t.y-s;t.x=e+n*i-o*r,t.y=s+n*r+o*i}return t.reset(),t}}class ke{static{this.instance=null}static local(){return null===ke.instance&&(ke.instance=new ke),ke.instance}execute(t,e,s,i,r){return new Fe(t,e,s)}}class Fe{constructor(t,e,s){this._inputGeometries=t,this._xFactor=void 0!==e.xScaleFactor?e.xScaleFactor:1.15,this._yFactor=void 0!==e.yScaleFactor?e.yScaleFactor:1.15}next(){const t=this._inputGeometries.next();if(t){if(1===this._xFactor&&1===this._yFactor)return t;if("esriGeometryPoint"===t.geometryType)return t;if(t.totalSize>0){const e=(0,le.z8)(t),s=(e[2]+e[0])/2,i=(e[3]+e[1])/2;return t.reset(),this._scaleCursor(t.clone(),s,i)}}return null}_scaleCursor(t,e,s){for(;t.nextPath();)for(;t.nextPoint();)t.x=e+(t.x-e)*this._xFactor,t.y=s+(t.y-s)*this._yFactor;return t.reset(),t}}class Ee{constructor(){this._polyline=[]}beginPath(t){this._polyline.push([t])}lineTo(t){if(0===this._polyline.length)throw new Error("No path started. Call beginPath first.");this._polyline[this._polyline.length-1].push(t)}getPointCount(){return this._polyline.reduce((t,e)=>t+e.length,0)}addSegment(t,e,s){s&&this.beginPath(t),this.lineTo(e)}getXY(t){let e=0;for(const s of this._polyline){if(t<e+s.length)return s[t-e];e+=s.length}return null}getGeometry(){return this._polyline}}class Re{static{this.instance=null}static local(){return null===Re.instance&&(Re.instance=new Re),Re.instance}execute(t,e,s,i,r){return new ze(t,e,s)}}class ze extends Nt{constructor(t,e,s){super(t,!1,!0),this._suppress=void 0!==e.suppress&&e.suppress,this._invert=void 0!==e.invert&&e.invert}processPath(t){if(t.totalSize<=0)return null;if(!this._suppress){const e=Pt.createEmptyOptimizedCIM("esriGeometryPolygon",!1,!1,t.yFactor);for(t.seekPathEnd();t.nextPoint();)e.pushXY(t.x,t.y);return e}const e=[],s=new Array(t.pathSize);let i=0;for(t.seekPathStart();t.nextPoint();)s[i++]=t.getControlPoint(),e.push([t.x,t.y]);let r=!0,n=!0,o=!1,a=!this._invert;i=0;const h=new Ee;let c=e[0];for(;i<e.length;){const t=e[i+1],l=s[i],u=s[i+1];i++,n&&(a=l||u?this._invert:!this._invert,n=!1),a?(h.addSegment(c,t,r),r=!1):o=!0,c=t,u&&(a?(a=!1,r=!0):a=!0)}const l=h.getGeometry();if(0===l.length)return null;if(!o&&e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]){const t=l[l.length-1];return t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]||t.push([t[0][0],t[0][1]]),Pt.fromJSONCIM({paths:l})}const u=l[l.length-1];return h.getPointCount()>1&&"esriGeometryPolygon"===t.geometryType&&u[0][0]===u[u.length-1][0]&&u[0][1]===u[u.length-1][1]&&l.length>1&&(l[l.length-1].push(...l[0]),l.splice(0,1)),Pt.fromJSONCIM({paths:l})}}function Oe(t,e,s){return t[0]=e[0]-s[0],t[1]=e[1]-s[1],t}function Le(t,e){return Math.sqrt(t*t+e*e)}function De(t){const e=Le(t[0],t[1]);t[0]/=e,t[1]/=e}function Ge(t,e){return Le(t[0]-e[0],t[1]-e[1])}function Ne(t){return t.length-1}function Be(t,e,s=1){let[i,r]=function(t,e){return t[e+1]}(t,e);return[i,r]=[Math.round(i),Math.round(r)],Math.sqrt(i*i+r*r)*s}class qe{constructor(t,e,s,i,r){this._segments=t,this._index=e,this._distance=s,this._xStart=i,this._yStart=r,this._done=!1}static create(t){return new qe(t,0,0,t[0][0],t[0][1])}clone(){return new qe(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(t){return this._index===t._index||t._index===this._index-1&&(0===this._distance||1===t._distance)||t._index===this._index+1&&(1===this._distance||0===t._distance)}leq(t){return this._index<t._index||this._index===t._index&&this._distance<=t._distance}geq(t){return this._index>t._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let s=Math.acos(e);return t>0&&(s=2*Math.PI-s),s}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<Ne(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(t,e){const s=this.backwardLength;if(t<=s)return this._distance=(s-t)/this.length,this;let i=this.backwardLength;for(;this.prev();){if(i+this.length>t)return this._seekBackwards(t-i);i+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let s=this.remainingLength;for(;this.next();){if(s+this.length>t)return this.seek(t-s,e);s+=this.length}return this._distance=1,e?this:null}}function We(t,e,s,i=!0){const r=function(t){let e=0;for(let s=0;s<Ne(t);s++)e+=Be(t,s);return e}(t),n=qe.create(t),o=r/2;if(!i)return n.seek(o),void(n.x<_.CQ&&n.y<_.CQ&&n.x>0&&n.y>0&&s(n.clone(),0,o+0*e,r));const a=Math.max((r-e)/2,0),h=Math.floor(a/e),c=o-h*e;n.seek(c);for(let t=-h;t<=h;t++)n.x<_.CQ&&n.y<_.CQ&&n.x>0&&n.y>0&&s(n.clone(),t,o+t*e,r),n.seek(e)}function Ue(t,e){const s=e;for(let e=0;e<t.length;e++){let i=t[e];Ye(i,s);const r=[];r.push(i[0]);for(let t=1;t<i.length;t++){const[e,s]=i[t-1],[n,o]=i[t],a=n-e,h=o-s;r.push([a,h])}t[e]=r,i=r}return t}function Ye(t,e){const s=1e-6;if(e<=0)return;const i=t.length;if(i<3)return;const r=[];let n=0;r.push(0);for(let e=1;e<i;e++)n+=Ge(t[e],t[e-1]),r.push(n);e=Math.min(e,.2*n);const o=[];o.push(t[0][0]),o.push(t[0][1]);const a=t[i-1][0],h=t[i-1][1],c=Oe([0,0],t[0],t[1]);De(c),t[0][0]+=e*c[0],t[0][1]+=e*c[1],Oe(c,t[i-1],t[i-2]),De(c),t[i-1][0]+=e*c[0],t[i-1][1]+=e*c[1];for(let t=1;t<i;t++)r[t]+=e;r[i-1]+=e;const l=.5*e;for(let n=1;n<i-1;n++){let a=0,h=0,c=0;for(let i=n-1;i>=0&&!(r[i+1]<r[n]-l);i--){const o=l+r[i+1]-r[n],u=r[i+1]-r[i],d=r[n]-r[i]<l?1:o/u;if(Math.abs(d)<s)break;const _=d*d,p=d*o-.5*_*u,f=d*u/e,m=t[i+1],g=t[i][0]-m[0],y=t[i][1]-m[1];a+=f/p*(m[0]*d*o+.5*_*(o*g-u*m[0])-_*d*u*g/3),h+=f/p*(m[1]*d*o+.5*_*(o*y-u*m[1])-_*d*u*y/3),c+=f}for(let o=n+1;o<i&&!(r[o-1]>r[n]+l);o++){const i=l-r[o-1]+r[n],u=r[o]-r[o-1],d=r[o]-r[n]<l?1:i/u;if(Math.abs(d)<s)break;const _=d*d,p=d*i-.5*_*u,f=d*u/e,m=t[o-1],g=t[o][0]-m[0],y=t[o][1]-m[1];a+=f/p*(m[0]*d*i+.5*_*(i*g-u*m[0])-_*d*u*g/3),h+=f/p*(m[1]*d*i+.5*_*(i*y-u*m[1])-_*d*u*y/3),c+=f}o.push(a/c),o.push(h/c)}o.push(a),o.push(h);for(let e=0,s=0;e<i;e++)t[e][0]=o[s++],t[e][1]=o[s++]}const je=()=>D.A.getLogger("esri.symbols.cim.effects.EffectTaperedPolygon");class Ve{static{this.instance=null}static local(){return null===Ve.instance&&(Ve.instance=new Ve),Ve.instance}execute(t,e,s,i,r){return new Xe(t,e,s,i,r)}}class Xe extends Nt{constructor(t,e,s,i,r){super(t,!1,!0),this._slopeS=0,this._slopeC=1,this._lastTangent1=new Yt.bR(NaN,NaN),this._lastWidth=0,this._tileKey=null,this._halfFromWidth=Math.abs(void 0!==e.fromWidth?e.fromWidth:0)*s*.5,this._halfToWidth=Math.abs(void 0!==e.toWidth?e.toWidth:1)*s*.5,this._originalLength=(void 0!==e.length?e.length:0)*s,this._length=0,this._tileKey=i,this._geometryEngine=r}processPath(t){if(t.totalSize<=0)return null;if(this._halfFromWidth<=0&&this._halfToWidth<=0){const e=Pt.createEmptyOptimizedCIM("esriGeometryPolygon",!1,!1,t.yFactor);for(t.seekPathEnd();t.prevPoint();)e.pushXY(t.x,t.y);for(t.seekPathStart();t.nextPoint();)e.pushXY(t.x,t.y);return e}const e=[];t.seekPathStart();let s=0,r=0;for(;t.nextPoint();)e.push([t.x-s,t.y-r]),s=t.x,r=t.y;let n=this._geometryEngine?.simplify(y.A.WebMercator,{paths:[e]});n||null!=this._tileKey||(n={paths:[e]});const o=(0,It.Bi)(n)?n.rings:(0,It.Rg)(n)?n.paths:null;if(!o)return je().error(new i.A("mapview-bad-resource","Unable to process geometry")),null;const a=new Ee,h=new Ee;let c=0;for(const t of o){s=t[0][0],r=t[0][1];for(let e=1;e<t.length;e++){const i=s+t[e][0],n=r+t[e][1];c+=Math.sqrt((i-s)*(i-s)+(n-r)*(n-r)),s=i,r=n}}if(0===this._originalLength||this._originalLength>c){this._length=c;const t=(this._halfToWidth-this._halfFromWidth)/this._length;if(Math.abs(t)<1){const e=t*t;this._slopeC=Math.sqrt(1/(1+e)),this._slopeS=Math.sqrt(e/(1+e)),t<0&&(this._slopeS=-this._slopeS)}else this._slopeC=this._slopeS=.7071}else this._length=this._originalLength,this._slopeC=1,this._slopeS=0;let l=0;const u=[];for(const t of o){const e=qe.create(t),s=qe.create(t);this._setFromOffset(s,a,h);let i=s.next(),r=e;for(;i&&r;)l=this._setOffset(r,i,l,a,h),r=e.next(),i=s.next();r=e,r&&this._setToOffset(r,l,a,h);const n=a.getGeometry(),o=h.getGeometry(),c=[];for(const t of n)c.push(...t);for(let t=o.length-1;t>=0;t--){const e=o[t];for(let t=e.length-1;t>=0;t--)c.push(e[t])}u.push(c)}const d={rings:u};(0,$t.uC)(d);let _=this._geometryEngine?.simplify(y.A.WebMercator,d);if(!_){if(null!=this._tileKey)return null;_=d}return Pt.fromJSONCIM(_)}_setFromOffset(t,e,s){const i=this._halfFromWidth,r=new Yt.bR(t.xEnd-t.xStart,t.yEnd-t.yStart);r.normalize(),r.scale(i),e.beginPath([t.xStart-r.y,t.yStart+r.x]),s.beginPath([t.xStart+r.y,t.yStart-r.x])}_setToOffset(t,e,s,i){let r;r=(e+=Math.sqrt((t.xEnd-t.xStart)*(t.xEnd-t.xStart)+(t.yEnd-t.yStart)*(t.yEnd-t.yStart)))>=this._length?this._halfToWidth:this._halfFromWidth+(this._halfToWidth-this._halfFromWidth)*e/this._length;const n=new Yt.bR(t.xEnd-t.xStart,t.yEnd-t.yStart);n.normalize(),n.scale(r),s.lineTo([t.xEnd-n.y,t.yEnd+n.x]),i.lineTo([t.xEnd+n.y,t.yEnd-n.x])}_setOffset(t,e,s,r,n){const o=Math.sqrt((t.xEnd-t.xStart)*(t.xEnd-t.xStart)+(t.yEnd-t.yStart)*(t.yEnd-t.yStart));let a;a=s+o>=this._length?this._halfToWidth:this._halfFromWidth+(this._halfToWidth-this._halfFromWidth)*(s+o)/this._length,s+=o;const h=new Yt.bR(t.xEnd,t.yEnd),c=new Yt.bR(t.xEnd-t.xStart,t.yEnd-t.yStart);c.normalize();const l=new Yt.bR(e.xEnd-e.xStart,e.yEnd-e.yStart);l.normalize();const u=c.x*l.y-c.y*l.x;let d;d=0===Math.abs(u)?new Yt.bR(l.x,l.y):new Yt.bR((l.x-c.x)/u,(l.y-c.y)/u);const _=r.getPointCount(),p=n.getPointCount();c.leftPerpendicular(),l.leftPerpendicular();const f=c.x*l.x+c.y*l.y;if(f>.99){const t=new Yt.bR((c.x+l.x)*a/2,(c.y+l.y)*a/2),e=t.clone();e.rotate(this._slopeC,this._slopeS),r.lineTo([h.x+e.x,h.y+e.y]);const s=t.clone();s.rotateReverse(this._slopeC,this._slopeS),n.lineTo([h.x-s.x,h.y-s.y])}else{if(u<0){const t=d.clone().scale(-a);t.rotateReverse(this._slopeC,this._slopeS);const e=n.getXY(p-1);e||je().error(new i.A("mapview-bad-resource","Unable to process geometry, index out of scope"));const s=Yt.bR.add(h,t),r=Yt.bR.sub(s,Yt.bR.fromArray(e));if(c.x*r.y-c.y*r.x>0){const t=new Yt.bR(-c.x*a,-c.y*a);t.rotateReverse(this._slopeC,this._slopeS);const e=new Yt.bR(-l.x*a,-l.y*a);e.rotateReverse(this._slopeC,this._slopeS),n.lineTo([h.x+t.x,h.y+t.y]),n.lineTo([h.x,h.y]),n.lineTo([h.x+e.x,h.y+e.y])}else n.lineTo([h.x+t.x,h.y+t.y])}else{const t=d.clone().scale(a);t.rotate(this._slopeC,this._slopeS);const e=r.getXY(_-1);e||je().error(new i.A("mapview-bad-resource","Unable to process geometry, index out of scope"));const s=Yt.bR.add(h,t),n=Yt.bR.sub(s,Yt.bR.fromArray(e));if(c.x*n.y-c.y*n.x>0){const t=c.clone().scale(a);t.rotate(this._slopeC,this._slopeS);const e=l.clone().scale(a);e.rotate(this._slopeC,this._slopeS),r.lineTo([h.x+t.x,h.y+t.y]),r.lineTo([h.x,h.y]),r.lineTo([h.x+e.x,h.y+e.y])}else r.lineTo([h.x+t.x,h.y+t.y])}const e=Math.acos(f);let s=1;if(a>.25){const t=2*Math.acos(1-.25/a);t<e&&(s=Math.round(e/t))}const o=Math.cos(e/s),m=Math.sin(e/s),g=c.clone();if(u<0){g.rotate(this._slopeC,this._slopeS);const e=r.getXY(_-1);e||je().error(new i.A("mapview-bad-resource","Unable to process geometry, index out of scope"));const s=Yt.bR.add(h,g.clone().scale(this._lastWidth)),n=Yt.bR.sub(s,Yt.bR.fromArray(e)),o=c.x*n.y-c.y*n.x;if(!isNaN(this._lastTangent1.x)&&!isNaN(this._lastTangent1.y)&&o>0){const e=new Yt.bR(t.xStart,t.yStart),s=this._lastTangent1.clone().scale(this._lastWidth);s.rotate(this._slopeC,this._slopeS);const i=c.clone().scale(this._lastWidth);i.rotate(this._slopeC,this._slopeS),r.lineTo([e.x+s.x,e.y+s.y]),r.lineTo([e.x,e.y]),r.lineTo([e.x+i.x,e.y+i.y])}}else{g.scale(-1).rotateReverse(this._slopeC,this._slopeS);const e=n.getXY(p-1);e||je().error(new i.A("mapview-bad-resource","Unable to process geometry, index out of scope"));const s=Yt.bR.add(h,g.clone().scale(this._lastWidth)),r=Yt.bR.sub(s,Yt.bR.fromArray(e)),o=c.x*r.y-c.y*r.x;if(!isNaN(this._lastTangent1.x)&&!isNaN(this._lastTangent1.y)&&o>0){const e=new Yt.bR(t.xStart,t.yStart),s=this._lastTangent1.clone().scale(-this._lastWidth);s.rotateReverse(this._slopeC,this._slopeS);const i=c.clone().scale(-this._lastWidth);i.rotateReverse(this._slopeC,this._slopeS),n.lineTo([e.x+s.x,e.y+s.y]),n.lineTo([e.x,e.y]),n.lineTo([e.x+i.x,e.y+i.y])}}g.scale(a);for(let t=0;t<=s;t++)u<0?(r.lineTo([h.x+g.x,h.y+g.y]),g.rotateReverse(o,m)):(n.lineTo([h.x+g.x,h.y+g.y]),g.rotate(o,m))}return this._lastTangent1.setCoords(c.x,c.y),this._lastWidth=a,s}}class He{static{this.instance=null}static local(){return null===He.instance&&(He.instance=new He),He.instance}execute(t,e,s,i,r){return new Ze(t,e,s)}}class Ze{constructor(t,e,s){this._inputGeometries=t,this._height=(void 0!==e.amplitude?e.amplitude:2)*s,this._period=(void 0!==e.period?e.period:3)*s,this._style=e.waveform,this._height<=0&&(this._height=Math.abs(this._height)),this._period<=0&&(this._period=Math.abs(this._period)),this._pattern=new ee,this._pattern.addValue(this._period),this._pattern.addValue(this._period),this._walker=new re,this._walker.updateTolerance(s)}next(){let t=this._inputGeometries.next();for(;t;){if(0===this._height||0===this._period)return t;const e=this._processGeom(t);if(e)return e;t=this._inputGeometries.next()}return null}_processGeom(t){const e=Pt.createEmptyOptimizedCIM(t.geometryType);for(;t.nextPath();){e.startPath();const s=t.pathLength();if(this._walker.init(t,this._pattern))switch(this._style){case"Sinus":default:this._constructCurve(e,s,!1);break;case"Square":this._constructSquare(e,s);break;case"Triangle":this._constructTriangle(e,s);break;case"Random":this._constructCurve(e,s,!0)}else for(;t.nextPoint();)e.pushXY(t.x,t.y)}return e}_constructCurve(t,e,s){let i=Math.round(e/this._period);0===i&&(i=1);const r=16*i+1,n=e/i,o=this._period/16,a=1/r,h=2*Math.PI*e/n,c=2*Math.PI*Math.random(),l=2*Math.PI*Math.random(),u=2*Math.PI*Math.random(),d=.75-Math.random()/2,_=.75-Math.random()/2,p=new se;this._walker.curPointAndAngle(p),t.pushPoint(p.pt);let f=0;for(;;){if(!this._walker.nextPointAndAngle(o,p)){t.pushPoint(this._walker.getPathEnd());break}{const e=f;let i;if(f+=a,s){const t=this._height/2*(1+.3*Math.sin(d*h*e+c));i=t*Math.sin(h*e+l),i+=t*Math.sin(_*h*e+u),i/=2}else i=.5*this._height*Math.sin(.5*h*e);t.pushXY(p.pt[0]-i*p.sa,p.pt[1]+i*p.ca)}}}_constructSquare(t,e){Math.round(e/this._period);let s=!0;for(;;){let e=!1;if(this._walker.curPositionIsValid()){const i=new se;this._walker.curPointAndAngle(i);const r=new se;if(this._walker.nextPointAndAngle(this._period,r)){const n=new se;this._walker.nextPointAndAngle(this._period,n)&&(s?(t.pushPoint(i.pt),s=!1):t.pushPoint(i.pt),t.pushXY(i.pt[0]-this._height/2*i.sa,i.pt[1]+this._height/2*i.ca),t.pushXY(r.pt[0]-this._height/2*r.sa,r.pt[1]+this._height/2*r.ca),t.pushXY(r.pt[0]+this._height/2*r.sa,r.pt[1]-this._height/2*r.ca),t.pushXY(n.pt[0]+this._height/2*n.sa,n.pt[1]-this._height/2*n.ca),e=!0)}}if(!e){t.pushPoint(this._walker.getPathEnd());break}}}_constructTriangle(t,e){Math.round(e/this._period);let s=!0;for(;;){let e=!1;if(this._walker.curPositionIsValid()){const i=new se;this._walker.curPointAndAngle(i);const r=new se;if(this._walker.nextPointAndAngle(this._period/2,r)){const n=new se;this._walker.nextPointAndAngle(this._period,n)&&(this._walker.nextPosition(this._period/2)&&(s?(t.pushPoint(i.pt),s=!1):t.pushPoint(i.pt),t.pushXY(r.pt[0]-this._height/2*r.sa,r.pt[1]+this._height/2*r.ca),t.pushXY(n.pt[0]+this._height/2*n.sa,n.pt[1]-this._height/2*n.ca)),e=!0)}}if(!e){t.pushPoint(this._walker.getPathEnd());break}}}}class $e{static{this.instance=null}static local(){return null===$e.instance&&($e.instance=new $e),$e.instance}execute(t,e,s,i,r){return new Qe(t,e,s)}}class Qe extends Gt{constructor(t,e,s){super(t),this._geometryWalker=new re,this._geometryWalker.updateTolerance(s),this._angleToLine=e.angleToLine??!0,this._offset=(e.offset?e.offset:0)*s,this._originalEndings=e.endings,this._offsetAtEnd=(e.customEndingOffset?e.customEndingOffset:0)*s,this._position=-(e.offsetAlongLine?e.offsetAlongLine:0)*s,this._pattern=new ee,this._pattern.init(e.placementTemplate,!1),this._pattern.scale(s),this._endings=this._originalEndings}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath)e=this._pattern.nextValue();else{"WithFullGap"===this._originalEndings&&this.isClosed?this._endings="WithMarkers":this._endings=this._originalEndings,this._pattern.extPtGap=0;let s,i=!0;switch(this._endings){case"NoConstraint":s=-this._position,s=this._adjustPosition(s),i=!1;break;case"WithHalfGap":default:s=-this._pattern.lastValue()/2;break;case"WithFullGap":s=-this._pattern.lastValue(),this._pattern.extPtGap=this._pattern.lastValue();break;case"WithMarkers":s=0;break;case"Custom":s=-this._position,s=this._adjustPosition(s),this._pattern.extPtGap=.5*this._offsetAtEnd}if(!this._geometryWalker.init(t,this._pattern,i))return null;this._pattern.reset();let r=0;for(;s>r;)s-=r,r=this._pattern.nextValue();r-=s,e=r,this.iteratePath=!0}const s=new se;return this._geometryWalker.nextPointAndAngle(e,s)?"WithFullGap"===this._endings&&this._geometryWalker.isPathEnd()?(this.iteratePath=!1,null):"WithMarkers"===this._endings&&this._geometryWalker.isPathEnd()&&(this.iteratePath=!1,this.isClosed)?null:(this.internalPlacement.setTranslate(s.pt[0]-this._offset*s.sa,s.pt[1]+this._offset*s.ca),this._angleToLine&&this.internalPlacement.setRotateCS(s.ca,s.sa),this.internalPlacement):(this.iteratePath=!1,null)}_adjustPosition(t){let e=t/this._pattern.length();return e-=Math.floor(e),e*this._pattern.length()}}class Je{static{this.instance=null}static local(){return null===Je.instance&&(Je.instance=new Je),Je.instance}execute(t,e,s,i,r){return new Ke(t,e,s)}}class Ke extends Gt{constructor(t,e,s){super(t,!1,!0),this._curveHelper=new qt,this._placePerPart=e.placePerPart??!1,this._angleToLine=void 0===e.angleToLine||e.angleToLine,this._offset=void 0!==e.offset?e.offset*s:0,this._type=e.extremityPlacement,this._position=void 0!==e.offsetAlongLine?e.offsetAlongLine*s:0,this._beginProcessed=!1}processMultiPath(t){return this._placePerPart?super.processMultiPath(t):this.processPath(t)}processPath(t){let e;switch(this._type){case"Both":default:this._beginProcessed?(e=this._atExtremities(t,this._position,!1),this._beginProcessed=!1,this.iterateMultiPath=!1,this.iteratePath=!1):(e=this._atExtremities(t,this._position,!0),this._beginProcessed=!0,this.iterateMultiPath=!0,this.iteratePath=!0);break;case"JustBegin":e=this._atExtremities(t,this._position,!0);break;case"JustEnd":e=this._atExtremities(t,this._position,!1);case"None":}return e}_atExtremities(t,e,s){if(this._placePerPart||(s?t.seekPath(0):t.seekPath(t.totalSize-1)),s||t.seekPathEnd(),s?t.nextPoint():t.prevPoint()){let i=0,[r,n]=[0,0],[o,a]=[t.x,t.y];const h=[0,0];for(;s?t.nextPoint():t.prevPoint();){r=o,n=a,o=t.x,a=t.y;const s=this._curveHelper.getLength(r,n,o,a);if(i+s>e){const t=(e-i)/s,[c,l]=this._curveHelper.getAngleCS(h,r,n,o,a,t),u=this._curveHelper.getCoord2D(r,n,o,a,t);return this.internalPlacement.setTranslate(u[0]-this._offset*l,u[1]+this._offset*c),this._angleToLine&&this.internalPlacement.setRotateCS(-c,-l),this.internalPlacement}i+=s}}return null}}class ts{static{this.instance=null}static local(){return null===ts.instance&&(ts.instance=new ts),ts.instance}execute(t,e,s,i,r){return new es(t,e,s)}}class es extends Gt{constructor(t,e,s){super(t),this._walker=new re,this._walker.updateTolerance(s),this._angleToLine=void 0===e.angleToLine||e.angleToLine,this._offset=void 0!==e.offset?e.offset*s:0,this._beginGap=void 0!==e.beginPosition?e.beginPosition*s:0,this._endGap=void 0!==e.endPosition?e.endPosition*s:0,this._flipFirst=void 0===e.flipFirst||e.flipFirst,this._pattern=new ee,this._pattern.init(e.positionArray,!1,!1),this._subPathLen=0,this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath){const t=this._pattern.nextValue()*this._subPathLen,s=this._beginGap+t;e=s-this._prevPos,this._prevPos=s}else{if(this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0,this._subPathLen=t.pathLength()-this._beginGap-this._endGap,this._subPathLen<0)return this.iteratePath=!1,null;if(!this._walker.init(t,this._pattern,!1))return null;this._pattern.reset();const s=this._pattern.nextValue()*this._subPathLen,i=this._beginGap+s;e=i-this._prevPos,this._prevPos=i,this.iteratePath=!0}const s=new se;if(!this._walker.nextPointAndAngle(e,s,1))return this.iteratePath=!1,null;this.internalPlacement.setTranslate(s.pt[0]-this._offset*s.sa,s.pt[1]+this._offset*s.ca);const i=this._isFirst&&this._flipFirst;let r,n;return this._angleToLine?(r=s.ca,n=s.sa):(r=1,n=0),i&&(r=-r,n=-n),this.internalPlacement.setRotateCS(r,n),this._isFirst=!1,this._posCount--,0===this._posCount&&(this.iteratePath=!1),this.internalPlacement}}const ss=512,is=24,rs=1e-6;class ns{static{this.instance=null}static local(){return null===ns.instance&&(ns.instance=new ns),ns.instance}execute(t,e,s,i,r){return new os(t,e,s,i,r)}}class os{constructor(t,e,s,i,r){if(this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,this._currentX=0,this._currentY=0,this._accelerationMap=null,this._testInsidePolygon=!1,this._verticalSubdivision=!0,this._stepX=Math.abs(e.stepX??16)*s,this._stepY=Math.abs(e.stepY??16)*s,this._stepX=Math.round(128*this._stepX)/128,this._stepY=Math.round(128*this._stepY)/128,0!==this._stepX&&0!==this._stepY){if(this._gridType=e.gridType??"Fixed","Random"===this._gridType){const t=e.seed??13,s=1;this._randomLCG=new h.A(t*s),this._randomness=(e.randomness??100)/100,this._gridAngle=0,this._shiftOddRows=!1,this._cosAngle=1,this._sinAngle=0,this._offsetX=0,this._offsetY=0,this._buildRandomValues()}else{if(this._randomness=0,this._gridAngle=e.gridAngle??0,this._shiftOddRows=e.shiftOddRows??!1,this._offsetX=(e.offsetX??0)*s,this._offsetY=(e.offsetY??0)*s,this._cosAngle=Math.cos(this._gridAngle/180*Math.PI),this._sinAngle=-Math.sin(this._gridAngle/180*Math.PI),this._stepX)if(this._offsetX<0)for(;this._offsetX<-.5*this._stepX;)this._offsetX+=this._stepX;else for(;this._offsetX>=.5*this._stepX;)this._offsetX-=this._stepX;if(this._stepY)if(this._offsetY<0)for(;this._offsetY<-.5*this._stepY;)this._offsetY+=this._stepY;else for(;this._offsetY>=.5*this._stepY;)this._offsetY-=this._stepY}if(this._graphicOriginX=0,this._graphicOriginY=0,null!=i){const[t,e,s,r]=i.split("/"),n=parseFloat(t),o=parseFloat(e),a=parseFloat(s),h=parseFloat(r);this._graphicOriginX=-(h*2**n+a)*ss,this._graphicOriginY=o*ss,this._testInsidePolygon=!0}this._internalPlacement=new Lt,this._calculateMinMax(t),this._geometryCursor=t}}next(){return this._geometryCursor?this._nextInside():null}_buildRandomValues(){if(!os._randValues){os._randValues=[];for(let t=0;t<is;t++)for(let t=0;t<is;t++)os._randValues.push(this._randomLCG.getFloat()),os._randValues.push(this._randomLCG.getFloat())}}_calculateMinMax(t){let e,s,i,r,n,o,a,h,c,l,u,d,_,p;this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,a=h=_=u=Number.MAX_VALUE,c=l=p=d=-Number.MAX_VALUE;const f=1!==this._cosAngle;for(t.reset();t.nextPath();)for(;t.nextPoint();)o=t.x,n=t.y,e=o-this._graphicOriginX-this._offsetX,s=n-this._graphicOriginY-this._offsetY,f?(i=this._cosAngle*e-this._sinAngle*s,r=this._sinAngle*e+this._cosAngle*s):(i=e,r=s),a=Math.min(a,i),c=Math.max(c,i),h=Math.min(h,r),l=Math.max(l,r),u=Math.min(u,n),d=Math.max(d,n),_=Math.min(_,o),p=Math.max(p,o);u=u!==Number.MAX_VALUE?u:-512-this._stepY,d=d!==-Number.MAX_VALUE?d:this._stepY,_=_!==Number.MAX_VALUE?_:-this._stepX,p=p!==-Number.MAX_VALUE?p:ss+this._stepX;const m=d-u,g=p-_;if(this._verticalSubdivision=m>=g,this._polygonMin=this._verticalSubdivision?u:_,this._testInsidePolygon){let t=0-this._graphicOriginX-this._offsetX-this._stepX,e=ss-this._graphicOriginX-this._offsetX+this._stepX,s=-512-this._graphicOriginY-this._offsetY-this._stepY,i=0-this._graphicOriginY-this._offsetY+this._stepY;if(f){const r=[[t,s],[t,i],[e,s],[e,i]];t=s=Number.MAX_VALUE,e=i=-Number.MAX_VALUE;for(const n of r){const r=this._cosAngle*n[0]-this._sinAngle*n[1],o=this._sinAngle*n[0]+this._cosAngle*n[1];t=Math.min(t,r),e=Math.max(e,r),s=Math.min(s,o),i=Math.max(i,o)}}a=a!==Number.MAX_VALUE?Math.max(a,t):t,h=h!==Number.MAX_VALUE?Math.max(h,s):s,c=c!==-Number.MAX_VALUE?Math.min(c,e):e,l=l!==-Number.MAX_VALUE?Math.min(l,i):i}this._xMin=Math.round(a/this._stepX),this._xMax=Math.round(c/this._stepX),this._yMin=Math.round(h/this._stepY),this._yMax=Math.round(l/this._stepY),this._currentX=this._xMax+1,this._currentY=this._yMin-1,this._buildAccelerationMap(t,_,p,u,d)}_buildAccelerationMap(t,e,s,i,r){t.reset();const n=new Map,o=this._verticalSubdivision,a=o?r-i:s-e;let h=Math.ceil(a/10);if(h<=1)return;const c=Math.floor(a/h);let l,u,d,_,p,f,m,g,y,x,b;for(h++,this._delta=c,o?(y=-512-2*this._stepY,x=2*this._stepY,b=i):(y=-2*this._stepX,x=ss+2*this._stepX,b=e);t.nextPath();)if(!(t.pathSize<2)&&t.nextPoint())for(l=t.x,u=t.y;t.nextPoint();l=d,u=_){if(d=t.x,_=t.y,o){if(u===_||u<y&&_<y||u>x&&_>x)continue;p=Math.min(u,_),f=Math.max(u,_)}else{if(l===d||l<y&&d<y||l>x&&d>x)continue;p=Math.min(l,d),f=Math.max(l,d)}for(;p<f;)m=Math.floor((p-b)/c),as(m,l,u,d,_,n),p+=c;g=Math.floor((f-b)/c),g>m&&as(g,l,u,d,_,n)}this._accelerationMap=n}_nextInside(){for(;;){if(this._currentX>this._xMax){if(this._currentY++,this._currentY>this._yMax)return null;this._currentX=this._xMin,this._shiftOddRows&&this._currentY%2&&this._currentX--}let t=this._currentX*this._stepX+this._offsetX;this._shiftOddRows&&this._currentY%2&&(t+=.5*this._stepX);const e=this._currentY*this._stepY+this._offsetY;let s,i;if(this._currentX++,"Random"===this._gridType){const r=(this._currentX%is+is)%is,n=(this._currentY%is+is)%is;s=this._graphicOriginX+t+this._stepX*this._randomness*(.5-os._randValues[n*is+r])*2/3,i=this._graphicOriginY+e+this._stepY*this._randomness*(.5-os._randValues[n*is+r+1])*2/3}else s=this._graphicOriginX+this._cosAngle*t+this._sinAngle*e,i=this._graphicOriginY-this._sinAngle*t+this._cosAngle*e;if(!this._testInsidePolygon||this._isInsidePolygon(s,i,this._geometryCursor))return this._internalPlacement.setTranslate(s,i),this._internalPlacement}}_isInsidePolygon(t,e,s){if(null==this._accelerationMap)return function(t,e,s){let i,r,n,o,a=0;for(t+=rs,e+=rs,s.reset();s.nextPath();)if(s.nextPoint())for(i=s.x,r=s.y;s.nextPoint();i=n,r=o)n=s.x,o=s.y,r>e!=o>e&&((n-i)*(e-r)-(o-r)*(t-i)>0?a++:a--);return 0!==a}(t,e,s);t+=rs,e+=rs;const i=this._verticalSubdivision,r=i?e:t,n=Math.floor((r-this._polygonMin)/this._delta),o=this._accelerationMap.get(n);if(!o)return!1;let a,h,c,l=0;for(const s of o){if(a=s[0],h=s[1],i){if(a[1]>e==h[1]>e)continue;c=(h[0]-a[0])*(e-a[1])-(h[1]-a[1])*(t-a[0])}else{if(a[0]>t==h[0]>t)continue;c=(h[1]-a[1])*(t-a[0])-(h[0]-a[0])*(e-a[1])}c>0?l++:l--}return 0!==l}}function as(t,e,s,i,r,n){let o=n.get(t);o||(o=[],n.set(t,o)),o.push([[e,s],[i,r]])}class hs{static{this.instance=null}static local(){return null===hs.instance&&(hs.instance=new hs),hs.instance}execute(t,e,s,i,r){return new cs(t,e,s)}}class cs extends Gt{constructor(t,e,s){super(t),this._curveHelper=new qt,this._angleToLine=void 0===e.angleToLine||e.angleToLine,this._offset=void 0!==e.offset?e.offset*s:0,this._relativeTo=e.relativeTo,this._position=void 0!==e.startPointOffset?e.startPointOffset*s:0,this._epsilon=.001*s}processPath(t){const e=this._position;if("SegmentMidpoint"===this._relativeTo){if(this.iteratePath||(this.iteratePath=!0),t.nextPoint()){let[e,s]=[t.x,t.y],[i,r]=[0,0];const n=[0,0];for(;t.nextPoint();){i=t.x,r=t.y;const o=this._curveHelper.getLength(e,s,i,r);if(o<this._epsilon){e=i,s=r;continue}const a=.5+this._position/o,[h,c]=this._curveHelper.getAngleCS(n,e,s,i,r,a),l=this._curveHelper.getCoord2D(e,s,i,r,a);return this.internalPlacement.setTranslate(l[0]-this._offset*c,l[1]+this._offset*h),this._angleToLine&&this.internalPlacement.setRotateCS(h,c),this.internalPlacement}}return this.iteratePath=!1,null}const s="LineEnd"===this._relativeTo;return this.onLine(t,e,s)}onLine(t,e,s){let i,r=!1;switch(this._relativeTo){case"LineMiddle":default:t.seekPathStart(),i=t.pathLength()/2+e;break;case"LineBeginning":i=e;break;case"LineEnd":i=e,r=!0}s?t.seekPathEnd():t.seekPathStart();let n=0;if(s?t.prevPoint():t.nextPoint()){let[e,o]=[t.x,t.y],[a,h]=[0,0];const c=[0,0];for(;s?t.prevPoint():t.nextPoint();){a=t.x,h=t.y;const s=this._curveHelper.getLength(e,o,a,h);if(n+s>i){const t=(i-n)/s,[l,u]=this._curveHelper.getAngleCS(c,e,o,a,h,t),d=this._curveHelper.getCoord2D(e,o,a,h,t),_=r?-this._offset:this._offset;return this.internalPlacement.setTranslate(d[0]-_*u,d[1]+_*l),this._angleToLine&&(r?this.internalPlacement.setRotateCS(-l,-u):this.internalPlacement.setRotateCS(l,u)),this.internalPlacement}e=a,o=h,n+=s}}return null}}class ls{static{this.instance=null}static local(){return null===ls.instance&&(ls.instance=new ls),ls.instance}execute(t,e,s,i,r){return new us(t,e,s)}}class us extends Gt{constructor(t,e,s){super(t),this._curveHelper=new qt,this._angleToLine=void 0===e.angleToLine||e.angleToLine,this._offset=void 0!==e.offset?e.offset*s:0,this._endPoints=void 0===e.placeOnEndPoints||e.placeOnEndPoints,this._controlPoints=void 0===e.placeOnControlPoints||e.placeOnControlPoints,this._regularVertices=void 0===e.placeOnRegularVertices||e.placeOnRegularVertices,this._tags=[],this._tagIterator=0}processPath(t){if(this.iteratePath||(this._preparePath(t),this.iteratePath=!0),this._tagIterator>=this._tags.length)return this._tags.length=0,this._tagIterator=0,this.iteratePath=!1,null;const e=this._tags[this._tagIterator];this._angleToLine&&this.internalPlacement.setRotate(e[2]);let s=e[0],i=e[1];if(0!==this._offset){const t=Math.cos(e[2]),r=Math.sin(e[2]);s-=this._offset*r,i+=this._offset*t}return this.internalPlacement.setTranslate(s,i),this._tagIterator++,this.internalPlacement}_preparePath(t){this._tags.length=0,this._tagIterator=0,t.seekPathStart();const e=t.isClosed();let s=0,i=!1,r=0,n=0;if(t.seekPathStart(),t.nextPoint()){let o=t.x,a=t.y,h=t.getControlPoint(),c=!0,l=t.nextPoint();for(;l;){const u=t.x,d=t.y,_=t.getControlPoint();(this._angleToLine||0!==this._offset)&&(r=this._curveHelper.getAngle(o,a,u,d,0)),c?(c=!1,e?(s=r,i=h):(this._endPoints||this._controlPoints&&h)&&this._tags.push([o,a,r])):h?this._controlPoints&&this._tags.push([o,a,ds(n,r)]):this._regularVertices&&this._tags.push([o,a,ds(n,r)]),(this._angleToLine||0!==this._offset)&&(n=this._curveHelper.getAngle(o,a,u,d,1)),l=t.nextPoint(),l||(e?_||i?this._controlPoints&&this._tags.push([u,d,ds(n,s)]):this._regularVertices&&this._tags.push([u,d,ds(n,s)]):(this._endPoints||this._controlPoints&&_)&&this._tags.push([u,d,n])),o=u,a=d,h=_}}this._tagIterator=0}}function ds(t,e){const s=Math.PI;for(;Math.abs(e-t)>s+2e-15;)e-t>s?e-=2*s:e+=2*s;return(t+e)/2}var _s=s(12176);function ps(t){if(0===t.totalSize)return null;const e=(0,le.z8)(t);if(!e)return null;const s=4*(Math.abs(e[0])+Math.abs(e[2])+Math.abs(e[1])+Math.abs(e[3])+1)*222045e-19;let i=0,r=0;t.reset();for(let e=0;t.nextPath();e++){const s=t.getCurrentRingArea();s>r&&(r=s,i=e)}if(t.seekPath(i),0===t.pathSize)return null;t.seekPathStart();const n=(0,le.B$)(t);if(Math.abs(r)<=2*s*s)return[(n[0]+n[2])/2,(n[1]+n[3])/2];t.seekPathStart();const o=(0,ve.w2)(t,(0,H.vt)());if(null===o)return null;if(t.totalPoints<4)return o;const a=[[NaN,NaN],[NaN,NaN],[NaN,NaN],[NaN,NaN]],h=[NaN,NaN,NaN,NaN],c=[NaN,NaN,NaN,NaN];let l=!1,u=ms(o,t,!0);0===u.distance&&(l=!0,a[0][0]=o[0],a[0][1]=o[1],u=ms(o,t,!1)),h[0]=u.distance,c[0]=0;const d=[NaN,NaN];let _=!1,p=.25,f=-1,m=NaN;do{if(m=NaN,a[1]=gs(t,Ps(n[0],n[2],p),0,e),isNaN(a[1][0])||isNaN(a[1][1])||(u=ms(a[1],t,!1),m=u.distance),!isNaN(m)&&m>s&&fs(a[1],t))_=!0,h[1]=m,c[1]=Ms(a[1],o);else if(!isNaN(m)&&m>f&&(f=m,d[0]=a[1][0],d[1]=a[1][1]),p-=.01,p<.1){if(!(f>=0))break;_=!0,h[1]=f,a[1][0]=d[0],a[1][1]=d[1],c[1]=Ms(a[1],o)}}while(!_);_=!1,p=.5,f=-1;let g=.01,y=1;do{if(m=NaN,a[2]=gs(t,Ps(n[0],n[2],p),0,e),isNaN(a[2][0])||isNaN(a[2][1])||(u=ms(a[2],t,!1),m=u.distance),!isNaN(m)&&m>s&&fs(a[2],t))_=!0,h[2]=m,c[2]=Ms(a[2],o);else if(!isNaN(m)&&m>f)f=m,d[0]=a[2][0],d[1]=a[2][1];else if(m>f&&(f=m,d[0]=a[2][0],d[1]=a[2][1]),p=.5+g*y,g+=.01,y*=-1,p<.3||p>.7){if(!(f>=0))break;_=!0,h[2]=f,a[2][0]=d[0],a[2][1]=d[1],c[2]=Ms(a[2],o)}}while(!_);_=!1,p=.75,f=-1;do{if(m=NaN,a[3]=gs(t,Ps(n[0],n[2],p),0,e),isNaN(a[3][0])||isNaN(a[3][1])||(u=ms(a[3],t,!1),m=u.distance),!isNaN(m)&&m>s&&fs(a[3],t))_=!0,h[3]=m,c[3]=Ms(a[3],o);else if(m>f&&(f=m,d[0]=a[3][0],d[1]=a[3][1]),p+=.01,p>.9){if(!(f>=0))break;_=!0,h[3]=f,a[3][0]=d[0],a[3][1]=d[1],c[3]=Ms(a[3],o)}}while(!_);const x=[0,1,2,3],b=l?0:1;let w;for(let t=b;t<4;t++)for(let t=b;t<3;t++){const e=c[t],s=c[t+1];Cs(e,s)>0&&(w=x[t],x[t]=x[t+1],x[t+1]=w,c[t]=s,c[t+1]=e)}let v=b,I=0,S=0;for(let t=b;t<4;t++){switch(t){case 0:S=2*h[x[t]];break;case 1:S=1.66666666*h[x[t]];break;case 2:S=1.33333333*h[x[t]];break;case 3:S=h[x[t]]}S>I&&(I=S,v=x[t])}return a[v]}function fs(t,e){let s,i,r,n,o=0;for(e.reset();e.nextPath()&&e.nextPoint();)for(s=e.x,i=e.y;e.nextPoint();s=r,i=n)r=e.x,n=e.y,i>t[1]!=n>t[1]&&((r-s)*(t[1]-i)-(n-i)*(t[0]-s)>0?o++:o--);return 0!==o}function ms(t,e,s){if(s&&fs(t,e))return{coord:t,distance:0};let i=1/0,r=0,n=0,o=[0,0],a=[0,0];const h=[0,0];for(e.reset();e.nextPath()&&e.nextPoint();)if(!(e.pathSize<2))for(o[0]=e.x,o[1]=e.y;e.nextPoint();o=a){a=[e.x,e.y],(0,$t.gR)(h,t,o,a);const s=Ms(t,h);s<i&&(i=s,r=h[0],n=h[1])}return{coord:[r,n],distance:Math.sqrt(i)}}function gs(t,e,s,i){const r=[e,0];let n=1/0,o=1/0,a=!1,h=!1;const c=[[e,i[1]-1],[e,i[3]+1]],l=[0,0],u=[0,0],d=[0,0],_=[[0,0],[0,0]],p=(0,H.vt)();for(t.reset();t.nextPath()&&t.nextPoint();)if(!(t.pathSize<2))for(_[0][0]=t.x,_[0][1]=t.y;t.nextPoint();_[0][0]=_[1][0],_[0][1]=_[1][1]){if(_[1][0]=t.x,_[1][1]=t.y,null===ys(p,_))continue;if(u[0]=c[0][0],u[1]=c[0][1],d[0]=c[1][0],d[1]=c[1][1],0===Is(p,u,d))continue;if(!(0,_s.Ql)(c[0],c[1],_[0],_[1],l))continue;const e=l[1];n>o?e<n&&(n=e,a=!0):e<o&&(o=e,h=!0)}return a&&h?r[1]=(n+o)/2:r[0]=r[1]=NaN,r}function ys(t,e){if(e.length<2)return null;t||(t=(0,H.vt)());const[s,i]=e[0],[r,n]=e[1];return t[0]=Math.min(s,r),t[1]=Math.min(i,n),t[2]=Math.max(s,r),t[3]=Math.max(i,n),t}const xs=1,bs=4,ws=3,vs=12;function Is(t,e,s){let i=Ss(e,t),r=Ss(s,t);const n=t[0],o=t[1],a=t[2],h=t[3];if(i&r)return 0;if(!(i|r))return 4;const c=(i?1:0)|(r?2:0);do{const c=s[0]-e[0],l=s[1]-e[1];if(c>l)i&ws?(i&xs?(e[1]+=l*(n-e[0])/c,e[0]=n):(e[1]+=l*(a-e[0])/c,e[0]=a),i=Ss(e,t)):r&ws?(r&xs?(s[1]+=l*(n-s[0])/c,s[0]=n):(s[1]+=l*(a-s[0])/c,s[0]=a),r=Ss(s,t)):i?(i&bs?(e[0]+=c*(o-e[1])/l,e[1]=o):(e[0]+=c*(h-e[1])/l,e[1]=h),i=Ss(e,t)):(r&bs?(s[0]+=c*(o-s[1])/l,s[1]=o):(s[0]+=c*(h-s[1])/l,s[1]=h),r=Ss(s,t));else if(i&vs?(i&bs?(e[0]+=c*(o-e[1])/l,e[1]=o):(e[0]+=c*(h-e[1])/l,e[1]=h),i=Ss(e,t)):r&vs?(r&bs?(s[0]+=c*(o-s[1])/l,s[1]=o):(s[0]+=c*(h-s[1])/l,s[1]=h),r=Ss(s,t)):i?(i&xs?(e[1]+=l*(n-e[0])/c,e[0]=n):(e[1]+=l*(a-e[0])/c,e[0]=a),i=Ss(e,t)):(r&xs?(s[1]+=l*(n-s[0])/c,s[0]=n):(s[1]+=l*(a-s[0])/c,s[0]=a),r=Ss(s,t)),i&r)return 0}while(i|r);return c}function Ss(t,e){return(t[0]<e[0]?1:0)|(t[0]>e[2]?1:0)<<1|(t[1]<e[1]?1:0)<<2|(t[1]>e[3]?1:0)<<3}function Ps(t,e,s){return t+(e-t)*s}function Ms(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Cs(t,e){if(t<e)return-1;if(t>e)return 1;if(t===e)return 0;const s=isNaN(t),i=isNaN(e);return s<i?-1:s>i?1:0}class As{static{this.instance=null}static local(){return null===As.instance&&(As.instance=new As),As.instance}execute(t,e,s,i,r){return new Ts(t,e,s)}}class Ts{constructor(t,e,s){this._geometryCursor=t,this._offsetX=void 0!==e.offsetX?e.offsetX*s:0,this._offsetY=void 0!==e.offsetY?e.offsetY*s:0,this._method=void 0!==e.method?e.method:"OnPolygon",this._placementPerPart=void 0!==e.placePerPart&&e.placePerPart,this._internalPlacement=new Lt}next(){const t=this._geometryCursor;if(!t)return null;if(!this._placementPerPart)return this._geometryCursor=null,this._polygonCenter(t);for(;t.nextPath();)if(!(t.getCurrentRingArea()<0))return this._polygonCenter(t.getCurrentPath());return this._geometryCursor=null,null}_polygonCenter(t){let e=!1;switch(this._method){case"CenterOfMass":{const s=(0,ve.TP)(t);s&&(this._internalPlacement.setTranslate(s[0]+this._offsetX,s[1]+this._offsetY),e=!0)}break;case"BoundingBoxCenter":{const s=(0,le.z8)(t);s&&(this._internalPlacement.setTranslate((s[2]+s[0])/2+this._offsetX,(s[3]+s[1])/2+this._offsetY),e=!0)}break;default:{const s=ps(t);null!==s&&(this._internalPlacement.setTranslate(s[0]+this._offsetX,s[1]+this._offsetY),e=!0)}}return e?this._internalPlacement:null}}function ks(t){if(!t)return null;switch(t.type){case"CIMGeometricEffectAddControlPoints":return zt.local();case"CIMGeometricEffectArrow":return Wt.local();case"CIMGeometricEffectBuffer":return Ht.local();case"CIMGeometricEffectControlMeasureLine":return Qt.local();case"CIMGeometricEffectCut":return Kt.local();case"CIMGeometricEffectDashes":return oe.local();case"CIMGeometricEffectDonut":return he.local();case"CIMGeometricEffectJog":return me.local();case"CIMGeometricEffectMove":return ye.local();case"CIMGeometricEffectOffset":return be.local();case"CIMGeometricEffectRadial":return Ie.local();case"CIMGeometricEffectReverse":return Pe.local();case"CIMGeometricEffectRotate":return Ae.local();case"CIMGeometricEffectScale":return ke.local();case"CIMGeometricEffectSuppress":return Re.local();case"CIMGeometricEffectTaperedPolygon":return Ve.local();case"CIMGeometricEffectWave":return He.local();case"CIMGeometricEffectEnclosingPolygon":return ue.local()}return null}class Fs{static getPlacement(t,e,s,i,r,n){const o=function(t){if(!t)return null;switch(t.type){case"CIMMarkerPlacementAlongLineSameSize":return $e.local();case"CIMMarkerPlacementAtExtremities":return Je.local();case"CIMMarkerPlacementAtRatioPositions":return ts.local();case"CIMMarkerPlacementInsidePolygon":return ns.local();case"CIMMarkerPlacementOnLine":return hs.local();case"CIMMarkerPlacementOnVertices":return ls.local();case"CIMMarkerPlacementPolygonCenter":return As.local()}return null}(s);return o?(-1===e&&t.invertY(),o.execute(t,s,i,r,n)):null}}var Es=s(68197);function Rs(t,e){return[!!t?.minScale&&e.scaleToZoom(t.minScale)||0,!!t?.maxScale&&e.scaleToZoom(t.maxScale)||100]}function zs(t){return 1<<t}function Os(t){let e=0;for(const[s,i]of t)i&&(e|=1<<s);return e}function Ls(t){let e;if(!t)return[0,0,0,0];if("string"==typeof t){const s=Es.A.fromString(t);if(!s)return D.A.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.meshWriterUtils").errorOnce(new i.A("mapview:mesh-processing","Unable to parse string into color",{color:t})),[0,0,0,0];e=s.toArray()}else e=t;const[s,r,n,o]=e;return[s*(o/255),r*(o/255),n*(o/255),o]}function Ds(t){switch(t){case"butt":case"Butt":return 0;case"round":case"Round":return 1;case"square":case"Square":return 2}}function Gs(t){switch(t){case"bevel":case"Bevel":return 0;case"miter":case"Miter":return 2;case"round":case"Round":return 1}}function Ns(t,e){return Math.round(Math.min(Math.sqrt(t*e),255))}function Bs(t,e){return Math.round(t*e)/e}const qs=0,Ws=1,Us=2,Ys=3,js=4,Vs=5;new(s(32488).A),s(11831),s(92602),new Map,new Set;var Xs=s(34727);s(40804),s(5760);var Hs=s(34304);function Zs(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function $s(t,e,s){const i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=s[0],l=s[1],u=s[2],d=s[3],_=s[4],p=s[5];return t[0]=i*c+n*l,t[1]=r*c+o*l,t[2]=i*u+n*d,t[3]=r*u+o*d,t[4]=i*_+n*p+a,t[5]=r*_+o*p+h,t}function Qs(t,e,s){const i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=Math.sin(s),l=Math.cos(s);return t[0]=i*l+n*c,t[1]=r*l+o*c,t[2]=i*-c+n*l,t[3]=r*-c+o*l,t[4]=a,t[5]=h,t}function Js(t,e,s){const i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=s[0],l=s[1];return t[0]=i,t[1]=r,t[2]=n,t[3]=o,t[4]=i*c+n*l+a,t[5]=r*c+o*l+h,t}function Ks(t,e){const s=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=s,t[2]=-s,t[3]=i,t[4]=0,t[5]=0,t}function ti(t,e,s){return t[0]=e[0]-s[0],t[1]=e[1]-s[1],t[2]=e[2]-s[2],t[3]=e[3]-s[3],t[4]=e[4]-s[4],t[5]=e[5]-s[5],t}const ei=$s,si=ti;function ii(){const t=new Float32Array(6);return t[0]=1,t[3]=1,t}function ri(t,e,s,i){const r=e[i],n=e[i+1];t[i]=s[0]*r+s[2]*n+s[4],t[i+1]=s[1]*r+s[3]*n+s[5]}function ni(t,e,s,i=0,r=0,n=2){const o=r||e.length/n;for(let r=i;r<o;r++)ri(t,e,s,r*n)}Object.freeze(Object.defineProperty({__proto__:null,add:function(t,e,s){return t[0]=e[0]+s[0],t[1]=e[1]+s[1],t[2]=e[2]+s[2],t[3]=e[3]+s[3],t[4]=e[4]+s[4],t[5]=e[5]+s[5],t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},determinant:function(t){return t[0]*t[3]-t[1]*t[2]},equals:function(t,e){const s=t[0],i=t[1],r=t[2],n=t[3],o=t[4],a=t[5],h=e[0],c=e[1],l=e[2],u=e[3],d=e[4],_=e[5],p=(0,Hs.FD)();return Math.abs(s-h)<=p*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(i-c)<=p*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(r-l)<=p*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(n-u)<=p*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-d)<=p*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(a-_)<=p*Math.max(1,Math.abs(a),Math.abs(_))},exactEquals:function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},frob:function(t){return Math.sqrt(t[0]**2+t[1]**2+t[2]**2+t[3]**2+t[4]**2+t[5]**2+1)},fromRotation:Ks,fromScaling:function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},fromTranslation:function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},identity:Zs,invert:function(t,e){const s=e[0],i=e[1],r=e[2],n=e[3],o=e[4],a=e[5];let h=s*n-i*r;return h?(h=1/h,t[0]=n*h,t[1]=-i*h,t[2]=-r*h,t[3]=s*h,t[4]=(r*a-n*o)*h,t[5]=(i*o-s*a)*h,t):null},mul:ei,multiply:$s,multiplyScalar:function(t,e,s){return t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*s,t[5]=e[5]*s,t},multiplyScalarAndAdd:function(t,e,s,i){return t[0]=e[0]+s[0]*i,t[1]=e[1]+s[1]*i,t[2]=e[2]+s[2]*i,t[3]=e[3]+s[3]*i,t[4]=e[4]+s[4]*i,t[5]=e[5]+s[5]*i,t},rotate:Qs,scale:function(t,e,s){const i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=s[0],l=s[1];return t[0]=i*c,t[1]=r*c,t[2]=n*l,t[3]=o*l,t[4]=a,t[5]=h,t},set:function(t,e,s,i,r,n,o){return t[0]=e,t[1]=s,t[2]=i,t[3]=r,t[4]=n,t[5]=o,t},str:function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},sub:si,subtract:ti,translate:Js},Symbol.toStringTag,{value:"Module"})),Object.freeze(Object.defineProperty({__proto__:null,clone:function(t){const e=new Float32Array(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},create:ii,fromValues:function(t,e,s,i,r,n){const o=new Float32Array(6);return o[0]=t,o[1]=e,o[2]=s,o[3]=i,o[4]=r,o[5]=n,o},transform:ri,transformMany:ni},Symbol.toStringTag,{value:"Module"}));var oi=s(88340);var ai=s(18989);class hi{constructor(t,e,s,i){this.transformedX=0,this.transformedY=0,this.center=(0,oi.fA)(t,e),this.centerT=(0,oi.vt)(),this.halfWidth=s/2,this.halfHeight=i/2,this.width=s,this.height=i}get x(){return this.center[0]}get y(){return this.center[1]}get blX(){return this.center[0]+this.halfWidth}get blY(){return this.center[1]+this.halfHeight}get trX(){return this.center[0]-this.halfWidth}get trY(){return this.center[1]-this.halfHeight}get xmin(){return this.x-this.halfWidth}get xmax(){return this.x+this.halfWidth}get ymin(){return this.y-this.halfHeight}get ymax(){return this.y+this.halfHeight}set x(t){this.center[0]=t}set y(t){this.center[1]=t}clone(){return new hi(this.x,this.y,this.width,this.height)}serialize(t){return t.writeF32(this.center[0]),t.writeF32(this.center[1]),t.push(this.width),t.push(this.height),t}findCollisionDelta(t,e=4){const s=Math.abs(t.centerT[0]-this.centerT[0]),i=Math.abs(t.centerT[1]-this.centerT[1]),r=(t.halfWidth+this.halfWidth+e)/s,n=(t.halfHeight+this.halfHeight+e)/i,o=Math.min(r,n);return Math.log2(o)}extend(t){const e=Math.min(this.xmin,t.xmin),s=Math.min(this.ymin,t.ymin),i=Math.max(this.xmax,t.xmax)-e,r=Math.max(this.ymax,t.ymax)-s,n=e+i/2,o=s+r/2;this.width=i,this.height=r,this.halfWidth=i/2,this.halfHeight=r/2,this.x=n,this.y=o}static deserialize(t){const e=t.readF32(),s=t.readF32(),i=t.readInt32(),r=t.readInt32();return new hi(e,s,i,r)}}const ci=Math.PI/180;class li{constructor(t,e,s,i){this._rotationT=ii(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const r=s.rect,n=new Float32Array(8);t*=i,e*=i;const o=s.code?r.width*i:s.metrics.width,a=s.code?r.height*i:s.metrics.height;this.width=o,this.height=a,n[0]=t,n[1]=e,n[2]=t+o,n[3]=e,n[4]=t,n[5]=e+a,n[6]=t+o,n[7]=e+a,this._data=n,this._setTextureCoords(r),this._scale=i,this._mosaic=s,this.x=t,this.y=e,this.maxOffset=Math.max(t+o,e+a)}get mosaic(){return this._mosaic}set angle(t){this._angle=t,Ks(this._rotationT,-t),this._setOffsets()}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:e}=this._mosaic.metrics,s=e*this._scale,i=Math.abs(t)*this._scale,r=new Float32Array(8);r[0]=this.x,r[1]=this.y,r[2]=this.x+s,r[3]=this.y,r[4]=this.x,r[5]=this.y+i,r[6]=this.x+s,r[7]=this.y+i,ni(r,r,$s(ii(),this._rotationT,this._transform));let n=1/0,o=1/0,a=-1/0,h=-1/0;for(let t=0;t<4;t++){const e=r[2*t],s=r[2*t+1];n=Math.min(n,e),o=Math.min(o,s),a=Math.max(a,e),h=Math.max(h,s)}const c=a-n,l=h-o,u=n+c/2,d=o+l/2;this._bounds=new hi(u,d,c,l)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(){this._offsets||(this._offsets={topLeft:[0,0],topRight:[0,0],bottomLeft:[0,0],bottomRight:[0,0]});const t=$s(ii(),this._rotationT,this._transform);this._offsets.topLeft[0]=this._data[0],this._offsets.topLeft[1]=this._data[1],this._offsets.topRight[0]=this._data[2],this._offsets.topRight[1]=this._data[3],this._offsets.bottomLeft[0]=this._data[4],this._offsets.bottomLeft[1]=this._data[5],this._offsets.bottomRight[0]=this._data[6],this._offsets.bottomRight[1]=this._data[7],(0,N.l0)(this._offsets.topLeft,this._offsets.topLeft,t),(0,N.l0)(this._offsets.topRight,this._offsets.topRight,t),(0,N.l0)(this._offsets.bottomLeft,this._offsets.bottomLeft,t),(0,N.l0)(this._offsets.bottomRight,this._offsets.bottomRight,t)}_setTextureCoords({x:t,y:e,width:s,height:i}){this._texcoords={topLeft:[t,e],topRight:[t+s,e],bottomLeft:[t,e+i],bottomRight:[t+s,e+i]}}}const ui=(t,e)=>({code:0,page:0,sdf:!0,rect:new ai.A(0,0,11,8),textureBinding:e,metrics:{advance:0,height:4,width:t,left:0,top:0}});function di(t,e){return t.forEach(t=>(0,N.l0)(t,t,e)),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class _i{constructor(t,e,s){this._rotation=0,this._decorate(t,e,s),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=0!==s.angle,this._transform=this._createGlyphTransform(this.bounds,s),this._borderLineSizePx=s.borderLineSizePx,(s.borderLineSizePx||s.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const e of t)e.setTransform(this._transform)}setRotation(t){if(0===t&&0===this._rotation)return;this._rotation=t;const e=this._transform;$s(e,Ks(ii(),t),e);for(const t of this.glyphs)t.setTransform(this._transform)}_decorate(t,e,s){if(!s.decoration||"none"===s.decoration||!t.length)return;const i=s.scale,r="underline"===s.decoration?26:16,n=t[0].textureBinding;for(const s of e){const e=s.startX*i,o=s.startY*i,a=(s.width+s.glyphWidthEnd)*i;t.push(new li(e,o+r*i,ui(a,n),1))}}shapeBackground(t){const e=(1.5+(this._borderLineSizePx||0))/2,s=this._borderLineSizePx?e:0,{xmin:i,ymin:r,xmax:n,ymax:o,x:a,y:h,width:c,height:l}=this.bounds,u=[i-8,r-8],d=[n+8,r-8],_=[i-8,o+8],p=[n+8,o+8],f=di([[u[0]-e,u[1]-e],[d[0]+e,d[1]-e],[u[0]+s,u[1]+s],[d[0]-s,d[1]+s]],t),m=di([[_[0]+s,_[1]-s],[p[0]-s,p[1]-s],[_[0]-e,_[1]+e],[p[0]+e,p[1]+e]],t),g=di([[u[0]-e,u[1]-e],[u[0]+s,u[1]+s],[_[0]-e,_[1]+e],[_[0]+s,_[1]-s]],t),y=di([[d[0]-s,d[1]+s],[d[0]+e,d[1]-e],[p[0]-s,p[1]-s],[p[0]+e,p[1]+e]],t),x={main:di([u,d,_,p],t),top:f,bot:m,left:g,right:y};return[new hi(a,h,c+2*e,l+2*e),x]}get boundsT(){const t=this.bounds,e=(0,N.hZ)((0,oi.vt)(),t.x,t.y);if((0,N.l0)(e,e,this._transform),this._hasRotation){const s=Math.max(t.width,t.height);return new hi(e[0],e[1],s,s)}return new hi(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,s=1/0,i=0,r=0;for(const n of t)e=Math.min(e,n.xTopLeft),s=Math.min(s,n.yTopLeft),i=Math.max(i,n.xBottomRight),r=Math.max(r,n.yBottomRight);const n=i-e,o=r-s;return new hi(e+n/2,s+o/2,n,o)}_createGlyphTransform(t,e){const s=ci*e.angle,i=ii(),r=(0,oi.vt)();return Js(i,i,(0,N.hZ)(r,e.xOffset,-e.yOffset)),e.useCIMAngleBehavior?Qs(i,i,s):(Js(i,i,(0,N.hZ)(r,t.x,t.y)),Qs(i,i,s),Js(i,i,(0,N.hZ)(r,-t.x,-t.y))),i}}class pi{constructor(t,e,s,i,r,n){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,s)),this.end=Math.max(0,Math.max(e,s)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].metrics.width),this.width=i,this.yMin=r,this.yMax=n}}const fi=t=>10===t,mi=t=>32===t;function gi(t,e){const s=e.scale,i=new Array,{glyphs:r,isRightToLeft:n}=t,o=function(t,e,s){const i=new Array,r=1/s.scale,n=s.maxLineWidth*r,o=e?t.length-1:0,a=e?-1:t.length,h=e?-1:1;let c=o,l=0,u=0,d=c,_=d,p=0,f=1/0,m=0;for(;c!==a;){const{code:e,metrics:s}=t[c],r=Math.abs(s.top);if(fi(e)||mi(e)||(f=Math.min(f,r),m=Math.max(m,r+s.height)),fi(e))c!==o&&(i.push(new pi(t,d,c-h,l,f===1/0?0:f,m)),f=1/0,m=0),l=0,d=c+h,_=c+h,u=0;else if(mi(e))_=c+h,u=0,p=s.advance,l+=s.advance;else if(l>n){if(_!==d){const e=_-2*h;l-=p,i.push(new pi(t,d,e,l-u,f,m)),f=1/0,m=0,d=_,l=u}else i.push(new pi(t,d,c-h,l,f,m)),f=1/0,m=0,d=c,_=c,l=0;l+=s.advance,u+=s.advance}else l+=s.advance,u+=s.advance;c+=h}const g=new pi(t,d,c-h,l,f,m);return g.start>=0&&g.end<t.length&&i.push(g),i}(r,n,e),a=o.length?function(t,e){let s=0;for(let e=0;e<t.length;e++){const{width:i}=t[e];s=Math.max(i,s)}const i="underline"===e.decoration?4:0,r=t[0].yMin;return{x:0,y:r,height:t[t.length-1].yMax+e.lineHeight*(t.length-1)+i-r,width:s}}(o,e):{y:0,height:0},h=function(t){if(!t)return 0;switch(t){case"Left":case"left":return-1;case"Right":case"right":return 1;case"Justify":return D.A.getLogger("esri.views.2d.engine.webgl.alignmentUtils").warnOnce("Horizontal alignment 'justify' is not implemented. Falling back to 'center'."),0;case"Center":case"center":return 0}}(e.horizontalAlignment),c=function(t){if(!t)return 0;switch(t){case"Top":case"top":return 1;case"Center":case"middle":return 0;case"Baseline":case"baseline":return 2;case"Bottom":case"bottom":return-1}}(e.verticalAlignment),l=2===c?1:0,u=l?0:c-1,d=(1-l)*-a.y+u*(a.height/2)+-22*(l?1:0);for(let n=0;n<o.length;n++){const{start:a,end:c,width:l}=o[n];let u=-1*(h+1)*(l/2)-3;const _=(t.isRightToLeft?o.length-1-n:n)*e.lineHeight+d-3;o[n].startX=u,o[n].startY=_;for(let t=a;t<=c;t++){const e=r[t];if(fi(e.code))continue;const n=new li(u+e.metrics.left,_-e.metrics.top,e,s);u+=e.metrics.advance,i.push(n)}}return new _i(i,o,e)}var yi=s(39829);Math.PI,s(59868);var xi=s(13195);function bi(t){if(!t)return 0;switch(t.type){case"CIMGeometricEffectArrow":return Math.abs(.5*t.width);case"CIMGeometricEffectBuffer":return Math.abs(t.size);case"CIMGeometricEffectControlMeasureLine":return 500;case"CIMGeometricEffectExtension":case"CIMGeometricEffectRadial":return Math.abs(t.length);case"CIMGeometricEffectJog":return Math.abs(.5*t.length);case"CIMGeometricEffectMove":return Math.max(Math.abs((0,ne.$w)(t.offsetX)),Math.abs((0,ne.$w)(t.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(t.offset);case"CIMGeometricEffectRegularPolygon":return Math.abs(t.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(t.fromWidth),Math.abs(t.toWidth));case"CIMGeometricEffectWave":return Math.abs(t.amplitude);case"CIMGeometricEffectDonut":return Math.abs(t.width)}}function wi(t){if(!t)return 0;let e=0;for(const s of t)e+=bi(s);return e}Math.PI,Math.PI;const vi=96/72;class Ii{static executeEffects(t,e,s,i,r){const n=vi,o=wi(t);let a=new Vt(e);for(const e of t){const t=ks(e);t&&(a=t.execute(a,e,n,s,i,o,r))}return a}static applyEffects(t,e,s){if(!t)return e;const i=wi(t);let r,n=new Vt(Pt.fromJSONCIM(e));for(const e of t){const t=ks(e);t&&(n=t.execute(n,e,1,null,s,i,!1))}const o=[];let a=null;for(;r=n.next();)o.push(...(0,vt.x)(r)),a=r.geometryType;return 0===o.length||null===a?null:"esriGeometryPolygon"===a?{rings:o}:{paths:o}}}let Si=null;function Pi(){return Si}const Mi=new Float32Array(1),Ci=new Uint32Array(Mi.buffer);function Ai(t){const e=function(t){return Mi[0]=t,Ci[0]}(t),s=e>>>31;let i=e>>>23&255,r=8388607&e;return i-=127,i>15?s<<15|31744:i<-25?0:(i<-14&&(r+=8388608,r/=2**(-14-i),i=-15),i+=15,r/=8192,r=function(t){const e=Math.floor(t),s=t-e;return e<1023&&(s>.5||.5===s&&e%2==1)?e+1:e}(r),s<<15|i<<10|r)}function Ti(t,e,s,i,r,n,o){if(t.primitiveName===e){let e=i?.readWithDefault(r,n,t[s]&&o);return"text"===t.type&&(e=e.toString()),void(t[s]=e)}if("type"in t&&null!=t.type){if(t.effects)for(const a of t.effects)Ti(a,e,s,i,r,n,o);switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(t.symbolLayers)for(const a of t.symbolLayers)Ti(a,e,s,i,r,n,o);break;case"CIMTextSymbol":t.symbol&&Ti(t.symbol,e,s,i,r,n,o);break;case"CIMHatchFill":t.lineSymbol&&Ti(t.lineSymbol,e,s,i,r,n,o);break;case"CIMPictureMarker":case"CIMCharacterMarker":case"CIMVectorMarker":if(t.markerPlacement&&Ti(t.markerPlacement,e,s,i,r,n,o),"CIMVectorMarker"===t.type&&t.markerGraphics)for(const a of t.markerGraphics)Ti(a,e,s,i,r,n,o),Ti(a.symbol,e,s,i,r,n,o)}}}function ki(t){const e=Math.max(1.25*t.width,20);return null!=t.effects&&t.effects.length>0?400:e}var Fi=s(63907);function Ei(t){switch(t){case Fi.pe.BYTE:case Fi.pe.UNSIGNED_BYTE:return 1;case Fi.pe.SHORT:case Fi.pe.UNSIGNED_SHORT:case Fi.pe.HALF_FLOAT:return 2;case Fi.pe.FLOAT:case Fi.pe.INT:case Fi.pe.UNSIGNED_INT:return 4}}class Ri{static fromVertexSpec(t,e){const{attributes:s,optionalAttributes:i}=t;let r,n,o;const a=[];for(const t in s){if(s[t].otherSource)continue;const e=s[t];"position"===e.pack?r={...e,name:t,offset:0}:"id"===e.pack?n={...e,name:t,offset:4}:"bitset"===t?o={...e,name:t,offset:7}:a.push({...e,name:t})}for(const t in i)if(!0===e[t]){const e=i[t];a.push({...e,name:t})}const h=function(t){const e=[],s=[],i=[];for(const r of t){const t=Ei(r.type)*r.count;switch(t%2||t%4||4){case 4:e.push(r);continue;case 2:s.push(r);continue;case 1:i.push(r);continue;default:throw new Error("Found unexpected dataType byte count")}}return e.push(...s),e.push(...i),e}(a),c=[];let l=8,u=1;for(const t of h)c.push({...t,offset:l}),l+=Ei(t.type)*t.count,t.packAlternating&&(u=Math.max(t.packAlternating.count,u));const d=Uint32Array.BYTES_PER_ELEMENT,_=l%d;return new Ri(r,n,o,c,l+(_?d-_:0),u)}constructor(t,e,s,i,r,n){this.position=t,this.id=e,this.bitset=s,this.standardAttributes=i,this.stride=r,this.packVertexCount=n,i.push(s),this._attributes=[t,e,s,...i]}get attributeLayout(){if(!this._attributeLayout){const t=function(t){const e=t.map(({name:t,count:e,type:s})=>`${t}.${e}.${s}`).join(",");return(0,yt.Wm)(e)}(this._attributes),e=this._attributes.map(t=>({name:t.name,count:t.count,offset:t.offset,type:t.type,packPrecisionFactor:t.packPrecisionFactor,normalized:t.normalized??!1}));this._attributeLayout={attributes:e,hash:t,stride:this.stride}}return this._attributeLayout}}class zi{static fromVertexSpec(t,e){const s=Ri.fromVertexSpec(t,e);return new zi(s)}constructor(t){this._spec=t,this._packed=new Uint8Array(this._spec.stride*this._spec.packVertexCount),this._packedU32View=new Uint32Array(this._packed.buffer),this._dataView=new DataView(this._packed.buffer)}get attributeLayout(){return this._spec.attributeLayout}get stride(){return this._spec.stride}writeVertex(t,e,s,i,r,n){for(let t=0;t<this._spec.packVertexCount;t++){const o=t*this._spec.stride;this._packPosition(s,i,o),this._packId(e,o);const a=this._spec.bitset;if(n){if(a.packTessellation){const t=a.packTessellation(n,r,s,i);this._pack(t,a,o)}for(const t of this._spec.standardAttributes)if(null!=t.packTessellation){const e=t.packTessellation(n,r,s,i);this._pack(e,t,o)}else if(t.packAlternating?.packTessellation){const e=t.packAlternating.packTessellation(n,r,s,i);for(let s=0;s<this._spec.packVertexCount;s++){const i=e[s];this._pack(i,t,s*this._spec.stride)}}}}t.vertexWriteRegion(this._packedU32View)}pack(t,e){for(const s of this._spec.standardAttributes)if(s.pack&&"string"!=typeof s.pack){const i=s.pack(t,e);for(let t=0;t<this._spec.packVertexCount;t++)this._pack(i,s,t*this._spec.stride)}else if(s.packAlternating?.pack){const i=s.packAlternating.pack(t,e);for(let t=0;t<this._spec.packVertexCount;t++){const e=i[t];this._pack(e,s,t*this._spec.stride)}}}_packPosition(t,e,s){const{offset:i}=this._spec.position,r=this._spec.position.packPrecisionFactor??1,n=65535&t*r|e*r<<16;this._dataView.setUint32(s+i,n,!0)}_packId(t,e){const s=t*(this._spec.id.packPrecisionFactor??1),i=4278190080&this._dataView.getUint32(e+this._spec.id.offset,!0);this._dataView.setUint32(e+this._spec.id.offset,s|i,!0)}_pack(t,e,s){!function(t,e,s,i){const r=s.packPrecisionFactor??1;switch(s.type){case Fi.pe.BYTE:if(1===s.count)t.setInt8(i+s.offset,e*r);else for(let n=0;n<s.count;n++){const o=n*Int8Array.BYTES_PER_ELEMENT;t.setInt8(i+s.offset+o,e[n]*r)}break;case Fi.pe.UNSIGNED_BYTE:if(1===s.count)t.setUint8(i+s.offset,e*r);else for(let n=0;n<s.count;n++){const o=n*Uint8Array.BYTES_PER_ELEMENT;t.setUint8(i+s.offset+o,e[n]*r)}break;case Fi.pe.SHORT:if(1===s.count)t.setInt16(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Int16Array.BYTES_PER_ELEMENT;t.setInt16(i+s.offset+o,e[n]*r,!0)}break;case Fi.pe.UNSIGNED_SHORT:if(1===s.count)t.setUint16(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Uint16Array.BYTES_PER_ELEMENT;t.setUint16(i+s.offset+o,e[n]*r,!0)}break;case Fi.pe.INT:if(1===s.count)t.setInt32(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Int32Array.BYTES_PER_ELEMENT;t.setInt32(i+s.offset+o,e[n]*r,!0)}break;case Fi.pe.UNSIGNED_INT:if(1===s.count)t.setUint32(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Uint32Array.BYTES_PER_ELEMENT;t.setUint32(i+s.offset+o,e[n]*r,!0)}break;case Fi.pe.FLOAT:if(1===s.count)t.setFloat32(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Float32Array.BYTES_PER_ELEMENT;t.setFloat32(i+s.offset+o,e[n]*r,!0)}break;case Fi.pe.HALF_FLOAT:if(1===s.count)t.setUint16(i+s.offset,Ai(e*r),!0);else for(let n=0;n<s.count;n++){const o=n*Uint16Array.BYTES_PER_ELEMENT;t.setUint16(i+s.offset+o,Ai(e[n]*r),!0)}}}(this._dataView,t,e,s)}}class Oi{constructor(t,e,s,i){this._instanceId=t,this._evaluator=e,this._enabledOptionalAttributes=s,this._viewParams=i,this._evaluator.evaluator=t=>this.vertexSpec.createComputedParams(t)}get _vertexPack(){if(!this._cachedVertexPack){const t=zi.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||t.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=t}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}setReferences(t){this._references=t}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){(function(t){if(!t)return!1;for(const e of t)switch(e.effect.type){case"CIMGeometricEffectBuffer":case"CIMGeometricEffectDonut":case"CIMGeometricEffectOffset":case"CIMGeometricEffectTaperedPolygon":case"CIMGeometricEffectEnclosingPolygon":return!0}return!1})(this.effectInfos)&&await async function(){Si=await Promise.all([s.e(9930),s.e(9940)]).then(s.bind(s,47559))}()}enqueueRequest(t,e,s){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(t,e,s)}write(t,e,s,i,r){this.ensurePacked(e,s,i);const n=this.evaluatedMeshParams.effects;if(!n||0===n.length)return void this._write(t,s,void 0,r);const o=this.getEffectCursor(t,s,n);if(!o)return;let a;for(;a=o.next();)a.invertY(),this._write(t,s,a,r)}ensurePacked(t,e,s){if(!this._evaluator.hasDynamicProperties)return;const i=this._evaluator.evaluateMeshParams(t,e,s);this._vertexPack.pack(i,this._viewParams)}hasArcadeDependency(t){return this._evaluator.hasArcadeDependency(t)}_writeVertex(t,e,s,i,r){const n=this.evaluatedMeshParams;this._vertexPack.writeVertex(t,e,s,i,n,r)}getEffectCursor(t,e,s){const i=e.readGeometryForDisplay()?.clone();if(!i)return;const r=Pt.fromOptimizedCIM(i,e.geometryType),n=Pi();r.invertY();const o=t.id||"";return Ii.executeEffects(s,r,o,n,this._preventEffectClipping)}}class Li extends Oi{}function Di(t,e){let s;if("string"==typeof t)s=(0,yt.Wm)(t+`-seed(${e})`);else{let i=12;s=t^e;do{s=107*(s>>8^s)+i|0}while(0!==--i)}return(1+s/(1<<31))/2}function Gi(t){return Math.floor(Di(t,Ni)*Bi)}const Ni=53290320,Bi=10;class qi{generateSource(t){const e=[];for(let s=1;s<this.length;s++)e.push(`vec4 atom${s} = texture(${t.animationTexture}, (pointer + 0.5) / size);`),e.push("pointer.x += 1.0;");for(let t=0;t<this.ins;t++)e.push("top--;"),e.push(`vec4 in${this.ins-t-1} = stack[top];`);for(let t=0;t<this.outs;t++)e.push(`vec4 out${t};`);const{microcode:s}=this;for(const t of s)e.push(t);for(let t=0;t<this.outs;t++)e.push(`stack[top] = out${t};`),e.push("top++;"),e.push(`if (top >= ${Zi}) { top = ${Zi-1}; }`);return e}}let Wi=128;function Ui(t){return[`float duration = clamp(${t.duration}, 0.05, 3600.0);`,`float startTimeOffset = ${t.startTimeOffset};`,`float repeatDelay = ${t.repeatDelay};`,`float timeOriginSelector = ${t.timeOriginSelector};`,`float repeatType = ${t.repeatType};`,`float easing = ${t.easing};`,`float playAnimation = ${t.playAnimation} * (1.0 - step(0.0, -${t.duration}));`,`float reverseAnimation = ${t.reverseAnimation};`,"float time = globalTime - (timeOriginSelector == 1.0 ? localTimeOrigin : 0.0);","time *= playAnimation;","time *= 1.0 - reverseAnimation * 2.0;","float period = duration + repeatDelay;","time += reverseAnimation == 1.0 ? (period - startTimeOffset - 0.001) : startTimeOffset + 0.001;","float omega = time / period;","float oi = floor(omega);","omega = repeatType == 1.0 || repeatType == 3.0 ? omega - oi : omega;","float of = omega * period;","of = (clamp(of, reverseAnimation * repeatDelay, period - (1.0 - reverseAnimation) * repeatDelay) - reverseAnimation * repeatDelay) / duration;","of = easing == 2.0 ? pow(of, 3.0) : of;","of = easing == 3.0 ? 1.0 - pow(1.0 - of, 3.0) : of;","of = easing == 4.0 ? of < 0.5 ? 4.0 * pow(of, 3.0) : 1.0 - pow(-2.0 * of + 2.0, 3.0) / 2.0 : of;","bool oscillate = repeatType == 3.0 && mod(oi, 2.0) == 1.0;",`${t.out} = oscillate ? 1.0 - of : of;`]}const Yi={Linear:1,EaseIn:2,EaseOut:3,EaseInOut:4},ji={Loop:1,None:2,Oscillate:3},Vi={Local:1,Global:2};function Xi(t){const e=Yi[t.easing],s=ji[t.repeatType],i=Vi[t.timeOriginSelector];return[[t.duration,t.startTimeOffset,t.repeatDelay,i],[s,e,t.playAnimation,t.reverseAnimation]]}const Hi={scalar:new class extends qi{constructor(){super(...arguments),this.opcode=++Wi,this.length=1,this.ins=0,this.outs=1,this.microcode=["out0 = vec4(atom0.y, atom0.y, atom0.y, atom0.y);"]}encode(t){return[[this.opcode,t,0,0]]}},vector3:new class extends qi{constructor(){super(...arguments),this.opcode=++Wi,this.length=1,this.ins=0,this.outs=1,this.microcode=["out0 = vec4(atom0.yzw, 0.0);"]}encode(t){return[[this.opcode,t[0]||0,t[1]||0,t[2]||0]]}},vector4:new class extends qi{constructor(){super(...arguments),this.opcode=++Wi,this.length=2,this.ins=0,this.outs=1,this.microcode=["out0 = atom1;"]}encode(t){return[[this.opcode,0,0,0],t]}},animatedTransform:new class extends qi{constructor(){super(...arguments),this.opcode=++Wi,this.length=10,this.ins=1,this.outs=1,this.microcode=["vec2 fromTranslation = atom1.xy;","vec2 toTranslation = atom1.zw;","float fromRotation = atom2.x;","float toRotation = atom2.y;","float fromScale = atom2.z;","float toScale = atom2.w;","bool relativeTranslation = atom9.x == 1.0;","bool absoluteScale = atom9.y == 1.0;","vec2 translationMultiplier = relativeTranslation ? pixelDimensions : vec2(1.0, 1.0);","float scaleDivisor = absoluteScale ? pixelDimensions.y : 1.0;","float fTranslation;","{",...Ui({duration:"atom3.x",startTimeOffset:"atom3.y",repeatDelay:"atom3.z",timeOriginSelector:"atom3.w",repeatType:"atom4.x",easing:"atom4.y",playAnimation:"atom4.z",reverseAnimation:"atom4.w",out:"fTranslation"}),"}","float fRotation;","{",...Ui({duration:"atom5.x",startTimeOffset:"atom5.y",repeatDelay:"atom5.z",timeOriginSelector:"atom5.w",repeatType:"atom6.x",easing:"atom6.y",playAnimation:"atom6.z",reverseAnimation:"atom6.w",out:"fRotation"}),"}","float fScale;","{",...Ui({duration:"atom7.x",startTimeOffset:"atom7.y",repeatDelay:"atom7.z",timeOriginSelector:"atom7.w",repeatType:"atom8.x",easing:"atom8.y",playAnimation:"atom8.z",reverseAnimation:"atom8.w",out:"fScale"}),"}","vec2 aTranslation = mix(fromTranslation, toTranslation, fTranslation);","float aRotation = mix(fromRotation, toRotation, fRotation);","float aScale = mix(fromScale, toScale, fScale);","vec2 pTranslation = in0.xy;","float pRotation = in0.z;","float pScale = in0.w;","aTranslation *= translationMultiplier;","aScale /= scaleDivisor;","float rotation = pRotation + aRotation;","float scale = pScale * aScale;","float sin1 = sin(pRotation);","float cos1 = cos(pRotation);","float s1 = pScale;","float x1 = pTranslation.x;","float y1 = pTranslation.y;","float x2 = aTranslation.x;","float y2 = aTranslation.y;","\n vec2 translation = vec2(\n cos1 * s1 * x2 - sin1 * s1 * y2 + x1,\n sin1 * s1 * x2 + cos1 * s1 * y2 + y1\n );\n ","out0 = vec4(translation, rotation, scale);"]}encode(t){return[[this.opcode,0,0,0],[t.translation.from[0],t.translation.from[1],t.translation.to[0],t.translation.to[1]],[t.rotation.from,t.rotation.to,t.scale.from,t.scale.to],...Xi(t.translation.timing),...Xi(t.rotation.timing),...Xi(t.scale.timing),[t.relativeTranslation?1:0,t.absoluteScale?1:0,0,0]]}},animatedColor:new class extends qi{constructor(){super(...arguments),this.opcode=++Wi,this.length=7,this.ins=1,this.outs=1,this.microcode=["float fromOpacity = atom0.y;","float toOpacity = atom0.z;","vec4 fromColor = atom1;","vec4 toColor = atom2;","float fColor;","{",...Ui({duration:"atom3.x",startTimeOffset:"atom3.y",repeatDelay:"atom3.z",timeOriginSelector:"atom3.w",repeatType:"atom4.x",easing:"atom4.y",playAnimation:"atom4.z",reverseAnimation:"atom4.w",out:"fColor"}),"}","float fOpacity;","{",...Ui({duration:"atom5.x",startTimeOffset:"atom5.y",repeatDelay:"atom5.z",timeOriginSelector:"atom5.w",repeatType:"atom6.x",easing:"atom6.y",playAnimation:"atom6.z",reverseAnimation:"atom6.w",out:"fOpacity"}),"}","vec4 aColor = mix(fromColor, toColor, fColor);","aColor.a *= mix(fromOpacity, toOpacity, fOpacity);","vec4 pColor = in0;","out0 = aColor * pColor;"]}encode(t){return[[this.opcode,t.opacity.from,t.opacity.to,0],[t.color.from[0],t.color.from[1],t.color.from[2],t.color.from[3]],[t.color.to[0],t.color.to[1],t.color.to[2],t.color.to[3]],...Xi(t.color.timing),...Xi(t.opacity.timing)]}},animatedShift:new class extends qi{constructor(){super(...arguments),this.opcode=++Wi,this.length=4,this.ins=1,this.outs=1,this.microcode=["float fromShift = atom0.y;","float toShift = atom0.z;","float duration = atom1.x;","bool multiplyByLineLength = atom3.x == 1.0;","float fShift;","{",...Ui({duration:"duration",startTimeOffset:"atom1.y",repeatDelay:"atom1.z",timeOriginSelector:"atom1.w",repeatType:"atom2.x",easing:"atom2.y",playAnimation:"atom2.z",reverseAnimation:"atom2.w",out:"fShift"}),"}","toShift *= multiplyByLineLength ? lineLength : 1.0;","float aShift = mix(fromShift, toShift, fShift);","vec4 pShift = in0;","out0 = mod(aShift + pShift, lineLength);"]}encode(t){return[[this.opcode,t.shift.from,t.shift.to,0],...Xi(t.shift.timing),[t.multiplyByLineLength?1:0,0,0,0]]}},ret:new class extends qi{constructor(){super(...arguments),this.opcode=++Wi,this.length=1,this.ins=0,this.outs=0,this.microcode=["break;"]}encode(){return[[this.opcode,0,0,0]]}}},Zi=4;function $i(t){return t instanceof Qi?t:"object"==typeof t&&"type"in t?sr[t.type].hydrate(t):new Ji(t)}class Qi{constructor(t){this.inputs=t}encode(){const t=[];for(const e of this.inputs)t.push(...e.encode());return t.push(...this.instructions),t}}class Ji extends Qi{constructor(t){super([]),this.value=t}simplify(){return this}get instructions(){if(Array.isArray(this.value)){const[t,e,s,i]=this.value;return null!=i?Hi.vector4.encode([t,e||0,s||0,i]):Hi.vector3.encode([t,e||0,s||0])}return Hi.scalar.encode(this.value)}}class Ki extends Qi{constructor(t,e){super([e]),this._config=t,this._parent=e}static hydrate(t){return new Ki(t,$i(t.parent))}simplify(){if(this._config.relativeTranslation||this._config.absoluteScale)return this;const t=this._parent.simplify();if(!(t instanceof Ji))return this;const[e,s,i,r]=t.value,n=this._config.translation.from[0],o=this._config.translation.from[1],a=this._config.rotation.from,h=this._config.scale.from;if(n===this._config.translation.to[0]&&o===this._config.translation.to[1]&&a===this._config.rotation.to&&h===this._config.scale.to){const t=i+a,c=r*h,l=Math.sin(i),u=Math.cos(i);return new Ji([u*r*n-l*r*o+e,l*r*n+u*r*o+s,t,c])}return new Ki(this._config,t)}get instructions(){return Hi.animatedTransform.encode(this._config)}}class tr extends Qi{constructor(t,e){super([e]),this._config=t,this._parent=e}static hydrate(t){return new tr(t,$i(t.parent))}simplify(){const t=this._parent.simplify();if(!(t instanceof Ji))return this;const[e,s,i,r]=t.value,n=this._config.color.from[0],o=this._config.color.from[1],a=this._config.color.from[2];let h=this._config.color.from[3];const c=this._config.opacity.from;return n===this._config.color.to[0]&&o===this._config.color.to[1]&&a===this._config.color.to[2]&&h===this._config.color.to[3]&&c===this._config.opacity.to?(h*=c,new Ji([e*n,s*o,i*a,r*h])):new tr(this._config,t)}get instructions(){return Hi.animatedColor.encode(this._config)}}class er extends Qi{constructor(t,e){super([e]),this._config=t,this._parent=e}static hydrate(t){return new er(t,$i(t.parent))}simplify(){const t=this._parent.simplify();return t instanceof Ji?new er(this._config,t):this}get instructions(){return Hi.animatedShift.encode(this._config)}}const sr={AnimatedTransform:Ki,AnimatedColor:tr,AnimatedShift:er};function ir(t){return nr(t.map(t=>ar(t)).map(t=>$i(t).simplify()))}function rr(t){const e=[];return e.push(t.transform),e.push(t.fromColor),e.push(t.toColor),e.push(t.colorMix),e.push(t.toOpacity),e.push(t.opacityMix),t?.shift?e.push(t?.shift):e.push([1,1,1,1]),e}function nr(t){const e=[],s=[];let i=0;for(const r of t){const n=[...r.encode(),...Hi.ret.encode()];e.push([i+t.length,0,0,0]),s.push(...n),i+=n.length}return[...e,...s]}async function or(t,e){const s=t;let i;if("number"==typeof s||"string"==typeof s||"boolean"==typeof s)i=s;else if(Array.isArray(s))i=await Promise.all(s.map(t=>or(t,e)));else if("object"==typeof s)if("valueExpressionInfo"in s){const{valueExpressionInfo:t}=s,{expression:r}=t;i={...s,computed:await e.createComputedField({expression:r})}}else{i={};for(const t in s)i[t]=await or(s[t],e)}return i}function ar(t,e,s){const i=t;let r;if("number"==typeof i||"string"==typeof i||"boolean"==typeof i)r=i;else if(Array.isArray(i))r=i.map(t=>ar(t,e,s));else if("object"==typeof i)if("type"in i&&null!=i.type&&"Process"===i.type)switch(i.op){case"ArcadeColor":{const t=ar(i.value,e,s);cr(Array.isArray(t)&&4===t.length),r=[t[0]/255,t[1]/255,t[2]/255,t[3]]}break;case"Transparency":{const t=ar(i.value,e,s);cr("number"==typeof t),r=1-t/100}break;case"Divide":case"Multiply":case"Add":{const t=ar(i.left,e,s);cr("number"==typeof t);const n=ar(i.right,e,s);switch(cr("number"==typeof n),i.op){case"Divide":r=t/n;break;case"Multiply":r=t*n;break;case"Add":r=t+n}}break;case"Random":{const t=ar(i.seed,e,s),n=ar(i.min,e,s),o=ar(i.max,e,s);r=n+Di(Gi(e.getObjectId()||0),t)*(o-n)}break;case"Cond":{const t=ar(i.condition,e,s),n=ar(i.ifTrue,e,s),o=ar(i.ifFalse,e,s);r=t?n:o}break;case"MatchWinding":{const t=ar(i.sign,e,s);let n=ar(i.angle,e,s);if(t>0)for(;n<0;)n+=2*Math.PI;else for(;n>0;)n-=2*Math.PI;r=n}}else if("computed"in i)r=function(t){if(!("computed"in t))return t;let i=t.computed.readWithDefault(e,s,[255*t.defaultValue[0],255*t.defaultValue[1],255*t.defaultValue[2],t.defaultValue[3]]);if("string"==typeof i){const t=Es.A.fromString(i);t&&(i=[t.r,t.g,t.b,t.a])}return i}(i);else{r={};for(const t in i)r[t]=ar(i[t],e,s)}return r}function*hr(t){const e=t;if(Array.isArray(e))for(const t of e)yield*hr(t);else if("object"==typeof e)if("type"in e&&null!=e.type&&"Process"===e.type)switch(e.op){case"ArcadeColor":case"Transparency":yield*hr(e.value);break;case"Divide":case"Multiply":case"Add":yield*hr(e.left),yield*hr(e.right);break;case"Random":yield*hr(e.seed),yield*hr(e.min),yield*hr(e.max);break;case"Cond":yield*hr(e.condition),yield*hr(e.ifTrue),yield*hr(e.ifFalse);break;case"MatchWinding":yield*hr(e.sign),yield*hr(e.angle)}else if("computed"in e)yield e.computed;else for(const t in e)yield*hr(e[t])}function cr(t){if(!t)throw new Error("Assertion failed.")}const lr={type:Fi.pe.SHORT,count:2,packPrecisionFactor:_.fq,pack:({scaleInfo:t},{tileInfo:e})=>Rs(t,e)},ur={type:Fi.pe.FLOAT,count:4,packPrecisionFactor:1,packTessellation:({value1Position2Value2:t})=>(cr(t),t)},dr={type:Fi.pe.FLOAT,count:4,packPrecisionFactor:1,packTessellation:()=>[0,0,0,1]},_r={type:Fi.pe.FLOAT,count:1,packPrecisionFactor:1,pack:()=>0},pr={type:Fi.pe.FLOAT,count:1,packPrecisionFactor:1,packTessellation:({lineLength:t})=>t},fr={type:Fi.pe.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},mr={type:Fi.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},gr={type:Fi.pe.FLOAT,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[t,e]},yr={type:Fi.pe.UNSIGNED_BYTE,count:3,pack:"id"},xr={type:Fi.pe.UNSIGNED_BYTE,count:1,pack:function(t){const{sprite:e,isMapAligned:s,colorLocked:i,scaleSymbolsProportionally:r,isStroke:n}=t;let o=0;return s&&(o|=zs(Ws)),i&&(o|=zs(js)),e.sdf&&(o|=zs(qs)),r&&(o|=zs(Us)),n&&(o|=zs(Vs)),o}},br={type:Fi.pe.SHORT,count:2,pack:"position",packPrecisionFactor:1},wr={marker:{type:Fi.pe.FLOAT,count:2,packAlternating:{count:4,pack:({texelDimensions:t})=>[[-.5*t[0],-.5*t[1]],[.5*t[0],-.5*t[1]],[-.5*t[0],.5*t[1]],[.5*t[0],.5*t[1]]]}},line:{type:Fi.pe.FLOAT,count:2,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e},{baseSize:s})=>[t*s/2,e*s/2]},fill:{type:Fi.pe.FLOAT,count:2,packTessellation:()=>[0,0]}},vr={marker:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:1,packAlternating:{count:4,packTessellation:({texXmax:t,texXmin:e,texYmax:s,texYmin:i})=>[[e,i],[t,i],[e,s],[t,s]]}}},Ir={type:Fi.pe.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+_.hM,n=e.y+_.hM;return[r+1,n+1,r+s-1,n+i-1]}},Sr={type:Fi.pe.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,pack:({animations:t,baseSize:e,referenceSize:s})=>[t.dataColumn,t.dataRow,e,s]},Pr={type:Fi.pe.UNSIGNED_SHORT,count:4,packPrecisionFactor:8,pack:({strokeWidth:t,pixelDimensions:e,baseSize:s,sprite:i,sizeRatio:r})=>{const n=Math.max(s*i.width/i.height,s),o=i.sdfDecodeCoeff*n*r;return[e[0],e[1],t,o]}},Mr={type:Fi.pe.BYTE,count:1,packTessellation:({angle:t})=>t};function Cr(t){let{pixelDimensions:e,texelDimensions:s,baseSize:i,referenceSize:r,strokeWidth:n,sizeRatio:o}=t;if(e||(e=t.sprite.sdf?[0,0]:[t.sprite.width,t.sprite.height]),s||(s=t.sprite.sdf?[0,0]:e),null!=t.patternHeight){const s=t.patternHeight/e[1];e[1]*=s,e[0]*=s}-1===i&&(i=e[1]),i=(0,l.Lz)(i),r=(0,l.Lz)(r),n=(0,l.Lz)(n);const a=(t.sprite.sdfDecodeCoeff??1)*o;return{...t,pixelDimensions:e,texelDimensions:s,baseSize:i,referenceSize:r,strokeWidth:n,sdfDecodeCoeff:a}}class Ar extends Li{get vertexSpec(){return{createComputedParams:Cr,optionalAttributes:{zoomRange:lr,value1Position2Value2:ur,lineLength:pr},attributes:{id:yr,bitset:xr,pos:br,offset:wr.marker,uv:vr.marker,animationPointerAndBaseSizeAndReferenceSize:Sr,sizing:Pr,angle:Mr}}}_write(t,e){const s=this.evaluatedMeshParams.sprite,{textureBinding:i}=s;t.recordStart(this.instanceId,this.attributeLayout,i);const r=e.getDisplayId();if(this.shift&&"esriGeometryPolyline"===e.geometryType)this._writeParticles(t,e);else if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(t,e);else if("esriGeometryPolygon"===e.geometryType){const s=e.readCentroidForDisplay();if(!s)return;const[i,n]=s.coords;this._writeQuad(t,r,i,n)}else if("esriGeometryPoint"===e.geometryType){const s=e.readXForDisplay(),i=e.readYForDisplay();this._writeQuad(t,r,s,i)}else{const s=e.readGeometryForDisplay();s&&s.forEachVertex((e,s)=>{this._writeQuad(t,r,e,s)})}t.recordEnd()}_writePlacedMarkers(t,e){const s=Pt.fromFeatureSetReaderCIM(e)?.clone();if(!s)return;const i=Fs.getPlacement(s,-1,this.evaluatedMeshParams.placement,(0,l.Lz)(1),t.id,Pi());if(!i)return;const r=e.getDisplayId();let n=i.next(),o=null;for(;null!=n;){const e=n.tx,s=-n.ty;if(Math.abs(e)>Rt||Math.abs(s)>Rt){n=i.next();continue}const a=-n.getAngle();t.recordBounds(e,s,64,64),this.shift?o&&this._writeQuad(t,r,o[0],o[1],void 0,a):this._writeQuad(t,r,e,s,void 0,a),o=[e,s],n=i.next()}}_writeParticles(t,e){const s=e.getDisplayId(),i=e.readGeometryForDisplay();if(!i)return;const r=[];i.forEachVertex((t,e)=>{r.push([t,e])});const n=function(t){const e=[];let s=0;for(let i=1;i<t.length;i++){const r=t[i-1],n=t[i],o=n[0]-r[0],a=n[1]-r[1],h=Math.sqrt(o*o+a*a),c=o/h,l=a/h;e.push({a:{position:r,distance:s,direction:[c,l]},b:{position:n,distance:s+h,direction:[c,l]}}),s+=h}return e}(r);let o=0;for(let t=1;t<r.length;t++){const e=r[t][0]-r[t-1][0],s=r[t][1]-r[t-1][1],i=Math.sqrt(e*e+s*s);o+=i}const a=e=>{for(const i of n){const{a:r,b:n}=i;this._writeQuad(t,s,r.position[0],r.position[1],[r.distance-e,n.position[0],n.position[1],n.distance-e],this.evaluatedMeshParams.angleToLine?Math.atan2(r.direction[1],r.direction[0]):0,o,!0)}},{placement:h}=this.evaluatedMeshParams;if(!h||"placementTemplate"in h||"CIMMarkerPlacementOnVertices"===h.type){let t;if(h&&"CIMMarkerPlacementOnVertices"!==h.type)t=h.placementTemplate;else{t=[0];for(const e of n){const{a:s,b:i}=e,r=s.position[0]-i.position[0],n=s.position[1]-i.position[1],o=Math.sqrt(r*r+n*n);t.push(o)}}let e=-1*o;for(;e<2*o;)for(const s of t)e+=s,a(e)}else"CIMMarkerPlacementAtExtremities"===h.type?"JustBegin"===h.extremityPlacement?a(1):"JustEnd"===h.extremityPlacement?(a(o-1),a(-1)):"Both"===h.extremityPlacement&&(a(1),a(o-1)):"CIMMarkerPlacementOnLine"===h.type&&a(o/2)}_writeQuad(t,e,s,i,r,n=0,o=0,a=!1){const h=this.evaluatedMeshParams.sprite,{rect:c}=h,l=c.x+_.hM,u=c.y+_.hM,d=c.x+c.width-_.hM,p=c.y+c.height-_.hM,f=t.vertexCount();a||t.recordBounds(s,i,64,64);const m={texXmin:l,texYmin:u,texXmax:d,texYmax:p,value1Position2Value2:r,angle:n/.024543692606171875,lineLength:o};for(let r=0;r<4;r++)this._writeVertex(t,e,s,i,m);t.indexEnsureSize(6),t.indexWrite(f),t.indexWrite(f+1),t.indexWrite(f+2),t.indexWrite(f+1),t.indexWrite(f+3),t.indexWrite(f+2)}}class Tr extends Ar{constructor(){super(...arguments),this.shift=!1}}class kr extends Ar{constructor(){super(...arguments),this.shift=!0}}var Fr=s(83773),Er=(s(83349),s(15585));function Rr(t,e,s,i,r,n,o){rn=0;const a=(i-s)*n,h=r&&r.length,c=h?(r[0]-s)*n:a;let l,u,d,_,p,f=zr(e,s,0,0,c,n,!0);if(f&&f.next!==f.prev){if(h&&(f=function(t,e,s,i,r,n){const o=new Array;for(let r=0,a=i.length;r<a;r++){const h=zr(t,e,0,i[r]*n,r<a-1?i[r+1]*n:s*n,n,!1);h===h.next&&(h.steiner=!0),o.push(qr(h))}o.sort($r);for(const t of o)r=Wr(t,r);return r}(e,s,i,r,f,n)),a>80*n){l=d=e[0+s*n],u=_=e[1+s*n];for(let t=n;t<c;t+=n){const i=e[t+s*n],r=e[t+1+s*n];l=Math.min(l,i),u=Math.min(u,r),d=Math.max(d,i),_=Math.max(_,r)}p=Math.max(d-l,_-u),p=0!==p?1/p:0}Lr(f,t,n,l,u,p,o,0)}}function zr(t,e,s,i,r,n,o){let a;if(o===function(t,e,s,i,r,n){let o=0;for(let s=i,a=r-n;s<r;s+=n)o+=(t[a+e*n]-t[s+e*n])*(t[s+1+e*n]+t[a+1+e*n]),a=s;return o}(t,e,0,i,r,n)>0)for(let s=i;s<r;s+=n)a=Nr(s+e*n,t[s+e*n],t[s+1+e*n],a);else for(let s=r-n;s>=i;s-=n)a=Nr(s+e*n,t[s+e*n],t[s+1+e*n],a);return a&&Zr(a,a.next)&&(Br(a),a=a.next),a}function Or(t,e=t){if(!t)return t;let s,i=t;do{if(s=!1,i.steiner||!Zr(i,i.next)&&0!==Yr(i.prev,i,i.next))i=i.next;else{if(Br(i),i=e=i.prev,i===i.next)break;s=!0}}while(s||i!==e);return e}function Lr(t,e,s,i,r,n,o,a){if(!t)return;!a&&n&&(t=Ur(t,i,r,n));let h=t;for(;t.prev!==t.next;){const c=t.prev,l=t.next;if(n?Gr(t,i,r,n):Dr(t))e.push(c.index/s+o),e.push(t.index/s+o),e.push(l.index/s+o),Br(t),t=l.next,h=l.next;else if((t=l)===h){a?1===a?Lr(t=Qr(t,e,s,o),e,s,i,r,n,o,2):2===a&&Jr(t,e,s,i,r,n,o):Lr(Or(t),e,s,i,r,n,o,1);break}}}function Dr(t){const e=t.prev,s=t,i=t.next;if(Yr(e,s,i)>=0)return!1;let r=t.next.next;const n=r;let o=0;for(;r!==t.prev&&(0===o||r!==n);){if(o++,Vr(e.x,e.y,s.x,s.y,i.x,i.y,r.x,r.y)&&Yr(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Gr(t,e,s,i){const r=t.prev,n=t,o=t.next;if(Yr(r,n,o)>=0)return!1;const a=r.x<n.x?r.x<o.x?r.x:o.x:n.x<o.x?n.x:o.x,h=r.y<n.y?r.y<o.y?r.y:o.y:n.y<o.y?n.y:o.y,c=r.x>n.x?r.x>o.x?r.x:o.x:n.x>o.x?n.x:o.x,l=r.y>n.y?r.y>o.y?r.y:o.y:n.y>o.y?n.y:o.y,u=Hr(a,h,e,s,i),d=Hr(c,l,e,s,i);let _=t.prevZ,p=t.nextZ;for(;_&&_.z>=u&&p&&p.z<=d;){if(_!==t.prev&&_!==t.next&&Vr(r.x,r.y,n.x,n.y,o.x,o.y,_.x,_.y)&&Yr(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,p!==t.prev&&p!==t.next&&Vr(r.x,r.y,n.x,n.y,o.x,o.y,p.x,p.y)&&Yr(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;_&&_.z>=u;){if(_!==t.prev&&_!==t.next&&Vr(r.x,r.y,n.x,n.y,o.x,o.y,_.x,_.y)&&Yr(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&Vr(r.x,r.y,n.x,n.y,o.x,o.y,p.x,p.y)&&Yr(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Nr(t,e,s,i){const r=en.create(t,e,s);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Br(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function qr(t){let e=t,s=t;do{(e.x<s.x||e.x===s.x&&e.y<s.y)&&(s=e),e=e.next}while(e!==t);return s}function Wr(t,e){const s=function(t,e){let s=e;const i=t.x,r=t.y;let n,o=-1/0;do{if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){const t=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=i&&t>o){if(o=t,t===i){if(r===s.y)return s;if(r===s.next.y)return s.next}n=s.x<s.next.x?s:s.next}}s=s.next}while(s!==e);if(!n)return null;if(i===o)return n.prev;const a=n,h=n.x,c=n.y;let l,u=1/0;for(s=n.next;s!==a;)i>=s.x&&s.x>=h&&i!==s.x&&Vr(r<c?i:o,r,h,c,r<c?o:i,r,s.x,s.y)&&(l=Math.abs(r-s.y)/(i-s.x),(l<u||l===u&&s.x>n.x)&&Xr(s,t)&&(n=s,u=l)),s=s.next;return n}(t,e);if(!s)return e;const i=tn(s,t);return Or(i,i.next),Or(s,s.next)}function Ur(t,e,s,i){let r;for(;r!==t;r=r.next){if(r=r||t,null===r.z&&(r.z=Hr(r.x,r.y,e,s,i)),r.prev.next!==r||r.next.prev!==r)return r.prev.next=r,r.next.prev=r,Ur(t,e,s,i);r.prevZ=r.prev,r.nextZ=r.next}return t.prevZ.nextZ=null,t.prevZ=null,function(t){let e,s=1;for(;;){let i,r=t;t=null,e=null;let n=0;for(;r;){n++,i=r;let o=0;for(;o<s&&i;o++)i=i.nextZ;let a=s;for(;o>0||a>0&&i;){let s;0===o?(s=i,i=i.nextZ,a--):0!==a&&i?r.z<=i.z?(s=r,r=r.nextZ,o--):(s=i,i=i.nextZ,a--):(s=r,r=r.nextZ,o--),e?e.nextZ=s:t=s,s.prevZ=e,e=s}r=i}if(e.nextZ=null,s*=2,n<2)return t}}(t)}function Yr(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function jr(t,e,s,i){return!!(Zr(t,e)&&Zr(s,i)||Zr(t,i)&&Zr(s,e))||Yr(t,e,s)>0!=Yr(t,e,i)>0&&Yr(s,i,t)>0!=Yr(s,i,e)>0}function Vr(t,e,s,i,r,n,o,a){return(r-o)*(e-a)-(t-o)*(n-a)>=0&&(t-o)*(i-a)-(s-o)*(e-a)>=0&&(s-o)*(n-a)-(r-o)*(i-a)>=0}function Xr(t,e){return Yr(t.prev,t,t.next)<0?Yr(t,e,t.next)>=0&&Yr(t,t.prev,e)>=0:Yr(t,e,t.prev)<0||Yr(t,t.next,e)<0}function Hr(t,e,s,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Zr(t,e){return t.x===e.x&&t.y===e.y}function $r(t,e){return t.x-e.x}function Qr(t,e,s,i){let r=t;do{const n=r.prev,o=r.next.next;!Zr(n,o)&&jr(n,r,r.next,o)&&Xr(n,o)&&Xr(o,n)&&(e.push(n.index/s+i),e.push(r.index/s+i),e.push(o.index/s+i),Br(r),Br(r.next),r=t=o),r=r.next}while(r!==t);return r}function Jr(t,e,s,i,r,n,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.index!==t.index&&Kr(a,t)){let h=tn(a,t);return a=Or(a,a.next),h=Or(h,h.next),Lr(a,e,s,i,r,n,o,0),void Lr(h,e,s,i,r,n,o,0)}t=t.next}a=a.next}while(a!==t)}function Kr(t,e){return t.next.index!==e.index&&t.prev.index!==e.index&&!function(t,e){let s=t;do{if(s.index!==t.index&&s.next.index!==t.index&&s.index!==e.index&&s.next.index!==e.index&&jr(s,s.next,t,e))return!0;s=s.next}while(s!==t);return!1}(t,e)&&Xr(t,e)&&Xr(e,t)&&function(t,e){let s=t,i=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{s.y>n!=s.next.y>n&&s.next.y!==s.y&&r<(s.next.x-s.x)*(n-s.y)/(s.next.y-s.y)+s.x&&(i=!i),s=s.next}while(s!==t);return i}(t,e)}function tn(t,e){const s=en.create(t.index,t.x,t.y),i=en.create(e.index,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,s.next=r,r.prev=s,i.next=s,s.prev=i,n.next=i,i.prev=n,i}class en{constructor(){this.index=0,this.x=0,this.y=0,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}static create(t,e,s){const i=rn<sn.length?sn[rn++]:new en;return i.index=t,i.x=e,i.y=s,i.prev=null,i.next=null,i.z=null,i.prevZ=null,i.nextZ=null,i.steiner=!1,i}}const sn=[];let rn=0;for(let t=0;t<8096;t++)sn.push(new en);const nn=new Yt.O3(0,0,0,1,0),on=new Yt.O3(0,0,0,1,0);function an(t,e,s){let i=0;for(let r=1;r<s;r++){const s=t[2*(e+r-1)],n=t[2*(e+r-1)+1];i+=(t[2*(e+r)]-s)*(t[2*(e+r)+1]+n)}return i}function hn(t,e,s,i,r){let n=0;for(let o=s;o<i;o+=3){const s=2*(t[o]-r),i=2*(t[o+1]-r),a=2*(t[o+2]-r);n+=Math.abs((e[s]-e[a])*(e[i+1]-e[s+1])-(e[s]-e[i])*(e[a+1]-e[s+1]))}return n}function cn(t,e){const{coords:s,lengths:i}=e,r=t;let n=0;for(let t=0;t<i.length;){let e=t,o=i[t],a=an(s,n,o);const h=[];for(;++e<i.length;){const t=i[e],r=an(s,n+o,t);if(!(r>0))break;a+=r,h.push(n+o),o+=t}const c=r.length;Rr(r,s,n,n+o,h,2,0);const l=hn(r,s,c,r.length,0),u=Math.abs(a);if(Math.abs((l-u)/Math.max(1e-7,u))>1e-5)return r.length=0,!1;t=e,n+=o}return!0}function ln(t,e){if(null==t)return null;if(!function(t,e,s){let i=0;for(let e=0;e<t.lengths.length;e++){const r=t.lengths[e];for(let e=0;e<r;e++){const r=t.coords[2*(e+i)],n=t.coords[2*(e+i)+1];if(r<-128||r>s||n<-128||n>s)return!0}i+=r}return!1}(t,0,_.CQ+128))return t;nn.setPixelMargin(e),nn.reset(3);let s=0;for(let e=0;e<t.lengths.length;e++){const i=t.lengths[e];let r=t.coords[2*(0+s)],n=t.coords[2*(0+s)+1];nn.moveTo(r,n);for(let e=1;e<i;e++)r=t.coords[2*(e+s)],n=t.coords[2*(e+s)+1],nn.lineTo(r,n);nn.close(),s+=i}const i=nn.result(!1);if(!i)return null;const r=[],n=[];for(const t of i){let e=0;for(const s of t)n.push(s.x),n.push(s.y),e++;r.push(e)}return new St.A(r,n)}function un(t,e){on.setPixelMargin(e);const s=on,i=-e,r=_.CQ+e;let n=[],o=!1;if(!t.nextPath())return null;let a=t.pathLength(),h=!0;for(;h;){t.seekPathStart();const e=[];if(!t.pathSize)return null;s.reset(2),t.nextPoint();let c=t.x,l=t.y;if(o)s.moveTo(c,l);else{if(c<i||c>r||l<i||l>r){o=!0;continue}e.push({x:c,y:l})}let u=!1;for(;t.nextPoint();)if(c=t.x,l=t.y,o)s.lineTo(c,l);else{if(c<i||c>r||l<i||l>r){u=!0;break}e.push({x:c,y:l})}if(u)o=!0;else{if(o){const t=s.resultWithStarts();if(t)for(const e of t)n.push({...e,pathLength:a})}else n.push({line:e,start:0,pathLength:a});h=t.nextPath(),a=h?t.pathLength():0,o=!1}}return n=n.filter(t=>t.line.length>1),0===n.length?null:n}nn.setExtent(_.CQ),on.setExtent(_.CQ);class dn{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0,this.pathLength=0,this.distanceOffset=0,this.lineLength=0}}const _n={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:_.fq,pack:({scaleInfo:t},{tileInfo:e})=>Rs(t,e)}},attributes:{id:{type:Fi.pe.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:Fi.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1},color:{type:Fi.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>Ls(t)},offset:{type:Fi.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[Bs(t,16),Bs(e,16)]},normal:{type:Fi.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[Bs(t,16),Bs(e,16)]},halfWidth:{type:Fi.pe.HALF_FLOAT,count:1,pack:({width:t})=>(0,l.Lz)(.5*t)},referenceHalfWidth:{type:Fi.pe.HALF_FLOAT,count:1,pack:({referenceWidth:t})=>(0,l.Lz)(.5*t)}}};class pn{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0,this.distanceOffset=0}}const fn=65535;class mn extends Oi{constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=_n,this._currentWrite=new pn,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:fn,textured:!1},this._tessParams=new dn,this._initializeTessellator()}writeLineVertices(t,e,s){const i=this._getLines(e);null!=i&&this._writeVertices(t,s,i)}_initializeTessellator(){this._lineTessellator=new Fr.i(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(t,e,s){const i=s??Pt.fromFeatureSetReaderCIM(e);i&&this._writeGeometry(t,e,i)}_writeGeometry(t,e,s,i){t.recordStart(this.instanceId,this.attributeLayout,i),this.writeLineVertices(t,s,e),t.recordEnd()}_getLines(t){return un(t,ki(this.evaluatedMeshParams))}_writeVertices(t,e,s){const{_currentWrite:i,_tessellationOptions:r,evaluatedMeshParams:n}=this,{width:o,capType:a,joinType:h,miterLimit:c,hasSizeVV:u}=n,d=(0,l.Lz)(.5*o);r.halfWidth=d,r.capType=Ds(a),r.joinType=Gs(h),r.miterLimit=c;const p=!u;i.out=t,i.id=e.getDisplayId(),i.vertexCount=0,i.indexCount=0,i.vertexFrom=t.vertexCount(),i.vertexBounds=p&&d<_.Gh?0:1;for(const{line:t,start:e,pathLength:n}of s)r.initialDistance=e%fn,i.pathLength=n,i.distanceOffset=Math.floor(e/fn)*fn,this._lineTessellator.tessellate(t,r,p)}_writeTesselatedVertex(t,e,s,i,r,n,o,a,h,c,l){const{out:u,id:d,vertexBounds:_,pathLength:p,distanceOffset:f}=this._currentWrite;return this.hasEffects&&u.recordBounds(t,e,_,_),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=c,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=l,this._tessParams.pathLength=p,this._tessParams.distanceOffset=f,this._writeVertex(u,d,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}class gn extends Li{_write(t,e,s){const i=s??Pt.fromFeatureSetReaderCIM(e);if(!i)return;const r=this.evaluatedMeshParams.sprite,{textureBinding:n}=r;t.recordStart(this.instanceId,this.attributeLayout,n);const o=e.getDisplayId();this._writePoly(t,o,i.asOptimized()),t.recordEnd()}}class yn extends gn{constructor(){super(...arguments),this.vertexSpec={createComputedParams:Cr,attributes:{id:yr,bitset:xr,pos:br,offset:wr.fill,tlbr:Ir,animationPointerAndBaseSizeAndReferenceSize:Sr,sizing:Pr},optionalAttributes:{zoomRange:lr,value1Position2Value2:dr,lineLength:_r}}}_writePoly(t,e,s){const i=[];if(!cn(i,s))return;const r=t.vertexCount();s.forEachVertex((s,i)=>{this._writeVertex(t,e,s,i)}),t.indexEnsureSize(i.length);for(const e of i)t.indexWrite(r+e)}}class xn{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0}}class bn extends gn{constructor(){super(...arguments),this.vertexSpec={createComputedParams:Cr,attributes:{id:yr,bitset:xr,pos:br,offset:wr.line,tlbr:Ir,animationPointerAndBaseSizeAndReferenceSize:Sr,sizing:Pr,accumulatedDistance:fr,normal:gr,segmentDirection:mr},optionalAttributes:{zoomRange:lr,value1Position2Value2:dr,lineLength:pr}},this._tessParams=new dn,this._currentWrite=new xn,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:65535,textured:!1},this._lineLength=0,this._lineTessellator=new Fr.i((t,e,s,i,r,n,o,a,h,c,l)=>this._writeTesselatedVertex(t,e,s,i,r,n,o,a,h,c,l,this._lineLength),this._writeTriangle.bind(this),!1)}_writePoly(t,e,s){const i=un(Pt.fromOptimized(s,"esriGeometryPolyline"),64);if(null==i)return;const{_currentWrite:r,_tessellationOptions:n}=this,{baseSize:o,capType:a,joinType:h,miterLimit:c}=this.evaluatedMeshParams,u=(0,l.Lz)(.5*o);n.halfWidth=u,n.capType=Ds(a||"Round"),n.joinType=Gs(h||"Round"),n.miterLimit=c||2,r.out=t,r.id=e,r.vertexCount=0,r.indexCount=0,r.vertexFrom=t.vertexCount(),r.vertexBounds=1;for(const{line:t,start:e,pathLength:s}of i){n.initialDistance=e%65535,r.pathLength=s,this._lineLength=0;for(let e=1;e<t.length;e++){const s=t[e].x-t[e-1].x,i=t[e].y-t[e-1].y;this._lineLength+=Math.sqrt(s*s+i*i)}this._lineTessellator.tessellate(t,n,!1)}}_writeTesselatedVertex(t,e,s,i,r,n,o,a,h,c,l,u){const{out:d,id:_,vertexBounds:p,pathLength:f}=this._currentWrite;return this.hasEffects&&d.recordBounds(t,e,p,p),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=c,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=l,this._tessParams.pathLength=f,this._tessParams.lineLength=u,this._writeVertex(d,_,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}const wn=(0,n.A)("featurelayer-fast-triangulation-enabled");class vn extends Oi{async loadDependencies(){await Promise.all([super.loadDependencies(),(0,Er.F)()])}_write(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay(),r=this._clip(i);r&&(t.recordStart(this.instanceId,this.attributeLayout),this._writeGeometry(t,e,r),t.recordEnd())}_clip(t){return t?ln(t,this.hasEffects?256:8):null}_writeGeometry(t,e,s){const i=s.maxLength>100,r=[],n=this.createTesselationParams(e);if(!i&&wn&&cn(r,s))return void(r.length&&this._writeVertices(t,e,s.coords,n,r));const o=function(t){const{coords:e,lengths:s}=t,{buffer:i}=(0,Er.l)(e,s);return i}(s);this._writeVertices(t,e,o,n)}_writeVertices(t,e,s,i,r){const n=e.getDisplayId(),o=t.vertexCount(),a=this.hasEffects;let h=0;if(r)for(const e of r){const r=s[2*e],o=s[2*e+1];a&&t.recordBounds(r,o,0,0),this._writeVertex(t,n,r,o,i),h++}else for(let e=0;e<s.length;e+=2){const r=Math.round(s[e]),o=Math.round(s[e+1]);a&&t.recordBounds(r,o,0,0),this._writeVertex(t,n,r,o,i),h++}t.indexEnsureSize(h);for(let e=0;e<h;e++)t.indexWrite(e+o)}}const In={createComputedParams:t=>t,optionalAttributes:{},attributes:{id:{type:Fi.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1},pos:{type:Fi.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},inverseArea:{type:Fi.pe.FLOAT,count:1,packTessellation:({inverseArea:t})=>t}}};class Sn extends vn{constructor(){super(...arguments),this.vertexSpec=In}createTesselationParams(t){return{inverseArea:1/t.readGeometryArea()}}}const Pn={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:_.fq,pack:({scaleInfo:t},{tileInfo:e})=>Rs(t,e)}},attributes:{id:{type:Fi.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1},pos:{type:Fi.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},color:{type:Fi.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>Ls(t)}}};class Mn extends vn{constructor(){super(...arguments),this.vertexSpec=Pn}createTesselationParams(t){return null}}const Cn={createComputedParams:t=>t,optionalAttributes:Pn.optionalAttributes,attributes:{...Pn.attributes,tlbr:{count:4,type:Fi.pe.UNSIGNED_SHORT,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+_.hM,n=e.y+_.hM;return[r,n,r+s,n+i]}},inverseRasterizationScale:{count:1,type:Fi.pe.BYTE,packPrecisionFactor:16,pack:({sprite:t})=>1/t.rasterizationScale}}};class An extends Mn{constructor(){super(...arguments),this.vertexSpec=Cn}_write(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay(),r=this._clip(i);if(!r)return;const n=this.evaluatedMeshParams.sprite?.textureBinding;t.recordStart(this.instanceId,this.attributeLayout,n),this._writeGeometry(t,e,r),t.recordEnd()}}function Tn(t){const{sprite:e,aspectRatio:s,scaleProportionally:i}=t,r=(0,l.Lz)(t.height),n=r>0?r:e.height;let o=r*s;return o<=0?o=e.width:i&&(o*=e.width/e.height),{width:o,height:n}}function kn(t){const{applyRandomOffset:e,sampleAlphaOnly:s}=t;return Os([[2,e],[4,s]])}const Fn={createComputedParams:t=>t,optionalAttributes:Cn.optionalAttributes,attributes:{...Cn.attributes,bitset:{count:1,type:Fi.pe.UNSIGNED_BYTE,pack:kn},width:{count:1,type:Fi.pe.HALF_FLOAT,pack:t=>Tn(t).width},height:{count:1,type:Fi.pe.HALF_FLOAT,pack:t=>Tn(t).height},offset:{count:2,type:Fi.pe.HALF_FLOAT,pack:({offsetX:t,offsetY:e})=>[(0,l.Lz)(t),-(0,l.Lz)(e)]},scale:{count:2,type:Fi.pe.UNSIGNED_BYTE,packPrecisionFactor:16,pack:({scaleX:t,scaleY:e})=>[t,e]},angle:{count:1,type:Fi.pe.UNSIGNED_BYTE,pack:({angle:t})=>(0,xi.wV)(t)}}};class En extends An{constructor(){super(...arguments),this.vertexSpec=Fn}}const Rn={createComputedParams:t=>t,optionalAttributes:_n.optionalAttributes,attributes:{..._n.attributes,bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:t=>0},color:{type:Fi.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>Ls(t)}}},zn={createComputedParams:t=>t,optionalAttributes:_n.optionalAttributes,attributes:{..._n.attributes,bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:t=>Os([[0,!0],[1,t.outlineUsesColorVV]])},color:{type:Fi.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>Ls(t)}}};class On extends mn{constructor(){super(...arguments),this.vertexSpec=zn}}class Ln extends Mn{constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=Rn,this._lineMeshWriter=this._createOutlineWriter(t,e,s,i)}_createOutlineWriter(t,e,s,i){return new On(t,e,s,i)}_write(t,e){const s=this.evaluatedMeshParams.effects,i=this.evaluatedMeshParams.outlineEffects;if(s?.length||i?.length){if(s?.length){const i=this.getEffectCursor(t,e,s);if(i){let s;for(;s=i?.next();)s.invertY(),this._writeFill(t,e,s)}}else this._writeFill(t,e);if(i?.length){const s=this.getEffectCursor(t,e,i);if(s){let i;for(;i=s?.next();)i.invertY(),this._writeOutline(t,e,i)}}else this._writeOutline(t,e)}else this._writeSimpleOutlineFill(t,e)}_writeSimpleOutlineFill(t,e){const s=e.readGeometryForDisplay(),i=this._clip(s);i&&(this._writeGeometry(t,e,i),this._lineMeshWriter.writeLineVertices(t,Pt.fromOptimizedCIM(i,"esriGeometryPolyline"),e))}_writeFill(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay(),r=this._clip(i);r&&this._writeGeometry(t,e,r)}_writeOutline(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay(),r=this._clip(i);r&&this._lineMeshWriter.writeLineVertices(t,Pt.fromOptimizedCIM(r,"esriGeometryPolyline"),e)}_clip(t){return t?ln(t,ki(this.evaluatedMeshParams)):null}get effectInfos(){return[...this._evaluator.inputMeshParams.effects?.effectInfos??[],...this._evaluator.inputMeshParams.outlineEffects?.effectInfos??[]]}write(t,e,s,i,r){this.ensurePacked(e,s,i),t.recordStart(this.instanceId,this.attributeLayout),this._write(t,s),t.recordEnd()}ensurePacked(t,e,s){super.ensurePacked(t,e,s),this._lineMeshWriter.ensurePacked(t,e,s)}enqueueRequest(t,e,s){super.enqueueRequest(t,e,s),this._lineMeshWriter.enqueueRequest(t,e,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}get hasEffects(){return!!this.evaluatedMeshParams.outlineEffects}}const Dn=Fn,Gn=zn,Nn={createComputedParams:t=>t,optionalAttributes:Dn.optionalAttributes,attributes:{...Dn.attributes,bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:t=>kn(t)},aux1:{count:1,type:Fi.pe.HALF_FLOAT,pack:t=>Tn(t).width},aux2:{count:1,type:Fi.pe.HALF_FLOAT,pack:t=>Tn(t).height},aux3:{count:2,type:Fi.pe.HALF_FLOAT,pack:({offsetX:t,offsetY:e})=>[(0,l.Lz)(t),(0,l.Lz)(e)]},aux4:{count:2,type:Fi.pe.UNSIGNED_BYTE,pack:({scaleX:t,scaleY:e})=>[16*t,16*e]}}},Bn={createComputedParams:t=>t,optionalAttributes:Dn.optionalAttributes,attributes:{...Dn.attributes,color:Gn.attributes.color,bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:t=>Os([[0,!0]])},aux1:{count:1,type:Fi.pe.HALF_FLOAT,pack:t=>(0,l.Lz)(.5*t.width)},aux2:{count:1,type:Fi.pe.HALF_FLOAT,pack:t=>(0,l.Lz)(.5*t.referenceWidth)},aux3:{count:2,type:Fi.pe.HALF_FLOAT,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[t,e]},aux4:{count:2,type:Fi.pe.UNSIGNED_BYTE,packTessellation:({normalX:t,normalY:e})=>[16*t+128,16*e+128]}}};class qn extends On{constructor(){super(...arguments),this.vertexSpec=Bn}}class Wn extends Ln{constructor(){super(...arguments),this.vertexSpec=Nn}_createOutlineWriter(t,e,s,i){return new qn(t,e,s,i)}write(t,e,s,i,r){this.ensurePacked(e,s,i);const n=this.evaluatedMeshParams.sprite?.textureBinding;t.recordStart(this.instanceId,this.attributeLayout,n),this._write(t,s),t.recordEnd()}ensurePacked(t,e,s){super.ensurePacked(t,e,s),this._lineMeshWriter.ensurePacked(t,e,s)}enqueueRequest(t,e,s){super.enqueueRequest(t,e,s),this._lineMeshWriter.enqueueRequest(t,e,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}class Un{constructor(t,e){this._size=t,this._sizeUnits=e,this._relativeSize=null}get relativeSize(){return this._relativeSize??=this.calculateRelativeSize(),this._relativeSize}calculateRelativeSize(){if(0===this._sizeUnits){const t=Math.min(this._size/100,1);return[t,t]}return this.calculateRelativeSizeFromAbsolute()}}class Yn extends Un{constructor(t,e,s,i){super(e,s),this.rotationMatrix00=1,this.rotationMatrix01=0,this.rotationMatrix10=0,this.rotationMatrix11=1,this.bounds={xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0},this.rotationMatrix00=Math.cos(i),this.rotationMatrix01=-Math.sin(i),this.rotationMatrix10=-this.rotationMatrix01,this.rotationMatrix11=this.rotationMatrix00;const{bounds:r,rotationMatrix00:n,rotationMatrix01:o,rotationMatrix10:a,rotationMatrix11:h}=this;t.forEachVertex((t,e)=>{const s=t*n+e*o,i=t*a+e*h;r.xmin=Math.min(r.xmin,s),r.ymin=Math.min(r.ymin,i),r.xmax=Math.max(r.xmax,s),r.ymax=Math.max(r.ymax,i)}),this.center=[(r.xmin+r.xmax)/2,(r.ymin+r.ymax)/2]}}class jn extends Yn{constructor(t,e,s,i){super(t,e,s,i),this.method="linear"}getRelativePosition(t,e){const{rotationMatrix00:s,rotationMatrix01:i,bounds:r}=this,{xmin:n,xmax:o}=r;return[(t*s+e*i-n)/(o-n),0]}calculateRelativeSizeFromAbsolute(){const{_size:t,bounds:e}=this,{xmin:s,xmax:i}=e;return[(0,l.Lz)(t)/(i-s),0]}}class Vn extends Yn{constructor(t,e,s,i){super(t,e,s,i),this.method="rectangular"}getRelativePosition(t,e){const{bounds:s,center:i,rotationMatrix00:r,rotationMatrix01:n,rotationMatrix10:o,rotationMatrix11:a}=this,h=t*o+e*a,c=t*r+e*n-i[0],l=h-i[1];return[c*(2/(s.xmax-s.xmin)),-l*(2/(s.ymax-s.ymin))]}calculateRelativeSizeFromAbsolute(){const{_size:t,bounds:e}=this,{xmin:s,ymin:i,xmax:r,ymax:n}=e;return[(0,l.Lz)(2*t)/(r-s),(0,l.Lz)(2*t)/(n-i)]}}class Xn extends Yn{constructor(t,e,s){super(t,e,s,0),this.method="circular";const{xmin:i,xmax:r,ymin:n,ymax:o}=this.bounds,a=r-i,h=o-n;this.radius=Math.sqrt(a*a+h*h)/2}getRelativePosition(t,e){const{center:s,radius:i}=this;return[(t-s[0])/i,-(e-s[1])/i]}calculateRelativeSizeFromAbsolute(){const{_size:t}=this;return[(0,l.Lz)(t)/this.radius,0]}}function Hn(t,e){if(null==t)return null;const s=(0,Xs.kU)(e.angle),i=e.gradientSize,r=e.gradientSizeUnits;switch(e.gradientMethod.toLowerCase()){case"linear":return new jn(t,i,r,s);case"rectangular":return new Vn(t,i,r,s);case"circular":return new Xn(t,i,r);default:return D.A.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.fill.GradientSizeHelper").errorOnce(`Gradient fill method "${e.gradientMethod}" currently unsupported.`),null}}const Zn={createComputedParams:t=>t,optionalAttributes:Pn.optionalAttributes,attributes:{...Pn.attributes,bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:({gradientSizeUnits:t,gradientType:e})=>{let s=0;return 1===t&&(s|=zs(0)),"discrete"===e.toLowerCase()&&(s|=zs(1)),s}},tlbr:{count:4,type:Fi.pe.UNSIGNED_SHORT,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+_.hM+_.MZ,n=e.y+_.hM;return[r,n,r+s-2*_.MZ,n+i]}},relativePosition:{count:2,type:Fi.pe.HALF_FLOAT,packTessellation:({gradientStats:t},e,s,i)=>t?.getRelativePosition(s,i)??[0,0]},relativeGradientSize:{count:2,type:Fi.pe.HALF_FLOAT,packTessellation:({gradientStats:t})=>t?.relativeSize??[1,1]},gradientMethod:{count:1,type:Fi.pe.UNSIGNED_BYTE,pack:({gradientMethod:t})=>{switch(t.toLowerCase()){case"rectangular":return 1;case"circular":return 2;default:return 0}}}}};class $n extends vn{constructor(){super(...arguments),this.vertexSpec=Zn}get _preventEffectClipping(){return!0}createTesselationParams(t){return{gradientStats:Hn(this._unclippedGeometry,this.evaluatedMeshParams)}}_write(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay();this._unclippedGeometry=i;const r=this._clip(i);if(!r)return void(this._unclippedGeometry=null);const n=this.evaluatedMeshParams.sprite?.textureBinding;t.recordStart(this.instanceId,this.attributeLayout,n),this._writeGeometry(t,e,r),this._unclippedGeometry=null,t.recordEnd()}}const Qn={optionalAttributes:Cn.optionalAttributes,createComputedParams:t=>t,attributes:{...Cn.attributes,...Rn.attributes}},Jn={optionalAttributes:Cn.optionalAttributes,createComputedParams:t=>t,attributes:{...Cn.attributes,...zn.attributes}};class Kn extends On{constructor(){super(...arguments),this.vertexSpec=Jn}}class to extends Ln{constructor(){super(...arguments),this.vertexSpec=Qn}_createOutlineWriter(t,e,s,i){return new Kn(t,e,s,i)}write(t,e,s,i,r){this.ensurePacked(e,s,i);const n=this.evaluatedMeshParams.sprite?.textureBinding;t.recordStart(this.instanceId,this.attributeLayout,n),this._write(t,s),t.recordEnd()}ensurePacked(t,e,s){super.ensurePacked(t,e,s),this._lineMeshWriter.ensurePacked(t,e,s)}enqueueRequest(t,e,s){super.enqueueRequest(t,e,s),this._lineMeshWriter.enqueueRequest(t,e,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}const eo={createComputedParams:t=>t,optionalAttributes:{},attributes:{pos:{type:Fi.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:Fi.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1},offset:{type:Fi.pe.BYTE,count:2,packAlternating:{count:4,pack:()=>[[-1,-1],[1,-1],[-1,1],[1,1]]}}}};class so extends Oi{constructor(){super(...arguments),this.vertexSpec=eo}_write(t,e){t.recordStart(this.instanceId,this.attributeLayout);const s=e.getDisplayId();if("esriGeometryPoint"===e.geometryType){const i=e.readXForDisplay(),r=e.readYForDisplay();this._writeQuad(t,s,i,r)}else if("esriGeometryMultipoint"===e.geometryType){const i=e.readGeometryForDisplay();i?.forEachVertex((e,i)=>{e>=0&&e<=512&&i>=0&&i<=512&&this._writeQuad(t,s,e,i)})}t.recordEnd()}_writeQuad(t,e,s,i){const r=t.vertexCount();this._writeVertex(t,e,s,i),t.indexWrite(r+0),t.indexWrite(r+1),t.indexWrite(r+2),t.indexWrite(r+1),t.indexWrite(r+3),t.indexWrite(r+2)}}var io=s(48163),ro=s(90708);class no{constructor(t,e,s,i,r,n,o,a,h,c,l=[],u=0,d=0){this.displayId=t,this.labelClassId=e,this.hash=s,this.anchorX=i,this.anchorY=r,this.directionX=n,this.directionY=o,this.maxScale=a,this.minScale=h,this.referenceBounds=c,this.bounds=l,this.recordStart=u,this.recordCount=d,this.priority=0,this._colliders=null,this.uniqueSymbol=null,this.selectedForRendering=!1}get xTile(){return this.anchorX}get yTile(){return this.anchorY}colliders(t){if(!this._colliders){const e=t.attributeView,s=_.C2;let i=this.referenceBounds?.size??0;const r=t.layerView.labelingCollisionInfos[0].vvEvaluators[0];if(null!=r){const t=r(e.getVisualVariableData(this.displayId,0));i=isNaN(t)||null==t||t===1/0?i:t}const n=this.minScale?t.layerView.view.featuresTilingScheme.scaleToZoom(this.minScale):0,o=this.maxScale?t.layerView.view.featuresTilingScheme.scaleToZoom(this.maxScale):25,a=this.directionX*(s+i/2),h=this.directionY*(s+i/2);this._colliders=this.bounds.map(t=>({xTile:this.anchorX,yTile:this.anchorY,dxPixels:t.x-t.halfWidth+a,dyPixels:t.y-t.halfHeight+h,hard:!0,partIndex:1,width:t.width+2,height:t.height+2,angle:0,xScreen:0,yScreen:0,dxScreen:0,dyScreen:0,enabled:!0,minLod:n,maxLod:o}))}return this._colliders}get id(){return this.displayId}serialize(t){t.push(this.displayId),t.push(this.labelClassId),t.push(this.hash),t.push(this.recordStart),t.push(this.recordCount),t.writeF32(this.anchorX),t.writeF32(this.anchorY),t.writeF32(this.directionX),t.writeF32(this.directionY),t.writeF32(this.maxScale),t.writeF32(this.minScale),this.referenceBounds?(t.writeF32(this.referenceBounds.size),t.writeF32(this.referenceBounds.offsetX),t.writeF32(this.referenceBounds.offsetY)):(t.writeF32(0),t.writeF32(0),t.writeF32(0)),$(t,this.bounds)}static deserialize(t){const e=t.readInt32(),s=t.readInt32(),i=t.readInt32(),r=t.readInt32(),n=t.readInt32(),o=t.readF32(),a=t.readF32(),h=t.readF32(),c=t.readF32(),l=t.readF32(),u=t.readF32(),d=t.readF32(),_=t.readF32(),p=t.readF32(),f=Q(t,hi)??[];return new no(e,s,i,o,a,h,c,l,u,{size:d,offsetX:_,offsetY:p},f,r,n)}}class oo{constructor(t){const{offsetX:e,offsetY:s,postAngle:i,fontSize:r,haloSize:n,outlineSize:o,scaleFactor:a,transforms:h}=t;if(this.offsetX=e,this.offsetY=s,this.postAngle=i,this.fontSize=Math.min(r,96),this.haloSize=n??0,this.outlineSize=o??0,this.transforms=h,h&&h.infos.length>1){const t=(0,ne.zb)(r,i,!1,e,s,h,!1);this.fontSize=Math.min(t.size,96);const n=t.size/r;this.haloSize*=n,this.outlineSize*=n,this.postAngle=t.rotation,this.offsetX=t.offsetX,this.offsetY=t.offsetY}a&&(this.fontSize*=a,this.offsetX*=a,this.offsetY*=a)}}const ao=[4,4],ho=[16,4],co={topLeft:ho,topRight:ho,bottomLeft:ho,bottomRight:ho},lo=[4,2],uo=[4,6],_o={topLeft:lo,topRight:lo,bottomLeft:uo,bottomRight:uo},po={topLeft:lo,topRight:uo,bottomLeft:lo,bottomRight:uo},fo={topLeft:uo,topRight:uo,bottomLeft:ao,bottomRight:ao},mo={topLeft:ao,topRight:ao,bottomLeft:uo,bottomRight:uo},go={topLeft:uo,topRight:ao,bottomLeft:uo,bottomRight:ao},yo={topLeft:ao,topRight:uo,bottomLeft:ao,bottomRight:uo},xo={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:Fi.pe.UNSIGNED_SHORT,count:2,packPrecisionFactor:_.fq,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||28]},clipAngle:{type:Fi.pe.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>wo(t||0)},referenceSymbol:{type:Fi.pe.BYTE,count:4,packPrecisionFactor:1,packTessellation:(t,e)=>{const s=t.isLineLabel||!t.referenceBounds,i=function(t){switch(t){case 1:case"right":return-1;case 0:case"center":return 0;case-1:case"left":return 1;default:return console.debug(`Found invalid horizontal alignment ${t}`),0}}(s?"center":e.horizontalAlignment),r=function(t){switch(t){case 1:case"top":return 1;case 0:case"middle":return 0;case-1:case 2:case"baseline":case"bottom":return-1;default:return console.debug(`Found invalid vertical alignment ${t}`),0}}(s?"middle":e.verticalAlignment),{offsetX:n,offsetY:o,size:a}=s?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[(0,l.Lz)(n),-(0,l.Lz)(o),Math.round((0,l.Lz)(a)),i+1<<2|r+1]}},visibility:{type:Fi.pe.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:Fi.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:Fi.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>Os([[0,t],[3,!!e]])},offset:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:s,topLeft:i,topRight:r}=t;return[i,r,e,s]}}},textureUV:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:s,topLeft:i,topRight:r}=t;return[i,r,e,s]}}},color:{type:Fi.pe.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:Fi.pe.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({fontSize:t},{referenceSize:e})=>[Math.round((0,l.Lz)(t)),Math.round((0,l.Lz)(e??t))]},outlineColor:{type:Fi.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>Ls(t)},haloColor:{type:Fi.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>Ls(t)},outlineAndHaloSize:{type:Fi.pe.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:e})=>[Math.round((0,l.Lz)(t)),Math.round((0,l.Lz)(e))]}}};class bo extends Oi{constructor(){super(...arguments),this.vertexSpec=xo,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,s){super.ensurePacked(t,e,s),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new oo(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,s){const i=this._getShaping();if(!i)return;const r=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,i,s);if(s?.nextPath())return s.nextPoint(),this._writeGlyphs(t,r,s.x,s.y,i,0);if("esriGeometryPolygon"===e.geometryType){const s=e.readCentroidForDisplay();if(!s)return;const[n,o]=s.coords;return this._writeGlyphs(t,r,n,o,i,0)}if("esriGeometryMultipoint"===e.geometryType){const s=e.readGeometryForDisplay();return void s?.forEachVertex((e,s)=>this._writeGlyphs(t,r,e,s,i,0))}const n=e.readXForDisplay(),o=e.readYForDisplay();return this._writeGlyphs(t,r,n,o,i,0)}_writePlacedTextMarkers(t,e,s,i){const r=i??Pt.fromFeatureSetReaderCIM(e);if(!r)return;const n=Fs.getPlacement(r,-1,this.evaluatedMeshParams.placement,(0,l.Lz)(1),t.id,Pi());if(!n)return;const o=e.getDisplayId();let a=n.next();for(;null!=a;){const e=a.tx,i=-a.ty,r=-a.getAngle();this._writeGlyphs(t,o,e,i,s,r),a=n.next()}}_getShaping(t){const e=this._textMeshTransformProps,s=this.evaluatedMeshParams;if(!s.glyphs?.glyphs.length)return null;const i=(0,l.Lz)(e.fontSize),r=(0,l.Lz)(e.offsetX),n=(0,l.Lz)(e.offsetY),o=(0,Xs.qE)((0,l.Lz)(s.lineWidth),_.GR,_.cp),a=_.DY*(0,Xs.qE)(s.lineHeightRatio,.25,4);return gi(s.glyphs,{scale:i/_.eG,angle:e.postAngle,xOffset:r,yOffset:n,horizontalAlignment:s.horizontalAlignment,verticalAlignment:t||s.verticalAlignment,maxLineWidth:o,lineHeight:a,decoration:s.decoration,borderLineSizePx:(0,l.Lz)(s.boxBorderLineSize),hasBackground:!!s.boxBackgroundColor,useCIMAngleBehavior:s.useCIMAngleBehavior})}_writeGlyphs(t,e,s,i,r,n,o,a,h=!0){const c=this.evaluatedMeshParams,u=this._textMeshTransformProps,d=(0,l.Lz)(u.fontSize),_=u.haloSize,p=u.outlineSize,f=(0,l.Lz)(u.offsetX),m=(0,l.Lz)(u.offsetY),[g,y]=Rs(c.scaleInfo,this.getTileInfo());0!==n&&r.setRotation(n);const x=r.bounds,b=s+x.x+f,w=i+x.y-m,v=2*(c.minPixelBuffer?c.minPixelBuffer/d:1),I=Math.max(x.width,x.height)*v;r.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),h&&t.recordBounds(b,w,I,I),this._writeTextBox(t,e,s,i,r.textBox,o,a),t.recordEnd());for(const n of r.glyphs){t.recordStart(this.instanceId,this.attributeLayout,n.textureBinding),h&&t.recordBounds(b,w,I,I);const{texcoords:r,offsets:l}=n;this._writeQuad(t,e,s,i,{texcoords:r,offsets:l,fontSize:d,haloSize:_,outlineSize:p,color:Ls(c.color),isBackground:!1,referenceBounds:o,minZoom:g,maxZoom:y,...a}),t.recordEnd()}0!==n&&r.setRotation(-n)}_writeTextBox(t,e,s,i,r,n,o){const a=this.evaluatedMeshParams,{fontSize:h,haloSize:c,outlineSize:l}=this._textMeshTransformProps,{boxBackgroundColor:u,boxBorderLineColor:d}=a,_={isBackground:!0,fontSize:h,haloSize:c,outlineSize:l,referenceBounds:n,...o};u&&(this._writeQuad(t,e,s,i,{texcoords:co,offsets:r.main,color:Ls(u),..._}),d||(this._writeQuad(t,e,s,i,{texcoords:fo,offsets:r.top,color:Ls(u),..._}),this._writeQuad(t,e,s,i,{texcoords:mo,offsets:r.bot,color:Ls(u),..._}),this._writeQuad(t,e,s,i,{texcoords:go,offsets:r.left,color:Ls(u),..._}),this._writeQuad(t,e,s,i,{texcoords:yo,offsets:r.right,color:Ls(u),..._}))),d&&(this._writeQuad(t,e,s,i,{texcoords:_o,offsets:r.top,color:Ls(d),..._}),this._writeQuad(t,e,s,i,{texcoords:_o,offsets:r.bot,color:Ls(d),..._}),this._writeQuad(t,e,s,i,{texcoords:po,offsets:r.left,color:Ls(d),..._}),this._writeQuad(t,e,s,i,{texcoords:po,offsets:r.right,color:Ls(d),..._}))}_writeQuad(t,e,s,i,r){const n=t.vertexCount();this._writeVertex(t,e,s,i,r),t.indexWrite(n+0),t.indexWrite(n+1),t.indexWrite(n+2),t.indexWrite(n+1),t.indexWrite(n+3),t.indexWrite(n+2)}}const wo=t=>Math.round(t*(254/360)),vo=(0,z.Bj)(t=>{let e=0;if(0===t)return 1/0;for(;!(t%2);)e++,t/=2;return e});class Io extends bo{constructor(){super(...arguments),this._zoomLevel=0}_write(t,e,s,i){if(this._zoomLevel=i||0,null!=s)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(e.geometryType){case"esriGeometryPoint":{const s=e.readXForDisplay(),i=e.readYForDisplay();this._writePoint(t,s,i,0,e);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":{const s=e.readCentroidForDisplay();if(!s)return;const[i,r]=s.coords;this._writePoint(t,i,r,0,e);break}case"esriGeometryMultipoint":{let s=0;const i=Pt.fromFeatureSetReader(e);if(i?.nextPath())for(;i.nextPoint();)this._writePoint(t,i.x,i.y,s++,e);break}case"esriGeometryPolyline":this._writeLines(t,e)}}_getMetricDir(){const{horizontalAlignment:t,verticalAlignment:e}=this.evaluatedMeshParams;return["center"===t?0:"right"===t?-1:1,"middle"===e?0:"bottom"===e?-1:1]}_createLineLabelMetric(t,e,s,i,r){const[n,o]=this._getMetricDir(),a=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0,c=this.evaluatedMeshParams.labelClassId;return new no(t,c,e,s,i,n,o,a,h,r)}_writePoint(t,e,s,i,r){if(e<0||e>_.CQ||s<0||s>_.CQ)return;const n=this._getShaping();if(!n)return;const o=r.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,h=function(t,e,s){return(0,yt.Wm)(`${t}${e}${s}`)}(r.getObjectId(),a,i),[c,l]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,p=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};t.metricStart(new no(o,a,h,e,s,c,l,u,d,p)),this._writeGlyphs(t,o,e,s,n,0,p,void 0,!1),t.metricBoxWrite(n.boundsT),t.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const t of this._references){const e=t.getBoundsInfo();if(e)return e}return null}_writeLines(t,e){const{scaleInfo:s,verticalAlignment:i}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,n=this._getShaping("middle");if(!n)return;const o=(t,e,s,i)=>this._placeSubdivGlyphs(t,e,s,i),a=(n.bounds.width+r)/2;this._current={out:t,id:e.getDisplayId(),objId:e.getObjectId(),shaping:n,zoomRange:Rs(s,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===i?"above":"top"===i?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(e,o,a):this._writeCenterAlong(e,o,a)}_writeAboveAndBelowAlong(t,e,s){const{repeatLabel:i}=this.evaluatedMeshParams,{shaping:r}=this._current,n=r.bounds.halfHeight,o=t.readGeometryForDisplay();if(!o)return;const a=new St.A;(0,ro.kz)(a,o,!1,!1,"esriGeometryPolyline",1);const h=So(new St.A,a,n),c=So(new St.A,a,-n),l=(0,ro.zv)(c,"esriGeometryPolyline",!1,!1),u=Ue((0,ro.zv)(h,"esriGeometryPolyline",!1,!1).paths,r.bounds.width),d=Ue(l.paths,r.bounds.width);this._current.offsetDirection="above";for(let t=0;t<u.length;t++)this._current.pathIndex=t,We(u[t],s,e,!!i);this._current.offsetDirection="below";for(let t=0;t<d.length;t++)this._current.pathIndex=t,We(d[t],s,e,!!i)}_writeCenterAlong(t,e,s){const{repeatLabel:i}=this.evaluatedMeshParams,{shaping:r}=this._current,n=Ue(t.readLegacyGeometryForDisplay().paths,r.bounds.width);for(let t=0;t<n.length;t++)this._current.pathIndex=t,We(n[t],s,e,!!i)}_placeSubdivGlyphs(t,e,s,i){const{allowOverrun:r,labelPosition:n,repeatLabelDistance:o}=this.evaluatedMeshParams,a=this._current.zoomRange[0],h=vo(e),c=this._current.shaping.bounds.width/2,l=Math.sqrt(o||128)/2,u=Math.min(s,i-s),d=this._current.shaping.isMultiline?28:Math.log2(u/(l+c/2)),_=0===e?d:Math.min(h,d),p=Math.max(a,this._zoomLevel+1-_),f=this._zoomLevel-p,m=this._current.shaping.bounds.width/2*2**f,g=function(t,e,s,i,r){return(0,yt.Wm)(`${t}${r}${e}${s*2**(28-i)}`)}(this._current.objId,this._current.pathIndex,e,this._zoomLevel,this.evaluatedMeshParams.labelClassId);this._current.shaping.isMultiline?0===e&&this._placeStraight(t,p,g):r&&f<0?this._placeStraightAlong(t,a,g):"parallel"===n?this._placeStraightAlong(t,p,g):"curved"===n&&this._placeCurved(t,p,m,g)}_placeStraight(t,e,s){const{out:i,id:r,shaping:n,referenceBounds:o}=this._current,{x:a,y:h}=t;i.metricStart(this._createLineLabelMetric(r,s,a,h)),i.metricBoxWrite(n.boundsT);const c=t.angle*(180/Math.PI)%360,l=(t.angle*(180/Math.PI)+180)%360,u={clipAngle:c,mapAligned:!0,isLineLabel:!0,minZoom:e};this._writeGlyphs(i,r,a,h,n,0,o,u,!1);const d={clipAngle:l,mapAligned:!0,isLineLabel:!0,minZoom:e};this._writeGlyphs(i,r,a,h,n,0,o,d,!1),i.metricEnd()}_placeCurved(t,e,s,i){const{out:r,id:n}=this._current;r.metricStart(this._createLineLabelMetric(n,i,t.x,t.y));const o=t.clone(),a=t.angle*(180/Math.PI)%360,h=(t.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(o,e,1,a),this._placeBack(t,o,e,s,1,a),this._placeForward(t,o,e,s,1,a)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(o,e,0,h),this._placeBack(t,o,e,s,0,h),this._placeForward(t,o,e,s,0,h)),r.metricEnd()}_placeStraightAlong(t,e,s){const{out:i,id:r,shaping:n,zoomRange:o,referenceBounds:a}=this._current,{boxBorderLineColor:h,boxBackgroundColor:c}=this.evaluatedMeshParams,u=t.clone(),d=t.angle*(180/Math.PI)%360,_=(t.angle*(180/Math.PI)+180)%360,p=n.glyphs.length>0&&!(!h&&!c);if(i.metricStart(this._createLineLabelMetric(r,s,t.x,t.y)),p){const s=Math.max(e,o[0],0),h=Math.min(28,o[1]),c=Ks(ii(),-t.angle),u={minZoom:s,maxZoom:h,clipAngle:d,mapAligned:!0,isLineLabel:!0},p=(0,l.Lz)(this.evaluatedMeshParams.offsetX),f=(0,l.Lz)(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e=(0,oi.fA)(p,-1*f),[s,o]=n.shapeBackground(Js(ii(),c,e));i.recordStart(this.instanceId,this.attributeLayout,n.glyphs[0].textureBinding),this._writeTextBox(i,r,t.x,t.y,o,a,u),i.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e=(0,oi.fA)(p,f),[s,o]=n.shapeBackground(Js(ii(),c,e));u.clipAngle=_,i.recordStart(this.instanceId,this.attributeLayout,n.glyphs[0].textureBinding),this._writeTextBox(i,r,t.x,t.y,o,a,u),i.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(u,e,1,d,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(u,e,0,_,!0),i.metricEnd()}_placeBack(t,e,s,i,r,n){const o=t.clone();let a=t.backwardLength+0;for(;o.prev()&&!(a>=i);)this._placeOnSegment(o,e,a,s,-1,r,n),a+=o.length+0}_placeForward(t,e,s,i,r,n){const o=t.clone();let a=t.remainingLength+0;for(;o.next()&&!(a>=i);)this._placeOnSegment(o,e,a,s,1,r,n),a+=o.length+0}_placeFirst(t,e,s,i,r=!1){const{out:n,id:o,shaping:a,zoomRange:h,referenceBounds:c}=this._current,u=a.glyphs,d=(0,l.Lz)(this.evaluatedMeshParams.offsetX),_=(0,l.Lz)(this.evaluatedMeshParams.offsetY),p=(0,oi.fA)(d,_),f=Ks(ii(),-t.angle);(0,N.l0)(p,p,f);for(const l of u){const u=l.x>a.bounds.x?s:1-s,d=u*t.remainingLength+(1-u)*t.backwardLength,_=Math.abs(l.x+l.width/2-a.bounds.x),f=Math.max(0,this._zoomLevel+Math.log2(_/(d+0))),m=Math.max(e,r?0:f);if(l.maxZoom=Math.min(h[1],28),l.angle=t.angle+(1-s)*Math.PI,l.minZoom=Math.max(h[0],m),this._writeLineGlyph(n,o,t.x,t.y,l,i,c,!0),(s||this._current.offsetDirection)&&this._isVisible(l.minZoom,l.maxZoom)){const t=new hi(l.bounds.x+p[0],l.bounds.y+p[1],l.bounds.width,l.bounds.height);n.metricBoxWrite(t)}}}_placeOnSegment(t,e,s,i,r,n,o){const{out:a,id:h,shaping:c,referenceBounds:u}=this._current,d=c.glyphs,_=t.dx/t.length,p=t.dy/t.length,f={x:t.x+s*-r*_,y:t.y+s*-r*p},m=(0,l.Lz)(this.evaluatedMeshParams.offsetX),g=(0,l.Lz)(this.evaluatedMeshParams.offsetY),y=(0,oi.fA)(m,g),x=Ks(ii(),-t.angle);(0,N.l0)(y,y,x);for(const e of d){const l=e.x>c.bounds.x?n:1-n;if(!(l&&1===r||!l&&-1===r))continue;const d=Math.abs(e.x+e.width/2-c.bounds.x),_=Math.max(0,this._zoomLevel+Math.log2(d/s)-.1),p=Math.max(i,this._zoomLevel+Math.log2(d/(s+t.length+0)));if(0!==_&&(e.angle=t.angle+(1-n)*Math.PI,e.minZoom=p,e.maxZoom=_,this._writeLineGlyph(a,h,f.x,f.y,e,o,u,!0),(n||this._current.offsetDirection)&&this._isVisible(e.minZoom,e.maxZoom))){const t=new hi(e.bounds.x+y[0],e.bounds.y+y[1],e.bounds.width,e.bounds.height);a.metricBoxWrite(t)}}}_writeLineGlyph(t,e,s,i,r,n,o,a){if(s<0||s>_.CQ||i<0||i>_.CQ)return;t.recordStart(this.instanceId,this.attributeLayout,r.textureBinding);const{texcoords:h,offsets:c}=r,{fontSize:l,haloSize:u,outlineSize:d}=this._textMeshTransformProps;this._writeQuad(t,e,s,i,{texcoords:h,offsets:c,fontSize:l,haloSize:u,outlineSize:d,color:Ls(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:o,minZoom:Math.max(this._current.zoomRange[0],r.minZoom),maxZoom:Math.min(this._current.zoomRange[1],r.maxZoom),clipAngle:n,mapAligned:a,isLineLabel:!0}),t.recordEnd()}_packedZoom(t){return Math.floor(t*_.fq)/_.fq}_isVisible(t,e){let s=Math.max(this._current.zoomRange[0],t),i=Math.min(this._current.zoomRange[1],e);s=this._packedZoom(s),i=this._packedZoom(i);const r=this._packedZoom(this._zoomLevel);return s<=r&&r<=i}}function So(t,e,s){const{coords:i,lengths:r}=e,n=(0,io.vt)(),o=(0,io.vt)(),a=(0,io.vt)(),h=(0,io.vt)(),c=(0,io.vt)(),l=(0,io.vt)();let u=0;for(let e=0;e<r.length;e++){const d=r[e];for(let e=0;e<d;e++){const r=2*(e+u-1),_=2*(e+u),p=2*(e+u+1);e>0?(0,N.hZ)(n,i[r],i[r+1]):(0,N.hZ)(n,0,0),(0,N.hZ)(o,i[_],i[_+1]),e<d-1?(0,N.hZ)(a,i[p],i[p+1]):(0,N.hZ)(a,0,0),0===e?(0,N.hZ)(h,0,0):((0,N.jb)(h,o,n),(0,N.S8)(h,h),(0,N.hZ)(h,h[1],-h[0])),e===d-1?(0,N.hZ)(c,0,0):((0,N.jb)(c,a,o),(0,N.S8)(c,c),(0,N.hZ)(c,c[1],-c[0])),(0,N.WQ)(l,h,c),(0,N.S8)(l,l);const f=l[0]*c[0]+l[1]*c[1];0!==f&&(0,N.hs)(l,l,f),(0,N.hs)(l,l,s),t.coords.push(o[0]+l[0],o[1]+l[1])}t.lengths.push(d),u+=d}return t}const Po={createComputedParams:t=>t,optionalAttributes:_n.optionalAttributes,attributes:{..._n.attributes,bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:({gradientMethod:t,gradientSizeUnits:e,gradientType:s})=>Os([[0,"alongline"===t.toLowerCase()],[1,1===e],[2,"discrete"===s.toLowerCase()]])},tlbr:{type:Fi.pe.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+_.hM+_.MZ,n=e.y+_.hM;return[r,n,r+s-2*_.MZ,n+i]}},accumulatedDistance:{type:Fi.pe.HALF_FLOAT,count:1,packTessellation:({distance:t,pathLength:e,distanceOffset:s})=>(s+t)/e},gradientSize:{type:Fi.pe.HALF_FLOAT,count:1,pack:({gradientSize:t,gradientSizeUnits:e})=>0===e?t/100:(0,l.Lz)(t)},totalLength:{type:Fi.pe.HALF_FLOAT,count:1,packTessellation:({pathLength:t})=>t},segmentDirection:{type:Fi.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]}}};class Mo extends mn{get _preventEffectClipping(){return!0}constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=Po,this._tessellationOptions.textured=!0}_write(t,e,s){const i=s??Pt.fromFeatureSetReaderCIM(e);if(!i)return;const{sprite:r}=this.evaluatedMeshParams;this._writeGeometry(t,e,i,r?.textureBinding)}}const Co={createComputedParams:t=>t,optionalAttributes:_n.optionalAttributes,attributes:{..._n.attributes,bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:t,shouldScaleDash:e,isSDF:s})=>Os([[4,t],[2,e],[3,s]])},tlbr:{type:Fi.pe.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+_.hM,n=e.y+_.hM;return[r,n,r+s,n+i]}},accumulatedDistance:{type:Fi.pe.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},segmentDirection:{type:Fi.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},offsetAlongLine:{type:Fi.pe.HALF_FLOAT,count:1,pack:({offsetAlongLine:t})=>(0,l.Lz)(t)},capType:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:({capType:t})=>{switch(t){case"Butt":case"butt":default:return 0;case"Square":case"square":return 1;case"Round":case"round":return 2}}}}};class Ao extends mn{constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=Co,this._tessellationOptions.textured=!0}_write(t,e,s){const i=s??Pt.fromFeatureSetReaderCIM(e);if(!i)return;const{sprite:r}=this.evaluatedMeshParams;this._writeGeometry(t,e,i,r?.textureBinding)}}class To{static from(t){return"width"in t?this.fromSimpleMeshParams(t):this.fromComplexMeshParams(t)}static fromSimpleMeshParams(t){const e=new To(t.sprite,t.color,t.outlineColor,t.minPixelBuffer,t.placement,t.scaleInfo,t.effects),{type:s,width:i,height:r,angle:n,alignment:o,outlineSize:a,referenceSize:h,sprite:c,overrideOutlineColor:u}=t;return e.rawWidth=(0,l.Lz)(i),e.rawHeight=(0,l.Lz)(r),e.angle=n,e.alignment=o,e.outlineSize=(0,l.Lz)(a),e.referenceSize=(0,l.Lz)(h),e.overrideOutlineColor=u,e.offsetX=(0,l.Lz)(t.offsetX),e.offsetY=(0,l.Lz)(t.offsetY),"simple"!==s||c.sdf||(e.rawWidth=c.width,e.rawHeight=c.height),e._computeSize(t,!1),e}static fromComplexMeshParams(t){const e=new To(t.sprite,t.color,t.outlineColor,t.minPixelBuffer,t.placement,t.scaleInfo,t.effects);let{alignment:s,transforms:i,size:r,scaleX:n,anchorX:o,anchorY:a,angle:h,colorLocked:c,frameHeight:u,widthRatio:d,offsetX:_,offsetY:p,outlineSize:f,referenceSize:m,scaleFactor:g,sizeRatio:y,isAbsoluteAnchorPoint:x,rotateClockwise:b,scaleSymbolsProportionally:w,sprite:v}=t;if(i&&i.infos.length>0){const t=(0,ne.zb)(r,h,b,_,p,i);r=t.size,h=t.rotation,_=t.offsetX,p=t.offsetY,b=!1}g&&(r*=g,_*=g,p*=g);const I=n*(v.width/v.height);e.alignment=s,e.rawHeight=(0,l.Lz)(r),e.rawWidth=e.rawHeight*I,e.referenceSize=(0,l.Lz)(m),e.sizeRatio=y,e.sdfDecodeCoeff=(v.sdfDecodeCoeff??1)*y,e.angle=h,e.rotateClockwise=b,e.anchorX=o,e.anchorY=a,e.offsetX=(0,l.Lz)(_),e.offsetY=(0,l.Lz)(p),x&&r&&(v.sdf?e.anchorX=o/(r*d):e.anchorX=o/(r*I),e.anchorY=a/r);const S=w&&u?r/u:1;return e.outlineSize=0===f||isNaN(f)?0:(0,l.Lz)(f)*S,e.scaleSymbolsProportionally=w,e.colorLocked=c,e._computeSize(t,!0),e}constructor(t,e,s,i,r,n,o){this.sprite=t,this.color=e,this.outlineColor=s,this.minPixelBuffer=i,this.placement=r,this.scaleInfo=n,this.effects=o,this.rawWidth=0,this.rawHeight=0,this.angle=0,this.outlineSize=0,this.referenceSize=0,this.sizeRatio=1,this.sdfDecodeCoeff=1,this.alignment=0,this.scaleSymbolsProportionally=!1,this.overrideOutlineColor=!1,this.colorLocked=!1,this.anchorX=0,this.anchorY=0,this.computedWidth=0,this.computedHeight=0,this.texXmin=0,this.texYmin=0,this.texXmax=0,this.texYmax=0,this.offsetX=0,this.offsetY=0,this.rotateClockwise=!0}get boundsInfo(){return{size:Math.max(this.computedHeight,this.computedWidth),offsetX:this.offsetX,offsetY:this.offsetY}}_computeSize(t,e){const{sprite:s,hasSizeVV:i}=t,r=!!s.sdf,n=s.sdfPaddingRatio??.5,{rawWidth:o,rawHeight:a,sizeRatio:h,outlineSize:c}=this,l=s.rect;let u=o*h,d=a*h,p=0,f=0;if(r){const t=1/(1-n);if(u*=t,d*=t,i)this.computedWidth=u,this.computedHeight=d;else{const t=e&&o>a?u:o,i=a,r=c+2;this.computedWidth=Math.min(t+r,u),this.computedHeight=Math.min(i+r,d);const n=Math.max(s.width,s.height)/Math.max(u,d);p=(this.computedWidth-u)*n,f=(this.computedHeight-d)*n}}else this.computedWidth=u*(l.width/s.width),this.computedHeight=d*(l.height/s.height),p=2*_.hM,f=2*_.hM;const m=l.x+_.hM-p/2,g=l.y+_.hM-f/2,y=m+s.width+p,x=g+s.height+f;this.texXmin=ko(m),this.texYmin=ko(g),this.texXmax=Fo(y),this.texYmax=Fo(x),this.computedWidth*=(this.texXmax-this.texXmin)/(y-m),this.computedHeight*=(this.texYmax-this.texYmin)/(x-g),this.anchorX*=u/this.computedWidth,this.anchorY*=d/this.computedHeight}}function ko(t,e=1e-7){const s=Math.ceil(t);return s-t<e?s:Math.floor(t)}function Fo(t,e=1e-7){const s=Math.floor(t);return t-s<e?s:Math.ceil(t)}const Eo=128/Math.PI;const Ro={createComputedParams:t=>To.from(t),optionalAttributes:{zoomRange:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:_.fq,pack:({scaleInfo:t},{tileInfo:e})=>Rs(t,e)}},attributes:{pos:{type:Fi.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:Fi.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:({sprite:t,alignment:e,scaleSymbolsProportionally:s,overrideOutlineColor:i,colorLocked:r})=>{let n=0;return t.sdf&&(n|=zs(qs)),1===e&&(n|=zs(Ws)),s&&(n|=zs(Us)),i&&(n|=zs(Ys)),r&&(n|=zs(js)),n}},offset:{type:Fi.pe.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:t,computedWidth:e,computedHeight:s,anchorX:i,anchorY:r,offsetX:n,offsetY:o,rotateClockwise:a})=>{const h=function(t,e,s,i,r=!1){const n=ii(),o=r?1:-1;return Zs(n),(e||s)&&Js(n,n,[e,-s]),i&&Qs(n,n,.017453292519944444*o*-i),n}(0,n,o,-t,a),c=-(.5+i)*e,l=-(.5-r)*s,u=[c,l],d=[c+e,l],_=[c,l+s],p=[c+e,l+s];return(0,N.l0)(u,u,h),(0,N.l0)(d,d,h),(0,N.l0)(_,_,h),(0,N.l0)(p,p,h),[u,d,_,p]}}},textureUV:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:t,texXmin:e,texYmax:s,texYmin:i})=>[[e,i],[t,i],[e,s],[t,s]]}},color:{type:Fi.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>Ls(t)},outlineColor:{type:Fi.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>Ls(t)},sizing:{type:Fi.pe.UNSIGNED_BYTE,count:4,pack:({rawWidth:t,rawHeight:e,outlineSize:s,referenceSize:i})=>[Ns(Math.max(t,e),128),Ns(s,128),Ns(i,128),0]},placementAngle:{type:Fi.pe.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:t})=>function(t){return function(t){return t%=256,Math.abs(t>=0?t:t+256)}(t*Eo)}(t)},sdfDecodeCoeff:{type:Fi.pe.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:t})=>t}}};class zo extends Oi{constructor(){super(...arguments),this.vertexSpec=Ro}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(t,e,s){const i=this.evaluatedMeshParams.sprite?.textureBinding,r=e.getDisplayId();t.recordStart(this.instanceId,this.attributeLayout,i);const n=this.evaluatedMeshParams.minPixelBuffer,o=Math.max(this.evaluatedMeshParams.computedWidth,n),a=Math.max(this.evaluatedMeshParams.computedHeight,n),h=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,c=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,l=this.evaluatedMeshParams.offsetX+h,u=-this.evaluatedMeshParams.offsetY+c;if(null!=this.evaluatedMeshParams.placement){let i=null;if(null!=s&&(i=Xt(s,2*Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight),!1),null===i))return;this._writePlacedMarkers(t,e,i,o,a)}else if(s?.nextPath()){s.nextPoint();const e=s.x,i=s.y;t.recordBounds(e+l,i+u,o,a),this._writeQuad(t,r,e,i)}else if("esriGeometryPolygon"===e.geometryType){const s=e.readCentroidForDisplay();if(!s)return;const[i,n]=s.coords;t.recordBounds(i+l,n+u,o,a),this._writeQuad(t,r,i,n)}else if("esriGeometryPoint"===e.geometryType){const s=e.readXForDisplay(),i=e.readYForDisplay();t.recordBounds(s+l,i+u,o,a),this._writeQuad(t,r,s,i)}else{const s=e.readGeometryForDisplay();s?.forEachVertex((e,s)=>{t.recordBounds(e+l,s+u,o,a),Math.abs(e)>Rt||Math.abs(s)>Rt||this._writeQuad(t,r,e,s)})}t.recordEnd()}_writePlacedMarkers(t,e,s,i,r){const n=s??Pt.fromFeatureSetReaderCIM(e);if(!n)return;const o=Fs.getPlacement(n,-1,this.evaluatedMeshParams.placement,(0,l.Lz)(1),t.id,Pi());if(!o)return;const a=e.getDisplayId();let h=o.next();const c=this.evaluatedMeshParams.offsetX,u=-this.evaluatedMeshParams.offsetY;for(;null!=h;){const e=h.tx,s=-h.ty;if(Math.abs(e)>Rt||Math.abs(s)>Rt){h=o.next();continue}const n=-h.getAngle();t.recordBounds(e+c,s+u,i,r),this._writeQuad(t,a,e,s,n),h=o.next()}}_writeQuad(t,e,s,i,r){const n=t.vertexCount(),o=null==r?null:{placementAngle:r};this._writeVertex(t,e,s,i,o),t.indexWrite(n+0),t.indexWrite(n+1),t.indexWrite(n+2),t.indexWrite(n+1),t.indexWrite(n+3),t.indexWrite(n+2)}}var Oo=s(4576),Lo=s(55674);class Do{destroy(){}}class Go extends Do{constructor(t){super(),this._value=t}resize(t){}read(t,e){return this._value}readWithDefault(t,e,s){return this._value}hasArcadeDependency(t){return!1}}const No=()=>D.A.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.mesh.MeshWriterInputEvaluator");async function Bo(t,e,s,i){const{defaultValue:r,valueExpressionInfo:n,value:o}=e;if(n){if("dictionary-template"===n.type)return{...e,computed:t.createDictionaryTemplateField(n,s),defaultValue:r};const{expression:o}=n,a=await t.createComputedField({expression:o},i);return a?{...e,computed:a,defaultValue:r}:null}return{...e,computed:new Go(o),defaultValue:r}}async function qo(t,e,s){const{valueExpressionInfo:i}=e,r="dictionary-template"===i.type?t.createDictionaryTemplateField(i,s):await t.createComputedField({expression:i.expression});return r?{...e,computed:r}:null}function Wo(t){return"object"==typeof t&&null!=t&&(!(!("valueExpressionInfo"in t)||!t.valueExpressionInfo)||"type"in t&&"Process"===t.type&&"op"in t&&"Random"===t.op)}function Uo(t){if(Array.isArray(t))for(const e of t)if(Uo(e))return!0;if("object"==typeof t){if(Wo(t))return!0;for(const e in t)if(Uo(t[e]))return!0}return!1}class Yo{static async create(t,e,s,i){const r={},n=new Map,o=new Map,a=new Map,h=new Map,c=new Map,l=new Map;for(const u in s){const d=s[u];if(null!=d&&"object"==typeof d)if(Array.isArray(d)){if("object"==typeof d[0])throw new Error(`InternalError: Cannot handle ${u}. Nested array params are not supported`);r[u]=d}else{if("valueExpressionInfo"in d){if(d.value){r[u]=d.value;continue}const e=await qo(t,d,i);if(!e){r[u]=d.defaultValue;continue}n.set(u,e),r[u]=null;continue}switch(d.type){case"cim-effect-infos":if(d.effectInfos.some(t=>t.overrides.length)){o.set(u,{effects:await Promise.all(d.effectInfos.map(async e=>{const s=e.overrides.map(e=>Bo(t,e,i,!1));return{effect:e.effect,compiledOverrides:(await Promise.all(s)).filter(Oo.Ru)}}))});break}r[u]=d.effectInfos.map(t=>t.effect);break;case"cim-marker-placement-param":d.overrides.length&&a.set(u,{placementInfo:d,compiledOverrides:(await Promise.all(d.overrides.map(e=>Bo(t,e,i,!1)))).filter(Oo.Ru)}),r[u]=d.placement;break;case"text-rasterization-param":{if(d.overrides.length){const e=d.overrides.map(e=>Bo(t,e,i,d.useLegacyLabelEvaluationRules??!1));h.set(u,{compiledOverrides:(await Promise.all(e)).filter(Oo.Ru),rasterizationParam:d,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:d.resource};r[u]=await e.fetchResourceImmediate(s)??null;break}case"sprite-rasterization-param":{if(d.overrides.length){const e=d.overrides.map(e=>Bo(t,e,i,!1));h.set(u,{compiledOverrides:(await Promise.all(e)).filter(Oo.Ru),rasterizationParam:d,objectIdToResourceId:new Map});continue}if("animated"===d.resource.type){h.set(u,{compiledOverrides:[],rasterizationParam:d,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:d.resource};r[u]=await e.fetchResourceImmediate(s)??null;break}case"cim-marker-transform-param":{const{params:e}=d;if(Uo(e)){const s={compiledMarkerInfos:[]};await Promise.all(e.map(async e=>{const r={props:{}};for(const s in e)if(Wo(e[s])){const n=await qo(t,e[s],i);r.compiledExpressionMap||(r.compiledExpressionMap=new Map);const o=r.compiledExpressionMap;n&&o.set(s,n)}else r.props[s]=e[s];s.compiledMarkerInfos.push(r)})),c.set(u,s)}else r[u]={type:"cim-marker-transform-info",infos:e};break}case"animation-params":{const{params:s}=d,i=rr(s);if(Uo(i)){const e=await Promise.all(i.map(e=>or(e,t)));l.set(u,{params:e,propertyIdToResourceId:new Map,key:u})}else{const t=ir(i),s=await e.fetchResourceImmediate({type:"animation-info",resource:t});null!=s&&"sprite"===s.type&&(r[u]={dataRow:s.rect.y,dataColumn:s.rect.x})}break}default:r[u]=d}}else r[u]=d}return new Yo(s,r,n,o,a,h,c,l)}constructor(t,e,s,i,r,n,o,a){this.inputMeshParams=t,this._resolvedMeshParams=e,this._dynamicProperties=s,this._dynamicEffectProperties=i,this._dynamicPlacementProperties=r,this._dynamicAsyncProperties=n,this._dynamicTransformProperties=o,this._dynamicAsyncAnimations=a,this.evaluator=t=>t,this._arcadeDependencies=new Set;for(const t of this._expressions())(0,Lo.QY)(this._arcadeDependencies,t)}get hasDynamicProperties(){return!!(this._dynamicProperties.size||this._dynamicAsyncProperties.size||this._dynamicEffectProperties.size||this._dynamicTransformProperties.size||this._dynamicPlacementProperties.size||this._dynamicAsyncAnimations.size)}get evaluatedMeshParams(){return this._evaluatedMeshParams||(this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams)),this._evaluatedMeshParams}enqueueRequest(t,e,s){for(const r of this._dynamicAsyncProperties.values()){const n=(0,wt.o8)(r.rasterizationParam.resource);"animated"===r.rasterizationParam.resource.type&&r.rasterizationParam.resource.randomizeStartTime&&(n.primitiveName="__RESERVED__PRIMITIVE__NAME__",n.startGroup=Gi(e.getObjectId()||0));for(const{primitiveName:t,propertyName:o,computed:a,defaultValue:h,valueExpressionInfo:c}of r.compiledOverrides)try{Ti(n,"animated"===r.rasterizationParam.resource.type?n.primitiveName:t,o,a,e,s,h)}catch(t){No().errorOnce(new i.A("invalid-arcade-expression","Encountered an error when evaluating the arcade expression",{error:t,valueExpressionInfo:c}))}const o=t.enqueueRequest({type:"cim-rasterization-info",resource:n});r.objectIdToResourceId.set(e.getObjectId(),o)}for(const i of this._dynamicAsyncAnimations.values()){const r=i.params.map(t=>ar(t,e,s)).map($i).map(t=>t.simplify()),n=nr(r),o=t.enqueueRequest({type:"animation-info",resource:n});i.propertyIdToResourceId.set(e.getObjectId()+"."+i.key,o)}}evaluateMeshParams(t,e,s){for(const[t,i]of this._dynamicProperties.entries())this._resolvedMeshParams[t]=i.computed.readWithDefault(e,s,i.defaultValue);for(const[t,i]of this._dynamicPlacementProperties.entries())for(const{computed:r,defaultValue:n,propertyName:o}of i.compiledOverrides){const a=r.readWithDefault(e,s,n);i.placementInfo.placement[o]=a,this._resolvedMeshParams[t]=i.placementInfo.placement}for(const[t,i]of this._dynamicEffectProperties.entries())for(const r of i.effects){for(const{computed:t,defaultValue:i,propertyName:n}of r.compiledOverrides){const o=t.readWithDefault(e,s,i);r.effect[n]=o}this._resolvedMeshParams[t]=i.effects.map(t=>t.effect)}for(const[t,i]of this._dynamicTransformProperties.entries()){const r={type:"cim-marker-transform-info",infos:[]};for(const t of i.compiledMarkerInfos){const i={...t.props};if(t.compiledExpressionMap)for(const[r,n]of t.compiledExpressionMap){const t=n.computed.readWithDefault(e,s,n.defaultValue);i[r]="number"==typeof t||"boolean"==typeof t?t:n.defaultValue}r.infos.push(i)}this._resolvedMeshParams[t]=r}for(const[s,i]of this._dynamicAsyncProperties.entries()){const r=i.objectIdToResourceId.get(e.getObjectId());if(null==r)continue;const n=t.getResource(r);this._resolvedMeshParams[s]=n}for(const[s,i]of this._dynamicAsyncAnimations.entries()){const r=i.propertyIdToResourceId.get(e.getObjectId()+"."+s);if(null==r)continue;const n=t.getResource(r);this._resolvedMeshParams[s]={dataRow:n.rect.y,dataColumn:n.rect.x}}return this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams),this.evaluatedMeshParams}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}*_expressions(){for(const t of this._dynamicProperties.values())yield t.computed;for(const t of this._dynamicEffectProperties.values())for(const e of t.effects)for(const t of e.compiledOverrides)yield t.computed;for(const t of this._dynamicPlacementProperties.values())for(const e of t.compiledOverrides)yield e.computed;for(const t of this._dynamicAsyncProperties.values())for(const e of t.compiledOverrides)yield e.computed;for(const t of this._dynamicTransformProperties.values())for(const e of t.compiledMarkerInfos)if(null!=e.compiledExpressionMap)for(const t of e.compiledExpressionMap.values())yield t.computed;for(const t of this._dynamicAsyncAnimations.values())for(const e of t.params)yield*hr(e)}}const jo={createComputedParams:t=>t,optionalAttributes:{},attributes:{pos:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:10,pack:"position"},id:{type:Fi.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:t=>0},offset:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:16,packAlternating:{count:4,pack:({size:t})=>{const e=(0,l.Lz)(t),s=-e/2,i=-e/2;return[[s,i],[s+e,i],[s,i+e],[s+e,i+e]]}}},texCoords:{type:Fi.pe.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:()=>[[0,1],[1,1],[0,0],[1,0]]}},size:{type:Fi.pe.UNSIGNED_BYTE,count:2,pack:({size:t})=>[t,t]},referenceSize:{type:Fi.pe.UNSIGNED_BYTE,count:1,pack:({size:t})=>(0,l.Lz)(t)},zoomRange:{type:Fi.pe.UNSIGNED_BYTE,count:2,pack:({scaleInfo:t},{tileInfo:e})=>Rs(t,e)}}};class Vo extends Oi{constructor(){super(...arguments),this.vertexSpec=jo}_write(t,e){const s=e.getDisplayId(),i=this.evaluatedMeshParams.minPixelBuffer,r=Math.max((0,l.Lz)(this.evaluatedMeshParams.size),i);let n,o;if("esriGeometryPoint"===e.geometryType)n=e.readXForDisplay(),o=e.readYForDisplay();else{const t=e.readCentroidForDisplay();if(!t)return;n=t?.coords[0],o=t?.coords[1]}t.recordStart(this.instanceId,this.attributeLayout),t.recordBounds(n,o,r,r);const a=t.vertexCount();this._writeVertex(t,s,n,o),t.indexWrite(a+0),t.indexWrite(a+1),t.indexWrite(a+2),t.indexWrite(a+1),t.indexWrite(a+3),t.indexWrite(a+2),t.recordEnd()}}class Xo{async createMeshWriter(t,e,s,i,r){const n=this._getMeshWriter(i.techniqueType),o=await Yo.create(t,e,i.inputParams,r),a=new n(i.id,o,i.optionalAttributes,s);return await a.loadDependencies(),a}_getMeshWriter(t){switch(t){case 9:return Mn;case 8:return Sn;case 6:return En;case 20:return An;case 10:return $n;case 18:return Ln;case 21:return to;case 7:return Wn;case 17:return zo;case 22:return Vo;case 24:return bo;case 15:return mn;case 25:return Ao;case 11:return Mo;case 13:return so;case 14:return Io;case 2:return Tr;case 3:return kr;case 0:return yn;case 1:return bn;default:throw new Error("Internal Error: Mesh writer not in the registry")}}}class Ho{constructor(t,e,s,i,r){this.storage=t,this.proxy=e,this.viewParams=s,this.registry=i,this.fieldsMap=r}async createMeshWriters(t){const e=t.map(t=>this.registry.createMeshWriter(this.storage,this.proxy,this.viewParams,t,this.fieldsMap));return Promise.all(e)}}var Zo=s(563);class $o{constructor(t){this._outstandingMessages=[],this._queue=new Zo.QueueProcessor({concurrency:t.concurrency,process:e=>t.process(e)})}async push(t){if(t.end)return await Promise.all(this._outstandingMessages),await this._queue.push(t),void(this._outstandingMessages=[]);const e=this._queue.push(t);return this._outstandingMessages.push(e),e}}var Qo=s(43334),Jo=s(31464),Ko=s(95466);class ta{static async create(t,e){if("count"===e.statisticType){const t=new Go(1);return new ta(e.name,e.alias,e.type,e.statisticType,t)}const s=await t.createComputedField({expression:e.onStatisticExpression?.expression,field:e.onStatisticField});return new ta(e.name,e.alias,e.type,e.statisticType,s)}constructor(t,e,s,i,r){this.name=t,this.alias=e,this.type=s,this.statisticType=i,this.computed=r}}var ea=s(65529),sa=s(70328),ia=s(37730),ra=s(95422);class na{constructor(t){this.subscription=t,this.handledChunks=new Set}destroy(){}}class oa{constructor(t,e,s){this._source=t,this._attributeStore=e,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}onSubscribe(t){const e=this.createState(t);this._sendStates.set(t.key.id,e),this.updateChunks()}onUnsubscribe(t){this._sendStates.get(t.key.id)?.destroy(),this._sendStates.delete(t.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(){return!1}invalidate(){const t=Array.from(this._sendStates.values());this._sendStates.clear();for(const e of t)e.destroy(),this.onSubscribe(e.subscription)}invalidateAttributeData(t){}hasArcadeDependency(t){return!1}getFeatureObjectIdsForAggregate(t){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(t){return this.displayMap(t,t=>t,t=>t)}getDisplayAndObjectIds(t){return this.displayMap(t,t=>t,(t,e,s)=>[t,s])}afterUpdateChunks(){}}class aa extends oa{constructor(t,e,s,i,r){super(t,e,r),this.spatialReference=s,this.aggregateFields=i,this._arcadeDependencies=new Set,this.events=new ea.A.EventEmitter,this.featureAdapter=ia.T;for(const t of i)(0,Lo.QY)(this._arcadeDependencies,t.computed)}get aggregateQueryEngine(){return this._aggregateQueryEngine||(this._aggregateQueryEngine=new ra.do({featureStore:this,fieldsIndex:this._metadata.fieldsIndex,geometryType:this._metadata.geometryType,featureIdInfo:this._metadata.featureIdInfo,spatialReference:this.spatialReference})),this._aggregateQueryEngine}get isAggregate(){return!0}removeChunks(t){}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}forEach(t){return this.forEachAggregateWorldSpace(t)}forEachInBounds(t,e){}forEachBounds(t,e){const s=(0,sa.vt)();for(const i of t){const t=(0,ro.jQ)(s,i.geometry,!1,!1);t&&e(t)}}}class ha{constructor(t,e,s,i,r){this.subscription=t,this.reader=e,this.clear=s,this.end=i,this.debugInfo=r,this.type="append"}get id(){return this.subscription.tile.id}createMessage(t,e,s){return{type:"append",clear:this.clear,id:this.id,append:t,end:this.end,debugInfo:this.debugInfo,subscriptionVesrion:this.subscription.version,version:e,attributeEpoch:s}}}class ca{constructor(t,e,s,i,r){this.subscription=t,this.reader=e,this.remove=s,this.end=i,this.debugInfo=r,this.type="update"}get id(){return this.subscription.tile.id}createMessage(t,e,s){return{type:"update",id:this.id,modify:t,debugInfo:this.debugInfo,remove:this.remove,version:e,subscriptionVesrion:this.subscription.version,end:this.end,attributeEpoch:s}}}const la=8388607,ua=t=>t&la;class da extends Do{constructor(t){super(),this._field=t}resize(t){throw new Error("Method not implemented.")}read(t,e){return t.readAttribute(this._field)}readWithDefault(t,e){return t.readAttribute(this._field)}hasArcadeDependency(t){return!1}}function _a(t,e,s){if(null==t)return null;const i=e.readArcadeFeature();e.contextTimeZone=s.$view?.timeZone;try{return t.evaluate(i,s)}catch(t){return D.A.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",t),null}}function pa(t){return null==t||t===1/0||t===-1/0||"number"==typeof t&&isNaN(t)}function fa(t,e,s,i){if(null==t)return null!=i?i:null;const r=e.readArcadeFeature();e.contextTimeZone=s.$view?.timeZone;const n=t.evaluate(r,s);return pa(n)?null!=i?i:null:n}class ma extends Do{static async create(t,e){const s=await(0,Lo.Ad)(t,e.spatialReference),i=(0,yt.Wm)(t);return new ma(s,i)}constructor(t,e){super(),this._compiled=t,this._cacheKey=e}resize(t){}read(t,e){return this.hasArcadeDependency("scale")||"system"!==e.$view.timeZone?_a(this._compiled,t,e):this._readCached(t,e)}readWithDefault(t,e,s){return this.hasArcadeDependency("scale")||"system"!==e.$view.timeZone?fa(this._compiled,t,e,s):this._readWithDefaultCached(t,e,s)}hasArcadeDependency(t){return this._compiled?.references(t)??!1}_getCacheKey(t){if(!this._compiled?.references("timeProperties"))return this._cacheKey;const{currentStart:e,currentEnd:s}=t.$view.timeProperties;return this._cacheKey+function(t,e){const s=43758.5453*Math.sin(12.9898*t+78.233*e);return s-Math.floor(s)}(e??1,s??1)}_readCached(t,e){if(t.setCache(this._getCacheKey(e)),t.hasCachedValue())return t.getCachedValue();const s=_a(this._compiled,t,e);return t.setCachedValue(s),s}_readWithDefaultCached(t,e,s){if(t.setCache(this._getCacheKey(e)),t.hasCachedValue())return t.getCachedValue();const i=fa(this._compiled,t,e,s);return t.setCachedValue(i),i}}var ga=s(97770),ya=s(18047),xa=s(68463),ba=s(30524),wa=s(32730);class va extends Do{static async create(t,e){const s=(0,wa.lc)(t);return new va(t=>s.replaceAll(/{[^}]*}/g,e=>{const s=e.slice(1,-1),i=t.metadata.fieldsIndex.get(s);if(null==i)return e;const r=t.readAttribute(s);return null==r?"":function(t,e){if(null==t)return"";const s=e.domain;if(s)if("codedValue"===s.type||"coded-value"===s.type){const e=t;for(const t of s.codedValues)if(t.code===e)return t.name}else if("range"===s.type){const{max:i,min:r}=(0,xa.A5)(e),n=+t;if(null!=r&&null!=i&&r<=n&&n<=i)return s.name}let i=t;return(0,ba.vE)(e)?i=(0,ga.Yq)(i,(0,ga.J2)("short-date")):(0,ba.WA)(e)&&(i=(0,ya.ZV)(+i)),i||""}(r,i)}))}constructor(t){super(),this._evaluator=t}resize(t){}read(t,e){return this._evaluator(t)}readWithDefault(t,e,s){const i=this._evaluator(t);return pa(i)?s:i}hasArcadeDependency(t){return!1}}class Ia extends Do{constructor(t,e){super(),this._template=t,this._parts=(0,ne.gQ)(t.template,e)}resize(t){}read(t,e){return(0,ne._h)(t,this._parts,this._template.textCase)}readWithDefault(t,e,s){return(0,ne._h)(t,this._parts,this._template.textCase)}hasArcadeDependency(t){return!1}}class Sa extends Do{constructor(t,e){super(),this._field=t,this._normalizationInfo=e}resize(t){throw new Error("Method not implemented.")}read(t,e){return this._readNormalized(t)}readWithDefault(t,e){return this._readNormalized(t)}hasArcadeDependency(t){return!1}_readNormalized(t){const e=t.readAttribute(this._field);if(null==e)return null;const{normalizationField:s,normalizationTotal:i,normalizationType:r}=this._normalizationInfo,n=t.readAttribute(s);switch(r??"esriNormalizeByField"){case"esriNormalizeByField":return n?n?e/n:void 0:null;case"esriNormalizeByLog":return Math.log(e)*Math.LOG10E;case"esriNormalizeByPercentOfTotal":return i?e/i*100:null}}}class Pa{static fromBuffer(t,e){return new Pa(t,e)}static create(t,e=4294967295){const s=new Uint32Array(Math.ceil(t/32));return new Pa(s,e)}constructor(t,e){this._mask=0,this._buf=t,this._mask=e}_getIndex(t){return Math.floor(t/32)}has(t){const e=this._mask&t;return!!(this._buf[this._getIndex(e)]&1<<e%32)}hasRange(t,e){let s=t,i=e;for(;s%32&&s!==i;){if(this.has(s))return!0;s++}for(;i%32&&s!==i;){if(this.has(s))return!0;i--}if(s===i)return!1;for(let t=s/32;t!==i/32;t++)if(this._buf[t])return!0;return!1}set(t){const e=this._mask&t,s=this._getIndex(e),i=1<<e%32;this._buf[s]|=i}setRange(t,e){let s=t,i=e;for(;s%32&&s!==i;)this.set(s++);for(;i%32&&s!==i;)this.set(i--);if(s!==i)for(let t=s/32;t!==i/32;t++)this._buf[t]=4294967295}unset(t){const e=this._mask&t,s=this._getIndex(e),i=1<<e%32;this._buf[s]&=4294967295^i}resize(t){const e=this._buf,s=new Uint32Array(Math.ceil(t/32));s.set(e),this._buf=s}or(t){for(let e=0;e<this._buf.length;e++)this._buf[e]|=t._buf[e];return this}and(t){for(let e=0;e<this._buf.length;e++)this._buf[e]&=t._buf[e];return this}xor(t){for(let e=0;e<this._buf.length;e++)this._buf[e]^=t._buf[e];return this}ior(t){for(let e=0;e<this._buf.length;e++)this._buf[e]|=~t._buf[e];return this}iand(t){for(let e=0;e<this._buf.length;e++)this._buf[e]&=~t._buf[e];return this}ixor(t){for(let e=0;e<this._buf.length;e++)this._buf[e]^=~t._buf[e];return this}any(){for(let t=0;t<this._buf.length;t++)if(this._buf[t])return!0;return!1}copy(t){for(let e=0;e<this._buf.length;e++)this._buf[e]=t._buf[e];return this}clone(){return new Pa(this._buf.slice(),this._mask)}clear(){for(let t=0;t<this._buf.length;t++)this._buf[t]=0;return this}forEachSet(t){for(let e=0;e<this._buf.length;e++){let s=this._buf[e],i=32*e;if(s)for(;s;)1&s&&t(i),s>>>=1,i++}}countSet(){let t=0;return this.forEachSet(e=>{t++}),t}}var Ma=s(39516);const Ca=()=>D.A.getLogger("esri.views.2d.layers.FeatureLayerView2D"),Aa={getAttribute:(t,e)=>t.readAttribute(e)};async function Ta(t,e){try{const s=await(0,Ma.GP)(t,e);return s.isStandardized||Ca().error(new i.A("sql-parse-error","expression is not standardized",{where:t})),(e,r)=>{const n=e.readArcadeFeature();try{return s.testFeatureCompiled(n,Aa,r.currentUser)}catch(e){return Ca().warn(new i.A("sql-runtime-error","Encountered an error when evaluating where clause",{where:t,error:e})),!0}}}catch(e){return Ca().warn(new i.A("sql-runtime-error","Encountered an error when evaluating where clause",{where:t,error:e})),t=>!0}}const ka=()=>D.A.getLogger("esri.views.2d.layers.features.support.ComputedAttributeStorage"),Fa=4294967295;function Ea(t,e,s){if(!(t.length>e))for(;t.length<=e;)t.push(s)}class Ra{constructor(t){this._numerics=[],this._strings=[],this._allocatedSize=256,this._bitsets=[],this._instanceIds=[],this._bounds=[],this._dirtyBitset=this.getBitset(this.createBitset()),this.compilationOptions=t}createBitset(){const t=this._bitsets.length;return this._bitsets.push(Pa.create(this._allocatedSize,la)),t+1}createDictionaryTemplateField(t,e){return new Ia(t,e)}async createComputedField(t,e=!1){if(t.expression)try{if(!this.compilationOptions)throw new Error("InternalError: Compilation options not defined");return e?await va.create(t.expression,this.compilationOptions):await ma.create(t.expression,this.compilationOptions)}catch(e){const s=new i.A("featurelayer","Failed to compile arcade expression",{error:e,expression:t.expression});return ka().error(s),null}if(t.normalizationType||t.normalizationField)return new Sa(t.field,t);if(t.field)return new da(t.field);const s=new i.A("featurelayer","Unable to create computed field. No expression or field found",{info:t});return ka().error(s),null}async createWhereClause(t){return t?Ta(t,this.compilationOptions.fields):null}getBitset(t){return this._bitsets[t-1]}getComputedNumeric(t,e){return this.getComputedNumericAtIndex(t&la,0)}setComputedNumeric(t,e,s){return this.setComputedNumericAtIndex(t&la,s,0)}getComputedString(t,e){return this.getComputedStringAtIndex(t&la,0)}setComputedString(t,e,s){return this.setComputedStringAtIndex(t&la,0,s)}getComputedNumericAtIndex(t,e){const s=t&la;return this._ensureNumeric(e,s),this._numerics[e][s]}setComputedNumericAtIndex(t,e,s){const i=t&la;this._ensureNumeric(e,i),this._numerics[e][i]=s}getPackedChunkId(t){const e=t&la;return this._ensureInstanceId(e),this._instanceIds[e]}setPackedChunkId(t,e){const s=t&la;this._ensureInstanceId(s),this._instanceIds[s]=e}getComputedStringAtIndex(t,e){const s=t&la;return this._ensureString(e,s),this._strings[e][s]}setComputedStringAtIndex(t,e,s){const i=t&la;this._ensureString(e,i),this._strings[e][i]=s}getXMin(t){return this._bounds[4*(t&la)]}getYMin(t){return this._bounds[4*(t&la)+1]}getXMax(t){return this._bounds[4*(t&la)+2]}getYMax(t){return this._bounds[4*(t&la)+3]}setBounds(t,e,s=!1){const i=t&la;if(!s&&!this._dirtyBitset.has(t))return this._bounds[4*i]!==Fa;this._dirtyBitset.unset(t);const r=e.readGeometryWorldSpace();if(Ea(this._bounds,4*i+4,0),!r||!r.coords.length)return this._bounds[4*i]=Fa,this._bounds[4*i+1]=Fa,this._bounds[4*i+2]=Fa,this._bounds[4*i+3]=Fa,!1;let n=1/0,o=1/0,a=-1/0,h=-1/0;return r.forEachVertex((t,e)=>{n=Math.min(n,t),o=Math.min(o,e),a=Math.max(a,t),h=Math.max(h,e)}),this._bounds[4*i]=n,this._bounds[4*i+1]=o,this._bounds[4*i+2]=a,this._bounds[4*i+3]=h,!0}getBounds(t,e){const s=this.getXMin(e),i=this.getYMin(e),r=this.getXMax(e),n=this.getYMax(e);return(0,sa.BI)(t,s,i,r,n),s!==Fa}_ensureNumeric(t,e){this._numerics[t]||(this._numerics[t]=[]),Ea(this._numerics[t],e,0)}_ensureInstanceId(t){Ea(this._instanceIds,t,0)}_ensureString(t,e){this._strings[t]||(this._strings[t]=[]),Ea(this._strings[t],e,null)}}var za=s(58727),Oa=s(62660),La=s(86420),Da=s(61956),Ga=s(66131),Na=s(44729),Ba=s(15032),qa=s(62577),Wa=s(27647),Ua=s(98623);class Ya{constructor(t){this._valid=Pa.create(t),this._data=new Array(t)}has(t){return this._valid.has(t)}set(t,e){this._valid.set(t),this._data[t]=e}get(t){return this._data[t]}}const ja=(0,n.A)("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],Va=ja[0],Xa=ja[1],Ha=ja[2],Za=ja[3],$a=(0,n.A)("featurelayer-simplify-payload-size-factors")??[1,2,4],Qa=$a[0],Ja=$a[1],Ka=$a[2],th=(0,n.A)("featurelayer-simplify-mobile-factor")??2,eh=(0,n.A)("esri-mobile"),sh=4294967295;class ih{constructor(t){this.metadata=t,this.type="FeatureSetReader",this._overrides=null,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(t,e){let s=1;const i=eh?th:1;e>4e6?s=Ka*i:e>1e6?s=Ja*i:e>5e5?s=Qa*i:e>1e5&&(s=i);let r=0;return t>4e3?r=Za*s:t>2e3?r=Ha*s:t>100?r=Xa:t>15&&(r=Va),r}getBounds(t){!function(t,e){if(!(t.length>e))for(;t.length<=e;)t.push(0)}(this._boundsBuffer,4*this.getIndex()+4);const e=this.getBoundsXMin();if(e===sh||!isFinite(e))return!1;if(0===this.getBoundsXMin()){const e=this.readGeometryWorldSpace();if(e?.isPoint&&0===e.coords[0]&&0===e.coords[1])return(0,sa.BI)(t,0,0,0,0),!0;if(!e)return this.setBoundsXMin(sh),!1;let s=1/0,i=1/0,r=-1/0,n=-1/0;return e.forEachVertex((t,e)=>{s=Math.min(s,t),i=Math.min(i,e),r=Math.max(r,t),n=Math.max(n,e)}),this.setBoundsXMin(s),this.setBoundsYMin(i),this.setBoundsXMax(r),this.setBoundsYMax(n),(0,sa.BI)(t,s,i,r,n),!0}const s=this.getBoundsXMin(),i=this.getBoundsYMin(),r=this.getBoundsXMax(),n=this.getBoundsYMax();return(0,sa.BI)(t,s,i,r,n),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(t){this._boundsBuffer[4*this.getIndex()]=t}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(t){this._boundsBuffer[4*this.getIndex()+1]=t}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(t){this._boundsBuffer[4*this.getIndex()+2]=t}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(t){this._boundsBuffer[4*this.getIndex()+3]=t}readAttributeAsTimestamp(t){const e=this.readAttribute(t);return"string"==typeof e?new Date(e).getTime():"number"==typeof e||null==e?e:null}readAttribute(t,e=!1){const s=this._readAttribute(t,e);if(void 0!==s)return s;for(const s of this._joined){s.setIndex(this.getIndex());const i=s._readAttribute(t,e);if(void 0!==i)return i}}readAttributes(){const t=this._readAttributes();for(const e of this._joined){e.setIndex(this.getIndex());const s=e._readAttributes();for(const e of Object.keys(s))t[e]=s[e]}return t}joinAttributes(t){this._joined.push(t)}registerOverrides(t){this._overrides=t}withoutOverrides(){const t=this.copy();return t._overrides=null,t}readOptimizedFeatureWorldSpace(){const t=this.readGeometryWorldSpace(),e=this.readAttributes(),s=this.readCentroidWorldSpace();return new Qo.Om(t,e,s,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){const t=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(t&&{x:t.coords[0],y:t.coords[1]})??null}}readLegacyFeatureWorldSpace(){const t=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(t&&{x:t.coords[0],y:t.coords[1]})??null}}readLegacyGeometryForDisplay(){const t=this.readGeometryForDisplay();return(0,ro.zv)(t,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const t=this._readX(),e=this.getInTransform();return null==e?t:t*e.scale[0]+e.translate[0]}readYWorldSpace(){const t=this._readY(),e=this.getInTransform();return null==e?t:e.translate[1]-t*e.scale[1]}readGeometryForDisplay(){const t=this._readGeometryDeltaDecoded(!0);if(!t){const t=this._createDeltaQuantizedGeometryFromServerCentroid();return t?t.deltaDecode():null}return t}readGeometryForDisplayTransformed(t){let e=this.readGeometryForDisplay();if(e&&"esriGeometryPolyline"===this.metadata.geometryType&&(e=(0,ro.kz)(new St.A,e,this.hasZ,this.hasM,this.metadata.geometryType,t.scale[0])),e&&(e=(0,ro.hK)(e,t,this.metadata.geometryType,this.hasZ,this.hasM)),!e){const e=this.readCentroidForDisplay();if(!e)return null;const s=(0,qa.IE)(t,e.coords[0]),i=(0,qa.B2)(t,e.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(s,i).deltaDecode()}return e}readGeometryWorldSpace(){let t=this._readGeometry();if(t||(t=this._createDeltaQuantizedGeometryFromServerCentroid()),!t)return null;const e=t.clone(),s=this.getInTransform();return null!=s&&(0,ro.Ch)(e,e,this.hasZ,this.hasM,s),e}readCentroidForDisplay(){const t=this.readGeometryForDisplay();return t?this._computeDisplayCentroid(t):this._readServerCentroid()}readCentroidWorldSpace(){const t=this.readGeometryForDisplay(),e=t?this._computeDisplayCentroid(t):this._readServerCentroid();if(!e)return null;const s=e.clone(),i=this.getInTransform();return null!=i&&(0,ro.Ch)(s,s,this.hasZ,this.hasM,i),s}setCache(t){let e=this._caches.get(t);null==e&&(e=new Ya(this.getSize()),this._caches.set(t,e)),this._activeCache=e}setCachedValue(t){this._activeCache.set(this.getIndex(),t)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}_readGeometryDeltaDecoded(t){const e=this._readGeometry(t);return"esriGeometryPoint"!==this.geometryType&&e&&this.getInTransform()?e.deltaDecode():e}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(t){this._contextTimeZone=t}readArcadeFeature(){return this}hasField(t){return this.fields.has(t)||this._joined.some(e=>e.hasField(t))}geometry(){const t=this.readGeometryWorldSpace(),e=(0,ro.zv)(t,this.geometryType,this.hasZ,this.hasM),s=(0,It.rS)(e);if(s){if(!this.metadata.outSpatialReference)throw new Error("InternalError: Expected spatial reference to be defined");s.spatialReference=this.metadata.outSpatialReference}return s}autocastArcadeDate(t,e){return e&&e instanceof Date?this.isUnknownDateTimeField(t)?Ga.lY.unknownDateJSToArcadeDate(e):Ga.lY.dateJSAndZoneToArcadeDate(e,this.contextTimeZone??Ua.qU):e}isUnknownDateTimeField(t){return this.metadata.fieldsIndex.getTimeZone(t)===Ua.L5}field(t){let e=this.fields.get(t);if(e)switch(e.type){case"date-only":case"esriFieldTypeDateOnly":return Na.n.fromReader(this.readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return Ba.k.fromReader(this.readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return Ga.lY.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(const s of this._joined)if(s.setIndex(this.getIndex()),e=s.fields.get(t),e)switch(e.type){case"date-only":case"esriFieldTypeDateOnly":return Na.n.fromReader(s._readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return Ba.k.fromReader(s._readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return Ga.lY.fromReaderAsTimeStampOffset(s._readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,s._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw new Error(`Field ${t} does not exist`)}setField(t,e){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map(t=>t.name)}castToText(t=!1){if(!t)return JSON.stringify(this.readLegacyFeatureForDisplay());const e=this.readLegacyFeatureForDisplay();if(!e)return JSON.stringify(null);const s={geometry:e.geometry,attributes:{...e.attributes??{}}};for(const t in s.attributes){const e=s.attributes[t];e instanceof Date&&(s.attributes[t]=e.getTime())}return JSON.stringify(s)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(t=null){return{attributes:this._readAttributes(),geometry:!0===t?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(t=null,e=null){return Promise.resolve(this.castAsJson(e))}_getExists(){if(this._overrides){const t=this.getObjectId();return!this._overrides.hasOverride(t)}return!0}_computeDisplayCentroid(t){if(null==this.getInTransform())return(0,Wa.Q)(new St.A,t,this.hasM,this.hasZ);const e=Pt.fromOptimized(t,this.geometryType);e.yFactor*=-1;const s=ps(e);return s?(s[1]*=-1,new St.A([],s)):null}copyInto(t){t._joined=this._joined,t._overrides=this._overrides,t._objectIdToIndex=this._objectIdToIndex,t._boundsBuffer=this._boundsBuffer,t._activeCache=this._activeCache,t._caches=this._caches,t._contextTimeZone=this._contextTimeZone}_readLegacyGeometryWorldSpace(){const t=this.readGeometryWorldSpace();return(0,ro.zv)(t,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){const t=this._readServerCentroid();if(!t)return null;const[e,s]=t.coords;return this._createDeltaQuantizedExtrudedGeometry(e,s)}_createDeltaQuantizedExtrudedGeometry(t,e){return"esriGeometryPolyline"===this.geometryType?this._createDeltaQuantizedExtrudedLine(t,e):this._createDeltaQuantizedExtrudedQuad(t,e)}_createDeltaQuantizedExtrudedQuad(t,e){return new St.A([5],[t-1,e,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(t,e){return new St.A([2],[t-1,e+1,1,-1])}}class rh extends ih{static fromFeatures(t,e){const{geometryType:s}=e,i=(0,ro.Di)([],t,s,!1,!1,e.featureIdInfo);for(let e=0;e<i.length;e++)i[e].displayId=t[e].displayId;return rh.fromOptimizedFeatures(i,e)}static fromFeatureSet(t,e){const s=(0,ro.q3)(t,e.featureIdInfo);return rh.fromOptimizedFeatureSet(s,e)}static fromOptimizedFeatureSet(t,e){const s=rh.fromOptimizedFeatures(t.features,e);return s._exceededTransferLimit=t.exceededTransferLimit,s._transform=t.transform,s._fieldsIndex=new Ko.A(t.fields),s}static fromOptimizedFeatures(t,e,s){const i=new rh(t,e);return i._fieldsIndex=e.fieldsIndex,i._transform=s,i}static empty(t){return new rh([],t)}constructor(t,e){super(e),this._exceededTransferLimit=!1,this._featureIndex=-1,this._fieldsIndex=null,this._geometryType=e.geometryType,this._features=t}get fields(){return this._fieldsIndex}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return!1}get hasM(){return!1}get _current(){return this._features[this._featureIndex]}get usedMemory(){return this._current.usedMemory}getSize(){return this._features.length}getCursor(){return this.copy()}getInTransform(){return this._transform}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getIndex(){return this._featureIndex}setIndex(t){this._featureIndex=t}getObjectId(){return this._current?.objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){this._current.displayId=t}copy(){const t=new rh(this._features,this.metadata);return this.copyInto(t),t}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readGeometryArea(){return(0,Qo.N3)(this._current)?(0,ro.Rk)(this._current.geometry,2):0}_readX(){return(0,Qo.N3)(this._current)?this._current.geometry.coords[0]:0}_readY(){return(0,Qo.N3)(this._current)?this._current.geometry.coords[1]:0}_readGeometry(){return(0,Qo.N3)(this._current)?this._current.geometry??null:null}_readServerCentroid(){return this._current.centroid}_readAttribute(t,e){if(!this._fieldsIndex){const e=this._current.attributes[t];if(void 0!==e)return e;const s=t.toLowerCase();for(const t in this._current.attributes)if(t.toLowerCase()===s)return this._current.attributes[t];return}const s=this._fieldsIndex.get(t);if(!s)return;const i=this._current.attributes[s.name];return null==i?i:e&&this.fields.isDateField(t)?new Date(i):i}_readAttributes(){return this._current.attributes}copyInto(t){super.copyInto(t),t._featureIndex=this._featureIndex,t._transform=this._transform,t._fieldsIndex=this._fieldsIndex}}class nh{static{this.Shared=new nh}getObjectId(t){return t.getObjectId()}getAttributes(t){return t.readAttributes()}getAttribute(t,e){return t.readAttribute(e)}getAttributeAsTimestamp(t,e){return t.readAttributeAsTimestamp(e)}cloneWithGeometry(t,e){const s=t.readAttributes(),i=new Qo.Om(e,s,null,t.getObjectId(),t.getDisplayId()),r=rh.fromOptimizedFeatures([i],t.metadata);return r.setIndex(0),r}getGeometry(t){return t.readGeometryWorldSpace()}getCentroid(t,e){return t.readCentroidForDisplay()}}class oh{constructor(t){this._geometryBounds=(0,H.vt)(),this._idToVisibility=new Map,this._serviceInfo=t}static async create(t){const e=new oh(t);return await e.update(t.filterJSON,t.spatialReference),e}get hash(){return this._hash}check(t,e){return this._applyFilter(t,e)}invalidate(){this._idToVisibility.forEach((t,e)=>{this._idToVisibility.set(e,0)})}setKnownIds(t){for(const e of t)this._idToVisibility.set(e,1)}setTrue(t){const e=[],s=[],i=new Set(t);return this._idToVisibility.forEach((t,r)=>{const n=!!(1&this._idToVisibility.get(r)),o=i.has(r);!n&&o?e.push(r):n&&!o&&s.push(r),this._idToVisibility.set(r,o?3:0)}),{show:e,hide:s}}createQuery(){const{geometry:t,spatialRel:e,where:s,timeExtent:i,objectIds:r}=this;return Da.A.fromJSON({geometry:t,spatialRel:e,where:s,timeExtent:i,objectIds:r})}async update(t,e){this._hash=JSON.stringify(t);const s=await(0,za.T2)(t,null,e);await Promise.all([this._setGeometryFilter(s),this._setIdFilter(s),this._setAttributeFilter(s),this._setTimeFilter(s)])}async _setAttributeFilter(t){if(!t?.where)return this._clause=null,void(this.where=null);this._clause=await Ta(t.where,this._serviceInfo.fieldsIndex),this.where=t.where}_setIdFilter(t){this._idsToShow=t?.objectIds&&new Set(t.objectIds),this._idsToHide=t?.hiddenIds&&new Set(t.hiddenIds),this.objectIds=t?.objectIds}async _setGeometryFilter(t){if(!t?.geometry)return this._spatialQueryOperator=null,this.geometry=null,void(this.spatialRel=null);const e=t.geometry,s=t.spatialRel??"esriSpatialRelIntersects",i=await(0,Oa.xt)(s,e,this._serviceInfo.geometryType,this._serviceInfo.hasZ,this._serviceInfo.hasM);(0,le.Rg)(this._geometryBounds,e),this._spatialQueryOperator=i,this.geometry=e,this.spatialRel=s}_setTimeFilter(t){if(this.timeExtent=this._timeOperator=null,t?.timeExtent){if(!this._serviceInfo.timeInfo){const e=new i.A("feature-layer-view:time-filter-not-available","Unable to apply time filter, as layer doesn't have time metadata.",t.timeExtent);return void D.A.getLogger("esri.views.2d.layers.features.controllers.FeatureFilter").error(e)}this.timeExtent=t.timeExtent,this._timeOperator=(0,La.I)(this._serviceInfo.timeInfo,t.timeExtent,nh.Shared)}}_applyFilter(t,e){return this._filterByGeometry(t)&&this._filterById(t)&&this._filterByTime(t)&&this._filterByExpression(t,e)}_filterByExpression(t,e){return!this.where||this._clause(t,e)}_filterById(t){return(!this._idsToHide?.size||!this._idsToHide.has(t.getObjectId()))&&(!this._idsToShow?.size||this._idsToShow.has(t.getObjectId()))}_filterByGeometry(t){if(!this.geometry)return!0;const e=t.readGeometryWorldSpace();return!!e&&this._spatialQueryOperator(e)}_filterByTime(t){return null==this._timeOperator||this._timeOperator(t)}}class ah{static minimal(t,e,s=[]){return new ah({geometryType:t,fieldsIndex:new Ko.A(s).toJSON(),featureIdInfo:{type:"object-id",fieldName:e},subtypes:null,subtypeField:null,types:null,globalIdField:null,spatialReference:null,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null})}static createFeature(t){return new ah(t)}constructor(t){let e;this._options=t,this._fieldsIndex=Ko.A.fromJSON(t.fieldsIndex),t.spatialReference&&(this._spatialReference=y.A.fromJSON(t.spatialReference)),t.outSpatialReference&&(this._outSpatialReference=y.A.fromJSON(t.outSpatialReference)),"object-id"===t.featureIdInfo.type&&(e=t.featureIdInfo.fieldName),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:e,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0,datesInUnknownTimezone:this._options.timeReferenceUnknownClient??void 0,dateFieldsTimeZone:this._options.dateFieldsTimeZone??void 0}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return"esriGeometryMultiPatch"===this._options.geometryType?"esriGeometryPolygon":this._options.geometryType}get serviceGeometryType(){return this._options.geometryType}get subtypeField(){return this._options.subtypeField}get timeInfo(){return this._options.timeInfo}get featureIdInfo(){return this._options.featureIdInfo}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get outSpatialReference(){return this._outSpatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}weakCloneWithAdditionalFields(t){return new ah({fieldsIndex:{fields:[...this._fieldsIndex.fields,...t],timeZoneByFieldName:null},geometryType:this.geometryType,globalIdField:this.globalIdField,featureIdInfo:this.featureIdInfo,spatialReference:this.spatialReference,outSpatialReference:this.outSpatialReference,subtypeField:this.subtypeField,subtypes:this._options.subtypes,timeInfo:this.timeInfo,timeReferenceUnknownClient:this.timeReferenceUnknownClient,dateFieldsTimeZone:this._options.dateFieldsTimeZone,typeIdField:this._options.typeIdField,types:this._options.types})}}class hh extends na{constructor(t,e){super(t),this.bins=new Map,this.featureCache=new Map,this.done=!1,this._store=e}reset(){this.destroy(),this.done=!1}destroy(){const t=this.subscription.tile.key.level;for(const e of this.featureCache.keys())this._store.releaseDisplayIdForObjectId(`${e}.${t}`);this.bins.clear(),this.featureCache.clear(),this.handledChunks.clear()}get tile(){return this.subscription.tile}*featuresWorldSpace(){for(const t of this.featureCache.values()){const e=t.clone();e.geometry&&(0,ro.Ch)(e.geometry,e.geometry,!1,!1,this.subscription.tile.transform),yield e}}}class ch extends aa{static async create(t,e,s,i,r,n){const o=new Ra({spatialReference:e}),a=await Promise.all(t.fields.map(async t=>ta.create(o,t))),h=t.featureFilter?await oh.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return"geohash"===t.index.type&&await(0,Jo.Nk)(e,y.A.WGS84),new ch(t,h,r,a,e,s,i,n)}constructor(t,e,s,i,r,n,o,a){super(n,o,r,i,a),this._schema=t,this._featureFilter=e,this._arcadeContextInfo=s,this._metadata=ah.createFeature({geometryType:"esriGeometryPolygon",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new Ko.A(t.fields).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,outSpatialReference:n.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}createState(t){return new hh(t,this._attributeStore)}async*applyOverrideUpdate(t){for(const t of this._sendStates.values()){t.reset();const e=new ha(t.subscription,rh.empty(this._source.metadata),!0,!1,{});yield e}}displayMap(t,e,s){const i=new Map(t.map(t=>[e(t),t])),r=[];for(const t of this._sendStates.values())for(const e of t.featuresWorldSpace()){const{objectId:t,displayId:n}=e,o=i.get(t);if(null!=o){const e=s(n,o,t);r.push(e),i.delete(t)}}return r}getDisplayFeatures(t){const e=new Set(t),s=new Set,i=[];for(const t of this._sendStates.values())for(const r of t.featuresWorldSpace())e.has(r.displayId)&&!s.has(r.objectId)&&(r.geometry&&i.push({...(0,ro.oN)(r,this._metadata.geometryType,!1,!1),displayId:r.displayId}),s.add(r.objectId));return{features:[],aggregates:i,tracks:[]}}getFeatureObjectIdsForAggregate(t){for(const e of this._sendStates.values())for(const s of e.bins.values())if(s.id===t)return Array.from(s.containedObjectIds);return[]}async*updateChunks(){for(const t of this._sendStates.values())yield*this._update(t,this._source)}forEachAggregateWorldSpace(t){const e=new Set;for(const s of this._sendStates.values())for(const i of s.featuresWorldSpace())e.has(i.objectId)||(t(i),e.add(i.objectId))}_createIndexOptions(t){switch(this._schema.index.type){case"geohash":return{type:"geohash",fields:this.aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:t.scale,sqlOptions:this._sqlOptions};case"grid":{const e=this._schema.index.fixedBinLevel,s=null!=e?t.tileInfoView.getLODInfoAt(e).scale:t.scale;return{type:"grid",fields:this.aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:s,sqlOptions:this._sqlOptions}}}}async*_update(t,e){const{handledChunks:s,subscription:i,bins:r,featureCache:n}=t,o=i.tile;if(t.done)return;for(const i of e.chunks()){if(s.has(i.chunkId))continue;s.add(i.chunkId);const e=i.queryInfo;if("tileId"in e){const t=new b.A(e.tileId);if(t.level!==o.level||t.world!==o.key.world)continue}i.getAggregateIndex(this._createIndexOptions(t.tile)).putBounded(r,t.tile.extent,t.tile.resolution)}const a=[],h=i.tile.transform,c=i.tile.key.level;for(const t of r.values()){let e=n.get(t.id);if(e)e.attributes=t.getAttributes();else{const s=t.getGeometry(this.spatialReference,h);e=new Qo.Om(s,t.getAttributes(),null,t.id),s||(e.centroid=t.getGeometricCentroid(this.spatialReference,h)),e.displayId=this._attributeStore.createDisplayIdForObjectId(`${e.objectId}.${c}`),n.set(t.id,e)}a.push(e)}this.events.emit("changed"),t.done=!e.updateTracking.updating;const l=rh.fromOptimizedFeatures(a,this._metadata,h),u=l.getCursor(),d=t.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo);for(;u.next();)this._attributeStore.setAttributeData(u.getDisplayId(),u,d,this._sqlOptions);const _=new ca(t.subscription,l,[],t.done,{});yield _}}class lh{constructor(t){this._statistics=t}get statistics(){return this._statistics}}const uh=Math.PI/180;class dh{static create(t){return new dh(t.map(t=>function(t){switch(t.statisticType){case"min":return new ph(t);case"max":return new fh(t);case"avg":return new gh(t);case"avg_angle":return new yh(t);case"sum":case"count":return new mh(t);case"mode":return new xh(t)}}(t)))}constructor(t){this._statistics=t}values(){return this._statistics.values()}insert(t,e){for(const s of this._statistics)s.insert(t,e)}merge(t){for(let e=0;e<this._statistics.length;e++){const s=this._statistics[e],i=t._statistics[e];if(s.field.name!==i.field.name)throw new Error("InternalError: Tried to merge incompatible statistics");s.merge(i)}}clone(){return new dh(this._statistics.map(t=>t.clone()))}}class _h{constructor(t){this.field=t}insert(t,e){if(!this.field.computed)return;const s=this.field.computed.read(t,e);pa(s)||this._insertValue(s)}}class ph extends _h{constructor(){super(...arguments),this.type="min",this.value=Number.MAX_VALUE}_insertValue(t){this.value=Math.min(this.value,t)}merge(t){this.value=Math.min(this.value,t.value)}clone(){const t=new ph(this.field);return t.value=this.value,t}}class fh extends _h{constructor(){super(...arguments),this.type="max",this.value=Number.MIN_VALUE}_insertValue(t){this.value=Math.max(this.value,t)}merge(t){this.value=Math.max(this.value,t.value)}clone(){const t=new fh(this.field);return t.value=this.value,t}}class mh extends _h{constructor(){super(...arguments),this.type="sum",this.value=0}_insertValue(t){this.value+=t}merge(t){this.value+=t.value}clone(){const t=new mh(this.field);return t.value=this.value,t}}class gh extends _h{constructor(){super(...arguments),this.type="avg",this._total=0,this._count=0}get value(){return this._total/this._count}_insertValue(t){this._total+=t,this._count+=1}merge(t){this._total+=t._total,this._count+=t._count}clone(){const t=new gh(this.field);return t._total=this._total,t._count=this._count,t}}class yh extends _h{constructor(){super(...arguments),this.type="avg_angle",this._x=0,this._y=0,this._count=0}get value(){const t=this._x/this._count,e=this._y/this._count,s=180/Math.PI;return Math.atan2(e,t)*s}_insertValue(t){this._x=this._x+Math.cos(t*uh),this._y=this._y+Math.sin(t*uh),this._count+=1}merge(t){this._x+=t._x,this._y+=t._y,this._count+=t._count}clone(){const t=new yh(this.field);return t._x=this._x,t._y=this._y,t._count=this._count,t}}class xh extends _h{constructor(){super(...arguments),this._frequencies=new Map}get value(){let t,e=0;for(const[s,i]of this._frequencies.entries())i>e&&(e=i,t=s);return t}_insertValue(t){const e=this._frequencies.get(t);null!=e?this._frequencies.set(t,e+1):this._frequencies.set(t,1)}merge(t){for(const[e,s]of t._frequencies.entries()){const t=this._frequencies.get(e);null!=t?this._frequencies.set(e,t+s):this._frequencies.set(e,s)}}clone(){const t=new xh(this.field);return t._frequencies=new Map(this._frequencies),t}}class bh extends lh{static createId(t,e){return`${t}.${e}`}static create(t,e,s,i){return new bh(t,e,dh.create(s),i)}constructor(t,e,s,i){super(s),this.gridX=t,this.gridY=e,this._worldUnitsPerCell=i,this._count=0,this._xWorldTotal=0,this._yWorldTotal=0,this._objectIds=new Set}get id(){return bh.createId(this.gridX,this.gridY)}get containedObjectIds(){return this._objectIds}get count(){return this._count}get firstObjectId(){return this._objectIds.values().next().value}get centroidXWorld(){return this._xWorldTotal/this._count}get centroidYWorld(){return this._yWorldTotal/this._count}clone(){const t=new bh(this.gridX,this.gridY,this._statistics.clone(),this._worldUnitsPerCell);return t._count=this._count,t._xWorldTotal=this._xWorldTotal,t._yWorldTotal=this._yWorldTotal,t._firstFeatureAttributes=this._firstFeatureAttributes,t._objectIds=new Set(this._objectIds),t}insert(t,e,s,i){0===this._count?this._firstFeatureAttributes=t.readAttributes():this._firstFeatureAttributes=null,this._count+=1,this._xWorldTotal+=s,this._yWorldTotal+=i,this._statistics.insert(t,e),this._objectIds.add(t.getObjectId())}merge(t){if(0!==t._count){this._count+=t._count,this._firstFeatureAttributes=t._firstFeatureAttributes,this._xWorldTotal+=t._xWorldTotal,this._yWorldTotal+=t._yWorldTotal,this._statistics.merge(t._statistics);for(const e of t._objectIds.values())this._objectIds.add(e)}}getCentroidX(t){return null==t?this.centroidXWorld:(0,ro.IE)(t,this.centroidXWorld)}getCentroidY(t){return null==t?this.centroidYWorld:(0,ro.B2)(t,this.centroidYWorld)}getGeometry(t,e){const s=this.gridX*this._worldUnitsPerCell,i=this.gridY*this._worldUnitsPerCell,r=new St.A([4],[s,i,s+this._worldUnitsPerCell,i,s+this._worldUnitsPerCell,i+this._worldUnitsPerCell,s,i+this._worldUnitsPerCell]);if(null!=e){const t=new St.A;return(0,ro.Nl)(t,r,!1,!1,"esriGeometryPolygon",e)}return r}getCentroid(t){const e=new St.A([],[this.centroidXWorld,this.centroidYWorld]);if(null!=t){const s=new St.A;return(0,ro.Nl)(s,e,!1,!1,"esriGeometryPoint",t)}return e}getGeometricCentroid(t,e){const s=this.gridX*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,i=this.gridY*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,r=new St.A([],[s,i]);if(null!=e){const t=new St.A;return(0,ro.Nl)(t,r,!1,!1,"esriGeometryPoint",e)}return r}getAttributes(){const t={aggregateId:this.id};for(const e of this._statistics.values())t[e.field.name]=e.value;return null!=this._firstFeatureAttributes?{...t,...this._firstFeatureAttributes}:t}}var wh=s(83047);function vh(t,{timeZone:e,timeExtent:s}){return{$view:{scale:t,timeZone:e,timeProperties:{currentStart:s?.start,currentEnd:s?.end}}}}class Ih{constructor(t){this._options=t}insert(t,e){const s=t.getCursor(),{arcadeContextInfo:i,scale:r}=this._options,n=vh(r,i);for(;s.next();)this._insertFeature(s,n,this._options.sqlOptions,e)}_insertFeature(t,e,s,i){const{featureFilter:r}=this._options;if(null!==r&&!r.check(t,s))return;let n=0,o=0;if("esriGeometryPoint"===t.geometryType)n=t.readXWorldSpace(),o=t.readYWorldSpace();else{if(i){const e=t.readCentroidForDisplay();if(null==e)return;const[s,i]=e.coords;if(s<0||s>_.CQ||i<0||i>_.CQ)return}const e=t.readCentroidWorldSpace();if(null==e)return;n=e.coords[0],o=e.coords[1]}this._insert(t,n,o,e)}}function Sh(t,e){return(0,wh.GA)(t)*wh.dy*96/e}class Ph extends Ih{constructor(t){super(t),this._cells=new Map,this._pixelsPerMapUnit=Sh(t.spatialReference,t.scale)}put(t){for(const e of this._cells.values()){const s=t.get(e.id);s?s.merge(e):t.set(e.id,e.clone())}}putBounded(t,e,s){const i=[e.xmin,e.ymin,e.xmax,e.ymax],[r,n,o,a]=i,h=Math.floor(r*this._pixelsPerMapUnit/this._options.cellSize),c=Math.floor(n*this._pixelsPerMapUnit/this._options.cellSize),l=Math.ceil(o*this._pixelsPerMapUnit/this._options.cellSize),u=Math.ceil(a*this._pixelsPerMapUnit/this._options.cellSize);for(let e=c;e<=u;e++)for(let s=h;s<=l;s++){const i=`${s}.${e}`,r=this._cells.get(i);if(!r)continue;const n=t.get(r.id);n?r&&!t.has(r.id)&&n.merge(r):t.set(r.id,r.clone())}}_insert(t,e,s,i){const r=e*this._pixelsPerMapUnit,n=s*this._pixelsPerMapUnit,o=Math.floor(r/this._options.cellSize),a=Math.floor(n/this._options.cellSize);this._getCellOrCreate(o,a).insert(t,i,e,s)}_getCellOrCreate(t,e){const s=bh.createId(t,e);let i=this._cells.get(s);if(!i){const r=1*this._options.cellSize/this._pixelsPerMapUnit;i=bh.create(t,e,this._options.fields,r),this._cells.set(s,i)}return i}}class Mh{constructor(t,e){this.inner=t,this.displayId=e}}class Ch extends na{constructor(t){super(t),this.didSend=!1,this.done=!1}}class Ah{constructor(t,e,s,i,r){this._level=t,this._scale=e,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const t of this._clusters.values())this._store.releaseDisplayIdForObjectId(t.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const t of this._clusters.values()){const e=t.inner.getCentroid(null),s=new Qo.Om(e,t.inner.getAttributes(),null,t.inner.id,t.displayId);yield s}}clusters(){return this._clusters.values()}updateChunks(t,e){let s=!1;for(const e of t){const t=e.queryInfo;"tileId"in t&&new b.A(t.tileId).level!==this._level||this._handledChunks.has(e.normalizedChunkId)||(this._handledChunks.add(e.normalizedChunkId),s=!0,e.getAggregateIndex({...this._indexOptions,scale:this._scale}).put(this._cells))}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=Sh(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:t}of e){const e=t.tile.bounds,s=Math.floor(e[0]*r/n),o=Math.floor(e[1]*r/n),a=Math.ceil(e[2]*r/n),h=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,s),i.yMin=Math.min(i.yMin,o),i.xMax=Math.max(i.xMax,a),i.yMax=Math.max(i.yMax,h)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(t){let e=!1;for(const t of this._clusters.values())t.inner.count>1&&(e=this._updateAggregateStatistics(this._statistics,t.inner)||e);if(e){const e=Array.from(this._statistics.entries()).map(([t,e])=>({fieldName:t,minValue:e.minValue,maxValue:e.maxValue}));await t.container.updateStatistics(this._level,e)}}createAggregateFeatures(t,e){const s=t.subscription,i=[],r=s.tile.transform;for(const t of this._clusters.values()){let e=t.inner.getCentroidX(r);const n=t.inner.getCentroidY(r),o=s.tile.lod,a=o.wrap?o.worldSize[0]:null,h=1===t.inner.count?t.inner.firstObjectId:t.inner.id,c=t.displayId;if(null!=a)if(1===a){const s=new St.A([],[e,n]),r=new Qo.Om(s,t.inner.getAttributes(),null,h,c);r.geometry.coords[0]-=_.CQ,i.push(r);const o=new St.A([],[e,n]),a=new Qo.Om(o,t.inner.getAttributes(),null,h,c);a.geometry.coords[0]+=_.CQ,i.push(a)}else e>_.CQ+_.CQ/2?e-=a*_.CQ:e<-256&&(e+=a*_.CQ);if(e<_.CQ+128&&e>=-128&&n<_.CQ+128&&n>=-128){const s=new St.A([],[e,n]),r=new Qo.Om(s,t.inner.getAttributes(),null,h,c);i.push(r)}}return rh.fromOptimizedFeatures(i,e,s.tile.transform)}_clusterCells(t){let e=Array.from(this._cells.values());e=e.sort((t,e)=>e.count-t.count);const s=[];for(const t of this._clusters.values())s.push(t.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/Sh(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,n=new Set;for(const s of e){if(n.has(s.id))continue;if(s.gridX<t.xMin||s.gridX>t.xMax||s.gridY<t.yMin||s.gridY>t.yMax)continue;const e=this._store.createDisplayIdForObjectId(s.id),o=new Mh(s.clone(),e);n.add(s.id),this._clusters.set(s.id,o);const a=s.centroidXWorld,h=s.centroidYWorld;for(let t=s.gridY-r;t<=s.gridY+r;t++)for(let e=s.gridX-r;e<=s.gridX+r;e++){if(t===s.gridY&&e===s.gridX)continue;const r=this._cells.get(bh.createId(e,t));if(!r||n.has(r.id))continue;const c=Math.abs(r.centroidXWorld-a),l=Math.abs(r.centroidYWorld-h);c<i&&l<i&&(o.inner.merge(r),n.add(r.id))}}for(const t of s)this._store.releaseDisplayIdForObjectId(t)}_updateAggregateStatistics(t,e){let s=!1;for(const i of e.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const e=i.value,r=i.field,n=t.get(r.name);if(n){const{minValue:t,maxValue:i}=n,r=Math.min(n.minValue,e),o=Math.max(n.maxValue,e);t===r&&i===o||(n.minValue=r,n.maxValue=o,s=!0);continue}t.set(r.name,{minValue:e,maxValue:e}),s=!0}return s}}class Th extends aa{static async create(t,e,s,i,r,n,o){const a=new Ra({spatialReference:s}),h={type:"grid",fields:await Promise.all(e.fields.map(async t=>ta.create(a,t))),spatialReference:s,featureFilter:e.featureFilter?await oh.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:e.featureFilter}):null,cellSize:e.clusterRadius/4,arcadeContextInfo:n,sqlOptions:o};return new Th(t,e.clusterRadius,h,e.fields,i,r,o)}constructor(t,e,s,i,r,n,o){super(r,n,s.spatialReference,s.fields,o),this._connection=t,this._clusterRadius=e,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=ah.createFeature({geometryType:"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new Ko.A([...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:r.metadata.spatialReference,outSpatialReference:r.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear()}onSubscribe(t){super.onSubscribe(t),this._requiredLevel=t.tile.level,this._requiredScale=t.tile.scale}createState(t){return new Ch(t)}async*applyOverrideUpdate(t){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(t,e,s){const i=new Map(t.map(t=>[e(t),t])),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const t of n.clusters()){const e=i.get(t.inner.id);if(null!=e){const n=s(t.displayId,e,t.inner.id);r.push(n),i.delete(t.inner.id);continue}if(1===t.inner.count){const{firstObjectId:e}=t.inner,n=e?i.get(e):null;if(null!=n){const o=s(t.displayId,n,e);r.push(o),i.delete(e)}}}return r}getDisplayFeatures(t){const e=new Set(t),s=new Set,i=[],r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const t of n.aggregatesWorldSpace())if(e.has(t.displayId)&&!s.has(t.displayId)){const e=(0,ro.oN)(t,this._metadata.geometryType,!1,!1);if(s.add(t.displayId),1===e.attributes.cluster_count){i.push({...e,displayId:t.displayId});continue}r.push({...e,displayId:t.displayId})}return{features:i,aggregates:r,tracks:[]}}getFeatureObjectIdsForAggregate(t){const e=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of e.clusters())if(s.inner.id===t)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(){const t=this._source.chunks();if(!t.length)return;const e=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter(t=>t.subscription.tile.level===this._requiredLevel);if(e.updateChunks(t,s)||!this._source.updateTracking.updating)for(const t of s)t.subscription.tile.level===this._requiredLevel&&(t.didSend=!1,t.done=!1);const i=Array.from(this._sendStates.values()).filter(t=>t.done).map(t=>t.subscription.tile.key),r=new Set(i);for(const t of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some(e=>e.containsChild(t.subscription.tile.key)))continue;if(t.subscription.tile.key.getChildKeys().every(t=>r.has(t)))continue}t.didSend||t.subscription.tile.level!==this._requiredLevel||(t.didSend=!0,yield*this._update(t,e,this._source))}await e.updateStatistics(this._connection)}forEachAggregateWorldSpace(t){if(null==this._requiredLevel||null==this._requiredScale)return;const e=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of e.aggregatesWorldSpace())t(s)}_getClusterState(t,e){if(null==t||null==e)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(e);return s||(s=new Ah(t,e,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(e,s)),s}async*_update(t,e,s){if(t.done)return;const i=e.createAggregateFeatures(t,this._metadata);this.events.emit("changed"),t.done=!s.updateTracking.updating;const r=i.getCursor(),n=t.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n,this._sqlOptions);const o=new ha(t.subscription,i,!0,t.done,{});yield o}}var kh=s(11006);function Fh(t,e){if(!(this instanceof Fh))return new Fh(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&("function"==typeof e?this.toBBox=e:this._initFormat(e)),this.clear()}function Eh(t,e,s){if(!s)return e.indexOf(t);for(var i=0;i<e.length;i++)if(s(t,e[i]))return i;return-1}function Rh(t,e){zh(t,0,t.children.length,e,t)}function zh(t,e,s,i,r){r||(r=Yh(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(var n,o=e;o<s;o++)n=t.children[o],Oh(r,t.leaf?i(n):n);return r}function Oh(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Lh(t,e){return t.minX-e.minX}function Dh(t,e){return t.minY-e.minY}function Gh(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Nh(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Bh(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function qh(t,e){var s=Math.max(t.minX,e.minX),i=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),n=Math.min(t.maxY,e.maxY);return Math.max(0,r-s)*Math.max(0,n-i)}function Wh(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Uh(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Yh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function jh(t,e,s,i,r){for(var n,o=[e,s];o.length;)(s=o.pop())-(e=o.pop())<=i||(n=e+Math.ceil((s-e)/i/2)*i,(0,kh.q)(t,n,e,s,r),o.push(e,n,n,s))}Fh.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,s=[],i=this.toBBox;if(!Uh(t,e))return s;for(var r,n,o,a,h=[];e;){for(r=0,n=e.children.length;r<n;r++)o=e.children[r],Uh(t,a=e.leaf?i(o):o)&&(e.leaf?s.push(o):Wh(t,a)?this._all(o,s):h.push(o));e=h.pop()}return s},collides:function(t){var e=this.data,s=this.toBBox;if(!Uh(t,e))return!1;for(var i,r,n,o,a=[];e;){for(i=0,r=e.children.length;i<r;i++)if(n=e.children[i],Uh(t,o=e.leaf?s(n):n)){if(e.leaf||Wh(t,o))return!0;a.push(n)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,s=t.length;e<s;e++)this.insert(t[e]);return this}var i=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var r=this.data;this.data=i,i=r}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},insert:function(t){return null!=t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=Yh([]),this},remove:function(t,e){if(null==t)return this;for(var s,i,r,n,o=this.data,a=this.toBBox(t),h=[],c=[];o||h.length;){if(o||(o=h.pop(),i=h[h.length-1],s=c.pop(),n=!0),o.leaf&&-1!==(r=Eh(t,o.children,e)))return o.children.splice(r,1),h.push(o),this._condense(h),this;n||o.leaf||!Wh(o,a)?i?(s++,o=i.children[s],n=!1):o=null:(h.push(o),c.push(s),s=0,i=o,o=o.children[0])}return this},toBBox:function(t){return t},compareMinX:Lh,compareMinY:Dh,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var s=[];t;)t.leaf?e.push.apply(e,t.children):s.push.apply(s,t.children),t=s.pop();return e},_build:function(t,e,s,i){var r,n=s-e+1,o=this._maxEntries;if(n<=o)return Rh(r=Yh(t.slice(e,s+1)),this.toBBox),r;i||(i=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,i-1))),(r=Yh([])).leaf=!1,r.height=i;var a,h,c,l,u=Math.ceil(n/o),d=u*Math.ceil(Math.sqrt(o));for(jh(t,e,s,d,this.compareMinX),a=e;a<=s;a+=d)for(jh(t,a,c=Math.min(a+d-1,s),u,this.compareMinY),h=a;h<=c;h+=u)l=Math.min(h+u-1,c),r.children.push(this._build(t,h,l,i-1));return Rh(r,this.toBBox),r},_chooseSubtree:function(t,e,s,i){for(var r,n,o,a,h,c,l,u;i.push(e),!e.leaf&&i.length-1!==s;){for(l=u=1/0,r=0,n=e.children.length;r<n;r++)h=Gh(o=e.children[r]),(c=Bh(t,o)-h)<u?(u=c,l=h<l?h:l,a=o):c===u&&h<l&&(l=h,a=o);e=a||e.children[0]}return e},_insert:function(t,e,s){var i=this.toBBox,r=s?t:i(t),n=[],o=this._chooseSubtree(r,this.data,e,n);for(o.children.push(t),Oh(o,r);e>=0&&n[e].children.length>this._maxEntries;)this._split(n,e),e--;this._adjustParentBBoxes(r,n,e)},_split:function(t,e){var s=t[e],i=s.children.length,r=this._minEntries;this._chooseSplitAxis(s,r,i);var n=this._chooseSplitIndex(s,r,i),o=Yh(s.children.splice(n,s.children.length-n));o.height=s.height,o.leaf=s.leaf,Rh(s,this.toBBox),Rh(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(s,o)},_splitRoot:function(t,e){this.data=Yh([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Rh(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,s){var i,r,n,o,a,h,c,l;for(h=c=1/0,i=e;i<=s-e;i++)o=qh(r=zh(t,0,i,this.toBBox),n=zh(t,i,s,this.toBBox)),a=Gh(r)+Gh(n),o<h?(h=o,l=i,c=a<c?a:c):o===h&&a<c&&(c=a,l=i);return l},_chooseSplitAxis:function(t,e,s){var i=t.leaf?this.compareMinX:Lh,r=t.leaf?this.compareMinY:Dh;this._allDistMargin(t,e,s,i)<this._allDistMargin(t,e,s,r)&&t.children.sort(i)},_allDistMargin:function(t,e,s,i){t.children.sort(i);var r,n,o=this.toBBox,a=zh(t,0,e,o),h=zh(t,s-e,s,o),c=Nh(a)+Nh(h);for(r=e;r<s-e;r++)n=t.children[r],Oh(a,t.leaf?o(n):n),c+=Nh(a);for(r=s-e-1;r>=e;r--)n=t.children[r],Oh(h,t.leaf?o(n):n),c+=Nh(h);return c},_adjustParentBBoxes:function(t,e,s){for(var i=s;i>=0;i--)Oh(e[i],t)},_condense:function(t){for(var e,s=t.length-1;s>=0;s--)0===t[s].children.length?s>0?(e=t[s-1].children).splice(e.indexOf(t[s]),1):this.clear():Rh(t[s],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};class Vh{static fromReader(t){const e=[],s=t.copy(),i=(0,sa.vt)();for(;s.next();)s.getBounds(i)&&e.push(s.getIndex());const r=Fh(9,t=>(s.setIndex(t),{minX:s.getBoundsXMin(),minY:s.getBoundsYMin(),maxX:s.getBoundsXMax(),maxY:s.getBoundsYMax()}));return r.load(e),new Vh(r)}constructor(t){this._index=t}search(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this._index.search(e)}}var Xh=s(79258);function Hh(t,e,s,i){if(i.isWebMercator){const i=(0,Xs.KJ)(t/Xh.$O.radius),r=i-360*Math.floor((i+180)/360),n=[0,0];return Zh(n,0,(0,Xs.KJ)(Math.PI/2-2*Math.atan(Math.exp(-e/Xh.$O.radius))),r,s),n}const r=(0,Jo.Cv)({x:t,y:e},i,y.A.WGS84);if(!r)return null;const n=[0,0];return Zh(n,0,r.y,r.x,s),n}function Zh(t,e,s,i,r){r%2&&(r+=1);let n=0,o=0,a=-90,h=90,c=-180,l=180;for(let t=0;t<r/2;t++){for(let e=0;e<5;e++){const s=(c+l)/2,r=i>s?1:0;n|=r<<29-(e+5*t),c=(1-r)*c+r*s,l=(1-r)*s+r*l}for(let e=0;e<5;e++){const i=(a+h)/2,r=s>i?1:0;o|=r<<29-(e+5*t),a=(1-r)*a+r*i,h=(1-r)*i+r*h}}t[2*e]=n,t[2*e+1]=o}(0,io.vt)(),(0,io.vt)();class $h extends lh{static create(t,e,s,i){const r=dh.create(t),n=new Array(32);for(let t=0;t<n.length;t++)n[t]=null;return new $h(r,e,s,i,n)}constructor(t,e,s,i,r){super(t),this.xNode=e,this.yNode=s,this.depth=i,this.children=r,this._objectIds=new Set,this._count=0,this._xWorldTotal=0,this._yWorldTotal=0,this._xGeohashTotal=0,this._yGeohashTotal=0,this.next=null}get id(){return`${this.xNode}.${this.yNode}`}get containedObjectIds(){return this._objectIds}get count(){return this._count}clone(){const t=new $h(this._statistics.clone(),this.xNode,this.yNode,this.depth,this.children);return t._count=this._count,t._xWorldTotal=this._xWorldTotal,t._yWorldTotal=this._yWorldTotal,t._xGeohashTotal=this._xGeohashTotal,t._yGeohashTotal=this._yGeohashTotal,t.next=this.next,t._objectIds=new Set(this._objectIds),t}insert(t,e,s,i,r,n){this._count+=1,this._xWorldTotal+=e,this._yWorldTotal+=s,this._xGeohashTotal+=i,this._yGeohashTotal+=r,this._statistics.insert(t,n),this._objectIds.add(t.getObjectId())}merge(t){if(0!==t._count){this._count+=t._count,this._xWorldTotal+=t._xWorldTotal,this._yWorldTotal+=t._yWorldTotal,this._xGeohashTotal+=t._xWorldTotal,this._yGeohashTotal+=t._yWorldTotal,this._statistics.merge(t._statistics);for(const e of t._objectIds.values())this._objectIds.add(e)}}getCentroid(t){throw new Error("getCentroid not supported for GeohashNode")}getGeometry(t,e){const s=this._getLngLatBounds(),[i,r,n,o]=s,a=(0,Jo.Cv)({rings:[[[i,r],[i,o],[n,o],[n,r],[i,r]]]},y.A.WGS84,t),h=(0,ro.Ye)(new St.A,a,!1,!1);return null!=e?(0,ro.Nl)(new St.A,h,!1,!1,"esriGeometryPolygon",e,!1,!1):h}getGeometricCentroid(t,e){const s=this._getLngLatBounds(),[i,r,n,o]=s,a=(0,Jo.Cv)({x:(i+n)/2,y:(r+o)/2},y.A.WGS84,t),h=(0,ro.qN)(new St.A,a);return null!=e?(0,ro.Nl)(new St.A,h,!1,!1,"esriGeometryPoint",e,!1,!1):h}getAttributes(){const t={aggregateId:this.id};for(const e of this._statistics.values())t[e.field.name]=e.value;return t.aggregateCount=this._count,t}find(t,e,s,i,r,n){if(i>=s)return this;const o=1-i%2,a=3*o+2*(1-o),h=2*o+3*(1-o),c=30-r-a,l=30-n-h,u=((t&7*o+3*(1-o)<<c)>>c)+((e&3*o+7*(1-o)<<l)>>l)*(8*o+4*(1-o)),d=this.children[u];return null==d?null:d.find(t,e,s,i+1,r+a,n+h)}_getLngLatBounds(){const t=this.depth,e=Math.ceil(t/2),s=Math.floor(t/2),i=30-(3*e+2*s),r=30-(2*e+3*s);return function(t,e){let s=-90,i=90,r=-180,n=180;for(let o=0;o<e;o++){const e=Math.ceil((o+1)/2),a=Math.floor((o+1)/2),h=1-o%2,c=30-(3*e+2*a),l=30-(2*e+3*a),u=2*h+3*(1-h),d=(7*h+3*(1-h)<<c&t.geohashX)>>c,_=(3*h+7*(1-h)<<l&t.geohashY)>>l;for(let t=3*h+2*(1-h)-1;t>=0;t--){const e=(r+n)/2,s=d&1<<t?1:0;r=(1-s)*r+s*e,n=(1-s)*e+s*n}for(let t=u-1;t>=0;t--){const e=(s+i)/2,r=_&1<<t?1:0;s=(1-r)*s+r*e,i=(1-r)*e+r*i}}return[r,s,n,i]}({geohashX:this.xNode<<i,geohashY:this.yNode<<r},this.depth)}}class Qh{constructor(t){this._fields=t,this._size=0,this._depth=0,this._root=$h.create(this._fields,0,0,0)}destroy(){}get size(){return this._size}get depth(){return this._depth}find(t,e,s){return this._root.find(t,e,s,0,0,0)}insert(t,e,s,i,r,n,o){let a=this._root,h=0,c=0,l=0;for(;null!==a;){if(a.insert(t,e,s,i,r,o),h>=n)return;const u=Math.ceil((h+1)/2),d=Math.floor((h+1)/2),_=1-h%2,p=30-(3*u+2*d),f=30-(2*u+3*d),m=(i&7*_+3*(1-_)<<p)>>p,g=(r&3*_+7*(1-_)<<f)>>f,y=m+g*(8*_+4*(1-_));c=c<<3*_+2*(1-_)|m,l=l<<2*_+3*(1-_)|g,null==a.children[y]&&(a.children[y]=$h.create(this._fields,c,l,h+1),this._depth=Math.max(this._depth,h+1),this._size+=1),h+=1,a=a.children[y]}}putBins(t,e){for(const s of this.getNodes(e)){const e=t.get(s.id);e?e.merge(s):t.set(s.id,s.clone())}}getNodes(t){const e=[],{geohashBounds:s,level:i}=t;let r=this._root;for(;null!==r;){const t=r.depth,n=r.xNode,o=r.yNode;if(t>=i){e.push(r),r=r.next;continue}const a=Math.ceil((t+1)/2),h=Math.floor((t+1)/2),c=1-t%2,l=30-(3*a+2*h),u=30-(2*a+3*h),d=~((1<<l)-1),_=~((1<<u)-1),p=(s.xLL&d)>>l,f=(s.yLL&_)>>u,m=(s.xTR&d)>>l,g=(s.yTR&_)>>u,y=n<<3*c+2*(1-c),x=o<<2*c+3*(1-c),b=y+8*c+4*(1-c),w=x+4*c+8*(1-c),v=Math.max(y,p),I=Math.max(x,f),S=Math.min(b,m),P=Math.min(w,g);let M=null,C=null;for(let t=I;t<=P;t++)for(let e=v;e<=S;e++){const s=e-y+(t-x)*(8*c+4*(1-c)),i=r.children[s];i&&(M||(M=i,M.next=r.next),C&&(C.next=i),C=i,i.next=r.next)}r=M||r.next}return e}}class Jh extends Ih{constructor(t){super(t),this._tree=new Qh(this._options.fields)}put(t){throw new Error("Geohash tree does not support put")}putBounded(t,e,s){const{geohashLevel:i,spatialReference:r}=this._options,n=function(t,e,s,i){const r=[t.xmin,t.ymin,t.xmax,t.ymax],n=yi.A.fromExtent((0,H.w1)(r,i)),o=(0,Jo.Cv)(n,i,y.A.WGS84,{densificationStep:64*e});if(!o)return null;const a=(0,ro.Ye)(new St.A,o,!1,!1),h=a.coords.filter((t,e)=>!(e%2)),c=a.coords.filter((t,e)=>e%2),l=Math.min(...h),u=Math.min(...c),d=Math.max(...h),_=Math.max(...c),p=Hh(l,u,s,y.A.WGS84),f=Hh(d,_,s,y.A.WGS84);return p&&f?{bounds:r,geohashBounds:{xLL:p[0],yLL:p[1],xTR:f[0],yTR:f[1]},level:s}:null}(e,s,i,r);null!=n&&this._tree.putBins(t,n)}_insert(t,e,s,i){const{geohashLevel:r,spatialReference:n}=this._options,o=Hh(e,s,r,n);o&&this._tree.insert(t,e,s,o[0],o[1],r,i)}}var Kh=s(69397);class tc extends ih{static from(t,e){if(t instanceof this){const s=new Set(e),i=t._indices.filter(t=>s.has(t));return new tc(t._reader,i)}return new tc(t.copy(),e)}constructor(t,e){super(t.metadata),this._currentIndex=-1,this._displayTransform=null,this._reader=t,this._indices=e}setTransformForDisplay(t){const e=this._reader.getInTransform();if(null==e)return void(this._displayTransform=(0,qa.Q1)(t));const s=(0,qa.Q1)(e),i=(0,qa.Q1)(t),[r,n]=s.scale,[o,a]=s.translate,[h,c]=i.scale,[l,u]=i.translate,d=r/h,_=n/c,p=(o-l)/h,f=(a-u)/c;this._displayTransform={originPosition:"lowerLeft",scale:[1/d,1/_,1,1],translate:[-p/d,-f/_,0,0]}}getInTransform(){return this._reader.getInTransform()}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){const t=new tc(this._reader.copy(),this._indices);return t._currentIndex=this._currentIndex,t._displayTransform=this._displayTransform,t._processorAttributes=this._processorAttributes,t}get contextTimeZone(){return this._reader.contextTimeZone}set contextTimeZone(t){this._reader.contextTimeZone=t}get usedMemory(){return Kh.qK+this._reader.usedMemory}setProcessorAttributes(t){this._processorAttributes=Object.assign(this._processorAttributes??{},t)}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}readXForDisplay(){return this._displayTransform?(0,qa.IE)(this._displayTransform,this._reader.readXForDisplay()):this._reader.readXForDisplay()}readYForDisplay(){return this._displayTransform?(0,qa.B2)(this._displayTransform,this._reader.readYForDisplay()):this._reader.readYForDisplay()}readGeometryForDisplay(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform):this._reader.readGeometryForDisplay()}readCentroidForDisplay(){const t=this._reader.readCentroidForDisplay()?.clone();if(t){const[e,s]=t.coords;this._displayTransform?(t.coords[0]=(0,qa.IE)(this._displayTransform,e),t.coords[1]=(0,qa.B2)(this._displayTransform,s)):(t.coords[0]=e,t.coords[1]=s)}return t}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}readAttribute(t,e=!1){const s=this._reader.readAttribute(t,e);return null==s&&this._processorAttributes?this._processorAttributes[t]:s}readAttributes(){return{...this._processorAttributes??{},...this._reader.readAttributes()}}joinAttributes(t){return this._reader.joinAttributes(t)}getBounds(t){return this._reader.getBounds(t)}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(t){return this._reader.setDisplayId(t)}setIndex(t){return this._reader.setIndex(t)}getIndex(){return this._reader.getIndex()}readXWorldSpace(){return this._reader.readXWorldSpace()}readYWorldSpace(){return this._reader.readYWorldSpace()}_readX(){return this._reader.readXForDisplay()}_readY(){return this._reader.readYForDisplay()}_readServerCentroid(){return this._reader._readServerCentroid()}readLegacyFeatureForDisplay(){const t=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(t&&{x:t.coords[0],y:t.coords[1]})??null}}readLegacyGeometryForDisplay(){const t=this.readGeometryForDisplay();return(0,ro.zv)(t,this.geometryType,!1,!1)}readGeometryArea(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform)?.area()??0:this._reader.readGeometryArea()}readGeometryWorldSpace(){return this._reader.readGeometryWorldSpace()}_readGeometry(){return this._reader._readGeometry()}_readAttribute(t,e){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}_readAttributes(){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(t){return this._reader.field(t)}hasField(t){return this._reader.hasField(t)}setField(t,e){return this._reader.setField(t,e)}keys(){return this._reader.keys()}castToText(t=!1){return this._reader.castToText(t)}}class ec{size(){return this.reader.getSize()}get fields(){return this.reader.fields}invalidate(){this._aggregateIndex=null,this._aggregateIndexHash=null,this._spatialIndex=null}registerOverrides(t){this.reader.registerOverrides(t),this.invalidate()}queryFeaturesInBounds(t){const e=this._getSpatialIndex().search(t);return tc.from(this.reader,e)}getAggregateIndex(t){const e=JSON.stringify(t);if(e!==this._aggregateIndexHash){switch(this._aggregateIndexHash=e,t.type){case"grid":this._aggregateIndex=new Ph(t);break;case"geohash":this._aggregateIndex=new Jh(t)}this._aggregateIndex.insert(this.reader,this.isTiled)}return this._aggregateIndex}_getSpatialIndex(){return this._spatialIndex||(this._spatialIndex=Vh.fromReader(this.reader)),this._spatialIndex}}class sc{constructor(){this.modified=[],this.removed=[]}modify(t){this.modified.push(t)}remove(t){this.removed.push(t)}get isEmpty(){return 0===this.modified.length&&0===this.removed.length}}class ic extends ec{constructor(t){super(),this._reader=t,this.chunkId="override",this.normalizedChunkId="override"}static fromFeatures(t,e){const s=rh.fromOptimizedFeatures(t,e);return new ic(s)}get reader(){return this._reader}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}getTileReader(t){if(!this._reader.getSize())return null;const e=this.queryFeaturesInBounds(t.bounds);return e.setTransformForDisplay(t.transform),e}}class rc{constructor(t,e){this.inner=t,this.isWeak=e,this.lastWeak=null}get isStrong(){return!this.isWeak}}class nc{constructor(){this._overrides=new Map,this._update=new sc,this._lastCleanup=0}hasOverride(t){return this._overrides.has(t)}onChunkInsert(t){if(this._overrides.size){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId(),s=this._overrides.get(t);if(s?.lastWeak&&(s.lastWeak=null),s?.isWeak){const t=e.readOptimizedFeatureWorldSpace();s.inner=t,this._update.modify(t),this.invalidate()}}}t.registerOverrides(this)}apply(t,e){const{updateWeak:s,removeWeak:i,update:r,remove:n,release:o}=t.commands;this.invalidate();for(const t of s){const e=new rc(t,!0),s=this._overrides.get(t.objectId);s?.isStrong?s.lastWeak=e:(this._overrides.set(t.objectId,e),this._update.modify(t))}for(const t of r){const e=new rc(t,!1),s=this._overrides.get(t.objectId);e.lastWeak=s?.isWeak?s:s?.lastWeak??null,this._overrides.set(t.objectId,e),this._update.modify(t)}for(const t of i){const e=new rc(null,!0),s=this._overrides.get(t);s?.isStrong?s.lastWeak=e:(this._overrides.set(t,e),this._update.remove(t))}for(const t of n){const e=new rc(null,!1),s=this._overrides.get(t);e.lastWeak=s?.isWeak?s:s?.lastWeak??null,this._overrides.set(t,e),this._update.remove(t)}if(o.length){const t=new Set;for(const e of o){const s=this._overrides.get(e);s?.lastWeak?(this._overrides.set(e,s.lastWeak),null==s.lastWeak.inner?this._update.remove(e):this._update.modify(s.lastWeak.inner)):s&&!s.isWeak&&(this._overrides.delete(e),t.add(e))}e.forEachUnsafe(e=>{const s=e.getObjectId();t.has(s)&&(this._update.modify(e.readOptimizedFeatureWorldSpace()),t.delete(s))});for(const e of t.values())this._update.remove(e)}}clearWeakOverrides(){for(const[t,e]of this._overrides.entries())e.isWeak&&this._overrides.delete(t);this.invalidate()}cleanup(t){if(this._overrides.size<1e4)return;const e=performance.now();if(e-this._lastCleanup<1e3)return;this._lastCleanup=e;const s=this._getWeakDeletions();if(!(s.size<1e4)){for(const e of t){const t=e.reader.withoutOverrides().getCursor();for(;t.next();){const e=t.getObjectId();s.delete(e)}}for(const t of s)this._overrides.delete(t);s.size&&this.invalidate()}}takeOverrideUpdate(){const t=this._update;return t.isEmpty?null:(this._update=new sc,t)}asChunk(t){if(!this._chunk){const e=[];for(const t of this._overrides.values())null!=t.inner&&e.push(t.inner);this._chunk=ic.fromFeatures(e,t)}return this._chunk}invalidate(){this._chunk=null}putWeakObjectIdsFromGlobalIds(t,e,s){for(const[i,r]of this._overrides.entries()){if(r.isWeak&&null!=r.inner){const n=r.inner.attributes[s];n&&e.has(n)&&!t.has(n)&&t.set(n,i);continue}if(null!=r.lastWeak&&null!=r.lastWeak.inner){const n=r.lastWeak.inner.attributes[s];n&&e.has(n)&&!t.has(n)&&t.set(n,i)}}}_getWeakDeletions(){const t=new Set;for(const[e,s]of this._overrides.entries())s.isWeak&&null==s.inner&&t.add(e);return t}}class oc extends na{}class ac extends oa{constructor(t,e,s,i){super(t,e,i),this._arcadeContextInfo=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(t){this.handledChunksForAttributeData.clear(),this._arcadeContextInfo=t,null!=this._evalOptions&&(this._evalOptions=vh(this._evalOptions.$view.scale,t))}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.createArcadeEvaluationOptions(this._arcadeContextInfo)}createState(t){return new oc(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const i=new Map(t.map(t=>[e(t),t])),r=[];for(const t of this._source.chunks()){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId(),n=e.getDisplayId(),o=i.get(t);if(null!=o){const e=s(n,o,t);r.push(e),i.delete(t)}}}return r}getDisplayFeatures(t){const e=new Set(t),s=new Set,i=[];for(const t of this._source.chunks()){const r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId(),n=r.getDisplayId();e.has(n)&&!s.has(t)&&(i.push({...r.readLegacyFeatureWorldSpace(),displayId:n}),s.add(t))}}return{features:i,aggregates:[],tracks:[]}}async*applyOverrideUpdate(t){const e=[];for(const s of t.modified){const t=this._attributeStore.createDisplayIdForObjectId(s.objectId);s.displayId=t,e.push(t)}const s=rh.fromOptimizedFeatures(t.modified,this._source.metadata).getCursor();for(;s.next();)this._attributeStore.setAttributeData(s.getDisplayId(),s,this._evalOptions,this._sqlOptions);const i=[];for(const e of t.removed){const t=this._attributeStore.getDisplayIdForObjectId(e);null!=t&&i.push(t)}(0,n.A)("esri-2d-update-debug")&&console.debug("FeatureUpdateStrategy.applyLocalEdit",{message:t,modifiedDisplayIds:e,removedDisplayIds:i});const r=ic.fromFeatures(t.modified,this._source.metadata);this.handledChunks.add(r.chunkId),this.handledChunksForAttributeData.add(r.chunkId),this.handledChunksForIdCreation.add(r.chunkId);for(const t of this._sendStates.values())t.handledChunks.add(r.chunkId),yield new ca(t.subscription,null,e,!1,r.queryInfo);for(const t of this._sendStates.values()){const e=r.getTileReader(t.subscription.tile);yield new ca(t.subscription,e,i,!1,r.queryInfo)}for(const e of t.removed)this._attributeStore.releaseDisplayIdForObjectId(e)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}afterUpdateChunks(){for(const t of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(t);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(t):this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}async _updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions,this._sqlOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const i of this._source.chunks()){const{chunkId:r}=i;if(s.has(r)||!this.handledChunksForIdCreation.has(r)||!this.handledChunksForAttributeData.has(r))continue;s.add(r);const n=i.getTileReader(e.tile);n&&(yield new ha(t.subscription,n,!1,i.end,i.queryInfo))}}}var hc=s(77085),cc=s(5808),lc=s(17136),uc=s(89056);let dc;class _c{constructor(t,e,s,i,r){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=i,this.time=r}}class pc{static getOid(t){return ot.xq+t}constructor(t,e,s,i,r,n,o,a){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=i,this._fields=r,this._spatialReference=n,this._metadata=o,this._isStream=a,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new St.A}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes??{},aggregateId:this.objectId,[ot.EA]:0};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}stageObservation(t,e){this._nextObservationRecords.push(new _c(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e){const s=new Set(this._nextObservationRecords.map(t=>t.objectId)),i=this._observationRecords.filter(t=>!s.has(t.objectId)).map(t=>t.objectId);let r,n;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort((t,e)=>{const s=t.time,i=e.time;return null!=s&&null!=i?s-i:0}),this._schema.timeField){case"startTimeField":r=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":r=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":r=this._isStream?ot.Aw:null}n=this._isStream?e?.end??Date.now():e?.end??-1/0;const o=t.map(t=>t.reader.getCursor());let a;for(let t=this._nextObservationRecords.length-1;t>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);t--){const e=this._nextObservationRecords[t],s=o[e.chunkIndex];(0,f.Lw)(s),s.setIndex(e.featureIndex);const i=null!=r?s.readAttributeAsTimestamp(r):null;(null!=i?n-i:0)>=this._maxDisplayDuration||(this._commitObservation(e,s),a??=e)}if(null!=a){const{chunkIndex:t,featureIndex:e,objectId:s,displayId:i}=a,r=o[t];(0,f.Lw)(r),r.setIndex(e);const n=new Qo.Om(r.readGeometryWorldSpace(),{...r.readAttributes(),[ot.EA]:1},null,s,i);this._latestObservationFeature=n}else this._latestObservationFeature=null;return this._trackLineGeometry=function(t,e,s){if(e.length<2)return(0,ro.eU)(t,[e],!1,!1);if(s.isWrappable){let i=!1;for(let t=1;t<e.length;t++){const r=e[t][0],n=(0,lc.O7)(r,e[t-1][0],s);r!==n&&(e[t][0]=n,i=!0)}if(i){const i=(0,uc.b3)({paths:[e],spatialReference:s});if(null!=i)return(0,ro.eU)(t,i.paths,!1,!1)}return(0,ro.eU)(t,[e],!1,!1)}const i=dc.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),r=dc.fromSpatialReference(s);if(null!=r){const e=(0,hc.g7)(i,1e6,r,cc.O.geodesic);if(null!=e){const s=dc.toGeometry(e,r);if(null!=s&&"paths"in s)return(0,ro.eU)(t,s.paths,!1,!1)}}return(0,ro.eU)(t,[e],!1,!1)}(this._trackLineGeometry,this._trackLinePath,this._spatialReference),this._bounds=function(t){const{lengths:e,coords:s}=t;if(!e.length)return[(0,H.Ie)()];const i=[];let r=0;for(let t=0;t<e.length;t++){const n=e[t],o=(0,H.Ie)();i.push(o);for(let t=0;t<n;t++){const e=s[2*(t+r)],i=s[2*(t+r)+1];(0,H.tK)(o,[e,i])}r+=n}return i}(this._trackLineGeometry),this._nextObservationRecords=[],i}updateStatistics(t,e){this._statistics=dh.create(this._fields);const s=t.map(t=>t.reader.getCursor());for(const{chunkIndex:t,featureIndex:i}of this._observationRecords){const r=s[t];(0,f.Lw)(r),r.setIndex(i),this._statistics.insert(r,e)}}overlapsTile(t){for(const e of this._bounds)if((0,H.$9)(e,t.bounds,32))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:i,attributes:r}=this._latestObservationFeature,n=new St.A;(0,ro.Nl)(n,i,!1,!1,this._metadata.geometryType,t.subscription.tile.transform);const o=(0,H.fA)(1/0,1/0,-1/0,-1/0);return function(t,e){const{coords:s,lengths:i}=t;if(!i.length)return void e(s[0],s[1]);let r=0;for(let t=0;t<i.length;t++){const n=i[t];let o=0,a=0;for(let t=0;t<n;t++)o+=s[2*(t+r)],a+=s[2*(t+r)+1],e(o,a);r+=n}}(n,(t,e)=>(0,H.tK)(o,[t,e])),(0,H.HY)(o,(0,H.fA)(0,0,_.CQ,_.CQ))?new Qo.Om(n,r,null,e,s):null}getTrackLineFeatureForTile(t){const e=new St.A;return(0,ro.Nl)(e,this._trackLineGeometry,!1,!1,"esriGeometryPolyline",t.subscription.tile.transform),new Qo.Om(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new Qo.Om(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:(0,ro.zv)(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let i=s?.coords[0],r=s?.coords[1];null==s&&(i=e.readXWorldSpace(),r=e.readYWorldSpace()),null!=i&&null!=r&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([i,r]))}}class fc extends na{constructor(t){super(t),this.done=!1}}class mc extends aa{static async create(t,e,i,r,n,o){const a=new Ra({spatialReference:e}),h=await Promise.all(t.fields.map(async t=>ta.create(a,t))),c=t.featureFilter?await oh.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||(0,hc.s1)()||await Promise.all([Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299),s.e(8125)]).then(s.bind(s,78125)),Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299)]).then(s.bind(s,83299)),(0,hc.Hh)()]).then(([t,e,s])=>{dc={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}}),new mc(t,i,r,e,h,c,n,o)}constructor(t,e,s,i,r,n,o,a){super(e,s,i,r,a),this._schema=t,this._featureFilter=n,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:ot.EA,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=ah.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:ot.EA,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){const t=new Set(this._source.chunks().map(t=>t.chunkId));for(const e of t)if(!this._handledChunks.has(e))return!0;for(const e of this._handledChunks)if(!t.has(e))return!0;return!1}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new fc(t)}async*applyOverrideUpdate(t){D.A.getLogger("esri.views.2d.layers.features.processor.TrackStrategy").error("Applying override to tracks is not supported")}displayMap(t,e,s){const i=new Map(t.map(t=>[e(t),t])),r=[];for(const t of this._tracks.values()){const e=i.get(t.objectId);if(null!=e){const n=s(t.displayId,e,t.objectId);r.push(n),i.delete(t.objectId);continue}for(const e of t.observations()){const t=i.get(e.objectId);if(null!=t){const n=s(e.displayId,t,e.objectId);r.push(n),i.delete(e.objectId)}}}return r}getDisplayFeatures(t){const e=new Set(t),s=[],i=[],r=this._source.chunks().map(t=>t.reader.getCursor());for(const t of this._tracks.values()){e.has(t.displayId)&&i.push(t.getTrackLineDisplayFeature());for(const{displayId:i,chunkIndex:n,featureIndex:o}of t.observations())if(e.has(i)){const t=r[n];t.setIndex(o),s.push({displayId:i,attributes:{},...t.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:i}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),t=>t.objectId);return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let i=0;i<t.length;i++){const r=t[i];this._handledChunks.add(r.chunkId);const n=r.reader.getCursor();for(;n.next();){const t=n.readAttribute(e),r=n.getObjectId();if(null!=t&&null!=r&&(null===this._featureFilter||this._featureFilter.check(n,this._sqlOptions))){if(n.getDisplayId()||n.setDisplayId(this._attributeStore.createDisplayIdForObjectId(r)),!this._tracks.has(t)){const e=pc.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),i=new pc(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,i)}this._tracks.get(t).stageObservation(i,n),s.add(t)}}}for(const e of this._tracks.values())if(s.has(e.trackId)){const s=e.commitObservations(t,this._featureFilter?.timeExtent);for(const t of s)this._attributeStore.releaseDisplayIdForObjectId(t);e.updateStatistics(t,vh(1,this._arcadeContextInfo))}else this._removeTrack(e)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e)}*_update(t){if(t.done)return;t.done=!this._source.updateTracking.updating;const e=[],s=[];for(const i of this._tracks.values())if(i.length>0){if(this._schema.showLatestObservation){const s=i.getLatestObservationFeatureForTile(t);null!=s&&e.push(s)}this._schema.showTrackLine&&i.overlapsTile(t.subscription.tile)&&s.push(i.getTrackLineFeatureForTile(t))}const i=rh.fromOptimizedFeatures(e,this._metadata,t.subscription.tile.transform),r=rh.fromOptimizedFeatures(s,this._trackLineMetadata,t.subscription.tile.transform);let n=[];if(this._schema.showPreviousObservations){const e=this._source.chunks().map(()=>[]);for(const t of this._tracks.values())for(const{chunkIndex:s,featureIndex:i}of t.previousObservations())e[s].push(i);n=this._source.chunks().map((s,i)=>{const r=s.getTileReader(t.subscription.tile);if(null==r)return null;const n=tc.from(r,e[i]);return n.setProcessorAttributes({[ot.EA]:2}),"esriGeometryPoint"!==n.geometryType&&null!=n.getInTransform()||n.setTransformForDisplay(t.subscription.tile.transform),n}).filter(Oo.Ru)}this.events.emit("changed");const o=t.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),a=r.getCursor();for(;a.next();)this._attributeStore.setAttributeData(a.getDisplayId(),a,o,this._sqlOptions);for(const t of n){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,o,this._sqlOptions)}const h=i.getCursor();for(;h.next();)this._attributeStore.setAttributeData(h.getDisplayId(),h,o,this._sqlOptions);yield new ha(t.subscription,r,!1,!1,{});for(const e of n)yield new ha(t.subscription,e,!1,!1,{});yield new ha(t.subscription,i,!1,t.done,{})}}s(62298);new Map;class gc{constructor(t){this.data=t,this._referenceCount=0}increment(){this._referenceCount+=1}decrement(){this._referenceCount-=1}empty(){return 0===this._referenceCount}}class yc{constructor(){this._freeIdsGenerationA=[],this._freeIdsGenerationB=[],this._idCounter=1,this._freeIds=this._freeIdsGenerationA,this._objectIdToDisplayId=new Map}createIdForObjectId(t){let e=this._objectIdToDisplayId.get(t);return e?e.increment():(e=new gc((0|this._getFreeId())>>>0),e.increment(),this._objectIdToDisplayId.set(t,e)),e.data}releaseIdForObjectId(t){const e=this._objectIdToDisplayId.get(t);e&&(e.decrement(),e.empty()&&(this._objectIdToDisplayId.delete(t),this._freeIds.push(e.data)))}getDisplayIdForObjectId(t){const e=this._objectIdToDisplayId.get(t);return null!=e?e.data:null}releaseAll(){for(const t of this._objectIdToDisplayId.values())this._freeIds.push(t.data);this._objectIdToDisplayId.clear()}incrementGeneration(){this._freeIds=this._freeIds===this._freeIdsGenerationA?this._freeIdsGenerationB:this._freeIdsGenerationA}_getFreeId(){return this._freeIds.length?this._freeIds.pop():this._idCounter++}}const xc=()=>D.A.getLogger("esri.views.layers.2d.features.support.AttributeStore"),bc=(xc(),()=>null),wc=(0,n.A)("esri-shared-array-buffer");(0,n.A)("esri-atomics");class vc{constructor(t,e,s){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:i,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=i,this.layout=r,this._resetRange(),this.size=t,this.isLocal=s,n||(this.data=this._initData(i,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const s=this.data;for(let i=0;i<this.size*this.size;i++)s[i*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const s=this.data;for(let i=0;i<this.size*this.size;i++)s[i*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,s){const i=this.data;for(const r of s)i[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,s){this.data[s*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)}unsetComponentTexel(t,e,s){this.data[s*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)}getData(t,e){const s=ua(t);return this.data[s*this.texelSize+e]}setData(t,e,s){const i=ua(t),r=1<<e;0!==(this.layout&r)?null!=this.data&&(this.data[i*this.texelSize+e]=s,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)):xc().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),s=this.data;e.set(s),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,s=this.texelSize;if(t>e)return null;this._resetRange();const i=!this.isLocal,r=this.pixelType,n=this.layout,o=this.data;return{start:t,end:e,data:i&&o.slice(t*s,(e+1)*s)||null,pixelType:r,layout:n}}_initData(t,e){const s=ArrayBuffer,r=function(t){switch(t){case 5121:return Uint8Array;case 32819:return Uint16Array;case 5126:return Float32Array;default:return void D.A.getLogger("esri.views.2d.engine.webgl.Utils").error(new i.A("webgl-utils",`Unable to handle type ${t}`))}}(t),n=new r(new s(e*e*4*r.BYTES_PER_ELEMENT));for(let t=0;t<n.length;t+=4)n[t+1]=255;return n}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class Ic{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=_.TB,this._idsToHighlight=new Map,this._arcadeDependencies=new Set,this._initialized=!1,this.version=0,this._idGenerator=new yc,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=5126;bc(`Creating AttributeStore ${wc?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:5121,layout:1},{pixelType:5121,layout:15,textureOnly:!0},{pixelType:5121,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:5126,layout:15}],this._blocks=this._blockDescriptors.map(()=>null)}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}getDisplayIdForObjectId(t){return this._idGenerator.getDisplayIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}releaseAllIds(){this._idGenerator.releaseAll()}async update(t,e,s,i=0){const r=(0,g.Ui)(this._schema,t);if(this.version=i,r&&((0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStore.update`,{changed:r}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map(t=>t?oh.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:s.outSpatialReference,filterJSON:t}):null))),"multi"!==t.type)this._attributeComputeInfo={type:"feature",map:new Map},await Promise.all(t.bindings.map(async t=>{const s=await this._bind(e,t);this._updateReferences(s)}));else{this._attributeComputeInfo={type:"multi",keyField:t.keyField,map:new Map};for(const s in t.bindings){const i=t.bindings[s];await Promise.all(i.map(async t=>{const i=await this._bind(e,t,parseInt(s,10));this._updateReferences(i)}))}}}setHighlight(t,e){let s=null;0===t.length&&0===e.length&&(s=this._getBlock(0),s.unsetComponentAllTexels(0,(1<<_.U5)-1));for(const{displayId:e,highlightFlags:i}of t){if(null==e||-1===e)continue;s||(s=this._getBlock(0),s.unsetComponentAllTexels(0,(1<<_.U5)-1));const t=ua(e);s.setComponent(0,i,[t])}this._idsToHighlight.clear();for(const{objectId:e,highlightFlags:s}of t)this._idsToHighlight.set(e,s);for(const{objectId:t,highlightFlags:s}of e)this._idsToHighlight.set(t,s)}setData(t,e,s,i){const r=ua(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,s,i)}getData(t,e,s){return this._getBlock(e).getData(t,s)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=ua(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,s,i){const r=ua(t);this._ensureSizeForTexel(r),this._getBlock(0).setData(r,0,this.getFilterFlags(e,i));const n=this._attributeComputeInfo;let o=null;n&&(o="multi"===n.type?n.map.get(e.readAttribute(n.keyField)):n.map,o?.size&&o.forEach((t,i)=>{const n=1*i%4,o=Math.floor(1*i/4),a=this._getBlock(o+3);let h=t.field?.read(e,s);t.valueRepresentation&&(h=function(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}(h,t.valueRepresentation)),(null===h||isNaN(h)||h===1/0||h===-1/0)&&(h=1e-30),a.setData(r,n,h)}))}get epoch(){return this._epoch}sendUpdates(){const t=this._blocks.map(t=>null!=t?t.toMessage():null),e=this._getInitArgs();(0,n.A)("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch}),this._epoch+=1,(0,n.A)("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,s){const i=await t.createComputedField(e),{valueRepresentation:r}=e,n=this._attributeComputeInfo;if("multi"===n.type){const t=n.map.get(s)??new Map;t.set(e.binding,{field:i,valueRepresentation:r}),n.map.set(s,t)}else n.map.set(e.binding,{field:i,valueRepresentation:r});return i}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(1),this._getBlock(2),this._getBlock(7),{blockSize:this._size,blockDescriptors:this._blocks.map(t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null)})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;bc(`Initializing AttributeBlock at index ${t}`);const s=new vc(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=s,this._initialized=!1,s}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;bc("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return xc().error(new i.A("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}_updateReferences(t){(0,Lo.QY)(this._arcadeDependencies,t)}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<_.U5)}getFilterFlags(t,e){let s=0;for(let i=0;i<this._filters.length;i++){const r=!!(1<<i),n=this._filters[i];s|=(!r||null==n||n.check(t,e)?1:0)<<i}let i=0;if(this._idsToHighlight.size){const e=t.getObjectId();i=this.getHighlightFlags(e)}return s<<_.U5|i}}class Sc{constructor(t,e){this._connection=t,this._source=e,this._version=1,this._registry=new Xo,this._proxy=new bt({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e)}),this._attributeStore=new Ic({isLocal:!1,update:t=>(0,u.oV)(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get version(){return this._version}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[],tracks:[]}}getDisplayIds(t){const e={};return this._strategy?(this._strategy.displayMap(t,t=>t,(t,s,i)=>{e[i]=t}),e):e}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}requiresInvalidation(){return this._strategy?.requiresInvalidation()??!1}async update(t,e,s,i,r){const o=t.processor,a=(0,m.i8)(this._schema?.storage,o.storage),h=(0,m.i8)(this._schema?.mesh.properties,o.mesh.properties),c=(0,m.i8)(this._schema?.mesh.factory,o.mesh.factory),l=(0,m.i8)(this._schema?.mesh.strategy,o.mesh.strategy),u=function(t,e){const s=[];return t?.timeExtent?.start===e.timeExtent?.start&&t?.timeExtent?.end===e.timeExtent?.end||s.push("timeProperties"),s}(this._schema?.expressionProperties,o.expressionProperties),d=u.some(t=>this._attributeStore.hasArcadeDependency(t)),_=u.some(t=>this._factory?.hasArcadeDependency(t)??!1),p=u.some(t=>this._strategy?.hasArcadeDependency(t))||this._strategy?.isAggregate&&d,f=_||p,x=h||c||l;if(!(a||x||_||d||p||i))return!1;(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:(0,g.Ui)(this._schema,o),schema:o}),this._schema=o;const b=y.A.fromJSON(this._source.service.outSpatialReference),w=new Ra({fields:this._source.metadata.fieldsIndex,spatialReference:b}),v={currentUser:o.mesh.properties.currentUser};if((a||x||d)&&(await this._attributeStore.update(o.storage,w,this._source.metadata,e),this._strategy?.invalidateAttributeData(Pc(o))),!i&&!x&&!f)return!1;(l||h||f)&&await this._updateStrategy(o.mesh.strategy,b,r,Pc(o),v),this._updateSortKey(w,"sortKey"in o.mesh.properties?o.mesh.properties.sortKey:null);const I="dictionary"===o.mesh.factory.symbology.type?o.mesh.factory.symbology.fieldMap:null,S=new Ho(w,this._proxy,s,this._registry,I);return(c||"dictionary"===o.mesh.factory.symbology.type)&&(this._factory=await gt.create(S,o.mesh.factory)),this._version=e,!0}async applyOverrideUpdate(t){if(!this._strategy)return;const e=this._strategy.applyOverrideUpdate(t);for await(const t of e)try{await this._process(t)}catch(t){}}async updateChunks(){await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(t.map(({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1})),t);const e=this._strategy.displayMap(t,({objectId:t})=>t,(t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e}));this._attributeStore.setHighlight(e,t)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(){if(!this._strategy)return;const t=this._strategy.updateChunks(),e=[],s=new Map;for await(const i of t){let t=s.get(i.id);null==t&&(t=new $o({concurrency:16,process:t=>this._process(t)}),s.set(i.id,t));const r=t.push(i).catch(t=>(0,a.jH)(t));e.push(r)}try{await Promise.all(e)}catch(t){}(0,n.A)("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),(0,n.A)("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s,i,r){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new ac(this._source,this._attributeStore,i,r);break;case"binning":this._strategy=await ch.create(t,e,this._source,this._attributeStore,i,r);break;case"cluster":this._strategy=await Th.create(this._connection,t,e,this._source,this._attributeStore,i,r);break;case"track":this._strategy=await mc.create(t,e,this._source,this._attributeStore,i,r)}for(const t of s)this._strategy.onSubscribe(t)}async _updateSortKey(t,e){if(this._sortInfo=(0,f.pR)(this._sortInfo?.computed),null!=e){const s=e.byRenderer?null:await t.createComputedField(e);this._sortInfo={...e,computed:s}}}async _process(t){const e=t.subscription;if((0,n.A)("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process`)}const s={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(t,s),(0,a.Te)(e.signal);const i=await this._write(t,e.tile.createArcadeEvaluationOptions(Pc(this._schema)),s),r=e.tile.tileInfoView.getLODInfoAt(e.tile.key);(0,a.Te)(e.signal);const{message:o,transferList:h}=i.serialize(r),c={objectIdMap:null,inner:t.createMessage(o,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){c.objectIdMap={};const e=t.reader?.getCursor();if(e)for(;e.next();)c.objectIdMap[e.getDisplayId()]=e.getObjectId()}if((0,a.Te)(e.signal),await this._connection.container.onMessage(c,{signal:e.signal,transferList:h}),this._attributeStore.sendUpdates(),(0,n.A)("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process.await`)}}async _fetchResources(t,e){await this._fetchMatcherResources(t),await this._fetchWriterResources(t,e)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t,e){if(!t.reader)return;const s=t.reader.getCursor(),i=t.subscription.tile.createArcadeEvaluationOptions(Pc(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,i,e);await this._proxy.fetchEnqueuedResources()}async _write(t,e,s){const i=t.subscription.tile,r=t.reader?.getCursor(),n=r?.getSize()??0,o=i.tileInfoView.tileInfo.isWrappable,h=i.tileInfoView.tileInfo.spatialReference.isWGS84,c=new rt(i.key,this._strategy.enablePixelBuffering,o,h,n);if(!r)return c;const l=i.createArcadeEvaluationOptions(Pc(this._schema));let u=0;for(;r.next();){++u%1e3||(await(0,a.Pl)(0),(0,a.Te)(t.subscription));const n=this._getSortKeyValue(r,e);c.entityStart(r.getDisplayId(),n),this._factory.write(c,this._proxy,r,l,s,i.level),c.entityEnd()}return c}_getSortKeyValue(t,e){if(!this._sortInfo)return 0;const{computed:s,order:i,byRenderer:r}=this._sortInfo,n=r?this._factory.getSortKey(t,e):s?.read(t,e);return null==n||isNaN(n)?0:n*("asc"===i?-1:1)}}function Pc(t){const{timeZone:e}=t?.mesh.properties??{},{timeExtent:s}=t?.expressionProperties??{};return{timeZone:e,timeExtent:s}}var Mc=s(78888),Cc=s(80893),Ac=s(7562);class Tc{static from(t){let e=0,s=0,i=0;return t.forEach(t=>{const r=t._readGeometry();r&&(s+=r.isPoint?1:r.lengths.reduce((t,e)=>t+e,0),i+=r.isPoint?1:r.lengths.length,e+=1)}),new Tc(e,s,i)}constructor(t,e,s){this.featureCount=t,this.vertexCount=e,this.ringCount=s}toJSON(){return{featureCount:this.featureCount,ringCount:this.featureCount,vertexCount:this.featureCount}}}var kc=s(60694),Fc=s(41560),Ec=s(64272);class Rc{static fromSchema(t,e,s){const i="feature"===e.type?e.mutable.dataFilter.queryScaleRanges:[],r=e.mutable.displayFilterInfo;return new Rc(function(t,e,s){const i=function(t){switch(t.type){case"object-id":case"unique-id-simple":return`${t.fieldName} ASC`;case"unique-id-composite":return`${t.fieldNames.join(",")} ASC`}}(s.featureIdInfo),r=t.source,n={returnCentroid:!(null!==r&&"object"==typeof r&&"path"in r&&(0,kc.Wo)(r.path))&&"esriGeometryPolygon"===s.serviceGeometryType,returnGeometry:!0,timeReferenceUnknownClient:s.timeReferenceUnknownClient??void 0,outSpatialReference:y.A.fromJSON(t.outSpatialReference),orderByFields:"memory"===t.type?[]:[i],where:e.mutable.dataFilter.definitionExpression??"1=1",outFields:e.mutable.availableFields,multipatchOption:"esriGeometryMultiPatch"===s.serviceGeometryType?"xyFootprint":null};if("feature"===e.type){const{gdbVersion:t,historicMoment:s,timeExtent:i}=e.mutable.dataFilter;return{...n,gdbVersion:t,historicMoment:s?new Date(s):null,timeExtent:i?Ec.T.fromJSON(i):null,outFields:e.mutable.availableFields}}return n}(t,e,s),r,i,s.subtypeField,e.mutable.dataFilter.customParameters,s.geometryType,t.queryMetadata)}constructor(t,e,s,i,r,n,o){this._queryParams=t,this._displayFilter=e,this._queryScaleRanges=s,this._subtypeField=i,this._customParameters=r,this._geometryType=n,this._queryMetadata=o}get pageSize(){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support paged queries");const t=this._queryMetadata.supportsMaxRecordCountFactor?4:null,e=(this._queryMetadata.maxRecordCount??8e3)*(t??1);return Math.min(8e3,e)}get objectIdsQueryPageSize(){return this._queryMetadata?.maxRecordCount??2e3}updateHistoricMoment(t){this._queryParams.historicMoment=t}updateFields(t){this._queryParams.outFields=t}createPatchFieldsQuery(t,e,s){if(!e.getSize())return null;const i=t.clone();if("*"===this._queryParams.outFields[0]){if("*"===(i.outFields??[])[0])return null;i.outFields=this._queryParams.outFields}else{const t=new Set(this._queryParams.outFields),s=[];for(const i of t)e.hasField(i)||s.push(i);if(0===s.length)return null;i.outFields=s}i.returnGeometry=!1,i.returnCentroid=!1,i.quantizationParameters=null,i.cacheHint=!0;const r={inner:i,customParameters:this._customParameters};if((0,n.A)("esri-tiles-debug")&&null!=s){const t=s.chunkId.toString().replaceAll("/",".");r.customParameters=r.customParameters?{...r.customParameters,chunkId:t}:{chunkId:t}}return r}createQuery(t={}){if(!this._queryParams)throw new Error("InternalError: queryInfo should be defined");return{inner:new Da.A({...this._queryParams,...t}),customParameters:this._customParameters}}createTileQuery(t,e){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support tile queries");const s=this.createQuery(e),i=s.inner;if(this._queryScaleRanges.length){const e=this._queryScaleRanges.filter(e=>(!e.minScale||e.minScale>=t.maxScale)&&(!e.maxScale||e.maxScale<=t.minScale)).map(t=>t.subtypeCode);if(e.length){const t=`${this._subtypeField} IN (${e})`;i.where=(0,Ma.mA)(i.where,t)}}if(this._displayFilter&&(i.where=(0,Ma.mA)(i.where,(0,Fc.Ch)(this._displayFilter,t.minScale,t.maxScale))),i.quantizationParameters=e.quantizationParameters??t.getQuantizationParameters(),i.resultType="tile",i.geometry=t.extent,this._queryMetadata.supportsQuantization?"esriGeometryPolyline"===this._geometryType&&(i.maxAllowableOffset=t.resolution*(0,n.A)("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==this._geometryType&&"esriGeometryPolygon"!==this._geometryType||(i.maxAllowableOffset=t.resolution,"esriGeometryPolyline"===this._geometryType&&(i.maxAllowableOffset*=(0,n.A)("feature-polyline-generalization-factor"))),i.defaultSpatialReferenceEnabled=this._queryMetadata.supportsDefaultSpatialReference,i.compactGeometryEnabled=this._queryMetadata.supportsCompactGeometry,this._queryMetadata.supportsMaxRecordCountFactor&&(i.maxRecordCountFactor=4),(0,n.A)("esri-tiles-debug")){const e=t.id.replaceAll("/",".");s.customParameters=s.customParameters?{...s.customParameters,tileId:e}:{tileId:e}}return s}createPagedTileQuery(t,e){const s=this.pageSize;return this.createTileQuery(t,{start:s*e,num:s,returnExceededLimitFeatures:!0})}createPagedQuery(t,e){const s=this.pageSize;return this.createQuery({start:s*t,num:s,returnExceededLimitFeatures:!0,maxRecordCountFactor:4,quantizationParameters:e,cacheHint:!0})}createObjectIdsQuery(t){return this.createQuery({objectIds:t,outFields:["*"]})}}let zc=class extends R.A{constructor(t){super(),this._connection=t,this._enabledEventTypes=new Set,this._updateInfo={websocket:0,client:0},this._lastTime=performance.now(),this._queuedCommands=[],this.addHandles([(0,c.wB)(()=>this._strategy?.connectionStatus??"disconnected",t=>{this._layerView.setProperty({propertyName:"pipelineConnectionStatus",value:t})},{initial:!0}),(0,c.wB)(()=>this._strategy?.errorString||null,t=>this._layerView.setProperty({propertyName:"pipelineErrorString",value:t}),{initial:!0})])}destroy(){this._strategy=null,this.removeAllHandles()}get _layerView(){return this._connection.layerView}set strategy(t){null==this._strategy&&this._resetUpdateInfo(performance.now());const e="event-handles";this.removeHandles(e),null!=t&&(this.addHandles([t.events.on("data-received",t=>this._onFeature(t)),t.events.on("message-received",t=>this._onWebSocketMessage(t)),t.events.on("features-updated",t=>this._onUpdate(t)),t.events.on("tick",()=>this._onTick())],e),this._queuedCommands.forEach(e=>e(t)),this._queuedCommands=[]),this._strategy=t}updateCustomParameters(t){null!=t&&this._callOrEnqueue(e=>e.updateCustomParameters(t))}sendMessageToSocket(t){this._callOrEnqueue(e=>e.sendMessageToSocket(t))}sendMessageToClient(t){this._callOrEnqueue(e=>e.sendMessageToClient(t))}enableEvent(t,e){e?this._enabledEventTypes.add(t):this._enabledEventTypes.delete(t)}disconnect(){this._strategy?.disconnect()}connect(){this._strategy?.connect()}clear(){this._strategy?.clear()}_onWebSocketMessage(t){this._enabledEventTypes.has("message-received")&&this._layerView.emitEvent({name:"message-received",event:t})}_onFeature(t){this._updateInfo.websocket++,this._enabledEventTypes.has("data-received")&&this._layerView.emitEvent({name:"data-received",event:{attributes:t.attributes,centroid:t.centroid,geometry:t.geometry}})}_onUpdate(t){this._updateInfo.client+=t}_onTick(){const t=performance.now(),e=t-this._lastTime;if(e>2500){const s=Math.round(this._updateInfo.client/(e/1e3)),i=Math.round(this._updateInfo.websocket/(e/1e3));this._resetUpdateInfo(t),this._layerView.emitEvent({name:"update-rate",event:{client:s,websocket:i}})}}_resetUpdateInfo(t){this._lastTime=t,this._updateInfo.client=0,this._updateInfo.websocket=0}_callOrEnqueue(t){null!=this._strategy?t(this._strategy):this._queuedCommands.push(t)}};(0,E.Cg)([(0,L.MZ)()],zc.prototype,"_strategy",void 0),zc=(0,E.Cg)([(0,G.$)("esri.views.2d.layers.features.sources.StreamMessenger")],zc);var Oc=s(13069);class Lc extends ec{constructor(t,e,s,i){super(),this._reader=t,this._queryJSON=e,this._page=s,this._end=i,this.chunkId=`${this._page}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(t){const e=this.queryFeaturesInBounds(t.bounds);return e.setTransformForDisplay(t.transform),e}}class Dc{constructor(t,e,s,r){this.store=t,this.queryInfo=e,this._options=s,this._fetch=r,this._nextBatch=new Set,this._fetchFeatures=(0,a.sg)(async()=>{if(0===this._nextBatch.size||this._options.signal?.aborted)return;const t=Array.from(this._nextBatch);this._nextBatch.clear(),t.length>8e3&&D.A.getLogger("esri.views.2d.layers.FeatureLayerView2D").warn(new i.A("highlight-too-many-features","highlight is limited to 8000 features on large layers configured with a display filter to avoid performance issues"));const e=this.queryInfo.objectIdsQueryPageSize,s=Math.ceil(8e3/e),r=Math.min(s,Math.ceil(t.length/e)),n=Array.from({length:r},(s,i)=>{const r=i*e,n=Math.min(r+e,t.length);return{num:i,query:this.queryInfo.createObjectIdsQuery(t.slice(r,n))}});try{await async function(t,e,s,r={}){const n=(await Promise.allSettled(s.map(s=>async function(t,e,s,i={}){const r=`${t.chunkPrefix??""}${s.num}`,n=await t.fetch(s.query,i,{chunkId:r}),o=new Lc(n,s.query.inner.toJSON(),s.num,!1);o.chunkId=o.normalizedChunkId=r,(0,a.Te)(i),e.insert(o)}(t,e,s,r)))).filter(t=>"rejected"===t.status).map(t=>t.reason);if(n.length)throw new i.A("featurelayer-query","Encountered errors when downloading data",{errors:n})}({chunkPrefix:"cache."+(0,Oc.lk)(),fetch:this._fetch},this.store,n,this._options)}catch(t){}})}prepareCacheUpdate(t,e){if(e)for(const t of e)this._nextBatch.delete(t);for(const e of t)this._nextBatch.add(e)}applyCacheUpdate(){return 0===this._nextBatch.size||this._options.signal?.aborted?null:this._fetchFeatures().catch(()=>{})}}class Gc{constructor(t){this._store=t,this._controller=new AbortController}destroy(){this._controller.abort()}get _options(){return{signal:this._controller.signal}}get _signal(){return this._controller.signal}unsafeSetQueryHistoricMoment(t){throw new Error("InternalError: LoadStrategy does not support query info")}async queryByObjectId(t){throw new Error("InternalError: LoadStrategy does not support fetching")}async addParquetFile(t){throw new Error("InternalError: LoadStrategy does not support loading blobs")}prepareCacheUpdate(t,e){}applyCacheUpdate(){return null}}var Nc=s(10382),Bc=s(75321),qc=s(51624),Wc=s(53655);const Uc=268435455;class Yc{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.idFieldIndices=[],this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}}const jc=268435455,Vc=128e3,Xc={small:{delta:new Int32Array(128),decoded:new Int32Array(128)},small64:{delta:new Float64Array(0),decoded:new Float64Array(0)},large:{delta:new Int32Array(Vc),decoded:new Int32Array(Vc)},large64:{delta:new Float64Array(0),decoded:new Float64Array(0)}};function Hc(t,e){return e?t<=Xc.small64.delta.length?Xc.small64:(t<=Xc.large64.delta.length||(Xc.large64.delta=new Float64Array(Math.round(1.25*t)),Xc.large64.decoded=new Float64Array(Math.round(1.25*t))),Xc.large64):t<=Xc.small.delta.length?Xc.small:(t<=Xc.large.delta.length||(Xc.large.delta=new Int32Array(Math.round(1.25*t)),Xc.large.decoded=new Int32Array(Math.round(1.25*t))),Xc.large)}function Zc(t){for(;t.next();){if(1===t.tag())return t.getMessage();t.skip()}return null}function $c(t,e,s,i,r,n){return.5*Math.abs(t*i+s*n+r*e-t*n-s*e-r*i)}function Qc(t,e,s,i,r){return!!t&&0===e*r-i*s&&e*i+s*r>0}class Jc extends ih{static fromBuffer(t,e,s=!1){const r=e.geometryType,n=function(t){try{const e=2,s=new qc.A(new Uint8Array(t),new DataView(t));for(;s.next();){if(s.tag()===e)return Zc(s.getMessage());s.skip()}}catch(t){const e=new i.A("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:t});D.A.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(e)}return null}(t),o=function(t,e,s,i=!1){const r=t.asUnsafe(),n=r.pos(),o=new Yc;let a=0,h=0,c=null,l=!1;const u=[];for(;r.next();)switch(r.tag()){case 12:c=r.processMessage(Wc.ae);break;case 9:if(o.exceededTransferLimit=r.getBool(),o.exceededTransferLimit){o.offsets.geometry=i?new Float64Array(8e3):new Int32Array(8e3),o.centroid=i?new Float64Array(16e3):new Int32Array(16e3);for(let t=0;t<o.centroid.length;t++)o.centroid[t]=Uc}break;case 13:{const t=r.processMessage(Wc.cn);t.index=a++,u.push(t);break}case 15:{const t=r.getLength(),s=r.pos()+t;if(!o.exceededTransferLimit){const t=o.offsets.geometry,e=o.centroid;t.push(0),e.push(Uc),e.push(Uc)}!l&&o.exceededTransferLimit&&(l=!0,o.offsets.attributes=i?new Float64Array(8e3*a):new Uint32Array(8e3*a));let n=h*a;for(;r.pos()<s&&r.next();)switch(r.tag()){case 1:{l?o.offsets.attributes[n++]=r.pos():o.offsets.attributes.push(r.pos());const t=r.getLength();r.skipLen(t);break}case 2:if(e){const t=r.getLength(),e=r.pos()+t;for(;r.pos()<e&&r.next();)switch(r.tag()){case 3:{r.getUInt32();const t=r.getSInt64(),e=r.getSInt64();o.centroid[2*h]=t,o.centroid[2*h+1]=e;break}default:r.skip()}}else{o.offsets.geometry[h]=r.pos();const t=r.getLength();o.vertexCount+=t,r.skipLen(t)}break;case 4:{const t=r.getLength(),e=r.pos()+t;for(;r.pos()<e&&r.next();)switch(r.tag()){case 3:{r.getUInt32();const t=r.getSInt64(),e=r.getSInt64();o.centroid[2*h]=t,o.centroid[2*h+1]=e;break}default:r.skip()}break}default:r.skip()}h++,o.hasFeatures=!0;break}default:r.skip()}o.fields=new Ko.A(u),o.featureCount=h,o.fieldCount=a;const d=function*(t){switch(t.type){case"object-id":case"unique-id-simple":return void(yield t.fieldName);case"unique-id-composite":return void(yield*t.fieldNames)}}(s);return o.idFieldIndices=Array.from(d,t=>o.fields.get(t)?.index),o.transform=c,o.displayIds=new Uint32Array(o.featureCount),o.groupIds=new Uint16Array(o.featureCount),r.move(n),o}(n,"esriGeometryPoint"===r,e.featureIdInfo,s);return new Jc(n,o,e,s)}constructor(t,e,s,i){super(s),this._use64Bit=i,this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0},this._parseCaches=new Array,this._geometryType=s.geometryType,this._reader=t,this._header=e,this._hasNext=e.hasFeatures,this._isPoints="esriGeometryPoint"===s.geometryType}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return!1}get hasM(){return!1}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(t){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._featureIndex=t}getAttributeHash(){let t="";for(const e of this._header.fields.fields)t+=this._readAttributeAtIndex(e.index)+".";return t}getObjectId(){if(1===this._header.idFieldIndices.length)return this._readAttributeAtIndex(this._header.idFieldIndices[0]);const t=this._header.idFieldIndices.map(t=>this._readAttributeAtIndex(t));return JSON.stringify(t)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(t){this._header.displayIds[this._featureIndex]=t}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){const t=this._reader.clone(),e=new Jc(t,this._header,this.metadata,this._use64Bit);return this.copyInto(e),e}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}get usedMemory(){return Kh.qK+(this._cache.geometry?.usedMemory??0)}_readX(){return this._header.centroid[2*this._featureIndex]}_readY(){return this._header.centroid[2*this._featureIndex+1]}_readServerCentroid(){const t=this._header.centroid[2*this._featureIndex],e=this._header.centroid[2*this._featureIndex+1];return t===jc?null:new St.A([],[t,e])}_readGeometry(t=!1){if(void 0===this._cache.geometry){let e=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===jc)return null;const t=this._header.centroid[2*this._featureIndex],s=this._header.centroid[2*this._featureIndex+1];e=new St.A([],[t,s])}else{const s=this._header.offsets.geometry[this._featureIndex],i=this._reader;if(0===s)return null;i.move(s);try{e=t?this._parseGeometryForDisplay(i):this._parseGeometry(i)}catch(t){return null}}return 0===e?.coords.length&&(e=null),this._cache.geometry=e,e}return this._cache.geometry}_readAttribute(t,e){const s=this._header.fields.get(t);if(null==s)return;const i=this._readAttributeAtIndex(s.index),r=this._header.fields.isDateField(s.name);return e?null==i?i:r?new Date(i):i:i}_readAttributes(){const t={};for(const e of this._header.fields.fields)t[e.name]=this._readAttributeAtIndex(e.index);return t}copyInto(t){super.copyInto(t),t._featureIndex=this._featureIndex,t._featureOffset=this._featureOffset,t._hasNext=this._hasNext,t._parseCaches=this._parseCaches}_readAttributeAtIndex(t){let e=this._parseCaches[t];if(e||(e=new Ya(this.getSize()),this._parseCaches[t]=e),e.has(this._featureIndex))return e.get(this._featureIndex);const s=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+t],i=this._reader;i.move(s);const r=function(t){const e=t.getLength(),s=t.pos()+e;for(;t.pos()<s&&t.next();)switch(t.tag()){case 1:return t.getString();case 2:return t.getFloat();case 3:return t.getDouble();case 4:return t.getSInt32();case 5:return t.getUInt32();case 6:return t.getInt64();case 7:return t.getUInt64();case 8:return t.getSInt64();case 9:return t.getBool();default:return t.skip(),null}return null}(i);return e.set(this._featureIndex,r),r}_readGeometryDeltaDecoded(t=!1){if(void 0===this._cache.unquantGeometry){const e=this._readGeometry(t);if(!e)return this._cache.unquantGeometry=void 0,null;if(!this.getInTransform())return this._cache.unquantGeometry=e,e;const s=Hc(e.coords.length,this._use64Bit).decoded,i=e.clone(s),r=i.coords;let n=0;for(const t of i.lengths){for(let e=1;e<t;e++){const t=2*(n+e),s=2*(n+e-1);r[t]+=r[s],r[t+1]+=r[s+1]}n+=t}return this._cache.unquantGeometry=i,i}return this._cache.unquantGeometry}_parseGeometry(t){const e=t.asUnsafe(),s=e.getLength(),i=e.pos()+s,r=[],n=[];for(;e.pos()<i&&e.next();)switch(e.tag()){case 2:{const t=e.getUInt32(),s=e.pos()+t;for(;e.pos()<s;)n.push(e.getUInt32());break}case 3:{const t=e.getUInt32(),s=e.pos()+t;for(r.push(e.getSInt64()),r.push(e.getSInt64()),this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64();e.pos()<s;)r.push(e.getSInt64()),r.push(e.getSInt64()),this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64();break}default:e.skip()}return new St.A(n,r)}_parseGeometryForDisplay(t){const e=t.asUnsafe(),s=e.getLength(),i=e.pos()+s,r=[],n=[];let o=0,a=0,h=null,c=0;const l="esriGeometryPolygon"===this.geometryType,u="esriGeometryPolyline"===this.geometryType,d=l||u;for(;e.pos()<i&&e.next();)switch(e.tag()){case 2:{const t=e.getUInt32(),s=e.pos()+t;for(;e.pos()<s;){const t=e.getUInt32();r.push(t),o+=t}h=Hc(2*o,this._use64Bit).delta;break}case 3:{e.getUInt32();const t=2+(this.hasZ?1:0)+(this.hasM?1:0);(0,f.Lw)(h);for(const s of r)if(a+t*s>h.length)for(let t=0;t<s;t++)e.getSInt64(),e.getSInt64(),this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64();else if(l){const t=this.getAreaSimplificationThreshold(s,this._header.vertexCount);let i=2,r=1;const o=!1;let l=e.getSInt64(),u=e.getSInt64();h[a++]=l,h[a++]=u,this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64();let _=e.getSInt64(),p=e.getSInt64();for(this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64();i<s;){let s=e.getSInt64(),n=e.getSInt64();this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64();const o=l+_,f=u+p;$c(l,u,o,f,o+s,f+n)>=t?(c+=-.5*(o-l)*(f+u),r>1&&Qc(d,h[a-2],h[a-1],_,p)?(h[a-2]+=_,h[a-1]+=p):(h[a++]=_,h[a++]=p,r++),l=o,u=f):(s+=_,n+=p),_=s,p=n,i++}r<3||o?a-=2*r:(c+=-.5*(l+_-l)*(u+p+u),Qc(d,h[a-2],h[a-1],_,p)?(h[a-2]+=_,h[a-1]+=p,n.push(r)):(h[a++]=_,h[a++]=p,n.push(++r)))}else{let t=0,i=e.getSInt64(),r=e.getSInt64();this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64(),h[a++]=i,h[a++]=r,t+=1;for(let n=1;n<s;n++){const s=e.getSInt64(),o=e.getSInt64(),l=i+s,u=r+o;c+=-.5*(l-i)*(u+r),this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64(),n>2&&Qc(d,h[a-2],h[a-1],s,o)?(h[a-2]+=s,h[a-1]+=o):(h[a++]=s,h[a++]=o,t+=1),i=l,r=u}n.push(t)}break}default:e.skip()}return this._cache.area=c,n.length?new St.A(n,h):null!=h?this._createDeltaQuantizedExtrudedGeometry(h[0],h[1]):null}}class Kc{constructor(t,e){this.service=t,this._metadata=e}destroy(){}}class tl extends Kc{constructor(t,e){super(t,e),this._portsOpen=async function(t){const e=new Nc.A;return await e.open(t,{}),e}(t.source).then(t=>this.client=t)}destroy(){this.client.close(),this.client=null}async executeQuery(t,e){await this._portsOpen;const s=await this.client.invoke("queryFeatures",t.toJSON(),e);return rh.fromFeatureSet(s,this._metadata)}}class el extends Kc{async executeQuery(t,e){const{data:s}=await(0,Cc.kS)(this.service.source,t,e),i=!t.quantizationParameters;return Jc.fromBuffer(s,this._metadata,i)}}class sl extends Kc{async executeQuery(t,e){const{source:s,queryMetadata:i}=this.service;if(null!=t.quantizationParameters&&!i.supportsQuantization){const i=t.clone(),r=(0,qa.VV)(i.quantizationParameters);i.quantizationParameters=null;const{data:n}=await(0,Cc.eW)(s,i,this._metadata.spatialReference,e),o=(0,ro.q3)(n,this._metadata.featureIdInfo);return(0,ro.jH)(r,o),rh.fromOptimizedFeatureSet(o,this._metadata)}const{data:r}=await(0,Cc.eW)(s,t,this._metadata.spatialReference,e);return"esriGeometryPoint"===this._metadata.geometryType&&(r.features=r.features?.filter(t=>{if(null!=t.geometry){const e=t.geometry;return Number.isFinite(e.x)&&Number.isFinite(e.y)}return!0})),rh.fromFeatureSet(r,this._metadata)}}class il extends Kc{async executeQuery(t,e){if(t.quantizationParameters&&!this.service.queryMetadata.supportsQuantization){const s=t.clone(),i=(0,qa.VV)(s.quantizationParameters);s.quantizationParameters=null;const r=await(0,Bc.I)(this.service.source,t,e);return(0,ro.jH)(i,r),rh.fromOptimizedFeatureSet(r,this._metadata)}const s=await(0,Bc.I)(this.service.source,t,e);return rh.fromOptimizedFeatureSet(s,this._metadata)}}class rl extends Gc{constructor(t,e,s,i,r){super(s),this._serviceInfo=t,this._queryInfo=e,this._metadata=i,this._connection=r,this._queue=new Zo.QueueProcessor({concurrency:32,process:async t=>{const e={signal:t.options?.signal,query:t.query.customParameters,useRequestQueue:!0};return this._adapter.executeQuery(t.query.inner,e)}}),this._adapter=function(t,e){switch(t.type){case"memory":return new tl(t,e);case"ogc":return new il(t,e);case"feature-service":return t.queryMetadata.supportsFormatPBF&&(0,n.A)("featurelayer-pbf")?new el(t,e):new sl(t,e)}}(t,i)}unsafeSetQueryHistoricMoment(t){this._queryInfo.updateHistoricMoment(t)}async updateFields(t){this._queryInfo.updateFields(t);const e=Array.from(this._store.chunks()).map(async t=>{const e=Da.A.fromJSON(t.queryInfo.queryJSON);if(e)try{return await this._tryUpdateFields(t.reader,e,{chunkId:t.chunkId}),null}catch(t){return t}}),s=(await Promise.all(e)).filter(t=>t);if(s.length)throw new i.A("featurelayer-query","Encountered errors when downloading fields",{errors:s})}async queryByObjectId(t){if(0===t.length)return rh.empty(this._metadata);const e=this._queryInfo.createQuery({objectIds:t});return this._fetch(e,null,null)}async _fetch(t,e,s){const i=await this._enqueue(t,e);return await this._tryUpdateFields(i,t.inner,s),i}async _tryUpdateFields(t,e,s){const r=this._queryInfo.createPatchFieldsQuery(e,t,s);if(!r)return;const n=await this._enqueue(r,this._options);n.getSize()===t.getSize()?t.joinAttributes(n):D.A.getLogger("esri.views.2d.layers.features.sources.strategies.AFetchLoadStrategy").error(new i.A("featurelayer-query",`Failed to join features. Expected a count of ${t.getSize()} features, but got ${n.getSize()}`,{query:r.inner.toJSON(),debugInfo:s}))}async _enqueue(t,e){return this._connection.onEvent({type:"fetchStart"}),this._queue.push({query:t,options:e}).finally(()=>{this._connection.onEvent({type:"fetchEnd",done:0===this._queue.length})})}}class nl extends rl{constructor(t,e,s,i,r){super(t,e,s,i,r),this._chunksById=new Map,this._featureCache=new Dc(s,e,this._options,this._fetch.bind(this))}prepareCacheUpdate(t,e){return this._featureCache.prepareCacheUpdate(t,e)}applyCacheUpdate(){return this._featureCache.applyCacheUpdate()}unload(t){this._removeChunks(t.tile)}_addChunk(t){const e=t.tile.id;this._chunksById.has(e)||this._chunksById.set(e,[]);const s=t.size();(s||t.first||t.end)&&((0,n.A)("esri-2d-update-debug")&&console.debug(`Chunk[${t.chunkId}] ATileLoadStrategy.addChunk [count=${s}]`),this._chunksById.get(e).push(t),this._store.insert(t))}_removeChunks(t){const e=this._chunksById.get(t.key.id)??[];for(const s of e)(0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${t.key.id}] Chunk[${s.chunkId}] ATileLoadStrategy.removeChunk`),this._store.remove(s);this._chunksById.delete(t.key.id)}}class ol extends ec{constructor(t,e,s,i,r,n){super(),this._reader=t,this._queryJSON=e,this._tile=s,this._sourceTile=i,this._sourceTileDepth=r,this._end=n,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._sourceTile?.key.normalizedId}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return 0===this._sourceTileDepth}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}get isTiled(){return!0}getTileReader(t){return this._tile.key.id===t.key.id?this.reader:null}}class al{constructor(t,e){this.subscription=t,this._tileIdToResult=new Map,this._controller=new AbortController,this._handles=(0,r.vE)([(0,a.u7)(t.signal,()=>this._controller.abort()),(0,a.u7)(e,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get(t){return this._tileIdToResult.get(t)}set(t,e){this._tileIdToResult.set(t,e)}get options(){return{signal:this._controller.signal}}}class hl extends nl{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const t of this._loadStates.values())t.destroy();this._loadStates.clear()}get about(){return{supportsDisplayFilter:!0,willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(t){this._loadStates.has(t.key.id)||this._loadStates.set(t.key.id,new al(t,this._options));const e=this._loadStates.get(t.key.id);let s;try{for await(const s of this._fetchChunkInfos(e,t.tile,0)){const{queryJSON:t,reader:i,sourceTile:r,sourceTileDepth:n,tile:o}=s,h=new ol(i,t,o,r,n,!1);(0,a.Te)(e.options),this._addChunk(h)}}catch(t){s=t}const i=new ol(rh.empty(this._metadata),null,t.tile,null,-1,!0);if(this._addChunk(i),s)throw s}unload(t){super.unload(t),this._loadStates.get(t.key.id)?.destroy(),this._loadStates.delete(t.key.id)}async*_fetchChunkInfos(t,e,s){let i=t.get(e.id);const r=!!i;if(i||(i=await this._fetchChunkInfo(t,e,s),t.set(e.id,i)),i.reader.exceededTransferLimit&&s<(0,n.A)("featurelayer-query-max-depth"))for(const i of e.createChildTiles())yield*this._fetchChunkInfos(t,i,s+1);else r||(yield i)}async _fetchChunkInfo(t,e,s){const i=t.subscription.tile.getQuantizationParameters(),r=this._queryInfo.createTileQuery(e,{returnExceededLimitFeatures:!1,quantizationParameters:i});return{reader:await this._fetch(r,t.options,{chunkId:e.id}),queryJSON:r.inner.toJSON(),tile:t.subscription.tile,sourceTile:e,sourceTileDepth:s}}}class cl extends ec{constructor(t,e,s,i,r){super(),this._reader=t,this._queryJSON=e,this._tile=s,this._page=i,this._end=r,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get page(){return this._page}get tile(){return this._tile}get isTiled(){return!0}getTileReader(t){return this._tile.key.id===t.key.id?this.reader:null}}class ll{constructor(t,e){this.subscription=t,this._pages=new Set,this._controller=new AbortController,this._done=!1,this._handles=(0,r.vE)([(0,a.u7)(t.signal,()=>this._controller.abort()),(0,a.u7)(e,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get pageStart(){let t=-1;for(const e of this._pages.values())t=Math.max(t,e);return t+1}get done(){return this._done}get options(){return{signal:this._controller.signal}}add(t,e){this._pages.add(t),this._done=this._done||e}}class ul extends nl{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const t of this._loadStates.values())t.destroy();this._loadStates.clear()}get about(){return{supportsDisplayFilter:!0,willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(t){const e=(0,z.tE)(this._loadStates,t.key.id,()=>new ll(t,this._options));for await(const t of this._fetchPages(e))this._addChunk(t)}unload(t){super.unload(t),this._loadStates.get(t.key.id)?.destroy(),this._loadStates.delete(t.key.id)}async*_fetchPages(t){let e;try{for await(const e of this._concurrentPageStream(t))(0,a.Te)(t.options),0!==e.size()&&(yield e)}catch(t){e=t}if(e&&(0,a.zf)(e)||(yield new cl(rh.empty(this._metadata),null,t.subscription.tile,-1,!0)),e)throw e}async*_concurrentPageStream(t){const e=(0,n.A)("featurelayer-query-tile-concurrency"),s=this._pageStreamAll(t),i=[];let r=!1,o=1;for(;!r;){const t=[];for(;!r&&i.length<o;){const e=s.next();if(!e.value){r=!0;break}const n=e.value;n.then(t=>{t.reader.exceededTransferLimit||(r=!0)}).catch(t=>{r=!0}).finally(()=>{i.splice(i.indexOf(n),1)}),i.push(n),t.push(n)}for(const e of t)yield e;i.length&&await Promise.race(i),o<e&&(o+=1)}}*_pageStreamAll(t){const e=Math.ceil((0,n.A)("featurelayer-query-tile-max-features")/this._queryInfo.pageSize);for(let s=0;s<e;s++)yield this._downloadPage(s,t)}async _downloadPage(t,e){(0,a.Te)(e.options);const s=e.subscription.tile,i=this._queryInfo.createPagedTileQuery(s,t),r=await this._fetch(i,e.options,{chunkId:`${s.id}-${t}`});return(0,a.Te)(e.options),new cl(r,i.inner.toJSON(),s,t,!1)}}var dl=s(2741);let _l=null;var pl=s(57733);async function fl(t,e={}){const{ParquetFile:r}=await async function(){return _l||(_l=async function(){const t=await Promise.resolve().then(s.bind(s,57733));return await t.default({module_or_path:(0,dl.s)("esri/libs/parquet/pkg/bundle_bg.wasm")}),t}()),_l}(),n=(t=>async function(e,s,i,r){const n=t?.(),o=n?{...n,debug:r}:{debug:r},{data:a}=await(0,Mc.A)(e,{responseType:"array-buffer",query:o,headers:{range:`bytes=${s}-${i}`}});return a})(e.getCustomParameters),o=(t=>async function(e){const{data:s}=await(0,Mc.A)(e,{responseType:"native",method:"head",query:t?.()}),i=s.headers.get("Content-Length");if(null==i)throw new Error("Unable to parse content length");return parseInt(i,10)})(e.getCustomParameters),a=e.geometryInfo?function(t,e){const s=t.spatialReference.wkid,r=e.wkid;if(!s||!r)throw new i.A("parquet","Unable to create ParquetFile, in and out wkid must be specified");const n=function(t){switch(t){case"esriGeometryPoint":return pl.GeometryType.Point;case"esriGeometryPolygon":return pl.GeometryType.Polygon;case"esriGeometryPolyline":return pl.GeometryType.Polyline;case"esriGeometryMultipoint":return pl.GeometryType.Multipoint;default:throw new i.A("parquet",`Found unexpected GeometryType: ${t}`)}}(t.geometryType),o=function(t){switch(t.encoding.type){case"wkb":return pl.PrimaryGeometryField.fromWkb(t.encoding.primaryFieldName);case"location":{const{latitudeFieldName:e,longitudeFieldName:s}=t.encoding;return pl.PrimaryGeometryField.fromLocation(e,s)}}}(t),a=[];if("xz"===t.displayOptimization?.mode){const e=t.displayOptimization.multiscale;for(const t of e.levels??[]){const[e,s]=t.transform.translate,[i,r]=t.transform.scale,n=new Float64Array([e,s]),o=new Float64Array([i,r]);a.push(pl.MultiscaleGeometryField.new(t.level,t.column,n,o))}}return pl.GeometryInfo.new(n,s,r,o,a)}(e.geometryInfo,e.outSpatialReference):null;return r.fromUrl(t,n,o,a)}let ml;class gl extends ih{constructor(t,e,s,i,r=new Uint32Array(s.size())){super(t),this._fields=e,this._inner=s,this._chunkId=i,this._displayIds=r,this._index=-1,this.usedMemory=Kh.qK,this._size=this._inner.size(),t.featureIdInfo.type,this._chunkId>65535&&console.error("Exceeded max allowed parquet reader size")}destroy(){super.destroy(),this._inner.free()}get fields(){return this._fields}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}getInTransform(){return null}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let t="";for(const e of this.fields.fields)t+=this._readAttribute(e.name,!1)+".";return t}getObjectId(){return this._inner.rowId(this._index)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(t){this._displayIds[this._index]=t}setIndex(t){this._index=t}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}setBoundsXMin(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(t){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const t=new gl(this.metadata,this._fields,this._inner,this._chunkId,this._displayIds);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._index=this._index}readGeometryForDisplayTransformed(t){const[e,s]=t.translate,[i,r]=t.scale;return ml||(ml=pl.QuantizedGeometryBuffer.new()),this._inner.transformGeometry(ml,e,s,i,r,this._index)?new St.A(ml.readLengthsUnsafe(),ml.readCoordsUnsafe()):null}_readGeometry(t){const e=this._inner.readCoords(this._index),s=this._inner.readLengths(this._index);return e&&s?new St.A(s,e):null}_readX(){return this._inner.readX(this._index)}_readY(){return this._inner.readY(this._index)}_readServerCentroid(){return null}_readAttribute(t,e){const s=this.fields.get(t);if(!s)return;if(null==s.attributeId)return this.getObjectId();const i=this._inner.readAttribute(this._index,s.attributeId);if(null==i)return i;const r=this.fields.isDateField(s.name);return e?null==i?i:r?new Date(i):i:i}_readAttributes(){const t={};for(const e of this._fields.fields)null!=e.attributeId&&(this._inner.isEmpty(e.attributeId)||(t[e.name]=this._readAttribute(e.name,!1)));return t.__OBJECTID=this.getObjectId(),t}}class yl extends Gc{constructor(t,e,s,i){super(i),this._service=t,this._metadata=e,this._schema=s,this._chunkId=0,this._files=[],this._availableFields=new Set(s.mutable.availableFields)}destroy(){super.destroy();for(const t of this._files)t.free()}get about(){return{supportsDisplayFilter:!1,willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}async updateFields(t){await this._promise;const e=new Set(t),s=(0,O.iv)(e,this._availableFields);this._availableFields=(0,O.KC)(s,this._availableFields);const i=this._fieldsIndex;if(null==i)return;const r=Array.from(s).map(t=>i.get(t)?.attributeId);if(s.size)for(const t of this._files)await t.ensureFields(new Uint16Array(r))}async load(t){return null==this._promise&&(this._promise=this._download()),this._promise}unload(t){}async addParquetFile(t){this._insert(t)}async _insert(t){const e=await fl(t,{geometryInfo:this._service.geometryInfo,outSpatialReference:this._service.outSpatialReference,getCustomParameters:()=>this._schema.mutable.dataFilter.customParameters});this._files.push(e),(0,a.Te)(this._options);const s=e.fields().map(t=>({name:t.name,alias:t.name,type:t.type,attributeId:e.attributeIdFor(t.name)})),{timeZoneByFieldName:i}=this._service.metadata.fieldsIndex,r=Ko.A.fromJSON({fields:s,timeZoneByFieldName:i});this._fieldsIndex=r;const n=new Uint16Array(Array.from(this._availableFields.values()).map(t=>r.get(t)?.attributeId).filter(t=>null!=t));await e.readAllChunks(n,this._signal,t=>{if(this._signal.aborted)return;const e=this._chunkId++,s=new gl(this._metadata,r,t,e),i=new Lc(s,null,e,!1);this._store.insert(i)})}async _download(){try{await Promise.all(this._service.source.urls.map(t=>this._insert(t)));const t=new Lc(rh.empty(this._metadata),null,-1,!0);this._store.insert(t)}catch(t){throw console.error(t),t}}}class xl extends ec{constructor(t,e,s,i,r){super(),this._metadata=t,this._reader=e,this._tile=s,this._page=i,this._end=r,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._page}${this.end?"e":""}`}get reader(){return this._reader??rh.empty(this._metadata)}get first(){return 0===this._page}get end(){return this._end}get tile(){return this.tile}get queryInfo(){return{type:"parquet",chunkId:this.chunkId,queryJSON:null,page:this._page,size:this.size(),tileId:this._tile.id,end:this.end}}get isTiled(){return!0}getTileReader(t){if(this._tile.key.id===t.key.id){const e=[];for(let t=0;t<this.reader.getSize();t++)e.push(t);const s=tc.from(this.reader,e);return s.setTransformForDisplay(t.transform),s}return null}}class bl extends Gc{constructor(t,e,s,i){super(i),this._metadata=e,this._schema=s,this._files=[];const r=new Set(s.mutable.availableFields);if(!t.geometryInfo.displayOptimization)throw new Error("InternalError: ParquetTileLoadStrategy only supports XZ-enabled parquet files");this._index=wl.create(e,t,r,i,()=>this._schema.mutable.dataFilter.customParameters)}destroy(){super.destroy();for(const t of this._files)t.free()}get about(){return{supportsDisplayFilter:!1,willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}async load(t){const e=await this._index;await e.ensureLoaded(t)}unload(t){this._index.then(e=>e.unload(t.tile))}async updateFields(t){return(await this._index).updateFields(t)}async addParquetFile(t){throw new Error("Impl!")}}class wl{static async create(t,e,s,i,r){const n=await Promise.all(e.source.urls.map(t=>fl(t,{geometryInfo:e.geometryInfo,outSpatialReference:e.outSpatialReference,getCustomParameters:r}))),[o]=n,a=o.fields().map(t=>({name:t.name,alias:t.name,type:t.type,attributeId:o.attributeIdFor(t.name)})),{timeZoneByFieldName:h}=e.metadata.fieldsIndex,c=Ko.A.fromJSON({fields:a,timeZoneByFieldName:h}),l=new Uint16Array(Array.from(s.values()).map(t=>c.get(t)?.attributeId).filter(t=>null!=t)),u=e.geometryInfo.displayOptimization;if(!u)throw new Error("InternalError: tiled parquet load requires display optimization");return new wl(t,await Promise.all(n),c,l,i,s,u)}constructor(t,e,s,i,r,n,o){this._metadata=t,this._files=e,this._fieldsIndex=s,this._fieldIndices=i,this._store=r,this._availableFields=n,this._displayOptimization=o,this._queue=new Zo.QueueProcessor({concurrency:1,process:t=>this._ensureLoaded(t)}),this._tileIdToChunkId=new Map}get file(){return this._files[0]}async ensureLoaded(t){return this._queue.push(t)}unload(t){const e=this._tileIdToChunkId.get(t.id);if(null!=e){for(const t of e)this._store.removeById(t);this._tileIdToChunkId.delete(t.id)}}async _ensureLoaded(t){const e=this._metadata.outSpatialReference,s=t.tile,{xmin:i,ymin:r,xmax:n,ymax:o}=function(t,e){const s=[t.xmin,t.ymin,t.xmax,t.ymax],i=yi.A.fromExtent((0,H.w1)(s,e)),r=(0,Jo.Cv)(i,e,y.A.WGS84);if(!r)return null;const n=(0,ro.Ye)(new St.A,r,!1,!1),o=n.coords.filter((t,e)=>!(e%2)),a=n.coords.filter((t,e)=>e%2);return{xmin:Math.min(...o),ymin:Math.min(...a),xmax:Math.max(...o),ymax:Math.max(...a)}}(s.extent,e);let a=0;const h={extent:s.extent,extent_lat_lng:{xmin:i,ymin:r,xmax:n,ymax:o},tile_level:s.level,attributes:this._fieldIndices};if("z"===this._displayOptimization.mode?await this.file.queryZChunks(h.extent_lat_lng,this._fieldIndices,t.signal,e=>{if(t.signal.aborted)return;const i=new gl(this._metadata,this._fieldsIndex,e,a),r=new xl(this._metadata,i,s,a++,!1);this._insertChunk(s,r)}):await this.file.queryXZChunks(h,t.signal,e=>{if(t.signal.aborted)return;const i=new gl(this._metadata,this._fieldsIndex,e,a),r=new xl(this._metadata,i,s,a++,!1);this._insertChunk(s,r)}),t.signal.aborted)return;const c=new xl(this._metadata,null,s,a++,!0);this._insertChunk(s,c)}_insertChunk(t,e){let s=this._tileIdToChunkId.get(t.id);null==s&&(s=[],this._tileIdToChunkId.set(t.id,s)),s.push(e.chunkId),this._store.insert(e)}async updateFields(t){const e=new Set(t),s=(0,O.iv)(e,this._availableFields);if(this._availableFields=(0,O.KC)(s,this._availableFields),s.size)for(const t of this._files){const e=Array.from(s).map(t=>this._fieldsIndex.get(t)?.attributeId);await t.ensureFields(new Uint16Array(e))}}}var vl=s(27348);class Il extends rl{constructor(t,e,s,i,r,n){super(t,e,s,r,n),this._snapshotInfo=i}get about(){return{supportsDisplayFilter:!1,willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}load(t){return null==this._promise&&(this._promise=this._download()),this._promise}unload(t){}async _download(){const t=this._snapshotInfo.initialTolerance,e=t?new vl.A({mode:"view",originPosition:"upper-left",tolerance:t}):null;await this._downloadStreaming(e),null!=e&&await this._downloadRefresh()}async _downloadStreaming(t){try{for await(const e of this._fetchPages(t))this._store.insert(e)}catch(t){throw new i.A("featurelayer-query","Encountered error when downloading data",{error:t})}}async _downloadRefresh(){try{const t=[];for await(const e of this._fetchPages(null))t.push(e);this._store.clear();for(const e of t)this._store.insert(e);this._store.refresh()}catch(t){throw new i.A("featurelayer-query","Encountered error when downloading data",{error:t})}}async*_fetchPages(t){let e;try{for await(const e of this._concurrentPageStream(t))0!==e.size()&&(yield e)}catch(t){e=t}if(e&&(0,a.zf)(e)||(yield new Lc(rh.empty(this._metadata),null,-1,!0)),e)throw e}async*_concurrentPageStream(t){const e=(0,n.A)("featurelayer-snapshot-concurrency"),s=this._pageStreamAll(t),i=[];let r=!1,o=1;for(;!r;){const t=[];for(;!r&&i.length<o;){const e=s.next();if(!e.value){r=!0;break}const n=e.value;n.then(t=>{t.reader.exceededTransferLimit||(r=!0)}).catch(t=>{r=!0}).finally(()=>{i.splice(i.indexOf(n),1)}),i.push(n),t.push(n)}for(const e of t)yield e;i.length&&await Promise.race(i),o<e&&(o+=1)}}*_pageStreamAll(t){const e=Math.ceil(this._snapshotInfo.maxFeatureCount/this._queryInfo.pageSize);for(let s=0;s<e;s++)yield this._downloadPage(s,t)}async _downloadPage(t,e){(0,a.Te)(this._options);const s=this._queryInfo.createPagedQuery(t,e),i=await this._fetch(s,this._options,{chunkId:t.toString()}),r=new Lc(i,s.inner.toJSON(),t,!1);return(0,a.Te)(this._options),r}}class Sl{constructor(t){this.size=0,this._start=0,this.maxSize=t,this._buffer=new Array(t)}get entries(){return this._buffer}enqueue(t){if(this.size===this.maxSize){const e=this._buffer[this._start];return this._buffer[this._start]=t,this._start=(this._start+1)%this.maxSize,e}return this._buffer[(this._start+this.size++)%this.maxSize]=t,null}dequeue(){if(0===this.size)return null;const t=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,t}peek(){return 0===this.size?null:this._buffer[this._start]}peekLast(){return 0===this.size?null:this._buffer[(this._start+(this.size-1))%this.maxSize]}find(t){if(0===this.size)return null;for(const e of this._buffer)if(null!=e&&t(e))return e;return null}clear(t){let e=this.dequeue();for(;null!=e;)t&&t(e),e=this.dequeue()}}class Pl{constructor(t,e,s,r,n=128){if(this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=s,this._purgeOptions=r,this.store=t,"unique-id-composite"===e.type)throw new i.A("stream-layer","composite uniqueIds are not supported");this.idField=e.fieldName,this.purgeInterval=n,this._useGeneratedIds=this.idField===ot.DN}removeById(t){this._removed.push(t)}removeByTrackId(t){const e=this._trackIdToObservations.get(t);if(e)for(const t of e.entries)this._removed.push(t)}add(t){if(this._useGeneratedIds){const e=this._nextId();t.attributes[this.idField]=e,t.objectId=e}else t.objectId=t.attributes[this.idField];const e=t.objectId;if(this._addOrUpdated.set(e,t),this._maxAge=Math.max(this._maxAge,t.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return null==this._trackIdLessObservations&&(this._trackIdLessObservations=new Sl(1e5)),void this._trackIdLessObservations.enqueue(e);const s=t.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(s)){const t=null!=this._purgeOptions?.maxObservations?this._purgeOptions.maxObservations:1e3,e=(0,Xs.qE)(t,0,1e3);this._trackIdToObservations.set(s,new Sl(e))}const i=this._trackIdToObservations.get(s),r=i?.enqueue(e);null!=r&&(this._addOrUpdated.has(r)?this._addOrUpdated.delete(r):this._removed.push(r))}checkForUpdates(){const t=this._getToAdd(),e=this._getToRemove(),s=performance.now(),i=s-this._lastPurge,r=Date.now();i>=this.purgeInterval&&(this._purge(s),this._lastPurge=s);const n=[];if(null!=e)for(const t of e){const e=this.store.removeById(t);null!=e&&n.push(e)}const o=[];if(null!=t){const i=new Set(e??[]);for(const e of t)i.has(e.objectId)||(e.attributes[ot.Gm]=s,e.attributes[ot.Aw]=r,this.store.add(e),o.push(e))}return!(!o.length&&!n?.length||(this.store.update(o,n),0))}_getToAdd(){if(!this._addOrUpdated.size)return null;const t=new Array(this._addOrUpdated.size);let e=0;return this._addOrUpdated.forEach(s=>t[e++]=s),this._addOrUpdated.clear(),t}_getToRemove(){const t=this._removed;return this._removed.length?(this._removed=[],t):null}_nextId(){const t=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,t}_purge(t){const e=this._purgeOptions;null!=e&&(this._purgeSomeByDisplayCount(e),this._purgeByAge(e),this._purgeByAgeReceived(t,e),this._purgeTracks())}_purgeSomeByDisplayCount(t){if(!t.displayCount)return;let e=this.store.size;if(e>t.displayCount){if(this._timeInfo.trackIdField)for(const s of this._trackIdToObservations.values())if(e>t.displayCount&&s.size){const t=s.dequeue();this._removed.push(t),e--}if(null!=this._trackIdLessObservations){let s=e-t.displayCount;for(;s-- >0;){const t=this._trackIdLessObservations.dequeue();null!=t&&this._removed.push(t)}}}}_purgeByAge(t){const e=this._timeInfo?.startTimeField;if(!t.age||!e)return;const s=60*t.age*1e3,i=this._maxAge-s;this.store.forEach(t=>{t.attributes[e]<i&&this._removed.push(t.objectId)})}_purgeByAgeReceived(t,e){if(!e.ageReceived)return;const s=t-60*e.ageReceived*1e3;this.store.forEach(t=>{t.attributes[ot.Gm]<s&&this._removed.push(t.objectId)})}_purgeTracks(){this._trackIdToObservations.forEach((t,e)=>{0===t.size&&this._trackIdToObservations.delete(e)})}}var Ml=s(30624);let Cl=class extends R.A{constructor(t){super(t)}get connectionStatus(){return this.connection?.connectionStatus}get errorString(){return this.connection?.errorString}};(0,E.Cg)([(0,L.MZ)()],Cl.prototype,"connection",void 0),(0,E.Cg)([(0,L.MZ)()],Cl.prototype,"connectionStatus",null),(0,E.Cg)([(0,L.MZ)()],Cl.prototype,"errorString",null),Cl=(0,E.Cg)([(0,G.$)("esri.views.2d.layers.features.sources.StreamConnectionState")],Cl);class Al{constructor(t,e){this._metadata=t,this._onUpdate=e,this._objectIdToFeature=new Map}get size(){return this._objectIdToFeature.size}get reader(){return rh.fromFeatures([...this._objectIdToFeature.values()],this._metadata)}add(t){this._objectIdToFeature.set(t.objectId,t)}forEach(t){this._objectIdToFeature.forEach(t)}removeById(t){const e=this._objectIdToFeature.get(t);return e?(this._objectIdToFeature.delete(t),e):null}clear(){this._objectIdToFeature=new Map}update(t,e){this._onUpdate(t?.length??0)}}class Tl extends ec{constructor(t){super(),this._reader=t,this.chunkId="stream-chunk",this.normalizedChunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(t){const e=this.queryFeaturesInBounds(t.bounds);return e.setTransformForDisplay(t.transform),e}}class kl extends Gc{constructor(t,e,s,i,r){super(s),this._service=t,this._dataFilter=e,this._streamOptions=i,this._metadata=r,this._connectionState=new Cl,this._forceRefresh=!1,this.events=new ea.A.EventEmitter;const{timeInfo:n}=this._metadata,{purgeOptions:o}=e;this._stagingStore=new Al(this._metadata.weakCloneWithAdditionalFields([{name:ot.Aw,alias:"timeReceived",type:"esriFieldTypeDate"}]),t=>this.events.emit("features-updated",t)),this._manager=new Pl(this._stagingStore,r.featureIdInfo,n,o),this.connect()}destroy(){super.destroy(),this.disconnect()}get about(){return{supportsDisplayFilter:!1,willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}async refresh(){const t=null!=this._chunk;return this._manager.checkForUpdates()||!t||this._forceRefresh?(this._chunk&&this._store.remove(this._chunk),this._forceRefresh=!1,this._chunk=new Tl(this._stagingStore.reader),this._store.insert(this._chunk),this.events.emit("tick"),!0):(this.events.emit("tick"),!1)}async updateFields(t){throw new Error("Updating available fields not supported for StreamLayer")}async load(t){}unload(t){}disconnect(){this._connection=(0,f.pR)(this._connection),this._connectionState.connection=null,this._handlesGroup?.remove()}connect(){if(null!=this._connection)return;const{geometryType:t,spatialReference:e}=this._metadata,{maxReconnectionAttempts:s,maxReconnectionInterval:i,geometryDefinition:n,definitionExpression:o,customParameters:a}=this._dataFilter;this._connection=(0,Ml.createConnection)(this._service.source,e,this._streamOptions.outSR,t,o,n,s,i,a),this._handlesGroup=(0,r.vE)([this._connection.on("data-received",t=>this._onFeature(t)),this._connection.on("message-received",t=>this._onWebSocketMessage(t))]),this._connectionState.connection=this._connection}clear(){this._manager.checkForUpdates(),this._stagingStore.clear(),this._forceRefresh=!0}updateCustomParameters(t){this._connection?.updateCustomParameters(t)}sendMessageToSocket(t){this._connection?.sendMessageToSocket(t)}sendMessageToClient(t){this._connection?.sendMessageToClient(t)}_onWebSocketMessage(t){if("type"in t)switch(t.type){case"delete":if(t.objectIds)for(const e of t.objectIds)this._manager.removeById(e);if(t.trackIds)for(const e of t.trackIds)this._manager.removeByTrackId(e);break;case"clear":this.clear()}this.events.emit("message-received",t)}_onFeature(t){try{this._manager.add(t),this.events.emit("data-received",t)}catch(t){}}}class Fl{constructor(t){this._metadata=t,this._chunks=new Map,this._chunksToRemove=[],this._overrides=new nc,this.events=new ea.A.EventEmitter,this.featureAdapter=new nh}destroy(){this.clear()}clear(){for(const t of this._chunks.values())this._chunksToRemove.push(t);this._chunks.clear(),this._overrides.clearWeakOverrides()}*chunks(){this._overrides&&(yield this._overrides.asChunk(this._metadata)),yield*this._chunks.values()}insert(t){(0,n.A)("esri-2d-update-debug")&&console.debug(`Chunk[${t.chunkId}] SourceChunkStore.insert`),this._overrides.onChunkInsert(t),this._chunks.set(t.chunkId,t),this.events.emit("changed")}remove(t){(0,n.A)("esri-2d-update-debug")&&console.debug(`Chunk[${t.chunkId}] SourceChunkStore.remove`),this._chunks.delete(t.chunkId),this._chunksToRemove.push(t)}removeById(t){(0,n.A)("esri-2d-update-debug")&&console.debug(`Chunk[${t}] SourceChunkStore.remove`);const e=this._chunks.get(t);this._chunks.delete(t),e&&this._chunksToRemove.push(e)}cleanup(){const t=this._chunksToRemove;return this._chunksToRemove=[],this._overrides.cleanup(this._chunks.values()),t}applyOverride(t){this._overrides.apply(t,this),this.events.emit("changed");for(const t of this._chunks.values())t.invalidate()}takeOverrideUpdate(){return this._overrides.takeOverrideUpdate()}refresh(){this.events.emit("refresh")}forEach(t){const e=new Set;for(const s of this.chunks()){const i=s.reader.getCursor();for(;i.next();){const s=i.getObjectId();e.has(s)||(t(i.copy()),e.add(s))}}}forEachUnsafe(t){const e=new Set;for(const s of this.chunks()){const i=s.reader.getCursor();for(;i.next();){const s=i.getObjectId();e.has(s)||(t(i),e.add(s))}}}mapObjectIdsFromGlobalIds(t,e){const s=new Map,i=new Set(t);return this._overrides.putWeakObjectIdsFromGlobalIds(s,i,e),this._forEachUnsafeIgnoreOverrides(t=>{const r=t.readAttribute(e);if(r&&i.has(r)&&!s.has(r)){const e=t.getObjectId();s.set(r,e)}}),s}forEachInBounds(t,e){const s=new Set;for(const i of this.chunks()){const r=i.queryFeaturesInBounds(t);for(;r.next();){const t=r.getObjectId();s.has(t)||(e(r.copy()),s.add(t))}}}forEachBounds(t,e){const s=(0,sa.vt)();for(const i of t)i.getBounds(s)&&e(s)}_forEachUnsafeIgnoreOverrides(t){const e=new Set;for(const s of this._chunks.values()){const i=s.reader.withoutOverrides().getCursor();for(;i.next();){const s=i.getObjectId();e.has(s)||(t(i),e.add(s))}}}}var El=s(79897);let Rl=class extends R.A{constructor(t){super(t),this.debugName="",this._updatingHandles=new El.U,this._idToUpdatingState=new q.A}get updating(){const t=this._updatingHandles.updating||Array.from(this._idToUpdatingState.values()).some(t=>t);if((0,n.A)("esri-2d-log-updating")){const e=Array.from(this._idToUpdatingState.entries()).map(([t,e])=>`-> ${t}: ${e}`).join("\n");console.log(`${this.debugName}: Updating: ${t}\n-> Handles: ${this._updatingHandles.updating}\n${e}`)}return t}addUpdateTracking(t,e){const s=(0,c.wB)(()=>e.updating,e=>this._idToUpdatingState.set(t,e),{sync:!0});this.addHandles(s)}addPromise(t){return this._updatingHandles.addPromise(t)}};(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],Rl.prototype,"debugName",void 0),(0,E.Cg)([(0,L.MZ)({readOnly:!0})],Rl.prototype,"updating",null),Rl=(0,E.Cg)([(0,G.$)("esri.views.2d.layers.support.UpdateTracking2D")],Rl);class zl{constructor(t,e,s,i,r){this.service=t,this._aggregateAdapter=e,this._subscriptions=s,this._connection=i,this._cachedObjectIds=r,this._updateTracking=new Rl({debugName:"FeatureSource"}),this._didInvalidateData=!1,this._metadata=ah.createFeature(t.metadata),this._store=new Fl(this._metadata)}destroy(){this._strategy?.destroy(),this._store.destroy(),this._streamMessenger?.destroy(),"memory"===this.service.type&&this.service.source.map(t=>t.close())}get metadata(){if(!this._metadata)throw new Error("InternalError: Metadata not defined. Was update called?");return this._metadata}get store(){return this._store}get streamMessenger(){return null==this._streamMessenger&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return Tc.from(this._store)}get updateTracking(){return this._updateTracking}get queryEngine(){if(!this._queryEngine){if(!this._schema)return null;const{dataFilter:t}=this._schema.mutable,e=this._schema.mutable.availableFields,s=this._metadata;this._queryEngine=new ra.do({featureStore:this._store,fieldsIndex:s.fieldsIndex,geometryType:s.geometryType,featureIdInfo:s.featureIdInfo,hasM:!1,hasZ:!1,spatialReference:this.service.outSpatialReference,aggregateAdapter:this._aggregateAdapter,timeInfo:s.timeInfo,definitionExpression:t.definitionExpression,availableFields:e})}return this._queryEngine}get isStream(){return"stream"===this._schema.type}get hasDisplayFilter(){return!!this._schema&&"displayFilterInfo"in this._schema.mutable&&null!=this._schema.mutable.displayFilterInfo}chunks(){return Array.from(this._store.chunks())}prepareCacheUpdate(t,e){const s=new Set,i=new Set;for(const e of t)this._cachedObjectIds.has(e)||(this._cachedObjectIds.add(e),s.add(e));for(const t of e)this._cachedObjectIds.delete(t),i.add(t);this.hasDisplayFilter&&this._strategy.prepareCacheUpdate(s,i)}async applyCacheUpdate(){this.hasDisplayFilter&&await this._updateTracking.addPromise(this._strategy.applyCacheUpdate())}cleanup(){return this._store.cleanup()}onSubscribe(t){this._connection.onEvent({type:"subscribe",tile:t.tile.id});const e=this._strategy?.load(t);e&&(e.then(()=>this._connection.onEvent({type:"loaded",tile:t.tile.id})).catch(e=>this._connection.onEvent({type:"error",tile:t.tile.id,error:e})),this._updateTracking.addPromise(e))}onResume(t){this._updateTracking.addPromise((0,a.QZ)(this._strategy?.load(t)))}onUnsubscribe(t){this._connection.onEvent({type:"unsubscribe",tile:t.tile.id}),this._strategy?.unload(t)}applyOverride(t){this._didInvalidateData=!0,this._store.applyOverride(t)}takeOverrideUpdate(){return this._store.takeOverrideUpdate()}async update(t,e){const s=t.source,i=(0,g.Ui)(this._schema?.mutable,s.mutable);if(!i)return!1;if((0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.update`,{changes:i}),this._schema=s,this._queryEngine?.destroy(),this._queryEngine=null,"feature-service"===this.service.type&&null!=this.service.queryMetadata.lastEditDate&&(this._lastEditDate=this.service.queryMetadata.lastEditDate),null==this._streamMessenger&&"stream"===this._schema.type&&this._initStreamMessenger(),(0,g.w2)(i,"sourceRefreshVersion")&&this._strategy?.refresh)return this._strategy.refresh();if(("feature"===s.type||"parquet"===s.type)&&(0,g.w2)(i,"availableFields")){if(await this._queryLastEditDateChanged()||this._didInvalidateData)this._didInvalidateData=!1,await this._updateStrategy(e);else{this._connection.onEvent({type:"updateFieldsStart"});try{await this._strategy.updateFields(s.mutable.availableFields),this._connection.onEvent({type:"updateFieldsEnd"})}catch(t){this._connection.onEvent({type:"updateFieldsError",error:t})}}return!1}return!!((0,g.Mj)(i,"dataFilter")||(0,g.Mj)(i,"sourceRefreshVersion")||this._strategy.about.supportsDisplayFilter&&(0,g.Mj)(i,"displayFilterInfo"))&&(await this._updateStrategy(e),!0)}async addParquetFile(t){this._strategy.addParquetFile(t)}unsafeSetQueryHistoricMoment(t){"feature"===this._schema.type&&(this._schema.mutable.dataFilter.historicMoment=t,this._strategy.unsafeSetQueryHistoricMoment(new Date(t)))}_initStreamMessenger(){null==this._streamMessenger&&(this._streamMessenger=new zc(this._connection))}async normalizeOverrides(t){const e={historicMoment:t.historicMoment,commands:{updateWeak:t.commands.updateWeak.map(Qo.Om.fromJSON),removeWeak:t.commands.removeWeak,update:t.commands.update.map(Qo.Om.fromJSON),remove:t.commands.remove,release:t.commands.release}},s=t.commands.updateByIdWeak,i=await this._queryOptimizedFeatures(s);return e.commands.updateWeak.push(...i),e}async _queryOptimizedFeatures(t){if(0===t.length)return[];const e=[],s=(await this._strategy.queryByObjectId(t)).getCursor();for(;s.next();)e.push(s.readOptimizedFeatureWorldSpace());return e}getObjectIdsFromGlobalIds(t){const e=this.metadata.globalIdField;if(null==e)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const s=this._store.mapObjectIdsFromGlobalIds(t,e).values();return Array.from(s)}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;const t=this.service.source,e={...t.query,f:"json"},s=(await(0,Mc.A)(t.path,{query:e,responseType:"json"})).data.editingInfo.lastEditDate;return s!==this._lastEditDate&&(this._lastEditDate=s,!0)}async _createStrategy(){const t="isSourceHosted"in this.service&&this.service.isSourceHosted,e=Array.isArray(this.service.source),s=this.service.source&&"collection"in this.service.source,i=t||e||s;if("stream"===this._schema.type){const t=new kl(this.service,this._schema.mutable.dataFilter,this._store,{outSR:this.service.outSpatialReference},this.metadata);return this._streamMessenger.strategy=t,t}if("parquet"===this._schema.type){const t=this.service;return null!=t.geometryInfo.displayOptimization?new bl(t,this._metadata,this._schema,this._store):new yl(t,this._metadata,this._schema,this._store)}const r=this.service,n=Rc.fromSchema(r,this._schema,this._metadata),o=await this._supportSnapshotMode(r,n);return o?new Il(r,n,this._store,o,this.metadata,this._connection):i?new ul(r,n,this._store,this.metadata,this._connection):new hl(r,n,this._store,this.metadata,this._connection)}async _updateStrategy(t){const e=await this._createStrategy();this._connection.onEvent({type:"updateStrategyStart",about:e.about});const s=!!this._strategy;this._store.clear(),this._strategy?.destroy(),this._strategy=e,(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.updateStrategy`,{strategy:e});const i=Array.from(this._subscriptions.values());if(!i.length)return void this._connection.onEvent({type:"updateStrategyEnd"});const r=Promise.all(i.map(t=>this._strategy.load(t).then(()=>this._connection.onEvent({type:"loaded",tile:t.tile.id})).catch(e=>this._connection.onEvent({type:"error",tile:t.tile.id,error:e}))));this._updateTracking.addPromise(r),this._strategy.prepareCacheUpdate(this._cachedObjectIds);try{s&&await r}catch(t){(0,a.jH)(t)}this._connection.onEvent({type:"updateStrategyEnd"}),(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.updateStrategyEnd`,{strategy:e})}async _supportSnapshotMode(t,e){const{queryMetadata:s}=t,i=s.snapshotInfo;return i?await this._executeExceedsLimitQuery(t,e,i)?null:i:null}async _executeExceedsLimitQuery(t,e,s){if(!s.supportsExceedsLimit)return this._executeExceedsLimitFallbackQuery(t,e,s);try{const i=t.source,r=e.createQuery();r.inner.orderByFields=[],r.inner.returnGeometry=!1;const n=new Ac.A;n.statisticType="exceedslimit",n.maxPointCount=s.maxFeatureCount,n.maxRecordCount=s.maxFeatureCount,n.outStatisticFieldName="exceedslimit",s.maxVertexCount&&(n.maxVertexCount=s.maxVertexCount),r.inner.outStatistics=[n],r.inner.cacheHint=!0;const o=await(0,Cc.eW)(i,r.inner,void 0,{query:r.customParameters}),a=o.data.features[0]?.attributes.exceedslimit;return!(0===a)}catch(t){return!0}}async _executeExceedsLimitFallbackQuery(t,e,s){if(s.maxVertexCount)return!0;const i=t.source,r=e.createQuery();r.inner.orderByFields=[],r.inner.returnGeometry=!1,r.inner.cacheHint=!0;try{return(await(0,Cc.gW)(i,r.inner,{query:r.customParameters})).data.count>s.maxFeatureCount}catch(t){return!0}}}class Ol{constructor(t,e){this.tile=t,this.version=e,this._abortController=new AbortController}get key(){return this.tile.key}get signal(){return this._abortController.signal}abort(){this._abortController.abort()}}var Ll=s(98291);class Dl{constructor(t,e){this.key=new b.A(0,0,0,0),this.bounds=(0,H.vt)(),this.objectIds=new Set,this.key.set(e);const s=t.getLODInfoAt(this.key);this.tileInfoView=t,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.level=s.level,this.scale=s.scale,this.minScale=t.zoomToScale(s.level-1),this.maxScale=t.zoomToScale(s.level+1)}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){return(0,H.w1)(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createArcadeEvaluationOptions(t){return vh(this.scale,t)}createChildTiles(){const t=this.key.getChildKeys(),e=Ll.A.acquire();for(let s=0;s<t.length;s++)e[s]=new Dl(this.tileInfoView,t[s]);return e}getQuantizationParameters(){return vl.A.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}class Gl{constructor(t){this.inner=t,this.resolver=(0,a.Tw)()}}class Nl{constructor(){this._aggregateAdapter={getFeatureObjectIds:t=>this._processor.getFeatureObjectIdsForAggregate(t)},this._subscriptions=new Map,this._cachedObjectIds=new Set,this._updateRequested=!1,this._didSourceRefresh=!1,this._updateSubscriptionRequests=[],this._updateHighlightRequests=[]}destroy(){this._subscriptions.clear(),this._processor?.destroy(),this._source?.destroy(),this._handles?.remove(),this._updateOverridesRequest=null,this._tileInfoView=null}onAttach(t){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.onAttach");const e=this._connection,s=d.A.fromJSON(t.tileInfoJSON);this._tileInfoView=new F(s),this._source=new zl(t.service,this._aggregateAdapter,this._subscriptions,e,this._cachedObjectIds),this._processor=new Sc(e,this._source),this._handles=(0,r.vE)([this._source.store.events.on("changed",()=>this._requestUpdate()),this._source.store.events.on("refresh",()=>this._requestRefresh()),(0,c.wB)(()=>this._source.updateTracking.updating,()=>{this._requestUpdate(),(0,a.QZ)(this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}))})])}onDetach(){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.onDetach"),this.destroy()}set remoteClient(t){this._connection=new p(t)}get features(){const t=this._source?.queryEngine;if(!t)throw new i.A("no-queryEngine","No query engine defined");return t}get aggregates(){const t=this._processor?.aggregateQueryEngine;if(!t)throw new i.A("no-queryEngine","No aggregate query engine defined");return t}get processor(){return this._processor}get streamMessenger(){return this._source.streamMessenger}getDisplayFeatures(t){return this._processor.getDisplayFeatures(t)}getDisplayIds(t){return this._processor.getDisplayIds(t)}getObjectIdsFromGlobalIds(t){return this._source.getObjectIdsFromGlobalIds(t)}async updateSchema(t,e){return(0,n.A)("esri-2d-update-debug")&&this._updateSchemaRequest&&console.error("InternalError: Schema already updating"),this._updateSchemaRequest=new Gl({schema:t,version:e}),this._requestUpdate(),this._updateSchemaRequest.resolver.promise}updateSubscriptions(t){const e=new Gl(t);return this._updateSubscriptionRequests.push(e),this._requestUpdate(),e.resolver.promise}updateHighlight(t){const e=new Gl(t);return this._updateHighlightRequests.push(e),this._requestUpdate(),e.resolver.promise}async addParquetFile(t){return this._source.addParquetFile(t)}async onOverride(t){if(null!=this._updateOverridesRequest)throw new i.A("featurelayer","InternalError - Already processing an edit");this._updateOverridesRequest=new Gl(t);const e=this._updateOverridesRequest.resolver.promise;return this._requestUpdate(),e}queryStatistics(){return this._source.statistics.toJSON()}async queryVisibleFeatures(t,e){return this.features.executeQuery(t,e)}async queryHeatmapStatistics(t){const e=Math.round((0,l.Lz)(t.radius));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const r="string"==typeof t.fieldOffset,n=t.fieldOffset??0,o=Array.from(this._subscriptions.values()),a=this._source.chunks(),h=e**2,c=3/(Math.PI*h),u=2*e,d=Math.ceil(_.CQ/u);for(const e of o){const o=e.tile,l=new Float64Array(d*d);for(const e of a){const s=e.getTileReader(o);if(!s)continue;const i=s.getCursor();for(;i.next();){let e=1;if(null!=t.field){const s=i.readAttribute(t.field);e=r?-1*+s:+s+n}const s=i.readXForDisplay()/u,o=i.readYForDisplay()/u,a=Math.floor(s),_=Math.floor(o);if(a<0||_<0||a>=d||_>=d)continue;const p=((.5+a-s)*u)**2+((.5+_-o)*u)**2;if(p>h)continue;const f=e*(c*(1-p/h)**2);l[_+a*d]+=f}}for(let t=0;t<l.length;t++)s=Math.min(s,l[t]),i=Math.max(i,l[t])}return{max:i,min:s}}async getSampleFeatures(t){const e=this._source.chunks();if(e.reduce((t,e)=>t+e.size(),0)<=t.minFeatureCount){if(!this._source.updateTracking.updating){const t=[];return this._source.store.forEachUnsafe(e=>t.push(e.readLegacyFeatureWorldSpace())),t}return null}const s=new Set,i=[],r=e.map(t=>t.reader.getCursor()),n=new h.A,o=3*t.sampleSize;for(let a=0;a<o&&i.length<t.sampleSize;a++){const t=r[n.getIntRange(0,e.length-1)];if(0===t.getSize())continue;const o=n.getIntRange(0,t.getSize()-1);t.setIndex(o);const a=t.getObjectId();s.has(a)||(s.add(a),i.push(t.readLegacyFeatureWorldSpace()))}return i.length>=t.sampleSize?i:null}_requestUpdate(){this._updateRequested||(this._updateRequested=!0,(0,o.d)(()=>this._scheduleNextUpdate()))}_requestRefresh(){this._didSourceRefresh=!0,this._requestUpdate()}_scheduleNextUpdate(){this._updateRequested&&(this._ongoingUpdate||(this._ongoingUpdate=(0,u.oV)(this._doUpdate()).finally(()=>{this._ongoingUpdate=null,this._scheduleNextUpdate()}),this._updateRequested=!1))}_subscribe(t){const e=t.tileId;if(this._subscriptions.has(e))return;(0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.subscribe`);const s=new Dl(this._tileInfoView,e),i=new Ol(s,t.version);this._subscriptions.set(e,i),this._source.onSubscribe(i),this._processor.onSubscribe(i)}_unsubscribe(t){const e=this._subscriptions.get(t);e&&((0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.unsubscribe`),e.abort(),this._source.onUnsubscribe(e),this._processor.onUnsubscribe(e),this._subscriptions.delete(e.key.id))}async _doUpdate(){if((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateStart"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}),this._updateSubscriptionRequests.length){const t=this._updateSubscriptionRequests;this._updateSubscriptionRequests=[];for(const e of t)this._doUpdateSubscriptions(e.inner),e.resolver.resolve()}if(this._updateHighlightRequests.length){const t=this._updateHighlightRequests,e=new Set,s=new Set;for(const i of t)for(const{objectId:t,highlightFlags:r}of i.inner.highlights)r?(e.add(t),s.delete(t)):(s.add(t),e.delete(t));this._source.prepareCacheUpdate(e,s)}const t=this._updateSchemaRequest;this._updateSchemaRequest=null;let e=!1;if(null!=t){const{schema:s,version:i}=t.inner;e=await this._doUpdateSchema(s,i)}this._processor.requiresInvalidation()&&(e=!0),this._didSourceRefresh&&(e=!0,this._didSourceRefresh=!1),e&&(this._processor.invalidate(),await this._connection.container.updateRenderState(this._processor.version));const s=this._updateOverridesRequest;if(this._updateOverridesRequest=null,null!=s){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.applyOverride",s.inner),null!=s.inner.historicMoment&&this._source.unsafeSetQueryHistoricMoment(s.inner.historicMoment);const t=await this._source.normalizeOverrides(s.inner);this._source.applyOverride(t),(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.endOverride",s.inner)}if(await this._source.applyCacheUpdate(),this._updateHighlightRequests.length){const t=this._updateHighlightRequests;this._updateHighlightRequests=[];for(const e of t)this._processor.updateHighlight(e.inner),e.resolver.resolve()}const i=this._source.cleanup();this._processor.removeChunks(i);try{const t=this._source.takeOverrideUpdate();if(null!=t&&this._subscriptions.size){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesStart"),await this._connection.container.lockForOverrides();try{await this._processor.applyOverrideUpdate(t)}catch(t){(0,n.A)("esri-2d-update-debug")&&console.debug("InternalError",t)}await this._connection.container.unlockForOverrides(),(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesEnd")}this._subscriptions.size&&((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksStart"),await this._processor.updateChunks(),(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksEnd"))}catch(t){(0,a.jH)(t)}null!=s&&s.resolver.resolve(),null!=t&&t.resolver.resolve(),null==t&&e&&await this._connection.container.trySwapRenderState(),this._updateRequested?((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=true]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0})):((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=false, After flush]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:this._updateRequested}))}async _doUpdateSchema(t,e){(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${e}] Pipeline.updateStart`,{schema:t});const s={tileInfo:this._tileInfoView?.tileInfo},i=await this._source.update(t,e),r=Array.from(this._subscriptions.values()),o=this._processor.update(t,e,s,i,r);return(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${e}] Pipeline.updateEnd`),o}_doUpdateSubscriptions(t){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.updateSubscriptions",t);for(const e of t.subscribe)this._subscribe(e);for(const e of t.unsubscribe)this._unsubscribe(e)}}},5808:(t,e,s)=>{s.d(e,{O:()=>i});const i={geodesic:0,loxodrome:1,"great-elliptic":2,"normal-section":3,"shape-preserving":4}},6774:(t,e,s)=>{s.d(e,{O3:()=>n,Ox:()=>o,bR:()=>i});class i{constructor(t,e){this.x=t,this.y=e}static fromArray(t){return new i(t[0],t[1])}clone(){return new i(this.x,this.y)}equals(t,e){return t===this.x&&e===this.y}isEqual(t){return t.x===this.x&&t.y===this.y}setCoords(t,e){return this.x=t,this.y=e,this}normalize(){const t=this.x,e=this.y,s=Math.sqrt(t*t+e*e);return this.x/=s,this.y/=s,this}rightPerpendicular(){const t=this.x;return this.x=this.y,this.y=-t,this}leftPerpendicular(){const t=this.x;return this.x=-this.y,this.y=t,this}move(t,e){return this.x+=t,this.y+=e,this}assign(t){return this.x=t.x,this.y=t.y,this}assignAdd(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}assignSub(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}rotate(t,e){const s=this.x,i=this.y;return this.x=s*t-i*e,this.y=s*e+i*t,this}rotateReverse(t,e){const s=this.x,i=this.y;return this.x=s*t+i*e,this.y=-s*e+i*t,this}scale(t){return this.x*=t,this.y*=t,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}sub(t){return this.x-=t.x,this.y-=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}static distance(t,e){const s=e.x-t.x,i=e.y-t.y;return Math.sqrt(s*s+i*i)}static add(t,e){return new i(t.x+e.x,t.y+e.y)}static sub(t,e){return new i(t.x-e.x,t.y-e.y)}}class r{constructor(t,e,s){this.ratio=t,this.x=e,this.y=s}}class n{constructor(t,e,s,i=8,r=8){this._lines=[],this._starts=[],this.validateTessellation=!0,this._pixelRatio=i,this._pixelMargin=r,this._tileSize=512*i,this._dz=t,this._yPos=e,this._xPos=s}setPixelMargin(t){t!==this._pixelMargin&&(this._pixelMargin=t,this.setExtent(this._extent))}setExtent(t){this._extent=t,this._finalRatio=this._tileSize/t*(1<<this._dz);let e=this._pixelRatio*this._pixelMargin;e/=this._finalRatio;const s=t>>this._dz;e>s&&(e=s),this._margin=e,this._xmin=s*this._xPos-e,this._ymin=s*this._yPos-e,this._xmax=this._xmin+s+2*e,this._ymax=this._ymin+s+2*e}reset(t){this._type=t,this._lines=[],this._starts=[],this._line=null,this._start=0}moveTo(t,e){this._pushLine(),this._prevIsIn=this._isIn(t,e),this._moveTo(t,e,this._prevIsIn),this._prevPt=new i(t,e),this._firstPt=new i(t,e),this._dist=0}lineTo(t,e){const s=this._isIn(t,e),n=new i(t,e),o=i.distance(this._prevPt,n);let a,h,c,l,u,d,_,p;if(s)this._prevIsIn?this._lineTo(t,e,!0):(a=this._prevPt,h=n,c=this._intersect(h,a),this._start=this._dist+o*(1-this._r),this._lineTo(c.x,c.y,!0),this._lineTo(h.x,h.y,!0));else if(this._prevIsIn)h=this._prevPt,a=n,c=this._intersect(h,a),this._lineTo(c.x,c.y,!0),this._lineTo(a.x,a.y,!1);else{const t=this._prevPt,e=n;if(t.x<=this._xmin&&e.x<=this._xmin||t.x>=this._xmax&&e.x>=this._xmax||t.y<=this._ymin&&e.y<=this._ymin||t.y>=this._ymax&&e.y>=this._ymax)this._lineTo(e.x,e.y,!1);else{const s=[];if((t.x<this._xmin&&e.x>this._xmin||t.x>this._xmin&&e.x<this._xmin)&&(l=(this._xmin-t.x)/(e.x-t.x),p=t.y+l*(e.y-t.y),p<=this._ymin?d=!1:p>=this._ymax?d=!0:s.push(new r(l,this._xmin,p))),(t.x<this._xmax&&e.x>this._xmax||t.x>this._xmax&&e.x<this._xmax)&&(l=(this._xmax-t.x)/(e.x-t.x),p=t.y+l*(e.y-t.y),p<=this._ymin?d=!1:p>=this._ymax?d=!0:s.push(new r(l,this._xmax,p))),(t.y<this._ymin&&e.y>this._ymin||t.y>this._ymin&&e.y<this._ymin)&&(l=(this._ymin-t.y)/(e.y-t.y),_=t.x+l*(e.x-t.x),_<=this._xmin?u=!1:_>=this._xmax?u=!0:s.push(new r(l,_,this._ymin))),(t.y<this._ymax&&e.y>this._ymax||t.y>this._ymax&&e.y<this._ymax)&&(l=(this._ymax-t.y)/(e.y-t.y),_=t.x+l*(e.x-t.x),_<=this._xmin?u=!1:_>=this._xmax?u=!0:s.push(new r(l,_,this._ymax))),0===s.length)u?d?this._lineTo(this._xmax,this._ymax,!0):this._lineTo(this._xmax,this._ymin,!0):d?this._lineTo(this._xmin,this._ymax,!0):this._lineTo(this._xmin,this._ymin,!0);else if(s.length>1&&s[0].ratio>s[1].ratio)this._start=this._dist+o*s[1].ratio,this._lineTo(s[1].x,s[1].y,!0),this._lineTo(s[0].x,s[0].y,!0);else{this._start=this._dist+o*s[0].ratio;for(let t=0;t<s.length;t++)this._lineTo(s[t].x,s[t].y,!0)}this._lineTo(e.x,e.y,!1)}}this._dist+=o,this._prevIsIn=s,this._prevPt=n}close(){if(this._line.length>2){const t=this._firstPt,e=this._prevPt;t.x===e.x&&t.y===e.y||this.lineTo(t.x,t.y);const s=this._line;let i=s.length;for(;i>=4&&(s[0].x===s[1].x&&s[0].x===s[i-2].x||s[0].y===s[1].y&&s[0].y===s[i-2].y);)s.pop(),s[0].x=s[i-2].x,s[0].y=s[i-2].y,--i}}result(t=!0){return this._pushLine(),0===this._lines.length?null:(3===this._type&&t&&a.simplify(this._tileSize,this._margin*this._finalRatio,this._lines),this._lines)}resultWithStarts(){if(2!==this._type)throw new Error("Only valid for lines");this._pushLine();const t=this._lines,e=t.length;if(0===e)return null;const s=[];for(let i=0;i<e;i++)s.push({line:t[i],start:this._starts[i]||0});return s}_isIn(t,e){return t>=this._xmin&&t<=this._xmax&&e>=this._ymin&&e<=this._ymax}_intersect(t,e){let s,r,n;if(e.x>=this._xmin&&e.x<=this._xmax)r=e.y<=this._ymin?this._ymin:this._ymax,n=(r-t.y)/(e.y-t.y),s=t.x+n*(e.x-t.x);else if(e.y>=this._ymin&&e.y<=this._ymax)s=e.x<=this._xmin?this._xmin:this._xmax,n=(s-t.x)/(e.x-t.x),r=t.y+n*(e.y-t.y);else{r=e.y<=this._ymin?this._ymin:this._ymax,s=e.x<=this._xmin?this._xmin:this._xmax;const i=(s-t.x)/(e.x-t.x),o=(r-t.y)/(e.y-t.y);i<o?(n=i,r=t.y+i*(e.y-t.y)):(n=o,s=t.x+o*(e.x-t.x))}return this._r=n,new i(s,r)}_pushLine(){this._line&&(1===this._type?this._line.length>0&&(this._lines.push(this._line),this._starts.push(this._start)):2===this._type?this._line.length>1&&(this._lines.push(this._line),this._starts.push(this._start)):3===this._type&&this._line.length>3&&(this._lines.push(this._line),this._starts.push(this._start))),this._line=[],this._start=0}_moveTo(t,e,s){3!==this._type?s&&(t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line.push(new i(t,e))):(s||(t<this._xmin&&(t=this._xmin),t>this._xmax&&(t=this._xmax),e<this._ymin&&(e=this._ymin),e>this._ymax&&(e=this._ymax)),t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line.push(new i(t,e)),this._isH=!1,this._isV=!1)}_lineTo(t,e,s){let r,n;if(3!==this._type)if(s){if(t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line.length>0&&(r=this._line[this._line.length-1],r.equals(t,e)))return;this._line.push(new i(t,e))}else this._line&&this._line.length>0&&this._pushLine();else if(s||(t<this._xmin&&(t=this._xmin),t>this._xmax&&(t=this._xmax),e<this._ymin&&(e=this._ymin),e>this._ymax&&(e=this._ymax)),t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line&&this._line.length>0){r=this._line[this._line.length-1];const s=r.x===t,o=r.y===e;if(s&&o)return;this._isH&&s||this._isV&&o?(r.x=t,r.y=e,n=this._line[this._line.length-2],n.x===t&&n.y===e?(this._line.pop(),this._line.length<=1?(this._isH=!1,this._isV=!1):(n=this._line[this._line.length-2],this._isH=n.x===t,this._isV=n.y===e)):(this._isH=n.x===t,this._isV=n.y===e)):(this._line.push(new i(t,e)),this._isH=s,this._isV=o)}else this._line.push(new i(t,e))}}class o{setExtent(t){this._ratio=4096===t?1:4096/t}get validateTessellation(){return this._ratio<1}reset(t){this._lines=[],this._line=null}moveTo(t,e){this._line&&this._lines.push(this._line),this._line=[];const s=this._ratio;this._line.push(new i(t*s,e*s))}lineTo(t,e){const s=this._ratio;this._line.push(new i(t*s,e*s))}close(){const t=this._line;t&&!t[0].isEqual(t[t.length-1])&&t.push(t[0])}result(){return this._line&&this._lines.push(this._line),0===this._lines.length?null:this._lines}}class a{static simplify(t,e,s){if(!s)return;const i=-e,r=t+e,n=-e,o=t+e,h=[],c=[],l=s.length;for(let t=0;t<l;++t){const e=s[t];if(!e||e.length<2)continue;let a,l=e[0];const u=e.length;for(let s=1;s<u;++s)a=e[s],l.x===a.x&&(l.x<=i&&(l.y>a.y?(h.push(t),h.push(s),h.push(0),h.push(-1)):(c.push(t),c.push(s),c.push(0),c.push(-1))),l.x>=r&&(l.y<a.y?(h.push(t),h.push(s),h.push(1),h.push(-1)):(c.push(t),c.push(s),c.push(1),c.push(-1)))),l.y===a.y&&(l.y<=n&&(l.x<a.x?(h.push(t),h.push(s),h.push(2),h.push(-1)):(c.push(t),c.push(s),c.push(2),c.push(-1))),l.y>=o&&(l.x>a.x?(h.push(t),h.push(s),h.push(3),h.push(-1)):(c.push(t),c.push(s),c.push(3),c.push(-1)))),l=a}if(0===h.length||0===c.length)return;a.fillParent(s,c,h),a.fillParent(s,h,c);const u=[];a.calcDeltas(u,c,h),a.calcDeltas(u,h,c),a.addDeltas(u,s)}static fillParent(t,e,s){const i=s.length,r=e.length;for(let n=0;n<r;n+=4){const r=e[n],o=e[n+1],a=e[n+2],c=t[r][o-1],l=t[r][o];let u=8092,d=-1;for(let e=0;e<i;e+=4){if(s[e+2]!==a)continue;const i=s[e],r=s[e+1],n=t[i][r-1],o=t[i][r];switch(a){case 0:case 1:if(h(c.y,n.y,o.y)&&h(l.y,n.y,o.y)){const t=Math.abs(o.y-n.y);t<u&&(u=t,d=e)}break;case 2:case 3:if(h(c.x,n.x,o.x)&&h(l.x,n.x,o.x)){const t=Math.abs(o.x-n.x);t<u&&(u=t,d=e)}}}e[n+3]=d}}static calcDeltas(t,e,s){const i=e.length;for(let r=0;r<i;r+=4){const i=[],n=a.calcDelta(r,e,s,i);t.push(e[r]),t.push(e[r+1]),t.push(e[r+2]),t.push(n)}}static calcDelta(t,e,s,i){const r=e[t+3];if(-1===r)return 0;const n=i.length;return n>1&&i[n-2]===r?0:(i.push(r),a.calcDelta(r,s,e,i)+1)}static addDeltas(t,e){const s=t.length;let i=0;for(let e=0;e<s;e+=4){const s=t[e+3];s>i&&(i=s)}for(let r=0;r<s;r+=4){const s=e[t[r]],n=t[r+1],o=i-t[r+3];switch(t[r+2]){case 0:s[n-1].x-=o,s[n].x-=o,1===n&&(s[s.length-1].x-=o),n===s.length-1&&(s[0].x-=o);break;case 1:s[n-1].x+=o,s[n].x+=o,1===n&&(s[s.length-1].x+=o),n===s.length-1&&(s[0].x+=o);break;case 2:s[n-1].y-=o,s[n].y-=o,1===n&&(s[s.length-1].y-=o),n===s.length-1&&(s[0].y-=o);break;case 3:s[n-1].y+=o,s[n].y+=o,1===n&&(s[s.length-1].y+=o),n===s.length-1&&(s[0].y+=o)}}}}const h=(t,e,s)=>t>=e&&t<=s||t>=s&&t<=e},9775:(t,e,s)=>{s.d(e,{A:()=>n});var i=s(62788),r=s(95488);class n{constructor(t=t=>t.values().next().value){this._peeker=t,this._observable=new r.I,this._items=new Set}get length(){return(0,i.gc)(this._observable),this._items.size}clear(){0!==this.length&&(this._items.clear(),this._observable.notify())}last(){if(0===this.length)return;let t;for(t of this._items);return t}peek(){if(0!==this.length)return this._peeker(this._items)}push(t){this.contains(t)||(this._items.add(t),this._observable.notify())}contains(t){return(0,i.gc)(this._observable),this._items.has(t)}pop(){if(0===this.length)return;const t=this.peek();return this._items.delete(t),this._observable.notify(),t}popLast(){if(0===this.length)return;const t=this.last();return this._items.delete(t),this._observable.notify(),t}remove(t){this.contains(t)&&(this._items.delete(t),this._observable.notify())}filter(t){const e=this.length;return this._items.forEach(e=>{t(e)||this._items.delete(e)}),e!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){(0,i.gc)(this._observable),yield*this._items}}},10382:(t,e,s)=>{s.d(e,{A:()=>c});var i=s(36563),r=(s(44208),s(74887)),n=s(9775),o=s(72457),a=s(52268),h=s(61322);class c{constructor(){this._inUseClients=new Array,this._clients=new Array,this._clientPromises=new Array,this._ongoingJobsQueue=new n.A,this._ongoingLowPriorityJobsQueue=new n.A}destroy(){this.close()}get closed(){return!this._clients?.length}open(t,e){return new Promise((s,i)=>{let n=!0;const o=t=>{(0,r.Te)(e.signal),n&&(n=!1,t())};this._clients.length=t.length,this._clientPromises.length=t.length,this._inUseClients.length=t.length;for(let n=0;n<t.length;++n){const a=t[n];(0,r.$X)(a)?this._clientPromises[n]=a.then(t=>(this._clients[n]=new h.default(t,e,this._ongoingJobsQueue,this._ongoingLowPriorityJobsQueue),o(s),this._clients[n]),()=>(o(i),null)):(this._clients[n]=new h.default(a,e,this._ongoingJobsQueue,this._ongoingLowPriorityJobsQueue),this._clientPromises[n]=Promise.resolve(this._clients[n]),o(s))}})}broadcast(t,e,s){const i=new Array(this._clientPromises.length);for(let r=0;r<this._clientPromises.length;++r){const n=this._clientPromises[r];i[r]=n.then(i=>i?.invoke(t,e,s))}return i}close(){let t;for(;t=this._ongoingJobsQueue.pop();)t.resolver.reject((0,r.NK)(`Worker closing, aborting job calling '${t.methodName}'`));for(;t=this._ongoingLowPriorityJobsQueue.pop();)t.resolver.reject((0,r.NK)(`Worker closing, aborting job calling '${t.methodName}'`));for(const t of this._clientPromises)t.then(t=>t?.close());this._clients.length=0,this._clientPromises.length=0,this._inUseClients.length=0,(0,o.h)(this)}invoke(t,e,s){return this.apply(t,[e],s)}apply(t,e,s){const i=(0,r.Tw)();("low"===s?.priority?this._ongoingLowPriorityJobsQueue:this._ongoingJobsQueue).push({methodName:t,data:e,invokeOptions:s,resolver:i});for(let t=0;t<this._clientPromises.length;t++){const e=this._clients[t];e?e.jobAdded():this._clientPromises[t].then(t=>t?.jobAdded())}return i.promise}createInvokeProxy(t){return(0,a.L)(this,t)}on(t,e){return Promise.all(this._clientPromises).then(()=>(0,i.vE)(this._clients.map(s=>s.on(t,e))))}openPorts(){return new Promise(t=>{const e=new Array(this._clientPromises.length);let s=e.length;for(let i=0;i<this._clientPromises.length;++i)this._clientPromises[i].then(r=>{r&&(e[i]=r.openPort()),0===--s&&t(e)})})}get test(){}}},13069:(t,e,s)=>{s.d(e,{AG:()=>a,lk:()=>r,vD:()=>o,yS:()=>n});const i="randomUUID"in crypto;function r(){if(i)return crypto.randomUUID();const t=crypto.getRandomValues(new Uint16Array(8));t[3]=4095&t[3]|16384,t[4]=16383&t[4]|32768;const e=e=>t[e].toString(16).padStart(4,"0");return e(0)+e(1)+"-"+e(2)+"-"+e(3)+"-"+e(4)+"-"+e(5)+e(6)+e(7)}function n(){return`{${r().toUpperCase()}}`}function o(){return`{${r()}}`}function a(t){const e=t.toUpperCase();return"{"!==t[0]?`{${e}}`:e}},13195:(t,e,s)=>{s.d(e,{GW:()=>m,IU:()=>b,Jo:()=>o,MG:()=>n,Wh:()=>d,cP:()=>I,os:()=>l,p6:()=>f,pJ:()=>a,ru:()=>v,s3:()=>w,wV:()=>p,yM:()=>S,z0:()=>_});var i=s(95108),r=s(6774);const n=Number.POSITIVE_INFINITY,o=Math.PI,a=2*o,h=128/o,c=256/360,l=o/180,u=1/Math.LN2;function d(t,e){return(t%=e)>=0?t:t+e}function _(t){return d(t*h,256)}function p(t){return d(t*c,256)}function f(t){return Math.log(t)*u}function m(t,e,s){return t*(1-s)+e*s}const g=8,y=14,x=16;function b(t){return g+Math.max((t-y)*x,0)}function w(t,e,s){let i,r,n,o=0;for(const a of s){i=a.length;for(let s=1;s<i;++s)r=a[s-1],n=a[s],r.y>e!=n.y>e&&((n.x-r.x)*(e-r.y)-(n.y-r.y)*(t-r.x)>0?o++:o--)}return 0!==o}function v(t,e,s,r){let n,o,a,h;const c=r*r;for(const r of s){const s=r.length;if(!(s<2)){n=r[0].x,o=r[0].y;for(let l=1;l<s;++l){if(a=r[l].x,h=r[l].y,(0,i.Ng)(t,e,n,o,a,h)<c)return!0;n=a,o=h}}}return!1}function I(t,e){if(0===e||Number.isNaN(e))return t;const s=[],i=new r.bR(0,0),n=new r.bR(0,0),o=new r.bR(0,0);for(let a=0;a<t.length;a++){const h=t[a],c=[];for(let t=0;t<h.length;t++){const s=h[t-1],a=h[t],l=h[t+1];0===t?i.setCoords(0,0):i.assignSub(a,s).normalize().rightPerpendicular(),t===h.length-1?n.setCoords(0,0):n.assignSub(l,a).normalize().rightPerpendicular(),o.assignAdd(i,n).normalize();const u=o.x*n.x+o.y*n.y;0!==u&&o.scale(1/u),c.push(r.bR.add(a,o.scale(e)))}s.push(c)}return s}function S(t,e,s,i){const n=new r.bR(t[0],t[1]);if(n.scale(i),"viewport"===e){const t=-s*(Math.PI/180),e=Math.cos(t),i=Math.sin(t);n.rotate(e,i)}return n}},18047:(t,e,s)=>{s.d(e,{ZV:()=>h,yx:()=>a});var i=s(73444);const r={ar:"ar-u-nu-latn",bs:"sr-Latn-CS",nn:"no-NN"};let n=new WeakMap,o={};function a(t={}){const e={};return null!=t.digitSeparator&&(e.useGrouping=t.digitSeparator),null!=t.places&&(e.minimumFractionDigits=e.maximumFractionDigits=t.places),e}function h(t,e){return Object.is(t,-0)&&(t=0),function(t){const e=t||o;if(!n.has(e)){const s=(0,i.lR)(),o=s&&r[s]||(0,i.QC)();n.set(e,new Intl.NumberFormat(o,t))}return n.get(e)}(e).format(t)}(0,i.Ml)(()=>{n=new WeakMap,o={}}),new Map},30624:(t,e,s)=>{s.r(e),s.d(e,{createConnection:()=>I});var i=s(31635),r=s(78888),n=s(49186),o=s(53966),a=s(74887),h=s(84952),c=(s(44208),s(87811),s(40608)),l=s(16930),u=s(65864),d=s(10107),_=s(62815),p=s(65529);let f=class extends p.A.EventedAccessor{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new n.A("stream-connection",this.errorString):null}onFeature(t){this.emit("data-received",t)}onMessage(t){this.emit("message-received",t)}};(0,i.Cg)([(0,d.MZ)({readOnly:!0})],f.prototype,"connectionError",null),f=(0,i.Cg)([(0,c.$)("esri.layers.support.StreamConnection")],f);let m=class extends f{constructor(t){super({}),this._outstandingMessages=[],this.errorString=null;const{geometryType:e,spatialReference:s,sourceSpatialReference:i}=t;this._config=t,this._featureZScaler=(0,_.N)(e,i,s),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),null!=this._websocket&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(null==this._websocket)return"disconnected";switch(this._websocket.readyState){case 0:case 1:return"connected";case 2:case 3:return"disconnected"}}sendMessageToSocket(t){null!=this._websocket?this._websocket.send(JSON.stringify(t)):this._outstandingMessages.push(t)}sendMessageToClient(t){this._onMessage(t)}updateCustomParameters(t){this._config.customParameters=t,null!=this._websocket&&this._websocket.close()}async _tryCreateWebSocket(t=this._config.source.path,e=1e3,s=0){try{if(this.destroyed)return;const e=(0,h.a6)(t,this._config.customParameters??{});this._websocket=await this._createWebSocket(e),this.notifyChange("connectionStatus")}catch(i){const r=e/1e3;return this._config.maxReconnectionAttempts&&s>=this._config.maxReconnectionAttempts?(o.A.getLogger(this).error(new n.A("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(o.A.getLogger(this).error(new n.A("websocket-connection",`Failed to connect. Attempting to reconnect in ${r}s`,i)),await(0,a.Pl)(e),this._tryCreateWebSocket(t,Math.min(1.5*e,1e3*this._config.maxReconnectionInterval),s+1))}}_setWebSocketJSONParseHandler(t){t.onmessage=t=>{try{const e=JSON.parse(t.data);this._onMessage(e)}catch(t){return void o.A.getLogger(this).error(new n.A("websocket-connection","Failed to parse message, invalid JSON",{error:t}))}}}_createWebSocket(t){return new Promise((e,s)=>{const i=new WebSocket(t);i.onopen=()=>{if(i.onopen=null,this.destroyed)return i.onclose=null,void i.close();i.onclose=t=>this._onClose(t),i.onerror=t=>this._onError(t),this._setWebSocketJSONParseHandler(i),e(i)},i.onclose=t=>{i.onopen=i.onclose=null,s(t)}})}async _handshake(t=1e4){const e=this._websocket;if(null==e)return;const s=(0,a.Tw)(),i=e.onmessage,{filter:r,outFields:h,spatialReference:c}=this._config;return s.timeout(t),e.onmessage=t=>{let a=null;try{a=JSON.parse(t.data)}catch(t){}a&&"object"==typeof a||(o.A.getLogger(this).error(new n.A("websocket-connection","Protocol violation. Handshake failed - malformed message",t.data)),s.reject(),this.destroy()),a.spatialReference?.wkid!==c?.wkid&&(o.A.getLogger(this).error(new n.A("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${c.wkid}`,t.data)),s.reject(),this.destroy()),"json"!==a.format&&(o.A.getLogger(this).error(new n.A("websocket-connection","Protocol violation. Handshake failed - format is not set",t.data)),s.reject(),this.destroy()),r&&a.filter!==r&&o.A.getLogger(this).error(new n.A("websocket-connection","Tried to set filter, but server doesn't support it")),h&&a.outFields!==h&&o.A.getLogger(this).error(new n.A("websocket-connection","Tried to set outFields, but server doesn't support it")),e.onmessage=i;for(const t of this._outstandingMessages)e.send(JSON.stringify(t));this._outstandingMessages=[],s.resolve()},e.send(JSON.stringify({filter:r,outFields:h,format:"json",spatialReference:{wkid:c.wkid}})),s.promise}_onMessage(t){if(this.onMessage(t),"type"in t)switch(t.type){case"features":case"featureResult":for(const e of t.features)null!=this._featureZScaler&&this._featureZScaler(e.geometry),this.onFeature(e)}}_onError(t){const e="Encountered an error over WebSocket connection";this._set("errorString",e),o.A.getLogger(this).error("websocket-connection",e)}_onClose(t){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==t.code&&o.A.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${t.code}`),this.destroyed||this._open()}};(0,i.Cg)([(0,d.MZ)()],m.prototype,"connectionStatus",null),(0,i.Cg)([(0,d.MZ)()],m.prototype,"errorString",void 0),m=(0,i.Cg)([(0,c.$)("esri.layers.graphics.sources.connections.WebSocketConnection")],m);var g=s(80893),y=s(61956);const x={maxQueryDepth:5,maxRecordCountFactor:3};let b=class extends m{constructor(t){super({...x,...t}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const t=await this._fetchServiceDefinition(this._config.source);t.timeInfo.trackIdField||o.A.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const e=this._fetchWebSocketUrl(t.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(e);const{filter:s,outFields:i}=this._config;this.destroyed||this._setFilter(s,i)}_onMessage(t){if("attributes"in t){let e;try{e=this._enrich(t),null!=this._featureZScaler&&this._featureZScaler(e.geometry)}catch(t){return void o.A.getLogger(this).error(new n.A("geoevent-connection","Failed to parse message",t))}this.onFeature(e)}else this.onMessage(t)}async _fetchServiceDefinition(t){const e={f:"json",...this._config.customParameters},s=(0,r.A)(t.path,{query:e,responseType:"json"}),i=(await s).data;return this._serviceDefinition=i,i}_fetchWebSocketUrl(t,e){const s=t[0],{urls:i,token:r}=s,n=this._inferWebSocketBaseUrl(i);return(0,h.a6)(`${n}/subscribe`,{outSR:""+e.wkid,token:r})}_inferWebSocketBaseUrl(t){if(1===t.length)return t[0];for(const e of t)if(e.includes("wss"))return e;return o.A.getLogger(this).error(new n.A("geoevent-connection","Unable to infer WebSocket url",t)),null}async _setFilter(t,e){const s=this._websocket;if(null==s||null==t&&null==e)return;const i=JSON.stringify({filter:this._serializeFilter(t,e)});let r=!1;const h=(0,a.Tw)();return s.onmessage=t=>{const e=JSON.parse(t.data);e.filter&&(e.error&&(o.A.getLogger(this).error(new n.A("geoevent-connection","Failed to set service filter",e.error)),this._set("errorString",`Could not set service filter - ${e.error}`),h.reject(e.error)),this._setWebSocketJSONParseHandler(s),r=!0,h.resolve())},s.send(i),setTimeout(()=>{r||(this.destroyed||this._websocket!==s||o.A.getLogger(this).error(new n.A("geoevent-connection","Server timed out when setting filter")),h.reject())},1e4),h.promise}_serializeFilter(t,e){const s={};if(null==t&&null==e)return s;if(t?.geometry)try{const e=(0,u.rS)(t.geometry);if("extent"!==e.type)throw new n.A("geoevent-connection",`Expected extent but found type ${e.type}`);s.geometry=JSON.stringify(e.shiftCentralMeridian())}catch(t){o.A.getLogger(this).error(new n.A("geoevent-connection","Encountered an error when setting connection geometryDefinition",t))}return t?.where&&"1 = 1"!==t.where&&"1=1"!==t.where&&(s.where=t.where),null!=e&&(s.outFields=e.join(",")),s}_enrich(t){if(!this._relatedFeatures)return t;const e=this._serviceDefinition.relatedFeatures.joinField,s=t.attributes[e],i=this._relatedFeatures.get(s);if(!i)return o.A.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",t),t;const{attributes:r,geometry:a}=i;for(const e in r)t.attributes[e]=r[e];return a&&(t.geometry=a),t.geometry||t.centroid||o.A.getLogger(this).error(new n.A("geoevent-connection","Found malformed feature - no geometry found",t)),t}async _queryBuddyServices(){try{const{relatedFeatures:t,keepLatestArchive:e}=this._serviceDefinition,s=this._queryRelatedFeatures(t),i=this._queryArchive(e);await s;const r=await i;if(!r)return;for(const t of r.features)this.onFeature(this._enrich(t))}catch(t){o.A.getLogger(this).error(new n.A("geoevent-connection","Encountered an error when querying buddy services",{error:t}))}}async _queryRelatedFeatures(t){if(!t)return;const e=await this._queryBuddy(t.featuresUrl);this._addRelatedFeatures(e)}async _queryArchive(t){if(t)return this._queryBuddy(t.featuresUrl)}async _queryBuddy(t){const e=new((await Promise.all([s.e(6131),s.e(8219),s.e(8948),s.e(3910),s.e(13),s.e(1214),s.e(9953),s.e(4796),s.e(3029),s.e(4111),s.e(8506),s.e(3600),s.e(812),s.e(655),s.e(6719)]).then(s.bind(s,13600))).default)({url:t}),{capabilities:i}=await e.load(),r=i.query.supportsMaxRecordCountFactor,n=i.query.supportsPagination,o=i.query.supportsCentroid,a=this._config.maxRecordCountFactor,h=e.capabilities.query.maxRecordCount,c=r?h*a:h,u=new y.A;if(u.outFields=this._config.outFields??["*"],u.where=this._config.filter?.where??"1=1",u.returnGeometry=!0,u.returnExceededLimitFeatures=!0,u.outSpatialReference=l.A.fromJSON(this._config.spatialReference),o&&(u.returnCentroid=!0),r&&(u.maxRecordCountFactor=a),n)return u.num=c,e.destroy(),this._queryPages(t,u);const d=await(0,g.eW)(t,u,this._config.sourceSpatialReference);return e.destroy(),d.data}async _queryPages(t,e,s=[],i=0){e.start=null!=e.num?i*e.num:null;const{data:r}=await(0,g.eW)(t,e,this._config.sourceSpatialReference);return r.exceededTransferLimit&&i<(this._config.maxQueryDepth??0)?(r.features.forEach(t=>s.push(t)),this._queryPages(t,e,s,i+1)):(s.forEach(t=>r.features.push(t)),r)}_addRelatedFeatures(t){const e=new Map,s=t.features,i=this._serviceDefinition.relatedFeatures.joinField;for(const t of s){const s=t.attributes[i];e.set(s,t)}this._relatedFeatures=e}};b=(0,i.Cg)([(0,c.$)("esri.layers.graphics.sources.connections.GeoEventConnection")],b);let w=class extends f{constructor(t){super({}),this.connectionStatus="connected",this.errorString=null;const{geometryType:e,spatialReference:s,sourceSpatialReference:i}=t;this._featureZScaler=(0,_.N)(e,i,s)}normalizeCtorArgs(){return{}}updateCustomParameters(t){}sendMessageToSocket(t){}sendMessageToClient(t){if("type"in t)switch(t.type){case"features":case"featureResult":for(const e of t.features)null!=this._featureZScaler&&this._featureZScaler(e.geometry),this.onFeature(e)}this.onMessage(t)}};function v(t,e){if(null==t&&null==e)return null;const s={};return null!=e&&(s.geometry=e),null!=t&&(s.where=t),s}function I(t,e,s,i,r,n,o,a,h){const c={source:t,sourceSpatialReference:e,spatialReference:s,geometryType:i,filter:v(r,n),maxReconnectionAttempts:o,maxReconnectionInterval:a,customParameters:h};return t?t.path.startsWith("wss://")||t.path.startsWith("ws://")?new m(c):new b(c):new w(c)}(0,i.Cg)([(0,d.MZ)()],w.prototype,"connectionStatus",void 0),(0,i.Cg)([(0,d.MZ)()],w.prototype,"errorString",void 0),w=(0,i.Cg)([(0,c.$)("esri.layers.support.ClientSideConnection")],w)},32730:(t,e,s)=>{s.d(e,{BI:()=>m,D3:()=>p,XJ:()=>f,lc:()=>_,mX:()=>y,rU:()=>g,tH:()=>I});var i=s(799);const r="__begin__",n="__end__",o=new RegExp(r,"ig"),a=new RegExp(n,"ig"),h=new RegExp("^"+r,"i"),c=new RegExp(n+"$","i"),l='"',u=l+" + ",d=" + "+l;function _(t){return t.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function p(t){return t.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function f(t){const e={expression:"",type:"none"};return t.labelExpressionInfo?t.labelExpressionInfo.value?(e.expression=t.labelExpressionInfo.value,e.type="conventional"):t.labelExpressionInfo.expression&&(e.expression=t.labelExpressionInfo.expression,e.type="arcade"):null!=t.labelExpression&&(e.expression=_(t.labelExpression),e.type="conventional"),e}function m(t){const e=f(t);if(!e)return null;switch(e.type){case"conventional":return y(e.expression);case"arcade":return e.expression}return null}function g(t){const e=f(t);if(!e)return null;switch(e.type){case"conventional":return function(t){const e=t?.match(x);return e?.[1].trim()||null}(e.expression);case"arcade":return I(e.expression)}return null}function y(t){let e;return t?(e=(0,i.HC)(t,t=>r+'$feature["'+t+'"]'+n),e=h.test(e)?e.replace(h,""):l+e,e=c.test(e)?e.replace(c,""):e+l,e=e.replaceAll(o,u).replaceAll(a,d)):e='""',e}const x=/^\s*\{([^}]+)\}\s*$/i,b=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,w=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,v=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function I(t){if(!t)return null;let e=b.exec(t)||w.exec(t);return e?e[1]||e[3]:(e=v.exec(t),e?e[2]:null)}},37585:(t,e,s)=>{s.d(e,{C:()=>r,Cc:()=>m,Io:()=>u,S8:()=>f,WQ:()=>o,aI:()=>b,e$:()=>y,hZ:()=>n,hs:()=>l,jb:()=>v,l0:()=>g,t2:()=>x});var i=s(34304);function r(t,e){return t[0]=e[0],t[1]=e[1],t}function n(t,e,s){return t[0]=e,t[1]=s,t}function o(t,e,s){return t[0]=e[0]+s[0],t[1]=e[1]+s[1],t}function a(t,e,s){return t[0]=e[0]-s[0],t[1]=e[1]-s[1],t}function h(t,e,s){return t[0]=e[0]*s[0],t[1]=e[1]*s[1],t}function c(t,e,s){return t[0]=e[0]/s[0],t[1]=e[1]/s[1],t}function l(t,e,s){return t[0]=e[0]*s,t[1]=e[1]*s,t}function u(t,e){const s=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(s*s+i*i)}function d(t,e){const s=e[0]-t[0],i=e[1]-t[1];return s*s+i*i}function _(t){const e=t[0],s=t[1];return Math.sqrt(e*e+s*s)}function p(t){const e=t[0],s=t[1];return e*e+s*s}function f(t,e){const s=e[0],i=e[1];let r=s*s+i*i;return r>0&&(r=1/Math.sqrt(r),t[0]=e[0]*r,t[1]=e[1]*r),t}function m(t,e,s,i){const r=e[0],n=e[1];return t[0]=r+i*(s[0]-r),t[1]=n+i*(s[1]-n),t}function g(t,e,s){const i=e[0],r=e[1];return t[0]=s[0]*i+s[2]*r+s[4],t[1]=s[1]*i+s[3]*r+s[5],t}function y(t,e,s,i){const r=e[0]-s[0],n=e[1]-s[1],o=Math.sin(i),a=Math.cos(i);return t[0]=r*a-n*o+s[0],t[1]=r*o+n*a+s[1],t}function x(t,e){return t[0]===e[0]&&t[1]===e[1]}function b(t,e){const s=t[0],r=t[1],n=e[0],o=e[1],a=(0,i.FD)();return Math.abs(s-n)<=a*Math.max(1,Math.abs(s),Math.abs(n))&&Math.abs(r-o)<=a*Math.max(1,Math.abs(r),Math.abs(o))}const w=_,v=a,I=h,S=c,P=u,M=d,C=p;Object.freeze(Object.defineProperty({__proto__:null,add:o,angle:function(t,e){const s=t[0],i=t[1],r=e[0],n=e[1];let o=s*s+i*i;o>0&&(o=1/Math.sqrt(o));let a=r*r+n*n;a>0&&(a=1/Math.sqrt(a));const h=(s*r+i*n)*o*a;return h>1?0:h<-1?Math.PI:Math.acos(h)},ceil:function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},copy:r,cross:function(t,e,s){const i=e[0]*s[1]-e[1]*s[0];return t[0]=t[1]=0,t[2]=i,t},dist:P,distance:u,div:S,divide:c,dot:function(t,e){return t[0]*e[0]+t[1]*e[1]},equals:b,exactEquals:x,floor:function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},inverse:function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},len:w,length:_,lerp:m,max:function(t,e,s){return t[0]=Math.max(e[0],s[0]),t[1]=Math.max(e[1],s[1]),t},min:function(t,e,s){return t[0]=Math.min(e[0],s[0]),t[1]=Math.min(e[1],s[1]),t},mul:I,multiply:h,negate:function(t,e){return t[0]=-e[0],t[1]=-e[1],t},normalize:f,projectAndScale:function(t,e,s,i,r){let n=e[0]-s[0],o=e[1]-s[1];const a=(i[0]*n+i[1]*o)*(r-1);return n=i[0]*a,o=i[1]*a,t[0]=e[0]+n,t[1]=e[1]+o,t},random:function(t,e=1){const s=2*(0,i.Ov)()*Math.PI;return t[0]=Math.cos(s)*e,t[1]=Math.sin(s)*e,t},rotate:y,round:function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},scale:l,scaleAndAdd:function(t,e,s,i){return t[0]=e[0]+s[0]*i,t[1]=e[1]+s[1]*i,t},set:n,sqrDist:M,sqrLen:C,squaredDistance:d,squaredLength:p,str:function(t){return"vec2("+t[0]+", "+t[1]+")"},sub:v,subtract:a,transformMat2:function(t,e,s){const i=e[0],r=e[1];return t[0]=s[0]*i+s[2]*r,t[1]=s[1]*i+s[3]*r,t},transformMat2d:g,transformMat3:function(t,e,s){const i=e[0],r=e[1];return t[0]=s[0]*i+s[3]*r+s[6],t[1]=s[1]*i+s[4]*r+s[7],t},transformMat4:function(t,e,s){const i=e[0],r=e[1];return t[0]=s[0]*i+s[4]*r+s[12],t[1]=s[1]*i+s[5]*r+s[13],t}},Symbol.toStringTag,{value:"Module"}))},37730:(t,e,s)=>{s.d(e,{T:()=>r});var i=s(43334);const r={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(t,e)=>new i.Om(e,t.attributes,null,t.objectId),getGeometry:t=>t.geometry,getCentroid:(t,e)=>t.ensureCentroid(e)}},39516:(t,e,s)=>{let i;async function r(){return null==i&&(i=Promise.all([s.e(8368),s.e(4123)]).then(s.bind(s,44123)).then(t=>new t.WhereClauseCache(500,500))),i}async function n(t,e){const s=await r(),i=s.get(t,e);if(null==i)throw s.getError(t,e);return i}function o(t,e){return t||=null,e||=null,"1=1"===t?e??t:"1=1"===e?t??e:t&&e?`(${t}) AND (${e})`:t??e}function a(t,e){return t||=null,e||=null,"1=1"===t||"1=1"===e||t===e?"1=1"===t?t:e:t&&e?`(${t}) OR (${e})`:t??e}s.d(e,{GP:()=>n,IW:()=>a,mA:()=>o})},44159:(t,e,s)=>{s.d(e,{A:()=>r});var i=s(93687);class r{static{this.pool=new i.A(r,null,null,25,50)}static getId(t,e,s,i){return"object"==typeof t?`${t.level}/${t.row}/${t.col}/${t.world}`:`${t}/${e}/${s}/${i}`}constructor(t,e,s,i){this.set(t,e,s,i)}get key(){return this}get id(){return this.toString()}get normalizedId(){return`${this.level}/${this.row}/${this.col}`}set id(t){this.set(t)}get hash(){const t=4095&this.row,e=4095&this.col,s=63&this.level;return(3&this.world)<<30|e<<22|t<<8|s}acquire(t,e,s,i){this.set(t,e,s,i)}contains(t){const e=t.level-this.level;return e>=0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}containsChild(t){const e=t.level-this.level;return e>0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}equals(t){return this.level===t.level&&this.row===t.row&&this.col===t.col&&this.world===t.world}clone(){return new r(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(t,e,s,i){if(null==t)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof t)this.level=t.level||0,this.row=t.row||0,this.col=t.col||0,this.world=t.world||0;else if("string"==typeof t){const[e,s,i,r]=t.split("/");this.level=parseFloat(e),this.row=parseFloat(s),this.col=parseFloat(i),this.world=parseFloat(r)}else this.level=+t,this.row=+e,this.col=+s,this.world=+i||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new r(this.level-1,this.row>>1,this.col>>1,this.world)}getNormalizedNeighbor(t,e,s){const i=this.clone();return i.col+=t,i.row+=e,s.normalizeKey(i),i}getChildKeys(){const t=this.level+1,e=this.row<<1,s=this.col<<1,i=this.world;return[new r(t,e,s,i),new r(t,e,s+1,i),new r(t,e+1,s,i),new r(t,e+1,s+1,i)]}compareRowMajor(t){return this.row<t.row?-1:this.row>t.row?1:this.col<t.col?-1:this.col>t.col?1:0}}},46140:(t,e,s)=>{s.d(e,{R:()=>r});var i=s(49186);let r=class t{constructor(t,e,s=""){this.major=t,this.minor=e,this._context=s}lessThan(t,e){return this.major<t||t===this.major&&this.minor<e}greaterEqual(t,e){return!this.lessThan(t,e)}validate(t){if(this.major!==t.major){const e=this._context&&this._context+":",s=this._context&&this._context+" ";throw new i.A(e+"unsupported-version",`Required major ${s}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:t})}}clone(){return new t(this.major,this.minor,this._context)}static parse(e,s=""){const[r,n]=e.split("."),o=/^\s*\d+\s*$/;if(!r?.match||!o.test(r))throw new i.A((s&&s+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!n?.match||!o.test(n))throw new i.A((s&&s+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const a=parseInt(r,10),h=parseInt(n,10);return new t(a,h,s)}}},48163:(t,e,s)=>{function i(){return[0,0]}function r(t){return[t[0],t[1]]}function n(t,e){return[t,e]}function o(){return n(1,1)}function a(){return n(1,0)}function h(){return n(0,1)}s.d(e,{Un:()=>c,fA:()=>n,o8:()=>r,vt:()=>i});const c=o(),l=a(),u=h();Object.freeze(Object.defineProperty({__proto__:null,ONES:c,UNIT_X:l,UNIT_Y:u,ZEROS:[0,0],clone:r,create:i,freeze:function(t,e){return[t,e]},fromArray:function(t,e=[0,0]){const s=Math.min(2,t.length);for(let i=0;i<s;++i)e[i]=t[i];return e},fromValues:n,ones:o,unitX:a,unitY:h,zeros:function(){return[0,0]}},Symbol.toStringTag,{value:"Module"}))},57733:(t,e,s)=>{let i;function r(t){const e=i.__externref_table_alloc();return i.__wbindgen_export_2.set(e,t),e}function n(t,e){try{return t.apply(this,e)}catch(t){const e=r(t);i.__wbindgen_exn_store(e)}}s.r(e),s.d(e,{ColumnDescriptor:()=>D,FieldMetadata:()=>N,GeometryInfo:()=>q,GeometryType:()=>z,MultiscaleGeometryField:()=>U,PageEncodingDescriptor:()=>j,ParquetChunk:()=>X,ParquetFile:()=>Z,PrimaryGeometryField:()=>Q,QuantizedGeometryBuffer:()=>K,RangeProviderJs:()=>et,RowGroup:()=>it,default:()=>at,enableTracing:()=>x,initSync:()=>ot}),Symbol.dispose||(Symbol.dispose=Symbol("Symbol.dispose"));const o="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&o.decode();let a=null;function h(){return null!==a&&0!==a.byteLength||(a=new Uint8Array(i.memory.buffer)),a}function c(t,e){return t>>>=0,o.decode(h().subarray(t,t+e))}let l=0;const u="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},d="function"==typeof u.encodeInto?function(t,e){return u.encodeInto(t,e)}:function(t,e){const s=u.encode(t);return e.set(s),{read:t.length,written:s.length}};function _(t,e,s){if(void 0===s){const s=u.encode(t),i=e(s.length,1)>>>0;return h().subarray(i,i+s.length).set(s),l=s.length,i}let i=t.length,r=e(i,1)>>>0;const n=h();let o=0;for(;o<i;o++){const e=t.charCodeAt(o);if(e>127)break;n[r+o]=e}if(o!==i){0!==o&&(t=t.slice(o)),r=s(r,i,i=o+3*t.length,1)>>>0;const e=h().subarray(r+o,r+i);o+=d(t,e).written,r=s(r,i,o,1)>>>0}return l=o,r}let p=null;function f(){return(null===p||!0===p.buffer.detached||void 0===p.buffer.detached&&p.buffer!==i.memory.buffer)&&(p=new DataView(i.memory.buffer)),p}function m(t){return null==t}const g="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{i.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function y(t,e,s,r){const n={a:t,b:e,cnt:1,dtor:s},o=(...t)=>{n.cnt++;const e=n.a;n.a=0;try{return r(e,n.b,...t)}finally{0===--n.cnt?(i.__wbindgen_export_6.get(n.dtor)(e,n.b),g.unregister(n)):n.a=e}};return o.original=n,g.register(o,n,n),o}function x(){i.enableTracing()}let b=null;function w(){return null!==b&&0!==b.byteLength||(b=new Float64Array(i.memory.buffer)),b}let v=null;function I(){return null!==v&&0!==v.byteLength||(v=new Uint32Array(i.memory.buffer)),v}function S(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function P(t,e){t>>>=0;const s=f(),r=[];for(let n=t;n<t+4*e;n+=4)r.push(i.__wbindgen_export_2.get(s.getUint32(n,!0)));return i.__externref_drop_slice(t,e),r}function M(t,e){const s=e(8*t.length,8)>>>0;return w().set(t,s/8),l=t.length,s}function C(t,e){const s=e(4*t.length,4)>>>0;for(let e=0;e<t.length;e++){const i=r(t[e]);f().setUint32(s+4*e,i,!0)}return l=t.length,s}function A(t,e){const s=e(1*t.length,1)>>>0;return h().set(t,s/1),l=t.length,s}let T=null;function k(){return null!==T&&0!==T.byteLength||(T=new Uint16Array(i.memory.buffer)),T}function F(t,e){const s=e(2*t.length,2)>>>0;return k().set(t,s/2),l=t.length,s}function E(t,e,s){i.closure83_externref_shim(t,e,s)}function R(t,e,s,r){i.closure9_externref_shim(t,e,s,r)}const z=Object.freeze({Point:0,0:"Point",Polygon:1,1:"Polygon",Polyline:2,2:"Polyline",Multipoint:3,3:"Multipoint"}),O=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeBigInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"],L="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_columndescriptor_free(t>>>0,1));class D{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,L.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_columndescriptor_free(t,0)}[Symbol.dispose](){this.free()}name(){let t,e;try{const s=i.columndescriptor_name(this.__wbg_ptr);return t=s[0],e=s[1],c(s[0],s[1])}finally{i.__wbindgen_free(t,e,1)}}physicalType(){let t,e;try{const s=i.columndescriptor_physicalType(this.__wbg_ptr);return t=s[0],e=s[1],c(s[0],s[1])}finally{i.__wbindgen_free(t,e,1)}}logicalType(){const t=i.columndescriptor_logicalType(this.__wbg_ptr);let e;return 0!==t[0]&&(e=c(t[0],t[1]).slice(),i.__wbindgen_free(t[0],1*t[1],1)),e}encodings(){const t=i.columndescriptor_encodings(this.__wbg_ptr);var e=P(t[0],t[1]).slice();return i.__wbindgen_free(t[0],4*t[1],4),e}pageEncodings(){const t=i.columndescriptor_pageEncodings(this.__wbg_ptr);let e;return 0!==t[0]&&(e=P(t[0],t[1]).slice(),i.__wbindgen_free(t[0],4*t[1],4)),e}numValues(){return i.columndescriptor_numValues(this.__wbg_ptr)}compression(){let t,e;try{const s=i.columndescriptor_compression(this.__wbg_ptr);return t=s[0],e=s[1],c(s[0],s[1])}finally{i.__wbindgen_free(t,e,1)}}compressedSize(){return i.columndescriptor_compressedSize(this.__wbg_ptr)}uncompressedSize(){return i.columndescriptor_uncompressedSize(this.__wbg_ptr)}nullCount(){const t=i.columndescriptor_nullCount(this.__wbg_ptr);return 0===t[0]?void 0:t[1]}distinctCount(){const t=i.columndescriptor_distinctCount(this.__wbg_ptr);return 0===t[0]?void 0:t[1]}minValue(){return i.columndescriptor_minValue(this.__wbg_ptr)}maxValue(){return i.columndescriptor_maxValue(this.__wbg_ptr)}}const G="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_fieldmetadata_free(t>>>0,1));class N{static __wrap(t){t>>>=0;const e=Object.create(N.prototype);return e.__wbg_ptr=t,G.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,G.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_fieldmetadata_free(t,0)}[Symbol.dispose](){this.free()}get id(){return i.__wbg_get_fieldmetadata_id(this.__wbg_ptr)}set id(t){i.__wbg_set_fieldmetadata_id(this.__wbg_ptr,t)}get name(){let t,e;try{const s=i.fieldmetadata_name(this.__wbg_ptr);return t=s[0],e=s[1],c(s[0],s[1])}finally{i.__wbindgen_free(t,e,1)}}get type(){const t=i.fieldmetadata_esri_type(this.__wbg_ptr);return O[t]}get physicalType(){const t=i.fieldmetadata_physical_type(this.__wbg_ptr);let e;return 0!==t[0]&&(e=c(t[0],t[1]).slice(),i.__wbindgen_free(t[0],1*t[1],1)),e}get logicalType(){const t=i.fieldmetadata_logical_type(this.__wbg_ptr);let e;return 0!==t[0]&&(e=c(t[0],t[1]).slice(),i.__wbindgen_free(t[0],1*t[1],1)),e}}const B="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_geometryinfo_free(t>>>0,1));class q{static __wrap(t){t>>>=0;const e=Object.create(q.prototype);return e.__wbg_ptr=t,B.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,B.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_geometryinfo_free(t,0)}[Symbol.dispose](){this.free()}static new(t,e,s,r,n){S(r,Q);var o=r.__destroy_into_raw();const a=C(n,i.__wbindgen_malloc),h=l,c=i.geometryinfo_new(t,e,s,o,a,h);return q.__wrap(c)}}const W="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_multiscalegeometryfield_free(t>>>0,1));class U{static __wrap(t){t>>>=0;const e=Object.create(U.prototype);return e.__wbg_ptr=t,W.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof U?t.__destroy_into_raw():0}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,W.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_multiscalegeometryfield_free(t,0)}[Symbol.dispose](){this.free()}get level(){return i.__wbg_get_multiscalegeometryfield_level(this.__wbg_ptr)}set level(t){i.__wbg_set_multiscalegeometryfield_level(this.__wbg_ptr,t)}static new(t,e,s,r){const n=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),o=l,a=M(s,i.__wbindgen_malloc),h=l,c=M(r,i.__wbindgen_malloc),u=l,d=i.multiscalegeometryfield_new(t,n,o,a,h,c,u);return U.__wrap(d)}has_field(t){const e=_(t,i.__wbindgen_malloc,i.__wbindgen_realloc),s=l;return 0!==i.multiscalegeometryfield_has_field(this.__wbg_ptr,e,s)}}const Y="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_pageencodingdescriptor_free(t>>>0,1));class j{static __wrap(t){t>>>=0;const e=Object.create(j.prototype);return e.__wbg_ptr=t,Y.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Y.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_pageencodingdescriptor_free(t,0)}[Symbol.dispose](){this.free()}pageType(){let t,e;try{const s=i.pageencodingdescriptor_pageType(this.__wbg_ptr);return t=s[0],e=s[1],c(s[0],s[1])}finally{i.__wbindgen_free(t,e,1)}}encoding(){let t,e;try{const s=i.pageencodingdescriptor_encoding(this.__wbg_ptr);return t=s[0],e=s[1],c(s[0],s[1])}finally{i.__wbindgen_free(t,e,1)}}count(){return i.pageencodingdescriptor_count(this.__wbg_ptr)}}const V="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_parquetchunk_free(t>>>0,1));class X{static __wrap(t){t>>>=0;const e=Object.create(X.prototype);return e.__wbg_ptr=t,V.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,V.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_parquetchunk_free(t,0)}[Symbol.dispose](){this.free()}size(){return i.parquetchunk_size(this.__wbg_ptr)>>>0}isEmpty(t){return 0!==i.parquetchunk_isEmpty(this.__wbg_ptr,t)}rowId(t){return i.parquetchunk_rowId(this.__wbg_ptr,t)}readX(t){const e=i.parquetchunk_readX(this.__wbg_ptr,t);return 0===e[0]?void 0:e[1]}readY(t){const e=i.parquetchunk_readY(this.__wbg_ptr,t);return 0===e[0]?void 0:e[1]}readCoords(t){const e=i.parquetchunk_readCoords(this.__wbg_ptr,t);let s;return 0!==e[0]&&(s=function(t,e){return t>>>=0,w().subarray(t/8,t/8+e)}(e[0],e[1]).slice(),i.__wbindgen_free(e[0],8*e[1],8)),s}readLengths(t){const e=i.parquetchunk_readLengths(this.__wbg_ptr,t);let s;return 0!==e[0]&&(s=function(t,e){return t>>>=0,I().subarray(t/4,t/4+e)}(e[0],e[1]).slice(),i.__wbindgen_free(e[0],4*e[1],4)),s}transformGeometry(t,e,s,r,n,o){S(t,K);const a=i.parquetchunk_transformGeometry(this.__wbg_ptr,t.__wbg_ptr,e,s,r,n,o);return 16777215===a?void 0:0!==a}boundsXMin(t){const e=i.parquetchunk_boundsXMin(this.__wbg_ptr,t);return 0===e[0]?void 0:e[1]}boundsYMin(t){const e=i.parquetchunk_boundsYMin(this.__wbg_ptr,t);return 0===e[0]?void 0:e[1]}boundsXMax(t){const e=i.parquetchunk_boundsXMax(this.__wbg_ptr,t);return 0===e[0]?void 0:e[1]}boundsYMax(t){const e=i.parquetchunk_boundsYMax(this.__wbg_ptr,t);return 0===e[0]?void 0:e[1]}readAttribute(t,e){return i.parquetchunk_readAttribute(this.__wbg_ptr,t,e)}}const H="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_parquetfile_free(t>>>0,1));class Z{static __wrap(t){t>>>=0;const e=Object.create(Z.prototype);return e.__wbg_ptr=t,H.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,H.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_parquetfile_free(t,0)}[Symbol.dispose](){this.free()}static fromUrl(t,e,s,r){const n=_(t,i.__wbindgen_malloc,i.__wbindgen_realloc),o=l;let a=0;return m(r)||(S(r,q),a=r.__destroy_into_raw()),i.parquetfile_fromUrl(n,o,e,s,a)}static fromBinary(t,e){const s=A(t,i.__wbindgen_malloc),r=l;let n=0;return m(e)||(S(e,q),n=e.__destroy_into_raw()),i.parquetfile_fromBinary(s,r,n)}version(){return i.parquetfile_version(this.__wbg_ptr)}numRows(){return i.parquetfile_numRows(this.__wbg_ptr)>>>0}numFields(){return i.parquetfile_numFields(this.__wbg_ptr)>>>0}numColumns(){return i.parquetfile_numColumns(this.__wbg_ptr)>>>0}createdBy(){const t=i.parquetfile_createdBy(this.__wbg_ptr);let e;return 0!==t[0]&&(e=c(t[0],t[1]).slice(),i.__wbindgen_free(t[0],1*t[1],1)),e}keyValueMetadata(t){const e=_(t,i.__wbindgen_malloc,i.__wbindgen_realloc),s=l,r=i.parquetfile_keyValueMetadata(this.__wbg_ptr,e,s);let n;return 0!==r[0]&&(n=c(r[0],r[1]).slice(),i.__wbindgen_free(r[0],1*r[1],1)),n}keys(){const t=i.parquetfile_keys(this.__wbg_ptr);let e;return 0!==t[0]&&(e=P(t[0],t[1]).slice(),i.__wbindgen_free(t[0],4*t[1],4)),e}attributeIdFor(t){const e=_(t,i.__wbindgen_malloc,i.__wbindgen_realloc),s=l;return i.parquetfile_attributeIdFor(this.__wbg_ptr,e,s)}fields(){const t=i.parquetfile_fields(this.__wbg_ptr);var e=P(t[0],t[1]).slice();return i.__wbindgen_free(t[0],4*t[1],4),e}rowGroups(){const t=i.parquetfile_rowGroups(this.__wbg_ptr);var e=P(t[0],t[1]).slice();return i.__wbindgen_free(t[0],4*t[1],4),e}ensureFields(t){const e=F(t,i.__wbindgen_malloc),s=l;return i.parquetfile_ensureFields(this.__wbg_ptr,e,s)}readFirstChunk(t){const e=F(t,i.__wbindgen_malloc),s=l;return i.parquetfile_readFirstChunk(this.__wbg_ptr,e,s)}readAllChunks(t,e,s){const r=F(t,i.__wbindgen_malloc),n=l;return i.parquetfile_readAllChunks(this.__wbg_ptr,r,n,e,s)}queryZChunks(t,e,s,r){const n=F(e,i.__wbindgen_malloc),o=l;return i.parquetfile_queryZChunks(this.__wbg_ptr,t,n,o,s,r)}queryXZChunks(t,e,s){return i.parquetfile_queryXZChunks(this.__wbg_ptr,t,e,s)}}const $="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_primarygeometryfield_free(t>>>0,1));class Q{static __wrap(t){t>>>=0;const e=Object.create(Q.prototype);return e.__wbg_ptr=t,$.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,$.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_primarygeometryfield_free(t,0)}[Symbol.dispose](){this.free()}static fromNative(t){const e=_(t,i.__wbindgen_malloc,i.__wbindgen_realloc),s=l,r=i.primarygeometryfield_fromNative(e,s);return Q.__wrap(r)}static fromWkb(t){const e=_(t,i.__wbindgen_malloc,i.__wbindgen_realloc),s=l,r=i.primarygeometryfield_fromWkb(e,s);return Q.__wrap(r)}static fromLocation(t,e){const s=_(t,i.__wbindgen_malloc,i.__wbindgen_realloc),r=l,n=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),o=l,a=i.primarygeometryfield_fromLocation(s,r,n,o);return Q.__wrap(a)}}const J="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_quantizedgeometrybuffer_free(t>>>0,1));class K{static __wrap(t){t>>>=0;const e=Object.create(K.prototype);return e.__wbg_ptr=t,J.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,J.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_quantizedgeometrybuffer_free(t,0)}[Symbol.dispose](){this.free()}static new(){const t=i.quantizedgeometrybuffer_new();return K.__wrap(t)}readCoordsUnsafe(){return i.quantizedgeometrybuffer_readCoordsUnsafe(this.__wbg_ptr)}readLengthsUnsafe(){return i.quantizedgeometrybuffer_readLengthsUnsafe(this.__wbg_ptr)}}const tt="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_rangeproviderjs_free(t>>>0,1));class et{static __wrap(t){t>>>=0;const e=Object.create(et.prototype);return e.__wbg_ptr=t,tt.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,tt.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_rangeproviderjs_free(t,0)}[Symbol.dispose](){this.free()}static new(t,e){const s=i.rangeproviderjs_new(t,e);return et.__wrap(s)}static withFetch(){const t=i.rangeproviderjs_withFetch();return et.__wrap(t)}}const st="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>i.__wbg_rowgroup_free(t>>>0,1));class it{static __wrap(t){t>>>=0;const e=Object.create(it.prototype);return e.__wbg_ptr=t,st.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,st.unregister(this),t}free(){const t=this.__destroy_into_raw();i.__wbg_rowgroup_free(t,0)}[Symbol.dispose](){this.free()}}function rt(){const t={wbg:{}};return t.wbg.__wbg_aborted_c078e36031795a9a=function(t){return t.aborted},t.wbg.__wbg_apply_36be6a55257c99bf=function(){return n(function(t,e,s){return t.apply(e,s)},arguments)},t.wbg.__wbg_buffer_609cc3eee51ed158=function(t){return t.buffer},t.wbg.__wbg_call_672a4d21634d4a24=function(){return n(function(t,e){return t.call(e)},arguments)},t.wbg.__wbg_call_7cccdd69e0791ae2=function(){return n(function(t,e,s){return t.call(e,s)},arguments)},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(t,e){let s,r;try{s=t,r=e,console.error(c(t,e))}finally{i.__wbindgen_free(s,r,1)}},t.wbg.__wbg_fieldmetadata_new=function(t){return N.__wrap(t)},t.wbg.__wbg_get_67b2ba62fc30de12=function(){return n(function(t,e){return Reflect.get(t,e)},arguments)},t.wbg.__wbg_length_8cfd2c6409af88ad=function(t){return t.length},t.wbg.__wbg_length_a446193dc22c12f8=function(t){return t.length},t.wbg.__wbg_multiscalegeometryfield_unwrap=function(t){return U.__unwrap(t)},t.wbg.__wbg_new_23a2665fac83c611=function(t,e){try{var s={a:t,b:e};return new Promise((t,e)=>{const i=s.a;s.a=0;try{return R(i,s.b,t,e)}finally{s.a=i}})}finally{s.a=s.b=0}},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_9fee97a409b32b68=function(t){return new Uint16Array(t)},t.wbg.__wbg_new_a12002a7f91c75be=function(t){return new Uint8Array(t)},t.wbg.__wbg_newnoargs_105ed471475aaf50=function(t,e){return new Function(c(t,e))},t.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212=function(t,e,s){return new Uint32Array(t,e>>>0,s>>>0)},t.wbg.__wbg_newwithbyteoffsetandlength_f254047f7e80e7ff=function(t,e,s){return new Int16Array(t,e>>>0,s>>>0)},t.wbg.__wbg_newwithlength_c4c419ef0bc8a1f8=function(t){return new Array(t>>>0)},t.wbg.__wbg_pageencodingdescriptor_new=function(t){return j.__wrap(t)},t.wbg.__wbg_parquetchunk_new=function(t){return X.__wrap(t)},t.wbg.__wbg_parquetfile_new=function(t){return Z.__wrap(t)},t.wbg.__wbg_queueMicrotask_98e746b9f850fe3d=function(t){queueMicrotask(t)},t.wbg.__wbg_queueMicrotask_c847cc8372bec908=function(t){return t.queueMicrotask},t.wbg.__wbg_resolve_4851785c9c5f573d=function(t){return Promise.resolve(t)},t.wbg.__wbg_rowgroup_new=function(t){return it.__wrap(t)},t.wbg.__wbg_set_37837023f3d740e8=function(t,e,s){t[e>>>0]=s},t.wbg.__wbg_set_65595bdd868b3009=function(t,e,s){t.set(e,s>>>0)},t.wbg.__wbg_set_f4f1f0daa30696fc=function(t,e,s){t.set(e,s>>>0)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(t,e){const s=_(e.stack,i.__wbindgen_malloc,i.__wbindgen_realloc),r=l;f().setInt32(t+4,r,!0),f().setInt32(t+0,s,!0)},t.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const t="undefined"==typeof global?null:global;return m(t)?0:r(t)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const t="undefined"==typeof globalThis?null:globalThis;return m(t)?0:r(t)},t.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const t="undefined"==typeof self?null:self;return m(t)?0:r(t)},t.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const t="undefined"==typeof window?null:window;return m(t)?0:r(t)},t.wbg.__wbg_then_44b73946d2fb3e7d=function(t,e){return t.then(e)},t.wbg.__wbg_then_48b406749878a531=function(t,e,s){return t.then(e,s)},t.wbg.__wbg_valueOf_fdbb54fcdfe33477=function(t){return t.valueOf()},t.wbg.__wbindgen_bigint_from_i64=function(t){return t},t.wbg.__wbindgen_cb_drop=function(t){const e=t.original;return 1==e.cnt--&&(e.a=0,!0)},t.wbg.__wbindgen_closure_wrapper1681=function(t,e,s){return y(t,e,84,E)},t.wbg.__wbindgen_init_externref_table=function(){const t=i.__wbindgen_export_2,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)},t.wbg.__wbindgen_is_function=function(t){return"function"==typeof t},t.wbg.__wbindgen_is_undefined=function(t){return void 0===t},t.wbg.__wbindgen_memory=function(){return i.memory},t.wbg.__wbindgen_number_get=function(t,e){const s="number"==typeof e?e:void 0;f().setFloat64(t+8,m(s)?0:s,!0),f().setInt32(t+0,!m(s),!0)},t.wbg.__wbindgen_number_new=function(t){return t},t.wbg.__wbindgen_string_new=function(t,e){return c(t,e)},t.wbg.__wbindgen_throw=function(t,e){throw new Error(c(t,e))},t.wbg.__wbindgen_uint8_array_new=function(t,e){var s=function(t,e){return t>>>=0,h().subarray(t/1,t/1+e)}(t,e).slice();return i.__wbindgen_free(t,1*e,1),s},t}function nt(t,e){return i=t.exports,at.__wbindgen_wasm_module=e,p=null,b=null,T=null,v=null,a=null,i.__wbindgen_start(),i}function ot(t){if(void 0!==i)return i;void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?({module:t}=t):console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=rt();return t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t)),nt(new WebAssembly.Instance(t,e),t)}async function at(t){if(void 0!==i)return i;void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?({module_or_path:t}=t):console.warn("using deprecated parameters for the initialization function; pass a single object instead"));const e=rt();("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t));const{instance:s,module:r}=await async function(t,e){if("function"==typeof Response&&t instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(t,e)}catch(e){if("application/wasm"==t.headers.get("Content-Type"))throw e;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",e)}const s=await t.arrayBuffer();return await WebAssembly.instantiate(s,e)}{const s=await WebAssembly.instantiate(t,e);return s instanceof WebAssembly.Instance?{instance:s,module:t}:s}}(await t,e);return nt(s,r)}},62298:(t,e,s)=>{s(63907)},63907:(t,e,s)=>{var i,r,n,o,a,h;s.d(e,{CQ:()=>_,Fq:()=>u,H0:()=>n,SB:()=>a,WR:()=>i,iE:()=>o,nI:()=>d,pe:()=>r,r6:()=>c,vt:()=>h,yI:()=>l}),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(i||(i={})),function(t){t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.HALF_FLOAT=5131]="HALF_FLOAT"}(r||(r={})),function(t){t[t.RGBA4=32854]="RGBA4",t[t.R16F=33325]="R16F",t[t.RG16F=33327]="RG16F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.R32F=33326]="R32F",t[t.RG32F=33328]="RG32F",t[t.RGBA32F=34836]="RGBA32F",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB5_A1=32855]="RGB5_A1",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.RGB16F=34843]="RGB16F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.RGB565=36194]="RGB565",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2=32857]="RGB10_A2",t[t.RGB10_A2UI=36975]="RGB10_A2UI"}(n||(n={})),function(t){t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(o||(o={})),function(t){t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F"}(a||(a={})),function(t){t[t.Texture=0]="Texture",t[t.TileTexture=1]="TileTexture",t[t.BufferObject=2]="BufferObject",t[t.VertexArrayObject=3]="VertexArrayObject",t[t.Shader=4]="Shader",t[t.Program=5]="Program",t[t.FramebufferObject=6]="FramebufferObject",t[t.Renderbuffer=7]="Renderbuffer",t[t.TransformFeedback=8]="TransformFeedback",t[t.Sync=9]="Sync",t[t.UNCOUNTED=10]="UNCOUNTED",t[t.LinesOfCode=10]="LinesOfCode",t[t.Uniform=11]="Uniform",t[t.COUNT=12]="COUNT"}(h||(h={}));const c=36064,l=36065,u=36066,d=33306;var _;!function(t){t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(_||(_={}))},72457:(t,e,s)=>{s.d(e,{h:()=>n,k:()=>r});const i=new FinalizationRegistry(t=>{t.close()});function r(t,e){i.register(t,e,e)}function n(t){i.unregister(t)}},72691:(t,e,s)=>{s.d(e,{Aw:()=>o,DN:()=>i,EA:()=>n,Gm:()=>r,xq:()=>a});const i="__esri_stream_id__",r="__esri_timestamp__",n="__esri_track_part__",o="__esri_time_received__",a="__esri_track_line__"},72802:(t,e,s)=>{s.d(e,{U:()=>i});class i{constructor(t,e,s,i,r=void 0){this.id=t,this.level=e,this.row=s,this.col=i,this.extent=r}}},76061:(t,e,s)=>{s.d(e,{G:()=>i,S:()=>r});class i{*[Symbol.iterator](){let t=this.next();for(;t;)yield t,t=this.next()}}class r extends i{constructor(t){super(),this.m_iGeom=-1,this.m_aGeoms=t?t.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const t=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,t}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}},76213:(t,e,s)=>{s.d(e,{C2:()=>o,CQ:()=>i,DY:()=>r,GR:()=>f,Gh:()=>h,MZ:()=>d,TB:()=>p,U5:()=>a,_M:()=>c,cp:()=>m,eG:()=>n,fq:()=>_,hM:()=>u,ie:()=>l});const i=512,r=29,n=24,o=4,a=6,h=1.05,c=3,l=3,u=4,d=1,_=10,p=256,f=32,m=512},77085:(t,e,s)=>{s.d(e,{Hh:()=>a,fz:()=>l,g7:()=>h,s1:()=>o,zo:()=>c});var i=s(76061),r=s(83290);let n;function o(){return!!n&&(0,r.i)()}async function a(){if(!o()){const[t,e]=await Promise.all([Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(1088)]).then(s.bind(s,31088)),Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(5756)]).then(s.bind(s,15756)).then(({injectPe:t})=>t),(0,r.l)()]);n=new t.OperatorGeodeticDensifyByLength,e(r.p)}}function h(t,e,s,i){return n.execute(t,e,s,i,null)}function c(t,e,s,r){const o=n.executeMany(new i.S(t),e,s,r,null);return Array.from(o)}function l(){return n.supportsCurves()}},79897:(t,e,s)=>{s.d(e,{U:()=>l});var i=s(31635),r=s(69622),n=s(36563),o=s(36708),a=s(11932),h=s(10107),c=s(40608);let l=class extends r.A{constructor(){super(...arguments),this.updating=!1,this._handleId=0,this._scheduleHandleId=0,this._pendingPromises=new Set}destroy(){this.removeAll()}add(t,e,s={}){return this._installWatch(t,e,s,o.wB)}addWhen(t,e,s={}){return this._installWatch(t,e,s,o.z7)}addOnCollectionChange(t,e,{initial:s=!1,final:i=!1}={}){const r=++this._handleId;return this.addHandles([(0,o.on)(t,"after-changes",this._createSyncUpdatingCallback(),o.OH),(0,o.on)(t,"change",e,{onListenerAdd:s?t=>e({added:t.toArray(),removed:[]}):void 0,onListenerRemove:i?t=>e({added:[],removed:t.toArray()}):void 0})],r),(0,n.hA)(()=>this.removeHandles(r))}addPromise(t){if(null==t)return t;const e=++this._handleId;this.addHandles((0,n.hA)(()=>{this._pendingPromises.delete(t)&&(0!==this._pendingPromises.size||this.hasHandles(u)||this._set("updating",!1))}),e),this._pendingPromises.add(t),this._set("updating",!0);const s=()=>this.removeHandles(e);return t.then(s,s),t}removeAll(){this._pendingPromises.clear(),this.removeAllHandles(),this._set("updating",!1)}_installWatch(t,e,s={},i){const r=++this._handleId;s.sync||this._installSyncUpdatingWatch(t,r);const o=i(t,e,s);return this.addHandles(o,r),(0,n.hA)(()=>this.removeHandles(r))}_installSyncUpdatingWatch(t,e){const s=this._createSyncUpdatingCallback(),i=(0,o.wB)(t,s,{sync:!0,equals:()=>!1});return this.addHandles(i,e),i}_createSyncUpdatingCallback(){return()=>{this.removeHandles(u),++this._scheduleHandleId;const t=this._scheduleHandleId;this._get("updating")||this._set("updating",!0),this.addHandles((0,a._)(()=>{t===this._scheduleHandleId&&(this._set("updating",this._pendingPromises.size>0),this.removeHandles(u))}),u)}}};(0,i.Cg)([(0,h.MZ)({readOnly:!0})],l.prototype,"updating",void 0),l=(0,i.Cg)([(0,c.$)("esri.core.support.UpdatingHandles")],l);const u=-42},87045:(t,e,s)=>{s.d(e,{A:()=>w});var i,r=s(31635),n=s(66552),o=s(25482),a=s(83047),h=s(10107),c=s(56507),l=(s(44208),s(87811),s(36005)),u=s(40608),d=s(43937),_=s(86738),p=s(16930),f=s(19419),m=s(21325),g=s(28735),y=s(91806),x=s(72802);const b=new n.J({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let w=class extends o.A{static{i=this}static create(t={}){const{resolutionFactor:e=1,scales:s,size:r=256,spatialReference:n=p.A.WebMercator,numLODs:o=24}=t;if(!(0,m.fn)(n)){const t=[];if(s)for(let e=0;e<s.length;e++){const i=s[e];t.push(new y.A({level:e,scale:i,resolution:i}))}else{let e=5e-4;for(let s=o-1;s>=0;s--)t.unshift(new y.A({level:s,scale:e,resolution:e})),e*=2}return new i({dpi:96,lods:t,origin:new _.A(0,0,n),size:[r,r],spatialReference:n})}const h=(0,m.Vp)(n),c=t.origin?new _.A({x:t.origin.x,y:t.origin.y,spatialReference:n}):new _.A(h?{x:h.origin[0],y:h.origin[1],spatialReference:n}:{x:0,y:0,spatialReference:n}),l=1/(39.37*(0,a.GA)(n)*96),u=[];if(s)for(let t=0;t<s.length;t++){const e=s[t],i=e*l;u.push(new y.A({level:t,scale:e,resolution:i}))}else{let t=(0,m.EA)(n)?512/r*591657527.5917094:256/r*591657527.591555;const s=Math.ceil(o/e);u.push(new y.A({level:0,scale:t,resolution:t*l}));for(let i=1;i<s;i++){const s=t/2**e,r=s*l;u.push(new y.A({level:i,scale:s,resolution:r})),t=s}}return new i({dpi:96,lods:u,origin:c,size:[r,r],spatialReference:n})}constructor(t){super(t),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:t,origin:e}=this;if(t&&e){const s=(0,m.Vp)(t);return t.isWrappable&&!!s&&Math.abs(s.origin[0]-e.x)<=s.dx}return!1}readOrigin(t,e){return _.A.fromJSON({spatialReference:e.spatialReference,...t})}set lods(t){let e=0,s=0;const i=[],r=this._levelToLOD={};t&&(e=-1/0,s=1/0,t.forEach(t=>{i.push(t.scale),e=t.scale>e?t.scale:e,s=t.scale<s?t.scale:s,r[t.level]=t})),this._set("scales",i),this._set("lods",t),this._initializeUpsampleLevels()}readSize(t,e){return[e.cols,e.rows]}writeSize(t,e){e.cols=t[0],e.rows=t[1]}zoomToScale(t){const e=this.scales;if(t<=0)return e[0];if(t>=e.length-1)return e[e.length-1];const s=Math.floor(t),i=s+1;return e[s]/(e[s]/e[i])**(t-s)}scaleToZoom(t){const e=this.scales,s=e.length-1;let i=0;for(;i<s;i++){const s=e[i],r=e[i+1];if(s<=t)return i;if(r===t)return i+1;if(s>t&&r<t)return i+Math.log(s/t)/Math.log(s/r)}return i}tileAt(t,e,s,i){const r=this.lodAt(t);if(!r)return null;let n,o;if("number"==typeof e)n=e,o=s;else if((0,m.aI)(e.spatialReference,this.spatialReference))n=e.x,o=e.y,i=s;else{const t=(0,g.Cv)(e,this.spatialReference);if(null==t)return null;n=t.x,o=t.y,i=s}const a=r.resolution*this.size[0],h=r.resolution*this.size[1];return i||(i=new x.U(null,0,0,0,(0,f.vt)())),i.level=t,i.row=Math.floor((this.origin.y-o)/h+.001),i.col=Math.floor((n-this.origin.x)/a+.001),this.updateTileInfo(i),i}updateTileInfo(t,e=0){let s=this.lodAt(t.level);if(!s&&1===e){const e=this.lods[this.lods.length-1];e.level<t.level&&(s=e)}if(!s)return;const i=t.level-s.level,r=s.resolution*this.size[0]/2**i,n=s.resolution*this.size[1]/2**i;t.id=`${t.level}/${t.row}/${t.col}`,t.extent||(t.extent=(0,f.vt)()),t.extent[0]=this.origin.x+t.col*r,t.extent[1]=this.origin.y-(t.row+1)*n,t.extent[2]=t.extent[0]+r,t.extent[3]=t.extent[1]+n}upsampleTile(t){const e=this._upsampleLevels[t.level];return!(!e||-1===e.parentLevel||(t.level=e.parentLevel,t.row=Math.floor(t.row/e.factor+.001),t.col=Math.floor(t.col/e.factor+.001),this.updateTileInfo(t),0))}getTileBounds(t,e){const s=this.lodAt(e.level);if(null==s)return null;const{resolution:i}=s,r=i*this.size[0],n=i*this.size[1];return t[0]=this.origin.x+e.col*r,t[1]=this.origin.y-(e.row+1)*n,t[2]=t[0]+r,t[3]=t[1]+n,t}lodAt(t){return this._levelToLOD?.[t]??null}clone(){return i.fromJSON(this.write({}))}getCompatibleForVTL(t){if(this.size[0]!==this.size[1]||256===this.size[0]&&512===t)return null;const e=(512===this.size[0]&&256===t?-1:0)+(this.spatialReference.isGeographic?1:0);if(this.size[0]===t&&0===e)return this;const s=[],r=this.lods.length-e;for(let t=0;t<r;t++){const i=t+e,{scale:r,resolution:n}=i>=0?this.lods[i]:{scale:2*this.lods[0].scale,resolution:2*this.lods[0].resolution};s.push(new y.A({level:t,scale:r,resolution:n}))}return new i({size:[t,t],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:s})}_initializeUpsampleLevels(){const t=this.lods;this._upsampleLevels=[];let e=null;for(let s=0;s<t.length;s++){const i=t[s];this._upsampleLevels[i.level]={parentLevel:e?e.level:-1,factor:e?e.resolution/i.resolution:0},e=i}}};(0,r.Cg)([(0,h.MZ)({type:Number,json:{write:!0}})],w.prototype,"compressionQuality",void 0),(0,r.Cg)([(0,h.MZ)({type:Number,json:{write:!0}})],w.prototype,"dpi",void 0),(0,r.Cg)([(0,h.MZ)({type:String,json:{read:b.read,write:b.write,origins:{"web-scene":{read:!1,write:!1}}}})],w.prototype,"format",void 0),(0,r.Cg)([(0,h.MZ)({readOnly:!0})],w.prototype,"isWrappable",null),(0,r.Cg)([(0,h.MZ)({type:_.A,json:{write:!0}})],w.prototype,"origin",void 0),(0,r.Cg)([(0,l.w)("origin")],w.prototype,"readOrigin",null),(0,r.Cg)([(0,h.MZ)({type:[y.A],value:null,json:{write:!0}})],w.prototype,"lods",null),(0,r.Cg)([(0,h.MZ)({readOnly:!0})],w.prototype,"scales",void 0),(0,r.Cg)([(0,h.MZ)({cast:t=>Array.isArray(t)?t:"number"==typeof t?[t,t]:[256,256]})],w.prototype,"size",void 0),(0,r.Cg)([(0,l.w)("size",["rows","cols"])],w.prototype,"readSize",null),(0,r.Cg)([(0,d.K)("size",{cols:{type:c.jz},rows:{type:c.jz}})],w.prototype,"writeSize",null),(0,r.Cg)([(0,h.MZ)({type:p.A,json:{write:!0}})],w.prototype,"spatialReference",void 0),w=i=(0,r.Cg)([(0,u.$)("esri.layers.support.TileInfo")],w)},88340:(t,e,s)=>{function i(){return new Float32Array(2)}function r(t,e){const s=new Float32Array(2);return s[0]=t,s[1]=e,s}function n(){return i()}function o(){return r(1,1)}function a(){return r(1,0)}function h(){return r(0,1)}s.d(e,{Un:()=>l,fA:()=>r,uY:()=>c,vt:()=>i});const c=n(),l=o(),u=a(),d=h();Object.freeze(Object.defineProperty({__proto__:null,ONES:l,UNIT_X:u,UNIT_Y:d,ZEROS:c,clone:function(t){const e=new Float32Array(2);return e[0]=t[0],e[1]=t[1],e},create:i,fromValues:r,ones:o,unitX:a,unitY:h,zeros:n},Symbol.toStringTag,{value:"Module"}))},89056:(t,e,s)=>{s.d(e,{b3:()=>u,jZ:()=>l});var i=s(12195),r=s(19419),n=s(537),o=s(95108),a=s(65864),h=s(80754),c=s(21325);function l(t){return d(t,!0)}function u(t){return d(t,!1)}function d(t,e){if(null==t)return null;const s=t.spatialReference,r=(0,c.Vp)(s),o=(0,i.W)(t)?t.toJSON():t;if(!r)return o;const l=(0,c.K8)(s)?102100:4326,u=h.j7[l].maxX,d=h.j7[l].minX;if((0,a.fT)(o))return p(o,u,d);if((0,a.U9)(o))return o.points=o.points.map(t=>p(t,u,d)),o;if((0,a.ZC)(o))return _(o,r);if((0,a.Bi)(o)||(0,a.Rg)(o)){const t=(0,n.Rg)(b,o),s={xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]},i=(0,h.kd)(s.xmin,d)*(2*u),r=0===i?o:(0,h.kS)(o,i);return s.xmin+=i,s.xmax+=i,s.xmax>u?y(r,u,e):s.xmin<d?y(r,d,e):r}return o}function _(t,e){if(!e)return t;const s=function(t,e){const s=[],{ymin:i,ymax:r,xmin:n,xmax:o}=t,a=t.xmax-t.xmin,[h,c]=e.valid,{x:l,frameId:u}=f(t.xmin,e),{x:d,frameId:_}=f(t.xmax,e),p=l===d&&a>0;if(a>2*c){const t={xmin:n<o?l:d,ymin:i,xmax:c,ymax:r},e={xmin:h,ymin:i,xmax:n<o?d:l,ymax:r},a={xmin:0,ymin:i,xmax:c,ymax:r},p={xmin:h,ymin:i,xmax:0,ymax:r},f=[],g=[];m(t,a)&&f.push(u),m(t,p)&&g.push(u),m(e,a)&&f.push(_),m(e,p)&&g.push(_);for(let t=u+1;t<_;t++)f.push(t),g.push(t);s.push(new x(t,[u]),new x(e,[_]),new x(a,f),new x(p,g))}else l>d||p?s.push(new x({xmin:l,ymin:i,xmax:c,ymax:r},[u]),new x({xmin:h,ymin:i,xmax:d,ymax:r},[_])):s.push(new x({xmin:l,ymin:i,xmax:d,ymax:r},[u]));return s}(t,e).map(t=>t.extent);return s.length<2?s[0]||t:s.length>2?(t.xmin=e.valid[0],t.xmax=e.valid[1],t):{rings:s.map(t=>[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]])}}function p(t,e,s){if(Array.isArray(t)){const i=t[0];if(i>e){const s=(0,h.kd)(i,e);t[0]=i+s*(-2*e)}else if(i<s){const e=(0,h.kd)(i,s);t[0]=i+e*(-2*s)}}else{const i=t.x;if(i>e){const s=(0,h.kd)(i,e);t.x+=s*(-2*e)}else if(i<s){const e=(0,h.kd)(i,s);t.x+=e*(-2*s)}}return t}function f(t,e){const[s,i]=e.valid,r=2*i;let n,o=0;return t>i?(n=Math.ceil(Math.abs(t-i)/r),t-=n*r,o=n):t<s&&(n=Math.ceil(Math.abs(t-s)/r),t+=n*r,o=-n),{x:t,frameId:o}}function m(t,e){const{xmin:s,ymin:i,xmax:r,ymax:n}=e;return g(t,s,i)&&g(t,s,n)&&g(t,r,n)&&g(t,r,i)}function g(t,e,s){return e>=t.xmin&&e<=t.xmax&&s>=t.ymin&&s<=t.ymax}function y(t,e,s=!0){const i=!(0,a.Rg)(t);if(i&&(0,o.m3)(t),s)return(new w).cut(t,e);const r=i?t.rings:t.paths,n=i?4:2,h=r.length,c=-2*e;for(let t=0;t<h;t++){const e=r[t];if(e&&e.length>=n){const t=[];for(const s of e)t.push([s[0]+c,s[1]]);r.push(t)}}return i?t.rings=r:t.paths=r,t}class x{constructor(t,e){this.extent=t,this.frameIds=e}}const b=(0,r.vt)();class w{constructor(){this._linesIn=[],this._linesOut=[]}cut(t,e){let s;if(this._xCut=e,t.rings)this._closed=!0,s=t.rings,this._minPts=4;else{if(!t.paths)return null;this._closed=!1,s=t.paths,this._minPts=2}for(const t of s){if(!t||t.length<this._minPts)continue;let e=!0;for(const s of t)e?(this.moveTo(s),e=!1):this.lineTo(s);this._closed&&this.close()}this._pushLineIn(),this._pushLineOut(),s=[];for(const t of this._linesIn)t&&t.length>=this._minPts&&s.push(t);const i=-2*this._xCut;for(const t of this._linesOut)if(t&&t.length>=this._minPts){for(const e of t)e[0]+=i;s.push(t)}return this._closed?t.rings=s:t.paths=s,t}moveTo(t){this._pushLineIn(),this._pushLineOut(),this._prevSide=this._side(t[0]),this._moveTo(t[0],t[1],this._prevSide),this._prevPt=t,this._firstPt=t}lineTo(t){const e=this._side(t[0]);if(e*this._prevSide===-1){const s=this._intersect(this._prevPt,t);this._lineTo(this._xCut,s,0),this._prevSide=0,this._lineTo(t[0],t[1],e)}else this._lineTo(t[0],t[1],e);this._prevSide=e,this._prevPt=t}close(){const t=this._firstPt,e=this._prevPt;t[0]===e[0]&&t[1]===e[1]||this.lineTo(t),this._checkClosingPt(this._lineIn),this._checkClosingPt(this._lineOut)}_moveTo(t,e,s){this._closed?(this._lineIn.push([s<=0?t:this._xCut,e]),this._lineOut.push([s>=0?t:this._xCut,e])):(s<=0&&this._lineIn.push([t,e]),s>=0&&this._lineOut.push([t,e]))}_lineTo(t,e,s){this._closed?(v(this._lineIn,s<=0?t:this._xCut,e),v(this._lineOut,s>=0?t:this._xCut,e)):s<0?(0===this._prevSide&&this._pushLineOut(),this._lineIn.push([t,e])):s>0?(0===this._prevSide&&this._pushLineIn(),this._lineOut.push([t,e])):this._prevSide<0?(this._lineIn.push([t,e]),this._lineOut.push([t,e])):this._prevSide>0&&(this._lineOut.push([t,e]),this._lineIn.push([t,e]))}_checkClosingPt(t){const e=t.length;e>3&&t[0][0]===this._xCut&&t[e-2][0]===this._xCut&&t[1][0]===this._xCut&&(t[0][1]=t[e-2][1],t.pop())}_side(t){return t<this._xCut?-1:t>this._xCut?1:0}_intersect(t,e){const s=(this._xCut-t[0])/(e[0]-t[0]);return t[1]+s*(e[1]-t[1])}_pushLineIn(){this._lineIn&&this._lineIn.length>=this._minPts&&this._linesIn.push(this._lineIn),this._lineIn=[]}_pushLineOut(){this._lineOut&&this._lineOut.length>=this._minPts&&this._linesOut.push(this._lineOut),this._lineOut=[]}}function v(t,e,s){const i=t.length;i>1&&t[i-1][0]===e&&t[i-2][0]===e?t[i-1][1]=s:t.push([e,s])}},91806:(t,e,s)=>{s.d(e,{A:()=>c});var i,r=s(31635),n=s(25482),o=s(10107),a=s(56507),h=(s(44208),s(87811),s(40608));let c=class extends n.A{static{i=this}constructor(t){super(t),this.cols=null,this.level=0,this.levelValue=null,this.origin=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new i({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,r.Cg)([(0,o.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"cols",void 0),(0,r.Cg)([(0,o.MZ)({type:a.jz,json:{write:!0}})],c.prototype,"level",void 0),(0,r.Cg)([(0,o.MZ)({type:String,json:{write:!0}})],c.prototype,"levelValue",void 0),(0,r.Cg)([(0,o.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"origin",void 0),(0,r.Cg)([(0,o.MZ)({type:Number,json:{write:!0}})],c.prototype,"resolution",void 0),(0,r.Cg)([(0,o.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"rows",void 0),(0,r.Cg)([(0,o.MZ)({type:Number,json:{write:!0}})],c.prototype,"scale",void 0),c=i=(0,r.Cg)([(0,h.$)("esri.layers.support.LOD")],c)}}]);