@arcgis/core 5.0.0-next.32 → 5.0.0-next.34

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 (285) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{9252854b512237b6a0ef.js → 0446562aee0639c61485.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{b56c07c0b43cb1999070.js → 1fa55d4c4b092a98bdd7.js} +1 -1
  4. package/assets/esri/core/workers/chunks/22f745539ca54d8cd30d.js +1 -0
  5. package/assets/esri/core/workers/chunks/2613e482450b57f2d4f5.js +1 -0
  6. package/assets/esri/core/workers/chunks/{e7f4d135ef9665de1468.js → 33431e8131f6017de2f9.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{1dfca37f95f2b968aa54.js → 39d2b540738431adec98.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{096e5f94eaa226814569.js → 4356274cfa477eb6d749.js} +1 -1
  9. package/assets/esri/core/workers/chunks/44b6b7418cbf7f778bef.js +1 -0
  10. package/assets/esri/core/workers/chunks/4675ed3ca3e0104d00bf.js +1 -0
  11. package/assets/esri/core/workers/chunks/{25fd0884dd14973c89f5.js → 486e69261aa2caf9ec3c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{3c1e50c3505e5e7c946a.js → 4d5591c1b4ef37075921.js} +1 -1
  13. package/assets/esri/core/workers/chunks/4df7cc3477bc46fc39af.js +1 -0
  14. package/assets/esri/core/workers/chunks/52ecbaa2d32692d6d8df.js +1 -0
  15. package/assets/esri/core/workers/chunks/{3777b41b4fa2f1418402.js → 55818fe7a7aa1e5c8bbd.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{d21ae4980741be98f948.js → 59889855d23baec1adf9.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{7e6fae3660e7a6a0fa16.js → 5f781ef46ce7c4048c2f.js} +1 -1
  18. package/assets/esri/core/workers/chunks/5f9e64f00329cb646f0c.js +1 -0
  19. package/assets/esri/core/workers/chunks/61cb30e2e8edd18ebbf0.js +1 -0
  20. package/assets/esri/core/workers/chunks/63933cbcb5c12df09715.js +1 -0
  21. package/assets/esri/core/workers/chunks/706423d801fa9cbf2e90.js +1 -0
  22. package/assets/esri/core/workers/chunks/{e6df4327ac1d9b65b80d.js → 71dd80231ea656a6380c.js} +1 -1
  23. package/assets/esri/core/workers/chunks/725819839434c59102f3.js +1 -0
  24. package/assets/esri/core/workers/chunks/{d786b17cc9062b1450ac.js → 726a797f5df7eeee0b3d.js} +1 -1
  25. package/assets/esri/core/workers/chunks/72cebf18da5ec5eeb666.js +1 -0
  26. package/assets/esri/core/workers/chunks/{bd58c027408dc858f23c.js → 77b45957cfe42523c1c8.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{a2cee5ac0d4df0108425.js → 82cc758bddd9f8397b9f.js} +1 -1
  28. package/assets/esri/core/workers/chunks/852de585a72d902344a6.js +1 -0
  29. package/assets/esri/core/workers/chunks/871dd5e1f016a04b8d98.js +1 -0
  30. package/assets/esri/core/workers/chunks/892c417f5130b003889d.js +1 -0
  31. package/assets/esri/core/workers/chunks/907083c427d7fb4354e9.js +1 -0
  32. package/assets/esri/core/workers/chunks/{433d249c35c56bf15806.js → 97650ee3d0eecb69ccbb.js} +3 -3
  33. package/assets/esri/core/workers/chunks/{add17e95f47e6904bf6d.js → a59dab47a58695c639da.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{f441fc74451330384fb0.js → abb05a903440d97a6a74.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{3bacd904cd93c8013f6a.js → ae793d814cf32db9fbde.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{e0b70652da4a7f672cfc.js → b21cf62652ca772108c8.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{5baef729beef0199c3d9.js → b536fdb655ad293d9024.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{1d4ea8db272655c0608c.js → c7c721de93bc8688e13c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/c82a974c8448407885e6.js +1 -0
  40. package/assets/esri/core/workers/chunks/c8d2cce4a426c72ab173.js +1 -0
  41. package/assets/esri/core/workers/chunks/c9c2e00fed979c21e2f0.js +1 -0
  42. package/assets/esri/core/workers/chunks/{94005916d321c879bea1.js → cb500d673ca7ec1ef945.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{14feb12826e0c8ba7fb8.js → d14bd320f72d8e8a0ad8.js} +1 -1
  44. package/assets/esri/core/workers/chunks/d239a4ef60e348cfb05a.js +1 -0
  45. package/assets/esri/core/workers/chunks/{4b6a44c6265c8959abd8.js → d3db7244fac7398cc700.js} +1 -1
  46. package/assets/esri/core/workers/chunks/d6d03f22c91f528b97e5.js +1 -0
  47. package/assets/esri/core/workers/chunks/{4ab89c990a82c745c0fd.js → d764b6273974f4bca31b.js} +1 -1
  48. package/assets/esri/core/workers/chunks/d86e59da76eea888ba86.js +1 -0
  49. package/assets/esri/core/workers/chunks/dc3a4ad62bc041a4f899.js +1 -0
  50. package/assets/esri/core/workers/chunks/{7aa730e5ac7b268e3c98.js → dd34d56caafa38d4b8e4.js} +1 -1
  51. package/assets/esri/core/workers/chunks/df458ad51be27df3d79d.js +1 -0
  52. package/assets/esri/core/workers/chunks/{01b8e680befff83e7d3e.js → e093e745708f722bc1b9.js} +1 -1
  53. package/assets/esri/core/workers/chunks/e3a994587f9b2e88db85.js +1 -0
  54. package/assets/esri/core/workers/chunks/ea5bf896acfcc3106bf5.js +1 -0
  55. package/assets/esri/core/workers/chunks/{a74e6d505a55ed27f004.js → f11453f24c0b728669d2.js} +1 -1
  56. package/assets/esri/core/workers/chunks/f2ebd6471e1259a6eac0.js +1 -0
  57. package/assets/esri/core/workers/chunks/f3c232fc56a29d51196a.js +1 -0
  58. package/assets/esri/core/workers/chunks/{2a17991923abc64c84c6.js → f55328aabf84770c8e6a.js} +1 -1
  59. package/assets/esri/core/workers/chunks/fa01d1813fa78034526e.js +1 -0
  60. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  61. package/chunks/ComponentShader.glsl.js +19 -21
  62. package/chunks/Envelope.js +1 -1
  63. package/chunks/GaussianSplat.glsl.js +2 -2
  64. package/chunks/Geometry.js +1 -1
  65. package/chunks/GlowComposition.glsl.js +5 -5
  66. package/chunks/Laserlines.glsl.js +1 -1
  67. package/chunks/MultiPathImpl.js +1 -1
  68. package/chunks/Point2D.js +1 -1
  69. package/chunks/Terrain.glsl.js +9 -11
  70. package/chunks/UnitFactory.js +1 -1
  71. package/chunks/boundedPlane.js +1 -1
  72. package/chunks/cameraUtilsSpherical.js +1 -1
  73. package/chunks/lyr3DMain.js +1 -1
  74. package/chunks/vec32.js +1 -1
  75. package/config.js +1 -1
  76. package/core/deprecate.js +1 -1
  77. package/core/has.js +1 -1
  78. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  79. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  80. package/geometry/SpatialReference.js +1 -1
  81. package/geometry/operators/integrateOperator.js +1 -1
  82. package/geometry/operators/support/apiConverter.js +1 -1
  83. package/geometry/operators/support/jsonConverter.js +1 -1
  84. package/geometry/support/lineSegment.js +1 -1
  85. package/geometry/support/meshUtils/merge.js +1 -1
  86. package/geometry/support/spatialReferenceUtils.js +1 -1
  87. package/geometry/support/sphere.js +1 -1
  88. package/interfaces.d.ts +522 -5
  89. package/intl/locale.js +1 -1
  90. package/kernel.js +1 -1
  91. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  92. package/layers/VoxelWasmPerSceneView.js +1 -1
  93. package/layers/catalog/CatalogDynamicGroupLayer.js +1 -1
  94. package/layers/graphics/data/AttributesBuilder.js +1 -1
  95. package/layers/graphics/data/QueryEngineResult.js +1 -1
  96. package/layers/mixins/ArcGISImageService.js +1 -1
  97. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  98. package/layers/support/layerOriginUtils.js +1 -1
  99. package/layers/voxel/VoxelVolume.js +1 -1
  100. package/package.json +3 -3
  101. package/portal/schemas/definitions.js +1 -1
  102. package/request/config.js +1 -1
  103. package/request/process.js +1 -1
  104. package/rest/query/operations/query.js +1 -1
  105. package/rest/support/LocateSetting.d.ts +4 -0
  106. package/rest/support/LocateSetting.js +5 -0
  107. package/rest/support/LocateSettingBase.d.ts +4 -0
  108. package/rest/support/LocateSettingBase.js +5 -0
  109. package/rest/support/LocateSettingSource.d.ts +4 -0
  110. package/rest/support/LocateSettingSource.js +5 -0
  111. package/rest/support/LocateSettings.d.ts +4 -0
  112. package/rest/support/LocateSettings.js +5 -0
  113. package/rest/support/LocateSettingsOverrides.d.ts +4 -0
  114. package/rest/support/LocateSettingsOverrides.js +5 -0
  115. package/rest/support/RouteParameters.js +1 -1
  116. package/statistics/utils.js +1 -1
  117. package/support/revision.js +1 -1
  118. package/views/3d/GroundView3D.js +1 -1
  119. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  120. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  121. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  122. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  123. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  124. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  125. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  126. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  127. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  128. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  129. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  130. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  131. package/views/3d/camera/constraintUtils/distance.js +1 -1
  132. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  133. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  134. package/views/3d/environment/CloudsParameters.js +1 -1
  135. package/views/3d/environment/EnvironmentManager.js +1 -1
  136. package/views/3d/environment/MarsAtmosphere.js +1 -1
  137. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  138. package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
  139. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  140. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  141. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  142. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  143. package/views/3d/layers/I3SMeshView3D.js +1 -1
  144. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  145. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  146. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  147. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  148. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  149. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  150. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  151. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  152. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  153. package/views/3d/state/ConstraintsManager.js +1 -1
  154. package/views/3d/state/Frustum.js +1 -1
  155. package/views/3d/state/NearFarHeuristic.js +1 -1
  156. package/views/3d/state/controllers/FovController.js +1 -1
  157. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  158. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  159. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  160. package/views/3d/support/CombinedElevationProvider.js +1 -1
  161. package/views/3d/support/ElevationRange.js +1 -1
  162. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  163. package/views/3d/support/cameraUtils.js +1 -1
  164. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  165. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +5 -0
  166. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +5 -0
  167. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  168. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  169. package/views/3d/support/intersectionUtils.js +1 -1
  170. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  171. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  172. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  173. package/views/3d/support/viewpointUtils.js +1 -1
  174. package/views/3d/terrain/ElevationBounds.js +1 -1
  175. package/views/3d/terrain/ElevationData.js +1 -1
  176. package/views/3d/terrain/OverlayManager.js +1 -1
  177. package/views/3d/terrain/PatchRenderData.js +1 -1
  178. package/views/3d/terrain/SphericalPatch.js +1 -1
  179. package/views/3d/terrain/TerrainSurface.js +1 -1
  180. package/views/3d/terrain/Tile.js +1 -1
  181. package/views/3d/webgl/RenderCamera.js +1 -1
  182. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  183. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  184. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +57 -0
  185. package/views/3d/webgl-engine/collections/Component/Material/ComponentDataConstants.js +5 -0
  186. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/Material/ComponentShader.glsl.js +5 -0
  188. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  189. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  190. package/views/3d/webgl-engine/collections/Component/Material/{shader/DecodeSymbolColor.glsl.js → DecodeSymbolColor.glsl.js} +1 -1
  191. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +1 -1
  192. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +10 -13
  193. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +7 -1
  194. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +1 -1
  195. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  196. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
  197. package/views/3d/webgl-engine/effects/glow/GlowPresets.glsl.js +1 -1
  198. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  199. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  200. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  201. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  202. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  203. package/views/3d/webgl-engine/lib/TextureBackedBuffer/BufferManager.js +1 -1
  204. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  205. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
  206. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  207. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  208. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  209. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  210. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  211. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  212. package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
  213. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  214. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  215. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  216. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  217. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  218. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  219. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  220. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  221. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
  222. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +24 -31
  223. package/views/Attribution.js +1 -1
  224. package/views/DOMContainer.js +1 -1
  225. package/views/SelectionManager.js +1 -1
  226. package/views/View.js +1 -1
  227. package/views/interactive/GraphicManipulator.js +1 -1
  228. package/views/interactive/SegmentLabels.js +1 -1
  229. package/views/interactive/coordinateHelper.js +1 -1
  230. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  231. package/views/interactive/sketch/constraints.js +1 -1
  232. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  233. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  234. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  235. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  236. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  237. package/views/support/GroundElevationSampler.js +1 -1
  238. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  239. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  240. package/views/support/geometry3dUtils.js +1 -1
  241. package/views/support/selectionUtils.js +1 -1
  242. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  243. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  244. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
  245. package/widgets/BuildingExplorer.js +1 -1
  246. package/widgets/Editor/EditorViewModel.js +1 -1
  247. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  248. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  249. package/widgets/ShadowCast/DiscreteOptions.js +1 -1
  250. package/widgets/ShadowCast/DurationOptions.js +1 -1
  251. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  252. package/widgets/ShadowCast/ThresholdOptions.js +1 -1
  253. package/widgets/ShadowCast.js +1 -1
  254. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  255. package/assets/esri/core/workers/chunks/0a1df5a724fe253b3866.js +0 -1
  256. package/assets/esri/core/workers/chunks/155d74b9c0ef31dc2316.js +0 -1
  257. package/assets/esri/core/workers/chunks/2c8c48433b380da59831.js +0 -1
  258. package/assets/esri/core/workers/chunks/31b5747a254d13acc58e.js +0 -1
  259. package/assets/esri/core/workers/chunks/3ac84e324d212815e252.js +0 -1
  260. package/assets/esri/core/workers/chunks/41a00c77e6f7ce61e476.js +0 -1
  261. package/assets/esri/core/workers/chunks/45729d006db6a569715f.js +0 -1
  262. package/assets/esri/core/workers/chunks/50cf3cbcad2be1c1e210.js +0 -1
  263. package/assets/esri/core/workers/chunks/565358ea8d1bdc4d1ebc.js +0 -1
  264. package/assets/esri/core/workers/chunks/592afe1a41bed3b0cc31.js +0 -1
  265. package/assets/esri/core/workers/chunks/5aeda8a1f2ccabfdf40f.js +0 -1
  266. package/assets/esri/core/workers/chunks/657d9e5145da1306ace8.js +0 -1
  267. package/assets/esri/core/workers/chunks/7f7a81ed8893ab649af7.js +0 -1
  268. package/assets/esri/core/workers/chunks/7ffef8a19166f6b564d8.js +0 -1
  269. package/assets/esri/core/workers/chunks/819781a209608dcdd678.js +0 -1
  270. package/assets/esri/core/workers/chunks/8d57e3a0e5687ce15557.js +0 -1
  271. package/assets/esri/core/workers/chunks/8e9a5d38da40702def80.js +0 -1
  272. package/assets/esri/core/workers/chunks/aac313257a8b1ae75b75.js +0 -1
  273. package/assets/esri/core/workers/chunks/be06c8a58c217a17451b.js +0 -1
  274. package/assets/esri/core/workers/chunks/d56548a994753b08403c.js +0 -1
  275. package/assets/esri/core/workers/chunks/dd95e679618b7b21a7b1.js +0 -1
  276. package/assets/esri/core/workers/chunks/e08a1934d98e7324776d.js +0 -1
  277. package/assets/esri/core/workers/chunks/e5deb72df8b2505fd325.js +0 -1
  278. package/assets/esri/core/workers/chunks/e689a4849f5af3f2f641.js +0 -1
  279. package/assets/esri/core/workers/chunks/f259ad785ce3aa970792.js +0 -1
  280. package/assets/esri/core/workers/chunks/f3127bdf28a1d9b8db27.js +0 -1
  281. package/assets/esri/core/workers/chunks/f4919950a9a3703d9da3.js +0 -1
  282. package/assets/esri/core/workers/chunks/f6ce485c082d0d640b01.js +0 -1
  283. package/assets/esri/core/workers/chunks/fd9ef4b8c969962cf72b.js +0 -1
  284. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +0 -57
  285. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{asinClamped as s}from"../../../core/mathUtils.js";import{dot as r,subtract as n,squaredDistance as i,exactEquals as o,set as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{m as a,d as h,h as f,e as l,F as d,c as p,s as m,a as g,E as _,g as k,f as L,n as x}from"../../../chunks/vec32.js";import{create as y,UNIT_Z as z,fromValues as M,clone as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as T,g as q}from"../../../chunks/vec42.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{directGeodeticSolver as j,inverseGeodeticSolver as v,InverseGeodeticSolverResult as D}from"../../../geometry/geodesicUtils.js";import{toRadians as b}from"../../../geometry/support/geodesicConstants.js";import{create as R,fromPoints as A,fromPositionAndNormal as Z,intersectLine as U,signedDistance as E,projectPoint as I,getNormal as S,distance as C}from"../../../geometry/support/plane.js";import{Sphere as G}from"../../../geometry/support/sphere.js";import{tangentFrame as O}from"../../3d/support/mathUtils.js";import{clone as F,asVec2 as V,createWritable as B,create as H,fromValues as J,fromVec3 as K}from"./normalizedPoint.js";import{projectPointToVerticalPlane as N,isClose as Q,projectPointToVerticalCylinder as W,projectPointToLineLike as X,intersectLineLikes as Y,intersectVerticalPlaneAndLineLike as $,intersectLineLikeAndVerticalCylinder as tt,intersectLineLikeAndCircle as et,intersectVerticalPlanes as st,intersectVerticalPlaneAndVerticalCylinder as rt,intersectVerticalCylinders as nt,intersectVerticalPlaneAndPoint as it,vectorsHaveCloseZ as ot,isPointInsidePlane as ct,pointsInsidePlane as ut}from"../../support/geometry3dUtils.js";class at{intersect(t){return St(this,t)}closestPoints(t){return[this.closestTo(t)]}}class ht extends at{constructor(t){super(),this.point=t}equals(t){return this===t||le(t)&&a(this.point,t.point)}closestTo(){return F(this.point)}}class ft extends at{constructor(t,e,s){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:s}}equals(t){return this===t||de(t)&&this.lineLike.type===t.lineLike.type&&a(this.start,t.start)&&a(this.end,t.end)}closestTo(t){const e=B();return X(t,this.lineLike,e),e}}class lt extends ft{constructor(t,e){super(t,e,1)}}class dt extends ft{constructor(t,e){super(t,e,0)}}class pt extends at{constructor(t){super(),this.constraints=t}equals(t){return this===t||fe(t)&&e(this.constraints,t.constraints,(t,e)=>t.equals(e))}closestTo(t){let e,s=1/0;for(const r of this.constraints){const n=r.closestTo(t),i=m(t,n);i<s&&(s=i,e=n)}return F(e??t)}closestPoints(t){return this.constraints.flatMap(e=>e===this?[]:e.closestPoints(t))}}class mt extends at{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||ge(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=B();return W(t,this.center,this.radius,e),e}}class gt extends at{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||_e(t)&&a(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=B();return W(t,this.center,this.radius,e),e[2]=this.center[2],e}asCircle(){return new _t(F(this.center),this.radius,J(0,0,1))}}class _t extends at{constructor(t,e,s,r){super(),this.center=t,this.radius=e,this.normal=s,this.slicePlane=r}equals(t){return this===t||ke(t)&&a(this.center,t.center)&&a(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:s}=this;I(this.getPlane(Lt),t,kt);const r=g(kt,kt,e),n=_(r);if(Q(n,0))return F(t);const i=s/Math.sqrt(n),o=B();p(o,e,r,i);const{slicePlane:c}=this;if(c&&!ct(c,o)){const e=Ft(c,this);return e?.closestTo(t)??F(t)}return o}getPlane(t=R()){return Z(this.center,this.normal,t)}}const kt=y(),Lt=R();class xt extends at{constructor(t){super(),this.z=t}equals(t){return this===t||pe(t)&&this.z===t.z}closestTo(t){return J(t[0],t[1],this.z)}getPlane(t=R()){return f(yt,0,0,this.z),Z(yt,z,t)}}const yt=y();class zt extends at{constructor(t,e,s){super(),this.start=t,this.end=e,this.planeLike={start:V(t),end:V(e),type:s}}equals(t){return this===t||me(t)&&this.planeLike.type===t.planeLike.type&&a(this.start,t.start)&&a(this.end,t.end)}closestTo(t){const e=B();return N(t,this.planeLike,e),e}closestEndTo(t){const{start:e,end:s}=this.planeLike;return Math.sign(r(n(Mt,s,e),n(Pt,V(t),e)))>0?this.end:this.start}getPlane(t=R()){const e=h(Tt,this.end);return e[2]+=1,A(this.start,this.end,e,t)}getSlicePlane(t=R()){const{start:e,end:s,type:r}=this.planeLike;if(0===r)return;const n=f(Tt,e[0],e[1],0),i=f(qt,s[0],s[1],0),o=l(qt,i,n);return Z(n,o,t),t}}const Mt=u(),Pt=u(),Tt=y(),qt=y();class wt extends zt{constructor(t,e){super(t,e,1)}}class jt extends zt{constructor(t,e){super(t,e,0)}}class vt extends at{constructor(t,e){super(),this.sphere=new G(t,e),this._center=P(t)}equals(t){return this===t||Le(t)&&this.sphere.exactEquals(t.sphere)}closestTo(t){const e=B();return this.sphere.projectPoint(t,e),e}get center(){return this._center}get radius(){return this.sphere.radius}}class Dt extends at{constructor(t,e,s){super(),this.start=t,this.end=e,this.getZ=s,this.planeLike={start:V(t),end:V(e),type:0}}equals(t){return this===t||xe(t)&&a(this.start,t.start)&&a(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return It(this,t)}addIfOnTheGround(t,e){for(const s of e){const e=this.getZ(s[0],s[1])??0;Q(s[2],e)&&(s[2]=e,t.push(s))}}}class bt extends at{constructor(t,e,s){super(),this._x=t,this._y=e,this._z=s}equals(t){return this===t||ze(t)&&this._x===t._x&&this._y===t._y&&this._z===t._z}closestTo([t,e,s]){return H(this._x??t,this._y??e,this._z??s)}}class Rt extends at{constructor(t,e,s,r,n){super(),this._origin=t,this._spatialReference=e,this._distanceMeters=s,this._z=r,this._directionDegrees=n}equals(t){return this===t||ye(t)&&o(this._origin,t._origin)&&this._spatialReference===t._spatialReference&&this._distanceMeters===t._distanceMeters&&this._z===t._z&&this._directionDegrees===t._directionDegrees}closestTo([t,e,s]){return c(At,t,e),o(At,this._origin)||this._applyDirectionAndDistance(At),H(At[0],At[1],this._z??s)}_applyDirectionAndDistance(t){if(null!=this._directionDegrees&&null!=this._distanceMeters)j(t,this._origin,this._directionDegrees,this._distanceMeters,this._spatialReference);else if(null!=this._directionDegrees)Ut(t,this._origin,this._directionDegrees,t,this._spatialReference);else if(null!=this._distanceMeters){const{azimuth:e}=v(Zt,this._origin,t,this._spatialReference);j(t,this._origin,e??0,this._distanceMeters,this._spatialReference)}}}const At=[0,0],Zt=new D;function Ut(t,e,s,r,n){let{azimuth:i,distance:o}=v(Et,e,r,n);i??=0;let c=o*Math.cos((i-s)*b);c=Math.max(0,c),j(t,e,s,c,n)}const Et=new D;function It(t,e){const s=B();return N(e,t.planeLike,s),s[2]=t.getZ(s[0],s[1])??Me,s}function St(t,e){if(fe(t)){const s=[];for(const r of t.constraints){const t=r.intersect(e);t&&s.push(t)}return he(s)}if(fe(e))return St(e,t);if(xe(t))return oe(t,e);if(xe(e))return oe(e,t);if(le(t)){const{point:s}=t;if(le(e))return a(s,e.point)?t:void 0;const r=e.closestTo(s);return d(r,s)?t:void 0}if(de(t)){if(le(e))return St(e,t);if(de(e))return ue(Y(t.lineLike,e.lineLike));if(pe(e))return Ct(t,e);if(me(e))return ue($(e.planeLike,t.lineLike));if(ge(e))return ue(tt(t.lineLike,e.center,e.radius));if(ke(e))return ue(et(t.lineLike,e));if(_e(e))return Gt(t,e);if(Le(e))return Ot(t,e)}else if(pe(t)){if(le(e)||de(e))return St(e,t);if(pe(e))return Vt(t,e);if(me(e))return Bt(t,e);if(ge(e))return Ht(t,e);if(ke(e))return Kt(t,e);if(_e(e))return Jt(t,e);if(Le(e))return Nt(t,e)}else if(me(t)){if(le(e)||de(e)||pe(e))return St(e,t);if(me(e))return ce(st(t.planeLike,e.planeLike));if(ge(e))return ce(rt(t.planeLike,e.center,e.radius));if(ke(e))return Wt(t,e);if(_e(e))return Qt(t,e);if(Le(e))return Xt(t,e)}else if(ge(t)){if(le(e)||de(e)||pe(e)||me(e))return St(e,t);if(ge(e))return ce(nt(V(t.center),t.radius,V(e.center),e.radius));if(ke(e))return Yt();if(_e(e))return $t(t,e);if(Le(e))return te()}else if(ke(t)){if(le(e)||de(e)||pe(e)||me(e)||ge(e))return St(e,t);if(ke(e))return ee();if(_e(e))return ee(e.asCircle());if(Le(e))return se()}else if(_e(t)){if(le(e)||de(e)||pe(e)||me(e)||ge(e)||ke(e))return St(e,t);if(_e(e))return re(e,t);if(Le(e))return ne()}else if(Le(t)){if(le(e)||de(e)||pe(e)||me(e)||ge(e)||_e(e))return St(e,t);if(Le(e))return ie()}}const Ct=(()=>{const t=R();return(e,s)=>{const{start:r,end:n}=e;if(ot(r,n)&&Q(r[2],s.z))return e;const i=B();return U(s.getPlane(t),r,n,i)?new ht(i):void 0}})();function Gt({lineLike:t},{center:e,radius:s}){const r=e[2];return ue(tt(t,e,s).filter(t=>Q(t[2],r)))}function Ot({lineLike:t},{sphere:e}){return ue(e.intersectLine(t.start,t.end))}const Ft=(()=>{const t=w(),e=y(),r=y();return(n,i,o)=>{const{normal:c,center:u,radius:a}=i;O(c,e,r);const h=S(n),f=a*k(h,e),l=a*k(h,r);T(t,u[0],u[1],u[2],1);const d=q(n,t),m=Math.hypot(f,l),g=Q(m,0);if(Q(C(n,u),0)){if(g)return i;if(Q(a,0))return!o||ct(o,u)?new ht(F(u)):void 0;L(e,h,c),x(e,e);const t=new Array,s=P(u);p(s,s,e,a),o&&!ct(o,s)||t.push(s);const r=P(u);return p(r,r,e,-a),o&&!ct(o,r)||t.push(r),ue(t)}if(g)return;const _=-d/m;if(Math.abs(_)>1||Q(_,1))return;const z=Math.atan(f/l),M=s(_)-z,w=Math.PI-M,j=new Array,v=y();p(v,u,e,a*Math.cos(M)),p(v,v,r,a*Math.sin(M)),j.push(v);const D=y();return p(D,u,e,a*Math.cos(w)),p(D,D,r,a*Math.sin(w)),j.push(D),ue(o?ut(o,j):j)}})();function Vt(t,e){return Q(t.z,e.z)?t:void 0}function Bt({z:t},{planeLike:e}){const[s,r]=e.start,[n,i]=e.end,o=J(s,r,t),c=J(n,i,t);return 0===e.type?new lt(o,c):new dt(o,c)}function Ht(t,e){const[s,r]=e.center;return new gt(J(s,r,t.z),e.radius)}function Jt(t,e){return Q(e.center[2],t.z)?e:void 0}const Kt=(()=>{const t=R();return(e,s)=>Ft(e.getPlane(t),s,s.slicePlane)})();function Nt(t,{center:e,radius:s}){const r=Math.abs(e[2]-t.z);if(r>s&&!Q(r,s))return;const n=J(e[0],e[1],t.z),i=Math.sqrt(s**2-r**2);return Q(i,0)?void 0:new gt(n,i)}const Qt=(()=>{const t=R();return(e,{center:s,radius:r})=>{const n=rt(e.planeLike,s,r),i=s[2];e.getSlicePlane(t);const o=new Array;for(const[c,u]of n){const e=[c,u,i];ct(t,e)&&o.push(e)}return ue(o)}})(),Wt=(()=>{const t=R(),e=R();return(s,r)=>Ft(s.getPlane(t),r,s.getSlicePlane(e))})(),Xt=(()=>{const t=R();return(e,{center:s,radius:r})=>{const n=e.getPlane(t),i=E(n,s),o=Math.abs(i);if(o>r&&!Q(o,r))return;const c=Math.sqrt(r**2-i**2);if(Q(c,0)){const t=B();return I(n,s,t),new ht(t)}const u=B(),a=P(S(n));return p(u,s,a,i),new _t(u,c,a,e.getSlicePlane())}})();function Yt(t,e){}function $t(t,e){const s=i(V(t.center),V(e.center));if(Q(s,0)&&Q(t.radius,e.radius))return e;return ae(nt(V(t.center),t.radius,V(e.center),e.radius),e.center[2])}function te(t,e){}function ee(t,e){}function se(t,e){}function re(t,e){if(!ot(t.center,e.center))return;const s=i(V(t.center),V(e.center));if(Q(s,0)&&Q(t.radius,e.radius))return t;return ae(nt(V(t.center),t.radius,V(e.center),e.radius),t.center[2])}function ne(t,e){}function ie(t,e){}function oe(t,e){const{planeLike:s,getZ:r}=t,n=new Array;if(le(e))t.addIfOnTheGround(n,it(s,e.point));else if(de(e))t.addIfOnTheGround(n,$(s,e.lineLike));else if(ge(e))for(const[i,o]of rt(s,e.center,e.radius)){const t=r(i,o);null!=t&&n.push(M(i,o,t))}else if(me(e)||xe(e))for(const[i,o]of st(s,e.planeLike)){const t=r(i,o)??Me;n.push(M(i,o,t))}return ue(n)}function ce(t){return he(t.map(([t,e])=>{const s=J(t,e,0),r=J(t,e,1);return new lt(s,r)}))}function ue(t){return he(t.map(t=>t?new ht(K(t)):void 0))}function ae(t,e){return ue(t.map(([t,s])=>[t,s,e]))}function he(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new pt(e.filter(t))}function fe(t){return t instanceof pt}function le(t){return t instanceof ht}function de(t){return t instanceof ft}function pe(t){return t instanceof xt}function me(t){return t instanceof zt}function ge(t){return t instanceof mt}function _e(t){return t instanceof gt}function ke(t){return t instanceof _t}function Le(t){return t instanceof vt}function xe(t){return t instanceof Dt}function ye(t){return t instanceof Rt}function ze(t){return t instanceof bt}const Me=0;export{_t as CircleConstraint,at as Constraint,bt as CoordinateConstraint,Dt as DrapedLineConstraint,Rt as GeodesicConstraint,gt as HorizontalCircleConstraint,xt as HorizontalPlaneConstraint,lt as LineConstraint,ft as LineLikeConstraint,ht as PointConstraint,dt as RayConstraint,pt as SetConstraint,vt as SphereConstraint,mt as VerticalCylinderConstraint,wt as VerticalHalfPlaneConstraint,jt as VerticalPlaneConstraint,zt as VerticalPlaneLikeConstraint,he as constraintOrSet,le as isPoint};
5
+ import{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{asinClamped as s}from"../../../core/mathUtils.js";import{dot as r,subtract as n,squaredDistance as i,exactEquals as o,set as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{m as a,d as h,h as f,e as l,G as d,c as p,s as m,a as g,F as _,g as k,f as L,n as x}from"../../../chunks/vec32.js";import{create as y,UNIT_Z as z,fromValues as M,clone as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as T,g as q}from"../../../chunks/vec42.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{directGeodeticSolver as j,inverseGeodeticSolver as v,InverseGeodeticSolverResult as D}from"../../../geometry/geodesicUtils.js";import{toRadians as b}from"../../../geometry/support/geodesicConstants.js";import{create as R,fromPoints as A,fromPositionAndNormal as Z,intersectLine as U,signedDistance as G,projectPoint as I,getNormal as S,distance as C}from"../../../geometry/support/plane.js";import{Sphere as E}from"../../../geometry/support/sphere.js";import{tangentFrame as O}from"../../3d/support/mathUtils.js";import{clone as F,asVec2 as V,createWritable as B,create as H,fromValues as J,fromVec3 as K}from"./normalizedPoint.js";import{projectPointToVerticalPlane as N,isClose as Q,projectPointToVerticalCylinder as W,projectPointToLineLike as X,intersectLineLikes as Y,intersectVerticalPlaneAndLineLike as $,intersectLineLikeAndVerticalCylinder as tt,intersectLineLikeAndCircle as et,intersectVerticalPlanes as st,intersectVerticalPlaneAndVerticalCylinder as rt,intersectVerticalCylinders as nt,intersectVerticalPlaneAndPoint as it,vectorsHaveCloseZ as ot,isPointInsidePlane as ct,pointsInsidePlane as ut}from"../../support/geometry3dUtils.js";class at{intersect(t){return St(this,t)}closestPoints(t){return[this.closestTo(t)]}}class ht extends at{constructor(t){super(),this.point=t}equals(t){return this===t||le(t)&&a(this.point,t.point)}closestTo(){return F(this.point)}}class ft extends at{constructor(t,e,s){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:s}}equals(t){return this===t||de(t)&&this.lineLike.type===t.lineLike.type&&a(this.start,t.start)&&a(this.end,t.end)}closestTo(t){const e=B();return X(t,this.lineLike,e),e}}class lt extends ft{constructor(t,e){super(t,e,1)}}class dt extends ft{constructor(t,e){super(t,e,0)}}class pt extends at{constructor(t){super(),this.constraints=t}equals(t){return this===t||fe(t)&&e(this.constraints,t.constraints,(t,e)=>t.equals(e))}closestTo(t){let e,s=1/0;for(const r of this.constraints){const n=r.closestTo(t),i=m(t,n);i<s&&(s=i,e=n)}return F(e??t)}closestPoints(t){return this.constraints.flatMap(e=>e===this?[]:e.closestPoints(t))}}class mt extends at{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||ge(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=B();return W(t,this.center,this.radius,e),e}}class gt extends at{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||_e(t)&&a(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=B();return W(t,this.center,this.radius,e),e[2]=this.center[2],e}asCircle(){return new _t(F(this.center),this.radius,J(0,0,1))}}class _t extends at{constructor(t,e,s,r){super(),this.center=t,this.radius=e,this.normal=s,this.slicePlane=r}equals(t){return this===t||ke(t)&&a(this.center,t.center)&&a(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:s}=this;I(this.getPlane(Lt),t,kt);const r=g(kt,kt,e),n=_(r);if(Q(n,0))return F(t);const i=s/Math.sqrt(n),o=B();p(o,e,r,i);const{slicePlane:c}=this;if(c&&!ct(c,o)){const e=Ft(c,this);return e?.closestTo(t)??F(t)}return o}getPlane(t=R()){return Z(this.center,this.normal,t)}}const kt=y(),Lt=R();class xt extends at{constructor(t){super(),this.z=t}equals(t){return this===t||pe(t)&&this.z===t.z}closestTo(t){return J(t[0],t[1],this.z)}getPlane(t=R()){return f(yt,0,0,this.z),Z(yt,z,t)}}const yt=y();class zt extends at{constructor(t,e,s){super(),this.start=t,this.end=e,this.planeLike={start:V(t),end:V(e),type:s}}equals(t){return this===t||me(t)&&this.planeLike.type===t.planeLike.type&&a(this.start,t.start)&&a(this.end,t.end)}closestTo(t){const e=B();return N(t,this.planeLike,e),e}closestEndTo(t){const{start:e,end:s}=this.planeLike;return Math.sign(r(n(Mt,s,e),n(Pt,V(t),e)))>0?this.end:this.start}getPlane(t=R()){const e=h(Tt,this.end);return e[2]+=1,A(this.start,this.end,e,t)}getSlicePlane(t=R()){const{start:e,end:s,type:r}=this.planeLike;if(0===r)return;const n=f(Tt,e[0],e[1],0),i=f(qt,s[0],s[1],0),o=l(qt,i,n);return Z(n,o,t),t}}const Mt=u(),Pt=u(),Tt=y(),qt=y();class wt extends zt{constructor(t,e){super(t,e,1)}}class jt extends zt{constructor(t,e){super(t,e,0)}}class vt extends at{constructor(t,e){super(),this.sphere=new E(t,e),this._center=P(t)}equals(t){return this===t||Le(t)&&this.sphere.exactEquals(t.sphere)}closestTo(t){const e=B();return this.sphere.projectPoint(t,e),e}get center(){return this._center}get radius(){return this.sphere.radius}}class Dt extends at{constructor(t,e,s){super(),this.start=t,this.end=e,this.getZ=s,this.planeLike={start:V(t),end:V(e),type:0}}equals(t){return this===t||xe(t)&&a(this.start,t.start)&&a(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return It(this,t)}addIfOnTheGround(t,e){for(const s of e){const e=this.getZ(s[0],s[1])??0;Q(s[2],e)&&(s[2]=e,t.push(s))}}}class bt extends at{constructor(t,e,s){super(),this._x=t,this._y=e,this._z=s}equals(t){return this===t||ze(t)&&this._x===t._x&&this._y===t._y&&this._z===t._z}closestTo([t,e,s]){return H(this._x??t,this._y??e,this._z??s)}}class Rt extends at{constructor(t,e,s,r,n){super(),this._origin=t,this._spatialReference=e,this._distanceMeters=s,this._z=r,this._directionDegrees=n}equals(t){return this===t||ye(t)&&o(this._origin,t._origin)&&this._spatialReference===t._spatialReference&&this._distanceMeters===t._distanceMeters&&this._z===t._z&&this._directionDegrees===t._directionDegrees}closestTo([t,e,s]){return c(At,t,e),o(At,this._origin)||this._applyDirectionAndDistance(At),H(At[0],At[1],this._z??s)}_applyDirectionAndDistance(t){if(null!=this._directionDegrees&&null!=this._distanceMeters)j(t,this._origin,this._directionDegrees,this._distanceMeters,this._spatialReference);else if(null!=this._directionDegrees)Ut(t,this._origin,this._directionDegrees,t,this._spatialReference);else if(null!=this._distanceMeters){const{azimuth:e}=v(Zt,this._origin,t,this._spatialReference);j(t,this._origin,e??0,this._distanceMeters,this._spatialReference)}}}const At=[0,0],Zt=new D;function Ut(t,e,s,r,n){let{azimuth:i,distance:o}=v(Gt,e,r,n);i??=0;let c=o*Math.cos((i-s)*b);c=Math.max(0,c),j(t,e,s,c,n)}const Gt=new D;function It(t,e){const s=B();return N(e,t.planeLike,s),s[2]=t.getZ(s[0],s[1])??Me,s}function St(t,e){if(fe(t)){const s=[];for(const r of t.constraints){const t=r.intersect(e);t&&s.push(t)}return he(s)}if(fe(e))return St(e,t);if(xe(t))return oe(t,e);if(xe(e))return oe(e,t);if(le(t)){const{point:s}=t;if(le(e))return a(s,e.point)?t:void 0;const r=e.closestTo(s);return d(r,s)?t:void 0}if(de(t)){if(le(e))return St(e,t);if(de(e))return ue(Y(t.lineLike,e.lineLike));if(pe(e))return Ct(t,e);if(me(e))return ue($(e.planeLike,t.lineLike));if(ge(e))return ue(tt(t.lineLike,e.center,e.radius));if(ke(e))return ue(et(t.lineLike,e));if(_e(e))return Et(t,e);if(Le(e))return Ot(t,e)}else if(pe(t)){if(le(e)||de(e))return St(e,t);if(pe(e))return Vt(t,e);if(me(e))return Bt(t,e);if(ge(e))return Ht(t,e);if(ke(e))return Kt(t,e);if(_e(e))return Jt(t,e);if(Le(e))return Nt(t,e)}else if(me(t)){if(le(e)||de(e)||pe(e))return St(e,t);if(me(e))return ce(st(t.planeLike,e.planeLike));if(ge(e))return ce(rt(t.planeLike,e.center,e.radius));if(ke(e))return Wt(t,e);if(_e(e))return Qt(t,e);if(Le(e))return Xt(t,e)}else if(ge(t)){if(le(e)||de(e)||pe(e)||me(e))return St(e,t);if(ge(e))return ce(nt(V(t.center),t.radius,V(e.center),e.radius));if(ke(e))return Yt();if(_e(e))return $t(t,e);if(Le(e))return te()}else if(ke(t)){if(le(e)||de(e)||pe(e)||me(e)||ge(e))return St(e,t);if(ke(e))return ee();if(_e(e))return ee(e.asCircle());if(Le(e))return se()}else if(_e(t)){if(le(e)||de(e)||pe(e)||me(e)||ge(e)||ke(e))return St(e,t);if(_e(e))return re(e,t);if(Le(e))return ne()}else if(Le(t)){if(le(e)||de(e)||pe(e)||me(e)||ge(e)||_e(e))return St(e,t);if(Le(e))return ie()}}const Ct=(()=>{const t=R();return(e,s)=>{const{start:r,end:n}=e;if(ot(r,n)&&Q(r[2],s.z))return e;const i=B();return U(s.getPlane(t),r,n,i)?new ht(i):void 0}})();function Et({lineLike:t},{center:e,radius:s}){const r=e[2];return ue(tt(t,e,s).filter(t=>Q(t[2],r)))}function Ot({lineLike:t},{sphere:e}){return ue(e.intersectLine(t.start,t.end))}const Ft=(()=>{const t=w(),e=y(),r=y();return(n,i,o)=>{const{normal:c,center:u,radius:a}=i;O(c,e,r);const h=S(n),f=a*k(h,e),l=a*k(h,r);T(t,u[0],u[1],u[2],1);const d=q(n,t),m=Math.hypot(f,l),g=Q(m,0);if(Q(C(n,u),0)){if(g)return i;if(Q(a,0))return!o||ct(o,u)?new ht(F(u)):void 0;L(e,h,c),x(e,e);const t=new Array,s=P(u);p(s,s,e,a),o&&!ct(o,s)||t.push(s);const r=P(u);return p(r,r,e,-a),o&&!ct(o,r)||t.push(r),ue(t)}if(g)return;const _=-d/m;if(Math.abs(_)>1||Q(_,1))return;const z=Math.atan(f/l),M=s(_)-z,w=Math.PI-M,j=new Array,v=y();p(v,u,e,a*Math.cos(M)),p(v,v,r,a*Math.sin(M)),j.push(v);const D=y();return p(D,u,e,a*Math.cos(w)),p(D,D,r,a*Math.sin(w)),j.push(D),ue(o?ut(o,j):j)}})();function Vt(t,e){return Q(t.z,e.z)?t:void 0}function Bt({z:t},{planeLike:e}){const[s,r]=e.start,[n,i]=e.end,o=J(s,r,t),c=J(n,i,t);return 0===e.type?new lt(o,c):new dt(o,c)}function Ht(t,e){const[s,r]=e.center;return new gt(J(s,r,t.z),e.radius)}function Jt(t,e){return Q(e.center[2],t.z)?e:void 0}const Kt=(()=>{const t=R();return(e,s)=>Ft(e.getPlane(t),s,s.slicePlane)})();function Nt(t,{center:e,radius:s}){const r=Math.abs(e[2]-t.z);if(r>s&&!Q(r,s))return;const n=J(e[0],e[1],t.z),i=Math.sqrt(s**2-r**2);return Q(i,0)?void 0:new gt(n,i)}const Qt=(()=>{const t=R();return(e,{center:s,radius:r})=>{const n=rt(e.planeLike,s,r),i=s[2];e.getSlicePlane(t);const o=new Array;for(const[c,u]of n){const e=[c,u,i];ct(t,e)&&o.push(e)}return ue(o)}})(),Wt=(()=>{const t=R(),e=R();return(s,r)=>Ft(s.getPlane(t),r,s.getSlicePlane(e))})(),Xt=(()=>{const t=R();return(e,{center:s,radius:r})=>{const n=e.getPlane(t),i=G(n,s),o=Math.abs(i);if(o>r&&!Q(o,r))return;const c=Math.sqrt(r**2-i**2);if(Q(c,0)){const t=B();return I(n,s,t),new ht(t)}const u=B(),a=P(S(n));return p(u,s,a,i),new _t(u,c,a,e.getSlicePlane())}})();function Yt(t,e){}function $t(t,e){const s=i(V(t.center),V(e.center));if(Q(s,0)&&Q(t.radius,e.radius))return e;return ae(nt(V(t.center),t.radius,V(e.center),e.radius),e.center[2])}function te(t,e){}function ee(t,e){}function se(t,e){}function re(t,e){if(!ot(t.center,e.center))return;const s=i(V(t.center),V(e.center));if(Q(s,0)&&Q(t.radius,e.radius))return t;return ae(nt(V(t.center),t.radius,V(e.center),e.radius),t.center[2])}function ne(t,e){}function ie(t,e){}function oe(t,e){const{planeLike:s,getZ:r}=t,n=new Array;if(le(e))t.addIfOnTheGround(n,it(s,e.point));else if(de(e))t.addIfOnTheGround(n,$(s,e.lineLike));else if(ge(e))for(const[i,o]of rt(s,e.center,e.radius)){const t=r(i,o);null!=t&&n.push(M(i,o,t))}else if(me(e)||xe(e))for(const[i,o]of st(s,e.planeLike)){const t=r(i,o)??Me;n.push(M(i,o,t))}return ue(n)}function ce(t){return he(t.map(([t,e])=>{const s=J(t,e,0),r=J(t,e,1);return new lt(s,r)}))}function ue(t){return he(t.map(t=>t?new ht(K(t)):void 0))}function ae(t,e){return ue(t.map(([t,s])=>[t,s,e]))}function he(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new pt(e.filter(t))}function fe(t){return t instanceof pt}function le(t){return t instanceof ht}function de(t){return t instanceof ft}function pe(t){return t instanceof xt}function me(t){return t instanceof zt}function ge(t){return t instanceof mt}function _e(t){return t instanceof gt}function ke(t){return t instanceof _t}function Le(t){return t instanceof vt}function xe(t){return t instanceof Dt}function ye(t){return t instanceof Rt}function ze(t){return t instanceof bt}const Me=0;export{_t as CircleConstraint,at as Constraint,bt as CoordinateConstraint,Dt as DrapedLineConstraint,Rt as GeodesicConstraint,gt as HorizontalCircleConstraint,xt as HorizontalPlaneConstraint,lt as LineConstraint,ft as LineLikeConstraint,ht as PointConstraint,dt as RayConstraint,pt as SetConstraint,vt as SphereConstraint,mt as VerticalCylinderConstraint,wt as VerticalHalfPlaneConstraint,jt as VerticalPlaneConstraint,zt as VerticalPlaneLikeConstraint,he as constraintOrSet,le as isPoint};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{generateUID as o}from"../../../../../core/uid.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{i as n,C as i}from"../../../../../chunks/vec32.js";import{create as r,clone as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,fromPoints as a,projectPoint as m}from"../../../../../geometry/support/lineSegment.js";import{Sphere as p}from"../../../../../geometry/support/sphere.js";import{Octree as h}from"../../../../3d/webgl-engine/lib/Octree.js";import{extractComponentsEdgeLocationsLayout as u}from"../../../../3d/webgl-engine/lib/edgeRendering/edgeProcessing.js";import{maxCandidateCount as g,boundsFromEdge as l}from"./sceneLayerSnappingUtils.js";import{SnappingCandidateEdge as f,SnappingCandidateVertex as _}from"./SnappingCandidate.js";let b=class{constructor(){this._idToComponent=new Map,this._components=new h(e=>e.bounds),this._edges=new h(e=>e.bounds),this._tmpLineSegment=d(),this._tmpP1=r(),this._tmpP2=r(),this._tmpP3=r(),this.remoteClient=null}async fetchCandidates(e,o){await Promise.resolve(),t(o);const s=e;s.mbs=new p(e.mbsJSON),await this._ensureEdgeLocations(s,o);const n=[];return this._edges.forEachNeighbor(e=>(this._addCandidates(s,e,n),n.length<g),s.mbs),{result:{candidates:n}}}async _ensureEdgeLocations(e,t){const o=[];if(this._components.forEachNeighbor(e=>{if(null==e.info){const{id:t,uid:s}=e;o.push({id:t,uid:s})}return!0},e.mbs),!o.length)return;const s={components:o},n=await this.remoteClient.invoke("fetchAllEdgeLocations",s,t??{});for(const i of n.components)this._setFetchEdgeLocations(i)}async add(e){const t=new C(e.id,new p(e.bounds));return this._idToComponent.set(t.id,t),this._components.add([t]),{result:{}}}async remove(e){const t=this._idToComponent.get(e.id);if(t){const e=[];this._edges.forEachNeighbor(o=>(o.component===t&&e.push(o),!0),t.bounds),this._edges.remove(e),this._components.remove([t]),this._idToComponent.delete(t.id)}return{result:{}}}_setFetchEdgeLocations(e){const t=this._idToComponent.get(e.id);if(null==t||e.uid!==t.uid)return;const o=u.createView(e.locations),s=new Array(o.count),n=r(),i=r();for(let r=0;r<o.count;r++){o.position0.getVec(r,n),o.position1.getVec(r,i);const c=l(n,i,e.origin),d=new S(t,r,c);s[r]=d}this._edges.add(s);const{objectIds:c,origin:d}=e;t.info={locations:o,objectIds:c,origin:d}}_addCandidates(e,t,o){const{info:s}=t.component,{origin:i,objectIds:r}=s,c=s.locations,d=c.position0.getVec(t.index,this._tmpP1),a=c.position1.getVec(t.index,this._tmpP2);n(d,d,i),n(a,a,i);const m=r[c.componentIndex.get(t.index)];this._addEdgeCandidate(e,m,d,a,o),j(e,m,d,o),j(e,m,a,o)}_addEdgeCandidate(e,t,o,s,n){if(!e.returnEdge)return;const r=e.mbs.center,d=a(o,s,this._tmpLineSegment),p=m(d,r,this._tmpP3);e.mbs.contains(p)&&n.push(new f(t,c(p),i(r,p),c(o),c(s)))}};b=e([s("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")],b);const w=b;function j(e,t,o,s){e.returnVertex&&e.mbs.contains(o)&&s.push(new _(t,c(o),i(e.mbs.center,o)))}class C{constructor(e,t){this.id=e,this.bounds=t,this.info=null,this.uid=o()}}class S{constructor(e,t,o){this.component=e,this.index=t,this.bounds=o}}export{w as default};
5
+ import{__decorate as e}from"tslib";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{generateUID as o}from"../../../../../core/uid.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{i as n,D as i}from"../../../../../chunks/vec32.js";import{create as r,clone as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,fromPoints as a,projectPoint as m}from"../../../../../geometry/support/lineSegment.js";import{Sphere as p}from"../../../../../geometry/support/sphere.js";import{Octree as h}from"../../../../3d/webgl-engine/lib/Octree.js";import{extractComponentsEdgeLocationsLayout as u}from"../../../../3d/webgl-engine/lib/edgeRendering/edgeProcessing.js";import{maxCandidateCount as g,boundsFromEdge as l}from"./sceneLayerSnappingUtils.js";import{SnappingCandidateEdge as f,SnappingCandidateVertex as _}from"./SnappingCandidate.js";let b=class{constructor(){this._idToComponent=new Map,this._components=new h(e=>e.bounds),this._edges=new h(e=>e.bounds),this._tmpLineSegment=d(),this._tmpP1=r(),this._tmpP2=r(),this._tmpP3=r(),this.remoteClient=null}async fetchCandidates(e,o){await Promise.resolve(),t(o);const s=e;s.mbs=new p(e.mbsJSON),await this._ensureEdgeLocations(s,o);const n=[];return this._edges.forEachNeighbor(e=>(this._addCandidates(s,e,n),n.length<g),s.mbs),{result:{candidates:n}}}async _ensureEdgeLocations(e,t){const o=[];if(this._components.forEachNeighbor(e=>{if(null==e.info){const{id:t,uid:s}=e;o.push({id:t,uid:s})}return!0},e.mbs),!o.length)return;const s={components:o},n=await this.remoteClient.invoke("fetchAllEdgeLocations",s,t??{});for(const i of n.components)this._setFetchEdgeLocations(i)}async add(e){const t=new C(e.id,new p(e.bounds));return this._idToComponent.set(t.id,t),this._components.add([t]),{result:{}}}async remove(e){const t=this._idToComponent.get(e.id);if(t){const e=[];this._edges.forEachNeighbor(o=>(o.component===t&&e.push(o),!0),t.bounds),this._edges.remove(e),this._components.remove([t]),this._idToComponent.delete(t.id)}return{result:{}}}_setFetchEdgeLocations(e){const t=this._idToComponent.get(e.id);if(null==t||e.uid!==t.uid)return;const o=u.createView(e.locations),s=new Array(o.count),n=r(),i=r();for(let r=0;r<o.count;r++){o.position0.getVec(r,n),o.position1.getVec(r,i);const c=l(n,i,e.origin),d=new S(t,r,c);s[r]=d}this._edges.add(s);const{objectIds:c,origin:d}=e;t.info={locations:o,objectIds:c,origin:d}}_addCandidates(e,t,o){const{info:s}=t.component,{origin:i,objectIds:r}=s,c=s.locations,d=c.position0.getVec(t.index,this._tmpP1),a=c.position1.getVec(t.index,this._tmpP2);n(d,d,i),n(a,a,i);const m=r[c.componentIndex.get(t.index)];this._addEdgeCandidate(e,m,d,a,o),j(e,m,d,o),j(e,m,a,o)}_addEdgeCandidate(e,t,o,s,n){if(!e.returnEdge)return;const r=e.mbs.center,d=a(o,s,this._tmpLineSegment),p=m(d,r,this._tmpP3);e.mbs.contains(p)&&n.push(new f(t,c(p),i(r,p),c(o),c(s)))}};b=e([s("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")],b);const w=b;function j(e,t,o,s){e.returnVertex&&e.mbs.contains(o)&&s.push(new _(t,c(o),i(e.mbs.center,o)))}class C{constructor(e,t){this.id=e,this.bounds=t,this.info=null,this.uid=o()}}class S{constructor(e,t,o){this.component=e,this.index=t,this.bounds=o}}export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{j as e,c as r,C as t,i as n}from"../../../../../chunks/vec32.js";import{Sphere as c}from"../../../../../geometry/support/sphere.js";const s=1e3;function o(s,o,p){const a=new c;return e(a.center,s,.5),r(a.center,a.center,o,.5),a.radius=t(a.center,s),n(a.center,a.center,p),a}export{o as boundsFromEdge,s as maxCandidateCount};
5
+ import{j as e,c as r,D as t,i as n}from"../../../../../chunks/vec32.js";import{Sphere as c}from"../../../../../geometry/support/sphere.js";const s=1e3;function o(s,o,p){const a=new c;return e(a.center,s,.5),r(a.center,a.center,o,.5),a.radius=t(a.center,s),n(a.center,a.center,p),a}export{o as boundsFromEdge,s as maxCandidateCount};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{m as t,C as e}from"../../../../chunks/vec32.js";import{SnappingHint as i}from"./SnappingHint.js";class s extends i{constructor(t,e,i,s,n=3,h=!0,a=!0){super(s,n),this.type=t,this.lineStart=e,this.lineEnd=i,this.fadeLeft=h,this.fadeRight=a}equals(e){return e instanceof s&&(this.type===e.type&&t(this.lineStart,e.lineStart)&&t(this.lineEnd,e.lineEnd)&&this.fadeLeft===e.fadeLeft&&this.fadeRight===e.fadeRight)}get length(){return e(this.lineStart,this.lineEnd)}}export{s as LineSnappingHint};
5
+ import{m as t,D as e}from"../../../../chunks/vec32.js";import{SnappingHint as i}from"./SnappingHint.js";class s extends i{constructor(t,e,i,s,n=3,h=!0,a=!0){super(s,n),this.type=t,this.lineStart=e,this.lineEnd=i,this.fadeLeft=h,this.fadeRight=a}equals(e){return e instanceof s&&(this.type===e.type&&t(this.lineStart,e.lineStart)&&t(this.lineEnd,e.lineEnd)&&this.fadeLeft===e.fadeLeft&&this.fadeRight===e.fadeRight)}get length(){return e(this.lineStart,this.lineEnd)}}export{s as LineSnappingHint};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{createTask as t}from"../../../core/asyncUtils.js";import{handlesGroup as o,makeHandle as e}from"../../../core/handleUtils.js";import{floatEqualUlp as n}from"../../../core/mathUtils.js";import{createAngle as r,createScalar as i,valueInUnit as a}from"../../../core/quantity.js";import{watch as l}from"../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as s}from"../../../core/units.js";import{q as u,j as c,F as p}from"../../../chunks/vec32.js";import{UNIT_Z as f,create as m,clone as d,ONES as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoaded as y,load as v}from"../../../geometry/coordinateFormatter.js";import j from"../../../geometry/support/MeshTransform.js";import{isRelativeVertexSpace as x}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isWebMercator as b}from"../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as h}from"../../../geometry/support/webMercatorUtils.js";import{tooltipKeys as S}from"../keybindings.js";import U from"../Tooltip.js";import{parseLatitudeLongitude as w,parseXY as A}from"./fields/parsingAndFormattingUtils.js";import{getDegreesArithmetic as M,getDegreesGeographic as k}from"../../support/angularMeasurementUtils.js";function R(t){const o=new U(t());return o.addHandles(l(()=>t(),({view:t,options:e,info:n})=>{o.view=t,void 0!==e&&(o.options=e),void 0!==n&&(o.info=n)})),o}function V(t,o){const e=x(o.vertexSpace),{scale:n,orientation:a}=t,{transform:l}=o,s=I(l);e&&null!=s?(a.actual=r(s,"degrees","arithmetic"),a.visible=!0):(a.actual=null,a.visible=!1),e?(n.actual=i(H(l)),n.visible=!0):(n.actual=null,n.visible=!1)}function z(t,o,e){if(!o||!x(o.vertexSpace))return;const n=o.transform??=new j;D(t,n,e),F(t,n,e)}function D(t,o,e){const r=M(t.orientation.actual),i=T(o.rotationAxis);if(null==r||null==i)return;const a=r-90,l=o.rotationAngle,s=a*i,u=s-l;n(l,s)||(e?.onRotateStart(0),o.rotationAngle=s,e?.onRotate(u),e?.onRotateStop(u))}function F(t,o,e){const n=t.scale.actual?.value,r=H(o);if(null==n||n===r)return;const{scale:i}=o;let a;if(0===r)a=d(g);else{const t=n/r;a=c(m(),i,t)}e?.onScaleStart(i[0],i[1],i[2]),o.scale=a,e?.onScale(a[0],a[1],a[2]),e?.onScaleStop(a[0],a[1],a[2])}function P(t,o){const{x:e,y:r,z:i}=o,{x:a,y:l,z:s}=q(t,o.spatialReference);return{dx:null==a||n(a,e)?0:a-e,dy:null==l||n(l,r)?0:l-r,dz:null==s||null==i||n(s,i)?0:s-i}}function q(t,o){let e,n;t.geographic?(e=k(t.longitude.actual),n=k(t.latitude.actual),b(o)&&(null!=e&&null!=n?[e,n]=h(e,n,E):null!=e?e=h(e,0,E)[0]:null!=n&&(n=h(0,n,E)[1]))):(e=t.x.actual?.value,n=t.y.actual?.value);const r=t.elevation.actual,i=s(o);return{x:e,y:n,z:null!=i&&null!=r?a(r,i):void 0}}const E=[0,0];function I(t){const o=90;if(!t)return o;const e=T(t.rotationAxis)??1;return null!=e?o+e*t.rotationAngle:null}function T(t){return p(t,f)?1:p(t,B)?-1:null}const B=u(m(),f);function H(t){return t?Math.max(...t.scale):1}function O(t,o){return!("key-down"!==t.type||t.key!==S.enterInputMode||!o||!C(o.info))&&(o.enterInputMode(),t.preventDefault(),t.stopPropagation(),!0)}function C(t){const o=t?.sketchOptions;if(!o)return!1;const{inputEnabled:e,visibleElements:n}=o.tooltips;return e&&!0===t.editableFields.some(({name:t})=>"x"===t||"y"===t?n.coordinates:n[t])}function G(n,r){let i=null;return o([n.on("paste",o=>{i?.abort(),i=t(async()=>{y()||await v(),J(o,n.info,r)})}),t(()=>v()),e(()=>i?.abort())])}function J(t,o,e){if(!o||!("geographic"in o))return;const n=t.clipboardData?.getData("text");if(!n)return;const r=o=>{t.stopPropagation(),t.preventDefault(),e?.onBeforePaste(),o(),e?.onAfterPaste()};if(o.geographic){const t=w(n);t&&r(()=>{o.longitude.applyValue(t.longitude),o.latitude.applyValue(t.latitude)})}else{const t=A(n);t&&r(()=>{o.x.applyValue(t.x),o.y.applyValue(t.y)})}}export{G as connectPasteEvent,O as enterInputModeIfAvailable,P as getXYZDeltasFromTooltipInfo,R as makeTooltip,J as pasteLocation,z as updateMeshTransformFromTooltipInfo,V as updateTooltipInfoFromMeshTransform};
5
+ import{createTask as t}from"../../../core/asyncUtils.js";import{handlesGroup as o,makeHandle as e}from"../../../core/handleUtils.js";import{floatEqualUlp as n}from"../../../core/mathUtils.js";import{createAngle as r,createScalar as i,valueInUnit as a}from"../../../core/quantity.js";import{watch as l}from"../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as s}from"../../../core/units.js";import{q as u,j as c,G as p}from"../../../chunks/vec32.js";import{UNIT_Z as f,create as m,clone as d,ONES as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoaded as y,load as v}from"../../../geometry/coordinateFormatter.js";import j from"../../../geometry/support/MeshTransform.js";import{isRelativeVertexSpace as x}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isWebMercator as b}from"../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as h}from"../../../geometry/support/webMercatorUtils.js";import{tooltipKeys as S}from"../keybindings.js";import U from"../Tooltip.js";import{parseLatitudeLongitude as w,parseXY as A}from"./fields/parsingAndFormattingUtils.js";import{getDegreesArithmetic as M,getDegreesGeographic as k}from"../../support/angularMeasurementUtils.js";function R(t){const o=new U(t());return o.addHandles(l(()=>t(),({view:t,options:e,info:n})=>{o.view=t,void 0!==e&&(o.options=e),void 0!==n&&(o.info=n)})),o}function V(t,o){const e=x(o.vertexSpace),{scale:n,orientation:a}=t,{transform:l}=o,s=I(l);e&&null!=s?(a.actual=r(s,"degrees","arithmetic"),a.visible=!0):(a.actual=null,a.visible=!1),e?(n.actual=i(G(l)),n.visible=!0):(n.actual=null,n.visible=!1)}function z(t,o,e){if(!o||!x(o.vertexSpace))return;const n=o.transform??=new j;D(t,n,e),P(t,n,e)}function D(t,o,e){const r=M(t.orientation.actual),i=T(o.rotationAxis);if(null==r||null==i)return;const a=r-90,l=o.rotationAngle,s=a*i,u=s-l;n(l,s)||(e?.onRotateStart(0),o.rotationAngle=s,e?.onRotate(u),e?.onRotateStop(u))}function P(t,o,e){const n=t.scale.actual?.value,r=G(o);if(null==n||n===r)return;const{scale:i}=o;let a;if(0===r)a=d(g);else{const t=n/r;a=c(m(),i,t)}e?.onScaleStart(i[0],i[1],i[2]),o.scale=a,e?.onScale(a[0],a[1],a[2]),e?.onScaleStop(a[0],a[1],a[2])}function F(t,o){const{x:e,y:r,z:i}=o,{x:a,y:l,z:s}=q(t,o.spatialReference);return{dx:null==a||n(a,e)?0:a-e,dy:null==l||n(l,r)?0:l-r,dz:null==s||null==i||n(s,i)?0:s-i}}function q(t,o){let e,n;t.geographic?(e=k(t.longitude.actual),n=k(t.latitude.actual),b(o)&&(null!=e&&null!=n?[e,n]=h(e,n,E):null!=e?e=h(e,0,E)[0]:null!=n&&(n=h(0,n,E)[1]))):(e=t.x.actual?.value,n=t.y.actual?.value);const r=t.elevation.actual,i=s(o);return{x:e,y:n,z:null!=i&&null!=r?a(r,i):void 0}}const E=[0,0];function I(t){const o=90;if(!t)return o;const e=T(t.rotationAxis)??1;return null!=e?o+e*t.rotationAngle:null}function T(t){return p(t,f)?1:p(t,B)?-1:null}const B=u(m(),f);function G(t){return t?Math.max(...t.scale):1}function H(t,o){return!("key-down"!==t.type||t.key!==S.enterInputMode||!o||!O(o.info))&&(o.enterInputMode(),t.preventDefault(),t.stopPropagation(),!0)}function O(t){const o=t?.sketchOptions;if(!o)return!1;const{inputEnabled:e,visibleElements:n}=o.tooltips;return e&&!0===t.editableFields.some(({name:t})=>"x"===t||"y"===t?n.coordinates:n[t])}function C(n,r){let i=null;return o([n.on("paste",o=>{i?.abort(),i=t(async()=>{y()||await v(),J(o,n.info,r)})}),t(()=>v()),e(()=>i?.abort())])}function J(t,o,e){if(!o||!("geographic"in o))return;const n=t.clipboardData?.getData("text");if(!n)return;const r=o=>{t.stopPropagation(),t.preventDefault(),e?.onBeforePaste(),o(),e?.onAfterPaste()};if(o.geographic){const t=w(n);t&&r(()=>{o.longitude.applyValue(t.longitude),o.latitude.applyValue(t.latitude)})}else{const t=A(n);t&&r(()=>{o.x.applyValue(t.x),o.y.applyValue(t.y)})}}export{C as connectPasteEvent,H as enterInputModeIfAvailable,F as getXYZDeltasFromTooltipInfo,R as makeTooltip,J as pasteLocation,z as updateMeshTransformFromTooltipInfo,V as updateTooltipInfoFromMeshTransform};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{create as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{E as e,n as i,d as s}from"../../chunks/vec32.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{rotationAngleAndAxisDirectRotation as l,rotationAnglesAndAxesHeadingPreserving as n}from"../3d/state/utils/navigationUtils.js";import{FilteredFiniteDifference as r}from"./FilteredFiniteDifference.js";import{FilteredValue as h}from"./FilteredValue.js";import{Momentum as _}from"./Momentum.js";const m=1e-5;class u extends _{constructor(t,e,i,s,a,l=0,n){super(t,e,i),this._angularVelocity1=s,this.axis1=a,this.angularVelocity2=l,this.axis2=n}value1(t){return super.valueFromInitialVelocity(this._angularVelocity1,t)}value2(t){return super.valueFromInitialVelocity(this.angularVelocity2,t)}}class o{constructor(e=300,i=12,s=.84){this._minimumInitialVelocity=e,this._stopVelocity=i,this._friction=s,this.enabled=!0,this._tmpAxis1=a(),this._tmpAxis2=a(),this._tmpAngles=t(),this._time=new r(.3),this._screen=[new r(.4),new r(.4)],this._angle1=new h(.6),this._angle2=new h(.6),this._axis1=a(),this._axis2=a(),this._lastScene=a()}addMomentumDirectRotation(t,a,n,r,h,_){if(this.enabled){if(this._time.hasLastValue()){if(this._time.computeDelta(n)<.01)return;let t=l(this._lastScene,a,this._tmpAxis2,r,h,_);this._angle2.update(0),e(this._tmpAxis2)<m?t=0:i(this._axis1,this._tmpAxis2),this._angle1.update(t),s(this._lastScene,a)}this._screen[0].update(t[0]),this._screen[1].update(t[1]),this._time.update(n)}}addMomentumPreserveHeading(t,a,l,r,h,_,u){if(this.enabled){if(this._time.hasLastValue()){if(this._time.computeDelta(l)<.01)return;n(this._lastScene,a,this._tmpAxis2,this._tmpAxis1,this._tmpAngles,r,h,_,u,!1),e(this._tmpAxis2)<m?(this._angle1.update(0),this._angle2.update(0)):(this._angle1.update(this._tmpAngles[1]),this._angle2.update(this._tmpAngles[0]),i(this._axis1,this._tmpAxis1),i(this._axis2,this._tmpAxis2)),s(this._lastScene,a)}this._screen[0].update(t[0]),this._screen[1].update(t[1]),this._time.update(l)}}reset(){this._screen[0].reset(),this._screen[1].reset(),this._angle1.reset(),this._angle2.reset(),this._time.reset()}evaluateMomentum(){if(!this.enabled||!this._screen[0].hasFilteredDelta())return null;const t=this._screen[0].filteredDelta,e=this._screen[1].filteredDelta,i=null==t||null==e?null:Math.sqrt(t*t+e*e),s=this._time.filteredDelta,a=null==i||null==s?0:i/s;return Math.abs(a)<this._minimumInitialVelocity?null:this.createMomentum(a,this._stopVelocity,this._friction)}createMomentum(t,e,i){const s=this._time.filteredDelta,a=this._angle1.filteredValue,l=this._angle2.filteredValue,n=null==s||null==l?0:l/s;return new u(t,e,i,null==s||null==a?0:a/s,this._axis1,n,this._axis2)}}export{u as PanSphericalMomentum,o as PanSphericalMomentumEstimator};
5
+ import{create as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{F as e,n as i,d as s}from"../../chunks/vec32.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{rotationAngleAndAxisDirectRotation as l,rotationAnglesAndAxesHeadingPreserving as n}from"../3d/state/utils/navigationUtils.js";import{FilteredFiniteDifference as r}from"./FilteredFiniteDifference.js";import{FilteredValue as h}from"./FilteredValue.js";import{Momentum as _}from"./Momentum.js";const m=1e-5;class u extends _{constructor(t,e,i,s,a,l=0,n){super(t,e,i),this._angularVelocity1=s,this.axis1=a,this.angularVelocity2=l,this.axis2=n}value1(t){return super.valueFromInitialVelocity(this._angularVelocity1,t)}value2(t){return super.valueFromInitialVelocity(this.angularVelocity2,t)}}class o{constructor(e=300,i=12,s=.84){this._minimumInitialVelocity=e,this._stopVelocity=i,this._friction=s,this.enabled=!0,this._tmpAxis1=a(),this._tmpAxis2=a(),this._tmpAngles=t(),this._time=new r(.3),this._screen=[new r(.4),new r(.4)],this._angle1=new h(.6),this._angle2=new h(.6),this._axis1=a(),this._axis2=a(),this._lastScene=a()}addMomentumDirectRotation(t,a,n,r,h,_){if(this.enabled){if(this._time.hasLastValue()){if(this._time.computeDelta(n)<.01)return;let t=l(this._lastScene,a,this._tmpAxis2,r,h,_);this._angle2.update(0),e(this._tmpAxis2)<m?t=0:i(this._axis1,this._tmpAxis2),this._angle1.update(t),s(this._lastScene,a)}this._screen[0].update(t[0]),this._screen[1].update(t[1]),this._time.update(n)}}addMomentumPreserveHeading(t,a,l,r,h,_,u){if(this.enabled){if(this._time.hasLastValue()){if(this._time.computeDelta(l)<.01)return;n(this._lastScene,a,this._tmpAxis2,this._tmpAxis1,this._tmpAngles,r,h,_,u,!1),e(this._tmpAxis2)<m?(this._angle1.update(0),this._angle2.update(0)):(this._angle1.update(this._tmpAngles[1]),this._angle2.update(this._tmpAngles[0]),i(this._axis1,this._tmpAxis1),i(this._axis2,this._tmpAxis2)),s(this._lastScene,a)}this._screen[0].update(t[0]),this._screen[1].update(t[1]),this._time.update(l)}}reset(){this._screen[0].reset(),this._screen[1].reset(),this._angle1.reset(),this._angle2.reset(),this._time.reset()}evaluateMomentum(){if(!this.enabled||!this._screen[0].hasFilteredDelta())return null;const t=this._screen[0].filteredDelta,e=this._screen[1].filteredDelta,i=null==t||null==e?null:Math.sqrt(t*t+e*e),s=this._time.filteredDelta,a=null==i||null==s?0:i/s;return Math.abs(a)<this._minimumInitialVelocity?null:this.createMomentum(a,this._stopVelocity,this._friction)}createMomentum(t,e,i){const s=this._time.filteredDelta,a=this._angle1.filteredValue,l=this._angle2.filteredValue,n=null==s||null==l?0:l/s;return new u(t,e,i,null==s||null==a?0:a/s,this._axis1,n,this._axis2)}}export{u as PanSphericalMomentum,o as PanSphericalMomentumEstimator};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Logger.js";import{property as i,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/SpatialReference.js";import{toExtent as o}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as a}from"../../geometry/support/contains.js";import{GroundViewElevationSampler as s}from"./GroundViewElevationSampler.js";let l=class extends s{initialize(){this.view.basemapTerrain.on("elevation-change",()=>this.emit("changed",{}))}get demResolution(){return this.view.basemapTerrain.demResolution}get extent(){const e=this.view.basemapTerrain;if(null==e?.extent||null==e.spatialReference)return null;const t=o(e.extent,e.spatialReference);return t.zmin=e.visibleElevationBounds.min,t.zmax=e.visibleElevationBounds.max,t}get spatialReference(){return this.view.basemapTerrain?.spatialReference??r.WGS84}elevationAt(e,i){if(null==this.extent||!a(this.extent,e,i)){const n=null!=this.extent?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return t.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`),this.noDataValue}return this.view.elevationProvider?.getElevation(e,i,0,this.spatialReference,"ground")??this.noDataValue}};e([i({readOnly:!0})],l.prototype,"demResolution",null),e([i({readOnly:!0})],l.prototype,"extent",null),e([i()],l.prototype,"spatialReference",null),l=e([n("esri.views.support.GroundElevationSampler")],l);export{l as GroundElevationSampler};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Logger.js";import{property as i,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/SpatialReference.js";import{toExtent as o}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as a}from"../../geometry/support/contains.js";import{GroundViewElevationSampler as s}from"./GroundViewElevationSampler.js";let l=class extends s{initialize(){this.view.basemapTerrain.on("elevation-change",()=>this.emit("changed",{}))}get demResolution(){return this.view.basemapTerrain.demResolution}get extent(){const e=this.view.basemapTerrain;if(null==e?.extent||null==e.spatialReference)return null;const t=o(e.extent,e.spatialReference);return t.zmin=e.visibleElevationRange.minElevation,t.zmax=e.visibleElevationRange.maxElevation,t}get spatialReference(){return this.view.basemapTerrain?.spatialReference??r.WGS84}elevationAt(e,i){if(null==this.extent||!a(this.extent,e,i)){const n=null!=this.extent?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return t.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`),this.noDataValue}return this.view.elevationProvider?.getElevation(e,i,0,this.spatialReference,"ground")??this.noDataValue}};e([i({readOnly:!0})],l.prototype,"demResolution",null),e([i({readOnly:!0})],l.prototype,"extent",null),e([i()],l.prototype,"spatialReference",null),l=e([n("esri.views.support.GroundElevationSampler")],l);export{l as GroundElevationSampler};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{createArea as t}from"../../core/quantity.js";import{areaUnitFromSpatialReference as o}from"../../core/units.js";import{e as r}from"../../chunks/earcut.js";import{h as n,c as e,E as s}from"../../chunks/vec32.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as c}from"../../geometry/projection/projectVectorToVector.js";import{fromPoints as f,wrap as u,getNormal as l,projectPointLocal as m}from"../../geometry/support/plane.js";import{areaPoints2d as p}from"../../geometry/support/triangle.js";import{computeEuclideanMeasurementSR as a}from"./measurementUtils.js";function g(t,o=k()){return j(t,o)}function h(t,o=k()){return j(t,o,!1)}function j(r,g,h=r.hasZ){const j=a(r.spatialReference),k=o(j);if(null==k)return null;const x=(t,o)=>!(o.length<2)&&(n(t,o[0],o[1],h&&o[2]||0),!0);let C=0;for(const t of r.rings){const o=t.length;if(o<3)continue;const{positionsWorldCoords:a}=g;for(;a.length<o;)a.push(i());const h=y,k=n(d,0,0,0),R=1/o;for(let n=0;n<o;n++){if(!x(h,t[n]))return null;if(!c(h,r.spatialReference,a[n],j))return null;e(k,k,a[n],R)}const V=f(a[0],a[1],k,u());if(0===s(l(V)))continue;for(let t=0;t<o;t++)m(V,k,a[t],a[t]);const W=v(a);for(let t=0;t<W.length;t+=3)C+=p(a[W[t]],a[W[t+1]],a[W[t+2]])}return t(C,k)}const y=i(),d=i();function k(){return{positionsWorldCoords:[]}}function v(t){return r(x(t),[],2)}function x(t){const o=new Float64Array(2*t.length);for(let r=0;r<t.length;++r){const n=t[r],e=2*r;o[e]=n[0],o[e+1]=n[1]}return o}export{j as computeEuclideanPlanarArea,k as createEuclideanPlanarAreaCache,h as euclideanHorizontalPlanarArea,g as euclideanPlanarArea,v as triangulate};
5
+ import{createArea as t}from"../../core/quantity.js";import{areaUnitFromSpatialReference as o}from"../../core/units.js";import{e as r}from"../../chunks/earcut.js";import{h as n,c as e,F as s}from"../../chunks/vec32.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as c}from"../../geometry/projection/projectVectorToVector.js";import{fromPoints as f,wrap as u,getNormal as l,projectPointLocal as m}from"../../geometry/support/plane.js";import{areaPoints2d as p}from"../../geometry/support/triangle.js";import{computeEuclideanMeasurementSR as a}from"./measurementUtils.js";function g(t,o=k()){return j(t,o)}function h(t,o=k()){return j(t,o,!1)}function j(r,g,h=r.hasZ){const j=a(r.spatialReference),k=o(j);if(null==k)return null;const x=(t,o)=>!(o.length<2)&&(n(t,o[0],o[1],h&&o[2]||0),!0);let C=0;for(const t of r.rings){const o=t.length;if(o<3)continue;const{positionsWorldCoords:a}=g;for(;a.length<o;)a.push(i());const h=y,k=n(d,0,0,0),F=1/o;for(let n=0;n<o;n++){if(!x(h,t[n]))return null;if(!c(h,r.spatialReference,a[n],j))return null;e(k,k,a[n],F)}const R=f(a[0],a[1],k,u());if(0===s(l(R)))continue;for(let t=0;t<o;t++)m(R,k,a[t],a[t]);const V=v(a);for(let t=0;t<V.length;t+=3)C+=p(a[V[t]],a[V[t+1]],a[V[t+2]])}return t(C,k)}const y=i(),d=i();function k(){return{positionsWorldCoords:[]}}function v(t){return r(x(t),[],2)}function x(t){const o=new Float64Array(2*t.length);for(let r=0;r<t.length;++r){const n=t[r],e=2*r;o[e]=n[0],o[e+1]=n[1]}return o}export{j as computeEuclideanPlanarArea,k as createEuclideanPlanarAreaCache,h as euclideanHorizontalPlanarArea,g as euclideanPlanarArea,v as triangulate};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{createLength as n}from"../../core/quantity.js";import{verticalLengthUnitFromSpatialReference as t,lengthUnitFromSpatialReference as e}from"../../core/units.js";import{C as r,h as l}from"../../chunks/vec32.js";import{create as u}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as i}from"../../geometry/projection/projectVectorToVector.js";import{equals as o}from"../../geometry/support/spatialReferenceUtils.js";import{computeEuclideanMeasurementSR as c}from"./measurementUtils.js";function s(n){return f(n,0)}function a(n){return f(n,1)}function f(t,r){const{hasZ:l,spatialReference:u}=t,i=c(u);let o=0;const s=e(i);if(null==s)return null;const a=0===r?Z:j;for(const n of t.paths){if(n.length<2)continue;const t=n.length-1;for(let e=0;e<t;++e){const t=n[e];b[0]=t[0],b[1]=t[1],b[2]=l?t[2]:0;const r=n[e+1];S[0]=r[0],S[1]=r[1],S[2]=l?r[2]:0;const i=a(b,S,u);if(null==i)return null;o+=i.value}}return n(o,s)}function p(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,S[0]=t.x,S[1]=t.y,S[2]=t.hasZ?t.z:0,x(b,S,e)):null}function h(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,S[0]=t.x,S[1]=t.y,S[2]=t.hasZ?t.z:0,Z(b,S,e)):null}function m(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,S[0]=t.x,S[1]=t.y,S[2]=t.hasZ?t.z:0,j(b,S,e)):null}function z(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,S[0]=t.x,S[1]=t.y,S[2]=t.hasZ?t.z:0,d(b,S,e)):null}function y(n){return null!=n?R(n.hasZ?n.z:0,n.spatialReference):null}function R(e,r){const l=t(r);return null!=l?n(e??0,l):null}function x(t,e,r){const l=g(t,e,r);return null!=l?{direct:n(l.direct,l.unit),horizontal:n(l.horizontal,l.unit),vertical:n(l.vertical,l.unit)}:null}function Z(t,e,r){const l=g(t,e,r,0);return null!=l?n(l.direct,l.unit):null}function j(t,e,r){const l=g(t,e,r,1);return null!=l?n(l.horizontal,l.unit):null}function v(t,e,r){const l=g(t,e,r,2);return null!=l?n(Math.abs(l.verticalSigned),l.unit):null}function d(t,e,r){const l=g(t,e,r,2);return null!=l?n(l.verticalSigned,l.unit):null}function g(n,t,u,o){const s=c(u),a=e(s);if(null==a)return null;const f=t[2]-n[2];if(2===o)return{verticalSigned:f,unit:a};if(!i(n,u,M,s)||!i(t,u,U,s))return null;if(0===o){return{direct:r(U,M),unit:a}}if(l(V,n[0],n[1],t[2]),!i(V,u,V,s))return null;const p=r(V,U);if(1===o)return{horizontal:p,unit:a};return{direct:r(U,M),horizontal:p,vertical:Math.abs(f),unit:a}}const b=u(),S=u(),M=u(),U=u(),V=u();export{y as elevationFromPoint,R as elevationFromZ,Z as euclideanDirectDistance,h as euclideanDirectDistanceBetweenPoints,x as euclideanDistance,p as euclideanDistanceBetweenPoints,j as euclideanHorizontalDistance,m as euclideanHorizontalDistanceBetweenPoints,a as euclideanHorizontalLength,s as euclideanLength,v as verticalDistance,d as verticalSignedDistance,z as verticalSignedDistanceBetweenPoints};
5
+ import{createLength as n}from"../../core/quantity.js";import{verticalLengthUnitFromSpatialReference as t,lengthUnitFromSpatialReference as e}from"../../core/units.js";import{D as r,h as l}from"../../chunks/vec32.js";import{create as u}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as i}from"../../geometry/projection/projectVectorToVector.js";import{equals as o}from"../../geometry/support/spatialReferenceUtils.js";import{computeEuclideanMeasurementSR as c}from"./measurementUtils.js";function s(n){return f(n,0)}function a(n){return f(n,1)}function f(t,r){const{hasZ:l,spatialReference:u}=t,i=c(u);let o=0;const s=e(i);if(null==s)return null;const a=0===r?Z:j;for(const n of t.paths){if(n.length<2)continue;const t=n.length-1;for(let e=0;e<t;++e){const t=n[e];b[0]=t[0],b[1]=t[1],b[2]=l?t[2]:0;const r=n[e+1];S[0]=r[0],S[1]=r[1],S[2]=l?r[2]:0;const i=a(b,S,u);if(null==i)return null;o+=i.value}}return n(o,s)}function p(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,S[0]=t.x,S[1]=t.y,S[2]=t.hasZ?t.z:0,x(b,S,e)):null}function h(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,S[0]=t.x,S[1]=t.y,S[2]=t.hasZ?t.z:0,Z(b,S,e)):null}function m(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,S[0]=t.x,S[1]=t.y,S[2]=t.hasZ?t.z:0,j(b,S,e)):null}function z(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,S[0]=t.x,S[1]=t.y,S[2]=t.hasZ?t.z:0,d(b,S,e)):null}function y(n){return null!=n?R(n.hasZ?n.z:0,n.spatialReference):null}function R(e,r){const l=t(r);return null!=l?n(e??0,l):null}function x(t,e,r){const l=g(t,e,r);return null!=l?{direct:n(l.direct,l.unit),horizontal:n(l.horizontal,l.unit),vertical:n(l.vertical,l.unit)}:null}function Z(t,e,r){const l=g(t,e,r,0);return null!=l?n(l.direct,l.unit):null}function j(t,e,r){const l=g(t,e,r,1);return null!=l?n(l.horizontal,l.unit):null}function v(t,e,r){const l=g(t,e,r,2);return null!=l?n(Math.abs(l.verticalSigned),l.unit):null}function d(t,e,r){const l=g(t,e,r,2);return null!=l?n(l.verticalSigned,l.unit):null}function g(n,t,u,o){const s=c(u),a=e(s);if(null==a)return null;const f=t[2]-n[2];if(2===o)return{verticalSigned:f,unit:a};if(!i(n,u,M,s)||!i(t,u,U,s))return null;if(0===o){return{direct:r(U,M),unit:a}}if(l(V,n[0],n[1],t[2]),!i(V,u,V,s))return null;const p=r(V,U);if(1===o)return{horizontal:p,unit:a};return{direct:r(U,M),horizontal:p,vertical:Math.abs(f),unit:a}}const b=u(),S=u(),M=u(),U=u(),V=u();export{y as elevationFromPoint,R as elevationFromZ,Z as euclideanDirectDistance,h as euclideanDirectDistanceBetweenPoints,x as euclideanDistance,p as euclideanDistanceBetweenPoints,j as euclideanHorizontalDistance,m as euclideanHorizontalDistanceBetweenPoints,a as euclideanHorizontalLength,s as euclideanLength,v as verticalDistance,d as verticalSignedDistance,z as verticalSignedDistanceBetweenPoints};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{floatEqualAbsolute as t}from"../../core/mathUtils.js";import{subtract as n,length as r,scaleAndAdd as s,sub as e,dot as o,squaredLength as c,lerp as i,set as u,distance as a,squaredDistance as f}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as p,fromValues as m,ZEROS as h}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as d,g as l,c as y,h as b,f as j,w as M,e as g,d as x,C as q,H as v}from"../../chunks/vec32.js";import{create as U,clone as k}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as w}from"../../core/libs/gl-matrix-2/math/common.js";import{fromPositionAndNormal as C,create as L,distance as A,intersectLine as H,isPointInside as P}from"../../geometry/support/plane.js";import{tangentFrame as z}from"../3d/support/mathUtils.js";import{intersectLineLikeAndCircle as B}from"./geometry2dUtils.js";function D({start:t,end:r,type:e},i,u){const a=[],f=n(rt,r,t),m=n(st,t,i),h=c(f),d=2*o(f,m),l=d*d-4*h*(c(m)-u*u);if(0===l){const n=-d/(2*h);(0===e||n>=0)&&a.push(s(p(),t,f,n))}else if(l>0){const n=Math.sqrt(l),r=(-d+n)/(2*h);(0===e||r>=0)&&a.push(s(p(),t,f,r));const o=(-d-n)/(2*h);(0===e||o>=0)&&a.push(s(p(),t,f,o))}return a}function E(t,r){const s=t.start,c=t.end,i=n(rt,c,s),u=b(ot,-i[1],i[0],0),a=r.start,f=r.end,p=d(ct,f,a),m=l(p,u),h=b(it,s[0],s[1],0),j=d(ut,h,a),M=l(j,u),g=w();if(Math.abs(m)<g)return Math.abs(M),[];const x=y(at,a,p,M/m);if(0===r.type){const t=d(ft,x,a);if(l(t,p)<-g)return[]}if(1===t.type){const t=e(st,x,s);if(o(t,i)<-g)return[]}return[k(x)]}function F(t,n){return V(Y(mt,n[2],t),n)}function G(t,n){const r=0;return T(Y(mt,r,t),Y(ht,r,n)).map(([t,n])=>m(t,n))}function I(t,n,r){return O(t,Y(mt,t[2],n),r)}function J(t,n){return Q(Y(mt,t[2],n),t)}function K(t,e,o,c=U()){const i=n(rt,t,e),u=r(i);return s(c,e,i,0===u?1:o/u),c[2]=t[2],c}function N(t,n,r){return a(t,n)-r}function O(t,{start:n,end:r,type:s},e=U()){const o=d(et,t,n),c=d(ot,r,n),i=l(o,c)/l(c,c);return y(e,n,c,0===s?Math.max(i,0):i)}function Q({start:t,end:n,type:r},s){const e=d(et,s,t),o=d(ot,n,t);if(0===r&&l(o,e)<-w())return q(t,s);const c=j(ct,o,e);return v(c)/v(o)}const R=(()=>{const t=U(),n=U(),r=U();return({start:s,end:e},{center:o,radius:c,normal:i,slicePlane:a})=>{const f=C(o,i,pt);if($(A(f,s),0)&&$(A(f,e),0)){z(i,t,n);const f=(s,e)=>(g(r,e,o),u(s,l(r,t),l(r,n)),s),p=B({start:f(rt,s),end:f(st,e),type:1},h,c),m=[];for(const[r,s]of p){const e=x(U(),o);y(e,e,t,r),y(e,e,n,s),a&&!tt(a,e)||m.push(e)}return m}const p=U();return H(f,s,e,p)?!$(q(p,o),c)||a&&!tt(a,p)?[]:[p]:[]}})();function S({start:t,end:r,type:s},e,i){const u=[],a=g(et,r,t),f=n(st,t,e),p=c(a),m=2*o(a,f),h=m*m-4*p*(c(f)-i*i);if(0===h){const n=-m/(2*p);(1===s||n>=0)&&u.push(y(U(),t,a,n))}else if(h>0){const n=Math.sqrt(h),r=(-m+n)/(2*p);(1===s||r>=0)&&u.push(y(U(),t,a,r));const e=(-m-n)/(2*p);(1===s||e>=0)&&u.push(y(U(),t,a,e))}return u}function T(t,n){const r=t.start,s=t.end,e=n.start,o=n.end,c=d(et,s,r),i=d(ot,o,e),u=d(ct,e,r),a=j(it,c,i);if(!$(l(u,a),0))return[];const f=M(a);if($(f,0))return[];const p=j(ut,u,i),m=l(p,a)/f,h=y(at,r,c,m);if(0===t.type){const t=d(ft,h,r);if(l(c,t)<-w())return[]}if(0===n.type){const t=d(ft,h,e);if(l(i,t)<-w())return[]}return[k(h)]}function V({start:t,end:n,type:r},s){const e=d(et,s,t),o=d(ot,n,t),c=j(ct,o,e),i=M(c)/M(o),u=w();if(i<u)switch(r){case 1:return[k(s)];case 0:return l(o,e)<-u?[]:[k(s)]}return[]}function W(t,n,r){return $(f(r,t),n*n)?[k(r)]:[]}function X(t,n,r,s){const[e,o]=t,[c,u]=r,a=c-e,f=u-o,p=a*a+f*f,h=Math.sqrt(p);if(h>n+s)return[];if(h<Math.abs(n-s))return[];if($(h,0)&&$(n,s))return[];const d=(n*n-s*s+p)/(2*h),l=Math.sqrt(n*n-d*d),y=l*f/h,b=l*a/h,[j,M]=i(rt,t,r,d/h);return $(y,b)?[m(j,M)]:[m(j+y,M-b),m(j-y,M+b)]}function Y(t,n,{start:r,end:s,type:e}){return b(t.start,r[0],r[1],n),b(t.end,s[0],s[1],n),t.type=nt[e],t}function Z(t,n){return $(t[2],n[2])}function $(n,r){return t(Math.abs(n-r),0,w())}function _(t,n){return n.filter(n=>tt(t,n))}function tt(t,n){return P(t,n)}const nt={0:1,1:0},rt=p(),st=p(),et=U(),ot=U(),ct=U(),it=U(),ut=U(),at=U(),ft=U(),pt=L(),mt={start:U(),end:U(),type:1},ht={start:U(),end:U(),type:1};export{V as intersectLineAndPoint,R as intersectLineLikeAndCircle,S as intersectLineLikeAndVerticalCylinder,T as intersectLineLikes,W as intersectVerticalCylinderAndPoint,X as intersectVerticalCylinders,E as intersectVerticalPlaneAndLineLike,F as intersectVerticalPlaneAndPoint,D as intersectVerticalPlaneAndVerticalCylinder,G as intersectVerticalPlanes,$ as isClose,tt as isPointInsidePlane,Q as pointToLineLikeDistance,N as pointToVerticalCylinderDistance,J as pointToVerticalPlaneDistance,_ as pointsInsidePlane,O as projectPointToLineLike,K as projectPointToVerticalCylinder,I as projectPointToVerticalPlane,Z as vectorsHaveCloseZ};
5
+ import{floatEqualAbsolute as t}from"../../core/mathUtils.js";import{subtract as n,length as r,scaleAndAdd as s,sub as e,dot as o,squaredLength as c,lerp as i,set as u,distance as a,squaredDistance as f}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as p,fromValues as m,ZEROS as h}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as d,g as l,c as y,h as b,f as j,w as M,e as g,d as x,D as q,B as v}from"../../chunks/vec32.js";import{create as U,clone as k}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as w}from"../../core/libs/gl-matrix-2/math/common.js";import{fromPositionAndNormal as L,create as A,distance as B,intersectLine as C,isPointInside as D}from"../../geometry/support/plane.js";import{tangentFrame as P}from"../3d/support/mathUtils.js";import{intersectLineLikeAndCircle as z}from"./geometry2dUtils.js";function E({start:t,end:r,type:e},i,u){const a=[],f=n(rt,r,t),m=n(st,t,i),h=c(f),d=2*o(f,m),l=d*d-4*h*(c(m)-u*u);if(0===l){const n=-d/(2*h);(0===e||n>=0)&&a.push(s(p(),t,f,n))}else if(l>0){const n=Math.sqrt(l),r=(-d+n)/(2*h);(0===e||r>=0)&&a.push(s(p(),t,f,r));const o=(-d-n)/(2*h);(0===e||o>=0)&&a.push(s(p(),t,f,o))}return a}function F(t,r){const s=t.start,c=t.end,i=n(rt,c,s),u=b(ot,-i[1],i[0],0),a=r.start,f=r.end,p=d(ct,f,a),m=l(p,u),h=b(it,s[0],s[1],0),j=d(ut,h,a),M=l(j,u),g=w();if(Math.abs(m)<g)return Math.abs(M),[];const x=y(at,a,p,M/m);if(0===r.type){const t=d(ft,x,a);if(l(t,p)<-g)return[]}if(1===t.type){const t=e(st,x,s);if(o(t,i)<-g)return[]}return[k(x)]}function G(t,n){return V(Y(mt,n[2],t),n)}function H(t,n){const r=0;return T(Y(mt,r,t),Y(ht,r,n)).map(([t,n])=>m(t,n))}function I(t,n,r){return O(t,Y(mt,t[2],n),r)}function J(t,n){return Q(Y(mt,t[2],n),t)}function K(t,e,o,c=U()){const i=n(rt,t,e),u=r(i);return s(c,e,i,0===u?1:o/u),c[2]=t[2],c}function N(t,n,r){return a(t,n)-r}function O(t,{start:n,end:r,type:s},e=U()){const o=d(et,t,n),c=d(ot,r,n),i=l(o,c)/l(c,c);return y(e,n,c,0===s?Math.max(i,0):i)}function Q({start:t,end:n,type:r},s){const e=d(et,s,t),o=d(ot,n,t);if(0===r&&l(o,e)<-w())return q(t,s);const c=j(ct,o,e);return v(c)/v(o)}const R=(()=>{const t=U(),n=U(),r=U();return({start:s,end:e},{center:o,radius:c,normal:i,slicePlane:a})=>{const f=L(o,i,pt);if($(B(f,s),0)&&$(B(f,e),0)){P(i,t,n);const f=(s,e)=>(g(r,e,o),u(s,l(r,t),l(r,n)),s),p=z({start:f(rt,s),end:f(st,e),type:1},h,c),m=[];for(const[r,s]of p){const e=x(U(),o);y(e,e,t,r),y(e,e,n,s),a&&!tt(a,e)||m.push(e)}return m}const p=U();return C(f,s,e,p)?!$(q(p,o),c)||a&&!tt(a,p)?[]:[p]:[]}})();function S({start:t,end:r,type:s},e,i){const u=[],a=g(et,r,t),f=n(st,t,e),p=c(a),m=2*o(a,f),h=m*m-4*p*(c(f)-i*i);if(0===h){const n=-m/(2*p);(1===s||n>=0)&&u.push(y(U(),t,a,n))}else if(h>0){const n=Math.sqrt(h),r=(-m+n)/(2*p);(1===s||r>=0)&&u.push(y(U(),t,a,r));const e=(-m-n)/(2*p);(1===s||e>=0)&&u.push(y(U(),t,a,e))}return u}function T(t,n){const r=t.start,s=t.end,e=n.start,o=n.end,c=d(et,s,r),i=d(ot,o,e),u=d(ct,e,r),a=j(it,c,i);if(!$(l(u,a),0))return[];const f=M(a);if($(f,0))return[];const p=j(ut,u,i),m=l(p,a)/f,h=y(at,r,c,m);if(0===t.type){const t=d(ft,h,r);if(l(c,t)<-w())return[]}if(0===n.type){const t=d(ft,h,e);if(l(i,t)<-w())return[]}return[k(h)]}function V({start:t,end:n,type:r},s){const e=d(et,s,t),o=d(ot,n,t),c=j(ct,o,e),i=M(c)/M(o),u=w();if(i<u)switch(r){case 1:return[k(s)];case 0:return l(o,e)<-u?[]:[k(s)]}return[]}function W(t,n,r){return $(f(r,t),n*n)?[k(r)]:[]}function X(t,n,r,s){const[e,o]=t,[c,u]=r,a=c-e,f=u-o,p=a*a+f*f,h=Math.sqrt(p);if(h>n+s)return[];if(h<Math.abs(n-s))return[];if($(h,0)&&$(n,s))return[];const d=(n*n-s*s+p)/(2*h),l=Math.sqrt(n*n-d*d),y=l*f/h,b=l*a/h,[j,M]=i(rt,t,r,d/h);return $(y,b)?[m(j,M)]:[m(j+y,M-b),m(j-y,M+b)]}function Y(t,n,{start:r,end:s,type:e}){return b(t.start,r[0],r[1],n),b(t.end,s[0],s[1],n),t.type=nt[e],t}function Z(t,n){return $(t[2],n[2])}function $(n,r){return t(Math.abs(n-r),0,w())}function _(t,n){return n.filter(n=>tt(t,n))}function tt(t,n){return D(t,n)}const nt={0:1,1:0},rt=p(),st=p(),et=U(),ot=U(),ct=U(),it=U(),ut=U(),at=U(),ft=U(),pt=A(),mt={start:U(),end:U(),type:1},ht={start:U(),end:U(),type:1};export{V as intersectLineAndPoint,R as intersectLineLikeAndCircle,S as intersectLineLikeAndVerticalCylinder,T as intersectLineLikes,W as intersectVerticalCylinderAndPoint,X as intersectVerticalCylinders,F as intersectVerticalPlaneAndLineLike,G as intersectVerticalPlaneAndPoint,E as intersectVerticalPlaneAndVerticalCylinder,H as intersectVerticalPlanes,$ as isClose,tt as isPointInsidePlane,Q as pointToLineLikeDistance,N as pointToVerticalCylinderDistance,J as pointToVerticalPlaneDistance,_ as pointsInsidePlane,O as projectPointToLineLike,K as projectPointToVerticalCylinder,I as projectPointToVerticalPlane,Z as vectorsHaveCloseZ};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- function e(e){return!(null==e||"object"!=typeof e||!("createQuery"in e)||!e.createQuery)}export{e as isSelectableLayer};
5
+ function e(e){return!(null==e||"object"!=typeof e||!("createQuery"in e)||!e.createQuery)}export{e as isISelectableLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../Graphic.js";import i from"../../core/Accessor.js";import a from"../../core/Collection.js";import n from"../../core/Error.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as o,cast as c,subclass as h}from"../../core/accessorSupport/decorators.js";import d from"../../popup/support/AttachmentsOrderByInfo.js";import l from"../../rest/query/support/AttachmentInfo.js";import p from"../../rest/support/AttachmentQuery.js";import{getSourceLayer as m}from"../Feature/support/featureUtils.js";const u={editing:!1,operations:{add:!0,update:!0,delete:!0}},f=a.ofType(l);let y=class extends i{constructor(t){super(t),this._getAttachmentsPromise=null,this._attachmentLayer=null,this.attachmentKeywords=null,this.attachmentTypes=null,this.capabilities={...u},this.activeAttachmentInfo=null,this.activeFileInfo=null,this.attachmentInfos=new f,this.fileInfos=new a,this.graphic=null,this.mode="view",this.orderByFields=null,this.filesEnabled=!1,this.addHandles(r(()=>this.graphic,()=>this._graphicChanged(),s))}destroy(){this._attachmentLayer=null,this.graphic=null}castCapabilities(t){return{...u,...t}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){const{graphic:t}=this;if(!t)return!1;const e=t.layer||t.sourceLayer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsResize||!1}get supportsTypeWildcard(){const{graphic:t}=this;if(!t)return!1;const e=t.layer||t.sourceLayer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsTypeWildcard||!1}async getAttachments(){const{_attachmentLayer:t,attachmentInfos:e,orderByFields:i,attachmentTypes:a,attachmentKeywords:r,supportsTypeWildcard:s}=this;if(!t||"function"!=typeof t.queryAttachments)throw new n("invalid-layer","getAttachments(): A valid layer is required.");const o=this._getObjectId();if("number"!=typeof o)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const c=i?.map(t=>`${t.field} ${"descending"===t.order?"DESC":"ASC"}`),h=new p({objectIds:[o],returnMetadata:!0,orderByFields:c,attachmentTypes:s?a?.filter(Boolean).map(t=>`${t}/*`):void 0,keywords:r}),d=[],l=t.queryAttachments(h).then(t=>t[o]||d).catch(()=>d);this._getAttachmentsPromise=l,this.notifyChange("state");const m=await l;return e.destroyAll(),m.length&&e.addMany(m),this._getAttachmentsPromise=null,this.notifyChange("state"),m}async addAttachment(t,e=this.graphic){const{_attachmentLayer:i,attachmentInfos:a,capabilities:r}=this;if(!e)throw new n("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:e});if(!t)throw new n("invalid-attachment","addAttachment(): An attachment is required.",{attachment:t});if(!r.operations?.add)throw new n("invalid-capabilities","addAttachment(): add capabilities are required.");if(!i||"function"!=typeof i.addAttachment)throw new n("invalid-layer","addAttachment(): A valid layer is required.");const s=i.addAttachment(e,t).then(t=>this._queryAttachment(t.objectId,e)),o=await s;return a.add(o),o}async deleteAttachment(t){const{_attachmentLayer:e,attachmentInfos:i,graphic:a,capabilities:r}=this;if(!t)throw new n("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:t});if(!r.operations?.delete)throw new n("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!e||"function"!=typeof e.deleteAttachments)throw new n("invalid-layer","deleteAttachment(): A valid layer is required.");if(!a)throw new n("invalid-graphic","deleteAttachment(): A graphic is required.");const s=e.deleteAttachments(a,[t.id]).then(()=>t),o=await s;return i.remove(o),o.destroy(),o}async updateAttachment(t,e=this.activeAttachmentInfo){const{_attachmentLayer:i,attachmentInfos:a,graphic:r,capabilities:s}=this;if(!t)throw new n("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:t});if(!e)throw new n("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:e});if(!s.operations?.update)throw new n("invalid-capabilities","updateAttachment(): Update capabilities are required.");const o=a.indexOf(e);if(!i||"function"!=typeof i.updateAttachment)throw new n("invalid-layer","updateAttachment(): A valid layer is required.");if(!r)throw new n("invalid-graphic","updateAttachment(): A graphic is required.");const c=i.updateAttachment(r,e.id,t).then(t=>this._queryAttachment(t.objectId)),h=await c;return a.splice(o,1,h),h}async commitFiles(){return await Promise.all(this.fileInfos.items.map(t=>this.addAttachment(t.form))),this.fileInfos.removeAll(),this.getAttachments()}addFile(t,e){if(!t||!e)return null;const i={file:t,form:e};return this.fileInfos.add(i),i}updateFile(t,e,i=this.activeFileInfo){if(!t||!e||!i)return null;const a=this.fileInfos.indexOf(i);return a>-1&&this.fileInfos.splice(a,1,{file:t,form:e}),this.fileInfos.items[a]}deleteFile(t){const e=this.fileInfos.find(e=>e.file===t);return e?(this.fileInfos.remove(e),e):null}async _queryAttachment(t,e){const{_attachmentLayer:i}=this;if(!t||!i?.queryAttachments)throw new n("invalid-attachment-id","Could not query attachment.");const a=this._getObjectId(e);if("number"!=typeof a)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const r=new p({objectIds:[a],attachmentsWhere:`AttachmentId=${t}`,returnMetadata:!0});return i.queryAttachments(r).then(t=>t[a][0])}_getObjectId(t=this.graphic){return t?.getObjectId()??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>this.attachmentInfos.destroyAll()))}_setAttachmentLayer(){const{graphic:t}=this,e=m(t);this._attachmentLayer=e?"scene"===e.type&&null!=e.associatedLayer?e.associatedLayer:e:null}};t([o({type:[String]})],y.prototype,"attachmentKeywords",void 0),t([o({type:[["application","audio","image","model","text","video"]]})],y.prototype,"attachmentTypes",void 0),t([o()],y.prototype,"capabilities",void 0),t([c("capabilities")],y.prototype,"castCapabilities",null),t([o()],y.prototype,"activeAttachmentInfo",void 0),t([o()],y.prototype,"activeFileInfo",void 0),t([o({readOnly:!0,type:f})],y.prototype,"attachmentInfos",void 0),t([o()],y.prototype,"fileInfos",void 0),t([o({type:e})],y.prototype,"graphic",void 0),t([o()],y.prototype,"mode",void 0),t([o({type:[d]})],y.prototype,"orderByFields",void 0),t([o({readOnly:!0})],y.prototype,"state",null),t([o()],y.prototype,"filesEnabled",void 0),t([o({readOnly:!0})],y.prototype,"supportsResizeAttachments",null),t([o({readOnly:!0})],y.prototype,"supportsTypeWildcard",null),y=t([h("esri.widgets.Attachments.AttachmentsViewModel")],y);export{y as default};
5
+ import{__decorate as t}from"tslib";import e from"../../Graphic.js";import i from"../../core/Accessor.js";import a from"../../core/Collection.js";import n from"../../core/Error.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as o,cast as c,subclass as h}from"../../core/accessorSupport/decorators.js";import d from"../../popup/support/AttachmentsOrderByInfo.js";import l from"../../rest/query/support/AttachmentInfo.js";import p from"../../rest/support/AttachmentQuery.js";import{getSourceLayer as m}from"../Feature/support/featureUtils.js";const u={editing:!1,operations:{add:!0,update:!0,delete:!0}},f=a.ofType(l);let y=class extends i{constructor(t){super(t),this._getAttachmentsPromise=null,this._attachmentLayer=null,this.attachmentKeywords=null,this.attachmentTypes=null,this.capabilities={...u},this.activeAttachmentInfo=null,this.activeFileInfo=null,this.attachmentInfos=new f,this.fileInfos=new a,this.graphic=null,this.mode="view",this.orderByFields=null,this.filesEnabled=!1,this.addHandles(r(()=>this.graphic,()=>this._graphicChanged(),s))}destroy(){this._attachmentLayer=null,this.graphic=null}castCapabilities(t){return{...u,...t}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){const{graphic:t}=this;if(!t)return!1;const e=t.sourceLayer??t.layer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsResize||!1}get supportsTypeWildcard(){const{graphic:t}=this;if(!t)return!1;const e=t.sourceLayer??t.layer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsTypeWildcard||!1}async getAttachments(){const{_attachmentLayer:t,attachmentInfos:e,orderByFields:i,attachmentTypes:a,attachmentKeywords:r,supportsTypeWildcard:s}=this;if(!t||"function"!=typeof t.queryAttachments)throw new n("invalid-layer","getAttachments(): A valid layer is required.");const o=this._getObjectId();if("number"!=typeof o)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const c=i?.map(t=>`${t.field} ${"descending"===t.order?"DESC":"ASC"}`),h=new p({objectIds:[o],returnMetadata:!0,orderByFields:c,attachmentTypes:s?a?.filter(Boolean).map(t=>`${t}/*`):void 0,keywords:r}),d=[],l=t.queryAttachments(h).then(t=>t[o]||d).catch(()=>d);this._getAttachmentsPromise=l,this.notifyChange("state");const m=await l;return e.destroyAll(),m.length&&e.addMany(m),this._getAttachmentsPromise=null,this.notifyChange("state"),m}async addAttachment(t,e=this.graphic){const{_attachmentLayer:i,attachmentInfos:a,capabilities:r}=this;if(!e)throw new n("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:e});if(!t)throw new n("invalid-attachment","addAttachment(): An attachment is required.",{attachment:t});if(!r.operations?.add)throw new n("invalid-capabilities","addAttachment(): add capabilities are required.");if(!i||"function"!=typeof i.addAttachment)throw new n("invalid-layer","addAttachment(): A valid layer is required.");const s=i.addAttachment(e,t).then(t=>this._queryAttachment(t.objectId,e)),o=await s;return a.add(o),o}async deleteAttachment(t){const{_attachmentLayer:e,attachmentInfos:i,graphic:a,capabilities:r}=this;if(!t)throw new n("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:t});if(!r.operations?.delete)throw new n("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!e||"function"!=typeof e.deleteAttachments)throw new n("invalid-layer","deleteAttachment(): A valid layer is required.");if(!a)throw new n("invalid-graphic","deleteAttachment(): A graphic is required.");const s=e.deleteAttachments(a,[t.id]).then(()=>t),o=await s;return i.remove(o),o.destroy(),o}async updateAttachment(t,e=this.activeAttachmentInfo){const{_attachmentLayer:i,attachmentInfos:a,graphic:r,capabilities:s}=this;if(!t)throw new n("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:t});if(!e)throw new n("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:e});if(!s.operations?.update)throw new n("invalid-capabilities","updateAttachment(): Update capabilities are required.");const o=a.indexOf(e);if(!i||"function"!=typeof i.updateAttachment)throw new n("invalid-layer","updateAttachment(): A valid layer is required.");if(!r)throw new n("invalid-graphic","updateAttachment(): A graphic is required.");const c=i.updateAttachment(r,e.id,t).then(t=>this._queryAttachment(t.objectId)),h=await c;return a.splice(o,1,h),h}async commitFiles(){return await Promise.all(this.fileInfos.items.map(t=>this.addAttachment(t.form))),this.fileInfos.removeAll(),this.getAttachments()}addFile(t,e){if(!t||!e)return null;const i={file:t,form:e};return this.fileInfos.add(i),i}updateFile(t,e,i=this.activeFileInfo){if(!t||!e||!i)return null;const a=this.fileInfos.indexOf(i);return a>-1&&this.fileInfos.splice(a,1,{file:t,form:e}),this.fileInfos.items[a]}deleteFile(t){const e=this.fileInfos.find(e=>e.file===t);return e?(this.fileInfos.remove(e),e):null}async _queryAttachment(t,e){const{_attachmentLayer:i}=this;if(!t||!i?.queryAttachments)throw new n("invalid-attachment-id","Could not query attachment.");const a=this._getObjectId(e);if("number"!=typeof a)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const r=new p({objectIds:[a],attachmentsWhere:`AttachmentId=${t}`,returnMetadata:!0});return i.queryAttachments(r).then(t=>t[a][0])}_getObjectId(t=this.graphic){return t?.getObjectId()??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>this.attachmentInfos.destroyAll()))}_setAttachmentLayer(){const{graphic:t}=this,e=m(t);this._attachmentLayer=e?"scene"===e.type&&null!=e.associatedLayer?e.associatedLayer:e:null}};t([o({type:[String]})],y.prototype,"attachmentKeywords",void 0),t([o({type:[["application","audio","image","model","text","video"]]})],y.prototype,"attachmentTypes",void 0),t([o()],y.prototype,"capabilities",void 0),t([c("capabilities")],y.prototype,"castCapabilities",null),t([o()],y.prototype,"activeAttachmentInfo",void 0),t([o()],y.prototype,"activeFileInfo",void 0),t([o({readOnly:!0,type:f})],y.prototype,"attachmentInfos",void 0),t([o()],y.prototype,"fileInfos",void 0),t([o({type:e})],y.prototype,"graphic",void 0),t([o()],y.prototype,"mode",void 0),t([o({type:[d]})],y.prototype,"orderByFields",void 0),t([o({readOnly:!0})],y.prototype,"state",null),t([o()],y.prototype,"filesEnabled",void 0),t([o({readOnly:!0})],y.prototype,"supportsResizeAttachments",null),t([o({readOnly:!0})],y.prototype,"supportsTypeWildcard",null),y=t([h("esri.widgets.Attachments.AttachmentsViewModel")],y);export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import s from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import r from"../../core/Logger.js";import{isAbortError as l}from"../../core/promiseUtils.js";import{watch as o,whenOnce as a}from"../../core/reactiveUtils.js";import{property as n,subclass as p}from"../../core/accessorSupport/decorators.js";import d from"../../layers/BuildingSceneLayer.js";import y from"../../layers/support/BuildingFilter.js";import h from"./BuildingDisciplinesViewModel.js";import c from"./BuildingLevel.js";import u from"./BuildingPhase.js";import{showFullModel as m}from"./support/buildingLayerUtils.js";import{setFilterOnLayers as g,getFilterBlockSolid as f,getFilterBlockXRay as v,generateFilterId as j}from"./support/filterUtils.js";import{createLoadLayersFunction as _}from"./support/layerUtils.js";let w=class extends t{constructor(e){super(e),this.view=null,this.state="disabled",this.level=new c,this.phase=new u,this.disciplines=new h,this._loadLayers=_(),this.layers=new s}initialize(){this.addHandles([this.layers.on("change",()=>this._onLayersChange()),o(()=>({state:this.state,layers:this.layers,filter:this._filter}),({state:e,layers:t,filter:s})=>{"ready"===e&&g(t,s)},{initial:!0})]),this._onLayersChange()}destroy(){this.level.destroyed||this.level.destroy(),this.phase.destroyed||this.phase.destroy(),this.disciplines.destroyed||this.disciplines.destroy()}get isSupported(){return"3d"===this.view?.type}get layers(){return this._get("layers")}set layers(e){const t=e.filter(e=>e instanceof d);t.length!==e.length&&r.getLogger(this).error("Some layers are not BuildingSceneLayers but only BuildingSceneLayers can be passed to the widget."),this._set("layers",i(t,this._get("layers")))}get _filter(){const e=this.level.filterExpressions,t=this.phase.filterExpressions,s=[],i=f([e.solid,t.solid]);null!=i&&s.push(i);const r=v([e.xRay,t.xRay]);return null!=r&&s.push(r),0===s.length?null:new y({id:j(),name:"Building Explorer Filter",filterBlocks:s})}async _onLayersChange(){const e=this.layers;if(this.level.layers=e,this.phase.layers=e,this.disciplines.layers=e,0!==e.length){this._set("state","loading");try{await this._loadLayers(e),await Promise.all([a(()=>"ready"===this.level.state),a(()=>"ready"===this.phase.state),a(()=>"ready"===this.disciplines.state)]),e.forEach(m),this._set("state","ready")}catch(t){l(t)||this._set("state","failed")}}else this._set("state","disabled")}};e([n({value:null})],w.prototype,"view",void 0),e([n()],w.prototype,"isSupported",null),e([n({type:s,nonNullable:!0})],w.prototype,"layers",null),e([n({readOnly:!0})],w.prototype,"state",void 0),e([n({readOnly:!0,type:c})],w.prototype,"level",void 0),e([n({readOnly:!0,type:u})],w.prototype,"phase",void 0),e([n({readOnly:!0,type:h})],w.prototype,"disciplines",void 0),e([n()],w.prototype,"_filter",null),w=e([p("esri.widgets.BuildingExplorer.BuildingExplorerViewModel")],w);const L=w;export{L as default};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import s from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import{deprecateUnnecessaryViewModel as r}from"../../core/deprecate.js";import l from"../../core/Logger.js";import{isAbortError as o}from"../../core/promiseUtils.js";import{watch as a,whenOnce as n}from"../../core/reactiveUtils.js";import{property as p,subclass as d}from"../../core/accessorSupport/decorators.js";import y from"../../layers/BuildingSceneLayer.js";import h from"../../layers/support/BuildingFilter.js";import c from"./BuildingDisciplinesViewModel.js";import u from"./BuildingLevel.js";import g from"./BuildingPhase.js";import{showFullModel as m}from"./support/buildingLayerUtils.js";import{setFilterOnLayers as f,getFilterBlockSolid as v,getFilterBlockXRay as w,generateFilterId as j}from"./support/filterUtils.js";import{createLoadLayersFunction as _}from"./support/layerUtils.js";let L=class extends t{constructor(e){super(e),this.view=null,this.state="disabled",this.level=new u({isDefaultViewModel:!0}),this.phase=new g({isDefaultViewModel:!0}),this.disciplines=new c,this._loadLayers=_(),e?.isDefaultViewModel||r(l.getLogger(this),"Building Explorer","arcgis-building-explorer",{version:"5.0"}),this.layers=new s}normalizeCtorArgs(e){const{isDefaultViewModel:t,...s}=e??{};return s}initialize(){this.addHandles([this.layers.on("change",()=>this._onLayersChange()),a(()=>({state:this.state,layers:this.layers,filter:this._filter}),({state:e,layers:t,filter:s})=>{"ready"===e&&f(t,s)},{initial:!0})]),this._onLayersChange()}destroy(){this.level.destroyed||this.level.destroy(),this.phase.destroyed||this.phase.destroy(),this.disciplines.destroyed||this.disciplines.destroy()}get isSupported(){return"3d"===this.view?.type}get layers(){return this._get("layers")}set layers(e){const t=e.filter(e=>e instanceof y);t.length!==e.length&&l.getLogger(this).error("Some layers are not BuildingSceneLayers but only BuildingSceneLayers can be passed to the widget."),this._set("layers",i(t,this._get("layers")))}get _filter(){const e=this.level.filterExpressions,t=this.phase.filterExpressions,s=[],i=v([e.solid,t.solid]);null!=i&&s.push(i);const r=w([e.xRay,t.xRay]);return null!=r&&s.push(r),0===s.length?null:new h({id:j(),name:"Building Explorer Filter",filterBlocks:s})}async _onLayersChange(){const e=this.layers;if(this.level.layers=e,this.phase.layers=e,this.disciplines.layers=e,0!==e.length){this._set("state","loading");try{await this._loadLayers(e),await Promise.all([n(()=>"ready"===this.level.state),n(()=>"ready"===this.phase.state),n(()=>"ready"===this.disciplines.state)]),e.forEach(m),this._set("state","ready")}catch(t){o(t)||this._set("state","failed")}}else this._set("state","disabled")}};e([p({value:null})],L.prototype,"view",void 0),e([p()],L.prototype,"isSupported",null),e([p({type:s,nonNullable:!0})],L.prototype,"layers",null),e([p({readOnly:!0})],L.prototype,"state",void 0),e([p({readOnly:!0,type:u})],L.prototype,"level",void 0),e([p({readOnly:!0,type:g})],L.prototype,"phase",void 0),e([p({readOnly:!0,type:c})],L.prototype,"disciplines",void 0),e([p()],L.prototype,"_filter",null),L=e([d("esri.widgets.BuildingExplorer.BuildingExplorerViewModel")],L);const B=L;export{B as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{binaryIndexOf as l}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import{referenceSetter as a}from"../../core/collectionUtils.js";import{isAbortError as i}from"../../core/promiseUtils.js";import{property as r,subclass as o}from"../../core/accessorSupport/decorators.js";import{createLoadLayersFunction as n}from"./support/layerUtils.js";import{getDomainInfo as u,getValidNumber as d,getMin as h,getMax as y}from"./support/validation.js";let p=class extends t{constructor(e){super(e),this.state="disabled",this._valueBeforeReady=null,this._domainInfo=u([]),this._loadLayers=n(),this.layers=new s}initialize(){this.addHandles(this.layers.on("change",()=>this._onLayersChange())),this._onLayersChange()}destroy(){this._set("state","disabled")}get enabled(){return this.allowedValues.length>0&&this._get("enabled")}set enabled(e){e!==this.enabled&&this.allowedValues.length>0&&this._set("enabled",e)}get value(){return("ready"===this.state?this._get("value"):this._valueBeforeReady)??0}set value(e){if("ready"!==this.state)return void(this._valueBeforeReady=e);if(e===this.value)return;const t=d(e,this);null!=t&&this._set("value",t)}get min(){return h(this.allowedValues)}get max(){return y(this.allowedValues)}get allowedValues(){return this._domainInfo.allowedValues}set allowedValues(e){null==e?this._clearOverride("allowedValues"):this._override("allowedValues",e);const t=d(this.value,this);null!=t&&(this.value=t)}get hasNext(){if(!this.enabled)return!0;const e=this._valueIndex;return e>=0&&e<this.allowedValues.length-1}get hasPrevious(){return!this.enabled||this._valueIndex>0}set layers(e){const t=this._get("layers");this._set("layers",a(e,t))}get filterExpressions(){return{solid:null,xRay:null}}get _valueIndex(){return l(this.allowedValues,this.value)}select(e){if("ready"!==this.state)return void(this._valueBeforeReady=e);null!=d(e,this)&&(this.enabled=!0,this.value=e)}clear(){"ready"===this.state?this.enabled=!1:this._valueBeforeReady=null}next(){const{state:e,allowedValues:t,enabled:l,hasNext:s,_valueIndex:a}=this;if("ready"===e||null==this._valueBeforeReady){if(0!==t.length)return l?void(s&&(this.value=t[a+1])):(this.enabled=!0,void(this.value=t[0]))}else this._valueBeforeReady++}previous(){const{state:e,allowedValues:t,enabled:l,hasPrevious:s,_valueIndex:a}=this;if("ready"===e||null==this._valueBeforeReady){if(0!==t.length)return l?void(s&&(this.value=t[a-1])):(this.enabled=!0,void(this.value=t[t.length-1]))}else this._valueBeforeReady++}getValueLabel(e){return 0===this.layers.length?null:this._domainInfo.fieldValueMap.get(e)??null}async _onLayersChange(){if(this._set("state","loading"),this._domainInfo=u([]),0!==this.layers.length)try{await this._loadLayers(this.layers),this._setup()}catch(e){i(e)||this._set("state","failed")}}};e([r({value:!1,nonNullable:!0})],p.prototype,"enabled",null),e([r({nonNullable:!0})],p.prototype,"value",null),e([r({readOnly:!0})],p.prototype,"min",null),e([r({readOnly:!0})],p.prototype,"max",null),e([r()],p.prototype,"allowedValues",null),e([r({readOnly:!0})],p.prototype,"hasNext",null),e([r({readOnly:!0})],p.prototype,"hasPrevious",null),e([r({type:s,nonNullable:!0})],p.prototype,"layers",null),e([r({nonNullable:!0})],p.prototype,"state",void 0),e([r()],p.prototype,"_valueBeforeReady",void 0),e([r({readOnly:!0})],p.prototype,"_valueIndex",null),e([r()],p.prototype,"_domainInfo",void 0),p=e([o("esri.widgets.BuildingExplorer.BuildingNumericFilterViewModel")],p);const v=p;export{v as default};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{binaryIndexOf as l}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import{referenceSetter as a}from"../../core/collectionUtils.js";import{deprecateUnnecessaryViewModel as r}from"../../core/deprecate.js";import i from"../../core/Logger.js";import{isAbortError as o}from"../../core/promiseUtils.js";import{property as n,subclass as u}from"../../core/accessorSupport/decorators.js";import{createLoadLayersFunction as d}from"./support/layerUtils.js";import{getDomainInfo as h,getValidNumber as y,getMin as p,getMax as v}from"./support/validation.js";let f=class extends t{constructor(e){super(e),this.state="disabled",this._valueBeforeReady=null,this._domainInfo=h([]),this._loadLayers=d(),e?.isDefaultViewModel||r(i.getLogger(this),"Building Explorer","arcgis-building-explorer",{version:"5.0"}),this.layers=new s}normalizeCtorArgs(e){const{isDefaultViewModel:t,...l}=e??{};return l}initialize(){this.addHandles(this.layers.on("change",()=>this._onLayersChange())),this._onLayersChange()}destroy(){this._set("state","disabled")}get enabled(){return this.allowedValues.length>0&&this._get("enabled")}set enabled(e){e!==this.enabled&&this.allowedValues.length>0&&this._set("enabled",e)}get value(){return("ready"===this.state?this._get("value"):this._valueBeforeReady)??0}set value(e){if("ready"!==this.state)return void(this._valueBeforeReady=e);if(e===this.value)return;const t=y(e,this);null!=t&&this._set("value",t)}get min(){return p(this.allowedValues)}get max(){return v(this.allowedValues)}get allowedValues(){return this._domainInfo.allowedValues}set allowedValues(e){null==e?this._clearOverride("allowedValues"):this._override("allowedValues",e);const t=y(this.value,this);null!=t&&(this.value=t)}get hasNext(){if(!this.enabled)return!0;const e=this._valueIndex;return e>=0&&e<this.allowedValues.length-1}get hasPrevious(){return!this.enabled||this._valueIndex>0}set layers(e){const t=this._get("layers");this._set("layers",a(e,t))}get filterExpressions(){return{solid:null,xRay:null}}get _valueIndex(){return l(this.allowedValues,this.value)}select(e){if("ready"!==this.state)return void(this._valueBeforeReady=e);null!=y(e,this)&&(this.enabled=!0,this.value=e)}clear(){"ready"===this.state?this.enabled=!1:this._valueBeforeReady=null}next(){const{state:e,allowedValues:t,enabled:l,hasNext:s,_valueIndex:a}=this;if("ready"===e||null==this._valueBeforeReady){if(0!==t.length)return l?void(s&&(this.value=t[a+1])):(this.enabled=!0,void(this.value=t[0]))}else this._valueBeforeReady++}previous(){const{state:e,allowedValues:t,enabled:l,hasPrevious:s,_valueIndex:a}=this;if("ready"===e||null==this._valueBeforeReady){if(0!==t.length)return l?void(s&&(this.value=t[a-1])):(this.enabled=!0,void(this.value=t[t.length-1]))}else this._valueBeforeReady++}getValueLabel(e){return 0===this.layers.length?null:this._domainInfo.fieldValueMap.get(e)??null}async _onLayersChange(){if(this._set("state","loading"),this._domainInfo=h([]),0!==this.layers.length)try{await this._loadLayers(this.layers),this._setup()}catch(e){o(e)||this._set("state","failed")}}};e([n({value:!1,nonNullable:!0})],f.prototype,"enabled",null),e([n({nonNullable:!0})],f.prototype,"value",null),e([n({readOnly:!0})],f.prototype,"min",null),e([n({readOnly:!0})],f.prototype,"max",null),e([n()],f.prototype,"allowedValues",null),e([n({readOnly:!0})],f.prototype,"hasNext",null),e([n({readOnly:!0})],f.prototype,"hasPrevious",null),e([n({type:s,nonNullable:!0})],f.prototype,"layers",null),e([n({nonNullable:!0})],f.prototype,"state",void 0),e([n()],f.prototype,"_valueBeforeReady",void 0),e([n({readOnly:!0})],f.prototype,"_valueIndex",null),e([n()],f.prototype,"_domainInfo",void 0),f=e([u("esri.widgets.BuildingExplorer.BuildingNumericFilterViewModel")],f);const g=f;export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{property as i,cast as s,subclass as t}from"../core/accessorSupport/decorators.js";import l from"./Widget.js";import r from"./BuildingExplorer/BuildingExplorerViewModel.js";import{css as o}from"./BuildingExplorer/css.js";import n from"./BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js";import a from"./BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js";import d from"./BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import{Heading as g}from"./support/Heading.js";import{messageBundle as u,tsx as m,classes as h}from"./support/widget.js";const v={levels:!0,phases:!0,disciplines:!0};let y=class extends l{constructor(e,i){super(e,i),this._defaultViewModel=new r,this.viewModel=this._defaultViewModel,this.visibleElements={...v},this.headingLevel=3,this.messages=null,this.messagesCommon=null,this.toggleSiblingsVisibility=!1}loadDependencies(){return p({loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}_castVisibleElements(e){return{...v,...e}}get icon(){return"organization"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}render(){const e=this.viewModel,i="disabled"===e.state||!e.isSupported;return m("div",{"aria-label":this.messages.widgetLabel,class:h(c.widget,o.base,c.panel,{[c.widgetDisabled]:i}),key:this},this._renderContent())}_renderContent(){const e=this.viewModel,i=this.messages;if(!e.isSupported)return m("p",{class:o.panelError},i.unsupported);if(!e.layers.length)return m("p",{class:o.panelError},i.noData);switch(e.state){case"loading":return this._renderLoadingIndicator();case"ready":return m("div",{class:o.content,key:"content"},this._renderLevelPickerSection(),this._renderPhasePickerSection(),this._renderDisciplinesSection());case"failed":return m("p",{class:o.panelError},i.failed);default:return null}}_renderLoadingIndicator(){const e=this.messagesCommon.loading;return m("div",{"aria-label":e,class:o.loadingContainer,key:"loading-container",role:"presentation",title:e},m("calcite-loader",{label:e,type:"indeterminate"}))}_renderLevelPickerSection(){const e=this.viewModel.level,i="ready"===e.state,s=e.allowedValues.length>1;if(!this.visibleElements.levels||!i||!s)return null;const t=this.messages?.level;return m("div",{class:h(o.section,o.levels),key:"levels"},m(g,{level:this.headingLevel},t?.title),m(a,{messages:t,vm:e}))}_renderPhasePickerSection(){const e=this.viewModel.phase,i="ready"===e.state,s=e.allowedValues.length>1;if(!this.visibleElements.phases||!i||!s)return null;const t=this.messages.phase;return m("div",{class:h(o.section,o.phases),key:"phases"},m(g,{level:this.headingLevel},t.title),m(d,{messages:t,vm:e}))}_renderDisciplinesSection(){const e=this.viewModel.disciplines,i="ready"===e.state,s=e.root.hasChildren;if(!this.visibleElements.disciplines||!i||!s)return null;const t=this.messages?.disciplines;return m("div",{class:h(o.section,o.disciplines),key:"disciplines"},m(g,{level:this.headingLevel},t.title),m(n,{messages:t,toggleSiblingsVisibility:this.toggleSiblingsVisibility,vm:e}))}};e([i({type:r})],y.prototype,"viewModel",void 0),e([i()],y.prototype,"view",null),e([i()],y.prototype,"layers",null),e([i()],y.prototype,"visibleElements",void 0),e([s("visibleElements")],y.prototype,"_castVisibleElements",null),e([i()],y.prototype,"headingLevel",void 0),e([i()],y.prototype,"icon",null),e([i()],y.prototype,"label",null),e([i(),u("esri/widgets/BuildingExplorer/t9n/BuildingExplorer")],y.prototype,"messages",void 0),e([i(),u("esri/t9n/common")],y.prototype,"messagesCommon",void 0),e([i({nonNullable:!0})],y.prototype,"toggleSiblingsVisibility",void 0),e([i()],y.prototype,"uiStrings",void 0),y=e([t("esri.widgets.BuildingExplorer")],y);const w=y;export{w as default};
5
+ import{__decorate as e}from"tslib";import{deprecateWidget as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{property as t,cast as l,subclass as r}from"../core/accessorSupport/decorators.js";import o from"./Widget.js";import n from"./BuildingExplorer/BuildingExplorerViewModel.js";import{css as a}from"./BuildingExplorer/css.js";import d from"./BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js";import p from"./BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js";import c from"./BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{Heading as m}from"./support/Heading.js";import{messageBundle as h,tsx as v,classes as y}from"./support/widget.js";const w={levels:!0,phases:!0,disciplines:!0};let b=class extends o{constructor(e,t){super(e,t),this._defaultViewModel=new n({isDefaultViewModel:!0}),this.viewModel=this._defaultViewModel,this.visibleElements={...w},this.headingLevel=3,this.messages=null,this.messagesCommon=null,this.toggleSiblingsVisibility=!1,i(s.getLogger(this),"Building Explorer","arcgis-building-explorer",{version:"5.0"})}loadDependencies(){return g({loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}_castVisibleElements(e){return{...w,...e}}get icon(){return"organization"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}render(){const e=this.viewModel,i="disabled"===e.state||!e.isSupported;return v("div",{"aria-label":this.messages.widgetLabel,class:y(u.widget,a.base,u.panel,{[u.widgetDisabled]:i}),key:this},this._renderContent())}_renderContent(){const e=this.viewModel,i=this.messages;if(!e.isSupported)return v("p",{class:a.panelError},i.unsupported);if(!e.layers.length)return v("p",{class:a.panelError},i.noData);switch(e.state){case"loading":return this._renderLoadingIndicator();case"ready":return v("div",{class:a.content,key:"content"},this._renderLevelPickerSection(),this._renderPhasePickerSection(),this._renderDisciplinesSection());case"failed":return v("p",{class:a.panelError},i.failed);default:return null}}_renderLoadingIndicator(){const e=this.messagesCommon.loading;return v("div",{"aria-label":e,class:a.loadingContainer,key:"loading-container",role:"presentation",title:e},v("calcite-loader",{label:e,type:"indeterminate"}))}_renderLevelPickerSection(){const e=this.viewModel.level,i="ready"===e.state,s=e.allowedValues.length>1;if(!this.visibleElements.levels||!i||!s)return null;const t=this.messages?.level;return v("div",{class:y(a.section,a.levels),key:"levels"},v(m,{level:this.headingLevel},t?.title),v(p,{messages:t,vm:e}))}_renderPhasePickerSection(){const e=this.viewModel.phase,i="ready"===e.state,s=e.allowedValues.length>1;if(!this.visibleElements.phases||!i||!s)return null;const t=this.messages.phase;return v("div",{class:y(a.section,a.phases),key:"phases"},v(m,{level:this.headingLevel},t.title),v(c,{messages:t,vm:e}))}_renderDisciplinesSection(){const e=this.viewModel.disciplines,i="ready"===e.state,s=e.root.hasChildren;if(!this.visibleElements.disciplines||!i||!s)return null;const t=this.messages?.disciplines;return v("div",{class:y(a.section,a.disciplines),key:"disciplines"},v(m,{level:this.headingLevel},t.title),v(d,{messages:t,toggleSiblingsVisibility:this.toggleSiblingsVisibility,vm:e}))}};e([t({type:n})],b.prototype,"viewModel",void 0),e([t()],b.prototype,"view",null),e([t()],b.prototype,"layers",null),e([t()],b.prototype,"visibleElements",void 0),e([l("visibleElements")],b.prototype,"_castVisibleElements",null),e([t()],b.prototype,"headingLevel",void 0),e([t()],b.prototype,"icon",null),e([t()],b.prototype,"label",null),e([t(),h("esri/widgets/BuildingExplorer/t9n/BuildingExplorer")],b.prototype,"messages",void 0),e([t(),h("esri/t9n/common")],b.prototype,"messagesCommon",void 0),e([t({nonNullable:!0})],b.prototype,"toggleSiblingsVisibility",void 0),e([t()],b.prototype,"uiStrings",void 0),b=e([r("esri.widgets.BuildingExplorer")],b);const f=b;export{f as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import{deprecatedFunction as o}from"../../core/deprecate.js";import a from"../../core/Error.js";import{EventedAccessor as s}from"../../core/Evented.js";import{abortHandle as n,makeHandle as l}from"../../core/handleUtils.js";import"../../core/has.js";import d from"../../core/Logger.js";import{destroyMaybe as c,abortMaybe as p,removeMaybe as h}from"../../core/maybe.js";import{throwIfAborted as u,createResolver as w}from"../../core/promiseUtils.js";import{watch as f,on as m,when as y,syncAndInitial as g,initial as k,sync as v,whenOnce as _}from"../../core/reactiveUtils.js";import{property as W,subclass as M}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as F}from"../../editing/templateUtils.js";import{getGraphicLayer as T}from"../../graphic/graphicOriginUtils.js";import V from"../../layers/GraphicsLayer.js";import{isEditableLayer as I}from"../../layers/support/editableLayers.js";import{isFeatureLayer as E,isSubtypeGroupLayer as S,getOwningPortalUrl as A}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as L}from"../../portal/support/urlUtils.js";import U from"../../views/SelectionManager.js";import C from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as O}from"../../views/interactive/snapping/SnappingManager.js";import j from"../../views/interactive/snapping/SnappingOptions.js";import{isSelectableLayer as R}from"../../views/support/selectionUtils.js";import P from"../Attachments/AttachmentsViewModel.js";import H from"./CreateFeaturesWorkflow.js";import q from"./UpdateWorkflow.js";import{getLayersFromWorkflow as x,isCreateFeaturesWorkflow as G,isUpdateRecordWorkflow as D,isUpdateFeaturesWorkflow as B,isMergeFeaturesWorkflow as N,isSplitFeatureWorkflow as Q,isUpdateWorkflow as z,isFeatureFormViewModel as Z,findEditorItemForLayerOrThrow as $,toFeatureInfos as J,fetchFullFeaturesByObjectId as K,fetchFullFeatures as X,findEditorItemForLayer as Y,whenEditorLayerView as ee}from"./workflowUtils.js";import te from"./support/EditorItem.js";import{assertViewNot3D as ie,MultipleSourceLayersError as re,InsufficientFeatureCountError as oe,MissingOriginLayerError as ae,assertMergeWorkflowCapabilities as se,FetchFullFeatureError as ne,assertSplitWorkflowCapabilities as le}from"./support/errors.js";import{makeTemplateGroupInfoForLayer as de}from"../FeatureTemplates/featureTemplatesUtils.js";import ce from"../FeatureTemplates/FeatureTemplatesViewModel.js";import pe from"../Sketch/SketchViewModel.js";import he from"../Spinner/SpinnerViewModel.js";import{goTo as ue}from"../support/goToUtils.js";import{isFeatureItem as we,isLayerItem as fe}from"../support/SelectionList/selectionListUtils.js";import me from"../support/SelectionList/SelectionListViewModel.js";import ye from"../support/SelectionToolbar/SelectionToolbarViewModel.js";function ge(e,t){return e?.find(e=>e.layer===t)}let ke=class extends s{constructor(e){super(e),this._queuedSelectionTool=null,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new V({listMode:"hide",internal:!0,title:"Editor sketch layer"}),this._snappingManager=null,this._templatesByLayer=new Map,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new b,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new r,this.editorItems=new r,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new P({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new ce({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.layerInfos=null,this.ownSketchViewModel=new pe({layer:this._sketchGraphicsLayer}),this.selectionListViewModel=new me,this.selectionManager=new U,this.selectionToolbarViewModel=new ye({continuousSelectionEnabled:!0,defaultOperationType:"replace",persistSelection:!1,returnGeometry:!1}),this.sketchOptions=new C,this.snappingOptions=new j({attributeRulesEnabled:!0}),this.spinnerViewModel=new he,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.back=async()=>{if("viewing-selection-list"===this.state)return this.selectionListViewModel.filterText=void 0,void this.effectiveSelectionManager.clear();this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>await(this.activeWorkflow?.save()),this.selectFeature=(e,t=!1)=>{const i=this.activeWorkflow;if(this._candidateCommitted||"update"!==i?.type)return;const{rootFeatures:r}=i.data;r.removeAll(),e&&r.add(e),t&&(i.next(),this._candidateCommitted=!0)}}initialize(){this.addHandles([f(()=>{const e=this.view,t=e?.map?.editableLayers.toArray(),i=e?.allLayerViews,r=i?.filter(e=>!!t?.includes(e.layer));return[t,r,this.layerInfos]},()=>this._updateEditorItems(),g),f(()=>this.hideTemplatesForInactiveLayers,()=>this.syncFeatureTemplates()),f(()=>this._selectionSources,()=>this._syncSelectionSources(),k),m(()=>this.activeWorkflow,"cancel",()=>this.emit("workflow-cancel")),m(()=>this.activeWorkflow,"commit",()=>this.emit("workflow-commit")),m(()=>this.activeWorkflow,"complete",()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)}),y(()=>!this.activeWorkflow&&this._queuedSelectionTool,()=>this._queuedSelectionTool&&this.selectionToolbarViewModel.activateTool(this._queuedSelectionTool)),f(()=>this.activeWorkflow,e=>this.selectionManager.showHighlight=!e),y(()=>this.view?.map,e=>e.add(this._sketchGraphicsLayer),k),m(()=>this.editorItems,"change",()=>this._afterEditorItemsChange()),f(()=>[this.canCreate,this.canUpdateVisible],()=>this._afterEditorItemsChange()),f(()=>this.page,(e,t)=>{const i=[...this.pageStack];if(-1===i.indexOf(e))i.push(e);else for(;i.length&&i.at(-1)!==e;)i.pop();this.pageStack=i},g),y(()=>"awaiting-update-feature-candidate"===this.state,()=>this._candidateCommitted=!1),m(()=>this.featureTemplatesViewModel,"select",async({item:e,oldItem:t})=>{const{activeWorkflow:i}=this;if(i){if("update"===i.type&&"awaiting-feature-creation-info"===i.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(t,{emit:!1})}}if(!e)return;const r={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(r);await this.startCreateFeaturesWorkflowAtFeatureCreation(r)}),f(()=>[this.view,this.featureTemplatesViewModel],([e,t])=>{t.view=e},g),m(()=>this.view,"key-down",e=>{"Escape"===e.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(e.stopPropagation(),this.back())}),m(()=>this.sketchViewModel,["create","delete","update"],e=>{const{activeWorkflow:t}=this,i=x(t),r=`sketch-${e.type}`;this.emit(r,{type:r,detail:e,layer:i[0],layers:i})},v),f(()=>this.view,e=>{if(this._snappingManager=c(this._snappingManager),!e)return;const t=this.snappingOptions;this._snappingManager=new O({view:e,options:t}),this.ownSketchViewModel.snappingManager=this._snappingManager},g),f(()=>this.snappingOptions,e=>{this._snappingManager&&(this._snappingManager.options=e)},g),m(()=>this.selectionToolbarViewModel,"complete",e=>this._onSelectionComplete(e)),f(()=>({view:this.view,selectionManager:this.effectiveSelectionManager,selectionListViewModel:this.selectionListViewModel,selectionToolbarViewModel:this.selectionToolbarViewModel}),({view:e,selectionManager:t,selectionListViewModel:i,selectionToolbarViewModel:r})=>{t.view=e,i.view=e,r.view=e},g),f(()=>this.effectiveSelectionManager,e=>{this.selectionListViewModel.selectionManager=e,this.selectionToolbarViewModel.selectionManager=e},g)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then(()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null}),this._updateItemsTask=p(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=h(this._sketchEventListenerHandle),this.selectionListViewModel?.destroy(),this.selectionToolbarViewModel?.destroy(),this.selectionManager.destroy()}get _featureTemplatesLayersAndTables(){const e=new r;for(const t of this.editorItems){const i=this.hideTemplatesForInactiveLayers&&!t.visible;t.supportsCreateFeaturesWorkflow&&!i&&e.push(t.layer)}return e}get _selectionSources(){const e=new r;for(const t of this.editorItems)R(t.layer)&&t.supportsUpdateWorkflow&&t.visible&&e.push(t.layer);return e}get activeFeatureCount(){const e=this.activeLeafWorkflow;return G(e)?e.pendingFeatures.length:D(e)&&e.data.edits.feature?1:B(e)?e.data.fullFeatures.length:N(e)?e.data.features.length:Q(e)?2:0}get activeLeafWorkflow(){const e=this.activeWorkflow;return e&&z(e)?e.activeWorkflow??e:e}get canCreate(){return this.editorItems.some(e=>e.supportsCreateFeaturesWorkflow)}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some(e=>e.supportsUpdateWorkflow)}get canUpdateVisible(){return this.editorItems.some(e=>e.supportsUpdateWorkflow&&e.visible)}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter(e=>"scene"===e.type||!e.isTable)}get effectiveSelectionManager(){return this.selectionManager}get featureFormViewModel(){const e=this.activeWorkflow?.formViewModel;return Z(e)?e:null}get formViewModel(){return this.activeWorkflow?.formViewModel}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get sketchViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeSketchViewModel:"create-features"===e?.type?e.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const e=this.attachmentsViewModel.mode;if("add"===e)return"adding-attachment";if("edit"===e)return"editing-attachment";const{activeWorkflow:t}=this,i=!t?.stepId;return this.effectiveSelectionManager.count&&i?"viewing-selection-list":i?"ready":"update"===t.type&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}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}set view(e){this.ownSketchViewModel.view=e,this.spinnerViewModel.view=e,this._set("view",e)}get canZoomTo(){const e=this.sketchViewModel,t=e?.createGraphic?.geometry?.type;return!(!e?.updateGraphics?.length&&"multipoint"!==t)}get page(){const{activeWorkflow:e,state:t}=this;if("update"===e?.type&&Z(e.formViewModel)){const{associatedLayer:t,associationId:i}=e.formViewModel;if(t||null!=i)return"viewing-associated-features"}if("update"===e?.type&&"awaiting-feature-to-update"===e.stepId)return"ready";if("create-features"===e?.type&&0===e.numPendingFeatures){const t=e.data.upload;if(t)return"default"===t.state?"ready":"creating-features-upload-details"}return t??"disabled"}get featureFormDisabled(){const{activeLeafWorkflow:e}=this;if(D(e))return!1===e.data.editorItem?.capabilities.update.attributes||!0===e.formViewModel.disabled;if(B(e)){const{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeLeafWorkflow:e}=this;if(D(e)){const{data:t}=e;return t.editorItem?.capabilities.delete.enabled&&!t.readOnly}return!!B(e)&&e.data.editorItems.every(e=>e.capabilities.delete.enabled)}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}getTemplatesForLayer(e){return this._templatesByLayer.get(e)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,"creating-features")}async startCreateFeaturesWorkflow(e,t="awaiting-feature-creation-info"){if(await _(()=>!this.updating),!this.canCreate)throw new a("editing:unsupported-workflow","Creating features is unsupported or disabled.");const i=this._createUpdatingResolver();try{await this._cancelWorkflow();const i=this._createCreateFeaturesWorkflow(e,t);this._set("activeWorkflow",i),await i.start()}catch(r){this._logErrorAndCancelWorkflow(r)}finally{i.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(e){await _(()=>!this.updating);const t=this._createUpdatingResolver();try{const{initialFeature:t}=e,i=t.sourceLayer=t.layer,r=i?$(this.editorItems,i):void 0;if(!r?.supportsCreateFeaturesWorkflow)throw new a("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const o=this._createCreateFeaturesWorkflow({initialFeature:t,layer:r.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",o),await o.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startMergeFeaturesWorkflow(e,t={}){await _(()=>!this.updating),ie(this,"merge-features");const i=Array.isArray(e)?J(e):[e];if(i.length>1)throw new re;if(0===i.length||i[0].objectIds.length<2)throw new oe(2);const o=i[0],a=o.layer;if(!a)throw new ae;const s=$(this.editorItems,a);se(s);const l=this._createUpdatingResolver(),d=new AbortController;this.addHandles(n(d));try{await this._cancelWorkflow(),this.selectionToolbarViewModel.cancel();const e=await K(o.objectIds,a,this.view?.spatialReference,d.signal);if(e.length!==o.objectIds.length)throw new ne;let i;if(t.keyFeature){const r=t.keyFeature.getObjectId();i=e.find(e=>e.getObjectId()===r)??t.keyFeature}const s=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new r(e),rootWorkflowOptions:{type:"merge",props:{...t,keyFeature:i}}});this._set("activeWorkflow",s),this.addHandles(this._destroyWorkflowOnCommit(s)),await s.start()}catch(c){this._logErrorAndCancelWorkflow(c)}finally{l.resolve()}}async startSplitFeatureWorkflow(e,t={}){await _(()=>!this.updating),ie(this,"split-feature");const i=T(e);if(!i)throw new ae;const o=$(this.editorItems,i);le(o);const a=this._createUpdatingResolver(),s=new AbortController;this.addHandles(n(s));try{await this._cancelWorkflow();const o=await X([e],i,this.view?.spatialReference,s.signal);if(1!==o.length)throw new ne;const a=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new r(o),rootWorkflowOptions:{type:"split",props:t}});this._set("activeWorkflow",a),this.addHandles(this._destroyWorkflowOnCommit(a)),await a.start()}catch(l){this._logErrorAndCancelWorkflow(l)}finally{a.resolve()}}async startUpdateFeaturesWorkflow(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update features workflow is unsupported or disabled.");const t=Array.isArray(e)?J(e):[e];if(t.length>1)throw new re;const i=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature",{rootFeatureInfos:t,rootWorkflowOptions:{type:"update-multiple"}});e.addHandles(this._destroyWorkflowOnCommit(e)),this._set("activeWorkflow",e),await e.start()}catch(r){this._logErrorAndCancelWorkflow(r)}finally{i.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow();this._set("activeWorkflow",e),await e.start()}catch(t){this._logErrorAndCancelWorkflow(t)}finally{e.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow("awaiting-update-feature-candidate");t.data.candidates=e,this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureEdit(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.selectionToolbarViewModel.cancel();const t=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new r([e])});t.addHandles(this._destroyWorkflowOnCommit(t)),this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowWithActiveSelection(){const{selectionListViewModel:e}=this;if(!e.visibleFeatureCount||!e.visibleLayerCount)throw new a("editing:missing-selection","Unable to determine visible selection.");if(e.visibleLayerCount>1)throw new a("editing:features-different-layers","Cannot start workflow with features from different layers.");const t=e.layerItems.find(e=>e.visible);t&&await this._startUpdateWorkflowWithLayerItem(t,"update")}async deleteFeatureFromWorkflow(){o(d.getLogger(this),"EditorViewModel.deleteFeatureFromWorkflow is deprecated. Use EditorViewModel.deleteFeatures instead.",{version:"4.33",replacement:"EditorViewModel.deleteFeatures",warnOnce:!0}),await this.deleteFeatures()}async deleteFeatures(){const e=this.activeWorkflow;if(z(e))return e.deleteActiveFeatures();this._logError("editing:unsupported-workflow","Deleting features requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:e}=this;e&&"update"===e.type?await e.deleteActiveAssociation():this._logError("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}itemHasInvalidFormTemplate(e){return null!=e&&!0===Y(this.editorItems,e.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(e){const{view:i,sketchViewModel:r}=this;if(!i)return;const o=void 0,a=e??r?.createGraphic;if(a)"mesh"===a.geometry?.type?ue(i,a.geometry,o):ue(i,a,o);else{const e=r?.updateGraphics?.toArray();"3d"===i.type&&e?.some(e=>"mesh"===e.geometry?.type)?ue(i,e.map(e=>e.geometry).filter(t),o):e&&ue(i,e,o)}}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}async onSelectionListItemSelect(e){we(e)&&await this.startUpdateWorkflowAtFeatureEdit(e.graphic)}async onSelectionListMenuItemSelect(e,t){we(e)?await this.startUpdateWorkflowAtFeatureEdit(e.graphic):fe(e)&&await this._startUpdateWorkflowWithLayerItem(e,t)}restrictFeatureTemplatesViewModelToLayer(e){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([e]),l(()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)})}async _getEditorItemCandidates(e){const{view:t}=this;if(!t?.map)return[];const{map:i}=t,r=i.editableLayers.toArray(),o=i.allTables.toArray().filter(e=>E(e)||S(e));return await Promise.allSettled([...r.flatMap(e=>this._getLayerLoadPromise(e)),...o.flatMap(e=>this._getLayerLoadPromise(e))]),u(e),[...r.reverse(),...o.reverse()].filter(e=>I(e)&&("mesh"!==e.geometryType||"3d"===t.type)).flatMap(e=>"subtype-group"===e.type?e.sublayers.toArray():e)}_getLayerLoadPromise(e){return S(e)?e.loadAll():e.load()}_drainEditorItems(){this.editorItems.drain(e=>e.destroy())}_updateEditorItems(){p(this._updateItemsTask);const{view:e}=this,t=i(async t=>{if(!e?.map||!e?.allLayerViews)return;const i=await this._getEditorItemCandidates(t);if(!i.length)return void this._drainEditorItems();const r=[],o=[],a=[],{layerInfos:s}=this;for(const l of i){const t=ge(s,l),i=await ee(e,l).catch(()=>null);(t?r:i?o:a).push(new te({layer:l,layerInfo:t,layerView:i}))}s?.length&&r.sort((e,t)=>s.findIndex(({layer:t})=>t===e.layer)-s.findIndex(({layer:e})=>e===t.layer));const n=[...r,...o,...a];t.aborted||(this._drainEditorItems(),this.editorItems.addMany(n))});this._updatingHandles.addPromise(t.promise),this._updateItemsTask=t}_updateTemplates(){p(this._updateTemplatesTask);const e=i(async e=>{const t=this._templatesByLayer,i=this._featureTemplatesLayersAndTables.filter(e=>!t.has(e));if(i.length>0){const r=await F({layers:i.toArray(),view:this.view,signal:e,queryOptions:{returnVisibleTemplatesOnly:!0}});for(const{layer:e,templates:i}of r)t.set(e,i)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)});this._updatingHandles.addPromise(e.promise),this._updateTemplatesTask=e}_setFeatureTemplatesViewModelLayers(e){const t=this._templatesByLayer,i=[];for(const r of e){const e=t.get(r);e&&e.length>0&&i.push(de(r,e))}this.featureTemplatesViewModel.templateInfos=i}_afterEditorItemsChange(){const{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),!e)return;const{stepId:t}=e;"create-features"!==e.type?"update"===e.type&&("awaiting-feature-to-update"===t&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===t&&!e.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==t||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(e){const t=this.activeWorkflow;if(!t)return void(e?.warnIfNoWorkflow&&this._logError("editing:no-active-workflow","There is no active workflow to cancel."));if(!e||!1!==e.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await t.cancel(e)}finally{t.destroy()}}else try{await t.cancel(e),this._set("activeWorkflow",null),t.destroy()}catch(i){}}_createCreateFeaturesWorkflow(e,t){return H.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createUpdateWorkflow(e,t){const i=q.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)});return i}_addAttachments(e,t){const i=t.map(t=>this._addAttachment(e,t.feature,t.attachment))??[];return Promise.all(i)}async _addAttachment(e,t,i){let r=null;if(!("addAttachment"in e)||null==e.capabilities?.attachment)throw new a("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation(async()=>(r=await(e.addAttachment?.(t,i).catch(e=>{throw e?.error||e}))??null,r)),r}async _applyEdits(e,t,i){let r=null;const o=e.url?await A(e.url):null,a={returnServiceEditsOption:(!o||!L(o))&&!/\/hosted\//i.test(e.url)?"original-and-current-features":void 0,...i};return await this._queueOperation(async()=>{const{view:i}=this;if(!i)return null;const o=await ee(i,e).catch(()=>null);return r=await e.applyEdits(t,a),o&&await _(()=>!o.updating),r}),r}async _applyEditsFeatureService(e,t,i){let r=null;return await this._queueOperation(async()=>r=await e.applyEdits(t,i)),r}_destroyWorkflowOnCommit(e){return m(()=>e,"commit",()=>{e.destroy(),this.activeWorkflow===e&&this._set("activeWorkflow",null)})}_queueOperation(e){this._activityQueue.push(e);const t=(e,t)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)};return e().then(e=>(Array.isArray(e)?e.forEach(e=>this._handleEditsResultError(e)):this._handleEditsResultError(e),e)).catch(i=>{this._logError("editing:operation-error","An error occurred.",{error:i});const r={error:i,retry:()=>(t(r,this.failures),this._queueOperation(e)),cancel:()=>{t(r,this.failures)}};this._set("failures",[...this.failures,r])}).then(()=>{t(e,this._activityQueue)})}_handleEditsResultError(e){if(null!=e&&"error"in e&&null!=e.error)throw e.error;if(null!=e&&"addFeatureResults"in e){const{addFeatureResults:t,deleteFeatureResults:i,updateFeatureResults:r}=e,o=t.find(e=>!!e.error)||r.find(e=>!!e.error)||i.find(e=>!!e.error);if(o)throw o.error}}_createUpdatingResolver(){const e=w();return this._updatingHandles.addPromise(e.promise),e}_logErrorAndCancelWorkflow(e){const{name:t,message:i,details:r}=e;this._logError(t??"editing:workflow-start-failed",i??void 0,r??e),this._cancelWorkflow({force:!0})}_itemIsSuspended(e){const t=$(this.editorItems,e);return null!=t&&(!t.visible||t.disabled)}_logError(e,t,i){d.getLogger(this).error(new a(e,t,i))}_syncSelectionSources(){this.selectionManager.sources.items=this._selectionSources.toArray()}async _onSelectionComplete(e){if(e.aborted)return;const{operationType:t,selection:i}=e,{effectiveSelectionManager:r}=this,o="ready"===this.state,a=1===i.length;if(this._queuedSelectionTool=void 0,o&&a&&"replace"===t)return this._queuedSelectionTool=e.toolName,this.startUpdateWorkflowAtFeatureEdit(i[0]);switch(t){case"remove":r.updateSelection({current:[],added:[],removed:i});break;case"replace":r.clear(),r.updateSelection({current:i,added:[],removed:[]});break;case"add":r.updateSelection({current:i,added:[],removed:[]})}}async _startUpdateWorkflowWithLayerItem(e,t){if(!e.objectIds?.length)return;const i=e.featureItems.filter(e=>e.visible).map(e=>e.graphic),r=this.selectionListViewModel.filterText;if(1===i.length)return await this.startUpdateWorkflowAtFeatureEdit(i[0]);let o;if(null!=r&&""!==r){const e=J(i);if(e.length>1)throw new re;if(o=e[0],!o)throw new oe("merge"===t?2:1)}else o={layer:e.layer,objectIds:e.objectIds};"update"===t?await this.startUpdateFeaturesWorkflow(o):"merge"===t&&await this.startMergeFeaturesWorkflow(o)}};e([W()],ke.prototype,"_featureTemplatesLayersAndTables",null),e([W()],ke.prototype,"_queuedSelectionTool",void 0),e([W()],ke.prototype,"_snappingManager",void 0),e([W()],ke.prototype,"_selectionSources",null),e([W()],ke.prototype,"activeFeatureCount",null),e([W({readOnly:!0})],ke.prototype,"activeWorkflow",void 0),e([W()],ke.prototype,"activeLeafWorkflow",null),e([W({readOnly:!0})],ke.prototype,"_activityQueue",void 0),e([W({readOnly:!0})],ke.prototype,"canCreate",null),e([W()],ke.prototype,"canCreateVisible",null),e([W({readOnly:!0})],ke.prototype,"canUpdate",null),e([W()],ke.prototype,"canUpdateVisible",null),e([W()],ke.prototype,"featureTemplatesLayers",null),e([W()],ke.prototype,"editorItems",void 0),e([W()],ke.prototype,"effectiveSelectionManager",null),e([W({readOnly:!0})],ke.prototype,"failures",void 0),e([W()],ke.prototype,"hideTemplatesForInactiveLayers",void 0),e([W({type:P})],ke.prototype,"attachmentsViewModel",void 0),e([W()],ke.prototype,"featureFormViewModel",null),e([W()],ke.prototype,"formViewModel",null),e([W()],ke.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),e([W({type:ce})],ke.prototype,"featureTemplatesViewModel",void 0),e([W()],ke.prototype,"labelOptions",null),e([W()],ke.prototype,"layerInfos",void 0),e([W()],ke.prototype,"ownSketchViewModel",void 0),e([W()],ke.prototype,"selectionListViewModel",void 0),e([W()],ke.prototype,"selectionManager",void 0),e([W()],ke.prototype,"selectionToolbarViewModel",void 0),e([W()],ke.prototype,"sketchOptions",void 0),e([W()],ke.prototype,"sketchViewModel",null),e([W({type:j,nonNullable:!0})],ke.prototype,"snappingOptions",void 0),e([W()],ke.prototype,"spinnerViewModel",void 0),e([W()],ke.prototype,"state",null),e([W({readOnly:!0})],ke.prototype,"syncing",null),e([W()],ke.prototype,"updating",null),e([W()],ke.prototype,"tooltipOptions",null),e([W()],ke.prototype,"valueOptions",null),e([W()],ke.prototype,"view",null),e([W()],ke.prototype,"canZoomTo",null),e([W()],ke.prototype,"pageStack",void 0),e([W()],ke.prototype,"showDiscardEditsPrompt",void 0),e([W()],ke.prototype,"_candidateCommitted",void 0),e([W()],ke.prototype,"page",null),e([W()],ke.prototype,"featureFormDisabled",null),e([W()],ke.prototype,"featureFormHasAssociation",null),e([W()],ke.prototype,"canGoBack",null),e([W()],ke.prototype,"shouldShowDeleteButton",null),e([W()],ke.prototype,"hasPendingEdits",null),e([W()],ke.prototype,"snappingManager",null),ke=e([M("esri.widgets.Editor.EditorViewModel")],ke);const ve=ke;export{ve as default};
5
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import{deprecatedFunction as o}from"../../core/deprecate.js";import a from"../../core/Error.js";import{EventedAccessor as s}from"../../core/Evented.js";import{abortHandle as n,makeHandle as l}from"../../core/handleUtils.js";import"../../core/has.js";import d from"../../core/Logger.js";import{destroyMaybe as c,abortMaybe as p,removeMaybe as h}from"../../core/maybe.js";import{throwIfAborted as u,createResolver as w}from"../../core/promiseUtils.js";import{watch as f,on as m,when as y,syncAndInitial as g,initial as k,sync as v,whenOnce as _}from"../../core/reactiveUtils.js";import{property as W,subclass as M}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as F}from"../../editing/templateUtils.js";import{getGraphicLayer as T}from"../../graphic/graphicOriginUtils.js";import V from"../../layers/GraphicsLayer.js";import{isEditableLayer as I}from"../../layers/support/editableLayers.js";import{isFeatureLayer as E,isSubtypeGroupLayer as S,getOwningPortalUrl as A}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as L}from"../../portal/support/urlUtils.js";import U from"../../views/SelectionManager.js";import C from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as O}from"../../views/interactive/snapping/SnappingManager.js";import j from"../../views/interactive/snapping/SnappingOptions.js";import{isISelectableLayer as R}from"../../views/support/selectionUtils.js";import P from"../Attachments/AttachmentsViewModel.js";import H from"./CreateFeaturesWorkflow.js";import q from"./UpdateWorkflow.js";import{getLayersFromWorkflow as x,isCreateFeaturesWorkflow as G,isUpdateRecordWorkflow as D,isUpdateFeaturesWorkflow as B,isMergeFeaturesWorkflow as N,isSplitFeatureWorkflow as Q,isUpdateWorkflow as z,isFeatureFormViewModel as Z,findEditorItemForLayerOrThrow as $,toFeatureInfos as J,fetchFullFeaturesByObjectId as K,fetchFullFeatures as X,findEditorItemForLayer as Y,whenEditorLayerView as ee}from"./workflowUtils.js";import te from"./support/EditorItem.js";import{assertViewNot3D as ie,MultipleSourceLayersError as re,InsufficientFeatureCountError as oe,MissingOriginLayerError as ae,assertMergeWorkflowCapabilities as se,FetchFullFeatureError as ne,assertSplitWorkflowCapabilities as le}from"./support/errors.js";import{makeTemplateGroupInfoForLayer as de}from"../FeatureTemplates/featureTemplatesUtils.js";import ce from"../FeatureTemplates/FeatureTemplatesViewModel.js";import pe from"../Sketch/SketchViewModel.js";import he from"../Spinner/SpinnerViewModel.js";import{goTo as ue}from"../support/goToUtils.js";import{isFeatureItem as we,isLayerItem as fe}from"../support/SelectionList/selectionListUtils.js";import me from"../support/SelectionList/SelectionListViewModel.js";import ye from"../support/SelectionToolbar/SelectionToolbarViewModel.js";function ge(e,t){return e?.find(e=>e.layer===t)}let ke=class extends s{constructor(e){super(e),this._queuedSelectionTool=null,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new V({listMode:"hide",internal:!0,title:"Editor sketch layer"}),this._snappingManager=null,this._templatesByLayer=new Map,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new b,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new r,this.editorItems=new r,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new P({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new ce({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.layerInfos=null,this.ownSketchViewModel=new pe({layer:this._sketchGraphicsLayer}),this.selectionListViewModel=new me,this.selectionManager=new U,this.selectionToolbarViewModel=new ye({continuousSelectionEnabled:!0,defaultOperationType:"replace",persistSelection:!1,returnGeometry:!1}),this.sketchOptions=new C,this.snappingOptions=new j({attributeRulesEnabled:!0}),this.spinnerViewModel=new he,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.back=async()=>{if("viewing-selection-list"===this.state)return this.selectionListViewModel.filterText=void 0,void this.effectiveSelectionManager.clear();this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>await(this.activeWorkflow?.save()),this.selectFeature=(e,t=!1)=>{const i=this.activeWorkflow;if(this._candidateCommitted||"update"!==i?.type)return;const{rootFeatures:r}=i.data;r.removeAll(),e&&r.add(e),t&&(i.next(),this._candidateCommitted=!0)}}initialize(){this.addHandles([f(()=>{const e=this.view,t=e?.map?.editableLayers.toArray(),i=e?.allLayerViews,r=i?.filter(e=>!!t?.includes(e.layer));return[t,r,this.layerInfos]},()=>this._updateEditorItems(),g),f(()=>this.hideTemplatesForInactiveLayers,()=>this.syncFeatureTemplates()),f(()=>this._selectionSources,()=>this._syncSelectionSources(),k),m(()=>this.activeWorkflow,"cancel",()=>this.emit("workflow-cancel")),m(()=>this.activeWorkflow,"commit",()=>this.emit("workflow-commit")),m(()=>this.activeWorkflow,"complete",()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)}),y(()=>!this.activeWorkflow&&this._queuedSelectionTool,()=>this._queuedSelectionTool&&this.selectionToolbarViewModel.activateTool(this._queuedSelectionTool)),f(()=>this.activeWorkflow,e=>this.selectionManager.highlightEnabled=!e),y(()=>this.view?.map,e=>e.add(this._sketchGraphicsLayer),k),m(()=>this.editorItems,"change",()=>this._afterEditorItemsChange()),f(()=>[this.canCreate,this.canUpdateVisible],()=>this._afterEditorItemsChange()),f(()=>this.page,(e,t)=>{const i=[...this.pageStack];if(-1===i.indexOf(e))i.push(e);else for(;i.length&&i.at(-1)!==e;)i.pop();this.pageStack=i},g),y(()=>"awaiting-update-feature-candidate"===this.state,()=>this._candidateCommitted=!1),m(()=>this.featureTemplatesViewModel,"select",async({item:e,oldItem:t})=>{const{activeWorkflow:i}=this;if(i){if("update"===i.type&&"awaiting-feature-creation-info"===i.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(t,{emit:!1})}}if(!e)return;const r={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(r);await this.startCreateFeaturesWorkflowAtFeatureCreation(r)}),f(()=>[this.view,this.featureTemplatesViewModel],([e,t])=>{t.view=e},g),m(()=>this.view,"key-down",e=>{"Escape"===e.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(e.stopPropagation(),this.back())}),m(()=>this.sketchViewModel,["create","delete","update"],e=>{const{activeWorkflow:t}=this,i=x(t),r=`sketch-${e.type}`;this.emit(r,{type:r,detail:e,layer:i[0],layers:i})},v),f(()=>this.view,e=>{if(this._snappingManager=c(this._snappingManager),!e)return;const t=this.snappingOptions;this._snappingManager=new O({view:e,options:t}),this.ownSketchViewModel.snappingManager=this._snappingManager},g),f(()=>this.snappingOptions,e=>{this._snappingManager&&(this._snappingManager.options=e)},g),m(()=>this.selectionToolbarViewModel,"complete",e=>this._onSelectionComplete(e)),f(()=>({view:this.view,selectionManager:this.effectiveSelectionManager,selectionListViewModel:this.selectionListViewModel,selectionToolbarViewModel:this.selectionToolbarViewModel}),({view:e,selectionManager:t,selectionListViewModel:i,selectionToolbarViewModel:r})=>{t.view=e,i.view=e,r.view=e},g),f(()=>this.effectiveSelectionManager,e=>{this.selectionListViewModel.selectionManager=e,this.selectionToolbarViewModel.selectionManager=e},g)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then(()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null}),this._updateItemsTask=p(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=h(this._sketchEventListenerHandle),this.selectionListViewModel?.destroy(),this.selectionToolbarViewModel?.destroy(),this.selectionManager.destroy()}get _featureTemplatesLayersAndTables(){const e=new r;for(const t of this.editorItems){const i=this.hideTemplatesForInactiveLayers&&!t.visible;t.supportsCreateFeaturesWorkflow&&!i&&e.push(t.layer)}return e}get _selectionSources(){const e=new r;for(const t of this.editorItems)R(t.layer)&&t.supportsUpdateWorkflow&&t.visible&&e.push(t.layer);return e}get activeFeatureCount(){const e=this.activeLeafWorkflow;return G(e)?e.pendingFeatures.length:D(e)&&e.data.edits.feature?1:B(e)?e.data.fullFeatures.length:N(e)?e.data.features.length:Q(e)?2:0}get activeLeafWorkflow(){const e=this.activeWorkflow;return e&&z(e)?e.activeWorkflow??e:e}get canCreate(){return this.editorItems.some(e=>e.supportsCreateFeaturesWorkflow)}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some(e=>e.supportsUpdateWorkflow)}get canUpdateVisible(){return this.editorItems.some(e=>e.supportsUpdateWorkflow&&e.visible)}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter(e=>"scene"===e.type||!e.isTable)}get effectiveSelectionManager(){return this.selectionManager}get featureFormViewModel(){const e=this.activeWorkflow?.formViewModel;return Z(e)?e:null}get formViewModel(){return this.activeWorkflow?.formViewModel}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get sketchViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeSketchViewModel:"create-features"===e?.type?e.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const e=this.attachmentsViewModel.mode;if("add"===e)return"adding-attachment";if("edit"===e)return"editing-attachment";const{activeWorkflow:t}=this,i=!t?.stepId;return this.effectiveSelectionManager.count&&i?"viewing-selection-list":i?"ready":"update"===t.type&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}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}set view(e){this.ownSketchViewModel.view=e,this.spinnerViewModel.view=e,this._set("view",e)}get canZoomTo(){const e=this.sketchViewModel,t=e?.createGraphic?.geometry?.type;return!(!e?.updateGraphics?.length&&"multipoint"!==t)}get page(){const{activeWorkflow:e,state:t}=this;if("update"===e?.type&&Z(e.formViewModel)){const{associatedLayer:t,associationId:i}=e.formViewModel;if(t||null!=i)return"viewing-associated-features"}if("update"===e?.type&&"awaiting-feature-to-update"===e.stepId)return"ready";if("create-features"===e?.type&&0===e.numPendingFeatures){const t=e.data.upload;if(t)return"default"===t.state?"ready":"creating-features-upload-details"}return t??"disabled"}get featureFormDisabled(){const{activeLeafWorkflow:e}=this;if(D(e))return!1===e.data.editorItem?.capabilities.update.attributes||!0===e.formViewModel.disabled;if(B(e)){const{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeLeafWorkflow:e}=this;if(D(e)){const{data:t}=e;return t.editorItem?.capabilities.delete.enabled&&!t.readOnly}return!!B(e)&&e.data.editorItems.every(e=>e.capabilities.delete.enabled)}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}getTemplatesForLayer(e){return this._templatesByLayer.get(e)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,"creating-features")}async startCreateFeaturesWorkflow(e,t="awaiting-feature-creation-info"){if(await _(()=>!this.updating),!this.canCreate)throw new a("editing:unsupported-workflow","Creating features is unsupported or disabled.");const i=this._createUpdatingResolver();try{await this._cancelWorkflow();const i=this._createCreateFeaturesWorkflow(e,t);this._set("activeWorkflow",i),await i.start()}catch(r){this._logErrorAndCancelWorkflow(r)}finally{i.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(e){await _(()=>!this.updating);const t=this._createUpdatingResolver();try{const{initialFeature:t}=e,i=t.sourceLayer=t.layer,r=i?$(this.editorItems,i):void 0;if(!r?.supportsCreateFeaturesWorkflow)throw new a("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const o=this._createCreateFeaturesWorkflow({initialFeature:t,layer:r.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",o),await o.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startMergeFeaturesWorkflow(e,t={}){await _(()=>!this.updating),ie(this,"merge-features");const i=Array.isArray(e)?J(e):[e];if(i.length>1)throw new re;if(0===i.length||i[0].objectIds.length<2)throw new oe(2);const o=i[0],a=o.layer;if(!a)throw new ae;const s=$(this.editorItems,a);se(s);const l=this._createUpdatingResolver(),d=new AbortController;this.addHandles(n(d));try{await this._cancelWorkflow(),this.selectionToolbarViewModel.cancel();const e=await K(o.objectIds,a,this.view?.spatialReference,d.signal);if(e.length!==o.objectIds.length)throw new ne;let i;if(t.keyFeature){const r=t.keyFeature.getObjectId();i=e.find(e=>e.getObjectId()===r)??t.keyFeature}const s=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new r(e),rootWorkflowOptions:{type:"merge",props:{...t,keyFeature:i}}});this._set("activeWorkflow",s),this.addHandles(this._destroyWorkflowOnCommit(s)),await s.start()}catch(c){this._logErrorAndCancelWorkflow(c)}finally{l.resolve()}}async startSplitFeatureWorkflow(e,t={}){await _(()=>!this.updating),ie(this,"split-feature");const i=T(e);if(!i)throw new ae;const o=$(this.editorItems,i);le(o);const a=this._createUpdatingResolver(),s=new AbortController;this.addHandles(n(s));try{await this._cancelWorkflow();const o=await X([e],i,this.view?.spatialReference,s.signal);if(1!==o.length)throw new ne;const a=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new r(o),rootWorkflowOptions:{type:"split",props:t}});this._set("activeWorkflow",a),this.addHandles(this._destroyWorkflowOnCommit(a)),await a.start()}catch(l){this._logErrorAndCancelWorkflow(l)}finally{a.resolve()}}async startUpdateFeaturesWorkflow(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update features workflow is unsupported or disabled.");const t=Array.isArray(e)?J(e):[e];if(t.length>1)throw new re;const i=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature",{rootFeatureInfos:t,rootWorkflowOptions:{type:"update-multiple"}});e.addHandles(this._destroyWorkflowOnCommit(e)),this._set("activeWorkflow",e),await e.start()}catch(r){this._logErrorAndCancelWorkflow(r)}finally{i.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow();this._set("activeWorkflow",e),await e.start()}catch(t){this._logErrorAndCancelWorkflow(t)}finally{e.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow("awaiting-update-feature-candidate");t.data.candidates=e,this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureEdit(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.selectionToolbarViewModel.cancel();const t=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new r([e])});t.addHandles(this._destroyWorkflowOnCommit(t)),this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowWithActiveSelection(){const{selectionListViewModel:e}=this;if(!e.visibleFeatureCount||!e.visibleLayerCount)throw new a("editing:missing-selection","Unable to determine visible selection.");if(e.visibleLayerCount>1)throw new a("editing:features-different-layers","Cannot start workflow with features from different layers.");const t=e.layerItems.find(e=>e.visible);t&&await this._startUpdateWorkflowWithLayerItem(t,"update")}async deleteFeatureFromWorkflow(){o(d.getLogger(this),"EditorViewModel.deleteFeatureFromWorkflow is deprecated. Use EditorViewModel.deleteFeatures instead.",{version:"4.33",replacement:"EditorViewModel.deleteFeatures",warnOnce:!0}),await this.deleteFeatures()}async deleteFeatures(){const e=this.activeWorkflow;if(z(e))return e.deleteActiveFeatures();this._logError("editing:unsupported-workflow","Deleting features requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:e}=this;e&&"update"===e.type?await e.deleteActiveAssociation():this._logError("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}itemHasInvalidFormTemplate(e){return null!=e&&!0===Y(this.editorItems,e.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(e){const{view:i,sketchViewModel:r}=this;if(!i)return;const o=void 0,a=e??r?.createGraphic;if(a)"mesh"===a.geometry?.type?ue(i,a.geometry,o):ue(i,a,o);else{const e=r?.updateGraphics?.toArray();"3d"===i.type&&e?.some(e=>"mesh"===e.geometry?.type)?ue(i,e.map(e=>e.geometry).filter(t),o):e&&ue(i,e,o)}}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}async onSelectionListItemSelect(e){we(e)&&await this.startUpdateWorkflowAtFeatureEdit(e.graphic)}async onSelectionListMenuItemSelect(e,t){we(e)?await this.startUpdateWorkflowAtFeatureEdit(e.graphic):fe(e)&&await this._startUpdateWorkflowWithLayerItem(e,t)}restrictFeatureTemplatesViewModelToLayer(e){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([e]),l(()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)})}async _getEditorItemCandidates(e){const{view:t}=this;if(!t?.map)return[];const{map:i}=t,r=i.editableLayers.toArray(),o=i.allTables.toArray().filter(e=>E(e)||S(e));return await Promise.allSettled([...r.flatMap(e=>this._getLayerLoadPromise(e)),...o.flatMap(e=>this._getLayerLoadPromise(e))]),u(e),[...r.reverse(),...o.reverse()].filter(e=>I(e)&&("mesh"!==e.geometryType||"3d"===t.type)).flatMap(e=>"subtype-group"===e.type?e.sublayers.toArray():e)}_getLayerLoadPromise(e){return S(e)?e.loadAll():e.load()}_drainEditorItems(){this.editorItems.drain(e=>e.destroy())}_updateEditorItems(){p(this._updateItemsTask);const{view:e}=this,t=i(async t=>{if(!e?.map||!e?.allLayerViews)return;const i=await this._getEditorItemCandidates(t);if(!i.length)return void this._drainEditorItems();const r=[],o=[],a=[],{layerInfos:s}=this;for(const l of i){const t=ge(s,l),i=await ee(e,l).catch(()=>null);(t?r:i?o:a).push(new te({layer:l,layerInfo:t,layerView:i}))}s?.length&&r.sort((e,t)=>s.findIndex(({layer:t})=>t===e.layer)-s.findIndex(({layer:e})=>e===t.layer));const n=[...r,...o,...a];t.aborted||(this._drainEditorItems(),this.editorItems.addMany(n))});this._updatingHandles.addPromise(t.promise),this._updateItemsTask=t}_updateTemplates(){p(this._updateTemplatesTask);const e=i(async e=>{const t=this._templatesByLayer,i=this._featureTemplatesLayersAndTables.filter(e=>!t.has(e));if(i.length>0){const r=await F({layers:i.toArray(),view:this.view,signal:e,queryOptions:{returnVisibleTemplatesOnly:!0}});for(const{layer:e,templates:i}of r)t.set(e,i)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)});this._updatingHandles.addPromise(e.promise),this._updateTemplatesTask=e}_setFeatureTemplatesViewModelLayers(e){const t=this._templatesByLayer,i=[];for(const r of e){const e=t.get(r);e&&e.length>0&&i.push(de(r,e))}this.featureTemplatesViewModel.templateInfos=i}_afterEditorItemsChange(){const{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),!e)return;const{stepId:t}=e;"create-features"!==e.type?"update"===e.type&&("awaiting-feature-to-update"===t&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===t&&!e.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==t||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(e){const t=this.activeWorkflow;if(!t)return void(e?.warnIfNoWorkflow&&this._logError("editing:no-active-workflow","There is no active workflow to cancel."));if(!e||!1!==e.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await t.cancel(e)}finally{t.destroy()}}else try{await t.cancel(e),this._set("activeWorkflow",null),t.destroy()}catch(i){}}_createCreateFeaturesWorkflow(e,t){return H.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createUpdateWorkflow(e,t){const i=q.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)});return i}_addAttachments(e,t){const i=t.map(t=>this._addAttachment(e,t.feature,t.attachment))??[];return Promise.all(i)}async _addAttachment(e,t,i){let r=null;if(!("addAttachment"in e)||null==e.capabilities?.attachment)throw new a("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation(async()=>(r=await(e.addAttachment?.(t,i).catch(e=>{throw e?.error||e}))??null,r)),r}async _applyEdits(e,t,i){let r=null;const o=e.url?await A(e.url):null,a={returnServiceEditsOption:(!o||!L(o))&&!/\/hosted\//i.test(e.url)?"original-and-current-features":void 0,...i};return await this._queueOperation(async()=>{const{view:i}=this;if(!i)return null;const o=await ee(i,e).catch(()=>null);return r=await e.applyEdits(t,a),o&&await _(()=>!o.updating),r}),r}async _applyEditsFeatureService(e,t,i){let r=null;return await this._queueOperation(async()=>r=await e.applyEdits(t,i)),r}_destroyWorkflowOnCommit(e){return m(()=>e,"commit",()=>{e.destroy(),this.activeWorkflow===e&&this._set("activeWorkflow",null)})}_queueOperation(e){this._activityQueue.push(e);const t=(e,t)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)};return e().then(e=>(Array.isArray(e)?e.forEach(e=>this._handleEditsResultError(e)):this._handleEditsResultError(e),e)).catch(i=>{this._logError("editing:operation-error","An error occurred.",{error:i});const r={error:i,retry:()=>(t(r,this.failures),this._queueOperation(e)),cancel:()=>{t(r,this.failures)}};this._set("failures",[...this.failures,r])}).then(()=>{t(e,this._activityQueue)})}_handleEditsResultError(e){if(null!=e&&"error"in e&&null!=e.error)throw e.error;if(null!=e&&"addFeatureResults"in e){const{addFeatureResults:t,deleteFeatureResults:i,updateFeatureResults:r}=e,o=t.find(e=>!!e.error)||r.find(e=>!!e.error)||i.find(e=>!!e.error);if(o)throw o.error}}_createUpdatingResolver(){const e=w();return this._updatingHandles.addPromise(e.promise),e}_logErrorAndCancelWorkflow(e){const{name:t,message:i,details:r}=e;this._logError(t??"editing:workflow-start-failed",i??void 0,r??e),this._cancelWorkflow({force:!0})}_itemIsSuspended(e){const t=$(this.editorItems,e);return null!=t&&(!t.visible||t.disabled)}_logError(e,t,i){d.getLogger(this).error(new a(e,t,i))}_syncSelectionSources(){this.selectionManager.sources.items=this._selectionSources.toArray()}async _onSelectionComplete(e){if(e.aborted)return;const{operationType:t,selection:i}=e,{effectiveSelectionManager:r}=this,o="ready"===this.state,a=1===i.length;if(this._queuedSelectionTool=void 0,o&&a&&"replace"===t)return this._queuedSelectionTool=e.toolName,this.startUpdateWorkflowAtFeatureEdit(i[0]);switch(t){case"remove":r.updateSelection({current:[],added:[],removed:i});break;case"replace":r.clear(),r.updateSelection({current:i,added:[],removed:[]});break;case"add":r.updateSelection({current:i,added:[],removed:[]})}}async _startUpdateWorkflowWithLayerItem(e,t){if(!e.objectIds?.length)return;const i=e.featureItems.filter(e=>e.visible).map(e=>e.graphic),r=this.selectionListViewModel.filterText;if(1===i.length)return await this.startUpdateWorkflowAtFeatureEdit(i[0]);let o;if(null!=r&&""!==r){const e=J(i);if(e.length>1)throw new re;if(o=e[0],!o)throw new oe("merge"===t?2:1)}else o={layer:e.layer,objectIds:e.objectIds};"update"===t?await this.startUpdateFeaturesWorkflow(o):"merge"===t&&await this.startMergeFeaturesWorkflow(o)}};e([W()],ke.prototype,"_featureTemplatesLayersAndTables",null),e([W()],ke.prototype,"_queuedSelectionTool",void 0),e([W()],ke.prototype,"_snappingManager",void 0),e([W()],ke.prototype,"_selectionSources",null),e([W()],ke.prototype,"activeFeatureCount",null),e([W({readOnly:!0})],ke.prototype,"activeWorkflow",void 0),e([W()],ke.prototype,"activeLeafWorkflow",null),e([W({readOnly:!0})],ke.prototype,"_activityQueue",void 0),e([W({readOnly:!0})],ke.prototype,"canCreate",null),e([W()],ke.prototype,"canCreateVisible",null),e([W({readOnly:!0})],ke.prototype,"canUpdate",null),e([W()],ke.prototype,"canUpdateVisible",null),e([W()],ke.prototype,"featureTemplatesLayers",null),e([W()],ke.prototype,"editorItems",void 0),e([W()],ke.prototype,"effectiveSelectionManager",null),e([W({readOnly:!0})],ke.prototype,"failures",void 0),e([W()],ke.prototype,"hideTemplatesForInactiveLayers",void 0),e([W({type:P})],ke.prototype,"attachmentsViewModel",void 0),e([W()],ke.prototype,"featureFormViewModel",null),e([W()],ke.prototype,"formViewModel",null),e([W()],ke.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),e([W({type:ce})],ke.prototype,"featureTemplatesViewModel",void 0),e([W()],ke.prototype,"labelOptions",null),e([W()],ke.prototype,"layerInfos",void 0),e([W()],ke.prototype,"ownSketchViewModel",void 0),e([W()],ke.prototype,"selectionListViewModel",void 0),e([W()],ke.prototype,"selectionManager",void 0),e([W()],ke.prototype,"selectionToolbarViewModel",void 0),e([W()],ke.prototype,"sketchOptions",void 0),e([W()],ke.prototype,"sketchViewModel",null),e([W({type:j,nonNullable:!0})],ke.prototype,"snappingOptions",void 0),e([W()],ke.prototype,"spinnerViewModel",void 0),e([W()],ke.prototype,"state",null),e([W({readOnly:!0})],ke.prototype,"syncing",null),e([W()],ke.prototype,"updating",null),e([W()],ke.prototype,"tooltipOptions",null),e([W()],ke.prototype,"valueOptions",null),e([W()],ke.prototype,"view",null),e([W()],ke.prototype,"canZoomTo",null),e([W()],ke.prototype,"pageStack",void 0),e([W()],ke.prototype,"showDiscardEditsPrompt",void 0),e([W()],ke.prototype,"_candidateCommitted",void 0),e([W()],ke.prototype,"page",null),e([W()],ke.prototype,"featureFormDisabled",null),e([W()],ke.prototype,"featureFormHasAssociation",null),e([W()],ke.prototype,"canGoBack",null),e([W()],ke.prototype,"shouldShowDeleteButton",null),e([W()],ke.prototype,"hasPendingEdits",null),e([W()],ke.prototype,"snappingManager",null),ke=e([M("esri.widgets.Editor.EditorViewModel")],ke);const ve=ke;export{ve as default};