import CJS_COMPAT_NODE_URL_qfbekemo7ri from 'node:url';
import CJS_COMPAT_NODE_PATH_qfbekemo7ri from 'node:path';
import CJS_COMPAT_NODE_MODULE_qfbekemo7ri from "node:module";

var __filename = CJS_COMPAT_NODE_URL_qfbekemo7ri.fileURLToPath(import.meta.url);
var __dirname = CJS_COMPAT_NODE_PATH_qfbekemo7ri.dirname(__filename);
var require = CJS_COMPAT_NODE_MODULE_qfbekemo7ri.createRequire(import.meta.url);

// ------------------------------------------------------------
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
// ------------------------------------------------------------
import {
  __name
} from "./chunk-PTT3CRNJ.js";

// ../node_modules/yocto-queue/index.js
var Node = class {
  static {
    __name(this, "Node");
  }
  value;
  next;
  constructor(value) {
    this.value = value;
  }
};
var Queue = class {
  static {
    __name(this, "Queue");
  }
  #head;
  #tail;
  #size;
  constructor() {
    this.clear();
  }
  enqueue(value) {
    const node = new Node(value);
    if (this.#head) {
      this.#tail.next = node;
      this.#tail = node;
    } else {
      this.#head = node;
      this.#tail = node;
    }
    this.#size++;
  }
  dequeue() {
    const current = this.#head;
    if (!current) {
      return;
    }
    this.#head = this.#head.next;
    this.#size--;
    return current.value;
  }
  peek() {
    if (!this.#head) {
      return;
    }
    return this.#head.value;
  }
  clear() {
    this.#head = void 0;
    this.#tail = void 0;
    this.#size = 0;
  }
  get size() {
    return this.#size;
  }
  *[Symbol.iterator]() {
    let current = this.#head;
    while (current) {
      yield current.value;
      current = current.next;
    }
  }
  *drain() {
    while (this.#head) {
      yield this.dequeue();
    }
  }
};

export {
  Queue
};
