shadow$provide.module$node_modules$pixi_DOT_js$lib$utils$pool$Pool = function(global, require, module, exports) {
  class Pool {
    constructor(ClassType, initialSize) {
      this._pool = [];
      this._index = this._count = 0;
      this._classType = ClassType;
      initialSize && this.prepopulate(initialSize);
    }
    prepopulate(total) {
      for (let i = 0; i < total; i++) {
        this._pool[this._index++] = new this._classType();
      }
      this._count += total;
    }
    get(data) {
      let item;
      0 < this._index ? item = this._pool[--this._index] : (item = new this._classType(), this._count++);
      item.init?.(data);
      return item;
    }
    return(item) {
      item.reset?.();
      this._pool[this._index++] = item;
    }
    get totalSize() {
      return this._count;
    }
    get totalFree() {
      return this._index;
    }
    get totalUsed() {
      return this._count - this._index;
    }
    clear() {
      if (0 < this._pool.length && this._pool[0].destroy) {
        for (let i = 0; i < this._index; i++) {
          this._pool[i].destroy();
        }
      }
      this._index = this._count = this._pool.length = 0;
    }
  }
  exports.Pool = Pool;
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$utils$pool$Pool.js.map
