/*
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/Error","../../core/HandleOwner","../../core/has","../../core/Logger","../../core/throttle","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","./engine/webgl/collisions/CollisionEngine"],(function(e,t,s,i,r,o,a,l,n,p,c,u,d){"use strict";const h=32;a.getLogger("esri.views.2d.layers.labels.LabelManager");let y=function(t){function s(s){var i;return(i=t.call(this,s)||this)._applyVisibilityPassThrottled=l.throttle(i._applyVisibilityPass,h,e._assertThisInitialized(i)),i.lastUpdateId=-1,i.updateRequested=!1,i.view=null,i}e._inheritsLoose(s,t);var i=s.prototype;return i.initialize=function(){this.collisionEngine=new d.CollisionEngine},i.destroy=function(){this.collisionEngine=null,this._applyVisibilityPassThrottled.remove(),this._applyVisibilityPassThrottled=null},i.update=function(e){this._applyVisibilityPassThrottled(e)},i.viewChange=function(){this.requestUpdate()},i.requestUpdate=function(){this.updateRequested||(this.updateRequested=!0,this.view.requestUpdate())},i.processUpdate=function(e){this._set("updateParameters",e),this.updateRequested&&(this.updateRequested=!1,this.update(e))},i._applyVisibilityPass=function(e){try{const t=this.view.featuresTilingScheme.getClosestInfoForScale(e.state.scale).level;this.collisionEngine.run(this.view.allLayerViews.items,e,t)}catch(t){}},e._createClass(s,[{key:"updating",get:function(){return this.updateRequested}}]),s}(r.HandleOwnerMixin(s));t.__decorate([n.property()],y.prototype,"updateRequested",void 0),t.__decorate([n.property({readOnly:!0})],y.prototype,"updateParameters",void 0),t.__decorate([n.property()],y.prototype,"updating",null),t.__decorate([n.property()],y.prototype,"view",void 0),y=t.__decorate([u.subclass("esri.views.2d.layers.labels.LabelManager")],y);return y}));
