import e from "../../../../inherits-browser/dist/index.es.mjs";
import CommandInterceptor from "../../command/CommandInterceptor.mjs";
function RootElementsBehavior(canvas, injector) {
  injector.invoke(CommandInterceptor, 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);
    }
  });
}
e(RootElementsBehavior, CommandInterceptor);
RootElementsBehavior.$inject = ["canvas", "injector"];
export {
  RootElementsBehavior as default
};
