@arcgis/core 4.34.0-next.1 → 4.34.0-next.2

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 (177) hide show
  1. package/Map.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/DimensionAnalysis.js +1 -1
  4. package/analysis/LineOfSightAnalysis.js +1 -1
  5. package/analysis/ViewshedAnalysis.js +1 -1
  6. package/arcade/Voxel.js +1 -1
  7. package/arcade/functions/knowledgegraph.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/{253bcc3cc7bc4c2dc6ea.js → 03db109e9b695528c35d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{fa63b0f7fa799cb2f81d.js → 07e58dff44fcbb3b3539.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{fc61d02286b6ff5447cc.js → 09da6b3085fc84cd69d5.js} +1 -1
  12. package/assets/esri/core/workers/chunks/0fd826e7f64a37aaaa1e.js +1 -0
  13. package/assets/esri/core/workers/chunks/{1c86aa3802d9ae0230ae.js → 28e31ac00dc95a1318e9.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{0d23610475c85385fbff.js → 355e6bcdb401ada71f39.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{bba6d7615d8f3862fe70.js → 36f0046ff6b46adce7b7.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{42d9989b2aad3ac28d4d.js → 397b15d46f22718c9f38.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{b0522dffa5600345c07e.js → 3e85e63148b5e93d3074.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{d2ebb72a43d995ed368a.js → 42bb9bb6fe44a47d9b81.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{6ee41e9c92ed8ba4c763.js → 4dd0a5f327fa5fc7249d.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{36b0d6b4089a96475201.js → 51ba7345c31e6eb79060.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{66e79aa02b3aa12b3778.js → 5200be8bce60fa831026.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{6b23ca6570357f9fb724.js → 52a57106a41b8c9483d7.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{585c7b485c42555ec554.js → 61f9747c960d959b571b.js} +2 -2
  24. package/assets/esri/core/workers/chunks/{9fc35ec8185beba96715.js → 632d1a1287dde980479e.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{1d043965dcdc11b3aeaa.js → 63852887b3f07d50f7c9.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{c16e0da7a19310c71e8b.js → 677af0281e4fc9f3bd98.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{6ecc3a3737ae8622dfa4.js → 7b12607633bbdc318936.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{d839a237d5edc243d645.js → 8aa8f9986b966ccb64e2.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{67338948e470c1251d8a.js → 8d14e957219364a81d5f.js} +3 -3
  30. package/assets/esri/core/workers/chunks/92a5dccb328229a9336b.js +1 -0
  31. package/assets/esri/core/workers/chunks/{631205dc4d73d49ec9ed.js → 95507ff0a243e451b99e.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{1051a5a57b2fb843a555.js → 9cd55043f3d789f41815.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{2b1486a466760d2152f5.js → a0f2df8ca7cd14bfa013.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{06eb4832b6c86744e52e.js → aba19485b6cdcb70dac6.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{9a06476b834584d00d5c.js → b160dcbea6256e0cf689.js} +1 -1
  36. package/assets/esri/core/workers/chunks/b2a6afa0cd537805b4b8.js +1 -0
  37. package/assets/esri/core/workers/chunks/{571252c9822d73cf7b01.js → b845586219f284a215b2.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{97c148adf0347c69a79c.js → c9604f8df909ec4fad46.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{b87fec1753f164c845c5.js → ca76950d81ab4ebb65e1.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{faa40ef04604c7cce706.js → cb63ea6a53d3c2fc3179.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{55f087bca75c3f2a4515.js → d3c0d7799c92c6f0e7d3.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{ca60b34c3e1ed2ff5934.js → dd2b316baae02bbdddac.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{80b596496800e8d60eb8.js → ed75e0962358523f4439.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{0cf979a093e9744d1e80.js → ef7955a2509be0f03ca2.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{b5d68d8460b7c15001dd.js → f1c6df5cf2ccb6ac47a1.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{523046e04679e301797d.js → f3d97a4c4f433adbdab5.js} +1 -1
  47. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  48. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  49. package/chunks/FocusAreaColor.glsl.js +10 -8
  50. package/chunks/persistableUrlUtils.js +1 -1
  51. package/config.js +1 -1
  52. package/core/accessorSupport/decorators/persistable.js +1 -1
  53. package/geometry/projection/projectPointToVector.js +1 -1
  54. package/geometry/projection/projectVectorToPoint.js +1 -1
  55. package/geometry/projection/projectVectorToVector.js +1 -1
  56. package/geometry/projection.js +1 -1
  57. package/geometry/projectionUtils.js +5 -0
  58. package/geometry/support/meshUtils/elevation.js +1 -1
  59. package/geometry/support/meshUtils/extent.js +1 -1
  60. package/interfaces.d.ts +34 -2
  61. package/kernel.js +1 -1
  62. package/layers/MapNotesLayer.js +1 -1
  63. package/layers/RouteLayer.js +1 -1
  64. package/layers/graphics/applyEditsUtils.js +1 -1
  65. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  66. package/layers/graphics/data/QueryEngine.js +1 -1
  67. package/layers/graphics/data/projectionSupport.js +1 -1
  68. package/layers/graphics/data/queryUtils.js +1 -1
  69. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  70. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  71. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  72. package/layers/ogc/wfsUtils.js +1 -1
  73. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  74. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  75. package/layers/orientedImagery/transformations/utils.js +1 -1
  76. package/layers/support/ControlPointsGeoreference.js +1 -1
  77. package/layers/support/CornersGeoreference.js +1 -1
  78. package/layers/support/ElevationQuery.js +1 -1
  79. package/layers/support/ExtentAndRotationGeoreference.js +1 -1
  80. package/layers/support/GeoreferenceBase.js +1 -1
  81. package/layers/support/LocalMediaElementSource.js +1 -1
  82. package/layers/support/MediaElementView.js +1 -1
  83. package/layers/support/PolygonCollection.js +1 -1
  84. package/layers/support/SceneModification.js +1 -1
  85. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  86. package/package.json +1 -1
  87. package/portal/schemas/definitions.js +1 -1
  88. package/portal/schemas/webScene.js +1 -1
  89. package/portal/support/portalItemUtils.js +1 -1
  90. package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
  91. package/smartMapping/renderers/size.js +1 -1
  92. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  93. package/smartMapping/statistics/histogram.js +1 -1
  94. package/smartMapping/statistics/summaryStatistics.js +1 -1
  95. package/support/persistableUrlUtils.js +1 -1
  96. package/support/revision.js +1 -1
  97. package/views/2d/ViewStateManager.js +1 -1
  98. package/views/2d/constraints/GeometryConstraint.js +1 -1
  99. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  100. package/views/2d/grid/GridView2D.js +1 -1
  101. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  102. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  103. package/views/2d/layers/KMLLayerView2D.js +1 -1
  104. package/views/2d/viewpointUtils.js +1 -1
  105. package/views/3d/FocusAreasView.js +1 -1
  106. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  107. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  108. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  109. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  110. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  111. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  112. package/views/3d/analysis/support/projectionUtils.js +1 -1
  113. package/views/3d/environment/EnvironmentManager.js +1 -1
  114. package/views/3d/interactive/Manipulator3D.js +1 -1
  115. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  116. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  117. package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
  118. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  119. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  120. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  121. package/views/3d/layers/FlowSubView3D.js +1 -1
  122. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  123. package/views/3d/layers/SceneLayerWorker.js +1 -1
  124. package/views/3d/layers/TileLayerView3D.js +1 -1
  125. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  126. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  127. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  128. package/views/3d/layers/graphics/focusAreaStyle.js +1 -1
  129. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  130. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  131. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  132. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  133. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  134. package/views/3d/state/ViewStateManager.js +1 -1
  135. package/views/3d/support/cameraUtils.js +1 -1
  136. package/views/3d/support/viewpointUtils.js +1 -1
  137. package/views/3d/terrain/ExtentHelper.js +1 -1
  138. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  139. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  140. package/views/3d/webgl-engine/effects/focusArea/FocusAreaEffect.js +5 -0
  141. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  142. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  143. package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +1 -1
  144. package/views/FocusArea.js +1 -1
  145. package/views/FocusAreaOutline.js +1 -1
  146. package/views/FocusAreas.js +1 -1
  147. package/views/SceneView.js +1 -1
  148. package/views/View2D.js +1 -1
  149. package/views/interactive/GraphicManipulator.js +1 -1
  150. package/views/interactive/dragEventPipeline.js +1 -1
  151. package/views/interactive/snapping/GridSnappingEngine.js +1 -1
  152. package/views/interactive/snapping/SnappingManager.js +1 -1
  153. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  154. package/views/layers/SceneLayerView.js +1 -1
  155. package/views/support/projectionUtils.js +1 -1
  156. package/webscene/Slide.js +1 -1
  157. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  158. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  159. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  160. package/widgets/CoordinateConversion/support/Format.js +1 -1
  161. package/widgets/Editor/Upload.js +1 -1
  162. package/widgets/Editor.js +1 -1
  163. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  164. package/widgets/Features/FeaturesViewModel.js +1 -1
  165. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  166. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  167. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  168. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  169. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  170. package/widgets/Sketch/SketchViewModel.js +1 -1
  171. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  172. package/widgets/support/AnchorElementViewModel.js +1 -1
  173. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  174. package/widgets/support/tests.js +1 -1
  175. package/assets/esri/core/workers/chunks/3a743653b786b010a57f.js +0 -1
  176. package/assets/esri/core/workers/chunks/6d1e1a4fcb90ea8b6848.js +0 -1
  177. package/assets/esri/core/workers/chunks/87fc7b6c3e2d4f7775e2.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../chunks/tslib.es6.js";import r from"../core/Accessor.js";import e from"../core/Collection.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{FocusAreaOutline as i}from"./FocusAreaOutline.js";let p=class extends r{constructor(o){super(o),this.id=`focusarea-${Date.now().toString(16)}`,this.enabled=!0,this.geometries=new e}};o([t()],p.prototype,"id",void 0),o([t()],p.prototype,"title",void 0),o([t()],p.prototype,"enabled",void 0),o([t()],p.prototype,"geometries",void 0),o([t({type:i})],p.prototype,"outline",void 0),p=o([s("esri.views.FocusArea")],p);export{p as FocusArea};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import o from"../request.js";import r from"../core/Clonable.js";import s from"../core/JSONSupport.js";import t from"../core/Promise.js";import{on as i,sync as p}from"../core/reactiveUtils.js";import{generateUUID as a}from"../core/uuid.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as n}from"../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{persistable as l}from"../core/accessorSupport/decorators/persistable.js";import d from"../layers/support/PolygonCollection.js";import{f as u}from"../chunks/persistableUrlUtils.js";import{FocusAreaOutline as j}from"./FocusAreaOutline.js";let f=class extends(t.EsriPromiseMixin(s.JSONSupportMixin(r))){constructor(e){super(e),this.id=`focusarea-${a()}`,this.enabled=!0,this.geometries=new d}initialize(){this.addHandles(i((()=>this.geometries),"after-changes",(()=>this.geometries=this.geometries),p))}readGeometries(e,o,r){Array.isArray(e)?this.geometries=d.fromJSON(e,r):r.hooks?.onAfterLoad?.((()=>this._loadGeometries(u(e,r),r)))}async _loadGeometries(e,r){const s=await o(e,{responseType:"json"});this.geometries=d.fromJSON(s.data,r)}};e([m({type:String,nonNullable:!0,json:{write:!0,origins:{"web-scene":{write:{isRequired:!0}}}}}),m()],f.prototype,"id",void 0),e([m({type:String,json:{write:!0}})],f.prototype,"title",void 0),e([m({type:Boolean,nonNullable:!0,json:{write:!0,origins:{"web-scene":{write:{isRequired:!0}}}}})],f.prototype,"enabled",void 0),e([m({type:j,json:{write:!0}})],f.prototype,"outline",void 0),e([m({type:d,nonNullable:!0,json:{write:!0,origins:{"web-scene":{write:{isRequired:!0}}}},clonable:e=>new d(e.items.map((e=>e.clone())))}),l({origins:["web-scene","portal-item"],type:"resource",prefix:"geometries",contentAddressed:!0})],f.prototype,"geometries",void 0),e([n(["web-scene","portal-item"],"geometries")],f.prototype,"readGeometries",null),f=e([c("esri.views.FocusArea")],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/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../chunks/tslib.es6.js";import r from"../Color.js";import s from"../core/Accessor.js";import{property as e}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as t}from"../core/accessorSupport/decorators/subclass.js";let c=class extends s{constructor(o){super(o),this.color=null}};o([e({type:r})],c.prototype,"color",void 0),c=o([t("esri.views.FocusAreaOutline")],c);export{c as FocusAreaOutline};
5
+ import{_ as o}from"../chunks/tslib.es6.js";import r from"../Color.js";import s from"../core/Clonable.js";import e from"../core/JSONSupport.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import{Integer as p}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";let i=class extends(s.ClonableMixin(e)){constructor(o){super(o),this.color=null}};o([t({type:r,json:{type:[p],write:!0}})],i.prototype,"color",void 0),i=o([c("esri.views.FocusAreaOutline")],i);export{i as FocusAreaOutline};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../chunks/tslib.es6.js";import o from"../core/Accessor.js";import s from"../core/Collection.js";import{property as e}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";let t=class extends o{constructor(){super(...arguments),this.areas=new s,this.style="dark"}add(r){this.areas.add(r)}addMany(r){this.areas.addMany(r)}remove(r){this.areas.remove(r)}removeMany(r){this.areas.removeMany(r)}removeAll(){this.areas.removeAll()}};r([e()],t.prototype,"areas",void 0),r([e()],t.prototype,"style",void 0),t=r([a("esri.views.FocusAreas")],t);export{t as FocusAreas};
5
+ import{_ as o}from"../chunks/tslib.es6.js";import r from"../core/Clonable.js";import e from"../core/Collection.js";import s from"../core/JSONSupport.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import p from"./FocusArea.js";let c=class extends(s.JSONSupportMixin(r)){constructor(o){super(o),this.areas=new e,this.style="bright"}};o([t({type:e.ofType(p),nonNullable:!0,json:{write:!0,origins:{"web-scene":{write:{isRequired:!0}}}},clonable:o=>new e(o.items.map((o=>o.clone())))})],c.prototype,"areas",void 0),o([t({type:["bright","dark"],nonNullable:!0,json:{write:!0}})],c.prototype,"style",void 0),c=o([i("esri.views.FocusAreas")],c);export{c as FocusAreas};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{ObservableChangesType as d}from"../core/ObservableChangesType.js";import{throwIfAborted as u}from"../core/promiseUtils.js";import{on as c,watch as g,initial as m,sync as y,whenOnce as f,syncAndInitial as w}from"../core/reactiveUtils.js";import{setFrameDuration as v}from"../core/scheduling.js";import{createScreenPointArray as _,createScreenPoint as b}from"../core/screenUtils.js";import{getMetersPerUnitForSR as M}from"../core/unitUtils.js";import{initialize as S}from"../core/workers/workers.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as R}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as C,ensureClass as O}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as T}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as E}from"../core/support/OwningCollection.js";import A from"../geometry/Extent.js";import L from"../geometry/HeightModelInfo.js";import H from"../geometry/Point.js";import{project as I,canProjectWithoutEngine as D}from"../geometry/projection.js";import G from"../geometry/SpatialReference.js";import{projectBoundingRect as F}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as P}from"../geometry/projection/projectPointToVector.js";import{create as U,toExtent as W}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as q}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as z}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as k,isTiledLayer as B,isVoxelLayer as N,isIntegratedMeshLayer as Q}from"../layers/support/layerUtils.js";import{AnalysesCollection as Y}from"../support/AnalysesCollection.js";import{WebSceneTag as Z}from"../support/tagSymbols.js";import{BreakpointsOwner as $}from"./BreakpointsOwner.js";import{DOMContainer as J}from"./DOMContainer.js";import K from"./GroundView.js";import{PopupView as X}from"./PopupView.js";import ee from"./View.js";import te from"./ViewAnimation.js";import{ViewingMode as ie,stringFromViewingMode as re,viewingModeFromString as se}from"./ViewingMode.js";import{layerView3DImporter as ne}from"./3d/layerViewModuleImportUtils.js";import ae from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as oe}from"./3d/constraints/Constraints.js";import{EnvironmentManager as le}from"./3d/environment/EnvironmentManager.js";import pe from"./3d/environment/SceneViewEnvironment.js";import he from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as de}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ue}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ce}from"./3d/layers/support/FeatureTileTree3D.js";import ge from"./3d/state/ViewState.js";import{ViewStateManager as me}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as ye}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as fe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as we}from"./3d/support/debugFlags.js";import ve from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as _e}from"./3d/support/ElevationProvider.js";import{toMap as be,hitTest as Me}from"./3d/support/hitTest.js";import{popupHitTest as Se}from"./3d/support/popupHitTest.js";import Ve from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as je}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Re}from"./3d/support/ResourceController.js";import Ce from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Oe}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Te}from"./3d/support/ViewSlice.js";import{PointsOfInterest as xe}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Ee from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ae,getTiledLayerInfo as Le,checkIfTileInfoSupportedForView as He}from"./3d/terrain/terrainUtils.js";import{Stage as Ie}from"./3d/webgl-engine/Stage.js";import{olidEnabled as De}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{defaultTolerance as Ge}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Fe}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as Pe}from"./support/HighlightDefaults.js";import Ue from"./support/HighlightOptions.js";import{occludeesSupported as We}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as qe,createScreenPointFromSupportedEvent as ze}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ke}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Be,destroyTextureCompressionWorker as Ne}from"./support/TextureCompressionHelper.js";import{check as Qe}from"./support/WebGLRequirements.js";import Ye from"./ui/DefaultUI.js";import Ze from"./ui/3d/DefaultUI3D.js";import $e from"../webscene/Environment.js";let Je=class extends($(X(J(ee)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Re(this),this.deconflictor=new de({view:this}),this.labeler=new ue({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Y,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new oe,this.environment=new pe,this.environmentManager=new le,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ae({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ge({view:this}),this.slice=new Te,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Ze,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,S();const t=(e=null)=>{null!=e&&e.type===d.MOVE||(this._updatingChanged(),this.map?.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([c((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),g((()=>this.scene),(e=>e?.load().catch((()=>{}))))]),this.inputManager=new he({view:this}),this.stateManager=new me({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=Be(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new K({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>v(e>0?1e3/Math.ceil(e):0)),m),this.addHandles([g((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),y),g((()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration})),(()=>this._updateSlice()),y)])}destroy(){this.destroyed||(Ne(this),this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this._exitBasemapTerrain(),this.stage?.destroy(),this.slice.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof A?this.spatialReference&&(t=Ke(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ie.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:Ke(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||G.WGS84,i=Ke(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||G.WGS84;let t;const i=i=>{const r=Ke(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new A({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}const s=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach((e=>s(e))),null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const n=this._get("_groundAndLayersExtent");return t.equals(n)?n:t}castEnvironment(e){return e?e instanceof pe?e:e instanceof $e?this.environment?.cloneWithWebsceneEnvironment(e)??pe.fromWebsceneEnvironment(e):C(pe,e):new pe}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&Z in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){ve.isValidProfile(e)&&(ve.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||ve.getDefaultProfile()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?z(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?L.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroying||this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ae(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return re(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?re(this.defaultsFromMap.viewingMode):ke(t,ie.Global)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find((({name:e})=>e===Pe))??new Ue}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===Pe)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Ce(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=qe(e)?ze(this,e):e;return be(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?_e(this.elevationProvider,e):null)??0;return P(e,Xe,this.renderSpatialReference,t),this.state.camera.projectToScreen(Xe,et),b(et[0],et[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;P(e,Xe,i);const r=this.state.camera.computeScreenPixelSizeAt(Xe);return t&&i!==t?r*M(i)/M(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=qe(e)?ze(this,e):e;return Me(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Se(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!De())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this.stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ne.importLayerView(e)}hasLayerViewModule(e){return ne.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Qe(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?se(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ie.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ie.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ke(e,i)&&(null==t||(!!k(t)||(!B(t)||null!=Le(t,e,i))&&(!N(t)||i!==ie.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(k(t)&&(r||s)){return!s||i===ie.Local||null===He(t.tileInfo,t.fullExtent,e,ie.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:G.WebMercator,viewingMode:i}]:[{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}return B(t)||N(t)||!r&&!s?B(t)&&r&&i!==ie.Global?[{spatialReference:e,viewingMode:i},{spatialReference:G.WGS84,viewingMode:ie.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${re(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&We(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter((e=>"media-3d"!==e.type)).find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await f((()=>this.graphicsView)),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer):null}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await it[e]();return t&&(u(i.signal),await t(i.signal)),u(i.signal),this._importControllers.delete(e),r}catch{this._importControllers.delete(e)}return null}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new Ee({view:this})),this._set("elevationProvider",new fe({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){const e=this.basemapTerrain,t=this.elevationProvider;e&&(this._set("basemapTerrain",null),this._set("elevationProvider",null),t.unregister(e),t.destroy(),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new xe({view:this})),this._set("featureTiles",new ce({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?I(W(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>we.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&we.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||we.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),w),this.updatingHandles.add((()=>this.clippingArea),e,w),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,w)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.featureTiles&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this._set("featureTiles",p(this.featureTiles)),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=q(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",je.create(this.state.viewingMode,i)),t||this.addHandles(g((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!F(e,this.basemapTerrain.spatialReference,tt,t)||(this.renderCoordsHelper.extent=tt)}),y),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Ge/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===d.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(g((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),y),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new ye(this.state.viewingMode,(e=>this.stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Ie({view:this,options:e,container:i}),this._updateSlice(),this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this.stage.renderer.setParameters({highQualityTransparency:e})),m),this.on("pointer-move",(()=>this.stage?.renderer.resetAnimation())),a(this.stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Ge/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Oe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this._importModule("GraphicsView3D",(e=>f((()=>this.basemapTerrain?.ready),e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=p(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this._importModule("FocusAreasView"))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){const e=se(this.viewingMode);e===ie.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(c((()=>this.graphics),"after-changes",(()=>this._ensureGraphicsView())),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(g((()=>this.map?.focusAreas?.areas.length??0),(e=>this._ensureFocusAreasView(e)),{initial:!0}),"FocusAreasView");const t=this.scene?.initialViewProperties??null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?T(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,t?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(Fe);for(const t of this.allLayerViews)Q(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(Fe);for(const t of this.allLayerViews)Q(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}};function Ke(e,t){return null!=e&&D(e.spatialReference,t)?I(e,t):null}e([V()],Je.prototype,"_userClippingArea",void 0),e([V()],Je.prototype,"_resourceController",void 0),e([V()],Je.prototype,"_stage",void 0),e([V({readOnly:!0})],Je.prototype,"deconflictor",void 0),e([V({readOnly:!0})],Je.prototype,"labeler",void 0),e([V(E(Y,"analyses"))],Je.prototype,"analyses",void 0),e([V({type:te,readOnly:!0})],Je.prototype,"animation",null),e([V({readOnly:!0})],Je.prototype,"basemapTerrain",void 0),e([V({readOnly:!0})],Je.prototype,"elevationProvider",void 0),e([V()],Je.prototype,"camera",null),e([V({type:t})],Je.prototype,"contentCamera",null),e([V({readOnly:!0})],Je.prototype,"canvas",void 0),e([V({type:H})],Je.prototype,"center",null),e([V({type:A})],Je.prototype,"clippingArea",null),e([V({type:oe})],Je.prototype,"constraints",void 0),e([V({type:A,readOnly:!0})],Je.prototype,"renderDataExtent",null),e([V({readOnly:!0})],Je.prototype,"tileInfo",null),e([V({type:A,readOnly:!0})],Je.prototype,"dataExtent",null),e([V({type:A,readOnly:!0})],Je.prototype,"_groundAndLayersExtent",null),e([V({type:pe})],Je.prototype,"environment",void 0),e([j("environment")],Je.prototype,"castEnvironment",null),e([V({readOnly:!0})],Je.prototype,"environmentManager",void 0),e([V({type:A})],Je.prototype,"extent",null),e([V({type:r})],Je.prototype,"floors",void 0),e([V()],Je.prototype,"screenCenter",null),e([V()],Je.prototype,"frustum",null),e([V({type:Number,readOnly:!0})],Je.prototype,"fullOpacity",void 0),e([V({readOnly:!0})],Je.prototype,"graphicsView",void 0),e([V({readOnly:!0})],Je.prototype,"analysisViewManager",void 0),e([V()],Je.prototype,"groundView",void 0),e([V({type:Boolean})],Je.prototype,"initialExtentRequired",null),e([V()],Je.prototype,"defaultsFromMapSettings",null),e([V()],Je.prototype,"interacting",null),e([V()],Je.prototype,"stationary",null),e([V()],Je.prototype,"navigating",null),e([V()],Je.prototype,"map",void 0),e([V()],Je.prototype,"padding",null),e([V({type:xe,readOnly:!0})],Je.prototype,"pointsOfInterest",void 0),e([V({type:ce,readOnly:!0})],Je.prototype,"featureTiles",void 0),e([V()],Je.prototype,"_featureTreeDebugger",void 0),e([V({type:Boolean})],Je.prototype,"screenSizePerspectiveEnabled",void 0),e([V({constructOnly:!0})],Je.prototype,"deactivatedWebGLExtensions",void 0),e([V({constructOnly:!0})],Je.prototype,"debugWebGLExtensions",void 0),e([V({constructOnly:!0})],Je.prototype,"renderCanvas",void 0),e([V({constructOnly:!0})],Je.prototype,"state",void 0),e([V({readOnly:!0})],Je.prototype,"inputManager",void 0),e([V({readOnly:!0})],Je.prototype,"stateManager",void 0),e([V({type:["low","medium","high"]})],Je.prototype,"qualityProfile",null),e([V({type:Ve,get(){let e=this._get("qualitySettings");return e||(e=new Ve,ve.apply(this.qualityProfile,e)),e}})],Je.prototype,"qualitySettings",void 0),e([V()],Je.prototype,"slice",void 0),e([V({readOnly:!0})],Je.prototype,"typeSpecificPreconditionsReady",null),e([V({readOnly:!0})],Je.prototype,"renderCoordsHelper",void 0),e([V({readOnly:!0})],Je.prototype,"sceneIntersectionHelper",void 0),e([V({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Je.prototype,"resolution",null),e([V({type:Number})],Je.prototype,"scale",null),e([V()],Je.prototype,"heightModelInfo",null),e([V()],Je.prototype,"spatialReference",void 0),e([V({type:Boolean,constructOnly:!0})],Je.prototype,"alphaCompositingEnabled",void 0),e([V({constructOnly:!0})],Je.prototype,"preserveDrawingBufferEnabled",void 0),e([V({type:Boolean})],Je.prototype,"supersampleScreenshotsEnabled",void 0),e([V({readOnly:!0})],Je.prototype,"type",void 0),e([V(),j((e=>e instanceof Ye?e:O(Ze,e)))],Je.prototype,"ui",void 0),e([V({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Je.prototype,"updating",null),e([V()],Je.prototype,"_updatingObjects",null),e([V()],Je.prototype,"_updatingObjectsWithProgress",null),e([V({type:Number,readOnly:!0,dependsOn:["updating"]})],Je.prototype,"updatingProgress",void 0),e([V({type:["global","local"]})],Je.prototype,"viewingMode",null),e([V({type:i})],Je.prototype,"viewpoint",null),e([V({readOnly:!0})],Je.prototype,"visibleArea",null),e([V({type:Number})],Je.prototype,"zoom",null),e([V({type:Ue})],Je.prototype,"highlightOptions",null),e([V({readOnly:!0})],Je.prototype,"quality",null),e([V({readOnly:!0})],Je.prototype,"resolutionScale",null),e([V()],Je.prototype,"focusAreasView",void 0),e([V()],Je.prototype,"_defaultToMapOptions",null),e([V()],Je.prototype,"_defaultHitTestOptions",null),Je=e([R("esri.views.SceneView")],Je);const Xe=x(),et=_(),tt=U(),it={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js")},rt=Je;export{rt as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{ObservableChangesType as d}from"../core/ObservableChangesType.js";import{throwIfAborted as u}from"../core/promiseUtils.js";import{on as c,watch as g,initial as m,sync as y,whenOnce as f,syncAndInitial as w}from"../core/reactiveUtils.js";import{setFrameDuration as v}from"../core/scheduling.js";import{createScreenPointArray as _,createScreenPoint as b}from"../core/screenUtils.js";import{getMetersPerUnitForSR as M}from"../core/unitUtils.js";import{initialize as S}from"../core/workers/workers.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as R}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as C,ensureClass as O}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as T}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as E}from"../core/support/OwningCollection.js";import A from"../geometry/Extent.js";import L from"../geometry/HeightModelInfo.js";import H from"../geometry/Point.js";import{project as I,canProjectWithoutEngine as D}from"../geometry/projectionUtils.js";import G from"../geometry/SpatialReference.js";import{projectBoundingRect as F}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as P}from"../geometry/projection/projectPointToVector.js";import{create as U,toExtent as W}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as q}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as z}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as k,isTiledLayer as B,isVoxelLayer as N,isIntegratedMeshLayer as Q}from"../layers/support/layerUtils.js";import{AnalysesCollection as Y}from"../support/AnalysesCollection.js";import{WebSceneTag as Z}from"../support/tagSymbols.js";import{BreakpointsOwner as $}from"./BreakpointsOwner.js";import{DOMContainer as J}from"./DOMContainer.js";import K from"./GroundView.js";import{PopupView as X}from"./PopupView.js";import ee from"./View.js";import te from"./ViewAnimation.js";import{ViewingMode as ie,stringFromViewingMode as re,viewingModeFromString as se}from"./ViewingMode.js";import{layerView3DImporter as ne}from"./3d/layerViewModuleImportUtils.js";import ae from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as oe}from"./3d/constraints/Constraints.js";import{EnvironmentManager as le}from"./3d/environment/EnvironmentManager.js";import pe from"./3d/environment/SceneViewEnvironment.js";import he from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as de}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ue}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ce}from"./3d/layers/support/FeatureTileTree3D.js";import ge from"./3d/state/ViewState.js";import{ViewStateManager as me}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as ye}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as fe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as we}from"./3d/support/debugFlags.js";import ve from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as _e}from"./3d/support/ElevationProvider.js";import{toMap as be,hitTest as Me}from"./3d/support/hitTest.js";import{popupHitTest as Se}from"./3d/support/popupHitTest.js";import Ve from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as je}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Re}from"./3d/support/ResourceController.js";import Ce from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Oe}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Te}from"./3d/support/ViewSlice.js";import{PointsOfInterest as xe}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Ee from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ae,getTiledLayerInfo as Le,checkIfTileInfoSupportedForView as He}from"./3d/terrain/terrainUtils.js";import{Stage as Ie}from"./3d/webgl-engine/Stage.js";import{olidEnabled as De}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{defaultTolerance as Ge}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Fe}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as Pe}from"./support/HighlightDefaults.js";import Ue from"./support/HighlightOptions.js";import{occludeesSupported as We}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as qe,createScreenPointFromSupportedEvent as ze}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ke}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Be,destroyTextureCompressionWorker as Ne}from"./support/TextureCompressionHelper.js";import{check as Qe}from"./support/WebGLRequirements.js";import Ye from"./ui/DefaultUI.js";import Ze from"./ui/3d/DefaultUI3D.js";import $e from"../webscene/Environment.js";let Je=class extends($(X(J(ee)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Re(this),this.deconflictor=new de({view:this}),this.labeler=new ue({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Y,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new oe,this.environment=new pe,this.environmentManager=new le,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ae({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ge({view:this}),this.slice=new Te,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Ze,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,S();const t=(e=null)=>{null!=e&&e.type===d.MOVE||(this._updatingChanged(),this.map?.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([c((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),g((()=>this.scene),(e=>e?.load().catch((()=>{}))))]),this.inputManager=new he({view:this}),this.stateManager=new me({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=Be(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new K({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>v(e>0?1e3/Math.ceil(e):0)),m),this.addHandles([g((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),y),g((()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration})),(()=>this._updateSlice()),y)])}destroy(){this.destroyed||(Ne(this),this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this._exitBasemapTerrain(),this.stage?.destroy(),this.slice.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof A?this.spatialReference&&(t=Ke(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ie.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:Ke(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||G.WGS84,i=Ke(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||G.WGS84;let t;const i=i=>{const r=Ke(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new A({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}const s=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach((e=>s(e))),null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const n=this._get("_groundAndLayersExtent");return t.equals(n)?n:t}castEnvironment(e){return e?e instanceof pe?e:e instanceof $e?this.environment?.cloneWithWebsceneEnvironment(e)??pe.fromWebsceneEnvironment(e):C(pe,e):new pe}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&Z in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){ve.isValidProfile(e)&&(ve.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||ve.getDefaultProfile()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?z(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?L.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroying||this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ae(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return re(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?re(this.defaultsFromMap.viewingMode):ke(t,ie.Global)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find((({name:e})=>e===Pe))??new Ue}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===Pe)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Ce(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=qe(e)?ze(this,e):e;return be(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?_e(this.elevationProvider,e):null)??0;return P(e,Xe,this.renderSpatialReference,t),this.state.camera.projectToScreen(Xe,et),b(et[0],et[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;P(e,Xe,i);const r=this.state.camera.computeScreenPixelSizeAt(Xe);return t&&i!==t?r*M(i)/M(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=qe(e)?ze(this,e):e;return Me(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Se(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!De())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this.stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ne.importLayerView(e)}hasLayerViewModule(e){return ne.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Qe(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?se(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ie.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ie.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ke(e,i)&&(null==t||(!!k(t)||(!B(t)||null!=Le(t,e,i))&&(!N(t)||i!==ie.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(k(t)&&(r||s)){return!s||i===ie.Local||null===He(t.tileInfo,t.fullExtent,e,ie.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:G.WebMercator,viewingMode:i}]:[{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}return B(t)||N(t)||!r&&!s?B(t)&&r&&i!==ie.Global?[{spatialReference:e,viewingMode:i},{spatialReference:G.WGS84,viewingMode:ie.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${re(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&We(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter((e=>"media-3d"!==e.type)).find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await f((()=>this.graphicsView)),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer):null}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await it[e]();return t&&(u(i.signal),await t(i.signal)),u(i.signal),this._importControllers.delete(e),r}catch{this._importControllers.delete(e)}return null}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new Ee({view:this})),this._set("elevationProvider",new fe({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){const e=this.basemapTerrain,t=this.elevationProvider;e&&(this._set("basemapTerrain",null),this._set("elevationProvider",null),t.unregister(e),t.destroy(),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new xe({view:this})),this._set("featureTiles",new ce({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?I(W(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>we.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&we.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||we.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),w),this.updatingHandles.add((()=>this.clippingArea),e,w),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,w)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.featureTiles&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this._set("featureTiles",p(this.featureTiles)),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=q(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",je.create(this.state.viewingMode,i)),t||this.addHandles(g((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!F(e,this.basemapTerrain.spatialReference,tt,t)||(this.renderCoordsHelper.extent=tt)}),y),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Ge/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===d.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(g((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),y),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new ye(this.state.viewingMode,(e=>this.stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Ie({view:this,options:e,container:i}),this._updateSlice(),this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this.stage.renderer.setParameters({highQualityTransparency:e})),m),this.on("pointer-move",(()=>this.stage?.renderer.resetAnimation())),a(this.stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Ge/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Oe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this._importModule("GraphicsView3D",(e=>f((()=>this.basemapTerrain?.ready),e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=p(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this._importModule("FocusAreasView"))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){const e=se(this.viewingMode);e===ie.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(c((()=>this.graphics),"after-changes",(()=>this._ensureGraphicsView())),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(g((()=>this.map?.focusAreas?.areas.length??0),(e=>this._ensureFocusAreasView(e)),{initial:!0}),"FocusAreasView");const t=this.scene?.initialViewProperties??null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?T(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,t?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(Fe);for(const t of this.allLayerViews)Q(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(Fe);for(const t of this.allLayerViews)Q(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}};function Ke(e,t){return null!=e&&D(e.spatialReference,t)?I(e,t):null}e([V()],Je.prototype,"_userClippingArea",void 0),e([V()],Je.prototype,"_resourceController",void 0),e([V()],Je.prototype,"_stage",void 0),e([V({readOnly:!0})],Je.prototype,"deconflictor",void 0),e([V({readOnly:!0})],Je.prototype,"labeler",void 0),e([V(E(Y,"analyses"))],Je.prototype,"analyses",void 0),e([V({type:te,readOnly:!0})],Je.prototype,"animation",null),e([V({readOnly:!0})],Je.prototype,"basemapTerrain",void 0),e([V({readOnly:!0})],Je.prototype,"elevationProvider",void 0),e([V()],Je.prototype,"camera",null),e([V({type:t})],Je.prototype,"contentCamera",null),e([V({readOnly:!0})],Je.prototype,"canvas",void 0),e([V({type:H})],Je.prototype,"center",null),e([V({type:A})],Je.prototype,"clippingArea",null),e([V({type:oe})],Je.prototype,"constraints",void 0),e([V({type:A,readOnly:!0})],Je.prototype,"renderDataExtent",null),e([V({readOnly:!0})],Je.prototype,"tileInfo",null),e([V({type:A,readOnly:!0})],Je.prototype,"dataExtent",null),e([V({type:A,readOnly:!0})],Je.prototype,"_groundAndLayersExtent",null),e([V({type:pe})],Je.prototype,"environment",void 0),e([j("environment")],Je.prototype,"castEnvironment",null),e([V({readOnly:!0})],Je.prototype,"environmentManager",void 0),e([V({type:A})],Je.prototype,"extent",null),e([V({type:r})],Je.prototype,"floors",void 0),e([V()],Je.prototype,"screenCenter",null),e([V()],Je.prototype,"frustum",null),e([V({type:Number,readOnly:!0})],Je.prototype,"fullOpacity",void 0),e([V({readOnly:!0})],Je.prototype,"graphicsView",void 0),e([V({readOnly:!0})],Je.prototype,"analysisViewManager",void 0),e([V()],Je.prototype,"groundView",void 0),e([V({type:Boolean})],Je.prototype,"initialExtentRequired",null),e([V()],Je.prototype,"defaultsFromMapSettings",null),e([V()],Je.prototype,"interacting",null),e([V()],Je.prototype,"stationary",null),e([V()],Je.prototype,"navigating",null),e([V()],Je.prototype,"map",void 0),e([V()],Je.prototype,"padding",null),e([V({type:xe,readOnly:!0})],Je.prototype,"pointsOfInterest",void 0),e([V({type:ce,readOnly:!0})],Je.prototype,"featureTiles",void 0),e([V()],Je.prototype,"_featureTreeDebugger",void 0),e([V({type:Boolean})],Je.prototype,"screenSizePerspectiveEnabled",void 0),e([V({constructOnly:!0})],Je.prototype,"deactivatedWebGLExtensions",void 0),e([V({constructOnly:!0})],Je.prototype,"debugWebGLExtensions",void 0),e([V({constructOnly:!0})],Je.prototype,"renderCanvas",void 0),e([V({constructOnly:!0})],Je.prototype,"state",void 0),e([V({readOnly:!0})],Je.prototype,"inputManager",void 0),e([V({readOnly:!0})],Je.prototype,"stateManager",void 0),e([V({type:["low","medium","high"]})],Je.prototype,"qualityProfile",null),e([V({type:Ve,get(){let e=this._get("qualitySettings");return e||(e=new Ve,ve.apply(this.qualityProfile,e)),e}})],Je.prototype,"qualitySettings",void 0),e([V()],Je.prototype,"slice",void 0),e([V({readOnly:!0})],Je.prototype,"typeSpecificPreconditionsReady",null),e([V({readOnly:!0})],Je.prototype,"renderCoordsHelper",void 0),e([V({readOnly:!0})],Je.prototype,"sceneIntersectionHelper",void 0),e([V({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Je.prototype,"resolution",null),e([V({type:Number})],Je.prototype,"scale",null),e([V()],Je.prototype,"heightModelInfo",null),e([V()],Je.prototype,"spatialReference",void 0),e([V({type:Boolean,constructOnly:!0})],Je.prototype,"alphaCompositingEnabled",void 0),e([V({constructOnly:!0})],Je.prototype,"preserveDrawingBufferEnabled",void 0),e([V({type:Boolean})],Je.prototype,"supersampleScreenshotsEnabled",void 0),e([V({readOnly:!0})],Je.prototype,"type",void 0),e([V(),j((e=>e instanceof Ye?e:O(Ze,e)))],Je.prototype,"ui",void 0),e([V({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Je.prototype,"updating",null),e([V()],Je.prototype,"_updatingObjects",null),e([V()],Je.prototype,"_updatingObjectsWithProgress",null),e([V({type:Number,readOnly:!0,dependsOn:["updating"]})],Je.prototype,"updatingProgress",void 0),e([V({type:["global","local"]})],Je.prototype,"viewingMode",null),e([V({type:i})],Je.prototype,"viewpoint",null),e([V({readOnly:!0})],Je.prototype,"visibleArea",null),e([V({type:Number})],Je.prototype,"zoom",null),e([V({type:Ue})],Je.prototype,"highlightOptions",null),e([V({readOnly:!0})],Je.prototype,"quality",null),e([V({readOnly:!0})],Je.prototype,"resolutionScale",null),e([V()],Je.prototype,"focusAreasView",void 0),e([V()],Je.prototype,"_defaultToMapOptions",null),e([V()],Je.prototype,"_defaultHitTestOptions",null),Je=e([R("esri.views.SceneView")],Je);const Xe=x(),et=_(),tt=U(),it={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js")},rt=Je;export{rt as default};
package/views/View2D.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import u from"../geometry/Polygon.js";import{isLoadedOrLoadFor as m}from"../geometry/projection.js";import y from"../layers/support/TileInfo.js";import{BreakpointsOwner as f}from"./BreakpointsOwner.js";import{DOMContainer as w}from"./DOMContainer.js";import{PopupView as V}from"./PopupView.js";import M from"./View.js";import{Viewport2DMixin as b}from"./Viewport2DMixin.js";import v from"./2d/AnimationManager.js";import{layerView2DImporter as _}from"./2d/layerViewModuleImportUtils.js";import j from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as S}from"./2d/viewpointUtils.js";import L from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as R}from"./2d/layers/support/util.js";import{clipContainsPoint as O}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as T,setDefaultHighlightOptions as k}from"./2d/support/highlightOptionsUtils.js";import{hitTest as C}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as x,takeScreenshot as D}from"./2d/support/screenshotUtils.js";import{Timeline as E}from"./2d/support/Timeline.js";import P from"./navigation/Navigation.js";import G from"./navigation/NavigationActionMap.js";import U from"./support/HighlightOptions.js";import{isSupportedScreenPointEvent as q,createScreenPointFromSupportedEvent as z}from"./support/screenUtils.js";import{check as A}from"./support/WebGLRequirements.js";import I from"./ui/DefaultUI.js";import N from"./ui/2d/DefaultUI2D.js";import{isWebMap as W}from"../webmap/utils.js";import $ from"../webmap/background/ColorBackground.js";let F,H,B,Z,J,K,Q;async function X(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);H=e,B=t,Z=i,J=r,K=s,Q=a,F=n}let Y=class extends(b(f(V(w(M))))){constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new P({actionMap:new G({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.floors=new i,this.grid=null,this.map=null,this.spatialReferenceLocked=!1,this.timeline=new E,this.type="2d",this.view2dType=null,this.ui=new N,this.test={takeScreenshot:async e=>x(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new L(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return m(t.spatialReference,i)}get background(){return W(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get highlightOptions(){return T(this)}set highlightOptions(e){k(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resolution(){return this.stateManager.resolution??0}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating))||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce(((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating})),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get visibleArea(){const e=this.stateManager.visibleArea;return e?new u({rings:[e.map((e=>[e[0],e[1]]))],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return C(this,e,t)}async takeScreenshot(e){return D(this._getScreenshotView(e),e)}toMap(e){if(!this.ready)return null;const t=q(e)?z(this,e):e;return this.stateManager.toMap(t)}toScreen(e,t){return this.stateManager.toScreen(e,t)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return W(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return W(this.map)?this.map.initialViewProperties.timeExtent:null}hasLayerViewModule(e){return _.hasLayerViewModule(e)}importLayerView(e){return _.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter((i=>i.clips.every((i=>O(this,i,e,t))))).reverse(),s=new globalThis.Map(r.map((e=>[e.layer.uid,e]))),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=A(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e){a.getLogger(this).warn("#validate()",e.message);const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const s=document.createElement("a");throw s.innerHTML="https://esriurl.com/systemRequirements",s.target="_blank",s.setAttribute("style","font-size: 18px;"),s.href="https://esriurl.com/systemRequirements",t.appendChild(i),t.appendChild(r),t.appendChild(s),this.surface.appendChild(t),e}}loadAsyncDependencies(){return X()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,d=l?.rotation??0,g=l?.scale||p&&S(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),c=o.center??h,u=o.rotation??d,m=o.scale??g;return c&&m?new t({targetGeometry:c,scale:m,rotation:u}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new F(this.surface,{canvas:this.renderCanvas,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=t,this._magnifierView=new K,this._magnifierView.magnifier=this.magnifier,this._gridView=new Q;const i=new Z({view:this});this._set("labelManager",i);const r=new v({view:this});this._set("animationManager",r);const s=new J({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("webgl-error",(e=>this.fatalError=e.error)),o((()=>this.stationary),(e=>t.stationary=e),l),o((()=>this.background),(e=>{t.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),l),o((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),l),o((()=>this.grid),(e=>this._gridView.grid=e),l),o((()=>this.renderingOptions),(e=>t.renderingOptions=e),l),o((()=>this.highlights.items.map((e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})))),(()=>{t.highlightGradient=R(t.highlightGradient,this.highlights.items)}),l),o((()=>this.state.id),(()=>t.state=this.state),l)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this.stage.addChild(e.container)}));const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new j(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new H({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new B(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],Y.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],Y.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],Y.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],Y.prototype,"graphicsTileStore",null),e([h()],Y.prototype,"graphicsView",void 0),e([h()],Y.prototype,"constraintsInfo",null),e([h()],Y.prototype,"initialExtentRequired",null),e([h()],Y.prototype,"labelManager",void 0),e([h({type:P,nonNullable:!0})],Y.prototype,"navigation",void 0),e([h({constructOnly:!0})],Y.prototype,"renderCanvas",void 0),e([h()],Y.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],Y.prototype,"supersampleScreenshotsEnabled",void 0),e([h({readOnly:!0})],Y.prototype,"supportsGround",void 0),e([h()],Y.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],Y.prototype,"typeSpecificPreconditionsReady",null),e([h({type:$})],Y.prototype,"background",null),e([h()],Y.prototype,"center",null),e([h({type:i})],Y.prototype,"floors",void 0),e([h()],Y.prototype,"grid",void 0),e([h({type:U})],Y.prototype,"highlightOptions",null),e([h()],Y.prototype,"map",void 0),e([h()],Y.prototype,"padding",null),e([h({readOnly:!0})],Y.prototype,"rendering",null),e([h({readOnly:!0})],Y.prototype,"resolution",null),e([h()],Y.prototype,"scale",null),e([h({constructOnly:!0})],Y.prototype,"spatialReferenceLocked",void 0),e([h({readOnly:!0})],Y.prototype,"tileInfo",null),e([h({type:E,readOnly:!0})],Y.prototype,"timeline",void 0),e([h({readOnly:!0})],Y.prototype,"type",void 0),e([h({readOnly:!0})],Y.prototype,"updating",null),e([h({readOnly:!0})],Y.prototype,"view2dType",void 0),e([h({readOnly:!0})],Y.prototype,"visibleArea",null),e([h()],Y.prototype,"zoom",null),e([h({readOnly:!0})],Y.prototype,"navigating",null),e([h(),d((e=>e instanceof I?e:c(N,e)))],Y.prototype,"ui",void 0),Y=e([g("esri.views.View2D")],Y);const ee=Y;export{ee as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import u from"../geometry/Polygon.js";import{isLoadedOrLoadFor as m}from"../geometry/projectionUtils.js";import y from"../layers/support/TileInfo.js";import{BreakpointsOwner as f}from"./BreakpointsOwner.js";import{DOMContainer as w}from"./DOMContainer.js";import{PopupView as V}from"./PopupView.js";import M from"./View.js";import{Viewport2DMixin as b}from"./Viewport2DMixin.js";import v from"./2d/AnimationManager.js";import{layerView2DImporter as _}from"./2d/layerViewModuleImportUtils.js";import j from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as S}from"./2d/viewpointUtils.js";import L from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as R}from"./2d/layers/support/util.js";import{clipContainsPoint as O}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as T,setDefaultHighlightOptions as k}from"./2d/support/highlightOptionsUtils.js";import{hitTest as C}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as x,takeScreenshot as D}from"./2d/support/screenshotUtils.js";import{Timeline as E}from"./2d/support/Timeline.js";import P from"./navigation/Navigation.js";import G from"./navigation/NavigationActionMap.js";import U from"./support/HighlightOptions.js";import{isSupportedScreenPointEvent as q,createScreenPointFromSupportedEvent as z}from"./support/screenUtils.js";import{check as A}from"./support/WebGLRequirements.js";import I from"./ui/DefaultUI.js";import N from"./ui/2d/DefaultUI2D.js";import{isWebMap as W}from"../webmap/utils.js";import $ from"../webmap/background/ColorBackground.js";let F,H,B,Z,J,K,Q;async function X(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);H=e,B=t,Z=i,J=r,K=s,Q=a,F=n}let Y=class extends(b(f(V(w(M))))){constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new P({actionMap:new G({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.floors=new i,this.grid=null,this.map=null,this.spatialReferenceLocked=!1,this.timeline=new E,this.type="2d",this.view2dType=null,this.ui=new N,this.test={takeScreenshot:async e=>x(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new L(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return m(t.spatialReference,i)}get background(){return W(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get highlightOptions(){return T(this)}set highlightOptions(e){k(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resolution(){return this.stateManager.resolution??0}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating))||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce(((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating})),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get visibleArea(){const e=this.stateManager.visibleArea;return e?new u({rings:[e.map((e=>[e[0],e[1]]))],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return C(this,e,t)}async takeScreenshot(e){return D(this._getScreenshotView(e),e)}toMap(e){if(!this.ready)return null;const t=q(e)?z(this,e):e;return this.stateManager.toMap(t)}toScreen(e,t){return this.stateManager.toScreen(e,t)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return W(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return W(this.map)?this.map.initialViewProperties.timeExtent:null}hasLayerViewModule(e){return _.hasLayerViewModule(e)}importLayerView(e){return _.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter((i=>i.clips.every((i=>O(this,i,e,t))))).reverse(),s=new globalThis.Map(r.map((e=>[e.layer.uid,e]))),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=A(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e){a.getLogger(this).warn("#validate()",e.message);const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const s=document.createElement("a");throw s.innerHTML="https://esriurl.com/systemRequirements",s.target="_blank",s.setAttribute("style","font-size: 18px;"),s.href="https://esriurl.com/systemRequirements",t.appendChild(i),t.appendChild(r),t.appendChild(s),this.surface.appendChild(t),e}}loadAsyncDependencies(){return X()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,d=l?.rotation??0,g=l?.scale||p&&S(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),c=o.center??h,u=o.rotation??d,m=o.scale??g;return c&&m?new t({targetGeometry:c,scale:m,rotation:u}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new F(this.surface,{canvas:this.renderCanvas,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=t,this._magnifierView=new K,this._magnifierView.magnifier=this.magnifier,this._gridView=new Q;const i=new Z({view:this});this._set("labelManager",i);const r=new v({view:this});this._set("animationManager",r);const s=new J({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("webgl-error",(e=>this.fatalError=e.error)),o((()=>this.stationary),(e=>t.stationary=e),l),o((()=>this.background),(e=>{t.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),l),o((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),l),o((()=>this.grid),(e=>this._gridView.grid=e),l),o((()=>this.renderingOptions),(e=>t.renderingOptions=e),l),o((()=>this.highlights.items.map((e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})))),(()=>{t.highlightGradient=R(t.highlightGradient,this.highlights.items)}),l),o((()=>this.state.id),(()=>t.state=this.state),l)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this.stage.addChild(e.container)}));const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new j(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new H({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new B(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],Y.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],Y.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],Y.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],Y.prototype,"graphicsTileStore",null),e([h()],Y.prototype,"graphicsView",void 0),e([h()],Y.prototype,"constraintsInfo",null),e([h()],Y.prototype,"initialExtentRequired",null),e([h()],Y.prototype,"labelManager",void 0),e([h({type:P,nonNullable:!0})],Y.prototype,"navigation",void 0),e([h({constructOnly:!0})],Y.prototype,"renderCanvas",void 0),e([h()],Y.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],Y.prototype,"supersampleScreenshotsEnabled",void 0),e([h({readOnly:!0})],Y.prototype,"supportsGround",void 0),e([h()],Y.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],Y.prototype,"typeSpecificPreconditionsReady",null),e([h({type:$})],Y.prototype,"background",null),e([h()],Y.prototype,"center",null),e([h({type:i})],Y.prototype,"floors",void 0),e([h()],Y.prototype,"grid",void 0),e([h({type:U})],Y.prototype,"highlightOptions",null),e([h()],Y.prototype,"map",void 0),e([h()],Y.prototype,"padding",null),e([h({readOnly:!0})],Y.prototype,"rendering",null),e([h({readOnly:!0})],Y.prototype,"resolution",null),e([h()],Y.prototype,"scale",null),e([h({constructOnly:!0})],Y.prototype,"spatialReferenceLocked",void 0),e([h({readOnly:!0})],Y.prototype,"tileInfo",null),e([h({type:E,readOnly:!0})],Y.prototype,"timeline",void 0),e([h({readOnly:!0})],Y.prototype,"type",void 0),e([h({readOnly:!0})],Y.prototype,"updating",null),e([h({readOnly:!0})],Y.prototype,"view2dType",void 0),e([h({readOnly:!0})],Y.prototype,"visibleArea",null),e([h()],Y.prototype,"zoom",null),e([h({readOnly:!0})],Y.prototype,"navigating",null),e([h(),d((e=>e instanceof I?e:c(N,e)))],Y.prototype,"ui",void 0),Y=e([g("esri.views.View2D")],Y);const ee=Y;export{ee as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import o from"../../core/Evented.js";import{watch as i,sync as s}from"../../core/reactiveUtils.js";import{screenPointObjectToArray as r,pt2px as l,createScreenPointArray as n}from"../../core/screenUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as h}from"../../core/libs/gl-matrix-2/math/vec2.js";import{j as p}from"../../chunks/vec32.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u,project as y}from"../../geometry/projection.js";import{projectPointToVector as g}from"../../geometry/projection/projectPointToVector.js";import{getGraphicEffectiveElevationMode as b}from"../../support/elevationInfoUtils.js";import{getDefaultSymbol2D as d}from"../../symbols/support/defaults.js";import f from"../../symbols/support/ElevationInfo.js";import{getSymbolInfo as _}from"./support/utils.js";import{intersectsDrapedGeometry as v}from"../support/drapedUtils.js";let S=class extends e{set graphic(t){this._circleCollisionCache=null,this._originalSymbol=t.symbol,this._set("graphic",t),this.attachSymbolChanged()}get elevationInfo(){const{layer:t}=this.graphic,e=t&&"elevationInfo"in t?t.elevationInfo:null,o=b(this.graphic),i=e?e.offset:0;return new f({mode:o,offset:i})}set focusedSymbol(t){t!==this._get("focusedSymbol")&&(this._set("focusedSymbol",t),this._updateGraphicSymbol(),this._circleCollisionCache=null)}grabbableForEvent(){return!0}set grabbing(t){t!==this._get("grabbing")&&(this._set("grabbing",t),this._updateGraphicSymbol())}set hovering(t){t!==this._get("hovering")&&(this._set("hovering",t),this._updateGraphicSymbol())}set selected(t){t!==this._get("selected")&&(this._set("selected",t),this._updateGraphicSymbol(),this.events.emit("select-changed",{action:t?"select":"deselect"}))}get _focused(){return this._get("hovering")||this._get("grabbing")}constructor(t){super(t),this.layer=null,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.dragging=!1,this.cursor=null,this.consumesClicks=!0,this.events=new o.EventEmitter,this._circleCollisionCache=null,this._graphicSymbolChangedHandle=null,this._originalSymbol=null}destroy(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this._set("view",null)}intersectionDistance(t){const e=this.graphic;if(!1===e.visible)return null;const o=e.geometry;if(null==o)return null;const i=this._get("focusedSymbol"),s=null!=i?i:e.symbol;return"2d"===this.view.type?this._intersectDistance2D(this.view,t,o,s):this._intersectDistance3D(this.view,t,e)}attach(){this.attachSymbolChanged(),null!=this.layer&&this.layer.add(this.graphic)}detach(){this.detachSymbolChanged(),this._resetGraphicSymbol(),null!=this.layer&&this.layer.remove(this.graphic)}attachSymbolChanged(){this.detachSymbolChanged(),this._graphicSymbolChangedHandle=i((()=>this.graphic?.symbol),(t=>{null!=t&&t!==this.focusedSymbol&&t!==this._originalSymbol&&(this._originalSymbol=t,this._focused&&null!=this.focusedSymbol&&(this.graphic.symbol=this.focusedSymbol))}),s)}detachSymbolChanged(){null!=this._graphicSymbolChangedHandle&&(this._graphicSymbolChangedHandle.remove(),this._graphicSymbolChangedHandle=null)}onElevationChange(){}onViewChange(){}_updateGraphicSymbol(){this.graphic.symbol=this._focused&&null!=this.focusedSymbol?this.focusedSymbol:this._originalSymbol}_resetGraphicSymbol(){this.graphic.symbol=this._originalSymbol}_intersectDistance2D(t,e,o,i){if(null==(i=i||d(o)))return null;const s=1;let n=this._circleCollisionCache;if("point"===o.type&&"cim"===i.type&&"CIMPointSymbol"===i.data.symbol?.type&&i.data.symbol.symbolLayers){const{offsetX:l,offsetY:n,size:a}=_(i),c=r(e,j),p=a/2,m=t.toScreen(o),u=m.x+l,y=m.y+n;return h(c,[u,y])<p*p?s:null}if("point"!==o.type||"simple-marker"!==i.type)return v(e,o,t)?s:null;if(null==n||!n.originalPoint.equals(o)){const e=o,s=t.spatialReference;if(u(e.spatialReference,s)){const t=y(e,s);n={originalPoint:e.clone(),mapPoint:t,radiusPx:l(i.size)},this._circleCollisionCache=n}}if(null!=n){const o=r(e,j),a=t.toScreen?.(n.mapPoint);if(!a)return null;const c=n.radiusPx,p=a.x+l(i.xoffset),m=a.y-l(i.yoffset);return h(o,[p,m])<c*c?s:null}return null}_intersectDistance3D(t,e,o){const i=t.toMap(e,{include:[o]});return i&&g(i,C,t.renderSpatialReference)?p(C,t.state.camera.eye):null}};t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"graphic",null),t([a()],S.prototype,"elevationInfo",null),t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"view",void 0),t([a({value:null})],S.prototype,"focusedSymbol",null),t([a({constructOnly:!0})],S.prototype,"layer",void 0),t([a()],S.prototype,"interactive",void 0),t([a()],S.prototype,"selectable",void 0),t([a()],S.prototype,"grabbable",void 0),t([a({value:!1})],S.prototype,"grabbing",null),t([a()],S.prototype,"dragging",void 0),t([a()],S.prototype,"hovering",null),t([a({value:!1})],S.prototype,"selected",null),t([a()],S.prototype,"cursor",void 0),S=t([c("esri.views.interactive.GraphicManipulator")],S);const C=m(),j=n();export{S as GraphicManipulator};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import o from"../../core/Evented.js";import{watch as i,sync as s}from"../../core/reactiveUtils.js";import{screenPointObjectToArray as r,pt2px as l,createScreenPointArray as n}from"../../core/screenUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as h}from"../../core/libs/gl-matrix-2/math/vec2.js";import{j as p}from"../../chunks/vec32.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u,project as y}from"../../geometry/projectionUtils.js";import{projectPointToVector as g}from"../../geometry/projection/projectPointToVector.js";import{getGraphicEffectiveElevationMode as b}from"../../support/elevationInfoUtils.js";import{getDefaultSymbol2D as d}from"../../symbols/support/defaults.js";import f from"../../symbols/support/ElevationInfo.js";import{getSymbolInfo as _}from"./support/utils.js";import{intersectsDrapedGeometry as v}from"../support/drapedUtils.js";let S=class extends e{set graphic(t){this._circleCollisionCache=null,this._originalSymbol=t.symbol,this._set("graphic",t),this.attachSymbolChanged()}get elevationInfo(){const{layer:t}=this.graphic,e=t&&"elevationInfo"in t?t.elevationInfo:null,o=b(this.graphic),i=e?e.offset:0;return new f({mode:o,offset:i})}set focusedSymbol(t){t!==this._get("focusedSymbol")&&(this._set("focusedSymbol",t),this._updateGraphicSymbol(),this._circleCollisionCache=null)}grabbableForEvent(){return!0}set grabbing(t){t!==this._get("grabbing")&&(this._set("grabbing",t),this._updateGraphicSymbol())}set hovering(t){t!==this._get("hovering")&&(this._set("hovering",t),this._updateGraphicSymbol())}set selected(t){t!==this._get("selected")&&(this._set("selected",t),this._updateGraphicSymbol(),this.events.emit("select-changed",{action:t?"select":"deselect"}))}get _focused(){return this._get("hovering")||this._get("grabbing")}constructor(t){super(t),this.layer=null,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.dragging=!1,this.cursor=null,this.consumesClicks=!0,this.events=new o.EventEmitter,this._circleCollisionCache=null,this._graphicSymbolChangedHandle=null,this._originalSymbol=null}destroy(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this._set("view",null)}intersectionDistance(t){const e=this.graphic;if(!1===e.visible)return null;const o=e.geometry;if(null==o)return null;const i=this._get("focusedSymbol"),s=null!=i?i:e.symbol;return"2d"===this.view.type?this._intersectDistance2D(this.view,t,o,s):this._intersectDistance3D(this.view,t,e)}attach(){this.attachSymbolChanged(),null!=this.layer&&this.layer.add(this.graphic)}detach(){this.detachSymbolChanged(),this._resetGraphicSymbol(),null!=this.layer&&this.layer.remove(this.graphic)}attachSymbolChanged(){this.detachSymbolChanged(),this._graphicSymbolChangedHandle=i((()=>this.graphic?.symbol),(t=>{null!=t&&t!==this.focusedSymbol&&t!==this._originalSymbol&&(this._originalSymbol=t,this._focused&&null!=this.focusedSymbol&&(this.graphic.symbol=this.focusedSymbol))}),s)}detachSymbolChanged(){null!=this._graphicSymbolChangedHandle&&(this._graphicSymbolChangedHandle.remove(),this._graphicSymbolChangedHandle=null)}onElevationChange(){}onViewChange(){}_updateGraphicSymbol(){this.graphic.symbol=this._focused&&null!=this.focusedSymbol?this.focusedSymbol:this._originalSymbol}_resetGraphicSymbol(){this.graphic.symbol=this._originalSymbol}_intersectDistance2D(t,e,o,i){if(null==(i=i||d(o)))return null;const s=1;let n=this._circleCollisionCache;if("point"===o.type&&"cim"===i.type&&"CIMPointSymbol"===i.data.symbol?.type&&i.data.symbol.symbolLayers){const{offsetX:l,offsetY:n,size:a}=_(i),c=r(e,j),p=a/2,m=t.toScreen(o),u=m.x+l,y=m.y+n;return h(c,[u,y])<p*p?s:null}if("point"!==o.type||"simple-marker"!==i.type)return v(e,o,t)?s:null;if(null==n||!n.originalPoint.equals(o)){const e=o,s=t.spatialReference;if(u(e.spatialReference,s)){const t=y(e,s);n={originalPoint:e.clone(),mapPoint:t,radiusPx:l(i.size)},this._circleCollisionCache=n}}if(null!=n){const o=r(e,j),a=t.toScreen?.(n.mapPoint);if(!a)return null;const c=n.radiusPx,p=a.x+l(i.xoffset),m=a.y-l(i.yoffset);return h(o,[p,m])<c*c?s:null}return null}_intersectDistance3D(t,e,o){const i=t.toMap(e,{include:[o]});return i&&g(i,C,t.renderSpatialReference)?p(C,t.state.camera.eye):null}};t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"graphic",null),t([a()],S.prototype,"elevationInfo",null),t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"view",void 0),t([a({value:null})],S.prototype,"focusedSymbol",null),t([a({constructOnly:!0})],S.prototype,"layer",void 0),t([a()],S.prototype,"interactive",void 0),t([a()],S.prototype,"selectable",void 0),t([a()],S.prototype,"grabbable",void 0),t([a({value:!1})],S.prototype,"grabbing",null),t([a()],S.prototype,"dragging",void 0),t([a()],S.prototype,"hovering",null),t([a({value:!1})],S.prototype,"selected",null),t([a()],S.prototype,"cursor",void 0),S=t([c("esri.views.interactive.GraphicManipulator")],S);const C=m(),j=n();export{S as GraphicManipulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as a}from"../../geometry/projection.js";import{isMeshWithRelativeVertexSpace as o}from"../../geometry/support/meshVertexSpaceUtils.js";import{clonePoint as l,hydratedSpatialReference as c}from"../../layers/graphics/hydratedFeatures.js";import{getZForElevationMode as s}from"../../support/elevationInfoUtils.js";import{EditGeometryOperations as u}from"./editGeometry/EditGeometryOperations.js";function i(t,n){let e=null,r=null;return a=>{if("cancel"===a.action)return void(null!=r&&(r.execute({action:"cancel"}),e=null,r=null));const o={action:a.action,screenStart:a.start,screenEnd:a.screenPoint};"start"===a.action&&null==e&&(e=new w,r=new w,n(t,e,r,a.pointerType,o)),null!=e&&e.execute(o),"end"===a.action&&null!=e&&(e=null,r=null)}}function p(t,n){return t.events.on("drag",i(t,n))}function m(t,n){const e=[t.x,t.y,t.z??0],r=n,a=[Math.cos(r),Math.sin(r)],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]);if(0===o)return null;a[0]/=o,a[1]/=o;const l=t=>{const n=(t.x-e[0])*a[0]+(t.y-e[1])*a[1];t.x=e[0]+n*a[0],t.y=e[1]+n*a[1]};return t=>(l(t.mapStart),l(t.mapEnd),{...t,axis:a})}function f(t){let n=null;return e=>{if("start"===e.action&&(n=y(t,e.mapStart.spatialReference)),null==n)return null;const r=e.mapEnd.x-e.mapStart.x,a=e.mapEnd.y-e.mapStart.y,o=(e.mapEnd.z??0)-(e.mapStart.z??0);return n.move(r,a,o,e.action),{...e,translationX:r,translationY:a,translationZ:o}}}function d(t,n){return null==t?null:t.spatialReference.equals(n)?t.clone():a(t,n)}function y(t,n){const e=t.operations;if(!e)return null;const r=e.data.geometry,l=c(n);if(r.spatialReference.equals(l))return x(t,e,(()=>{}));if("mesh"!==r.type){const n=d(r,l);if(null==n)return null;const o=r.spatialReference;return x(t,u.fromGeometry(n,e.viewingMode),(()=>{const t=a(r,o);e.trySetGeometry(t)}))}if(o(r)){const n=d(r.origin,l);if(!n)return null;const o=r.spatialReference,c=u.fromGeometry(n,e.viewingMode);return x(t,e,(()=>{const t=a(c.data.geometry,o),n=t.x-r.origin.x,l=t.y-r.origin.y,s=(t.z??0)-(r.origin.z??0);e.move(n,l,s)}))}return null}function x(t,n,e){let r=0,a=0,o=0;return{move:(l,c,s,u)=>{"start"===u&&(r=0,a=0,o=0);const i=l-r,p=c-a,m=s-o;n.move(i,p,m),r+=i,a+=p,o+=m,e(),"end"===u&&t.endInteraction?.()}}}function E(t,n=null,e){let r=null;const o=null==n||t.spatialReference?.equals(n)?t=>t:t=>null!=t?a(t,n):t,l={exclude:[],...e};return n=>{if("start"===n.action&&(r=o(t.toMap(n.screenStart,l))),null==r)return null;const e=o(t.toMap(n.screenEnd,l));return null!=e?{...n,mapStart:r,mapEnd:e}:null}}function S(n){const e=n.map((t=>f(t))).filter(t);return t=>{const n=t.mapEnd.x-t.mapStart.x,r=t.mapEnd.y-t.mapStart.y,a=t.mapEnd.z-t.mapStart.z;return e.forEach((n=>n(t))),{...t,translationX:n,translationY:r,translationZ:a}}}function h(t,e){const r=new Map;for(const a of e)r.set(a,n(t[a]));return n=>(r.forEach(((n,e)=>{t[e]=n})),n)}function g(t){const n=t.operations?.createResetState();return t=>(n?.remove(),t)}function z(t){const n=t.map((t=>g(t))).filter((t=>null!=t));return t=>(n.forEach((n=>n(t))),t)}function v(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z);const a=r.mapEnd.x-t,o=r.mapEnd.y-n,l=r.mapEnd.z-e;return t=r.mapEnd.x,n=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:a,mapDeltaY:o,mapDeltaZ:l,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function j(){let t=0,n=0;return e=>{"start"===e.action&&(t=e.screenStart.x,n=e.screenStart.y);const r=e.screenEnd.x-t,a=e.screenEnd.y-n;return t=e.screenEnd.x,n=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:a}}}function M(t,n){let a=null,o=0,l=0;return c=>{if("start"===c.action&&(a=t.toScreen?.(n),null!=a&&(a.x<0||a.x>t.width||a.y<0||a.y>t.height?a=null:(o=c.screenStart.x-a.x,l=c.screenStart.y-a.y))),null==a)return null;const s=e(c.screenEnd.x-o,0,t.width),u=e(c.screenEnd.y-l,0,t.height),i=r(s,u);return c.screenStart=a,c.screenEnd=i,c}}const R=()=>{};class w{constructor(){this.execute=R}next(t,n=new w){return null!=t&&(this.execute=e=>{const r=t(e);null!=r&&n.execute(r)}),n}}function D(t,n,e=[]){if("2d"===t.type)return t=>t;let r=null;return a=>{"start"===a.action&&(r=t.toMap(a.screenStart,{exclude:e}),null!=r&&(r.z=s(r,t,n)));const o=t.toMap(a.screenEnd,{exclude:e});null!=o&&(o.z=s(o,t,n));const l=null!=r&&null!=o?{sceneStart:r,sceneEnd:o}:null;return{...a,scenePoints:l}}}function G(t,n,e){const r=n.elevationProvider.getElevation(t.x,t.y,t.z??0,t.spatialReference,"scene")??0,a=l(t);return a.z=r,a.hasZ=!0,a.z=s(a,n,e),a}function U(t,n){if("2d"===t.type)return t=>t;let e=null;return r=>{"start"===r.action&&(e=G(r.mapStart,t,n));const a=G(r.mapEnd,t,n),o=null!=e&&null!=a?{sceneStart:e,sceneEnd:a}:null;return{...r,scenePoints:o}}}export{w as EventPipeline,v as addMapDelta,j as addScreenDelta,m as constrainToMapAxis,i as createDragEventPipelineCallback,p as createManipulatorDragEventPipeline,M as dragAtLocation,f as dragManipulatedObject,S as dragManipulatedObjectMany,g as resetManipulatedObject,z as resetManipulatedObjectMany,h as resetProperties,D as sceneSnappingAtLocation,U as sceneSnappingAtProjectedLocation,E as screenToMap};
5
+ import{isSome as t}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as a}from"../../geometry/projectionUtils.js";import{isMeshWithRelativeVertexSpace as o}from"../../geometry/support/meshVertexSpaceUtils.js";import{clonePoint as l,hydratedSpatialReference as c}from"../../layers/graphics/hydratedFeatures.js";import{getZForElevationMode as s}from"../../support/elevationInfoUtils.js";import{EditGeometryOperations as u}from"./editGeometry/EditGeometryOperations.js";function i(t,n){let e=null,r=null;return a=>{if("cancel"===a.action)return void(null!=r&&(r.execute({action:"cancel"}),e=null,r=null));const o={action:a.action,screenStart:a.start,screenEnd:a.screenPoint};"start"===a.action&&null==e&&(e=new w,r=new w,n(t,e,r,a.pointerType,o)),null!=e&&e.execute(o),"end"===a.action&&null!=e&&(e=null,r=null)}}function p(t,n){return t.events.on("drag",i(t,n))}function m(t,n){const e=[t.x,t.y,t.z??0],r=n,a=[Math.cos(r),Math.sin(r)],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]);if(0===o)return null;a[0]/=o,a[1]/=o;const l=t=>{const n=(t.x-e[0])*a[0]+(t.y-e[1])*a[1];t.x=e[0]+n*a[0],t.y=e[1]+n*a[1]};return t=>(l(t.mapStart),l(t.mapEnd),{...t,axis:a})}function f(t){let n=null;return e=>{if("start"===e.action&&(n=y(t,e.mapStart.spatialReference)),null==n)return null;const r=e.mapEnd.x-e.mapStart.x,a=e.mapEnd.y-e.mapStart.y,o=(e.mapEnd.z??0)-(e.mapStart.z??0);return n.move(r,a,o,e.action),{...e,translationX:r,translationY:a,translationZ:o}}}function d(t,n){return null==t?null:t.spatialReference.equals(n)?t.clone():a(t,n)}function y(t,n){const e=t.operations;if(!e)return null;const r=e.data.geometry,l=c(n);if(r.spatialReference.equals(l))return x(t,e,(()=>{}));if("mesh"!==r.type){const n=d(r,l);if(null==n)return null;const o=r.spatialReference;return x(t,u.fromGeometry(n,e.viewingMode),(()=>{const t=a(r,o);e.trySetGeometry(t)}))}if(o(r)){const n=d(r.origin,l);if(!n)return null;const o=r.spatialReference,c=u.fromGeometry(n,e.viewingMode);return x(t,e,(()=>{const t=a(c.data.geometry,o),n=t.x-r.origin.x,l=t.y-r.origin.y,s=(t.z??0)-(r.origin.z??0);e.move(n,l,s)}))}return null}function x(t,n,e){let r=0,a=0,o=0;return{move:(l,c,s,u)=>{"start"===u&&(r=0,a=0,o=0);const i=l-r,p=c-a,m=s-o;n.move(i,p,m),r+=i,a+=p,o+=m,e(),"end"===u&&t.endInteraction?.()}}}function E(t,n=null,e){let r=null;const o=null==n||t.spatialReference?.equals(n)?t=>t:t=>null!=t?a(t,n):t,l={exclude:[],...e};return n=>{if("start"===n.action&&(r=o(t.toMap(n.screenStart,l))),null==r)return null;const e=o(t.toMap(n.screenEnd,l));return null!=e?{...n,mapStart:r,mapEnd:e}:null}}function S(n){const e=n.map((t=>f(t))).filter(t);return t=>{const n=t.mapEnd.x-t.mapStart.x,r=t.mapEnd.y-t.mapStart.y,a=t.mapEnd.z-t.mapStart.z;return e.forEach((n=>n(t))),{...t,translationX:n,translationY:r,translationZ:a}}}function h(t,e){const r=new Map;for(const a of e)r.set(a,n(t[a]));return n=>(r.forEach(((n,e)=>{t[e]=n})),n)}function g(t){const n=t.operations?.createResetState();return t=>(n?.remove(),t)}function z(t){const n=t.map((t=>g(t))).filter((t=>null!=t));return t=>(n.forEach((n=>n(t))),t)}function v(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z);const a=r.mapEnd.x-t,o=r.mapEnd.y-n,l=r.mapEnd.z-e;return t=r.mapEnd.x,n=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:a,mapDeltaY:o,mapDeltaZ:l,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function j(){let t=0,n=0;return e=>{"start"===e.action&&(t=e.screenStart.x,n=e.screenStart.y);const r=e.screenEnd.x-t,a=e.screenEnd.y-n;return t=e.screenEnd.x,n=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:a}}}function M(t,n){let a=null,o=0,l=0;return c=>{if("start"===c.action&&(a=t.toScreen?.(n),null!=a&&(a.x<0||a.x>t.width||a.y<0||a.y>t.height?a=null:(o=c.screenStart.x-a.x,l=c.screenStart.y-a.y))),null==a)return null;const s=e(c.screenEnd.x-o,0,t.width),u=e(c.screenEnd.y-l,0,t.height),i=r(s,u);return c.screenStart=a,c.screenEnd=i,c}}const R=()=>{};class w{constructor(){this.execute=R}next(t,n=new w){return null!=t&&(this.execute=e=>{const r=t(e);null!=r&&n.execute(r)}),n}}function D(t,n,e=[]){if("2d"===t.type)return t=>t;let r=null;return a=>{"start"===a.action&&(r=t.toMap(a.screenStart,{exclude:e}),null!=r&&(r.z=s(r,t,n)));const o=t.toMap(a.screenEnd,{exclude:e});null!=o&&(o.z=s(o,t,n));const l=null!=r&&null!=o?{sceneStart:r,sceneEnd:o}:null;return{...a,scenePoints:l}}}function U(t,n,e){const r=n.elevationProvider.getElevation(t.x,t.y,t.z??0,t.spatialReference,"scene")??0,a=l(t);return a.z=r,a.hasZ=!0,a.z=s(a,n,e),a}function G(t,n){if("2d"===t.type)return t=>t;let e=null;return r=>{"start"===r.action&&(e=U(r.mapStart,t,n));const a=U(r.mapEnd,t,n),o=null!=e&&null!=a?{sceneStart:e,sceneEnd:a}:null;return{...r,scenePoints:o}}}export{w as EventPipeline,v as addMapDelta,j as addScreenDelta,m as constrainToMapAxis,i as createDragEventPipelineCallback,p as createManipulatorDragEventPipeline,M as dragAtLocation,f as dragManipulatedObject,S as dragManipulatedObjectMany,g as resetManipulatedObject,z as resetManipulatedObjectMany,h as resetProperties,D as sceneSnappingAtLocation,G as sceneSnappingAtProjectedLocation,E as screenToMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/Logger.js";import{deg2rad as i}from"../../../core/mathUtils.js";import{convertUnit as n}from"../../../core/unitUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{K as a}from"../../../chunks/vec32.js";import{isLoadedOrLoadFor as p,project as l}from"../../../geometry/projection.js";import{getClosestDenormalizedXToReference as c}from"../../../geometry/support/normalizeUtils.js";import{getResolutionForScale as u}from"../../../geometry/support/scaleUtils.js";import{minimumPixelsPerStrideForDisplayWhenScalingOff as d}from"../../2d/grid/constants.js";import{getScaleFactor as g,measureMetersPerUnitAtReferencePoint as f}from"../../2d/grid/gridUtils.js";import{create as h,createWritable as m}from"../sketch/normalizedPoint.js";import{gridPlacementGraphicSymbol as S}from"./snappingUtils.js";import{IntersectionSnappingCandidate as y}from"./candidates/IntersectionSnappingCandidate.js";import{LineSnappingCandidate as v}from"./candidates/LineSnappingCandidate.js";let w=class extends t{constructor(e){super(e),this.options=null}destroy(){this._set("options",null)}get grid(){return this.view.grid}get effectiveViewRotation(){return this.grid?.rotateWithMap?0:i(this.view.rotation??0)}get gridRotation(){return i(this.grid?.rotation??0)}get gridCenter(){const{spatialReference:e,grid:t}=this;if(!t||!e||!p(t.center.spatialReference,e))return null;try{const r=l(t.center,e),i=e.isWrappable&&null!=this.view?.center?c(r.x,this.view.center.x,e):r.x;return h(i,r.y,r.z)}catch(i){return r.getLogger(this).errorOnce("Grid Snapping - Failed to project grid center.",i),null}}get offsetScaleFactor(){const{pixelsPerStride:e,grid:t}=this;if(!t||!e)return 1;const{majorLineInterval:r,dynamicScaling:i}=t;return r<1?null:g(r,e,i)}get spatialReference(){return this.view.spatialReference}get gridMetersPerStride(){const{grid:e}=this;return e?n(e.spacing,e.units,"meters"):null}get viewMetersPerPixel(){const{viewMetersPerSRUnit:e}=this;return null==e?null:e*u(this.view.scale,this.view.spatialReference)}get viewMetersPerSRUnit(){const{spatialReference:e}=this.view;return this.gridCenter?f(this.gridCenter[0],this.gridCenter[1],e):null}get pixelsPerStride(){const{gridMetersPerStride:e,viewMetersPerPixel:t}=this;return t&&e?e/t:null}get updating(){return null!=this.grid&&null!=this.spatialReference&&null==this.viewMetersPerSRUnit}async fetchCandidates(e,t,r){const{options:i,view:n}=this;if(!i?.effectiveGridEnabled||!n.grid||r.feature?.attributes&&S in r.feature.attributes)return[];const o=r.coordinateHelper.arrayToPoint(e),s=i.distance*("touch"===r.pointer?i.touchSensitivityMultiplier:1);return this.fetchCandidatesSync(o,s)}fetchCandidatesSync(e,t){const r=[],{grid:i,effectiveViewRotation:n,gridRotation:o,gridCenter:s,viewMetersPerPixel:a,viewMetersPerSRUnit:c,offsetScaleFactor:u,spatialReference:g,gridMetersPerStride:f,pixelsPerStride:m}=this;if(!(i&&a&&c&&s&&g&&u&&f&&m))return r;if(!i.dynamicScaling&&m<d)return r;if(!p(e.spatialReference,g))return r;const S=l(e,g),w=h(S.x,S.y,S.z),x=P(w,-o,s,-n),C=f/c*u,U=j(x,C,s),{shouldSnapX:b,shouldSnapY:L}=R(U,x,t,a,c);if(!b&&!L)return[];const z=h((b?U:x)[0],(L?U:x)[1]),E=P(z,o,s,n),F=P(U,o,s,n);if(L){const e=M(U,x,C,"y"),t=P(e,o,s,n);r.push(new v({lineStart:F,lineEnd:t,targetPoint:E,isDraped:!1}))}if(b){const e=M(U,x,C,"x"),t=P(e,o,s,n);r.push(new v({lineStart:F,lineEnd:t,targetPoint:E,isDraped:!1}))}return b&&L&&r.push(new y(E,r[0],r[1],!1)),r}};e([o({constructOnly:!0})],w.prototype,"view",void 0),e([o()],w.prototype,"options",void 0),e([o()],w.prototype,"grid",null),e([o()],w.prototype,"effectiveViewRotation",null),e([o()],w.prototype,"gridRotation",null),e([o()],w.prototype,"gridCenter",null),e([o()],w.prototype,"offsetScaleFactor",null),e([o()],w.prototype,"spatialReference",null),e([o()],w.prototype,"gridMetersPerStride",null),e([o()],w.prototype,"viewMetersPerPixel",null),e([o()],w.prototype,"viewMetersPerSRUnit",null),e([o()],w.prototype,"pixelsPerStride",null),e([o()],w.prototype,"updating",null),w=e([s("esri.views.interactive.snapping.GridSnappingEngine")],w);const P=(e,t,r,i)=>{const n=m(e[0],e[1],e[2]);return a(n,a(n,n,r,t),r,i)},j=(e,t,r)=>{const i=(e[0]-r[0])/t,n=(e[1]-r[1])/t,o=Math.trunc(i),s=Math.trunc(n),a=Math.round(i%1),p=Math.round(n%1),l=r[0]+(o+a)*t,c=r[1]+(s+p)*t;return h(l,c)},R=(e,t,r,i,n)=>{if(i<=0)return{shouldSnapX:!1,shouldSnapY:!1};const o=(e[0]-t[0])/i,s=(e[1]-t[1])/i;return{shouldSnapX:Math.abs(o*n)<r,shouldSnapY:Math.abs(s*n)<r}},M=(e,t,r,i)=>{if("y"===i){const i=t[0]>e[0]?1:-1;return h(e[0]+r*i,e[1])}const n=t[1]>e[1]?1:-1;return h(e[0],e[1]+r*n)};export{w as GridSnappingEngine};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import r from"../../../core/Logger.js";import{deg2rad as i}from"../../../core/mathUtils.js";import{convertUnit as n}from"../../../core/unitUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{K as a}from"../../../chunks/vec32.js";import{isLoadedOrLoadFor as p,project as l}from"../../../geometry/projectionUtils.js";import{getClosestDenormalizedXToReference as c}from"../../../geometry/support/normalizeUtils.js";import{getResolutionForScale as u}from"../../../geometry/support/scaleUtils.js";import{minimumPixelsPerStrideForDisplayWhenScalingOff as d}from"../../2d/grid/constants.js";import{getScaleFactor as g,measureMetersPerUnitAtReferencePoint as f}from"../../2d/grid/gridUtils.js";import{create as h,createWritable as m}from"../sketch/normalizedPoint.js";import{gridPlacementGraphicSymbol as S}from"./snappingUtils.js";import{IntersectionSnappingCandidate as y}from"./candidates/IntersectionSnappingCandidate.js";import{LineSnappingCandidate as v}from"./candidates/LineSnappingCandidate.js";let w=class extends e{constructor(t){super(t),this.options=null}destroy(){this._set("options",null)}get grid(){return this.view.grid}get effectiveViewRotation(){return this.grid?.rotateWithMap?0:i(this.view.rotation??0)}get gridRotation(){return i(this.grid?.rotation??0)}get gridCenter(){const{spatialReference:t,grid:e}=this;if(!e||!t||!p(e.center.spatialReference,t))return null;try{const r=l(e.center,t),i=t.isWrappable&&null!=this.view?.center?c(r.x,this.view.center.x,t):r.x;return h(i,r.y,r.z)}catch(i){return r.getLogger(this).errorOnce("Grid Snapping - Failed to project grid center.",i),null}}get offsetScaleFactor(){const{pixelsPerStride:t,grid:e}=this;if(!e||!t)return 1;const{majorLineInterval:r,dynamicScaling:i}=e;return r<1?null:g(r,t,i)}get spatialReference(){return this.view.spatialReference}get gridMetersPerStride(){const{grid:t}=this;return t?n(t.spacing,t.units,"meters"):null}get viewMetersPerPixel(){const{viewMetersPerSRUnit:t}=this;return null==t?null:t*u(this.view.scale,this.view.spatialReference)}get viewMetersPerSRUnit(){const{spatialReference:t}=this.view;return this.gridCenter?f(this.gridCenter[0],this.gridCenter[1],t):null}get pixelsPerStride(){const{gridMetersPerStride:t,viewMetersPerPixel:e}=this;return e&&t?t/e:null}get updating(){return null!=this.grid&&null!=this.spatialReference&&null==this.viewMetersPerSRUnit}async fetchCandidates(t,e,r){const{options:i,view:n}=this;if(!i?.effectiveGridEnabled||!n.grid||r.feature?.attributes&&S in r.feature.attributes)return[];const o=r.coordinateHelper.arrayToPoint(t),s=i.distance*("touch"===r.pointer?i.touchSensitivityMultiplier:1);return this.fetchCandidatesSync(o,s)}fetchCandidatesSync(t,e){const r=[],{grid:i,effectiveViewRotation:n,gridRotation:o,gridCenter:s,viewMetersPerPixel:a,viewMetersPerSRUnit:c,offsetScaleFactor:u,spatialReference:g,gridMetersPerStride:f,pixelsPerStride:m}=this;if(!(i&&a&&c&&s&&g&&u&&f&&m))return r;if(!i.dynamicScaling&&m<d)return r;if(!p(t.spatialReference,g))return r;const S=l(t,g),w=h(S.x,S.y,S.z),x=P(w,-o,s,-n),C=f/c*u,U=j(x,C,s),{shouldSnapX:b,shouldSnapY:L}=R(U,x,e,a,c);if(!b&&!L)return[];const z=h((b?U:x)[0],(L?U:x)[1]),E=P(z,o,s,n),F=P(U,o,s,n);if(L){const t=M(U,x,C,"y"),e=P(t,o,s,n);r.push(new v({lineStart:F,lineEnd:e,targetPoint:E,isDraped:!1}))}if(b){const t=M(U,x,C,"x"),e=P(t,o,s,n);r.push(new v({lineStart:F,lineEnd:e,targetPoint:E,isDraped:!1}))}return b&&L&&r.push(new y(E,r[0],r[1],!1)),r}};t([o({constructOnly:!0})],w.prototype,"view",void 0),t([o()],w.prototype,"options",void 0),t([o()],w.prototype,"grid",null),t([o()],w.prototype,"effectiveViewRotation",null),t([o()],w.prototype,"gridRotation",null),t([o()],w.prototype,"gridCenter",null),t([o()],w.prototype,"offsetScaleFactor",null),t([o()],w.prototype,"spatialReference",null),t([o()],w.prototype,"gridMetersPerStride",null),t([o()],w.prototype,"viewMetersPerPixel",null),t([o()],w.prototype,"viewMetersPerSRUnit",null),t([o()],w.prototype,"pixelsPerStride",null),t([o()],w.prototype,"updating",null),w=t([s("esri.views.interactive.snapping.GridSnappingEngine")],w);const P=(t,e,r,i)=>{const n=m(t[0],t[1],t[2]);return a(n,a(n,n,r,e),r,i)},j=(t,e,r)=>{const i=(t[0]-r[0])/e,n=(t[1]-r[1])/e,o=Math.trunc(i),s=Math.trunc(n),a=Math.round(i%1),p=Math.round(n%1),l=r[0]+(o+a)*e,c=r[1]+(s+p)*e;return h(l,c)},R=(t,e,r,i,n)=>{if(i<=0)return{shouldSnapX:!1,shouldSnapY:!1};const o=(t[0]-e[0])/i,s=(t[1]-e[1])/i;return{shouldSnapX:Math.abs(o*n)<r,shouldSnapY:Math.abs(s*n)<r}},M=(t,e,r,i)=>{if("y"===i){const i=e[0]>t[0]?1:-1;return h(t[0]+r*i,t[1])}const n=e[1]>t[1]?1:-1;return h(t[0],t[1]+r*n)};export{w as GridSnappingEngine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{createTask as n}from"../../../core/asyncUtils.js";import i from"../../../core/Evented.js";import"../../../core/has.js";import{throwIfAborted as s,isAborted as a}from"../../../core/promiseUtils.js";import{watch as r,syncAndInitial as o,sync as p}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{project as h,initializeProjection as l}from"../../../geometry/projection.js";import{absoluteHeightElevationInfo as u}from"../../../support/elevationInfoUtils.js";import{fromPoint as f,markAsTarget as g,toElevationAlignedDehydratedPoint as _}from"../sketch/normalizedPoint.js";import{defaults as S}from"./Settings.js";import{SnappingDomain as m}from"./SnappingDomain.js";import v from"./SnappingOptions.js";import{sortCandidatesInPlace as y,squaredScreenDistance as C}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as w}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as E}from"./candidates/EdgeSnappingCandidate.js";import{IntersectionSnappingCandidate as P}from"./candidates/IntersectionSnappingCandidate.js";import{LineSnappingCandidate as T}from"./candidates/LineSnappingCandidate.js";import{ParallelLineSnappingCandidate as j}from"./candidates/ParallelLineSnappingCandidate.js";import{RightAngleSnappingCandidate as M,SelfSnappingRightAngleType as R}from"./candidates/RightAngleSnappingCandidate.js";import{RightAngleTriangleSnappingCandidate as q}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as A}from"../support/viewUtils.js";import{loadGeodesicLengthMeasurementUtils as I}from"../../support/geodesicLengthMeasurementUtils.js";let x=class extends(i.EventedMixin(t)){constructor(e){super(e),this.options=new v,this._engineCache=new Map,this._loadTask=null,this._engines=[],this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=b.MAIN}initialize(){this.addHandles([r((()=>{const{distance:e,touchSensitivityMultiplier:t,effectiveSelfEnabled:n,effectiveFeatureEnabled:i,effectiveGridEnabled:s}=this.options;return{selfEnabled:n,featureEnabled:i,gridEnabled:"2d"===this.view.type&&s,viewReady:this.view.ready,viewSpatialReference:this.view.spatialReference,distance:e,touchSensitivityMultiplier:t}}),((e,t)=>{t&&(this.doneSnapping(),this.emit("changed")),this._loadTask?.abort(),this._loadTask=n((n=>this._updateEngines(e,t,n)))}),o),r((()=>this.options),(e=>{for(const t of this._engines)t.options=e}),p)])}destroy(){this._loadTask?.abort(),this._destroyEngines()}get updating(){return this._engines.some((e=>e.updating))||!this._loadTask?.finished}_destroyEngines(){this._engineCache.forEach((e=>e.destroy())),this._engineCache.clear(),this._engines=[]}async _updateEngines(e,t,n){if(!e.viewReady)return void this._destroyEngines();t?.viewSpatialReference!==e.viewSpatialReference&&this._destroyEngines();const i=this._engineCache,s=await Promise.allSettled([e.featureEnabled&&!i.has("feature")?this._createFeatureSnappingEngine(n):void 0,e.selfEnabled&&!i.has("self")?this._createSelfSnappingEngine(n):void 0,e.gridEnabled&&!i.has("grid")?this._createGridSnappingEngine(n):void 0]);if(n.aborted)for(const a of s)"fulfilled"===a.status&&a.value?.engine.destroy();else{for(const e of s)"fulfilled"===e.status&&e.value&&i.set(e.value.type,e.value.engine);this._engines=Array.from(i.values())}}async _createSelfSnappingEngine(e){const[{SelfSnappingEngine:t},n]=await Promise.all([import("./SelfSnappingEngine.js"),I()]);return s(e),{type:"self",engine:new t({view:this.view,options:this.options,geodesicLengthMeasurementUtils:n})}}async _createGridSnappingEngine(e){const{view:t}=this;if("2d"!==t.type)return;const{GridSnappingEngine:n}=await import("./GridSnappingEngine.js");return s(e),{type:"grid",engine:new n({view:t,options:this.options})}}async _createFeatureSnappingEngine(e){const{FeatureSnappingEngine:t}=await import("./FeatureSnappingEngine.js");s(e);const{view:n,options:i}=this,{spatialReference:a}=n;return{type:"feature",engine:new t({view:n,options:i,spatialReference:a})}}get _squaredMouseProximityThreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const{distance:e,touchSensitivityMultiplier:t}=this.options,n=e*t;return n*n}snap(e){return k(e)?this._snapMultiPoint(e):this._snapSinglePoint(e)}update(e){const{point:t,context:n}=e;this._removeVisualization();const i=this._currentMainCandidate;if(null==i)return t;const s=this._selectUpdateInput(e);if(null==s)return t;const{spatialReference:a}=n,r=h(s,a);if(null==r)return t;const{view:o}=this,{elevationInfo:p,visualizer:d}=n,c=[],l=f(r,o,p),u=i.constraint.closestTo(l);if(!this._arePointsWithinScreenThreshold(l,u,n)||!N(i,n.drawConstraints))return this._resetSnappingState(),t;i.targetPoint=g(u),c.push(...i.hints);for(const h of this._currentOtherActiveCandidates)N(h,n.drawConstraints)&&(h.targetPoint=g(u),c.push(...h.hints));return null!=d&&this.addHandles(d.draw(c,{spatialReference:a,elevationInfo:H(n),view:o,selfSnappingZ:n.selfSnappingZ}),z),_(u,o,t,n)}doneSnapping(){this._removeVisualization(),this._resetSnappingState()}_selectUpdateInput({point:e,scenePoint:t}){switch(this._currentSnappedType){case b.MAIN:return e;case b.SCENE:return t}}_resetSnappingState(){this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=b.MAIN}_removeVisualization(){this.removeHandles(z)}async _snapSinglePoint({point:e,context:t,signal:n}){const{view:i}=this,{elevationInfo:s}=t,a=f(e,i,s),r=await this._fetchCandidates(a,m.ALL,t,n);return this._createSnapResult(a,b.MAIN,r,i,e,t,n)}async _snapMultiPoint({point:e,scenePoint:t,context:n,signal:i}){const{view:s}=this,{coordinateHelper:a,elevationInfo:r,spatialReference:o}=n;await l(t.spatialReference,o);const p=h(t,o),d=f(p,s,r),c=await this._fetchCandidates(d,m.FEATURE,n,i);if(c.length>0){const e=await this._fetchCandidates(d,m.SELF,n,i);return this._createSnapResult(d,b.SCENE,[...c,...e],s,p,n,i)}const u=f(e,s,r),g=await this._fetchCandidates(u,m.SELF,n,i);return this._createSnapResult(u,b.MAIN,g,s,{z:a.hasZ()&&e.hasZ?e.z??0:void 0,m:a.hasM()&&e.hasM?e.m??0:void 0},n,i)}async _fetchCandidates(e,t,n,i){return(await Promise.all(this._engines.map((s=>s.fetchCandidates(e,t,n,i))))).flat()}_createSnapResult(e,t,n,i,s,r,o){return{get valid(){return!a(o)},apply:()=>{const{spatialReference:a}=r,{snappedPoint:o,hints:p}=this._processCandidates(e,t,n,r);return this._removeVisualization(),null!=r.visualizer&&this.addHandles(r.visualizer.draw(p,{spatialReference:a,elevationInfo:u,view:i,selfSnappingZ:r.selfSnappingZ}),z),_(o,i,s,r)}}}_processCandidates(e,t,n,i){if(n.length<1)return this.doneSnapping(),{snappedPoint:e,hints:[]};this._currentSnappedType!==t&&this._resetSnappingState(),y(e,n);const s=this._currentMainCandidate;if(null!=s){const a=U(s,n);if(a>=0){if(!(n[a]instanceof P))return this._intersectWithOtherCandidates(a,n,e,t,i);if(this._arePointsWithinScreenThreshold(e,s.targetPoint,i))return this._updateSnappingCandidate(s,t,n,i)}}return this._intersectWithOtherCandidates(0,n,e,t,i)}_intersectWithOtherCandidates(e,t,n,i,s){const{coordinateHelper:a}=s,r=t[e],o=[];for(let p=0;p<t.length;++p){if(p===e)continue;const i=t[p],s=r.constraint.intersect(i.constraint);if(s)for(const e of s.closestPoints(r.targetPoint))o.push([new P(g(e),r,i,i.isDraped),this._squaredScreenDistance(n,e,a)])}return o.length>0&&(o.sort(((e,t)=>e[1]-t[1])),o[0][1]<this._squaredPointProximityThreshold(s.pointer))?this._updateSnappingCandidate(o[0][0],i,t,s):N(r,s.drawConstraints)?this._updateSnappingCandidate(r,i,t,s):{snappedPoint:n,hints:[]}}_updateSnappingCandidate(e,t,n,i){this.doneSnapping(),this._currentMainCandidate=e,this._currentSnappedType=t;const s=this._currentMainCandidate.targetPoint,a=[];a.push(...e.hints);for(const r of n){if(e instanceof P){if(r.constraint.equals(e.first.constraint)||r.constraint.equals(e.second.constraint))continue}else if(r.constraint.equals(e.constraint))continue;const t=r.constraint.closestTo(s);this._squaredScreenDistance(t,s,i.coordinateHelper)<L()&&(r.targetPoint=s,this._currentOtherActiveCandidates.push(r),a.push(...r.hints))}return{snappedPoint:s,hints:a}}_squaredPointProximityThreshold(e){return"touch"===e?this._squaredTouchProximityThreshold:this._squaredMouseProximityThreshold}_arePointsWithinScreenThreshold(e,t,n){return this._squaredScreenDistance(e,t,n.coordinateHelper)<this._squaredPointProximityThreshold(n.pointer)}_squaredScreenDistance(e,t,n){return C(this._toScreen(e,n),this._toScreen(t,n))}_toScreen(e,t){return A(e,t.spatialReference,u,this.view)}get test(){}};var b;e([d({constructOnly:!0})],x.prototype,"view",void 0),e([d()],x.prototype,"options",void 0),e([d({readOnly:!0})],x.prototype,"updating",null),e([d()],x.prototype,"_loadTask",void 0),e([d()],x.prototype,"_engines",void 0),e([d()],x.prototype,"_squaredMouseProximityThreshold",null),e([d()],x.prototype,"_squaredTouchProximityThreshold",null),x=e([c("esri.views.interactive.snapping.SnappingManager")],x),function(e){e[e.MAIN=0]="MAIN",e[e.SCENE=1]="SCENE"}(b||(b={}));const z="visualization-handle";function L(){return S.satisfiesConstraintScreenThreshold*S.satisfiesConstraintScreenThreshold}function N(e,t){return!t||null==t.direction&&null==t.distance||!(e instanceof w||e instanceof E||e instanceof T||e instanceof j||e instanceof q)&&(!(e instanceof M)||null==t.direction&&e.selfSnappingType===R.LastVertex)}function U(e,t){return e instanceof P?O(t,e.first)>=0&&O(t,e.second)>=0?0:-1:O(t,e)}function O(e,t){let n=-1;for(let i=0;i<e.length;++i)if(t.constraint.equals(e[i].constraint)){n=i;break}return n}function k(e){return null!=e.scenePoint}function H({coordinateHelper:e,elevationInfo:t}){return e.hasZ()?u:t}export{x as SnappingManager};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{createTask as n}from"../../../core/asyncUtils.js";import i from"../../../core/Evented.js";import"../../../core/has.js";import{throwIfAborted as s,isAborted as a}from"../../../core/promiseUtils.js";import{watch as r,syncAndInitial as o,sync as p}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{project as h,initializeProjection as l}from"../../../geometry/projectionUtils.js";import{absoluteHeightElevationInfo as u}from"../../../support/elevationInfoUtils.js";import{fromPoint as f,markAsTarget as g,toElevationAlignedDehydratedPoint as _}from"../sketch/normalizedPoint.js";import{defaults as S}from"./Settings.js";import{SnappingDomain as m}from"./SnappingDomain.js";import v from"./SnappingOptions.js";import{sortCandidatesInPlace as y,squaredScreenDistance as C}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as w}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as E}from"./candidates/EdgeSnappingCandidate.js";import{IntersectionSnappingCandidate as P}from"./candidates/IntersectionSnappingCandidate.js";import{LineSnappingCandidate as T}from"./candidates/LineSnappingCandidate.js";import{ParallelLineSnappingCandidate as j}from"./candidates/ParallelLineSnappingCandidate.js";import{RightAngleSnappingCandidate as M,SelfSnappingRightAngleType as R}from"./candidates/RightAngleSnappingCandidate.js";import{RightAngleTriangleSnappingCandidate as q}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as A}from"../support/viewUtils.js";import{loadGeodesicLengthMeasurementUtils as I}from"../../support/geodesicLengthMeasurementUtils.js";let x=class extends(i.EventedMixin(t)){constructor(e){super(e),this.options=new v,this._engineCache=new Map,this._loadTask=null,this._engines=[],this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=b.MAIN}initialize(){this.addHandles([r((()=>{const{distance:e,touchSensitivityMultiplier:t,effectiveSelfEnabled:n,effectiveFeatureEnabled:i,effectiveGridEnabled:s}=this.options;return{selfEnabled:n,featureEnabled:i,gridEnabled:"2d"===this.view.type&&s,viewReady:this.view.ready,viewSpatialReference:this.view.spatialReference,distance:e,touchSensitivityMultiplier:t}}),((e,t)=>{t&&(this.doneSnapping(),this.emit("changed")),this._loadTask?.abort(),this._loadTask=n((n=>this._updateEngines(e,t,n)))}),o),r((()=>this.options),(e=>{for(const t of this._engines)t.options=e}),p)])}destroy(){this._loadTask?.abort(),this._destroyEngines()}get updating(){return this._engines.some((e=>e.updating))||!this._loadTask?.finished}_destroyEngines(){this._engineCache.forEach((e=>e.destroy())),this._engineCache.clear(),this._engines=[]}async _updateEngines(e,t,n){if(!e.viewReady)return void this._destroyEngines();t?.viewSpatialReference!==e.viewSpatialReference&&this._destroyEngines();const i=this._engineCache,s=await Promise.allSettled([e.featureEnabled&&!i.has("feature")?this._createFeatureSnappingEngine(n):void 0,e.selfEnabled&&!i.has("self")?this._createSelfSnappingEngine(n):void 0,e.gridEnabled&&!i.has("grid")?this._createGridSnappingEngine(n):void 0]);if(n.aborted)for(const a of s)"fulfilled"===a.status&&a.value?.engine.destroy();else{for(const e of s)"fulfilled"===e.status&&e.value&&i.set(e.value.type,e.value.engine);this._engines=Array.from(i.values())}}async _createSelfSnappingEngine(e){const[{SelfSnappingEngine:t},n]=await Promise.all([import("./SelfSnappingEngine.js"),I()]);return s(e),{type:"self",engine:new t({view:this.view,options:this.options,geodesicLengthMeasurementUtils:n})}}async _createGridSnappingEngine(e){const{view:t}=this;if("2d"!==t.type)return;const{GridSnappingEngine:n}=await import("./GridSnappingEngine.js");return s(e),{type:"grid",engine:new n({view:t,options:this.options})}}async _createFeatureSnappingEngine(e){const{FeatureSnappingEngine:t}=await import("./FeatureSnappingEngine.js");s(e);const{view:n,options:i}=this,{spatialReference:a}=n;return{type:"feature",engine:new t({view:n,options:i,spatialReference:a})}}get _squaredMouseProximityThreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const{distance:e,touchSensitivityMultiplier:t}=this.options,n=e*t;return n*n}snap(e){return k(e)?this._snapMultiPoint(e):this._snapSinglePoint(e)}update(e){const{point:t,context:n}=e;this._removeVisualization();const i=this._currentMainCandidate;if(null==i)return t;const s=this._selectUpdateInput(e);if(null==s)return t;const{spatialReference:a}=n,r=h(s,a);if(null==r)return t;const{view:o}=this,{elevationInfo:p,visualizer:d}=n,c=[],l=f(r,o,p),u=i.constraint.closestTo(l);if(!this._arePointsWithinScreenThreshold(l,u,n)||!L(i,n.drawConstraints))return this._resetSnappingState(),t;i.targetPoint=g(u),c.push(...i.hints);for(const h of this._currentOtherActiveCandidates)L(h,n.drawConstraints)&&(h.targetPoint=g(u),c.push(...h.hints));return null!=d&&this.addHandles(d.draw(c,{spatialReference:a,elevationInfo:H(n),view:o,selfSnappingZ:n.selfSnappingZ}),z),_(u,o,t,n)}doneSnapping(){this._removeVisualization(),this._resetSnappingState()}_selectUpdateInput({point:e,scenePoint:t}){switch(this._currentSnappedType){case b.MAIN:return e;case b.SCENE:return t}}_resetSnappingState(){this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=b.MAIN}_removeVisualization(){this.removeHandles(z)}async _snapSinglePoint({point:e,context:t,signal:n}){const{view:i}=this,{elevationInfo:s}=t,a=f(e,i,s),r=await this._fetchCandidates(a,m.ALL,t,n);return this._createSnapResult(a,b.MAIN,r,i,e,t,n)}async _snapMultiPoint({point:e,scenePoint:t,context:n,signal:i}){const{view:s}=this,{coordinateHelper:a,elevationInfo:r,spatialReference:o}=n;await l(t.spatialReference,o);const p=h(t,o),d=f(p,s,r),c=await this._fetchCandidates(d,m.FEATURE,n,i);if(c.length>0){const e=await this._fetchCandidates(d,m.SELF,n,i);return this._createSnapResult(d,b.SCENE,[...c,...e],s,p,n,i)}const u=f(e,s,r),g=await this._fetchCandidates(u,m.SELF,n,i);return this._createSnapResult(u,b.MAIN,g,s,{z:a.hasZ()&&e.hasZ?e.z??0:void 0,m:a.hasM()&&e.hasM?e.m??0:void 0},n,i)}async _fetchCandidates(e,t,n,i){return(await Promise.all(this._engines.map((s=>s.fetchCandidates(e,t,n,i))))).flat()}_createSnapResult(e,t,n,i,s,r,o){return{get valid(){return!a(o)},apply:()=>{const{spatialReference:a}=r,{snappedPoint:o,hints:p}=this._processCandidates(e,t,n,r);return this._removeVisualization(),null!=r.visualizer&&this.addHandles(r.visualizer.draw(p,{spatialReference:a,elevationInfo:u,view:i,selfSnappingZ:r.selfSnappingZ}),z),_(o,i,s,r)}}}_processCandidates(e,t,n,i){if(n.length<1)return this.doneSnapping(),{snappedPoint:e,hints:[]};this._currentSnappedType!==t&&this._resetSnappingState(),y(e,n);const s=this._currentMainCandidate;if(null!=s){const a=N(s,n);if(a>=0){if(!(n[a]instanceof P))return this._intersectWithOtherCandidates(a,n,e,t,i);if(this._arePointsWithinScreenThreshold(e,s.targetPoint,i))return this._updateSnappingCandidate(s,t,n,i)}}return this._intersectWithOtherCandidates(0,n,e,t,i)}_intersectWithOtherCandidates(e,t,n,i,s){const{coordinateHelper:a}=s,r=t[e],o=[];for(let p=0;p<t.length;++p){if(p===e)continue;const i=t[p],s=r.constraint.intersect(i.constraint);if(s)for(const e of s.closestPoints(r.targetPoint))o.push([new P(g(e),r,i,i.isDraped),this._squaredScreenDistance(n,e,a)])}return o.length>0&&(o.sort(((e,t)=>e[1]-t[1])),o[0][1]<this._squaredPointProximityThreshold(s.pointer))?this._updateSnappingCandidate(o[0][0],i,t,s):L(r,s.drawConstraints)?this._updateSnappingCandidate(r,i,t,s):{snappedPoint:n,hints:[]}}_updateSnappingCandidate(e,t,n,i){this.doneSnapping(),this._currentMainCandidate=e,this._currentSnappedType=t;const s=this._currentMainCandidate.targetPoint,a=[];a.push(...e.hints);for(const r of n){if(e instanceof P){if(r.constraint.equals(e.first.constraint)||r.constraint.equals(e.second.constraint))continue}else if(r.constraint.equals(e.constraint))continue;const t=r.constraint.closestTo(s);this._squaredScreenDistance(t,s,i.coordinateHelper)<U()&&(r.targetPoint=s,this._currentOtherActiveCandidates.push(r),a.push(...r.hints))}return{snappedPoint:s,hints:a}}_squaredPointProximityThreshold(e){return"touch"===e?this._squaredTouchProximityThreshold:this._squaredMouseProximityThreshold}_arePointsWithinScreenThreshold(e,t,n){return this._squaredScreenDistance(e,t,n.coordinateHelper)<this._squaredPointProximityThreshold(n.pointer)}_squaredScreenDistance(e,t,n){return C(this._toScreen(e,n),this._toScreen(t,n))}_toScreen(e,t){return A(e,t.spatialReference,u,this.view)}get test(){}};var b;e([d({constructOnly:!0})],x.prototype,"view",void 0),e([d()],x.prototype,"options",void 0),e([d({readOnly:!0})],x.prototype,"updating",null),e([d()],x.prototype,"_loadTask",void 0),e([d()],x.prototype,"_engines",void 0),e([d()],x.prototype,"_squaredMouseProximityThreshold",null),e([d()],x.prototype,"_squaredTouchProximityThreshold",null),x=e([c("esri.views.interactive.snapping.SnappingManager")],x),function(e){e[e.MAIN=0]="MAIN",e[e.SCENE=1]="SCENE"}(b||(b={}));const z="visualization-handle";function U(){return S.satisfiesConstraintScreenThreshold*S.satisfiesConstraintScreenThreshold}function L(e,t){return!t||null==t.direction&&null==t.distance||!(e instanceof w||e instanceof E||e instanceof T||e instanceof j||e instanceof q)&&(!(e instanceof M)||null==t.direction&&e.selfSnappingType===R.LastVertex)}function N(e,t){return e instanceof P?O(t,e.first)>=0&&O(t,e.second)>=0?0:-1:O(t,e)}function O(e,t){let n=-1;for(let i=0;i<e.length;++i)if(t.constraint.equals(e[i].constraint)){n=i;break}return n}function k(e){return null!=e.scenePoint}function H({coordinateHelper:e,elevationInfo:t}){return e.hasZ()?u:t}export{x as SnappingManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{removeUnordered as o}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{memoize as s}from"../../../../core/memoize.js";import{throwIfAborted as i,allSettledValues as n,whenOrAbort as a}from"../../../../core/promiseUtils.js";import{initial as p,watch as l,on as d}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import y from"../../../../geometry/Polygon.js";import{initializeProjection as m,canProjectWithoutEngine as g,project as f}from"../../../../geometry/projection.js";import{normalizeCentralMeridianForDisplay as _}from"../../../../geometry/support/normalizeUtilsSync.js";import{featureGeometryTypeKebabDictionary as v}from"../../../../geometry/support/typeUtils.js";import{convertFromGeometry as S}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as w}from"../../../../layers/graphics/OptimizedFeature.js";import{executeQueryForSnapping as j}from"../../../../layers/graphics/data/executeQueryForSnapping.js";import b from"../../../../layers/graphics/data/FeatureStore.js";import{QueryEngine as E}from"../../../../layers/graphics/data/QueryEngine.js";import k from"../../../../layers/support/FieldsIndex.js";import{elevationContextAffectsAlignment as C}from"../../../../support/elevationInfoUtils.js";import{symbolHasExtrudeSymbolLayer as F}from"../../../../symbols/support/utils.js";import{sortCandidatesInPlace as A,makeSnappingQuery as I}from"../snappingUtils.js";import{convertSnappingCandidate as P,makeGetGroundElevation as G}from"./queryEngineUtils.js";import{getSnappingCandidateElevationAligner as H}from"./snappingCandidateElevationAlignment.js";import{getSnappingCandidateElevationFilter as R}from"./snappingCandidateElevationFilter.js";import{getSymbologySnappingCandidatesFetcher as x}from"./symbologySnappingCandidates.js";import{TaskPriority as z}from"../../../support/Scheduler.js";const O="graphics-collections";let U=class extends t{get updating(){return this._updatingHandles.updating}get _hasZ(){const e=this.view;return null!=e&&"3d"===e.type&&"map-notes"!==this.layerSource.layer.type}get _snappingElevationAligner(){const{view:e}=this,{layer:t}=this.layerSource,o=null!=e&&"3d"===e.type;if(!o||"map-notes"===t.type)return H();const r=async(o,r)=>(await a(e.whenLayerView(t),r)).elevationAlignPointsInFeatures(o,r);return H(o,{elevationInfo:t.elevationInfo,alignPointsInFeatures:r})}get _snappingElevationFilter(){const{view:e}=this,t=null!=e&&"3d"===e.type&&"map-notes"!==this.layerSource.layer.type;return R(t)}get _symbologySnappingFetcher(){const{view:e}=this,{layer:t}=this.layerSource,o=null!=e&&"3d"===e.type,r=this._extrudedPolygonSymbolsCount>0;return o&&"map-notes"!==t.type&&r?x(r,(async(o,r)=>{const s=await e.whenLayerView(t);return i(r),s.queryForSymbologySnapping({candidates:o,spatialReference:e.spatialReference},r)})):x()}constructor(e){super(e),this.availability=1,this._sources={multipoint:null,point:null,polygon:null,polyline:null},this._loadedWkids=new Set,this._loadedWkts=new Set,this._pendingAdds=[],this._extrudedPolygonSymbolsCount=0,this._updatingHandles=new h,this._memoizedMakeGetGroundElevation=s(G)}destroy(){for(const e of this._pendingAdds)e.task.abort();this._pendingAdds.length=0,this._mapSources((e=>this._destroySource(e))),this._updatingHandles.destroy()}initialize(){this._updatingHandles.add((()=>this.getGraphicsLayers()),(e=>{this._updatingHandles.removeHandles(O);for(const t of e)this._addMany(t.graphics.toArray()),this.addHandles([t.on("graphic-update",(e=>this._onGraphicUpdate(e))),this._updatingHandles.addOnCollectionChange((()=>t.graphics),(e=>this._onGraphicsChanged(e)))],O)}),p);const{view:e}=this,{layer:t}=this.layerSource;null!=e&&"3d"===e.type&&"map-notes"!==t.type&&e.elevationProvider&&this.addHandles([e.elevationProvider.on("elevation-change",(({context:e})=>{C(e,t.elevationInfo)&&this._snappingElevationAligner.notifyElevationSourceChange()})),l((()=>t.elevationInfo),(()=>this._snappingElevationAligner.notifyElevationSourceChange()),p),d((()=>t),["edits","apply-edits","graphic-update"],(()=>this._symbologySnappingFetcher.notifySymbologyChange()))])}async fetchCandidates(e,t){const{point:o,coordinateHelper:{spatialReference:r}}=e,s=await n(this._mapSources((o=>this._fetchCandidatesForSource(o,e,t))));i(t);const a=this._memoizedMakeGetGroundElevation(this.view,r),p=s.flat().map((e=>P(e,a)));return A(o,p),p}async _fetchCandidatesForSource(e,t,o){const r=I({parameters:t,mode:this.view?.type??"2d"}),s=await j(e.queryEngine,r,o);i(o);const n=await this._snappingElevationAligner.alignCandidates(s.candidates,t.coordinateHelper.spatialReference,o);i(o);const a=await this._symbologySnappingFetcher.fetch(n,o);i(o);const p=0===a.length?n:[...n,...a];return this._snappingElevationFilter.filter(r,p)}refresh(){}_onGraphicUpdate(e){if(this.getGraphicsLayers().some((t=>t.graphics.includes(e.graphic))))switch(e.property){case"geometry":case"visible":this._remove(e.graphic),this._addMany([e.graphic])}}_onGraphicsChanged(e){for(const t of e.removed)this._remove(t);this._addMany(e.added)}_addMany(e){const t=[],o=new Map;for(const r of e)null!=r.geometry&&(this._needsInitializeProjection(r.geometry.spatialReference)?(t.push(r.geometry.spatialReference),o.set(r.uid,r)):this._add(r));this._createPendingAdd(t,o)}_createPendingAdd(e,t){if(!e.length)return;const s=r((async o=>{await m(e.map((e=>({source:e,dest:this.spatialReference}))),{signal:o}),this._markLoadedSpatialReferences(e);for(const e of t.values())this._add(e)}));this._updatingHandles.addPromise(s.promise);const i={task:s,graphics:t},n=()=>o(this._pendingAdds,i);s.promise.then(n,n),this._pendingAdds.push(i)}_markLoadedSpatialReferences(e){for(const t of e){null!=t.wkid&&this._loadedWkids.add(t.wkid);const e=t.wkt2||t.wkt;e&&this._loadedWkts.add(e)}}_add(e){if(null==e.geometry||!e.visible)return;let t=e.geometry;if("mesh"===t.type)return;"extent"===t.type&&(t=y.fromExtent(t));const o=this._ensureSource(t.type);if(null==o)return;const r=this._createOptimizedFeature(e.uid,t);null!=r&&(o.featureStore.add(r),F(e.symbol)&&this._extrudedPolygonSymbolsCount++)}_needsInitializeProjection(e){if(null!=e.wkid&&this._loadedWkids.has(e.wkid))return!1;const t=e.wkt2||e.wkt;return(!t||!this._loadedWkts.has(t))&&!g(e,this.spatialReference)}_createOptimizedFeature(e,t){const o=f(_(t),this.spatialReference);if(!o)return null;const r=this._ensureGeometryHasZ(o),s=S(r,this._hasZ,!1);return new w(s,{[Z]:e},null,e)}_ensureGeometryHasZ(e){if(!this._hasZ)return e;const t=e=>{for(;e.length<3;)e.push(0)},o=e.clone();switch(o.hasZ=!0,o.type){case"point":o.z=o.z??0;break;case"multipoint":o.points.forEach(t);break;case"polyline":o.paths.forEach((e=>e.forEach(t)));break;case"polygon":o.rings.forEach((e=>e.forEach(t)))}return o}_ensureSource(e){const t=this._sources[e];if(null!=t)return t;const o=this._createSource(e);return this._sources[e]=o,o}_createSource(e){const t=v.toJSON(e),o=this._hasZ,r=new b({geometryType:t,hasZ:o,hasM:!1});return{featureStore:r,queryEngine:new E({featureStore:r,fieldsIndex:k.fromLayerJSON({fields:[{name:Z,type:"esriFieldTypeOID",alias:Z}]}),geometryType:t,hasM:!1,hasZ:o,featureIdInfo:{type:"object-id",fieldName:Z},spatialReference:this.spatialReference,priority:z.SNAPPING,scheduler:null!=this.view&&"3d"===this.view.type?this.view.resourceController.scheduler:null}),type:e}}_remove(e){this._mapSources((t=>this._removeFromSource(t,e)));for(const t of this._pendingAdds)t.graphics.delete(e.uid),0===t.graphics.size&&t.task.abort()}_removeFromSource(e,t){const o=t.uid;e.featureStore.has(o)&&(e.featureStore.removeById(t.uid),F(t.symbol)&&this._extrudedPolygonSymbolsCount--)}_destroySource(e){e.queryEngine.destroy(),this._sources[e.type]=null}_mapSources(e){const{point:t,polygon:o,polyline:r,multipoint:s}=this._sources,i=[];return null!=t&&i.push(e(t)),null!=o&&i.push(e(o)),null!=r&&i.push(e(r)),null!=s&&i.push(e(s)),i}};e([c()],U.prototype,"getGraphicsLayers",void 0),e([c({constructOnly:!0})],U.prototype,"layerSource",void 0),e([c({constructOnly:!0})],U.prototype,"spatialReference",void 0),e([c({constructOnly:!0})],U.prototype,"view",void 0),e([c({readOnly:!0})],U.prototype,"updating",null),e([c({readOnly:!0})],U.prototype,"availability",void 0),e([c()],U.prototype,"_hasZ",null),e([c()],U.prototype,"_snappingElevationAligner",null),e([c()],U.prototype,"_snappingElevationFilter",null),e([c()],U.prototype,"_symbologySnappingFetcher",null),e([c()],U.prototype,"_extrudedPolygonSymbolsCount",void 0),U=e([u("esri.views.interactive.snapping.featureSources.GraphicsSnappingSource")],U);const Z="OBJECTID";export{U as GraphicsSnappingSource};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{removeUnordered as o}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{memoize as s}from"../../../../core/memoize.js";import{throwIfAborted as i,allSettledValues as n,whenOrAbort as a}from"../../../../core/promiseUtils.js";import{initial as p,watch as l,on as d}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import y from"../../../../geometry/Polygon.js";import{initializeProjection as m,canProjectWithoutEngine as g,project as f}from"../../../../geometry/projectionUtils.js";import{normalizeCentralMeridianForDisplay as _}from"../../../../geometry/support/normalizeUtilsSync.js";import{featureGeometryTypeKebabDictionary as v}from"../../../../geometry/support/typeUtils.js";import{convertFromGeometry as S}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as w}from"../../../../layers/graphics/OptimizedFeature.js";import{executeQueryForSnapping as j}from"../../../../layers/graphics/data/executeQueryForSnapping.js";import b from"../../../../layers/graphics/data/FeatureStore.js";import{QueryEngine as E}from"../../../../layers/graphics/data/QueryEngine.js";import k from"../../../../layers/support/FieldsIndex.js";import{elevationContextAffectsAlignment as C}from"../../../../support/elevationInfoUtils.js";import{symbolHasExtrudeSymbolLayer as F}from"../../../../symbols/support/utils.js";import{sortCandidatesInPlace as A,makeSnappingQuery as I}from"../snappingUtils.js";import{convertSnappingCandidate as P,makeGetGroundElevation as G}from"./queryEngineUtils.js";import{getSnappingCandidateElevationAligner as H}from"./snappingCandidateElevationAlignment.js";import{getSnappingCandidateElevationFilter as R}from"./snappingCandidateElevationFilter.js";import{getSymbologySnappingCandidatesFetcher as U}from"./symbologySnappingCandidates.js";import{TaskPriority as x}from"../../../support/Scheduler.js";const z="graphics-collections";let O=class extends t{get updating(){return this._updatingHandles.updating}get _hasZ(){const e=this.view;return null!=e&&"3d"===e.type&&"map-notes"!==this.layerSource.layer.type}get _snappingElevationAligner(){const{view:e}=this,{layer:t}=this.layerSource,o=null!=e&&"3d"===e.type;if(!o||"map-notes"===t.type)return H();const r=async(o,r)=>(await a(e.whenLayerView(t),r)).elevationAlignPointsInFeatures(o,r);return H(o,{elevationInfo:t.elevationInfo,alignPointsInFeatures:r})}get _snappingElevationFilter(){const{view:e}=this,t=null!=e&&"3d"===e.type&&"map-notes"!==this.layerSource.layer.type;return R(t)}get _symbologySnappingFetcher(){const{view:e}=this,{layer:t}=this.layerSource,o=null!=e&&"3d"===e.type,r=this._extrudedPolygonSymbolsCount>0;return o&&"map-notes"!==t.type&&r?U(r,(async(o,r)=>{const s=await e.whenLayerView(t);return i(r),s.queryForSymbologySnapping({candidates:o,spatialReference:e.spatialReference},r)})):U()}constructor(e){super(e),this.availability=1,this._sources={multipoint:null,point:null,polygon:null,polyline:null},this._loadedWkids=new Set,this._loadedWkts=new Set,this._pendingAdds=[],this._extrudedPolygonSymbolsCount=0,this._updatingHandles=new h,this._memoizedMakeGetGroundElevation=s(G)}destroy(){for(const e of this._pendingAdds)e.task.abort();this._pendingAdds.length=0,this._mapSources((e=>this._destroySource(e))),this._updatingHandles.destroy()}initialize(){this._updatingHandles.add((()=>this.getGraphicsLayers()),(e=>{this._updatingHandles.removeHandles(z);for(const t of e)this._addMany(t.graphics.toArray()),this.addHandles([t.on("graphic-update",(e=>this._onGraphicUpdate(e))),this._updatingHandles.addOnCollectionChange((()=>t.graphics),(e=>this._onGraphicsChanged(e)))],z)}),p);const{view:e}=this,{layer:t}=this.layerSource;null!=e&&"3d"===e.type&&"map-notes"!==t.type&&e.elevationProvider&&this.addHandles([e.elevationProvider.on("elevation-change",(({context:e})=>{C(e,t.elevationInfo)&&this._snappingElevationAligner.notifyElevationSourceChange()})),l((()=>t.elevationInfo),(()=>this._snappingElevationAligner.notifyElevationSourceChange()),p),d((()=>t),["edits","apply-edits","graphic-update"],(()=>this._symbologySnappingFetcher.notifySymbologyChange()))])}async fetchCandidates(e,t){const{point:o,coordinateHelper:{spatialReference:r}}=e,s=await n(this._mapSources((o=>this._fetchCandidatesForSource(o,e,t))));i(t);const a=this._memoizedMakeGetGroundElevation(this.view,r),p=s.flat().map((e=>P(e,a)));return A(o,p),p}async _fetchCandidatesForSource(e,t,o){const r=I({parameters:t,mode:this.view?.type??"2d"}),s=await j(e.queryEngine,r,o);i(o);const n=await this._snappingElevationAligner.alignCandidates(s.candidates,t.coordinateHelper.spatialReference,o);i(o);const a=await this._symbologySnappingFetcher.fetch(n,o);i(o);const p=0===a.length?n:[...n,...a];return this._snappingElevationFilter.filter(r,p)}refresh(){}_onGraphicUpdate(e){if(this.getGraphicsLayers().some((t=>t.graphics.includes(e.graphic))))switch(e.property){case"geometry":case"visible":this._remove(e.graphic),this._addMany([e.graphic])}}_onGraphicsChanged(e){for(const t of e.removed)this._remove(t);this._addMany(e.added)}_addMany(e){const t=[],o=new Map;for(const r of e)null!=r.geometry&&(this._needsInitializeProjection(r.geometry.spatialReference)?(t.push(r.geometry.spatialReference),o.set(r.uid,r)):this._add(r));this._createPendingAdd(t,o)}_createPendingAdd(e,t){if(!e.length)return;const s=r((async o=>{await m(e.map((e=>({source:e,dest:this.spatialReference}))),{signal:o}),this._markLoadedSpatialReferences(e);for(const e of t.values())this._add(e)}));this._updatingHandles.addPromise(s.promise);const i={task:s,graphics:t},n=()=>o(this._pendingAdds,i);s.promise.then(n,n),this._pendingAdds.push(i)}_markLoadedSpatialReferences(e){for(const t of e){null!=t.wkid&&this._loadedWkids.add(t.wkid);const e=t.wkt2||t.wkt;e&&this._loadedWkts.add(e)}}_add(e){if(null==e.geometry||!e.visible)return;let t=e.geometry;if("mesh"===t.type)return;"extent"===t.type&&(t=y.fromExtent(t));const o=this._ensureSource(t.type);if(null==o)return;const r=this._createOptimizedFeature(e.uid,t);null!=r&&(o.featureStore.add(r),F(e.symbol)&&this._extrudedPolygonSymbolsCount++)}_needsInitializeProjection(e){if(null!=e.wkid&&this._loadedWkids.has(e.wkid))return!1;const t=e.wkt2||e.wkt;return(!t||!this._loadedWkts.has(t))&&!g(e,this.spatialReference)}_createOptimizedFeature(e,t){const o=f(_(t),this.spatialReference);if(!o)return null;const r=this._ensureGeometryHasZ(o),s=S(r,this._hasZ,!1);return new w(s,{[Z]:e},null,e)}_ensureGeometryHasZ(e){if(!this._hasZ)return e;const t=e=>{for(;e.length<3;)e.push(0)},o=e.clone();switch(o.hasZ=!0,o.type){case"point":o.z=o.z??0;break;case"multipoint":o.points.forEach(t);break;case"polyline":o.paths.forEach((e=>e.forEach(t)));break;case"polygon":o.rings.forEach((e=>e.forEach(t)))}return o}_ensureSource(e){const t=this._sources[e];if(null!=t)return t;const o=this._createSource(e);return this._sources[e]=o,o}_createSource(e){const t=v.toJSON(e),o=this._hasZ,r=new b({geometryType:t,hasZ:o,hasM:!1});return{featureStore:r,queryEngine:new E({featureStore:r,fieldsIndex:k.fromLayerJSON({fields:[{name:Z,type:"esriFieldTypeOID",alias:Z}]}),geometryType:t,hasM:!1,hasZ:o,featureIdInfo:{type:"object-id",fieldName:Z},spatialReference:this.spatialReference,priority:x.SNAPPING,scheduler:null!=this.view&&"3d"===this.view.type?this.view.resourceController.scheduler:null}),type:e}}_remove(e){this._mapSources((t=>this._removeFromSource(t,e)));for(const t of this._pendingAdds)t.graphics.delete(e.uid),0===t.graphics.size&&t.task.abort()}_removeFromSource(e,t){const o=t.uid;e.featureStore.has(o)&&(e.featureStore.removeById(t.uid),F(t.symbol)&&this._extrudedPolygonSymbolsCount--)}_destroySource(e){e.queryEngine.destroy(),this._sources[e.type]=null}_mapSources(e){const{point:t,polygon:o,polyline:r,multipoint:s}=this._sources,i=[];return null!=t&&i.push(e(t)),null!=o&&i.push(e(o)),null!=r&&i.push(e(r)),null!=s&&i.push(e(s)),i}};e([c()],O.prototype,"getGraphicsLayers",void 0),e([c({constructOnly:!0})],O.prototype,"layerSource",void 0),e([c({constructOnly:!0})],O.prototype,"spatialReference",void 0),e([c({constructOnly:!0})],O.prototype,"view",void 0),e([c({readOnly:!0})],O.prototype,"updating",null),e([c({readOnly:!0})],O.prototype,"availability",void 0),e([c()],O.prototype,"_hasZ",null),e([c()],O.prototype,"_snappingElevationAligner",null),e([c()],O.prototype,"_snappingElevationFilter",null),e([c()],O.prototype,"_symbologySnappingFetcher",null),e([c()],O.prototype,"_extrudedPolygonSymbolsCount",void 0),O=e([u("esri.views.interactive.snapping.featureSources.GraphicsSnappingSource")],O);const Z="OBJECTID";export{O as GraphicsSnappingSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{isSome as t}from"../../core/arrayUtils.js";import r from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{unwrapUpdating as i,updating as n,isUpdating as l}from"../../core/maybeUpdating.js";import{throwIfAbortError as s,throwIfNotAbortError as a}from"../../core/promiseUtils.js";import{whenOnce as m}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{project as u,canProjectWithoutEngine as g,isLoaded as y,load as h}from"../../geometry/projection.js";import d from"./LayerView.js";let f=class extends d{constructor(){super(...arguments),this.layer=null,this.filter=null,this._geometryEngine=null,this._projectionEngineLoaded=!1,this._abortController=new AbortController}get availableFields(){return[]}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){throw new Error("Not implemented")}get maximumNumberOfFeaturesExceeded(){return!1}get layerFilter(){return i(this._layerFilter)}get _layerFilter(){const e=this.layer?.filter;if(null==e||e.geometries.length<1)return null;const o=this._geometryEngine;if(null==o||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)return n;const i=e.geometries.at(0).spatialReference,l=e.geometries.toArray().map((e=>{try{e=o.simplify(e)}catch(t){return r.getLogger(this).warnOncePerTick("Failed to simplify scene filter mask polygon. Polygon will be ignored."),null}if(null==e)return null;if(e.spatialReference.equals(i))return e;try{return u(e,i)}catch(t){return r.getLogger(this).warnOncePerTick("Failed to project scene filter mask polygon. Polygon will be ignored."),null}})).filter(t).sort(((e,t)=>e.extent.xmin-t.extent.xmin)),s=new Set,a=new Array,m=new Array;for(let t of l){const e=t.extent.xmin;if(a.length=0,s.forEach((r=>{if(e>=r.extent.xmax)return m.push(r),void s.delete(r);t.extent.ymin<=r.extent.ymax&&t.extent.ymax>=r.extent.ymin&&o.intersects(t,r)&&a.push(r)})),a.length>0){a.push(t);try{t=o.union(a)}catch(p){r.getLogger(this).warnOncePerTick("Failed to unify filter mask polygons. Polygon will be ignored.");continue}a.pop(),a.forEach((e=>s.delete(e)))}s.add(t)}return s.forEach((e=>m.push(e))),m.length>0?{spatialRelationship:e.spatialRelationship,geometries:m}:null}get _filterNeedsProjectionEngine(){const e=this.layer.filter;if(null==e||e.geometries.length<=1)return!1;const t=e.geometries.at(0).spatialReference;return e.geometries.some((({spatialReference:e})=>!e.equals(t)&&!g(e,t)))}get layerFilterUpdating(){return l(this._layerFilter)}initialize(){const{signal:e}=this._abortController;m((()=>this.destroyed||!this._geometryEngine&&this.layer?.filter?.geometries?.length),e).then((async()=>{s(e),this._geometryEngine=await import("../../geometry/geometryEngine.js")})).catch(a),this._projectionEngineLoaded=y(),m((()=>this.destroyed||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine),e).then((async()=>{s(e),await h(),this._projectionEngineLoaded=!0})).catch(a)}destroy(){this._abortController=o(this._abortController)}highlight(e){throw new Error("Not implemented")}queryFeatures(e,t){throw new Error("Not implemented")}queryObjectIds(e,t){throw new Error("Not implemented")}queryFeatureCount(e,t){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(e,t){throw new Error("Not implemented")}};e([p()],f.prototype,"layer",void 0),e([p()],f.prototype,"availableFields",null),e([p()],f.prototype,"maximumNumberOfFeatures",null),e([p({readOnly:!0})],f.prototype,"maximumNumberOfFeaturesExceeded",null),e([p()],f.prototype,"filter",void 0),e([p({readOnly:!0})],f.prototype,"layerFilter",null),e([p({readOnly:!0})],f.prototype,"_layerFilter",null),e([p()],f.prototype,"_geometryEngine",void 0),e([p()],f.prototype,"_projectionEngineLoaded",void 0),e([p()],f.prototype,"_filterNeedsProjectionEngine",null),e([p()],f.prototype,"layerFilterUpdating",null),f=e([c("esri.views.layers.SceneLayerView")],f);export{f as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{isSome as t}from"../../core/arrayUtils.js";import r from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{unwrapUpdating as i,updating as n,isUpdating as l}from"../../core/maybeUpdating.js";import{throwIfAbortError as s,throwIfNotAbortError as a}from"../../core/promiseUtils.js";import{whenOnce as m}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{project as u,canProjectWithoutEngine as g,isLoaded as y,load as h}from"../../geometry/projectionUtils.js";import d from"./LayerView.js";let f=class extends d{constructor(){super(...arguments),this.layer=null,this.filter=null,this._geometryEngine=null,this._projectionEngineLoaded=!1,this._abortController=new AbortController}get availableFields(){return[]}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){throw new Error("Not implemented")}get maximumNumberOfFeaturesExceeded(){return!1}get layerFilter(){return i(this._layerFilter)}get _layerFilter(){const e=this.layer?.filter;if(null==e||e.geometries.length<1)return null;const o=this._geometryEngine;if(null==o||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)return n;const i=e.geometries.at(0).spatialReference,l=e.geometries.toArray().map((e=>{try{e=o.simplify(e)}catch(t){return r.getLogger(this).warnOncePerTick("Failed to simplify scene filter mask polygon. Polygon will be ignored."),null}if(null==e)return null;if(e.spatialReference.equals(i))return e;try{return u(e,i)}catch(t){return r.getLogger(this).warnOncePerTick("Failed to project scene filter mask polygon. Polygon will be ignored."),null}})).filter(t).sort(((e,t)=>e.extent.xmin-t.extent.xmin)),s=new Set,a=new Array,m=new Array;for(let t of l){const e=t.extent.xmin;if(a.length=0,s.forEach((r=>{if(e>=r.extent.xmax)return m.push(r),void s.delete(r);t.extent.ymin<=r.extent.ymax&&t.extent.ymax>=r.extent.ymin&&o.intersects(t,r)&&a.push(r)})),a.length>0){a.push(t);try{t=o.union(a)}catch(p){r.getLogger(this).warnOncePerTick("Failed to unify filter mask polygons. Polygon will be ignored.");continue}a.pop(),a.forEach((e=>s.delete(e)))}s.add(t)}return s.forEach((e=>m.push(e))),m.length>0?{spatialRelationship:e.spatialRelationship,geometries:m}:null}get _filterNeedsProjectionEngine(){const e=this.layer.filter;if(null==e||e.geometries.length<=1)return!1;const t=e.geometries.at(0).spatialReference;return e.geometries.some((({spatialReference:e})=>!e.equals(t)&&!g(e,t)))}get layerFilterUpdating(){return l(this._layerFilter)}initialize(){const{signal:e}=this._abortController;m((()=>this.destroyed||!this._geometryEngine&&this.layer?.filter?.geometries?.length),e).then((async()=>{s(e),this._geometryEngine=await import("../../geometry/geometryEngine.js")})).catch(a),this._projectionEngineLoaded=y(),m((()=>this.destroyed||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine),e).then((async()=>{s(e),await h(),this._projectionEngineLoaded=!0})).catch(a)}destroy(){this._abortController=o(this._abortController)}highlight(e){throw new Error("Not implemented")}queryFeatures(e,t){throw new Error("Not implemented")}queryObjectIds(e,t){throw new Error("Not implemented")}queryFeatureCount(e,t){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(e,t){throw new Error("Not implemented")}};e([p()],f.prototype,"layer",void 0),e([p()],f.prototype,"availableFields",null),e([p()],f.prototype,"maximumNumberOfFeatures",null),e([p({readOnly:!0})],f.prototype,"maximumNumberOfFeaturesExceeded",null),e([p()],f.prototype,"filter",void 0),e([p({readOnly:!0})],f.prototype,"layerFilter",null),e([p({readOnly:!0})],f.prototype,"_layerFilter",null),e([p()],f.prototype,"_geometryEngine",void 0),e([p()],f.prototype,"_projectionEngineLoaded",void 0),e([p()],f.prototype,"_filterNeedsProjectionEngine",null),e([p()],f.prototype,"layerFilterUpdating",null),f=e([c("esri.views.layers.SceneLayerView")],f);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/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as t}from"../../core/promiseUtils.js";import{isLoaded as e,canProjectWithoutEngine as r,project as n,load as o,projectWithZConversion as i}from"../../geometry/projection.js";let a,c=null;async function l(e){c||(c=import("../../portal/support/geometryServiceUtils.js").then((t=>a=t))),await c,t(e)}async function s(t,i,c,p){if(!t)return null;const u=t.spatialReference;return e()||r(u,i)?n(t,i):a?a.projectGeometry(t,i,c,p):(await Promise.race([l(p),o(p)]),s(t,i,c,p))}async function p(t,e){try{return t?.spatialReference?await i(t,e):null}catch{return null}}export{s as projectWithEngineOrService,p as projectWithZConversionSilent};
5
+ import{throwIfAborted as t}from"../../core/promiseUtils.js";import{isLoaded as e,canProjectWithoutEngine as r,project as n,load as o,projectWithZConversion as i}from"../../geometry/projectionUtils.js";let a,c=null;async function l(e){c||(c=import("../../portal/support/geometryServiceUtils.js").then((t=>a=t))),await c,t(e)}async function s(t,i,c,p){if(!t)return null;const u=t.spatialReference;return e()||r(u,i)?n(t,i):a?a.projectGeometry(t,i,c,p):(await Promise.race([l(p),o(p)]),s(t,i,c,p))}async function p(t,e){try{return t?.spatialReference?await i(t,e):null}catch{return null}}export{s as projectWithEngineOrService,p as projectWithZConversionSilent};