@linkurious/ogma-annotations 1.1.8 → 1.1.9
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 +641 -597
- package/dist/index.umd.js +12 -10
- package/dist/style.css +1 -1
- package/dist/types/Editor/Texts/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var v = (u, l, t) => (
|
|
4
|
-
var
|
|
5
|
-
function
|
|
1
|
+
var _n = Object.defineProperty;
|
|
2
|
+
var In = (u, l, t) => l in u ? _n(u, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[l] = t;
|
|
3
|
+
var v = (u, l, t) => (In(u, typeof l != "symbol" ? l + "" : l, t), t);
|
|
4
|
+
var Mn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5
|
+
function de(u) {
|
|
6
6
|
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
7
7
|
}
|
|
8
|
-
var
|
|
8
|
+
var Ne = { exports: {} };
|
|
9
9
|
(function(u) {
|
|
10
10
|
(function(l, t) {
|
|
11
11
|
u.exports = t();
|
|
@@ -15,29 +15,29 @@ var $e = { exports: {} };
|
|
|
15
15
|
function h(s) {
|
|
16
16
|
return Math.round(s * 1e8) / 1e8;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
var m =
|
|
20
|
-
return Math.sqrt(m * m +
|
|
18
|
+
function f(s, d) {
|
|
19
|
+
var m = d.x - s.x, S = d.y - s.y;
|
|
20
|
+
return Math.sqrt(m * m + S * S);
|
|
21
21
|
}
|
|
22
|
-
function g(s,
|
|
23
|
-
var
|
|
22
|
+
function g(s, d, m) {
|
|
23
|
+
var S = d.y - s.y, T = d.x - s.x, b = Math.atan2(S, T);
|
|
24
24
|
if (m)
|
|
25
|
-
for (;
|
|
26
|
-
|
|
27
|
-
return
|
|
25
|
+
for (; b < 0; )
|
|
26
|
+
b += t;
|
|
27
|
+
return b;
|
|
28
28
|
}
|
|
29
|
-
function p(s,
|
|
30
|
-
this.x = s !== void 0 ? s : 0, this.y =
|
|
29
|
+
function p(s, d) {
|
|
30
|
+
this.x = s !== void 0 ? s : 0, this.y = d !== void 0 ? d : 0;
|
|
31
31
|
}
|
|
32
32
|
return p.fromRadians = function(s) {
|
|
33
|
-
var
|
|
34
|
-
return new p(
|
|
33
|
+
var d = Math.cos(s), m = Math.sin(s);
|
|
34
|
+
return new p(d, m);
|
|
35
35
|
}, p.fromDegrees = function(s) {
|
|
36
|
-
var
|
|
37
|
-
return p.fromRadians(
|
|
36
|
+
var d = s * (Math.PI / 180);
|
|
37
|
+
return p.fromRadians(d);
|
|
38
38
|
}, p.fromString = function(s) {
|
|
39
|
-
var
|
|
40
|
-
return new p(parseFloat(
|
|
39
|
+
var d = s.split(",");
|
|
40
|
+
return new p(parseFloat(d[0]), parseFloat(d[1]));
|
|
41
41
|
}, p.fromArray = function(s) {
|
|
42
42
|
return new p(s[0], s[1]);
|
|
43
43
|
}, p.prototype = {
|
|
@@ -100,8 +100,8 @@ var $e = { exports: {} };
|
|
|
100
100
|
// @param x - optional x component to set.
|
|
101
101
|
// @param y - optional y component to set.
|
|
102
102
|
// @return self.
|
|
103
|
-
set: function(s,
|
|
104
|
-
return s !== void 0 && (this.x = s),
|
|
103
|
+
set: function(s, d) {
|
|
104
|
+
return s !== void 0 && (this.x = s), d !== void 0 && (this.y = d), this;
|
|
105
105
|
},
|
|
106
106
|
// [API]
|
|
107
107
|
// [chainable, clone]
|
|
@@ -137,7 +137,7 @@ 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
|
|
140
|
+
return f(this, s);
|
|
141
141
|
},
|
|
142
142
|
// [API]
|
|
143
143
|
// []
|
|
@@ -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
|
|
195
|
-
return this.x = h(
|
|
194
|
+
var d = Math.cos(s), m = Math.sin(s), S = this.x * d - this.y * m, T = this.x * m + this.y * d;
|
|
195
|
+
return this.x = h(S), this.y = h(T), this;
|
|
196
196
|
},
|
|
197
197
|
// [API]
|
|
198
198
|
// [chainable]
|
|
@@ -368,8 +368,8 @@ var $e = { exports: {} };
|
|
|
368
368
|
// @param min - min value for x, y components.
|
|
369
369
|
// @param max - max value for x, y components.
|
|
370
370
|
// @return self.
|
|
371
|
-
clampSelf: function(s,
|
|
372
|
-
return this.x < s.x && (this.x = s.x), this.y < s.y && (this.y = s.y), this.x >
|
|
371
|
+
clampSelf: function(s, d) {
|
|
372
|
+
return this.x < s.x && (this.x = s.x), this.y < s.y && (this.y = s.y), this.x > d.x && (this.x = d.x), this.y > d.y && (this.y = d.y), this;
|
|
373
373
|
},
|
|
374
374
|
// [API]
|
|
375
375
|
// [chainable, clone]
|
|
@@ -378,8 +378,8 @@ var $e = { exports: {} };
|
|
|
378
378
|
// @param min - min value for x, y components.
|
|
379
379
|
// @param max - max value for x, y components.
|
|
380
380
|
// @return cloned vector in range.
|
|
381
|
-
clamp: function(s,
|
|
382
|
-
return this.clone().clampSelf(s,
|
|
381
|
+
clamp: function(s, d) {
|
|
382
|
+
return this.clone().clampSelf(s, d);
|
|
383
383
|
},
|
|
384
384
|
// [API]
|
|
385
385
|
// [chainable, changeSelf]
|
|
@@ -450,8 +450,8 @@ var $e = { exports: {} };
|
|
|
450
450
|
// @param x - default value for x if undefined (0 if not defined).
|
|
451
451
|
// @param y - default value for y if undefined (0 if not defined).
|
|
452
452
|
// @return self.
|
|
453
|
-
repairSelf: function(s,
|
|
454
|
-
return (typeof this.x != "number" || isNaN(this.x + 1)) && (this.x = s || 0), (typeof this.y != "number" || isNaN(this.y + 1)) && (this.y =
|
|
453
|
+
repairSelf: function(s, d) {
|
|
454
|
+
return (typeof this.x != "number" || isNaN(this.x + 1)) && (this.x = s || 0), (typeof this.y != "number" || isNaN(this.y + 1)) && (this.y = d || 0), this;
|
|
455
455
|
},
|
|
456
456
|
// [API]
|
|
457
457
|
// [chainable, clone]
|
|
@@ -460,8 +460,8 @@ var $e = { exports: {} };
|
|
|
460
460
|
// @param x - default value for x if undefined (0 if not defined).
|
|
461
461
|
// @param y - default value for y if undefined (0 if not defined).
|
|
462
462
|
// @return repaired clone.
|
|
463
|
-
repair: function(s,
|
|
464
|
-
return this.clone().repairSelf(s,
|
|
463
|
+
repair: function(s, d) {
|
|
464
|
+
return this.clone().repairSelf(s, d);
|
|
465
465
|
},
|
|
466
466
|
// [API]
|
|
467
467
|
// []
|
|
@@ -482,23 +482,23 @@ var $e = { exports: {} };
|
|
|
482
482
|
}();
|
|
483
483
|
return l.zero = new l(0, 0), l.one = new l(1, 1), l.up = new l(0, -1), l.down = new l(0, 1), l.left = new l(-1, 0), l.right = new l(1, 0), l.upLeft = new l(-1, -1), l.downLeft = new l(-1, 1), l.upRight = new l(1, -1), l.downRight = new l(1, 1), l.prototype.magnitude = l.prototype.length, Object.freeze && (Object.freeze(l.zero), Object.freeze(l.one), Object.freeze(l.up), Object.freeze(l.down), Object.freeze(l.left), Object.freeze(l.right), Object.freeze(l.upLeft), Object.freeze(l.downLeft), Object.freeze(l.upRight), Object.freeze(l.downRight)), l;
|
|
484
484
|
});
|
|
485
|
-
})(
|
|
486
|
-
var
|
|
487
|
-
const
|
|
485
|
+
})(Ne);
|
|
486
|
+
var Dn = Ne.exports;
|
|
487
|
+
const Y = /* @__PURE__ */ de(Dn);
|
|
488
488
|
let Xt = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((l, t) => (t &= 63, t < 36 ? l += t.toString(36) : t < 62 ? l += (t - 26).toString(36).toUpperCase() : t > 62 ? l += "-" : l += "_", l), "");
|
|
489
|
-
const
|
|
489
|
+
const zt = {
|
|
490
490
|
strokeType: "plain",
|
|
491
491
|
strokeColor: "black",
|
|
492
492
|
strokeWidth: 1,
|
|
493
493
|
head: "none",
|
|
494
494
|
tail: "none"
|
|
495
|
-
},
|
|
495
|
+
}, Te = {
|
|
496
496
|
id: 0,
|
|
497
497
|
type: "Feature",
|
|
498
498
|
properties: {
|
|
499
499
|
type: "arrow",
|
|
500
500
|
style: {
|
|
501
|
-
...
|
|
501
|
+
...zt
|
|
502
502
|
}
|
|
503
503
|
},
|
|
504
504
|
geometry: {
|
|
@@ -518,13 +518,13 @@ const Lt = {
|
|
|
518
518
|
// tail: 'arrow-plain',
|
|
519
519
|
// start: { x: 0, y: 0 },
|
|
520
520
|
// end: { x: 100, y: 100 }
|
|
521
|
-
},
|
|
521
|
+
}, On = (u = 0, l = 0, t = 0, r = 0, a = { ...zt }) => ({
|
|
522
522
|
id: Xt(),
|
|
523
523
|
type: "Feature",
|
|
524
524
|
properties: {
|
|
525
525
|
type: "arrow",
|
|
526
526
|
style: {
|
|
527
|
-
...
|
|
527
|
+
...zt,
|
|
528
528
|
...a
|
|
529
529
|
}
|
|
530
530
|
},
|
|
@@ -535,29 +535,29 @@ const Lt = {
|
|
|
535
535
|
[t, r]
|
|
536
536
|
]
|
|
537
537
|
}
|
|
538
|
-
}),
|
|
539
|
-
function
|
|
540
|
-
return document.createElementNS(
|
|
538
|
+
}), Ln = "http://www.w3.org/2000/svg";
|
|
539
|
+
function Ot(u) {
|
|
540
|
+
return document.createElementNS(Ln, u);
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
return u.geometry.bbox ||
|
|
542
|
+
function He(u) {
|
|
543
|
+
return u.geometry.bbox || zn(u), u.geometry.bbox;
|
|
544
544
|
}
|
|
545
545
|
function ut(u) {
|
|
546
|
-
const l =
|
|
546
|
+
const l = He(u);
|
|
547
547
|
return {
|
|
548
548
|
width: l[2] - l[0],
|
|
549
549
|
height: l[3] - l[1]
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
552
|
function ct(u) {
|
|
553
|
-
const l =
|
|
553
|
+
const l = He(u);
|
|
554
554
|
return { x: l[0], y: l[1] };
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function zn(u) {
|
|
557
557
|
const [l, t] = u.geometry.coordinates[0][0], [r, a] = u.geometry.coordinates[0][2];
|
|
558
558
|
u.geometry.bbox = [l, t, r, a];
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Cn(u, l, t, r, a) {
|
|
561
561
|
u.geometry.bbox = [l, t, l + r, t + a], u.geometry.coordinates = [
|
|
562
562
|
[
|
|
563
563
|
[l, t],
|
|
@@ -568,7 +568,7 @@ function zn(u, l, t, r, a) {
|
|
|
568
568
|
]
|
|
569
569
|
];
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function Lt(u) {
|
|
572
572
|
const [l, t] = u.geometry.coordinates[0];
|
|
573
573
|
return { x: l, y: t };
|
|
574
574
|
}
|
|
@@ -576,25 +576,25 @@ function jt(u, l) {
|
|
|
576
576
|
const [t, r] = u.geometry.coordinates[l === "start" ? 0 : 1];
|
|
577
577
|
return { x: t, y: r };
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function Bt(u) {
|
|
580
580
|
const [l, t] = u.geometry.coordinates[1];
|
|
581
581
|
return { x: l, y: t };
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function Re(u, l, t) {
|
|
584
584
|
u.geometry.coordinates[0] = [l, t];
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function je(u, l, t) {
|
|
587
587
|
u.geometry.coordinates[1] = [l, t];
|
|
588
588
|
}
|
|
589
589
|
function Vt(u) {
|
|
590
|
-
return { start:
|
|
590
|
+
return { start: Lt(u), end: Bt(u) };
|
|
591
591
|
}
|
|
592
592
|
function bt(u, l, t, r) {
|
|
593
|
-
l === "start" ?
|
|
593
|
+
l === "start" ? Re(u, t, r) : je(u, t, r);
|
|
594
594
|
}
|
|
595
|
-
const
|
|
596
|
-
function
|
|
597
|
-
return
|
|
595
|
+
const Fe = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
|
|
596
|
+
function Gn(u) {
|
|
597
|
+
return qt(u).reduce(
|
|
598
598
|
(l, t) => (l[0] = Math.min(t[0], l[0]), l[1] = Math.min(t[1], l[1]), l[2] = Math.max(t[0], l[2]), l[3] = Math.max(t[1], l[3]), l),
|
|
599
599
|
[
|
|
600
600
|
Number.POSITIVE_INFINITY,
|
|
@@ -604,18 +604,18 @@ function Xn(u) {
|
|
|
604
604
|
]
|
|
605
605
|
);
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function qt(u) {
|
|
608
608
|
let l = [];
|
|
609
609
|
return u.type == "Point" ? l = [u.coordinates] : u.type == "LineString" || u.type == "MultiPoint" ? l = u.coordinates : u.type == "Polygon" || u.type == "MultiLineString" ? l = u.coordinates.reduce(function(t, r) {
|
|
610
610
|
return t.concat(r);
|
|
611
611
|
}, []) : u.type == "MultiPolygon" ? l = u.coordinates.reduce(
|
|
612
612
|
(t, r) => t.concat(r.reduce((a, h) => a.concat(h), [])),
|
|
613
613
|
[]
|
|
614
|
-
) : u.type == "Feature" ? l =
|
|
615
|
-
(t, r) => t.concat(
|
|
614
|
+
) : u.type == "Feature" ? l = qt(u.geometry) : u.type == "GeometryCollection" ? l = u.geometries.reduce(
|
|
615
|
+
(t, r) => t.concat(qt(r)),
|
|
616
616
|
[]
|
|
617
617
|
) : u.type == "FeatureCollection" && (l = u.features.reduce(
|
|
618
|
-
(t, r) => t.concat(
|
|
618
|
+
(t, r) => t.concat(qt(r)),
|
|
619
619
|
[]
|
|
620
620
|
)), l;
|
|
621
621
|
}
|
|
@@ -626,141 +626,141 @@ function Ft(u, l, t) {
|
|
|
626
626
|
y: l.y + t * Math.sin(r)
|
|
627
627
|
};
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function qe(u, l = 5, t = 30) {
|
|
630
630
|
var s;
|
|
631
|
-
const { start: r, end: a } = Vt(u), h = new
|
|
631
|
+
const { start: r, end: a } = Vt(u), h = new Y(r.x, r.y), g = new Y(a.x, a.y).sub(h), p = u.properties.style && u.properties.style.strokeWidth ? (s = u.properties.style) == null ? void 0 : s.strokeWidth : 0;
|
|
632
632
|
return Math.min(t, Math.max(3 * p, g.length() * 0.1, l));
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function _e(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 h = u.clone().add(a.rotateRadians(Math.PI / 8)),
|
|
639
|
-
return `M ${h.x} ${h.y} L ${g} ${
|
|
638
|
+
const h = 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 ${h.x} ${h.y} L ${g} ${f.x} ${f.y} ${t === "arrow" ? "" : `${h.x} ${h.y}`}`;
|
|
640
640
|
}
|
|
641
|
-
function
|
|
642
|
-
const { start: h, end:
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
|
|
641
|
+
function $n(u, l, t, r, a) {
|
|
642
|
+
const { start: h, end: f } = Vt(u), { tail: g, head: p, strokeColor: s, strokeWidth: d } = u.properties.style || t, m = new Y(h.x, h.y), S = new Y(f.x, f.y), T = S.clone().sub(m), b = qe(u, r, a), D = Ot("path");
|
|
643
|
+
D.setAttribute("data-annotation", `${u.id}`), D.setAttribute("data-annotation-type", "arrow");
|
|
644
|
+
const A = p === "arrow-plain" || g === "arrow";
|
|
645
|
+
D.setAttribute("stroke", s || "none"), D.setAttribute("stroke-width", `${d}`), D.setAttribute("fill", A ? s || "" : "none"), D.setAttribute("stroke-linecap", "round"), D.setAttribute("stroke-linejoin", "round");
|
|
646
|
+
const $ = _e(m, T.clone().invert(), g, b), N = _e(S, T, p, b), _ = $ + `M ${m.x} ${m.y} ${S.x} ${S.y}` + N;
|
|
647
|
+
D.setAttribute("d", _), l.appendChild(D);
|
|
648
648
|
}
|
|
649
|
-
const
|
|
650
|
-
var
|
|
649
|
+
const V = -1, Ut = "dragging", Yt = "dragstart", St = "dragend", ae = "select", le = "unselect", Pn = "hover", Nn = "unhover", he = "remove", ce = "add", Hn = "cancelDrawing", ue = "update", Rn = "link";
|
|
650
|
+
var Be = { exports: {} };
|
|
651
651
|
(function(u) {
|
|
652
652
|
var l = Object.prototype.hasOwnProperty, t = "~";
|
|
653
653
|
function r() {
|
|
654
654
|
}
|
|
655
655
|
Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
|
|
656
|
-
function a(p, s,
|
|
657
|
-
this.fn = p, this.context = s, this.once =
|
|
656
|
+
function a(p, s, d) {
|
|
657
|
+
this.fn = p, this.context = s, this.once = d || !1;
|
|
658
658
|
}
|
|
659
|
-
function h(p, s,
|
|
660
|
-
if (typeof
|
|
659
|
+
function h(p, s, d, m, S) {
|
|
660
|
+
if (typeof d != "function")
|
|
661
661
|
throw new TypeError("The listener must be a function");
|
|
662
|
-
var T = new a(
|
|
663
|
-
return p._events[
|
|
662
|
+
var T = new a(d, m || p, S), b = t ? t + s : s;
|
|
663
|
+
return p._events[b] ? p._events[b].fn ? p._events[b] = [p._events[b], T] : p._events[b].push(T) : (p._events[b] = T, p._eventsCount++), p;
|
|
664
664
|
}
|
|
665
|
-
function
|
|
665
|
+
function f(p, s) {
|
|
666
666
|
--p._eventsCount === 0 ? p._events = new r() : delete p._events[s];
|
|
667
667
|
}
|
|
668
668
|
function g() {
|
|
669
669
|
this._events = new r(), this._eventsCount = 0;
|
|
670
670
|
}
|
|
671
671
|
g.prototype.eventNames = function() {
|
|
672
|
-
var s = [],
|
|
672
|
+
var s = [], d, m;
|
|
673
673
|
if (this._eventsCount === 0)
|
|
674
674
|
return s;
|
|
675
|
-
for (m in
|
|
676
|
-
l.call(
|
|
677
|
-
return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(
|
|
675
|
+
for (m in d = this._events)
|
|
676
|
+
l.call(d, m) && s.push(t ? m.slice(1) : m);
|
|
677
|
+
return Object.getOwnPropertySymbols ? s.concat(Object.getOwnPropertySymbols(d)) : s;
|
|
678
678
|
}, g.prototype.listeners = function(s) {
|
|
679
|
-
var
|
|
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
|
|
685
|
-
S
|
|
686
|
-
return
|
|
684
|
+
for (var S = 0, T = m.length, b = new Array(T); S < T; S++)
|
|
685
|
+
b[S] = m[S].fn;
|
|
686
|
+
return b;
|
|
687
687
|
}, g.prototype.listenerCount = function(s) {
|
|
688
|
-
var
|
|
688
|
+
var d = t ? t + s : s, m = this._events[d];
|
|
689
689
|
return m ? m.fn ? 1 : m.length : 0;
|
|
690
|
-
}, g.prototype.emit = function(s,
|
|
691
|
-
var
|
|
692
|
-
if (!this._events[
|
|
690
|
+
}, g.prototype.emit = function(s, d, m, S, T, b) {
|
|
691
|
+
var D = t ? t + s : s;
|
|
692
|
+
if (!this._events[D])
|
|
693
693
|
return !1;
|
|
694
|
-
var
|
|
695
|
-
if (
|
|
696
|
-
switch (
|
|
694
|
+
var A = this._events[D], $ = arguments.length, N, _;
|
|
695
|
+
if (A.fn) {
|
|
696
|
+
switch (A.once && this.removeListener(s, A.fn, void 0, !0), $) {
|
|
697
697
|
case 1:
|
|
698
|
-
return
|
|
698
|
+
return A.fn.call(A.context), !0;
|
|
699
699
|
case 2:
|
|
700
|
-
return
|
|
700
|
+
return A.fn.call(A.context, d), !0;
|
|
701
701
|
case 3:
|
|
702
|
-
return
|
|
702
|
+
return A.fn.call(A.context, d, m), !0;
|
|
703
703
|
case 4:
|
|
704
|
-
return
|
|
704
|
+
return A.fn.call(A.context, d, m, S), !0;
|
|
705
705
|
case 5:
|
|
706
|
-
return
|
|
706
|
+
return A.fn.call(A.context, d, m, S, T), !0;
|
|
707
707
|
case 6:
|
|
708
|
-
return
|
|
708
|
+
return A.fn.call(A.context, d, m, S, T, b), !0;
|
|
709
709
|
}
|
|
710
|
-
for (
|
|
711
|
-
|
|
712
|
-
|
|
710
|
+
for (_ = 1, N = new Array($ - 1); _ < $; _++)
|
|
711
|
+
N[_ - 1] = arguments[_];
|
|
712
|
+
A.fn.apply(A.context, N);
|
|
713
713
|
} else {
|
|
714
|
-
var
|
|
715
|
-
for (
|
|
716
|
-
switch (
|
|
714
|
+
var X = A.length, W;
|
|
715
|
+
for (_ = 0; _ < X; _++)
|
|
716
|
+
switch (A[_].once && this.removeListener(s, A[_].fn, void 0, !0), $) {
|
|
717
717
|
case 1:
|
|
718
|
-
|
|
718
|
+
A[_].fn.call(A[_].context);
|
|
719
719
|
break;
|
|
720
720
|
case 2:
|
|
721
|
-
|
|
721
|
+
A[_].fn.call(A[_].context, d);
|
|
722
722
|
break;
|
|
723
723
|
case 3:
|
|
724
|
-
|
|
724
|
+
A[_].fn.call(A[_].context, d, m);
|
|
725
725
|
break;
|
|
726
726
|
case 4:
|
|
727
|
-
|
|
727
|
+
A[_].fn.call(A[_].context, d, m, S);
|
|
728
728
|
break;
|
|
729
729
|
default:
|
|
730
|
-
if (!
|
|
731
|
-
for (
|
|
732
|
-
|
|
733
|
-
|
|
730
|
+
if (!N)
|
|
731
|
+
for (W = 1, N = new Array($ - 1); W < $; W++)
|
|
732
|
+
N[W - 1] = arguments[W];
|
|
733
|
+
A[_].fn.apply(A[_].context, N);
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
736
|
return !0;
|
|
737
|
-
}, g.prototype.on = function(s,
|
|
738
|
-
return h(this, s,
|
|
739
|
-
}, g.prototype.once = function(s,
|
|
740
|
-
return h(this, s,
|
|
741
|
-
}, g.prototype.removeListener = function(s,
|
|
737
|
+
}, g.prototype.on = function(s, d, m) {
|
|
738
|
+
return h(this, s, d, m, !1);
|
|
739
|
+
}, g.prototype.once = function(s, d, m) {
|
|
740
|
+
return h(this, s, d, m, !0);
|
|
741
|
+
}, g.prototype.removeListener = function(s, d, m, S) {
|
|
742
742
|
var T = t ? t + s : s;
|
|
743
743
|
if (!this._events[T])
|
|
744
744
|
return this;
|
|
745
|
-
if (!
|
|
746
|
-
return
|
|
747
|
-
var
|
|
748
|
-
if (
|
|
749
|
-
|
|
745
|
+
if (!d)
|
|
746
|
+
return f(this, T), this;
|
|
747
|
+
var b = this._events[T];
|
|
748
|
+
if (b.fn)
|
|
749
|
+
b.fn === d && (!S || b.once) && (!m || b.context === m) && f(this, T);
|
|
750
750
|
else {
|
|
751
|
-
for (var
|
|
752
|
-
(
|
|
753
|
-
|
|
751
|
+
for (var D = 0, A = [], $ = b.length; D < $; D++)
|
|
752
|
+
(b[D].fn !== d || S && !b[D].once || m && b[D].context !== m) && A.push(b[D]);
|
|
753
|
+
A.length ? this._events[T] = A.length === 1 ? A[0] : A : f(this, T);
|
|
754
754
|
}
|
|
755
755
|
return this;
|
|
756
756
|
}, g.prototype.removeAllListeners = function(s) {
|
|
757
|
-
var
|
|
758
|
-
return s ? (
|
|
757
|
+
var d;
|
|
758
|
+
return s ? (d = t ? t + s : s, this._events[d] && f(this, d)) : (this._events = new r(), this._eventsCount = 0), this;
|
|
759
759
|
}, g.prototype.off = g.prototype.removeListener, g.prototype.addListener = g.prototype.on, g.prefixed = t, g.EventEmitter = g, u.exports = g;
|
|
760
|
-
})(
|
|
761
|
-
var
|
|
762
|
-
const
|
|
763
|
-
class
|
|
760
|
+
})(Be);
|
|
761
|
+
var jn = Be.exports;
|
|
762
|
+
const Ve = /* @__PURE__ */ de(jn);
|
|
763
|
+
class Ue extends Ve {
|
|
764
764
|
constructor(t, r) {
|
|
765
765
|
super();
|
|
766
766
|
v(this, "ogma");
|
|
@@ -768,8 +768,8 @@ class qe extends Be {
|
|
|
768
768
|
// layer to draw elements
|
|
769
769
|
v(this, "layer");
|
|
770
770
|
v(this, "editor");
|
|
771
|
-
v(this, "selectedId",
|
|
772
|
-
v(this, "hoveredId",
|
|
771
|
+
v(this, "selectedId", V);
|
|
772
|
+
v(this, "hoveredId", V);
|
|
773
773
|
// used to remember ogma options before we change them
|
|
774
774
|
v(this, "ogmaOptions");
|
|
775
775
|
v(this, "shouldDetect");
|
|
@@ -777,13 +777,13 @@ class qe extends Be {
|
|
|
777
777
|
v(this, "showeditorOnHover");
|
|
778
778
|
v(this, "maxHandleScale", 1.5);
|
|
779
779
|
v(this, "_onKeyUp", (t) => {
|
|
780
|
-
t.code === 27 && this.selectedId !==
|
|
780
|
+
t.code === 27 && this.selectedId !== V ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== V && this._canRemove() && this.remove(this.selectedId);
|
|
781
781
|
});
|
|
782
782
|
v(this, "_onClickMouseMove", (t) => {
|
|
783
|
-
if (!t.domEvent || this.isDragging || !this.shouldDetect)
|
|
783
|
+
if (!t.domEvent || this.isDragging || !this.shouldDetect || t.domEvent.type !== "mousemove" && t.domEvent.target.tagName === "a")
|
|
784
784
|
return;
|
|
785
785
|
const r = this.ogma.view.screenToGraphCoordinates(t), a = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
|
|
786
|
-
t.domEvent.type === "mousemove" ? a ? this.hover(a.id) : this.hoveredId !==
|
|
786
|
+
t.domEvent.type === "mousemove" ? a ? this.hover(a.id) : this.hoveredId !== V && this.unhover() : a ? this.select(a.id) : this.selectedId !== V && this.unselect();
|
|
787
787
|
});
|
|
788
788
|
this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("frame", () => {
|
|
789
789
|
this.refreshEditor(), this.refreshDrawing();
|
|
@@ -814,7 +814,7 @@ class qe extends Be {
|
|
|
814
814
|
...t.geometry
|
|
815
815
|
}
|
|
816
816
|
});
|
|
817
|
-
return this.elements.push(a), this.layer.refresh(), this.emit(
|
|
817
|
+
return this.elements.push(a), this.layer.refresh(), this.emit(ce, a), a;
|
|
818
818
|
}
|
|
819
819
|
updateStyle(t, r) {
|
|
820
820
|
this.updateAnnotation(t, {
|
|
@@ -845,13 +845,13 @@ class qe extends Be {
|
|
|
845
845
|
Object.keys(r).forEach((h) => {
|
|
846
846
|
if (h !== "id")
|
|
847
847
|
if (h === "properties") {
|
|
848
|
-
const
|
|
848
|
+
const f = r.properties || { style: {} };
|
|
849
849
|
t.properties = {
|
|
850
850
|
...t.properties || {},
|
|
851
|
-
...
|
|
851
|
+
...f || {},
|
|
852
852
|
style: {
|
|
853
853
|
...t.properties.style || {},
|
|
854
|
-
...
|
|
854
|
+
...f.style || {}
|
|
855
855
|
}
|
|
856
856
|
};
|
|
857
857
|
} else
|
|
@@ -876,22 +876,22 @@ class qe extends Be {
|
|
|
876
876
|
*/
|
|
877
877
|
select(t) {
|
|
878
878
|
const r = this.getById(t);
|
|
879
|
-
r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(
|
|
879
|
+
r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(ae, r));
|
|
880
880
|
}
|
|
881
881
|
hover(t) {
|
|
882
882
|
const r = this.getById(t);
|
|
883
|
-
r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(
|
|
883
|
+
r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Pn, r));
|
|
884
884
|
}
|
|
885
885
|
getSelectedFeature() {
|
|
886
|
-
return this.selectedId ===
|
|
886
|
+
return this.selectedId === V ? null : this.getById(this.selectedId);
|
|
887
887
|
}
|
|
888
888
|
unselect() {
|
|
889
889
|
const t = this.getById(this.selectedId);
|
|
890
|
-
return t && this.emit(
|
|
890
|
+
return t && this.emit(le, t), this.selectedId = V, this.hoveredId === V && this.editor.hide(), this.layer.refresh(), this;
|
|
891
891
|
}
|
|
892
892
|
unhover() {
|
|
893
893
|
const t = this.getById(this.hoveredId);
|
|
894
|
-
return this.emit(
|
|
894
|
+
return this.emit(Nn, t), this.hoveredId = V, this.selectedId === V && this.editor.hide(), this.layer.refresh(), this;
|
|
895
895
|
}
|
|
896
896
|
/**
|
|
897
897
|
* @method remove
|
|
@@ -900,7 +900,7 @@ class qe extends Be {
|
|
|
900
900
|
*/
|
|
901
901
|
remove(t) {
|
|
902
902
|
const r = this.getById(t);
|
|
903
|
-
t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((a) => a.id !== t), r && this.emit(
|
|
903
|
+
t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((a) => a.id !== t), r && this.emit(he, r), this.layer.refresh();
|
|
904
904
|
}
|
|
905
905
|
/**
|
|
906
906
|
* @method disableDragging
|
|
@@ -950,24 +950,24 @@ class qe extends Be {
|
|
|
950
950
|
this.ogma.events.off(this._onClickMouseMove).off(this._onKeyUp), this.layer.destroy();
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
|
-
const
|
|
954
|
-
class
|
|
953
|
+
const Ie = "handle-line", Me = "handle-start", De = "handle-end";
|
|
954
|
+
class Fn extends Ue {
|
|
955
955
|
constructor(t, r = {}) {
|
|
956
956
|
super(
|
|
957
957
|
t,
|
|
958
958
|
`
|
|
959
959
|
<div class="arrow-handle">
|
|
960
|
-
<div id="${
|
|
961
|
-
<div id="${
|
|
962
|
-
<div id="${
|
|
960
|
+
<div id="${Ie}" data-handle-id="0" class="handle line"></div>
|
|
961
|
+
<div id="${Me}" data-handle-id="1" class="handle"></div>
|
|
962
|
+
<div id="${De}" data-handle-id="2" class="handle"></div>
|
|
963
963
|
</div>
|
|
964
964
|
`
|
|
965
965
|
);
|
|
966
966
|
// active handle id
|
|
967
|
-
v(this, "draggedHandle",
|
|
967
|
+
v(this, "draggedHandle", V);
|
|
968
968
|
v(this, "start", { x: 0, y: 0 });
|
|
969
969
|
v(this, "end", { x: 0, y: 0 });
|
|
970
|
-
v(this, "arrow", { ...
|
|
970
|
+
v(this, "arrow", { ...Te });
|
|
971
971
|
v(this, "startX", 0);
|
|
972
972
|
v(this, "startY", 0);
|
|
973
973
|
v(this, "minArrowHeight", 0);
|
|
@@ -975,16 +975,16 @@ class Hn extends qe {
|
|
|
975
975
|
v(this, "handles", []);
|
|
976
976
|
v(this, "onHandleMouseDown", (t) => {
|
|
977
977
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
978
|
-
r && (this.startDragging(r, t.clientX, t.clientY), this.draggedHandle =
|
|
978
|
+
r && (this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = Fe(t.target));
|
|
979
979
|
});
|
|
980
980
|
v(this, "onMouseUp", () => {
|
|
981
|
-
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle =
|
|
981
|
+
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V, this.emit(St, this.arrow));
|
|
982
982
|
});
|
|
983
983
|
v(this, "onMouseMove", (t) => {
|
|
984
|
-
if (!this.isDragging || this.draggedHandle ===
|
|
984
|
+
if (!this.isDragging || this.draggedHandle === V)
|
|
985
985
|
return;
|
|
986
|
-
const r = this.handles[this.draggedHandle], a = this.ogma.view.getAngle(), { x: h, y:
|
|
987
|
-
(g || p) &&
|
|
986
|
+
const r = this.handles[this.draggedHandle], a = this.ogma.view.getAngle(), { x: h, y: f } = new Y(t.clientX - this.startX, t.clientY - this.startY).divScalar(this.ogma.view.getZoom()).rotateRadians(a), g = r.id === Ie, p = r.id === Me, s = r.id === De;
|
|
987
|
+
(g || p) && Re(this.arrow, this.start.x + h, this.start.y + f), (g || s) && je(this.arrow, this.end.x + h, this.end.y + f), this.emit(
|
|
988
988
|
Ut,
|
|
989
989
|
this.arrow,
|
|
990
990
|
g ? "line" : p ? "start" : "end"
|
|
@@ -1002,47 +1002,47 @@ class Hn extends qe {
|
|
|
1002
1002
|
* @param y
|
|
1003
1003
|
* @param arrow
|
|
1004
1004
|
*/
|
|
1005
|
-
startDrawing(t, r, a =
|
|
1005
|
+
startDrawing(t, r, a = On(t, r, t, r, zt)) {
|
|
1006
1006
|
var g;
|
|
1007
1007
|
this.add(a), this.hoveredId = a.id;
|
|
1008
|
-
const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }),
|
|
1009
|
-
this.startDragging(this.getById(a.id), h.x + (
|
|
1008
|
+
const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), f = ((g = this.ogma.getContainer()) == null ? void 0 : g.getBoundingClientRect()) || { left: 0, top: 0 };
|
|
1009
|
+
this.startDragging(this.getById(a.id), h.x + (f == null ? void 0 : f.left), h.y + f.top), this.draggedHandle = 2;
|
|
1010
1010
|
}
|
|
1011
1011
|
cancelDrawing() {
|
|
1012
|
-
this.isDragging && (this.remove(this.arrow.id), this.emit(St, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle =
|
|
1012
|
+
this.isDragging && (this.remove(this.arrow.id), this.emit(St, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V);
|
|
1013
1013
|
}
|
|
1014
1014
|
startDragging(t, r, a) {
|
|
1015
|
-
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = a, this.start =
|
|
1015
|
+
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = a, this.start = Lt(this.arrow), this.end = Bt(this.arrow), this.disableDragging(), this.emit(Yt, this.arrow), this.isDragging = !0;
|
|
1016
1016
|
}
|
|
1017
1017
|
detect(t, r = 0) {
|
|
1018
1018
|
return this.elements.find((a) => {
|
|
1019
|
-
const { start: h, end:
|
|
1020
|
-
new
|
|
1021
|
-
), p = new
|
|
1022
|
-
return Math.abs(
|
|
1019
|
+
const { start: h, end: f } = Vt(a), g = new Y(t.x, t.y).sub(
|
|
1020
|
+
new Y((h.x + f.x) / 2, (h.y + f.y) / 2)
|
|
1021
|
+
), p = new Y(f.x, f.y).sub(new Y(h.x, h.y)), s = p.length(), d = p.normalize(), m = qe(a);
|
|
1022
|
+
return Math.abs(d.dot(g)) < s / 2 + r && Math.abs(d.rotateRadians(Math.PI / 2).dot(g)) < m / 2 + r;
|
|
1023
1023
|
});
|
|
1024
1024
|
}
|
|
1025
1025
|
refreshEditor() {
|
|
1026
1026
|
if (+this.selectedId < 0 && +this.hoveredId < 0)
|
|
1027
1027
|
return;
|
|
1028
|
-
const t = this.selectedId !==
|
|
1028
|
+
const t = this.selectedId !== V ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Vt(t), a = this.ogma.view.graphToScreenCoordinates(r.start), h = this.ogma.view.graphToScreenCoordinates(r.end), f = Math.min(this.ogma.view.getZoom(), this.maxHandleScale), [g, p, s] = Array.prototype.slice.call(
|
|
1029
1029
|
this.editor.element.querySelectorAll(".handle")
|
|
1030
1030
|
);
|
|
1031
|
-
p.style.transform = `translate(${a.x}px, ${a.y}px) translate(-50%, -50%) scale(${
|
|
1032
|
-
const
|
|
1031
|
+
p.style.transform = `translate(${a.x}px, ${a.y}px) translate(-50%, -50%) scale(${f})`, s.style.transform = `translate(${h.x}px, ${h.y}px) translate(-50%, -50%) scale(${f}`;
|
|
1032
|
+
const d = {
|
|
1033
1033
|
x: (h.x + a.x) / 2,
|
|
1034
1034
|
y: (h.y + a.y) / 2
|
|
1035
|
-
}, m = new
|
|
1036
|
-
g.style.width = `${m.length()}px`, g.style.left = `${
|
|
1035
|
+
}, m = new Y(h.x - a.x, h.y - a.y), S = m.mul(1 / m.length()), T = Math.atan2(S.y, S.x);
|
|
1036
|
+
g.style.width = `${m.length()}px`, g.style.left = `${d.x}px`, g.style.top = `${d.y}px`, g.style.transform = `translate(-50%, -50%) rotate(${T}rad)`;
|
|
1037
1037
|
}
|
|
1038
1038
|
getDefaultOptions() {
|
|
1039
|
-
return
|
|
1039
|
+
return Te;
|
|
1040
1040
|
}
|
|
1041
1041
|
draw(t) {
|
|
1042
1042
|
t.innerHTML = "";
|
|
1043
|
-
const r =
|
|
1043
|
+
const r = Ot("g"), a = this.ogma.view.getAngle();
|
|
1044
1044
|
r.setAttribute("transform", `rotate(${-a * (180 / Math.PI)})`), this.elements.forEach(
|
|
1045
|
-
(h) =>
|
|
1045
|
+
(h) => $n(h, r, zt, this.minArrowHeight, this.maxArrowHeight)
|
|
1046
1046
|
), t.appendChild(r);
|
|
1047
1047
|
}
|
|
1048
1048
|
refreshDrawing() {
|
|
@@ -1083,10 +1083,10 @@ const At = {
|
|
|
1083
1083
|
}
|
|
1084
1084
|
// position: { x: 0, y: 0 },
|
|
1085
1085
|
// size: { width: 100, height: 50 }
|
|
1086
|
-
},
|
|
1086
|
+
}, Oe = {
|
|
1087
1087
|
handleSize: 3.5,
|
|
1088
1088
|
placeholder: "Your text..."
|
|
1089
|
-
},
|
|
1089
|
+
}, qn = (u = 0, l = 0, t = 100, r = 50, a = "", h = { ...At }) => ({
|
|
1090
1090
|
id: Xt(),
|
|
1091
1091
|
type: "Feature",
|
|
1092
1092
|
properties: {
|
|
@@ -1107,11 +1107,11 @@ const At = {
|
|
|
1107
1107
|
]
|
|
1108
1108
|
}
|
|
1109
1109
|
});
|
|
1110
|
-
var
|
|
1110
|
+
var Ye = { exports: {} };
|
|
1111
1111
|
(function(u, l) {
|
|
1112
1112
|
(function(t, r) {
|
|
1113
1113
|
u.exports = r();
|
|
1114
|
-
})(
|
|
1114
|
+
})(Mn, () => (() => {
|
|
1115
1115
|
var t = { d: (e, n) => {
|
|
1116
1116
|
for (var o in n)
|
|
1117
1117
|
t.o(n, o) && !t.o(e, o) && Object.defineProperty(e, o, { enumerable: !0, get: n[o] });
|
|
@@ -1123,20 +1123,20 @@ var Ve = { exports: {} };
|
|
|
1123
1123
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1124
1124
|
}, a(e);
|
|
1125
1125
|
}
|
|
1126
|
-
t.d(r, { default: () =>
|
|
1127
|
-
var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/,
|
|
1126
|
+
t.d(r, { default: () => kn });
|
|
1127
|
+
var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, f = /\bsmall-caps\b/, g = /\b(?:italic|oblique)\b/, p = /\bbold(?:er)?\b/, s = 13.3333333, d = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
|
|
1128
1128
|
function m(e) {
|
|
1129
1129
|
var n = "", o = this;
|
|
1130
1130
|
return o.style && o.style !== "normal" && (n += o.style), o.variant && o.variant !== "normal" && (n += (n ? " " : "") + o.variant), o.weight && o.weight !== "normal" && (n += (n ? " " : "") + o.weight), o.size && (n += (n ? " " : "") + o.size + "px", o.height !== o.size && (n += "/" + o.height + "px")), o.family && (n += (n ? " " : "") + o.family), e && (n += "::" + o.baseline), e && (n += "::" + o.color), n;
|
|
1131
1131
|
}
|
|
1132
|
-
var
|
|
1132
|
+
var S = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: m, valueOf: m };
|
|
1133
1133
|
function T(e) {
|
|
1134
1134
|
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = h.exec(e);
|
|
1135
1135
|
n.family = (o[6] || "").trim();
|
|
1136
|
-
var i =
|
|
1136
|
+
var i = d[o[2]] || parseFloat(o[2]);
|
|
1137
1137
|
o[3] === "%" ? i *= 0.16 : o[3] === "em" ? i *= 16 : o[3] === "pt" && (i *= s), n.size = i;
|
|
1138
1138
|
var c = parseFloat(o[4]);
|
|
1139
|
-
if (c !== "normal" && c !== "inherit" && c ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = c * s : o[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)),
|
|
1139
|
+
if (c !== "normal" && c !== "inherit" && c ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = c * s : o[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)), f.test(o[1]) && (n.variant = "small-caps"), g.test(o[1]) && (n.style = "italic"), p.test(o[1]))
|
|
1140
1140
|
n.weight = "bold";
|
|
1141
1141
|
else {
|
|
1142
1142
|
var y = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
|
|
@@ -1144,22 +1144,22 @@ var Ve = { exports: {} };
|
|
|
1144
1144
|
}
|
|
1145
1145
|
return n;
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1148
|
-
var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, y = 14, w = 12, x = null,
|
|
1147
|
+
function b() {
|
|
1148
|
+
var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, y = 14, w = 12, x = null, E = null, k = "";
|
|
1149
1149
|
if (i && i.nodeType) {
|
|
1150
|
-
var O = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView),
|
|
1151
|
-
e =
|
|
1150
|
+
var O = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), L = O.getComputedStyle(i, null);
|
|
1151
|
+
e = L.getPropertyValue("font-family") || "", w = parseFloat(L.getPropertyValue("font-size")), y = L.getPropertyValue("line-height"), x = L.getPropertyValue("font-weight"), E = L.getPropertyValue("font-style"), k = L.getPropertyValue("font-variant") || "";
|
|
1152
1152
|
} else if (typeof i == "string") {
|
|
1153
1153
|
var I = T(i);
|
|
1154
|
-
e = I.family, w = I.size, y = I.height,
|
|
1154
|
+
e = I.family, w = I.size, y = I.height, k = I.variant, E = I.style, x = I.weight;
|
|
1155
1155
|
} else
|
|
1156
|
-
a(i) === "object" && (e = i.family, w = i.size, y = i.height,
|
|
1156
|
+
a(i) === "object" && (e = i.family, w = i.size, y = i.height, k = i.variant, x = i.weight, E = i.style, n = i.baseline, o = i.color);
|
|
1157
1157
|
c.size && c.size < 3 && (w *= c.size), y = y !== "normal" && y ? parseFloat(y) : w * (7 / 6), c.height && c.height < 3 && (y *= c.height);
|
|
1158
|
-
var z = Object.create(
|
|
1159
|
-
return z.family = c.family || e || "sans-serif", z.height = y ?? 14, z.size = w ?? 12, z.variant = c.variant ||
|
|
1158
|
+
var z = Object.create(S);
|
|
1159
|
+
return z.family = c.family || e || "sans-serif", z.height = y ?? 14, z.size = w ?? 12, z.variant = c.variant || k || "", z.style = c.style || E || "", z.weight = c.weight || x || "", z.baseline = n || 0, c.baseline != null && (z.baseline = c.baseline), z.color = c.color || o || "", z.id = m.call(z, !0), z;
|
|
1160
1160
|
}
|
|
1161
|
-
const
|
|
1162
|
-
var
|
|
1161
|
+
const D = { "\n": 0.28, "\r": 0.28, " ": 0.28, " ": 0.28, " ": 0.28, "": 0, " ": 0.5, " ": 1, " ": 0.5, " ": 1, " ": 0.33, " ": 0.25, " ": 0.16, " ": 0.56, " ": 0.28, " ": 0.2, " ": 0.15, "": 0, " ": 0.16, " ": 0.22, " ": 1, "\uFEFF": 0 };
|
|
1162
|
+
var A, $ = function(e) {
|
|
1163
1163
|
var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
|
|
1164
1164
|
if (n && n.getContext) {
|
|
1165
1165
|
var o = n.getContext("2d");
|
|
@@ -1168,29 +1168,29 @@ var Ve = { exports: {} };
|
|
|
1168
1168
|
return o.font = String(c), o.measureText(i).width;
|
|
1169
1169
|
};
|
|
1170
1170
|
}
|
|
1171
|
-
}(typeof document < "u" ? document : null) || (
|
|
1172
|
-
if (!
|
|
1173
|
-
var o =
|
|
1174
|
-
|
|
1171
|
+
}(typeof document < "u" ? document : null) || (A = {}, function(e, n) {
|
|
1172
|
+
if (!A[n]) {
|
|
1173
|
+
var o = b(n);
|
|
1174
|
+
A[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
|
|
1175
1175
|
}
|
|
1176
|
-
return e.length *
|
|
1177
|
-
}),
|
|
1178
|
-
function
|
|
1179
|
-
var i = Object.assign({},
|
|
1176
|
+
return e.length * A[n].size;
|
|
1177
|
+
}), N = {}, _ = { trim: !0, collapse: !0 };
|
|
1178
|
+
function X(e, n, o) {
|
|
1179
|
+
var i = Object.assign({}, _, o), c = String(e);
|
|
1180
1180
|
if (!c)
|
|
1181
1181
|
return 0;
|
|
1182
|
-
if (c in
|
|
1182
|
+
if (c in D) {
|
|
1183
1183
|
var y = n.id + "/" + c;
|
|
1184
|
-
return y in
|
|
1184
|
+
return y in N || (N[y] = $("_".concat(c, "_"), n) - $("__", n)), N[y];
|
|
1185
1185
|
}
|
|
1186
|
-
return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "),
|
|
1186
|
+
return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), $(c, n) + n.size * (e.tracking || 0);
|
|
1187
1187
|
}
|
|
1188
|
-
function
|
|
1189
|
-
return
|
|
1188
|
+
function W(e) {
|
|
1189
|
+
return W = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1190
1190
|
return typeof n;
|
|
1191
1191
|
} : function(n) {
|
|
1192
1192
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1193
|
-
},
|
|
1193
|
+
}, W(e);
|
|
1194
1194
|
}
|
|
1195
1195
|
function Et(e, n) {
|
|
1196
1196
|
if (typeof n != "function" && n !== null)
|
|
@@ -1202,7 +1202,7 @@ var Ve = { exports: {} };
|
|
|
1202
1202
|
return o.__proto__ = i, o;
|
|
1203
1203
|
}, kt(e, n);
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function Wt(e) {
|
|
1206
1206
|
var n = function() {
|
|
1207
1207
|
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
|
|
1208
1208
|
return !1;
|
|
@@ -1222,11 +1222,11 @@ var Ve = { exports: {} };
|
|
|
1222
1222
|
o = Reflect.construct(i, arguments, c);
|
|
1223
1223
|
} else
|
|
1224
1224
|
o = i.apply(this, arguments);
|
|
1225
|
-
return
|
|
1225
|
+
return Xe(this, o);
|
|
1226
1226
|
};
|
|
1227
1227
|
}
|
|
1228
|
-
function
|
|
1229
|
-
if (n && (
|
|
1228
|
+
function Xe(e, n) {
|
|
1229
|
+
if (n && (W(n) === "object" || typeof n == "function"))
|
|
1230
1230
|
return n;
|
|
1231
1231
|
if (n !== void 0)
|
|
1232
1232
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
@@ -1245,28 +1245,28 @@ var Ve = { exports: {} };
|
|
|
1245
1245
|
if (!(e instanceof n))
|
|
1246
1246
|
throw new TypeError("Cannot call a class as a function");
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1248
|
+
function fe(e, n) {
|
|
1249
1249
|
for (var o = 0; o < n.length; o++) {
|
|
1250
1250
|
var i = n[o];
|
|
1251
1251
|
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
|
|
1252
|
-
if (
|
|
1252
|
+
if (W(y) !== "object" || y === null)
|
|
1253
1253
|
return y;
|
|
1254
1254
|
var x = y[Symbol.toPrimitive];
|
|
1255
1255
|
if (x !== void 0) {
|
|
1256
|
-
var
|
|
1257
|
-
if (
|
|
1258
|
-
return
|
|
1256
|
+
var E = x.call(y, w);
|
|
1257
|
+
if (W(E) !== "object")
|
|
1258
|
+
return E;
|
|
1259
1259
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1260
1260
|
}
|
|
1261
1261
|
return String(y);
|
|
1262
|
-
}(i.key, "string"),
|
|
1262
|
+
}(i.key, "string"), W(c) === "symbol" ? c : String(c)), i);
|
|
1263
1263
|
}
|
|
1264
1264
|
var c;
|
|
1265
1265
|
}
|
|
1266
1266
|
function Pt(e, n, o) {
|
|
1267
|
-
return n &&
|
|
1267
|
+
return n && fe(e.prototype, n), o && fe(e, o), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1268
1268
|
}
|
|
1269
|
-
var
|
|
1269
|
+
var R = function() {
|
|
1270
1270
|
function e() {
|
|
1271
1271
|
var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
1272
1272
|
$t(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
|
|
@@ -1281,41 +1281,41 @@ var Ve = { exports: {} };
|
|
|
1281
1281
|
} }]), e;
|
|
1282
1282
|
}(), Tt = function(e) {
|
|
1283
1283
|
Et(o, e);
|
|
1284
|
-
var n =
|
|
1284
|
+
var n = Wt(o);
|
|
1285
1285
|
function o() {
|
|
1286
1286
|
return $t(this, o), n.apply(this, arguments);
|
|
1287
1287
|
}
|
|
1288
1288
|
return Pt(o);
|
|
1289
|
-
}(
|
|
1289
|
+
}(R), nt = function(e) {
|
|
1290
1290
|
Et(o, e);
|
|
1291
|
-
var n =
|
|
1291
|
+
var n = Wt(o);
|
|
1292
1292
|
function o() {
|
|
1293
1293
|
return $t(this, o), n.apply(this, arguments);
|
|
1294
1294
|
}
|
|
1295
1295
|
return Pt(o);
|
|
1296
|
-
}(
|
|
1296
|
+
}(R), pt = function(e) {
|
|
1297
1297
|
Et(o, e);
|
|
1298
|
-
var n =
|
|
1298
|
+
var n = Wt(o);
|
|
1299
1299
|
function o() {
|
|
1300
1300
|
return $t(this, o), n.apply(this, arguments);
|
|
1301
1301
|
}
|
|
1302
1302
|
return Pt(o);
|
|
1303
|
-
}(
|
|
1303
|
+
}(R), Gt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, We = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, pe = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Ge = /^(?:[;\xAD%?…]|,(?!\d))/, Ze = /^[´±°¢£¤$¥\u2212]/;
|
|
1304
1304
|
function Nt(e, n) {
|
|
1305
1305
|
n !== !1 && (e = e.trim());
|
|
1306
|
-
for (var o, i, c = [], y = e.charAt(0), w = 0, x = 1,
|
|
1306
|
+
for (var o, i, c = [], y = e.charAt(0), w = 0, x = 1, E = e.length; x < E; x++) {
|
|
1307
1307
|
o = e.charAt(x), i = e.charAt(x + 1);
|
|
1308
|
-
var
|
|
1309
|
-
if ((
|
|
1308
|
+
var k = Gt.test(y), O = Gt.test(o), L = O || k, I = void 0;
|
|
1309
|
+
if ((Ze.test(o) && !pe.test(y) || Ge.test(y + i) && !pe.test(o)) && (L = !0), y !== "-" && y !== "‐" && y !== "–" && y !== "—" || ((I = Gt.test(e.charAt(x - 2))) && !O && (L = !1), !I && We.test(o + i) && (L = !0)), L) {
|
|
1310
1310
|
var z = e.slice(w, x);
|
|
1311
|
-
/\u00AD$/.test(z) ? (c.push(new
|
|
1311
|
+
/\u00AD$/.test(z) ? (c.push(new R(z.slice(0, -1))), c.push(new pt())) : (c.push(new R(z)), c.push(new Tt())), w = x;
|
|
1312
1312
|
}
|
|
1313
1313
|
y = o;
|
|
1314
1314
|
}
|
|
1315
|
-
return c.push(new
|
|
1315
|
+
return c.push(new R(e.slice(w))), c;
|
|
1316
1316
|
}
|
|
1317
|
-
const
|
|
1318
|
-
var
|
|
1317
|
+
const ge = { nbsp: " ", iexcl: "¡", cent: "¢", pound: "£", curren: "¤", yen: "¥", brvbar: "¦", sect: "§", uml: "¨", copy: "©", ordf: "ª", laquo: "«", not: "¬", shy: "", reg: "®", macr: "¯", deg: "°", plusmn: "±", sup2: "²", sup3: "³", acute: "´", micro: "µ", para: "¶", middot: "·", cedil: "¸", sup1: "¹", ordm: "º", raquo: "»", frac14: "¼", frac12: "½", frac34: "¾", iquest: "¿", Agrave: "À", Aacute: "Á", Acirc: "Â", Atilde: "Ã", Auml: "Ä", Aring: "Å", AElig: "Æ", Ccedil: "Ç", Egrave: "È", Eacute: "É", Ecirc: "Ê", Euml: "Ë", Igrave: "Ì", Iacute: "Í", Icirc: "Î", Iuml: "Ï", ETH: "Ð", Ntilde: "Ñ", Ograve: "Ò", Oacute: "Ó", Ocirc: "Ô", Otilde: "Õ", Ouml: "Ö", times: "×", Oslash: "Ø", Ugrave: "Ù", Uacute: "Ú", Ucirc: "Û", Uuml: "Ü", Yacute: "Ý", THORN: "Þ", szlig: "ß", agrave: "à", aacute: "á", acirc: "â", atilde: "ã", auml: "ä", aring: "å", aelig: "æ", ccedil: "ç", egrave: "è", eacute: "é", ecirc: "ê", euml: "ë", igrave: "ì", iacute: "í", icirc: "î", iuml: "ï", eth: "ð", ntilde: "ñ", ograve: "ò", oacute: "ó", ocirc: "ô", otilde: "õ", ouml: "ö", divide: "÷", oslash: "ø", ugrave: "ù", uacute: "ú", ucirc: "û", uuml: "ü", yacute: "ý", thorn: "þ", yuml: "ÿ", fnof: "ƒ", Alpha: "Α", Beta: "Β", Gamma: "Γ", Delta: "Δ", Epsilon: "Ε", Zeta: "Ζ", Eta: "Η", Theta: "Θ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Xi: "Ξ", Omicron: "Ο", Pi: "Π", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Upsilon: "Υ", Phi: "Φ", Chi: "Χ", Psi: "Ψ", Omega: "Ω", alpha: "α", beta: "β", gamma: "γ", delta: "δ", epsilon: "ε", zeta: "ζ", eta: "η", theta: "θ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", xi: "ξ", omicron: "ο", pi: "π", rho: "ρ", sigmaf: "ς", sigma: "σ", tau: "τ", upsilon: "υ", phi: "φ", chi: "χ", psi: "ψ", omega: "ω", thetasym: "ϑ", upsih: "ϒ", piv: "ϖ", bull: "•", hellip: "…", prime: "′", Prime: "″", oline: "‾", frasl: "⁄", weierp: "℘", image: "ℑ", real: "ℜ", trade: "™", alefsym: "ℵ", larr: "←", uarr: "↑", rarr: "→", darr: "↓", harr: "↔", crarr: "↵", lArr: "⇐", uArr: "⇑", rArr: "⇒", dArr: "⇓", hArr: "⇔", forall: "∀", part: "∂", exist: "∃", empty: "∅", nabla: "∇", isin: "∈", notin: "∉", ni: "∋", prod: "∏", sum: "∑", minus: "−", lowast: "∗", radic: "√", prop: "∝", infin: "∞", ang: "∠", and: "⊥", or: "⊦", cap: "∩", cup: "∪", int: "∫", there4: "∴", sim: "∼", cong: "≅", asymp: "≈", ne: "≠", equiv: "≡", le: "≤", ge: "≥", sub: "⊂", sup: "⊃", nsub: "⊄", sube: "⊆", supe: "⊇", oplus: "⊕", otimes: "⊗", perp: "⊥", sdot: "⋅", lceil: "⌈", rceil: "⌉", lfloor: "⌊", rfloor: "⌋", lang: "〈", rang: "〉", loz: "◊", spades: "♠", clubs: "♣", hearts: "♥", diams: "♦", quot: '"', amp: "&", lt: "<", gt: ">", OElig: "Œ", oelig: "œ", Scaron: "Š", scaron: "š", Yuml: "Ÿ", circ: "ˆ", tilde: "˜", ensp: " ", emsp: " ", thinsp: " ", zwnj: "", zwj: "", lrm: "", rlm: "", ndash: "–", mdash: "—", lsquo: "‘", rsquo: "’", sbquo: "‚", ldquo: "“", rdquo: "”", bdquo: "„", dagger: "†", Dagger: "‡", permil: "‰", lsaquo: "‹", rsaquo: "›" };
|
|
1318
|
+
var Ke = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, Je = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Qe = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, tn = /^<!--(.+?)-->/, en = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, ye = { b: function(e) {
|
|
1319
1319
|
e.weight = "bold";
|
|
1320
1320
|
}, strong: function(e) {
|
|
1321
1321
|
e.weight = "bold";
|
|
@@ -1341,26 +1341,26 @@ var Ve = { exports: {} };
|
|
|
1341
1341
|
e.sub = !0;
|
|
1342
1342
|
}, sup: function(e) {
|
|
1343
1343
|
e.sup = !0;
|
|
1344
|
-
} },
|
|
1345
|
-
function
|
|
1346
|
-
return e.replace(
|
|
1344
|
+
} }, nn = { div: 1, li: 1, blockquote: 2, h1: 2, h2: 2, h3: 2, h4: 2, h5: 2, h6: 2, ul: 2, ol: 2, hr: 2, p: 2 };
|
|
1345
|
+
function me(e) {
|
|
1346
|
+
return e.replace(en, function(n, o, i, c) {
|
|
1347
1347
|
if (o || i) {
|
|
1348
1348
|
var y = o ? 10 : 16;
|
|
1349
1349
|
return String.fromCharCode(parseInt(o || i, y));
|
|
1350
1350
|
}
|
|
1351
|
-
return c in
|
|
1351
|
+
return c in ge ? ge[c] : n;
|
|
1352
1352
|
});
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1354
|
+
function rn(e) {
|
|
1355
1355
|
return e && e.length > 1 && (e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'") ? e.slice(1, -1) : e;
|
|
1356
1356
|
}
|
|
1357
|
-
var
|
|
1358
|
-
function
|
|
1357
|
+
var sn = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
|
|
1358
|
+
function on(e) {
|
|
1359
1359
|
var n, o = {};
|
|
1360
1360
|
if (e) {
|
|
1361
1361
|
do
|
|
1362
|
-
if (n =
|
|
1363
|
-
var i =
|
|
1362
|
+
if (n = sn.exec(e)) {
|
|
1363
|
+
var i = me(rn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
|
|
1364
1364
|
if (o[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0]))
|
|
1365
1365
|
throw new Error("Attribute error");
|
|
1366
1366
|
}
|
|
@@ -1370,8 +1370,8 @@ var Ve = { exports: {} };
|
|
|
1370
1370
|
}
|
|
1371
1371
|
return o;
|
|
1372
1372
|
}
|
|
1373
|
-
const
|
|
1374
|
-
var
|
|
1373
|
+
const ve = { copyright: "©", textcopyright: "©", dag: "†", textdagger: "†", ddag: "‡", textdaggerdbl: "‡", guillemotleft: "«", guillemotright: "»", guilsinglleft: "‹", guilsinglright: "›", ldots: "…", dots: "…", textellipsis: "…", lq: "‘", P: "¶", textparagraph: "¶", pounds: "£", textsterling: "£", quotedblbase: "„", quotesinglbase: "‚", rq: "’", S: "§", sim: "~", textasciicircum: "^", textasciitilde: "˜", texttildelow: "~", textasteriskcentered: "*", textbackslash: "'", textbar: "|", textbardbl: "╎", textbigcircle: "◯", textbraceleft: "{", textbraceright: "}", textbullet: "•", textdollar: "$", textemdash: "—", textendash: "—", texteuro: "€", eurosym: "€", euro: "€", textexclamdown: "¡", textgreater: ">", textless: "<", textordfeminine: "ª", textordmasculine: "º", textperiodcentered: "·", cdot: "·", textquestiondown: "¿", textquotedblleft: "“", textquotedblright: "”", textquoteleft: "‘", textquoteright: "’", textquotestraightbase: "‚", textquotestraightdblbase: "„", textregistered: "®", textthreequartersemdash: "-", texttrademark: "™", texttwelveudash: "-", textunderscore: "_", textvisiblespace: "␣", gets: "←", textleftarrow: "←", to: "→", textrightarrow: "→", textdegree: "°", infty: "∞", triangle: "△", triangledown: "▽", blacktriangle: "▲", blacktriangledown: "▼", angle: "∠", sphericalangle: "∢", aleph: "ℵ", hbar: "ħ", imath: "𝚤", jmath: "𝚥", ell: "ℓ", wp: "℘", Re: "ℜ", Im: "ℑ", mho: "℧", prime: "′", emptyset: "∅", nabla: "∇", surd: "√", partial: "∂", top: "⟙", bot: "⟂", vdash: "⟝", dashv: "⟞", forall: "∀", exists: "∃", nexists: "∄", neg: "¬", lnot: "¬", flat: "♭", natural: "♮", sharp: "♯", backslash: "\\", Box: "□", Diamond: "♢", clubsuit: "♣", diamondsuit: "♦", heartsuit: "♥", spadesuit: "♠", Join: "⨝", blacksquare: "■", bigstar: "★", diagdown: "╲", diagup: "╱", blacklozenge: "⧫", rfloor: "⌋", lfloor: "⌊", rceil: "⌉", lceil: "⌈", rangle: "⟩", langle: "⟨", sum: "∑", int: "∫", oint: "∮", prod: "∏", coprod: "∏", bigcap: "∩", bigcup: "∪", bigsqcup: "⊔", bigvee: "∨", bigwedge: "∧", bigodot: "⊙", bigotimes: "⊗", bigoplus: "⊕", biguplus: "⊎", alpha: "α", beta: "β", chi: "χ", delta: "δ", epsilon: "ε", eta: "η", gamma: "γ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", omega: "ω", phi: "φ", pi: "π", psi: "ψ", rho: "ρ", sigma: "σ", tau: "τ", theta: "θ", upsilon: "υ", xi: "ξ", zeta: "ζ", Alpha: "Α", Beta: "Β", Chi: "Χ", Delta: "Δ", Epsilon: "Ε", Eta: "Η", Gamma: "Γ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Omega: "Ω", Phi: "Φ", Pi: "Π", Psi: "Ψ", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Theta: "Θ", Upsilon: "Υ", Xi: "Ξ", Zeta: "Ζ", aa: "å", AA: "Å", ae: "æ", AE: "Æ", dh: "ð", DH: "Ð", dj: "đ", DJ: "Đ", ij: "ij", IJ: "IJ", l: "ł", L: "Ł", ng: "ŋ", NG: "Ŋ", o: "ø", O: "Ø", oe: "œ", OE: "Œ", ss: "ß", SS: "SS", th: "þ", TH: "Þ" };
|
|
1374
|
+
var an = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, ln = /^%[^\n]+(?:\n|$)/, hn = /^[^#$%&~_^\\{}]+/, cn = /^\\([&{}$%#_])/, un = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, dn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, U = { bf: function(e) {
|
|
1375
1375
|
e.weight = "bold";
|
|
1376
1376
|
}, it: function(e) {
|
|
1377
1377
|
e.style = "italic";
|
|
@@ -1390,115 +1390,115 @@ var Ve = { exports: {} };
|
|
|
1390
1390
|
}, newline: function(e) {
|
|
1391
1391
|
this.tokens.push(new nt());
|
|
1392
1392
|
}, url: function(e, n) {
|
|
1393
|
-
this.open_context().href = n, this.add_token(new
|
|
1393
|
+
this.open_context().href = n, this.add_token(new R(n)), this.close_context();
|
|
1394
1394
|
} };
|
|
1395
|
-
|
|
1396
|
-
var
|
|
1397
|
-
function
|
|
1395
|
+
U.textsuperscript = U["^"], U.textsubscript = U._, U.textsl = U.sl, U.mathbf = U.bf, U.mathit = U.it, U.textbf = U.bf, U.textit = U.it, U.textcolor = U.color;
|
|
1396
|
+
var fn = /[\r\n\xA0]+/g;
|
|
1397
|
+
function pn(e, n) {
|
|
1398
1398
|
e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
|
|
1399
1399
|
var o = n;
|
|
1400
|
-
return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o =
|
|
1400
|
+
return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = b(n, e)), o;
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1402
|
+
function xe(e, n, o) {
|
|
1403
1403
|
for (var i, c, y = e.width; y + o.width > n && e.length; )
|
|
1404
|
-
c = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width =
|
|
1405
|
-
e[e.length - 1] instanceof pt && e.pop(), i = e[e.length - 1] || i || {}, o.font =
|
|
1404
|
+
c = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = X(i, i.font), y += i.width) : e.pop(), y -= c;
|
|
1405
|
+
e[e.length - 1] instanceof pt && e.pop(), i = e[e.length - 1] || i || {}, o.font = b(o.font, i.bold, i.italic, ""), o.href = e.length ? i.href : null, o.rel = e.length ? i.rel : null, o.target = e.length ? i.target : null, e.push(o);
|
|
1406
1406
|
}
|
|
1407
1407
|
function vt(e) {
|
|
1408
1408
|
return Math.round(1e6 * e) / 1e6;
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1410
|
+
function we(e) {
|
|
1411
1411
|
return function(n) {
|
|
1412
1412
|
if (Array.isArray(n))
|
|
1413
|
-
return
|
|
1413
|
+
return Zt(n);
|
|
1414
1414
|
}(e) || function(n) {
|
|
1415
1415
|
if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null)
|
|
1416
1416
|
return Array.from(n);
|
|
1417
1417
|
}(e) || function(n, o) {
|
|
1418
1418
|
if (n) {
|
|
1419
1419
|
if (typeof n == "string")
|
|
1420
|
-
return
|
|
1420
|
+
return Zt(n, o);
|
|
1421
1421
|
var i = Object.prototype.toString.call(n).slice(8, -1);
|
|
1422
|
-
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) ?
|
|
1422
|
+
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) ? Zt(n, o) : void 0;
|
|
1423
1423
|
}
|
|
1424
1424
|
}(e) || function() {
|
|
1425
1425
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1426
1426
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1427
1427
|
}();
|
|
1428
1428
|
}
|
|
1429
|
-
function
|
|
1429
|
+
function Zt(e, n) {
|
|
1430
1430
|
(n == null || n > e.length) && (n = e.length);
|
|
1431
1431
|
for (var o = 0, i = new Array(n); o < n; o++)
|
|
1432
1432
|
i[o] = e[o];
|
|
1433
1433
|
return i;
|
|
1434
1434
|
}
|
|
1435
|
-
var
|
|
1435
|
+
var gn = { center: "middle", right: "end" }, yn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, Kt = function(e, n) {
|
|
1436
1436
|
return !e && !n || e === n;
|
|
1437
1437
|
};
|
|
1438
|
-
function
|
|
1438
|
+
function mn(e, n) {
|
|
1439
1439
|
var o = [], i = n.font(), c = i.size, y = i.family, w = n.align(), x = n.createElement();
|
|
1440
1440
|
if (e.length) {
|
|
1441
|
-
var
|
|
1442
|
-
if (
|
|
1443
|
-
var
|
|
1444
|
-
Q += (O *
|
|
1441
|
+
var E = i.height, k = n.valign(), O = n.height()(), L = n.width()(0), I = !isFinite(L) && e.length === 1, z = I ? null : n.x(), j = vt(E / c), Q = I ? null : vt(E / (1.15 * c + (E - c) / 2));
|
|
1442
|
+
if (yn[k] && isFinite(O)) {
|
|
1443
|
+
var P = k === "bottom" ? 1 : 0.5;
|
|
1444
|
+
Q += (O * P - E * e.length * P) / c;
|
|
1445
1445
|
}
|
|
1446
|
-
var
|
|
1447
|
-
w === "right" ?
|
|
1448
|
-
for (var
|
|
1449
|
-
if (
|
|
1450
|
-
var gt = x(tt,
|
|
1451
|
-
|
|
1446
|
+
var C = w === "justify", F = 0;
|
|
1447
|
+
w === "right" ? F = L : w === "center" && (F = L / 2);
|
|
1448
|
+
for (var H = [], tt = "tspan", G = null, q = "", M = function() {
|
|
1449
|
+
if (q) {
|
|
1450
|
+
var gt = x(tt, G, q);
|
|
1451
|
+
H.push(gt);
|
|
1452
1452
|
}
|
|
1453
|
-
tt = "tspan",
|
|
1453
|
+
tt = "tspan", G = null, q = "";
|
|
1454
1454
|
}, it = 0, et = e.length; it < et; it++) {
|
|
1455
1455
|
var at = "", dt = "", st = 0, lt = e[it];
|
|
1456
1456
|
if (lt.length) {
|
|
1457
|
-
|
|
1458
|
-
for (var xt = 0,
|
|
1459
|
-
var B = lt[
|
|
1460
|
-
B.whitespace && xt++,
|
|
1457
|
+
H = [];
|
|
1458
|
+
for (var xt = 0, Mt = 0, ht = void 0, Z = 0, Ht = lt.length; Z < Ht; Z++) {
|
|
1459
|
+
var B = lt[Z], K = B.font;
|
|
1460
|
+
B.whitespace && xt++, Mt += B.width, Z && !B.tracking && !st && Kt(K.id, at) && Kt(B.class, dt) && Kt(ht, B.href) ? q += B.value : (M(), q = B.value, G = { fontFamily: K.family !== y ? K.family : null, fontSize: K.size !== c ? K.size : null, fontWeight: K.weight || null, fontStyle: K.style || null, fontVariant: K.variant !== "normal" && K.variant || null, fill: K.color || null, baselineShift: K.baseline ? 100 * K.baseline + "%" : null, className: B.class || null }, st && (G.dx = vt(st), st = 0), B.tracking && (st = K.size * B.tracking), B.href && !ht ? (ht = B.href, tt = "a", G.href = ht, G.rel = B.rel, G.target = B.target) : ht = null, at = K.id, dt = B.class);
|
|
1461
1461
|
}
|
|
1462
|
-
if (
|
|
1463
|
-
o.push.apply(o,
|
|
1462
|
+
if (M(), I)
|
|
1463
|
+
o.push.apply(o, we(H));
|
|
1464
1464
|
else {
|
|
1465
|
-
var
|
|
1466
|
-
|
|
1465
|
+
var Rt = null, Dt = it === et - 1 || lt[lt.length - 1] instanceof nt;
|
|
1466
|
+
C && lt.length > 1 && !Dt && (Rt = vt((L - Mt) / xt)), o.push(x.apply(void 0, ["tspan", { wordSpacing: Rt, x: z(it) + F, dy: vt(it ? j : Q) + "em" }].concat(we(H))));
|
|
1467
1467
|
}
|
|
1468
1468
|
} else
|
|
1469
|
-
o.push(x("tspan", { x: z(it), dy: vt(it ?
|
|
1469
|
+
o.push(x("tspan", { x: z(it), dy: vt(it ? j : Q) + "em" }, " "));
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
return x.apply(void 0, ["text", { fontFamily: y, fontSize: c, textAnchor:
|
|
1472
|
+
return x.apply(void 0, ["text", { fontFamily: y, fontSize: c, textAnchor: gn[w] || "start" }].concat(o));
|
|
1473
1473
|
}
|
|
1474
|
-
var
|
|
1475
|
-
function
|
|
1474
|
+
var vn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
|
|
1475
|
+
function xn(e, n, o) {
|
|
1476
1476
|
if (e.length) {
|
|
1477
1477
|
o.textBaseline = "middle";
|
|
1478
|
-
var i = n.font(), c = i.height, y = i.size, w = n.valign(), x = n.height()(),
|
|
1478
|
+
var i = n.font(), c = i.height, y = i.size, w = n.valign(), x = n.height()(), E = n.width()(0), k = n.align(), O = k === "justify", L = 0.5 * c, I = vn[w];
|
|
1479
1479
|
if (I && isFinite(x)) {
|
|
1480
1480
|
var z = e.length * c;
|
|
1481
|
-
|
|
1481
|
+
L += x * I - z * I;
|
|
1482
1482
|
}
|
|
1483
|
-
e.forEach(function(
|
|
1484
|
-
var
|
|
1485
|
-
|
|
1486
|
-
|
|
1483
|
+
e.forEach(function(j, Q) {
|
|
1484
|
+
var P = n.x()(Q), C = Q * c + L, F = 0, H = 0;
|
|
1485
|
+
j.forEach(function(q) {
|
|
1486
|
+
q.whitespace && F++, H += q.width;
|
|
1487
1487
|
});
|
|
1488
|
-
var tt = 0,
|
|
1489
|
-
O &&
|
|
1490
|
-
o.font =
|
|
1491
|
-
var
|
|
1488
|
+
var tt = 0, G = Q === e.length - 1 || j[j.length - 1] instanceof nt;
|
|
1489
|
+
O && j.length > 1 && !G && (tt = (E - H) / F), j.forEach(function(q) {
|
|
1490
|
+
o.font = q.font;
|
|
1491
|
+
var M = q.font, it = M.baseline ? y * -M.baseline + 0.15 * y : 0;
|
|
1492
1492
|
o.fillStyle = function(dt, st) {
|
|
1493
1493
|
return dt.color ? dt.color : st.href ? "#00C" : "#000";
|
|
1494
|
-
}(
|
|
1494
|
+
}(M, q);
|
|
1495
1495
|
var et = 0;
|
|
1496
|
-
if (
|
|
1496
|
+
if (k === "right" ? et += E - H : k === "center" ? et += E / 2 - H / 2 : k === "justify" && (q.whitespace || q instanceof nt) && (P += tt), o.fillText(q.value, P + et, C + it), q.href) {
|
|
1497
1497
|
o.beginPath(), o.strokeStyle = o.fillStyle;
|
|
1498
|
-
var at = Math.floor(
|
|
1499
|
-
o.moveTo(
|
|
1498
|
+
var at = Math.floor(C + 0.45 * y) + 0.5;
|
|
1499
|
+
o.moveTo(P + et, at), o.lineTo(P + et + q.width, at), o.stroke();
|
|
1500
1500
|
}
|
|
1501
|
-
|
|
1501
|
+
P += q.width;
|
|
1502
1502
|
});
|
|
1503
1503
|
});
|
|
1504
1504
|
}
|
|
@@ -1510,39 +1510,39 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1510
1510
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1511
1511
|
}, Jt(e);
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1513
|
+
function be(e) {
|
|
1514
1514
|
for (var n = {}, o = 0; o < e.length; o++) {
|
|
1515
1515
|
var i = e[o];
|
|
1516
1516
|
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));
|
|
1517
1517
|
}
|
|
1518
1518
|
return n;
|
|
1519
1519
|
}
|
|
1520
|
-
function
|
|
1521
|
-
return
|
|
1520
|
+
function _t(e) {
|
|
1521
|
+
return _t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1522
1522
|
return typeof n;
|
|
1523
1523
|
} : function(n) {
|
|
1524
1524
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1525
|
-
},
|
|
1525
|
+
}, _t(e);
|
|
1526
1526
|
}
|
|
1527
|
-
function
|
|
1527
|
+
function wn(e, n) {
|
|
1528
1528
|
for (var o = 0; o < n.length; o++) {
|
|
1529
1529
|
var i = n[o];
|
|
1530
1530
|
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
|
|
1531
|
-
if (
|
|
1531
|
+
if (_t(y) !== "object" || y === null)
|
|
1532
1532
|
return y;
|
|
1533
1533
|
var x = y[Symbol.toPrimitive];
|
|
1534
1534
|
if (x !== void 0) {
|
|
1535
|
-
var
|
|
1536
|
-
if (
|
|
1537
|
-
return
|
|
1535
|
+
var E = x.call(y, w);
|
|
1536
|
+
if (_t(E) !== "object")
|
|
1537
|
+
return E;
|
|
1538
1538
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1539
1539
|
}
|
|
1540
1540
|
return String(y);
|
|
1541
|
-
}(i.key, "string"),
|
|
1541
|
+
}(i.key, "string"), _t(c) === "symbol" ? c : String(c)), i);
|
|
1542
1542
|
}
|
|
1543
1543
|
var c;
|
|
1544
1544
|
}
|
|
1545
|
-
var
|
|
1545
|
+
var bn = b(), Qt = function(e) {
|
|
1546
1546
|
return typeof e == "function" ? e : function() {
|
|
1547
1547
|
return e;
|
|
1548
1548
|
};
|
|
@@ -1563,80 +1563,80 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1563
1563
|
}
|
|
1564
1564
|
var n, o;
|
|
1565
1565
|
return n = e, o = [{ key: "linebreak", value: function(i) {
|
|
1566
|
-
var c = this, y = this.props.parser(String(i)), w = this.font(), x = function(
|
|
1567
|
-
if (!
|
|
1566
|
+
var c = this, y = this.props.parser(String(i)), w = this.font(), x = function(E, k, O) {
|
|
1567
|
+
if (!E.length)
|
|
1568
1568
|
return [];
|
|
1569
|
-
var
|
|
1570
|
-
if (!
|
|
1569
|
+
var L = k.height(), I = k.width(), z = k.overflowLine(), j = k.overflowWrap(), Q = b(O, !0, !1), P = isFinite(L()) ? Math.floor(L() / O.height) : 1 / 0;
|
|
1570
|
+
if (!L() && !I(0) || !P)
|
|
1571
1571
|
return [];
|
|
1572
|
-
for (var
|
|
1573
|
-
var
|
|
1574
|
-
if (
|
|
1575
|
-
if (
|
|
1576
|
-
|
|
1577
|
-
else if (
|
|
1578
|
-
|
|
1579
|
-
else if (
|
|
1580
|
-
|
|
1581
|
-
else if (
|
|
1572
|
+
for (var C = 0, F = 0, H = 0, tt = [], G = [], q = !1; C < E.length && F < P; ) {
|
|
1573
|
+
var M = E[C], it = pn(M, O);
|
|
1574
|
+
if (M.width = X(M, it), M.font = it, M.line = F, M.whitespace = M.value in D, M.value && (M.value = M.value.replace(fn, " ")), !(!H && M.whitespace || q && M.whitespace))
|
|
1575
|
+
if (M instanceof nt)
|
|
1576
|
+
H = 0, G = [], tt.push(C + 1), F++;
|
|
1577
|
+
else if (M instanceof Tt || M instanceof pt)
|
|
1578
|
+
G.push({ index: C, width: H });
|
|
1579
|
+
else if (M.whitespace || H + M.width < I(F))
|
|
1580
|
+
H += M.width;
|
|
1581
|
+
else if (G.length) {
|
|
1582
1582
|
var et = void 0, at = void 0;
|
|
1583
1583
|
do {
|
|
1584
|
-
at = !0, et =
|
|
1585
|
-
var dt =
|
|
1586
|
-
dt instanceof pt && (st =
|
|
1584
|
+
at = !0, et = G.pop();
|
|
1585
|
+
var dt = E[et.index], st = void 0;
|
|
1586
|
+
dt instanceof pt && (st = X("-", dt.font), et.width + st > I(F) && (at = !G.length));
|
|
1587
1587
|
} while (!at);
|
|
1588
|
-
tt.push(et.index + 1),
|
|
1589
|
-
} else if (
|
|
1590
|
-
var lt = I(
|
|
1591
|
-
if (
|
|
1592
|
-
var xt =
|
|
1588
|
+
tt.push(et.index + 1), H = 0, F++, C = et.index, G = [];
|
|
1589
|
+
} else if (j === "break-word") {
|
|
1590
|
+
var lt = I(F);
|
|
1591
|
+
if (H + M.width > lt) {
|
|
1592
|
+
var xt = M.clone();
|
|
1593
1593
|
do
|
|
1594
|
-
|
|
1595
|
-
while (
|
|
1596
|
-
xt.value = xt.value.slice(
|
|
1594
|
+
M.value = M.value.slice(0, -1), M.width = X(M, M.font), H += M.width;
|
|
1595
|
+
while (M.value && M.width > lt);
|
|
1596
|
+
xt.value = xt.value.slice(M.value.length), E.splice(C + 1, 0, new Tt(), xt);
|
|
1597
1597
|
}
|
|
1598
|
-
tt.push(
|
|
1598
|
+
tt.push(C + 1), H = 0, F++;
|
|
1599
1599
|
} else
|
|
1600
|
-
|
|
1601
|
-
|
|
1600
|
+
H += M.width;
|
|
1601
|
+
C++, q = M.whitespace;
|
|
1602
1602
|
}
|
|
1603
|
-
|
|
1604
|
-
var
|
|
1605
|
-
for (var J, yt =
|
|
1603
|
+
C !== tt[tt.length - 1] && tt.push(C);
|
|
1604
|
+
var Mt = 0, ht = 0, Z = tt.map(function(gt) {
|
|
1605
|
+
for (var J, yt = Mt; (J = E[yt]) && (J.whitespace || !J.value); )
|
|
1606
1606
|
yt++;
|
|
1607
|
-
for (var ft = gt, ne = null; ft > yt && (J =
|
|
1607
|
+
for (var ft = gt, ne = null; ft > yt && (J = E[ft - 1]) && (J.whitespace || !(J.value || J instanceof pt)); )
|
|
1608
1608
|
J instanceof nt && (ne = J), ft--;
|
|
1609
|
-
J instanceof pt && (J.value = "-", J.width =
|
|
1610
|
-
var wt =
|
|
1609
|
+
J instanceof pt && (J.value = "-", J.width = X("-", J.font)), Mt = gt;
|
|
1610
|
+
var wt = E.slice(yt, ft).filter(function(ie) {
|
|
1611
1611
|
return ie.value;
|
|
1612
1612
|
});
|
|
1613
|
-
return ne && wt.push(ne), wt.width = wt.reduce(function(ie,
|
|
1614
|
-
return ie +
|
|
1613
|
+
return ne && wt.push(ne), wt.width = wt.reduce(function(ie, Tn) {
|
|
1614
|
+
return ie + Tn.width;
|
|
1615
1615
|
}, 0), wt.width > ht && (ht = wt.width), wt;
|
|
1616
1616
|
});
|
|
1617
|
-
if (
|
|
1618
|
-
var
|
|
1619
|
-
|
|
1617
|
+
if (Z.hasLineOverflow = !1, z) {
|
|
1618
|
+
var Ht = z === "ellipsis" ? "…" : z;
|
|
1619
|
+
Z.forEach(function(gt, J) {
|
|
1620
1620
|
var yt = I(J);
|
|
1621
1621
|
if (gt.width > yt) {
|
|
1622
|
-
var ft = new
|
|
1623
|
-
ft.font = O, ft.width =
|
|
1622
|
+
var ft = new R(Ht);
|
|
1623
|
+
ft.font = O, ft.width = X(Ht, Q), xe(gt, yt, ft), Z.hasLineOverflow = !0;
|
|
1624
1624
|
}
|
|
1625
1625
|
});
|
|
1626
1626
|
}
|
|
1627
|
-
var B =
|
|
1628
|
-
if (B &&
|
|
1629
|
-
var K = I(
|
|
1630
|
-
|
|
1627
|
+
var B = k.overflow() === "ellipsis" ? "…" : k.overflow();
|
|
1628
|
+
if (B && C !== E.length) {
|
|
1629
|
+
var K = I(Z.length - 1), Rt = Z[Z.length - 1], Dt = new R(B);
|
|
1630
|
+
Dt.font = O, Dt.width = X(B, Q), xe(Rt, K, Dt), Z.hasOverflow = !0;
|
|
1631
1631
|
} else
|
|
1632
|
-
|
|
1633
|
-
return
|
|
1632
|
+
Z.hasOverflow = !1;
|
|
1633
|
+
return Z.font = O, Z.width = ht, Z;
|
|
1634
1634
|
}(y, this, w);
|
|
1635
|
-
return x.height = x.length * w.height, x.render = function(
|
|
1636
|
-
return c.render(x,
|
|
1635
|
+
return x.height = x.length * w.height, x.render = function(E) {
|
|
1636
|
+
return c.render(x, E);
|
|
1637
1637
|
}, x.svg = x.render, x.draw = x.render, x;
|
|
1638
1638
|
} }, { key: "font", value: function(i) {
|
|
1639
|
-
return arguments.length ? (this.props.font =
|
|
1639
|
+
return arguments.length ? (this.props.font = b(i), this) : this.props.font || b(bn);
|
|
1640
1640
|
} }, { key: "overflow", value: function(i) {
|
|
1641
1641
|
return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
|
|
1642
1642
|
} }, { key: "overflowLine", value: function(i) {
|
|
@@ -1672,16 +1672,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1672
1672
|
} }, { key: "createElement", value: function(i) {
|
|
1673
1673
|
return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
|
|
1674
1674
|
} }, { key: "render", value: function() {
|
|
1675
|
-
var i =
|
|
1676
|
-
return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ?
|
|
1677
|
-
} }], o &&
|
|
1675
|
+
var i = be(arguments);
|
|
1676
|
+
return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? xn(i.text, this, i.ctx) : mn(i.text, this);
|
|
1677
|
+
} }], o && wn(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1678
1678
|
}();
|
|
1679
|
-
function
|
|
1680
|
-
return
|
|
1679
|
+
function It(e) {
|
|
1680
|
+
return It = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1681
1681
|
return typeof n;
|
|
1682
1682
|
} : function(n) {
|
|
1683
1683
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1684
|
-
},
|
|
1684
|
+
}, It(e);
|
|
1685
1685
|
}
|
|
1686
1686
|
function te(e, n) {
|
|
1687
1687
|
(n == null || n > e.length) && (n = e.length);
|
|
@@ -1689,29 +1689,29 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1689
1689
|
i[o] = e[o];
|
|
1690
1690
|
return i;
|
|
1691
1691
|
}
|
|
1692
|
-
function
|
|
1692
|
+
function An(e, n) {
|
|
1693
1693
|
for (var o = 0; o < n.length; o++) {
|
|
1694
1694
|
var i = n[o];
|
|
1695
1695
|
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(y, w) {
|
|
1696
|
-
if (
|
|
1696
|
+
if (It(y) !== "object" || y === null)
|
|
1697
1697
|
return y;
|
|
1698
1698
|
var x = y[Symbol.toPrimitive];
|
|
1699
1699
|
if (x !== void 0) {
|
|
1700
|
-
var
|
|
1701
|
-
if (
|
|
1702
|
-
return
|
|
1700
|
+
var E = x.call(y, w);
|
|
1701
|
+
if (It(E) !== "object")
|
|
1702
|
+
return E;
|
|
1703
1703
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1704
1704
|
}
|
|
1705
1705
|
return String(y);
|
|
1706
|
-
}(i.key, "string"),
|
|
1706
|
+
}(i.key, "string"), It(c) === "symbol" ? c : String(c)), i);
|
|
1707
1707
|
}
|
|
1708
1708
|
var c;
|
|
1709
1709
|
}
|
|
1710
|
-
var
|
|
1710
|
+
var Ae = function(e) {
|
|
1711
1711
|
return typeof e == "function" ? e : function() {
|
|
1712
1712
|
return e;
|
|
1713
1713
|
};
|
|
1714
|
-
},
|
|
1714
|
+
}, Se = function() {
|
|
1715
1715
|
function e(i) {
|
|
1716
1716
|
if (function(y, w) {
|
|
1717
1717
|
if (!(y instanceof w))
|
|
@@ -1727,20 +1727,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1727
1727
|
}
|
|
1728
1728
|
var n, o;
|
|
1729
1729
|
return n = e, o = [{ key: "anchor", value: function(i) {
|
|
1730
|
-
var c = this.props, y = c.hAnchor, w = c.vAnchor, x = c.width,
|
|
1730
|
+
var c = this.props, y = c.hAnchor, w = c.vAnchor, x = c.width, E = c.height;
|
|
1731
1731
|
if (!arguments.length)
|
|
1732
|
-
return [y * x(0), w *
|
|
1732
|
+
return [y * x(0), w * E(0)];
|
|
1733
1733
|
if (typeof i == "string") {
|
|
1734
|
-
var
|
|
1734
|
+
var k = this.props;
|
|
1735
1735
|
i.toLowerCase().trim().split(/\s+/).forEach(function(O) {
|
|
1736
|
-
O === "top" && (
|
|
1736
|
+
O === "top" && (k.vAnchor = -0), O === "middle" && (k.vAnchor = -0.5), O === "bottom" && (k.vAnchor = -1), O === "left" && (k.hAnchor = -0), O === "center" && (k.hAnchor = -0.5), O === "right" && (k.hAnchor = -1);
|
|
1737
1737
|
});
|
|
1738
1738
|
}
|
|
1739
1739
|
return this;
|
|
1740
1740
|
} }, { key: "width", value: function(i) {
|
|
1741
|
-
return arguments.length ? (this.props.width =
|
|
1741
|
+
return arguments.length ? (this.props.width = Ae(i), this) : this.props.width;
|
|
1742
1742
|
} }, { key: "height", value: function(i) {
|
|
1743
|
-
return arguments.length ? (this.props.height =
|
|
1743
|
+
return arguments.length ? (this.props.height = Ae(i), this) : this.props.height;
|
|
1744
1744
|
} }, { key: "rotate", value: function(i) {
|
|
1745
1745
|
return arguments.length ? (this.props.rotation = i, this) : this.props.rotation;
|
|
1746
1746
|
} }, { key: "createElement", value: function(i) {
|
|
@@ -1753,19 +1753,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1753
1753
|
}(y = this.anchor()) || function(x) {
|
|
1754
1754
|
if (typeof Symbol < "u" && x[Symbol.iterator] != null || x["@@iterator"] != null)
|
|
1755
1755
|
return Array.from(x);
|
|
1756
|
-
}(y) || function(x,
|
|
1756
|
+
}(y) || function(x, E) {
|
|
1757
1757
|
if (x) {
|
|
1758
1758
|
if (typeof x == "string")
|
|
1759
|
-
return te(x,
|
|
1760
|
-
var
|
|
1761
|
-
return
|
|
1759
|
+
return te(x, E);
|
|
1760
|
+
var k = Object.prototype.toString.call(x).slice(8, -1);
|
|
1761
|
+
return k === "Object" && x.constructor && (k = x.constructor.name), k === "Map" || k === "Set" ? Array.from(x) : k === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k) ? te(x, E) : void 0;
|
|
1762
1762
|
}
|
|
1763
1763
|
}(y) || function() {
|
|
1764
1764
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1765
1765
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1766
1766
|
}()), c(w), w.restore(), w;
|
|
1767
1767
|
} }, { key: "render", value: function() {
|
|
1768
|
-
var i =
|
|
1768
|
+
var i = be(arguments);
|
|
1769
1769
|
if (i.d3)
|
|
1770
1770
|
return i.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
|
|
1771
1771
|
if (i.ctx)
|
|
@@ -1774,62 +1774,62 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1774
1774
|
var c = typeof i.text.render == "function" ? i.text.render() : i.text;
|
|
1775
1775
|
return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
|
|
1776
1776
|
}
|
|
1777
|
-
} }], o &&
|
|
1778
|
-
}(),
|
|
1779
|
-
function
|
|
1777
|
+
} }], o && An(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1778
|
+
}(), Sn = Object.prototype.hasOwnProperty, ee = {};
|
|
1779
|
+
function En(e) {
|
|
1780
1780
|
return ee[e] || (ee[e] = e.replace(/([a-z])([A-Z])/g, function(n, o, i) {
|
|
1781
1781
|
return o + "-" + i.toLowerCase();
|
|
1782
1782
|
})), ee[e];
|
|
1783
1783
|
}
|
|
1784
|
-
function
|
|
1784
|
+
function Ee(e, n) {
|
|
1785
1785
|
if (Array.isArray(n))
|
|
1786
1786
|
return n.forEach(function(o) {
|
|
1787
|
-
return
|
|
1787
|
+
return Ee(e, o);
|
|
1788
1788
|
});
|
|
1789
1789
|
typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
|
|
1790
1790
|
}
|
|
1791
|
-
function
|
|
1791
|
+
function ke(e, n) {
|
|
1792
1792
|
if (typeof document < "u") {
|
|
1793
1793
|
var o = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
|
|
1794
1794
|
if (n && o.setAttribute)
|
|
1795
1795
|
for (var i in n)
|
|
1796
|
-
|
|
1796
|
+
Sn.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : En(i), n[i]);
|
|
1797
1797
|
for (var c = arguments.length, y = new Array(c > 2 ? c - 2 : 0), w = 2; w < c; w++)
|
|
1798
1798
|
y[w - 2] = arguments[w];
|
|
1799
1799
|
return y != null && y.length && y.forEach(function(x) {
|
|
1800
|
-
|
|
1800
|
+
Ee(o, x);
|
|
1801
1801
|
}), o;
|
|
1802
1802
|
}
|
|
1803
1803
|
}
|
|
1804
|
-
rt.createElement =
|
|
1804
|
+
rt.createElement = ke, rt.textparser = Nt, rt.defaultparser = Nt, rt.htmlparser = function(e) {
|
|
1805
1805
|
e = String(e || "").trim();
|
|
1806
|
-
for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], y = [], w = function(
|
|
1806
|
+
for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], y = [], w = function(L) {
|
|
1807
1807
|
for (var I in i)
|
|
1808
|
-
i[I] && (
|
|
1809
|
-
c.push(
|
|
1810
|
-
}, x = function(
|
|
1811
|
-
var I = c.length, z =
|
|
1808
|
+
i[I] && (L[I] = i[I]);
|
|
1809
|
+
c.push(L);
|
|
1810
|
+
}, x = function(L) {
|
|
1811
|
+
var I = c.length, z = nn[L];
|
|
1812
1812
|
if (I && z) {
|
|
1813
|
-
for (var
|
|
1814
|
-
|
|
1815
|
-
for (; z && c[
|
|
1816
|
-
|
|
1813
|
+
for (var j = I - 1; c[j] && (c[j] instanceof Tt || Ke.test(c[j].value)); )
|
|
1814
|
+
j--;
|
|
1815
|
+
for (; z && c[j] && c[j] instanceof nt; )
|
|
1816
|
+
j--, z--;
|
|
1817
1817
|
for (; z-- > 0; )
|
|
1818
1818
|
c.push(new nt());
|
|
1819
1819
|
}
|
|
1820
1820
|
}; e.length; ) {
|
|
1821
1821
|
if (n = /^[^<]+/.exec(e))
|
|
1822
|
-
Nt(
|
|
1823
|
-
else if (!(n =
|
|
1824
|
-
if (n =
|
|
1822
|
+
Nt(me(n[0]), !1).forEach(w);
|
|
1823
|
+
else if (!(n = tn.exec(e)))
|
|
1824
|
+
if (n = Je.exec(e))
|
|
1825
1825
|
y.length && (i = y.pop()), x(n[1]);
|
|
1826
|
-
else if (n =
|
|
1827
|
-
var
|
|
1828
|
-
x(
|
|
1829
|
-
var
|
|
1830
|
-
|
|
1826
|
+
else if (n = Qe.exec(e)) {
|
|
1827
|
+
var E = n[1];
|
|
1828
|
+
x(E), y.push(i), i = Object.create(i), ye[E] && ye[E](i, "");
|
|
1829
|
+
var k = on(n[2]);
|
|
1830
|
+
E === "a" && (k.href && (i.href = k.href), k.rel && (i.rel = k.rel), k.target && (i.target = k.target)), k.class && (i.class = i.class ? i.class + " " + k.class : k.class), k.style && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(k.style)) && o[1] && (i.color = o[1]), E === "br" && c.push(new nt());
|
|
1831
1831
|
} else
|
|
1832
|
-
n = [e.slice(0, 1)], w(new
|
|
1832
|
+
n = [e.slice(0, 1)], w(new R(n[0]));
|
|
1833
1833
|
e = e.slice(n[0].length);
|
|
1834
1834
|
}
|
|
1835
1835
|
for (var O = c[c.length - 1]; O instanceof nt; )
|
|
@@ -1838,85 +1838,91 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1838
1838
|
}, rt.latexparser = function(e) {
|
|
1839
1839
|
e = String(e || "").trim();
|
|
1840
1840
|
var n = [0];
|
|
1841
|
-
e = e.replace(/\\verb,(.*?),/, function(
|
|
1842
|
-
return n.push(
|
|
1841
|
+
e = e.replace(/\\verb,(.*?),/, function(P, C) {
|
|
1842
|
+
return n.push(C), "\\verb," + (n.length - 1) + ",";
|
|
1843
1843
|
}).replace(/\\\\\n/g, function() {
|
|
1844
1844
|
return "\\\\";
|
|
1845
|
-
}).replace(
|
|
1846
|
-
return
|
|
1847
|
-
}).replace(/\n\s+/g, function(
|
|
1848
|
-
return /\n/.test(
|
|
1849
|
-
}).replace(/\\symbol\{(\d+)\}/, function(
|
|
1850
|
-
return
|
|
1851
|
-
}).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(
|
|
1852
|
-
return
|
|
1853
|
-
}).replace(/\\verb,(.*?),/, function(
|
|
1854
|
-
return "\\verb,".concat(n[+
|
|
1845
|
+
}).replace(un, function(P, C, F) {
|
|
1846
|
+
return F.charAt(C - 1) === "\\" ? P : dn[P];
|
|
1847
|
+
}).replace(/\n\s+/g, function(P) {
|
|
1848
|
+
return /\n/.test(P.slice(1)) ? "\\par " : P;
|
|
1849
|
+
}).replace(/\\symbol\{(\d+)\}/, function(P, C, F, H) {
|
|
1850
|
+
return H.charAt(F - 1) === "\\" ? P : String.fromCharCode(1 * C);
|
|
1851
|
+
}).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(P, C, F, H) {
|
|
1852
|
+
return C + F + "{" + H + "}";
|
|
1853
|
+
}).replace(/\\verb,(.*?),/, function(P, C) {
|
|
1854
|
+
return "\\verb,".concat(n[+C], ",");
|
|
1855
1855
|
});
|
|
1856
|
-
for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], y = [], w = function(
|
|
1857
|
-
for (var
|
|
1858
|
-
i[
|
|
1859
|
-
return c.push(
|
|
1856
|
+
for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], y = [], w = function(P) {
|
|
1857
|
+
for (var C in i)
|
|
1858
|
+
i[C] && (P[C] = i[C]);
|
|
1859
|
+
return c.push(P), P;
|
|
1860
1860
|
}, x = function() {
|
|
1861
1861
|
y.push(i), i = Object.create(i);
|
|
1862
|
-
},
|
|
1862
|
+
}, E = function() {
|
|
1863
1863
|
if (!y.length)
|
|
1864
1864
|
throw new Error("Unexpected }");
|
|
1865
1865
|
i = y.pop();
|
|
1866
|
-
},
|
|
1867
|
-
if (o =
|
|
1866
|
+
}, k = { tokens: c, open_context: x, close_context: E, add_token: w }; e.length; ) {
|
|
1867
|
+
if (o = hn.exec(e))
|
|
1868
1868
|
Nt(o[0], !1).forEach(w);
|
|
1869
|
-
else if (o =
|
|
1870
|
-
w(new
|
|
1871
|
-
else if (!(o =
|
|
1869
|
+
else if (o = cn.exec(e))
|
|
1870
|
+
w(new R(o[1]));
|
|
1871
|
+
else if (!(o = ln.exec(e))) {
|
|
1872
1872
|
if (o = /^\{/.exec(e))
|
|
1873
1873
|
x();
|
|
1874
1874
|
else if (o = /^\}/.exec(e))
|
|
1875
|
-
|
|
1875
|
+
E();
|
|
1876
1876
|
else if (!(o = /^\$/.exec(e)))
|
|
1877
1877
|
if (o = /^\\verb,([^,]+),/.exec(e))
|
|
1878
|
-
w(new
|
|
1879
|
-
else if (o =
|
|
1880
|
-
var O = o[1].slice(1) || o[1],
|
|
1878
|
+
w(new R(o[1]));
|
|
1879
|
+
else if (o = an.exec(e)) {
|
|
1880
|
+
var O = o[1].slice(1) || o[1], L = !!o[2];
|
|
1881
1881
|
if (/^(La)?TeX$/i.test(O)) {
|
|
1882
1882
|
x(), i.family = "serif";
|
|
1883
1883
|
var I = void 0;
|
|
1884
|
-
O === "LaTeX" && ((I = w(new
|
|
1885
|
-
} else if (O in
|
|
1886
|
-
w(new
|
|
1887
|
-
else if (O in
|
|
1888
|
-
var z = [],
|
|
1889
|
-
if (
|
|
1890
|
-
for (
|
|
1884
|
+
O === "LaTeX" && ((I = w(new R("L"))).tracking = -0.25, (I = w(new R("A"))).size = 0.7, I.baseline = 0.3, I.tracking = -0.1), (I = w(new R("T"))).tracking = -0.17, (I = w(new R("E"))).baseline = -0.22, I.tracking = -0.13, I = w(new R("X")), E();
|
|
1885
|
+
} else if (O in ve)
|
|
1886
|
+
w(new R(ve[O])), L && x();
|
|
1887
|
+
else if (O in U) {
|
|
1888
|
+
var z = [], j = U[O].length - 1, Q = void 0;
|
|
1889
|
+
if (j) {
|
|
1890
|
+
for (L = !1, e = e.slice(o[0].length - 1); j--; ) {
|
|
1891
1891
|
if (!(Q = /^\{([^}]+)\}/.exec(e)))
|
|
1892
1892
|
throw new Error(O + " is missing an argument");
|
|
1893
1893
|
z.push(Q[1]), e = e.slice(Q[0].length);
|
|
1894
1894
|
}
|
|
1895
|
-
o[0] = /^\{/.exec(e) ? "{" : "",
|
|
1895
|
+
o[0] = /^\{/.exec(e) ? "{" : "", L = !!o[0];
|
|
1896
1896
|
}
|
|
1897
|
-
|
|
1897
|
+
L && x(), U[O].apply(k, [i].concat(z));
|
|
1898
1898
|
} else
|
|
1899
|
-
console.warn("unknown latex command", O), w(new
|
|
1899
|
+
console.warn("unknown latex command", O), w(new R(o[1])), L && x();
|
|
1900
1900
|
} else
|
|
1901
|
-
o = [e.slice(0, 1)], w(new
|
|
1901
|
+
o = [e.slice(0, 1)], w(new R(o[0]));
|
|
1902
1902
|
}
|
|
1903
1903
|
e = e.slice(o[0].length);
|
|
1904
1904
|
}
|
|
1905
1905
|
return c;
|
|
1906
1906
|
}, rt.measureText = function(e, n, o) {
|
|
1907
|
-
return
|
|
1908
|
-
}, rt.Token =
|
|
1909
|
-
const
|
|
1907
|
+
return X(e, b(n), o);
|
|
1908
|
+
}, rt.Token = R, rt.Break = Tt, rt.LineBreak = nt, rt.SoftHyphen = pt, rt.Rotator = Se, Se.createElement = ke;
|
|
1909
|
+
const kn = rt;
|
|
1910
1910
|
return r.default;
|
|
1911
1911
|
})());
|
|
1912
|
-
})(
|
|
1913
|
-
var
|
|
1914
|
-
const
|
|
1915
|
-
function
|
|
1912
|
+
})(Ye);
|
|
1913
|
+
var Bn = Ye.exports;
|
|
1914
|
+
const Le = /* @__PURE__ */ de(Bn);
|
|
1915
|
+
function se(u) {
|
|
1916
|
+
return u.replace(/…$/, "");
|
|
1917
|
+
}
|
|
1918
|
+
function oe(u) {
|
|
1919
|
+
return u.children[0].innerHTML;
|
|
1920
|
+
}
|
|
1921
|
+
function Vn(u, l) {
|
|
1916
1922
|
const t = ut(u), { fontSize: r, font: a, padding: h = 0 } = u.properties.style || {};
|
|
1917
1923
|
if (t.width === t.height && t.width === 0)
|
|
1918
1924
|
return;
|
|
1919
|
-
const
|
|
1925
|
+
const f = new Le({
|
|
1920
1926
|
font: `${r}px/${r}px ${a}`.replace(/(px)+/g, "px"),
|
|
1921
1927
|
width: t.width - h * 2,
|
|
1922
1928
|
height: t.height - h * 2,
|
|
@@ -1925,15 +1931,50 @@ function Bn(u, l) {
|
|
|
1925
1931
|
x: 0,
|
|
1926
1932
|
overflow: "ellipsis",
|
|
1927
1933
|
parser: "html",
|
|
1928
|
-
createElement:
|
|
1929
|
-
})
|
|
1934
|
+
createElement: Le.createElement
|
|
1935
|
+
});
|
|
1936
|
+
f.overflowWrap("break-word");
|
|
1937
|
+
const p = f.linebreak(
|
|
1930
1938
|
u.properties.content.replaceAll(`
|
|
1931
1939
|
`, "<br>")
|
|
1932
|
-
).render();
|
|
1933
|
-
|
|
1940
|
+
).render(), s = [...p.children];
|
|
1941
|
+
let d = 0;
|
|
1942
|
+
const m = [];
|
|
1943
|
+
u.properties.content.split(`
|
|
1944
|
+
`).forEach((b) => {
|
|
1945
|
+
let D = b;
|
|
1946
|
+
for (; D.length && d < s.length; ) {
|
|
1947
|
+
if (s[d].innerHTML === " ") {
|
|
1948
|
+
D.startsWith(`
|
|
1949
|
+
`) || m.push(d), d++;
|
|
1950
|
+
break;
|
|
1951
|
+
}
|
|
1952
|
+
const A = se(oe(s[d]));
|
|
1953
|
+
D.startsWith(A) && (D = D.slice(A.length).trim()), d++;
|
|
1954
|
+
}
|
|
1955
|
+
}), m.forEach((b) => p.removeChild(s[b]));
|
|
1956
|
+
const S = u.properties.content.match(/(https?:\/\/.*)/gm), T = S ? S.map((b) => b.split(" ")[0]) : [];
|
|
1957
|
+
p.setAttribute("transform", `translate(${h}, ${h})`), T.forEach((b) => {
|
|
1958
|
+
let D = b;
|
|
1959
|
+
const A = [];
|
|
1960
|
+
for (; D.length > 0; ) {
|
|
1961
|
+
const $ = s.find((_) => !!_.children[0] && _.children[0].tagName === "tspan" && D.startsWith(se(oe(_))));
|
|
1962
|
+
if (!$)
|
|
1963
|
+
break;
|
|
1964
|
+
A.push($);
|
|
1965
|
+
const N = se($.children[0].innerHTML).length;
|
|
1966
|
+
if (!N)
|
|
1967
|
+
break;
|
|
1968
|
+
D = D.slice(N);
|
|
1969
|
+
}
|
|
1970
|
+
A.forEach(($) => {
|
|
1971
|
+
const N = document.createElementNS("http://www.w3.org/2000/svg", "a");
|
|
1972
|
+
N.setAttribute("href", b), N.setAttribute("target", "_blank"), N.innerHTML = oe($), $.children[0].innerHTML = "", $.children[0].appendChild(N);
|
|
1973
|
+
});
|
|
1974
|
+
}), l.appendChild(p);
|
|
1934
1975
|
}
|
|
1935
|
-
const
|
|
1936
|
-
class
|
|
1976
|
+
const ze = 20;
|
|
1977
|
+
class Un extends Ue {
|
|
1937
1978
|
constructor(t, r = {}) {
|
|
1938
1979
|
super(
|
|
1939
1980
|
t,
|
|
@@ -1947,7 +1988,7 @@ class qn extends qe {
|
|
|
1947
1988
|
<span class="handle left top point-handle top-left" data-handle-id="5"></span>
|
|
1948
1989
|
<span class="handle bottom right point-handle bottom-right" data-handle-id="6"></span>
|
|
1949
1990
|
<span class="handle left bottom left-handle point-handle bottom-left" data-handle-id="7"></span>
|
|
1950
|
-
<textarea wrap="
|
|
1991
|
+
<textarea wrap="on"></textarea>
|
|
1951
1992
|
</div>
|
|
1952
1993
|
`
|
|
1953
1994
|
);
|
|
@@ -1958,7 +1999,7 @@ class qn extends qe {
|
|
|
1958
1999
|
v(this, "startX", 0);
|
|
1959
2000
|
v(this, "startY", 0);
|
|
1960
2001
|
v(this, "handles", []);
|
|
1961
|
-
v(this, "draggedHandle",
|
|
2002
|
+
v(this, "draggedHandle", V);
|
|
1962
2003
|
v(this, "isFocused", !1);
|
|
1963
2004
|
v(this, "placeholder", "Type your text here...");
|
|
1964
2005
|
v(this, "_onFocus", () => {
|
|
@@ -1967,22 +2008,22 @@ class qn extends qe {
|
|
|
1967
2008
|
v(this, "_onBlur", () => {
|
|
1968
2009
|
this.isFocused = !1;
|
|
1969
2010
|
});
|
|
1970
|
-
v(this, "startDrawing", (t, r, a =
|
|
2011
|
+
v(this, "startDrawing", (t, r, a = qn(t, r, 0, 0, "", At)) => {
|
|
1971
2012
|
this.add(a);
|
|
1972
2013
|
const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
|
|
1973
2014
|
this.select(a.id), this.startDragging(this.getById(a.id), h.x, h.y), this.draggedHandle = 6;
|
|
1974
2015
|
});
|
|
1975
2016
|
v(this, "cancelDrawing", () => {
|
|
1976
|
-
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...re }, this.draggedHandle =
|
|
2017
|
+
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...re }, this.draggedHandle = V, this.isDragging = !1, this.emit(St, this.annotation));
|
|
1977
2018
|
});
|
|
1978
2019
|
v(this, "startDragging", (t, r, a) => {
|
|
1979
2020
|
this.annotation = t;
|
|
1980
|
-
const h = ct(this.annotation),
|
|
1981
|
-
this.rect.x = h.x, this.rect.y = h.y, this.rect.width =
|
|
2021
|
+
const h = ct(this.annotation), f = ut(this.annotation);
|
|
2022
|
+
this.rect.x = h.x, this.rect.y = h.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(Yt, this.annotation), this.isDragging = !0;
|
|
1982
2023
|
});
|
|
1983
2024
|
v(this, "onHandleMouseDown", (t) => {
|
|
1984
2025
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
1985
|
-
r && (this.selectedId !== r.id && this.select(this.hoveredId), this.startDragging(r, t.clientX, t.clientY), this.draggedHandle =
|
|
2026
|
+
r && (this.selectedId !== r.id && this.select(this.hoveredId), this.startDragging(r, t.clientX, t.clientY), this.draggedHandle = Fe(t.target));
|
|
1986
2027
|
});
|
|
1987
2028
|
v(this, "onMouseMove", (t) => {
|
|
1988
2029
|
requestAnimationFrame(() => this._onMouseMove(t));
|
|
@@ -1991,19 +2032,22 @@ class qn extends qe {
|
|
|
1991
2032
|
if (!this.isDragging)
|
|
1992
2033
|
return;
|
|
1993
2034
|
t.stopPropagation(), t.preventDefault();
|
|
1994
|
-
const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), h = r.classList.contains("left"),
|
|
1995
|
-
(g && h || a &&
|
|
1996
|
-
const
|
|
1997
|
-
this.rect.width +
|
|
1998
|
-
|
|
1999
|
-
),
|
|
2035
|
+
const r = this.handles[this.draggedHandle], a = r.classList.contains("top"), h = r.classList.contains("left"), f = r.classList.contains("right"), g = r.classList.contains("bottom"), p = r.classList.contains("line-handle"), s = this.ogma.view.getZoom(), d = (t.clientX - this.startX) / s, m = (t.clientY - this.startY) / s, S = this.ogma.view.getAngle(), T = new Y(d, m).rotateRadians(S);
|
|
2036
|
+
(g && h || a && f) && (T.y = 0, T.x = 0);
|
|
2037
|
+
const b = h || p ? this.rect.x + T.x : this.rect.x, D = a || p ? this.rect.y + T.y : this.rect.y, A = Math.max(
|
|
2038
|
+
this.rect.width + d * (p || h ? 0 : 1),
|
|
2039
|
+
ze
|
|
2040
|
+
), $ = Math.max(
|
|
2000
2041
|
this.rect.height + m * (p || a ? 0 : 1),
|
|
2001
|
-
|
|
2042
|
+
ze
|
|
2002
2043
|
);
|
|
2003
|
-
|
|
2044
|
+
Cn(this.annotation, b, D, A, $), this.emit(Ut, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
|
|
2004
2045
|
});
|
|
2005
2046
|
v(this, "onMouseUp", () => {
|
|
2006
|
-
!this.isDragging || this.draggedHandle ===
|
|
2047
|
+
!this.isDragging || this.draggedHandle === V || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(St, this.annotation), this.isDragging = !1, this.draggedHandle = V);
|
|
2048
|
+
});
|
|
2049
|
+
v(this, "_onMousedown", (t) => {
|
|
2050
|
+
t.stopPropagation();
|
|
2007
2051
|
});
|
|
2008
2052
|
v(this, "onViewChanged", () => {
|
|
2009
2053
|
const t = Math.max(2, this.handleSize / this.ogma.view.getZoom());
|
|
@@ -2011,11 +2055,11 @@ class qn extends qe {
|
|
|
2011
2055
|
});
|
|
2012
2056
|
v(this, "_onInput", () => {
|
|
2013
2057
|
const t = this.getById(this.selectedId);
|
|
2014
|
-
t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(
|
|
2058
|
+
t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(ue, t), this.layer.refresh());
|
|
2015
2059
|
});
|
|
2016
|
-
this.showeditorOnHover = !1, this.handleSize =
|
|
2060
|
+
this.showeditorOnHover = !1, this.handleSize = Oe.handleSize || r.textHandleSize, this.placeholder = Oe.placeholder || r.textPlaceholder || "";
|
|
2017
2061
|
const a = this.textArea = this.editor.element.querySelector("textarea");
|
|
2018
|
-
a.addEventListener("input", this._onInput), a.addEventListener("focus", this._onFocus), a.addEventListener("blur", this._onBlur), a.spellcheck = !1, this.handles = Array.prototype.slice.call(
|
|
2062
|
+
a.addEventListener("input", this._onInput), a.addEventListener("focus", this._onFocus), a.addEventListener("blur", this._onBlur), a.addEventListener("mousedown", this._onMousedown), a.spellcheck = !1, this.handles = Array.prototype.slice.call(
|
|
2019
2063
|
this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
|
|
2020
2064
|
), this.handles.forEach(
|
|
2021
2065
|
(h) => h.addEventListener("mousedown", this.onHandleMouseDown)
|
|
@@ -2025,36 +2069,36 @@ class qn extends qe {
|
|
|
2025
2069
|
return !this.isFocused;
|
|
2026
2070
|
}
|
|
2027
2071
|
detect({ x: t, y: r }, a = 0) {
|
|
2028
|
-
const h = new
|
|
2072
|
+
const h = new Y(t, r), f = this.ogma.view.getAngle();
|
|
2029
2073
|
return this.elements.find((g) => {
|
|
2030
|
-
const { x: p, y: s } = ct(g), { width:
|
|
2031
|
-
return T > -a && T <
|
|
2074
|
+
const { x: p, y: s } = ct(g), { width: d, height: m } = ut(g), S = new Y(p, s), { x: T, y: b } = h.sub(S).rotateRadians(-f);
|
|
2075
|
+
return T > -a && T < d + a && b > -a && b < m + a;
|
|
2032
2076
|
});
|
|
2033
2077
|
}
|
|
2034
2078
|
draw(t) {
|
|
2035
2079
|
t.innerHTML = "";
|
|
2036
2080
|
const r = "", a = this.ogma.view.getAngle();
|
|
2037
|
-
this.elements.forEach((
|
|
2038
|
-
const p = `class${g}`, s = ut(
|
|
2039
|
-
color:
|
|
2081
|
+
this.elements.forEach((f, g) => {
|
|
2082
|
+
const p = `class${g}`, s = ut(f), d = ct(f), m = f.id, {
|
|
2083
|
+
color: S,
|
|
2040
2084
|
fontSize: T,
|
|
2041
|
-
font:
|
|
2042
|
-
strokeColor:
|
|
2043
|
-
strokeWidth:
|
|
2044
|
-
strokeType:
|
|
2045
|
-
background:
|
|
2046
|
-
} =
|
|
2085
|
+
font: b,
|
|
2086
|
+
strokeColor: D,
|
|
2087
|
+
strokeWidth: A,
|
|
2088
|
+
strokeType: $,
|
|
2089
|
+
background: N
|
|
2090
|
+
} = f.properties.style || At;
|
|
2047
2091
|
if (m === this.selectedId)
|
|
2048
2092
|
return;
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2051
|
-
const
|
|
2052
|
-
let
|
|
2053
|
-
|
|
2054
|
-
const { x: Et, y: kt } = new
|
|
2055
|
-
|
|
2093
|
+
const _ = Ot("g");
|
|
2094
|
+
_.classList.add("annotation-text"), _.setAttribute("fill", `${S}`), _.setAttribute("font-size", `${T}px`), _.setAttribute("font-family", `${b}`);
|
|
2095
|
+
const X = Ot("rect");
|
|
2096
|
+
let W = !1;
|
|
2097
|
+
$ && $ !== "none" && (W = !0, X.setAttribute("stroke", D || "black"), X.setAttribute("stroke-width", `${A}`), $ === "dashed" && X.setAttribute("stroke-dasharray", "5,5")), (N && N.length || W) && (W = !0, X.setAttribute("fill", N || "transparent")), W && (X.setAttribute("width", `${s.width}`), X.setAttribute("height", `${s.height}`)), _.appendChild(X), Vn(f, _);
|
|
2098
|
+
const { x: Et, y: kt } = new Y(d.x, d.y).rotateRadians(-a);
|
|
2099
|
+
_.setAttribute("transform", `translate(${Et},${kt})`), _.classList.add(p), _.setAttribute("data-annotation", `${f.id}`), _.setAttribute("data-annotation-type", "text"), t.appendChild(_);
|
|
2056
2100
|
});
|
|
2057
|
-
const h =
|
|
2101
|
+
const h = Ot("style");
|
|
2058
2102
|
h.innerHTML = r, t.firstChild && t.insertBefore(h, t.firstChild);
|
|
2059
2103
|
}
|
|
2060
2104
|
refreshDrawing() {
|
|
@@ -2063,8 +2107,8 @@ class qn extends qe {
|
|
|
2063
2107
|
const a = r.getAttribute("data-annotation");
|
|
2064
2108
|
if (!a)
|
|
2065
2109
|
return;
|
|
2066
|
-
const h = ct(this.getById(a)), { x:
|
|
2067
|
-
r.setAttribute("transform", `translate(${
|
|
2110
|
+
const h = ct(this.getById(a)), { x: f, y: g } = new Y(h.x, h.y).rotateRadians(-t);
|
|
2111
|
+
r.setAttribute("transform", `translate(${f},${g})`);
|
|
2068
2112
|
});
|
|
2069
2113
|
}
|
|
2070
2114
|
getDefaultOptions() {
|
|
@@ -2074,13 +2118,13 @@ class qn extends qe {
|
|
|
2074
2118
|
if (+this.selectedId < 0 && +this.hoveredId < 0)
|
|
2075
2119
|
return;
|
|
2076
2120
|
const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), a = this.ogma.view.graphToScreenCoordinates(ct(t)), h = this.ogma.view.getZoom(), {
|
|
2077
|
-
font:
|
|
2121
|
+
font: f,
|
|
2078
2122
|
fontSize: g,
|
|
2079
2123
|
color: p,
|
|
2080
2124
|
background: s,
|
|
2081
|
-
padding:
|
|
2125
|
+
padding: d = 0
|
|
2082
2126
|
} = t.properties.style || At, m = (g || 1) * h;
|
|
2083
|
-
this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${a.x}px, ${a.y}px)translate(-50%, -50%)translate(${r.width / 2 * h}px, ${r.height / 2 * h}px)`, this.editor.element.style.width = `${r.width * h}px`, this.editor.element.style.height = `${r.height * h}px`, this.textArea.style.font = `${m} ${
|
|
2127
|
+
this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${a.x}px, ${a.y}px)translate(-50%, -50%)translate(${r.width / 2 * h}px, ${r.height / 2 * h}px)`, this.editor.element.style.width = `${r.width * h}px`, this.editor.element.style.height = `${r.height * h}px`, this.textArea.style.font = `${m} ${f}`, this.textArea.style.fontFamily = f || "sans-serif", this.textArea.style.fontSize = `${m}px`, this.textArea.style.padding = `${h * 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();
|
|
2084
2128
|
}
|
|
2085
2129
|
select(t) {
|
|
2086
2130
|
super.select(t), this.textArea.focus();
|
|
@@ -2089,22 +2133,22 @@ class qn extends qe {
|
|
|
2089
2133
|
super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
|
|
2090
2134
|
}
|
|
2091
2135
|
}
|
|
2092
|
-
class
|
|
2136
|
+
class Yn {
|
|
2093
2137
|
constructor() {
|
|
2094
2138
|
v(this, "links", {});
|
|
2095
2139
|
v(this, "linksByTargetId", {});
|
|
2096
2140
|
v(this, "linksByArrowId", {});
|
|
2097
2141
|
}
|
|
2098
2142
|
add(l, t, r, a, h) {
|
|
2099
|
-
const
|
|
2100
|
-
id:
|
|
2143
|
+
const f = Xt(), g = l.id, p = {
|
|
2144
|
+
id: f,
|
|
2101
2145
|
arrow: g,
|
|
2102
2146
|
target: r,
|
|
2103
2147
|
targetType: a,
|
|
2104
2148
|
connectionPoint: h,
|
|
2105
2149
|
side: t
|
|
2106
2150
|
};
|
|
2107
|
-
return this.links[
|
|
2151
|
+
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] = {
|
|
2108
2152
|
id: r,
|
|
2109
2153
|
side: t,
|
|
2110
2154
|
type: a,
|
|
@@ -2123,10 +2167,10 @@ class Vn {
|
|
|
2123
2167
|
return this;
|
|
2124
2168
|
const h = this.links[a];
|
|
2125
2169
|
delete this.links[a];
|
|
2126
|
-
const
|
|
2127
|
-
for (let s = 0; s <
|
|
2128
|
-
if (
|
|
2129
|
-
|
|
2170
|
+
const f = this.linksByTargetId[h.target];
|
|
2171
|
+
for (let s = 0; s < f.length; s++)
|
|
2172
|
+
if (f[s] === a) {
|
|
2173
|
+
f.splice(s, 1);
|
|
2130
2174
|
break;
|
|
2131
2175
|
}
|
|
2132
2176
|
return delete this.linksByArrowId[r][t], this;
|
|
@@ -2144,7 +2188,7 @@ class Vn {
|
|
|
2144
2188
|
Object.values(this.links).forEach(l);
|
|
2145
2189
|
}
|
|
2146
2190
|
}
|
|
2147
|
-
const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type === "text",
|
|
2191
|
+
const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type === "text", Ce = (u) => u.type === "FeatureCollection", Xn = {
|
|
2148
2192
|
magnetColor: "#3e8",
|
|
2149
2193
|
detectMargin: 20,
|
|
2150
2194
|
magnetHandleRadius: 5,
|
|
@@ -2154,7 +2198,7 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
|
|
|
2154
2198
|
textHandleSize: 3.5,
|
|
2155
2199
|
minArrowHeight: 20,
|
|
2156
2200
|
maxArrowHeight: 30
|
|
2157
|
-
},
|
|
2201
|
+
}, $e = ["start", "end"], Pe = [
|
|
2158
2202
|
{ x: 0, y: 0 },
|
|
2159
2203
|
{ x: 0.5, y: 0 },
|
|
2160
2204
|
{ x: 1, y: 0 },
|
|
@@ -2164,12 +2208,12 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
|
|
|
2164
2208
|
{ x: 0.5, y: 1 },
|
|
2165
2209
|
{ x: 1, y: 1 }
|
|
2166
2210
|
];
|
|
2167
|
-
class
|
|
2211
|
+
class Zn extends Ve {
|
|
2168
2212
|
constructor(t, r = {}) {
|
|
2169
2213
|
super();
|
|
2170
2214
|
v(this, "arrows");
|
|
2171
2215
|
v(this, "texts");
|
|
2172
|
-
v(this, "links", new
|
|
2216
|
+
v(this, "links", new Yn());
|
|
2173
2217
|
v(this, "layer");
|
|
2174
2218
|
v(this, "annotations");
|
|
2175
2219
|
v(this, "ogma");
|
|
@@ -2185,10 +2229,10 @@ class Gn extends Be {
|
|
|
2185
2229
|
return;
|
|
2186
2230
|
t.beginPath(), t.fillStyle = "green";
|
|
2187
2231
|
const r = this.ogma.view.getZoom();
|
|
2188
|
-
|
|
2232
|
+
Pe.forEach((a) => {
|
|
2189
2233
|
if (!this.textToMagnet)
|
|
2190
2234
|
return;
|
|
2191
|
-
const h = ut(this.textToMagnet),
|
|
2235
|
+
const h = ut(this.textToMagnet), f = ct(this.textToMagnet), { x: g, y: p } = new Y(a.x, a.y).mul({ x: h.width, y: h.height }).rotateRadians(this.ogma.view.getAngle()).add(f);
|
|
2192
2236
|
t.moveTo(g, p), t.arc(g, p, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
|
|
2193
2237
|
}), t.fill(), t.closePath();
|
|
2194
2238
|
});
|
|
@@ -2196,22 +2240,22 @@ class Gn extends Be {
|
|
|
2196
2240
|
const a = r;
|
|
2197
2241
|
if (ot(t) && a === "line")
|
|
2198
2242
|
["start", "end"].find((h) => {
|
|
2199
|
-
const
|
|
2200
|
-
return this._snapToText(t, a,
|
|
2243
|
+
const f = h === "start" ? Lt(t) : Bt(t);
|
|
2244
|
+
return this._snapToText(t, a, f) || this._findAndSnapToNode(t, h, f);
|
|
2201
2245
|
});
|
|
2202
2246
|
else if (ot(t) && a !== "line") {
|
|
2203
|
-
const h = a === "start" ?
|
|
2247
|
+
const h = a === "start" ? Lt(t) : Bt(t);
|
|
2204
2248
|
this._snapToText(t, a, h) || this._findAndSnapToNode(t, a, h);
|
|
2205
2249
|
} else
|
|
2206
|
-
mt(t) && (this.activeLinks.forEach(({ arrow: h, side:
|
|
2207
|
-
const p = this.getAnnotation(h), s = ut(t),
|
|
2208
|
-
p.geometry.coordinates[
|
|
2250
|
+
mt(t) && (this.activeLinks.forEach(({ arrow: h, side: f, connectionPoint: g }) => {
|
|
2251
|
+
const p = this.getAnnotation(h), s = ut(t), d = ct(t), m = new Y(g.x, g.y).mul({ x: s.width, y: s.height }).rotateRadians(this.ogma.view.getAngle()).add(d);
|
|
2252
|
+
p.geometry.coordinates[f === "start" ? 0 : 1] = [m.x, m.y];
|
|
2209
2253
|
}), this.activeLinks.length && this.arrows.refreshLayer());
|
|
2210
2254
|
this.layer.refresh(), this.emit(Ut, t, r);
|
|
2211
2255
|
});
|
|
2212
2256
|
v(this, "_onFeatureDragEnd", (t) => {
|
|
2213
|
-
this.dragged !== null && ot(t) &&
|
|
2214
|
-
this.links.getArrowLink(t.id, r) && this.emit(
|
|
2257
|
+
this.dragged !== null && ot(t) && Lt(this.dragged) && $e.forEach((r) => {
|
|
2258
|
+
this.links.getArrowLink(t.id, r) && this.emit(Rn, {
|
|
2215
2259
|
arrow: t,
|
|
2216
2260
|
link: this.links.getArrowLink(t.id, r)
|
|
2217
2261
|
});
|
|
@@ -2232,26 +2276,26 @@ class Gn extends Be {
|
|
|
2232
2276
|
});
|
|
2233
2277
|
v(this, "_onLayoutEnd", (t) => {
|
|
2234
2278
|
t.ids.forEach((r, a) => {
|
|
2235
|
-
this.links.getTargetLinks(r, "node").forEach((
|
|
2236
|
-
const g = this.getAnnotation(
|
|
2279
|
+
this.links.getTargetLinks(r, "node").forEach((f) => {
|
|
2280
|
+
const g = this.getAnnotation(f.arrow), p = f.side, s = jt(
|
|
2237
2281
|
g,
|
|
2238
2282
|
p === "start" ? "end" : "start"
|
|
2239
|
-
),
|
|
2240
|
-
bt(g, p,
|
|
2283
|
+
), d = t.positions.current[a], m = this.ogma.getNode(r).getAttribute("radius"), S = Ft(s, d, +m);
|
|
2284
|
+
bt(g, p, S.x, S.y);
|
|
2241
2285
|
});
|
|
2242
2286
|
}), this.arrows.refreshLayer(), this.texts.refreshLayer();
|
|
2243
2287
|
});
|
|
2244
2288
|
v(this, "_onAdded", (t) => {
|
|
2245
|
-
this.emit(
|
|
2289
|
+
this.emit(ce, t);
|
|
2246
2290
|
});
|
|
2247
2291
|
v(this, "_onRemoved", (t) => {
|
|
2248
|
-
this.emit(
|
|
2292
|
+
this.emit(he, t);
|
|
2249
2293
|
});
|
|
2250
2294
|
v(this, "_onUnselect", (t) => {
|
|
2251
|
-
this.selected = null, this.emit(
|
|
2295
|
+
this.selected = null, this.emit(le, t);
|
|
2252
2296
|
});
|
|
2253
2297
|
v(this, "_onSelect", (t) => {
|
|
2254
|
-
this.selected !== t && (this.selected = t, this.emit(
|
|
2298
|
+
this.selected !== t && (this.selected = t, this.emit(ae, this.selected));
|
|
2255
2299
|
});
|
|
2256
2300
|
/**
|
|
2257
2301
|
* Triggers the update event on the annotation
|
|
@@ -2263,25 +2307,25 @@ class Gn extends Be {
|
|
|
2263
2307
|
);
|
|
2264
2308
|
});
|
|
2265
2309
|
v(this, "_onUpdate", (t) => {
|
|
2266
|
-
this.emit(
|
|
2310
|
+
this.emit(ue, t);
|
|
2267
2311
|
});
|
|
2268
|
-
this.options = this.setOptions({ ...
|
|
2269
|
-
a.on(Yt, this._onFeatureDragStart).on(Ut, this._onFeatureDrag).on(St, this._onFeatureDragEnd).on(
|
|
2312
|
+
this.options = this.setOptions({ ...Xn, ...r }), this.ogma = t, this.arrows = new Fn(t, this.options), this.texts = new Un(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((a) => {
|
|
2313
|
+
a.on(Yt, this._onFeatureDragStart).on(Ut, this._onFeatureDrag).on(St, this._onFeatureDragEnd).on(ue, this.onUpdate).on(le, this._onUnselect).on(ae, this._onSelect).on(ce, this._onAdded).on(he, this._onRemoved);
|
|
2270
2314
|
}), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
|
|
2271
2315
|
this.refreshTextLinks();
|
|
2272
2316
|
}), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
|
|
2273
2317
|
}
|
|
2274
2318
|
_moveNodes(t, r, a) {
|
|
2275
2319
|
t.forEach((h) => {
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2278
|
-
const s = this.getAnnotation(p.arrow),
|
|
2320
|
+
const f = this.links.getTargetLinks(h.getId(), "node"), g = h.getPosition();
|
|
2321
|
+
f.forEach((p) => {
|
|
2322
|
+
const s = this.getAnnotation(p.arrow), d = p.side, m = jt(
|
|
2279
2323
|
s,
|
|
2280
|
-
|
|
2324
|
+
d === "start" ? "end" : "start"
|
|
2281
2325
|
);
|
|
2282
|
-
let
|
|
2283
|
-
const T = +h.getAttribute("radius"),
|
|
2284
|
-
(p.connectionPoint.x - (g.x - r) >
|
|
2326
|
+
let S = g;
|
|
2327
|
+
const T = +h.getAttribute("radius"), b = 1e-6;
|
|
2328
|
+
(p.connectionPoint.x - (g.x - r) > b || p.connectionPoint.y - (g.y - a) > b) && (S = Ft(m, g, T)), bt(s, d, S.x, S.y);
|
|
2285
2329
|
});
|
|
2286
2330
|
}), this.arrows.refreshLayer();
|
|
2287
2331
|
}
|
|
@@ -2290,32 +2334,32 @@ class Gn extends Be {
|
|
|
2290
2334
|
if (this.links.remove(t, r), !h)
|
|
2291
2335
|
return !1;
|
|
2292
2336
|
this.textToMagnet = h;
|
|
2293
|
-
const
|
|
2294
|
-
return
|
|
2337
|
+
const f = this.findMagnetPoint(Pe, h, a);
|
|
2338
|
+
return f ? (bt(t, r, f.point.x, f.point.y), this.links.add(t, r, h.id, "text", f.magnet), !0) : !1;
|
|
2295
2339
|
}
|
|
2296
2340
|
_findAndSnapToNode(t, r, a) {
|
|
2297
|
-
const h = this.ogma.view.graphToScreenCoordinates(a),
|
|
2298
|
-
this.links.remove(t, r),
|
|
2341
|
+
const h = this.ogma.view.graphToScreenCoordinates(a), f = this.ogma.view.getElementAt(h);
|
|
2342
|
+
this.links.remove(t, r), f && f.isNode ? (this.hoveredNode = f, this.hoveredNode.setSelected(!0), this._snapToNode(t, r, f, h)) : (this.hoveredNode && this.hoveredNode.setSelected(!1), this.hoveredNode = null);
|
|
2299
2343
|
}
|
|
2300
2344
|
_snapToNode(t, r, a, h) {
|
|
2301
|
-
const
|
|
2345
|
+
const f = a.getPositionOnScreen(), g = +a.getAttribute("radius"), p = g * this.ogma.view.getZoom(), s = h.x - f.x, d = h.y - f.y, m = Math.sqrt(s * s + d * d), S = a.getPosition();
|
|
2302
2346
|
if (m < p + this.options.detectMargin) {
|
|
2303
|
-
let T =
|
|
2347
|
+
let T = S;
|
|
2304
2348
|
if (m > p / 2) {
|
|
2305
|
-
const
|
|
2306
|
-
T = Ft(
|
|
2349
|
+
const b = jt(t, r === "end" ? "start" : "end");
|
|
2350
|
+
T = Ft(b, T, g);
|
|
2307
2351
|
}
|
|
2308
2352
|
bt(t, r, T.x, T.y), this.links.add(t, r, a.getId(), "node", T);
|
|
2309
2353
|
}
|
|
2310
2354
|
}
|
|
2311
2355
|
refreshTextLinks() {
|
|
2312
2356
|
let t = !1;
|
|
2313
|
-
this.links.forEach(({ connectionPoint: r, targetType: a, target: h, arrow:
|
|
2357
|
+
this.links.forEach(({ connectionPoint: r, targetType: a, target: h, arrow: f, side: g }) => {
|
|
2314
2358
|
if (a !== "text")
|
|
2315
2359
|
return;
|
|
2316
2360
|
t = !0;
|
|
2317
|
-
const p = this.getAnnotation(h), s = this.getAnnotation(
|
|
2318
|
-
bt(s, g,
|
|
2361
|
+
const p = this.getAnnotation(h), s = this.getAnnotation(f), d = ut(p), m = ct(p), S = new Y(r.x, r.y).mul({ x: d.width, y: d.height }).rotateRadians(this.ogma.view.getAngle()).add(m);
|
|
2362
|
+
bt(s, g, S.x, S.y);
|
|
2319
2363
|
}), t && this.arrows.refreshLayer();
|
|
2320
2364
|
}
|
|
2321
2365
|
/**
|
|
@@ -2326,17 +2370,17 @@ class Gn extends Be {
|
|
|
2326
2370
|
}
|
|
2327
2371
|
findMagnetPoint(t, r, a) {
|
|
2328
2372
|
let h;
|
|
2329
|
-
for (const
|
|
2330
|
-
const g = ut(r), p = ct(r), s = new
|
|
2373
|
+
for (const f of t) {
|
|
2374
|
+
const g = ut(r), p = ct(r), s = new Y(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(
|
|
2331
2375
|
this.options.magnetRadius * this.ogma.view.getZoom(),
|
|
2332
2376
|
// when really zoomed in: avoid to snap on too far away magnets
|
|
2333
2377
|
g.width / 2,
|
|
2334
2378
|
g.height / 2
|
|
2335
2379
|
);
|
|
2336
|
-
if (
|
|
2380
|
+
if (d < Math.max(m, this.options.magnetHandleRadius)) {
|
|
2337
2381
|
h = {
|
|
2338
2382
|
point: s,
|
|
2339
|
-
magnet:
|
|
2383
|
+
magnet: f
|
|
2340
2384
|
};
|
|
2341
2385
|
break;
|
|
2342
2386
|
}
|
|
@@ -2373,8 +2417,8 @@ class Gn extends Be {
|
|
|
2373
2417
|
* @param annotation The annotation to add
|
|
2374
2418
|
*/
|
|
2375
2419
|
add(t) {
|
|
2376
|
-
if (
|
|
2377
|
-
const [r, a] = t.features.reduce((h,
|
|
2420
|
+
if (Ce(t)) {
|
|
2421
|
+
const [r, a] = t.features.reduce((h, f) => (ot(f) ? h[1].push(f) : mt(f) && h[0].push(f), h), [[], []]);
|
|
2378
2422
|
return r.forEach(
|
|
2379
2423
|
(h) => this.add(h)
|
|
2380
2424
|
), a.forEach(
|
|
@@ -2396,13 +2440,13 @@ class Gn extends Be {
|
|
|
2396
2440
|
* @param annotation The annotation(s) to remove
|
|
2397
2441
|
*/
|
|
2398
2442
|
remove(t) {
|
|
2399
|
-
return
|
|
2443
|
+
return Ce(t) ? (t.features.forEach(
|
|
2400
2444
|
(r) => this.remove(r)
|
|
2401
2445
|
), this) : (ot(t) ? (this.links.remove(t, "start"), this.links.remove(t, "end"), this.arrows.remove(t.id)) : this.texts.remove(t.id), this);
|
|
2402
2446
|
}
|
|
2403
2447
|
loadLink(t) {
|
|
2404
2448
|
if (t.properties.link)
|
|
2405
|
-
for (const r of
|
|
2449
|
+
for (const r of $e) {
|
|
2406
2450
|
const a = t.properties.link[r];
|
|
2407
2451
|
if (!a)
|
|
2408
2452
|
continue;
|
|
@@ -2410,12 +2454,12 @@ class Gn extends Be {
|
|
|
2410
2454
|
if (a.type === "text" && h)
|
|
2411
2455
|
this.links.add(t, r, a.id, a.type, a.magnet);
|
|
2412
2456
|
else if (a.type === "node") {
|
|
2413
|
-
const
|
|
2414
|
-
if (!
|
|
2457
|
+
const f = this.ogma.getNode(a.id);
|
|
2458
|
+
if (!f)
|
|
2415
2459
|
continue;
|
|
2416
2460
|
this.links.add(t, r, a.id, a.type, a.magnet);
|
|
2417
|
-
const g =
|
|
2418
|
-
bt(t, r,
|
|
2461
|
+
const g = f.getPosition(), p = f.getAttribute("radius") || 0, s = jt(t, r === "start" ? "end" : "start"), d = Ft(s, g, +p);
|
|
2462
|
+
bt(t, r, d.x, d.y);
|
|
2419
2463
|
}
|
|
2420
2464
|
}
|
|
2421
2465
|
}
|
|
@@ -2441,7 +2485,7 @@ class Gn extends Be {
|
|
|
2441
2485
|
* Cancel drawing on the current frame
|
|
2442
2486
|
*/
|
|
2443
2487
|
cancelDrawing() {
|
|
2444
|
-
this.annotations.forEach((t) => t.cancelDrawing()), this.emit(
|
|
2488
|
+
this.annotations.forEach((t) => t.cancelDrawing()), this.emit(Hn);
|
|
2445
2489
|
}
|
|
2446
2490
|
/**
|
|
2447
2491
|
* Update the style of the annotation with the given id
|
|
@@ -2481,33 +2525,33 @@ class Gn extends Be {
|
|
|
2481
2525
|
}
|
|
2482
2526
|
}
|
|
2483
2527
|
export {
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2528
|
+
Fn as Arrows,
|
|
2529
|
+
Zn as Control,
|
|
2530
|
+
Un as Texts,
|
|
2531
|
+
On as createArrow,
|
|
2532
|
+
Ot as createSVGElement,
|
|
2533
|
+
qn as createText,
|
|
2534
|
+
Te as defaultArrowOptions,
|
|
2535
|
+
zt as defaultArrowStyle,
|
|
2536
|
+
Oe as defaultControllerOptions,
|
|
2493
2537
|
re as defaultTextOptions,
|
|
2494
2538
|
At as defaultTextStyle,
|
|
2495
|
-
|
|
2496
|
-
|
|
2539
|
+
Gn as getAnnotationsBounds,
|
|
2540
|
+
Bt as getArrowEnd,
|
|
2497
2541
|
Vt as getArrowEndPoints,
|
|
2498
2542
|
jt as getArrowSide,
|
|
2499
|
-
|
|
2543
|
+
Lt as getArrowStart,
|
|
2500
2544
|
Ft as getAttachmentPointOnNode,
|
|
2501
|
-
|
|
2502
|
-
|
|
2545
|
+
Fe as getHandleId,
|
|
2546
|
+
He as getTextBbox,
|
|
2503
2547
|
ct as getTextPosition,
|
|
2504
2548
|
ut as getTextSize,
|
|
2505
|
-
|
|
2549
|
+
Ce as isAnnotationCollection,
|
|
2506
2550
|
ot as isArrow,
|
|
2507
2551
|
mt as isText,
|
|
2508
|
-
|
|
2552
|
+
je as setArrowEnd,
|
|
2509
2553
|
bt as setArrowEndPoint,
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2554
|
+
Re as setArrowStart,
|
|
2555
|
+
Cn as setTextBbox,
|
|
2556
|
+
zn as updateTextBbox
|
|
2513
2557
|
};
|