mind-elixir 5.5.0 → 5.6.0

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.
@@ -14,6 +14,7 @@ const Se = {
14
14
  "--root-border-color": "rgba(0, 0, 0, 0)",
15
15
  "--main-color": "#444446",
16
16
  "--main-bgcolor": "#ffffff",
17
+ "--main-bgcolor-transparent": "rgba(255, 255, 255, 0.8)",
17
18
  "--topic-padding": "3px",
18
19
  "--color": "#777777",
19
20
  "--bgcolor": "#f6f6f6",
@@ -40,6 +41,7 @@ const Se = {
40
41
  "--root-border-color": "rgba(255, 255, 255, 0.1)",
41
42
  "--main-color": "#ffffff",
42
43
  "--main-bgcolor": "#4c4f69",
44
+ "--main-bgcolor-transparent": "rgba(76, 79, 105, 0.8)",
43
45
  "--topic-padding": "3px",
44
46
  "--color": "#cccccc",
45
47
  "--bgcolor": "#252526",
@@ -65,16 +67,16 @@ const he = function(e, t) {
65
67
  return null;
66
68
  } else
67
69
  return null;
68
- }, X = (e, t) => {
70
+ }, K = (e, t) => {
69
71
  if (e.parent = t, e.children)
70
72
  for (let n = 0; n < e.children.length; n++)
71
- X(e.children[n], e);
73
+ K(e.children[n], e);
72
74
  }, Q = (e, t, n) => {
73
75
  if (e.expanded = t, e.children)
74
76
  if (n === void 0 || n > 0) {
75
77
  const o = n !== void 0 ? n - 1 : void 0;
76
- e.children.forEach((i) => {
77
- Q(i, t, o);
78
+ e.children.forEach((s) => {
79
+ Q(s, t, o);
78
80
  });
79
81
  } else
80
82
  e.children.forEach((o) => {
@@ -86,17 +88,13 @@ function ke(e) {
86
88
  for (let t = 0; t < e.children.length; t++)
87
89
  ke(e.children[t]);
88
90
  }
89
- function ue(e, t, n, o) {
90
- const i = o - t, s = e - n;
91
- let l = Math.atan(Math.abs(i) / Math.abs(s)) / 3.14 * 180;
92
- if (isNaN(l)) return;
93
- s < 0 && i > 0 && (l = 180 - l), s < 0 && i < 0 && (l = 180 + l), s > 0 && i < 0 && (l = 360 - l);
94
- const r = 12, c = 30, a = l + c, d = l - c;
91
+ function fe(e, t, n, o) {
92
+ const s = n - e, i = o - t, r = Math.atan2(i, s) * 180 / Math.PI, c = 12, a = 30, d = (r + 180 - a) * Math.PI / 180, h = (r + 180 + a) * Math.PI / 180;
95
93
  return {
96
- x1: n + Math.cos(Math.PI * a / 180) * r,
97
- y1: o - Math.sin(Math.PI * a / 180) * r,
98
- x2: n + Math.cos(Math.PI * d / 180) * r,
99
- y2: o - Math.sin(Math.PI * d / 180) * r
94
+ x1: n + Math.cos(d) * c,
95
+ y1: o + Math.sin(d) * c,
96
+ x2: n + Math.cos(h) * c,
97
+ y2: o + Math.sin(h) * c
100
98
  };
101
99
  }
102
100
  function q() {
@@ -117,7 +115,7 @@ function Te(e) {
117
115
  })
118
116
  );
119
117
  }
120
- const F = (e, t) => {
118
+ const H = (e, t) => {
121
119
  let n = 0, o = 0;
122
120
  for (; t && t !== e; )
123
121
  n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
@@ -126,31 +124,31 @@ const F = (e, t) => {
126
124
  for (const n in t)
127
125
  e.setAttribute(n, t[n]);
128
126
  }, de = (e) => e ? e.tagName === "ME-TPC" : !1, _e = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
129
- for (let i = 0; i < o.length; i++) {
130
- if (t === o[i]) continue;
131
- const { parent: s } = t.nodeObj;
132
- if (s === o[i].nodeObj)
127
+ for (let s = 0; s < o.length; s++) {
128
+ if (t === o[s]) continue;
129
+ const { parent: i } = t.nodeObj;
130
+ if (i === o[s].nodeObj)
133
131
  return !1;
134
132
  }
135
133
  return !0;
136
- }), tt = (e) => {
134
+ }), Le = (e) => {
137
135
  const t = /translate3d\(([^,]+),\s*([^,]+)/, n = e.match(t);
138
136
  return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
139
137
  }, nt = function(e) {
140
138
  for (let t = 0; t < e.length; t++) {
141
- const { dom: n, evt: o, func: i } = e[t];
142
- n.addEventListener(o, i);
139
+ const { dom: n, evt: o, func: s } = e[t];
140
+ n.addEventListener(o, s);
143
141
  }
144
142
  return function() {
145
143
  for (let n = 0; n < e.length; n++) {
146
- const { dom: o, evt: i, func: s } = e[n];
147
- o.removeEventListener(i, s);
144
+ const { dom: o, evt: s, func: i } = e[n];
145
+ o.removeEventListener(s, i);
148
146
  }
149
147
  };
150
- }, je = (e, t) => {
148
+ }, He = (e, t) => {
151
149
  const n = e.x - t.x, o = e.y - t.y;
152
150
  return Math.sqrt(n * n + o * o);
153
- }, I = {
151
+ }, B = {
154
152
  LHS: "lhs",
155
153
  RHS: "rhs"
156
154
  }, bt = (e) => {
@@ -161,36 +159,36 @@ const F = (e, t) => {
161
159
  e.selectNode(t[Math.ceil(t.length / 2) - 1]);
162
160
  }, xt = (e) => {
163
161
  e.selectNode(e.map.querySelector("me-root>me-tpc"));
164
- }, Et = function(e, t) {
162
+ }, Ct = function(e, t) {
165
163
  const n = t.parentElement.parentElement.parentElement.previousSibling;
166
164
  if (n) {
167
165
  const o = n.firstChild;
168
166
  e.selectNode(o);
169
167
  }
170
- }, Ct = function(e, t) {
168
+ }, Et = function(e, t) {
171
169
  const n = t.parentElement.nextSibling;
172
170
  if (n && n.firstChild) {
173
171
  const o = n.firstChild.firstChild.firstChild;
174
172
  e.selectNode(o);
175
173
  }
176
- }, He = function(e, t) {
174
+ }, Re = function(e, t) {
177
175
  const n = e.currentNode || e.currentNodes?.[0];
178
176
  if (!n) return;
179
- const o = n.nodeObj, i = n.offsetParent.offsetParent.parentElement;
180
- o.parent ? i.className === t ? Ct(e, n) : o.parent?.parent ? Et(e, n) : xt(e) : t === I.LHS ? bt(e) : wt(e);
181
- }, Ie = function(e, t) {
177
+ const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
178
+ o.parent ? s.className === t ? Et(e, n) : o.parent?.parent ? Ct(e, n) : xt(e) : t === B.LHS ? bt(e) : wt(e);
179
+ }, Be = function(e, t) {
182
180
  const n = e.currentNode;
183
181
  if (!n || !n.nodeObj.parent) return;
184
- const i = t + "Sibling", s = n.parentElement.parentElement[i];
185
- s ? e.selectNode(s.firstChild.firstChild) : e.selectNode(n);
182
+ const s = t + "Sibling", i = n.parentElement.parentElement[s];
183
+ i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
186
184
  }, J = function(e, t, n) {
187
- const { scaleVal: o, scaleSensitivity: i } = e;
185
+ const { scaleVal: o, scaleSensitivity: s } = e;
188
186
  switch (t) {
189
187
  case "in":
190
- e.scale(o + i, n);
188
+ e.scale(o + s, n);
191
189
  break;
192
190
  case "out":
193
- e.scale(o - i, n);
191
+ e.scale(o - s, n);
194
192
  }
195
193
  };
196
194
  function St(e, t) {
@@ -198,8 +196,8 @@ function St(e, t) {
198
196
  const n = () => {
199
197
  e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
200
198
  };
201
- let o = !1, i = null;
202
- const s = (r) => {
199
+ let o = !1, s = null;
200
+ const i = (r) => {
203
201
  const c = e.nodeData;
204
202
  if (r.key === "0")
205
203
  for (const a of c.children)
@@ -210,7 +208,7 @@ function St(e, t) {
210
208
  if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
211
209
  for (const a of c.children)
212
210
  Q(a, !0, Number(r.key) - 1);
213
- e.refresh(), e.toCenter(), o = !1, i && (clearTimeout(i), i = null, e.container.removeEventListener("keydown", s));
211
+ e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
214
212
  }, l = {
215
213
  Enter: (r) => {
216
214
  r.shiftKey ? e.insertSibling("before") : r.ctrlKey || r.metaKey ? e.insertParent() : e.insertSibling("after");
@@ -230,21 +228,21 @@ function St(e, t) {
230
228
  else {
231
229
  if (r.metaKey || r.ctrlKey)
232
230
  return e.initSide();
233
- Ie(e, "previous");
231
+ Be(e, "previous");
234
232
  }
235
233
  },
236
234
  ArrowDown: (r) => {
237
- r.altKey ? e.moveDownNode() : Ie(e, "next");
235
+ r.altKey ? e.moveDownNode() : Be(e, "next");
238
236
  },
239
237
  ArrowLeft: (r) => {
240
238
  if (r.metaKey || r.ctrlKey)
241
239
  return e.initLeft();
242
- He(e, I.LHS);
240
+ Re(e, B.LHS);
243
241
  },
244
242
  ArrowRight: (r) => {
245
243
  if (r.metaKey || r.ctrlKey)
246
244
  return e.initRight();
247
- He(e, I.RHS);
245
+ Re(e, B.RHS);
248
246
  },
249
247
  PageUp: () => e.moveUpNode(),
250
248
  PageDown: () => {
@@ -273,9 +271,9 @@ function St(e, t) {
273
271
  }
274
272
  },
275
273
  k: (r) => {
276
- (r.metaKey || r.ctrlKey) && (o = !0, i && (clearTimeout(i), e.container.removeEventListener("keydown", s)), i = window.setTimeout(() => {
277
- o = !1, i = null;
278
- }, 2e3), e.container.addEventListener("keydown", s));
274
+ (r.metaKey || r.ctrlKey) && (o = !0, s && (clearTimeout(s), e.container.removeEventListener("keydown", i)), s = window.setTimeout(() => {
275
+ o = !1, s = null;
276
+ }, 2e3), e.container.addEventListener("keydown", i));
279
277
  },
280
278
  Delete: n,
281
279
  Backspace: n,
@@ -298,7 +296,7 @@ const xe = document, Nt = function(e, t) {
298
296
  const t = e.querySelectorAll(".insert-preview");
299
297
  for (const n of t || [])
300
298
  n.remove();
301
- }, Be = function(e, t) {
299
+ }, Ie = function(e, t) {
302
300
  for (const n of t) {
303
301
  const o = n.parentElement.parentElement.contains(e);
304
302
  if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
@@ -338,45 +336,45 @@ function _t(e) {
338
336
  };
339
337
  }
340
338
  const Lt = 5;
341
- function Re(e, t, n, o = !1) {
339
+ function Fe(e, t, n, o = !1) {
342
340
  if (e.spacePressed) return !1;
343
- const i = n.target;
344
- if (i?.tagName !== "ME-TPC" || !i.nodeObj.parent) return !1;
341
+ const s = n.target;
342
+ if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
345
343
  t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.selection.cancel();
346
- let s = e.currentNodes;
347
- return s?.includes(i) || (e.selectNode(i), s = e.currentNodes), e.dragged = s, o && it(e, t), !0;
344
+ let i = e.currentNodes;
345
+ return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o && st(e, t), !0;
348
346
  }
349
347
  function ot(e, t, n) {
350
348
  e.style.transform = `translate(${t + 10}px, ${n + 10}px)`, e.style.display = "block";
351
349
  }
352
- function it(e, t) {
350
+ function st(e, t) {
353
351
  const { dragged: n } = e;
354
352
  if (!n) return;
355
353
  const o = document.activeElement;
356
354
  o && o.isContentEditable && o.blur(), t.isDragging = !0, n.length > 1 ? t.ghost.innerHTML = n.length + "" : t.ghost.innerHTML = n[0].innerHTML;
357
- for (const i of n)
358
- i.parentElement.parentElement.style.opacity = "0.5";
355
+ for (const s of n)
356
+ s.parentElement.parentElement.style.opacity = "0.5";
359
357
  e.dragMoveHelper.clear();
360
358
  }
361
359
  function At(e, t, n) {
362
360
  const { dragged: o } = e;
363
361
  if (!o || t.pointerId !== n.pointerId) return;
364
- const i = n.clientX - t.startX, s = n.clientY - t.startY, l = Math.sqrt(i * i + s * s);
365
- if (!t.isDragging && l > Lt && it(e, t), !t.isDragging) return;
362
+ const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i);
363
+ if (!t.isDragging && l > Lt && st(e, t), !t.isDragging) return;
366
364
  ot(t.ghost, n.clientX, n.clientY);
367
365
  const r = e.container.getBoundingClientRect();
368
366
  n.clientX < r.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > r.x + r.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < r.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > r.y + r.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(), ge(t.meet);
369
367
  const c = 12 * e.scaleVal, a = xe.elementFromPoint(n.clientX, n.clientY - c);
370
- if (Be(a, o)) {
368
+ if (Ie(a, o)) {
371
369
  t.meet = a;
372
370
  const d = a.getBoundingClientRect(), h = d.y;
373
371
  n.clientY > h + d.height ? t.insertType = "after" : t.insertType = "in";
374
372
  } else {
375
373
  const d = xe.elementFromPoint(n.clientX, n.clientY + c);
376
- if (Be(d, o)) {
374
+ if (Ie(d, o)) {
377
375
  t.meet = d;
378
- const f = d.getBoundingClientRect().y;
379
- n.clientY < f ? t.insertType = "before" : t.insertType = "in";
376
+ const u = d.getBoundingClientRect().y;
377
+ n.clientY < u ? t.insertType = "before" : t.insertType = "in";
380
378
  } else
381
379
  t.insertType = null, t.meet = null;
382
380
  }
@@ -386,8 +384,8 @@ function Mt(e, t, n) {
386
384
  const { dragged: o } = e;
387
385
  if (!(!o || t.pointerId !== n.pointerId)) {
388
386
  t.edgeMoveController.stop();
389
- for (const i of o)
390
- i.parentElement.parentElement.style.opacity = "1";
387
+ for (const s of o)
388
+ s.parentElement.parentElement.style.opacity = "1";
391
389
  t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (ge(t.meet), t.insertType === "before" ? e.moveNodeBefore(o, t.meet) : t.insertType === "after" ? e.moveNodeAfter(o, t.meet) : t.insertType === "in" && e.moveNodeIn(o, t.meet)), e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null;
392
390
  }
393
391
  }
@@ -409,36 +407,36 @@ function Pt(e) {
409
407
  let n = 0;
410
408
  e.spacePressed = !1;
411
409
  let o = null;
412
- const i = /* @__PURE__ */ new Map(), s = e.draggable ? _t(e) : null;
410
+ const s = /* @__PURE__ */ new Map(), i = e.draggable ? _t(e) : null;
413
411
  let l = null, r = null, c = null, a = null;
414
- const d = 500, h = 10, f = () => {
412
+ const d = 500, h = 10, u = () => {
415
413
  l !== null && (clearTimeout(l), l = null, r = null, c = null, a = null);
416
- }, y = (u, w) => {
417
- u.hasPointerCapture && u.hasPointerCapture(w) && u.releasePointerCapture(w);
418
- }, v = (u, w) => {
419
- const k = u.closest(".svg-label");
414
+ }, y = (f, w) => {
415
+ f.hasPointerCapture && f.hasPointerCapture(w) && f.releasePointerCapture(w);
416
+ }, v = (f, w) => {
417
+ const k = f.closest(".svg-label");
420
418
  if (k) {
421
- const M = k.dataset.svgId, se = k.dataset.type, ne = document.getElementById(M);
419
+ const M = k.dataset.svgId, ie = k.dataset.type, ne = document.getElementById(M);
422
420
  if (ne) {
423
- if (se === "arrow")
421
+ if (ie === "arrow")
424
422
  return w ? e.editArrowLabel(ne) : e.selectArrow(ne), !0;
425
- if (se === "summary")
423
+ if (ie === "summary")
426
424
  return w ? e.editSummary(ne) : e.selectSummary(ne), !0;
427
425
  }
428
426
  }
429
- if (u.closest(".topiclinks")) {
430
- const M = u.closest("g");
427
+ if (f.closest(".topiclinks")) {
428
+ const M = f.closest("g");
431
429
  if (M)
432
430
  return w ? e.editArrowLabel(M) : e.selectArrow(M), !0;
433
431
  }
434
- if (u.closest(".summary")) {
435
- const M = u.closest("g");
432
+ if (f.closest(".summary")) {
433
+ const M = f.closest("g");
436
434
  if (M)
437
435
  return w ? e.editSummary(M) : e.selectSummary(M), !0;
438
436
  }
439
437
  return !1;
440
- }, p = (u) => {
441
- if (u.button !== 0) return;
438
+ }, p = (f) => {
439
+ if (f.button !== 0) return;
442
440
  if (e.helper1?.moved) {
443
441
  e.helper1.clear();
444
442
  return;
@@ -451,115 +449,115 @@ function Pt(e) {
451
449
  t.clear();
452
450
  return;
453
451
  }
454
- if (s?.isDragging)
452
+ if (i?.isDragging)
455
453
  return;
456
- const w = u.target;
454
+ const w = f.target;
457
455
  if (w.tagName === "ME-EPD")
458
- u.ctrlKey || u.metaKey ? e.expandNodeAll(w.previousSibling) : e.expandNode(w.previousSibling);
456
+ f.ctrlKey || f.metaKey ? e.expandNodeAll(w.previousSibling) : e.expandNode(w.previousSibling);
459
457
  else if (w.tagName === "ME-TPC" && e.currentNodes.length > 1)
460
458
  e.selectNode(w);
461
459
  else if (!e.editable)
462
460
  return;
463
461
  v(w, !1);
464
- }, m = (u) => {
462
+ }, g = (f) => {
465
463
  if (!e.editable) return;
466
- const w = u.target;
464
+ const w = f.target;
467
465
  de(w) && e.beginEdit(w), v(w, !0);
468
- }, g = (u) => {
469
- if (u.pointerType === "mouse" || i.size > 1) return;
466
+ }, m = (f) => {
467
+ if (f.pointerType === "mouse" || s.size > 1) return;
470
468
  const w = (/* @__PURE__ */ new Date()).getTime(), k = w - n;
471
- k < 300 && k > 0 && m(u), n = w;
472
- }, b = (u) => {
473
- u.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"));
474
- }, x = (u) => {
475
- u.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
476
- }, L = (u) => {
477
- if (u.pointerType === "touch" && (i.set(u.pointerId, { x: u.clientX, y: u.clientY }), i.size === 2)) {
478
- const [M, se] = Array.from(i.values());
479
- o = je(M, se), f();
469
+ k < 300 && k > 0 && g(f), n = w;
470
+ }, b = (f) => {
471
+ f.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"));
472
+ }, x = (f) => {
473
+ f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
474
+ }, L = (f) => {
475
+ if (f.pointerType === "touch" && (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), s.size === 2)) {
476
+ const [M, ie] = Array.from(s.values());
477
+ o = He(M, ie), u();
480
478
  }
481
479
  t.moved = !1;
482
- const w = u.target, k = e.mouseSelectionButton === 0 ? 2 : 0;
483
- if (s && (u.button === 0 || u.pointerType === "touch")) {
484
- if (u.pointerType === "touch" && i.size > 1)
485
- (s.isDragging || s.pointerId !== null) && ve(e, s);
486
- else if (u.pointerType === "touch" && i.size === 1)
487
- (de(w) || w.closest("me-tpc")) && (r = { x: u.clientX, y: u.clientY }, c = w, a = u.pointerId, l = window.setTimeout(() => {
488
- Re(e, s, u, !0) && (c && c.setPointerCapture(u.pointerId), ot(s.ghost, u.clientX, u.clientY)), l = null, r = null, c = null, a = null;
480
+ const w = f.target, k = e.mouseSelectionButton === 0 ? 2 : 0;
481
+ if (i && (f.button === 0 || f.pointerType === "touch")) {
482
+ if (f.pointerType === "touch" && s.size > 1)
483
+ (i.isDragging || i.pointerId !== null) && ve(e, i);
484
+ else if (f.pointerType === "touch" && s.size === 1)
485
+ (de(w) || w.closest("me-tpc")) && (r = { x: f.clientX, y: f.clientY }, c = w, a = f.pointerId, l = window.setTimeout(() => {
486
+ Fe(e, i, f, !0) && (c && c.setPointerCapture(f.pointerId), ot(i.ghost, f.clientX, f.clientY)), l = null, r = null, c = null, a = null;
489
487
  }, d));
490
- else if (u.pointerType === "mouse" && Re(e, s, u, !1)) {
491
- w.setPointerCapture(u.pointerId);
488
+ else if (f.pointerType === "mouse" && Fe(e, i, f, !1)) {
489
+ w.setPointerCapture(f.pointerId);
492
490
  return;
493
491
  }
494
492
  }
495
- const O = e.spacePressed && u.button === 0 && u.pointerType === "mouse", Y = u.button === k && u.pointerType === "mouse" || u.pointerType === "touch";
496
- !O && !Y || (t.x = u.clientX, t.y = u.clientY, w.className !== "circle" && w.contentEditable !== "plaintext-only" && (t.mousedown = !0, w.setPointerCapture(u.pointerId)));
497
- }, _ = (u) => {
498
- if (u.pointerType === "touch" && i.has(u.pointerId)) {
499
- if (i.set(u.pointerId, { x: u.clientX, y: u.clientY }), l !== null && r !== null && u.pointerId === a) {
500
- const w = u.clientX - r.x, k = u.clientY - r.y;
501
- Math.sqrt(w * w + k * k) > h && f();
493
+ const $ = e.spacePressed && f.button === 0 && f.pointerType === "mouse", Y = f.button === k && f.pointerType === "mouse" || f.pointerType === "touch";
494
+ !$ && !Y || (t.x = f.clientX, t.y = f.clientY, w.className !== "circle" && w.contentEditable !== "plaintext-only" && (t.mousedown = !0, w.setPointerCapture(f.pointerId)));
495
+ }, T = (f) => {
496
+ if (f.pointerType === "touch" && s.has(f.pointerId)) {
497
+ if (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), l !== null && r !== null && f.pointerId === a) {
498
+ const w = f.clientX - r.x, k = f.clientY - r.y;
499
+ Math.sqrt(w * w + k * k) > h && u();
502
500
  }
503
- if (i.size >= 2) {
504
- const [w, k] = Array.from(i.values()), O = je(w, k);
501
+ if (s.size >= 2) {
502
+ const [w, k] = Array.from(s.values()), $ = He(w, k);
505
503
  if (o == null)
506
- o = O;
504
+ o = $;
507
505
  else {
508
- const Y = O - o;
506
+ const Y = $ - o;
509
507
  Math.abs(Y) > 8 && (Y > 0 ? J(e, "in", {
510
508
  x: (w.x + k.x) / 2,
511
509
  y: (w.y + k.y) / 2
512
510
  }) : J(e, "out", {
513
511
  x: (w.x + k.x) / 2,
514
512
  y: (w.y + k.y) / 2
515
- }), o = O);
513
+ }), o = $);
516
514
  }
517
515
  return;
518
516
  }
519
517
  }
520
- if (!(s && s.pointerId !== null && (At(e, s, u), s.isDragging))) {
521
- if (u.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
522
- const w = u.clientX - t.x, k = u.clientY - t.y;
518
+ if (!(i && i.pointerId !== null && (At(e, i, f), i.isDragging))) {
519
+ if (f.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
520
+ const w = f.clientX - t.x, k = f.clientY - t.y;
523
521
  t.onMove(w, k);
524
522
  }
525
- t.x = u.clientX, t.y = u.clientY;
523
+ t.x = f.clientX, t.y = f.clientY;
526
524
  }
527
- }, C = (u) => {
528
- if (u.pointerType === "touch" && (i.delete(u.pointerId), i.size < 2 && (o = null), f()), s && s.pointerId !== null) {
529
- const w = s.isDragging;
530
- if (Mt(e, s, u), y(u.target, u.pointerId), w)
525
+ }, E = (f) => {
526
+ if (f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) {
527
+ const w = i.isDragging;
528
+ if (Mt(e, i, f), y(f.target, f.pointerId), w)
531
529
  return;
532
530
  }
533
- t.mousedown && (y(u.target, u.pointerId), t.clear());
534
- }, E = () => {
535
- f(), t.mousedown && t.clear(), s && (s.isDragging || s.pointerId !== null) && ve(e, s);
536
- }, S = (u) => {
537
- u.pointerType === "touch" && (i.delete(u.pointerId), i.size < 2 && (o = null), f()), s && s.pointerId === u.pointerId && ve(e, s), C(u);
538
- }, N = (u) => {
539
- if (u.preventDefault(), u.button !== 2 || !e.editable) return;
540
- const w = u.target;
531
+ t.mousedown && (y(f.target, f.pointerId), t.clear());
532
+ }, C = () => {
533
+ u(), t.mousedown && t.clear(), i && (i.isDragging || i.pointerId !== null) && ve(e, i);
534
+ }, S = (f) => {
535
+ f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === f.pointerId && ve(e, i), E(f);
536
+ }, N = (f) => {
537
+ if (f.preventDefault(), f.button !== 2 || !e.editable) return;
538
+ const w = f.target;
541
539
  de(w) && !w.classList.contains("selected") && e.selectNode(w), setTimeout(() => {
542
- e.dragMoveHelper.moved || e.bus.fire("showContextMenu", u);
540
+ e.dragMoveHelper.moved || e.bus.fire("showContextMenu", f);
543
541
  }, 200);
544
- }, D = (u) => {
545
- u.stopPropagation(), u.preventDefault(), u.ctrlKey || u.metaKey ? u.deltaY < 0 ? J(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && J(e, "out", e.dragMoveHelper) : u.shiftKey ? e.move(-u.deltaY, 0) : e.move(-u.deltaX, -u.deltaY);
546
- }, { container: T } = e;
542
+ }, D = (f) => {
543
+ f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey ? f.deltaY < 0 ? J(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && J(e, "out", e.dragMoveHelper) : f.shiftKey ? e.move(-f.deltaY, 0) : e.move(-f.deltaX, -f.deltaY);
544
+ }, { container: _ } = e;
547
545
  return nt([
548
- { dom: T, evt: "pointerdown", func: L },
549
- { dom: T, evt: "pointermove", func: _ },
550
- { dom: T, evt: "pointerup", func: C },
551
- { dom: T, evt: "pointercancel", func: S },
552
- { dom: T, evt: "pointerdown", func: g },
553
- { dom: T, evt: "click", func: p },
554
- { dom: T, evt: "dblclick", func: m },
555
- { dom: T, evt: "contextmenu", func: N },
556
- { dom: T, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : D },
557
- { dom: T, evt: "blur", func: E },
558
- { dom: T, evt: "keydown", func: b },
559
- { dom: T, evt: "keyup", func: x }
546
+ { dom: _, evt: "pointerdown", func: L },
547
+ { dom: _, evt: "pointermove", func: T },
548
+ { dom: _, evt: "pointerup", func: E },
549
+ { dom: _, evt: "pointercancel", func: S },
550
+ { dom: _, evt: "pointerdown", func: m },
551
+ { dom: _, evt: "click", func: p },
552
+ { dom: _, evt: "dblclick", func: g },
553
+ { dom: _, evt: "contextmenu", func: N },
554
+ { dom: _, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : D },
555
+ { dom: _, evt: "blur", func: C },
556
+ { dom: _, evt: "keydown", func: b },
557
+ { dom: _, evt: "keyup", func: x }
560
558
  ]);
561
559
  }
562
- function $t() {
560
+ function Ot() {
563
561
  return {
564
562
  handlers: {},
565
563
  addListener: function(e, t) {
@@ -583,42 +581,42 @@ function $t() {
583
581
  }
584
582
  };
585
583
  }
586
- const fe = document, Ot = function() {
584
+ const ue = document, $t = function() {
587
585
  this.nodes.innerHTML = "";
588
586
  const e = this.createTopic(this.nodeData);
589
- Le.call(this, e, this.nodeData), e.draggable = !1;
590
- const t = fe.createElement("me-root");
587
+ Ae.call(this, e, this.nodeData), e.draggable = !1;
588
+ const t = ue.createElement("me-root");
591
589
  t.appendChild(e);
592
590
  const n = this.nodeData.children || [];
593
591
  if (this.direction === 2) {
594
- let o = 0, i = 0;
595
- n.map((s) => {
596
- s.direction === 0 ? o += 1 : s.direction === 1 ? i += 1 : o <= i ? (s.direction = 0, o += 1) : (s.direction = 1, i += 1);
592
+ let o = 0, s = 0;
593
+ n.map((i) => {
594
+ i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
597
595
  });
598
596
  }
599
597
  jt(this, n, t);
600
598
  }, jt = function(e, t, n) {
601
- const o = fe.createElement("me-main");
602
- o.className = I.LHS;
603
- const i = fe.createElement("me-main");
604
- i.className = I.RHS;
605
- for (let s = 0; s < t.length; s++) {
606
- const l = t[s], { grp: r } = e.createWrapper(l);
607
- e.direction === 2 ? l.direction === 0 ? o.appendChild(r) : i.appendChild(r) : e.direction === 0 ? o.appendChild(r) : i.appendChild(r);
608
- }
609
- e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(i), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
599
+ const o = ue.createElement("me-main");
600
+ o.className = B.LHS;
601
+ const s = ue.createElement("me-main");
602
+ s.className = B.RHS;
603
+ for (let i = 0; i < t.length; i++) {
604
+ const l = t[i], { grp: r } = e.createWrapper(l);
605
+ e.direction === 2 ? l.direction === 0 ? o.appendChild(r) : s.appendChild(r) : e.direction === 0 ? o.appendChild(r) : s.appendChild(r);
606
+ }
607
+ e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
610
608
  }, Ht = function(e, t) {
611
- const n = fe.createElement("me-children");
609
+ const n = ue.createElement("me-children");
612
610
  for (let o = 0; o < t.length; o++) {
613
- const i = t[o], { grp: s } = e.createWrapper(i);
614
- n.appendChild(s);
611
+ const s = t[o], { grp: i } = e.createWrapper(s);
612
+ n.appendChild(i);
615
613
  }
616
614
  return n;
617
- }, P = document, st = function(e, t) {
615
+ }, P = document, it = function(e, t) {
618
616
  const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
619
617
  if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
620
618
  return o;
621
- }, Le = function(e, t) {
619
+ }, Ae = function(e, t) {
622
620
  if (e.innerHTML = "", t.style) {
623
621
  const n = t.style;
624
622
  for (const o in n)
@@ -650,24 +648,24 @@ const fe = document, Ot = function() {
650
648
  if (t.tags && t.tags.length) {
651
649
  const n = P.createElement("div");
652
650
  n.className = "tags", t.tags.forEach((o) => {
653
- const i = P.createElement("span");
654
- typeof o == "string" ? i.textContent = o : (i.textContent = o.text, o.className && (i.className = o.className), o.style && Object.assign(i.style, o.style)), n.appendChild(i);
651
+ const s = P.createElement("span");
652
+ typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
655
653
  }), e.appendChild(n), e.tags = n;
656
654
  } else e.tags && (e.tags = void 0);
657
- }, It = function(e, t) {
658
- const n = P.createElement("me-wrapper"), { p: o, tpc: i } = this.createParent(e);
655
+ }, Rt = function(e, t) {
656
+ const n = P.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
659
657
  if (n.appendChild(o), !t && e.children && e.children.length > 0) {
660
- const s = Ae(e.expanded);
661
- if (o.appendChild(s), e.expanded !== !1) {
658
+ const i = Me(e.expanded);
659
+ if (o.appendChild(i), e.expanded !== !1) {
662
660
  const l = Ht(this, e.children);
663
661
  n.appendChild(l);
664
662
  }
665
663
  }
666
- return { grp: n, top: o, tpc: i };
664
+ return { grp: n, top: o, tpc: s };
667
665
  }, Bt = function(e) {
668
666
  const t = P.createElement("me-parent"), n = this.createTopic(e);
669
- return Le.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
670
- }, Rt = function(e) {
667
+ return Ae.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
668
+ }, It = function(e) {
671
669
  const t = P.createElement("me-children");
672
670
  return t.append(...e), t;
673
671
  }, Ft = function(e) {
@@ -682,12 +680,12 @@ function rt(e) {
682
680
  }
683
681
  const Yt = function(e) {
684
682
  if (!e) return;
685
- const t = P.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: i, offsetTop: s } = F(this.nodes, e);
683
+ const t = P.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = H(this.nodes, e);
686
684
  this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
687
685
  const l = getComputedStyle(e);
688
686
  t.style.cssText = `
689
- left: ${i}px;
690
- top: ${s}px;
687
+ left: ${s}px;
688
+ top: ${i}px;
691
689
  min-width:${e.offsetWidth - 8}px;
692
690
  color:${l.color};
693
691
  font-size:${l.fontSize};
@@ -715,20 +713,20 @@ const Yt = function(e) {
715
713
  origin: o
716
714
  }));
717
715
  });
718
- }, Ae = function(e) {
716
+ }, Me = function(e) {
719
717
  const t = P.createElement("me-epd");
720
718
  return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
721
- }, ee = document, H = "http://www.w3.org/2000/svg", me = function(e) {
722
- const t = e.clientWidth, n = e.clientHeight, o = e.dataset, i = Number(o.x), s = Number(o.y), l = o.anchor;
723
- let r = i;
724
- l === "middle" ? r = i - t / 2 : l === "end" && (r = i - t), e.style.left = `${r}px`, e.style.top = `${s - n / 2}px`, e.style.visibility = "visible";
725
- }, Ee = function(e, t, n, o) {
726
- const { anchor: i = "middle", color: s, dataType: l, svgId: r } = o, c = document.createElement("div");
727
- c.className = "svg-label", c.style.color = s || "#666";
719
+ }, ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
720
+ const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
721
+ let r = s;
722
+ l === "middle" ? r = s - t / 2 : l === "end" && (r = s - t), e.style.left = `${r}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
723
+ }, Ce = function(e, t, n, o) {
724
+ const { anchor: s = "middle", color: i, dataType: l, svgId: r } = o, c = document.createElement("div");
725
+ c.className = "svg-label", c.style.color = i || "#666";
728
726
  const a = "label-" + r;
729
- return c.id = a, c.innerHTML = e, c.dataset.type = l, c.dataset.svgId = r, c.dataset.x = t.toString(), c.dataset.y = n.toString(), c.dataset.anchor = i, c;
727
+ return c.id = a, c.innerHTML = e, c.dataset.type = l, c.dataset.svgId = r, c.dataset.x = t.toString(), c.dataset.y = n.toString(), c.dataset.anchor = s, c;
730
728
  }, lt = function(e, t, n) {
731
- const o = ee.createElementNS(H, "path");
729
+ const o = ee.createElementNS(R, "path");
732
730
  return A(o, {
733
731
  d: e,
734
732
  stroke: t || "#666",
@@ -736,13 +734,13 @@ const Yt = function(e) {
736
734
  "stroke-width": n
737
735
  }), o;
738
736
  }, oe = function(e) {
739
- const t = ee.createElementNS(H, "svg");
737
+ const t = ee.createElementNS(R, "svg");
740
738
  return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
741
- }, Fe = function() {
742
- const e = ee.createElementNS(H, "line");
739
+ }, Ye = function() {
740
+ const e = ee.createElementNS(R, "line");
743
741
  return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
744
742
  }, Wt = function(e, t, n, o) {
745
- const i = ee.createElementNS(H, "g");
743
+ const s = ee.createElementNS(R, "g");
746
744
  return [
747
745
  {
748
746
  name: "line",
@@ -757,7 +755,7 @@ const Yt = function(e) {
757
755
  d: n
758
756
  }
759
757
  ].forEach((l, r) => {
760
- const c = l.d, a = ee.createElementNS(H, "path"), d = {
758
+ const c = l.d, a = ee.createElementNS(R, "path"), d = {
761
759
  d: c,
762
760
  stroke: o?.stroke || "rgb(227, 125, 116)",
763
761
  fill: "none",
@@ -765,32 +763,32 @@ const Yt = function(e) {
765
763
  "stroke-width": String(o?.strokeWidth || "2")
766
764
  };
767
765
  o?.opacity !== void 0 && (d.opacity = String(o.opacity)), A(a, d), r === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
768
- const h = ee.createElementNS(H, "path");
766
+ const h = ee.createElementNS(R, "path");
769
767
  A(h, {
770
768
  d: c,
771
769
  stroke: "transparent",
772
770
  fill: "none",
773
771
  "stroke-width": "15"
774
- }), i.appendChild(h), i.appendChild(a), i[l.name] = a;
775
- }), i;
772
+ }), s.appendChild(h), s.appendChild(a), s[l.name] = a;
773
+ }), s;
776
774
  }, ct = function(e, t, n) {
777
775
  if (!t) return;
778
- const o = n.label, i = t.cloneNode(!0);
779
- e.nodes.appendChild(i), i.id = "input-box", i.textContent = o, i.contentEditable = "plaintext-only", i.spellcheck = !1, i.style.cssText = `
776
+ const o = n.label, s = t.cloneNode(!0);
777
+ e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
780
778
  left:${t.style.left};
781
779
  top:${t.style.top};
782
780
  max-width: 200px;
783
- `, rt(i), e.scrollIntoView(i), i.addEventListener("keydown", (s) => {
784
- s.stopPropagation();
785
- const l = s.key;
781
+ `, rt(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
782
+ i.stopPropagation();
783
+ const l = i.key;
786
784
  if (l === "Enter" || l === "Tab") {
787
- if (s.shiftKey) return;
788
- s.preventDefault(), i.blur(), e.container.focus();
785
+ if (i.shiftKey) return;
786
+ i.preventDefault(), s.blur(), e.container.focus();
789
787
  }
790
- }), i.addEventListener("blur", () => {
791
- if (!i) return;
792
- const s = i.textContent?.trim() || "";
793
- s === "" ? n.label = o : n.label = s, i.remove(), s !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label, me(t), "parent" in n ? e.bus.fire("operation", {
788
+ }), s.addEventListener("blur", () => {
789
+ if (!s) return;
790
+ const i = s.textContent?.trim() || "";
791
+ i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label, me(t), "parent" in n ? e.bus.fire("operation", {
794
792
  name: "finishEditSummary",
795
793
  obj: n
796
794
  }) : e.bus.fire("operation", {
@@ -798,32 +796,32 @@ const Yt = function(e) {
798
796
  obj: n
799
797
  }));
800
798
  });
801
- }, zt = function(e) {
802
- const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, i = t.offsetWidth, s = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
799
+ }, Xt = function(e) {
800
+ const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
803
801
  this.lines.innerHTML = "";
804
802
  for (let r = 0; r < l.length; r++) {
805
- const c = l[r], a = c.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = F(this.nodes, a), f = a.offsetWidth, y = a.offsetHeight, v = c.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: i, pH: s, cT: h, cL: d, cW: f, cH: y, direction: v, containerHeight: this.nodes.offsetHeight }), m = this.theme.palette, g = a.nodeObj.branchColor || m[r % m.length];
806
- if (a.style.borderColor = g, this.lines.appendChild(lt(p, g, "3")), e && e !== c)
803
+ const c = l[r], a = c.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = H(this.nodes, a), u = a.offsetWidth, y = a.offsetHeight, v = c.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: y, direction: v, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[r % g.length];
804
+ if (a.style.borderColor = m, this.lines.appendChild(lt(p, m, "3")), e && e !== c)
807
805
  continue;
808
806
  const b = oe("subLines"), x = c.lastChild;
809
- x.tagName === "svg" && x.remove(), c.appendChild(b), at(this, b, g, c, v, !0);
807
+ x.tagName === "svg" && x.remove(), c.appendChild(b), at(this, b, m, c, v, !0);
810
808
  }
811
809
  this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
812
- }, at = function(e, t, n, o, i, s) {
810
+ }, at = function(e, t, n, o, s, i) {
813
811
  const l = o.firstChild, r = o.children[1].children;
814
812
  if (r.length === 0) return;
815
813
  const c = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
816
- for (let f = 0; f < r.length; f++) {
817
- const y = r[f], v = y.firstChild, p = v.offsetTop, m = v.offsetLeft, g = v.offsetWidth, b = v.offsetHeight, x = v.firstChild.nodeObj.branchColor || n, L = e.generateSubBranch({ pT: c, pL: a, pW: d, pH: h, cT: p, cL: m, cW: g, cH: b, direction: i, isFirst: s });
814
+ for (let u = 0; u < r.length; u++) {
815
+ const y = r[u], v = y.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, b = v.offsetHeight, x = v.firstChild.nodeObj.branchColor || n, L = e.generateSubBranch({ pT: c, pL: a, pW: d, pH: h, cT: p, cL: g, cW: m, cH: b, direction: s, isFirst: i });
818
816
  t.appendChild(lt(L, x, "2"));
819
- const _ = v.children[1];
820
- if (_) {
821
- if (!_.expanded) continue;
817
+ const T = v.children[1];
818
+ if (T) {
819
+ if (!T.expanded) continue;
822
820
  } else
823
821
  continue;
824
- at(e, t, x, y, i);
822
+ at(e, t, x, y, s);
825
823
  }
826
- }, Ye = {
824
+ }, We = {
827
825
  addChild: "插入子节点",
828
826
  addParent: "插入父节点",
829
827
  addSibling: "插入同级节点",
@@ -836,9 +834,9 @@ const Yt = function(e) {
836
834
  linkBidirectional: "双向连接",
837
835
  clickTips: "请点击目标节点",
838
836
  summary: "摘要"
839
- }, We = {
840
- cn: Ye,
841
- zh_CN: Ye,
837
+ }, Xe = {
838
+ cn: We,
839
+ zh_CN: We,
842
840
  zh_TW: {
843
841
  addChild: "插入子節點",
844
842
  addParent: "插入父節點",
@@ -980,38 +978,38 @@ const Yt = function(e) {
980
978
  summary: "Rezumat"
981
979
  }
982
980
  };
983
- function Gt(e, t) {
981
+ function zt(e, t) {
984
982
  t = t === !0 ? {
985
983
  focus: !0,
986
984
  link: !0
987
985
  } : t;
988
- const n = (C) => {
989
- const E = document.createElement("div");
990
- return E.innerText = C, E.className = "tips", E;
991
- }, o = (C, E, S) => {
986
+ const n = (E) => {
987
+ const C = document.createElement("div");
988
+ return C.innerText = E, C.className = "tips", C;
989
+ }, o = (E, C, S) => {
992
990
  const N = document.createElement("li");
993
- return N.id = C, N.innerHTML = `<span>${we(E)}</span><span ${S ? 'class="key"' : ""}>${we(S)}</span>`, N;
994
- }, i = We[e.locale] ? e.locale : "en", s = We[i], l = o("cm-add_child", s.addChild, "Tab"), r = o("cm-add_parent", s.addParent, "Ctrl + Enter"), c = o("cm-add_sibling", s.addSibling, "Enter"), a = o("cm-remove_child", s.removeNode, "Delete"), d = o("cm-fucus", s.focus, ""), h = o("cm-unfucus", s.cancelFocus, ""), f = o("cm-up", s.moveUp, "PgUp"), y = o("cm-down", s.moveDown, "Pgdn"), v = o("cm-link", s.link, ""), p = o("cm-link-bidirectional", s.linkBidirectional, ""), m = o("cm-summary", s.summary, ""), g = document.createElement("ul");
995
- if (g.className = "menu-list", g.appendChild(l), g.appendChild(r), g.appendChild(c), g.appendChild(a), t.focus && (g.appendChild(d), g.appendChild(h)), g.appendChild(f), g.appendChild(y), g.appendChild(m), t.link && (g.appendChild(v), g.appendChild(p)), t && t.extend)
996
- for (let C = 0; C < t.extend.length; C++) {
997
- const E = t.extend[C], S = o(E.name, E.name, E.key || "");
998
- g.appendChild(S), S.onclick = (N) => {
999
- E.onclick(N);
991
+ return N.id = E, N.innerHTML = `<span>${we(C)}</span><span ${S ? 'class="key"' : ""}>${we(S)}</span>`, N;
992
+ }, s = Xe[e.locale] ? e.locale : "en", i = Xe[s], l = o("cm-add_child", i.addChild, "Tab"), r = o("cm-add_parent", i.addParent, "Ctrl + Enter"), c = o("cm-add_sibling", i.addSibling, "Enter"), a = o("cm-remove_child", i.removeNode, "Delete"), d = o("cm-fucus", i.focus, ""), h = o("cm-unfucus", i.cancelFocus, ""), u = o("cm-up", i.moveUp, "PgUp"), y = o("cm-down", i.moveDown, "Pgdn"), v = o("cm-link", i.link, ""), p = o("cm-link-bidirectional", i.linkBidirectional, ""), g = o("cm-summary", i.summary, ""), m = document.createElement("ul");
993
+ if (m.className = "menu-list", m.appendChild(l), m.appendChild(r), m.appendChild(c), m.appendChild(a), t.focus && (m.appendChild(d), m.appendChild(h)), m.appendChild(u), m.appendChild(y), m.appendChild(g), t.link && (m.appendChild(v), m.appendChild(p)), t && t.extend)
994
+ for (let E = 0; E < t.extend.length; E++) {
995
+ const C = t.extend[E], S = o(C.name, C.name, C.key || "");
996
+ m.appendChild(S), S.onclick = (N) => {
997
+ C.onclick(N);
1000
998
  };
1001
999
  }
1002
1000
  const b = document.createElement("div");
1003
- b.className = "context-menu", b.appendChild(g), b.hidden = !0, e.container.append(b);
1001
+ b.className = "context-menu", b.appendChild(m), b.hidden = !0, e.container.append(b);
1004
1002
  let x = !0;
1005
- const L = (C) => {
1006
- const E = C.target;
1007
- if (de(E)) {
1008
- E.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (d.className = "disabled", f.className = "disabled", y.className = "disabled", r.className = "disabled", c.className = "disabled", a.className = "disabled") : (d.className = "", f.className = "", y.className = "", r.className = "", c.className = "", a.className = ""), b.hidden = !1, g.style.top = "", g.style.bottom = "", g.style.left = "", g.style.right = "";
1009
- const S = g.getBoundingClientRect(), N = g.offsetHeight, D = g.offsetWidth, T = C.clientY - S.top, R = C.clientX - S.left;
1010
- N + T > window.innerHeight ? (g.style.top = "", g.style.bottom = "0px") : (g.style.bottom = "", g.style.top = T + 15 + "px"), D + R > window.innerWidth ? (g.style.left = "", g.style.right = "0px") : (g.style.right = "", g.style.left = R + 10 + "px");
1003
+ const L = (E) => {
1004
+ const C = E.target;
1005
+ if (de(C)) {
1006
+ C.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (d.className = "disabled", u.className = "disabled", y.className = "disabled", r.className = "disabled", c.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", y.className = "", r.className = "", c.className = "", a.className = ""), b.hidden = !1, m.style.top = "", m.style.bottom = "", m.style.left = "", m.style.right = "";
1007
+ const S = m.getBoundingClientRect(), N = m.offsetHeight, D = m.offsetWidth, _ = E.clientY - S.top, F = E.clientX - S.left;
1008
+ N + _ > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = _ + 15 + "px"), D + F > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = F + 10 + "px");
1011
1009
  }
1012
1010
  };
1013
- e.bus.addListener("showContextMenu", L), b.onclick = (C) => {
1014
- C.target === b && (b.hidden = !0);
1011
+ e.bus.addListener("showContextMenu", L), b.onclick = (E) => {
1012
+ E.target === b && (b.hidden = !0);
1015
1013
  }, l.onclick = () => {
1016
1014
  e.addChild(), b.hidden = !0;
1017
1015
  }, r.onclick = () => {
@@ -1024,33 +1022,33 @@ function Gt(e, t) {
1024
1022
  x || (e.focusNode(e.currentNode), b.hidden = !0);
1025
1023
  }, h.onclick = () => {
1026
1024
  e.cancelFocus(), b.hidden = !0;
1027
- }, f.onclick = () => {
1025
+ }, u.onclick = () => {
1028
1026
  x || (e.moveUpNode(), b.hidden = !0);
1029
1027
  }, y.onclick = () => {
1030
1028
  x || (e.moveDownNode(), b.hidden = !0);
1031
1029
  };
1032
- const _ = (C) => {
1030
+ const T = (E) => {
1033
1031
  b.hidden = !0;
1034
- const E = e.currentNode, S = n(s.clickTips);
1032
+ const C = e.currentNode, S = n(i.clickTips);
1035
1033
  e.container.appendChild(S), e.map.addEventListener(
1036
1034
  "click",
1037
1035
  (N) => {
1038
1036
  N.preventDefault(), S.remove();
1039
1037
  const D = N.target;
1040
- (D.parentElement.tagName === "ME-PARENT" || D.parentElement.tagName === "ME-ROOT") && e.createArrow(E, D, C);
1038
+ (D.parentElement.tagName === "ME-PARENT" || D.parentElement.tagName === "ME-ROOT") && e.createArrow(C, D, E);
1041
1039
  },
1042
1040
  {
1043
1041
  once: !0
1044
1042
  }
1045
1043
  );
1046
1044
  };
1047
- return v.onclick = () => _(), p.onclick = () => _({ bidirectional: !0 }), m.onclick = () => {
1045
+ return v.onclick = () => T(), p.onclick = () => T({ bidirectional: !0 }), g.onclick = () => {
1048
1046
  b.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
1049
1047
  }, () => {
1050
- l.onclick = null, r.onclick = null, c.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, f.onclick = null, y.onclick = null, v.onclick = null, m.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
1048
+ l.onclick = null, r.onclick = null, c.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, y.onclick = null, v.onclick = null, g.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
1051
1049
  };
1052
1050
  }
1053
- const Kt = function(e) {
1051
+ const Gt = function(e) {
1054
1052
  return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
1055
1053
  type: "summary",
1056
1054
  value: e.obj.id
@@ -1065,8 +1063,8 @@ const Kt = function(e) {
1065
1063
  value: [e.obj.id]
1066
1064
  };
1067
1065
  };
1068
- function Xt(e) {
1069
- let t = [], n = -1, o = e.getData(), i = [];
1066
+ function Kt(e) {
1067
+ let t = [], n = -1, o = e.getData(), s = [];
1070
1068
  e.undo = function() {
1071
1069
  if (n > -1) {
1072
1070
  const c = t[n];
@@ -1089,24 +1087,24 @@ function Xt(e) {
1089
1087
  }
1090
1088
  }
1091
1089
  };
1092
- const s = function(c) {
1090
+ const i = function(c) {
1093
1091
  if (c.name === "beginEdit") return;
1094
1092
  t = t.slice(0, n + 1);
1095
1093
  const a = e.getData(), d = {
1096
1094
  prev: o,
1097
1095
  operation: c.name,
1098
- currentSelected: i.map((h) => h.id),
1099
- currentTarget: Kt(c),
1096
+ currentSelected: s.map((h) => h.id),
1097
+ currentTarget: Gt(c),
1100
1098
  next: a
1101
1099
  };
1102
1100
  t.push(d), o = a, n = t.length - 1;
1103
1101
  }, l = function(c) {
1104
1102
  (c.metaKey || c.ctrlKey) && (c.shiftKey && c.key === "Z" || c.key === "y") ? e.redo() : (c.metaKey || c.ctrlKey) && c.key === "z" && e.undo();
1105
1103
  }, r = function() {
1106
- i = e.currentNodes.map((c) => c.nodeObj);
1104
+ s = e.currentNodes.map((c) => c.nodeObj);
1107
1105
  };
1108
- return e.bus.addListener("operation", s), e.bus.addListener("selectNodes", r), e.container.addEventListener("keydown", l), () => {
1109
- e.bus.removeListener("operation", s), e.bus.removeListener("selectNodes", r), e.container.removeEventListener("keydown", l);
1106
+ return e.bus.addListener("operation", i), e.bus.addListener("selectNodes", r), e.container.addEventListener("keydown", l), () => {
1107
+ e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", r), e.container.removeEventListener("keydown", l);
1110
1108
  };
1111
1109
  }
1112
1110
  const qt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>', Vt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>', Ut = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>', Jt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>', Zt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>', Qt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>', en = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>', tn = {
@@ -1117,29 +1115,45 @@ const qt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
1117
1115
  living: Zt,
1118
1116
  zoomin: Qt,
1119
1117
  zoomout: en
1120
- }, K = (e, t) => {
1118
+ }, G = (e, t) => {
1121
1119
  const n = document.createElement("span");
1122
1120
  return n.id = e, n.innerHTML = tn[t], n;
1123
1121
  };
1124
1122
  function nn(e) {
1125
- const t = document.createElement("div"), n = K("fullscreen", "full"), o = K("toCenter", "living"), i = K("zoomout", "zoomout"), s = K("zoomin", "zoomin"), l = document.createElement("span");
1126
- return l.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(i), t.appendChild(s), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
1127
- document.fullscreenElement === e.el ? document.exitFullscreen() : e.el.requestFullscreen();
1123
+ const t = document.createElement("div"), n = G("fullscreen", "full"), o = G("toCenter", "living"), s = G("zoomout", "zoomout"), i = G("zoomin", "zoomin");
1124
+ t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
1125
+ let l = null;
1126
+ const r = () => {
1127
+ const a = e.container.getBoundingClientRect(), d = Le(e.map.style.transform), h = a.width / 2, u = a.height / 2, y = (h - d.x) / e.scaleVal, v = (u - d.y) / e.scaleVal;
1128
+ l = {
1129
+ containerRect: a,
1130
+ currentTransform: d,
1131
+ mapCenterX: y,
1132
+ mapCenterY: v
1133
+ };
1134
+ }, c = () => {
1135
+ if (l) {
1136
+ const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal, y = h - l.mapCenterY * e.scaleVal, v = u - l.currentTransform.x, p = y - l.currentTransform.y;
1137
+ e.move(v, p);
1138
+ }
1139
+ };
1140
+ return e.el.addEventListener("fullscreenchange", c), n.onclick = () => {
1141
+ r(), document.fullscreenElement !== e.el ? e.el.requestFullscreen() : document.exitFullscreen();
1128
1142
  }, o.onclick = () => {
1129
1143
  e.toCenter();
1130
- }, i.onclick = () => {
1131
- e.scale(e.scaleVal - e.scaleSensitivity);
1132
1144
  }, s.onclick = () => {
1145
+ e.scale(e.scaleVal - e.scaleSensitivity);
1146
+ }, i.onclick = () => {
1133
1147
  e.scale(e.scaleVal + e.scaleSensitivity);
1134
1148
  }, t;
1135
1149
  }
1136
1150
  function on(e) {
1137
- const t = document.createElement("div"), n = K("tbltl", "left"), o = K("tbltr", "right"), i = K("tblts", "side");
1138
- return t.appendChild(n), t.appendChild(o), t.appendChild(i), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
1151
+ const t = document.createElement("div"), n = G("tbltl", "left"), o = G("tbltr", "right"), s = G("tblts", "side");
1152
+ return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
1139
1153
  e.initLeft();
1140
1154
  }, o.onclick = () => {
1141
1155
  e.initRight();
1142
- }, i.onclick = () => {
1156
+ }, s.onclick = () => {
1143
1157
  e.initSide();
1144
1158
  }, t;
1145
1159
  }
@@ -1157,8 +1171,8 @@ class rn {
1157
1171
  }
1158
1172
  dispatchEvent(t, ...n) {
1159
1173
  let o = !0;
1160
- for (const i of this._listeners.get(t) ?? [])
1161
- o = i(...n) !== !1 && o;
1174
+ for (const s of this._listeners.get(t) ?? [])
1175
+ o = s(...n) !== !1 && o;
1162
1176
  return o;
1163
1177
  }
1164
1178
  unbindAllListeners() {
@@ -1171,17 +1185,17 @@ class rn {
1171
1185
  }
1172
1186
  const ze = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e }, t, n) => {
1173
1187
  if (typeof t == "object")
1174
- for (const [o, i] of Object.entries(t))
1175
- i !== void 0 && (e[o] = ze(i));
1188
+ for (const [o, s] of Object.entries(t))
1189
+ s !== void 0 && (e[o] = ze(s));
1176
1190
  else n !== void 0 && (e[t] = ze(n));
1177
1191
  }, Ge = (e = 0, t = 0, n = 0, o = 0) => {
1178
- const i = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
1179
- return { ...i, toJSON: () => JSON.stringify(i) };
1192
+ const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
1193
+ return { ...s, toJSON: () => JSON.stringify(s) };
1180
1194
  }, ln = (e) => {
1181
1195
  let t, n = -1, o = !1;
1182
1196
  return {
1183
- next: (...i) => {
1184
- t = i, o || (o = !0, n = requestAnimationFrame(() => {
1197
+ next: (...s) => {
1198
+ t = s, o || (o = !0, n = requestAnimationFrame(() => {
1185
1199
  e(...t), o = !1;
1186
1200
  }));
1187
1201
  },
@@ -1192,24 +1206,24 @@ const ze = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
1192
1206
  }, Ke = (e, t, n = "touch") => {
1193
1207
  switch (n) {
1194
1208
  case "center": {
1195
- const o = t.left + t.width / 2, i = t.top + t.height / 2;
1196
- return o >= e.left && o <= e.right && i >= e.top && i <= e.bottom;
1209
+ const o = t.left + t.width / 2, s = t.top + t.height / 2;
1210
+ return o >= e.left && o <= e.right && s >= e.top && s <= e.bottom;
1197
1211
  }
1198
1212
  case "cover":
1199
1213
  return t.left >= e.left && t.top >= e.top && t.right <= e.right && t.bottom <= e.bottom;
1200
1214
  case "touch":
1201
1215
  return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
1202
1216
  }
1203
- }, cn = () => matchMedia("(hover: none), (pointer: coarse)").matches, an = () => "safari" in window, Ce = (e) => Array.isArray(e) ? e : [e], dt = (e) => (t, n, o, i = {}) => {
1204
- (t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = Ce(n), t = Ce(t);
1205
- for (const s of t)
1206
- if (s)
1217
+ }, cn = () => matchMedia("(hover: none), (pointer: coarse)").matches, an = () => "safari" in window, Ee = (e) => Array.isArray(e) ? e : [e], dt = (e) => (t, n, o, s = {}) => {
1218
+ (t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = Ee(n), t = Ee(t);
1219
+ for (const i of t)
1220
+ if (i)
1207
1221
  for (const l of n)
1208
- s[e](l, o, { capture: !1, ...i });
1209
- }, z = dt("addEventListener"), j = dt("removeEventListener"), re = (e) => {
1222
+ i[e](l, o, { capture: !1, ...s });
1223
+ }, X = dt("addEventListener"), j = dt("removeEventListener"), re = (e) => {
1210
1224
  const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
1211
1225
  return { x: t, y: n, target: o };
1212
- }, V = (e, t = document) => Ce(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), dn = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
1226
+ }, V = (e, t = document) => Ee(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), dn = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
1213
1227
  switch (o) {
1214
1228
  case "alt":
1215
1229
  return e.altKey;
@@ -1218,7 +1232,7 @@ const ze = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
1218
1232
  case "shift":
1219
1233
  return e.shiftKey;
1220
1234
  }
1221
- }) : !1), { abs: G, max: Xe, min: qe, ceil: Ve } = Math, Ue = (e = []) => ({
1235
+ }) : !1), { abs: z, max: qe, min: Ve, ceil: Ue } = Math, Je = (e = []) => ({
1222
1236
  stored: e,
1223
1237
  selected: [],
1224
1238
  touched: [],
@@ -1229,7 +1243,7 @@ class hn extends rn {
1229
1243
  // Options
1230
1244
  _options;
1231
1245
  // Selection store
1232
- _selection = Ue();
1246
+ _selection = Je();
1233
1247
  // Area element and clipping element
1234
1248
  _area;
1235
1249
  _clippingElement;
@@ -1294,10 +1308,10 @@ class hn extends rn {
1294
1308
  }
1295
1309
  }
1296
1310
  };
1297
- for (const s of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
1298
- typeof this[s] == "function" && (this[s] = this[s].bind(this));
1299
- const { document: n, selectionAreaClass: o, selectionContainerClass: i } = this._options;
1300
- this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), i && this._clippingElement.classList.add(i), W(this._area, {
1311
+ for (const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
1312
+ typeof this[i] == "function" && (this[i] = this[i].bind(this));
1313
+ const { document: n, selectionAreaClass: o, selectionContainerClass: s } = this._options;
1314
+ this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s), W(this._area, {
1301
1315
  willChange: "top, left, bottom, right, width, height",
1302
1316
  top: 0,
1303
1317
  left: 0,
@@ -1309,91 +1323,91 @@ class hn extends rn {
1309
1323
  // https://stackoverflow.com/a/38268846
1310
1324
  pointerEvents: "none",
1311
1325
  zIndex: "1"
1312
- }), this._frame = ln((s) => {
1313
- this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", s), this._redrawSelectionArea();
1326
+ }), this._frame = ln((i) => {
1327
+ this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
1314
1328
  }), this.enable();
1315
1329
  }
1316
1330
  _toggleStartEvents(t = !0) {
1317
- const { document: n, features: o } = this._options, i = t ? z : j;
1318
- i(n, "mousedown", this._onTapStart), o.touch && i(n, "touchstart", this._onTapStart, { passive: !1 });
1331
+ const { document: n, features: o } = this._options, s = t ? X : j;
1332
+ s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
1319
1333
  }
1320
1334
  _onTapStart(t, n = !1) {
1321
- const { x: o, y: i, target: s } = re(t), { document: l, startAreas: r, boundaries: c, features: a, behaviour: d } = this._options, h = s.getBoundingClientRect();
1335
+ const { x: o, y: s, target: i } = re(t), { document: l, startAreas: r, boundaries: c, features: a, behaviour: d } = this._options, h = i.getBoundingClientRect();
1322
1336
  if (t instanceof MouseEvent && !dn(t, d.triggers))
1323
1337
  return;
1324
- const f = V(r, l), y = V(c, l);
1325
- this._targetElement = y.find((g) => Ke(g.getBoundingClientRect(), h));
1326
- const v = t.composedPath(), p = f.find((g) => v.includes(g));
1327
- if (this._targetBoundary = y.find((g) => v.includes(g)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
1338
+ const u = V(r, l), y = V(c, l);
1339
+ this._targetElement = y.find((m) => Ke(m.getBoundingClientRect(), h));
1340
+ const v = t.composedPath(), p = u.find((m) => v.includes(m));
1341
+ if (this._targetBoundary = y.find((m) => v.includes(m)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
1328
1342
  return;
1329
- this._areaLocation = { x1: o, y1: i, x2: 0, y2: 0 };
1330
- const m = l.scrollingElement ?? l.body;
1331
- this._scrollDelta = { x: m.scrollLeft, y: m.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), z(l, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), z(l, ["mouseup", "touchcancel", "touchend"], this._onTapStop), z(l, "scroll", this._onScroll), a.deselectOnBlur && (this._targetBoundaryScrolled = !1, z(this._targetBoundary, "scroll", this._onStartAreaScroll));
1343
+ this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
1344
+ const g = l.scrollingElement ?? l.body;
1345
+ this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), X(l, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), X(l, ["mouseup", "touchcancel", "touchend"], this._onTapStop), X(l, "scroll", this._onScroll), a.deselectOnBlur && (this._targetBoundaryScrolled = !1, X(this._targetBoundary, "scroll", this._onStartAreaScroll));
1332
1346
  }
1333
1347
  _onSingleTap(t) {
1334
1348
  const {
1335
1349
  singleTap: { intersect: n },
1336
1350
  range: o
1337
- } = this._options.features, i = re(t);
1338
- let s;
1351
+ } = this._options.features, s = re(t);
1352
+ let i;
1339
1353
  if (n === "native")
1340
- s = i.target;
1354
+ i = s.target;
1341
1355
  else if (n === "touch") {
1342
1356
  this.resolveSelectables();
1343
- const { x: r, y: c } = i;
1344
- s = this._selectables.find((a) => {
1345
- const { right: d, left: h, top: f, bottom: y } = a.getBoundingClientRect();
1346
- return r < d && r > h && c < y && c > f;
1357
+ const { x: r, y: c } = s;
1358
+ i = this._selectables.find((a) => {
1359
+ const { right: d, left: h, top: u, bottom: y } = a.getBoundingClientRect();
1360
+ return r < d && r > h && c < y && c > u;
1347
1361
  });
1348
1362
  }
1349
- if (!s)
1363
+ if (!i)
1350
1364
  return;
1351
- for (this.resolveSelectables(); !this._selectables.includes(s); )
1352
- if (s.parentElement)
1353
- s = s.parentElement;
1365
+ for (this.resolveSelectables(); !this._selectables.includes(i); )
1366
+ if (i.parentElement)
1367
+ i = i.parentElement;
1354
1368
  else {
1355
1369
  this._targetBoundaryScrolled || this.clearSelection();
1356
1370
  return;
1357
1371
  }
1358
1372
  const { stored: l } = this._selection;
1359
1373
  if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
1360
- const r = this._latestElement, [c, a] = r.compareDocumentPosition(s) & 4 ? [s, r] : [r, s], d = [
1374
+ const r = this._latestElement, [c, a] = r.compareDocumentPosition(i) & 4 ? [i, r] : [r, i], d = [
1361
1375
  ...this._selectables.filter((h) => h.compareDocumentPosition(c) & 4 && h.compareDocumentPosition(a) & 2),
1362
1376
  c,
1363
1377
  a
1364
1378
  ];
1365
1379
  this.select(d), this._latestElement = r;
1366
- } else l.includes(s) && (l.length === 1 || t.ctrlKey || l.every((r) => this._selection.stored.includes(r))) ? this.deselect(s) : (this.select(s), this._latestElement = s);
1380
+ } else l.includes(i) && (l.length === 1 || t.ctrlKey || l.every((r) => this._selection.stored.includes(r))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
1367
1381
  }
1368
1382
  _delayedTapMove(t) {
1369
1383
  const {
1370
1384
  container: n,
1371
1385
  document: o,
1372
- behaviour: { startThreshold: i }
1373
- } = this._options, { x1: s, y1: l } = this._areaLocation, { x: r, y: c } = re(t);
1386
+ behaviour: { startThreshold: s }
1387
+ } = this._options, { x1: i, y1: l } = this._areaLocation, { x: r, y: c } = re(t);
1374
1388
  if (
1375
1389
  // Single number for both coordinates
1376
- typeof i == "number" && G(r + c - (s + l)) >= i || // Different x and y threshold
1377
- typeof i == "object" && G(r - s) >= i.x || G(c - l) >= i.y
1390
+ typeof s == "number" && z(r + c - (i + l)) >= s || // Different x and y threshold
1391
+ typeof s == "object" && z(r - i) >= s.x || z(c - l) >= s.y
1378
1392
  ) {
1379
1393
  if (j(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
1380
1394
  j(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
1381
1395
  return;
1382
1396
  }
1383
- z(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), W(this._area, "display", "block"), V(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (z(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), z(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
1397
+ X(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), W(this._area, "display", "block"), V(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (X(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), X(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
1384
1398
  }
1385
1399
  this._handleMoveEvent(t);
1386
1400
  }
1387
1401
  _setupSelectionArea() {
1388
- const { _clippingElement: t, _targetElement: n, _area: o } = this, i = this._targetRect = n.getBoundingClientRect();
1402
+ const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
1389
1403
  this._scrollAvailable ? (W(t, {
1390
- top: i.top,
1391
- left: i.left,
1392
- width: i.width,
1393
- height: i.height
1404
+ top: s.top,
1405
+ left: s.left,
1406
+ width: s.width,
1407
+ height: s.height
1394
1408
  }), W(o, {
1395
- marginTop: -i.top,
1396
- marginLeft: -i.left
1409
+ marginTop: -s.top,
1410
+ marginLeft: -s.left
1397
1411
  })) : (W(t, {
1398
1412
  top: 0,
1399
1413
  left: 0,
@@ -1405,7 +1419,7 @@ class hn extends rn {
1405
1419
  }));
1406
1420
  }
1407
1421
  _onTapMove(t) {
1408
- const { _scrollSpeed: n, _areaLocation: o, _options: i, _frame: s } = this, { speedDivider: l } = i.behaviour.scrolling;
1422
+ const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling;
1409
1423
  this._targetElement;
1410
1424
  const { x: r, y: c } = re(t);
1411
1425
  if (o.x2 = r, o.y2 = c, this._lastMousePosition.x = r, this._lastMousePosition.y = c, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
@@ -1417,14 +1431,14 @@ class hn extends rn {
1417
1431
  }
1418
1432
  const d = this._options.mindElixirInstance;
1419
1433
  if (d && d.move) {
1420
- const h = n.x ? Ve(n.x / l) : 0, f = n.y ? Ve(n.y / l) : 0;
1421
- (h || f) && (d.move(-h, -f), o.x1 -= h, o.y1 -= f);
1434
+ const h = n.x ? Ue(n.x / l) : 0, u = n.y ? Ue(n.y / l) : 0;
1435
+ (h || u) && (d.move(-h, -u), o.x1 -= h, o.y1 -= u);
1422
1436
  }
1423
- s.next(t), requestAnimationFrame(a);
1437
+ i.next(t), requestAnimationFrame(a);
1424
1438
  };
1425
1439
  requestAnimationFrame(a);
1426
1440
  } else
1427
- s.next(t);
1441
+ i.next(t);
1428
1442
  this._handleMoveEvent(t);
1429
1443
  }
1430
1444
  _handleMoveEvent(t) {
@@ -1435,19 +1449,19 @@ class hn extends rn {
1435
1449
  const {
1436
1450
  _scrollDelta: t,
1437
1451
  _options: { document: n }
1438
- } = this, { scrollTop: o, scrollLeft: i } = n.scrollingElement ?? n.body;
1439
- this._areaLocation.x1 += t.x - i, this._areaLocation.y1 += t.y - o, t.x = i, t.y = o, this._setupSelectionArea(), this._frame.next(null);
1452
+ } = this, { scrollTop: o, scrollLeft: s } = n.scrollingElement ?? n.body;
1453
+ this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
1440
1454
  }
1441
1455
  _onStartAreaScroll() {
1442
1456
  this._targetBoundaryScrolled = !0, j(this._targetElement, "scroll", this._onStartAreaScroll);
1443
1457
  }
1444
1458
  _wheelScroll(t) {
1445
- const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0, i = t.deltaX ? t.deltaX > 0 ? 1 : -1 : 0;
1446
- this._scrollSpeed.y += o * n, this._scrollSpeed.x += i * n, this._onTapMove(t), t.preventDefault();
1459
+ const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0, s = t.deltaX ? t.deltaX > 0 ? 1 : -1 : 0;
1460
+ this._scrollSpeed.y += o * n, this._scrollSpeed.x += s * n, this._onTapMove(t), t.preventDefault();
1447
1461
  }
1448
1462
  _keyboardScroll(t) {
1449
- const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0, i = t.key === "ArrowUp" ? -1 : t.key === "ArrowDown" ? 1 : 0;
1450
- this._scrollSpeed.x += Math.sign(o) * n, this._scrollSpeed.y += Math.sign(i) * n, t.preventDefault(), this._onTapMove({
1463
+ const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0, s = t.key === "ArrowUp" ? -1 : t.key === "ArrowDown" ? 1 : 0;
1464
+ this._scrollSpeed.x += Math.sign(o) * n, this._scrollSpeed.y += Math.sign(s) * n, t.preventDefault(), this._onTapMove({
1451
1465
  clientX: this._lastMousePosition.x,
1452
1466
  clientY: this._lastMousePosition.y,
1453
1467
  preventDefault: () => {
@@ -1455,49 +1469,49 @@ class hn extends rn {
1455
1469
  });
1456
1470
  }
1457
1471
  _recalculateSelectionAreaRect() {
1458
- const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: i } = this, s = this._targetRect, { x1: l, y1: r } = n;
1472
+ const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, i = this._targetRect, { x1: l, y1: r } = n;
1459
1473
  let { x2: c, y2: a } = n;
1460
1474
  const {
1461
1475
  behaviour: {
1462
1476
  scrolling: { startScrollMargins: d }
1463
1477
  }
1464
- } = i;
1465
- c < s.left + d.x ? (t.x = -G(s.left - c + d.x), c = c < s.left ? s.left : c) : c > s.right - d.x ? (t.x = G(s.left + s.width - c - d.x), c = c > s.right ? s.right : c) : t.x = 0, a < s.top + d.y ? (t.y = -G(s.top - a + d.y), a = a < s.top ? s.top : a) : a > s.bottom - d.y ? (t.y = G(s.top + s.height - a - d.y), a = a > s.bottom ? s.bottom : a) : t.y = 0;
1466
- const h = qe(l, c), f = qe(r, a), y = Xe(l, c), v = Xe(r, a);
1467
- this._areaRect = Ge(h, f, y - h, v - f);
1478
+ } = s;
1479
+ c < i.left + d.x ? (t.x = -z(i.left - c + d.x), c = c < i.left ? i.left : c) : c > i.right - d.x ? (t.x = z(i.left + i.width - c - d.x), c = c > i.right ? i.right : c) : t.x = 0, a < i.top + d.y ? (t.y = -z(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = z(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
1480
+ const h = Ve(l, c), u = Ve(r, a), y = qe(l, c), v = qe(r, a);
1481
+ this._areaRect = Ge(h, u, y - h, v - u);
1468
1482
  }
1469
1483
  _redrawSelectionArea() {
1470
- const { x: t, y: n, width: o, height: i } = this._areaRect, { style: s } = this._area;
1471
- s.left = `${t}px`, s.top = `${n}px`, s.width = `${o}px`, s.height = `${i}px`;
1484
+ const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
1485
+ i.left = `${t}px`, i.top = `${n}px`, i.width = `${o}px`, i.height = `${s}px`;
1472
1486
  }
1473
1487
  _onTapStop(t, n) {
1474
- const { document: o, features: i } = this._options, { _singleClick: s } = this;
1475
- j(this._targetElement, "scroll", this._onStartAreaScroll), j(o, ["mousemove", "touchmove"], this._delayedTapMove), j(o, ["touchmove", "mousemove"], this._onTapMove), j(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), j(o, "scroll", this._onScroll), this._keepSelection(), t && s && i.singleTap.allow ? this._onSingleTap(t) : !s && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, j(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), j(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), this._frame?.cancel(), W(this._area, "display", "none");
1488
+ const { document: o, features: s } = this._options, { _singleClick: i } = this;
1489
+ j(this._targetElement, "scroll", this._onStartAreaScroll), j(o, ["mousemove", "touchmove"], this._delayedTapMove), j(o, ["touchmove", "mousemove"], this._onTapMove), j(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), j(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, j(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), j(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), this._frame?.cancel(), W(this._area, "display", "none");
1476
1490
  }
1477
1491
  _updateElementSelection() {
1478
- const { _selectables: t, _options: n, _selection: o, _areaRect: i } = this, { stored: s, selected: l, touched: r } = o, { intersect: c, overlap: a } = n.behaviour, d = a === "invert", h = [], f = [], y = [];
1492
+ const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap: a } = n.behaviour, d = a === "invert", h = [], u = [], y = [];
1479
1493
  for (let p = 0; p < t.length; p++) {
1480
- const m = t[p];
1481
- if (Ke(i, m.getBoundingClientRect(), c)) {
1482
- if (l.includes(m))
1483
- s.includes(m) && !r.includes(m) && r.push(m);
1484
- else if (d && s.includes(m)) {
1485
- y.push(m);
1494
+ const g = t[p];
1495
+ if (Ke(s, g.getBoundingClientRect(), c)) {
1496
+ if (l.includes(g))
1497
+ i.includes(g) && !r.includes(g) && r.push(g);
1498
+ else if (d && i.includes(g)) {
1499
+ y.push(g);
1486
1500
  continue;
1487
1501
  } else
1488
- f.push(m);
1489
- h.push(m);
1502
+ u.push(g);
1503
+ h.push(g);
1490
1504
  }
1491
1505
  }
1492
- d && f.push(...s.filter((p) => !l.includes(p)));
1506
+ d && u.push(...i.filter((p) => !l.includes(p)));
1493
1507
  const v = a === "keep";
1494
1508
  for (let p = 0; p < l.length; p++) {
1495
- const m = l[p];
1496
- !h.includes(m) && !// Check if the user wants to keep previously selected elements, e.g.,
1509
+ const g = l[p];
1510
+ !h.includes(g) && !// Check if the user wants to keep previously selected elements, e.g.,
1497
1511
  // not make them part of the current selection as soon as they're touched.
1498
- (v && s.includes(m)) && y.push(m);
1512
+ (v && i.includes(g)) && y.push(g);
1499
1513
  }
1500
- o.selected = h, o.changed = { added: f, removed: y }, this._latestElement = void 0;
1514
+ o.selected = h, o.changed = { added: u, removed: y }, this._latestElement = void 0;
1501
1515
  }
1502
1516
  _emitEvent(t, n) {
1503
1517
  return this.emit(t, {
@@ -1507,12 +1521,12 @@ class hn extends rn {
1507
1521
  });
1508
1522
  }
1509
1523
  _keepSelection() {
1510
- const { _options: t, _selection: n } = this, { selected: o, changed: i, touched: s, stored: l } = n, r = o.filter((c) => !l.includes(c));
1524
+ const { _options: t, _selection: n } = this, { selected: o, changed: s, touched: i, stored: l } = n, r = o.filter((c) => !l.includes(c));
1511
1525
  switch (t.behaviour.overlap) {
1512
1526
  case "drop": {
1513
1527
  n.stored = [
1514
1528
  ...r,
1515
- ...l.filter((c) => !s.includes(c))
1529
+ ...l.filter((c) => !i.includes(c))
1516
1530
  // Elements not touched
1517
1531
  ];
1518
1532
  break;
@@ -1520,7 +1534,7 @@ class hn extends rn {
1520
1534
  case "invert": {
1521
1535
  n.stored = [
1522
1536
  ...r,
1523
- ...l.filter((c) => !i.removed.includes(c))
1537
+ ...l.filter((c) => !s.removed.includes(c))
1524
1538
  // Elements not removed from selection
1525
1539
  ];
1526
1540
  break;
@@ -1556,8 +1570,8 @@ class hn extends rn {
1556
1570
  * @param quiet If move / stop events should be fired
1557
1571
  */
1558
1572
  clearSelection(t = !0, n = !1) {
1559
- const { selected: o, stored: i, changed: s } = this._selection;
1560
- s.added = [], s.removed.push(...o, ...t ? i : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Ue(t ? [] : i);
1573
+ const { selected: o, stored: s, changed: i } = this._selection;
1574
+ i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Je(t ? [] : s);
1561
1575
  }
1562
1576
  /**
1563
1577
  * @returns {Array} Selected elements
@@ -1617,8 +1631,8 @@ class hn extends rn {
1617
1631
  * @param quiet If this should not trigger the move event
1618
1632
  */
1619
1633
  select(t, n = !1) {
1620
- const { changed: o, selected: i, stored: s } = this._selection, l = V(t, this._options.document).filter((r) => !i.includes(r) && !s.includes(r));
1621
- return s.push(...l), i.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
1634
+ const { changed: o, selected: s, stored: i } = this._selection, l = V(t, this._options.document).filter((r) => !s.includes(r) && !i.includes(r));
1635
+ return i.push(...l), s.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
1622
1636
  }
1623
1637
  /**
1624
1638
  * Removes a particular element from the selection
@@ -1626,11 +1640,11 @@ class hn extends rn {
1626
1640
  * @param quiet If this should not trigger the move event
1627
1641
  */
1628
1642
  deselect(t, n = !1) {
1629
- const { selected: o, stored: i, changed: s } = this._selection, l = V(t, this._options.document).filter((r) => o.includes(r) || i.includes(r));
1630
- this._selection.stored = i.filter((r) => !l.includes(r)), this._selection.selected = o.filter((r) => !l.includes(r)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((r) => !s.removed.includes(r))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
1643
+ const { selected: o, stored: s, changed: i } = this._selection, l = V(t, this._options.document).filter((r) => o.includes(r) || s.includes(r));
1644
+ this._selection.stored = s.filter((r) => !l.includes(r)), this._selection.selected = o.filter((r) => !l.includes(r)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((r) => !i.removed.includes(r))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
1631
1645
  }
1632
1646
  }
1633
- function un(e) {
1647
+ function fn(e) {
1634
1648
  const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new hn({
1635
1649
  selectables: [".map-container me-tpc"],
1636
1650
  boundaries: [e.container],
@@ -1653,51 +1667,51 @@ function un(e) {
1653
1667
  }
1654
1668
  }).on("beforestart", ({ event: o }) => {
1655
1669
  if (e.spacePressed) return !1;
1656
- const i = o.target;
1657
- if (i.id === "input-box" || i.className === "circle" || e.container.querySelector(".context-menu")?.contains(i))
1670
+ const s = o.target;
1671
+ if (s.id === "input-box" || s.className === "circle" || e.container.querySelector(".context-menu")?.contains(s))
1658
1672
  return !1;
1659
1673
  if (!o.ctrlKey && !o.metaKey) {
1660
- if (i.tagName === "ME-TPC" && i.classList.contains("selected"))
1674
+ if (s.tagName === "ME-TPC" && s.classList.contains("selected"))
1661
1675
  return !1;
1662
1676
  e.clearSelection();
1663
1677
  }
1664
- const s = n.getSelectionArea();
1665
- return s.style.background = "#4f90f22d", s.style.border = "1px solid #4f90f2", s.parentElement && (s.parentElement.style.zIndex = "9999"), !0;
1678
+ const i = n.getSelectionArea();
1679
+ return i.style.background = "#4f90f22d", i.style.border = "1px solid #4f90f2", i.parentElement && (i.parentElement.style.zIndex = "9999"), !0;
1666
1680
  }).on(
1667
1681
  "move",
1668
1682
  ({
1669
1683
  store: {
1670
- changed: { added: o, removed: i }
1684
+ changed: { added: o, removed: s }
1671
1685
  }
1672
1686
  }) => {
1673
- if (o.length > 0 || i.length > 0, o.length > 0) {
1674
- for (const s of o)
1675
- s.className = "selected";
1687
+ if (o.length > 0 || s.length > 0, o.length > 0) {
1688
+ for (const i of o)
1689
+ i.className = "selected";
1676
1690
  e.currentNodes = [...e.currentNodes, ...o], e.bus.fire(
1677
1691
  "selectNodes",
1678
- o.map((s) => s.nodeObj)
1692
+ o.map((i) => i.nodeObj)
1679
1693
  );
1680
1694
  }
1681
- if (i.length > 0) {
1682
- for (const s of i)
1683
- s.classList.remove("selected");
1684
- e.currentNodes = e.currentNodes.filter((s) => !i?.includes(s)), e.bus.fire(
1695
+ if (s.length > 0) {
1696
+ for (const i of s)
1697
+ i.classList.remove("selected");
1698
+ e.currentNodes = e.currentNodes.filter((i) => !s?.includes(i)), e.bus.fire(
1685
1699
  "unselectNodes",
1686
- i.map((s) => s.nodeObj)
1700
+ s.map((i) => i.nodeObj)
1687
1701
  );
1688
1702
  }
1689
1703
  }
1690
1704
  );
1691
1705
  e.selection = n;
1692
1706
  }
1693
- const fn = function(e, t = !0) {
1707
+ const un = function(e, t = !0) {
1694
1708
  this.theme = e;
1695
1709
  const o = {
1696
1710
  ...(e.type === "dark" ? Ne : Se).cssVar,
1697
1711
  ...e.cssVar
1698
- }, i = Object.keys(o);
1699
- for (let s = 0; s < i.length; s++) {
1700
- const l = i[s];
1712
+ }, s = Object.keys(o);
1713
+ for (let i = 0; i < s.length; i++) {
1714
+ const l = s[i];
1701
1715
  this.container.style.setProperty(l, o[l]);
1702
1716
  }
1703
1717
  t && this.refresh();
@@ -1722,8 +1736,8 @@ function ht(e) {
1722
1736
  return t === void 0 ? 0 : (t.splice(n, 1), t.length);
1723
1737
  }
1724
1738
  function mn(e, t, n) {
1725
- const { siblings: o, index: i } = te(n);
1726
- o !== void 0 && (t === "before" ? o.splice(i, 0, e) : o.splice(i + 1, 0, e));
1739
+ const { siblings: o, index: s } = te(n);
1740
+ o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
1727
1741
  }
1728
1742
  function yn(e, t) {
1729
1743
  const { siblings: n, index: o } = te(e);
@@ -1734,9 +1748,9 @@ function vn(e, t, n) {
1734
1748
  n.children ? n.children.push(t) : n.children = [t];
1735
1749
  else {
1736
1750
  t.direction !== void 0 && (t.direction = n.direction);
1737
- const { siblings: o, index: i } = te(n);
1751
+ const { siblings: o, index: s } = te(n);
1738
1752
  if (o === void 0) return;
1739
- e === "before" ? o.splice(i, 0, t) : o.splice(i + 1, 0, t);
1753
+ e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
1740
1754
  }
1741
1755
  }
1742
1756
  const bn = function({ map: e, direction: t }, n) {
@@ -1745,20 +1759,20 @@ const bn = function({ map: e, direction: t }, n) {
1745
1759
  if (t === 1)
1746
1760
  return 1;
1747
1761
  if (t === 2) {
1748
- const o = e.querySelector(".lhs")?.childElementCount || 0, i = e.querySelector(".rhs")?.childElementCount || 0;
1749
- return o <= i ? (n.direction = 0, 0) : (n.direction = 1, 1);
1750
- }
1751
- }, ut = function(e, t, n) {
1752
- const o = n.children[0].children[0], i = t.parentElement;
1753
- if (i.tagName === "ME-PARENT") {
1754
- if (ie(o), i.children[1])
1755
- i.nextSibling.appendChild(n);
1762
+ const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
1763
+ return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
1764
+ }
1765
+ }, ft = function(e, t, n) {
1766
+ const o = n.children[0].children[0], s = t.parentElement;
1767
+ if (s.tagName === "ME-PARENT") {
1768
+ if (se(o), s.children[1])
1769
+ s.nextSibling.appendChild(n);
1756
1770
  else {
1757
- const s = e.createChildren([n]);
1758
- i.appendChild(Ae(!0)), i.insertAdjacentElement("afterend", s);
1771
+ const i = e.createChildren([n]);
1772
+ s.appendChild(Me(!0)), s.insertAdjacentElement("afterend", i);
1759
1773
  }
1760
1774
  e.linkDiv(n.offsetParent);
1761
- } else i.tagName === "ME-ROOT" && (bn(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
1775
+ } else s.tagName === "ME-ROOT" && (bn(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
1762
1776
  }, wn = function(e, t) {
1763
1777
  const n = e.parentNode;
1764
1778
  if (t === 0) {
@@ -1766,38 +1780,38 @@ const bn = function({ map: e, direction: t }, n) {
1766
1780
  o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
1767
1781
  }
1768
1782
  n.parentNode.remove();
1769
- }, ft = {
1783
+ }, ut = {
1770
1784
  before: "beforebegin",
1771
1785
  after: "afterend"
1772
- }, ie = function(e) {
1786
+ }, se = function(e) {
1773
1787
  const n = e.parentElement.parentElement.lastElementChild;
1774
1788
  n?.tagName === "svg" && n?.remove();
1775
1789
  }, xn = function(e, t) {
1776
1790
  const n = e.nodeObj, o = Te(n);
1777
1791
  o.style && t.style && (t.style = Object.assign(o.style, t.style));
1778
- const i = Object.assign(n, t);
1779
- Le.call(this, e, i), this.linkDiv(), this.bus.fire("operation", {
1792
+ const s = Object.assign(n, t);
1793
+ Ae.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
1780
1794
  name: "reshapeNode",
1781
- obj: i,
1795
+ obj: s,
1782
1796
  origin: o
1783
1797
  });
1784
- }, Me = function(e, t, n) {
1798
+ }, De = function(e, t, n) {
1785
1799
  if (!t) return null;
1786
1800
  const o = t.nodeObj;
1787
1801
  o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
1788
- const i = n || e.generateNewObj();
1789
- o.children ? o.children.push(i) : o.children = [i], X(e.nodeData);
1790
- const { grp: s, top: l } = e.createWrapper(i);
1791
- return ut(e, t, s), { newTop: l, newNodeObj: i };
1792
- }, En = function(e, t, n) {
1802
+ const s = n || e.generateNewObj();
1803
+ o.children ? o.children.push(s) : o.children = [s], K(e.nodeData);
1804
+ const { grp: i, top: l } = e.createWrapper(s);
1805
+ return ft(e, t, i), { newTop: l, newNodeObj: s };
1806
+ }, Cn = function(e, t, n) {
1793
1807
  const o = t || this.currentNode;
1794
1808
  if (!o) return;
1795
- const i = o.nodeObj;
1796
- if (i.parent) {
1797
- if (!i.parent?.parent && this.direction === 2) {
1809
+ const s = o.nodeObj;
1810
+ if (s.parent) {
1811
+ if (!s.parent?.parent && this.direction === 2) {
1798
1812
  const a = this.map.querySelector(".lhs")?.childElementCount || 0, d = this.map.querySelector(".rhs")?.childElementCount || 0;
1799
1813
  if (!a || !d) {
1800
- this.addChild(this.findEle(i.parent.id), n);
1814
+ this.addChild(this.findEle(s.parent.id), n);
1801
1815
  return;
1802
1816
  }
1803
1817
  }
@@ -1805,61 +1819,61 @@ const bn = function({ map: e, direction: t }, n) {
1805
1819
  this.addChild();
1806
1820
  return;
1807
1821
  }
1808
- const s = n || this.generateNewObj();
1809
- if (!i.parent?.parent) {
1810
- const a = o.closest("me-main").className === I.LHS ? 0 : 1;
1811
- s.direction = a;
1822
+ const i = n || this.generateNewObj();
1823
+ if (!s.parent?.parent) {
1824
+ const a = o.closest("me-main").className === B.LHS ? 0 : 1;
1825
+ i.direction = a;
1812
1826
  }
1813
- mn(s, e, i), X(this.nodeData);
1814
- const l = o.parentElement, { grp: r, top: c } = this.createWrapper(s);
1815
- l.parentElement.insertAdjacentElement(ft[e], r), this.linkDiv(r.offsetParent), n || this.editTopic(c.firstChild), this.bus.fire("operation", {
1827
+ mn(i, e, s), K(this.nodeData);
1828
+ const l = o.parentElement, { grp: r, top: c } = this.createWrapper(i);
1829
+ l.parentElement.insertAdjacentElement(ut[e], r), this.linkDiv(r.offsetParent), n || this.editTopic(c.firstChild), this.bus.fire("operation", {
1816
1830
  name: "insertSibling",
1817
1831
  type: e,
1818
- obj: s
1832
+ obj: i
1819
1833
  }), this.selectNode(c.firstChild, !0);
1820
- }, Cn = function(e, t) {
1834
+ }, En = function(e, t) {
1821
1835
  const n = e || this.currentNode;
1822
1836
  if (!n) return;
1823
- ie(n);
1837
+ se(n);
1824
1838
  const o = n.nodeObj;
1825
1839
  if (!o.parent)
1826
1840
  return;
1827
- const i = t || this.generateNewObj();
1828
- yn(o, i), X(this.nodeData);
1829
- const s = n.parentElement.parentElement, { grp: l, top: r } = this.createWrapper(i, !0);
1830
- r.appendChild(Ae(!0)), s.insertAdjacentElement("afterend", l);
1831
- const c = this.createChildren([s]);
1841
+ const s = t || this.generateNewObj();
1842
+ yn(o, s), K(this.nodeData);
1843
+ const i = n.parentElement.parentElement, { grp: l, top: r } = this.createWrapper(s, !0);
1844
+ r.appendChild(Me(!0)), i.insertAdjacentElement("afterend", l);
1845
+ const c = this.createChildren([i]);
1832
1846
  r.insertAdjacentElement("afterend", c), this.linkDiv(), t || this.editTopic(r.firstChild), this.selectNode(r.firstChild, !0), this.bus.fire("operation", {
1833
1847
  name: "insertParent",
1834
- obj: i
1848
+ obj: s
1835
1849
  });
1836
1850
  }, Sn = function(e, t) {
1837
1851
  const n = e || this.currentNode;
1838
1852
  if (!n) return;
1839
- const o = Me(this, n, t);
1853
+ const o = De(this, n, t);
1840
1854
  if (!o) return;
1841
- const { newTop: i, newNodeObj: s } = o;
1855
+ const { newTop: s, newNodeObj: i } = o;
1842
1856
  this.bus.fire("operation", {
1843
1857
  name: "addChild",
1844
- obj: s
1845
- }), t || this.editTopic(i.firstChild), this.selectNode(i.firstChild, !0);
1858
+ obj: i
1859
+ }), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
1846
1860
  }, Nn = function(e, t) {
1847
1861
  const n = Te(e.nodeObj);
1848
1862
  ke(n);
1849
- const o = Me(this, t, n);
1863
+ const o = De(this, t, n);
1850
1864
  if (!o) return;
1851
- const { newNodeObj: i } = o;
1852
- this.selectNode(this.findEle(i.id)), this.bus.fire("operation", {
1865
+ const { newNodeObj: s } = o;
1866
+ this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
1853
1867
  name: "copyNode",
1854
- obj: i
1868
+ obj: s
1855
1869
  });
1856
1870
  }, kn = function(e, t) {
1857
1871
  e = _e(e);
1858
1872
  const n = [];
1859
1873
  for (let o = 0; o < e.length; o++) {
1860
- const i = e[o], s = Te(i.nodeObj);
1861
- ke(s);
1862
- const l = Me(this, t, s);
1874
+ const s = e[o], i = Te(s.nodeObj);
1875
+ ke(i);
1876
+ const l = De(this, t, i);
1863
1877
  if (!l) return;
1864
1878
  const { newNodeObj: r } = l;
1865
1879
  n.push(r);
@@ -1892,49 +1906,49 @@ const bn = function({ map: e, direction: t }, n) {
1892
1906
  if (e.length === 0) return;
1893
1907
  e = _e(e);
1894
1908
  for (const n of e) {
1895
- const o = n.nodeObj, i = ht(o);
1896
- wn(n, i);
1909
+ const o = n.nodeObj, s = ht(o);
1910
+ wn(n, s);
1897
1911
  }
1898
1912
  const t = e[e.length - 1];
1899
1913
  this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
1900
1914
  name: "removeNodes",
1901
1915
  objs: e.map((n) => n.nodeObj)
1902
1916
  });
1903
- }, De = (e, t, n, o) => {
1917
+ }, Pe = (e, t, n, o) => {
1904
1918
  e = _e(e);
1905
- let i = n.nodeObj;
1906
- t === "in" && i.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(i.id), i = n.nodeObj), t === "after" && (e = e.reverse());
1907
- const s = [];
1919
+ let s = n.nodeObj;
1920
+ t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
1921
+ const i = [];
1908
1922
  for (const r of e) {
1909
1923
  const c = r.nodeObj;
1910
- if (vn(t, c, i), X(o.nodeData), t === "in") {
1924
+ if (vn(t, c, s), K(o.nodeData), t === "in") {
1911
1925
  const a = r.parentElement;
1912
- ut(o, n, a.parentElement);
1926
+ ft(o, n, a.parentElement);
1913
1927
  } else {
1914
- ie(r);
1928
+ se(r);
1915
1929
  const a = r.parentElement.parentNode;
1916
- s.includes(a.parentElement) || s.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(ft[t], a);
1930
+ i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(ut[t], a);
1917
1931
  }
1918
1932
  }
1919
- for (const r of s)
1933
+ for (const r of i)
1920
1934
  r.childElementCount === 0 && r.tagName !== "ME-MAIN" && (r.previousSibling.children[1].remove(), r.remove());
1921
1935
  o.linkDiv(), o.scrollIntoView(e[e.length - 1]);
1922
1936
  const l = t === "before" ? "moveNodeBefore" : t === "after" ? "moveNodeAfter" : "moveNodeIn";
1923
1937
  o.bus.fire("operation", {
1924
1938
  name: l,
1925
1939
  objs: e.map((r) => r.nodeObj),
1926
- toObj: i
1940
+ toObj: s
1927
1941
  });
1928
1942
  }, An = function(e, t) {
1929
- De(e, "in", t, this);
1943
+ Pe(e, "in", t, this);
1930
1944
  }, Mn = function(e, t) {
1931
- De(e, "before", t, this);
1945
+ Pe(e, "before", t, this);
1932
1946
  }, Dn = function(e, t) {
1933
- De(e, "after", t, this);
1947
+ Pe(e, "after", t, this);
1934
1948
  }, Pn = function(e) {
1935
1949
  const t = e || this.currentNode;
1936
1950
  t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
1937
- }, $n = function(e, t) {
1951
+ }, On = function(e, t) {
1938
1952
  e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
1939
1953
  }, pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1940
1954
  __proto__: null,
@@ -1942,8 +1956,8 @@ const bn = function({ map: e, direction: t }, n) {
1942
1956
  beginEdit: Pn,
1943
1957
  copyNode: Nn,
1944
1958
  copyNodes: kn,
1945
- insertParent: Cn,
1946
- insertSibling: En,
1959
+ insertParent: En,
1960
+ insertSibling: Cn,
1947
1961
  moveDownNode: _n,
1948
1962
  moveNodeAfter: Dn,
1949
1963
  moveNodeBefore: Mn,
@@ -1951,10 +1965,10 @@ const bn = function({ map: e, direction: t }, n) {
1951
1965
  moveUpNode: Tn,
1952
1966
  removeNodes: Ln,
1953
1967
  reshapeNode: xn,
1954
- rmSubline: ie,
1955
- setNodeTopic: $n
1968
+ rmSubline: se,
1969
+ setNodeTopic: On
1956
1970
  }, Symbol.toStringTag, { value: "Module" }));
1957
- function On(e) {
1971
+ function $n(e) {
1958
1972
  return {
1959
1973
  nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
1960
1974
  arrows: e.arrows,
@@ -1966,19 +1980,19 @@ function On(e) {
1966
1980
  const jn = function(e) {
1967
1981
  const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
1968
1982
  if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
1969
- const s = n.left + n.width / 2, l = n.top + n.height / 2, r = o.left + o.width / 2, c = o.top + o.height / 2, a = s - r, d = l - c;
1983
+ const i = n.left + n.width / 2, l = n.top + n.height / 2, r = o.left + o.width / 2, c = o.top + o.height / 2, a = i - r, d = l - c;
1970
1984
  this.move(-a, -d, !0);
1971
1985
  }
1972
1986
  }, Hn = function(e, t, n) {
1973
1987
  this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
1974
- }, In = function(e) {
1988
+ }, Rn = function(e) {
1975
1989
  this.selection.select(e);
1976
1990
  }, Bn = function(e) {
1977
1991
  this.selection?.deselect(e);
1978
- }, Rn = function() {
1992
+ }, In = function() {
1979
1993
  this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
1980
1994
  }, Fn = function() {
1981
- const e = On(this);
1995
+ const e = $n(this);
1982
1996
  return JSON.stringify(e, (t, n) => {
1983
1997
  if (!(t === "parent" && typeof n != "string"))
1984
1998
  return n;
@@ -1987,47 +2001,47 @@ const jn = function(e) {
1987
2001
  return JSON.parse(this.getDataString());
1988
2002
  }, Wn = function() {
1989
2003
  this.editable = !0;
1990
- }, zn = function() {
2004
+ }, Xn = function() {
1991
2005
  this.editable = !1;
1992
- }, Gn = function(e, t = { x: 0, y: 0 }) {
1993
- if (e < this.scaleMin || e > this.scaleMax) return;
1994
- const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, i = t.y ? t.y - n.top - n.height / 2 : 0, { dx: s, dy: l } = Pe(this), r = this.map.style.transform, { x: c, y: a } = tt(r), d = c - s, h = a - l, f = this.scaleVal, y = (-o + d) * (1 - e / f), v = (-i + h) * (1 - e / f);
2006
+ }, zn = function(e, t = { x: 0, y: 0 }) {
2007
+ if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
2008
+ const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = Oe(this), r = this.map.style.transform, { x: c, y: a } = Le(r), d = c - i, h = a - l, u = this.scaleVal, y = (-o + d) * (1 - e / u), v = (-s + h) * (1 - e / u);
1995
2009
  this.map.style.transform = `translate3d(${c - y}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
1996
- }, Kn = function() {
2010
+ }, Gn = function() {
1997
2011
  const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
1998
2012
  this.scaleVal = n;
1999
- const { dx: o, dy: i } = Pe(this, !0);
2000
- this.map.style.transform = `translate3d(${o}px, ${i}px, 0) scale(${n})`, this.bus.fire("scale", n);
2001
- }, Xn = function(e, t, n = !1) {
2002
- const { map: o, scaleVal: i, bus: s, container: l, nodes: r } = this;
2013
+ const { dx: o, dy: s } = Oe(this, !0);
2014
+ this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
2015
+ }, Kn = function(e, t, n = !1) {
2016
+ const { map: o, scaleVal: s, bus: i, container: l, nodes: r } = this;
2003
2017
  if (n && o.style.transition === "transform 0.3s")
2004
2018
  return;
2005
2019
  const c = o.style.transform;
2006
- let { x: a, y: d } = tt(c);
2007
- const h = l.getBoundingClientRect(), f = r.getBoundingClientRect(), y = f.left < h.right && f.right > h.left, v = f.top < h.bottom && f.bottom > h.top;
2020
+ let { x: a, y: d } = Le(c);
2021
+ const h = l.getBoundingClientRect(), u = r.getBoundingClientRect(), y = u.left < h.right && u.right > h.left, v = u.top < h.bottom && u.bottom > h.top;
2008
2022
  if (y) {
2009
- const p = f.left + e, m = f.right + e;
2010
- (p >= h.right || m <= h.left) && (e = 0);
2023
+ const p = u.left + e, g = u.right + e;
2024
+ (p >= h.right || g <= h.left) && (e = 0);
2011
2025
  }
2012
2026
  if (v) {
2013
- const p = f.top + t, m = f.bottom + t;
2014
- (p >= h.bottom || m <= h.top) && (t = 0);
2027
+ const p = u.top + t, g = u.bottom + t;
2028
+ (p >= h.bottom || g <= h.top) && (t = 0);
2015
2029
  }
2016
2030
  a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
2017
2031
  o.style.transition = "none";
2018
- }, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${i})`, s.fire("move", { dx: e, dy: t });
2019
- }, Pe = (e, t = !1) => {
2020
- const { container: n, map: o, nodes: i } = e;
2021
- let s, l;
2032
+ }, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
2033
+ }, Oe = (e, t = !1) => {
2034
+ const { container: n, map: o, nodes: s } = e;
2035
+ let i, l;
2022
2036
  if (e.alignment === "nodes" || t)
2023
- s = (n.offsetWidth - i.offsetWidth) / 2, l = (n.offsetHeight - i.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
2037
+ i = (n.offsetWidth - s.offsetWidth) / 2, l = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
2024
2038
  else {
2025
2039
  const r = o.querySelector("me-root"), c = r.offsetTop, a = r.offsetLeft, d = r.offsetWidth, h = r.offsetHeight;
2026
- s = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - c - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
2040
+ i = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - c - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
2027
2041
  }
2028
- return { dx: s, dy: l };
2042
+ return { dx: i, dy: l };
2029
2043
  }, qn = function() {
2030
- const { map: e, container: t } = this, { dx: n, dy: o } = Pe(this);
2044
+ const { map: e, container: t } = this, { dx: n, dy: o } = Oe(this);
2031
2045
  t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
2032
2046
  }, Vn = function(e) {
2033
2047
  e(this);
@@ -2046,41 +2060,41 @@ const jn = function(e) {
2046
2060
  }, no = function(e, t) {
2047
2061
  const n = e.nodeObj;
2048
2062
  typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
2049
- const o = e.getBoundingClientRect(), i = {
2063
+ const o = e.getBoundingClientRect(), s = {
2050
2064
  x: o.left,
2051
2065
  y: o.top
2052
- }, s = e.parentNode, l = s.children[1];
2053
- if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", ie(e), n.expanded) {
2066
+ }, i = e.parentNode, l = i.children[1];
2067
+ if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", se(e), n.expanded) {
2054
2068
  const h = this.createChildren(
2055
- n.children.map((f) => this.createWrapper(f).grp)
2069
+ n.children.map((u) => this.createWrapper(u).grp)
2056
2070
  );
2057
- s.parentNode.appendChild(h);
2071
+ i.parentNode.appendChild(h);
2058
2072
  } else
2059
- s.parentNode.children[1].remove();
2073
+ i.parentNode.children[1].remove();
2060
2074
  this.linkDiv(e.closest("me-main > me-wrapper"));
2061
2075
  const r = e.getBoundingClientRect(), c = {
2062
2076
  x: r.left,
2063
2077
  y: r.top
2064
- }, a = i.x - c.x, d = i.y - c.y;
2078
+ }, a = s.x - c.x, d = s.y - c.y;
2065
2079
  this.move(a, d), this.bus.fire("expandNode", n);
2066
2080
  }, oo = function(e, t) {
2067
- const n = e.nodeObj, o = e.getBoundingClientRect(), i = {
2081
+ const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
2068
2082
  x: o.left,
2069
2083
  y: o.top
2070
2084
  };
2071
2085
  Q(n, t ?? !n.expanded), this.refresh();
2072
- const s = this.findEle(n.id).getBoundingClientRect(), l = {
2073
- x: s.left,
2074
- y: s.top
2075
- }, r = i.x - l.x, c = i.y - l.y;
2086
+ const i = this.findEle(n.id).getBoundingClientRect(), l = {
2087
+ x: i.left,
2088
+ y: i.top
2089
+ }, r = s.x - l.x, c = s.y - l.y;
2076
2090
  this.move(r, c);
2077
- }, io = function(e) {
2078
- this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), X(this.nodeData), this.layout(), this.linkDiv();
2079
- }, so = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2091
+ }, so = function(e) {
2092
+ this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), K(this.nodeData), this.layout(), this.linkDiv();
2093
+ }, io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2080
2094
  __proto__: null,
2081
2095
  cancelFocus: Jn,
2082
- clearSelection: Rn,
2083
- disableEdit: zn,
2096
+ clearSelection: In,
2097
+ disableEdit: Xn,
2084
2098
  enableEdit: Wn,
2085
2099
  expandNode: no,
2086
2100
  expandNodeAll: oo,
@@ -2091,13 +2105,13 @@ const jn = function(e) {
2091
2105
  initRight: Qn,
2092
2106
  initSide: eo,
2093
2107
  install: Vn,
2094
- move: Xn,
2095
- refresh: io,
2096
- scale: Gn,
2097
- scaleFit: Kn,
2108
+ move: Kn,
2109
+ refresh: so,
2110
+ scale: zn,
2111
+ scaleFit: Gn,
2098
2112
  scrollIntoView: jn,
2099
2113
  selectNode: Hn,
2100
- selectNodes: In,
2114
+ selectNodes: Rn,
2101
2115
  setLocale: to,
2102
2116
  toCenter: qn,
2103
2117
  unselectNodes: Bn
@@ -2136,53 +2150,53 @@ const jn = function(e) {
2136
2150
  this.moved = !1, this.pointerdown = !1;
2137
2151
  }
2138
2152
  };
2139
- }, Je = {
2153
+ }, Ze = {
2140
2154
  create: ro
2141
2155
  }, lo = "#4dc4ff";
2142
- function gt(e, t, n, o, i, s, l, r) {
2156
+ function gt(e, t, n, o, s, i, l, r) {
2143
2157
  return {
2144
- x: e / 8 + n * 3 / 8 + i * 3 / 8 + l / 8,
2145
- y: t / 8 + o * 3 / 8 + s * 3 / 8 + r / 8
2158
+ x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
2159
+ y: t / 8 + o * 3 / 8 + i * 3 / 8 + r / 8
2146
2160
  };
2147
2161
  }
2148
2162
  function co(e, t, n) {
2149
2163
  e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), me(e));
2150
2164
  }
2151
- function le(e, t, n, o, i) {
2165
+ function le(e, t, n, o, s) {
2152
2166
  A(e, {
2153
2167
  x1: t + "",
2154
2168
  y1: n + "",
2155
2169
  x2: o + "",
2156
- y2: i + ""
2170
+ y2: s + ""
2157
2171
  });
2158
2172
  }
2159
- function Ze(e, t, n, o, i, s, l, r, c, a) {
2160
- const d = `M ${t} ${n} C ${o} ${i} ${s} ${l} ${r} ${c}`;
2173
+ function Qe(e, t, n, o, s, i, l, r, c, a) {
2174
+ const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${r} ${c}`;
2161
2175
  if (e.line.setAttribute("d", d), a.style) {
2162
2176
  const p = a.style;
2163
2177
  p.stroke && e.line.setAttribute("stroke", p.stroke), p.strokeWidth && e.line.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeDasharray && e.line.setAttribute("stroke-dasharray", p.strokeDasharray), p.strokeLinecap && e.line.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && e.line.setAttribute("opacity", String(p.opacity));
2164
2178
  }
2165
2179
  const h = e.querySelectorAll('path[stroke="transparent"]');
2166
2180
  h.length > 0 && h[0].setAttribute("d", d);
2167
- const f = ue(s, l, r, c);
2168
- if (f) {
2169
- const p = `M ${f.x1} ${f.y1} L ${r} ${c} L ${f.x2} ${f.y2}`;
2181
+ const u = fe(i, l, r, c);
2182
+ if (u) {
2183
+ const p = `M ${u.x1} ${u.y1} L ${r} ${c} L ${u.x2} ${u.y2}`;
2170
2184
  if (e.arrow1.setAttribute("d", p), h.length > 1 && h[1].setAttribute("d", p), a.style) {
2171
- const m = a.style;
2172
- m.stroke && e.arrow1.setAttribute("stroke", m.stroke), m.strokeWidth && e.arrow1.setAttribute("stroke-width", String(m.strokeWidth)), m.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", m.strokeLinecap), m.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(m.opacity));
2185
+ const g = a.style;
2186
+ g.stroke && e.arrow1.setAttribute("stroke", g.stroke), g.strokeWidth && e.arrow1.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(g.opacity));
2173
2187
  }
2174
2188
  }
2175
2189
  if (a.bidirectional) {
2176
- const p = ue(o, i, t, n);
2190
+ const p = fe(o, s, t, n);
2177
2191
  if (p) {
2178
- const m = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
2179
- if (e.arrow2.setAttribute("d", m), h.length > 2 && h[2].setAttribute("d", m), a.style) {
2180
- const g = a.style;
2181
- g.stroke && e.arrow2.setAttribute("stroke", g.stroke), g.strokeWidth && e.arrow2.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(g.opacity));
2192
+ const g = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
2193
+ if (e.arrow2.setAttribute("d", g), h.length > 2 && h[2].setAttribute("d", g), a.style) {
2194
+ const m = a.style;
2195
+ m.stroke && e.arrow2.setAttribute("stroke", m.stroke), m.strokeWidth && e.arrow2.setAttribute("stroke-width", String(m.strokeWidth)), m.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", m.strokeLinecap), m.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(m.opacity));
2182
2196
  }
2183
2197
  }
2184
2198
  }
2185
- const { x: y, y: v } = gt(t, n, o, i, s, l, r, c);
2199
+ const { x: y, y: v } = gt(t, n, o, s, i, l, r, c);
2186
2200
  if (e.labelEl && co(e.labelEl, y, v), a.style?.labelColor) {
2187
2201
  const p = e.labelEl;
2188
2202
  p && (p.style.color = a.style.labelColor);
@@ -2190,9 +2204,9 @@ function Ze(e, t, n, o, i, s, l, r, c, a) {
2190
2204
  yo(e);
2191
2205
  }
2192
2206
  function pe(e, t, n) {
2193
- const { offsetLeft: o, offsetTop: i } = F(e.nodes, t), s = t.offsetWidth, l = t.offsetHeight, r = o + s / 2, c = i + l / 2, a = r + n.x, d = c + n.y;
2207
+ const { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, r = o + i / 2, c = s + l / 2, a = r + n.x, d = c + n.y;
2194
2208
  return {
2195
- w: s,
2209
+ w: i,
2196
2210
  h: l,
2197
2211
  cx: r,
2198
2212
  cy: c,
@@ -2208,46 +2222,52 @@ function Z(e) {
2208
2222
  y: n
2209
2223
  };
2210
2224
  }
2211
- const $e = function(e, t, n, o, i) {
2225
+ const $e = function(e, t, n, o, s) {
2212
2226
  if (!t || !n)
2213
2227
  return;
2214
- const s = pe(e, t, o.delta1), l = pe(e, n, o.delta2), { x: r, y: c } = Z(s), { ctrlX: a, ctrlY: d } = s, { ctrlX: h, ctrlY: f } = l, { x: y, y: v } = Z(l), p = ue(h, f, y, v);
2228
+ const i = pe(e, t, o.delta1), l = pe(e, n, o.delta2), { x: r, y: c } = Z(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: y, y: v } = Z(l), p = fe(h, u, y, v);
2215
2229
  if (!p) return;
2216
- const m = `M ${p.x1} ${p.y1} L ${y} ${v} L ${p.x2} ${p.y2}`;
2217
- let g = "";
2230
+ const g = `M ${p.x1} ${p.y1} L ${y} ${v} L ${p.x2} ${p.y2}`;
2231
+ let m = "";
2218
2232
  if (o.bidirectional) {
2219
- const N = ue(a, d, r, c);
2233
+ const N = fe(a, d, r, c);
2220
2234
  if (!N) return;
2221
- g = `M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`;
2235
+ m = `M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`;
2222
2236
  }
2223
- const b = Wt(`M ${r} ${c} C ${a} ${d} ${h} ${f} ${y} ${v}`, m, g, o.style), { x, y: L } = gt(r, c, a, d, h, f, y, v), _ = o.style?.labelColor || "rgb(235, 95, 82)", C = "arrow-" + o.id;
2224
- b.id = C;
2225
- const E = e.markdown ? e.markdown(o.label, o) : o.label, S = Ee(E, x, L, {
2237
+ const b = Wt(`M ${r} ${c} C ${a} ${d} ${h} ${u} ${y} ${v}`, g, m, o.style), { x, y: L } = gt(r, c, a, d, h, u, y, v), T = o.style?.labelColor || "rgb(235, 95, 82)", E = "arrow-" + o.id;
2238
+ b.id = E;
2239
+ const C = e.markdown ? e.markdown(o.label, o) : o.label, S = Ce(C, x, L, {
2226
2240
  anchor: "middle",
2227
- color: _,
2241
+ color: T,
2228
2242
  dataType: "arrow",
2229
- svgId: C
2243
+ svgId: E
2230
2244
  });
2231
- b.labelEl = S, b.arrowObj = o, b.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.linkSvgGroup.appendChild(b), me(S), i || (e.arrows.push(o), e.currentArrow = b, mt(e, o, s, l));
2245
+ b.labelEl = S, b.arrowObj = o, b.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.linkSvgGroup.appendChild(b), me(S), s || (e.arrows.push(o), e.currentArrow = b, mt(e, o, i, l));
2232
2246
  }, ao = function(e, t, n = {}) {
2233
- const o = {
2247
+ const o = H(this.nodes, e), s = H(this.nodes, t), i = o.offsetLeft + e.offsetWidth / 2, l = o.offsetTop + e.offsetHeight / 2, r = s.offsetLeft + t.offsetWidth / 2, c = s.offsetTop + t.offsetHeight / 2, a = r - i, d = c - l, h = Math.sqrt(a * a + d * d), u = Math.max(50, Math.min(200, h * 0.3)), y = Math.abs(a), v = Math.abs(d);
2248
+ let p, g;
2249
+ if (y > v * 1.5) {
2250
+ const b = a > 0 ? e.offsetWidth / 2 : -e.offsetWidth / 2, x = a > 0 ? -t.offsetWidth / 2 : t.offsetWidth / 2;
2251
+ p = { x: b + (a > 0 ? u : -u), y: 0 }, g = { x: x + (a > 0 ? -u : u), y: 0 };
2252
+ } else if (v > y * 1.5) {
2253
+ const b = d > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, x = d > 0 ? -t.offsetHeight / 2 : t.offsetHeight / 2;
2254
+ p = { x: 0, y: b + (d > 0 ? u : -u) }, g = { x: 0, y: x + (d > 0 ? -u : u) };
2255
+ } else {
2256
+ const b = Math.atan2(d, a), x = e.offsetWidth / 2 * Math.cos(b), L = e.offsetHeight / 2 * Math.sin(b), T = -(t.offsetWidth / 2) * Math.cos(b), E = -(t.offsetHeight / 2) * Math.sin(b), C = u * 0.7 * (a > 0 ? 1 : -1), S = u * 0.7 * (d > 0 ? 1 : -1);
2257
+ p = { x: x + C, y: L + S }, g = { x: T - C, y: E - S };
2258
+ }
2259
+ const m = {
2234
2260
  id: q(),
2235
2261
  label: "Custom Link",
2236
2262
  from: e.nodeObj.id,
2237
2263
  to: t.nodeObj.id,
2238
- delta1: {
2239
- x: e.offsetWidth / 2 + 100,
2240
- y: 0
2241
- },
2242
- delta2: {
2243
- x: t.offsetWidth / 2 + 100,
2244
- y: 0
2245
- },
2264
+ delta1: p,
2265
+ delta2: g,
2246
2266
  ...n
2247
2267
  };
2248
- $e(this, e, t, o), this.bus.fire("operation", {
2268
+ $e(this, e, t, m), this.bus.fire("operation", {
2249
2269
  name: "createArrow",
2250
- obj: o
2270
+ obj: m
2251
2271
  });
2252
2272
  }, ho = function(e) {
2253
2273
  ye(this);
@@ -2256,7 +2276,7 @@ const $e = function(e, t, n, o, i) {
2256
2276
  name: "createArrow",
2257
2277
  obj: t
2258
2278
  });
2259
- }, uo = function(e) {
2279
+ }, fo = function(e) {
2260
2280
  let t;
2261
2281
  if (e ? t = e : t = this.currentArrow, !t) return;
2262
2282
  ye(this);
@@ -2267,14 +2287,14 @@ const $e = function(e, t, n, o, i) {
2267
2287
  id: n
2268
2288
  }
2269
2289
  });
2270
- }, fo = function(e) {
2290
+ }, uo = function(e) {
2271
2291
  this.currentArrow = e;
2272
- const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), i = pe(this, n, t.delta1), s = pe(this, o, t.delta2);
2273
- mt(this, t, i, s);
2292
+ const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = pe(this, n, t.delta1), i = pe(this, o, t.delta2);
2293
+ mt(this, t, s, i);
2274
2294
  }, po = function() {
2275
2295
  ye(this), this.currentArrow = null;
2276
2296
  }, be = function(e, t) {
2277
- const n = document.createElementNS(H, "path");
2297
+ const n = document.createElementNS(R, "path");
2278
2298
  return A(n, {
2279
2299
  d: e,
2280
2300
  stroke: t,
@@ -2284,14 +2304,14 @@ const $e = function(e, t, n, o, i) {
2284
2304
  "stroke-linejoin": "round"
2285
2305
  }), n;
2286
2306
  }, go = function(e, t) {
2287
- const n = document.createElementNS(H, "g");
2307
+ const n = document.createElementNS(R, "g");
2288
2308
  n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
2289
2309
  const o = be(e.line.getAttribute("d"), t);
2290
2310
  n.appendChild(o);
2291
- const i = be(e.arrow1.getAttribute("d"), t);
2292
- if (n.appendChild(i), e.arrow2.getAttribute("d")) {
2293
- const s = be(e.arrow2.getAttribute("d"), t);
2294
- n.appendChild(s);
2311
+ const s = be(e.arrow1.getAttribute("d"), t);
2312
+ if (n.appendChild(s), e.arrow2.getAttribute("d")) {
2313
+ const i = be(e.arrow2.getAttribute("d"), t);
2314
+ n.appendChild(i);
2295
2315
  }
2296
2316
  e.insertBefore(n, e.firstChild);
2297
2317
  }, mo = function(e) {
@@ -2305,18 +2325,18 @@ const $e = function(e, t, n, o, i) {
2305
2325
  }, ye = function(e) {
2306
2326
  e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && mo(e.currentArrow);
2307
2327
  }, mt = function(e, t, n, o) {
2308
- const { linkController: i, P2: s, P3: l, line1: r, line2: c, nodes: a, map: d, currentArrow: h, bus: f } = e;
2328
+ const { linkController: s, P2: i, P3: l, line1: r, line2: c, nodes: a, map: d, currentArrow: h, bus: u } = e;
2309
2329
  if (!h) return;
2310
- i.style.display = "initial", s.style.display = "initial", l.style.display = "initial", a.appendChild(i), a.appendChild(s), a.appendChild(l), go(h, lo);
2311
- let { x: y, y: v } = Z(n), { ctrlX: p, ctrlY: m } = n, { ctrlX: g, ctrlY: b } = o, { x, y: L } = Z(o);
2312
- s.style.cssText = `top:${m}px;left:${p}px;`, l.style.cssText = `top:${b}px;left:${g}px;`, le(r, y, v, p, m), le(c, g, b, x, L), e.helper1 = Je.create(s), e.helper2 = Je.create(l), e.helper1.init(d, (_, C) => {
2313
- p = p + _ / e.scaleVal, m = m + C / e.scaleVal;
2314
- const E = Z({ ...n, ctrlX: p, ctrlY: m });
2315
- y = E.x, v = E.y, s.style.top = m + "px", s.style.left = p + "px", Ze(h, y, v, p, m, g, b, x, L, t), le(r, y, v, p, m), t.delta1.x = p - n.cx, t.delta1.y = m - n.cy, f.fire("updateArrowDelta", t);
2316
- }), e.helper2.init(d, (_, C) => {
2317
- g = g + _ / e.scaleVal, b = b + C / e.scaleVal;
2318
- const E = Z({ ...o, ctrlX: g, ctrlY: b });
2319
- x = E.x, L = E.y, l.style.top = b + "px", l.style.left = g + "px", Ze(h, y, v, p, m, g, b, x, L, t), le(c, g, b, x, L), t.delta2.x = g - o.cx, t.delta2.y = b - o.cy, f.fire("updateArrowDelta", t);
2330
+ s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), go(h, lo);
2331
+ let { x: y, y: v } = Z(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: b } = o, { x, y: L } = Z(o);
2332
+ i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${b}px;left:${m}px;`, le(r, y, v, p, g), le(c, m, b, x, L), e.helper1 = Ze.create(i), e.helper2 = Ze.create(l), e.helper1.init(d, (T, E) => {
2333
+ p = p + T / e.scaleVal, g = g + E / e.scaleVal;
2334
+ const C = Z({ ...n, ctrlX: p, ctrlY: g });
2335
+ y = C.x, v = C.y, i.style.top = g + "px", i.style.left = p + "px", Qe(h, y, v, p, g, m, b, x, L, t), le(r, y, v, p, g), t.delta1.x = p - n.cx, t.delta1.y = g - n.cy, u.fire("updateArrowDelta", t);
2336
+ }), e.helper2.init(d, (T, E) => {
2337
+ m = m + T / e.scaleVal, b = b + E / e.scaleVal;
2338
+ const C = Z({ ...o, ctrlX: m, ctrlY: b });
2339
+ x = C.x, L = C.y, l.style.top = b + "px", l.style.left = m + "px", Qe(h, y, v, p, g, m, b, x, L, t), le(c, m, b, x, L), t.delta2.x = m - o.cx, t.delta2.y = b - o.cy, u.fire("updateArrowDelta", t);
2320
2340
  });
2321
2341
  };
2322
2342
  function vo() {
@@ -2341,12 +2361,12 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2341
2361
  createArrow: ao,
2342
2362
  createArrowFrom: ho,
2343
2363
  editArrowLabel: bo,
2344
- removeArrow: uo,
2364
+ removeArrow: fo,
2345
2365
  renderArrow: vo,
2346
- selectArrow: fo,
2366
+ selectArrow: uo,
2347
2367
  tidyArrow: wo,
2348
2368
  unselectArrow: po
2349
- }, Symbol.toStringTag, { value: "Module" })), Eo = function(e) {
2369
+ }, Symbol.toStringTag, { value: "Module" })), Co = function(e) {
2350
2370
  if (e.length === 0) throw new Error("No selected node.");
2351
2371
  if (e.length === 1) {
2352
2372
  const c = e[0].nodeObj, a = e[0].nodeObj.parent;
@@ -2376,18 +2396,18 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2376
2396
  break e;
2377
2397
  }
2378
2398
  if (!o) throw new Error("Can not select root node.");
2379
- const i = n.map((c) => c[o - 1].index).sort(), s = i[0] || 0, l = i[i.length - 1] || 0, r = n[0][o - 1].node;
2399
+ const s = n.map((c) => c[o - 1].index).sort(), i = s[0] || 0, l = s[s.length - 1] || 0, r = n[0][o - 1].node;
2380
2400
  if (!r.parent) throw new Error("Please select nodes in the same main topic.");
2381
2401
  return {
2382
2402
  parent: r.id,
2383
- start: s,
2403
+ start: i,
2384
2404
  end: l
2385
2405
  };
2386
- }, Co = function(e) {
2387
- const t = document.createElementNS(H, "g");
2406
+ }, Eo = function(e) {
2407
+ const t = document.createElementNS(R, "g");
2388
2408
  return t.setAttribute("id", e), t;
2389
- }, Qe = function(e, t) {
2390
- const n = document.createElementNS(H, "path");
2409
+ }, et = function(e, t) {
2410
+ const n = document.createElementNS(R, "path");
2391
2411
  return A(n, {
2392
2412
  d: e,
2393
2413
  stroke: t || "#666",
@@ -2396,34 +2416,34 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2396
2416
  "stroke-width": "2"
2397
2417
  }), n;
2398
2418
  }, So = (e) => e.parentElement.parentElement, No = function(e, { parent: t, start: n }) {
2399
- const o = e.findEle(t), i = o.nodeObj;
2400
- let s;
2401
- return i.parent ? s = o.closest("me-main").className : s = e.findEle(i.children[n].id).closest("me-main").className, s;
2402
- }, Oe = function(e, t) {
2403
- const { id: n, label: o, parent: i, start: s, end: l, style: r } = t, { nodes: c, theme: a, summarySvg: d } = e, f = e.findEle(i).nodeObj, y = No(e, t);
2404
- let v = 1 / 0, p = 0, m = 0, g = 0;
2405
- for (let u = s; u <= l; u++) {
2406
- const w = f.children?.[u];
2419
+ const o = e.findEle(t), s = o.nodeObj;
2420
+ let i;
2421
+ return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
2422
+ }, je = function(e, t) {
2423
+ const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, y = No(e, t);
2424
+ let v = 1 / 0, p = 0, g = 0, m = 0;
2425
+ for (let f = i; f <= l; f++) {
2426
+ const w = u.children?.[f];
2407
2427
  if (!w)
2408
2428
  return e.removeSummary(n), null;
2409
- const k = So(e.findEle(w.id)), { offsetLeft: O, offsetTop: Y } = F(c, k), M = s === l ? 10 : 20;
2410
- u === s && (m = Y + M), u === l && (g = Y + k.offsetHeight - M), O < v && (v = O), k.offsetWidth + O > p && (p = k.offsetWidth + O);
2429
+ const k = So(e.findEle(w.id)), { offsetLeft: $, offsetTop: Y } = H(c, k), M = i === l ? 10 : 20;
2430
+ f === i && (g = Y + M), f === l && (m = Y + k.offsetHeight - M), $ < v && (v = $), k.offsetWidth + $ > p && (p = k.offsetWidth + $);
2411
2431
  }
2412
2432
  let b, x;
2413
- const L = f.parent ? 10 : 0, _ = m + L, C = g + L, E = (_ + C) / 2, S = r?.stroke || a.cssVar["--color"], N = r?.labelColor || a.cssVar["--color"], D = "s-" + n, T = e.markdown ? e.markdown(o, t) : o;
2414
- y === I.LHS ? (b = Qe(`M ${v + 10} ${_} c -5 0 -10 5 -10 10 L ${v} ${C - 10} c 0 5 5 10 10 10 M ${v} ${E} h -10`, S), x = Ee(T, v - 20, E, { anchor: "end", color: N, dataType: "summary", svgId: D })) : (b = Qe(`M ${p - 10} ${_} c 5 0 10 5 10 10 L ${p} ${C - 10} c 0 5 -5 10 -10 10 M ${p} ${E} h 10`, S), x = Ee(T, p + 20, E, { anchor: "start", color: N, dataType: "summary", svgId: D }));
2415
- const R = Co(D);
2416
- return R.appendChild(b), e.labelContainer.appendChild(x), me(x), R.summaryObj = t, R.labelEl = x, d.appendChild(R), R;
2433
+ const L = u.parent ? 10 : 0, T = g + L, E = m + L, C = (T + E) / 2, S = r?.stroke || a.cssVar["--color"], N = r?.labelColor || a.cssVar["--color"], D = "s-" + n, _ = e.markdown ? e.markdown(o, t) : o;
2434
+ y === B.LHS ? (b = et(`M ${v + 10} ${T} c -5 0 -10 5 -10 10 L ${v} ${E - 10} c 0 5 5 10 10 10 M ${v} ${C} h -10`, S), x = Ce(_, v - 20, C, { anchor: "end", color: N, dataType: "summary", svgId: D })) : (b = et(`M ${p - 10} ${T} c 5 0 10 5 10 10 L ${p} ${E - 10} c 0 5 -5 10 -10 10 M ${p} ${C} h 10`, S), x = Ce(_, p + 20, C, { anchor: "start", color: N, dataType: "summary", svgId: D }));
2435
+ const F = Eo(D);
2436
+ return F.appendChild(b), e.labelContainer.appendChild(x), me(x), F.summaryObj = t, F.labelEl = x, d.appendChild(F), F;
2417
2437
  }, ko = function(e = {}) {
2418
2438
  if (!this.currentNodes) return;
2419
- const { currentNodes: t, summaries: n, bus: o } = this, { parent: i, start: s, end: l } = Eo(t), r = { id: q(), parent: i, start: s, end: l, label: "summary", style: e.style }, c = Oe(this, r);
2439
+ const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = Co(t), r = { id: q(), parent: s, start: i, end: l, label: "summary", style: e.style }, c = je(this, r);
2420
2440
  n.push(r), this.editSummary(c), o.fire("operation", {
2421
2441
  name: "createSummary",
2422
2442
  obj: r
2423
2443
  });
2424
2444
  }, To = function(e) {
2425
2445
  const t = q(), n = { ...e, id: t };
2426
- Oe(this, n), this.summaries.push(n), this.bus.fire("operation", {
2446
+ je(this, n), this.summaries.push(n), this.bus.fire("operation", {
2427
2447
  name: "createSummary",
2428
2448
  obj: n
2429
2449
  });
@@ -2441,7 +2461,7 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2441
2461
  }, Mo = function() {
2442
2462
  this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
2443
2463
  try {
2444
- Oe(this, e);
2464
+ je(this, e);
2445
2465
  } catch {
2446
2466
  }
2447
2467
  }), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
@@ -2456,41 +2476,41 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2456
2476
  renderSummary: Mo,
2457
2477
  selectSummary: Lo,
2458
2478
  unselectSummary: Ao
2459
- }, Symbol.toStringTag, { value: "Module" })), $ = "http://www.w3.org/2000/svg";
2460
- function $o(e, t) {
2461
- const n = document.createElementNS($, "svg");
2479
+ }, Symbol.toStringTag, { value: "Module" })), O = "http://www.w3.org/2000/svg";
2480
+ function Oo(e, t) {
2481
+ const n = document.createElementNS(O, "svg");
2462
2482
  return A(n, {
2463
2483
  version: "1.1",
2464
- xmlns: $,
2484
+ xmlns: O,
2465
2485
  height: e,
2466
2486
  width: t
2467
2487
  }), n;
2468
2488
  }
2469
- function Oo(e, t) {
2489
+ function $o(e, t) {
2470
2490
  return (parseInt(e) - parseInt(t)) / 2;
2471
2491
  }
2472
2492
  function jo(e, t, n, o) {
2473
- const i = document.createElementNS($, "g");
2474
- let s = "";
2475
- return e.text ? s = e.text.textContent : s = e.childNodes[0].textContent, s.split(`
2493
+ const s = document.createElementNS(O, "g");
2494
+ let i = "";
2495
+ return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
2476
2496
  `).forEach((r, c) => {
2477
- const a = document.createElementNS($, "text");
2497
+ const a = document.createElementNS(O, "text");
2478
2498
  A(a, {
2479
2499
  x: n + parseInt(t.paddingLeft) + "",
2480
- y: o + parseInt(t.paddingTop) + Oo(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
2500
+ y: o + parseInt(t.paddingTop) + $o(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
2481
2501
  "text-anchor": "start",
2482
2502
  "font-family": t.fontFamily,
2483
2503
  "font-size": `${t.fontSize}`,
2484
2504
  "font-weight": `${t.fontWeight}`,
2485
2505
  fill: `${t.color}`
2486
- }), a.innerHTML = r, i.appendChild(a);
2487
- }), i;
2506
+ }), a.innerHTML = r, s.appendChild(a);
2507
+ }), s;
2488
2508
  }
2489
2509
  function Ho(e, t, n, o) {
2490
- let i = "";
2491
- e.nodeObj?.dangerouslySetInnerHTML ? i = e.nodeObj.dangerouslySetInnerHTML : e.text ? i = e.text.textContent : i = e.childNodes[0].textContent;
2492
- const s = document.createElementNS($, "foreignObject");
2493
- A(s, {
2510
+ let s = "";
2511
+ e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
2512
+ const i = document.createElementNS(O, "foreignObject");
2513
+ A(i, {
2494
2514
  x: n + parseInt(t.paddingLeft) + "",
2495
2515
  y: o + parseInt(t.paddingTop) + "",
2496
2516
  width: t.width,
@@ -2500,13 +2520,13 @@ function Ho(e, t, n, o) {
2500
2520
  return A(l, {
2501
2521
  xmlns: "http://www.w3.org/1999/xhtml",
2502
2522
  style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
2503
- }), l.innerHTML = i, s.appendChild(l), s;
2523
+ }), l.innerHTML = s, i.appendChild(l), i;
2504
2524
  }
2505
- function Io(e, t) {
2506
- const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = F(e.nodes, t), s = document.createElementNS($, "rect");
2507
- return A(s, {
2525
+ function Ro(e, t) {
2526
+ const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(O, "rect");
2527
+ return A(i, {
2508
2528
  x: o + "",
2509
- y: i + "",
2529
+ y: s + "",
2510
2530
  rx: n.borderRadius,
2511
2531
  ry: n.borderRadius,
2512
2532
  width: n.width,
@@ -2514,13 +2534,13 @@ function Io(e, t) {
2514
2534
  fill: n.backgroundColor,
2515
2535
  stroke: n.borderColor,
2516
2536
  "stroke-width": n.borderWidth
2517
- }), s;
2537
+ }), i;
2518
2538
  }
2519
2539
  function ce(e, t, n = !1) {
2520
- const o = getComputedStyle(t), { offsetLeft: i, offsetTop: s } = F(e.nodes, t), l = document.createElementNS($, "rect");
2540
+ const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = H(e.nodes, t), l = document.createElementNS(O, "rect");
2521
2541
  A(l, {
2522
- x: i + "",
2523
- y: s + "",
2542
+ x: s + "",
2543
+ y: i + "",
2524
2544
  rx: o.borderRadius,
2525
2545
  ry: o.borderRadius,
2526
2546
  width: o.width,
@@ -2529,44 +2549,44 @@ function ce(e, t, n = !1) {
2529
2549
  stroke: o.borderColor,
2530
2550
  "stroke-width": o.borderWidth
2531
2551
  });
2532
- const r = document.createElementNS($, "g");
2552
+ const r = document.createElementNS(O, "g");
2533
2553
  r.appendChild(l);
2534
2554
  let c;
2535
- return n ? c = Ho(t, o, i, s) : c = jo(t, o, i, s), r.appendChild(c), r;
2555
+ return n ? c = Ho(t, o, s, i) : c = jo(t, o, s, i), r.appendChild(c), r;
2536
2556
  }
2537
2557
  function Bo(e, t) {
2538
- const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = F(e.nodes, t), s = document.createElementNS($, "a"), l = document.createElementNS($, "text");
2558
+ const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(O, "a"), l = document.createElementNS(O, "text");
2539
2559
  return A(l, {
2540
2560
  x: o + "",
2541
- y: i + parseInt(n.fontSize) + "",
2561
+ y: s + parseInt(n.fontSize) + "",
2542
2562
  "text-anchor": "start",
2543
2563
  "font-family": n.fontFamily,
2544
2564
  "font-size": `${n.fontSize}`,
2545
2565
  "font-weight": `${n.fontWeight}`,
2546
2566
  fill: `${n.color}`
2547
- }), l.innerHTML = t.textContent, s.appendChild(l), s.setAttribute("href", t.href), s;
2567
+ }), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
2548
2568
  }
2549
- function Ro(e, t) {
2550
- const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = F(e.nodes, t), s = document.createElementNS($, "image");
2551
- return A(s, {
2569
+ function Io(e, t) {
2570
+ const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(O, "image");
2571
+ return A(i, {
2552
2572
  x: o + "",
2553
- y: i + "",
2573
+ y: s + "",
2554
2574
  width: n.width + "",
2555
2575
  height: n.height + "",
2556
2576
  href: t.src
2557
- }), s;
2577
+ }), i;
2558
2578
  }
2559
2579
  const ae = 100, Fo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">', Yo = (e, t = !1) => {
2560
- const n = e.nodes, o = n.offsetHeight + ae * 2, i = n.offsetWidth + ae * 2, s = $o(o + "px", i + "px"), l = document.createElementNS($, "svg"), r = document.createElementNS($, "rect");
2580
+ const n = e.nodes, o = n.offsetHeight + ae * 2, s = n.offsetWidth + ae * 2, i = Oo(o + "px", s + "px"), l = document.createElementNS(O, "svg"), r = document.createElementNS(O, "rect");
2561
2581
  A(r, {
2562
2582
  x: "0",
2563
2583
  y: "0",
2564
- width: `${i}`,
2584
+ width: `${s}`,
2565
2585
  height: `${o}`,
2566
2586
  fill: e.theme.cssVar["--bgcolor"]
2567
- }), s.appendChild(r), n.querySelectorAll(".subLines").forEach((h) => {
2568
- const f = h.cloneNode(!0), { offsetLeft: y, offsetTop: v } = F(n, h.parentElement);
2569
- f.setAttribute("x", `${y}`), f.setAttribute("y", `${v}`), l.appendChild(f);
2587
+ }), i.appendChild(r), n.querySelectorAll(".subLines").forEach((h) => {
2588
+ const u = h.cloneNode(!0), { offsetLeft: y, offsetTop: v } = H(n, h.parentElement);
2589
+ u.setAttribute("x", `${y}`), u.setAttribute("y", `${v}`), l.appendChild(u);
2570
2590
  });
2571
2591
  const c = n.querySelector(".lines")?.cloneNode(!0);
2572
2592
  c && l.appendChild(c);
@@ -2574,7 +2594,7 @@ const ae = 100, Fo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
2574
2594
  a && l.appendChild(a);
2575
2595
  const d = n.querySelector(".summary")?.cloneNode(!0);
2576
2596
  return d && l.appendChild(d), n.querySelectorAll("me-tpc").forEach((h) => {
2577
- h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(ce(e, h, !t)) : (l.appendChild(Io(e, h)), l.appendChild(ce(e, h.text, !t)));
2597
+ h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(ce(e, h, !t)) : (l.appendChild(Ro(e, h)), l.appendChild(ce(e, h.text, !t)));
2578
2598
  }), n.querySelectorAll(".tags > span").forEach((h) => {
2579
2599
  l.appendChild(ce(e, h));
2580
2600
  }), n.querySelectorAll(".icons > span").forEach((h) => {
@@ -2582,39 +2602,39 @@ const ae = 100, Fo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
2582
2602
  }), n.querySelectorAll(".hyper-link").forEach((h) => {
2583
2603
  l.appendChild(Bo(e, h));
2584
2604
  }), n.querySelectorAll("img").forEach((h) => {
2585
- l.appendChild(Ro(e, h));
2605
+ l.appendChild(Io(e, h));
2586
2606
  }), A(l, {
2587
2607
  x: ae + "",
2588
2608
  y: ae + "",
2589
2609
  overflow: "visible"
2590
- }), s.appendChild(l), s;
2610
+ }), i.appendChild(l), i;
2591
2611
  }, Wo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Fo + e.outerHTML);
2592
- function zo(e) {
2612
+ function Xo(e) {
2593
2613
  return new Promise((t, n) => {
2594
2614
  const o = new FileReader();
2595
- o.onload = (i) => {
2596
- t(i.target.result);
2597
- }, o.onerror = (i) => {
2598
- n(i);
2615
+ o.onload = (s) => {
2616
+ t(s.target.result);
2617
+ }, o.onerror = (s) => {
2618
+ n(s);
2599
2619
  }, o.readAsDataURL(e);
2600
2620
  });
2601
2621
  }
2602
- const Go = function(e = !1, t) {
2622
+ const zo = function(e = !1, t) {
2603
2623
  const n = Yo(this, e), o = Wo(n, t);
2604
2624
  return new Blob([o], { type: "image/svg+xml" });
2605
- }, Ko = async function(e = !1, t) {
2606
- const n = this.exportSvg(e, t), o = await zo(n);
2607
- return new Promise((i, s) => {
2625
+ }, Go = async function(e = !1, t) {
2626
+ const n = this.exportSvg(e, t), o = await Xo(n);
2627
+ return new Promise((s, i) => {
2608
2628
  const l = new Image();
2609
2629
  l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
2610
2630
  const r = document.createElement("canvas");
2611
- r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(i, "image/png", 1);
2612
- }, l.src = o, l.onerror = s;
2631
+ r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(s, "image/png", 1);
2632
+ }, l.src = o, l.onerror = i;
2613
2633
  });
2614
- }, Xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2634
+ }, Ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2615
2635
  __proto__: null,
2616
- exportPng: Ko,
2617
- exportSvg: Go
2636
+ exportPng: Go,
2637
+ exportSvg: zo
2618
2638
  }, Symbol.toStringTag, { value: "Module" }));
2619
2639
  function qo(e, t) {
2620
2640
  return async function(...n) {
@@ -2622,54 +2642,54 @@ function qo(e, t) {
2622
2642
  o && !await o.apply(this, n) || e.apply(this, n);
2623
2643
  };
2624
2644
  }
2625
- const et = Object.keys(pt), yt = {};
2626
- for (let e = 0; e < et.length; e++) {
2627
- const t = et[e];
2645
+ const tt = Object.keys(pt), yt = {};
2646
+ for (let e = 0; e < tt.length; e++) {
2647
+ const t = tt[e];
2628
2648
  yt[t] = qo(pt[t], t);
2629
2649
  }
2630
2650
  const Vo = {
2631
2651
  getObjById: he,
2632
2652
  generateNewObj: vt,
2633
- layout: Ot,
2634
- linkDiv: zt,
2653
+ layout: $t,
2654
+ linkDiv: Xt,
2635
2655
  editTopic: Yt,
2636
- createWrapper: It,
2656
+ createWrapper: Rt,
2637
2657
  createParent: Bt,
2638
- createChildren: Rt,
2658
+ createChildren: It,
2639
2659
  createTopic: Ft,
2640
- findEle: st,
2641
- changeTheme: fn,
2642
- ...so,
2660
+ findEle: it,
2661
+ changeTheme: un,
2662
+ ...io,
2643
2663
  ...yt,
2644
2664
  ...xo,
2645
2665
  ...Po,
2646
- ...Xo,
2666
+ ...Ko,
2647
2667
  init(e) {
2648
2668
  if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
2649
- e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, X(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && sn(this), this.keypress && St(this, this.keypress), this.editable && un(this), this.contextMenu && this.disposable.push(Gt(this, this.contextMenu)), this.draggable && this.disposable.push(Dt()), this.allowUndo && this.disposable.push(Xt(this)), this.layout(), this.linkDiv(), this.toCenter();
2669
+ e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, K(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && sn(this), this.keypress && St(this, this.keypress), this.editable && fn(this), this.contextMenu && this.disposable.push(zt(this, this.contextMenu)), this.draggable && this.disposable.push(Dt()), this.allowUndo && this.disposable.push(Kt(this)), this.layout(), this.linkDiv(), this.toCenter();
2650
2670
  },
2651
2671
  destroy() {
2652
2672
  this.disposable.forEach((e) => e()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
2653
2673
  }
2654
2674
  };
2655
- function Uo({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: l, cH: r, direction: c, containerHeight: a }) {
2675
+ function Uo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, containerHeight: a }) {
2656
2676
  let d = t + n / 2;
2657
2677
  const h = e + o / 2;
2658
- let f;
2659
- c === I.LHS ? f = s + l : f = s;
2660
- const y = i + r / 2, p = (1 - Math.abs(y - h) / a) * 0.25 * (n / 2);
2661
- return c === I.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${y} ${f} ${y}`;
2678
+ let u;
2679
+ c === B.LHS ? u = i + l : u = i;
2680
+ const y = s + r / 2, p = (1 - Math.abs(y - h) / a) * 0.25 * (n / 2);
2681
+ return c === B.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${y} ${u} ${y}`;
2662
2682
  }
2663
- function Jo({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: l, cH: r, direction: c, isFirst: a }) {
2683
+ function Jo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, isFirst: a }) {
2664
2684
  const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
2665
- let h = 0, f = 0;
2685
+ let h = 0, u = 0;
2666
2686
  a ? h = e + o / 2 : h = e + o;
2667
- const y = i + r;
2668
- let v = 0, p = 0, m = 0;
2669
- const g = Math.abs(h - y) / 300 * d;
2670
- return c === I.LHS ? (m = t, v = m + d, p = m - d, f = s + d, `M ${v} ${h} C ${m} ${h} ${m + g} ${y} ${p} ${y} H ${f}`) : (m = t + n, v = m - d, p = m + d, f = s + l - d, `M ${v} ${h} C ${m} ${h} ${m - g} ${y} ${p} ${y} H ${f}`);
2687
+ const y = s + r;
2688
+ let v = 0, p = 0, g = 0;
2689
+ const m = Math.abs(h - y) / 300 * d;
2690
+ return c === B.LHS ? (g = t, v = g + d, p = g - d, u = i + d, `M ${v} ${h} C ${g} ${h} ${g + m} ${y} ${p} ${y} H ${u}`) : (g = t + n, v = g - d, p = g + d, u = i + l - d, `M ${v} ${h} C ${g} ${h} ${g - m} ${y} ${p} ${y} H ${u}`);
2671
2691
  }
2672
- const Zo = "5.5.0";
2692
+ const Zo = "5.6.0";
2673
2693
  function Qo(e) {
2674
2694
  return {
2675
2695
  x: 0,
@@ -2686,56 +2706,56 @@ function Qo(e) {
2686
2706
  };
2687
2707
  }
2688
2708
  const U = document;
2689
- function B({
2709
+ function I({
2690
2710
  el: e,
2691
2711
  direction: t,
2692
2712
  locale: n,
2693
2713
  draggable: o,
2694
- editable: i,
2695
- contextMenu: s,
2714
+ editable: s,
2715
+ contextMenu: i,
2696
2716
  toolBar: l,
2697
2717
  keypress: r,
2698
2718
  mouseSelectionButton: c,
2699
2719
  selectionContainer: a,
2700
2720
  before: d,
2701
2721
  newTopicName: h,
2702
- allowUndo: f,
2722
+ allowUndo: u,
2703
2723
  generateMainBranch: y,
2704
2724
  generateSubBranch: v,
2705
2725
  overflowHidden: p,
2706
- theme: m,
2707
- alignment: g,
2726
+ theme: g,
2727
+ alignment: m,
2708
2728
  scaleSensitivity: b,
2709
2729
  scaleMax: x,
2710
2730
  scaleMin: L,
2711
- handleWheel: _,
2712
- markdown: C,
2713
- imageProxy: E
2731
+ handleWheel: T,
2732
+ markdown: E,
2733
+ imageProxy: C
2714
2734
  }) {
2715
2735
  let S = null;
2716
2736
  const N = Object.prototype.toString.call(e);
2717
2737
  if (N === "[object HTMLDivElement]" ? S = e : N === "[object String]" && (S = document.querySelector(e)), !S) throw new Error("MindElixir: el is not a valid element");
2718
- S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = d || {}, this.locale = n || "en", this.newTopicName = h || "New Node", this.contextMenu = s ?? !0, this.toolBar = l ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = i ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = x ?? 1.4, this.scaleMin = L ?? 0.2, this.generateMainBranch = y || Uo, this.generateSubBranch = v || Jo, this.overflowHidden = p ?? !1, this.alignment = g ?? "root", this.handleWheel = _ ?? !0, this.markdown = C || void 0, this.imageProxy = E || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Qo(this), this.bus = $t(), this.container = U.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
2738
+ S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = d || {}, this.locale = n || "en", this.newTopicName = h || "New Node", this.contextMenu = i ?? !0, this.toolBar = l ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = u ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = x ?? 1.4, this.scaleMin = L ?? 0.2, this.generateMainBranch = y || Uo, this.generateSubBranch = v || Jo, this.overflowHidden = p ?? !1, this.alignment = m ?? "root", this.handleWheel = T ?? !0, this.markdown = E || void 0, this.imageProxy = C || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Qo(this), this.bus = Ot(), this.container = U.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
2719
2739
  const D = window.matchMedia("(prefers-color-scheme: dark)");
2720
- this.theme = m || (D.matches ? Ne : Se);
2721
- const T = U.createElement("div");
2722
- T.className = "map-canvas", this.map = T, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = U.createElement("me-nodes"), this.lines = oe("lines"), this.summarySvg = oe("summary"), this.linkController = oe("linkcontroller"), this.P2 = U.createElement("div"), this.P3 = U.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Fe(), this.line2 = Fe(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = oe("topiclinks"), this.labelContainer = U.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Pt(this));
2740
+ this.theme = g || (D.matches ? Ne : Se);
2741
+ const _ = U.createElement("div");
2742
+ _.className = "map-canvas", this.map = _, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = U.createElement("me-nodes"), this.lines = oe("lines"), this.summarySvg = oe("summary"), this.linkController = oe("linkcontroller"), this.P2 = U.createElement("div"), this.P3 = U.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Ye(), this.line2 = Ye(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = oe("topiclinks"), this.labelContainer = U.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Pt(this));
2723
2743
  }
2724
- B.prototype = Vo;
2725
- Object.defineProperty(B.prototype, "currentNode", {
2744
+ I.prototype = Vo;
2745
+ Object.defineProperty(I.prototype, "currentNode", {
2726
2746
  get() {
2727
2747
  return this.currentNodes[this.currentNodes.length - 1];
2728
2748
  },
2729
2749
  enumerable: !0
2730
2750
  });
2731
- B.LEFT = 0;
2732
- B.RIGHT = 1;
2733
- B.SIDE = 2;
2734
- B.THEME = Se;
2735
- B.DARK_THEME = Ne;
2736
- B.version = Zo;
2737
- B.E = st;
2738
- B.new = (e) => ({
2751
+ I.LEFT = 0;
2752
+ I.RIGHT = 1;
2753
+ I.SIDE = 2;
2754
+ I.THEME = Se;
2755
+ I.DARK_THEME = Ne;
2756
+ I.version = Zo;
2757
+ I.E = it;
2758
+ I.new = (e) => ({
2739
2759
  nodeData: {
2740
2760
  id: q(),
2741
2761
  topic: e || "new topic",
@@ -2743,5 +2763,5 @@ B.new = (e) => ({
2743
2763
  }
2744
2764
  });
2745
2765
  export {
2746
- B as default
2766
+ I as default
2747
2767
  };