/*
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/maybe","../../../core/reactiveUtils","../../../core/accessorSupport/decorators/property","../../../core/arrayUtils","../../../core/has","../../../core/accessorSupport/ensureType","../../../core/accessorSupport/decorators/subclass","./LayerView3D","./graphics/GraphicsProcessor","./support/projectExtentUtils","../webgl-engine/lib/basicInterfaces","../../layers/LayerView"],(function(e,r,t,i,s,n,o,a,l,c,u,p,d,h){"use strict";let y=function(r){function s(){var e;return(e=r.apply(this,arguments)||this).type="graphics-3d",e.slicePlaneEnabled=!1,e.fullExtentInLocalViewSpatialReference=null,e}e._inheritsLoose(s,r);var n=s.prototype;return n.initialize=function(){this._set("processor",new u.GraphicsProcessor({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.setup()),this.handles.add(this.layer.on("graphic-update",(e=>this.processor.graphicsCore.graphicUpdateHandler(e)))),this.addResolvingPromise(p.toViewIfLocal(this).then((e=>this.fullExtentInLocalViewSpatialReference=e))),this.layer.internal?this.notifyChange("updating"):this.handles.add(i.when((()=>{var e,r;return null==(e=this.view)||null==(r=e.basemapTerrain)?void 0:r.ready}),(()=>()=>this.notifyChange("updating")),{once:!0}))},n.destroy=function(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("processor",t.destroyMaybe(this.processor))},n.getSuspendInfo=function(){var e,t,i,s;const n=r.prototype.getSuspendInfo.call(this);return n.outsideScaleRange=null!=(e=null==(t=this.processor)?void 0:t.scaleVisibilitySuspended)&&e,n.outsideOfView=null!=(i=null==(s=this.processor)?void 0:s.frustumVisibilitySuspended)&&i,n},n.fetchPopupFeatures=function(){var r=e._asyncToGenerator((function*(e,r){return t.isSome(r)?r.clientGraphics:null}));function i(e,t){return r.apply(this,arguments)}return i}(),n.getHit=function(e){return this.processor.getHit(e)},n.whenGraphicBounds=function(e,r){return this.processor.whenGraphicBounds(e,r)},n.computeAttachmentOrigin=function(e,r){var t;return null==(t=this.processor)?void 0:t.computeAttachmentOrigin(e,r)},n.getSymbolLayerSize=function(e,r){return this.processor.getSymbolLayerSize(e,r)},n.queryGraphics=function(){return Promise.resolve(this.loadedGraphics)},n.maskOccludee=function(e){return this.processor.maskOccludee(e)},n.highlight=function(e){return this.processor.highlight(e)},n.canResume=function(){var e;return r.prototype.canResume.call(this)&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)},n.isUpdating=function(){var e,r,t;return!((null==(e=this.processor)||!e.updating)&&(this.layer.internal||null!=(r=this.view)&&null!=(t=r.basemapTerrain)&&t.ready))},e._createClass(s,[{key:"loadedGraphics",get:function(){return this.layer.graphics}},{key:"legendEnabled",get:function(){var e;return this.canResume()&&!(null!=(e=this.processor)&&e.frustumVisibilitySuspended)}},{key:"updatePolicy",get:function(){var e;return(null==(e=this.processor)?void 0:e.graphicsCore.effectiveUpdatePolicy)||d.UpdatePolicy.SYNC}},{key:"performanceInfo",get:function(){var e,r,t,i;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:null!=(e=null==(r=this.processor)?void 0:r.elevationAlignment.updating)&&e,visibilityFrustum:null!=(t=!(null!=(i=this.processor)&&i.frustumVisibilitySuspended))&&t}}}]),s}(c.LayerView3D(h));r.__decorate([s.property()],y.prototype,"loadedGraphics",null),r.__decorate([s.property({readOnly:!0})],y.prototype,"legendEnabled",null),r.__decorate([s.property()],y.prototype,"layer",void 0),r.__decorate([s.property({readOnly:!0})],y.prototype,"processor",void 0),r.__decorate([s.property({type:Boolean})],y.prototype,"slicePlaneEnabled",void 0),y=r.__decorate([l.subclass("esri.views.3d.layers.GraphicsLayerView3D")],y);return y}));
