"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _widget = _interopRequireDefault(require("./widget/widget"));
var _container = _interopRequireDefault(require("./container"));
var Skeleton = exports["default"] = /*#__PURE__*/function () {
  function Skeleton() {
    this.leftArea = new _container["default"]('left');
    this.toolbarArea = new _container["default"]('toolbar');
    this.bottomArea = new _container["default"]('bottom');
    this.topLeftArea = new _container["default"]('topLeft');
    this.topRightArea = new _container["default"]('topRight');
    this.topCenterArea = new _container["default"]('topCenter');
  }
  var _proto = Skeleton.prototype;
  _proto.add = function add(config) {
    var handle = function handle(config) {
      return new _widget["default"](config.name, config);
    };
    switch (config.area) {
      case 'bottom':
        return this.bottomArea.add(config, handle);
      case 'left':
        return this.leftArea.add(config, handle);
      case 'toolbar':
        return this.toolbarArea.add(config, handle);
      case 'topCenter':
        return this.topCenterArea.add(config, handle);
      case 'topLeft':
        return this.topLeftArea.add(config, handle);
      case 'topRight':
        return this.topRightArea.add(config, handle);
      default:
        var n = config.area;
        console.warn(n + " \u4E0D\u662F never \u7C7B\u578B");
    }
  };
  _proto.remove = function remove(area, name) {
    switch (area) {
      case 'bottom':
        return this.bottomArea.remove(name);
      case 'left':
        return this.leftArea.remove(name);
      case 'toolbar':
        return this.toolbarArea.remove(name);
      case 'topCenter':
        return this.topCenterArea.remove(name);
      case 'topLeft':
        return this.topLeftArea.remove(name);
      case 'topRight':
        return this.topRightArea.remove(name);
      default:
        var n = area;
        console.warn(n + " \u4E0D\u662F never \u7C7B\u578B");
        return false;
    }
  };
  return Skeleton;
}();