"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Elements = require("../../util/Elements.js");
const index_esm$1 = require("../../../../tiny-svg/dist/index.esm.js");
const index_esm = require("../../../../min-dom/dist/index.esm.js");
const index_esm$2 = require("../../../../min-dash/dist/index.esm.js");
var x = 500;
function r(n, o, f) {
  this.offset = 6;
  var l = o.cls("djs-outline", ["no-fill"]), a = this;
  function u(e, s) {
    var t = index_esm$1.create("rect");
    return index_esm$1.attr(t, index_esm$2.assign({
      x: 10,
      y: 10,
      rx: 3,
      width: 100,
      height: 100
    }, l)), index_esm$1.append(e, t), t;
  }
  n.on(["shape.added", "shape.changed"], x, function(e) {
    var s = e.element, t = e.gfx, i = index_esm.query(".djs-outline", t);
    i || (i = u(t)), a.updateShapeOutline(i, s);
  }), n.on(["connection.added", "connection.changed"], function(e) {
    var s = e.element, t = e.gfx, i = index_esm.query(".djs-outline", t);
    i || (i = u(t)), a.updateConnectionOutline(i, s);
  });
}
r.prototype.updateShapeOutline = function(n, o) {
  index_esm$1.attr(n, {
    x: -this.offset,
    y: -this.offset,
    width: o.width + this.offset * 2,
    height: o.height + this.offset * 2
  });
};
r.prototype.updateConnectionOutline = function(n, o) {
  var f = Elements.getBBox(o);
  index_esm$1.attr(n, {
    x: f.x - this.offset,
    y: f.y - this.offset,
    width: f.width + this.offset * 2,
    height: f.height + this.offset * 2
  });
};
r.$inject = ["eventBus", "styles", "elementRegistry"];
exports.default = r;
