@arcgis/core 4.26.0-next.20230119 → 4.26.0-next.20230121

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 (98) hide show
  1. package/arcade/ArcadeDate.js +1 -1
  2. package/arcade/Feature.js +1 -1
  3. package/arcade/featureset/support/shared.js +1 -1
  4. package/arcade/featureset/support/sqlUtils.js +1 -1
  5. package/arcade/languageUtils.js +1 -1
  6. package/arcade/lib/arcade-parser.js +1 -1
  7. package/arcade/lib/parser.js +1 -1
  8. package/arcade/lib/scanner.js +1 -1
  9. package/arcade/lib/types.js +1 -1
  10. package/arcade/validation/arcadeValidator.js +1 -1
  11. package/arcade/validation/diagnosticMessages.js +1 -1
  12. package/arcade/validation/languageKeywords.js +5 -0
  13. package/assets/esri/core/workers/RemoteClient.js +1 -1
  14. package/assets/esri/core/workers/chunks/{e6c6e3c9750829ec82c1.js → 09ac51aeb0f6fe16aa30.js} +1 -1
  15. package/assets/esri/core/workers/chunks/293594192932f0e00ecf.js +1 -0
  16. package/assets/esri/core/workers/chunks/4f4064eabbbc4a66f95a.js +1 -0
  17. package/assets/esri/core/workers/chunks/{0417369a1d563a6280ff.js → 63706a04e173000994db.js} +1 -1
  18. package/assets/esri/core/workers/chunks/6a90b1d73d5941ebb112.js +1 -0
  19. package/assets/esri/core/workers/chunks/{0c242aa92ab4f0c996db.js → 70f1fe5f36bc4abff2d2.js} +1 -1
  20. package/assets/esri/core/workers/chunks/96d4c50f74a9c0dcdb66.js +1 -0
  21. package/assets/esri/core/workers/chunks/b26a671d3523b8a48404.js +1 -0
  22. package/assets/esri/core/workers/chunks/{5dfed65b615b33588488.js → db96a2dc1879b4944cb8.js} +1 -1
  23. package/assets/esri/core/workers/chunks/fcf033c581f58d006cf6.js +1 -0
  24. package/assets/esri/core/workers/chunks/{5e872adb3a5e84c49865.js → fde8827bd7f1a97a6db3.js} +1 -1
  25. package/assets/esri/themes/base/widgets/_Editor.scss +9 -14
  26. package/assets/esri/themes/dark/main.css +1 -1
  27. package/assets/esri/themes/light/main.css +1 -1
  28. package/assets/esri/themes/light/view.css +1 -1
  29. package/chunks/languageUtils.js +1 -1
  30. package/core/scheduling.js +1 -1
  31. package/interfaces.d.ts +24 -12
  32. package/layers/StreamLayer.js +1 -1
  33. package/layers/VoxelWasmPerSceneView.js +1 -1
  34. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  35. package/layers/graphics/controllers/StreamController.js +1 -1
  36. package/layers/graphics/data/StreamFeatureManager.js +1 -1
  37. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  38. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  39. package/layers/support/FeatureReductionBinning.js +1 -1
  40. package/layers/support/FeatureReductionCluster.js +1 -1
  41. package/layers/support/StreamConnection.js +1 -1
  42. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  43. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  44. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  45. package/package.json +1 -1
  46. package/support/revision.js +1 -1
  47. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  48. package/views/2d/interactive/editingTools/MediaTransformToolsWrapper.js +1 -1
  49. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  50. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  51. package/views/2d/layers/StreamLayerView2D.js +1 -1
  52. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  53. package/views/2d/layers/features/schemaUtils.js +1 -1
  54. package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
  55. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  56. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  57. package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
  58. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  59. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  60. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  61. package/views/3d/layers/I3SMeshView3D.js +1 -1
  62. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  63. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  64. package/views/3d/layers/PointCloudWorker.js +1 -1
  65. package/views/3d/layers/RouteLayerView3D.js +1 -1
  66. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  67. package/views/3d/layers/SceneLayerView3D.js +1 -1
  68. package/views/3d/layers/StreamLayerView3D.js +1 -1
  69. package/views/3d/layers/TileLayerView3D.js +1 -1
  70. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  71. package/views/3d/layers/i3s/I3SLodHandling.js +1 -1
  72. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  73. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  74. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  75. package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
  76. package/views/3d/layers/i3s/PointCloudRendererUtil.js +1 -1
  77. package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
  78. package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
  79. package/views/3d/layers/support/I3STreeDebugger.js +1 -1
  80. package/views/3d/layers/support/SceneLayerViewRequiredFields.js +1 -1
  81. package/views/3d/terrain/TerrainSurface.js +1 -1
  82. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
  83. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  84. package/views/PopupView.js +1 -1
  85. package/views/SceneView.js +1 -1
  86. package/views/interactive/SegmentLabels.js +1 -1
  87. package/views/layers/ImageryLayerView.js +1 -1
  88. package/views/layers/SceneLayerView.js +1 -1
  89. package/views/layers/StreamLayerView.js +1 -1
  90. package/widgets/Editor.js +1 -1
  91. package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
  92. package/widgets/Home/HomeViewModel.js +1 -1
  93. package/assets/esri/core/workers/chunks/0efee8d9fc5632346cb4.js +0 -1
  94. package/assets/esri/core/workers/chunks/10e715aa4ac96d7dd1b4.js +0 -1
  95. package/assets/esri/core/workers/chunks/2dfb17fa5b6a5d239942.js +0 -1
  96. package/assets/esri/core/workers/chunks/2e3962506c353b562a88.js +0 -1
  97. package/assets/esri/core/workers/chunks/7320e6d8f207399bc8f1.js +0 -1
  98. package/assets/esri/core/workers/chunks/a194f90ffe13b3d448b0.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.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Viewpoint.js";import s from"../core/Collection.js";import{byId as a}from"../core/domUtils.js";import n from"../core/Error.js";import{on as o}from"../core/events.js";import{handlesGroup as l,makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isIterable as h}from"../core/iteratorUtils.js";import d from"../core/Logger.js";import{destroyMaybe as c,isNone as u,isSome as g,unwrapOr as m,removeMaybe as f}from"../core/maybe.js";import{ObservableChangesType as y}from"../core/ObservableChangesType.js";import{throwIfAborted as w}from"../core/promiseUtils.js";import{on as v,watch as _,initial as b,syncAndInitial as M,whenOnce as S,sync as C}from"../core/reactiveUtils.js";import{setFrameDuration as R}from"../core/scheduling.js";import{screenPointObjectToArray as V,createScreenPoint as x,createScreenPointArray as T}from"../core/screenUtils.js";import{initialize as O}from"../core/workers/workers.js";import{property as E}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as I}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as L}from"../core/accessorSupport/ensureType.js";import{c as P}from"../chunks/vec3f64.js";import{owningCollectionProperty as G}from"../core/support/OwningCollection.js";import A from"../geometry/HeightModelInfo.js";import{projectPointToVector as H,projectVectorToVector as U,canProjectWithoutEngine as D,project as W,projectBoundingRect as F}from"../geometry/projection.js";import{create as k,toExtent as q}from"../geometry/support/aaBoundingRect.js";import{B as z,c as N}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as B}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as Q}from"../geometry/support/scaleUtils.js";import{fallbackObjectIDAttribute as $}from"../layers/LayerConstants.js";import{isImageryTileLayer as X,isTiledLayer as Y,isVoxelLayer as Z}from"../layers/support/layerUtils.js";import{AnalysesCollection as J}from"../support/AnalysesCollection.js";import{BreakpointsOwner as K}from"./BreakpointsOwner.js";import{DOMContainer as ee}from"./DOMContainer.js";import te from"./GroundView.js";import{PopupView as ie}from"./PopupView.js";import re from"./View.js";import se from"./ViewAnimation.js";import{ViewingMode as ae,stringFromViewingMode as ne,viewingModeFromString as oe}from"./ViewingMode.js";import{layerView3DImporter as le}from"./3d/layerViewModuleImportUtils.js";import pe from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as he}from"./3d/constraints/Constraints.js";import de from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as ce}from"./3d/environment/SceneViewEnvironmentManager.js";import ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ge}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as me}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as fe}from"./3d/layers/support/FeatureTileTree3D.js";import ye from"./3d/state/ViewState.js";import{ViewStateManager as we}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as ve}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as _e}from"./3d/support/CombinedElevationProvider.js";import be from"./3d/support/debugFlags.js";import Me from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Se}from"./3d/support/ElevationProvider.js";import Ce from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Re}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Ve}from"./3d/support/PropertiesPool.js";import xe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Te}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Oe}from"./3d/support/ResourceController.js";import Ee from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as je}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Ie}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Le from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Pe,getTiledLayerInfo as Ge,checkIfTileInfoSupportedForView as Ae}from"./3d/terrain/terrainUtils.js";import{Stage as He}from"./3d/webgl-engine/Stage.js";import{newIntersector as Ue,DEFAULT_TOLERANCE as De}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as We,IntersectorType as Fe}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as ke}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toHit as qe,toOwner as ze}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as Ne}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as Be}from"./support/hitTestSelectUtils.js";import{occludeesSupported as Qe}from"./support/layerViewUtils.js";import{RenderState as $e}from"./support/RenderState.js";import{encode as Xe,encodeData as Ye,toRenderSettings as Ze,screenshotSuperSampleSettings as Je}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Ke,createScreenPointFromSupportedEvent as et}from"./support/screenUtils.js";import{isSpatialReferenceSupported as tt}from"./support/spatialReferenceSupport.js";import{check as it}from"./support/WebGLRequirements.js";import rt from"./ui/3d/DefaultUI3D.js";import st from"../webscene/Environment.js";import at from"../geometry/Extent.js";import nt from"../geometry/SpatialReference.js";import ot from"../geometry/Point.js";let lt=class extends(K(ee(ie(re)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new Ve({slicePlane:z},this),this._resourceController=Oe(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new ge({view:this}),this.labeler=new me({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new J,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new he,this.environmentManager=new ce,this.floors=new s,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new pe({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ye,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new rt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new Ce,this.voxelWasm=null,this.voxelWasmPromise=null,O(),e&&e.environment||(this._defaults.environment=new de,this.environment=this._defaults.environment);const t=(e=null)=>{g(e)&&e.type===y.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.handles.add([v((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),_((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new ue({view:this}),this.stateManager=new we({view:this})}initialize(){this.groundView=new te({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.handles.add(v((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),b),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),b),this.updatingHandles.add((()=>this.qualitySettings.frameRate),(e=>R(e>0?1e3/Math.ceil(e):0)),b),this.updatingHandles.add((()=>this.map?.ground),e,M),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),M),this.handles.add(_((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),C))}destroy(){this.destroyed||(this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=c(this.sharedSymbolResources),this._set("labeler",c(this.labeler)),this._set("deconflictor",c(this.deconflictor)),this._resourceController=c(this._resourceController),this._set("stateManager",c(this.stateManager)),this._set("inputManager",c(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.handles.remove("updatingMonitors"),this._set("environmentManager",c(this.environmentManager)),this.groundView=c(this.groundView))}get renderSpatialReference(){return this.renderCoordsHelper&&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;let e=this._userClippingArea||this.get("map.clippingArea");return!(!!this._userClippingArea||this.get("map.clippingEnabled"))||u(e)?(this._clippingArea=null,null):e instanceof at?this.spatialReference&&(e=dt(e,this.spatialReference),u(e))?(d.getLogger(this.declaredClass).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),u(e.intersection(this._groundAndLayersExtent))&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(d.getLogger(this.declaredClass).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&g(e)?d.getLogger(this.declaredClass).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ae.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return u(t)||u(e)||t.spatialReference.equals(e)?t:dt(t,e)}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||nt.WGS84,i=dt(this.clippingArea,t);g(i)&&(e=g(e)?e.intersection(i):i);const r=this._get("dataExtent");return g(e)&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||nt.WGS84;let t;const i=i=>{const r=dt(i,e);u(r)||(g(t)?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new at({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{!g(e.fullExtent)||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(u(t))return null;t.hasZ?(t.zmin=Math.min(0,t.zmin),t.zmax=Math.max(0,t.zmax)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof de?e:e instanceof st?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):de.fromWebsceneEnvironment(e):L(de,e):new de}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||g(this.activeTool)&&this.activeTool.visible}get stationary(){return!this.animation&&!this.resizing&&(u(this.state)||this.state.stationary)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){Me.isValidProfile(e)&&(Me.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Me.getDefaultProfile()}set slicePlane(e){if(g(this._stage)&&this._stage.renderer.setParameters({slicePlane:e}),u(e))return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");N(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?Q(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?A.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(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||Pe(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager])if(g(s)&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of[this.deconflictor,this.labeler,this.basemapTerrain])g(s)&&s.updating&&(++i,e+=s.updatingProgress);const r=this.stateManager.test.updatingIgnoreRenderState?$e.IDLE:this.state.mode;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r!==$e.IDLE||this._createGraphicsViewController||this.inputManager?.hasPendingInputs||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 viewingMode(){const e=this._predeterminedViewingMode;if(g(e))return ne(e);const t=this.spatialReference;return t?g(this.defaultsFromMap?.viewingMode)&&t.equals(this.defaultsFromMap.spatialReference)?ne(this.defaultsFromMap.viewingMode):tt(t,ae.Global)?"global":"local":"global"}set viewingMode(e){this.ready?d.getLogger(this.declaredClass).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 zoom(){return this.stateManager?.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get performanceInfo(){return new Ee(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 d.getLogger(this.declaredClass).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=g(i.graphics)&&(g(i.graphics.include)||g(i.graphics.exclude)),s=Ke(e)?et(this,e):e,a=V(s);i.enableDraped=i.include&&!i.include.has(Ne)||i.exclude&&i.exclude.has(Ne);const n=this.sceneIntersectionHelper,o=Ue(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?We.ALL:We.MIN,n.intersectIntersectorScreen(a,o,i),r){for(const e of o.results.all){const t=qe(e,this);if(u(t))return this._intersectResultToMapPoint(e);if("graphic"!==t.type||this._testGraphicUidFilter(i.graphics,t.graphic))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return d.getLogger(this.declaredClass).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=m(null==e.z&&Se(this.elevationProvider,e),0);return H(e,ut,this.renderSpatialReference,t),this.state.camera.projectToScreen(ut,gt),x(gt[0],gt[1])}pixelSizeAt(e){return this.ready?e?(H(e,ut,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(ut)):0:(d.getLogger(this.declaredClass).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Ke(e)?et(this,e):e,r=T(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const a=Ue(this.state.viewingMode);a.options.selectionMode=!0,a.options.store=We.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,a,s);const n=this._intersectResultsToHits(a.results.all,s.graphics),o=a.results.ground,l=ze(o,this),p=g(l)&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:n,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:ke(o)?o.distanceInRenderSpace:0,layer:p}};return be.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=a),Promise.resolve(h)}async popupHitTest(e){const{results:t,ground:i}=await Be(this,e);let r=null;return!(0===t.length||Math.abs(m(t[0].distance,0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(u(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":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Xe(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Ye(i,this._pixelFormat())}_completeSettings(e){const t=Ze(e,this);return t.pixelRatio/=this.state.pixelRatio,Je(t,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}async takeScreenshotWithObjectAndLayerId(e){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),r=Xe(i[0],t,this._pixelFormat()),s=this._completeSettings(e);s.format="png";return[r,Xe(i[1],s,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(u(this._stage.renderView.objectAndLayerIdRenderHelper))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return le.importLayerView(e)}hasLayerViewModule(e){return le.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=it(this.type);if(has("safari")&&has("safari")<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),g(e))throw d.getLogger(this.declaredClass).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return g(e)?oe(e):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(g(i))return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ae.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ae.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ae.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ae.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!tt(e,i)&&(!!u(t)||(!!X(t)||(!Y(t)||!u(Ge(t,e,i)))&&(!Z(t)||i!==ae.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(u(t))return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(X(t)&&(r||s)){return!s||i===ae.Local||null===Ae(t.tileInfo,t.fullExtent,e,ae.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:nt.WebMercator,viewingMode:i}]:[{spatialReference:r?nt.WGS84:nt.WebMercator,viewingMode:i}]}return Y(t)||Z(t)||!r&&!s?Y(t)&&r&&i!==ae.Global?[{spatialReference:e,viewingMode:i},{spatialReference:nt.WGS84,viewingMode:ae.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?nt.WGS84:nt.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=g(this.getSpatialReferenceSupport({spatialReference:e})),i=this._predeterminedViewingMode;return t||(g(i)?d.getLogger(this.declaredClass).warnOnce(`Spatial reference defined on view not supported in ${ne(i)} viewing mode.`):e.isGeographic&&d.getLogger(this.declaredClass).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||nt.WGS84;return U(e,this.renderSpatialReference,e,i)||(i=nt.WGS84,U(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new ot(e,i),t}trackGraphicState(e){if(!e.graphic)return d.getLogger(this.declaredClass).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&&g(t)&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return g(t)?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,g(i)&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(s.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):p()}maskOccludee(e){if(!e)return d.getLogger(this.declaredClass).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&&g(t)&&Qe(t)&&(i=t.maskOccludee(e))};return g(t)?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,g(i)&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){g(this.graphicsView)&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await S((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new n("no-view-for-graphic");return 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)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,ct.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,ct.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(ut)?(t=this.computeMapPointFromVec3d(ut,t),e.intersector===Fe.TERRAIN&&this.basemapTerrain&&(t.z=m(Se(this.basemapTerrain,t),0)),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const a=e[s],n=ze(a,this);if(g(n)&&(n===this.map.ground||"type"in n&&"integrated-mesh"===n.type))break;const o=qe(a,this);if(u(o))continue;if("graphic"===o.type){if(u(r)&&s!==e.length-1&&(r=new Set),g(r)){const e=this._getGraphicFilterUid(o.graphic);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o.graphic))continue}const l=this._intersectResultToMapPoint(a),p=a.distanceInRenderSpace;i.push({...o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){const t=e.sourceLayer,i=e.layer,r=t&&"objectIdField"in t?t:i&&"objectIdField"in i?i:t;if(r){const t=r.objectIdField??$,i=e.attributes?.[t];if(i)return`o-${r.id}-${i}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return u(e)||(u(e.include)||e.include.has(i))&&(u(e.exclude)||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,r={layerUids:null,graphicUids:null}){if(!e)return r;if(e instanceof i)ht(r,this._getGraphicFilterUid(e)),t===ct.INCLUDE&&(g(this.graphicsView)&&e.layer===this?pt(r,this.graphicsView.processor.layer.id):e.layer&&pt(r,e.layer.uid));else if(h(e))for(const i of e)i===this.graphics&&g(this.graphicsView)?pt(r,this.graphicsView.processor.layer.id):i===this.map.ground?pt(r,Ne):this._externalToInternalRenderItems(i,t,r);else"uid"in e&&pt(r,e.uid);return r}_initBasemapTerrain(){this._set("basemapTerrain",new Le({view:this})),this._set("elevationProvider",new _e({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ie({view:this})),this._set("featureTiles",new fe({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=g(this.basemapTerrain.extent)&&g(this.basemapTerrain.spatialReference)?W(q(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;g(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.handles.add([this.updatingHandles.add((()=>be.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&&be.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||be.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),M),this.updatingHandles.add((()=>this.clippingArea),e,M),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,M)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.handles.remove("render-coords-helper"),this.handles.remove("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Re(this.map,e));const t=this.state.isGlobal,i=B(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Te.create(this.state.viewingMode,i)),t||this.handles.add(_((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;g(e)&&(0!==e[0]||0!==e[1]||0!==e[2]||0!==e[3])&&F(e,this.basemapTerrain.spatialReference,mt,t)&&(this.renderCoordsHelper.extent=mt)}),C),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.handles.remove("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){g(e)&&e.type===y.MOVE||(this.handles.remove("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.handles.add(_((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),C),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.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)=>this._renderScreenshotOverlay(e,t)}},t=new ve(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=a(this.surface);this._stage=new He({view:this,options:e,container:i}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this._lostWebGLContextHandle=o(this._stage.renderView.canvas,"webglcontextlost",(()=>this.fatalError=new n("webgl-context-lost"))),this.handles.add([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderer.setParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),b),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),b),_((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),M),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation()))],"stage");const r=()=>{this._stage.renderer.setParameters({defaultHighlightOptions:Ce.toEngineOptions(this.highlightOptions)})};this.handles.add(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),r),"stage"),r(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=c(this._stage),this._lostWebGLContextHandle=f(this._lostWebGLContextHandle),this.handles.remove("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new je({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())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.handles.remove("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;w(e),await S((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.handles.remove("graphics-view"),g(this.graphicsView)&&(this.handles.remove(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=oe(this.viewingMode);if(e===ae.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.handles.add(v((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.handles.remove("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Ne);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Ne);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultToMapOptions.exclude.add(e.uid)}}addVoxelLayerViewToWasm(e){return u(this.voxelWasm)?(u(this.voxelWasmPromise)&&(this.voxelWasmPromise=import("../layers/VoxelWasmPerSceneView.js").then((e=>(this.voxelWasm=new e.default(this),this.voxelWasm)))),this.voxelWasmPromise.then((t=>t.addVoxelLayer(e)))):this.voxelWasm.addVoxelLayer(e)}removeVoxelLayerViewFromWasm(e){if(g(this.voxelWasm)){this.voxelWasm.removeVoxelLayer(e)<1&&(this.voxelWasm=null,this.voxelWasmPromise=null)}}};function pt(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function ht(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function dt(e,t){return g(e)&&D(e.spatialReference,t)?W(e,t):null}var ct;lt.type="3d",e([E()],lt.prototype,"_userClippingArea",void 0),e([E()],lt.prototype,"_resourceController",void 0),e([E()],lt.prototype,"_stage",void 0),e([E({readOnly:!0})],lt.prototype,"deconflictor",void 0),e([E({readOnly:!0})],lt.prototype,"labeler",void 0),e([E(G(J,"analyses"))],lt.prototype,"analyses",void 0),e([E({type:se,readOnly:!0})],lt.prototype,"animation",null),e([E({readOnly:!0})],lt.prototype,"basemapTerrain",void 0),e([E({readOnly:!0})],lt.prototype,"elevationProvider",void 0),e([E()],lt.prototype,"camera",null),e([E({type:t})],lt.prototype,"contentCamera",null),e([E({readOnly:!0})],lt.prototype,"canvas",void 0),e([E({type:ot})],lt.prototype,"center",null),e([E({type:at})],lt.prototype,"clippingArea",null),e([E({type:he})],lt.prototype,"constraints",void 0),e([E({type:at,readOnly:!0})],lt.prototype,"renderDataExtent",null),e([E({type:at,readOnly:!0})],lt.prototype,"dataExtent",null),e([E({type:at,readOnly:!0})],lt.prototype,"_groundAndLayersExtent",null),e([E({value:null,type:de})],lt.prototype,"environment",null),e([j("environment")],lt.prototype,"castEnvironment",null),e([E({readOnly:!0})],lt.prototype,"environmentManager",void 0),e([E({type:at})],lt.prototype,"extent",null),e([E()],lt.prototype,"floors",void 0),e([E()],lt.prototype,"screenCenter",null),e([E()],lt.prototype,"frustum",null),e([E({type:Number,readOnly:!0})],lt.prototype,"fullOpacity",void 0),e([E({readOnly:!0})],lt.prototype,"graphicsView",void 0),e([E({readOnly:!0})],lt.prototype,"analysisViewManager",void 0),e([E()],lt.prototype,"groundView",void 0),e([E({type:Boolean})],lt.prototype,"initialExtentRequired",null),e([E()],lt.prototype,"_defaultsFromMapSettings",null),e([E()],lt.prototype,"interacting",null),e([E()],lt.prototype,"stationary",null),e([E()],lt.prototype,"navigating",null),e([E()],lt.prototype,"map",void 0),e([E({readOnly:!0})],lt.prototype,"mapCoordsHelper",void 0),e([E()],lt.prototype,"padding",null),e([E({type:Ie,readOnly:!0})],lt.prototype,"pointsOfInterest",void 0),e([E({type:fe,readOnly:!0})],lt.prototype,"featureTiles",void 0),e([E()],lt.prototype,"_featureTreeDebugger",void 0),e([E({type:Boolean})],lt.prototype,"screenSizePerspectiveEnabled",void 0),e([E({constructOnly:!0})],lt.prototype,"deactivatedWebGLExtensions",void 0),e([E({constructOnly:!0})],lt.prototype,"debugWebGLExtensions",void 0),e([E({constructOnly:!0})],lt.prototype,"renderCanvas",void 0),e([E({constructOnly:!0})],lt.prototype,"state",void 0),e([E({readOnly:!0})],lt.prototype,"inputManager",void 0),e([E({readOnly:!0})],lt.prototype,"stateManager",void 0),e([E({type:["low","medium","high"]})],lt.prototype,"qualityProfile",null),e([E({type:xe,get(){let e=this._get("qualitySettings");return e||(e=new xe,Me.apply(this.qualityProfile,e)),e}})],lt.prototype,"qualitySettings",void 0),e([E()],lt.prototype,"slicePlane",null),e([E({readOnly:!0})],lt.prototype,"typeSpecificPreconditionsReady",null),e([E({readOnly:!0})],lt.prototype,"renderCoordsHelper",void 0),e([E({readOnly:!0})],lt.prototype,"sceneIntersectionHelper",void 0),e([E({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],lt.prototype,"resolution",null),e([E({type:Number})],lt.prototype,"scale",null),e([E()],lt.prototype,"heightModelInfo",null),e([E()],lt.prototype,"spatialReference",void 0),e([E({type:Boolean,constructOnly:!0})],lt.prototype,"alphaCompositingEnabled",void 0),e([E({constructOnly:!0})],lt.prototype,"preserveDrawingBufferEnabled",void 0),e([E({type:Boolean})],lt.prototype,"supersampleScreenshotsEnabled",void 0),e([E({readOnly:!0})],lt.prototype,"type",void 0),e([E({type:rt})],lt.prototype,"ui",void 0),e([E({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.hasPendingInputs","toolViewManager.updating","analysisViewManager.updating","state.mode"]})],lt.prototype,"updating",null),e([E({type:Number,readOnly:!0,dependsOn:["updating"]})],lt.prototype,"updatingProgress",void 0),e([E({type:["global","local"]})],lt.prototype,"viewingMode",null),e([E({type:r})],lt.prototype,"viewpoint",null),e([E({type:Number})],lt.prototype,"zoom",null),e([E({type:Ce})],lt.prototype,"highlightOptions",void 0),lt=e([I("esri.views.SceneView")],lt),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(ct||(ct={}));const ut=P(),gt=T(),mt=k(),ft=lt;export{ft as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Viewpoint.js";import s from"../core/Collection.js";import{byId as a}from"../core/domUtils.js";import n from"../core/Error.js";import{on as o}from"../core/events.js";import{handlesGroup as l,makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isIterable as h}from"../core/iteratorUtils.js";import d from"../core/Logger.js";import{destroyMaybe as c,isNone as u,isSome as g,unwrapOr as m,removeMaybe as f}from"../core/maybe.js";import{ObservableChangesType as y}from"../core/ObservableChangesType.js";import{throwIfAborted as w}from"../core/promiseUtils.js";import{on as v,watch as _,initial as b,syncAndInitial as M,whenOnce as S,sync as C}from"../core/reactiveUtils.js";import{setFrameDuration as R}from"../core/scheduling.js";import{screenPointObjectToArray as V,createScreenPoint as x,createScreenPointArray as T}from"../core/screenUtils.js";import{initialize as O}from"../core/workers/workers.js";import{property as E}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as L}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as I}from"../core/accessorSupport/ensureType.js";import{c as P}from"../chunks/vec3f64.js";import{owningCollectionProperty as G}from"../core/support/OwningCollection.js";import H from"../geometry/HeightModelInfo.js";import{projectPointToVector as A,projectVectorToVector as U,canProjectWithoutEngine as D,project as W,projectBoundingRect as F}from"../geometry/projection.js";import{create as k,toExtent as q}from"../geometry/support/aaBoundingRect.js";import{B as z,c as N}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as B}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as Q}from"../geometry/support/scaleUtils.js";import{fallbackObjectIDAttribute as $}from"../layers/LayerConstants.js";import{isImageryTileLayer as X,isTiledLayer as Y,isVoxelLayer as Z}from"../layers/support/layerUtils.js";import{AnalysesCollection as J}from"../support/AnalysesCollection.js";import{BreakpointsOwner as K}from"./BreakpointsOwner.js";import{DOMContainer as ee}from"./DOMContainer.js";import te from"./GroundView.js";import{PopupView as ie}from"./PopupView.js";import re from"./View.js";import se from"./ViewAnimation.js";import{ViewingMode as ae,stringFromViewingMode as ne,viewingModeFromString as oe}from"./ViewingMode.js";import{layerView3DImporter as le}from"./3d/layerViewModuleImportUtils.js";import pe from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as he}from"./3d/constraints/Constraints.js";import de from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as ce}from"./3d/environment/SceneViewEnvironmentManager.js";import ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ge}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as me}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as fe}from"./3d/layers/support/FeatureTileTree3D.js";import ye from"./3d/state/ViewState.js";import{ViewStateManager as we}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as ve}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as _e}from"./3d/support/CombinedElevationProvider.js";import be from"./3d/support/debugFlags.js";import Me from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Se}from"./3d/support/ElevationProvider.js";import Ce from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Re}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Ve}from"./3d/support/PropertiesPool.js";import xe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Te}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Oe}from"./3d/support/ResourceController.js";import Ee from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as je}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Le}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Ie from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Pe,getTiledLayerInfo as Ge,checkIfTileInfoSupportedForView as He}from"./3d/terrain/terrainUtils.js";import{Stage as Ae}from"./3d/webgl-engine/Stage.js";import{newIntersector as Ue,DEFAULT_TOLERANCE as De}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as We,IntersectorType as Fe}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as ke}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toHit as qe,toOwner as ze}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as Ne}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as Be}from"./support/hitTestSelectUtils.js";import{occludeesSupported as Qe}from"./support/layerViewUtils.js";import{RenderState as $e}from"./support/RenderState.js";import{encode as Xe,encodeData as Ye,toRenderSettings as Ze,screenshotSuperSampleSettings as Je}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Ke,createScreenPointFromSupportedEvent as et}from"./support/screenUtils.js";import{isSpatialReferenceSupported as tt}from"./support/spatialReferenceSupport.js";import{check as it}from"./support/WebGLRequirements.js";import rt from"./ui/3d/DefaultUI3D.js";import st from"../webscene/Environment.js";import at from"../geometry/Extent.js";import nt from"../geometry/SpatialReference.js";import ot from"../geometry/Point.js";let lt=class extends(K(ee(ie(re)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._lostWebGLContextHandle=null,this._resolveWhenReady=[],this._propertiesPool=new Ve({slicePlane:z},this),this._resourceController=Oe(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new ge({view:this}),this.labeler=new me({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new J,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new he,this.environmentManager=new ce,this.floors=new s,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new pe({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ye,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new rt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new Ce,this.voxelWasm=null,this.voxelWasmPromise=null,O(),e&&e.environment||(this._defaults.environment=new de,this.environment=this._defaults.environment);const t=(e=null)=>{g(e)&&e.type===y.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.handles.add([v((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),_((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new ue({view:this}),this.stateManager=new we({view:this})}initialize(){this.groundView=new te({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.handles.add(v((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),b),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),b),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>R(e>0?1e3/Math.ceil(e):0)),b),this.updatingHandles.add((()=>this.map?.ground),e,M),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),M),this.handles.add(_((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),C))}destroy(){this.destroyed||(this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=c(this.sharedSymbolResources),this._set("labeler",c(this.labeler)),this._set("deconflictor",c(this.deconflictor)),this._resourceController=c(this._resourceController),this._set("stateManager",c(this.stateManager)),this._set("inputManager",c(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.handles.remove("updatingMonitors"),this._set("environmentManager",c(this.environmentManager)),this.groundView=c(this.groundView))}get renderSpatialReference(){return this.renderCoordsHelper&&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;let e=this._userClippingArea||("clippingArea"in this.map?this.map?.clippingArea:void 0);return!(!!this._userClippingArea||this.get("map.clippingEnabled"))||u(e)?(this._clippingArea=null,null):e instanceof at?this.spatialReference&&(e=dt(e,this.spatialReference),u(e))?(d.getLogger(this.declaredClass).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),u(e.intersection(this._groundAndLayersExtent))&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(d.getLogger(this.declaredClass).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&g(e)?d.getLogger(this.declaredClass).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ae.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return u(t)||u(e)||t.spatialReference.equals(e)?t:dt(t,e)}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||nt.WGS84,i=dt(this.clippingArea,t);g(i)&&(e=g(e)?e.intersection(i):i);const r=this._get("dataExtent");return g(e)&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||nt.WGS84;let t;const i=i=>{const r=dt(i,e);u(r)||(g(t)?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new at({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{!g(e.fullExtent)||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(u(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 s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof de?e:e instanceof st?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):de.fromWebsceneEnvironment(e):I(de,e):new de}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||g(this.activeTool)&&this.activeTool.visible}get stationary(){return!this.animation&&!this.resizing&&(u(this.state)||this.state.stationary)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){Me.isValidProfile(e)&&(Me.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Me.getDefaultProfile()}set slicePlane(e){if(g(this._stage)&&this._stage.renderer.setParameters({slicePlane:e}),u(e))return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");N(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?Q(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?H.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(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||Pe(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager])if(g(s)&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of[this.deconflictor,this.labeler,this.basemapTerrain])g(s)&&s.updating&&(++i,e+=s.updatingProgress);const r=this.stateManager.test.updatingIgnoreRenderState?$e.IDLE:this.state.mode;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r!==$e.IDLE||this._createGraphicsViewController||this.inputManager?.hasPendingInputs||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 viewingMode(){const e=this._predeterminedViewingMode;if(g(e))return ne(e);const t=this.spatialReference;return t?g(this.defaultsFromMap?.viewingMode)&&t.equals(this.defaultsFromMap.spatialReference)?ne(this.defaultsFromMap.viewingMode):tt(t,ae.Global)?"global":"local":"global"}set viewingMode(e){this.ready?d.getLogger(this.declaredClass).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 zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get performanceInfo(){return new Ee(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 d.getLogger(this.declaredClass).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=g(i.graphics)&&(g(i.graphics.include)||g(i.graphics.exclude)),s=Ke(e)?et(this,e):e,a=V(s);i.enableDraped=i.include&&!i.include.has(Ne)||i.exclude&&i.exclude.has(Ne);const n=this.sceneIntersectionHelper,o=Ue(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?We.ALL:We.MIN,n.intersectIntersectorScreen(a,o,i),r){for(const e of o.results.all){const t=qe(e,this);if(u(t))return this._intersectResultToMapPoint(e);if("graphic"!==t.type||this._testGraphicUidFilter(i.graphics,t.graphic))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return d.getLogger(this.declaredClass).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=m(null==e.z?Se(this.elevationProvider,e):null,0);return A(e,ut,this.renderSpatialReference,t),this.state.camera.projectToScreen(ut,gt),x(gt[0],gt[1])}pixelSizeAt(e){return this.ready?e?(A(e,ut,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(ut)):0:(d.getLogger(this.declaredClass).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Ke(e)?et(this,e):e,r=T(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const a=Ue(this.state.viewingMode);a.options.selectionMode=!0,a.options.store=We.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,a,s);const n=this._intersectResultsToHits(a.results.all,s.graphics),o=a.results.ground,l=ze(o,this),p=g(l)&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:n,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:ke(o)?o.distanceInRenderSpace:0,layer:p}};return be.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=a),Promise.resolve(h)}async popupHitTest(e){const{results:t,ground:i}=await Be(this,e);let r=null;return!(0===t.length||Math.abs(m(t[0].distance,0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(u(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":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Xe(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Ye(i,this._pixelFormat())}_completeSettings(e){const t=Ze(e,this);return t.pixelRatio/=this.state.pixelRatio,Je(t,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}async takeScreenshotWithObjectAndLayerId(e){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),r=Xe(i[0],t,this._pixelFormat()),s=this._completeSettings(e);s.format="png";return[r,Xe(i[1],s,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(u(this._stage.renderView.objectAndLayerIdRenderHelper))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return le.importLayerView(e)}hasLayerViewModule(e){return le.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=it(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})),g(e))throw d.getLogger(this.declaredClass).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return g(e)?oe(e):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(g(i))return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ae.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ae.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ae.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ae.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!tt(e,i)&&(!!u(t)||(!!X(t)||(!Y(t)||!u(Ge(t,e,i)))&&(!Z(t)||i!==ae.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(u(t))return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(X(t)&&(r||s)){return!s||i===ae.Local||null===He(t.tileInfo,t.fullExtent,e,ae.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:nt.WebMercator,viewingMode:i}]:[{spatialReference:r?nt.WGS84:nt.WebMercator,viewingMode:i}]}return Y(t)||Z(t)||!r&&!s?Y(t)&&r&&i!==ae.Global?[{spatialReference:e,viewingMode:i},{spatialReference:nt.WGS84,viewingMode:ae.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?nt.WGS84:nt.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=g(this.getSpatialReferenceSupport({spatialReference:e})),i=this._predeterminedViewingMode;return t||(g(i)?d.getLogger(this.declaredClass).warnOnce(`Spatial reference defined on view not supported in ${ne(i)} viewing mode.`):e.isGeographic&&d.getLogger(this.declaredClass).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||nt.WGS84;return U(e,this.renderSpatialReference,e,i)||(i=nt.WGS84,U(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new ot(e,i),t}trackGraphicState(e){if(!e.graphic)return d.getLogger(this.declaredClass).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&&g(t)&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return g(t)?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,g(i)&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(s.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):p()}maskOccludee(e){if(!e)return d.getLogger(this.declaredClass).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&&g(t)&&Qe(t)&&(i=t.maskOccludee(e))};return g(t)?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,g(i)&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){g(this.graphicsView)&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await S((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new n("no-view-for-graphic");return 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)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,ct.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,ct.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(ut)?(t=this.computeMapPointFromVec3d(ut,t),e.intersector===Fe.TERRAIN&&this.basemapTerrain&&(t.z=m(Se(this.basemapTerrain,t),0)),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const a=e[s],n=ze(a,this);if(g(n)&&(n===this.map.ground||"type"in n&&"integrated-mesh"===n.type))break;const o=qe(a,this);if(u(o))continue;if("graphic"===o.type){if(u(r)&&s!==e.length-1&&(r=new Set),g(r)){const e=this._getGraphicFilterUid(o.graphic);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o.graphic))continue}const l=this._intersectResultToMapPoint(a),p=a.distanceInRenderSpace;i.push({...o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){const t=e.sourceLayer,i=e.layer,r=t&&"objectIdField"in t?t:i&&"objectIdField"in i?i:t;if(r){const t=r.objectIdField??$,i=e.attributes?.[t];if(i)return`o-${r.id}-${i}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return u(e)||(u(e.include)||e.include.has(i))&&(u(e.exclude)||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,r={layerUids:void 0,graphicUids:void 0}){if(!e)return r;if(e instanceof i)ht(r,this._getGraphicFilterUid(e)),t===ct.INCLUDE&&(g(this.graphicsView)&&e.layer===this?pt(r,this.graphicsView.processor.layer.id):e.layer&&pt(r,e.layer.uid));else if(h(e))for(const i of e)i===this.graphics&&g(this.graphicsView)?pt(r,this.graphicsView.processor.layer.id):i===this.map.ground?pt(r,Ne):this._externalToInternalRenderItems(i,t,r);else"uid"in e&&pt(r,e.uid);return r}_initBasemapTerrain(){this._set("basemapTerrain",new Ie({view:this})),this._set("elevationProvider",new _e({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Le({view:this})),this._set("featureTiles",new fe({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=g(this.basemapTerrain.extent)&&g(this.basemapTerrain.spatialReference)?W(q(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;g(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.handles.add([this.updatingHandles.add((()=>be.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&&be.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||be.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),M),this.updatingHandles.add((()=>this.clippingArea),e,M),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,M)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.handles.remove("render-coords-helper"),this.handles.remove("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Re(this.map,e));const t=this.state.isGlobal,i=B(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Te.create(this.state.viewingMode,i)),t||this.handles.add(_((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;g(e)&&(0!==e[0]||0!==e[1]||0!==e[2]||0!==e[3])&&F(e,this.basemapTerrain.spatialReference,mt,t)&&(this.renderCoordsHelper.extent=mt)}),C),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.handles.remove("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){g(e)&&e.type===y.MOVE||(this.handles.remove("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.handles.add(_((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),C),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.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)=>this._renderScreenshotOverlay(e,t)}},t=new ve(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=a(this.surface);this._stage=new Ae({view:this,options:e,container:i}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this._lostWebGLContextHandle=o(this._stage.renderView.canvas,"webglcontextlost",(()=>this.fatalError=new n("webgl-context-lost"))),this.handles.add([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderer.setParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),b),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),b),_((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),M),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation()))],"stage");const r=()=>{this._stage.renderer.setParameters({defaultHighlightOptions:Ce.toEngineOptions(this.highlightOptions)})};this.handles.add(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),r),"stage"),r(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=c(this._stage),this._lostWebGLContextHandle=f(this._lostWebGLContextHandle),this.handles.remove("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new je({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())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.handles.remove("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;w(e),await S((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.handles.remove("graphics-view"),g(this.graphicsView)&&(this.handles.remove(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=oe(this.viewingMode);if(e===ae.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.handles.add(v((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.handles.remove("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Ne);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Ne);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}addVoxelLayerViewToWasm(e){return u(this.voxelWasm)?(u(this.voxelWasmPromise)&&(this.voxelWasmPromise=import("../layers/VoxelWasmPerSceneView.js").then((e=>(this.voxelWasm=new e.default(this),this.voxelWasm)))),this.voxelWasmPromise.then((t=>t.addVoxelLayer(e)))):this.voxelWasm.addVoxelLayer(e)}removeVoxelLayerViewFromWasm(e){if(g(this.voxelWasm)){this.voxelWasm.removeVoxelLayer(e)<1&&(this.voxelWasm=null,this.voxelWasmPromise=null)}}};function pt(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function ht(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function dt(e,t){return g(e)&&D(e.spatialReference,t)?W(e,t):null}var ct;lt.type="3d",e([E()],lt.prototype,"_userClippingArea",void 0),e([E()],lt.prototype,"_resourceController",void 0),e([E()],lt.prototype,"_stage",void 0),e([E({readOnly:!0})],lt.prototype,"deconflictor",void 0),e([E({readOnly:!0})],lt.prototype,"labeler",void 0),e([E(G(J,"analyses"))],lt.prototype,"analyses",void 0),e([E({type:se,readOnly:!0})],lt.prototype,"animation",null),e([E({readOnly:!0})],lt.prototype,"basemapTerrain",void 0),e([E({readOnly:!0})],lt.prototype,"elevationProvider",void 0),e([E()],lt.prototype,"camera",null),e([E({type:t})],lt.prototype,"contentCamera",null),e([E({readOnly:!0})],lt.prototype,"canvas",void 0),e([E({type:ot})],lt.prototype,"center",null),e([E({type:at})],lt.prototype,"clippingArea",null),e([E({type:he})],lt.prototype,"constraints",void 0),e([E({type:at,readOnly:!0})],lt.prototype,"renderDataExtent",null),e([E({type:at,readOnly:!0})],lt.prototype,"dataExtent",null),e([E({type:at,readOnly:!0})],lt.prototype,"_groundAndLayersExtent",null),e([E({value:null,type:de})],lt.prototype,"environment",null),e([j("environment")],lt.prototype,"castEnvironment",null),e([E({readOnly:!0})],lt.prototype,"environmentManager",void 0),e([E({type:at})],lt.prototype,"extent",null),e([E()],lt.prototype,"floors",void 0),e([E()],lt.prototype,"screenCenter",null),e([E()],lt.prototype,"frustum",null),e([E({type:Number,readOnly:!0})],lt.prototype,"fullOpacity",void 0),e([E({readOnly:!0})],lt.prototype,"graphicsView",void 0),e([E({readOnly:!0})],lt.prototype,"analysisViewManager",void 0),e([E()],lt.prototype,"groundView",void 0),e([E({type:Boolean})],lt.prototype,"initialExtentRequired",null),e([E()],lt.prototype,"_defaultsFromMapSettings",null),e([E()],lt.prototype,"interacting",null),e([E()],lt.prototype,"stationary",null),e([E()],lt.prototype,"navigating",null),e([E()],lt.prototype,"map",void 0),e([E({readOnly:!0})],lt.prototype,"mapCoordsHelper",void 0),e([E()],lt.prototype,"padding",null),e([E({type:Le,readOnly:!0})],lt.prototype,"pointsOfInterest",void 0),e([E({type:fe,readOnly:!0})],lt.prototype,"featureTiles",void 0),e([E()],lt.prototype,"_featureTreeDebugger",void 0),e([E({type:Boolean})],lt.prototype,"screenSizePerspectiveEnabled",void 0),e([E({constructOnly:!0})],lt.prototype,"deactivatedWebGLExtensions",void 0),e([E({constructOnly:!0})],lt.prototype,"debugWebGLExtensions",void 0),e([E({constructOnly:!0})],lt.prototype,"renderCanvas",void 0),e([E({constructOnly:!0})],lt.prototype,"state",void 0),e([E({readOnly:!0})],lt.prototype,"inputManager",void 0),e([E({readOnly:!0})],lt.prototype,"stateManager",void 0),e([E({type:["low","medium","high"]})],lt.prototype,"qualityProfile",null),e([E({type:xe,get(){let e=this._get("qualitySettings");return e||(e=new xe,Me.apply(this.qualityProfile,e)),e}})],lt.prototype,"qualitySettings",void 0),e([E()],lt.prototype,"slicePlane",null),e([E({readOnly:!0})],lt.prototype,"typeSpecificPreconditionsReady",null),e([E({readOnly:!0})],lt.prototype,"renderCoordsHelper",void 0),e([E({readOnly:!0})],lt.prototype,"sceneIntersectionHelper",void 0),e([E({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],lt.prototype,"resolution",null),e([E({type:Number})],lt.prototype,"scale",null),e([E()],lt.prototype,"heightModelInfo",null),e([E()],lt.prototype,"spatialReference",void 0),e([E({type:Boolean,constructOnly:!0})],lt.prototype,"alphaCompositingEnabled",void 0),e([E({constructOnly:!0})],lt.prototype,"preserveDrawingBufferEnabled",void 0),e([E({type:Boolean})],lt.prototype,"supersampleScreenshotsEnabled",void 0),e([E({readOnly:!0})],lt.prototype,"type",void 0),e([E({type:rt})],lt.prototype,"ui",void 0),e([E({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.hasPendingInputs","toolViewManager.updating","analysisViewManager.updating","state.mode"]})],lt.prototype,"updating",null),e([E({type:Number,readOnly:!0,dependsOn:["updating"]})],lt.prototype,"updatingProgress",void 0),e([E({type:["global","local"]})],lt.prototype,"viewingMode",null),e([E({type:r})],lt.prototype,"viewpoint",null),e([E({type:Number})],lt.prototype,"zoom",null),e([E({type:Ce})],lt.prototype,"highlightOptions",void 0),lt=e([L("esri.views.SceneView")],lt),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(ct||(ct={}));const ut=P(),gt=T(),mt=k(),ft=lt;export{ft 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.26/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 s}from"../../core/asyncUtils.js";import{makeHandle as o}from"../../core/handleUtils.js";import{isNone as i,isSome as r,applySome as a}from"../../core/maybe.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import{formatLength as l}from"../../core/quantityFormatUtils.js";import{watch as p,on as c}from"../../core/reactiveUtils.js";import{createScreenPointArray as h}from"../../core/screenUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{k as u,s as f,f as b,b as g,l as _,j as x}from"../../chunks/vec2.js";import{a as y}from"../../chunks/vec2f64.js";import{F as v}from"../../chunks/vec3.js";import{isClockwise as j}from"../../geometry/support/coordsUtils.js";import{fetchMessageBundle as U}from"../../intl/messages.js";import{getGeometryEffectiveElevationMode as I}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as L}from"../../support/getDefaultUnitForView.js";import D from"../overlay/TextOverlayItem.js";import{autoDirectDistanceByElevationMode as O}from"../support/automaticLengthMeasurementUtils.js";const S=3025,w={default:15,far:25};let V=class extends t{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._messagesUnits=null,this._labelInfos=[],this._nextLabelIndex=0}initialize(){const e=s((async e=>{const t=await U("esri/core/t9n/Units");n(e),this._messagesUnits=t})),t=()=>a(this.context,(e=>e.editGeometryOperations));this.addHandles([p((()=>[r(this.context)&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits]),(()=>this._update())),...["vertex-add","vertex-update","vertex-remove"].map((e=>c(t,e,(()=>this._update())))),o((()=>e.abort()))])}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop())}get updating(){return i(this._messagesUnits)}get test(){return{labelContents:this._labelInfos.slice(0,this._nextLabelIndex).map((e=>e.label.text))}}get _edgeDistancePixels(){return w[this.edgeDistance]}_update(){this._nextLabelIndex=0;const e=this.context;if(i(e))return void this._destroyUnusedLabels();const{components:t,geometry:s,coordinateHelper:o}=e.editGeometryOperations.data;if(!s)return void this._destroyUnusedLabels();const a=t.length;for(let i=0;i<a;++i){const n=[];if(t[i].iterateVertices((e=>{n.push(o.toXYZ(e.pos))})),0===i&&r(this.stagedVertex)&&n.push(o.toXYZ(this.stagedVertex)),n.length<2)continue;const l=n[0],p=n[n.length-1];"polygon"===s.type&&n.length>2&&!v(l,p)&&n.push(l);const c=1===a&&!j(n,!1,!1);let h=C,d=G;this.toScreenPointArray(e,l,h);for(let t=1;t<n.length;++t){const s=n[t-1],o=n[t];this.toScreenPointArray(e,o,d),this._addLabel(e,s,h,o,d,c),[h,d]=[d,h]}}this._destroyUnusedLabels()}_addLabel(e,t,s,o,i,a){const{label:n}=this._getOrCreateLabel(e);if(!this.visible||u(s,i)<S)return void(n.visible=!1);const p=r(e.graphicState)?e.graphicState.isDraped?"on-the-ground":"absolute-height":I(e.editGeometryOperations.data.geometry,e.elevationInfo),{spatialReference:c}=e.editGeometryOperations.data,h=O(t,o,c,p),d=this._messagesUnits,m=L(e.view);n.text=r(d)&&r(h)?l(d,h,m):"",n.visible=!0;const y=i[0]-s[0],v=i[1]-s[1];a?f(P,-v,y):f(P,v,-y),b(P,P),g(P,P,this._edgeDistancePixels),_(k,s,i,.5),x(k,k,P),n.position=[k[0],k[1]],Math.abs(P[0])>Math.abs(P[1])?n.anchor=P[0]>0?"left":"right":n.anchor=-P[1]<0?"top":"bottom"}_getOrCreateLabel(e){if(this._labelInfos.length>this._nextLabelIndex)return this._labelInfos[this._nextLabelIndex++];const t=new D({fontSize:10,anchor:"center"});e.view.overlay.items.add(t);const s={label:t};return this._labelInfos.push(s),this._nextLabelIndex=this._labelInfos.length,s}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){a(this.context,(t=>t.view.overlay.items.remove(e))),e.destroy()}};e([d()],V.prototype,"context",void 0),e([d()],V.prototype,"stagedVertex",void 0),e([d()],V.prototype,"visible",void 0),e([d()],V.prototype,"edgeDistance",void 0),e([d()],V.prototype,"updating",null),e([d()],V.prototype,"_messagesUnits",void 0),e([d()],V.prototype,"_edgeDistancePixels",null),V=e([m("esri.views.interactive")],V);const P=y(),k=y(),C=h(),G=h();export{V as SegmentLabels};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import{makeHandle as o}from"../../core/handleUtils.js";import{isNone as i,isSome as r,applySome as a}from"../../core/maybe.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import{formatLength as l}from"../../core/quantityFormatUtils.js";import{watch as p,on as c}from"../../core/reactiveUtils.js";import{createScreenPointArray as h}from"../../core/screenUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{k as u,s as f,f as b,b as g,l as _,j as x}from"../../chunks/vec2.js";import{a as y}from"../../chunks/vec2f64.js";import{F as v}from"../../chunks/vec3.js";import{isClockwise as j}from"../../geometry/support/coordsUtils.js";import{fetchMessageBundle as U}from"../../intl/messages.js";import{getGeometryEffectiveElevationMode as I}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as L}from"../../support/getDefaultUnitForView.js";import D from"../overlay/TextOverlayItem.js";import{autoDirectDistanceByElevationMode as O}from"../support/automaticLengthMeasurementUtils.js";const S=3025,w={default:15,far:25};let V=class extends t{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._messagesUnits=null,this._labelInfos=[],this._nextLabelIndex=0}initialize(){const e=s((async e=>{const t=await U("esri/core/t9n/Units");n(e),this._messagesUnits=t})),t=()=>a(this.context,(e=>e.editGeometryOperations));this.addHandles([p((()=>[r(this.context)&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits]),(()=>this._update())),...["vertex-add","vertex-update","vertex-remove"].map((e=>c(t,e,(()=>this._update())))),o((()=>e.abort()))])}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop())}get updating(){return i(this._messagesUnits)}get test(){return{labelContents:this._labelInfos.slice(0,this._nextLabelIndex).map((e=>e.label.text))}}get _edgeDistancePixels(){return w[this.edgeDistance]}_update(){this._nextLabelIndex=0;const e=this.context;if(i(e))return void this._destroyUnusedLabels();const{components:t,geometry:s,coordinateHelper:o}=e.editGeometryOperations.data;if(!s)return void this._destroyUnusedLabels();const a=t.length;for(let i=0;i<a;++i){const n=[];if(t[i].iterateVertices((e=>{n.push(o.toXYZ(e.pos))})),0===i&&r(this.stagedVertex)&&n.push(o.toXYZ(this.stagedVertex)),n.length<2)continue;const l=n[0],p=n[n.length-1];"polygon"===s.type&&n.length>2&&!v(l,p)&&n.push(l);const c=1===a&&!j(n,!1,!1);let h=C,d=G;this.toScreenPointArray(e,l,h);for(let t=1;t<n.length;++t){const s=n[t-1],o=n[t];this.toScreenPointArray(e,o,d),this._addLabel(e,s,h,o,d,c),[h,d]=[d,h]}}this._destroyUnusedLabels()}_addLabel(e,t,s,o,i,a){const{label:n}=this._getOrCreateLabel(e);if(!this.visible||u(s,i)<S)return void(n.visible=!1);const p=r(e.graphicState)?e.graphicState.isDraped?"on-the-ground":"absolute-height":I(e.editGeometryOperations.data.geometry,e.elevationInfo),{spatialReference:c}=e.editGeometryOperations.data,h=O(t,o,c,p),d=this._messagesUnits,m=L(e.view);n.text=r(d)&&r(h)?l(d,h,m):"",n.visible=!0;const y=i[0]-s[0],v=i[1]-s[1];a?f(P,-v,y):f(P,v,-y),b(P,P),g(P,P,this._edgeDistancePixels),_(k,s,i,.5),x(k,k,P),n.position=[k[0],k[1]],Math.abs(P[0])>Math.abs(P[1])?n.anchor=P[0]>0?"left":"right":n.anchor=-P[1]<0?"top":"bottom"}_getOrCreateLabel(e){if(this._labelInfos.length>this._nextLabelIndex)return this._labelInfos[this._nextLabelIndex++];const t=new D({fontSize:10,anchor:"center"});e.view.overlay?.items.add(t);const s={label:t};return this._labelInfos.push(s),this._nextLabelIndex=this._labelInfos.length,s}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){a(this.context,(t=>t.view.overlay?.items.remove(e))),e.destroy()}};e([d()],V.prototype,"context",void 0),e([d()],V.prototype,"stagedVertex",void 0),e([d()],V.prototype,"visible",void 0),e([d()],V.prototype,"edgeDistance",void 0),e([d()],V.prototype,"updating",null),e([d()],V.prototype,"_messagesUnits",void 0),e([d()],V.prototype,"_edgeDistancePixels",null),V=e([m("esri.views.interactive")],V);const P=y(),k=y(),C=h(),G=h();export{V as SegmentLabels};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Error.js";import{isNone as t,isSome as o}from"../../core/maybe.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/Point.js";import{combinedViewLayerTimeExtentProperty as a}from"../../layers/support/commonProperties.js";import n from"../../rest/support/Query.js";import{getFetchPopupTemplate as u}from"./support/popupUtils.js";const m=m=>{let c=class extends m{constructor(){super(...arguments),this.view=null}async fetchPopupFeatures(e,s){const{layer:p}=this;if(!e)throw new r("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:p});const{popupEnabled:a}=p,m=u(p,s);if(!a||t(m))throw new r("imagerylayerview:fetchPopupFeatures","Missing required popupTemplate or popupEnabled",{popupEnabled:a,popupTemplate:m});const c=await m.getRequiredFields(),l=new n;l.timeExtent=this.timeExtent,l.geometry=e,l.outFields=c,l.outSpatialReference=e.spatialReference;const y=this.view.resolution,w="2d"===this.view.type?new i(y,y,this.view.spatialReference):new i(.5*y,.5*y,this.view.spatialReference),{returnTopmostRaster:d,showNoDataRecords:h}=m.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},f={returnDomainValues:!0,returnTopmostRaster:d,pixelSize:w,showNoDataRecords:h,signal:o(s)?s.signal:null};return p.queryVisibleRasters(l,f).then((e=>e))}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}};return e([s()],c.prototype,"layer",void 0),e([s()],c.prototype,"suspended",void 0),e([s(a)],c.prototype,"timeExtent",void 0),e([s()],c.prototype,"view",void 0),c=e([p("esri.views.layers.ImageryLayerView")],c),c};export{m as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Error.js";import{isNone as t,isSome as o}from"../../core/maybe.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/Point.js";import{combinedViewLayerTimeExtentProperty as a}from"../../layers/support/commonProperties.js";import n from"../../rest/support/Query.js";import{getFetchPopupTemplate as u}from"./support/popupUtils.js";const m=m=>{let c=class extends m{constructor(){super(...arguments),this.view=null}async fetchPopupFeatures(e,s){const{layer:p}=this;if(!e)throw new r("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:p});const{popupEnabled:a}=p,m=u(p,s);if(!a||t(m))throw new r("imagerylayerview:fetchPopupFeatures","Missing required popupTemplate or popupEnabled",{popupEnabled:a,popupTemplate:m});const c=await m.getRequiredFields(),l=new n;l.timeExtent=this.timeExtent,l.geometry=e,l.outFields=c,l.outSpatialReference=e.spatialReference;const{resolution:y,spatialReference:d}=this.view,w="2d"===this.view.type?new i(y,y,d):new i(.5*y,.5*y,d),{returnTopmostRaster:f,showNoDataRecords:h}=m.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},R={returnDomainValues:!0,returnTopmostRaster:f,pixelSize:w,showNoDataRecords:h,signal:o(s)?s.signal:null};return p.queryVisibleRasters(l,R).then((e=>e))}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}};return e([s()],c.prototype,"layer",void 0),e([s()],c.prototype,"suspended",void 0),e([s(a)],c.prototype,"timeExtent",void 0),e([s()],c.prototype,"view",void 0),c=e([p("esri.views.layers.ImageryLayerView")],c),c};export{m 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.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{isNone as r,isSome as o}from"../../core/maybe.js";import{unwrapUpdating as i,updating as n,isUpdating as l}from"../../core/maybeUpdating.js";import{whenOnce as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{project as p,canProjectWithoutEngine as u,isLoaded as c,load as y}from"../../geometry/projection.js";import g from"./LayerView.js";const d="esri.views.layers.SceneLayerView",h=t.getLogger(d);let f=class extends g{constructor(){super(...arguments),this.layer=null,this.filter=null,this._geometryEngine=null,this._projectionEngineLoaded=!1}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(r(e)||e.geometries.length<1)return null;const t=this._geometryEngine;if(r(t)||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)return n;const o=e.geometries.getItemAt(0).spatialReference,i=e.geometries.toArray().map((e=>{try{e=t.simplify(e)}catch(r){return h.warnOncePerTick("Failed to simplify scene filter mask polygon. Polygon will be ignored."),null}if(null==e)return null;if(e.spatialReference.equals(o))return e;try{return p(e,o)}catch(r){return h.warnOncePerTick("Failed to project scene filter mask polygon. Polygon will be ignored."),null}})).filter((e=>null!=e)).sort(((e,t)=>e.extent.xmin-t.extent.xmin)),l=new Set,s=new Array,a=new Array;for(let r of i){const e=r.extent.xmin;if(s.length=0,l.forEach((o=>{if(e>=o.extent.xmax)return a.push(o),void l.delete(o);r.extent.ymin<=o.extent.ymax&&r.extent.ymax>=o.extent.ymin&&t.intersects(r,o)&&s.push(o)})),s.length>0){s.push(r);try{r=t.union(s)}catch(m){h.warnOncePerTick("Failed to unify filter mask polygons. Polygon will be ignored.");continue}s.pop(),s.forEach((e=>l.delete(e)))}l.add(r)}return l.forEach((e=>a.push(e))),a.length>0?{spatialRelationship:e.spatialRelationship,geometries:a}:null}get _filterNeedsProjectionEngine(){const e=this.layer.filter;if(r(e)||e.geometries.length<=1)return!1;const t=e.geometries.getItemAt(0).spatialReference;return e.geometries.some((({spatialReference:e})=>!e.equals(t)&&!u(e,t)))}get layerFilterUpdating(){return l(this._layerFilter)}initialize(){s((()=>!this._geometryEngine&&o(this.layer.filter)&&this.layer.filter.geometries.length)).then((async()=>this._geometryEngine=await import("../../geometry/geometryEngine.js"))),this._projectionEngineLoaded=c(),s((()=>!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)).then((async()=>{await y(),this._projectionEngineLoaded=!0}))}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([a()],f.prototype,"layer",void 0),e([a()],f.prototype,"availableFields",null),e([a()],f.prototype,"maximumNumberOfFeatures",null),e([a({readOnly:!0})],f.prototype,"maximumNumberOfFeaturesExceeded",null),e([a()],f.prototype,"filter",void 0),e([a({readOnly:!0})],f.prototype,"layerFilter",null),e([a({readOnly:!0})],f.prototype,"_layerFilter",null),e([a()],f.prototype,"_geometryEngine",void 0),e([a()],f.prototype,"_projectionEngineLoaded",void 0),e([a()],f.prototype,"_filterNeedsProjectionEngine",null),e([a()],f.prototype,"layerFilterUpdating",null),f=e([m(d)],f);const E=f;export{E as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{isNone as r,isSome as o}from"../../core/maybe.js";import{unwrapUpdating as i,updating as n,isUpdating as l}from"../../core/maybeUpdating.js";import{whenOnce as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{project as p,canProjectWithoutEngine as u,isLoaded as c,load as y}from"../../geometry/projection.js";import g from"./LayerView.js";const d="esri.views.layers.SceneLayerView",h=t.getLogger(d);let f=class extends g{constructor(){super(...arguments),this.layer=null,this.filter=null,this._geometryEngine=null,this._projectionEngineLoaded=!1}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(r(e)||e.geometries.length<1)return null;const t=this._geometryEngine;if(r(t)||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)return n;const i=e.geometries.getItemAt(0).spatialReference,l=e.geometries.toArray().map((e=>{try{e=t.simplify(e)}catch(r){return h.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 p(e,i)}catch(r){return h.warnOncePerTick("Failed to project scene filter mask polygon. Polygon will be ignored."),null}})).filter(o).sort(((e,t)=>e.extent.xmin-t.extent.xmin)),s=new Set,a=new Array,m=new Array;for(let r of l){const e=r.extent.xmin;if(a.length=0,s.forEach((o=>{if(e>=o.extent.xmax)return m.push(o),void s.delete(o);r.extent.ymin<=o.extent.ymax&&r.extent.ymax>=o.extent.ymin&&t.intersects(r,o)&&a.push(o)})),a.length>0){a.push(r);try{r=t.union(a)}catch(u){h.warnOncePerTick("Failed to unify filter mask polygons. Polygon will be ignored.");continue}a.pop(),a.forEach((e=>s.delete(e)))}s.add(r)}return s.forEach((e=>m.push(e))),m.length>0?{spatialRelationship:e.spatialRelationship,geometries:m}:null}get _filterNeedsProjectionEngine(){const e=this.layer.filter;if(r(e)||e.geometries.length<=1)return!1;const t=e.geometries.getItemAt(0).spatialReference;return e.geometries.some((({spatialReference:e})=>!e.equals(t)&&!u(e,t)))}get layerFilterUpdating(){return l(this._layerFilter)}initialize(){s((()=>!this._geometryEngine&&o(this.layer.filter)&&this.layer.filter.geometries.length)).then((async()=>this._geometryEngine=await import("../../geometry/geometryEngine.js"))),this._projectionEngineLoaded=c(),s((()=>!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)).then((async()=>{await y(),this._projectionEngineLoaded=!0}))}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([a()],f.prototype,"layer",void 0),e([a()],f.prototype,"availableFields",null),e([a()],f.prototype,"maximumNumberOfFeatures",null),e([a({readOnly:!0})],f.prototype,"maximumNumberOfFeaturesExceeded",null),e([a()],f.prototype,"filter",void 0),e([a({readOnly:!0})],f.prototype,"layerFilter",null),e([a({readOnly:!0})],f.prototype,"_layerFilter",null),e([a()],f.prototype,"_geometryEngine",void 0),e([a()],f.prototype,"_projectionEngineLoaded",void 0),e([a()],f.prototype,"_filterNeedsProjectionEngine",null),e([a()],f.prototype,"layerFilterUpdating",null),f=e([m(d)],f);const E=f;export{E 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.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../chunks/tslib.es6.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import e from"../../layers/support/FeatureFilter.js";const s=s=>{let n=class extends s{constructor(...r){super(...r),this.connectionError=null,this.filter=null}get connectionStatus(){return this.controller?.connection?.connectionStatus??"disconnected"}};return r([o({readOnly:!0})],n.prototype,"connectionError",void 0),r([o({readOnly:!0})],n.prototype,"connectionStatus",null),r([o({type:e})],n.prototype,"filter",void 0),n=r([t("esri.layers.mixins.StreamLayerView")],n),n};export{s as default};
5
+ import{_ as r}from"../../chunks/tslib.es6.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import e from"../../layers/support/FeatureFilter.js";const s=s=>{let n=class extends s{constructor(...r){super(...r),this.connectionError=null,this.filter=null}get connectionStatus(){return this.controller?.isPaused?"paused":this.controller?.connection?.connectionStatus??"disconnected"}};return r([o({readOnly:!0})],n.prototype,"connectionError",void 0),r([o({readOnly:!0})],n.prototype,"connectionStatus",null),r([o({type:e})],n.prototype,"filter",void 0),n=r([t("esri.layers.mixins.StreamLayerView")],n),n};export{s as default};
package/widgets/Editor.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.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import s from"../core/Logger.js";import{isSome as a}from"../core/maybe.js";import{createDeferred as i}from"../core/promiseUtils.js";import{watch as n,on as o,when as r,initial as l}from"../core/reactiveUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{cast as c}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import h from"./Attachments.js";import u from"./FeatureForm.js";import g from"./FeatureTemplates.js";import w from"./Spinner.js";import _ from"./Widget.js";import{workflowDeprecation as f}from"./Editor/deprecationUtils.js";import v from"./Editor/EditorViewModel.js";import{ItemList as b}from"./FeatureTemplates/ItemList.js";import{Heading as y,incrementHeadingLevel as k}from"./support/Heading.js";import C from"./support/SnappingControls.js";import{accessibleHandler as M}from"./support/decorators/accessibleHandler.js";import{messageBundle as A}from"./support/decorators/messageBundle.js";import{vmEvent as F}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import{substitute as E}from"../intl/substitute.js";const T="esri-editor",S=`${T}__panel`,P=`${T}__prompt`,L={base:`${T} esri-widget esri-widget--panel`,message:`${T}__message`,controls:`${T}__controls`,controlButton:`${T}__control-button`,progressBar:`${T}__progress-bar`,panelToolbar:`${S}-toolbar`,panelContent:`${S}-content`,panelContentMessage:`${S}-content__message`,panelContentSection:`${S}-content__section`,panelContentSectionGroup:`${S}-content__section__group`,snappingSettingsContainer:`${T}__snapping-settings`,updateFeaturesActionButtons:`${T}__update-features-action-buttons`,updateFeaturesActionButtonsButton:`${T}__update-features-action-buttons--button`,featureTemplatesContainer:`${T}__feature-templates-container`,promptContainer:P,promptHeader:`${P}__header`,promptHeading:`${P}__header__heading`,promptMessage:`${P}__message`,promptDivider:`${P}__divider`,promptActions:`${P}__actions`,warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit",button:"esri-button",buttonDisabled:"esri-button--disabled",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary"},j={undoRedoButtons:!1,snappingControls:!0,snappingControlsElements:{header:!1,enabledToggle:!0,selfEnabledToggle:!0,featureEnabledToggle:!0,layerList:!0}};function B(e){e.focus()}const U="esri.widgets.Editor",I=s.getLogger(U);let V=class extends(t(_)){constructor(e,t){super(e,t),this._candidateCommitted=!1,this._featureForm=new u,this._attachments=new h({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new g({enableListScroll:!1}),this._filterText="",this._prompt=null,this._spinner=new w,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=L.widgetIcon,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new v,this.visibleElements={...j},this._setCandidateFeature=(e,t=!1)=>{if(this._candidateCommitted)return;const s=this._assertActiveUpdateWorkflow();s.data.edits.feature=e,t&&(s.next(),this._candidateCommitted=!0)},this._clearPrompt=()=>{this._prompt=null},this._handleSave=this._handleSave.bind(this),this._handleBack=this._handleBack.bind(this),this._handleDelete=this._handleDelete.bind(this),this._handleAdd=this._handleAdd.bind(this),this._handleEdit=this._handleEdit.bind(this),this._handleAttachmentAdd=this._handleAttachmentAdd.bind(this),this._handleAttachmentUpdate=this._handleAttachmentUpdate.bind(this),this._handleAttachmentDelete=this._handleAttachmentDelete.bind(this),this.EditorPanel=this.EditorPanel.bind(this)}initialize(){const{view:e,snappingOptions:t}=this;this._snappingControls=new C({layerListOpen:!1,snappingOptions:t,view:e,visibleElements:this.visibleElements.snappingControlsElements});const s=()=>this.scheduleRender();this.addHandles([n((()=>k(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),o((()=>this.viewModel.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{this.viewModel.activeWorkflow&&await this.viewModel.cancelWorkflow(),e&&e.id!==t?.id&&(this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(e):this.startCreateFeaturesWorkflowAtFeatureCreation(e))})),n((()=>this.viewModel.selectedTemplateItem),(e=>this._featureTemplates.select(e,!1))),n((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?.featureFormViewModel??null,this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null}),l),n((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),l),o((()=>this.viewModel?.sketchViewModel),"create",s),o((()=>this.viewModel?.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._clearPrompt()}},secondary:{label:s.form.no,action:()=>{e.deny(),this._clearPrompt()}}}}})),r((()=>this.supportingWidgetDefaults),(e=>{this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch)}),l),r((()=>this._attachments?.error),(e=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:s.form.ok,action:this._clearPrompt}}}})),r((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:a,cancel:i}]=e;this._prompt={title:t.errorWarningTitle,message:E(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{a(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{i(),this._clearPrompt()}}}}})),n((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText="";break;case"awaiting-update-feature-candidate":this._candidateCommitted=!1}})),n((()=>[this._attachments?.selectedFile,this._attachments?.submitting]),s),n((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),o((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this._handleBack()}))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._snappingControls.destroy()}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-accordion-item.js"),import("@esri/calcite-components/dist/components/calcite-accordion.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow-item.js"),import("@esri/calcite-components/dist/components/calcite-flow-item.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-scrim.js")])}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){this.viewModel.allowedWorkflows=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){const t={...j,...e,snappingControlsElements:{...j.snappingControlsElements,...e?.snappingControlsElements}};return a(this._snappingControls)&&(this._snappingControls.visibleElements=t.snappingControlsElements),t}startCreateWorkflowAtFeatureTypeSelection(){return f(I,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return f(I,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return f(I,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{_attachments:e,_prompt:t,viewModel:s}=this;if(!s)return W("div",{class:L.base});const i=a(t)&&W("calcite-scrim",null,this._renderPrompt(t)),{state:n}=s,o=s.syncing||e.submitting;return W("div",{class:L.base},o&&this._renderProgressBar(),W("calcite-flow",null,s.pageStack.map((e=>this._renderPage(e,n))),this._renderPage(s.page,n)),i)}_renderPage(e,t){switch(e){case"disabled":break;case"ready":return this._renderLanding(t);case"awaiting-feature-creation-info":return this._renderTemplates(t);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this._renderAttributeEditing(t);case"awaiting-update-feature-candidate":return this._renderFeatureList(t);case"adding-attachment":return this._renderAttachmentAdding(t);case"editing-attachment":return this._renderAttachmentEditing(t)}return W("div",null)}_isPanelActive(e){return this.viewModel.state===e}_renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:a,messagesCommon:i,_handleBack:n,_snappingControls:o,viewModel:{sketchViewModel:r}}=this;return W(t,{active:this._isPanelActive(e),key:"templates-panel",handleBack:n,heading:a.selectTemplate,headingLevel:s,messages:a,messagesCommon:i,sketchViewModel:r,snappingControls:o},W("div",{class:L.panelContent},this._featureTemplates.render()))}_renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:a,messagesCommon:i,headingLevel:n,_handleBack:o,_snappingControls:r,viewModel:l}=this;if(!t)return null;const d=t.type,c=l.featureFormViewModel,p="update"===d&&!t.data.edits.modified||l.syncing||c.updating,m="update"===d?a.editFeature:a.createFeatures,h="update"===d?i.update:i.create,u="create-features"===d&&"create-new"===t.createFeatureState,g=[{clickHandler:this._handleSave,disabled:p,label:"create-features"===d&&t.numPendingFeatures>1?E(a.createFeaturesTemplate,{numFeatures:t.numPendingFeatures}):h,type:"primary",width:"full"}];this._shouldShowDeleteButton&&g.push({appearance:"solid",clickHandler:this._handleDelete,disabled:l.syncing,kind:"danger",label:i.delete,type:"primary",width:"full"});const w=this._shouldShowAttachments,_=c.inputFields.every((e=>!e.visible))&&!w?this._renderMessage(E(a.clickToFinishTemplate,{button:h})):W("div",{key:"panel-content-section",class:L.panelContentSection},W("div",{class:L.panelContentSectionGroup},this._featureForm.render(),w&&W("div",{key:"attachments"},W(y,{level:k(n)},a.attachments),this._attachments.render())));return W(s,{active:this._isPanelActive(e),key:"attribute-editing-panel",heading:m,headingLevel:n,handleBack:o,messages:a,messagesCommon:i,sketchViewModel:l.sketchViewModel,snappingControls:r},W("div",{key:"panel-content",class:L.panelContent},_,u&&W("calcite-scrim",null)),this._renderFooterActions(g))}_renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_handleBack:a,headingLevel:i,messages:n,messagesCommon:o,_snappingControls:r,viewModel:{sketchViewModel:l}}=this,d=[{label:t.submitting?o.cancel:o.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentAdd,width:"full"}];return W(s,{active:this._isPanelActive(e),key:"attachment-adding-panel",heading:n.addAttachment,headingLevel:i,handleBack:a,messages:n,messagesCommon:o,sketchViewModel:l,snappingControls:r},W("div",{class:L.panelContent},t.render()),this._renderFooterActions(d))}_renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_handleBack:a,headingLevel:i,messages:n,messagesCommon:o,_snappingControls:r,viewModel:{sketchViewModel:l}}=this,d=[{label:o.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentUpdate,width:"half"},{label:o.delete,disabled:t.submitting,type:"tertiary",clickHandler:this._handleAttachmentDelete,width:"half",appearance:"outline"}];return W(s,{active:this._isPanelActive(e),key:"attachment-editing-panel",heading:n.editAttachment,headingLevel:i,handleBack:a,messages:n,messagesCommon:o,sketchViewModel:l,snappingControls:r},W("div",{class:L.panelContent},t.render()),this._renderFooterActions(d))}_renderMessage(e){return W("div",{key:"panel-content-message",class:L.panelContentMessage},e)}_renderFooterActions(e){return e.filter(a).map((({type:e,disabled:t,class:s,...a},i)=>$({class:this.classes(s,L.controlButton,{[L.buttonSecondary]:"secondary"===e,[L.buttonTertiary]:"tertiary"===e,[L.buttonDisabled]:!!t}),key:`action-${i}`,slot:"footer-actions",disabled:t,...a})))}_renderPrompt({title:e,message:t,context:s,actions:a}){const i=a.secondary,n=W("calcite-button",{appearance:"solid",kind:"danger"===s?"danger":"brand",width:i?"half":"full",onclick:a.primary.action,key:"prompt-primary-button",afterCreate:B},a.primary.label),o=i&&W("calcite-button",{appearance:"outline",kind:"danger"===s?"danger":"brand",width:"half",onclick:i.action,key:"prompt-secondary-button"},i.label);return W("div",{class:`${L.promptContainer}--${s}`},W("div",{class:L.promptHeader},W("calcite-icon",{icon:"exclamation-mark-triangle"}),W(y,{class:L.promptHeading,level:this.headingLevel},e)),W("div",{class:L.promptMessage},t),W("div",{class:L.promptDivider}),W("div",{class:L.promptActions},o,n))}_renderProgressBar(){return W("div",{class:this.classes(L.progressBar),key:"progress-bar"})}_renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:a,messagesCommon:i,_snappingControls:n,_featureTemplates:{viewModel:{numberOfFeatureTemplates:o}},viewModel:{canUpdate:r,sketchViewModel:l}}=this,d=!r&&0===o;return W(t,{active:this._isPanelActive(e),key:"landing-panel",heading:a.widgetLabel,headingLevel:s,messages:a,messagesCommon:i,sketchViewModel:l,snappingControls:n},W("div",{class:L.panelContent},r&&W("div",{key:"edit-actions",class:L.panelContentSection},this._renderUpdateActions(e)),o>0&&W("div",{key:"create-actions",class:L.panelContentSection},this._renderCreateActions()),d&&W("div",{key:"no-content",class:L.panelContentMessage},a.noEditableLayers)))}_renderUpdateActions(e){const{messages:t,messagesCommon:s}=this;return W("div",{key:"update-actions"},W(y,{level:k(this.headingLevel)},t.editFeatures),W("calcite-list",{selectionMode:"single",selectionAppearance:"border"},W("calcite-list-item",{selected:"awaiting-feature-to-update"===e,label:s.select,onCalciteListItemSelect:this._handleEdit},W("calcite-icon",{icon:"cursor",slot:"content-start"}))))}_renderCreateActions(){const{_featureTemplates:e,headingLevel:t,messages:s}=this;return W("div",{key:"create-actions"},W(y,{level:k(t)},s.createFeatures),W("div",{key:"templates",class:L.featureTemplatesContainer},e.render()))}_renderFeatureList(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:n,messagesCommon:o,messagesTemplates:r,_snappingControls:l,viewModel:{editableItems:d,sketchViewModel:c}}=this,p=this._assertActiveUpdateWorkflow().data.candidates,m=E(n.multipleFeaturesTemplate,{total:p.length}),h=new Map;let u=0;p.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,a=this._filterText.toLowerCase(),{title:i}=s.layer,n=d.find((e=>e.layer===s.layer));if(!n)return null;const{attachmentsOnUpdateEnabled:o,supports:r}=n;return(r.includes("update")||r.includes("delete")||o)&&(!a||t?.toLowerCase().includes(a)||i?.toLowerCase().includes(a))})).filter(a).forEach((e=>{u++;const t=e.data.layer;h.has(t)?h.get(t)?.items.push(e):h.set(t,{id:`${t.id}`,label:t.title??"",items:[e]})}));const g=d.toArray().map((({layer:e})=>h.get(e))).filter(a),w=u>10||this._filterText.length>0;return W(t,{active:this._isPanelActive(e),key:"feature-list",heading:m,headingLevel:i,handleBack:s,messages:n,messagesCommon:o,sketchViewModel:c,snappingControls:l},W("div",{class:L.panelContent},W("div",{class:L.panelContentSection},b({id:this.id,enableListScroll:!1,filterEnabled:w,filterText:this._filterText,items:g,messages:{filterPlaceholder:r.filterPlaceholder,noItems:r.noItems,noMatches:r.noMatches},onItemMouseEnter:e=>this._setCandidateFeature(e.data),onItemMouseLeave:()=>this._setCandidateFeature(null),onItemSelect:e=>this._setCandidateFeature(e.data,!0),onFilterChange:e=>this._filterText=e}))))}EditorPanel(e,...t){const{handleBack:s,heading:a,headingLevel:i,key:n,messages:o,messagesCommon:r,sketchViewModel:l,snappingControls:d}=e,{snappingControls:c,undoRedoButtons:p}=this.visibleElements;return W("calcite-flow-item",{bind:this,key:n,heading:a,headingLevel:i,closable:!1,onCalciteFlowItemBack:s??void 0},W("div",{key:"panel-toolbar",class:L.panelToolbar},c&&W("calcite-accordion",{class:L.snappingSettingsContainer,appearance:"transparent"},W("calcite-accordion-item",{heading:o?.snapping,iconStart:"vertex-gps"},d.render())),p&&[W("calcite-button",{key:"undo-button",label:r.undo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"undo",scale:"l",disabled:!l.canUndo(),onclick:l.undo.bind(l)},r.undo),W("calcite-button",{key:"redo-button",label:r.redo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"redo",scale:"l",disabled:!l.canRedo(),onclick:l.redo.bind(l)},r.redo)]),...t)}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:a}=e,i=m(t);return i&&a[i]&&`${a[i]}`||E(this.messages.untitledFeatureTemplate,{id:a[s]})}_handleDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.viewModel.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}}}_handleSave(){const{featureFormViewModel:e}=this.viewModel;e.submit(),!e.submittable||e.validateContingencyConstraints(e.getValues(),{includeIncompleteViolations:!0}).length>0||this.viewModel.activeWorkflow?.commit()}_handleAttachmentAdd(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.addFile(),e.previous()):this._attachments.addAttachment().then((()=>e.previous())))}_handleAttachmentUpdate(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.previous()):this._attachments.updateAttachment().then((()=>e.previous())))}_handleAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?(e.deleteFile(),t.previous(),this._clearPrompt()):e.deleteAttachment(e.viewModel.activeAttachmentInfo).then((()=>{t.previous(),this._clearPrompt()})))}},secondary:{label:e.keepAttachment,action:this._clearPrompt}}}}_handleAdd(){this.viewModel.canCreate}async _handleEdit(e){const{viewModel:t}=this;if(!t.canUpdate)return;e.target.selected?await t.startUpdateWorkflowAtFeatureSelection():t.activeWorkflow&&await t.cancelWorkflow()}async _handleBack(e){e?.stopPropagation();const t=this.activeWorkflow;if(!t||!this._canGoBack)return;const s=i(),a=async()=>{await(t.hasPreviousStep?t.previous({cancelCurrentStep:!0}):this.viewModel.cancelWorkflow({force:!0})),s.resolve()},n="create"===t.type;if(n||"create-features"===t.type&&t.numPendingFeatures>0||"editing-existing-feature"===t.stepId&&t.data.edits.modified){const{messages:e}=this;this._prompt={title:n?e.cancelAddTitle:e.cancelEditTitle,message:n?e.cancelAddWarningMessage:e.cancelEditWarningMessage,context:"danger",actions:{primary:{label:n?e.discardFeature:e.discardEdits,action:()=>{this._clearPrompt(),a()}},secondary:{label:n?e.continueAdding:e.continueEditing,action:this._clearPrompt}}}}else a();return s.promise}_assertActiveUpdateWorkflow(){const e=this.viewModel.activeWorkflow;if("update"===e?.type)return e;throw new Error("Expected activeWorkflow to be an UpdateWorkflow")}get _canGoBack(){return a(this.activeWorkflow)&&!this.viewModel.syncing}get _shouldShowDeleteButton(){const{activeWorkflow:e}=this;return!!e&&"update"===e.type&&e.data.editableItem.supports.includes("delete")}get _shouldShowAttachments(){const e=this.activeWorkflow;if(!e)return!1;if("update"===e.type)return e.data.editableItem.attachmentsOnUpdateEnabled;const t=e.data.creationInfo;if(!t)return!1;const{layerInfos:s}=this,{layer:a}=t,i=this.viewModel.editableItems.find((e=>e.layer===a));if(i)return i.attachmentsOnCreateEnabled;const{data:n}=a.capabilities,o=s&&s.find((e=>e.layer===a));return"supportsAttachment"in n&&n.supportsAttachment&&(!o||!1!==o.allowAttachments&&!1!==o.attachmentsOnUpdateEnabled)}};function $(e){const{disabled:t,class:s,key:a,clickHandler:i,label:n,...o}=e;return W("calcite-button",{class:s,disabled:t??!1,key:a,onclick:i,type:"button",...o},n)}e([d()],V.prototype,"_attachments",void 0),e([d()],V.prototype,"_filterText",void 0),e([d()],V.prototype,"_prompt",void 0),e([d({readOnly:!0})],V.prototype,"activeWorkflow",null),e([d()],V.prototype,"allowedWorkflows",null),e([d()],V.prototype,"useDeprecatedCreateWorkflow",void 0),e([d()],V.prototype,"headingLevel",void 0),e([d()],V.prototype,"iconClass",void 0),e([d()],V.prototype,"label",null),e([d()],V.prototype,"labelOptions",null),e([d()],V.prototype,"layerInfos",null),e([d(),A("esri/widgets/Editor/t9n/Editor")],V.prototype,"messages",void 0),e([d(),A("esri/t9n/common")],V.prototype,"messagesCommon",void 0),e([d(),A("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],V.prototype,"messagesTemplates",void 0),e([d()],V.prototype,"snappingOptions",null),e([d()],V.prototype,"tooltipOptions",null),e([d()],V.prototype,"supportingWidgetDefaults",void 0),e([d()],V.prototype,"view",null),e([d(),F(["workflow-cancel","workflow-commit"])],V.prototype,"viewModel",void 0),e([d()],V.prototype,"visibleElements",void 0),e([c("visibleElements")],V.prototype,"castVisibleElements",null),e([M()],V.prototype,"_handleDelete",null),e([M()],V.prototype,"_handleAttachmentAdd",null),e([M()],V.prototype,"_handleAttachmentUpdate",null),e([M()],V.prototype,"_handleAttachmentDelete",null),e([M()],V.prototype,"_handleAdd",null),e([M()],V.prototype,"_handleEdit",null),e([M()],V.prototype,"_handleBack",null),e([d()],V.prototype,"_canGoBack",null),e([d()],V.prototype,"_shouldShowDeleteButton",null),e([d()],V.prototype,"_shouldShowAttachments",null),V=e([p(U)],V);const x=V;export{x as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import s from"../core/Logger.js";import{isSome as a}from"../core/maybe.js";import{createDeferred as i}from"../core/promiseUtils.js";import{watch as n,on as o,when as r,initial as l}from"../core/reactiveUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{cast as c}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import h from"./Attachments.js";import u from"./FeatureForm.js";import g from"./FeatureTemplates.js";import _ from"./Spinner.js";import w from"./Widget.js";import{workflowDeprecation as f}from"./Editor/deprecationUtils.js";import v from"./Editor/EditorViewModel.js";import{ItemList as k}from"./FeatureTemplates/ItemList.js";import{Heading as b,incrementHeadingLevel as y}from"./support/Heading.js";import C from"./support/SnappingControls.js";import{accessibleHandler as M}from"./support/decorators/accessibleHandler.js";import{messageBundle as A}from"./support/decorators/messageBundle.js";import{vmEvent as F}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import{substitute as E}from"../intl/substitute.js";const T="esri-editor",B=`${T}__panel`,S=`${T}__prompt`,L={base:`${T} esri-widget esri-widget--panel`,message:`${T}__message`,actions:`${T}__actions`,actionButton:`${T}_action-button`,progressBar:`${T}__progress-bar`,panelToolbar:`${B}-toolbar`,panelContent:`${B}-content`,panelContentMessage:`${B}-content__message`,panelContentSection:`${B}-content__section`,panelContentSectionGroup:`${B}-content__section__group`,snappingSettingsContainer:`${T}__snapping-settings`,updateFeaturesActionButtons:`${T}__update-features-action-buttons`,updateFeaturesActionButtonsButton:`${T}__update-features-action-buttons--button`,featureTemplatesContainer:`${T}__feature-templates-container`,promptContainer:S,promptHeader:`${S}__header`,promptHeading:`${S}__header__heading`,promptMessage:`${S}__message`,promptDivider:`${S}__divider`,promptActions:`${S}__actions`,warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit"},P={undoRedoButtons:!1,snappingControls:!0,snappingControlsElements:{header:!1,enabledToggle:!0,selfEnabledToggle:!0,featureEnabledToggle:!0,layerList:!0}};function j(e){e.focus()}const I="esri.widgets.Editor",U=s.getLogger(I);let V=class extends(t(w)){constructor(e,t){super(e,t),this._candidateCommitted=!1,this._featureForm=new u,this._attachments=new h({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new g({enableListScroll:!1}),this._filterText="",this._prompt=null,this._spinner=new _,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=L.widgetIcon,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new v,this.visibleElements={...P},this._setCandidateFeature=(e,t=!1)=>{if(this._candidateCommitted)return;const s=this._assertActiveUpdateWorkflow();s.data.edits.feature=e,t&&(s.next(),this._candidateCommitted=!0)},this._clearPrompt=()=>{this._prompt=null},this._handleSave=this._handleSave.bind(this),this._handleBack=this._handleBack.bind(this),this._handleDelete=this._handleDelete.bind(this),this._handleAdd=this._handleAdd.bind(this),this._handleEdit=this._handleEdit.bind(this),this._handleAttachmentAdd=this._handleAttachmentAdd.bind(this),this._handleAttachmentUpdate=this._handleAttachmentUpdate.bind(this),this._handleAttachmentDelete=this._handleAttachmentDelete.bind(this),this.EditorPanel=this.EditorPanel.bind(this)}initialize(){const{view:e,snappingOptions:t}=this;this._snappingControls=new C({layerListOpen:!1,snappingOptions:t,view:e,visibleElements:this.visibleElements.snappingControlsElements});const s=()=>this.scheduleRender();this.addHandles([n((()=>y(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),o((()=>this.viewModel.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{this.viewModel.activeWorkflow&&await this.viewModel.cancelWorkflow(),e&&e.id!==t?.id&&(this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(e):this.startCreateFeaturesWorkflowAtFeatureCreation(e))})),n((()=>this.viewModel.selectedTemplateItem),(e=>this._featureTemplates.select(e,!1))),n((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?.featureFormViewModel??null,this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null}),l),n((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),l),o((()=>this.viewModel?.sketchViewModel),"create",s),o((()=>this.viewModel?.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._clearPrompt()}},secondary:{label:s.form.no,action:()=>{e.deny(),this._clearPrompt()}}}}})),r((()=>this.supportingWidgetDefaults),(e=>{this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch)}),l),r((()=>this._attachments?.error),(e=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:s.form.ok,action:this._clearPrompt}}}})),r((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:a,cancel:i}]=e;this._prompt={title:t.errorWarningTitle,message:E(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{a(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{i(),this._clearPrompt()}}}}})),n((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText="";break;case"awaiting-update-feature-candidate":this._candidateCommitted=!1}})),n((()=>[this._attachments?.selectedFile,this._attachments?.submitting]),s),n((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),o((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this._handleBack()}))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._snappingControls.destroy()}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-accordion-item.js"),import("@esri/calcite-components/dist/components/calcite-accordion.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow-item.js"),import("@esri/calcite-components/dist/components/calcite-flow-item.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-scrim.js")])}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){this.viewModel.allowedWorkflows=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){const t={...P,...e,snappingControlsElements:{...P.snappingControlsElements,...e?.snappingControlsElements}};return a(this._snappingControls)&&(this._snappingControls.visibleElements=t.snappingControlsElements),t}startCreateWorkflowAtFeatureTypeSelection(){return f(U,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return f(U,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return f(U,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{_attachments:e,_prompt:t,viewModel:s}=this;if(!s)return W("div",{class:L.base});const i=a(t)&&W("calcite-scrim",null,this._renderPrompt(t)),{state:n}=s,o=s.syncing||e.submitting;return W("div",{class:L.base},o&&this._renderProgressBar(),W("calcite-flow",null,s.pageStack.map((e=>this._renderPage(e,n))),this._renderPage(s.page,n)),i)}_renderPage(e,t){switch(e){case"disabled":break;case"ready":return this._renderLanding(t);case"awaiting-feature-creation-info":return this._renderTemplates(t);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this._renderAttributeEditing(t);case"awaiting-update-feature-candidate":return this._renderFeatureList(t);case"adding-attachment":return this._renderAttachmentAdding(t);case"editing-attachment":return this._renderAttachmentEditing(t)}return W("div",null)}_isPanelActive(e){return this.viewModel.state===e}_renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:a,messagesCommon:i,_handleBack:n,_snappingControls:o,viewModel:{sketchViewModel:r}}=this;return W(t,{active:this._isPanelActive(e),key:"templates-panel",handleBack:n,heading:a.selectTemplate,headingLevel:s,messages:a,messagesCommon:i,sketchViewModel:r,snappingControls:o},W("div",{class:L.panelContent},this._featureTemplates.render()),this._renderFooterActions([this._backButtonInfo]))}_renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:a,messagesCommon:i,headingLevel:n,_handleBack:o,_snappingControls:r,viewModel:l}=this;if(!t)return null;const d=t.type,c=l.featureFormViewModel,p="update"===d&&!t.data.edits.modified||l.syncing||c.updating,m="update"===d?a.editFeature:a.createFeatures,h="update"===d?i.update:i.create,u="create-features"===d&&"create-new"===t.createFeatureState,g="create-features"===d?t.numPendingFeatures:0,_=g>1?E(a.createFeaturesTemplate,{numFeatures:g}):h,w=this._shouldShowAttachments,f=c.inputFields.every((e=>!e.visible))&&!w?this._renderMessage(E(a.clickToFinishTemplate,{button:h})):W("div",{key:"panel-content-section",class:L.panelContentSection},W("div",{class:L.panelContentSectionGroup},this._featureForm.render(),w&&W("div",{key:"attachments"},W(b,{level:y(n)},a.attachments),this._attachments.render())));return W(s,{active:this._isPanelActive(e),key:"attribute-editing-panel",heading:m,headingLevel:n,handleBack:o,messages:a,messagesCommon:i,sketchViewModel:l.sketchViewModel,snappingControls:r},W("div",{key:"panel-content",class:L.panelContent},f,u&&W("calcite-scrim",null)),this._renderFooterActions([this._backButtonInfo,{clickHandler:this._handleSave,disabled:p,label:_,type:"primary"},this._shouldShowDeleteButton?{...this._deleteButtonCommonInfo,clickHandler:this._handleDelete,disabled:l.syncing,label:i.delete}:null]))}_renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_handleBack:a,headingLevel:i,messages:n,messagesCommon:o,_snappingControls:r,viewModel:{sketchViewModel:l}}=this;return W(s,{active:this._isPanelActive(e),key:"attachment-adding-panel",heading:n.addAttachment,headingLevel:i,handleBack:a,messages:n,messagesCommon:o,sketchViewModel:l,snappingControls:r},W("div",{class:L.panelContent},t.render()),this._renderFooterActions([{label:t.submitting?o.cancel:o.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentAdd},this._backButtonInfo]))}_renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_handleBack:a,headingLevel:i,messages:n,messagesCommon:o,_snappingControls:r,viewModel:{sketchViewModel:l}}=this;return W(s,{active:this._isPanelActive(e),key:"attachment-editing-panel",heading:n.editAttachment,headingLevel:i,handleBack:a,messages:n,messagesCommon:o,sketchViewModel:l,snappingControls:r},W("div",{class:L.panelContent},t.render()),this._renderFooterActions([this._backButtonInfo,{label:o.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentUpdate},{...this._deleteButtonCommonInfo,clickHandler:this._handleAttachmentDelete,disabled:t.submitting,label:o.delete}]))}_renderMessage(e){return W("div",{key:"panel-content-message",class:L.panelContentMessage},e)}_renderFooterActions(e){return W("div",{key:"footer-actions",slot:"footer",class:L.actions},e.filter(a).map((({type:e,disabled:t,class:s,clickHandler:a,label:i,...n},o)=>W("calcite-button",{key:`action-${o}`,slot:"footer-actions",class:this.classes(s,L.actionButton),disabled:t??!1,onclick:a,width:"full",...n},i))))}_renderPrompt({title:e,message:t,context:s,actions:a}){const i=a.secondary,n=W("calcite-button",{appearance:"solid",kind:"danger"===s?"danger":"brand",width:i?"half":"full",onclick:a.primary.action,key:"prompt-primary-button",afterCreate:j},a.primary.label),o=i&&W("calcite-button",{appearance:"outline",kind:"danger"===s?"danger":"brand",width:"half",onclick:i.action,key:"prompt-secondary-button"},i.label);return W("div",{class:`${L.promptContainer}--${s}`},W("div",{class:L.promptHeader},W("calcite-icon",{icon:"exclamation-mark-triangle"}),W(b,{class:L.promptHeading,level:this.headingLevel},e)),W("div",{class:L.promptMessage},t),W("div",{class:L.promptDivider}),W("div",{class:L.promptActions},o,n))}_renderProgressBar(){return W("div",{class:this.classes(L.progressBar),key:"progress-bar"})}_renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:a,messagesCommon:i,_snappingControls:n,_featureTemplates:{viewModel:{numberOfFeatureTemplates:o}},viewModel:{canUpdate:r,sketchViewModel:l}}=this,d=!r&&0===o;return W(t,{active:this._isPanelActive(e),key:"landing-panel",heading:a.widgetLabel,headingLevel:s,messages:a,messagesCommon:i,sketchViewModel:l,snappingControls:n},W("div",{class:L.panelContent},r&&W("div",{key:"edit-actions",class:L.panelContentSection},this._renderUpdateActions(e)),o>0&&W("div",{key:"create-actions",class:L.panelContentSection},this._renderCreateActions()),d&&W("div",{key:"no-content",class:L.panelContentMessage},a.noEditableLayers)))}_renderUpdateActions(e){const{messages:t,messagesCommon:s}=this;return W("div",{key:"update-actions"},W(b,{level:y(this.headingLevel)},t.editFeatures),W("calcite-list",{selectionMode:"single",selectionAppearance:"border"},W("calcite-list-item",{selected:"awaiting-feature-to-update"===e,label:s.select,onCalciteListItemSelect:this._handleEdit},W("calcite-icon",{icon:"cursor",slot:"content-start"}))))}_renderCreateActions(){const{_featureTemplates:e,headingLevel:t,messages:s}=this;return W("div",{key:"create-actions"},W(b,{level:y(t)},s.createFeatures),W("div",{key:"templates",class:L.featureTemplatesContainer},e.render()))}_renderFeatureList(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:n,messagesCommon:o,messagesTemplates:r,_snappingControls:l,viewModel:{editableItems:d,sketchViewModel:c}}=this,p=this._assertActiveUpdateWorkflow().data.candidates,m=E(n.multipleFeaturesTemplate,{total:p.length}),h=new Map;let u=0;p.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,a=this._filterText.toLowerCase(),{title:i}=s.layer,n=d.find((e=>e.layer===s.layer));if(!n)return null;const{attachmentsOnUpdateEnabled:o,supports:r}=n;return(r.includes("update")||r.includes("delete")||o)&&(!a||t?.toLowerCase().includes(a)||i?.toLowerCase().includes(a))})).filter(a).forEach((e=>{u++;const t=e.data.layer;h.has(t)?h.get(t)?.items.push(e):h.set(t,{id:`${t.id}`,label:t.title??"",items:[e]})}));const g=d.toArray().map((({layer:e})=>h.get(e))).filter(a),_=u>10||this._filterText.length>0;return W(t,{active:this._isPanelActive(e),key:"feature-list",heading:m,headingLevel:i,handleBack:s,messages:n,messagesCommon:o,sketchViewModel:c,snappingControls:l},W("div",{class:L.panelContent},W("div",{class:L.panelContentSection},k({id:this.id,enableListScroll:!1,filterEnabled:_,filterText:this._filterText,items:g,messages:{filterPlaceholder:r.filterPlaceholder,noItems:r.noItems,noMatches:r.noMatches},onItemMouseEnter:e=>this._setCandidateFeature(e.data),onItemMouseLeave:()=>this._setCandidateFeature(null),onItemSelect:e=>this._setCandidateFeature(e.data,!0),onFilterChange:e=>this._filterText=e}))),this._renderFooterActions([this._backButtonInfo]))}EditorPanel(e,...t){const{handleBack:s,heading:a,headingLevel:i,key:n,messages:o,messagesCommon:r,sketchViewModel:l,snappingControls:d}=e,{snappingControls:c,undoRedoButtons:p}=this.visibleElements;return W("calcite-flow-item",{bind:this,key:n,heading:a,headingLevel:i,closable:!1,onCalciteFlowItemBack:s??void 0},W("div",{key:"panel-toolbar",class:L.panelToolbar},c&&W("calcite-accordion",{class:L.snappingSettingsContainer,appearance:"transparent"},W("calcite-accordion-item",{heading:o?.snapping,iconStart:"vertex-gps"},d.render())),p&&[W("calcite-button",{key:"undo-button",label:r.undo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"undo",scale:"l",disabled:!l.canUndo(),onclick:l.undo.bind(l)},r.undo),W("calcite-button",{key:"redo-button",label:r.redo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"redo",scale:"l",disabled:!l.canRedo(),onclick:l.redo.bind(l)},r.redo)]),...t)}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:a}=e,i=m(t);return i&&a[i]&&`${a[i]}`||E(this.messages.untitledFeatureTemplate,{id:a[s]})}_handleDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.viewModel.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}}}_handleSave(){const{featureFormViewModel:e}=this.viewModel;e.submit(),!e.submittable||e.validateContingencyConstraints(e.getValues(),{includeIncompleteViolations:!0}).length>0||this.viewModel.activeWorkflow?.commit()}_handleAttachmentAdd(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.addFile(),e.previous()):this._attachments.addAttachment().then((()=>e.previous())))}_handleAttachmentUpdate(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.previous()):this._attachments.updateAttachment().then((()=>e.previous())))}_handleAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?(e.deleteFile(),t.previous(),this._clearPrompt()):e.deleteAttachment(e.viewModel.activeAttachmentInfo).then((()=>{t.previous(),this._clearPrompt()})))}},secondary:{label:e.keepAttachment,action:this._clearPrompt}}}}_handleAdd(){this.viewModel.canCreate}async _handleEdit(e){const{viewModel:t}=this;if(!t.canUpdate)return;e.target.selected?await t.startUpdateWorkflowAtFeatureSelection():t.activeWorkflow&&await t.cancelWorkflow()}async _handleBack(e){e?.stopPropagation();const t=this.activeWorkflow;if(!t||!this._canGoBack)return;const s=i(),a=async()=>{await(t.hasPreviousStep?t.previous({cancelCurrentStep:!0}):this.viewModel.cancelWorkflow({force:!0})),s.resolve()},n="create"===t.type;if(n||"create-features"===t.type&&t.numPendingFeatures>0||"editing-existing-feature"===t.stepId&&t.data.edits.modified){const{messages:e}=this;this._prompt={title:n?e.cancelAddTitle:e.cancelEditTitle,message:n?e.cancelAddWarningMessage:e.cancelEditWarningMessage,context:"danger",actions:{primary:{label:n?e.discardFeature:e.discardEdits,action:()=>{this._clearPrompt(),a()}},secondary:{label:n?e.continueAdding:e.continueEditing,action:this._clearPrompt}}}}else a();return s.promise}_assertActiveUpdateWorkflow(){const e=this.viewModel.activeWorkflow;if("update"===e?.type)return e;throw new Error("Expected activeWorkflow to be an UpdateWorkflow")}get _canGoBack(){return a(this.activeWorkflow)&&!this.viewModel.syncing}get _shouldShowDeleteButton(){const{activeWorkflow:e}=this;return!!e&&"update"===e.type&&e.data.editableItem.supports.includes("delete")}get _shouldShowAttachments(){const e=this.activeWorkflow;if(!e)return!1;if("update"===e.type)return e.data.editableItem.attachmentsOnUpdateEnabled;const t=e.data.creationInfo;if(!t)return!1;const{layerInfos:s}=this,{layer:a}=t,i=this.viewModel.editableItems.find((e=>e.layer===a));if(i)return i.attachmentsOnCreateEnabled;const{data:n}=a.capabilities,o=s&&s.find((e=>e.layer===a));return"supportsAttachment"in n&&n.supportsAttachment&&(!o||!1!==o.allowAttachments&&!1!==o.attachmentsOnUpdateEnabled)}get _backButtonInfo(){return{appearance:"outline",clickHandler:this._handleBack,label:this.messagesCommon.back,type:"secondary"}}get _deleteButtonCommonInfo(){return{appearance:"transparent",kind:"danger",type:"primary"}}};e([d()],V.prototype,"_attachments",void 0),e([d()],V.prototype,"_filterText",void 0),e([d()],V.prototype,"_prompt",void 0),e([d({readOnly:!0})],V.prototype,"activeWorkflow",null),e([d()],V.prototype,"allowedWorkflows",null),e([d()],V.prototype,"useDeprecatedCreateWorkflow",void 0),e([d()],V.prototype,"headingLevel",void 0),e([d()],V.prototype,"iconClass",void 0),e([d()],V.prototype,"label",null),e([d()],V.prototype,"labelOptions",null),e([d()],V.prototype,"layerInfos",null),e([d(),A("esri/widgets/Editor/t9n/Editor")],V.prototype,"messages",void 0),e([d(),A("esri/t9n/common")],V.prototype,"messagesCommon",void 0),e([d(),A("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],V.prototype,"messagesTemplates",void 0),e([d()],V.prototype,"snappingOptions",null),e([d()],V.prototype,"tooltipOptions",null),e([d()],V.prototype,"supportingWidgetDefaults",void 0),e([d()],V.prototype,"view",null),e([d(),F(["workflow-cancel","workflow-commit"])],V.prototype,"viewModel",void 0),e([d()],V.prototype,"visibleElements",void 0),e([c("visibleElements")],V.prototype,"castVisibleElements",null),e([M()],V.prototype,"_handleDelete",null),e([M()],V.prototype,"_handleAttachmentAdd",null),e([M()],V.prototype,"_handleAttachmentUpdate",null),e([M()],V.prototype,"_handleAttachmentDelete",null),e([M()],V.prototype,"_handleAdd",null),e([M()],V.prototype,"_handleEdit",null),e([M()],V.prototype,"_handleBack",null),e([d()],V.prototype,"_canGoBack",null),e([d()],V.prototype,"_shouldShowDeleteButton",null),e([d()],V.prototype,"_shouldShowAttachments",null),e([d()],V.prototype,"_backButtonInfo",null),e([d()],V.prototype,"_deleteButtonCommonInfo",null),V=e([p(I)],V);const $=V;export{$ 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.26/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{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";let l=class extends t{constructor(e){super(e),this._vendorInfo=null,this._fullscreenStyle="width: 100%; height: 100%;",this.view=null,this._errorHandler=this._errorHandler.bind(this),this._stateHandler=this._stateHandler.bind(this)}destroy(){this._removeFullscreenListeners(),this.view=null}get element(){return this.view?.container??null}set element(e){this._override("element",e)}get state(){return this.element?this._isSupported()?this._isActive()?"active":"ready":"feature-unsupported":"disabled"}enter(){this._enterFullscreen()}exit(){this._exitFullscreen()}toggle(){this._isActive()?this._exitFullscreen():this._enterFullscreen()}_isSupported(){this._removeFullscreenListeners();const e=this._getVendorInfo(this.element);return this._addFullscreenListeners(e),this._vendorInfo=e,!!e}_isActive(){return!!this._vendorInfo&&!!document[this._vendorInfo.propertyName]}_stateHandler(){this.notifyChange("state"),"active"===this.state?this._addStyle():this._removeStyle()}_errorHandler(e){r.getLogger(this.declaredClass).error("fullscreen request failed",e)}_getVendorInfo(e){if(e)return e.requestFullscreen?{enterName:"requestFullscreen",exitName:"exitFullscreen",errorEventName:"fullscreenerror",changeEventName:"fullscreenchange",propertyName:"fullscreen"}:e.webkitRequestFullScreen?{enterName:"webkitRequestFullscreen",exitName:"webkitCancelFullScreen",errorEventName:"webkitfullscreenerror",changeEventName:"webkitfullscreenchange",propertyName:"webkitIsFullScreen"}:e.mozRequestFullScreen?{enterName:"mozRequestFullScreen",exitName:"mozCancelFullScreen",errorEventName:"mozfullscreenerror",changeEventName:"mozfullscreenchange",propertyName:"mozFullScreen"}:e.msRequestFullscreen?{enterName:"msRequestFullscreen",exitName:"msExitFullscreen",errorEventName:"MSFullscreenError",changeEventName:"MSFullscreenChange",propertyName:"msFullscreenElement"}:void 0}_enterFullscreen(){if("feature-unsupported"===this.state)return void r.getLogger(this.declaredClass).warn("The fullscreen API is not supported in this browser.");const{element:e}=this;e&&(e[this._vendorInfo.enterName].call(e),this.notifyChange("state"))}_addStyle(){const{element:e}=this;e&&e.setAttribute("style",this._fullscreenStyle)}_removeStyle(){const{element:e}=this;e&&e.removeAttribute("style")}_exitFullscreen(){if("feature-unsupported"===this.state)return;const{element:e}=this;e&&(document[this._vendorInfo.exitName].call(document),this.notifyChange("state"))}_addFullscreenListeners(e){e&&(document.addEventListener(e.changeEventName,this._stateHandler),document.addEventListener(e.errorEventName,this._errorHandler))}_removeFullscreenListeners(){const{_vendorInfo:e}=this;this._vendorInfo&&(document.removeEventListener(e.changeEventName,this._stateHandler),document.removeEventListener(e.errorEventName,this._errorHandler))}};e([s()],l.prototype,"element",null),e([s({readOnly:!0})],l.prototype,"state",null),e([s()],l.prototype,"view",void 0),e([s()],l.prototype,"enter",null),e([s()],l.prototype,"exit",null),e([s()],l.prototype,"toggle",null),l=e([n("esri.widgets.Fullscreen.FullscreenViewModel")],l);const o=l;export{o as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";let l=class extends t{constructor(e){super(e),this._vendorInfo=null,this._fullscreenStyle="width: 100%; height: 100%;",this.view=null,this._errorHandler=this._errorHandler.bind(this),this._stateHandler=this._stateHandler.bind(this)}destroy(){this._removeFullscreenListeners(),this.view=null}get element(){return this.view?.container??null}set element(e){this._override("element",e)}get state(){return this.element?this._isSupported()?this._isActive()?"active":"ready":"feature-unsupported":"disabled"}enter(){this._enterFullscreen()}exit(){this._exitFullscreen()}toggle(){this._isActive()?this._exitFullscreen():this._enterFullscreen()}_isSupported(){this._removeFullscreenListeners();const e=this._getVendorInfo(this.element);return this._addFullscreenListeners(e),this._vendorInfo=e,!!e}_isActive(){return!!this._vendorInfo&&!!document[this._vendorInfo.propertyName]}_stateHandler(){this.notifyChange("state"),"active"===this.state?this._addStyle():this._removeStyle()}_errorHandler(e){r.getLogger(this.declaredClass).error("fullscreen request failed",e)}_getVendorInfo(e){if(e)return e.requestFullscreen?{enterName:"requestFullscreen",exitName:"exitFullscreen",errorEventName:"fullscreenerror",changeEventName:"fullscreenchange",propertyName:"fullscreen"}:e.webkitRequestFullScreen?{enterName:"webkitRequestFullscreen",exitName:"webkitCancelFullScreen",errorEventName:"webkitfullscreenerror",changeEventName:"webkitfullscreenchange",propertyName:"webkitIsFullScreen"}:e.mozRequestFullScreen?{enterName:"mozRequestFullScreen",exitName:"mozCancelFullScreen",errorEventName:"mozfullscreenerror",changeEventName:"mozfullscreenchange",propertyName:"mozFullScreen"}:e.msRequestFullscreen?{enterName:"msRequestFullscreen",exitName:"msExitFullscreen",errorEventName:"MSFullscreenError",changeEventName:"MSFullscreenChange",propertyName:"msFullscreenElement"}:void 0}_enterFullscreen(){if("feature-unsupported"===this.state)return void r.getLogger(this.declaredClass).warn("The fullscreen API is not supported in this browser.");const{element:e}=this;e&&(this._vendorInfo&&e[this._vendorInfo.enterName].call(e),this.notifyChange("state"))}_addStyle(){const{element:e}=this;e&&e.setAttribute("style",this._fullscreenStyle)}_removeStyle(){const{element:e}=this;e&&e.removeAttribute("style")}_exitFullscreen(){if("feature-unsupported"===this.state)return;const{element:e}=this;e&&(this._vendorInfo&&document[this._vendorInfo.exitName].call(document),this.notifyChange("state"))}_addFullscreenListeners(e){e&&(document.addEventListener(e.changeEventName,this._stateHandler),document.addEventListener(e.errorEventName,this._errorHandler))}_removeFullscreenListeners(){const{_vendorInfo:e}=this;e&&(document.removeEventListener(e.changeEventName,this._stateHandler),document.removeEventListener(e.errorEventName,this._errorHandler))}};e([s()],l.prototype,"element",null),e([s({readOnly:!0})],l.prototype,"state",null),e([s()],l.prototype,"view",void 0),e([s()],l.prototype,"enter",null),e([s()],l.prototype,"exit",null),e([s()],l.prototype,"toggle",null),l=e([n("esri.widgets.Fullscreen.FullscreenViewModel")],l);const o=l;export{o as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../Viewpoint.js";import e from"../../core/Error.js";import i from"../../core/Evented.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{GoToMixin as n}from"../support/GoTo.js";let l=class extends(n(i.EventedAccessor)){constructor(o){super(o),this._initialViewpoint=null,this._goingHomeController=null,this.go=this.go.bind(this)}destroy(){this._cancelGo(),this.view=null}get state(){return this.get("view.ready")?this._goingHomeController?"going-home":"ready":"disabled"}set view(o){this._initialViewpoint=null,this._set("view",o),o&&o.when().then((()=>{this.view===o&&(this._initialViewpoint=o.viewpoint.clone(),this.notifyChange("viewpoint"))}))}get viewpoint(){return this._get("viewpoint")||this._initialViewpoint}set viewpoint(o){this._set("viewpoint",o)}async go(){if(!this.get("view.ready"))throw new e("home:disabled-state","Cannot go when disabled.");this._cancelGo(),this.emit("go");const o=new AbortController;this._goingHomeController=o;try{await this.view.when(),await this.callGoTo({target:this.viewpoint,options:{signal:o.signal}})}catch(t){}this._goingHomeController=null}cancelGo(){this._cancelGo()}_cancelGo(){const{_goingHomeController:o}=this;o&&o.abort(),this._goingHomeController=null}};o([r()],l.prototype,"_goingHomeController",void 0),o([r({readOnly:!0})],l.prototype,"state",null),o([r()],l.prototype,"view",null),o([r({type:t})],l.prototype,"viewpoint",null),o([r()],l.prototype,"go",null),o([r()],l.prototype,"cancelGo",null),l=o([s("esri.widgets.Home.HomeViewModel")],l);const p=l;export{p as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../Viewpoint.js";import e from"../../core/Error.js";import i from"../../core/Evented.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{GoToMixin as n}from"../support/GoTo.js";let l=class extends(n(i.EventedAccessor)){constructor(o){super(o),this._initialViewpoint=null,this._goingHomeController=null,this.go=this.go.bind(this)}destroy(){this._cancelGo(),this.view=null}get state(){return this.get("view.ready")?this._goingHomeController?"going-home":"ready":"disabled"}set view(o){this._initialViewpoint=null,this._set("view",o),o&&o.when().then((()=>{this.view===o&&(this._initialViewpoint=o.viewpoint.clone(),this.notifyChange("viewpoint"))}))}get viewpoint(){return this._get("viewpoint")||this._initialViewpoint}set viewpoint(o){this._set("viewpoint",o)}async go(){if(!this.get("view.ready"))throw new e("home:disabled-state","Cannot go when disabled.");this._cancelGo(),this.emit("go");const o=new AbortController;this._goingHomeController=o;try{await(this.view?.when()),await this.callGoTo({target:this.viewpoint,options:{signal:o.signal}})}catch(t){}this._goingHomeController=null}cancelGo(){this._cancelGo()}_cancelGo(){const{_goingHomeController:o}=this;o&&o.abort(),this._goingHomeController=null}};o([r()],l.prototype,"_goingHomeController",void 0),o([r({readOnly:!0})],l.prototype,"state",null),o([r()],l.prototype,"view",null),o([r({type:t})],l.prototype,"viewpoint",null),o([r()],l.prototype,"go",null),o([r()],l.prototype,"cancelGo",null),l=o([s("esri.widgets.Home.HomeViewModel")],l);const p=l;export{p as default};