@arcgis/core 5.0.0-next.4 → 5.0.0-next.6

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 (435) hide show
  1. package/Map.js +1 -1
  2. package/analysis/ElevationProfileAnalysis.js +1 -1
  3. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  4. package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +4 -0
  5. package/applications/KnowledgeStudio/generalSdkInternalAccess.js +5 -0
  6. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +1 -0
  7. package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
  8. package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +2 -0
  9. package/applications/KnowledgeStudio/layerInternalAccessUtils.js +1 -1
  10. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  11. package/assets/components/assets/sort-handle/t9n/messages.uk.json +1 -1
  12. package/assets/esri/core/workers/RemoteClient.js +1 -1
  13. package/assets/esri/core/workers/chunks/020c8913d8e35d63080b.js +1 -0
  14. package/assets/esri/core/workers/chunks/02e69f0c63d97661da60.js +1 -0
  15. package/assets/esri/core/workers/chunks/06ba43843e9c4988049b.js +1 -0
  16. package/assets/esri/core/workers/chunks/087973e7c4fea5fcfa5e.js +1 -0
  17. package/assets/esri/core/workers/chunks/{388482cea4b9fdeaf06e.js → 0f30a9514571c7be9978.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{929ece362604dc301229.js → 17acde0245ecd956306c.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{14ace5dc4b8984212a57.js → 17d5f8dba6ebb1184506.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{651b9144abb1895cc510.js → 1e848d9da1c61a27cf18.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{8cea114168d849c38b1b.js → 20278683bddc8c2d8136.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{00aa85ae6419aad183ea.js → 22d6b8102e75bdef204c.js} +1 -1
  23. package/assets/esri/core/workers/chunks/279366e6b743f9680603.js +1 -0
  24. package/assets/esri/core/workers/chunks/285762ff92d5388b6024.js +1 -0
  25. package/assets/esri/core/workers/chunks/{4f01be74dd26e639330f.js → 2f24017e72d41c259faa.js} +1 -1
  26. package/assets/esri/core/workers/chunks/36b1f47d70b57d79df7b.js +1 -0
  27. package/assets/esri/core/workers/chunks/{3d65b8a2fbe1df050a25.js → 377a66034e7c1bad5599.js} +1 -1
  28. package/assets/esri/core/workers/chunks/37f2ef14399546e697e6.js +1 -0
  29. package/assets/esri/core/workers/chunks/{0f9bb3187306f89e3d63.js → 398f356b11fd33bd3831.js} +1 -1
  30. package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js.LICENSE.txt +1 -1
  31. package/assets/esri/core/workers/chunks/{f7c99e9c8d19352af38d.js → 3ac7562ea90f91a9f30c.js} +1 -1
  32. package/assets/esri/core/workers/chunks/3f3d492f1093b7832aab.js +1 -0
  33. package/assets/esri/core/workers/chunks/4442817beb7a76c95770.js +1 -0
  34. package/assets/esri/core/workers/chunks/464d42bebb365287808d.js +1 -0
  35. package/assets/esri/core/workers/chunks/4c5a7249a311070d8f43.js +1 -0
  36. package/assets/esri/core/workers/chunks/{d570c75a425aa29672c8.js → 4d599008e1ea42321b37.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{c0feec6e2f0e45900ae0.js → 53bd8996e8812f1ad7b2.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{9a723d739ac44b45432c.js → 557960763695abee4a83.js} +1 -1
  39. package/assets/esri/core/workers/chunks/5bd36dbf46c25bd961c8.js +1 -0
  40. package/assets/esri/core/workers/chunks/{b7a17927e14f502006b4.js → 5ea0c62016d56990787b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{2ea6985da4eb0107bb9d.js → 5fc7b61f467f1d60a284.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{a87521ebe632bf783ef4.js → 62a49cfd9a2508950e9f.js} +1 -1
  43. package/assets/esri/core/workers/chunks/67d9cfe02613cb73ee37.js.LICENSE.txt +1 -1
  44. package/assets/esri/core/workers/chunks/{ec13053af1999701464a.js → 6826fe54562dcdc054d7.js} +1 -1
  45. package/assets/esri/core/workers/chunks/6c3b99209d542efa64d4.js +1 -0
  46. package/assets/esri/core/workers/chunks/{8215015f11221a354273.js → 6d049182bec34a22abcd.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{309c5f69ea06f3081d83.js → 73487b9d85e726e9c012.js} +1 -1
  48. package/assets/esri/core/workers/chunks/7413e582bc2b16af6a0f.js +1 -0
  49. package/assets/esri/core/workers/chunks/{3d22fe2f2c40abbc246e.js → 7461124454bfb4fb6474.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{147ad5fdd02f46b6da24.js → 7544316a75dbd981aea6.js} +1 -1
  51. package/assets/esri/core/workers/chunks/75bf27271a31e26e1b21.js +1 -0
  52. package/assets/esri/core/workers/chunks/{630efe10c871425b6a95.js → 76ae1702fecc7ad7017c.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{de1f75c907152df7e788.js → 794748fd1edc29a621cd.js} +1 -1
  54. package/assets/esri/core/workers/chunks/79dbfa2b9b332ca0002f.js +1 -0
  55. package/assets/esri/core/workers/chunks/7a23ab84e1144f081c92.js +1 -0
  56. package/assets/esri/core/workers/chunks/7aaaebbabee27690283c.js +1 -0
  57. package/assets/esri/core/workers/chunks/7c4a63aeead2505d6f02.js +1 -0
  58. package/assets/esri/core/workers/chunks/{2a5f331c0f18d8574b4e.js → 811d4c46c75cf6a63e78.js} +1 -1
  59. package/assets/esri/core/workers/chunks/8372f142c4d7a65c7954.js +1 -0
  60. package/assets/esri/core/workers/chunks/{d84373a6ec94dcfec8c2.js → 88074189fa10c335370b.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{dc31865edea480f0ebba.js → 8833c3d168951be4bf20.js} +1 -1
  62. package/assets/esri/core/workers/chunks/883ffaa69b3e6eb158bf.js +1 -0
  63. package/assets/esri/core/workers/chunks/{85622fe99f4d08afe875.js → 8a314b3790313e6dc5db.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{b0b2670596d6d8c32b5e.js → 8c056eac35d05d9524b7.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{0086a09441627842d34a.js → 8f3503b2fb6cd38757b9.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{1a713dcc9971e1935401.js → 8f56f298e7c1a283f407.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{dabc5a38a472c9719df9.js → 8ffd4710d168c2fcfd96.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{b2add7338258ca7c24dd.js → 90250e9239c173aace88.js} +1 -1
  69. package/assets/esri/core/workers/chunks/90b2b43b8b54c9a1ec35.js +1 -0
  70. package/assets/esri/core/workers/chunks/90f8b4bda28af43ea019.js +1 -0
  71. package/assets/esri/core/workers/chunks/{89027f6800e17fab8973.js → 9486032af3e934d85582.js} +1 -1
  72. package/assets/esri/core/workers/chunks/95c594a87b732f5c4979.js +1 -0
  73. package/assets/esri/core/workers/chunks/9786f91455350eaae493.js +1 -0
  74. package/assets/esri/core/workers/chunks/99859dce1925b406ccd0.js +1 -0
  75. package/assets/esri/core/workers/chunks/9c5cbf8810f37b1a4718.js +1 -0
  76. package/assets/esri/core/workers/chunks/9e8dceef4c961f56940d.js +1 -0
  77. package/assets/esri/core/workers/chunks/9fac5a12e878cd745354.js +1 -0
  78. package/assets/esri/core/workers/chunks/a06bac9b8f9e18874de8.js +316 -0
  79. package/assets/esri/core/workers/chunks/a091623bbfb3d771c8d8.js +1 -0
  80. package/assets/esri/core/workers/chunks/{01642fe19e81bfa33eb5.js → a395373e3173e6458a56.js} +1 -1
  81. package/assets/esri/core/workers/chunks/a3991ae8caa713d4ddcd.js +1 -0
  82. package/assets/esri/core/workers/chunks/{135e270b4f03c4270870.js → a4db5c9a90107e097df8.js} +1 -1
  83. package/assets/esri/core/workers/chunks/a712cdff78fc826acd8c.js +1 -0
  84. package/assets/esri/core/workers/chunks/a8f998b8ec8c56150479.js.LICENSE.txt +1 -1
  85. package/assets/esri/core/workers/chunks/aa54b6f2aba6952af149.js +1 -0
  86. package/assets/esri/core/workers/chunks/aa78b69219d9a0ef1c54.js.LICENSE.txt +1 -1
  87. package/assets/esri/core/workers/chunks/ac26e3e77df4302f47a2.js +1 -0
  88. package/assets/esri/core/workers/chunks/af5fc5d6c1d072a27df1.js +1 -0
  89. package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js → b017bac40dc8328013e3.js} +2 -2
  90. package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js.LICENSE.txt → b017bac40dc8328013e3.js.LICENSE.txt} +1 -1
  91. package/assets/esri/core/workers/chunks/{bc3bcf88b252760e2574.js → b3028b1ff75eafd0c358.js} +1 -1
  92. package/assets/esri/core/workers/chunks/b59f9c3f7a149214256f.js +1 -0
  93. package/assets/esri/core/workers/chunks/b96eb0ea506379182d62.js +2 -0
  94. package/assets/esri/core/workers/chunks/{24921d31efa8d222ad2d.js.LICENSE.txt → b96eb0ea506379182d62.js.LICENSE.txt} +1 -1
  95. package/assets/esri/core/workers/chunks/{b5863afafd3a7d2d5c05.js → bb5484b5eeacc9ad2ceb.js} +3 -3
  96. package/assets/esri/core/workers/chunks/bb56717c4e36f28d4c08.js +1 -0
  97. package/assets/esri/core/workers/chunks/bb7976e2f883b544add6.js +1 -0
  98. package/assets/esri/core/workers/chunks/{5875a51b97ee9bd438a0.js → bc241c7735e4efba734a.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{56916e56c20465428dd4.js → be3b874f86f627f4fa98.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{0eaa4dccba0d844b9da3.js → c3ddcf9148dd2640c402.js} +1 -1
  101. package/assets/esri/core/workers/chunks/c476643002387f60ea42.js +1 -0
  102. package/assets/esri/core/workers/chunks/c4e4da69969499a89a2c.js +1 -0
  103. package/assets/esri/core/workers/chunks/c8733cd621105afab2ac.js +1 -0
  104. package/assets/esri/core/workers/chunks/ccc0da0e01f023c8aa1f.js +1 -0
  105. package/assets/esri/core/workers/chunks/cd1930f08e1fc8b30b14.js +1 -0
  106. package/assets/esri/core/workers/chunks/ce16489cf7eb0d78c741.js.LICENSE.txt +1 -1
  107. package/assets/esri/core/workers/chunks/d048e4926e78458afa3e.js +1 -0
  108. package/assets/esri/core/workers/chunks/d1fe816b6990918c13c7.js +1 -0
  109. package/assets/esri/core/workers/chunks/d305a21666b1ed5bf33d.js +1 -0
  110. package/assets/esri/core/workers/chunks/d39a10155317e6f7a21c.js +1 -0
  111. package/assets/esri/core/workers/chunks/d40f57f9fc47f9a9f97c.js +1 -0
  112. package/assets/esri/core/workers/chunks/d6e0528eacee7ea4c1ce.js.LICENSE.txt +1 -1
  113. package/assets/esri/core/workers/chunks/d97fadbc69e055d183a0.js +1 -0
  114. package/assets/esri/core/workers/chunks/dedc4583b5f32a278124.js +1 -0
  115. package/assets/esri/core/workers/chunks/e31192ae920e3e19b6aa.js +1 -0
  116. package/assets/esri/core/workers/chunks/{e5bcc44f3dc6fc90835a.js → e5a06ce0ef6a9a90e100.js} +1 -1
  117. package/assets/esri/core/workers/chunks/e82f5437bd66779c6740.js +1 -0
  118. package/assets/esri/core/workers/chunks/f0e0a63962784acb4ba1.js +1 -0
  119. package/assets/esri/core/workers/chunks/{039ec0fbe3b4b398b8c6.js → f26dc1d83beed63b6045.js} +1 -1
  120. package/assets/esri/core/workers/chunks/{fa5c87889c2f0bef896b.js → f35aaa04cca676c2d3f8.js} +1 -1
  121. package/assets/esri/core/workers/chunks/f4d0ae6be1b3984228d0.js +1 -0
  122. package/assets/esri/core/workers/chunks/{7c5c272612198db83851.js → f5e47eea8720ba84665b.js} +1 -1
  123. package/assets/esri/core/workers/chunks/f651c05604eab83aef5f.js.LICENSE.txt +1 -1
  124. package/assets/esri/core/workers/chunks/{fa4411e0a5ac3fcba365.js → f65c0102af17390a50ac.js} +1 -1
  125. package/assets/esri/core/workers/chunks/f6c11c8ac687de3ef1ab.js +1 -0
  126. package/assets/esri/core/workers/chunks/f6c8beb60f6d29945a2e.js +1 -0
  127. package/assets/esri/core/workers/chunks/f746e3f7ebff2bbdf333.js +1 -0
  128. package/assets/esri/core/workers/chunks/f9324e88c359c03f35aa.js +1 -0
  129. package/assets/esri/core/workers/chunks/{cfa3164e7fa1884dc2b9.js → facb3886714222772ab2.js} +1 -1
  130. package/assets/esri/core/workers/chunks/fd2efd1d1cf9d95a87e6.js +1 -0
  131. package/assets/esri/core/workers/chunks/{fe3f95fda29e4844b153.js → fe77ae6cf232a7a3298e.js} +1 -1
  132. package/assets/esri/core/workers/chunks/{2ce4a0fe4fae63c43a81.js → ff35a077ac6776469805.js} +1 -1
  133. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  134. package/assets/esri/themes/base/widgets/_Directions.scss +17 -18
  135. package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +14 -4
  136. package/assets/esri/themes/dark/main.css +1 -1
  137. package/assets/esri/themes/light/main.css +1 -1
  138. package/assets/esri/themes/light/view.css +1 -1
  139. package/chunks/ComponentShader.glsl.js +72 -39
  140. package/chunks/OITBlend.glsl.js +3 -3
  141. package/chunks/bundle.js +1 -1
  142. package/config.js +1 -1
  143. package/core/Identifiable.js +1 -1
  144. package/core/MultiOriginJSONSupport.js +1 -1
  145. package/core/NumericIdentifiable.js +5 -0
  146. package/core/QueueProcessor.js +1 -1
  147. package/core/WriteableMultiOriginJSONMixin.js +5 -0
  148. package/core/has.js +1 -1
  149. package/core/performance.js +5 -0
  150. package/core/sanitizerUtils.js +1 -1
  151. package/core/scheduling.js +1 -1
  152. package/core/workers/Connection.js +1 -1
  153. package/core/workers/WorkerHandle.js +1 -1
  154. package/core/workers/utils.js +1 -1
  155. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
  156. package/geohash/GeohashCell.js +1 -1
  157. package/geohash/geohashUtils.js +1 -1
  158. package/geometry/GeometryCursor.js +1 -1
  159. package/geometry/geometryCursorCollectUtils.js +1 -1
  160. package/geometry/libtess.js +1 -1
  161. package/geometry/support/jsonUtils.js +1 -1
  162. package/geometry/support/normalizeUtilsSync.js +1 -1
  163. package/geometry/support/triangulationUtils.js +1 -1
  164. package/interfaces.d.ts +444 -349
  165. package/intl/date.js +1 -1
  166. package/intl.d.ts +2 -0
  167. package/intl.js +1 -1
  168. package/kernel.js +1 -1
  169. package/layers/FeatureLayer.js +1 -1
  170. package/layers/graphics/OptimizedFeature.js +1 -1
  171. package/layers/graphics/OptimizedGeometry.js +1 -1
  172. package/layers/graphics/centroid.js +1 -1
  173. package/layers/graphics/contains.js +1 -1
  174. package/layers/graphics/data/AttributesBuilder.js +1 -1
  175. package/layers/graphics/data/FeatureStore.js +1 -1
  176. package/layers/graphics/data/QueryEngine.js +1 -1
  177. package/layers/graphics/data/QueryEngineResult.js +1 -1
  178. package/layers/graphics/data/geometryUtils.js +1 -1
  179. package/layers/graphics/data/spatialQuerySupport.js +1 -1
  180. package/layers/graphics/featureConversionUtils.js +1 -1
  181. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  182. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  183. package/layers/graphics/sources/geojson/geojson.js +1 -1
  184. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  185. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  186. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  187. package/layers/knowledgeGraph/layerUtils.js +1 -1
  188. package/layers/mixins/ArcGISImageService.js +1 -1
  189. package/layers/mixins/ImageryTileMixin.js +1 -1
  190. package/layers/support/MediaElementBase.js +1 -1
  191. package/layers/support/PixelBlock.js +1 -1
  192. package/layers/support/RasterInfo.js +1 -1
  193. package/layers/support/RasterJobHandler.js +1 -1
  194. package/layers/support/RasterSensorInfo.js +1 -1
  195. package/layers/support/RasterStorageInfo.js +1 -1
  196. package/layers/support/RasterWorker.js +1 -1
  197. package/layers/support/TitleCreator.js +1 -1
  198. package/layers/support/arcgisLayerUrl.js +1 -1
  199. package/layers/support/capabilities.js +1 -1
  200. package/layers/support/fieldUtils.js +1 -1
  201. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  202. package/layers/support/rasterDatasets/pixelReader.js +1 -1
  203. package/layers/support/rasterFieldUtils.js +1 -1
  204. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  205. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  206. package/package.json +5 -5
  207. package/request.js +1 -1
  208. package/rest/print.js +1 -1
  209. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  210. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  211. package/rest/query/operations/query.js +1 -1
  212. package/rest/query/operations/queryZScale.js +1 -1
  213. package/rest/versionManagement/getVersionInfos.js +1 -1
  214. package/smartMapping/statistics/histogram.js +1 -1
  215. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  216. package/smartMapping/support/utils.js +1 -1
  217. package/support/basemapDefinitions.js +1 -1
  218. package/support/elevationInfoUtils.js +1 -1
  219. package/support/requestImageUtils.js +1 -1
  220. package/support/revision.js +1 -1
  221. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  222. package/undoredo/support/Services.js +1 -1
  223. package/views/2d/GoToManager.js +1 -1
  224. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  225. package/views/2d/constraints/GeometryConstraint.js +1 -1
  226. package/views/2d/constraints/RotationConstraint.js +1 -1
  227. package/views/2d/constraints/ZoomConstraint.js +1 -1
  228. package/views/2d/engine/vectorTiles/decluttering/SymbolFader.js +1 -1
  229. package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
  230. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  231. package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +1 -1
  232. package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
  233. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  234. package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
  235. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  236. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  237. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  238. package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
  239. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  240. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  241. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  242. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  243. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  244. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  245. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  246. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  247. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  248. package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
  249. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  250. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  251. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  252. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  253. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  254. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  255. package/views/3d/FocusAreasView.js +1 -1
  256. package/views/3d/GroundView3D.js +1 -1
  257. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  258. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  259. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  260. package/views/3d/glTF/DefaultLoadingContext.js +1 -1
  261. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  262. package/views/3d/layers/FlowSubView3D.js +1 -1
  263. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  264. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  265. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  266. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  267. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  268. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  269. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  270. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  271. package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
  272. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  273. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  274. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  275. package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
  276. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  277. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  278. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  279. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  280. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  281. package/views/3d/layers/support/lyr3dTypeConversions.js +1 -1
  282. package/views/3d/state/ViewStateManager.js +1 -1
  283. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  284. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  285. package/views/3d/state/controllers/RotateController.js +1 -1
  286. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  287. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  288. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  289. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  290. package/views/3d/state/utils/navigationUtils.js +1 -1
  291. package/views/3d/support/DisplayQualityProfile.js +1 -1
  292. package/views/3d/support/QualitySettings.js +1 -1
  293. package/views/3d/support/StreamDataLoader.js +1 -1
  294. package/views/3d/support/engineContent/line.js +1 -1
  295. package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
  296. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  297. package/views/3d/support/flow/FlowWorker.js +1 -1
  298. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  299. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  300. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  301. package/views/3d/support/flow/constants.js +1 -1
  302. package/views/3d/support/hitTest.js +1 -1
  303. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  304. package/views/3d/terrain/OverlayRenderer.js +1 -1
  305. package/views/3d/terrain/Tile.js +1 -1
  306. package/views/3d/terrain/TileOverlayData.js +1 -1
  307. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  308. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  309. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  310. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  311. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  312. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +7 -7
  313. package/views/3d/webgl-engine/core/shaderModules/BooleanDrawUniform.js +5 -0
  314. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConstructionContext.js +1 -1
  315. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  316. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  317. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  318. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  319. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +4 -4
  320. package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
  321. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  322. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
  323. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  324. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  325. package/views/analysis/ElevationProfile/constants.js +1 -1
  326. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  327. package/views/draw/support/Reshape.js +1 -1
  328. package/views/draw/support/reshapeUtils.js +1 -1
  329. package/views/interactive/dragEventPipeline.js +1 -1
  330. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  331. package/views/support/Scheduler.js +1 -1
  332. package/views/webgl/ShaderBuilder.js +1 -1
  333. package/views/webgl/Texture.js +1 -1
  334. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  335. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  336. package/widgets/BatchAttributeForm.js +1 -1
  337. package/widgets/Directions/css.js +1 -1
  338. package/widgets/Directions.js +1 -1
  339. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  340. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  341. package/widgets/Editor/EditorViewModel.js +1 -1
  342. package/widgets/Editor/Edits.js +1 -1
  343. package/widgets/Editor/MergeFeaturesWorkflow.d.ts +4 -0
  344. package/widgets/Editor/MergeFeaturesWorkflow.js +5 -0
  345. package/widgets/Editor/MergeFeaturesWorkflowData.d.ts +4 -0
  346. package/widgets/Editor/MergeFeaturesWorkflowData.js +5 -0
  347. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  348. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  349. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  350. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  351. package/widgets/Editor/components/UploadDetails.js +1 -1
  352. package/widgets/Editor/support/EditorItem.js +1 -1
  353. package/widgets/Editor/support/mergeFeaturesUtils.js +5 -0
  354. package/widgets/Editor/workflowUtils.js +1 -1
  355. package/widgets/Editor.js +1 -1
  356. package/widgets/Feature/FeatureExpression.js +1 -1
  357. package/widgets/Feature/FeatureFields/FeatureFieldsViewModel.js +1 -1
  358. package/widgets/Feature/FeatureFields.js +1 -1
  359. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  360. package/widgets/Feature/FeatureMedia.js +1 -1
  361. package/widgets/Feature/FeatureViewModel.js +1 -1
  362. package/widgets/Feature/support/featureUtils.js +1 -1
  363. package/widgets/Feature.js +1 -1
  364. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  365. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  366. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  367. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  368. package/widgets/Print.js +1 -1
  369. package/widgets/Search/LayerSearchSource.js +1 -1
  370. package/widgets/UtilityNetworkTrace.js +1 -1
  371. package/widgets/support/ColorPicker.js +1 -1
  372. package/widgets/support/SelectionList/LayerItem.js +1 -1
  373. package/widgets/support/jsxWidgetSupport.js +1 -1
  374. package/assets/esri/core/workers/chunks/0429c1a3690f20647c9f.js +0 -1
  375. package/assets/esri/core/workers/chunks/065f2bbcaeef1f13fd48.js +0 -1
  376. package/assets/esri/core/workers/chunks/0731e588afd1f561ec3b.js +0 -1
  377. package/assets/esri/core/workers/chunks/188272af9a6470ccfe31.js +0 -1
  378. package/assets/esri/core/workers/chunks/18da83afbc324fef9fd8.js +0 -316
  379. package/assets/esri/core/workers/chunks/1a9f544f20f643161a36.js +0 -1
  380. package/assets/esri/core/workers/chunks/1cfcadaa98ac528fea37.js +0 -1
  381. package/assets/esri/core/workers/chunks/1db0bf570a04687b3130.js +0 -1
  382. package/assets/esri/core/workers/chunks/24921d31efa8d222ad2d.js +0 -2
  383. package/assets/esri/core/workers/chunks/2a900a632a1231deb713.js +0 -1
  384. package/assets/esri/core/workers/chunks/31c6e951b99315e8e68a.js +0 -1
  385. package/assets/esri/core/workers/chunks/35491fbdd287470d40a4.js +0 -1
  386. package/assets/esri/core/workers/chunks/36247c6f6fc2891df2cf.js +0 -1
  387. package/assets/esri/core/workers/chunks/3d53307efbc3f07d7bf2.js +0 -1
  388. package/assets/esri/core/workers/chunks/40b81d1c2d53cf598b8e.js +0 -1
  389. package/assets/esri/core/workers/chunks/42a72e1d963e4636323b.js +0 -1
  390. package/assets/esri/core/workers/chunks/456161a323be7d640c61.js +0 -1
  391. package/assets/esri/core/workers/chunks/500d09d2191127371081.js +0 -1
  392. package/assets/esri/core/workers/chunks/50864c1924030e62497d.js +0 -1
  393. package/assets/esri/core/workers/chunks/5707713c2f27588b9194.js +0 -1
  394. package/assets/esri/core/workers/chunks/5713f96bade5ebb54c81.js +0 -1
  395. package/assets/esri/core/workers/chunks/5718cf135e105e1e026b.js +0 -1
  396. package/assets/esri/core/workers/chunks/5c585b338a9e9aa0e205.js +0 -1
  397. package/assets/esri/core/workers/chunks/5d1d909354c90cb8eb60.js +0 -1
  398. package/assets/esri/core/workers/chunks/5ea03f53d4d64d9e7cae.js +0 -1
  399. package/assets/esri/core/workers/chunks/63019a7eb5222dc5e420.js +0 -1
  400. package/assets/esri/core/workers/chunks/64629ddcf008349eaf41.js +0 -1
  401. package/assets/esri/core/workers/chunks/64ee8d2acae2d6fce608.js +0 -1
  402. package/assets/esri/core/workers/chunks/6fcacfcb3d83515c37c9.js +0 -1
  403. package/assets/esri/core/workers/chunks/72ecf49d03bb24bf0998.js +0 -1
  404. package/assets/esri/core/workers/chunks/7421f9575487cdc9e28e.js +0 -1
  405. package/assets/esri/core/workers/chunks/77a11d7d53325d108ed8.js +0 -1
  406. package/assets/esri/core/workers/chunks/7a05b1f6163112bc9db2.js +0 -1
  407. package/assets/esri/core/workers/chunks/7d9882ddfa6495f72baa.js +0 -1
  408. package/assets/esri/core/workers/chunks/7fffad8ff6878fa1fd56.js +0 -1
  409. package/assets/esri/core/workers/chunks/81bbe5251ed13c0d91cc.js +0 -1
  410. package/assets/esri/core/workers/chunks/8b16aa50d879b92a5375.js +0 -1
  411. package/assets/esri/core/workers/chunks/8bc64fc7c4b9eb8fca4d.js +0 -1
  412. package/assets/esri/core/workers/chunks/8bfa19c24be0e3f3fd74.js +0 -1
  413. package/assets/esri/core/workers/chunks/8eefa133c36a004c054c.js +0 -1
  414. package/assets/esri/core/workers/chunks/9834bc11586a2d8d6f35.js +0 -1
  415. package/assets/esri/core/workers/chunks/9c6fc4fe2c46f40d63d9.js +0 -1
  416. package/assets/esri/core/workers/chunks/a5f25104938ab33e7a85.js +0 -1
  417. package/assets/esri/core/workers/chunks/a7bd294996e6c8b8354a.js +0 -1
  418. package/assets/esri/core/workers/chunks/abf4f018c692c18c3320.js +0 -1
  419. package/assets/esri/core/workers/chunks/b1f667006cba60ef4aa7.js +0 -1
  420. package/assets/esri/core/workers/chunks/b2d9f4e057af26a538fb.js +0 -1
  421. package/assets/esri/core/workers/chunks/b62807c6fcfb70a87cd4.js +0 -1
  422. package/assets/esri/core/workers/chunks/b8339c1d60847a9eed3e.js +0 -1
  423. package/assets/esri/core/workers/chunks/bc6619307f312f9241bf.js +0 -1
  424. package/assets/esri/core/workers/chunks/bfc1e8aec7aace3ff30e.js +0 -1
  425. package/assets/esri/core/workers/chunks/c362fbbafec91c44eeb2.js +0 -1
  426. package/assets/esri/core/workers/chunks/c368a8e8d2f1535af446.js +0 -1
  427. package/assets/esri/core/workers/chunks/c941d15190fc08523d0d.js +0 -1
  428. package/assets/esri/core/workers/chunks/cc70a4a915b0b2ccb2a0.js +0 -1
  429. package/assets/esri/core/workers/chunks/d121045cddbe55c2ecb2.js +0 -1
  430. package/assets/esri/core/workers/chunks/d2120a623b1bd91b9ed9.js +0 -1
  431. package/assets/esri/core/workers/chunks/d78c2833cdc4730a88a3.js +0 -1
  432. package/assets/esri/core/workers/chunks/df438b62702007267798.js +0 -1
  433. package/assets/esri/core/workers/chunks/f4eb090bcc3eca64306a.js +0 -1
  434. package/assets/esri/core/workers/chunks/f7846523adacbfe5047e.js +0 -1
  435. package/assets/esri/core/workers/chunks/f839b86bee15deaf84e4.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{dedupeResult as t}from"../../../core/dedupeResult.js";import{equalsShallow as o}from"../../../core/lang.js";import{equalsMaybe as r}from"../../../core/maybe.js";import{watch as i}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as a}from"../../../layers/support/GeometryDescriptor.js";import{getVisibleLayerIds as l}from"./elevationProfileLayerUtils.js";import{ElevationProfileLineComputation as c}from"./ElevationProfileLineComputation.js";let p=class extends c{constructor(){super(...arguments),this.type="input",this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this._getStableElevationDependencies=t(()=>{const{view:e}=this.controller;if(!e)return null;const t=this._getStableElevationInfo();return{view:e,stationary:!this._requiresElevationAlignment||e.stationary,elevationInfo:t,visibleLayerIds:this._getStableLayerIds(),spatialReference:this._getStableSpatialReference()}},o),this._getStableElevationInfo=t(()=>this.controller.elevationInfo,r),this._getStableSpatialReference=t(()=>this.controller.view?.spatialReference,r),this._getStableLayerIds=t(()=>{const{view:e}=this.controller;return"3d"!==e.type?[]:l(e)},o)}initialize(){const e=()=>this.onInvalidate(this);this.addHandles([i(()=>this._queryElevationDependencies,e),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:o}){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{view:i,spatialReference:n}=r;if(this._requiresElevationAlignment&&"3d"===i.type&&n){const r=await a.fromGeometry(e).project(n,o);if(!r)return{geometry:e,noDataValue:t};const s=i.elevationProvider;return r.coordinates.forEach(e=>{e.z=s.getElevation(e.x,e.y,0,n,"ground")??0}),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}get _requiresElevationAlignment(){return"on-the-ground"===this.controller.elevationInfo?.mode&&"3d"===this.controller.view.type}get _queryElevationDependencies(){return this._getStableElevationDependencies()}};e([n()],p.prototype,"_queryElevationDependencies",null),p=e([s("esri.views.analysis.ElevationProfile.ElevationProfileLineInputComputation")],p);export{p as ElevationProfileLineInputComputation};
5
+ import{__decorate as e}from"tslib";import{dedupeResult as t}from"../../../core/dedupeResult.js";import{equalsShallow as o}from"../../../core/lang.js";import{equalsMaybe as r}from"../../../core/maybe.js";import{watch as i,sync as n}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as l}from"../../../layers/support/GeometryDescriptor.js";import{getVisibleLayerIds as c}from"./elevationProfileLayerUtils.js";import{ElevationProfileLineComputation as p}from"./ElevationProfileLineComputation.js";let u=class extends p{constructor(){super(...arguments),this.type="input",this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this._getStableElevationDependencies=t(()=>{const{view:e}=this.controller;if(!e)return null;const t=this._getStableElevationInfo();return{view:e,stationary:!this._requiresElevationAlignment||e.stationary,elevationInfo:t,visibleLayerIds:this._getStableLayerIds(),spatialReference:this._getStableSpatialReference()}},o),this._getStableElevationInfo=t(()=>this.controller.elevationInfo,r),this._getStableSpatialReference=t(()=>this.controller.view?.spatialReference,r),this._getStableLayerIds=t(()=>{const{view:e}=this.controller;return"3d"!==e.type?[]:c(e)},o)}initialize(){const e=()=>this.onInvalidate(this);this.addHandles([i(()=>this._queryElevationDependencies,e,n),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:o}){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{view:i,spatialReference:n}=r;if(this._requiresElevationAlignment&&"3d"===i.type&&n){const r=await l.fromGeometry(e).project(n,o);if(!r)return{geometry:e,noDataValue:t};const s=i.elevationProvider;return r.coordinates.forEach(e=>{e.z=s.getElevation(e.x,e.y,0,n,"ground")??0}),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}get _requiresElevationAlignment(){return"on-the-ground"===this.controller.elevationInfo?.mode&&"3d"===this.controller.view.type}get _queryElevationDependencies(){return this._getStableElevationDependencies()}};e([s()],u.prototype,"_queryElevationDependencies",null),u=e([a("esri.views.analysis.ElevationProfile.ElevationProfileLineInputComputation")],u);export{u as ElevationProfileLineInputComputation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{Clonable as e}from"../../../core/Clonable.js";import{memoize as o}from"../../../core/memoize.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../../../geometry/Point.js";import{binaryFindClosest as i}from"./elevationProfileGenerationUtils.js";import{convertSamples as n,convertStatistics as a}from"./elevationProfileUnitUtils.js";let p=class extends e{constructor(t){super(t),this._getSamplesMemoized=o((t,e)=>n(t,e)),this._getStatisticsMemoized=o((t,e)=>a(t,e)),this.rawResult=null}get available(){const{computation:t}=this;return t.profile.enabled&&t.available}get profile(){return this.computation.profile}get progress(){return null!=this.rawResult&&this.computation.profile.enabled?this.rawResult.progress:0}get samples(){return this._getSamplesMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get statistics(){return this._getStatisticsMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get hoveredPoint(){if(!this.computation.profile.enabled)return null;const t=this.computation.controller.analysisViewData.hoveredPosition;if(null==t)return null;const{rawResult:e,samples:o}=this;if(null==o||null==e)return null;const r=o.length;if(0===r)return null;const s=o[r-1].distance,n=i(o,t*s,t=>t.distance);if(null==n)return null;const{x:a,y:p,z:u}=n;return null==u?null:new l({x:a,y:p,z:u,spatialReference:e.spatialReference})}};t([r()],p.prototype,"available",null),t([r({readOnly:!0})],p.prototype,"profile",null),t([r({readOnly:!0})],p.prototype,"progress",null),t([r()],p.prototype,"samples",null),t([r()],p.prototype,"statistics",null),t([r({constructOnly:!0})],p.prototype,"computation",void 0),t([r()],p.prototype,"rawResult",void 0),t([r()],p.prototype,"hoveredPoint",null),p=t([s("esri.views.analysis.ElevationProfile.ElevationProfileResult")],p);export{p as default};
5
+ import{__decorate as t}from"tslib";import{Clonable as e}from"../../../core/Clonable.js";import{memoize as o}from"../../../core/memoize.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../../../geometry/Point.js";import{sanitizeProgress as i,binaryFindClosest as n}from"./elevationProfileGenerationUtils.js";import{convertSamples as a,convertStatistics as p}from"./elevationProfileUnitUtils.js";let u=class extends e{constructor(t){super(t),this._getSamplesMemoized=o((t,e)=>a(t,e)),this._getStatisticsMemoized=o((t,e)=>p(t,e)),this.rawResult=null}get available(){const{computation:t}=this;return t.profile.enabled&&t.available}get profile(){return this.computation.profile}get progress(){return i(null!=this.rawResult&&this.computation.profile.enabled?this.rawResult.progress:0)}get samples(){return this._getSamplesMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get statistics(){return this._getStatisticsMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get hoveredPoint(){if(!this.computation.profile.enabled)return null;const t=this.computation.controller.analysisViewData.hoveredPosition;if(null==t)return null;const{rawResult:e,samples:o}=this;if(null==o||null==e)return null;const r=o.length;if(0===r)return null;const s=o[r-1].distance,i=n(o,t*s,t=>t.distance);if(null==i)return null;const{x:a,y:p,z:u}=i;return null==u?null:new l({x:a,y:p,z:u,spatialReference:e.spatialReference})}};t([r()],u.prototype,"available",null),t([r({readOnly:!0})],u.prototype,"profile",null),t([r({readOnly:!0})],u.prototype,"progress",null),t([r()],u.prototype,"samples",null),t([r()],u.prototype,"statistics",null),t([r({constructOnly:!0})],u.prototype,"computation",void 0),t([r()],u.prototype,"rawResult",void 0),t([r()],u.prototype,"hoveredPoint",null),u=t([s("esri.views.analysis.ElevationProfile.ElevationProfileResult")],u);export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import s from"../../../core/Accessor.js";import{createTask as i}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{makeHandle as a}from"../../../core/handleUtils.js";import{ignoreAbortErrors as r,isAborted as o,throwIfAborted as n}from"../../../core/promiseUtils.js";import{watch as c,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../core/support/UpdatingHandles.js";import m from"../../../layers/GraphicsLayer.js";import{getGraphicEffectiveElevationInfo as y}from"../../../support/elevationInfoUtils.js";import u from"../../../symbols/CIMSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import _ from"../../../symbols/support/ElevationInfo.js";import{ExclusiveOperationManager as f}from"../ExclusiveOperationManager.js";import{isPolyline as k,isValidInputGraphic as v}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as w}from"../../input/InputManager.js";import{isCancelEvent as G}from"../../interactive/interactiveToolUtils.js";import b from"../../../widgets/Sketch/SketchViewModel.js";let S=class extends s{constructor(e){super(e),this._updatingHandles=new d,this._operationManager=new f}initialize(){const{view:e}=this;this._graphicsLayer=new m({listMode:"hide",internal:!0}),this._sketchViewModel=new b({layer:this._graphicsLayer,view:e,defaultCreateOptions:{mode:"click",hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol}),this.addHandles([c(()=>({map:e.map,internalGraphicsLayer:this._graphicsLayer,state:this.state,sketchGraphicVisible:this._analysis.viewOptions.geometryVisualizationVisible}),({map:e,internalGraphicsLayer:t,state:s,sketchGraphicVisible:i})=>{j(e,t);const a=this.sketchGraphic;switch(a&&(a.visible=!0),s){case"idle":case"reshaping-disabled":a&&!i&&(a.visible=!1),this._operationManager.stop(),this._ensureUpdatedSketchGraphic();break;case"reshaping":r(this._startReshape());break;case"awaiting-sketch":this.analysisViewData.interactive=!0}},h),c(()=>this._analysis.elevationInfo,e=>{this._graphicsLayer.elevationInfo=e},h)])}destroy(){this._operationManager.destroy(),this._sketchViewModel.destroy();const e=this._graphicsLayer;this.view.map?.remove(e),e.destroy()}get sketchGraphic(){return this._get("sketchGraphic")}set sketchGraphic(e){e!==this._get("sketchGraphic")&&(this._set("sketchGraphic",e),L(this._graphicsLayer,e),this._updateAnalysisFromSketchGraphic())}get state(){const{visible:e,interactive:t}=this.analysisViewData;if(!e)return"idle";switch(this._operationManager.currentOperationType){case"place":return this._sketchViewModel.createGraphic===this.sketchGraphic?"sketching":"awaiting-sketch";case"pick-feature":return"picking";default:return this._analysis.geometry?t?"reshaping":"reshaping-disabled":"idle"}}get updating(){return this._sketchViewModel.updating||this._updatingHandles.updating}get _analysis(){return this.analysisViewData.analysis}get _lineSymbol(){return M(this.view.type)}place(e){return this._operationManager.start("place",async t=>{const s=this._analysis.clone();this._ensureUpdatedSketchGraphic();const i=this._sketchViewModel.on("create",e=>{switch(e.state){case"start":this.sketchGraphic=e.graphic,this._analysis.elevationInfo=this._graphicsLayer.elevationInfo;break;case"active":this._updateAnalysisFromSketchGraphic();break;case"complete":this._updateAnalysisFromSketchGraphic(),t.stop();break;case"cancel":t.stop()}});t.handles.push(i,a(()=>(i.remove(),this._sketchViewModel.cancel(),this._updateAnalysisFromSketchGraphic(),this._analysis.valid?o(e)||s.equals(this._analysis)?t.reject():void t.resolve({}):(this._clear(),t.reject()))),this._stashSketchGraphic()),this._graphicsLayer.elevationInfo=V,await this._updatingHandles.addPromise(r(this._sketchViewModel.create("polyline")))},e)}_stashSketchGraphic(){const e=this.sketchGraphic;if(!e)return a();const t=this._analysis.elevationInfo,s=new m({listMode:"hide",internal:!0,elevationInfo:t});return this.view.map.add(s),s.graphics.add(e),a(()=>{this.sketchGraphic===e&&(this._graphicsLayer.elevationInfo=t,this._graphicsLayer.add(e)),s.removeFromParent(),s.destroy()})}async pickFeature(e){return this._operationManager.start("pick-feature",async e=>{const{view:t}=this;t.closePopup();let s=null;const r=a=>{a.defer(async()=>{s?.abort(),s=i(async s=>{const{results:i}=await t.hitTest(a);n(s);const r=i.filter(e=>"graphic"===e.type).map(e=>e.graphic).find(v);r?(a.preventDefault(),a.stopPropagation(),this.sketchGraphic=null,this._analysis.geometry=r.geometry,this._analysis.elevationInfo=new _({...y(r)}),e.resolve({feature:r}),e.stop()):e.reject()}),await s.promise})},o=t=>{G(t)&&(e.reject(),e.stop())};e.handles.push(t.on("immediate-click",r,w.TOOL),t.on("key-down",o,w.TOOL),t.acquireCursor("crosshair","high"),a(()=>{s?.abort(),e.reject()})),t.focus()},e)}_startReshape(){return this._operationManager.start("reshape",async e=>{const t=()=>{const e=this._ensureUpdatedSketchGraphic();return e?(L(this._graphicsLayer,e),this._updatingHandles.addPromise(this._sketchViewModel.update(e,{tool:"reshape"}))):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;const s=this._sketchViewModel.on("update",s=>{this._updateAnalysisFromSketchGraphic(),"complete"===s.state&&("reshaping"===this.state?r(t()):e.resolve())});e.handles.push(s,a(()=>{s.remove(),this._sketchViewModel.cancel(),e.resolve()})),await t()})}_ensureUpdatedSketchGraphic(){const{geometry:e}=this._analysis;if(!e)return this.sketchGraphic=null,null;const s=this.sketchGraphic??=new t({symbol:this._lineSymbol,geometry:e});return s.geometry=e,s}_clear(){this.sketchGraphic=null,this._analysis.clear()}_updateAnalysisFromSketchGraphic(){let e=this.sketchGraphic?.geometry;k(e)||(e=null);const t=this._analysis;t.geometry!==e&&(t.geometry=e)}};function M(e){if("2d"===e){const e={type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5};return new u({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{...e,effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],color:[0,0,0,255]},{...e,color:[255,255,255,255]}]}}})}return new g({color:[0,0,0,0]})}function j(e,t){t&&(t.removeFromParent(),e?.add(t))}function L({graphics:e},t){t?(e.includes(t)||e.add(t),1!==e.length&&e.removeMany(e.filter(e=>e!==t))):e.removeAll()}e([l({constructOnly:!0})],S.prototype,"analysisViewData",void 0),e([l({constructOnly:!0})],S.prototype,"view",void 0),e([l()],S.prototype,"sketchGraphic",null),e([l({nonNullable:!0})],S.prototype,"state",null),e([l()],S.prototype,"updating",null),e([l()],S.prototype,"_analysis",null),e([l()],S.prototype,"_lineSymbol",null),S=e([p("esri.views.analysis.ElevationProfile.ElevationProfileTool")],S);const V=new _({mode:"on-the-ground",offset:0});export{S as ElevationProfileTool};
5
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import s from"../../../core/Accessor.js";import{createTask as i}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{makeHandle as a}from"../../../core/handleUtils.js";import{ignoreAbortErrors as r,isAborted as o,throwIfAborted as n}from"../../../core/promiseUtils.js";import{watch as l,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../core/support/UpdatingHandles.js";import m from"../../../layers/GraphicsLayer.js";import{getGraphicEffectiveElevationInfo as y}from"../../../support/elevationInfoUtils.js";import u from"../../../symbols/CIMSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import _ from"../../../symbols/support/ElevationInfo.js";import{ExclusiveOperationManager as f}from"../ExclusiveOperationManager.js";import{isPolyline as k,isValidInputGraphic as v}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as w}from"../../input/InputManager.js";import{isCancelEvent as b}from"../../interactive/interactiveToolUtils.js";import G from"../../../widgets/Sketch/SketchViewModel.js";let S=class extends s{constructor(e){super(e),this._updatingHandles=new d,this._operationManager=new f}initialize(){const{view:e}=this;this._graphicsLayer=new m({listMode:"hide",internal:!0}),this._sketchViewModel=new G({layer:this._graphicsLayer,view:e,defaultCreateOptions:{mode:"click",hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{shapeOperation:"none"},toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol}),this.addHandles([l(()=>({map:e.map,internalGraphicsLayer:this._graphicsLayer,state:this.state,geometryVisualizationVisible:this._analysis.viewOptions.geometryVisualizationVisible,visible:this.analysisViewData.visible}),({map:e,internalGraphicsLayer:t,state:s,geometryVisualizationVisible:i,visible:a})=>{j(e,t);const o=this.sketchGraphic;switch(o&&(o.visible=a),s){case"idle":case"reshaping-disabled":o&&!i&&(o.visible=!1),this._operationManager.stop(),this._ensureUpdatedSketchGraphic();break;case"reshaping":r(this._startReshape());break;case"awaiting-sketch":this.analysisViewData.interactive=!0}},c),l(()=>this._analysis.elevationInfo,e=>{this._graphicsLayer.elevationInfo=e},c)])}destroy(){this._operationManager.destroy(),this._sketchViewModel.destroy();const e=this._graphicsLayer;this.view.map?.remove(e),e.destroy()}get sketchGraphic(){return this._get("sketchGraphic")}set sketchGraphic(e){e!==this._get("sketchGraphic")&&(this._set("sketchGraphic",e),L(this._graphicsLayer,e),this._updateAnalysisFromSketchGraphic())}get state(){const{visible:e,interactive:t}=this.analysisViewData;if(!e)return"idle";switch(this._operationManager.currentOperationType){case"place":return this._sketchViewModel.createGraphic===this.sketchGraphic?"sketching":"awaiting-sketch";case"pick-feature":return"picking";default:return this._analysis.geometry?t?"reshaping":"reshaping-disabled":"idle"}}get updating(){return this._sketchViewModel.updating||this._updatingHandles.updating}get _analysis(){return this.analysisViewData.analysis}get _lineSymbol(){return M(this.view.type)}place(e){return this._operationManager.start("place",async t=>{const s=this._analysis.clone();this._ensureUpdatedSketchGraphic();const i=this._stashSketchGraphic(),n=this._sketchViewModel.on("create",e=>{switch(e.state){case"start":this.sketchGraphic=e.graphic,this._analysis.elevationInfo=this._graphicsLayer.elevationInfo,i.remove();break;case"active":this._updateAnalysisFromSketchGraphic();break;case"complete":this._updateAnalysisFromSketchGraphic(),t.stop();break;case"cancel":t.stop()}});t.handles.push(n,a(()=>(n.remove(),this._sketchViewModel.cancel(),this._updateAnalysisFromSketchGraphic(),this._analysis.valid?o(e)||s.equals(this._analysis)?t.reject():void t.resolve({}):(this._clear(),t.reject()))),i),this._graphicsLayer.elevationInfo=V,await this._updatingHandles.addPromise(r(this._sketchViewModel.create("polyline")))},e)}_stashSketchGraphic(){const e=this.sketchGraphic;if(!e)return a();const t=this._analysis.elevationInfo,s=new m({listMode:"hide",internal:!0,elevationInfo:t});return this.view.map.add(s),s.graphics.add(e),a(()=>{this.sketchGraphic===e&&(this._graphicsLayer.elevationInfo=t,this._graphicsLayer.add(e)),s.removeFromParent(),s.destroy()})}async pickFeature(e){return this._operationManager.start("pick-feature",async e=>{const{view:t}=this;t.closePopup();let s=null;const r=a=>{a.defer(async()=>{s?.abort(),s=i(async s=>{const{results:i}=await t.hitTest(a);n(s);const r=i.filter(e=>"graphic"===e.type).map(e=>e.graphic).find(v);r?(a.preventDefault(),a.stopPropagation(),this.sketchGraphic=null,this._analysis.geometry=r.geometry,this._analysis.elevationInfo=new _({...y(r)}),e.resolve({feature:r}),e.stop()):e.reject()}),await s.promise})},o=t=>{b(t)&&(e.reject(),e.stop())};e.handles.push(t.on("immediate-click",r,w.TOOL),t.on("key-down",o,w.TOOL),t.acquireCursor("crosshair","high"),a(()=>{s?.abort(),e.reject()})),t.focus()},e)}_startReshape(){return this._operationManager.start("reshape",async e=>{const t=()=>{const e=this._ensureUpdatedSketchGraphic();return e?(L(this._graphicsLayer,e),this._updatingHandles.addPromise(this._sketchViewModel.update(e,{tool:"reshape"}))):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;const s=this._sketchViewModel.on("update",s=>{this._updateAnalysisFromSketchGraphic(),"complete"===s.state&&("reshaping"===this.state?r(t()):e.resolve())});e.handles.push(s,a(()=>{s.remove(),this._sketchViewModel.cancel(),e.resolve()})),await t()})}_ensureUpdatedSketchGraphic(){const{geometry:e}=this._analysis;if(!e)return this.sketchGraphic=null,null;const s=this.sketchGraphic??=new t({symbol:this._lineSymbol,geometry:e});return s.geometry=e,s}_clear(){this.sketchGraphic=null,this._analysis.clear()}_updateAnalysisFromSketchGraphic(){let e=this.sketchGraphic?.geometry;k(e)||(e=null);const t=this._analysis;t.geometry!==e&&(t.geometry=e)}};function M(e){if("2d"===e){const e={type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5};return new u({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{...e,effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],color:[0,0,0,255]},{...e,color:[255,255,255,255]}]}}})}return new g({color:[0,0,0,0]})}function j(e,t){t&&(t.removeFromParent(),e?.add(t))}function L({graphics:e},t){t?(e.includes(t)||e.add(t),1!==e.length&&e.removeMany(e.filter(e=>e!==t))):e.removeAll()}e([h({constructOnly:!0})],S.prototype,"analysisViewData",void 0),e([h({constructOnly:!0})],S.prototype,"view",void 0),e([h()],S.prototype,"sketchGraphic",null),e([h({nonNullable:!0})],S.prototype,"state",null),e([h()],S.prototype,"updating",null),e([h()],S.prototype,"_analysis",null),e([h()],S.prototype,"_lineSymbol",null),S=e([p("esri.views.analysis.ElevationProfile.ElevationProfileTool")],S);const V=new _({mode:"on-the-ground",offset:0});export{S as ElevationProfileTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{makeHandle as e}from"../../../core/handleUtils.js";import{convertUnit as t}from"../../../core/unitUtils.js";let l={noDataValue:-5e5,defaultQueryOptions:()=>({noDataValue:l.noDataValue,demResolution:"auto",maximumAutoTileRequests:150,ignoreInvisibleLayers:!0,signal:null}),updateThrottleMillis:100,delayAfterPreviewMillis:500,defaultDemResolution:t(10,"centimeters","meters"),densificationMaxSamples:3e3,largeChartSamples:1e4,maxTotalSamples:1e5,maxChartRatio:300,minSlopeSampleDistance:10,formatPrecision:1,profileLinesUpdateThrottleMillis:100,hoveredPointsStyle:{size:14,borderStyle:"solid",borderWidth:3,borderColor:"#ffffff",boxShadow:"0px 0px 0px 5px rgba(255,255,255,0.2)"}};function i(){return l}function a(t){const i=l;return l={...l,...t},e(()=>{l=i})}function o(){return a({defaultDemResolution:100,densificationMaxSamples:500,updateThrottleMillis:0,delayAfterPreviewMillis:0})}const r={progress:1,hasZ:!1,samples:[],statistics:null,spatialReference:null},s=" ― ";export{r as errorResult,i as getConfig,s as notAvailable,a as setConfig,o as setTestConfig};
5
+ import{makeHandle as e}from"../../../core/handleUtils.js";import{convertUnit as t}from"../../../core/unitUtils.js";let l={noDataValue:-5e5,defaultQueryOptions:()=>({noDataValue:l.noDataValue,demResolution:"auto",maximumAutoTileRequests:150,ignoreInvisibleLayers:!0,signal:null}),updateThrottleMillis:100,delayAfterPreviewMillis:500,defaultDemResolution:t(10,"centimeters","meters"),densificationMaxSamples:3e3,largeChartSamples:1e4,maxTotalSamples:1e5,maxChartRatio:300,minSlopeSampleDistance:10,formatPrecision:1,profileLinesUpdateThrottleMillis:100,hoveredPointsStyle:{size:14,borderStyle:"solid",borderWidth:3,borderColor:"#ffffff",boxShadow:"0px 0px 0px 5px rgba(255,255,255,0.2)"}};function i(){return l}function o(t){const i=l;return l={...l,...t},e(()=>{l=i})}function a(){return o({defaultDemResolution:100,densificationMaxSamples:500,updateThrottleMillis:0,delayAfterPreviewMillis:0,profileLinesUpdateThrottleMillis:0})}const r={progress:1,hasZ:!1,samples:[],statistics:null,spatialReference:null},s=" ― ";export{r as errorResult,i as getConfig,s as notAvailable,o as setConfig,a as setTestConfig};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{splitIntoChunks as e}from"../../../core/arrayUtils.js";import{lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as r,throwIfNotAbortError as n,after as o,isAbortError as s}from"../../../core/promiseUtils.js";import i from"../../../geometry/Multipoint.js";import{unnormalizedCoordinate as l}from"../../../geometry/support/coordsUtils.js";import{getInfo as a}from"../../../geometry/support/spatialReferenceUtils.js";import{getConfig as c,errorResult as u}from"./constants.js";import{InvalidGeometryError as p,TooComplexError as f,ElevationQueryError as m}from"./elevationProfileErrors.js";import{isValidInputPath as d,countPoints as h,densifyPath as y}from"./elevationProfileGeometryUtils.js";import{getStatistics as w}from"./elevationProfileStatisticsUtils.js";import{breadthFirstBinaryPartitioning as g}from"./elevationProfileTraversalUtils.js";import{ScheduledQueueProcessor as v}from"../../support/ScheduledQueueProcessor.js";import{TaskPriority as P}from"../../support/Scheduler.js";async function*j(e,t){const{view:n,geometry:s,elevationInfo:i,providers:l,options:a}=e,u=n.spatialReference;if(!u||null==s||!d(s))throw new p;const m=l.length;if(0===m)return null;const w=Math.round(a.maxTotalSamples/m);if(h(s)>w)throw new f;const g=await y(s,i,n,u,a,w,t);r(t);let v=0;const P=new Array(m),j=new Array(m);for(let r=0;r<m;r++){const n=M(g);P[r]=n,v+=n.samples.length;const o={...e,provider:l[r],result:n,densificationResult:g};j[r]=R(o,t)[Symbol.iterator]()}if(v>a.maxTotalSamples)throw new f;const Z=await Promise.all(j.map(e=>{const t=e.next();return!0===t.done?Promise.resolve(null):t.value}));r(t);for(let r=0;r<m;r++)P[r]=Z[r];yield P,await o(e.delayAfterPreview??c().delayAfterPreviewMillis,null,t.signal),r(t);const S=[];try{let e;do{e=!1;for(let t=0;t<m;t++){const r=j[t].next();!1===r.done&&(S.push({resultPromise:r.value,index:t}),e=!0)}}while(e)}finally{j.forEach(e=>e.return?.())}for(const{resultPromise:o,index:c}of S)P[c]=await o,r(t),yield P;for(const r of P)null!=r&&(r.progress=1);yield P}function*R(t,r){const{densificationResult:n}=t,o={...t,abortOptions:r,densificationResult:n},s=g(0,o.result.samples.length),i=s.slice(0,o.provider.numSamplesForPreview);yield Z(o,i,!0);const l=e(s,o.provider.numSamplesPerChunk);for(const e of l)yield Z(o,e,!1)}async function Z({densificationResult:e,result:t,provider:r,queue:n,abortOptions:o,cache:l},a,p){const{densifiedPath:f,pathLength:m}=e,d=t.spatialReference,{samples:h}=t,y=[];for(let s=0;s<a.length;s++){const e=h[a[s]];y[s]=[...e.coordinate]}try{return await n.push({geometry:new i({spatialReference:d,points:y,hasZ:f.hasZ}),provider:r,indices:a,preview:p,result:t,parameters:{...c().defaultQueryOptions(),minDemResolution:p?Math.round(m/r.numSamplesForPreview):Math.round(m/h.length),cache:l}},o),{...t}}catch(w){return s(w)?null:u}}function S(e){return new v({priority:P.ELEVATION_PROFILE,concurrency:1,scheduler:e,process:async e=>{r(e.parameters);try{await U(e)}catch(t){n(t)}}})}async function U({geometry:e,provider:t,indices:r,preview:n,result:o,parameters:s}){if(0===r.length)return;const i=(await b(t,e,s)).geometry,{hasZ:l,points:a}=i,c=s.noDataValue,{samples:u}=o;for(let p=0;p<r.length;p++){const e=u[r[p]];if(e.isHole)continue;const t=l?a[p][2]:null;null===t||t===c?e.sampledZ=null:(o.hasZ=!0,e.sampledZ=t),e.sampled=!0}x(u),o.progress=n?0:o.progress+r.length/u.length,o.statistics=w(o.samples,o.spatialReference)}function x(e){const t=e.length-1;let r=0;for(let n=1;n<=t;n++){(e[n].sampled||n===t)&&(E(e,r,n),r=n)}}function E(e,r,n){if(n-r===1)return;const o=e[r],s=o.sampledZ,i=e[n],l=i.sampledZ;if(null==s||null==l){for(let t=r+1;t<n;t++)e[t].sampledZ=null;return}const a=o.distance,c=i.distance-a;for(let u=r+1;u<n;u++){const r=e[u],n=(r.distance-a)/c;r.sampledZ=t(s,l,n)}}function M({densifiedPath:e,distances:t}){const r=e.spatialReference,n=a(r),o=e.paths,s=o.length,i=[];let c=null,u=0;for(let a=0;a<s;a++){const e=o[a],r=e.length,s=t[a];for(let t=0;t<r;t++){const r=e[t],o=s[t];n&&(r[0]=l(r[0],n.valid[0],n.valid[1])),c&&0===t&&A(i,c,r,u,o),i.push(O(r,o)),c=r,u=o}}return{progress:0,samples:i,hasZ:!1,statistics:null,spatialReference:r}}function A(e,t,r,n,o){e.push(T(t,n)),e.push(T(r,o))}function O(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!1,isHole:!1}}function T(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!0,isHole:!0}}async function b(e,t,r){try{return await e.queryElevation(t,r)}catch(n){throw new m}}function F(e,t,r){if(!e||0===e.length)return;const n=e.length-1,o=e[0];if(t<=r(o))return o;const s=e[n];if(t>=r(s))return s;let i=0,l=0,a=n;for(;i<a;){l=i+Math.floor((a-i)/2);const o=e[l],s=r(o);if(s===t)return o;if(t<s){if(l>0){const n=e[l-1],i=r(n);if(t>i)return t-i>=s-t?o:n}a=l}else{if(l<n){const n=e[l+1],i=r(n);if(t<i)return t-s>=i-t?n:o}i=l+1}}return e[l]}export{F as binaryFindClosest,S as createProfileQueue,R as generateProfile,j as generateProfiles,x as interpolateElevations};
5
+ import{splitIntoChunks as e}from"../../../core/arrayUtils.js";import{lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as r,throwIfNotAbortError as n,after as o,isAbortError as s}from"../../../core/promiseUtils.js";import i from"../../../geometry/Multipoint.js";import{unnormalizedCoordinate as l}from"../../../geometry/support/coordsUtils.js";import{getInfo as a}from"../../../geometry/support/spatialReferenceUtils.js";import{getConfig as c,errorResult as u}from"./constants.js";import{InvalidGeometryError as p,TooComplexError as f,ElevationQueryError as m}from"./elevationProfileErrors.js";import{isValidInputPath as d,countPoints as h,densifyPath as y}from"./elevationProfileGeometryUtils.js";import{getStatistics as w}from"./elevationProfileStatisticsUtils.js";import{breadthFirstBinaryPartitioning as g}from"./elevationProfileTraversalUtils.js";import{ScheduledQueueProcessor as v}from"../../support/ScheduledQueueProcessor.js";import{TaskPriority as P}from"../../support/Scheduler.js";async function*j(e,t){const{view:n,geometry:s,elevationInfo:i,providers:l,options:a}=e,u=n.spatialReference;if(!u||null==s||!d(s))throw new p;const m=l.length;if(0===m)return null;const w=Math.round(a.maxTotalSamples/m);if(h(s)>w)throw new f;const g=await y(s,i,n,u,a,w,t);r(t);let v=0;const P=new Array(m),j=new Array(m);for(let r=0;r<m;r++){const n=M(g);P[r]=n,v+=n.samples.length;const o={...e,provider:l[r],result:n,densificationResult:g};j[r]=R(o,t)[Symbol.iterator]()}if(v>a.maxTotalSamples)throw new f;const Z=await Promise.all(j.map(e=>{const t=e.next();return!0===t.done?Promise.resolve(null):t.value}));r(t);for(let r=0;r<m;r++)P[r]=Z[r];yield P,await o(e.delayAfterPreview??c().delayAfterPreviewMillis,null,t.signal),r(t);const S=[];try{let e;do{e=!1;for(let t=0;t<m;t++){const r=j[t].next();!1===r.done&&(S.push({resultPromise:r.value,index:t}),e=!0)}}while(e)}finally{j.forEach(e=>e.return?.())}for(const{resultPromise:o,index:c}of S)P[c]=await o,r(t),yield P;for(const r of P)null!=r&&(r.progress=1);yield P}function*R(t,r){const{densificationResult:n}=t,o={...t,abortOptions:r,densificationResult:n},s=g(0,o.result.samples.length),i=s.slice(0,o.provider.numSamplesForPreview);yield Z(o,i,!0);const l=e(s,o.provider.numSamplesPerChunk);for(const e of l)yield Z(o,e,!1)}async function Z({densificationResult:e,result:t,provider:r,queue:n,abortOptions:o,cache:l},a,p){const{densifiedPath:f,pathLength:m}=e,d=t.spatialReference,{samples:h}=t,y=[];for(let s=0;s<a.length;s++){const e=h[a[s]];y[s]=[...e.coordinate]}try{return await n.push({geometry:new i({spatialReference:d,points:y,hasZ:f.hasZ}),provider:r,indices:a,preview:p,result:t,parameters:{...c().defaultQueryOptions(),minDemResolution:p?Math.round(m/r.numSamplesForPreview):Math.round(m/h.length),cache:l}},o),{...t}}catch(w){return s(w)?null:u}}function S(e){return new v({priority:P.ELEVATION_PROFILE,concurrency:1,scheduler:e,process:async e=>{r(e.parameters);try{await U(e)}catch(t){n(t)}}})}async function U({geometry:e,provider:t,indices:r,preview:n,result:o,parameters:s}){if(0===r.length)return;const i=(await b(t,e,s)).geometry,{hasZ:l,points:a}=i,c=s.noDataValue,{samples:u}=o;for(let p=0;p<r.length;p++){const e=u[r[p]];if(e.isHole)continue;const t=l?a[p][2]:null;null===t||t===c?e.sampledZ=null:(o.hasZ=!0,e.sampledZ=t),e.sampled=!0}x(u),o.progress=n?0:o.progress+r.length/u.length,o.statistics=w(o.samples,o.spatialReference)}function x(e){const t=e.length-1;let r=0;for(let n=1;n<=t;n++){(e[n].sampled||n===t)&&(E(e,r,n),r=n)}}function E(e,r,n){if(n-r===1)return;const o=e[r],s=o.sampledZ,i=e[n],l=i.sampledZ;if(null==s||null==l){for(let t=r+1;t<n;t++)e[t].sampledZ=null;return}const a=o.distance,c=i.distance-a;for(let u=r+1;u<n;u++){const r=e[u],n=(r.distance-a)/c;r.sampledZ=t(s,l,n)}}function M({densifiedPath:e,distances:t}){const r=e.spatialReference,n=a(r),o=e.paths,s=o.length,i=[];let c=null,u=0;for(let a=0;a<s;a++){const e=o[a],r=e.length,s=t[a];for(let t=0;t<r;t++){const r=e[t],o=s[t];n&&(r[0]=l(r[0],n.valid[0],n.valid[1])),c&&0===t&&A(i,c,r,u,o),i.push(O(r,o)),c=r,u=o}}return{progress:0,samples:i,hasZ:!1,statistics:null,spatialReference:r}}function A(e,t,r,n,o){e.push(T(t,n)),e.push(T(r,o))}function O(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!1,isHole:!1}}function T(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!0,isHole:!0}}async function b(e,t,r){try{return await e.queryElevation(t,r)}catch(n){throw new m}}function F(e,t,r){if(!e||0===e.length)return;const n=e.length-1,o=e[0];if(t<=r(o))return o;const s=e[n];if(t>=r(s))return s;let i=0,l=0,a=n;for(;i<a;){l=i+Math.floor((a-i)/2);const o=e[l],s=r(o);if(s===t)return o;if(t<s){if(l>0){const n=e[l-1],i=r(n);if(t>i)return t-i>=s-t?o:n}a=l}else{if(l<n){const n=e[l+1],i=r(n);if(t<i)return t-s>=i-t?n:o}i=l+1}}return e[l]}function H(e){return e>.999999?1:e}export{F as binaryFindClosest,S as createProfileQueue,R as generateProfile,j as generateProfiles,x as interpolateElevations,H as sanitizeProgress};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,assertIsSome as p,abortMaybe as c}from"../../../core/maybe.js";import{pausable as l,when as d,watch as m,initial as v,sync as u}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import f from"../../../geometry/Polyline.js";import{fromGeometry as G,toGeometry as x}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as M,geometryToCoordinates as b}from"../../../geometry/support/coordsUtils.js";import{isPoint as C}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as S}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as E,toEllipticArc7 as w}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as O,isCircularArc as V,isEllipticArc4 as I,isBezierCurve as k,isCoordinate as H,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as R}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as T}from"../../../geometry/support/curves/mathUtils.js";import A from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as j}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as L}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as U,cloneMove as F}from"./drawUtils.js";import D from"./GraphicMover.js";import z from"./HighlightHelper.js";import{addUniqueLayer as K,isConnectedReshapeSupportedLayer as N}from"./layerUtils.js";import{createTooltipInfos as q,connectTooltip as Z,updateTranslateTooltipInfo as $,updateTranslateVertexTooltipInfo as B}from"./reshapeTooltipUtils.js";import{defaultSymbols as J,createMidpointGraphics as Q,createVertexGraphics as W,createCurveControlPointGraphics as X,createCurveConstructionLineGraphics as Y,attributeKeys as tt,getMidpoint as et,controlPointKinds as it,saveUpdatedCurveOrCoordinate as st,toolIdAttribute as ot,splitCurve as rt,isSingleSegmentCircle as nt,isSingleSegmentEllipse as at}from"./reshapeUtils.js";import{ViewEventPriorities as ht}from"../../input/InputManager.js";import{createCoordinateHelper as pt}from"../../interactive/coordinateHelper.js";import{sketchKeys as ct}from"../../interactive/keybindings.js";import{EditGeometryOperations as lt}from"../../interactive/editGeometry/EditGeometryOperations.js";import dt from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as mt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as vt,enterInputModeIfAvailable as ut}from"../../interactive/tooltip/tooltipCommonUtils.js";const yt=Symbol();let _t=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this.activeTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=J,this.sketchOptions=new dt,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new z({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=l(()=>this.graphic?.geometry,t=>{if(!t)return;const e=new Set(this.selectedManipulators.map(wt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(wt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).items;i&&h.push(o),s?.set("graphics",h)},u),this.tooltip=vt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=q(this.sketchOptions),this.addHandles([d(()=>t?.ready,()=>{const{layer:t,view:e}=this;K(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ht.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),m(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),Z(this.tooltip,()=>this._tooltipsContext),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),v),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??pt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedManipulator,automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t);this._editGeometryOperations=h(this._editGeometryOperations)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&M(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;null!=t&&"mesh"!==t.type&&"extent"!==t.type?this._editGeometryOperations??=lt.fromGeometry(t,2,{allowCurves:!0}):this._logGeometryTypeError()}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new A({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;p(i),this._snappingContext=new mt({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new j(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover?.destroy(),this._mover=null,this.removeHandles(yt)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=h(this._editGeometryOperations),this._snappingTask=c(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=gt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=Q(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){this._removeVertexGraphics();const e=W(t,this.symbols,this._coordinateHelper);this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}_setupCurveGraphics(t){this._removeCurveGraphics();const e=X(t,this.symbols,this._coordinateHelper),i=Y(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(e),this.layer.addMany(i)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("outline.color",t),hover:this.symbols.controlPoints.hover?.clone().set("outline.color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[tt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).items;t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new D({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new L({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?Vt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,It(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const e=gt(n);this._updateVertexGraphicLocations(e);const{dxMap:o,dyMap:r}=U(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t,{operationType:r}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)||o.getAttribute(tt.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(O(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.midpointGraphics){const{pathIndex:s,pointIndexStart:o,pointIndexEnd:r}=i.attributes,n=t[s];i.geometry=et(n[o],n[r],e)}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Et(s);null!=t&&null!=e&&s.getAttribute(tt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Et(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(V(r)||I(r)){const i=O(t[e][o-1]),n=V(r)?E(i,r):R(i,r),[a,h]=S(n,.25);s.geometry=new g({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(k(r)){const t=s.getAttribute(tt.controlPointKind),[e,i]=t===it.bezier.cp1?r.b[1]:r.b[2];s.geometry=new g({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(tt.controlPointKind),[o,r]=Et(s),n=t[o],a=O(n[r-1]),h=O(n[r]),p=t[o][r];i===it.bezier.line1?s.geometry=new f({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new f({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Et(t);s===e&&o>=i&&t.setAttribute(tt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(tt.pathIndex)!==e)continue;const t=o.getAttribute(tt.pointIndexStart);t>=i&&(o.setAttribute(tt.pointIndexStart,t+1),o.setAttribute(tt.pointIndexEnd,o.getAttribute(tt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Et(t);return p(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){c(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&C(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,h),r())})}else{const i=null!=this._stagedVertex?new g(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry;if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);if(h){const t=n.getZ(a),e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){const o=n.spatialReference,[a,h]=Et(t);let p=ft(r);const c=n.pointToArray(e);this._updateGeometryFromGraphic(t,p,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)?(p=this._moveRelatedCoordinates(p,t,c),p=this._moveSelectedHandleCoordinates(p,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p),this._updateCurveGraphicLocations(p)):this._isMidpoint(t)&&this._updateCurveGraphicLocations(p),st(r,p)}this._updateGraphicGeometry(r.clone()),this._editGeometryOperations=lt.fromGeometry(r,2,{allowCurves:!0}),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_moveRelatedCoordinates(t,e,i){const{relatedGraphicIndices:s}=e.attributes,o=this._coordinateHelper.spatialReference;if(!s?.length)return t;for(const r of s){const s=this.vertexGraphics.at(r),[n,a]=Et(s);St(t,n,a,i,o),s.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Et(n),h=n.getAttribute(tt.relatedGraphicIndices),p=F(n.geometry,i,s,this.view),c=b(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,c,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Et(e);St(t,s,o,c,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?xt(e,i,s,[o[0],o[1]],t.getAttribute(tt.controlPointKind)):(St(e,i,s,o,r),n&&(0===s?St(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(yt),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=i.clone(),o=[],{[tt.pathIndex]:r,[tt.pointIndexStart]:n,[tt.pointIndexEnd]:a}=e.attributes,h=b(e.geometry),p=0===a?n+1:a;e.attributes={[tt.tool]:ot,[tt.pathIndex]:r,[tt.pointIndex]:p,[tt.relatedGraphicIndices]:[]};const c=ft(s),l=c[r][a];if(H(l)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=O(c[r][p]);c[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(tt.controlPointKind,it.circle.interior),e.setAttribute(tt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),st(s,c)}else c[r].splice(p,0,h),o.push({coordinates:c[r][p],componentIndex:r,vertexIndex:p})}else{const t=O(c[r][n]),e=rt(t,l,.5,this._coordinateHelper);c[r].splice(a,1,...e),o.push({coordinates:O(c[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),o}_addToSelection(t){const e=Ot(t);for(const i of e)i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&ut(t,this.tooltip)||ct.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&this._removeVertices(this.selectedManipulators)}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=e.clone();let r=ft(o);const n=[],a=Ot(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(t===a&&e===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!H(t)&&(r[i][o]=O(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=O(t[0]),[s,o]=O(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);st(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),yt)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,$(i,o,this._tooltipsContext,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,B(i,o,n,this._tooltipsContext,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function gt(t){const e=ft(t.clone());if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!H(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function ft(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Gt(t,e,i,s){const o=t[e][i];if(V(o))o.c[1]=s;else if(I(o)){const o=O(t[e][i]);t[e][i]={c:[o,s]}}}function xt(t,e,i,s,o){switch(o){case it.circle.interior:Gt(t,e,i,s);break;case it.bezier.cp1:t[e][i].b[1]=s;break;case it.bezier.cp2:t[e][i].b[2]=s}}function Mt(t,e){return t<1e-8*e}function bt(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[c,l]=n,d=c-h,m=l-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],x=_*G-g*f,M=(d**2+m**2)/2;if(Mt(Math.abs(x),M))return[(h+c)/2,(p+l)/2];const[b,C]=[G/x*M,-f/x*M],S=b**2+C**2,[E,w]=[d/2-b,m/2-C];if(Mt(E**2+w**2,S)){const[t,e]=v?[-C,b]:[C,-b];return[t+b+h,e+C+p]}const O=Math.sqrt((b**2+C**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*O+b+h,w*O+C+p]}function Ct(t,e,i){const s=G(new f({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=x(s,i),r=o[0][1];return P(r)?r:w(t,r)}function St(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(nt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(at(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,c]=[n-o,a-r],l=T(c,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,l,h,i.a[6]]})}const a=O(r);if(H(r))r.splice(0,r.length,...s);else if(k(r))r.b[0].splice(0,r.b[0].length,...s);else if(V(r)||I(r)){const o=O(t[e][i-1]),n=V(r)?E(o,r):R(o,r);t[e].splice(i,1,{c:[[...s],bt(o,n,s,!0)]})}else if(P(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(t[e][i-1]);r.a=Ct(n,r,o).a}if(n&&!H(n)&&!k(r))if(V(n)||I(n)){const o=O(n),r=V(n)?E(a,n):R(a,n);t[e].splice(i+1,1,{c:[o,bt(o,r,s,!1)]})}else if(P(n)){const t=O(r);n.a=Ct(t,n,o).a}}function Et({attributes:t}){return[t?.[tt.pathIndex]||0,t?.[tt.pointIndex]||0]}function wt({attributes:t}){return`${t?.[tt.pathIndex]}-${t?.[tt.pointIndex]}`}function Ot(t){return t instanceof e?[t]:[...t]}function Vt(t){const e=t.sourceLayer??t.layer;return N(e)?{graphic:t,layer:e}:null}function It(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[tt.pathIndex],vertexIndex:t[tt.pointIndex]}))}t([y()],_t.prototype,"_activeOperationInfo",void 0),t([y()],_t.prototype,"_connectedReshapeManager",void 0),t([y()],_t.prototype,"_coordinateHelper",null),t([y()],_t.prototype,"_editGeometryOperations",void 0),t([y()],_t.prototype,"tooltip",void 0),t([y()],_t.prototype,"tooltipInfos",void 0),t([y()],_t.prototype,"activeTooltipInfo",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticAreaMeasurementUtils",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticLengthMeasurementUtils",void 0),t([y()],_t.prototype,"_selectedManipulator",null),t([y()],_t.prototype,"_tooltipsContext",null),t([y()],_t.prototype,"callbacks",void 0),t([y()],_t.prototype,"connectedReshapeProviders",void 0),t([y()],_t.prototype,"enableMidpoints",void 0),t([y()],_t.prototype,"enableCurveOnMidpoint",void 0),t([y()],_t.prototype,"enableMovement",void 0),t([y()],_t.prototype,"enableVertices",void 0),t([y()],_t.prototype,"graphic",void 0),t([y()],_t.prototype,"highlightName",void 0),t([y()],_t.prototype,"highlightsEnabled",void 0),t([y()],_t.prototype,"layer",void 0),t([y()],_t.prototype,"snappingManager",void 0),t([y({readOnly:!0})],_t.prototype,"state",null),t([y()],_t.prototype,"symbols",void 0),t([y({type:dt})],_t.prototype,"sketchOptions",void 0),t([y({readOnly:!0})],_t.prototype,"type",void 0),t([y({readOnly:!0})],_t.prototype,"vertexGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"curveControlPointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"constructionLineGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"midpointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"selectedManipulators",void 0),t([y()],_t.prototype,"view",void 0),_t=t([_("esri.views.draw.support.Reshape")],_t);const kt=_t;export{kt as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,assertIsSome as p,abortMaybe as c}from"../../../core/maybe.js";import{pausable as l,when as d,watch as m,initial as v,sync as u}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import f from"../../../geometry/Polyline.js";import{fromGeometry as G,toGeometry as x}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as M,geometryToCoordinates as b}from"../../../geometry/support/coordsUtils.js";import{isPoint as C}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as S}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as E,toEllipticArc7 as w}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as O,isCircularArc as V,isEllipticArc4 as I,isBezierCurve as P,isCoordinate as k,isEllipticArc7 as H}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as R}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as T}from"../../../geometry/support/curves/mathUtils.js";import A from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as j}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as L}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as U,cloneMove as F}from"./drawUtils.js";import D from"./GraphicMover.js";import z from"./HighlightHelper.js";import{addUniqueLayer as K,isConnectedReshapeSupportedLayer as N}from"./layerUtils.js";import{createTooltipInfos as q,connectTooltip as Z,updateTranslateTooltipInfo as $,updateTranslateVertexTooltipInfo as B}from"./reshapeTooltipUtils.js";import{defaultSymbols as J,createMidpointGraphics as Q,createVertexGraphics as W,createCurveControlPointGraphics as X,createCurveConstructionLineGraphics as Y,attributeKeys as tt,getMidpoint as et,controlPointKinds as it,saveUpdatedCurveOrCoordinate as st,toolIdAttribute as ot,splitCurve as rt,isSingleSegmentCircle as nt,isSingleSegmentEllipse as at}from"./reshapeUtils.js";import{ViewEventPriorities as ht}from"../../input/InputManager.js";import{createCoordinateHelper as pt}from"../../interactive/coordinateHelper.js";import{sketchKeys as ct}from"../../interactive/keybindings.js";import{EditGeometryOperations as lt}from"../../interactive/editGeometry/EditGeometryOperations.js";import dt from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as mt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as vt,enterInputModeIfAvailable as ut}from"../../interactive/tooltip/tooltipCommonUtils.js";const yt=Symbol();let _t=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this.activeTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=J,this.sketchOptions=new dt,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new z({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=l(()=>this.graphic?.geometry,t=>{if(!t)return;const e=new Set(this.selectedManipulators.map(wt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(wt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).items;i&&h.push(o),s?.set("graphics",h)},u),this.tooltip=vt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=q(this.sketchOptions),this.addHandles([d(()=>t?.ready,()=>{const{layer:t,view:e}=this;K(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ht.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),m(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),Z(this.tooltip,()=>this._tooltipsContext),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),v),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??pt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedManipulator,automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t);this._editGeometryOperations=h(this._editGeometryOperations)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&M(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;null!=t&&"mesh"!==t.type&&"extent"!==t.type?this._editGeometryOperations??=lt.fromGeometry(t,2,{allowCurves:!0}):this._logGeometryTypeError()}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new A({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;p(i),this._snappingContext=new mt({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new j(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover?.destroy(),this._mover=null,this.removeHandles(yt)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=h(this._editGeometryOperations),this._snappingTask=c(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=gt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=Q(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){this._removeVertexGraphics();const e=W(t,this.symbols,this._coordinateHelper);this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}_setupCurveGraphics(t){this._removeCurveGraphics();const e=X(t,this.symbols,this._coordinateHelper),i=Y(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[tt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).items;t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new D({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new L({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?Vt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,It(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const e=gt(n);this._updateVertexGraphicLocations(e);const{dxMap:o,dyMap:r}=U(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t,{operationType:r}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)||o.getAttribute(tt.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(O(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.midpointGraphics){const{pathIndex:s,pointIndexStart:o,pointIndexEnd:r}=i.attributes,n=t[s];i.geometry=et(n[o],n[r],e)}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Et(s);null!=t&&null!=e&&s.getAttribute(tt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Et(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(V(r)||I(r)){const i=O(t[e][o-1]),n=V(r)?E(i,r):R(i,r),[a,h]=S(n,.25);s.geometry=new g({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(P(r)){const t=s.getAttribute(tt.controlPointKind),[e,i]=t===it.bezier.cp1?r.b[1]:r.b[2];s.geometry=new g({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(tt.controlPointKind),[o,r]=Et(s),n=t[o],a=O(n[r-1]),h=O(n[r]),p=t[o][r];i===it.bezier.line1?s.geometry=new f({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new f({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Et(t);s===e&&o>=i&&t.setAttribute(tt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(tt.pathIndex)!==e)continue;const t=o.getAttribute(tt.pointIndexStart);t>=i&&(o.setAttribute(tt.pointIndexStart,t+1),o.setAttribute(tt.pointIndexEnd,o.getAttribute(tt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Et(t);return p(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){c(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&C(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,h),r())})}else{const i=null!=this._stagedVertex?new g(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry;if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);if(h){const t=n.getZ(a),e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){const o=n.spatialReference,[a,h]=Et(t);let p=ft(r);const c=n.pointToArray(e);this._updateGeometryFromGraphic(t,p,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)?(p=this._moveRelatedCoordinates(p,t,c),p=this._moveSelectedHandleCoordinates(p,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p),this._updateCurveGraphicLocations(p)):this._isMidpoint(t)&&this._updateCurveGraphicLocations(p),st(r,p)}this._updateGraphicGeometry(r.clone()),this._editGeometryOperations=lt.fromGeometry(r,2,{allowCurves:!0}),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_moveRelatedCoordinates(t,e,i){const{relatedGraphicIndices:s}=e.attributes,o=this._coordinateHelper.spatialReference;if(!s?.length)return t;for(const r of s){const s=this.vertexGraphics.at(r),[n,a]=Et(s);St(t,n,a,i,o),s.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Et(n),h=n.getAttribute(tt.relatedGraphicIndices),p=F(n.geometry,i,s,this.view),c=b(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,c,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Et(e);St(t,s,o,c,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?xt(e,i,s,[o[0],o[1]],t.getAttribute(tt.controlPointKind)):(St(e,i,s,o,r),n&&(0===s?St(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(yt),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=i.clone(),o=[],{[tt.pathIndex]:r,[tt.pointIndexStart]:n,[tt.pointIndexEnd]:a}=e.attributes,h=b(e.geometry),p=0===a?n+1:a;e.attributes={[tt.tool]:ot,[tt.pathIndex]:r,[tt.pointIndex]:p,[tt.relatedGraphicIndices]:[]};const c=ft(s),l=c[r][a];if(k(l)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=O(c[r][p]);c[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(tt.controlPointKind,it.circle.interior),e.setAttribute(tt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),st(s,c)}else c[r].splice(p,0,h),o.push({coordinates:c[r][p],componentIndex:r,vertexIndex:p})}else{const t=O(c[r][n]),e=rt(t,l,.5,this._coordinateHelper);c[r].splice(a,1,...e),o.push({coordinates:O(c[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),o}_addToSelection(t){const e=Ot(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&ut(t,this.tooltip)||ct.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&this._removeVertices(this.selectedManipulators)}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=e.clone();let r=ft(o);const n=[],a=Ot(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(t===a&&e===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!k(t)&&(r[i][o]=O(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=O(t[0]),[s,o]=O(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);st(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),yt)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,$(i,o,this._tooltipsContext,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,B(i,o,n,this._tooltipsContext,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function gt(t){const e=ft(t.clone());if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!k(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function ft(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Gt(t,e,i,s){const o=t[e][i];if(V(o))o.c[1]=s;else if(I(o)){const o=O(t[e][i]);t[e][i]={c:[o,s]}}}function xt(t,e,i,s,o){switch(o){case it.circle.interior:Gt(t,e,i,s);break;case it.bezier.cp1:t[e][i].b[1]=s;break;case it.bezier.cp2:t[e][i].b[2]=s}}function Mt(t,e){return t<1e-8*e}function bt(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[c,l]=n,d=c-h,m=l-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],x=_*G-g*f,M=(d**2+m**2)/2;if(Mt(Math.abs(x),M))return[(h+c)/2,(p+l)/2];const[b,C]=[G/x*M,-f/x*M],S=b**2+C**2,[E,w]=[d/2-b,m/2-C];if(Mt(E**2+w**2,S)){const[t,e]=v?[-C,b]:[C,-b];return[t+b+h,e+C+p]}const O=Math.sqrt((b**2+C**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*O+b+h,w*O+C+p]}function Ct(t,e,i){const s=G(new f({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=x(s,i),r=o[0][1];return H(r)?r:w(t,r)}function St(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(nt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(at(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,c]=[n-o,a-r],l=T(c,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,l,h,i.a[6]]})}const a=O(r);if(k(r))r.splice(0,r.length,...s);else if(P(r))r.b[0].splice(0,r.b[0].length,...s);else if(V(r)||I(r)){const o=O(t[e][i-1]),n=V(r)?E(o,r):R(o,r);t[e].splice(i,1,{c:[[...s],bt(o,n,s,!0)]})}else if(H(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(t[e][i-1]);r.a=Ct(n,r,o).a}if(n&&!k(n)&&!P(r))if(V(n)||I(n)){const o=O(n),r=V(n)?E(a,n):R(a,n);t[e].splice(i+1,1,{c:[o,bt(o,r,s,!1)]})}else if(H(n)){const t=O(r);n.a=Ct(t,n,o).a}}function Et({attributes:t}){return[t?.[tt.pathIndex]||0,t?.[tt.pointIndex]||0]}function wt({attributes:t}){return`${t?.[tt.pathIndex]}-${t?.[tt.pointIndex]}`}function Ot(t){return t instanceof e?[t]:[...t]}function Vt(t){const e=t.sourceLayer??t.layer;return N(e)?{graphic:t,layer:e}:null}function It(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[tt.pathIndex],vertexIndex:t[tt.pointIndex]}))}t([y()],_t.prototype,"_activeOperationInfo",void 0),t([y()],_t.prototype,"_connectedReshapeManager",void 0),t([y()],_t.prototype,"_coordinateHelper",null),t([y()],_t.prototype,"_editGeometryOperations",void 0),t([y()],_t.prototype,"tooltip",void 0),t([y()],_t.prototype,"tooltipInfos",void 0),t([y()],_t.prototype,"activeTooltipInfo",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticAreaMeasurementUtils",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticLengthMeasurementUtils",void 0),t([y()],_t.prototype,"_selectedManipulator",null),t([y()],_t.prototype,"_tooltipsContext",null),t([y()],_t.prototype,"callbacks",void 0),t([y()],_t.prototype,"connectedReshapeProviders",void 0),t([y()],_t.prototype,"enableMidpoints",void 0),t([y()],_t.prototype,"enableCurveOnMidpoint",void 0),t([y()],_t.prototype,"enableMovement",void 0),t([y()],_t.prototype,"enableVertices",void 0),t([y()],_t.prototype,"graphic",void 0),t([y()],_t.prototype,"highlightName",void 0),t([y()],_t.prototype,"highlightsEnabled",void 0),t([y()],_t.prototype,"layer",void 0),t([y()],_t.prototype,"snappingManager",void 0),t([y({readOnly:!0})],_t.prototype,"state",null),t([y()],_t.prototype,"symbols",void 0),t([y({type:dt})],_t.prototype,"sketchOptions",void 0),t([y({readOnly:!0})],_t.prototype,"type",void 0),t([y({readOnly:!0})],_t.prototype,"vertexGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"curveControlPointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"constructionLineGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"midpointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"selectedManipulators",void 0),t([y()],_t.prototype,"view",void 0),_t=t([_("esri.views.draw.support.Reshape")],_t);const Pt=_t;export{Pt as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import{equals as t}from"../../../core/arrayUtils.js";import o from"../../../geometry/Point.js";import r from"../../../geometry/Polyline.js";import{getMidpoint as i}from"../../../geometry/support/coordsUtils.js";import{isMultipoint as n,isPolygon as s,isPolyline as c}from"../../../geometry/support/typeUtils.js";import{interpolateBezierCurve as l,splitBezierCurve as a}from"../../../geometry/support/curves/bezierCurveUtils.js";import{interpolateCircle as p}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as u,splitCircularArc as m}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as d,isCoordinate as f,isBezierCurve as h,isEllipticArc4 as y,isCircularArc as v,isEllipticArc as g,isEllipticArc7 as x}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as b,splitEllipticArc4 as w}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{deriveEllipse as z,interpolateEllipse as I,splitEllipticArc7 as j}from"../../../geometry/support/curves/ellipticArc7Utils.js";import P from"../../../symbols/SimpleLineSymbol.js";import S from"../../../symbols/SimpleMarkerSymbol.js";import{settings as C}from"./settings.js";const R={pathIndex:"pathIndex",pointIndex:"pointIndex",pointIndexStart:"pointIndexStart",pointIndexEnd:"pointIndexEnd",controlPointKind:"kind",relatedGraphicIndices:"relatedGraphicIndices",curveFromStraightEdgeFlag:"curveFromStraightEdgeFlag",tool:"esriSketchTool"},U={bezier:{cp1:"bezier-cp-1",cp2:"bezier-cp-2",line1:"bezier-line-1",line2:"bezier-line-2"},circle:{interior:"circle-interior"}},k="box",E=C.reshapeGraphics,T={vertices:{default:new S({style:"circle",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new S({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}}),selected:new S({style:"circle",size:E.selected.size,color:E.selected.color,outline:{color:E.selected.outlineColor,width:1}})},controlPoints:{default:new S({style:"circle",size:E.vertex.size,color:E.vertex.outlineColor,outline:{color:E.vertex.color,width:1}}),hover:new S({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverOutlineColor,outline:{color:E.vertex.hoverColor,width:1}}),selected:new S({style:"circle",size:E.selected.size,color:E.selected.outlineColor,outline:{color:E.selected.color,width:1}})},midpoints:{default:new S({style:"circle",size:E.midpoint.size,color:E.midpoint.color,outline:{color:E.midpoint.outlineColor,width:1}}),hover:new S({style:"circle",size:E.midpoint.size,color:E.midpoint.color,outline:{color:E.midpoint.outlineColor,width:1}})},constructionLines:new P({style:"solid",width:1,color:E.vertex.color})};function K(t,o,r){const i=[];return t?.forEach((t,n)=>{t.forEach((t,s)=>{i.push(new e({geometry:r.arrayToPoint(d(t)),symbol:o?.vertices?.default,attributes:{[R.tool]:k,[R.pathIndex]:n,[R.pointIndex]:s}}))})}),i}function F(t,o,r){const i=[];for(let n=0;n<t.length;n++){const s=t[n];if(!Z(t,n))for(let t=1;t<s.length;t++){const c=s[t];if(f(c))continue;const l=d(s[t-1]),a={[R.tool]:k,[R.pathIndex]:n,[R.pointIndex]:t};if(h(c)){const t=c.b.slice(1);i.push(...t.map((t,i)=>new e({geometry:r.arrayToPoint(t),symbol:o?.controlPoints?.default,attributes:{...a,[R.controlPointKind]:0===i?U.bezier.cp1:U.bezier.cp2}})))}const m=v(c),g=y(c);if(m||g){const t=m?u(l,c):b(l,c),n=p(t,.25);i.push(new e({geometry:r.arrayToPoint(n),symbol:o?.controlPoints?.default,attributes:{...a,[R.controlPointKind]:U.circle.interior}}))}}}return i}function G(t,o,i){const n=[],{spatialReference:s}=i;for(let c=0;c<t.length;c++){const i=t[c];for(let t=1;t<i.length;t++){const l=i[t];if(!h(l))continue;const[a,p,u]=l.b,m=d(i[t-1]),f={[R.tool]:k,[R.pathIndex]:c,[R.pointIndex]:t};n.push(new e({geometry:new r({paths:[[[m[0],m[1]],p]],spatialReference:s}),symbol:o?.constructionLines,attributes:{...f,[R.controlPointKind]:U.bezier.line1}}),new e({geometry:new r({paths:[[[a[0],a[1]],u]],spatialReference:s}),symbol:o?.constructionLines,attributes:{...f,[R.controlPointKind]:U.bezier.line2}}))}}return n}function L(t,o,r,i){const n=[];for(let s=0;s<t.length;s++){const c=t[s],l=O(t,s);for(let t=0;t<c.length;t++){const a=(t+1)%c.length;if((!i||l)&&0===a)continue;const p=M(c[t],c[a],r);n.push(new e({geometry:p,symbol:o.midpoints.default,attributes:{[R.tool]:k,[R.pathIndex]:s,[R.pointIndexStart]:t,[R.pointIndexEnd]:a}}))}}return n}function M(e,t,r){const n=d(e),s=d(t),{spatialReference:c}=r,a=r.arrayToVector(n),m=r.arrayToVector(s),g=r.toXYZ(a),x=r.toXYZ(m),[w,j,P]=i(g,x),S=r.hasM()?0:void 0;if(f(t))return new o({x:w,y:j,z:P,m:S,spatialReference:c});if(h(t)){const[e,r]=l(n,t,.5);return new o({x:e,y:r,z:P,m:S,spatialReference:c})}if(v(t)){const e=u(n,t),[r,i]=p(e,.5);return new o({x:r,y:i,z:P,m:S,spatialReference:c})}if(y(t)){const e=b(n,t),[r,i]=p(e,.5);return new o({x:r,y:i,z:P,m:S,spatialReference:c})}const C=z(n,t),[R,U]=I(C,.5);return new o({x:R,y:U,z:P,m:S,spatialReference:c})}function Z(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&y(r[1])}function A(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&x(r[1])}function O(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&g(r[1])}function V(e,t){if(n(e))return void(e.points=t.flat());const o=t.some(e=>e.some(e=>!f(e)));s(e)?o?(e.curveRings=t,e.rings=[]):(e.rings=t,e.curveRings=void 0):c(e)&&(o?(e.curvePaths=t,e.paths=[]):(e.curvePaths=void 0,e.paths=t))}function X(e,t,o,r){const i=d(t);let n=[];switch(!0){case h(t):n=a(e,t,o);break;case v(t):{const r=u(e,t);n=m(r,t,o);break}case y(t):{const r=b(e,t);n=w(r,t,o);break}default:{const r=z(e,t);n=j(r,t,o);break}}if(n.length<2)return n;if(r.hasZ()){const t=e.at(2)??0,r=i.at(2)??0,s=t+(r-t)*o;d(n[0])[2]=s,d(n[1])[2]=r}if(r.hasM()){const e=r.hasZ()?3:2;d(n[0])[e]=0,d(n[1])[e]=i.at(-1)??0}return n}export{R as attributeKeys,U as controlPointKinds,G as createCurveConstructionLineGraphics,F as createCurveControlPointGraphics,L as createMidpointGraphics,K as createVertexGraphics,T as defaultSymbols,M as getMidpoint,Z as isSingleSegmentCircle,A as isSingleSegmentEllipse,O as isSingleSegmentPolygon,V as saveUpdatedCurveOrCoordinate,X as splitCurve,k as toolIdAttribute};
5
+ import e from"../../../Graphic.js";import{equals as t}from"../../../core/arrayUtils.js";import o from"../../../geometry/Point.js";import r from"../../../geometry/Polyline.js";import{getMidpoint as n}from"../../../geometry/support/coordsUtils.js";import{isMultipoint as i,isPolygon as s,isPolyline as l}from"../../../geometry/support/typeUtils.js";import{interpolateBezierCurve as c,splitBezierCurve as a}from"../../../geometry/support/curves/bezierCurveUtils.js";import{interpolateCircle as p}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as u,splitCircularArc as m}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as d,isCoordinate as f,isBezierCurve as h,isEllipticArc4 as y,isCircularArc as v,isEllipticArc as g,isEllipticArc7 as x}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as b,splitEllipticArc4 as w}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{deriveEllipse as z,interpolateEllipse as I,splitEllipticArc7 as j}from"../../../geometry/support/curves/ellipticArc7Utils.js";import P from"../../../symbols/SimpleLineSymbol.js";import S from"../../../symbols/SimpleMarkerSymbol.js";import{settings as C}from"./settings.js";const R={pathIndex:"pathIndex",pointIndex:"pointIndex",pointIndexStart:"pointIndexStart",pointIndexEnd:"pointIndexEnd",controlPointKind:"kind",relatedGraphicIndices:"relatedGraphicIndices",curveFromStraightEdgeFlag:"curveFromStraightEdgeFlag",tool:"esriSketchTool"},U={bezier:{cp1:"bezier-cp-1",cp2:"bezier-cp-2",line1:"bezier-line-1",line2:"bezier-line-2"},circle:{interior:"circle-interior"}},k="box",E=C.reshapeGraphics,T={vertices:{default:new S({style:"circle",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new S({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}}),selected:new S({style:"circle",size:E.selected.size,color:E.selected.color,outline:{color:E.selected.outlineColor,width:1}})},controlPoints:{default:new S({style:"diamond",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new S({style:"diamond",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}}),selected:new S({style:"diamond",size:E.selected.size,color:E.selected.color,outline:{color:E.selected.outlineColor,width:1}})},midpoints:{default:new S({style:"circle",size:E.midpoint.size,color:E.midpoint.color,outline:{color:E.midpoint.outlineColor,width:1}}),hover:new S({style:"circle",size:E.midpoint.size,color:E.midpoint.color,outline:{color:E.midpoint.outlineColor,width:1}})},constructionLines:new P({style:"solid",width:1,color:E.vertex.color})};function K(t,o,r){const n=[];return t?.forEach((t,i)=>{t.forEach((t,s)=>{n.push(new e({geometry:r.arrayToPoint(d(t)),symbol:o?.vertices?.default,attributes:{[R.tool]:k,[R.pathIndex]:i,[R.pointIndex]:s}}))})}),n}function F(t,o,r){const n=[];for(let i=0;i<t.length;i++){const s=t[i];if(!Z(t,i))for(let t=1;t<s.length;t++){const l=s[t];if(f(l))continue;const c=d(s[t-1]),a={[R.tool]:k,[R.pathIndex]:i,[R.pointIndex]:t};if(h(l)){const t=l.b.slice(1);n.push(...t.map((t,n)=>new e({geometry:r.arrayToPoint(t),symbol:o?.controlPoints?.default,attributes:{...a,[R.controlPointKind]:0===n?U.bezier.cp1:U.bezier.cp2}})))}const m=v(l),g=y(l);if(m||g){const t=m?u(c,l):b(c,l),i=p(t,.25);n.push(new e({geometry:r.arrayToPoint(i),symbol:o?.controlPoints?.default,attributes:{...a,[R.controlPointKind]:U.circle.interior}}))}}}return n}function G(t,o,n){const i=[],{spatialReference:s}=n;for(let l=0;l<t.length;l++){const n=t[l];for(let t=1;t<n.length;t++){const c=n[t];if(!h(c))continue;const[a,p,u]=c.b,m=d(n[t-1]),f={[R.tool]:k,[R.pathIndex]:l,[R.pointIndex]:t};i.push(new e({geometry:new r({paths:[[[m[0],m[1]],p]],spatialReference:s}),symbol:o?.constructionLines,attributes:{...f,[R.controlPointKind]:U.bezier.line1}}),new e({geometry:new r({paths:[[[a[0],a[1]],u]],spatialReference:s}),symbol:o?.constructionLines,attributes:{...f,[R.controlPointKind]:U.bezier.line2}}))}}return i}function L(t,o,r,n){const i=[];for(let s=0;s<t.length;s++){const l=t[s],c=O(t,s);for(let t=0;t<l.length;t++){const a=(t+1)%l.length;if((!n||c)&&0===a)continue;const p=M(l[t],l[a],r);i.push(new e({geometry:p,symbol:o.midpoints.default,attributes:{[R.tool]:k,[R.pathIndex]:s,[R.pointIndexStart]:t,[R.pointIndexEnd]:a}}))}}return i}function M(e,t,r){const i=d(e),s=d(t),{spatialReference:l}=r,a=r.arrayToVector(i),m=r.arrayToVector(s),g=r.toXYZ(a),x=r.toXYZ(m),[w,j,P]=n(g,x),S=r.hasM()?0:void 0;if(f(t))return new o({x:w,y:j,z:P,m:S,spatialReference:l});if(h(t)){const[e,r]=c(i,t,.5);return new o({x:e,y:r,z:P,m:S,spatialReference:l})}if(v(t)){const e=u(i,t),[r,n]=p(e,.5);return new o({x:r,y:n,z:P,m:S,spatialReference:l})}if(y(t)){const e=b(i,t),[r,n]=p(e,.5);return new o({x:r,y:n,z:P,m:S,spatialReference:l})}const C=z(i,t),[R,U]=I(C,.5);return new o({x:R,y:U,z:P,m:S,spatialReference:l})}function Z(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&y(r[1])}function A(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&x(r[1])}function O(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&g(r[1])}function V(e,t){if(i(e))return void(e.points=t.flat());const o=t.some(e=>e.some(e=>!f(e)));s(e)?o?(e.curveRings=t,e.rings=[]):(e.rings=t,e.curveRings=void 0):l(e)&&(o?(e.curvePaths=t,e.paths=[]):(e.curvePaths=void 0,e.paths=t))}function X(e,t,o,r){const n=d(t);let i=[];switch(!0){case h(t):i=a(e,t,o);break;case v(t):{const r=u(e,t);i=m(r,t,o);break}case y(t):{const r=b(e,t);i=w(r,t,o);break}default:{const r=z(e,t);i=j(r,t,o);break}}if(i.length<2)return i;if(r.hasZ()){const t=e.at(2)??0,r=n.at(2)??0,s=t+(r-t)*o;d(i[0])[2]=s,d(i[1])[2]=r}if(r.hasM()){const e=r.hasZ()?3:2;d(i[0])[e]=0,d(i[1])[e]=n.at(-1)??0}return i}export{R as attributeKeys,U as controlPointKinds,G as createCurveConstructionLineGraphics,F as createCurveControlPointGraphics,L as createMidpointGraphics,K as createVertexGraphics,T as defaultSymbols,M as getMidpoint,Z as isSingleSegmentCircle,A as isSingleSegmentEllipse,O as isSingleSegmentPolygon,V as saveUpdatedCurveOrCoordinate,X as splitCurve,k as toolIdAttribute};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as o}from"../../geometry/projectionUtils.js";import{isMeshWithRelativeVertexSpace as a}from"../../geometry/support/meshVertexSpaceUtils.js";import{clonePoint as l,hydratedSpatialReference as c}from"../../layers/graphics/hydratedFeatures.js";import{getZForElevationMode as s}from"../../support/elevationInfoUtils.js";import{EditGeometryOperations as u}from"./editGeometry/EditGeometryOperations.js";function i(t,n){let e=null,r=null;return o=>{if("cancel"===o.action)return void(null!=r&&(r.execute({action:"cancel"}),e=null,r=null));const a={action:o.action,screenStart:o.start,screenEnd:o.screenPoint};"start"===o.action&&null==e&&(e=new D,r=new D,n(t,e,r,o.pointerType,a)),null!=e&&e.execute(a),"end"===o.action&&null!=e&&(e=null,r=null)}}function p(t,n){return t.events.on("drag",i(t,n))}function m(t,n){const e=[t.x,t.y,t.z??0],r=n,o=[Math.cos(r),Math.sin(r)],a=Math.sqrt(o[0]*o[0]+o[1]*o[1]);if(0===a)return null;o[0]/=a,o[1]/=a;const l=t=>{const n=(t.x-e[0])*o[0]+(t.y-e[1])*o[1];t.x=e[0]+n*o[0],t.y=e[1]+n*o[1]};return t=>(l(t.mapStart),l(t.mapEnd),{...t,axis:o})}function f(t){let n=null;const e=j();return r=>{if("start"===r.action&&(n=y(t,r.mapStart.spatialReference)),null==n)return null;const o=e(r);if(!o)return null;const{translationX:a,translationY:l,translationZ:c}=o;return n.move(a,l,c,r.action),o}}function d(t,n){return null==t?null:t.spatialReference.equals(n)?t.clone():o(t,n)}function y(t,n){const e=t.operations;if(!e)return null;const r=e.data.geometry,l=c(n);if(r.spatialReference.equals(l))return x(t,e,()=>{});if("mesh"!==r.type){const n=d(r,l);if(null==n)return null;const a=r.spatialReference;return x(t,u.fromGeometry(n,e.viewingMode),()=>{const t=o(r,a);e.trySetGeometry(t)})}if(a(r)){const n=d(r.origin,l);if(!n)return null;const a=r.spatialReference,c=u.fromGeometry(n,e.viewingMode);return x(t,e,()=>{const t=o(c.data.geometry,a),n=t.x-r.origin.x,l=t.y-r.origin.y,s=(t.z??0)-(r.origin.z??0);e.move(n,l,s)})}return null}function x(t,n,e){let r=0,o=0,a=0;return{move:(l,c,s,u)=>{"start"===u&&(r=0,o=0,a=0);const i=l-r,p=c-o,m=s-a;n.move(i,p,m),r+=i,o+=p,a+=m,e(),"end"===u&&t.endInteraction?.()}}}function E(t,n=null,e){let r=null;const a=null==n||t.spatialReference?.equals(n)?t=>t:t=>null!=t?o(t,n):t,l={exclude:[],...e};return n=>{if("start"===n.action&&(r=a(t.toMap(n.screenStart,l))),null==r)return null;const e=a(t.toMap(n.screenEnd,l));return null!=e?{...n,mapStart:r,mapEnd:e}:null}}function S(n){const e=n.map(t=>f(t)).filter(t),r=j();return t=>{const n=r(t);return e.forEach(n=>n(t)),n}}function h(t,e){const r=new Map;for(const o of e)r.set(o,n(t[o]));return n=>(r.forEach((n,e)=>{t[e]=n}),n)}function g(t){const n=t.operations?.createResetState();return t=>(n?.remove(),t)}function v(t){const n=t.map(t=>g(t)).filter(t=>null!=t);return t=>(n.forEach(n=>n(t)),t)}function z(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z??0);const o=r.mapEnd.x-t,a=r.mapEnd.y-n,l=(r.mapEnd.z??0)-e;return t=r.mapEnd.x,n=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:o,mapDeltaY:a,mapDeltaZ:l,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function j(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z??0);const o=r.mapEnd.x-t,a=r.mapEnd.y-n,l=(r.mapEnd.z??0)-e;return{...r,translationX:o,translationY:a,translationZ:l}}}function M(){let t=0,n=0;return e=>{"start"===e.action&&(t=e.screenStart.x,n=e.screenStart.y);const r=e.screenEnd.x-t,o=e.screenEnd.y-n;return t=e.screenEnd.x,n=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:o}}}function R(t,n){let o=null,a=0,l=0;return c=>{if("start"===c.action&&(o=t.toScreen?.(n),null!=o&&(o.x<0||o.x>t.width||o.y<0||o.y>t.height?o=null:(a=c.screenStart.x-o.x,l=c.screenStart.y-o.y))),null==o)return null;const s=e(c.screenEnd.x-a,0,t.width),u=e(c.screenEnd.y-l,0,t.height),i=r(s,u);return c.screenStart=o,c.screenEnd=i,c}}const w=()=>{};class D{constructor(){this.execute=w}next(t,n=new D){return null!=t&&(this.execute=e=>{const r=t(e);null!=r&&n.execute(r)}),n}}function U(t,n,e=[]){if("2d"===t.type)return t=>t;let r=null;return o=>{"start"===o.action&&(r=t.toMap(o.screenStart,{exclude:e}),null!=r&&(r.z=s(r,t,n)));const a=t.toMap(o.screenEnd,{exclude:e});null!=a&&(a.z=s(a,t,n));const l=null!=r&&null!=a?{sceneStart:r,sceneEnd:a}:null;return{...o,scenePoints:l}}}function G(t,n,e){const r=n.elevationProvider.getElevation(t.x,t.y,t.z??0,t.spatialReference,"scene")??0,o=l(t);return o.z=r,o.hasZ=!0,o.z=s(o,n,e),o}function q(t,n){if("2d"===t.type)return t=>t;let e=null;return r=>{"start"===r.action&&(e=G(r.mapStart,t,n));const o=G(r.mapEnd,t,n),a=null!=e&&null!=o?{sceneStart:e,sceneEnd:o}:null;return{...r,scenePoints:a}}}export{D as EventPipeline,z as addMapDelta,j as addMapTranslation,M as addScreenDelta,m as constrainToMapAxis,i as createDragEventPipelineCallback,p as createManipulatorDragEventPipeline,R as dragAtLocation,f as dragManipulatedObject,S as dragManipulatedObjectMany,g as resetManipulatedObject,v as resetManipulatedObjectMany,h as resetProperties,U as sceneSnappingAtLocation,q as sceneSnappingAtProjectedLocation,E as screenToMap};
5
+ import{isSome as t}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as a}from"../../geometry/projectionUtils.js";import{isMeshWithRelativeVertexSpace as o}from"../../geometry/support/meshVertexSpaceUtils.js";import{clonePoint as l,hydratedSpatialReference as c}from"../../layers/graphics/hydratedFeatures.js";import{getZForElevationMode as s}from"../../support/elevationInfoUtils.js";import{EditGeometryOperations as u}from"./editGeometry/EditGeometryOperations.js";function i(t,n){let e=null,r=null;return a=>{if("cancel"===a.action)return void(null!=r&&(r.execute({action:"cancel"}),e=null,r=null));const o={action:a.action,screenStart:a.start,screenEnd:a.screenPoint};"start"===a.action&&null==e&&(e=new D,r=new D,n(t,e,r,a.pointerType,o)),null!=e&&e.execute(o),"end"===a.action&&null!=e&&(e=null,r=null)}}function p(t,n){return t.events.on("drag",i(t,n))}function m(t,n){const e=[t.x,t.y,t.z??0],r=n,a=[Math.cos(r),Math.sin(r)],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]);if(0===o)return null;a[0]/=o,a[1]/=o;const l=t=>{const n=(t.x-e[0])*a[0]+(t.y-e[1])*a[1];t.x=e[0]+n*a[0],t.y=e[1]+n*a[1]};return t=>(l(t.mapStart),l(t.mapEnd),{...t,axis:a})}function f(t){let n=null;const e=j();return r=>{if("start"===r.action&&(n=y(t,r.mapStart.spatialReference)),null==n)return null;const a=e(r);if(!a)return null;const{translationX:o,translationY:l,translationZ:c}=a;return n.move(o,l,c,r.action),a}}function d(t,n){return null==t?null:t.spatialReference.equals(n)?t.clone():a(t,n)}function y(t,n){const e=t.operations;if(!e)return null;const r=e.data.geometry,l=c(n);if(r.spatialReference.equals(l))return x(t,e,()=>{});if("mesh"!==r.type){const n=d(r,l);if(null==n)return null;const o=r.spatialReference,c=u.fromGeometry(n,e.viewingMode);return x(t,c,()=>{const t=c.data.geometry,n=a(t,o);e.trySetGeometry(n)})}if(o(r)){const n=d(r.origin,l);if(!n)return null;const o=r.spatialReference,c=u.fromGeometry(n,e.viewingMode);return x(t,e,()=>{const t=a(c.data.geometry,o),n=t.x-r.origin.x,l=t.y-r.origin.y,s=(t.z??0)-(r.origin.z??0);e.move(n,l,s)})}return null}function x(t,n,e){let r=0,a=0,o=0;return{move:(l,c,s,u)=>{"start"===u&&(r=0,a=0,o=0);const i=l-r,p=c-a,m=s-o;n.move(i,p,m),r+=i,a+=p,o+=m,e(),"end"===u&&t.endInteraction?.()}}}function E(t,n=null,e){let r=null;const o=null==n||t.spatialReference?.equals(n)?t=>t:t=>null!=t?a(t,n):t,l={exclude:[],...e};return n=>{if("start"===n.action&&(r=o(t.toMap(n.screenStart,l))),null==r)return null;const e=o(t.toMap(n.screenEnd,l));return null!=e?{...n,mapStart:r,mapEnd:e}:null}}function S(n){const e=n.map(t=>f(t)).filter(t),r=j();return t=>{const n=r(t);return e.forEach(n=>n(t)),n}}function h(t,e){const r=new Map;for(const a of e)r.set(a,n(t[a]));return n=>(r.forEach((n,e)=>{t[e]=n}),n)}function g(t){const n=t.operations?.createResetState();return t=>(n?.remove(),t)}function v(t){const n=t.map(t=>g(t)).filter(t=>null!=t);return t=>(n.forEach(n=>n(t)),t)}function z(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z??0);const a=r.mapEnd.x-t,o=r.mapEnd.y-n,l=(r.mapEnd.z??0)-e;return t=r.mapEnd.x,n=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:a,mapDeltaY:o,mapDeltaZ:l,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function j(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z??0);const a=r.mapEnd.x-t,o=r.mapEnd.y-n,l=(r.mapEnd.z??0)-e;return{...r,translationX:a,translationY:o,translationZ:l}}}function M(){let t=0,n=0;return e=>{"start"===e.action&&(t=e.screenStart.x,n=e.screenStart.y);const r=e.screenEnd.x-t,a=e.screenEnd.y-n;return t=e.screenEnd.x,n=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:a}}}function R(t,n){let a=null,o=0,l=0;return c=>{if("start"===c.action&&(a=t.toScreen?.(n),null!=a&&(a.x<0||a.x>t.width||a.y<0||a.y>t.height?a=null:(o=c.screenStart.x-a.x,l=c.screenStart.y-a.y))),null==a)return null;const s=e(c.screenEnd.x-o,0,t.width),u=e(c.screenEnd.y-l,0,t.height),i=r(s,u);return c.screenStart=a,c.screenEnd=i,c}}const w=()=>{};class D{constructor(){this.execute=w}next(t,n=new D){return null!=t&&(this.execute=e=>{const r=t(e);null!=r&&n.execute(r)}),n}}function U(t,n,e=[]){if("2d"===t.type)return t=>t;let r=null;return a=>{"start"===a.action&&(r=t.toMap(a.screenStart,{exclude:e}),null!=r&&(r.z=s(r,t,n)));const o=t.toMap(a.screenEnd,{exclude:e});null!=o&&(o.z=s(o,t,n));const l=null!=r&&null!=o?{sceneStart:r,sceneEnd:o}:null;return{...a,scenePoints:l}}}function G(t,n,e){const r=n.elevationProvider.getElevation(t.x,t.y,t.z??0,t.spatialReference,"scene")??0,a=l(t);return a.z=r,a.hasZ=!0,a.z=s(a,n,e),a}function q(t,n){if("2d"===t.type)return t=>t;let e=null;return r=>{"start"===r.action&&(e=G(r.mapStart,t,n));const a=G(r.mapEnd,t,n),o=null!=e&&null!=a?{sceneStart:e,sceneEnd:a}:null;return{...r,scenePoints:o}}}export{D as EventPipeline,z as addMapDelta,j as addMapTranslation,M as addScreenDelta,m as constrainToMapAxis,i as createDragEventPipelineCallback,p as createManipulatorDragEventPipeline,R as dragAtLocation,f as dragManipulatedObject,S as dragManipulatedObjectMany,g as resetManipulatedObject,v as resetManipulatedObjectMany,h as resetProperties,U as sceneSnappingAtLocation,q as sceneSnappingAtProjectedLocation,E as screenToMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import{intersection as s,isSubsetOf as i}from"../../../../../core/SetUtils.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as n,intersects as l,fromExtent as u,area as c}from"../../../../../geometry/support/aaBoundingRect.js";import{getBoundsOptimizedGeometry as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{BoundsStore as a}from"../../../../../layers/graphics/data/BoundsStore.js";import{TileKey as d}from"../../../../../layers/support/TileKey.js";import{executeQueryForCount as f}from"../../../../../rest/query/operations/query.js";import{FeatureServiceTileCache as _}from"./FeatureServiceTileCache.js";let m=class extends t{setPriorityOrderByKey(e){this._tiles.setPriorityOrderByKey(e)}get _memoryLimitExceeded(){return this.featureStore.usedMemory>=this.maximumByteSize}constructor(e){super(e),this.tileInfo=null,this.extent=null,this.maximumByteSize=10485760,this._tileBounds=new a,this._tiles=new _,this._refCounts=new Map,this._tileFeatureCounts=new Map,this._tmpBoundingRect=n()}add(e,t){for(const s of t)this._referenceFeature(s.objectId);const i=this.featureStore.upsertMany(t),r=i.map(e=>new Set(Object.keys(e.attributes))).reduce((e,t)=>s(e,t),new Set(Object.keys(i[0]?.attributes??[]))),o=this._memoryLimitExceeded;this._addTileStorage(e,new Set(i.map(e=>e.objectId)),r),o&&this._applyCacheMemoryLimits()}_applyCacheMemoryLimits(){if(!this._memoryLimitExceeded)return;const{_tiles:e,featureStore:t,maximumByteSize:s}=this;e.someFromLowestToHighestPriority(e=>!this._memoryLimitExceeded||t.usedMemory-this._estimateRemoveTileMemoryReduction(e)<s||(this._removeTileStorage(e),!1))}_estimateRemoveTileMemoryReduction(e){let t=0;for(const s of e.objectIds){if(1===this._refCounts.get(s)){const e=this.featureStore.getFeature(s);e&&(t+=this.featureStore.estimateFeatureUsedMemory?.(e)??0)}}return t}getAttributesForTile(e){return e?this._tiles.get(e)?.attributeKeys:null}destroy(){this.clear(),this._tileFeatureCounts.clear()}clear(){this.featureStore.clear(),this._tileBounds.clear(),this._tiles.clear(),this._refCounts.clear()}refresh(){this.clear(),this._tileFeatureCounts.clear()}processEdits(e,t,s){return this._processEditsDelete(e.deletedFeatures.concat(e.updatedFeatures)),this._processEditsRefetch(e.addedFeatures.concat(e.updatedFeatures),t,s)}_addTileStorage(e,t,s){const i=e.id;this._tiles.set(i,new y(e,t,s)),this._tileBounds.set(i,e.extent),this._tileFeatureCounts.set(i,t.size)}_remove({id:e}){const t=this._tiles.get(e);t&&this._removeTileStorage(t)}_removeTileStorage(e){const t=[];for(const i of e.objectIds)1===this._unreferenceFeature(i)&&t.push(i);this.featureStore.removeManyById(t);const s=e.key.id;this._tiles.delete(s),this._tileBounds.delete(s)}_processEditsDelete(e){this.featureStore.removeManyById(e);for(const t of this._tiles.values()){for(const s of e)t.objectIds.delete(s);this._tileFeatureCounts.set(t.key.id,t.objectIds.size)}for(const t of e)this._refCounts.delete(t)}async _processEditsRefetch(e,t,s){if(!e.length)return;const i=(await t(e,s)).features,{hasZ:r,hasM:o}=this.featureStore;for(const n of i){const e=h(this._tmpBoundingRect,n.geometry,r,o);null!=e&&this._tileBounds.forEachInBounds(e,e=>{const t=this._tiles.get(e);this.featureStore.add(n);const s=n.objectId;t.objectIds.has(s)||(t.objectIds.add(s),this._referenceFeature(s),this._tileFeatureCounts.set(t.key.id,t.objectIds.size))})}}process(e,t=()=>!0,s){if(null==this.tileInfo||!e.extent||null!=this.extent&&!l(u(this.extent,this._tmpBoundingRect),e.extent))return new v(e);if(this._memoryLimitExceeded&&!this._tiles.hasLowerPriority(e.id??""))return new v(e);const r=this.getAttributesForTile(e.id);if(i(s,r))return new v(e);const o=this._createTileTree(e,this.tileInfo);return this._simplify(o,t,null,0,1),this._collectMissingTiles(e,o,this.tileInfo,s)}get debugInfo(){return Array.from(this._tiles.values()).map(({key:e})=>({key:e.toJSON(),featureCount:this._tileFeatureCounts.get(e.id)||0}))}getFeatureCount(e){return this._tileFeatureCounts.get(e.id)??0}async fetchCount(e,t,s,i){const r=this._tileFeatureCounts.get(e.id);if(null!=r)return r;const o=await f(t,s,i);return this._tileFeatureCounts.set(e.id,o.data.count),o.data.count}_createTileTree(e,t){const s=new g(e.level,e.row,e.col);return t.updateTileInfo(s,1),this._tileBounds.forEachInBounds(e.extent,i=>{const r=this._tiles.get(i)?.key;r&&p(e,r)&&this._populateChildren(s,r,t,this._tileFeatureCounts.get(r.id)||0)}),s}_populateChildren(e,t,s,i){const r=t.level-e.level-1;if(r<0)return void(e.isLeaf=!0);const o=t.row>>r,n=t.col>>r,l=e.row<<1,u=n-(e.col<<1)+(o-l<<1),c=e.children[u];if(null!=c)this._populateChildren(c,t,s,i);else{const r=new g(e.level+1,o,n);s.updateTileInfo(r,1),e.children[u]=r,this._populateChildren(r,t,s,i)}}_simplify(e,t,s,i,r){const o=r*r;if(e.isLeaf)return t(this.getFeatureCount(e),r)?0:(this._remove(e),null!=s&&(s.children[i]=null),o);const n=r/2,l=n*n;let u=0;for(let c=0;c<e.children.length;c++){const s=e.children[c];u+=null!=s?this._simplify(s,t,e,c,n):l}return 0===u?this._mergeChildren(e):1-u/o<S&&(this._purge(e),null!=s&&(s.children[i]=null),u=o),u}_mergeChildren(e){const t=new Set;let i;this._forEachLeaf(e,e=>{const r=this._tiles.get(e.id);if(r){i=i?s(i,r.attributeKeys):new Set(r.attributeKeys);for(const e of r.objectIds)t.has(e)||(t.add(e),this._referenceFeature(e));this._remove(e)}}),this._addTileStorage(e,t,i??new Set),e.isLeaf=!0,e.children[0]=e.children[1]=e.children[2]=e.children[3]=null,this._tileFeatureCounts.set(e.id,t.size)}_forEachLeaf(e,t){for(const s of e.children)null!=s&&(s.isLeaf?t(s):this._forEachLeaf(s,t))}_purge(e){if(null!=e)if(e.isLeaf)this._remove(e);else for(let t=0;t<e.children.length;t++){const s=e.children[t];this._purge(s),e.children[t]=null}}_collectMissingTiles(e,t,s,i){const r=new C(s,e,this.extent);return this._collectMissingTilesRecurse(t,r,1,i),r.info}_collectMissingTilesRecurse(e,t,s,r){const o=this.getAttributesForTile(e.id),n=o&&!i(r,o);if(n&&t.addMissing(e.level,e.row,e.col,s),e.isLeaf)return;if(!e.hasChildren)return void(n||t.addMissing(e.level,e.row,e.col,s));const l=s/2;for(let i=0;i<e.children.length;i++){const s=e.children[i];null==s?t.addMissing(e.level+1,(e.row<<1)+((2&i)>>1),(e.col<<1)+(1&i),l):this._collectMissingTilesRecurse(s,t,l,r)}}_referenceFeature(e){const t=(this._refCounts.get(e)||0)+1;return this._refCounts.set(e,t),1===t?0:2}_unreferenceFeature(e){const t=(this._refCounts.get(e)||0)-1;return 0===t?(this._refCounts.delete(e),1):(t>0&&this._refCounts.set(e,t),2)}get test(){}};function p(e,t){if(!e||!t)return!1;if(e.level===t.level)return e.row===t.row&&e.col===t.col;const s=e.level<t.level,i=s?e:t,r=s?t:e,o=1<<r.level-i.level;return Math.floor(r.row/o)===i.row&&Math.floor(r.col/o)===i.col}e([r({constructOnly:!0})],m.prototype,"featureStore",void 0),e([r()],m.prototype,"tileInfo",void 0),e([r()],m.prototype,"extent",void 0),e([r()],m.prototype,"maximumByteSize",void 0),m=e([o("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTileStore")],m);class y{constructor(e,t,s){this.key=e,this.objectIds=t,this.attributeKeys=s}}class g extends d{constructor(){super(...arguments),this.isLeaf=!1,this.children=[null,null,null,null]}get hasChildren(){return!this.isLeaf&&(null!=this.children[0]||null!=this.children[1]||null!=this.children[2]||null!=this.children[3])}}class v{constructor(e,t=[]){this.missingTiles=t,this.fullArea=0,this.coveredArea=0,this.fullArea=c(e.extent),this.coveredArea=this.fullArea}prepend(e){this.missingTiles=e.missingTiles.concat(this.missingTiles),this.coveredArea+=e.coveredArea,this.fullArea+=e.fullArea}}class C{constructor(e,t,s){this._tileInfo=e,this._extent=null,this.info=new v(t),null!=s&&(this._extent=u(s))}addMissing(e,t,s,i){const r=new d(e,t,s);this._tileInfo.updateTileInfo(r,1)&&(null==this._extent||l(this._extent,r.extent))&&(this.info.missingTiles.push({data:r,resolution:i}),this.info.coveredArea-=c(r.extent))}}const S=.18751;export{m as FeatureServiceTileStore,v as ProcessResult};
5
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import{intersection as s,isSubsetOf as i}from"../../../../../core/SetUtils.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as n,intersects as l,fromExtent as c,area as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getBoundsOptimizedGeometry as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{BoundsStore as a}from"../../../../../layers/graphics/data/BoundsStore.js";import{TileKey as d}from"../../../../../layers/support/TileKey.js";import{executeQueryForCount as f}from"../../../../../rest/query/operations/query.js";import{FeatureServiceTileCache as _}from"./FeatureServiceTileCache.js";let m=class extends t{setPriorityOrderByKey(e){this._tiles.setPriorityOrderByKey(e)}get _memoryLimitExceeded(){return this.featureStore.usedMemory>=this.maximumByteSize}constructor(e){super(e),this.tileInfo=null,this.extent=null,this.maximumByteSize=10485760,this._tileBounds=new a,this._tiles=new _,this._refCounts=new Map,this._tileFeatureCounts=new Map,this._tmpBoundingRect=n()}add(e,t){for(const s of t)this._referenceFeature(s.objectId);const i=this.featureStore.upsertMany(t),r=i.map(e=>new Set(Object.keys(e.attributes))).reduce((e,t)=>s(e,t),new Set(Object.keys(i[0]?.attributes??[]))),o=this._memoryLimitExceeded;this._addTileStorage(e,new Set(i.map(e=>e.objectId)),r),o&&this._applyCacheMemoryLimits()}_applyCacheMemoryLimits(){if(!this._memoryLimitExceeded)return;const{_tiles:e,featureStore:t,maximumByteSize:s}=this;e.someFromLowestToHighestPriority(e=>!this._memoryLimitExceeded||t.usedMemory-this._estimateRemoveTileMemoryReduction(e)<s||(this._removeTileStorage(e),!1))}_estimateRemoveTileMemoryReduction(e){let t=0;for(const s of e.objectIds){if(1===this._refCounts.get(s)){const e=this.featureStore.getFeature(s);e&&(t+=this.featureStore.estimateFeatureUsedMemory?.(e)??0)}}return t}getAttributesForTile(e){return e?this._tiles.get(e)?.attributeKeys:null}destroy(){this.clear(),this._tileFeatureCounts.clear()}clear(){this.featureStore.clear(),this._tileBounds.clear(),this._tiles.clear(),this._refCounts.clear()}refresh(){this.clear(),this._tileFeatureCounts.clear()}processEdits(e,t,s){return this._processEditsDelete(e.deletedFeatures.concat(e.updatedFeatures)),this._processEditsRefetch(e.addedFeatures.concat(e.updatedFeatures),t,s)}_addTileStorage(e,t,s){const i=e.id;this._tiles.set(i,new y(e,t,s)),this._tileBounds.set(i,e.extent),this._tileFeatureCounts.set(i,t.size)}_remove({id:e}){const t=this._tiles.get(e);t&&this._removeTileStorage(t)}_removeTileStorage(e){const t=[];for(const i of e.objectIds)1===this._unreferenceFeature(i)&&t.push(i);this.featureStore.removeManyById(t);const s=e.key.id;this._tiles.delete(s),this._tileBounds.delete(s)}_processEditsDelete(e){this.featureStore.removeManyById(e);for(const t of this._tiles.values()){for(const s of e)t.objectIds.delete(s);this._tileFeatureCounts.set(t.key.id,t.objectIds.size)}for(const t of e)this._refCounts.delete(t)}async _processEditsRefetch(e,t,s){if(!e.length)return;const{features:i}=await t(e,s);for(const r of i){const e=h(this._tmpBoundingRect,r.geometry);null!=e&&this._tileBounds.forEachInBounds(e,e=>{const t=this._tiles.get(e);this.featureStore.add(r);const s=r.objectId;t.objectIds.has(s)||(t.objectIds.add(s),this._referenceFeature(s),this._tileFeatureCounts.set(t.key.id,t.objectIds.size))})}}process(e,t=()=>!0,s){if(null==this.tileInfo||!e.extent||null!=this.extent&&!l(c(this.extent,this._tmpBoundingRect),e.extent))return new v(e);if(this._memoryLimitExceeded&&!this._tiles.hasLowerPriority(e.id??""))return new v(e);const r=this.getAttributesForTile(e.id);if(i(s,r))return new v(e);const o=this._createTileTree(e,this.tileInfo);return this._simplify(o,t,null,0,1),this._collectMissingTiles(e,o,this.tileInfo,s)}get debugInfo(){return Array.from(this._tiles.values()).map(({key:e})=>({key:e.toJSON(),featureCount:this._tileFeatureCounts.get(e.id)||0}))}getFeatureCount(e){return this._tileFeatureCounts.get(e.id)??0}async fetchCount(e,t,s,i){const r=this._tileFeatureCounts.get(e.id);if(null!=r)return r;const o=await f(t,s,i);return this._tileFeatureCounts.set(e.id,o.data.count),o.data.count}_createTileTree(e,t){const s=new g(e.level,e.row,e.col);return t.updateTileInfo(s,1),this._tileBounds.forEachInBounds(e.extent,i=>{const r=this._tiles.get(i)?.key;r&&p(e,r)&&this._populateChildren(s,r,t,this._tileFeatureCounts.get(r.id)||0)}),s}_populateChildren(e,t,s,i){const r=t.level-e.level-1;if(r<0)return void(e.isLeaf=!0);const o=t.row>>r,n=t.col>>r,l=e.row<<1,c=n-(e.col<<1)+(o-l<<1),u=e.children[c];if(null!=u)this._populateChildren(u,t,s,i);else{const r=new g(e.level+1,o,n);s.updateTileInfo(r,1),e.children[c]=r,this._populateChildren(r,t,s,i)}}_simplify(e,t,s,i,r){const o=r*r;if(e.isLeaf)return t(this.getFeatureCount(e),r)?0:(this._remove(e),null!=s&&(s.children[i]=null),o);const n=r/2,l=n*n;let c=0;for(let u=0;u<e.children.length;u++){const s=e.children[u];c+=null!=s?this._simplify(s,t,e,u,n):l}return 0===c?this._mergeChildren(e):1-c/o<S&&(this._purge(e),null!=s&&(s.children[i]=null),c=o),c}_mergeChildren(e){const t=new Set;let i;this._forEachLeaf(e,e=>{const r=this._tiles.get(e.id);if(r){i=i?s(i,r.attributeKeys):new Set(r.attributeKeys);for(const e of r.objectIds)t.has(e)||(t.add(e),this._referenceFeature(e));this._remove(e)}}),this._addTileStorage(e,t,i??new Set),e.isLeaf=!0,e.children[0]=e.children[1]=e.children[2]=e.children[3]=null,this._tileFeatureCounts.set(e.id,t.size)}_forEachLeaf(e,t){for(const s of e.children)null!=s&&(s.isLeaf?t(s):this._forEachLeaf(s,t))}_purge(e){if(null!=e)if(e.isLeaf)this._remove(e);else for(let t=0;t<e.children.length;t++){const s=e.children[t];this._purge(s),e.children[t]=null}}_collectMissingTiles(e,t,s,i){const r=new C(s,e,this.extent);return this._collectMissingTilesRecurse(t,r,1,i),r.info}_collectMissingTilesRecurse(e,t,s,r){const o=this.getAttributesForTile(e.id),n=o&&!i(r,o);if(n&&t.addMissing(e.level,e.row,e.col,s),e.isLeaf)return;if(!e.hasChildren)return void(n||t.addMissing(e.level,e.row,e.col,s));const l=s/2;for(let i=0;i<e.children.length;i++){const s=e.children[i];null==s?t.addMissing(e.level+1,(e.row<<1)+((2&i)>>1),(e.col<<1)+(1&i),l):this._collectMissingTilesRecurse(s,t,l,r)}}_referenceFeature(e){const t=(this._refCounts.get(e)||0)+1;return this._refCounts.set(e,t),1===t?0:2}_unreferenceFeature(e){const t=(this._refCounts.get(e)||0)-1;return 0===t?(this._refCounts.delete(e),1):(t>0&&this._refCounts.set(e,t),2)}get test(){}};function p(e,t){if(!e||!t)return!1;if(e.level===t.level)return e.row===t.row&&e.col===t.col;const s=e.level<t.level,i=s?e:t,r=s?t:e,o=1<<r.level-i.level;return Math.floor(r.row/o)===i.row&&Math.floor(r.col/o)===i.col}e([r({constructOnly:!0})],m.prototype,"featureStore",void 0),e([r()],m.prototype,"tileInfo",void 0),e([r()],m.prototype,"extent",void 0),e([r()],m.prototype,"maximumByteSize",void 0),m=e([o("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTileStore")],m);class y{constructor(e,t,s){this.key=e,this.objectIds=t,this.attributeKeys=s}}class g extends d{constructor(){super(...arguments),this.isLeaf=!1,this.children=[null,null,null,null]}get hasChildren(){return!this.isLeaf&&(null!=this.children[0]||null!=this.children[1]||null!=this.children[2]||null!=this.children[3])}}class v{constructor(e,t=[]){this.missingTiles=t,this.fullArea=0,this.coveredArea=0,this.fullArea=u(e.extent),this.coveredArea=this.fullArea}prepend(e){this.missingTiles=e.missingTiles.concat(this.missingTiles),this.coveredArea+=e.coveredArea,this.fullArea+=e.fullArea}}class C{constructor(e,t,s){this._tileInfo=e,this._extent=null,this.info=new v(t),null!=s&&(this._extent=c(s))}addMissing(e,t,s,i){const r=new d(e,t,s);this._tileInfo.updateTileInfo(r,1)&&(null==this._extent||l(this._extent,r.extent))&&(this.info.missingTiles.push({data:r,resolution:i}),this.info.coveredArea-=u(r.extent))}}const S=.18751;export{m as FeatureServiceTileStore,v as ProcessResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{removeUnordered as e,filterInPlace as t}from"../../core/arrayUtils.js";import s from"../../core/Handles.js";import"../../core/has.js";import r from"../../core/Logger.js";import{removeMaybe as i}from"../../core/maybe.js";import a from"../../core/PerformanceSampler.js";import{isAborted as n,createAbortError as u,when as _,isPromiseLike as h}from"../../core/promiseUtils.js";import{watch as o,initial as E,when as d}from"../../core/reactiveUtils.js";import{signal as T}from"../../core/signal.js";import{Milliseconds as c}from"../../core/time.js";import m from"./debugFlags.js";import{PromiseQueue as l}from"./PromiseQueue.js";import{Yield as R}from"./Yield.js";function g(){return new U}const I={RESOURCE_CONTROLLER_IMMEDIATE:"immediate",RESOURCE_CONTROLLER:"schedule",SLIDE:"slide",STREAM_DATA_LOADER:"stream loader",ELEVATION_QUERY:"elevation query",TERRAIN_SURFACE:"terrain",SURFACE_GEOMETRY_UPDATES:"surface geometry updates",LOD_RENDERER:"LoD renderer",GRAPHICS_CORE:"Graphics3D",I3S_CONTROLLER:"I3S",POINT_CLOUD_LAYER:"point cloud",FEATURE_TILE_FETCHER:"feature fetcher",STREAM_CONTROLLER:"stream controller",OVERLAY:"overlay",OVERLAY_RENDERER:"overlay renderer",STAGE:"stage",GRAPHICS_DECONFLICTOR:"graphics deconflictor",FILTER_VISIBILITY:"Graphics3D filter visibility",SCALE_VISIBILITY:"Graphics3D scale visibility",FRUSTUM_VISIBILITY:"Graphics3D frustum visibility",POINT_OF_INTEREST_FREQUENT:"POI frequent",POINT_OF_INTEREST_INFREQUENT:"POI infrequent",LABELER:"labeler",FEATURE_QUERY_ENGINE:"feature query",FEATURE_TILE_TREE:"feature tile tree",FEATURE_TILE_TREE_ACTIVE:"fast feature tile tree",ELEVATION_ALIGNMENT:"elevation alignment",ELEVATION_ALIGNMENT_SCENE:"elevation alignment scene",TEXT_TEXTURE_ATLAS:"text texture atlas",TEXTURE_UNLOAD:"texture unload",LINE_OF_SIGHT_TOOL:"line of sight tool",LINE_OF_SIGHT_TOOL_INTERACTIVE:"interactive line of sight tool",ELEVATION_PROFILE:"elevation profile",SNAPPING:"snapping",SHADOW_ACCUMULATOR:"shadow accumulator",CLOUDS_GENERATOR:"clouds generator",FLOW_GENERATOR:"flow generator",MAPVIEW_FETCH_QUEUE:"mapview fetch queue",MAPVIEW_LAYERVIEW_UPDATE:"mapview layerview update",MAPVIEW_VECTOR_TILE_PARSING_QUEUE:"mapview vector tile parsing queue",NONE:0,TEST_PRIO:1},f=0,p=new Map([[I.RESOURCE_CONTROLLER_IMMEDIATE,f],[I.RESOURCE_CONTROLLER,4],[I.SLIDE,f],[I.STREAM_DATA_LOADER,f],[I.ELEVATION_QUERY,f],[I.TERRAIN_SURFACE,1],[I.SURFACE_GEOMETRY_UPDATES,1],[I.LOD_RENDERER,2],[I.GRAPHICS_CORE,2],[I.I3S_CONTROLLER,2],[I.POINT_CLOUD_LAYER,2],[I.FEATURE_TILE_FETCHER,2],[I.STREAM_CONTROLLER,2],[I.CLOUDS_GENERATOR,2],[I.OVERLAY,4],[I.OVERLAY_RENDERER,4],[I.STAGE,4],[I.GRAPHICS_DECONFLICTOR,4],[I.FILTER_VISIBILITY,4],[I.SCALE_VISIBILITY,4],[I.FRUSTUM_VISIBILITY,4],[I.POINT_OF_INTEREST_FREQUENT,6],[I.POINT_OF_INTEREST_INFREQUENT,30],[I.LABELER,8],[I.FEATURE_QUERY_ENGINE,8],[I.FEATURE_TILE_TREE,16],[I.FEATURE_TILE_TREE_ACTIVE,f],[I.ELEVATION_ALIGNMENT,12],[I.ELEVATION_ALIGNMENT_SCENE,14],[I.TEXT_TEXTURE_ATLAS,12],[I.TEXTURE_UNLOAD,12],[I.LINE_OF_SIGHT_TOOL,16],[I.LINE_OF_SIGHT_TOOL_INTERACTIVE,f],[I.SNAPPING,f],[I.SHADOW_ACCUMULATOR,30],[I.FLOW_GENERATOR,12],[I.MAPVIEW_FETCH_QUEUE,f],[I.MAPVIEW_LAYERVIEW_UPDATE,2],[I.MAPVIEW_VECTOR_TILE_PARSING_QUEUE,f]]);function L(e){return p.has(e)?p.get(e):"number"==typeof e?e:1}const A=c(6.5),O=c(1),N=c(30),b=c(1e3/30),k=c(100),P=.9;class U{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some(e=>e.needsUpdate)}constructor(){this._updating=T(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new a("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new C,this.state=1,this._tasks=new Array,this._runQueue=new Array,this._load=0,this._forceTask=!1,this._debug=!1,this._debugHandle=o(()=>m.SCHEDULER_LOG_SLOW_TASKS,e=>this._debug=e,E);for(const e of Object.keys(I))this.performanceInfo.tasks.set(I[e],new a(String(I[e])))}destroy(){this._tasks.forEach(e=>e.remove()),this._tasks.length=0,this._runQueue.length=0,i(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(e){this._updatingChanged(),e&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask(()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this._runFrame())}))}registerTask(e,t){const s=new S(this,e,t);return this._tasks.push(s),this._updatingChanged(),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new a(e)),s}get load(){return this._load}frame(e){if(this._startFrameTaskTimes(),this._updateBudget(e)){const e=this._budget.now();return this._runFrame(),this._recordFrameTaskTimes(this._budget.now()-e),!0}return this._recordFrameTaskTimes(0),!1}_updateBudget(e){this._test&&(this._test.usedBudget=0),++this._frameNumber;let t=A,s=e.frameDuration,r=O;switch(this.state){case 2:t=c(0),s=c(Math.max(k,e.frameDuration)),r=N;break;case 1:s=c(Math.max(b,e.frameDuration))}return s=c(s-e.elapsedFrameTime-t),2!==this.state&&s<O&&!this._forceTask?(this._forceTask=!0,!1):(s=c(Math.max(s,r)),this._budget.reset(s),this._updateLoad(),this._schedule())}_runFrame(){switch(this._forceTask=!1,this._microTaskQueued=!1,this.state){case 2:this._runIdle();break;case 1:this._runInteracting();break;default:this._runAnimating()}this._test&&(this._test.usedBudget=this._budget.elapsed)}stopFrame(){this._budget.reset(c(0)),this._budget.madeProgress()}removeTask(t){e(this._tasks,t),e(this._runQueue,t),this._updatingChanged()}_updateTask(e){this._tasks.forEach(t=>{t.name===e&&t.setPriority(e)})}_getState(e){if(this._runQueue.some(t=>t.name===e))return"s";let t="i";return this._tasks.forEach(s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t="r":"r"!==t&&(t="w"))}),t}_getRuntime(e){let t=0;return this._tasks.forEach(s=>{s.name===e&&(t+=s.runtime)}),t}_resetRuntimes(){this._tasks.forEach(e=>e.runtime=0)}_getRunning(){const e=new Map;if(this._tasks.forEach(t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)}),0===e.size)return null;let t="";return e.forEach((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`}),t}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const e=this._tasks.reduce((e,t)=>t.needsUpdate?++e:e,0);this._load=this._load*P+e*(1-P)}_schedule(){for(t(this._runQueue,e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1)),this._tasks.forEach(e=>{e.basePriority===f&&e.needsUpdate&&!this._runQueue.includes(e)&&e.blockFrame!==this._frameNumber&&this._runQueue.unshift(e)});0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forEach(s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==f&&s.blockFrame!==this._frameNumber)if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority}),!e)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){do{for(;this._runQueue.length>0;){const t=this._budget.now(),s=this._runQueue.pop();this._budget.resetProgress();try{s.task.runTask(this._budget)===R&&(s.blockFrame=this._frameNumber)}catch(e){r.getLogger("esri.views.support.Scheduler").error(`Exception in task "${s.name}"`,e),s.blockFrame=this._frameNumber}!this._budget.hasProgressed&&s.blockFrame!==this._frameNumber&&s.needsUpdate&&(s.name,I.I3S_CONTROLLER,s.blockFrame=this._frameNumber),s.schedulePriority=s.basePriority;const i=this._budget.now()-t;if(s.runtime+=i,this._frameTaskTimes.set(s.priority,this._frameTaskTimes.get(s.priority)+i),this._budget.remaining<=0)return void this._updatingChanged()}}while(this._schedule());this._updatingChanged()}_startFrameTaskTimes(){for(const e of Object.keys(I))this._frameTaskTimes.set(I[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach((e,t)=>this.performanceInfo.tasks.get(t).push(e)),this.performanceInfo.total.push(e)}get test(){return this._test}}class S{get task(){return this._task.value}get readyToRun(){return this._queue.readyToRun}get updating(){return this._queue.updating}constructor(e,t,r){this._scheduler=e,this.name=t,this.blockFrame=0,this.runtime=0,this._queue=new l,this._handles=new s,this._basePriority=L(t),this.schedulePriority=this._basePriority,this._task=T(null!=r?r:this._queue),this._handles.add(d(()=>this.task.readyToRun,t=>e.taskRunningChanged(t)))}remove(){this.processQueue(y),this._scheduler.removeTask(this),this.schedule=D.schedule,this.reschedule=D.reschedule,this.scheduleGenerator=D.scheduleGenerator,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){if(this.name===e)return;this.name=e;const t=L(e);this._basePriority!==f&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.readyToRun||!this.task.destroyed&&this.task.readyToRun}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}scheduleGenerator(e,t,s){return this._queue.pushGenerator(e,t,s)}processQueue(e){return this._queue.runTask(e)}}class C{constructor(){this._begin=performance?.now()??0,this._budget=0,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e){this._begin=this.now(),this._budget=e,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}const y=new C;function F(e){const t=new C;return t.reset(e),t}y.enabled=!1;class w{remove(){}processQueue(){}schedule(e,t,s){try{if(n(t)){const e=u();return s?Promise.resolve(s(e)):Promise.reject(e)}return _(e(y))}catch(r){return Promise.reject(r)}}reschedule(e,t,s){return this.schedule(e,t,s)}async scheduleGenerator(e,t,s){if(n(t)){const e=u();if(s)return s(e);throw e}const r=e(y);for(;;){const e=r.next(y),i=h(e)?await e:e;if(n(t)){const e=u();if(s){const t=s(e);return r.return(null),t}throw r.throw(e),e}if(i.done)return i.value}}}const D=new w;export{D as ImmediateTask,I as TaskPriority,L as getTaskPriority,F as makeBudget,g as newScheduler,y as noBudget,p as taskPriorities};
5
+ import{removeUnordered as e,filterInPlace as t}from"../../core/arrayUtils.js";import s from"../../core/Handles.js";import"../../core/has.js";import r from"../../core/Logger.js";import{removeMaybe as i}from"../../core/maybe.js";import{recordPerformance as a}from"../../core/performance.js";import n from"../../core/PerformanceSampler.js";import{isAborted as u,createAbortError as _,when as h,isPromiseLike as o}from"../../core/promiseUtils.js";import{watch as E,initial as d,when as T}from"../../core/reactiveUtils.js";import{signal as c}from"../../core/signal.js";import{Milliseconds as m}from"../../core/time.js";import l from"./debugFlags.js";import{PromiseQueue as g}from"./PromiseQueue.js";import{Yield as R}from"./Yield.js";function I(){return new U}const f={RESOURCE_CONTROLLER_IMMEDIATE:"immediate",RESOURCE_CONTROLLER:"schedule",SLIDE:"slide",STREAM_DATA_LOADER:"stream loader",ELEVATION_QUERY:"elevation query",TERRAIN_SURFACE:"terrain",SURFACE_GEOMETRY_UPDATES:"surface geometry updates",LOD_RENDERER:"LoD renderer",GRAPHICS_CORE:"Graphics3D",I3S_CONTROLLER:"I3S",POINT_CLOUD_LAYER:"point cloud",FEATURE_TILE_FETCHER:"feature fetcher",STREAM_CONTROLLER:"stream controller",OVERLAY:"overlay",OVERLAY_RENDERER:"overlay renderer",STAGE:"stage",GRAPHICS_DECONFLICTOR:"graphics deconflictor",FILTER_VISIBILITY:"graphics filter visibility",SCALE_VISIBILITY:"graphics scale visibility",FRUSTUM_VISIBILITY:"graphics frustum visibility",POINT_OF_INTEREST_FREQUENT:"POI frequent",POINT_OF_INTEREST_INFREQUENT:"POI infrequent",LABELER:"labeler",FEATURE_QUERY_ENGINE:"feature query",FEATURE_TILE_TREE:"feature tile tree",FEATURE_TILE_TREE_ACTIVE:"fast feature tile tree",ELEVATION_ALIGNMENT:"elevation alignment",ELEVATION_ALIGNMENT_SCENE:"elevation alignment scene",TEXT_TEXTURE_ATLAS:"text texture atlas",TEXTURE_UNLOAD:"texture unload",LINE_OF_SIGHT_TOOL:"line of sight tool",LINE_OF_SIGHT_TOOL_INTERACTIVE:"interactive line of sight tool",ELEVATION_PROFILE:"elevation profile",SNAPPING:"snapping",SHADOW_ACCUMULATOR:"shadow accumulator",CLOUDS_GENERATOR:"clouds generator",FLOW_GENERATOR:"flow generator",MAPVIEW_FETCH_QUEUE:"mapview fetch queue",MAPVIEW_LAYERVIEW_UPDATE:"mapview layerview update",MAPVIEW_VECTOR_TILE_PARSING_QUEUE:"mapview vector tile parsing queue",NONE:0,TEST_PRIO:1},p=0,L=new Map([[f.RESOURCE_CONTROLLER_IMMEDIATE,p],[f.RESOURCE_CONTROLLER,4],[f.SLIDE,p],[f.STREAM_DATA_LOADER,p],[f.ELEVATION_QUERY,p],[f.TERRAIN_SURFACE,1],[f.SURFACE_GEOMETRY_UPDATES,1],[f.LOD_RENDERER,2],[f.GRAPHICS_CORE,2],[f.I3S_CONTROLLER,2],[f.POINT_CLOUD_LAYER,2],[f.FEATURE_TILE_FETCHER,2],[f.STREAM_CONTROLLER,2],[f.CLOUDS_GENERATOR,2],[f.OVERLAY,4],[f.OVERLAY_RENDERER,4],[f.STAGE,4],[f.GRAPHICS_DECONFLICTOR,4],[f.FILTER_VISIBILITY,4],[f.SCALE_VISIBILITY,4],[f.FRUSTUM_VISIBILITY,4],[f.POINT_OF_INTEREST_FREQUENT,6],[f.POINT_OF_INTEREST_INFREQUENT,30],[f.LABELER,8],[f.FEATURE_QUERY_ENGINE,8],[f.FEATURE_TILE_TREE,16],[f.FEATURE_TILE_TREE_ACTIVE,p],[f.ELEVATION_ALIGNMENT,12],[f.ELEVATION_ALIGNMENT_SCENE,14],[f.TEXT_TEXTURE_ATLAS,12],[f.TEXTURE_UNLOAD,12],[f.LINE_OF_SIGHT_TOOL,16],[f.LINE_OF_SIGHT_TOOL_INTERACTIVE,p],[f.SNAPPING,p],[f.SHADOW_ACCUMULATOR,30],[f.FLOW_GENERATOR,12],[f.MAPVIEW_FETCH_QUEUE,p],[f.MAPVIEW_LAYERVIEW_UPDATE,2],[f.MAPVIEW_VECTOR_TILE_PARSING_QUEUE,p]]);function A(e){return L.has(e)?L.get(e):"number"==typeof e?e:1}const O=m(6.5),N=m(1),b=m(30),k=m(1e3/30),S=m(100),P=.9;class U{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some(e=>e.needsUpdate)}constructor(){this._updating=c(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new n("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new F,this.state=1,this._tasks=new Array,this._runQueue=new Array,this._load=0,this._forceTask=!1,this._debug=!1,this._debugHandle=E(()=>l.SCHEDULER_LOG_SLOW_TASKS,e=>this._debug=e,d);for(const e of Object.keys(f))this.performanceInfo.tasks.set(f[e],new n(String(f[e])))}destroy(){this._tasks.forEach(e=>e.remove()),this._tasks.length=0,this._runQueue.length=0,i(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(e){this._updatingChanged(),e&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask(()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this._runFrame())}))}registerTask(e,t){const s=new C(this,e,t);return this._tasks.push(s),this._updatingChanged(),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new n(e)),s}get load(){return this._load}frame(e){if(this._startFrameTaskTimes(),this._updateBudget(e)){const e=this._budget.now();this._runFrame();const t=this._budget.now();this._recordFrameTaskTimes(t-e);const s=2===this.state?"Idle":1===this.state?"Interacting":"Animating";return a(`${s} Frame Tasks`,e,t,"Maps SDK","Scheduling"),!0}return this._recordFrameTaskTimes(0),!1}_updateBudget(e){this._test&&(this._test.usedBudget=0),++this._frameNumber;let t=O,s=e.frameDuration,r=N;switch(this.state){case 2:t=m(0),s=m(Math.max(S,e.frameDuration)),r=b;break;case 1:s=m(Math.max(k,e.frameDuration))}return s=m(s-e.elapsedFrameTime-t),2!==this.state&&s<N&&!this._forceTask?(this._forceTask=!0,!1):(s=m(Math.max(s,r)),this._budget.reset(s),this._updateLoad(),this._schedule())}_runFrame(){switch(this._forceTask=!1,this._microTaskQueued=!1,this.state){case 2:this._runIdle();break;case 1:this._runInteracting();break;default:this._runAnimating()}this._test&&(this._test.usedBudget=this._budget.elapsed)}stopFrame(){this._budget.reset(m(0)),this._budget.madeProgress()}removeTask(t){e(this._tasks,t),e(this._runQueue,t),this._updatingChanged()}_updateTask(e){this._tasks.forEach(t=>{t.name===e&&t.setPriority(e)})}_getState(e){if(this._runQueue.some(t=>t.name===e))return"s";let t="i";return this._tasks.forEach(s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t="r":"r"!==t&&(t="w"))}),t}_getRuntime(e){let t=0;return this._tasks.forEach(s=>{s.name===e&&(t+=s.runtime)}),t}_resetRuntimes(){this._tasks.forEach(e=>e.runtime=0)}_getRunning(){const e=new Map;if(this._tasks.forEach(t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)}),0===e.size)return null;let t="";return e.forEach((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`}),t}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const e=this._tasks.reduce((e,t)=>t.needsUpdate?++e:e,0);this._load=this._load*P+e*(1-P)}_schedule(){for(t(this._runQueue,e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1)),this._tasks.forEach(e=>{e.basePriority===p&&e.needsUpdate&&!this._runQueue.includes(e)&&e.blockFrame!==this._frameNumber&&this._runQueue.unshift(e)});0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forEach(s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==p&&s.blockFrame!==this._frameNumber)if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority}),!e)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){do{for(;this._runQueue.length>0;){const t=this._budget.now(),s=this._runQueue.pop();this._budget.resetProgress();try{s.task.runTask(this._budget)===R&&(s.blockFrame=this._frameNumber)}catch(e){r.getLogger("esri.views.support.Scheduler").error(`Exception in task "${s.name}"`,e),s.blockFrame=this._frameNumber}!this._budget.hasProgressed&&s.blockFrame!==this._frameNumber&&s.needsUpdate&&(s.name,f.I3S_CONTROLLER,s.blockFrame=this._frameNumber),s.schedulePriority=s.basePriority;const i=this._budget.now(),n=i-t;if(a(`${s.name}`,t,i,"Maps SDK","Scheduling"),s.runtime+=n,this._frameTaskTimes.set(s.priority,this._frameTaskTimes.get(s.priority)+n),this._budget.remaining<=0)return void this._updatingChanged()}}while(this._schedule());this._updatingChanged()}_startFrameTaskTimes(){for(const e of Object.keys(f))this._frameTaskTimes.set(f[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach((e,t)=>this.performanceInfo.tasks.get(t).push(e)),this.performanceInfo.total.push(e)}get test(){return this._test}}class C{get task(){return this._task.value}get readyToRun(){return this._queue.readyToRun}get updating(){return this._queue.updating}constructor(e,t,r){this._scheduler=e,this.name=t,this.blockFrame=0,this.runtime=0,this._queue=new g,this._handles=new s,this._basePriority=A(t),this.schedulePriority=this._basePriority,this._task=c(null!=r?r:this._queue),this._handles.add(T(()=>this.task.readyToRun,t=>e.taskRunningChanged(t)))}remove(){this.processQueue(y),this._scheduler.removeTask(this),this.schedule=M.schedule,this.reschedule=M.reschedule,this.scheduleGenerator=M.scheduleGenerator,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){if(this.name===e)return;this.name=e;const t=A(e);this._basePriority!==p&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.readyToRun||!this.task.destroyed&&this.task.readyToRun}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}scheduleGenerator(e,t,s){return this._queue.pushGenerator(e,t,s)}processQueue(e){return this._queue.runTask(e)}}class F{constructor(){this._begin=performance?.now()??0,this._budget=0,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e){this._begin=this.now(),this._budget=e,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}const y=new F;function w(e){const t=new F;return t.reset(e),t}y.enabled=!1;class D{remove(){}processQueue(){}schedule(e,t,s){try{if(u(t)){const e=_();return s?Promise.resolve(s(e)):Promise.reject(e)}return h(e(y))}catch(r){return Promise.reject(r)}}reschedule(e,t,s){return this.schedule(e,t,s)}async scheduleGenerator(e,t,s){if(u(t)){const e=_();if(s)return s(e);throw e}const r=e(y);for(;;){const e=r.next(y),i=o(e)?await e:e;if(u(t)){const e=_();if(s){const t=s(e);return r.return(null),t}throw r.throw(e),e}if(i.done)return i.value}}}const M=new D;export{M as ImmediateTask,f as TaskPriority,A as getTaskPriority,w as makeBudget,I as newScheduler,y as noBudget,L as taskPriorities};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import"../../core/has.js";import t from"../../core/Logger.js";const r=()=>t.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class n{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class s extends n{constructor(){super(...arguments),this.vertex=new u,this.fragment=new u,this.attributes=new c,this.varyings=new h,this.extensions=new m,this.outputs=new _}get fragmentUniforms(){return this.fragment.uniforms.entries}get attributeNames(){return this.attributes.names}get builder(){return this}generate(e,t=!1){const r=this.extensions.generateSource(e),n=this.attributes.generateSource(e),s=this.varyings.generateSource(e),i="vertex"===e?this.vertex:this.fragment,a=i.uniforms.generateSource(),o=i.code.generateSource(),u=i.main.generateSource(t),c="vertex"===e?p:l,h=i.constants.generateSource(),m=this.outputs.generateSource(e);return`#version 300 es\n${r.join("\n")}\n${c}\n${h.join("\n")}\n${a.join("\n")}\n${n.join("\n")}\n${s.join("\n")}\n${m.join("\n")}\n${o.join("\n")}\n${u.join("\n")}`}generateBind(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)});const r=Array.from(t.values()),n=r.length;return t=>{for(let s=0;s<n;++s)r[s](e,t)}}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)});const r=Array.from(t.values()),n=r.length;return(t,s)=>{for(let i=0;i<n;++i)r[i](e,t,s)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)});const r=Array.from(t.values()),n=r.length;return(t,s,i)=>{for(let a=0;a<n;++a)r[a](e,i,t,s)}}}class i{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(const t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(t){if(null!=t){if(this._entries.has(t.name)&&!this._entries.get(t.name).equals(t))throw new e("shaderbuilder:duplicate-uniform",`Duplicate uniform name ${t.name} for different uniform type`);this._entries.set(t.name,t)}else r().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map(({name:e,arraySize:t,type:r})=>null!=t?`uniform ${r} ${e}[${t}];`:`uniform ${r} ${e};`)}get entries(){return Array.from(this._entries.values())}}class a{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(t){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];if(t)throw new e("shaderbuilder:missing-main","Shader does not contain main function body.");return[]}}class o{constructor(e){this._stage=e,this._entries=new Array}add(e){return this._entries.push(e),this._stage}generateSource(){return this._entries}}class u extends n{constructor(){super(...arguments),this.uniforms=new i(this),this.main=new a(this),this.code=new o(this),this.constants=new d(this)}get builder(){return this}}class c{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map(e=>`in ${e[1]} ${e[0]};`)}get names(){return this._entries.map(([e])=>e)}}class h{constructor(){this._entries=new Map}add(e,t,n){this._entries.has(e)?r().warn(`Ignoring duplicate varying ${t} ${e}`):this._entries.set(e,{type:t,invariant:n?.invariant??!1})}generateSource(e){const t=new Array;return this._entries.forEach((r,n)=>t.push((r.invariant&&"vertex"===e?"invariant ":"")+("int"===r.type?"flat ":"")+("vertex"===e?"out":"in")+` ${r.type} ${n};`)),t}}class m{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){const t="vertex"===e?m.ALLOWLIST_VERTEX:m.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter(e=>t.includes(e)).map(e=>`#extension ${e} : enable`)}static{this.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"]}static{this.ALLOWLIST_VERTEX=[]}}class _{constructor(){this._entries=new Map}add(e,t,n=0){const s=this._entries.get(n);s?.name!==e||s?.type!==t?this._entries.set(n,{name:e,type:t}):r().warn(`Fragment shader output location ${n} occupied`)}static{this.DEFAULT_TYPE="vec4"}static{this.DEFAULT_NAME="fragColor"}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:_.DEFAULT_NAME,type:_.DEFAULT_TYPE});const t=new Array;return this._entries.forEach((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`)),t}}class d{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let n="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":n=d._numberToFloatStr(r);break;case"int":n=d._numberToIntStr(r);break;case"bool":n=r.toString();break;case"vec2":n=`vec2(${d._numberToFloatStr(r[0])}, ${d._numberToFloatStr(r[1])})`;break;case"vec3":n=`vec3(${d._numberToFloatStr(r[0])}, ${d._numberToFloatStr(r[1])}, ${d._numberToFloatStr(r[2])})`;break;case"vec4":n=`vec4(${d._numberToFloatStr(r[0])}, ${d._numberToFloatStr(r[1])}, ${d._numberToFloatStr(r[2])}, ${d._numberToFloatStr(r[3])})`;break;case"ivec2":n=`ivec2(${d._numberToIntStr(r[0])}, ${d._numberToIntStr(r[1])})`;break;case"ivec3":n=`ivec3(${d._numberToIntStr(r[0])}, ${d._numberToIntStr(r[1])}, ${d._numberToIntStr(r[2])})`;break;case"ivec4":n=`ivec4(${d._numberToIntStr(r[0])}, ${d._numberToIntStr(r[1])}, ${d._numberToIntStr(r[2])}, ${d._numberToIntStr(r[3])})`;break;case"uvec2":n=`uvec2(${d._numberToIntStr(r[0])}, ${d._numberToIntStr(r[1])})`;break;case"uvec3":n=`uvec3(${d._numberToIntStr(r[0])}, ${d._numberToIntStr(r[1])}, ${d._numberToIntStr(r[2])})`;break;case"uvec4":n=`uvec4(${d._numberToIntStr(r[0])}, ${d._numberToIntStr(r[1])}, ${d._numberToIntStr(r[2])}, ${d._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${t}(${Array.prototype.map.call(r,e=>d._numberToFloatStr(e)).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${n};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const l="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n#else\n precision mediump float;\n precision mediump int;\n precision mediump sampler2D;\n precision mediump usampler2D;\n precision mediump sampler2DArray;\n precision mediump sampler2DShadow;\n#endif",p="precision highp float;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n\n\n invariant gl_Position;\n ";export{o as Code,n as Includes,a as Main,s as ShaderBuilder,u as Stage,i as Uniforms};
5
+ import e from"../../core/Error.js";import"../../core/has.js";import t from"../../core/Logger.js";const r=()=>t.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class n{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class s extends n{constructor(){super(...arguments),this.vertex=new u,this.fragment=new u,this.attributes=new c,this.varyings=new h,this.outputs=new m}get fragmentUniforms(){return this.fragment.uniforms.entries}get attributeNames(){return this.attributes.names}get builder(){return this}generate(e,t=!1){const r=this.attributes.generateSource(e),n=this.varyings.generateSource(e),s="vertex"===e?this.vertex:this.fragment,i=s.uniforms.generateSource(),a=s.code.generateSource(),o=s.main.generateSource(t),u="vertex"===e?d:_,c=s.constants.generateSource(),h=this.outputs.generateSource(e);return`#version 300 es\n${u}\n${c.join("\n")}\n${i.join("\n")}\n${r.join("\n")}\n${n.join("\n")}\n${h.join("\n")}\n${a.join("\n")}\n${o.join("\n")}`}generateBind(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)});const r=Array.from(t.values()),n=r.length;return t=>{for(let s=0;s<n;++s)r[s](e,t)}}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)});const r=Array.from(t.values()),n=r.length;return(t,s)=>{for(let i=0;i<n;++i)r[i](e,t,s)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)});const r=Array.from(t.values()),n=r.length;return(t,s,i)=>{for(let a=0;a<n;++a)r[a](e,i,t,s)}}}class i{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(const t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(t){if(null!=t){if(this._entries.has(t.name)&&!this._entries.get(t.name).equals(t))throw new e("shaderbuilder:duplicate-uniform",`Duplicate uniform name ${t.name} for different uniform type`);this._entries.set(t.name,t)}else r().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map(({name:e,arraySize:t,type:r})=>null!=t?`uniform ${r} ${e}[${t}];`:`uniform ${r} ${e};`)}get entries(){return Array.from(this._entries.values())}}class a{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(t){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];if(t)throw new e("shaderbuilder:missing-main","Shader does not contain main function body.");return[]}}class o{constructor(e){this._stage=e,this._entries=new Array}add(e){return this._entries.push(e),this._stage}generateSource(){return this._entries}}class u extends n{constructor(){super(...arguments),this.uniforms=new i(this),this.main=new a(this),this.code=new o(this),this.constants=new l(this)}get builder(){return this}}class c{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map(e=>`in ${e[1]} ${e[0]};`)}get names(){return this._entries.map(([e])=>e)}}class h{constructor(){this._entries=new Map}add(e,t,n){this._entries.has(e)?r().warn(`Ignoring duplicate varying ${t} ${e}`):this._entries.set(e,{type:t,invariant:n?.invariant??!1})}generateSource(e){const t=new Array;return this._entries.forEach((r,n)=>t.push((r.invariant&&"vertex"===e?"invariant ":"")+("int"===r.type?"flat ":"")+("vertex"===e?"out":"in")+` ${r.type} ${n};`)),t}}class m{constructor(){this._entries=new Map}add(e,t,n=0){const s=this._entries.get(n);s?.name!==e||s?.type!==t?this._entries.set(n,{name:e,type:t}):r().warn(`Fragment shader output location ${n} occupied`)}static{this.DEFAULT_TYPE="vec4"}static{this.DEFAULT_NAME="fragColor"}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:m.DEFAULT_NAME,type:m.DEFAULT_TYPE});const t=new Array;return this._entries.forEach((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`)),t}}class l{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let n="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":n=l._numberToFloatStr(r);break;case"int":n=l._numberToIntStr(r);break;case"bool":n=r.toString();break;case"vec2":n=`vec2(${l._numberToFloatStr(r[0])}, ${l._numberToFloatStr(r[1])})`;break;case"vec3":n=`vec3(${l._numberToFloatStr(r[0])}, ${l._numberToFloatStr(r[1])}, ${l._numberToFloatStr(r[2])})`;break;case"vec4":n=`vec4(${l._numberToFloatStr(r[0])}, ${l._numberToFloatStr(r[1])}, ${l._numberToFloatStr(r[2])}, ${l._numberToFloatStr(r[3])})`;break;case"ivec2":n=`ivec2(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])})`;break;case"ivec3":n=`ivec3(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])})`;break;case"ivec4":n=`ivec4(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])}, ${l._numberToIntStr(r[3])})`;break;case"uvec2":n=`uvec2(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])})`;break;case"uvec3":n=`uvec3(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])})`;break;case"uvec4":n=`uvec4(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])}, ${l._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${t}(${Array.prototype.map.call(r,e=>l._numberToFloatStr(e)).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${n};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const _="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n#else\n precision mediump float;\n precision mediump int;\n precision mediump sampler2D;\n precision mediump usampler2D;\n precision mediump sampler2DArray;\n precision mediump sampler2DShadow;\n#endif",d="precision highp float;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n\n\n invariant gl_Position;\n ";export{o as Code,n as Includes,a as Main,s as ShaderBuilder,u as Stage,i as Uniforms};