@linkurious/ogma-annotations 1.1.10 → 1.1.12

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
@@ -1,11 +1,11 @@
1
- var _n = Object.defineProperty;
2
- var In = (u, l, t) => l in u ? _n(u, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[l] = t;
3
- var v = (u, l, t) => (In(u, typeof l != "symbol" ? l + "" : l, t), t);
4
- var Mn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
- function de(u) {
1
+ var In = Object.defineProperty;
2
+ var Mn = (u, l, t) => l in u ? In(u, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[l] = t;
3
+ var v = (u, l, t) => (Mn(u, typeof l != "symbol" ? l + "" : l, t), t);
4
+ var Dn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
+ function fe(u) {
6
6
  return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
7
7
  }
8
- var Ne = { exports: {} };
8
+ var Re = { exports: {} };
9
9
  (function(u) {
10
10
  (function(l, t) {
11
11
  u.exports = t();
@@ -16,11 +16,11 @@ var Ne = { exports: {} };
16
16
  return Math.round(s * 1e8) / 1e8;
17
17
  }
18
18
  function f(s, d) {
19
- var m = d.x - s.x, S = d.y - s.y;
20
- return Math.sqrt(m * m + S * S);
19
+ var m = d.x - s.x, A = d.y - s.y;
20
+ return Math.sqrt(m * m + A * A);
21
21
  }
22
22
  function g(s, d, m) {
23
- var S = d.y - s.y, T = d.x - s.x, b = Math.atan2(S, T);
23
+ var A = d.y - s.y, T = d.x - s.x, b = Math.atan2(A, T);
24
24
  if (m)
25
25
  for (; b < 0; )
26
26
  b += t;
@@ -191,8 +191,8 @@ var Ne = { 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), S = this.x * d - this.y * m, T = this.x * m + this.y * d;
195
- return this.x = h(S), this.y = h(T), this;
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 = h(A), this.y = h(T), this;
196
196
  },
197
197
  // [API]
198
198
  // [chainable]
@@ -482,9 +482,9 @@ var Ne = { 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
- })(Ne);
486
- var Dn = Ne.exports;
487
- const Y = /* @__PURE__ */ de(Dn);
485
+ })(Re);
486
+ var On = Re.exports;
487
+ const Y = /* @__PURE__ */ fe(On);
488
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
489
  const zt = {
490
490
  strokeType: "plain",
@@ -492,7 +492,7 @@ const zt = {
492
492
  strokeWidth: 1,
493
493
  head: "none",
494
494
  tail: "none"
495
- }, Te = {
495
+ }, _e = {
496
496
  id: 0,
497
497
  type: "Feature",
498
498
  properties: {
@@ -518,7 +518,7 @@ const zt = {
518
518
  // tail: 'arrow-plain',
519
519
  // start: { x: 0, y: 0 },
520
520
  // end: { x: 100, y: 100 }
521
- }, On = (u = 0, l = 0, t = 0, r = 0, a = { ...zt }) => ({
521
+ }, Ln = (u = 0, l = 0, t = 0, r = 0, a = { ...zt }) => ({
522
522
  id: Xt(),
523
523
  type: "Feature",
524
524
  properties: {
@@ -535,12 +535,12 @@ const zt = {
535
535
  [t, r]
536
536
  ]
537
537
  }
538
- }), Ln = "http://www.w3.org/2000/svg";
538
+ }), zn = "http://www.w3.org/2000/svg";
539
539
  function Ot(u) {
540
- return document.createElementNS(Ln, u);
540
+ return document.createElementNS(zn, u);
541
541
  }
542
542
  function He(u) {
543
- return u.geometry.bbox || zn(u), u.geometry.bbox;
543
+ return u.geometry.bbox || Cn(u), u.geometry.bbox;
544
544
  }
545
545
  function ut(u) {
546
546
  const l = He(u);
@@ -553,11 +553,11 @@ function ct(u) {
553
553
  const l = He(u);
554
554
  return { x: l[0], y: l[1] };
555
555
  }
556
- function zn(u) {
556
+ function Cn(u) {
557
557
  const [l, t] = u.geometry.coordinates[0][0], [r, a] = u.geometry.coordinates[0][2];
558
558
  u.geometry.bbox = [l, t, r, a];
559
559
  }
560
- function Cn(u, l, t, r, a) {
560
+ function Pn(u, l, t, r, a) {
561
561
  u.geometry.bbox = [l, t, l + r, t + a], u.geometry.coordinates = [
562
562
  [
563
563
  [l, t],
@@ -580,20 +580,20 @@ function Bt(u) {
580
580
  const [l, t] = u.geometry.coordinates[1];
581
581
  return { x: l, y: t };
582
582
  }
583
- function Re(u, l, t) {
583
+ function je(u, l, t) {
584
584
  u.geometry.coordinates[0] = [l, t];
585
585
  }
586
- function je(u, l, t) {
586
+ function Fe(u, l, t) {
587
587
  u.geometry.coordinates[1] = [l, t];
588
588
  }
589
589
  function Vt(u) {
590
590
  return { start: Lt(u), end: Bt(u) };
591
591
  }
592
592
  function bt(u, l, t, r) {
593
- l === "start" ? Re(u, t, r) : je(u, t, r);
593
+ l === "start" ? je(u, t, r) : Fe(u, t, r);
594
594
  }
595
- const Fe = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
596
- function Gn(u) {
595
+ const qe = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
596
+ function Zn(u) {
597
597
  return qt(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
  [
@@ -626,12 +626,21 @@ function Ft(u, l, t) {
626
626
  y: l.y + t * Math.sin(r)
627
627
  };
628
628
  }
629
- function qe(u, l = 5, t = 30) {
629
+ function ae(u, l) {
630
+ if (!l)
631
+ return { x: u.clientX, y: u.clientY };
632
+ const t = l.getBoundingClientRect();
633
+ return {
634
+ x: u.clientX - t.left - l.clientLeft,
635
+ y: u.clientY - t.top - l.clientTop
636
+ };
637
+ }
638
+ function Be(u, l = 5, t = 30) {
630
639
  var s;
631
640
  const { start: r, end: a } = Vt(u), h = new Y(r.x, r.y), g = new Y(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
641
  return Math.min(t, Math.max(3 * p, g.length() * 0.1, l));
633
642
  }
634
- function _e(u, l, t, r) {
643
+ function Ie(u, l, t, r) {
635
644
  const a = l.clone().normalize().invert().mul(r);
636
645
  if (!t || t === "none")
637
646
  return "";
@@ -639,15 +648,15 @@ function _e(u, l, t, r) {
639
648
  return `M ${h.x} ${h.y} L ${g} ${f.x} ${f.y} ${t === "arrow" ? "" : `${h.x} ${h.y}`}`;
640
649
  }
641
650
  function $n(u, l, t, r, a) {
642
- const { start: h, end: f } = Vt(u), { tail: g, head: p, strokeColor: s, strokeWidth: d } = u.properties.style || t, m = new Y(h.x, h.y), S = new Y(f.x, f.y), T = S.clone().sub(m), b = qe(u, r, a), D = Ot("path");
643
- D.setAttribute("data-annotation", `${u.id}`), D.setAttribute("data-annotation-type", "arrow");
644
- const A = p === "arrow-plain" || g === "arrow";
645
- D.setAttribute("stroke", s || "none"), D.setAttribute("stroke-width", `${d}`), D.setAttribute("fill", A ? s || "" : "none"), D.setAttribute("stroke-linecap", "round"), D.setAttribute("stroke-linejoin", "round");
646
- const $ = _e(m, T.clone().invert(), g, b), N = _e(S, T, p, b), _ = $ + `M ${m.x} ${m.y} ${S.x} ${S.y}` + N;
647
- D.setAttribute("d", _), l.appendChild(D);
651
+ const { start: h, end: f } = Vt(u), { tail: g, head: p, strokeColor: s, strokeWidth: d } = u.properties.style || t, m = new Y(h.x, h.y), A = new Y(f.x, f.y), T = A.clone().sub(m), b = Be(u, r, a), I = Ot("path");
652
+ I.setAttribute("data-annotation", `${u.id}`), I.setAttribute("data-annotation-type", "arrow");
653
+ const S = p === "arrow-plain" || g === "arrow";
654
+ I.setAttribute("stroke", s || "none"), I.setAttribute("stroke-width", `${d}`), I.setAttribute("fill", S ? s || "" : "none"), I.setAttribute("stroke-linecap", "round"), I.setAttribute("stroke-linejoin", "round");
655
+ const P = Ie(m, T.clone().invert(), g, b), $ = Ie(A, T, p, b), _ = P + `M ${m.x} ${m.y} ${A.x} ${A.y}` + $;
656
+ I.setAttribute("d", _), l.appendChild(I);
648
657
  }
649
- const V = -1, Ut = "dragging", Yt = "dragstart", St = "dragend", ae = "select", le = "unselect", Pn = "hover", Nn = "unhover", he = "remove", ce = "add", Hn = "cancelDrawing", ue = "update", Rn = "link";
650
- var Be = { exports: {} };
658
+ const V = -1, Ut = "dragging", Yt = "dragstart", St = "dragend", le = "select", he = "unselect", Nn = "hover", Rn = "unhover", ce = "remove", ue = "add", Hn = "cancelDrawing", de = "update", jn = "link";
659
+ var Ve = { exports: {} };
651
660
  (function(u) {
652
661
  var l = Object.prototype.hasOwnProperty, t = "~";
653
662
  function r() {
@@ -656,10 +665,10 @@ var Be = { exports: {} };
656
665
  function a(p, s, d) {
657
666
  this.fn = p, this.context = s, this.once = d || !1;
658
667
  }
659
- function h(p, s, d, m, S) {
668
+ function h(p, s, d, m, A) {
660
669
  if (typeof d != "function")
661
670
  throw new TypeError("The listener must be a function");
662
- var T = new a(d, m || p, S), b = t ? t + s : s;
671
+ var T = new a(d, m || p, A), b = t ? t + s : s;
663
672
  return p._events[b] ? p._events[b].fn ? p._events[b] = [p._events[b], T] : p._events[b].push(T) : (p._events[b] = T, p._eventsCount++), p;
664
673
  }
665
674
  function f(p, s) {
@@ -681,56 +690,56 @@ var Be = { exports: {} };
681
690
  return [];
682
691
  if (m.fn)
683
692
  return [m.fn];
684
- for (var S = 0, T = m.length, b = new Array(T); S < T; S++)
685
- b[S] = m[S].fn;
693
+ for (var A = 0, T = m.length, b = new Array(T); A < T; A++)
694
+ b[A] = m[A].fn;
686
695
  return b;
687
696
  }, g.prototype.listenerCount = function(s) {
688
697
  var d = t ? t + s : s, m = this._events[d];
689
698
  return m ? m.fn ? 1 : m.length : 0;
690
- }, g.prototype.emit = function(s, d, m, S, T, b) {
691
- var D = t ? t + s : s;
692
- if (!this._events[D])
699
+ }, g.prototype.emit = function(s, d, m, A, T, b) {
700
+ var I = t ? t + s : s;
701
+ if (!this._events[I])
693
702
  return !1;
694
- var A = this._events[D], $ = arguments.length, N, _;
695
- if (A.fn) {
696
- switch (A.once && this.removeListener(s, A.fn, void 0, !0), $) {
703
+ var S = this._events[I], P = arguments.length, $, _;
704
+ if (S.fn) {
705
+ switch (S.once && this.removeListener(s, S.fn, void 0, !0), P) {
697
706
  case 1:
698
- return A.fn.call(A.context), !0;
707
+ return S.fn.call(S.context), !0;
699
708
  case 2:
700
- return A.fn.call(A.context, d), !0;
709
+ return S.fn.call(S.context, d), !0;
701
710
  case 3:
702
- return A.fn.call(A.context, d, m), !0;
711
+ return S.fn.call(S.context, d, m), !0;
703
712
  case 4:
704
- return A.fn.call(A.context, d, m, S), !0;
713
+ return S.fn.call(S.context, d, m, A), !0;
705
714
  case 5:
706
- return A.fn.call(A.context, d, m, S, T), !0;
715
+ return S.fn.call(S.context, d, m, A, T), !0;
707
716
  case 6:
708
- return A.fn.call(A.context, d, m, S, T, b), !0;
717
+ return S.fn.call(S.context, d, m, A, T, b), !0;
709
718
  }
710
- for (_ = 1, N = new Array($ - 1); _ < $; _++)
711
- N[_ - 1] = arguments[_];
712
- A.fn.apply(A.context, N);
719
+ for (_ = 1, $ = new Array(P - 1); _ < P; _++)
720
+ $[_ - 1] = arguments[_];
721
+ S.fn.apply(S.context, $);
713
722
  } else {
714
- var X = A.length, W;
723
+ var X = S.length, W;
715
724
  for (_ = 0; _ < X; _++)
716
- switch (A[_].once && this.removeListener(s, A[_].fn, void 0, !0), $) {
725
+ switch (S[_].once && this.removeListener(s, S[_].fn, void 0, !0), P) {
717
726
  case 1:
718
- A[_].fn.call(A[_].context);
727
+ S[_].fn.call(S[_].context);
719
728
  break;
720
729
  case 2:
721
- A[_].fn.call(A[_].context, d);
730
+ S[_].fn.call(S[_].context, d);
722
731
  break;
723
732
  case 3:
724
- A[_].fn.call(A[_].context, d, m);
733
+ S[_].fn.call(S[_].context, d, m);
725
734
  break;
726
735
  case 4:
727
- A[_].fn.call(A[_].context, d, m, S);
736
+ S[_].fn.call(S[_].context, d, m, A);
728
737
  break;
729
738
  default:
730
- if (!N)
731
- for (W = 1, N = new Array($ - 1); W < $; W++)
732
- N[W - 1] = arguments[W];
733
- A[_].fn.apply(A[_].context, N);
739
+ if (!$)
740
+ for (W = 1, $ = new Array(P - 1); W < P; W++)
741
+ $[W - 1] = arguments[W];
742
+ S[_].fn.apply(S[_].context, $);
734
743
  }
735
744
  }
736
745
  return !0;
@@ -738,7 +747,7 @@ var Be = { exports: {} };
738
747
  return h(this, s, d, m, !1);
739
748
  }, g.prototype.once = function(s, d, m) {
740
749
  return h(this, s, d, m, !0);
741
- }, g.prototype.removeListener = function(s, d, m, S) {
750
+ }, g.prototype.removeListener = function(s, d, m, A) {
742
751
  var T = t ? t + s : s;
743
752
  if (!this._events[T])
744
753
  return this;
@@ -746,21 +755,21 @@ var Be = { exports: {} };
746
755
  return f(this, T), this;
747
756
  var b = this._events[T];
748
757
  if (b.fn)
749
- b.fn === d && (!S || b.once) && (!m || b.context === m) && f(this, T);
758
+ b.fn === d && (!A || b.once) && (!m || b.context === m) && f(this, T);
750
759
  else {
751
- for (var D = 0, A = [], $ = b.length; D < $; D++)
752
- (b[D].fn !== d || S && !b[D].once || m && b[D].context !== m) && A.push(b[D]);
753
- A.length ? this._events[T] = A.length === 1 ? A[0] : A : f(this, T);
760
+ for (var I = 0, S = [], P = b.length; I < P; I++)
761
+ (b[I].fn !== d || A && !b[I].once || m && b[I].context !== m) && S.push(b[I]);
762
+ S.length ? this._events[T] = S.length === 1 ? S[0] : S : f(this, T);
754
763
  }
755
764
  return this;
756
765
  }, g.prototype.removeAllListeners = function(s) {
757
766
  var d;
758
767
  return s ? (d = t ? t + s : s, this._events[d] && f(this, d)) : (this._events = new r(), this._eventsCount = 0), this;
759
768
  }, g.prototype.off = g.prototype.removeListener, g.prototype.addListener = g.prototype.on, g.prefixed = t, g.EventEmitter = g, u.exports = g;
760
- })(Be);
761
- var jn = Be.exports;
762
- const Ve = /* @__PURE__ */ de(jn);
763
- class Ue extends Ve {
769
+ })(Ve);
770
+ var Fn = Ve.exports;
771
+ const Ue = /* @__PURE__ */ fe(Fn);
772
+ class Ye extends Ue {
764
773
  constructor(t, r) {
765
774
  super();
766
775
  v(this, "ogma");
@@ -780,7 +789,7 @@ class Ue extends Ve {
780
789
  t.code === 27 && this.selectedId !== V ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== V && this._canRemove() && this.remove(this.selectedId);
781
790
  });
782
791
  v(this, "_onClickMouseMove", (t) => {
783
- if (!t.domEvent || this.isDragging || !this.shouldDetect || t.domEvent.type !== "mousemove" && t.domEvent.target.tagName === "a")
792
+ if (!t.domEvent || this.isDragging || !this.shouldDetect || t.domEvent.type !== "mousemove" && t.domEvent.target && t.domEvent.target.tagName === "a")
784
793
  return;
785
794
  const r = this.ogma.view.screenToGraphCoordinates(t), a = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
786
795
  t.domEvent.type === "mousemove" ? a ? this.hover(a.id) : this.hoveredId !== V && this.unhover() : a ? this.select(a.id) : this.selectedId !== V && this.unselect();
@@ -814,7 +823,7 @@ class Ue extends Ve {
814
823
  ...t.geometry
815
824
  }
816
825
  });
817
- return this.elements.push(a), this.layer.refresh(), this.emit(ce, a), a;
826
+ return this.elements.push(a), this.layer.refresh(), this.emit(ue, a), a;
818
827
  }
819
828
  updateStyle(t, r) {
820
829
  this.updateAnnotation(t, {
@@ -876,22 +885,22 @@ class Ue extends Ve {
876
885
  */
877
886
  select(t) {
878
887
  const r = this.getById(t);
879
- r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(ae, r));
888
+ r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(le, r));
880
889
  }
881
890
  hover(t) {
882
891
  const r = this.getById(t);
883
- r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Pn, r));
892
+ r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Nn, r));
884
893
  }
885
894
  getSelectedFeature() {
886
895
  return this.selectedId === V ? null : this.getById(this.selectedId);
887
896
  }
888
897
  unselect() {
889
898
  const t = this.getById(this.selectedId);
890
- return t && this.emit(le, t), this.selectedId = V, this.hoveredId === V && this.editor.hide(), this.layer.refresh(), this;
899
+ return t && this.emit(he, t), this.selectedId = V, this.hoveredId === V && this.editor.hide(), this.layer.refresh(), this;
891
900
  }
892
901
  unhover() {
893
902
  const t = this.getById(this.hoveredId);
894
- return this.emit(Nn, t), this.hoveredId = V, this.selectedId === V && this.editor.hide(), this.layer.refresh(), this;
903
+ return this.emit(Rn, t), this.hoveredId = V, this.selectedId === V && this.editor.hide(), this.layer.refresh(), this;
895
904
  }
896
905
  /**
897
906
  * @method remove
@@ -900,7 +909,7 @@ class Ue extends Ve {
900
909
  */
901
910
  remove(t) {
902
911
  const r = this.getById(t);
903
- t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((a) => a.id !== t), r && this.emit(he, r), this.layer.refresh();
912
+ t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((a) => a.id !== t), r && this.emit(ce, r), this.layer.refresh();
904
913
  }
905
914
  /**
906
915
  * @method disableDragging
@@ -950,16 +959,16 @@ class Ue extends Ve {
950
959
  this.ogma.events.off(this._onClickMouseMove).off(this._onKeyUp), this.layer.destroy();
951
960
  }
952
961
  }
953
- const Ie = "handle-line", Me = "handle-start", De = "handle-end";
954
- class Fn extends Ue {
962
+ const Me = "handle-line", De = "handle-start", Oe = "handle-end";
963
+ class qn extends Ye {
955
964
  constructor(t, r = {}) {
956
965
  super(
957
966
  t,
958
967
  `
959
968
  <div class="arrow-handle">
960
- <div id="${Ie}" data-handle-id="0" class="handle line"></div>
961
- <div id="${Me}" data-handle-id="1" class="handle"></div>
962
- <div id="${De}" data-handle-id="2" class="handle"></div>
969
+ <div id="${Me}" data-handle-id="0" class="handle line"></div>
970
+ <div id="${De}" data-handle-id="1" class="handle"></div>
971
+ <div id="${Oe}" data-handle-id="2" class="handle"></div>
963
972
  </div>
964
973
  `
965
974
  );
@@ -967,7 +976,7 @@ class Fn extends Ue {
967
976
  v(this, "draggedHandle", V);
968
977
  v(this, "start", { x: 0, y: 0 });
969
978
  v(this, "end", { x: 0, y: 0 });
970
- v(this, "arrow", { ...Te });
979
+ v(this, "arrow", { ..._e });
971
980
  v(this, "startX", 0);
972
981
  v(this, "startY", 0);
973
982
  v(this, "minArrowHeight", 0);
@@ -975,7 +984,10 @@ class Fn extends Ue {
975
984
  v(this, "handles", []);
976
985
  v(this, "onHandleMouseDown", (t) => {
977
986
  const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
978
- r && (this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = Fe(t.target));
987
+ if (!r)
988
+ return;
989
+ const { x: a, y: h } = ae(t, this.ogma.getContainer());
990
+ this.startDragging(r, a, h), this.draggedHandle = qe(t.target);
979
991
  });
980
992
  v(this, "onMouseUp", () => {
981
993
  this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V, this.emit(St, this.arrow));
@@ -983,8 +995,11 @@ class Fn extends Ue {
983
995
  v(this, "onMouseMove", (t) => {
984
996
  if (!this.isDragging || this.draggedHandle === V)
985
997
  return;
986
- const r = this.handles[this.draggedHandle], a = this.ogma.view.getAngle(), { x: h, y: f } = new Y(t.clientX - this.startX, t.clientY - this.startY).divScalar(this.ogma.view.getZoom()).rotateRadians(a), g = r.id === Ie, p = r.id === Me, s = r.id === De;
987
- (g || p) && Re(this.arrow, this.start.x + h, this.start.y + f), (g || s) && je(this.arrow, this.end.x + h, this.end.y + f), this.emit(
998
+ const r = this.handles[this.draggedHandle], a = this.ogma.view.getAngle(), { x: h, y: f } = new Y(
999
+ t.clientX - this.startX,
1000
+ t.clientY - this.startY
1001
+ ).divScalar(this.ogma.view.getZoom()).rotateRadians(a), g = r.id === Me, p = r.id === De, s = r.id === Oe;
1002
+ (g || p) && je(this.arrow, this.start.x + h, this.start.y + f), (g || s) && Fe(this.arrow, this.end.x + h, this.end.y + f), this.emit(
988
1003
  Ut,
989
1004
  this.arrow,
990
1005
  g ? "line" : p ? "start" : "end"
@@ -1002,11 +1017,18 @@ class Fn extends Ue {
1002
1017
  * @param y
1003
1018
  * @param arrow
1004
1019
  */
1005
- startDrawing(t, r, a = On(t, r, t, r, zt)) {
1020
+ startDrawing(t, r, a = Ln(t, r, t, r, zt)) {
1006
1021
  var g;
1007
- this.add(a), this.hoveredId = a.id;
1008
- const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), f = ((g = this.ogma.getContainer()) == null ? void 0 : g.getBoundingClientRect()) || { left: 0, top: 0 };
1009
- this.startDragging(this.getById(a.id), h.x + (f == null ? void 0 : f.left), h.y + f.top), this.draggedHandle = 2;
1022
+ this.disableDragging(), this.add(a), this.hoveredId = a.id;
1023
+ const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), f = ((g = this.ogma.getContainer()) == null ? void 0 : g.getBoundingClientRect()) || {
1024
+ left: 0,
1025
+ top: 0
1026
+ };
1027
+ this.startDragging(
1028
+ this.getById(a.id),
1029
+ h.x + (f == null ? void 0 : f.left),
1030
+ h.y + f.top
1031
+ ), this.draggedHandle = 2;
1010
1032
  }
1011
1033
  cancelDrawing() {
1012
1034
  this.isDragging && (this.remove(this.arrow.id), this.emit(St, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V);
@@ -1018,7 +1040,7 @@ class Fn extends Ue {
1018
1040
  return this.elements.find((a) => {
1019
1041
  const { start: h, end: f } = Vt(a), g = new Y(t.x, t.y).sub(
1020
1042
  new Y((h.x + f.x) / 2, (h.y + f.y) / 2)
1021
- ), p = new Y(f.x, f.y).sub(new Y(h.x, h.y)), s = p.length(), d = p.normalize(), m = qe(a);
1043
+ ), p = new Y(f.x, f.y).sub(new Y(h.x, h.y)), s = p.length(), d = p.normalize(), m = Be(a);
1022
1044
  return Math.abs(d.dot(g)) < s / 2 + r && Math.abs(d.rotateRadians(Math.PI / 2).dot(g)) < m / 2 + r;
1023
1045
  });
1024
1046
  }
@@ -1032,11 +1054,11 @@ class Fn extends Ue {
1032
1054
  const d = {
1033
1055
  x: (h.x + a.x) / 2,
1034
1056
  y: (h.y + a.y) / 2
1035
- }, m = new Y(h.x - a.x, h.y - a.y), S = m.mul(1 / m.length()), T = Math.atan2(S.y, S.x);
1057
+ }, m = new Y(h.x - a.x, h.y - a.y), A = m.mul(1 / m.length()), T = Math.atan2(A.y, A.x);
1036
1058
  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)`;
1037
1059
  }
1038
1060
  getDefaultOptions() {
1039
- return Te;
1061
+ return _e;
1040
1062
  }
1041
1063
  draw(t) {
1042
1064
  t.innerHTML = "";
@@ -1047,7 +1069,10 @@ class Fn extends Ue {
1047
1069
  }
1048
1070
  refreshDrawing() {
1049
1071
  const t = this.ogma.view.getAngle();
1050
- this.layer.element.children[0].setAttribute("transform", `rotate(${-t * (180 / Math.PI)})`);
1072
+ this.layer.element.children[0].setAttribute(
1073
+ "transform",
1074
+ `rotate(${-t * (180 / Math.PI)})`
1075
+ );
1051
1076
  }
1052
1077
  destroy() {
1053
1078
  super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
@@ -1083,10 +1108,10 @@ const At = {
1083
1108
  }
1084
1109
  // position: { x: 0, y: 0 },
1085
1110
  // size: { width: 100, height: 50 }
1086
- }, Oe = {
1111
+ }, Le = {
1087
1112
  handleSize: 3.5,
1088
1113
  placeholder: "Your text..."
1089
- }, qn = (u = 0, l = 0, t = 100, r = 50, a = "", h = { ...At }) => ({
1114
+ }, Bn = (u = 0, l = 0, t = 100, r = 50, a = "", h = { ...At }) => ({
1090
1115
  id: Xt(),
1091
1116
  type: "Feature",
1092
1117
  properties: {
@@ -1107,11 +1132,11 @@ const At = {
1107
1132
  ]
1108
1133
  }
1109
1134
  });
1110
- var Ye = { exports: {} };
1135
+ var Xe = { exports: {} };
1111
1136
  (function(u, l) {
1112
1137
  (function(t, r) {
1113
1138
  u.exports = r();
1114
- })(Mn, () => (() => {
1139
+ })(Dn, () => (() => {
1115
1140
  var t = { d: (e, n) => {
1116
1141
  for (var o in n)
1117
1142
  t.o(n, o) && !t.o(e, o) && Object.defineProperty(e, o, { enumerable: !0, get: n[o] });
@@ -1123,13 +1148,13 @@ var Ye = { exports: {} };
1123
1148
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1124
1149
  }, a(e);
1125
1150
  }
1126
- t.d(r, { default: () => kn });
1151
+ t.d(r, { default: () => Tn });
1127
1152
  var h = /^((?:[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 };
1128
1153
  function m(e) {
1129
1154
  var n = "", o = this;
1130
1155
  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;
1131
1156
  }
1132
- var S = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: m, valueOf: m };
1157
+ var A = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: m, valueOf: m };
1133
1158
  function T(e) {
1134
1159
  var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = h.exec(e);
1135
1160
  n.family = (o[6] || "").trim();
@@ -1150,16 +1175,16 @@ var Ye = { exports: {} };
1150
1175
  var O = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), L = O.getComputedStyle(i, null);
1151
1176
  e = L.getPropertyValue("font-family") || "", w = parseFloat(L.getPropertyValue("font-size")), y = L.getPropertyValue("line-height"), x = L.getPropertyValue("font-weight"), E = L.getPropertyValue("font-style"), k = L.getPropertyValue("font-variant") || "";
1152
1177
  } else if (typeof i == "string") {
1153
- var I = T(i);
1154
- e = I.family, w = I.size, y = I.height, k = I.variant, E = I.style, x = I.weight;
1178
+ var M = T(i);
1179
+ e = M.family, w = M.size, y = M.height, k = M.variant, E = M.style, x = M.weight;
1155
1180
  } else
1156
1181
  a(i) === "object" && (e = i.family, w = i.size, y = i.height, k = i.variant, x = i.weight, E = i.style, n = i.baseline, o = i.color);
1157
1182
  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);
1158
- var z = Object.create(S);
1183
+ var z = Object.create(A);
1159
1184
  return z.family = c.family || e || "sans-serif", z.height = y ?? 14, z.size = w ?? 12, z.variant = c.variant || k || "", z.style = c.style || E || "", 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;
1160
1185
  }
1161
- const D = { "\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 };
1162
- var A, $ = function(e) {
1186
+ const I = { "\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 };
1187
+ var S, P = function(e) {
1163
1188
  var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
1164
1189
  if (n && n.getContext) {
1165
1190
  var o = n.getContext("2d");
@@ -1168,22 +1193,22 @@ var Ye = { exports: {} };
1168
1193
  return o.font = String(c), o.measureText(i).width;
1169
1194
  };
1170
1195
  }
1171
- }(typeof document < "u" ? document : null) || (A = {}, function(e, n) {
1172
- if (!A[n]) {
1196
+ }(typeof document < "u" ? document : null) || (S = {}, function(e, n) {
1197
+ if (!S[n]) {
1173
1198
  var o = b(n);
1174
- A[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
1199
+ S[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
1175
1200
  }
1176
- return e.length * A[n].size;
1177
- }), N = {}, _ = { trim: !0, collapse: !0 };
1201
+ return e.length * S[n].size;
1202
+ }), $ = {}, _ = { trim: !0, collapse: !0 };
1178
1203
  function X(e, n, o) {
1179
1204
  var i = Object.assign({}, _, o), c = String(e);
1180
1205
  if (!c)
1181
1206
  return 0;
1182
- if (c in D) {
1207
+ if (c in I) {
1183
1208
  var y = n.id + "/" + c;
1184
- return y in N || (N[y] = $("_".concat(c, "_"), n) - $("__", n)), N[y];
1209
+ return y in $ || ($[y] = P("_".concat(c, "_"), n) - P("__", n)), $[y];
1185
1210
  }
1186
- return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), $(c, n) + n.size * (e.tracking || 0);
1211
+ return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), P(c, n) + n.size * (e.tracking || 0);
1187
1212
  }
1188
1213
  function W(e) {
1189
1214
  return W = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
@@ -1222,10 +1247,10 @@ var Ye = { exports: {} };
1222
1247
  o = Reflect.construct(i, arguments, c);
1223
1248
  } else
1224
1249
  o = i.apply(this, arguments);
1225
- return Xe(this, o);
1250
+ return We(this, o);
1226
1251
  };
1227
1252
  }
1228
- function Xe(e, n) {
1253
+ function We(e, n) {
1229
1254
  if (n && (W(n) === "object" || typeof n == "function"))
1230
1255
  return n;
1231
1256
  if (n !== void 0)
@@ -1241,11 +1266,11 @@ var Ye = { exports: {} };
1241
1266
  return n.__proto__ || Object.getPrototypeOf(n);
1242
1267
  }, Ct(e);
1243
1268
  }
1244
- function $t(e, n) {
1269
+ function Pt(e, n) {
1245
1270
  if (!(e instanceof n))
1246
1271
  throw new TypeError("Cannot call a class as a function");
1247
1272
  }
1248
- function fe(e, n) {
1273
+ function pe(e, n) {
1249
1274
  for (var o = 0; o < n.length; o++) {
1250
1275
  var i = n[o];
1251
1276
  i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
@@ -1263,15 +1288,15 @@ var Ye = { exports: {} };
1263
1288
  }
1264
1289
  var c;
1265
1290
  }
1266
- function Pt(e, n, o) {
1267
- return n && fe(e.prototype, n), o && fe(e, o), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1291
+ function $t(e, n, o) {
1292
+ return n && pe(e.prototype, n), o && pe(e, o), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1268
1293
  }
1269
- var R = function() {
1294
+ var H = function() {
1270
1295
  function e() {
1271
1296
  var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
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;
1297
+ Pt(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
1273
1298
  }
1274
- return Pt(e, [{ key: "clone", value: function() {
1299
+ return $t(e, [{ key: "clone", value: function() {
1275
1300
  var n = new e(this.value);
1276
1301
  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;
1277
1302
  } }, { key: "valueOf", value: function() {
@@ -1283,39 +1308,39 @@ var Ye = { exports: {} };
1283
1308
  Et(o, e);
1284
1309
  var n = Wt(o);
1285
1310
  function o() {
1286
- return $t(this, o), n.apply(this, arguments);
1311
+ return Pt(this, o), n.apply(this, arguments);
1287
1312
  }
1288
- return Pt(o);
1289
- }(R), nt = function(e) {
1313
+ return $t(o);
1314
+ }(H), nt = function(e) {
1290
1315
  Et(o, e);
1291
1316
  var n = Wt(o);
1292
1317
  function o() {
1293
- return $t(this, o), n.apply(this, arguments);
1318
+ return Pt(this, o), n.apply(this, arguments);
1294
1319
  }
1295
- return Pt(o);
1296
- }(R), pt = function(e) {
1320
+ return $t(o);
1321
+ }(H), pt = function(e) {
1297
1322
  Et(o, e);
1298
1323
  var n = Wt(o);
1299
1324
  function o() {
1300
- return $t(this, o), n.apply(this, arguments);
1325
+ return Pt(this, o), n.apply(this, arguments);
1301
1326
  }
1302
- return Pt(o);
1303
- }(R), Gt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, We = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, pe = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Ge = /^(?:[;\xAD%?…]|,(?!\d))/, Ze = /^[´±°¢£¤$¥\u2212]/;
1327
+ return $t(o);
1328
+ }(H), Gt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, Ge = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, ge = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Ze = /^(?:[;\xAD%?…]|,(?!\d))/, Ke = /^[´±°¢£¤$¥\u2212]/;
1304
1329
  function Nt(e, n) {
1305
1330
  n !== !1 && (e = e.trim());
1306
1331
  for (var o, i, c = [], y = e.charAt(0), w = 0, x = 1, E = e.length; x < E; x++) {
1307
1332
  o = e.charAt(x), i = e.charAt(x + 1);
1308
- var k = Gt.test(y), O = Gt.test(o), L = O || k, I = void 0;
1309
- if ((Ze.test(o) && !pe.test(y) || Ge.test(y + i) && !pe.test(o)) && (L = !0), y !== "-" && y !== "‐" && y !== "–" && y !== "—" || ((I = Gt.test(e.charAt(x - 2))) && !O && (L = !1), !I && We.test(o + i) && (L = !0)), L) {
1333
+ var k = Gt.test(y), O = Gt.test(o), L = O || k, M = void 0;
1334
+ if ((Ke.test(o) && !ge.test(y) || Ze.test(y + i) && !ge.test(o)) && (L = !0), y !== "-" && y !== "‐" && y !== "–" && y !== "—" || ((M = Gt.test(e.charAt(x - 2))) && !O && (L = !1), !M && Ge.test(o + i) && (L = !0)), L) {
1310
1335
  var z = e.slice(w, x);
1311
- /\u00AD$/.test(z) ? (c.push(new R(z.slice(0, -1))), c.push(new pt())) : (c.push(new R(z)), c.push(new Tt())), w = x;
1336
+ /\u00AD$/.test(z) ? (c.push(new H(z.slice(0, -1))), c.push(new pt())) : (c.push(new H(z)), c.push(new Tt())), w = x;
1312
1337
  }
1313
1338
  y = o;
1314
1339
  }
1315
- return c.push(new R(e.slice(w))), c;
1340
+ return c.push(new H(e.slice(w))), c;
1316
1341
  }
1317
- const ge = { 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: "›" };
1318
- var Ke = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, Je = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Qe = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, tn = /^<!--(.+?)-->/, en = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, ye = { b: function(e) {
1342
+ const ye = { 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: "›" };
1343
+ var Je = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, Qe = /^<\/([a-zA-Z0-9]+)([^>]*)>/, tn = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, en = /^<!--(.+?)-->/, nn = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, me = { b: function(e) {
1319
1344
  e.weight = "bold";
1320
1345
  }, strong: function(e) {
1321
1346
  e.weight = "bold";
@@ -1341,26 +1366,26 @@ var Ye = { exports: {} };
1341
1366
  e.sub = !0;
1342
1367
  }, sup: function(e) {
1343
1368
  e.sup = !0;
1344
- } }, nn = { 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 };
1345
- function me(e) {
1346
- return e.replace(en, function(n, o, i, c) {
1369
+ } }, rn = { 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 };
1370
+ function ve(e) {
1371
+ return e.replace(nn, function(n, o, i, c) {
1347
1372
  if (o || i) {
1348
1373
  var y = o ? 10 : 16;
1349
1374
  return String.fromCharCode(parseInt(o || i, y));
1350
1375
  }
1351
- return c in ge ? ge[c] : n;
1376
+ return c in ye ? ye[c] : n;
1352
1377
  });
1353
1378
  }
1354
- function rn(e) {
1379
+ function sn(e) {
1355
1380
  return e && e.length > 1 && (e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'") ? e.slice(1, -1) : e;
1356
1381
  }
1357
- var sn = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
1358
- function on(e) {
1382
+ var on = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
1383
+ function an(e) {
1359
1384
  var n, o = {};
1360
1385
  if (e) {
1361
1386
  do
1362
- if (n = sn.exec(e)) {
1363
- var i = me(rn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
1387
+ if (n = on.exec(e)) {
1388
+ var i = ve(sn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
1364
1389
  if (o[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0]))
1365
1390
  throw new Error("Attribute error");
1366
1391
  }
@@ -1370,8 +1395,8 @@ var Ye = { exports: {} };
1370
1395
  }
1371
1396
  return o;
1372
1397
  }
1373
- const ve = { copyright: "©", textcopyright: "©", dag: "†", textdagger: "†", ddag: "‡", textdaggerdbl: "‡", guillemotleft: "«", guillemotright: "»", guilsinglleft: "‹", guilsinglright: "›", ldots: "…", dots: "…", textellipsis: "…", lq: "‘", P: "¶", textparagraph: "¶", pounds: "£", textsterling: "£", quotedblbase: "„", quotesinglbase: "‚", rq: "’", S: "§", sim: "~", textasciicircum: "^", textasciitilde: "˜", texttildelow: "~", textasteriskcentered: "*", textbackslash: "'", textbar: "|", textbardbl: "╎", textbigcircle: "◯", textbraceleft: "{", textbraceright: "}", textbullet: "•", textdollar: "$", textemdash: "—", textendash: "—", texteuro: "€", eurosym: "€", euro: "€", textexclamdown: "¡", textgreater: ">", textless: "<", textordfeminine: "ª", textordmasculine: "º", textperiodcentered: "·", cdot: "·", textquestiondown: "¿", textquotedblleft: "“", textquotedblright: "”", textquoteleft: "‘", textquoteright: "’", textquotestraightbase: "‚", textquotestraightdblbase: "„", textregistered: "®", textthreequartersemdash: "-", texttrademark: "™", texttwelveudash: "-", textunderscore: "_", textvisiblespace: "␣", gets: "←", textleftarrow: "←", to: "→", textrightarrow: "→", textdegree: "°", infty: "∞", triangle: "△", triangledown: "▽", blacktriangle: "▲", blacktriangledown: "▼", angle: "∠", sphericalangle: "∢", aleph: "ℵ", hbar: "ħ", imath: "𝚤", jmath: "𝚥", ell: "ℓ", wp: "℘", Re: "ℜ", Im: "ℑ", mho: "℧", prime: "′", emptyset: "∅", nabla: "∇", surd: "√", partial: "∂", top: "⟙", bot: "⟂", vdash: "⟝", dashv: "⟞", forall: "∀", exists: "∃", nexists: "∄", neg: "¬", lnot: "¬", flat: "♭", natural: "♮", sharp: "♯", backslash: "\\", Box: "□", Diamond: "♢", clubsuit: "♣", diamondsuit: "♦", heartsuit: "♥", spadesuit: "♠", Join: "⨝", blacksquare: "■", bigstar: "★", diagdown: "╲", diagup: "╱", blacklozenge: "⧫", rfloor: "⌋", lfloor: "⌊", rceil: "⌉", lceil: "⌈", rangle: "⟩", langle: "⟨", sum: "∑", int: "∫", oint: "∮", prod: "∏", coprod: "∏", bigcap: "∩", bigcup: "∪", bigsqcup: "⊔", bigvee: "∨", bigwedge: "∧", bigodot: "⊙", bigotimes: "⊗", bigoplus: "⊕", biguplus: "⊎", alpha: "α", beta: "β", chi: "χ", delta: "δ", epsilon: "ε", eta: "η", gamma: "γ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", omega: "ω", phi: "φ", pi: "π", psi: "ψ", rho: "ρ", sigma: "σ", tau: "τ", theta: "θ", upsilon: "υ", xi: "ξ", zeta: "ζ", Alpha: "Α", Beta: "Β", Chi: "Χ", Delta: "Δ", Epsilon: "Ε", Eta: "Η", Gamma: "Γ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Omega: "Ω", Phi: "Φ", Pi: "Π", Psi: "Ψ", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Theta: "Θ", Upsilon: "Υ", Xi: "Ξ", Zeta: "Ζ", aa: "å", AA: "Å", ae: "æ", AE: "Æ", dh: "ð", DH: "Ð", dj: "đ", DJ: "Đ", ij: "ij", IJ: "IJ", l: "ł", L: "Ł", ng: "ŋ", NG: "Ŋ", o: "ø", O: "Ø", oe: "œ", OE: "Œ", ss: "ß", SS: "SS", th: "þ", TH: "Þ" };
1374
- var an = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, ln = /^%[^\n]+(?:\n|$)/, hn = /^[^#$%&~_^\\{}]+/, cn = /^\\([&{}$%#_])/, un = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, dn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, U = { bf: function(e) {
1398
+ const xe = { copyright: "©", textcopyright: "©", dag: "†", textdagger: "†", ddag: "‡", textdaggerdbl: "‡", guillemotleft: "«", guillemotright: "»", guilsinglleft: "‹", guilsinglright: "›", ldots: "…", dots: "…", textellipsis: "…", lq: "‘", P: "¶", textparagraph: "¶", pounds: "£", textsterling: "£", quotedblbase: "„", quotesinglbase: "‚", rq: "’", S: "§", sim: "~", textasciicircum: "^", textasciitilde: "˜", texttildelow: "~", textasteriskcentered: "*", textbackslash: "'", textbar: "|", textbardbl: "╎", textbigcircle: "◯", textbraceleft: "{", textbraceright: "}", textbullet: "•", textdollar: "$", textemdash: "—", textendash: "—", texteuro: "€", eurosym: "€", euro: "€", textexclamdown: "¡", textgreater: ">", textless: "<", textordfeminine: "ª", textordmasculine: "º", textperiodcentered: "·", cdot: "·", textquestiondown: "¿", textquotedblleft: "“", textquotedblright: "”", textquoteleft: "‘", textquoteright: "’", textquotestraightbase: "‚", textquotestraightdblbase: "„", textregistered: "®", textthreequartersemdash: "-", texttrademark: "™", texttwelveudash: "-", textunderscore: "_", textvisiblespace: "␣", gets: "←", textleftarrow: "←", to: "→", textrightarrow: "→", textdegree: "°", infty: "∞", triangle: "△", triangledown: "▽", blacktriangle: "▲", blacktriangledown: "▼", angle: "∠", sphericalangle: "∢", aleph: "ℵ", hbar: "ħ", imath: "𝚤", jmath: "𝚥", ell: "ℓ", wp: "℘", Re: "ℜ", Im: "ℑ", mho: "℧", prime: "′", emptyset: "∅", nabla: "∇", surd: "√", partial: "∂", top: "⟙", bot: "⟂", vdash: "⟝", dashv: "⟞", forall: "∀", exists: "∃", nexists: "∄", neg: "¬", lnot: "¬", flat: "♭", natural: "♮", sharp: "♯", backslash: "\\", Box: "□", Diamond: "♢", clubsuit: "♣", diamondsuit: "♦", heartsuit: "♥", spadesuit: "♠", Join: "⨝", blacksquare: "■", bigstar: "★", diagdown: "╲", diagup: "╱", blacklozenge: "⧫", rfloor: "⌋", lfloor: "⌊", rceil: "⌉", lceil: "⌈", rangle: "⟩", langle: "⟨", sum: "∑", int: "∫", oint: "∮", prod: "∏", coprod: "∏", bigcap: "∩", bigcup: "∪", bigsqcup: "⊔", bigvee: "∨", bigwedge: "∧", bigodot: "⊙", bigotimes: "⊗", bigoplus: "⊕", biguplus: "⊎", alpha: "α", beta: "β", chi: "χ", delta: "δ", epsilon: "ε", eta: "η", gamma: "γ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", omega: "ω", phi: "φ", pi: "π", psi: "ψ", rho: "ρ", sigma: "σ", tau: "τ", theta: "θ", upsilon: "υ", xi: "ξ", zeta: "ζ", Alpha: "Α", Beta: "Β", Chi: "Χ", Delta: "Δ", Epsilon: "Ε", Eta: "Η", Gamma: "Γ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Omega: "Ω", Phi: "Φ", Pi: "Π", Psi: "Ψ", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Theta: "Θ", Upsilon: "Υ", Xi: "Ξ", Zeta: "Ζ", aa: "å", AA: "Å", ae: "æ", AE: "Æ", dh: "ð", DH: "Ð", dj: "đ", DJ: "Đ", ij: "ij", IJ: "IJ", l: "ł", L: "Ł", ng: "ŋ", NG: "Ŋ", o: "ø", O: "Ø", oe: "œ", OE: "Œ", ss: "ß", SS: "SS", th: "þ", TH: "Þ" };
1399
+ var ln = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, hn = /^%[^\n]+(?:\n|$)/, cn = /^[^#$%&~_^\\{}]+/, un = /^\\([&{}$%#_])/, dn = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, fn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, U = { bf: function(e) {
1375
1400
  e.weight = "bold";
1376
1401
  }, it: function(e) {
1377
1402
  e.style = "italic";
@@ -1390,16 +1415,16 @@ var Ye = { exports: {} };
1390
1415
  }, newline: function(e) {
1391
1416
  this.tokens.push(new nt());
1392
1417
  }, url: function(e, n) {
1393
- this.open_context().href = n, this.add_token(new R(n)), this.close_context();
1418
+ this.open_context().href = n, this.add_token(new H(n)), this.close_context();
1394
1419
  } };
1395
1420
  U.textsuperscript = U["^"], U.textsubscript = U._, U.textsl = U.sl, U.mathbf = U.bf, U.mathit = U.it, U.textbf = U.bf, U.textit = U.it, U.textcolor = U.color;
1396
- var fn = /[\r\n\xA0]+/g;
1397
- function pn(e, n) {
1421
+ var pn = /[\r\n\xA0]+/g;
1422
+ function gn(e, n) {
1398
1423
  e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
1399
1424
  var o = n;
1400
1425
  return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = b(n, e)), o;
1401
1426
  }
1402
- function xe(e, n, o) {
1427
+ function we(e, n, o) {
1403
1428
  for (var i, c, y = e.width; y + o.width > n && e.length; )
1404
1429
  c = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = X(i, i.font), y += i.width) : e.pop(), y -= c;
1405
1430
  e[e.length - 1] instanceof pt && e.pop(), i = e[e.length - 1] || i || {}, o.font = b(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);
@@ -1407,7 +1432,7 @@ var Ye = { exports: {} };
1407
1432
  function vt(e) {
1408
1433
  return Math.round(1e6 * e) / 1e6;
1409
1434
  }
1410
- function we(e) {
1435
+ function be(e) {
1411
1436
  return function(n) {
1412
1437
  if (Array.isArray(n))
1413
1438
  return Zt(n);
@@ -1432,73 +1457,73 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1432
1457
  i[o] = e[o];
1433
1458
  return i;
1434
1459
  }
1435
- var gn = { center: "middle", right: "end" }, yn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, Kt = function(e, n) {
1460
+ var yn = { center: "middle", right: "end" }, mn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, Kt = function(e, n) {
1436
1461
  return !e && !n || e === n;
1437
1462
  };
1438
- function mn(e, n) {
1463
+ function vn(e, n) {
1439
1464
  var o = [], i = n.font(), c = i.size, y = i.family, w = n.align(), x = n.createElement();
1440
1465
  if (e.length) {
1441
- var E = i.height, k = n.valign(), O = n.height()(), L = n.width()(0), I = !isFinite(L) && e.length === 1, z = I ? null : n.x(), j = vt(E / c), Q = I ? null : vt(E / (1.15 * c + (E - c) / 2));
1442
- if (yn[k] && isFinite(O)) {
1443
- var P = k === "bottom" ? 1 : 0.5;
1444
- Q += (O * P - E * e.length * P) / c;
1466
+ var E = i.height, k = n.valign(), O = n.height()(), L = n.width()(0), M = !isFinite(L) && e.length === 1, z = M ? null : n.x(), j = vt(E / c), Q = M ? null : vt(E / (1.15 * c + (E - c) / 2));
1467
+ if (mn[k] && isFinite(O)) {
1468
+ var N = k === "bottom" ? 1 : 0.5;
1469
+ Q += (O * N - E * e.length * N) / c;
1445
1470
  }
1446
1471
  var C = w === "justify", F = 0;
1447
1472
  w === "right" ? F = L : w === "center" && (F = L / 2);
1448
- for (var H = [], tt = "tspan", G = null, q = "", M = function() {
1473
+ for (var R = [], tt = "tspan", G = null, q = "", D = function() {
1449
1474
  if (q) {
1450
1475
  var gt = x(tt, G, q);
1451
- H.push(gt);
1476
+ R.push(gt);
1452
1477
  }
1453
1478
  tt = "tspan", G = null, q = "";
1454
1479
  }, it = 0, et = e.length; it < et; it++) {
1455
1480
  var at = "", dt = "", st = 0, lt = e[it];
1456
1481
  if (lt.length) {
1457
- H = [];
1458
- for (var xt = 0, Mt = 0, ht = void 0, Z = 0, Ht = lt.length; Z < Ht; Z++) {
1482
+ R = [];
1483
+ for (var xt = 0, Mt = 0, ht = void 0, Z = 0, Rt = lt.length; Z < Rt; Z++) {
1459
1484
  var B = lt[Z], K = B.font;
1460
- B.whitespace && xt++, Mt += B.width, Z && !B.tracking && !st && Kt(K.id, at) && Kt(B.class, dt) && Kt(ht, B.href) ? q += B.value : (M(), q = B.value, G = { 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 && (G.dx = vt(st), st = 0), B.tracking && (st = K.size * B.tracking), B.href && !ht ? (ht = B.href, tt = "a", G.href = ht, G.rel = B.rel, G.target = B.target) : ht = null, at = K.id, dt = B.class);
1485
+ B.whitespace && xt++, Mt += B.width, Z && !B.tracking && !st && Kt(K.id, at) && Kt(B.class, dt) && Kt(ht, B.href) ? q += B.value : (D(), q = B.value, G = { 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 && (G.dx = vt(st), st = 0), B.tracking && (st = K.size * B.tracking), B.href && !ht ? (ht = B.href, tt = "a", G.href = ht, G.rel = B.rel, G.target = B.target) : ht = null, at = K.id, dt = B.class);
1461
1486
  }
1462
- if (M(), I)
1463
- o.push.apply(o, we(H));
1487
+ if (D(), M)
1488
+ o.push.apply(o, be(R));
1464
1489
  else {
1465
- var Rt = null, Dt = it === et - 1 || lt[lt.length - 1] instanceof nt;
1466
- C && lt.length > 1 && !Dt && (Rt = vt((L - Mt) / xt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Rt, x: z(it) + F, dy: vt(it ? j : Q) + "em" }].concat(we(H))));
1490
+ var Ht = null, Dt = it === et - 1 || lt[lt.length - 1] instanceof nt;
1491
+ C && lt.length > 1 && !Dt && (Ht = vt((L - Mt) / xt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Ht, x: z(it) + F, dy: vt(it ? j : Q) + "em" }].concat(be(R))));
1467
1492
  }
1468
1493
  } else
1469
1494
  o.push(x("tspan", { x: z(it), dy: vt(it ? j : Q) + "em" }, " "));
1470
1495
  }
1471
1496
  }
1472
- return x.apply(void 0, ["text", { fontFamily: y, fontSize: c, textAnchor: gn[w] || "start" }].concat(o));
1497
+ return x.apply(void 0, ["text", { fontFamily: y, fontSize: c, textAnchor: yn[w] || "start" }].concat(o));
1473
1498
  }
1474
- var vn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1475
- function xn(e, n, o) {
1499
+ var xn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1500
+ function wn(e, n, o) {
1476
1501
  if (e.length) {
1477
1502
  o.textBaseline = "middle";
1478
- var i = n.font(), c = i.height, y = i.size, w = n.valign(), x = n.height()(), E = n.width()(0), k = n.align(), O = k === "justify", L = 0.5 * c, I = vn[w];
1479
- if (I && isFinite(x)) {
1503
+ var i = n.font(), c = i.height, y = i.size, w = n.valign(), x = n.height()(), E = n.width()(0), k = n.align(), O = k === "justify", L = 0.5 * c, M = xn[w];
1504
+ if (M && isFinite(x)) {
1480
1505
  var z = e.length * c;
1481
- L += x * I - z * I;
1506
+ L += x * M - z * M;
1482
1507
  }
1483
1508
  e.forEach(function(j, Q) {
1484
- var P = n.x()(Q), C = Q * c + L, F = 0, H = 0;
1509
+ var N = n.x()(Q), C = Q * c + L, F = 0, R = 0;
1485
1510
  j.forEach(function(q) {
1486
- q.whitespace && F++, H += q.width;
1511
+ q.whitespace && F++, R += q.width;
1487
1512
  });
1488
1513
  var tt = 0, G = Q === e.length - 1 || j[j.length - 1] instanceof nt;
1489
- O && j.length > 1 && !G && (tt = (E - H) / F), j.forEach(function(q) {
1514
+ O && j.length > 1 && !G && (tt = (E - R) / F), j.forEach(function(q) {
1490
1515
  o.font = q.font;
1491
- var M = q.font, it = M.baseline ? y * -M.baseline + 0.15 * y : 0;
1516
+ var D = q.font, it = D.baseline ? y * -D.baseline + 0.15 * y : 0;
1492
1517
  o.fillStyle = function(dt, st) {
1493
1518
  return dt.color ? dt.color : st.href ? "#00C" : "#000";
1494
- }(M, q);
1519
+ }(D, q);
1495
1520
  var et = 0;
1496
- if (k === "right" ? et += E - H : k === "center" ? et += E / 2 - H / 2 : k === "justify" && (q.whitespace || q instanceof nt) && (P += tt), o.fillText(q.value, P + et, C + it), q.href) {
1521
+ if (k === "right" ? et += E - R : k === "center" ? et += E / 2 - R / 2 : k === "justify" && (q.whitespace || q instanceof nt) && (N += tt), o.fillText(q.value, N + et, C + it), q.href) {
1497
1522
  o.beginPath(), o.strokeStyle = o.fillStyle;
1498
1523
  var at = Math.floor(C + 0.45 * y) + 0.5;
1499
- o.moveTo(P + et, at), o.lineTo(P + et + q.width, at), o.stroke();
1524
+ o.moveTo(N + et, at), o.lineTo(N + et + q.width, at), o.stroke();
1500
1525
  }
1501
- P += q.width;
1526
+ N += q.width;
1502
1527
  });
1503
1528
  });
1504
1529
  }
@@ -1510,7 +1535,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1510
1535
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1511
1536
  }, Jt(e);
1512
1537
  }
1513
- function be(e) {
1538
+ function Ae(e) {
1514
1539
  for (var n = {}, o = 0; o < e.length; o++) {
1515
1540
  var i = e[o];
1516
1541
  typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : Jt(i) === "object" && i._groups ? n.d3 = i : i && i.nodeType && i.getContext ? n.ctx = i.getContext("2d") : i && i.fillText && i.beginPath ? n.ctx = i : i && (n.text = i));
@@ -1524,7 +1549,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1524
1549
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1525
1550
  }, _t(e);
1526
1551
  }
1527
- function wn(e, n) {
1552
+ function bn(e, n) {
1528
1553
  for (var o = 0; o < n.length; o++) {
1529
1554
  var i = n[o];
1530
1555
  i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
@@ -1542,7 +1567,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1542
1567
  }
1543
1568
  var c;
1544
1569
  }
1545
- var bn = b(), Qt = function(e) {
1570
+ var An = b(), Qt = function(e) {
1546
1571
  return typeof e == "function" ? e : function() {
1547
1572
  return e;
1548
1573
  };
@@ -1566,39 +1591,39 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1566
1591
  var c = this, y = this.props.parser(String(i)), w = this.font(), x = function(E, k, O) {
1567
1592
  if (!E.length)
1568
1593
  return [];
1569
- var L = k.height(), I = k.width(), z = k.overflowLine(), j = k.overflowWrap(), Q = b(O, !0, !1), P = isFinite(L()) ? Math.floor(L() / O.height) : 1 / 0;
1570
- if (!L() && !I(0) || !P)
1594
+ var L = k.height(), M = k.width(), z = k.overflowLine(), j = k.overflowWrap(), Q = b(O, !0, !1), N = isFinite(L()) ? Math.floor(L() / O.height) : 1 / 0;
1595
+ if (!L() && !M(0) || !N)
1571
1596
  return [];
1572
- for (var C = 0, F = 0, H = 0, tt = [], G = [], q = !1; C < E.length && F < P; ) {
1573
- var M = E[C], it = pn(M, O);
1574
- if (M.width = X(M, it), M.font = it, M.line = F, M.whitespace = M.value in D, M.value && (M.value = M.value.replace(fn, " ")), !(!H && M.whitespace || q && M.whitespace))
1575
- if (M instanceof nt)
1576
- H = 0, G = [], tt.push(C + 1), F++;
1577
- else if (M instanceof Tt || M instanceof pt)
1578
- G.push({ index: C, width: H });
1579
- else if (M.whitespace || H + M.width < I(F))
1580
- H += M.width;
1597
+ for (var C = 0, F = 0, R = 0, tt = [], G = [], q = !1; C < E.length && F < N; ) {
1598
+ var D = E[C], it = gn(D, O);
1599
+ if (D.width = X(D, it), D.font = it, D.line = F, D.whitespace = D.value in I, D.value && (D.value = D.value.replace(pn, " ")), !(!R && D.whitespace || q && D.whitespace))
1600
+ if (D instanceof nt)
1601
+ R = 0, G = [], tt.push(C + 1), F++;
1602
+ else if (D instanceof Tt || D instanceof pt)
1603
+ G.push({ index: C, width: R });
1604
+ else if (D.whitespace || R + D.width < M(F))
1605
+ R += D.width;
1581
1606
  else if (G.length) {
1582
1607
  var et = void 0, at = void 0;
1583
1608
  do {
1584
1609
  at = !0, et = G.pop();
1585
1610
  var dt = E[et.index], st = void 0;
1586
- dt instanceof pt && (st = X("-", dt.font), et.width + st > I(F) && (at = !G.length));
1611
+ dt instanceof pt && (st = X("-", dt.font), et.width + st > M(F) && (at = !G.length));
1587
1612
  } while (!at);
1588
- tt.push(et.index + 1), H = 0, F++, C = et.index, G = [];
1613
+ tt.push(et.index + 1), R = 0, F++, C = et.index, G = [];
1589
1614
  } else if (j === "break-word") {
1590
- var lt = I(F);
1591
- if (H + M.width > lt) {
1592
- var xt = M.clone();
1615
+ var lt = M(F);
1616
+ if (R + D.width > lt) {
1617
+ var xt = D.clone();
1593
1618
  do
1594
- M.value = M.value.slice(0, -1), M.width = X(M, M.font), H += M.width;
1595
- while (M.value && M.width > lt);
1596
- xt.value = xt.value.slice(M.value.length), E.splice(C + 1, 0, new Tt(), xt);
1619
+ D.value = D.value.slice(0, -1), D.width = X(D, D.font), R += D.width;
1620
+ while (D.value && D.width > lt);
1621
+ xt.value = xt.value.slice(D.value.length), E.splice(C + 1, 0, new Tt(), xt);
1597
1622
  }
1598
- tt.push(C + 1), H = 0, F++;
1623
+ tt.push(C + 1), R = 0, F++;
1599
1624
  } else
1600
- H += M.width;
1601
- C++, q = M.whitespace;
1625
+ R += D.width;
1626
+ C++, q = D.whitespace;
1602
1627
  }
1603
1628
  C !== tt[tt.length - 1] && tt.push(C);
1604
1629
  var Mt = 0, ht = 0, Z = tt.map(function(gt) {
@@ -1610,24 +1635,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1610
1635
  var wt = E.slice(yt, ft).filter(function(ie) {
1611
1636
  return ie.value;
1612
1637
  });
1613
- return ne && wt.push(ne), wt.width = wt.reduce(function(ie, Tn) {
1614
- return ie + Tn.width;
1638
+ return ne && wt.push(ne), wt.width = wt.reduce(function(ie, _n) {
1639
+ return ie + _n.width;
1615
1640
  }, 0), wt.width > ht && (ht = wt.width), wt;
1616
1641
  });
1617
1642
  if (Z.hasLineOverflow = !1, z) {
1618
- var Ht = z === "ellipsis" ? "…" : z;
1643
+ var Rt = z === "ellipsis" ? "…" : z;
1619
1644
  Z.forEach(function(gt, J) {
1620
- var yt = I(J);
1645
+ var yt = M(J);
1621
1646
  if (gt.width > yt) {
1622
- var ft = new R(Ht);
1623
- ft.font = O, ft.width = X(Ht, Q), xe(gt, yt, ft), Z.hasLineOverflow = !0;
1647
+ var ft = new H(Rt);
1648
+ ft.font = O, ft.width = X(Rt, Q), we(gt, yt, ft), Z.hasLineOverflow = !0;
1624
1649
  }
1625
1650
  });
1626
1651
  }
1627
1652
  var B = k.overflow() === "ellipsis" ? "…" : k.overflow();
1628
1653
  if (B && C !== E.length) {
1629
- var K = I(Z.length - 1), Rt = Z[Z.length - 1], Dt = new R(B);
1630
- Dt.font = O, Dt.width = X(B, Q), xe(Rt, K, Dt), Z.hasOverflow = !0;
1654
+ var K = M(Z.length - 1), Ht = Z[Z.length - 1], Dt = new H(B);
1655
+ Dt.font = O, Dt.width = X(B, Q), we(Ht, K, Dt), Z.hasOverflow = !0;
1631
1656
  } else
1632
1657
  Z.hasOverflow = !1;
1633
1658
  return Z.font = O, Z.width = ht, Z;
@@ -1636,7 +1661,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1636
1661
  return c.render(x, E);
1637
1662
  }, x.svg = x.render, x.draw = x.render, x;
1638
1663
  } }, { key: "font", value: function(i) {
1639
- return arguments.length ? (this.props.font = b(i), this) : this.props.font || b(bn);
1664
+ return arguments.length ? (this.props.font = b(i), this) : this.props.font || b(An);
1640
1665
  } }, { key: "overflow", value: function(i) {
1641
1666
  return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
1642
1667
  } }, { key: "overflowLine", value: function(i) {
@@ -1672,9 +1697,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1672
1697
  } }, { key: "createElement", value: function(i) {
1673
1698
  return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
1674
1699
  } }, { key: "render", value: function() {
1675
- var i = be(arguments);
1676
- return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? xn(i.text, this, i.ctx) : mn(i.text, this);
1677
- } }], o && wn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1700
+ var i = Ae(arguments);
1701
+ return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? wn(i.text, this, i.ctx) : vn(i.text, this);
1702
+ } }], o && bn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1678
1703
  }();
1679
1704
  function It(e) {
1680
1705
  return It = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
@@ -1689,7 +1714,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1689
1714
  i[o] = e[o];
1690
1715
  return i;
1691
1716
  }
1692
- function An(e, n) {
1717
+ function Sn(e, n) {
1693
1718
  for (var o = 0; o < n.length; o++) {
1694
1719
  var i = n[o];
1695
1720
  i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
@@ -1707,11 +1732,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1707
1732
  }
1708
1733
  var c;
1709
1734
  }
1710
- var Ae = function(e) {
1735
+ var Se = function(e) {
1711
1736
  return typeof e == "function" ? e : function() {
1712
1737
  return e;
1713
1738
  };
1714
- }, Se = function() {
1739
+ }, Ee = function() {
1715
1740
  function e(i) {
1716
1741
  if (function(y, w) {
1717
1742
  if (!(y instanceof w))
@@ -1738,9 +1763,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1738
1763
  }
1739
1764
  return this;
1740
1765
  } }, { key: "width", value: function(i) {
1741
- return arguments.length ? (this.props.width = Ae(i), this) : this.props.width;
1766
+ return arguments.length ? (this.props.width = Se(i), this) : this.props.width;
1742
1767
  } }, { key: "height", value: function(i) {
1743
- return arguments.length ? (this.props.height = Ae(i), this) : this.props.height;
1768
+ return arguments.length ? (this.props.height = Se(i), this) : this.props.height;
1744
1769
  } }, { key: "rotate", value: function(i) {
1745
1770
  return arguments.length ? (this.props.rotation = i, this) : this.props.rotation;
1746
1771
  } }, { key: "createElement", value: function(i) {
@@ -1765,7 +1790,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1765
1790
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1766
1791
  }()), c(w), w.restore(), w;
1767
1792
  } }, { key: "render", value: function() {
1768
- var i = be(arguments);
1793
+ var i = Ae(arguments);
1769
1794
  if (i.d3)
1770
1795
  return i.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
1771
1796
  if (i.ctx)
@@ -1774,43 +1799,43 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1774
1799
  var c = typeof i.text.render == "function" ? i.text.render() : i.text;
1775
1800
  return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
1776
1801
  }
1777
- } }], o && An(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1778
- }(), Sn = Object.prototype.hasOwnProperty, ee = {};
1779
- function En(e) {
1802
+ } }], o && Sn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1803
+ }(), En = Object.prototype.hasOwnProperty, ee = {};
1804
+ function kn(e) {
1780
1805
  return ee[e] || (ee[e] = e.replace(/([a-z])([A-Z])/g, function(n, o, i) {
1781
1806
  return o + "-" + i.toLowerCase();
1782
1807
  })), ee[e];
1783
1808
  }
1784
- function Ee(e, n) {
1809
+ function ke(e, n) {
1785
1810
  if (Array.isArray(n))
1786
1811
  return n.forEach(function(o) {
1787
- return Ee(e, o);
1812
+ return ke(e, o);
1788
1813
  });
1789
1814
  typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
1790
1815
  }
1791
- function ke(e, n) {
1816
+ function Te(e, n) {
1792
1817
  if (typeof document < "u") {
1793
1818
  var o = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
1794
1819
  if (n && o.setAttribute)
1795
1820
  for (var i in n)
1796
- Sn.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : En(i), n[i]);
1821
+ En.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : kn(i), n[i]);
1797
1822
  for (var c = arguments.length, y = new Array(c > 2 ? c - 2 : 0), w = 2; w < c; w++)
1798
1823
  y[w - 2] = arguments[w];
1799
1824
  return y != null && y.length && y.forEach(function(x) {
1800
- Ee(o, x);
1825
+ ke(o, x);
1801
1826
  }), o;
1802
1827
  }
1803
1828
  }
1804
- rt.createElement = ke, rt.textparser = Nt, rt.defaultparser = Nt, rt.htmlparser = function(e) {
1829
+ rt.createElement = Te, rt.textparser = Nt, rt.defaultparser = Nt, rt.htmlparser = function(e) {
1805
1830
  e = String(e || "").trim();
1806
1831
  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(L) {
1807
- for (var I in i)
1808
- i[I] && (L[I] = i[I]);
1832
+ for (var M in i)
1833
+ i[M] && (L[M] = i[M]);
1809
1834
  c.push(L);
1810
1835
  }, x = function(L) {
1811
- var I = c.length, z = nn[L];
1812
- if (I && z) {
1813
- for (var j = I - 1; c[j] && (c[j] instanceof Tt || Ke.test(c[j].value)); )
1836
+ var M = c.length, z = rn[L];
1837
+ if (M && z) {
1838
+ for (var j = M - 1; c[j] && (c[j] instanceof Tt || Je.test(c[j].value)); )
1814
1839
  j--;
1815
1840
  for (; z && c[j] && c[j] instanceof nt; )
1816
1841
  j--, z--;
@@ -1819,17 +1844,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1819
1844
  }
1820
1845
  }; e.length; ) {
1821
1846
  if (n = /^[^<]+/.exec(e))
1822
- Nt(me(n[0]), !1).forEach(w);
1823
- else if (!(n = tn.exec(e)))
1824
- if (n = Je.exec(e))
1847
+ Nt(ve(n[0]), !1).forEach(w);
1848
+ else if (!(n = en.exec(e)))
1849
+ if (n = Qe.exec(e))
1825
1850
  y.length && (i = y.pop()), x(n[1]);
1826
- else if (n = Qe.exec(e)) {
1851
+ else if (n = tn.exec(e)) {
1827
1852
  var E = n[1];
1828
- x(E), y.push(i), i = Object.create(i), ye[E] && ye[E](i, "");
1829
- var k = on(n[2]);
1853
+ x(E), y.push(i), i = Object.create(i), me[E] && me[E](i, "");
1854
+ var k = an(n[2]);
1830
1855
  E === "a" && (k.href && (i.href = k.href), k.rel && (i.rel = k.rel), k.target && (i.target = k.target)), k.class && (i.class = i.class ? i.class + " " + k.class : k.class), k.style && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(k.style)) && o[1] && (i.color = o[1]), E === "br" && c.push(new nt());
1831
1856
  } else
1832
- n = [e.slice(0, 1)], w(new R(n[0]));
1857
+ n = [e.slice(0, 1)], w(new H(n[0]));
1833
1858
  e = e.slice(n[0].length);
1834
1859
  }
1835
1860
  for (var O = c[c.length - 1]; O instanceof nt; )
@@ -1838,25 +1863,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1838
1863
  }, rt.latexparser = function(e) {
1839
1864
  e = String(e || "").trim();
1840
1865
  var n = [0];
1841
- e = e.replace(/\\verb,(.*?),/, function(P, C) {
1866
+ e = e.replace(/\\verb,(.*?),/, function(N, C) {
1842
1867
  return n.push(C), "\\verb," + (n.length - 1) + ",";
1843
1868
  }).replace(/\\\\\n/g, function() {
1844
1869
  return "\\\\";
1845
- }).replace(un, function(P, C, F) {
1846
- return F.charAt(C - 1) === "\\" ? P : dn[P];
1847
- }).replace(/\n\s+/g, function(P) {
1848
- return /\n/.test(P.slice(1)) ? "\\par " : P;
1849
- }).replace(/\\symbol\{(\d+)\}/, function(P, C, F, H) {
1850
- return H.charAt(F - 1) === "\\" ? P : String.fromCharCode(1 * C);
1851
- }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(P, C, F, H) {
1852
- return C + F + "{" + H + "}";
1853
- }).replace(/\\verb,(.*?),/, function(P, C) {
1870
+ }).replace(dn, function(N, C, F) {
1871
+ return F.charAt(C - 1) === "\\" ? N : fn[N];
1872
+ }).replace(/\n\s+/g, function(N) {
1873
+ return /\n/.test(N.slice(1)) ? "\\par " : N;
1874
+ }).replace(/\\symbol\{(\d+)\}/, function(N, C, F, R) {
1875
+ return R.charAt(F - 1) === "\\" ? N : String.fromCharCode(1 * C);
1876
+ }).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(N, C, F, R) {
1877
+ return C + F + "{" + R + "}";
1878
+ }).replace(/\\verb,(.*?),/, function(N, C) {
1854
1879
  return "\\verb,".concat(n[+C], ",");
1855
1880
  });
1856
- for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], y = [], w = function(P) {
1881
+ for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], y = [], w = function(N) {
1857
1882
  for (var C in i)
1858
- i[C] && (P[C] = i[C]);
1859
- return c.push(P), P;
1883
+ i[C] && (N[C] = i[C]);
1884
+ return c.push(N), N;
1860
1885
  }, x = function() {
1861
1886
  y.push(i), i = Object.create(i);
1862
1887
  }, E = function() {
@@ -1864,26 +1889,26 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1864
1889
  throw new Error("Unexpected }");
1865
1890
  i = y.pop();
1866
1891
  }, k = { tokens: c, open_context: x, close_context: E, add_token: w }; e.length; ) {
1867
- if (o = hn.exec(e))
1892
+ if (o = cn.exec(e))
1868
1893
  Nt(o[0], !1).forEach(w);
1869
- else if (o = cn.exec(e))
1870
- w(new R(o[1]));
1871
- else if (!(o = ln.exec(e))) {
1894
+ else if (o = un.exec(e))
1895
+ w(new H(o[1]));
1896
+ else if (!(o = hn.exec(e))) {
1872
1897
  if (o = /^\{/.exec(e))
1873
1898
  x();
1874
1899
  else if (o = /^\}/.exec(e))
1875
1900
  E();
1876
1901
  else if (!(o = /^\$/.exec(e)))
1877
1902
  if (o = /^\\verb,([^,]+),/.exec(e))
1878
- w(new R(o[1]));
1879
- else if (o = an.exec(e)) {
1903
+ w(new H(o[1]));
1904
+ else if (o = ln.exec(e)) {
1880
1905
  var O = o[1].slice(1) || o[1], L = !!o[2];
1881
1906
  if (/^(La)?TeX$/i.test(O)) {
1882
1907
  x(), i.family = "serif";
1883
- var I = void 0;
1884
- O === "LaTeX" && ((I = w(new R("L"))).tracking = -0.25, (I = w(new R("A"))).size = 0.7, I.baseline = 0.3, I.tracking = -0.1), (I = w(new R("T"))).tracking = -0.17, (I = w(new R("E"))).baseline = -0.22, I.tracking = -0.13, I = w(new R("X")), E();
1885
- } else if (O in ve)
1886
- w(new R(ve[O])), L && x();
1908
+ var M = void 0;
1909
+ O === "LaTeX" && ((M = w(new H("L"))).tracking = -0.25, (M = w(new H("A"))).size = 0.7, M.baseline = 0.3, M.tracking = -0.1), (M = w(new H("T"))).tracking = -0.17, (M = w(new H("E"))).baseline = -0.22, M.tracking = -0.13, M = w(new H("X")), E();
1910
+ } else if (O in xe)
1911
+ w(new H(xe[O])), L && x();
1887
1912
  else if (O in U) {
1888
1913
  var z = [], j = U[O].length - 1, Q = void 0;
1889
1914
  if (j) {
@@ -1896,33 +1921,33 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1896
1921
  }
1897
1922
  L && x(), U[O].apply(k, [i].concat(z));
1898
1923
  } else
1899
- console.warn("unknown latex command", O), w(new R(o[1])), L && x();
1924
+ console.warn("unknown latex command", O), w(new H(o[1])), L && x();
1900
1925
  } else
1901
- o = [e.slice(0, 1)], w(new R(o[0]));
1926
+ o = [e.slice(0, 1)], w(new H(o[0]));
1902
1927
  }
1903
1928
  e = e.slice(o[0].length);
1904
1929
  }
1905
1930
  return c;
1906
1931
  }, rt.measureText = function(e, n, o) {
1907
1932
  return X(e, b(n), o);
1908
- }, rt.Token = R, rt.Break = Tt, rt.LineBreak = nt, rt.SoftHyphen = pt, rt.Rotator = Se, Se.createElement = ke;
1909
- const kn = rt;
1933
+ }, rt.Token = H, rt.Break = Tt, rt.LineBreak = nt, rt.SoftHyphen = pt, rt.Rotator = Ee, Ee.createElement = Te;
1934
+ const Tn = rt;
1910
1935
  return r.default;
1911
1936
  })());
1912
- })(Ye);
1913
- var Bn = Ye.exports;
1914
- const Le = /* @__PURE__ */ de(Bn);
1937
+ })(Xe);
1938
+ var Vn = Xe.exports;
1939
+ const ze = /* @__PURE__ */ fe(Vn);
1915
1940
  function se(u) {
1916
1941
  return u.replace(/…$/, "");
1917
1942
  }
1918
1943
  function oe(u) {
1919
1944
  return u.children[0].innerHTML;
1920
1945
  }
1921
- function Vn(u, l) {
1946
+ function Un(u, l) {
1922
1947
  const t = ut(u), { fontSize: r, font: a, padding: h = 0 } = u.properties.style || {};
1923
1948
  if (t.width === t.height && t.width === 0)
1924
1949
  return;
1925
- const f = new Le({
1950
+ const f = new ze({
1926
1951
  font: `${r}px/${r}px ${a}`.replace(/(px)+/g, "px"),
1927
1952
  width: t.width - h * 2,
1928
1953
  height: t.height - h * 2,
@@ -1931,7 +1956,7 @@ function Vn(u, l) {
1931
1956
  x: 0,
1932
1957
  overflow: "ellipsis",
1933
1958
  parser: "html",
1934
- createElement: Le.createElement
1959
+ createElement: ze.createElement
1935
1960
  });
1936
1961
  f.overflowWrap("break-word");
1937
1962
  const p = f.linebreak(
@@ -1942,39 +1967,39 @@ function Vn(u, l) {
1942
1967
  const m = [];
1943
1968
  u.properties.content.split(`
1944
1969
  `).forEach((b) => {
1945
- let D = b;
1946
- for (; D.length && d < s.length; ) {
1970
+ let I = b;
1971
+ for (; I.length && d < s.length; ) {
1947
1972
  if (s[d].innerHTML === "&nbsp;") {
1948
- D.startsWith(`
1973
+ I.startsWith(`
1949
1974
  `) || m.push(d), d++;
1950
1975
  break;
1951
1976
  }
1952
- const A = se(oe(s[d]));
1953
- D.startsWith(A) && (D = D.slice(A.length).trim()), d++;
1977
+ const S = se(oe(s[d]));
1978
+ I.startsWith(S) && (I = I.slice(S.length).trim()), d++;
1954
1979
  }
1955
1980
  }), m.forEach((b) => p.removeChild(s[b]));
1956
- const S = u.properties.content.match(/(https?:\/\/.*)/gm), T = S ? S.map((b) => b.split(" ")[0]) : [];
1981
+ const A = u.properties.content.match(/(https?:\/\/.*)/gm), T = A ? A.map((b) => b.split(" ")[0]) : [];
1957
1982
  p.setAttribute("transform", `translate(${h}, ${h})`), T.forEach((b) => {
1958
- let D = b;
1959
- const A = [];
1960
- for (; D.length > 0; ) {
1961
- const $ = s.find((_) => !!_.children[0] && _.children[0].tagName === "tspan" && D.startsWith(se(oe(_))));
1962
- if (!$)
1983
+ let I = b;
1984
+ const S = [];
1985
+ for (; I.length > 0; ) {
1986
+ const P = s.find((_) => !!_.children[0] && _.children[0].tagName === "tspan" && I.startsWith(se(oe(_))));
1987
+ if (!P)
1963
1988
  break;
1964
- A.push($);
1965
- const N = se($.children[0].innerHTML).length;
1966
- if (!N)
1989
+ S.push(P);
1990
+ const $ = se(P.children[0].innerHTML).length;
1991
+ if (!$)
1967
1992
  break;
1968
- D = D.slice(N);
1993
+ I = I.slice($);
1969
1994
  }
1970
- A.forEach(($) => {
1971
- const N = document.createElementNS("http://www.w3.org/2000/svg", "a");
1972
- N.setAttribute("href", b), N.setAttribute("target", "_blank"), N.innerHTML = oe($), $.children[0].innerHTML = "", $.children[0].appendChild(N);
1995
+ S.forEach((P) => {
1996
+ const $ = document.createElementNS("http://www.w3.org/2000/svg", "a");
1997
+ $.setAttribute("href", b), $.setAttribute("target", "_blank"), $.innerHTML = oe(P), P.children[0].innerHTML = "", P.children[0].appendChild($);
1973
1998
  });
1974
1999
  }), l.appendChild(p);
1975
2000
  }
1976
- const ze = 20;
1977
- class Un extends Ue {
2001
+ const Ce = 20;
2002
+ class Yn extends Ye {
1978
2003
  constructor(t, r = {}) {
1979
2004
  super(
1980
2005
  t,
@@ -2008,7 +2033,7 @@ class Un extends Ue {
2008
2033
  v(this, "_onBlur", () => {
2009
2034
  this.isFocused = !1;
2010
2035
  });
2011
- v(this, "startDrawing", (t, r, a = qn(t, r, 0, 0, "", At)) => {
2036
+ v(this, "startDrawing", (t, r, a = Bn(t, r, 0, 0, "", At)) => {
2012
2037
  this.add(a);
2013
2038
  const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
2014
2039
  this.select(a.id), this.startDragging(this.getById(a.id), h.x, h.y), this.draggedHandle = 6;
@@ -2023,7 +2048,11 @@ class Un extends Ue {
2023
2048
  });
2024
2049
  v(this, "onHandleMouseDown", (t) => {
2025
2050
  const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
2026
- r && (this.selectedId !== r.id && this.select(this.hoveredId), this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = Fe(t.target));
2051
+ if (!r)
2052
+ return;
2053
+ this.selectedId !== r.id && this.select(this.hoveredId);
2054
+ const { x: a, y: h } = ae(t, this.ogma.getContainer());
2055
+ this.startDragging(r, a, h), this.draggedHandle = qe(t.target);
2027
2056
  });
2028
2057
  v(this, "onMouseMove", (t) => {
2029
2058
  requestAnimationFrame(() => this._onMouseMove(t));
@@ -2032,16 +2061,19 @@ class Un extends Ue {
2032
2061
  if (!this.isDragging)
2033
2062
  return;
2034
2063
  t.stopPropagation(), t.preventDefault();
2035
- const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), h = 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, S = this.ogma.view.getAngle(), T = new Y(d, m).rotateRadians(S);
2036
- (g && h || a && f) && (T.y = 0, T.x = 0);
2037
- const b = h || p ? this.rect.x + T.x : this.rect.x, D = a || p ? this.rect.y + T.y : this.rect.y, A = Math.max(
2038
- this.rect.width + d * (p || h ? 0 : 1),
2039
- ze
2040
- ), $ = Math.max(
2041
- this.rect.height + m * (p || a ? 0 : 1),
2042
- ze
2064
+ const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), h = r.classList.contains("left"), f = r.classList.contains("right"), g = r.classList.contains("bottom"), p = r.classList.contains("line-handle"), { x: s, y: d } = ae(
2065
+ t,
2066
+ this.ogma.getContainer()
2067
+ ), m = this.ogma.view.getZoom(), A = (s - this.startX) / m, T = (d - this.startY) / m, b = this.ogma.view.getAngle(), I = new Y(A, T).rotateRadians(b);
2068
+ (g && h || a && f) && (I.y = 0, I.x = 0);
2069
+ const S = h || p ? this.rect.x + I.x : this.rect.x, P = a || p ? this.rect.y + I.y : this.rect.y, $ = Math.max(
2070
+ this.rect.width + A * (p || h ? 0 : 1),
2071
+ Ce
2072
+ ), _ = Math.max(
2073
+ this.rect.height + T * (p || a ? 0 : 1),
2074
+ Ce
2043
2075
  );
2044
- Cn(this.annotation, b, D, A, $), this.emit(Ut, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
2076
+ Pn(this.annotation, S, P, $, _), this.emit(Ut, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
2045
2077
  });
2046
2078
  v(this, "onMouseUp", () => {
2047
2079
  !this.isDragging || this.draggedHandle === V || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(St, this.annotation), this.isDragging = !1, this.draggedHandle = V);
@@ -2055,9 +2087,9 @@ class Un extends Ue {
2055
2087
  });
2056
2088
  v(this, "_onInput", () => {
2057
2089
  const t = this.getById(this.selectedId);
2058
- t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(ue, t), this.layer.refresh());
2090
+ t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(de, t), this.layer.refresh());
2059
2091
  });
2060
- this.showeditorOnHover = !1, this.handleSize = Oe.handleSize || r.textHandleSize, this.placeholder = Oe.placeholder || r.textPlaceholder || "";
2092
+ this.showeditorOnHover = !1, this.handleSize = Le.handleSize || r.textHandleSize, this.placeholder = Le.placeholder || r.textPlaceholder || "";
2061
2093
  const a = this.textArea = this.editor.element.querySelector("textarea");
2062
2094
  a.addEventListener("input", this._onInput), a.addEventListener("focus", this._onFocus), a.addEventListener("blur", this._onBlur), a.addEventListener("mousedown", this._onMousedown), a.spellcheck = !1, this.handles = Array.prototype.slice.call(
2063
2095
  this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
@@ -2071,7 +2103,7 @@ class Un extends Ue {
2071
2103
  detect({ x: t, y: r }, a = 0) {
2072
2104
  const h = new Y(t, r), f = this.ogma.view.getAngle();
2073
2105
  return this.elements.find((g) => {
2074
- const { x: p, y: s } = ct(g), { width: d, height: m } = ut(g), S = new Y(p, s), { x: T, y: b } = h.sub(S).rotateRadians(-f);
2106
+ const { x: p, y: s } = ct(g), { width: d, height: m } = ut(g), A = new Y(p, s), { x: T, y: b } = h.sub(A).rotateRadians(-f);
2075
2107
  return T > -a && T < d + a && b > -a && b < m + a;
2076
2108
  });
2077
2109
  }
@@ -2080,22 +2112,24 @@ class Un extends Ue {
2080
2112
  const r = "", a = this.ogma.view.getAngle();
2081
2113
  this.elements.forEach((f, g) => {
2082
2114
  const p = `class${g}`, s = ut(f), d = ct(f), m = f.id, {
2083
- color: S,
2115
+ color: A,
2084
2116
  fontSize: T,
2085
2117
  font: b,
2086
- strokeColor: D,
2087
- strokeWidth: A,
2088
- strokeType: $,
2089
- background: N
2118
+ strokeColor: I,
2119
+ strokeWidth: S,
2120
+ strokeType: P,
2121
+ background: $
2090
2122
  } = f.properties.style || At;
2091
2123
  if (m === this.selectedId)
2092
2124
  return;
2093
2125
  const _ = Ot("g");
2094
- _.classList.add("annotation-text"), _.setAttribute("fill", `${S}`), _.setAttribute("font-size", `${T}px`), _.setAttribute("font-family", `${b}`);
2126
+ _.classList.add("annotation-text"), _.setAttribute("fill", `${A}`), _.setAttribute("font-size", `${T}px`), _.setAttribute("font-family", `${b}`);
2095
2127
  const X = Ot("rect");
2096
2128
  let W = !1;
2097
- $ && $ !== "none" && (W = !0, X.setAttribute("stroke", D || "black"), X.setAttribute("stroke-width", `${A}`), $ === "dashed" && X.setAttribute("stroke-dasharray", "5,5")), (N && N.length || W) && (W = !0, X.setAttribute("fill", N || "transparent")), W && (X.setAttribute("width", `${s.width}`), X.setAttribute("height", `${s.height}`)), _.appendChild(X), Vn(f, _);
2098
- const { x: Et, y: kt } = new Y(d.x, d.y).rotateRadians(-a);
2129
+ P && P !== "none" && (W = !0, X.setAttribute("stroke", I || "black"), X.setAttribute("stroke-width", `${S}`), P === "dashed" && X.setAttribute("stroke-dasharray", "5,5")), ($ && $.length || W) && (W = !0, X.setAttribute("fill", $ || "transparent")), W && (X.setAttribute("width", `${s.width}`), X.setAttribute("height", `${s.height}`)), _.appendChild(X), Un(f, _);
2130
+ const { x: Et, y: kt } = new Y(d.x, d.y).rotateRadians(
2131
+ -a
2132
+ );
2099
2133
  _.setAttribute("transform", `translate(${Et},${kt})`), _.classList.add(p), _.setAttribute("data-annotation", `${f.id}`), _.setAttribute("data-annotation-type", "text"), t.appendChild(_);
2100
2134
  });
2101
2135
  const h = Ot("style");
@@ -2107,7 +2141,9 @@ class Un extends Ue {
2107
2141
  const a = r.getAttribute("data-annotation");
2108
2142
  if (!a)
2109
2143
  return;
2110
- const h = ct(this.getById(a)), { x: f, y: g } = new Y(h.x, h.y).rotateRadians(-t);
2144
+ const h = ct(this.getById(a)), { x: f, y: g } = new Y(h.x, h.y).rotateRadians(
2145
+ -t
2146
+ );
2111
2147
  r.setAttribute("transform", `translate(${f},${g})`);
2112
2148
  });
2113
2149
  }
@@ -2117,7 +2153,9 @@ class Un extends Ue {
2117
2153
  refreshEditor() {
2118
2154
  if (+this.selectedId < 0 && +this.hoveredId < 0)
2119
2155
  return;
2120
- 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(), {
2156
+ const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), a = this.ogma.view.graphToScreenCoordinates(
2157
+ ct(t)
2158
+ ), h = this.ogma.view.getZoom(), {
2121
2159
  font: f,
2122
2160
  fontSize: g,
2123
2161
  color: p,
@@ -2133,7 +2171,7 @@ class Un extends Ue {
2133
2171
  super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
2134
2172
  }
2135
2173
  }
2136
- class Yn {
2174
+ class Xn {
2137
2175
  constructor() {
2138
2176
  v(this, "links", {});
2139
2177
  v(this, "linksByTargetId", {});
@@ -2188,7 +2226,7 @@ class Yn {
2188
2226
  Object.values(this.links).forEach(l);
2189
2227
  }
2190
2228
  }
2191
- const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type === "text", Ce = (u) => u.type === "FeatureCollection", Xn = {
2229
+ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type === "text", Pe = (u) => u.type === "FeatureCollection", Wn = {
2192
2230
  magnetColor: "#3e8",
2193
2231
  detectMargin: 20,
2194
2232
  magnetHandleRadius: 5,
@@ -2198,7 +2236,7 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
2198
2236
  textHandleSize: 3.5,
2199
2237
  minArrowHeight: 20,
2200
2238
  maxArrowHeight: 30
2201
- }, $e = ["start", "end"], Pe = [
2239
+ }, $e = ["start", "end"], Ne = [
2202
2240
  { x: 0, y: 0 },
2203
2241
  { x: 0.5, y: 0 },
2204
2242
  { x: 1, y: 0 },
@@ -2208,12 +2246,12 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
2208
2246
  { x: 0.5, y: 1 },
2209
2247
  { x: 1, y: 1 }
2210
2248
  ];
2211
- class Zn extends Ve {
2249
+ class Kn extends Ue {
2212
2250
  constructor(t, r = {}) {
2213
2251
  super();
2214
2252
  v(this, "arrows");
2215
2253
  v(this, "texts");
2216
- v(this, "links", new Yn());
2254
+ v(this, "links", new Xn());
2217
2255
  v(this, "layer");
2218
2256
  v(this, "annotations");
2219
2257
  v(this, "ogma");
@@ -2229,7 +2267,7 @@ class Zn extends Ve {
2229
2267
  return;
2230
2268
  t.beginPath(), t.fillStyle = "green";
2231
2269
  const r = this.ogma.view.getZoom();
2232
- Pe.forEach((a) => {
2270
+ Ne.forEach((a) => {
2233
2271
  if (!this.textToMagnet)
2234
2272
  return;
2235
2273
  const h = ut(this.textToMagnet), f = ct(this.textToMagnet), { x: g, y: p } = new Y(a.x, a.y).mul({ x: h.width, y: h.height }).rotateRadians(this.ogma.view.getAngle()).add(f);
@@ -2255,7 +2293,7 @@ class Zn extends Ve {
2255
2293
  });
2256
2294
  v(this, "_onFeatureDragEnd", (t) => {
2257
2295
  this.dragged !== null && ot(t) && Lt(this.dragged) && $e.forEach((r) => {
2258
- this.links.getArrowLink(t.id, r) && this.emit(Rn, {
2296
+ this.links.getArrowLink(t.id, r) && this.emit(jn, {
2259
2297
  arrow: t,
2260
2298
  link: this.links.getArrowLink(t.id, r)
2261
2299
  });
@@ -2280,22 +2318,22 @@ class Zn extends Ve {
2280
2318
  const g = this.getAnnotation(f.arrow), p = f.side, s = jt(
2281
2319
  g,
2282
2320
  p === "start" ? "end" : "start"
2283
- ), d = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), S = Ft(s, d, +m);
2284
- bt(g, p, S.x, S.y);
2321
+ ), d = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), A = Ft(s, d, +m);
2322
+ bt(g, p, A.x, A.y);
2285
2323
  });
2286
2324
  }), this.arrows.refreshLayer(), this.texts.refreshLayer();
2287
2325
  });
2288
2326
  v(this, "_onAdded", (t) => {
2289
- this.emit(ce, t);
2327
+ this.emit(ue, t);
2290
2328
  });
2291
2329
  v(this, "_onRemoved", (t) => {
2292
- this.emit(he, t);
2330
+ this.emit(ce, t);
2293
2331
  });
2294
2332
  v(this, "_onUnselect", (t) => {
2295
- this.selected = null, this.emit(le, t);
2333
+ this.selected = null, this.emit(he, t);
2296
2334
  });
2297
2335
  v(this, "_onSelect", (t) => {
2298
- this.selected !== t && (this.selected = t, this.emit(ae, this.selected));
2336
+ this.selected !== t && (this.selected = t, this.emit(le, this.selected));
2299
2337
  });
2300
2338
  /**
2301
2339
  * Triggers the update event on the annotation
@@ -2307,10 +2345,10 @@ class Zn extends Ve {
2307
2345
  );
2308
2346
  });
2309
2347
  v(this, "_onUpdate", (t) => {
2310
- this.emit(ue, t);
2348
+ this.emit(de, t);
2311
2349
  });
2312
- this.options = this.setOptions({ ...Xn, ...r }), this.ogma = t, this.arrows = new Fn(t, this.options), this.texts = new Un(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
2313
- a.on(Yt, this._onFeatureDragStart).on(Ut, this._onFeatureDrag).on(St, this._onFeatureDragEnd).on(ue, this.onUpdate).on(le, this._onUnselect).on(ae, this._onSelect).on(ce, this._onAdded).on(he, this._onRemoved);
2350
+ this.options = this.setOptions({ ...Wn, ...r }), this.ogma = t, this.arrows = new qn(t, this.options), this.texts = new Yn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
2351
+ a.on(Yt, this._onFeatureDragStart).on(Ut, this._onFeatureDrag).on(St, this._onFeatureDragEnd).on(de, this.onUpdate).on(he, this._onUnselect).on(le, this._onSelect).on(ue, this._onAdded).on(ce, this._onRemoved);
2314
2352
  }), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
2315
2353
  this.refreshTextLinks();
2316
2354
  }), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
@@ -2323,9 +2361,9 @@ class Zn extends Ve {
2323
2361
  s,
2324
2362
  d === "start" ? "end" : "start"
2325
2363
  );
2326
- let S = g;
2364
+ let A = g;
2327
2365
  const T = +h.getAttribute("radius"), b = 1e-6;
2328
- (p.connectionPoint.x - (g.x - r) > b || p.connectionPoint.y - (g.y - a) > b) && (S = Ft(m, g, T)), bt(s, d, S.x, S.y);
2366
+ (p.connectionPoint.x - (g.x - r) > b || p.connectionPoint.y - (g.y - a) > b) && (A = Ft(m, g, T)), bt(s, d, A.x, A.y);
2329
2367
  });
2330
2368
  }), this.arrows.refreshLayer();
2331
2369
  }
@@ -2334,7 +2372,7 @@ class Zn extends Ve {
2334
2372
  if (this.links.remove(t, r), !h)
2335
2373
  return !1;
2336
2374
  this.textToMagnet = h;
2337
- const f = this.findMagnetPoint(Pe, h, a);
2375
+ const f = this.findMagnetPoint(Ne, h, a);
2338
2376
  return f ? (bt(t, r, f.point.x, f.point.y), this.links.add(t, r, h.id, "text", f.magnet), !0) : !1;
2339
2377
  }
2340
2378
  _findAndSnapToNode(t, r, a) {
@@ -2342,9 +2380,9 @@ class Zn extends Ve {
2342
2380
  this.links.remove(t, r), f && f.isNode ? (this.hoveredNode = f, this.hoveredNode.setSelected(!0), this._snapToNode(t, r, f, h)) : (this.hoveredNode && this.hoveredNode.setSelected(!1), this.hoveredNode = null);
2343
2381
  }
2344
2382
  _snapToNode(t, r, a, h) {
2345
- const f = a.getPositionOnScreen(), g = +a.getAttribute("radius"), p = g * this.ogma.view.getZoom(), s = h.x - f.x, d = h.y - f.y, m = Math.sqrt(s * s + d * d), S = a.getPosition();
2383
+ const f = a.getPositionOnScreen(), g = +a.getAttribute("radius"), p = g * this.ogma.view.getZoom(), s = h.x - f.x, d = h.y - f.y, m = Math.sqrt(s * s + d * d), A = a.getPosition();
2346
2384
  if (m < p + this.options.detectMargin) {
2347
- let T = S;
2385
+ let T = A;
2348
2386
  if (m > p / 2) {
2349
2387
  const b = jt(t, r === "end" ? "start" : "end");
2350
2388
  T = Ft(b, T, g);
@@ -2354,13 +2392,15 @@ class Zn extends Ve {
2354
2392
  }
2355
2393
  refreshTextLinks() {
2356
2394
  let t = !1;
2357
- this.links.forEach(({ connectionPoint: r, targetType: a, target: h, arrow: f, side: g }) => {
2358
- if (a !== "text")
2359
- return;
2360
- t = !0;
2361
- const p = this.getAnnotation(h), s = this.getAnnotation(f), d = ut(p), m = ct(p), S = new Y(r.x, r.y).mul({ x: d.width, y: d.height }).rotateRadians(this.ogma.view.getAngle()).add(m);
2362
- bt(s, g, S.x, S.y);
2363
- }), t && this.arrows.refreshLayer();
2395
+ this.links.forEach(
2396
+ ({ connectionPoint: r, targetType: a, target: h, arrow: f, side: g }) => {
2397
+ if (a !== "text")
2398
+ return;
2399
+ t = !0;
2400
+ const p = this.getAnnotation(h), s = this.getAnnotation(f), d = ut(p), m = ct(p), A = new Y(r.x, r.y).mul({ x: d.width, y: d.height }).rotateRadians(this.ogma.view.getAngle()).add(m);
2401
+ bt(s, g, A.x, A.y);
2402
+ }
2403
+ ), t && this.arrows.refreshLayer();
2364
2404
  }
2365
2405
  /**
2366
2406
  * @returns the currently selected annotation
@@ -2417,13 +2457,12 @@ class Zn extends Ve {
2417
2457
  * @param annotation The annotation to add
2418
2458
  */
2419
2459
  add(t) {
2420
- if (Ce(t)) {
2421
- const [r, a] = t.features.reduce((h, f) => (ot(f) ? h[1].push(f) : mt(f) && h[0].push(f), h), [[], []]);
2422
- return r.forEach(
2423
- (h) => this.add(h)
2424
- ), a.forEach(
2425
- (h) => this.add(h)
2426
- ), this.arrows.refreshLayer(), this;
2460
+ if (Pe(t)) {
2461
+ const [r, a] = t.features.reduce(
2462
+ (h, f) => (ot(f) ? h[1].push(f) : mt(f) && h[0].push(f), h),
2463
+ [[], []]
2464
+ );
2465
+ return r.forEach((h) => this.add(h)), a.forEach((h) => this.add(h)), this.arrows.refreshLayer(), this;
2427
2466
  }
2428
2467
  switch (t.properties.type) {
2429
2468
  case "text":
@@ -2436,11 +2475,11 @@ class Zn extends Ve {
2436
2475
  return this;
2437
2476
  }
2438
2477
  /**
2439
- * Remove an annotation or an array of annotations from the controller
2440
- * @param annotation The annotation(s) to remove
2441
- */
2478
+ * Remove an annotation or an array of annotations from the controller
2479
+ * @param annotation The annotation(s) to remove
2480
+ */
2442
2481
  remove(t) {
2443
- return Ce(t) ? (t.features.forEach(
2482
+ return Pe(t) ? (t.features.forEach(
2444
2483
  (r) => this.remove(r)
2445
2484
  ), this) : (ot(t) ? (this.links.remove(t, "start"), this.links.remove(t, "end"), this.arrows.remove(t.id)) : this.texts.remove(t.id), this);
2446
2485
  }
@@ -2458,7 +2497,10 @@ class Zn extends Ve {
2458
2497
  if (!f)
2459
2498
  continue;
2460
2499
  this.links.add(t, r, a.id, a.type, a.magnet);
2461
- const g = f.getPosition(), p = f.getAttribute("radius") || 0, s = jt(t, r === "start" ? "end" : "start"), d = Ft(s, g, +p);
2500
+ const g = f.getPosition(), p = f.getAttribute("radius") || 0, s = jt(
2501
+ t,
2502
+ r === "start" ? "end" : "start"
2503
+ ), d = Ft(s, g, +p);
2462
2504
  bt(t, r, d.x, d.y);
2463
2505
  }
2464
2506
  }
@@ -2497,7 +2539,7 @@ class Zn extends Ve {
2497
2539
  return a ? (ot(a) ? this.arrows.updateStyle(a, r) : mt(a) && this.texts.updateStyle(a, r), this.onUpdate(a), this) : this;
2498
2540
  }
2499
2541
  /**
2500
- *
2542
+ *
2501
2543
  * @returns the annotations in the controller
2502
2544
  */
2503
2545
  getAnnotations() {
@@ -2525,33 +2567,47 @@ class Zn extends Ve {
2525
2567
  }
2526
2568
  }
2527
2569
  export {
2528
- Fn as Arrows,
2529
- Zn as Control,
2530
- Un as Texts,
2531
- On as createArrow,
2570
+ qn as Arrows,
2571
+ Kn as Control,
2572
+ ue as EVT_ADD,
2573
+ Hn as EVT_CANCEL_DRAWING,
2574
+ Ut as EVT_DRAG,
2575
+ St as EVT_DRAG_END,
2576
+ Yt as EVT_DRAG_START,
2577
+ Nn as EVT_HOVER,
2578
+ jn as EVT_LINK,
2579
+ ce as EVT_REMOVE,
2580
+ le as EVT_SELECT,
2581
+ Rn as EVT_UNHOVER,
2582
+ he as EVT_UNSELECT,
2583
+ de as EVT_UPDATE,
2584
+ V as NONE,
2585
+ Yn as Texts,
2586
+ ae as clientToContainerPosition,
2587
+ Ln as createArrow,
2532
2588
  Ot as createSVGElement,
2533
- qn as createText,
2534
- Te as defaultArrowOptions,
2589
+ Bn as createText,
2590
+ _e as defaultArrowOptions,
2535
2591
  zt as defaultArrowStyle,
2536
- Oe as defaultControllerOptions,
2592
+ Le as defaultControllerOptions,
2537
2593
  re as defaultTextOptions,
2538
2594
  At as defaultTextStyle,
2539
- Gn as getAnnotationsBounds,
2595
+ Zn as getAnnotationsBounds,
2540
2596
  Bt as getArrowEnd,
2541
2597
  Vt as getArrowEndPoints,
2542
2598
  jt as getArrowSide,
2543
2599
  Lt as getArrowStart,
2544
2600
  Ft as getAttachmentPointOnNode,
2545
- Fe as getHandleId,
2601
+ qe as getHandleId,
2546
2602
  He as getTextBbox,
2547
2603
  ct as getTextPosition,
2548
2604
  ut as getTextSize,
2549
- Ce as isAnnotationCollection,
2605
+ Pe as isAnnotationCollection,
2550
2606
  ot as isArrow,
2551
2607
  mt as isText,
2552
- je as setArrowEnd,
2608
+ Fe as setArrowEnd,
2553
2609
  bt as setArrowEndPoint,
2554
- Re as setArrowStart,
2555
- Cn as setTextBbox,
2556
- zn as updateTextBbox
2610
+ je as setArrowStart,
2611
+ Pn as setTextBbox,
2612
+ Cn as updateTextBbox
2557
2613
  };