@linkurious/ogma-annotations-react 1.1.22 → 1.1.23
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.js +12 -12
- package/dist/index.mjs +721 -730
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -14,15 +14,15 @@ var fr;
|
|
|
14
14
|
function tn() {
|
|
15
15
|
if (fr) return he;
|
|
16
16
|
fr = 1;
|
|
17
|
-
var u = Ir, e = Symbol.for("react.element"),
|
|
17
|
+
var u = Ir, e = Symbol.for("react.element"), o = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, l = u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
18
18
|
function f(g, d, v) {
|
|
19
19
|
var y, A = {}, _ = null, S = null;
|
|
20
20
|
v !== void 0 && (_ = "" + v), d.key !== void 0 && (_ = "" + d.key), d.ref !== void 0 && (S = d.ref);
|
|
21
|
-
for (y in d) n.call(d, y) && !
|
|
21
|
+
for (y in d) n.call(d, y) && !h.hasOwnProperty(y) && (A[y] = d[y]);
|
|
22
22
|
if (g && g.defaultProps) for (y in d = g.defaultProps, d) A[y] === void 0 && (A[y] = d[y]);
|
|
23
|
-
return { $$typeof: e, type: g, key: _, ref: S, props: A, _owner:
|
|
23
|
+
return { $$typeof: e, type: g, key: _, ref: S, props: A, _owner: l.current };
|
|
24
24
|
}
|
|
25
|
-
return he.Fragment =
|
|
25
|
+
return he.Fragment = o, he.jsx = f, he.jsxs = f, he;
|
|
26
26
|
}
|
|
27
27
|
var ce = {};
|
|
28
28
|
/**
|
|
@@ -37,46 +37,46 @@ var ce = {};
|
|
|
37
37
|
var gr;
|
|
38
38
|
function en() {
|
|
39
39
|
return gr || (gr = 1, process.env.NODE_ENV !== "production" && function() {
|
|
40
|
-
var u = Ir, e = Symbol.for("react.element"),
|
|
40
|
+
var u = Ir, e = Symbol.for("react.element"), o = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), f = Symbol.for("react.provider"), g = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), R = Symbol.iterator, C = "@@iterator";
|
|
41
41
|
function L(t) {
|
|
42
42
|
if (t === null || typeof t != "object")
|
|
43
43
|
return null;
|
|
44
|
-
var
|
|
45
|
-
return typeof
|
|
44
|
+
var s = R && t[R] || t[C];
|
|
45
|
+
return typeof s == "function" ? s : null;
|
|
46
46
|
}
|
|
47
47
|
var I = u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
48
48
|
function k(t) {
|
|
49
49
|
{
|
|
50
|
-
for (var
|
|
51
|
-
|
|
52
|
-
z("error", t,
|
|
50
|
+
for (var s = arguments.length, c = new Array(s > 1 ? s - 1 : 0), p = 1; p < s; p++)
|
|
51
|
+
c[p - 1] = arguments[p];
|
|
52
|
+
z("error", t, c);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
function z(t,
|
|
55
|
+
function z(t, s, c) {
|
|
56
56
|
{
|
|
57
57
|
var p = I.ReactDebugCurrentFrame, m = p.getStackAddendum();
|
|
58
|
-
m !== "" && (
|
|
59
|
-
var w =
|
|
58
|
+
m !== "" && (s += "%s", c = c.concat([m]));
|
|
59
|
+
var w = c.map(function(b) {
|
|
60
60
|
return String(b);
|
|
61
61
|
});
|
|
62
|
-
w.unshift("Warning: " +
|
|
62
|
+
w.unshift("Warning: " + s), Function.prototype.apply.call(console[t], console, w);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
var B = !1, tt = !1, rt = !1, Yt = !1, Vt = !1, ge;
|
|
66
66
|
ge = Symbol.for("react.module.reference");
|
|
67
67
|
function Dt(t) {
|
|
68
|
-
return !!(typeof t == "string" || typeof t == "function" || t === n || t ===
|
|
68
|
+
return !!(typeof t == "string" || typeof t == "function" || t === n || t === h || Vt || t === l || t === v || t === y || Yt || t === S || B || tt || rt || typeof t == "object" && t !== null && (t.$$typeof === _ || t.$$typeof === A || t.$$typeof === f || t.$$typeof === g || t.$$typeof === d || // This needs to include all possible module reference object
|
|
69
69
|
// types supported by any Flight configuration anywhere since
|
|
70
70
|
// we don't know which Flight build this will end up being used
|
|
71
71
|
// with.
|
|
72
72
|
t.$$typeof === ge || t.getModuleId !== void 0));
|
|
73
73
|
}
|
|
74
|
-
function Pt(t,
|
|
74
|
+
function Pt(t, s, c) {
|
|
75
75
|
var p = t.displayName;
|
|
76
76
|
if (p)
|
|
77
77
|
return p;
|
|
78
|
-
var m =
|
|
79
|
-
return m !== "" ?
|
|
78
|
+
var m = s.displayName || s.name || "";
|
|
79
|
+
return m !== "" ? c + "(" + m + ")" : c;
|
|
80
80
|
}
|
|
81
81
|
function pe(t) {
|
|
82
82
|
return t.displayName || "Context";
|
|
@@ -91,11 +91,11 @@ function en() {
|
|
|
91
91
|
switch (t) {
|
|
92
92
|
case n:
|
|
93
93
|
return "Fragment";
|
|
94
|
-
case
|
|
94
|
+
case o:
|
|
95
95
|
return "Portal";
|
|
96
|
-
case
|
|
96
|
+
case h:
|
|
97
97
|
return "Profiler";
|
|
98
|
-
case
|
|
98
|
+
case l:
|
|
99
99
|
return "StrictMode";
|
|
100
100
|
case v:
|
|
101
101
|
return "Suspense";
|
|
@@ -105,11 +105,11 @@ function en() {
|
|
|
105
105
|
if (typeof t == "object")
|
|
106
106
|
switch (t.$$typeof) {
|
|
107
107
|
case g:
|
|
108
|
-
var
|
|
109
|
-
return pe(
|
|
108
|
+
var s = t;
|
|
109
|
+
return pe(s) + ".Consumer";
|
|
110
110
|
case f:
|
|
111
|
-
var
|
|
112
|
-
return pe(
|
|
111
|
+
var c = t;
|
|
112
|
+
return pe(c._context) + ".Provider";
|
|
113
113
|
case d:
|
|
114
114
|
return Pt(t, t.render, "ForwardRef");
|
|
115
115
|
case A:
|
|
@@ -189,7 +189,7 @@ function en() {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
var Gt = I.ReactCurrentDispatcher, Jt;
|
|
192
|
-
function $t(t,
|
|
192
|
+
function $t(t, s, c) {
|
|
193
193
|
{
|
|
194
194
|
if (Jt === void 0)
|
|
195
195
|
try {
|
|
@@ -207,13 +207,13 @@ function en() {
|
|
|
207
207
|
var Be = typeof WeakMap == "function" ? WeakMap : Map;
|
|
208
208
|
_t = new Be();
|
|
209
209
|
}
|
|
210
|
-
function Zt(t,
|
|
210
|
+
function Zt(t, s) {
|
|
211
211
|
if (!t || Kt)
|
|
212
212
|
return "";
|
|
213
213
|
{
|
|
214
|
-
var
|
|
215
|
-
if (
|
|
216
|
-
return
|
|
214
|
+
var c = _t.get(t);
|
|
215
|
+
if (c !== void 0)
|
|
216
|
+
return c;
|
|
217
217
|
}
|
|
218
218
|
var p;
|
|
219
219
|
Kt = !0;
|
|
@@ -222,7 +222,7 @@ function en() {
|
|
|
222
222
|
var w;
|
|
223
223
|
w = Gt.current, Gt.current = null, be();
|
|
224
224
|
try {
|
|
225
|
-
if (
|
|
225
|
+
if (s) {
|
|
226
226
|
var b = function() {
|
|
227
227
|
throw Error();
|
|
228
228
|
};
|
|
@@ -278,14 +278,14 @@ function en() {
|
|
|
278
278
|
var W = t ? t.displayName || t.name : "", F = W ? $t(W) : "";
|
|
279
279
|
return typeof t == "function" && _t.set(t, F), F;
|
|
280
280
|
}
|
|
281
|
-
function qe(t,
|
|
281
|
+
function qe(t, s, c) {
|
|
282
282
|
return Zt(t, !1);
|
|
283
283
|
}
|
|
284
284
|
function We(t) {
|
|
285
|
-
var
|
|
286
|
-
return !!(
|
|
285
|
+
var s = t.prototype;
|
|
286
|
+
return !!(s && s.isReactComponent);
|
|
287
287
|
}
|
|
288
|
-
function It(t,
|
|
288
|
+
function It(t, s, c) {
|
|
289
289
|
if (t == null)
|
|
290
290
|
return "";
|
|
291
291
|
if (typeof t == "function")
|
|
@@ -303,11 +303,11 @@ function en() {
|
|
|
303
303
|
case d:
|
|
304
304
|
return qe(t.render);
|
|
305
305
|
case A:
|
|
306
|
-
return It(t.type,
|
|
306
|
+
return It(t.type, s, c);
|
|
307
307
|
case _: {
|
|
308
308
|
var p = t, m = p._payload, w = p._init;
|
|
309
309
|
try {
|
|
310
|
-
return It(w(m),
|
|
310
|
+
return It(w(m), s, c);
|
|
311
311
|
} catch {
|
|
312
312
|
}
|
|
313
313
|
}
|
|
@@ -317,12 +317,12 @@ function en() {
|
|
|
317
317
|
var bt = Object.prototype.hasOwnProperty, we = {}, xe = I.ReactDebugCurrentFrame;
|
|
318
318
|
function jt(t) {
|
|
319
319
|
if (t) {
|
|
320
|
-
var
|
|
321
|
-
xe.setExtraStackFrame(
|
|
320
|
+
var s = t._owner, c = It(t.type, t._source, s ? s.type : null);
|
|
321
|
+
xe.setExtraStackFrame(c);
|
|
322
322
|
} else
|
|
323
323
|
xe.setExtraStackFrame(null);
|
|
324
324
|
}
|
|
325
|
-
function Ue(t,
|
|
325
|
+
function Ue(t, s, c, p, m) {
|
|
326
326
|
{
|
|
327
327
|
var w = Function.call.bind(bt);
|
|
328
328
|
for (var b in t)
|
|
@@ -330,14 +330,14 @@ function en() {
|
|
|
330
330
|
var E = void 0;
|
|
331
331
|
try {
|
|
332
332
|
if (typeof t[b] != "function") {
|
|
333
|
-
var D = Error((p || "React class") + ": " +
|
|
333
|
+
var D = Error((p || "React class") + ": " + c + " type `" + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[b] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
334
334
|
throw D.name = "Invariant Violation", D;
|
|
335
335
|
}
|
|
336
|
-
E = t[b](
|
|
336
|
+
E = t[b](s, b, p, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
337
337
|
} catch (T) {
|
|
338
338
|
E = T;
|
|
339
339
|
}
|
|
340
|
-
E && !(E instanceof Error) && (jt(m), k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", p || "React class",
|
|
340
|
+
E && !(E instanceof Error) && (jt(m), k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", p || "React class", c, b, typeof E), jt(null)), E instanceof Error && !(E.message in we) && (we[E.message] = !0, jt(m), k("Failed %s type: %s", c, E.message), jt(null));
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
}
|
|
@@ -347,8 +347,8 @@ function en() {
|
|
|
347
347
|
}
|
|
348
348
|
function q(t) {
|
|
349
349
|
{
|
|
350
|
-
var
|
|
351
|
-
return
|
|
350
|
+
var s = typeof Symbol == "function" && Symbol.toStringTag, c = s && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
351
|
+
return c;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
function Ve(t) {
|
|
@@ -373,53 +373,53 @@ function en() {
|
|
|
373
373
|
}, Ft, ke;
|
|
374
374
|
function Xe(t) {
|
|
375
375
|
if (bt.call(t, "ref")) {
|
|
376
|
-
var
|
|
377
|
-
if (
|
|
376
|
+
var s = Object.getOwnPropertyDescriptor(t, "ref").get;
|
|
377
|
+
if (s && s.isReactWarning)
|
|
378
378
|
return !1;
|
|
379
379
|
}
|
|
380
380
|
return t.ref !== void 0;
|
|
381
381
|
}
|
|
382
382
|
function ee(t) {
|
|
383
383
|
if (bt.call(t, "key")) {
|
|
384
|
-
var
|
|
385
|
-
if (
|
|
384
|
+
var s = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
385
|
+
if (s && s.isReactWarning)
|
|
386
386
|
return !1;
|
|
387
387
|
}
|
|
388
388
|
return t.key !== void 0;
|
|
389
389
|
}
|
|
390
|
-
function Ge(t,
|
|
390
|
+
function Ge(t, s) {
|
|
391
391
|
typeof t.ref == "string" && ct.current;
|
|
392
392
|
}
|
|
393
|
-
function Je(t,
|
|
393
|
+
function Je(t, s) {
|
|
394
394
|
{
|
|
395
|
-
var
|
|
396
|
-
Ft || (Ft = !0, k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
395
|
+
var c = function() {
|
|
396
|
+
Ft || (Ft = !0, k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
397
397
|
};
|
|
398
|
-
|
|
399
|
-
get:
|
|
398
|
+
c.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
399
|
+
get: c,
|
|
400
400
|
configurable: !0
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
function Ke(t,
|
|
404
|
+
function Ke(t, s) {
|
|
405
405
|
{
|
|
406
|
-
var
|
|
407
|
-
ke || (ke = !0, k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
406
|
+
var c = function() {
|
|
407
|
+
ke || (ke = !0, k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
408
408
|
};
|
|
409
|
-
|
|
410
|
-
get:
|
|
409
|
+
c.isReactWarning = !0, Object.defineProperty(t, "ref", {
|
|
410
|
+
get: c,
|
|
411
411
|
configurable: !0
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
var re = function(t,
|
|
415
|
+
var re = function(t, s, c, p, m, w, b) {
|
|
416
416
|
var E = {
|
|
417
417
|
// This tag allows us to uniquely identify this as a React Element
|
|
418
418
|
$$typeof: e,
|
|
419
419
|
// Built-in properties that belong on the element
|
|
420
420
|
type: t,
|
|
421
|
-
key:
|
|
422
|
-
ref:
|
|
421
|
+
key: s,
|
|
422
|
+
ref: c,
|
|
423
423
|
props: b,
|
|
424
424
|
// Record the component responsible for creating this element.
|
|
425
425
|
_owner: w
|
|
@@ -441,12 +441,12 @@ function en() {
|
|
|
441
441
|
value: m
|
|
442
442
|
}), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
|
|
443
443
|
};
|
|
444
|
-
function _e(t,
|
|
444
|
+
function _e(t, s, c, p, m) {
|
|
445
445
|
{
|
|
446
446
|
var w, b = {}, E = null, D = null;
|
|
447
|
-
|
|
448
|
-
for (w in
|
|
449
|
-
bt.call(
|
|
447
|
+
c !== void 0 && (te(c), E = "" + c), ee(s) && (te(s.key), E = "" + s.key), Xe(s) && (D = s.ref, Ge(s, m));
|
|
448
|
+
for (w in s)
|
|
449
|
+
bt.call(s, w) && !Ae.hasOwnProperty(w) && (b[w] = s[w]);
|
|
450
450
|
if (t && t.defaultProps) {
|
|
451
451
|
var T = t.defaultProps;
|
|
452
452
|
for (w in T)
|
|
@@ -462,8 +462,8 @@ function en() {
|
|
|
462
462
|
var dt = I.ReactCurrentOwner, Se = I.ReactDebugCurrentFrame;
|
|
463
463
|
function wt(t) {
|
|
464
464
|
if (t) {
|
|
465
|
-
var
|
|
466
|
-
Se.setExtraStackFrame(
|
|
465
|
+
var s = t._owner, c = It(t.type, t._source, s ? s.type : null);
|
|
466
|
+
Se.setExtraStackFrame(c);
|
|
467
467
|
} else
|
|
468
468
|
Se.setExtraStackFrame(null);
|
|
469
469
|
}
|
|
@@ -490,37 +490,37 @@ Check the render method of \`` + t + "`.";
|
|
|
490
490
|
var Ce = {};
|
|
491
491
|
function Te(t) {
|
|
492
492
|
{
|
|
493
|
-
var
|
|
494
|
-
if (!
|
|
495
|
-
var
|
|
496
|
-
|
|
493
|
+
var s = xt();
|
|
494
|
+
if (!s) {
|
|
495
|
+
var c = typeof t == "string" ? t : t.displayName || t.name;
|
|
496
|
+
c && (s = `
|
|
497
497
|
|
|
498
|
-
Check the top-level render call using <` +
|
|
498
|
+
Check the top-level render call using <` + c + ">.");
|
|
499
499
|
}
|
|
500
|
-
return
|
|
500
|
+
return s;
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
function ie(t,
|
|
503
|
+
function ie(t, s) {
|
|
504
504
|
{
|
|
505
505
|
if (!t._store || t._store.validated || t.key != null)
|
|
506
506
|
return;
|
|
507
507
|
t._store.validated = !0;
|
|
508
|
-
var
|
|
509
|
-
if (Ce[
|
|
508
|
+
var c = Te(s);
|
|
509
|
+
if (Ce[c])
|
|
510
510
|
return;
|
|
511
|
-
Ce[
|
|
511
|
+
Ce[c] = !0;
|
|
512
512
|
var p = "";
|
|
513
|
-
t && t._owner && t._owner !== dt.current && (p = " It was passed a child from " + it(t._owner.type) + "."), wt(t), k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',
|
|
513
|
+
t && t._owner && t._owner !== dt.current && (p = " It was passed a child from " + it(t._owner.type) + "."), wt(t), k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, p), wt(null);
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
function Re(t,
|
|
516
|
+
function Re(t, s) {
|
|
517
517
|
{
|
|
518
518
|
if (typeof t != "object")
|
|
519
519
|
return;
|
|
520
520
|
if (Qt(t))
|
|
521
|
-
for (var
|
|
522
|
-
var p = t[
|
|
523
|
-
G(p) && ie(p,
|
|
521
|
+
for (var c = 0; c < t.length; c++) {
|
|
522
|
+
var p = t[c];
|
|
523
|
+
G(p) && ie(p, s);
|
|
524
524
|
}
|
|
525
525
|
else if (G(t))
|
|
526
526
|
t._store && (t._store.validated = !0);
|
|
@@ -528,39 +528,39 @@ Check the top-level render call using <` + h + ">.");
|
|
|
528
528
|
var m = L(t);
|
|
529
529
|
if (typeof m == "function" && m !== t.entries)
|
|
530
530
|
for (var w = m.call(t), b; !(b = w.next()).done; )
|
|
531
|
-
G(b.value) && ie(b.value,
|
|
531
|
+
G(b.value) && ie(b.value, s);
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function oe(t) {
|
|
536
536
|
{
|
|
537
|
-
var
|
|
538
|
-
if (
|
|
537
|
+
var s = t.type;
|
|
538
|
+
if (s == null || typeof s == "string")
|
|
539
539
|
return;
|
|
540
|
-
var
|
|
541
|
-
if (typeof
|
|
542
|
-
|
|
543
|
-
else if (typeof
|
|
540
|
+
var c;
|
|
541
|
+
if (typeof s == "function")
|
|
542
|
+
c = s.propTypes;
|
|
543
|
+
else if (typeof s == "object" && (s.$$typeof === d || // Note: Memo only checks outer props here.
|
|
544
544
|
// Inner props are checked in the reconciler.
|
|
545
|
-
|
|
546
|
-
|
|
545
|
+
s.$$typeof === A))
|
|
546
|
+
c = s.propTypes;
|
|
547
547
|
else
|
|
548
548
|
return;
|
|
549
|
-
if (
|
|
550
|
-
var p = it(
|
|
551
|
-
Ue(
|
|
552
|
-
} else if (
|
|
549
|
+
if (c) {
|
|
550
|
+
var p = it(s);
|
|
551
|
+
Ue(c, t.props, "prop", p, t);
|
|
552
|
+
} else if (s.PropTypes !== void 0 && !St) {
|
|
553
553
|
St = !0;
|
|
554
|
-
var m = it(
|
|
554
|
+
var m = it(s);
|
|
555
555
|
k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", m || "Unknown");
|
|
556
556
|
}
|
|
557
|
-
typeof
|
|
557
|
+
typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
function Ze(t) {
|
|
561
561
|
{
|
|
562
|
-
for (var
|
|
563
|
-
var p =
|
|
562
|
+
for (var s = Object.keys(t.props), c = 0; c < s.length; c++) {
|
|
563
|
+
var p = s[c];
|
|
564
564
|
if (p !== "children" && p !== "key") {
|
|
565
565
|
wt(t), k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), wt(null);
|
|
566
566
|
break;
|
|
@@ -569,8 +569,8 @@ Check the top-level render call using <` + h + ">.");
|
|
|
569
569
|
t.ref !== null && (wt(t), k("Invalid attribute `ref` supplied to `React.Fragment`."), wt(null));
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
-
var
|
|
573
|
-
function ae(t,
|
|
572
|
+
var se = {};
|
|
573
|
+
function ae(t, s, c, p, m, w) {
|
|
574
574
|
{
|
|
575
575
|
var b = Dt(t);
|
|
576
576
|
if (!b) {
|
|
@@ -581,11 +581,11 @@ Check the top-level render call using <` + h + ">.");
|
|
|
581
581
|
var T;
|
|
582
582
|
t === null ? T = "null" : Qt(t) ? T = "array" : t !== void 0 && t.$$typeof === e ? (T = "<" + (it(t.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : T = typeof t, k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, E);
|
|
583
583
|
}
|
|
584
|
-
var O = _e(t,
|
|
584
|
+
var O = _e(t, s, c, m, w);
|
|
585
585
|
if (O == null)
|
|
586
586
|
return O;
|
|
587
587
|
if (b) {
|
|
588
|
-
var j =
|
|
588
|
+
var j = s.children;
|
|
589
589
|
if (j !== void 0)
|
|
590
590
|
if (p)
|
|
591
591
|
if (Qt(j)) {
|
|
@@ -597,39 +597,39 @@ Check the top-level render call using <` + h + ">.");
|
|
|
597
597
|
else
|
|
598
598
|
Re(j, t);
|
|
599
599
|
}
|
|
600
|
-
if (bt.call(
|
|
601
|
-
var F = it(t), P = Object.keys(
|
|
600
|
+
if (bt.call(s, "key")) {
|
|
601
|
+
var F = it(t), P = Object.keys(s).filter(function(J) {
|
|
602
602
|
return J !== "key";
|
|
603
603
|
}), H = P.length > 0 ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
604
|
-
if (!
|
|
604
|
+
if (!se[F + H]) {
|
|
605
605
|
var N = P.length > 0 ? "{" + P.join(": ..., ") + ": ...}" : "{}";
|
|
606
606
|
k(`A props object containing a "key" prop is being spread into JSX:
|
|
607
607
|
let props = %s;
|
|
608
608
|
<%s {...props} />
|
|
609
609
|
React keys must be passed directly to JSX without using spread:
|
|
610
610
|
let props = %s;
|
|
611
|
-
<%s key={someKey} {...props} />`, H, F, N, F),
|
|
611
|
+
<%s key={someKey} {...props} />`, H, F, N, F), se[F + H] = !0;
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
|
-
return t === n ? Ze(O) :
|
|
614
|
+
return t === n ? Ze(O) : oe(O), O;
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
function Qe(t,
|
|
618
|
-
return ae(t,
|
|
617
|
+
function Qe(t, s, c) {
|
|
618
|
+
return ae(t, s, c, !0);
|
|
619
619
|
}
|
|
620
|
-
function r(t,
|
|
621
|
-
return ae(t,
|
|
620
|
+
function r(t, s, c) {
|
|
621
|
+
return ae(t, s, c, !1);
|
|
622
622
|
}
|
|
623
|
-
var i = r,
|
|
624
|
-
ce.Fragment = n, ce.jsx = i, ce.jsxs =
|
|
623
|
+
var i = r, a = Qe;
|
|
624
|
+
ce.Fragment = n, ce.jsx = i, ce.jsxs = a;
|
|
625
625
|
}()), ce;
|
|
626
626
|
}
|
|
627
627
|
var pr;
|
|
628
628
|
function rn() {
|
|
629
629
|
return pr || (pr = 1, process.env.NODE_ENV === "production" ? Pe.exports = tn() : Pe.exports = en()), Pe.exports;
|
|
630
630
|
}
|
|
631
|
-
var nn = rn(),
|
|
632
|
-
let Ne = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((e,
|
|
631
|
+
var nn = rn(), on = Object.defineProperty, sn = (u, e, o) => e in u ? on(u, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : u[e] = o, x = (u, e, o) => sn(u, typeof e != "symbol" ? e + "" : e, o);
|
|
632
|
+
let Ne = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((e, o) => (o &= 63, o < 36 ? e += o.toString(36) : o < 62 ? e += (o - 26).toString(36).toUpperCase() : o > 62 ? e += "-" : e += "_", e), "");
|
|
633
633
|
const fe = {
|
|
634
634
|
strokeType: "plain",
|
|
635
635
|
strokeColor: "#202020",
|
|
@@ -662,21 +662,21 @@ const fe = {
|
|
|
662
662
|
// tail: 'arrow-plain',
|
|
663
663
|
// start: { x: 0, y: 0 },
|
|
664
664
|
// end: { x: 100, y: 100 }
|
|
665
|
-
}, an = (u = 0, e = 0,
|
|
665
|
+
}, an = (u = 0, e = 0, o = 0, n = 0, l = { ...fe }) => ({
|
|
666
666
|
id: Ne(),
|
|
667
667
|
type: "Feature",
|
|
668
668
|
properties: {
|
|
669
669
|
type: "arrow",
|
|
670
670
|
style: {
|
|
671
671
|
...fe,
|
|
672
|
-
...
|
|
672
|
+
...l
|
|
673
673
|
}
|
|
674
674
|
},
|
|
675
675
|
geometry: {
|
|
676
676
|
type: "LineString",
|
|
677
677
|
coordinates: [
|
|
678
678
|
[u, e],
|
|
679
|
-
[
|
|
679
|
+
[o, n]
|
|
680
680
|
]
|
|
681
681
|
}
|
|
682
682
|
}), ln = "http://www.w3.org/2000/svg";
|
|
@@ -698,90 +698,76 @@ function vt(u) {
|
|
|
698
698
|
return { x: e[0], y: e[1] };
|
|
699
699
|
}
|
|
700
700
|
function un(u) {
|
|
701
|
-
const [e,
|
|
702
|
-
u.geometry.bbox = [e,
|
|
701
|
+
const [e, o] = u.geometry.coordinates[0][0], [n, l] = u.geometry.coordinates[0][2];
|
|
702
|
+
u.geometry.bbox = [e, o, n, l];
|
|
703
703
|
}
|
|
704
|
-
function hn(u, e,
|
|
705
|
-
u.geometry.bbox = [e,
|
|
704
|
+
function hn(u, e, o, n, l) {
|
|
705
|
+
u.geometry.bbox = [e, o, e + n, o + l], u.geometry.coordinates = [
|
|
706
706
|
[
|
|
707
|
-
[e,
|
|
708
|
-
[e + n,
|
|
709
|
-
[e + n,
|
|
710
|
-
[e,
|
|
711
|
-
[e,
|
|
707
|
+
[e, o],
|
|
708
|
+
[e + n, o],
|
|
709
|
+
[e + n, o + l],
|
|
710
|
+
[e, o + l],
|
|
711
|
+
[e, o]
|
|
712
712
|
]
|
|
713
713
|
];
|
|
714
714
|
}
|
|
715
715
|
function de(u) {
|
|
716
|
-
const [e,
|
|
717
|
-
return { x: e, y:
|
|
716
|
+
const [e, o] = u.geometry.coordinates[0];
|
|
717
|
+
return { x: e, y: o };
|
|
718
718
|
}
|
|
719
719
|
function Le(u, e) {
|
|
720
|
-
const [
|
|
721
|
-
return { x:
|
|
720
|
+
const [o, n] = u.geometry.coordinates[e === "start" ? 0 : 1];
|
|
721
|
+
return { x: o, y: n };
|
|
722
722
|
}
|
|
723
723
|
function je(u) {
|
|
724
|
-
const [e,
|
|
725
|
-
return { x: e, y:
|
|
724
|
+
const [e, o] = u.geometry.coordinates[1];
|
|
725
|
+
return { x: e, y: o };
|
|
726
726
|
}
|
|
727
|
-
function Mr(u, e,
|
|
728
|
-
u.geometry.coordinates[0] = [e,
|
|
727
|
+
function Mr(u, e, o) {
|
|
728
|
+
u.geometry.coordinates[0] = [e, o];
|
|
729
729
|
}
|
|
730
|
-
function zr(u, e,
|
|
731
|
-
u.geometry.coordinates[1] = [e,
|
|
730
|
+
function zr(u, e, o) {
|
|
731
|
+
u.geometry.coordinates[1] = [e, o];
|
|
732
732
|
}
|
|
733
733
|
function Fe(u) {
|
|
734
734
|
return { start: de(u), end: je(u) };
|
|
735
735
|
}
|
|
736
|
-
function Ht(u, e,
|
|
737
|
-
e === "start" ? Mr(u,
|
|
736
|
+
function Ht(u, e, o, n) {
|
|
737
|
+
e === "start" ? Mr(u, o, n) : zr(u, o, n);
|
|
738
738
|
}
|
|
739
739
|
const Nr = (u) => parseInt(u.getAttribute("data-handle-id") || "-1");
|
|
740
740
|
function cn(u) {
|
|
741
741
|
return Array.isArray(u) && u.length === 2 && u.every(isFinite);
|
|
742
742
|
}
|
|
743
|
-
function dn(u, e,
|
|
744
|
-
for (let
|
|
745
|
-
const
|
|
746
|
-
if (cn(
|
|
747
|
-
|
|
743
|
+
function dn(u, e, o, n) {
|
|
744
|
+
for (let l = 0; l < u.coordinates.length; l++) {
|
|
745
|
+
const h = u.coordinates[l];
|
|
746
|
+
if (cn(h))
|
|
747
|
+
h[0] = o + (h[0] - o) * e, h[1] = n + (h[1] - n) * e;
|
|
748
748
|
else
|
|
749
|
-
for (let f = 0; f <
|
|
750
|
-
const g =
|
|
751
|
-
g[0] =
|
|
749
|
+
for (let f = 0; f < h.length; f++) {
|
|
750
|
+
const g = h[f];
|
|
751
|
+
g[0] = o + (g[0] - o) * e, g[1] = n + (g[1] - n) * e;
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
754
|
return u;
|
|
755
755
|
}
|
|
756
|
-
function $e(u, e,
|
|
756
|
+
function $e(u, e, o) {
|
|
757
757
|
const n = Math.atan2(u.y - e.y, u.x - e.x);
|
|
758
758
|
return {
|
|
759
|
-
x: e.x +
|
|
760
|
-
y: e.y +
|
|
759
|
+
x: e.x + o * Math.cos(n),
|
|
760
|
+
y: e.y + o * Math.sin(n)
|
|
761
761
|
};
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function sr(u, e) {
|
|
764
764
|
if (!e) return { x: u.clientX, y: u.clientY };
|
|
765
|
-
const
|
|
765
|
+
const o = e.getBoundingClientRect();
|
|
766
766
|
return {
|
|
767
|
-
x: u.clientX -
|
|
768
|
-
y: u.clientY -
|
|
767
|
+
x: u.clientX - o.left - e.clientLeft,
|
|
768
|
+
y: u.clientY - o.top - e.clientTop
|
|
769
769
|
};
|
|
770
770
|
}
|
|
771
|
-
function fn(u, e) {
|
|
772
|
-
return u.startsWith("#") ? pn(u, e) : u.startsWith("rgb") ? yn(u, e) : u;
|
|
773
|
-
}
|
|
774
|
-
function gn(u) {
|
|
775
|
-
return u.length === 4 ? u.split("").map((e) => e + e).join("") : u;
|
|
776
|
-
}
|
|
777
|
-
function pn(u, e) {
|
|
778
|
-
const [s, n, a] = gn(u).match(/\w\w/g).map((c) => parseInt(c, 16));
|
|
779
|
-
return `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
780
|
-
}
|
|
781
|
-
function yn(u, e) {
|
|
782
|
-
const [s, n, a] = u.match(/\d+/g).map((c) => parseInt(c, 10));
|
|
783
|
-
return `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
784
|
-
}
|
|
785
771
|
const Ot = (u, e) => ({
|
|
786
772
|
x: u.x - e.x,
|
|
787
773
|
y: u.y - e.y
|
|
@@ -803,68 +789,74 @@ const Ot = (u, e) => ({
|
|
|
803
789
|
}), Ie = (u, e) => ({
|
|
804
790
|
x: u.x * e.x,
|
|
805
791
|
y: u.y * e.y
|
|
806
|
-
}),
|
|
807
|
-
const
|
|
792
|
+
}), st = (u, e) => {
|
|
793
|
+
const o = Math.sin(e), n = Math.cos(e);
|
|
808
794
|
return {
|
|
809
|
-
x: u.x * n - u.y *
|
|
810
|
-
y: u.x *
|
|
795
|
+
x: u.x * n - u.y * o,
|
|
796
|
+
y: u.x * o + u.y * n
|
|
811
797
|
};
|
|
812
|
-
},
|
|
798
|
+
}, fn = (u, e) => ({
|
|
813
799
|
x: u.x / e,
|
|
814
800
|
y: u.y / e
|
|
815
|
-
}), vr = (u, e) => u.x * e.x + u.y * e.y,
|
|
816
|
-
function Wr(u, e = 5,
|
|
801
|
+
}), vr = (u, e) => u.x * e.x + u.y * e.y, gn = 0.5;
|
|
802
|
+
function Wr(u, e = 5, o = 30) {
|
|
817
803
|
var n;
|
|
818
|
-
const { start:
|
|
819
|
-
return Math.min(
|
|
804
|
+
const { start: l, end: h } = Fe(u), f = Ot(h, l), g = u.properties.style && u.properties.style.strokeWidth ? (n = u.properties.style) == null ? void 0 : n.strokeWidth : 0;
|
|
805
|
+
return Math.min(o, Math.max(3 * g, qt(f) * 0.01, e));
|
|
820
806
|
}
|
|
821
|
-
function mr(u, e,
|
|
822
|
-
const
|
|
823
|
-
if (!
|
|
824
|
-
const
|
|
825
|
-
return `M ${
|
|
807
|
+
function mr(u, e, o, n) {
|
|
808
|
+
const l = qr(Hr(Br(e)), n);
|
|
809
|
+
if (!o || o !== "arrow" && o !== "arrow-plain") return "";
|
|
810
|
+
const h = Bt(u, st(l, Math.PI / 10)), f = Bt(u, st(l, -Math.PI / 10)), g = `${u.x} ${u.y}`;
|
|
811
|
+
return `M ${h.x} ${h.y} L ${g} ${f.x} ${f.y} ${o === "arrow" ? "" : `${h.x} ${h.y}`}`;
|
|
826
812
|
}
|
|
827
|
-
function
|
|
828
|
-
const { start:
|
|
813
|
+
function pn(u, e, o, n, l) {
|
|
814
|
+
const { start: h, end: f } = Fe(u), {
|
|
829
815
|
tail: g,
|
|
830
816
|
head: d,
|
|
831
817
|
strokeColor: v,
|
|
832
818
|
strokeWidth: y = 0
|
|
833
|
-
} = u.properties.style ||
|
|
819
|
+
} = u.properties.style || o, A = Ot(f, h), _ = Wr(u, n, l), S = Rt("g"), R = Rt("path");
|
|
834
820
|
S.setAttribute("data-annotation", `${u.id}`), S.setAttribute("data-annotation-type", "arrow");
|
|
835
821
|
const C = d === "arrow-plain" || g === "arrow", L = v || "none";
|
|
836
822
|
R.setAttribute("stroke", L), R.setAttribute("stroke-width", `${y}`), R.setAttribute("fill", C ? v || "" : "none"), R.setAttribute("stroke-linecap", "round"), R.setAttribute("stroke-linejoin", "round");
|
|
837
|
-
const I = mr(
|
|
838
|
-
R.setAttribute("d", z), S.appendChild(R), br(S,
|
|
823
|
+
const I = mr(h, Hr(A), g, _), k = mr(f, A, d, _), z = I + `M ${h.x} ${h.y} ${f.x} ${f.y}` + k;
|
|
824
|
+
R.setAttribute("d", z), S.appendChild(R), br(S, h, L, g, y), br(S, f, L, d, y), e.appendChild(S);
|
|
839
825
|
}
|
|
840
|
-
function br(u, e,
|
|
841
|
-
n === "halo-dot" && wr(
|
|
826
|
+
function br(u, e, o, n, l) {
|
|
827
|
+
n === "halo-dot" && wr(
|
|
828
|
+
u,
|
|
829
|
+
e,
|
|
830
|
+
yn(o),
|
|
831
|
+
gn,
|
|
832
|
+
l * 4
|
|
833
|
+
), (n === "dot" || n === "halo-dot") && wr(u, e, o, 1, l * 2);
|
|
842
834
|
}
|
|
843
|
-
function
|
|
844
|
-
return u === "none" ? "none" :
|
|
835
|
+
function yn(u) {
|
|
836
|
+
return u === "none" ? "none" : u;
|
|
845
837
|
}
|
|
846
|
-
function wr(u, e,
|
|
847
|
-
const
|
|
848
|
-
|
|
838
|
+
function wr(u, e, o, n, l) {
|
|
839
|
+
const h = Rt("circle");
|
|
840
|
+
h.setAttribute("cx", `${e.x}`), h.setAttribute("cy", `${e.y}`), h.setAttribute("r", `${l}`), h.setAttribute("fill-opacity", `${n}`), h.setAttribute("fill", o), u.appendChild(h);
|
|
849
841
|
}
|
|
850
|
-
const V = -1, Me = "dragging", ze = "dragstart", Ut = "dragend", ar = "select", lr = "unselect",
|
|
842
|
+
const V = -1, Me = "dragging", ze = "dragstart", Ut = "dragend", ar = "select", lr = "unselect", vn = "hover", mn = "unhover", ur = "remove", hr = "add", bn = "cancelDrawing", cr = "update", wn = "link";
|
|
851
843
|
function Ur(u) {
|
|
852
844
|
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
853
845
|
}
|
|
854
846
|
var xr = { exports: {} }, Er;
|
|
855
|
-
function
|
|
847
|
+
function xn() {
|
|
856
848
|
return Er || (Er = 1, function(u) {
|
|
857
|
-
var e = Object.prototype.hasOwnProperty,
|
|
849
|
+
var e = Object.prototype.hasOwnProperty, o = "~";
|
|
858
850
|
function n() {
|
|
859
851
|
}
|
|
860
|
-
Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (
|
|
861
|
-
function
|
|
852
|
+
Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (o = !1));
|
|
853
|
+
function l(d, v, y) {
|
|
862
854
|
this.fn = d, this.context = v, this.once = y || !1;
|
|
863
855
|
}
|
|
864
|
-
function
|
|
856
|
+
function h(d, v, y, A, _) {
|
|
865
857
|
if (typeof y != "function")
|
|
866
858
|
throw new TypeError("The listener must be a function");
|
|
867
|
-
var S = new
|
|
859
|
+
var S = new l(y, A || d, _), R = o ? o + v : v;
|
|
868
860
|
return d._events[R] ? d._events[R].fn ? d._events[R] = [d._events[R], S] : d._events[R].push(S) : (d._events[R] = S, d._eventsCount++), d;
|
|
869
861
|
}
|
|
870
862
|
function f(d, v) {
|
|
@@ -877,20 +869,20 @@ function _n() {
|
|
|
877
869
|
var d = [], v, y;
|
|
878
870
|
if (this._eventsCount === 0) return d;
|
|
879
871
|
for (y in v = this._events)
|
|
880
|
-
e.call(v, y) && d.push(
|
|
872
|
+
e.call(v, y) && d.push(o ? y.slice(1) : y);
|
|
881
873
|
return Object.getOwnPropertySymbols ? d.concat(Object.getOwnPropertySymbols(v)) : d;
|
|
882
874
|
}, g.prototype.listeners = function(d) {
|
|
883
|
-
var v =
|
|
875
|
+
var v = o ? o + d : d, y = this._events[v];
|
|
884
876
|
if (!y) return [];
|
|
885
877
|
if (y.fn) return [y.fn];
|
|
886
878
|
for (var A = 0, _ = y.length, S = new Array(_); A < _; A++)
|
|
887
879
|
S[A] = y[A].fn;
|
|
888
880
|
return S;
|
|
889
881
|
}, g.prototype.listenerCount = function(d) {
|
|
890
|
-
var v =
|
|
882
|
+
var v = o ? o + d : d, y = this._events[v];
|
|
891
883
|
return y ? y.fn ? 1 : y.length : 0;
|
|
892
884
|
}, g.prototype.emit = function(d, v, y, A, _, S) {
|
|
893
|
-
var R =
|
|
885
|
+
var R = o ? o + d : d;
|
|
894
886
|
if (!this._events[R]) return !1;
|
|
895
887
|
var C = this._events[R], L = arguments.length, I, k;
|
|
896
888
|
if (C.fn) {
|
|
@@ -935,11 +927,11 @@ function _n() {
|
|
|
935
927
|
}
|
|
936
928
|
return !0;
|
|
937
929
|
}, g.prototype.on = function(d, v, y) {
|
|
938
|
-
return
|
|
930
|
+
return h(this, d, v, y, !1);
|
|
939
931
|
}, g.prototype.once = function(d, v, y) {
|
|
940
|
-
return
|
|
932
|
+
return h(this, d, v, y, !0);
|
|
941
933
|
}, g.prototype.removeListener = function(d, v, y, A) {
|
|
942
|
-
var _ =
|
|
934
|
+
var _ = o ? o + d : d;
|
|
943
935
|
if (!this._events[_]) return this;
|
|
944
936
|
if (!v)
|
|
945
937
|
return f(this, _), this;
|
|
@@ -954,26 +946,26 @@ function _n() {
|
|
|
954
946
|
return this;
|
|
955
947
|
}, g.prototype.removeAllListeners = function(d) {
|
|
956
948
|
var v;
|
|
957
|
-
return d ? (v =
|
|
958
|
-
}, g.prototype.off = g.prototype.removeListener, g.prototype.addListener = g.prototype.on, g.prefixed =
|
|
949
|
+
return d ? (v = o ? o + d : d, this._events[v] && f(this, v)) : (this._events = new n(), this._eventsCount = 0), this;
|
|
950
|
+
}, g.prototype.off = g.prototype.removeListener, g.prototype.addListener = g.prototype.on, g.prefixed = o, g.EventEmitter = g, u.exports = g;
|
|
959
951
|
}(xr)), xr.exports;
|
|
960
952
|
}
|
|
961
|
-
var
|
|
962
|
-
const Yr = /* @__PURE__ */ Ur(
|
|
953
|
+
var En = xn();
|
|
954
|
+
const Yr = /* @__PURE__ */ Ur(En);
|
|
963
955
|
class Vr extends Yr {
|
|
964
|
-
constructor(e,
|
|
956
|
+
constructor(e, o) {
|
|
965
957
|
super(), x(this, "ogma"), x(this, "elements"), x(this, "layer"), x(this, "editor"), x(this, "selectedId", V), x(this, "hoveredId", V), x(this, "ogmaOptions"), x(this, "shouldDetect"), x(this, "isDragging"), x(this, "showeditorOnHover"), x(this, "_onKeyUp", (n) => {
|
|
966
958
|
n.code === 27 && this.selectedId !== V ? this.unselect() : (n.code === 46 || n.code === 8) && this.selectedId !== V && this._canRemove() && this.remove(this.selectedId);
|
|
967
959
|
}), x(this, "_onClickMouseMove", (n) => {
|
|
968
960
|
if (!n.domEvent || this.isDragging || !this.shouldDetect || n.domEvent.type !== "mousemove" && n.domEvent.target && n.domEvent.target.tagName === "a")
|
|
969
961
|
return;
|
|
970
|
-
const
|
|
971
|
-
n.domEvent.type === "mousemove" ?
|
|
962
|
+
const l = this.ogma.view.screenToGraphCoordinates(n), h = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(l, 0) : void 0;
|
|
963
|
+
n.domEvent.type === "mousemove" ? h ? this.hover(h.id) : this.hoveredId !== V && this.unhover() : h ? this.select(h.id) : this.selectedId !== V && this.unselect();
|
|
972
964
|
}), this.ogma = e, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = e.getOptions(), e.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("frame", () => {
|
|
973
965
|
this.refreshEditor(), this.refreshDrawing();
|
|
974
966
|
}), this.layer = e.layers.addSVGLayer({
|
|
975
967
|
draw: (n) => this.draw(n)
|
|
976
|
-
}), this.layer.moveToTop(), this.editor = e.layers.addLayer(
|
|
968
|
+
}), this.layer.moveToTop(), this.editor = e.layers.addLayer(o), this.editor.hide();
|
|
977
969
|
}
|
|
978
970
|
_canRemove() {
|
|
979
971
|
return !0;
|
|
@@ -984,38 +976,38 @@ class Vr extends Yr {
|
|
|
984
976
|
* @returns the added annotation
|
|
985
977
|
*/
|
|
986
978
|
add(e) {
|
|
987
|
-
const
|
|
979
|
+
const o = this.getDefaultOptions(), n = Object.assign(e, {
|
|
988
980
|
id: e.id === void 0 ? Ne() : e.id,
|
|
989
981
|
type: e.type,
|
|
990
982
|
properties: {
|
|
991
|
-
...
|
|
983
|
+
...o.properties,
|
|
992
984
|
...e.properties || {},
|
|
993
985
|
// styles need to be merged
|
|
994
|
-
style: { ...
|
|
986
|
+
style: { ...o.properties.style, ...e.properties.style || {} }
|
|
995
987
|
},
|
|
996
988
|
geometry: {
|
|
997
|
-
...
|
|
989
|
+
...o.geometry,
|
|
998
990
|
...e.geometry
|
|
999
991
|
}
|
|
1000
992
|
});
|
|
1001
993
|
return this.elements.push(n), this.layer.refresh(), this.emit(hr, n), n;
|
|
1002
994
|
}
|
|
1003
|
-
updateStyle(e,
|
|
995
|
+
updateStyle(e, o) {
|
|
1004
996
|
this.updateAnnotation(e, {
|
|
1005
997
|
properties: {
|
|
1006
|
-
style:
|
|
998
|
+
style: o
|
|
1007
999
|
}
|
|
1008
1000
|
});
|
|
1009
1001
|
}
|
|
1010
|
-
updateGeometry(e,
|
|
1002
|
+
updateGeometry(e, o) {
|
|
1011
1003
|
this.updateAnnotation(e, {
|
|
1012
|
-
geometry:
|
|
1004
|
+
geometry: o
|
|
1013
1005
|
});
|
|
1014
1006
|
}
|
|
1015
|
-
scale(e,
|
|
1007
|
+
scale(e, o, n, l) {
|
|
1016
1008
|
this.updateGeometry(
|
|
1017
1009
|
e,
|
|
1018
|
-
dn(e.geometry,
|
|
1010
|
+
dn(e.geometry, o, n, l)
|
|
1019
1011
|
);
|
|
1020
1012
|
}
|
|
1021
1013
|
/**
|
|
@@ -1024,37 +1016,37 @@ class Vr extends Yr {
|
|
|
1024
1016
|
* @param id Id of the annotation to update
|
|
1025
1017
|
* @param element params of the annotation
|
|
1026
1018
|
*/
|
|
1027
|
-
update(e,
|
|
1019
|
+
update(e, o) {
|
|
1028
1020
|
const n = this.getById(e);
|
|
1029
|
-
this.updateAnnotation(n,
|
|
1021
|
+
this.updateAnnotation(n, o);
|
|
1030
1022
|
}
|
|
1031
|
-
updateAnnotation(e,
|
|
1023
|
+
updateAnnotation(e, o) {
|
|
1032
1024
|
if (!e) return;
|
|
1033
1025
|
const n = e.id;
|
|
1034
|
-
Object.keys(
|
|
1035
|
-
if (
|
|
1036
|
-
if (
|
|
1037
|
-
const
|
|
1026
|
+
Object.keys(o).forEach((l) => {
|
|
1027
|
+
if (l !== "id")
|
|
1028
|
+
if (l === "properties") {
|
|
1029
|
+
const h = o.properties || { style: {} };
|
|
1038
1030
|
e.properties = {
|
|
1039
1031
|
...e.properties || {},
|
|
1040
|
-
...
|
|
1032
|
+
...h || {},
|
|
1041
1033
|
style: {
|
|
1042
1034
|
...e.properties.style || {},
|
|
1043
|
-
...
|
|
1035
|
+
...h.style || {}
|
|
1044
1036
|
}
|
|
1045
1037
|
};
|
|
1046
|
-
} else
|
|
1038
|
+
} else l === "geometry" ? e.geometry = {
|
|
1047
1039
|
...e.geometry,
|
|
1048
|
-
...
|
|
1049
|
-
} : e[
|
|
1040
|
+
...o.geometry
|
|
1041
|
+
} : e[l] = o[l];
|
|
1050
1042
|
}), n === this.selectedId && this.refreshEditor(), this.layer.refresh();
|
|
1051
1043
|
}
|
|
1052
1044
|
getById(e) {
|
|
1053
|
-
const
|
|
1045
|
+
const o = Number(e);
|
|
1054
1046
|
for (let n = 0; n < this.elements.length; n++) {
|
|
1055
|
-
const
|
|
1056
|
-
if (!(
|
|
1057
|
-
return
|
|
1047
|
+
const l = this.elements[n];
|
|
1048
|
+
if (!(l.id !== e && l.id !== o))
|
|
1049
|
+
return l;
|
|
1058
1050
|
}
|
|
1059
1051
|
}
|
|
1060
1052
|
/**
|
|
@@ -1063,12 +1055,12 @@ class Vr extends Yr {
|
|
|
1063
1055
|
* Select element, show editor, disable Ogma dragging and fire event
|
|
1064
1056
|
*/
|
|
1065
1057
|
select(e) {
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1058
|
+
const o = this.getById(e);
|
|
1059
|
+
o && (this.editor.show(), this.selectedId = e, this.refreshEditor(), this.layer.refresh(), this.emit(ar, o));
|
|
1068
1060
|
}
|
|
1069
1061
|
hover(e) {
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1062
|
+
const o = this.getById(e);
|
|
1063
|
+
o && (this.showeditorOnHover && this.editor.show(), this.hoveredId = e, this.refreshEditor(), this.layer.refresh(), this.emit(vn, o));
|
|
1072
1064
|
}
|
|
1073
1065
|
getSelectedFeature() {
|
|
1074
1066
|
return this.selectedId === V ? null : this.getById(this.selectedId);
|
|
@@ -1079,7 +1071,7 @@ class Vr extends Yr {
|
|
|
1079
1071
|
}
|
|
1080
1072
|
unhover() {
|
|
1081
1073
|
const e = this.getById(this.hoveredId);
|
|
1082
|
-
return this.emit(
|
|
1074
|
+
return this.emit(mn, e), this.hoveredId = V, this.selectedId === V && this.editor.hide(), this.layer.refresh(), this;
|
|
1083
1075
|
}
|
|
1084
1076
|
/**
|
|
1085
1077
|
* @method remove
|
|
@@ -1087,8 +1079,8 @@ class Vr extends Yr {
|
|
|
1087
1079
|
* Removes annotation with the given id
|
|
1088
1080
|
*/
|
|
1089
1081
|
remove(e) {
|
|
1090
|
-
const
|
|
1091
|
-
e === this.hoveredId && this.unhover(), e === this.selectedId && this.unselect(), this.elements = this.elements.filter((n) => n.id !== e),
|
|
1082
|
+
const o = this.getById(e);
|
|
1083
|
+
e === this.hoveredId && this.unhover(), e === this.selectedId && this.unselect(), this.elements = this.elements.filter((n) => n.id !== e), o && this.emit(ur, o), this.layer.refresh();
|
|
1092
1084
|
}
|
|
1093
1085
|
/**
|
|
1094
1086
|
* @method disableDragging
|
|
@@ -1139,8 +1131,8 @@ class Vr extends Yr {
|
|
|
1139
1131
|
}
|
|
1140
1132
|
}
|
|
1141
1133
|
const Ar = "handle-line", kr = "handle-start", _r = "handle-end";
|
|
1142
|
-
class
|
|
1143
|
-
constructor(e,
|
|
1134
|
+
class An extends Vr {
|
|
1135
|
+
constructor(e, o = {}) {
|
|
1144
1136
|
super(
|
|
1145
1137
|
e,
|
|
1146
1138
|
`
|
|
@@ -1151,27 +1143,27 @@ class Cn extends Vr {
|
|
|
1151
1143
|
</div>
|
|
1152
1144
|
`
|
|
1153
1145
|
), x(this, "draggedHandle", V), x(this, "start", { x: 0, y: 0 }), x(this, "end", { x: 0, y: 0 }), x(this, "arrow", { ...yr }), x(this, "startX", 0), x(this, "startY", 0), x(this, "minArrowHeight", 0), x(this, "maxArrowHeight", 0), x(this, "handles", []), x(this, "onHandleMouseDown", (n) => {
|
|
1154
|
-
const
|
|
1155
|
-
if (!
|
|
1156
|
-
const { x:
|
|
1157
|
-
this.startDragging(
|
|
1146
|
+
const l = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
1147
|
+
if (!l) return;
|
|
1148
|
+
const { x: h, y: f } = sr(n, this.ogma.getContainer());
|
|
1149
|
+
this.startDragging(l, h, f), this.draggedHandle = Nr(n.target);
|
|
1158
1150
|
}), x(this, "onMouseUp", () => {
|
|
1159
1151
|
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V, this.emit(Ut, this.arrow));
|
|
1160
1152
|
}), x(this, "onMouseMove", (n) => {
|
|
1161
1153
|
if (!this.isDragging || this.draggedHandle === V) return;
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1154
|
+
const l = this.handles[this.draggedHandle], h = this.ogma.view.getAngle(), { x: f, y: g } = st(
|
|
1155
|
+
fn(
|
|
1164
1156
|
{ x: n.x - this.startX, y: n.y - this.startY },
|
|
1165
1157
|
this.ogma.view.getZoom()
|
|
1166
1158
|
),
|
|
1167
|
-
|
|
1168
|
-
), d =
|
|
1159
|
+
h
|
|
1160
|
+
), d = l.id === Ar, v = l.id === kr, y = l.id === _r;
|
|
1169
1161
|
(d || v) && Mr(this.arrow, this.start.x + f, this.start.y + g), (d || y) && zr(this.arrow, this.end.x + f, this.end.y + g), this.emit(
|
|
1170
1162
|
Me,
|
|
1171
1163
|
this.arrow,
|
|
1172
1164
|
d ? "line" : v ? "start" : "end"
|
|
1173
1165
|
), this.refreshEditor(), this.layer.refresh();
|
|
1174
|
-
}), this.minArrowHeight =
|
|
1166
|
+
}), this.minArrowHeight = o.minArrowHeight || 0, this.maxArrowHeight = o.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
|
|
1175
1167
|
this.editor.element.querySelectorAll(".arrow-handle>.handle")
|
|
1176
1168
|
), this.handles.forEach(
|
|
1177
1169
|
(n) => n.addEventListener("mousedown", this.onHandleMouseDown)
|
|
@@ -1183,55 +1175,55 @@ class Cn extends Vr {
|
|
|
1183
1175
|
* @param y
|
|
1184
1176
|
* @param arrow
|
|
1185
1177
|
*/
|
|
1186
|
-
startDrawing(e,
|
|
1187
|
-
var
|
|
1178
|
+
startDrawing(e, o, n = an(e, o, e, o, fe)) {
|
|
1179
|
+
var l;
|
|
1188
1180
|
this.disableDragging(), this.add(n), this.hoveredId = n.id;
|
|
1189
|
-
const
|
|
1181
|
+
const h = this.ogma.view.graphToScreenCoordinates({ x: e, y: o }), f = ((l = this.ogma.getContainer()) == null ? void 0 : l.getBoundingClientRect()) || {
|
|
1190
1182
|
left: 0,
|
|
1191
1183
|
top: 0
|
|
1192
1184
|
};
|
|
1193
1185
|
this.startDragging(
|
|
1194
1186
|
this.getById(n.id),
|
|
1195
|
-
|
|
1196
|
-
|
|
1187
|
+
h.x + (f == null ? void 0 : f.left),
|
|
1188
|
+
h.y + f.top
|
|
1197
1189
|
), this.draggedHandle = 2;
|
|
1198
1190
|
}
|
|
1199
1191
|
cancelDrawing() {
|
|
1200
1192
|
this.isDragging && (this.remove(this.arrow.id), this.emit(Ut, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V);
|
|
1201
1193
|
}
|
|
1202
|
-
startDragging(e,
|
|
1203
|
-
this.selectedId !== e.id && this.select(this.hoveredId), this.arrow = e, this.startX =
|
|
1194
|
+
startDragging(e, o, n) {
|
|
1195
|
+
this.selectedId !== e.id && this.select(this.hoveredId), this.arrow = e, this.startX = o, this.startY = n, this.start = de(this.arrow), this.end = je(this.arrow), this.disableDragging(), this.emit(ze, this.arrow), this.isDragging = !0;
|
|
1204
1196
|
}
|
|
1205
|
-
detect(e,
|
|
1197
|
+
detect(e, o = 0) {
|
|
1206
1198
|
return this.elements.find((n) => {
|
|
1207
|
-
const { start:
|
|
1208
|
-
x: (
|
|
1209
|
-
y: (
|
|
1210
|
-
}), g = Ot(
|
|
1211
|
-
return Math.abs(vr(v, f)) < d / 2 +
|
|
1199
|
+
const { start: l, end: h } = Fe(n), f = Ot(e, {
|
|
1200
|
+
x: (l.x + h.x) / 2,
|
|
1201
|
+
y: (l.y + h.y) / 2
|
|
1202
|
+
}), g = Ot(h, l), d = qt(g), v = Br(g), y = Wr(n);
|
|
1203
|
+
return Math.abs(vr(v, f)) < d / 2 + o && Math.abs(vr(st(v, Math.PI / 2), f)) < y / 2 + o;
|
|
1212
1204
|
});
|
|
1213
1205
|
}
|
|
1214
1206
|
refreshEditor() {
|
|
1215
1207
|
if (+this.selectedId < 0 && +this.hoveredId < 0) return;
|
|
1216
|
-
const e = this.selectedId !== V ? this.getById(this.selectedId) : this.getById(this.hoveredId),
|
|
1208
|
+
const e = this.selectedId !== V ? this.getById(this.selectedId) : this.getById(this.hoveredId), o = Fe(e), n = this.ogma.view.graphToScreenCoordinates(o.start), l = this.ogma.view.graphToScreenCoordinates(o.end), [h, f, g] = Array.prototype.slice.call(
|
|
1217
1209
|
this.editor.element.querySelectorAll(".handle")
|
|
1218
1210
|
);
|
|
1219
|
-
f.style.transform = `translate(${n.x}px, ${n.y}px) translate(-50%, -50%)`, g.style.transform = `translate(${
|
|
1211
|
+
f.style.transform = `translate(${n.x}px, ${n.y}px) translate(-50%, -50%)`, g.style.transform = `translate(${l.x}px, ${l.y}px) translate(-50%, -50%)`;
|
|
1220
1212
|
const d = {
|
|
1221
|
-
x: (
|
|
1222
|
-
y: (
|
|
1223
|
-
}, v = Ot(
|
|
1224
|
-
|
|
1213
|
+
x: (l.x + n.x) / 2,
|
|
1214
|
+
y: (l.y + n.y) / 2
|
|
1215
|
+
}, v = Ot(l, n), y = qr(v, 1 / qt(v)), A = Math.atan2(y.y, y.x);
|
|
1216
|
+
h.style.width = `${qt(v)}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, h.style.transform = `translate(-50%, -50%) rotate(${A}rad)`;
|
|
1225
1217
|
}
|
|
1226
1218
|
getDefaultOptions() {
|
|
1227
1219
|
return yr;
|
|
1228
1220
|
}
|
|
1229
1221
|
draw(e) {
|
|
1230
1222
|
e.innerHTML = "";
|
|
1231
|
-
const
|
|
1232
|
-
n !== 0 &&
|
|
1233
|
-
(
|
|
1234
|
-
), e.appendChild(
|
|
1223
|
+
const o = Rt("g"), n = this.ogma.view.getAngle();
|
|
1224
|
+
n !== 0 && o.setAttribute("transform", `rotate(${-n * (180 / Math.PI)})`), this.elements.forEach(
|
|
1225
|
+
(l) => pn(l, o, fe, this.minArrowHeight, this.maxArrowHeight)
|
|
1226
|
+
), e.appendChild(o);
|
|
1235
1227
|
}
|
|
1236
1228
|
refreshDrawing() {
|
|
1237
1229
|
const e = this.ogma.view.getAngle();
|
|
@@ -1278,100 +1270,100 @@ const Wt = {
|
|
|
1278
1270
|
}, Sr = {
|
|
1279
1271
|
handleSize: 3.5,
|
|
1280
1272
|
placeholder: "Your text..."
|
|
1281
|
-
},
|
|
1273
|
+
}, kn = (u = 0, e = 0, o = 100, n = 50, l = "", h = { ...Wt }) => ({
|
|
1282
1274
|
id: Ne(),
|
|
1283
1275
|
type: "Feature",
|
|
1284
1276
|
properties: {
|
|
1285
1277
|
type: "text",
|
|
1286
|
-
content:
|
|
1287
|
-
style: { ...Wt, ...
|
|
1278
|
+
content: l,
|
|
1279
|
+
style: { ...Wt, ...h }
|
|
1288
1280
|
},
|
|
1289
1281
|
geometry: {
|
|
1290
1282
|
type: "Polygon",
|
|
1291
1283
|
coordinates: [
|
|
1292
1284
|
[
|
|
1293
1285
|
[u, e],
|
|
1294
|
-
[u +
|
|
1295
|
-
[u +
|
|
1286
|
+
[u + o, e],
|
|
1287
|
+
[u + o, e + n],
|
|
1296
1288
|
[u, e + n],
|
|
1297
1289
|
[u, e]
|
|
1298
1290
|
]
|
|
1299
1291
|
]
|
|
1300
1292
|
}
|
|
1301
1293
|
});
|
|
1302
|
-
var dr = { exports: {} },
|
|
1303
|
-
function
|
|
1294
|
+
var dr = { exports: {} }, _n = dr.exports, Cr;
|
|
1295
|
+
function Sn() {
|
|
1304
1296
|
return Cr || (Cr = 1, function(u, e) {
|
|
1305
|
-
(function(
|
|
1297
|
+
(function(o, n) {
|
|
1306
1298
|
u.exports = n();
|
|
1307
|
-
})(
|
|
1308
|
-
var
|
|
1309
|
-
for (var
|
|
1299
|
+
})(_n, () => (() => {
|
|
1300
|
+
var o = { d: (r, i) => {
|
|
1301
|
+
for (var a in i) o.o(i, a) && !o.o(r, a) && Object.defineProperty(r, a, { enumerable: !0, get: i[a] });
|
|
1310
1302
|
}, o: (r, i) => Object.prototype.hasOwnProperty.call(r, i) }, n = {};
|
|
1311
|
-
function
|
|
1312
|
-
return
|
|
1303
|
+
function l(r) {
|
|
1304
|
+
return l = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
|
|
1313
1305
|
return typeof i;
|
|
1314
1306
|
} : function(i) {
|
|
1315
1307
|
return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
|
|
1316
|
-
},
|
|
1308
|
+
}, l(r);
|
|
1317
1309
|
}
|
|
1318
|
-
|
|
1319
|
-
var
|
|
1310
|
+
o.d(n, { default: () => Qe });
|
|
1311
|
+
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/, d = /\bbold(?:er)?\b/, v = 13.3333333, y = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
|
|
1320
1312
|
function A(r) {
|
|
1321
|
-
var i = "",
|
|
1322
|
-
return
|
|
1313
|
+
var i = "", a = this;
|
|
1314
|
+
return a.style && a.style !== "normal" && (i += a.style), a.variant && a.variant !== "normal" && (i += (i ? " " : "") + a.variant), a.weight && a.weight !== "normal" && (i += (i ? " " : "") + a.weight), a.size && (i += (i ? " " : "") + a.size + "px", a.height !== a.size && (i += "/" + a.height + "px")), a.family && (i += (i ? " " : "") + a.family), r && (i += "::" + a.baseline), r && (i += "::" + a.color), i;
|
|
1323
1315
|
}
|
|
1324
1316
|
var _ = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: A, valueOf: A };
|
|
1325
1317
|
function S(r) {
|
|
1326
|
-
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
1327
|
-
i.family = (
|
|
1328
|
-
var t = y[
|
|
1329
|
-
|
|
1330
|
-
var
|
|
1331
|
-
if (
|
|
1318
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = h.exec(r);
|
|
1319
|
+
i.family = (a[6] || "").trim();
|
|
1320
|
+
var t = y[a[2]] || parseFloat(a[2]);
|
|
1321
|
+
a[3] === "%" ? t *= 0.16 : a[3] === "em" ? t *= 16 : a[3] === "pt" && (t *= v), i.size = t;
|
|
1322
|
+
var s = parseFloat(a[4]);
|
|
1323
|
+
if (s !== "normal" && s !== "inherit" && s ? a[5] && a[5] !== "em" ? a[5] === "pt" ? i.height = s * v : a[5] === "%" ? i.height = 0.01 * t : i.height = s : i.height = s * t : i.height = Math.round(t * (7 / 6)), f.test(a[1]) && (i.variant = "small-caps"), g.test(a[1]) && (i.style = "italic"), d.test(a[1])) i.weight = "bold";
|
|
1332
1324
|
else {
|
|
1333
|
-
var
|
|
1334
|
-
|
|
1325
|
+
var c = parseInt(/\b(\d+)\b/.exec(a[1]), 10);
|
|
1326
|
+
c >= 100 && c !== 400 && (i.weight = c);
|
|
1335
1327
|
}
|
|
1336
1328
|
return i;
|
|
1337
1329
|
}
|
|
1338
1330
|
function R() {
|
|
1339
|
-
var r, i,
|
|
1331
|
+
var r, i, a, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, c = 14, p = 12, m = null, w = null, b = "";
|
|
1340
1332
|
if (t && t.nodeType) {
|
|
1341
1333
|
var E = t && (t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView), D = E.getComputedStyle(t, null);
|
|
1342
|
-
r = D.getPropertyValue("font-family") || "", p = parseFloat(D.getPropertyValue("font-size")),
|
|
1334
|
+
r = D.getPropertyValue("font-family") || "", p = parseFloat(D.getPropertyValue("font-size")), c = D.getPropertyValue("line-height"), m = D.getPropertyValue("font-weight"), w = D.getPropertyValue("font-style"), b = D.getPropertyValue("font-variant") || "";
|
|
1343
1335
|
} else if (typeof t == "string") {
|
|
1344
1336
|
var T = S(t);
|
|
1345
|
-
r = T.family, p = T.size,
|
|
1346
|
-
} else
|
|
1347
|
-
|
|
1337
|
+
r = T.family, p = T.size, c = T.height, b = T.variant, w = T.style, m = T.weight;
|
|
1338
|
+
} else l(t) === "object" && (r = t.family, p = t.size, c = t.height, b = t.variant, m = t.weight, w = t.style, i = t.baseline, a = t.color);
|
|
1339
|
+
s.size && s.size < 3 && (p *= s.size), c = c !== "normal" && c ? parseFloat(c) : p * (7 / 6), s.height && s.height < 3 && (c *= s.height);
|
|
1348
1340
|
var O = Object.create(_);
|
|
1349
|
-
return O.family =
|
|
1341
|
+
return O.family = s.family || r || "sans-serif", O.height = c ?? 14, O.size = p ?? 12, O.variant = s.variant || b || "", O.style = s.style || w || "", O.weight = s.weight || m || "", O.baseline = i || 0, s.baseline != null && (O.baseline = s.baseline), O.color = s.color || a || "", O.id = A.call(O, !0), O;
|
|
1350
1342
|
}
|
|
1351
1343
|
const C = { "\n": 0.28, "\r": 0.28, " ": 0.28, " ": 0.28, " ": 0.28, "": 0, " ": 0.5, " ": 1, " ": 0.5, " ": 1, " ": 0.33, " ": 0.25, " ": 0.16, " ": 0.56, " ": 0.28, " ": 0.2, " ": 0.15, "": 0, " ": 0.16, " ": 0.22, " ": 1, "\uFEFF": 0 };
|
|
1352
1344
|
var L, I = function(r) {
|
|
1353
1345
|
var i = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || r && r.createElement("canvas");
|
|
1354
1346
|
if (i && i.getContext) {
|
|
1355
|
-
var
|
|
1356
|
-
if (
|
|
1357
|
-
return
|
|
1347
|
+
var a = i.getContext("2d");
|
|
1348
|
+
if (a && typeof a.measureText == "function") return function(t, s) {
|
|
1349
|
+
return a.font = String(s), a.measureText(t).width;
|
|
1358
1350
|
};
|
|
1359
1351
|
}
|
|
1360
1352
|
}(typeof document < "u" ? document : null) || (L = {}, function(r, i) {
|
|
1361
1353
|
if (!L[i]) {
|
|
1362
|
-
var
|
|
1363
|
-
L[i] =
|
|
1354
|
+
var a = R(i);
|
|
1355
|
+
L[i] = a, /\bmonospace\b/.test(a.family) ? a.size *= 0.6 : (a.size *= 0.45, a.weight && (a.size *= 1.18));
|
|
1364
1356
|
}
|
|
1365
1357
|
return r.length * L[i].size;
|
|
1366
1358
|
}), k = {}, z = { trim: !0, collapse: !0 };
|
|
1367
|
-
function B(r, i,
|
|
1368
|
-
var t = Object.assign({}, z,
|
|
1369
|
-
if (!
|
|
1370
|
-
if (
|
|
1371
|
-
var
|
|
1372
|
-
return
|
|
1359
|
+
function B(r, i, a) {
|
|
1360
|
+
var t = Object.assign({}, z, a), s = String(r);
|
|
1361
|
+
if (!s) return 0;
|
|
1362
|
+
if (s in C) {
|
|
1363
|
+
var c = i.id + "/" + s;
|
|
1364
|
+
return c in k || (k[c] = I("_".concat(s, "_"), i) - I("__", i)), k[c];
|
|
1373
1365
|
}
|
|
1374
|
-
return t.trim && t.collapse ? t.trim ?
|
|
1366
|
+
return t.trim && t.collapse ? t.trim ? s = s.trim() : t.collapse && (s = s.replace(/\s+/g, " ")) : s = s.replace(/\n/g, " "), I(s, i) + i.size * (r.tracking || 0);
|
|
1375
1367
|
}
|
|
1376
1368
|
function tt(r) {
|
|
1377
1369
|
return tt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
|
|
@@ -1385,8 +1377,8 @@ function On() {
|
|
|
1385
1377
|
r.prototype = Object.create(i && i.prototype, { constructor: { value: r, writable: !0, configurable: !0 } }), Object.defineProperty(r, "prototype", { writable: !1 }), i && Yt(r, i);
|
|
1386
1378
|
}
|
|
1387
1379
|
function Yt(r, i) {
|
|
1388
|
-
return Yt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(
|
|
1389
|
-
return
|
|
1380
|
+
return Yt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(a, t) {
|
|
1381
|
+
return a.__proto__ = t, a;
|
|
1390
1382
|
}, Yt(r, i);
|
|
1391
1383
|
}
|
|
1392
1384
|
function Vt(r) {
|
|
@@ -1401,20 +1393,20 @@ function On() {
|
|
|
1401
1393
|
}
|
|
1402
1394
|
}();
|
|
1403
1395
|
return function() {
|
|
1404
|
-
var
|
|
1396
|
+
var a, t = Dt(r);
|
|
1405
1397
|
if (i) {
|
|
1406
|
-
var
|
|
1407
|
-
|
|
1408
|
-
} else
|
|
1409
|
-
return ge(this,
|
|
1398
|
+
var s = Dt(this).constructor;
|
|
1399
|
+
a = Reflect.construct(t, arguments, s);
|
|
1400
|
+
} else a = t.apply(this, arguments);
|
|
1401
|
+
return ge(this, a);
|
|
1410
1402
|
};
|
|
1411
1403
|
}
|
|
1412
1404
|
function ge(r, i) {
|
|
1413
1405
|
if (i && (tt(i) === "object" || typeof i == "function")) return i;
|
|
1414
1406
|
if (i !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
|
|
1415
|
-
return function(
|
|
1416
|
-
if (
|
|
1417
|
-
return
|
|
1407
|
+
return function(a) {
|
|
1408
|
+
if (a === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1409
|
+
return a;
|
|
1418
1410
|
}(r);
|
|
1419
1411
|
}
|
|
1420
1412
|
function Dt(r) {
|
|
@@ -1426,22 +1418,22 @@ function On() {
|
|
|
1426
1418
|
if (!(r instanceof i)) throw new TypeError("Cannot call a class as a function");
|
|
1427
1419
|
}
|
|
1428
1420
|
function pe(r, i) {
|
|
1429
|
-
for (var
|
|
1430
|
-
var t = i[
|
|
1431
|
-
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(r, (
|
|
1432
|
-
if (tt(
|
|
1433
|
-
var m =
|
|
1421
|
+
for (var a = 0; a < i.length; a++) {
|
|
1422
|
+
var t = i[a];
|
|
1423
|
+
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(r, (s = function(c, p) {
|
|
1424
|
+
if (tt(c) !== "object" || c === null) return c;
|
|
1425
|
+
var m = c[Symbol.toPrimitive];
|
|
1434
1426
|
if (m !== void 0) {
|
|
1435
|
-
var w = m.call(
|
|
1427
|
+
var w = m.call(c, p);
|
|
1436
1428
|
if (tt(w) !== "object") return w;
|
|
1437
1429
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1438
1430
|
}
|
|
1439
|
-
return String(
|
|
1440
|
-
}(t.key, "string"), tt(
|
|
1431
|
+
return String(c);
|
|
1432
|
+
}(t.key, "string"), tt(s) === "symbol" ? s : String(s)), t);
|
|
1441
1433
|
}
|
|
1442
|
-
var
|
|
1434
|
+
var s;
|
|
1443
1435
|
}
|
|
1444
|
-
function it(r, i,
|
|
1436
|
+
function it(r, i, a) {
|
|
1445
1437
|
return i && pe(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
1446
1438
|
}
|
|
1447
1439
|
var M = function() {
|
|
@@ -1458,39 +1450,39 @@ function On() {
|
|
|
1458
1450
|
return this.value;
|
|
1459
1451
|
} }]), r;
|
|
1460
1452
|
}(), lt = function(r) {
|
|
1461
|
-
rt(
|
|
1462
|
-
var i = Vt(
|
|
1463
|
-
function
|
|
1464
|
-
return Pt(this,
|
|
1453
|
+
rt(a, r);
|
|
1454
|
+
var i = Vt(a);
|
|
1455
|
+
function a() {
|
|
1456
|
+
return Pt(this, a), i.apply(this, arguments);
|
|
1465
1457
|
}
|
|
1466
|
-
return it(
|
|
1458
|
+
return it(a);
|
|
1467
1459
|
}(M), X = function(r) {
|
|
1468
|
-
rt(
|
|
1469
|
-
var i = Vt(
|
|
1470
|
-
function
|
|
1471
|
-
return Pt(this,
|
|
1460
|
+
rt(a, r);
|
|
1461
|
+
var i = Vt(a);
|
|
1462
|
+
function a() {
|
|
1463
|
+
return Pt(this, a), i.apply(this, arguments);
|
|
1472
1464
|
}
|
|
1473
|
-
return it(
|
|
1465
|
+
return it(a);
|
|
1474
1466
|
}(M), ut = function(r) {
|
|
1475
|
-
rt(
|
|
1476
|
-
var i = Vt(
|
|
1477
|
-
function
|
|
1478
|
-
return Pt(this,
|
|
1467
|
+
rt(a, r);
|
|
1468
|
+
var i = Vt(a);
|
|
1469
|
+
function a() {
|
|
1470
|
+
return Pt(this, a), i.apply(this, arguments);
|
|
1479
1471
|
}
|
|
1480
|
-
return it(
|
|
1472
|
+
return it(a);
|
|
1481
1473
|
}(M), Lt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, ye = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, Xt = /^[\xA0\u2011\u202F\u2060\uFEFF]/, ve = /^(?:[;\xAD%?…]|,(?!\d))/, me = /^[´±°¢£¤$¥\u2212]/;
|
|
1482
1474
|
function kt(r, i) {
|
|
1483
1475
|
i !== !1 && (r = r.trim());
|
|
1484
|
-
for (var
|
|
1485
|
-
|
|
1486
|
-
var b = Lt.test(
|
|
1487
|
-
if ((me.test(
|
|
1476
|
+
for (var a, t, s = [], c = r.charAt(0), p = 0, m = 1, w = r.length; m < w; m++) {
|
|
1477
|
+
a = r.charAt(m), t = r.charAt(m + 1);
|
|
1478
|
+
var b = Lt.test(c), E = Lt.test(a), D = E || b, T = void 0;
|
|
1479
|
+
if ((me.test(a) && !Xt.test(c) || ve.test(c + t) && !Xt.test(a)) && (D = !0), c !== "-" && c !== "‐" && c !== "–" && c !== "—" || ((T = Lt.test(r.charAt(m - 2))) && !E && (D = !1), !T && ye.test(a + t) && (D = !0)), D) {
|
|
1488
1480
|
var O = r.slice(p, m);
|
|
1489
|
-
/\u00AD$/.test(O) ? (
|
|
1481
|
+
/\u00AD$/.test(O) ? (s.push(new M(O.slice(0, -1))), s.push(new ut())) : (s.push(new M(O)), s.push(new lt())), p = m;
|
|
1490
1482
|
}
|
|
1491
|
-
|
|
1483
|
+
c = a;
|
|
1492
1484
|
}
|
|
1493
|
-
return
|
|
1485
|
+
return s.push(new M(r.slice(p))), s;
|
|
1494
1486
|
}
|
|
1495
1487
|
const be = { 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: "›" };
|
|
1496
1488
|
var He = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, Gt = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Jt = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, $t = /^<!--(.+?)-->/, Kt = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, _t = { b: function(r) {
|
|
@@ -1521,12 +1513,12 @@ function On() {
|
|
|
1521
1513
|
r.sup = !0;
|
|
1522
1514
|
} }, Be = { 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 };
|
|
1523
1515
|
function Zt(r) {
|
|
1524
|
-
return r.replace(Kt, function(i,
|
|
1525
|
-
if (
|
|
1526
|
-
var
|
|
1527
|
-
return String.fromCharCode(parseInt(
|
|
1516
|
+
return r.replace(Kt, function(i, a, t, s) {
|
|
1517
|
+
if (a || t) {
|
|
1518
|
+
var c = a ? 10 : 16;
|
|
1519
|
+
return String.fromCharCode(parseInt(a || t, c));
|
|
1528
1520
|
}
|
|
1529
|
-
return
|
|
1521
|
+
return s in be ? be[s] : i;
|
|
1530
1522
|
});
|
|
1531
1523
|
}
|
|
1532
1524
|
function qe(r) {
|
|
@@ -1534,17 +1526,17 @@ function On() {
|
|
|
1534
1526
|
}
|
|
1535
1527
|
var We = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
|
|
1536
1528
|
function It(r) {
|
|
1537
|
-
var i,
|
|
1529
|
+
var i, a = {};
|
|
1538
1530
|
if (r) {
|
|
1539
1531
|
do
|
|
1540
1532
|
if (i = We.exec(r)) {
|
|
1541
1533
|
var t = Zt(qe(i[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
|
|
1542
|
-
if (
|
|
1534
|
+
if (a[i[1]] = t, (r = r.slice(i[0].length)).length && /^\S/.test(r[0])) throw new Error("Attribute error");
|
|
1543
1535
|
}
|
|
1544
1536
|
while (i && r.length);
|
|
1545
1537
|
if (/\S/.test(r)) throw new Error("Attribute error");
|
|
1546
1538
|
}
|
|
1547
|
-
return
|
|
1539
|
+
return a;
|
|
1548
1540
|
}
|
|
1549
1541
|
const bt = { 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: "Þ" };
|
|
1550
1542
|
var we = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, xe = /^%[^\n]+(?:\n|$)/, jt = /^[^#$%&~_^\\{}]+/, Ue = /^\\([&{}$%#_])/, Ye = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, Qt = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, q = { bf: function(r) {
|
|
@@ -1572,12 +1564,12 @@ function On() {
|
|
|
1572
1564
|
var Ve = /[\r\n\xA0]+/g;
|
|
1573
1565
|
function Ee(r, i) {
|
|
1574
1566
|
r.sup && (r.baseline = 0.45, r.size = 0.7), r.sub && (r.baseline = -0.3, r.size = 0.7);
|
|
1575
|
-
var
|
|
1576
|
-
return (r.style || r.weight || r.baseline || r.color || r.size || r.family) && (
|
|
1567
|
+
var a = i;
|
|
1568
|
+
return (r.style || r.weight || r.baseline || r.color || r.size || r.family) && (a = R(i, r)), a;
|
|
1577
1569
|
}
|
|
1578
|
-
function te(r, i,
|
|
1579
|
-
for (var t,
|
|
1580
|
-
r[r.length - 1] instanceof ut && r.pop(), t = r[r.length - 1] || t || {},
|
|
1570
|
+
function te(r, i, a) {
|
|
1571
|
+
for (var t, s, c = r.width; c + a.width > i && r.length; ) s = (t = r[r.length - 1]).width, t.width > a.width ? (t.value = t.value.slice(0, -1), t.width = B(t, t.font), c += t.width) : r.pop(), c -= s;
|
|
1572
|
+
r[r.length - 1] instanceof ut && r.pop(), t = r[r.length - 1] || t || {}, a.font = R(a.font, t.bold, t.italic, ""), a.href = r.length ? t.href : null, a.rel = r.length ? t.rel : null, a.target = r.length ? t.target : null, r.push(a);
|
|
1581
1573
|
}
|
|
1582
1574
|
function ct(r) {
|
|
1583
1575
|
return Math.round(1e6 * r) / 1e6;
|
|
@@ -1587,11 +1579,11 @@ function On() {
|
|
|
1587
1579
|
if (Array.isArray(i)) return Ft(i);
|
|
1588
1580
|
}(r) || function(i) {
|
|
1589
1581
|
if (typeof Symbol < "u" && i[Symbol.iterator] != null || i["@@iterator"] != null) return Array.from(i);
|
|
1590
|
-
}(r) || function(i,
|
|
1582
|
+
}(r) || function(i, a) {
|
|
1591
1583
|
if (i) {
|
|
1592
|
-
if (typeof i == "string") return Ft(i,
|
|
1584
|
+
if (typeof i == "string") return Ft(i, a);
|
|
1593
1585
|
var t = Object.prototype.toString.call(i).slice(8, -1);
|
|
1594
|
-
return t === "Object" && i.constructor && (t = i.constructor.name), t === "Map" || t === "Set" ? Array.from(i) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Ft(i,
|
|
1586
|
+
return t === "Object" && i.constructor && (t = i.constructor.name), t === "Map" || t === "Set" ? Array.from(i) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Ft(i, a) : void 0;
|
|
1595
1587
|
}
|
|
1596
1588
|
}(r) || function() {
|
|
1597
1589
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
@@ -1600,19 +1592,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1600
1592
|
}
|
|
1601
1593
|
function Ft(r, i) {
|
|
1602
1594
|
(i == null || i > r.length) && (i = r.length);
|
|
1603
|
-
for (var
|
|
1595
|
+
for (var a = 0, t = new Array(i); a < i; a++) t[a] = r[a];
|
|
1604
1596
|
return t;
|
|
1605
1597
|
}
|
|
1606
1598
|
var ke = { center: "middle", right: "end" }, Xe = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, ee = function(r, i) {
|
|
1607
1599
|
return !r && !i || r === i;
|
|
1608
1600
|
};
|
|
1609
1601
|
function Ge(r, i) {
|
|
1610
|
-
var
|
|
1602
|
+
var a = [], t = i.font(), s = t.size, c = t.family, p = i.align(), m = i.createElement();
|
|
1611
1603
|
if (r.length) {
|
|
1612
|
-
var w = t.height, b = i.valign(), E = i.height()(), D = i.width()(0), T = !isFinite(D) && r.length === 1, O = T ? null : i.x(), j = ct(w /
|
|
1604
|
+
var w = t.height, b = i.valign(), E = i.height()(), D = i.width()(0), T = !isFinite(D) && r.length === 1, O = T ? null : i.x(), j = ct(w / s), W = T ? null : ct(w / (1.15 * s + (w - s) / 2));
|
|
1613
1605
|
if (Xe[b] && isFinite(E)) {
|
|
1614
1606
|
var F = b === "bottom" ? 1 : 0.5;
|
|
1615
|
-
W += (E * F - w * r.length * F) /
|
|
1607
|
+
W += (E * F - w * r.length * F) / s;
|
|
1616
1608
|
}
|
|
1617
1609
|
var P = p === "justify", H = 0;
|
|
1618
1610
|
p === "right" ? H = D : p === "center" && (H = D / 2);
|
|
@@ -1622,50 +1614,50 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1622
1614
|
N.push(Ct);
|
|
1623
1615
|
}
|
|
1624
1616
|
J = "tspan", K = null, U = "";
|
|
1625
|
-
},
|
|
1626
|
-
var ft = "", Et = "", ht = 0, gt = r[
|
|
1617
|
+
}, ot = 0, nt = r.length; ot < nt; ot++) {
|
|
1618
|
+
var ft = "", Et = "", ht = 0, gt = r[ot];
|
|
1627
1619
|
if (gt.length) {
|
|
1628
1620
|
N = [];
|
|
1629
1621
|
for (var Mt = 0, le = 0, pt = void 0, Z = 0, Oe = gt.length; Z < Oe; Z++) {
|
|
1630
1622
|
var Y = gt[Z], Q = Y.font;
|
|
1631
|
-
Y.whitespace && Mt++, le += Y.width, Z && !Y.tracking && !ht && ee(Q.id, ft) && ee(Y.class, Et) && ee(pt, Y.href) ? U += Y.value : ($(), U = Y.value, K = { fontFamily: Q.family !==
|
|
1623
|
+
Y.whitespace && Mt++, le += Y.width, Z && !Y.tracking && !ht && ee(Q.id, ft) && ee(Y.class, Et) && ee(pt, Y.href) ? U += Y.value : ($(), U = Y.value, K = { fontFamily: Q.family !== c ? Q.family : null, fontSize: Q.size !== s ? Q.size : null, fontWeight: Q.weight || null, fontStyle: Q.style || null, fontVariant: Q.variant !== "normal" && Q.variant || null, fill: Q.color || null, baselineShift: Q.baseline ? 100 * Q.baseline + "%" : null, className: Y.class || null }, ht && (K.dx = ct(ht), ht = 0), Y.tracking && (ht = Q.size * Y.tracking), Y.href && !pt ? (pt = Y.href, J = "a", K.href = pt, K.rel = Y.rel, K.target = Y.target) : pt = null, ft = Q.id, Et = Y.class);
|
|
1632
1624
|
}
|
|
1633
|
-
if ($(), T)
|
|
1625
|
+
if ($(), T) a.push.apply(a, Ae(N));
|
|
1634
1626
|
else {
|
|
1635
|
-
var De = null, ue =
|
|
1636
|
-
P && gt.length > 1 && !ue && (De = ct((D - le) / Mt)),
|
|
1627
|
+
var De = null, ue = ot === nt - 1 || gt[gt.length - 1] instanceof X;
|
|
1628
|
+
P && gt.length > 1 && !ue && (De = ct((D - le) / Mt)), a.push(m.apply(void 0, ["tspan", { wordSpacing: De, x: O(ot) + H, dy: ct(ot ? j : W) + "em" }].concat(Ae(N))));
|
|
1637
1629
|
}
|
|
1638
|
-
} else
|
|
1630
|
+
} else a.push(m("tspan", { x: O(ot), dy: ct(ot ? j : W) + "em" }, " "));
|
|
1639
1631
|
}
|
|
1640
1632
|
}
|
|
1641
|
-
return m.apply(void 0, ["text", { fontFamily:
|
|
1633
|
+
return m.apply(void 0, ["text", { fontFamily: c, fontSize: s, textAnchor: ke[p] || "start" }].concat(a));
|
|
1642
1634
|
}
|
|
1643
1635
|
var Je = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
|
|
1644
|
-
function Ke(r, i,
|
|
1636
|
+
function Ke(r, i, a) {
|
|
1645
1637
|
if (r.length) {
|
|
1646
|
-
|
|
1647
|
-
var t = i.font(),
|
|
1638
|
+
a.textBaseline = "middle";
|
|
1639
|
+
var t = i.font(), s = t.height, c = t.size, p = i.valign(), m = i.height()(), w = i.width()(0), b = i.align(), E = b === "justify", D = 0.5 * s, T = Je[p];
|
|
1648
1640
|
if (T && isFinite(m)) {
|
|
1649
|
-
var O = r.length *
|
|
1641
|
+
var O = r.length * s;
|
|
1650
1642
|
D += m * T - O * T;
|
|
1651
1643
|
}
|
|
1652
1644
|
r.forEach(function(j, W) {
|
|
1653
|
-
var F = i.x()(W), P = W *
|
|
1645
|
+
var F = i.x()(W), P = W * s + D, H = 0, N = 0;
|
|
1654
1646
|
j.forEach(function(U) {
|
|
1655
1647
|
U.whitespace && H++, N += U.width;
|
|
1656
1648
|
});
|
|
1657
1649
|
var J = 0, K = W === r.length - 1 || j[j.length - 1] instanceof X;
|
|
1658
1650
|
E && j.length > 1 && !K && (J = (w - N) / H), j.forEach(function(U) {
|
|
1659
|
-
|
|
1660
|
-
var $ = U.font,
|
|
1661
|
-
|
|
1651
|
+
a.font = U.font;
|
|
1652
|
+
var $ = U.font, ot = $.baseline ? c * -$.baseline + 0.15 * c : 0;
|
|
1653
|
+
a.fillStyle = function(Et, ht) {
|
|
1662
1654
|
return Et.color ? Et.color : ht.href ? "#00C" : "#000";
|
|
1663
1655
|
}($, U);
|
|
1664
1656
|
var nt = 0;
|
|
1665
|
-
if (b === "right" ? nt += w - N : b === "center" ? nt += w / 2 - N / 2 : b === "justify" && (U.whitespace || U instanceof X) && (F += J),
|
|
1666
|
-
|
|
1667
|
-
var ft = Math.floor(P + 0.45 *
|
|
1668
|
-
|
|
1657
|
+
if (b === "right" ? nt += w - N : b === "center" ? nt += w / 2 - N / 2 : b === "justify" && (U.whitespace || U instanceof X) && (F += J), a.fillText(U.value, F + nt, P + ot), U.href) {
|
|
1658
|
+
a.beginPath(), a.strokeStyle = a.fillStyle;
|
|
1659
|
+
var ft = Math.floor(P + 0.45 * c) + 0.5;
|
|
1660
|
+
a.moveTo(F + nt, ft), a.lineTo(F + nt + U.width, ft), a.stroke();
|
|
1669
1661
|
}
|
|
1670
1662
|
F += U.width;
|
|
1671
1663
|
});
|
|
@@ -1680,8 +1672,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1680
1672
|
}, re(r);
|
|
1681
1673
|
}
|
|
1682
1674
|
function _e(r) {
|
|
1683
|
-
for (var i = {},
|
|
1684
|
-
var t = r[
|
|
1675
|
+
for (var i = {}, a = 0; a < r.length; a++) {
|
|
1676
|
+
var t = r[a];
|
|
1685
1677
|
typeof t != "number" && t != null && (typeof t == "string" ? i.text = t : typeof t == "function" ? i.fn = t : re(t) === "object" && t._groups ? i.d3 = t : t && t.nodeType && t.getContext ? i.ctx = t.getContext("2d") : t && t.fillText && t.beginPath ? i.ctx = t : t && (i.text = t));
|
|
1686
1678
|
}
|
|
1687
1679
|
return i;
|
|
@@ -1694,20 +1686,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1694
1686
|
}, dt(r);
|
|
1695
1687
|
}
|
|
1696
1688
|
function Se(r, i) {
|
|
1697
|
-
for (var
|
|
1698
|
-
var t = i[
|
|
1699
|
-
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(r, (
|
|
1700
|
-
if (dt(
|
|
1701
|
-
var m =
|
|
1689
|
+
for (var a = 0; a < i.length; a++) {
|
|
1690
|
+
var t = i[a];
|
|
1691
|
+
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(r, (s = function(c, p) {
|
|
1692
|
+
if (dt(c) !== "object" || c === null) return c;
|
|
1693
|
+
var m = c[Symbol.toPrimitive];
|
|
1702
1694
|
if (m !== void 0) {
|
|
1703
|
-
var w = m.call(
|
|
1695
|
+
var w = m.call(c, p);
|
|
1704
1696
|
if (dt(w) !== "object") return w;
|
|
1705
1697
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1706
1698
|
}
|
|
1707
|
-
return String(
|
|
1708
|
-
}(t.key, "string"), dt(
|
|
1699
|
+
return String(c);
|
|
1700
|
+
}(t.key, "string"), dt(s) === "symbol" ? s : String(s)), t);
|
|
1709
1701
|
}
|
|
1710
|
-
var
|
|
1702
|
+
var s;
|
|
1711
1703
|
}
|
|
1712
1704
|
var wt = R(), St = function(r) {
|
|
1713
1705
|
return typeof r == "function" ? r : function() {
|
|
@@ -1715,25 +1707,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1715
1707
|
};
|
|
1716
1708
|
}, G = function() {
|
|
1717
1709
|
function r(t) {
|
|
1718
|
-
if (function(
|
|
1719
|
-
if (!(
|
|
1710
|
+
if (function(c, p) {
|
|
1711
|
+
if (!(c instanceof p)) throw new TypeError("Cannot call a class as a function");
|
|
1720
1712
|
}(this, r), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
|
|
1721
1713
|
return 1 / 0;
|
|
1722
1714
|
}, height: function() {
|
|
1723
1715
|
return 1 / 0;
|
|
1724
1716
|
}, x: function() {
|
|
1725
1717
|
return 0;
|
|
1726
|
-
}, font: null, tAnchor: 0, parser: r.defaultparser }, t) for (var
|
|
1718
|
+
}, font: null, tAnchor: 0, parser: r.defaultparser }, t) for (var s in t) typeof this[s] == "function" && this[s](t[s]);
|
|
1727
1719
|
}
|
|
1728
|
-
var i,
|
|
1729
|
-
return i = r,
|
|
1730
|
-
var
|
|
1720
|
+
var i, a;
|
|
1721
|
+
return i = r, a = [{ key: "linebreak", value: function(t) {
|
|
1722
|
+
var s = this, c = this.props.parser(String(t)), p = this.font(), m = function(w, b, E) {
|
|
1731
1723
|
if (!w.length) return [];
|
|
1732
1724
|
var D = b.height(), T = b.width(), O = b.overflowLine(), j = b.overflowWrap(), W = R(E, !0, !1), F = isFinite(D()) ? Math.floor(D() / E.height) : 1 / 0;
|
|
1733
1725
|
if (!D() && !T(0) || !F) return [];
|
|
1734
1726
|
for (var P = 0, H = 0, N = 0, J = [], K = [], U = !1; P < w.length && H < F; ) {
|
|
1735
|
-
var $ = w[P],
|
|
1736
|
-
if ($.width = B($,
|
|
1727
|
+
var $ = w[P], ot = Ee($, E);
|
|
1728
|
+
if ($.width = B($, ot), $.font = ot, $.line = H, $.whitespace = $.value in C, $.value && ($.value = $.value.replace(Ve, " ")), !(!N && $.whitespace || U && $.whitespace)) if ($ instanceof X) N = 0, K = [], J.push(P + 1), H++;
|
|
1737
1729
|
else if ($ instanceof lt || $ instanceof ut) K.push({ index: P, width: N });
|
|
1738
1730
|
else if ($.whitespace || N + $.width < T(H)) N += $.width;
|
|
1739
1731
|
else if (K.length) {
|
|
@@ -1785,9 +1777,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1785
1777
|
ue.font = E, ue.width = B(Y, W), te(De, Q, ue), Z.hasOverflow = !0;
|
|
1786
1778
|
} else Z.hasOverflow = !1;
|
|
1787
1779
|
return Z.font = E, Z.width = pt, Z;
|
|
1788
|
-
}(
|
|
1780
|
+
}(c, this, p);
|
|
1789
1781
|
return m.height = m.length * p.height, m.render = function(w) {
|
|
1790
|
-
return
|
|
1782
|
+
return s.render(m, w);
|
|
1791
1783
|
}, m.svg = m.render, m.draw = m.render, m;
|
|
1792
1784
|
} }, { key: "font", value: function(t) {
|
|
1793
1785
|
return arguments.length ? (this.props.font = R(t), this) : this.props.font || R(wt);
|
|
@@ -1799,12 +1791,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1799
1791
|
return arguments.length ? (this.props.valign = t, this) : this.props.valign;
|
|
1800
1792
|
} }, { key: "align", value: function(t) {
|
|
1801
1793
|
if (!arguments.length) return this.props.align;
|
|
1802
|
-
var
|
|
1803
|
-
return
|
|
1794
|
+
var s = String(t).toLowerCase();
|
|
1795
|
+
return s === "left" || s === "start" ? (this.props.align = "left", this.props.tAnchor = 0) : s === "center" || s === "middle" ? (this.props.align = "center", this.props.tAnchor = -0.5) : s === "end" || s === "right" ? (this.props.align = "right", this.props.tAnchor = -1) : s === "justify" && (this.props.align = t, this.props.tAnchor = 0), this;
|
|
1804
1796
|
} }, { key: "overflowWrap", value: function(t) {
|
|
1805
1797
|
if (!arguments.length) return this.props.overflowWrap || "normal";
|
|
1806
|
-
var
|
|
1807
|
-
return
|
|
1798
|
+
var s = String(t).toLowerCase();
|
|
1799
|
+
return s === "break-word" ? this.props.overflowWrap = "break-word" : s !== "normal" && t != null || (this.props.overflowWrap = null), this;
|
|
1808
1800
|
} }, { key: "width", value: function(t) {
|
|
1809
1801
|
return arguments.length ? (this.props.width = St(t), this) : this.props.width;
|
|
1810
1802
|
} }, { key: "height", value: function(t) {
|
|
@@ -1814,8 +1806,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1814
1806
|
} }, { key: "parser", value: function(t) {
|
|
1815
1807
|
if (!arguments.length) return this.props.parser;
|
|
1816
1808
|
if (typeof t == "string") {
|
|
1817
|
-
var
|
|
1818
|
-
typeof
|
|
1809
|
+
var s = r[t] || r[t + "parser"];
|
|
1810
|
+
typeof s == "function" && (t = s);
|
|
1819
1811
|
}
|
|
1820
1812
|
if (typeof t != "function") throw new Error("Unknown parser: " + t);
|
|
1821
1813
|
return this.props.parser = t, this;
|
|
@@ -1824,7 +1816,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1824
1816
|
} }, { key: "render", value: function() {
|
|
1825
1817
|
var t = _e(arguments);
|
|
1826
1818
|
return typeof t.text == "string" && (t.text = this.linebreak(t.text)), t.ctx ? Ke(t.text, this, t.ctx) : Ge(t.text, this);
|
|
1827
|
-
} }],
|
|
1819
|
+
} }], a && Se(i.prototype, a), Object.defineProperty(i, "prototype", { writable: !1 }), r;
|
|
1828
1820
|
}();
|
|
1829
1821
|
function xt(r) {
|
|
1830
1822
|
return xt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
|
|
@@ -1835,24 +1827,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1835
1827
|
}
|
|
1836
1828
|
function ne(r, i) {
|
|
1837
1829
|
(i == null || i > r.length) && (i = r.length);
|
|
1838
|
-
for (var
|
|
1830
|
+
for (var a = 0, t = new Array(i); a < i; a++) t[a] = r[a];
|
|
1839
1831
|
return t;
|
|
1840
1832
|
}
|
|
1841
1833
|
function Ce(r, i) {
|
|
1842
|
-
for (var
|
|
1843
|
-
var t = i[
|
|
1844
|
-
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(r, (
|
|
1845
|
-
if (xt(
|
|
1846
|
-
var m =
|
|
1834
|
+
for (var a = 0; a < i.length; a++) {
|
|
1835
|
+
var t = i[a];
|
|
1836
|
+
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(r, (s = function(c, p) {
|
|
1837
|
+
if (xt(c) !== "object" || c === null) return c;
|
|
1838
|
+
var m = c[Symbol.toPrimitive];
|
|
1847
1839
|
if (m !== void 0) {
|
|
1848
|
-
var w = m.call(
|
|
1840
|
+
var w = m.call(c, p);
|
|
1849
1841
|
if (xt(w) !== "object") return w;
|
|
1850
1842
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1851
1843
|
}
|
|
1852
|
-
return String(
|
|
1853
|
-
}(t.key, "string"), xt(
|
|
1844
|
+
return String(c);
|
|
1845
|
+
}(t.key, "string"), xt(s) === "symbol" ? s : String(s)), t);
|
|
1854
1846
|
}
|
|
1855
|
-
var
|
|
1847
|
+
var s;
|
|
1856
1848
|
}
|
|
1857
1849
|
var Te = function(r) {
|
|
1858
1850
|
return typeof r == "function" ? r : function() {
|
|
@@ -1860,19 +1852,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1860
1852
|
};
|
|
1861
1853
|
}, ie = function() {
|
|
1862
1854
|
function r(t) {
|
|
1863
|
-
if (function(
|
|
1864
|
-
if (!(
|
|
1855
|
+
if (function(c, p) {
|
|
1856
|
+
if (!(c instanceof p)) throw new TypeError("Cannot call a class as a function");
|
|
1865
1857
|
}(this, r), this.props = { width: function() {
|
|
1866
1858
|
return 1 / 0;
|
|
1867
1859
|
}, height: function() {
|
|
1868
1860
|
return 1 / 0;
|
|
1869
|
-
}, rotation: 0, vAnchor: 0, hAnchor: 0 }, t) for (var
|
|
1861
|
+
}, rotation: 0, vAnchor: 0, hAnchor: 0 }, t) for (var s in t) typeof this[s] == "function" && this[s](t[s]);
|
|
1870
1862
|
this.render = this.render.bind(this);
|
|
1871
1863
|
}
|
|
1872
|
-
var i,
|
|
1873
|
-
return i = r,
|
|
1874
|
-
var
|
|
1875
|
-
if (!arguments.length) return [
|
|
1864
|
+
var i, a;
|
|
1865
|
+
return i = r, a = [{ key: "anchor", value: function(t) {
|
|
1866
|
+
var s = this.props, c = s.hAnchor, p = s.vAnchor, m = s.width, w = s.height;
|
|
1867
|
+
if (!arguments.length) return [c * m(0), p * w(0)];
|
|
1876
1868
|
if (typeof t == "string") {
|
|
1877
1869
|
var b = this.props;
|
|
1878
1870
|
t.toLowerCase().trim().split(/\s+/).forEach(function(E) {
|
|
@@ -1888,78 +1880,78 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1888
1880
|
return arguments.length ? (this.props.rotation = t, this) : this.props.rotation;
|
|
1889
1881
|
} }, { key: "createElement", value: function(t) {
|
|
1890
1882
|
return arguments.length ? (this.props.createElement = t, this) : this.props.createElement || r.createElement;
|
|
1891
|
-
} }, { key: "canvas", value: function(t,
|
|
1892
|
-
var
|
|
1883
|
+
} }, { key: "canvas", value: function(t, s) {
|
|
1884
|
+
var c, p = t.getContext ? t.getContext("2d") : t;
|
|
1893
1885
|
return p.save(), p.rotate(this.rotate() * Math.PI / 180), p.translate.apply(p, function(m) {
|
|
1894
1886
|
if (Array.isArray(m)) return ne(m);
|
|
1895
|
-
}(
|
|
1887
|
+
}(c = this.anchor()) || function(m) {
|
|
1896
1888
|
if (typeof Symbol < "u" && m[Symbol.iterator] != null || m["@@iterator"] != null) return Array.from(m);
|
|
1897
|
-
}(
|
|
1889
|
+
}(c) || function(m, w) {
|
|
1898
1890
|
if (m) {
|
|
1899
1891
|
if (typeof m == "string") return ne(m, w);
|
|
1900
1892
|
var b = Object.prototype.toString.call(m).slice(8, -1);
|
|
1901
1893
|
return b === "Object" && m.constructor && (b = m.constructor.name), b === "Map" || b === "Set" ? Array.from(m) : b === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b) ? ne(m, w) : void 0;
|
|
1902
1894
|
}
|
|
1903
|
-
}(
|
|
1895
|
+
}(c) || function() {
|
|
1904
1896
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1905
1897
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1906
|
-
}()),
|
|
1898
|
+
}()), s(p), p.restore(), p;
|
|
1907
1899
|
} }, { key: "render", value: function() {
|
|
1908
1900
|
var t = _e(arguments);
|
|
1909
1901
|
if (t.d3) return t.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
|
|
1910
1902
|
if (t.ctx) return this.canvas(t.ctx, t.fn);
|
|
1911
1903
|
if (t.text) {
|
|
1912
|
-
var
|
|
1913
|
-
return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") },
|
|
1904
|
+
var s = typeof t.text.render == "function" ? t.text.render() : t.text;
|
|
1905
|
+
return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, s);
|
|
1914
1906
|
}
|
|
1915
|
-
} }],
|
|
1916
|
-
}(), Re = Object.prototype.hasOwnProperty,
|
|
1907
|
+
} }], a && Ce(i.prototype, a), Object.defineProperty(i, "prototype", { writable: !1 }), r;
|
|
1908
|
+
}(), Re = Object.prototype.hasOwnProperty, oe = {};
|
|
1917
1909
|
function Ze(r) {
|
|
1918
|
-
return
|
|
1919
|
-
return
|
|
1920
|
-
})),
|
|
1910
|
+
return oe[r] || (oe[r] = r.replace(/([a-z])([A-Z])/g, function(i, a, t) {
|
|
1911
|
+
return a + "-" + t.toLowerCase();
|
|
1912
|
+
})), oe[r];
|
|
1921
1913
|
}
|
|
1922
|
-
function
|
|
1923
|
-
if (Array.isArray(i)) return i.forEach(function(
|
|
1924
|
-
return
|
|
1914
|
+
function se(r, i) {
|
|
1915
|
+
if (Array.isArray(i)) return i.forEach(function(a) {
|
|
1916
|
+
return se(r, a);
|
|
1925
1917
|
});
|
|
1926
1918
|
typeof i == "string" && (i = document.createTextNode(i)), r.appendChild(i);
|
|
1927
1919
|
}
|
|
1928
1920
|
function ae(r, i) {
|
|
1929
1921
|
if (typeof document < "u") {
|
|
1930
|
-
var
|
|
1931
|
-
if (i &&
|
|
1932
|
-
for (var
|
|
1933
|
-
return
|
|
1934
|
-
|
|
1935
|
-
}),
|
|
1922
|
+
var a = typeof r == "string" ? document.createElementNS("http://www.w3.org/2000/svg", r) : r;
|
|
1923
|
+
if (i && a.setAttribute) for (var t in i) Re.call(i, t) && i[t] != null && a.setAttribute(t === "className" ? "class" : Ze(t), i[t]);
|
|
1924
|
+
for (var s = arguments.length, c = new Array(s > 2 ? s - 2 : 0), p = 2; p < s; p++) c[p - 2] = arguments[p];
|
|
1925
|
+
return c != null && c.length && c.forEach(function(m) {
|
|
1926
|
+
se(a, m);
|
|
1927
|
+
}), a;
|
|
1936
1928
|
}
|
|
1937
1929
|
}
|
|
1938
1930
|
G.createElement = ae, G.textparser = kt, G.defaultparser = kt, G.htmlparser = function(r) {
|
|
1939
1931
|
r = String(r || "").trim();
|
|
1940
|
-
for (var i,
|
|
1932
|
+
for (var i, a, t = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, s = [], c = [], p = function(D) {
|
|
1941
1933
|
for (var T in t) t[T] && (D[T] = t[T]);
|
|
1942
|
-
|
|
1934
|
+
s.push(D);
|
|
1943
1935
|
}, m = function(D) {
|
|
1944
|
-
var T =
|
|
1936
|
+
var T = s.length, O = Be[D];
|
|
1945
1937
|
if (T && O) {
|
|
1946
|
-
for (var j = T - 1;
|
|
1947
|
-
for (; O &&
|
|
1948
|
-
for (; O-- > 0; )
|
|
1938
|
+
for (var j = T - 1; s[j] && (s[j] instanceof lt || He.test(s[j].value)); ) j--;
|
|
1939
|
+
for (; O && s[j] && s[j] instanceof X; ) j--, O--;
|
|
1940
|
+
for (; O-- > 0; ) s.push(new X());
|
|
1949
1941
|
}
|
|
1950
1942
|
}; r.length; ) {
|
|
1951
1943
|
if (i = /^[^<]+/.exec(r)) kt(Zt(i[0]), !1).forEach(p);
|
|
1952
|
-
else if (!(i = $t.exec(r))) if (i = Gt.exec(r))
|
|
1944
|
+
else if (!(i = $t.exec(r))) if (i = Gt.exec(r)) c.length && (t = c.pop()), m(i[1]);
|
|
1953
1945
|
else if (i = Jt.exec(r)) {
|
|
1954
1946
|
var w = i[1];
|
|
1955
|
-
m(w),
|
|
1947
|
+
m(w), c.push(t), t = Object.create(t), _t[w] && _t[w](t, "");
|
|
1956
1948
|
var b = It(i[2]);
|
|
1957
|
-
w === "a" && (b.href && (t.href = b.href), b.rel && (t.rel = b.rel), b.target && (t.target = b.target)), b.class && (t.class = t.class ? t.class + " " + b.class : b.class), b.style && (
|
|
1949
|
+
w === "a" && (b.href && (t.href = b.href), b.rel && (t.rel = b.rel), b.target && (t.target = b.target)), b.class && (t.class = t.class ? t.class + " " + b.class : b.class), b.style && (a = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(b.style)) && a[1] && (t.color = a[1]), w === "br" && s.push(new X());
|
|
1958
1950
|
} else i = [r.slice(0, 1)], p(new M(i[0]));
|
|
1959
1951
|
r = r.slice(i[0].length);
|
|
1960
1952
|
}
|
|
1961
|
-
for (var E =
|
|
1962
|
-
return
|
|
1953
|
+
for (var E = s[s.length - 1]; E instanceof X; ) s.pop(), E = s[s.length - 1];
|
|
1954
|
+
return s;
|
|
1963
1955
|
}, G.latexparser = function(r) {
|
|
1964
1956
|
r = String(r || "").trim();
|
|
1965
1957
|
var i = [0];
|
|
@@ -1978,23 +1970,23 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1978
1970
|
}).replace(/\\verb,(.*?),/, function(F, P) {
|
|
1979
1971
|
return "\\verb,".concat(i[+P], ",");
|
|
1980
1972
|
});
|
|
1981
|
-
for (var
|
|
1973
|
+
for (var a, t = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, s = [], c = [], p = function(F) {
|
|
1982
1974
|
for (var P in t) t[P] && (F[P] = t[P]);
|
|
1983
|
-
return
|
|
1975
|
+
return s.push(F), F;
|
|
1984
1976
|
}, m = function() {
|
|
1985
|
-
|
|
1977
|
+
c.push(t), t = Object.create(t);
|
|
1986
1978
|
}, w = function() {
|
|
1987
|
-
if (!
|
|
1988
|
-
t =
|
|
1989
|
-
}, b = { tokens:
|
|
1990
|
-
if (
|
|
1991
|
-
else if (
|
|
1992
|
-
else if (!(
|
|
1993
|
-
if (
|
|
1994
|
-
else if (
|
|
1995
|
-
else if (!(
|
|
1996
|
-
else if (
|
|
1997
|
-
var E =
|
|
1979
|
+
if (!c.length) throw new Error("Unexpected }");
|
|
1980
|
+
t = c.pop();
|
|
1981
|
+
}, b = { tokens: s, open_context: m, close_context: w, add_token: p }; r.length; ) {
|
|
1982
|
+
if (a = jt.exec(r)) kt(a[0], !1).forEach(p);
|
|
1983
|
+
else if (a = Ue.exec(r)) p(new M(a[1]));
|
|
1984
|
+
else if (!(a = xe.exec(r))) {
|
|
1985
|
+
if (a = /^\{/.exec(r)) m();
|
|
1986
|
+
else if (a = /^\}/.exec(r)) w();
|
|
1987
|
+
else if (!(a = /^\$/.exec(r))) if (a = /^\\verb,([^,]+),/.exec(r)) p(new M(a[1]));
|
|
1988
|
+
else if (a = we.exec(r)) {
|
|
1989
|
+
var E = a[1].slice(1) || a[1], D = !!a[2];
|
|
1998
1990
|
if (/^(La)?TeX$/i.test(E)) {
|
|
1999
1991
|
m(), t.family = "serif";
|
|
2000
1992
|
var T = void 0;
|
|
@@ -2003,42 +1995,42 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2003
1995
|
else if (E in q) {
|
|
2004
1996
|
var O = [], j = q[E].length - 1, W = void 0;
|
|
2005
1997
|
if (j) {
|
|
2006
|
-
for (D = !1, r = r.slice(
|
|
1998
|
+
for (D = !1, r = r.slice(a[0].length - 1); j--; ) {
|
|
2007
1999
|
if (!(W = /^\{([^}]+)\}/.exec(r))) throw new Error(E + " is missing an argument");
|
|
2008
2000
|
O.push(W[1]), r = r.slice(W[0].length);
|
|
2009
2001
|
}
|
|
2010
|
-
|
|
2002
|
+
a[0] = /^\{/.exec(r) ? "{" : "", D = !!a[0];
|
|
2011
2003
|
}
|
|
2012
2004
|
D && m(), q[E].apply(b, [t].concat(O));
|
|
2013
|
-
} else console.warn("unknown latex command", E), p(new M(
|
|
2014
|
-
} else
|
|
2005
|
+
} else console.warn("unknown latex command", E), p(new M(a[1])), D && m();
|
|
2006
|
+
} else a = [r.slice(0, 1)], p(new M(a[0]));
|
|
2015
2007
|
}
|
|
2016
|
-
r = r.slice(
|
|
2008
|
+
r = r.slice(a[0].length);
|
|
2017
2009
|
}
|
|
2018
|
-
return
|
|
2019
|
-
}, G.measureText = function(r, i,
|
|
2020
|
-
return B(r, R(i),
|
|
2010
|
+
return s;
|
|
2011
|
+
}, G.measureText = function(r, i, a) {
|
|
2012
|
+
return B(r, R(i), a);
|
|
2021
2013
|
}, G.Token = M, G.Break = lt, G.LineBreak = X, G.SoftHyphen = ut, G.Rotator = ie, ie.createElement = ae;
|
|
2022
2014
|
const Qe = G;
|
|
2023
2015
|
return n.default;
|
|
2024
2016
|
})());
|
|
2025
2017
|
}(dr)), dr.exports;
|
|
2026
2018
|
}
|
|
2027
|
-
var
|
|
2028
|
-
const Tr = /* @__PURE__ */ Ur(
|
|
2019
|
+
var Cn = Sn();
|
|
2020
|
+
const Tr = /* @__PURE__ */ Ur(Cn);
|
|
2029
2021
|
function ir(u) {
|
|
2030
2022
|
return u.replace(/…$/, "");
|
|
2031
2023
|
}
|
|
2032
|
-
function
|
|
2024
|
+
function or(u) {
|
|
2033
2025
|
return u.children[0].innerHTML;
|
|
2034
2026
|
}
|
|
2035
|
-
function
|
|
2036
|
-
const
|
|
2037
|
-
if (
|
|
2027
|
+
function Tn(u, e) {
|
|
2028
|
+
const o = mt(u), { fontSize: n, font: l, padding: h = 0 } = u.properties.style || {};
|
|
2029
|
+
if (o.width === o.height && o.width === 0) return;
|
|
2038
2030
|
const f = new Tr({
|
|
2039
|
-
font: `${n}px/${n}px ${
|
|
2040
|
-
width:
|
|
2041
|
-
height:
|
|
2031
|
+
font: `${n}px/${n}px ${l}`.replace(/(px)+/g, "px"),
|
|
2032
|
+
width: o.width - h * 2,
|
|
2033
|
+
height: o.height - h * 2,
|
|
2042
2034
|
align: "left",
|
|
2043
2035
|
valign: "top",
|
|
2044
2036
|
x: 0,
|
|
@@ -2062,17 +2054,17 @@ function Pn(u, e) {
|
|
|
2062
2054
|
`) || y.push(v), v++;
|
|
2063
2055
|
break;
|
|
2064
2056
|
}
|
|
2065
|
-
const C = ir(
|
|
2057
|
+
const C = ir(or(d[v]));
|
|
2066
2058
|
R.startsWith(C) && (R = R.slice(C.length).trim()), v++;
|
|
2067
2059
|
}
|
|
2068
2060
|
}), y.forEach((S) => g.removeChild(d[S]));
|
|
2069
2061
|
const A = u.properties.content.match(/(https?:\/\/.*)/gm), _ = A ? A.map((S) => S.split(" ")[0]) : [];
|
|
2070
|
-
g.setAttribute("transform", `translate(${
|
|
2062
|
+
g.setAttribute("transform", `translate(${h}, ${h})`), _.forEach((S) => {
|
|
2071
2063
|
let R = S;
|
|
2072
2064
|
const C = [];
|
|
2073
2065
|
for (; R.length > 0; ) {
|
|
2074
2066
|
const L = d.find(
|
|
2075
|
-
(k) => !!k.children[0] && k.children[0].tagName === "tspan" && R.startsWith(ir(
|
|
2067
|
+
(k) => !!k.children[0] && k.children[0].tagName === "tspan" && R.startsWith(ir(or(k)))
|
|
2076
2068
|
);
|
|
2077
2069
|
if (!L) break;
|
|
2078
2070
|
C.push(L);
|
|
@@ -2082,13 +2074,13 @@ function Pn(u, e) {
|
|
|
2082
2074
|
}
|
|
2083
2075
|
C.forEach((L) => {
|
|
2084
2076
|
const I = document.createElementNS("http://www.w3.org/2000/svg", "a");
|
|
2085
|
-
I.setAttribute("href", S), I.setAttribute("target", "_blank"), I.innerHTML =
|
|
2077
|
+
I.setAttribute("href", S), I.setAttribute("target", "_blank"), I.innerHTML = or(L), L.children[0].innerHTML = "", L.children[0].appendChild(I);
|
|
2086
2078
|
});
|
|
2087
2079
|
}), e.appendChild(g);
|
|
2088
2080
|
}
|
|
2089
2081
|
const Rr = 20;
|
|
2090
|
-
class
|
|
2091
|
-
constructor(e,
|
|
2082
|
+
class Rn extends Vr {
|
|
2083
|
+
constructor(e, o = {}) {
|
|
2092
2084
|
super(
|
|
2093
2085
|
e,
|
|
2094
2086
|
`
|
|
@@ -2108,72 +2100,72 @@ class Ln extends Vr {
|
|
|
2108
2100
|
this.textArea.value === this.placeholder && (this.textArea.value = ""), this.isFocused = !0;
|
|
2109
2101
|
}), x(this, "_onBlur", () => {
|
|
2110
2102
|
this.isFocused = !1;
|
|
2111
|
-
}), x(this, "startDrawing", (
|
|
2103
|
+
}), x(this, "startDrawing", (l, h, f = kn(l, h, 0, 0, "", Wt)) => {
|
|
2112
2104
|
this.add(f);
|
|
2113
|
-
const g = this.ogma.view.graphToScreenCoordinates({ x:
|
|
2105
|
+
const g = this.ogma.view.graphToScreenCoordinates({ x: l, y: h });
|
|
2114
2106
|
this.select(f.id), this.startDragging(this.getById(f.id), g.x, g.y), this.draggedHandle = 6;
|
|
2115
2107
|
}), x(this, "cancelDrawing", () => {
|
|
2116
2108
|
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...nr }, this.draggedHandle = V, this.isDragging = !1, this.emit(Ut, this.annotation));
|
|
2117
|
-
}), x(this, "startDragging", (
|
|
2118
|
-
this.annotation =
|
|
2109
|
+
}), x(this, "startDragging", (l, h, f) => {
|
|
2110
|
+
this.annotation = l;
|
|
2119
2111
|
const g = vt(this.annotation), d = mt(this.annotation);
|
|
2120
|
-
this.rect.x = g.x, this.rect.y = g.y, this.rect.width = d.width, this.rect.height = d.height, this.startX =
|
|
2121
|
-
}), x(this, "onHandleMouseDown", (
|
|
2122
|
-
const
|
|
2123
|
-
if (!
|
|
2124
|
-
this.selectedId !==
|
|
2125
|
-
const { x: f, y: g } =
|
|
2126
|
-
this.startDragging(
|
|
2127
|
-
}), x(this, "onMouseMove", (
|
|
2128
|
-
requestAnimationFrame(() => this._onMouseMove(
|
|
2129
|
-
}), x(this, "_onMouseMove", (
|
|
2112
|
+
this.rect.x = g.x, this.rect.y = g.y, this.rect.width = d.width, this.rect.height = d.height, this.startX = h, this.startY = f, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(ze, this.annotation), this.isDragging = !0;
|
|
2113
|
+
}), x(this, "onHandleMouseDown", (l) => {
|
|
2114
|
+
const h = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
2115
|
+
if (!h) return;
|
|
2116
|
+
this.selectedId !== h.id && this.select(this.hoveredId);
|
|
2117
|
+
const { x: f, y: g } = sr(l, this.ogma.getContainer());
|
|
2118
|
+
this.startDragging(h, f, g), this.draggedHandle = Nr(l.target);
|
|
2119
|
+
}), x(this, "onMouseMove", (l) => {
|
|
2120
|
+
requestAnimationFrame(() => this._onMouseMove(l));
|
|
2121
|
+
}), x(this, "_onMouseMove", (l) => {
|
|
2130
2122
|
if (!this.isDragging) return;
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2133
|
-
let f =
|
|
2134
|
-
const g =
|
|
2135
|
-
let y =
|
|
2123
|
+
l.stopPropagation(), l.preventDefault();
|
|
2124
|
+
const h = this.handles[this.draggedHandle];
|
|
2125
|
+
let f = h.classList.contains("top");
|
|
2126
|
+
const g = h.classList.contains("left"), d = h.classList.contains("right"), v = h.classList.contains("bottom");
|
|
2127
|
+
let y = h.classList.contains("line-handle");
|
|
2136
2128
|
!y && !f && !v && !g && !d && (f = !0, y = !0);
|
|
2137
|
-
const { x: A, y: _ } =
|
|
2138
|
-
|
|
2129
|
+
const { x: A, y: _ } = sr(
|
|
2130
|
+
l,
|
|
2139
2131
|
this.ogma.getContainer()
|
|
2140
2132
|
);
|
|
2141
2133
|
let S = this.rect.x, R = this.rect.y, C = Math.max(this.rect.width, Rr), L = Math.max(this.rect.height, Rr);
|
|
2142
|
-
const I = this.ogma.view.getZoom(), k = (A - this.startX) / I, z = (_ - this.startY) / I, B = this.ogma.view.getAngle(), tt =
|
|
2134
|
+
const I = this.ogma.view.getZoom(), k = (A - this.startX) / I, z = (_ - this.startY) / I, B = this.ogma.view.getAngle(), tt = st({ x: k, y: z }, B), rt = st({ x: k, y: z }, -B);
|
|
2143
2135
|
y ? (S = this.rect.x + tt.x, R = this.rect.y + tt.y) : g && f ? (S += tt.x, R += tt.y, C -= k, L -= z) : d && v ? (C += k, L += z) : g && v ? (S += rt.x, C -= rt.x, L += rt.y) : d && f && (R += rt.y, C += rt.x, L -= rt.y), hn(this.annotation, S, R, C, L), this.emit(Me, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
|
|
2144
2136
|
}), x(this, "onMouseUp", () => {
|
|
2145
2137
|
!this.isDragging || this.draggedHandle === V || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(Ut, this.annotation), this.isDragging = !1, this.draggedHandle = V);
|
|
2146
|
-
}), x(this, "_onMousedown", (
|
|
2147
|
-
|
|
2138
|
+
}), x(this, "_onMousedown", (l) => {
|
|
2139
|
+
l.stopPropagation();
|
|
2148
2140
|
}), x(this, "onViewChanged", () => {
|
|
2149
|
-
const
|
|
2150
|
-
document.documentElement.style.setProperty("--handle-scale", `${1 /
|
|
2141
|
+
const l = Math.max(2, this.handleSize / this.ogma.view.getZoom());
|
|
2142
|
+
document.documentElement.style.setProperty("--handle-scale", `${1 / l}`), this.ogma.view.getAngle() === 0 ? this.editor.element.classList.remove("rotated") : this.editor.element.classList.add("rotated");
|
|
2151
2143
|
}), x(this, "_onInput", () => {
|
|
2152
|
-
const
|
|
2153
|
-
|
|
2144
|
+
const l = this.getById(this.selectedId);
|
|
2145
|
+
l && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), l.properties.content = this.textArea.value, this.emit(cr, l), this.layer.refresh());
|
|
2154
2146
|
}), this.showeditorOnHover = !1, this.handleSize = Sr.handleSize, this.placeholder = Sr.placeholder;
|
|
2155
2147
|
const n = this.textArea = this.editor.element.querySelector("textarea");
|
|
2156
2148
|
n.addEventListener("input", this._onInput), n.addEventListener("focus", this._onFocus), n.addEventListener("blur", this._onBlur), n.addEventListener("mousedown", this._onMousedown), n.spellcheck = !1, this.handles = Array.prototype.slice.call(
|
|
2157
2149
|
this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
|
|
2158
2150
|
), this.handles.push(this.editor.element), this.handles.forEach(
|
|
2159
|
-
(
|
|
2151
|
+
(l) => l.addEventListener("mousedown", this.onHandleMouseDown)
|
|
2160
2152
|
), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0), e.events.on(["viewChanged", "zoom"], this.onViewChanged);
|
|
2161
2153
|
}
|
|
2162
2154
|
_canRemove() {
|
|
2163
2155
|
return !this.isFocused;
|
|
2164
2156
|
}
|
|
2165
|
-
detect({ x: e, y:
|
|
2166
|
-
const
|
|
2157
|
+
detect({ x: e, y: o }, n = 0) {
|
|
2158
|
+
const l = { x: e, y: o }, h = this.ogma.view.getAngle();
|
|
2167
2159
|
return this.elements.find((f) => {
|
|
2168
|
-
const { x: g, y: d } = vt(f), { width: v, height: y } = mt(f), A = { x: g, y: d }, { x: _, y: S } =
|
|
2160
|
+
const { x: g, y: d } = vt(f), { width: v, height: y } = mt(f), A = { x: g, y: d }, { x: _, y: S } = st(Ot(l, A), -h);
|
|
2169
2161
|
return _ > -n && _ < v + n && S > -n && S < y + n;
|
|
2170
2162
|
});
|
|
2171
2163
|
}
|
|
2172
2164
|
draw(e) {
|
|
2173
2165
|
e.innerHTML = "";
|
|
2174
|
-
const
|
|
2175
|
-
for (let
|
|
2176
|
-
const f = this.elements[
|
|
2166
|
+
const o = "", n = this.ogma.view.getAngle();
|
|
2167
|
+
for (let h = 0; h < this.elements.length; h++) {
|
|
2168
|
+
const f = this.elements[h], g = `class${h}`, d = mt(f), v = vt(f);
|
|
2177
2169
|
if (f.id === this.selectedId) continue;
|
|
2178
2170
|
const {
|
|
2179
2171
|
color: y,
|
|
@@ -2189,20 +2181,20 @@ class Ln extends Vr {
|
|
|
2189
2181
|
const z = Rt("rect");
|
|
2190
2182
|
I && (z.setAttribute("rx", `${I}`), z.setAttribute("ry", `${I}`));
|
|
2191
2183
|
let B = !1;
|
|
2192
|
-
C && C !== "none" && (B = !0, z.setAttribute("stroke", S || "black"), z.setAttribute("stroke-width", `${R}`), C === "dashed" && z.setAttribute("stroke-dasharray", "5,5")), (L && L.length || B) && (B = !0, z.setAttribute("fill", L || "transparent")), B && (z.setAttribute("width", `${d.width}`), z.setAttribute("height", `${d.height}`)), k.appendChild(z),
|
|
2193
|
-
const { x: tt, y: rt } =
|
|
2184
|
+
C && C !== "none" && (B = !0, z.setAttribute("stroke", S || "black"), z.setAttribute("stroke-width", `${R}`), C === "dashed" && z.setAttribute("stroke-dasharray", "5,5")), (L && L.length || B) && (B = !0, z.setAttribute("fill", L || "transparent")), B && (z.setAttribute("width", `${d.width}`), z.setAttribute("height", `${d.height}`)), k.appendChild(z), Tn(f, k);
|
|
2185
|
+
const { x: tt, y: rt } = st(v, -n);
|
|
2194
2186
|
k.setAttribute("transform", `translate(${tt},${rt})`), k.classList.add(g), k.setAttribute("data-annotation", `${f.id}`), k.setAttribute("data-annotation-type", "text"), e.appendChild(k);
|
|
2195
2187
|
}
|
|
2196
|
-
const
|
|
2197
|
-
|
|
2188
|
+
const l = Rt("style");
|
|
2189
|
+
l.innerHTML = o, e.firstChild && e.insertBefore(l, e.firstChild);
|
|
2198
2190
|
}
|
|
2199
2191
|
refreshDrawing() {
|
|
2200
|
-
const e = this.ogma.view.getAngle(),
|
|
2201
|
-
for (let n = 0; n <
|
|
2202
|
-
const
|
|
2203
|
-
if (!
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2192
|
+
const e = this.ogma.view.getAngle(), o = this.layer.element.children;
|
|
2193
|
+
for (let n = 0; n < o.length; n++) {
|
|
2194
|
+
const l = o[n];
|
|
2195
|
+
if (!l.hasAttribute("data-annotation")) continue;
|
|
2196
|
+
const h = l.getAttribute("data-annotation"), f = vt(this.getById(h)), { x: g, y: d } = st(f, -e);
|
|
2197
|
+
l.setAttribute("transform", `translate(${g},${d})`);
|
|
2206
2198
|
}
|
|
2207
2199
|
}
|
|
2208
2200
|
getDefaultOptions() {
|
|
@@ -2210,20 +2202,20 @@ class Ln extends Vr {
|
|
|
2210
2202
|
}
|
|
2211
2203
|
refreshEditor() {
|
|
2212
2204
|
if (+this.selectedId < 0 && +this.hoveredId < 0) return;
|
|
2213
|
-
const e = this.getById(this.selectedId) || this.getById(this.hoveredId),
|
|
2205
|
+
const e = this.getById(this.selectedId) || this.getById(this.hoveredId), o = mt(e), n = this.ogma.view.graphToScreenCoordinates(
|
|
2214
2206
|
vt(e)
|
|
2215
|
-
),
|
|
2216
|
-
font:
|
|
2207
|
+
), l = this.ogma.view.getZoom(), {
|
|
2208
|
+
font: h,
|
|
2217
2209
|
fontSize: f,
|
|
2218
2210
|
color: g,
|
|
2219
2211
|
background: d,
|
|
2220
2212
|
padding: v = 0
|
|
2221
|
-
} = e.properties.style || Wt, y = (f || 1) *
|
|
2213
|
+
} = e.properties.style || Wt, y = (f || 1) * l;
|
|
2222
2214
|
this.textArea.value = e.properties.content;
|
|
2223
2215
|
const A = this.editor.element.style;
|
|
2224
|
-
A.transform = `translate(${n.x}px, ${n.y}px)translate(-50%, -50%)translate(${
|
|
2216
|
+
A.transform = `translate(${n.x}px, ${n.y}px)translate(-50%, -50%)translate(${o.width / 2 * l}px, ${o.height / 2 * l}px)`, A.width = `${o.width * l}px`, A.height = `${o.height * l}px`;
|
|
2225
2217
|
const _ = this.textArea.style;
|
|
2226
|
-
_.font = `${y} ${
|
|
2218
|
+
_.font = `${y} ${h}`, _.fontFamily = h || "sans-serif", _.fontSize = `${y}px`, _.padding = `${l * v}px`, _.lineHeight = `${y}px`, _.boxSizing = "border-box", _.color = g || "black", _.background = d || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
|
|
2227
2219
|
}
|
|
2228
2220
|
select(e) {
|
|
2229
2221
|
super.select(e), this.textArea.classList.add("noevents");
|
|
@@ -2232,35 +2224,35 @@ class Ln extends Vr {
|
|
|
2232
2224
|
super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
|
|
2233
2225
|
}
|
|
2234
2226
|
}
|
|
2235
|
-
class
|
|
2227
|
+
class On {
|
|
2236
2228
|
constructor() {
|
|
2237
2229
|
x(this, "links", {}), x(this, "linksByTargetId", {}), x(this, "linksByArrowId", {});
|
|
2238
2230
|
}
|
|
2239
|
-
add(e,
|
|
2231
|
+
add(e, o, n, l, h) {
|
|
2240
2232
|
const f = Ne(), g = e.id, d = {
|
|
2241
2233
|
id: f,
|
|
2242
2234
|
arrow: g,
|
|
2243
2235
|
target: n,
|
|
2244
|
-
targetType:
|
|
2245
|
-
connectionPoint:
|
|
2246
|
-
side:
|
|
2236
|
+
targetType: l,
|
|
2237
|
+
connectionPoint: h,
|
|
2238
|
+
side: o
|
|
2247
2239
|
};
|
|
2248
|
-
return this.links[f] = d, this.linksByTargetId[n] || (this.linksByTargetId[n] = []), this.linksByTargetId[n].push(f), this.linksByArrowId[g] || (this.linksByArrowId[g] = {}), this.linksByArrowId[g][
|
|
2240
|
+
return this.links[f] = d, this.linksByTargetId[n] || (this.linksByTargetId[n] = []), this.linksByTargetId[n].push(f), this.linksByArrowId[g] || (this.linksByArrowId[g] = {}), this.linksByArrowId[g][o] = f, e.properties.link = e.properties.link || {}, e.properties.link[o] = {
|
|
2249
2241
|
id: n,
|
|
2250
|
-
side:
|
|
2251
|
-
type:
|
|
2252
|
-
magnet:
|
|
2242
|
+
side: o,
|
|
2243
|
+
type: l,
|
|
2244
|
+
magnet: h
|
|
2253
2245
|
}, this;
|
|
2254
2246
|
}
|
|
2255
|
-
arrowIsLinked(e,
|
|
2247
|
+
arrowIsLinked(e, o) {
|
|
2256
2248
|
var n;
|
|
2257
|
-
return !!((n = this.linksByArrowId[e]) != null && n[
|
|
2249
|
+
return !!((n = this.linksByArrowId[e]) != null && n[o]);
|
|
2258
2250
|
}
|
|
2259
2251
|
// remove the link between the arrow and the target by arrow id and side
|
|
2260
|
-
remove(e,
|
|
2261
|
-
var n,
|
|
2262
|
-
const
|
|
2263
|
-
if ((
|
|
2252
|
+
remove(e, o) {
|
|
2253
|
+
var n, l;
|
|
2254
|
+
const h = e.id, f = (n = this.linksByArrowId[h]) == null ? void 0 : n[o];
|
|
2255
|
+
if ((l = e.properties.link) == null || delete l[o], !f) return this;
|
|
2264
2256
|
const g = this.links[f];
|
|
2265
2257
|
delete this.links[f];
|
|
2266
2258
|
const d = this.linksByTargetId[g.target];
|
|
@@ -2269,22 +2261,22 @@ class $n {
|
|
|
2269
2261
|
d.splice(v, 1);
|
|
2270
2262
|
break;
|
|
2271
2263
|
}
|
|
2272
|
-
return delete this.linksByArrowId[
|
|
2264
|
+
return delete this.linksByArrowId[h][o], this;
|
|
2273
2265
|
}
|
|
2274
|
-
getArrowLink(e,
|
|
2266
|
+
getArrowLink(e, o) {
|
|
2275
2267
|
var n;
|
|
2276
|
-
const
|
|
2277
|
-
return
|
|
2268
|
+
const l = (n = this.linksByArrowId[e]) == null ? void 0 : n[o];
|
|
2269
|
+
return l ? this.links[l] : null;
|
|
2278
2270
|
}
|
|
2279
|
-
getTargetLinks(e,
|
|
2271
|
+
getTargetLinks(e, o) {
|
|
2280
2272
|
var n;
|
|
2281
|
-
return ((n = this.linksByTargetId[e]) == null ? void 0 : n.map((
|
|
2273
|
+
return ((n = this.linksByTargetId[e]) == null ? void 0 : n.map((l) => this.links[l]).filter((l) => l.targetType === o)) ?? [];
|
|
2282
2274
|
}
|
|
2283
2275
|
forEach(e) {
|
|
2284
2276
|
Object.values(this.links).forEach(e);
|
|
2285
2277
|
}
|
|
2286
2278
|
}
|
|
2287
|
-
const at = (u) => u.properties.type === "arrow", yt = (u) => u.properties.type === "text", Or = (u) => u.type === "FeatureCollection",
|
|
2279
|
+
const at = (u) => u.properties.type === "arrow", yt = (u) => u.properties.type === "text", Or = (u) => u.type === "FeatureCollection", Dn = {
|
|
2288
2280
|
magnetColor: "#3e8",
|
|
2289
2281
|
detectMargin: 20,
|
|
2290
2282
|
magnetHandleRadius: 5,
|
|
@@ -2304,56 +2296,56 @@ const at = (u) => u.properties.type === "arrow", yt = (u) => u.properties.type =
|
|
|
2304
2296
|
{ x: 0.5, y: 1 },
|
|
2305
2297
|
{ x: 1, y: 1 }
|
|
2306
2298
|
];
|
|
2307
|
-
class
|
|
2308
|
-
constructor(e,
|
|
2309
|
-
super(), x(this, "arrows"), x(this, "texts"), x(this, "links", new
|
|
2299
|
+
class Pn extends Yr {
|
|
2300
|
+
constructor(e, o = {}) {
|
|
2301
|
+
super(), x(this, "arrows"), x(this, "texts"), x(this, "links", new On()), x(this, "layer"), x(this, "annotations"), x(this, "ogma"), x(this, "options"), x(this, "selected", null), x(this, "updateTimeout", 0), x(this, "hoveredNode", null), x(this, "dragged", null), x(this, "textToMagnet"), x(this, "activeLinks", []), x(this, "_render", (n) => {
|
|
2310
2302
|
if (!this.dragged || this.textToMagnet === void 0) return;
|
|
2311
2303
|
n.beginPath(), n.fillStyle = "green";
|
|
2312
|
-
const
|
|
2313
|
-
Pr.forEach((
|
|
2304
|
+
const l = this.ogma.view.getZoom();
|
|
2305
|
+
Pr.forEach((h) => {
|
|
2314
2306
|
if (!this.textToMagnet) return;
|
|
2315
|
-
const f = mt(this.textToMagnet), g = vt(this.textToMagnet), d = Ie(
|
|
2316
|
-
n.moveTo(y, A), n.arc(y, A, this.options.magnetHandleRadius /
|
|
2307
|
+
const f = mt(this.textToMagnet), g = vt(this.textToMagnet), d = Ie(h, { x: f.width, y: f.height }), v = st(d, this.ogma.view.getAngle()), { x: y, y: A } = Bt(v, g);
|
|
2308
|
+
n.moveTo(y, A), n.arc(y, A, this.options.magnetHandleRadius / l, 0, Math.PI * 2);
|
|
2317
2309
|
}), n.fill(), n.closePath();
|
|
2318
|
-
}), x(this, "_onFeatureDrag", (n,
|
|
2319
|
-
const
|
|
2320
|
-
if (at(n) &&
|
|
2310
|
+
}), x(this, "_onFeatureDrag", (n, l) => {
|
|
2311
|
+
const h = l;
|
|
2312
|
+
if (at(n) && h === "line")
|
|
2321
2313
|
["start", "end"].find((f) => {
|
|
2322
2314
|
const g = f === "start" ? de(n) : je(n);
|
|
2323
|
-
return this._snapToText(n,
|
|
2315
|
+
return this._snapToText(n, h, g) || this._findAndSnapToNode(n, f, g);
|
|
2324
2316
|
});
|
|
2325
|
-
else if (at(n) &&
|
|
2326
|
-
const f =
|
|
2327
|
-
this._snapToText(n,
|
|
2317
|
+
else if (at(n) && h !== "line") {
|
|
2318
|
+
const f = h === "start" ? de(n) : je(n);
|
|
2319
|
+
this._snapToText(n, h, f) || this._findAndSnapToNode(n, h, f);
|
|
2328
2320
|
} else yt(n) && (this.activeLinks.forEach(({ arrow: f, side: g, connectionPoint: d }) => {
|
|
2329
|
-
const v = this.getAnnotation(f), y = mt(n), A = vt(n), _ = Ie(d, { x: y.width, y: y.height }), S =
|
|
2321
|
+
const v = this.getAnnotation(f), y = mt(n), A = vt(n), _ = Ie(d, { x: y.width, y: y.height }), S = st(_, this.ogma.view.getAngle()), R = Bt(S, A);
|
|
2330
2322
|
v.geometry.coordinates[g === "start" ? 0 : 1] = [R.x, R.y];
|
|
2331
2323
|
}), this.activeLinks.length && this.arrows.refreshLayer());
|
|
2332
|
-
this.layer.refresh(), this.emit(Me, n,
|
|
2324
|
+
this.layer.refresh(), this.emit(Me, n, l);
|
|
2333
2325
|
}), x(this, "_onFeatureDragEnd", (n) => {
|
|
2334
|
-
this.dragged !== null && at(n) && de(this.dragged) && Dr.forEach((
|
|
2335
|
-
this.links.getArrowLink(n.id,
|
|
2326
|
+
this.dragged !== null && at(n) && de(this.dragged) && Dr.forEach((l) => {
|
|
2327
|
+
this.links.getArrowLink(n.id, l) && this.emit(wn, {
|
|
2336
2328
|
arrow: n,
|
|
2337
|
-
link: this.links.getArrowLink(n.id,
|
|
2329
|
+
link: this.links.getArrowLink(n.id, l)
|
|
2338
2330
|
});
|
|
2339
|
-
}), (yt(n) || at(n)) && this.onUpdate(n), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((
|
|
2331
|
+
}), (yt(n) || at(n)) && this.onUpdate(n), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((l) => l.enableDetection()), this.layer.refresh(), this.emit(Ut, n);
|
|
2340
2332
|
}), x(this, "_onFeatureDragStart", (n) => {
|
|
2341
|
-
this.textToMagnet = void 0, at(n) ? this.dragged = n : yt(n) && this.activeLinks.push(...this.links.getTargetLinks(n.id, "text")), this.annotations.forEach((
|
|
2342
|
-
const
|
|
2343
|
-
|
|
2333
|
+
this.textToMagnet = void 0, at(n) ? this.dragged = n : yt(n) && this.activeLinks.push(...this.links.getTargetLinks(n.id, "text")), this.annotations.forEach((l) => {
|
|
2334
|
+
const h = l.getSelectedFeature();
|
|
2335
|
+
h && h !== n && l.unhover().unselect(), l.disableDetection();
|
|
2344
2336
|
}), this.emit(ze, n);
|
|
2345
2337
|
}), x(this, "_onNodesDragStart", () => {
|
|
2346
2338
|
this.arrows.unhover().unselect(), this.texts.unhover().unselect();
|
|
2347
2339
|
}), x(this, "_onNodesDrag", (n) => {
|
|
2348
|
-
const { dx:
|
|
2349
|
-
this._moveNodes(n.nodes,
|
|
2340
|
+
const { dx: l, dy: h } = n;
|
|
2341
|
+
this._moveNodes(n.nodes, l, h);
|
|
2350
2342
|
}), x(this, "_onLayoutEnd", (n) => {
|
|
2351
|
-
n.ids.forEach((
|
|
2352
|
-
this.links.getTargetLinks(
|
|
2343
|
+
n.ids.forEach((l, h) => {
|
|
2344
|
+
this.links.getTargetLinks(l, "node").forEach((f) => {
|
|
2353
2345
|
const g = this.getAnnotation(f.arrow), d = f.side, v = Le(
|
|
2354
2346
|
g,
|
|
2355
2347
|
d === "start" ? "end" : "start"
|
|
2356
|
-
), y = n.positions.current[
|
|
2348
|
+
), y = n.positions.current[h], A = this.ogma.getNode(l).getAttribute("radius"), _ = $e(v, y, +A);
|
|
2357
2349
|
Ht(g, d, _.x, _.y);
|
|
2358
2350
|
});
|
|
2359
2351
|
}), this.arrows.refreshLayer(), this.texts.refreshLayer();
|
|
@@ -2371,56 +2363,56 @@ class jn extends Yr {
|
|
|
2371
2363
|
);
|
|
2372
2364
|
}), x(this, "_onUpdate", (n) => {
|
|
2373
2365
|
this.emit(cr, n);
|
|
2374
|
-
}), this.options = this.setOptions({ ...
|
|
2366
|
+
}), this.options = this.setOptions({ ...Dn, ...o }), this.ogma = e, this.arrows = new An(e, this.options), this.texts = new Rn(e, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((n) => {
|
|
2375
2367
|
n.on(ze, this._onFeatureDragStart).on(Me, this._onFeatureDrag).on(Ut, this._onFeatureDragEnd).on(cr, this.onUpdate).on(lr, this._onUnselect).on(ar, this._onSelect).on(hr, this._onAdded).on(ur, this._onRemoved);
|
|
2376
2368
|
}), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
|
|
2377
2369
|
this.refreshTextLinks();
|
|
2378
2370
|
}), this.layer = e.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
|
|
2379
2371
|
}
|
|
2380
|
-
_moveNodes(e,
|
|
2381
|
-
e.forEach((
|
|
2382
|
-
const
|
|
2383
|
-
|
|
2372
|
+
_moveNodes(e, o, n) {
|
|
2373
|
+
e.forEach((l) => {
|
|
2374
|
+
const h = this.links.getTargetLinks(l.getId(), "node"), f = l.getPosition();
|
|
2375
|
+
h.forEach((g) => {
|
|
2384
2376
|
const d = this.getAnnotation(g.arrow), v = g.side, y = Le(
|
|
2385
2377
|
d,
|
|
2386
2378
|
v === "start" ? "end" : "start"
|
|
2387
2379
|
);
|
|
2388
2380
|
let A = f;
|
|
2389
|
-
const _ = +
|
|
2390
|
-
(g.connectionPoint.x - (f.x -
|
|
2381
|
+
const _ = +l.getAttribute("radius"), S = 1e-6;
|
|
2382
|
+
(g.connectionPoint.x - (f.x - o) > S || g.connectionPoint.y - (f.y - n) > S) && (A = $e(y, f, _)), Ht(d, v, A.x, A.y);
|
|
2391
2383
|
});
|
|
2392
2384
|
}), this.arrows.refreshLayer();
|
|
2393
2385
|
}
|
|
2394
|
-
_snapToText(e,
|
|
2395
|
-
const
|
|
2396
|
-
if (this.links.remove(e,
|
|
2397
|
-
this.textToMagnet =
|
|
2398
|
-
const
|
|
2399
|
-
return
|
|
2386
|
+
_snapToText(e, o, n) {
|
|
2387
|
+
const l = this.texts.detect(n, this.options.detectMargin);
|
|
2388
|
+
if (this.links.remove(e, o), !l) return !1;
|
|
2389
|
+
this.textToMagnet = l;
|
|
2390
|
+
const h = this.findMagnetPoint(Pr, l, n);
|
|
2391
|
+
return h ? (Ht(e, o, h.point.x, h.point.y), this.links.add(e, o, l.id, "text", h.magnet), !0) : !1;
|
|
2400
2392
|
}
|
|
2401
|
-
_findAndSnapToNode(e,
|
|
2402
|
-
var
|
|
2393
|
+
_findAndSnapToNode(e, o, n) {
|
|
2394
|
+
var l, h;
|
|
2403
2395
|
const f = this.ogma.view.graphToScreenCoordinates(n), g = this.ogma.view.getElementAt(f);
|
|
2404
|
-
this.links.remove(e,
|
|
2396
|
+
this.links.remove(e, o), g && g.isNode ? ((l = this.hoveredNode) == null || l.setSelected(!1), this.hoveredNode = g, g.setSelected(!0), this._snapToNode(e, o, g, f)) : ((h = this.hoveredNode) == null || h.setSelected(!1), this.hoveredNode = null);
|
|
2405
2397
|
}
|
|
2406
|
-
_snapToNode(e,
|
|
2407
|
-
const
|
|
2398
|
+
_snapToNode(e, o, n, l) {
|
|
2399
|
+
const h = n.getPositionOnScreen(), f = +n.getAttribute("radius"), g = f * this.ogma.view.getZoom(), d = l.x - h.x, v = l.y - h.y, y = Math.sqrt(d * d + v * v), A = n.getPosition();
|
|
2408
2400
|
if (y < g + this.options.detectMargin) {
|
|
2409
2401
|
let _ = A;
|
|
2410
2402
|
if (y > g / 2) {
|
|
2411
|
-
const S = Le(e,
|
|
2403
|
+
const S = Le(e, o === "end" ? "start" : "end");
|
|
2412
2404
|
_ = $e(S, _, f);
|
|
2413
2405
|
}
|
|
2414
|
-
Ht(e,
|
|
2406
|
+
Ht(e, o, _.x, _.y), this.links.add(e, o, n.getId(), "node", _);
|
|
2415
2407
|
}
|
|
2416
2408
|
}
|
|
2417
2409
|
refreshTextLinks() {
|
|
2418
2410
|
let e = !1;
|
|
2419
2411
|
this.links.forEach(
|
|
2420
|
-
({ connectionPoint:
|
|
2412
|
+
({ connectionPoint: o, targetType: n, target: l, arrow: h, side: f }) => {
|
|
2421
2413
|
if (n !== "text") return;
|
|
2422
2414
|
e = !0;
|
|
2423
|
-
const g = this.getAnnotation(
|
|
2415
|
+
const g = this.getAnnotation(l), d = this.getAnnotation(h), v = mt(g), y = vt(g), A = Ie(o, { x: v.width, y: v.height }), _ = st(A, this.ogma.view.getAngle()), S = Bt(_, y);
|
|
2424
2416
|
Ht(d, f, S.x, S.y);
|
|
2425
2417
|
}
|
|
2426
2418
|
), e && this.arrows.refreshLayer();
|
|
@@ -2431,24 +2423,24 @@ class jn extends Yr {
|
|
|
2431
2423
|
getSelected() {
|
|
2432
2424
|
return this.selected;
|
|
2433
2425
|
}
|
|
2434
|
-
findMagnetPoint(e,
|
|
2435
|
-
let
|
|
2436
|
-
for (const
|
|
2437
|
-
const f = mt(
|
|
2426
|
+
findMagnetPoint(e, o, n) {
|
|
2427
|
+
let l;
|
|
2428
|
+
for (const h of e) {
|
|
2429
|
+
const f = mt(o), g = vt(o), d = Ie(h, { x: f.width, y: f.height }), v = st(d, this.ogma.view.getAngle()), y = Bt(v, g), A = qt(Ot(y, n)), _ = Math.min(
|
|
2438
2430
|
this.options.magnetRadius * this.ogma.view.getZoom(),
|
|
2439
2431
|
// when really zoomed in: avoid to snap on too far away magnets
|
|
2440
2432
|
f.width / 2,
|
|
2441
2433
|
f.height / 2
|
|
2442
2434
|
);
|
|
2443
2435
|
if (A < Math.max(_, this.options.magnetHandleRadius)) {
|
|
2444
|
-
|
|
2436
|
+
l = {
|
|
2445
2437
|
point: y,
|
|
2446
|
-
magnet:
|
|
2438
|
+
magnet: h
|
|
2447
2439
|
};
|
|
2448
2440
|
break;
|
|
2449
2441
|
}
|
|
2450
2442
|
}
|
|
2451
|
-
return
|
|
2443
|
+
return l;
|
|
2452
2444
|
}
|
|
2453
2445
|
/**
|
|
2454
2446
|
* Set the options for the controller
|
|
@@ -2466,8 +2458,8 @@ class jn extends Yr {
|
|
|
2466
2458
|
* @param id the id of the annotation to select
|
|
2467
2459
|
*/
|
|
2468
2460
|
select(e) {
|
|
2469
|
-
const
|
|
2470
|
-
return
|
|
2461
|
+
const o = this.getAnnotations().features.find((n) => n.id === e);
|
|
2462
|
+
return o ? (at(o) ? this.arrows.select(o.id) : yt(o) && this.texts.select(o.id), this) : this;
|
|
2471
2463
|
}
|
|
2472
2464
|
/**
|
|
2473
2465
|
* Unselects the currently selected annotation
|
|
@@ -2481,11 +2473,11 @@ class jn extends Yr {
|
|
|
2481
2473
|
*/
|
|
2482
2474
|
add(e) {
|
|
2483
2475
|
if (Or(e)) {
|
|
2484
|
-
const [
|
|
2485
|
-
(
|
|
2476
|
+
const [o, n] = e.features.reduce(
|
|
2477
|
+
(l, h) => (at(h) ? l[1].push(h) : yt(h) && l[0].push(h), l),
|
|
2486
2478
|
[[], []]
|
|
2487
2479
|
);
|
|
2488
|
-
return
|
|
2480
|
+
return o.forEach((l) => this.add(l)), n.forEach((l) => this.add(l)), this.arrows.refreshLayer(), this;
|
|
2489
2481
|
}
|
|
2490
2482
|
switch (e.properties.type) {
|
|
2491
2483
|
case "text":
|
|
@@ -2504,26 +2496,26 @@ class jn extends Yr {
|
|
|
2504
2496
|
*/
|
|
2505
2497
|
remove(e) {
|
|
2506
2498
|
return Or(e) ? (e.features.forEach(
|
|
2507
|
-
(
|
|
2499
|
+
(o) => this.remove(o)
|
|
2508
2500
|
), this) : (at(e) ? (this.links.remove(e, "start"), this.links.remove(e, "end"), this.arrows.remove(e.id)) : this.texts.remove(e.id), this);
|
|
2509
2501
|
}
|
|
2510
2502
|
loadLink(e) {
|
|
2511
2503
|
if (e.properties.link)
|
|
2512
|
-
for (const
|
|
2513
|
-
const n = e.properties.link[
|
|
2504
|
+
for (const o of Dr) {
|
|
2505
|
+
const n = e.properties.link[o];
|
|
2514
2506
|
if (!n) continue;
|
|
2515
|
-
const
|
|
2516
|
-
if (n.type === "text" &&
|
|
2517
|
-
this.links.add(e,
|
|
2507
|
+
const l = this.getAnnotation(n.id);
|
|
2508
|
+
if (n.type === "text" && l)
|
|
2509
|
+
this.links.add(e, o, n.id, n.type, n.magnet);
|
|
2518
2510
|
else if (n.type === "node") {
|
|
2519
|
-
const
|
|
2520
|
-
if (!
|
|
2521
|
-
this.links.add(e,
|
|
2522
|
-
const f =
|
|
2511
|
+
const h = this.ogma.getNode(n.id);
|
|
2512
|
+
if (!h) continue;
|
|
2513
|
+
this.links.add(e, o, n.id, n.type, n.magnet);
|
|
2514
|
+
const f = h.getPosition(), g = h.getAttribute("radius") || 0, d = Le(
|
|
2523
2515
|
e,
|
|
2524
|
-
|
|
2516
|
+
o === "start" ? "end" : "start"
|
|
2525
2517
|
), v = $e(d, f, +g);
|
|
2526
|
-
Ht(e,
|
|
2518
|
+
Ht(e, o, v.x, v.y);
|
|
2527
2519
|
}
|
|
2528
2520
|
}
|
|
2529
2521
|
}
|
|
@@ -2533,8 +2525,8 @@ class jn extends Yr {
|
|
|
2533
2525
|
* @param y coord of the first point
|
|
2534
2526
|
* @param arrow The arrow to add
|
|
2535
2527
|
*/
|
|
2536
|
-
startArrow(e,
|
|
2537
|
-
this.cancelDrawing(), this.arrows.startDrawing(e,
|
|
2528
|
+
startArrow(e, o, n) {
|
|
2529
|
+
this.cancelDrawing(), this.arrows.startDrawing(e, o, n);
|
|
2538
2530
|
}
|
|
2539
2531
|
/**
|
|
2540
2532
|
* Start adding a text (add it, and give control to the user)
|
|
@@ -2542,30 +2534,29 @@ class jn extends Yr {
|
|
|
2542
2534
|
* @param y coord of the top left point
|
|
2543
2535
|
* @param text The text to add
|
|
2544
2536
|
*/
|
|
2545
|
-
startText(e,
|
|
2546
|
-
this.cancelDrawing(), this.texts.startDrawing(e,
|
|
2537
|
+
startText(e, o, n) {
|
|
2538
|
+
this.cancelDrawing(), this.texts.startDrawing(e, o, n);
|
|
2547
2539
|
}
|
|
2548
2540
|
/**
|
|
2549
2541
|
* Cancel drawing on the current frame
|
|
2550
2542
|
*/
|
|
2551
2543
|
cancelDrawing() {
|
|
2552
|
-
this.annotations.forEach((e) => e.cancelDrawing()), this.emit(
|
|
2544
|
+
this.annotations.forEach((e) => e.cancelDrawing()), this.emit(bn);
|
|
2553
2545
|
}
|
|
2554
2546
|
/**
|
|
2555
2547
|
* Update the style of the annotation with the given id
|
|
2556
2548
|
* @param id The id of the annotation to update
|
|
2557
2549
|
* @param style The new style
|
|
2558
2550
|
*/
|
|
2559
|
-
updateStyle(e,
|
|
2560
|
-
const n = this.getAnnotations().features.find((
|
|
2561
|
-
return n ? (at(n) ? this.arrows.updateStyle(n,
|
|
2551
|
+
updateStyle(e, o) {
|
|
2552
|
+
const n = this.getAnnotations().features.find((l) => l.id === e);
|
|
2553
|
+
return n ? (at(n) ? this.arrows.updateStyle(n, o) : yt(n) && this.texts.updateStyle(n, o), this.onUpdate(n), this) : this;
|
|
2562
2554
|
}
|
|
2563
|
-
setScale(e,
|
|
2564
|
-
const
|
|
2565
|
-
return
|
|
2555
|
+
setScale(e, o, n, l) {
|
|
2556
|
+
const h = this.getAnnotations().features.find((f) => f.id === e);
|
|
2557
|
+
return h ? (at(h) ? this.arrows.scale(h, o, n, l) : yt(h) && this.texts.scale(h, o, n, l), this.onUpdate(h), this) : this;
|
|
2566
2558
|
}
|
|
2567
2559
|
/**
|
|
2568
|
-
*
|
|
2569
2560
|
* @returns the annotations in the controller
|
|
2570
2561
|
*/
|
|
2571
2562
|
getAnnotations() {
|
|
@@ -2573,8 +2564,8 @@ class jn extends Yr {
|
|
|
2573
2564
|
type: "FeatureCollection",
|
|
2574
2565
|
features: []
|
|
2575
2566
|
};
|
|
2576
|
-
return this.annotations.forEach((
|
|
2577
|
-
e.features = [...e.features, ...
|
|
2567
|
+
return this.annotations.forEach((o) => {
|
|
2568
|
+
e.features = [...e.features, ...o.getElements()];
|
|
2578
2569
|
}), e;
|
|
2579
2570
|
}
|
|
2580
2571
|
/**
|
|
@@ -2583,7 +2574,7 @@ class jn extends Yr {
|
|
|
2583
2574
|
* @returns The annotation with the given id
|
|
2584
2575
|
*/
|
|
2585
2576
|
getAnnotation(e) {
|
|
2586
|
-
return this.getAnnotations().features.find((
|
|
2577
|
+
return this.getAnnotations().features.find((o) => o.id === e);
|
|
2587
2578
|
}
|
|
2588
2579
|
/**
|
|
2589
2580
|
* Destroy the controller and its elements
|
|
@@ -2592,7 +2583,7 @@ class jn extends Yr {
|
|
|
2592
2583
|
this.annotations.forEach((e) => e.destroy()), this.layer.destroy();
|
|
2593
2584
|
}
|
|
2594
2585
|
}
|
|
2595
|
-
const Lr = [8, 10, 12, 14, 16, 24, 32, 48, 64, 72], $r = "none", Xr = "#333333",
|
|
2586
|
+
const Lr = [8, 10, 12, 14, 16, 24, 32, 48, 64, 72], $r = "none", Xr = "#333333", Nn = [
|
|
2596
2587
|
"#FFFFFF",
|
|
2597
2588
|
"#F44E3B",
|
|
2598
2589
|
"#FE9200",
|
|
@@ -2605,7 +2596,7 @@ const Lr = [8, 10, 12, 14, 16, 24, 32, 48, 64, 72], $r = "none", Xr = "#333333",
|
|
|
2605
2596
|
"#333333",
|
|
2606
2597
|
"#808080",
|
|
2607
2598
|
"#cccccc"
|
|
2608
|
-
],
|
|
2599
|
+
], Hn = [
|
|
2609
2600
|
"Roboto",
|
|
2610
2601
|
"Helvetica Neue",
|
|
2611
2602
|
"Helvetica",
|
|
@@ -2617,33 +2608,33 @@ const Lr = [8, 10, 12, 14, 16, 24, 32, 48, 64, 72], $r = "none", Xr = "#333333",
|
|
|
2617
2608
|
"Consolas",
|
|
2618
2609
|
"Courier New",
|
|
2619
2610
|
"monospace"
|
|
2620
|
-
].sort((u, e) => u.toLocaleLowerCase().localeCompare(e.toLocaleLowerCase())),
|
|
2611
|
+
].sort((u, e) => u.toLocaleLowerCase().localeCompare(e.toLocaleLowerCase())), Ln = {
|
|
2621
2612
|
head: "arrow",
|
|
2622
2613
|
strokeColor: Xr,
|
|
2623
2614
|
strokeWidth: 5
|
|
2624
|
-
},
|
|
2615
|
+
}, $n = 0.25, In = {
|
|
2625
2616
|
font: "Roboto",
|
|
2626
2617
|
fontSize: Lr[2],
|
|
2627
|
-
padding: Lr[2] *
|
|
2618
|
+
padding: Lr[2] * $n,
|
|
2628
2619
|
color: Xr,
|
|
2629
2620
|
strokeType: $r,
|
|
2630
2621
|
background: $r
|
|
2631
2622
|
};
|
|
2632
|
-
function
|
|
2633
|
-
return u.reduce((e,
|
|
2623
|
+
function jn(u) {
|
|
2624
|
+
return u.reduce((e, o) => e + o, 0) / u.length;
|
|
2634
2625
|
}
|
|
2635
|
-
function
|
|
2636
|
-
return e + (
|
|
2626
|
+
function Bn(u, e = 0, o = 1) {
|
|
2627
|
+
return e + (o - e) * u;
|
|
2637
2628
|
}
|
|
2638
|
-
function
|
|
2639
|
-
return (u - e) / (
|
|
2629
|
+
function qn(u, e = 0, o = 1) {
|
|
2630
|
+
return (u - e) / (o - e);
|
|
2640
2631
|
}
|
|
2641
|
-
function
|
|
2632
|
+
function Wn() {
|
|
2642
2633
|
return jr(null);
|
|
2643
2634
|
}
|
|
2644
2635
|
const Gr = jr(
|
|
2645
2636
|
void 0
|
|
2646
|
-
),
|
|
2637
|
+
), Un = () => Kr(Gr), Fn = (u, e) => {
|
|
2647
2638
|
switch (e.type) {
|
|
2648
2639
|
case "add":
|
|
2649
2640
|
return {
|
|
@@ -2653,28 +2644,28 @@ const Gr = jr(
|
|
|
2653
2644
|
case "remove":
|
|
2654
2645
|
return {
|
|
2655
2646
|
...u,
|
|
2656
|
-
features: u.features.filter((
|
|
2647
|
+
features: u.features.filter((o) => o.id !== e.payload.id)
|
|
2657
2648
|
};
|
|
2658
2649
|
case "update":
|
|
2659
2650
|
return {
|
|
2660
2651
|
...u,
|
|
2661
2652
|
features: u.features.map(
|
|
2662
|
-
(
|
|
2653
|
+
(o) => o.id === e.payload.id ? e.payload : o
|
|
2663
2654
|
)
|
|
2664
2655
|
};
|
|
2665
2656
|
default:
|
|
2666
2657
|
return u;
|
|
2667
2658
|
}
|
|
2668
|
-
},
|
|
2669
|
-
const e = Qr(), [
|
|
2659
|
+
}, Yn = ({ children: u }) => {
|
|
2660
|
+
const e = Qr(), [o, n] = Zr(Fn, {
|
|
2670
2661
|
type: "FeatureCollection",
|
|
2671
2662
|
features: []
|
|
2672
|
-
}), [
|
|
2663
|
+
}), [l, h] = Nt(null), [f, g] = Nt(Ln), [d, v] = Nt(In), [y, A] = Nt(), [_, S] = Nt(1), [R, C] = Nt(1);
|
|
2673
2664
|
return rr(() => {
|
|
2674
2665
|
if (!e) return;
|
|
2675
|
-
const L = new
|
|
2666
|
+
const L = new Pn(e, {
|
|
2676
2667
|
minArrowHeight: 1
|
|
2677
|
-
}), I =
|
|
2668
|
+
}), I = jn(e.getNodes().getAttribute("radius")) / 5, k = _;
|
|
2678
2669
|
return g({
|
|
2679
2670
|
...f,
|
|
2680
2671
|
strokeWidth: (f.strokeWidth || 1) * k
|
|
@@ -2683,24 +2674,24 @@ const Gr = jr(
|
|
|
2683
2674
|
...z.properties.style || {}
|
|
2684
2675
|
}) : yt(z) && v({
|
|
2685
2676
|
...z.properties.style || {}
|
|
2686
|
-
}),
|
|
2677
|
+
}), h(z);
|
|
2687
2678
|
}).on("unselect", () => {
|
|
2688
|
-
|
|
2679
|
+
h(null);
|
|
2689
2680
|
}), A(L), () => {
|
|
2690
2681
|
y == null || y.destroy();
|
|
2691
2682
|
};
|
|
2692
2683
|
}, [e]), rr(() => {
|
|
2693
|
-
y &&
|
|
2694
|
-
}, [y, f,
|
|
2695
|
-
y &&
|
|
2696
|
-
}, [y, d,
|
|
2684
|
+
y && l && (l == null ? void 0 : l.properties.type) === "arrow" && y.updateStyle(l.id, f);
|
|
2685
|
+
}, [y, f, l]), rr(() => {
|
|
2686
|
+
y && l && (l == null ? void 0 : l.properties.type) === "text" && y.updateStyle(l.id, d);
|
|
2687
|
+
}, [y, d, l]), /* @__PURE__ */ nn.jsx(
|
|
2697
2688
|
Gr.Provider,
|
|
2698
2689
|
{
|
|
2699
2690
|
value: {
|
|
2700
|
-
annotations:
|
|
2691
|
+
annotations: o,
|
|
2701
2692
|
updateAnnotations: n,
|
|
2702
|
-
currentAnnotation:
|
|
2703
|
-
setCurrentAnnotation:
|
|
2693
|
+
currentAnnotation: l,
|
|
2694
|
+
setCurrentAnnotation: h,
|
|
2704
2695
|
textStyle: d,
|
|
2705
2696
|
setTextStyle: v,
|
|
2706
2697
|
arrowStyle: f,
|
|
@@ -2718,18 +2709,18 @@ const Gr = jr(
|
|
|
2718
2709
|
};
|
|
2719
2710
|
export {
|
|
2720
2711
|
Gr as AnnotationsContext,
|
|
2721
|
-
|
|
2712
|
+
Yn as AnnotationsContextProvider,
|
|
2722
2713
|
Xr as BLACK,
|
|
2723
|
-
|
|
2714
|
+
$n as RELATIVE_PADDING,
|
|
2724
2715
|
$r as TRANSPARENT,
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2716
|
+
Wn as createAnnotationsContext,
|
|
2717
|
+
Ln as defaultArrowStyle,
|
|
2718
|
+
Nn as defaultColors,
|
|
2719
|
+
In as defaultTextStyle,
|
|
2729
2720
|
Lr as fontSizes,
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2721
|
+
Hn as fonts,
|
|
2722
|
+
Bn as interpolate,
|
|
2723
|
+
jn as mean,
|
|
2724
|
+
qn as normalize,
|
|
2725
|
+
Un as useAnnotationsContext
|
|
2735
2726
|
};
|