@linkurious/ogma-annotations 1.1.1 → 1.1.3

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