@arcgis/core 4.32.0-next.20250106 → 4.32.0-next.20250108

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 (228) hide show
  1. package/AttributeBinsGraphic.js +5 -0
  2. package/README.md +1 -1
  3. package/WebLinkChart.js +1 -1
  4. package/applications/MapViewer/templateUtils.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/000771f8eefcd6af0fda.js +1 -0
  7. package/assets/esri/core/workers/chunks/{9372d08ba8bf3342c48f.js → 011ccfd3acee83e7dc68.js} +1 -1
  8. package/assets/esri/core/workers/chunks/03af4a51043677ffcd0f.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d07da8b63d83af179a2c.js → 05943caacfd28c383810.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{9f495ad57cdbfa90c5b8.js → 095aeb19e2207c8361ca.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{67c7bdc0c91a8f803ea8.js → 11cb25dfab7c8467897a.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{07304287ed5244fa4e12.js → 12b2c8251ec2d0e2ca46.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js → 1abeba63bf623a746d5c.js} +2 -2
  14. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js.LICENSE.txt → 1abeba63bf623a746d5c.js.LICENSE.txt} +1 -1
  15. package/assets/esri/core/workers/chunks/{a57cead317eb2fc9afd8.js → 206194cf069ad4bcc3ad.js} +1 -1
  16. package/assets/esri/core/workers/chunks/24a597ae32a2083a50a5.js +1 -0
  17. package/assets/esri/core/workers/chunks/{0673d811c496143fc3d4.js → 2779cf112299b612a73a.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{bd37c9cc720587665fd3.js → 304b88ade7551130ad3a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{aedff36d3fec86abb9fb.js → 30a84ddf0384bb52fdbe.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{367af4aa7e170c8553e3.js → 33a13544b9e5f4f20bce.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{dce55e7f76adecc055c3.js → 35d9457109d0631a1ca8.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{3a90163b76b0bc7f21d2.js → 3767defbd9c4b2e86886.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3a3e9701e5d7b05f41b7.js +1 -0
  24. package/assets/esri/core/workers/chunks/{9a498f2c007f4d78d4dd.js → 4234539a9721104acafb.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{76fa5c7c87831ad25cde.js → 435c037ccba71f1e22d3.js} +1 -1
  26. package/assets/esri/core/workers/chunks/4387c47ae1b36d770f1d.js +1 -0
  27. package/assets/esri/core/workers/chunks/44ec3c77339b9765aaa4.js +1 -0
  28. package/assets/esri/core/workers/chunks/4b77c8d994498899631a.js +1 -0
  29. package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +1 -0
  30. package/assets/esri/core/workers/chunks/{f9af0473878d960a02f2.js → 58485909e1cfeb52c01e.js} +1 -1
  31. package/assets/esri/core/workers/chunks/5b61a1e7ac60a02a906d.js +1 -0
  32. package/assets/esri/core/workers/chunks/62f8949a2d9076f3c1ea.js +2 -0
  33. package/assets/esri/core/workers/chunks/{c8cd6ba5600d8ff8db0b.js.LICENSE.txt → 62f8949a2d9076f3c1ea.js.LICENSE.txt} +1 -1
  34. package/assets/esri/core/workers/chunks/{664aa401887b59abd7b7.js → 6400f39a965900f66ce7.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{ddce265c46e4dfeb6c6d.js → 66d40a486aa3caa76106.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6b3ee691646fbc39445c.js +1 -0
  37. package/assets/esri/core/workers/chunks/{533a7fd64b17bb294545.js → 6c58f792e2ae3736f662.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js → 6efb36bc2205203ff44d.js} +2 -2
  39. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js.LICENSE.txt → 6efb36bc2205203ff44d.js.LICENSE.txt} +1 -1
  40. package/assets/esri/core/workers/chunks/76a7114a69264f5c07b0.js +2 -0
  41. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js.LICENSE.txt → 76a7114a69264f5c07b0.js.LICENSE.txt} +1 -1
  42. package/assets/esri/core/workers/chunks/{a90611cdc86190799560.js → 7a43fda8984549a084b8.js} +1 -1
  43. package/assets/esri/core/workers/chunks/7b753da3b8a6d75abf20.js +1 -0
  44. package/assets/esri/core/workers/chunks/{ca1e186f136abb23ae4b.js → 7d0fc25ce1f74adcfeb6.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{9b020c47ca9ff5de9bb8.js → 7db356976198c4df76c1.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{9ad7d095e614e7e8d7f5.js → 7df076d15b7b7a66dcee.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{955421ee2247965244f0.js → 7fe92f072d3641ec4662.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{4c56698cf1c669371865.js → 81816410cb1453938593.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{4ffaa2c5ab47a599ee9f.js → 82266ca8002554198208.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{88c68881cbdf4e911832.js → 89286d8f59844724cd16.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{f19d3c855f6e93544918.js → 8be0151a24c9af76a976.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{d9e396adf3354ee68339.js → 8f2b2d2dc9935b0d2039.js} +1 -1
  53. package/assets/esri/core/workers/chunks/907a91266e25cc4b9d42.js +1 -0
  54. package/assets/esri/core/workers/chunks/{a77aa86896bbb0e088df.js → 9857491cafa0278d9ae6.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{993db7646a8fc60179eb.js → 98da074899c82f0ded0b.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{3bb94da29dac3367ecc6.js → a1edd3f68e691ea39594.js} +1 -1
  57. package/assets/esri/core/workers/chunks/a8ec4189ec3b37d5ff74.js +1 -0
  58. package/assets/esri/core/workers/chunks/{6a4305eb1e52b80ecb5c.js → b8ea84adff5619040494.js} +3 -3
  59. package/assets/esri/core/workers/chunks/c4374b6bc5c8dc6435c7.js +1 -0
  60. package/assets/esri/core/workers/chunks/c5a928dcff7dc8a8cc9f.js +2 -0
  61. package/assets/esri/core/workers/chunks/{f4e3db71d1adae717535.js.LICENSE.txt → c5a928dcff7dc8a8cc9f.js.LICENSE.txt} +1 -1
  62. package/assets/esri/core/workers/chunks/cac79b64a7dade8bf486.js +2 -0
  63. package/assets/esri/core/workers/chunks/{bf0a0ca7fdac98f06a89.js.LICENSE.txt → cac79b64a7dade8bf486.js.LICENSE.txt} +1 -1
  64. package/assets/esri/core/workers/chunks/cd92b80de7e9f982f9a9.js +1 -0
  65. package/assets/esri/core/workers/chunks/{2cccaf50134c65944e0a.js → d0876eed5249b029f9f0.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{178f606c8896ae5f39de.js → d1dbbab4a4c6072c182f.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{8e42fb623f56942958d8.js → d74b5dc60f02892d03e7.js} +1 -1
  68. package/assets/esri/core/workers/chunks/e27b8674a3492db51f2e.js +1 -0
  69. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js → e2d987c39a6ef318511c.js} +2 -2
  70. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js.LICENSE.txt → e2d987c39a6ef318511c.js.LICENSE.txt} +1 -1
  71. package/assets/esri/core/workers/chunks/{943428cf643e87ccfaad.js → e7e26b71f9eb28421936.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{f0adabf6d71a27f3183b.js → e80b0646a7e0e466ea65.js} +1 -1
  73. package/assets/esri/core/workers/chunks/e9c21907fabcedbd32ae.js +1 -0
  74. package/assets/esri/core/workers/chunks/{3ed7c8138231de3a3b96.js → f8c960df1dabab120c70.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{fdd8a5eb07466541f1f9.js → fd95b19f02d8dfef2baf.js} +1 -1
  76. package/assets/esri/widgets/support/GridControls/t9n/GridControls_ja.json +1 -1
  77. package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
  78. package/chunks/LineSeries.js +1 -1
  79. package/chunks/OperatorProject.js +1 -1
  80. package/chunks/Pattern.glsl.js +1 -1
  81. package/chunks/QuadraticBezier.js +1 -1
  82. package/chunks/Transformation2D.js +1 -1
  83. package/chunks/bufferOperator.js +1 -1
  84. package/chunks/chartUtilsAm5.js +1 -1
  85. package/chunks/geodesicBufferOperator.js +1 -1
  86. package/chunks/lyr3DWorker.js +1 -1
  87. package/chunks/terrainUtilsPlanar.js +1 -1
  88. package/chunks/terrainUtilsSpherical.js +1 -1
  89. package/chunks/vxlLayer.js +1 -1
  90. package/geometry/operators/graphicBufferOperator.js +1 -1
  91. package/geometry/support/meshUtils/primitives.js +1 -1
  92. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  93. package/geometry/support/triangle.js +1 -1
  94. package/interfaces.d.ts +186 -96
  95. package/layers/LinkChartLayer.js +1 -1
  96. package/layers/MapNotesLayer.js +1 -1
  97. package/layers/MediaLayer.js +1 -1
  98. package/layers/graphics/data/QueryEngineResult.js +1 -1
  99. package/layers/graphics/data/queryUtils.js +1 -1
  100. package/layers/graphics/data/queryValidationUtils.js +1 -1
  101. package/layers/graphics/sources/WFSSource.js +1 -1
  102. package/layers/support/ImageElement.js +1 -1
  103. package/layers/support/VideoElement.js +1 -1
  104. package/layers/support/capabilities.js +1 -1
  105. package/layers/support/featureLayerUtils.js +1 -1
  106. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  107. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  108. package/layers/video/VideoController.js +1 -1
  109. package/linkChart/OrganicLayoutSettings.js +1 -1
  110. package/package.json +4 -4
  111. package/renderers/RasterStretchRenderer.js +1 -1
  112. package/rest/query/executeAttributeBinsQuery.js +1 -1
  113. package/rest/support/AttributeBinsFeatureSet.js +5 -0
  114. package/rest/support/AttributeBinsQuery.js +1 -1
  115. package/rest/support/BinParametersAttributes.js +1 -1
  116. package/rest/support/BinParametersBase.js +1 -1
  117. package/rest/support/DateBinParameters.js +1 -1
  118. package/rest/support/FeatureSet.js +1 -1
  119. package/rest/support/NormalizationBinParametersMixin.js +1 -1
  120. package/rest/support/Query.js +1 -1
  121. package/rest/support/TopFeaturesQuery.js +1 -1
  122. package/smartMapping/renderers/color.js +1 -1
  123. package/smartMapping/renderers/dotDensity.js +1 -1
  124. package/smartMapping/renderers/pieChart.js +1 -1
  125. package/smartMapping/renderers/size.js +1 -1
  126. package/smartMapping/renderers/univariateColorSize.js +1 -1
  127. package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
  128. package/support/mediaLayerUtils.js +5 -0
  129. package/support/revision.js +1 -1
  130. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  131. package/symbols/cim/cimAnalyzer.js +1 -1
  132. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  133. package/views/2d/AnimationManager.js +1 -1
  134. package/views/2d/engine/Bitmap.js +1 -1
  135. package/views/2d/engine/BitmapContainer.js +1 -1
  136. package/views/2d/engine/BitmapTileContainer.js +1 -1
  137. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  138. package/views/2d/engine/webgl/Overlay.js +1 -1
  139. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  140. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  143. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  144. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  145. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  146. package/views/2d/navigation/MapViewNavigation.js +1 -1
  147. package/views/2d/support/HighlightGroup.js +1 -1
  148. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  149. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  150. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  151. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  152. package/views/3d/analysis/support/measurementUtils.js +1 -1
  153. package/views/3d/environment/CloudsParameters.js +1 -1
  154. package/views/3d/environment/MarsAtmosphere.js +1 -1
  155. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  156. package/views/3d/layers/MediaLayerView3D.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/placementUtils.js +1 -1
  159. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  160. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  161. package/views/3d/state/NearFarHeuristic.js +1 -1
  162. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  163. package/views/3d/support/HighlightGroup.js +1 -1
  164. package/views/3d/terrain/SphericalPatch.js +1 -1
  165. package/views/3d/terrain/TerrainRenderer.js +1 -1
  166. package/views/3d/terrain/TerrainSurface.js +1 -1
  167. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  168. package/views/3d/terrain/TileRenderer.js +1 -1
  169. package/views/3d/terrain/TileTexture.js +1 -1
  170. package/views/3d/terrain/terrainUtilsPlanar.js +1 -1
  171. package/views/3d/terrain/terrainUtilsSpherical.js +1 -1
  172. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  173. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  174. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  175. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  176. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  177. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  178. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +4 -4
  179. package/views/SceneView.js +1 -1
  180. package/views/View.js +1 -1
  181. package/views/draw/support/HighlightHelper.js +1 -1
  182. package/views/input/BrowserEventSource.js +1 -1
  183. package/views/layers/DimensionLayerView.js +1 -1
  184. package/views/layers/MediaLayerView.js +1 -1
  185. package/views/support/HighlightGroup.d.ts +4 -0
  186. package/views/support/HighlightGroup.js +5 -0
  187. package/views/webgl/Texture.js +1 -1
  188. package/views/webgl/textureUtils.js +5 -0
  189. package/webscene/Slide.js +1 -1
  190. package/widgets/BasemapLayerList.js +1 -1
  191. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  192. package/widgets/CatalogLayerList.js +1 -1
  193. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  194. package/widgets/Editor/UpdateWorkflow.js +1 -1
  195. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  196. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  197. package/widgets/FeatureTable/support/exportUtils.js +1 -1
  198. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  199. package/widgets/LayerList/support/layerListUtils.js +1 -1
  200. package/widgets/LayerList.js +1 -1
  201. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  202. package/widgets/PanoramicViewer/utils.js +1 -1
  203. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  204. package/widgets/Sketch/SketchViewModel.js +1 -1
  205. package/widgets/TableList.js +1 -1
  206. package/widgets/support/ColorPicker.js +1 -1
  207. package/assets/esri/core/workers/chunks/005727711cca0614c2ab.js +0 -2
  208. package/assets/esri/core/workers/chunks/0a3bf1b74cce1b6b7ed8.js +0 -1
  209. package/assets/esri/core/workers/chunks/0d2411a941c42acb8cc2.js +0 -1
  210. package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +0 -1
  211. package/assets/esri/core/workers/chunks/13720b1d97fb7d80e972.js +0 -1
  212. package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +0 -1
  213. package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +0 -1
  214. package/assets/esri/core/workers/chunks/1a713cc601c6fcd97d2f.js +0 -1
  215. package/assets/esri/core/workers/chunks/3029354194f1a3030c5c.js +0 -1
  216. package/assets/esri/core/workers/chunks/318a39b56851e707edad.js +0 -1
  217. package/assets/esri/core/workers/chunks/53cd990b2c988518de6d.js +0 -1
  218. package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +0 -1
  219. package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +0 -1
  220. package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +0 -1
  221. package/assets/esri/core/workers/chunks/9f0ebeae8a3ba360284b.js +0 -1
  222. package/assets/esri/core/workers/chunks/a3cef3837f4df9ab022e.js +0 -1
  223. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js +0 -2
  224. package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +0 -2
  225. package/assets/esri/core/workers/chunks/ea250d66089967976c05.js +0 -1
  226. package/assets/esri/core/workers/chunks/ecf317c6c790b3cc83bf.js +0 -1
  227. package/assets/esri/core/workers/chunks/f4e3db71d1adae717535.js +0 -2
  228. package/views/2d/support/HighlightGroup.d.ts +0 -4
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import i from"../../core/Accessor.js";import{watch as a,initial as l}from"../../core/reactiveUtils.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./ScaleRanges.js";import n from"../Slider/SliderViewModel.js";let c=class extends i{constructor(e){super(e),this.layer=null,this.mode="range",this.scaleRanges=r.fromScaleRange({minScale:0,maxScale:0}),this.sliderViewModel=(()=>{const{max:e}=this._getSliderIndexRange(this.scaleRanges.length-1);return new n({precision:10,min:0,max:e,values:[0,e]})})()}initialize(){this.addHandles([a((()=>this.layer),(e=>e?.load().catch((()=>{})))),a((()=>this.mode),(e=>{"range"===e&&1===this.sliderViewModel.values?.length?this.sliderViewModel.values=[this.sliderViewModel.min,this.sliderViewModel.values[0]]:2===this.sliderViewModel.values?.length&&("min-scale-only"===e?this.sliderViewModel.values=[this.sliderViewModel.values[0]]:"max-scale-only"===e&&(this.sliderViewModel.values=[this.sliderViewModel.values[1]]))})),a((()=>({loaded:this.layer?.loaded,ready:this.view?.ready})),(({loaded:e,ready:i})=>{if(!e||!i)return;if(this._hasTiledLayer()){const e=this._getLayerResampling()?void 0:this.mapScaleToSlider(this._getTiledLayerMaxScale()),i=this.mapScaleToSlider(this._getTiledLayerMinScale());this.sliderViewModel.effectiveMax=e,this.sliderViewModel.effectiveMin=i}else{const e=this.layer&&"maxScaleRange"in this.layer?this.layer.maxScaleRange:null,{minScale:i=0,maxScale:a=0}=e??{};this.sliderViewModel.effectiveMax=0===a?void 0:this.mapScaleToSlider(a),this.sliderViewModel.effectiveMin=0===i?void 0:this.mapScaleToSlider(i)}const a=this.layer;a&&"minScale"in a&&"maxScale"in a?(this.minScale=a.minScale,this.maxScale=a.maxScale):(this.minScale=void 0,this.maxScale=void 0)}),l)])}get effectiveMaxScale(){return 0===this.maxScale?this.maxScaleLimit:this.maxScale}get effectiveMinScale(){return 0===this.minScale?this.minScaleLimit:this.minScale}get effectiveMaxScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.effectiveMax??this.sliderViewModel.max)}get effectiveMinScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.effectiveMin??this.sliderViewModel.min)}get maxScale(){return this._getScale("max")}set maxScale(e){this._setMaxScaleOnSlider(e)}get maxScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.max)}set maxScaleLimit(e){this._setSliderRange({maxScale:e,minScale:this.minScaleLimit})}get minScale(){return this._getScale("min")}set minScale(e){this._setMinScaleOnSlider(e)}get minScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.min)}set minScaleLimit(e){this._setSliderRange({maxScale:this.maxScaleLimit,minScale:e})}get state(){const{view:e,layer:i}=this;return!e&&!i||!e&&i?.loaded||!i&&e?.ready||e&&e.ready&&i?.loaded?"ready":"disabled"}set view(e){this._set("view",e)}mapScaleToSlider(e){const i=this.scaleRanges.scaleToRangeIndex(e),a=this.scaleRanges.findScaleRangeByIndex(i),{maxScale:l,minScale:t}=a,{max:s,min:r}=this._getSliderIndexRange(i);return this._mapToRange(e,t,l,r,s)}mapSliderToScale(e){const i=this.scaleRanges.findScaleRangeByIndex(e),{maxScale:a,minScale:l}=i,{max:t,min:s}=this._getSliderIndexRange(e);return this._mapToRange(e,s,t,l,a)}_setSliderRange(e){this.scaleRanges=r.fromScaleRange(e);const{max:i}=this._getSliderIndexRange(this.scaleRanges.length-1);this.sliderViewModel.max=i,this.sliderViewModel.min=0,this.notifyChange("maxScaleLimit"),this.notifyChange("minScaleLimit")}_getSliderIndexRange(e){const i=Math.floor(e);return{min:i,max:i+.99999}}_mapToRange(e,i,a,l,t){return l+(e-i)*(t-l)/(a-i)}_getSliderValue(e){const{min:i,max:a,values:l}=this.sliderViewModel,[t,s]=l;switch(this.mode){case"max-scale-only":return"min"===e?i:t;case"min-scale-only":return"min"===e?t:a;default:return"min"===e?t??i:s??a}}_getScale(e){const i=this.mapSliderToScale(this._getSliderValue(e));return this._normalizeScale(e,i)}_setMaxScaleOnSlider(e){const{scaleRanges:i,sliderViewModel:a}=this;if(void 0!==e){const l=this.mapScaleToSlider(this._constrainMaxScaleToLayer(i.clampMaxScale(e)));switch(this.mode){case"range":a.values=[a.values[0],l];break;case"max-scale-only":a.values=[l]}}}_setMinScaleOnSlider(e){const{scaleRanges:i,sliderViewModel:a}=this;if(void 0!==e){const l=this.mapScaleToSlider(this._constrainMinScaleToLayer(i.clampMinScale(e)));switch(this.mode){case"range":a.values=[l,a.values[1]];break;case"min-scale-only":a.values=[l]}}}_constrainMinScaleToLayer(e){const{scaleRanges:i}=this;if(this._hasTiledLayer()){const{firstRange:a}=i,l=this._getTiledLayerMinScale(),t=.85;e=this._mapToRange(e,a.maxScale,a.minScale,0,1)>t||e>l?l:e}return e}_constrainMaxScaleToLayer(e){if(this._hasTiledLayer()&&!this._getLayerResampling()){const i=this._getTiledLayerMaxScale();e=e<i?i:e}return e}_normalizeScale(e,i){const a="max"===e?"maxScale":"minScale",l=this._hasTiledLayer()?"min"===e?this._getTiledLayerMinScale():this._getTiledLayerMaxScale():this.scaleRanges[a],t=this._hasTiledLayer()?"min"===e?this._getTiledLayerRealMinScale():this._getTiledLayerRealMaxScale():l,s=1e-6,r=0===i||t===i||Math.abs(t-i)<=s;return Number((r?0:i).toFixed(6))}_getLayerLODS(){if(!this.layer?.loaded||!("tileInfo"in this.layer))return null;return"imagery-tile"===this.layer?.type&&"Raster"===this.layer.raster?.tileType?null:this.layer.tileInfo?.lods}_getLayerResampling(){return!!this.layer?.loaded&&(!("resampling"in this.layer)||this.layer.resampling)}_getTiledLayerMinScale(){const e=this._getLayerLODS();return this.scaleRanges.clampMinScale(e[0].scale)}_getTiledLayerMaxScale(){const e=this._getLayerLODS();return e[e.length-1].scale}_getTiledLayerRealMinScale(){const e=this._getLayerLODS(),i=this.layer,a=i&&"sourceJSON"in i?i.sourceJSON?.tileInfo?.lods??e:e;return this.scaleRanges.clampMinScale(a[0].scale)}_getTiledLayerRealMaxScale(){const e=this._getLayerLODS(),i=this.layer,a=i&&"sourceJSON"in i?i.sourceJSON?.tileInfo?.lods??e:e;return a[a.length-1].scale}_hasTiledLayer(){return!!this._getLayerLODS()}};e([t({readOnly:!0})],c.prototype,"effectiveMaxScale",null),e([t({readOnly:!0})],c.prototype,"effectiveMinScale",null),e([t()],c.prototype,"effectiveMaxScaleLimit",null),e([t()],c.prototype,"effectiveMinScaleLimit",null),e([t()],c.prototype,"layer",void 0),e([t()],c.prototype,"maxScale",null),e([t()],c.prototype,"maxScaleLimit",null),e([t()],c.prototype,"mode",void 0),e([t()],c.prototype,"minScale",null),e([t()],c.prototype,"minScaleLimit",null),e([t()],c.prototype,"scaleRanges",void 0),e([t()],c.prototype,"sliderViewModel",void 0),e([t({readOnly:!0})],c.prototype,"state",null),e([t()],c.prototype,"view",null),c=e([s("esri.widgets.ScaleRangeSlider.ScaleRangeSliderViewModel")],c);const o=c;export{o as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import i from"../../core/Accessor.js";import{watch as a,initial as l}from"../../core/reactiveUtils.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./ScaleRanges.js";import n from"../Slider/SliderViewModel.js";let c=class extends i{constructor(e){super(e),this.layer=null,this.mode="range",this.scaleRanges=r.fromScaleRange({minScale:0,maxScale:0}),this.sliderViewModel=(()=>{const{max:e}=this._getSliderIndexRange(this.scaleRanges.length-1);return new n({precision:10,min:0,max:e,values:[0,e]})})()}initialize(){this.addHandles([a((()=>this.layer),(e=>e?.load().catch((()=>{})))),a((()=>this.mode),(e=>{"range"===e&&1===this.sliderViewModel.values?.length?this.sliderViewModel.values=[this.sliderViewModel.min,this.sliderViewModel.values[0]]:2===this.sliderViewModel.values?.length&&("min-scale-only"===e?this.sliderViewModel.values=[this.sliderViewModel.values[0]]:"max-scale-only"===e&&(this.sliderViewModel.values=[this.sliderViewModel.values[1]]))})),a((()=>({loaded:this.layer?.loaded,ready:this.view?.ready})),(({loaded:e,ready:i})=>{if(!e||!i)return;if(this._hasTiledLayer()){const e=this._getLayerResampling()?void 0:this.mapScaleToSlider(this._getTiledLayerMaxScale()),i=this.mapScaleToSlider(this._getTiledLayerMinScale());this.sliderViewModel.effectiveMax=e,this.sliderViewModel.effectiveMin=i}else{const e=this.layer&&"maxScaleRange"in this.layer?this.layer.maxScaleRange:null,{minScale:i=0,maxScale:a=0}=e??{};this.sliderViewModel.effectiveMax=0===a?void 0:this.mapScaleToSlider(a),this.sliderViewModel.effectiveMin=0===i?void 0:this.mapScaleToSlider(i)}const a=this.layer;a&&"minScale"in a&&"maxScale"in a?(this.minScale=a.minScale,this.maxScale=a.maxScale):(this.minScale=void 0,this.maxScale=void 0)}),l)])}get effectiveMaxScale(){return 0===this.maxScale?this.maxScaleLimit:this.maxScale}get effectiveMinScale(){return 0===this.minScale?this.minScaleLimit:this.minScale}get effectiveMaxScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.effectiveMax??this.sliderViewModel.max)}get effectiveMinScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.effectiveMin??this.sliderViewModel.min)}get maxScale(){return this._getScale("max")}set maxScale(e){this._setMaxScaleOnSlider(e)}get maxScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.max)}set maxScaleLimit(e){this._setSliderRange({maxScale:e,minScale:this.minScaleLimit})}get minScale(){return this._getScale("min")}set minScale(e){this._setMinScaleOnSlider(e)}get minScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.min)}set minScaleLimit(e){this._setSliderRange({maxScale:this.maxScaleLimit,minScale:e})}get state(){const{view:e,layer:i}=this;return!e&&!i||!e&&i?.loaded||!i&&e?.ready||e&&e.ready&&i?.loaded?"ready":"disabled"}set view(e){this._set("view",e)}mapScaleToSlider(e){const i=this.scaleRanges.scaleToRangeIndex(e),a=this.scaleRanges.findScaleRangeByIndex(i),{maxScale:l,minScale:t}=a,{max:s,min:r}=this._getSliderIndexRange(i);return this._mapToRange(e,t,l,r,s)}mapSliderToScale(e){const i=this.scaleRanges.findScaleRangeByIndex(e),{maxScale:a,minScale:l}=i,{max:t,min:s}=this._getSliderIndexRange(e);return this._mapToRange(e,s,t,l,a)}_setSliderRange(e){this.scaleRanges=r.fromScaleRange(e);const{max:i}=this._getSliderIndexRange(this.scaleRanges.length-1);this.sliderViewModel.max=i,this.sliderViewModel.min=0,this.notifyChange("maxScaleLimit"),this.notifyChange("minScaleLimit")}_getSliderIndexRange(e){const i=Math.floor(e);return{min:i,max:i+.99999}}_mapToRange(e,i,a,l,t){return l+(e-i)*(t-l)/(a-i)}_getSliderValue(e){const{min:i,max:a,values:l}=this.sliderViewModel,[t,s]=l;switch(this.mode){case"max-scale-only":return"min"===e?i:t;case"min-scale-only":return"min"===e?t:a;default:return"min"===e?t??i:s??a}}_getScale(e){const i=this.mapSliderToScale(this._getSliderValue(e));return this._normalizeScale(e,i)}_setMaxScaleOnSlider(e){const{scaleRanges:i,sliderViewModel:a}=this;if(void 0!==e){const l=this.mapScaleToSlider(this._constrainMaxScaleToLayer(i.clampMaxScale(e)));switch(this.mode){case"range":a.values=[a.values[0],l];break;case"max-scale-only":a.values=[l]}}}_setMinScaleOnSlider(e){const{scaleRanges:i,sliderViewModel:a}=this;if(void 0!==e){const l=this.mapScaleToSlider(this._constrainMinScaleToLayer(i.clampMinScale(e)));switch(this.mode){case"range":a.values=[l,a.values[1]];break;case"min-scale-only":a.values=[l]}}}_constrainMinScaleToLayer(e){const{scaleRanges:i}=this;if(this._hasTiledLayer()){const{firstRange:a}=i,l=this._getTiledLayerMinScale(),t=.85;e=this._mapToRange(e,a.maxScale,a.minScale,0,1)>t||e>l?l:e}return e}_constrainMaxScaleToLayer(e){if(this._hasTiledLayer()&&!this._getLayerResampling()){const i=this._getTiledLayerMaxScale();e=e<i?i:e}return e}_normalizeScale(e,i){const a="max"===e?"maxScale":"minScale",l=this._hasTiledLayer()?"min"===e?this._getTiledLayerMinScale():this._getTiledLayerMaxScale():this.scaleRanges[a],t=this._hasTiledLayer()?"min"===e?this._getTiledLayerRealMinScale():this._getTiledLayerRealMaxScale():l,s=1e-6,r=0===i||t===i||Math.abs(t-i)<=s;return Number((r?0:i).toFixed(6))}_getLayerLODS(){const{layer:e}=this;if(!e?.loaded||!("tileInfo"in e))return null;return"wcs"===e.type||"imagery-tile"===e.type&&"Raster"===e.raster?.tileType?null:e.tileInfo?.lods}_getLayerResampling(){return!!this.layer?.loaded&&(!("resampling"in this.layer)||this.layer.resampling)}_getTiledLayerMinScale(){const e=this._getLayerLODS();return this.scaleRanges.clampMinScale(e[0].scale)}_getTiledLayerMaxScale(){const e=this._getLayerLODS();return e[e.length-1].scale}_getTiledLayerRealMinScale(){const e=this._getLayerLODS(),i=this.layer,a=i&&"sourceJSON"in i?i.sourceJSON?.tileInfo?.lods??e:e;return this.scaleRanges.clampMinScale(a[0].scale)}_getTiledLayerRealMaxScale(){const e=this._getLayerLODS(),i=this.layer,a=i&&"sourceJSON"in i?i.sourceJSON?.tileInfo?.lods??e:e;return a[a.length-1].scale}_hasTiledLayer(){return!!this._getLayerLODS()}};e([t({readOnly:!0})],c.prototype,"effectiveMaxScale",null),e([t({readOnly:!0})],c.prototype,"effectiveMinScale",null),e([t()],c.prototype,"effectiveMaxScaleLimit",null),e([t()],c.prototype,"effectiveMinScaleLimit",null),e([t()],c.prototype,"layer",void 0),e([t()],c.prototype,"maxScale",null),e([t()],c.prototype,"maxScaleLimit",null),e([t()],c.prototype,"mode",void 0),e([t()],c.prototype,"minScale",null),e([t()],c.prototype,"minScaleLimit",null),e([t()],c.prototype,"scaleRanges",void 0),e([t()],c.prototype,"sliderViewModel",void 0),e([t({readOnly:!0})],c.prototype,"state",null),e([t()],c.prototype,"view",null),c=e([s("esri.widgets.ScaleRangeSlider.ScaleRangeSliderViewModel")],c);const o=c;export{o 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{symbolTypes as t}from"../../symbols.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Evented.js";import{drainHandles as r}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as n,abortMaybe as p}from"../../core/maybe.js";import{createAbortError as l,whenOrAbort as c}from"../../core/promiseUtils.js";import{on as h,watch as d,when as u,whenOnce as y,syncAndInitial as m}from"../../core/reactiveUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as f}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as _,isLoaded as b,load as w,project as G}from"../../geometry/projection.js";import{geometryToCoordinates as O}from"../../geometry/support/coordsUtils.js";import{equals as T}from"../../geometry/support/spatialReferenceUtils.js";import E from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as S}from"../../layers/support/layerUtils.js";import{SupportedObjectResult as A,isSupportedObjectResultMessage as k}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as M}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as C}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as D}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as H}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as R}from"../../views/input/InputManager.js";import{sketchKeys as j}from"../../views/interactive/keybindings.js";import I from"../../views/interactive/sketch/SketchLabelOptions.js";import U from"../../views/interactive/sketch/SketchOptions.js";import x from"../../views/interactive/sketch/SketchTooltipOptions.js";import P from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as L}from"../../views/interactive/snapping/SnappingManager.js";import F from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as V}from"../../views/interactive/snapping/snappingUtils.js";import{findFirstGraphicHit as K}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as W}from"../../views/support/screenUtils.js";import{CreateOperationHandle as Z,UpdateOperationHandle as q}from"./support/OperationHandle.js";import z from"../../symbols/SimpleMarkerSymbol.js";import N from"../../symbols/SimpleFillSymbol.js";import B from"../../symbols/SimpleLineSymbol.js";import $ from"../../symbols/MeshSymbol3D.js";import Y from"../../symbols/FillSymbol3DLayer.js";const J={defaultZ:0},Q={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0},tool:"transform"};let X=class extends a.EventedAccessor{constructor(e){super(e),this._numUpdating=0,this._defaultSnappingManager=null,this._internalGraphicsLayer=new E({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new N({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new B({color:[130,130,130,1],width:2}),this.meshSymbol=new $({symbolLayers:new o([new Y])}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.vertexSymbol=new z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new U,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._originalPopupEnabled=null,this.defaultCreateOptions=J,this.defaultUpdateOptions=Q,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new F}initialize(){this.addHandles([h((()=>this.view?.map?.layers),"change",(e=>{e.removed.includes(this.layer)&&this.cancel()})),h((()=>this.layer?.graphics),"change",(e=>{if(null!=this._operationHandle)for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())})),d((()=>this.layer?.elevationInfo??null),(e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)}),m),d((()=>this.view),(e=>{this._defaultSnappingManager=n(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new L({view:e,options:this.snappingOptions})),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))}),m),d((()=>this.view?.spatialReference),((e,t)=>{e&&t&&!e.equals(t)&&this.cancel()}))]),V(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=n(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this.emit("destroy")}get updating(){return this._numUpdating>0||null!=this.snappingManager&&this.snappingManager.updating}get activeTool(){return this._operationHandle?.tool??null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...J,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Q,...e,reshapeOptions:{...Q.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...Q.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=n(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new L({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&(t.cursor=null),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(u((()=>e.ready),(t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)}),m),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=p(this._moduleLoaderAbortController),this._viewReadyAbortController=p(this._viewReadyAbortController),this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e,layer:o}=this,i=t.toArray();o.removeMany(i),this.cancel(),this._emitDeleteEvent({graphics:i,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map((e=>e.clone())).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),l();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");H(o,this._internalGraphicsLayer);const a=await this._setupCreateOperation(e,t);if(null==a||this.destroyed)return void o.map.remove(this._internalGraphicsLayer);const r=()=>{if(a===this._operationHandle){const t=this.createGraphic,o=this._operationHandle.cancelled;this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map&&this.view.map.remove(this._internalGraphicsLayer),a.cancelled||null==t||i.add(t),this.emit("create",{graphic:t,state:o?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"})}};a.on("complete",r),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),l();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some((e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0))))return;const s=await this._setupUpdateOperation(r,t);this.destroyed||null==s||le(s)||(H(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){this._beginAsyncOperation(),e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||T(o.geometry.spatialReference,t.spatialReference)||(_(o.geometry.spatialReference,t.spatialReference)||b()||await w(),o.geometry=G(o.geometry,t.spatialReference));this._endAsyncOperation()}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach((e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)}));const i=await t.hitTest(e,{exclude:o});return K(i.results)}const o=[t.map.ground];t.map.allLayers.forEach((e=>{S(e.type)&&o.push(e)}));const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?f(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",(async t=>{const o="active"===this.state&&"create"===this._operationHandle?.type;if("disabled"===this.state||o||!this.updateOnGraphicClick)return;this._beginAsyncOperation();const i=await t.async((()=>this._getFirstHit(W(t))));let a=null;if(null!=i){const o=i.graphic;this.updateGraphics.includes(o)||o.layer===this.layer?(t.stopPropagation(),a=o):"2d"!==e.type||this._isComponentGraphic(o)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==a||this.updateGraphics.includes(a)||await this.update([a],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}}),this._endAsyncOperation()}),R.WIDGET)]}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a=await this._setupDrawGraphicTool(e,o,i);return null==a?null:(o.tools.add(a),o.activeTool=a,this._setupCreateOperationHandle(a))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,c="rectangle"===e||"circle"===e?"hybrid":"click",h=l??"rectangle"!==e,d={centered:"rectangle"!==e&&!("circle"===e&&!h),cursor:i,defaultZ:a,forceUniformSize:h,graphicProperties:n,geometryToPlace:s,geometryType:e,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:r,mode:p??c,snappingManager:this.snappingManager,snapToScene:!1,view:t};return"2d"===t.type?this._makeDrawGraphicTool2D(d):this._makeDrawGraphicTool3D(d)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return le(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:oe(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(t)||this.destroyed)return null;const{elevationInfo:o}=this.layer;return new t.module.DrawGraphicTool3D({...e,elevationInfo:o,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e){const t=this.view;if(!t)return this._logMissingView(),null;let o=null;const i=e.forceUniformSize,a=e.centered,s=[t.on("key-down",(t=>{if(t.key===j.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===j.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==j.vertexAdd||t.repeat)t.key===j.undo?(t.stopPropagation(),n.undo()):t.key===j.redo?(t.stopPropagation(),n.redo()):t.key!==j.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===j.center&&(t.repeat||(e.centered=!a,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}}),R.WIDGET),t.on("key-up",(t=>{t.key===j.pan?e.enabled=!0:t.key!==j.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===j.center&&(e.centered=a,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())}),R.WIDGET),e.on("vertex-add",(t=>{switch(o=null==o?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:o,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}})),e.on("cursor-update",(t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})})),e.on("vertex-remove",(t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}})),e.on("complete",(e=>{this._set("createGraphic",e.graphic),o="complete",e.aborted?n&&n.cancel():n&&n.complete()})),d((()=>this._getGraphicSymbolFromTool(e.geometryType)),(t=>{e.graphicSymbol=t}))],n=new Z({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{r(s),t.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this;if(!i)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let r=a.tool??Q.tool;for(const s of e)o.remove(s),o.add(s);if("3d"===i.type){if(0===e.length)return null;switch(r){case"move":return this._setupMove3DOperation(e,a,i,r);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,i);case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(r){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,r,a,i);case"transform":if(1===e.length){const t=e[0].geometry?.type;"point"!==t&&"multipoint"!==t||(r="reshape")}return this._setupTransformOrReshape2DOperation(e,r,a,i)}}async _setupMove3DOperation(e,t,o,i,a=!1){const s=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(s))return s;const{ManipulatedObject3DGraphic:n,MoveTool3D:p}=s.module,l=new Map,c=()=>{l.forEach((e=>e.destroy())),l.clear()};for(const r of e){const e=new n({view:o,graphic:r}),t=M(e);if(t!==A.SUPPORTED)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${k(t)}).`),null;l.set(r,e)}const h=new p({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(h),h.objects.addMany(Array.from(l.values())),a||this.updateGraphics.addMany(e);const d=[],u=new q({activeComponent:h,tool:i,type:"update",onEnd:()=>{r(d),pe(o,h),c()},undo:()=>{se(this.view,h),ie(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ae(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new n({view:o,graphic:e});l.set(e,t),h.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach((e=>e.updates.splice(t,1))),u.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=l.get(e);o&&(h.objects.remove(o),o.destroy(),l.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._setupReshape3DOperation(e,t,o,!0);a&&!le(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return d.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(u,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)}),R.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&D(e[0])===A.SUPPORTED){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:s,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:c}=p.module,h=new c({graphic:e,view:o}),d=new l({object:h,view:o,enableRotation:a,enableScaling:s,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],y=new q({activeComponent:d,tool:i,type:"update",onEnd:()=>{r(u),pe(o,d),h.destroy()},undo:()=>{se(this.view,d),ie(y,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ae(y,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);le(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(y,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)}),R.WIDGET)),y}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,c=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(c))return c;const{ManipulatedObject3DGraphic:h,ExtentTransformTool:d}=c.module,u=this.view?.inputManager?.isModifierKeyDown(j.constraint),y=new h({view:o,graphic:e}),m=new d({object:y,view:o,enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!u,sketchOptions:this.sketchOptions});o.tools.add(m),i||this.updateGraphics.add(e);const g=[],v=new q({activeComponent:m,tool:a,type:"update",onEnd:()=>{r(g),pe(o,m),y.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);le(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._setupReshape3DOperation(e,t,o,!0);i&&!le(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return g.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(v,e,t)),R.WIDGET),o.on("key-down",(e=>this._getCommonUpdateOperationKeyDownHandlers(v,e)),R.WIDGET),o.on("key-down",(e=>{e.key!==j.constraint||e.repeat||(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())}),R.WIDGET),o.on("key-up",(e=>{e.key===j.constraint&&(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())}),R.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a=await this._getGraphicMover(e,t,o);if(le(a))return a;const s=new q({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._displayDefaultCursor(),r(l),r(p),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();ie(s,e),s.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ae(s,e),s.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updateSpatialReference(e),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach((e=>e.updates.splice(t,1))),s.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:s.complete()}});let n=!1;const p=[o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(s,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key!==j.constraint||e.repeat||(n=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),R.WIDGET),o.on("key-up",(e=>{e.key===j.constraint&&n&&(n=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),R.WIDGET)],l=this._getHandlesForComponent(s,t);return s}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",s=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(s))return s;const{ManipulatedObject3DGraphic:n,ReshapeTool3D:p}=s.module,l=new n({view:o,graphic:e}),c=C(l);if(c!==A.SUPPORTED)return l.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${k(c)}).`),null;const h=t.reshapeOptions,d=new p({view:o,object:l,enableZVertex:t.enableZ&&"move"===h?.vertexOperation,enableZShape:t.enableZ&&"move"===h?.shapeOperation,enableMoveObject:"move"===h?.shapeOperation||"move-xy"===h?.shapeOperation,enableMidpoints:"split"===h?.edgeOperation,enableEdgeOffset:"offset"===h?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),i||this.updateGraphics.add(l.graphic);const u=[],y=new q({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),pe(o,d),l.destroy()},canUndo:()=>!d.destroyed&&d.canUndo,undo:()=>{d.destroyed||(d.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!d.destroyed&&d.canRedo,redo:()=>{d.destroyed||(d.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);le(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;y.onEnd(),y.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);le(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(y,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)}),R.WIDGET)),y}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(le(a))return a;const s=new q({activeComponent:a,type:"update",onEnd:()=>{r(p),r(n),s.activeComponent&&!s.activeComponent.destroyed&&s.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{ie(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},redo:()=>{ae(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},addToSelection:async e=>{let t=s.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),s.onEnd(),s.destroy();const a=await this._setupTransformOrReshape2DOperation(t,"transform",o,i);if(le(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),s.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach((e=>e.updates.splice(t,1))),s.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();if(0===o.length)s.complete();else{const e=o[0].geometry;1!==o.length||null==e||"point"!==e.type&&"multipoint"!==e.type?s.activeComponent.graphics=o:s.toggleTool()}this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===s.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===s.tool&&"extent"===t.type))return;let a=null;"transform"===s.tool?a=await this._getReshape([e],o,i):"reshape"===s.tool&&(a=await this._getBox([e],o,i)),le(a)||(s.activeComponent?.destroy(),s.activeComponent=a,s.activeComponent&&(r(p),p=this._getHandlesForComponent(s,o)))}}),n=[i.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(s,e,o)),R.WIDGET),i.on("key-down",(e=>{if(this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key===j.constraint&&!e.repeat&&s){const e=s.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),R.WIDGET),i.on("key-up",(e=>{if(e.key===j.constraint&&s){const e=s.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),R.WIDGET)];let p=this._getHandlesForComponent(s,o);return s}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return le(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayGrabbingCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayPointerCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayPointerCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(le(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(j.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const i="split"===t.reshapeOptions?.edgeOperation,a="move"===t.reshapeOptions?.shapeOperation,r=!!t.highlightOptions?.enabled,s=await this._requireModule(import("../../views/draw/support/Reshape.js"));return le(s)?s:new s.module.default({enableMidpoints:i,enableMovement:a,graphic:e[0],highlightsEnabled:r,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map((e=>O(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map((e=>O(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",(({graphic:t,viewEvent:o})=>{o.native?.shiftKey&&(o.stopPropagation(),e.removeFromSelection(t))})),o.on("graphic-move-start",(t=>e.addToHistory(ne(t.allGraphics))))];case"box":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(ne(t.graphics)))),o.on("rotate-start",(t=>e.addToHistory(ne(t.graphics)))),o.on("scale-start",(t=>e.addToHistory(ne(t.graphics))))];case"reshape":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(ne([t.mover])))),o.on("reshape-start",(t=>e.addToHistory(ne([t.graphic])))),o.on("vertex-add",(t=>e.addToHistory(ne([t.oldGraphic])))),o.on("vertex-remove",(t=>e.addToHistory(ne([t.oldGraphic]))))];case"move-3d":return[o.events.on("record-undo",(({updates:t})=>{e.addToHistory({updates:t})})),o.events.on("move-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})})),o.events.on("move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})})),o.events.on("move-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})})),o.events.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()}))];case"transform-3d":return[o.events.on("record-undo",(({updates:t})=>{e.addToHistory({updates:t})})),o.events.on("translate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})})),o.events.on("translate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})})),o.events.on("rotate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})})),o.events.on("rotate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})})),o.events.on("scale-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})})),o.events.on("scale-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})})),o.events.on("translate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})})),o.events.on("rotate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})})),o.events.on("scale",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})})),o.events.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()}))];case"reshape-3d":return[o.events.on("reshape",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})})),o.events.on("move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})})),o.events.on("vertex-add",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.events.on("vertex-remove",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.events.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()}))]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&i.layer===this.layer?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=W(t),a=await t.async((()=>this._getFirstHit(i)));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some((e=>null!=e&&(!(!i||e.layer!==this.layer)&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0))))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===j.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===j.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===j.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&j.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=n(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_displayPointerCursor(){this.view?.container&&"pointer"!==this.view.cursor&&(this.view.cursor="pointer")}_displayGrabbingCursor(){this.view?.container&&"grabbing"!==this.view.cursor&&(this.view.cursor="grabbing")}_displayDefaultCursor(){this.view?.container&&null!==this.view.cursor&&(this.view.cursor=null)}_logError(e,t,o){s.getLogger(this).error(new i(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}get test(){}wait(){return y((()=>!this.updating))}_beginAsyncOperation(){this._numUpdating+=1,this.notifyChange("updating")}_endAsyncOperation(){this._numUpdating-=1,this.notifyChange("updating")}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(p(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await c(y((()=>e?.ready)),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",te("view"))}_logMissingLayer(){this._logError(ee,te("layer"))}};e([g()],X.prototype,"_defaultSnappingManager",void 0),e([g()],X.prototype,"updating",null),e([g()],X.prototype,"_operationHandle",void 0),e([g({readOnly:!0})],X.prototype,"activeTool",null),e([g()],X.prototype,"activeTooltip",null),e([g()],X.prototype,"activeFillSymbol",void 0),e([g()],X.prototype,"activeLineSymbol",void 0),e([g()],X.prototype,"activeVertexSymbol",void 0),e([g()],X.prototype,"allowDeleteKey",void 0),e([g({readOnly:!0})],X.prototype,"createGraphic",null),e([g()],X.prototype,"defaultCreateOptions",null),e([g()],X.prototype,"defaultUpdateOptions",null),e([g({type:I,nonNullable:!0})],X.prototype,"labelOptions",null),e([g()],X.prototype,"layer",void 0),e([g({types:t})],X.prototype,"pointSymbol",void 0),e([g({types:t})],X.prototype,"polygonSymbol",void 0),e([g({types:t})],X.prototype,"polylineSymbol",void 0),e([g()],X.prototype,"meshSymbol",void 0),e([g({type:F,nonNullable:!0})],X.prototype,"snappingOptions",null),e([g()],X.prototype,"snappingManager",null),e([g({readOnly:!0})],X.prototype,"state",null),e([g({type:x,nonNullable:!0})],X.prototype,"tooltipOptions",null),e([g({readOnly:!0})],X.prototype,"updateGraphics",void 0),e([g()],X.prototype,"updateOnGraphicClick",void 0),e([g({type:P,nonNullable:!0})],X.prototype,"valueOptions",null),e([g({types:t})],X.prototype,"vertexSymbol",void 0),e([g({value:null})],X.prototype,"view",null),e([g({constructOnly:!0,type:U})],X.prototype,"sketchOptions",void 0),X=e([v("esri.widgets.Sketch.SketchViewModel")],X);const ee="sketch:missing-property",te=e=>`Property '${e}' is missing on SketchViewModel.`;function oe(e){return"polygon"===e||"rectangle"===e||"circle"===e}function ie(e,t){re("undo",e.history.undo,e.history.redo,t)}function ae(e,t){re("redo",e.history.redo,e.history.undo,t)}function re(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach(((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))})),o.push({updates:s})}function se(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function ne(e){return{updates:e.map((({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e}))}}function pe(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function le(e){return"requireError"in e&&"aborted"===e.requireError}const ce=X;export{ce as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{symbolTypes as t}from"../../symbols.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Evented.js";import{drainHandles as r}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as n,abortMaybe as p}from"../../core/maybe.js";import{createAbortError as l,whenOrAbort as c}from"../../core/promiseUtils.js";import{on as h,watch as d,when as u,whenOnce as y,syncAndInitial as m}from"../../core/reactiveUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as f}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as _,load as b,project as w,isLoaded as G}from"../../geometry/projection.js";import{geometryToCoordinates as O}from"../../geometry/support/coordsUtils.js";import{equals as T}from"../../geometry/support/spatialReferenceUtils.js";import E from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as S}from"../../layers/support/layerUtils.js";import{SupportedObjectResult as A,isSupportedObjectResultMessage as k}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as M}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as C}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as D}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as H}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as R}from"../../views/input/InputManager.js";import{sketchKeys as j}from"../../views/interactive/keybindings.js";import I from"../../views/interactive/sketch/SketchLabelOptions.js";import U from"../../views/interactive/sketch/SketchOptions.js";import x from"../../views/interactive/sketch/SketchTooltipOptions.js";import P from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as L}from"../../views/interactive/snapping/SnappingManager.js";import F from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as V}from"../../views/interactive/snapping/snappingUtils.js";import{findFirstGraphicHit as K}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as W}from"../../views/support/screenUtils.js";import{CreateOperationHandle as Z,UpdateOperationHandle as q}from"./support/OperationHandle.js";import z from"../../symbols/SimpleMarkerSymbol.js";import N from"../../symbols/SimpleFillSymbol.js";import B from"../../symbols/SimpleLineSymbol.js";import $ from"../../symbols/MeshSymbol3D.js";import Y from"../../symbols/FillSymbol3DLayer.js";const J={defaultZ:0},Q={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0},tool:"transform"};let X=class extends a.EventedAccessor{constructor(e){super(e),this._numUpdating=0,this._defaultSnappingManager=null,this._internalGraphicsLayer=new E({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new N({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new B({color:[130,130,130,1],width:2}),this.meshSymbol=new $({symbolLayers:new o([new Y])}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.vertexSymbol=new z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new U,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._originalPopupEnabled=null,this.defaultCreateOptions=J,this.defaultUpdateOptions=Q,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new F}initialize(){this.addHandles([h((()=>this.view?.map?.layers),"change",(e=>{e.removed.includes(this.layer)&&this.cancel()})),h((()=>this.layer?.graphics),"change",(e=>{if(null!=this._operationHandle)for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())})),d((()=>this.layer?.elevationInfo??null),(e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)}),m),d((()=>this.view),(e=>{this._defaultSnappingManager=n(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new L({view:e,options:this.snappingOptions})),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))}),m),d((()=>this.view?.spatialReference),((e,t)=>{e&&t&&!e.equals(t)&&this.cancel()}))]),V(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=n(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this.emit("destroy")}get updating(){return this._numUpdating>0||null!=this.snappingManager&&this.snappingManager.updating}get activeTool(){return this._operationHandle?.tool??null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...J,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Q,...e,reshapeOptions:{...Q.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...Q.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=n(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new L({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&(t.cursor=null),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(u((()=>e.ready),(t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)}),m),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=p(this._moduleLoaderAbortController),this._viewReadyAbortController=p(this._viewReadyAbortController),this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e,layer:o}=this,i=t.toArray();o.removeMany(i),this.cancel(),this._emitDeleteEvent({graphics:i,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map((e=>e.clone())).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),l();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");H(o,this._internalGraphicsLayer);const a=await this._setupCreateOperation(e,t);if(null==a||this.destroyed)return void o.map.remove(this._internalGraphicsLayer);const r=()=>{if(a===this._operationHandle){const t=this.createGraphic,o=this._operationHandle.cancelled;this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map&&this.view.map.remove(this._internalGraphicsLayer),a.cancelled||null==t||i.add(t),this.emit("create",{graphic:t,state:o?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"})}};a.on("complete",r),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),l();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some((e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0))))return;const s=await this._setupUpdateOperation(r,t);this.destroyed||null==s||le(s)||(H(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){this._beginAsyncOperation(),e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||T(o.geometry.spatialReference,t.spatialReference)||(_(o.geometry.spatialReference,t.spatialReference)||G()||await b(),o.geometry=w(o.geometry,t.spatialReference));this._endAsyncOperation()}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach((e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)}));const i=await t.hitTest(e,{exclude:o});return K(i.results)}const o=[t.map.ground];t.map.allLayers.forEach((e=>{S(e.type)&&o.push(e)}));const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?f(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",(async t=>{const o="active"===this.state&&"create"===this._operationHandle?.type;if("disabled"===this.state||o||!this.updateOnGraphicClick)return;this._beginAsyncOperation();const i=await t.async((()=>this._getFirstHit(W(t))));let a=null;if(null!=i){const o=i.graphic;this.updateGraphics.includes(o)||o.layer===this.layer?(t.stopPropagation(),a=o):"2d"!==e.type||this._isComponentGraphic(o)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==a||this.updateGraphics.includes(a)||await this.update([a],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}}),this._endAsyncOperation()}),R.WIDGET)]}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a=await this._setupDrawGraphicTool(e,o,i);return null==a?null:(o.tools.add(a),o.activeTool=a,this._setupCreateOperationHandle(a))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,c="rectangle"===e||"circle"===e?"hybrid":"click",h=l??"rectangle"!==e,d={centered:"rectangle"!==e&&!("circle"===e&&!h),cursor:i,defaultZ:a,forceUniformSize:h,graphicProperties:n,geometryToPlace:s,geometryType:e,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:r,mode:p??c,snappingManager:this.snappingManager,snapToScene:!1,view:t};return"2d"===t.type?this._makeDrawGraphicTool2D(d):this._makeDrawGraphicTool3D(d)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return le(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:oe(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(t)||this.destroyed)return null;const{elevationInfo:o}=this.layer;return new t.module.DrawGraphicTool3D({...e,elevationInfo:o,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e){const t=this.view;if(!t)return this._logMissingView(),null;let o=null;const i=e.forceUniformSize,a=e.centered,s=[t.on("key-down",(t=>{if(t.key===j.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===j.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==j.vertexAdd||t.repeat)t.key===j.undo?(t.stopPropagation(),n.undo()):t.key===j.redo?(t.stopPropagation(),n.redo()):t.key!==j.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===j.center&&(t.repeat||(e.centered=!a,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}}),R.WIDGET),t.on("key-up",(t=>{t.key===j.pan?e.enabled=!0:t.key!==j.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===j.center&&(e.centered=a,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())}),R.WIDGET),e.on("vertex-add",(t=>{switch(o=null==o?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:o,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}})),e.on("cursor-update",(t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})})),e.on("vertex-remove",(t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}})),e.on("complete",(e=>{this._set("createGraphic",e.graphic),o="complete",e.aborted?n&&n.cancel():n&&n.complete()})),d((()=>this._getGraphicSymbolFromTool(e.geometryType)),(t=>{e.graphicSymbol=t}))],n=new Z({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{r(s),t.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this;if(!i)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let r=a.tool??Q.tool;for(const s of e)o.remove(s),o.add(s);if("3d"===i.type){if(0===e.length)return null;switch(r){case"move":return this._setupMove3DOperation(e,a,i,r);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,i);case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(r){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,r,a,i);case"transform":if(1===e.length){const t=e[0].geometry?.type;"point"!==t&&"multipoint"!==t||(r="reshape")}return this._setupTransformOrReshape2DOperation(e,r,a,i)}}async _setupMove3DOperation(e,t,o,i,a=!1){const s=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(s))return s;const{ManipulatedObject3DGraphic:n,MoveTool3D:p}=s.module,l=new Map,c=()=>{l.forEach((e=>e.destroy())),l.clear()};for(const r of e){const e=new n({view:o,graphic:r}),t=M(e);if(t!==A.SUPPORTED)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${k(t)}).`),null;l.set(r,e)}const h=new p({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(h),h.objects.addMany(Array.from(l.values())),a||this.updateGraphics.addMany(e);const d=[],u=new q({activeComponent:h,tool:i,type:"update",onEnd:()=>{r(d),pe(o,h),c()},undo:()=>{se(this.view,h),ie(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ae(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new n({view:o,graphic:e});l.set(e,t),h.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach((e=>e.updates.splice(t,1))),u.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=l.get(e);o&&(h.objects.remove(o),o.destroy(),l.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._setupReshape3DOperation(e,t,o,!0);a&&!le(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return d.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(u,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)}),R.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&D(e[0])===A.SUPPORTED){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:s,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:c}=p.module,h=new c({graphic:e,view:o}),d=new l({object:h,view:o,enableRotation:a,enableScaling:s,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],y=new q({activeComponent:d,tool:i,type:"update",onEnd:()=>{r(u),pe(o,d),h.destroy()},undo:()=>{se(this.view,d),ie(y,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ae(y,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);le(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(y,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)}),R.WIDGET)),y}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,c=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(c))return c;const{ManipulatedObject3DGraphic:h,ExtentTransformTool:d}=c.module,u=this.view?.inputManager?.isModifierKeyDown(j.constraint),y=new h({view:o,graphic:e}),m=new d({object:y,view:o,enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!u,sketchOptions:this.sketchOptions});o.tools.add(m),i||this.updateGraphics.add(e);const g=[],v=new q({activeComponent:m,tool:a,type:"update",onEnd:()=>{r(g),pe(o,m),y.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);le(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._setupReshape3DOperation(e,t,o,!0);i&&!le(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return g.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(v,e,t)),R.WIDGET),o.on("key-down",(e=>this._getCommonUpdateOperationKeyDownHandlers(v,e)),R.WIDGET),o.on("key-down",(e=>{e.key!==j.constraint||e.repeat||(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())}),R.WIDGET),o.on("key-up",(e=>{e.key===j.constraint&&(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())}),R.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a=await this._getGraphicMover(e,t,o);if(le(a))return a;const s=new q({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._displayDefaultCursor(),r(l),r(p),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();ie(s,e),s.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ae(s,e),s.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updateSpatialReference(e),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach((e=>e.updates.splice(t,1))),s.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:s.complete()}});let n=!1;const p=[o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(s,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key!==j.constraint||e.repeat||(n=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),R.WIDGET),o.on("key-up",(e=>{e.key===j.constraint&&n&&(n=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),R.WIDGET)],l=this._getHandlesForComponent(s,t);return s}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",s=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(le(s))return s;const{ManipulatedObject3DGraphic:n,ReshapeTool3D:p}=s.module,l=new n({view:o,graphic:e}),c=C(l);if(c!==A.SUPPORTED)return l.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${k(c)}).`),null;const h=t.reshapeOptions,d=new p({view:o,object:l,enableZVertex:t.enableZ&&"move"===h?.vertexOperation,enableZShape:t.enableZ&&"move"===h?.shapeOperation,enableMoveObject:"move"===h?.shapeOperation||"move-xy"===h?.shapeOperation,enableMidpoints:"split"===h?.edgeOperation,enableEdgeOffset:"offset"===h?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),i||this.updateGraphics.add(l.graphic);const u=[],y=new q({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),pe(o,d),l.destroy()},canUndo:()=>!d.destroyed&&d.canUndo,undo:()=>{d.destroyed||(d.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!d.destroyed&&d.canRedo,redo:()=>{d.destroyed||(d.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);le(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;y.onEnd(),y.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);le(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(y,e,t)),R.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)}),R.WIDGET)),y}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(le(a))return a;const s=new q({activeComponent:a,type:"update",onEnd:()=>{r(p),r(n),s.activeComponent&&!s.activeComponent.destroyed&&s.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{ie(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},redo:()=>{ae(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},addToSelection:async e=>{let t=s.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),s.onEnd(),s.destroy();const a=await this._setupTransformOrReshape2DOperation(t,"transform",o,i);if(le(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),s.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach((e=>e.updates.splice(t,1))),s.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();if(0===o.length)s.complete();else{const e=o[0].geometry;1!==o.length||null==e||"point"!==e.type&&"multipoint"!==e.type?s.activeComponent.graphics=o:s.toggleTool()}this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===s.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===s.tool&&"extent"===t.type))return;let a=null;"transform"===s.tool?a=await this._getReshape([e],o,i):"reshape"===s.tool&&(a=await this._getBox([e],o,i)),le(a)||(s.activeComponent?.destroy(),s.activeComponent=a,s.activeComponent&&(r(p),p=this._getHandlesForComponent(s,o)))}}),n=[i.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(s,e,o)),R.WIDGET),i.on("key-down",(e=>{if(this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key===j.constraint&&!e.repeat&&s){const e=s.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),R.WIDGET),i.on("key-up",(e=>{if(e.key===j.constraint&&s){const e=s.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),R.WIDGET)];let p=this._getHandlesForComponent(s,o);return s}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return le(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayGrabbingCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayPointerCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayPointerCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(le(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(j.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const i="split"===t.reshapeOptions?.edgeOperation,a="move"===t.reshapeOptions?.shapeOperation,r=!!t.highlightOptions?.enabled,s=await this._requireModule(import("../../views/draw/support/Reshape.js"));return le(s)?s:new s.module.default({enableMidpoints:i,enableMovement:a,graphic:e[0],highlightsEnabled:r,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map((e=>O(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map((e=>O(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",(({graphic:t,viewEvent:o})=>{o.native?.shiftKey&&(o.stopPropagation(),e.removeFromSelection(t))})),o.on("graphic-move-start",(t=>e.addToHistory(ne(t.allGraphics))))];case"box":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(ne(t.graphics)))),o.on("rotate-start",(t=>e.addToHistory(ne(t.graphics)))),o.on("scale-start",(t=>e.addToHistory(ne(t.graphics))))];case"reshape":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(ne([t.mover])))),o.on("reshape-start",(t=>e.addToHistory(ne([t.graphic])))),o.on("vertex-add",(t=>e.addToHistory(ne([t.oldGraphic])))),o.on("vertex-remove",(t=>e.addToHistory(ne([t.oldGraphic]))))];case"move-3d":return[o.events.on("record-undo",(({updates:t})=>{e.addToHistory({updates:t})})),o.events.on("move-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})})),o.events.on("move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})})),o.events.on("move-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})})),o.events.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()}))];case"transform-3d":return[o.events.on("record-undo",(({updates:t})=>{e.addToHistory({updates:t})})),o.events.on("translate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})})),o.events.on("translate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})})),o.events.on("rotate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})})),o.events.on("rotate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})})),o.events.on("scale-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})})),o.events.on("scale-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})})),o.events.on("translate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})})),o.events.on("rotate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})})),o.events.on("scale",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})})),o.events.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()}))];case"reshape-3d":return[o.events.on("reshape",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})})),o.events.on("move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})})),o.events.on("vertex-add",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.events.on("vertex-remove",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.events.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()}))]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&i.layer===this.layer?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=W(t),a=await t.async((()=>this._getFirstHit(i)));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some((e=>null!=e&&(!(!i||e.layer!==this.layer)&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0))))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===j.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===j.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===j.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&j.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=n(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_displayPointerCursor(){this.view?.container&&"pointer"!==this.view.cursor&&(this.view.cursor="pointer")}_displayGrabbingCursor(){this.view?.container&&"grabbing"!==this.view.cursor&&(this.view.cursor="grabbing")}_displayDefaultCursor(){this.view?.container&&null!==this.view.cursor&&(this.view.cursor=null)}_logError(e,t,o){s.getLogger(this).error(new i(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}get test(){}wait(){return y((()=>!this.updating))}_beginAsyncOperation(){this._numUpdating+=1,this.notifyChange("updating")}_endAsyncOperation(){this._numUpdating-=1,this.notifyChange("updating")}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(p(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await c(y((()=>e?.ready)),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",te("view"))}_logMissingLayer(){this._logError(ee,te("layer"))}};e([g()],X.prototype,"_defaultSnappingManager",void 0),e([g()],X.prototype,"updating",null),e([g()],X.prototype,"_operationHandle",void 0),e([g({readOnly:!0})],X.prototype,"activeTool",null),e([g()],X.prototype,"activeTooltip",null),e([g()],X.prototype,"activeFillSymbol",void 0),e([g()],X.prototype,"activeLineSymbol",void 0),e([g()],X.prototype,"activeVertexSymbol",void 0),e([g()],X.prototype,"allowDeleteKey",void 0),e([g({readOnly:!0})],X.prototype,"createGraphic",null),e([g()],X.prototype,"defaultCreateOptions",null),e([g()],X.prototype,"defaultUpdateOptions",null),e([g({type:I,nonNullable:!0})],X.prototype,"labelOptions",null),e([g()],X.prototype,"layer",void 0),e([g({types:t})],X.prototype,"pointSymbol",void 0),e([g({types:t})],X.prototype,"polygonSymbol",void 0),e([g({types:t})],X.prototype,"polylineSymbol",void 0),e([g()],X.prototype,"meshSymbol",void 0),e([g({type:F,nonNullable:!0})],X.prototype,"snappingOptions",null),e([g()],X.prototype,"snappingManager",null),e([g({readOnly:!0})],X.prototype,"state",null),e([g({type:x,nonNullable:!0})],X.prototype,"tooltipOptions",null),e([g({readOnly:!0})],X.prototype,"updateGraphics",void 0),e([g()],X.prototype,"updateOnGraphicClick",void 0),e([g({type:P,nonNullable:!0})],X.prototype,"valueOptions",null),e([g({types:t})],X.prototype,"vertexSymbol",void 0),e([g({value:null})],X.prototype,"view",null),e([g({constructOnly:!0,type:U})],X.prototype,"sketchOptions",void 0),X=e([v("esri.widgets.Sketch.SketchViewModel")],X);const ee="sketch:missing-property",te=e=>`Property '${e}' is missing on SketchViewModel.`;function oe(e){return"polygon"===e||"rectangle"===e||"circle"===e}function ie(e,t){re("undo",e.history.undo,e.history.redo,t)}function ae(e,t){re("redo",e.history.redo,e.history.undo,t)}function re(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach(((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))})),o.push({updates:s})}function se(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function ne(e){return{updates:e.map((({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e}))}}function pe(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function le(e){return"requireError"in e&&"aborted"===e.requireError}const ce=X;export{ce 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import{on as s,initial as o}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import a from"./LayerList/LayerListItem.js";import{minDragEnabledItems as d,minFilterItems as m,getLayerType as c,removeDestroyedListItems as p}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{calciteListFilterProps as g}from"./support/listUtils.js";import{setFocus as f}from"./support/widgetUtils.js";import{messageBundle as I}from"./support/decorators/messageBundle.js";import{vmEvent as b}from"./support/decorators/vmEvent.js";import{tsx as v}from"./support/jsxFactory.js";import{css as _}from"./TableList/css.js";import w from"./TableList/ListItem.js";import y from"./TableList/TableListViewModel.js";import L from"./TableList/TableListVisibleElements.js";import{getItem as C,sortTablesToIds as E}from"./TableList/support/tableListUtils.js";const F="flat",M=t.ofType(w);let P=class extends(i.IdentifiableMixin(n)){constructor(e,t){super(e,t),this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`table-${this.uid}`,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=d,this.minFilterItems=m,this.selectedItems=new M,this.selectionMode="none",this.viewModel=new y,this.visibleElements=new L,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=C(e);if(!l?.sortable)return!1;const r=C(t),n=c(t),a=C(i),d=c(i),m=!!n&&!!d&&n===d,p={selected:l,from:r,to:a},h=t.group,u=i.group;return h&&u&&"function"==typeof o?o.call(null,p):m},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=o.value;const r=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));E(this.map?.tables,r)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0}}initialize(){this.addHandles(s((()=>this.viewModel.tableItems),"change",(()=>p(this.selectedItems)),o))}loadDependencies(){return h({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get _dragEnabled(){return this.viewModel.totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get _visibleItems(){return this.tableItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get icon(){return"table"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get tableItems(){return this.viewModel.tableItems}get tables(){return this.viewModel.tables}set tables(e){this.viewModel.tables=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,{_visibleItems:t}=this,i={[u.hidden]:"loading"===e,[u.disabled]:"disabled"===e};return v("div",{class:this.classes(_.base,u.widget,u.panel,i)},t?.length?this._renderItems():this._renderNoItems())}_renderNoItemsMessage(){return v("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return v("div",{class:_.itemMessage,key:"esri-layer-list__no-items"},v("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(){const{_openedPanelItems:e}=this;return e.toArray().map((({title:t,panel:i},s)=>{const o=()=>this._handlePanelFlowItemBack(i);return v("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:t,heading:i.title,headingLevel:this.headingLevel,key:`flow-panel-${i.uid}`,selected:s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),o()}},i.render(),v("calcite-button",{appearance:"transparent",onclick:o,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,f(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,f(e))}_renderItems(){const{visible:e,collapsed:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},_dragEnabled:r,_visibleItems:n,_filterEnabled:a,_rootGroupUid:d,_openedPanelItems:m,selectionMode:c,messages:p,filterPlaceholder:h,filterText:u}=this,f=[v("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!e,collapsed:t,collapsible:s,heading:o?p.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!m.length,onCalciteFlowItemClose:()=>this.visible=!1},v("calcite-list",{canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":d,displayMode:F,dragEnabled:r,filterEnabled:a,filterPlaceholder:h,filterProps:g,filterText:a?u:"",group:d,key:"root-list",label:p.widgetLabel,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},n?.toArray().map((e=>this._renderItem(e))),n?.length&&a?v("div",{class:_.filterNoResults,slot:"filter-no-results"},v("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems()];return e?l?v("calcite-flow",{key:"root-flow"},f):f:null}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_renderItem(e){return v(a,{canMove:this._canMove,css:_,displayMode:F,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange})}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>C(e))).filter(Boolean);i.removeAll(),i.addMany(s)}};e([l()],P.prototype,"_focusRootFlowItem",void 0),e([l()],P.prototype,"_focusPanelFlowItem",void 0),e([l()],P.prototype,"_dragEnabled",null),e([l()],P.prototype,"_filterEnabled",null),e([l()],P.prototype,"_visibleItems",null),e([l()],P.prototype,"_openedPanelItems",null),e([l()],P.prototype,"collapsed",void 0),e([l()],P.prototype,"dragEnabled",void 0),e([l()],P.prototype,"filterPlaceholder",void 0),e([l()],P.prototype,"filterText",void 0),e([l()],P.prototype,"headingLevel",void 0),e([l()],P.prototype,"icon",null),e([l()],P.prototype,"label",null),e([l()],P.prototype,"listItemCanGiveFunction",void 0),e([l()],P.prototype,"listItemCanReceiveFunction",void 0),e([l()],P.prototype,"listItemCreatedFunction",null),e([l()],P.prototype,"map",null),e([l(),I("esri/widgets/TableList/t9n/TableList")],P.prototype,"messages",void 0),e([l(),I("esri/t9n/common")],P.prototype,"messagesCommon",void 0),e([l()],P.prototype,"minDragEnabledItems",void 0),e([l()],P.prototype,"minFilterItems",void 0),e([l()],P.prototype,"selectedItems",void 0),e([l()],P.prototype,"selectionMode",void 0),e([l({readOnly:!0})],P.prototype,"tableItems",null),e([l()],P.prototype,"tables",null),e([b("trigger-action"),l({type:y})],P.prototype,"viewModel",void 0),e([l({type:L,nonNullable:!0})],P.prototype,"visibleElements",void 0),P=e([r("esri.widgets.TableList")],P);const j=P;export{j as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import{on as o,watch as s,initial as l}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import d from"./LayerList/LayerListItem.js";import{minDragEnabledItems as c,minFilterItems as m,getLayerType as p,removeDestroyedListItems as h,setFilterPredicate as u}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as f}from"./support/globalCss.js";import{calciteListFilterProps as I}from"./support/listUtils.js";import{setFocus as b}from"./support/widgetUtils.js";import{messageBundle as _}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as y}from"./support/jsxFactory.js";import{css as w}from"./TableList/css.js";import L from"./TableList/ListItem.js";import E from"./TableList/TableListViewModel.js";import C from"./TableList/TableListVisibleElements.js";import{getItem as F,sortTablesToIds as M}from"./TableList/support/tableListUtils.js";const P="flat",j=t.ofType(L);let D=class extends(i.IdentifiableMixin(a)){constructor(e,t){super(e,t),this._rootListEl=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`table-${this.uid}`,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=c,this.minFilterItems=m,this.selectedItems=new j,this.selectionMode="none",this.viewModel=new E,this.visibleElements=new C,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=F(e);if(!l?.sortable)return!1;const r=F(t),n=p(t),a=F(i),d=p(i),c=!!n&&!!d&&n===d,m={selected:l,from:r,to:a},h=t.group,u=i.group;return h&&u&&"function"==typeof s?s.call(null,m):c},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(!o||!i||t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value;const r=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));M(this.map?.tables,r)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0}}initialize(){this.addHandles([o((()=>this.viewModel.tableItems),"change",(()=>h(this.selectedItems)),l),s((()=>[this.filterPredicate,this._rootListEl]),(()=>u(this._rootListEl,this.filterPredicate)))])}loadDependencies(){return g({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get _dragEnabled(){return this.viewModel.totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get _visibleItems(){return this.tableItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get icon(){return"table"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get tableItems(){return this.viewModel.tableItems}get tables(){return this.viewModel.tables}set tables(e){this.viewModel.tables=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,{_visibleItems:t}=this,i={[f.hidden]:"loading"===e,[f.disabled]:"disabled"===e};return y("div",{class:this.classes(w.base,f.widget,f.panel,i)},t?.length?this._renderItems():this._renderNoItems())}_renderNoItemsMessage(){return y("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return y("div",{class:w.itemMessage,key:"esri-layer-list__no-items"},y("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(){const{_openedPanelItems:e}=this;return e.toArray().map((({title:t,panel:i},o)=>{const s=()=>this._handlePanelFlowItemBack(i);return y("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:t,heading:i.title,headingLevel:this.headingLevel,key:`flow-panel-${i.uid}`,selected:o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),s()}},i.render(),y("calcite-button",{appearance:"transparent",onclick:s,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,b(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,b(e))}_renderItems(){const{visible:e,collapsed:t,visibleElements:{closeButton:i,collapseButton:o,heading:s,flow:l},_dragEnabled:r,_visibleItems:n,_filterEnabled:a,_rootGroupUid:d,_openedPanelItems:c,selectionMode:m,messages:p,filterPlaceholder:h,filterText:u}=this,g=[y("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!e,collapsed:t,collapsible:o,heading:s?p.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!c.length,onCalciteFlowItemClose:()=>this.visible=!1},y("calcite-list",{afterCreate:e=>{this._rootListEl=e},afterRemoved:()=>{this._rootListEl=null},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":d,displayMode:P,dragEnabled:r,filterEnabled:a,filterPlaceholder:h,filterProps:I,filterText:a?u:"",group:d,key:"root-list",label:p.widgetLabel,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},n?.toArray().map((e=>this._renderItem(e))),n?.length&&a?y("div",{class:w.filterNoResults,slot:"filter-no-results"},y("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems()];return e?l?y("calcite-flow",{key:"root-flow"},g):g:null}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_renderItem(e){return y(d,{canMove:this._canMove,css:w,displayMode:P,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange})}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>F(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([r()],D.prototype,"_rootListEl",void 0),e([r()],D.prototype,"_focusRootFlowItem",void 0),e([r()],D.prototype,"_focusPanelFlowItem",void 0),e([r()],D.prototype,"_dragEnabled",null),e([r()],D.prototype,"_filterEnabled",null),e([r()],D.prototype,"_visibleItems",null),e([r()],D.prototype,"_openedPanelItems",null),e([r()],D.prototype,"collapsed",void 0),e([r()],D.prototype,"dragEnabled",void 0),e([r()],D.prototype,"filterPlaceholder",void 0),e([r()],D.prototype,"filterPredicate",void 0),e([r()],D.prototype,"filterText",void 0),e([r()],D.prototype,"headingLevel",void 0),e([r()],D.prototype,"icon",null),e([r()],D.prototype,"label",null),e([r()],D.prototype,"listItemCanGiveFunction",void 0),e([r()],D.prototype,"listItemCanReceiveFunction",void 0),e([r()],D.prototype,"listItemCreatedFunction",null),e([r()],D.prototype,"map",null),e([r(),_("esri/widgets/TableList/t9n/TableList")],D.prototype,"messages",void 0),e([r(),_("esri/t9n/common")],D.prototype,"messagesCommon",void 0),e([r()],D.prototype,"minDragEnabledItems",void 0),e([r()],D.prototype,"minFilterItems",void 0),e([r()],D.prototype,"selectedItems",void 0),e([r()],D.prototype,"selectionMode",void 0),e([r({readOnly:!0})],D.prototype,"tableItems",null),e([r()],D.prototype,"tables",null),e([v("trigger-action"),r({type:E})],D.prototype,"viewModel",void 0),e([r({type:C,nonNullable:!0})],D.prototype,"visibleElements",void 0),D=e([n("esri.widgets.TableList")],D);const T=D;export{T 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../Color.js";import{watch as t,syncAndInitial as r}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import n from"../Widget.js";import{loadCalciteComponents as a}from"./componentsUtils.js";import"./widgetUtils.js";import{messageBundle as p}from"./decorators/messageBundle.js";import{tsx as c}from"./jsxFactory.js";const l="esri-color-picker",u={base:l,backgroundPattern:`${l}__bg-pattern`,toggleButton:`${l}__toggle-button`,popover:`${l}__popover`};let d=class extends n{constructor(e,t){super(e,t),this.value=new o,this.alphaEnabled=!0,this._containerElement=null,this._button=null,this._open=!1,this._onColorInput=e=>{const t=e.currentTarget.value,r="string"==typeof t?new o(t):new o;this.value=r,this.onChange?.(r)}}initialize(){this.addHandles(t((()=>({container:this._containerElement,value:this.value})),(({container:e,value:o})=>{e?.style.setProperty("--esri-color-picker-value",o.toCss(!0))}),r))}loadDependencies(){return a({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),"color-picker":()=>import("@esri/calcite-components/dist/components/calcite-color-picker"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}render(){const e=this._messages,o=this._open?e.close:e.open;return c("div",{afterCreate:e=>this._containerElement=e,class:this.classes(u.base,this.class)},c("div",{class:u.backgroundPattern,key:"background-pattern"}),c("calcite-button",{afterCreate:e=>this._button=e,appearance:"transparent",class:u.toggleButton,key:"popover-trigger",kind:"neutral",label:o,scale:"s",tabIndex:-1,title:o}),c("calcite-popover",{autoClose:!0,class:u.popover,key:"popover",label:e.label,overlayPositioning:"fixed",referenceElement:this._button,onCalcitePopoverClose:()=>this._open=!1,onCalcitePopoverOpen:()=>this._open=!0},c("calcite-color-picker",{alphaChannel:this.alphaEnabled,channelsDisabled:!0,key:"color-picker",savedDisabled:!0,value:this.value.toCss(),onCalciteColorPickerInput:this._onColorInput})))}};e([s()],d.prototype,"class",void 0),e([s()],d.prototype,"value",void 0),e([s()],d.prototype,"alphaEnabled",void 0),e([s()],d.prototype,"onChange",void 0),e([s()],d.prototype,"_containerElement",void 0),e([s()],d.prototype,"_button",void 0),e([s()],d.prototype,"_open",void 0),e([s(),p("esri/widgets/support/t9n/ColorPicker")],d.prototype,"_messages",void 0),d=e([i("esri.widgets.support.ColorPicker")],d);export{d as ColorPicker};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../Color.js";import{watch as t,syncAndInitial as r}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import n from"../Widget.js";import{loadCalciteComponents as a}from"./componentsUtils.js";import"./widgetUtils.js";import{messageBundle as p}from"./decorators/messageBundle.js";import{tsx as c}from"./jsxFactory.js";const l="esri-color-picker",u={base:l,backgroundPattern:`${l}__bg-pattern`,toggleButton:`${l}__toggle-button`,popover:`${l}__popover`};let d=class extends n{constructor(e,t){super(e,t),this.value=new o,this.alphaEnabled=!0,this._containerElement=null,this._button=null,this._open=!1,this._onColorInput=e=>{const t=e.currentTarget.value,r="string"==typeof t?new o(t):new o;this.value=r,this.onChange?.(r)}}initialize(){this.addHandles(t((()=>({container:this._containerElement,value:this.value})),(({container:e,value:o})=>{e?.style.setProperty("--esri-color-picker-value",o.toCss(!0))}),r))}loadDependencies(){return a({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),"color-picker":()=>import("@esri/calcite-components/dist/components/calcite-color-picker"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}render(){const e=this._messages,o=this._open?e.close:e.open;return c("div",{afterCreate:e=>this._containerElement=e,class:this.classes(u.base,this.class)},c("div",{class:u.backgroundPattern,key:"background-pattern"}),c("calcite-button",{afterCreate:e=>this._button=e,appearance:"transparent",class:u.toggleButton,key:"popover-trigger",kind:"neutral",label:o,scale:"s",tabIndex:-1,title:o}),c("calcite-popover",{autoClose:!0,class:u.popover,key:"popover",label:e.label,overlayPositioning:"fixed",referenceElement:this._button,onCalcitePopoverClose:()=>this._open=!1,onCalcitePopoverOpen:()=>this._open=!0},c("calcite-color-picker",{alphaChannel:this.alphaEnabled,channelsDisabled:!0,key:"color-picker",savedDisabled:!0,value:this.value.toCss(!0),onCalciteColorPickerInput:this._onColorInput})))}};e([s()],d.prototype,"class",void 0),e([s()],d.prototype,"value",void 0),e([s()],d.prototype,"alphaEnabled",void 0),e([s()],d.prototype,"onChange",void 0),e([s()],d.prototype,"_containerElement",void 0),e([s()],d.prototype,"_button",void 0),e([s()],d.prototype,"_open",void 0),e([s(),p("esri/widgets/support/t9n/ColorPicker")],d.prototype,"_messages",void 0),d=e([i("esri.widgets.support.ColorPicker")],d);export{d as ColorPicker};