"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index_es = require("../../../../inherits-browser/dist/index.es.js");
const CommandInterceptor = require("../../command/CommandInterceptor.js");
function RootElementsBehavior(canvas, injector) {
  injector.invoke(CommandInterceptor.default, this);
  this.executed(function(event) {
    var context = event.context;
    if (context.rootElement) {
      canvas.setRootElement(context.rootElement);
    } else {
      context.rootElement = canvas.getRootElement();
    }
  });
  this.revert(function(event) {
    var context = event.context;
    if (context.rootElement) {
      canvas.setRootElement(context.rootElement);
    }
  });
}
index_es.default(RootElementsBehavior, CommandInterceptor.default);
RootElementsBehavior.$inject = ["canvas", "injector"];
exports.default = RootElementsBehavior;
