@linkurious/ogma-annotations 1.1.12 → 1.1.14
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/LICENSE +201 -0
- package/Readme.md +139 -0
- package/dist/index.js +11 -11
- package/dist/index.mjs +1035 -1484
- package/dist/style.css +1 -1
- package/dist/types/Editor/Arrows/index.d.ts +1 -1
- package/dist/types/Editor/Arrows/render.d.ts +1 -1
- package/dist/types/Editor/Texts/index.d.ts +1 -1
- package/dist/types/Editor/base.d.ts +2 -3
- package/dist/types/links.d.ts +2 -2
- package/dist/types/types.d.ts +23 -16
- package/dist/types/vec.d.ts +15 -0
- package/package.json +10 -9
package/dist/index.mjs
CHANGED
|
@@ -1,498 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
function fe(u) {
|
|
6
|
-
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
7
|
-
}
|
|
8
|
-
var Re = { exports: {} };
|
|
9
|
-
(function(u) {
|
|
10
|
-
(function(l, t) {
|
|
11
|
-
u.exports = t();
|
|
12
|
-
})("Vector", function() {
|
|
13
|
-
var l = function() {
|
|
14
|
-
var t = Math.PI * 2, r = 180 / Math.PI, a = Math.PI / 180;
|
|
15
|
-
function h(s) {
|
|
16
|
-
return Math.round(s * 1e8) / 1e8;
|
|
17
|
-
}
|
|
18
|
-
function f(s, d) {
|
|
19
|
-
var m = d.x - s.x, A = d.y - s.y;
|
|
20
|
-
return Math.sqrt(m * m + A * A);
|
|
21
|
-
}
|
|
22
|
-
function g(s, d, m) {
|
|
23
|
-
var A = d.y - s.y, T = d.x - s.x, b = Math.atan2(A, T);
|
|
24
|
-
if (m)
|
|
25
|
-
for (; b < 0; )
|
|
26
|
-
b += t;
|
|
27
|
-
return b;
|
|
28
|
-
}
|
|
29
|
-
function p(s, d) {
|
|
30
|
-
this.x = s !== void 0 ? s : 0, this.y = d !== void 0 ? d : 0;
|
|
31
|
-
}
|
|
32
|
-
return p.fromRadians = function(s) {
|
|
33
|
-
var d = Math.cos(s), m = Math.sin(s);
|
|
34
|
-
return new p(d, m);
|
|
35
|
-
}, p.fromDegrees = function(s) {
|
|
36
|
-
var d = s * (Math.PI / 180);
|
|
37
|
-
return p.fromRadians(d);
|
|
38
|
-
}, p.fromString = function(s) {
|
|
39
|
-
var d = s.split(",");
|
|
40
|
-
return new p(parseFloat(d[0]), parseFloat(d[1]));
|
|
41
|
-
}, p.fromArray = function(s) {
|
|
42
|
-
return new p(s[0], s[1]);
|
|
43
|
-
}, p.prototype = {
|
|
44
|
-
// version
|
|
45
|
-
version: "2.0.1",
|
|
46
|
-
// [API]
|
|
47
|
-
// [chainable, clone]
|
|
48
|
-
// clone the vector and return the cloned instance.
|
|
49
|
-
// @return cloned vector.
|
|
50
|
-
clone: function() {
|
|
51
|
-
return new p(this.x, this.y);
|
|
52
|
-
},
|
|
53
|
-
// [API]
|
|
54
|
-
// []
|
|
55
|
-
// Get if equal to another vector
|
|
56
|
-
// @param vector - other vector to compare with.
|
|
57
|
-
// @return if vectors are equal.
|
|
58
|
-
equals: function(s) {
|
|
59
|
-
return this.prototype === s.prototype && this.x === s.x && this.y === s.y;
|
|
60
|
-
},
|
|
61
|
-
// [API]
|
|
62
|
-
// [chainable, changeSelf]
|
|
63
|
-
// set values from another vector. this changes value of self.
|
|
64
|
-
// @param vector - other vector to get values from.
|
|
65
|
-
// @return self.
|
|
66
|
-
copy: function(s) {
|
|
67
|
-
return this.x = s.x, this.y = s.y, this;
|
|
68
|
-
},
|
|
69
|
-
// [API]
|
|
70
|
-
// [chainable, changeSelf]
|
|
71
|
-
// set only the x component from another vector.
|
|
72
|
-
// @return self.
|
|
73
|
-
copyX: function(s) {
|
|
74
|
-
return this.x = s.x, this;
|
|
75
|
-
},
|
|
76
|
-
// [API]
|
|
77
|
-
// [chainable, changeSelf]
|
|
78
|
-
// set only the y component from another vector.
|
|
79
|
-
// @return self.
|
|
80
|
-
copyY: function(s) {
|
|
81
|
-
return this.y = s.y, this;
|
|
82
|
-
},
|
|
83
|
-
// [API]
|
|
84
|
-
// []
|
|
85
|
-
// convert to a dictionary with {x, y}.
|
|
86
|
-
// @return a dictionary representation of the vector.
|
|
87
|
-
toDict: function() {
|
|
88
|
-
return { x: this.x, y: this.y };
|
|
89
|
-
},
|
|
90
|
-
// [API]
|
|
91
|
-
// []
|
|
92
|
-
// convert to array with [x, y].
|
|
93
|
-
// @return an array representation of the vector.
|
|
94
|
-
toArray: function() {
|
|
95
|
-
return [this.x, this.y];
|
|
96
|
-
},
|
|
97
|
-
// [API]
|
|
98
|
-
// [chainable, changeSelf]
|
|
99
|
-
// set values from x, y.
|
|
100
|
-
// @param x - optional x component to set.
|
|
101
|
-
// @param y - optional y component to set.
|
|
102
|
-
// @return self.
|
|
103
|
-
set: function(s, d) {
|
|
104
|
-
return s !== void 0 && (this.x = s), d !== void 0 && (this.y = d), this;
|
|
105
|
-
},
|
|
106
|
-
// [API]
|
|
107
|
-
// [chainable, clone]
|
|
108
|
-
// clone and flip between x and y values.
|
|
109
|
-
// @return cloned vector with flipped x and y components.
|
|
110
|
-
flipXY: function() {
|
|
111
|
-
return new p(this.y, this.x);
|
|
112
|
-
},
|
|
113
|
-
// [API]
|
|
114
|
-
// [chainable, changeSelf]
|
|
115
|
-
// flip between x and y values.
|
|
116
|
-
// @return self.
|
|
117
|
-
flipXYSelf: function() {
|
|
118
|
-
return this.y = [this.x, this.x = this.y][0], this;
|
|
119
|
-
},
|
|
120
|
-
// [API]
|
|
121
|
-
// [chainable, clone]
|
|
122
|
-
// clone and invert x and y values (like multiply with -1, eg x, y => -x, -y)
|
|
123
|
-
// @return cloned vector with inverted values.
|
|
124
|
-
invert: function() {
|
|
125
|
-
return this.mulScalar(-1);
|
|
126
|
-
},
|
|
127
|
-
// [API]
|
|
128
|
-
// [chainable, changeSelf]
|
|
129
|
-
// invert x and y values (like multiply with -1, eg x, y => -x, -y)
|
|
130
|
-
// @return self.
|
|
131
|
-
invertSelf: function() {
|
|
132
|
-
return this.mulScalarSelf(-1), this;
|
|
133
|
-
},
|
|
134
|
-
// [API]
|
|
135
|
-
// []
|
|
136
|
-
// get the distance from another vector.
|
|
137
|
-
// @param other - vector to get distance from.
|
|
138
|
-
// @return distance between vectors.
|
|
139
|
-
distanceFrom: function(s) {
|
|
140
|
-
return f(this, s);
|
|
141
|
-
},
|
|
142
|
-
// [API]
|
|
143
|
-
// []
|
|
144
|
-
// get angle from another vector in radians.
|
|
145
|
-
// @return angle in radians from this to other.
|
|
146
|
-
radiansTo: function(s) {
|
|
147
|
-
return g(this, s, !0);
|
|
148
|
-
},
|
|
149
|
-
// [API]
|
|
150
|
-
// []
|
|
151
|
-
// get degrees from another vector in degrees.
|
|
152
|
-
// @return angle in degrees from this to other.
|
|
153
|
-
degreesTo: function(s) {
|
|
154
|
-
return g(this, s, !0) * r;
|
|
155
|
-
},
|
|
156
|
-
// [API]
|
|
157
|
-
// []
|
|
158
|
-
// convert this vector to a radian angle.
|
|
159
|
-
// this is equivalent to doing Vector.zero.radiansTo(this).
|
|
160
|
-
// @return angle in radians.
|
|
161
|
-
toRadians: function(s) {
|
|
162
|
-
return g(p.zero, this, !0);
|
|
163
|
-
},
|
|
164
|
-
// [API]
|
|
165
|
-
// []
|
|
166
|
-
// convert this vector to degree.
|
|
167
|
-
// this is equivalent to doing Vector.zero.degreeTo(this).
|
|
168
|
-
// @return angle in degrees (0-360).
|
|
169
|
-
toDegrees: function(s) {
|
|
170
|
-
return this.toRadians() * r;
|
|
171
|
-
},
|
|
172
|
-
// [API]
|
|
173
|
-
// [chainable, changeSelf]
|
|
174
|
-
// rotate this vector by a given degree.
|
|
175
|
-
// @param degrees - degrees to rotate this vector by (can be positive or negative).
|
|
176
|
-
// @return self.
|
|
177
|
-
rotateDegreesSelf: function(s) {
|
|
178
|
-
return this.rotateRadiansSelf(s * a);
|
|
179
|
-
},
|
|
180
|
-
// [API]
|
|
181
|
-
// [chainable]
|
|
182
|
-
// clone and rotate the vector by a given degree.
|
|
183
|
-
// @param degrees - degree to rotate this vector by (can be positive or negative).
|
|
184
|
-
// @return cloned rotated vector.
|
|
185
|
-
rotateDegrees: function(s) {
|
|
186
|
-
return this.clone().rotateDegreesSelf(s);
|
|
187
|
-
},
|
|
188
|
-
// [API]
|
|
189
|
-
// [chainable, changeSelf]
|
|
190
|
-
// rotate this vector by a given radian.
|
|
191
|
-
// @param radians - radians to rotate this vector by (can be positive or negative).
|
|
192
|
-
// @return self.
|
|
193
|
-
rotateRadiansSelf: function(s) {
|
|
194
|
-
var d = Math.cos(s), m = Math.sin(s), A = this.x * d - this.y * m, T = this.x * m + this.y * d;
|
|
195
|
-
return this.x = h(A), this.y = h(T), this;
|
|
196
|
-
},
|
|
197
|
-
// [API]
|
|
198
|
-
// [chainable]
|
|
199
|
-
// clone and rotate the vector by a given degree.
|
|
200
|
-
// @param radians - radians to rotate this vector by (can be positive or negative).
|
|
201
|
-
// @return cloned rotated vector.
|
|
202
|
-
rotateRadians: function(s) {
|
|
203
|
-
return this.clone().rotateRadiansSelf(s);
|
|
204
|
-
},
|
|
205
|
-
// [API]
|
|
206
|
-
// []
|
|
207
|
-
// calculate the length of this vector (aka magnitude).
|
|
208
|
-
// @return vector length.
|
|
209
|
-
length: function() {
|
|
210
|
-
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
211
|
-
},
|
|
212
|
-
// [API]
|
|
213
|
-
// [chainable, changeSelf]
|
|
214
|
-
// normalize this vector, eg make length equal 1.
|
|
215
|
-
// @return self.
|
|
216
|
-
normalizeSelf: function() {
|
|
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
|
-
},
|
|
220
|
-
// [API]
|
|
221
|
-
// [chainable, clone]
|
|
222
|
-
// clone and normalize the vector.
|
|
223
|
-
// @return normalized vector.
|
|
224
|
-
normalize: function() {
|
|
225
|
-
return this.clone().normalizeSelf();
|
|
226
|
-
},
|
|
227
|
-
// [API]
|
|
228
|
-
// [chainable, changeSelf]
|
|
229
|
-
// add other vector to self.
|
|
230
|
-
// for example, v(10, 11) + v(5, 6) = v(15, 17).
|
|
231
|
-
// @param other - vector to add components to self.
|
|
232
|
-
// @return self.
|
|
233
|
-
addSelf: function(s) {
|
|
234
|
-
return typeof s == "number" ? this.addScalarSelf(s) : (this.x += s.x, this.y += s.y, this);
|
|
235
|
-
},
|
|
236
|
-
// [API]
|
|
237
|
-
// [chainable, changeSelf]
|
|
238
|
-
// subtract other vector from self.
|
|
239
|
-
// for example, v(10, 10) - v(2, 3) = v(8, 7).
|
|
240
|
-
// @param other - vector to subtract components from self.
|
|
241
|
-
// @return self.
|
|
242
|
-
subSelf: function(s) {
|
|
243
|
-
return typeof s == "number" ? this.subScalarSelf(s) : (this.x -= s.x, this.y -= s.y, this);
|
|
244
|
-
},
|
|
245
|
-
// [API]
|
|
246
|
-
// [chainable, changeSelf]
|
|
247
|
-
// divide self by other vector.
|
|
248
|
-
// for example, v(10, 20) / v(2, 5) = v(5, 4).
|
|
249
|
-
// @param other - vector to divide components from self.
|
|
250
|
-
// @return self.
|
|
251
|
-
divSelf: function(s) {
|
|
252
|
-
return typeof s == "number" ? this.divScalarSelf(s) : (this.x /= s.x, this.y /= s.y, this);
|
|
253
|
-
},
|
|
254
|
-
// [API]
|
|
255
|
-
// [chainable, changeSelf]
|
|
256
|
-
// multiply self vector by other vector.
|
|
257
|
-
// for example, v(2, 3) * v(3, 4) = v(6, 12).
|
|
258
|
-
// @param other - vector to multiply components with self.
|
|
259
|
-
// @return self.
|
|
260
|
-
mulSelf: function(s) {
|
|
261
|
-
return typeof s == "number" ? this.mulScalarSelf(s) : (this.x *= s.x, this.y *= s.y, this);
|
|
262
|
-
},
|
|
263
|
-
// [API]
|
|
264
|
-
// [chainable, changeSelf]
|
|
265
|
-
// add scalar value to self.
|
|
266
|
-
// for example, v(2, 3) + 5 = v(7, 8).
|
|
267
|
-
// @param val - value to add to components.
|
|
268
|
-
// @return self.
|
|
269
|
-
addScalarSelf: function(s) {
|
|
270
|
-
return this.x += s, this.y += s, this;
|
|
271
|
-
},
|
|
272
|
-
// [API]
|
|
273
|
-
// [chainable, changeSelf]
|
|
274
|
-
// subtract scalar from self.
|
|
275
|
-
// for example, v(7, 9) - 5 = v(3, 4).
|
|
276
|
-
// @param val - value to subtract from components.
|
|
277
|
-
// @return self.
|
|
278
|
-
subScalarSelf: function(s) {
|
|
279
|
-
return this.x -= s, this.y -= s, this;
|
|
280
|
-
},
|
|
281
|
-
// [API]
|
|
282
|
-
// [chainable, changeSelf]
|
|
283
|
-
// divide self by scalar.
|
|
284
|
-
// for example, v(6, 8) / 5 = v(3, 4).
|
|
285
|
-
// @param val - value to divide components by.
|
|
286
|
-
// @return self.
|
|
287
|
-
divScalarSelf: function(s) {
|
|
288
|
-
return this.x /= s, this.y /= s, this;
|
|
289
|
-
},
|
|
290
|
-
// [API]
|
|
291
|
-
// [chainable, changeSelf]
|
|
292
|
-
// multiply self by scalar.
|
|
293
|
-
// for example, v(2, 3) * 2 = v(4, 6).
|
|
294
|
-
// @param val - value to multiply components with.
|
|
295
|
-
// @return self.
|
|
296
|
-
mulScalarSelf: function(s) {
|
|
297
|
-
return this.x *= s, this.y *= s, this;
|
|
298
|
-
},
|
|
299
|
-
// [API]
|
|
300
|
-
// [chainable, clone]
|
|
301
|
-
// clone self and add other vector to it.
|
|
302
|
-
// @param other - vector to add with.
|
|
303
|
-
// @return cloned vector.
|
|
304
|
-
add: function(s) {
|
|
305
|
-
return this.clone().addSelf(s);
|
|
306
|
-
},
|
|
307
|
-
// [API]
|
|
308
|
-
// [chainable, clone]
|
|
309
|
-
// clone self and subtract other vector from it.
|
|
310
|
-
// @param other - vector to subtract with.
|
|
311
|
-
// @return cloned vector.
|
|
312
|
-
sub: function(s) {
|
|
313
|
-
return this.clone().subSelf(s);
|
|
314
|
-
},
|
|
315
|
-
// [API]
|
|
316
|
-
// [chainable, clone]
|
|
317
|
-
// clone self and multiply by other vector.
|
|
318
|
-
// @param other - vector to multiply with.
|
|
319
|
-
// @return cloned vector.
|
|
320
|
-
mul: function(s) {
|
|
321
|
-
return this.clone().mulSelf(s);
|
|
322
|
-
},
|
|
323
|
-
// [API]
|
|
324
|
-
// [chainable, clone]
|
|
325
|
-
// clone self and divide by other vector.
|
|
326
|
-
// @param other - vector to divide with.
|
|
327
|
-
// @param scalar - value to divide by.
|
|
328
|
-
// @return cloned vector.
|
|
329
|
-
div: function(s) {
|
|
330
|
-
return this.clone().divSelf(s);
|
|
331
|
-
},
|
|
332
|
-
// [API]
|
|
333
|
-
// [chainable, clone]
|
|
334
|
-
// clone self and add scalar to it.
|
|
335
|
-
// @param scalar - value to add.
|
|
336
|
-
// @return cloned vector.
|
|
337
|
-
addScalar: function(s) {
|
|
338
|
-
return this.clone().addScalarSelf(s);
|
|
339
|
-
},
|
|
340
|
-
// [API]
|
|
341
|
-
// [chainable, clone]
|
|
342
|
-
// clone self and substract scalar from it.
|
|
343
|
-
// @param scalar - value to subtract.
|
|
344
|
-
// @return cloned vector.
|
|
345
|
-
subScalar: function(s) {
|
|
346
|
-
return this.clone().subScalarSelf(s);
|
|
347
|
-
},
|
|
348
|
-
// [API]
|
|
349
|
-
// [chainable, clone]
|
|
350
|
-
// clone self and multiply by scalar.
|
|
351
|
-
// @param scalar - value to multiply with.
|
|
352
|
-
// @return cloned vector.
|
|
353
|
-
mulScalar: function(s) {
|
|
354
|
-
return this.clone().mulScalarSelf(s);
|
|
355
|
-
},
|
|
356
|
-
// [API]
|
|
357
|
-
// [chainable, clone]
|
|
358
|
-
// clone self and divide by scalar.
|
|
359
|
-
// @param scalar - value to divide by.
|
|
360
|
-
// @return cloned vector.
|
|
361
|
-
divScalar: function(s) {
|
|
362
|
-
return this.clone().divScalarSelf(s);
|
|
363
|
-
},
|
|
364
|
-
// [API]
|
|
365
|
-
// [chainable, changeSelf]
|
|
366
|
-
// clamp vector values into range.
|
|
367
|
-
// note: this function does not validate that min < max.
|
|
368
|
-
// @param min - min value for x, y components.
|
|
369
|
-
// @param max - max value for x, y components.
|
|
370
|
-
// @return self.
|
|
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
|
-
},
|
|
374
|
-
// [API]
|
|
375
|
-
// [chainable, clone]
|
|
376
|
-
// clone vector and clamp its values.
|
|
377
|
-
// note: this function does not validate that min < max.
|
|
378
|
-
// @param min - min value for x, y components.
|
|
379
|
-
// @param max - max value for x, y components.
|
|
380
|
-
// @return cloned vector in range.
|
|
381
|
-
clamp: function(s, d) {
|
|
382
|
-
return this.clone().clampSelf(s, d);
|
|
383
|
-
},
|
|
384
|
-
// [API]
|
|
385
|
-
// [chainable, changeSelf]
|
|
386
|
-
// apply a function on x and y components of the vector.
|
|
387
|
-
// for example, you can use Math.round to round the vector x, y values.
|
|
388
|
-
// @param func - function to apply on components.
|
|
389
|
-
// @return self.
|
|
390
|
-
applySelf: function(s) {
|
|
391
|
-
return this.x = s(this.x), this.y = s(this.y), this;
|
|
392
|
-
},
|
|
393
|
-
// [API]
|
|
394
|
-
// [chainable, clone]
|
|
395
|
-
// clone self and apply a function on x and y components of the clone vector.
|
|
396
|
-
// for example, you can use Math.round to round the vector x, y values.
|
|
397
|
-
// @param func - function to apply on components.
|
|
398
|
-
// @return cloned vector.
|
|
399
|
-
apply: function(s) {
|
|
400
|
-
return this.clone().applySelf(s);
|
|
401
|
-
},
|
|
402
|
-
// [API]
|
|
403
|
-
// [chainable, changeSelf]
|
|
404
|
-
// turn self to absolute values (eg turn x, y positive).
|
|
405
|
-
// @return self.
|
|
406
|
-
absSelf: function() {
|
|
407
|
-
return this.applySelf(Math.abs);
|
|
408
|
-
},
|
|
409
|
-
// [API]
|
|
410
|
-
// [chainable, clone]
|
|
411
|
-
// clone and turn to absolute values (eg turn x, y positive).
|
|
412
|
-
// @return cloned vector.
|
|
413
|
-
abs: function() {
|
|
414
|
-
return this.clone().absSelf();
|
|
415
|
-
},
|
|
416
|
-
// [API]
|
|
417
|
-
// [chainable, changeSelf]
|
|
418
|
-
// turn self to round values (eg turn x, y positive).
|
|
419
|
-
// @return self.
|
|
420
|
-
roundSelf: function() {
|
|
421
|
-
return this.applySelf(Math.round);
|
|
422
|
-
},
|
|
423
|
-
// [API]
|
|
424
|
-
// [chainable, clone]
|
|
425
|
-
// clone and turn to round values (eg turn x, y positive).
|
|
426
|
-
// @return cloned vector.
|
|
427
|
-
round: function() {
|
|
428
|
-
return this.clone().roundSelf();
|
|
429
|
-
},
|
|
430
|
-
// [API]
|
|
431
|
-
// []
|
|
432
|
-
// calculate dot-product of this vector with another vector.
|
|
433
|
-
// @param other - other vector to calculate dot-product with.
|
|
434
|
-
// @return dot product.
|
|
435
|
-
dot: function(s) {
|
|
436
|
-
return this.x * s.x + this.y * s.y;
|
|
437
|
-
},
|
|
438
|
-
// [API]
|
|
439
|
-
// []
|
|
440
|
-
// calculate cross-product of this vector with another vector.
|
|
441
|
-
// @param other - other vector to calculate cross-product with.
|
|
442
|
-
// @return dot product.
|
|
443
|
-
cross: function(s) {
|
|
444
|
-
return this.x * s.y - this.y * s.x;
|
|
445
|
-
},
|
|
446
|
-
// [API]
|
|
447
|
-
// [chainable, changeSelf]
|
|
448
|
-
// if any of the components of this vector are NaN, null, undefined, etc. set them to defaults.
|
|
449
|
-
// note: 0's are considered to be a valid number and will not be replaced with a default value.
|
|
450
|
-
// @param x - default value for x if undefined (0 if not defined).
|
|
451
|
-
// @param y - default value for y if undefined (0 if not defined).
|
|
452
|
-
// @return self.
|
|
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
|
-
},
|
|
456
|
-
// [API]
|
|
457
|
-
// [chainable, clone]
|
|
458
|
-
// create a clone and if any of the components of the vector are NaN, null, undefined, etc. set them to default.
|
|
459
|
-
// note: 0's are considered to be a valid number and will not be replaced with a default value.
|
|
460
|
-
// @param x - default value for x if undefined (0 if not defined).
|
|
461
|
-
// @param y - default value for y if undefined (0 if not defined).
|
|
462
|
-
// @return repaired clone.
|
|
463
|
-
repair: function(s, d) {
|
|
464
|
-
return this.clone().repairSelf(s, d);
|
|
465
|
-
},
|
|
466
|
-
// [API]
|
|
467
|
-
// []
|
|
468
|
-
// convert to string in the form of "x,y".
|
|
469
|
-
// @return string representation of the vector.
|
|
470
|
-
toString: function() {
|
|
471
|
-
return this.x + "," + this.y;
|
|
472
|
-
},
|
|
473
|
-
// [API]
|
|
474
|
-
// []
|
|
475
|
-
// convert to a string with a given format.
|
|
476
|
-
// @param format - a string in which %x and %y will be replaced with the vector values.
|
|
477
|
-
// @return formatted string representing the vector.
|
|
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
|
-
}
|
|
481
|
-
}, p;
|
|
482
|
-
}();
|
|
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
|
-
});
|
|
485
|
-
})(Re);
|
|
486
|
-
var On = Re.exports;
|
|
487
|
-
const Y = /* @__PURE__ */ fe(On);
|
|
488
|
-
let Xt = (u = 21) => crypto.getRandomValues(new Uint8Array(u)).reduce((l, t) => (t &= 63, t < 36 ? l += t.toString(36) : t < 62 ? l += (t - 26).toString(36).toUpperCase() : t > 62 ? l += "-" : l += "_", l), "");
|
|
1
|
+
var $n = Object.defineProperty;
|
|
2
|
+
var zn = (a, l, t) => l in a ? $n(a, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[l] = t;
|
|
3
|
+
var m = (a, l, t) => (zn(a, typeof l != "symbol" ? l + "" : l, t), t);
|
|
4
|
+
let Kt = (a = 21) => crypto.getRandomValues(new Uint8Array(a)).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
5
|
const zt = {
|
|
490
6
|
strokeType: "plain",
|
|
491
7
|
strokeColor: "black",
|
|
492
8
|
strokeWidth: 1,
|
|
493
9
|
head: "none",
|
|
494
10
|
tail: "none"
|
|
495
|
-
},
|
|
11
|
+
}, Me = {
|
|
496
12
|
id: 0,
|
|
497
13
|
type: "Feature",
|
|
498
14
|
properties: {
|
|
@@ -518,83 +34,83 @@ const zt = {
|
|
|
518
34
|
// tail: 'arrow-plain',
|
|
519
35
|
// start: { x: 0, y: 0 },
|
|
520
36
|
// end: { x: 100, y: 100 }
|
|
521
|
-
},
|
|
522
|
-
id:
|
|
37
|
+
}, Nn = (a = 0, l = 0, t = 0, r = 0, o = { ...zt }) => ({
|
|
38
|
+
id: Kt(),
|
|
523
39
|
type: "Feature",
|
|
524
40
|
properties: {
|
|
525
41
|
type: "arrow",
|
|
526
42
|
style: {
|
|
527
43
|
...zt,
|
|
528
|
-
...
|
|
44
|
+
...o
|
|
529
45
|
}
|
|
530
46
|
},
|
|
531
47
|
geometry: {
|
|
532
48
|
type: "LineString",
|
|
533
49
|
coordinates: [
|
|
534
|
-
[
|
|
50
|
+
[a, l],
|
|
535
51
|
[t, r]
|
|
536
52
|
]
|
|
537
53
|
}
|
|
538
|
-
}),
|
|
539
|
-
function
|
|
540
|
-
return document.createElementNS(
|
|
54
|
+
}), Hn = "http://www.w3.org/2000/svg";
|
|
55
|
+
function Pt(a) {
|
|
56
|
+
return document.createElementNS(Hn, a);
|
|
541
57
|
}
|
|
542
|
-
function
|
|
543
|
-
return
|
|
58
|
+
function qe(a) {
|
|
59
|
+
return a.geometry.bbox || Fn(a), a.geometry.bbox;
|
|
544
60
|
}
|
|
545
|
-
function ut(
|
|
546
|
-
const l =
|
|
61
|
+
function ut(a) {
|
|
62
|
+
const l = qe(a);
|
|
547
63
|
return {
|
|
548
64
|
width: l[2] - l[0],
|
|
549
65
|
height: l[3] - l[1]
|
|
550
66
|
};
|
|
551
67
|
}
|
|
552
|
-
function ct(
|
|
553
|
-
const l =
|
|
68
|
+
function ct(a) {
|
|
69
|
+
const l = qe(a);
|
|
554
70
|
return { x: l[0], y: l[1] };
|
|
555
71
|
}
|
|
556
|
-
function
|
|
557
|
-
const [l, t] =
|
|
558
|
-
|
|
72
|
+
function Fn(a) {
|
|
73
|
+
const [l, t] = a.geometry.coordinates[0][0], [r, o] = a.geometry.coordinates[0][2];
|
|
74
|
+
a.geometry.bbox = [l, t, r, o];
|
|
559
75
|
}
|
|
560
|
-
function
|
|
561
|
-
|
|
76
|
+
function Bn(a, l, t, r, o) {
|
|
77
|
+
a.geometry.bbox = [l, t, l + r, t + o], a.geometry.coordinates = [
|
|
562
78
|
[
|
|
563
79
|
[l, t],
|
|
564
80
|
[l + r, t],
|
|
565
|
-
[l + r, t +
|
|
566
|
-
[l, t +
|
|
81
|
+
[l + r, t + o],
|
|
82
|
+
[l, t + o],
|
|
567
83
|
[l, t]
|
|
568
84
|
]
|
|
569
85
|
];
|
|
570
86
|
}
|
|
571
|
-
function
|
|
572
|
-
const [l, t] =
|
|
87
|
+
function $t(a) {
|
|
88
|
+
const [l, t] = a.geometry.coordinates[0];
|
|
573
89
|
return { x: l, y: t };
|
|
574
90
|
}
|
|
575
|
-
function
|
|
576
|
-
const [t, r] =
|
|
91
|
+
function Rt(a, l) {
|
|
92
|
+
const [t, r] = a.geometry.coordinates[l === "start" ? 0 : 1];
|
|
577
93
|
return { x: t, y: r };
|
|
578
94
|
}
|
|
579
|
-
function
|
|
580
|
-
const [l, t] =
|
|
95
|
+
function Gt(a) {
|
|
96
|
+
const [l, t] = a.geometry.coordinates[1];
|
|
581
97
|
return { x: l, y: t };
|
|
582
98
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
99
|
+
function Re(a, l, t) {
|
|
100
|
+
a.geometry.coordinates[0] = [l, t];
|
|
585
101
|
}
|
|
586
|
-
function
|
|
587
|
-
|
|
102
|
+
function Ve(a, l, t) {
|
|
103
|
+
a.geometry.coordinates[1] = [l, t];
|
|
588
104
|
}
|
|
589
|
-
function
|
|
590
|
-
return { start:
|
|
105
|
+
function Yt(a) {
|
|
106
|
+
return { start: $t(a), end: Gt(a) };
|
|
591
107
|
}
|
|
592
|
-
function
|
|
593
|
-
l === "start" ?
|
|
108
|
+
function At(a, l, t, r) {
|
|
109
|
+
l === "start" ? Re(a, t, r) : Ve(a, t, r);
|
|
594
110
|
}
|
|
595
|
-
const
|
|
596
|
-
function
|
|
597
|
-
return
|
|
111
|
+
const Ue = (a) => parseInt(a.getAttribute("data-handle-id") || "-1");
|
|
112
|
+
function ii(a) {
|
|
113
|
+
return Wt(a).reduce(
|
|
598
114
|
(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
115
|
[
|
|
600
116
|
Number.POSITIVE_INFINITY,
|
|
@@ -604,200 +120,234 @@ function Zn(u) {
|
|
|
604
120
|
]
|
|
605
121
|
);
|
|
606
122
|
}
|
|
607
|
-
function
|
|
123
|
+
function Wt(a) {
|
|
608
124
|
let l = [];
|
|
609
|
-
return
|
|
125
|
+
return a.type == "Point" ? l = [a.coordinates] : a.type == "LineString" || a.type == "MultiPoint" ? l = a.coordinates : a.type == "Polygon" || a.type == "MultiLineString" ? l = a.coordinates.reduce(function(t, r) {
|
|
610
126
|
return t.concat(r);
|
|
611
|
-
}, []) :
|
|
612
|
-
(t, r) => t.concat(r.reduce((
|
|
127
|
+
}, []) : a.type == "MultiPolygon" ? l = a.coordinates.reduce(
|
|
128
|
+
(t, r) => t.concat(r.reduce((o, h) => o.concat(h), [])),
|
|
613
129
|
[]
|
|
614
|
-
) :
|
|
615
|
-
(t, r) => t.concat(
|
|
130
|
+
) : a.type == "Feature" ? l = Wt(a.geometry) : a.type == "GeometryCollection" ? l = a.geometries.reduce(
|
|
131
|
+
(t, r) => t.concat(Wt(r)),
|
|
616
132
|
[]
|
|
617
|
-
) :
|
|
618
|
-
(t, r) => t.concat(
|
|
133
|
+
) : a.type == "FeatureCollection" && (l = a.features.reduce(
|
|
134
|
+
(t, r) => t.concat(Wt(r)),
|
|
619
135
|
[]
|
|
620
136
|
)), l;
|
|
621
137
|
}
|
|
622
|
-
function
|
|
623
|
-
const r = Math.atan2(
|
|
138
|
+
function Vt(a, l, t) {
|
|
139
|
+
const r = Math.atan2(a.y - l.y, a.x - l.x);
|
|
624
140
|
return {
|
|
625
141
|
x: l.x + t * Math.cos(r),
|
|
626
142
|
y: l.y + t * Math.sin(r)
|
|
627
143
|
};
|
|
628
144
|
}
|
|
629
|
-
function
|
|
145
|
+
function ue(a, l) {
|
|
630
146
|
if (!l)
|
|
631
|
-
return { x:
|
|
147
|
+
return { x: a.clientX, y: a.clientY };
|
|
632
148
|
const t = l.getBoundingClientRect();
|
|
633
149
|
return {
|
|
634
|
-
x:
|
|
635
|
-
y:
|
|
150
|
+
x: a.clientX - t.left - l.clientLeft,
|
|
151
|
+
y: a.clientY - t.top - l.clientTop
|
|
636
152
|
};
|
|
637
153
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
154
|
+
const vt = (a, l) => ({
|
|
155
|
+
x: a.x - l.x,
|
|
156
|
+
y: a.y - l.y
|
|
157
|
+
}), kt = (a) => Math.sqrt(a.x * a.x + a.y * a.y), We = (a) => ({
|
|
158
|
+
x: -a.x,
|
|
159
|
+
y: -a.y
|
|
160
|
+
}), Ge = (a) => {
|
|
161
|
+
const l = kt(a);
|
|
162
|
+
return l === 0 ? { x: 0, y: 0 } : {
|
|
163
|
+
x: a.x / l,
|
|
164
|
+
y: a.y / l
|
|
165
|
+
};
|
|
166
|
+
}, Et = (a, l) => ({
|
|
167
|
+
x: a.x + l.x,
|
|
168
|
+
y: a.y + l.y
|
|
169
|
+
}), Ye = (a, l) => ({
|
|
170
|
+
x: a.x * l,
|
|
171
|
+
y: a.y * l
|
|
172
|
+
}), Ut = (a, l) => ({
|
|
173
|
+
x: a.x * l.x,
|
|
174
|
+
y: a.y * l.y
|
|
175
|
+
}), rt = (a, l) => {
|
|
176
|
+
const t = Math.sin(l), r = Math.cos(l);
|
|
177
|
+
return {
|
|
178
|
+
x: a.x * r - a.y * t,
|
|
179
|
+
y: a.x * t + a.y * r
|
|
180
|
+
};
|
|
181
|
+
}, jn = (a, l) => ({
|
|
182
|
+
x: a.x / l,
|
|
183
|
+
y: a.y / l
|
|
184
|
+
}), Oe = (a, l) => a.x * l.x + a.y * l.y;
|
|
185
|
+
function Xe(a, l = 5, t = 30) {
|
|
186
|
+
var d;
|
|
187
|
+
const { start: r, end: o } = Yt(a), h = vt(o, r), u = a.properties.style && a.properties.style.strokeWidth ? (d = a.properties.style) == null ? void 0 : d.strokeWidth : 0;
|
|
188
|
+
return Math.min(t, Math.max(3 * u, kt(h) * 0.1, l));
|
|
642
189
|
}
|
|
643
|
-
function
|
|
644
|
-
const
|
|
190
|
+
function Le(a, l, t, r) {
|
|
191
|
+
const o = Ye(We(Ge(l)), r);
|
|
645
192
|
if (!t || t === "none")
|
|
646
193
|
return "";
|
|
647
|
-
const h =
|
|
648
|
-
return `M ${h.x} ${h.y} L ${
|
|
194
|
+
const h = Et(a, rt(o, Math.PI / 8)), u = Et(a, rt(o, -Math.PI / 8)), d = `${a.x} ${a.y}`;
|
|
195
|
+
return `M ${h.x} ${h.y} L ${d} ${u.x} ${u.y} ${t === "arrow" ? "" : `${h.x} ${h.y}`}`;
|
|
649
196
|
}
|
|
650
|
-
function
|
|
651
|
-
const { start: h, end:
|
|
652
|
-
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
|
|
197
|
+
function qn(a, l, t, r, o) {
|
|
198
|
+
const { start: h, end: u } = Yt(a), { tail: d, head: g, strokeColor: f, strokeWidth: y } = a.properties.style || t, v = vt(u, h), T = Xe(a, r, o), A = Pt("path");
|
|
199
|
+
A.setAttribute("data-annotation", `${a.id}`), A.setAttribute("data-annotation-type", "arrow");
|
|
200
|
+
const b = g === "arrow-plain" || d === "arrow";
|
|
201
|
+
A.setAttribute("stroke", f || "none"), A.setAttribute("stroke-width", `${y}`), A.setAttribute("fill", b ? f || "" : "none"), A.setAttribute("stroke-linecap", "round"), A.setAttribute("stroke-linejoin", "round");
|
|
202
|
+
const C = Le(h, We(v), d, T), E = Le(u, v, g, T), $ = C + `M ${h.x} ${h.y} ${u.x} ${u.y}` + E;
|
|
203
|
+
A.setAttribute("d", $), l.appendChild(A);
|
|
657
204
|
}
|
|
658
|
-
const V = -1,
|
|
659
|
-
var
|
|
660
|
-
|
|
205
|
+
const V = -1, Xt = "dragging", Zt = "dragstart", Tt = "dragend", de = "select", fe = "unselect", Rn = "hover", Vn = "unhover", pe = "remove", ge = "add", Un = "cancelDrawing", ye = "update", Wn = "link";
|
|
206
|
+
var Gn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
207
|
+
function Ze(a) {
|
|
208
|
+
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
209
|
+
}
|
|
210
|
+
var Ke = { exports: {} };
|
|
211
|
+
(function(a) {
|
|
661
212
|
var l = Object.prototype.hasOwnProperty, t = "~";
|
|
662
213
|
function r() {
|
|
663
214
|
}
|
|
664
215
|
Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
|
|
665
|
-
function
|
|
666
|
-
this.fn =
|
|
216
|
+
function o(g, f, y) {
|
|
217
|
+
this.fn = g, this.context = f, this.once = y || !1;
|
|
667
218
|
}
|
|
668
|
-
function h(
|
|
669
|
-
if (typeof
|
|
219
|
+
function h(g, f, y, v, T) {
|
|
220
|
+
if (typeof y != "function")
|
|
670
221
|
throw new TypeError("The listener must be a function");
|
|
671
|
-
var
|
|
672
|
-
return
|
|
222
|
+
var A = new o(y, v || g, T), b = t ? t + f : f;
|
|
223
|
+
return g._events[b] ? g._events[b].fn ? g._events[b] = [g._events[b], A] : g._events[b].push(A) : (g._events[b] = A, g._eventsCount++), g;
|
|
673
224
|
}
|
|
674
|
-
function
|
|
675
|
-
--
|
|
225
|
+
function u(g, f) {
|
|
226
|
+
--g._eventsCount === 0 ? g._events = new r() : delete g._events[f];
|
|
676
227
|
}
|
|
677
|
-
function
|
|
228
|
+
function d() {
|
|
678
229
|
this._events = new r(), this._eventsCount = 0;
|
|
679
230
|
}
|
|
680
|
-
|
|
681
|
-
var
|
|
231
|
+
d.prototype.eventNames = function() {
|
|
232
|
+
var f = [], y, v;
|
|
682
233
|
if (this._eventsCount === 0)
|
|
683
|
-
return
|
|
684
|
-
for (
|
|
685
|
-
l.call(
|
|
686
|
-
return Object.getOwnPropertySymbols ?
|
|
687
|
-
},
|
|
688
|
-
var
|
|
689
|
-
if (!
|
|
234
|
+
return f;
|
|
235
|
+
for (v in y = this._events)
|
|
236
|
+
l.call(y, v) && f.push(t ? v.slice(1) : v);
|
|
237
|
+
return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(y)) : f;
|
|
238
|
+
}, d.prototype.listeners = function(f) {
|
|
239
|
+
var y = t ? t + f : f, v = this._events[y];
|
|
240
|
+
if (!v)
|
|
690
241
|
return [];
|
|
691
|
-
if (
|
|
692
|
-
return [
|
|
693
|
-
for (var
|
|
694
|
-
b[
|
|
242
|
+
if (v.fn)
|
|
243
|
+
return [v.fn];
|
|
244
|
+
for (var T = 0, A = v.length, b = new Array(A); T < A; T++)
|
|
245
|
+
b[T] = v[T].fn;
|
|
695
246
|
return b;
|
|
696
|
-
},
|
|
697
|
-
var
|
|
698
|
-
return
|
|
699
|
-
},
|
|
700
|
-
var
|
|
701
|
-
if (!this._events[
|
|
247
|
+
}, d.prototype.listenerCount = function(f) {
|
|
248
|
+
var y = t ? t + f : f, v = this._events[y];
|
|
249
|
+
return v ? v.fn ? 1 : v.length : 0;
|
|
250
|
+
}, d.prototype.emit = function(f, y, v, T, A, b) {
|
|
251
|
+
var C = t ? t + f : f;
|
|
252
|
+
if (!this._events[C])
|
|
702
253
|
return !1;
|
|
703
|
-
var
|
|
704
|
-
if (
|
|
705
|
-
switch (
|
|
254
|
+
var E = this._events[C], $ = arguments.length, N, _;
|
|
255
|
+
if (E.fn) {
|
|
256
|
+
switch (E.once && this.removeListener(f, E.fn, void 0, !0), $) {
|
|
706
257
|
case 1:
|
|
707
|
-
return
|
|
258
|
+
return E.fn.call(E.context), !0;
|
|
708
259
|
case 2:
|
|
709
|
-
return
|
|
260
|
+
return E.fn.call(E.context, y), !0;
|
|
710
261
|
case 3:
|
|
711
|
-
return
|
|
262
|
+
return E.fn.call(E.context, y, v), !0;
|
|
712
263
|
case 4:
|
|
713
|
-
return
|
|
264
|
+
return E.fn.call(E.context, y, v, T), !0;
|
|
714
265
|
case 5:
|
|
715
|
-
return
|
|
266
|
+
return E.fn.call(E.context, y, v, T, A), !0;
|
|
716
267
|
case 6:
|
|
717
|
-
return
|
|
268
|
+
return E.fn.call(E.context, y, v, T, A, b), !0;
|
|
718
269
|
}
|
|
719
|
-
for (_ = 1,
|
|
720
|
-
|
|
721
|
-
|
|
270
|
+
for (_ = 1, N = new Array($ - 1); _ < $; _++)
|
|
271
|
+
N[_ - 1] = arguments[_];
|
|
272
|
+
E.fn.apply(E.context, N);
|
|
722
273
|
} else {
|
|
723
|
-
var
|
|
724
|
-
for (_ = 0; _ <
|
|
725
|
-
switch (
|
|
274
|
+
var W = E.length, G;
|
|
275
|
+
for (_ = 0; _ < W; _++)
|
|
276
|
+
switch (E[_].once && this.removeListener(f, E[_].fn, void 0, !0), $) {
|
|
726
277
|
case 1:
|
|
727
|
-
|
|
278
|
+
E[_].fn.call(E[_].context);
|
|
728
279
|
break;
|
|
729
280
|
case 2:
|
|
730
|
-
|
|
281
|
+
E[_].fn.call(E[_].context, y);
|
|
731
282
|
break;
|
|
732
283
|
case 3:
|
|
733
|
-
|
|
284
|
+
E[_].fn.call(E[_].context, y, v);
|
|
734
285
|
break;
|
|
735
286
|
case 4:
|
|
736
|
-
|
|
287
|
+
E[_].fn.call(E[_].context, y, v, T);
|
|
737
288
|
break;
|
|
738
289
|
default:
|
|
739
|
-
if (
|
|
740
|
-
for (
|
|
741
|
-
|
|
742
|
-
|
|
290
|
+
if (!N)
|
|
291
|
+
for (G = 1, N = new Array($ - 1); G < $; G++)
|
|
292
|
+
N[G - 1] = arguments[G];
|
|
293
|
+
E[_].fn.apply(E[_].context, N);
|
|
743
294
|
}
|
|
744
295
|
}
|
|
745
296
|
return !0;
|
|
746
|
-
},
|
|
747
|
-
return h(this,
|
|
748
|
-
},
|
|
749
|
-
return h(this,
|
|
750
|
-
},
|
|
751
|
-
var
|
|
752
|
-
if (!this._events[
|
|
297
|
+
}, d.prototype.on = function(f, y, v) {
|
|
298
|
+
return h(this, f, y, v, !1);
|
|
299
|
+
}, d.prototype.once = function(f, y, v) {
|
|
300
|
+
return h(this, f, y, v, !0);
|
|
301
|
+
}, d.prototype.removeListener = function(f, y, v, T) {
|
|
302
|
+
var A = t ? t + f : f;
|
|
303
|
+
if (!this._events[A])
|
|
753
304
|
return this;
|
|
754
|
-
if (!
|
|
755
|
-
return
|
|
756
|
-
var b = this._events[
|
|
305
|
+
if (!y)
|
|
306
|
+
return u(this, A), this;
|
|
307
|
+
var b = this._events[A];
|
|
757
308
|
if (b.fn)
|
|
758
|
-
b.fn ===
|
|
309
|
+
b.fn === y && (!T || b.once) && (!v || b.context === v) && u(this, A);
|
|
759
310
|
else {
|
|
760
|
-
for (var
|
|
761
|
-
(b[
|
|
762
|
-
|
|
311
|
+
for (var C = 0, E = [], $ = b.length; C < $; C++)
|
|
312
|
+
(b[C].fn !== y || T && !b[C].once || v && b[C].context !== v) && E.push(b[C]);
|
|
313
|
+
E.length ? this._events[A] = E.length === 1 ? E[0] : E : u(this, A);
|
|
763
314
|
}
|
|
764
315
|
return this;
|
|
765
|
-
},
|
|
766
|
-
var
|
|
767
|
-
return
|
|
768
|
-
},
|
|
769
|
-
})(
|
|
770
|
-
var
|
|
771
|
-
const
|
|
772
|
-
class
|
|
316
|
+
}, d.prototype.removeAllListeners = function(f) {
|
|
317
|
+
var y;
|
|
318
|
+
return f ? (y = t ? t + f : f, this._events[y] && u(this, y)) : (this._events = new r(), this._eventsCount = 0), this;
|
|
319
|
+
}, d.prototype.off = d.prototype.removeListener, d.prototype.addListener = d.prototype.on, d.prefixed = t, d.EventEmitter = d, a.exports = d;
|
|
320
|
+
})(Ke);
|
|
321
|
+
var Yn = Ke.exports;
|
|
322
|
+
const Je = /* @__PURE__ */ Ze(Yn);
|
|
323
|
+
class Qe extends Je {
|
|
773
324
|
constructor(t, r) {
|
|
774
325
|
super();
|
|
775
|
-
|
|
776
|
-
|
|
326
|
+
m(this, "ogma");
|
|
327
|
+
m(this, "elements");
|
|
777
328
|
// layer to draw elements
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
329
|
+
m(this, "layer");
|
|
330
|
+
m(this, "editor");
|
|
331
|
+
m(this, "selectedId", V);
|
|
332
|
+
m(this, "hoveredId", V);
|
|
782
333
|
// used to remember ogma options before we change them
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
v(this, "_onKeyUp", (t) => {
|
|
334
|
+
m(this, "ogmaOptions");
|
|
335
|
+
m(this, "shouldDetect");
|
|
336
|
+
m(this, "isDragging");
|
|
337
|
+
m(this, "showeditorOnHover");
|
|
338
|
+
m(this, "_onKeyUp", (t) => {
|
|
789
339
|
t.code === 27 && this.selectedId !== V ? this.unselect() : (t.code === 46 || t.code === 8) && this.selectedId !== V && this._canRemove() && this.remove(this.selectedId);
|
|
790
340
|
});
|
|
791
|
-
|
|
341
|
+
m(this, "_onClickMouseMove", (t) => {
|
|
792
342
|
if (!t.domEvent || this.isDragging || !this.shouldDetect || t.domEvent.type !== "mousemove" && t.domEvent.target && t.domEvent.target.tagName === "a")
|
|
793
343
|
return;
|
|
794
|
-
const r = this.ogma.view.screenToGraphCoordinates(t),
|
|
795
|
-
t.domEvent.type === "mousemove" ?
|
|
344
|
+
const r = this.ogma.view.screenToGraphCoordinates(t), o = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
|
|
345
|
+
t.domEvent.type === "mousemove" ? o ? this.hover(o.id) : this.hoveredId !== V && this.unhover() : o ? this.select(o.id) : this.selectedId !== V && this.unselect();
|
|
796
346
|
});
|
|
797
347
|
this.ogma = t, this.elements = [], this.shouldDetect = !0, this.isDragging = !1, this.showeditorOnHover = !0, this.ogmaOptions = t.getOptions(), t.events.on(["click", "mousemove"], this._onClickMouseMove).on("keyup", this._onKeyUp).on("frame", () => {
|
|
798
348
|
this.refreshEditor(), this.refreshDrawing();
|
|
799
349
|
}), this.layer = t.layers.addSVGLayer({
|
|
800
|
-
draw: (
|
|
350
|
+
draw: (o) => this.draw(o)
|
|
801
351
|
}), this.layer.moveToTop(), this.editor = t.layers.addLayer(r), this.editor.hide();
|
|
802
352
|
}
|
|
803
353
|
_canRemove() {
|
|
@@ -809,8 +359,8 @@ class Ye extends Ue {
|
|
|
809
359
|
* @returns the added annotation
|
|
810
360
|
*/
|
|
811
361
|
add(t) {
|
|
812
|
-
const r = this.getDefaultOptions(),
|
|
813
|
-
id: t.id === void 0 ?
|
|
362
|
+
const r = this.getDefaultOptions(), o = Object.assign(t, {
|
|
363
|
+
id: t.id === void 0 ? Kt() : t.id,
|
|
814
364
|
type: t.type,
|
|
815
365
|
properties: {
|
|
816
366
|
...r.properties,
|
|
@@ -823,7 +373,7 @@ class Ye extends Ue {
|
|
|
823
373
|
...t.geometry
|
|
824
374
|
}
|
|
825
375
|
});
|
|
826
|
-
return this.elements.push(
|
|
376
|
+
return this.elements.push(o), this.layer.refresh(), this.emit(ge, o), o;
|
|
827
377
|
}
|
|
828
378
|
updateStyle(t, r) {
|
|
829
379
|
this.updateAnnotation(t, {
|
|
@@ -841,26 +391,26 @@ class Ye extends Ue {
|
|
|
841
391
|
* @method update
|
|
842
392
|
* Updates an annotation (position, color etc)
|
|
843
393
|
* @param id Id of the annotation to update
|
|
844
|
-
* @param
|
|
394
|
+
* @param element params of the annotation
|
|
845
395
|
*/
|
|
846
396
|
update(t, r) {
|
|
847
|
-
const
|
|
848
|
-
this.updateAnnotation(
|
|
397
|
+
const o = this.getById(t);
|
|
398
|
+
this.updateAnnotation(o, r);
|
|
849
399
|
}
|
|
850
400
|
updateAnnotation(t, r) {
|
|
851
401
|
if (!t)
|
|
852
402
|
return;
|
|
853
|
-
const
|
|
403
|
+
const o = t.id;
|
|
854
404
|
Object.keys(r).forEach((h) => {
|
|
855
405
|
if (h !== "id")
|
|
856
406
|
if (h === "properties") {
|
|
857
|
-
const
|
|
407
|
+
const u = r.properties || { style: {} };
|
|
858
408
|
t.properties = {
|
|
859
409
|
...t.properties || {},
|
|
860
|
-
...
|
|
410
|
+
...u || {},
|
|
861
411
|
style: {
|
|
862
412
|
...t.properties.style || {},
|
|
863
|
-
...
|
|
413
|
+
...u.style || {}
|
|
864
414
|
}
|
|
865
415
|
};
|
|
866
416
|
} else
|
|
@@ -868,12 +418,12 @@ class Ye extends Ue {
|
|
|
868
418
|
...t.geometry,
|
|
869
419
|
...r.geometry
|
|
870
420
|
} : t[h] = r[h];
|
|
871
|
-
}),
|
|
421
|
+
}), o === this.selectedId && this.refreshEditor(), this.layer.refresh();
|
|
872
422
|
}
|
|
873
423
|
getById(t) {
|
|
874
424
|
const r = Number(t);
|
|
875
|
-
for (let
|
|
876
|
-
const h = this.elements[
|
|
425
|
+
for (let o = 0; o < this.elements.length; o++) {
|
|
426
|
+
const h = this.elements[o];
|
|
877
427
|
if (!(h.id !== t && h.id !== r))
|
|
878
428
|
return h;
|
|
879
429
|
}
|
|
@@ -885,22 +435,22 @@ class Ye extends Ue {
|
|
|
885
435
|
*/
|
|
886
436
|
select(t) {
|
|
887
437
|
const r = this.getById(t);
|
|
888
|
-
r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(
|
|
438
|
+
r && (this.editor.show(), this.selectedId = t, this.refreshEditor(), this.layer.refresh(), this.emit(de, r));
|
|
889
439
|
}
|
|
890
440
|
hover(t) {
|
|
891
441
|
const r = this.getById(t);
|
|
892
|
-
r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(
|
|
442
|
+
r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(Rn, r));
|
|
893
443
|
}
|
|
894
444
|
getSelectedFeature() {
|
|
895
445
|
return this.selectedId === V ? null : this.getById(this.selectedId);
|
|
896
446
|
}
|
|
897
447
|
unselect() {
|
|
898
448
|
const t = this.getById(this.selectedId);
|
|
899
|
-
return t && this.emit(
|
|
449
|
+
return t && this.emit(fe, t), this.selectedId = V, this.hoveredId === V && this.editor.hide(), this.layer.refresh(), this;
|
|
900
450
|
}
|
|
901
451
|
unhover() {
|
|
902
452
|
const t = this.getById(this.hoveredId);
|
|
903
|
-
return this.emit(
|
|
453
|
+
return this.emit(Vn, t), this.hoveredId = V, this.selectedId === V && this.editor.hide(), this.layer.refresh(), this;
|
|
904
454
|
}
|
|
905
455
|
/**
|
|
906
456
|
* @method remove
|
|
@@ -909,7 +459,7 @@ class Ye extends Ue {
|
|
|
909
459
|
*/
|
|
910
460
|
remove(t) {
|
|
911
461
|
const r = this.getById(t);
|
|
912
|
-
t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((
|
|
462
|
+
t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((o) => o.id !== t), r && this.emit(pe, r), this.layer.refresh();
|
|
913
463
|
}
|
|
914
464
|
/**
|
|
915
465
|
* @method disableDragging
|
|
@@ -959,56 +509,59 @@ class Ye extends Ue {
|
|
|
959
509
|
this.ogma.events.off(this._onClickMouseMove).off(this._onKeyUp), this.layer.destroy();
|
|
960
510
|
}
|
|
961
511
|
}
|
|
962
|
-
const
|
|
963
|
-
class
|
|
512
|
+
const Ce = "handle-line", Pe = "handle-start", $e = "handle-end";
|
|
513
|
+
class Xn extends Qe {
|
|
964
514
|
constructor(t, r = {}) {
|
|
965
515
|
super(
|
|
966
516
|
t,
|
|
967
517
|
`
|
|
968
518
|
<div class="arrow-handle">
|
|
969
|
-
<div id="${
|
|
970
|
-
<div id="${
|
|
971
|
-
<div id="${
|
|
519
|
+
<div id="${Ce}" data-handle-id="0" class="handle line"></div>
|
|
520
|
+
<div id="${Pe}" data-handle-id="1" class="handle point"></div>
|
|
521
|
+
<div id="${$e}" data-handle-id="2" class="handle point"></div>
|
|
972
522
|
</div>
|
|
973
523
|
`
|
|
974
524
|
);
|
|
975
525
|
// active handle id
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
526
|
+
m(this, "draggedHandle", V);
|
|
527
|
+
m(this, "start", { x: 0, y: 0 });
|
|
528
|
+
m(this, "end", { x: 0, y: 0 });
|
|
529
|
+
m(this, "arrow", { ...Me });
|
|
530
|
+
m(this, "startX", 0);
|
|
531
|
+
m(this, "startY", 0);
|
|
532
|
+
m(this, "minArrowHeight", 0);
|
|
533
|
+
m(this, "maxArrowHeight", 0);
|
|
534
|
+
m(this, "handles", []);
|
|
535
|
+
m(this, "onHandleMouseDown", (t) => {
|
|
986
536
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
987
537
|
if (!r)
|
|
988
538
|
return;
|
|
989
|
-
const { x:
|
|
990
|
-
this.startDragging(r,
|
|
539
|
+
const { x: o, y: h } = ue(t, this.ogma.getContainer());
|
|
540
|
+
this.startDragging(r, o, h), this.draggedHandle = Ue(t.target);
|
|
991
541
|
});
|
|
992
|
-
|
|
993
|
-
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V, this.emit(
|
|
542
|
+
m(this, "onMouseUp", () => {
|
|
543
|
+
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V, this.emit(Tt, this.arrow));
|
|
994
544
|
});
|
|
995
|
-
|
|
545
|
+
m(this, "onMouseMove", (t) => {
|
|
996
546
|
if (!this.isDragging || this.draggedHandle === V)
|
|
997
547
|
return;
|
|
998
|
-
const r = this.handles[this.draggedHandle],
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
548
|
+
const r = this.handles[this.draggedHandle], o = this.ogma.view.getAngle(), { x: h, y: u } = rt(
|
|
549
|
+
jn(
|
|
550
|
+
{ x: t.clientX - this.startX, y: t.clientY - this.startY },
|
|
551
|
+
this.ogma.view.getZoom()
|
|
552
|
+
),
|
|
553
|
+
o
|
|
554
|
+
), d = r.id === Ce, g = r.id === Pe, f = r.id === $e;
|
|
555
|
+
(d || g) && Re(this.arrow, this.start.x + h, this.start.y + u), (d || f) && Ve(this.arrow, this.end.x + h, this.end.y + u), this.emit(
|
|
556
|
+
Xt,
|
|
1004
557
|
this.arrow,
|
|
1005
|
-
|
|
558
|
+
d ? "line" : g ? "start" : "end"
|
|
1006
559
|
), this.refreshEditor(), this.layer.refresh();
|
|
1007
560
|
});
|
|
1008
561
|
this.minArrowHeight = r.minArrowHeight || 0, this.maxArrowHeight = r.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
|
|
1009
562
|
this.editor.element.querySelectorAll(".arrow-handle>.handle")
|
|
1010
563
|
), this.handles.forEach(
|
|
1011
|
-
(
|
|
564
|
+
(o) => o.addEventListener("mousedown", this.onHandleMouseDown)
|
|
1012
565
|
), document.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("mouseup", this.onMouseUp);
|
|
1013
566
|
}
|
|
1014
567
|
/**
|
|
@@ -1017,54 +570,55 @@ class qn extends Ye {
|
|
|
1017
570
|
* @param y
|
|
1018
571
|
* @param arrow
|
|
1019
572
|
*/
|
|
1020
|
-
startDrawing(t, r,
|
|
1021
|
-
var
|
|
1022
|
-
this.disableDragging(), this.add(
|
|
1023
|
-
const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }),
|
|
573
|
+
startDrawing(t, r, o = Nn(t, r, t, r, zt)) {
|
|
574
|
+
var d;
|
|
575
|
+
this.disableDragging(), this.add(o), this.hoveredId = o.id;
|
|
576
|
+
const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), u = ((d = this.ogma.getContainer()) == null ? void 0 : d.getBoundingClientRect()) || {
|
|
1024
577
|
left: 0,
|
|
1025
578
|
top: 0
|
|
1026
579
|
};
|
|
1027
580
|
this.startDragging(
|
|
1028
|
-
this.getById(
|
|
1029
|
-
h.x + (
|
|
1030
|
-
h.y +
|
|
581
|
+
this.getById(o.id),
|
|
582
|
+
h.x + (u == null ? void 0 : u.left),
|
|
583
|
+
h.y + u.top
|
|
1031
584
|
), this.draggedHandle = 2;
|
|
1032
585
|
}
|
|
1033
586
|
cancelDrawing() {
|
|
1034
|
-
this.isDragging && (this.remove(this.arrow.id), this.emit(
|
|
587
|
+
this.isDragging && (this.remove(this.arrow.id), this.emit(Tt, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V);
|
|
1035
588
|
}
|
|
1036
|
-
startDragging(t, r,
|
|
1037
|
-
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY =
|
|
589
|
+
startDragging(t, r, o) {
|
|
590
|
+
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = o, this.start = $t(this.arrow), this.end = Gt(this.arrow), this.disableDragging(), this.emit(Zt, this.arrow), this.isDragging = !0;
|
|
1038
591
|
}
|
|
1039
592
|
detect(t, r = 0) {
|
|
1040
|
-
return this.elements.find((
|
|
1041
|
-
const { start: h, end:
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
593
|
+
return this.elements.find((o) => {
|
|
594
|
+
const { start: h, end: u } = Yt(o), d = vt(t, {
|
|
595
|
+
x: (h.x + u.x) / 2,
|
|
596
|
+
y: (h.y + u.y) / 2
|
|
597
|
+
}), g = vt(u, h), f = kt(g), y = Ge(g), v = Xe(o);
|
|
598
|
+
return Math.abs(Oe(y, d)) < f / 2 + r && Math.abs(Oe(rt(y, Math.PI / 2), d)) < v / 2 + r;
|
|
1045
599
|
});
|
|
1046
600
|
}
|
|
1047
601
|
refreshEditor() {
|
|
1048
602
|
if (+this.selectedId < 0 && +this.hoveredId < 0)
|
|
1049
603
|
return;
|
|
1050
|
-
const t = this.selectedId !== V ? this.getById(this.selectedId) : this.getById(this.hoveredId), r =
|
|
604
|
+
const t = this.selectedId !== V ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Yt(t), o = this.ogma.view.graphToScreenCoordinates(r.start), h = this.ogma.view.graphToScreenCoordinates(r.end), [u, d, g] = Array.prototype.slice.call(
|
|
1051
605
|
this.editor.element.querySelectorAll(".handle")
|
|
1052
606
|
);
|
|
1053
|
-
|
|
1054
|
-
const
|
|
1055
|
-
x: (h.x +
|
|
1056
|
-
y: (h.y +
|
|
1057
|
-
},
|
|
1058
|
-
|
|
607
|
+
d.style.transform = `translate(${o.x}px, ${o.y}px) translate(-50%, -50%)`, g.style.transform = `translate(${h.x}px, ${h.y}px) translate(-50%, -50%)`;
|
|
608
|
+
const f = {
|
|
609
|
+
x: (h.x + o.x) / 2,
|
|
610
|
+
y: (h.y + o.y) / 2
|
|
611
|
+
}, y = vt(h, o), v = Ye(y, 1 / kt(y)), T = Math.atan2(v.y, v.x);
|
|
612
|
+
u.style.width = `${kt(y)}px`, u.style.left = `${f.x}px`, u.style.top = `${f.y}px`, u.style.transform = `translate(-50%, -50%) rotate(${T}rad)`;
|
|
1059
613
|
}
|
|
1060
614
|
getDefaultOptions() {
|
|
1061
|
-
return
|
|
615
|
+
return Me;
|
|
1062
616
|
}
|
|
1063
617
|
draw(t) {
|
|
1064
618
|
t.innerHTML = "";
|
|
1065
|
-
const r =
|
|
1066
|
-
r.setAttribute("transform", `rotate(${-
|
|
1067
|
-
(h) =>
|
|
619
|
+
const r = Pt("g"), o = this.ogma.view.getAngle();
|
|
620
|
+
r.setAttribute("transform", `rotate(${-o * (180 / Math.PI)})`), this.elements.forEach(
|
|
621
|
+
(h) => qn(h, r, zt, this.minArrowHeight, this.maxArrowHeight)
|
|
1068
622
|
), t.appendChild(r);
|
|
1069
623
|
}
|
|
1070
624
|
refreshDrawing() {
|
|
@@ -1078,7 +632,7 @@ class qn extends Ye {
|
|
|
1078
632
|
super.destroy(), document.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("mouseup", this.onMouseUp);
|
|
1079
633
|
}
|
|
1080
634
|
}
|
|
1081
|
-
const
|
|
635
|
+
const St = {
|
|
1082
636
|
font: "sans-serif",
|
|
1083
637
|
fontSize: 12,
|
|
1084
638
|
color: "black",
|
|
@@ -1086,13 +640,13 @@ const At = {
|
|
|
1086
640
|
strokeWidth: 1,
|
|
1087
641
|
strokeColor: "#000",
|
|
1088
642
|
strokeType: "plain"
|
|
1089
|
-
},
|
|
643
|
+
}, le = {
|
|
1090
644
|
id: 0,
|
|
1091
645
|
type: "Feature",
|
|
1092
646
|
properties: {
|
|
1093
647
|
type: "text",
|
|
1094
648
|
content: "",
|
|
1095
|
-
style: { ...
|
|
649
|
+
style: { ...St }
|
|
1096
650
|
},
|
|
1097
651
|
geometry: {
|
|
1098
652
|
type: "Polygon",
|
|
@@ -1108,126 +662,126 @@ const At = {
|
|
|
1108
662
|
}
|
|
1109
663
|
// position: { x: 0, y: 0 },
|
|
1110
664
|
// size: { width: 100, height: 50 }
|
|
1111
|
-
},
|
|
665
|
+
}, ze = {
|
|
1112
666
|
handleSize: 3.5,
|
|
1113
667
|
placeholder: "Your text..."
|
|
1114
|
-
},
|
|
1115
|
-
id:
|
|
668
|
+
}, Zn = (a = 0, l = 0, t = 100, r = 50, o = "", h = { ...St }) => ({
|
|
669
|
+
id: Kt(),
|
|
1116
670
|
type: "Feature",
|
|
1117
671
|
properties: {
|
|
1118
672
|
type: "text",
|
|
1119
|
-
content:
|
|
1120
|
-
style: { ...
|
|
673
|
+
content: o,
|
|
674
|
+
style: { ...St, ...h }
|
|
1121
675
|
},
|
|
1122
676
|
geometry: {
|
|
1123
677
|
type: "Polygon",
|
|
1124
678
|
coordinates: [
|
|
1125
679
|
[
|
|
1126
|
-
[
|
|
1127
|
-
[
|
|
1128
|
-
[
|
|
1129
|
-
[
|
|
1130
|
-
[
|
|
680
|
+
[a, l],
|
|
681
|
+
[a + t, l],
|
|
682
|
+
[a + t, l + r],
|
|
683
|
+
[a, l + r],
|
|
684
|
+
[a, l]
|
|
1131
685
|
]
|
|
1132
686
|
]
|
|
1133
687
|
}
|
|
1134
688
|
});
|
|
1135
|
-
var
|
|
1136
|
-
(function(
|
|
689
|
+
var tn = { exports: {} };
|
|
690
|
+
(function(a, l) {
|
|
1137
691
|
(function(t, r) {
|
|
1138
|
-
|
|
1139
|
-
})(
|
|
692
|
+
a.exports = r();
|
|
693
|
+
})(Gn, () => (() => {
|
|
1140
694
|
var t = { d: (e, n) => {
|
|
1141
|
-
for (var
|
|
1142
|
-
t.o(n,
|
|
695
|
+
for (var s in n)
|
|
696
|
+
t.o(n, s) && !t.o(e, s) && Object.defineProperty(e, s, { enumerable: !0, get: n[s] });
|
|
1143
697
|
}, o: (e, n) => Object.prototype.hasOwnProperty.call(e, n) }, r = {};
|
|
1144
|
-
function
|
|
1145
|
-
return
|
|
698
|
+
function o(e) {
|
|
699
|
+
return o = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1146
700
|
return typeof n;
|
|
1147
701
|
} : function(n) {
|
|
1148
702
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1149
|
-
},
|
|
703
|
+
}, o(e);
|
|
1150
704
|
}
|
|
1151
|
-
t.d(r, { default: () =>
|
|
1152
|
-
var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/,
|
|
1153
|
-
function
|
|
1154
|
-
var n = "",
|
|
1155
|
-
return
|
|
705
|
+
t.d(r, { default: () => Cn });
|
|
706
|
+
var h = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, u = /\bsmall-caps\b/, d = /\b(?:italic|oblique)\b/, g = /\bbold(?:er)?\b/, f = 13.3333333, y = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
|
|
707
|
+
function v(e) {
|
|
708
|
+
var n = "", s = this;
|
|
709
|
+
return s.style && s.style !== "normal" && (n += s.style), s.variant && s.variant !== "normal" && (n += (n ? " " : "") + s.variant), s.weight && s.weight !== "normal" && (n += (n ? " " : "") + s.weight), s.size && (n += (n ? " " : "") + s.size + "px", s.height !== s.size && (n += "/" + s.height + "px")), s.family && (n += (n ? " " : "") + s.family), e && (n += "::" + s.baseline), e && (n += "::" + s.color), n;
|
|
1156
710
|
}
|
|
1157
|
-
var
|
|
1158
|
-
function
|
|
1159
|
-
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
1160
|
-
n.family = (
|
|
1161
|
-
var i =
|
|
1162
|
-
|
|
1163
|
-
var c = parseFloat(
|
|
1164
|
-
if (c !== "normal" && c !== "inherit" && c ?
|
|
711
|
+
var T = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: v, valueOf: v };
|
|
712
|
+
function A(e) {
|
|
713
|
+
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = h.exec(e);
|
|
714
|
+
n.family = (s[6] || "").trim();
|
|
715
|
+
var i = y[s[2]] || parseFloat(s[2]);
|
|
716
|
+
s[3] === "%" ? i *= 0.16 : s[3] === "em" ? i *= 16 : s[3] === "pt" && (i *= f), n.size = i;
|
|
717
|
+
var c = parseFloat(s[4]);
|
|
718
|
+
if (c !== "normal" && c !== "inherit" && c ? s[5] && s[5] !== "em" ? s[5] === "pt" ? n.height = c * f : s[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)), u.test(s[1]) && (n.variant = "small-caps"), d.test(s[1]) && (n.style = "italic"), g.test(s[1]))
|
|
1165
719
|
n.weight = "bold";
|
|
1166
720
|
else {
|
|
1167
|
-
var
|
|
1168
|
-
|
|
721
|
+
var p = parseInt(/\b(\d+)\b/.exec(s[1]), 10);
|
|
722
|
+
p >= 100 && p !== 400 && (n.weight = p);
|
|
1169
723
|
}
|
|
1170
724
|
return n;
|
|
1171
725
|
}
|
|
1172
726
|
function b() {
|
|
1173
|
-
var e, n,
|
|
727
|
+
var e, n, s, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = 14, w = 12, x = null, k = null, S = "";
|
|
1174
728
|
if (i && i.nodeType) {
|
|
1175
|
-
var
|
|
1176
|
-
e =
|
|
729
|
+
var M = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), O = M.getComputedStyle(i, null);
|
|
730
|
+
e = O.getPropertyValue("font-family") || "", w = parseFloat(O.getPropertyValue("font-size")), p = O.getPropertyValue("line-height"), x = O.getPropertyValue("font-weight"), k = O.getPropertyValue("font-style"), S = O.getPropertyValue("font-variant") || "";
|
|
1177
731
|
} else if (typeof i == "string") {
|
|
1178
|
-
var
|
|
1179
|
-
e =
|
|
732
|
+
var I = A(i);
|
|
733
|
+
e = I.family, w = I.size, p = I.height, S = I.variant, k = I.style, x = I.weight;
|
|
1180
734
|
} else
|
|
1181
|
-
|
|
1182
|
-
c.size && c.size < 3 && (w *= c.size),
|
|
1183
|
-
var
|
|
1184
|
-
return
|
|
735
|
+
o(i) === "object" && (e = i.family, w = i.size, p = i.height, S = i.variant, x = i.weight, k = i.style, n = i.baseline, s = i.color);
|
|
736
|
+
c.size && c.size < 3 && (w *= c.size), p = p !== "normal" && p ? parseFloat(p) : w * (7 / 6), c.height && c.height < 3 && (p *= c.height);
|
|
737
|
+
var L = Object.create(T);
|
|
738
|
+
return L.family = c.family || e || "sans-serif", L.height = p ?? 14, L.size = w ?? 12, L.variant = c.variant || S || "", L.style = c.style || k || "", L.weight = c.weight || x || "", L.baseline = n || 0, c.baseline != null && (L.baseline = c.baseline), L.color = c.color || s || "", L.id = v.call(L, !0), L;
|
|
1185
739
|
}
|
|
1186
|
-
const
|
|
1187
|
-
var
|
|
740
|
+
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 };
|
|
741
|
+
var E, $ = function(e) {
|
|
1188
742
|
var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
|
|
1189
743
|
if (n && n.getContext) {
|
|
1190
|
-
var
|
|
1191
|
-
if (
|
|
744
|
+
var s = n.getContext("2d");
|
|
745
|
+
if (s && typeof s.measureText == "function")
|
|
1192
746
|
return function(i, c) {
|
|
1193
|
-
return
|
|
747
|
+
return s.font = String(c), s.measureText(i).width;
|
|
1194
748
|
};
|
|
1195
749
|
}
|
|
1196
|
-
}(typeof document < "u" ? document : null) || (
|
|
1197
|
-
if (!
|
|
1198
|
-
var
|
|
1199
|
-
|
|
750
|
+
}(typeof document < "u" ? document : null) || (E = {}, function(e, n) {
|
|
751
|
+
if (!E[n]) {
|
|
752
|
+
var s = b(n);
|
|
753
|
+
E[n] = s, /\bmonospace\b/.test(s.family) ? s.size *= 0.6 : (s.size *= 0.45, s.weight && (s.size *= 1.18));
|
|
1200
754
|
}
|
|
1201
|
-
return e.length *
|
|
1202
|
-
}),
|
|
1203
|
-
function
|
|
1204
|
-
var i = Object.assign({}, _,
|
|
755
|
+
return e.length * E[n].size;
|
|
756
|
+
}), N = {}, _ = { trim: !0, collapse: !0 };
|
|
757
|
+
function W(e, n, s) {
|
|
758
|
+
var i = Object.assign({}, _, s), c = String(e);
|
|
1205
759
|
if (!c)
|
|
1206
760
|
return 0;
|
|
1207
|
-
if (c in
|
|
1208
|
-
var
|
|
1209
|
-
return
|
|
761
|
+
if (c in C) {
|
|
762
|
+
var p = n.id + "/" + c;
|
|
763
|
+
return p in N || (N[p] = $("_".concat(c, "_"), n) - $("__", n)), N[p];
|
|
1210
764
|
}
|
|
1211
|
-
return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "),
|
|
765
|
+
return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), $(c, n) + n.size * (e.tracking || 0);
|
|
1212
766
|
}
|
|
1213
|
-
function
|
|
1214
|
-
return
|
|
767
|
+
function G(e) {
|
|
768
|
+
return G = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1215
769
|
return typeof n;
|
|
1216
770
|
} : function(n) {
|
|
1217
771
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1218
|
-
},
|
|
772
|
+
}, G(e);
|
|
1219
773
|
}
|
|
1220
|
-
function
|
|
774
|
+
function _t(e, n) {
|
|
1221
775
|
if (typeof n != "function" && n !== null)
|
|
1222
776
|
throw new TypeError("Super expression must either be null or a function");
|
|
1223
|
-
e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n &&
|
|
777
|
+
e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && It(e, n);
|
|
1224
778
|
}
|
|
1225
|
-
function
|
|
1226
|
-
return
|
|
1227
|
-
return
|
|
1228
|
-
},
|
|
779
|
+
function It(e, n) {
|
|
780
|
+
return It = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(s, i) {
|
|
781
|
+
return s.__proto__ = i, s;
|
|
782
|
+
}, It(e, n);
|
|
1229
783
|
}
|
|
1230
|
-
function
|
|
784
|
+
function Jt(e) {
|
|
1231
785
|
var n = function() {
|
|
1232
786
|
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
|
|
1233
787
|
return !1;
|
|
@@ -1241,62 +795,62 @@ var Xe = { exports: {} };
|
|
|
1241
795
|
}
|
|
1242
796
|
}();
|
|
1243
797
|
return function() {
|
|
1244
|
-
var
|
|
798
|
+
var s, i = Nt(e);
|
|
1245
799
|
if (n) {
|
|
1246
|
-
var c =
|
|
1247
|
-
|
|
800
|
+
var c = Nt(this).constructor;
|
|
801
|
+
s = Reflect.construct(i, arguments, c);
|
|
1248
802
|
} else
|
|
1249
|
-
|
|
1250
|
-
return
|
|
803
|
+
s = i.apply(this, arguments);
|
|
804
|
+
return en(this, s);
|
|
1251
805
|
};
|
|
1252
806
|
}
|
|
1253
|
-
function
|
|
1254
|
-
if (n && (
|
|
807
|
+
function en(e, n) {
|
|
808
|
+
if (n && (G(n) === "object" || typeof n == "function"))
|
|
1255
809
|
return n;
|
|
1256
810
|
if (n !== void 0)
|
|
1257
811
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
1258
|
-
return function(
|
|
1259
|
-
if (
|
|
812
|
+
return function(s) {
|
|
813
|
+
if (s === void 0)
|
|
1260
814
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1261
|
-
return
|
|
815
|
+
return s;
|
|
1262
816
|
}(e);
|
|
1263
817
|
}
|
|
1264
|
-
function
|
|
1265
|
-
return
|
|
818
|
+
function Nt(e) {
|
|
819
|
+
return Nt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
|
|
1266
820
|
return n.__proto__ || Object.getPrototypeOf(n);
|
|
1267
|
-
},
|
|
821
|
+
}, Nt(e);
|
|
1268
822
|
}
|
|
1269
|
-
function
|
|
823
|
+
function Ht(e, n) {
|
|
1270
824
|
if (!(e instanceof n))
|
|
1271
825
|
throw new TypeError("Cannot call a class as a function");
|
|
1272
826
|
}
|
|
1273
|
-
function
|
|
1274
|
-
for (var
|
|
1275
|
-
var i = n[
|
|
1276
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(
|
|
1277
|
-
if (
|
|
1278
|
-
return
|
|
1279
|
-
var x =
|
|
827
|
+
function me(e, n) {
|
|
828
|
+
for (var s = 0; s < n.length; s++) {
|
|
829
|
+
var i = n[s];
|
|
830
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
|
|
831
|
+
if (G(p) !== "object" || p === null)
|
|
832
|
+
return p;
|
|
833
|
+
var x = p[Symbol.toPrimitive];
|
|
1280
834
|
if (x !== void 0) {
|
|
1281
|
-
var
|
|
1282
|
-
if (
|
|
1283
|
-
return
|
|
835
|
+
var k = x.call(p, w);
|
|
836
|
+
if (G(k) !== "object")
|
|
837
|
+
return k;
|
|
1284
838
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1285
839
|
}
|
|
1286
|
-
return String(
|
|
1287
|
-
}(i.key, "string"),
|
|
840
|
+
return String(p);
|
|
841
|
+
}(i.key, "string"), G(c) === "symbol" ? c : String(c)), i);
|
|
1288
842
|
}
|
|
1289
843
|
var c;
|
|
1290
844
|
}
|
|
1291
|
-
function
|
|
1292
|
-
return n &&
|
|
845
|
+
function Ft(e, n, s) {
|
|
846
|
+
return n && me(e.prototype, n), s && me(e, s), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1293
847
|
}
|
|
1294
|
-
var
|
|
848
|
+
var F = function() {
|
|
1295
849
|
function e() {
|
|
1296
850
|
var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
1297
|
-
|
|
851
|
+
Ht(this, e), this.value = n, this.weight = null, this.style = null, this.font = null, this.href = null, this.sub = !1, this.sup = !1;
|
|
1298
852
|
}
|
|
1299
|
-
return
|
|
853
|
+
return Ft(e, [{ key: "clone", value: function() {
|
|
1300
854
|
var n = new e(this.value);
|
|
1301
855
|
return n.value = this.value, n.weight = this.weight, n.style = this.style, n.font = this.font, n.href = this.href, n.sub = this.sub, n.sup = this.sup, n;
|
|
1302
856
|
} }, { key: "valueOf", value: function() {
|
|
@@ -1304,43 +858,43 @@ var Xe = { exports: {} };
|
|
|
1304
858
|
} }, { key: "toString", value: function() {
|
|
1305
859
|
return this.value;
|
|
1306
860
|
} }]), e;
|
|
1307
|
-
}(),
|
|
1308
|
-
|
|
1309
|
-
var n =
|
|
1310
|
-
function
|
|
1311
|
-
return
|
|
861
|
+
}(), Dt = function(e) {
|
|
862
|
+
_t(s, e);
|
|
863
|
+
var n = Jt(s);
|
|
864
|
+
function s() {
|
|
865
|
+
return Ht(this, s), n.apply(this, arguments);
|
|
1312
866
|
}
|
|
1313
|
-
return
|
|
1314
|
-
}(
|
|
1315
|
-
|
|
1316
|
-
var n =
|
|
1317
|
-
function
|
|
1318
|
-
return
|
|
867
|
+
return Ft(s);
|
|
868
|
+
}(F), et = function(e) {
|
|
869
|
+
_t(s, e);
|
|
870
|
+
var n = Jt(s);
|
|
871
|
+
function s() {
|
|
872
|
+
return Ht(this, s), n.apply(this, arguments);
|
|
1319
873
|
}
|
|
1320
|
-
return
|
|
1321
|
-
}(
|
|
1322
|
-
|
|
1323
|
-
var n =
|
|
1324
|
-
function
|
|
1325
|
-
return
|
|
874
|
+
return Ft(s);
|
|
875
|
+
}(F), pt = function(e) {
|
|
876
|
+
_t(s, e);
|
|
877
|
+
var n = Jt(s);
|
|
878
|
+
function s() {
|
|
879
|
+
return Ht(this, s), n.apply(this, arguments);
|
|
1326
880
|
}
|
|
1327
|
-
return
|
|
1328
|
-
}(
|
|
1329
|
-
function
|
|
881
|
+
return Ft(s);
|
|
882
|
+
}(F), Qt = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, nn = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, ve = /^[\xA0\u2011\u202F\u2060\uFEFF]/, rn = /^(?:[;\xAD%?…]|,(?!\d))/, sn = /^[´±°¢£¤$¥\u2212]/;
|
|
883
|
+
function Bt(e, n) {
|
|
1330
884
|
n !== !1 && (e = e.trim());
|
|
1331
|
-
for (var
|
|
1332
|
-
|
|
1333
|
-
var
|
|
1334
|
-
if ((
|
|
1335
|
-
var
|
|
1336
|
-
/\u00AD$/.test(
|
|
885
|
+
for (var s, i, c = [], p = e.charAt(0), w = 0, x = 1, k = e.length; x < k; x++) {
|
|
886
|
+
s = e.charAt(x), i = e.charAt(x + 1);
|
|
887
|
+
var S = Qt.test(p), M = Qt.test(s), O = M || S, I = void 0;
|
|
888
|
+
if ((sn.test(s) && !ve.test(p) || rn.test(p + i) && !ve.test(s)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((I = Qt.test(e.charAt(x - 2))) && !M && (O = !1), !I && nn.test(s + i) && (O = !0)), O) {
|
|
889
|
+
var L = e.slice(w, x);
|
|
890
|
+
/\u00AD$/.test(L) ? (c.push(new F(L.slice(0, -1))), c.push(new pt())) : (c.push(new F(L)), c.push(new Dt())), w = x;
|
|
1337
891
|
}
|
|
1338
|
-
|
|
892
|
+
p = s;
|
|
1339
893
|
}
|
|
1340
|
-
return c.push(new
|
|
894
|
+
return c.push(new F(e.slice(w))), c;
|
|
1341
895
|
}
|
|
1342
|
-
const
|
|
1343
|
-
var
|
|
896
|
+
const xe = { 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: "›" };
|
|
897
|
+
var on = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, an = /^<\/([a-zA-Z0-9]+)([^>]*)>/, ln = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, hn = /^<!--(.+?)-->/, cn = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, we = { b: function(e) {
|
|
1344
898
|
e.weight = "bold";
|
|
1345
899
|
}, strong: function(e) {
|
|
1346
900
|
e.weight = "bold";
|
|
@@ -1366,37 +920,37 @@ var Xe = { exports: {} };
|
|
|
1366
920
|
e.sub = !0;
|
|
1367
921
|
}, sup: function(e) {
|
|
1368
922
|
e.sup = !0;
|
|
1369
|
-
} },
|
|
1370
|
-
function
|
|
1371
|
-
return e.replace(
|
|
1372
|
-
if (
|
|
1373
|
-
var
|
|
1374
|
-
return String.fromCharCode(parseInt(
|
|
923
|
+
} }, un = { 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 };
|
|
924
|
+
function be(e) {
|
|
925
|
+
return e.replace(cn, function(n, s, i, c) {
|
|
926
|
+
if (s || i) {
|
|
927
|
+
var p = s ? 10 : 16;
|
|
928
|
+
return String.fromCharCode(parseInt(s || i, p));
|
|
1375
929
|
}
|
|
1376
|
-
return c in
|
|
930
|
+
return c in xe ? xe[c] : n;
|
|
1377
931
|
});
|
|
1378
932
|
}
|
|
1379
|
-
function
|
|
933
|
+
function dn(e) {
|
|
1380
934
|
return e && e.length > 1 && (e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'") ? e.slice(1, -1) : e;
|
|
1381
935
|
}
|
|
1382
|
-
var
|
|
1383
|
-
function
|
|
1384
|
-
var n,
|
|
936
|
+
var fn = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
|
|
937
|
+
function pn(e) {
|
|
938
|
+
var n, s = {};
|
|
1385
939
|
if (e) {
|
|
1386
940
|
do
|
|
1387
|
-
if (n =
|
|
1388
|
-
var i =
|
|
1389
|
-
if (
|
|
941
|
+
if (n = fn.exec(e)) {
|
|
942
|
+
var i = be(dn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
|
|
943
|
+
if (s[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0]))
|
|
1390
944
|
throw new Error("Attribute error");
|
|
1391
945
|
}
|
|
1392
946
|
while (n && e.length);
|
|
1393
947
|
if (/\S/.test(e))
|
|
1394
948
|
throw new Error("Attribute error");
|
|
1395
949
|
}
|
|
1396
|
-
return
|
|
950
|
+
return s;
|
|
1397
951
|
}
|
|
1398
|
-
const
|
|
1399
|
-
var
|
|
952
|
+
const Ae = { 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: "Þ" };
|
|
953
|
+
var gn = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, yn = /^%[^\n]+(?:\n|$)/, mn = /^[^#$%&~_^\\{}]+/, vn = /^\\([&{}$%#_])/, xn = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, wn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, U = { bf: function(e) {
|
|
1400
954
|
e.weight = "bold";
|
|
1401
955
|
}, it: function(e) {
|
|
1402
956
|
e.style = "italic";
|
|
@@ -1411,170 +965,170 @@ var Xe = { exports: {} };
|
|
|
1411
965
|
}, _: function(e) {
|
|
1412
966
|
e.sub = !0;
|
|
1413
967
|
}, par: function(e) {
|
|
1414
|
-
this.tokens.push(new
|
|
968
|
+
this.tokens.push(new et(), new et());
|
|
1415
969
|
}, newline: function(e) {
|
|
1416
|
-
this.tokens.push(new
|
|
970
|
+
this.tokens.push(new et());
|
|
1417
971
|
}, url: function(e, n) {
|
|
1418
|
-
this.open_context().href = n, this.add_token(new
|
|
972
|
+
this.open_context().href = n, this.add_token(new F(n)), this.close_context();
|
|
1419
973
|
} };
|
|
1420
974
|
U.textsuperscript = U["^"], U.textsubscript = U._, U.textsl = U.sl, U.mathbf = U.bf, U.mathit = U.it, U.textbf = U.bf, U.textit = U.it, U.textcolor = U.color;
|
|
1421
|
-
var
|
|
1422
|
-
function
|
|
975
|
+
var bn = /[\r\n\xA0]+/g;
|
|
976
|
+
function An(e, n) {
|
|
1423
977
|
e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
|
|
1424
|
-
var
|
|
1425
|
-
return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (
|
|
978
|
+
var s = n;
|
|
979
|
+
return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (s = b(n, e)), s;
|
|
1426
980
|
}
|
|
1427
|
-
function
|
|
1428
|
-
for (var i, c,
|
|
1429
|
-
c = (i = e[e.length - 1]).width, i.width >
|
|
1430
|
-
e[e.length - 1] instanceof pt && e.pop(), i = e[e.length - 1] || i || {},
|
|
981
|
+
function Ee(e, n, s) {
|
|
982
|
+
for (var i, c, p = e.width; p + s.width > n && e.length; )
|
|
983
|
+
c = (i = e[e.length - 1]).width, i.width > s.width ? (i.value = i.value.slice(0, -1), i.width = W(i, i.font), p += i.width) : e.pop(), p -= c;
|
|
984
|
+
e[e.length - 1] instanceof pt && e.pop(), i = e[e.length - 1] || i || {}, s.font = b(s.font, i.bold, i.italic, ""), s.href = e.length ? i.href : null, s.rel = e.length ? i.rel : null, s.target = e.length ? i.target : null, e.push(s);
|
|
1431
985
|
}
|
|
1432
|
-
function
|
|
986
|
+
function xt(e) {
|
|
1433
987
|
return Math.round(1e6 * e) / 1e6;
|
|
1434
988
|
}
|
|
1435
|
-
function
|
|
989
|
+
function ke(e) {
|
|
1436
990
|
return function(n) {
|
|
1437
991
|
if (Array.isArray(n))
|
|
1438
|
-
return
|
|
992
|
+
return te(n);
|
|
1439
993
|
}(e) || function(n) {
|
|
1440
994
|
if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null)
|
|
1441
995
|
return Array.from(n);
|
|
1442
|
-
}(e) || function(n,
|
|
996
|
+
}(e) || function(n, s) {
|
|
1443
997
|
if (n) {
|
|
1444
998
|
if (typeof n == "string")
|
|
1445
|
-
return
|
|
999
|
+
return te(n, s);
|
|
1446
1000
|
var i = Object.prototype.toString.call(n).slice(8, -1);
|
|
1447
|
-
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) ?
|
|
1001
|
+
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) ? te(n, s) : void 0;
|
|
1448
1002
|
}
|
|
1449
1003
|
}(e) || function() {
|
|
1450
1004
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1451
1005
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1452
1006
|
}();
|
|
1453
1007
|
}
|
|
1454
|
-
function
|
|
1008
|
+
function te(e, n) {
|
|
1455
1009
|
(n == null || n > e.length) && (n = e.length);
|
|
1456
|
-
for (var
|
|
1457
|
-
i[
|
|
1010
|
+
for (var s = 0, i = new Array(n); s < n; s++)
|
|
1011
|
+
i[s] = e[s];
|
|
1458
1012
|
return i;
|
|
1459
1013
|
}
|
|
1460
|
-
var
|
|
1014
|
+
var En = { center: "middle", right: "end" }, kn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, ee = function(e, n) {
|
|
1461
1015
|
return !e && !n || e === n;
|
|
1462
1016
|
};
|
|
1463
|
-
function
|
|
1464
|
-
var
|
|
1017
|
+
function Sn(e, n) {
|
|
1018
|
+
var s = [], i = n.font(), c = i.size, p = i.family, w = n.align(), x = n.createElement();
|
|
1465
1019
|
if (e.length) {
|
|
1466
|
-
var
|
|
1467
|
-
if (
|
|
1468
|
-
var
|
|
1469
|
-
|
|
1020
|
+
var k = i.height, S = n.valign(), M = n.height()(), O = n.width()(0), I = !isFinite(O) && e.length === 1, L = I ? null : n.x(), B = xt(k / c), J = I ? null : xt(k / (1.15 * c + (k - c) / 2));
|
|
1021
|
+
if (kn[S] && isFinite(M)) {
|
|
1022
|
+
var z = S === "bottom" ? 1 : 0.5;
|
|
1023
|
+
J += (M * z - k * e.length * z) / c;
|
|
1470
1024
|
}
|
|
1471
|
-
var
|
|
1472
|
-
w === "right" ?
|
|
1473
|
-
for (var
|
|
1025
|
+
var P = w === "justify", j = 0;
|
|
1026
|
+
w === "right" ? j = O : w === "center" && (j = O / 2);
|
|
1027
|
+
for (var H = [], Q = "tspan", Y = null, q = "", D = function() {
|
|
1474
1028
|
if (q) {
|
|
1475
|
-
var gt = x(
|
|
1476
|
-
|
|
1029
|
+
var gt = x(Q, Y, q);
|
|
1030
|
+
H.push(gt);
|
|
1477
1031
|
}
|
|
1478
|
-
|
|
1479
|
-
},
|
|
1480
|
-
var at = "", dt = "", st = 0, lt = e[
|
|
1032
|
+
Q = "tspan", Y = null, q = "";
|
|
1033
|
+
}, nt = 0, tt = e.length; nt < tt; nt++) {
|
|
1034
|
+
var at = "", dt = "", st = 0, lt = e[nt];
|
|
1481
1035
|
if (lt.length) {
|
|
1482
|
-
|
|
1483
|
-
for (var
|
|
1484
|
-
var
|
|
1485
|
-
|
|
1036
|
+
H = [];
|
|
1037
|
+
for (var wt = 0, Lt = 0, ht = void 0, X = 0, jt = lt.length; X < jt; X++) {
|
|
1038
|
+
var R = lt[X], Z = R.font;
|
|
1039
|
+
R.whitespace && wt++, Lt += R.width, X && !R.tracking && !st && ee(Z.id, at) && ee(R.class, dt) && ee(ht, R.href) ? q += R.value : (D(), q = R.value, Y = { fontFamily: Z.family !== p ? Z.family : null, fontSize: Z.size !== c ? Z.size : null, fontWeight: Z.weight || null, fontStyle: Z.style || null, fontVariant: Z.variant !== "normal" && Z.variant || null, fill: Z.color || null, baselineShift: Z.baseline ? 100 * Z.baseline + "%" : null, className: R.class || null }, st && (Y.dx = xt(st), st = 0), R.tracking && (st = Z.size * R.tracking), R.href && !ht ? (ht = R.href, Q = "a", Y.href = ht, Y.rel = R.rel, Y.target = R.target) : ht = null, at = Z.id, dt = R.class);
|
|
1486
1040
|
}
|
|
1487
|
-
if (D(),
|
|
1488
|
-
|
|
1041
|
+
if (D(), I)
|
|
1042
|
+
s.push.apply(s, ke(H));
|
|
1489
1043
|
else {
|
|
1490
|
-
var
|
|
1491
|
-
|
|
1044
|
+
var qt = null, Ct = nt === tt - 1 || lt[lt.length - 1] instanceof et;
|
|
1045
|
+
P && lt.length > 1 && !Ct && (qt = xt((O - Lt) / wt)), s.push(x.apply(void 0, ["tspan", { wordSpacing: qt, x: L(nt) + j, dy: xt(nt ? B : J) + "em" }].concat(ke(H))));
|
|
1492
1046
|
}
|
|
1493
1047
|
} else
|
|
1494
|
-
|
|
1048
|
+
s.push(x("tspan", { x: L(nt), dy: xt(nt ? B : J) + "em" }, " "));
|
|
1495
1049
|
}
|
|
1496
1050
|
}
|
|
1497
|
-
return x.apply(void 0, ["text", { fontFamily:
|
|
1051
|
+
return x.apply(void 0, ["text", { fontFamily: p, fontSize: c, textAnchor: En[w] || "start" }].concat(s));
|
|
1498
1052
|
}
|
|
1499
|
-
var
|
|
1500
|
-
function
|
|
1053
|
+
var Tn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
|
|
1054
|
+
function _n(e, n, s) {
|
|
1501
1055
|
if (e.length) {
|
|
1502
|
-
|
|
1503
|
-
var i = n.font(), c = i.height,
|
|
1504
|
-
if (
|
|
1505
|
-
var
|
|
1506
|
-
|
|
1056
|
+
s.textBaseline = "middle";
|
|
1057
|
+
var i = n.font(), c = i.height, p = i.size, w = n.valign(), x = n.height()(), k = n.width()(0), S = n.align(), M = S === "justify", O = 0.5 * c, I = Tn[w];
|
|
1058
|
+
if (I && isFinite(x)) {
|
|
1059
|
+
var L = e.length * c;
|
|
1060
|
+
O += x * I - L * I;
|
|
1507
1061
|
}
|
|
1508
|
-
e.forEach(function(
|
|
1509
|
-
var
|
|
1510
|
-
|
|
1511
|
-
q.whitespace &&
|
|
1062
|
+
e.forEach(function(B, J) {
|
|
1063
|
+
var z = n.x()(J), P = J * c + O, j = 0, H = 0;
|
|
1064
|
+
B.forEach(function(q) {
|
|
1065
|
+
q.whitespace && j++, H += q.width;
|
|
1512
1066
|
});
|
|
1513
|
-
var
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
var D = q.font,
|
|
1517
|
-
|
|
1067
|
+
var Q = 0, Y = J === e.length - 1 || B[B.length - 1] instanceof et;
|
|
1068
|
+
M && B.length > 1 && !Y && (Q = (k - H) / j), B.forEach(function(q) {
|
|
1069
|
+
s.font = q.font;
|
|
1070
|
+
var D = q.font, nt = D.baseline ? p * -D.baseline + 0.15 * p : 0;
|
|
1071
|
+
s.fillStyle = function(dt, st) {
|
|
1518
1072
|
return dt.color ? dt.color : st.href ? "#00C" : "#000";
|
|
1519
1073
|
}(D, q);
|
|
1520
|
-
var
|
|
1521
|
-
if (
|
|
1522
|
-
|
|
1523
|
-
var at = Math.floor(
|
|
1524
|
-
|
|
1074
|
+
var tt = 0;
|
|
1075
|
+
if (S === "right" ? tt += k - H : S === "center" ? tt += k / 2 - H / 2 : S === "justify" && (q.whitespace || q instanceof et) && (z += Q), s.fillText(q.value, z + tt, P + nt), q.href) {
|
|
1076
|
+
s.beginPath(), s.strokeStyle = s.fillStyle;
|
|
1077
|
+
var at = Math.floor(P + 0.45 * p) + 0.5;
|
|
1078
|
+
s.moveTo(z + tt, at), s.lineTo(z + tt + q.width, at), s.stroke();
|
|
1525
1079
|
}
|
|
1526
|
-
|
|
1080
|
+
z += q.width;
|
|
1527
1081
|
});
|
|
1528
1082
|
});
|
|
1529
1083
|
}
|
|
1530
1084
|
}
|
|
1531
|
-
function
|
|
1532
|
-
return
|
|
1085
|
+
function ne(e) {
|
|
1086
|
+
return ne = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1533
1087
|
return typeof n;
|
|
1534
1088
|
} : function(n) {
|
|
1535
1089
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1536
|
-
},
|
|
1090
|
+
}, ne(e);
|
|
1537
1091
|
}
|
|
1538
|
-
function
|
|
1539
|
-
for (var n = {},
|
|
1540
|
-
var i = e[
|
|
1541
|
-
typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i :
|
|
1092
|
+
function Se(e) {
|
|
1093
|
+
for (var n = {}, s = 0; s < e.length; s++) {
|
|
1094
|
+
var i = e[s];
|
|
1095
|
+
typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : ne(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));
|
|
1542
1096
|
}
|
|
1543
1097
|
return n;
|
|
1544
1098
|
}
|
|
1545
|
-
function
|
|
1546
|
-
return
|
|
1099
|
+
function Mt(e) {
|
|
1100
|
+
return Mt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1547
1101
|
return typeof n;
|
|
1548
1102
|
} : function(n) {
|
|
1549
1103
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1550
|
-
},
|
|
1104
|
+
}, Mt(e);
|
|
1551
1105
|
}
|
|
1552
|
-
function
|
|
1553
|
-
for (var
|
|
1554
|
-
var i = n[
|
|
1555
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(
|
|
1556
|
-
if (
|
|
1557
|
-
return
|
|
1558
|
-
var x =
|
|
1106
|
+
function In(e, n) {
|
|
1107
|
+
for (var s = 0; s < n.length; s++) {
|
|
1108
|
+
var i = n[s];
|
|
1109
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
|
|
1110
|
+
if (Mt(p) !== "object" || p === null)
|
|
1111
|
+
return p;
|
|
1112
|
+
var x = p[Symbol.toPrimitive];
|
|
1559
1113
|
if (x !== void 0) {
|
|
1560
|
-
var
|
|
1561
|
-
if (
|
|
1562
|
-
return
|
|
1114
|
+
var k = x.call(p, w);
|
|
1115
|
+
if (Mt(k) !== "object")
|
|
1116
|
+
return k;
|
|
1563
1117
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1564
1118
|
}
|
|
1565
|
-
return String(
|
|
1566
|
-
}(i.key, "string"),
|
|
1119
|
+
return String(p);
|
|
1120
|
+
}(i.key, "string"), Mt(c) === "symbol" ? c : String(c)), i);
|
|
1567
1121
|
}
|
|
1568
1122
|
var c;
|
|
1569
1123
|
}
|
|
1570
|
-
var
|
|
1124
|
+
var Dn = b(), ie = function(e) {
|
|
1571
1125
|
return typeof e == "function" ? e : function() {
|
|
1572
1126
|
return e;
|
|
1573
1127
|
};
|
|
1574
|
-
},
|
|
1128
|
+
}, it = function() {
|
|
1575
1129
|
function e(i) {
|
|
1576
|
-
if (function(
|
|
1577
|
-
if (!(
|
|
1130
|
+
if (function(p, w) {
|
|
1131
|
+
if (!(p instanceof w))
|
|
1578
1132
|
throw new TypeError("Cannot call a class as a function");
|
|
1579
1133
|
}(this, e), this.props = { overflow: "ellipsis", lineclamp: null, align: "left", wordBreak: null, valign: "top", width: function() {
|
|
1580
1134
|
return 1 / 0;
|
|
@@ -1586,82 +1140,82 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1586
1140
|
for (var c in i)
|
|
1587
1141
|
typeof this[c] == "function" && this[c](i[c]);
|
|
1588
1142
|
}
|
|
1589
|
-
var n,
|
|
1590
|
-
return n = e,
|
|
1591
|
-
var c = this,
|
|
1592
|
-
if (!
|
|
1143
|
+
var n, s;
|
|
1144
|
+
return n = e, s = [{ key: "linebreak", value: function(i) {
|
|
1145
|
+
var c = this, p = this.props.parser(String(i)), w = this.font(), x = function(k, S, M) {
|
|
1146
|
+
if (!k.length)
|
|
1593
1147
|
return [];
|
|
1594
|
-
var
|
|
1595
|
-
if (!
|
|
1148
|
+
var O = S.height(), I = S.width(), L = S.overflowLine(), B = S.overflowWrap(), J = b(M, !0, !1), z = isFinite(O()) ? Math.floor(O() / M.height) : 1 / 0;
|
|
1149
|
+
if (!O() && !I(0) || !z)
|
|
1596
1150
|
return [];
|
|
1597
|
-
for (var
|
|
1598
|
-
var D =
|
|
1599
|
-
if (D.width =
|
|
1600
|
-
if (D instanceof
|
|
1601
|
-
|
|
1602
|
-
else if (D instanceof
|
|
1603
|
-
|
|
1604
|
-
else if (D.whitespace ||
|
|
1605
|
-
|
|
1606
|
-
else if (
|
|
1607
|
-
var
|
|
1151
|
+
for (var P = 0, j = 0, H = 0, Q = [], Y = [], q = !1; P < k.length && j < z; ) {
|
|
1152
|
+
var D = k[P], nt = An(D, M);
|
|
1153
|
+
if (D.width = W(D, nt), D.font = nt, D.line = j, D.whitespace = D.value in C, D.value && (D.value = D.value.replace(bn, " ")), !(!H && D.whitespace || q && D.whitespace))
|
|
1154
|
+
if (D instanceof et)
|
|
1155
|
+
H = 0, Y = [], Q.push(P + 1), j++;
|
|
1156
|
+
else if (D instanceof Dt || D instanceof pt)
|
|
1157
|
+
Y.push({ index: P, width: H });
|
|
1158
|
+
else if (D.whitespace || H + D.width < I(j))
|
|
1159
|
+
H += D.width;
|
|
1160
|
+
else if (Y.length) {
|
|
1161
|
+
var tt = void 0, at = void 0;
|
|
1608
1162
|
do {
|
|
1609
|
-
at = !0,
|
|
1610
|
-
var dt =
|
|
1611
|
-
dt instanceof pt && (st =
|
|
1163
|
+
at = !0, tt = Y.pop();
|
|
1164
|
+
var dt = k[tt.index], st = void 0;
|
|
1165
|
+
dt instanceof pt && (st = W("-", dt.font), tt.width + st > I(j) && (at = !Y.length));
|
|
1612
1166
|
} while (!at);
|
|
1613
|
-
|
|
1614
|
-
} else if (
|
|
1615
|
-
var lt =
|
|
1616
|
-
if (
|
|
1617
|
-
var
|
|
1167
|
+
Q.push(tt.index + 1), H = 0, j++, P = tt.index, Y = [];
|
|
1168
|
+
} else if (B === "break-word") {
|
|
1169
|
+
var lt = I(j);
|
|
1170
|
+
if (H + D.width > lt) {
|
|
1171
|
+
var wt = D.clone();
|
|
1618
1172
|
do
|
|
1619
|
-
D.value = D.value.slice(0, -1), D.width =
|
|
1173
|
+
D.value = D.value.slice(0, -1), D.width = W(D, D.font), H += D.width;
|
|
1620
1174
|
while (D.value && D.width > lt);
|
|
1621
|
-
|
|
1175
|
+
wt.value = wt.value.slice(D.value.length), k.splice(P + 1, 0, new Dt(), wt);
|
|
1622
1176
|
}
|
|
1623
|
-
|
|
1177
|
+
Q.push(P + 1), H = 0, j++;
|
|
1624
1178
|
} else
|
|
1625
|
-
|
|
1626
|
-
|
|
1179
|
+
H += D.width;
|
|
1180
|
+
P++, q = D.whitespace;
|
|
1627
1181
|
}
|
|
1628
|
-
|
|
1629
|
-
var
|
|
1630
|
-
for (var
|
|
1182
|
+
P !== Q[Q.length - 1] && Q.push(P);
|
|
1183
|
+
var Lt = 0, ht = 0, X = Q.map(function(gt) {
|
|
1184
|
+
for (var K, yt = Lt; (K = k[yt]) && (K.whitespace || !K.value); )
|
|
1631
1185
|
yt++;
|
|
1632
|
-
for (var ft = gt,
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
var
|
|
1636
|
-
return
|
|
1186
|
+
for (var ft = gt, oe = null; ft > yt && (K = k[ft - 1]) && (K.whitespace || !(K.value || K instanceof pt)); )
|
|
1187
|
+
K instanceof et && (oe = K), ft--;
|
|
1188
|
+
K instanceof pt && (K.value = "-", K.width = W("-", K.font)), Lt = gt;
|
|
1189
|
+
var bt = k.slice(yt, ft).filter(function(ae) {
|
|
1190
|
+
return ae.value;
|
|
1637
1191
|
});
|
|
1638
|
-
return
|
|
1639
|
-
return
|
|
1640
|
-
}, 0),
|
|
1192
|
+
return oe && bt.push(oe), bt.width = bt.reduce(function(ae, Pn) {
|
|
1193
|
+
return ae + Pn.width;
|
|
1194
|
+
}, 0), bt.width > ht && (ht = bt.width), bt;
|
|
1641
1195
|
});
|
|
1642
|
-
if (
|
|
1643
|
-
var
|
|
1644
|
-
|
|
1645
|
-
var yt =
|
|
1196
|
+
if (X.hasLineOverflow = !1, L) {
|
|
1197
|
+
var jt = L === "ellipsis" ? "…" : L;
|
|
1198
|
+
X.forEach(function(gt, K) {
|
|
1199
|
+
var yt = I(K);
|
|
1646
1200
|
if (gt.width > yt) {
|
|
1647
|
-
var ft = new
|
|
1648
|
-
ft.font =
|
|
1201
|
+
var ft = new F(jt);
|
|
1202
|
+
ft.font = M, ft.width = W(jt, J), Ee(gt, yt, ft), X.hasLineOverflow = !0;
|
|
1649
1203
|
}
|
|
1650
1204
|
});
|
|
1651
1205
|
}
|
|
1652
|
-
var
|
|
1653
|
-
if (
|
|
1654
|
-
var
|
|
1655
|
-
|
|
1206
|
+
var R = S.overflow() === "ellipsis" ? "…" : S.overflow();
|
|
1207
|
+
if (R && P !== k.length) {
|
|
1208
|
+
var Z = I(X.length - 1), qt = X[X.length - 1], Ct = new F(R);
|
|
1209
|
+
Ct.font = M, Ct.width = W(R, J), Ee(qt, Z, Ct), X.hasOverflow = !0;
|
|
1656
1210
|
} else
|
|
1657
|
-
|
|
1658
|
-
return
|
|
1659
|
-
}(
|
|
1660
|
-
return x.height = x.length * w.height, x.render = function(
|
|
1661
|
-
return c.render(x,
|
|
1211
|
+
X.hasOverflow = !1;
|
|
1212
|
+
return X.font = M, X.width = ht, X;
|
|
1213
|
+
}(p, this, w);
|
|
1214
|
+
return x.height = x.length * w.height, x.render = function(k) {
|
|
1215
|
+
return c.render(x, k);
|
|
1662
1216
|
}, x.svg = x.render, x.draw = x.render, x;
|
|
1663
1217
|
} }, { key: "font", value: function(i) {
|
|
1664
|
-
return arguments.length ? (this.props.font = b(i), this) : this.props.font || b(
|
|
1218
|
+
return arguments.length ? (this.props.font = b(i), this) : this.props.font || b(Dn);
|
|
1665
1219
|
} }, { key: "overflow", value: function(i) {
|
|
1666
1220
|
return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
|
|
1667
1221
|
} }, { key: "overflowLine", value: function(i) {
|
|
@@ -1679,11 +1233,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1679
1233
|
var c = String(i).toLowerCase();
|
|
1680
1234
|
return c === "break-word" ? this.props.overflowWrap = "break-word" : c !== "normal" && i != null || (this.props.overflowWrap = null), this;
|
|
1681
1235
|
} }, { key: "width", value: function(i) {
|
|
1682
|
-
return arguments.length ? (this.props.width =
|
|
1236
|
+
return arguments.length ? (this.props.width = ie(i), this) : this.props.width;
|
|
1683
1237
|
} }, { key: "height", value: function(i) {
|
|
1684
|
-
return arguments.length ? (this.props.height =
|
|
1238
|
+
return arguments.length ? (this.props.height = ie(i), this) : this.props.height;
|
|
1685
1239
|
} }, { key: "x", value: function(i) {
|
|
1686
|
-
return arguments.length ? (this.props.x =
|
|
1240
|
+
return arguments.length ? (this.props.x = ie(i), this) : this.props.x;
|
|
1687
1241
|
} }, { key: "parser", value: function(i) {
|
|
1688
1242
|
if (!arguments.length)
|
|
1689
1243
|
return this.props.parser;
|
|
@@ -1697,49 +1251,49 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1697
1251
|
} }, { key: "createElement", value: function(i) {
|
|
1698
1252
|
return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
|
|
1699
1253
|
} }, { key: "render", value: function() {
|
|
1700
|
-
var i =
|
|
1701
|
-
return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ?
|
|
1702
|
-
} }],
|
|
1254
|
+
var i = Se(arguments);
|
|
1255
|
+
return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? _n(i.text, this, i.ctx) : Sn(i.text, this);
|
|
1256
|
+
} }], s && In(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1703
1257
|
}();
|
|
1704
|
-
function
|
|
1705
|
-
return
|
|
1258
|
+
function Ot(e) {
|
|
1259
|
+
return Ot = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1706
1260
|
return typeof n;
|
|
1707
1261
|
} : function(n) {
|
|
1708
1262
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1709
|
-
},
|
|
1263
|
+
}, Ot(e);
|
|
1710
1264
|
}
|
|
1711
|
-
function
|
|
1265
|
+
function re(e, n) {
|
|
1712
1266
|
(n == null || n > e.length) && (n = e.length);
|
|
1713
|
-
for (var
|
|
1714
|
-
i[
|
|
1267
|
+
for (var s = 0, i = new Array(n); s < n; s++)
|
|
1268
|
+
i[s] = e[s];
|
|
1715
1269
|
return i;
|
|
1716
1270
|
}
|
|
1717
|
-
function
|
|
1718
|
-
for (var
|
|
1719
|
-
var i = n[
|
|
1720
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(
|
|
1721
|
-
if (
|
|
1722
|
-
return
|
|
1723
|
-
var x =
|
|
1271
|
+
function Mn(e, n) {
|
|
1272
|
+
for (var s = 0; s < n.length; s++) {
|
|
1273
|
+
var i = n[s];
|
|
1274
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
|
|
1275
|
+
if (Ot(p) !== "object" || p === null)
|
|
1276
|
+
return p;
|
|
1277
|
+
var x = p[Symbol.toPrimitive];
|
|
1724
1278
|
if (x !== void 0) {
|
|
1725
|
-
var
|
|
1726
|
-
if (
|
|
1727
|
-
return
|
|
1279
|
+
var k = x.call(p, w);
|
|
1280
|
+
if (Ot(k) !== "object")
|
|
1281
|
+
return k;
|
|
1728
1282
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1729
1283
|
}
|
|
1730
|
-
return String(
|
|
1731
|
-
}(i.key, "string"),
|
|
1284
|
+
return String(p);
|
|
1285
|
+
}(i.key, "string"), Ot(c) === "symbol" ? c : String(c)), i);
|
|
1732
1286
|
}
|
|
1733
1287
|
var c;
|
|
1734
1288
|
}
|
|
1735
|
-
var
|
|
1289
|
+
var Te = function(e) {
|
|
1736
1290
|
return typeof e == "function" ? e : function() {
|
|
1737
1291
|
return e;
|
|
1738
1292
|
};
|
|
1739
|
-
},
|
|
1293
|
+
}, _e = function() {
|
|
1740
1294
|
function e(i) {
|
|
1741
|
-
if (function(
|
|
1742
|
-
if (!(
|
|
1295
|
+
if (function(p, w) {
|
|
1296
|
+
if (!(p instanceof w))
|
|
1743
1297
|
throw new TypeError("Cannot call a class as a function");
|
|
1744
1298
|
}(this, e), this.props = { width: function() {
|
|
1745
1299
|
return 1 / 0;
|
|
@@ -1750,47 +1304,47 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1750
1304
|
typeof this[c] == "function" && this[c](i[c]);
|
|
1751
1305
|
this.render = this.render.bind(this);
|
|
1752
1306
|
}
|
|
1753
|
-
var n,
|
|
1754
|
-
return n = e,
|
|
1755
|
-
var c = this.props,
|
|
1307
|
+
var n, s;
|
|
1308
|
+
return n = e, s = [{ key: "anchor", value: function(i) {
|
|
1309
|
+
var c = this.props, p = c.hAnchor, w = c.vAnchor, x = c.width, k = c.height;
|
|
1756
1310
|
if (!arguments.length)
|
|
1757
|
-
return [
|
|
1311
|
+
return [p * x(0), w * k(0)];
|
|
1758
1312
|
if (typeof i == "string") {
|
|
1759
|
-
var
|
|
1760
|
-
i.toLowerCase().trim().split(/\s+/).forEach(function(
|
|
1761
|
-
|
|
1313
|
+
var S = this.props;
|
|
1314
|
+
i.toLowerCase().trim().split(/\s+/).forEach(function(M) {
|
|
1315
|
+
M === "top" && (S.vAnchor = -0), M === "middle" && (S.vAnchor = -0.5), M === "bottom" && (S.vAnchor = -1), M === "left" && (S.hAnchor = -0), M === "center" && (S.hAnchor = -0.5), M === "right" && (S.hAnchor = -1);
|
|
1762
1316
|
});
|
|
1763
1317
|
}
|
|
1764
1318
|
return this;
|
|
1765
1319
|
} }, { key: "width", value: function(i) {
|
|
1766
|
-
return arguments.length ? (this.props.width =
|
|
1320
|
+
return arguments.length ? (this.props.width = Te(i), this) : this.props.width;
|
|
1767
1321
|
} }, { key: "height", value: function(i) {
|
|
1768
|
-
return arguments.length ? (this.props.height =
|
|
1322
|
+
return arguments.length ? (this.props.height = Te(i), this) : this.props.height;
|
|
1769
1323
|
} }, { key: "rotate", value: function(i) {
|
|
1770
1324
|
return arguments.length ? (this.props.rotation = i, this) : this.props.rotation;
|
|
1771
1325
|
} }, { key: "createElement", value: function(i) {
|
|
1772
1326
|
return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
|
|
1773
1327
|
} }, { key: "canvas", value: function(i, c) {
|
|
1774
|
-
var
|
|
1328
|
+
var p, w = i.getContext ? i.getContext("2d") : i;
|
|
1775
1329
|
return w.save(), w.rotate(this.rotate() * Math.PI / 180), w.translate.apply(w, function(x) {
|
|
1776
1330
|
if (Array.isArray(x))
|
|
1777
|
-
return
|
|
1778
|
-
}(
|
|
1331
|
+
return re(x);
|
|
1332
|
+
}(p = this.anchor()) || function(x) {
|
|
1779
1333
|
if (typeof Symbol < "u" && x[Symbol.iterator] != null || x["@@iterator"] != null)
|
|
1780
1334
|
return Array.from(x);
|
|
1781
|
-
}(
|
|
1335
|
+
}(p) || function(x, k) {
|
|
1782
1336
|
if (x) {
|
|
1783
1337
|
if (typeof x == "string")
|
|
1784
|
-
return
|
|
1785
|
-
var
|
|
1786
|
-
return
|
|
1338
|
+
return re(x, k);
|
|
1339
|
+
var S = Object.prototype.toString.call(x).slice(8, -1);
|
|
1340
|
+
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) ? re(x, k) : void 0;
|
|
1787
1341
|
}
|
|
1788
|
-
}(
|
|
1342
|
+
}(p) || function() {
|
|
1789
1343
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1790
1344
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1791
1345
|
}()), c(w), w.restore(), w;
|
|
1792
1346
|
} }, { key: "render", value: function() {
|
|
1793
|
-
var i =
|
|
1347
|
+
var i = Se(arguments);
|
|
1794
1348
|
if (i.d3)
|
|
1795
1349
|
return i.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
|
|
1796
1350
|
if (i.ctx)
|
|
@@ -1799,156 +1353,156 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1799
1353
|
var c = typeof i.text.render == "function" ? i.text.render() : i.text;
|
|
1800
1354
|
return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
|
|
1801
1355
|
}
|
|
1802
|
-
} }],
|
|
1803
|
-
}(),
|
|
1804
|
-
function
|
|
1805
|
-
return
|
|
1806
|
-
return
|
|
1807
|
-
})),
|
|
1356
|
+
} }], s && Mn(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1357
|
+
}(), On = Object.prototype.hasOwnProperty, se = {};
|
|
1358
|
+
function Ln(e) {
|
|
1359
|
+
return se[e] || (se[e] = e.replace(/([a-z])([A-Z])/g, function(n, s, i) {
|
|
1360
|
+
return s + "-" + i.toLowerCase();
|
|
1361
|
+
})), se[e];
|
|
1808
1362
|
}
|
|
1809
|
-
function
|
|
1363
|
+
function Ie(e, n) {
|
|
1810
1364
|
if (Array.isArray(n))
|
|
1811
|
-
return n.forEach(function(
|
|
1812
|
-
return
|
|
1365
|
+
return n.forEach(function(s) {
|
|
1366
|
+
return Ie(e, s);
|
|
1813
1367
|
});
|
|
1814
1368
|
typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
|
|
1815
1369
|
}
|
|
1816
|
-
function
|
|
1370
|
+
function De(e, n) {
|
|
1817
1371
|
if (typeof document < "u") {
|
|
1818
|
-
var
|
|
1819
|
-
if (n &&
|
|
1372
|
+
var s = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
|
|
1373
|
+
if (n && s.setAttribute)
|
|
1820
1374
|
for (var i in n)
|
|
1821
|
-
|
|
1822
|
-
for (var c = arguments.length,
|
|
1823
|
-
|
|
1824
|
-
return
|
|
1825
|
-
|
|
1826
|
-
}),
|
|
1375
|
+
On.call(n, i) && n[i] != null && s.setAttribute(i === "className" ? "class" : Ln(i), n[i]);
|
|
1376
|
+
for (var c = arguments.length, p = new Array(c > 2 ? c - 2 : 0), w = 2; w < c; w++)
|
|
1377
|
+
p[w - 2] = arguments[w];
|
|
1378
|
+
return p != null && p.length && p.forEach(function(x) {
|
|
1379
|
+
Ie(s, x);
|
|
1380
|
+
}), s;
|
|
1827
1381
|
}
|
|
1828
1382
|
}
|
|
1829
|
-
|
|
1383
|
+
it.createElement = De, it.textparser = Bt, it.defaultparser = Bt, it.htmlparser = function(e) {
|
|
1830
1384
|
e = String(e || "").trim();
|
|
1831
|
-
for (var n,
|
|
1832
|
-
for (var
|
|
1833
|
-
i[
|
|
1834
|
-
c.push(
|
|
1835
|
-
}, x = function(
|
|
1836
|
-
var
|
|
1837
|
-
if (
|
|
1838
|
-
for (var
|
|
1839
|
-
|
|
1840
|
-
for (;
|
|
1841
|
-
|
|
1842
|
-
for (;
|
|
1843
|
-
c.push(new
|
|
1385
|
+
for (var n, s, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], p = [], w = function(O) {
|
|
1386
|
+
for (var I in i)
|
|
1387
|
+
i[I] && (O[I] = i[I]);
|
|
1388
|
+
c.push(O);
|
|
1389
|
+
}, x = function(O) {
|
|
1390
|
+
var I = c.length, L = un[O];
|
|
1391
|
+
if (I && L) {
|
|
1392
|
+
for (var B = I - 1; c[B] && (c[B] instanceof Dt || on.test(c[B].value)); )
|
|
1393
|
+
B--;
|
|
1394
|
+
for (; L && c[B] && c[B] instanceof et; )
|
|
1395
|
+
B--, L--;
|
|
1396
|
+
for (; L-- > 0; )
|
|
1397
|
+
c.push(new et());
|
|
1844
1398
|
}
|
|
1845
1399
|
}; e.length; ) {
|
|
1846
1400
|
if (n = /^[^<]+/.exec(e))
|
|
1847
|
-
|
|
1848
|
-
else if (!(n =
|
|
1849
|
-
if (n =
|
|
1850
|
-
|
|
1851
|
-
else if (n =
|
|
1852
|
-
var
|
|
1853
|
-
x(
|
|
1854
|
-
var
|
|
1855
|
-
|
|
1401
|
+
Bt(be(n[0]), !1).forEach(w);
|
|
1402
|
+
else if (!(n = hn.exec(e)))
|
|
1403
|
+
if (n = an.exec(e))
|
|
1404
|
+
p.length && (i = p.pop()), x(n[1]);
|
|
1405
|
+
else if (n = ln.exec(e)) {
|
|
1406
|
+
var k = n[1];
|
|
1407
|
+
x(k), p.push(i), i = Object.create(i), we[k] && we[k](i, "");
|
|
1408
|
+
var S = pn(n[2]);
|
|
1409
|
+
k === "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 && (s = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(S.style)) && s[1] && (i.color = s[1]), k === "br" && c.push(new et());
|
|
1856
1410
|
} else
|
|
1857
|
-
n = [e.slice(0, 1)], w(new
|
|
1411
|
+
n = [e.slice(0, 1)], w(new F(n[0]));
|
|
1858
1412
|
e = e.slice(n[0].length);
|
|
1859
1413
|
}
|
|
1860
|
-
for (var
|
|
1861
|
-
c.pop(),
|
|
1414
|
+
for (var M = c[c.length - 1]; M instanceof et; )
|
|
1415
|
+
c.pop(), M = c[c.length - 1];
|
|
1862
1416
|
return c;
|
|
1863
|
-
},
|
|
1417
|
+
}, it.latexparser = function(e) {
|
|
1864
1418
|
e = String(e || "").trim();
|
|
1865
1419
|
var n = [0];
|
|
1866
|
-
e = e.replace(/\\verb,(.*?),/, function(
|
|
1867
|
-
return n.push(
|
|
1420
|
+
e = e.replace(/\\verb,(.*?),/, function(z, P) {
|
|
1421
|
+
return n.push(P), "\\verb," + (n.length - 1) + ",";
|
|
1868
1422
|
}).replace(/\\\\\n/g, function() {
|
|
1869
1423
|
return "\\\\";
|
|
1870
|
-
}).replace(
|
|
1871
|
-
return
|
|
1872
|
-
}).replace(/\n\s+/g, function(
|
|
1873
|
-
return /\n/.test(
|
|
1874
|
-
}).replace(/\\symbol\{(\d+)\}/, function(
|
|
1875
|
-
return
|
|
1876
|
-
}).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(
|
|
1877
|
-
return
|
|
1878
|
-
}).replace(/\\verb,(.*?),/, function(
|
|
1879
|
-
return "\\verb,".concat(n[+
|
|
1424
|
+
}).replace(xn, function(z, P, j) {
|
|
1425
|
+
return j.charAt(P - 1) === "\\" ? z : wn[z];
|
|
1426
|
+
}).replace(/\n\s+/g, function(z) {
|
|
1427
|
+
return /\n/.test(z.slice(1)) ? "\\par " : z;
|
|
1428
|
+
}).replace(/\\symbol\{(\d+)\}/, function(z, P, j, H) {
|
|
1429
|
+
return H.charAt(j - 1) === "\\" ? z : String.fromCharCode(1 * P);
|
|
1430
|
+
}).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, function(z, P, j, H) {
|
|
1431
|
+
return P + j + "{" + H + "}";
|
|
1432
|
+
}).replace(/\\verb,(.*?),/, function(z, P) {
|
|
1433
|
+
return "\\verb,".concat(n[+P], ",");
|
|
1880
1434
|
});
|
|
1881
|
-
for (var
|
|
1882
|
-
for (var
|
|
1883
|
-
i[
|
|
1884
|
-
return c.push(
|
|
1435
|
+
for (var s, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], p = [], w = function(z) {
|
|
1436
|
+
for (var P in i)
|
|
1437
|
+
i[P] && (z[P] = i[P]);
|
|
1438
|
+
return c.push(z), z;
|
|
1885
1439
|
}, x = function() {
|
|
1886
|
-
|
|
1887
|
-
},
|
|
1888
|
-
if (!
|
|
1440
|
+
p.push(i), i = Object.create(i);
|
|
1441
|
+
}, k = function() {
|
|
1442
|
+
if (!p.length)
|
|
1889
1443
|
throw new Error("Unexpected }");
|
|
1890
|
-
i =
|
|
1891
|
-
},
|
|
1892
|
-
if (
|
|
1893
|
-
|
|
1894
|
-
else if (
|
|
1895
|
-
w(new
|
|
1896
|
-
else if (!(
|
|
1897
|
-
if (
|
|
1444
|
+
i = p.pop();
|
|
1445
|
+
}, S = { tokens: c, open_context: x, close_context: k, add_token: w }; e.length; ) {
|
|
1446
|
+
if (s = mn.exec(e))
|
|
1447
|
+
Bt(s[0], !1).forEach(w);
|
|
1448
|
+
else if (s = vn.exec(e))
|
|
1449
|
+
w(new F(s[1]));
|
|
1450
|
+
else if (!(s = yn.exec(e))) {
|
|
1451
|
+
if (s = /^\{/.exec(e))
|
|
1898
1452
|
x();
|
|
1899
|
-
else if (
|
|
1900
|
-
|
|
1901
|
-
else if (!(
|
|
1902
|
-
if (
|
|
1903
|
-
w(new
|
|
1904
|
-
else if (
|
|
1905
|
-
var
|
|
1906
|
-
if (/^(La)?TeX$/i.test(
|
|
1453
|
+
else if (s = /^\}/.exec(e))
|
|
1454
|
+
k();
|
|
1455
|
+
else if (!(s = /^\$/.exec(e)))
|
|
1456
|
+
if (s = /^\\verb,([^,]+),/.exec(e))
|
|
1457
|
+
w(new F(s[1]));
|
|
1458
|
+
else if (s = gn.exec(e)) {
|
|
1459
|
+
var M = s[1].slice(1) || s[1], O = !!s[2];
|
|
1460
|
+
if (/^(La)?TeX$/i.test(M)) {
|
|
1907
1461
|
x(), i.family = "serif";
|
|
1908
|
-
var
|
|
1909
|
-
|
|
1910
|
-
} else if (
|
|
1911
|
-
w(new
|
|
1912
|
-
else if (
|
|
1913
|
-
var
|
|
1914
|
-
if (
|
|
1915
|
-
for (
|
|
1916
|
-
if (!(
|
|
1917
|
-
throw new Error(
|
|
1918
|
-
|
|
1462
|
+
var I = void 0;
|
|
1463
|
+
M === "LaTeX" && ((I = w(new F("L"))).tracking = -0.25, (I = w(new F("A"))).size = 0.7, I.baseline = 0.3, I.tracking = -0.1), (I = w(new F("T"))).tracking = -0.17, (I = w(new F("E"))).baseline = -0.22, I.tracking = -0.13, I = w(new F("X")), k();
|
|
1464
|
+
} else if (M in Ae)
|
|
1465
|
+
w(new F(Ae[M])), O && x();
|
|
1466
|
+
else if (M in U) {
|
|
1467
|
+
var L = [], B = U[M].length - 1, J = void 0;
|
|
1468
|
+
if (B) {
|
|
1469
|
+
for (O = !1, e = e.slice(s[0].length - 1); B--; ) {
|
|
1470
|
+
if (!(J = /^\{([^}]+)\}/.exec(e)))
|
|
1471
|
+
throw new Error(M + " is missing an argument");
|
|
1472
|
+
L.push(J[1]), e = e.slice(J[0].length);
|
|
1919
1473
|
}
|
|
1920
|
-
|
|
1474
|
+
s[0] = /^\{/.exec(e) ? "{" : "", O = !!s[0];
|
|
1921
1475
|
}
|
|
1922
|
-
|
|
1476
|
+
O && x(), U[M].apply(S, [i].concat(L));
|
|
1923
1477
|
} else
|
|
1924
|
-
console.warn("unknown latex command",
|
|
1478
|
+
console.warn("unknown latex command", M), w(new F(s[1])), O && x();
|
|
1925
1479
|
} else
|
|
1926
|
-
|
|
1480
|
+
s = [e.slice(0, 1)], w(new F(s[0]));
|
|
1927
1481
|
}
|
|
1928
|
-
e = e.slice(
|
|
1482
|
+
e = e.slice(s[0].length);
|
|
1929
1483
|
}
|
|
1930
1484
|
return c;
|
|
1931
|
-
},
|
|
1932
|
-
return
|
|
1933
|
-
},
|
|
1934
|
-
const
|
|
1485
|
+
}, it.measureText = function(e, n, s) {
|
|
1486
|
+
return W(e, b(n), s);
|
|
1487
|
+
}, it.Token = F, it.Break = Dt, it.LineBreak = et, it.SoftHyphen = pt, it.Rotator = _e, _e.createElement = De;
|
|
1488
|
+
const Cn = it;
|
|
1935
1489
|
return r.default;
|
|
1936
1490
|
})());
|
|
1937
|
-
})(
|
|
1938
|
-
var
|
|
1939
|
-
const
|
|
1940
|
-
function
|
|
1941
|
-
return
|
|
1491
|
+
})(tn);
|
|
1492
|
+
var Kn = tn.exports;
|
|
1493
|
+
const Ne = /* @__PURE__ */ Ze(Kn);
|
|
1494
|
+
function he(a) {
|
|
1495
|
+
return a.replace(/…$/, "");
|
|
1942
1496
|
}
|
|
1943
|
-
function
|
|
1944
|
-
return
|
|
1497
|
+
function ce(a) {
|
|
1498
|
+
return a.children[0].innerHTML;
|
|
1945
1499
|
}
|
|
1946
|
-
function
|
|
1947
|
-
const t = ut(
|
|
1500
|
+
function Jn(a, l) {
|
|
1501
|
+
const t = ut(a), { fontSize: r, font: o, padding: h = 0 } = a.properties.style || {};
|
|
1948
1502
|
if (t.width === t.height && t.width === 0)
|
|
1949
1503
|
return;
|
|
1950
|
-
const
|
|
1951
|
-
font: `${r}px/${r}px ${
|
|
1504
|
+
const u = new Ne({
|
|
1505
|
+
font: `${r}px/${r}px ${o}`.replace(/(px)+/g, "px"),
|
|
1952
1506
|
width: t.width - h * 2,
|
|
1953
1507
|
height: t.height - h * 2,
|
|
1954
1508
|
align: "left",
|
|
@@ -1956,50 +1510,50 @@ function Un(u, l) {
|
|
|
1956
1510
|
x: 0,
|
|
1957
1511
|
overflow: "ellipsis",
|
|
1958
1512
|
parser: "html",
|
|
1959
|
-
createElement:
|
|
1513
|
+
createElement: Ne.createElement
|
|
1960
1514
|
});
|
|
1961
|
-
|
|
1962
|
-
const
|
|
1963
|
-
|
|
1515
|
+
u.overflowWrap("break-word");
|
|
1516
|
+
const g = u.linebreak(
|
|
1517
|
+
a.properties.content.replaceAll(`
|
|
1964
1518
|
`, "<br>")
|
|
1965
|
-
).render(),
|
|
1966
|
-
let
|
|
1967
|
-
const
|
|
1968
|
-
|
|
1519
|
+
).render(), f = [...g.children];
|
|
1520
|
+
let y = 0;
|
|
1521
|
+
const v = [];
|
|
1522
|
+
a.properties.content.split(`
|
|
1969
1523
|
`).forEach((b) => {
|
|
1970
|
-
let
|
|
1971
|
-
for (;
|
|
1972
|
-
if (
|
|
1973
|
-
|
|
1974
|
-
`) ||
|
|
1524
|
+
let C = b;
|
|
1525
|
+
for (; C.length && y < f.length; ) {
|
|
1526
|
+
if (f[y].innerHTML === " ") {
|
|
1527
|
+
C.startsWith(`
|
|
1528
|
+
`) || v.push(y), y++;
|
|
1975
1529
|
break;
|
|
1976
1530
|
}
|
|
1977
|
-
const
|
|
1978
|
-
|
|
1531
|
+
const E = he(ce(f[y]));
|
|
1532
|
+
C.startsWith(E) && (C = C.slice(E.length).trim()), y++;
|
|
1979
1533
|
}
|
|
1980
|
-
}),
|
|
1981
|
-
const
|
|
1982
|
-
|
|
1983
|
-
let
|
|
1984
|
-
const
|
|
1985
|
-
for (;
|
|
1986
|
-
const
|
|
1987
|
-
if (!P)
|
|
1988
|
-
break;
|
|
1989
|
-
S.push(P);
|
|
1990
|
-
const $ = se(P.children[0].innerHTML).length;
|
|
1534
|
+
}), v.forEach((b) => g.removeChild(f[b]));
|
|
1535
|
+
const T = a.properties.content.match(/(https?:\/\/.*)/gm), A = T ? T.map((b) => b.split(" ")[0]) : [];
|
|
1536
|
+
g.setAttribute("transform", `translate(${h}, ${h})`), A.forEach((b) => {
|
|
1537
|
+
let C = b;
|
|
1538
|
+
const E = [];
|
|
1539
|
+
for (; C.length > 0; ) {
|
|
1540
|
+
const $ = f.find((_) => !!_.children[0] && _.children[0].tagName === "tspan" && C.startsWith(he(ce(_))));
|
|
1991
1541
|
if (!$)
|
|
1992
1542
|
break;
|
|
1993
|
-
|
|
1543
|
+
E.push($);
|
|
1544
|
+
const N = he($.children[0].innerHTML).length;
|
|
1545
|
+
if (!N)
|
|
1546
|
+
break;
|
|
1547
|
+
C = C.slice(N);
|
|
1994
1548
|
}
|
|
1995
|
-
|
|
1996
|
-
const
|
|
1997
|
-
|
|
1549
|
+
E.forEach(($) => {
|
|
1550
|
+
const N = document.createElementNS("http://www.w3.org/2000/svg", "a");
|
|
1551
|
+
N.setAttribute("href", b), N.setAttribute("target", "_blank"), N.innerHTML = ce($), $.children[0].innerHTML = "", $.children[0].appendChild(N);
|
|
1998
1552
|
});
|
|
1999
|
-
}), l.appendChild(
|
|
1553
|
+
}), l.appendChild(g);
|
|
2000
1554
|
}
|
|
2001
|
-
const
|
|
2002
|
-
class
|
|
1555
|
+
const He = 20;
|
|
1556
|
+
class Qn extends Qe {
|
|
2003
1557
|
constructor(t, r = {}) {
|
|
2004
1558
|
super(
|
|
2005
1559
|
t,
|
|
@@ -2017,81 +1571,81 @@ class Yn extends Ye {
|
|
|
2017
1571
|
</div>
|
|
2018
1572
|
`
|
|
2019
1573
|
);
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
1574
|
+
m(this, "textArea");
|
|
1575
|
+
m(this, "handleSize");
|
|
1576
|
+
m(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
|
|
1577
|
+
m(this, "annotation", { ...le });
|
|
1578
|
+
m(this, "startX", 0);
|
|
1579
|
+
m(this, "startY", 0);
|
|
1580
|
+
m(this, "handles", []);
|
|
1581
|
+
m(this, "draggedHandle", V);
|
|
1582
|
+
m(this, "isFocused", !1);
|
|
1583
|
+
m(this, "placeholder", "Type your text here...");
|
|
1584
|
+
m(this, "_onFocus", () => {
|
|
2031
1585
|
this.textArea.value === this.placeholder && (this.textArea.value = ""), this.isFocused = !0;
|
|
2032
1586
|
});
|
|
2033
|
-
|
|
1587
|
+
m(this, "_onBlur", () => {
|
|
2034
1588
|
this.isFocused = !1;
|
|
2035
1589
|
});
|
|
2036
|
-
|
|
2037
|
-
this.add(
|
|
1590
|
+
m(this, "startDrawing", (t, r, o = Zn(t, r, 0, 0, "", St)) => {
|
|
1591
|
+
this.add(o);
|
|
2038
1592
|
const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
|
|
2039
|
-
this.select(
|
|
1593
|
+
this.select(o.id), this.startDragging(this.getById(o.id), h.x, h.y), this.draggedHandle = 6;
|
|
2040
1594
|
});
|
|
2041
|
-
|
|
2042
|
-
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...
|
|
1595
|
+
m(this, "cancelDrawing", () => {
|
|
1596
|
+
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...le }, this.draggedHandle = V, this.isDragging = !1, this.emit(Tt, this.annotation));
|
|
2043
1597
|
});
|
|
2044
|
-
|
|
1598
|
+
m(this, "startDragging", (t, r, o) => {
|
|
2045
1599
|
this.annotation = t;
|
|
2046
|
-
const h = ct(this.annotation),
|
|
2047
|
-
this.rect.x = h.x, this.rect.y = h.y, this.rect.width =
|
|
1600
|
+
const h = ct(this.annotation), u = ut(this.annotation);
|
|
1601
|
+
this.rect.x = h.x, this.rect.y = h.y, this.rect.width = u.width, this.rect.height = u.height, this.startX = r, this.startY = o, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Zt, this.annotation), this.isDragging = !0;
|
|
2048
1602
|
});
|
|
2049
|
-
|
|
1603
|
+
m(this, "onHandleMouseDown", (t) => {
|
|
2050
1604
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
2051
1605
|
if (!r)
|
|
2052
1606
|
return;
|
|
2053
1607
|
this.selectedId !== r.id && this.select(this.hoveredId);
|
|
2054
|
-
const { x:
|
|
2055
|
-
this.startDragging(r,
|
|
1608
|
+
const { x: o, y: h } = ue(t, this.ogma.getContainer());
|
|
1609
|
+
this.startDragging(r, o, h), this.draggedHandle = Ue(t.target);
|
|
2056
1610
|
});
|
|
2057
|
-
|
|
1611
|
+
m(this, "onMouseMove", (t) => {
|
|
2058
1612
|
requestAnimationFrame(() => this._onMouseMove(t));
|
|
2059
1613
|
});
|
|
2060
|
-
|
|
1614
|
+
m(this, "_onMouseMove", (t) => {
|
|
2061
1615
|
if (!this.isDragging)
|
|
2062
1616
|
return;
|
|
2063
1617
|
t.stopPropagation(), t.preventDefault();
|
|
2064
|
-
const r = this.handles[this.draggedHandle],
|
|
1618
|
+
const r = this.handles[this.draggedHandle], o = r.classList.contains("top"), h = r.classList.contains("left"), u = r.classList.contains("right"), d = r.classList.contains("bottom"), g = r.classList.contains("line-handle"), { x: f, y } = ue(
|
|
2065
1619
|
t,
|
|
2066
1620
|
this.ogma.getContainer()
|
|
2067
|
-
),
|
|
2068
|
-
(
|
|
2069
|
-
const
|
|
2070
|
-
this.rect.width +
|
|
2071
|
-
|
|
1621
|
+
), v = this.ogma.view.getZoom(), T = (f - this.startX) / v, A = (y - this.startY) / v, b = this.ogma.view.getAngle(), C = rt({ x: T, y: A }, b);
|
|
1622
|
+
(d && h || o && u) && (C.y = 0, C.x = 0);
|
|
1623
|
+
const E = h || g ? this.rect.x + C.x : this.rect.x, $ = o || g ? this.rect.y + C.y : this.rect.y, N = Math.max(
|
|
1624
|
+
this.rect.width + T * (g || h ? 0 : 1),
|
|
1625
|
+
He
|
|
2072
1626
|
), _ = Math.max(
|
|
2073
|
-
this.rect.height +
|
|
2074
|
-
|
|
1627
|
+
this.rect.height + A * (g || o ? 0 : 1),
|
|
1628
|
+
He
|
|
2075
1629
|
);
|
|
2076
|
-
|
|
1630
|
+
Bn(this.annotation, E, $, N, _), this.emit(Xt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
|
|
2077
1631
|
});
|
|
2078
|
-
|
|
2079
|
-
!this.isDragging || this.draggedHandle === V || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(
|
|
1632
|
+
m(this, "onMouseUp", () => {
|
|
1633
|
+
!this.isDragging || this.draggedHandle === V || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(Tt, this.annotation), this.isDragging = !1, this.draggedHandle = V);
|
|
2080
1634
|
});
|
|
2081
|
-
|
|
1635
|
+
m(this, "_onMousedown", (t) => {
|
|
2082
1636
|
t.stopPropagation();
|
|
2083
1637
|
});
|
|
2084
|
-
|
|
1638
|
+
m(this, "onViewChanged", () => {
|
|
2085
1639
|
const t = Math.max(2, this.handleSize / this.ogma.view.getZoom());
|
|
2086
1640
|
document.documentElement.style.setProperty("--handle-scale", `${1 / t}`);
|
|
2087
1641
|
});
|
|
2088
|
-
|
|
1642
|
+
m(this, "_onInput", () => {
|
|
2089
1643
|
const t = this.getById(this.selectedId);
|
|
2090
|
-
t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(
|
|
1644
|
+
t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(ye, t), this.layer.refresh());
|
|
2091
1645
|
});
|
|
2092
|
-
this.showeditorOnHover = !1, this.handleSize =
|
|
2093
|
-
const
|
|
2094
|
-
|
|
1646
|
+
this.showeditorOnHover = !1, this.handleSize = ze.handleSize || r.textHandleSize, this.placeholder = ze.placeholder || r.textPlaceholder || "";
|
|
1647
|
+
const o = this.textArea = this.editor.element.querySelector("textarea");
|
|
1648
|
+
o.addEventListener("input", this._onInput), o.addEventListener("focus", this._onFocus), o.addEventListener("blur", this._onBlur), o.addEventListener("mousedown", this._onMousedown), o.spellcheck = !1, this.handles = Array.prototype.slice.call(
|
|
2095
1649
|
this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
|
|
2096
1650
|
), this.handles.forEach(
|
|
2097
1651
|
(h) => h.addEventListener("mousedown", this.onHandleMouseDown)
|
|
@@ -2100,69 +1654,65 @@ class Yn extends Ye {
|
|
|
2100
1654
|
_canRemove() {
|
|
2101
1655
|
return !this.isFocused;
|
|
2102
1656
|
}
|
|
2103
|
-
detect({ x: t, y: r },
|
|
2104
|
-
const h =
|
|
2105
|
-
return this.elements.find((
|
|
2106
|
-
const { x:
|
|
2107
|
-
return
|
|
1657
|
+
detect({ x: t, y: r }, o = 0) {
|
|
1658
|
+
const h = { x: t, y: r }, u = this.ogma.view.getAngle();
|
|
1659
|
+
return this.elements.find((d) => {
|
|
1660
|
+
const { x: g, y: f } = ct(d), { width: y, height: v } = ut(d), T = { x: g, y: f }, { x: A, y: b } = rt(vt(h, T), -u);
|
|
1661
|
+
return A > -o && A < y + o && b > -o && b < v + o;
|
|
2108
1662
|
});
|
|
2109
1663
|
}
|
|
2110
1664
|
draw(t) {
|
|
2111
1665
|
t.innerHTML = "";
|
|
2112
|
-
const r = "",
|
|
2113
|
-
this.elements.forEach((
|
|
2114
|
-
const
|
|
2115
|
-
color:
|
|
2116
|
-
fontSize:
|
|
1666
|
+
const r = "", o = this.ogma.view.getAngle();
|
|
1667
|
+
this.elements.forEach((u, d) => {
|
|
1668
|
+
const g = `class${d}`, f = ut(u), y = ct(u), v = u.id, {
|
|
1669
|
+
color: T,
|
|
1670
|
+
fontSize: A,
|
|
2117
1671
|
font: b,
|
|
2118
|
-
strokeColor:
|
|
2119
|
-
strokeWidth:
|
|
2120
|
-
strokeType:
|
|
2121
|
-
background:
|
|
2122
|
-
} =
|
|
2123
|
-
if (
|
|
1672
|
+
strokeColor: C,
|
|
1673
|
+
strokeWidth: E,
|
|
1674
|
+
strokeType: $,
|
|
1675
|
+
background: N
|
|
1676
|
+
} = u.properties.style || St;
|
|
1677
|
+
if (v === this.selectedId)
|
|
2124
1678
|
return;
|
|
2125
|
-
const _ =
|
|
2126
|
-
_.classList.add("annotation-text"), _.setAttribute("fill", `${
|
|
2127
|
-
const
|
|
2128
|
-
let
|
|
2129
|
-
|
|
2130
|
-
const { x:
|
|
2131
|
-
|
|
2132
|
-
);
|
|
2133
|
-
_.setAttribute("transform", `translate(${Et},${kt})`), _.classList.add(p), _.setAttribute("data-annotation", `${f.id}`), _.setAttribute("data-annotation-type", "text"), t.appendChild(_);
|
|
1679
|
+
const _ = Pt("g");
|
|
1680
|
+
_.classList.add("annotation-text"), _.setAttribute("fill", `${T}`), _.setAttribute("font-size", `${A}px`), _.setAttribute("font-family", `${b}`);
|
|
1681
|
+
const W = Pt("rect");
|
|
1682
|
+
let G = !1;
|
|
1683
|
+
$ && $ !== "none" && (G = !0, W.setAttribute("stroke", C || "black"), W.setAttribute("stroke-width", `${E}`), $ === "dashed" && W.setAttribute("stroke-dasharray", "5,5")), (N && N.length || G) && (G = !0, W.setAttribute("fill", N || "transparent")), G && (W.setAttribute("width", `${f.width}`), W.setAttribute("height", `${f.height}`)), _.appendChild(W), Jn(u, _);
|
|
1684
|
+
const { x: _t, y: It } = rt(y, -o);
|
|
1685
|
+
_.setAttribute("transform", `translate(${_t},${It})`), _.classList.add(g), _.setAttribute("data-annotation", `${u.id}`), _.setAttribute("data-annotation-type", "text"), t.appendChild(_);
|
|
2134
1686
|
});
|
|
2135
|
-
const h =
|
|
1687
|
+
const h = Pt("style");
|
|
2136
1688
|
h.innerHTML = r, t.firstChild && t.insertBefore(h, t.firstChild);
|
|
2137
1689
|
}
|
|
2138
1690
|
refreshDrawing() {
|
|
2139
1691
|
const t = this.ogma.view.getAngle();
|
|
2140
1692
|
[...this.layer.element.children].forEach((r) => {
|
|
2141
|
-
const
|
|
2142
|
-
if (!
|
|
1693
|
+
const o = r.getAttribute("data-annotation");
|
|
1694
|
+
if (!o)
|
|
2143
1695
|
return;
|
|
2144
|
-
const h = ct(this.getById(
|
|
2145
|
-
|
|
2146
|
-
);
|
|
2147
|
-
r.setAttribute("transform", `translate(${f},${g})`);
|
|
1696
|
+
const h = ct(this.getById(o)), { x: u, y: d } = rt(h, -t);
|
|
1697
|
+
r.setAttribute("transform", `translate(${u},${d})`);
|
|
2148
1698
|
});
|
|
2149
1699
|
}
|
|
2150
1700
|
getDefaultOptions() {
|
|
2151
|
-
return
|
|
1701
|
+
return le;
|
|
2152
1702
|
}
|
|
2153
1703
|
refreshEditor() {
|
|
2154
1704
|
if (+this.selectedId < 0 && +this.hoveredId < 0)
|
|
2155
1705
|
return;
|
|
2156
|
-
const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t),
|
|
1706
|
+
const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), o = this.ogma.view.graphToScreenCoordinates(
|
|
2157
1707
|
ct(t)
|
|
2158
1708
|
), h = this.ogma.view.getZoom(), {
|
|
2159
|
-
font:
|
|
2160
|
-
fontSize:
|
|
2161
|
-
color:
|
|
2162
|
-
background:
|
|
2163
|
-
padding:
|
|
2164
|
-
} = t.properties.style ||
|
|
2165
|
-
this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${
|
|
1709
|
+
font: u,
|
|
1710
|
+
fontSize: d,
|
|
1711
|
+
color: g,
|
|
1712
|
+
background: f,
|
|
1713
|
+
padding: y = 0
|
|
1714
|
+
} = t.properties.style || St, v = (d || 1) * h;
|
|
1715
|
+
this.textArea.value = t.properties.content, this.editor.element.style.transform = `translate(${o.x}px, ${o.y}px)translate(-50%, -50%)translate(${r.width / 2 * h}px, ${r.height / 2 * h}px)`, this.editor.element.style.width = `${r.width * h}px`, this.editor.element.style.height = `${r.height * h}px`, this.textArea.style.font = `${v} ${u}`, this.textArea.style.fontFamily = u || "sans-serif", this.textArea.style.fontSize = `${v}px`, this.textArea.style.padding = `${h * y}px`, this.textArea.style.lineHeight = `${v}px`, this.textArea.style.boxSizing = "border-box", this.textArea.style.color = g || "black", this.textArea.style.background = f || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
|
|
2166
1716
|
}
|
|
2167
1717
|
select(t) {
|
|
2168
1718
|
super.select(t), this.textArea.focus();
|
|
@@ -2171,25 +1721,25 @@ class Yn extends Ye {
|
|
|
2171
1721
|
super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
|
|
2172
1722
|
}
|
|
2173
1723
|
}
|
|
2174
|
-
class
|
|
1724
|
+
class ti {
|
|
2175
1725
|
constructor() {
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
}
|
|
2180
|
-
add(l, t, r,
|
|
2181
|
-
const
|
|
2182
|
-
id:
|
|
2183
|
-
arrow:
|
|
1726
|
+
m(this, "links", {});
|
|
1727
|
+
m(this, "linksByTargetId", {});
|
|
1728
|
+
m(this, "linksByArrowId", {});
|
|
1729
|
+
}
|
|
1730
|
+
add(l, t, r, o, h) {
|
|
1731
|
+
const u = Kt(), d = l.id, g = {
|
|
1732
|
+
id: u,
|
|
1733
|
+
arrow: d,
|
|
2184
1734
|
target: r,
|
|
2185
|
-
targetType:
|
|
1735
|
+
targetType: o,
|
|
2186
1736
|
connectionPoint: h,
|
|
2187
1737
|
side: t
|
|
2188
1738
|
};
|
|
2189
|
-
return this.links[
|
|
1739
|
+
return this.links[u] = g, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(u), this.linksByArrowId[d] || (this.linksByArrowId[d] = {}), this.linksByArrowId[d][t] = u, l.properties.link = l.properties.link || {}, l.properties.link[t] = {
|
|
2190
1740
|
id: r,
|
|
2191
1741
|
side: t,
|
|
2192
|
-
type:
|
|
1742
|
+
type: o,
|
|
2193
1743
|
magnet: h
|
|
2194
1744
|
}, this;
|
|
2195
1745
|
}
|
|
@@ -2199,34 +1749,34 @@ class Xn {
|
|
|
2199
1749
|
}
|
|
2200
1750
|
// remove the link between the arrow and the target by arrow id and side
|
|
2201
1751
|
remove(l, t) {
|
|
2202
|
-
var
|
|
2203
|
-
const r = l.id,
|
|
2204
|
-
if ((
|
|
1752
|
+
var d, g;
|
|
1753
|
+
const r = l.id, o = (d = this.linksByArrowId[r]) == null ? void 0 : d[t];
|
|
1754
|
+
if ((g = l.properties.link) == null || delete g[t], !o)
|
|
2205
1755
|
return this;
|
|
2206
|
-
const h = this.links[
|
|
2207
|
-
delete this.links[
|
|
2208
|
-
const
|
|
2209
|
-
for (let
|
|
2210
|
-
if (f
|
|
2211
|
-
|
|
1756
|
+
const h = this.links[o];
|
|
1757
|
+
delete this.links[o];
|
|
1758
|
+
const u = this.linksByTargetId[h.target];
|
|
1759
|
+
for (let f = 0; f < u.length; f++)
|
|
1760
|
+
if (u[f] === o) {
|
|
1761
|
+
u.splice(f, 1);
|
|
2212
1762
|
break;
|
|
2213
1763
|
}
|
|
2214
1764
|
return delete this.linksByArrowId[r][t], this;
|
|
2215
1765
|
}
|
|
2216
1766
|
getArrowLink(l, t) {
|
|
2217
|
-
var
|
|
2218
|
-
const r = (
|
|
1767
|
+
var o;
|
|
1768
|
+
const r = (o = this.linksByArrowId[l]) == null ? void 0 : o[t];
|
|
2219
1769
|
return r ? this.links[r] : null;
|
|
2220
1770
|
}
|
|
2221
1771
|
getTargetLinks(l, t) {
|
|
2222
1772
|
var r;
|
|
2223
|
-
return ((r = this.linksByTargetId[l]) == null ? void 0 : r.map((
|
|
1773
|
+
return ((r = this.linksByTargetId[l]) == null ? void 0 : r.map((o) => this.links[o]).filter((o) => o.targetType === t)) ?? [];
|
|
2224
1774
|
}
|
|
2225
1775
|
forEach(l) {
|
|
2226
1776
|
Object.values(this.links).forEach(l);
|
|
2227
1777
|
}
|
|
2228
1778
|
}
|
|
2229
|
-
const ot = (
|
|
1779
|
+
const ot = (a) => a.properties.type === "arrow", mt = (a) => a.properties.type === "text", Fe = (a) => a.type === "FeatureCollection", ei = {
|
|
2230
1780
|
magnetColor: "#3e8",
|
|
2231
1781
|
detectMargin: 20,
|
|
2232
1782
|
magnetHandleRadius: 5,
|
|
@@ -2236,7 +1786,7 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
|
|
|
2236
1786
|
textHandleSize: 3.5,
|
|
2237
1787
|
minArrowHeight: 20,
|
|
2238
1788
|
maxArrowHeight: 30
|
|
2239
|
-
},
|
|
1789
|
+
}, Be = ["start", "end"], je = [
|
|
2240
1790
|
{ x: 0, y: 0 },
|
|
2241
1791
|
{ x: 0.5, y: 0 },
|
|
2242
1792
|
{ x: 1, y: 0 },
|
|
@@ -2246,159 +1796,160 @@ const ot = (u) => u.properties.type === "arrow", mt = (u) => u.properties.type =
|
|
|
2246
1796
|
{ x: 0.5, y: 1 },
|
|
2247
1797
|
{ x: 1, y: 1 }
|
|
2248
1798
|
];
|
|
2249
|
-
class
|
|
1799
|
+
class ri extends Je {
|
|
2250
1800
|
constructor(t, r = {}) {
|
|
2251
1801
|
super();
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
1802
|
+
m(this, "arrows");
|
|
1803
|
+
m(this, "texts");
|
|
1804
|
+
m(this, "links", new ti());
|
|
1805
|
+
m(this, "layer");
|
|
1806
|
+
m(this, "annotations");
|
|
1807
|
+
m(this, "ogma");
|
|
1808
|
+
m(this, "options");
|
|
1809
|
+
m(this, "selected", null);
|
|
1810
|
+
m(this, "updateTimeout", 0);
|
|
1811
|
+
m(this, "hoveredNode", null);
|
|
1812
|
+
m(this, "dragged", null);
|
|
1813
|
+
m(this, "textToMagnet");
|
|
1814
|
+
m(this, "activeLinks", []);
|
|
1815
|
+
m(this, "_render", (t) => {
|
|
2266
1816
|
if (!this.dragged || this.textToMagnet === void 0)
|
|
2267
1817
|
return;
|
|
2268
1818
|
t.beginPath(), t.fillStyle = "green";
|
|
2269
1819
|
const r = this.ogma.view.getZoom();
|
|
2270
|
-
|
|
1820
|
+
je.forEach((o) => {
|
|
2271
1821
|
if (!this.textToMagnet)
|
|
2272
1822
|
return;
|
|
2273
|
-
const h = ut(this.textToMagnet),
|
|
2274
|
-
t.moveTo(
|
|
1823
|
+
const h = ut(this.textToMagnet), u = ct(this.textToMagnet), d = Ut(o, { x: h.width, y: h.height }), g = rt(d, this.ogma.view.getAngle()), { x: f, y } = Et(g, u);
|
|
1824
|
+
t.moveTo(f, y), t.arc(f, y, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
|
|
2275
1825
|
}), t.fill(), t.closePath();
|
|
2276
1826
|
});
|
|
2277
|
-
|
|
2278
|
-
const
|
|
2279
|
-
if (ot(t) &&
|
|
1827
|
+
m(this, "_onFeatureDrag", (t, r) => {
|
|
1828
|
+
const o = r;
|
|
1829
|
+
if (ot(t) && o === "line")
|
|
2280
1830
|
["start", "end"].find((h) => {
|
|
2281
|
-
const
|
|
2282
|
-
return this._snapToText(t,
|
|
1831
|
+
const u = h === "start" ? $t(t) : Gt(t);
|
|
1832
|
+
return this._snapToText(t, o, u) || this._findAndSnapToNode(t, h, u);
|
|
2283
1833
|
});
|
|
2284
|
-
else if (ot(t) &&
|
|
2285
|
-
const h =
|
|
2286
|
-
this._snapToText(t,
|
|
1834
|
+
else if (ot(t) && o !== "line") {
|
|
1835
|
+
const h = o === "start" ? $t(t) : Gt(t);
|
|
1836
|
+
this._snapToText(t, o, h) || this._findAndSnapToNode(t, o, h);
|
|
2287
1837
|
} else
|
|
2288
|
-
mt(t) && (this.activeLinks.forEach(({ arrow: h, side:
|
|
2289
|
-
const
|
|
2290
|
-
|
|
1838
|
+
mt(t) && (this.activeLinks.forEach(({ arrow: h, side: u, connectionPoint: d }) => {
|
|
1839
|
+
const g = this.getAnnotation(h), f = ut(t), y = ct(t), v = Ut(d, { x: f.width, y: f.height }), T = rt(v, this.ogma.view.getAngle()), A = Et(T, y);
|
|
1840
|
+
g.geometry.coordinates[u === "start" ? 0 : 1] = [A.x, A.y];
|
|
2291
1841
|
}), this.activeLinks.length && this.arrows.refreshLayer());
|
|
2292
|
-
this.layer.refresh(), this.emit(
|
|
1842
|
+
this.layer.refresh(), this.emit(Xt, t, r);
|
|
2293
1843
|
});
|
|
2294
|
-
|
|
2295
|
-
this.dragged !== null && ot(t) &&
|
|
2296
|
-
this.links.getArrowLink(t.id, r) && this.emit(
|
|
1844
|
+
m(this, "_onFeatureDragEnd", (t) => {
|
|
1845
|
+
this.dragged !== null && ot(t) && $t(this.dragged) && Be.forEach((r) => {
|
|
1846
|
+
this.links.getArrowLink(t.id, r) && this.emit(Wn, {
|
|
2297
1847
|
arrow: t,
|
|
2298
1848
|
link: this.links.getArrowLink(t.id, r)
|
|
2299
1849
|
});
|
|
2300
|
-
}), (mt(t) || ot(t)) && this.onUpdate(t), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((r) => r.enableDetection()), this.layer.refresh(), this.emit(
|
|
1850
|
+
}), (mt(t) || ot(t)) && this.onUpdate(t), this.dragged = null, this.activeLinks = [], this.textToMagnet = void 0, this.annotations.forEach((r) => r.enableDetection()), this.layer.refresh(), this.emit(Tt, t);
|
|
2301
1851
|
});
|
|
2302
|
-
|
|
1852
|
+
m(this, "_onFeatureDragStart", (t) => {
|
|
2303
1853
|
this.textToMagnet = void 0, ot(t) ? this.dragged = t : mt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
|
|
2304
|
-
const
|
|
2305
|
-
|
|
2306
|
-
}), this.emit(
|
|
1854
|
+
const o = r.getSelectedFeature();
|
|
1855
|
+
o && o !== t && r.unhover().unselect(), r.disableDetection();
|
|
1856
|
+
}), this.emit(Zt, t);
|
|
2307
1857
|
});
|
|
2308
|
-
|
|
1858
|
+
m(this, "_onNodesDragStart", () => {
|
|
2309
1859
|
this.arrows.unhover().unselect(), this.texts.unhover().unselect();
|
|
2310
1860
|
});
|
|
2311
|
-
|
|
2312
|
-
const { dx: r, dy:
|
|
2313
|
-
this._moveNodes(t.nodes, r,
|
|
1861
|
+
m(this, "_onNodesDrag", (t) => {
|
|
1862
|
+
const { dx: r, dy: o } = t;
|
|
1863
|
+
this._moveNodes(t.nodes, r, o);
|
|
2314
1864
|
});
|
|
2315
|
-
|
|
2316
|
-
t.ids.forEach((r,
|
|
2317
|
-
this.links.getTargetLinks(r, "node").forEach((
|
|
2318
|
-
const
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
),
|
|
2322
|
-
|
|
1865
|
+
m(this, "_onLayoutEnd", (t) => {
|
|
1866
|
+
t.ids.forEach((r, o) => {
|
|
1867
|
+
this.links.getTargetLinks(r, "node").forEach((u) => {
|
|
1868
|
+
const d = this.getAnnotation(u.arrow), g = u.side, f = Rt(
|
|
1869
|
+
d,
|
|
1870
|
+
g === "start" ? "end" : "start"
|
|
1871
|
+
), y = t.positions.current[o], v = this.ogma.getNode(r).getAttribute("radius"), T = Vt(f, y, +v);
|
|
1872
|
+
At(d, g, T.x, T.y);
|
|
2323
1873
|
});
|
|
2324
1874
|
}), this.arrows.refreshLayer(), this.texts.refreshLayer();
|
|
2325
1875
|
});
|
|
2326
|
-
|
|
2327
|
-
this.emit(
|
|
1876
|
+
m(this, "_onAdded", (t) => {
|
|
1877
|
+
this.emit(ge, t);
|
|
2328
1878
|
});
|
|
2329
|
-
|
|
2330
|
-
this.emit(
|
|
1879
|
+
m(this, "_onRemoved", (t) => {
|
|
1880
|
+
this.emit(pe, t);
|
|
2331
1881
|
});
|
|
2332
|
-
|
|
2333
|
-
this.selected = null, this.emit(
|
|
1882
|
+
m(this, "_onUnselect", (t) => {
|
|
1883
|
+
this.selected = null, this.emit(fe, t);
|
|
2334
1884
|
});
|
|
2335
|
-
|
|
2336
|
-
this.selected !== t && (this.selected = t, this.emit(
|
|
1885
|
+
m(this, "_onSelect", (t) => {
|
|
1886
|
+
this.selected !== t && (this.selected = t, this.emit(de, this.selected));
|
|
2337
1887
|
});
|
|
2338
1888
|
/**
|
|
2339
1889
|
* Triggers the update event on the annotation
|
|
2340
1890
|
* @param annotation The annotation updated
|
|
2341
1891
|
*/
|
|
2342
|
-
|
|
1892
|
+
m(this, "onUpdate", (t) => {
|
|
2343
1893
|
cancelAnimationFrame(this.updateTimeout), this.updateTimeout = requestAnimationFrame(
|
|
2344
1894
|
() => this._onUpdate(t)
|
|
2345
1895
|
);
|
|
2346
1896
|
});
|
|
2347
|
-
|
|
2348
|
-
this.emit(
|
|
1897
|
+
m(this, "_onUpdate", (t) => {
|
|
1898
|
+
this.emit(ye, t);
|
|
2349
1899
|
});
|
|
2350
|
-
this.options = this.setOptions({ ...
|
|
2351
|
-
|
|
1900
|
+
this.options = this.setOptions({ ...ei, ...r }), this.ogma = t, this.arrows = new Xn(t, this.options), this.texts = new Qn(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((o) => {
|
|
1901
|
+
o.on(Zt, this._onFeatureDragStart).on(Xt, this._onFeatureDrag).on(Tt, this._onFeatureDragEnd).on(ye, this.onUpdate).on(fe, this._onUnselect).on(de, this._onSelect).on(ge, this._onAdded).on(pe, this._onRemoved);
|
|
2352
1902
|
}), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
|
|
2353
1903
|
this.refreshTextLinks();
|
|
2354
1904
|
}), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
|
|
2355
1905
|
}
|
|
2356
|
-
_moveNodes(t, r,
|
|
1906
|
+
_moveNodes(t, r, o) {
|
|
2357
1907
|
t.forEach((h) => {
|
|
2358
|
-
const
|
|
2359
|
-
|
|
2360
|
-
const
|
|
2361
|
-
|
|
2362
|
-
|
|
1908
|
+
const u = this.links.getTargetLinks(h.getId(), "node"), d = h.getPosition();
|
|
1909
|
+
u.forEach((g) => {
|
|
1910
|
+
const f = this.getAnnotation(g.arrow), y = g.side, v = Rt(
|
|
1911
|
+
f,
|
|
1912
|
+
y === "start" ? "end" : "start"
|
|
2363
1913
|
);
|
|
2364
|
-
let
|
|
2365
|
-
const
|
|
2366
|
-
(
|
|
1914
|
+
let T = d;
|
|
1915
|
+
const A = +h.getAttribute("radius"), b = 1e-6;
|
|
1916
|
+
(g.connectionPoint.x - (d.x - r) > b || g.connectionPoint.y - (d.y - o) > b) && (T = Vt(v, d, A)), At(f, y, T.x, T.y);
|
|
2367
1917
|
});
|
|
2368
1918
|
}), this.arrows.refreshLayer();
|
|
2369
1919
|
}
|
|
2370
|
-
_snapToText(t, r,
|
|
2371
|
-
const h = this.texts.detect(
|
|
1920
|
+
_snapToText(t, r, o) {
|
|
1921
|
+
const h = this.texts.detect(o, this.options.detectMargin);
|
|
2372
1922
|
if (this.links.remove(t, r), !h)
|
|
2373
1923
|
return !1;
|
|
2374
1924
|
this.textToMagnet = h;
|
|
2375
|
-
const
|
|
2376
|
-
return
|
|
2377
|
-
}
|
|
2378
|
-
_findAndSnapToNode(t, r,
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
1925
|
+
const u = this.findMagnetPoint(je, h, o);
|
|
1926
|
+
return u ? (At(t, r, u.point.x, u.point.y), this.links.add(t, r, h.id, "text", u.magnet), !0) : !1;
|
|
1927
|
+
}
|
|
1928
|
+
_findAndSnapToNode(t, r, o) {
|
|
1929
|
+
var d, g;
|
|
1930
|
+
const h = this.ogma.view.graphToScreenCoordinates(o), u = this.ogma.view.getElementAt(h);
|
|
1931
|
+
this.links.remove(t, r), u && u.isNode ? ((d = this.hoveredNode) == null || d.setSelected(!1), this.hoveredNode = u, u.setSelected(!0), this._snapToNode(t, r, u, h)) : ((g = this.hoveredNode) == null || g.setSelected(!1), this.hoveredNode = null);
|
|
1932
|
+
}
|
|
1933
|
+
_snapToNode(t, r, o, h) {
|
|
1934
|
+
const u = o.getPositionOnScreen(), d = +o.getAttribute("radius"), g = d * this.ogma.view.getZoom(), f = h.x - u.x, y = h.y - u.y, v = Math.sqrt(f * f + y * y), T = o.getPosition();
|
|
1935
|
+
if (v < g + this.options.detectMargin) {
|
|
1936
|
+
let A = T;
|
|
1937
|
+
if (v > g / 2) {
|
|
1938
|
+
const b = Rt(t, r === "end" ? "start" : "end");
|
|
1939
|
+
A = Vt(b, A, d);
|
|
2389
1940
|
}
|
|
2390
|
-
|
|
1941
|
+
At(t, r, A.x, A.y), this.links.add(t, r, o.getId(), "node", A);
|
|
2391
1942
|
}
|
|
2392
1943
|
}
|
|
2393
1944
|
refreshTextLinks() {
|
|
2394
1945
|
let t = !1;
|
|
2395
1946
|
this.links.forEach(
|
|
2396
|
-
({ connectionPoint: r, targetType:
|
|
2397
|
-
if (
|
|
1947
|
+
({ connectionPoint: r, targetType: o, target: h, arrow: u, side: d }) => {
|
|
1948
|
+
if (o !== "text")
|
|
2398
1949
|
return;
|
|
2399
1950
|
t = !0;
|
|
2400
|
-
const
|
|
2401
|
-
|
|
1951
|
+
const g = this.getAnnotation(h), f = this.getAnnotation(u), y = ut(g), v = ct(g), T = Ut(r, { x: y.width, y: y.height }), A = rt(T, this.ogma.view.getAngle()), b = Et(A, v);
|
|
1952
|
+
At(f, d, b.x, b.y);
|
|
2402
1953
|
}
|
|
2403
1954
|
), t && this.arrows.refreshLayer();
|
|
2404
1955
|
}
|
|
@@ -2408,19 +1959,19 @@ class Kn extends Ue {
|
|
|
2408
1959
|
getSelected() {
|
|
2409
1960
|
return this.selected;
|
|
2410
1961
|
}
|
|
2411
|
-
findMagnetPoint(t, r,
|
|
1962
|
+
findMagnetPoint(t, r, o) {
|
|
2412
1963
|
let h;
|
|
2413
|
-
for (const
|
|
2414
|
-
const
|
|
1964
|
+
for (const u of t) {
|
|
1965
|
+
const d = ut(r), g = ct(r), f = Ut(u, { x: d.width, y: d.height }), y = rt(f, this.ogma.view.getAngle()), v = Et(y, g), T = kt(vt(v, o)), A = Math.min(
|
|
2415
1966
|
this.options.magnetRadius * this.ogma.view.getZoom(),
|
|
2416
1967
|
// when really zoomed in: avoid to snap on too far away magnets
|
|
2417
|
-
|
|
2418
|
-
|
|
1968
|
+
d.width / 2,
|
|
1969
|
+
d.height / 2
|
|
2419
1970
|
);
|
|
2420
|
-
if (
|
|
1971
|
+
if (T < Math.max(A, this.options.magnetHandleRadius)) {
|
|
2421
1972
|
h = {
|
|
2422
|
-
point:
|
|
2423
|
-
magnet:
|
|
1973
|
+
point: v,
|
|
1974
|
+
magnet: u
|
|
2424
1975
|
};
|
|
2425
1976
|
break;
|
|
2426
1977
|
}
|
|
@@ -2443,7 +1994,7 @@ class Kn extends Ue {
|
|
|
2443
1994
|
* @param id the id of the annotation to select
|
|
2444
1995
|
*/
|
|
2445
1996
|
select(t) {
|
|
2446
|
-
const r = this.getAnnotations().features.find((
|
|
1997
|
+
const r = this.getAnnotations().features.find((o) => o.id === t);
|
|
2447
1998
|
return r ? (ot(r) ? this.arrows.select(r.id) : mt(r) && this.texts.select(r.id), this) : this;
|
|
2448
1999
|
}
|
|
2449
2000
|
/**
|
|
@@ -2457,12 +2008,12 @@ class Kn extends Ue {
|
|
|
2457
2008
|
* @param annotation The annotation to add
|
|
2458
2009
|
*/
|
|
2459
2010
|
add(t) {
|
|
2460
|
-
if (
|
|
2461
|
-
const [r,
|
|
2462
|
-
(h,
|
|
2011
|
+
if (Fe(t)) {
|
|
2012
|
+
const [r, o] = t.features.reduce(
|
|
2013
|
+
(h, u) => (ot(u) ? h[1].push(u) : mt(u) && h[0].push(u), h),
|
|
2463
2014
|
[[], []]
|
|
2464
2015
|
);
|
|
2465
|
-
return r.forEach((h) => this.add(h)),
|
|
2016
|
+
return r.forEach((h) => this.add(h)), o.forEach((h) => this.add(h)), this.arrows.refreshLayer(), this;
|
|
2466
2017
|
}
|
|
2467
2018
|
switch (t.properties.type) {
|
|
2468
2019
|
case "text":
|
|
@@ -2479,29 +2030,29 @@ class Kn extends Ue {
|
|
|
2479
2030
|
* @param annotation The annotation(s) to remove
|
|
2480
2031
|
*/
|
|
2481
2032
|
remove(t) {
|
|
2482
|
-
return
|
|
2033
|
+
return Fe(t) ? (t.features.forEach(
|
|
2483
2034
|
(r) => this.remove(r)
|
|
2484
2035
|
), this) : (ot(t) ? (this.links.remove(t, "start"), this.links.remove(t, "end"), this.arrows.remove(t.id)) : this.texts.remove(t.id), this);
|
|
2485
2036
|
}
|
|
2486
2037
|
loadLink(t) {
|
|
2487
2038
|
if (t.properties.link)
|
|
2488
|
-
for (const r of
|
|
2489
|
-
const
|
|
2490
|
-
if (!
|
|
2039
|
+
for (const r of Be) {
|
|
2040
|
+
const o = t.properties.link[r];
|
|
2041
|
+
if (!o)
|
|
2491
2042
|
continue;
|
|
2492
|
-
const h = this.getAnnotation(
|
|
2493
|
-
if (
|
|
2494
|
-
this.links.add(t, r,
|
|
2495
|
-
else if (
|
|
2496
|
-
const
|
|
2497
|
-
if (!
|
|
2043
|
+
const h = this.getAnnotation(o.id);
|
|
2044
|
+
if (o.type === "text" && h)
|
|
2045
|
+
this.links.add(t, r, o.id, o.type, o.magnet);
|
|
2046
|
+
else if (o.type === "node") {
|
|
2047
|
+
const u = this.ogma.getNode(o.id);
|
|
2048
|
+
if (!u)
|
|
2498
2049
|
continue;
|
|
2499
|
-
this.links.add(t, r,
|
|
2500
|
-
const
|
|
2050
|
+
this.links.add(t, r, o.id, o.type, o.magnet);
|
|
2051
|
+
const d = u.getPosition(), g = u.getAttribute("radius") || 0, f = Rt(
|
|
2501
2052
|
t,
|
|
2502
2053
|
r === "start" ? "end" : "start"
|
|
2503
|
-
),
|
|
2504
|
-
|
|
2054
|
+
), y = Vt(f, d, +g);
|
|
2055
|
+
At(t, r, y.x, y.y);
|
|
2505
2056
|
}
|
|
2506
2057
|
}
|
|
2507
2058
|
}
|
|
@@ -2511,8 +2062,8 @@ class Kn extends Ue {
|
|
|
2511
2062
|
* @param y coord of the first point
|
|
2512
2063
|
* @param arrow The arrow to add
|
|
2513
2064
|
*/
|
|
2514
|
-
startArrow(t, r,
|
|
2515
|
-
this.cancelDrawing(), this.arrows.startDrawing(t, r,
|
|
2065
|
+
startArrow(t, r, o) {
|
|
2066
|
+
this.cancelDrawing(), this.arrows.startDrawing(t, r, o);
|
|
2516
2067
|
}
|
|
2517
2068
|
/**
|
|
2518
2069
|
* Start adding a text (add it, and give control to the user)
|
|
@@ -2520,14 +2071,14 @@ class Kn extends Ue {
|
|
|
2520
2071
|
* @param y coord of the top left point
|
|
2521
2072
|
* @param text The text to add
|
|
2522
2073
|
*/
|
|
2523
|
-
startText(t, r,
|
|
2524
|
-
this.cancelDrawing(), this.texts.startDrawing(t, r,
|
|
2074
|
+
startText(t, r, o) {
|
|
2075
|
+
this.cancelDrawing(), this.texts.startDrawing(t, r, o);
|
|
2525
2076
|
}
|
|
2526
2077
|
/**
|
|
2527
2078
|
* Cancel drawing on the current frame
|
|
2528
2079
|
*/
|
|
2529
2080
|
cancelDrawing() {
|
|
2530
|
-
this.annotations.forEach((t) => t.cancelDrawing()), this.emit(
|
|
2081
|
+
this.annotations.forEach((t) => t.cancelDrawing()), this.emit(Un);
|
|
2531
2082
|
}
|
|
2532
2083
|
/**
|
|
2533
2084
|
* Update the style of the annotation with the given id
|
|
@@ -2535,8 +2086,8 @@ class Kn extends Ue {
|
|
|
2535
2086
|
* @param style The new style
|
|
2536
2087
|
*/
|
|
2537
2088
|
updateStyle(t, r) {
|
|
2538
|
-
const
|
|
2539
|
-
return
|
|
2089
|
+
const o = this.getAnnotations().features.find((h) => h.id === t);
|
|
2090
|
+
return o ? (ot(o) ? this.arrows.updateStyle(o, r) : mt(o) && this.texts.updateStyle(o, r), this.onUpdate(o), this) : this;
|
|
2540
2091
|
}
|
|
2541
2092
|
/**
|
|
2542
2093
|
*
|
|
@@ -2567,47 +2118,47 @@ class Kn extends Ue {
|
|
|
2567
2118
|
}
|
|
2568
2119
|
}
|
|
2569
2120
|
export {
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2121
|
+
Xn as Arrows,
|
|
2122
|
+
ri as Control,
|
|
2123
|
+
ge as EVT_ADD,
|
|
2124
|
+
Un as EVT_CANCEL_DRAWING,
|
|
2125
|
+
Xt as EVT_DRAG,
|
|
2126
|
+
Tt as EVT_DRAG_END,
|
|
2127
|
+
Zt as EVT_DRAG_START,
|
|
2128
|
+
Rn as EVT_HOVER,
|
|
2129
|
+
Wn as EVT_LINK,
|
|
2130
|
+
pe as EVT_REMOVE,
|
|
2131
|
+
de as EVT_SELECT,
|
|
2132
|
+
Vn as EVT_UNHOVER,
|
|
2133
|
+
fe as EVT_UNSELECT,
|
|
2134
|
+
ye as EVT_UPDATE,
|
|
2584
2135
|
V as NONE,
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2136
|
+
Qn as Texts,
|
|
2137
|
+
ue as clientToContainerPosition,
|
|
2138
|
+
Nn as createArrow,
|
|
2139
|
+
Pt as createSVGElement,
|
|
2140
|
+
Zn as createText,
|
|
2141
|
+
Me as defaultArrowOptions,
|
|
2591
2142
|
zt as defaultArrowStyle,
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2143
|
+
ze as defaultControllerOptions,
|
|
2144
|
+
le as defaultTextOptions,
|
|
2145
|
+
St as defaultTextStyle,
|
|
2146
|
+
ii as getAnnotationsBounds,
|
|
2147
|
+
Gt as getArrowEnd,
|
|
2148
|
+
Yt as getArrowEndPoints,
|
|
2149
|
+
Rt as getArrowSide,
|
|
2150
|
+
$t as getArrowStart,
|
|
2151
|
+
Vt as getAttachmentPointOnNode,
|
|
2152
|
+
Ue as getHandleId,
|
|
2153
|
+
qe as getTextBbox,
|
|
2603
2154
|
ct as getTextPosition,
|
|
2604
2155
|
ut as getTextSize,
|
|
2605
|
-
|
|
2156
|
+
Fe as isAnnotationCollection,
|
|
2606
2157
|
ot as isArrow,
|
|
2607
2158
|
mt as isText,
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2159
|
+
Ve as setArrowEnd,
|
|
2160
|
+
At as setArrowEndPoint,
|
|
2161
|
+
Re as setArrowStart,
|
|
2162
|
+
Bn as setTextBbox,
|
|
2163
|
+
Fn as updateTextBbox
|
|
2613
2164
|
};
|