"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Store = void 0;

var _mobx = require("mobx");

var __assign = void 0 && (void 0).__assign || function () {
  __assign = Object.assign || function (t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];

      for (var p in s) {
        if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
    }

    return t;
  };

  return __assign.apply(this, arguments);
};

var debug = require('debug')('worker:mobx');

var Store =
/** @class */
function () {
  function Store() {
    this.hoveredMeta = ''; // hover的元组件

    this.clickedMeta = ''; // 点击的元组件

    this.clickedGroup = ''; // 点击的元组件组

    this.clickedFloor = ''; // 点击的楼层

    this.textSelection = null; // 文本元组件选中区域

    (0, _mobx.makeObservable)(this, {
      hoveredMeta: _mobx.observable,
      clickedMeta: _mobx.observable,
      clickedGroup: _mobx.observable,
      setState: _mobx.action.bound
    });
  }
  /** 修改状态 */


  Store.prototype.setState = function (data) {
    var _this = this;

    debug('magicDesign state', data);
    var propertyList = Object.getOwnPropertyNames(data);
    propertyList.forEach(function (field) {
      _this[field] = data[field];
    });
    localStorage.setItem('mobx', __assign(__assign({}, localStorage.getItem('mobx')), data));
  };

  return Store;
}();

exports.Store = Store;