"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const hasOwnProperty = Object.prototype.hasOwnProperty;
function forEach(from, callback) {
  for (let key in from) {
    if (hasOwnProperty.call(from, key)) {
      const result = callback({ key, value: from[key] }, function() {
        delete from[key];
      });
      if (result === false) {
        return;
      }
    }
  }
}
class SetMap {
  constructor() {
    this.map = /* @__PURE__ */ new Map();
  }
  add(key, value) {
    let values = this.map.get(key);
    if (!values) {
      values = /* @__PURE__ */ new Set();
      this.map.set(key, values);
    }
    values.add(value);
  }
  delete(key, value) {
    const values = this.map.get(key);
    if (!values) {
      return;
    }
    values.delete(value);
    if (values.size === 0) {
      this.map.delete(key);
    }
  }
  forEach(key, fn) {
    const values = this.map.get(key);
    if (!values) {
      return;
    }
    values.forEach(fn);
  }
}
exports.SetMap = SetMap;
exports.forEach = forEach;
