mind-elixir 5.11.0 → 5.11.1-beta.1

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.
@@ -1,4 +1,4 @@
1
- const Wn = 0, Rn = 1, Xn = 2, rt = {
1
+ const Bn = 0, Wn = 1, Yn = 2, tt = {
2
2
  name: "Latte",
3
3
  type: "light",
4
4
  palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
@@ -25,7 +25,7 @@ const Wn = 0, Rn = 1, Xn = 2, rt = {
25
25
  "--panel-border-color": "#eaeaea",
26
26
  "--map-padding": "50px 80px"
27
27
  }
28
- }, ct = {
28
+ }, et = {
29
29
  name: "Dark",
30
30
  type: "dark",
31
31
  palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
@@ -53,59 +53,59 @@ const Wn = 0, Rn = 1, Xn = 2, rt = {
53
53
  "--map-padding": "50px 80px"
54
54
  }
55
55
  };
56
- function $t(t) {
56
+ function Nt(t) {
57
57
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
58
58
  }
59
- const J = function(t, e) {
59
+ const G = function(t, e) {
60
60
  if (e.id === t)
61
61
  return e;
62
62
  if (e.children && e.children.length) {
63
63
  for (let n = 0; n < e.children.length; n++) {
64
- const o = J(t, e.children[n]);
64
+ const o = G(t, e.children[n]);
65
65
  if (o) return o;
66
66
  }
67
67
  return null;
68
68
  } else
69
69
  return null;
70
- }, lt = (t, e) => {
70
+ }, nt = (t, e) => {
71
71
  if (t.parent = e, t.children)
72
72
  for (let n = 0; n < t.children.length; n++)
73
- lt(t.children[n], t);
74
- }, bt = (t, e, n) => {
73
+ nt(t.children[n], t);
74
+ }, wt = (t, e, n) => {
75
75
  t.expanded = e, t.children && t.children.forEach((o) => {
76
- bt(o, e);
76
+ wt(o, e);
77
77
  });
78
78
  };
79
- function Z(t, e, n, o) {
80
- const s = n - t, i = o - e, c = Math.atan2(i, s) * 180 / Math.PI, d = 12, a = 30, h = (c + 180 - a) * Math.PI / 180, f = (c + 180 + a) * Math.PI / 180;
79
+ function _(t, e, n, o) {
80
+ const s = n - t, i = o - e, c = Math.atan2(i, s) * 180 / Math.PI, l = 12, a = 30, d = (c + 180 - a) * Math.PI / 180, f = (c + 180 + a) * Math.PI / 180;
81
81
  return {
82
- x1: n + Math.cos(h) * d,
83
- y1: o + Math.sin(h) * d,
84
- x2: n + Math.cos(f) * d,
85
- y2: o + Math.sin(f) * d
82
+ x1: n + Math.cos(d) * l,
83
+ y1: o + Math.sin(d) * l,
84
+ x2: n + Math.cos(f) * l,
85
+ y2: o + Math.sin(f) * l
86
86
  };
87
87
  }
88
- function _() {
88
+ function Y() {
89
89
  return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
90
90
  }
91
- const Ht = function() {
92
- const t = _();
91
+ const At = function() {
92
+ const t = Y();
93
93
  return {
94
94
  topic: this.newTopicName,
95
95
  id: t
96
96
  };
97
- }, H = (t, e) => {
97
+ }, M = (t, e) => {
98
98
  let n = 0, o = 0;
99
99
  for (; e && e !== t; )
100
100
  n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
101
101
  return { offsetLeft: n, offsetTop: o };
102
- }, M = (t, e) => {
102
+ }, D = (t, e) => {
103
103
  for (const n in e)
104
104
  t.setAttribute(n, e[n]);
105
- }, q = (t) => t ? t.tagName === "ME-TPC" : !1, at = (t) => {
105
+ }, J = (t) => t ? t.tagName === "ME-TPC" : !1, ot = (t) => {
106
106
  const e = /translate3d\(([^,]+),\s*([^,]+)/, n = t.match(e);
107
107
  return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
108
- }, xt = function(t) {
108
+ }, vt = function(t) {
109
109
  for (let e = 0; e < t.length; e++) {
110
110
  const { dom: n, evt: o, func: s } = t[e];
111
111
  n.addEventListener(o, s);
@@ -116,31 +116,31 @@ const Ht = function() {
116
116
  o.removeEventListener(s, i);
117
117
  }
118
118
  };
119
- }, ut = (t, e) => {
119
+ }, ht = (t, e) => {
120
120
  const n = t.x - e.x, o = t.y - e.y;
121
121
  return Math.sqrt(n * n + o * o);
122
- }, It = function(t, e) {
122
+ }, $t = function(t, e) {
123
123
  if (!e)
124
- return tt(t), t;
124
+ return j(t), t;
125
125
  let n = t.querySelector(".insert-preview");
126
126
  const o = `insert-preview ${e} show`;
127
127
  return n || (n = document.createElement("div"), t.appendChild(n)), n.className = o, t;
128
- }, tt = function(t) {
128
+ }, j = function(t) {
129
129
  if (!t) return;
130
130
  const e = t.querySelectorAll(".insert-preview");
131
131
  for (const n of e || [])
132
132
  n.remove();
133
- }, pt = function(t, e) {
133
+ }, dt = function(t, e) {
134
134
  for (const n of e) {
135
135
  const o = n.parentElement.parentElement.contains(t);
136
136
  if (!(t && t.tagName === "ME-TPC" && t !== n && !o && t.nodeObj.parent)) return !1;
137
137
  }
138
138
  return !0;
139
- }, Ot = function(t) {
139
+ }, Ht = function(t) {
140
140
  const e = document.createElement("div");
141
141
  return e.className = "mind-elixir-ghost", t.container.appendChild(e), e;
142
142
  };
143
- class Yt {
143
+ class It {
144
144
  mind;
145
145
  isMoving = !1;
146
146
  interval = null;
@@ -157,28 +157,34 @@ class Yt {
157
157
  this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
158
158
  }
159
159
  }
160
- function Bt(t) {
160
+ function Ot(t) {
161
161
  return {
162
162
  isDragging: !1,
163
163
  insertType: null,
164
164
  meet: null,
165
- ghost: Ot(t),
166
- edgeMoveController: new Yt(t),
165
+ ghost: Ht(t),
166
+ edgeMoveController: new It(t),
167
167
  startX: 0,
168
168
  startY: 0,
169
169
  pointerId: null
170
170
  };
171
171
  }
172
- const Wt = 5;
173
- function gt(t, e, n, o = !1) {
172
+ const Bt = 5;
173
+ function ft(t, e, n, o = !1) {
174
174
  if (t.spacePressed) return !1;
175
175
  const s = n.target;
176
- return s?.tagName !== "ME-TPC" || !s.nodeObj.parent ? !1 : (e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.dragged = t.currentNodes, o && Et(t, e), !0);
176
+ if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
177
+ if (e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.dragged = t.currentNodes, o) {
178
+ xt(t, e);
179
+ const i = t.container.getBoundingClientRect();
180
+ bt(e.ghost, n.clientX - i.x, n.clientY - i.y);
181
+ }
182
+ return !0;
177
183
  }
178
- function Ct(t, e, n) {
184
+ function bt(t, e, n) {
179
185
  t.style.transform = `translate(${e - 10}px, ${n - 10}px)`, t.style.display = "block";
180
186
  }
181
- function Et(t, e) {
187
+ function xt(t, e) {
182
188
  const { dragged: n } = t;
183
189
  if (!n) return;
184
190
  const o = document.activeElement;
@@ -187,54 +193,54 @@ function Et(t, e) {
187
193
  s.parentElement.parentElement.style.opacity = "0.5";
188
194
  t.panHelper.clear();
189
195
  }
190
- function Rt(t, e, n) {
196
+ function Wt(t, e, n) {
191
197
  const { dragged: o } = t;
192
198
  if (!o || e.pointerId !== n.pointerId) return;
193
199
  const s = n.clientX - e.startX, i = n.clientY - e.startY, r = Math.sqrt(s * s + i * i);
194
- if (!e.isDragging && r > Wt && Et(t, e), !e.isDragging) return;
200
+ if (!e.isDragging && r > Bt && xt(t, e), !e.isDragging) return;
195
201
  const c = t.container.getBoundingClientRect();
196
- Ct(e.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? e.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? e.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? e.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? e.edgeMoveController.move(0, -1) : e.edgeMoveController.stop(), tt(e.meet);
197
- const d = 12 * t.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - d);
198
- if (pt(a, o)) {
202
+ bt(e.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? e.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? e.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? e.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? e.edgeMoveController.move(0, -1) : e.edgeMoveController.stop(), j(e.meet);
203
+ const l = 12 * t.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - l);
204
+ if (dt(a, o)) {
199
205
  e.meet = a;
200
- const h = a.getBoundingClientRect(), f = h.y;
201
- n.clientY > f + h.height ? e.insertType = "after" : e.insertType = "in";
206
+ const d = a.getBoundingClientRect(), f = d.y;
207
+ n.clientY > f + d.height ? e.insertType = "after" : e.insertType = "in";
202
208
  } else {
203
- const h = document.elementFromPoint(n.clientX, n.clientY + d);
204
- if (pt(h, o)) {
205
- e.meet = h;
206
- const p = h.getBoundingClientRect().y;
209
+ const d = document.elementFromPoint(n.clientX, n.clientY + l);
210
+ if (dt(d, o)) {
211
+ e.meet = d;
212
+ const p = d.getBoundingClientRect().y;
207
213
  n.clientY < p ? e.insertType = "before" : e.insertType = "in";
208
214
  } else
209
215
  e.insertType = null, e.meet = null;
210
216
  }
211
- e.meet && It(e.meet, e.insertType);
217
+ e.meet && $t(e.meet, e.insertType);
212
218
  }
213
- function Xt(t, e, n) {
219
+ function Yt(t, e, n) {
214
220
  const { dragged: o } = t;
215
221
  if (!(!o || e.pointerId !== n.pointerId)) {
216
222
  e.edgeMoveController.stop();
217
223
  for (const s of o)
218
224
  s.parentElement.parentElement.style.opacity = "1";
219
- e.ghost.style.display = "none", e.ghost.innerHTML = "", e.isDragging && e.meet && (tt(e.meet), e.insertType === "before" ? t.moveNodeBefore(o, e.meet) : e.insertType === "after" ? t.moveNodeAfter(o, e.meet) : e.insertType === "in" && t.moveNodeIn(o, e.meet)), t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
225
+ e.ghost.style.display = "none", e.ghost.innerHTML = "", e.isDragging && e.meet && (j(e.meet), e.insertType === "before" ? t.moveNodeBefore(o, e.meet) : e.insertType === "after" ? t.moveNodeAfter(o, e.meet) : e.insertType === "in" && t.moveNodeIn(o, e.meet)), t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
220
226
  }
221
227
  }
222
- function ot(t, e) {
228
+ function ut(t, e) {
223
229
  const { dragged: n } = t;
224
230
  if (n) {
225
231
  e.edgeMoveController.stop();
226
232
  for (const o of n)
227
233
  o.parentElement.parentElement.style.opacity = "1";
228
- e.meet && tt(e.meet), e.ghost.style.display = "none", e.ghost.innerHTML = "", t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
234
+ e.meet && j(e.meet), e.ghost.style.display = "none", e.ghost.innerHTML = "", t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
229
235
  }
230
236
  }
231
- const G = {
237
+ const I = {
232
238
  LHS: "lhs",
233
239
  RHS: "rhs"
234
- }, Gt = function() {
240
+ }, Rt = function() {
235
241
  this.nodes.innerHTML = "";
236
242
  const t = this.createTopic(this.nodeData);
237
- Tt.call(this, t, this.nodeData), t.draggable = !1;
243
+ St.call(this, t, this.nodeData), t.draggable = !1;
238
244
  const e = document.createElement("me-root");
239
245
  e.appendChild(t);
240
246
  const n = this.nodeData.children || [];
@@ -244,29 +250,29 @@ const G = {
244
250
  i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
245
251
  });
246
252
  }
247
- Vt(this, n, e);
248
- }, Vt = function(t, e, n) {
253
+ Xt(this, n, e);
254
+ }, Xt = function(t, e, n) {
249
255
  const o = document.createElement("me-main");
250
- o.className = G.LHS;
256
+ o.className = I.LHS;
251
257
  const s = document.createElement("me-main");
252
- s.className = G.RHS;
258
+ s.className = I.RHS;
253
259
  for (let i = 0; i < e.length; i++) {
254
260
  const r = e[i], { grp: c } = t.createWrapper(r);
255
261
  t.direction === 2 ? r.direction === 0 ? o.appendChild(c) : s.appendChild(c) : t.direction === 0 ? o.appendChild(c) : s.appendChild(c);
256
262
  }
257
263
  t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(s), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
258
- }, zt = function(t, e) {
264
+ }, Vt = function(t, e) {
259
265
  const n = document.createElement("me-children");
260
266
  for (let o = 0; o < e.length; o++) {
261
267
  const s = e[o], { grp: i } = t.createWrapper(s);
262
268
  n.appendChild(i);
263
269
  }
264
270
  return n;
265
- }, St = function(t, e) {
271
+ }, Ct = function(t, e) {
266
272
  const o = (this?.el ? this.el : e || document).querySelector(`[data-nodeid="me${t}"]`);
267
273
  if (!o) throw new Error(`FindEle: Node ${t} not found, maybe it's collapsed.`);
268
274
  return o;
269
- }, Tt = function(t, e) {
275
+ }, St = function(t, e) {
270
276
  if (t.innerHTML = "", e.style) {
271
277
  const n = e.style;
272
278
  for (const o in n)
@@ -293,7 +299,7 @@ const G = {
293
299
  } else t.link && (t.link = void 0);
294
300
  if (e.icons && e.icons.length) {
295
301
  const n = document.createElement("span");
296
- n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${$t(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
302
+ n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${Nt(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
297
303
  } else t.icons && (t.icons = void 0);
298
304
  if (e.tags && e.tags.length) {
299
305
  const n = document.createElement("div");
@@ -302,35 +308,35 @@ const G = {
302
308
  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);
303
309
  }), t.appendChild(n), t.tags = n;
304
310
  } else t.tags && (t.tags = void 0);
305
- }, Ft = function(t, e) {
311
+ }, zt = function(t, e) {
306
312
  const n = document.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
307
313
  if (n.appendChild(o), !e && t.children && t.children.length > 0) {
308
- const i = Kt(t.expanded);
314
+ const i = jt(t.expanded);
309
315
  if (o.appendChild(i), t.expanded !== !1) {
310
- const r = zt(this, t.children);
316
+ const r = Vt(this, t.children);
311
317
  n.appendChild(r);
312
318
  }
313
319
  }
314
320
  return { grp: n, top: o, tpc: s };
315
- }, _t = function(t) {
321
+ }, Ft = function(t) {
316
322
  const e = document.createElement("me-parent"), n = this.createTopic(t);
317
- return Tt.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
318
- }, qt = function(t) {
323
+ return St.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
324
+ }, Gt = function(t) {
319
325
  const e = document.createElement("me-children");
320
326
  return e.append(...t), e;
321
- }, jt = function(t) {
327
+ }, _t = function(t) {
322
328
  const e = document.createElement("me-tpc");
323
329
  return e.nodeObj = t, e.dataset.nodeid = "me" + t.id, e;
324
330
  };
325
- function Lt(t) {
331
+ function Et(t) {
326
332
  const e = document.createRange();
327
333
  e.selectNodeContents(t);
328
334
  const n = window.getSelection();
329
335
  n && (n.removeAllRanges(), n.addRange(e));
330
336
  }
331
- const Ut = function(t) {
337
+ const qt = function(t) {
332
338
  if (!t) return;
333
- const e = document.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = H(this.nodes, t);
339
+ const e = document.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = M(this.nodes, t);
334
340
  this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
335
341
  const r = getComputedStyle(t);
336
342
  e.style.cssText = `
@@ -343,19 +349,19 @@ const Ut = function(t) {
343
349
  margin:${r.margin};
344
350
  background-color:${r.backgroundColor !== "rgba(0, 0, 0, 0)" && r.backgroundColor};
345
351
  border: ${r.border};
346
- border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"), Lt(e), this.bus.fire("operation", {
352
+ border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"), t.style.opacity = "0", Et(e), this.bus.fire("operation", {
347
353
  name: "beginEdit",
348
354
  obj: t.nodeObj
349
355
  }), e.addEventListener("keydown", (c) => {
350
356
  c.stopPropagation();
351
- const d = c.key;
352
- if (d === "Enter" || d === "Tab") {
357
+ const l = c.key;
358
+ if (l === "Enter" || l === "Tab") {
353
359
  if (c.shiftKey) return;
354
360
  c.preventDefault(), e.blur(), this.container.focus();
355
- } else d === "Escape" && (c.preventDefault(), e.textContent = o, e.blur(), this.container.focus());
361
+ } else l === "Escape" && (c.preventDefault(), e.textContent = o, e.blur(), this.container.focus());
356
362
  }), e.addEventListener("blur", () => {
357
363
  if (!e) return;
358
- e.remove();
364
+ t.style.opacity = "1", e.remove();
359
365
  const c = e.innerText?.trim() || "";
360
366
  c === o || c === "" || (n.topic = c, this.markdown ? t.text.innerHTML = this.markdown(n.topic, n) : t.text.textContent = c, this.linkDiv(), this.bus.fire("operation", {
361
367
  name: "finishEdit",
@@ -363,14 +369,14 @@ const Ut = function(t) {
363
369
  origin: o
364
370
  }));
365
371
  });
366
- }, Kt = function(t) {
372
+ }, jt = function(t) {
367
373
  const e = document.createElement("me-epd");
368
374
  return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
369
- }, Jt = function(t) {
375
+ }, Ut = function(t) {
370
376
  const n = t.parentElement.parentElement.lastElementChild;
371
377
  n?.tagName === "svg" && n?.remove();
372
378
  };
373
- function Zt(t) {
379
+ function Kt(t) {
374
380
  return {
375
381
  nodeData: t.isFocusMode ? t.nodeDataBackup : t.nodeData,
376
382
  arrows: t.arrows,
@@ -379,51 +385,51 @@ function Zt(t) {
379
385
  theme: t.theme
380
386
  };
381
387
  }
382
- const Qt = function(t) {
388
+ const Jt = function(t) {
383
389
  const e = this.container, n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
384
390
  if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
385
- const i = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2, d = o.top + o.height / 2, a = i - c, h = r - d;
386
- this.move(-a, -h, !0);
391
+ const i = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2, l = o.top + o.height / 2, a = i - c, d = r - l;
392
+ this.move(-a, -d, !0);
387
393
  }
388
- }, te = function(t, e, n) {
394
+ }, Zt = function(t, e, n) {
389
395
  this.clearSelection(), this.scrollIntoView(t), this.selection?.select(t), e && this.bus.fire("selectNewNode", t.nodeObj);
390
- }, ee = function(t) {
396
+ }, Qt = function(t) {
391
397
  this.selection?.select(t);
392
- }, ne = function(t) {
398
+ }, te = function(t) {
393
399
  this.selection?.deselect(t);
394
- }, oe = function() {
400
+ }, ee = function() {
395
401
  this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
396
- }, Dt = function(t) {
402
+ }, Tt = function(t) {
397
403
  return JSON.stringify(t, (e, n) => {
398
404
  if (!(e === "parent" && typeof n != "string"))
399
405
  return n;
400
406
  });
401
- }, se = function() {
402
- const t = Zt(this);
403
- return Dt(t);
404
- }, ie = function() {
407
+ }, ne = function() {
408
+ const t = Kt(this);
409
+ return Tt(t);
410
+ }, oe = function() {
405
411
  return JSON.parse(this.getDataString());
406
- }, re = function() {
412
+ }, se = function() {
407
413
  this.editable = !0;
408
- }, ce = function() {
414
+ }, ie = function() {
409
415
  this.editable = !1;
410
- }, le = function(t, e = { x: 0, y: 0 }) {
416
+ }, re = function(t, e = { x: 0, y: 0 }) {
411
417
  if (t < this.scaleMin && t < this.scaleVal || t > this.scaleMax && t > this.scaleVal) return;
412
- const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = dt(this), c = this.map.style.transform, { x: d, y: a } = at(c), h = d - i, f = a - r, p = this.scaleVal, m = (-o + h) * (1 - t / p), y = (-s + f) * (1 - t / p);
413
- this.map.style.transform = `translate3d(${d - m}px, ${a - y}px, 0) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
414
- }, ae = function() {
418
+ const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = st(this), c = this.map.style.transform, { x: l, y: a } = ot(c), d = l - i, f = a - r, p = this.scaleVal, w = (-o + d) * (1 - t / p), y = (-s + f) * (1 - t / p);
419
+ this.map.style.transform = `translate3d(${l - w}px, ${a - y}px, 0) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
420
+ }, ce = function() {
415
421
  const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
416
422
  this.scaleVal = n;
417
- const { dx: o, dy: s } = dt(this, !0);
423
+ const { dx: o, dy: s } = st(this, !0);
418
424
  this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
419
- }, de = function(t, e, n = !1) {
425
+ }, le = function(t, e, n = !1) {
420
426
  const { map: o, scaleVal: s, bus: i, container: r, nodes: c } = this;
421
427
  if (n && o.style.transition === "transform 0.3s")
422
428
  return;
423
- const d = o.style.transform;
424
- let { x: a, y: h } = at(d);
425
- const f = r.getBoundingClientRect(), p = c.getBoundingClientRect(), m = p.left < f.right && p.right > f.left, y = p.top < f.bottom && p.bottom > f.top;
426
- if (m) {
429
+ const l = o.style.transform;
430
+ let { x: a, y: d } = ot(l);
431
+ const f = r.getBoundingClientRect(), p = c.getBoundingClientRect(), w = p.left < f.right && p.right > f.left, y = p.top < f.bottom && p.bottom > f.top;
432
+ if (w) {
427
433
  const u = p.left + t, g = p.right + t;
428
434
  (u >= f.right || g <= f.left) && (t = 0);
429
435
  }
@@ -431,42 +437,42 @@ const Qt = function(t) {
431
437
  const u = p.top + e, g = p.bottom + e;
432
438
  (u >= f.bottom || g <= f.top) && (e = 0);
433
439
  }
434
- a += t, h += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
440
+ a += t, d += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
435
441
  o.style.transition = "none";
436
- }, 300)), o.style.transform = `translate3d(${a}px, ${h}px, 0) scale(${s})`, i.fire("move", { dx: t, dy: e });
437
- }, dt = (t, e = !1) => {
442
+ }, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: t, dy: e });
443
+ }, st = (t, e = !1) => {
438
444
  const { container: n, map: o, nodes: s } = t;
439
445
  let i, r;
440
446
  if (t.alignment === "nodes" || e)
441
447
  i = (n.offsetWidth - s.offsetWidth) / 2, r = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
442
448
  else {
443
- const c = o.querySelector("me-root"), d = c.offsetTop, a = c.offsetLeft, h = c.offsetWidth, f = c.offsetHeight;
444
- i = n.offsetWidth / 2 - a - h / 2, r = n.offsetHeight / 2 - d - f / 2, o.style.transformOrigin = `${a + h / 2}px 50%`;
449
+ const c = o.querySelector("me-root"), l = c.offsetTop, a = c.offsetLeft, d = c.offsetWidth, f = c.offsetHeight;
450
+ i = n.offsetWidth / 2 - a - d / 2, r = n.offsetHeight / 2 - l - f / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
445
451
  }
446
452
  return { dx: i, dy: r };
447
- }, he = function() {
448
- const { map: t, container: e } = this, { dx: n, dy: o } = dt(this);
453
+ }, ae = function() {
454
+ const { map: t, container: e } = this, { dx: n, dy: o } = st(this);
449
455
  e.scrollTop = 0, e.scrollLeft = 0, t.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
450
- }, fe = function(t) {
456
+ }, he = function(t) {
451
457
  t(this);
452
- }, ue = function(t) {
458
+ }, de = function(t) {
453
459
  t.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = t.nodeObj, this.initRight(), this.toCenter());
454
- }, pe = function() {
460
+ }, fe = function() {
455
461
  this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
456
- }, ge = function() {
462
+ }, ue = function() {
457
463
  this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
458
- }, me = function() {
464
+ }, pe = function() {
459
465
  this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
460
- }, ye = function() {
466
+ }, ge = function() {
461
467
  this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
462
- }, we = function(t, e) {
468
+ }, me = function(t, e) {
463
469
  const n = t.nodeObj;
464
470
  typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
465
471
  const o = t.getBoundingClientRect(), s = {
466
472
  x: o.left,
467
473
  y: o.top
468
474
  }, i = t.parentNode, r = i.children[1];
469
- if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", Jt(t), n.expanded) {
475
+ if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", Ut(t), n.expanded) {
470
476
  const f = this.createChildren(
471
477
  n.children.map((p) => this.createWrapper(p).grp)
472
478
  );
@@ -474,99 +480,147 @@ const Qt = function(t) {
474
480
  } else
475
481
  i.parentNode.children[1].remove();
476
482
  this.linkDiv(t.closest("me-main > me-wrapper"));
477
- const c = t.getBoundingClientRect(), d = {
483
+ const c = t.getBoundingClientRect(), l = {
478
484
  x: c.left,
479
485
  y: c.top
480
- }, a = s.x - d.x, h = s.y - d.y;
481
- this.move(a, h), this.bus.fire("expandNode", n);
482
- }, ve = function(t, e) {
486
+ }, a = s.x - l.x, d = s.y - l.y;
487
+ this.move(a, d), this.bus.fire("expandNode", n);
488
+ }, ye = function(t, e) {
483
489
  const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
484
490
  x: o.left,
485
491
  y: o.top
486
492
  };
487
- bt(n, e ?? !n.expanded), this.refresh();
493
+ wt(n, e ?? !n.expanded), this.refresh();
488
494
  const i = this.findEle(n.id).getBoundingClientRect(), r = {
489
495
  x: i.left,
490
496
  y: i.top
491
- }, c = s.x - r.x, d = s.y - r.y;
492
- this.move(c, d);
493
- }, be = function(t) {
494
- this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)), lt(this.nodeData), this.layout(), this.linkDiv();
495
- }, xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
497
+ }, c = s.x - r.x, l = s.y - r.y;
498
+ this.move(c, l);
499
+ }, we = function(t) {
500
+ this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)), nt(this.nodeData), this.layout(), this.linkDiv();
501
+ }, ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
496
502
  __proto__: null,
497
- cancelFocus: pe,
498
- clearSelection: oe,
499
- disableEdit: ce,
500
- enableEdit: re,
501
- expandNode: we,
502
- expandNodeAll: ve,
503
- focusNode: ue,
504
- getData: ie,
505
- getDataString: se,
506
- initLeft: ge,
507
- initRight: me,
508
- initSide: ye,
509
- install: fe,
510
- move: de,
511
- refresh: be,
512
- scale: le,
513
- scaleFit: ae,
514
- scrollIntoView: Qt,
515
- selectNode: te,
516
- selectNodes: ee,
517
- stringifyData: Dt,
518
- toCenter: he,
519
- unselectNodes: ne
520
- }, Symbol.toStringTag, { value: "Module" })), Ce = 40, Ee = 10, Se = ({ deltaMode: t, deltaY: e, viewportHeight: n }) => t === WheelEvent.DOM_DELTA_LINE ? e * Ce : t === WheelEvent.DOM_DELTA_PAGE ? e * n : e, Te = ({ deltaMode: t, deltaY: e, scaleSensitivity: n, viewportHeight: o }) => {
521
- const i = -Se({ deltaMode: t, deltaY: e, viewportHeight: o }) / Ee * n;
503
+ cancelFocus: fe,
504
+ clearSelection: ee,
505
+ disableEdit: ie,
506
+ enableEdit: se,
507
+ expandNode: me,
508
+ expandNodeAll: ye,
509
+ focusNode: de,
510
+ getData: oe,
511
+ getDataString: ne,
512
+ initLeft: ue,
513
+ initRight: pe,
514
+ initSide: ge,
515
+ install: he,
516
+ move: le,
517
+ refresh: we,
518
+ scale: re,
519
+ scaleFit: ce,
520
+ scrollIntoView: Jt,
521
+ selectNode: Zt,
522
+ selectNodes: Qt,
523
+ stringifyData: Tt,
524
+ toCenter: ae,
525
+ unselectNodes: te
526
+ }, Symbol.toStringTag, { value: "Module" })), be = 40, xe = 10, Ce = ({ deltaMode: t, deltaY: e, viewportHeight: n }) => t === WheelEvent.DOM_DELTA_LINE ? e * be : t === WheelEvent.DOM_DELTA_PAGE ? e * n : e, Se = ({ deltaMode: t, deltaY: e, scaleSensitivity: n, viewportHeight: o }) => {
527
+ const i = -Ce({ deltaMode: t, deltaY: e, viewportHeight: o }) / xe * n;
522
528
  return Math.max(-n, Math.min(n, i));
523
- }, Le = (t, e, n) => {
529
+ }, Ee = (t, e, n) => {
524
530
  e !== 0 && t.scale(t.scaleVal + e, n);
525
- }, De = (t, e) => {
526
- const n = Te({
531
+ }, Te = (t, e) => {
532
+ const n = Se({
527
533
  deltaMode: e.deltaMode,
528
534
  deltaY: e.deltaY,
529
535
  scaleSensitivity: t.scaleSensitivity,
530
536
  viewportHeight: t.container.clientHeight || window.innerHeight
531
537
  });
532
- Le(t, n, { x: e.clientX, y: e.clientY });
538
+ Ee(t, n, { x: e.clientX, y: e.clientY });
533
539
  };
534
- function Me(t) {
535
- const { panHelper: e } = t;
536
- let n = 0, o = null;
540
+ function De(t) {
541
+ const { panHelper: e, container: n } = t;
542
+ let o = null;
537
543
  t.spacePressed = !1;
538
- let s = null;
539
- const i = /* @__PURE__ */ new Map(), r = Bt(t);
540
- let c = null, d = null, a = null, h = null;
541
- const f = 500, p = 10, m = () => {
542
- c !== null && (clearTimeout(c), c = null, d = null, a = null, h = null);
543
- }, y = (l, w) => {
544
- l.hasPointerCapture && l.hasPointerCapture(w) && l.releasePointerCapture(w);
545
- }, u = (l, w) => {
546
- if (l.id === "input-box" || l.closest("#input-box")) return !1;
547
- const E = l.closest(".svg-label");
548
- if (E) {
549
- const D = E.dataset.svgId, V = E.dataset.type, z = document.getElementById(D);
550
- if (z) {
551
- if (V === "arrow")
552
- return w ? t.editArrowLabel(z) : t.selectArrow(z), !0;
553
- if (V === "summary")
554
- return w ? t.editSummary(z) : t.selectSummary(z), !0;
555
- }
544
+ const s = {
545
+ lastTap: 0,
546
+ lastTapTarget: null,
547
+ DOUBLE_CLICK_THRESHOLD: 300,
548
+ detect(h, m) {
549
+ const x = (/* @__PURE__ */ new Date()).getTime(), S = x - this.lastTap, E = S < this.DOUBLE_CLICK_THRESHOLD && S > 0 && this.lastTapTarget === h.target;
550
+ this.lastTap = x, this.lastTapTarget = h.target, E && m(h);
551
+ },
552
+ clear() {
553
+ this.lastTap = 0, this.lastTapTarget = null;
556
554
  }
557
- if (l.closest(".topiclinks")) {
558
- const D = l.closest("g");
559
- if (D)
560
- return w ? t.editArrowLabel(D) : t.selectArrow(D), !0;
555
+ }, i = {
556
+ Idle: 0,
557
+ Pinch: 1,
558
+ DragWait: 2,
559
+ Drag: 3,
560
+ Pan: 4,
561
+ BoxSelect: 5
562
+ };
563
+ t.ptState = i.Idle;
564
+ const r = {
565
+ lastDistance: null,
566
+ activePointers: /* @__PURE__ */ new Map(),
567
+ handlePointerDown(h) {
568
+ if (h.pointerType !== "touch") return !1;
569
+ if (this.activePointers.set(h.pointerId, { x: h.clientX, y: h.clientY }), this.activePointers.size >= 2) {
570
+ const [m, x] = Array.from(this.activePointers.values());
571
+ return this.lastDistance = ht(m, x), !0;
572
+ }
573
+ return !1;
574
+ },
575
+ handlePointerMove(h) {
576
+ if (h.pointerType !== "touch" || !this.activePointers.has(h.pointerId)) return !1;
577
+ if (this.activePointers.set(h.pointerId, { x: h.clientX, y: h.clientY }), this.activePointers.size >= 2) {
578
+ const [m, x] = Array.from(this.activePointers.values()), S = ht(m, x);
579
+ if (this.lastDistance !== null && this.lastDistance > 0) {
580
+ const E = S / this.lastDistance;
581
+ t.scale(t.scaleVal * E, {
582
+ x: (m.x + x.x) / 2,
583
+ y: (m.y + x.y) / 2
584
+ });
585
+ }
586
+ return this.lastDistance = S, !0;
587
+ }
588
+ return !1;
589
+ },
590
+ handlePointerUp(h) {
591
+ h.pointerType === "touch" && (this.activePointers.delete(h.pointerId), this.activePointers.size < 2 && (this.lastDistance = null));
592
+ },
593
+ clear() {
594
+ this.activePointers.clear(), this.lastDistance = null;
561
595
  }
562
- if (l.closest(".summary")) {
563
- const D = l.closest("g");
564
- if (D)
565
- return w ? t.editSummary(D) : t.selectSummary(D), !0;
596
+ }, c = Ot(t), l = {
597
+ timer: null,
598
+ startPos: null,
599
+ pointerId: null,
600
+ DURATION: 500,
601
+ MOVE_THRESHOLD: 10,
602
+ clear() {
603
+ this.timer !== null && (clearTimeout(this.timer), this.timer = null, this.startPos = null, this.pointerId = null);
604
+ },
605
+ start(h, m) {
606
+ this.timer = window.setTimeout(() => {
607
+ m(h), this.timer = null, this.startPos = null, this.pointerId = null;
608
+ }, this.DURATION), this.startPos = { x: h.clientX, y: h.clientY }, this.pointerId = h.pointerId;
609
+ },
610
+ handleMove(h) {
611
+ if (this.timer !== null && this.startPos !== null && h.pointerId === this.pointerId) {
612
+ const m = h.clientX - this.startPos.x, x = h.clientY - this.startPos.y;
613
+ Math.sqrt(m * m + x * x) > this.MOVE_THRESHOLD && this.clear();
614
+ }
566
615
  }
567
- return !1;
568
- }, g = (l) => {
569
- if (l.pointerType === "mouse" && l.button !== 0) return;
616
+ }, a = (h, m) => {
617
+ if (h.closest("#input-box")) return !1;
618
+ const x = h.closest(".svg-label"), S = h.closest(".topiclinks, .summary"), E = x ? { type: x.dataset.type, element: document.getElementById(x.dataset.svgId) } : S ? { type: S.classList.contains("topiclinks") ? "arrow" : "summary", element: h.closest("g") } : null;
619
+ if (!E?.type || !E?.element) return !1;
620
+ const { type: P, element: k } = E;
621
+ return t.clearSelection(), P === "arrow" ? m ? t.editArrowLabel(k) : t.selectArrow(k) : m ? t.editSummary(k) : t.selectSummary(k), !0;
622
+ }, d = (h) => {
623
+ if (h.pointerType === "mouse" && h.button !== 0) return;
570
624
  if (t.helper1?.moved) {
571
625
  t.helper1.clear();
572
626
  return;
@@ -579,125 +633,99 @@ function Me(t) {
579
633
  e.clear();
580
634
  return;
581
635
  }
582
- if (r?.isDragging)
636
+ if (c?.isDragging)
583
637
  return;
584
- const w = l.target;
585
- if (w.tagName === "ME-EPD")
586
- l.ctrlKey || l.metaKey ? t.expandNodeAll(w.previousSibling) : t.expandNode(w.previousSibling);
587
- else if (!t.editable)
588
- return;
589
- u(w, !1);
590
- }, b = (l) => {
638
+ const m = h.target;
639
+ m.tagName === "ME-EPD" && (h.ctrlKey || h.metaKey ? t.expandNodeAll(m.previousSibling) : t.expandNode(m.previousSibling));
640
+ }, f = (h) => {
591
641
  if (!t.editable) return;
592
- const w = l.target;
593
- q(w) && t.beginEdit(w), u(w, !0);
594
- }, v = (l) => {
595
- l.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
596
- }, x = (l) => {
597
- l.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
598
- }, S = (l) => {
599
- if (l.pointerType === "touch" && (i.set(l.pointerId, { x: l.clientX, y: l.clientY }), i.size === 2)) {
600
- const [D, V] = Array.from(i.values());
601
- s = ut(D, V), m();
602
- }
603
- e.moved = !1;
604
- const w = l.target, E = t.mouseSelectionButton === 0 ? 2 : 0;
605
- if (t.editable && (l.button === 0 || l.pointerType === "touch") && q(w)) {
606
- t.selection?.cancel();
607
- const D = t.currentNodes || [];
608
- if (l.ctrlKey || l.metaKey)
609
- if (D.includes(w)) {
610
- t.selection?.deselect(w);
611
- return;
612
- } else
613
- t.selection?.select(w);
614
- else D.includes(w) || t.selectNode(w);
615
- }
616
- if (t.editable && (l.button === 0 || l.pointerType === "touch")) {
617
- if (l.pointerType === "touch" && i.size > 1)
618
- (r.isDragging || r.pointerId !== null) && ot(t, r);
619
- else if (l.pointerType === "touch" && i.size === 1)
620
- (q(w) || w.closest("me-tpc")) && (d = { x: l.clientX, y: l.clientY }, a = w, h = l.pointerId, c = window.setTimeout(() => {
621
- gt(t, r, l, !0) && (a && a.setPointerCapture(l.pointerId), Ct(r.ghost, l.clientX, l.clientY)), c = null, d = null, a = null, h = null;
622
- }, f));
623
- else if (l.pointerType === "mouse" && gt(t, r, l, !1)) {
624
- w.setPointerCapture(l.pointerId);
625
- return;
626
- }
642
+ const m = h.target;
643
+ if (J(m)) {
644
+ t.selectNode(m), t.beginEdit(m);
645
+ return;
627
646
  }
628
- const N = t.spacePressed && l.button === 0 && l.pointerType === "mouse", B = !t.editable || l.button === E && l.pointerType === "mouse" || l.pointerType === "touch";
629
- !N && !B || (e.x = l.clientX, e.y = l.clientY, w.className !== "circle" && w.contentEditable !== "plaintext-only" && (e.mousedown = !0, w.setPointerCapture(l.pointerId)));
630
- }, T = (l) => {
631
- if (l.pointerType === "touch" && i.has(l.pointerId)) {
632
- if (i.set(l.pointerId, { x: l.clientX, y: l.clientY }), c !== null && d !== null && l.pointerId === h) {
633
- const w = l.clientX - d.x, E = l.clientY - d.y;
634
- Math.sqrt(w * w + E * E) > p && m();
635
- }
636
- if (i.size >= 2) {
637
- const [w, E] = Array.from(i.values()), N = ut(w, E);
638
- if (s == null)
639
- s = N;
640
- else {
641
- if (s > 0) {
642
- const B = N / s;
643
- t.scale(t.scaleVal * B, {
644
- x: (w.x + E.x) / 2,
645
- y: (w.y + E.y) / 2
646
- });
647
- }
648
- s = N;
649
- }
650
- return;
651
- }
647
+ a(m, !0);
648
+ }, p = (h) => {
649
+ if (h.pointerType === "touch" && r.handlePointerDown(h)) {
650
+ t.ptState = i.Pinch, l.clear(), e.clear(), (c.isDragging || c.pointerId !== null) && ut(t, c);
651
+ return;
652
652
  }
653
- if (!(r && r.pointerId !== null && (Rt(t, r, l), r.isDragging))) {
654
- if (l.target.contentEditable !== "plaintext-only" || t.spacePressed && e.mousedown) {
655
- const w = l.clientX - e.x, E = l.clientY - e.y;
656
- e.onMove(w, E);
657
- }
658
- e.x = l.clientX, e.y = l.clientY;
653
+ if (t.ptState === i.Pinch) return;
654
+ const m = h.target;
655
+ if (m.className === "map-container" && h.button === 0 && h.pointerType === "mouse") {
656
+ t.ptState = i.BoxSelect;
657
+ return;
659
658
  }
660
- }, L = (l) => {
661
- if (l.pointerType === "touch" && (i.delete(l.pointerId), i.size < 2 && (s = null), m()), r && r.pointerId !== null) {
662
- const E = r.isDragging;
663
- if (Xt(t, r, l), y(l.target, l.pointerId), E)
664
- return;
659
+ if (e.handlePointerDown(h), e.mousedown && (t.ptState = i.Pan), h.button === 0 || h.pointerType === "touch")
660
+ if (J(m)) {
661
+ t.selection?.cancel();
662
+ const S = t.currentNodes || [];
663
+ h.ctrlKey || h.metaKey || t.mobileMultiSelect ? S.includes(m) ? o = m : ((t.currentArrow || t.currentSummary) && t.clearSelection(), t.selection?.select(m)) : S.includes(m) || t.selectNode(m), h.pointerType === "touch" ? (t.ptState = i.DragWait, l.start(h, (P) => {
664
+ ft(t, c, P, !0) && (t.ptState = i.Drag, m.setPointerCapture(P.pointerId));
665
+ })) : ft(t, c, h, !1) && (t.ptState = i.Drag, m.setPointerCapture(h.pointerId));
666
+ } else
667
+ a(m, !1);
668
+ }, w = (h) => {
669
+ switch (t.ptState) {
670
+ case i.Pinch:
671
+ r.handlePointerMove(h);
672
+ break;
673
+ case i.DragWait:
674
+ l.handleMove(h), l.timer === null && (t.ptState = i.Idle);
675
+ break;
676
+ case i.Drag:
677
+ Wt(t, c, h);
678
+ break;
679
+ case i.Pan:
680
+ e.handlePointerMove(h);
681
+ break;
665
682
  }
666
- if (l.pointerType === "touch" && i.size === 0 && !e.moved) {
667
- const E = (/* @__PURE__ */ new Date()).getTime(), N = E - n;
668
- N < 300 && N > 0 && o === l.target && b(l), n = E, o = l.target;
683
+ }, y = (h) => {
684
+ h.pointerType === "touch" && r.handlePointerUp(h);
685
+ const m = c.isDragging, x = e.moved;
686
+ switch (t.ptState) {
687
+ case i.DragWait:
688
+ l.clear();
689
+ break;
690
+ case i.Drag:
691
+ Yt(t, c, h);
692
+ break;
693
+ case i.Pan:
694
+ e.handlePointerUp(h);
695
+ break;
669
696
  }
670
- e.mousedown && (y(l.target, l.pointerId), e.clear());
671
- }, C = () => {
672
- m(), e.mousedown && e.clear(), r && (r.isDragging || r.pointerId !== null) && ot(t, r);
673
- }, P = (l) => {
674
- l.pointerType === "touch" && (i.delete(l.pointerId), i.size < 2 && (s = null), m()), r && r.pointerId === l.pointerId && ot(t, r), L(l);
675
- }, k = (l) => {
676
- if (l.preventDefault(), l.button !== 2 || !t.editable) return;
677
- const w = l.target;
678
- q(w) && !w.classList.contains("selected") && t.selectNode(w), setTimeout(() => {
679
- t.panHelper.moved || t.bus.fire("showContextMenu", l);
697
+ s.detect(h, f), (t.ptState !== i.Pinch || r.activePointers.size < 2) && (t.ptState = i.Idle), o && (!m && !x && t.selection?.deselect(o), o = null);
698
+ }, u = () => {
699
+ r.clear(), l.clear(), e.clear(), s.clear(), (c.isDragging || c.pointerId !== null) && ut(t, c), t.ptState = i.Idle, o = null;
700
+ }, g = (h) => {
701
+ h.preventDefault(), h.button === 2 && t.editable && setTimeout(() => {
702
+ if (t.panHelper.moved) return;
703
+ const m = h.target;
704
+ J(m) && !m.classList.contains("selected") && t.selectNode(m), t.bus.fire("showContextMenu", h);
680
705
  }, 200);
681
- }, Y = (l) => {
682
- if (l.stopPropagation(), l.preventDefault(), l.ctrlKey || l.metaKey) return De(t, l);
683
- if (l.shiftKey) return t.move(-l.deltaY, 0);
684
- t.move(-l.deltaX, -l.deltaY);
685
- }, { container: A } = t;
686
- return xt([
687
- { dom: A, evt: "pointerdown", func: S },
688
- { dom: A, evt: "pointermove", func: T },
689
- { dom: A, evt: "pointerup", func: L },
690
- { dom: A, evt: "pointercancel", func: P },
691
- { dom: A, evt: "click", func: g },
692
- { dom: A, evt: "dblclick", func: b },
693
- { dom: A, evt: "contextmenu", func: k },
694
- { dom: A, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : Y },
695
- { dom: A, evt: "blur", func: C },
696
- { dom: A, evt: "keydown", func: v },
697
- { dom: A, evt: "keyup", func: x }
706
+ }, b = (h) => {
707
+ if (h.stopPropagation(), h.preventDefault(), h.ctrlKey || h.metaKey) return Te(t, h);
708
+ if (h.shiftKey) return t.move(-h.deltaY, 0);
709
+ t.move(-h.deltaX, -h.deltaY);
710
+ }, v = (h) => {
711
+ h.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
712
+ }, C = (h) => {
713
+ h.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
714
+ };
715
+ return vt([
716
+ { dom: n, evt: "pointerdown", func: p },
717
+ { dom: n, evt: "pointermove", func: w },
718
+ { dom: n, evt: "pointerup", func: y },
719
+ { dom: n, evt: "pointercancel", func: u },
720
+ { dom: n, evt: "click", func: d },
721
+ { dom: n, evt: "contextmenu", func: g },
722
+ { dom: n, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : b },
723
+ { dom: n, evt: "blur", func: u },
724
+ { dom: n, evt: "keydown", func: v },
725
+ { dom: n, evt: "keyup", func: C }
698
726
  ]);
699
727
  }
700
- function ke() {
728
+ function Le() {
701
729
  return {
702
730
  handlers: {},
703
731
  addListener: function(t, e) {
@@ -721,31 +749,31 @@ function ke() {
721
749
  }
722
750
  };
723
751
  }
724
- const I = "http://www.w3.org/2000/svg", et = function(t) {
752
+ const N = "http://www.w3.org/2000/svg", U = function(t) {
725
753
  const e = t.clientWidth, n = t.clientHeight, o = t.dataset, s = Number(o.x), i = Number(o.y), r = o.anchor;
726
754
  let c = s;
727
755
  r === "middle" ? c = s - e / 2 : r === "end" && (c = s - e), t.style.left = `${c}px`, t.style.top = `${i - n / 2}px`, t.style.visibility = "visible";
728
- }, it = function(t, e, n, o) {
729
- const { anchor: s = "middle", color: i, dataType: r, svgId: c } = o, d = document.createElement("div");
730
- d.className = "svg-label", d.style.color = i || "#666";
756
+ }, Q = function(t, e, n, o) {
757
+ const { anchor: s = "middle", color: i, dataType: r, svgId: c } = o, l = document.createElement("div");
758
+ l.className = "svg-label", l.style.color = i || "#666";
731
759
  const a = "label-" + c;
732
- return d.id = a, d.innerHTML = t, d.dataset.type = r, d.dataset.svgId = c, d.dataset.x = e.toString(), d.dataset.y = n.toString(), d.dataset.anchor = s, d;
733
- }, Mt = function(t, e, n) {
734
- const o = document.createElementNS(I, "path");
735
- return M(o, {
760
+ return l.id = a, l.innerHTML = t, l.dataset.type = r, l.dataset.svgId = c, l.dataset.x = e.toString(), l.dataset.y = n.toString(), l.dataset.anchor = s, l;
761
+ }, Dt = function(t, e, n) {
762
+ const o = document.createElementNS(N, "path");
763
+ return D(o, {
736
764
  d: t,
737
765
  stroke: e || "#666",
738
766
  fill: "none",
739
767
  "stroke-width": n
740
768
  }), o;
741
- }, F = function(t) {
742
- const e = document.createElementNS(I, "svg");
769
+ }, W = function(t) {
770
+ const e = document.createElementNS(N, "svg");
743
771
  return e.setAttribute("class", t), e.setAttribute("overflow", "visible"), e;
744
- }, mt = function() {
745
- const t = document.createElementNS(I, "line");
772
+ }, pt = function() {
773
+ const t = document.createElementNS(N, "line");
746
774
  return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
747
- }, Ne = function(t, e, n, o) {
748
- const s = document.createElementNS(I, "g");
775
+ }, Me = function(t, e, n, o) {
776
+ const s = document.createElementNS(N, "g");
749
777
  return [
750
778
  {
751
779
  name: "line",
@@ -760,30 +788,32 @@ const I = "http://www.w3.org/2000/svg", et = function(t) {
760
788
  d: n
761
789
  }
762
790
  ].forEach((r, c) => {
763
- const d = r.d, a = document.createElementNS(I, "path"), h = {
764
- d,
791
+ const l = r.d, a = document.createElementNS(N, "path"), d = {
792
+ d: l,
765
793
  stroke: o?.stroke || "rgb(227, 125, 116)",
766
794
  fill: "none",
767
795
  "stroke-linecap": o?.strokeLinecap || "cap",
768
796
  "stroke-width": String(o?.strokeWidth || "2")
769
797
  };
770
- o?.opacity !== void 0 && (h.opacity = String(o.opacity)), M(a, h), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
771
- const f = document.createElementNS(I, "path");
772
- M(f, {
773
- d,
798
+ o?.opacity !== void 0 && (d.opacity = String(o.opacity)), D(a, d), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
799
+ const f = document.createElementNS(N, "path");
800
+ D(f, {
801
+ d: l,
774
802
  stroke: "transparent",
775
803
  fill: "none",
776
804
  "stroke-width": "15"
777
805
  }), s.appendChild(f), s.appendChild(a), s[r.name] = a;
778
806
  }), s;
779
- }, kt = function(t, e, n) {
807
+ }, Lt = function(t, e, n) {
780
808
  if (!e) return;
781
- const o = n.label, s = e.cloneNode(!0);
809
+ const o = n.label;
810
+ e.style.opacity = "0";
811
+ const s = e.cloneNode(!0);
782
812
  t.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
783
813
  left:${e.style.left};
784
814
  top:${e.style.top};
785
815
  max-width: 200px;
786
- `, Lt(s), t.scrollIntoView(s), s.addEventListener("keydown", (i) => {
816
+ `, Et(s), t.scrollIntoView(s), s.addEventListener("keydown", (i) => {
787
817
  i.stopPropagation();
788
818
  const r = i.key;
789
819
  if (r === "Enter" || r === "Tab") {
@@ -793,7 +823,7 @@ const I = "http://www.w3.org/2000/svg", et = function(t) {
793
823
  }), s.addEventListener("blur", () => {
794
824
  if (!s) return;
795
825
  const i = s.innerText?.trim() || "";
796
- i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (t.markdown ? e.innerHTML = t.markdown(n.label, n) : e.textContent = n.label, et(e), "parent" in n ? t.bus.fire("operation", {
826
+ i === "" ? n.label = o : n.label = i, e.style.opacity = "1", s.remove(), i !== o && (t.markdown ? e.innerHTML = t.markdown(n.label, n) : e.textContent = n.label, U(e), "parent" in n ? t.bus.fire("operation", {
797
827
  name: "finishEditSummary",
798
828
  obj: n
799
829
  }) : t.bus.fire("operation", {
@@ -805,58 +835,58 @@ const I = "http://www.w3.org/2000/svg", et = function(t) {
805
835
  const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, i = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
806
836
  this.lines.innerHTML = "";
807
837
  for (let c = 0; c < r.length; c++) {
808
- const d = r[c], a = d.querySelector("me-tpc"), { offsetLeft: h, offsetTop: f } = H(this.nodes, a), p = a.offsetWidth, m = a.offsetHeight, y = d.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: f, cL: h, cW: p, cH: m, direction: y, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, b = a.nodeObj.branchColor || g[c % g.length];
809
- if (a.style.borderColor = b, this.lines.appendChild(Mt(u, b, "3")), t && t !== d)
838
+ const l = r[c], a = l.querySelector("me-tpc"), { offsetLeft: d, offsetTop: f } = M(this.nodes, a), p = a.offsetWidth, w = a.offsetHeight, y = l.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: f, cL: d, cW: p, cH: w, direction: y, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, b = a.nodeObj.branchColor || g[c % g.length];
839
+ if (a.style.borderColor = b, this.lines.appendChild(Dt(u, b, "3")), t && t !== l)
810
840
  continue;
811
- const v = F("subLines"), x = d.lastChild;
812
- x.tagName === "svg" && x.remove(), d.appendChild(v), Nt(this, v, b, d, y, !0);
841
+ const v = W("subLines"), C = l.lastChild;
842
+ C.tagName === "svg" && C.remove(), l.appendChild(v), Mt(this, v, b, l, y, !0);
813
843
  }
814
844
  this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
815
- }, Nt = function(t, e, n, o, s, i) {
845
+ }, Mt = function(t, e, n, o, s, i) {
816
846
  const r = o.firstChild, c = o.children[1].children;
817
847
  if (c.length === 0) return;
818
- const d = r.offsetTop, a = r.offsetLeft, h = r.offsetWidth, f = r.offsetHeight;
848
+ const l = r.offsetTop, a = r.offsetLeft, d = r.offsetWidth, f = r.offsetHeight;
819
849
  for (let p = 0; p < c.length; p++) {
820
- const m = c[p], y = m.firstChild, u = y.offsetTop, g = y.offsetLeft, b = y.offsetWidth, v = y.offsetHeight, x = y.firstChild.nodeObj.branchColor || n, S = t.generateSubBranch({ pT: d, pL: a, pW: h, pH: f, cT: u, cL: g, cW: b, cH: v, direction: s, isFirst: i });
821
- e.appendChild(Mt(S, x, "2"));
822
- const T = y.children[1];
823
- if (T) {
824
- if (!T.expanded) continue;
850
+ const w = c[p], y = w.firstChild, u = y.offsetTop, g = y.offsetLeft, b = y.offsetWidth, v = y.offsetHeight, C = y.firstChild.nodeObj.branchColor || n, T = t.generateSubBranch({ pT: l, pL: a, pW: d, pH: f, cT: u, cL: g, cW: b, cH: v, direction: s, isFirst: i });
851
+ e.appendChild(Dt(T, C, "2"));
852
+ const h = y.children[1];
853
+ if (h) {
854
+ if (!h.expanded) continue;
825
855
  } else
826
856
  continue;
827
- Nt(t, e, x, m, s);
857
+ Mt(t, e, C, w, s);
828
858
  }
829
- }, Ae = '<?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>', $e = '<?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>', He = '<?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>', Ie = '<?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>', Oe = '<?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>', Ye = '<?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>', Be = '<?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>', We = {
830
- side: Ae,
831
- left: $e,
832
- right: He,
833
- full: Ie,
834
- living: Oe,
835
- zoomin: Ye,
836
- zoomout: Be
837
- }, W = (t, e) => {
859
+ }, ke = '<?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>', Ne = '<?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>', Ae = '<?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>', $e = '<?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>', He = '<?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>', Ie = '<?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>', Oe = '<?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>', Be = {
860
+ side: ke,
861
+ left: Ne,
862
+ right: Ae,
863
+ full: $e,
864
+ living: He,
865
+ zoomin: Ie,
866
+ zoomout: Oe
867
+ }, $ = (t, e) => {
838
868
  const n = document.createElement("span");
839
- return n.id = t, n.innerHTML = We[e], n;
869
+ return n.id = t, n.innerHTML = Be[e], n;
840
870
  };
841
- function Re(t) {
842
- const e = document.createElement("div"), n = W("fullscreen", "full"), o = W("toCenter", "living"), s = W("zoomout", "zoomout"), i = W("zoomin", "zoomin");
871
+ function We(t) {
872
+ const e = document.createElement("div"), n = $("fullscreen", "full"), o = $("toCenter", "living"), s = $("zoomout", "zoomout"), i = $("zoomin", "zoomin");
843
873
  e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(i), e.className = "mind-elixir-toolbar rb";
844
874
  let r = null;
845
875
  const c = () => {
846
- const a = t.container.getBoundingClientRect(), h = at(t.map.style.transform), f = a.width / 2, p = a.height / 2, m = (f - h.x) / t.scaleVal, y = (p - h.y) / t.scaleVal;
876
+ const a = t.container.getBoundingClientRect(), d = ot(t.map.style.transform), f = a.width / 2, p = a.height / 2, w = (f - d.x) / t.scaleVal, y = (p - d.y) / t.scaleVal;
847
877
  r = {
848
878
  containerRect: a,
849
- currentTransform: h,
850
- mapCenterX: m,
879
+ currentTransform: d,
880
+ mapCenterX: w,
851
881
  mapCenterY: y
852
882
  };
853
- }, d = () => {
883
+ }, l = () => {
854
884
  if (r) {
855
- const a = t.container.getBoundingClientRect(), h = a.width / 2, f = a.height / 2, p = h - r.mapCenterX * t.scaleVal, m = f - r.mapCenterY * t.scaleVal, y = p - r.currentTransform.x, u = m - r.currentTransform.y;
885
+ const a = t.container.getBoundingClientRect(), d = a.width / 2, f = a.height / 2, p = d - r.mapCenterX * t.scaleVal, w = f - r.mapCenterY * t.scaleVal, y = p - r.currentTransform.x, u = w - r.currentTransform.y;
856
886
  t.move(y, u);
857
887
  }
858
888
  };
859
- return t.el.addEventListener("fullscreenchange", d), n.onclick = () => {
889
+ return t.el.addEventListener("fullscreenchange", l), n.onclick = () => {
860
890
  c(), document.fullscreenElement !== t.el ? t.el.requestFullscreen() : document.exitFullscreen();
861
891
  }, o.onclick = () => {
862
892
  t.toCenter();
@@ -866,8 +896,8 @@ function Re(t) {
866
896
  t.scale(t.scaleVal + t.scaleSensitivity);
867
897
  }, e;
868
898
  }
869
- function Xe(t) {
870
- const e = document.createElement("div"), n = W("tbltl", "left"), o = W("tbltr", "right"), s = W("tblts", "side");
899
+ function Ye(t) {
900
+ const e = document.createElement("div"), n = $("tbltl", "left"), o = $("tbltr", "right"), s = $("tblts", "side");
871
901
  return e.appendChild(n), e.appendChild(o), e.appendChild(s), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
872
902
  t.initLeft();
873
903
  }, o.onclick = () => {
@@ -876,13 +906,13 @@ function Xe(t) {
876
906
  t.initSide();
877
907
  }, e;
878
908
  }
879
- function Ge(t) {
880
- t.container.append(Re(t)), t.container.append(Xe(t));
909
+ function Re(t) {
910
+ t.container.append(We(t)), t.container.append(Ye(t));
881
911
  }
882
- const Ve = function(t, e = !0) {
912
+ const Xe = function(t, e = !0) {
883
913
  this.theme = t;
884
914
  const o = {
885
- ...(t.type === "dark" ? ct : rt).cssVar,
915
+ ...(t.type === "dark" ? et : tt).cssVar,
886
916
  ...t.cssVar
887
917
  }, s = Object.keys(o);
888
918
  for (let i = 0; i < s.length; i++) {
@@ -890,7 +920,7 @@ const Ve = function(t, e = !0) {
890
920
  this.container.style.setProperty(r, o[r]);
891
921
  }
892
922
  e && this.refresh();
893
- }, ze = function(t) {
923
+ }, Ve = function(t) {
894
924
  return {
895
925
  dom: t,
896
926
  moved: !1,
@@ -913,7 +943,7 @@ const Ve = function(t, e = !0) {
913
943
  },
914
944
  cb: null,
915
945
  init(e, n) {
916
- this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = xt([
946
+ this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = vt([
917
947
  { dom: e, evt: "pointermove", func: this.handlePointerMove },
918
948
  { dom: e, evt: "pointerleave", func: this.handleClear },
919
949
  { dom: e, evt: "pointerup", func: this.handleClear },
@@ -925,44 +955,44 @@ const Ve = function(t, e = !0) {
925
955
  this.moved = !1, this.pointerdown = !1;
926
956
  }
927
957
  };
928
- }, yt = {
929
- create: ze
930
- }, Fe = "#4dc4ff";
958
+ }, gt = {
959
+ create: Ve
960
+ }, ze = "#4dc4ff";
931
961
  function Pt(t, e, n, o, s, i, r, c) {
932
962
  return {
933
963
  x: t / 8 + n * 3 / 8 + s * 3 / 8 + r / 8,
934
964
  y: e / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
935
965
  };
936
966
  }
937
- function _e(t, e, n) {
938
- t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), et(t));
967
+ function Fe(t, e, n) {
968
+ t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), U(t));
939
969
  }
940
- function j(t, e, n, o, s) {
941
- M(t, {
970
+ function V(t, e, n, o, s) {
971
+ D(t, {
942
972
  x1: e + "",
943
973
  y1: n + "",
944
974
  x2: o + "",
945
975
  y2: s + ""
946
976
  });
947
977
  }
948
- function wt(t, e, n, o, s, i, r, c, d, a) {
949
- const h = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${c} ${d}`;
950
- if (t.line.setAttribute("d", h), a.style) {
978
+ function mt(t, e, n, o, s, i, r, c, l, a) {
979
+ const d = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${c} ${l}`;
980
+ if (t.line.setAttribute("d", d), a.style) {
951
981
  const u = a.style;
952
982
  u.stroke && t.line.setAttribute("stroke", u.stroke), u.strokeWidth && t.line.setAttribute("stroke-width", String(u.strokeWidth)), u.strokeDasharray && t.line.setAttribute("stroke-dasharray", u.strokeDasharray), u.strokeLinecap && t.line.setAttribute("stroke-linecap", u.strokeLinecap), u.opacity !== void 0 && t.line.setAttribute("opacity", String(u.opacity));
953
983
  }
954
984
  const f = t.querySelectorAll('path[stroke="transparent"]');
955
- f.length > 0 && f[0].setAttribute("d", h);
956
- const p = Z(i, r, c, d);
985
+ f.length > 0 && f[0].setAttribute("d", d);
986
+ const p = _(i, r, c, l);
957
987
  if (p) {
958
- const u = `M ${p.x1} ${p.y1} L ${c} ${d} L ${p.x2} ${p.y2}`;
988
+ const u = `M ${p.x1} ${p.y1} L ${c} ${l} L ${p.x2} ${p.y2}`;
959
989
  if (t.arrow1.setAttribute("d", u), f.length > 1 && f[1].setAttribute("d", u), a.style) {
960
990
  const g = a.style;
961
991
  g.stroke && t.arrow1.setAttribute("stroke", g.stroke), g.strokeWidth && t.arrow1.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && t.arrow1.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && t.arrow1.setAttribute("opacity", String(g.opacity));
962
992
  }
963
993
  }
964
994
  if (a.bidirectional) {
965
- const u = Z(o, s, e, n);
995
+ const u = _(o, s, e, n);
966
996
  if (u) {
967
997
  const g = `M ${u.x1} ${u.y1} L ${e} ${n} L ${u.x2} ${u.y2}`;
968
998
  if (t.arrow2.setAttribute("d", g), f.length > 2 && f[2].setAttribute("d", g), a.style) {
@@ -971,25 +1001,25 @@ function wt(t, e, n, o, s, i, r, c, d, a) {
971
1001
  }
972
1002
  }
973
1003
  }
974
- const { x: m, y } = Pt(e, n, o, s, i, r, c, d);
975
- if (t.labelEl && _e(t.labelEl, m, y), a.style?.labelColor) {
1004
+ const { x: w, y } = Pt(e, n, o, s, i, r, c, l);
1005
+ if (t.labelEl && Fe(t.labelEl, w, y), a.style?.labelColor) {
976
1006
  const u = t.labelEl;
977
1007
  u && (u.style.color = a.style.labelColor);
978
1008
  }
979
- en(t);
1009
+ Qe(t);
980
1010
  }
981
- function Q(t, e, n) {
982
- const { offsetLeft: o, offsetTop: s } = H(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, d = s + r / 2, a = c + n.x, h = d + n.y;
1011
+ function q(t, e, n) {
1012
+ const { offsetLeft: o, offsetTop: s } = M(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, l = s + r / 2, a = c + n.x, d = l + n.y;
983
1013
  return {
984
1014
  w: i,
985
1015
  h: r,
986
1016
  cx: c,
987
- cy: d,
1017
+ cy: l,
988
1018
  ctrlX: a,
989
- ctrlY: h
1019
+ ctrlY: d
990
1020
  };
991
1021
  }
992
- function X(t) {
1022
+ function H(t) {
993
1023
  let e, n;
994
1024
  const o = (t.cy - t.ctrlY) / (t.ctrlX - t.cx);
995
1025
  return o > t.h / t.w || o < -t.h / t.w ? t.cy - t.ctrlY < 0 ? (e = t.cx - t.h / 2 / o, n = t.cy + t.h / 2) : (e = t.cx + t.h / 2 / o, n = t.cy - t.h / 2) : t.cx - t.ctrlX < 0 ? (e = t.cx + t.w / 2, n = t.cy - t.w * o / 2) : (e = t.cx - t.w / 2, n = t.cy + t.w * o / 2), {
@@ -997,74 +1027,74 @@ function X(t) {
997
1027
  y: n
998
1028
  };
999
1029
  }
1000
- const qe = function(t, e, n) {
1001
- const o = H(t.nodes, e), s = H(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, d = s.offsetTop + n.offsetHeight / 2, a = c - i, h = d - r, f = Math.sqrt(a * a + h * h), p = Math.max(50, Math.min(200, f * 0.3)), m = Math.abs(a), y = Math.abs(h);
1030
+ const Ge = function(t, e, n) {
1031
+ const o = M(t.nodes, e), s = M(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, l = s.offsetTop + n.offsetHeight / 2, a = c - i, d = l - r, f = Math.sqrt(a * a + d * d), p = Math.max(50, Math.min(200, f * 0.3)), w = Math.abs(a), y = Math.abs(d);
1002
1032
  let u, g;
1003
1033
  if (f < 150) {
1004
1034
  const v = e.closest("me-main").className === "lhs" ? -1 : 1;
1005
1035
  u = { x: 200 * v, y: 0 }, g = { x: 200 * v, y: 0 };
1006
- } else if (m > y * 1.5) {
1007
- const v = a > 0 ? e.offsetWidth / 2 : -e.offsetWidth / 2, x = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
1008
- u = { x: v + (a > 0 ? p : -p), y: 0 }, g = { x: x + (a > 0 ? -p : p), y: 0 };
1009
- } else if (y > m * 1.5) {
1010
- const v = h > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, x = h > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
1011
- u = { x: 0, y: v + (h > 0 ? p : -p) }, g = { x: 0, y: x + (h > 0 ? -p : p) };
1036
+ } else if (w > y * 1.5) {
1037
+ const v = a > 0 ? e.offsetWidth / 2 : -e.offsetWidth / 2, C = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
1038
+ u = { x: v + (a > 0 ? p : -p), y: 0 }, g = { x: C + (a > 0 ? -p : p), y: 0 };
1039
+ } else if (y > w * 1.5) {
1040
+ const v = d > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, C = d > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
1041
+ u = { x: 0, y: v + (d > 0 ? p : -p) }, g = { x: 0, y: C + (d > 0 ? -p : p) };
1012
1042
  } else {
1013
- const v = Math.atan2(h, a), x = e.offsetWidth / 2 * Math.cos(v), S = e.offsetHeight / 2 * Math.sin(v), T = -(n.offsetWidth / 2) * Math.cos(v), L = -(n.offsetHeight / 2) * Math.sin(v), C = p * 0.7 * (a > 0 ? 1 : -1), P = p * 0.7 * (h > 0 ? 1 : -1);
1014
- u = { x: x + C, y: S + P }, g = { x: T - C, y: L - P };
1043
+ const v = Math.atan2(d, a), C = e.offsetWidth / 2 * Math.cos(v), T = e.offsetHeight / 2 * Math.sin(v), h = -(n.offsetWidth / 2) * Math.cos(v), m = -(n.offsetHeight / 2) * Math.sin(v), x = p * 0.7 * (a > 0 ? 1 : -1), S = p * 0.7 * (d > 0 ? 1 : -1);
1044
+ u = { x: C + x, y: T + S }, g = { x: h - x, y: m - S };
1015
1045
  }
1016
1046
  return {
1017
1047
  delta1: { x: Math.round(u.x), y: Math.round(u.y) },
1018
1048
  delta2: { x: Math.round(g.x), y: Math.round(g.y) }
1019
1049
  };
1020
- }, ht = function(t, e, n, o, s) {
1050
+ }, it = function(t, e, n, o, s) {
1021
1051
  if (!e || !n)
1022
1052
  return;
1023
1053
  if (!o.delta1 || !o.delta2) {
1024
- const k = qe(t, e, n);
1025
- o.delta1 = k.delta1, o.delta2 = k.delta2;
1054
+ const E = Ge(t, e, n);
1055
+ o.delta1 = E.delta1, o.delta2 = E.delta2;
1026
1056
  }
1027
- const i = Q(t, e, o.delta1), r = Q(t, n, o.delta2), { x: c, y: d } = X(i), { ctrlX: a, ctrlY: h } = i, { ctrlX: f, ctrlY: p } = r, { x: m, y } = X(r), u = Z(f, p, m, y);
1057
+ const i = q(t, e, o.delta1), r = q(t, n, o.delta2), { x: c, y: l } = H(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: f, ctrlY: p } = r, { x: w, y } = H(r), u = _(f, p, w, y);
1028
1058
  if (!u) return;
1029
- const g = `M ${u.x1} ${u.y1} L ${m} ${y} L ${u.x2} ${u.y2}`;
1059
+ const g = `M ${u.x1} ${u.y1} L ${w} ${y} L ${u.x2} ${u.y2}`;
1030
1060
  let b = "";
1031
1061
  if (o.bidirectional) {
1032
- const k = Z(a, h, c, d);
1033
- if (!k) return;
1034
- b = `M ${k.x1} ${k.y1} L ${c} ${d} L ${k.x2} ${k.y2}`;
1062
+ const E = _(a, d, c, l);
1063
+ if (!E) return;
1064
+ b = `M ${E.x1} ${E.y1} L ${c} ${l} L ${E.x2} ${E.y2}`;
1035
1065
  }
1036
- const v = Ne(`M ${c} ${d} C ${a} ${h} ${f} ${p} ${m} ${y}`, g, b, o.style), { x, y: S } = Pt(c, d, a, h, f, p, m, y), T = o.style?.labelColor || "rgb(235, 95, 82)", L = "arrow-" + o.id;
1037
- v.id = L;
1038
- const C = t.markdown ? t.markdown(o.label, o) : o.label, P = it(C, x, S, {
1066
+ const v = Me(`M ${c} ${l} C ${a} ${d} ${f} ${p} ${w} ${y}`, g, b, o.style), { x: C, y: T } = Pt(c, l, a, d, f, p, w, y), h = o.style?.labelColor || "rgb(235, 95, 82)", m = "a-" + o.id;
1067
+ v.id = m;
1068
+ const x = t.markdown ? t.markdown(o.label, o) : o.label, S = Q(x, C, T, {
1039
1069
  anchor: "middle",
1040
- color: T,
1070
+ color: h,
1041
1071
  dataType: "arrow",
1042
- svgId: L
1072
+ svgId: m
1043
1073
  });
1044
- v.labelEl = P, v.arrowObj = o, v.dataset.linkid = o.id, t.labelContainer.appendChild(P), t.linkSvgGroup.appendChild(v), et(P), s || (t.arrows.push(o), t.currentArrow = v, At(t, o, i, r));
1045
- }, je = function(t, e, n = {}) {
1074
+ v.labelEl = S, v.arrowObj = o, v.dataset.linkid = o.id, t.labelContainer.appendChild(S), t.arrowSvg.appendChild(v), U(S), s || (t.arrows.push(o), t.currentArrow = v, kt(t, o, i, r));
1075
+ }, _e = function(t, e, n = {}) {
1046
1076
  const o = {
1047
- id: _(),
1077
+ id: Y(),
1048
1078
  label: "Custom Link",
1049
1079
  from: t.nodeObj.id,
1050
1080
  to: e.nodeObj.id,
1051
1081
  ...n
1052
1082
  };
1053
- ht(this, t, e, o), this.bus.fire("operation", {
1083
+ it(this, t, e, o), this.bus.fire("operation", {
1054
1084
  name: "createArrow",
1055
1085
  obj: o
1056
1086
  });
1057
- }, Ue = function(t) {
1058
- nt(this);
1059
- const e = { ...t, id: _() };
1060
- ht(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
1087
+ }, qe = function(t) {
1088
+ K(this);
1089
+ const e = { ...t, id: Y() };
1090
+ it(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
1061
1091
  name: "createArrow",
1062
1092
  obj: e
1063
1093
  });
1064
- }, Ke = function(t) {
1094
+ }, je = function(t) {
1065
1095
  let e;
1066
1096
  if (t ? e = t : e = this.currentArrow, !e) return;
1067
- nt(this);
1097
+ K(this);
1068
1098
  const n = e.arrowObj.id;
1069
1099
  this.arrows = this.arrows.filter((o) => o.id !== n), e.labelEl?.remove(), e.remove(), this.bus.fire("operation", {
1070
1100
  name: "removeArrow",
@@ -1072,15 +1102,15 @@ const qe = function(t, e, n) {
1072
1102
  id: n
1073
1103
  }
1074
1104
  });
1075
- }, Je = function(t) {
1105
+ }, Ue = function(t) {
1076
1106
  this.currentArrow = t;
1077
- const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = Q(this, n, e.delta1), i = Q(this, o, e.delta2);
1078
- At(this, e, s, i);
1079
- }, Ze = function() {
1080
- nt(this), this.currentArrow = null;
1081
- }, st = function(t, e) {
1082
- const n = document.createElementNS(I, "path");
1083
- return M(n, {
1107
+ const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = q(this, n, e.delta1), i = q(this, o, e.delta2);
1108
+ kt(this, e, s, i), this.bus.fire("selectArrow", e);
1109
+ }, Ke = function() {
1110
+ K(this), this.currentArrow = null, this.bus.fire("unselectArrow");
1111
+ }, Z = function(t, e) {
1112
+ const n = document.createElementNS(N, "path");
1113
+ return D(n, {
1084
1114
  d: t,
1085
1115
  stroke: e,
1086
1116
  fill: "none",
@@ -1088,201 +1118,201 @@ const qe = function(t, e, n) {
1088
1118
  "stroke-linecap": "round",
1089
1119
  "stroke-linejoin": "round"
1090
1120
  }), n;
1091
- }, Qe = function(t, e) {
1092
- const n = document.createElementNS(I, "g");
1121
+ }, Je = function(t, e) {
1122
+ const n = document.createElementNS(N, "g");
1093
1123
  n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
1094
- const o = st(t.line.getAttribute("d"), e);
1124
+ const o = Z(t.line.getAttribute("d"), e);
1095
1125
  n.appendChild(o);
1096
- const s = st(t.arrow1.getAttribute("d"), e);
1126
+ const s = Z(t.arrow1.getAttribute("d"), e);
1097
1127
  if (n.appendChild(s), t.arrow2.getAttribute("d")) {
1098
- const i = st(t.arrow2.getAttribute("d"), e);
1128
+ const i = Z(t.arrow2.getAttribute("d"), e);
1099
1129
  n.appendChild(i);
1100
1130
  }
1101
1131
  t.insertBefore(n, t.firstChild);
1102
- }, tn = function(t) {
1132
+ }, Ze = function(t) {
1103
1133
  const e = t.querySelector(".arrow-highlight");
1104
1134
  e && e.remove();
1105
- }, en = function(t) {
1135
+ }, Qe = function(t) {
1106
1136
  const e = t.querySelector(".arrow-highlight");
1107
1137
  if (!e) return;
1108
1138
  const n = e.querySelectorAll("path");
1109
1139
  n.length >= 1 && n[0].setAttribute("d", t.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", t.arrow1.getAttribute("d")), n.length >= 3 && t.arrow2.getAttribute("d") && n[2].setAttribute("d", t.arrow2.getAttribute("d"));
1110
- }, nt = function(t) {
1111
- t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && tn(t.currentArrow);
1112
- }, At = function(t, e, n, o) {
1113
- const { linkController: s, P2: i, P3: r, line1: c, line2: d, nodes: a, map: h, currentArrow: f, bus: p } = t;
1140
+ }, K = function(t) {
1141
+ t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && Ze(t.currentArrow);
1142
+ }, kt = function(t, e, n, o) {
1143
+ const { linkController: s, P2: i, P3: r, line1: c, line2: l, nodes: a, map: d, currentArrow: f, bus: p } = t;
1114
1144
  if (!f) return;
1115
- s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(r), Qe(f, Fe);
1116
- let { x: m, y } = X(n), { ctrlX: u, ctrlY: g } = n, { ctrlX: b, ctrlY: v } = o, { x, y: S } = X(o);
1117
- i.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${v}px;left:${b}px;`, j(c, m, y, u, g), j(d, b, v, x, S), t.helper1 = yt.create(i), t.helper2 = yt.create(r), t.helper1.init(h, (T, L) => {
1118
- u = u + T / t.scaleVal, g = g + L / t.scaleVal;
1119
- const C = X({ ...n, ctrlX: u, ctrlY: g });
1120
- m = C.x, y = C.y, i.style.top = g + "px", i.style.left = u + "px", wt(f, m, y, u, g, b, v, x, S, e), j(c, m, y, u, g), e.delta1.x = Math.round(u - n.cx), e.delta1.y = Math.round(g - n.cy), p.fire("updateArrowDelta", e);
1121
- }), t.helper2.init(h, (T, L) => {
1122
- b = b + T / t.scaleVal, v = v + L / t.scaleVal;
1123
- const C = X({ ...o, ctrlX: b, ctrlY: v });
1124
- x = C.x, S = C.y, r.style.top = v + "px", r.style.left = b + "px", wt(f, m, y, u, g, b, v, x, S, e), j(d, b, v, x, S), e.delta2.x = Math.round(b - o.cx), e.delta2.y = Math.round(v - o.cy), p.fire("updateArrowDelta", e);
1145
+ s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(r), Je(f, ze);
1146
+ let { x: w, y } = H(n), { ctrlX: u, ctrlY: g } = n, { ctrlX: b, ctrlY: v } = o, { x: C, y: T } = H(o);
1147
+ i.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${v}px;left:${b}px;`, V(c, w, y, u, g), V(l, b, v, C, T), t.helper1 = gt.create(i), t.helper2 = gt.create(r), t.helper1.init(d, (h, m) => {
1148
+ u = u + h / t.scaleVal, g = g + m / t.scaleVal;
1149
+ const x = H({ ...n, ctrlX: u, ctrlY: g });
1150
+ w = x.x, y = x.y, i.style.top = g + "px", i.style.left = u + "px", mt(f, w, y, u, g, b, v, C, T, e), V(c, w, y, u, g), e.delta1.x = Math.round(u - n.cx), e.delta1.y = Math.round(g - n.cy), p.fire("updateArrowDelta", e);
1151
+ }), t.helper2.init(d, (h, m) => {
1152
+ b = b + h / t.scaleVal, v = v + m / t.scaleVal;
1153
+ const x = H({ ...o, ctrlX: b, ctrlY: v });
1154
+ C = x.x, T = x.y, r.style.top = v + "px", r.style.left = b + "px", mt(f, w, y, u, g, b, v, C, T, e), V(l, b, v, C, T), e.delta2.x = Math.round(b - o.cx), e.delta2.y = Math.round(v - o.cy), p.fire("updateArrowDelta", e);
1125
1155
  });
1126
1156
  };
1127
- function nn() {
1128
- this.linkSvgGroup.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((e) => e.remove());
1157
+ function tn() {
1158
+ this.arrowSvg.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((e) => e.remove());
1129
1159
  for (let e = 0; e < this.arrows.length; e++) {
1130
1160
  const n = this.arrows[e];
1131
1161
  try {
1132
- ht(this, this.findEle(n.from), this.findEle(n.to), n, !0);
1162
+ it(this, this.findEle(n.from), this.findEle(n.to), n, !0);
1133
1163
  } catch {
1134
1164
  }
1135
1165
  }
1136
- this.nodes.appendChild(this.linkSvgGroup);
1166
+ this.nodes.appendChild(this.arrowSvg);
1137
1167
  }
1138
- function on(t) {
1139
- nt(this), t && t.labelEl && kt(this, t.labelEl, t.arrowObj);
1168
+ function en(t) {
1169
+ K(this), t && t.labelEl && Lt(this, t.labelEl, t.arrowObj);
1140
1170
  }
1141
- function sn() {
1142
- this.arrows = this.arrows.filter((t) => J(t.from, this.nodeData) && J(t.to, this.nodeData));
1171
+ function nn() {
1172
+ this.arrows = this.arrows.filter((t) => G(t.from, this.nodeData) && G(t.to, this.nodeData));
1143
1173
  }
1144
- const rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1174
+ const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1145
1175
  __proto__: null,
1146
- createArrow: je,
1147
- createArrowFrom: Ue,
1148
- editArrowLabel: on,
1149
- removeArrow: Ke,
1150
- renderArrow: nn,
1151
- selectArrow: Je,
1152
- tidyArrow: sn,
1153
- unselectArrow: Ze
1154
- }, Symbol.toStringTag, { value: "Module" })), cn = function(t) {
1176
+ createArrow: _e,
1177
+ createArrowFrom: qe,
1178
+ editArrowLabel: en,
1179
+ removeArrow: je,
1180
+ renderArrow: tn,
1181
+ selectArrow: Ue,
1182
+ tidyArrow: nn,
1183
+ unselectArrow: Ke
1184
+ }, Symbol.toStringTag, { value: "Module" })), sn = function(t) {
1155
1185
  if (t.length === 0) throw new Error("No selected node.");
1156
1186
  if (t.length === 1) {
1157
- const d = t[0].nodeObj, a = t[0].nodeObj.parent;
1187
+ const l = t[0].nodeObj, a = t[0].nodeObj.parent;
1158
1188
  if (!a) throw new Error("Can not select root node.");
1159
- const h = a.children.findIndex((f) => d === f);
1189
+ const d = a.children.findIndex((f) => l === f);
1160
1190
  return {
1161
1191
  parent: a.id,
1162
- start: h,
1163
- end: h
1192
+ start: d,
1193
+ end: d
1164
1194
  };
1165
1195
  }
1166
1196
  let e = 0;
1167
- const n = t.map((d) => {
1168
- let a = d.nodeObj;
1169
- const h = [];
1197
+ const n = t.map((l) => {
1198
+ let a = l.nodeObj;
1199
+ const d = [];
1170
1200
  for (; a.parent; ) {
1171
- const f = a.parent, m = f.children?.indexOf(a);
1172
- a = f, h.unshift({ node: a, index: m });
1201
+ const f = a.parent, w = f.children?.indexOf(a);
1202
+ a = f, d.unshift({ node: a, index: w });
1173
1203
  }
1174
- return h.length > e && (e = h.length), h;
1204
+ return d.length > e && (e = d.length), d;
1175
1205
  });
1176
1206
  let o = 0;
1177
1207
  t: for (; o < e; o++) {
1178
- const d = n[0][o]?.node;
1208
+ const l = n[0][o]?.node;
1179
1209
  for (let a = 1; a < n.length; a++)
1180
- if (n[a][o]?.node !== d)
1210
+ if (n[a][o]?.node !== l)
1181
1211
  break t;
1182
1212
  }
1183
1213
  if (!o) throw new Error("Can not select root node.");
1184
- const s = n.map((d) => d[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, c = n[0][o - 1].node;
1214
+ const s = n.map((l) => l[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, c = n[0][o - 1].node;
1185
1215
  if (!c.parent) throw new Error("Please select nodes in the same main topic.");
1186
1216
  return {
1187
1217
  parent: c.id,
1188
1218
  start: i,
1189
1219
  end: r
1190
1220
  };
1191
- }, ln = function(t) {
1192
- const e = document.createElementNS(I, "g");
1221
+ }, rn = function(t) {
1222
+ const e = document.createElementNS(N, "g");
1193
1223
  return e.setAttribute("id", t), e;
1194
- }, vt = function(t, e) {
1195
- const n = document.createElementNS(I, "path");
1196
- return M(n, {
1224
+ }, yt = function(t, e) {
1225
+ const n = document.createElementNS(N, "path");
1226
+ return D(n, {
1197
1227
  d: t,
1198
1228
  stroke: e || "#666",
1199
1229
  fill: "none",
1200
1230
  "stroke-linecap": "round",
1201
1231
  "stroke-width": "2"
1202
1232
  }), n;
1203
- }, an = (t) => t.parentElement.parentElement, dn = function(t, { parent: e, start: n }) {
1233
+ }, cn = (t) => t.parentElement.parentElement, ln = function(t, { parent: e, start: n }) {
1204
1234
  const o = t.findEle(e), s = o.nodeObj;
1205
1235
  let i;
1206
1236
  return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
1207
- }, ft = function(t, e) {
1208
- const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: d, theme: a, summarySvg: h } = t, p = t.findEle(s).nodeObj, m = dn(t, e);
1237
+ }, rt = function(t, e) {
1238
+ const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: l, theme: a, summarySvg: d } = t, p = t.findEle(s).nodeObj, w = ln(t, e);
1209
1239
  let y = 1 / 0, u = 0, g = 0, b = 0;
1210
- for (let l = i; l <= r; l++) {
1211
- const w = p.children?.[l];
1212
- if (!w)
1240
+ for (let B = i; B <= r; B++) {
1241
+ const ct = p.children?.[B];
1242
+ if (!ct)
1213
1243
  return t.removeSummary(n), null;
1214
- const E = an(t.findEle(w.id)), { offsetLeft: N, offsetTop: B } = H(d, E), D = i === r ? 10 : 20;
1215
- l === i && (g = B + D), l === r && (b = B + E.offsetHeight - D), N < y && (y = N), E.offsetWidth + N > u && (u = E.offsetWidth + N);
1244
+ const R = cn(t.findEle(ct.id)), { offsetLeft: X, offsetTop: lt } = M(l, R), at = i === r ? 10 : 20;
1245
+ B === i && (g = lt + at), B === r && (b = lt + R.offsetHeight - at), X < y && (y = X), R.offsetWidth + X > u && (u = R.offsetWidth + X);
1216
1246
  }
1217
- let v, x;
1218
- const S = p.parent ? 10 : 0, T = g + S, L = b + S, C = (T + L) / 2, P = c?.stroke || a.cssVar["--color"], k = c?.labelColor || a.cssVar["--color"], Y = "s-" + n, A = t.markdown ? t.markdown(o, e) : o;
1219
- m === G.LHS ? (v = vt(`M ${y + 10} ${T} c -5 0 -10 5 -10 10 L ${y} ${L - 10} c 0 5 5 10 10 10 M ${y} ${C} h -10`, P), x = it(A, y - 20, C, { anchor: "end", color: k, dataType: "summary", svgId: Y })) : (v = vt(`M ${u - 10} ${T} c 5 0 10 5 10 10 L ${u} ${L - 10} c 0 5 -5 10 -10 10 M ${u} ${C} h 10`, P), x = it(A, u + 20, C, { anchor: "start", color: k, dataType: "summary", svgId: Y }));
1220
- const R = ln(Y);
1221
- return R.appendChild(v), t.labelContainer.appendChild(x), et(x), R.summaryObj = e, R.labelEl = x, h.appendChild(R), R;
1222
- }, hn = function(t = {}) {
1247
+ let v, C;
1248
+ const T = p.parent ? 10 : 0, h = g + T, m = b + T, x = (h + m) / 2, S = c?.stroke || a.cssVar["--color"], E = c?.labelColor || a.cssVar["--color"], P = "s-" + n, k = t.markdown ? t.markdown(o, e) : o;
1249
+ w === I.LHS ? (v = yt(`M ${y + 10} ${h} c -5 0 -10 5 -10 10 L ${y} ${m - 10} c 0 5 5 10 10 10 M ${y} ${x} h -10`, S), C = Q(k, y - 20, x, { anchor: "end", color: E, dataType: "summary", svgId: P })) : (v = yt(`M ${u - 10} ${h} c 5 0 10 5 10 10 L ${u} ${m - 10} c 0 5 -5 10 -10 10 M ${u} ${x} h 10`, S), C = Q(k, u + 20, x, { anchor: "start", color: E, dataType: "summary", svgId: P }));
1250
+ const O = rn(P);
1251
+ return O.appendChild(v), t.labelContainer.appendChild(C), U(C), O.summaryObj = e, O.labelEl = C, d.appendChild(O), O;
1252
+ }, an = function(t = {}) {
1223
1253
  if (!this.currentNodes) return;
1224
- const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = cn(e), c = { id: _(), parent: s, start: i, end: r, label: "summary", style: t.style }, d = ft(this, c);
1225
- n.push(c), this.editSummary(d), o.fire("operation", {
1254
+ const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = sn(e), c = { id: Y(), parent: s, start: i, end: r, label: "summary", style: t.style }, l = rt(this, c);
1255
+ n.push(c), this.editSummary(l), o.fire("operation", {
1226
1256
  name: "createSummary",
1227
1257
  obj: c
1228
1258
  });
1229
- }, fn = function(t) {
1230
- const e = _(), n = { ...t, id: e };
1231
- ft(this, n), this.summaries.push(n), this.bus.fire("operation", {
1259
+ }, hn = function(t) {
1260
+ const e = Y(), n = { ...t, id: e };
1261
+ rt(this, n), this.summaries.push(n), this.bus.fire("operation", {
1232
1262
  name: "createSummary",
1233
1263
  obj: n
1234
1264
  });
1235
- }, un = function(t) {
1265
+ }, dn = function(t) {
1236
1266
  const e = this.summaries.findIndex((n) => n.id === t);
1237
1267
  e > -1 && (this.summaries.splice(e, 1), this.nodes.querySelector("#s-" + t)?.remove(), this.nodes.querySelector("#label-s-" + t)?.remove()), this.bus.fire("operation", {
1238
1268
  name: "removeSummary",
1239
1269
  obj: { id: t }
1240
1270
  });
1241
- }, pn = function(t) {
1271
+ }, fn = function(t) {
1242
1272
  const e = t.labelEl;
1243
- e && e.classList.add("selected"), this.currentSummary = t;
1244
- }, gn = function() {
1245
- this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
1246
- }, mn = function() {
1273
+ e && e.classList.add("selected"), this.currentSummary = t, this.bus.fire("selectSummary", t.summaryObj);
1274
+ }, un = function() {
1275
+ this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
1276
+ }, pn = function() {
1247
1277
  this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
1248
1278
  try {
1249
- ft(this, t);
1279
+ rt(this, t);
1250
1280
  } catch {
1251
1281
  }
1252
1282
  }), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
1253
- }, yn = function(t) {
1254
- t && t.labelEl && kt(this, t.labelEl, t.summaryObj);
1255
- }, wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1283
+ }, gn = function(t) {
1284
+ t && t.labelEl && Lt(this, t.labelEl, t.summaryObj);
1285
+ }, mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1256
1286
  __proto__: null,
1257
- createSummary: hn,
1258
- createSummaryFrom: fn,
1259
- editSummary: yn,
1260
- removeSummary: un,
1261
- renderSummary: mn,
1262
- selectSummary: pn,
1263
- unselectSummary: gn
1264
- }, Symbol.toStringTag, { value: "Module" })), $ = "http://www.w3.org/2000/svg";
1265
- function vn(t, e) {
1266
- const n = document.createElementNS($, "svg");
1267
- return M(n, {
1287
+ createSummary: an,
1288
+ createSummaryFrom: hn,
1289
+ editSummary: gn,
1290
+ removeSummary: dn,
1291
+ renderSummary: pn,
1292
+ selectSummary: fn,
1293
+ unselectSummary: un
1294
+ }, Symbol.toStringTag, { value: "Module" })), L = "http://www.w3.org/2000/svg";
1295
+ function yn(t, e) {
1296
+ const n = document.createElementNS(L, "svg");
1297
+ return D(n, {
1268
1298
  version: "1.1",
1269
- xmlns: $,
1299
+ xmlns: L,
1270
1300
  height: t,
1271
1301
  width: e
1272
1302
  }), n;
1273
1303
  }
1274
- function bn(t, e) {
1304
+ function wn(t, e) {
1275
1305
  return (parseInt(t) - parseInt(e)) / 2;
1276
1306
  }
1277
- function xn(t, e, n, o) {
1278
- const s = document.createElementNS($, "g");
1307
+ function vn(t, e, n, o) {
1308
+ const s = document.createElementNS(L, "g");
1279
1309
  let i = "";
1280
1310
  return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
1281
- `).forEach((c, d) => {
1282
- const a = document.createElementNS($, "text");
1283
- M(a, {
1311
+ `).forEach((c, l) => {
1312
+ const a = document.createElementNS(L, "text");
1313
+ D(a, {
1284
1314
  x: n + parseInt(e.paddingLeft) + "",
1285
- y: o + parseInt(e.paddingTop) + bn(e.lineHeight, e.fontSize) * (d + 1) + parseFloat(e.fontSize) * (d + 1) + "",
1315
+ y: o + parseInt(e.paddingTop) + wn(e.lineHeight, e.fontSize) * (l + 1) + parseFloat(e.fontSize) * (l + 1) + "",
1286
1316
  "text-anchor": "start",
1287
1317
  "font-family": e.fontFamily,
1288
1318
  "font-size": `${e.fontSize}`,
@@ -1291,25 +1321,25 @@ function xn(t, e, n, o) {
1291
1321
  }), a.innerHTML = c, s.appendChild(a);
1292
1322
  }), s;
1293
1323
  }
1294
- function Cn(t, e, n, o) {
1324
+ function bn(t, e, n, o) {
1295
1325
  let s = "";
1296
1326
  t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
1297
- const i = document.createElementNS($, "foreignObject");
1298
- M(i, {
1327
+ const i = document.createElementNS(L, "foreignObject");
1328
+ D(i, {
1299
1329
  x: n + parseInt(e.paddingLeft) + "",
1300
1330
  y: o + parseInt(e.paddingTop) + "",
1301
1331
  width: e.width,
1302
1332
  height: e.height
1303
1333
  });
1304
1334
  const r = document.createElement("div");
1305
- return M(r, {
1335
+ return D(r, {
1306
1336
  xmlns: "http://www.w3.org/1999/xhtml",
1307
1337
  style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
1308
1338
  }), r.innerHTML = s, i.appendChild(r), i;
1309
1339
  }
1310
- function En(t, e) {
1311
- const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = H(t.nodes, e), i = document.createElementNS($, "rect");
1312
- return M(i, {
1340
+ function xn(t, e) {
1341
+ const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = M(t.nodes, e), i = document.createElementNS(L, "rect");
1342
+ return D(i, {
1313
1343
  x: o + "",
1314
1344
  y: s + "",
1315
1345
  rx: n.borderRadius,
@@ -1321,9 +1351,9 @@ function En(t, e) {
1321
1351
  "stroke-width": n.borderWidth
1322
1352
  }), i;
1323
1353
  }
1324
- function U(t, e, n = !1) {
1325
- const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = H(t.nodes, e), r = document.createElementNS($, "rect");
1326
- M(r, {
1354
+ function z(t, e, n = !1) {
1355
+ const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = M(t.nodes, e), r = document.createElementNS(L, "rect");
1356
+ D(r, {
1327
1357
  x: s + "",
1328
1358
  y: i + "",
1329
1359
  rx: o.borderRadius,
@@ -1334,14 +1364,14 @@ function U(t, e, n = !1) {
1334
1364
  stroke: o.borderColor,
1335
1365
  "stroke-width": o.borderWidth
1336
1366
  });
1337
- const c = document.createElementNS($, "g");
1367
+ const c = document.createElementNS(L, "g");
1338
1368
  c.appendChild(r);
1339
- let d;
1340
- return n ? d = Cn(e, o, s, i) : d = xn(e, o, s, i), c.appendChild(d), c;
1369
+ let l;
1370
+ return n ? l = bn(e, o, s, i) : l = vn(e, o, s, i), c.appendChild(l), c;
1341
1371
  }
1342
- function Sn(t, e) {
1343
- const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = H(t.nodes, e), i = document.createElementNS($, "a"), r = document.createElementNS($, "text");
1344
- return M(r, {
1372
+ function Cn(t, e) {
1373
+ const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = M(t.nodes, e), i = document.createElementNS(L, "a"), r = document.createElementNS(L, "text");
1374
+ return D(r, {
1345
1375
  x: o + "",
1346
1376
  y: s + parseInt(n.fontSize) + "",
1347
1377
  "text-anchor": "start",
@@ -1351,9 +1381,9 @@ function Sn(t, e) {
1351
1381
  fill: `${n.color}`
1352
1382
  }), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
1353
1383
  }
1354
- function Tn(t, e) {
1355
- const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = H(t.nodes, e), i = document.createElementNS($, "image");
1356
- return M(i, {
1384
+ function Sn(t, e) {
1385
+ const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = M(t.nodes, e), i = document.createElementNS(L, "image");
1386
+ return D(i, {
1357
1387
  x: o + "",
1358
1388
  y: s + "",
1359
1389
  width: n.width + "",
@@ -1361,40 +1391,40 @@ function Tn(t, e) {
1361
1391
  href: e.src
1362
1392
  }), i;
1363
1393
  }
1364
- const K = 100, Ln = '<?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">', Dn = (t, e = !1) => {
1365
- const n = t.nodes, o = n.offsetHeight + K * 2, s = n.offsetWidth + K * 2, i = vn(o + "px", s + "px"), r = document.createElementNS($, "svg"), c = document.createElementNS($, "rect");
1366
- M(c, {
1394
+ const F = 100, 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">', Tn = (t, e = !1) => {
1395
+ const n = t.nodes, o = n.offsetHeight + F * 2, s = n.offsetWidth + F * 2, i = yn(o + "px", s + "px"), r = document.createElementNS(L, "svg"), c = document.createElementNS(L, "rect");
1396
+ D(c, {
1367
1397
  x: "0",
1368
1398
  y: "0",
1369
1399
  width: `${s}`,
1370
1400
  height: `${o}`,
1371
1401
  fill: t.theme.cssVar["--bgcolor"]
1372
1402
  }), i.appendChild(c), n.querySelectorAll(".subLines").forEach((f) => {
1373
- const p = f.cloneNode(!0), { offsetLeft: m, offsetTop: y } = H(n, f.parentElement);
1374
- p.setAttribute("x", `${m}`), p.setAttribute("y", `${y}`), r.appendChild(p);
1403
+ const p = f.cloneNode(!0), { offsetLeft: w, offsetTop: y } = M(n, f.parentElement);
1404
+ p.setAttribute("x", `${w}`), p.setAttribute("y", `${y}`), r.appendChild(p);
1375
1405
  });
1376
- const d = n.querySelector(".lines")?.cloneNode(!0);
1377
- d && r.appendChild(d);
1406
+ const l = n.querySelector(".lines")?.cloneNode(!0);
1407
+ l && r.appendChild(l);
1378
1408
  const a = n.querySelector(".topiclinks")?.cloneNode(!0);
1379
1409
  a && r.appendChild(a);
1380
- const h = n.querySelector(".summary")?.cloneNode(!0);
1381
- return h && r.appendChild(h), n.querySelectorAll("me-tpc").forEach((f) => {
1382
- f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(U(t, f, !e)) : (r.appendChild(En(t, f)), r.appendChild(U(t, f.text, !e)));
1410
+ const d = n.querySelector(".summary")?.cloneNode(!0);
1411
+ return d && r.appendChild(d), n.querySelectorAll("me-tpc").forEach((f) => {
1412
+ f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(z(t, f, !e)) : (r.appendChild(xn(t, f)), r.appendChild(z(t, f.text, !e)));
1383
1413
  }), n.querySelectorAll(".tags > span").forEach((f) => {
1384
- r.appendChild(U(t, f));
1414
+ r.appendChild(z(t, f));
1385
1415
  }), n.querySelectorAll(".icons > span").forEach((f) => {
1386
- r.appendChild(U(t, f));
1416
+ r.appendChild(z(t, f));
1387
1417
  }), n.querySelectorAll(".hyper-link").forEach((f) => {
1388
- r.appendChild(Sn(t, f));
1418
+ r.appendChild(Cn(t, f));
1389
1419
  }), n.querySelectorAll("img").forEach((f) => {
1390
- r.appendChild(Tn(t, f));
1391
- }), M(r, {
1392
- x: K + "",
1393
- y: K + "",
1420
+ r.appendChild(Sn(t, f));
1421
+ }), D(r, {
1422
+ x: F + "",
1423
+ y: F + "",
1394
1424
  overflow: "visible"
1395
1425
  }), i.appendChild(r), i;
1396
- }, Mn = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), Ln + t.outerHTML);
1397
- function kn(t) {
1426
+ }, Dn = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), En + t.outerHTML);
1427
+ function Ln(t) {
1398
1428
  return new Promise((e, n) => {
1399
1429
  const o = new FileReader();
1400
1430
  o.onload = (s) => {
@@ -1404,11 +1434,11 @@ function kn(t) {
1404
1434
  }, o.readAsDataURL(t);
1405
1435
  });
1406
1436
  }
1407
- const Nn = function(t = !1, e) {
1408
- const n = Dn(this, t), o = Mn(n, e);
1437
+ const Mn = function(t = !1, e) {
1438
+ const n = Tn(this, t), o = Dn(n, e);
1409
1439
  return new Blob([o], { type: "image/svg+xml" });
1410
1440
  }, Pn = async function(t = !1, e) {
1411
- const n = this.exportSvg(t, e), o = await kn(n);
1441
+ const n = this.exportSvg(t, e), o = await Ln(n);
1412
1442
  return new Promise((s, i) => {
1413
1443
  const r = new Image();
1414
1444
  r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
@@ -1416,69 +1446,88 @@ const Nn = function(t = !1, e) {
1416
1446
  c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(s, "image/png", 1);
1417
1447
  }, r.src = o, r.onerror = i;
1418
1448
  });
1419
- }, An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1449
+ }, kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1420
1450
  __proto__: null,
1421
1451
  exportPng: Pn,
1422
- exportSvg: Nn
1423
- }, Symbol.toStringTag, { value: "Module" })), $n = {}, Hn = {
1424
- getObjById: J,
1425
- generateNewObj: Ht,
1426
- layout: Gt,
1452
+ exportSvg: Mn
1453
+ }, Symbol.toStringTag, { value: "Module" })), Nn = {}, An = {
1454
+ getObjById: G,
1455
+ generateNewObj: At,
1456
+ layout: Rt,
1427
1457
  linkDiv: Pe,
1428
- editTopic: Ut,
1429
- createWrapper: Ft,
1430
- createParent: _t,
1431
- createChildren: qt,
1432
- createTopic: jt,
1433
- findEle: St,
1434
- changeTheme: Ve,
1435
- ...xe,
1436
- ...$n,
1437
- ...rn,
1438
- ...wn,
1439
- ...An,
1458
+ editTopic: qt,
1459
+ createWrapper: zt,
1460
+ createParent: Ft,
1461
+ createChildren: Gt,
1462
+ createTopic: _t,
1463
+ findEle: Ct,
1464
+ changeTheme: Xe,
1465
+ ...ve,
1466
+ ...Nn,
1467
+ ...on,
1468
+ ...mn,
1469
+ ...kn,
1440
1470
  init(t) {
1441
1471
  if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
1442
- t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, lt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Ge(this), this.layout(), this.linkDiv(), this.toCenter();
1472
+ t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, nt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Re(this), this.layout(), this.linkDiv(), this.toCenter();
1443
1473
  },
1444
1474
  destroy() {
1445
- this.disposable.forEach((t) => t()), 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.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;
1475
+ this.disposable.forEach((t) => t()), 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.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.arrowSvg = 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;
1476
+ },
1477
+ /**
1478
+ * @public
1479
+ * @param {boolean} enable
1480
+ */
1481
+ enableMobileMultiSelect(t) {
1482
+ this.mobileMultiSelect = t;
1446
1483
  }
1447
1484
  };
1448
- function In({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: d, containerHeight: a }) {
1449
- let h = e + n / 2;
1485
+ function $n({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, containerHeight: a }) {
1486
+ let d = e + n / 2;
1450
1487
  const f = t + o / 2;
1451
1488
  let p;
1452
- d === G.LHS ? p = i + r : p = i;
1453
- const m = s + c / 2, u = (1 - Math.abs(m - f) / a) * 0.25 * (n / 2);
1454
- return d === G.LHS ? h = h - n / 10 - u : h = h + n / 10 + u, `M ${h} ${f} Q ${h} ${m} ${p} ${m}`;
1489
+ l === I.LHS ? p = i + r : p = i;
1490
+ const w = s + c / 2, u = (1 - Math.abs(w - f) / a) * 0.25 * (n / 2);
1491
+ return l === I.LHS ? d = d - n / 10 - u : d = d + n / 10 + u, `M ${d} ${f} Q ${d} ${w} ${p} ${w}`;
1455
1492
  }
1456
- function On({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: d, isFirst: a }) {
1457
- const h = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
1493
+ function Hn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, isFirst: a }) {
1494
+ const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
1458
1495
  let f = 0, p = 0;
1459
1496
  a ? f = t + o / 2 : f = t + o;
1460
- const m = s + c;
1497
+ const w = s + c;
1461
1498
  let y = 0, u = 0, g = 0;
1462
- const b = Math.abs(f - m) / 300 * h;
1463
- return d === G.LHS ? (g = e, y = g + h, u = g - h, p = i + h, `M ${y} ${f} C ${g} ${f} ${g + b} ${m} ${u} ${m} H ${p}`) : (g = e + n, y = g - h, u = g + h, p = i + r - h, `M ${y} ${f} C ${g} ${f} ${g - b} ${m} ${u} ${m} H ${p}`);
1499
+ const b = Math.abs(f - w) / 300 * d;
1500
+ return l === I.LHS ? (g = e, y = g + d, u = g - d, p = i + d, `M ${y} ${f} C ${g} ${f} ${g + b} ${w} ${u} ${w} H ${p}`) : (g = e + n, y = g - d, u = g + d, p = i + r - d, `M ${y} ${f} C ${g} ${f} ${g - b} ${w} ${u} ${w} H ${p}`);
1464
1501
  }
1465
- const Yn = "5.11.0";
1466
- function Bn(t) {
1502
+ const In = "5.11.1-beta.1";
1503
+ function On(t) {
1467
1504
  return {
1468
1505
  x: 0,
1469
1506
  y: 0,
1470
1507
  moved: !1,
1471
- // diffrentiate click and move
1508
+ // differentiate click and move
1472
1509
  mousedown: !1,
1473
- onMove(e, n) {
1474
- this.mousedown && (this.moved = !0, t.move(e, n));
1510
+ handlePointerDown(e) {
1511
+ this.moved = !1;
1512
+ const n = e.target, o = t.mouseSelectionButton === 0 ? 2 : 0, s = t.spacePressed && e.button === 0 && e.pointerType === "mouse", i = !t.editable || e.button === o && e.pointerType === "mouse" || e.pointerType === "touch";
1513
+ !s && !i || (this.x = e.clientX, this.y = e.clientY, n.className !== "circle" && n.contentEditable !== "plaintext-only" && (this.mousedown = !0, n.setPointerCapture(e.pointerId)));
1514
+ },
1515
+ handlePointerMove(e) {
1516
+ if (!this.mousedown || e.target.contentEditable === "plaintext-only" && !t.spacePressed) return !1;
1517
+ const n = e.clientX - this.x, o = e.clientY - this.y;
1518
+ return this.x = e.clientX, this.y = e.clientY, this.moved = !0, t.move(n, o), !0;
1519
+ },
1520
+ handlePointerUp(e) {
1521
+ if (!this.mousedown) return;
1522
+ const n = e.target;
1523
+ n.hasPointerCapture && n.hasPointerCapture(e.pointerId) && n.releasePointerCapture(e.pointerId), this.mousedown = !1;
1475
1524
  },
1476
1525
  clear() {
1477
- this.mousedown = !1;
1526
+ this.mousedown = !1, this.moved = !1;
1478
1527
  }
1479
1528
  };
1480
1529
  }
1481
- function O({
1530
+ function A({
1482
1531
  el: t,
1483
1532
  direction: e,
1484
1533
  editable: n,
@@ -1487,50 +1536,51 @@ function O({
1487
1536
  keypress: i,
1488
1537
  mouseSelectionButton: r,
1489
1538
  selectionContainer: c,
1490
- before: d,
1539
+ before: l,
1491
1540
  newTopicName: a,
1492
- allowUndo: h,
1541
+ allowUndo: d,
1493
1542
  generateMainBranch: f,
1494
1543
  generateSubBranch: p,
1495
- overflowHidden: m,
1544
+ overflowHidden: w,
1496
1545
  theme: y,
1497
1546
  alignment: u,
1498
1547
  scaleSensitivity: g,
1499
1548
  scaleMax: b,
1500
1549
  scaleMin: v,
1501
- handleWheel: x,
1502
- markdown: S,
1503
- imageProxy: T,
1504
- pasteHandler: L
1550
+ handleWheel: C,
1551
+ markdown: T,
1552
+ imageProxy: h,
1553
+ pasteHandler: m,
1554
+ mobileMultiSelect: x
1505
1555
  }) {
1506
- let C = null;
1507
- const P = Object.prototype.toString.call(t);
1508
- if (P === "[object HTMLDivElement]" ? C = t : P === "[object String]" && (C = document.querySelector(t)), !C) throw new Error("MindElixir: el is not a valid element");
1509
- C.style.position = "relative", C.innerHTML = "", this.el = C, this.disposable = [], this.before = d || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = h ?? !0, this.scaleSensitivity = g ?? 0.1, this.scaleMax = b ?? 1.4, this.scaleMin = v ?? 0.2, this.generateMainBranch = f || In, this.generateSubBranch = p || On, this.overflowHidden = m ?? !1, this.alignment = u ?? "root", this.handleWheel = x ?? !0, this.markdown = S || void 0, this.imageProxy = T || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.panHelper = Bn(this), this.bus = ke(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
1510
- const k = window.matchMedia("(prefers-color-scheme: dark)");
1511
- this.theme = y || (k.matches ? ct : rt);
1512
- const Y = document.createElement("div");
1513
- Y.className = "map-canvas", this.map = Y, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = F("lines"), this.summarySvg = F("summary"), this.linkController = F("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = mt(), this.line2 = mt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = F("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Me(this)), L && (this.pasteHandler = L);
1556
+ let S = null;
1557
+ const E = Object.prototype.toString.call(t);
1558
+ if (E === "[object HTMLDivElement]" ? S = t : E === "[object String]" && (S = document.querySelector(t)), !S) throw new Error("MindElixir: el is not a valid element");
1559
+ S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = l || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = d ?? !0, this.scaleSensitivity = g ?? 0.1, this.scaleMax = b ?? 1.4, this.scaleMin = v ?? 0.2, this.generateMainBranch = f || $n, this.generateSubBranch = p || Hn, this.overflowHidden = w ?? !1, this.alignment = u ?? "root", this.handleWheel = C ?? !0, this.markdown = T || void 0, this.imageProxy = h || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = x ?? !1, this.panHelper = On(this), this.bus = Le(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
1560
+ const P = window.matchMedia("(prefers-color-scheme: dark)");
1561
+ this.theme = y || (P.matches ? et : tt);
1562
+ const k = document.createElement("div");
1563
+ k.className = "map-canvas", this.map = k, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = W("lines"), this.summarySvg = W("summary"), this.linkController = W("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = pt(), this.line2 = pt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = W("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(De(this)), m && (this.pasteHandler = m);
1514
1564
  }
1515
- O.prototype = Hn;
1516
- Object.defineProperty(O.prototype, "currentNode", {
1565
+ A.prototype = An;
1566
+ Object.defineProperty(A.prototype, "currentNode", {
1517
1567
  get() {
1518
1568
  return this.currentNodes[this.currentNodes.length - 1];
1519
1569
  },
1520
1570
  enumerable: !0
1521
1571
  });
1522
- O.LEFT = 0;
1523
- O.RIGHT = 1;
1524
- O.SIDE = 2;
1525
- O.THEME = rt;
1526
- O.DARK_THEME = ct;
1527
- O.version = Yn;
1528
- O.E = St;
1572
+ A.LEFT = 0;
1573
+ A.RIGHT = 1;
1574
+ A.SIDE = 2;
1575
+ A.THEME = tt;
1576
+ A.DARK_THEME = et;
1577
+ A.version = In;
1578
+ A.E = Ct;
1529
1579
  export {
1530
- ct as DARK_THEME,
1531
- Wn as LEFT,
1532
- Rn as RIGHT,
1533
- Xn as SIDE,
1534
- rt as THEME,
1535
- O as default
1580
+ et as DARK_THEME,
1581
+ Bn as LEFT,
1582
+ Wn as RIGHT,
1583
+ Yn as SIDE,
1584
+ tt as THEME,
1585
+ A as default
1536
1586
  };