mind-elixir 5.9.0 → 5.9.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.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +601 -602
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +538 -539
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/MindElixir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Zo = 0, Qo = 1, es = 2, be = {
|
|
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 os = 0, ss = 1, is = 2, Se = {
|
|
|
25
25
|
"--panel-border-color": "#eaeaea",
|
|
26
26
|
"--map-padding": "50px 80px"
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, we = {
|
|
29
29
|
name: "Dark",
|
|
30
30
|
type: "dark",
|
|
31
31
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -53,42 +53,42 @@ const os = 0, ss = 1, is = 2, Se = {
|
|
|
53
53
|
"--map-padding": "50px 80px"
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
function
|
|
56
|
+
function me(e) {
|
|
57
57
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const le = function(e, t) {
|
|
60
60
|
if (t.id === e)
|
|
61
61
|
return t;
|
|
62
62
|
if (t.children && t.children.length) {
|
|
63
63
|
for (let n = 0; n < t.children.length; n++) {
|
|
64
|
-
const o =
|
|
64
|
+
const o = le(e, t.children[n]);
|
|
65
65
|
if (o) return o;
|
|
66
66
|
}
|
|
67
67
|
return null;
|
|
68
68
|
} else
|
|
69
69
|
return null;
|
|
70
|
-
},
|
|
70
|
+
}, G = (e, t) => {
|
|
71
71
|
if (e.parent = t, e.children)
|
|
72
72
|
for (let n = 0; n < e.children.length; n++)
|
|
73
|
-
|
|
74
|
-
},
|
|
73
|
+
G(e.children[n], e);
|
|
74
|
+
}, U = (e, t, n) => {
|
|
75
75
|
if (e.expanded = t, e.children)
|
|
76
76
|
if (n === void 0 || n > 0) {
|
|
77
77
|
const o = n !== void 0 ? n - 1 : void 0;
|
|
78
78
|
e.children.forEach((s) => {
|
|
79
|
-
|
|
79
|
+
U(s, t, o);
|
|
80
80
|
});
|
|
81
81
|
} else
|
|
82
82
|
e.children.forEach((o) => {
|
|
83
|
-
|
|
83
|
+
U(o, !1);
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
function
|
|
86
|
+
function xe(e) {
|
|
87
87
|
if (e.id = V(), e.children)
|
|
88
88
|
for (let t = 0; t < e.children.length; t++)
|
|
89
|
-
|
|
89
|
+
xe(e.children[t]);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function ce(e, t, n, o) {
|
|
92
92
|
const s = n - e, i = o - t, c = Math.atan2(i, s) * 180 / Math.PI, r = 12, a = 30, d = (c + 180 - a) * Math.PI / 180, h = (c + 180 + a) * Math.PI / 180;
|
|
93
93
|
return {
|
|
94
94
|
x1: n + Math.cos(d) * r,
|
|
@@ -100,14 +100,14 @@ function fe(e, t, n, o) {
|
|
|
100
100
|
function V() {
|
|
101
101
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
102
102
|
}
|
|
103
|
-
const
|
|
103
|
+
const gt = function() {
|
|
104
104
|
const e = V();
|
|
105
105
|
return {
|
|
106
106
|
topic: this.newTopicName,
|
|
107
107
|
id: e
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
function
|
|
110
|
+
function Ce(e) {
|
|
111
111
|
return JSON.parse(
|
|
112
112
|
JSON.stringify(e, (n, o) => {
|
|
113
113
|
if (n !== "parent")
|
|
@@ -115,7 +115,7 @@ function Te(e) {
|
|
|
115
115
|
})
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const j = (e, t) => {
|
|
119
119
|
let n = 0, o = 0;
|
|
120
120
|
for (; t && t !== e; )
|
|
121
121
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
@@ -123,7 +123,7 @@ const H = (e, t) => {
|
|
|
123
123
|
}, A = (e, t) => {
|
|
124
124
|
for (const n in t)
|
|
125
125
|
e.setAttribute(n, t[n]);
|
|
126
|
-
},
|
|
126
|
+
}, re = (e) => e ? e.tagName === "ME-TPC" : !1, Ee = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
127
127
|
for (let s = 0; s < o.length; s++) {
|
|
128
128
|
if (t === o[s]) continue;
|
|
129
129
|
const { parent: i } = t.nodeObj;
|
|
@@ -131,10 +131,10 @@ const H = (e, t) => {
|
|
|
131
131
|
return !1;
|
|
132
132
|
}
|
|
133
133
|
return !0;
|
|
134
|
-
}),
|
|
134
|
+
}), Se = (e) => {
|
|
135
135
|
const t = /translate3d\(([^,]+),\s*([^,]+)/, n = e.match(t);
|
|
136
136
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
137
|
-
},
|
|
137
|
+
}, Qe = function(e) {
|
|
138
138
|
for (let t = 0; t < e.length; t++) {
|
|
139
139
|
const { dom: n, evt: o, func: s } = e[t];
|
|
140
140
|
n.addEventListener(o, s);
|
|
@@ -145,17 +145,17 @@ const H = (e, t) => {
|
|
|
145
145
|
o.removeEventListener(s, i);
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
},
|
|
148
|
+
}, Pe = (e, t) => {
|
|
149
149
|
const n = e.x - t.x, o = e.y - t.y;
|
|
150
150
|
return Math.sqrt(n * n + o * o);
|
|
151
|
-
},
|
|
151
|
+
}, R = {
|
|
152
152
|
LHS: "lhs",
|
|
153
153
|
RHS: "rhs"
|
|
154
|
-
},
|
|
154
|
+
}, mt = function() {
|
|
155
155
|
this.nodes.innerHTML = "";
|
|
156
156
|
const e = this.createTopic(this.nodeData);
|
|
157
|
-
|
|
158
|
-
const t =
|
|
157
|
+
Ne.call(this, e, this.nodeData), e.draggable = !1;
|
|
158
|
+
const t = document.createElement("me-root");
|
|
159
159
|
t.appendChild(e);
|
|
160
160
|
const n = this.nodeData.children || [];
|
|
161
161
|
if (this.direction === 2) {
|
|
@@ -164,29 +164,29 @@ const H = (e, t) => {
|
|
|
164
164
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
},
|
|
169
|
-
const o =
|
|
170
|
-
o.className =
|
|
171
|
-
const s =
|
|
172
|
-
s.className =
|
|
167
|
+
yt(this, n, t);
|
|
168
|
+
}, yt = function(e, t, n) {
|
|
169
|
+
const o = document.createElement("me-main");
|
|
170
|
+
o.className = R.LHS;
|
|
171
|
+
const s = document.createElement("me-main");
|
|
172
|
+
s.className = R.RHS;
|
|
173
173
|
for (let i = 0; i < t.length; i++) {
|
|
174
174
|
const l = t[i], { grp: c } = e.createWrapper(l);
|
|
175
175
|
e.direction === 2 ? l.direction === 0 ? o.appendChild(c) : s.appendChild(c) : e.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
176
176
|
}
|
|
177
177
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
|
|
178
|
-
},
|
|
179
|
-
const n =
|
|
178
|
+
}, vt = function(e, t) {
|
|
179
|
+
const n = document.createElement("me-children");
|
|
180
180
|
for (let o = 0; o < t.length; o++) {
|
|
181
181
|
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
182
182
|
n.appendChild(i);
|
|
183
183
|
}
|
|
184
184
|
return n;
|
|
185
|
-
},
|
|
185
|
+
}, et = function(e, t) {
|
|
186
186
|
const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
187
187
|
if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
188
188
|
return o;
|
|
189
|
-
},
|
|
189
|
+
}, Ne = function(e, t) {
|
|
190
190
|
if (e.innerHTML = "", t.style) {
|
|
191
191
|
const n = t.style;
|
|
192
192
|
for (const o in n)
|
|
@@ -199,58 +199,58 @@ const H = (e, t) => {
|
|
|
199
199
|
if (t.image) {
|
|
200
200
|
const n = t.image;
|
|
201
201
|
if (n.url && n.width && n.height) {
|
|
202
|
-
const o =
|
|
202
|
+
const o = document.createElement("img");
|
|
203
203
|
o.src = this.imageProxy ? this.imageProxy(n.url) : n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
|
|
204
204
|
}
|
|
205
205
|
} else e.image && (e.image = void 0);
|
|
206
206
|
{
|
|
207
|
-
const n =
|
|
207
|
+
const n = document.createElement("span");
|
|
208
208
|
n.className = "text", this.markdown ? n.innerHTML = this.markdown(t.topic, t) : n.textContent = t.topic, e.appendChild(n), e.text = n;
|
|
209
209
|
}
|
|
210
210
|
if (t.hyperLink) {
|
|
211
|
-
const n =
|
|
211
|
+
const n = document.createElement("a");
|
|
212
212
|
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
|
|
213
213
|
} else e.link && (e.link = void 0);
|
|
214
214
|
if (t.icons && t.icons.length) {
|
|
215
|
-
const n =
|
|
216
|
-
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${
|
|
215
|
+
const n = document.createElement("span");
|
|
216
|
+
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${me(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
217
217
|
} else e.icons && (e.icons = void 0);
|
|
218
218
|
if (t.tags && t.tags.length) {
|
|
219
|
-
const n =
|
|
219
|
+
const n = document.createElement("div");
|
|
220
220
|
n.className = "tags", t.tags.forEach((o) => {
|
|
221
|
-
const s =
|
|
221
|
+
const s = document.createElement("span");
|
|
222
222
|
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);
|
|
223
223
|
}), e.appendChild(n), e.tags = n;
|
|
224
224
|
} else e.tags && (e.tags = void 0);
|
|
225
|
-
},
|
|
226
|
-
const n =
|
|
225
|
+
}, bt = function(e, t) {
|
|
226
|
+
const n = document.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
227
227
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
228
|
-
const i =
|
|
228
|
+
const i = ke(e.expanded);
|
|
229
229
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
230
|
-
const l =
|
|
230
|
+
const l = vt(this, e.children);
|
|
231
231
|
n.appendChild(l);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
return { grp: n, top: o, tpc: s };
|
|
235
|
-
},
|
|
236
|
-
const t =
|
|
237
|
-
return
|
|
238
|
-
},
|
|
239
|
-
const t =
|
|
235
|
+
}, wt = function(e) {
|
|
236
|
+
const t = document.createElement("me-parent"), n = this.createTopic(e);
|
|
237
|
+
return Ne.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
238
|
+
}, xt = function(e) {
|
|
239
|
+
const t = document.createElement("me-children");
|
|
240
240
|
return t.append(...e), t;
|
|
241
|
-
},
|
|
242
|
-
const t =
|
|
241
|
+
}, Ct = function(e) {
|
|
242
|
+
const t = document.createElement("me-tpc");
|
|
243
243
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t;
|
|
244
244
|
};
|
|
245
|
-
function
|
|
246
|
-
const t =
|
|
245
|
+
function tt(e) {
|
|
246
|
+
const t = document.createRange();
|
|
247
247
|
t.selectNodeContents(e);
|
|
248
248
|
const n = window.getSelection();
|
|
249
249
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
250
250
|
}
|
|
251
|
-
const
|
|
251
|
+
const Et = function(e) {
|
|
252
252
|
if (!e) return;
|
|
253
|
-
const t =
|
|
253
|
+
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = j(this.nodes, e);
|
|
254
254
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
255
255
|
const l = getComputedStyle(e);
|
|
256
256
|
t.style.cssText = `
|
|
@@ -263,7 +263,7 @@ const _t = function(e) {
|
|
|
263
263
|
margin:${l.margin};
|
|
264
264
|
background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor};
|
|
265
265
|
border: ${l.border};
|
|
266
|
-
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"),
|
|
266
|
+
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), tt(t), this.bus.fire("operation", {
|
|
267
267
|
name: "beginEdit",
|
|
268
268
|
obj: e.nodeObj
|
|
269
269
|
}), t.addEventListener("keydown", (c) => {
|
|
@@ -283,48 +283,48 @@ const _t = function(e) {
|
|
|
283
283
|
origin: o
|
|
284
284
|
}));
|
|
285
285
|
});
|
|
286
|
-
},
|
|
287
|
-
const t =
|
|
286
|
+
}, ke = function(e) {
|
|
287
|
+
const t = document.createElement("me-epd");
|
|
288
288
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
289
|
-
},
|
|
289
|
+
}, J = (e) => {
|
|
290
290
|
const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
|
|
291
291
|
return { siblings: t, index: n };
|
|
292
292
|
};
|
|
293
|
-
function
|
|
294
|
-
const { siblings: t, index: n } =
|
|
293
|
+
function St(e) {
|
|
294
|
+
const { siblings: t, index: n } = J(e);
|
|
295
295
|
if (t === void 0) return;
|
|
296
296
|
const o = t[n];
|
|
297
297
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
const { siblings: t, index: n } =
|
|
299
|
+
function Nt(e) {
|
|
300
|
+
const { siblings: t, index: n } = J(e);
|
|
301
301
|
if (t === void 0) return;
|
|
302
302
|
const o = t[n];
|
|
303
303
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
const { siblings: t, index: n } =
|
|
305
|
+
function nt(e) {
|
|
306
|
+
const { siblings: t, index: n } = J(e);
|
|
307
307
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
308
308
|
}
|
|
309
|
-
function
|
|
310
|
-
const { siblings: o, index: s } =
|
|
309
|
+
function kt(e, t, n) {
|
|
310
|
+
const { siblings: o, index: s } = J(n);
|
|
311
311
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
const { siblings: n, index: o } =
|
|
313
|
+
function Tt(e, t) {
|
|
314
|
+
const { siblings: n, index: o } = J(e);
|
|
315
315
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
if (
|
|
317
|
+
function _t(e, t, n) {
|
|
318
|
+
if (nt(t), n.parent?.parent || (t.direction = n.direction), e === "in")
|
|
319
319
|
n.children ? n.children.push(t) : n.children = [t];
|
|
320
320
|
else {
|
|
321
321
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
322
|
-
const { siblings: o, index: s } =
|
|
322
|
+
const { siblings: o, index: s } = J(n);
|
|
323
323
|
if (o === void 0) return;
|
|
324
324
|
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
const
|
|
327
|
+
const Lt = function({ map: e, direction: t }, n) {
|
|
328
328
|
if (t === 0)
|
|
329
329
|
return 0;
|
|
330
330
|
if (t === 1)
|
|
@@ -333,48 +333,48 @@ const Ot = function({ map: e, direction: t }, n) {
|
|
|
333
333
|
const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
|
|
334
334
|
return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
|
|
335
335
|
}
|
|
336
|
-
},
|
|
336
|
+
}, ot = function(e, t, n) {
|
|
337
337
|
const o = n.children[0].children[0], s = t.parentElement;
|
|
338
338
|
if (s.tagName === "ME-PARENT") {
|
|
339
|
-
if (
|
|
339
|
+
if (ee(o), s.children[1])
|
|
340
340
|
s.nextSibling.appendChild(n);
|
|
341
341
|
else {
|
|
342
342
|
const i = e.createChildren([n]);
|
|
343
|
-
s.appendChild(
|
|
343
|
+
s.appendChild(ke(!0)), s.insertAdjacentElement("afterend", i);
|
|
344
344
|
}
|
|
345
345
|
e.linkDiv(n.offsetParent);
|
|
346
|
-
} else s.tagName === "ME-ROOT" && (
|
|
347
|
-
},
|
|
346
|
+
} else s.tagName === "ME-ROOT" && (Lt(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
|
|
347
|
+
}, At = function(e, t) {
|
|
348
348
|
const n = e.parentNode;
|
|
349
349
|
if (t === 0) {
|
|
350
350
|
const o = n.parentNode.parentNode;
|
|
351
351
|
o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
|
|
352
352
|
}
|
|
353
353
|
n.parentNode.remove();
|
|
354
|
-
},
|
|
354
|
+
}, st = {
|
|
355
355
|
before: "beforebegin",
|
|
356
356
|
after: "afterend"
|
|
357
|
-
},
|
|
357
|
+
}, ee = function(e) {
|
|
358
358
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
359
359
|
n?.tagName === "svg" && n?.remove();
|
|
360
|
-
},
|
|
361
|
-
const n = e.nodeObj, o =
|
|
360
|
+
}, Dt = function(e, t) {
|
|
361
|
+
const n = e.nodeObj, o = Ce(n);
|
|
362
362
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
363
363
|
const s = Object.assign(n, t);
|
|
364
|
-
|
|
364
|
+
Ne.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
365
365
|
name: "reshapeNode",
|
|
366
366
|
obj: s,
|
|
367
367
|
origin: o
|
|
368
368
|
});
|
|
369
|
-
},
|
|
369
|
+
}, Te = function(e, t, n) {
|
|
370
370
|
if (!t) return null;
|
|
371
371
|
const o = t.nodeObj;
|
|
372
372
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
373
373
|
const s = n || e.generateNewObj();
|
|
374
|
-
o.children ? o.children.push(s) : o.children = [s],
|
|
374
|
+
o.children ? o.children.push(s) : o.children = [s], G(e.nodeData);
|
|
375
375
|
const { grp: i, top: l } = e.createWrapper(s);
|
|
376
|
-
return
|
|
377
|
-
},
|
|
376
|
+
return ot(e, t, i), { newTop: l, newNodeObj: s };
|
|
377
|
+
}, Mt = function(e, t, n) {
|
|
378
378
|
const o = t || this.currentNode;
|
|
379
379
|
if (!o) return;
|
|
380
380
|
const s = o.nodeObj;
|
|
@@ -392,58 +392,58 @@ const Ot = function({ map: e, direction: t }, n) {
|
|
|
392
392
|
}
|
|
393
393
|
const i = n || this.generateNewObj();
|
|
394
394
|
if (!s.parent?.parent) {
|
|
395
|
-
const a = o.closest("me-main").className ===
|
|
395
|
+
const a = o.closest("me-main").className === R.LHS ? 0 : 1;
|
|
396
396
|
i.direction = a;
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
kt(i, e, s), G(this.nodeData);
|
|
399
399
|
const l = o.parentElement, { grp: c, top: r } = this.createWrapper(i);
|
|
400
|
-
l.parentElement.insertAdjacentElement(
|
|
400
|
+
l.parentElement.insertAdjacentElement(st[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(r.firstChild), this.bus.fire("operation", {
|
|
401
401
|
name: "insertSibling",
|
|
402
402
|
type: e,
|
|
403
403
|
obj: i
|
|
404
404
|
}), this.selectNode(r.firstChild, !0);
|
|
405
|
-
},
|
|
405
|
+
}, Pt = function(e, t) {
|
|
406
406
|
const n = e || this.currentNode;
|
|
407
407
|
if (!n) return;
|
|
408
|
-
|
|
408
|
+
ee(n);
|
|
409
409
|
const o = n.nodeObj;
|
|
410
410
|
if (!o.parent)
|
|
411
411
|
return;
|
|
412
412
|
const s = t || this.generateNewObj();
|
|
413
|
-
|
|
413
|
+
Tt(o, s), G(this.nodeData);
|
|
414
414
|
const i = n.parentElement.parentElement, { grp: l, top: c } = this.createWrapper(s, !0);
|
|
415
|
-
c.appendChild(
|
|
415
|
+
c.appendChild(ke(!0)), i.insertAdjacentElement("afterend", l);
|
|
416
416
|
const r = this.createChildren([i]);
|
|
417
417
|
c.insertAdjacentElement("afterend", r), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
|
|
418
418
|
name: "insertParent",
|
|
419
419
|
obj: s
|
|
420
420
|
});
|
|
421
|
-
},
|
|
421
|
+
}, Ot = function(e, t) {
|
|
422
422
|
const n = e || this.currentNode;
|
|
423
423
|
if (!n) return;
|
|
424
|
-
const o =
|
|
424
|
+
const o = Te(this, n, t);
|
|
425
425
|
if (!o) return;
|
|
426
426
|
const { newTop: s, newNodeObj: i } = o;
|
|
427
427
|
this.bus.fire("operation", {
|
|
428
428
|
name: "addChild",
|
|
429
429
|
obj: i
|
|
430
430
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
431
|
-
},
|
|
432
|
-
const n =
|
|
433
|
-
|
|
434
|
-
const o =
|
|
431
|
+
}, $t = function(e, t) {
|
|
432
|
+
const n = Ce(e.nodeObj);
|
|
433
|
+
xe(n);
|
|
434
|
+
const o = Te(this, t, n);
|
|
435
435
|
if (!o) return;
|
|
436
436
|
const { newNodeObj: s } = o;
|
|
437
437
|
this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
|
|
438
438
|
name: "copyNode",
|
|
439
439
|
obj: s
|
|
440
440
|
});
|
|
441
|
-
},
|
|
441
|
+
}, jt = function(e, t) {
|
|
442
442
|
const n = [];
|
|
443
443
|
for (let o = 0; o < e.length; o++) {
|
|
444
|
-
const s = e[o], i =
|
|
445
|
-
|
|
446
|
-
const l =
|
|
444
|
+
const s = e[o], i = Ce(s.nodeObj);
|
|
445
|
+
xe(i);
|
|
446
|
+
const l = Te(this, t, i);
|
|
447
447
|
if (!l) return;
|
|
448
448
|
const { newNodeObj: c } = l;
|
|
449
449
|
n.push(c);
|
|
@@ -452,52 +452,52 @@ const Ot = function({ map: e, direction: t }, n) {
|
|
|
452
452
|
name: "copyNodes",
|
|
453
453
|
objs: n
|
|
454
454
|
});
|
|
455
|
-
},
|
|
455
|
+
}, Ht = function(e) {
|
|
456
456
|
const t = e || this.currentNode;
|
|
457
457
|
if (!t) return;
|
|
458
458
|
const n = t.nodeObj;
|
|
459
|
-
|
|
459
|
+
St(n);
|
|
460
460
|
const o = t.parentNode.parentNode;
|
|
461
461
|
o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
|
|
462
462
|
name: "moveUpNode",
|
|
463
463
|
obj: n
|
|
464
464
|
});
|
|
465
|
-
},
|
|
465
|
+
}, Rt = function(e) {
|
|
466
466
|
const t = e || this.currentNode;
|
|
467
467
|
if (!t) return;
|
|
468
468
|
const n = t.nodeObj;
|
|
469
|
-
|
|
469
|
+
Nt(n);
|
|
470
470
|
const o = t.parentNode.parentNode;
|
|
471
471
|
o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
|
|
472
472
|
name: "moveDownNode",
|
|
473
473
|
obj: n
|
|
474
474
|
});
|
|
475
|
-
},
|
|
475
|
+
}, It = function(e) {
|
|
476
476
|
if (e.length === 0) return;
|
|
477
|
-
e =
|
|
477
|
+
e = Ee(e);
|
|
478
478
|
for (const n of e) {
|
|
479
|
-
const o = n.nodeObj, s =
|
|
480
|
-
|
|
479
|
+
const o = n.nodeObj, s = nt(o);
|
|
480
|
+
At(n, s);
|
|
481
481
|
}
|
|
482
482
|
const t = e[e.length - 1];
|
|
483
483
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
484
484
|
name: "removeNodes",
|
|
485
485
|
objs: e.map((n) => n.nodeObj)
|
|
486
486
|
});
|
|
487
|
-
},
|
|
488
|
-
e =
|
|
487
|
+
}, _e = (e, t, n, o) => {
|
|
488
|
+
e = Ee(e);
|
|
489
489
|
let s = n.nodeObj;
|
|
490
490
|
t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
|
|
491
491
|
const i = [];
|
|
492
492
|
for (const c of e) {
|
|
493
493
|
const r = c.nodeObj;
|
|
494
|
-
if (
|
|
494
|
+
if (_t(t, r, s), G(o.nodeData), t === "in") {
|
|
495
495
|
const a = c.parentElement;
|
|
496
|
-
|
|
496
|
+
ot(o, n, a.parentElement);
|
|
497
497
|
} else {
|
|
498
|
-
|
|
498
|
+
ee(c);
|
|
499
499
|
const a = c.parentElement.parentNode;
|
|
500
|
-
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(
|
|
500
|
+
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(st[t], a);
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
for (const c of i)
|
|
@@ -509,36 +509,36 @@ const Ot = function({ map: e, direction: t }, n) {
|
|
|
509
509
|
objs: e.map((c) => c.nodeObj),
|
|
510
510
|
toObj: s
|
|
511
511
|
});
|
|
512
|
-
},
|
|
513
|
-
|
|
514
|
-
},
|
|
515
|
-
|
|
516
|
-
},
|
|
517
|
-
|
|
518
|
-
},
|
|
512
|
+
}, Bt = function(e, t) {
|
|
513
|
+
_e(e, "in", t, this);
|
|
514
|
+
}, Ft = function(e, t) {
|
|
515
|
+
_e(e, "before", t, this);
|
|
516
|
+
}, Yt = function(e, t) {
|
|
517
|
+
_e(e, "after", t, this);
|
|
518
|
+
}, Wt = function(e) {
|
|
519
519
|
const t = e || this.currentNode;
|
|
520
520
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
521
|
-
},
|
|
521
|
+
}, Xt = function(e, t) {
|
|
522
522
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
523
|
-
},
|
|
523
|
+
}, it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
524
524
|
__proto__: null,
|
|
525
|
-
addChild:
|
|
526
|
-
beginEdit:
|
|
527
|
-
copyNode:
|
|
528
|
-
copyNodes:
|
|
529
|
-
insertParent:
|
|
530
|
-
insertSibling:
|
|
531
|
-
moveDownNode:
|
|
532
|
-
moveNodeAfter:
|
|
533
|
-
moveNodeBefore:
|
|
534
|
-
moveNodeIn:
|
|
535
|
-
moveUpNode:
|
|
536
|
-
removeNodes:
|
|
537
|
-
reshapeNode:
|
|
538
|
-
rmSubline:
|
|
539
|
-
setNodeTopic:
|
|
525
|
+
addChild: Ot,
|
|
526
|
+
beginEdit: Wt,
|
|
527
|
+
copyNode: $t,
|
|
528
|
+
copyNodes: jt,
|
|
529
|
+
insertParent: Pt,
|
|
530
|
+
insertSibling: Mt,
|
|
531
|
+
moveDownNode: Rt,
|
|
532
|
+
moveNodeAfter: Yt,
|
|
533
|
+
moveNodeBefore: Ft,
|
|
534
|
+
moveNodeIn: Bt,
|
|
535
|
+
moveUpNode: Ht,
|
|
536
|
+
removeNodes: It,
|
|
537
|
+
reshapeNode: Dt,
|
|
538
|
+
rmSubline: ee,
|
|
539
|
+
setNodeTopic: Xt
|
|
540
540
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
541
|
-
function
|
|
541
|
+
function zt(e) {
|
|
542
542
|
return {
|
|
543
543
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
544
544
|
arrows: e.arrows,
|
|
@@ -547,49 +547,49 @@ function Ut(e) {
|
|
|
547
547
|
theme: e.theme
|
|
548
548
|
};
|
|
549
549
|
}
|
|
550
|
-
const
|
|
550
|
+
const Gt = function(e) {
|
|
551
551
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
552
552
|
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
553
553
|
const i = n.left + n.width / 2, l = n.top + n.height / 2, c = o.left + o.width / 2, r = o.top + o.height / 2, a = i - c, d = l - r;
|
|
554
554
|
this.move(-a, -d, !0);
|
|
555
555
|
}
|
|
556
|
-
},
|
|
556
|
+
}, Vt = function(e, t, n) {
|
|
557
557
|
this.clearSelection(), this.scrollIntoView(e), this.selection?.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
558
|
-
},
|
|
558
|
+
}, qt = function(e) {
|
|
559
559
|
this.selection?.select(e);
|
|
560
|
-
},
|
|
560
|
+
}, Kt = function(e) {
|
|
561
561
|
this.selection?.deselect(e);
|
|
562
|
-
},
|
|
562
|
+
}, Ut = function() {
|
|
563
563
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
564
|
-
},
|
|
564
|
+
}, Le = function(e) {
|
|
565
565
|
return JSON.stringify(e, (t, n) => {
|
|
566
566
|
if (!(t === "parent" && typeof n != "string"))
|
|
567
567
|
return n;
|
|
568
568
|
});
|
|
569
|
-
},
|
|
570
|
-
const e =
|
|
571
|
-
return
|
|
572
|
-
},
|
|
569
|
+
}, Jt = function() {
|
|
570
|
+
const e = zt(this);
|
|
571
|
+
return Le(e);
|
|
572
|
+
}, Zt = function() {
|
|
573
573
|
return JSON.parse(this.getDataString());
|
|
574
|
-
},
|
|
574
|
+
}, Qt = function() {
|
|
575
575
|
this.editable = !0;
|
|
576
|
-
},
|
|
576
|
+
}, en = function() {
|
|
577
577
|
this.editable = !1;
|
|
578
|
-
},
|
|
578
|
+
}, tn = function(e, t = { x: 0, y: 0 }) {
|
|
579
579
|
if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
|
|
580
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } =
|
|
580
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = Ae(this), c = this.map.style.transform, { x: r, y: a } = Se(c), d = r - i, h = a - l, u = this.scaleVal, y = (-o + d) * (1 - e / u), v = (-s + h) * (1 - e / u);
|
|
581
581
|
this.map.style.transform = `translate3d(${r - y}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
582
|
-
},
|
|
582
|
+
}, nn = function() {
|
|
583
583
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
584
584
|
this.scaleVal = n;
|
|
585
|
-
const { dx: o, dy: s } =
|
|
585
|
+
const { dx: o, dy: s } = Ae(this, !0);
|
|
586
586
|
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
587
|
-
},
|
|
587
|
+
}, on = function(e, t, n = !1) {
|
|
588
588
|
const { map: o, scaleVal: s, bus: i, container: l, nodes: c } = this;
|
|
589
589
|
if (n && o.style.transition === "transform 0.3s")
|
|
590
590
|
return;
|
|
591
591
|
const r = o.style.transform;
|
|
592
|
-
let { x: a, y: d } =
|
|
592
|
+
let { x: a, y: d } = Se(r);
|
|
593
593
|
const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(), y = u.left < h.right && u.right > h.left, v = u.top < h.bottom && u.bottom > h.top;
|
|
594
594
|
if (y) {
|
|
595
595
|
const p = u.left + e, g = u.right + e;
|
|
@@ -602,7 +602,7 @@ const Jt = function(e) {
|
|
|
602
602
|
a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
603
603
|
o.style.transition = "none";
|
|
604
604
|
}, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
605
|
-
},
|
|
605
|
+
}, Ae = (e, t = !1) => {
|
|
606
606
|
const { container: n, map: o, nodes: s } = e;
|
|
607
607
|
let i, l;
|
|
608
608
|
if (e.alignment === "nodes" || t)
|
|
@@ -612,31 +612,31 @@ const Jt = function(e) {
|
|
|
612
612
|
i = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - r - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
|
|
613
613
|
}
|
|
614
614
|
return { dx: i, dy: l };
|
|
615
|
-
},
|
|
616
|
-
const { map: e, container: t } = this, { dx: n, dy: o } =
|
|
615
|
+
}, sn = function() {
|
|
616
|
+
const { map: e, container: t } = this, { dx: n, dy: o } = Ae(this);
|
|
617
617
|
t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
618
|
-
},
|
|
618
|
+
}, rn = function(e) {
|
|
619
619
|
e(this);
|
|
620
|
-
},
|
|
620
|
+
}, ln = function(e) {
|
|
621
621
|
e.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
|
|
622
|
-
},
|
|
622
|
+
}, cn = function() {
|
|
623
623
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
624
|
-
},
|
|
624
|
+
}, an = function() {
|
|
625
625
|
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
626
|
-
},
|
|
626
|
+
}, dn = function() {
|
|
627
627
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
628
|
-
},
|
|
628
|
+
}, hn = function() {
|
|
629
629
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
630
|
-
},
|
|
630
|
+
}, fn = function(e) {
|
|
631
631
|
this.locale = e, this.refresh();
|
|
632
|
-
},
|
|
632
|
+
}, un = function(e, t) {
|
|
633
633
|
const n = e.nodeObj;
|
|
634
634
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
635
635
|
const o = e.getBoundingClientRect(), s = {
|
|
636
636
|
x: o.left,
|
|
637
637
|
y: o.top
|
|
638
638
|
}, i = e.parentNode, l = i.children[1];
|
|
639
|
-
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "",
|
|
639
|
+
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", ee(e), n.expanded) {
|
|
640
640
|
const h = this.createChildren(
|
|
641
641
|
n.children.map((u) => this.createWrapper(u).grp)
|
|
642
642
|
);
|
|
@@ -649,76 +649,76 @@ const Jt = function(e) {
|
|
|
649
649
|
y: c.top
|
|
650
650
|
}, a = s.x - r.x, d = s.y - r.y;
|
|
651
651
|
this.move(a, d), this.bus.fire("expandNode", n);
|
|
652
|
-
},
|
|
652
|
+
}, pn = function(e, t) {
|
|
653
653
|
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
654
654
|
x: o.left,
|
|
655
655
|
y: o.top
|
|
656
656
|
};
|
|
657
|
-
|
|
657
|
+
U(n, t ?? !n.expanded), this.refresh();
|
|
658
658
|
const i = this.findEle(n.id).getBoundingClientRect(), l = {
|
|
659
659
|
x: i.left,
|
|
660
660
|
y: i.top
|
|
661
661
|
}, c = s.x - l.x, r = s.y - l.y;
|
|
662
662
|
this.move(c, r);
|
|
663
|
-
},
|
|
664
|
-
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)),
|
|
665
|
-
},
|
|
663
|
+
}, gn = function(e) {
|
|
664
|
+
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), G(this.nodeData), this.layout(), this.linkDiv();
|
|
665
|
+
}, mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
666
666
|
__proto__: null,
|
|
667
|
-
cancelFocus:
|
|
668
|
-
clearSelection:
|
|
669
|
-
disableEdit:
|
|
670
|
-
enableEdit:
|
|
671
|
-
expandNode:
|
|
672
|
-
expandNodeAll:
|
|
673
|
-
focusNode:
|
|
674
|
-
getData:
|
|
675
|
-
getDataString:
|
|
676
|
-
initLeft:
|
|
677
|
-
initRight:
|
|
678
|
-
initSide:
|
|
679
|
-
install:
|
|
680
|
-
move:
|
|
681
|
-
refresh:
|
|
682
|
-
scale:
|
|
683
|
-
scaleFit:
|
|
684
|
-
scrollIntoView:
|
|
685
|
-
selectNode:
|
|
686
|
-
selectNodes:
|
|
687
|
-
setLocale:
|
|
688
|
-
stringifyData:
|
|
689
|
-
toCenter:
|
|
690
|
-
unselectNodes:
|
|
691
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
667
|
+
cancelFocus: cn,
|
|
668
|
+
clearSelection: Ut,
|
|
669
|
+
disableEdit: en,
|
|
670
|
+
enableEdit: Qt,
|
|
671
|
+
expandNode: un,
|
|
672
|
+
expandNodeAll: pn,
|
|
673
|
+
focusNode: ln,
|
|
674
|
+
getData: Zt,
|
|
675
|
+
getDataString: Jt,
|
|
676
|
+
initLeft: an,
|
|
677
|
+
initRight: dn,
|
|
678
|
+
initSide: hn,
|
|
679
|
+
install: rn,
|
|
680
|
+
move: on,
|
|
681
|
+
refresh: gn,
|
|
682
|
+
scale: tn,
|
|
683
|
+
scaleFit: nn,
|
|
684
|
+
scrollIntoView: Gt,
|
|
685
|
+
selectNode: Vt,
|
|
686
|
+
selectNodes: qt,
|
|
687
|
+
setLocale: fn,
|
|
688
|
+
stringifyData: Le,
|
|
689
|
+
toCenter: sn,
|
|
690
|
+
unselectNodes: Kt
|
|
691
|
+
}, Symbol.toStringTag, { value: "Module" })), Oe = "MIND-ELIXIR-WAIT-COPY", yn = (e) => {
|
|
692
692
|
const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
|
|
693
693
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
694
|
-
},
|
|
694
|
+
}, vn = (e) => {
|
|
695
695
|
const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
|
|
696
696
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
697
|
-
},
|
|
697
|
+
}, bn = (e) => {
|
|
698
698
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
699
|
-
},
|
|
699
|
+
}, wn = function(e, t) {
|
|
700
700
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
701
701
|
if (n) {
|
|
702
702
|
const o = n.firstChild;
|
|
703
703
|
e.selectNode(o);
|
|
704
704
|
}
|
|
705
|
-
},
|
|
705
|
+
}, xn = function(e, t) {
|
|
706
706
|
const n = t.parentElement.nextSibling;
|
|
707
707
|
if (n && n.firstChild) {
|
|
708
708
|
const o = n.firstChild.firstChild.firstChild;
|
|
709
709
|
e.selectNode(o);
|
|
710
710
|
}
|
|
711
|
-
},
|
|
711
|
+
}, $e = function(e, t) {
|
|
712
712
|
const n = e.currentNode || e.currentNodes?.[0];
|
|
713
713
|
if (!n) return;
|
|
714
714
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
715
|
-
o.parent ? s.className === t ?
|
|
716
|
-
},
|
|
715
|
+
o.parent ? s.className === t ? xn(e, n) : o.parent?.parent ? wn(e, n) : bn(e) : t === R.LHS ? yn(e) : vn(e);
|
|
716
|
+
}, je = function(e, t) {
|
|
717
717
|
const n = e.currentNode;
|
|
718
718
|
if (!n || !n.nodeObj.parent) return;
|
|
719
719
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
720
720
|
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
721
|
-
},
|
|
721
|
+
}, ae = function(e, t, n) {
|
|
722
722
|
const { scaleVal: o, scaleSensitivity: s } = e;
|
|
723
723
|
switch (t) {
|
|
724
724
|
case "in":
|
|
@@ -728,7 +728,7 @@ const Jt = function(e) {
|
|
|
728
728
|
e.scale(o - s, n);
|
|
729
729
|
}
|
|
730
730
|
};
|
|
731
|
-
function
|
|
731
|
+
function Cn(e, t) {
|
|
732
732
|
t = t === !0 ? {} : t;
|
|
733
733
|
const n = () => {
|
|
734
734
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
@@ -738,13 +738,13 @@ function Tn(e, t) {
|
|
|
738
738
|
const a = e.nodeData;
|
|
739
739
|
if (r.key === "0")
|
|
740
740
|
for (const d of a.children)
|
|
741
|
-
|
|
741
|
+
U(d, !1);
|
|
742
742
|
if (r.key === "=")
|
|
743
743
|
for (const d of a.children)
|
|
744
|
-
|
|
744
|
+
U(d, !0);
|
|
745
745
|
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
|
|
746
746
|
for (const d of a.children)
|
|
747
|
-
|
|
747
|
+
U(d, !0, Number(r.key) - 1);
|
|
748
748
|
e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
|
|
749
749
|
}, l = {
|
|
750
750
|
Enter: (r) => {
|
|
@@ -765,31 +765,31 @@ function Tn(e, t) {
|
|
|
765
765
|
else {
|
|
766
766
|
if (r.metaKey || r.ctrlKey)
|
|
767
767
|
return e.initSide();
|
|
768
|
-
|
|
768
|
+
je(e, "previous");
|
|
769
769
|
}
|
|
770
770
|
},
|
|
771
771
|
ArrowDown: (r) => {
|
|
772
|
-
r.altKey ? e.moveDownNode() :
|
|
772
|
+
r.altKey ? e.moveDownNode() : je(e, "next");
|
|
773
773
|
},
|
|
774
774
|
ArrowLeft: (r) => {
|
|
775
775
|
if (r.metaKey || r.ctrlKey)
|
|
776
776
|
return e.initLeft();
|
|
777
|
-
|
|
777
|
+
$e(e, R.LHS);
|
|
778
778
|
},
|
|
779
779
|
ArrowRight: (r) => {
|
|
780
780
|
if (r.metaKey || r.ctrlKey)
|
|
781
781
|
return e.initRight();
|
|
782
|
-
|
|
782
|
+
$e(e, R.RHS);
|
|
783
783
|
},
|
|
784
784
|
PageUp: () => e.moveUpNode(),
|
|
785
785
|
PageDown: () => {
|
|
786
786
|
e.moveDownNode();
|
|
787
787
|
},
|
|
788
788
|
"=": (r) => {
|
|
789
|
-
(r.metaKey || r.ctrlKey) &&
|
|
789
|
+
(r.metaKey || r.ctrlKey) && ae(e, "in");
|
|
790
790
|
},
|
|
791
791
|
"-": (r) => {
|
|
792
|
-
(r.metaKey || r.ctrlKey) &&
|
|
792
|
+
(r.metaKey || r.ctrlKey) && ae(e, "out");
|
|
793
793
|
},
|
|
794
794
|
0: (r) => {
|
|
795
795
|
if (r.metaKey || r.ctrlKey) {
|
|
@@ -815,8 +815,8 @@ function Tn(e, t) {
|
|
|
815
815
|
const c = (r) => {
|
|
816
816
|
if (r.target instanceof HTMLElement && r.target.id === "input-box" || e.currentNodes.length === 0) return !1;
|
|
817
817
|
if (r.clipboardData) {
|
|
818
|
-
const a =
|
|
819
|
-
magic:
|
|
818
|
+
const a = Ee(e.currentNodes).map((h) => h.nodeObj), d = Le({
|
|
819
|
+
magic: Oe,
|
|
820
820
|
data: a
|
|
821
821
|
});
|
|
822
822
|
return r.clipboardData.setData("text/plain", d), r.preventDefault(), !0;
|
|
@@ -830,7 +830,7 @@ function Tn(e, t) {
|
|
|
830
830
|
if (a)
|
|
831
831
|
try {
|
|
832
832
|
const d = JSON.parse(a);
|
|
833
|
-
if (d && d.magic ===
|
|
833
|
+
if (d && d.magic === Oe && Array.isArray(d.data)) {
|
|
834
834
|
const h = d.data, u = h.map((y) => ({ nodeObj: y }));
|
|
835
835
|
h.length > 0 && e.currentNode && (e.copyNodes(u, e.currentNode), r.preventDefault());
|
|
836
836
|
return;
|
|
@@ -840,28 +840,28 @@ function Tn(e, t) {
|
|
|
840
840
|
e.pasteHandler && e.pasteHandler(r);
|
|
841
841
|
});
|
|
842
842
|
}
|
|
843
|
-
const
|
|
843
|
+
const En = function(e, t) {
|
|
844
844
|
if (!t)
|
|
845
|
-
return
|
|
845
|
+
return he(e), e;
|
|
846
846
|
let n = e.querySelector(".insert-preview");
|
|
847
847
|
const o = `insert-preview ${t} show`;
|
|
848
|
-
return n || (n =
|
|
849
|
-
},
|
|
848
|
+
return n || (n = document.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
849
|
+
}, he = function(e) {
|
|
850
850
|
if (!e) return;
|
|
851
851
|
const t = e.querySelectorAll(".insert-preview");
|
|
852
852
|
for (const n of t || [])
|
|
853
853
|
n.remove();
|
|
854
|
-
},
|
|
854
|
+
}, He = function(e, t) {
|
|
855
855
|
for (const n of t) {
|
|
856
856
|
const o = n.parentElement.parentElement.contains(e);
|
|
857
857
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
858
858
|
}
|
|
859
859
|
return !0;
|
|
860
|
-
},
|
|
860
|
+
}, Sn = function(e) {
|
|
861
861
|
const t = document.createElement("div");
|
|
862
862
|
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
|
|
863
863
|
};
|
|
864
|
-
class
|
|
864
|
+
class Nn {
|
|
865
865
|
mind;
|
|
866
866
|
isMoving = !1;
|
|
867
867
|
interval = null;
|
|
@@ -878,31 +878,31 @@ class An {
|
|
|
878
878
|
this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function kn(e) {
|
|
882
882
|
return {
|
|
883
883
|
isDragging: !1,
|
|
884
884
|
insertType: null,
|
|
885
885
|
meet: null,
|
|
886
|
-
ghost:
|
|
887
|
-
edgeMoveController: new
|
|
886
|
+
ghost: Sn(e),
|
|
887
|
+
edgeMoveController: new Nn(e),
|
|
888
888
|
startX: 0,
|
|
889
889
|
startY: 0,
|
|
890
890
|
pointerId: null
|
|
891
891
|
};
|
|
892
892
|
}
|
|
893
|
-
const
|
|
894
|
-
function
|
|
893
|
+
const Tn = 5;
|
|
894
|
+
function Re(e, t, n, o = !1) {
|
|
895
895
|
if (e.spacePressed) return !1;
|
|
896
896
|
const s = n.target;
|
|
897
897
|
if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
|
|
898
898
|
t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.selection?.cancel();
|
|
899
899
|
let i = e.currentNodes;
|
|
900
|
-
return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o &&
|
|
900
|
+
return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o && lt(e, t), !0;
|
|
901
901
|
}
|
|
902
|
-
function
|
|
902
|
+
function rt(e, t, n) {
|
|
903
903
|
e.style.transform = `translate(${t - 10}px, ${n - 10}px)`, e.style.display = "block";
|
|
904
904
|
}
|
|
905
|
-
function
|
|
905
|
+
function lt(e, t) {
|
|
906
906
|
const { dragged: n } = e;
|
|
907
907
|
if (!n) return;
|
|
908
908
|
const o = document.activeElement;
|
|
@@ -911,57 +911,57 @@ function ft(e, t) {
|
|
|
911
911
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
912
912
|
e.dragMoveHelper.clear();
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function _n(e, t, n) {
|
|
915
915
|
const { dragged: o } = e;
|
|
916
916
|
if (!o || t.pointerId !== n.pointerId) return;
|
|
917
917
|
const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i);
|
|
918
|
-
if (!t.isDragging && l >
|
|
918
|
+
if (!t.isDragging && l > Tn && lt(e, t), !t.isDragging) return;
|
|
919
919
|
const c = e.container.getBoundingClientRect();
|
|
920
|
-
|
|
921
|
-
const r = 12 * e.scaleVal, a =
|
|
922
|
-
if (
|
|
920
|
+
rt(t.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(), he(t.meet);
|
|
921
|
+
const r = 12 * e.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - r);
|
|
922
|
+
if (He(a, o)) {
|
|
923
923
|
t.meet = a;
|
|
924
924
|
const d = a.getBoundingClientRect(), h = d.y;
|
|
925
925
|
n.clientY > h + d.height ? t.insertType = "after" : t.insertType = "in";
|
|
926
926
|
} else {
|
|
927
|
-
const d =
|
|
928
|
-
if (
|
|
927
|
+
const d = document.elementFromPoint(n.clientX, n.clientY + r);
|
|
928
|
+
if (He(d, o)) {
|
|
929
929
|
t.meet = d;
|
|
930
930
|
const u = d.getBoundingClientRect().y;
|
|
931
931
|
n.clientY < u ? t.insertType = "before" : t.insertType = "in";
|
|
932
932
|
} else
|
|
933
933
|
t.insertType = null, t.meet = null;
|
|
934
934
|
}
|
|
935
|
-
t.meet &&
|
|
935
|
+
t.meet && En(t.meet, t.insertType);
|
|
936
936
|
}
|
|
937
|
-
function
|
|
937
|
+
function Ln(e, t, n) {
|
|
938
938
|
const { dragged: o } = e;
|
|
939
939
|
if (!(!o || t.pointerId !== n.pointerId)) {
|
|
940
940
|
t.edgeMoveController.stop();
|
|
941
941
|
for (const s of o)
|
|
942
942
|
s.parentElement.parentElement.style.opacity = "1";
|
|
943
|
-
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (
|
|
943
|
+
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (he(t.meet), t.insertType === "before" ? e.moveNodeBefore(o, t.meet) : t.insertType === "after" ? e.moveNodeAfter(o, t.meet) : t.insertType === "in" && e.moveNodeIn(o, t.meet)), e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null;
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function pe(e, t) {
|
|
947
947
|
const { dragged: n } = e;
|
|
948
948
|
if (n) {
|
|
949
949
|
t.edgeMoveController.stop();
|
|
950
950
|
for (const o of n)
|
|
951
951
|
o.parentElement.parentElement.style.opacity = "1";
|
|
952
|
-
t.meet &&
|
|
952
|
+
t.meet && he(t.meet), t.ghost.style.display = "none", t.ghost.innerHTML = "", e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null;
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function An(e) {
|
|
956
956
|
return () => {
|
|
957
957
|
};
|
|
958
958
|
}
|
|
959
|
-
function
|
|
959
|
+
function Dn(e) {
|
|
960
960
|
const { dragMoveHelper: t } = e;
|
|
961
961
|
let n = 0;
|
|
962
962
|
e.spacePressed = !1;
|
|
963
963
|
let o = null;
|
|
964
|
-
const s = /* @__PURE__ */ new Map(), i = e.editable ?
|
|
964
|
+
const s = /* @__PURE__ */ new Map(), i = e.editable ? kn(e) : null;
|
|
965
965
|
let l = null, c = null, r = null, a = null;
|
|
966
966
|
const d = 500, h = 10, u = () => {
|
|
967
967
|
l !== null && (clearTimeout(l), l = null, c = null, r = null, a = null);
|
|
@@ -971,23 +971,23 @@ function jn(e) {
|
|
|
971
971
|
if (f.id === "input-box" || f.closest("#input-box")) return !1;
|
|
972
972
|
const k = f.closest(".svg-label");
|
|
973
973
|
if (k) {
|
|
974
|
-
const
|
|
975
|
-
if (
|
|
976
|
-
if (
|
|
977
|
-
return w ? e.editArrowLabel(
|
|
978
|
-
if (
|
|
979
|
-
return w ? e.editSummary(
|
|
974
|
+
const M = k.dataset.svgId, te = k.dataset.type, Z = document.getElementById(M);
|
|
975
|
+
if (Z) {
|
|
976
|
+
if (te === "arrow")
|
|
977
|
+
return w ? e.editArrowLabel(Z) : e.selectArrow(Z), !0;
|
|
978
|
+
if (te === "summary")
|
|
979
|
+
return w ? e.editSummary(Z) : e.selectSummary(Z), !0;
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
982
|
if (f.closest(".topiclinks")) {
|
|
983
|
-
const
|
|
984
|
-
if (
|
|
985
|
-
return w ? e.editArrowLabel(
|
|
983
|
+
const M = f.closest("g");
|
|
984
|
+
if (M)
|
|
985
|
+
return w ? e.editArrowLabel(M) : e.selectArrow(M), !0;
|
|
986
986
|
}
|
|
987
987
|
if (f.closest(".summary")) {
|
|
988
|
-
const
|
|
989
|
-
if (
|
|
990
|
-
return w ? e.editSummary(
|
|
988
|
+
const M = f.closest("g");
|
|
989
|
+
if (M)
|
|
990
|
+
return w ? e.editSummary(M) : e.selectSummary(M), !0;
|
|
991
991
|
}
|
|
992
992
|
return !1;
|
|
993
993
|
}, p = (f) => {
|
|
@@ -1017,7 +1017,7 @@ function jn(e) {
|
|
|
1017
1017
|
}, g = (f) => {
|
|
1018
1018
|
if (!e.editable) return;
|
|
1019
1019
|
const w = f.target;
|
|
1020
|
-
|
|
1020
|
+
re(w) && e.beginEdit(w), v(w, !0);
|
|
1021
1021
|
}, m = (f) => {
|
|
1022
1022
|
if (f.pointerType === "mouse" || s.size > 1) return;
|
|
1023
1023
|
const w = (/* @__PURE__ */ new Date()).getTime(), k = w - n;
|
|
@@ -1028,25 +1028,25 @@ function jn(e) {
|
|
|
1028
1028
|
f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
1029
1029
|
}, L = (f) => {
|
|
1030
1030
|
if (f.pointerType === "touch" && (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), s.size === 2)) {
|
|
1031
|
-
const [
|
|
1032
|
-
o =
|
|
1031
|
+
const [M, te] = Array.from(s.values());
|
|
1032
|
+
o = Pe(M, te), u();
|
|
1033
1033
|
}
|
|
1034
1034
|
t.moved = !1;
|
|
1035
1035
|
const w = f.target, k = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
1036
1036
|
if (i && (f.button === 0 || f.pointerType === "touch")) {
|
|
1037
1037
|
if (f.pointerType === "touch" && s.size > 1)
|
|
1038
|
-
(i.isDragging || i.pointerId !== null) &&
|
|
1038
|
+
(i.isDragging || i.pointerId !== null) && pe(e, i);
|
|
1039
1039
|
else if (f.pointerType === "touch" && s.size === 1)
|
|
1040
|
-
(
|
|
1041
|
-
|
|
1040
|
+
(re(w) || w.closest("me-tpc")) && (c = { x: f.clientX, y: f.clientY }, r = w, a = f.pointerId, l = window.setTimeout(() => {
|
|
1041
|
+
Re(e, i, f, !0) && (r && r.setPointerCapture(f.pointerId), rt(i.ghost, f.clientX, f.clientY)), l = null, c = null, r = null, a = null;
|
|
1042
1042
|
}, d));
|
|
1043
|
-
else if (f.pointerType === "mouse" &&
|
|
1043
|
+
else if (f.pointerType === "mouse" && Re(e, i, f, !1)) {
|
|
1044
1044
|
w.setPointerCapture(f.pointerId);
|
|
1045
1045
|
return;
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1048
|
+
const O = e.spacePressed && f.button === 0 && f.pointerType === "mouse", W = !e.editable || f.button === k && f.pointerType === "mouse" || f.pointerType === "touch";
|
|
1049
|
+
!O && !W || (t.x = f.clientX, t.y = f.clientY, w.className !== "circle" && w.contentEditable !== "plaintext-only" && (t.mousedown = !0, w.setPointerCapture(f.pointerId)));
|
|
1050
1050
|
}, T = (f) => {
|
|
1051
1051
|
if (f.pointerType === "touch" && s.has(f.pointerId)) {
|
|
1052
1052
|
if (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), l !== null && c !== null && f.pointerId === a) {
|
|
@@ -1054,23 +1054,23 @@ function jn(e) {
|
|
|
1054
1054
|
Math.sqrt(w * w + k * k) > h && u();
|
|
1055
1055
|
}
|
|
1056
1056
|
if (s.size >= 2) {
|
|
1057
|
-
const [w, k] = Array.from(s.values()),
|
|
1057
|
+
const [w, k] = Array.from(s.values()), O = Pe(w, k);
|
|
1058
1058
|
if (o == null)
|
|
1059
|
-
o =
|
|
1059
|
+
o = O;
|
|
1060
1060
|
else {
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1061
|
+
if (o > 0) {
|
|
1062
|
+
const W = O / o;
|
|
1063
|
+
e.scale(e.scaleVal * W, {
|
|
1064
|
+
x: (w.x + k.x) / 2,
|
|
1065
|
+
y: (w.y + k.y) / 2
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
o = O;
|
|
1069
1069
|
}
|
|
1070
1070
|
return;
|
|
1071
1071
|
}
|
|
1072
1072
|
}
|
|
1073
|
-
if (!(i && i.pointerId !== null && (
|
|
1073
|
+
if (!(i && i.pointerId !== null && (_n(e, i, f), i.isDragging))) {
|
|
1074
1074
|
if (f.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
|
|
1075
1075
|
const w = f.clientX - t.x, k = f.clientY - t.y;
|
|
1076
1076
|
t.onMove(w, k);
|
|
@@ -1080,24 +1080,24 @@ function jn(e) {
|
|
|
1080
1080
|
}, E = (f) => {
|
|
1081
1081
|
if (f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) {
|
|
1082
1082
|
const w = i.isDragging;
|
|
1083
|
-
if (
|
|
1083
|
+
if (Ln(e, i, f), y(f.target, f.pointerId), w)
|
|
1084
1084
|
return;
|
|
1085
1085
|
}
|
|
1086
1086
|
t.mousedown && (y(f.target, f.pointerId), t.clear());
|
|
1087
1087
|
}, C = () => {
|
|
1088
|
-
u(), t.mousedown && t.clear(), i && (i.isDragging || i.pointerId !== null) &&
|
|
1088
|
+
u(), t.mousedown && t.clear(), i && (i.isDragging || i.pointerId !== null) && pe(e, i);
|
|
1089
1089
|
}, S = (f) => {
|
|
1090
|
-
f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === f.pointerId &&
|
|
1090
|
+
f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === f.pointerId && pe(e, i), E(f);
|
|
1091
1091
|
}, N = (f) => {
|
|
1092
1092
|
if (f.preventDefault(), f.button !== 2 || !e.editable) return;
|
|
1093
1093
|
const w = f.target;
|
|
1094
|
-
|
|
1094
|
+
re(w) && !w.classList.contains("selected") && e.selectNode(w), setTimeout(() => {
|
|
1095
1095
|
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", f);
|
|
1096
1096
|
}, 200);
|
|
1097
|
-
},
|
|
1098
|
-
f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey ? f.deltaY < 0 ?
|
|
1097
|
+
}, D = (f) => {
|
|
1098
|
+
f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey ? f.deltaY < 0 ? ae(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && ae(e, "out", e.dragMoveHelper) : f.shiftKey ? e.move(-f.deltaY, 0) : e.move(-f.deltaX, -f.deltaY);
|
|
1099
1099
|
}, { container: _ } = e;
|
|
1100
|
-
return
|
|
1100
|
+
return Qe([
|
|
1101
1101
|
{ dom: _, evt: "pointerdown", func: L },
|
|
1102
1102
|
{ dom: _, evt: "pointermove", func: T },
|
|
1103
1103
|
{ dom: _, evt: "pointerup", func: E },
|
|
@@ -1106,13 +1106,13 @@ function jn(e) {
|
|
|
1106
1106
|
{ dom: _, evt: "click", func: p },
|
|
1107
1107
|
{ dom: _, evt: "dblclick", func: g },
|
|
1108
1108
|
{ dom: _, evt: "contextmenu", func: N },
|
|
1109
|
-
{ dom: _, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel :
|
|
1109
|
+
{ dom: _, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : D },
|
|
1110
1110
|
{ dom: _, evt: "blur", func: C },
|
|
1111
1111
|
{ dom: _, evt: "keydown", func: b },
|
|
1112
1112
|
{ dom: _, evt: "keyup", func: x }
|
|
1113
1113
|
]);
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1115
|
+
function Mn() {
|
|
1116
1116
|
return {
|
|
1117
1117
|
handlers: {},
|
|
1118
1118
|
addListener: function(e, t) {
|
|
@@ -1136,31 +1136,31 @@ function Hn() {
|
|
|
1136
1136
|
}
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
|
-
const
|
|
1139
|
+
const H = "http://www.w3.org/2000/svg", fe = function(e) {
|
|
1140
1140
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
1141
1141
|
let c = s;
|
|
1142
1142
|
l === "middle" ? c = s - t / 2 : l === "end" && (c = s - t), e.style.left = `${c}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
|
|
1143
|
-
},
|
|
1143
|
+
}, ye = function(e, t, n, o) {
|
|
1144
1144
|
const { anchor: s = "middle", color: i, dataType: l, svgId: c } = o, r = document.createElement("div");
|
|
1145
1145
|
r.className = "svg-label", r.style.color = i || "#666";
|
|
1146
1146
|
const a = "label-" + c;
|
|
1147
1147
|
return r.id = a, r.innerHTML = e, r.dataset.type = l, r.dataset.svgId = c, r.dataset.x = t.toString(), r.dataset.y = n.toString(), r.dataset.anchor = s, r;
|
|
1148
|
-
},
|
|
1149
|
-
const o =
|
|
1148
|
+
}, ct = function(e, t, n) {
|
|
1149
|
+
const o = document.createElementNS(H, "path");
|
|
1150
1150
|
return A(o, {
|
|
1151
1151
|
d: e,
|
|
1152
1152
|
stroke: t || "#666",
|
|
1153
1153
|
fill: "none",
|
|
1154
1154
|
"stroke-width": n
|
|
1155
1155
|
}), o;
|
|
1156
|
-
},
|
|
1157
|
-
const t =
|
|
1156
|
+
}, Q = function(e) {
|
|
1157
|
+
const t = document.createElementNS(H, "svg");
|
|
1158
1158
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
1159
|
-
},
|
|
1160
|
-
const e =
|
|
1159
|
+
}, Ie = function() {
|
|
1160
|
+
const e = document.createElementNS(H, "line");
|
|
1161
1161
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
1162
|
-
},
|
|
1163
|
-
const s =
|
|
1162
|
+
}, Pn = function(e, t, n, o) {
|
|
1163
|
+
const s = document.createElementNS(H, "g");
|
|
1164
1164
|
return [
|
|
1165
1165
|
{
|
|
1166
1166
|
name: "line",
|
|
@@ -1175,7 +1175,7 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1175
1175
|
d: n
|
|
1176
1176
|
}
|
|
1177
1177
|
].forEach((l, c) => {
|
|
1178
|
-
const r = l.d, a =
|
|
1178
|
+
const r = l.d, a = document.createElementNS(H, "path"), d = {
|
|
1179
1179
|
d: r,
|
|
1180
1180
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
1181
1181
|
fill: "none",
|
|
@@ -1183,7 +1183,7 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1183
1183
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
1184
1184
|
};
|
|
1185
1185
|
o?.opacity !== void 0 && (d.opacity = String(o.opacity)), A(a, d), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
1186
|
-
const h =
|
|
1186
|
+
const h = document.createElementNS(H, "path");
|
|
1187
1187
|
A(h, {
|
|
1188
1188
|
d: r,
|
|
1189
1189
|
stroke: "transparent",
|
|
@@ -1191,14 +1191,14 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1191
1191
|
"stroke-width": "15"
|
|
1192
1192
|
}), s.appendChild(h), s.appendChild(a), s[l.name] = a;
|
|
1193
1193
|
}), s;
|
|
1194
|
-
},
|
|
1194
|
+
}, at = function(e, t, n) {
|
|
1195
1195
|
if (!t) return;
|
|
1196
1196
|
const o = n.label, s = t.cloneNode(!0);
|
|
1197
1197
|
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
1198
1198
|
left:${t.style.left};
|
|
1199
1199
|
top:${t.style.top};
|
|
1200
1200
|
max-width: 200px;
|
|
1201
|
-
`,
|
|
1201
|
+
`, tt(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
1202
1202
|
i.stopPropagation();
|
|
1203
1203
|
const l = i.key;
|
|
1204
1204
|
if (l === "Enter" || l === "Tab") {
|
|
@@ -1208,7 +1208,7 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1208
1208
|
}), s.addEventListener("blur", () => {
|
|
1209
1209
|
if (!s) return;
|
|
1210
1210
|
const i = s.textContent?.trim() || "";
|
|
1211
|
-
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label,
|
|
1211
|
+
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label, fe(t), "parent" in n ? e.bus.fire("operation", {
|
|
1212
1212
|
name: "finishEditSummary",
|
|
1213
1213
|
obj: n
|
|
1214
1214
|
}) : e.bus.fire("operation", {
|
|
@@ -1216,32 +1216,32 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1216
1216
|
obj: n
|
|
1217
1217
|
}));
|
|
1218
1218
|
});
|
|
1219
|
-
},
|
|
1219
|
+
}, On = function(e) {
|
|
1220
1220
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
|
|
1221
1221
|
this.lines.innerHTML = "";
|
|
1222
1222
|
for (let c = 0; c < l.length; c++) {
|
|
1223
|
-
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } =
|
|
1224
|
-
if (a.style.borderColor = m, this.lines.appendChild(
|
|
1223
|
+
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = j(this.nodes, a), u = a.offsetWidth, y = a.offsetHeight, v = r.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: y, direction: v, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[c % g.length];
|
|
1224
|
+
if (a.style.borderColor = m, this.lines.appendChild(ct(p, m, "3")), e && e !== r)
|
|
1225
1225
|
continue;
|
|
1226
|
-
const b =
|
|
1227
|
-
x.tagName === "svg" && x.remove(), r.appendChild(b),
|
|
1226
|
+
const b = Q("subLines"), x = r.lastChild;
|
|
1227
|
+
x.tagName === "svg" && x.remove(), r.appendChild(b), dt(this, b, m, r, v, !0);
|
|
1228
1228
|
}
|
|
1229
1229
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
1230
|
-
},
|
|
1230
|
+
}, dt = function(e, t, n, o, s, i) {
|
|
1231
1231
|
const l = o.firstChild, c = o.children[1].children;
|
|
1232
1232
|
if (c.length === 0) return;
|
|
1233
1233
|
const r = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
|
|
1234
1234
|
for (let u = 0; u < c.length; u++) {
|
|
1235
1235
|
const y = c[u], v = y.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, b = v.offsetHeight, x = v.firstChild.nodeObj.branchColor || n, L = e.generateSubBranch({ pT: r, pL: a, pW: d, pH: h, cT: p, cL: g, cW: m, cH: b, direction: s, isFirst: i });
|
|
1236
|
-
t.appendChild(
|
|
1236
|
+
t.appendChild(ct(L, x, "2"));
|
|
1237
1237
|
const T = v.children[1];
|
|
1238
1238
|
if (T) {
|
|
1239
1239
|
if (!T.expanded) continue;
|
|
1240
1240
|
} else
|
|
1241
1241
|
continue;
|
|
1242
|
-
|
|
1242
|
+
dt(e, t, x, y, s);
|
|
1243
1243
|
}
|
|
1244
|
-
},
|
|
1244
|
+
}, Be = {
|
|
1245
1245
|
addChild: "插入子节点",
|
|
1246
1246
|
addParent: "插入父节点",
|
|
1247
1247
|
addSibling: "插入同级节点",
|
|
@@ -1254,9 +1254,9 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1254
1254
|
linkBidirectional: "双向连接",
|
|
1255
1255
|
clickTips: "请点击目标节点",
|
|
1256
1256
|
summary: "摘要"
|
|
1257
|
-
},
|
|
1258
|
-
cn:
|
|
1259
|
-
zh_CN:
|
|
1257
|
+
}, Fe = {
|
|
1258
|
+
cn: Be,
|
|
1259
|
+
zh_CN: Be,
|
|
1260
1260
|
zh_TW: {
|
|
1261
1261
|
addChild: "插入子節點",
|
|
1262
1262
|
addParent: "插入父節點",
|
|
@@ -1398,7 +1398,7 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1398
1398
|
summary: "Rezumat"
|
|
1399
1399
|
}
|
|
1400
1400
|
};
|
|
1401
|
-
function
|
|
1401
|
+
function $n(e, t) {
|
|
1402
1402
|
t = t === !0 ? {
|
|
1403
1403
|
focus: !0,
|
|
1404
1404
|
link: !0
|
|
@@ -1408,8 +1408,8 @@ function Bn(e, t) {
|
|
|
1408
1408
|
return C.innerText = E, C.className = "tips", C;
|
|
1409
1409
|
}, o = (E, C, S) => {
|
|
1410
1410
|
const N = document.createElement("li");
|
|
1411
|
-
return N.id = E, N.innerHTML = `<span>${
|
|
1412
|
-
}, s =
|
|
1411
|
+
return N.id = E, N.innerHTML = `<span>${me(C)}</span><span ${S ? 'class="key"' : ""}>${me(S)}</span>`, N;
|
|
1412
|
+
}, s = Fe[e.locale] ? e.locale : "en", i = Fe[s], l = o("cm-add_child", i.addChild, "Tab"), c = o("cm-add_parent", i.addParent, "Ctrl + Enter"), r = o("cm-add_sibling", i.addSibling, "Enter"), a = o("cm-remove_child", i.removeNode, "Delete"), d = o("cm-fucus", i.focus, ""), h = o("cm-unfucus", i.cancelFocus, ""), u = o("cm-up", i.moveUp, "PgUp"), y = o("cm-down", i.moveDown, "Pgdn"), v = o("cm-link", i.link, ""), p = o("cm-link-bidirectional", i.linkBidirectional, ""), g = o("cm-summary", i.summary, ""), m = document.createElement("ul");
|
|
1413
1413
|
if (m.className = "menu-list", m.appendChild(l), m.appendChild(c), m.appendChild(r), m.appendChild(a), t.focus && (m.appendChild(d), m.appendChild(h)), m.appendChild(u), m.appendChild(y), m.appendChild(g), t.link && (m.appendChild(v), m.appendChild(p)), t && t.extend)
|
|
1414
1414
|
for (let E = 0; E < t.extend.length; E++) {
|
|
1415
1415
|
const C = t.extend[E], S = o(C.name, C.name, C.key || "");
|
|
@@ -1422,10 +1422,10 @@ function Bn(e, t) {
|
|
|
1422
1422
|
let x = !0;
|
|
1423
1423
|
const L = (E) => {
|
|
1424
1424
|
const C = E.target;
|
|
1425
|
-
if (
|
|
1425
|
+
if (re(C)) {
|
|
1426
1426
|
C.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (d.className = "disabled", u.className = "disabled", y.className = "disabled", c.className = "disabled", r.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", y.className = "", c.className = "", r.className = "", a.className = ""), b.hidden = !1, m.style.top = "", m.style.bottom = "", m.style.left = "", m.style.right = "";
|
|
1427
|
-
const S = m.offsetHeight, N = m.offsetWidth,
|
|
1428
|
-
S + _ > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = _ + 15 + "px"), N +
|
|
1427
|
+
const S = m.offsetHeight, N = m.offsetWidth, D = m.getBoundingClientRect(), _ = E.clientY - D.top, B = E.clientX - D.left;
|
|
1428
|
+
S + _ > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = _ + 15 + "px"), N + B > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = B + 10 + "px");
|
|
1429
1429
|
}
|
|
1430
1430
|
};
|
|
1431
1431
|
e.bus.addListener("showContextMenu", L), b.onclick = (E) => {
|
|
@@ -1454,8 +1454,8 @@ function Bn(e, t) {
|
|
|
1454
1454
|
"click",
|
|
1455
1455
|
(N) => {
|
|
1456
1456
|
N.preventDefault(), S.remove();
|
|
1457
|
-
const
|
|
1458
|
-
(
|
|
1457
|
+
const D = N.target;
|
|
1458
|
+
(D.parentElement.tagName === "ME-PARENT" || D.parentElement.tagName === "ME-ROOT") && e.createArrow(C, D, E);
|
|
1459
1459
|
},
|
|
1460
1460
|
{
|
|
1461
1461
|
once: !0
|
|
@@ -1468,7 +1468,7 @@ function Bn(e, t) {
|
|
|
1468
1468
|
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, y.onclick = null, v.onclick = null, g.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
|
|
1469
1469
|
};
|
|
1470
1470
|
}
|
|
1471
|
-
const
|
|
1471
|
+
const jn = function(e) {
|
|
1472
1472
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
1473
1473
|
type: "summary",
|
|
1474
1474
|
value: e.obj.id
|
|
@@ -1483,7 +1483,7 @@ const Fn = function(e) {
|
|
|
1483
1483
|
value: [e.obj.id]
|
|
1484
1484
|
};
|
|
1485
1485
|
};
|
|
1486
|
-
function
|
|
1486
|
+
function Hn(e) {
|
|
1487
1487
|
let t = [], n = -1, o = e.getData(), s = [];
|
|
1488
1488
|
e.undo = function() {
|
|
1489
1489
|
if (n > -1) {
|
|
@@ -1514,7 +1514,7 @@ function Yn(e) {
|
|
|
1514
1514
|
prev: o,
|
|
1515
1515
|
operation: r.name,
|
|
1516
1516
|
currentSelected: s.map((h) => h.id),
|
|
1517
|
-
currentTarget:
|
|
1517
|
+
currentTarget: jn(r),
|
|
1518
1518
|
next: a
|
|
1519
1519
|
};
|
|
1520
1520
|
t.push(d), o = a, n = t.length - 1;
|
|
@@ -1527,24 +1527,24 @@ function Yn(e) {
|
|
|
1527
1527
|
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", c), e.container.removeEventListener("keydown", l);
|
|
1528
1528
|
};
|
|
1529
1529
|
}
|
|
1530
|
-
const
|
|
1531
|
-
side:
|
|
1532
|
-
left:
|
|
1533
|
-
right:
|
|
1534
|
-
full:
|
|
1535
|
-
living:
|
|
1536
|
-
zoomin:
|
|
1537
|
-
zoomout:
|
|
1538
|
-
},
|
|
1530
|
+
const Rn = '<?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>', In = '<?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>', Bn = '<?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>', Fn = '<?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>', Yn = '<?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>', Wn = '<?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>', Xn = '<?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>', zn = {
|
|
1531
|
+
side: Rn,
|
|
1532
|
+
left: In,
|
|
1533
|
+
right: Bn,
|
|
1534
|
+
full: Fn,
|
|
1535
|
+
living: Yn,
|
|
1536
|
+
zoomin: Wn,
|
|
1537
|
+
zoomout: Xn
|
|
1538
|
+
}, z = (e, t) => {
|
|
1539
1539
|
const n = document.createElement("span");
|
|
1540
|
-
return n.id = e, n.innerHTML =
|
|
1540
|
+
return n.id = e, n.innerHTML = zn[t], n;
|
|
1541
1541
|
};
|
|
1542
|
-
function
|
|
1543
|
-
const t = document.createElement("div"), n =
|
|
1542
|
+
function Gn(e) {
|
|
1543
|
+
const t = document.createElement("div"), n = z("fullscreen", "full"), o = z("toCenter", "living"), s = z("zoomout", "zoomout"), i = z("zoomin", "zoomin");
|
|
1544
1544
|
t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
|
|
1545
1545
|
let l = null;
|
|
1546
1546
|
const c = () => {
|
|
1547
|
-
const a = e.container.getBoundingClientRect(), d =
|
|
1547
|
+
const a = e.container.getBoundingClientRect(), d = Se(e.map.style.transform), h = a.width / 2, u = a.height / 2, y = (h - d.x) / e.scaleVal, v = (u - d.y) / e.scaleVal;
|
|
1548
1548
|
l = {
|
|
1549
1549
|
containerRect: a,
|
|
1550
1550
|
currentTransform: d,
|
|
@@ -1567,8 +1567,8 @@ function Jn(e) {
|
|
|
1567
1567
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1568
1568
|
}, t;
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1571
|
-
const t = document.createElement("div"), n =
|
|
1570
|
+
function Vn(e) {
|
|
1571
|
+
const t = document.createElement("div"), n = z("tbltl", "left"), o = z("tbltr", "right"), s = z("tblts", "side");
|
|
1572
1572
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1573
1573
|
e.initLeft();
|
|
1574
1574
|
}, o.onclick = () => {
|
|
@@ -1577,10 +1577,10 @@ function Zn(e) {
|
|
|
1577
1577
|
e.initSide();
|
|
1578
1578
|
}, t;
|
|
1579
1579
|
}
|
|
1580
|
-
function
|
|
1581
|
-
e.container.append(
|
|
1580
|
+
function qn(e) {
|
|
1581
|
+
e.container.append(Gn(e)), e.container.append(Vn(e));
|
|
1582
1582
|
}
|
|
1583
|
-
class
|
|
1583
|
+
class Kn {
|
|
1584
1584
|
_listeners = /* @__PURE__ */ new Map();
|
|
1585
1585
|
addEventListener(t, n) {
|
|
1586
1586
|
const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
@@ -1603,15 +1603,15 @@ class eo {
|
|
|
1603
1603
|
off = this.removeEventListener;
|
|
1604
1604
|
emit = this.dispatchEvent;
|
|
1605
1605
|
}
|
|
1606
|
-
const
|
|
1606
|
+
const Ye = (e, t = "px") => typeof e == "number" ? e + t : e, F = ({ style: e }, t, n) => {
|
|
1607
1607
|
if (typeof t == "object")
|
|
1608
1608
|
for (const [o, s] of Object.entries(t))
|
|
1609
|
-
s !== void 0 && (e[o] =
|
|
1610
|
-
else n !== void 0 && (e[t] =
|
|
1611
|
-
},
|
|
1609
|
+
s !== void 0 && (e[o] = Ye(s));
|
|
1610
|
+
else n !== void 0 && (e[t] = Ye(n));
|
|
1611
|
+
}, We = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1612
1612
|
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1613
1613
|
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1614
|
-
},
|
|
1614
|
+
}, Un = (e) => {
|
|
1615
1615
|
let t, n = -1, o = !1;
|
|
1616
1616
|
return {
|
|
1617
1617
|
next: (...s) => {
|
|
@@ -1623,7 +1623,7 @@ const qe = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1623
1623
|
cancelAnimationFrame(n), o = !1;
|
|
1624
1624
|
}
|
|
1625
1625
|
};
|
|
1626
|
-
},
|
|
1626
|
+
}, Xe = (e, t, n = "touch") => {
|
|
1627
1627
|
switch (n) {
|
|
1628
1628
|
case "center": {
|
|
1629
1629
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -1634,16 +1634,16 @@ const qe = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1634
1634
|
case "touch":
|
|
1635
1635
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1636
1636
|
}
|
|
1637
|
-
},
|
|
1638
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1637
|
+
}, Jn = () => matchMedia("(hover: none), (pointer: coarse)").matches, Zn = () => "safari" in window, ve = (e) => Array.isArray(e) ? e : [e], ht = (e) => (t, n, o, s = {}) => {
|
|
1638
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = ve(n), t = ve(t);
|
|
1639
1639
|
for (const i of t)
|
|
1640
1640
|
if (i)
|
|
1641
1641
|
for (const l of n)
|
|
1642
1642
|
i[e](l, o, { capture: !1, ...s });
|
|
1643
|
-
},
|
|
1643
|
+
}, Y = ht("addEventListener"), $ = ht("removeEventListener"), ne = (e) => {
|
|
1644
1644
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1645
1645
|
return { x: t, y: n, target: o };
|
|
1646
|
-
},
|
|
1646
|
+
}, q = (e, t = document) => ve(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), Qn = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1647
1647
|
switch (o) {
|
|
1648
1648
|
case "alt":
|
|
1649
1649
|
return e.altKey;
|
|
@@ -1652,18 +1652,18 @@ const qe = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1652
1652
|
case "shift":
|
|
1653
1653
|
return e.shiftKey;
|
|
1654
1654
|
}
|
|
1655
|
-
}) : !1), { abs:
|
|
1655
|
+
}) : !1), { abs: X, max: ze, min: Ge, ceil: Ve } = Math, qe = (e = []) => ({
|
|
1656
1656
|
stored: e,
|
|
1657
1657
|
selected: [],
|
|
1658
1658
|
touched: [],
|
|
1659
1659
|
changed: { added: [], removed: [] }
|
|
1660
1660
|
});
|
|
1661
|
-
class
|
|
1661
|
+
class eo extends Kn {
|
|
1662
1662
|
static version = "mind-elixir-fork";
|
|
1663
1663
|
// Options
|
|
1664
1664
|
_options;
|
|
1665
1665
|
// Selection store
|
|
1666
|
-
_selection =
|
|
1666
|
+
_selection = qe();
|
|
1667
1667
|
// Area element and clipping element
|
|
1668
1668
|
_area;
|
|
1669
1669
|
_clippingElement;
|
|
@@ -1676,7 +1676,7 @@ class io extends eo {
|
|
|
1676
1676
|
_latestElement;
|
|
1677
1677
|
// Dynamically constructed area rect
|
|
1678
1678
|
_areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 };
|
|
1679
|
-
_areaRect =
|
|
1679
|
+
_areaRect = We();
|
|
1680
1680
|
// If a single click is being performed, it's a single-click until the user dragged the mouse
|
|
1681
1681
|
_singleClick = !0;
|
|
1682
1682
|
_frame;
|
|
@@ -1731,44 +1731,44 @@ class io extends eo {
|
|
|
1731
1731
|
for (const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1732
1732
|
typeof this[i] == "function" && (this[i] = this[i].bind(this));
|
|
1733
1733
|
const { document: n, selectionAreaClass: o, selectionContainerClass: s } = this._options;
|
|
1734
|
-
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s),
|
|
1734
|
+
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s), F(this._area, {
|
|
1735
1735
|
willChange: "top, left, bottom, right, width, height",
|
|
1736
1736
|
top: 0,
|
|
1737
1737
|
left: 0,
|
|
1738
1738
|
position: "fixed"
|
|
1739
|
-
}),
|
|
1739
|
+
}), F(this._clippingElement, {
|
|
1740
1740
|
overflow: "hidden",
|
|
1741
1741
|
position: "fixed",
|
|
1742
1742
|
transform: "translate3d(0, 0, 0)",
|
|
1743
1743
|
// https://stackoverflow.com/a/38268846
|
|
1744
1744
|
pointerEvents: "none",
|
|
1745
1745
|
zIndex: "1"
|
|
1746
|
-
}), this._frame =
|
|
1746
|
+
}), this._frame = Un((i) => {
|
|
1747
1747
|
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
|
|
1748
1748
|
}), this.enable();
|
|
1749
1749
|
}
|
|
1750
1750
|
_toggleStartEvents(t = !0) {
|
|
1751
|
-
const { document: n, features: o } = this._options, s = t ?
|
|
1751
|
+
const { document: n, features: o } = this._options, s = t ? Y : $;
|
|
1752
1752
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1753
1753
|
}
|
|
1754
1754
|
_onTapStart(t, n = !1) {
|
|
1755
|
-
const { x: o, y: s, target: i } =
|
|
1756
|
-
if (t instanceof MouseEvent && !
|
|
1755
|
+
const { x: o, y: s, target: i } = ne(t), { document: l, startAreas: c, boundaries: r, features: a, behaviour: d } = this._options, h = i.getBoundingClientRect();
|
|
1756
|
+
if (t instanceof MouseEvent && !Qn(t, d.triggers))
|
|
1757
1757
|
return;
|
|
1758
|
-
const u =
|
|
1759
|
-
this._targetElement = y.find((m) =>
|
|
1758
|
+
const u = q(c, l), y = q(r, l);
|
|
1759
|
+
this._targetElement = y.find((m) => Xe(m.getBoundingClientRect(), h));
|
|
1760
1760
|
const v = t.composedPath(), p = u.find((m) => v.includes(m));
|
|
1761
1761
|
if (this._targetBoundary = y.find((m) => v.includes(m)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1762
1762
|
return;
|
|
1763
1763
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1764
1764
|
const g = l.scrollingElement ?? l.body;
|
|
1765
|
-
this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0),
|
|
1765
|
+
this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), Y(l, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), Y(l, ["mouseup", "touchcancel", "touchend"], this._onTapStop), Y(l, "scroll", this._onScroll), a.deselectOnBlur && (this._targetBoundaryScrolled = !1, Y(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1766
1766
|
}
|
|
1767
1767
|
_onSingleTap(t) {
|
|
1768
1768
|
const {
|
|
1769
1769
|
singleTap: { intersect: n },
|
|
1770
1770
|
range: o
|
|
1771
|
-
} = this._options.features, s =
|
|
1771
|
+
} = this._options.features, s = ne(t);
|
|
1772
1772
|
let i;
|
|
1773
1773
|
if (n === "native")
|
|
1774
1774
|
i = s.target;
|
|
@@ -1804,36 +1804,36 @@ class io extends eo {
|
|
|
1804
1804
|
container: n,
|
|
1805
1805
|
document: o,
|
|
1806
1806
|
behaviour: { startThreshold: s }
|
|
1807
|
-
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } =
|
|
1807
|
+
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } = ne(t);
|
|
1808
1808
|
if (
|
|
1809
1809
|
// Single number for both coordinates
|
|
1810
|
-
typeof s == "number" &&
|
|
1811
|
-
typeof s == "object" &&
|
|
1810
|
+
typeof s == "number" && X(c + r - (i + l)) >= s || // Different x and y threshold
|
|
1811
|
+
typeof s == "object" && X(c - i) >= s.x || X(r - l) >= s.y
|
|
1812
1812
|
) {
|
|
1813
|
-
if (
|
|
1814
|
-
|
|
1813
|
+
if ($(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1814
|
+
$(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1815
1815
|
return;
|
|
1816
1816
|
}
|
|
1817
|
-
|
|
1817
|
+
Y(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), F(this._area, "display", "block"), q(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (Y(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), Y(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
1818
1818
|
}
|
|
1819
1819
|
this._handleMoveEvent(t);
|
|
1820
1820
|
}
|
|
1821
1821
|
_setupSelectionArea() {
|
|
1822
1822
|
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
1823
|
-
this._scrollAvailable ? (
|
|
1823
|
+
this._scrollAvailable ? (F(t, {
|
|
1824
1824
|
top: s.top,
|
|
1825
1825
|
left: s.left,
|
|
1826
1826
|
width: s.width,
|
|
1827
1827
|
height: s.height
|
|
1828
|
-
}),
|
|
1828
|
+
}), F(o, {
|
|
1829
1829
|
marginTop: -s.top,
|
|
1830
1830
|
marginLeft: -s.left
|
|
1831
|
-
})) : (
|
|
1831
|
+
})) : (F(t, {
|
|
1832
1832
|
top: 0,
|
|
1833
1833
|
left: 0,
|
|
1834
1834
|
width: "100%",
|
|
1835
1835
|
height: "100%"
|
|
1836
|
-
}),
|
|
1836
|
+
}), F(o, {
|
|
1837
1837
|
marginTop: 0,
|
|
1838
1838
|
marginLeft: 0
|
|
1839
1839
|
}));
|
|
@@ -1841,7 +1841,7 @@ class io extends eo {
|
|
|
1841
1841
|
_onTapMove(t) {
|
|
1842
1842
|
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling;
|
|
1843
1843
|
this._targetElement;
|
|
1844
|
-
const { x: c, y: r } =
|
|
1844
|
+
const { x: c, y: r } = ne(t);
|
|
1845
1845
|
if (o.x2 = c, o.y2 = r, this._lastMousePosition.x = c, this._lastMousePosition.y = r, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1846
1846
|
this._scrollingActive = !0;
|
|
1847
1847
|
const a = () => {
|
|
@@ -1851,7 +1851,7 @@ class io extends eo {
|
|
|
1851
1851
|
}
|
|
1852
1852
|
const d = this._options.mindElixirInstance;
|
|
1853
1853
|
if (d && d.move) {
|
|
1854
|
-
const h = n.x ?
|
|
1854
|
+
const h = n.x ? Ve(n.x / l) : 0, u = n.y ? Ve(n.y / l) : 0;
|
|
1855
1855
|
(h || u) && (d.move(-h, -u), o.x1 -= h, o.y1 -= u);
|
|
1856
1856
|
}
|
|
1857
1857
|
i.next(t), requestAnimationFrame(a);
|
|
@@ -1863,7 +1863,7 @@ class io extends eo {
|
|
|
1863
1863
|
}
|
|
1864
1864
|
_handleMoveEvent(t) {
|
|
1865
1865
|
const { features: n } = this._options;
|
|
1866
|
-
(n.touch &&
|
|
1866
|
+
(n.touch && Jn() || this._scrollAvailable && Zn()) && t.preventDefault();
|
|
1867
1867
|
}
|
|
1868
1868
|
_onScroll() {
|
|
1869
1869
|
const {
|
|
@@ -1873,7 +1873,7 @@ class io extends eo {
|
|
|
1873
1873
|
this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1874
1874
|
}
|
|
1875
1875
|
_onStartAreaScroll() {
|
|
1876
|
-
this._targetBoundaryScrolled = !0,
|
|
1876
|
+
this._targetBoundaryScrolled = !0, $(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1877
1877
|
}
|
|
1878
1878
|
_wheelScroll(t) {
|
|
1879
1879
|
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0, s = t.deltaX ? t.deltaX > 0 ? 1 : -1 : 0;
|
|
@@ -1896,9 +1896,9 @@ class io extends eo {
|
|
|
1896
1896
|
scrolling: { startScrollMargins: d }
|
|
1897
1897
|
}
|
|
1898
1898
|
} = s;
|
|
1899
|
-
r < i.left + d.x ? (t.x = -
|
|
1900
|
-
const h =
|
|
1901
|
-
this._areaRect =
|
|
1899
|
+
r < i.left + d.x ? (t.x = -X(i.left - r + d.x), r = r < i.left ? i.left : r) : r > i.right - d.x ? (t.x = X(i.left + i.width - r - d.x), r = r > i.right ? i.right : r) : t.x = 0, a < i.top + d.y ? (t.y = -X(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = X(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
|
|
1900
|
+
const h = Ge(l, r), u = Ge(c, a), y = ze(l, r), v = ze(c, a);
|
|
1901
|
+
this._areaRect = We(h, u, y - h, v - u);
|
|
1902
1902
|
}
|
|
1903
1903
|
_redrawSelectionArea() {
|
|
1904
1904
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1906,13 +1906,13 @@ class io extends eo {
|
|
|
1906
1906
|
}
|
|
1907
1907
|
_onTapStop(t, n) {
|
|
1908
1908
|
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1909
|
-
|
|
1909
|
+
$(this._targetElement, "scroll", this._onStartAreaScroll), $(o, ["mousemove", "touchmove"], this._delayedTapMove), $(o, ["touchmove", "mousemove"], this._onTapMove), $(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), $(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, $(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), $(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), this._frame?.cancel(), F(this._area, "display", "none");
|
|
1910
1910
|
}
|
|
1911
1911
|
_updateElementSelection() {
|
|
1912
1912
|
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: c } = o, { intersect: r, overlap: a } = n.behaviour, d = a === "invert", h = [], u = [], y = [];
|
|
1913
1913
|
for (let p = 0; p < t.length; p++) {
|
|
1914
1914
|
const g = t[p];
|
|
1915
|
-
if (
|
|
1915
|
+
if (Xe(s, g.getBoundingClientRect(), r)) {
|
|
1916
1916
|
if (l.includes(g))
|
|
1917
1917
|
i.includes(g) && !c.includes(g) && c.push(g);
|
|
1918
1918
|
else if (d && i.includes(g)) {
|
|
@@ -1982,7 +1982,7 @@ class io extends eo {
|
|
|
1982
1982
|
* Will update everything that can be selected
|
|
1983
1983
|
*/
|
|
1984
1984
|
resolveSelectables() {
|
|
1985
|
-
this._selectables =
|
|
1985
|
+
this._selectables = q(this._options.selectables, this._options.document);
|
|
1986
1986
|
}
|
|
1987
1987
|
/**
|
|
1988
1988
|
* Same as deselecting, but for all elements currently selected
|
|
@@ -1991,7 +1991,7 @@ class io extends eo {
|
|
|
1991
1991
|
*/
|
|
1992
1992
|
clearSelection(t = !0, n = !1) {
|
|
1993
1993
|
const { selected: o, stored: s, changed: i } = this._selection;
|
|
1994
|
-
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection =
|
|
1994
|
+
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = qe(t ? [] : s);
|
|
1995
1995
|
}
|
|
1996
1996
|
/**
|
|
1997
1997
|
* @returns {Array} Selected elements
|
|
@@ -2051,7 +2051,7 @@ class io extends eo {
|
|
|
2051
2051
|
* @param quiet If this should not trigger the move event
|
|
2052
2052
|
*/
|
|
2053
2053
|
select(t, n = !1) {
|
|
2054
|
-
const { changed: o, selected: s, stored: i } = this._selection, l =
|
|
2054
|
+
const { changed: o, selected: s, stored: i } = this._selection, l = q(t, this._options.document).filter((c) => !s.includes(c) && !i.includes(c));
|
|
2055
2055
|
return i.push(...l), s.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
|
|
2056
2056
|
}
|
|
2057
2057
|
/**
|
|
@@ -2060,12 +2060,12 @@ class io extends eo {
|
|
|
2060
2060
|
* @param quiet If this should not trigger the move event
|
|
2061
2061
|
*/
|
|
2062
2062
|
deselect(t, n = !1) {
|
|
2063
|
-
const { selected: o, stored: s, changed: i } = this._selection, l =
|
|
2063
|
+
const { selected: o, stored: s, changed: i } = this._selection, l = q(t, this._options.document).filter((c) => o.includes(c) || s.includes(c));
|
|
2064
2064
|
this._selection.stored = s.filter((c) => !l.includes(c)), this._selection.selected = o.filter((c) => !l.includes(c)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((c) => !i.removed.includes(c))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
2065
2065
|
}
|
|
2066
2066
|
}
|
|
2067
|
-
function
|
|
2068
|
-
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new
|
|
2067
|
+
function to(e) {
|
|
2068
|
+
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new eo({
|
|
2069
2069
|
selectables: [".map-container me-tpc"],
|
|
2070
2070
|
boundaries: [e.container],
|
|
2071
2071
|
container: e.selectionContainer,
|
|
@@ -2124,10 +2124,10 @@ function ro(e) {
|
|
|
2124
2124
|
);
|
|
2125
2125
|
e.selection = n;
|
|
2126
2126
|
}
|
|
2127
|
-
const
|
|
2127
|
+
const no = function(e, t = !0) {
|
|
2128
2128
|
this.theme = e;
|
|
2129
2129
|
const o = {
|
|
2130
|
-
...(e.type === "dark" ?
|
|
2130
|
+
...(e.type === "dark" ? we : be).cssVar,
|
|
2131
2131
|
...e.cssVar
|
|
2132
2132
|
}, s = Object.keys(o);
|
|
2133
2133
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -2135,7 +2135,7 @@ const lo = function(e, t = !0) {
|
|
|
2135
2135
|
this.container.style.setProperty(l, o[l]);
|
|
2136
2136
|
}
|
|
2137
2137
|
t && this.refresh();
|
|
2138
|
-
},
|
|
2138
|
+
}, oo = function(e) {
|
|
2139
2139
|
return {
|
|
2140
2140
|
dom: e,
|
|
2141
2141
|
moved: !1,
|
|
@@ -2158,7 +2158,7 @@ const lo = function(e, t = !0) {
|
|
|
2158
2158
|
},
|
|
2159
2159
|
cb: null,
|
|
2160
2160
|
init(t, n) {
|
|
2161
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
2161
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = Qe([
|
|
2162
2162
|
{ dom: t, evt: "pointermove", func: this.handlePointerMove },
|
|
2163
2163
|
{ dom: t, evt: "pointerleave", func: this.handleClear },
|
|
2164
2164
|
{ dom: t, evt: "pointerup", func: this.handleClear },
|
|
@@ -2170,19 +2170,19 @@ const lo = function(e, t = !0) {
|
|
|
2170
2170
|
this.moved = !1, this.pointerdown = !1;
|
|
2171
2171
|
}
|
|
2172
2172
|
};
|
|
2173
|
-
},
|
|
2174
|
-
create:
|
|
2175
|
-
},
|
|
2176
|
-
function
|
|
2173
|
+
}, Ke = {
|
|
2174
|
+
create: oo
|
|
2175
|
+
}, so = "#4dc4ff";
|
|
2176
|
+
function ft(e, t, n, o, s, i, l, c) {
|
|
2177
2177
|
return {
|
|
2178
2178
|
x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
|
|
2179
2179
|
y: t / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
2180
2180
|
};
|
|
2181
2181
|
}
|
|
2182
|
-
function
|
|
2183
|
-
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(),
|
|
2182
|
+
function io(e, t, n) {
|
|
2183
|
+
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), fe(e));
|
|
2184
2184
|
}
|
|
2185
|
-
function
|
|
2185
|
+
function oe(e, t, n, o, s) {
|
|
2186
2186
|
A(e, {
|
|
2187
2187
|
x1: t + "",
|
|
2188
2188
|
y1: n + "",
|
|
@@ -2190,7 +2190,7 @@ function le(e, t, n, o, s) {
|
|
|
2190
2190
|
y2: s + ""
|
|
2191
2191
|
});
|
|
2192
2192
|
}
|
|
2193
|
-
function
|
|
2193
|
+
function Ue(e, t, n, o, s, i, l, c, r, a) {
|
|
2194
2194
|
const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${c} ${r}`;
|
|
2195
2195
|
if (e.line.setAttribute("d", d), a.style) {
|
|
2196
2196
|
const p = a.style;
|
|
@@ -2198,7 +2198,7 @@ function tt(e, t, n, o, s, i, l, c, r, a) {
|
|
|
2198
2198
|
}
|
|
2199
2199
|
const h = e.querySelectorAll('path[stroke="transparent"]');
|
|
2200
2200
|
h.length > 0 && h[0].setAttribute("d", d);
|
|
2201
|
-
const u =
|
|
2201
|
+
const u = ce(i, l, c, r);
|
|
2202
2202
|
if (u) {
|
|
2203
2203
|
const p = `M ${u.x1} ${u.y1} L ${c} ${r} L ${u.x2} ${u.y2}`;
|
|
2204
2204
|
if (e.arrow1.setAttribute("d", p), h.length > 1 && h[1].setAttribute("d", p), a.style) {
|
|
@@ -2207,7 +2207,7 @@ function tt(e, t, n, o, s, i, l, c, r, a) {
|
|
|
2207
2207
|
}
|
|
2208
2208
|
}
|
|
2209
2209
|
if (a.bidirectional) {
|
|
2210
|
-
const p =
|
|
2210
|
+
const p = ce(o, s, t, n);
|
|
2211
2211
|
if (p) {
|
|
2212
2212
|
const g = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
|
|
2213
2213
|
if (e.arrow2.setAttribute("d", g), h.length > 2 && h[2].setAttribute("d", g), a.style) {
|
|
@@ -2216,15 +2216,15 @@ function tt(e, t, n, o, s, i, l, c, r, a) {
|
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
2218
2218
|
}
|
|
2219
|
-
const { x: y, y: v } =
|
|
2220
|
-
if (e.labelEl &&
|
|
2219
|
+
const { x: y, y: v } = ft(t, n, o, s, i, l, c, r);
|
|
2220
|
+
if (e.labelEl && io(e.labelEl, y, v), a.style?.labelColor) {
|
|
2221
2221
|
const p = e.labelEl;
|
|
2222
2222
|
p && (p.style.color = a.style.labelColor);
|
|
2223
2223
|
}
|
|
2224
|
-
|
|
2224
|
+
go(e);
|
|
2225
2225
|
}
|
|
2226
|
-
function
|
|
2227
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
2226
|
+
function de(e, t, n) {
|
|
2227
|
+
const { offsetLeft: o, offsetTop: s } = j(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, c = o + i / 2, r = s + l / 2, a = c + n.x, d = r + n.y;
|
|
2228
2228
|
return {
|
|
2229
2229
|
w: i,
|
|
2230
2230
|
h: l,
|
|
@@ -2234,7 +2234,7 @@ function pe(e, t, n) {
|
|
|
2234
2234
|
ctrlY: d
|
|
2235
2235
|
};
|
|
2236
2236
|
}
|
|
2237
|
-
function
|
|
2237
|
+
function K(e) {
|
|
2238
2238
|
let t, n;
|
|
2239
2239
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
2240
2240
|
return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
|
|
@@ -2242,8 +2242,8 @@ function Z(e) {
|
|
|
2242
2242
|
y: n
|
|
2243
2243
|
};
|
|
2244
2244
|
}
|
|
2245
|
-
const
|
|
2246
|
-
const o =
|
|
2245
|
+
const ro = function(e, t, n) {
|
|
2246
|
+
const o = j(e.nodes, t), s = j(e.nodes, n), i = o.offsetLeft + t.offsetWidth / 2, l = o.offsetTop + t.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, r = s.offsetTop + n.offsetHeight / 2, a = c - i, d = r - l, h = Math.sqrt(a * a + d * d), u = Math.max(50, Math.min(200, h * 0.3)), y = Math.abs(a), v = Math.abs(d);
|
|
2247
2247
|
let p, g;
|
|
2248
2248
|
if (h < 150) {
|
|
2249
2249
|
const b = t.closest("me-main").className === "lhs" ? -1 : 1;
|
|
@@ -2259,32 +2259,32 @@ const fo = function(e, t, n) {
|
|
|
2259
2259
|
p = { x: x + C, y: L + S }, g = { x: T - C, y: E - S };
|
|
2260
2260
|
}
|
|
2261
2261
|
return { delta1: p, delta2: g };
|
|
2262
|
-
},
|
|
2262
|
+
}, De = function(e, t, n, o, s) {
|
|
2263
2263
|
if (!t || !n)
|
|
2264
2264
|
return;
|
|
2265
2265
|
if (!o.delta1 || !o.delta2) {
|
|
2266
|
-
const N =
|
|
2266
|
+
const N = ro(e, t, n);
|
|
2267
2267
|
o.delta1 = N.delta1, o.delta2 = N.delta2;
|
|
2268
2268
|
}
|
|
2269
|
-
const i =
|
|
2269
|
+
const i = de(e, t, o.delta1), l = de(e, n, o.delta2), { x: c, y: r } = K(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: y, y: v } = K(l), p = ce(h, u, y, v);
|
|
2270
2270
|
if (!p) return;
|
|
2271
2271
|
const g = `M ${p.x1} ${p.y1} L ${y} ${v} L ${p.x2} ${p.y2}`;
|
|
2272
2272
|
let m = "";
|
|
2273
2273
|
if (o.bidirectional) {
|
|
2274
|
-
const N =
|
|
2274
|
+
const N = ce(a, d, c, r);
|
|
2275
2275
|
if (!N) return;
|
|
2276
2276
|
m = `M ${N.x1} ${N.y1} L ${c} ${r} L ${N.x2} ${N.y2}`;
|
|
2277
2277
|
}
|
|
2278
|
-
const b =
|
|
2278
|
+
const b = Pn(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${y} ${v}`, g, m, o.style), { x, y: L } = ft(c, r, a, d, h, u, y, v), T = o.style?.labelColor || "rgb(235, 95, 82)", E = "arrow-" + o.id;
|
|
2279
2279
|
b.id = E;
|
|
2280
|
-
const C = e.markdown ? e.markdown(o.label, o) : o.label, S =
|
|
2280
|
+
const C = e.markdown ? e.markdown(o.label, o) : o.label, S = ye(C, x, L, {
|
|
2281
2281
|
anchor: "middle",
|
|
2282
2282
|
color: T,
|
|
2283
2283
|
dataType: "arrow",
|
|
2284
2284
|
svgId: E
|
|
2285
2285
|
});
|
|
2286
|
-
b.labelEl = S, b.arrowObj = o, b.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.linkSvgGroup.appendChild(b),
|
|
2287
|
-
},
|
|
2286
|
+
b.labelEl = S, b.arrowObj = o, b.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.linkSvgGroup.appendChild(b), fe(S), s || (e.arrows.push(o), e.currentArrow = b, ut(e, o, i, l));
|
|
2287
|
+
}, lo = function(e, t, n = {}) {
|
|
2288
2288
|
const o = {
|
|
2289
2289
|
id: V(),
|
|
2290
2290
|
label: "Custom Link",
|
|
@@ -2292,21 +2292,21 @@ const fo = function(e, t, n) {
|
|
|
2292
2292
|
to: t.nodeObj.id,
|
|
2293
2293
|
...n
|
|
2294
2294
|
};
|
|
2295
|
-
|
|
2295
|
+
De(this, e, t, o), this.bus.fire("operation", {
|
|
2296
2296
|
name: "createArrow",
|
|
2297
2297
|
obj: o
|
|
2298
2298
|
});
|
|
2299
|
-
},
|
|
2300
|
-
|
|
2299
|
+
}, co = function(e) {
|
|
2300
|
+
ue(this);
|
|
2301
2301
|
const t = { ...e, id: V() };
|
|
2302
|
-
|
|
2302
|
+
De(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2303
2303
|
name: "createArrow",
|
|
2304
2304
|
obj: t
|
|
2305
2305
|
});
|
|
2306
|
-
},
|
|
2306
|
+
}, ao = function(e) {
|
|
2307
2307
|
let t;
|
|
2308
2308
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2309
|
-
|
|
2309
|
+
ue(this);
|
|
2310
2310
|
const n = t.arrowObj.id;
|
|
2311
2311
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.labelEl?.remove(), t.remove(), this.bus.fire("operation", {
|
|
2312
2312
|
name: "removeArrow",
|
|
@@ -2314,14 +2314,14 @@ const fo = function(e, t, n) {
|
|
|
2314
2314
|
id: n
|
|
2315
2315
|
}
|
|
2316
2316
|
});
|
|
2317
|
-
},
|
|
2317
|
+
}, ho = function(e) {
|
|
2318
2318
|
this.currentArrow = e;
|
|
2319
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s =
|
|
2320
|
-
|
|
2321
|
-
},
|
|
2322
|
-
|
|
2323
|
-
},
|
|
2324
|
-
const n = document.createElementNS(
|
|
2319
|
+
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = de(this, n, t.delta1), i = de(this, o, t.delta2);
|
|
2320
|
+
ut(this, t, s, i);
|
|
2321
|
+
}, fo = function() {
|
|
2322
|
+
ue(this), this.currentArrow = null;
|
|
2323
|
+
}, ge = function(e, t) {
|
|
2324
|
+
const n = document.createElementNS(H, "path");
|
|
2325
2325
|
return A(n, {
|
|
2326
2326
|
d: e,
|
|
2327
2327
|
stroke: t,
|
|
@@ -2330,70 +2330,70 @@ const fo = function(e, t, n) {
|
|
|
2330
2330
|
"stroke-linecap": "round",
|
|
2331
2331
|
"stroke-linejoin": "round"
|
|
2332
2332
|
}), n;
|
|
2333
|
-
},
|
|
2334
|
-
const n = document.createElementNS(
|
|
2333
|
+
}, uo = function(e, t) {
|
|
2334
|
+
const n = document.createElementNS(H, "g");
|
|
2335
2335
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2336
|
-
const o =
|
|
2336
|
+
const o = ge(e.line.getAttribute("d"), t);
|
|
2337
2337
|
n.appendChild(o);
|
|
2338
|
-
const s =
|
|
2338
|
+
const s = ge(e.arrow1.getAttribute("d"), t);
|
|
2339
2339
|
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2340
|
-
const i =
|
|
2340
|
+
const i = ge(e.arrow2.getAttribute("d"), t);
|
|
2341
2341
|
n.appendChild(i);
|
|
2342
2342
|
}
|
|
2343
2343
|
e.insertBefore(n, e.firstChild);
|
|
2344
|
-
},
|
|
2344
|
+
}, po = function(e) {
|
|
2345
2345
|
const t = e.querySelector(".arrow-highlight");
|
|
2346
2346
|
t && t.remove();
|
|
2347
|
-
},
|
|
2347
|
+
}, go = function(e) {
|
|
2348
2348
|
const t = e.querySelector(".arrow-highlight");
|
|
2349
2349
|
if (!t) return;
|
|
2350
2350
|
const n = t.querySelectorAll("path");
|
|
2351
2351
|
n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
|
|
2352
|
-
},
|
|
2353
|
-
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow &&
|
|
2354
|
-
},
|
|
2352
|
+
}, ue = function(e) {
|
|
2353
|
+
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && po(e.currentArrow);
|
|
2354
|
+
}, ut = function(e, t, n, o) {
|
|
2355
2355
|
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: d, currentArrow: h, bus: u } = e;
|
|
2356
2356
|
if (!h) return;
|
|
2357
|
-
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l),
|
|
2358
|
-
let { x: y, y: v } =
|
|
2359
|
-
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${b}px;left:${m}px;`,
|
|
2357
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), uo(h, so);
|
|
2358
|
+
let { x: y, y: v } = K(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: b } = o, { x, y: L } = K(o);
|
|
2359
|
+
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${b}px;left:${m}px;`, oe(c, y, v, p, g), oe(r, m, b, x, L), e.helper1 = Ke.create(i), e.helper2 = Ke.create(l), e.helper1.init(d, (T, E) => {
|
|
2360
2360
|
p = p + T / e.scaleVal, g = g + E / e.scaleVal;
|
|
2361
|
-
const C =
|
|
2362
|
-
y = C.x, v = C.y, i.style.top = g + "px", i.style.left = p + "px",
|
|
2361
|
+
const C = K({ ...n, ctrlX: p, ctrlY: g });
|
|
2362
|
+
y = C.x, v = C.y, i.style.top = g + "px", i.style.left = p + "px", Ue(h, y, v, p, g, m, b, x, L, t), oe(c, y, v, p, g), t.delta1.x = p - n.cx, t.delta1.y = g - n.cy, u.fire("updateArrowDelta", t);
|
|
2363
2363
|
}), e.helper2.init(d, (T, E) => {
|
|
2364
2364
|
m = m + T / e.scaleVal, b = b + E / e.scaleVal;
|
|
2365
|
-
const C =
|
|
2366
|
-
x = C.x, L = C.y, l.style.top = b + "px", l.style.left = m + "px",
|
|
2365
|
+
const C = K({ ...o, ctrlX: m, ctrlY: b });
|
|
2366
|
+
x = C.x, L = C.y, l.style.top = b + "px", l.style.left = m + "px", Ue(h, y, v, p, g, m, b, x, L, t), oe(r, m, b, x, L), t.delta2.x = m - o.cx, t.delta2.y = b - o.cy, u.fire("updateArrowDelta", t);
|
|
2367
2367
|
});
|
|
2368
2368
|
};
|
|
2369
|
-
function
|
|
2369
|
+
function mo() {
|
|
2370
2370
|
this.linkSvgGroup.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((t) => t.remove());
|
|
2371
2371
|
for (let t = 0; t < this.arrows.length; t++) {
|
|
2372
2372
|
const n = this.arrows[t];
|
|
2373
2373
|
try {
|
|
2374
|
-
|
|
2374
|
+
De(this, this.findEle(n.from), this.findEle(n.to), n, !0);
|
|
2375
2375
|
} catch {
|
|
2376
2376
|
}
|
|
2377
2377
|
}
|
|
2378
2378
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
2379
2379
|
}
|
|
2380
|
-
function
|
|
2381
|
-
|
|
2380
|
+
function yo(e) {
|
|
2381
|
+
ue(this), e && e.labelEl && at(this, e.labelEl, e.arrowObj);
|
|
2382
2382
|
}
|
|
2383
|
-
function
|
|
2384
|
-
this.arrows = this.arrows.filter((e) =>
|
|
2383
|
+
function vo() {
|
|
2384
|
+
this.arrows = this.arrows.filter((e) => le(e.from, this.nodeData) && le(e.to, this.nodeData));
|
|
2385
2385
|
}
|
|
2386
|
-
const
|
|
2386
|
+
const bo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2387
2387
|
__proto__: null,
|
|
2388
|
-
createArrow:
|
|
2389
|
-
createArrowFrom:
|
|
2390
|
-
editArrowLabel:
|
|
2391
|
-
removeArrow:
|
|
2392
|
-
renderArrow:
|
|
2393
|
-
selectArrow:
|
|
2394
|
-
tidyArrow:
|
|
2395
|
-
unselectArrow:
|
|
2396
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2388
|
+
createArrow: lo,
|
|
2389
|
+
createArrowFrom: co,
|
|
2390
|
+
editArrowLabel: yo,
|
|
2391
|
+
removeArrow: ao,
|
|
2392
|
+
renderArrow: mo,
|
|
2393
|
+
selectArrow: ho,
|
|
2394
|
+
tidyArrow: vo,
|
|
2395
|
+
unselectArrow: fo
|
|
2396
|
+
}, Symbol.toStringTag, { value: "Module" })), wo = function(e) {
|
|
2397
2397
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2398
2398
|
if (e.length === 1) {
|
|
2399
2399
|
const r = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
@@ -2430,11 +2430,11 @@ const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2430
2430
|
start: i,
|
|
2431
2431
|
end: l
|
|
2432
2432
|
};
|
|
2433
|
-
},
|
|
2434
|
-
const t = document.createElementNS(
|
|
2433
|
+
}, xo = function(e) {
|
|
2434
|
+
const t = document.createElementNS(H, "g");
|
|
2435
2435
|
return t.setAttribute("id", e), t;
|
|
2436
|
-
},
|
|
2437
|
-
const n = document.createElementNS(
|
|
2436
|
+
}, Je = function(e, t) {
|
|
2437
|
+
const n = document.createElementNS(H, "path");
|
|
2438
2438
|
return A(n, {
|
|
2439
2439
|
d: e,
|
|
2440
2440
|
stroke: t || "#666",
|
|
@@ -2442,89 +2442,89 @@ const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2442
2442
|
"stroke-linecap": "round",
|
|
2443
2443
|
"stroke-width": "2"
|
|
2444
2444
|
}), n;
|
|
2445
|
-
},
|
|
2445
|
+
}, Co = (e) => e.parentElement.parentElement, Eo = function(e, { parent: t, start: n }) {
|
|
2446
2446
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2447
2447
|
let i;
|
|
2448
2448
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2449
|
-
},
|
|
2450
|
-
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, y =
|
|
2449
|
+
}, Me = function(e, t) {
|
|
2450
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, y = Eo(e, t);
|
|
2451
2451
|
let v = 1 / 0, p = 0, g = 0, m = 0;
|
|
2452
2452
|
for (let f = i; f <= l; f++) {
|
|
2453
2453
|
const w = u.children?.[f];
|
|
2454
2454
|
if (!w)
|
|
2455
2455
|
return e.removeSummary(n), null;
|
|
2456
|
-
const k =
|
|
2457
|
-
f === i && (g =
|
|
2456
|
+
const k = Co(e.findEle(w.id)), { offsetLeft: O, offsetTop: W } = j(r, k), M = i === l ? 10 : 20;
|
|
2457
|
+
f === i && (g = W + M), f === l && (m = W + k.offsetHeight - M), O < v && (v = O), k.offsetWidth + O > p && (p = k.offsetWidth + O);
|
|
2458
2458
|
}
|
|
2459
2459
|
let b, x;
|
|
2460
|
-
const L = u.parent ? 10 : 0, T = g + L, E = m + L, C = (T + E) / 2, S = c?.stroke || a.cssVar["--color"], N = c?.labelColor || a.cssVar["--color"],
|
|
2461
|
-
y ===
|
|
2462
|
-
const
|
|
2463
|
-
return
|
|
2464
|
-
},
|
|
2460
|
+
const L = u.parent ? 10 : 0, T = g + L, E = m + L, C = (T + E) / 2, S = c?.stroke || a.cssVar["--color"], N = c?.labelColor || a.cssVar["--color"], D = "s-" + n, _ = e.markdown ? e.markdown(o, t) : o;
|
|
2461
|
+
y === R.LHS ? (b = Je(`M ${v + 10} ${T} c -5 0 -10 5 -10 10 L ${v} ${E - 10} c 0 5 5 10 10 10 M ${v} ${C} h -10`, S), x = ye(_, v - 20, C, { anchor: "end", color: N, dataType: "summary", svgId: D })) : (b = Je(`M ${p - 10} ${T} c 5 0 10 5 10 10 L ${p} ${E - 10} c 0 5 -5 10 -10 10 M ${p} ${C} h 10`, S), x = ye(_, p + 20, C, { anchor: "start", color: N, dataType: "summary", svgId: D }));
|
|
2462
|
+
const B = xo(D);
|
|
2463
|
+
return B.appendChild(b), e.labelContainer.appendChild(x), fe(x), B.summaryObj = t, B.labelEl = x, d.appendChild(B), B;
|
|
2464
|
+
}, So = function(e = {}) {
|
|
2465
2465
|
if (!this.currentNodes) return;
|
|
2466
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } =
|
|
2466
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = wo(t), c = { id: V(), parent: s, start: i, end: l, label: "summary", style: e.style }, r = Me(this, c);
|
|
2467
2467
|
n.push(c), this.editSummary(r), o.fire("operation", {
|
|
2468
2468
|
name: "createSummary",
|
|
2469
2469
|
obj: c
|
|
2470
2470
|
});
|
|
2471
|
-
},
|
|
2471
|
+
}, No = function(e) {
|
|
2472
2472
|
const t = V(), n = { ...e, id: t };
|
|
2473
|
-
|
|
2473
|
+
Me(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2474
2474
|
name: "createSummary",
|
|
2475
2475
|
obj: n
|
|
2476
2476
|
});
|
|
2477
|
-
},
|
|
2477
|
+
}, ko = function(e) {
|
|
2478
2478
|
const t = this.summaries.findIndex((n) => n.id === e);
|
|
2479
2479
|
t > -1 && (this.summaries.splice(t, 1), this.nodes.querySelector("#s-" + e)?.remove(), this.nodes.querySelector("#label-s-" + e)?.remove()), this.bus.fire("operation", {
|
|
2480
2480
|
name: "removeSummary",
|
|
2481
2481
|
obj: { id: e }
|
|
2482
2482
|
});
|
|
2483
|
-
},
|
|
2483
|
+
}, To = function(e) {
|
|
2484
2484
|
const t = e.labelEl;
|
|
2485
2485
|
t && t.classList.add("selected"), this.currentSummary = e;
|
|
2486
|
-
},
|
|
2486
|
+
}, _o = function() {
|
|
2487
2487
|
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
2488
|
-
},
|
|
2488
|
+
}, Lo = function() {
|
|
2489
2489
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2490
2490
|
try {
|
|
2491
|
-
|
|
2491
|
+
Me(this, e);
|
|
2492
2492
|
} catch {
|
|
2493
2493
|
}
|
|
2494
2494
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2495
|
-
},
|
|
2496
|
-
e && e.labelEl &&
|
|
2497
|
-
},
|
|
2495
|
+
}, Ao = function(e) {
|
|
2496
|
+
e && e.labelEl && at(this, e.labelEl, e.summaryObj);
|
|
2497
|
+
}, Do = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2498
2498
|
__proto__: null,
|
|
2499
|
-
createSummary:
|
|
2500
|
-
createSummaryFrom:
|
|
2501
|
-
editSummary:
|
|
2502
|
-
removeSummary:
|
|
2503
|
-
renderSummary:
|
|
2504
|
-
selectSummary:
|
|
2505
|
-
unselectSummary:
|
|
2506
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2507
|
-
function
|
|
2508
|
-
const n = document.createElementNS(
|
|
2499
|
+
createSummary: So,
|
|
2500
|
+
createSummaryFrom: No,
|
|
2501
|
+
editSummary: Ao,
|
|
2502
|
+
removeSummary: ko,
|
|
2503
|
+
renderSummary: Lo,
|
|
2504
|
+
selectSummary: To,
|
|
2505
|
+
unselectSummary: _o
|
|
2506
|
+
}, Symbol.toStringTag, { value: "Module" })), P = "http://www.w3.org/2000/svg";
|
|
2507
|
+
function Mo(e, t) {
|
|
2508
|
+
const n = document.createElementNS(P, "svg");
|
|
2509
2509
|
return A(n, {
|
|
2510
2510
|
version: "1.1",
|
|
2511
|
-
xmlns:
|
|
2511
|
+
xmlns: P,
|
|
2512
2512
|
height: e,
|
|
2513
2513
|
width: t
|
|
2514
2514
|
}), n;
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2516
|
+
function Po(e, t) {
|
|
2517
2517
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2518
2518
|
}
|
|
2519
|
-
function
|
|
2520
|
-
const s = document.createElementNS(
|
|
2519
|
+
function Oo(e, t, n, o) {
|
|
2520
|
+
const s = document.createElementNS(P, "g");
|
|
2521
2521
|
let i = "";
|
|
2522
2522
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2523
2523
|
`).forEach((c, r) => {
|
|
2524
|
-
const a = document.createElementNS(
|
|
2524
|
+
const a = document.createElementNS(P, "text");
|
|
2525
2525
|
A(a, {
|
|
2526
2526
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2527
|
-
y: o + parseInt(t.paddingTop) +
|
|
2527
|
+
y: o + parseInt(t.paddingTop) + Po(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
|
|
2528
2528
|
"text-anchor": "start",
|
|
2529
2529
|
"font-family": t.fontFamily,
|
|
2530
2530
|
"font-size": `${t.fontSize}`,
|
|
@@ -2533,10 +2533,10 @@ function Io(e, t, n, o) {
|
|
|
2533
2533
|
}), a.innerHTML = c, s.appendChild(a);
|
|
2534
2534
|
}), s;
|
|
2535
2535
|
}
|
|
2536
|
-
function
|
|
2536
|
+
function $o(e, t, n, o) {
|
|
2537
2537
|
let s = "";
|
|
2538
2538
|
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2539
|
-
const i = document.createElementNS(
|
|
2539
|
+
const i = document.createElementNS(P, "foreignObject");
|
|
2540
2540
|
A(i, {
|
|
2541
2541
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2542
2542
|
y: o + parseInt(t.paddingTop) + "",
|
|
@@ -2549,8 +2549,8 @@ function Bo(e, t, n, o) {
|
|
|
2549
2549
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2550
2550
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2551
2551
|
}
|
|
2552
|
-
function
|
|
2553
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2552
|
+
function jo(e, t) {
|
|
2553
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = j(e.nodes, t), i = document.createElementNS(P, "rect");
|
|
2554
2554
|
return A(i, {
|
|
2555
2555
|
x: o + "",
|
|
2556
2556
|
y: s + "",
|
|
@@ -2563,8 +2563,8 @@ function Fo(e, t) {
|
|
|
2563
2563
|
"stroke-width": n.borderWidth
|
|
2564
2564
|
}), i;
|
|
2565
2565
|
}
|
|
2566
|
-
function
|
|
2567
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2566
|
+
function se(e, t, n = !1) {
|
|
2567
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = j(e.nodes, t), l = document.createElementNS(P, "rect");
|
|
2568
2568
|
A(l, {
|
|
2569
2569
|
x: s + "",
|
|
2570
2570
|
y: i + "",
|
|
@@ -2576,13 +2576,13 @@ function ce(e, t, n = !1) {
|
|
|
2576
2576
|
stroke: o.borderColor,
|
|
2577
2577
|
"stroke-width": o.borderWidth
|
|
2578
2578
|
});
|
|
2579
|
-
const c = document.createElementNS(
|
|
2579
|
+
const c = document.createElementNS(P, "g");
|
|
2580
2580
|
c.appendChild(l);
|
|
2581
2581
|
let r;
|
|
2582
|
-
return n ? r =
|
|
2582
|
+
return n ? r = $o(t, o, s, i) : r = Oo(t, o, s, i), c.appendChild(r), c;
|
|
2583
2583
|
}
|
|
2584
|
-
function
|
|
2585
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2584
|
+
function Ho(e, t) {
|
|
2585
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = j(e.nodes, t), i = document.createElementNS(P, "a"), l = document.createElementNS(P, "text");
|
|
2586
2586
|
return A(l, {
|
|
2587
2587
|
x: o + "",
|
|
2588
2588
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2593,8 +2593,8 @@ function Yo(e, t) {
|
|
|
2593
2593
|
fill: `${n.color}`
|
|
2594
2594
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2597
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2596
|
+
function Ro(e, t) {
|
|
2597
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = j(e.nodes, t), i = document.createElementNS(P, "image");
|
|
2598
2598
|
return A(i, {
|
|
2599
2599
|
x: o + "",
|
|
2600
2600
|
y: s + "",
|
|
@@ -2603,8 +2603,8 @@ function Wo(e, t) {
|
|
|
2603
2603
|
href: t.src
|
|
2604
2604
|
}), i;
|
|
2605
2605
|
}
|
|
2606
|
-
const
|
|
2607
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
2606
|
+
const ie = 100, Io = '<?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">', Bo = (e, t = !1) => {
|
|
2607
|
+
const n = e.nodes, o = n.offsetHeight + ie * 2, s = n.offsetWidth + ie * 2, i = Mo(o + "px", s + "px"), l = document.createElementNS(P, "svg"), c = document.createElementNS(P, "rect");
|
|
2608
2608
|
A(c, {
|
|
2609
2609
|
x: "0",
|
|
2610
2610
|
y: "0",
|
|
@@ -2612,7 +2612,7 @@ const ae = 100, Xo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2612
2612
|
height: `${o}`,
|
|
2613
2613
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2614
2614
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((h) => {
|
|
2615
|
-
const u = h.cloneNode(!0), { offsetLeft: y, offsetTop: v } =
|
|
2615
|
+
const u = h.cloneNode(!0), { offsetLeft: y, offsetTop: v } = j(n, h.parentElement);
|
|
2616
2616
|
u.setAttribute("x", `${y}`), u.setAttribute("y", `${v}`), l.appendChild(u);
|
|
2617
2617
|
});
|
|
2618
2618
|
const r = n.querySelector(".lines")?.cloneNode(!0);
|
|
@@ -2621,22 +2621,22 @@ const ae = 100, Xo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2621
2621
|
a && l.appendChild(a);
|
|
2622
2622
|
const d = n.querySelector(".summary")?.cloneNode(!0);
|
|
2623
2623
|
return d && l.appendChild(d), n.querySelectorAll("me-tpc").forEach((h) => {
|
|
2624
|
-
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(
|
|
2624
|
+
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(se(e, h, !t)) : (l.appendChild(jo(e, h)), l.appendChild(se(e, h.text, !t)));
|
|
2625
2625
|
}), n.querySelectorAll(".tags > span").forEach((h) => {
|
|
2626
|
-
l.appendChild(
|
|
2626
|
+
l.appendChild(se(e, h));
|
|
2627
2627
|
}), n.querySelectorAll(".icons > span").forEach((h) => {
|
|
2628
|
-
l.appendChild(
|
|
2628
|
+
l.appendChild(se(e, h));
|
|
2629
2629
|
}), n.querySelectorAll(".hyper-link").forEach((h) => {
|
|
2630
|
-
l.appendChild(
|
|
2630
|
+
l.appendChild(Ho(e, h));
|
|
2631
2631
|
}), n.querySelectorAll("img").forEach((h) => {
|
|
2632
|
-
l.appendChild(
|
|
2632
|
+
l.appendChild(Ro(e, h));
|
|
2633
2633
|
}), A(l, {
|
|
2634
|
-
x:
|
|
2635
|
-
y:
|
|
2634
|
+
x: ie + "",
|
|
2635
|
+
y: ie + "",
|
|
2636
2636
|
overflow: "visible"
|
|
2637
2637
|
}), i.appendChild(l), i;
|
|
2638
|
-
},
|
|
2639
|
-
function
|
|
2638
|
+
}, Fo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Io + e.outerHTML);
|
|
2639
|
+
function Yo(e) {
|
|
2640
2640
|
return new Promise((t, n) => {
|
|
2641
2641
|
const o = new FileReader();
|
|
2642
2642
|
o.onload = (s) => {
|
|
@@ -2646,11 +2646,11 @@ function qo(e) {
|
|
|
2646
2646
|
}, o.readAsDataURL(e);
|
|
2647
2647
|
});
|
|
2648
2648
|
}
|
|
2649
|
-
const
|
|
2650
|
-
const n =
|
|
2649
|
+
const Wo = function(e = !1, t) {
|
|
2650
|
+
const n = Bo(this, e), o = Fo(n, t);
|
|
2651
2651
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2652
|
-
},
|
|
2653
|
-
const n = this.exportSvg(e, t), o = await
|
|
2652
|
+
}, Xo = async function(e = !1, t) {
|
|
2653
|
+
const n = this.exportSvg(e, t), o = await Yo(n);
|
|
2654
2654
|
return new Promise((s, i) => {
|
|
2655
2655
|
const l = new Image();
|
|
2656
2656
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
@@ -2658,66 +2658,66 @@ const Vo = function(e = !1, t) {
|
|
|
2658
2658
|
c.width = l.width, c.height = l.height, c.getContext("2d").drawImage(l, 0, 0), c.toBlob(s, "image/png", 1);
|
|
2659
2659
|
}, l.src = o, l.onerror = i;
|
|
2660
2660
|
});
|
|
2661
|
-
},
|
|
2661
|
+
}, zo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2662
2662
|
__proto__: null,
|
|
2663
|
-
exportPng:
|
|
2664
|
-
exportSvg:
|
|
2663
|
+
exportPng: Xo,
|
|
2664
|
+
exportSvg: Wo
|
|
2665
2665
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2666
|
-
function
|
|
2666
|
+
function Go(e, t) {
|
|
2667
2667
|
return async function(...n) {
|
|
2668
2668
|
const o = this.before[t];
|
|
2669
2669
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2670
2670
|
};
|
|
2671
2671
|
}
|
|
2672
|
-
const
|
|
2673
|
-
for (let e = 0; e <
|
|
2674
|
-
const t =
|
|
2675
|
-
|
|
2672
|
+
const Ze = Object.keys(it), pt = {};
|
|
2673
|
+
for (let e = 0; e < Ze.length; e++) {
|
|
2674
|
+
const t = Ze[e];
|
|
2675
|
+
pt[t] = Go(it[t], t);
|
|
2676
2676
|
}
|
|
2677
|
-
const
|
|
2678
|
-
getObjById:
|
|
2679
|
-
generateNewObj:
|
|
2680
|
-
layout:
|
|
2681
|
-
linkDiv:
|
|
2682
|
-
editTopic:
|
|
2683
|
-
createWrapper:
|
|
2684
|
-
createParent:
|
|
2685
|
-
createChildren:
|
|
2686
|
-
createTopic:
|
|
2687
|
-
findEle:
|
|
2688
|
-
changeTheme:
|
|
2689
|
-
...
|
|
2690
|
-
...
|
|
2691
|
-
...
|
|
2692
|
-
...
|
|
2693
|
-
...
|
|
2677
|
+
const Vo = {
|
|
2678
|
+
getObjById: le,
|
|
2679
|
+
generateNewObj: gt,
|
|
2680
|
+
layout: mt,
|
|
2681
|
+
linkDiv: On,
|
|
2682
|
+
editTopic: Et,
|
|
2683
|
+
createWrapper: bt,
|
|
2684
|
+
createParent: wt,
|
|
2685
|
+
createChildren: xt,
|
|
2686
|
+
createTopic: Ct,
|
|
2687
|
+
findEle: et,
|
|
2688
|
+
changeTheme: no,
|
|
2689
|
+
...mn,
|
|
2690
|
+
...pt,
|
|
2691
|
+
...bo,
|
|
2692
|
+
...Do,
|
|
2693
|
+
...zo,
|
|
2694
2694
|
init(e) {
|
|
2695
2695
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2696
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
2696
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, G(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && qn(this), this.keypress && Cn(this, this.keypress), this.editable && (to(this), this.disposable.push(An())), this.contextMenu && this.disposable.push($n(this, this.contextMenu)), this.allowUndo && this.disposable.push(Hn(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2697
2697
|
},
|
|
2698
2698
|
destroy() {
|
|
2699
2699
|
this.disposable.forEach((e) => e()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.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;
|
|
2700
2700
|
}
|
|
2701
2701
|
};
|
|
2702
|
-
function
|
|
2702
|
+
function qo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, containerHeight: a }) {
|
|
2703
2703
|
let d = t + n / 2;
|
|
2704
2704
|
const h = e + o / 2;
|
|
2705
2705
|
let u;
|
|
2706
|
-
r ===
|
|
2706
|
+
r === R.LHS ? u = i + l : u = i;
|
|
2707
2707
|
const y = s + c / 2, p = (1 - Math.abs(y - h) / a) * 0.25 * (n / 2);
|
|
2708
|
-
return r ===
|
|
2708
|
+
return r === R.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${y} ${u} ${y}`;
|
|
2709
2709
|
}
|
|
2710
|
-
function
|
|
2710
|
+
function Ko({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, isFirst: a }) {
|
|
2711
2711
|
const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2712
2712
|
let h = 0, u = 0;
|
|
2713
2713
|
a ? h = e + o / 2 : h = e + o;
|
|
2714
2714
|
const y = s + c;
|
|
2715
2715
|
let v = 0, p = 0, g = 0;
|
|
2716
2716
|
const m = Math.abs(h - y) / 300 * d;
|
|
2717
|
-
return r ===
|
|
2717
|
+
return r === R.LHS ? (g = t, v = g + d, p = g - d, u = i + d, `M ${v} ${h} C ${g} ${h} ${g + m} ${y} ${p} ${y} H ${u}`) : (g = t + n, v = g - d, p = g + d, u = i + l - d, `M ${v} ${h} C ${g} ${h} ${g - m} ${y} ${p} ${y} H ${u}`);
|
|
2718
2718
|
}
|
|
2719
|
-
const
|
|
2720
|
-
function
|
|
2719
|
+
const Uo = "5.9.1";
|
|
2720
|
+
function Jo(e) {
|
|
2721
2721
|
return {
|
|
2722
2722
|
x: 0,
|
|
2723
2723
|
y: 0,
|
|
@@ -2732,8 +2732,7 @@ function ns(e) {
|
|
|
2732
2732
|
}
|
|
2733
2733
|
};
|
|
2734
2734
|
}
|
|
2735
|
-
|
|
2736
|
-
function B({
|
|
2735
|
+
function I({
|
|
2737
2736
|
el: e,
|
|
2738
2737
|
direction: t,
|
|
2739
2738
|
locale: n,
|
|
@@ -2762,27 +2761,27 @@ function B({
|
|
|
2762
2761
|
let S = null;
|
|
2763
2762
|
const N = Object.prototype.toString.call(e);
|
|
2764
2763
|
if (N === "[object HTMLDivElement]" ? S = e : N === "[object String]" && (S = document.querySelector(e)), !S) throw new Error("MindElixir: el is not a valid element");
|
|
2765
|
-
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.newTopicName = d || "New Node", this.contextMenu = s ?? !0, this.toolBar = i ?? !0, this.keypress = l ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.editable = o ?? !0, this.allowUndo = h ?? !0, this.scaleSensitivity = m ?? 0.1, this.scaleMax = b ?? 1.4, this.scaleMin = x ?? 0.2, this.generateMainBranch = u ||
|
|
2766
|
-
const
|
|
2767
|
-
this.theme = p || (
|
|
2768
|
-
const _ =
|
|
2769
|
-
_.className = "map-canvas", this.map = _, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes =
|
|
2764
|
+
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.newTopicName = d || "New Node", this.contextMenu = s ?? !0, this.toolBar = i ?? !0, this.keypress = l ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.editable = o ?? !0, this.allowUndo = h ?? !0, this.scaleSensitivity = m ?? 0.1, this.scaleMax = b ?? 1.4, this.scaleMin = x ?? 0.2, this.generateMainBranch = u || qo, this.generateSubBranch = y || Ko, this.overflowHidden = v ?? !1, this.alignment = g ?? "root", this.handleWheel = L ?? !0, this.markdown = T || void 0, this.imageProxy = E || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Jo(this), this.bus = Mn(), this.container = document.createElement("div"), this.selectionContainer = r || this.container, this.container.className = "map-container";
|
|
2765
|
+
const D = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2766
|
+
this.theme = p || (D.matches ? we : be);
|
|
2767
|
+
const _ = document.createElement("div");
|
|
2768
|
+
_.className = "map-canvas", this.map = _, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = Q("lines"), this.summarySvg = Q("summary"), this.linkController = Q("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 = Ie(), this.line2 = Ie(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = Q("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(Dn(this)), C && (this.pasteHandler = C);
|
|
2770
2769
|
}
|
|
2771
|
-
|
|
2772
|
-
Object.defineProperty(
|
|
2770
|
+
I.prototype = Vo;
|
|
2771
|
+
Object.defineProperty(I.prototype, "currentNode", {
|
|
2773
2772
|
get() {
|
|
2774
2773
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
2775
2774
|
},
|
|
2776
2775
|
enumerable: !0
|
|
2777
2776
|
});
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2777
|
+
I.LEFT = 0;
|
|
2778
|
+
I.RIGHT = 1;
|
|
2779
|
+
I.SIDE = 2;
|
|
2780
|
+
I.THEME = be;
|
|
2781
|
+
I.DARK_THEME = we;
|
|
2782
|
+
I.version = Uo;
|
|
2783
|
+
I.E = et;
|
|
2784
|
+
I.new = (e) => ({
|
|
2786
2785
|
nodeData: {
|
|
2787
2786
|
id: V(),
|
|
2788
2787
|
topic: e || "new topic",
|
|
@@ -2790,10 +2789,10 @@ B.new = (e) => ({
|
|
|
2790
2789
|
}
|
|
2791
2790
|
});
|
|
2792
2791
|
export {
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2792
|
+
we as DARK_THEME,
|
|
2793
|
+
Zo as LEFT,
|
|
2794
|
+
Qo as RIGHT,
|
|
2795
|
+
es as SIDE,
|
|
2796
|
+
be as THEME,
|
|
2797
|
+
I as default
|
|
2799
2798
|
};
|