@linkurious/ogma-annotations 1.1.20 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  var Fn = Object.defineProperty;
2
- var Rn = (a, l, t) => l in a ? Fn(a, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[l] = t;
3
- var m = (a, l, t) => Rn(a, typeof l != "symbol" ? l + "" : l, t);
4
- let Qt = (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), "");
2
+ var Rn = (a, h, t) => h in a ? Fn(a, h, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[h] = t;
3
+ var m = (a, h, t) => Rn(a, typeof h != "symbol" ? h + "" : h, t);
4
+ let Qt = (a = 21) => crypto.getRandomValues(new Uint8Array(a)).reduce((h, t) => (t &= 63, t < 36 ? h += t.toString(36) : t < 62 ? h += (t - 26).toString(36).toUpperCase() : t > 62 ? h += "-" : h += "_", h), "");
5
5
  const Nt = {
6
6
  strokeType: "plain",
7
7
  strokeColor: "#202020",
@@ -34,20 +34,20 @@ const Nt = {
34
34
  // tail: 'arrow-plain',
35
35
  // start: { x: 0, y: 0 },
36
36
  // end: { x: 100, y: 100 }
37
- }, qn = (a = 0, l = 0, t = 0, r = 0, s = { ...Nt }) => ({
37
+ }, qn = (a = 0, h = 0, t = 0, r = 0, o = { ...Nt }) => ({
38
38
  id: Qt(),
39
39
  type: "Feature",
40
40
  properties: {
41
41
  type: "arrow",
42
42
  style: {
43
43
  ...Nt,
44
- ...s
44
+ ...o
45
45
  }
46
46
  },
47
47
  geometry: {
48
48
  type: "LineString",
49
49
  coordinates: [
50
- [a, l],
50
+ [a, h],
51
51
  [t, r]
52
52
  ]
53
53
  }
@@ -59,59 +59,59 @@ function Ge(a) {
59
59
  return a.geometry.bbox || jn(a), a.geometry.bbox;
60
60
  }
61
61
  function ut(a) {
62
- const l = Ge(a);
62
+ const h = Ge(a);
63
63
  return {
64
- width: l[2] - l[0],
65
- height: l[3] - l[1]
64
+ width: h[2] - h[0],
65
+ height: h[3] - h[1]
66
66
  };
67
67
  }
68
68
  function ct(a) {
69
- const l = Ge(a);
70
- return { x: l[0], y: l[1] };
69
+ const h = Ge(a);
70
+ return { x: h[0], y: h[1] };
71
71
  }
72
72
  function jn(a) {
73
- const [l, t] = a.geometry.coordinates[0][0], [r, s] = a.geometry.coordinates[0][2];
74
- a.geometry.bbox = [l, t, r, s];
73
+ const [h, t] = a.geometry.coordinates[0][0], [r, o] = a.geometry.coordinates[0][2];
74
+ a.geometry.bbox = [h, t, r, o];
75
75
  }
76
- function Vn(a, l, t, r, s) {
77
- a.geometry.bbox = [l, t, l + r, t + s], a.geometry.coordinates = [
76
+ function Vn(a, h, t, r, o) {
77
+ a.geometry.bbox = [h, t, h + r, t + o], a.geometry.coordinates = [
78
78
  [
79
- [l, t],
80
- [l + r, t],
81
- [l + r, t + s],
82
- [l, t + s],
83
- [l, t]
79
+ [h, t],
80
+ [h + r, t],
81
+ [h + r, t + o],
82
+ [h, t + o],
83
+ [h, t]
84
84
  ]
85
85
  ];
86
86
  }
87
87
  function zt(a) {
88
- const [l, t] = a.geometry.coordinates[0];
89
- return { x: l, y: t };
88
+ const [h, t] = a.geometry.coordinates[0];
89
+ return { x: h, y: t };
90
90
  }
91
- function Vt(a, l) {
92
- const [t, r] = a.geometry.coordinates[l === "start" ? 0 : 1];
91
+ function Vt(a, h) {
92
+ const [t, r] = a.geometry.coordinates[h === "start" ? 0 : 1];
93
93
  return { x: t, y: r };
94
94
  }
95
95
  function Xt(a) {
96
- const [l, t] = a.geometry.coordinates[1];
97
- return { x: l, y: t };
96
+ const [h, t] = a.geometry.coordinates[1];
97
+ return { x: h, y: t };
98
98
  }
99
- function Ye(a, l, t) {
100
- a.geometry.coordinates[0] = [l, t];
99
+ function Ye(a, h, t) {
100
+ a.geometry.coordinates[0] = [h, t];
101
101
  }
102
- function Xe(a, l, t) {
103
- a.geometry.coordinates[1] = [l, t];
102
+ function Xe(a, h, t) {
103
+ a.geometry.coordinates[1] = [h, t];
104
104
  }
105
105
  function Zt(a) {
106
106
  return { start: zt(a), end: Xt(a) };
107
107
  }
108
- function kt(a, l, t, r) {
109
- l === "start" ? Ye(a, t, r) : Xe(a, t, r);
108
+ function kt(a, h, t, r) {
109
+ h === "start" ? Ye(a, t, r) : Xe(a, t, r);
110
110
  }
111
111
  const Ze = (a) => parseInt(a.getAttribute("data-handle-id") || "-1");
112
- function mr(a) {
112
+ function yr(a) {
113
113
  return Gt(a).reduce(
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),
114
+ (h, t) => (h[0] = Math.min(t[0], h[0]), h[1] = Math.min(t[1], h[1]), h[2] = Math.max(t[0], h[2]), h[3] = Math.max(t[1], h[3]), h),
115
115
  [
116
116
  Number.POSITIVE_INFINITY,
117
117
  Number.POSITIVE_INFINITY,
@@ -123,146 +123,152 @@ function mr(a) {
123
123
  function Un(a) {
124
124
  return Array.isArray(a) && a.length === 2 && a.every(isFinite);
125
125
  }
126
- function Wn(a, l, t, r) {
127
- for (let s = 0; s < a.coordinates.length; s++) {
128
- const h = a.coordinates[s];
129
- if (Un(h))
130
- h[0] = t + (h[0] - t) * l, h[1] = r + (h[1] - r) * l;
126
+ function Wn(a, h, t, r) {
127
+ for (let o = 0; o < a.coordinates.length; o++) {
128
+ const l = a.coordinates[o];
129
+ if (Un(l))
130
+ l[0] = t + (l[0] - t) * h, l[1] = r + (l[1] - r) * h;
131
131
  else
132
- for (let u = 0; u < h.length; u++) {
133
- const d = h[u];
134
- d[0] = t + (d[0] - t) * l, d[1] = r + (d[1] - r) * l;
132
+ for (let u = 0; u < l.length; u++) {
133
+ const d = l[u];
134
+ d[0] = t + (d[0] - t) * h, d[1] = r + (d[1] - r) * h;
135
135
  }
136
136
  }
137
137
  return a;
138
138
  }
139
139
  function Gt(a) {
140
- let l = [];
141
- 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) {
140
+ let h = [];
141
+ return a.type == "Point" ? h = [a.coordinates] : a.type == "LineString" || a.type == "MultiPoint" ? h = a.coordinates : a.type == "Polygon" || a.type == "MultiLineString" ? h = a.coordinates.reduce(function(t, r) {
142
142
  return t.concat(r);
143
- }, []) : a.type == "MultiPolygon" ? l = a.coordinates.reduce(
144
- (t, r) => t.concat(r.reduce((s, h) => s.concat(h), [])),
143
+ }, []) : a.type == "MultiPolygon" ? h = a.coordinates.reduce(
144
+ (t, r) => t.concat(r.reduce((o, l) => o.concat(l), [])),
145
145
  []
146
- ) : a.type == "Feature" ? l = Gt(a.geometry) : a.type == "GeometryCollection" ? l = a.geometries.reduce(
146
+ ) : a.type == "Feature" ? h = Gt(a.geometry) : a.type == "GeometryCollection" ? h = a.geometries.reduce(
147
147
  (t, r) => t.concat(Gt(r)),
148
148
  []
149
- ) : a.type == "FeatureCollection" && (l = a.features.reduce(
149
+ ) : a.type == "FeatureCollection" && (h = a.features.reduce(
150
150
  (t, r) => t.concat(Gt(r)),
151
151
  []
152
- )), l;
152
+ )), h;
153
153
  }
154
- function Ut(a, l, t) {
155
- const r = Math.atan2(a.y - l.y, a.x - l.x);
154
+ function Ut(a, h, t) {
155
+ const r = Math.atan2(a.y - h.y, a.x - h.x);
156
156
  return {
157
- x: l.x + t * Math.cos(r),
158
- y: l.y + t * Math.sin(r)
157
+ x: h.x + t * Math.cos(r),
158
+ y: h.y + t * Math.sin(r)
159
159
  };
160
160
  }
161
- function fe(a, l) {
162
- if (!l) return { x: a.clientX, y: a.clientY };
163
- const t = l.getBoundingClientRect();
161
+ function fe(a, h) {
162
+ if (!h) return { x: a.clientX, y: a.clientY };
163
+ const t = h.getBoundingClientRect();
164
164
  return {
165
- x: a.clientX - t.left - l.clientLeft,
166
- y: a.clientY - t.top - l.clientTop
165
+ x: a.clientX - t.left - h.clientLeft,
166
+ y: a.clientY - t.top - h.clientTop
167
167
  };
168
168
  }
169
- function Gn(a, l) {
170
- return a.startsWith("#") ? Xn(a, l) : a.startsWith("rgb") ? Zn(a, l) : a;
169
+ function mr(a, h) {
170
+ return a.startsWith("#") ? Yn(a, h) : a.startsWith("rgb") ? Xn(a, h) : a;
171
171
  }
172
- function Yn(a) {
173
- return a.length === 4 ? a.split("").map((l) => l + l).join("") : a;
172
+ function Gn(a) {
173
+ return a.length === 4 ? a.split("").map((h) => h + h).join("") : a;
174
174
  }
175
- function Xn(a, l) {
176
- const [t, r, s] = Yn(a).match(/\w\w/g).map((h) => parseInt(h, 16));
177
- return `rgba(${t}, ${r}, ${s}, ${l})`;
175
+ function Yn(a, h) {
176
+ const [t, r, o] = Gn(a).match(/\w\w/g).map((l) => parseInt(l, 16));
177
+ return `rgba(${t}, ${r}, ${o}, ${h})`;
178
178
  }
179
- function Zn(a, l) {
180
- const [t, r, s] = a.match(/\d+/g).map((h) => parseInt(h, 10));
181
- return `rgba(${t}, ${r}, ${s}, ${l})`;
179
+ function Xn(a, h) {
180
+ const [t, r, o] = a.match(/\d+/g).map((l) => parseInt(l, 10));
181
+ return `rgba(${t}, ${r}, ${o}, ${h})`;
182
182
  }
183
- const wt = (a, l) => ({
184
- x: a.x - l.x,
185
- y: a.y - l.y
183
+ const wt = (a, h) => ({
184
+ x: a.x - h.x,
185
+ y: a.y - h.y
186
186
  }), Tt = (a) => Math.sqrt(a.x * a.x + a.y * a.y), Ke = (a) => ({
187
187
  x: -a.x,
188
188
  y: -a.y
189
189
  }), Je = (a) => {
190
- const l = Tt(a);
191
- return l === 0 ? { x: 0, y: 0 } : {
192
- x: a.x / l,
193
- y: a.y / l
190
+ const h = Tt(a);
191
+ return h === 0 ? { x: 0, y: 0 } : {
192
+ x: a.x / h,
193
+ y: a.y / h
194
194
  };
195
- }, St = (a, l) => ({
196
- x: a.x + l.x,
197
- y: a.y + l.y
198
- }), Qe = (a, l) => ({
199
- x: a.x * l,
200
- y: a.y * l
201
- }), Wt = (a, l) => ({
202
- x: a.x * l.x,
203
- y: a.y * l.y
204
- }), rt = (a, l) => {
205
- const t = Math.sin(l), r = Math.cos(l);
195
+ }, St = (a, h) => ({
196
+ x: a.x + h.x,
197
+ y: a.y + h.y
198
+ }), Qe = (a, h) => ({
199
+ x: a.x * h,
200
+ y: a.y * h
201
+ }), Wt = (a, h) => ({
202
+ x: a.x * h.x,
203
+ y: a.y * h.y
204
+ }), rt = (a, h) => {
205
+ const t = Math.sin(h), r = Math.cos(h);
206
206
  return {
207
207
  x: a.x * r - a.y * t,
208
208
  y: a.x * t + a.y * r
209
209
  };
210
- }, Kn = (a, l) => ({
211
- x: a.x / l,
212
- y: a.y / l
213
- }), Le = (a, l) => a.x * l.x + a.y * l.y, Jn = 0.5;
214
- function tn(a, l = 5, t = 30) {
210
+ }, Zn = (a, h) => ({
211
+ x: a.x / h,
212
+ y: a.y / h
213
+ }), Le = (a, h) => a.x * h.x + a.y * h.y, Kn = 0.5;
214
+ function tn(a, h = 5, t = 30) {
215
215
  var d;
216
- const { start: r, end: s } = Zt(a), h = wt(s, r), u = a.properties.style && a.properties.style.strokeWidth ? (d = a.properties.style) == null ? void 0 : d.strokeWidth : 0;
217
- return Math.min(t, Math.max(3 * u, Tt(h) * 0.01, l));
216
+ const { start: r, end: o } = Zt(a), l = wt(o, r), u = a.properties.style && a.properties.style.strokeWidth ? (d = a.properties.style) == null ? void 0 : d.strokeWidth : 0;
217
+ return Math.min(t, Math.max(3 * u, Tt(l) * 0.01, h));
218
218
  }
219
- function Ce(a, l, t, r) {
220
- const s = Qe(Ke(Je(l)), r);
219
+ function $e(a, h, t, r) {
220
+ const o = Qe(Ke(Je(h)), r);
221
221
  if (!t || t !== "arrow" && t !== "arrow-plain") return "";
222
- const h = St(a, rt(s, Math.PI / 10)), u = St(a, rt(s, -Math.PI / 10)), d = `${a.x} ${a.y}`;
223
- return `M ${h.x} ${h.y} L ${d} ${u.x} ${u.y} ${t === "arrow" ? "" : `${h.x} ${h.y}`}`;
222
+ const l = St(a, rt(o, Math.PI / 10)), u = St(a, rt(o, -Math.PI / 10)), d = `${a.x} ${a.y}`;
223
+ return `M ${l.x} ${l.y} L ${d} ${u.x} ${u.y} ${t === "arrow" ? "" : `${l.x} ${l.y}`}`;
224
224
  }
225
- function Qn(a, l, t, r, s) {
226
- const { start: h, end: u } = Zt(a), {
225
+ function Jn(a, h, t, r, o) {
226
+ const { start: l, end: u } = Zt(a), {
227
227
  tail: d,
228
228
  head: g,
229
229
  strokeColor: f,
230
230
  strokeWidth: y = 0
231
- } = a.properties.style || t, v = wt(u, h), k = tn(a, r, s), b = xt("g"), w = xt("path");
231
+ } = a.properties.style || t, v = wt(u, l), k = tn(a, r, o), b = xt("g"), w = xt("path");
232
232
  b.setAttribute("data-annotation", `${a.id}`), b.setAttribute("data-annotation-type", "arrow");
233
- const $ = g === "arrow-plain" || d === "arrow", E = f || "none";
234
- w.setAttribute("stroke", E), w.setAttribute("stroke-width", `${y}`), w.setAttribute("fill", $ ? f || "" : "none"), w.setAttribute("stroke-linecap", "round"), w.setAttribute("stroke-linejoin", "round");
235
- const C = Ce(h, Ke(v), d, k), N = Ce(u, v, g, k), D = C + `M ${h.x} ${h.y} ${u.x} ${u.y}` + N;
236
- w.setAttribute("d", D), b.appendChild(w), $e(b, h, E, d, y), $e(b, u, E, g, y), l.appendChild(b);
233
+ const C = g === "arrow-plain" || d === "arrow", E = f || "none";
234
+ w.setAttribute("stroke", E), w.setAttribute("stroke-width", `${y}`), w.setAttribute("fill", C ? f || "" : "none"), w.setAttribute("stroke-linecap", "round"), w.setAttribute("stroke-linejoin", "round");
235
+ const $ = $e(l, Ke(v), d, k), N = $e(u, v, g, k), D = $ + `M ${l.x} ${l.y} ${u.x} ${u.y}` + N;
236
+ w.setAttribute("d", D), b.appendChild(w), Ce(b, l, E, d, y), Ce(b, u, E, g, y), h.appendChild(b);
237
237
  }
238
- function $e(a, l, t, r, s) {
239
- r === "halo-dot" && Pe(a, l, tr(t), s * 4), (r === "dot" || r === "halo-dot") && Pe(a, l, t, s * 2);
238
+ function Ce(a, h, t, r, o) {
239
+ r === "halo-dot" && Pe(
240
+ a,
241
+ h,
242
+ Qn(t),
243
+ Kn,
244
+ o * 4
245
+ ), (r === "dot" || r === "halo-dot") && Pe(a, h, t, 1, o * 2);
240
246
  }
241
- function tr(a) {
242
- return a === "none" ? "none" : Gn(a, Jn);
247
+ function Qn(a) {
248
+ return a === "none" ? "none" : a;
243
249
  }
244
- function Pe(a, l, t, r) {
245
- const s = xt("circle");
246
- s.setAttribute("cx", `${l.x}`), s.setAttribute("cy", `${l.y}`), s.setAttribute("r", `${r}`), s.setAttribute("fill", t), a.appendChild(s);
250
+ function Pe(a, h, t, r, o) {
251
+ const l = xt("circle");
252
+ l.setAttribute("cx", `${h.x}`), l.setAttribute("cy", `${h.y}`), l.setAttribute("r", `${o}`), l.setAttribute("fill-opacity", `${r}`), l.setAttribute("fill", t), a.appendChild(l);
247
253
  }
248
- const W = -1, Kt = "dragging", Jt = "dragstart", It = "dragend", pe = "select", ge = "unselect", er = "hover", nr = "unhover", ye = "remove", me = "add", rr = "cancelDrawing", ve = "update", ir = "link";
254
+ const W = -1, Kt = "dragging", Jt = "dragstart", It = "dragend", pe = "select", ge = "unselect", tr = "hover", er = "unhover", ye = "remove", me = "add", nr = "cancelDrawing", ve = "update", rr = "link";
249
255
  function en(a) {
250
256
  return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
251
257
  }
252
258
  var he = { exports: {} }, ze;
253
- function sr() {
259
+ function ir() {
254
260
  return ze || (ze = 1, function(a) {
255
- var l = Object.prototype.hasOwnProperty, t = "~";
261
+ var h = Object.prototype.hasOwnProperty, t = "~";
256
262
  function r() {
257
263
  }
258
264
  Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
259
- function s(g, f, y) {
265
+ function o(g, f, y) {
260
266
  this.fn = g, this.context = f, this.once = y || !1;
261
267
  }
262
- function h(g, f, y, v, k) {
268
+ function l(g, f, y, v, k) {
263
269
  if (typeof y != "function")
264
270
  throw new TypeError("The listener must be a function");
265
- var b = new s(y, v || g, k), w = t ? t + f : f;
271
+ var b = new o(y, v || g, k), w = t ? t + f : f;
266
272
  return g._events[w] ? g._events[w].fn ? g._events[w] = [g._events[w], b] : g._events[w].push(b) : (g._events[w] = b, g._eventsCount++), g;
267
273
  }
268
274
  function u(g, f) {
@@ -275,7 +281,7 @@ function sr() {
275
281
  var f = [], y, v;
276
282
  if (this._eventsCount === 0) return f;
277
283
  for (v in y = this._events)
278
- l.call(y, v) && f.push(t ? v.slice(1) : v);
284
+ h.call(y, v) && f.push(t ? v.slice(1) : v);
279
285
  return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(y)) : f;
280
286
  }, d.prototype.listeners = function(f) {
281
287
  var y = t ? t + f : f, v = this._events[y];
@@ -288,11 +294,11 @@ function sr() {
288
294
  var y = t ? t + f : f, v = this._events[y];
289
295
  return v ? v.fn ? 1 : v.length : 0;
290
296
  }, d.prototype.emit = function(f, y, v, k, b, w) {
291
- var $ = t ? t + f : f;
292
- if (!this._events[$]) return !1;
293
- var E = this._events[$], C = arguments.length, N, D;
297
+ var C = t ? t + f : f;
298
+ if (!this._events[C]) return !1;
299
+ var E = this._events[C], $ = arguments.length, N, D;
294
300
  if (E.fn) {
295
- switch (E.once && this.removeListener(f, E.fn, void 0, !0), C) {
301
+ switch (E.once && this.removeListener(f, E.fn, void 0, !0), $) {
296
302
  case 1:
297
303
  return E.fn.call(E.context), !0;
298
304
  case 2:
@@ -306,13 +312,13 @@ function sr() {
306
312
  case 6:
307
313
  return E.fn.call(E.context, y, v, k, b, w), !0;
308
314
  }
309
- for (D = 1, N = new Array(C - 1); D < C; D++)
315
+ for (D = 1, N = new Array($ - 1); D < $; D++)
310
316
  N[D - 1] = arguments[D];
311
317
  E.fn.apply(E.context, N);
312
318
  } else {
313
319
  var z = E.length, R;
314
320
  for (D = 0; D < z; D++)
315
- switch (E[D].once && this.removeListener(f, E[D].fn, void 0, !0), C) {
321
+ switch (E[D].once && this.removeListener(f, E[D].fn, void 0, !0), $) {
316
322
  case 1:
317
323
  E[D].fn.call(E[D].context);
318
324
  break;
@@ -326,16 +332,16 @@ function sr() {
326
332
  E[D].fn.call(E[D].context, y, v, k);
327
333
  break;
328
334
  default:
329
- if (!N) for (R = 1, N = new Array(C - 1); R < C; R++)
335
+ if (!N) for (R = 1, N = new Array($ - 1); R < $; R++)
330
336
  N[R - 1] = arguments[R];
331
337
  E[D].fn.apply(E[D].context, N);
332
338
  }
333
339
  }
334
340
  return !0;
335
341
  }, d.prototype.on = function(f, y, v) {
336
- return h(this, f, y, v, !1);
342
+ return l(this, f, y, v, !1);
337
343
  }, d.prototype.once = function(f, y, v) {
338
- return h(this, f, y, v, !0);
344
+ return l(this, f, y, v, !0);
339
345
  }, d.prototype.removeListener = function(f, y, v, k) {
340
346
  var b = t ? t + f : f;
341
347
  if (!this._events[b]) return this;
@@ -345,8 +351,8 @@ function sr() {
345
351
  if (w.fn)
346
352
  w.fn === y && (!k || w.once) && (!v || w.context === v) && u(this, b);
347
353
  else {
348
- for (var $ = 0, E = [], C = w.length; $ < C; $++)
349
- (w[$].fn !== y || k && !w[$].once || v && w[$].context !== v) && E.push(w[$]);
354
+ for (var C = 0, E = [], $ = w.length; C < $; C++)
355
+ (w[C].fn !== y || k && !w[C].once || v && w[C].context !== v) && E.push(w[C]);
350
356
  E.length ? this._events[b] = E.length === 1 ? E[0] : E : u(this, b);
351
357
  }
352
358
  return this;
@@ -356,8 +362,8 @@ function sr() {
356
362
  }, d.prototype.off = d.prototype.removeListener, d.prototype.addListener = d.prototype.on, d.prefixed = t, d.EventEmitter = d, a.exports = d;
357
363
  }(he)), he.exports;
358
364
  }
359
- var or = sr();
360
- const nn = /* @__PURE__ */ en(or);
365
+ var sr = ir();
366
+ const nn = /* @__PURE__ */ en(sr);
361
367
  class rn extends nn {
362
368
  constructor(t, r) {
363
369
  super();
@@ -379,13 +385,13 @@ class rn extends nn {
379
385
  m(this, "_onClickMouseMove", (t) => {
380
386
  if (!t.domEvent || this.isDragging || !this.shouldDetect || t.domEvent.type !== "mousemove" && t.domEvent.target && t.domEvent.target.tagName === "a")
381
387
  return;
382
- const r = this.ogma.view.screenToGraphCoordinates(t), s = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
383
- t.domEvent.type === "mousemove" ? s ? this.hover(s.id) : this.hoveredId !== W && this.unhover() : s ? this.select(s.id) : this.selectedId !== W && this.unselect();
388
+ const r = this.ogma.view.screenToGraphCoordinates(t), o = this.shouldDetect || !this.shouldDetect && +this.selectedId > -1 ? this.detect(r, 0) : void 0;
389
+ t.domEvent.type === "mousemove" ? o ? this.hover(o.id) : this.hoveredId !== W && this.unhover() : o ? this.select(o.id) : this.selectedId !== W && this.unselect();
384
390
  });
385
391
  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", () => {
386
392
  this.refreshEditor(), this.refreshDrawing();
387
393
  }), this.layer = t.layers.addSVGLayer({
388
- draw: (s) => this.draw(s)
394
+ draw: (o) => this.draw(o)
389
395
  }), this.layer.moveToTop(), this.editor = t.layers.addLayer(r), this.editor.hide();
390
396
  }
391
397
  _canRemove() {
@@ -397,7 +403,7 @@ class rn extends nn {
397
403
  * @returns the added annotation
398
404
  */
399
405
  add(t) {
400
- const r = this.getDefaultOptions(), s = Object.assign(t, {
406
+ const r = this.getDefaultOptions(), o = Object.assign(t, {
401
407
  id: t.id === void 0 ? Qt() : t.id,
402
408
  type: t.type,
403
409
  properties: {
@@ -411,7 +417,7 @@ class rn extends nn {
411
417
  ...t.geometry
412
418
  }
413
419
  });
414
- return this.elements.push(s), this.layer.refresh(), this.emit(me, s), s;
420
+ return this.elements.push(o), this.layer.refresh(), this.emit(me, o), o;
415
421
  }
416
422
  updateStyle(t, r) {
417
423
  this.updateAnnotation(t, {
@@ -425,10 +431,10 @@ class rn extends nn {
425
431
  geometry: r
426
432
  });
427
433
  }
428
- scale(t, r, s, h) {
434
+ scale(t, r, o, l) {
429
435
  this.updateGeometry(
430
436
  t,
431
- Wn(t.geometry, r, s, h)
437
+ Wn(t.geometry, r, o, l)
432
438
  );
433
439
  }
434
440
  /**
@@ -438,15 +444,15 @@ class rn extends nn {
438
444
  * @param element params of the annotation
439
445
  */
440
446
  update(t, r) {
441
- const s = this.getById(t);
442
- this.updateAnnotation(s, r);
447
+ const o = this.getById(t);
448
+ this.updateAnnotation(o, r);
443
449
  }
444
450
  updateAnnotation(t, r) {
445
451
  if (!t) return;
446
- const s = t.id;
447
- Object.keys(r).forEach((h) => {
448
- if (h !== "id")
449
- if (h === "properties") {
452
+ const o = t.id;
453
+ Object.keys(r).forEach((l) => {
454
+ if (l !== "id")
455
+ if (l === "properties") {
450
456
  const u = r.properties || { style: {} };
451
457
  t.properties = {
452
458
  ...t.properties || {},
@@ -456,18 +462,18 @@ class rn extends nn {
456
462
  ...u.style || {}
457
463
  }
458
464
  };
459
- } else h === "geometry" ? t.geometry = {
465
+ } else l === "geometry" ? t.geometry = {
460
466
  ...t.geometry,
461
467
  ...r.geometry
462
- } : t[h] = r[h];
463
- }), s === this.selectedId && this.refreshEditor(), this.layer.refresh();
468
+ } : t[l] = r[l];
469
+ }), o === this.selectedId && this.refreshEditor(), this.layer.refresh();
464
470
  }
465
471
  getById(t) {
466
472
  const r = Number(t);
467
- for (let s = 0; s < this.elements.length; s++) {
468
- const h = this.elements[s];
469
- if (!(h.id !== t && h.id !== r))
470
- return h;
473
+ for (let o = 0; o < this.elements.length; o++) {
474
+ const l = this.elements[o];
475
+ if (!(l.id !== t && l.id !== r))
476
+ return l;
471
477
  }
472
478
  }
473
479
  /**
@@ -481,7 +487,7 @@ class rn extends nn {
481
487
  }
482
488
  hover(t) {
483
489
  const r = this.getById(t);
484
- r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(er, r));
490
+ r && (this.showeditorOnHover && this.editor.show(), this.hoveredId = t, this.refreshEditor(), this.layer.refresh(), this.emit(tr, r));
485
491
  }
486
492
  getSelectedFeature() {
487
493
  return this.selectedId === W ? null : this.getById(this.selectedId);
@@ -492,7 +498,7 @@ class rn extends nn {
492
498
  }
493
499
  unhover() {
494
500
  const t = this.getById(this.hoveredId);
495
- return this.emit(nr, t), this.hoveredId = W, this.selectedId === W && this.editor.hide(), this.layer.refresh(), this;
501
+ return this.emit(er, t), this.hoveredId = W, this.selectedId === W && this.editor.hide(), this.layer.refresh(), this;
496
502
  }
497
503
  /**
498
504
  * @method remove
@@ -501,7 +507,7 @@ class rn extends nn {
501
507
  */
502
508
  remove(t) {
503
509
  const r = this.getById(t);
504
- t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((s) => s.id !== t), r && this.emit(ye, r), this.layer.refresh();
510
+ t === this.hoveredId && this.unhover(), t === this.selectedId && this.unselect(), this.elements = this.elements.filter((o) => o.id !== t), r && this.emit(ye, r), this.layer.refresh();
505
511
  }
506
512
  /**
507
513
  * @method disableDragging
@@ -552,7 +558,7 @@ class rn extends nn {
552
558
  }
553
559
  }
554
560
  const Ne = "handle-line", He = "handle-start", Fe = "handle-end";
555
- class ar extends rn {
561
+ class or extends rn {
556
562
  constructor(t, r = {}) {
557
563
  super(
558
564
  t,
@@ -577,22 +583,22 @@ class ar extends rn {
577
583
  m(this, "onHandleMouseDown", (t) => {
578
584
  const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
579
585
  if (!r) return;
580
- const { x: s, y: h } = fe(t, this.ogma.getContainer());
581
- this.startDragging(r, s, h), this.draggedHandle = Ze(t.target);
586
+ const { x: o, y: l } = fe(t, this.ogma.getContainer());
587
+ this.startDragging(r, o, l), this.draggedHandle = Ze(t.target);
582
588
  });
583
589
  m(this, "onMouseUp", () => {
584
590
  this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = W, this.emit(It, this.arrow));
585
591
  });
586
592
  m(this, "onMouseMove", (t) => {
587
593
  if (!this.isDragging || this.draggedHandle === W) return;
588
- const r = this.handles[this.draggedHandle], s = this.ogma.view.getAngle(), { x: h, y: u } = rt(
589
- Kn(
594
+ const r = this.handles[this.draggedHandle], o = this.ogma.view.getAngle(), { x: l, y: u } = rt(
595
+ Zn(
590
596
  { x: t.x - this.startX, y: t.y - this.startY },
591
597
  this.ogma.view.getZoom()
592
598
  ),
593
- s
599
+ o
594
600
  ), d = r.id === Ne, g = r.id === He, f = r.id === Fe;
595
- (d || g) && Ye(this.arrow, this.start.x + h, this.start.y + u), (d || f) && Xe(this.arrow, this.end.x + h, this.end.y + u), this.emit(
601
+ (d || g) && Ye(this.arrow, this.start.x + l, this.start.y + u), (d || f) && Xe(this.arrow, this.end.x + l, this.end.y + u), this.emit(
596
602
  Kt,
597
603
  this.arrow,
598
604
  d ? "line" : g ? "start" : "end"
@@ -601,7 +607,7 @@ class ar extends rn {
601
607
  this.minArrowHeight = r.minArrowHeight || 0, this.maxArrowHeight = r.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
602
608
  this.editor.element.querySelectorAll(".arrow-handle>.handle")
603
609
  ), this.handles.forEach(
604
- (s) => s.addEventListener("mousedown", this.onHandleMouseDown)
610
+ (o) => o.addEventListener("mousedown", this.onHandleMouseDown)
605
611
  ), document.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("mouseup", this.onMouseUp);
606
612
  }
607
613
  /**
@@ -610,44 +616,44 @@ class ar extends rn {
610
616
  * @param y
611
617
  * @param arrow
612
618
  */
613
- startDrawing(t, r, s = qn(t, r, t, r, Nt)) {
619
+ startDrawing(t, r, o = qn(t, r, t, r, Nt)) {
614
620
  var d;
615
- this.disableDragging(), this.add(s), this.hoveredId = s.id;
616
- const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), u = ((d = this.ogma.getContainer()) == null ? void 0 : d.getBoundingClientRect()) || {
621
+ this.disableDragging(), this.add(o), this.hoveredId = o.id;
622
+ const l = this.ogma.view.graphToScreenCoordinates({ x: t, y: r }), u = ((d = this.ogma.getContainer()) == null ? void 0 : d.getBoundingClientRect()) || {
617
623
  left: 0,
618
624
  top: 0
619
625
  };
620
626
  this.startDragging(
621
- this.getById(s.id),
622
- h.x + (u == null ? void 0 : u.left),
623
- h.y + u.top
627
+ this.getById(o.id),
628
+ l.x + (u == null ? void 0 : u.left),
629
+ l.y + u.top
624
630
  ), this.draggedHandle = 2;
625
631
  }
626
632
  cancelDrawing() {
627
633
  this.isDragging && (this.remove(this.arrow.id), this.emit(It, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = W);
628
634
  }
629
- startDragging(t, r, s) {
630
- this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = s, this.start = zt(this.arrow), this.end = Xt(this.arrow), this.disableDragging(), this.emit(Jt, this.arrow), this.isDragging = !0;
635
+ startDragging(t, r, o) {
636
+ this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = o, this.start = zt(this.arrow), this.end = Xt(this.arrow), this.disableDragging(), this.emit(Jt, this.arrow), this.isDragging = !0;
631
637
  }
632
638
  detect(t, r = 0) {
633
- return this.elements.find((s) => {
634
- const { start: h, end: u } = Zt(s), d = wt(t, {
635
- x: (h.x + u.x) / 2,
636
- y: (h.y + u.y) / 2
637
- }), g = wt(u, h), f = Tt(g), y = Je(g), v = tn(s);
639
+ return this.elements.find((o) => {
640
+ const { start: l, end: u } = Zt(o), d = wt(t, {
641
+ x: (l.x + u.x) / 2,
642
+ y: (l.y + u.y) / 2
643
+ }), g = wt(u, l), f = Tt(g), y = Je(g), v = tn(o);
638
644
  return Math.abs(Le(y, d)) < f / 2 + r && Math.abs(Le(rt(y, Math.PI / 2), d)) < v / 2 + r;
639
645
  });
640
646
  }
641
647
  refreshEditor() {
642
648
  if (+this.selectedId < 0 && +this.hoveredId < 0) return;
643
- const t = this.selectedId !== W ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Zt(t), s = this.ogma.view.graphToScreenCoordinates(r.start), h = this.ogma.view.graphToScreenCoordinates(r.end), [u, d, g] = Array.prototype.slice.call(
649
+ const t = this.selectedId !== W ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Zt(t), o = this.ogma.view.graphToScreenCoordinates(r.start), l = this.ogma.view.graphToScreenCoordinates(r.end), [u, d, g] = Array.prototype.slice.call(
644
650
  this.editor.element.querySelectorAll(".handle")
645
651
  );
646
- d.style.transform = `translate(${s.x}px, ${s.y}px) translate(-50%, -50%)`, g.style.transform = `translate(${h.x}px, ${h.y}px) translate(-50%, -50%)`;
652
+ d.style.transform = `translate(${o.x}px, ${o.y}px) translate(-50%, -50%)`, g.style.transform = `translate(${l.x}px, ${l.y}px) translate(-50%, -50%)`;
647
653
  const f = {
648
- x: (h.x + s.x) / 2,
649
- y: (h.y + s.y) / 2
650
- }, y = wt(h, s), v = Qe(y, 1 / Tt(y)), k = Math.atan2(v.y, v.x);
654
+ x: (l.x + o.x) / 2,
655
+ y: (l.y + o.y) / 2
656
+ }, y = wt(l, o), v = Qe(y, 1 / Tt(y)), k = Math.atan2(v.y, v.x);
651
657
  u.style.width = `${Tt(y)}px`, u.style.left = `${f.x}px`, u.style.top = `${f.y}px`, u.style.transform = `translate(-50%, -50%) rotate(${k}rad)`;
652
658
  }
653
659
  getDefaultOptions() {
@@ -655,9 +661,9 @@ class ar extends rn {
655
661
  }
656
662
  draw(t) {
657
663
  t.innerHTML = "";
658
- const r = xt("g"), s = this.ogma.view.getAngle();
659
- s !== 0 && r.setAttribute("transform", `rotate(${-s * (180 / Math.PI)})`), this.elements.forEach(
660
- (h) => Qn(h, r, Nt, this.minArrowHeight, this.maxArrowHeight)
664
+ const r = xt("g"), o = this.ogma.view.getAngle();
665
+ o !== 0 && r.setAttribute("transform", `rotate(${-o * (180 / Math.PI)})`), this.elements.forEach(
666
+ (l) => Jn(l, r, Nt, this.minArrowHeight, this.maxArrowHeight)
661
667
  ), t.appendChild(r);
662
668
  }
663
669
  refreshDrawing() {
@@ -705,100 +711,100 @@ const _t = {
705
711
  }, Re = {
706
712
  handleSize: 3.5,
707
713
  placeholder: "Your text..."
708
- }, lr = (a = 0, l = 0, t = 100, r = 50, s = "", h = { ..._t }) => ({
714
+ }, ar = (a = 0, h = 0, t = 100, r = 50, o = "", l = { ..._t }) => ({
709
715
  id: Qt(),
710
716
  type: "Feature",
711
717
  properties: {
712
718
  type: "text",
713
- content: s,
714
- style: { ..._t, ...h }
719
+ content: o,
720
+ style: { ..._t, ...l }
715
721
  },
716
722
  geometry: {
717
723
  type: "Polygon",
718
724
  coordinates: [
719
725
  [
720
- [a, l],
721
- [a + t, l],
722
- [a + t, l + r],
723
- [a, l + r],
724
- [a, l]
726
+ [a, h],
727
+ [a + t, h],
728
+ [a + t, h + r],
729
+ [a, h + r],
730
+ [a, h]
725
731
  ]
726
732
  ]
727
733
  }
728
734
  });
729
- var Yt = { exports: {} }, hr = Yt.exports, qe;
730
- function cr() {
731
- return qe || (qe = 1, function(a, l) {
735
+ var Yt = { exports: {} }, lr = Yt.exports, qe;
736
+ function hr() {
737
+ return qe || (qe = 1, function(a, h) {
732
738
  (function(t, r) {
733
739
  a.exports = r();
734
- })(hr, () => (() => {
740
+ })(lr, () => (() => {
735
741
  var t = { d: (e, n) => {
736
- for (var o in n) t.o(n, o) && !t.o(e, o) && Object.defineProperty(e, o, { enumerable: !0, get: n[o] });
742
+ for (var s in n) t.o(n, s) && !t.o(e, s) && Object.defineProperty(e, s, { enumerable: !0, get: n[s] });
737
743
  }, o: (e, n) => Object.prototype.hasOwnProperty.call(e, n) }, r = {};
738
- function s(e) {
739
- return s = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
744
+ function o(e) {
745
+ return o = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
740
746
  return typeof n;
741
747
  } : function(n) {
742
748
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
743
- }, s(e);
749
+ }, o(e);
744
750
  }
745
751
  t.d(r, { default: () => Nn });
746
- 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 };
752
+ var l = /^((?:[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 };
747
753
  function v(e) {
748
- var n = "", o = this;
749
- return o.style && o.style !== "normal" && (n += o.style), o.variant && o.variant !== "normal" && (n += (n ? " " : "") + o.variant), o.weight && o.weight !== "normal" && (n += (n ? " " : "") + o.weight), o.size && (n += (n ? " " : "") + o.size + "px", o.height !== o.size && (n += "/" + o.height + "px")), o.family && (n += (n ? " " : "") + o.family), e && (n += "::" + o.baseline), e && (n += "::" + o.color), n;
754
+ var n = "", s = this;
755
+ 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;
750
756
  }
751
757
  var k = { id: "", family: "sans-serif", height: 14, size: 12, variant: "", style: "", weight: "", baseline: "", color: null, toString: v, valueOf: v };
752
758
  function b(e) {
753
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = h.exec(e);
754
- n.family = (o[6] || "").trim();
755
- var i = y[o[2]] || parseFloat(o[2]);
756
- o[3] === "%" ? i *= 0.16 : o[3] === "em" ? i *= 16 : o[3] === "pt" && (i *= f), n.size = i;
757
- var c = parseFloat(o[4]);
758
- if (c !== "normal" && c !== "inherit" && c ? o[5] && o[5] !== "em" ? o[5] === "pt" ? n.height = c * f : o[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)), u.test(o[1]) && (n.variant = "small-caps"), d.test(o[1]) && (n.style = "italic"), g.test(o[1])) n.weight = "bold";
759
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = l.exec(e);
760
+ n.family = (s[6] || "").trim();
761
+ var i = y[s[2]] || parseFloat(s[2]);
762
+ s[3] === "%" ? i *= 0.16 : s[3] === "em" ? i *= 16 : s[3] === "pt" && (i *= f), n.size = i;
763
+ var c = parseFloat(s[4]);
764
+ 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])) n.weight = "bold";
759
765
  else {
760
- var p = parseInt(/\b(\d+)\b/.exec(o[1]), 10);
766
+ var p = parseInt(/\b(\d+)\b/.exec(s[1]), 10);
761
767
  p >= 100 && p !== 400 && (n.weight = p);
762
768
  }
763
769
  return n;
764
770
  }
765
771
  function w() {
766
- var e, n, o, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "12px/14px sans-serif", c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = 14, A = 12, x = null, S = null, T = "";
772
+ 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, A = 12, x = null, S = null, T = "";
767
773
  if (i && i.nodeType) {
768
774
  var M = i && (i.ownerDocument && i.ownerDocument.defaultView || i.document && i || i.defaultView), O = M.getComputedStyle(i, null);
769
775
  e = O.getPropertyValue("font-family") || "", A = parseFloat(O.getPropertyValue("font-size")), p = O.getPropertyValue("line-height"), x = O.getPropertyValue("font-weight"), S = O.getPropertyValue("font-style"), T = O.getPropertyValue("font-variant") || "";
770
776
  } else if (typeof i == "string") {
771
777
  var _ = b(i);
772
778
  e = _.family, A = _.size, p = _.height, T = _.variant, S = _.style, x = _.weight;
773
- } else s(i) === "object" && (e = i.family, A = i.size, p = i.height, T = i.variant, x = i.weight, S = i.style, n = i.baseline, o = i.color);
779
+ } else o(i) === "object" && (e = i.family, A = i.size, p = i.height, T = i.variant, x = i.weight, S = i.style, n = i.baseline, s = i.color);
774
780
  c.size && c.size < 3 && (A *= c.size), p = p !== "normal" && p ? parseFloat(p) : A * (7 / 6), c.height && c.height < 3 && (p *= c.height);
775
781
  var L = Object.create(k);
776
- return L.family = c.family || e || "sans-serif", L.height = p ?? 14, L.size = A ?? 12, L.variant = c.variant || T || "", L.style = c.style || S || "", L.weight = c.weight || x || "", L.baseline = n || 0, c.baseline != null && (L.baseline = c.baseline), L.color = c.color || o || "", L.id = v.call(L, !0), L;
782
+ return L.family = c.family || e || "sans-serif", L.height = p ?? 14, L.size = A ?? 12, L.variant = c.variant || T || "", L.style = c.style || S || "", 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;
777
783
  }
778
- const $ = { "\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 };
779
- var E, C = function(e) {
784
+ 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 };
785
+ var E, $ = function(e) {
780
786
  var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
781
787
  if (n && n.getContext) {
782
- var o = n.getContext("2d");
783
- if (o && typeof o.measureText == "function") return function(i, c) {
784
- return o.font = String(c), o.measureText(i).width;
788
+ var s = n.getContext("2d");
789
+ if (s && typeof s.measureText == "function") return function(i, c) {
790
+ return s.font = String(c), s.measureText(i).width;
785
791
  };
786
792
  }
787
793
  }(typeof document < "u" ? document : null) || (E = {}, function(e, n) {
788
794
  if (!E[n]) {
789
- var o = w(n);
790
- E[n] = o, /\bmonospace\b/.test(o.family) ? o.size *= 0.6 : (o.size *= 0.45, o.weight && (o.size *= 1.18));
795
+ var s = w(n);
796
+ E[n] = s, /\bmonospace\b/.test(s.family) ? s.size *= 0.6 : (s.size *= 0.45, s.weight && (s.size *= 1.18));
791
797
  }
792
798
  return e.length * E[n].size;
793
799
  }), N = {}, D = { trim: !0, collapse: !0 };
794
- function z(e, n, o) {
795
- var i = Object.assign({}, D, o), c = String(e);
800
+ function z(e, n, s) {
801
+ var i = Object.assign({}, D, s), c = String(e);
796
802
  if (!c) return 0;
797
- if (c in $) {
803
+ if (c in C) {
798
804
  var p = n.id + "/" + c;
799
- return p in N || (N[p] = C("_".concat(c, "_"), n) - C("__", n)), N[p];
805
+ return p in N || (N[p] = $("_".concat(c, "_"), n) - $("__", n)), N[p];
800
806
  }
801
- return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), C(c, n) + n.size * (e.tracking || 0);
807
+ 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);
802
808
  }
803
809
  function R(e) {
804
810
  return R = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
@@ -812,8 +818,8 @@ function cr() {
812
818
  e.prototype = Object.create(n && n.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), n && Dt(e, n);
813
819
  }
814
820
  function Dt(e, n) {
815
- return Dt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, i) {
816
- return o.__proto__ = i, o;
821
+ return Dt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(s, i) {
822
+ return s.__proto__ = i, s;
817
823
  }, Dt(e, n);
818
824
  }
819
825
  function Mt(e) {
@@ -828,20 +834,20 @@ function cr() {
828
834
  }
829
835
  }();
830
836
  return function() {
831
- var o, i = Ht(e);
837
+ var s, i = Ht(e);
832
838
  if (n) {
833
839
  var c = Ht(this).constructor;
834
- o = Reflect.construct(i, arguments, c);
835
- } else o = i.apply(this, arguments);
836
- return sn(this, o);
840
+ s = Reflect.construct(i, arguments, c);
841
+ } else s = i.apply(this, arguments);
842
+ return sn(this, s);
837
843
  };
838
844
  }
839
845
  function sn(e, n) {
840
846
  if (n && (R(n) === "object" || typeof n == "function")) return n;
841
847
  if (n !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
842
- return function(o) {
843
- if (o === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
844
- return o;
848
+ return function(s) {
849
+ if (s === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
850
+ return s;
845
851
  }(e);
846
852
  }
847
853
  function Ht(e) {
@@ -853,8 +859,8 @@ function cr() {
853
859
  if (!(e instanceof n)) throw new TypeError("Cannot call a class as a function");
854
860
  }
855
861
  function on(e, n) {
856
- for (var o = 0; o < n.length; o++) {
857
- var i = n[o];
862
+ for (var s = 0; s < n.length; s++) {
863
+ var i = n[s];
858
864
  i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, A) {
859
865
  if (R(p) !== "object" || p === null) return p;
860
866
  var x = p[Symbol.toPrimitive];
@@ -868,7 +874,7 @@ function cr() {
868
874
  }
869
875
  var c;
870
876
  }
871
- function Rt(e, n, o) {
877
+ function Rt(e, n, s) {
872
878
  return n && on(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
873
879
  }
874
880
  var q = function() {
@@ -885,37 +891,37 @@ function cr() {
885
891
  return this.value;
886
892
  } }]), e;
887
893
  }(), Ot = function(e) {
888
- dt(o, e);
889
- var n = Mt(o);
890
- function o() {
891
- return Ft(this, o), n.apply(this, arguments);
894
+ dt(s, e);
895
+ var n = Mt(s);
896
+ function s() {
897
+ return Ft(this, s), n.apply(this, arguments);
892
898
  }
893
- return Rt(o);
899
+ return Rt(s);
894
900
  }(q), et = function(e) {
895
- dt(o, e);
896
- var n = Mt(o);
897
- function o() {
898
- return Ft(this, o), n.apply(this, arguments);
901
+ dt(s, e);
902
+ var n = Mt(s);
903
+ function s() {
904
+ return Ft(this, s), n.apply(this, arguments);
899
905
  }
900
- return Rt(o);
906
+ return Rt(s);
901
907
  }(q), yt = function(e) {
902
- dt(o, e);
903
- var n = Mt(o);
904
- function o() {
905
- return Ft(this, o), n.apply(this, arguments);
908
+ dt(s, e);
909
+ var n = Mt(s);
910
+ function s() {
911
+ return Ft(this, s), n.apply(this, arguments);
906
912
  }
907
- return Rt(o);
913
+ return Rt(s);
908
914
  }(q), te = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, an = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, xe = /^[\xA0\u2011\u202F\u2060\uFEFF]/, ln = /^(?:[;\xAD%?…]|,(?!\d))/, hn = /^[´±°¢£¤$¥\u2212]/;
909
915
  function qt(e, n) {
910
916
  n !== !1 && (e = e.trim());
911
- for (var o, i, c = [], p = e.charAt(0), A = 0, x = 1, S = e.length; x < S; x++) {
912
- o = e.charAt(x), i = e.charAt(x + 1);
913
- var T = te.test(p), M = te.test(o), O = M || T, _ = void 0;
914
- if ((hn.test(o) && !xe.test(p) || ln.test(p + i) && !xe.test(o)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((_ = te.test(e.charAt(x - 2))) && !M && (O = !1), !_ && an.test(o + i) && (O = !0)), O) {
917
+ for (var s, i, c = [], p = e.charAt(0), A = 0, x = 1, S = e.length; x < S; x++) {
918
+ s = e.charAt(x), i = e.charAt(x + 1);
919
+ var T = te.test(p), M = te.test(s), O = M || T, _ = void 0;
920
+ if ((hn.test(s) && !xe.test(p) || ln.test(p + i) && !xe.test(s)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((_ = te.test(e.charAt(x - 2))) && !M && (O = !1), !_ && an.test(s + i) && (O = !0)), O) {
915
921
  var L = e.slice(A, x);
916
922
  /\u00AD$/.test(L) ? (c.push(new q(L.slice(0, -1))), c.push(new yt())) : (c.push(new q(L)), c.push(new Ot())), A = x;
917
923
  }
918
- p = o;
924
+ p = s;
919
925
  }
920
926
  return c.push(new q(e.slice(A))), c;
921
927
  }
@@ -948,10 +954,10 @@ function cr() {
948
954
  e.sup = !0;
949
955
  } }, gn = { 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 };
950
956
  function Ae(e) {
951
- return e.replace(pn, function(n, o, i, c) {
952
- if (o || i) {
953
- var p = o ? 10 : 16;
954
- return String.fromCharCode(parseInt(o || i, p));
957
+ return e.replace(pn, function(n, s, i, c) {
958
+ if (s || i) {
959
+ var p = s ? 10 : 16;
960
+ return String.fromCharCode(parseInt(s || i, p));
955
961
  }
956
962
  return c in we ? we[c] : n;
957
963
  });
@@ -961,17 +967,17 @@ function cr() {
961
967
  }
962
968
  var mn = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
963
969
  function vn(e) {
964
- var n, o = {};
970
+ var n, s = {};
965
971
  if (e) {
966
972
  do
967
973
  if (n = mn.exec(e)) {
968
974
  var i = Ae(yn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
969
- if (o[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0])) throw new Error("Attribute error");
975
+ if (s[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0])) throw new Error("Attribute error");
970
976
  }
971
977
  while (n && e.length);
972
978
  if (/\S/.test(e)) throw new Error("Attribute error");
973
979
  }
974
- return o;
980
+ return s;
975
981
  }
976
982
  const Ee = { 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: "Þ" };
977
983
  var xn = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, wn = /^%[^\n]+(?:\n|$)/, bn = /^[^#$%&~_^\\{}]+/, An = /^\\([&{}$%#_])/, En = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, kn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "­", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, G = { bf: function(e) {
@@ -999,12 +1005,12 @@ function cr() {
999
1005
  var Sn = /[\r\n\xA0]+/g;
1000
1006
  function Tn(e, n) {
1001
1007
  e.sup && (e.baseline = 0.45, e.size = 0.7), e.sub && (e.baseline = -0.3, e.size = 0.7);
1002
- var o = n;
1003
- return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (o = w(n, e)), o;
1008
+ var s = n;
1009
+ return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (s = w(n, e)), s;
1004
1010
  }
1005
- function ke(e, n, o) {
1006
- for (var i, c, p = e.width; p + o.width > n && e.length; ) c = (i = e[e.length - 1]).width, i.width > o.width ? (i.value = i.value.slice(0, -1), i.width = z(i, i.font), p += i.width) : e.pop(), p -= c;
1007
- e[e.length - 1] instanceof yt && e.pop(), i = e[e.length - 1] || i || {}, o.font = w(o.font, i.bold, i.italic, ""), o.href = e.length ? i.href : null, o.rel = e.length ? i.rel : null, o.target = e.length ? i.target : null, e.push(o);
1011
+ function ke(e, n, s) {
1012
+ for (var i, c, p = e.width; p + s.width > n && e.length; ) c = (i = e[e.length - 1]).width, i.width > s.width ? (i.value = i.value.slice(0, -1), i.width = z(i, i.font), p += i.width) : e.pop(), p -= c;
1013
+ e[e.length - 1] instanceof yt && e.pop(), i = e[e.length - 1] || i || {}, s.font = w(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);
1008
1014
  }
1009
1015
  function bt(e) {
1010
1016
  return Math.round(1e6 * e) / 1e6;
@@ -1014,11 +1020,11 @@ function cr() {
1014
1020
  if (Array.isArray(n)) return ee(n);
1015
1021
  }(e) || function(n) {
1016
1022
  if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) return Array.from(n);
1017
- }(e) || function(n, o) {
1023
+ }(e) || function(n, s) {
1018
1024
  if (n) {
1019
- if (typeof n == "string") return ee(n, o);
1025
+ if (typeof n == "string") return ee(n, s);
1020
1026
  var i = Object.prototype.toString.call(n).slice(8, -1);
1021
- 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) ? ee(n, o) : void 0;
1027
+ 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) ? ee(n, s) : void 0;
1022
1028
  }
1023
1029
  }(e) || function() {
1024
1030
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
@@ -1027,14 +1033,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1027
1033
  }
1028
1034
  function ee(e, n) {
1029
1035
  (n == null || n > e.length) && (n = e.length);
1030
- for (var o = 0, i = new Array(n); o < n; o++) i[o] = e[o];
1036
+ for (var s = 0, i = new Array(n); s < n; s++) i[s] = e[s];
1031
1037
  return i;
1032
1038
  }
1033
1039
  var _n = { center: "middle", right: "end" }, In = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, ne = function(e, n) {
1034
1040
  return !e && !n || e === n;
1035
1041
  };
1036
1042
  function Dn(e, n) {
1037
- var o = [], i = n.font(), c = i.size, p = i.family, A = n.align(), x = n.createElement();
1043
+ var s = [], i = n.font(), c = i.size, p = i.family, A = n.align(), x = n.createElement();
1038
1044
  if (e.length) {
1039
1045
  var S = i.height, T = n.valign(), M = n.height()(), O = n.width()(0), _ = !isFinite(O) && e.length === 1, L = _ ? null : n.x(), B = bt(S / c), J = _ ? null : bt(S / (1.15 * c + (S - c) / 2));
1040
1046
  if (In[T] && isFinite(M)) {
@@ -1053,24 +1059,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1053
1059
  var at = "", ft = "", ot = 0, lt = e[nt];
1054
1060
  if (lt.length) {
1055
1061
  F = [];
1056
- for (var At = 0, $t = 0, ht = void 0, X = 0, Bt = lt.length; X < Bt; X++) {
1062
+ for (var At = 0, Ct = 0, ht = void 0, X = 0, Bt = lt.length; X < Bt; X++) {
1057
1063
  var U = lt[X], Z = U.font;
1058
- U.whitespace && At++, $t += U.width, X && !U.tracking && !ot && ne(Z.id, at) && ne(U.class, ft) && ne(ht, U.href) ? V += U.value : (I(), V = U.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: U.class || null }, ot && (Y.dx = bt(ot), ot = 0), U.tracking && (ot = Z.size * U.tracking), U.href && !ht ? (ht = U.href, Q = "a", Y.href = ht, Y.rel = U.rel, Y.target = U.target) : ht = null, at = Z.id, ft = U.class);
1064
+ U.whitespace && At++, Ct += U.width, X && !U.tracking && !ot && ne(Z.id, at) && ne(U.class, ft) && ne(ht, U.href) ? V += U.value : (I(), V = U.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: U.class || null }, ot && (Y.dx = bt(ot), ot = 0), U.tracking && (ot = Z.size * U.tracking), U.href && !ht ? (ht = U.href, Q = "a", Y.href = ht, Y.rel = U.rel, Y.target = U.target) : ht = null, at = Z.id, ft = U.class);
1059
1065
  }
1060
- if (I(), _) o.push.apply(o, Se(F));
1066
+ if (I(), _) s.push.apply(s, Se(F));
1061
1067
  else {
1062
1068
  var jt = null, Pt = nt === tt - 1 || lt[lt.length - 1] instanceof et;
1063
- P && lt.length > 1 && !Pt && (jt = bt((O - $t) / At)), o.push(x.apply(void 0, ["tspan", { wordSpacing: jt, x: L(nt) + j, dy: bt(nt ? B : J) + "em" }].concat(Se(F))));
1069
+ P && lt.length > 1 && !Pt && (jt = bt((O - Ct) / At)), s.push(x.apply(void 0, ["tspan", { wordSpacing: jt, x: L(nt) + j, dy: bt(nt ? B : J) + "em" }].concat(Se(F))));
1064
1070
  }
1065
- } else o.push(x("tspan", { x: L(nt), dy: bt(nt ? B : J) + "em" }, " "));
1071
+ } else s.push(x("tspan", { x: L(nt), dy: bt(nt ? B : J) + "em" }, " "));
1066
1072
  }
1067
1073
  }
1068
- return x.apply(void 0, ["text", { fontFamily: p, fontSize: c, textAnchor: _n[A] || "start" }].concat(o));
1074
+ return x.apply(void 0, ["text", { fontFamily: p, fontSize: c, textAnchor: _n[A] || "start" }].concat(s));
1069
1075
  }
1070
1076
  var Mn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 };
1071
- function On(e, n, o) {
1077
+ function On(e, n, s) {
1072
1078
  if (e.length) {
1073
- o.textBaseline = "middle";
1079
+ s.textBaseline = "middle";
1074
1080
  var i = n.font(), c = i.height, p = i.size, A = n.valign(), x = n.height()(), S = n.width()(0), T = n.align(), M = T === "justify", O = 0.5 * c, _ = Mn[A];
1075
1081
  if (_ && isFinite(x)) {
1076
1082
  var L = e.length * c;
@@ -1083,16 +1089,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1083
1089
  });
1084
1090
  var Q = 0, Y = J === e.length - 1 || B[B.length - 1] instanceof et;
1085
1091
  M && B.length > 1 && !Y && (Q = (S - F) / j), B.forEach(function(V) {
1086
- o.font = V.font;
1092
+ s.font = V.font;
1087
1093
  var I = V.font, nt = I.baseline ? p * -I.baseline + 0.15 * p : 0;
1088
- o.fillStyle = function(ft, ot) {
1094
+ s.fillStyle = function(ft, ot) {
1089
1095
  return ft.color ? ft.color : ot.href ? "#00C" : "#000";
1090
1096
  }(I, V);
1091
1097
  var tt = 0;
1092
- if (T === "right" ? tt += S - F : T === "center" ? tt += S / 2 - F / 2 : T === "justify" && (V.whitespace || V instanceof et) && (H += Q), o.fillText(V.value, H + tt, P + nt), V.href) {
1093
- o.beginPath(), o.strokeStyle = o.fillStyle;
1098
+ if (T === "right" ? tt += S - F : T === "center" ? tt += S / 2 - F / 2 : T === "justify" && (V.whitespace || V instanceof et) && (H += Q), s.fillText(V.value, H + tt, P + nt), V.href) {
1099
+ s.beginPath(), s.strokeStyle = s.fillStyle;
1094
1100
  var at = Math.floor(P + 0.45 * p) + 0.5;
1095
- o.moveTo(H + tt, at), o.lineTo(H + tt + V.width, at), o.stroke();
1101
+ s.moveTo(H + tt, at), s.lineTo(H + tt + V.width, at), s.stroke();
1096
1102
  }
1097
1103
  H += V.width;
1098
1104
  });
@@ -1107,8 +1113,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1107
1113
  }, re(e);
1108
1114
  }
1109
1115
  function Te(e) {
1110
- for (var n = {}, o = 0; o < e.length; o++) {
1111
- var i = e[o];
1116
+ for (var n = {}, s = 0; s < e.length; s++) {
1117
+ var i = e[s];
1112
1118
  typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : re(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));
1113
1119
  }
1114
1120
  return n;
@@ -1121,8 +1127,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1121
1127
  }, Lt(e);
1122
1128
  }
1123
1129
  function Ln(e, n) {
1124
- for (var o = 0; o < n.length; o++) {
1125
- var i = n[o];
1130
+ for (var s = 0; s < n.length; s++) {
1131
+ var i = n[s];
1126
1132
  i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, A) {
1127
1133
  if (Lt(p) !== "object" || p === null) return p;
1128
1134
  var x = p[Symbol.toPrimitive];
@@ -1136,7 +1142,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1136
1142
  }
1137
1143
  var c;
1138
1144
  }
1139
- var Cn = w(), ie = function(e) {
1145
+ var $n = w(), ie = function(e) {
1140
1146
  return typeof e == "function" ? e : function() {
1141
1147
  return e;
1142
1148
  };
@@ -1152,15 +1158,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1152
1158
  return 0;
1153
1159
  }, font: null, tAnchor: 0, parser: e.defaultparser }, i) for (var c in i) typeof this[c] == "function" && this[c](i[c]);
1154
1160
  }
1155
- var n, o;
1156
- return n = e, o = [{ key: "linebreak", value: function(i) {
1161
+ var n, s;
1162
+ return n = e, s = [{ key: "linebreak", value: function(i) {
1157
1163
  var c = this, p = this.props.parser(String(i)), A = this.font(), x = function(S, T, M) {
1158
1164
  if (!S.length) return [];
1159
1165
  var O = T.height(), _ = T.width(), L = T.overflowLine(), B = T.overflowWrap(), J = w(M, !0, !1), H = isFinite(O()) ? Math.floor(O() / M.height) : 1 / 0;
1160
1166
  if (!O() && !_(0) || !H) return [];
1161
1167
  for (var P = 0, j = 0, F = 0, Q = [], Y = [], V = !1; P < S.length && j < H; ) {
1162
1168
  var I = S[P], nt = Tn(I, M);
1163
- if (I.width = z(I, nt), I.font = nt, I.line = j, I.whitespace = I.value in $, I.value && (I.value = I.value.replace(Sn, " ")), !(!F && I.whitespace || V && I.whitespace)) if (I instanceof et) F = 0, Y = [], Q.push(P + 1), j++;
1169
+ if (I.width = z(I, nt), I.font = nt, I.line = j, I.whitespace = I.value in C, I.value && (I.value = I.value.replace(Sn, " ")), !(!F && I.whitespace || V && I.whitespace)) if (I instanceof et) F = 0, Y = [], Q.push(P + 1), j++;
1164
1170
  else if (I instanceof Ot || I instanceof yt) Y.push({ index: P, width: F });
1165
1171
  else if (I.whitespace || F + I.width < _(j)) F += I.width;
1166
1172
  else if (Y.length) {
@@ -1185,10 +1191,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1185
1191
  P++, V = I.whitespace;
1186
1192
  }
1187
1193
  P !== Q[Q.length - 1] && Q.push(P);
1188
- var $t = 0, ht = 0, X = Q.map(function(mt) {
1189
- for (var K, vt = $t; (K = S[vt]) && (K.whitespace || !K.value); ) vt++;
1194
+ var Ct = 0, ht = 0, X = Q.map(function(mt) {
1195
+ for (var K, vt = Ct; (K = S[vt]) && (K.whitespace || !K.value); ) vt++;
1190
1196
  for (var pt = mt, ae = null; pt > vt && (K = S[pt - 1]) && (K.whitespace || !(K.value || K instanceof yt)); ) K instanceof et && (ae = K), pt--;
1191
- K instanceof yt && (K.value = "-", K.width = z("-", K.font)), $t = mt;
1197
+ K instanceof yt && (K.value = "-", K.width = z("-", K.font)), Ct = mt;
1192
1198
  var Et = S.slice(vt, pt).filter(function(le) {
1193
1199
  return le.value;
1194
1200
  });
@@ -1217,7 +1223,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1217
1223
  return c.render(x, S);
1218
1224
  }, x.svg = x.render, x.draw = x.render, x;
1219
1225
  } }, { key: "font", value: function(i) {
1220
- return arguments.length ? (this.props.font = w(i), this) : this.props.font || w(Cn);
1226
+ return arguments.length ? (this.props.font = w(i), this) : this.props.font || w($n);
1221
1227
  } }, { key: "overflow", value: function(i) {
1222
1228
  return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
1223
1229
  } }, { key: "overflowLine", value: function(i) {
@@ -1251,33 +1257,33 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1251
1257
  } }, { key: "render", value: function() {
1252
1258
  var i = Te(arguments);
1253
1259
  return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? On(i.text, this, i.ctx) : Dn(i.text, this);
1254
- } }], o && Ln(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1260
+ } }], s && Ln(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1255
1261
  }();
1256
- function Ct(e) {
1257
- return Ct = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1262
+ function $t(e) {
1263
+ return $t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
1258
1264
  return typeof n;
1259
1265
  } : function(n) {
1260
1266
  return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
1261
- }, Ct(e);
1267
+ }, $t(e);
1262
1268
  }
1263
1269
  function se(e, n) {
1264
1270
  (n == null || n > e.length) && (n = e.length);
1265
- for (var o = 0, i = new Array(n); o < n; o++) i[o] = e[o];
1271
+ for (var s = 0, i = new Array(n); s < n; s++) i[s] = e[s];
1266
1272
  return i;
1267
1273
  }
1268
- function $n(e, n) {
1269
- for (var o = 0; o < n.length; o++) {
1270
- var i = n[o];
1274
+ function Cn(e, n) {
1275
+ for (var s = 0; s < n.length; s++) {
1276
+ var i = n[s];
1271
1277
  i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, A) {
1272
- if (Ct(p) !== "object" || p === null) return p;
1278
+ if ($t(p) !== "object" || p === null) return p;
1273
1279
  var x = p[Symbol.toPrimitive];
1274
1280
  if (x !== void 0) {
1275
1281
  var S = x.call(p, A);
1276
- if (Ct(S) !== "object") return S;
1282
+ if ($t(S) !== "object") return S;
1277
1283
  throw new TypeError("@@toPrimitive must return a primitive value.");
1278
1284
  }
1279
1285
  return String(p);
1280
- }(i.key, "string"), Ct(c) === "symbol" ? c : String(c)), i);
1286
+ }(i.key, "string"), $t(c) === "symbol" ? c : String(c)), i);
1281
1287
  }
1282
1288
  var c;
1283
1289
  }
@@ -1296,8 +1302,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1296
1302
  }, rotation: 0, vAnchor: 0, hAnchor: 0 }, i) for (var c in i) typeof this[c] == "function" && this[c](i[c]);
1297
1303
  this.render = this.render.bind(this);
1298
1304
  }
1299
- var n, o;
1300
- return n = e, o = [{ key: "anchor", value: function(i) {
1305
+ var n, s;
1306
+ return n = e, s = [{ key: "anchor", value: function(i) {
1301
1307
  var c = this.props, p = c.hAnchor, A = c.vAnchor, x = c.width, S = c.height;
1302
1308
  if (!arguments.length) return [p * x(0), A * S(0)];
1303
1309
  if (typeof i == "string") {
@@ -1339,32 +1345,32 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1339
1345
  var c = typeof i.text.render == "function" ? i.text.render() : i.text;
1340
1346
  return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
1341
1347
  }
1342
- } }], o && $n(n.prototype, o), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1348
+ } }], s && Cn(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
1343
1349
  }(), Pn = Object.prototype.hasOwnProperty, oe = {};
1344
1350
  function zn(e) {
1345
- return oe[e] || (oe[e] = e.replace(/([a-z])([A-Z])/g, function(n, o, i) {
1346
- return o + "-" + i.toLowerCase();
1351
+ return oe[e] || (oe[e] = e.replace(/([a-z])([A-Z])/g, function(n, s, i) {
1352
+ return s + "-" + i.toLowerCase();
1347
1353
  })), oe[e];
1348
1354
  }
1349
1355
  function De(e, n) {
1350
- if (Array.isArray(n)) return n.forEach(function(o) {
1351
- return De(e, o);
1356
+ if (Array.isArray(n)) return n.forEach(function(s) {
1357
+ return De(e, s);
1352
1358
  });
1353
1359
  typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
1354
1360
  }
1355
1361
  function Me(e, n) {
1356
1362
  if (typeof document < "u") {
1357
- var o = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
1358
- if (n && o.setAttribute) for (var i in n) Pn.call(n, i) && n[i] != null && o.setAttribute(i === "className" ? "class" : zn(i), n[i]);
1363
+ var s = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
1364
+ if (n && s.setAttribute) for (var i in n) Pn.call(n, i) && n[i] != null && s.setAttribute(i === "className" ? "class" : zn(i), n[i]);
1359
1365
  for (var c = arguments.length, p = new Array(c > 2 ? c - 2 : 0), A = 2; A < c; A++) p[A - 2] = arguments[A];
1360
1366
  return p != null && p.length && p.forEach(function(x) {
1361
- De(o, x);
1362
- }), o;
1367
+ De(s, x);
1368
+ }), s;
1363
1369
  }
1364
1370
  }
1365
1371
  it.createElement = Me, it.textparser = qt, it.defaultparser = qt, it.htmlparser = function(e) {
1366
1372
  e = String(e || "").trim();
1367
- for (var n, o, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], p = [], A = function(O) {
1373
+ for (var n, s, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], p = [], A = function(O) {
1368
1374
  for (var _ in i) i[_] && (O[_] = i[_]);
1369
1375
  c.push(O);
1370
1376
  }, x = function(O) {
@@ -1381,7 +1387,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1381
1387
  var S = n[1];
1382
1388
  x(S), p.push(i), i = Object.create(i), be[S] && be[S](i, "");
1383
1389
  var T = vn(n[2]);
1384
- S === "a" && (T.href && (i.href = T.href), T.rel && (i.rel = T.rel), T.target && (i.target = T.target)), T.class && (i.class = i.class ? i.class + " " + T.class : T.class), T.style && (o = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(T.style)) && o[1] && (i.color = o[1]), S === "br" && c.push(new et());
1390
+ S === "a" && (T.href && (i.href = T.href), T.rel && (i.rel = T.rel), T.target && (i.target = T.target)), T.class && (i.class = i.class ? i.class + " " + T.class : T.class), T.style && (s = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(T.style)) && s[1] && (i.color = s[1]), S === "br" && c.push(new et());
1385
1391
  } else n = [e.slice(0, 1)], A(new q(n[0]));
1386
1392
  e = e.slice(n[0].length);
1387
1393
  }
@@ -1405,7 +1411,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1405
1411
  }).replace(/\\verb,(.*?),/, function(H, P) {
1406
1412
  return "\\verb,".concat(n[+P], ",");
1407
1413
  });
1408
- for (var o, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], p = [], A = function(H) {
1414
+ for (var s, i = { weight: null, italic: null, variant: null, sub: !1, sup: !1, href: null }, c = [], p = [], A = function(H) {
1409
1415
  for (var P in i) i[P] && (H[P] = i[P]);
1410
1416
  return c.push(H), H;
1411
1417
  }, x = function() {
@@ -1414,14 +1420,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1414
1420
  if (!p.length) throw new Error("Unexpected }");
1415
1421
  i = p.pop();
1416
1422
  }, T = { tokens: c, open_context: x, close_context: S, add_token: A }; e.length; ) {
1417
- if (o = bn.exec(e)) qt(o[0], !1).forEach(A);
1418
- else if (o = An.exec(e)) A(new q(o[1]));
1419
- else if (!(o = wn.exec(e))) {
1420
- if (o = /^\{/.exec(e)) x();
1421
- else if (o = /^\}/.exec(e)) S();
1422
- else if (!(o = /^\$/.exec(e))) if (o = /^\\verb,([^,]+),/.exec(e)) A(new q(o[1]));
1423
- else if (o = xn.exec(e)) {
1424
- var M = o[1].slice(1) || o[1], O = !!o[2];
1423
+ if (s = bn.exec(e)) qt(s[0], !1).forEach(A);
1424
+ else if (s = An.exec(e)) A(new q(s[1]));
1425
+ else if (!(s = wn.exec(e))) {
1426
+ if (s = /^\{/.exec(e)) x();
1427
+ else if (s = /^\}/.exec(e)) S();
1428
+ else if (!(s = /^\$/.exec(e))) if (s = /^\\verb,([^,]+),/.exec(e)) A(new q(s[1]));
1429
+ else if (s = xn.exec(e)) {
1430
+ var M = s[1].slice(1) || s[1], O = !!s[2];
1425
1431
  if (/^(La)?TeX$/i.test(M)) {
1426
1432
  x(), i.family = "serif";
1427
1433
  var _ = void 0;
@@ -1430,42 +1436,42 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1430
1436
  else if (M in G) {
1431
1437
  var L = [], B = G[M].length - 1, J = void 0;
1432
1438
  if (B) {
1433
- for (O = !1, e = e.slice(o[0].length - 1); B--; ) {
1439
+ for (O = !1, e = e.slice(s[0].length - 1); B--; ) {
1434
1440
  if (!(J = /^\{([^}]+)\}/.exec(e))) throw new Error(M + " is missing an argument");
1435
1441
  L.push(J[1]), e = e.slice(J[0].length);
1436
1442
  }
1437
- o[0] = /^\{/.exec(e) ? "{" : "", O = !!o[0];
1443
+ s[0] = /^\{/.exec(e) ? "{" : "", O = !!s[0];
1438
1444
  }
1439
1445
  O && x(), G[M].apply(T, [i].concat(L));
1440
- } else console.warn("unknown latex command", M), A(new q(o[1])), O && x();
1441
- } else o = [e.slice(0, 1)], A(new q(o[0]));
1446
+ } else console.warn("unknown latex command", M), A(new q(s[1])), O && x();
1447
+ } else s = [e.slice(0, 1)], A(new q(s[0]));
1442
1448
  }
1443
- e = e.slice(o[0].length);
1449
+ e = e.slice(s[0].length);
1444
1450
  }
1445
1451
  return c;
1446
- }, it.measureText = function(e, n, o) {
1447
- return z(e, w(n), o);
1452
+ }, it.measureText = function(e, n, s) {
1453
+ return z(e, w(n), s);
1448
1454
  }, it.Token = q, it.Break = Ot, it.LineBreak = et, it.SoftHyphen = yt, it.Rotator = Ie, Ie.createElement = Me;
1449
1455
  const Nn = it;
1450
1456
  return r.default;
1451
1457
  })());
1452
1458
  }(Yt)), Yt.exports;
1453
1459
  }
1454
- var ur = cr();
1455
- const Be = /* @__PURE__ */ en(ur);
1460
+ var cr = hr();
1461
+ const Be = /* @__PURE__ */ en(cr);
1456
1462
  function ue(a) {
1457
1463
  return a.replace(/…$/, "");
1458
1464
  }
1459
1465
  function de(a) {
1460
1466
  return a.children[0].innerHTML;
1461
1467
  }
1462
- function dr(a, l) {
1463
- const t = ut(a), { fontSize: r, font: s, padding: h = 0 } = a.properties.style || {};
1468
+ function ur(a, h) {
1469
+ const t = ut(a), { fontSize: r, font: o, padding: l = 0 } = a.properties.style || {};
1464
1470
  if (t.width === t.height && t.width === 0) return;
1465
1471
  const u = new Be({
1466
- font: `${r}px/${r}px ${s}`.replace(/(px)+/g, "px"),
1467
- width: t.width - h * 2,
1468
- height: t.height - h * 2,
1472
+ font: `${r}px/${r}px ${o}`.replace(/(px)+/g, "px"),
1473
+ width: t.width - l * 2,
1474
+ height: t.height - l * 2,
1469
1475
  align: "left",
1470
1476
  valign: "top",
1471
1477
  x: 0,
@@ -1482,39 +1488,39 @@ function dr(a, l) {
1482
1488
  const v = [];
1483
1489
  a.properties.content.split(`
1484
1490
  `).forEach((w) => {
1485
- let $ = w;
1486
- for (; $.length && y < f.length; ) {
1491
+ let C = w;
1492
+ for (; C.length && y < f.length; ) {
1487
1493
  if (f[y].innerHTML === "&nbsp;") {
1488
- $.startsWith(`
1494
+ C.startsWith(`
1489
1495
  `) || v.push(y), y++;
1490
1496
  break;
1491
1497
  }
1492
1498
  const E = ue(de(f[y]));
1493
- $.startsWith(E) && ($ = $.slice(E.length).trim()), y++;
1499
+ C.startsWith(E) && (C = C.slice(E.length).trim()), y++;
1494
1500
  }
1495
1501
  }), v.forEach((w) => g.removeChild(f[w]));
1496
1502
  const k = a.properties.content.match(/(https?:\/\/.*)/gm), b = k ? k.map((w) => w.split(" ")[0]) : [];
1497
- g.setAttribute("transform", `translate(${h}, ${h})`), b.forEach((w) => {
1498
- let $ = w;
1503
+ g.setAttribute("transform", `translate(${l}, ${l})`), b.forEach((w) => {
1504
+ let C = w;
1499
1505
  const E = [];
1500
- for (; $.length > 0; ) {
1501
- const C = f.find(
1502
- (D) => !!D.children[0] && D.children[0].tagName === "tspan" && $.startsWith(ue(de(D)))
1506
+ for (; C.length > 0; ) {
1507
+ const $ = f.find(
1508
+ (D) => !!D.children[0] && D.children[0].tagName === "tspan" && C.startsWith(ue(de(D)))
1503
1509
  );
1504
- if (!C) break;
1505
- E.push(C);
1506
- const N = ue(C.children[0].innerHTML).length;
1510
+ if (!$) break;
1511
+ E.push($);
1512
+ const N = ue($.children[0].innerHTML).length;
1507
1513
  if (!N) break;
1508
- $ = $.slice(N);
1514
+ C = C.slice(N);
1509
1515
  }
1510
- E.forEach((C) => {
1516
+ E.forEach(($) => {
1511
1517
  const N = document.createElementNS("http://www.w3.org/2000/svg", "a");
1512
- N.setAttribute("href", w), N.setAttribute("target", "_blank"), N.innerHTML = de(C), C.children[0].innerHTML = "", C.children[0].appendChild(N);
1518
+ N.setAttribute("href", w), N.setAttribute("target", "_blank"), N.innerHTML = de($), $.children[0].innerHTML = "", $.children[0].appendChild(N);
1513
1519
  });
1514
- }), l.appendChild(g);
1520
+ }), h.appendChild(g);
1515
1521
  }
1516
1522
  const je = 20;
1517
- class fr extends rn {
1523
+ class dr extends rn {
1518
1524
  constructor(t, r = {}) {
1519
1525
  super(
1520
1526
  t,
@@ -1548,25 +1554,25 @@ class fr extends rn {
1548
1554
  m(this, "_onBlur", () => {
1549
1555
  this.isFocused = !1;
1550
1556
  });
1551
- m(this, "startDrawing", (t, r, s = lr(t, r, 0, 0, "", _t)) => {
1552
- this.add(s);
1553
- const h = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
1554
- this.select(s.id), this.startDragging(this.getById(s.id), h.x, h.y), this.draggedHandle = 6;
1557
+ m(this, "startDrawing", (t, r, o = ar(t, r, 0, 0, "", _t)) => {
1558
+ this.add(o);
1559
+ const l = this.ogma.view.graphToScreenCoordinates({ x: t, y: r });
1560
+ this.select(o.id), this.startDragging(this.getById(o.id), l.x, l.y), this.draggedHandle = 6;
1555
1561
  });
1556
1562
  m(this, "cancelDrawing", () => {
1557
1563
  this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...ce }, this.draggedHandle = W, this.isDragging = !1, this.emit(It, this.annotation));
1558
1564
  });
1559
- m(this, "startDragging", (t, r, s) => {
1565
+ m(this, "startDragging", (t, r, o) => {
1560
1566
  this.annotation = t;
1561
- const h = ct(this.annotation), u = ut(this.annotation);
1562
- 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 = s, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Jt, this.annotation), this.isDragging = !0;
1567
+ const l = ct(this.annotation), u = ut(this.annotation);
1568
+ this.rect.x = l.x, this.rect.y = l.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(Jt, this.annotation), this.isDragging = !0;
1563
1569
  });
1564
1570
  m(this, "onHandleMouseDown", (t) => {
1565
1571
  const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
1566
1572
  if (!r) return;
1567
1573
  this.selectedId !== r.id && this.select(this.hoveredId);
1568
- const { x: s, y: h } = fe(t, this.ogma.getContainer());
1569
- this.startDragging(r, s, h), this.draggedHandle = Ze(t.target);
1574
+ const { x: o, y: l } = fe(t, this.ogma.getContainer());
1575
+ this.startDragging(r, o, l), this.draggedHandle = Ze(t.target);
1570
1576
  });
1571
1577
  m(this, "onMouseMove", (t) => {
1572
1578
  requestAnimationFrame(() => this._onMouseMove(t));
@@ -1575,17 +1581,17 @@ class fr extends rn {
1575
1581
  if (!this.isDragging) return;
1576
1582
  t.stopPropagation(), t.preventDefault();
1577
1583
  const r = this.handles[this.draggedHandle];
1578
- let s = r.classList.contains("top");
1579
- const h = r.classList.contains("left"), u = r.classList.contains("right"), d = r.classList.contains("bottom");
1584
+ let o = r.classList.contains("top");
1585
+ const l = r.classList.contains("left"), u = r.classList.contains("right"), d = r.classList.contains("bottom");
1580
1586
  let g = r.classList.contains("line-handle");
1581
- !g && !s && !d && !h && !u && (s = !0, g = !0);
1587
+ !g && !o && !d && !l && !u && (o = !0, g = !0);
1582
1588
  const { x: f, y } = fe(
1583
1589
  t,
1584
1590
  this.ogma.getContainer()
1585
1591
  );
1586
1592
  let v = this.rect.x, k = this.rect.y, b = Math.max(this.rect.width, je), w = Math.max(this.rect.height, je);
1587
- const $ = this.ogma.view.getZoom(), E = (f - this.startX) / $, C = (y - this.startY) / $, N = this.ogma.view.getAngle(), D = rt({ x: E, y: C }, N), z = rt({ x: E, y: C }, -N);
1588
- g ? (v = this.rect.x + D.x, k = this.rect.y + D.y) : h && s ? (v += D.x, k += D.y, b -= E, w -= C) : u && d ? (b += E, w += C) : h && d ? (v += z.x, b -= z.x, w += z.y) : u && s && (k += z.y, b += z.x, w -= z.y), Vn(this.annotation, v, k, b, w), this.emit(Kt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
1593
+ const C = this.ogma.view.getZoom(), E = (f - this.startX) / C, $ = (y - this.startY) / C, N = this.ogma.view.getAngle(), D = rt({ x: E, y: $ }, N), z = rt({ x: E, y: $ }, -N);
1594
+ g ? (v = this.rect.x + D.x, k = this.rect.y + D.y) : l && o ? (v += D.x, k += D.y, b -= E, w -= $) : u && d ? (b += E, w += $) : l && d ? (v += z.x, b -= z.x, w += z.y) : u && o && (k += z.y, b += z.x, w -= z.y), Vn(this.annotation, v, k, b, w), this.emit(Kt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
1589
1595
  });
1590
1596
  m(this, "onMouseUp", () => {
1591
1597
  !this.isDragging || this.draggedHandle === W || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(It, this.annotation), this.isDragging = !1, this.draggedHandle = W);
@@ -1595,33 +1601,33 @@ class fr extends rn {
1595
1601
  });
1596
1602
  m(this, "onViewChanged", () => {
1597
1603
  const t = Math.max(2, this.handleSize / this.ogma.view.getZoom());
1598
- document.documentElement.style.setProperty("--handle-scale", `${1 / t}`);
1604
+ document.documentElement.style.setProperty("--handle-scale", `${1 / t}`), this.ogma.view.getAngle() === 0 ? this.editor.element.classList.remove("rotated") : this.editor.element.classList.add("rotated");
1599
1605
  });
1600
1606
  m(this, "_onInput", () => {
1601
1607
  const t = this.getById(this.selectedId);
1602
1608
  t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(ve, t), this.layer.refresh());
1603
1609
  });
1604
1610
  this.showeditorOnHover = !1, this.handleSize = Re.handleSize || r.textHandleSize, this.placeholder = Re.placeholder || r.textPlaceholder || "";
1605
- const s = this.textArea = this.editor.element.querySelector("textarea");
1606
- s.addEventListener("input", this._onInput), s.addEventListener("focus", this._onFocus), s.addEventListener("blur", this._onBlur), s.addEventListener("mousedown", this._onMousedown), s.spellcheck = !1, this.handles = Array.prototype.slice.call(
1611
+ const o = this.textArea = this.editor.element.querySelector("textarea");
1612
+ 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(
1607
1613
  this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
1608
1614
  ), this.handles.push(this.editor.element), this.handles.forEach(
1609
- (h) => h.addEventListener("mousedown", this.onHandleMouseDown)
1615
+ (l) => l.addEventListener("mousedown", this.onHandleMouseDown)
1610
1616
  ), document.addEventListener("mouseup", this.onMouseUp), document.addEventListener("mousemove", this.onMouseMove, !0), t.events.on(["viewChanged", "zoom"], this.onViewChanged);
1611
1617
  }
1612
1618
  _canRemove() {
1613
1619
  return !this.isFocused;
1614
1620
  }
1615
- detect({ x: t, y: r }, s = 0) {
1616
- const h = { x: t, y: r }, u = this.ogma.view.getAngle();
1621
+ detect({ x: t, y: r }, o = 0) {
1622
+ const l = { x: t, y: r }, u = this.ogma.view.getAngle();
1617
1623
  return this.elements.find((d) => {
1618
- const { x: g, y: f } = ct(d), { width: y, height: v } = ut(d), k = { x: g, y: f }, { x: b, y: w } = rt(wt(h, k), -u);
1619
- return b > -s && b < y + s && w > -s && w < v + s;
1624
+ const { x: g, y: f } = ct(d), { width: y, height: v } = ut(d), k = { x: g, y: f }, { x: b, y: w } = rt(wt(l, k), -u);
1625
+ return b > -o && b < y + o && w > -o && w < v + o;
1620
1626
  });
1621
1627
  }
1622
1628
  draw(t) {
1623
1629
  t.innerHTML = "";
1624
- const r = "", s = this.ogma.view.getAngle();
1630
+ const r = "", o = this.ogma.view.getAngle();
1625
1631
  for (let u = 0; u < this.elements.length; u++) {
1626
1632
  const d = this.elements[u], g = `class${u}`, f = ut(d), y = ct(d);
1627
1633
  if (d.id === this.selectedId) continue;
@@ -1629,9 +1635,9 @@ class fr extends rn {
1629
1635
  color: k,
1630
1636
  fontSize: b,
1631
1637
  font: w,
1632
- strokeColor: $,
1638
+ strokeColor: C,
1633
1639
  strokeWidth: E,
1634
- strokeType: C,
1640
+ strokeType: $,
1635
1641
  background: N,
1636
1642
  borderRadius: D
1637
1643
  } = d.properties.style || _t, z = xt("g");
@@ -1639,20 +1645,20 @@ class fr extends rn {
1639
1645
  const R = xt("rect");
1640
1646
  D && (R.setAttribute("rx", `${D}`), R.setAttribute("ry", `${D}`));
1641
1647
  let dt = !1;
1642
- C && C !== "none" && (dt = !0, R.setAttribute("stroke", $ || "black"), R.setAttribute("stroke-width", `${E}`), C === "dashed" && R.setAttribute("stroke-dasharray", "5,5")), (N && N.length || dt) && (dt = !0, R.setAttribute("fill", N || "transparent")), dt && (R.setAttribute("width", `${f.width}`), R.setAttribute("height", `${f.height}`)), z.appendChild(R), dr(d, z);
1643
- const { x: Dt, y: Mt } = rt(y, -s);
1648
+ $ && $ !== "none" && (dt = !0, R.setAttribute("stroke", C || "black"), R.setAttribute("stroke-width", `${E}`), $ === "dashed" && R.setAttribute("stroke-dasharray", "5,5")), (N && N.length || dt) && (dt = !0, R.setAttribute("fill", N || "transparent")), dt && (R.setAttribute("width", `${f.width}`), R.setAttribute("height", `${f.height}`)), z.appendChild(R), ur(d, z);
1649
+ const { x: Dt, y: Mt } = rt(y, -o);
1644
1650
  z.setAttribute("transform", `translate(${Dt},${Mt})`), z.classList.add(g), z.setAttribute("data-annotation", `${d.id}`), z.setAttribute("data-annotation-type", "text"), t.appendChild(z);
1645
1651
  }
1646
- const h = xt("style");
1647
- h.innerHTML = r, t.firstChild && t.insertBefore(h, t.firstChild);
1652
+ const l = xt("style");
1653
+ l.innerHTML = r, t.firstChild && t.insertBefore(l, t.firstChild);
1648
1654
  }
1649
1655
  refreshDrawing() {
1650
1656
  const t = this.ogma.view.getAngle(), r = this.layer.element.children;
1651
- for (let s = 0; s < r.length; s++) {
1652
- const h = r[s];
1653
- if (!h.hasAttribute("data-annotation")) continue;
1654
- const u = h.getAttribute("data-annotation"), d = ct(this.getById(u)), { x: g, y: f } = rt(d, -t);
1655
- h.setAttribute("transform", `translate(${g},${f})`);
1657
+ for (let o = 0; o < r.length; o++) {
1658
+ const l = r[o];
1659
+ if (!l.hasAttribute("data-annotation")) continue;
1660
+ const u = l.getAttribute("data-annotation"), d = ct(this.getById(u)), { x: g, y: f } = rt(d, -t);
1661
+ l.setAttribute("transform", `translate(${g},${f})`);
1656
1662
  }
1657
1663
  }
1658
1664
  getDefaultOptions() {
@@ -1660,20 +1666,20 @@ class fr extends rn {
1660
1666
  }
1661
1667
  refreshEditor() {
1662
1668
  if (+this.selectedId < 0 && +this.hoveredId < 0) return;
1663
- const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), s = this.ogma.view.graphToScreenCoordinates(
1669
+ const t = this.getById(this.selectedId) || this.getById(this.hoveredId), r = ut(t), o = this.ogma.view.graphToScreenCoordinates(
1664
1670
  ct(t)
1665
- ), h = this.ogma.view.getZoom(), {
1671
+ ), l = this.ogma.view.getZoom(), {
1666
1672
  font: u,
1667
1673
  fontSize: d,
1668
1674
  color: g,
1669
1675
  background: f,
1670
1676
  padding: y = 0
1671
- } = t.properties.style || _t, v = (d || 1) * h;
1677
+ } = t.properties.style || _t, v = (d || 1) * l;
1672
1678
  this.textArea.value = t.properties.content;
1673
1679
  const k = this.editor.element.style;
1674
- k.transform = `translate(${s.x}px, ${s.y}px)translate(-50%, -50%)translate(${r.width / 2 * h}px, ${r.height / 2 * h}px)`, k.width = `${r.width * h}px`, k.height = `${r.height * h}px`;
1680
+ k.transform = `translate(${o.x}px, ${o.y}px)translate(-50%, -50%)translate(${r.width / 2 * l}px, ${r.height / 2 * l}px)`, k.width = `${r.width * l}px`, k.height = `${r.height * l}px`;
1675
1681
  const b = this.textArea.style;
1676
- b.font = `${v} ${u}`, b.fontFamily = u || "sans-serif", b.fontSize = `${v}px`, b.padding = `${h * y}px`, b.lineHeight = `${v}px`, b.boxSizing = "border-box", b.color = g || "black", b.background = f || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
1682
+ b.font = `${v} ${u}`, b.fontFamily = u || "sans-serif", b.fontSize = `${v}px`, b.padding = `${l * y}px`, b.lineHeight = `${v}px`, b.boxSizing = "border-box", b.color = g || "black", b.background = f || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
1677
1683
  }
1678
1684
  select(t) {
1679
1685
  super.select(t), this.textArea.classList.add("noevents");
@@ -1682,61 +1688,61 @@ class fr extends rn {
1682
1688
  super.destroy(), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("mousemove", this.onMouseMove, !0), this.ogma.events.off(this.onViewChanged);
1683
1689
  }
1684
1690
  }
1685
- class pr {
1691
+ class fr {
1686
1692
  constructor() {
1687
1693
  m(this, "links", {});
1688
1694
  m(this, "linksByTargetId", {});
1689
1695
  m(this, "linksByArrowId", {});
1690
1696
  }
1691
- add(l, t, r, s, h) {
1692
- const u = Qt(), d = l.id, g = {
1697
+ add(h, t, r, o, l) {
1698
+ const u = Qt(), d = h.id, g = {
1693
1699
  id: u,
1694
1700
  arrow: d,
1695
1701
  target: r,
1696
- targetType: s,
1697
- connectionPoint: h,
1702
+ targetType: o,
1703
+ connectionPoint: l,
1698
1704
  side: t
1699
1705
  };
1700
- 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] = {
1706
+ 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, h.properties.link = h.properties.link || {}, h.properties.link[t] = {
1701
1707
  id: r,
1702
1708
  side: t,
1703
- type: s,
1704
- magnet: h
1709
+ type: o,
1710
+ magnet: l
1705
1711
  }, this;
1706
1712
  }
1707
- arrowIsLinked(l, t) {
1713
+ arrowIsLinked(h, t) {
1708
1714
  var r;
1709
- return !!((r = this.linksByArrowId[l]) != null && r[t]);
1715
+ return !!((r = this.linksByArrowId[h]) != null && r[t]);
1710
1716
  }
1711
1717
  // remove the link between the arrow and the target by arrow id and side
1712
- remove(l, t) {
1718
+ remove(h, t) {
1713
1719
  var d, g;
1714
- const r = l.id, s = (d = this.linksByArrowId[r]) == null ? void 0 : d[t];
1715
- if ((g = l.properties.link) == null || delete g[t], !s) return this;
1716
- const h = this.links[s];
1717
- delete this.links[s];
1718
- const u = this.linksByTargetId[h.target];
1720
+ const r = h.id, o = (d = this.linksByArrowId[r]) == null ? void 0 : d[t];
1721
+ if ((g = h.properties.link) == null || delete g[t], !o) return this;
1722
+ const l = this.links[o];
1723
+ delete this.links[o];
1724
+ const u = this.linksByTargetId[l.target];
1719
1725
  for (let f = 0; f < u.length; f++)
1720
- if (u[f] === s) {
1726
+ if (u[f] === o) {
1721
1727
  u.splice(f, 1);
1722
1728
  break;
1723
1729
  }
1724
1730
  return delete this.linksByArrowId[r][t], this;
1725
1731
  }
1726
- getArrowLink(l, t) {
1727
- var s;
1728
- const r = (s = this.linksByArrowId[l]) == null ? void 0 : s[t];
1732
+ getArrowLink(h, t) {
1733
+ var o;
1734
+ const r = (o = this.linksByArrowId[h]) == null ? void 0 : o[t];
1729
1735
  return r ? this.links[r] : null;
1730
1736
  }
1731
- getTargetLinks(l, t) {
1737
+ getTargetLinks(h, t) {
1732
1738
  var r;
1733
- return ((r = this.linksByTargetId[l]) == null ? void 0 : r.map((s) => this.links[s]).filter((s) => s.targetType === t)) ?? [];
1739
+ return ((r = this.linksByTargetId[h]) == null ? void 0 : r.map((o) => this.links[o]).filter((o) => o.targetType === t)) ?? [];
1734
1740
  }
1735
- forEach(l) {
1736
- Object.values(this.links).forEach(l);
1741
+ forEach(h) {
1742
+ Object.values(this.links).forEach(h);
1737
1743
  }
1738
1744
  }
1739
- const st = (a) => a.properties.type === "arrow", gt = (a) => a.properties.type === "text", Ve = (a) => a.type === "FeatureCollection", gr = {
1745
+ const st = (a) => a.properties.type === "arrow", gt = (a) => a.properties.type === "text", Ve = (a) => a.type === "FeatureCollection", pr = {
1740
1746
  magnetColor: "#3e8",
1741
1747
  detectMargin: 20,
1742
1748
  magnetHandleRadius: 5,
@@ -1761,7 +1767,7 @@ class vr extends nn {
1761
1767
  super();
1762
1768
  m(this, "arrows");
1763
1769
  m(this, "texts");
1764
- m(this, "links", new pr());
1770
+ m(this, "links", new fr());
1765
1771
  m(this, "layer");
1766
1772
  m(this, "annotations");
1767
1773
  m(this, "ogma");
@@ -1776,31 +1782,31 @@ class vr extends nn {
1776
1782
  if (!this.dragged || this.textToMagnet === void 0) return;
1777
1783
  t.beginPath(), t.fillStyle = "green";
1778
1784
  const r = this.ogma.view.getZoom();
1779
- We.forEach((s) => {
1785
+ We.forEach((o) => {
1780
1786
  if (!this.textToMagnet) return;
1781
- const h = ut(this.textToMagnet), u = ct(this.textToMagnet), d = Wt(s, { x: h.width, y: h.height }), g = rt(d, this.ogma.view.getAngle()), { x: f, y } = St(g, u);
1787
+ const l = ut(this.textToMagnet), u = ct(this.textToMagnet), d = Wt(o, { x: l.width, y: l.height }), g = rt(d, this.ogma.view.getAngle()), { x: f, y } = St(g, u);
1782
1788
  t.moveTo(f, y), t.arc(f, y, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
1783
1789
  }), t.fill(), t.closePath();
1784
1790
  });
1785
1791
  m(this, "_onFeatureDrag", (t, r) => {
1786
- const s = r;
1787
- if (st(t) && s === "line")
1788
- ["start", "end"].find((h) => {
1789
- const u = h === "start" ? zt(t) : Xt(t);
1790
- return this._snapToText(t, s, u) || this._findAndSnapToNode(t, h, u);
1792
+ const o = r;
1793
+ if (st(t) && o === "line")
1794
+ ["start", "end"].find((l) => {
1795
+ const u = l === "start" ? zt(t) : Xt(t);
1796
+ return this._snapToText(t, o, u) || this._findAndSnapToNode(t, l, u);
1791
1797
  });
1792
- else if (st(t) && s !== "line") {
1793
- const h = s === "start" ? zt(t) : Xt(t);
1794
- this._snapToText(t, s, h) || this._findAndSnapToNode(t, s, h);
1795
- } else gt(t) && (this.activeLinks.forEach(({ arrow: h, side: u, connectionPoint: d }) => {
1796
- const g = this.getAnnotation(h), f = ut(t), y = ct(t), v = Wt(d, { x: f.width, y: f.height }), k = rt(v, this.ogma.view.getAngle()), b = St(k, y);
1798
+ else if (st(t) && o !== "line") {
1799
+ const l = o === "start" ? zt(t) : Xt(t);
1800
+ this._snapToText(t, o, l) || this._findAndSnapToNode(t, o, l);
1801
+ } else gt(t) && (this.activeLinks.forEach(({ arrow: l, side: u, connectionPoint: d }) => {
1802
+ const g = this.getAnnotation(l), f = ut(t), y = ct(t), v = Wt(d, { x: f.width, y: f.height }), k = rt(v, this.ogma.view.getAngle()), b = St(k, y);
1797
1803
  g.geometry.coordinates[u === "start" ? 0 : 1] = [b.x, b.y];
1798
1804
  }), this.activeLinks.length && this.arrows.refreshLayer());
1799
1805
  this.layer.refresh(), this.emit(Kt, t, r);
1800
1806
  });
1801
1807
  m(this, "_onFeatureDragEnd", (t) => {
1802
1808
  this.dragged !== null && st(t) && zt(this.dragged) && Ue.forEach((r) => {
1803
- this.links.getArrowLink(t.id, r) && this.emit(ir, {
1809
+ this.links.getArrowLink(t.id, r) && this.emit(rr, {
1804
1810
  arrow: t,
1805
1811
  link: this.links.getArrowLink(t.id, r)
1806
1812
  });
@@ -1808,24 +1814,24 @@ class vr extends nn {
1808
1814
  });
1809
1815
  m(this, "_onFeatureDragStart", (t) => {
1810
1816
  this.textToMagnet = void 0, st(t) ? this.dragged = t : gt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
1811
- const s = r.getSelectedFeature();
1812
- s && s !== t && r.unhover().unselect(), r.disableDetection();
1817
+ const o = r.getSelectedFeature();
1818
+ o && o !== t && r.unhover().unselect(), r.disableDetection();
1813
1819
  }), this.emit(Jt, t);
1814
1820
  });
1815
1821
  m(this, "_onNodesDragStart", () => {
1816
1822
  this.arrows.unhover().unselect(), this.texts.unhover().unselect();
1817
1823
  });
1818
1824
  m(this, "_onNodesDrag", (t) => {
1819
- const { dx: r, dy: s } = t;
1820
- this._moveNodes(t.nodes, r, s);
1825
+ const { dx: r, dy: o } = t;
1826
+ this._moveNodes(t.nodes, r, o);
1821
1827
  });
1822
1828
  m(this, "_onLayoutEnd", (t) => {
1823
- t.ids.forEach((r, s) => {
1829
+ t.ids.forEach((r, o) => {
1824
1830
  this.links.getTargetLinks(r, "node").forEach((u) => {
1825
1831
  const d = this.getAnnotation(u.arrow), g = u.side, f = Vt(
1826
1832
  d,
1827
1833
  g === "start" ? "end" : "start"
1828
- ), y = t.positions.current[s], v = this.ogma.getNode(r).getAttribute("radius"), k = Ut(f, y, +v);
1834
+ ), y = t.positions.current[o], v = this.ogma.getNode(r).getAttribute("radius"), k = Ut(f, y, +v);
1829
1835
  kt(d, g, k.x, k.y);
1830
1836
  });
1831
1837
  }), this.arrows.refreshLayer(), this.texts.refreshLayer();
@@ -1854,56 +1860,56 @@ class vr extends nn {
1854
1860
  m(this, "_onUpdate", (t) => {
1855
1861
  this.emit(ve, t);
1856
1862
  });
1857
- this.options = this.setOptions({ ...gr, ...r }), this.ogma = t, this.arrows = new ar(t, this.options), this.texts = new fr(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((s) => {
1858
- s.on(Jt, this._onFeatureDragStart).on(Kt, this._onFeatureDrag).on(It, this._onFeatureDragEnd).on(ve, this.onUpdate).on(ge, this._onUnselect).on(pe, this._onSelect).on(me, this._onAdded).on(ye, this._onRemoved);
1863
+ this.options = this.setOptions({ ...pr, ...r }), this.ogma = t, this.arrows = new or(t, this.options), this.texts = new dr(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((o) => {
1864
+ o.on(Jt, this._onFeatureDragStart).on(Kt, this._onFeatureDrag).on(It, this._onFeatureDragEnd).on(ve, this.onUpdate).on(ge, this._onUnselect).on(pe, this._onSelect).on(me, this._onAdded).on(ye, this._onRemoved);
1859
1865
  }), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
1860
1866
  this.refreshTextLinks();
1861
1867
  }), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
1862
1868
  }
1863
- _moveNodes(t, r, s) {
1864
- t.forEach((h) => {
1865
- const u = this.links.getTargetLinks(h.getId(), "node"), d = h.getPosition();
1869
+ _moveNodes(t, r, o) {
1870
+ t.forEach((l) => {
1871
+ const u = this.links.getTargetLinks(l.getId(), "node"), d = l.getPosition();
1866
1872
  u.forEach((g) => {
1867
1873
  const f = this.getAnnotation(g.arrow), y = g.side, v = Vt(
1868
1874
  f,
1869
1875
  y === "start" ? "end" : "start"
1870
1876
  );
1871
1877
  let k = d;
1872
- const b = +h.getAttribute("radius"), w = 1e-6;
1873
- (g.connectionPoint.x - (d.x - r) > w || g.connectionPoint.y - (d.y - s) > w) && (k = Ut(v, d, b)), kt(f, y, k.x, k.y);
1878
+ const b = +l.getAttribute("radius"), w = 1e-6;
1879
+ (g.connectionPoint.x - (d.x - r) > w || g.connectionPoint.y - (d.y - o) > w) && (k = Ut(v, d, b)), kt(f, y, k.x, k.y);
1874
1880
  });
1875
1881
  }), this.arrows.refreshLayer();
1876
1882
  }
1877
- _snapToText(t, r, s) {
1878
- const h = this.texts.detect(s, this.options.detectMargin);
1879
- if (this.links.remove(t, r), !h) return !1;
1880
- this.textToMagnet = h;
1881
- const u = this.findMagnetPoint(We, h, s);
1882
- return u ? (kt(t, r, u.point.x, u.point.y), this.links.add(t, r, h.id, "text", u.magnet), !0) : !1;
1883
+ _snapToText(t, r, o) {
1884
+ const l = this.texts.detect(o, this.options.detectMargin);
1885
+ if (this.links.remove(t, r), !l) return !1;
1886
+ this.textToMagnet = l;
1887
+ const u = this.findMagnetPoint(We, l, o);
1888
+ return u ? (kt(t, r, u.point.x, u.point.y), this.links.add(t, r, l.id, "text", u.magnet), !0) : !1;
1883
1889
  }
1884
- _findAndSnapToNode(t, r, s) {
1890
+ _findAndSnapToNode(t, r, o) {
1885
1891
  var d, g;
1886
- const h = this.ogma.view.graphToScreenCoordinates(s), u = this.ogma.view.getElementAt(h);
1887
- 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);
1892
+ const l = this.ogma.view.graphToScreenCoordinates(o), u = this.ogma.view.getElementAt(l);
1893
+ 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, l)) : ((g = this.hoveredNode) == null || g.setSelected(!1), this.hoveredNode = null);
1888
1894
  }
1889
- _snapToNode(t, r, s, h) {
1890
- const u = s.getPositionOnScreen(), d = +s.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), k = s.getPosition();
1895
+ _snapToNode(t, r, o, l) {
1896
+ const u = o.getPositionOnScreen(), d = +o.getAttribute("radius"), g = d * this.ogma.view.getZoom(), f = l.x - u.x, y = l.y - u.y, v = Math.sqrt(f * f + y * y), k = o.getPosition();
1891
1897
  if (v < g + this.options.detectMargin) {
1892
1898
  let b = k;
1893
1899
  if (v > g / 2) {
1894
1900
  const w = Vt(t, r === "end" ? "start" : "end");
1895
1901
  b = Ut(w, b, d);
1896
1902
  }
1897
- kt(t, r, b.x, b.y), this.links.add(t, r, s.getId(), "node", b);
1903
+ kt(t, r, b.x, b.y), this.links.add(t, r, o.getId(), "node", b);
1898
1904
  }
1899
1905
  }
1900
1906
  refreshTextLinks() {
1901
1907
  let t = !1;
1902
1908
  this.links.forEach(
1903
- ({ connectionPoint: r, targetType: s, target: h, arrow: u, side: d }) => {
1904
- if (s !== "text") return;
1909
+ ({ connectionPoint: r, targetType: o, target: l, arrow: u, side: d }) => {
1910
+ if (o !== "text") return;
1905
1911
  t = !0;
1906
- const g = this.getAnnotation(h), f = this.getAnnotation(u), y = ut(g), v = ct(g), k = Wt(r, { x: y.width, y: y.height }), b = rt(k, this.ogma.view.getAngle()), w = St(b, v);
1912
+ const g = this.getAnnotation(l), f = this.getAnnotation(u), y = ut(g), v = ct(g), k = Wt(r, { x: y.width, y: y.height }), b = rt(k, this.ogma.view.getAngle()), w = St(b, v);
1907
1913
  kt(f, d, w.x, w.y);
1908
1914
  }
1909
1915
  ), t && this.arrows.refreshLayer();
@@ -1914,24 +1920,24 @@ class vr extends nn {
1914
1920
  getSelected() {
1915
1921
  return this.selected;
1916
1922
  }
1917
- findMagnetPoint(t, r, s) {
1918
- let h;
1923
+ findMagnetPoint(t, r, o) {
1924
+ let l;
1919
1925
  for (const u of t) {
1920
- const d = ut(r), g = ct(r), f = Wt(u, { x: d.width, y: d.height }), y = rt(f, this.ogma.view.getAngle()), v = St(y, g), k = Tt(wt(v, s)), b = Math.min(
1926
+ const d = ut(r), g = ct(r), f = Wt(u, { x: d.width, y: d.height }), y = rt(f, this.ogma.view.getAngle()), v = St(y, g), k = Tt(wt(v, o)), b = Math.min(
1921
1927
  this.options.magnetRadius * this.ogma.view.getZoom(),
1922
1928
  // when really zoomed in: avoid to snap on too far away magnets
1923
1929
  d.width / 2,
1924
1930
  d.height / 2
1925
1931
  );
1926
1932
  if (k < Math.max(b, this.options.magnetHandleRadius)) {
1927
- h = {
1933
+ l = {
1928
1934
  point: v,
1929
1935
  magnet: u
1930
1936
  };
1931
1937
  break;
1932
1938
  }
1933
1939
  }
1934
- return h;
1940
+ return l;
1935
1941
  }
1936
1942
  /**
1937
1943
  * Set the options for the controller
@@ -1949,7 +1955,7 @@ class vr extends nn {
1949
1955
  * @param id the id of the annotation to select
1950
1956
  */
1951
1957
  select(t) {
1952
- const r = this.getAnnotations().features.find((s) => s.id === t);
1958
+ const r = this.getAnnotations().features.find((o) => o.id === t);
1953
1959
  return r ? (st(r) ? this.arrows.select(r.id) : gt(r) && this.texts.select(r.id), this) : this;
1954
1960
  }
1955
1961
  /**
@@ -1964,11 +1970,11 @@ class vr extends nn {
1964
1970
  */
1965
1971
  add(t) {
1966
1972
  if (Ve(t)) {
1967
- const [r, s] = t.features.reduce(
1968
- (h, u) => (st(u) ? h[1].push(u) : gt(u) && h[0].push(u), h),
1973
+ const [r, o] = t.features.reduce(
1974
+ (l, u) => (st(u) ? l[1].push(u) : gt(u) && l[0].push(u), l),
1969
1975
  [[], []]
1970
1976
  );
1971
- return r.forEach((h) => this.add(h)), s.forEach((h) => this.add(h)), this.arrows.refreshLayer(), this;
1977
+ return r.forEach((l) => this.add(l)), o.forEach((l) => this.add(l)), this.arrows.refreshLayer(), this;
1972
1978
  }
1973
1979
  switch (t.properties.type) {
1974
1980
  case "text":
@@ -1993,15 +1999,15 @@ class vr extends nn {
1993
1999
  loadLink(t) {
1994
2000
  if (t.properties.link)
1995
2001
  for (const r of Ue) {
1996
- const s = t.properties.link[r];
1997
- if (!s) continue;
1998
- const h = this.getAnnotation(s.id);
1999
- if (s.type === "text" && h)
2000
- this.links.add(t, r, s.id, s.type, s.magnet);
2001
- else if (s.type === "node") {
2002
- const u = this.ogma.getNode(s.id);
2002
+ const o = t.properties.link[r];
2003
+ if (!o) continue;
2004
+ const l = this.getAnnotation(o.id);
2005
+ if (o.type === "text" && l)
2006
+ this.links.add(t, r, o.id, o.type, o.magnet);
2007
+ else if (o.type === "node") {
2008
+ const u = this.ogma.getNode(o.id);
2003
2009
  if (!u) continue;
2004
- this.links.add(t, r, s.id, s.type, s.magnet);
2010
+ this.links.add(t, r, o.id, o.type, o.magnet);
2005
2011
  const d = u.getPosition(), g = u.getAttribute("radius") || 0, f = Vt(
2006
2012
  t,
2007
2013
  r === "start" ? "end" : "start"
@@ -2016,8 +2022,8 @@ class vr extends nn {
2016
2022
  * @param y coord of the first point
2017
2023
  * @param arrow The arrow to add
2018
2024
  */
2019
- startArrow(t, r, s) {
2020
- this.cancelDrawing(), this.arrows.startDrawing(t, r, s);
2025
+ startArrow(t, r, o) {
2026
+ this.cancelDrawing(), this.arrows.startDrawing(t, r, o);
2021
2027
  }
2022
2028
  /**
2023
2029
  * Start adding a text (add it, and give control to the user)
@@ -2025,14 +2031,14 @@ class vr extends nn {
2025
2031
  * @param y coord of the top left point
2026
2032
  * @param text The text to add
2027
2033
  */
2028
- startText(t, r, s) {
2029
- this.cancelDrawing(), this.texts.startDrawing(t, r, s);
2034
+ startText(t, r, o) {
2035
+ this.cancelDrawing(), this.texts.startDrawing(t, r, o);
2030
2036
  }
2031
2037
  /**
2032
2038
  * Cancel drawing on the current frame
2033
2039
  */
2034
2040
  cancelDrawing() {
2035
- this.annotations.forEach((t) => t.cancelDrawing()), this.emit(rr);
2041
+ this.annotations.forEach((t) => t.cancelDrawing()), this.emit(nr);
2036
2042
  }
2037
2043
  /**
2038
2044
  * Update the style of the annotation with the given id
@@ -2040,15 +2046,14 @@ class vr extends nn {
2040
2046
  * @param style The new style
2041
2047
  */
2042
2048
  updateStyle(t, r) {
2043
- const s = this.getAnnotations().features.find((h) => h.id === t);
2044
- return s ? (st(s) ? this.arrows.updateStyle(s, r) : gt(s) && this.texts.updateStyle(s, r), this.onUpdate(s), this) : this;
2049
+ const o = this.getAnnotations().features.find((l) => l.id === t);
2050
+ return o ? (st(o) ? this.arrows.updateStyle(o, r) : gt(o) && this.texts.updateStyle(o, r), this.onUpdate(o), this) : this;
2045
2051
  }
2046
- setScale(t, r, s, h) {
2052
+ setScale(t, r, o, l) {
2047
2053
  const u = this.getAnnotations().features.find((d) => d.id === t);
2048
- return u ? (st(u) ? this.arrows.scale(u, r, s, h) : gt(u) && this.texts.scale(u, r, s, h), this.onUpdate(u), this) : this;
2054
+ return u ? (st(u) ? this.arrows.scale(u, r, o, l) : gt(u) && this.texts.scale(u, r, o, l), this.onUpdate(u), this) : this;
2049
2055
  }
2050
2056
  /**
2051
- *
2052
2057
  * @returns the annotations in the controller
2053
2058
  */
2054
2059
  getAnnotations() {
@@ -2076,33 +2081,33 @@ class vr extends nn {
2076
2081
  }
2077
2082
  }
2078
2083
  export {
2079
- ar as Arrows,
2084
+ or as Arrows,
2080
2085
  vr as Control,
2081
2086
  me as EVT_ADD,
2082
- rr as EVT_CANCEL_DRAWING,
2087
+ nr as EVT_CANCEL_DRAWING,
2083
2088
  Kt as EVT_DRAG,
2084
2089
  It as EVT_DRAG_END,
2085
2090
  Jt as EVT_DRAG_START,
2086
- er as EVT_HOVER,
2087
- ir as EVT_LINK,
2091
+ tr as EVT_HOVER,
2092
+ rr as EVT_LINK,
2088
2093
  ye as EVT_REMOVE,
2089
2094
  pe as EVT_SELECT,
2090
- nr as EVT_UNHOVER,
2095
+ er as EVT_UNHOVER,
2091
2096
  ge as EVT_UNSELECT,
2092
2097
  ve as EVT_UPDATE,
2093
2098
  W as NONE,
2094
- fr as Texts,
2099
+ dr as Texts,
2095
2100
  fe as clientToContainerPosition,
2096
- Gn as colorToRgba,
2101
+ mr as colorToRgba,
2097
2102
  qn as createArrow,
2098
2103
  xt as createSVGElement,
2099
- lr as createText,
2104
+ ar as createText,
2100
2105
  Oe as defaultArrowOptions,
2101
2106
  Nt as defaultArrowStyle,
2102
2107
  Re as defaultControllerOptions,
2103
2108
  ce as defaultTextOptions,
2104
2109
  _t as defaultTextStyle,
2105
- mr as getAnnotationsBounds,
2110
+ yr as getAnnotationsBounds,
2106
2111
  Xt as getArrowEnd,
2107
2112
  Zt as getArrowEndPoints,
2108
2113
  Vt as getArrowSide,
@@ -2112,12 +2117,12 @@ export {
2112
2117
  Ge as getTextBbox,
2113
2118
  ct as getTextPosition,
2114
2119
  ut as getTextSize,
2115
- Yn as hexShortToLong,
2116
- Xn as hexToRgba,
2120
+ Gn as hexShortToLong,
2121
+ Yn as hexToRgba,
2117
2122
  Ve as isAnnotationCollection,
2118
2123
  st as isArrow,
2119
2124
  gt as isText,
2120
- Zn as rgbToRgba,
2125
+ Xn as rgbToRgba,
2121
2126
  Wn as scaleGeometry,
2122
2127
  Xe as setArrowEnd,
2123
2128
  kt as setArrowEndPoint,