@linkurious/ogma-annotations 1.1.5 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5,39 +5,39 @@ var In = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
5
5
  function ce(u) {
6
6
  return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
7
7
  }
8
- var Pe = { exports: {} };
8
+ var $e = { exports: {} };
9
9
  (function(u) {
10
10
  (function(l, t) {
11
11
  u.exports = t();
12
12
  })("Vector", function() {
13
13
  var l = function() {
14
14
  var t = Math.PI * 2, r = 180 / Math.PI, a = Math.PI / 180;
15
- function c(s) {
15
+ function h(s) {
16
16
  return Math.round(s * 1e8) / 1e8;
17
17
  }
18
- function f(s, d) {
19
- var m = d.x - s.x, A = d.y - s.y;
18
+ function d(s, f) {
19
+ var m = f.x - s.x, A = f.y - s.y;
20
20
  return Math.sqrt(m * m + A * A);
21
21
  }
22
- function g(s, d, m) {
23
- var A = d.y - s.y, T = d.x - s.x, S = Math.atan2(A, T);
22
+ function g(s, f, m) {
23
+ var A = f.y - s.y, T = f.x - s.x, S = Math.atan2(A, T);
24
24
  if (m)
25
25
  for (; S < 0; )
26
26
  S += t;
27
27
  return S;
28
28
  }
29
- function p(s, d) {
30
- this.x = s !== void 0 ? s : 0, this.y = d !== void 0 ? d : 0;
29
+ function p(s, f) {
30
+ this.x = s !== void 0 ? s : 0, this.y = f !== void 0 ? f : 0;
31
31
  }
32
32
  return p.fromRadians = function(s) {
33
- var d = Math.cos(s), m = Math.sin(s);
34
- return new p(d, m);
33
+ var f = Math.cos(s), m = Math.sin(s);
34
+ return new p(f, m);
35
35
  }, p.fromDegrees = function(s) {
36
- var d = s * (Math.PI / 180);
37
- return p.fromRadians(d);
36
+ var f = s * (Math.PI / 180);
37
+ return p.fromRadians(f);
38
38
  }, p.fromString = function(s) {
39
- var d = s.split(",");
40
- return new p(parseFloat(d[0]), parseFloat(d[1]));
39
+ var f = s.split(",");
40
+ return new p(parseFloat(f[0]), parseFloat(f[1]));
41
41
  }, p.fromArray = function(s) {
42
42
  return new p(s[0], s[1]);
43
43
  }, p.prototype = {
@@ -100,8 +100,8 @@ var Pe = { exports: {} };
100
100
  // @param x - optional x component to set.
101
101
  // @param y - optional y component to set.
102
102
  // @return self.
103
- set: function(s, d) {
104
- return s !== void 0 && (this.x = s), d !== void 0 && (this.y = d), this;
103
+ set: function(s, f) {
104
+ return s !== void 0 && (this.x = s), f !== void 0 && (this.y = f), this;
105
105
  },
106
106
  // [API]
107
107
  // [chainable, clone]
@@ -137,7 +137,7 @@ var Pe = { exports: {} };
137
137
  // @param other - vector to get distance from.
138
138
  // @return distance between vectors.
139
139
  distanceFrom: function(s) {
140
- return f(this, s);
140
+ return d(this, s);
141
141
  },
142
142
  // [API]
143
143
  // []
@@ -191,8 +191,8 @@ var Pe = { exports: {} };
191
191
  // @param radians - radians to rotate this vector by (can be positive or negative).
192
192
  // @return self.
193
193
  rotateRadiansSelf: function(s) {
194
- var d = Math.cos(s), m = Math.sin(s), A = this.x * d - this.y * m, T = this.x * m + this.y * d;
195
- return this.x = c(A), this.y = c(T), this;
194
+ var f = Math.cos(s), m = Math.sin(s), A = this.x * f - this.y * m, T = this.x * m + this.y * f;
195
+ return this.x = h(A), this.y = h(T), this;
196
196
  },
197
197
  // [API]
198
198
  // [chainable]
@@ -368,8 +368,8 @@ var Pe = { exports: {} };
368
368
  // @param min - min value for x, y components.
369
369
  // @param max - max value for x, y components.
370
370
  // @return self.
371
- clampSelf: function(s, d) {
372
- return this.x < s.x && (this.x = s.x), this.y < s.y && (this.y = s.y), this.x > d.x && (this.x = d.x), this.y > d.y && (this.y = d.y), this;
371
+ clampSelf: function(s, f) {
372
+ return this.x < s.x && (this.x = s.x), this.y < s.y && (this.y = s.y), this.x > f.x && (this.x = f.x), this.y > f.y && (this.y = f.y), this;
373
373
  },
374
374
  // [API]
375
375
  // [chainable, clone]
@@ -378,8 +378,8 @@ var Pe = { exports: {} };
378
378
  // @param min - min value for x, y components.
379
379
  // @param max - max value for x, y components.
380
380
  // @return cloned vector in range.
381
- clamp: function(s, d) {
382
- return this.clone().clampSelf(s, d);
381
+ clamp: function(s, f) {
382
+ return this.clone().clampSelf(s, f);
383
383
  },
384
384
  // [API]
385
385
  // [chainable, changeSelf]
@@ -450,8 +450,8 @@ var Pe = { exports: {} };
450
450
  // @param x - default value for x if undefined (0 if not defined).
451
451
  // @param y - default value for y if undefined (0 if not defined).
452
452
  // @return self.
453
- repairSelf: function(s, d) {
454
- return (typeof this.x != "number" || isNaN(this.x + 1)) && (this.x = s || 0), (typeof this.y != "number" || isNaN(this.y + 1)) && (this.y = d || 0), this;
453
+ repairSelf: function(s, f) {
454
+ return (typeof this.x != "number" || isNaN(this.x + 1)) && (this.x = s || 0), (typeof this.y != "number" || isNaN(this.y + 1)) && (this.y = f || 0), this;
455
455
  },
456
456
  // [API]
457
457
  // [chainable, clone]
@@ -460,8 +460,8 @@ var Pe = { exports: {} };
460
460
  // @param x - default value for x if undefined (0 if not defined).
461
461
  // @param y - default value for y if undefined (0 if not defined).
462
462
  // @return repaired clone.
463
- repair: function(s, d) {
464
- return this.clone().repairSelf(s, d);
463
+ repair: function(s, f) {
464
+ return this.clone().repairSelf(s, f);
465
465
  },
466
466
  // [API]
467
467
  // []
@@ -482,11 +482,11 @@ var Pe = { exports: {} };
482
482
  }();
483
483
  return l.zero = new l(0, 0), l.one = new l(1, 1), l.up = new l(0, -1), l.down = new l(0, 1), l.left = new l(-1, 0), l.right = new l(1, 0), l.upLeft = new l(-1, -1), l.downLeft = new l(-1, 1), l.upRight = new l(1, -1), l.downRight = new l(1, 1), l.prototype.magnitude = l.prototype.length, Object.freeze && (Object.freeze(l.zero), Object.freeze(l.one), Object.freeze(l.up), Object.freeze(l.down), Object.freeze(l.left), Object.freeze(l.right), Object.freeze(l.upLeft), Object.freeze(l.downLeft), Object.freeze(l.upRight), Object.freeze(l.downRight)), l;
484
484
  });
485
- })(Pe);
486
- var _n = Pe.exports;
487
- const G = /* @__PURE__ */ ce(_n);
488
- let Ut = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((l, t) => (t &= 63, t < 36 ? l += t.toString(36) : t < 62 ? l += (t - 26).toString(36).toUpperCase() : t > 62 ? l += "-" : l += "_", l), "");
489
- const Mt = {
485
+ })($e);
486
+ var _n = $e.exports;
487
+ const U = /* @__PURE__ */ ce(_n);
488
+ let Xt = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((l, t) => (t &= 63, t < 36 ? l += t.toString(36) : t < 62 ? l += (t - 26).toString(36).toUpperCase() : t > 62 ? l += "-" : l += "_", l), "");
489
+ const Lt = {
490
490
  strokeType: "plain",
491
491
  strokeColor: "black",
492
492
  strokeWidth: 1,
@@ -498,7 +498,7 @@ const Mt = {
498
498
  properties: {
499
499
  type: "arrow",
500
500
  style: {
501
- ...Mt
501
+ ...Lt
502
502
  }
503
503
  },
504
504
  geometry: {
@@ -518,13 +518,13 @@ const Mt = {
518
518
  // tail: 'arrow-plain',
519
519
  // start: { x: 0, y: 0 },
520
520
  // end: { x: 100, y: 100 }
521
- }, Dn = (u = 0, l = 0, t = 0, r = 0, a = { ...Mt }) => ({
522
- id: Ut(),
521
+ }, Dn = (u = 0, l = 0, t = 0, r = 0, a = { ...Lt }) => ({
522
+ id: Xt(),
523
523
  type: "Feature",
524
524
  properties: {
525
525
  type: "arrow",
526
526
  style: {
527
- ...Mt,
527
+ ...Lt,
528
528
  ...a
529
529
  }
530
530
  },
@@ -536,21 +536,21 @@ const Mt = {
536
536
  ]
537
537
  }
538
538
  }), On = "http://www.w3.org/2000/svg";
539
- function Dt(u) {
539
+ function Mt(u) {
540
540
  return document.createElementNS(On, u);
541
541
  }
542
- function $e(u) {
542
+ function Pe(u) {
543
543
  return u.geometry.bbox || Mn(u), u.geometry.bbox;
544
544
  }
545
- function ct(u) {
546
- const l = $e(u);
545
+ function ut(u) {
546
+ const l = Pe(u);
547
547
  return {
548
548
  width: l[2] - l[0],
549
549
  height: l[3] - l[1]
550
550
  };
551
551
  }
552
- function ft(u) {
553
- const l = $e(u);
552
+ function ct(u) {
553
+ const l = Pe(u);
554
554
  return { x: l[0], y: l[1] };
555
555
  }
556
556
  function Mn(u) {
@@ -568,15 +568,15 @@ function zn(u, l, t, r, a) {
568
568
  ]
569
569
  ];
570
570
  }
571
- function Ot(u) {
571
+ function zt(u) {
572
572
  const [l, t] = u.geometry.coordinates[0];
573
573
  return { x: l, y: t };
574
574
  }
575
- function Rt(u, l) {
575
+ function jt(u, l) {
576
576
  const [t, r] = u.geometry.coordinates[l === "start" ? 0 : 1];
577
577
  return { x: t, y: r };
578
578
  }
579
- function Ft(u) {
579
+ function qt(u) {
580
580
  const [l, t] = u.geometry.coordinates[1];
581
581
  return { x: l, y: t };
582
582
  }
@@ -586,15 +586,15 @@ function Ne(u, l, t) {
586
586
  function Re(u, l, t) {
587
587
  u.geometry.coordinates[1] = [l, t];
588
588
  }
589
- function qt(u) {
590
- return { start: Ot(u), end: Ft(u) };
589
+ function Vt(u) {
590
+ return { start: zt(u), end: qt(u) };
591
591
  }
592
592
  function bt(u, l, t, r) {
593
593
  l === "start" ? Ne(u, t, r) : Re(u, t, r);
594
594
  }
595
595
  const He = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
596
596
  function Xn(u) {
597
- return jt(u).reduce(
597
+ return Bt(u).reduce(
598
598
  (l, t) => (l[0] = Math.min(t[0], l[0]), l[1] = Math.min(t[1], l[1]), l[2] = Math.max(t[0], l[2]), l[3] = Math.max(t[1], l[3]), l),
599
599
  [
600
600
  Number.POSITIVE_INFINITY,
@@ -604,22 +604,22 @@ function Xn(u) {
604
604
  ]
605
605
  );
606
606
  }
607
- function jt(u) {
607
+ function Bt(u) {
608
608
  let l = [];
609
609
  return u.type == "Point" ? l = [u.coordinates] : u.type == "LineString" || u.type == "MultiPoint" ? l = u.coordinates : u.type == "Polygon" || u.type == "MultiLineString" ? l = u.coordinates.reduce(function(t, r) {
610
610
  return t.concat(r);
611
611
  }, []) : u.type == "MultiPolygon" ? l = u.coordinates.reduce(
612
- (t, r) => t.concat(r.reduce((a, c) => a.concat(c), [])),
612
+ (t, r) => t.concat(r.reduce((a, h) => a.concat(h), [])),
613
613
  []
614
- ) : u.type == "Feature" ? l = jt(u.geometry) : u.type == "GeometryCollection" ? l = u.geometries.reduce(
615
- (t, r) => t.concat(jt(r)),
614
+ ) : u.type == "Feature" ? l = Bt(u.geometry) : u.type == "GeometryCollection" ? l = u.geometries.reduce(
615
+ (t, r) => t.concat(Bt(r)),
616
616
  []
617
617
  ) : u.type == "FeatureCollection" && (l = u.features.reduce(
618
- (t, r) => t.concat(jt(r)),
618
+ (t, r) => t.concat(Bt(r)),
619
619
  []
620
620
  )), l;
621
621
  }
622
- function Ht(u, l, t) {
622
+ function Ft(u, l, t) {
623
623
  const r = Math.atan2(u.y - l.y, u.x - l.x);
624
624
  return {
625
625
  x: l.x + t * Math.cos(r),
@@ -628,55 +628,55 @@ function Ht(u, l, t) {
628
628
  }
629
629
  function je(u, l = 5, t = 30) {
630
630
  var s;
631
- const { start: r, end: a } = qt(u), c = new G(r.x, r.y), g = new G(a.x, a.y).sub(c), p = u.properties.style && u.properties.style.strokeWidth ? (s = u.properties.style) == null ? void 0 : s.strokeWidth : 0;
631
+ const { start: r, end: a } = Vt(u), h = new U(r.x, r.y), g = new U(a.x, a.y).sub(h), p = u.properties.style && u.properties.style.strokeWidth ? (s = u.properties.style) == null ? void 0 : s.strokeWidth : 0;
632
632
  return Math.min(t, Math.max(3 * p, g.length() * 0.1, l));
633
633
  }
634
634
  function ke(u, l, t, r) {
635
635
  const a = l.clone().normalize().invert().mul(r);
636
636
  if (!t || t === "none")
637
637
  return "";
638
- const c = u.clone().add(a.rotateRadians(Math.PI / 8)), f = u.clone().add(a.rotateRadians(-Math.PI / 8)), g = `${u.x} ${u.y}`;
639
- return `M ${c.x} ${c.y} L ${g} ${f.x} ${f.y} ${t === "arrow" ? "" : `${c.x} ${c.y}`}`;
638
+ const h = u.clone().add(a.rotateRadians(Math.PI / 8)), d = u.clone().add(a.rotateRadians(-Math.PI / 8)), g = `${u.x} ${u.y}`;
639
+ return `M ${h.x} ${h.y} L ${g} ${d.x} ${d.y} ${t === "arrow" ? "" : `${h.x} ${h.y}`}`;
640
640
  }
641
641
  function Ln(u, l, t, r, a) {
642
- const { start: c, end: f } = qt(u), { tail: g, head: p, strokeColor: s, strokeWidth: d } = u.properties.style || t, m = new G(c.x, c.y), A = new G(f.x, f.y), T = A.clone().sub(m), S = je(u, r, a), C = Dt("path");
642
+ const { start: h, end: d } = Vt(u), { tail: g, head: p, strokeColor: s, strokeWidth: f } = u.properties.style || t, m = new U(h.x, h.y), A = new U(d.x, d.y), T = A.clone().sub(m), S = je(u, r, a), C = Mt("path");
643
643
  C.setAttribute("data-annotation", `${u.id}`), C.setAttribute("data-annotation-type", "arrow");
644
644
  const k = p === "arrow-plain" || g === "arrow";
645
- C.setAttribute("stroke", s || "none"), C.setAttribute("stroke-width", `${d}`), C.setAttribute("fill", k ? s || "" : "none"), C.setAttribute("stroke-linecap", "round"), C.setAttribute("stroke-linejoin", "round");
646
- const F = ke(m, T.clone().invert(), g, S), Y = ke(A, T, p, S), D = F + `M ${m.x} ${m.y} ${A.x} ${A.y}` + Y;
645
+ C.setAttribute("stroke", s || "none"), C.setAttribute("stroke-width", `${f}`), C.setAttribute("fill", k ? s || "" : "none"), C.setAttribute("stroke-linecap", "round"), C.setAttribute("stroke-linejoin", "round");
646
+ const F = ke(m, T.clone().invert(), g, S), X = ke(A, T, p, S), D = F + `M ${m.x} ${m.y} ${A.x} ${A.y}` + X;
647
647
  C.setAttribute("d", D), l.appendChild(C);
648
648
  }
649
- const B = -1, Bt = "dragging", Vt = "dragstart", St = "dragend", se = "select", oe = "unselect", Cn = "hover", Pn = "unhover", ae = "remove", le = "add", $n = "cancelDrawing", he = "update", Nn = "link";
649
+ const q = -1, Ut = "dragging", Yt = "dragstart", St = "dragend", se = "select", oe = "unselect", Cn = "hover", $n = "unhover", ae = "remove", le = "add", Pn = "cancelDrawing", he = "update", Nn = "link";
650
650
  var Fe = { exports: {} };
651
651
  (function(u) {
652
652
  var l = Object.prototype.hasOwnProperty, t = "~";
653
653
  function r() {
654
654
  }
655
655
  Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
656
- function a(p, s, d) {
657
- this.fn = p, this.context = s, this.once = d || !1;
656
+ function a(p, s, f) {
657
+ this.fn = p, this.context = s, this.once = f || !1;
658
658
  }
659
- function c(p, s, d, m, A) {
660
- if (typeof d != "function")
659
+ function h(p, s, f, m, A) {
660
+ if (typeof f != "function")
661
661
  throw new TypeError("The listener must be a function");
662
- var T = new a(d, m || p, A), S = t ? t + s : s;
662
+ var T = new a(f, m || p, A), S = t ? t + s : s;
663
663
  return p._events[S] ? p._events[S].fn ? p._events[S] = [p._events[S], T] : p._events[S].push(T) : (p._events[S] = T, p._eventsCount++), p;
664
664
  }
665
- function f(p, s) {
665
+ function d(p, s) {
666
666
  --p._eventsCount === 0 ? p._events = new r() : delete p._events[s];
667
667
  }
668
668
  function g() {
669
669
  this._events = new r(), this._eventsCount = 0;
670
670
  }
671
671
  g.prototype.eventNames = function() {
672
- var s = [], d, m;
672
+ var s = [], f, m;
673
673
  if (this._eventsCount === 0)
674
674
  return s;
675
- for (m in d = this._events)
676
- l.call(d, m) && s.push(t ? m.slice(1) : m);
677
- return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(d)) : s;
675
+ for (m in f = this._events)
676
+ l.call(f, m) && s.push(t ? m.slice(1) : m);
677
+ return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(f)) : s;
678
678
  }, g.prototype.listeners = function(s) {
679
- var d = t ? t + s : s, m = this._events[d];
679
+ var f = t ? t + s : s, m = this._events[f];
680
680
  if (!m)
681
681
  return [];
682
682
  if (m.fn)
@@ -685,82 +685,82 @@ var Fe = { exports: {} };
685
685
  S[A] = m[A].fn;
686
686
  return S;
687
687
  }, g.prototype.listenerCount = function(s) {
688
- var d = t ? t + s : s, m = this._events[d];
688
+ var f = t ? t + s : s, m = this._events[f];
689
689
  return m ? m.fn ? 1 : m.length : 0;
690
- }, g.prototype.emit = function(s, d, m, A, T, S) {
690
+ }, g.prototype.emit = function(s, f, m, A, T, S) {
691
691
  var C = t ? t + s : s;
692
692
  if (!this._events[C])
693
693
  return !1;
694
- var k = this._events[C], F = arguments.length, Y, D;
694
+ var k = this._events[C], F = arguments.length, X, D;
695
695
  if (k.fn) {
696
696
  switch (k.once && this.removeListener(s, k.fn, void 0, !0), F) {
697
697
  case 1:
698
698
  return k.fn.call(k.context), !0;
699
699
  case 2:
700
- return k.fn.call(k.context, d), !0;
700
+ return k.fn.call(k.context, f), !0;
701
701
  case 3:
702
- return k.fn.call(k.context, d, m), !0;
702
+ return k.fn.call(k.context, f, m), !0;
703
703
  case 4:
704
- return k.fn.call(k.context, d, m, A), !0;
704
+ return k.fn.call(k.context, f, m, A), !0;
705
705
  case 5:
706
- return k.fn.call(k.context, d, m, A, T), !0;
706
+ return k.fn.call(k.context, f, m, A, T), !0;
707
707
  case 6:
708
- return k.fn.call(k.context, d, m, A, T, S), !0;
708
+ return k.fn.call(k.context, f, m, A, T, S), !0;
709
709
  }
710
- for (D = 1, Y = new Array(F - 1); D < F; D++)
711
- Y[D - 1] = arguments[D];
712
- k.fn.apply(k.context, Y);
710
+ for (D = 1, X = new Array(F - 1); D < F; D++)
711
+ X[D - 1] = arguments[D];
712
+ k.fn.apply(k.context, X);
713
713
  } else {
714
- var U = k.length, X;
715
- for (D = 0; D < U; D++)
714
+ var Y = k.length, G;
715
+ for (D = 0; D < Y; D++)
716
716
  switch (k[D].once && this.removeListener(s, k[D].fn, void 0, !0), F) {
717
717
  case 1:
718
718
  k[D].fn.call(k[D].context);
719
719
  break;
720
720
  case 2:
721
- k[D].fn.call(k[D].context, d);
721
+ k[D].fn.call(k[D].context, f);
722
722
  break;
723
723
  case 3:
724
- k[D].fn.call(k[D].context, d, m);
724
+ k[D].fn.call(k[D].context, f, m);
725
725
  break;
726
726
  case 4:
727
- k[D].fn.call(k[D].context, d, m, A);
727
+ k[D].fn.call(k[D].context, f, m, A);
728
728
  break;
729
729
  default:
730
- if (!Y)
731
- for (X = 1, Y = new Array(F - 1); X < F; X++)
732
- Y[X - 1] = arguments[X];
733
- k[D].fn.apply(k[D].context, Y);
730
+ if (!X)
731
+ for (G = 1, X = new Array(F - 1); G < F; G++)
732
+ X[G - 1] = arguments[G];
733
+ k[D].fn.apply(k[D].context, X);
734
734
  }
735
735
  }
736
736
  return !0;
737
- }, g.prototype.on = function(s, d, m) {
738
- return c(this, s, d, m, !1);
739
- }, g.prototype.once = function(s, d, m) {
740
- return c(this, s, d, m, !0);
741
- }, g.prototype.removeListener = function(s, d, m, A) {
737
+ }, g.prototype.on = function(s, f, m) {
738
+ return h(this, s, f, m, !1);
739
+ }, g.prototype.once = function(s, f, m) {
740
+ return h(this, s, f, m, !0);
741
+ }, g.prototype.removeListener = function(s, f, m, A) {
742
742
  var T = t ? t + s : s;
743
743
  if (!this._events[T])
744
744
  return this;
745
- if (!d)
746
- return f(this, T), this;
745
+ if (!f)
746
+ return d(this, T), this;
747
747
  var S = this._events[T];
748
748
  if (S.fn)
749
- S.fn === d && (!A || S.once) && (!m || S.context === m) && f(this, T);
749
+ S.fn === f && (!A || S.once) && (!m || S.context === m) && d(this, T);
750
750
  else {
751
751
  for (var C = 0, k = [], F = S.length; C < F; C++)
752
- (S[C].fn !== d || A && !S[C].once || m && S[C].context !== m) && k.push(S[C]);
753
- k.length ? this._events[T] = k.length === 1 ? k[0] : k : f(this, T);
752
+ (S[C].fn !== f || A && !S[C].once || m && S[C].context !== m) && k.push(S[C]);
753
+ k.length ? this._events[T] = k.length === 1 ? k[0] : k : d(this, T);
754
754
  }
755
755
  return this;
756
756
  }, g.prototype.removeAllListeners = function(s) {
757
- var d;
758
- return s ? (d = t ? t + s : s, this._events[d] && f(this, d)) : (this._events = new r(), this._eventsCount = 0), this;
757
+ var f;
758
+ return s ? (f = t ? t + s : s, this._events[f] && d(this, f)) : (this._events = new r(), this._eventsCount = 0), this;
759
759
  }, g.prototype.off = g.prototype.removeListener, g.prototype.addListener = g.prototype.on, g.prefixed = t, g.EventEmitter = g, u.exports = g;
760
760
  })(Fe);
761
761
  var Rn = Fe.exports;
762
- const qe = /* @__PURE__ */ ce(Rn);
763
- class Be extends qe {
762
+ const Be = /* @__PURE__ */ ce(Rn);
763
+ class qe extends Be {
764
764
  constructor(t, r) {
765
765
  super();
766
766
  v(this, "ogma");
@@ -768,8 +768,8 @@ class Be extends qe {
768
768
  // layer to draw elements
769
769
  v(this, "layer");
770
770
  v(this, "editor");
771
- v(this, "selectedId", B);
772
- v(this, "hoveredId", B);
771
+ v(this, "selectedId", q);
772
+ v(this, "hoveredId", q);
773
773
  // used to remember ogma options before we change them
774
774
  v(this, "ogmaOptions");
775
775
  v(this, "shouldDetect");
@@ -777,15 +777,15 @@ class Be extends qe {
777
777
  v(this, "showeditorOnHover");
778
778
  v(this, "maxHandleScale", 1.5);
779
779
  v(this, "_onKeyUp", (t) => {
780
- t.code === 27 && this.selectedId !== B ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== B && this._canRemove() && this.remove(this.selectedId);
780
+ t.code === 27 && this.selectedId !== q ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== q && this._canRemove() && this.remove(this.selectedId);
781
781
  });
782
782
  v(this, "_onClickMouseMove", (t) => {
783
783
  if (!t.domEvent || this.isDragging || !this.shouldDetect)
784
784
  return;
785
785
  const r = this.ogma.view.screenToGraphCoordinates(t), a = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
786
- t.domEvent.type === "mousemove" ? a ? this.hover(a.id) : this.hoveredId !== B && this.unhover() : a ? this.select(a.id) : this.selectedId !== B && this.unselect();
786
+ t.domEvent.type === "mousemove" ? a ? this.hover(a.id) : this.hoveredId !== q && this.unhover() : a ? this.select(a.id) : this.selectedId !== q && this.unselect();
787
787
  });
788
- this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("newFrame", () => {
788
+ this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("frame", () => {
789
789
  this.refreshEditor(), this.refreshDrawing();
790
790
  }), this.layer = t.layers.addSVGLayer({
791
791
  draw: (a) => this.draw(a)
@@ -801,7 +801,7 @@ class Be extends qe {
801
801
  */
802
802
  add(t) {
803
803
  const r = this.getDefaultOptions(), a = Object.assign(t, {
804
- id: t.id === void 0 ? Ut() : t.id,
804
+ id: t.id === void 0 ? Xt() : t.id,
805
805
  type: t.type,
806
806
  properties: {
807
807
  ...r.properties,
@@ -842,30 +842,31 @@ class Be extends qe {
842
842
  if (!t)
843
843
  return;
844
844
  const a = t.id;
845
- Object.keys(r).forEach((c) => {
846
- if (c !== "id")
847
- if (c === "properties") {
848
- const f = r.properties || { style: {} };
845
+ Object.keys(r).forEach((h) => {
846
+ if (h !== "id")
847
+ if (h === "properties") {
848
+ const d = r.properties || { style: {} };
849
849
  t.properties = {
850
850
  ...t.properties || {},
851
- ...f || {},
851
+ ...d || {},
852
852
  style: {
853
853
  ...t.properties.style || {},
854
- ...f.style || {}
854
+ ...d.style || {}
855
855
  }
856
856
  };
857
857
  } else
858
- c === "geometry" ? t.geometry = {
858
+ h === "geometry" ? t.geometry = {
859
859
  ...t.geometry,
860
860
  ...r.geometry
861
- } : t[c] = r[c];
861
+ } : t[h] = r[h];
862
862
  }), a === this.selectedId && this.refreshEditor(), this.layer.refresh();
863
863
  }
864
864
  getById(t) {
865
- for (let r = 0; r < this.elements.length; r++) {
866
- const a = this.elements[r];
867
- if (a.id === t)
868
- return a;
865
+ const r = Number(t);
866
+ for (let a = 0; a < this.elements.length; a++) {
867
+ const h = this.elements[a];
868
+ if (!(h.id !== t && h.id !== r))
869
+ return h;
869
870
  }
870
871
  }
871
872
  /**
@@ -882,15 +883,15 @@ class Be extends qe {
882
883
  r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Cn, r));
883
884
  }
884
885
  getSelectedFeature() {
885
- return this.selectedId === B ? null : this.getById(this.selectedId);
886
+ return this.selectedId === q ? null : this.getById(this.selectedId);
886
887
  }
887
888
  unselect() {
888
889
  const t = this.getById(this.selectedId);
889
- return t && this.emit(oe, t), this.selectedId = B, this.hoveredId === B && this.editor.hide(), this.layer.refresh(), this;
890
+ return t && this.emit(oe, t), this.selectedId = q, this.hoveredId === q && this.editor.hide(), this.layer.refresh(), this;
890
891
  }
891
892
  unhover() {
892
893
  const t = this.getById(this.hoveredId);
893
- return this.emit(Pn, t), this.hoveredId = B, this.selectedId === B && this.editor.hide(), this.layer.refresh(), this;
894
+ return this.emit($n, t), this.hoveredId = q, this.selectedId === q && this.editor.hide(), this.layer.refresh(), this;
894
895
  }
895
896
  /**
896
897
  * @method remove
@@ -950,7 +951,7 @@ class Be extends qe {
950
951
  }
951
952
  }
952
953
  const Te = "handle-line", Ie = "handle-start", _e = "handle-end";
953
- class Hn extends Be {
954
+ class Hn extends qe {
954
955
  constructor(t, r = {}) {
955
956
  super(
956
957
  t,
@@ -963,7 +964,7 @@ class Hn extends Be {
963
964
  `
964
965
  );
965
966
  // active handle id
966
- v(this, "draggedHandle", B);
967
+ v(this, "draggedHandle", q);
967
968
  v(this, "start", { x: 0, y: 0 });
968
969
  v(this, "end", { x: 0, y: 0 });
969
970
  v(this, "arrow", { ...Ee });
@@ -977,14 +978,14 @@ class Hn extends Be {
977
978
  r && (this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = He(t.target));
978
979
  });
979
980
  v(this, "onMouseUp", () => {
980
- this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B, this.emit(St, this.arrow));
981
+ this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = q, this.emit(St, this.arrow));
981
982
  });
982
983
  v(this, "onMouseMove", (t) => {
983
- if (!this.isDragging || this.draggedHandle === B)
984
+ if (!this.isDragging || this.draggedHandle === q)
984
985
  return;
985
- const r = this.handles[this.draggedHandle], a = this.ogma.view.getAngle(), { x: c, y: f } = new G(t.clientX - this.startX, t.clientY - this.startY).divScalar(this.ogma.view.getZoom()).rotateRadians(a), g = r.id === Te, p = r.id === Ie, s = r.id === _e;
986
- (g || p) && Ne(this.arrow, this.start.x + c, this.start.y + f), (g || s) && Re(this.arrow, this.end.x + c, this.end.y + f), this.emit(
987
- Bt,
986
+ const r = this.handles[this.draggedHandle], a = this.ogma.view.getAngle(), { x: h, y: d } = new U(t.clientX - this.startX, t.clientY - this.startY).divScalar(this.ogma.view.getZoom()).rotateRadians(a), g = r.id === Te, p = r.id === Ie, s = r.id === _e;
987
+ (g || p) && Ne(this.arrow, this.start.x + h, this.start.y + d), (g || s) && Re(this.arrow, this.end.x + h, this.end.y + d), this.emit(
988
+ Ut,
988
989
  this.arrow,
989
990
  g ? "line" : p ? "start" : "end"
990
991
  ), this.refreshEditor(), this.layer.refresh();
@@ -1001,49 +1002,53 @@ class Hn extends Be {
1001
1002
  * @param y
1002
1003
  * @param arrow
1003
1004
  */
1004
- startDrawing(t, r, a = Dn(t, r, t, r, Mt)) {
1005
+ startDrawing(t, r, a = Dn(t, r, t, r, Lt)) {
1005
1006
  var g;
1006
1007
  this.add(a), this.hoveredId = a.id;
1007
- const c = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), f = ((g = this.ogma.getContainer()) == null ? void 0 : g.getBoundingClientRect()) || { left: 0, top: 0 };
1008
- this.startDragging(this.getById(a.id), c.x + (f == null ? void 0 : f.left), c.y + f.top), this.draggedHandle = 2;
1008
+ const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), d = ((g = this.ogma.getContainer()) == null ? void 0 : g.getBoundingClientRect()) || { left: 0, top: 0 };
1009
+ this.startDragging(this.getById(a.id), h.x + (d == null ? void 0 : d.left), h.y + d.top), this.draggedHandle = 2;
1009
1010
  }
1010
1011
  cancelDrawing() {
1011
- this.isDragging && (this.remove(this.arrow.id), this.emit(St, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = B);
1012
+ this.isDragging && (this.remove(this.arrow.id), this.emit(St, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = q);
1012
1013
  }
1013
1014
  startDragging(t, r, a) {
1014
- this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = a, this.start = Ot(this.arrow), this.end = Ft(this.arrow), this.disableDragging(), this.emit(Vt, this.arrow), this.isDragging = !0;
1015
+ this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = a, this.start = zt(this.arrow), this.end = qt(this.arrow), this.disableDragging(), this.emit(Yt, this.arrow), this.isDragging = !0;
1015
1016
  }
1016
1017
  detect(t, r = 0) {
1017
1018
  return this.elements.find((a) => {
1018
- const { start: c, end: f } = qt(a), g = new G(t.x, t.y).sub(
1019
- new G((c.x + f.x) / 2, (c.y + f.y) / 2)
1020
- ), p = new G(f.x, f.y).sub(new G(c.x, c.y)), s = p.length(), d = p.normalize(), m = je(a);
1021
- return Math.abs(d.dot(g)) < s / 2 + r && Math.abs(d.rotateRadians(Math.PI / 2).dot(g)) < m / 2 + r;
1019
+ const { start: h, end: d } = Vt(a), g = new U(t.x, t.y).sub(
1020
+ new U((h.x + d.x) / 2, (h.y + d.y) / 2)
1021
+ ), p = new U(d.x, d.y).sub(new U(h.x, h.y)), s = p.length(), f = p.normalize(), m = je(a);
1022
+ return Math.abs(f.dot(g)) < s / 2 + r && Math.abs(f.rotateRadians(Math.PI / 2).dot(g)) < m / 2 + r;
1022
1023
  });
1023
1024
  }
1024
1025
  refreshEditor() {
1025
1026
  if (+this.selectedId < 0 && +this.hoveredId < 0)
1026
1027
  return;
1027
- const t = this.selectedId !== B ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = qt(t), a = this.ogma.view.graphToScreenCoordinates(r.start), c = this.ogma.view.graphToScreenCoordinates(r.end), f = Math.min(this.ogma.view.getZoom(), this.maxHandleScale), [g, p, s] = Array.prototype.slice.call(
1028
+ const t = this.selectedId !== q ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Vt(t), a = this.ogma.view.graphToScreenCoordinates(r.start), h = this.ogma.view.graphToScreenCoordinates(r.end), d = Math.min(this.ogma.view.getZoom(), this.maxHandleScale), [g, p, s] = Array.prototype.slice.call(
1028
1029
  this.editor.element.querySelectorAll(".handle")
1029
1030
  );
1030
- p.style.transform = `translate(${a.x}px, ${a.y}px) translate(-50%, -50%) scale(${f})`, s.style.transform = `translate(${c.x}px, ${c.y}px) translate(-50%, -50%) scale(${f}`;
1031
- const d = {
1032
- x: (c.x + a.x) / 2,
1033
- y: (c.y + a.y) / 2
1034
- }, m = new G(c.x - a.x, c.y - a.y), A = m.mul(1 / m.length()), T = Math.atan2(A.y, A.x);
1035
- g.style.width = `${m.length()}px`, g.style.left = `${d.x}px`, g.style.top = `${d.y}px`, g.style.transform = `translate(-50%, -50%) rotate(${T}rad)`;
1031
+ p.style.transform = `translate(${a.x}px, ${a.y}px) translate(-50%, -50%) scale(${d})`, s.style.transform = `translate(${h.x}px, ${h.y}px) translate(-50%, -50%) scale(${d}`;
1032
+ const f = {
1033
+ x: (h.x + a.x) / 2,
1034
+ y: (h.y + a.y) / 2
1035
+ }, m = new U(h.x - a.x, h.y - a.y), A = m.mul(1 / m.length()), T = Math.atan2(A.y, A.x);
1036
+ g.style.width = `${m.length()}px`, g.style.left = `${f.x}px`, g.style.top = `${f.y}px`, g.style.transform = `translate(-50%, -50%) rotate(${T}rad)`;
1036
1037
  }
1037
1038
  getDefaultOptions() {
1038
1039
  return Ee;
1039
1040
  }
1040
1041
  draw(t) {
1041
1042
  t.innerHTML = "";
1042
- const r = Dt("g");
1043
- this.elements.forEach(
1044
- (a) => Ln(a, r, Mt, this.minArrowHeight, this.maxArrowHeight)
1043
+ const r = Mt("g"), a = this.ogma.view.getAngle();
1044
+ r.setAttribute("transform", `rotate(${-a * (180 / Math.PI)})`), this.elements.forEach(
1045
+ (h) => Ln(h, r, Lt, this.minArrowHeight, this.maxArrowHeight)
1045
1046
  ), t.appendChild(r);
1046
1047
  }
1048
+ refreshDrawing() {
1049
+ const t = this.ogma.view.getAngle();
1050
+ this.layer.element.children[0].setAttribute("transform", `rotate(${-t * (180 / Math.PI)})`);
1051
+ }
1047
1052
  destroy() {
1048
1053
  super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
1049
1054
  }
@@ -1081,13 +1086,13 @@ const At = {
1081
1086
  }, De = {
1082
1087
  handleSize: 3.5,
1083
1088
  placeholder: "Your text..."
1084
- }, jn = (u = 0, l = 0, t = 100, r = 50, a = "", c = { ...At }) => ({
1085
- id: Ut(),
1089
+ }, jn = (u = 0, l = 0, t = 100, r = 50, a = "", h = { ...At }) => ({
1090
+ id: Xt(),
1086
1091
  type: "Feature",
1087
1092
  properties: {
1088
1093
  type: "text",
1089
1094
  content: a,
1090
- style: { ...At, ...c }
1095
+ style: { ...At, ...h }
1091
1096
  },
1092
1097
  geometry: {
1093
1098
  type: "Polygon",
@@ -1119,19 +1124,19 @@ var Ve = { exports: {} };
1119
1124
  }, a(e);
1120
1125
  }
1121
1126
  t.d(r, { default: () => Sn });
1122
- var c = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, f = /\bsmall-caps\b/, g = /\b(?:italic|oblique)\b/, p = /\bbold(?:er)?\b/, s = 13.3333333, d = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
1127
+ var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, d = /\bsmall-caps\b/, g = /\b(?:italic|oblique)\b/, p = /\bbold(?:er)?\b/, s = 13.3333333, f = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
1123
1128
  function m(e) {
1124
1129
  var n = "", o = this;
1125
1130
  return o.style && o.style !== "normal" && (n += o.style), o.variant && o.variant !== "normal" && (n += (n ? " " : "") + o.variant), o.weight && o.weight !== "normal" && (n += (n ? " " : "") + o.weight), o.size && (n += (n ? " " : "") + o.size + "px", o.height !== o.size && (n += "/" + o.height + "px")), o.family && (n += (n ? " " : "") + o.family), e && (n += "::" + o.baseline), e && (n += "::" + o.color), n;
1126
1131
  }
1127
1132
  var A = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: m, valueOf: m };
1128
1133
  function T(e) {
1129
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = c.exec(e);
1134
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = h.exec(e);
1130
1135
  n.family = (o[6] || "").trim();
1131
- var i = d[o[2]] || parseFloat(o[2]);
1136
+ var i = f[o[2]] || parseFloat(o[2]);
1132
1137
  o[3] === "%" ? i *= 0.16 : o[3] === "em" ? i *= 16 : o[3] === "pt" && (i *= s), n.size = i;
1133
- var h = parseFloat(o[4]);
1134
- if (h !== "normal" && h !== "inherit" && h ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = h * s : o[5] === "%" ? n.height = 0.01 * i : n.height = h : n.height = h * i : n.height = Math.round(i * (7 / 6)), f.test(o[1]) && (n.variant = "small-caps"), g.test(o[1]) && (n.style = "italic"), p.test(o[1]))
1138
+ var c = parseFloat(o[4]);
1139
+ if (c !== "normal" && c !== "inherit" && c ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = c * s : o[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)), d.test(o[1]) && (n.variant = "small-caps"), g.test(o[1]) && (n.style = "italic"), p.test(o[1]))
1135
1140
  n.weight = "bold";
1136
1141
  else {
1137
1142
  var y = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
@@ -1140,7 +1145,7 @@ var Ve = { exports: {} };
1140
1145
  return n;
1141
1146
  }
1142
1147
  function S() {
1143
- var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, y = 14, w = 12, x = null, b = null, E = "";
1148
+ var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, y = 14, w = 12, x = null, b = null, E = "";
1144
1149
  if (i && i.nodeType) {
1145
1150
  var O = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), M = O.getComputedStyle(i, null);
1146
1151
  e = M.getPropertyValue("font-family") || "", w = parseFloat(M.getPropertyValue("font-size")), y = M.getPropertyValue("line-height"), x = M.getPropertyValue("font-weight"), b = M.getPropertyValue("font-style"), E = M.getPropertyValue("font-variant") || "";
@@ -1149,9 +1154,9 @@ var Ve = { exports: {} };
1149
1154
  e = I.family, w = I.size, y = I.height, E = I.variant, b = I.style, x = I.weight;
1150
1155
  } else
1151
1156
  a(i) === "object" && (e = i.family, w = i.size, y = i.height, E = i.variant, x = i.weight, b = i.style, n = i.baseline, o = i.color);
1152
- h.size && h.size < 3 && (w *= h.size), y = y !== "normal" && y ? parseFloat(y) : w * (7 / 6), h.height && h.height < 3 && (y *= h.height);
1157
+ c.size && c.size < 3 && (w *= c.size), y = y !== "normal" && y ? parseFloat(y) : w * (7 / 6), c.height && c.height < 3 && (y *= c.height);
1153
1158
  var z = Object.create(A);
1154
- return z.family = h.family || e || "sans-serif", z.height = y ?? 14, z.size = w ?? 12, z.variant = h.variant || E || "", z.style = h.style || b || "", z.weight = h.weight || x || "", z.baseline = n || 0, h.baseline != null && (z.baseline = h.baseline), z.color = h.color || o || "", z.id = m.call(z, !0), z;
1159
+ return z.family = c.family || e || "sans-serif", z.height = y ?? 14, z.size = w ?? 12, z.variant = c.variant || E || "", z.style = c.style || b || "", z.weight = c.weight || x || "", z.baseline = n || 0, c.baseline != null && (z.baseline = c.baseline), z.color = c.color || o || "", z.id = m.call(z, !0), z;
1155
1160
  }
1156
1161
  const C = { "\n": 0.28, "\r": 0.28, " ": 0.28, " ": 0.28, " ": 0.28, "᠎": 0, " ": 0.5, " ": 1, " ": 0.5, " ": 1, " ": 0.33, " ": 0.25, " ": 0.16, " ": 0.56, " ": 0.28, " ": 0.2, " ": 0.15, "​": 0, " ": 0.16, " ": 0.22, " ": 1, "\uFEFF": 0 };
1157
1162
  var k, F = function(e) {
@@ -1159,8 +1164,8 @@ var Ve = { exports: {} };
1159
1164
  if (n && n.getContext) {
1160
1165
  var o = n.getContext("2d");
1161
1166
  if (o && typeof o.measureText == "function")
1162
- return function(i, h) {
1163
- return o.font = String(h), o.measureText(i).width;
1167
+ return function(i, c) {
1168
+ return o.font = String(c), o.measureText(i).width;
1164
1169
  };
1165
1170
  }
1166
1171
  }(typeof document < "u" ? document : null) || (k = {}, function(e, n) {
@@ -1169,33 +1174,33 @@ var Ve = { exports: {} };
1169
1174
  k[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
1170
1175
  }
1171
1176
  return e.length * k[n].size;
1172
- }), Y = {}, D = { trim: !0, collapse: !0 };
1173
- function U(e, n, o) {
1174
- var i = Object.assign({}, D, o), h = String(e);
1175
- if (!h)
1177
+ }), X = {}, D = { trim: !0, collapse: !0 };
1178
+ function Y(e, n, o) {
1179
+ var i = Object.assign({}, D, o), c = String(e);
1180
+ if (!c)
1176
1181
  return 0;
1177
- if (h in C) {
1178
- var y = n.id + "/" + h;
1179
- return y in Y || (Y[y] = F("_".concat(h, "_"), n) - F("__", n)), Y[y];
1182
+ if (c in C) {
1183
+ var y = n.id + "/" + c;
1184
+ return y in X || (X[y] = F("_".concat(c, "_"), n) - F("__", n)), X[y];
1180
1185
  }
1181
- return i.trim && i.collapse ? i.trim ? h = h.trim() : i.collapse && (h = h.replace(/\s+/g, " ")) : h = h.replace(/\n/g, " "), F(h, n) + n.size * (e.tracking || 0);
1186
+ return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), F(c, n) + n.size * (e.tracking || 0);
1182
1187
  }
1183
- function X(e) {
1184
- return X = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1188
+ function G(e) {
1189
+ return G = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1185
1190
  return typeof n;
1186
1191
  } : function(n) {
1187
1192
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1188
- }, X(e);
1193
+ }, G(e);
1189
1194
  }
1190
- function Yt(e, n) {
1195
+ function Et(e, n) {
1191
1196
  if (typeof n != "function" && n !== null)
1192
1197
  throw new TypeError("Super expression must either be null or a function");
1193
- e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && Xt(e, n);
1198
+ e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && kt(e, n);
1194
1199
  }
1195
- function Xt(e, n) {
1196
- return Xt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
1200
+ function kt(e, n) {
1201
+ return kt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
1197
1202
  return o.__proto__ = i, o;
1198
- }, Xt(e, n);
1203
+ }, kt(e, n);
1199
1204
  }
1200
1205
  function Gt(e) {
1201
1206
  var n = function() {
@@ -1211,17 +1216,17 @@ var Ve = { exports: {} };
1211
1216
  }
1212
1217
  }();
1213
1218
  return function() {
1214
- var o, i = zt(e);
1219
+ var o, i = Ct(e);
1215
1220
  if (n) {
1216
- var h = zt(this).constructor;
1217
- o = Reflect.construct(i, arguments, h);
1221
+ var c = Ct(this).constructor;
1222
+ o = Reflect.construct(i, arguments, c);
1218
1223
  } else
1219
1224
  o = i.apply(this, arguments);
1220
1225
  return Ue(this, o);
1221
1226
  };
1222
1227
  }
1223
1228
  function Ue(e, n) {
1224
- if (n && (X(n) === "object" || typeof n == "function"))
1229
+ if (n && (G(n) === "object" || typeof n == "function"))
1225
1230
  return n;
1226
1231
  if (n !== void 0)
1227
1232
  throw new TypeError("Derived constructors may only return object or undefined");
@@ -1231,42 +1236,42 @@ var Ve = { exports: {} };
1231
1236
  return o;
1232
1237
  }(e);
1233
1238
  }
1234
- function zt(e) {
1235
- return zt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
1239
+ function Ct(e) {
1240
+ return Ct = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
1236
1241
  return n.__proto__ || Object.getPrototypeOf(n);
1237
- }, zt(e);
1242
+ }, Ct(e);
1238
1243
  }
1239
- function Lt(e, n) {
1244
+ function $t(e, n) {
1240
1245
  if (!(e instanceof n))
1241
1246
  throw new TypeError("Cannot call a class as a function");
1242
1247
  }
1243
1248
  function ue(e, n) {
1244
1249
  for (var o = 0; o < n.length; o++) {
1245
1250
  var i = n[o];
1246
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(y, w) {
1247
- if (X(y) !== "object" || y === null)
1251
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
1252
+ if (G(y) !== "object" || y === null)
1248
1253
  return y;
1249
1254
  var x = y[Symbol.toPrimitive];
1250
1255
  if (x !== void 0) {
1251
1256
  var b = x.call(y, w);
1252
- if (X(b) !== "object")
1257
+ if (G(b) !== "object")
1253
1258
  return b;
1254
1259
  throw new TypeError("@@toPrimitive must return a primitive value.");
1255
1260
  }
1256
1261
  return String(y);
1257
- }(i.key, "string"), X(h) === "symbol" ? h : String(h)), i);
1262
+ }(i.key, "string"), G(c) === "symbol" ? c : String(c)), i);
1258
1263
  }
1259
- var h;
1264
+ var c;
1260
1265
  }
1261
- function Ct(e, n, o) {
1266
+ function Pt(e, n, o) {
1262
1267
  return n && ue(e.prototype, n), o && ue(e, o), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1263
1268
  }
1264
1269
  var N = function() {
1265
1270
  function e() {
1266
1271
  var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
1267
- Lt(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
1272
+ $t(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
1268
1273
  }
1269
- return Ct(e, [{ key: "clone", value: function() {
1274
+ return Pt(e, [{ key: "clone", value: function() {
1270
1275
  var n = new e(this.value);
1271
1276
  return n.value = this.value, n.weight = this.weight, n.style = this.style, n.font = this.font, n.href = this.href, n.sub = this.sub, n.sup = this.sup, n;
1272
1277
  } }, { key: "valueOf", value: function() {
@@ -1274,40 +1279,40 @@ var Ve = { exports: {} };
1274
1279
  } }, { key: "toString", value: function() {
1275
1280
  return this.value;
1276
1281
  } }]), e;
1277
- }(), Et = function(e) {
1278
- Yt(o, e);
1282
+ }(), Tt = function(e) {
1283
+ Et(o, e);
1279
1284
  var n = Gt(o);
1280
1285
  function o() {
1281
- return Lt(this, o), n.apply(this, arguments);
1286
+ return $t(this, o), n.apply(this, arguments);
1282
1287
  }
1283
- return Ct(o);
1288
+ return Pt(o);
1284
1289
  }(N), nt = function(e) {
1285
- Yt(o, e);
1290
+ Et(o, e);
1286
1291
  var n = Gt(o);
1287
1292
  function o() {
1288
- return Lt(this, o), n.apply(this, arguments);
1293
+ return $t(this, o), n.apply(this, arguments);
1289
1294
  }
1290
- return Ct(o);
1295
+ return Pt(o);
1291
1296
  }(N), pt = function(e) {
1292
- Yt(o, e);
1297
+ Et(o, e);
1293
1298
  var n = Gt(o);
1294
1299
  function o() {
1295
- return Lt(this, o), n.apply(this, arguments);
1300
+ return $t(this, o), n.apply(this, arguments);
1296
1301
  }
1297
- return Ct(o);
1302
+ return Pt(o);
1298
1303
  }(N), Zt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, Ye = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, de = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Xe = /^(?:[;\xAD%?…]|,(?!\d))/, Ge = /^[´±°¢£¤$¥\u2212]/;
1299
- function Pt(e, n) {
1304
+ function Nt(e, n) {
1300
1305
  n !== !1 && (e = e.trim());
1301
- for (var o, i, h = [], y = e.charAt(0), w = 0, x = 1, b = e.length; x < b; x++) {
1306
+ for (var o, i, c = [], y = e.charAt(0), w = 0, x = 1, b = e.length; x < b; x++) {
1302
1307
  o = e.charAt(x), i = e.charAt(x + 1);
1303
1308
  var E = Zt.test(y), O = Zt.test(o), M = O || E, I = void 0;
1304
1309
  if ((Ge.test(o) && !de.test(y) || Xe.test(y + i) && !de.test(o)) && (M = !0), y !== "-" && y !== "‐" && y !== "–" && y !== "—" || ((I = Zt.test(e.charAt(x - 2))) && !O && (M = !1), !I && Ye.test(o + i) && (M = !0)), M) {
1305
1310
  var z = e.slice(w, x);
1306
- /\u00AD$/.test(z) ? (h.push(new N(z.slice(0, -1))), h.push(new pt())) : (h.push(new N(z)), h.push(new Et())), w = x;
1311
+ /\u00AD$/.test(z) ? (c.push(new N(z.slice(0, -1))), c.push(new pt())) : (c.push(new N(z)), c.push(new Tt())), w = x;
1307
1312
  }
1308
1313
  y = o;
1309
1314
  }
1310
- return h.push(new N(e.slice(w))), h;
1315
+ return c.push(new N(e.slice(w))), c;
1311
1316
  }
1312
1317
  const fe = { nbsp: " ", iexcl: "¡", cent: "¢", pound: "£", curren: "¤", yen: "¥", brvbar: "¦", sect: "§", uml: "¨", copy: "©", ordf: "ª", laquo: "«", not: "¬", shy: "­", reg: "®", macr: "¯", deg: "°", plusmn: "±", sup2: "²", sup3: "³", acute: "´", micro: "µ", para: "¶", middot: "·", cedil: "¸", sup1: "¹", ordm: "º", raquo: "»", frac14: "¼", frac12: "½", frac34: "¾", iquest: "¿", Agrave: "À", Aacute: "Á", Acirc: "Â", Atilde: "Ã", Auml: "Ä", Aring: "Å", AElig: "Æ", Ccedil: "Ç", Egrave: "È", Eacute: "É", Ecirc: "Ê", Euml: "Ë", Igrave: "Ì", Iacute: "Í", Icirc: "Î", Iuml: "Ï", ETH: "Ð", Ntilde: "Ñ", Ograve: "Ò", Oacute: "Ó", Ocirc: "Ô", Otilde: "Õ", Ouml: "Ö", times: "×", Oslash: "Ø", Ugrave: "Ù", Uacute: "Ú", Ucirc: "Û", Uuml: "Ü", Yacute: "Ý", THORN: "Þ", szlig: "ß", agrave: "à", aacute: "á", acirc: "â", atilde: "ã", auml: "ä", aring: "å", aelig: "æ", ccedil: "ç", egrave: "è", eacute: "é", ecirc: "ê", euml: "ë", igrave: "ì", iacute: "í", icirc: "î", iuml: "ï", eth: "ð", ntilde: "ñ", ograve: "ò", oacute: "ó", ocirc: "ô", otilde: "õ", ouml: "ö", divide: "÷", oslash: "ø", ugrave: "ù", uacute: "ú", ucirc: "û", uuml: "ü", yacute: "ý", thorn: "þ", yuml: "ÿ", fnof: "ƒ", Alpha: "Α", Beta: "Β", Gamma: "Γ", Delta: "Δ", Epsilon: "Ε", Zeta: "Ζ", Eta: "Η", Theta: "Θ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Xi: "Ξ", Omicron: "Ο", Pi: "Π", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Upsilon: "Υ", Phi: "Φ", Chi: "Χ", Psi: "Ψ", Omega: "Ω", alpha: "α", beta: "β", gamma: "γ", delta: "δ", epsilon: "ε", zeta: "ζ", eta: "η", theta: "θ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", xi: "ξ", omicron: "ο", pi: "π", rho: "ρ", sigmaf: "ς", sigma: "σ", tau: "τ", upsilon: "υ", phi: "φ", chi: "χ", psi: "ψ", omega: "ω", thetasym: "ϑ", upsih: "ϒ", piv: "ϖ", bull: "•", hellip: "…", prime: "′", Prime: "″", oline: "‾", frasl: "⁄", weierp: "℘", image: "ℑ", real: "ℜ", trade: "™", alefsym: "ℵ", larr: "←", uarr: "↑", rarr: "→", darr: "↓", harr: "↔", crarr: "↵", lArr: "⇐", uArr: "⇑", rArr: "⇒", dArr: "⇓", hArr: "⇔", forall: "∀", part: "∂", exist: "∃", empty: "∅", nabla: "∇", isin: "∈", notin: "∉", ni: "∋", prod: "∏", sum: "∑", minus: "−", lowast: "∗", radic: "√", prop: "∝", infin: "∞", ang: "∠", and: "⊥", or: "⊦", cap: "∩", cup: "∪", int: "∫", there4: "∴", sim: "∼", cong: "≅", asymp: "≈", ne: "≠", equiv: "≡", le: "≤", ge: "≥", sub: "⊂", sup: "⊃", nsub: "⊄", sube: "⊆", supe: "⊇", oplus: "⊕", otimes: "⊗", perp: "⊥", sdot: "⋅", lceil: "⌈", rceil: "⌉", lfloor: "⌊", rfloor: "⌋", lang: "〈", rang: "〉", loz: "◊", spades: "♠", clubs: "♣", hearts: "♥", diams: "♦", quot: '"', amp: "&", lt: "<", gt: ">", OElig: "Œ", oelig: "œ", Scaron: "Š", scaron: "š", Yuml: "Ÿ", circ: "ˆ", tilde: "˜", ensp: " ", emsp: " ", thinsp: " ", zwnj: "‌", zwj: "‍", lrm: "‎", rlm: "‏", ndash: "–", mdash: "—", lsquo: "‘", rsquo: "’", sbquo: "‚", ldquo: "“", rdquo: "”", bdquo: "„", dagger: "†", Dagger: "‡", permil: "‰", lsaquo: "‹", rsaquo: "›" };
1313
1318
  var Ze = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, We = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Ke = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, Je = /^<!--(.+?)-->/, Qe = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, pe = { b: function(e) {
@@ -1338,12 +1343,12 @@ var Ve = { exports: {} };
1338
1343
  e.sup = !0;
1339
1344
  } }, tn = { div: 1, li: 1, blockquote: 2, h1: 2, h2: 2, h3: 2, h4: 2, h5: 2, h6: 2, ul: 2, ol: 2, hr: 2, p: 2 };
1340
1345
  function ge(e) {
1341
- return e.replace(Qe, function(n, o, i, h) {
1346
+ return e.replace(Qe, function(n, o, i, c) {
1342
1347
  if (o || i) {
1343
1348
  var y = o ? 10 : 16;
1344
1349
  return String.fromCharCode(parseInt(o || i, y));
1345
1350
  }
1346
- return h in fe ? fe[h] : n;
1351
+ return c in fe ? fe[c] : n;
1347
1352
  });
1348
1353
  }
1349
1354
  function en(e) {
@@ -1395,8 +1400,8 @@ var Ve = { exports: {} };
1395
1400
  return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = S(n, e)), o;
1396
1401
  }
1397
1402
  function me(e, n, o) {
1398
- for (var i, h, y = e.width; y + o.width > n && e.length; )
1399
- h = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = U(i, i.font), y += i.width) : e.pop(), y -= h;
1403
+ for (var i, c, y = e.width; y + o.width > n && e.length; )
1404
+ c = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = Y(i, i.font), y += i.width) : e.pop(), y -= c;
1400
1405
  e[e.length - 1] instanceof pt && e.pop(), i = e[e.length - 1] || i || {}, o.font = S(o.font, i.bold, i.italic, ""), o.href = e.length ? i.href : null, o.rel = e.length ? i.rel : null, o.target = e.length ? i.target : null, e.push(o);
1401
1406
  }
1402
1407
  function vt(e) {
@@ -1431,69 +1436,69 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1431
1436
  return !e && !n || e === n;
1432
1437
  };
1433
1438
  function gn(e, n) {
1434
- var o = [], i = n.font(), h = i.size, y = i.family, w = n.align(), x = n.createElement();
1439
+ var o = [], i = n.font(), c = i.size, y = i.family, w = n.align(), x = n.createElement();
1435
1440
  if (e.length) {
1436
- var b = i.height, E = n.valign(), O = n.height()(), M = n.width()(0), I = !isFinite(M) && e.length === 1, z = I ? null : n.x(), R = vt(b / h), Q = I ? null : vt(b / (1.15 * h + (b - h) / 2));
1441
+ var b = i.height, E = n.valign(), O = n.height()(), M = n.width()(0), I = !isFinite(M) && e.length === 1, z = I ? null : n.x(), R = vt(b / c), Q = I ? null : vt(b / (1.15 * c + (b - c) / 2));
1437
1442
  if (pn[E] && isFinite(O)) {
1438
- var P = E === "bottom" ? 1 : 0.5;
1439
- Q += (O * P - b * e.length * P) / h;
1443
+ var $ = E === "bottom" ? 1 : 0.5;
1444
+ Q += (O * $ - b * e.length * $) / c;
1440
1445
  }
1441
1446
  var L = w === "justify", H = 0;
1442
1447
  w === "right" ? H = M : w === "center" && (H = M / 2);
1443
- for (var $ = [], tt = "tspan", Z = null, j = "", _ = function() {
1448
+ for (var P = [], tt = "tspan", Z = null, j = "", _ = function() {
1444
1449
  if (j) {
1445
1450
  var gt = x(tt, Z, j);
1446
- $.push(gt);
1451
+ P.push(gt);
1447
1452
  }
1448
1453
  tt = "tspan", Z = null, j = "";
1449
1454
  }, it = 0, et = e.length; it < et; it++) {
1450
- var at = "", ut = "", st = 0, lt = e[it];
1455
+ var at = "", dt = "", st = 0, lt = e[it];
1451
1456
  if (lt.length) {
1452
- $ = [];
1453
- for (var xt = 0, It = 0, ht = void 0, W = 0, $t = lt.length; W < $t; W++) {
1454
- var q = lt[W], K = q.font;
1455
- q.whitespace && xt++, It += q.width, W && !q.tracking && !st && Kt(K.id, at) && Kt(q.class, ut) && Kt(ht, q.href) ? j += q.value : (_(), j = q.value, Z = { fontFamily: K.family !== y ? K.family : null, fontSize: K.size !== h ? K.size : null, fontWeight: K.weight || null, fontStyle: K.style || null, fontVariant: K.variant !== "normal" && K.variant || null, fill: K.color || null, baselineShift: K.baseline ? 100 * K.baseline + "%" : null, className: q.class || null }, st && (Z.dx = vt(st), st = 0), q.tracking && (st = K.size * q.tracking), q.href && !ht ? (ht = q.href, tt = "a", Z.href = ht, Z.rel = q.rel, Z.target = q.target) : ht = null, at = K.id, ut = q.class);
1457
+ P = [];
1458
+ for (var xt = 0, Dt = 0, ht = void 0, W = 0, Rt = lt.length; W < Rt; W++) {
1459
+ var B = lt[W], K = B.font;
1460
+ B.whitespace && xt++, Dt += B.width, W && !B.tracking && !st && Kt(K.id, at) && Kt(B.class, dt) && Kt(ht, B.href) ? j += B.value : (_(), j = B.value, Z = { fontFamily: K.family !== y ? K.family : null, fontSize: K.size !== c ? K.size : null, fontWeight: K.weight || null, fontStyle: K.style || null, fontVariant: K.variant !== "normal" && K.variant || null, fill: K.color || null, baselineShift: K.baseline ? 100 * K.baseline + "%" : null, className: B.class || null }, st && (Z.dx = vt(st), st = 0), B.tracking && (st = K.size * B.tracking), B.href && !ht ? (ht = B.href, tt = "a", Z.href = ht, Z.rel = B.rel, Z.target = B.target) : ht = null, at = K.id, dt = B.class);
1456
1461
  }
1457
1462
  if (_(), I)
1458
- o.push.apply(o, ve($));
1463
+ o.push.apply(o, ve(P));
1459
1464
  else {
1460
- var Nt = null, _t = it === et - 1 || lt[lt.length - 1] instanceof nt;
1461
- L && lt.length > 1 && !_t && (Nt = vt((M - It) / xt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Nt, x: z(it) + H, dy: vt(it ? R : Q) + "em" }].concat(ve($))));
1465
+ var Ht = null, Ot = it === et - 1 || lt[lt.length - 1] instanceof nt;
1466
+ L && lt.length > 1 && !Ot && (Ht = vt((M - Dt) / xt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Ht, x: z(it) + H, dy: vt(it ? R : Q) + "em" }].concat(ve(P))));
1462
1467
  }
1463
1468
  } else
1464
1469
  o.push(x("tspan", { x: z(it), dy: vt(it ? R : Q) + "em" }, " "));
1465
1470
  }
1466
1471
  }
1467
- return x.apply(void 0, ["text", { fontFamily: y, fontSize: h, textAnchor: fn[w] || "start" }].concat(o));
1472
+ return x.apply(void 0, ["text", { fontFamily: y, fontSize: c, textAnchor: fn[w] || "start" }].concat(o));
1468
1473
  }
1469
1474
  var yn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1470
1475
  function mn(e, n, o) {
1471
1476
  if (e.length) {
1472
1477
  o.textBaseline = "middle";
1473
- var i = n.font(), h = i.height, y = i.size, w = n.valign(), x = n.height()(), b = n.width()(0), E = n.align(), O = E === "justify", M = 0.5 * h, I = yn[w];
1478
+ var i = n.font(), c = i.height, y = i.size, w = n.valign(), x = n.height()(), b = n.width()(0), E = n.align(), O = E === "justify", M = 0.5 * c, I = yn[w];
1474
1479
  if (I && isFinite(x)) {
1475
- var z = e.length * h;
1480
+ var z = e.length * c;
1476
1481
  M += x * I - z * I;
1477
1482
  }
1478
1483
  e.forEach(function(R, Q) {
1479
- var P = n.x()(Q), L = Q * h + M, H = 0, $ = 0;
1484
+ var $ = n.x()(Q), L = Q * c + M, H = 0, P = 0;
1480
1485
  R.forEach(function(j) {
1481
- j.whitespace && H++, $ += j.width;
1486
+ j.whitespace && H++, P += j.width;
1482
1487
  });
1483
1488
  var tt = 0, Z = Q === e.length - 1 || R[R.length - 1] instanceof nt;
1484
- O && R.length > 1 && !Z && (tt = (b - $) / H), R.forEach(function(j) {
1489
+ O && R.length > 1 && !Z && (tt = (b - P) / H), R.forEach(function(j) {
1485
1490
  o.font = j.font;
1486
1491
  var _ = j.font, it = _.baseline ? y * -_.baseline + 0.15 * y : 0;
1487
- o.fillStyle = function(ut, st) {
1488
- return ut.color ? ut.color : st.href ? "#00C" : "#000";
1492
+ o.fillStyle = function(dt, st) {
1493
+ return dt.color ? dt.color : st.href ? "#00C" : "#000";
1489
1494
  }(_, j);
1490
1495
  var et = 0;
1491
- if (E === "right" ? et += b - $ : E === "center" ? et += b / 2 - $ / 2 : E === "justify" && (j.whitespace || j instanceof nt) && (P += tt), o.fillText(j.value, P + et, L + it), j.href) {
1496
+ if (E === "right" ? et += b - P : E === "center" ? et += b / 2 - P / 2 : E === "justify" && (j.whitespace || j instanceof nt) && ($ += tt), o.fillText(j.value, $ + et, L + it), j.href) {
1492
1497
  o.beginPath(), o.strokeStyle = o.fillStyle;
1493
1498
  var at = Math.floor(L + 0.45 * y) + 0.5;
1494
- o.moveTo(P + et, at), o.lineTo(P + et + j.width, at), o.stroke();
1499
+ o.moveTo($ + et, at), o.lineTo($ + et + j.width, at), o.stroke();
1495
1500
  }
1496
- P += j.width;
1501
+ $ += j.width;
1497
1502
  });
1498
1503
  });
1499
1504
  }
@@ -1512,30 +1517,30 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1512
1517
  }
1513
1518
  return n;
1514
1519
  }
1515
- function kt(e) {
1516
- return kt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1520
+ function It(e) {
1521
+ return It = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1517
1522
  return typeof n;
1518
1523
  } : function(n) {
1519
1524
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1520
- }, kt(e);
1525
+ }, It(e);
1521
1526
  }
1522
1527
  function vn(e, n) {
1523
1528
  for (var o = 0; o < n.length; o++) {
1524
1529
  var i = n[o];
1525
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(y, w) {
1526
- if (kt(y) !== "object" || y === null)
1530
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
1531
+ if (It(y) !== "object" || y === null)
1527
1532
  return y;
1528
1533
  var x = y[Symbol.toPrimitive];
1529
1534
  if (x !== void 0) {
1530
1535
  var b = x.call(y, w);
1531
- if (kt(b) !== "object")
1536
+ if (It(b) !== "object")
1532
1537
  return b;
1533
1538
  throw new TypeError("@@toPrimitive must return a primitive value.");
1534
1539
  }
1535
1540
  return String(y);
1536
- }(i.key, "string"), kt(h) === "symbol" ? h : String(h)), i);
1541
+ }(i.key, "string"), It(c) === "symbol" ? c : String(c)), i);
1537
1542
  }
1538
- var h;
1543
+ var c;
1539
1544
  }
1540
1545
  var xn = S(), Qt = function(e) {
1541
1546
  return typeof e == "function" ? e : function() {
@@ -1553,56 +1558,56 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1553
1558
  }, x: function() {
1554
1559
  return 0;
1555
1560
  }, font: null, tAnchor: 0, parser: e.defaultparser }, i)
1556
- for (var h in i)
1557
- typeof this[h] == "function" && this[h](i[h]);
1561
+ for (var c in i)
1562
+ typeof this[c] == "function" && this[c](i[c]);
1558
1563
  }
1559
1564
  var n, o;
1560
1565
  return n = e, o = [{ key: "linebreak", value: function(i) {
1561
- var h = this, y = this.props.parser(String(i)), w = this.font(), x = function(b, E, O) {
1566
+ var c = this, y = this.props.parser(String(i)), w = this.font(), x = function(b, E, O) {
1562
1567
  if (!b.length)
1563
1568
  return [];
1564
- var M = E.height(), I = E.width(), z = E.overflowLine(), R = E.overflowWrap(), Q = S(O, !0, !1), P = isFinite(M()) ? Math.floor(M() / O.height) : 1 / 0;
1565
- if (!M() && !I(0) || !P)
1569
+ var M = E.height(), I = E.width(), z = E.overflowLine(), R = E.overflowWrap(), Q = S(O, !0, !1), $ = isFinite(M()) ? Math.floor(M() / O.height) : 1 / 0;
1570
+ if (!M() && !I(0) || !$)
1566
1571
  return [];
1567
- for (var L = 0, H = 0, $ = 0, tt = [], Z = [], j = !1; L < b.length && H < P; ) {
1572
+ for (var L = 0, H = 0, P = 0, tt = [], Z = [], j = !1; L < b.length && H < $; ) {
1568
1573
  var _ = b[L], it = dn(_, O);
1569
- if (_.width = U(_, it), _.font = it, _.line = H, _.whitespace = _.value in C, _.value && (_.value = _.value.replace(un, " ")), !(!$ && _.whitespace || j && _.whitespace))
1574
+ if (_.width = Y(_, it), _.font = it, _.line = H, _.whitespace = _.value in C, _.value && (_.value = _.value.replace(un, " ")), !(!P && _.whitespace || j && _.whitespace))
1570
1575
  if (_ instanceof nt)
1571
- $ = 0, Z = [], tt.push(L + 1), H++;
1572
- else if (_ instanceof Et || _ instanceof pt)
1573
- Z.push({ index: L, width: $ });
1574
- else if (_.whitespace || $ + _.width < I(H))
1575
- $ += _.width;
1576
+ P = 0, Z = [], tt.push(L + 1), H++;
1577
+ else if (_ instanceof Tt || _ instanceof pt)
1578
+ Z.push({ index: L, width: P });
1579
+ else if (_.whitespace || P + _.width < I(H))
1580
+ P += _.width;
1576
1581
  else if (Z.length) {
1577
1582
  var et = void 0, at = void 0;
1578
1583
  do {
1579
1584
  at = !0, et = Z.pop();
1580
- var ut = b[et.index], st = void 0;
1581
- ut instanceof pt && (st = U("-", ut.font), et.width + st > I(H) && (at = !Z.length));
1585
+ var dt = b[et.index], st = void 0;
1586
+ dt instanceof pt && (st = Y("-", dt.font), et.width + st > I(H) && (at = !Z.length));
1582
1587
  } while (!at);
1583
- tt.push(et.index + 1), $ = 0, H++, L = et.index, Z = [];
1588
+ tt.push(et.index + 1), P = 0, H++, L = et.index, Z = [];
1584
1589
  } else if (R === "break-word") {
1585
1590
  var lt = I(H);
1586
- if ($ + _.width > lt) {
1591
+ if (P + _.width > lt) {
1587
1592
  var xt = _.clone();
1588
1593
  do
1589
- _.value = _.value.slice(0, -1), _.width = U(_, _.font), $ += _.width;
1594
+ _.value = _.value.slice(0, -1), _.width = Y(_, _.font), P += _.width;
1590
1595
  while (_.value && _.width > lt);
1591
- xt.value = xt.value.slice(_.value.length), b.splice(L + 1, 0, new Et(), xt);
1596
+ xt.value = xt.value.slice(_.value.length), b.splice(L + 1, 0, new Tt(), xt);
1592
1597
  }
1593
- tt.push(L + 1), $ = 0, H++;
1598
+ tt.push(L + 1), P = 0, H++;
1594
1599
  } else
1595
- $ += _.width;
1600
+ P += _.width;
1596
1601
  L++, j = _.whitespace;
1597
1602
  }
1598
1603
  L !== tt[tt.length - 1] && tt.push(L);
1599
- var It = 0, ht = 0, W = tt.map(function(gt) {
1600
- for (var J, yt = It; (J = b[yt]) && (J.whitespace || !J.value); )
1604
+ var Dt = 0, ht = 0, W = tt.map(function(gt) {
1605
+ for (var J, yt = Dt; (J = b[yt]) && (J.whitespace || !J.value); )
1601
1606
  yt++;
1602
- for (var dt = gt, ne = null; dt > yt && (J = b[dt - 1]) && (J.whitespace || !(J.value || J instanceof pt)); )
1603
- J instanceof nt && (ne = J), dt--;
1604
- J instanceof pt && (J.value = "-", J.width = U("-", J.font)), It = gt;
1605
- var wt = b.slice(yt, dt).filter(function(ie) {
1607
+ for (var ft = gt, ne = null; ft > yt && (J = b[ft - 1]) && (J.whitespace || !(J.value || J instanceof pt)); )
1608
+ J instanceof nt && (ne = J), ft--;
1609
+ J instanceof pt && (J.value = "-", J.width = Y("-", J.font)), Dt = gt;
1610
+ var wt = b.slice(yt, ft).filter(function(ie) {
1606
1611
  return ie.value;
1607
1612
  });
1608
1613
  return ne && wt.push(ne), wt.width = wt.reduce(function(ie, En) {
@@ -1610,25 +1615,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1610
1615
  }, 0), wt.width > ht && (ht = wt.width), wt;
1611
1616
  });
1612
1617
  if (W.hasLineOverflow = !1, z) {
1613
- var $t = z === "ellipsis" ? "…" : z;
1618
+ var Rt = z === "ellipsis" ? "…" : z;
1614
1619
  W.forEach(function(gt, J) {
1615
1620
  var yt = I(J);
1616
1621
  if (gt.width > yt) {
1617
- var dt = new N($t);
1618
- dt.font = O, dt.width = U($t, Q), me(gt, yt, dt), W.hasLineOverflow = !0;
1622
+ var ft = new N(Rt);
1623
+ ft.font = O, ft.width = Y(Rt, Q), me(gt, yt, ft), W.hasLineOverflow = !0;
1619
1624
  }
1620
1625
  });
1621
1626
  }
1622
- var q = E.overflow() === "ellipsis" ? "…" : E.overflow();
1623
- if (q && L !== b.length) {
1624
- var K = I(W.length - 1), Nt = W[W.length - 1], _t = new N(q);
1625
- _t.font = O, _t.width = U(q, Q), me(Nt, K, _t), W.hasOverflow = !0;
1627
+ var B = E.overflow() === "ellipsis" ? "…" : E.overflow();
1628
+ if (B && L !== b.length) {
1629
+ var K = I(W.length - 1), Ht = W[W.length - 1], Ot = new N(B);
1630
+ Ot.font = O, Ot.width = Y(B, Q), me(Ht, K, Ot), W.hasOverflow = !0;
1626
1631
  } else
1627
1632
  W.hasOverflow = !1;
1628
1633
  return W.font = O, W.width = ht, W;
1629
1634
  }(y, this, w);
1630
1635
  return x.height = x.length * w.height, x.render = function(b) {
1631
- return h.render(x, b);
1636
+ return c.render(x, b);
1632
1637
  }, x.svg = x.render, x.draw = x.render, x;
1633
1638
  } }, { key: "font", value: function(i) {
1634
1639
  return arguments.length ? (this.props.font = S(i), this) : this.props.font || S(xn);
@@ -1641,13 +1646,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1641
1646
  } }, { key: "align", value: function(i) {
1642
1647
  if (!arguments.length)
1643
1648
  return this.props.align;
1644
- var h = String(i).toLowerCase();
1645
- return h === "left" || h === "start" ? (this.props.align = "left", this.props.tAnchor = 0) : h === "center" || h === "middle" ? (this.props.align = "center", this.props.tAnchor = -0.5) : h === "end" || h === "right" ? (this.props.align = "right", this.props.tAnchor = -1) : h === "justify" && (this.props.align = i, this.props.tAnchor = 0), this;
1649
+ var c = String(i).toLowerCase();
1650
+ return c === "left" || c === "start" ? (this.props.align = "left", this.props.tAnchor = 0) : c === "center" || c === "middle" ? (this.props.align = "center", this.props.tAnchor = -0.5) : c === "end" || c === "right" ? (this.props.align = "right", this.props.tAnchor = -1) : c === "justify" && (this.props.align = i, this.props.tAnchor = 0), this;
1646
1651
  } }, { key: "overflowWrap", value: function(i) {
1647
1652
  if (!arguments.length)
1648
1653
  return this.props.overflowWrap || "normal";
1649
- var h = String(i).toLowerCase();
1650
- return h === "break-word" ? this.props.overflowWrap = "break-word" : h !== "normal" && i != null || (this.props.overflowWrap = null), this;
1654
+ var c = String(i).toLowerCase();
1655
+ return c === "break-word" ? this.props.overflowWrap = "break-word" : c !== "normal" && i != null || (this.props.overflowWrap = null), this;
1651
1656
  } }, { key: "width", value: function(i) {
1652
1657
  return arguments.length ? (this.props.width = Qt(i), this) : this.props.width;
1653
1658
  } }, { key: "height", value: function(i) {
@@ -1658,8 +1663,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1658
1663
  if (!arguments.length)
1659
1664
  return this.props.parser;
1660
1665
  if (typeof i == "string") {
1661
- var h = e[i] || e[i + "parser"];
1662
- typeof h == "function" && (i = h);
1666
+ var c = e[i] || e[i + "parser"];
1667
+ typeof c == "function" && (i = c);
1663
1668
  }
1664
1669
  if (typeof i != "function")
1665
1670
  throw new Error("Unknown parser: " + i);
@@ -1671,12 +1676,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1671
1676
  return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? mn(i.text, this, i.ctx) : gn(i.text, this);
1672
1677
  } }], o && vn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1673
1678
  }();
1674
- function Tt(e) {
1675
- return Tt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1679
+ function _t(e) {
1680
+ return _t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1676
1681
  return typeof n;
1677
1682
  } : function(n) {
1678
1683
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1679
- }, Tt(e);
1684
+ }, _t(e);
1680
1685
  }
1681
1686
  function te(e, n) {
1682
1687
  (n == null || n > e.length) && (n = e.length);
@@ -1687,20 +1692,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1687
1692
  function wn(e, n) {
1688
1693
  for (var o = 0; o < n.length; o++) {
1689
1694
  var i = n[o];
1690
- i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (h = function(y, w) {
1691
- if (Tt(y) !== "object" || y === null)
1695
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
1696
+ if (_t(y) !== "object" || y === null)
1692
1697
  return y;
1693
1698
  var x = y[Symbol.toPrimitive];
1694
1699
  if (x !== void 0) {
1695
1700
  var b = x.call(y, w);
1696
- if (Tt(b) !== "object")
1701
+ if (_t(b) !== "object")
1697
1702
  return b;
1698
1703
  throw new TypeError("@@toPrimitive must return a primitive value.");
1699
1704
  }
1700
1705
  return String(y);
1701
- }(i.key, "string"), Tt(h) === "symbol" ? h : String(h)), i);
1706
+ }(i.key, "string"), _t(c) === "symbol" ? c : String(c)), i);
1702
1707
  }
1703
- var h;
1708
+ var c;
1704
1709
  }
1705
1710
  var we = function(e) {
1706
1711
  return typeof e == "function" ? e : function() {
@@ -1716,13 +1721,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1716
1721
  }, height: function() {
1717
1722
  return 1 / 0;
1718
1723
  }, rotation: 0, vAnchor: 0, hAnchor: 0 }, i)
1719
- for (var h in i)
1720
- typeof this[h] == "function" && this[h](i[h]);
1724
+ for (var c in i)
1725
+ typeof this[c] == "function" && this[c](i[c]);
1721
1726
  this.render = this.render.bind(this);
1722
1727
  }
1723
1728
  var n, o;
1724
1729
  return n = e, o = [{ key: "anchor", value: function(i) {
1725
- var h = this.props, y = h.hAnchor, w = h.vAnchor, x = h.width, b = h.height;
1730
+ var c = this.props, y = c.hAnchor, w = c.vAnchor, x = c.width, b = c.height;
1726
1731
  if (!arguments.length)
1727
1732
  return [y * x(0), w * b(0)];
1728
1733
  if (typeof i == "string") {
@@ -1740,7 +1745,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1740
1745
  return arguments.length ? (this.props.rotation = i, this) : this.props.rotation;
1741
1746
  } }, { key: "createElement", value: function(i) {
1742
1747
  return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
1743
- } }, { key: "canvas", value: function(i, h) {
1748
+ } }, { key: "canvas", value: function(i, c) {
1744
1749
  var y, w = i.getContext ? i.getContext("2d") : i;
1745
1750
  return w.save(), w.rotate(this.rotate() * Math.PI / 180), w.translate.apply(w, function(x) {
1746
1751
  if (Array.isArray(x))
@@ -1758,7 +1763,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1758
1763
  }(y) || function() {
1759
1764
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
1760
1765
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1761
- }()), h(w), w.restore(), w;
1766
+ }()), c(w), w.restore(), w;
1762
1767
  } }, { key: "render", value: function() {
1763
1768
  var i = xe(arguments);
1764
1769
  if (i.d3)
@@ -1766,8 +1771,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1766
1771
  if (i.ctx)
1767
1772
  return this.canvas(i.ctx, i.fn);
1768
1773
  if (i.text) {
1769
- var h = typeof i.text.render == "function" ? i.text.render() : i.text;
1770
- return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, h);
1774
+ var c = typeof i.text.render == "function" ? i.text.render() : i.text;
1775
+ return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
1771
1776
  }
1772
1777
  } }], o && wn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1773
1778
  }(), bn = Object.prototype.hasOwnProperty, ee = {};
@@ -1789,32 +1794,32 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1789
1794
  if (n && o.setAttribute)
1790
1795
  for (var i in n)
1791
1796
  bn.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : An(i), n[i]);
1792
- for (var h = arguments.length, y = new Array(h > 2 ? h - 2 : 0), w = 2; w < h; w++)
1797
+ for (var c = arguments.length, y = new Array(c > 2 ? c - 2 : 0), w = 2; w < c; w++)
1793
1798
  y[w - 2] = arguments[w];
1794
1799
  return y != null && y.length && y.forEach(function(x) {
1795
1800
  Ae(o, x);
1796
1801
  }), o;
1797
1802
  }
1798
1803
  }
1799
- rt.createElement = Se, rt.textparser = Pt, rt.defaultparser = Pt, rt.htmlparser = function(e) {
1804
+ rt.createElement = Se, rt.textparser = Nt, rt.defaultparser = Nt, rt.htmlparser = function(e) {
1800
1805
  e = String(e || "").trim();
1801
- for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, h = [], y = [], w = function(M) {
1806
+ for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], y = [], w = function(M) {
1802
1807
  for (var I in i)
1803
1808
  i[I] && (M[I] = i[I]);
1804
- h.push(M);
1809
+ c.push(M);
1805
1810
  }, x = function(M) {
1806
- var I = h.length, z = tn[M];
1811
+ var I = c.length, z = tn[M];
1807
1812
  if (I && z) {
1808
- for (var R = I - 1; h[R] && (h[R] instanceof Et || Ze.test(h[R].value)); )
1813
+ for (var R = I - 1; c[R] && (c[R] instanceof Tt || Ze.test(c[R].value)); )
1809
1814
  R--;
1810
- for (; z && h[R] && h[R] instanceof nt; )
1815
+ for (; z && c[R] && c[R] instanceof nt; )
1811
1816
  R--, z--;
1812
1817
  for (; z-- > 0; )
1813
- h.push(new nt());
1818
+ c.push(new nt());
1814
1819
  }
1815
1820
  }; e.length; ) {
1816
1821
  if (n = /^[^<]+/.exec(e))
1817
- Pt(ge(n[0]), !1).forEach(w);
1822
+ Nt(ge(n[0]), !1).forEach(w);
1818
1823
  else if (!(n = Je.exec(e)))
1819
1824
  if (n = We.exec(e))
1820
1825
  y.length && (i = y.pop()), x(n[1]);
@@ -1822,45 +1827,45 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1822
1827
  var b = n[1];
1823
1828
  x(b), y.push(i), i = Object.create(i), pe[b] && pe[b](i, "");
1824
1829
  var E = rn(n[2]);
1825
- b === "a" && (E.href && (i.href = E.href), E.rel && (i.rel = E.rel), E.target && (i.target = E.target)), E.class && (i.class = i.class ? i.class + " " + E.class : E.class), E.style && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(E.style)) && o[1] && (i.color = o[1]), b === "br" && h.push(new nt());
1830
+ b === "a" && (E.href && (i.href = E.href), E.rel && (i.rel = E.rel), E.target && (i.target = E.target)), E.class && (i.class = i.class ? i.class + " " + E.class : E.class), E.style && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(E.style)) && o[1] && (i.color = o[1]), b === "br" && c.push(new nt());
1826
1831
  } else
1827
1832
  n = [e.slice(0, 1)], w(new N(n[0]));
1828
1833
  e = e.slice(n[0].length);
1829
1834
  }
1830
- for (var O = h[h.length - 1]; O instanceof nt; )
1831
- h.pop(), O = h[h.length - 1];
1832
- return h;
1835
+ for (var O = c[c.length - 1]; O instanceof nt; )
1836
+ c.pop(), O = c[c.length - 1];
1837
+ return c;
1833
1838
  }, rt.latexparser = function(e) {
1834
1839
  e = String(e || "").trim();
1835
1840
  var n = [0];
1836
- e = e.replace(/\\verb,(.*?),/, function(P, L) {
1841
+ e = e.replace(/\\verb,(.*?),/, function($, L) {
1837
1842
  return n.push(L), "\\verb," + (n.length - 1) + ",";
1838
1843
  }).replace(/\\\\\n/g, function() {
1839
1844
  return "\\\\";
1840
- }).replace(hn, function(P, L, H) {
1841
- return H.charAt(L - 1) === "\\" ? P : cn[P];
1842
- }).replace(/\n\s+/g, function(P) {
1843
- return /\n/.test(P.slice(1)) ? "\\par " : P;
1844
- }).replace(/\\symbol\{(\d+)\}/, function(P, L, H, $) {
1845
- return $.charAt(H - 1) === "\\" ? P : String.fromCharCode(1 * L);
1846
- }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(P, L, H, $) {
1847
- return L + H + "{" + $ + "}";
1848
- }).replace(/\\verb,(.*?),/, function(P, L) {
1845
+ }).replace(hn, function($, L, H) {
1846
+ return H.charAt(L - 1) === "\\" ? $ : cn[$];
1847
+ }).replace(/\n\s+/g, function($) {
1848
+ return /\n/.test($.slice(1)) ? "\\par " : $;
1849
+ }).replace(/\\symbol\{(\d+)\}/, function($, L, H, P) {
1850
+ return P.charAt(H - 1) === "\\" ? $ : String.fromCharCode(1 * L);
1851
+ }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function($, L, H, P) {
1852
+ return L + H + "{" + P + "}";
1853
+ }).replace(/\\verb,(.*?),/, function($, L) {
1849
1854
  return "\\verb,".concat(n[+L], ",");
1850
1855
  });
1851
- for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, h = [], y = [], w = function(P) {
1856
+ for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], y = [], w = function($) {
1852
1857
  for (var L in i)
1853
- i[L] && (P[L] = i[L]);
1854
- return h.push(P), P;
1858
+ i[L] && ($[L] = i[L]);
1859
+ return c.push($), $;
1855
1860
  }, x = function() {
1856
1861
  y.push(i), i = Object.create(i);
1857
1862
  }, b = function() {
1858
1863
  if (!y.length)
1859
1864
  throw new Error("Unexpected }");
1860
1865
  i = y.pop();
1861
- }, E = { tokens: h, open_context: x, close_context: b, add_token: w }; e.length; ) {
1866
+ }, E = { tokens: c, open_context: x, close_context: b, add_token: w }; e.length; ) {
1862
1867
  if (o = an.exec(e))
1863
- Pt(o[0], !1).forEach(w);
1868
+ Nt(o[0], !1).forEach(w);
1864
1869
  else if (o = ln.exec(e))
1865
1870
  w(new N(o[1]));
1866
1871
  else if (!(o = on.exec(e))) {
@@ -1897,24 +1902,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1897
1902
  }
1898
1903
  e = e.slice(o[0].length);
1899
1904
  }
1900
- return h;
1905
+ return c;
1901
1906
  }, rt.measureText = function(e, n, o) {
1902
- return U(e, S(n), o);
1903
- }, rt.Token = N, rt.Break = Et, rt.LineBreak = nt, rt.SoftHyphen = pt, rt.Rotator = be, be.createElement = Se;
1907
+ return Y(e, S(n), o);
1908
+ }, rt.Token = N, rt.Break = Tt, rt.LineBreak = nt, rt.SoftHyphen = pt, rt.Rotator = be, be.createElement = Se;
1904
1909
  const Sn = rt;
1905
1910
  return r.default;
1906
1911
  })());
1907
1912
  })(Ve);
1908
1913
  var Fn = Ve.exports;
1909
1914
  const Oe = /* @__PURE__ */ ce(Fn);
1910
- function qn(u, l) {
1911
- const t = ct(u), { fontSize: r, font: a, padding: c = 0 } = u.properties.style || {};
1915
+ function Bn(u, l) {
1916
+ const t = ut(u), { fontSize: r, font: a, padding: h = 0 } = u.properties.style || {};
1912
1917
  if (t.width === t.height && t.width === 0)
1913
1918
  return;
1914
1919
  const p = new Oe({
1915
1920
  font: `${r}px/${r}px ${a}`.replace(/(px)+/g, "px"),
1916
- width: t.width - c * 2,
1917
- height: t.height - c * 2,
1921
+ width: t.width - h * 2,
1922
+ height: t.height - h * 2,
1918
1923
  align: "left",
1919
1924
  valign: "top",
1920
1925
  x: 0,
@@ -1925,10 +1930,10 @@ function qn(u, l) {
1925
1930
  u.properties.content.replaceAll(`
1926
1931
  `, "<br>")
1927
1932
  ).render();
1928
- p.setAttribute("transform", `translate(${c}, ${c})`), l.appendChild(p);
1933
+ p.setAttribute("transform", `translate(${h}, ${h})`), l.appendChild(p);
1929
1934
  }
1930
1935
  const Me = 20;
1931
- class Bn extends Be {
1936
+ class qn extends qe {
1932
1937
  constructor(t, r = {}) {
1933
1938
  super(
1934
1939
  t,
@@ -1953,7 +1958,7 @@ class Bn extends Be {
1953
1958
  v(this, "startX", 0);
1954
1959
  v(this, "startY", 0);
1955
1960
  v(this, "handles", []);
1956
- v(this, "draggedHandle", B);
1961
+ v(this, "draggedHandle", q);
1957
1962
  v(this, "isFocused", !1);
1958
1963
  v(this, "placeholder", "Type your text here...");
1959
1964
  v(this, "_onFocus", () => {
@@ -1964,16 +1969,16 @@ class Bn extends Be {
1964
1969
  });
1965
1970
  v(this, "startDrawing", (t, r, a = jn(t, r, 0, 0, "", At)) => {
1966
1971
  this.add(a);
1967
- const c = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
1968
- this.select(a.id), this.startDragging(this.getById(a.id), c.x, c.y), this.draggedHandle = 6;
1972
+ const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
1973
+ this.select(a.id), this.startDragging(this.getById(a.id), h.x, h.y), this.draggedHandle = 6;
1969
1974
  });
1970
1975
  v(this, "cancelDrawing", () => {
1971
- this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...re }, this.draggedHandle = B, this.isDragging = !1, this.emit(St, this.annotation));
1976
+ this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...re }, this.draggedHandle = q, this.isDragging = !1, this.emit(St, this.annotation));
1972
1977
  });
1973
1978
  v(this, "startDragging", (t, r, a) => {
1974
1979
  this.annotation = t;
1975
- const c = ft(this.annotation), f = ct(this.annotation);
1976
- this.rect.x = c.x, this.rect.y = c.y, this.rect.width = f.width, this.rect.height = f.height, this.startX = r, this.startY = a, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Vt, this.annotation), this.isDragging = !0;
1980
+ const h = ct(this.annotation), d = ut(this.annotation);
1981
+ this.rect.x = h.x, this.rect.y = h.y, this.rect.width = d.width, this.rect.height = d.height, this.startX = r, this.startY = a, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Yt, this.annotation), this.isDragging = !0;
1977
1982
  });
1978
1983
  v(this, "onHandleMouseDown", (t) => {
1979
1984
  const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
@@ -1986,19 +1991,19 @@ class Bn extends Be {
1986
1991
  if (!this.isDragging)
1987
1992
  return;
1988
1993
  t.stopPropagation(), t.preventDefault();
1989
- const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), c = r.classList.contains("left"), f = r.classList.contains("right"), g = r.classList.contains("bottom"), p = r.classList.contains("line-handle"), s = this.ogma.view.getZoom(), d = (t.clientX - this.startX) / s, m = (t.clientY - this.startY) / s, A = this.ogma.view.getAngle(), T = new G(d, m).rotateRadians(A);
1990
- (g && c || a && f) && (T.y = 0, T.x = 0);
1991
- const S = c || p ? this.rect.x + T.x : this.rect.x, C = a || p ? this.rect.y + T.y : this.rect.y, k = Math.max(
1992
- this.rect.width + d * (p || c ? 0 : 1),
1994
+ const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), h = r.classList.contains("left"), d = r.classList.contains("right"), g = r.classList.contains("bottom"), p = r.classList.contains("line-handle"), s = this.ogma.view.getZoom(), f = (t.clientX - this.startX) / s, m = (t.clientY - this.startY) / s, A = this.ogma.view.getAngle(), T = new U(f, m).rotateRadians(A);
1995
+ (g && h || a && d) && (T.y = 0, T.x = 0);
1996
+ const S = h || p ? this.rect.x + T.x : this.rect.x, C = a || p ? this.rect.y + T.y : this.rect.y, k = Math.max(
1997
+ this.rect.width + f * (p || h ? 0 : 1),
1993
1998
  Me
1994
1999
  ), F = Math.max(
1995
2000
  this.rect.height + m * (p || a ? 0 : 1),
1996
2001
  Me
1997
2002
  );
1998
- zn(this.annotation, S, C, k, F), this.emit(Bt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
2003
+ zn(this.annotation, S, C, k, F), this.emit(Ut, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
1999
2004
  });
2000
2005
  v(this, "onMouseUp", () => {
2001
- !this.isDragging || this.draggedHandle === B || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(St, this.annotation), this.isDragging = !1, this.draggedHandle = B);
2006
+ !this.isDragging || this.draggedHandle === q || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(St, this.annotation), this.isDragging = !1, this.draggedHandle = q);
2002
2007
  });
2003
2008
  v(this, "onViewChanged", () => {
2004
2009
  const t = Math.max(2, this.handleSize / this.ogma.view.getZoom());
@@ -2013,48 +2018,53 @@ class Bn extends Be {
2013
2018
  a.addEventListener("input", this._onInput), a.addEventListener("focus", this._onFocus), a.addEventListener("blur", this._onBlur), a.spellcheck = !1, this.handles = Array.prototype.slice.call(
2014
2019
  this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
2015
2020
  ), this.handles.forEach(
2016
- (c) => c.addEventListener("mousedown", this.onHandleMouseDown)
2021
+ (h) => h.addEventListener("mousedown", this.onHandleMouseDown)
2017
2022
  ), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0), t.events.on(["viewChanged", "zoom"], this.onViewChanged);
2018
2023
  }
2019
2024
  _canRemove() {
2020
2025
  return !this.isFocused;
2021
2026
  }
2022
2027
  detect({ x: t, y: r }, a = 0) {
2023
- const c = new G(t, r), f = this.ogma.view.getAngle();
2028
+ const h = new U(t, r), d = this.ogma.view.getAngle();
2024
2029
  return this.elements.find((g) => {
2025
- const { x: p, y: s } = ft(g), { width: d, height: m } = ct(g), A = new G(p, s), { x: T, y: S } = c.sub(A).rotateRadians(-f);
2026
- return T > -a && T < d + a && S > -a && S < m + a;
2030
+ const { x: p, y: s } = ct(g), { width: f, height: m } = ut(g), A = new U(p, s), { x: T, y: S } = h.sub(A).rotateRadians(-d);
2031
+ return T > -a && T < f + a && S > -a && S < m + a;
2027
2032
  });
2028
2033
  }
2029
2034
  draw(t) {
2030
2035
  t.innerHTML = "";
2031
- const r = "", a = this.ogma.view.getAngle() * 180 / Math.PI;
2032
- this.elements.forEach((f, g) => {
2033
- const p = `class${g}`, s = ct(f), d = ft(f), m = f.id, {
2036
+ const r = "", a = this.ogma.view.getAngle();
2037
+ this.elements.forEach((d, g) => {
2038
+ const p = `class${g}`, s = ut(d), f = ct(d), m = d.id, {
2034
2039
  color: A,
2035
2040
  fontSize: T,
2036
2041
  font: S,
2037
2042
  strokeColor: C,
2038
2043
  strokeWidth: k,
2039
2044
  strokeType: F,
2040
- background: Y
2041
- } = f.properties.style || At;
2045
+ background: X
2046
+ } = d.properties.style || At;
2042
2047
  if (m === this.selectedId)
2043
2048
  return;
2044
- const D = Dt("g");
2049
+ const D = Mt("g");
2045
2050
  D.classList.add("annotation-text"), D.setAttribute("fill", `${A}`), D.setAttribute("font-size", `${T}px`), D.setAttribute("font-family", `${S}`);
2046
- const U = Dt("rect");
2047
- let X = !1;
2048
- F && F !== "none" && (X = !0, U.setAttribute("stroke", C || "black"), U.setAttribute("stroke-width", `${k}`), F === "dashed" && U.setAttribute("stroke-dasharray", "5,5")), (Y && Y.length || X) && (X = !0, U.setAttribute("fill", Y || "transparent")), X && (U.setAttribute("width", `${s.width}`), U.setAttribute("height", `${s.height}`)), D.appendChild(U), qn(f, D), D.setAttribute("transform", `translate(${d.x},${d.y}) rotate(${a})`), D.classList.add(p), D.setAttribute("data-annotation", `${f.id}`), D.setAttribute("data-annotation-type", "text"), t.appendChild(D);
2051
+ const Y = Mt("rect");
2052
+ let G = !1;
2053
+ F && F !== "none" && (G = !0, Y.setAttribute("stroke", C || "black"), Y.setAttribute("stroke-width", `${k}`), F === "dashed" && Y.setAttribute("stroke-dasharray", "5,5")), (X && X.length || G) && (G = !0, Y.setAttribute("fill", X || "transparent")), G && (Y.setAttribute("width", `${s.width}`), Y.setAttribute("height", `${s.height}`)), D.appendChild(Y), Bn(d, D);
2054
+ const { x: Et, y: kt } = new U(f.x, f.y).rotateRadians(-a);
2055
+ D.setAttribute("transform", `translate(${Et},${kt})`), D.classList.add(p), D.setAttribute("data-annotation", `${d.id}`), D.setAttribute("data-annotation-type", "text"), t.appendChild(D);
2049
2056
  });
2050
- const c = Dt("style");
2051
- c.innerHTML = r, t.firstChild && t.insertBefore(c, t.firstChild);
2057
+ const h = Mt("style");
2058
+ h.innerHTML = r, t.firstChild && t.insertBefore(h, t.firstChild);
2052
2059
  }
2053
2060
  refreshDrawing() {
2054
- const t = this.ogma.view.getAngle() * 180 / Math.PI;
2061
+ const t = this.ogma.view.getAngle();
2055
2062
  [...this.layer.element.children].forEach((r) => {
2056
- const a = r.getAttribute("transform"), c = a == null ? void 0 : a.match(/translate\(([^)]+)\)/);
2057
- c && r.setAttribute("transform", `translate(${c[1]}) rotate(${t})`);
2063
+ const a = r.getAttribute("data-annotation");
2064
+ if (!a)
2065
+ return;
2066
+ const h = ct(this.getById(a)), { x: d, y: g } = new U(h.x, h.y).rotateRadians(-t);
2067
+ r.setAttribute("transform", `translate(${d},${g})`);
2058
2068
  });
2059
2069
  }
2060
2070
  getDefaultOptions() {
@@ -2063,14 +2073,14 @@ class Bn extends Be {
2063
2073
  refreshEditor() {
2064
2074
  if (+this.selectedId < 0 && +this.hoveredId < 0)
2065
2075
  return;
2066
- const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ct(t), a = this.ogma.view.graphToScreenCoordinates(ft(t)), c = this.ogma.view.getZoom(), {
2067
- font: f,
2076
+ const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), a = this.ogma.view.graphToScreenCoordinates(ct(t)), h = this.ogma.view.getZoom(), {
2077
+ font: d,
2068
2078
  fontSize: g,
2069
2079
  color: p,
2070
2080
  background: s,
2071
- padding: d = 0
2072
- } = t.properties.style || At, m = (g || 1) * c;
2073
- this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${a.x}px, ${a.y}px)translate(-50%, -50%)translate(${r.width / 2 * c}px, ${r.height / 2 * c}px)`, this.editor.element.style.width = `${r.width * c}px`, this.editor.element.style.height = `${r.height * c}px`, this.textArea.style.font = `${m} ${f}`, this.textArea.style.fontFamily = f || "sans-serif", this.textArea.style.fontSize = `${m}px`, this.textArea.style.padding = `${c * d}px`, this.textArea.style.lineHeight = `${m}px`, this.textArea.style.boxSizing = "border-box", this.textArea.style.color = p || "black", this.textArea.style.background = s || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
2081
+ padding: f = 0
2082
+ } = t.properties.style || At, m = (g || 1) * h;
2083
+ this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${a.x}px, ${a.y}px)translate(-50%, -50%)translate(${r.width / 2 * h}px, ${r.height / 2 * h}px)`, this.editor.element.style.width = `${r.width * h}px`, this.editor.element.style.height = `${r.height * h}px`, this.textArea.style.font = `${m} ${d}`, this.textArea.style.fontFamily = d || "sans-serif", this.textArea.style.fontSize = `${m}px`, this.textArea.style.padding = `${h * f}px`, this.textArea.style.lineHeight = `${m}px`, this.textArea.style.boxSizing = "border-box", this.textArea.style.color = p || "black", this.textArea.style.background = s || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
2074
2084
  }
2075
2085
  select(t) {
2076
2086
  super.select(t), this.textArea.focus();
@@ -2085,20 +2095,20 @@ class Vn {
2085
2095
  v(this, "linksByTargetId", {});
2086
2096
  v(this, "linksByArrowId", {});
2087
2097
  }
2088
- add(l, t, r, a, c) {
2089
- const f = Ut(), g = l.id, p = {
2090
- id: f,
2098
+ add(l, t, r, a, h) {
2099
+ const d = Xt(), g = l.id, p = {
2100
+ id: d,
2091
2101
  arrow: g,
2092
2102
  target: r,
2093
2103
  targetType: a,
2094
- connectionPoint: c,
2104
+ connectionPoint: h,
2095
2105
  side: t
2096
2106
  };
2097
- return this.links[f] = p, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(f), this.linksByArrowId[g] || (this.linksByArrowId[g] = {}), this.linksByArrowId[g][t] = f, l.properties.link = l.properties.link || {}, l.properties.link[t] = {
2107
+ return this.links[d] = p, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(d), this.linksByArrowId[g] || (this.linksByArrowId[g] = {}), this.linksByArrowId[g][t] = d, l.properties.link = l.properties.link || {}, l.properties.link[t] = {
2098
2108
  id: r,
2099
2109
  side: t,
2100
2110
  type: a,
2101
- magnet: c
2111
+ magnet: h
2102
2112
  }, this;
2103
2113
  }
2104
2114
  arrowIsLinked(l, t) {
@@ -2111,12 +2121,12 @@ class Vn {
2111
2121
  const r = l.id, a = (g = this.linksByArrowId[r]) == null ? void 0 : g[t];
2112
2122
  if ((p = l.properties.link) == null || delete p[t], !a)
2113
2123
  return this;
2114
- const c = this.links[a];
2124
+ const h = this.links[a];
2115
2125
  delete this.links[a];
2116
- const f = this.linksByTargetId[c.target];
2117
- for (let s = 0; s < f.length; s++)
2118
- if (f[s] === a) {
2119
- f.splice(s, 1);
2126
+ const d = this.linksByTargetId[h.target];
2127
+ for (let s = 0; s < d.length; s++)
2128
+ if (d[s] === a) {
2129
+ d.splice(s, 1);
2120
2130
  break;
2121
2131
  }
2122
2132
  return delete this.linksByArrowId[r][t], this;
@@ -2154,7 +2164,7 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
2154
2164
  { x: 0.5, y: 1 },
2155
2165
  { x: 1, y: 1 }
2156
2166
  ];
2157
- class Gn extends qe {
2167
+ class Gn extends Be {
2158
2168
  constructor(t, r = {}) {
2159
2169
  super();
2160
2170
  v(this, "arrows");
@@ -2178,29 +2188,29 @@ class Gn extends qe {
2178
2188
  Ce.forEach((a) => {
2179
2189
  if (!this.textToMagnet)
2180
2190
  return;
2181
- const c = ct(this.textToMagnet), f = ft(this.textToMagnet), { x: g, y: p } = new G(a.x, a.y).mul({ x: c.width, y: c.height }).rotateRadians(this.ogma.view.getAngle()).add(f);
2191
+ const h = ut(this.textToMagnet), d = ct(this.textToMagnet), { x: g, y: p } = new U(a.x, a.y).mul({ x: h.width, y: h.height }).rotateRadians(this.ogma.view.getAngle()).add(d);
2182
2192
  t.moveTo(g, p), t.arc(g, p, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
2183
2193
  }), t.fill(), t.closePath();
2184
2194
  });
2185
2195
  v(this, "_onFeatureDrag", (t, r) => {
2186
2196
  const a = r;
2187
2197
  if (ot(t) && a === "line")
2188
- ["start", "end"].find((c) => {
2189
- const f = c === "start" ? Ot(t) : Ft(t);
2190
- return this._snapToText(t, a, f) || this._findAndSnapToNode(t, c, f);
2198
+ ["start", "end"].find((h) => {
2199
+ const d = h === "start" ? zt(t) : qt(t);
2200
+ return this._snapToText(t, a, d) || this._findAndSnapToNode(t, h, d);
2191
2201
  });
2192
2202
  else if (ot(t) && a !== "line") {
2193
- const c = a === "start" ? Ot(t) : Ft(t);
2194
- this._snapToText(t, a, c) || this._findAndSnapToNode(t, a, c);
2203
+ const h = a === "start" ? zt(t) : qt(t);
2204
+ this._snapToText(t, a, h) || this._findAndSnapToNode(t, a, h);
2195
2205
  } else
2196
- mt(t) && (this.activeLinks.forEach(({ arrow: c, side: f, connectionPoint: g }) => {
2197
- const p = this.getAnnotation(c), s = ct(t), d = ft(t), m = new G(g.x, g.y).mul({ x: s.width, y: s.height }).rotateRadians(this.ogma.view.getAngle()).add(d);
2198
- p.geometry.coordinates[f === "start" ? 0 : 1] = [m.x, m.y];
2206
+ mt(t) && (this.activeLinks.forEach(({ arrow: h, side: d, connectionPoint: g }) => {
2207
+ const p = this.getAnnotation(h), s = ut(t), f = ct(t), m = new U(g.x, g.y).mul({ x: s.width, y: s.height }).rotateRadians(this.ogma.view.getAngle()).add(f);
2208
+ p.geometry.coordinates[d === "start" ? 0 : 1] = [m.x, m.y];
2199
2209
  }), this.activeLinks.length && this.arrows.refreshLayer());
2200
- this.layer.refresh(), this.emit(Bt, t, r);
2210
+ this.layer.refresh(), this.emit(Ut, t, r);
2201
2211
  });
2202
2212
  v(this, "_onFeatureDragEnd", (t) => {
2203
- this.dragged !== null && ot(t) && Ot(this.dragged) && Le.forEach((r) => {
2213
+ this.dragged !== null && ot(t) && zt(this.dragged) && Le.forEach((r) => {
2204
2214
  this.links.getArrowLink(t.id, r) && this.emit(Nn, {
2205
2215
  arrow: t,
2206
2216
  link: this.links.getArrowLink(t.id, r)
@@ -2211,7 +2221,7 @@ class Gn extends qe {
2211
2221
  this.textToMagnet = void 0, ot(t) ? this.dragged = t : mt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
2212
2222
  const a = r.getSelectedFeature();
2213
2223
  a && a !== t && r.unhover().unselect(), r.disableDetection();
2214
- }), this.emit(Vt, t);
2224
+ }), this.emit(Yt, t);
2215
2225
  });
2216
2226
  v(this, "_onNodesDragStart", () => {
2217
2227
  this.arrows.unhover().unselect(), this.texts.unhover().unselect();
@@ -2222,11 +2232,11 @@ class Gn extends qe {
2222
2232
  });
2223
2233
  v(this, "_onLayoutEnd", (t) => {
2224
2234
  t.ids.forEach((r, a) => {
2225
- this.links.getTargetLinks(r, "node").forEach((f) => {
2226
- const g = this.getAnnotation(f.arrow), p = f.side, s = Rt(
2235
+ this.links.getTargetLinks(r, "node").forEach((d) => {
2236
+ const g = this.getAnnotation(d.arrow), p = d.side, s = jt(
2227
2237
  g,
2228
2238
  p === "start" ? "end" : "start"
2229
- ), d = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), A = Ht(s, d, +m);
2239
+ ), f = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), A = Ft(s, f, +m);
2230
2240
  bt(g, p, A.x, A.y);
2231
2241
  });
2232
2242
  }), this.arrows.refreshLayer(), this.texts.refreshLayer();
@@ -2255,56 +2265,56 @@ class Gn extends qe {
2255
2265
  v(this, "_onUpdate", (t) => {
2256
2266
  this.emit(he, t);
2257
2267
  });
2258
- this.options = this.setOptions({ ...Un, ...r }), this.ogma = t, this.arrows = new Hn(t, this.options), this.texts = new Bn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
2259
- a.on(Vt, this._onFeatureDragStart).on(Bt, this._onFeatureDrag).on(St, this._onFeatureDragEnd).on(he, this.onUpdate).on(oe, this._onUnselect).on(se, this._onSelect).on(le, this._onAdded).on(ae, this._onRemoved);
2268
+ this.options = this.setOptions({ ...Un, ...r }), this.ogma = t, this.arrows = new Hn(t, this.options), this.texts = new qn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
2269
+ a.on(Yt, this._onFeatureDragStart).on(Ut, this._onFeatureDrag).on(St, this._onFeatureDragEnd).on(he, this.onUpdate).on(oe, this._onUnselect).on(se, this._onSelect).on(le, this._onAdded).on(ae, this._onRemoved);
2260
2270
  }), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
2261
2271
  this.refreshTextLinks();
2262
2272
  }), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
2263
2273
  }
2264
2274
  _moveNodes(t, r, a) {
2265
- t.forEach((c) => {
2266
- const f = this.links.getTargetLinks(c.getId(), "node"), g = c.getPosition();
2267
- f.forEach((p) => {
2268
- const s = this.getAnnotation(p.arrow), d = p.side, m = Rt(
2275
+ t.forEach((h) => {
2276
+ const d = this.links.getTargetLinks(h.getId(), "node"), g = h.getPosition();
2277
+ d.forEach((p) => {
2278
+ const s = this.getAnnotation(p.arrow), f = p.side, m = jt(
2269
2279
  s,
2270
- d === "start" ? "end" : "start"
2280
+ f === "start" ? "end" : "start"
2271
2281
  );
2272
2282
  let A = g;
2273
- const T = +c.getAttribute("radius"), S = 1e-6;
2274
- (p.connectionPoint.x - (g.x - r) > S || p.connectionPoint.y - (g.y - a) > S) && (A = Ht(m, g, T)), bt(s, d, A.x, A.y);
2283
+ const T = +h.getAttribute("radius"), S = 1e-6;
2284
+ (p.connectionPoint.x - (g.x - r) > S || p.connectionPoint.y - (g.y - a) > S) && (A = Ft(m, g, T)), bt(s, f, A.x, A.y);
2275
2285
  });
2276
2286
  }), this.arrows.refreshLayer();
2277
2287
  }
2278
2288
  _snapToText(t, r, a) {
2279
- const c = this.texts.detect(a, this.options.detectMargin);
2280
- if (this.links.remove(t, r), !c)
2289
+ const h = this.texts.detect(a, this.options.detectMargin);
2290
+ if (this.links.remove(t, r), !h)
2281
2291
  return !1;
2282
- this.textToMagnet = c;
2283
- const f = this.findMagnetPoint(Ce, c, a);
2284
- return f ? (bt(t, r, f.point.x, f.point.y), this.links.add(t, r, c.id, "text", f.magnet), !0) : !1;
2292
+ this.textToMagnet = h;
2293
+ const d = this.findMagnetPoint(Ce, h, a);
2294
+ return d ? (bt(t, r, d.point.x, d.point.y), this.links.add(t, r, h.id, "text", d.magnet), !0) : !1;
2285
2295
  }
2286
2296
  _findAndSnapToNode(t, r, a) {
2287
- const c = this.ogma.view.graphToScreenCoordinates(a), f = this.ogma.view.getElementAt(c);
2288
- this.links.remove(t, r), f && f.isNode ? (this.hoveredNode = f, this.hoveredNode.setSelected(!0), this._snapToNode(t, r, f, c)) : (this.hoveredNode && this.hoveredNode.setSelected(!1), this.hoveredNode = null);
2297
+ const h = this.ogma.view.graphToScreenCoordinates(a), d = this.ogma.view.getElementAt(h);
2298
+ this.links.remove(t, r), d && d.isNode ? (this.hoveredNode = d, this.hoveredNode.setSelected(!0), this._snapToNode(t, r, d, h)) : (this.hoveredNode && this.hoveredNode.setSelected(!1), this.hoveredNode = null);
2289
2299
  }
2290
- _snapToNode(t, r, a, c) {
2291
- const f = a.getPositionOnScreen(), g = +a.getAttribute("radius"), p = g * this.ogma.view.getZoom(), s = c.x - f.x, d = c.y - f.y, m = Math.sqrt(s * s + d * d), A = a.getPosition();
2300
+ _snapToNode(t, r, a, h) {
2301
+ const d = a.getPositionOnScreen(), g = +a.getAttribute("radius"), p = g * this.ogma.view.getZoom(), s = h.x - d.x, f = h.y - d.y, m = Math.sqrt(s * s + f * f), A = a.getPosition();
2292
2302
  if (m < p + this.options.detectMargin) {
2293
2303
  let T = A;
2294
2304
  if (m > p / 2) {
2295
- const S = Rt(t, r === "end" ? "start" : "end");
2296
- T = Ht(S, T, g);
2305
+ const S = jt(t, r === "end" ? "start" : "end");
2306
+ T = Ft(S, T, g);
2297
2307
  }
2298
2308
  bt(t, r, T.x, T.y), this.links.add(t, r, a.getId(), "node", T);
2299
2309
  }
2300
2310
  }
2301
2311
  refreshTextLinks() {
2302
2312
  let t = !1;
2303
- this.links.forEach(({ connectionPoint: r, targetType: a, target: c, arrow: f, side: g }) => {
2313
+ this.links.forEach(({ connectionPoint: r, targetType: a, target: h, arrow: d, side: g }) => {
2304
2314
  if (a !== "text")
2305
2315
  return;
2306
2316
  t = !0;
2307
- const p = this.getAnnotation(c), s = this.getAnnotation(f), d = ct(p), m = ft(p), A = new G(r.x, r.y).mul({ x: d.width, y: d.height }).rotateRadians(this.ogma.view.getAngle()).add(m);
2317
+ const p = this.getAnnotation(h), s = this.getAnnotation(d), f = ut(p), m = ct(p), A = new U(r.x, r.y).mul({ x: f.width, y: f.height }).rotateRadians(this.ogma.view.getAngle()).add(m);
2308
2318
  bt(s, g, A.x, A.y);
2309
2319
  }), t && this.arrows.refreshLayer();
2310
2320
  }
@@ -2315,23 +2325,23 @@ class Gn extends qe {
2315
2325
  return this.selected;
2316
2326
  }
2317
2327
  findMagnetPoint(t, r, a) {
2318
- let c;
2319
- for (const f of t) {
2320
- const g = ct(r), p = ft(r), s = new G(f.x, f.y).mul({ x: g.width, y: g.height }).rotateRadians(this.ogma.view.getAngle()).add(p), d = s.sub(a).length(), m = Math.min(
2328
+ let h;
2329
+ for (const d of t) {
2330
+ const g = ut(r), p = ct(r), s = new U(d.x, d.y).mul({ x: g.width, y: g.height }).rotateRadians(this.ogma.view.getAngle()).add(p), f = s.sub(a).length(), m = Math.min(
2321
2331
  this.options.magnetRadius * this.ogma.view.getZoom(),
2322
2332
  // when really zoomed in: avoid to snap on too far away magnets
2323
2333
  g.width / 2,
2324
2334
  g.height / 2
2325
2335
  );
2326
- if (d < Math.max(m, this.options.magnetHandleRadius)) {
2327
- c = {
2336
+ if (f < Math.max(m, this.options.magnetHandleRadius)) {
2337
+ h = {
2328
2338
  point: s,
2329
- magnet: f
2339
+ magnet: d
2330
2340
  };
2331
2341
  break;
2332
2342
  }
2333
2343
  }
2334
- return c;
2344
+ return h;
2335
2345
  }
2336
2346
  /**
2337
2347
  * Set the options for the controller
@@ -2364,11 +2374,11 @@ class Gn extends qe {
2364
2374
  */
2365
2375
  add(t) {
2366
2376
  if (ze(t)) {
2367
- const [r, a] = t.features.reduce((c, f) => (ot(f) ? c[1].push(f) : mt(f) && c[0].push(f), c), [[], []]);
2377
+ const [r, a] = t.features.reduce((h, d) => (ot(d) ? h[1].push(d) : mt(d) && h[0].push(d), h), [[], []]);
2368
2378
  return r.forEach(
2369
- (c) => this.add(c)
2379
+ (h) => this.add(h)
2370
2380
  ), a.forEach(
2371
- (c) => this.add(c)
2381
+ (h) => this.add(h)
2372
2382
  ), this.arrows.refreshLayer(), this;
2373
2383
  }
2374
2384
  switch (t.properties.type) {
@@ -2396,16 +2406,16 @@ class Gn extends qe {
2396
2406
  const a = t.properties.link[r];
2397
2407
  if (!a)
2398
2408
  continue;
2399
- const c = this.getAnnotation(a.id);
2400
- if (a.type === "text" && c)
2409
+ const h = this.getAnnotation(a.id);
2410
+ if (a.type === "text" && h)
2401
2411
  this.links.add(t, r, a.id, a.type, a.magnet);
2402
2412
  else if (a.type === "node") {
2403
- const f = this.ogma.getNode(a.id);
2404
- if (!f)
2413
+ const d = this.ogma.getNode(a.id);
2414
+ if (!d)
2405
2415
  continue;
2406
2416
  this.links.add(t, r, a.id, a.type, a.magnet);
2407
- const g = f.getPosition(), p = f.getAttribute("radius") || 0, s = Rt(t, r === "start" ? "end" : "start"), d = Ht(s, g, +p);
2408
- bt(t, r, d.x, d.y);
2417
+ const g = d.getPosition(), p = d.getAttribute("radius") || 0, s = jt(t, r === "start" ? "end" : "start"), f = Ft(s, g, +p);
2418
+ bt(t, r, f.x, f.y);
2409
2419
  }
2410
2420
  }
2411
2421
  }
@@ -2431,7 +2441,7 @@ class Gn extends qe {
2431
2441
  * Cancel drawing on the current frame
2432
2442
  */
2433
2443
  cancelDrawing() {
2434
- this.annotations.forEach((t) => t.cancelDrawing()), this.emit($n);
2444
+ this.annotations.forEach((t) => t.cancelDrawing()), this.emit(Pn);
2435
2445
  }
2436
2446
  /**
2437
2447
  * Update the style of the annotation with the given id
@@ -2439,7 +2449,7 @@ class Gn extends qe {
2439
2449
  * @param style The new style
2440
2450
  */
2441
2451
  updateStyle(t, r) {
2442
- const a = this.getAnnotations().features.find((c) => c.id === t);
2452
+ const a = this.getAnnotations().features.find((h) => h.id === t);
2443
2453
  return a ? (ot(a) ? this.arrows.updateStyle(a, r) : mt(a) && this.texts.updateStyle(a, r), this.onUpdate(a), this) : this;
2444
2454
  }
2445
2455
  /**
@@ -2473,25 +2483,25 @@ class Gn extends qe {
2473
2483
  export {
2474
2484
  Hn as Arrows,
2475
2485
  Gn as Control,
2476
- Bn as Texts,
2486
+ qn as Texts,
2477
2487
  Dn as createArrow,
2478
- Dt as createSVGElement,
2488
+ Mt as createSVGElement,
2479
2489
  jn as createText,
2480
2490
  Ee as defaultArrowOptions,
2481
- Mt as defaultArrowStyle,
2491
+ Lt as defaultArrowStyle,
2482
2492
  De as defaultControllerOptions,
2483
2493
  re as defaultTextOptions,
2484
2494
  At as defaultTextStyle,
2485
2495
  Xn as getAnnotationsBounds,
2486
- Ft as getArrowEnd,
2487
- qt as getArrowEndPoints,
2488
- Rt as getArrowSide,
2489
- Ot as getArrowStart,
2490
- Ht as getAttachmentPointOnNode,
2496
+ qt as getArrowEnd,
2497
+ Vt as getArrowEndPoints,
2498
+ jt as getArrowSide,
2499
+ zt as getArrowStart,
2500
+ Ft as getAttachmentPointOnNode,
2491
2501
  He as getHandleId,
2492
- $e as getTextBbox,
2493
- ft as getTextPosition,
2494
- ct as getTextSize,
2502
+ Pe as getTextBbox,
2503
+ ct as getTextPosition,
2504
+ ut as getTextSize,
2495
2505
  ze as isAnnotationCollection,
2496
2506
  ot as isArrow,
2497
2507
  mt as isText,
@@ -2501,4 +2511,3 @@ export {
2501
2511
  zn as setTextBbox,
2502
2512
  Mn as updateTextBbox
2503
2513
  };
2504
- //# sourceMappingURL=index.mjs.map