shadow$provide.module$node_modules$pixi_DOT_js$lib$prepare$PrepareBase = function(global, require, module, exports) {
  var Container = require("module$node_modules$pixi_DOT_js$lib$scene$container$Container"), _const = require("module$node_modules$pixi_DOT_js$lib$ticker$const"), Ticker = require("module$node_modules$pixi_DOT_js$lib$ticker$Ticker");
  "use strict";
  const node_modules$pixi_DOT_js$lib$prepare$PrepareBase$classdecl$var42 = class {
    constructor(renderer) {
      this._tick = () => {
        this._destroyed || (this.timeout = setTimeout(this._processQueue, 0));
      };
      this._processQueue = () => {
        if (!this._destroyed) {
          for (var {queue} = this, itemsProcessed = 0; queue.length && itemsProcessed < node_modules$pixi_DOT_js$lib$prepare$PrepareBase$classdecl$var42.uploadsPerFrame;) {
            const queueItem = queue.shift();
            this.uploadQueueItem(queueItem);
            itemsProcessed++;
          }
          queue.length ? Ticker.Ticker.system.addOnce(this._tick, this, _const.UPDATE_PRIORITY.UTILITY) : this._resolve();
        }
      };
      this.renderer = renderer;
      this.queue = [];
      this.resolves = [];
    }
    getQueue() {
      return [...this.queue];
    }
    add(resource) {
      resource = Array.isArray(resource) ? resource : [resource];
      for (const resourceItem of resource) {
        resourceItem instanceof Container.Container ? this._addContainer(resourceItem) : this.resolveQueueItem(resourceItem, this.queue);
      }
      return this;
    }
    _addContainer(container) {
      this.resolveQueueItem(container, this.queue);
      for (const child of container.children) {
        this._addContainer(child);
      }
    }
    upload(resource) {
      resource && this.add(resource);
      return new Promise(resolve => {
        this.queue.length ? (this.resolves.push(resolve), this.dedupeQueue(), Ticker.Ticker.system.addOnce(this._tick, this, _const.UPDATE_PRIORITY.UTILITY)) : resolve();
      });
    }
    dedupeQueue() {
      const hash = Object.create(null);
      let nextUnique = 0;
      for (let i = 0; i < this.queue.length; i++) {
        const current = this.queue[i];
        hash[current.uid] || (hash[current.uid] = !0, this.queue[nextUnique++] = current);
      }
      this.queue.length = nextUnique;
    }
    destroy() {
      this._destroyed = !0;
      clearTimeout(this.timeout);
    }
    _resolve() {
      const {resolves} = this, array = resolves.slice(0);
      resolves.length = 0;
      for (const resolve of array) {
        resolve();
      }
    }
  };
  global = node_modules$pixi_DOT_js$lib$prepare$PrepareBase$classdecl$var42;
  global.uploadsPerFrame = 4;
  exports.PrepareBase = global;
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$prepare$PrepareBase.js.map
