@arcgis/core 4.28.0-next.20230713 → 4.28.0-next.20230715

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 (273) hide show
  1. package/Basemap.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{0b28b5eec6dc67be8ce9.js → 0121bfc81b794745e024.js} +1 -1
  4. package/assets/esri/core/workers/chunks/067d3d45caeaaba18d81.js +1 -0
  5. package/assets/esri/core/workers/chunks/080a13dc08a8db498ffa.js +1 -0
  6. package/assets/esri/core/workers/chunks/0dccbc6c2559fdc0c2ad.js +1 -0
  7. package/assets/esri/core/workers/chunks/{c912466351e37db68b6c.js → 14ab33573bb02d6c6b1a.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{c4b066760e9aa85b7607.js → 1b948f8429d8f9b1bbfb.js} +1 -1
  9. package/assets/esri/core/workers/chunks/204ed2ebd2d3da659791.js +1 -0
  10. package/assets/esri/core/workers/chunks/{5d5d4a4fdf5ca8d7837f.js → 239d4176ff2d5142b7f1.js} +1 -1
  11. package/assets/esri/core/workers/chunks/23bb98aaa20b180ee680.js +1 -0
  12. package/assets/esri/core/workers/chunks/27cf3ef9566d5226b0df.js +1 -0
  13. package/assets/esri/core/workers/chunks/{1c86f80d73dee1a4d9b7.js → 2f1695e4807a534e1743.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{60b422009f58d7bbb8c4.js → 3164b862a6b3f654fade.js} +1 -1
  15. package/assets/esri/core/workers/chunks/35f60625ada14eb801fd.js +1 -0
  16. package/assets/esri/core/workers/chunks/{4e4e62462deec25e82ce.js → 3a04bf1cdce263fe2191.js} +1 -1
  17. package/assets/esri/core/workers/chunks/41011207b6cc5eb6232f.js +1 -0
  18. package/assets/esri/core/workers/chunks/{8d50449c029c73136204.js → 432e3558db53574d21b4.js} +1 -1
  19. package/assets/esri/core/workers/chunks/4767f69b81d36dde9550.js +1 -0
  20. package/assets/esri/core/workers/chunks/{08ee2bd914867fd2cbd5.js → 490629c6f9fee501c9cd.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{044b15794b6403792f04.js → 4f079d0e69189c1d8bd9.js} +1 -1
  22. package/assets/esri/core/workers/chunks/4f1f4cc82fea0d1f79ec.js +1 -0
  23. package/assets/esri/core/workers/chunks/503a393327df755d8843.js +1 -0
  24. package/assets/esri/core/workers/chunks/50e05f479c7d414fc06b.js +1 -0
  25. package/assets/esri/core/workers/chunks/{3835a76c017431f19422.js → 51da3c5c50b153ce6bc7.js} +1 -1
  26. package/assets/esri/core/workers/chunks/54b97ca5f2164b941f5b.js +1 -0
  27. package/assets/esri/core/workers/chunks/5a3fb63dab89cf3418f7.js +1 -0
  28. package/assets/esri/core/workers/chunks/5ceaf1f05b219034a10c.js +1 -0
  29. package/assets/esri/core/workers/chunks/70aabffaaa0a1da8e609.js +1 -0
  30. package/assets/esri/core/workers/chunks/78cb95d1594a0cb0dd7a.js +1 -0
  31. package/assets/esri/core/workers/chunks/7f391ae5e0ea7812baca.js +1 -0
  32. package/assets/esri/core/workers/chunks/{1d2b8b937bbda91a6549.js → 82dfbc175b52c7a10475.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{036cd65514eab1749363.js → 8467d05626a3a72462c9.js} +1 -1
  34. package/assets/esri/core/workers/chunks/9038b1317f1252e31f09.js +1 -0
  35. package/assets/esri/core/workers/chunks/929ddc4d9975ed893767.js +1 -0
  36. package/assets/esri/core/workers/chunks/{e86dcc239c6a57000afc.js → 94633cc9cfb089ef010e.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{2f5f398374ff77fb17f0.js → 975eef6d20c17a0ed07b.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{8913bddc76b82cb24664.js → 98cf4e744e8f2c3fc536.js} +1 -1
  39. package/assets/esri/core/workers/chunks/a00414550fa21c5662f3.js +1 -0
  40. package/assets/esri/core/workers/chunks/a3a1d4f32e518e97d071.js +1 -0
  41. package/assets/esri/core/workers/chunks/{4e2029c8cc8a5afe5759.js → a5348f117dacdcae99ee.js} +1 -1
  42. package/assets/esri/core/workers/chunks/b0f0a3178d88fa600a11.js +1 -0
  43. package/assets/esri/core/workers/chunks/b4446ce010bc4a5aa917.js +1 -0
  44. package/assets/esri/core/workers/chunks/b8a45b28a915a423d09d.js +1 -0
  45. package/assets/esri/core/workers/chunks/{fb97d39b25b0b009d2f0.js → bd9e6f38c9ec4195322a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{30deb5a8e9a82186991d.js → c15c4bd52d4472ed50bc.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{55109f141c9f120833f6.js → c3d773c93efb41088c54.js} +1 -1
  48. package/assets/esri/core/workers/chunks/c518410b1214ffc58017.js +1 -0
  49. package/assets/esri/core/workers/chunks/d55faafe2ac914a3ebd1.js +1 -0
  50. package/assets/esri/core/workers/chunks/d5fd4780d57173f3e303.js +1 -0
  51. package/assets/esri/core/workers/chunks/da01e520a1ae0048e73e.js +1 -0
  52. package/assets/esri/core/workers/chunks/dd7603c9e5fd178c88f7.js +1 -0
  53. package/assets/esri/core/workers/chunks/ddcf58937924ab5a3d76.js +1 -0
  54. package/assets/esri/core/workers/chunks/e03a0f52d438f53a3057.js +1 -0
  55. package/assets/esri/core/workers/chunks/e433440fecd0114cb23d.js +1 -0
  56. package/assets/esri/core/workers/chunks/ea1560129e426980a4e2.js +1 -0
  57. package/assets/esri/core/workers/chunks/f73e2143f8d053aef092.js +1 -0
  58. package/assets/esri/core/workers/chunks/{0a0af540f4fe64c3d292.js → fa14238f1c308a74f843.js} +1 -1
  59. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +3 -0
  60. package/assets/esri/themes/dark/main.css +1 -1
  61. package/assets/esri/themes/light/main.css +1 -1
  62. package/assets/esri/themes/light/view.css +1 -1
  63. package/chunks/RibbonLine.glsl.js +57 -72
  64. package/chunks/ar.js +1 -1
  65. package/chunks/ar2.js +1 -1
  66. package/chunks/bg_BG.js +1 -1
  67. package/chunks/bg_BG2.js +1 -1
  68. package/chunks/bs_BA.js +1 -1
  69. package/chunks/bs_BA2.js +1 -1
  70. package/chunks/ca_ES.js +1 -1
  71. package/chunks/ca_ES2.js +1 -1
  72. package/chunks/chartUtilsAm5.js +1 -1
  73. package/chunks/cs_CZ.js +1 -1
  74. package/chunks/cs_CZ2.js +1 -1
  75. package/chunks/da_DK.js +1 -1
  76. package/chunks/da_DK2.js +1 -1
  77. package/chunks/de_CH.js +1 -1
  78. package/chunks/de_CH2.js +1 -1
  79. package/chunks/de_DE.js +1 -1
  80. package/chunks/de_DE2.js +1 -1
  81. package/chunks/el_GR.js +1 -1
  82. package/chunks/el_GR2.js +1 -1
  83. package/chunks/en_CA.js +1 -1
  84. package/chunks/en_CA2.js +1 -1
  85. package/chunks/en_US.js +1 -1
  86. package/chunks/en_US2.js +1 -1
  87. package/chunks/es_ES.js +1 -1
  88. package/chunks/es_ES2.js +1 -1
  89. package/chunks/et_EE.js +1 -1
  90. package/chunks/et_EE2.js +1 -1
  91. package/chunks/fi_FI.js +1 -1
  92. package/chunks/fi_FI2.js +1 -1
  93. package/chunks/fr_FR.js +1 -1
  94. package/chunks/fr_FR2.js +1 -1
  95. package/chunks/he_IL.js +1 -1
  96. package/chunks/he_IL2.js +1 -1
  97. package/chunks/hr_HR.js +1 -1
  98. package/chunks/hr_HR2.js +1 -1
  99. package/chunks/hu_HU.js +1 -1
  100. package/chunks/hu_HU2.js +1 -1
  101. package/chunks/id_ID.js +1 -1
  102. package/chunks/id_ID2.js +1 -1
  103. package/chunks/it_IT.js +1 -1
  104. package/chunks/it_IT2.js +1 -1
  105. package/chunks/ja_JP.js +1 -1
  106. package/chunks/ja_JP2.js +1 -1
  107. package/chunks/ko_KR.js +1 -1
  108. package/chunks/ko_KR2.js +1 -1
  109. package/chunks/lt_LT.js +1 -1
  110. package/chunks/lt_LT2.js +1 -1
  111. package/chunks/lv_LV.js +1 -1
  112. package/chunks/lv_LV2.js +1 -1
  113. package/chunks/nb_NO.js +1 -1
  114. package/chunks/nb_NO2.js +1 -1
  115. package/chunks/nl_NL.js +1 -1
  116. package/chunks/nl_NL2.js +1 -1
  117. package/chunks/pl_PL.js +1 -1
  118. package/chunks/pl_PL2.js +1 -1
  119. package/chunks/pt_BR.js +1 -1
  120. package/chunks/pt_BR2.js +1 -1
  121. package/chunks/pt_PT.js +1 -1
  122. package/chunks/pt_PT2.js +1 -1
  123. package/chunks/ro_RO.js +1 -1
  124. package/chunks/ro_RO2.js +1 -1
  125. package/chunks/ru_RU.js +1 -1
  126. package/chunks/ru_RU2.js +1 -1
  127. package/chunks/sk_SK.js +1 -1
  128. package/chunks/sk_SK2.js +1 -1
  129. package/chunks/sl_SL.js +1 -1
  130. package/chunks/sl_SL2.js +1 -1
  131. package/chunks/sr_RS.js +1 -1
  132. package/chunks/sr_RS2.js +1 -1
  133. package/chunks/sv_SE.js +1 -1
  134. package/chunks/sv_SE2.js +1 -1
  135. package/chunks/th_TH.js +1 -1
  136. package/chunks/th_TH2.js +1 -1
  137. package/chunks/tr_TR.js +1 -1
  138. package/chunks/tr_TR2.js +1 -1
  139. package/chunks/uk_UA.js +1 -1
  140. package/chunks/uk_UA2.js +1 -1
  141. package/chunks/vi_VN.js +1 -1
  142. package/chunks/vi_VN2.js +1 -1
  143. package/chunks/zh_Hans.js +1 -1
  144. package/chunks/zh_Hans2.js +1 -1
  145. package/chunks/zh_Hant.js +1 -1
  146. package/chunks/zh_Hant2.js +1 -1
  147. package/config.js +1 -1
  148. package/core/colorUtils.js +1 -1
  149. package/core/image/apng.js +1 -1
  150. package/core/image/gif.js +1 -1
  151. package/core/urlUtils.js +1 -1
  152. package/core/workers/WorkerOwner.js +1 -1
  153. package/core/workers/staticWorkerMessages.js +5 -0
  154. package/geometry/projection.js +1 -1
  155. package/interfaces.d.ts +42 -2
  156. package/kernel.js +1 -1
  157. package/layers/support/ImageElement.js +1 -1
  158. package/layers/video/VideoController.js +1 -1
  159. package/package.json +1 -1
  160. package/portal/Portal.js +1 -1
  161. package/support/BasemapStyle.js +5 -0
  162. package/support/basemapUtils.js +1 -1
  163. package/support/revision.js +1 -1
  164. package/symbols/support/previewSymbol2D.js +1 -1
  165. package/views/2d/GoToManager.js +5 -0
  166. package/views/2d/engine/Stage.js +1 -1
  167. package/views/2d/engine/webgl/Overlay.js +1 -1
  168. package/views/2d/engine/webgl/animatedFormats/utils.js +1 -1
  169. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  170. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  171. package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
  172. package/views/2d/layers/MediaLayerView2D.js +1 -1
  173. package/views/2d/layers/TileLayerView2D.js +1 -1
  174. package/views/2d/support/engineHelpers.js +1 -1
  175. package/views/2d/support/screenshotUtils.js +5 -0
  176. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  177. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  178. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  179. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  180. package/views/3d/analysis/Dimension/LengthDimensionVisualization.js +1 -1
  181. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  182. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  183. package/views/3d/analysis/Dimension/settings.js +1 -1
  184. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  185. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  186. package/views/3d/analysis/LineOfSight/LineOfSightToolConfiguration.js +1 -1
  187. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  188. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  189. package/views/3d/analysis/Slice/settings.js +1 -1
  190. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  191. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  192. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  193. package/views/3d/interactive/editingTools/lineGraphicVisualElementUtils.js +1 -1
  194. package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
  195. package/views/3d/interactive/editingTools/manipulations/MoveXYDiscManipulation.js +1 -1
  196. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  197. package/views/3d/interactive/editingTools/originGraphicVisualElementUtils.js +1 -1
  198. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  199. package/views/3d/interactive/editingTools/settings.js +1 -1
  200. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  201. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  202. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  203. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  204. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  205. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  206. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  207. package/views/3d/terrain/TerrainRenderer.js +1 -1
  208. package/views/3d/terrain/TerrainSurface.js +1 -1
  209. package/views/3d/terrain/Tile.js +1 -1
  210. package/views/3d/terrain/TileRenderer.js +1 -1
  211. package/views/3d/terrain/TileTexture.js +1 -1
  212. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +12 -13
  213. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  214. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  215. package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
  216. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  217. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  218. package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
  219. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  220. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  221. package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
  222. package/views/MapView.js +1 -1
  223. package/views/Theme.js +5 -0
  224. package/views/View.js +1 -1
  225. package/views/interactive/SegmentLabels.js +1 -1
  226. package/views/support/colorUtils.js +1 -1
  227. package/views/webgl/Texture.js +1 -1
  228. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  229. package/widgets/Attachments.js +1 -1
  230. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  231. package/widgets/ElevationProfile/support/InputRepresentation3D.js +1 -1
  232. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  233. package/widgets/Feature/FeatureMedia/chartCommon.js +1 -1
  234. package/widgets/Feature/FeatureMedia.js +1 -1
  235. package/widgets/support/chartUtils.js +1 -1
  236. package/widgets/support/chartUtilsAm5.js +1 -1
  237. package/assets/esri/core/workers/chunks/05f3374114bce72d3560.js +0 -1
  238. package/assets/esri/core/workers/chunks/10028df973ef7f9531c8.js +0 -1
  239. package/assets/esri/core/workers/chunks/1cbb03eec9dc23ef043b.js +0 -1
  240. package/assets/esri/core/workers/chunks/289061552a2a64bebd76.js +0 -1
  241. package/assets/esri/core/workers/chunks/308eeeaec591b4eea1de.js +0 -1
  242. package/assets/esri/core/workers/chunks/3155c750fc5a4e04a785.js +0 -1
  243. package/assets/esri/core/workers/chunks/346f67995b327bca8ee0.js +0 -1
  244. package/assets/esri/core/workers/chunks/3736e17dd6461f74cfaf.js +0 -1
  245. package/assets/esri/core/workers/chunks/37e60f9ca86f9d4bf4ea.js +0 -1
  246. package/assets/esri/core/workers/chunks/3a0b45ecc48e23a3a5d5.js +0 -1
  247. package/assets/esri/core/workers/chunks/417377c8e76944f428a7.js +0 -1
  248. package/assets/esri/core/workers/chunks/498dca81073e1fb477b9.js +0 -1
  249. package/assets/esri/core/workers/chunks/536962375ce4f1394481.js +0 -1
  250. package/assets/esri/core/workers/chunks/64bb4093c019a02d5309.js +0 -1
  251. package/assets/esri/core/workers/chunks/69de4733173ee2dee6e1.js +0 -1
  252. package/assets/esri/core/workers/chunks/6dcffe6683a798a42c78.js +0 -1
  253. package/assets/esri/core/workers/chunks/7a898d167029ee11a680.js +0 -1
  254. package/assets/esri/core/workers/chunks/7a973d70e6bc42d804ee.js +0 -1
  255. package/assets/esri/core/workers/chunks/7d9d2629af373c84624f.js +0 -1
  256. package/assets/esri/core/workers/chunks/885cb0da78e6853b23a4.js +0 -1
  257. package/assets/esri/core/workers/chunks/8e28862296972e9e6f82.js +0 -1
  258. package/assets/esri/core/workers/chunks/928431e1c449c6054547.js +0 -1
  259. package/assets/esri/core/workers/chunks/afdf30439d71a7cc19ae.js +0 -1
  260. package/assets/esri/core/workers/chunks/b1fa1571fd98d3b8dffe.js +0 -1
  261. package/assets/esri/core/workers/chunks/b20167d9163d0ee74b65.js +0 -1
  262. package/assets/esri/core/workers/chunks/b2a0e3e1dfccda7ed12e.js +0 -1
  263. package/assets/esri/core/workers/chunks/c09db831248054600e16.js +0 -1
  264. package/assets/esri/core/workers/chunks/dcccc9760998271254b5.js +0 -1
  265. package/assets/esri/core/workers/chunks/ddea45acae89759e57fa.js +0 -1
  266. package/assets/esri/core/workers/chunks/e039108eb3a592f6d8e3.js +0 -1
  267. package/assets/esri/core/workers/chunks/e70314ac10cc1f8f9f86.js +0 -1
  268. package/assets/esri/core/workers/chunks/f2d399b394a1a9156214.js +0 -1
  269. package/assets/esri/core/workers/chunks/f74d4e1eecec06f84ee2.js +0 -1
  270. package/assets/esri/core/workers/chunks/fb7eff7f76386f81d57b.js +0 -1
  271. package/assets/esri/core/workers/chunks/fe277d33b5b8a11c76df.js +0 -1
  272. package/core/analysisThemeUtils.js +0 -5
  273. package/views/support/createScreenshotPlan.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../../chunks/tslib.es6.js";import{ShaderOutput as t}from"../core/shaderLibrary/ShaderOutput.js";import{parameter as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TransparencyPassType as p}from"../lib/TransparencyPassType.js";import{DefaultTechniqueConfiguration as i}from"../materials/DefaultTechniqueConfiguration.js";var r;!function(o){o[o.BUTT=0]="BUTT",o[o.SQUARE=1]="SQUARE",o[o.ROUND=2]="ROUND",o[o.COUNT=3]="COUNT"}(r||(r={}));class s extends i{constructor(){super(...arguments),this.output=t.Color,this.capType=r.BUTT,this.transparencyPassType=p.NONE,this.occluder=!1,this.hasSlicePlane=!1,this.hasPolygonOffset=!1,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stippleScaleWithLineWidth=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.wireframe=!1,this.objectAndLayerIdColorInstanced=!1}}o([e({count:t.COUNT})],s.prototype,"output",void 0),o([e({count:r.COUNT})],s.prototype,"capType",void 0),o([e({count:p.COUNT})],s.prototype,"transparencyPassType",void 0),o([e()],s.prototype,"occluder",void 0),o([e()],s.prototype,"hasSlicePlane",void 0),o([e()],s.prototype,"hasPolygonOffset",void 0),o([e()],s.prototype,"writeDepth",void 0),o([e()],s.prototype,"draped",void 0),o([e()],s.prototype,"stippleEnabled",void 0),o([e()],s.prototype,"stippleOffColorEnabled",void 0),o([e()],s.prototype,"stippleScaleWithLineWidth",void 0),o([e()],s.prototype,"stipplePreferContinuous",void 0),o([e()],s.prototype,"roundJoins",void 0),o([e()],s.prototype,"applyMarkerOffset",void 0),o([e()],s.prototype,"vvSize",void 0),o([e()],s.prototype,"vvColor",void 0),o([e()],s.prototype,"vvOpacity",void 0),o([e()],s.prototype,"falloffEnabled",void 0),o([e()],s.prototype,"innerColorEnabled",void 0),o([e()],s.prototype,"hasOccludees",void 0),o([e()],s.prototype,"multipassEnabled",void 0),o([e()],s.prototype,"cullAboveGround",void 0),o([e()],s.prototype,"wireframe",void 0),o([e({constValue:!0})],s.prototype,"stippleRequiresClamp",void 0),o([e({constValue:!0})],s.prototype,"stippleRequiresStretchMeasure",void 0),o([e({constValue:!0})],s.prototype,"hasVvInstancing",void 0),o([e({constValue:!0})],s.prototype,"hasSliceTranslatedView",void 0),o([e()],s.prototype,"objectAndLayerIdColorInstanced",void 0);export{r as CapType,s as RibbonLineTechniqueConfiguration};
5
+ import{_ as o}from"../../../../chunks/tslib.es6.js";import{ShaderOutput as t}from"../core/shaderLibrary/ShaderOutput.js";import{parameter as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TransparencyPassType as p}from"../lib/TransparencyPassType.js";import{DefaultTechniqueConfiguration as r}from"../materials/DefaultTechniqueConfiguration.js";var i;!function(o){o[o.BUTT=0]="BUTT",o[o.SQUARE=1]="SQUARE",o[o.ROUND=2]="ROUND",o[o.COUNT=3]="COUNT"}(i||(i={}));class s extends r{constructor(){super(...arguments),this.output=t.Color,this.capType=i.BUTT,this.transparencyPassType=p.NONE,this.occluder=!1,this.hasSlicePlane=!1,this.hasPolygonOffset=!1,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.wireframe=!1,this.objectAndLayerIdColorInstanced=!1}}o([e({count:t.COUNT})],s.prototype,"output",void 0),o([e({count:i.COUNT})],s.prototype,"capType",void 0),o([e({count:p.COUNT})],s.prototype,"transparencyPassType",void 0),o([e()],s.prototype,"occluder",void 0),o([e()],s.prototype,"hasSlicePlane",void 0),o([e()],s.prototype,"hasPolygonOffset",void 0),o([e()],s.prototype,"writeDepth",void 0),o([e()],s.prototype,"draped",void 0),o([e()],s.prototype,"stippleEnabled",void 0),o([e()],s.prototype,"stippleOffColorEnabled",void 0),o([e()],s.prototype,"stipplePreferContinuous",void 0),o([e()],s.prototype,"roundJoins",void 0),o([e()],s.prototype,"applyMarkerOffset",void 0),o([e()],s.prototype,"vvSize",void 0),o([e()],s.prototype,"vvColor",void 0),o([e()],s.prototype,"vvOpacity",void 0),o([e()],s.prototype,"falloffEnabled",void 0),o([e()],s.prototype,"innerColorEnabled",void 0),o([e()],s.prototype,"hasOccludees",void 0),o([e()],s.prototype,"multipassEnabled",void 0),o([e()],s.prototype,"cullAboveGround",void 0),o([e()],s.prototype,"wireframe",void 0),o([e({constValue:!0})],s.prototype,"stippleRequiresClamp",void 0),o([e({constValue:!0})],s.prototype,"stippleRequiresStretchMeasure",void 0),o([e({constValue:!0})],s.prototype,"hasVvInstancing",void 0),o([e({constValue:!0})],s.prototype,"hasSliceTranslatedView",void 0),o([e()],s.prototype,"objectAndLayerIdColorInstanced",void 0);export{i as CapType,s as RibbonLineTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e}from"../../../../core/maybe.js";import t from"../../../../core/PerformanceSampler.js";import{Milliseconds as r}from"../../../../core/time.js";import{createElapsedTimerPool as i}from"../../../webgl/TimerPool.js";var a;!function(e){e.OVERLAY="overlay",e.PREPARE="prepare",e.SHADOW_MAP="shadow map",e.LINEAR_DEPTH="linear depth",e.ACCUMULATED_SHADOWS="accumulated shadows",e.OBJECT_AND_LAYER_ID_COLOR="object/layer id color",e.SSAO="SSAO",e.OPAQUE="opaque",e.OPAQUE_EDGES="opaque edges",e.VOXEL="voxel",e.TRANSPARENT="transparent",e.TRANSPARENT_EDGES="transparent edges",e.HUD_VISIBILITY="HUD visibility",e.TRANSPARENT_TERRAIN="transparent terrain",e.ENVIRONMENT="environment",e.LASER_LINE="laser line",e.OCCLUDED="occluded",e.ANTIALIASING="antialiasing",e.HIGHLIGHTS="highlights",e.HUD="HUD",e.HUD_OCCLUDED="HUD occluded",e.FINISH="finish"}(a||(a={}));const o="Total";class s{constructor(e){this._rctx=e,this._startTimeStampCPU=r(0),this._lastTimeStampCPU=r(0),this._totalCPUTime=new t(o),this._cpuTimeSamplers=new Map(Object.values(a).map((e=>[e,new t(e)]))),this._enableGPUTimer=0,this._totalGPUTime=new t("GPU"),this._gpuTimeSamplers=new Map(Object.values(a).map((e=>[e,new t(e)]))),this._totalTime=r(0),this._totalFrameCount=0}get totalCPUTimeSampler(){return this._totalCPUTime}get cpuTimeSamplers(){return Array.from(this._cpuTimeSamplers.values())}get totalGPUTimeSampler(){return this._totalGPUTime}get gpuTimeSamplers(){return Array.from(this._gpuTimeSamplers.values())}get gpuSamplingEnabled(){return null!=this._gpuTimerPool}get totalTime(){return this._totalTime}get totalFrameCount(){return this._totalFrameCount}get elapsedTime(){return r(performance.now()-this._startTimeStampCPU)}enableGPUPerformanceInfo(){if(null==this._gpuTimerPool){const e=[...Object.values(a),o];this._gpuTimerPool=i(this._rctx,e)}if(null==this._gpuTimerPool)return{hasGPUTimerSupport:!1,remove:()=>{}};++this._enableGPUTimer;let t=!1;return{hasGPUTimerSupport:!0,remove:()=>{t||(t=!0,--this._enableGPUTimer,0===this._enableGPUTimer&&(this._gpuTimerPool=e(this._gpuTimerPool)))}}}startFrame(){this._startTimeStampCPU=this._lastTimeStampCPU=r(performance.now()),null!=this._gpuTimerPool&&this._gpuTimerPool.start()}advance(e){const t=r(performance.now());if(this._cpuTimeSamplers.get(e).record(t-this._lastTimeStampCPU),this._lastTimeStampCPU=t,null!=this._gpuTimerPool){const t=this._gpuTimerPool.stop(e);this._gpuTimeSamplers.get(e).record(t),this._gpuTimerPool.start()}}finishFrame(){if(null!=this._gpuTimerPool){const e=this._gpuTimerPool.stop(a.FINISH);this._gpuTimeSamplers.get(a.FINISH).record(e)}const e=r(performance.now()-this._startTimeStampCPU);this._totalTime=r(this._totalTime+e),this._totalCPUTime.record(e),null!=this._gpuTimerPool&&this._totalGPUTime.record(this.gpuTimeSamplers.reduce(((e,t)=>e+(t.last||0)),0)),++this._totalFrameCount}}export{a as PerformanceCategory,s as RendererPerformanceInfo};
5
+ import{disposeMaybe as e}from"../../../../core/maybe.js";import t from"../../../../core/PerformanceSampler.js";import{Milliseconds as r}from"../../../../core/time.js";import{createElapsedTimerPool as i}from"../../../webgl/TimerPool.js";var a;!function(e){e.OVERLAY="overlay",e.PREPARE="prepare",e.SHADOW_MAP="shadow map",e.LINEAR_DEPTH="linear depth",e.ACCUMULATED_SHADOWS="accumulated shadows",e.OBJECT_AND_LAYER_ID_COLOR="object/layer id color",e.SSAO="SSAO",e.OPAQUE="opaque",e.OPAQUE_EDGES="opaque edges",e.VOXEL="voxel",e.TRANSPARENT="transparent",e.TRANSPARENT_EDGES="transparent edges",e.HUD_VISIBILITY="HUD visibility",e.TRANSPARENT_TERRAIN="transparent terrain",e.ENVIRONMENT="environment",e.LASER_LINE="laser line",e.OCCLUDED="occluded",e.ANTIALIASING="antialiasing",e.HIGHLIGHTS="highlights",e.HUD="HUD",e.HUD_OCCLUDED="HUD occluded",e.FINISH="finish"}(a||(a={}));const s="Total";class o{constructor(e){this._rctx=e,this._startTimeStampCPU=r(0),this._lastTimeStampCPU=r(0),this._totalCPUTime=new t(s),this._cpuTimeSamplers=new Map(Object.values(a).map((e=>[e,new t(e)]))),this._enableGPUTimer=0,this._totalGPUTime=new t("GPU"),this._gpuTimeSamplers=new Map(Object.values(a).map((e=>[e,new t(e)]))),this._totalTime=r(0),this._totalFrameCount=0}get totalCPUTimeSampler(){return this._totalCPUTime}get cpuTimeSamplers(){return Array.from(this._cpuTimeSamplers.values())}get totalGPUTimeSampler(){return this._totalGPUTime}get gpuTimeSamplers(){return Array.from(this._gpuTimeSamplers.values())}get gpuSamplingEnabled(){return null!=this._gpuTimerPool}get totalTime(){return this._totalTime}get totalFrameCount(){return this._totalFrameCount}get elapsedTime(){return r(performance.now()-this._startTimeStampCPU)}enableGPUPerformanceInfo(){if(null==this._gpuTimerPool){const e=[...Object.values(a),s];this._gpuTimerPool=i(this._rctx,e)}if(null==this._gpuTimerPool)return{hasGPUTimerSupport:!1,remove:()=>{}};++this._enableGPUTimer;let t=!1;return{hasGPUTimerSupport:!0,remove:()=>{t||(t=!0,--this._enableGPUTimer,0===this._enableGPUTimer&&(this._gpuTimerPool=e(this._gpuTimerPool)))}}}startFrame(){this._startTimeStampCPU=this._lastTimeStampCPU=r(performance.now()),this._gpuTimerPool&&this._gpuTimerPool.start()}advance(e){const t=r(performance.now());if(this._cpuTimeSamplers.get(e).record(t-this._lastTimeStampCPU),this._lastTimeStampCPU=t,this._gpuTimerPool){const t=this._gpuTimerPool.stop(e);this._gpuTimeSamplers.get(e).record(t),this._gpuTimerPool.start()}}finishFrame(){if(this._gpuTimerPool){const e=this._gpuTimerPool.stop(a.FINISH);this._gpuTimeSamplers.get(a.FINISH).record(e),this._rctx.gl.flush()}const e=r(performance.now()-this._startTimeStampCPU);this._totalTime=r(this._totalTime+e),this._totalCPUTime.record(e),this._gpuTimerPool&&this._totalGPUTime.record(this.gpuTimeSamplers.reduce(((e,t)=>e+(t.last||0)),0)),++this._totalFrameCount}}export{a as PerformanceCategory,o as RendererPerformanceInfo};
package/views/MapView.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import i from"../Viewpoint.js";import{isSome as r}from"../core/arrayUtils.js";import s from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import n from"../core/Error.js";import has from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{destroyMaybe as p}from"../core/maybe.js";import{throwIfAborted as h}from"../core/promiseUtils.js";import{watch as g,whenOnce as c,sync as u,syncAndInitial as d}from"../core/reactiveUtils.js";import{initialize as m}from"../core/workers/workers.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{cast as f}from"../core/accessorSupport/decorators/cast.js";import{subclass as w}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as _}from"../core/accessorSupport/ensureType.js";import{load as M,canProjectWithoutEngine as V,isLoaded as v}from"../geometry/projection.js";import T from"../layers/support/TileInfo.js";import{BreakpointsOwner as S}from"./BreakpointsOwner.js";import{DOMContainer as b}from"./DOMContainer.js";import{PopupView as j}from"./PopupView.js";import k from"./View.js";import L from"./ViewAnimation.js";import O from"./2d/AnimationManager.js";import P from"./2d/FrameTask.js";import{layerView2DImporter as R}from"./2d/layerViewModuleImportUtils.js";import x from"./2d/MapViewConstraints.js";import"./2d/tiling/PagedTileQueue.js";import E from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{create as C,extentToScale as z}from"./2d/viewpointUtils.js";import{ViewStateManager as D}from"./2d/ViewStateManager.js";import G from"./2d/input/MapViewInputManager.js";import q from"./2d/layers/features/support/TileStore.js";import A from"./2d/support/HighlightOptions.js";import{Timeline as I}from"./2d/support/Timeline.js";import N from"./support/createScreenshotPlan.js";import{encode as U,encodeData as F,getMaximumResolutionScale as W,getFormatAndQuality as $}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as H,createScreenPointFromSupportedEvent as B}from"./support/screenUtils.js";import{check as Q}from"./support/WebGLRequirements.js";import J from"./ui/DefaultUI.js";import K from"./ui/2d/DefaultUI2D.js";import Y from"../webmap/background/ColorBackground.js";let X,Z,ee,te,ie,re;async function se(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,Stage:a}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);Z=e,ee=t,te=i,ie=r,re=s,X=a}const ae=160,ne={flipY:!0,premultipliedAlpha:!0};let oe=class extends(S(j(b(k)))){constructor(e){super(e),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new a({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.stateManager=new D({constraints:new x({view:this})}),this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.rendering=!1,this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this._stationaryTimer=null,this._gotoTask=null,this.frameTask=new P(this),this._pePromise=null,this.floors=new s,this.highlightOptions=new A,this.inputManager=new G({view:this}),this.map=null,this.spatialReferenceLocked=!1,this.timeline=new I,this.type="2d",this.ui=new K,this.padding={top:0,right:0,bottom:0,left:0},this.addHandles([g((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(ae)}),u),this.on("resize",(e=>this.stateManager.resize(e.width,e.height))),g((()=>this.animationManager?.animation),(e=>{this.animation=e}))]),m()}destroy(){this._set("preconditionsReady",!1),this.frameTask=p(this.frameTask),this._gotoTask=null,this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new q(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get state(){return this.stateManager.state}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(!r||null==r.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get _projectionEngineLoaded(){return!!v()||(this._pePromise||(this._pePromise=M().finally((()=>{this._pePromise=null}))),!1)}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=this.spatialReference,i=e.targetGeometry;return!!V(i.spatialReference,t)||this._projectionEngineLoaded}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),!e||e.isFulfilled())return void this._set("animation",null);this._set("animation",e),this.frameTask.animationInProgress=!0;const i=()=>{e===this._get("animation")&&(this._set("animation",null),this.frameTask?.requestFrame()),this.frameTask.animationInProgress=!1};e.when(i,i)}get background(){return ce(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return this.stateManager?.constraints}set constraints(e){e.view=this;const t=this.stateManager.constraints;this.stateManager.constraints=e,t?.destroy()}get extent(){return this.stateManager?.extent??null}set extent(e){this.stateManager.extent=e}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get resizeAlign(){return this.stateManager.resizeAlign}set resizeAlign(e){this.stateManager.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return this.stateManager.rotation??0}set rotation(e){this.stateManager.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){const e=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)));if(has("esri-2d-log-updating")){const t=this.allLayerViews.reduce(((e,t)=>({...e,[t.layer.id]:!t.destroyed&&!("layerViews"in t)&&t.updating})),{});console.log(`Updating MapView: ${e}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(t)}\n`)}return e}get viewpoint(){return this.stateManager.viewpoint??null}set viewpoint(e){this.stateManager.viewpoint=e,this.frameTask.requestFrame()}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(e,t){if(e)return this.animation&&(this.animation=null),this._createAnimation(),c((()=>this.ready),t).then((()=>{const i={animate:!0,...t},r=C(e,this);return this.animation?.update(r),this._gotoTask={},i.animate?this._gotoAnimated(r,i):this._gotoImmediate(r,i)}));l.getLogger(this).error("#goTo()","target cannot be null or undefined")}async hitTest(e,t){const i=H(e)?B(this,e):e;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,a=!1,n=null,o=null;t?.include?ge(t.include,he(this,(e=>s.add(e)),(e=>{n||(n=new Set),n.add(e)}),(e=>s.add(e)),(()=>a=!0))):(a=!0,s=new Set(this.allLayerViews)),t?.exclude&&ge(t.exclude,he(this,(e=>s.delete(e)),(e=>{o||(o=new Set),o.add(e)})));const l=this.allLayerViews.filter((e=>!e.suspended&&s.has(e))).reverse(),p=this.toMap(i);let h=[...a?this.graphicsView.hitTest(p).map((e=>({type:"graphic",graphic:e,layer:null,mapPoint:p}))):[],...await Promise.all(l.map((e=>e.hitTest(p,i))).toArray())].filter(r).flat().filter(r);return n&&(h=h.filter((e=>!("graphic"in e)||!e.graphic||n?.has(pe(e.graphic))))),o&&(h=h.filter((e=>!("graphic"in e)||!e.graphic||!o?.has(pe(e.graphic))))),{screenPoint:i,results:h}}async takeScreenshot(e){const t=this._createScreenshotPlan(e),i=await this._stage.takeScreenshot(t);return U(i,{format:t.format,quality:t.quality,rotation:0,disableDecorations:!1},ne)}async _takeScreenshot(e){const t=this._createScreenshotPlan(e),i=await this._stage.takeScreenshot(t);return F(i,ne)}_createScreenshotPlan(e){e=e??{};const t=this.supersampleScreenshotsEnabled?Math.min(4,W(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;e.layers?(i=[],e.layers.forEach((e=>{const t=this.allLayerViews.find((t=>t.layer.id===e.id));t&&"container"in t&&t.container&&i.push(t.container)}))):i=this._stage.children;const{format:r,quality:s}=$(e.format,e.quality);return N(e,t,this.size,this.padding,r,s,i,e.rotation)}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}toMap(e){if(!this.ready)return null;const t=H(e)?B(this,e):e;return this.stateManager.toMap(t)}toScreen(e){return this.stateManager.toScreen(e)}on(e,t,i,r){const s=this.inputManager&&this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||null}hasLayerViewModule(e){return R.hasLayerViewModule(e)}importLayerView(e){return R.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(l.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(e){return this.hitTest(e).then((t=>({...t,mapPoint:this.toMap(e)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let e=Q(this.type);return has("safari")&&has("safari")<9&&(e=new n("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e?(l.getLogger(this).warn("#validate()",e.message),Promise.reject(e)):se()}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new L),this.animation}_cancellableGoTo(e,t,i){const r=()=>e===this._gotoTask,s=i.then((()=>{r()&&(this.animation=null)})).catch((e=>{throw r()&&(t&&!t.done&&(t.stop(),this.frameTask.animationInProgress=!1),this.animation=null),e})),a=new Promise((e=>e(s)));return t.when().catch((()=>{r()&&a.cancel&&a.cancel()})),a}_gotoImmediate(e,t){const i=this._gotoTask,r=this.animation,s=e.then((e=>{if(h(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");this.viewpoint=r.target=e,r.finish()}));return this._cancellableGoTo(i,r,s)}_flipStationary(e){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const e=performance.now()-this._lastStationaryEventTimestamp;e<ae&&(this._stationaryTimer=this._flipStationary(e))}),e)),this._stationaryTimer}_getDefaultViewpoint(){const{constraints:e,initialExtent:t,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??t,h=p?.center,g=l?.rotation??0,c=l?.scale||p&&z(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,d=o.rotation??g,m=o.scale??c;return u&&m?new i({targetGeometry:u,scale:m,rotation:d}):null}_gotoAnimated(e,t){const i=this._gotoTask,r=this.animation;if(!r)return Promise.resolve();const s=e.then((e=>{if(h(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");return r.update(e),this.animationManager.animate(r,this.viewpoint,t),r.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(i,r,s)}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new X(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this._stage=t,this._magnifierView=new re,this._magnifierView.magnifier=this.magnifier;const i=new te({view:this});this._set("labelManager",i);const r=new O({view:this});this._set("animationManager",r);const s=new ie({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("post-render",(()=>this._set("rendering",t.renderRequested))),t.on("will-render",(()=>this._set("rendering",t.renderRequested))),t.on("webgl-error",(e=>this.fatalError=e.error)),g((()=>this.stationary),(e=>t.stationary=e),d),g((()=>this.background),(e=>{t.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),d),g((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),d),g((()=>this.renderingOptions),(e=>t.renderingOptions=e),d),g((()=>this.highlightOptions),(e=>t.highlightOptions=e),d),g((()=>this.state.id),(()=>t.state=this.state),d)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.handles.remove("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null),this._set("ready",!1),this.stateManager.teardown(),this.animation=null}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this._stage.addChild(e.container)}));const e=this.graphicsView;this._stage.addChild(e.container),this._stage.addChild(this._magnifierView)}_setupSpatialReferenceDependentProperties(){const e=new E(T.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new Z({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new ee(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this._stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}};oe.type="2d",e([y({readOnly:!0})],oe.prototype,"animationManager",void 0),e([y({constructOnly:!0})],oe.prototype,"deactivatedWebGLExtensions",void 0),e([y({constructOnly:!0})],oe.prototype,"debugWebGLExtensions",void 0),e([y({readOnly:!0})],oe.prototype,"featuresTilingScheme",void 0),e([y({readOnly:!0})],oe.prototype,"fullOpacity",void 0),e([y({readOnly:!0})],oe.prototype,"graphicsTileStore",null),e([y()],oe.prototype,"graphicsView",void 0),e([y()],oe.prototype,"stateManager",void 0),e([y()],oe.prototype,"constraintsInfo",null),e([y({readOnly:!0})],oe.prototype,"state",null),e([y()],oe.prototype,"initialExtentRequired",null),e([y()],oe.prototype,"labelManager",void 0),e([y({readOnly:!0})],oe.prototype,"resourceManager",null),e([y({readOnly:!0})],oe.prototype,"textureManager",null),e([y({readOnly:!0})],oe.prototype,"mapViewNavigation",void 0),e([y({constructOnly:!0})],oe.prototype,"renderCanvas",void 0),e([y()],oe.prototype,"renderingOptions",void 0),e([y({readOnly:!0})],oe.prototype,"rendering",void 0),e([y({constructOnly:!0})],oe.prototype,"supersampleScreenshotsEnabled",void 0),e([y({readOnly:!0})],oe.prototype,"supportsGround",void 0),e([y()],oe.prototype,"_stationaryTimer",void 0),e([y()],oe.prototype,"_defaultsFromMapSettings",null),e([y()],oe.prototype,"_pePromise",void 0),e([y({readOnly:!0})],oe.prototype,"typeSpecificPreconditionsReady",null),e([y()],oe.prototype,"animation",null),e([y({type:Y})],oe.prototype,"background",null),e([y()],oe.prototype,"center",null),e([y({type:x})],oe.prototype,"constraints",null),e([y()],oe.prototype,"extent",null),e([y()],oe.prototype,"floors",void 0),e([y({type:A})],oe.prototype,"highlightOptions",void 0),e([y({readOnly:!0})],oe.prototype,"inputManager",void 0),e([y()],oe.prototype,"map",void 0),e([y()],oe.prototype,"padding",null),e([y()],oe.prototype,"resizeAlign",null),e([y({readOnly:!0})],oe.prototype,"resolution",null),e([y()],oe.prototype,"rotation",null),e([y()],oe.prototype,"scale",null),e([y({constructOnly:!0})],oe.prototype,"spatialReferenceLocked",void 0),e([y()],oe.prototype,"stationary",null),e([y({type:I,readOnly:!0})],oe.prototype,"timeline",void 0),e([y({readOnly:!0})],oe.prototype,"type",void 0),e([y({readOnly:!0})],oe.prototype,"updating",null),e([y()],oe.prototype,"viewpoint",null),e([y()],oe.prototype,"zoom",null),e([y({readOnly:!0})],oe.prototype,"navigating",null),e([y(),f((e=>e instanceof J?e:_(K,e)))],oe.prototype,"ui",void 0),oe=e([w("esri.views.MapView")],oe);const le=oe;function pe(e){const t=e.getObjectId();return t?`${e.layer?.uid??e.sourceLayer?.uid??"MapView"}/${t}`:`"MapView/${e.uid}`}function he(e,i,r,s,a){return n=>{if(n instanceof t){if(n.layer===e)a?.();else{const t=e.allLayerViews.find((e=>e.layer===n.layer));t&&s?.(t)}r(pe(n))}else{const t=e.allLayerViews.find((e=>e.layer===n));t&&i(t)}}}function ge(e,t){if(e)if(o(e))for(const i of e)if(o(i))for(const e of i)t(e);else t(i);else t(e)}function ce(e){return"esri.WebMap"===e?.declaredClass}export{le as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import i from"../Viewpoint.js";import{isSome as r}from"../core/arrayUtils.js";import s from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import n from"../core/Error.js";import has from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{destroyMaybe as p}from"../core/maybe.js";import{watch as h,sync as g,syncAndInitial as d}from"../core/reactiveUtils.js";import{initialize as u}from"../core/workers/workers.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as m}from"../core/accessorSupport/decorators/cast.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as f}from"../core/accessorSupport/ensureType.js";import{canProjectWithoutEngine as w,isLoadedOrLoad as M}from"../geometry/projection.js";import V from"../layers/support/TileInfo.js";import{BreakpointsOwner as v}from"./BreakpointsOwner.js";import{DOMContainer as _}from"./DOMContainer.js";import{PopupView as T}from"./PopupView.js";import b from"./View.js";import S from"./2d/AnimationManager.js";import j from"./2d/FrameTask.js";import{GoToManager as L}from"./2d/GoToManager.js";import{layerView2DImporter as O}from"./2d/layerViewModuleImportUtils.js";import R from"./2d/MapViewConstraints.js";import"./2d/tiling/PagedTileQueue.js";import k from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as x}from"./2d/viewpointUtils.js";import{ViewStateManager as P}from"./2d/ViewStateManager.js";import C from"./2d/input/MapViewInputManager.js";import E from"./2d/layers/features/support/TileStore.js";import D from"./2d/support/HighlightOptions.js";import{takeRawScreenshot as z,takeScreenshot as G}from"./2d/support/screenshotUtils.js";import{Timeline as N}from"./2d/support/Timeline.js";import{isSupportedScreenPointEvent as I,createScreenPointFromSupportedEvent as U}from"./support/screenUtils.js";import{check as q}from"./support/WebGLRequirements.js";import A from"./ui/DefaultUI.js";import F from"./ui/2d/DefaultUI2D.js";import W from"../webmap/background/ColorBackground.js";let $,H,B,Q,J,K;async function X(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,Stage:a}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);H=e,B=t,Q=i,J=r,K=s,$=a}const Y=160;let Z=class extends(v(T(_(b)))){constructor(e){super(e),this._magnifierView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new a({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.goToManager=new L({view:this}),this.graphicsView=null,this.stateManager=new P({constraints:new R({view:this})}),this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this._stationaryTimer=null,this.frameTask=new j(this),this.floors=new s,this.highlightOptions=new D,this.inputManager=new C({view:this}),this.map=null,this.spatialReferenceLocked=!1,this.timeline=new N,this.type="2d",this.ui=new F,this.test={takeScreenshot:async e=>z(this,e)},this.padding={top:0,right:0,bottom:0,left:0},this.addHandles([h((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(Y)}),g),this.on("resize",(e=>this.stateManager.resize(e.width,e.height))),h((()=>this.animationManager?.animation),(e=>{this.animation=e}))]),u()}destroy(){this._set("preconditionsReady",!1),this.frameTask=p(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new E(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get state(){return this.stateManager.state}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(!r||null==r.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=this.spatialReference,i=e.targetGeometry;return!!w(i.spatialReference,t)||M()}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),!e||e.isFulfilled())return this._set("animation",null),void(this.frameTask.animationInProgress=!1);this._set("animation",e),this.frameTask.animationInProgress=!0;const i=()=>{e===this._get("animation")&&(this._set("animation",null),this.frameTask?.requestFrame()),this.frameTask.animationInProgress=!1};e.when(i,i)}get background(){return se(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return this.stateManager?.constraints}set constraints(e){e.view=this;const t=this.stateManager.constraints;this.stateManager.constraints=e,t?.destroy()}get extent(){return this.stateManager?.extent??null}set extent(e){this.stateManager.extent=e}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return this.stateManager.resizeAlign}set resizeAlign(e){this.stateManager.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return this.stateManager.rotation??0}set rotation(e){this.stateManager.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){const e=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)));if(has("esri-2d-log-updating")){const t=this.allLayerViews.reduce(((e,t)=>({...e,[t.layer.id]:!t.destroyed&&!("layerViews"in t)&&t.updating})),{});console.log(`Updating MapView: ${e}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(t)}\n`)}return e}get viewpoint(){return this.stateManager.viewpoint??null}set viewpoint(e){this.stateManager.viewpoint=e,this.frameTask.requestFrame()}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(e,t){return this.goToManager.goTo(e,t)}async hitTest(e,t){const i=I(e)?U(this,e):e;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,a=!1,n=null,o=null;t?.include?re(t.include,ie(this,(e=>s.add(e)),(e=>{n||(n=new Set),n.add(e)}),(e=>s.add(e)),(()=>a=!0))):(a=!0,s=new Set(this.allLayerViews)),t?.exclude&&re(t.exclude,ie(this,(e=>s.delete(e)),(e=>{o||(o=new Set),o.add(e)})));const l=this.allLayerViews.filter((e=>!e.suspended&&s.has(e))).reverse(),p=this.toMap(i);let h=[...a?this.graphicsView.hitTest(p).map((e=>({type:"graphic",graphic:e,layer:null,mapPoint:p}))):[],...await Promise.all(l.map((e=>e.hitTest(p,i))).toArray())].filter(r).flat().filter(r);return n&&(h=h.filter((e=>!("graphic"in e)||!e.graphic||n?.has(te(e.graphic))))),o&&(h=h.filter((e=>!("graphic"in e)||!e.graphic||!o?.has(te(e.graphic))))),{screenPoint:i,results:h}}async takeScreenshot(e){return G(this,e)}toMap(e){if(!this.ready)return null;const t=I(e)?U(this,e):e;return this.stateManager.toMap(t)}toScreen(e){return this.stateManager.toScreen(e)}on(e,t,i,r){const s=this.inputManager&&this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||null}hasLayerViewModule(e){return O.hasLayerViewModule(e)}importLayerView(e){return O.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(l.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(e){return this.hitTest(e).then((t=>({...t,mapPoint:this.toMap(e)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let e=q(this.type);return has("safari")&&has("safari")<9&&(e=new n("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e?(l.getLogger(this).warn("#validate()",e.message),Promise.reject(e)):X()}_flipStationary(e){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const e=performance.now()-this._lastStationaryEventTimestamp;e<Y&&(this._stationaryTimer=this._flipStationary(e))}),e)),this._stationaryTimer}_getDefaultViewpoint(){const{constraints:e,initialExtent:t,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??t,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&x(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new i({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new $(this.surface,{canvas:this.renderCanvas,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=t,this._magnifierView=new K,this._magnifierView.magnifier=this.magnifier;const i=new Q({view:this});this._set("labelManager",i);const r=new S({view:this});this._set("animationManager",r);const s=new J({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("webgl-error",(e=>this.fatalError=e.error)),h((()=>this.stationary),(e=>t.stationary=e),d),h((()=>this.background),(e=>{t.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),d),h((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),d),h((()=>this.renderingOptions),(e=>t.renderingOptions=e),d),h((()=>this.highlightOptions),(e=>t.highlightOptions=e),d),h((()=>this.state.id),(()=>t.state=this.state),d)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.handles.remove("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null),this._set("ready",!1),this.stateManager.teardown(),this.animation=null}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this.stage.addChild(e.container)}));const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView)}_setupSpatialReferenceDependentProperties(){const e=new k(V.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new H({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new B(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}};Z.type="2d",e([c({readOnly:!0})],Z.prototype,"animationManager",void 0),e([c({constructOnly:!0})],Z.prototype,"deactivatedWebGLExtensions",void 0),e([c({constructOnly:!0})],Z.prototype,"debugWebGLExtensions",void 0),e([c({readOnly:!0})],Z.prototype,"featuresTilingScheme",void 0),e([c({readOnly:!0})],Z.prototype,"fullOpacity",void 0),e([c()],Z.prototype,"goToManager",void 0),e([c({readOnly:!0})],Z.prototype,"graphicsTileStore",null),e([c()],Z.prototype,"graphicsView",void 0),e([c()],Z.prototype,"stateManager",void 0),e([c()],Z.prototype,"constraintsInfo",null),e([c({readOnly:!0})],Z.prototype,"state",null),e([c()],Z.prototype,"initialExtentRequired",null),e([c()],Z.prototype,"labelManager",void 0),e([c({readOnly:!0})],Z.prototype,"mapViewNavigation",void 0),e([c({constructOnly:!0})],Z.prototype,"renderCanvas",void 0),e([c()],Z.prototype,"renderingOptions",void 0),e([c({constructOnly:!0})],Z.prototype,"supersampleScreenshotsEnabled",void 0),e([c({readOnly:!0})],Z.prototype,"supportsGround",void 0),e([c()],Z.prototype,"_stationaryTimer",void 0),e([c()],Z.prototype,"_defaultsFromMapSettings",null),e([c({readOnly:!0})],Z.prototype,"typeSpecificPreconditionsReady",null),e([c()],Z.prototype,"animation",null),e([c({type:W})],Z.prototype,"background",null),e([c()],Z.prototype,"center",null),e([c({type:R})],Z.prototype,"constraints",null),e([c()],Z.prototype,"extent",null),e([c()],Z.prototype,"floors",void 0),e([c({type:D})],Z.prototype,"highlightOptions",void 0),e([c({readOnly:!0})],Z.prototype,"inputManager",void 0),e([c()],Z.prototype,"map",void 0),e([c()],Z.prototype,"padding",null),e([c({readOnly:!0})],Z.prototype,"rendering",null),e([c()],Z.prototype,"resizeAlign",null),e([c({readOnly:!0})],Z.prototype,"resolution",null),e([c()],Z.prototype,"rotation",null),e([c()],Z.prototype,"scale",null),e([c({constructOnly:!0})],Z.prototype,"spatialReferenceLocked",void 0),e([c()],Z.prototype,"stationary",null),e([c({type:N,readOnly:!0})],Z.prototype,"timeline",void 0),e([c({readOnly:!0})],Z.prototype,"type",void 0),e([c({readOnly:!0})],Z.prototype,"updating",null),e([c()],Z.prototype,"viewpoint",null),e([c()],Z.prototype,"zoom",null),e([c({readOnly:!0})],Z.prototype,"navigating",null),e([c(),m((e=>e instanceof A?e:f(F,e)))],Z.prototype,"ui",void 0),Z=e([y("esri.views.MapView")],Z);const ee=Z;function te(e){const t=e.getObjectId();return t?`${e.layer?.uid??e.sourceLayer?.uid??"MapView"}/${t}`:`"MapView/${e.uid}`}function ie(e,i,r,s,a){return n=>{if(n instanceof t){if(n.layer===e)a?.();else{const t=e.allLayerViews.find((e=>e.layer===n.layer));t&&s?.(t)}r(te(n))}else{const t=e.allLayerViews.find((e=>e.layer===n));t&&i(t)}}}function re(e,t){if(e)if(o(e))for(const i of e)if(o(i))for(const e of i)t(e);else t(i);else t(e)}function se(e){return"esri.WebMap"===e?.declaredClass}export{ee as default};
package/views/Theme.js ADDED
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
+ */
5
+ import{_ as o}from"../chunks/tslib.es6.js";import r from"../Color.js";import e from"../core/Accessor.js";import{ClonableMixin as s}from"../core/Clonable.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";let p=class extends(s(e)){constructor(o){super(o),this.accentColor=new r([255,127,0]),this.textColor=new r([255,255,255])}};o([t({type:r,nonNullable:!0})],p.prototype,"accentColor",void 0),o([t({type:r,nonNullable:!0})],p.prototype,"textColor",void 0),p=o([c("esri.views.Theme")],p);const l=p;export{l as default};
package/views/View.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../TimeExtent.js";import r from"../core/Accessor.js";import{createTask as a}from"../core/asyncUtils.js";import s from"../core/Collection.js";import o from"../core/CollectionFlattener.js";import n from"../core/Error.js";import l from"../core/Evented.js";import{HandleOwnerMixin as p}from"../core/HandleOwner.js";import{makeHandle as h}from"../core/handleUtils.js";import d from"../core/Loadable.js";import y from"../core/Logger.js";import{destroyMaybe as c,abortMaybe as u}from"../core/maybe.js";import{EsriPromiseMixin as m}from"../core/Promise.js";import{after as f}from"../core/promiseUtils.js";import{watch as g,whenOnce as w,when as v,sync as V}from"../core/reactiveUtils.js";import{property as M}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as R}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as _}from"../core/support/OwningCollection.js";import S from"../geometry/Extent.js";import j from"../geometry/HeightModelInfo.js";import F from"../geometry/SpatialReference.js";import{equals as L}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as O}from"../support/AnalysesCollection.js";import{GraphicsCollection as E}from"../support/GraphicsCollection.js";import b from"../time/TimeReference.js";import{BasemapView as x}from"./BasemapView.js";import C from"./LayerViewManager.js";import I from"./Magnifier.js";import{ToolViewManager as T}from"./ToolViewManager.js";import q from"./input/Input.js";import{ViewEvents as D}from"./input/ViewEvents.js";import P from"./navigation/Navigation.js";import{DefaultsFromMap as U}from"./support/DefaultsFromMap.js";var k;let W=k=class extends(p(l.EventedMixin(m(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new o({getCollections:()=>[this.basemapView?.baseLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:A}),this.groundView=null,this.basemapView=null,this.fatalError=null,this.graphics=new E,this.analyses=new O,this.typeSpecificPreconditionsReady=!0,this.layerViews=new s,this.magnifier=new I,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.timeReference=new b,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new q,this.navigation=new P,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new D(this),this.persistableViewModels=new s,this._isValid=!1,this._readyCycleForced=!1,this._currentSpatialReference=null,this.handles.add(g((()=>this.preconditionsReady),(e=>{e?(this._currentSpatialReference=this.spatialReference,k.views.add(this)):(this._currentSpatialReference=null,k.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready?(this.toolViewManager?.detach(),null!=this.analysisViewManager&&this.analysisViewManager.detach(),this.layerViewManager?.clear(),this._teardown()):e&&!this.ready&&(this._startup(),null!=this.analysisViewManager&&this.analysisViewManager.attach(),this.toolViewManager.attach())}),V))}initialize(){this.addResolvingPromise(this.validate().then((()=>(this._isValid=!0,w((()=>this.ready)))))),this.basemapView=new x({view:this}),this.layerViewManager=new C({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new T({view:this}),this._setupSpatialReferenceLogger(),this.handles.add([g((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),{sync:!0,initial:!0}),g((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),{sync:!0}),g((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let e=null;this.handles.add([g((()=>this.defaultsFromMap?.ready),(t=>{const i=this.map?.allLayers.length>0;if(t&&!this.spatialReference&&i){if(null!=e)return;const t=h((()=>e=u(e)));e=a((async t=>{try{await f(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}y.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),this.handles.add(t,"spatial-reference-logger-task")}else this.handles.remove("spatial-reference-logger-task")}),{sync:!0})])}destroy(){this.destroyed||(k.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=c(this.graphics),this.analyses=c(this.analyses),this.handles.remove("defaultsFromMap"),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),c(this.analysisViewManager),this.toolViewManager=c(this.toolViewManager),this.layerViewManager=c(this.layerViewManager),this.basemapView=c(this.basemapView),this.groundView?.destroy(),this.layerViews?.forEach((e=>e.destroy())),this.layerViews.length=0,this.invalidate(),this._emitter.clear(),this.handles.removeAll(),this.map=c(this.map))}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return y.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new U({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:e=>this.getSpatialReferenceSupport(e),...this._defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||d.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._currentSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(y.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),d.isLoadable(e)&&e.load().catch((()=>{})),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._currentSpatialReference=null),this._set("map",e))}get spatialReference(){let e=this._userSpatialReference||this._currentSpatialReference||this.getDefaultSpatialReference()||null;return e&&this.defaultsFromMap?.required?.heightModelInfo&&(e=e.clone(),e.vcsWkid=this.defaultsFromMap.vcsWkid,e.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),e}set spatialReference(e){const t=!L(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){const e=this.toolViewManager?this.toolViewManager.cursor:null;return null!=e?e:this._cursor||"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}importLayerView(e){throw new n("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport({spatialReference:e})}when(e,t){return this.isResolved()&&!this.ready&&y.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(v((()=>this.destroyed||!1===this.preconditionsReady),(()=>this._readyCycleForced=!1),{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};W.views=new s,e([M()],W.prototype,"_userSpatialReference",void 0),e([M()],W.prototype,"activeTool",null),e([M({readOnly:!0})],W.prototype,"allLayerViews",void 0),e([M()],W.prototype,"groundView",void 0),e([M()],W.prototype,"animation",null),e([M()],W.prototype,"basemapView",void 0),e([M()],W.prototype,"center",null),e([M({readOnly:!0})],W.prototype,"_defaultsFromMapSettings",null),e([M()],W.prototype,"defaultsFromMap",null),e([M()],W.prototype,"fatalError",void 0),e([M({type:S})],W.prototype,"extent",null),e([M(_(E,"graphics"))],W.prototype,"graphics",void 0),e([M(_(O,"analyses"))],W.prototype,"analyses",void 0),e([M({readOnly:!0,type:j})],W.prototype,"heightModelInfo",null),e([M({readOnly:!0})],W.prototype,"interacting",null),e([M({readOnly:!0})],W.prototype,"navigating",null),e([M({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_currentSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],W.prototype,"preconditionsReady",null),e([M({readOnly:!0})],W.prototype,"typeSpecificPreconditionsReady",void 0),e([M({type:s,readOnly:!0})],W.prototype,"layerViews",void 0),e([M()],W.prototype,"resolution",null),e([M({type:I})],W.prototype,"magnifier",void 0),e([M({value:null,type:t})],W.prototype,"map",null),e([M()],W.prototype,"padding",void 0),e([M({readOnly:!0})],W.prototype,"ready",void 0),e([M({type:F})],W.prototype,"spatialReference",null),e([M()],W.prototype,"spatialReferenceWarningDelay",void 0),e([M()],W.prototype,"stationary",null),e([M({readOnly:!0})],W.prototype,"supportsGround",void 0),e([M({type:i})],W.prototype,"timeExtent",void 0),e([M({type:b,nonNullable:!0})],W.prototype,"timeReference",void 0),e([M()],W.prototype,"tools",null),e([M()],W.prototype,"toolViewManager",void 0),e([M({readOnly:!0})],W.prototype,"type",void 0),e([M({type:Number})],W.prototype,"scale",void 0),e([M({readOnly:!0})],W.prototype,"updating",void 0),e([M({readOnly:!0})],W.prototype,"initialExtentRequired",void 0),e([M({readOnly:!0})],W.prototype,"initialExtent",null),e([M()],W.prototype,"cursor",null),e([M({readOnly:!0})],W.prototype,"input",void 0),e([M({type:P,nonNullable:!0})],W.prototype,"navigation",void 0),e([M()],W.prototype,"layerViewManager",void 0),e([M()],W.prototype,"analysisViewManager",void 0),e([M()],W.prototype,"width",void 0),e([M()],W.prototype,"height",void 0),e([M({readOnly:!0})],W.prototype,"resizing",void 0),e([M({value:null,readOnly:!0})],W.prototype,"size",null),e([M({readOnly:!0})],W.prototype,"suspended",void 0),e([M({readOnly:!0})],W.prototype,"viewEvents",void 0),e([M({readOnly:!0})],W.prototype,"persistableViewModels",void 0),e([M()],W.prototype,"_isValid",void 0),e([M()],W.prototype,"_readyCycleForced",void 0),e([M()],W.prototype,"_currentSpatialReference",void 0),W=k=e([R("esri.views.View")],W);const z=W;function A(e){return e.layerViews}export{z as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../TimeExtent.js";import r from"../core/Accessor.js";import{createTask as a}from"../core/asyncUtils.js";import s from"../core/Collection.js";import o from"../core/CollectionFlattener.js";import n from"../core/Error.js";import l from"../core/Evented.js";import{HandleOwnerMixin as p}from"../core/HandleOwner.js";import{makeHandle as h}from"../core/handleUtils.js";import d from"../core/Loadable.js";import y from"../core/Logger.js";import{destroyMaybe as c,abortMaybe as u}from"../core/maybe.js";import{EsriPromiseMixin as m}from"../core/Promise.js";import{after as f}from"../core/promiseUtils.js";import{watch as g,whenOnce as w,when as v,sync as V}from"../core/reactiveUtils.js";import{property as M}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as R}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as _}from"../core/support/OwningCollection.js";import S from"../geometry/Extent.js";import j from"../geometry/HeightModelInfo.js";import F from"../geometry/SpatialReference.js";import{equals as L}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as O}from"../support/AnalysesCollection.js";import{GraphicsCollection as E}from"../support/GraphicsCollection.js";import b from"../time/TimeReference.js";import{BasemapView as x}from"./BasemapView.js";import C from"./LayerViewManager.js";import T from"./Magnifier.js";import I from"./Theme.js";import{ToolViewManager as q}from"./ToolViewManager.js";import D from"./input/Input.js";import{ViewEvents as P}from"./input/ViewEvents.js";import U from"./navigation/Navigation.js";import{DefaultsFromMap as k}from"./support/DefaultsFromMap.js";var W;let z=W=class extends(p(l.EventedMixin(m(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new o({getCollections:()=>[this.basemapView?.baseLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:G}),this.groundView=null,this.basemapView=null,this.fatalError=null,this.graphics=new E,this.analyses=new O,this.typeSpecificPreconditionsReady=!0,this.layerViews=new s,this.magnifier=new T,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.timeReference=new b,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new D,this.navigation=new U,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new P(this),this.persistableViewModels=new s,this._isValid=!1,this._readyCycleForced=!1,this._currentSpatialReference=null,this.theme=null,this.handles.add(g((()=>this.preconditionsReady),(e=>{e?(this._currentSpatialReference=this.spatialReference,W.views.add(this)):(this._currentSpatialReference=null,W.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready?(this.toolViewManager?.detach(),null!=this.analysisViewManager&&this.analysisViewManager.detach(),this.layerViewManager?.clear(),this._teardown()):e&&!this.ready&&(this._startup(),null!=this.analysisViewManager&&this.analysisViewManager.attach(),this.toolViewManager.attach())}),V))}initialize(){this.addResolvingPromise(this.validate().then((()=>(this._isValid=!0,w((()=>this.ready)))))),this.basemapView=new x({view:this}),this.layerViewManager=new C({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new q({view:this}),this._setupSpatialReferenceLogger(),this.handles.add([g((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),{sync:!0,initial:!0}),g((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),{sync:!0}),g((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let e=null;this.handles.add([g((()=>this.defaultsFromMap?.ready),(t=>{const i=this.map?.allLayers.length>0;if(t&&!this.spatialReference&&i){if(null!=e)return;const t=h((()=>e=u(e)));e=a((async t=>{try{await f(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}y.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),this.handles.add(t,"spatial-reference-logger-task")}else this.handles.remove("spatial-reference-logger-task")}),{sync:!0})])}destroy(){this.destroyed||(W.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=c(this.graphics),this.analyses=c(this.analyses),this.handles.remove("defaultsFromMap"),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),c(this.analysisViewManager),this.toolViewManager=c(this.toolViewManager),this.layerViewManager=c(this.layerViewManager),this.basemapView=c(this.basemapView),this.groundView?.destroy(),this.layerViews?.forEach((e=>e.destroy())),this.layerViews.length=0,this.invalidate(),this._emitter.clear(),this.handles.removeAll(),this.map=c(this.map))}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return y.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new k({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:e=>this.getSpatialReferenceSupport(e),...this._defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||d.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._currentSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(y.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),d.isLoadable(e)&&e.load().catch((()=>{})),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._currentSpatialReference=null),this._set("map",e))}get spatialReference(){let e=this._userSpatialReference||this._currentSpatialReference||this.getDefaultSpatialReference()||null;return e&&this.defaultsFromMap?.required?.heightModelInfo&&(e=e.clone(),e.vcsWkid=this.defaultsFromMap.vcsWkid,e.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),e}set spatialReference(e){const t=!L(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){const e=this.toolViewManager?this.toolViewManager.cursor:null;return null!=e?e:this._cursor||"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new I}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}importLayerView(e){throw new n("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport({spatialReference:e})}when(e,t){return this.isResolved()&&!this.ready&&y.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(v((()=>this.destroyed||!1===this.preconditionsReady),(()=>this._readyCycleForced=!1),{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};z.views=new s,e([M()],z.prototype,"_userSpatialReference",void 0),e([M()],z.prototype,"activeTool",null),e([M({readOnly:!0})],z.prototype,"allLayerViews",void 0),e([M()],z.prototype,"groundView",void 0),e([M()],z.prototype,"animation",null),e([M()],z.prototype,"basemapView",void 0),e([M()],z.prototype,"center",null),e([M({readOnly:!0})],z.prototype,"_defaultsFromMapSettings",null),e([M()],z.prototype,"defaultsFromMap",null),e([M()],z.prototype,"fatalError",void 0),e([M({type:S})],z.prototype,"extent",null),e([M(_(E,"graphics"))],z.prototype,"graphics",void 0),e([M(_(O,"analyses"))],z.prototype,"analyses",void 0),e([M({readOnly:!0,type:j})],z.prototype,"heightModelInfo",null),e([M({readOnly:!0})],z.prototype,"interacting",null),e([M({readOnly:!0})],z.prototype,"navigating",null),e([M({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_currentSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],z.prototype,"preconditionsReady",null),e([M({readOnly:!0})],z.prototype,"typeSpecificPreconditionsReady",void 0),e([M({type:s,readOnly:!0})],z.prototype,"layerViews",void 0),e([M()],z.prototype,"resolution",null),e([M({type:T})],z.prototype,"magnifier",void 0),e([M({value:null,type:t})],z.prototype,"map",null),e([M()],z.prototype,"padding",void 0),e([M({readOnly:!0})],z.prototype,"ready",void 0),e([M({type:F})],z.prototype,"spatialReference",null),e([M()],z.prototype,"spatialReferenceWarningDelay",void 0),e([M()],z.prototype,"stationary",null),e([M({readOnly:!0})],z.prototype,"supportsGround",void 0),e([M({type:i})],z.prototype,"timeExtent",void 0),e([M({type:b,nonNullable:!0})],z.prototype,"timeReference",void 0),e([M()],z.prototype,"tools",null),e([M()],z.prototype,"toolViewManager",void 0),e([M({readOnly:!0})],z.prototype,"type",void 0),e([M({type:Number})],z.prototype,"scale",void 0),e([M({readOnly:!0})],z.prototype,"updating",void 0),e([M({readOnly:!0})],z.prototype,"initialExtentRequired",void 0),e([M({readOnly:!0})],z.prototype,"initialExtent",null),e([M()],z.prototype,"cursor",null),e([M({readOnly:!0})],z.prototype,"input",void 0),e([M({type:U,nonNullable:!0})],z.prototype,"navigation",void 0),e([M()],z.prototype,"layerViewManager",void 0),e([M()],z.prototype,"analysisViewManager",void 0),e([M()],z.prototype,"width",void 0),e([M()],z.prototype,"height",void 0),e([M({readOnly:!0})],z.prototype,"resizing",void 0),e([M({value:null,readOnly:!0})],z.prototype,"size",null),e([M({readOnly:!0})],z.prototype,"suspended",void 0),e([M({readOnly:!0})],z.prototype,"viewEvents",void 0),e([M({readOnly:!0})],z.prototype,"persistableViewModels",void 0),e([M()],z.prototype,"_isValid",void 0),e([M()],z.prototype,"_readyCycleForced",void 0),e([M()],z.prototype,"_currentSpatialReference",void 0),e([M({type:I})],z.prototype,"theme",void 0),e([M({readOnly:!0,type:I})],z.prototype,"effectiveTheme",null),z=W=e([R("esri.views.View")],z);const A=z;function G(e){return e.layerViews}export{A as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{getTextColor as s,getTextHaloColor as o}from"../../core/analysisThemeUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import{makeHandle as r}from"../../core/handleUtils.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import{formatLength as a}from"../../core/quantityFormatUtils.js";import{watch as l,on as p}from"../../core/reactiveUtils.js";import{createScreenPointArray as c}from"../../core/screenUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{k as m,s as u,e as f,a as b,l as g,i as _}from"../../chunks/vec2.js";import{a as x}from"../../chunks/vec2f64.js";import{G as y}from"../../chunks/vec3.js";import{isClockwise as v}from"../../geometry/support/coordsUtils.js";import{fetchMessageBundle as j}from"../../intl/messages.js";import{getGeometryEffectiveElevationMode as U}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as I}from"../../support/getDefaultUnitForView.js";import L from"../overlay/TextOverlayItem.js";import{autoDirectDistanceByElevationMode as D}from"../support/automaticLengthMeasurementUtils.js";const O=3025,S={default:15,far:25};let w=class extends t{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._messagesUnits=null,this._labelInfos=[],this._nextLabelIndex=0}initialize(){const e=i((async e=>{const t=await j("esri/core/t9n/Units");n(e),this._messagesUnits=t}));this.addHandles([l((()=>[null!=this.context&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits]),(()=>this._update())),...["vertex-add","vertex-update","vertex-remove"].map((e=>p((()=>this.context?.editGeometryOperations),e,(()=>this._update())))),r((()=>e.abort()))])}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop())}get updating(){return null==this._messagesUnits}get test(){return{labelContents:this._labelInfos.slice(0,this._nextLabelIndex).map((e=>e.label.text))}}get _edgeDistancePixels(){return S[this.edgeDistance]}_update(){this._nextLabelIndex=0;const e=this.context;if(null==e)return void this._destroyUnusedLabels();const{components:t,geometry:s,coordinateHelper:o}=e.editGeometryOperations.data;if(!s)return void this._destroyUnusedLabels();const i=t.length;for(let r=0;r<i;++r){const n=[];if(t[r].iterateVertices((e=>{n.push(o.toXYZ(e.pos))})),0===r&&null!=this.stagedVertex&&n.push(o.toXYZ(this.stagedVertex)),n.length<2)continue;const a=n[0],l=n[n.length-1];"polygon"===s.type&&n.length>2&&!y(a,l)&&n.push(a);const p=1===i&&!v(n);let c=C,h=P;this.toScreenPointArray(e,a,c);for(let t=1;t<n.length;++t){const s=n[t-1],o=n[t];this.toScreenPointArray(e,o,h),this._addLabel(e,s,c,o,h,p),[c,h]=[h,c]}}this._destroyUnusedLabels()}_addLabel(e,t,s,o,i,r){const{label:n}=this._getOrCreateLabel(e);if(!this.visible||m(s,i)<O)return void(n.visible=!1);const l=null!=e.graphicState?e.graphicState.isDraped?"on-the-ground":"absolute-height":U(e.editGeometryOperations.data.geometry,e.elevationInfo),{spatialReference:p}=e.editGeometryOperations.data,c=D(t,o,p,l),h=this._messagesUnits,d=I(e.view);n.text=null!=h&&null!=c?a(h,c,d):"",n.visible=!0;const x=i[0]-s[0],y=i[1]-s[1];r?u(V,-y,x):u(V,y,-x),f(V,V),b(V,V,this._edgeDistancePixels),g(k,s,i,.5),_(k,k,V),n.position=[k[0],k[1]],Math.abs(V[0])>Math.abs(V[1])?n.anchor=V[0]>0?"left":"right":n.anchor=-V[1]<0?"top":"bottom"}_getOrCreateLabel(e){if(this._labelInfos.length>this._nextLabelIndex)return this._labelInfos[this._nextLabelIndex++];const t=new L({anchor:"center",fontSize:10,textColor:s(),backgroundColor:o(.6)});e.view.overlay?.items.add(t);const i={label:t};return this._labelInfos.push(i),this._nextLabelIndex=this._labelInfos.length,i}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){this.context?.view.overlay?.items.remove(e),e.destroy()}};e([h()],w.prototype,"context",void 0),e([h()],w.prototype,"stagedVertex",void 0),e([h()],w.prototype,"visible",void 0),e([h()],w.prototype,"edgeDistance",void 0),e([h()],w.prototype,"updating",null),e([h()],w.prototype,"_messagesUnits",void 0),e([h()],w.prototype,"_edgeDistancePixels",null),w=e([d("esri.views.interactive")],w);const V=x(),k=x(),C=c(),P=c();export{w as SegmentLabels};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import{multiplyOpacity as o,getContrast as r}from"../../core/colorUtils.js";import{makeHandle as i}from"../../core/handleUtils.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import{formatLength as a}from"../../core/quantityFormatUtils.js";import{watch as l,on as c}from"../../core/reactiveUtils.js";import{createScreenPointArray as p}from"../../core/screenUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{k as m,s as u,e as f,a as b,l as g,i as x}from"../../chunks/vec2.js";import{a as _}from"../../chunks/vec2f64.js";import{G as y}from"../../chunks/vec3.js";import{isClockwise as v}from"../../geometry/support/coordsUtils.js";import{fetchMessageBundle as j}from"../../intl/messages.js";import{getGeometryEffectiveElevationMode as U}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as I}from"../../support/getDefaultUnitForView.js";import L from"../overlay/TextOverlayItem.js";import{autoDirectDistanceByElevationMode as D}from"../support/automaticLengthMeasurementUtils.js";const w=3025,O={default:15,far:25};let S=class extends t{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._messagesUnits=null,this._labelInfos=[],this._nextLabelIndex=0}initialize(){const e=s((async e=>{const t=await j("esri/core/t9n/Units");n(e),this._messagesUnits=t}));this.addHandles([l((()=>[null!=this.context&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits]),(()=>this._update())),...["vertex-add","vertex-update","vertex-remove"].map((e=>c((()=>this.context?.editGeometryOperations),e,(()=>this._update())))),i((()=>e.abort()))])}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop())}get updating(){return null==this._messagesUnits}get test(){return{labelContents:this._labelInfos.slice(0,this._nextLabelIndex).map((e=>e.label.text))}}get _edgeDistancePixels(){return O[this.edgeDistance]}_update(){this._nextLabelIndex=0;const e=this.context;if(null==e)return void this._destroyUnusedLabels();const{components:t,geometry:s,coordinateHelper:o}=e.editGeometryOperations.data;if(!s)return void this._destroyUnusedLabels();const r=t.length;for(let i=0;i<r;++i){const n=[];if(t[i].iterateVertices((e=>{n.push(o.toXYZ(e.pos))})),0===i&&null!=this.stagedVertex&&n.push(o.toXYZ(this.stagedVertex)),n.length<2)continue;const a=n[0],l=n[n.length-1];"polygon"===s.type&&n.length>2&&!y(a,l)&&n.push(a);const c=1===r&&!v(n);let p=k,h=P;this.toScreenPointArray(e,a,p);for(let t=1;t<n.length;++t){const s=n[t-1],o=n[t];this.toScreenPointArray(e,o,h),this._addLabel(e,s,p,o,h,c),[p,h]=[h,p]}}this._destroyUnusedLabels()}_addLabel(e,t,s,o,r,i){const{label:n}=this._getOrCreateLabel(e);if(!this.visible||m(s,r)<w)return void(n.visible=!1);const l=null!=e.graphicState?e.graphicState.isDraped?"on-the-ground":"absolute-height":U(e.editGeometryOperations.data.geometry,e.elevationInfo),{spatialReference:c}=e.editGeometryOperations.data,p=D(t,o,c,l),h=this._messagesUnits,d=I(e.view);n.text=null!=h&&null!=p?a(h,p,d):"",n.visible=!0;const _=r[0]-s[0],y=r[1]-s[1];i?u(C,-y,_):u(C,y,-_),f(C,C),b(C,C,this._edgeDistancePixels),g(V,s,r,.5),x(V,V,C),n.position=[V[0],V[1]],Math.abs(C[0])>Math.abs(C[1])?n.anchor=C[0]>0?"left":"right":n.anchor=-C[1]<0?"top":"bottom"}_getOrCreateLabel(e){if(this._labelInfos.length>this._nextLabelIndex)return this._labelInfos[this._nextLabelIndex++];const{textColor:t}=e.view.effectiveTheme,s=o(r(t),.6),i=new L({anchor:"center",fontSize:10,textColor:t,backgroundColor:s});e.view.overlay?.items.add(i);const n={label:i};return this._labelInfos.push(n),this._nextLabelIndex=this._labelInfos.length,n}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){this.context?.view.overlay?.items.remove(e),e.destroy()}};e([h()],S.prototype,"context",void 0),e([h()],S.prototype,"stagedVertex",void 0),e([h()],S.prototype,"visible",void 0),e([h()],S.prototype,"edgeDistance",void 0),e([h()],S.prototype,"updating",null),e([h()],S.prototype,"_messagesUnits",void 0),e([h()],S.prototype,"_edgeDistancePixels",null),S=e([d("esri.views.interactive")],S);const C=_(),V=_(),k=p(),P=p();export{S as SegmentLabels};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import n from"../../Color.js";import{toLAB as t,toRGB as r,toHSV as o}from"../../core/colorUtils.js";import{b as a}from"../../chunks/vec4f64.js";async function e(t){await t.whenReady();const r=t.basemapView?.baseLayerViews.map((n=>n.layer)).toArray()??[];if(!r.length){const r=getComputedStyle(t.container).backgroundColor,o=r?new n(r):void 0;return("background"in t?t.background?.color:void 0)||(0!==o?.a?o:null)||null}const o=(await t.takeScreenshot({format:"png",layers:r})).data.data,a=o.length;let e=0,u=0,c=0,l=0,s=0,i=0;for(let n=0;n<a;n+=4){const t=o[n],r=o[n+1],a=o[n+2],f=o[n+3],h=f/255;e+=t*t*h,u+=r*r*h,c+=a*a*h,s+=h,f&&(l+=f,i++)}e=Math.round(Math.sqrt(e/s)),u=Math.round(Math.sqrt(u/s)),c=Math.round(Math.sqrt(c/s));return new n([e,u,c,l/i/255])}async function u(n){if(!n)return null;const t=await e(n);return null!=t?c(t):null}function c(n){return l(n).isBright?"light":"dark"}function l(t){let{r,g:o,b:a,a:e}=t;return e<1&&(r=Math.round(e*r+255*(1-e)),o=Math.round(e*o+255*(1-e)),a=Math.round(e*a+255*(1-e))),new n({r,g:o,b:a})}function s(n,t){const{r,g:o,b:a}=t?.ignoreAlpha?n:l(n);return.2126*r+.7152*o+.0722*a}function i(n,o){const a=t(n);a.l*=1-o;const e=r(a),u=n.clone();return u.setColor(e),u.a=n.a,u}function f(n,t){const r=n.clone();return r.a*=t,r}function h(n,t){const a=o(n);a.s*=t;const e=r(a),u=n.clone();return u.setColor(e),u.a=n.a,u}function d(t){return a(n.toUnitRGBA(t))}export{i as darken,h as desaturate,e as getBackgroundColor,u as getBackgroundColorTheme,s as getColorLuminance,c as getColorTheme,f as multiplyOpacity,d as unitRGBAFromColor};
5
+ import t from"../../Color.js";import{getColorTheme as n}from"../../core/colorUtils.js";async function r(n){await n.whenReady();const r=n.basemapView?.baseLayerViews.map((t=>t.layer)).toArray()??[];if(!r.length){const r=getComputedStyle(n.container).backgroundColor,o=r?new t(r):void 0;return("background"in n?n.background?.color:void 0)||(0!==o?.a?o:null)||null}const o=(await n.takeScreenshot({format:"png",layers:r})).data.data,a=o.length;let e=0,l=0,s=0,u=0,c=0,i=0;for(let t=0;t<a;t+=4){const n=o[t],r=o[t+1],a=o[t+2],d=o[t+3],h=d/255;e+=n*n*h,l+=r*r*h,s+=a*a*h,c+=h,d&&(u+=d,i++)}e=Math.round(Math.sqrt(e/c)),l=Math.round(Math.sqrt(l/c)),s=Math.round(Math.sqrt(s/c));return new t([e,l,s,u/i/255])}async function o(t){if(!t)return null;const o=await r(t);return null!=o?n(o):null}export{r as getBackgroundColor,o as getBackgroundColorTheme};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../core/Error.js";import"../../core/has.js";import{isPowerOfTwo as e}from"../../core/mathUtils.js";import{checkWebGLError as i}from"./checkWebGLError.js";import{ContextType as r}from"./contextUtils.js";import{ResourceType as s,TextureType as o,TextureSamplingMode as a,PixelFormat as n,PixelType as h,SizedPixelFormat as p,TextureWrapMode as l,CompressedTextureFormat as d}from"./enums.js";import{GLObjectType as c}from"./GLObjectType.js";import{estimateMemory as _}from"./TextureDescriptor.js";import{ValidatedTextureDescriptor as m}from"./ValidatedTextureDescriptor.js";const u=4;let T=class{constructor(e,i=null,a=null){if(this.type=c.Texture,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,a=i;else{const r=m.validate(e,i);if(!r)throw new t("Texture descriptor invalid");this._descriptor=r}if(this._descriptor.context.instanceCounter.increment(s.Texture,this),this._descriptor.context.type!==r.WEBGL2&&(this._descriptor.isImmutable&&(this._descriptor.isImmutable=!1),R(this._descriptor.target)))throw new t("3D and array textures are not supported in WebGL1");this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(a):this.setData(a)}get glName(){return this._glName}get descriptor(){return this._descriptor}get gpuMemoryUsage(){return P.delete(this),_(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}dispose(){this._descriptor.context.gl&&this._glName&&(this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor.context.instanceCounter.decrement(s.Texture,this))}release(){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new t("Immutable textures can't be resized!");r.width=e,r.height=i,this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null)}}_setDataCubeMap(t=null){for(let e=o.TEXTURE_CUBE_MAP_POSITIVE_X;e<=o.TEXTURE_CUBE_MAP_NEGATIVE_Z;e++)this._setData(t,e)}setData(t){this._setData(t)}_setData(e,r){if(!this._descriptor.context||!this._descriptor.context.gl)return;const s=this._descriptor.context.gl;i(s),this._glName||(this._glName=s.createTexture()),void 0===e&&(e=null);const o=this._descriptor,a=r??o.target,n=R(a);null===e&&(o.width=o.width||u,o.height=o.height||u,n&&(o.depth=o.depth??1));const h=this._descriptor.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(T.TEXTURE_UNIT_FOR_UPDATES),g(this._descriptor.context,o),this._configurePixelStorage(),i(s);const p=this._deriveInternalFormat();if(D(e)){let t="width"in e?e.width:e.codedWidth,r="height"in e?e.height:e.codedHeight;const h=1;e instanceof HTMLVideoElement&&(t=e.videoWidth,r=e.videoHeight),o.width&&o.height,n&&o.depth,o.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(a,p,o.hasMipmap,t,r,h),this._texImage(a,0,p,t,r,h,e),i(s),o.hasMipmap&&this.generateMipmap(),o.width||(o.width=t),o.height||(o.height=r),n&&!o.depth&&(o.depth=h)}else{const{width:r,height:h,depth:l}=o;if(null==r||null==h)throw new t("Width and height must be specified!");if(n&&null==l)throw new t("Depth must be specified!");if(o.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(a,p,o.hasMipmap,r,h,l),A(e)){const i=e.levels,n=b(a,r,h,l),d=Math.min(n-1,i.length-1);null!=this._descriptor.context.gl2?s.texParameteri(o.target,this._descriptor.context.gl2.TEXTURE_MAX_LEVEL,d):o.hasMipmap=o.hasMipmap&&n===i.length;const c=p;if(!w(c))throw new t("Attempting to use compressed data with an uncompressed format!");this._forEachMipmapLevel(((t,e,r,s)=>{const o=i[Math.min(t,i.length-1)];this._compressedTexImage(a,t,c,e,r,s,o)}),d)}else this._texImage(a,0,p,r,h,l,e),i(s),o.hasMipmap&&this.generateMipmap()}x(s,this._descriptor),E(s,this._descriptor),f(this._descriptor.context,this._descriptor),i(s),this._descriptor.context.bindTexture(h,T.TEXTURE_UNIT_FOR_UPDATES)}updateData(e,i,r,s,o,a,n=0){a||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const h=this._descriptor.context.gl,p=this._descriptor.context.gl2,l=this._descriptor,d=this._deriveInternalFormat(),{pixelFormat:c,dataType:_,target:m,isImmutable:u}=l;if(u&&!this._wasImmutablyAllocated)throw new t("Cannot update immutable texture before allocation!");const g=this._descriptor.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES,!0);if((i<0||r<0||s>l.width||o>l.height||i+s>l.width||r+o>l.height)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),n){if(!p)return void console.error("Webgl2 must be enabled to use dataRowOffset!");h.pixelStorei(p.UNPACK_SKIP_ROWS,n)}if(D(a)?p?p.texSubImage2D(m,e,i,r,s,o,c,_,a):h.texSubImage2D(m,e,i,r,c,_,a):A(a)?h.compressedTexSubImage2D(m,e,i,r,s,o,d,a.levels[e]):h.texSubImage2D(m,e,i,r,s,o,c,_,a),n){if(!p)return void console.error("Webgl2 must be enabled to use dataRowOffset!");h.pixelStorei(p.UNPACK_SKIP_ROWS,0)}this._descriptor.context.bindTexture(g,T.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,i,r,s,o,a,n,h){h||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const p=this._descriptor.context.gl2;if(null==p)throw new t("3D textures are not supported in WebGL1");const l=this._descriptor,d=this._deriveInternalFormat(),{pixelFormat:c,dataType:_,isImmutable:m,target:u}=l;if(m&&!this._wasImmutablyAllocated)throw new t("Cannot update immutable texture before allocation!");R(u)||console.warn("Attempting to set 3D texture data on a non-3D texture");const g=this._descriptor.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES);if(this._descriptor.context.setActiveTexture(T.TEXTURE_UNIT_FOR_UPDATES),(i<0||r<0||s<0||o>l.width||a>l.height||n>l.depth||i+o>l.width||r+a>l.height||s+n>l.depth)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),A(h))h=h.levels[e],p.compressedTexSubImage3D(u,e,i,r,s,o,a,n,d,h);else{const t=h;p.texSubImage3D(u,e,i,r,s,o,a,n,c,_,t)}this._descriptor.context.bindTexture(g,T.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,g(this._descriptor.context,e)}e.samplingMode===a.LINEAR?(this._samplingModeDirty=!0,e.samplingMode=a.LINEAR_MIPMAP_NEAREST):e.samplingMode===a.NEAREST&&(this._samplingModeDirty=!0,e.samplingMode=a.NEAREST_MIPMAP_NEAREST);const i=this._descriptor.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(T.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(i,T.TEXTURE_UNIT_FOR_UPDATES)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,g(this._descriptor.context,this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const t=this._descriptor.context.gl,e=this._descriptor;this._samplingModeDirty&&(x(t,e),this._samplingModeDirty=!1),this._wrapModeDirty&&(E(t,e),this._wrapModeDirty=!1)}_deriveInternalFormat(){if(this._descriptor.context.type===r.WEBGL1)return this._descriptor.internalFormat=this._descriptor.pixelFormat;if(null!=this._descriptor.internalFormat)return this._descriptor.internalFormat===n.DEPTH_STENCIL&&(this._descriptor.internalFormat=n.DEPTH24_STENCIL8),this._descriptor.internalFormat;switch(this._descriptor.dataType){case h.FLOAT:switch(this._descriptor.pixelFormat){case n.RGBA:return this._descriptor.internalFormat=p.RGBA32F;case n.RGB:return this._descriptor.internalFormat=p.RGB32F;default:throw new t("Unable to derive format")}case h.UNSIGNED_BYTE:switch(this._descriptor.pixelFormat){case n.RGBA:return this._descriptor.internalFormat=p.RGBA8;case n.RGB:return this._descriptor.internalFormat=p.RGB8}}return this._descriptor.internalFormat=this._descriptor.pixelFormat===n.DEPTH_STENCIL?n.DEPTH24_STENCIL8:this._descriptor.pixelFormat}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_texStorage(e,i,r,s,o,a){const n=this._descriptor.context.gl2;if(null==n)throw new t("Immutable textures are not supported in WebGL1");if(!M(i))throw new t("Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const h=r?b(e,s,o,a):1;if(R(e)){if(null==a)throw new t("Missing depth dimension for 3D texture upload");n.texStorage3D(e,h,i,s,o,a)}else n.texStorage2D(e,h,i,s,o);this._wasImmutablyAllocated=!0}_texImage(e,i,s,o,a,n,h){const p=this._descriptor.context.gl,l=R(e),{isImmutable:d,pixelFormat:c,dataType:_}=this._descriptor,m=this._descriptor.context.type===r.WEBGL2,u=m?p:null;if(m||!D(h))if(d){if(null!=h){const r=h;if(l){if(null==n)throw new t("Missing depth dimension for 3D texture upload");u.texSubImage3D(e,i,0,0,0,o,a,n,c,_,r)}else p.texSubImage2D(e,i,0,0,o,a,c,_,r)}}else{const r=h;if(l){if(null==n)throw new t("Missing depth dimension for 3D texture upload");u.texImage3D(e,i,s,o,a,n,0,c,_,r)}else p.texImage2D(e,i,s,o,a,0,c,_,r)}else p.texImage2D(e,0,s,c,_,h)}_compressedTexImage(e,i,s,o,a,n,h){const p=this._descriptor.context.gl;let l=null;const d=R(e),c=this._descriptor.isImmutable;if(d){if(this._descriptor.context.type!==r.WEBGL2)throw new t("3D textures are not supported in WebGL1");l=p}if(c){if(null!=h)if(d){if(null==n)throw new t("Missing depth dimension for 3D texture upload");l.compressedTexSubImage3D(e,i,0,0,0,o,a,n,s,h)}else p.compressedTexSubImage2D(e,i,0,0,o,a,s,h)}else if(d){if(null==n)throw new t("Missing depth dimension for 3D texture upload");l.compressedTexImage3D(e,i,s,o,a,n,0,h)}else p.compressedTexImage2D(e,i,s,o,a,0,h)}_forEachMipmapLevel(e,i=1/0){let{width:r,height:s,depth:a,hasMipmap:n,target:h}=this._descriptor;const p=h===o.TEXTURE_3D;if(null==r||null==s||p&&null==a)throw new t("Missing texture dimensions for mipmap calculation");for(let t=0;e(t,r,s,a),n&&(1!==r||1!==s||p&&1!==a)&&!(t>=i);++t)r=Math.max(1,r>>1),s=Math.max(1,s>>1),p&&(a=Math.max(1,a>>1))}};function g(t,i){(null!=i.width&&i.width<0||null!=i.height&&i.height<0||null!=i.depth&&i.depth<0)&&console.error("Negative dimension parameters are not allowed!");const s=t.type===r.WEBGL2;if(s||!i.isImmutable&&!R(i.target)||console.error("Immutable and 3D-like textures are not supported in WebGL1!"),s)return;null!=i.width&&e(i.width)&&null!=i.height&&e(i.height)||("number"==typeof i.wrapMode?i.wrapMode!==l.CLAMP_TO_EDGE&&console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"):i.wrapMode.s===l.CLAMP_TO_EDGE&&i.wrapMode.t===l.CLAMP_TO_EDGE||console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"),i.hasMipmap&&console.error("Mipmapping requires power-of-two textures!"))}function x(t,e){let i=e.samplingMode,r=e.samplingMode;i===a.LINEAR_MIPMAP_NEAREST||i===a.LINEAR_MIPMAP_LINEAR?(i=a.LINEAR,e.hasMipmap||(r=a.LINEAR)):i!==a.NEAREST_MIPMAP_NEAREST&&i!==a.NEAREST_MIPMAP_LINEAR||(i=a.NEAREST,e.hasMipmap||(r=a.NEAREST)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,i),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}function E(t,e){"number"==typeof e.wrapMode?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}function f(t,e){const i=t.capabilities.textureFilterAnisotropic;if(!i)return;t.gl.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}function M(t){return t in p}function w(t){return t in d}function A(t){return null!=t&&"type"in t&&"compressed"===t.type}function I(t){return null!=t&&"byteLength"in t}function D(t){return null!=t&&!A(t)&&!I(t)}function R(t){return t===o.TEXTURE_3D||t===o.TEXTURE_2D_ARRAY}function b(t,e,i,r=1){let s=Math.max(e,i);return t===o.TEXTURE_3D&&(s=Math.max(s,r)),Math.round(Math.log(s)/Math.LN2)+1}function U(){const t=new Array;return P.forEach(((e,i)=>t.push([i.gpuMemoryUsage,e]))),P.clear(),t.sort(((t,e)=>e[0]-t[0])),t.reduce(((t,e)=>`${t}\n\n${Math.round(e[0]/1024)}KB: ${e[1]}`),`Total: ${Math.round(t.reduce(((t,e)=>t+e[0]),0)/1024)}KB`)}T.TEXTURE_UNIT_FOR_UPDATES=0;const P=new Map;export{T as Texture,U as clearUnestimatedTextures};
5
+ import t from"../../core/Error.js";import"../../core/has.js";import{isPowerOfTwo as e}from"../../core/mathUtils.js";import{checkWebGLError as i}from"./checkWebGLError.js";import{ContextType as r}from"./contextUtils.js";import{ResourceType as s,TextureType as o,TextureSamplingMode as a,PixelFormat as n,PixelType as h,SizedPixelFormat as p,TextureWrapMode as l,CompressedTextureFormat as d}from"./enums.js";import{GLObjectType as c}from"./GLObjectType.js";import{estimateMemory as _}from"./TextureDescriptor.js";import{ValidatedTextureDescriptor as m}from"./ValidatedTextureDescriptor.js";const u=4;let T=class{constructor(e,i=null,a=null){if(this.type=c.Texture,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,a=i;else{const r=m.validate(e,i);if(!r)throw new t("Texture descriptor invalid");this._descriptor=r}if(this._descriptor.context.instanceCounter.increment(s.Texture,this),this._descriptor.context.type!==r.WEBGL2&&(this._descriptor.isImmutable&&(this._descriptor.isImmutable=!1),R(this._descriptor.target)))throw new t("3D and array textures are not supported in WebGL1");this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(a):this.setData(a)}get glName(){return this._glName}get descriptor(){return this._descriptor}get gpuMemoryUsage(){return P.delete(this),_(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}dispose(){this._descriptor.context.gl&&this._glName&&(this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor.context.instanceCounter.decrement(s.Texture,this))}release(){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new t("Immutable textures can't be resized!");r.width=e,r.height=i,this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null)}}_setDataCubeMap(t=null){for(let e=o.TEXTURE_CUBE_MAP_POSITIVE_X;e<=o.TEXTURE_CUBE_MAP_NEGATIVE_Z;e++)this._setData(t,e)}setData(t){this._setData(t)}_setData(e,r){if(!this._descriptor.context||!this._descriptor.context.gl)return;const s=this._descriptor.context.gl;i(s),this._glName||(this._glName=s.createTexture()),void 0===e&&(e=null);const o=this._descriptor,a=r??o.target,n=R(a);null===e&&(o.width=o.width||u,o.height=o.height||u,n&&(o.depth=o.depth??1));const h=this._descriptor.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(T.TEXTURE_UNIT_FOR_UPDATES),g(this._descriptor.context,o),this._configurePixelStorage(),i(s);const p=this._deriveInternalFormat();if(D(e)){let t="width"in e?e.width:e.codedWidth,r="height"in e?e.height:e.codedHeight;const h=1;e instanceof HTMLVideoElement&&(t=e.videoWidth,r=e.videoHeight),o.width&&o.height,n&&o.depth,o.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(a,p,o.hasMipmap,t,r,h),this._texImage(a,0,p,t,r,h,e),i(s),o.hasMipmap&&this.generateMipmap(),o.width||(o.width=t),o.height||(o.height=r),n&&!o.depth&&(o.depth=h)}else{const{width:r,height:h,depth:l}=o;if(null==r||null==h)throw new t("Width and height must be specified!");if(n&&null==l)throw new t("Depth must be specified!");if(o.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(a,p,o.hasMipmap,r,h,l),A(e)){const i=e.levels,n=b(a,r,h,l),d=Math.min(n-1,i.length-1);null!=this._descriptor.context.gl2?s.texParameteri(o.target,this._descriptor.context.gl2.TEXTURE_MAX_LEVEL,d):o.hasMipmap=o.hasMipmap&&n===i.length;const c=p;if(!w(c))throw new t("Attempting to use compressed data with an uncompressed format!");this._forEachMipmapLevel(((t,e,r,s)=>{const o=i[Math.min(t,i.length-1)];this._compressedTexImage(a,t,c,e,r,s,o)}),d)}else this._texImage(a,0,p,r,h,l,e),i(s),o.hasMipmap&&this.generateMipmap()}x(s,this._descriptor),E(s,this._descriptor),f(this._descriptor.context,this._descriptor),i(s),this._descriptor.context.bindTexture(h,T.TEXTURE_UNIT_FOR_UPDATES)}updateData(e,i,r,s,o,a,n=0){a||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const h=this._descriptor.context.gl,p=this._descriptor.context.gl2,l=this._descriptor,d=this._deriveInternalFormat(),{pixelFormat:c,dataType:_,target:m,isImmutable:u}=l;if(u&&!this._wasImmutablyAllocated)throw new t("Cannot update immutable texture before allocation!");const g=this._descriptor.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES,!0);if((i<0||r<0||s>l.width||o>l.height||i+s>l.width||r+o>l.height)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),n){if(!p)return void console.error("Webgl2 must be enabled to use dataRowOffset!");h.pixelStorei(p.UNPACK_SKIP_ROWS,n)}if(D(a)?p?p.texSubImage2D(m,e,i,r,s,o,c,_,a):h.texSubImage2D(m,e,i,r,c,_,a):A(a)?h.compressedTexSubImage2D(m,e,i,r,s,o,d,a.levels[e]):h.texSubImage2D(m,e,i,r,s,o,c,_,a),n){if(!p)return void console.error("Webgl2 must be enabled to use dataRowOffset!");h.pixelStorei(p.UNPACK_SKIP_ROWS,0)}this._descriptor.context.bindTexture(g,T.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,i,r,s,o,a,n,h){h||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const p=this._descriptor.context.gl2;if(null==p)throw new t("3D textures are not supported in WebGL1");const l=this._descriptor,d=this._deriveInternalFormat(),{pixelFormat:c,dataType:_,isImmutable:m,target:u}=l;if(m&&!this._wasImmutablyAllocated)throw new t("Cannot update immutable texture before allocation!");R(u)||console.warn("Attempting to set 3D texture data on a non-3D texture");const g=this._descriptor.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES);if(this._descriptor.context.setActiveTexture(T.TEXTURE_UNIT_FOR_UPDATES),(i<0||r<0||s<0||o>l.width||a>l.height||n>l.depth||i+o>l.width||r+a>l.height||s+n>l.depth)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),A(h))h=h.levels[e],p.compressedTexSubImage3D(u,e,i,r,s,o,a,n,d,h);else{const t=h;p.texSubImage3D(u,e,i,r,s,o,a,n,c,_,t)}this._descriptor.context.bindTexture(g,T.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,g(this._descriptor.context,e)}e.samplingMode===a.LINEAR?(this._samplingModeDirty=!0,e.samplingMode=a.LINEAR_MIPMAP_NEAREST):e.samplingMode===a.NEAREST&&(this._samplingModeDirty=!0,e.samplingMode=a.NEAREST_MIPMAP_NEAREST);const i=this._descriptor.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(T.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(i,T.TEXTURE_UNIT_FOR_UPDATES)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,g(this._descriptor.context,this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const t=this._descriptor.context.gl,e=this._descriptor;this._samplingModeDirty&&(x(t,e),this._samplingModeDirty=!1),this._wrapModeDirty&&(E(t,e),this._wrapModeDirty=!1)}_deriveInternalFormat(){if(this._descriptor.context.type===r.WEBGL1)return this._descriptor.internalFormat=this._descriptor.pixelFormat;if(null!=this._descriptor.internalFormat)return this._descriptor.internalFormat===n.DEPTH_STENCIL&&(this._descriptor.internalFormat=n.DEPTH24_STENCIL8),this._descriptor.internalFormat;switch(this._descriptor.dataType){case h.FLOAT:switch(this._descriptor.pixelFormat){case n.RGBA:return this._descriptor.internalFormat=p.RGBA32F;case n.RGB:return this._descriptor.internalFormat=p.RGB32F;default:throw new t("Unable to derive format")}case h.UNSIGNED_BYTE:switch(this._descriptor.pixelFormat){case n.RGBA:return this._descriptor.internalFormat=p.RGBA8;case n.RGB:return this._descriptor.internalFormat=p.RGB8}}return this._descriptor.internalFormat=this._descriptor.pixelFormat===n.DEPTH_STENCIL?n.DEPTH24_STENCIL8:this._descriptor.pixelFormat}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_texStorage(e,i,r,s,o,a){const n=this._descriptor.context.gl2;if(null==n)throw new t("Immutable textures are not supported in WebGL1");if(!M(i))throw new t("Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const h=r?b(e,s,o,a):1;if(R(e)){if(null==a)throw new t("Missing depth dimension for 3D texture upload");n.texStorage3D(e,h,i,s,o,a)}else n.texStorage2D(e,h,i,s,o);this._wasImmutablyAllocated=!0}_texImage(e,i,s,o,a,n,h){const p=this._descriptor.context.gl,l=R(e),{isImmutable:d,pixelFormat:c,dataType:_}=this._descriptor,m=this._descriptor.context.type===r.WEBGL2,u=m?p:null;if(m||!D(h))if(d){if(null!=h){const r=h;if(l){if(null==n)throw new t("Missing depth dimension for 3D texture upload");u.texSubImage3D(e,i,0,0,0,o,a,n,c,_,r)}else p.texSubImage2D(e,i,0,0,o,a,c,_,r)}}else{const r=h;if(l){if(null==n)throw new t("Missing depth dimension for 3D texture upload");u.texImage3D(e,i,s,o,a,n,0,c,_,r)}else p.texImage2D(e,i,s,o,a,0,c,_,r)}else p.texImage2D(e,0,s,c,_,h)}_compressedTexImage(e,i,s,o,a,n,h){const p=this._descriptor.context.gl;let l=null;const d=R(e),c=this._descriptor.isImmutable;if(d){if(this._descriptor.context.type!==r.WEBGL2)throw new t("3D textures are not supported in WebGL1");l=p}if(c){if(null!=h)if(d){if(null==n)throw new t("Missing depth dimension for 3D texture upload");l.compressedTexSubImage3D(e,i,0,0,0,o,a,n,s,h)}else p.compressedTexSubImage2D(e,i,0,0,o,a,s,h)}else if(d){if(null==n)throw new t("Missing depth dimension for 3D texture upload");l.compressedTexImage3D(e,i,s,o,a,n,0,h)}else p.compressedTexImage2D(e,i,s,o,a,0,h)}_forEachMipmapLevel(e,i=1/0){let{width:r,height:s,depth:a,hasMipmap:n,target:h}=this._descriptor;const p=h===o.TEXTURE_3D;if(null==r||null==s||p&&null==a)throw new t("Missing texture dimensions for mipmap calculation");for(let t=0;e(t,r,s,a),n&&(1!==r||1!==s||p&&1!==a)&&!(t>=i);++t)r=Math.max(1,r>>1),s=Math.max(1,s>>1),p&&(a=Math.max(1,a>>1))}};function g(t,i){(null!=i.width&&i.width<0||null!=i.height&&i.height<0||null!=i.depth&&i.depth<0)&&console.error("Negative dimension parameters are not allowed!");const s=t.type===r.WEBGL2;if(s||!i.isImmutable&&!R(i.target)||console.error("Immutable and 3D-like textures are not supported in WebGL1!"),s)return;null!=i.width&&e(i.width)&&null!=i.height&&e(i.height)||("number"==typeof i.wrapMode?i.wrapMode!==l.CLAMP_TO_EDGE&&console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"):i.wrapMode.s===l.CLAMP_TO_EDGE&&i.wrapMode.t===l.CLAMP_TO_EDGE||console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"),i.hasMipmap&&console.error("Mipmapping requires power-of-two textures!"))}function x(t,e){let i=e.samplingMode,r=e.samplingMode;i===a.LINEAR_MIPMAP_NEAREST||i===a.LINEAR_MIPMAP_LINEAR?(i=a.LINEAR,e.hasMipmap||(r=a.LINEAR)):i!==a.NEAREST_MIPMAP_NEAREST&&i!==a.NEAREST_MIPMAP_LINEAR||(i=a.NEAREST,e.hasMipmap||(r=a.NEAREST)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,i),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}function E(t,e){"number"==typeof e.wrapMode?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}function f(t,e){const i=t.capabilities.textureFilterAnisotropic;if(!i)return;t.gl.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}function M(t){return t in p}function w(t){return t in d}function A(t){return null!=t&&"type"in t&&"compressed"===t.type}function I(t){return null!=t&&"byteLength"in t}function D(t){return null!=t&&!A(t)&&!I(t)}function R(t){return t===o.TEXTURE_3D||t===o.TEXTURE_2D_ARRAY}function b(t,e,i,r=1){let s=Math.max(e,i);return t===o.TEXTURE_3D&&(s=Math.max(s,r)),Math.round(Math.log(s)/Math.LN2)+1}function U(){if(0===P.size)return;const t=new Array;return P.forEach(((e,i)=>t.push([i.gpuMemoryUsage,e]))),P.clear(),t.sort(((t,e)=>e[0]-t[0])),t.reduce(((t,e)=>`${t}\n\n${Math.round(e[0]/1024)}KB: ${e[1]}`),`Total unestimated texture memory: ${Math.round(t.reduce(((t,e)=>t+e[0]),0)/1024)}KB`)}T.TEXTURE_UNIT_FOR_UPDATES=0;const P=new Map;export{T as Texture,U as clearUnestimatedTextures};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../intl.js";import"../../symbols.js";import{getAccentColor as r,getTextColor as s,getTextHaloColor as i}from"../../core/analysisThemeUtils.js";import{destroyMaybe as o}from"../../core/maybe.js";import{watch as a,initial as n}from"../../core/reactiveUtils.js";import{formatDecimal as m,formatImperialArea as l,formatMetricArea as c,formatImperialLength as u,formatMetricLength as h}from"../../core/unitFormatUtils.js";import{convertUnit as p}from"../../core/unitUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{geodesicDensify as f,planarLength as v,simplify as _,geodesicLength as w,geodesicArea as g,planarArea as b}from"../../geometry/geometryEngine.js";import{isLoaded as j,project as L}from"../../geometry/projection.js";import{isSupported as S,geodesicDensify as G,geodesicLengths as k,geodesicAreas as q}from"../../geometry/support/geodesicUtils.js";import A from"../../layers/GraphicsLayer.js";import{ViewingMode as x}from"../../views/ViewingMode.js";import M from"../../views/draw/Draw.js";import{createManipulatorDragEventPipeline as T,screenToMap as D,dragGraphic as R}from"../../views/interactive/dragEventPipeline.js";import{GraphicManipulator as U}from"../../views/interactive/GraphicManipulator.js";import{InteractiveToolBase as W}from"../../views/interactive/InteractiveToolBase.js";import{fetchMessageBundle as z}from"../../intl/messages.js";import{onLocaleChange as E}from"../../intl/locale.js";import O from"../../geometry/Point.js";import P from"../../symbols/SimpleFillSymbol.js";import V from"../../symbols/SimpleLineSymbol.js";import F from"../../symbols/TextSymbol.js";import H from"../../symbols/Font.js";import C from"../../symbols/SimpleMarkerSymbol.js";import B from"../../geometry/Polyline.js";import I from"../../geometry/SpatialReference.js";import N from"../../geometry/Polygon.js";const J=1e5;let K=class extends W{constructor(e){super(e),this._drawActive=!1,this._measurementLayer=new A({internal:!0,listMode:"hide",visible:!1}),this._manipulatorLayer=new A({internal:!0,listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){z("esri/core/t9n/Units").then((e=>{this.messages=e})),this.addHandles(E((async()=>{this.messages=await z("esri/core/t9n/Units")})));const e=this.view;this._draw=new M({view:e}),e.map.addMany([this._measurementLayer,this._manipulatorLayer]),e.focus(),this.addHandles(a((()=>[this.unit,this.geodesicDistanceThreshold,this.messages]),(()=>{this._updateGraphics()}),n))}destroy(){const{map:e}=this.view;this._draw.view=null,this._draw=o(this._draw),e.removeMany([this._measurementLayer,this._manipulatorLayer]),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._measurementLayer=o(this._measurementLayer),this._manipulatorLayer=o(this._manipulatorLayer),this._resetVertices()}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||0!==this._vertices.length||this._startSketch()}onShow(){this._measurementLayer.visible=!0,this._manipulatorLayer.visible=!0}onHide(){this._measurementLayer.visible=!1,this._manipulatorLayer.visible=!1}reset(){this.manipulators.removeAll(),this._resetVertices(),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._draw.reset(),this._drawActive=!1}_resetVertices(){for(const{handle:e}of this._vertices)e.remove();this._vertices=[]}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],(e=>this._updateSketch(e.vertices))),e.on("draw-complete",(()=>this._stopSketch()))}_stopSketch(){if(this._vertices.length<3)return this.reset(),void this._startSketch();this.manipulators.forEach((({manipulator:e})=>{e.interactive=!0})),this._drawActive=!1,this.finishToolCreation()}_updateSketch(e){const t=this.view.spatialReference;if(t&&(!Z(t)||j())){for(;this._vertices.length>e.length;){const{handle:e,manipulator:t}=this._vertices.pop();e.remove(),this.manipulators.remove(t)}for(let r=this._vertices.length;r<e.length;r++){const[s,i]=e[r],o=Q(new O({x:s,y:i,spatialReference:t}),this.view,this._manipulatorLayer);this.manipulators.add(o);const a=T(o,((e,t)=>{t.next(D(this.view)).next(R(e.graphic,x.Local)).next((()=>{const t=e.graphic.geometry;this._vertices[r].coord=[t.x,t.y],this._updateGraphics()}))}));this._vertices.push({manipulator:o,coord:[s,i],handle:a})}if(this._vertices.length){const r=this._vertices.length-1,s=this._vertices[r],[i,o]=e[r];s.coord[0]===i&&s.coord[1]===o||(s.coord=[i,o],s.manipulator.graphic.geometry=new O({x:i,y:o,spatialReference:t}));const a=this._drawActive?this._vertices[r].manipulator:null;this.manipulators.forEach((({manipulator:e})=>{e.interactive=null==a||e!==a}))}this._updateGraphics()}}_updateGraphics(){if(this._vertices.length<2)return void this._measurementLayer.removeAll();const e=X(this._vertices.map((({coord:e})=>e)),this.view.spatialReference,this.geodesicDistanceThreshold);if(!e)return;const{measurement:o,fillGeometry:a,outlineGeometry:n}=e;this._set("measurement",o);const m=o?$(this.messages,o,this.unit):null;if(this._set("measurementLabel",m),!a&&!n)return;let l,c,u;const{graphics:h}=this._measurementLayer;3===h.length?(l=h.at(0),c=h.at(1),u=h.at(2)):(l=new t({symbol:new P({color:r(.3),outline:null})}),c=new t({symbol:new V({color:r(),width:2})}),u=new t({symbol:new F({color:s(),font:new H({size:14,family:"sans-serif"}),haloColor:i(.5),haloSize:2})}),h.removeAll(),h.addMany([l,c,u])),l.geometry=a,c.geometry=n,u.geometry=a?.centroid,u.symbol.text=m?.area??""}};function Q(e,s,i){const o=8,a={style:"circle",color:r(.5),outline:{type:"simple-line",width:0}},n=new C({...a,size:o}),m=new C({...a,size:1.5*o}),l=new t({geometry:e,symbol:n});return new U({view:s,layer:i,graphic:l,focusedSymbol:m})}function X(e,t,r){if(2===e.length){const s=new B({paths:e,spatialReference:t});let i;if(t?.isGeographic)if(S(t))i=G(s,J);else{const e=L(s,I.WGS84),r=G(e,J);i=L(r,t)}else if(t?.isWebMercator)i=f(s,J,"meters");else{if(v(s,"meters")>=r){const e=L(s,I.WGS84),r=G(e,J);i=L(r,t)}else i=s}return{measurement:null,fillGeometry:null,outlineGeometry:i}}e.push(e[0]);const s=new B({paths:[e],spatialReference:t}),i=new N({rings:[e],spatialReference:t});let o,a,n=null,m=null;if(t?.isGeographic)if(S(t)){if(n=G(s,J),m=G(i,J),m=_(m),!m)return null;o=k([s],"meters")[0],a=q([m],"square-meters")[0]}else{const e=I.WGS84,r=L(s,e),l=L(i,e);if(n=G(r,J),m=G(l,J),m=_(m),!m)return null;o=k([r],"meters")[0],a=q([m],"square-meters")[0],n=L(n,t),m=L(m,t)}else if(t?.isWebMercator){if(n=f(s,J,"meters"),m=f(i,J,"meters"),m=_(m),!m)return null;o=w(s,"meters"),a=g(m,"square-meters")}else{const e=v(s,"meters");if(e>=r){const e=I.WGS84,r=L(s,e),l=L(i,e);if(n=G(r,J),m=G(l,J),m=_(m),!m)return null;o=k([r],"meters")[0],a=q([m],"square-meters")[0],n=L(n,t),m=L(m,t)}else{if(n=s,m=_(i),!m)return null;o=e,a=b(m,"square-meters")}}return{measurement:{geometry:m,area:a,perimeter:o},fillGeometry:m,outlineGeometry:n}}function Y(e){return null!=e}function Z(e){if(!e)return!1;const{isGeographic:t,isWebMercator:r,isWGS84:s}=e;return t&&!s&&!S(e)||!t&&!r}function $(e,t,r){if(!t||!e)return null;const s={area:null,perimeter:null},{area:i,perimeter:o}=t;switch(r){case"metric":s.area=c(e,i,"square-meters");break;case"imperial":s.area=l(e,i,"square-meters");break;default:{const t=p(i,"square-meters",r);s.area=m(e,t,r);break}}const a=ee(r);if(a)switch(a){case"metric":s.perimeter=h(e,o,"meters");break;case"imperial":s.perimeter=u(e,o,"meters");break;default:{const t=p(o,"meters",a);s.perimeter=m(e,t,a);break}}else s.perimeter="";return s}function ee(e){switch(e){case"metric":case"ares":case"hectares":return"metric";case"imperial":case"acres":return"imperial";case"square-inches":return"inches";case"square-feet":return"feet";case"square-yards":return"yards";case"square-miles":return"miles";case"square-us-feet":return"us-feet";case"square-meters":return"meters";case"square-kilometers":return"kilometers";case"square-millimeters":return"millimeters";case"square-centimeters":return"centimeters";case"square-decimeters":return"decimeters";default:return null}}e([d()],K.prototype,"_drawActive",void 0),e([d({readOnly:!0})],K.prototype,"cursor",null),e([d({value:!0})],K.prototype,"editable",null),e([d({type:Number})],K.prototype,"geodesicDistanceThreshold",void 0),e([d({readOnly:!0})],K.prototype,"measurement",void 0),e([d({readOnly:!0})],K.prototype,"measurementLabel",void 0),e([d()],K.prototype,"messages",void 0),e([d()],K.prototype,"unit",void 0),e([d({constructOnly:!0})],K.prototype,"view",void 0),K=e([y("esri.widgets.AreaMeasurement2D.AreaMeasurement2DTool")],K);export{K as AreaMeasurement2DTool,X as createAreaMeasurementInfo2D,$ as createAreaMeasurementLabel,Z as isProjectionEngineRequired,Y as isSupported};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../intl.js";import"../../symbols.js";import{multiplyOpacity as r,getContrast as s}from"../../core/colorUtils.js";import{destroyMaybe as i}from"../../core/maybe.js";import{watch as o,initial as a}from"../../core/reactiveUtils.js";import{formatDecimal as n,formatImperialArea as m,formatMetricArea as l,formatImperialLength as c,formatMetricLength as u}from"../../core/unitFormatUtils.js";import{convertUnit as h}from"../../core/unitUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{geodesicDensify as f,planarLength as y,simplify as v,geodesicLength as _,geodesicArea as w,planarArea as g}from"../../geometry/geometryEngine.js";import{isLoaded as b,project as j}from"../../geometry/projection.js";import{isSupported as L,geodesicDensify as S,geodesicLengths as A,geodesicAreas as G}from"../../geometry/support/geodesicUtils.js";import k from"../../layers/GraphicsLayer.js";import{ViewingMode as q}from"../../views/ViewingMode.js";import x from"../../views/draw/Draw.js";import{createManipulatorDragEventPipeline as M,screenToMap as T,dragGraphic as C}from"../../views/interactive/dragEventPipeline.js";import{GraphicManipulator as D}from"../../views/interactive/GraphicManipulator.js";import{InteractiveToolBase as R}from"../../views/interactive/InteractiveToolBase.js";import{fetchMessageBundle as U}from"../../intl/messages.js";import{onLocaleChange as W}from"../../intl/locale.js";import z from"../../geometry/Point.js";import E from"../../symbols/SimpleFillSymbol.js";import O from"../../symbols/SimpleLineSymbol.js";import P from"../../symbols/TextSymbol.js";import V from"../../symbols/Font.js";import F from"../../symbols/SimpleMarkerSymbol.js";import H from"../../geometry/Polyline.js";import B from"../../geometry/SpatialReference.js";import I from"../../geometry/Polygon.js";const N=1e5;let J=class extends R{constructor(e){super(e),this._drawActive=!1,this._measurementLayer=new k({internal:!0,listMode:"hide",visible:!1}),this._manipulatorLayer=new k({internal:!0,listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){U("esri/core/t9n/Units").then((e=>{this.messages=e})),this.addHandles(W((async()=>{this.messages=await U("esri/core/t9n/Units")})));const e=this.view;this._draw=new x({view:e}),e.map.addMany([this._measurementLayer,this._manipulatorLayer]),e.focus(),this.addHandles([o((()=>[this.unit,this.geodesicDistanceThreshold,this.messages]),(()=>{this._updateGraphics()}),a),o((()=>[this.view.effectiveTheme.accentColor,this.view.effectiveTheme.textColor]),(()=>{if(!this._vertices.length)return;const e=this._vertices.map((({coord:e})=>e));for(const{handle:t}of this._vertices)t.remove();this._vertices=[],this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this.manipulators.removeAll(),this._updateSketch(e)}))])}destroy(){const{map:e}=this.view;this._draw.view=null,this._draw=i(this._draw),e.removeMany([this._measurementLayer,this._manipulatorLayer]),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._measurementLayer=i(this._measurementLayer),this._manipulatorLayer=i(this._manipulatorLayer),this._resetVertices()}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||0!==this._vertices.length||this._startSketch()}onShow(){this._measurementLayer.visible=!0,this._manipulatorLayer.visible=!0}onHide(){this._measurementLayer.visible=!1,this._manipulatorLayer.visible=!1}reset(){this.manipulators.removeAll(),this._resetVertices(),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._draw.reset(),this._drawActive=!1}_resetVertices(){for(const{handle:e}of this._vertices)e.remove();this._vertices=[]}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],(e=>this._updateSketch(e.vertices))),e.on("draw-complete",(()=>this._stopSketch()))}_stopSketch(){if(this._vertices.length<3)return this.reset(),void this._startSketch();this.manipulators.forEach((({manipulator:e})=>{e.interactive=!0})),this._drawActive=!1,this.finishToolCreation()}_updateSketch(e){const t=this.view.spatialReference;if(t&&(!Y(t)||b())){for(;this._vertices.length>e.length;){const{handle:e,manipulator:t}=this._vertices.pop();e.remove(),this.manipulators.remove(t)}for(let r=this._vertices.length;r<e.length;r++){const[s,i]=e[r],o=K(new z({x:s,y:i,spatialReference:t}),this.view,this._manipulatorLayer);this.manipulators.add(o);const a=M(o,((e,t)=>{t.next(T(this.view)).next(C(e.graphic,q.Local)).next((()=>{const t=e.graphic.geometry;this._vertices[r].coord=[t.x,t.y],this._updateGraphics()}))}));this._vertices.push({manipulator:o,coord:[s,i],handle:a})}if(this._vertices.length){const r=this._vertices.length-1,s=this._vertices[r],[i,o]=e[r];s.coord[0]===i&&s.coord[1]===o||(s.coord=[i,o],s.manipulator.graphic.geometry=new z({x:i,y:o,spatialReference:t}));const a=this._drawActive?this._vertices[r].manipulator:null;this.manipulators.forEach((({manipulator:e})=>{e.interactive=null==a||e!==a}))}this._updateGraphics()}}_updateGraphics(){if(this._vertices.length<2)return void this._measurementLayer.removeAll();const e=Q(this._vertices.map((({coord:e})=>e)),this.view.spatialReference,this.geodesicDistanceThreshold);if(!e)return;const{measurement:i,fillGeometry:o,outlineGeometry:a}=e;this._set("measurement",i);const n=i?Z(this.messages,i,this.unit):null;if(this._set("measurementLabel",n),!o&&!a)return;let m,l,c;const{graphics:u}=this._measurementLayer,h=3===u.length,{effectiveTheme:p}=this.view;h?(m=u.at(0),l=u.at(1),c=u.at(2)):(m=new t({symbol:new E({color:r(p.accentColor,.3),outline:null})}),l=new t({symbol:new O({color:p.accentColor,width:2})}),c=new t({symbol:new P({color:p.textColor,font:new V({size:14,family:"sans-serif"}),haloColor:r(s(p.textColor),.5),haloSize:2})}),u.removeAll(),u.addMany([m,l,c])),m.geometry=o,l.geometry=a,c.geometry=o?.centroid,c.symbol.text=n?.area??""}};function K(e,s,i){const o=8,a={style:"circle",color:r(s.effectiveTheme.accentColor,.5),outline:{type:"simple-line",width:0}},n=new F({...a,size:o}),m=new F({...a,size:1.5*o}),l=new t({geometry:e,symbol:n});return new D({view:s,layer:i,graphic:l,focusedSymbol:m})}function Q(e,t,r){if(2===e.length){const s=new H({paths:e,spatialReference:t});let i;if(t?.isGeographic)if(L(t))i=S(s,N);else{const e=j(s,B.WGS84),r=S(e,N);i=j(r,t)}else if(t?.isWebMercator)i=f(s,N,"meters");else{if(y(s,"meters")>=r){const e=j(s,B.WGS84),r=S(e,N);i=j(r,t)}else i=s}return{measurement:null,fillGeometry:null,outlineGeometry:i}}e.push(e[0]);const s=new H({paths:[e],spatialReference:t}),i=new I({rings:[e],spatialReference:t});let o,a,n=null,m=null;if(t?.isGeographic)if(L(t)){if(n=S(s,N),m=S(i,N),m=v(m),!m)return null;o=A([s],"meters")[0],a=G([m],"square-meters")[0]}else{const e=B.WGS84,r=j(s,e),l=j(i,e);if(n=S(r,N),m=S(l,N),m=v(m),!m)return null;o=A([r],"meters")[0],a=G([m],"square-meters")[0],n=j(n,t),m=j(m,t)}else if(t?.isWebMercator){if(n=f(s,N,"meters"),m=f(i,N,"meters"),m=v(m),!m)return null;o=_(s,"meters"),a=w(m,"square-meters")}else{const e=y(s,"meters");if(e>=r){const e=B.WGS84,r=j(s,e),l=j(i,e);if(n=S(r,N),m=S(l,N),m=v(m),!m)return null;o=A([r],"meters")[0],a=G([m],"square-meters")[0],n=j(n,t),m=j(m,t)}else{if(n=s,m=v(i),!m)return null;o=e,a=g(m,"square-meters")}}return{measurement:{geometry:m,area:a,perimeter:o},fillGeometry:m,outlineGeometry:n}}function X(e){return null!=e}function Y(e){if(!e)return!1;const{isGeographic:t,isWebMercator:r,isWGS84:s}=e;return t&&!s&&!L(e)||!t&&!r}function Z(e,t,r){if(!t||!e)return null;const s={area:null,perimeter:null},{area:i,perimeter:o}=t;switch(r){case"metric":s.area=l(e,i,"square-meters");break;case"imperial":s.area=m(e,i,"square-meters");break;default:{const t=h(i,"square-meters",r);s.area=n(e,t,r);break}}const a=$(r);if(a)switch(a){case"metric":s.perimeter=u(e,o,"meters");break;case"imperial":s.perimeter=c(e,o,"meters");break;default:{const t=h(o,"meters",a);s.perimeter=n(e,t,a);break}}else s.perimeter="";return s}function $(e){switch(e){case"metric":case"ares":case"hectares":return"metric";case"imperial":case"acres":return"imperial";case"square-inches":return"inches";case"square-feet":return"feet";case"square-yards":return"yards";case"square-miles":return"miles";case"square-us-feet":return"us-feet";case"square-meters":return"meters";case"square-kilometers":return"kilometers";case"square-millimeters":return"millimeters";case"square-centimeters":return"centimeters";case"square-decimeters":return"decimeters";default:return null}}e([p()],J.prototype,"_drawActive",void 0),e([p({readOnly:!0})],J.prototype,"cursor",null),e([p({value:!0})],J.prototype,"editable",null),e([p({type:Number})],J.prototype,"geodesicDistanceThreshold",void 0),e([p({readOnly:!0})],J.prototype,"measurement",void 0),e([p({readOnly:!0})],J.prototype,"measurementLabel",void 0),e([p()],J.prototype,"messages",void 0),e([p()],J.prototype,"unit",void 0),e([p({constructOnly:!0})],J.prototype,"view",void 0),J=e([d("esri.widgets.AreaMeasurement2D.AreaMeasurement2DTool")],J);export{J as AreaMeasurement2DTool,Q as createAreaMeasurementInfo2D,Z as createAreaMeasurementLabel,Y as isProjectionEngineRequired,X as isSupported};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{on as s,watch as i,initial as a}from"../core/reactiveUtils.js";import{formatFileSize as n}from"../core/unitFormatUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{cast as l}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import c from"./Attachments/AttachmentsViewModel.js";import{getIconPath as m,isSupportedImage as h}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{storeNode as p,discardNode as g,isRTL as b}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as _}from"./support/jsxFactory.js";const v={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},y="esri-attachments",w="esri-button",A={base:y,loaderContainer:`${y}__loader-container`,loader:`${y}__loader`,fadeIn:`${y}--fade-in`,container:`${y}__container`,containerList:`${y}__container--list`,containerPreview:`${y}__container--preview`,actions:`${y}__actions`,deleteButton:`${y}__delete-button`,addAttachmentButton:`${y}__add-attachment-button`,errorMessage:`${y}__error-message`,items:`${y}__items`,item:`${y}__item`,itemButton:`${y}__item-button`,itemMask:`${y}__item-mask`,itemMaskIcon:`${y}__item-mask--icon`,itemImage:`${y}__image`,itemImageResizable:`${y}__image--resizable`,itemLabel:`${y}__label`,itemFilename:`${y}__filename`,itemChevronIcon:`${y}__item-chevron-icon`,itemLink:`${y}__item-link`,itemLinkOverlay:`${y}__item-link-overlay`,itemLinkOverlayIcon:`${y}__item-link-overlay-icon`,itemEditIcon:`${y}__item-edit-icon`,itemAddIcon:`${y}__item-add-icon`,itemAddButton:`${y}__item-add-button`,formNode:`${y}__form-node`,fileFieldset:`${y}__file-fieldset`,fileLabel:`${y}__file-label`,fileName:`${y}__file-name`,fileInput:`${y}__file-input`,metadata:`${y}__metadata`,metadataFieldset:`${y}__metadata-fieldset`,progressBar:`${y}__progress-bar`,esriWidget:"esri-widget",esriButton:w,buttonDisabled:`${w}--disabled`,esriButtonSecondary:`${w}--secondary`,esriButtonTertiary:`${w}--tertiary`,esriButtonThird:`${w}--third`,esriButtonSmall:`${w}--small`,esriButtonHalf:`${w}--half`,empty:"esri-widget__content--empty",iconExternalLink:"esri-icon-link-external",iconEdit:"esri-icon-edit",iconRight:"esri-icon-right",iconLeft:"esri-icon-left",iconPlus:"esri-icon-plus"},k=window.CSS;let F=class extends d{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...v},this._supportsImageOrientation=k&&k.supports&&k.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}initialize(){this.viewModel||(this.viewModel=new c),this.addHandles([s((()=>this.viewModel?.attachmentInfos),"change",(()=>this.scheduleRender())),s((()=>this.viewModel?.fileInfos),"change",(()=>this.scheduleRender())),i((()=>this.viewModel?.mode),(()=>this._modeChanged()),a)])}loadDependencies(){return u({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...v,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(e).then((e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:add-attachment",this.messages.addErrorMessage,e)),e}))}deleteAttachment(e){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(e).then((e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e}))}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(s).then((t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:update-attachment",this.messages.updateErrorMessage,e)),e}))}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return _("div",{class:this.classes(A.base,A.esriWidget)},e?this.renderProgressBar():null,"loading"===s?this.renderLoading():this.renderAttachments(),this.renderErrorMessage())}renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?_("div",{key:"error-message",class:A.errorMessage},e.message):null}renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this.renderAddForm():"edit"===t?this.renderDetailsForm(s||e):this.renderAttachmentContainer()}renderLoading(){return _("div",{class:A.loaderContainer,key:"loader"},_("div",{class:A.loader}))}renderProgressBar(){return this.visibleElements.progressBar?_("div",{class:A.progressBar,key:"progress-bar"}):null}renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?_("button",{type:"button",bind:this,disabled:e,onclick:this._cancelForm,class:this.classes(A.esriButton,A.esriButtonTertiary,A.esriButtonSmall,A.esriButtonHalf,e&&A.buttonDisabled)},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?_("button",{type:"submit",disabled:s,class:this.classes(A.esriButton,A.esriButtonSecondary,A.esriButtonSmall,A.esriButtonHalf,{[A.buttonDisabled]:s})},this.messages.add):null,n=t?_("span",{key:"file-name",class:A.fileName},t.name):null,r=_("form",{bind:this,afterCreate:p,afterRemoved:g,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},_("fieldset",{class:A.fileFieldset},n,_("label",{class:this.classes(A.fileLabel,A.esriButton,A.esriButtonSecondary)},t?this.messages.changeFile:this.messages.selectFile,_("input",{class:A.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))),a,i);return _("div",{key:"add-form-container",class:A.formNode},r)}renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:r}=s,l=a||!i;let o,d,c,m;i?(o=i.type,d=i.name,c=i.size):e&&"file"in e?(o=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(o=e.contentType,d=e.name,c=e.size,m=e.url);const h=r.editing&&r.operations?.delete&&t.deleteButton?_("button",{key:"delete-button",type:"button",disabled:a,bind:this,onclick:t=>this._submitDeleteAttachment(t,e),class:this.classes(A.esriButton,A.esriButtonSmall,A.esriButtonTertiary,A.deleteButton,{[A.buttonDisabled]:a})},this.messages.delete):void 0,u=r.editing&&r.operations?.update&&t.updateButton?_("button",{disabled:l,key:"update-button",type:"submit",class:this.classes(A.esriButton,A.esriButtonSmall,A.esriButtonThird,{[A.buttonDisabled]:l})},this.messages.update):void 0,b=this.visibleElements.cancelUpdateButton?_("button",{disabled:a,key:"cancel-button",type:"button",bind:this,onclick:this._cancelForm,class:this.classes(A.esriButton,A.esriButtonSmall,A.esriButtonTertiary,A.esriButtonThird,{[A.buttonDisabled]:a})},this.messages.cancel):void 0,f=r.editing&&r.operations?.update?_("fieldset",{key:"file",class:A.fileFieldset},_("span",{key:"file-name",class:A.fileName},d),_("label",{class:this.classes(A.fileLabel,A.esriButton,A.esriButtonSecondary)},this.messages.changeFile,_("input",{class:A.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))):void 0,v=_("fieldset",{key:"size",class:A.metadataFieldset},_("label",null,n(this.messagesUnits,c??0))),y=_("fieldset",{key:"content-type",class:A.metadataFieldset},_("label",null,o)),w=null!=m?_("a",{class:A.itemLink,href:m,rel:"noreferrer",target:"_blank"},this.renderImageMask(e,400),_("div",{class:A.itemLinkOverlay},_("span",{class:A.itemLinkOverlayIcon},_("calcite-icon",{icon:"launch"})))):this.renderImageMask(e,400),k=_("form",{bind:this,afterCreate:p,afterRemoved:g,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},_("div",{class:A.metadata},v,y),f,_("div",{class:A.actions},h,b,u));return _("div",{key:"edit-form-container",class:A.formNode},w,k)}renderImageMask(e,t){return e?"file"in e?this.renderGenericImageMask(e.file.name,e.file.type):this.renderImageMaskForAttachment(e,t):null}renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=m(t),a={[A.itemImageResizable]:s};return _("div",{key:i,class:this.classes(A.itemMaskIcon,A.itemMask)},_("img",{title:e,alt:e,src:i,class:this.classes(a,A.itemImage)}))}renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,url:n}=e;if(!s||!h(i))return this.renderGenericImageMask(a,i);const r=this._getCSSTransform(e),l=r?{transform:r,"image-orientation":"none"}:{},o=`${n}${n?.includes("?")?"&":"?"}w=${t}`,d={[A.itemImageResizable]:s};return _("div",{key:o,class:this.classes(A.itemMask)},_("img",{styles:l,alt:a,title:a,src:o,class:this.classes(d,A.itemImage)}))}renderFile(e){const{file:t}=e;return _("li",{class:A.item,key:t},_("button",{key:"details-button",bind:this,class:A.itemButton,title:this.messages.attachmentDetails,"aria-label":this.messages.attachmentDetails,onclick:()=>this._startEditFile(e),type:"button"},this.renderImageMask(e),_("label",{class:A.itemLabel},_("span",{class:A.itemFilename},t.name||this.messages.noTitle),_("span",{"aria-hidden":"true",class:this.classes(A.itemChevronIcon,b(this.container)?A.iconLeft:A.iconRight)}))))}renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:r,name:l,url:o}=e,d=this.renderImageMask(e,"list"===t?48:400),c=a.editing?_("span",{"aria-hidden":"true",class:this.classes(A.itemChevronIcon,b(this.container)?A.iconLeft:A.iconRight)}):null,m=[d,"preview"===i&&n&&h(r)?null:_("label",{class:A.itemLabel},_("span",{class:A.itemFilename},l||this.messages.noTitle),c)],u=a.editing?_("button",{key:"details-button",bind:this,class:A.itemButton,title:this.messages.attachmentDetails,"aria-label":this.messages.attachmentDetails,"data-attachment-info-id":e.id,onclick:()=>this._startEditAttachment(e),type:"button"},m):_("a",{key:"details-link",class:A.itemButton,href:o??void 0,target:"_blank"},m);return _("li",{class:A.item,key:e},u)}renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,r=!!i?.length,l=!!n?.length,o={[A.containerList]:"preview"!==e,[A.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?_("button",{bind:this,onclick:()=>this._startAddAttachment(),class:this.classes(A.esriButton,A.esriButtonTertiary,A.addAttachmentButton),type:"button"},_("span",{"aria-hidden":"true",class:this.classes(A.itemAddIcon,A.iconPlus)}),this.messages.add):void 0,c=r?_("ul",{key:"attachments-list",class:A.items},i.toArray().map((t=>this.renderAttachmentInfo({attachmentInfo:t,displayType:e})))):void 0,m=l?_("ul",{key:"file-list",class:A.items},n.toArray().map((e=>this.renderFile(e)))):void 0,h=l||r?void 0:_("div",{class:A.empty},this.messages.noAttachments);return _("div",{key:"attachments-container",class:this.classes(A.container,o)},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t&&t.files&&t.files.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([r()],F.prototype,"capabilities",null),e([r()],F.prototype,"displayType",void 0),e([r({readOnly:!0})],F.prototype,"effectiveDisplayType",null),e([r()],F.prototype,"graphic",null),e([r()],F.prototype,"label",null),e([r(),f("esri/widgets/Attachments/t9n/Attachments")],F.prototype,"messages",void 0),e([r(),f("esri/core/t9n/Units")],F.prototype,"messagesUnits",void 0),e([r({readOnly:!0})],F.prototype,"selectedFile",void 0),e([r({readOnly:!0})],F.prototype,"submitting",void 0),e([r({readOnly:!0})],F.prototype,"error",void 0),e([r({type:c})],F.prototype,"viewModel",void 0),e([r()],F.prototype,"visibleElements",void 0),e([l("visibleElements")],F.prototype,"castVisibleElements",null),F=e([o("esri.widgets.Attachments")],F);const B=F;export{B as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{on as s,watch as i,initial as a}from"../core/reactiveUtils.js";import{formatFileSize as n}from"../core/unitFormatUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{cast as l}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import c from"./Attachments/AttachmentsViewModel.js";import{getIconPath as m,isSupportedImage as h}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{storeNode as p,discardNode as g,isRTL as b}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as _}from"./support/jsxFactory.js";const v={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},y="esri-attachments",A="esri-button",w={base:y,loaderContainer:`${y}__loader-container`,loader:`${y}__loader`,fadeIn:`${y}--fade-in`,container:`${y}__container`,containerList:`${y}__container--list`,containerPreview:`${y}__container--preview`,actions:`${y}__actions`,deleteButton:`${y}__delete-button`,addAttachmentButton:`${y}__add-attachment-button`,errorMessage:`${y}__error-message`,items:`${y}__items`,item:`${y}__item`,itemButton:`${y}__item-button`,itemMask:`${y}__item-mask`,itemMaskIcon:`${y}__item-mask--icon`,itemImage:`${y}__image`,itemImageResizable:`${y}__image--resizable`,itemLabel:`${y}__label`,itemFilename:`${y}__filename`,itemChevronIcon:`${y}__item-chevron-icon`,itemLink:`${y}__item-link`,itemLinkOverlay:`${y}__item-link-overlay`,itemLinkOverlayIcon:`${y}__item-link-overlay-icon`,itemEditIcon:`${y}__item-edit-icon`,itemAddIcon:`${y}__item-add-icon`,itemAddButton:`${y}__item-add-button`,formNode:`${y}__form-node`,fileFieldset:`${y}__file-fieldset`,fileLabel:`${y}__file-label`,fileName:`${y}__file-name`,fileInput:`${y}__file-input`,metadata:`${y}__metadata`,metadataFieldset:`${y}__metadata-fieldset`,progressBar:`${y}__progress-bar`,esriWidget:"esri-widget",esriButton:A,buttonDisabled:`${A}--disabled`,esriButtonSecondary:`${A}--secondary`,esriButtonTertiary:`${A}--tertiary`,esriButtonThird:`${A}--third`,esriButtonSmall:`${A}--small`,esriButtonHalf:`${A}--half`,empty:"esri-widget__content--empty",iconExternalLink:"esri-icon-link-external",iconEdit:"esri-icon-edit",iconRight:"esri-icon-right",iconLeft:"esri-icon-left",iconPlus:"esri-icon-plus"},k=window.CSS;let F=class extends d{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...v},this._supportsImageOrientation=k&&k.supports&&k.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e?.viewModel||(e={viewModel:new c,...e}),e}initialize(){this.addHandles([s((()=>this.viewModel?.attachmentInfos),"change",(()=>this.scheduleRender())),s((()=>this.viewModel?.fileInfos),"change",(()=>this.scheduleRender())),i((()=>this.viewModel?.mode),(()=>this._modeChanged()),a)])}loadDependencies(){return u({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...v,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(e).then((e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:add-attachment",this.messages.addErrorMessage,e)),e}))}deleteAttachment(e){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(e).then((e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e}))}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(s).then((t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:update-attachment",this.messages.updateErrorMessage,e)),e}))}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return _("div",{class:this.classes(w.base,w.esriWidget)},e?this.renderProgressBar():null,"loading"===s?this.renderLoading():this.renderAttachments(),this.renderErrorMessage())}renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?_("div",{key:"error-message",class:w.errorMessage},e.message):null}renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this.renderAddForm():"edit"===t?this.renderDetailsForm(s||e):this.renderAttachmentContainer()}renderLoading(){return _("div",{class:w.loaderContainer,key:"loader"},_("div",{class:w.loader}))}renderProgressBar(){return this.visibleElements.progressBar?_("div",{class:w.progressBar,key:"progress-bar"}):null}renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?_("button",{type:"button",bind:this,disabled:e,onclick:this._cancelForm,class:this.classes(w.esriButton,w.esriButtonTertiary,w.esriButtonSmall,w.esriButtonHalf,e&&w.buttonDisabled)},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?_("button",{type:"submit",disabled:s,class:this.classes(w.esriButton,w.esriButtonSecondary,w.esriButtonSmall,w.esriButtonHalf,{[w.buttonDisabled]:s})},this.messages.add):null,n=t?_("span",{key:"file-name",class:w.fileName},t.name):null,r=_("form",{bind:this,afterCreate:p,afterRemoved:g,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},_("fieldset",{class:w.fileFieldset},n,_("label",{class:this.classes(w.fileLabel,w.esriButton,w.esriButtonSecondary)},t?this.messages.changeFile:this.messages.selectFile,_("input",{class:w.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))),a,i);return _("div",{key:"add-form-container",class:w.formNode},r)}renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:r}=s,l=a||!i;let o,d,c,m;i?(o=i.type,d=i.name,c=i.size):e&&"file"in e?(o=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(o=e.contentType,d=e.name,c=e.size,m=e.url);const h=r.editing&&r.operations?.delete&&t.deleteButton?_("button",{key:"delete-button",type:"button",disabled:a,bind:this,onclick:t=>this._submitDeleteAttachment(t,e),class:this.classes(w.esriButton,w.esriButtonSmall,w.esriButtonTertiary,w.deleteButton,{[w.buttonDisabled]:a})},this.messages.delete):void 0,u=r.editing&&r.operations?.update&&t.updateButton?_("button",{disabled:l,key:"update-button",type:"submit",class:this.classes(w.esriButton,w.esriButtonSmall,w.esriButtonThird,{[w.buttonDisabled]:l})},this.messages.update):void 0,b=this.visibleElements.cancelUpdateButton?_("button",{disabled:a,key:"cancel-button",type:"button",bind:this,onclick:this._cancelForm,class:this.classes(w.esriButton,w.esriButtonSmall,w.esriButtonTertiary,w.esriButtonThird,{[w.buttonDisabled]:a})},this.messages.cancel):void 0,f=r.editing&&r.operations?.update?_("fieldset",{key:"file",class:w.fileFieldset},_("span",{key:"file-name",class:w.fileName},d),_("label",{class:this.classes(w.fileLabel,w.esriButton,w.esriButtonSecondary)},this.messages.changeFile,_("input",{class:w.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))):void 0,v=_("fieldset",{key:"size",class:w.metadataFieldset},_("label",null,n(this.messagesUnits,c??0))),y=_("fieldset",{key:"content-type",class:w.metadataFieldset},_("label",null,o)),A=null!=m?_("a",{class:w.itemLink,href:m,rel:"noreferrer",target:"_blank"},this.renderImageMask(e,400),_("div",{class:w.itemLinkOverlay},_("span",{class:w.itemLinkOverlayIcon},_("calcite-icon",{icon:"launch"})))):this.renderImageMask(e,400),k=_("form",{bind:this,afterCreate:p,afterRemoved:g,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},_("div",{class:w.metadata},v,y),f,_("div",{class:w.actions},h,b,u));return _("div",{key:"edit-form-container",class:w.formNode},A,k)}renderImageMask(e,t){return e?"file"in e?this.renderGenericImageMask(e.file.name,e.file.type):this.renderImageMaskForAttachment(e,t):null}renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=m(t),a={[w.itemImageResizable]:s};return _("div",{key:i,class:this.classes(w.itemMaskIcon,w.itemMask)},_("img",{title:e,alt:e,src:i,class:this.classes(a,w.itemImage)}))}renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,url:n}=e;if(!s||!h(i))return this.renderGenericImageMask(a,i);const r=this._getCSSTransform(e),l=r?{transform:r,"image-orientation":"none"}:{},o=`${n}${n?.includes("?")?"&":"?"}w=${t}`,d={[w.itemImageResizable]:s};return _("div",{key:o,class:this.classes(w.itemMask)},_("img",{styles:l,alt:a,title:a,src:o,class:this.classes(d,w.itemImage)}))}renderFile(e){const{file:t}=e;return _("li",{class:w.item,key:t},_("button",{key:"details-button",bind:this,class:w.itemButton,title:this.messages.attachmentDetails,"aria-label":this.messages.attachmentDetails,onclick:()=>this._startEditFile(e),type:"button"},this.renderImageMask(e),_("label",{class:w.itemLabel},_("span",{class:w.itemFilename},t.name||this.messages.noTitle),_("span",{"aria-hidden":"true",class:this.classes(w.itemChevronIcon,b(this.container)?w.iconLeft:w.iconRight)}))))}renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:r,name:l,url:o}=e,d=this.renderImageMask(e,"list"===t?48:400),c=a.editing?_("span",{"aria-hidden":"true",class:this.classes(w.itemChevronIcon,b(this.container)?w.iconLeft:w.iconRight)}):null,m=[d,"preview"===i&&n&&h(r)?null:_("label",{class:w.itemLabel},_("span",{class:w.itemFilename},l||this.messages.noTitle),c)],u=a.editing?_("button",{key:"details-button",bind:this,class:w.itemButton,title:this.messages.attachmentDetails,"aria-label":this.messages.attachmentDetails,"data-attachment-info-id":e.id,onclick:()=>this._startEditAttachment(e),type:"button"},m):_("a",{key:"details-link",class:w.itemButton,href:o??void 0,target:"_blank"},m);return _("li",{class:w.item,key:e},u)}renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,r=!!i?.length,l=!!n?.length,o={[w.containerList]:"preview"!==e,[w.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?_("button",{bind:this,onclick:()=>this._startAddAttachment(),class:this.classes(w.esriButton,w.esriButtonTertiary,w.addAttachmentButton),type:"button"},_("span",{"aria-hidden":"true",class:this.classes(w.itemAddIcon,w.iconPlus)}),this.messages.add):void 0,c=r?_("ul",{key:"attachments-list",class:w.items},i.toArray().map((t=>this.renderAttachmentInfo({attachmentInfo:t,displayType:e})))):void 0,m=l?_("ul",{key:"file-list",class:w.items},n.toArray().map((e=>this.renderFile(e)))):void 0,h=l||r?void 0:_("div",{class:w.empty},this.messages.noAttachments);return _("div",{key:"attachments-container",class:this.classes(w.container,o)},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t&&t.files&&t.files.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([r()],F.prototype,"capabilities",null),e([r()],F.prototype,"displayType",void 0),e([r({readOnly:!0})],F.prototype,"effectiveDisplayType",null),e([r()],F.prototype,"graphic",null),e([r()],F.prototype,"label",null),e([r(),f("esri/widgets/Attachments/t9n/Attachments")],F.prototype,"messages",void 0),e([r(),f("esri/core/t9n/Units")],F.prototype,"messagesUnits",void 0),e([r({readOnly:!0})],F.prototype,"selectedFile",void 0),e([r({readOnly:!0})],F.prototype,"submitting",void 0),e([r({readOnly:!0})],F.prototype,"error",void 0),e([r({type:c})],F.prototype,"viewModel",void 0),e([r()],F.prototype,"visibleElements",void 0),e([l("visibleElements")],F.prototype,"castVisibleElements",null),F=e([o("esri.widgets.Attachments")],F);const B=F;export{B as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../intl.js";import"../../symbols.js";import{getContrastColor as s,getAccentColor as r,getTextColor as i,getTextHaloColor as o}from"../../core/analysisThemeUtils.js";import{destroyMaybe as a}from"../../core/maybe.js";import{watch as n,initial as l}from"../../core/reactiveUtils.js";import{formatDecimal as m,formatImperialLength as c,formatMetricLength as h}from"../../core/unitFormatUtils.js";import{convertUnit as p}from"../../core/unitUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{geodesicLength as y,geodesicDensify as v,planarLength as _}from"../../geometry/geometryEngine.js";import{project as f}from"../../geometry/projection.js";import{isSupported as w,geodesicLengths as g,geodesicDensify as b}from"../../geometry/support/geodesicUtils.js";import j from"../../layers/GraphicsLayer.js";import{ViewingMode as S}from"../../views/ViewingMode.js";import L from"../../views/draw/Draw.js";import{createManipulatorDragEventPipeline as M,screenToMap as A,dragGraphic as x}from"../../views/interactive/dragEventPipeline.js";import{GraphicManipulator as k}from"../../views/interactive/GraphicManipulator.js";import{InteractiveToolBase as D}from"../../views/interactive/InteractiveToolBase.js";import{fetchMessageBundle as T}from"../../intl/messages.js";import{onLocaleChange as G}from"../../intl/locale.js";import C from"../../geometry/Point.js";import R from"../../symbols/CIMSymbol.js";import P from"../../symbols/TextSymbol.js";import U from"../../symbols/Font.js";import E from"../../symbols/SimpleMarkerSymbol.js";import I from"../../geometry/Polyline.js";import z from"../../geometry/SpatialReference.js";const W=1e5;let O=class extends D{constructor(e){super(e),this._drawActive=!1,this._measurementLayer=new j({internal:!0,listMode:"hide",visible:!1}),this._manipulatorLayer=new j({internal:!0,listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){T("esri/core/t9n/Units").then((e=>{this.messages=e})),this.addHandles(G((async()=>{this.messages=await T("esri/core/t9n/Units")})));const e=this.view;this._draw=new L({view:e}),e.map.addMany([this._measurementLayer,this._manipulatorLayer]),e.focus(),this.addHandles(n((()=>[this.unit,this.geodesicDistanceThreshold,this.messages]),(()=>{this._updatePolylines()}),l))}destroy(){const{map:e}=this.view;this._draw.view=null,this._draw=a(this._draw),e.removeMany([this._measurementLayer,this._manipulatorLayer]),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._measurementLayer=a(this._measurementLayer),this._manipulatorLayer=a(this._manipulatorLayer),this._resetVertices()}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||0!==this._vertices.length||this._startSketch()}onShow(){this._measurementLayer.visible=!0,this._manipulatorLayer.visible=!0}onHide(){this._measurementLayer.visible=!1,this._manipulatorLayer.visible=!1}reset(){this._resetVertices(),this._measurementLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._draw.reset(),this._drawActive=!1,this._updateSketch([])}_resetVertices(){for(const{handle:e}of this._vertices)e.remove();this._vertices=[]}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],(e=>this._updateSketch(e.vertices))),e.on("draw-complete",(()=>{this._stopSketch()}))}_stopSketch(){this.manipulators.forEach((({manipulator:e})=>{e.interactive=!0})),this._drawActive=!1,this.finishToolCreation()}_updateSketch(e){const{spatialReference:t}=this.view;for(;this._vertices.length>e.length;){const{handle:e,manipulator:t}=this._vertices.pop();e.remove(),this.manipulators.remove(t)}for(let n=this._vertices.length;n<e.length;n++){const[s,r]=e[n],i=V(new C({x:s,y:r,spatialReference:t}),this.view,this._manipulatorLayer);this.manipulators.add(i);const o=M(i,((e,t)=>{t.next(A(this.view)).next(x(e.graphic,S.Local)).next((()=>{const t=e.graphic.geometry;this._vertices[n].coord=[t.x,t.y],this._updatePolylines()}))}));this._vertices.push({manipulator:i,coord:[s,r],handle:o})}const s=this._vertices.length-1,r=this._vertices[s],[i,o]=e[s];r.coord[0]===i&&r.coord[1]===o||(r.coord=[i,o],r.manipulator.graphic.geometry=new C({x:i,y:o,spatialReference:t}));const a=this._drawActive?this._vertices[s].manipulator:null;this.manipulators.forEach((({manipulator:e})=>{e.interactive=null==a||e!==a})),this._updatePolylines()}_updatePolylines(){if(this._vertices.length<2)return void this._measurementLayer.removeAll();const e=this._vertices.map((({coord:e})=>e)),{measurement:a,drawing:n,original:l}=B(e,this.view.spatialReference,this.geodesicDistanceThreshold);this._set("measurement",a);const m=N(this.messages,a,this.unit);let c,h;this._set("measurementLabel",m);const{graphics:p}=this._measurementLayer;2===p.length?(c=p.at(0),h=p.at(1)):(c=new t({symbol:new R({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[14,12],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:3.5,color:s().toArray()},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:5,color:r().toArray()}]}}})}),h=new t({symbol:new P({color:i(),haloColor:o(.5),haloSize:2,font:new U({size:14,family:"sans-serif"})})}),p.removeAll(),p.addMany([c,h])),c.geometry=n,h.geometry=l.extent?.center,h.symbol.text=m}};function V(e,s,i){const o=r(.5),a={type:"simple-line",width:0},n=8,l=new E({style:"circle",color:o,size:n,outline:a}),m=new E({style:"circle",color:o,size:1.5*n,outline:a}),c=new t({geometry:e,symbol:l});return new k({view:s,layer:i,graphic:c,focusedSymbol:m})}function B(e,t,s){const r=new I({paths:[e],spatialReference:t});let i,o;if(t.isGeographic)if(w(t))i=g([r],"meters")[0],o=b(r,W);else{const e=f(r,z.WGS84),s=b(e,W);i=g([e],"meters")[0],o=f(s,t)}else if(t.isWebMercator)i=y(r,"meters"),o=v(r,W,"meters");else{const e=_(r,"meters");if(e>=s){const e=f(r,z.WGS84),s=b(e,W);i=g([e],"meters")[0],o=f(s,t)}else i=e,o=r}return{measurement:{geometry:o,length:i},original:r,drawing:o}}function F(e){return null!=e}function H(e){if(!e)return!1;const{isGeographic:t,isWebMercator:s,isWGS84:r}=e;return t&&!r&&!w(e)||!t&&!s}function N(e,t,s){if(!t||!e)return"";switch(s){case"metric":return h(e,t.length,"meters");case"imperial":return c(e,t.length,"meters");default:return m(e,p(t.length,"meters",s),s)}}e([u()],O.prototype,"_drawActive",void 0),e([u({readOnly:!0})],O.prototype,"cursor",null),e([u({value:!0})],O.prototype,"editable",null),e([u({type:Number})],O.prototype,"geodesicDistanceThreshold",void 0),e([u({readOnly:!0})],O.prototype,"measurement",void 0),e([u({readOnly:!0})],O.prototype,"measurementLabel",void 0),e([u()],O.prototype,"messages",void 0),e([u()],O.prototype,"unit",void 0),e([u({constructOnly:!0})],O.prototype,"view",void 0),O=e([d("esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DTool")],O);export{O as DistanceMeasurement2DTool,B as createDistanceMeasurementInfo2D,N as createDistanceMeasurementLabel,H as isProjectionEngineRequired,F as isSupported};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../intl.js";import"../../symbols.js";import{getContrast as r,multiplyOpacity as s}from"../../core/colorUtils.js";import{destroyMaybe as i}from"../../core/maybe.js";import{watch as o,initial as a}from"../../core/reactiveUtils.js";import{formatDecimal as n,formatImperialLength as l,formatMetricLength as m}from"../../core/unitFormatUtils.js";import{convertUnit as c}from"../../core/unitUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{geodesicLength as u,geodesicDensify as d,planarLength as y}from"../../geometry/geometryEngine.js";import{project as v}from"../../geometry/projection.js";import{isSupported as f,geodesicLengths as _,geodesicDensify as w}from"../../geometry/support/geodesicUtils.js";import g from"../../layers/GraphicsLayer.js";import{ViewingMode as b}from"../../views/ViewingMode.js";import j from"../../views/draw/Draw.js";import{createManipulatorDragEventPipeline as S,screenToMap as L,dragGraphic as M}from"../../views/interactive/dragEventPipeline.js";import{GraphicManipulator as x}from"../../views/interactive/GraphicManipulator.js";import{InteractiveToolBase as A}from"../../views/interactive/InteractiveToolBase.js";import{fetchMessageBundle as C}from"../../intl/messages.js";import{onLocaleChange as T}from"../../intl/locale.js";import k from"../../geometry/Point.js";import D from"../../symbols/CIMSymbol.js";import G from"../../symbols/TextSymbol.js";import R from"../../symbols/Font.js";import P from"../../symbols/SimpleMarkerSymbol.js";import U from"../../geometry/Polyline.js";import E from"../../geometry/SpatialReference.js";const I=1e5;let z=class extends A{constructor(e){super(e),this._drawActive=!1,this._measurementLayer=new g({internal:!0,listMode:"hide",visible:!1}),this._manipulatorLayer=new g({internal:!0,listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){C("esri/core/t9n/Units").then((e=>{this.messages=e})),this.addHandles(T((async()=>{this.messages=await C("esri/core/t9n/Units")})));const e=this.view;this._draw=new j({view:e}),e.map.addMany([this._measurementLayer,this._manipulatorLayer]),e.focus(),this.addHandles([o((()=>[this.unit,this.geodesicDistanceThreshold,this.messages]),(()=>{this._updatePolylines()}),a),o((()=>[this.view.effectiveTheme.accentColor,this.view.effectiveTheme.textColor]),(()=>{if(!this._vertices.length)return;const e=this._vertices.map((({coord:e})=>e));for(const{handle:t}of this._vertices)t.remove();this._vertices=[],this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this.manipulators.removeAll(),this._updateSketch(e)}))])}destroy(){const{map:e}=this.view;this._draw.view=null,this._draw=i(this._draw),e.removeMany([this._measurementLayer,this._manipulatorLayer]),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._measurementLayer=i(this._measurementLayer),this._manipulatorLayer=i(this._manipulatorLayer),this._resetVertices()}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||0!==this._vertices.length||this._startSketch()}onShow(){this._measurementLayer.visible=!0,this._manipulatorLayer.visible=!0}onHide(){this._measurementLayer.visible=!1,this._manipulatorLayer.visible=!1}_resetVertices(){for(const{handle:e}of this._vertices)e.remove();this._vertices=[]}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],(e=>this._updateSketch(e.vertices))),e.on("draw-complete",(()=>{this._stopSketch()}))}_stopSketch(){this.manipulators.forEach((({manipulator:e})=>{e.interactive=!0})),this._drawActive=!1,this.finishToolCreation()}_updateSketch(e){const{spatialReference:t}=this.view;for(;this._vertices.length>e.length;){const{handle:e,manipulator:t}=this._vertices.pop();e.remove(),this.manipulators.remove(t)}for(let n=this._vertices.length;n<e.length;n++){const[r,s]=e[n],i=W(new k({x:r,y:s,spatialReference:t}),this.view,this._manipulatorLayer);this.manipulators.add(i);const o=S(i,((e,t)=>{t.next(L(this.view)).next(M(e.graphic,b.Local)).next((()=>{const t=e.graphic.geometry;this._vertices[n].coord=[t.x,t.y],this._updatePolylines()}))}));this._vertices.push({manipulator:i,coord:[r,s],handle:o})}const r=this._vertices.length-1,s=this._vertices[r],[i,o]=e[r];s.coord[0]===i&&s.coord[1]===o||(s.coord=[i,o],s.manipulator.graphic.geometry=new k({x:i,y:o,spatialReference:t}));const a=this._drawActive?this._vertices[r].manipulator:null;this.manipulators.forEach((({manipulator:e})=>{e.interactive=null==a||e!==a})),this._updatePolylines()}_updatePolylines(){if(this._vertices.length<2)return void this._measurementLayer.removeAll();const e=this._vertices.map((({coord:e})=>e)),{measurement:i,drawing:o,original:a}=O(e,this.view.spatialReference,this.geodesicDistanceThreshold);this._set("measurement",i);const n=H(this.messages,i,this.unit);let l,m;this._set("measurementLabel",n);const{graphics:c}=this._measurementLayer,h=2===c.length,{effectiveTheme:p}=this.view;h?(l=c.at(0),m=c.at(1)):(l=new t({symbol:new D({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[14,12],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:3.5,color:r(p.accentColor).toArray()},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:5,color:p.accentColor.toArray()}]}}})}),m=new t({symbol:new G({color:p.textColor,haloColor:s(r(p.textColor),.5),haloSize:2,font:new R({size:14,family:"sans-serif"})})}),c.removeAll(),c.addMany([l,m])),l.geometry=o,m.geometry=a.extent?.center,m.symbol.text=n}};function W(e,r,i){const o=s(r.effectiveTheme.accentColor,.5),a={type:"simple-line",width:0},n=8,l=new P({style:"circle",color:o,size:n,outline:a}),m=new P({style:"circle",color:o,size:1.5*n,outline:a}),c=new t({geometry:e,symbol:l});return new x({view:r,layer:i,graphic:c,focusedSymbol:m})}function O(e,t,r){const s=new U({paths:[e],spatialReference:t});let i,o;if(t.isGeographic)if(f(t))i=_([s],"meters")[0],o=w(s,I);else{const e=v(s,E.WGS84),r=w(e,I);i=_([e],"meters")[0],o=v(r,t)}else if(t.isWebMercator)i=u(s,"meters"),o=d(s,I,"meters");else{const e=y(s,"meters");if(e>=r){const e=v(s,E.WGS84),r=w(e,I);i=_([e],"meters")[0],o=v(r,t)}else i=e,o=s}return{measurement:{geometry:o,length:i},original:s,drawing:o}}function B(e){return null!=e}function F(e){if(!e)return!1;const{isGeographic:t,isWebMercator:r,isWGS84:s}=e;return t&&!s&&!f(e)||!t&&!r}function H(e,t,r){if(!t||!e)return"";switch(r){case"metric":return m(e,t.length,"meters");case"imperial":return l(e,t.length,"meters");default:return n(e,c(t.length,"meters",r),r)}}e([h()],z.prototype,"_drawActive",void 0),e([h({readOnly:!0})],z.prototype,"cursor",null),e([h({value:!0})],z.prototype,"editable",null),e([h({type:Number})],z.prototype,"geodesicDistanceThreshold",void 0),e([h({readOnly:!0})],z.prototype,"measurement",void 0),e([h({readOnly:!0})],z.prototype,"measurementLabel",void 0),e([h()],z.prototype,"messages",void 0),e([h()],z.prototype,"unit",void 0),e([h({constructOnly:!0})],z.prototype,"view",void 0),z=e([p("esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DTool")],z);export{z as DistanceMeasurement2DTool,O as createDistanceMeasurementInfo2D,H as createDistanceMeasurementLabel,F as isProjectionEngineRequired,B as isSupported};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{createTask as e}from"../../../core/asyncUtils.js";import{destroyHandle as i,handlesGroup as t}from"../../../core/handleUtils.js";import{abortMaybe as s,removeMaybe as l}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as a}from"../../../core/reactiveUtils.js";import{getGraphicEffectiveElevationInfo as n}from"../../../support/elevationInfoUtils.js";import{getSettings as o}from"../../../views/3d/interactive/editingTools/settings.js";import{OutlineVisualElement as h}from"../../../views/3d/interactive/visualElements/OutlineVisualElement.js";import{GraphicState as m}from"../../../views/3d/layers/graphics/GraphicState.js";import{RenderOccludedFlag as c}from"../../../views/3d/webgl-engine/lib/Material.js";import{highlightsSupported as g}from"../../../views/support/layerViewUtils.js";class p{constructor(e){this._params=e,this._highlightTask=null,this._highlightHandle=null,this._visualElementHandle=null}destroy(){this.remove()}remove(){this._highlightTask=s(this._highlightTask),this._highlightHandle=l(this._highlightHandle),this._visualElementHandle=l(this._visualElementHandle)}showHighlight(i){if(this.remove(),null==i||!u(i))return;const t=i.layer;this._highlightTask=e((async e=>{const s=await this._params.view.whenLayerView(t);r(e),g(s)&&(this._highlightHandle=s.highlight(i))}))}showReshaping(e){if(this.remove(),null==e)return;const s=this._params.view,l=new h({view:s,geometry:u(e)?e.geometry:null,attached:!1,elevationInfo:n(e),renderOccluded:c.OccludeAndTransparentStencil,isDecoration:!0}),r=new m({graphic:e}),g=[a((()=>r.isDraped),(e=>{l.isDraped=e})),r.on("changed",(()=>{l.geometry=u(e)?e.geometry:null})),s.trackGraphicState(r),s.maskOccludee(e),i(l)];o(s).visualElements.lineGraphics.outline.apply(l),l.attached=!0,this._visualElementHandle=t(g)}}function u(e){return null!=e.geometry&&"polyline"===e.geometry.type}export{p as InputRepresentation3D};
5
+ import{createTask as e}from"../../../core/asyncUtils.js";import{destroyHandle as i,handlesGroup as t}from"../../../core/handleUtils.js";import{abortMaybe as s,removeMaybe as l}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as a}from"../../../core/reactiveUtils.js";import{getGraphicEffectiveElevationInfo as h}from"../../../support/elevationInfoUtils.js";import{getSettings as n}from"../../../views/3d/interactive/editingTools/settings.js";import{OutlineVisualElement as o}from"../../../views/3d/interactive/visualElements/OutlineVisualElement.js";import{GraphicState as m}from"../../../views/3d/layers/graphics/GraphicState.js";import{RenderOccludedFlag as c}from"../../../views/3d/webgl-engine/lib/Material.js";import{highlightsSupported as g}from"../../../views/support/layerViewUtils.js";class p{constructor(e){this._params=e,this._highlightTask=null,this._highlightHandle=null,this._visualElementHandle=null}destroy(){this.remove()}remove(){this._highlightTask=s(this._highlightTask),this._highlightHandle=l(this._highlightHandle),this._visualElementHandle=l(this._visualElementHandle)}showHighlight(i){if(this.remove(),null==i||!u(i))return;const t=i.layer;this._highlightTask=e((async e=>{const s=await this._params.view.whenLayerView(t);r(e),g(s)&&(this._highlightHandle=s.highlight(i))}))}showReshaping(e){if(this.remove(),null==e)return;const s=this._params.view,l=new o({view:s,geometry:u(e)?e.geometry:null,attached:!1,elevationInfo:h(e),renderOccluded:c.OccludeAndTransparentStencil,isDecoration:!0}),r=new m({graphic:e}),g=[a((()=>r.isDraped),(e=>{l.isDraped=e})),r.on("changed",(()=>{l.geometry=u(e)?e.geometry:null})),s.trackGraphicState(r),s.maskOccludee(e),i(l)];n(s.effectiveTheme).visualElements.lineGraphics.outline.apply(l),l.attached=!0,this._visualElementHandle=t(g)}}function u(e){return null!=e.geometry&&"polyline"===e.geometry.type}export{p as InputRepresentation3D};