"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ResizeObserverState = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _mobx = require("mobx");
class ResizeObserverState {
  constructor() {
    (0, _defineProperty2.default)(this, "contentRect", null);
    (0, _mobx.makeObservable)(this, {
      contentRect: _mobx.observable.ref
    });
  }
  init({
    target
  }) {
    if (target == null || typeof ResizeObserver === 'undefined') {
      return;
    }
    const resizeObserver = new ResizeObserver((0, _mobx.action)(([{
      contentRect
    }]) => {
      this.contentRect = {
        height: contentRect.height
      };
    }));
    resizeObserver.observe(target);
    return () => {
      resizeObserver.disconnect();
    };
  }
}
exports.ResizeObserverState = ResizeObserverState;
//# sourceMappingURL=ResizeObserverState.js.map