@linkurious/ogma-annotations 2.0.1 → 2.0.2

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,13 +1,13 @@
1
- var Tn = Object.defineProperty;
2
- var Fn = (i, e, t) => e in i ? Tn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var y = (i, e, t) => Fn(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { Node as Pn, geometry as zt } from "@linkurious/ogma";
5
- function Dn(i) {
1
+ var Fn = Object.defineProperty;
2
+ var Pn = (i, e, t) => e in i ? Fn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var y = (i, e, t) => Pn(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Node as Dn, geometry as zt } from "@linkurious/ogma";
5
+ function Ln(i) {
6
6
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
7
7
  }
8
- var Wt = { exports: {} }, pe;
9
- function Ln() {
10
- return pe || (pe = 1, (function(i) {
8
+ var jt = { exports: {} }, me;
9
+ function Hn() {
10
+ return me || (me = 1, (function(i) {
11
11
  var e = Object.prototype.hasOwnProperty, t = "~";
12
12
  function n() {
13
13
  }
@@ -18,8 +18,8 @@ function Ln() {
18
18
  function r(l, h, c, d, u) {
19
19
  if (typeof c != "function")
20
20
  throw new TypeError("The listener must be a function");
21
- var g = new s(c, d || l, u), p = t ? t + h : h;
22
- return l._events[p] ? l._events[p].fn ? l._events[p] = [l._events[p], g] : l._events[p].push(g) : (l._events[p] = g, l._eventsCount++), l;
21
+ var g = new s(c, d || l, u), f = t ? t + h : h;
22
+ return l._events[f] ? l._events[f].fn ? l._events[f] = [l._events[f], g] : l._events[f].push(g) : (l._events[f] = g, l._eventsCount++), l;
23
23
  }
24
24
  function o(l, h) {
25
25
  --l._eventsCount === 0 ? l._events = new n() : delete l._events[h];
@@ -37,18 +37,18 @@ function Ln() {
37
37
  var c = t ? t + h : h, d = this._events[c];
38
38
  if (!d) return [];
39
39
  if (d.fn) return [d.fn];
40
- for (var u = 0, g = d.length, p = new Array(g); u < g; u++)
41
- p[u] = d[u].fn;
42
- return p;
40
+ for (var u = 0, g = d.length, f = new Array(g); u < g; u++)
41
+ f[u] = d[u].fn;
42
+ return f;
43
43
  }, a.prototype.listenerCount = function(h) {
44
44
  var c = t ? t + h : h, d = this._events[c];
45
45
  return d ? d.fn ? 1 : d.length : 0;
46
- }, a.prototype.emit = function(h, c, d, u, g, p) {
47
- var f = t ? t + h : h;
48
- if (!this._events[f]) return !1;
49
- var m = this._events[f], x = arguments.length, b, v;
46
+ }, a.prototype.emit = function(h, c, d, u, g, f) {
47
+ var p = t ? t + h : h;
48
+ if (!this._events[p]) return !1;
49
+ var m = this._events[p], w = arguments.length, b, v;
50
50
  if (m.fn) {
51
- switch (m.once && this.removeListener(h, m.fn, void 0, !0), x) {
51
+ switch (m.once && this.removeListener(h, m.fn, void 0, !0), w) {
52
52
  case 1:
53
53
  return m.fn.call(m.context), !0;
54
54
  case 2:
@@ -60,15 +60,15 @@ function Ln() {
60
60
  case 5:
61
61
  return m.fn.call(m.context, c, d, u, g), !0;
62
62
  case 6:
63
- return m.fn.call(m.context, c, d, u, g, p), !0;
63
+ return m.fn.call(m.context, c, d, u, g, f), !0;
64
64
  }
65
- for (v = 1, b = new Array(x - 1); v < x; v++)
65
+ for (v = 1, b = new Array(w - 1); v < w; v++)
66
66
  b[v - 1] = arguments[v];
67
67
  m.fn.apply(m.context, b);
68
68
  } else {
69
- var S = m.length, w;
69
+ var S = m.length, x;
70
70
  for (v = 0; v < S; v++)
71
- switch (m[v].once && this.removeListener(h, m[v].fn, void 0, !0), x) {
71
+ switch (m[v].once && this.removeListener(h, m[v].fn, void 0, !0), w) {
72
72
  case 1:
73
73
  m[v].fn.call(m[v].context);
74
74
  break;
@@ -82,8 +82,8 @@ function Ln() {
82
82
  m[v].fn.call(m[v].context, c, d, u);
83
83
  break;
84
84
  default:
85
- if (!b) for (w = 1, b = new Array(x - 1); w < x; w++)
86
- b[w - 1] = arguments[w];
85
+ if (!b) for (x = 1, b = new Array(w - 1); x < w; x++)
86
+ b[x - 1] = arguments[x];
87
87
  m[v].fn.apply(m[v].context, b);
88
88
  }
89
89
  }
@@ -97,12 +97,12 @@ function Ln() {
97
97
  if (!this._events[g]) return this;
98
98
  if (!c)
99
99
  return o(this, g), this;
100
- var p = this._events[g];
101
- if (p.fn)
102
- p.fn === c && (!u || p.once) && (!d || p.context === d) && o(this, g);
100
+ var f = this._events[g];
101
+ if (f.fn)
102
+ f.fn === c && (!u || f.once) && (!d || f.context === d) && o(this, g);
103
103
  else {
104
- for (var f = 0, m = [], x = p.length; f < x; f++)
105
- (p[f].fn !== c || u && !p[f].once || d && p[f].context !== d) && m.push(p[f]);
104
+ for (var p = 0, m = [], w = f.length; p < w; p++)
105
+ (f[p].fn !== c || u && !f[p].once || d && f[p].context !== d) && m.push(f[p]);
106
106
  m.length ? this._events[g] = m.length === 1 ? m[0] : m : o(this, g);
107
107
  }
108
108
  return this;
@@ -110,14 +110,14 @@ function Ln() {
110
110
  var c;
111
111
  return h ? (c = t ? t + h : h, this._events[c] && o(this, c)) : (this._events = new n(), this._eventsCount = 0), this;
112
112
  }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = t, a.EventEmitter = a, i.exports = a;
113
- })(Wt)), Wt.exports;
113
+ })(jt)), jt.exports;
114
114
  }
115
- var Hn = Ln();
116
- const _n = /* @__PURE__ */ Dn(Hn), br = -1, Ut = "dragging", Ct = "dragstart", Bt = "dragend", re = "click", In = "select", zn = "unselect", vr = "hover", Sr = "unhover", Bn = "remove", oe = "add", Rn = "cancelDrawing", Ve = "completeDrawing", $n = "update", Nn = "link", Yn = "history", Ar = "data-annotation", Ze = 5, Xn = 3, de = {
115
+ var _n = Hn();
116
+ const In = /* @__PURE__ */ Ln(_n), vr = -1, Ut = "dragging", Ct = "dragstart", Bt = "dragend", oe = "click", zn = "select", Bn = "unselect", Sr = "hover", Ar = "unhover", Rn = "remove", ae = "add", $n = "cancelDrawing", Ze = "completeDrawing", Nn = "update", Yn = "link", On = "history", Er = "data-annotation", Ke = 5, Xn = 3, ue = {
117
117
  SHAPES: 1,
118
118
  EDITOR: 2,
119
119
  HANDLES: 3
120
- }, O = "start", it = "end", I = {
120
+ }, X = "start", it = "end", I = {
121
121
  default: "default",
122
122
  move: "move",
123
123
  pointer: "pointer",
@@ -136,7 +136,7 @@ const _n = /* @__PURE__ */ Dn(Hn), br = -1, Ut = "dragging", Ct = "dragstart", B
136
136
  eResize: "e-resize",
137
137
  sResize: "s-resize",
138
138
  wResize: "w-resize"
139
- }, at = "collapsed", Rt = "expanded", $t = 1.2, Ke = 0.2, T = {
139
+ }, at = "collapsed", Rt = "expanded", $t = 1.2, Je = 0.2, T = {
140
140
  TEXT: "text",
141
141
  NODE: "node",
142
142
  BOX: "box",
@@ -144,18 +144,18 @@ const _n = /* @__PURE__ */ Dn(Hn), br = -1, Ut = "dragging", Ct = "dragstart", B
144
144
  POLYGON: "polygon",
145
145
  ANNOTATION: "annotation",
146
146
  EDGE: "edge"
147
- }, Je = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
147
+ }, Qe = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
148
148
  <path d="M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
149
- </svg>`, Qe = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
149
+ </svg>`, tn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
150
150
  <path d="M12 6.00015H7.33333C6.97971 6.00015 6.64057 6.14063 6.39052 6.39068C6.14048 6.64072 6 6.97986 6 7.33348V16.6668C6 17.0204 6.14048 17.3596 6.39052 17.6096C6.64057 17.8597 6.97971 18.0002 7.33333 18.0002H16.6667C17.0203 18.0002 17.3594 17.8597 17.6095 17.6096C17.8595 17.3596 18 17.0204 18 16.6668V12.0002M16.25 5.75015C16.5152 5.48493 16.8749 5.33594 17.25 5.33594C17.6251 5.33594 17.9848 5.48493 18.25 5.75015C18.5152 6.01537 18.6642 6.37508 18.6642 6.75015C18.6642 7.12522 18.5152 7.48493 18.25 7.75015L12.2413 13.7595C12.083 13.9176 11.8875 14.0334 11.6727 14.0962L9.75733 14.6562C9.69997 14.6729 9.63916 14.6739 9.58127 14.6591C9.52339 14.6442 9.47055 14.6141 9.4283 14.5719C9.38604 14.5296 9.35593 14.4768 9.3411 14.4189C9.32627 14.361 9.32727 14.3002 9.344 14.2428L9.904 12.3275C9.96702 12.1129 10.083 11.9175 10.2413 11.7595L16.25 5.75015Z" stroke="#1A70E5" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
151
151
  </svg>
152
152
  `;
153
153
  let ut = (i = 21) => crypto.getRandomValues(new Uint8Array(i)).reduce((e, t) => (t &= 63, t < 36 ? e += t.toString(36) : t < 62 ? e += (t - 26).toString(36).toUpperCase() : t > 62 ? e += "-" : e += "_", e), "");
154
- function On(i, e) {
154
+ function Un(i, e) {
155
155
  const t = i[0] - e[0], n = i[1] - e[1];
156
156
  return t * t + n * n;
157
157
  }
158
- function Un(i, e, t) {
158
+ function qn(i, e, t) {
159
159
  let n = e[0], s = e[1], r = t[0] - n, o = t[1] - s;
160
160
  if (r !== 0 || o !== 0) {
161
161
  const a = ((i[0] - n) * r + (i[1] - s) * o) / (r * r + o * o);
@@ -163,32 +163,32 @@ function Un(i, e, t) {
163
163
  }
164
164
  return r = i[0] - n, o = i[1] - s, r * r + o * o;
165
165
  }
166
- function qn(i, e) {
166
+ function Wn(i, e) {
167
167
  let t = i[0];
168
168
  const n = [t];
169
169
  let s;
170
170
  for (let r = 1, o = i.length; r < o; r++)
171
- s = i[r], On(s, t) > e && (n.push(s), t = s);
171
+ s = i[r], Un(s, t) > e && (n.push(s), t = s);
172
172
  return t !== s && n.push(s), n;
173
173
  }
174
- function ae(i, e, t, n, s) {
174
+ function ce(i, e, t, n, s) {
175
175
  let r = n, o = 0;
176
176
  for (let a = e + 1; a < t; a++) {
177
- const l = Un(i[a], i[e], i[t]);
177
+ const l = qn(i[a], i[e], i[t]);
178
178
  l > r && (o = a, r = l);
179
179
  }
180
- r > n && (o - e > 1 && ae(i, e, o, n, s), s.push(i[o]), t - o > 1 && ae(i, o, t, n, s));
180
+ r > n && (o - e > 1 && ce(i, e, o, n, s), s.push(i[o]), t - o > 1 && ce(i, o, t, n, s));
181
181
  }
182
- function Wn(i, e) {
182
+ function jn(i, e) {
183
183
  const t = i.length - 1, n = [i[0]];
184
- return ae(i, 0, t, e, n), n.push(i[t]), n;
184
+ return ce(i, 0, t, e, n), n.push(i[t]), n;
185
185
  }
186
- function me(i, e, t) {
186
+ function ye(i, e, t) {
187
187
  if (i.length <= 2) return i;
188
188
  const n = e !== void 0 ? e * e : 1;
189
- return i = t ? i : qn(i, n), i = Wn(i, n), i;
189
+ return i = t ? i : Wn(i, n), i = jn(i, n), i;
190
190
  }
191
- function ye(i) {
191
+ function we(i) {
192
192
  if (i.geometry.bbox) return i.geometry.bbox;
193
193
  const e = i.geometry.coordinates[0];
194
194
  let t = 1 / 0, n = 1 / 0, s = -1 / 0, r = -1 / 0;
@@ -196,7 +196,7 @@ function ye(i) {
196
196
  o < t && (t = o), o > s && (s = o), a < n && (n = a), a > r && (r = a);
197
197
  return [t, n, s, r];
198
198
  }
199
- function tn(i) {
199
+ function en(i) {
200
200
  const e = i.geometry.coordinates[0];
201
201
  let t = 0, n = 0;
202
202
  const s = e.length - 1;
@@ -207,7 +207,7 @@ function tn(i) {
207
207
  y: n / s
208
208
  };
209
209
  }
210
- function Er(i, e, t) {
210
+ function Cr(i, e, t) {
211
211
  const n = i.geometry.coordinates.map(
212
212
  (o) => o.map(([a, l]) => [a + e, l + t])
213
213
  ), s = i.geometry.bbox, r = s ? [s[0] + e, s[1] + t, s[2] + e, s[3] + t] : void 0;
@@ -220,14 +220,14 @@ function Er(i, e, t) {
220
220
  }
221
221
  };
222
222
  }
223
- function en(i) {
223
+ function nn(i) {
224
224
  const e = i.geometry.coordinates[0];
225
225
  let t = 1 / 0, n = 1 / 0, s = -1 / 0, r = -1 / 0;
226
226
  for (const [o, a] of e)
227
227
  o < t && (t = o), o > s && (s = o), a < n && (n = a), a > r && (r = a);
228
228
  i.geometry.bbox = [t, n, s, r];
229
229
  }
230
- function Cr(i, e, t, n) {
230
+ function kr(i, e, t, n) {
231
231
  const s = i.geometry.coordinates.map(
232
232
  (o) => o.map(([a, l]) => {
233
233
  const h = a - t, c = l - n;
@@ -240,11 +240,11 @@ function Cr(i, e, t, n) {
240
240
  coordinates: s
241
241
  }
242
242
  };
243
- return en(r), r;
243
+ return nn(r), r;
244
244
  }
245
- const jn = "http://www.w3.org/2000/svg";
245
+ const Gn = "http://www.w3.org/2000/svg";
246
246
  function M(i) {
247
- return document.createElementNS(jn, i);
247
+ return document.createElementNS(Gn, i);
248
248
  }
249
249
  function rt(i) {
250
250
  return i.geometry.bbox || kt(i), i.geometry.bbox;
@@ -301,35 +301,35 @@ function kt(i) {
301
301
  i.geometry.bbox = [t, n, s, r];
302
302
  }
303
303
  }
304
- function kr(i, e, t, n, s) {
304
+ function Mr(i, e, t, n, s) {
305
305
  i.geometry.coordinates = [e + n / 2, t + s / 2], i.geometry.bbox = [e, t, e + n, t + s], i.properties.width = n, i.properties.height = s;
306
306
  }
307
- function nn(i) {
307
+ function sn(i) {
308
308
  const [e, t] = i.geometry.coordinates[0];
309
309
  return { x: e, y: t };
310
310
  }
311
311
  function Ht(i, e) {
312
- const [t, n] = i.geometry.coordinates[e === O ? 0 : 1];
312
+ const [t, n] = i.geometry.coordinates[e === X ? 0 : 1];
313
313
  return { x: t, y: n };
314
314
  }
315
- function sn(i) {
315
+ function rn(i) {
316
316
  const [e, t] = i.geometry.coordinates[1];
317
317
  return { x: e, y: t };
318
318
  }
319
- function Gn(i, e, t) {
319
+ function Vn(i, e, t) {
320
320
  i.geometry.coordinates[0] = [e, t];
321
321
  }
322
- function Vn(i, e, t) {
322
+ function Zn(i, e, t) {
323
323
  i.geometry.coordinates[1] = [e, t];
324
324
  }
325
- function ue(i) {
326
- return { start: nn(i), end: sn(i) };
325
+ function ge(i) {
326
+ return { start: sn(i), end: rn(i) };
327
327
  }
328
- function Zn(i, e, t, n) {
329
- e === O ? Gn(i, t, n) : Vn(i, t, n);
328
+ function Kn(i, e, t, n) {
329
+ e === X ? Vn(i, t, n) : Zn(i, t, n);
330
330
  }
331
- const Mr = (i) => parseInt(i.getAttribute("data-handle-id") || "-1");
332
- function Tr(i) {
331
+ const Tr = (i) => parseInt(i.getAttribute("data-handle-id") || "-1");
332
+ function Fr(i) {
333
333
  return _t(i).reduce(
334
334
  (e, t) => (e[0] = Math.min(t[0], e[0]), e[1] = Math.min(t[1], e[1]), e[2] = Math.max(t[0], e[2]), e[3] = Math.max(t[1], e[3]), e),
335
335
  [
@@ -340,13 +340,13 @@ function Tr(i) {
340
340
  ]
341
341
  );
342
342
  }
343
- function Kn(i) {
343
+ function Jn(i) {
344
344
  return Array.isArray(i) && i.length === 2 && i.every(isFinite);
345
345
  }
346
- function Fr(i, e, t, n) {
346
+ function Pr(i, e, t, n) {
347
347
  for (let s = 0; s < i.coordinates.length; s++) {
348
348
  const r = i.coordinates[s];
349
- if (Kn(r))
349
+ if (Jn(r))
350
350
  r[0] = t + (r[0] - t) * e, r[1] = n + (r[1] - n) * e;
351
351
  else
352
352
  for (let o = 0; o < r.length; o++) {
@@ -391,7 +391,7 @@ function _t(i) {
391
391
  ));
392
392
  return e;
393
393
  }
394
- function Pr(i, e, t) {
394
+ function Dr(i, e, t) {
395
395
  const n = Math.atan2(i.y - e.y, i.x - e.x);
396
396
  return {
397
397
  x: e.x + t * Math.cos(n),
@@ -406,12 +406,12 @@ function It(i, e) {
406
406
  y: i.clientY - t.top - e.clientTop
407
407
  };
408
408
  }
409
- function Dr(i, e) {
410
- return i.startsWith("#") ? Jn(i, e) : i.startsWith("rgb") ? Qn(i, e) : i;
409
+ function Lr(i, e) {
410
+ return i.startsWith("#") ? Qn(i, e) : i.startsWith("rgb") ? ts(i, e) : i;
411
411
  }
412
- function Lr(i) {
412
+ function Hr(i) {
413
413
  if (i.startsWith("#")) {
414
- const e = ge(i), t = parseInt(e.slice(1, 3), 16), n = parseInt(e.slice(3, 5), 16), s = parseInt(e.slice(5, 7), 16);
414
+ const e = fe(i), t = parseInt(e.slice(1, 3), 16), n = parseInt(e.slice(3, 5), 16), s = parseInt(e.slice(5, 7), 16);
415
415
  return { r: t, g: n, b: s, a: 1 };
416
416
  } else {
417
417
  const e = i.match(
@@ -426,21 +426,21 @@ function Lr(i) {
426
426
  };
427
427
  }
428
428
  }
429
- function ge(i) {
429
+ function fe(i) {
430
430
  return i.length === 4 ? i.split("").map((e) => e + e).join("") : i;
431
431
  }
432
- function Jn(i, e) {
433
- const [t, n, s] = ge(i).match(/\w\w/g).map((r) => parseInt(r, 16));
432
+ function Qn(i, e) {
433
+ const [t, n, s] = fe(i).match(/\w\w/g).map((r) => parseInt(r, 16));
434
434
  return `rgba(${t}, ${n}, ${s}, ${e})`;
435
435
  }
436
- function Qn(i, e) {
436
+ function ts(i, e) {
437
437
  const [t, n, s] = i.match(/\d+/g).map((r) => parseInt(r, 10));
438
438
  return `rgba(${t}, ${n}, ${s}, ${e})`;
439
439
  }
440
- function we() {
440
+ function xe() {
441
441
  return typeof window < "u" ? window : void 0;
442
442
  }
443
- const rn = (i, e = 16, t = !1) => {
443
+ const on = (i, e = 16, t = !1) => {
444
444
  let n = !1, s = null;
445
445
  const r = Math.max(1, Math.round(e * 60 / 1e3)), o = (a) => {
446
446
  requestAnimationFrame(() => {
@@ -459,13 +459,13 @@ const rn = (i, e = 16, t = !1) => {
459
459
  }
460
460
  i(...a), n = !0, o(r);
461
461
  };
462
- }, Hr = (i, e) => {
462
+ }, _r = (i, e) => {
463
463
  let t;
464
464
  return (...s) => {
465
465
  clearTimeout(t), t = setTimeout(() => i(...s), e);
466
466
  };
467
467
  };
468
- function _r(i, e) {
468
+ function Ir(i, e) {
469
469
  let t;
470
470
  return function(...n) {
471
471
  clearTimeout(t), t = setTimeout(() => {
@@ -473,7 +473,7 @@ function _r(i, e) {
473
473
  }, e);
474
474
  };
475
475
  }
476
- function ts(i) {
476
+ function es(i) {
477
477
  if ((W(i) || _(i)) && i.geometry.type === "Polygon") {
478
478
  const e = i.geometry.coordinates[0], t = e[0][0], n = e[0][1], s = e[2][0], r = e[2][1], o = s - t, a = r - n, l = t + o / 2, h = n + a / 2;
479
479
  return {
@@ -492,11 +492,11 @@ function ts(i) {
492
492
  }
493
493
  return i;
494
494
  }
495
- function on(i, e) {
495
+ function an(i, e) {
496
496
  let t, n, s, r = 1;
497
497
  const o = i.trim();
498
498
  if (o.startsWith("#")) {
499
- const d = (o.length === 4 ? ge(o) : o).match(/#?(\w{2})(\w{2})(\w{2})/);
499
+ const d = (o.length === 4 ? fe(o) : o).match(/#?(\w{2})(\w{2})(\w{2})/);
500
500
  if (!d) return i;
501
501
  t = parseInt(d[1], 16), n = parseInt(d[2], 16), s = parseInt(d[3], 16);
502
502
  } else {
@@ -509,14 +509,14 @@ function on(i, e) {
509
509
  const a = e * 100, h = 0.299 * t + 0.587 * n + 0.114 * s > 186 ? -a / 2 : a;
510
510
  return t = Math.max(0, Math.min(255, t + Math.round(2.55 * h))), n = Math.max(0, Math.min(255, n + Math.round(2.55 * h))), s = Math.max(0, Math.min(255, s + Math.round(2.55 * h))), `rgba(${t},${n},${s},${r})`;
511
511
  }
512
- const Ft = (i) => on(i, Ke), Ir = (i) => on(i, -Ke), X = (i, e) => ({
512
+ const Ft = (i) => an(i, Je), zr = (i) => an(i, -Je), Y = (i, e) => ({
513
513
  x: i.x - e.x,
514
514
  y: i.y - e.y
515
- }), K = (i) => Math.sqrt(i.x * i.x + i.y * i.y), es = (i) => ({
515
+ }), J = (i) => Math.sqrt(i.x * i.x + i.y * i.y), ns = (i) => ({
516
516
  x: -i.x,
517
517
  y: -i.y
518
518
  }), Nt = (i) => {
519
- const e = K(i);
519
+ const e = J(i);
520
520
  return e === 0 ? { x: 0, y: 0 } : {
521
521
  x: i.x / e,
522
522
  y: i.y / e
@@ -527,16 +527,16 @@ const Ft = (i) => on(i, Ke), Ir = (i) => on(i, -Ke), X = (i, e) => ({
527
527
  }), ot = (i, e) => ({
528
528
  x: i.x * e,
529
529
  y: i.y * e
530
- }), xe = (i, e) => {
530
+ }), be = (i, e) => {
531
531
  const t = Math.sin(e), n = Math.cos(e);
532
532
  return {
533
533
  x: i.x * n - i.y * t,
534
534
  y: i.x * t + i.y * n
535
535
  };
536
- }, mt = (i, e) => i.x * e.x + i.y * e.y, ns = (i, e) => i.x * e.y - i.y * e.x, tt = (i) => i.properties.type === "arrow";
537
- function an(i, e, t) {
538
- const { start: n, end: s } = ue(i), r = X(e, n), o = i.properties.style.strokeWidth, a = X(s, n), l = K(a), h = mt(r, Nt(a));
539
- return h > 0 && h < l && Math.abs(ns(r, Nt(a))) < o / 2 + t;
536
+ }, mt = (i, e) => i.x * e.x + i.y * e.y, ss = (i, e) => i.x * e.y - i.y * e.x, tt = (i) => i.properties.type === "arrow";
537
+ function cn(i, e, t) {
538
+ const { start: n, end: s } = ge(i), r = Y(e, n), o = i.properties.style.strokeWidth, a = Y(s, n), l = J(a), h = mt(r, Nt(a));
539
+ return h > 0 && h < l && Math.abs(ss(r, Nt(a))) < o / 2 + t;
540
540
  }
541
541
  const yt = {
542
542
  strokeType: "plain",
@@ -544,7 +544,7 @@ const yt = {
544
544
  strokeWidth: 1,
545
545
  head: "none",
546
546
  tail: "none"
547
- }, zr = {
547
+ }, Br = {
548
548
  id: void 0,
549
549
  // will be set by the editor
550
550
  type: "Feature",
@@ -589,7 +589,7 @@ const yt = {
589
589
  ]
590
590
  }
591
591
  }), W = (i) => i.properties.type === "box";
592
- function ss(i, e, t = 0, n = 1, s = 0) {
592
+ function is(i, e, t = 0, n = 1, s = 0) {
593
593
  const r = St(i), { width: o, height: a } = q(i), l = e.x - r.x, h = e.y - r.y, c = l * n - h * t, d = l * t + h * n;
594
594
  return c > -s && c < o + s && d > -s && d < a + s;
595
595
  }
@@ -600,7 +600,7 @@ const Mt = {
600
600
  boxShadow: "",
601
601
  padding: 16,
602
602
  strokeType: "plain"
603
- }, Br = {
603
+ }, Rr = {
604
604
  id: void 0,
605
605
  // will be set by the editor
606
606
  type: "Feature",
@@ -616,7 +616,7 @@ const Mt = {
616
616
  // center of 100x50 box
617
617
  bbox: [0, 0, 100, 50]
618
618
  }
619
- }, be = (i = 0, e = 0, t = 100, n = 50, s = { ...Mt }) => ({
619
+ }, ve = (i = 0, e = 0, t = 100, n = 50, s = { ...Mt }) => ({
620
620
  id: ut(),
621
621
  type: "Feature",
622
622
  properties: {
@@ -630,7 +630,7 @@ const Mt = {
630
630
  coordinates: [i + t / 2, e + n / 2]
631
631
  // center
632
632
  }
633
- }), _ = (i) => i.properties.type === "text", U = {
633
+ }), _ = (i) => i.properties.type === "text", G = {
634
634
  font: "sans-serif",
635
635
  fontSize: 18,
636
636
  color: "#505050",
@@ -640,7 +640,7 @@ const Mt = {
640
640
  padding: 16,
641
641
  strokeType: "plain",
642
642
  fixedSize: !1
643
- }, Rr = {
643
+ }, $r = {
644
644
  id: ut(),
645
645
  type: "Feature",
646
646
  properties: {
@@ -648,7 +648,7 @@ const Mt = {
648
648
  content: "",
649
649
  width: 100,
650
650
  height: 50,
651
- style: { ...U }
651
+ style: { ...G }
652
652
  },
653
653
  geometry: {
654
654
  type: "Point",
@@ -656,7 +656,7 @@ const Mt = {
656
656
  // center of 100x50 box
657
657
  bbox: [0, 0, 100, 50]
658
658
  }
659
- }, ve = (i = 0, e = 0, t = 100, n = 50, s = "", r = { ...U }) => ({
659
+ }, Se = (i = 0, e = 0, t = 100, n = 50, s = "", r = { ...G }) => ({
660
660
  id: ut(),
661
661
  type: "Feature",
662
662
  properties: {
@@ -664,7 +664,7 @@ const Mt = {
664
664
  content: s,
665
665
  width: t,
666
666
  height: n,
667
- style: { ...U, ...r }
667
+ style: { ...G, ...r }
668
668
  },
669
669
  geometry: {
670
670
  type: "Point",
@@ -673,15 +673,15 @@ const Mt = {
673
673
  bbox: [i, e, i + t, e + n]
674
674
  }
675
675
  });
676
- function cn(i, e, t = 0, n = 0, s = 1, r = 1) {
676
+ function ln(i, e, t = 0, n = 0, s = 1, r = 1) {
677
677
  var m;
678
678
  const [o, a] = i.geometry.coordinates;
679
679
  let { width: l, height: h } = q(i);
680
680
  (m = i.properties.style) != null && m.fixedSize && (l /= r, h /= r);
681
- const c = l / 2, d = h / 2, u = e.x - o, g = e.y - a, p = u * s - g * n, f = u * n + g * s;
682
- return p > -c - t && p < c + t && f > -d - t && f < d + t;
681
+ const c = l / 2, d = h / 2, u = e.x - o, g = e.y - a, f = u * s - g * n, p = u * n + g * s;
682
+ return f > -c - t && f < c + t && p > -d - t && p < d + t;
683
683
  }
684
- const D = (i) => i.properties.type === "comment", J = {
684
+ const F = (i) => i.properties.type === "comment", V = {
685
685
  // Box styling
686
686
  background: "#FFFACD",
687
687
  // Light yellow (sticky note color)
@@ -691,11 +691,11 @@ const D = (i) => i.properties.type === "comment", J = {
691
691
  strokeWidth: 1,
692
692
  strokeType: "plain",
693
693
  // Icon styling (collapsed mode)
694
- iconColor: "#FFCB2F",
694
+ iconColor: "#FFFACD",
695
695
  // Gold
696
696
  iconSymbol: "💬",
697
697
  iconBorderColor: "#aaa",
698
- iconBorderWidth: 2,
698
+ iconBorderWidth: 1,
699
699
  // Size properties
700
700
  minHeight: 60,
701
701
  maxHeight: 480,
@@ -708,26 +708,29 @@ const D = (i) => i.properties.type === "comment", J = {
708
708
  // Editing UI
709
709
  showSendButton: !0,
710
710
  autoGrow: !0,
711
+ // Visual effects
712
+ shadow: !0,
713
+ expandOnSelect: !1,
711
714
  // Fixed size (always screen-aligned)
712
715
  fixedSize: !0
713
- }, jt = {
716
+ }, Gt = {
714
717
  mode: "expanded",
715
718
  width: 200,
716
719
  height: 60,
717
720
  // Initial height, will auto-grow
718
- style: J
721
+ style: V
719
722
  };
720
- function ln(i, e, t, n) {
723
+ function hn(i, e, t, n) {
721
724
  const s = {
722
725
  type: "comment",
723
726
  content: t,
724
- mode: (n == null ? void 0 : n.mode) ?? jt.mode,
725
- width: (n == null ? void 0 : n.width) ?? jt.width,
726
- height: (n == null ? void 0 : n.height) ?? jt.height,
727
+ mode: (n == null ? void 0 : n.mode) ?? Gt.mode,
728
+ width: (n == null ? void 0 : n.width) ?? Gt.width,
729
+ height: (n == null ? void 0 : n.height) ?? Gt.height,
727
730
  author: n == null ? void 0 : n.author,
728
731
  timestamp: n == null ? void 0 : n.timestamp,
729
732
  style: {
730
- ...J,
733
+ ...V,
731
734
  ...n == null ? void 0 : n.style
732
735
  }
733
736
  };
@@ -741,7 +744,7 @@ function ln(i, e, t, n) {
741
744
  }
742
745
  };
743
746
  }
744
- function $r(i) {
747
+ function Nr(i) {
745
748
  return {
746
749
  ...i,
747
750
  properties: {
@@ -750,9 +753,9 @@ function $r(i) {
750
753
  }
751
754
  };
752
755
  }
753
- function is(i, e, t = 0, n, s, r = 1) {
756
+ function rs(i, e, t = 0, n, s, r = 1) {
754
757
  if (i.properties.mode !== at)
755
- return cn(
758
+ return ln(
756
759
  i,
757
760
  e,
758
761
  t,
@@ -760,30 +763,30 @@ function is(i, e, t = 0, n, s, r = 1) {
760
763
  s,
761
764
  r
762
765
  );
763
- const o = i.properties, a = { ...J, ...o.style };
766
+ const o = i.properties, a = { ...V, ...o.style };
764
767
  let l = a.iconSize, h = a.iconSize;
765
768
  a.fixedSize && (l /= r, h /= r);
766
769
  const c = l / 2, d = h / 2, u = e.x - i.geometry.coordinates[0], g = e.y - i.geometry.coordinates[1];
767
770
  return u >= -c - t && u <= c + t && g >= -d - t && g <= d + t;
768
771
  }
769
- function Nr(i) {
772
+ function Yr(i) {
770
773
  const [e, t] = i.geometry.coordinates;
771
774
  return { x: e, y: t };
772
775
  }
773
- function Yr(i) {
774
- const e = i.properties, t = { ...J, ...e.style };
776
+ function Or(i) {
777
+ const e = i.properties, t = { ...V, ...e.style };
775
778
  return e.mode === at ? { width: t.iconSize, height: t.iconSize } : { width: e.width, height: e.height };
776
779
  }
777
- function rs(i, e = 80) {
780
+ function os(i, e = 80) {
778
781
  const t = e / i.properties.width;
779
782
  return Math.max(0.1, Math.min(1, t));
780
783
  }
781
784
  function Xr(i) {
782
- const e = { ...J, ...i.properties.style };
783
- return e.collapseZoomThreshold !== void 0 ? e.collapseZoomThreshold : rs(i);
785
+ const e = { ...V, ...i.properties.style };
786
+ return e.collapseZoomThreshold !== void 0 ? e.collapseZoomThreshold : os(i);
784
787
  }
785
- function Or(i, e, t, n, s = "", r) {
786
- const o = ln(
788
+ function Ur(i, e, t, n, s = "", r) {
789
+ const o = hn(
787
790
  t,
788
791
  n,
789
792
  s,
@@ -795,19 +798,19 @@ function Or(i, e, t, n, s = "", r) {
795
798
  ...r == null ? void 0 : r.arrowStyle
796
799
  }, l = Yt(t, n, i, e, a);
797
800
  return l.properties.link = {
798
- [O]: {
801
+ [X]: {
799
802
  id: o.id,
800
- side: O,
803
+ side: X,
801
804
  type: "comment",
802
805
  magnet: { x: 0, y: 0 }
803
806
  }
804
807
  }, { comment: o, arrow: l };
805
808
  }
806
- function os(i, e, t, n, s, r, o, a, l) {
807
- const h = i - o, c = e - a, d = o + h * r - c * s, u = a + h * s + c * r, g = o + (h + t) * r - c * s, p = a + (h + t) * s + c * r, f = o + (h + t) * r - (c + n) * s, m = a + (h + t) * s + (c + n) * r, x = o + h * r - (c + n) * s, b = a + h * s + (c + n) * r;
808
- return l[0] = Math.min(d, g, f, x), l[1] = Math.min(u, p, m, b), l[2] = Math.max(d, g, f, x), l[3] = Math.max(u, p, m, b), l;
809
+ function as(i, e, t, n, s, r, o, a, l) {
810
+ const h = i - o, c = e - a, d = o + h * r - c * s, u = a + h * s + c * r, g = o + (h + t) * r - c * s, f = a + (h + t) * s + c * r, p = o + (h + t) * r - (c + n) * s, m = a + (h + t) * s + (c + n) * r, w = o + h * r - (c + n) * s, b = a + h * s + (c + n) * r;
811
+ return l[0] = Math.min(d, g, p, w), l[1] = Math.min(u, f, m, b), l[2] = Math.max(d, g, p, w), l[3] = Math.max(u, f, m, b), l;
809
812
  }
810
- function as(i, e, t) {
813
+ function cs(i, e, t) {
811
814
  const n = t.x - e.x, s = t.y - e.y, r = n * n + s * s;
812
815
  if (r === 0) {
813
816
  const d = i.x - e.x, u = i.y - e.y;
@@ -818,8 +821,8 @@ function as(i, e, t) {
818
821
  const a = e.x + o * n, l = e.y + o * s, h = i.x - a, c = i.y - l;
819
822
  return Math.sqrt(h * h + c * c);
820
823
  }
821
- const nt = (i) => i.properties.type === "polygon";
822
- function hn(i, e, t = 0) {
824
+ const st = (i) => i.properties.type === "polygon";
825
+ function dn(i, e, t = 0) {
823
826
  const n = i.geometry.coordinates[0], s = i.geometry.bbox;
824
827
  if (s) {
825
828
  const [o, a, l, h] = s;
@@ -835,11 +838,11 @@ function hn(i, e, t = 0) {
835
838
  if (t > 0)
836
839
  for (let o = 0; o < n.length - 1; o++) {
837
840
  const [a, l] = n[o], [h, c] = n[o + 1];
838
- if (as(e, { x: a, y: l }, { x: h, y: c }) <= t) return !0;
841
+ if (cs(e, { x: a, y: l }, { x: h, y: c }) <= t) return !0;
839
842
  }
840
843
  return !1;
841
844
  }
842
- function cs(i, e) {
845
+ function ls(i, e) {
843
846
  const t = i[0];
844
847
  t.length > 0 && (t[0][0] !== t[t.length - 1][0] || t[0][1] !== t[t.length - 1][1]) && t.push([t[0][0], t[0][1]]);
845
848
  let n = 1 / 0, s = 1 / 0, r = -1 / 0, o = -1 / 0;
@@ -869,43 +872,43 @@ const lt = {
869
872
  strokeColor: "#000000",
870
873
  strokeWidth: 2,
871
874
  background: "transparent"
872
- }, Ur = {
875
+ }, qr = {
873
876
  type: "polygon",
874
877
  style: {
875
878
  ...lt
876
879
  }
877
- }, Se = (i) => i.type === "FeatureCollection";
878
- function dn(i) {
880
+ }, Ae = (i) => i.type === "FeatureCollection";
881
+ function un(i) {
879
882
  return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(i.trim());
880
883
  }
881
- function un(i) {
884
+ function gn(i) {
882
885
  return /^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(i.trim());
883
886
  }
884
- function gn(i) {
887
+ function fn(i) {
885
888
  return /^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[0-9.]+\s*\)$/.test(
886
889
  i.trim()
887
890
  );
888
891
  }
889
- function ls(i) {
890
- return dn(i) || un(i) || gn(i);
891
- }
892
- function qr(i) {
893
- if (ls(i)) return i;
894
- throw new Error(`Invalid color format: ${i}`);
892
+ function hs(i) {
893
+ return un(i) || gn(i) || fn(i);
895
894
  }
896
895
  function Wr(i) {
897
- if (dn(i)) return i;
898
- throw new Error(`Invalid hex color format: ${i}`);
896
+ if (hs(i)) return i;
897
+ throw new Error(`Invalid color format: ${i}`);
899
898
  }
900
899
  function jr(i) {
901
900
  if (un(i)) return i;
902
- throw new Error(`Invalid RGB color format: ${i}`);
901
+ throw new Error(`Invalid hex color format: ${i}`);
903
902
  }
904
903
  function Gr(i) {
905
904
  if (gn(i)) return i;
905
+ throw new Error(`Invalid RGB color format: ${i}`);
906
+ }
907
+ function Vr(i) {
908
+ if (fn(i)) return i;
906
909
  throw new Error(`Invalid RGBA color format: ${i}`);
907
910
  }
908
- class hs {
911
+ class ds {
909
912
  constructor(e) {
910
913
  y(this, "previousZoom", -1);
911
914
  this.store = e;
@@ -916,7 +919,7 @@ class hs {
916
919
  */
917
920
  toggleComment(e) {
918
921
  const t = this.store.getState().getFeature(e);
919
- if (!t || !D(t)) return;
922
+ if (!t || !F(t)) return;
920
923
  const n = t;
921
924
  this.store.getState().applyLiveUpdate(e, {
922
925
  properties: {
@@ -935,7 +938,7 @@ class hs {
935
938
  this.previousZoom = e;
936
939
  const t = this.store.getState(), n = t.features, s = {};
937
940
  Object.values(n).forEach((r) => {
938
- if (D(r)) {
941
+ if (F(r)) {
939
942
  const o = r, a = this.getCommentZoomThreshold(o), l = e < a ? at : Rt;
940
943
  if (o.properties.mode === l) return;
941
944
  s[o.id] = {
@@ -1053,13 +1056,13 @@ class qt extends EventTarget {
1053
1056
  if (this.annotation = t ? t.id : null, this.annotation !== null) {
1054
1057
  const n = this.ogma.getContainer();
1055
1058
  if (n) {
1056
- const s = we() || n;
1059
+ const s = xe() || n;
1057
1060
  s.addEventListener("mousemove", this.handleMouseMove), s.addEventListener("mouseup", this.handleMouseUp, !1), n.addEventListener("mousedown", this.handleMouseDown, !0), s.addEventListener("click", this.onClick, !0);
1058
1061
  }
1059
1062
  } else {
1060
1063
  const n = this.ogma.getContainer();
1061
1064
  if (n) {
1062
- const s = we() || n;
1065
+ const s = xe() || n;
1063
1066
  s.removeEventListener("mousemove", this.handleMouseMove), s.removeEventListener("mouseup", this.handleMouseUp), n.removeEventListener("mousedown", this.handleMouseDown), s.removeEventListener("click", this.onClick);
1064
1067
  }
1065
1068
  this.clearDragState(), this.setCursor(I.default);
@@ -1089,7 +1092,7 @@ class qt extends EventTarget {
1089
1092
  return this.annotation !== null;
1090
1093
  }
1091
1094
  }
1092
- class ds extends qt {
1095
+ class us extends qt {
1093
1096
  constructor(t, n, s, r, o, a, l) {
1094
1097
  super(t, n);
1095
1098
  y(this, "links");
@@ -1102,7 +1105,7 @@ class ds extends qt {
1102
1105
  y(this, "startX", 0);
1103
1106
  y(this, "startY", 0);
1104
1107
  y(this, "onArrowComplete", () => {
1105
- var x;
1108
+ var w;
1106
1109
  this.arrowHandler.removeEventListener("dragend", this.onArrowComplete);
1107
1110
  const t = this.store.getState(), n = Array.from(t.selectedFeatures);
1108
1111
  if (n.length === 0) return;
@@ -1113,15 +1116,15 @@ class ds extends qt {
1113
1116
  h < 5 ? (c = this.startX + this.offsetX, d = this.startY + this.offsetY) : (c = o[0], d = o[1]);
1114
1117
  const u = this.comment;
1115
1118
  u.geometry.coordinates = [c, d], t.addFeature(u), this.store.setState({ drawingFeature: u.id });
1116
- const g = u.properties.height, p = c, f = d + g * 0.5;
1119
+ const g = u.properties.height, f = c, p = d + g * 0.5;
1117
1120
  this.snapArrowStart(s, r[0], r[1]);
1118
- const m = (x = s.properties.link) == null ? void 0 : x.start;
1121
+ const m = (w = s.properties.link) == null ? void 0 : w.start;
1119
1122
  t.updateFeature(s.id, {
1120
1123
  ...s,
1121
1124
  geometry: {
1122
1125
  ...s.geometry,
1123
1126
  coordinates: [
1124
- [p, f],
1127
+ [f, p],
1125
1128
  // Start: comment bottom edge
1126
1129
  r
1127
1130
  // End: original mousedown point (with any snapping from ArrowHandler)
@@ -1131,7 +1134,7 @@ class ds extends qt {
1131
1134
  ...s.properties,
1132
1135
  link: {
1133
1136
  start: {
1134
- side: O,
1137
+ side: X,
1135
1138
  id: u.id,
1136
1139
  type: T.COMMENT,
1137
1140
  magnet: { x: 0, y: 0.5 }
@@ -1146,7 +1149,7 @@ class ds extends qt {
1146
1149
  } : void 0
1147
1150
  }
1148
1151
  }
1149
- }), this.links.add(s, O, u.id, T.COMMENT, {
1152
+ }), this.links.add(s, X, u.id, T.COMMENT, {
1150
1153
  x: 0,
1151
1154
  y: 0.5
1152
1155
  }), m && m.magnet && this.links.add(
@@ -1175,38 +1178,38 @@ class ds extends qt {
1175
1178
  const r = this.snapping.snap({ x: n, y: s });
1176
1179
  r && (t.geometry.coordinates[0] = [r.point.x, r.point.y], t.properties.link = {
1177
1180
  start: {
1178
- side: O,
1181
+ side: X,
1179
1182
  id: r.id,
1180
1183
  type: r.type,
1181
1184
  magnet: r.magnet
1182
1185
  }
1183
- }, this.links.add(t, O, r.id, r.type, r.magnet));
1186
+ }, this.links.add(t, X, r.id, r.type, r.magnet));
1184
1187
  }
1185
1188
  }
1186
- function us(i, e, t, n, s) {
1187
- const { width: r, height: o } = n.view.getSize(), a = 8, l = 16, h = a * l, c = { width: 150, height: 50 }, d = c.width, u = c.height, g = Math.max(r, o), p = 200, f = {
1189
+ function gs(i, e, t, n, s) {
1190
+ const { width: r, height: o } = n.view.getSize(), a = 8, l = 16, h = a * l, c = { width: 150, height: 50 }, d = c.width, u = c.height, g = Math.max(r, o), f = 200, p = {
1188
1191
  minX: 0,
1189
1192
  minY: 0,
1190
1193
  maxX: 0,
1191
1194
  maxY: 0
1192
1195
  }, m = n.view.graphToScreenCoordinates({ x: i, y: e });
1193
- for (let x = 0; x < h; x++) {
1194
- const b = x % a, v = Math.floor(x / a), S = 2 * Math.PI * (b / a), w = p + v / l * (g - p), A = Math.cos(S) * w, C = Math.sin(S) * w, E = m.x + A, k = m.y + C;
1195
- if (f.minX = E, f.minY = k - u / 2, f.maxX = E + d, f.maxY = k + u / 2, A < 0 && (f.minX -= d, f.maxX -= d), f.minX < 0 || f.maxX > r || f.minY < 0 || f.maxY > o)
1196
+ for (let w = 0; w < h; w++) {
1197
+ const b = w % a, v = Math.floor(w / a), S = 2 * Math.PI * (b / a), x = f + v / l * (g - f), A = Math.cos(S) * x, C = Math.sin(S) * x, E = m.x + A, k = m.y + C;
1198
+ if (p.minX = E, p.minY = k - u / 2, p.maxX = E + d, p.maxY = k + u / 2, A < 0 && (p.minX -= d, p.maxX -= d), p.minX < 0 || p.maxX > r || p.minY < 0 || p.maxY > o)
1196
1199
  continue;
1197
- const F = n.view.screenToGraphCoordinates({
1198
- x: f.minX,
1199
- y: f.minY
1200
- }), j = n.view.screenToGraphCoordinates({
1201
- x: f.maxX,
1202
- y: f.maxY
1200
+ const P = n.view.screenToGraphCoordinates({
1201
+ x: p.minX,
1202
+ y: p.minY
1203
+ }), O = n.view.screenToGraphCoordinates({
1204
+ x: p.maxX,
1205
+ y: p.maxY
1203
1206
  });
1204
- if (f.minX = F.x, f.minY = F.y, f.maxX = j.x, f.maxY = j.y, !t.query(f).filter((R) => R.properties.type !== "arrow").length)
1207
+ if (p.minX = P.x, p.minY = P.y, p.maxX = O.x, p.maxY = O.y, !t.query(p).filter((B) => B.properties.type !== "arrow").length)
1205
1208
  return n.view.screenToGraphCoordinates({ x: E, y: k });
1206
1209
  }
1207
1210
  return n.view.screenToGraphCoordinates({ x: r / 2, y: o / 2 });
1208
1211
  }
1209
- class gs {
1212
+ class fs {
1210
1213
  constructor(e, t, n, s, r, o, a) {
1211
1214
  y(this, "ogma");
1212
1215
  y(this, "store");
@@ -1252,7 +1255,7 @@ class gs {
1252
1255
  }
1253
1256
  enableTextDrawing(e) {
1254
1257
  return this.enableDrawingMode((t, n) => {
1255
- const s = ve(t, n, 0, 0, void 0, e);
1258
+ const s = Se(t, n, 0, 0, void 0, e);
1256
1259
  this.startText(t, n, s);
1257
1260
  });
1258
1261
  }
@@ -1263,7 +1266,7 @@ class gs {
1263
1266
  */
1264
1267
  enableBoxDrawing(e) {
1265
1268
  return this.enableDrawingMode((t, n) => {
1266
- const s = be(t, n, 0, 0, e);
1269
+ const s = ve(t, n, 0, 0, e);
1267
1270
  this.startBox(t, n, s);
1268
1271
  });
1269
1272
  }
@@ -1274,7 +1277,7 @@ class gs {
1274
1277
  */
1275
1278
  enablePolygonDrawing(e) {
1276
1279
  return this.enableDrawingMode((t, n) => {
1277
- const s = cs([[[t, n]]], { style: e });
1280
+ const s = ls([[[t, n]]], { style: e });
1278
1281
  this.startPolygon(t, n, s);
1279
1282
  });
1280
1283
  }
@@ -1291,10 +1294,10 @@ class gs {
1291
1294
  return this.enableDrawingMode((t, n) => {
1292
1295
  let s = e.offsetX, r = e.offsetY;
1293
1296
  if (s === void 0 && r === void 0) {
1294
- const a = us(t, n, this.index, this.ogma);
1297
+ const a = gs(t, n, this.index, this.ogma);
1295
1298
  s = a.x, r = a.y;
1296
1299
  }
1297
- const o = ln(t, n, "", e == null ? void 0 : e.commentStyle);
1300
+ const o = hn(t, n, "", e == null ? void 0 : e.commentStyle);
1298
1301
  this.startComment(t, n, o, {
1299
1302
  ...e,
1300
1303
  offsetX: s,
@@ -1339,7 +1342,7 @@ class gs {
1339
1342
  }
1340
1343
  startComment(e, t, n, s) {
1341
1344
  this.editor.getActiveHandler() && this.editor.getActiveHandler().stopEditing(), this.control.cancelDrawing(), this.store.setState({ drawingFeature: n.id }), this.interactions.suppressClicksTemporarily(200);
1342
- const r = new ds(
1345
+ const r = new us(
1343
1346
  this.ogma,
1344
1347
  this.store,
1345
1348
  this.links,
@@ -1349,24 +1352,24 @@ class gs {
1349
1352
  s
1350
1353
  ), o = (a) => {
1351
1354
  var l;
1352
- a.id === n.id && (this.control.select(a.id), this.control.off(oe, o), (l = this.editor.getActiveHandler()) == null || l.startEditingText());
1355
+ a.id === n.id && (this.control.select(a.id), this.control.off(ae, o), (l = this.editor.getActiveHandler()) == null || l.startEditingText());
1353
1356
  };
1354
- return this.control.on(oe, o), r.startDrawing(n.id, e, t), this.control;
1357
+ return this.control.on(ae, o), r.startDrawing(n.id, e, t), this.control;
1355
1358
  }
1356
1359
  startBox(e, t, n) {
1357
- return n || (n = be(e, t)), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1360
+ return n || (n = ve(e, t)), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1358
1361
  }
1359
1362
  startArrow(e, t, n) {
1360
1363
  return n || (n = Yt(e, t)), this.editor.getActiveHandler() && this.editor.getActiveHandler().stopEditing(), this.control.cancelDrawing(), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1361
1364
  }
1362
1365
  startText(e, t, n) {
1363
- return n || (n = ve(e, t)), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1366
+ return n || (n = Se(e, t)), this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1364
1367
  }
1365
1368
  startPolygon(e, t, n) {
1366
1369
  return this.store.setState({ drawingFeature: n.id }), this.control.add(n), this.interactions.suppressClicksTemporarily(200), this.control.select(n.id), this.editor.getActiveHandler().startDrawing(n.id, e, t), this.control;
1367
1370
  }
1368
1371
  }
1369
- class fs {
1372
+ class ps {
1370
1373
  constructor(e, t) {
1371
1374
  this.store = e, this.links = t;
1372
1375
  }
@@ -1405,7 +1408,7 @@ class fs {
1405
1408
  this.store.temporal.getState().clear();
1406
1409
  }
1407
1410
  }
1408
- class ps {
1411
+ class ms {
1409
1412
  constructor(e) {
1410
1413
  this.store = e;
1411
1414
  }
@@ -1454,7 +1457,7 @@ class ps {
1454
1457
  return t ? e.features[t] : null;
1455
1458
  }
1456
1459
  }
1457
- class ms {
1460
+ class ys {
1458
1461
  constructor(e) {
1459
1462
  this.store = e;
1460
1463
  }
@@ -1463,10 +1466,10 @@ class ms {
1463
1466
  * @param annotation The annotation to add
1464
1467
  */
1465
1468
  add(e) {
1466
- if (Se(e))
1469
+ if (Ae(e))
1467
1470
  for (const t of e.features) this.add(t);
1468
1471
  else {
1469
- const t = ts(e);
1472
+ const t = es(e);
1470
1473
  this.store.getState().addFeature(t);
1471
1474
  }
1472
1475
  }
@@ -1475,7 +1478,7 @@ class ms {
1475
1478
  * @param annotation The annotation(s) to remove
1476
1479
  */
1477
1480
  remove(e) {
1478
- if (Se(e))
1481
+ if (Ae(e))
1479
1482
  for (const t of e.features) this.remove(t);
1480
1483
  else
1481
1484
  this.store.getState().removeFeature(e.id);
@@ -1602,12 +1605,12 @@ class ms {
1602
1605
  }
1603
1606
  });
1604
1607
  } else if (_(r) || W(r)) {
1605
- const [a, l] = r.geometry.coordinates, h = a - n, c = l - s, d = n + h * t, u = s + c * t, g = r.properties.width * t, p = r.properties.height * t;
1608
+ const [a, l] = r.geometry.coordinates, h = a - n, c = l - s, d = n + h * t, u = s + c * t, g = r.properties.width * t, f = r.properties.height * t;
1606
1609
  o.updateFeature(e, {
1607
1610
  properties: {
1608
1611
  ...r.properties,
1609
1612
  width: g,
1610
- height: p
1613
+ height: f
1611
1614
  },
1612
1615
  geometry: {
1613
1616
  ...r.geometry,
@@ -1617,19 +1620,19 @@ class ms {
1617
1620
  }
1618
1621
  }
1619
1622
  }
1620
- function ys(i) {
1623
+ function ws(i) {
1621
1624
  var t, n;
1622
1625
  const e = i.properties.link;
1623
1626
  return e ? ((t = e.start) == null ? void 0 : t.type) === T.COMMENT || ((n = e.end) == null ? void 0 : n.type) === T.COMMENT : !1;
1624
1627
  }
1625
- function ws(i) {
1628
+ function xs(i) {
1626
1629
  var e, t;
1627
1630
  return ((t = (e = i.properties.link) == null ? void 0 : e.start) == null ? void 0 : t.type) !== T.COMMENT;
1628
1631
  }
1629
- function Vr(i) {
1632
+ function Zr(i) {
1630
1633
  return !0;
1631
1634
  }
1632
- function fe(i, e, t, n, s = !1) {
1635
+ function pe(i, e, t, n, s = !1) {
1633
1636
  const r = i.getState(), o = r.getFeature(t);
1634
1637
  if (!o) return;
1635
1638
  const a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
@@ -1647,17 +1650,17 @@ function fe(i, e, t, n, s = !1) {
1647
1650
  for (const d of a) {
1648
1651
  const u = r.getFeature(d);
1649
1652
  if (!u) continue;
1650
- const g = xs(u, n);
1653
+ const g = bs(u, n);
1651
1654
  g && (c[d] = g, e.updateLinkedArrowsDuringDrag(d, n, c));
1652
1655
  }
1653
1656
  for (const d of l) {
1654
1657
  const u = r.getFeature(d);
1655
1658
  if (!u) continue;
1656
- const g = u.properties.link || {}, p = u.geometry.coordinates, f = [...p];
1657
- (g.start && Pt(g.start.type) || h === d) && (f[0] = [p[0][0] + n.x, p[0][1] + n.y]), (g.end && Pt(g.end.type) || h === d) && (f[1] = [p[1][0] + n.x, p[1][1] + n.y]), c[d] = {
1659
+ const g = u.properties.link || {}, f = u.geometry.coordinates, p = [...f];
1660
+ (g.start && Pt(g.start.type) || h === d) && (p[0] = [f[0][0] + n.x, f[0][1] + n.y]), (g.end && Pt(g.end.type) || h === d) && (p[1] = [f[1][0] + n.x, f[1][1] + n.y]), c[d] = {
1658
1661
  geometry: {
1659
1662
  ...u.geometry,
1660
- coordinates: f
1663
+ coordinates: p
1661
1664
  }
1662
1665
  };
1663
1666
  }
@@ -1666,8 +1669,8 @@ function fe(i, e, t, n, s = !1) {
1666
1669
  function Pt(i) {
1667
1670
  return i !== T.NODE && i !== T.EDGE;
1668
1671
  }
1669
- function xs(i, e) {
1670
- if (_(i) || W(i) || D(i)) {
1672
+ function bs(i, e) {
1673
+ if (_(i) || W(i) || F(i)) {
1671
1674
  const t = Q(i);
1672
1675
  return {
1673
1676
  geometry: {
@@ -1676,7 +1679,7 @@ function xs(i, e) {
1676
1679
  }
1677
1680
  };
1678
1681
  }
1679
- if (nt(i)) {
1682
+ if (st(i)) {
1680
1683
  const t = i, n = t.geometry.coordinates.map(
1681
1684
  (s) => s.map((r) => [r[0] + e.x, r[1] + e.y])
1682
1685
  );
@@ -1689,7 +1692,7 @@ function xs(i, e) {
1689
1692
  }
1690
1693
  return null;
1691
1694
  }
1692
- class bs extends qt {
1695
+ class vs extends qt {
1693
1696
  constructor(t, n, s, r) {
1694
1697
  super(t, n);
1695
1698
  y(this, "snapping");
@@ -1698,12 +1701,12 @@ class bs extends qt {
1698
1701
  this.snapping = s, this.links = r;
1699
1702
  }
1700
1703
  detectHandle(t) {
1701
- const n = this.getAnnotation(), s = this.clientToCanvas(t), r = Ze, o = n.geometry.coordinates[0], a = n.geometry.coordinates[1], l = Math.sqrt(
1704
+ const n = this.getAnnotation(), s = this.clientToCanvas(t), r = Ke, o = n.geometry.coordinates[0], a = n.geometry.coordinates[1], l = Math.sqrt(
1702
1705
  Math.pow(s.x - o[0], 2) + Math.pow(s.y - o[1], 2)
1703
1706
  ), h = Math.sqrt(
1704
1707
  Math.pow(s.x - a[0], 2) + Math.pow(s.y - a[1], 2)
1705
1708
  );
1706
- l < r ? this.grabHandle("start", o[0], o[1]) : h < r ? this.grabHandle("end", a[0], a[1]) : an(n, s, r) ? (this.setCursor(I.grab), this.hoveredHandle = {
1709
+ l < r ? this.grabHandle("start", o[0], o[1]) : h < r ? this.grabHandle("end", a[0], a[1]) : cn(n, s, r) ? (this.setCursor(I.grab), this.hoveredHandle = {
1707
1710
  type: "body",
1708
1711
  point: s
1709
1712
  }, this.store.setState({ hoveredHandle: 2, hoveredFeature: this.annotation })) : (this.store.setState({ hoveredHandle: -1, hoveredFeature: null }), this.hoveredHandle = void 0);
@@ -1727,7 +1730,7 @@ class bs extends qt {
1727
1730
  }), h = [...s.geometry.coordinates];
1728
1731
  if (n.type === "body") {
1729
1732
  const d = a.x - n.point.x, u = a.y - n.point.y;
1730
- fe(this.store, this.links, s.id, { x: d, y: u }, !0), this.dispatchEvent(l);
1733
+ pe(this.store, this.links, s.id, { x: d, y: u }, !0), this.dispatchEvent(l);
1731
1734
  return;
1732
1735
  } else n.type === "start" ? (h[0] = [a.x, a.y], this.snap && (r.start = {
1733
1736
  side: n.type,
@@ -1752,7 +1755,7 @@ class bs extends qt {
1752
1755
  onDragStart(t) {
1753
1756
  if (!super.onDragStart(t)) return !1;
1754
1757
  const n = this.getAnnotation(), s = this.hoveredHandle;
1755
- return s.type === "end" && !1 || s.type === "start" && !ws(n) ? (this.clearDragState(), !1) : (this.store.getState().startLiveUpdate([this.annotation]), !0);
1758
+ return s.type === "end" && !1 || s.type === "start" && !xs(n) ? (this.clearDragState(), !1) : (this.store.getState().startLiveUpdate([this.annotation]), !0);
1756
1759
  }
1757
1760
  onDragEnd(t) {
1758
1761
  var r, o, a, l;
@@ -1778,7 +1781,7 @@ class bs extends qt {
1778
1781
  c.id,
1779
1782
  c.type,
1780
1783
  c.magnet
1781
- ) : ((o = (r = n.properties.link) == null ? void 0 : r.start) == null ? void 0 : o.type) !== "comment" && this.links.remove(n, O), d ? this.links.add(
1784
+ ) : ((o = (r = n.properties.link) == null ? void 0 : r.start) == null ? void 0 : o.type) !== "comment" && this.links.remove(n, X), d ? this.links.add(
1782
1785
  n,
1783
1786
  "end",
1784
1787
  d.id,
@@ -1825,7 +1828,7 @@ class bs extends qt {
1825
1828
  ...t.properties,
1826
1829
  link: {
1827
1830
  start: {
1828
- side: O,
1831
+ side: X,
1829
1832
  id: r.id,
1830
1833
  type: r.type,
1831
1834
  magnet: r.magnet
@@ -1853,7 +1856,7 @@ class bs extends qt {
1853
1856
  let r = Ht(t, s);
1854
1857
  const o = t.properties.link || {};
1855
1858
  let a = null;
1856
- if (n instanceof Pn)
1859
+ if (n instanceof Dn)
1857
1860
  r = n.getPosition(), a = this.snapping.snapToNodes(r, n.toList());
1858
1861
  else {
1859
1862
  const l = this.store.getState().getFeature(n);
@@ -1861,8 +1864,8 @@ class bs extends qt {
1861
1864
  throw new Error(`Annotation with id ${n} not found`);
1862
1865
  if (_(l) || W(l))
1863
1866
  r = Q(l), a = this.snapping.snapToText(r, [l]);
1864
- else if (nt(l))
1865
- r = tn(l), a = this.snapping.snapToPolygon(r, [l]);
1867
+ else if (st(l))
1868
+ r = en(l), a = this.snapping.snapToPolygon(r, [l]);
1866
1869
  else
1867
1870
  throw new Error(
1868
1871
  `Cannot link arrow to annotation of type ${l.properties.type}`
@@ -1873,7 +1876,7 @@ class bs extends qt {
1873
1876
  id: a.id,
1874
1877
  type: a.type,
1875
1878
  magnet: a.magnet
1876
- }, this.links.add(t, s, a.id, a.type, a.magnet), Zn(t, s, r.x, r.y), this.store.getState().updateFeature(t.id, {
1879
+ }, this.links.add(t, s, a.id, a.type, a.magnet), Kn(t, s, r.x, r.y), this.store.getState().updateFeature(t.id, {
1877
1880
  properties: { ...t.properties, link: o },
1878
1881
  geometry: {
1879
1882
  type: t.geometry.type,
@@ -1882,7 +1885,7 @@ class bs extends qt {
1882
1885
  }));
1883
1886
  }
1884
1887
  }
1885
- class vs extends qt {
1888
+ class Ss extends qt {
1886
1889
  // Graph units
1887
1890
  constructor(t, n, s) {
1888
1891
  super(t, n);
@@ -1921,7 +1924,7 @@ class vs extends qt {
1921
1924
  detectHandle(t, n = 1) {
1922
1925
  const s = this.getAnnotation();
1923
1926
  if (!s) return;
1924
- const r = this.clientToCanvas(t), o = Ze / n, a = s.geometry.coordinates[0];
1927
+ const r = this.clientToCanvas(t), o = Ke / n, a = s.geometry.coordinates[0];
1925
1928
  for (let l = 0; l < a.length - 1; l++) {
1926
1929
  const [h, c] = a[l];
1927
1930
  if (Math.sqrt(
@@ -1931,7 +1934,7 @@ class vs extends qt {
1931
1934
  return;
1932
1935
  }
1933
1936
  }
1934
- hn(s, r, o) ? (this.setCursor(I.grab), this.hoveredHandle = {
1937
+ dn(s, r, o) ? (this.setCursor(I.grab), this.hoveredHandle = {
1935
1938
  type: "body",
1936
1939
  point: r
1937
1940
  }, this.store.setState({ hoveredHandle: -1, hoveredFeature: this.annotation })) : (this.store.setState({ hoveredHandle: -1, hoveredFeature: null }), this.hoveredHandle = void 0);
@@ -1970,18 +1973,18 @@ class vs extends qt {
1970
1973
  if (this.isDrawingMode && this.dragging) {
1971
1974
  const a = this.clientToCanvas(t), l = this.store.getState(), h = this.getAnnotation();
1972
1975
  if (!h) return;
1973
- const c = l.liveUpdates[this.annotation], d = c ? { ...h, ...c } : h, g = l.drawingPoints.slice(0, -1), p = [
1976
+ const c = l.liveUpdates[this.annotation], d = c ? { ...h, ...c } : h, g = l.drawingPoints.slice(0, -1), f = [
1974
1977
  ...g,
1975
1978
  [a.x, a.y],
1976
1979
  g[0]
1977
1980
  ];
1978
- l.setDrawingPoints(p);
1979
- const f = me(
1980
- p,
1981
+ l.setDrawingPoints(f);
1982
+ const p = ye(
1983
+ f,
1981
1984
  // Exclude closing point
1982
1985
  this.simplificationTolerance,
1983
1986
  !1
1984
- ), m = [...f, f[0]];
1987
+ ), m = [...p, p[0]];
1985
1988
  l.applyLiveUpdate(this.annotation, {
1986
1989
  ...d,
1987
1990
  geometry: {
@@ -1995,7 +1998,7 @@ class vs extends qt {
1995
1998
  const n = this.clientToCanvas(t), s = n.x - this.dragStartPoint.x, r = n.y - this.dragStartPoint.y, o = this.getAnnotation();
1996
1999
  if (o) {
1997
2000
  if (this.hoveredHandle.type === "body")
1998
- fe(this.store, this.links, o.id, { x: s, y: r });
2001
+ pe(this.store, this.links, o.id, { x: s, y: r });
1999
2002
  else if (this.hoveredHandle.type === "vertex" && this.hoveredHandle.vertexIndex !== void 0) {
2000
2003
  const a = o.geometry.coordinates[0].map((h, c) => c === this.hoveredHandle.vertexIndex ? [
2001
2004
  this.hoveredHandle.point.x + s,
@@ -2010,7 +2013,7 @@ class vs extends qt {
2010
2013
  coordinates: [a]
2011
2014
  }
2012
2015
  };
2013
- en(l), this.store.getState().applyLiveUpdate(o.id, l), this.links.snapLinkedArrowsDuringDrag(o.id);
2016
+ nn(l), this.store.getState().applyLiveUpdate(o.id, l), this.links.snapLinkedArrowsDuringDrag(o.id);
2014
2017
  }
2015
2018
  this.dispatchEvent(new Event(Ut));
2016
2019
  }
@@ -2022,7 +2025,7 @@ class vs extends qt {
2022
2025
  const r = n.drawingPoints;
2023
2026
  if (r.length < 3) this.cancelDrawing();
2024
2027
  else {
2025
- const o = me(
2028
+ const o = ye(
2026
2029
  r.slice(1, -1),
2027
2030
  // Exclude closing point
2028
2031
  this.simplificationTolerance,
@@ -2035,7 +2038,7 @@ class vs extends qt {
2035
2038
  }
2036
2039
  };
2037
2040
  kt(a), this.store.getState().applyLiveUpdate(s.id, a), this.store.setState({ drawingFeature: null }), this.commitChange(), this.isDrawingMode = !1, this.dragging = !1, this.restorePanning(), this.dispatchEvent(
2038
- new CustomEvent(Ve, { detail: a })
2041
+ new CustomEvent(Ze, { detail: a })
2039
2042
  );
2040
2043
  }
2041
2044
  }
@@ -2048,7 +2051,7 @@ class vs extends qt {
2048
2051
  return this.store.getState().getFeature(this.annotation);
2049
2052
  }
2050
2053
  }
2051
- class Ss {
2054
+ class As {
2052
2055
  constructor(e, t, n, s = () => {
2053
2056
  }) {
2054
2057
  y(this, "layer");
@@ -2080,9 +2083,9 @@ class Ss {
2080
2083
  y(this, "update", () => {
2081
2084
  this.getAnnotation() && (this.updateStyle(), this.updatePosition(), this.layer.setSize(this.getSize()));
2082
2085
  });
2083
- var u, g, p;
2086
+ var u, g, f;
2084
2087
  this.ogma = e, this.store = t, this.annotation = n, this.onSendHandler = s;
2085
- const r = this.getPosition(), o = this.getSize(), a = this.getAnnotation(), l = this.store.getState(), h = D(a) && (((u = l.options) == null ? void 0 : u.showSendButton) ?? !0), c = ((g = l.options) == null ? void 0 : g.sendButtonIcon) || "", d = ((p = l.options) == null ? void 0 : p.textPlaceholder) || "Enter text";
2088
+ const r = this.getPosition(), o = this.getSize(), a = this.getAnnotation(), l = this.store.getState(), h = F(a) && (((u = l.options) == null ? void 0 : u.showSendButton) ?? !0), c = ((g = l.options) == null ? void 0 : g.sendButtonIcon) || "", d = ((f = l.options) == null ? void 0 : f.textPlaceholder) || "Enter text";
2086
2089
  this.layer = this.ogma.layers.addOverlay(
2087
2090
  {
2088
2091
  element: `<div class="ogma-annotation-text-editor">
@@ -2094,16 +2097,16 @@ class Ss {
2094
2097
  position: r,
2095
2098
  size: o
2096
2099
  },
2097
- de.EDITOR
2100
+ ue.EDITOR
2098
2101
  ), this.textarea = this.layer.element.querySelector("textarea"), this.textarea.setAttribute("wrap", "on"), this.textarea.setAttribute("spellcheck", "false"), this.textarea.value = a.properties.content || "", h && (this.sendButton = this.layer.element.querySelector(".ogma-send-button"), this.sendButton.addEventListener("click", this.onSendClick), this.updateSendButtonState()), this.isFocused = !1, this.textarea.addEventListener("focus", this.onFocus), this.textarea.addEventListener("blur", this.onBlur), this.textarea.addEventListener("input", this.onInput), this.textarea.addEventListener("keyup", this.onKeyup), this.textarea.addEventListener("keydown", this.onKeydown), this.textarea.addEventListener("wheel", this.onMouseEvent), this.textarea.addEventListener("mouseup", this.onMouseEvent), this.textarea.addEventListener("mousedown", this.onMouseEvent), this.textarea.addEventListener("click", this.onMouseEvent), this.textarea.addEventListener("drag", this.onMouseEvent), this.updateStyle(), this.updatePosition(), this.textarea.focus(), this.unsubscribe = this.store.subscribe(
2099
- (f) => ({
2100
- rotation: f.rotation,
2101
- zoom: f.zoom,
2102
- annotation: f.features[this.annotation]
2102
+ (p) => ({
2103
+ rotation: p.rotation,
2104
+ zoom: p.zoom,
2105
+ annotation: p.features[this.annotation]
2103
2106
  }),
2104
2107
  this.update,
2105
2108
  {
2106
- equalityFn: (f, m) => f.rotation === m.rotation && f.zoom === m.zoom && f.annotation === m.annotation
2109
+ equalityFn: (p, m) => p.rotation === m.rotation && p.zoom === m.zoom && p.annotation === m.annotation
2107
2110
  }
2108
2111
  );
2109
2112
  }
@@ -2116,7 +2119,7 @@ class Ss {
2116
2119
  getPosition() {
2117
2120
  const e = this.getAnnotation();
2118
2121
  if (!e) return { x: 0, y: 0 };
2119
- const t = e.properties.style, n = (t == null ? void 0 : t.fixedSize) || !1, s = t == null ? void 0 : t.maxHeight, r = this.store.getState().zoom, o = Gt(e), [a, l] = e.geometry.coordinates, h = e.properties.width;
2122
+ const t = e.properties.style, n = (t == null ? void 0 : t.fixedSize) || !1, s = t == null ? void 0 : t.maxHeight, r = this.store.getState().zoom, o = Vt(e), [a, l] = e.geometry.coordinates, h = e.properties.width;
2120
2123
  let c = e.properties.height;
2121
2124
  s && (c = Math.min(c, s));
2122
2125
  const d = n ? 1 / r : 1;
@@ -2129,11 +2132,11 @@ class Ss {
2129
2132
  var g;
2130
2133
  const e = this.getAnnotation();
2131
2134
  if (!e) return { width: 0, height: 0 };
2132
- const t = q(e), n = Gt(e), s = e.properties.style, r = (s == null ? void 0 : s.fixedSize) || !1, o = s == null ? void 0 : s.maxHeight, a = this.store.getState().zoom, l = this.store.getState(), h = D(e) && (((g = l.options) == null ? void 0 : g.showSendButton) ?? !0), c = r ? 1 / a : 1;
2135
+ const t = q(e), n = Vt(e), s = e.properties.style, r = (s == null ? void 0 : s.fixedSize) || !1, o = s == null ? void 0 : s.maxHeight, a = this.store.getState().zoom, l = this.store.getState(), h = F(e) && (((g = l.options) == null ? void 0 : g.showSendButton) ?? !0), c = r ? 1 / a : 1;
2133
2136
  let d = (t.height - n * 2) * c;
2134
2137
  if (o) {
2135
- const p = (o - n * 2) * c;
2136
- d = Math.min(d, p);
2138
+ const f = (o - n * 2) * c;
2139
+ d = Math.min(d, f);
2137
2140
  }
2138
2141
  const u = h ? 28 * c : 0;
2139
2142
  return {
@@ -2142,60 +2145,63 @@ class Ss {
2142
2145
  };
2143
2146
  }
2144
2147
  updateStyle() {
2145
- var x;
2148
+ var b;
2146
2149
  const e = this.getAnnotation();
2147
2150
  if (!e) return;
2148
- const {
2149
- font: t,
2150
- fontSize: n = U.fontSize,
2151
- borderRadius: s,
2152
- color: r,
2153
- background: o,
2154
- padding: a = 0,
2155
- fixedSize: l = U.fixedSize
2156
- } = e.properties.style || U, h = this.textarea, c = this.layer.element, d = this.store.getState().zoom, u = l ? 1 / d : 1, g = parseFloat(n.toString()) * u, p = a * u, f = c.style;
2157
- f.display = "grid", f.gridTemplateRows = "1fr auto", f.boxSizing = "border-box", f.background = o || "transparent", f.borderRadius = `${(s || 0) * u}px`, f.padding = `${p}px`, f.transformOrigin = "center", f.transform = `rotate(${this.store.getState().rotation}rad)`;
2158
- const m = h.style;
2159
- if (m.font = `${g} ${t}`, m.fontFamily = t || "sans-serif", m.fontSize = `${g}px`, m.lineHeight = `${g * $t}px`, m.padding = "0", m.border = "none", m.outline = "none", m.boxSizing = "border-box", m.color = r || "black", m.background = "transparent", m.flex = "1", m.minHeight = "0", m.resize = "none", this.sendButton) {
2160
- const b = 24 * u, v = 4 * u;
2161
- this.sendButton.style.width = `${b}px`, this.sendButton.style.height = `${b}px`, this.sendButton.style.padding = `${v}px`, this.sendButton.style.transform = "";
2162
- const S = this.sendButton.querySelector(
2151
+ const t = F(e) ? V : G, {
2152
+ font: n,
2153
+ fontSize: s = t.fontSize,
2154
+ borderRadius: r,
2155
+ color: o,
2156
+ background: a = t.background,
2157
+ padding: l = 0,
2158
+ fixedSize: h = t.fixedSize
2159
+ } = e.properties.style || t, c = this.textarea, d = this.layer.element, u = this.store.getState().zoom, g = h ? 1 / u : 1, f = parseFloat(s.toString()) * g, p = l * g, m = d.style;
2160
+ if (m.display = "grid", m.gridTemplateRows = "1fr auto", m.boxSizing = "border-box", m.background = a || "transparent", m.borderRadius = `${(r || 0) * g}px`, m.padding = `${p}px`, m.transformOrigin = "center", m.transform = `rotate(${this.store.getState().rotation}rad)`, e.properties.type === "comment") {
2161
+ const v = e.properties.style, S = (v == null ? void 0 : v.shadow) !== !1;
2162
+ m.boxShadow = S ? "0 2px 8px rgba(0, 0, 0, 0.15)" : "none";
2163
+ }
2164
+ const w = c.style;
2165
+ if (w.font = `${f} ${n}`, w.fontFamily = n || "sans-serif", w.fontSize = `${f}px`, w.lineHeight = `${f * $t}px`, w.padding = "0", w.border = "none", w.outline = "none", w.boxSizing = "border-box", w.color = o || "black", w.background = "transparent", w.flex = "1", w.minHeight = "0", w.resize = "none", this.sendButton) {
2166
+ const v = 24 * g, S = 4 * g;
2167
+ this.sendButton.style.width = `${v}px`, this.sendButton.style.height = `${v}px`, this.sendButton.style.padding = `${S}px`, this.sendButton.style.transform = "";
2168
+ const x = this.sendButton.querySelector(
2163
2169
  ".ogma-send-button-icon"
2164
2170
  );
2165
- if (S) {
2166
- const w = 16 * u;
2167
- S.style.width = `${w}px`, S.style.height = `${w}px`;
2171
+ if (x) {
2172
+ const A = 16 * g;
2173
+ x.style.width = `${A}px`, x.style.height = `${A}px`;
2168
2174
  }
2169
2175
  }
2170
- if (l) {
2171
- const b = (x = e.properties.style) == null ? void 0 : x.maxHeight, v = b && e.properties.height >= b;
2172
- m.overflowY = v ? "auto" : "hidden", m.overflowX = "hidden";
2176
+ if (h) {
2177
+ const v = (b = e.properties.style) == null ? void 0 : b.maxHeight, S = v && e.properties.height >= v;
2178
+ w.overflowY = S ? "auto" : "hidden", w.overflowX = "hidden";
2173
2179
  }
2174
2180
  }
2175
2181
  updatePosition() {
2176
2182
  this.layer.setPosition(this.getPosition());
2177
2183
  }
2178
2184
  updateContent() {
2179
- var o, a, l;
2185
+ var o, a, l, h;
2180
2186
  const e = this.getAnnotation();
2181
2187
  if (!e) return;
2182
2188
  let t = e.properties.height, n = e.geometry.coordinates;
2183
2189
  const s = (o = e.properties.style) == null ? void 0 : o.fixedSize;
2184
2190
  if (s) {
2185
- const h = this.textarea.style.height;
2191
+ const c = this.textarea.style.height;
2186
2192
  this.textarea.style.height = "0px";
2187
- const c = this.textarea.scrollHeight;
2188
- this.textarea.style.height = h;
2189
- const d = Gt(e), u = this.store.getState().zoom, g = (c + d * 2 / u) * u, p = ((a = e.properties.style) == null ? void 0 : a.minHeight) || 50;
2190
- t = Math.max(p, g);
2191
- const f = (l = e.properties.style) == null ? void 0 : l.maxHeight, m = e.properties.height, x = t - m;
2192
- if (Math.abs(x) > 1) {
2193
- const [b, v] = e.geometry.coordinates;
2194
- if (f && t > f) {
2195
- const S = f - m;
2196
- t = f, Math.abs(S) > 1 && (n = [b, v + S / 2]);
2193
+ const d = this.textarea.scrollHeight;
2194
+ this.textarea.style.height = c;
2195
+ const u = Vt(e), g = this.store.getState().zoom, f = ((a = e.properties.style) == null ? void 0 : a.padding) || 0, p = (d + u * 2 / g) * g + f * 2, m = ((l = e.properties.style) == null ? void 0 : l.minHeight) || 50;
2196
+ t = Math.max(m, p);
2197
+ const w = (h = e.properties.style) == null ? void 0 : h.maxHeight, b = e.properties.height, v = t - b;
2198
+ if (Math.abs(v) > 1) {
2199
+ const [S, x] = e.geometry.coordinates;
2200
+ if (w && t > w) {
2201
+ const A = w - b;
2202
+ t = w, Math.abs(A) > 1 && (n = [S, x + A / 2]);
2197
2203
  } else
2198
- n = [b, v + x / 2];
2204
+ n = [S, x + v / 2];
2199
2205
  }
2200
2206
  }
2201
2207
  const r = {
@@ -2221,21 +2227,21 @@ class Ss {
2221
2227
  this.store.getState().commitLiveUpdates(/* @__PURE__ */ new Set([this.annotation])), this.unsubscribe(), this.sendButton && this.sendButton.removeEventListener("click", this.onSendClick), this.layer.destroy();
2222
2228
  }
2223
2229
  }
2224
- function Gt(i) {
2230
+ function Vt(i) {
2225
2231
  var e;
2226
2232
  return ((e = i.properties.style) == null ? void 0 : e.strokeWidth) || 0;
2227
2233
  }
2228
- const Ae = { x: 1, y: 0 }, Ee = { x: 0, y: 1 }, As = [
2229
- ["top", Ee, -0.5, -0.5, 0.5, -0.5],
2230
- ["right", Ae, 0.5, -0.5, 0.5, 0.5],
2231
- ["bottom", Ee, -0.5, 0.5, 0.5, 0.5],
2232
- ["left", Ae, -0.5, -0.5, -0.5, 0.5]
2233
- ], Es = {
2234
+ const Ee = { x: 1, y: 0 }, Ce = { x: 0, y: 1 }, Es = [
2235
+ ["top", Ce, -0.5, -0.5, 0.5, -0.5],
2236
+ ["right", Ee, 0.5, -0.5, 0.5, 0.5],
2237
+ ["bottom", Ce, -0.5, 0.5, 0.5, 0.5],
2238
+ ["left", Ee, -0.5, -0.5, -0.5, 0.5]
2239
+ ], Cs = {
2234
2240
  top: [0, 1],
2235
2241
  right: [1, 2],
2236
2242
  bottom: [2, 3],
2237
2243
  left: [3, 0]
2238
- }, Ce = [
2244
+ }, ke = [
2239
2245
  [-0.5, -0.5],
2240
2246
  // top-left (index 0)
2241
2247
  [0.5, -0.5],
@@ -2244,7 +2250,7 @@ const Ae = { x: 1, y: 0 }, Ee = { x: 0, y: 1 }, As = [
2244
2250
  // bottom-right (index 2)
2245
2251
  [-0.5, 0.5]
2246
2252
  // bottom-left (index 3)
2247
- ], Cs = [
2253
+ ], ks = [
2248
2254
  I.nwResize,
2249
2255
  // top-left (0)
2250
2256
  I.neResize,
@@ -2254,7 +2260,7 @@ const Ae = { x: 1, y: 0 }, Ee = { x: 0, y: 1 }, As = [
2254
2260
  I.swResize
2255
2261
  // bottom-left (3)
2256
2262
  ];
2257
- class Vt extends qt {
2263
+ class Zt extends qt {
2258
2264
  constructor(t, n, s) {
2259
2265
  super(t, n);
2260
2266
  y(this, "links");
@@ -2263,7 +2269,7 @@ class Vt extends qt {
2263
2269
  y(this, "onClick", (t) => {
2264
2270
  const n = this.getAnnotation();
2265
2271
  if (n) {
2266
- if (D(n) && n.properties.mode === at) {
2272
+ if (F(n) && n.properties.mode === at) {
2267
2273
  this.store.getState().updateFeature(n.id, {
2268
2274
  properties: {
2269
2275
  ...n.properties,
@@ -2273,11 +2279,11 @@ class Vt extends qt {
2273
2279
  return;
2274
2280
  }
2275
2281
  if (this.store.getState().selectedFeatures.has(n.id)) {
2276
- if (D(n) && this.justActivated) {
2282
+ if (F(n) && this.justActivated) {
2277
2283
  this.justActivated = !1;
2278
2284
  return;
2279
2285
  }
2280
- n && (_(n) || D(n)) && this.startEditingText();
2286
+ n && (_(n) || F(n)) && this.startEditingText();
2281
2287
  }
2282
2288
  }
2283
2289
  });
@@ -2292,28 +2298,28 @@ class Vt extends qt {
2292
2298
  let { width: a, height: l } = q(s);
2293
2299
  const h = 5 / n, c = Q(s), d = this.store.getState();
2294
2300
  let { revSin: u, revCos: g } = d;
2295
- (W(s) || D(s)) && (u = 0, g = 1), this.hoveredHandle = void 0;
2296
- const p = Xn * (1 / n), f = r - c.x, m = o - c.y, x = f * g - m * u, b = f * u + m * g, v = ((S = s.properties.style) == null ? void 0 : S.fixedSize) === !0 || D(s);
2301
+ (W(s) || F(s)) && (u = 0, g = 1), this.hoveredHandle = void 0;
2302
+ const f = Xn * (1 / n), p = r - c.x, m = o - c.y, w = p * g - m * u, b = p * u + m * g, v = ((S = s.properties.style) == null ? void 0 : S.fixedSize) === !0 || F(s);
2297
2303
  if (v && (a /= n, l /= n), !v) {
2298
- for (let w = 0; w < Ce.length; w++) {
2299
- const [A, C] = Ce[w], E = a * A, k = l * C;
2300
- if (x >= E - p - h && x <= E + p + h && b >= k - p - h && b <= k + p + h) {
2304
+ for (let x = 0; x < ke.length; x++) {
2305
+ const [A, C] = ke[x], E = a * A, k = l * C;
2306
+ if (w >= E - f - h && w <= E + f + h && b >= k - f - h && b <= k + f + h) {
2301
2307
  this.hoveredHandle = {
2302
2308
  type: "corner",
2303
- corner: w
2304
- }, this.store.setState({ hoveredHandle: w, hoveredFeature: this.annotation }), this.setCursor(this.getCornerCursor(w));
2309
+ corner: x
2310
+ }, this.store.setState({ hoveredHandle: x, hoveredFeature: this.annotation }), this.setCursor(this.getCornerCursor(x));
2305
2311
  return;
2306
2312
  }
2307
2313
  }
2308
- for (const [w, A, C, E, k, F] of As) {
2309
- const j = a * C, z = l * E, R = a * k, et = l * F, Y = mt(A, { x: x - j, y: b - z });
2310
- if (Math.abs(Y) < h && x >= j - h && x <= R + h && b >= z - h && b <= et + h) {
2311
- this.hoveredHandle = { type: "edge", edge: w, corner: -1 }, this.store.setState({ hoveredHandle: Es[w][0] + 4, hoveredFeature: this.annotation }), this.setCursor(this.getEdgeCursor(w));
2314
+ for (const [x, A, C, E, k, P] of Es) {
2315
+ const O = a * C, N = l * E, B = a * k, et = l * P, nt = mt(A, { x: w - O, y: b - N });
2316
+ if (Math.abs(nt) < h && w >= O - h && w <= B + h && b >= N - h && b <= et + h) {
2317
+ this.hoveredHandle = { type: "edge", edge: x, corner: -1 }, this.store.setState({ hoveredHandle: Cs[x][0] + 4, hoveredFeature: this.annotation }), this.setCursor(this.getEdgeCursor(x));
2312
2318
  return;
2313
2319
  }
2314
2320
  }
2315
2321
  }
2316
- if (x >= -a / 2 - h && x <= a / 2 + h && b >= -l / 2 - h && b <= l / 2 + h) {
2322
+ if (w >= -a / 2 - h && w <= a / 2 + h && b >= -l / 2 - h && b <= l / 2 + h) {
2317
2323
  this.store.setState({ hoveredHandle: 8, hoveredFeature: this.annotation }), this.hoveredHandle = { type: "body", corner: -1 }, this.setCursor(I.grab);
2318
2324
  return;
2319
2325
  }
@@ -2327,7 +2333,7 @@ class Vt extends qt {
2327
2333
  y: s.y - this.dragStartPoint.y
2328
2334
  }, o = this.hoveredHandle, a = this.getAnnotation();
2329
2335
  let l = null;
2330
- o.type === "corner" ? l = this.dragCorner(a, r, o.corner) : o.type === "edge" && o.edge ? l = this.dragEdge(a, r, o) : o.type === "body" && (fe(this.store, this.links, n.id, r), this.textEditor && this.textEditor.update()), l && (this.store.getState().applyLiveUpdate(n.id, l), this.links.updateLinkedArrowsDuringDrag(n.id, r), this.textEditor && this.textEditor.update()), this.dispatchEvent(
2336
+ o.type === "corner" ? l = this.dragCorner(a, r, o.corner) : o.type === "edge" && o.edge ? l = this.dragEdge(a, r, o) : o.type === "body" && (pe(this.store, this.links, n.id, r), this.textEditor && this.textEditor.update()), l && (this.store.getState().applyLiveUpdate(n.id, l), this.links.updateLinkedArrowsDuringDrag(n.id, r), this.textEditor && this.textEditor.update()), this.dispatchEvent(
2331
2337
  new CustomEvent(Ut, {
2332
2338
  detail: {
2333
2339
  point: s,
@@ -2340,11 +2346,11 @@ class Vt extends qt {
2340
2346
  dragCorner(t, n, s) {
2341
2347
  const r = s === 0 || s === 1, o = s === 0 || s === 3, a = s === 1 || s === 2, l = s === 2 || s === 3, { width: h, height: c } = q(t), d = this.store.getState();
2342
2348
  let { revSin: u, revCos: g } = d;
2343
- (W(t) || D(t)) && (u = 0, g = 1);
2344
- const p = n.x * g - n.y * u, f = n.x * u + n.y * g;
2345
- let m = 0, x = 0;
2346
- o ? m = -p : a && (m = p), r ? x = -f : l && (x = f);
2347
- const b = Math.max(0, h + m), v = Math.max(0, c + x), S = Q(t), w = S.x + n.x / 2, A = S.y + n.y / 2;
2349
+ (W(t) || F(t)) && (u = 0, g = 1);
2350
+ const f = n.x * g - n.y * u, p = n.x * u + n.y * g;
2351
+ let m = 0, w = 0;
2352
+ o ? m = -f : a && (m = f), r ? w = -p : l && (w = p);
2353
+ const b = Math.max(0, h + m), v = Math.max(0, c + w), S = Q(t), x = S.x + n.x / 2, A = S.y + n.y / 2;
2348
2354
  return {
2349
2355
  ...t,
2350
2356
  properties: {
@@ -2354,41 +2360,41 @@ class Vt extends qt {
2354
2360
  },
2355
2361
  geometry: {
2356
2362
  type: t.geometry.type,
2357
- coordinates: [w, A]
2363
+ coordinates: [x, A]
2358
2364
  }
2359
2365
  };
2360
2366
  }
2361
2367
  dragEdge(t, n, s) {
2362
2368
  const { width: r, height: o } = q(t), a = Q(t), l = this.store.getState();
2363
2369
  let { revSin: h, revCos: c } = l;
2364
- (W(t) || D(t)) && (h = 0, c = 1);
2370
+ (W(t) || F(t)) && (h = 0, c = 1);
2365
2371
  const d = n.x * c - n.y * h, u = n.x * h + n.y * c;
2366
- let g = r, p = o, f = 0, m = 0;
2372
+ let g = r, f = o, p = 0, m = 0;
2367
2373
  switch (s.edge) {
2368
2374
  case "top":
2369
- p = Math.max(0, o - u), m = u / 2;
2375
+ f = Math.max(0, o - u), m = u / 2;
2370
2376
  break;
2371
2377
  case "bottom":
2372
- p = Math.max(0, o + u), m = u / 2;
2378
+ f = Math.max(0, o + u), m = u / 2;
2373
2379
  break;
2374
2380
  case "left":
2375
- g = Math.max(0, r - d), f = d / 2;
2381
+ g = Math.max(0, r - d), p = d / 2;
2376
2382
  break;
2377
2383
  case "right":
2378
- g = Math.max(0, r + d), f = d / 2;
2384
+ g = Math.max(0, r + d), p = d / 2;
2379
2385
  break;
2380
2386
  }
2381
- const x = f * c + m * h, b = -f * h + m * c;
2387
+ const w = p * c + m * h, b = -p * h + m * c;
2382
2388
  return {
2383
2389
  ...t,
2384
2390
  properties: {
2385
2391
  ...t.properties,
2386
2392
  width: g,
2387
- height: p
2393
+ height: f
2388
2394
  },
2389
2395
  geometry: {
2390
2396
  type: t.geometry.type,
2391
- coordinates: [a.x + x, a.y + b]
2397
+ coordinates: [a.x + w, a.y + b]
2392
2398
  }
2393
2399
  };
2394
2400
  }
@@ -2396,7 +2402,7 @@ class Vt extends qt {
2396
2402
  return super.onDragStart(t) ? (this.stopEditingText(), this.store.getState().startLiveUpdate([this.annotation]), !0) : !1;
2397
2403
  }
2398
2404
  startEditingText() {
2399
- this.textEditor === null && (this.store.setState({ editingFeature: this.annotation }), this.textEditor = new Ss(
2405
+ this.textEditor === null && (this.store.setState({ editingFeature: this.annotation }), this.textEditor = new As(
2400
2406
  this.ogma,
2401
2407
  this.store,
2402
2408
  this.annotation,
@@ -2414,7 +2420,7 @@ class Vt extends qt {
2414
2420
  })) : this.commitChange(), this.hoveredHandle = void 0, this.dragStartPoint = void 0, this.dragging = !1, !0;
2415
2421
  }
2416
2422
  getCornerCursor(t) {
2417
- return Cs[t];
2423
+ return ks[t];
2418
2424
  }
2419
2425
  getEdgeCursor(t) {
2420
2426
  switch (t) {
@@ -2442,7 +2448,7 @@ class Vt extends qt {
2442
2448
  this.dragStartPoint = r, this.disablePanning(), this.onDragStart({ clientX: r.x, clientY: r.y });
2443
2449
  }
2444
2450
  setAnnotation(t) {
2445
- t && D(t) && (this.justActivated = !0), super.setAnnotation(t), t && D(t) && t.properties.mode === at && this.store.getState().updateFeature(t.id, {
2451
+ t && F(t) && (this.justActivated = !0), super.setAnnotation(t), t && F(t) && t.properties.mode === at && this.store.getState().updateFeature(t.id, {
2446
2452
  properties: {
2447
2453
  ...t.properties,
2448
2454
  mode: Rt
@@ -2450,7 +2456,7 @@ class Vt extends qt {
2450
2456
  });
2451
2457
  }
2452
2458
  }
2453
- class ks extends EventTarget {
2459
+ class Ms extends EventTarget {
2454
2460
  constructor(t, n, s, r, o) {
2455
2461
  super();
2456
2462
  y(this, "handlers", /* @__PURE__ */ new Map());
@@ -2459,12 +2465,12 @@ class ks extends EventTarget {
2459
2465
  y(this, "ogma");
2460
2466
  y(this, "snapping");
2461
2467
  y(this, "store");
2462
- this.ogma = t, this.store = n, this.snapping = s, this.interaction = o, this.handlers.set("box", new Vt(this.ogma, this.store, r)), this.handlers.set("text", new Vt(this.ogma, this.store, r)), this.handlers.set("comment", new Vt(this.ogma, this.store, r)), this.handlers.set(
2468
+ this.ogma = t, this.store = n, this.snapping = s, this.interaction = o, this.handlers.set("box", new Zt(this.ogma, this.store, r)), this.handlers.set("text", new Zt(this.ogma, this.store, r)), this.handlers.set("comment", new Zt(this.ogma, this.store, r)), this.handlers.set(
2463
2469
  "arrow",
2464
- new bs(this.ogma, this.store, this.snapping, r)
2470
+ new vs(this.ogma, this.store, this.snapping, r)
2465
2471
  ), this.handlers.set(
2466
2472
  "polygon",
2467
- new vs(this.ogma, this.store, r)
2473
+ new Ss(this.ogma, this.store, r)
2468
2474
  ), this.handlers.forEach((a) => {
2469
2475
  a.addEventListener("dragstart", ((l) => {
2470
2476
  this.dispatchEvent(
@@ -2524,8 +2530,8 @@ class ks extends EventTarget {
2524
2530
  destroy() {
2525
2531
  }
2526
2532
  }
2527
- const Ms = ["x", "y", "radius"], Ts = 1;
2528
- class Fs {
2533
+ const Ts = ["x", "y", "radius"], Fs = 1;
2534
+ class Ps {
2529
2535
  constructor(e, t, n, s) {
2530
2536
  y(this, "links", /* @__PURE__ */ new Map());
2531
2537
  y(this, "nodeToLink", /* @__PURE__ */ new Map());
@@ -2551,7 +2557,7 @@ class Fs {
2551
2557
  var a;
2552
2558
  const r = e.getFeature(s);
2553
2559
  if (!r) return;
2554
- (_(r) && ((a = r.properties.style) == null ? void 0 : a.fixedSize) || D(r)) && n.forEach((l) => {
2560
+ (_(r) && ((a = r.properties.style) == null ? void 0 : a.fixedSize) || F(r)) && n.forEach((l) => {
2555
2561
  const h = this.links.get(l);
2556
2562
  if (!h) return;
2557
2563
  const c = h.arrow;
@@ -2559,7 +2565,7 @@ class Fs {
2559
2565
  });
2560
2566
  }), t.size > 0 && this.update(t);
2561
2567
  });
2562
- y(this, "throttledRefresh", rn(() => this.refresh(), 20));
2568
+ y(this, "throttledRefresh", on(() => this.refresh(), 20));
2563
2569
  y(this, "onAddRemoveEdges", (e) => {
2564
2570
  const t = e.edges;
2565
2571
  if (!t.size || !this.edgeToLink.size) return;
@@ -2593,7 +2599,7 @@ class Fs {
2593
2599
  const u = h.properties.link.start;
2594
2600
  this.add(
2595
2601
  h,
2596
- O,
2602
+ X,
2597
2603
  u.id,
2598
2604
  u.type,
2599
2605
  u.magnet
@@ -2613,7 +2619,7 @@ class Fs {
2613
2619
  const l = t[a];
2614
2620
  if (tt(l)) {
2615
2621
  const h = l;
2616
- this.remove(h, O), this.remove(h, it);
2622
+ this.remove(h, X), this.remove(h, it);
2617
2623
  } else {
2618
2624
  const h = this.annotationToLink.get(a);
2619
2625
  if (!h) return;
@@ -2648,7 +2654,7 @@ class Fs {
2648
2654
  if (!l) continue;
2649
2655
  const h = s.getFeature(l.arrow), c = Ht(h, l.side), d = dt(c, t), u = {
2650
2656
  ...h.geometry,
2651
- coordinates: h.geometry.coordinates.map((g, p) => l.side === O && p === 0 || l.side === it && p === 1 ? [d.x, d.y] : [...g])
2657
+ coordinates: h.geometry.coordinates.map((g, f) => l.side === X && f === 0 || l.side === it && f === 1 ? [d.x, d.y] : [...g])
2652
2658
  };
2653
2659
  n ? n[h.id] = {
2654
2660
  geometry: u
@@ -2671,20 +2677,20 @@ class Fs {
2671
2677
  let h = n.getFeature(l.arrow);
2672
2678
  const c = n.liveUpdates[h.id];
2673
2679
  h = c ? { ...h, ...c } : h;
2674
- const d = h.geometry.coordinates[l.side === O ? 0 : 1], u = {
2680
+ const d = h.geometry.coordinates[l.side === X ? 0 : 1], u = {
2675
2681
  x: d[0],
2676
2682
  y: d[1]
2677
2683
  };
2678
2684
  let g;
2679
- if (_(s) || D(s) || W(s) ? g = this.snapping.snapToText(u, [s]) : nt(s) && (g = this.snapping.snapToPolygon(u, [s])), !g) continue;
2680
- const p = g.point, f = {
2685
+ if (_(s) || F(s) || W(s) ? g = this.snapping.snapToText(u, [s]) : st(s) && (g = this.snapping.snapToPolygon(u, [s])), !g) continue;
2686
+ const f = g.point, p = {
2681
2687
  ...h.geometry,
2682
- coordinates: h.geometry.coordinates.map((m, x) => l.side === O && x === 0 || l.side === it && x === 1 ? [p.x, p.y] : [...m])
2688
+ coordinates: h.geometry.coordinates.map((m, w) => l.side === X && w === 0 || l.side === it && w === 1 ? [f.x, f.y] : [...m])
2683
2689
  };
2684
2690
  t ? t[h.id] = {
2685
- geometry: f
2691
+ geometry: p
2686
2692
  } : n.applyLiveUpdate(h.id, {
2687
- geometry: f
2693
+ geometry: p
2688
2694
  });
2689
2695
  }
2690
2696
  }
@@ -2693,8 +2699,8 @@ class Fs {
2693
2699
  let l = r;
2694
2700
  if (s === T.POLYGON) {
2695
2701
  const u = this.store.getState().getFeature(n);
2696
- if (u && nt(u)) {
2697
- const g = ye(u), p = g[2] - g[0], f = g[3] - g[1], m = r.x - g[0], x = r.y - g[1], b = p > 0 ? m / p : 0.5, v = f > 0 ? x / f : 0.5;
2702
+ if (u && st(u)) {
2703
+ const g = we(u), f = g[2] - g[0], p = g[3] - g[1], m = r.x - g[0], w = r.y - g[1], b = f > 0 ? m / f : 0.5, v = p > 0 ? w / p : 0.5;
2698
2704
  l = { x: b, y: v };
2699
2705
  }
2700
2706
  }
@@ -2748,27 +2754,27 @@ class Fs {
2748
2754
  n.set(g, this.linksByArrowId.get(g)), s.set(g, this.linksByArrowId.get(g));
2749
2755
  });
2750
2756
  });
2751
- const o = e.getAttributes(Ms), a = this.store.getState(), l = {};
2757
+ const o = e.getAttributes(Ts), a = this.store.getState(), l = {};
2752
2758
  for (let h = 0; h < t.length; h++) {
2753
2759
  const c = t[h], d = this.nodeToLink.get(c);
2754
2760
  if (d)
2755
2761
  for (const u of d) {
2756
2762
  const g = this.links.get(u);
2757
2763
  if (!g) continue;
2758
- const p = g.arrow, f = this.store.getState().getFeature(p), m = f.geometry.coordinates.slice(), x = Ht(f, it), b = Ht(f, O), v = o[h], S = this._getNodeSnapPoint(
2764
+ const f = g.arrow, p = this.store.getState().getFeature(f), m = p.geometry.coordinates.slice(), w = Ht(p, it), b = Ht(p, X), v = o[h], S = this._getNodeSnapPoint(
2759
2765
  v,
2760
- ot(X(x, b), -1),
2766
+ ot(Y(w, b), -1),
2761
2767
  this._isLinkedToCenter(g)
2762
2768
  );
2763
- m[g.side === O ? 0 : 1] = S, l[p] = {
2764
- ...f,
2769
+ m[g.side === X ? 0 : 1] = S, l[f] = {
2770
+ ...p,
2765
2771
  geometry: {
2766
2772
  coordinates: m
2767
2773
  }
2768
- }, this.updatedItems.add(p), g.magnet = {
2774
+ }, this.updatedItems.add(f), g.magnet = {
2769
2775
  x: S[0] - v.x,
2770
2776
  y: S[1] - v.y
2771
- }, kt(l[p]);
2777
+ }, kt(l[f]);
2772
2778
  }
2773
2779
  }
2774
2780
  if (a.applyLiveUpdates(l), s.size > 0) {
@@ -2783,13 +2789,13 @@ class Fs {
2783
2789
  const o = this.ogma.getNodes(n).getAttributes(["x", "y", "radius"]), a = {};
2784
2790
  e.forEach((l, h) => {
2785
2791
  const c = this.links.get(l.start), d = this.links.get(l.end), u = t.getFeature(h);
2786
- let g = u.geometry.coordinates[0], p = u.geometry.coordinates[1];
2787
- const f = c ? c.targetType === T.NODE ? o[s.get(c.target)] : c.targetType === T.EDGE ? this._getEdgeSnapPoint(c.target, c.magnet.x, !0) : this._getAnnotationCenter(t.getFeature(c.target)) : { x: g[0], y: g[1] }, m = d ? d.targetType === T.NODE ? o[s.get(d.target)] : d.targetType === T.EDGE ? this._getEdgeSnapPoint(d.target, d.magnet.x, !0) : this._getAnnotationCenter(t.getFeature(d.target)) : { x: p[0], y: p[1] }, x = X(m, f);
2792
+ let g = u.geometry.coordinates[0], f = u.geometry.coordinates[1];
2793
+ const p = c ? c.targetType === T.NODE ? o[s.get(c.target)] : c.targetType === T.EDGE ? this._getEdgeSnapPoint(c.target, c.magnet.x, !0) : this._getAnnotationCenter(t.getFeature(c.target)) : { x: g[0], y: g[1] }, m = d ? d.targetType === T.NODE ? o[s.get(d.target)] : d.targetType === T.EDGE ? this._getEdgeSnapPoint(d.target, d.magnet.x, !0) : this._getAnnotationCenter(t.getFeature(d.target)) : { x: f[0], y: f[1] }, w = Y(m, p);
2788
2794
  if (c)
2789
2795
  if (c.targetType === T.NODE)
2790
2796
  g = this._getNodeSnapPoint(
2791
- f,
2792
- x,
2797
+ p,
2798
+ w,
2793
2799
  this._isLinkedToCenter(c)
2794
2800
  );
2795
2801
  else if (c.targetType === T.EDGE)
@@ -2805,18 +2811,18 @@ class Fs {
2805
2811
  }
2806
2812
  if (d)
2807
2813
  if (d.targetType === T.NODE)
2808
- p = this._getNodeSnapPoint(
2814
+ f = this._getNodeSnapPoint(
2809
2815
  m,
2810
- ot(x, -1),
2816
+ ot(w, -1),
2811
2817
  this._isLinkedToCenter(d)
2812
2818
  );
2813
2819
  else if (d.targetType === T.EDGE)
2814
- p = this._getEdgeSnapPoint(d.target, d.magnet.x);
2820
+ f = this._getEdgeSnapPoint(d.target, d.magnet.x);
2815
2821
  else {
2816
2822
  const b = t.getFeature(d.target);
2817
- p = this._getAnnotationSnapPoint(
2823
+ f = this._getAnnotationSnapPoint(
2818
2824
  b,
2819
- f,
2825
+ p,
2820
2826
  d,
2821
2827
  t.zoom
2822
2828
  );
@@ -2824,23 +2830,23 @@ class Fs {
2824
2830
  a[u.id] = {
2825
2831
  properties: u.properties,
2826
2832
  geometry: {
2827
- coordinates: [g, p]
2833
+ coordinates: [g, f]
2828
2834
  }
2829
2835
  }, kt(a[u.id]), this.updatedItems.add(u.id);
2830
2836
  }), t.applyLiveUpdates(a), this.requestCommit();
2831
2837
  }
2832
2838
  requestCommit() {
2833
- clearTimeout(this.commitTimeout), this.commitTimeout = setTimeout(this.commit, Ts);
2839
+ clearTimeout(this.commitTimeout), this.commitTimeout = setTimeout(this.commit, Fs);
2834
2840
  }
2835
2841
  _isLinkedToCenter(e) {
2836
2842
  return e.magnet.x === 0 && e.magnet.y === 0;
2837
2843
  }
2838
2844
  _getAnnotationCenter(e) {
2839
- return nt(e) ? tn(e) : Q(e);
2845
+ return st(e) ? en(e) : Q(e);
2840
2846
  }
2841
2847
  _getAnnotationSnapPoint(e, t, n, s) {
2842
- if (nt(e)) {
2843
- const r = ye(e), o = r[0] + n.magnet.x * (r[2] - r[0]), a = r[1] + n.magnet.y * (r[3] - r[1]);
2848
+ if (st(e)) {
2849
+ const r = we(e), o = r[0] + n.magnet.x * (r[2] - r[0]), a = r[1] + n.magnet.y * (r[3] - r[1]);
2844
2850
  return [o, a];
2845
2851
  }
2846
2852
  return this._getBoxSnapPoint(e, t, n, s);
@@ -2849,14 +2855,14 @@ class Fs {
2849
2855
  var d;
2850
2856
  const r = Q(e);
2851
2857
  let { width: o, height: a } = q(e);
2852
- (_(e) && ((d = e.properties.style) == null ? void 0 : d.fixedSize) || D(e)) && (o /= s, a /= s);
2858
+ (_(e) && ((d = e.properties.style) == null ? void 0 : d.fixedSize) || F(e)) && (o /= s, a /= s);
2853
2859
  let h = n.magnet.x * o, c = n.magnet.y * a;
2854
2860
  if (_(e) && !W(e)) {
2855
- const { sin: u, cos: g } = this.store.getState(), p = h * g - c * u, f = h * u + c * g;
2856
- h = p, c = f;
2857
- } else if (D(e)) {
2858
- const g = { ...e.properties.style }.iconSize || 32, p = g / 16 * 0.5;
2859
- h = n.magnet.x * g * p, c = n.magnet.y * g * p;
2861
+ const { sin: u, cos: g } = this.store.getState(), f = h * g - c * u, p = h * u + c * g;
2862
+ h = f, c = p;
2863
+ } else if (F(e)) {
2864
+ const g = { ...e.properties.style }.iconSize || 32, f = g / 16 * 0.5;
2865
+ h = n.magnet.x * g * f, c = n.magnet.y * g * f;
2860
2866
  }
2861
2867
  return [r.x + h, r.y + c];
2862
2868
  }
@@ -2897,7 +2903,7 @@ class Fs {
2897
2903
  this.ogma.events.off(this.onSetMultipleAttributes);
2898
2904
  }
2899
2905
  }
2900
- function Ps(i, e, t, n, s = 20) {
2906
+ function Ds(i, e, t, n, s = 20) {
2901
2907
  let r = 0, o = 1 / 0, a = null;
2902
2908
  for (let l = 0; l <= s; l++) {
2903
2909
  const h = l / s, c = zt.getPointOnQuadraticCurve(
@@ -2908,18 +2914,18 @@ function Ps(i, e, t, n, s = 20) {
2908
2914
  t.y,
2909
2915
  n.x,
2910
2916
  n.y
2911
- ), d = K(X(c, i));
2917
+ ), d = J(Y(c, i));
2912
2918
  d < o && (o = d, a = c, r = h);
2913
2919
  }
2914
2920
  return a ? { t: r, point: a, distance: o } : null;
2915
2921
  }
2916
- function Ds(i, e, t) {
2922
+ function Ls(i, e, t) {
2917
2923
  const n = t.x - e.x, s = t.y - e.y, r = n * n + s * s;
2918
2924
  if (r === 0)
2919
2925
  return {
2920
2926
  t: 0,
2921
2927
  point: { x: e.x, y: e.y },
2922
- distance: K(X(e, i))
2928
+ distance: J(Y(e, i))
2923
2929
  };
2924
2930
  const o = Math.max(
2925
2931
  0,
@@ -2934,30 +2940,30 @@ function Ds(i, e, t) {
2934
2940
  return {
2935
2941
  t: o,
2936
2942
  point: a,
2937
- distance: K(X(a, i))
2943
+ distance: J(Y(a, i))
2938
2944
  };
2939
2945
  }
2940
- function Ls(i, e, t) {
2946
+ function Hs(i, e, t) {
2941
2947
  let n = null, s = t;
2942
2948
  const r = e.getAttribute("curvature"), a = e.getExtremities().getPosition();
2943
2949
  for (let l = 0; l < e.size; l++) {
2944
2950
  const h = e.get(l), c = r[l], d = a[2 * l], u = a[2 * l + 1];
2945
2951
  let g;
2946
2952
  if (c === 0 || c === void 0)
2947
- g = Ds(i, d, u);
2953
+ g = Ls(i, d, u);
2948
2954
  else {
2949
- const p = zt.getQuadraticCurveControlPoint(
2955
+ const f = zt.getQuadraticCurveControlPoint(
2950
2956
  d.x,
2951
2957
  d.y,
2952
2958
  u.x,
2953
2959
  u.y,
2954
2960
  c
2955
2961
  );
2956
- g = Ps(
2962
+ g = Ds(
2957
2963
  i,
2958
2964
  d,
2959
2965
  u,
2960
- p
2966
+ f
2961
2967
  );
2962
2968
  }
2963
2969
  g && g.distance < s && (s = g.distance, n = {
@@ -2969,10 +2975,10 @@ function Ls(i, e, t) {
2969
2975
  }
2970
2976
  return n;
2971
2977
  }
2972
- function Hs(i, e, t) {
2978
+ function _s(i, e, t) {
2973
2979
  const n = e.getAttributes(["x", "y", "radius"]);
2974
2980
  for (let s = 0; s < n.length; s++) {
2975
- const r = n[s], o = X({ x: r.x, y: r.y }, i), a = K(o);
2981
+ const r = n[s], o = Y({ x: r.x, y: r.y }, i), a = J(o);
2976
2982
  if (a >= Number(r.radius) + Number(t)) continue;
2977
2983
  const l = ot(o, 1 / a), h = a < Number(r.radius) / 2, c = h ? { x: r.x, y: r.y } : dt({ x: r.x, y: r.y }, ot(l, -Number(r.radius))), d = h ? { x: 0, y: 0 } : l;
2978
2984
  return {
@@ -2984,7 +2990,7 @@ function Hs(i, e, t) {
2984
2990
  }
2985
2991
  return null;
2986
2992
  }
2987
- function _s(i, e) {
2993
+ function Is(i, e) {
2988
2994
  let t = !1;
2989
2995
  for (let n = 0, s = e.length - 1; n < e.length; s = n++) {
2990
2996
  const r = e[n][0], o = e[n][1], a = e[s][0], l = e[s][1];
@@ -2992,27 +2998,27 @@ function _s(i, e) {
2992
2998
  }
2993
2999
  return t;
2994
3000
  }
2995
- function Is(i, e, t, n, s) {
3001
+ function zs(i, e, t, n, s) {
2996
3002
  const r = i * i, o = r * i, a = 1 - i, l = a * a, h = l * a;
2997
3003
  return {
2998
3004
  x: h * e.x + 3 * l * i * t.x + 3 * a * r * n.x + o * s.x,
2999
3005
  y: h * e.y + 3 * l * i * t.y + 3 * a * r * n.y + o * s.y
3000
3006
  };
3001
3007
  }
3002
- function zs(i, e, t, n, s) {
3008
+ function Bs(i, e, t, n, s) {
3003
3009
  let r = 1 / 0, o = null;
3004
3010
  const a = 20;
3005
3011
  for (let l = 0; l <= a; l++) {
3006
- const h = l / a, c = Is(h, e, t, n, s), d = K(X(c, i));
3012
+ const h = l / a, c = zs(h, e, t, n, s), d = J(Y(c, i));
3007
3013
  d < r && (r = d, o = c);
3008
3014
  }
3009
3015
  return o ? { point: o, distance: r } : null;
3010
3016
  }
3011
- function Bs(i, e, t) {
3017
+ function Rs(i, e, t) {
3012
3018
  const n = e.geometry.coordinates[0];
3013
3019
  for (let s = 0; s < n.length - 1; s++) {
3014
3020
  const [r, o] = n[s];
3015
- if (K(X({ x: r, y: o }, i)) < t)
3021
+ if (J(Y({ x: r, y: o }, i)) < t)
3016
3022
  return {
3017
3023
  point: { x: r, y: o },
3018
3024
  magnet: { x: r, y: o },
@@ -3021,14 +3027,14 @@ function Bs(i, e, t) {
3021
3027
  };
3022
3028
  }
3023
3029
  for (let s = 0; s < n.length - 1; s++) {
3024
- const [r, o] = n[s], [a, l] = n[s + 1], h = { x: r, y: o }, d = X({ x: a, y: l }, h), u = K(d), g = {
3030
+ const [r, o] = n[s], [a, l] = n[s + 1], h = { x: r, y: o }, d = Y({ x: a, y: l }, h), u = J(d), g = {
3025
3031
  x: d.x / u,
3026
3032
  y: d.y / u
3027
- }, p = { x: -g.y, y: g.x }, f = X(i, h), m = Math.abs(mt(p, f)), x = mt(g, f);
3028
- if (x >= 0 && x <= u && m < t) {
3033
+ }, f = { x: -g.y, y: g.x }, p = Y(i, h), m = Math.abs(mt(f, p)), w = mt(g, p);
3034
+ if (w >= 0 && w <= u && m < t) {
3029
3035
  const b = {
3030
- x: h.x + g.x * x,
3031
- y: h.y + g.y * x
3036
+ x: h.x + g.x * w,
3037
+ y: h.y + g.y * w
3032
3038
  };
3033
3039
  return {
3034
3040
  point: b,
@@ -3040,14 +3046,14 @@ function Bs(i, e, t) {
3040
3046
  }
3041
3047
  return null;
3042
3048
  }
3043
- function Rs(i, e, t) {
3049
+ function $s(i, e, t) {
3044
3050
  for (const s of e) {
3045
3051
  const o = s.geometry.coordinates[0].slice(0, -1);
3046
3052
  if (o.length < 3)
3047
- return Bs(i, s, t);
3053
+ return Rs(i, s, t);
3048
3054
  for (let c = 0; c < o.length; c++) {
3049
3055
  const [d, u] = o[c];
3050
- if (K(X({ x: d, y: u }, i)) < t)
3056
+ if (J(Y({ x: d, y: u }, i)) < t)
3051
3057
  return {
3052
3058
  point: { x: d, y: u },
3053
3059
  magnet: { x: d, y: u },
@@ -3055,14 +3061,14 @@ function Rs(i, e, t) {
3055
3061
  id: s.id
3056
3062
  };
3057
3063
  }
3058
- const a = _s(i, o);
3064
+ const a = Is(i, o);
3059
3065
  let l = null, h = a ? 1 / 0 : t;
3060
3066
  for (let c = 0; c < o.length; c++) {
3061
- const d = o[(c - 1 + o.length) % o.length], u = o[c], g = o[(c + 1) % o.length], p = o[(c + 2) % o.length], f = u[0] + (g[0] - d[0]) / 6 * 0.5, m = u[1] + (g[1] - d[1]) / 6 * 0.5, x = g[0] - (p[0] - u[0]) / 6 * 0.5, b = g[1] - (p[1] - u[1]) / 6 * 0.5, v = zs(
3067
+ const d = o[(c - 1 + o.length) % o.length], u = o[c], g = o[(c + 1) % o.length], f = o[(c + 2) % o.length], p = u[0] + (g[0] - d[0]) / 6 * 0.5, m = u[1] + (g[1] - d[1]) / 6 * 0.5, w = g[0] - (f[0] - u[0]) / 6 * 0.5, b = g[1] - (f[1] - u[1]) / 6 * 0.5, v = Bs(
3062
3068
  i,
3063
3069
  { x: u[0], y: u[1] },
3064
- { x: f, y: m },
3065
- { x, y: b },
3070
+ { x: p, y: m },
3071
+ { x: w, y: b },
3066
3072
  { x: g[0], y: g[1] }
3067
3073
  );
3068
3074
  if (v) {
@@ -3088,7 +3094,7 @@ function Rs(i, e, t) {
3088
3094
  }
3089
3095
  return null;
3090
3096
  }
3091
- const fn = [
3097
+ const pn = [
3092
3098
  { x: -0.5, y: -0.5 },
3093
3099
  { x: 0, y: -0.5 },
3094
3100
  { x: 0.5, y: -0.5 },
@@ -3099,7 +3105,7 @@ const fn = [
3099
3105
  { x: 0.5, y: 0.5 },
3100
3106
  { x: 0, y: 0 }
3101
3107
  // center
3102
- ], $s = [
3108
+ ], Ns = [
3103
3109
  [-0.5, -0.5, 0.5, -0.5],
3104
3110
  // top
3105
3111
  [0.5, -0.5, 0.5, 0.5],
@@ -3109,29 +3115,29 @@ const fn = [
3109
3115
  [-0.5, 0.5, -0.5, -0.5]
3110
3116
  // left
3111
3117
  ];
3112
- function ke(i, e, t, n, s, r, o, a, l) {
3118
+ function Me(i, e, t, n, s, r, o, a, l) {
3113
3119
  const h = i * s, c = e * r;
3114
3120
  return l ? {
3115
3121
  x: t + (h * o - c * a),
3116
3122
  y: n + (h * a + c * o)
3117
3123
  } : { x: t + h, y: n + c };
3118
3124
  }
3119
- function Ns(i, e, t, n, s) {
3125
+ function Ys(i, e, t, n, s) {
3120
3126
  var c;
3121
3127
  const r = Q(e);
3122
3128
  let { width: o, height: a } = q(e);
3123
3129
  const { sin: l, cos: h } = s.getState();
3124
3130
  (c = e.properties.style) != null && c.fixedSize && (o /= t, a /= t);
3125
- for (const d of fn) {
3131
+ for (const d of pn) {
3126
3132
  let u = d.x * o, g = d.y * a;
3127
3133
  if (!W(e)) {
3128
- const m = u * h - g * l, x = u * l + g * h;
3129
- u = m, g = x;
3134
+ const m = u * h - g * l, w = u * l + g * h;
3135
+ u = m, g = w;
3130
3136
  }
3131
- const p = { x: r.x + u, y: r.y + g };
3132
- if (!(K(X(p, i)) >= n))
3137
+ const f = { x: r.x + u, y: r.y + g };
3138
+ if (!(J(Y(f, i)) >= n))
3133
3139
  return {
3134
- point: { x: p.x, y: p.y },
3140
+ point: { x: f.x, y: f.y },
3135
3141
  type: T.TEXT,
3136
3142
  magnet: d,
3137
3143
  id: e.id
@@ -3139,32 +3145,32 @@ function Ns(i, e, t, n, s) {
3139
3145
  }
3140
3146
  return null;
3141
3147
  }
3142
- function Ys(i, e, t, n, s) {
3143
- var p;
3148
+ function Os(i, e, t, n, s) {
3149
+ var f;
3144
3150
  const { x: r, y: o } = Q(e);
3145
3151
  let { width: a, height: l } = q(e);
3146
- (p = e.properties.style) != null && p.fixedSize && (a /= t, l /= t);
3152
+ (f = e.properties.style) != null && f.fixedSize && (a /= t, l /= t);
3147
3153
  const { sin: h, cos: c } = s.getState(), d = !W(e);
3148
3154
  let u = null, g = 1 / 0;
3149
- for (let f = 0; f < 4; f++) {
3150
- const [m, x, b, v] = $s[f], S = ke(m, x, r, o, a, l, c, h, d), w = ke(b, v, r, o, a, l, c, h, d), A = X(w, S), C = K(A), E = { x: A.x / C, y: A.y / C }, k = { x: -E.y, y: E.x }, F = X(i, S), j = mt(k, F), z = mt(E, F);
3151
- if (z >= 0 && z <= C) {
3152
- const R = Math.abs(j);
3153
- if (R < n || R < g) {
3154
- const et = z / C, Y = {
3155
+ for (let p = 0; p < 4; p++) {
3156
+ const [m, w, b, v] = Ns[p], S = Me(m, w, r, o, a, l, c, h, d), x = Me(b, v, r, o, a, l, c, h, d), A = Y(x, S), C = J(A), E = { x: A.x / C, y: A.y / C }, k = { x: -E.y, y: E.x }, P = Y(i, S), O = mt(k, P), N = mt(E, P);
3157
+ if (N >= 0 && N <= C) {
3158
+ const B = Math.abs(O);
3159
+ if (B < n || B < g) {
3160
+ const et = N / C, nt = {
3155
3161
  point: {
3156
- x: S.x + E.x * z,
3157
- y: S.y + E.y * z
3162
+ x: S.x + E.x * N,
3163
+ y: S.y + E.y * N
3158
3164
  },
3159
3165
  magnet: {
3160
3166
  x: m + (b - m) * et,
3161
- y: x + (v - x) * et
3167
+ y: w + (v - w) * et
3162
3168
  },
3163
3169
  type: T.TEXT,
3164
3170
  id: e.id
3165
3171
  };
3166
- if (R < n) return Y;
3167
- R < g && (g = R, u = Y);
3172
+ if (B < n) return nt;
3173
+ B < g && (g = B, u = nt);
3168
3174
  }
3169
3175
  }
3170
3176
  }
@@ -3172,12 +3178,12 @@ function Ys(i, e, t, n, s) {
3172
3178
  }
3173
3179
  function Xs(i, e, t, n, s) {
3174
3180
  for (const r of e) {
3175
- const o = Ns(i, r, t, n, s) || Ys(i, r, t, n, s);
3181
+ const o = Ys(i, r, t, n, s) || Os(i, r, t, n, s);
3176
3182
  if (o) return o;
3177
3183
  }
3178
3184
  return null;
3179
3185
  }
3180
- class Os extends EventTarget {
3186
+ class Us extends EventTarget {
3181
3187
  constructor(t, n, s, r) {
3182
3188
  super();
3183
3189
  y(this, "ogma");
@@ -3197,7 +3203,7 @@ class Os extends EventTarget {
3197
3203
  minY: t.y - n,
3198
3204
  maxX: t.x + n,
3199
3205
  maxY: t.y + n
3200
- }, r = this.spatialIndex.search(s), o = r.filter((p) => _(p) || W(p)), a = r.filter((p) => nt(p)), { nodes: l, edges: h } = this.ogma.view.getElementsInside(
3206
+ }, r = this.spatialIndex.search(s), o = r.filter((f) => _(f) || W(f)), a = r.filter((f) => st(f)), { nodes: l, edges: h } = this.ogma.view.getElementsInside(
3201
3207
  s.minX,
3202
3208
  s.minY,
3203
3209
  s.maxX,
@@ -3216,13 +3222,13 @@ class Os extends EventTarget {
3216
3222
  return Xs(t, n, s, this.options.magnetRadius, this.store);
3217
3223
  }
3218
3224
  snapToPolygon(t, n) {
3219
- return Rs(t, n, this.options.magnetRadius);
3225
+ return $s(t, n, this.options.magnetRadius);
3220
3226
  }
3221
3227
  snapToNodes(t, n) {
3222
- return Hs(t, n, this.options.detectMargin);
3228
+ return _s(t, n, this.options.detectMargin);
3223
3229
  }
3224
3230
  snapToEdges(t, n) {
3225
- return Ls(t, n, this.options.magnetRadius);
3231
+ return Hs(t, n, this.options.magnetRadius);
3226
3232
  }
3227
3233
  getHoveredNode() {
3228
3234
  return this.hoveredNode;
@@ -3232,10 +3238,10 @@ class Os extends EventTarget {
3232
3238
  (t = this.hoveredNode) == null || t.setSelected(!1), this.hoveredNode = null;
3233
3239
  }
3234
3240
  getMagnets() {
3235
- return fn;
3241
+ return pn;
3236
3242
  }
3237
3243
  }
3238
- class Us extends EventTarget {
3244
+ class qs extends EventTarget {
3239
3245
  // pixels
3240
3246
  constructor(t, n, s) {
3241
3247
  super();
@@ -3291,7 +3297,7 @@ class Us extends EventTarget {
3291
3297
  mousePressPoint: null
3292
3298
  }), this.mouseDownState && !this.mouseDownState.hasMoved && !n.isDragging) {
3293
3299
  const s = this.mouseDownState.annotation;
3294
- s ? t.ctrlKey || t.metaKey ? n.toggleSelection(s.id) : n.selectedFeatures.has(s.id) || n.setSelectedFeatures([s.id]) : !t.ctrlKey && !t.metaKey && n.clearSelection(), this.dispatchEvent(new CustomEvent(re, {
3300
+ s ? t.ctrlKey || t.metaKey ? n.toggleSelection(s.id) : n.selectedFeatures.has(s.id) || n.setSelectedFeatures([s.id]) : !t.ctrlKey && !t.metaKey && n.clearSelection(), this.dispatchEvent(new CustomEvent(oe, {
3295
3301
  detail: {
3296
3302
  id: (s == null ? void 0 : s.id) ?? null,
3297
3303
  position: {
@@ -3310,7 +3316,7 @@ class Us extends EventTarget {
3310
3316
  t,
3311
3317
  this.ogma.getContainer()
3312
3318
  ), { x: s, y: r } = this.ogma.view.screenToGraphCoordinates(n), o = this.detect(s, r);
3313
- if (!o || !D(o)) return;
3319
+ if (!o || !F(o)) return;
3314
3320
  const a = (d = o.properties.style) == null ? void 0 : d.maxHeight, l = o.properties.height;
3315
3321
  if (!a || l <= a) return;
3316
3322
  const h = this.ogma.getContainer(), c = h == null ? void 0 : h.querySelector(
@@ -3346,22 +3352,22 @@ class Us extends EventTarget {
3346
3352
  for (const h of l) {
3347
3353
  const c = o.getFeature(h.id);
3348
3354
  if (tt(c)) {
3349
- if (an(c, { x: t, y: n }, a)) {
3355
+ if (cn(c, { x: t, y: n }, a)) {
3350
3356
  r = c;
3351
3357
  break;
3352
3358
  }
3353
3359
  } else if (W(c)) {
3354
- if (ss(c, { x: t, y: n }, 0, 1, a)) {
3360
+ if (is(c, { x: t, y: n }, 0, 1, a)) {
3355
3361
  r = c;
3356
3362
  break;
3357
3363
  }
3358
- } else if (nt(c)) {
3359
- if (hn(c, { x: t, y: n }, a)) {
3364
+ } else if (st(c)) {
3365
+ if (dn(c, { x: t, y: n }, a)) {
3360
3366
  r = c;
3361
3367
  break;
3362
3368
  }
3363
- } else if (D(c)) {
3364
- if (is(
3369
+ } else if (F(c)) {
3370
+ if (rs(
3365
3371
  c,
3366
3372
  { x: t, y: n },
3367
3373
  a,
@@ -3372,7 +3378,7 @@ class Us extends EventTarget {
3372
3378
  r = c;
3373
3379
  break;
3374
3380
  }
3375
- } else if (_(c) && cn(
3381
+ } else if (_(c) && ln(
3376
3382
  c,
3377
3383
  { x: t, y: n },
3378
3384
  a,
@@ -3409,11 +3415,11 @@ class Us extends EventTarget {
3409
3415
  t && (t.removeEventListener("mousemove", this.onMouseMove), t.removeEventListener("click", this.onMouseClick));
3410
3416
  }
3411
3417
  }
3412
- function pn(i, e, t = 0, n = i.length - 1, s = qs) {
3418
+ function mn(i, e, t = 0, n = i.length - 1, s = Ws) {
3413
3419
  for (; n > t; ) {
3414
3420
  if (n - t > 600) {
3415
- const l = n - t + 1, h = e - t + 1, c = Math.log(l), d = 0.5 * Math.exp(2 * c / 3), u = 0.5 * Math.sqrt(c * d * (l - d) / l) * (h - l / 2 < 0 ? -1 : 1), g = Math.max(t, Math.floor(e - h * d / l + u)), p = Math.min(n, Math.floor(e + (l - h) * d / l + u));
3416
- pn(i, e, g, p, s);
3421
+ const l = n - t + 1, h = e - t + 1, c = Math.log(l), d = 0.5 * Math.exp(2 * c / 3), u = 0.5 * Math.sqrt(c * d * (l - d) / l) * (h - l / 2 < 0 ? -1 : 1), g = Math.max(t, Math.floor(e - h * d / l + u)), f = Math.min(n, Math.floor(e + (l - h) * d / l + u));
3422
+ mn(i, e, g, f, s);
3417
3423
  }
3418
3424
  const r = i[e];
3419
3425
  let o = t, a = n;
@@ -3428,10 +3434,10 @@ function wt(i, e, t) {
3428
3434
  const n = i[e];
3429
3435
  i[e] = i[t], i[t] = n;
3430
3436
  }
3431
- function qs(i, e) {
3437
+ function Ws(i, e) {
3432
3438
  return i < e ? -1 : i > e ? 1 : 0;
3433
3439
  }
3434
- class Ws {
3440
+ class js {
3435
3441
  constructor(e = 9) {
3436
3442
  this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
3437
3443
  }
@@ -3446,7 +3452,7 @@ class Ws {
3446
3452
  for (; t; ) {
3447
3453
  for (let o = 0; o < t.children.length; o++) {
3448
3454
  const a = t.children[o], l = t.leaf ? s(a) : a;
3449
- Lt(e, l) && (t.leaf ? n.push(a) : Kt(e, l) ? this._all(a, n) : r.push(a));
3455
+ Lt(e, l) && (t.leaf ? n.push(a) : Jt(e, l) ? this._all(a, n) : r.push(a));
3450
3456
  }
3451
3457
  t = r.pop();
3452
3458
  }
@@ -3460,7 +3466,7 @@ class Ws {
3460
3466
  for (let s = 0; s < t.children.length; s++) {
3461
3467
  const r = t.children[s], o = t.leaf ? this.toBBox(r) : r;
3462
3468
  if (Lt(e, o)) {
3463
- if (t.leaf || Kt(e, o)) return !0;
3469
+ if (t.leaf || Jt(e, o)) return !0;
3464
3470
  n.push(r);
3465
3471
  }
3466
3472
  }
@@ -3502,11 +3508,11 @@ class Ws {
3502
3508
  let a, l, h;
3503
3509
  for (; n || r.length; ) {
3504
3510
  if (n || (n = r.pop(), l = r[r.length - 1], a = o.pop(), h = !0), n.leaf) {
3505
- const c = js(e, n.children, t);
3511
+ const c = Gs(e, n.children, t);
3506
3512
  if (c !== -1)
3507
3513
  return n.children.splice(c, 1), r.push(n), this._condense(r), this;
3508
3514
  }
3509
- !h && !n.leaf && Kt(n, s) ? (r.push(n), o.push(a), a = 0, l = n, n = n.children[0]) : l ? (a++, n = l.children[a], h = !1) : n = null;
3515
+ !h && !n.leaf && Jt(n, s) ? (r.push(n), o.push(a), a = 0, l = n, n = n.children[0]) : l ? (a++, n = l.children[a], h = !1) : n = null;
3510
3516
  }
3511
3517
  return this;
3512
3518
  }
@@ -3538,10 +3544,10 @@ class Ws {
3538
3544
  return a = pt(e.slice(t, n + 1)), gt(a, this.toBBox), a;
3539
3545
  s || (s = Math.ceil(Math.log(r) / Math.log(o)), o = Math.ceil(r / Math.pow(o, s - 1))), a = pt([]), a.leaf = !1, a.height = s;
3540
3546
  const l = Math.ceil(r / o), h = l * Math.ceil(Math.sqrt(o));
3541
- Me(e, t, n, h, this.compareMinX);
3547
+ Te(e, t, n, h, this.compareMinX);
3542
3548
  for (let c = t; c <= n; c += h) {
3543
3549
  const d = Math.min(c + h - 1, n);
3544
- Me(e, c, d, l, this.compareMinY);
3550
+ Te(e, c, d, l, this.compareMinY);
3545
3551
  for (let u = c; u <= d; u += l) {
3546
3552
  const g = Math.min(u + l - 1, d);
3547
3553
  a.children.push(this._build(e, u, g, s - 1));
@@ -3553,7 +3559,7 @@ class Ws {
3553
3559
  for (; s.push(t), !(t.leaf || s.length - 1 === n); ) {
3554
3560
  let r = 1 / 0, o = 1 / 0, a;
3555
3561
  for (let l = 0; l < t.children.length; l++) {
3556
- const h = t.children[l], c = Zt(h), d = Zs(e, h) - c;
3562
+ const h = t.children[l], c = Kt(h), d = Ks(e, h) - c;
3557
3563
  d < o ? (o = d, r = c < r ? c : r, a = h) : d === o && c < r && (r = c, a = h);
3558
3564
  }
3559
3565
  t = a || t.children[0];
@@ -3579,14 +3585,14 @@ class Ws {
3579
3585
  _chooseSplitIndex(e, t, n) {
3580
3586
  let s, r = 1 / 0, o = 1 / 0;
3581
3587
  for (let a = t; a <= n - t; a++) {
3582
- const l = bt(e, 0, a, this.toBBox), h = bt(e, a, n, this.toBBox), c = Ks(l, h), d = Zt(l) + Zt(h);
3588
+ const l = bt(e, 0, a, this.toBBox), h = bt(e, a, n, this.toBBox), c = Js(l, h), d = Kt(l) + Kt(h);
3583
3589
  c < r ? (r = c, s = a, o = d < o ? d : o) : c === r && d < o && (o = d, s = a);
3584
3590
  }
3585
3591
  return s || n - t;
3586
3592
  }
3587
3593
  // sorts node children by the best axis for split
3588
3594
  _chooseSplitAxis(e, t, n) {
3589
- const s = e.leaf ? this.compareMinX : Gs, r = e.leaf ? this.compareMinY : Vs, o = this._allDistMargin(e, t, n, s), a = this._allDistMargin(e, t, n, r);
3595
+ const s = e.leaf ? this.compareMinX : Vs, r = e.leaf ? this.compareMinY : Zs, o = this._allDistMargin(e, t, n, s), a = this._allDistMargin(e, t, n, r);
3590
3596
  o < a && e.children.sort(s);
3591
3597
  }
3592
3598
  // total margin of all possible split distributions where each node is at least m full
@@ -3613,7 +3619,7 @@ class Ws {
3613
3619
  e[t].children.length === 0 ? t > 0 ? (n = e[t - 1].children, n.splice(n.indexOf(e[t]), 1)) : this.clear() : gt(e[t], this.toBBox);
3614
3620
  }
3615
3621
  }
3616
- function js(i, e, t) {
3622
+ function Gs(i, e, t) {
3617
3623
  if (!t) return e.indexOf(i);
3618
3624
  for (let n = 0; n < e.length; n++)
3619
3625
  if (t(i, e[n])) return n;
@@ -3633,26 +3639,26 @@ function bt(i, e, t, n, s) {
3633
3639
  function vt(i, e) {
3634
3640
  return i.minX = Math.min(i.minX, e.minX), i.minY = Math.min(i.minY, e.minY), i.maxX = Math.max(i.maxX, e.maxX), i.maxY = Math.max(i.maxY, e.maxY), i;
3635
3641
  }
3636
- function Gs(i, e) {
3642
+ function Vs(i, e) {
3637
3643
  return i.minX - e.minX;
3638
3644
  }
3639
- function Vs(i, e) {
3645
+ function Zs(i, e) {
3640
3646
  return i.minY - e.minY;
3641
3647
  }
3642
- function Zt(i) {
3648
+ function Kt(i) {
3643
3649
  return (i.maxX - i.minX) * (i.maxY - i.minY);
3644
3650
  }
3645
3651
  function Dt(i) {
3646
3652
  return i.maxX - i.minX + (i.maxY - i.minY);
3647
3653
  }
3648
- function Zs(i, e) {
3654
+ function Ks(i, e) {
3649
3655
  return (Math.max(e.maxX, i.maxX) - Math.min(e.minX, i.minX)) * (Math.max(e.maxY, i.maxY) - Math.min(e.minY, i.minY));
3650
3656
  }
3651
- function Ks(i, e) {
3657
+ function Js(i, e) {
3652
3658
  const t = Math.max(i.minX, e.minX), n = Math.max(i.minY, e.minY), s = Math.min(i.maxX, e.maxX), r = Math.min(i.maxY, e.maxY);
3653
3659
  return Math.max(0, s - t) * Math.max(0, r - n);
3654
3660
  }
3655
- function Kt(i, e) {
3661
+ function Jt(i, e) {
3656
3662
  return i.minX <= e.minX && i.minY <= e.minY && e.maxX <= i.maxX && e.maxY <= i.maxY;
3657
3663
  }
3658
3664
  function Lt(i, e) {
@@ -3669,28 +3675,28 @@ function pt(i) {
3669
3675
  maxY: -1 / 0
3670
3676
  };
3671
3677
  }
3672
- function Me(i, e, t, n, s) {
3678
+ function Te(i, e, t, n, s) {
3673
3679
  const r = [e, t];
3674
3680
  for (; r.length; ) {
3675
3681
  if (t = r.pop(), e = r.pop(), t - e <= n) continue;
3676
3682
  const o = e + Math.ceil((t - e) / n / 2) * n;
3677
- pn(i, o, e, t, s), r.push(e, o, o, t);
3683
+ mn(i, o, e, t, s), r.push(e, o, o, t);
3678
3684
  }
3679
3685
  }
3680
- const xt = { minX: 0, minY: 0, maxX: 0, maxY: 0 }, Te = (i, e) => i.id === e.id;
3681
- class Js extends Ws {
3686
+ const xt = { minX: 0, minY: 0, maxX: 0, maxY: 0 }, Fe = (i, e) => i.id === e.id;
3687
+ class Qs extends js {
3682
3688
  constructor(t) {
3683
3689
  super();
3684
3690
  y(this, "store");
3685
3691
  y(this, "onRotationChange", () => {
3686
- const t = this.store.getState().getAllFeatures().filter((n) => _(n) || D(n));
3692
+ const t = this.store.getState().getAllFeatures().filter((n) => _(n) || F(n));
3687
3693
  for (const n of t) this.updateRotatedText(n);
3688
3694
  });
3689
3695
  y(this, "onZoomChange", () => {
3690
3696
  const t = this.store.getState().getAllFeatures().filter(
3691
3697
  (n) => {
3692
3698
  var s;
3693
- return (_(n) || D(n)) && ((s = n.properties.style) == null ? void 0 : s.fixedSize);
3699
+ return (_(n) || F(n)) && ((s = n.properties.style) == null ? void 0 : s.fixedSize);
3694
3700
  }
3695
3701
  );
3696
3702
  for (const n of t) this.updateRotatedText(n);
@@ -3699,7 +3705,7 @@ class Js extends Ws {
3699
3705
  (n) => n.features,
3700
3706
  (n) => {
3701
3707
  this.clear(), Object.values(n).forEach((s) => {
3702
- _(s) || D(s) ? this.updateRotatedText(s) : this.insert(s);
3708
+ _(s) || F(s) ? this.updateRotatedText(s) : this.insert(s);
3703
3709
  });
3704
3710
  }
3705
3711
  ), this.store.subscribe(
@@ -3712,7 +3718,7 @@ class Js extends Ws {
3712
3718
  (n, s) => {
3713
3719
  s && s.isDragging && !n.isDragging && n.lastChangedFeatures.length > 0 && n.lastChangedFeatures.forEach((r) => {
3714
3720
  const o = n.features[r];
3715
- o && (kt(o), _(o) || D(o) ? this.updateRotatedText(o) : (this.remove(o, Te), this.insert(o)));
3721
+ o && (kt(o), _(o) || F(o) ? this.updateRotatedText(o) : (this.remove(o, Fe), this.insert(o)));
3716
3722
  });
3717
3723
  },
3718
3724
  { equalityFn: (n, s) => n.isDragging === s.isDragging }
@@ -3721,7 +3727,7 @@ class Js extends Ws {
3721
3727
  updateRotatedText(t) {
3722
3728
  var d;
3723
3729
  const n = this.store.getState();
3724
- this.remove(t, Te);
3730
+ this.remove(t, Fe);
3725
3731
  const s = Q(t);
3726
3732
  let { width: r, height: o } = q(t);
3727
3733
  if (((d = t.properties.style) == null ? void 0 : d.fixedSize) === !0) {
@@ -3758,7 +3764,7 @@ class Js extends Ws {
3758
3764
  return super.search(t);
3759
3765
  }
3760
3766
  }
3761
- class mn {
3767
+ class yn {
3762
3768
  constructor(e, t) {
3763
3769
  y(this, "layer");
3764
3770
  this.ogma = e, this.store = t;
@@ -3766,11 +3772,11 @@ class mn {
3766
3772
  destroy() {
3767
3773
  }
3768
3774
  }
3769
- function Qs(i, e, t, n, s, r) {
3775
+ function ti(i, e, t, n, s, r) {
3770
3776
  const o = Math.min(n / 2, s / 2), a = Math.min(r, o);
3771
3777
  i.beginPath(), i.moveTo(e + a, t), i.lineTo(e + n - a, t), i.quadraticCurveTo(e + n, t, e + n, t + a), i.lineTo(e + n, t + s - a), i.quadraticCurveTo(e + n, t + s, e + n - a, t + s), i.lineTo(e + a, t + s), i.quadraticCurveTo(e, t + s, e, t + s - a), i.lineTo(e, t + a), i.quadraticCurveTo(e, t, e + a, t), i.closePath();
3772
3778
  }
3773
- const Fe = [
3779
+ const Pe = [
3774
3780
  [-0.5, -0.5],
3775
3781
  // top-left
3776
3782
  [0.5, -0.5],
@@ -3780,7 +3786,7 @@ const Fe = [
3780
3786
  [-0.5, 0.5]
3781
3787
  // bottom-right
3782
3788
  ];
3783
- class ti extends mn {
3789
+ class ei extends yn {
3784
3790
  constructor(t, n) {
3785
3791
  super(t, n);
3786
3792
  // TODO: move it to settings and state
@@ -3809,7 +3815,7 @@ class ti extends mn {
3809
3815
  r,
3810
3816
  n.zoom
3811
3817
  ), this.renderBoxHandles(d, t, h, r, u);
3812
- } else nt(d) && this.renderPolygonHandles(
3818
+ } else st(d) && this.renderPolygonHandles(
3813
3819
  d,
3814
3820
  t,
3815
3821
  h,
@@ -3821,7 +3827,7 @@ class ti extends mn {
3821
3827
  this.layer = t.layers.addCanvasLayer(
3822
3828
  this.render,
3823
3829
  void 0,
3824
- de.HANDLES
3830
+ ue.HANDLES
3825
3831
  ), this.store.subscribe(
3826
3832
  (s) => ({
3827
3833
  selectedFeatures: s.selectedFeatures,
@@ -3831,46 +3837,46 @@ class ti extends mn {
3831
3837
  ), t.events.on("zoom", this.refresh);
3832
3838
  }
3833
3839
  renderOutline(t, n, s, r, o) {
3834
- var m, x;
3840
+ var m, w;
3835
3841
  const a = _(t) && ((m = t.properties.style) == null ? void 0 : m.fixedSize);
3836
3842
  let { width: l, height: h } = q(t);
3837
3843
  a && (l /= o, h /= o);
3838
- const c = St(t, a, o), d = l / 2, u = h / 2, g = c.x + d, p = c.y + u;
3839
- n.save(), n.translate(g, p), n.rotate(s);
3840
- const f = (x = t.properties.style) == null ? void 0 : x.borderRadius;
3841
- if (f && f > 0 ? (Qs(n, -d, -u, l, h, f), n.stroke()) : n.strokeRect(-d, -u, l, h), r >= 4 && r < 8) {
3842
- let b, v, S, w;
3843
- const A = f && f > 0 ? f : this.handleRadius / o;
3844
+ const c = St(t, a, o), d = l / 2, u = h / 2, g = c.x + d, f = c.y + u;
3845
+ n.save(), n.translate(g, f), n.rotate(s);
3846
+ const p = (w = t.properties.style) == null ? void 0 : w.borderRadius;
3847
+ if (p && p > 0 ? (ti(n, -d, -u, l, h, p), n.stroke()) : n.strokeRect(-d, -u, l, h), r >= 4 && r < 8) {
3848
+ let b, v, S, x;
3849
+ const A = p && p > 0 ? p : this.handleRadius / o;
3844
3850
  switch (r) {
3845
3851
  case 4:
3846
- b = -d + A, v = -u, S = d - A, w = -u;
3852
+ b = -d + A, v = -u, S = d - A, x = -u;
3847
3853
  break;
3848
3854
  case 5:
3849
- b = d, v = -u + A, S = d, w = u - A;
3855
+ b = d, v = -u + A, S = d, x = u - A;
3850
3856
  break;
3851
3857
  case 6:
3852
- b = d - A, v = u, S = -d + A, w = u;
3858
+ b = d - A, v = u, S = -d + A, x = u;
3853
3859
  break;
3854
3860
  case 7:
3855
- b = -d, v = u - A, S = -d, w = -u + A;
3861
+ b = -d, v = u - A, S = -d, x = -u + A;
3856
3862
  break;
3857
3863
  }
3858
- n.lineWidth = this.handleStrokeWidth * this.handleMagnifier / o, n.beginPath(), n.moveTo(b, v), n.lineTo(S, w), n.stroke(), n.lineWidth = this.handleStrokeWidth;
3864
+ n.lineWidth = this.handleStrokeWidth * this.handleMagnifier / o, n.beginPath(), n.moveTo(b, v), n.lineTo(S, x), n.stroke(), n.lineWidth = this.handleStrokeWidth;
3859
3865
  }
3860
3866
  n.restore();
3861
3867
  }
3862
3868
  renderArrowHandles(t, n, s, r) {
3863
- var u, g, p, f;
3864
- const o = nn(t), a = sn(t), l = +(r === 0), h = +(r === 1), c = s * (1 + (this.handleMagnifier - 1) * l), d = s * (1 + (this.handleMagnifier - 1) * h);
3865
- n.beginPath(), n.moveTo(o.x, o.y), n.lineTo(a.x, a.y), n.closePath(), n.stroke(), n.beginPath(), ((g = (u = t.properties.link) == null ? void 0 : u.start) == null ? void 0 : g.type) !== "comment" && (n.moveTo(o.x - c, o.y - c), n.rect(o.x - c, o.y - c, c * 2, c * 2)), ((f = (p = t.properties.link) == null ? void 0 : p.end) == null ? void 0 : f.type) !== "comment" && (n.moveTo(a.x - d, a.y - d), n.rect(a.x - d, a.y - d, d * 2, d * 2)), n.closePath(), n.fill(), n.stroke();
3869
+ var u, g, f, p;
3870
+ const o = sn(t), a = rn(t), l = +(r === 0), h = +(r === 1), c = s * (1 + (this.handleMagnifier - 1) * l), d = s * (1 + (this.handleMagnifier - 1) * h);
3871
+ n.beginPath(), n.moveTo(o.x, o.y), n.lineTo(a.x, a.y), n.closePath(), n.stroke(), n.beginPath(), ((g = (u = t.properties.link) == null ? void 0 : u.start) == null ? void 0 : g.type) !== "comment" && (n.moveTo(o.x - c, o.y - c), n.rect(o.x - c, o.y - c, c * 2, c * 2)), ((p = (f = t.properties.link) == null ? void 0 : f.end) == null ? void 0 : p.type) !== "comment" && (n.moveTo(a.x - d, a.y - d), n.rect(a.x - d, a.y - d, d * 2, d * 2)), n.closePath(), n.fill(), n.stroke();
3866
3872
  }
3867
3873
  renderBoxHandles(t, n, s, r, o) {
3868
- var p;
3869
- if (_(t) && ((p = t.properties.style) != null && p.fixedSize)) return;
3874
+ var f;
3875
+ if (_(t) && ((f = t.properties.style) != null && f.fixedSize)) return;
3870
3876
  const { width: a, height: l } = q(t), h = St(t), c = a / 2, d = l / 2, u = h.x + c, g = h.y + d;
3871
3877
  n.save(), n.translate(u, g), n.rotate(o), n.beginPath();
3872
- for (let f = 0; f < Fe.length; f++) {
3873
- const [m, x] = Fe[f], b = a * m, v = l * x, S = r === f ? s * this.handleMagnifier : s;
3878
+ for (let p = 0; p < Pe.length; p++) {
3879
+ const [m, w] = Pe[p], b = a * m, v = l * w, S = r === p ? s * this.handleMagnifier : s;
3874
3880
  n.rect(b - S, v - S, S * 2, S * 2);
3875
3881
  }
3876
3882
  n.closePath(), n.fill(), n.stroke(), n.restore();
@@ -3892,8 +3898,8 @@ class ti extends mn {
3892
3898
  t.beginPath();
3893
3899
  const o = r.length;
3894
3900
  for (let a = 0; a < o; a++) {
3895
- const l = r[(a - 1 + o) % o], h = r[a], c = r[(a + 1) % o], d = r[(a + 2) % o], u = h[0] + (c[0] - l[0]) / 6 * s, g = h[1] + (c[1] - l[1]) / 6 * s, p = c[0] - (d[0] - h[0]) / 6 * s, f = c[1] - (d[1] - h[1]) / 6 * s;
3896
- a === 0 && t.moveTo(h[0], h[1]), t.bezierCurveTo(u, g, p, f, c[0], c[1]);
3901
+ const l = r[(a - 1 + o) % o], h = r[a], c = r[(a + 1) % o], d = r[(a + 2) % o], u = h[0] + (c[0] - l[0]) / 6 * s, g = h[1] + (c[1] - l[1]) / 6 * s, f = c[0] - (d[0] - h[0]) / 6 * s, p = c[1] - (d[1] - h[1]) / 6 * s;
3902
+ a === 0 && t.moveTo(h[0], h[1]), t.bezierCurveTo(u, g, f, p, c[0], c[1]);
3897
3903
  }
3898
3904
  t.closePath();
3899
3905
  }
@@ -3921,15 +3927,15 @@ class ti extends mn {
3921
3927
  this.layer.destroy(), super.destroy();
3922
3928
  }
3923
3929
  }
3924
- const ei = 0.5;
3925
- function ni(i, e, t, n) {
3926
- const { start: s, end: r } = ue(i), o = X(r, s);
3927
- return Math.min(n, Math.max(2 * e, K(o) * 0.01, t));
3930
+ const ni = 0.5;
3931
+ function si(i, e, t, n) {
3932
+ const { start: s, end: r } = ge(i), o = Y(r, s);
3933
+ return Math.min(n, Math.max(2 * e, J(o) * 0.01, t));
3928
3934
  }
3929
- function Pe(i, e) {
3935
+ function De(i, e) {
3930
3936
  return !i || i === "none" ? 0 : i === "dot" ? e * 2 : i === "halo-dot" ? e * 4 : i === "arrow" || i === "arrow-plain" ? e : 0;
3931
3937
  }
3932
- function si(i, e) {
3938
+ function ii(i, e) {
3933
3939
  if (!i) {
3934
3940
  i = M("g");
3935
3941
  const t = M("path");
@@ -3939,43 +3945,43 @@ function si(i, e) {
3939
3945
  }
3940
3946
  return i;
3941
3947
  }
3942
- function ii(i, e, t, n, s, r) {
3943
- const { start: o, end: a } = ue(e), l = e.properties.style || yt, { tail: h, strokeWidth: c = 0, head: d, strokeColor: u, strokeType: g } = l, p = X(a, o), f = ys(e) ? 1 / r.zoom : 1, m = ni(e, c, t, n) * f, x = si(s, e.id), b = x.firstChild, v = u || "none";
3944
- b.setAttribute("stroke", v), b.setAttribute("stroke-width", `${f * c}`), b.setAttribute("fill", "none"), b.setAttribute("stroke-linecap", "round"), b.setAttribute("stroke-linejoin", "round");
3945
- const S = Pe(h, c * f), w = Pe(d, c * f), A = Nt(p), C = dt(o, ot(A, S)), E = dt(a, ot(A, -w)), k = `M ${C.x} ${C.y} L ${E.x} ${E.y}`;
3948
+ function ri(i, e, t, n, s, r) {
3949
+ const { start: o, end: a } = ge(e), l = e.properties.style || yt, { tail: h, strokeWidth: c = 0, head: d, strokeColor: u, strokeType: g } = l, f = Y(a, o), p = ws(e) ? 1 / r.zoom : 1, m = si(e, c, t, n) * p, w = ii(s, e.id), b = w.firstChild, v = u || "none";
3950
+ b.setAttribute("stroke", v), b.setAttribute("stroke-width", `${p * c}`), b.setAttribute("fill", "none"), b.setAttribute("stroke-linecap", "round"), b.setAttribute("stroke-linejoin", "round");
3951
+ const S = De(h, c * p), x = De(d, c * p), A = Nt(f), C = dt(o, ot(A, S)), E = dt(a, ot(A, -x)), k = `M ${C.x} ${C.y} L ${E.x} ${E.y}`;
3946
3952
  b.setAttribute("d", k);
3947
- const F = x.children[1];
3948
- return F.innerHTML = "", g === "dashed" ? b.setAttribute("stroke-dasharray", "5,10") : b.removeAttribute("stroke-dasharray"), De(
3949
- F,
3953
+ const P = w.children[1];
3954
+ return P.innerHTML = "", g === "dashed" ? b.setAttribute("stroke-dasharray", "5,10") : b.removeAttribute("stroke-dasharray"), Le(
3955
+ P,
3950
3956
  o,
3951
- p,
3957
+ f,
3952
3958
  v,
3953
3959
  h,
3954
3960
  c,
3955
- f,
3961
+ p,
3956
3962
  m
3957
- ), De(
3958
- F,
3963
+ ), Le(
3964
+ P,
3959
3965
  a,
3960
- es(p),
3966
+ ns(f),
3961
3967
  v,
3962
3968
  d,
3963
3969
  c,
3964
- f,
3970
+ p,
3965
3971
  m
3966
- ), x.setAttribute(
3972
+ ), w.setAttribute(
3967
3973
  "transform",
3968
3974
  `rotate(${-r.rotation * (180 / Math.PI)})`
3969
- ), i.appendChild(x), x;
3975
+ ), i.appendChild(w), w;
3970
3976
  }
3971
- function De(i, e, t, n, s, r, o, a) {
3972
- s === "halo-dot" && Le(
3977
+ function Le(i, e, t, n, s, r, o, a) {
3978
+ s === "halo-dot" && He(
3973
3979
  i,
3974
3980
  e,
3975
- ri(n),
3976
- ei,
3981
+ oi(n),
3982
+ ni,
3977
3983
  r * o * 4
3978
- ), (s === "dot" || s === "halo-dot") && Le(i, e, n, 1, r * o * 2), (s === "arrow" || s === "arrow-plain") && oi(
3984
+ ), (s === "dot" || s === "halo-dot") && He(i, e, n, 1, r * o * 2), (s === "arrow" || s === "arrow-plain") && ai(
3979
3985
  i,
3980
3986
  e,
3981
3987
  t,
@@ -3985,18 +3991,18 @@ function De(i, e, t, n, s, r, o, a) {
3985
3991
  a
3986
3992
  );
3987
3993
  }
3988
- function ri(i) {
3994
+ function oi(i) {
3989
3995
  return i === "none" ? "none" : i;
3990
3996
  }
3991
- function Le(i, e, t, n, s) {
3997
+ function He(i, e, t, n, s) {
3992
3998
  const r = M("circle");
3993
3999
  r.setAttribute("cx", `${e.x}`), r.setAttribute("cy", `${e.y}`), r.setAttribute("r", `${s}`), r.setAttribute("fill-opacity", `${n}`), r.setAttribute("fill", t), i.appendChild(r);
3994
4000
  }
3995
- function oi(i, e, t, n, s, r, o) {
3996
- const a = ot(Nt(t), o), l = dt(e, xe(a, Math.PI / 6)), h = dt(e, xe(a, -Math.PI / 6)), c = M("path"), d = `${e.x} ${e.y}`, u = `M ${l.x} ${l.y} L ${d} L ${h.x} ${h.y}${s ? " Z" : ""}`;
4001
+ function ai(i, e, t, n, s, r, o) {
4002
+ const a = ot(Nt(t), o), l = dt(e, be(a, Math.PI / 6)), h = dt(e, be(a, -Math.PI / 6)), c = M("path"), d = `${e.x} ${e.y}`, u = `M ${l.x} ${l.y} L ${d} L ${h.x} ${h.y}${s ? " Z" : ""}`;
3997
4003
  c.setAttribute("d", u), c.setAttribute("stroke", n), c.setAttribute("stroke-width", `${r}`), c.setAttribute("fill", s ? n : "none"), c.setAttribute("stroke-linecap", "round"), c.setAttribute("stroke-linejoin", "round"), i.appendChild(c);
3998
4004
  }
3999
- function ai(i, e, t = "box") {
4005
+ function ci(i, e, t = "box") {
4000
4006
  if (!i) {
4001
4007
  i = M("g"), i.setAttribute("data-annotation", `${e}`), i.setAttribute("data-annotation-type", t), i.classList.add(`annotation-${t}`);
4002
4008
  const n = M("rect");
@@ -4004,31 +4010,31 @@ function ai(i, e, t = "box") {
4004
4010
  }
4005
4011
  return i;
4006
4012
  }
4007
- function yn(i, e, t, n) {
4008
- const s = e.id, r = `class${s}`, o = q(e), a = ai(t, s, e.properties.type), { strokeColor: l, strokeWidth: h, strokeType: c, background: d, borderRadius: u, boxShadow: g } = e.properties.style || Mt;
4013
+ function wn(i, e, t, n) {
4014
+ const s = e.id, r = `class${s}`, o = q(e), a = ci(t, s, e.properties.type), { strokeColor: l, strokeWidth: h, strokeType: c, background: d, borderRadius: u, boxShadow: g } = e.properties.style || Mt;
4009
4015
  a.classList.add("annotation-box"), a.setAttribute("fill", `${d || "transparent"}`);
4010
- const p = a.firstChild;
4011
- u && (p.setAttribute("rx", `${u}`), p.setAttribute("ry", `${u}`)), c && c !== "none" && (p.setAttribute("stroke", l || "black"), p.setAttribute("stroke-width", `${h}`), c === "dashed" && p.setAttribute("stroke-dasharray", "5,5")), d && d.length && (n.hoveredFeature === e.id ? p.setAttribute("fill", Ft(d)) : p.setAttribute("fill", d));
4012
- const f = St(e);
4013
- return p.setAttribute("width", `${o.width}`), p.setAttribute("height", `${o.height}`), p.setAttribute("x", `${f.x}`), p.setAttribute("y", `${f.y}`), a.appendChild(p), g ? a.style.filter = `drop-shadow(${g})` : a.style.filter = "", a.setAttribute("transform", n.getRotationTransform(0, 0)), a.classList.add(r), a.setAttribute("data-annotation", `${e.id}`), a.setAttribute("data-annotation-type", e.properties.type), i.appendChild(a), a;
4016
+ const f = a.firstChild;
4017
+ u && (f.setAttribute("rx", `${u}`), f.setAttribute("ry", `${u}`)), c && c !== "none" && (f.setAttribute("stroke", l || "black"), f.setAttribute("stroke-width", `${h}`), c === "dashed" && f.setAttribute("stroke-dasharray", "5,5")), d && d.length && (n.hoveredFeature === e.id ? f.setAttribute("fill", Ft(d)) : f.setAttribute("fill", d));
4018
+ const p = St(e);
4019
+ return f.setAttribute("width", `${o.width}`), f.setAttribute("height", `${o.height}`), f.setAttribute("x", `${p.x}`), f.setAttribute("y", `${p.y}`), a.appendChild(f), g ? a.style.filter = `drop-shadow(${g})` : a.style.filter = "", a.setAttribute("transform", n.getRotationTransform(0, 0)), a.classList.add(r), a.setAttribute("data-annotation", `${e.id}`), a.setAttribute("data-annotation-type", e.properties.type), i.appendChild(a), a;
4014
4020
  }
4015
- let Jt = null;
4016
- function wn() {
4017
- return Jt || (Jt = document.createElement("canvas").getContext("2d")), Jt;
4021
+ let Qt = null;
4022
+ function xn() {
4023
+ return Qt || (Qt = document.createElement("canvas").getContext("2d")), Qt;
4018
4024
  }
4019
- function xn(i, e, t, n, s) {
4025
+ function bn(i, e, t, n, s) {
4020
4026
  if (!i || i.length === 0) return !0;
4021
4027
  if (i.includes(`
4022
4028
  `)) return !1;
4023
- const r = wn();
4029
+ const r = xn();
4024
4030
  r.font = `${t}px ${e}`;
4025
4031
  const o = r.measureText(i).width, a = n - s * 2;
4026
4032
  return o <= a;
4027
4033
  }
4028
- function ci(i, e, t, n, s) {
4034
+ function li(i, e, t, n, s) {
4029
4035
  if (!i || i.length === 0)
4030
4036
  return 60;
4031
- const r = wn();
4037
+ const r = xn();
4032
4038
  r.font = `${t}px ${e}`;
4033
4039
  const o = i.split(`
4034
4040
  `);
@@ -4038,8 +4044,8 @@ function ci(i, e, t, n, s) {
4038
4044
  const c = h.split(/\s+/);
4039
4045
  let d = 0;
4040
4046
  const u = r.measureText(" ").width, g = n - s * 2;
4041
- for (let p = 0; p < c.length; p++) {
4042
- const f = c[p], m = r.measureText(f).width;
4047
+ for (let f = 0; f < c.length; f++) {
4048
+ const p = c[f], m = r.measureText(p).width;
4043
4049
  d === 0 ? d = m : d + u + m <= g ? d += u + m : (a = Math.max(a, d), d = m);
4044
4050
  }
4045
4051
  a = Math.max(a, d);
@@ -4047,7 +4053,7 @@ function ci(i, e, t, n, s) {
4047
4053
  const l = a + s * 2 + 4;
4048
4054
  return Math.min(l, n);
4049
4055
  }
4050
- function li() {
4056
+ function hi() {
4051
4057
  const i = M("style");
4052
4058
  return i.textContent = `
4053
4059
  /* Comment Animation Styles */
@@ -4128,20 +4134,20 @@ function li() {
4128
4134
  }
4129
4135
  `, i;
4130
4136
  }
4131
- function hi(i, e, t) {
4132
- const n = { ...J, ...e.properties.style }, s = n.iconSize, {
4133
- iconColor: r = J.iconColor,
4134
- iconSymbol: o = J.iconSymbol,
4135
- iconBorderColor: a = J.iconBorderColor,
4136
- iconBorderWidth: l = J.iconBorderWidth
4137
+ function di(i, e, t) {
4138
+ const n = { ...V, ...e.properties.style }, s = n.iconSize, {
4139
+ iconColor: r = V.iconColor,
4140
+ iconSymbol: o = V.iconSymbol,
4141
+ iconBorderColor: a = V.iconBorderColor,
4142
+ iconBorderWidth: l = V.iconBorderWidth
4137
4143
  } = n;
4138
- let h = i.querySelector("circle");
4139
- h || (h = M("circle"), h.setAttribute("cx", "0"), h.setAttribute("cy", "0"), i.appendChild(h)), h.setAttribute("r", `${s / 2}`), t.hoveredFeature === e.id ? h.setAttribute("fill", Ft(r)) : h.setAttribute("fill", r), l && l > 0 ? (h.setAttribute("stroke", a || "#CCC"), h.setAttribute("stroke-width", `${l}`)) : (h.removeAttribute("stroke"), h.removeAttribute("stroke-width"));
4144
+ let h = i.querySelector("rect");
4145
+ h || (h = M("rect"), h.setAttribute("x", `${-s / 2}`), h.setAttribute("y", `${-s / 2}`), h.setAttribute("rx", `${n.borderRadius}`), h.setAttribute("ry", `${n.borderRadius}`), i.appendChild(h)), h.setAttribute("width", `${s}`), h.setAttribute("height", `${s}`), t.hoveredFeature === e.id ? h.setAttribute("fill", Ft(r)) : h.setAttribute("fill", r), l && l > 0 ? (h.setAttribute("stroke", a || "#CCC"), h.setAttribute("stroke-width", `${l}`)) : (h.removeAttribute("stroke"), h.removeAttribute("stroke-width"));
4140
4146
  let c = i.querySelector("text");
4141
4147
  c || (c = M("text"), c.setAttribute("x", "0"), c.setAttribute("y", "0"), c.setAttribute("text-anchor", "middle"), c.setAttribute("dominant-baseline", "central"), c.setAttribute("pointer-events", "none"), i.appendChild(c)), c.setAttribute("font-size", `${s * 0.5}`), c.textContent = o;
4142
4148
  }
4143
- function di(i, e, t, n = 0, s = !1) {
4144
- const r = { ...J, ...e.properties.style }, {
4149
+ function ui(i, e, t, n = 0, s = !1) {
4150
+ const r = { ...V, ...e.properties.style }, {
4145
4151
  font: o = "Arial, sans-serif",
4146
4152
  fontSize: a = 12,
4147
4153
  padding: l = 8,
@@ -4150,25 +4156,40 @@ function di(i, e, t, n = 0, s = !1) {
4150
4156
  borderRadius: d = 4,
4151
4157
  strokeColor: u = "#DDD",
4152
4158
  strokeWidth: g = 1,
4153
- maxHeight: p
4154
- } = r, f = e.properties.width, m = e.properties.content || "", x = typeof a == "number" ? a : parseFloat(a), b = ci(m, o, x, f, l), S = t.selectedFeatures.has(e.id) ? f : b + n, w = e.properties.height, A = xn(m, o, x, f, l), C = x * $t + l * 2, E = A ? Math.min(w, C) : w, k = p ? Math.min(E, p) : E, F = !A && p ? w > p : !1, z = k + (s ? 28 : 0);
4159
+ maxHeight: f
4160
+ } = r, p = e.properties.width, m = e.properties.content || "", w = typeof a == "number" ? a : parseFloat(a), b = li(
4161
+ m,
4162
+ o,
4163
+ w,
4164
+ p,
4165
+ l
4166
+ ), x = t.selectedFeatures.has(e.id) && r.expandOnSelect === !0 ? p : b + n, A = e.properties.height, C = bn(
4167
+ m,
4168
+ o,
4169
+ w,
4170
+ p,
4171
+ l
4172
+ ), E = w * $t + l * 2, k = C ? Math.min(A, E) : A, P = f ? Math.min(k, f) : k, O = !C && f ? A > f : !1, B = P + (s ? 28 : 0);
4155
4173
  i.innerHTML = "";
4156
- const R = -S / 2, et = -z / 2, Y = M("rect");
4157
- Y.setAttribute("x", `${R}`), Y.setAttribute("y", `${et}`), Y.setAttribute("width", `${S}`), Y.setAttribute("height", `${z}`), Y.setAttribute("rx", `${d}`), Y.setAttribute("ry", `${d}`), Y.setAttribute("fill", t.hoveredFeature === e.id ? Ft(h) : h), g && g > 0 && (Y.setAttribute("stroke", u || "#DDD"), Y.setAttribute("stroke-width", `${g}`)), i.appendChild(Y);
4158
- const G = M("foreignObject");
4159
- G.setAttribute("x", `${R}`), G.setAttribute("y", `${et}`), G.setAttribute("width", `${S}`), G.setAttribute("height", `${z}`), G.style.pointerEvents = "none";
4160
- const P = document.createElement("div");
4161
- P.style.width = "100%", P.style.height = "100%", P.style.padding = `${l}px`, P.style.boxSizing = "border-box", P.style.fontFamily = o, P.style.fontSize = `${a}px`, P.style.lineHeight = `${(typeof a == "number" ? a : parseFloat(a)) * $t}px`, P.style.color = c, P.style.overflowY = F ? "auto" : "hidden", P.style.overflowX = "hidden", P.style.overflowWrap = "break-word", P.style.whiteSpace = "pre-wrap", P.style.pointerEvents = "none", P.style.display = "flex", P.style.flexDirection = "column", P.style.position = "relative";
4162
- const st = document.createElement("div");
4163
- if (st.style.flex = "1", st.style.minHeight = "0", st.style.overflowY = F ? "auto" : "hidden", st.innerHTML = ui(m), P.appendChild(st), s) {
4164
- const L = document.createElement("div");
4165
- L.classList.add("ogma-send-button"), L.style.pointerEvents = "auto";
4166
- const B = document.createElement("span");
4167
- B.classList.add("ogma-send-button-icon"), B.innerHTML = t.options.editButtonIcon, L.appendChild(B), P.appendChild(L);
4168
- }
4169
- G.appendChild(P), i.appendChild(G), i.setAttribute("filter", "url(#softShadow)");
4170
- }
4171
- function ui(i) {
4174
+ const et = -x / 2, nt = -B / 2, U = M("rect");
4175
+ U.setAttribute("x", `${et}`), U.setAttribute("y", `${nt}`), U.setAttribute("width", `${x}`), U.setAttribute("height", `${B}`), U.setAttribute("rx", `${d}`), U.setAttribute("ry", `${d}`), U.setAttribute(
4176
+ "fill",
4177
+ t.hoveredFeature === e.id ? Ft(h) : h
4178
+ ), g && g > 0 && (U.setAttribute("stroke", u || "#DDD"), U.setAttribute("stroke-width", `${g}`)), i.appendChild(U);
4179
+ const j = M("foreignObject");
4180
+ j.setAttribute("x", `${et}`), j.setAttribute("y", `${nt}`), j.setAttribute("width", `${x}`), j.setAttribute("height", `${B}`), j.style.pointerEvents = "none";
4181
+ const L = document.createElement("div");
4182
+ L.style.width = "100%", L.style.height = "100%", L.style.padding = `${l}px`, L.style.boxSizing = "border-box", L.style.fontFamily = o, L.style.fontSize = `${a}px`, L.style.lineHeight = `${(typeof a == "number" ? a : parseFloat(a)) * $t}px`, L.style.color = c, L.style.overflowY = O ? "auto" : "hidden", L.style.overflowX = "hidden", L.style.overflowWrap = "break-word", L.style.whiteSpace = "pre-wrap", L.style.pointerEvents = "none", L.style.display = "flex", L.style.flexDirection = "column", L.style.position = "relative";
4183
+ const D = document.createElement("div");
4184
+ if (D.style.flex = "1", D.style.minHeight = "0", D.style.overflowY = O ? "auto" : "hidden", D.innerHTML = gi(m), L.appendChild(D), s) {
4185
+ const z = document.createElement("div");
4186
+ z.classList.add("ogma-send-button"), z.style.pointerEvents = "auto";
4187
+ const Wt = document.createElement("span");
4188
+ Wt.classList.add("ogma-send-button-icon"), Wt.innerHTML = t.options.editButtonIcon, z.appendChild(Wt), L.appendChild(z);
4189
+ }
4190
+ j.appendChild(L), i.appendChild(j), r.shadow !== !1 ? i.setAttribute("filter", "url(#softShadow)") : i.removeAttribute("filter");
4191
+ }
4192
+ function gi(i) {
4172
4193
  if (!i) return "";
4173
4194
  let e = i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4174
4195
  return e = e.replace(
@@ -4176,7 +4197,7 @@ function ui(i) {
4176
4197
  '<a href="$1" target="_blank" style="color: #38e; text-decoration: none;">$1</a>'
4177
4198
  ), e;
4178
4199
  }
4179
- function gi(i, e, t, n, s) {
4200
+ function fi(i, e, t, n, s) {
4180
4201
  const r = e.properties.mode;
4181
4202
  let o = t;
4182
4203
  o || (o = M("g"), o.setAttribute("data-annotation", `${e.id}`), o.setAttribute("data-annotation-type", "comment"));
@@ -4187,30 +4208,36 @@ function gi(i, e, t, n, s) {
4187
4208
  const h = r !== at && n.selectedFeatures.has(e.id) && n.editingFeature !== e.id && n.options.showEditButton;
4188
4209
  let c = 0;
4189
4210
  if (h) {
4190
- const u = { ...J, ...e.properties.style }, g = e.properties.content || "", p = typeof u.fontSize == "number" ? u.fontSize : parseFloat((u.fontSize || "12").toString());
4191
- xn(g, u.font || "Arial, sans-serif", p, e.properties.width, u.padding || 8) && (c = 32);
4192
- }
4193
- hi(a, e, n), di(l, e, n, c, h), s ? o.classList.remove("comment-no-transition") : o.classList.add("comment-no-transition"), r === at ? (o.classList.add("comment-collapsed"), o.classList.remove("comment-expanded")) : (o.classList.add("comment-expanded"), o.classList.remove("comment-collapsed"));
4211
+ const u = { ...V, ...e.properties.style }, g = e.properties.content || "", f = typeof u.fontSize == "number" ? u.fontSize : parseFloat((u.fontSize || "12").toString());
4212
+ bn(
4213
+ g,
4214
+ u.font || "Arial, sans-serif",
4215
+ f,
4216
+ e.properties.width,
4217
+ u.padding || 8
4218
+ ) && (c = 32);
4219
+ }
4220
+ di(a, e, n), ui(l, e, n, c, h), s ? o.classList.remove("comment-no-transition") : o.classList.add("comment-no-transition"), r === at ? (o.classList.add("comment-collapsed"), o.classList.remove("comment-expanded")) : (o.classList.add("comment-expanded"), o.classList.remove("comment-collapsed"));
4194
4221
  const d = Q(e);
4195
4222
  return o.setAttribute(
4196
4223
  "transform",
4197
4224
  n.getScreenAlignedTransform(d.x, d.y, !1)
4198
4225
  ), o.style.visibility = n.editingFeature === e.id ? "hidden" : "", (!o.parentNode || o.parentNode !== i) && i.appendChild(o), o;
4199
4226
  }
4200
- function fi(i, e = 0.5, t = !1) {
4227
+ function pi(i, e = 0.5, t = !1) {
4201
4228
  if (i.length < 2) return "";
4202
4229
  if (i.length < 3)
4203
4230
  return i.map((o, a) => `${a === 0 ? "M" : "L"}${o[0]},${o[1]}`).join(" ") + " Z";
4204
4231
  const n = i, s = n.length - 1, r = [];
4205
4232
  for (let o = 0; o < s; o++) {
4206
- const a = n[(o - 1 + s) % s], l = n[o], h = n[(o + 1) % s], c = n[(o + 2) % s], d = l[0] + (h[0] - a[0]) / 6 * e, u = l[1] + (h[1] - a[1]) / 6 * e, g = h[0] - (c[0] - l[0]) / 6 * e, p = h[1] - (c[1] - l[1]) / 6 * e;
4207
- o === 0 && r.push(`M${l[0]},${l[1]}`), t && o === s - 1 ? r.push(`L${h[0]},${h[1]}`) : r.push(`C${d},${u} ${g},${p} ${h[0]},${h[1]}`);
4233
+ const a = n[(o - 1 + s) % s], l = n[o], h = n[(o + 1) % s], c = n[(o + 2) % s], d = l[0] + (h[0] - a[0]) / 6 * e, u = l[1] + (h[1] - a[1]) / 6 * e, g = h[0] - (c[0] - l[0]) / 6 * e, f = h[1] - (c[1] - l[1]) / 6 * e;
4234
+ o === 0 && r.push(`M${l[0]},${l[1]}`), t && o === s - 1 ? r.push(`L${h[0]},${h[1]}`) : r.push(`C${d},${u} ${g},${f} ${h[0]},${h[1]}`);
4208
4235
  }
4209
4236
  return r.push("Z"), r.join(" ");
4210
4237
  }
4211
- const pi = (i, e, t = "box") => (i || (i = M("g"), i.setAttribute("data-annotation", `${e}`), i.classList.add(`annotation-${t}`)), i);
4212
- function mi(i, e, t, n) {
4213
- const s = pi(
4238
+ const mi = (i, e, t = "box") => (i || (i = M("g"), i.setAttribute("data-annotation", `${e}`), i.classList.add(`annotation-${t}`)), i);
4239
+ function yi(i, e, t, n) {
4240
+ const s = mi(
4214
4241
  t,
4215
4242
  e.id.toString(),
4216
4243
  e.properties.type
@@ -4225,14 +4252,14 @@ function mi(i, e, t, n) {
4225
4252
  strokeType: h = lt.strokeType
4226
4253
  } = e.properties.style || lt;
4227
4254
  o && r.setAttribute("stroke", o), a !== void 0 && r.setAttribute("stroke-width", String(a)), l && (n.hoveredFeature === e.id ? r.setAttribute("fill", Ft(l)) : r.setAttribute("fill", l)), h === "dashed" ? r.setAttribute("stroke-dasharray", "5,5") : r.removeAttribute("stroke-dasharray");
4228
- const c = e.geometry.coordinates[0], d = fi(
4255
+ const c = e.geometry.coordinates[0], d = pi(
4229
4256
  c,
4230
4257
  0.5,
4231
4258
  n.drawingFeature === e.id
4232
4259
  );
4233
4260
  return r.setAttribute("d", d), s.setAttribute("transform", n.getRotationTransform(0, 0)), i.appendChild(s), s;
4234
4261
  }
4235
- const yi = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, wi = /\bsmall-caps\b/, xi = /\b(?:italic|oblique)\b/, bi = /\bbold(?:er)?\b/, bn = 16, He = 13.3333333, vi = 0.01 * bn, Si = {
4262
+ const wi = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, xi = /\bsmall-caps\b/, bi = /\b(?:italic|oblique)\b/, vi = /\bbold(?:er)?\b/, vn = 16, _e = 13.3333333, Si = 0.01 * vn, Ai = {
4236
4263
  "xx-small": 9,
4237
4264
  "x-small": 10,
4238
4265
  smaller: 13.3333,
@@ -4242,35 +4269,35 @@ const yi = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|med
4242
4269
  larger: 19.2,
4243
4270
  "x-large": 24,
4244
4271
  "xx-large": 32
4245
- }, Qt = /* @__PURE__ */ new Map();
4246
- function Ai(i) {
4247
- if (Qt.has(i))
4248
- return Qt.get(i);
4249
- const e = yi.exec(i);
4272
+ }, te = /* @__PURE__ */ new Map();
4273
+ function Ei(i) {
4274
+ if (te.has(i))
4275
+ return te.get(i);
4276
+ const e = wi.exec(i);
4250
4277
  if (!e)
4251
4278
  return;
4252
4279
  const t = {};
4253
4280
  t.family = (e[6] || "").trim();
4254
- let n = Si[e[2]] || parseFloat(e[2]);
4255
- if (e[3] === "%" ? n *= vi : e[3] === "em" ? n *= bn : e[3] === "pt" && (n *= He), t.size = n, e[4] === "normal" || e[4] === "inherit" || !e[4] ? t.height = Math.round(n * (7 / 6)) : !e[5] || e[5] === "em" ? t.height = parseFloat(e[4] || "") * n : e[5] === "pt" ? t.height = parseFloat(e[4] || "") * He : e[5] === "%" ? t.height = n * 0.01 : t.height = parseFloat(e[4] || ""), t.variant = wi.test(e[1]) ? "small-caps" : "normal", t.style = xi.test(e[1]) ? "italic" : "normal", bi.test(e[1]))
4281
+ let n = Ai[e[2]] || parseFloat(e[2]);
4282
+ if (e[3] === "%" ? n *= Si : e[3] === "em" ? n *= vn : e[3] === "pt" && (n *= _e), t.size = n, e[4] === "normal" || e[4] === "inherit" || !e[4] ? t.height = Math.round(n * (7 / 6)) : !e[5] || e[5] === "em" ? t.height = parseFloat(e[4] || "") * n : e[5] === "pt" ? t.height = parseFloat(e[4] || "") * _e : e[5] === "%" ? t.height = n * 0.01 : t.height = parseFloat(e[4] || ""), t.variant = xi.test(e[1]) ? "small-caps" : "normal", t.style = bi.test(e[1]) ? "italic" : "normal", vi.test(e[1]))
4256
4283
  t.weight = 700;
4257
4284
  else {
4258
4285
  const s = /\b(\d+)\b/.exec(e[1]), r = s ? parseInt(s[1], 10) : 400;
4259
4286
  r >= 100 && r !== 400 ? t.weight = r : t.weight = 400;
4260
4287
  }
4261
- return Qt.set(i, t), t;
4288
+ return te.set(i, t), t;
4262
4289
  }
4263
- const Ei = "12px/14px sans-serif";
4264
- class V {
4290
+ const Ci = "12px/14px sans-serif";
4291
+ class Z {
4265
4292
  /**
4266
4293
  * @param {string | Font} [input]
4267
4294
  */
4268
- constructor(e = Ei) {
4295
+ constructor(e = Ci) {
4269
4296
  let t, n = 14, s = 12, r = 400, o = "normal", a = "normal", l = 0, h;
4270
4297
  if (typeof e == "string") {
4271
- const c = Ai(e);
4298
+ const c = Ei(e);
4272
4299
  c && (t = c.family, s = c.size, n = c.height || 14, a = c.variant, o = c.style, r = c.weight);
4273
- } else e instanceof V && (t = e.family, s = e.size, n = e.height, a = e.variant, r = e.weight, o = e.style, l = e.baseline, h = e.color);
4300
+ } else e instanceof Z && (t = e.family, s = e.size, n = e.height, a = e.variant, r = e.weight, o = e.style, l = e.baseline, h = e.color);
4274
4301
  this.family = t || "sans-serif", this.size = s || s === 0 ? s : 12, this.height = n || n === 0 ? n : this.size * (7 / 6), this.variant = a || "", this.style = o || "", this.weight = r || 400, this.baseline = l || 0, this.color = h || "";
4275
4302
  }
4276
4303
  /**
@@ -4288,7 +4315,7 @@ class V {
4288
4315
  * @return {Font}
4289
4316
  */
4290
4317
  assign(e = {}) {
4291
- const t = new V(this);
4318
+ const t = new Z(this);
4292
4319
  return e.bold && (t.weight = 700), e.weight && (t.weight = e.weight), e.italic && (t.style = "italic"), e.family && (t.family = e.family), e.style && (t.style = e.style), e.color && (t.color = e.color), typeof e.baseline == "number" && (t.baseline = e.baseline), typeof e.size == "number" && (t.size = e.size), t;
4293
4320
  }
4294
4321
  toString(e) {
@@ -4299,7 +4326,7 @@ class V {
4299
4326
  return this.toString(!0);
4300
4327
  }
4301
4328
  }
4302
- const vn = {
4329
+ const Sn = {
4303
4330
  "\n": 0.28,
4304
4331
  //
4305
4332
  "\r": 0.28,
@@ -4344,46 +4371,46 @@ const vn = {
4344
4371
  // IDEOGRAPHIC SPACE
4345
4372
  "\uFEFF": 0
4346
4373
  // ZERO WIDTH NO-BREAK SPACE
4347
- }, Ci = new V(), _e = {
4374
+ }, ki = new Z(), Ie = {
4348
4375
  trim: !0,
4349
4376
  collapse: !0
4350
- }, te = {};
4351
- function ce() {
4377
+ }, ee = {};
4378
+ function le() {
4352
4379
  return (i, e) => {
4353
- const t = new V(e);
4380
+ const t = new Z(e);
4354
4381
  let n = t.size;
4355
4382
  return /\bmonospace\b/.test(t.family) ? n *= 0.6 : (n *= 0.45, t.weight > 400 && (n *= 1.18)), i.length * n;
4356
4383
  };
4357
4384
  }
4358
- function le(i) {
4385
+ function he(i) {
4359
4386
  if (i && i.getContext) {
4360
4387
  const e = i.getContext("2d");
4361
4388
  if (e && typeof e.measureText == "function")
4362
4389
  return (t, n) => (e.font = String(n), e.measureText(t).width);
4363
4390
  }
4364
4391
  }
4365
- function Sn() {
4392
+ function An() {
4366
4393
  const i = typeof document < "u" ? document : null;
4367
4394
  return typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || i && i.createElement && i.createElement("canvas") || null;
4368
4395
  }
4369
- let At = le(Sn()) || ce();
4370
- function ki(i) {
4396
+ let At = he(An()) || le();
4397
+ function Mi(i) {
4371
4398
  if (i == null)
4372
- At = le(Sn()) || ce();
4399
+ At = he(An()) || le();
4373
4400
  else if (i)
4374
- At = le(i) || ce();
4401
+ At = he(i) || le();
4375
4402
  else
4376
4403
  throw new Error("setMeasureCanvas argument is not a canvas or null");
4377
4404
  }
4378
- function ct(i, e, t = _e) {
4379
- typeof e == "string" ? e = new V(e) : e instanceof V ? e = Ci.assign(e) : e = new V().assign(e);
4380
- const n = Object.assign({}, _e, t);
4405
+ function ct(i, e, t = Ie) {
4406
+ typeof e == "string" ? e = new Z(e) : e instanceof Z ? e = ki.assign(e) : e = new Z().assign(e);
4407
+ const n = Object.assign({}, Ie, t);
4381
4408
  let s = String(i);
4382
4409
  if (!s)
4383
4410
  return 0;
4384
- if (s in vn) {
4411
+ if (s in Sn) {
4385
4412
  const o = e.valueOf() + "/" + s;
4386
- return o in te || (te[o] = At(`_${s}_`, e) - At("__", e)), te[o];
4413
+ return o in ee || (ee[o] = At(`_${s}_`, e) - At("__", e)), ee[o];
4387
4414
  }
4388
4415
  !n.trim || !n.collapse ? s = s.replace(/\n/g, " ") : n.trim ? s = s.replace(/\n/g, " ").trim() : n.collapse && (s = s.replace(/\s+/g, " "));
4389
4416
  const r = typeof i == "string" ? 0 : i.tracking || 0;
@@ -4406,23 +4433,23 @@ class H {
4406
4433
  }
4407
4434
  class Tt extends H {
4408
4435
  }
4409
- class Z extends H {
4436
+ class K extends H {
4410
4437
  }
4411
4438
  class ht extends H {
4412
4439
  }
4413
- const Mi = /[\r\n\xA0]+/g, Ie = 0.7;
4414
- function Ti(i, e) {
4415
- i.sup && (i.baseline = 0.45, i.size = Ie), i.sub && (i.baseline = -0.3, i.size = Ie);
4440
+ const Ti = /[\r\n\xA0]+/g, ze = 0.7;
4441
+ function Fi(i, e) {
4442
+ i.sup && (i.baseline = 0.45, i.size = ze), i.sub && (i.baseline = -0.3, i.size = ze);
4416
4443
  let t = e;
4417
4444
  return (i.style || i.weight || i.baseline || i.color || i.size || i.family) && (t = e.assign(i)), t;
4418
4445
  }
4419
- function ze(i, e, t) {
4446
+ function Be(i, e, t) {
4420
4447
  let n = i.width, s, r;
4421
4448
  for (; n + t.width > e && i.length; )
4422
4449
  s = i[i.length - 1], r = s.width, s.width > t.width ? (s.value = s.value.slice(0, -1), s.width = ct(s, s.font), n += s.width) : i.pop(), n -= r;
4423
4450
  i[i.length - 1] instanceof ht && i.pop(), s = i[i.length - 1] || s || {}, t.font = t.font.assign(s), t.href = i.length ? s.href : null, t.rel = i.length ? s.rel : null, t.target = i.length ? s.target : null, i.push(t);
4424
4451
  }
4425
- function Be(i) {
4452
+ function Re(i) {
4426
4453
  return Object.assign([], {
4427
4454
  height: 0,
4428
4455
  font: i,
@@ -4431,26 +4458,26 @@ function Be(i) {
4431
4458
  hasLineOverflow: !1
4432
4459
  });
4433
4460
  }
4434
- function Fi(i, e, t) {
4461
+ function Pi(i, e, t) {
4435
4462
  if (!i.length)
4436
- return Be(t);
4463
+ return Re(t);
4437
4464
  const n = e.height(), s = e.width(), r = e.overflowLine(), o = e.overflowWrap(), a = t.assign({ bold: !0 }), l = isFinite(n()) ? Math.floor(n() / t.height) : 1 / 0;
4438
4465
  if (!n() && !s(0) || !l)
4439
- return Be(t);
4466
+ return Re(t);
4440
4467
  let h = 0, c = 0, d = 0;
4441
4468
  const u = [];
4442
- let g = [], p = !1;
4469
+ let g = [], f = !1;
4443
4470
  for (; h < i.length && c < l; ) {
4444
- const w = i[h], A = Ti(w, t);
4445
- if (w.width = ct(w, A), w.font = A, w.line = c, w.whitespace = w.value in vn, w.value && (w.value = w.value.replace(Mi, " ")), !(!d && w.whitespace || p && w.whitespace)) if (w instanceof Z)
4471
+ const x = i[h], A = Fi(x, t);
4472
+ if (x.width = ct(x, A), x.font = A, x.line = c, x.whitespace = x.value in Sn, x.value && (x.value = x.value.replace(Ti, " ")), !(!d && x.whitespace || f && x.whitespace)) if (x instanceof K)
4446
4473
  d = 0, g = [], u.push(h + 1), c++;
4447
- else if (w instanceof Tt || w instanceof ht)
4474
+ else if (x instanceof Tt || x instanceof ht)
4448
4475
  g.push({
4449
4476
  index: h,
4450
4477
  width: d
4451
4478
  });
4452
- else if (w.whitespace || d + w.width < s(c))
4453
- d += w.width;
4479
+ else if (x.whitespace || d + x.width < s(c))
4480
+ d += x.width;
4454
4481
  else if (g.length) {
4455
4482
  let C, E;
4456
4483
  do {
@@ -4460,60 +4487,60 @@ function Fi(i, e, t) {
4460
4487
  /** @type {Token} */
4461
4488
  i[C.index]
4462
4489
  );
4463
- let F;
4464
- k instanceof ht && (F = ct("-", k.font || t), C.width + F > s(c) && (E = !g.length));
4490
+ let P;
4491
+ k instanceof ht && (P = ct("-", k.font || t), C.width + P > s(c) && (E = !g.length));
4465
4492
  } while (!E);
4466
4493
  u.push(C.index + 1), d = 0, c++, h = C.index, g = [];
4467
4494
  } else if (o === "break-word") {
4468
4495
  const C = s(c);
4469
- if (d + w.width > C) {
4470
- const E = w.clone();
4496
+ if (d + x.width > C) {
4497
+ const E = x.clone();
4471
4498
  do
4472
- w.value = w.value.slice(0, -1), w.width = ct(w, w.font || t), d += w.width;
4473
- while (w.value && w.width > C);
4474
- E.value = E.value.slice(w.value.length), i.splice(h + 1, 0, new Tt(), E);
4499
+ x.value = x.value.slice(0, -1), x.width = ct(x, x.font || t), d += x.width;
4500
+ while (x.value && x.width > C);
4501
+ E.value = E.value.slice(x.value.length), i.splice(h + 1, 0, new Tt(), E);
4475
4502
  }
4476
4503
  u.push(h + 1), d = 0, c++;
4477
4504
  } else
4478
- d += w.width;
4479
- h++, p = w.whitespace;
4505
+ d += x.width;
4506
+ h++, f = x.whitespace;
4480
4507
  }
4481
4508
  h !== u[u.length - 1] && u.push(h);
4482
- let f = 0, m = 0;
4483
- const x = u.map((w) => {
4484
- let A = f, C;
4509
+ let p = 0, m = 0;
4510
+ const w = u.map((x) => {
4511
+ let A = p, C;
4485
4512
  for (; (C = i[A]) && (C.whitespace || !C.value); )
4486
4513
  A++;
4487
- let E = w, k = null;
4514
+ let E = x, k = null;
4488
4515
  for (; E > A && (C = i[E - 1]) && (C.whitespace || !(C.value || C instanceof ht)); )
4489
- C instanceof Z && (k = C), E--;
4490
- C instanceof ht && (C.value = "-", C.width = ct("-", C.font || t)), f = w;
4491
- const F = Object.assign(
4492
- i.slice(A, E).filter((j) => j.value),
4516
+ C instanceof K && (k = C), E--;
4517
+ C instanceof ht && (C.value = "-", C.width = ct("-", C.font || t)), p = x;
4518
+ const P = Object.assign(
4519
+ i.slice(A, E).filter((O) => O.value),
4493
4520
  { width: 0 }
4494
4521
  );
4495
- return k && F.push(k), F.width = F.reduce((j, z) => j + z.width, 0), F.width > m && (m = F.width), F;
4522
+ return k && P.push(k), P.width = P.reduce((O, N) => O + N.width, 0), P.width > m && (m = P.width), P;
4496
4523
  });
4497
4524
  let b = !1;
4498
4525
  if (r) {
4499
- const w = r === "ellipsis" ? "…" : r;
4500
- x.forEach((A, C) => {
4526
+ const x = r === "ellipsis" ? "…" : r;
4527
+ w.forEach((A, C) => {
4501
4528
  const E = s(C);
4502
4529
  if (A.width > E) {
4503
- const k = new H(w);
4504
- k.font = t, k.width = ct(w, a), ze(A, E, k), b = !0;
4530
+ const k = new H(x);
4531
+ k.font = t, k.width = ct(x, a), Be(A, E, k), b = !0;
4505
4532
  }
4506
4533
  });
4507
4534
  }
4508
4535
  let v = !1;
4509
4536
  const S = e.overflow() === "ellipsis" ? "…" : e.overflow();
4510
4537
  if (S && h !== i.length) {
4511
- const w = s(x.length - 1), A = x[x.length - 1], C = new H(S);
4512
- C.font = t, C.width = ct(S, a), ze(A, w, C), v = !0;
4538
+ const x = s(w.length - 1), A = w[w.length - 1], C = new H(S);
4539
+ C.font = t, C.width = ct(S, a), Be(A, x, C), v = !0;
4513
4540
  } else
4514
4541
  v = !1;
4515
- return Object.assign(x, {
4516
- height: x.length * t.height,
4542
+ return Object.assign(w, {
4543
+ height: w.length * t.height,
4517
4544
  font: t,
4518
4545
  width: m,
4519
4546
  hasOverflow: v,
@@ -4523,80 +4550,80 @@ function Fi(i, e, t) {
4523
4550
  function ft(i) {
4524
4551
  return Math.round(i * 1e6) / 1e6;
4525
4552
  }
4526
- const Pi = {
4553
+ const Di = {
4527
4554
  center: "middle",
4528
4555
  right: "end"
4529
- }, Di = {
4556
+ }, Li = {
4530
4557
  middle: 0.5,
4531
4558
  center: 0.5,
4532
4559
  bottom: 1,
4533
4560
  end: 1
4534
- }, ee = (i, e) => !i && !e || i === e;
4535
- function Li(i, e) {
4561
+ }, ne = (i, e) => !i && !e || i === e;
4562
+ function Hi(i, e) {
4536
4563
  const t = [], n = e.font(), s = n.size, r = n.family, o = e.align(), a = e.createElement();
4537
4564
  if (i.length) {
4538
- const l = n.height, h = e.valign(), c = e.height()(), d = e.width()(0), u = !isFinite(d) && i.length === 1, g = u ? null : e.x(), p = ft(l / s);
4539
- let f = u ? null : ft(l / (s * 1.15 + (l - s) / 2));
4540
- if (Di[h] && isFinite(c)) {
4565
+ const l = n.height, h = e.valign(), c = e.height()(), d = e.width()(0), u = !isFinite(d) && i.length === 1, g = u ? null : e.x(), f = ft(l / s);
4566
+ let p = u ? null : ft(l / (s * 1.15 + (l - s) / 2));
4567
+ if (Li[h] && isFinite(c)) {
4541
4568
  const E = h === "bottom" ? 1 : 0.5;
4542
- f = (f || 0) + (c * E - l * i.length * E) / s;
4569
+ p = (p || 0) + (c * E - l * i.length * E) / s;
4543
4570
  }
4544
- const x = o === "justify";
4571
+ const w = o === "justify";
4545
4572
  let b = 0;
4546
4573
  o === "right" ? b = d : o === "center" && (b = d / 2);
4547
- let v = [], S = "tspan", w = null, A = "";
4574
+ let v = [], S = "tspan", x = null, A = "";
4548
4575
  const C = () => {
4549
4576
  if (A) {
4550
- const E = a(S, w, A);
4577
+ const E = a(S, x, A);
4551
4578
  v.push(E);
4552
4579
  }
4553
- S = "tspan", w = null, A = "";
4580
+ S = "tspan", x = null, A = "";
4554
4581
  };
4555
4582
  for (let E = 0, k = i.length; E < k; E++) {
4556
- let F = "", j = "", z = 0;
4557
- const R = i[E];
4558
- if (!R.length) {
4583
+ let P = "", O = "", N = 0;
4584
+ const B = i[E];
4585
+ if (!B.length) {
4559
4586
  t.push(
4560
4587
  a("tspan", {
4561
4588
  x: g(E),
4562
- dy: ft(E ? p : f) + "em"
4589
+ dy: ft(E ? f : p) + "em"
4563
4590
  }, " ")
4564
4591
  );
4565
4592
  continue;
4566
4593
  }
4567
4594
  v = [];
4568
- let et = 0, Y = 0, G;
4569
- for (let P = 0, st = R.length; P < st; P++) {
4570
- const L = R[P], B = L.font;
4571
- L.whitespace && et++, Y += L.width, P && !L.tracking && !z && ee(B.id, F) && ee(L.class, j) && ee(G, L.href) ? A += L.value : (C(), A = L.value, w = {
4572
- fontFamily: B.family !== r ? B.family : null,
4573
- fontSize: B.size !== s ? B.size : null,
4574
- fontWeight: B.weight !== 400 && B.weight || null,
4575
- fontStyle: B.style !== "normal" && B.style || null,
4576
- fontVariant: B.variant !== "normal" && B.variant || null,
4577
- fill: B.color || null,
4578
- baselineShift: B.baseline ? B.baseline * 100 + "%" : null,
4579
- className: L.class || null,
4595
+ let et = 0, nt = 0, U;
4596
+ for (let j = 0, L = B.length; j < L; j++) {
4597
+ const D = B[j], z = D.font;
4598
+ D.whitespace && et++, nt += D.width, j && !D.tracking && !N && ne(z.id, P) && ne(D.class, O) && ne(U, D.href) ? A += D.value : (C(), A = D.value, x = {
4599
+ fontFamily: z.family !== r ? z.family : null,
4600
+ fontSize: z.size !== s ? z.size : null,
4601
+ fontWeight: z.weight !== 400 && z.weight || null,
4602
+ fontStyle: z.style !== "normal" && z.style || null,
4603
+ fontVariant: z.variant !== "normal" && z.variant || null,
4604
+ fill: z.color || null,
4605
+ baselineShift: z.baseline ? z.baseline * 100 + "%" : null,
4606
+ className: D.class || null,
4580
4607
  dx: 0,
4581
4608
  href: null,
4582
4609
  rel: null,
4583
4610
  target: null
4584
- }, z && (w.dx = ft(z), z = 0), L.tracking && (z = B.size * L.tracking), L.href && !G ? (G = L.href, S = "a", w.href = G, w.rel = L.rel, w.target = L.target) : G = null, F = B.id, j = L.class);
4611
+ }, N && (x.dx = ft(N), N = 0), D.tracking && (N = z.size * D.tracking), D.href && !U ? (U = D.href, S = "a", x.href = U, x.rel = D.rel, x.target = D.target) : U = null, P = z.id, O = D.class);
4585
4612
  }
4586
4613
  if (C(), u)
4587
4614
  t.push(...v);
4588
4615
  else {
4589
- let P = null;
4590
- const st = E === k - 1 || R[R.length - 1] instanceof Z;
4591
- if (x && R.length > 1 && !st) {
4592
- const L = d - Y;
4593
- P = ft(L / et);
4616
+ let j = null;
4617
+ const L = E === k - 1 || B[B.length - 1] instanceof K;
4618
+ if (w && B.length > 1 && !L) {
4619
+ const D = d - nt;
4620
+ j = ft(D / et);
4594
4621
  }
4595
4622
  t.push(
4596
4623
  a("tspan", {
4597
- wordSpacing: P,
4624
+ wordSpacing: j,
4598
4625
  x: g(E) + b,
4599
- dy: ft(E ? p : f) + "em"
4626
+ dy: ft(E ? f : p) + "em"
4600
4627
  }, ...v)
4601
4628
  );
4602
4629
  }
@@ -4605,53 +4632,53 @@ function Li(i, e) {
4605
4632
  return a("text", {
4606
4633
  fontFamily: r,
4607
4634
  fontSize: s,
4608
- textAnchor: Pi[o] || "start"
4635
+ textAnchor: Di[o] || "start"
4609
4636
  }, ...t);
4610
4637
  }
4611
- const Hi = {
4638
+ const _i = {
4612
4639
  middle: 0.5,
4613
4640
  center: 0.5,
4614
4641
  bottom: 1,
4615
4642
  end: 1
4616
4643
  };
4617
- function _i(i, e) {
4644
+ function Ii(i, e) {
4618
4645
  return i.color ? i.color : e.href ? "#00C" : "#000";
4619
4646
  }
4620
- function Ii(i, e, t) {
4647
+ function zi(i, e, t) {
4621
4648
  if (!i.length)
4622
4649
  return;
4623
4650
  t.textBaseline = "middle";
4624
4651
  const n = e.font(), s = n.height, r = n.size, o = e.valign(), a = e.height()(), l = e.width()(0), h = e.align(), c = h === "justify";
4625
4652
  let d = s * 0.5;
4626
- const u = Hi[o];
4653
+ const u = _i[o];
4627
4654
  if (u && isFinite(a)) {
4628
4655
  const g = i.length * s;
4629
4656
  d += a * u - g * u;
4630
4657
  }
4631
- i.forEach((g, p) => {
4632
- let f = e.x()(p);
4633
- const m = p * s + d;
4634
- let x = 0, b = 0;
4635
- g.forEach((w) => {
4636
- w.whitespace && x++, b += w.width;
4658
+ i.forEach((g, f) => {
4659
+ let p = e.x()(f);
4660
+ const m = f * s + d;
4661
+ let w = 0, b = 0;
4662
+ g.forEach((x) => {
4663
+ x.whitespace && w++, b += x.width;
4637
4664
  });
4638
4665
  let v = 0;
4639
- const S = p === i.length - 1 || g[g.length - 1] instanceof Z;
4640
- c && g.length > 1 && !S && (v = (l - b) / x), g.forEach((w) => {
4641
- t.font = w.font;
4642
- const A = w.font, C = A.baseline ? r * -A.baseline + r * 0.15 : 0;
4643
- t.fillStyle = _i(A, w);
4666
+ const S = f === i.length - 1 || g[g.length - 1] instanceof K;
4667
+ c && g.length > 1 && !S && (v = (l - b) / w), g.forEach((x) => {
4668
+ t.font = x.font;
4669
+ const A = x.font, C = A.baseline ? r * -A.baseline + r * 0.15 : 0;
4670
+ t.fillStyle = Ii(A, x);
4644
4671
  let E = 0;
4645
- if (h === "right" ? E += l - b : h === "center" ? E += l / 2 - b / 2 : h === "justify" && (w.whitespace || w instanceof Z) && (f += v), t.fillText(w.value, f + E, m + C), w.href) {
4672
+ if (h === "right" ? E += l - b : h === "center" ? E += l / 2 - b / 2 : h === "justify" && (x.whitespace || x instanceof K) && (p += v), t.fillText(x.value, p + E, m + C), x.href) {
4646
4673
  t.beginPath(), t.strokeStyle = t.fillStyle;
4647
4674
  const k = Math.floor(m + r * 0.45) + 0.5;
4648
- t.moveTo(f + E, k), t.lineTo(f + E + w.width, k), t.stroke();
4675
+ t.moveTo(p + E, k), t.lineTo(p + E + x.width, k), t.stroke();
4649
4676
  }
4650
- f += w.width;
4677
+ p += x.width;
4651
4678
  });
4652
4679
  });
4653
4680
  }
4654
- function An(i) {
4681
+ function En(i) {
4655
4682
  const e = {
4656
4683
  /* text, ctx, d3, fn */
4657
4684
  };
@@ -4661,37 +4688,37 @@ function An(i) {
4661
4688
  }
4662
4689
  return e;
4663
4690
  }
4664
- const zi = Object.prototype.hasOwnProperty, ne = {};
4665
- function Bi(i) {
4666
- return ne[i] || (ne[i] = i.replace(/([a-z])([A-Z])/g, (e, t, n) => t + "-" + n.toLowerCase())), ne[i];
4691
+ const Bi = Object.prototype.hasOwnProperty, se = {};
4692
+ function Ri(i) {
4693
+ return se[i] || (se[i] = i.replace(/([a-z])([A-Z])/g, (e, t, n) => t + "-" + n.toLowerCase())), se[i];
4667
4694
  }
4668
- function En(i, e) {
4695
+ function Cn(i, e) {
4669
4696
  if (Array.isArray(e))
4670
- return e.forEach((t) => En(i, t));
4697
+ return e.forEach((t) => Cn(i, t));
4671
4698
  typeof e == "string" && (e = document.createTextNode(e)), i.appendChild(e);
4672
4699
  }
4673
- function Cn(i, e, ...t) {
4700
+ function kn(i, e, ...t) {
4674
4701
  if (typeof document > "u")
4675
4702
  throw new Error("No document found, cannot create elements");
4676
4703
  const n = typeof i == "string" ? document.createElementNS("http://www.w3.org/2000/svg", i) : i;
4677
4704
  if (e && n.setAttribute)
4678
4705
  for (const s in e)
4679
- zi.call(e, s) && e[s] != null && n.setAttribute(
4680
- s === "className" ? "class" : Bi(s),
4706
+ Bi.call(e, s) && e[s] != null && n.setAttribute(
4707
+ s === "className" ? "class" : Ri(s),
4681
4708
  String(e[s])
4682
4709
  );
4683
4710
  return t != null && t.length && t.forEach((s) => {
4684
- En(n, s);
4711
+ Cn(n, s);
4685
4712
  }), n;
4686
4713
  }
4687
- const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4714
+ const $e = (i) => typeof i == "function" ? i : () => i, $i = {
4688
4715
  top: { vAnchor: -0 },
4689
4716
  middle: { vAnchor: -0.5 },
4690
4717
  bottom: { vAnchor: -1 },
4691
4718
  left: { hAnchor: -0 },
4692
4719
  center: { hAnchor: -0.5 },
4693
4720
  right: { hAnchor: -1 }
4694
- }, Ot = class Ot {
4721
+ }, Xt = class Xt {
4695
4722
  constructor(e) {
4696
4723
  if (this.props = {
4697
4724
  width: () => 1 / 0,
@@ -4722,7 +4749,7 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4722
4749
  ];
4723
4750
  if (typeof e == "string") {
4724
4751
  const o = this.props;
4725
- e.toLowerCase().trim().split(/\s+/).forEach((a) => Object.assign(o, Ri[a]));
4752
+ e.toLowerCase().trim().split(/\s+/).forEach((a) => Object.assign(o, $i[a]));
4726
4753
  }
4727
4754
  return this;
4728
4755
  }
@@ -4736,7 +4763,7 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4736
4763
  * @return {this}
4737
4764
  */
4738
4765
  width(e) {
4739
- return arguments.length ? (this.props.width = Re(e), this) : this.props.width;
4766
+ return arguments.length ? (this.props.width = $e(e), this) : this.props.width;
4740
4767
  }
4741
4768
  /**
4742
4769
  * @overload
@@ -4748,7 +4775,7 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4748
4775
  * @return {this}
4749
4776
  */
4750
4777
  height(e) {
4751
- return arguments.length ? (this.props.height = Re(e), this) : this.props.height;
4778
+ return arguments.length ? (this.props.height = $e(e), this) : this.props.height;
4752
4779
  }
4753
4780
  /**
4754
4781
  * @overload
@@ -4763,14 +4790,14 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4763
4790
  return arguments.length ? (this.props.rotation = e, this) : this.props.rotation;
4764
4791
  }
4765
4792
  createElement(e) {
4766
- return arguments.length ? (this.props.createElement = e, this) : this.props.createElement || Ot.createElement;
4793
+ return arguments.length ? (this.props.createElement = e, this) : this.props.createElement || Xt.createElement;
4767
4794
  }
4768
4795
  canvas(e, t) {
4769
4796
  const n = e.getContext ? e.getContext("2d") : e;
4770
4797
  return n.save(), n.rotate(this.rotate() * Math.PI / 180), n.translate(...this.anchor()), t(n), n.restore(), n;
4771
4798
  }
4772
4799
  render(...e) {
4773
- const t = An(e);
4800
+ const t = En(e);
4774
4801
  if (t.d3)
4775
4802
  return t.d3.attr("transform", `rotate(${this.rotate()}) translate(${this.anchor()})`);
4776
4803
  if (t.ctx)
@@ -4783,24 +4810,24 @@ const Re = (i) => typeof i == "function" ? i : () => i, Ri = {
4783
4810
  }
4784
4811
  }
4785
4812
  };
4786
- y(Ot, "createElement", Cn);
4787
- let he = Ot;
4788
- const se = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, $i = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, $e = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Ni = /^(?:[;\xAD%?…]|,(?!\d))/, Yi = /^[´±°¢£¤$¥\u2212]/, Xi = "'“‘[「【﹝〔<‹«{『((<《".split(""), Oi = "',,,!!??”]」】》>’»﹞〕〗〉}))』。".split(""), Ne = (i) => {
4813
+ y(Xt, "createElement", kn);
4814
+ let de = Xt;
4815
+ const ie = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, Ni = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, Ne = /^[\xA0\u2011\u202F\u2060\uFEFF]/, Yi = /^(?:[;\xAD%?…]|,(?!\d))/, Oi = /^[´±°¢£¤$¥\u2212]/, Xi = "'“‘[「【﹝〔<‹«{『((<《".split(""), Ui = "',,,!!??”]」】》>’»﹞〕〗〉}))』。".split(""), Ye = (i) => {
4789
4816
  const e = i.charCodeAt(0);
4790
4817
  return e >= 19968 && e <= 40959;
4791
4818
  };
4792
- function Xt(i, e) {
4819
+ function Ot(i, e) {
4793
4820
  e !== !1 && (i = i.trim());
4794
4821
  const t = [];
4795
4822
  let n = i.charAt(0), s, r, o = 0;
4796
4823
  for (let a = 1, l = i.length; a < l; a++) {
4797
4824
  s = i.charAt(a), r = i.charAt(a + 1);
4798
- const h = se.test(n), c = se.test(s);
4799
- let d = c || h || Ne(n) || Ne(s), u;
4800
- if ((Yi.test(s) && !$e.test(n) || Ni.test(n + r) && !$e.test(s)) && (d = !0), d && (Oi.includes(s) || Xi.includes(n)) && (d = !1), (n === "-" || // - ASCII dash
4825
+ const h = ie.test(n), c = ie.test(s);
4826
+ let d = c || h || Ye(n) || Ye(s), u;
4827
+ if ((Oi.test(s) && !Ne.test(n) || Yi.test(n + r) && !Ne.test(s)) && (d = !0), d && (Ui.includes(s) || Xi.includes(n)) && (d = !1), (n === "-" || // - ASCII dash
4801
4828
  n === "‐" || // ‐ Unicode hyphen
4802
4829
  n === "–" || // – En dash
4803
- n === "—") && (u = se.test(i.charAt(a - 2)), u && !c && (d = !1), !u && $i.test(s + r) && (d = !0)), d) {
4830
+ n === "—") && (u = ie.test(i.charAt(a - 2)), u && !c && (d = !1), !u && Ni.test(s + r) && (d = !0)), d) {
4804
4831
  const g = i.slice(o, a);
4805
4832
  /\u00AD$/.test(g) ? (t.push(new H(g.slice(0, -1))), t.push(new ht())) : (t.push(new H(g)), t.push(new Tt())), o = a;
4806
4833
  }
@@ -4808,7 +4835,7 @@ function Xt(i, e) {
4808
4835
  }
4809
4836
  return t.push(new H(i.slice(o))), t;
4810
4837
  }
4811
- const Ye = {
4838
+ const Oe = {
4812
4839
  nbsp: " ",
4813
4840
  iexcl: "¡",
4814
4841
  cent: "¢",
@@ -5060,7 +5087,7 @@ const Ye = {
5060
5087
  permil: "‰",
5061
5088
  lsaquo: "‹",
5062
5089
  rsaquo: "›"
5063
- }, Ui = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, qi = /^<\/([a-zA-Z0-9]+)([^>]*)>/, Wi = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, ji = /^<!--(.+?)-->/, Gi = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, Xe = {
5090
+ }, qi = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, Wi = /^<\/([a-zA-Z0-9]+)([^>]*)>/, ji = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, Gi = /^<!--(.+?)-->/, Vi = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, Xe = {
5064
5091
  b: (i) => i.weight = 700,
5065
5092
  strong: (i) => i.weight = 700,
5066
5093
  i: (i) => i.style = "italic",
@@ -5074,7 +5101,7 @@ const Ye = {
5074
5101
  tt: (i) => i.family = "monospace",
5075
5102
  sub: (i) => i.sub = !0,
5076
5103
  sup: (i) => i.sup = !0
5077
- }, Vi = {
5104
+ }, Zi = {
5078
5105
  div: 1,
5079
5106
  li: 1,
5080
5107
  blockquote: 2,
@@ -5089,27 +5116,27 @@ const Ye = {
5089
5116
  hr: 2,
5090
5117
  p: 2
5091
5118
  };
5092
- function kn(i) {
5093
- return i.replace(Gi, function(e, t, n, s) {
5119
+ function Mn(i) {
5120
+ return i.replace(Vi, function(e, t, n, s) {
5094
5121
  if (t || n) {
5095
5122
  const r = t ? 10 : 16;
5096
5123
  return String.fromCharCode(parseInt(t || n, r));
5097
- } else if (s in Ye)
5098
- return Ye[s];
5124
+ } else if (s in Oe)
5125
+ return Oe[s];
5099
5126
  return e;
5100
5127
  });
5101
5128
  }
5102
- function Zi(i) {
5129
+ function Ki(i) {
5103
5130
  return i && i.length > 1 && (i[0] === '"' && i[i.length - 1] === '"' || i[0] === "'" && i[i.length - 1] === "'") ? i.slice(1, -1) : i;
5104
5131
  }
5105
- const Ki = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
5106
- function Ji(i) {
5132
+ const Ji = /^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;
5133
+ function Qi(i) {
5107
5134
  let e;
5108
5135
  const t = {};
5109
5136
  if (i) {
5110
5137
  do
5111
- if (e = Ki.exec(i), e) {
5112
- const n = kn(Zi(e[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
5138
+ if (e = Ji.exec(i), e) {
5139
+ const n = Mn(Ki(e[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
5113
5140
  if (t[e[1]] = n, i = i.slice(e[0].length), i.length && /^\S/.test(i[0]))
5114
5141
  throw new Error("Attribute error");
5115
5142
  }
@@ -5119,7 +5146,7 @@ function Ji(i) {
5119
5146
  }
5120
5147
  return t;
5121
5148
  }
5122
- function Qi(i) {
5149
+ function tr(i) {
5123
5150
  i = String(i || "").trim();
5124
5151
  let e = {
5125
5152
  weight: null,
@@ -5143,38 +5170,38 @@ function Qi(i) {
5143
5170
  n.length && (e = n.pop());
5144
5171
  }, h = (d) => {
5145
5172
  const u = t.length;
5146
- let g = Vi[d];
5173
+ let g = Zi[d];
5147
5174
  if (u && g) {
5148
- let p = u - 1;
5149
- for (; t[p] && (t[p] instanceof Tt || Ui.test(t[p].value)); )
5150
- p--;
5151
- for (; g && t[p] && t[p] instanceof Z; )
5152
- p--, g--;
5175
+ let f = u - 1;
5176
+ for (; t[f] && (t[f] instanceof Tt || qi.test(t[f].value)); )
5177
+ f--;
5178
+ for (; g && t[f] && t[f] instanceof K; )
5179
+ f--, g--;
5153
5180
  for (; g-- > 0; )
5154
- t.push(new Z());
5181
+ t.push(new K());
5155
5182
  }
5156
5183
  };
5157
5184
  for (; i.length; ) {
5158
5185
  if (s = /^[^<]+/.exec(i)) {
5159
- const d = kn(s[0]);
5160
- Xt(d, !1).forEach(o);
5161
- } else if (!(s = ji.exec(i))) if (s = qi.exec(i))
5186
+ const d = Mn(s[0]);
5187
+ Ot(d, !1).forEach(o);
5188
+ } else if (!(s = Gi.exec(i))) if (s = Wi.exec(i))
5162
5189
  l(), h(s[1]);
5163
- else if (s = Wi.exec(i)) {
5190
+ else if (s = ji.exec(i)) {
5164
5191
  const d = s[1];
5165
5192
  h(d), a(), Xe[d] && Xe[d](e);
5166
- const u = Ji(s[2]);
5167
- d === "a" && (u.href && (e.href = u.href), u.rel && (e.rel = u.rel), u.target && (e.target = u.target)), u.class && (e.class = e.class ? e.class + " " + u.class : u.class), u.style && (r = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(u.style), r && r[1] && (e.color = r[1])), d === "br" && t.push(new Z());
5193
+ const u = Qi(s[2]);
5194
+ d === "a" && (u.href && (e.href = u.href), u.rel && (e.rel = u.rel), u.target && (e.target = u.target)), u.class && (e.class = e.class ? e.class + " " + u.class : u.class), u.style && (r = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(u.style), r && r[1] && (e.color = r[1])), d === "br" && t.push(new K());
5168
5195
  } else
5169
5196
  s = [i.slice(0, 1)], o(new H(s[0]));
5170
5197
  i = i.slice(s[0].length);
5171
5198
  }
5172
5199
  let c = t[t.length - 1];
5173
- for (; c instanceof Z; )
5200
+ for (; c instanceof K; )
5174
5201
  t.pop(), c = t[t.length - 1];
5175
5202
  return t;
5176
5203
  }
5177
- const Oe = {
5204
+ const Ue = {
5178
5205
  copyright: "©",
5179
5206
  textcopyright: "©",
5180
5207
  dag: "†",
@@ -5376,7 +5403,7 @@ const Oe = {
5376
5403
  SS: "SS",
5377
5404
  th: "þ",
5378
5405
  TH: "Þ"
5379
- }, tr = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, er = /^%[^\n]+(?:\n|$)/, nr = /^[^#$%&~_^\\{}]+/, sr = /^\\([&{}$%#_])/, ir = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, rr = {
5406
+ }, er = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, nr = /^%[^\n]+(?:\n|$)/, sr = /^[^#$%&~_^\\{}]+/, ir = /^\\([&{}$%#_])/, rr = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, or = {
5380
5407
  "---": "—",
5381
5408
  // \textemdash
5382
5409
  "--": "–",
@@ -5416,7 +5443,7 @@ const Oe = {
5416
5443
  // (0 width NBSp) end sentence
5417
5444
  "\\\\": "\\newline{}"
5418
5445
  // newline command shorthand
5419
- }, N = {
5446
+ }, $ = {
5420
5447
  bf: (i) => i.weight = "bold",
5421
5448
  it: (i) => i.style = "italic",
5422
5449
  sl: (i) => i.style = "italic",
@@ -5425,27 +5452,27 @@ const Oe = {
5425
5452
  "^": (i) => i.sup = !0,
5426
5453
  _: (i) => i.sub = !0,
5427
5454
  par: function(i) {
5428
- this.tokens.push(new Z(), new Z());
5455
+ this.tokens.push(new K(), new K());
5429
5456
  },
5430
5457
  newline: function(i) {
5431
- this.tokens.push(new Z());
5458
+ this.tokens.push(new K());
5432
5459
  },
5433
5460
  url: function(i, e) {
5434
5461
  i = this.open_context(), i.href = e, this.add_token(new H(e)), this.close_context();
5435
5462
  }
5436
5463
  };
5437
- N.textsuperscript = N["^"];
5438
- N.textsubscript = N._;
5439
- N.textsl = N.sl;
5440
- N.mathbf = N.bf;
5441
- N.mathit = N.it;
5442
- N.textbf = N.bf;
5443
- N.textit = N.it;
5444
- N.textcolor = N.color;
5445
- function or(i) {
5464
+ $.textsuperscript = $["^"];
5465
+ $.textsubscript = $._;
5466
+ $.textsl = $.sl;
5467
+ $.mathbf = $.bf;
5468
+ $.mathit = $.it;
5469
+ $.textbf = $.bf;
5470
+ $.textit = $.it;
5471
+ $.textcolor = $.color;
5472
+ function ar(i) {
5446
5473
  i = String(i || "").trim();
5447
5474
  const e = [0];
5448
- i = i.replace(/\\verb,(.*?),/, (c, d) => (e.push(d), "\\verb," + (e.length - 1) + ",")).replace(/\\\\\n/g, () => "\\\\").replace(ir, (c, d, u) => u.charAt(d - 1) === "\\" ? c : rr[c]).replace(/\n\s+/g, (c) => /\n/.test(c.slice(1)) ? "\\par " : c).replace(/\\symbol\{(\d+)\}/, (c, d, u, g) => g.charAt(u - 1) === "\\" ? c : String.fromCharCode(1 * d)).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, (c, d, u, g) => d + u + "{" + g + "}").replace(/\\verb,(.*?),/, (c, d) => `\\verb,${e[+d]},`);
5475
+ i = i.replace(/\\verb,(.*?),/, (c, d) => (e.push(d), "\\verb," + (e.length - 1) + ",")).replace(/\\\\\n/g, () => "\\\\").replace(rr, (c, d, u) => u.charAt(d - 1) === "\\" ? c : or[c]).replace(/\n\s+/g, (c) => /\n/.test(c.slice(1)) ? "\\par " : c).replace(/\\symbol\{(\d+)\}/, (c, d, u, g) => g.charAt(u - 1) === "\\" ? c : String.fromCharCode(1 * d)).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g, (c, d, u, g) => d + u + "{" + g + "}").replace(/\\verb,(.*?),/, (c, d) => `\\verb,${e[+d]},`);
5449
5476
  let t = {
5450
5477
  weight: null,
5451
5478
  italic: null,
@@ -5473,38 +5500,38 @@ function or(i) {
5473
5500
  add_token: o
5474
5501
  };
5475
5502
  for (; i.length; ) {
5476
- if (r = nr.exec(i))
5477
- Xt(r[0], !1).forEach(o);
5478
- else if (r = sr.exec(i))
5503
+ if (r = sr.exec(i))
5504
+ Ot(r[0], !1).forEach(o);
5505
+ else if (r = ir.exec(i))
5479
5506
  o(new H(r[1]));
5480
- else if (!(r = er.exec(i))) {
5507
+ else if (!(r = nr.exec(i))) {
5481
5508
  if (r = /^\{/.exec(i))
5482
5509
  a();
5483
5510
  else if (r = /^\}/.exec(i))
5484
5511
  l();
5485
5512
  else if (!(r = /^\$/.exec(i))) if (r = /^\\verb,([^,]+),/.exec(i))
5486
5513
  o(new H(r[1]));
5487
- else if (r = tr.exec(i)) {
5514
+ else if (r = er.exec(i)) {
5488
5515
  const c = r[1].slice(1) || r[1];
5489
5516
  let d = !!r[2];
5490
5517
  if (/^(La)?TeX$/i.test(c)) {
5491
5518
  a(), t.family = "serif";
5492
5519
  let u;
5493
5520
  c === "LaTeX" && (u = o(new H("L")), u.tracking = -0.25, u = o(new H("A")), u.size = 0.7, u.baseline = 0.3, u.tracking = -0.1), u = o(new H("T")), u.tracking = -0.17, u = o(new H("E")), u.baseline = -0.22, u.tracking = -0.13, u = o(new H("X")), l();
5494
- } else if (c in Oe)
5495
- o(new H(Oe[c])), d && a();
5496
- else if (c in N) {
5521
+ } else if (c in Ue)
5522
+ o(new H(Ue[c])), d && a();
5523
+ else if (c in $) {
5497
5524
  const u = [];
5498
- let g = N[c].length - 1, p;
5525
+ let g = $[c].length - 1, f;
5499
5526
  if (g) {
5500
5527
  for (d = !1, i = i.slice(r[0].length - 1); g--; )
5501
- if (p = /^\{([^}]+)\}/.exec(i))
5502
- u.push(p[1]), i = i.slice(p[0].length);
5528
+ if (f = /^\{([^}]+)\}/.exec(i))
5529
+ u.push(f[1]), i = i.slice(f[0].length);
5503
5530
  else
5504
5531
  throw new Error(c + " is missing an argument");
5505
5532
  r[0] = /^\{/.exec(i) ? "{" : "", d = !!r[0];
5506
5533
  }
5507
- d && a(), N[c].apply(h, [t, ...u]);
5534
+ d && a(), $[c].apply(h, [t, ...u]);
5508
5535
  } else
5509
5536
  o(new H(r[1])), d && a();
5510
5537
  } else
@@ -5514,7 +5541,7 @@ function or(i) {
5514
5541
  }
5515
5542
  return n;
5516
5543
  }
5517
- const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5544
+ const cr = new Z(), re = (i) => typeof i == "function" ? i : () => i, qe = {
5518
5545
  left: "left",
5519
5546
  start: "left",
5520
5547
  center: "center",
@@ -5522,7 +5549,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5522
5549
  right: "right",
5523
5550
  end: "right",
5524
5551
  justify: "justify"
5525
- }, $ = class $ {
5552
+ }, R = class R {
5526
5553
  /**
5527
5554
  * @param {object} [opts]
5528
5555
  * @param {string | Font} [opts.font = '12px/14px sans-serif']
@@ -5552,8 +5579,8 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5552
5579
  height: () => 1 / 0,
5553
5580
  x: () => 0,
5554
5581
  /** @type {Font} */
5555
- font: ar,
5556
- parser: $.defaultparser
5582
+ font: cr,
5583
+ parser: R.defaultparser
5557
5584
  }, e && (e.font && this.font(e.font), e.overflow && this.overflow(e.overflow), e.overflowLine && this.overflowLine(e.overflowLine), e.overflowWrap && this.overflowWrap(e.overflowWrap), e.valign && this.valign(e.valign), e.align && this.align(e.align), e.width && this.width(e.width), e.height && this.height(e.height), e.x && this.x(e.x), e.parser && this.parser(e.parser), e.createElement && this.createElement(e.createElement));
5558
5585
  }
5559
5586
  /**
@@ -5561,7 +5588,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5561
5588
  * @return {import('./types.js').Lines & import('./types.js').LinesPropsRender}
5562
5589
  */
5563
5590
  linebreak(e) {
5564
- const t = this.props.parser(String(e)), n = Fi(t, this, this.font()), s = (r) => this.render(n, r);
5591
+ const t = this.props.parser(String(e)), n = Pi(t, this, this.font()), s = (r) => this.render(n, r);
5565
5592
  return Object.assign(n, {
5566
5593
  render: s,
5567
5594
  svg: s,
@@ -5578,7 +5605,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5578
5605
  * @return {this}
5579
5606
  */
5580
5607
  font(e) {
5581
- return arguments.length ? (this.props.font = new V(e), this) : this.props.font || new V();
5608
+ return arguments.length ? (this.props.font = new Z(e), this) : this.props.font || new Z();
5582
5609
  }
5583
5610
  /**
5584
5611
  * @overload
@@ -5629,7 +5656,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5629
5656
  if (!arguments.length)
5630
5657
  return this.props.align;
5631
5658
  const t = String(e).toLowerCase();
5632
- return t in Ue && (this.props.align = Ue[t]), this;
5659
+ return t in qe && (this.props.align = qe[t]), this;
5633
5660
  }
5634
5661
  /**
5635
5662
  * @overload
@@ -5657,7 +5684,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5657
5684
  */
5658
5685
  width(e) {
5659
5686
  return arguments.length ? (this.props.width = /** @type {(line?: number) => number} */
5660
- ie(e), this) : this.props.width;
5687
+ re(e), this) : this.props.width;
5661
5688
  }
5662
5689
  /**
5663
5690
  * @overload
@@ -5670,7 +5697,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5670
5697
  */
5671
5698
  height(e) {
5672
5699
  return arguments.length ? (this.props.height = /** @type {() => number} */
5673
- ie(e), this) : this.props.height;
5700
+ re(e), this) : this.props.height;
5674
5701
  }
5675
5702
  /**
5676
5703
  * @overload
@@ -5683,7 +5710,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5683
5710
  */
5684
5711
  x(e) {
5685
5712
  return arguments.length ? (this.props.x = /** @type {(line?: number) => number} */
5686
- ie(e), this) : this.props.x;
5713
+ re(e), this) : this.props.x;
5687
5714
  }
5688
5715
  /**
5689
5716
  * @overload
@@ -5698,7 +5725,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5698
5725
  if (!arguments.length)
5699
5726
  return this.props.parser;
5700
5727
  if (typeof e == "string") {
5701
- const t = $[e] || $[e + "parser"];
5728
+ const t = R[e] || R[e + "parser"];
5702
5729
  typeof t == "function" && (e = t);
5703
5730
  }
5704
5731
  if (typeof e != "function")
@@ -5715,7 +5742,7 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5715
5742
  * @return {this}
5716
5743
  */
5717
5744
  createElement(e) {
5718
- return arguments.length ? (this.props.createElement = e, this) : this.props.createElement || $.createElement;
5745
+ return arguments.length ? (this.props.createElement = e, this) : this.props.createElement || R.createElement;
5719
5746
  }
5720
5747
  /**
5721
5748
  * @overload
@@ -5729,14 +5756,14 @@ const ar = new V(), ie = (i) => typeof i == "function" ? i : () => i, Ue = {
5729
5756
  * @return {undefined}
5730
5757
  */
5731
5758
  render(e, t) {
5732
- const n = An([e, t]);
5759
+ const n = En([e, t]);
5733
5760
  if (typeof n.text == "string" && (n.text = this.linebreak(n.text)), n.ctx)
5734
- Ii(n.text, this, n.ctx);
5761
+ zi(n.text, this, n.ctx);
5735
5762
  else
5736
- return Li(n.text, this);
5763
+ return Hi(n.text, this);
5737
5764
  }
5738
5765
  };
5739
- y($, "createElement", Cn), y($, "textparser", Xt), y($, "defaultparser", Xt), y($, "htmlparser", Qi), y($, "latexparser", or), y($, "Token", H), y($, "Break", Tt), y($, "LineBreak", Z), y($, "SoftHyphen", ht), y($, "Rotator", he), y($, "Font", V), y($, "setMeasureCanvas", ki), /**
5766
+ y(R, "createElement", kn), y(R, "textparser", Ot), y(R, "defaultparser", Ot), y(R, "htmlparser", tr), y(R, "latexparser", ar), y(R, "Token", H), y(R, "Break", Tt), y(R, "LineBreak", K), y(R, "SoftHyphen", ht), y(R, "Rotator", de), y(R, "Font", Z), y(R, "setMeasureCanvas", Mi), /**
5740
5767
  * Measure a string of text as printed with a specified font and return
5741
5768
  * its width.
5742
5769
  *
@@ -5745,41 +5772,41 @@ y($, "createElement", Cn), y($, "textparser", Xt), y($, "defaultparser", Xt), y(
5745
5772
  * @param {import('./types.js').MeasureOptions} [options]
5746
5773
  * @return {number}
5747
5774
  */
5748
- y($, "measureText", function(e, t, n) {
5749
- return ct(e, new V(t), n);
5775
+ y(R, "measureText", function(e, t, n) {
5776
+ return ct(e, new Z(t), n);
5750
5777
  });
5751
- let Et = $;
5752
- function cr(i, e, t, n) {
5778
+ let Et = R;
5779
+ function lr(i, e, t, n) {
5753
5780
  const { width: s, height: r } = q(e), {
5754
- color: o = U.color,
5755
- strokeColor: a = U.strokeColor,
5756
- strokeWidth: l = U.strokeWidth,
5757
- strokeType: h = U.strokeType,
5758
- background: c = U.background,
5759
- borderRadius: d = U.borderRadius,
5760
- fixedSize: u = U.fixedSize
5761
- } = e.properties.style || U, g = yn(i, e, t, n);
5781
+ color: o = G.color,
5782
+ strokeColor: a = G.strokeColor,
5783
+ strokeWidth: l = G.strokeWidth,
5784
+ strokeType: h = G.strokeType,
5785
+ background: c = G.background,
5786
+ borderRadius: d = G.borderRadius,
5787
+ fixedSize: u = G.fixedSize
5788
+ } = e.properties.style || G, g = wn(i, e, t, n);
5762
5789
  g.setAttribute("data-annotation-type", e.properties.type), g.classList.add("annotation-text"), g.setAttribute("fill", `${o}`);
5763
- let p = g.firstChild;
5764
- for (; p; ) {
5765
- const v = p.nextSibling;
5766
- p.nodeType === 1 && p.tagName !== "rect" && g.removeChild(p), p = v;
5767
- }
5768
5790
  let f = g.firstChild;
5769
- f || (f = M("rect"), g.appendChild(f));
5770
- const m = -s / 2, x = -r / 2;
5771
- d && (f.setAttribute("rx", `${d}`), f.setAttribute("ry", `${d}`)), h && h !== "none" && (f.setAttribute("stroke", a || "black"), f.setAttribute("stroke-width", `${l}`), h === "dashed" && f.setAttribute("stroke-dasharray", "5,5")), c && c.length && (n.hoveredFeature === e.id ? f.setAttribute("fill", Ft(c)) : f.setAttribute("fill", c)), f.setAttribute("width", `${s}`), f.setAttribute("height", `${r}`);
5791
+ for (; f; ) {
5792
+ const v = f.nextSibling;
5793
+ f.nodeType === 1 && f.tagName !== "rect" && g.removeChild(f), f = v;
5794
+ }
5795
+ let p = g.firstChild;
5796
+ p || (p = M("rect"), g.appendChild(p));
5797
+ const m = -s / 2, w = -r / 2;
5798
+ d && (p.setAttribute("rx", `${d}`), p.setAttribute("ry", `${d}`)), h && h !== "none" && (p.setAttribute("stroke", a || "black"), p.setAttribute("stroke-width", `${l}`), h === "dashed" && p.setAttribute("stroke-dasharray", "5,5")), c && c.length && (n.hoveredFeature === e.id ? p.setAttribute("fill", Ft(c)) : p.setAttribute("fill", c)), p.setAttribute("width", `${s}`), p.setAttribute("height", `${r}`);
5772
5799
  const b = Q(e);
5773
- return f.setAttribute("x", `${m}`), f.setAttribute("y", `${x}`), lr(e, g, m, x), g.setAttribute(
5800
+ return p.setAttribute("x", `${m}`), p.setAttribute("y", `${w}`), hr(e, g, m, w), g.setAttribute(
5774
5801
  "transform",
5775
5802
  n.getScreenAlignedTransform(b.x, b.y, !u)
5776
5803
  ), i.appendChild(g), g;
5777
5804
  }
5778
- const qe = (i) => i.replace(/…$/, ""), We = (i) => i.children[0].innerHTML;
5779
- function lr(i, e, t = 0, n = 0) {
5805
+ const We = (i) => i.replace(/…$/, ""), je = (i) => i.children[0].innerHTML;
5806
+ function hr(i, e, t = 0, n = 0) {
5780
5807
  const { width: s, height: r } = q(i), {
5781
- fontSize: o = U.fontSize,
5782
- font: a = U.font,
5808
+ fontSize: o = G.fontSize,
5809
+ font: a = G.font,
5783
5810
  padding: l = 0
5784
5811
  } = i.properties.style || {};
5785
5812
  if (s === r && s === 0) return;
@@ -5798,27 +5825,27 @@ function lr(i, e, t = 0, n = 0) {
5798
5825
  const d = i.properties.content || "";
5799
5826
  if (d.length === 0) return;
5800
5827
  const g = c.linebreak(d.replaceAll(`
5801
- `, "<br>")).svg(), p = [...g.children], f = d.match(/(https?:\/\/.*)/gm);
5802
- (f ? f.map((x) => x.split(" ")[0]) : []).forEach((x) => {
5803
- let b = x;
5828
+ `, "<br>")).svg(), f = [...g.children], p = d.match(/(https?:\/\/.*)/gm);
5829
+ (p ? p.map((w) => w.split(" ")[0]) : []).forEach((w) => {
5830
+ let b = w;
5804
5831
  const v = [];
5805
5832
  for (; b.length > 0; ) {
5806
- const S = p.find(
5807
- (A) => !!A.children[0] && A.children[0].tagName === "tspan" && b.startsWith(qe(We(A)))
5833
+ const S = f.find(
5834
+ (A) => !!A.children[0] && A.children[0].tagName === "tspan" && b.startsWith(We(je(A)))
5808
5835
  );
5809
5836
  if (!S) break;
5810
5837
  v.push(S);
5811
- const w = qe(S.children[0].innerHTML).length;
5812
- if (!w) break;
5813
- b = b.slice(w);
5838
+ const x = We(S.children[0].innerHTML).length;
5839
+ if (!x) break;
5840
+ b = b.slice(x);
5814
5841
  }
5815
5842
  v.forEach((S) => {
5816
- const w = document.createElementNS("http://www.w3.org/2000/svg", "a");
5817
- w.setAttribute("href", x), w.setAttribute("target", "_blank"), w.innerHTML = We(S), S.children[0].innerHTML = "", S.children[0].appendChild(w);
5843
+ const x = document.createElementNS("http://www.w3.org/2000/svg", "a");
5844
+ x.setAttribute("href", w), x.setAttribute("target", "_blank"), x.innerHTML = je(S), S.children[0].innerHTML = "", S.children[0].appendChild(x);
5818
5845
  });
5819
5846
  }), g.setAttribute("transform", `translate(${t + l}, ${n + l})`), e.appendChild(g);
5820
5847
  }
5821
- class hr extends mn {
5848
+ class dr extends yn {
5822
5849
  constructor(t, n) {
5823
5850
  super(t, n);
5824
5851
  y(this, "features", /* @__PURE__ */ new Map());
@@ -5834,44 +5861,45 @@ class hr extends mn {
5834
5861
  (!this.annotationsRoot || !t.contains(this.annotationsRoot)) && (t.innerHTML = "", t.appendChild(this.getDefs()), this.arrowsRoot = M("g"), this.commentsRoot = M("g"), this.annotationsRoot = M("g"), this.shapesRoot = M("g"), this.annotationsRoot.appendChild(this.arrowsRoot), this.annotationsRoot.appendChild(this.shapesRoot), this.annotationsRoot.appendChild(this.commentsRoot), t.appendChild(this.annotationsRoot)), t.removeChild(this.annotationsRoot);
5835
5862
  const a = this.arrowsRoot, l = this.annotationsRoot, h = this.commentsRoot, c = this.shapesRoot, d = this.store.getState(), u = this.getViewportBounds(), g = new Set(Object.keys(n));
5836
5863
  this.removeFeatures(g);
5837
- const p = /* @__PURE__ */ new Set();
5838
- for (let f of Object.values(n)) {
5839
- if (o[f.id] && (f = { ...f, ...o[f.id] }), !this.isExporting && !this.isFeatureVisible(f, u)) continue;
5840
- p.add(f.id);
5841
- let m = this.features.get(f.id);
5842
- W(f) ? m = yn(
5864
+ const f = /* @__PURE__ */ new Set();
5865
+ for (let p of Object.values(n)) {
5866
+ if (o[p.id] && (p = { ...p, ...o[p.id] }), !this.isExporting && !this.isFeatureVisible(p, u))
5867
+ continue;
5868
+ f.add(p.id);
5869
+ let m = this.features.get(p.id);
5870
+ W(p) ? m = wn(
5843
5871
  c,
5844
- f,
5872
+ p,
5845
5873
  m,
5846
5874
  d
5847
- ) : _(f) ? m = cr(
5875
+ ) : _(p) ? m = lr(
5848
5876
  c,
5849
- f,
5877
+ p,
5850
5878
  m,
5851
5879
  d
5852
- ) : D(f) ? m = gi(
5880
+ ) : F(p) ? m = fi(
5853
5881
  h,
5854
- f,
5882
+ p,
5855
5883
  m,
5856
5884
  d,
5857
- this.visibleFeatures.has(f.id)
5858
- ) : nt(f) ? m = mi(
5885
+ this.visibleFeatures.has(p.id)
5886
+ ) : st(p) ? m = yi(
5859
5887
  c,
5860
- f,
5888
+ p,
5861
5889
  m,
5862
5890
  d
5863
- ) : tt(f) && (m = ii(
5891
+ ) : tt(p) && (m = ri(
5864
5892
  a,
5865
- f,
5893
+ p,
5866
5894
  d.options.minArrowHeight,
5867
5895
  d.options.maxArrowHeight,
5868
5896
  m,
5869
5897
  d
5870
- )), m && this.features.set(f.id, m);
5898
+ )), m && this.features.set(p.id, m);
5871
5899
  }
5872
- this.applyStateClasses(l, s, r), t.appendChild(l), this.visibleFeatures.clear(), this.visibleFeatures = p;
5900
+ this.applyStateClasses(l, s, r), t.appendChild(l), this.visibleFeatures.clear(), this.visibleFeatures = f;
5873
5901
  });
5874
- y(this, "throttleRender", rn(
5902
+ y(this, "throttleRender", on(
5875
5903
  () => this.render(this.layer.element),
5876
5904
  16,
5877
5905
  !0
@@ -5889,7 +5917,7 @@ class hr extends mn {
5889
5917
  {
5890
5918
  draw: this.render
5891
5919
  },
5892
- de.SHAPES
5920
+ ue.SHAPES
5893
5921
  ), this.store.subscribe(
5894
5922
  (s) => ({
5895
5923
  features: s.features,
@@ -5908,14 +5936,13 @@ class hr extends mn {
5908
5936
  }
5909
5937
  getViewportBounds() {
5910
5938
  const t = this.ogma;
5911
- let n;
5939
+ let n = null;
5912
5940
  try {
5913
5941
  n = t.view.getSize();
5914
5942
  } catch {
5915
- return { minX: 0, minY: 0, maxX: 0, maxY: 0 };
5943
+ return [0, 0, 0, 0];
5916
5944
  }
5917
- if (!n)
5918
- return { minX: 0, minY: 0, maxX: 0, maxY: 0 };
5945
+ if (!n) return [0, 0, 0, 0];
5919
5946
  const { width: s, height: r } = n, o = 1.5, a = t.view.screenToGraphCoordinates({ x: 0, y: 0 }), l = t.view.screenToGraphCoordinates({ x: s * o, y: 0 }), h = t.view.screenToGraphCoordinates({ x: 0, y: r * o }), c = t.view.screenToGraphCoordinates({
5920
5947
  x: s * o,
5921
5948
  y: r * o
@@ -5938,7 +5965,7 @@ class hr extends mn {
5938
5965
  }
5939
5966
  getDefs() {
5940
5967
  const t = M("defs");
5941
- t.appendChild(li());
5968
+ t.appendChild(hi());
5942
5969
  const n = M("filter");
5943
5970
  n.setAttribute("id", "softShadow"), n.setAttribute("x", "-50%"), n.setAttribute("y", "-50%"), n.setAttribute("width", "200%"), n.setAttribute("height", "200%");
5944
5971
  const s = M("feGaussianBlur");
@@ -5981,7 +6008,7 @@ class hr extends mn {
5981
6008
  this.features.clear(), this.layer.destroy(), this.ogma.events.off(this.onExportStart), this.ogma.events.off(this.onExportEnd), super.destroy();
5982
6009
  }
5983
6010
  }
5984
- const je = (i) => {
6011
+ const Ge = (i) => {
5985
6012
  let e;
5986
6013
  const t = /* @__PURE__ */ new Set(), n = (h, c) => {
5987
6014
  const d = typeof h == "function" ? h(e) : h;
@@ -5991,8 +6018,8 @@ const je = (i) => {
5991
6018
  }
5992
6019
  }, s = () => e, a = { setState: n, getState: s, getInitialState: () => l, subscribe: (h) => (t.add(h), () => t.delete(h)) }, l = e = i(n, s, a);
5993
6020
  return a;
5994
- }, Mn = (i) => i ? je(i) : je;
5995
- var Ge = (i, e, t) => (s, r) => ({
6021
+ }, Tn = (i) => i ? Ge(i) : Ge;
6022
+ var Ve = (i, e, t) => (s, r) => ({
5996
6023
  pastStates: (t == null ? void 0 : t.pastStates) || [],
5997
6024
  futureStates: (t == null ? void 0 : t.futureStates) || [],
5998
6025
  undo: (o = 1) => {
@@ -6035,18 +6062,18 @@ var Ge = (i, e, t) => (s, r) => ({
6035
6062
  futureStates: []
6036
6063
  });
6037
6064
  }
6038
- }), dr = (i, e) => (n, s, r) => {
6065
+ }), ur = (i, e) => (n, s, r) => {
6039
6066
  var h, c;
6040
- r.temporal = Mn(
6041
- ((h = e == null ? void 0 : e.wrapTemporal) == null ? void 0 : h.call(e, Ge(n, s, e))) || Ge(n, s, e)
6067
+ r.temporal = Tn(
6068
+ ((h = e == null ? void 0 : e.wrapTemporal) == null ? void 0 : h.call(e, Ve(n, s, e))) || Ve(n, s, e)
6042
6069
  );
6043
6070
  const o = ((c = e == null ? void 0 : e.handleSet) == null ? void 0 : c.call(
6044
6071
  e,
6045
6072
  r.temporal.getState()._handleSet
6046
6073
  )) || r.temporal.getState()._handleSet, a = (d) => {
6047
- var p, f, m;
6074
+ var f, p, m;
6048
6075
  if (!r.temporal.getState().isTracking) return;
6049
- const u = ((p = e == null ? void 0 : e.partialize) == null ? void 0 : p.call(e, s())) || s(), g = (f = e == null ? void 0 : e.diff) == null ? void 0 : f.call(e, d, u);
6076
+ const u = ((f = e == null ? void 0 : e.partialize) == null ? void 0 : f.call(e, s())) || s(), g = (p = e == null ? void 0 : e.diff) == null ? void 0 : p.call(e, d, u);
6050
6077
  // If the user has provided a diff function but nothing has been changed, deltaState will be null
6051
6078
  g === null || // If the user has provided an equality function, use it
6052
6079
  (m = e == null ? void 0 : e.equality) != null && m.call(e, d, u) || o(
@@ -6071,7 +6098,7 @@ var Ge = (i, e, t) => (s, r) => ({
6071
6098
  r
6072
6099
  );
6073
6100
  };
6074
- const ur = (i) => (e, t, n) => {
6101
+ const gr = (i) => (e, t, n) => {
6075
6102
  const s = n.subscribe;
6076
6103
  return n.subscribe = (o, a, l) => {
6077
6104
  let h = o;
@@ -6081,15 +6108,15 @@ const ur = (i) => (e, t, n) => {
6081
6108
  h = (u) => {
6082
6109
  const g = o(u);
6083
6110
  if (!c(d, g)) {
6084
- const p = d;
6085
- a(d = g, p);
6111
+ const f = d;
6112
+ a(d = g, f);
6086
6113
  }
6087
6114
  }, l != null && l.fireImmediately && a(d, d);
6088
6115
  }
6089
6116
  return s(h);
6090
6117
  }, i(e, t, n);
6091
- }, gr = ur, fr = [0, 0, 0, 0];
6092
- function pr(i, e) {
6118
+ }, fr = gr, pr = [0, 0, 0, 0];
6119
+ function mr(i, e) {
6093
6120
  const t = Object.keys(i.features), n = Object.keys(e.features);
6094
6121
  if (t.length !== n.length) return !1;
6095
6122
  for (const s of t)
@@ -6100,10 +6127,10 @@ function pr(i, e) {
6100
6127
  }
6101
6128
  return i.drawingFeature === e.drawingFeature;
6102
6129
  }
6103
- const mr = (i) => {
6104
- const e = Mn()(
6105
- gr(
6106
- dr(
6130
+ const yr = (i) => {
6131
+ const e = Tn()(
6132
+ fr(
6133
+ ur(
6107
6134
  (t, n) => ({
6108
6135
  features: {},
6109
6136
  liveUpdates: {},
@@ -6128,9 +6155,9 @@ const mr = (i) => {
6128
6155
  invZoom: 1,
6129
6156
  options: {
6130
6157
  showSendButton: (i == null ? void 0 : i.showSendButton) ?? !0,
6131
- sendButtonIcon: (i == null ? void 0 : i.sendButtonIcon) ?? Je,
6158
+ sendButtonIcon: (i == null ? void 0 : i.sendButtonIcon) ?? Qe,
6132
6159
  showEditButton: (i == null ? void 0 : i.showEditButton) ?? !0,
6133
- editButtonIcon: (i == null ? void 0 : i.editButtonIcon) ?? Qe,
6160
+ editButtonIcon: (i == null ? void 0 : i.editButtonIcon) ?? tn,
6134
6161
  minArrowHeight: (i == null ? void 0 : i.minArrowHeight) ?? 20,
6135
6162
  maxArrowHeight: (i == null ? void 0 : i.maxArrowHeight) ?? 30,
6136
6163
  detectMargin: (i == null ? void 0 : i.detectMargin) ?? 2,
@@ -6142,21 +6169,21 @@ const mr = (i) => {
6142
6169
  options: { ...r.options, ...s }
6143
6170
  })),
6144
6171
  removeFeature: (s) => t((r) => {
6145
- var u, g, p, f;
6172
+ var u, g, f, p;
6146
6173
  const o = r.features[s];
6147
6174
  if (!o) return r;
6148
6175
  const { features: a, liveUpdates: l } = r, h = /* @__PURE__ */ new Set([s]);
6149
- if ((D(o) || _(o)) && Object.values(a).forEach((m) => {
6150
- var x, b, v, S;
6151
- tt(m) && (((b = (x = m.properties.link) == null ? void 0 : x.end) == null ? void 0 : b.id) === s || ((S = (v = m.properties.link) == null ? void 0 : v.start) == null ? void 0 : S.id) === s) && h.add(m.id);
6176
+ if ((F(o) || _(o)) && Object.values(a).forEach((m) => {
6177
+ var w, b, v, S;
6178
+ tt(m) && (((b = (w = m.properties.link) == null ? void 0 : w.end) == null ? void 0 : b.id) === s || ((S = (v = m.properties.link) == null ? void 0 : v.start) == null ? void 0 : S.id) === s) && h.add(m.id);
6152
6179
  }), tt(o)) {
6153
- const m = ((g = (u = o.properties.link) == null ? void 0 : u.end) == null ? void 0 : g.type) === "comment" ? o.properties.link.end.id : ((f = (p = o.properties.link) == null ? void 0 : p.start) == null ? void 0 : f.type) === "comment" ? o.properties.link.start.id : null;
6180
+ const m = ((g = (u = o.properties.link) == null ? void 0 : u.end) == null ? void 0 : g.type) === "comment" ? o.properties.link.end.id : ((p = (f = o.properties.link) == null ? void 0 : f.start) == null ? void 0 : p.type) === "comment" ? o.properties.link.start.id : null;
6154
6181
  if (m) {
6155
- let x = 0;
6182
+ let w = 0;
6156
6183
  if (Object.values(r.features).forEach((b) => {
6157
- var v, S, w, A;
6158
- tt(b) && b.id !== s && (((S = (v = b.properties.link) == null ? void 0 : v.end) == null ? void 0 : S.id) === m || ((A = (w = b.properties.link) == null ? void 0 : w.start) == null ? void 0 : A.id) === m) && x++;
6159
- }), x === 0)
6184
+ var v, S, x, A;
6185
+ tt(b) && b.id !== s && (((S = (v = b.properties.link) == null ? void 0 : v.end) == null ? void 0 : S.id) === m || ((A = (x = b.properties.link) == null ? void 0 : x.start) == null ? void 0 : A.id) === m) && w++;
6186
+ }), w === 0)
6160
6187
  return console.error(
6161
6188
  "Cannot delete last arrow attached to comment. Delete the comment instead."
6162
6189
  ), r;
@@ -6313,7 +6340,7 @@ const mr = (i) => {
6313
6340
  return `matrix(${a}, ${o}, ${-o}, ${a}, ${-l}, ${-h})`;
6314
6341
  },
6315
6342
  getRotatedBBox(s, r, o, a) {
6316
- return os(
6343
+ return as(
6317
6344
  s,
6318
6345
  r,
6319
6346
  o - s,
@@ -6322,7 +6349,7 @@ const mr = (i) => {
6322
6349
  this.cos,
6323
6350
  s + (o - s) / 2,
6324
6351
  r + (a - r) / 2,
6325
- fr
6352
+ pr
6326
6353
  );
6327
6354
  },
6328
6355
  setDrawingPoints: (s) => t({ drawingPoints: s })
@@ -6336,7 +6363,7 @@ const mr = (i) => {
6336
6363
  // Only track features, not liveUpdates!
6337
6364
  lastChangedFeatures: t.lastChangedFeatures
6338
6365
  }),
6339
- equality: pr,
6366
+ equality: mr,
6340
6367
  handleSet: (t) => (n) => {
6341
6368
  n.drawingFeature === null && t(n);
6342
6369
  }
@@ -6345,19 +6372,19 @@ const mr = (i) => {
6345
6372
  )
6346
6373
  );
6347
6374
  return e;
6348
- }, yr = {
6375
+ }, wr = {
6349
6376
  detectMargin: 2,
6350
6377
  magnetHandleRadius: 5,
6351
6378
  magnetRadius: 10,
6352
6379
  textPlaceholder: "Type here",
6353
6380
  showSendButton: !0,
6354
- sendButtonIcon: Je,
6381
+ sendButtonIcon: Qe,
6355
6382
  showEditButton: !0,
6356
- editButtonIcon: Qe,
6383
+ editButtonIcon: tn,
6357
6384
  minArrowHeight: 20,
6358
6385
  maxArrowHeight: 30
6359
6386
  };
6360
- class Zr extends _n {
6387
+ class Kr extends In {
6361
6388
  constructor(t, n = {}) {
6362
6389
  super();
6363
6390
  y(this, "ogma");
@@ -6384,23 +6411,23 @@ class Zr extends _n {
6384
6411
  this.links.update();
6385
6412
  });
6386
6413
  this.ogma = t;
6387
- const s = { ...yr, ...n };
6388
- this.store = mr(s), this.index = new Js(this.store), this.snapping = new Os(this.ogma, {
6414
+ const s = { ...wr, ...n };
6415
+ this.store = yr(s), this.index = new Qs(this.store), this.snapping = new Us(this.ogma, {
6389
6416
  detectMargin: n.detectMargin === void 0 ? 10 : n.detectMargin,
6390
6417
  magnetRadius: n.magnetRadius === void 0 ? 10 : n.magnetRadius
6391
- }, this.index, this.store), this.links = new Fs(this.ogma, this.snapping, this.store, (r, o) => {
6392
- this.emit(Nn, { arrow: r, link: o });
6393
- }), this.interactions = new Us(
6418
+ }, this.index, this.store), this.links = new Ps(this.ogma, this.snapping, this.store, (r, o) => {
6419
+ this.emit(Yn, { arrow: r, link: o });
6420
+ }), this.interactions = new qs(
6394
6421
  this.ogma,
6395
6422
  this.store,
6396
6423
  this.index
6397
- ), this.editor = new ks(
6424
+ ), this.editor = new Ms(
6398
6425
  this.ogma,
6399
6426
  this.store,
6400
6427
  this.snapping,
6401
6428
  this.links,
6402
6429
  this.interactions
6403
- ), this.drawing = new gs(
6430
+ ), this.drawing = new fs(
6404
6431
  this.ogma,
6405
6432
  this.store,
6406
6433
  this.editor,
@@ -6408,10 +6435,10 @@ class Zr extends _n {
6408
6435
  this.links,
6409
6436
  this,
6410
6437
  this.index
6411
- ), this.selectionManager = new ps(this.store), this.historyManager = new fs(this.store, this.links), this.updateManager = new ms(this.store), this.commentManager = new hs(this.store), this.initializeRenderers(), this.setupEvents();
6438
+ ), this.selectionManager = new ms(this.store), this.historyManager = new ps(this.store, this.links), this.updateManager = new ys(this.store), this.commentManager = new ds(this.store), this.initializeRenderers(), this.setupEvents();
6412
6439
  }
6413
6440
  initializeRenderers() {
6414
- this.renderers.shapes = new hr(this.ogma, this.store), this.renderers.handles = new ti(this.ogma, this.store);
6441
+ this.renderers.shapes = new dr(this.ogma, this.store), this.renderers.handles = new ei(this.ogma, this.store);
6415
6442
  }
6416
6443
  setupEvents() {
6417
6444
  this.ogma.events.on("rotate", this.onRotate).on("zoom", this.onZoom).on("layoutEnd", this.onLayout), this.editor.addEventListener(
@@ -6423,11 +6450,11 @@ class Zr extends _n {
6423
6450
  ), this.editor.addEventListener(Bt, (t) => this.emit(Bt, {
6424
6451
  id: t.detail.id,
6425
6452
  position: t.detail.position
6426
- })), this.interactions.addEventListener(re, ((t) => this.emit(re, {
6453
+ })), this.interactions.addEventListener(oe, ((t) => this.emit(oe, {
6427
6454
  id: t.detail.id,
6428
6455
  position: t.detail.position
6429
6456
  }))), this.store.temporal.subscribe((t) => {
6430
- this.emit(Yn, {
6457
+ this.emit(On, {
6431
6458
  canUndo: t.pastStates.length > 0,
6432
6459
  canRedo: t.futureStates.length > 0
6433
6460
  });
@@ -6437,23 +6464,23 @@ class Zr extends _n {
6437
6464
  const s = Array.from(t).filter(
6438
6465
  (r) => !(n != null && n.has(r))
6439
6466
  );
6440
- if (s.length > 0 && this.emit(In, { ids: s }), n) {
6467
+ if (s.length > 0 && this.emit(zn, { ids: s }), n) {
6441
6468
  const r = Array.from(n).filter((o) => !t.has(o));
6442
- r.length > 0 && this.emit(zn, { ids: r });
6469
+ r.length > 0 && this.emit(Bn, { ids: r });
6443
6470
  }
6444
6471
  }
6445
6472
  ), this.store.subscribe(
6446
6473
  (t) => t.drawingFeature,
6447
6474
  (t, n) => {
6448
- t === null && n !== null && this.emit(Ve, { id: n });
6475
+ t === null && n !== null && this.emit(Ze, { id: n });
6449
6476
  }
6450
6477
  ), this.store.subscribe(
6451
6478
  (t) => t.features,
6452
6479
  (t, n) => {
6453
6480
  for (const s of Object.keys(t))
6454
- n[s] ? n[s] !== t[s] && this.emit($n, t[s]) : this.emit(oe, { id: s });
6481
+ n[s] ? n[s] !== t[s] && this.emit(Nn, t[s]) : this.emit(ae, { id: s });
6455
6482
  for (const s of Object.keys(n))
6456
- t[s] || this.emit(Bn, { id: s });
6483
+ t[s] || this.emit(Rn, { id: s });
6457
6484
  }
6458
6485
  );
6459
6486
  }
@@ -6542,7 +6569,7 @@ class Zr extends _n {
6542
6569
  */
6543
6570
  cancelDrawing() {
6544
6571
  var t;
6545
- return this.drawing.cancelPendingDrawing(), (t = this.editor.getActiveHandler()) == null || t.cancelDrawing(), this.emit(Rn), this;
6572
+ return this.drawing.cancelPendingDrawing(), (t = this.editor.getActiveHandler()) == null || t.cancelDrawing(), this.emit($n), this;
6546
6573
  }
6547
6574
  /**
6548
6575
  * Enable arrow drawing mode - the recommended way to add arrows.
@@ -6977,120 +7004,120 @@ class Zr extends _n {
6977
7004
  export {
6978
7005
  at as COMMENT_MODE_COLLAPSED,
6979
7006
  Rt as COMMENT_MODE_EXPANDED,
6980
- Zr as Control,
6981
- Ar as DATA_ATTR,
6982
- Qe as DEFAULT_EDIT_ICON,
6983
- Je as DEFAULT_SEND_ICON,
6984
- oe as EVT_ADD,
6985
- Rn as EVT_CANCEL_DRAWING,
6986
- re as EVT_CLICK,
6987
- Ve as EVT_COMPLETE_DRAWING,
7007
+ Kr as Control,
7008
+ Er as DATA_ATTR,
7009
+ tn as DEFAULT_EDIT_ICON,
7010
+ Qe as DEFAULT_SEND_ICON,
7011
+ ae as EVT_ADD,
7012
+ $n as EVT_CANCEL_DRAWING,
7013
+ oe as EVT_CLICK,
7014
+ Ze as EVT_COMPLETE_DRAWING,
6988
7015
  Ut as EVT_DRAG,
6989
7016
  Bt as EVT_DRAG_END,
6990
7017
  Ct as EVT_DRAG_START,
6991
- Yn as EVT_HISTORY,
6992
- vr as EVT_HOVER,
6993
- Nn as EVT_LINK,
6994
- Bn as EVT_REMOVE,
6995
- In as EVT_SELECT,
6996
- Sr as EVT_UNHOVER,
6997
- zn as EVT_UNSELECT,
6998
- $n as EVT_UPDATE,
6999
- Ke as HL_BRIGHTEN,
7000
- de as LAYERS,
7001
- br as NONE,
7018
+ On as EVT_HISTORY,
7019
+ Sr as EVT_HOVER,
7020
+ Yn as EVT_LINK,
7021
+ Rn as EVT_REMOVE,
7022
+ zn as EVT_SELECT,
7023
+ Ar as EVT_UNHOVER,
7024
+ Bn as EVT_UNSELECT,
7025
+ Nn as EVT_UPDATE,
7026
+ Je as HL_BRIGHTEN,
7027
+ ue as LAYERS,
7028
+ vr as NONE,
7002
7029
  it as SIDE_END,
7003
- O as SIDE_START,
7030
+ X as SIDE_START,
7004
7031
  T as TARGET_TYPES,
7005
7032
  $t as TEXT_LINE_HEIGHT,
7006
- on as adjustColorBrightness,
7007
- qr as asColor,
7008
- Wr as asHexColor,
7009
- jr as asRgbColor,
7010
- Gr as asRgbaColor,
7033
+ an as adjustColorBrightness,
7034
+ Wr as asColor,
7035
+ jr as asHexColor,
7036
+ Gr as asRgbColor,
7037
+ Vr as asRgbaColor,
7011
7038
  Ft as brighten,
7012
- rs as calculateCommentZoomThreshold,
7013
- Vr as canDetachArrowEnd,
7014
- ws as canDetachArrowStart,
7039
+ os as calculateCommentZoomThreshold,
7040
+ Zr as canDetachArrowEnd,
7041
+ xs as canDetachArrowStart,
7015
7042
  It as clientToContainerPosition,
7016
- Dr as colorToRgba,
7043
+ Lr as colorToRgba,
7017
7044
  Yt as createArrow,
7018
- be as createBox,
7019
- ln as createComment,
7020
- Or as createCommentWithArrow,
7021
- cs as createPolygon,
7045
+ ve as createBox,
7046
+ hn as createComment,
7047
+ Ur as createCommentWithArrow,
7048
+ ls as createPolygon,
7022
7049
  M as createSVGElement,
7023
- ve as createText,
7050
+ Se as createText,
7024
7051
  I as cursors,
7025
- Ir as darken,
7026
- Hr as debounce,
7027
- _r as debounceTail,
7028
- zr as defaultArrowOptions,
7052
+ zr as darken,
7053
+ _r as debounce,
7054
+ Ir as debounceTail,
7055
+ Br as defaultArrowOptions,
7029
7056
  yt as defaultArrowStyle,
7030
- Br as defaultBoxOptions,
7057
+ Rr as defaultBoxOptions,
7031
7058
  Mt as defaultBoxStyle,
7032
- jt as defaultCommentOptions,
7033
- J as defaultCommentStyle,
7034
- Ur as defaultPolygonProperties,
7059
+ Gt as defaultCommentOptions,
7060
+ V as defaultCommentStyle,
7061
+ qr as defaultPolygonProperties,
7035
7062
  lt as defaultPolygonStyle,
7036
- Rr as defaultTextOptions,
7037
- U as defaultTextStyle,
7038
- an as detectArrow,
7039
- ss as detectBox,
7040
- is as detectComment,
7041
- hn as detectPolygon,
7042
- cn as detectText,
7043
- Tr as getAnnotationsBounds,
7044
- sn as getArrowEnd,
7045
- ue as getArrowEndPoints,
7063
+ $r as defaultTextOptions,
7064
+ G as defaultTextStyle,
7065
+ cn as detectArrow,
7066
+ is as detectBox,
7067
+ rs as detectComment,
7068
+ dn as detectPolygon,
7069
+ ln as detectText,
7070
+ Fr as getAnnotationsBounds,
7071
+ rn as getArrowEnd,
7072
+ ge as getArrowEndPoints,
7046
7073
  Ht as getArrowSide,
7047
- nn as getArrowStart,
7048
- Pr as getAttachmentPointOnNode,
7074
+ sn as getArrowStart,
7075
+ Dr as getAttachmentPointOnNode,
7049
7076
  rt as getBbox,
7050
7077
  Q as getBoxCenter,
7051
7078
  St as getBoxPosition,
7052
7079
  q as getBoxSize,
7053
- we as getBrowserWindow,
7054
- Nr as getCommentPosition,
7055
- Yr as getCommentSize,
7080
+ xe as getBrowserWindow,
7081
+ Yr as getCommentPosition,
7082
+ Or as getCommentSize,
7056
7083
  Xr as getCommentZoomThreshold,
7057
7084
  _t as getCoordinates,
7058
- Mr as getHandleId,
7059
- ye as getPolygonBounds,
7060
- tn as getPolygonCenter,
7085
+ Tr as getHandleId,
7086
+ we as getPolygonBounds,
7087
+ en as getPolygonCenter,
7061
7088
  rt as getTextBbox,
7062
7089
  St as getTextPosition,
7063
7090
  q as getTextSize,
7064
- Ze as handleDetectionThreshold,
7091
+ Ke as handleDetectionThreshold,
7065
7092
  Xn as handleRadius,
7066
- ge as hexShortToLong,
7067
- Jn as hexToRgba,
7068
- Se as isAnnotationCollection,
7093
+ fe as hexShortToLong,
7094
+ Qn as hexToRgba,
7095
+ Ae as isAnnotationCollection,
7069
7096
  tt as isArrow,
7070
7097
  W as isBox,
7071
- ls as isColor,
7072
- D as isComment,
7073
- ys as isCommentArrow,
7074
- dn as isHexColor,
7075
- nt as isPolygon,
7076
- un as isRgbColor,
7077
- gn as isRgbaColor,
7098
+ hs as isColor,
7099
+ F as isComment,
7100
+ ws as isCommentArrow,
7101
+ un as isHexColor,
7102
+ st as isPolygon,
7103
+ gn as isRgbColor,
7104
+ fn as isRgbaColor,
7078
7105
  _ as isText,
7079
- ts as migrateBoxOrTextIfNeeded,
7080
- Lr as parseColor,
7081
- Qn as rgbToRgba,
7082
- Fr as scaleGeometry,
7083
- Cr as scalePolygon,
7084
- Vn as setArrowEnd,
7085
- Zn as setArrowEndPoint,
7086
- Gn as setArrowStart,
7087
- kr as setBbox,
7088
- kr as setTextBbox,
7089
- me as simplifyPolygon,
7090
- rn as throttle,
7091
- $r as toggleCommentMode,
7092
- Er as translatePolygon,
7106
+ es as migrateBoxOrTextIfNeeded,
7107
+ Hr as parseColor,
7108
+ ts as rgbToRgba,
7109
+ Pr as scaleGeometry,
7110
+ kr as scalePolygon,
7111
+ Zn as setArrowEnd,
7112
+ Kn as setArrowEndPoint,
7113
+ Vn as setArrowStart,
7114
+ Mr as setBbox,
7115
+ Mr as setTextBbox,
7116
+ ye as simplifyPolygon,
7117
+ on as throttle,
7118
+ Nr as toggleCommentMode,
7119
+ Cr as translatePolygon,
7093
7120
  kt as updateBbox,
7094
- en as updatePolygonBbox,
7121
+ nn as updatePolygonBbox,
7095
7122
  kt as updateTextBbox
7096
7123
  };