"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Elements = require("../../util/Elements.js");
function ChangeSupport(eventBus, canvas, elementRegistry, graphicsFactory) {
  eventBus.on("element.changed", function(event) {
    var element = event.element;
    if (element.parent || element === canvas.getRootElement()) {
      event.gfx = elementRegistry.getGraphics(element);
    }
    if (!event.gfx) {
      return;
    }
    eventBus.fire(Elements.getType(element) + ".changed", event);
  });
  eventBus.on("elements.changed", function(event) {
    var elements = event.elements;
    elements.forEach(function(e) {
      eventBus.fire("element.changed", { element: e });
    });
    graphicsFactory.updateContainments(elements);
  });
  eventBus.on("shape.changed", function(event) {
    graphicsFactory.update("shape", event.element, event.gfx);
  });
  eventBus.on("connection.changed", function(event) {
    graphicsFactory.update("connection", event.element, event.gfx);
  });
}
ChangeSupport.$inject = [
  "eventBus",
  "canvas",
  "elementRegistry",
  "graphicsFactory"
];
exports.default = ChangeSupport;
