/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{trackAccess as t}from"./accessorSupport/tracking.js";import{SimpleObservable as s}from"./accessorSupport/tracking/SimpleObservable.js";class e{constructor(t){this._observable=new s,this._notifyPending=!1,this._batchDepth=0,this._set=new Set(t)}get size(){return t(this._observable),this._set.size}add(t){const s=this._set.size;return this._set.add(t),this._set.size!==s&&this._notify(),this}batch(t){try{this._batchDepth++,t()}finally{this._batchDepth--,this._notifyPending&&0===this._batchDepth&&(this._notifyPending=!1,this._notify())}}clear(){this._set.size>0&&(this._set.clear(),this._notify())}delete(t){const s=this._set.delete(t);return s&&this._notify(),s}entries(){return t(this._observable),this._set.entries()}forEach(s,e){t(this._observable),this._set.forEach((t,i)=>s.call(e,t,i,this),e)}has(s){return t(this._observable),this._set.has(s)}keys(){return t(this._observable),this._set.keys()}values(){return t(this._observable),this._set.values()}[Symbol.iterator](){return t(this._observable),this._set[Symbol.iterator]()}[Symbol.dispose](){this._observable.destroy()}get[Symbol.toStringTag](){return this._set[Symbol.toStringTag]}_notify(){this._batchDepth>0?this._notifyPending=!0:this._observable.notify()}}export{e as default};
