/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{trackAccess as t}from"./accessorSupport/tracking.js";import{SimpleObservable as e}from"./accessorSupport/tracking/SimpleObservable.js";class s{constructor(t=t=>t.values().next().value){this._peeker=t,this._observable=new e,this._items=new Set}get length(){return t(this._observable),this._items.size}clear(){0!==this.length&&(this._items.clear(),this._observable.notify())}last(){if(0===this.length)return;let t;for(t of this._items);return t}peek(){if(0!==this.length)return this._peeker(this._items)}push(t){this.contains(t)||(this._items.add(t),this._observable.notify())}contains(e){return t(this._observable),this._items.has(e)}pop(){if(0===this.length)return;const t=this.peek();return this._items.delete(t),this._observable.notify(),t}popLast(){if(0===this.length)return;const t=this.last();return this._items.delete(t),this._observable.notify(),t}remove(t){this.contains(t)&&(this._items.delete(t),this._observable.notify())}filter(t){const e=this.length;return this._items.forEach(e=>{t(e)||this._items.delete(e)}),e!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){t(this._observable),yield*this._items}}export{s as default};
