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