/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../chunks/_rollupPluginBabelHelpers","../chunks/tslib.es6","../core/Accessor","../core/Collection","../core/Handles","../core/reactiveUtils","../core/accessorSupport/decorators/property","../core/arrayUtils","../core/has","../core/accessorSupport/ensureType","../core/accessorSupport/decorators/subclass","./support/GroundViewElevationSampler"],(function(e,t,r,n,s,i,a,o,l,d,p,u){"use strict";let c=function(t){function r(e){var r;return(r=t.call(this,e)||this).handles=new s,r.view=null,r.layerViews=new n,r}e._inheritsLoose(r,t);var a=r.prototype;return a.initialize=function(){this.handles.add(i.when((()=>{var e,t;return null==(e=this.view)||null==(t=e.map)?void 0:t.ground}),(e=>e.load()))),this.handles.add(this.layerViews.on("after-changes",(()=>this._layerViewsAfterChangesHandler())))},a.destroy=function(){this._set("view",null),this.handles&&(this.handles.destroy(),this.handles=null)},a._layerViewsAfterChangesHandler=function(){this.handles.remove("updating"),this.handles.add(this.layerViews.map((e=>i.watch((()=>e.updating),(()=>this._updateUpdating()),i.sync))).toArray(),"updating"),this._updateUpdating()},a._updateUpdating=function(){this.notifyChange("updating")},e._createClass(r,[{key:"elevationSampler",get:function(){return this.view?"2d"===this.view.type?null:this.view.ready&&this.view.basemapTerrain&&this.view.basemapTerrain.ready?new u({view:this.view}):null:null}},{key:"updating",get:function(){return!this.suspended&&this.layerViews.some((e=>e.updating))}},{key:"suspended",get:function(){return!this.view||this.view.suspended}}]),r}(r);t.__decorate([a.property({readOnly:!0})],c.prototype,"elevationSampler",null),t.__decorate([a.property({type:Boolean,readOnly:!0})],c.prototype,"updating",null),t.__decorate([a.property({constructOnly:!0})],c.prototype,"view",void 0),t.__decorate([a.property({type:n,readOnly:!0})],c.prototype,"layerViews",void 0),t.__decorate([a.property({readOnly:!0})],c.prototype,"suspended",null),c=t.__decorate([p.subclass("esri.views.GroundView")],c);return c}));
