/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{debounce as r,isAbortError as s}from"../../../core/promiseUtils.js";import{property as o,subclass as a}from"../../../core/accessorSupport/decorators.js";import{projectAsync as n}from"../../../geometry/projectionUtils.js";import l from"./DrapedSubView3D.js";import{LayerView3D as p}from"./LayerView3D.js";import{LayerViewPerformanceInfo as d}from"./support/LayerViewPerformanceInfo.js";import u from"../../layers/LayerView.js";import{RefreshableLayerView as h}from"../../layers/RefreshableLayerView.js";import{isInEffectiveScaleRange as c}from"../../support/layerViewUtils.js";let f=class extends(h(p(u))){constructor(){super(...arguments),this.fullExtentInLocalViewSpatialReference=null,this.refreshDebounced=r(async e=>{this.destroyed||await this._doRefresh(e).catch(e=>{s(e)||t.getLogger(this).error(e)})},2e3),this.ignoresMemoryFactor=!1,this.unloadedMemory=0}get visibleAtCurrentScale(){const e=this.layer,t="effectiveScaleRange"in e?e.effectiveScaleRange:null;return c(t,this.view.scale)}isUpdating(){return super.isUpdating()||this.subView?.updating}initialize(){this._initSubView(),"local"===this.view.viewingMode&&this.addResolvingPromise((async()=>this.fullExtentInLocalViewSpatialReference=await n(this.layer.fullExtent,this.view.spatialReference).catch(()=>null))()),this._updatingHandles.add(()=>this.suspended,()=>this._suspendedChangeHandler())}destroy(){this.subView=i(this.subView)}_initSubView(){this.subView=new l({layerView:this})}async doRefresh(){return this._doRefresh()}async _doRefresh(e){this.suspended||await this.subView.doRefresh(e)}getFetchOptions(){}_suspendedChangeHandler(){this.suspended?this.subView.clear():this.refreshDebounced()}get test(){}get usedMemory(){return this.subView.usedMemory}get performanceInfo(){return new d(this.usedMemory)}};e([o()],f.prototype,"layer",void 0),e([o()],f.prototype,"suspended",void 0),e([o()],f.prototype,"fullExtentInLocalViewSpatialReference",void 0),e([o({readOnly:!0})],f.prototype,"visibleAtCurrentScale",null),e([o()],f.prototype,"updating",void 0),e([o()],f.prototype,"subView",void 0),f=e([a("esri.views.3d.layers.DynamicLayerView3D")],f);export{f as default};
