import { makeAutoObservable } from 'mobx';
var AreaContainer = /*#__PURE__*/function () {
  function AreaContainer(area) {
    this.area = void 0;
    this.items = [];
    makeAutoObservable(this, {
      area: false
    });
    this.area = area;
  }
  var _proto = AreaContainer.prototype;
  _proto.add = function add(config, handle) {
    var current = this.items.find(function (item) {
      return item.name === config.name;
    });
    if (!current) {
      var newItem = handle(config);
      if (newItem) {
        this.items.push(newItem);
      }
      return newItem;
    } else {
      console.warn(this.area + " \u5DF2\u5B58\u5728\u4E00\u4E2A\u540D\u4E3A " + config.name + " \u7684\u5143\u7D20\uFF0C\u65B0\u589E\u65E0\u6548");
      return current;
    }
  };
  _proto.remove = function remove(name) {
    this.items = this.items.filter(function (item) {
      return item.name !== name;
    });
    return true;
  };
  return AreaContainer;
}();
export { AreaContainer as default };