mind-elixir 5.9.0 → 5.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +604 -609
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +539 -540
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/readme.md +2 -6
package/dist/MindElixir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Jo = 0, Zo = 1, Qo = 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
|
+
}, B = {
|
|
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 = B.LHS;
|
|
171
|
+
const s = document.createElement("me-main");
|
|
172
|
+
s.className = B.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) => {
|
|
@@ -276,55 +276,55 @@ const _t = function(e) {
|
|
|
276
276
|
}), t.addEventListener("blur", () => {
|
|
277
277
|
if (!t) return;
|
|
278
278
|
t.remove();
|
|
279
|
-
const c = t.
|
|
279
|
+
const c = t.innerText?.trim() || "";
|
|
280
280
|
c === o || c === "" || (n.topic = c, this.markdown ? e.text.innerHTML = this.markdown(n.topic, n) : e.text.textContent = c, this.linkDiv(), this.bus.fire("operation", {
|
|
281
281
|
name: "finishEdit",
|
|
282
282
|
obj: n,
|
|
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 === B.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,51 @@ 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
|
+
}, It = 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
|
-
},
|
|
476
|
-
if (e.length === 0) return;
|
|
477
|
-
e = _e(e);
|
|
475
|
+
}, Rt = function(e) {
|
|
476
|
+
if (e = Ee(e), e.length === 0) return;
|
|
478
477
|
for (const n of e) {
|
|
479
|
-
const o = n.nodeObj, s =
|
|
480
|
-
|
|
478
|
+
const o = n.nodeObj, s = nt(o);
|
|
479
|
+
At(n, s);
|
|
481
480
|
}
|
|
482
481
|
const t = e[e.length - 1];
|
|
483
482
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
484
483
|
name: "removeNodes",
|
|
485
484
|
objs: e.map((n) => n.nodeObj)
|
|
486
485
|
});
|
|
487
|
-
},
|
|
488
|
-
e =
|
|
486
|
+
}, _e = (e, t, n, o) => {
|
|
487
|
+
e = Ee(e);
|
|
489
488
|
let s = n.nodeObj;
|
|
490
489
|
t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
|
|
491
490
|
const i = [];
|
|
492
491
|
for (const c of e) {
|
|
493
492
|
const r = c.nodeObj;
|
|
494
|
-
if (
|
|
493
|
+
if (_t(t, r, s), G(o.nodeData), t === "in") {
|
|
495
494
|
const a = c.parentElement;
|
|
496
|
-
|
|
495
|
+
ot(o, n, a.parentElement);
|
|
497
496
|
} else {
|
|
498
|
-
|
|
497
|
+
ee(c);
|
|
499
498
|
const a = c.parentElement.parentNode;
|
|
500
|
-
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(
|
|
499
|
+
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(st[t], a);
|
|
501
500
|
}
|
|
502
501
|
}
|
|
503
502
|
for (const c of i)
|
|
@@ -509,36 +508,36 @@ const Ot = function({ map: e, direction: t }, n) {
|
|
|
509
508
|
objs: e.map((c) => c.nodeObj),
|
|
510
509
|
toObj: s
|
|
511
510
|
});
|
|
512
|
-
},
|
|
513
|
-
|
|
514
|
-
},
|
|
515
|
-
|
|
516
|
-
},
|
|
517
|
-
|
|
518
|
-
},
|
|
511
|
+
}, Bt = function(e, t) {
|
|
512
|
+
_e(e, "in", t, this);
|
|
513
|
+
}, Ft = function(e, t) {
|
|
514
|
+
_e(e, "before", t, this);
|
|
515
|
+
}, Yt = function(e, t) {
|
|
516
|
+
_e(e, "after", t, this);
|
|
517
|
+
}, Wt = function(e) {
|
|
519
518
|
const t = e || this.currentNode;
|
|
520
519
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
521
|
-
},
|
|
520
|
+
}, Xt = function(e, t) {
|
|
522
521
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
523
|
-
},
|
|
522
|
+
}, it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
524
523
|
__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:
|
|
524
|
+
addChild: Ot,
|
|
525
|
+
beginEdit: Wt,
|
|
526
|
+
copyNode: $t,
|
|
527
|
+
copyNodes: jt,
|
|
528
|
+
insertParent: Pt,
|
|
529
|
+
insertSibling: Mt,
|
|
530
|
+
moveDownNode: It,
|
|
531
|
+
moveNodeAfter: Yt,
|
|
532
|
+
moveNodeBefore: Ft,
|
|
533
|
+
moveNodeIn: Bt,
|
|
534
|
+
moveUpNode: Ht,
|
|
535
|
+
removeNodes: Rt,
|
|
536
|
+
reshapeNode: Dt,
|
|
537
|
+
rmSubline: ee,
|
|
538
|
+
setNodeTopic: Xt
|
|
540
539
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
541
|
-
function
|
|
540
|
+
function zt(e) {
|
|
542
541
|
return {
|
|
543
542
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
544
543
|
arrows: e.arrows,
|
|
@@ -547,49 +546,49 @@ function Ut(e) {
|
|
|
547
546
|
theme: e.theme
|
|
548
547
|
};
|
|
549
548
|
}
|
|
550
|
-
const
|
|
549
|
+
const Gt = function(e) {
|
|
551
550
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
552
551
|
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
553
552
|
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
553
|
this.move(-a, -d, !0);
|
|
555
554
|
}
|
|
556
|
-
},
|
|
555
|
+
}, Vt = function(e, t, n) {
|
|
557
556
|
this.clearSelection(), this.scrollIntoView(e), this.selection?.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
558
|
-
},
|
|
557
|
+
}, qt = function(e) {
|
|
559
558
|
this.selection?.select(e);
|
|
560
|
-
},
|
|
559
|
+
}, Kt = function(e) {
|
|
561
560
|
this.selection?.deselect(e);
|
|
562
|
-
},
|
|
561
|
+
}, Ut = function() {
|
|
563
562
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
564
|
-
},
|
|
563
|
+
}, Le = function(e) {
|
|
565
564
|
return JSON.stringify(e, (t, n) => {
|
|
566
565
|
if (!(t === "parent" && typeof n != "string"))
|
|
567
566
|
return n;
|
|
568
567
|
});
|
|
569
|
-
},
|
|
570
|
-
const e =
|
|
571
|
-
return
|
|
572
|
-
},
|
|
568
|
+
}, Jt = function() {
|
|
569
|
+
const e = zt(this);
|
|
570
|
+
return Le(e);
|
|
571
|
+
}, Zt = function() {
|
|
573
572
|
return JSON.parse(this.getDataString());
|
|
574
|
-
},
|
|
573
|
+
}, Qt = function() {
|
|
575
574
|
this.editable = !0;
|
|
576
|
-
},
|
|
575
|
+
}, en = function() {
|
|
577
576
|
this.editable = !1;
|
|
578
|
-
},
|
|
577
|
+
}, tn = function(e, t = { x: 0, y: 0 }) {
|
|
579
578
|
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 } =
|
|
579
|
+
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
580
|
this.map.style.transform = `translate3d(${r - y}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
582
|
-
},
|
|
581
|
+
}, nn = function() {
|
|
583
582
|
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
583
|
this.scaleVal = n;
|
|
585
|
-
const { dx: o, dy: s } =
|
|
584
|
+
const { dx: o, dy: s } = Ae(this, !0);
|
|
586
585
|
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
587
|
-
},
|
|
586
|
+
}, on = function(e, t, n = !1) {
|
|
588
587
|
const { map: o, scaleVal: s, bus: i, container: l, nodes: c } = this;
|
|
589
588
|
if (n && o.style.transition === "transform 0.3s")
|
|
590
589
|
return;
|
|
591
590
|
const r = o.style.transform;
|
|
592
|
-
let { x: a, y: d } =
|
|
591
|
+
let { x: a, y: d } = Se(r);
|
|
593
592
|
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
593
|
if (y) {
|
|
595
594
|
const p = u.left + e, g = u.right + e;
|
|
@@ -602,7 +601,7 @@ const Jt = function(e) {
|
|
|
602
601
|
a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
603
602
|
o.style.transition = "none";
|
|
604
603
|
}, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
605
|
-
},
|
|
604
|
+
}, Ae = (e, t = !1) => {
|
|
606
605
|
const { container: n, map: o, nodes: s } = e;
|
|
607
606
|
let i, l;
|
|
608
607
|
if (e.alignment === "nodes" || t)
|
|
@@ -612,31 +611,31 @@ const Jt = function(e) {
|
|
|
612
611
|
i = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - r - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
|
|
613
612
|
}
|
|
614
613
|
return { dx: i, dy: l };
|
|
615
|
-
},
|
|
616
|
-
const { map: e, container: t } = this, { dx: n, dy: o } =
|
|
614
|
+
}, sn = function() {
|
|
615
|
+
const { map: e, container: t } = this, { dx: n, dy: o } = Ae(this);
|
|
617
616
|
t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
618
|
-
},
|
|
617
|
+
}, rn = function(e) {
|
|
619
618
|
e(this);
|
|
620
|
-
},
|
|
619
|
+
}, ln = function(e) {
|
|
621
620
|
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
|
-
},
|
|
621
|
+
}, cn = function() {
|
|
623
622
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
624
|
-
},
|
|
623
|
+
}, an = function() {
|
|
625
624
|
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
626
|
-
},
|
|
625
|
+
}, dn = function() {
|
|
627
626
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
628
|
-
},
|
|
627
|
+
}, hn = function() {
|
|
629
628
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
630
|
-
},
|
|
629
|
+
}, fn = function(e) {
|
|
631
630
|
this.locale = e, this.refresh();
|
|
632
|
-
},
|
|
631
|
+
}, un = function(e, t) {
|
|
633
632
|
const n = e.nodeObj;
|
|
634
633
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
635
634
|
const o = e.getBoundingClientRect(), s = {
|
|
636
635
|
x: o.left,
|
|
637
636
|
y: o.top
|
|
638
637
|
}, i = e.parentNode, l = i.children[1];
|
|
639
|
-
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "",
|
|
638
|
+
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", ee(e), n.expanded) {
|
|
640
639
|
const h = this.createChildren(
|
|
641
640
|
n.children.map((u) => this.createWrapper(u).grp)
|
|
642
641
|
);
|
|
@@ -649,76 +648,73 @@ const Jt = function(e) {
|
|
|
649
648
|
y: c.top
|
|
650
649
|
}, a = s.x - r.x, d = s.y - r.y;
|
|
651
650
|
this.move(a, d), this.bus.fire("expandNode", n);
|
|
652
|
-
},
|
|
651
|
+
}, pn = function(e, t) {
|
|
653
652
|
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
654
653
|
x: o.left,
|
|
655
654
|
y: o.top
|
|
656
655
|
};
|
|
657
|
-
|
|
656
|
+
U(n, t ?? !n.expanded), this.refresh();
|
|
658
657
|
const i = this.findEle(n.id).getBoundingClientRect(), l = {
|
|
659
658
|
x: i.left,
|
|
660
659
|
y: i.top
|
|
661
660
|
}, c = s.x - l.x, r = s.y - l.y;
|
|
662
661
|
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
|
-
},
|
|
662
|
+
}, gn = function(e) {
|
|
663
|
+
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();
|
|
664
|
+
}, mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
666
665
|
__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" })),
|
|
692
|
-
const
|
|
693
|
-
e.selectNode(
|
|
694
|
-
},
|
|
695
|
-
const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
|
|
696
|
-
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
697
|
-
}, Sn = (e) => {
|
|
666
|
+
cancelFocus: cn,
|
|
667
|
+
clearSelection: Ut,
|
|
668
|
+
disableEdit: en,
|
|
669
|
+
enableEdit: Qt,
|
|
670
|
+
expandNode: un,
|
|
671
|
+
expandNodeAll: pn,
|
|
672
|
+
focusNode: ln,
|
|
673
|
+
getData: Zt,
|
|
674
|
+
getDataString: Jt,
|
|
675
|
+
initLeft: an,
|
|
676
|
+
initRight: dn,
|
|
677
|
+
initSide: hn,
|
|
678
|
+
install: rn,
|
|
679
|
+
move: on,
|
|
680
|
+
refresh: gn,
|
|
681
|
+
scale: tn,
|
|
682
|
+
scaleFit: nn,
|
|
683
|
+
scrollIntoView: Gt,
|
|
684
|
+
selectNode: Vt,
|
|
685
|
+
selectNodes: qt,
|
|
686
|
+
setLocale: fn,
|
|
687
|
+
stringifyData: Le,
|
|
688
|
+
toCenter: sn,
|
|
689
|
+
unselectNodes: Kt
|
|
690
|
+
}, Symbol.toStringTag, { value: "Module" })), Oe = "MIND-ELIXIR-WAIT-COPY", yn = (e, t) => {
|
|
691
|
+
const n = e.map.querySelectorAll(`.${t}>me-wrapper>me-parent>me-tpc`);
|
|
692
|
+
n.length !== 0 && e.selectNode(n[Math.ceil(n.length / 2) - 1]);
|
|
693
|
+
}, vn = (e) => {
|
|
698
694
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
699
|
-
},
|
|
695
|
+
}, bn = function(e, t) {
|
|
700
696
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
701
697
|
if (n) {
|
|
702
698
|
const o = n.firstChild;
|
|
703
699
|
e.selectNode(o);
|
|
704
700
|
}
|
|
705
|
-
},
|
|
701
|
+
}, wn = function(e, t) {
|
|
706
702
|
const n = t.parentElement.nextSibling;
|
|
707
703
|
if (n && n.firstChild) {
|
|
708
704
|
const o = n.firstChild.firstChild.firstChild;
|
|
709
705
|
e.selectNode(o);
|
|
710
706
|
}
|
|
711
|
-
},
|
|
707
|
+
}, $e = function(e, t) {
|
|
712
708
|
const n = e.currentNode || e.currentNodes?.[0];
|
|
713
709
|
if (!n) return;
|
|
714
710
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
715
|
-
o.parent ? s.className === t ?
|
|
716
|
-
},
|
|
711
|
+
o.parent ? s.className === t ? wn(e, n) : o.parent?.parent ? bn(e, n) : vn(e) : yn(e, t);
|
|
712
|
+
}, je = function(e, t) {
|
|
717
713
|
const n = e.currentNode;
|
|
718
714
|
if (!n || !n.nodeObj.parent) return;
|
|
719
715
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
720
716
|
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
721
|
-
},
|
|
717
|
+
}, ae = function(e, t, n) {
|
|
722
718
|
const { scaleVal: o, scaleSensitivity: s } = e;
|
|
723
719
|
switch (t) {
|
|
724
720
|
case "in":
|
|
@@ -728,7 +724,7 @@ const Jt = function(e) {
|
|
|
728
724
|
e.scale(o - s, n);
|
|
729
725
|
}
|
|
730
726
|
};
|
|
731
|
-
function
|
|
727
|
+
function xn(e, t) {
|
|
732
728
|
t = t === !0 ? {} : t;
|
|
733
729
|
const n = () => {
|
|
734
730
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
@@ -738,13 +734,13 @@ function Tn(e, t) {
|
|
|
738
734
|
const a = e.nodeData;
|
|
739
735
|
if (r.key === "0")
|
|
740
736
|
for (const d of a.children)
|
|
741
|
-
|
|
737
|
+
U(d, !1);
|
|
742
738
|
if (r.key === "=")
|
|
743
739
|
for (const d of a.children)
|
|
744
|
-
|
|
740
|
+
U(d, !0);
|
|
745
741
|
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
|
|
746
742
|
for (const d of a.children)
|
|
747
|
-
|
|
743
|
+
U(d, !0, Number(r.key) - 1);
|
|
748
744
|
e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
|
|
749
745
|
}, l = {
|
|
750
746
|
Enter: (r) => {
|
|
@@ -765,31 +761,31 @@ function Tn(e, t) {
|
|
|
765
761
|
else {
|
|
766
762
|
if (r.metaKey || r.ctrlKey)
|
|
767
763
|
return e.initSide();
|
|
768
|
-
|
|
764
|
+
je(e, "previous");
|
|
769
765
|
}
|
|
770
766
|
},
|
|
771
767
|
ArrowDown: (r) => {
|
|
772
|
-
r.altKey ? e.moveDownNode() :
|
|
768
|
+
r.altKey ? e.moveDownNode() : je(e, "next");
|
|
773
769
|
},
|
|
774
770
|
ArrowLeft: (r) => {
|
|
775
771
|
if (r.metaKey || r.ctrlKey)
|
|
776
772
|
return e.initLeft();
|
|
777
|
-
|
|
773
|
+
$e(e, B.LHS);
|
|
778
774
|
},
|
|
779
775
|
ArrowRight: (r) => {
|
|
780
776
|
if (r.metaKey || r.ctrlKey)
|
|
781
777
|
return e.initRight();
|
|
782
|
-
|
|
778
|
+
$e(e, B.RHS);
|
|
783
779
|
},
|
|
784
780
|
PageUp: () => e.moveUpNode(),
|
|
785
781
|
PageDown: () => {
|
|
786
782
|
e.moveDownNode();
|
|
787
783
|
},
|
|
788
784
|
"=": (r) => {
|
|
789
|
-
(r.metaKey || r.ctrlKey) &&
|
|
785
|
+
(r.metaKey || r.ctrlKey) && ae(e, "in");
|
|
790
786
|
},
|
|
791
787
|
"-": (r) => {
|
|
792
|
-
(r.metaKey || r.ctrlKey) &&
|
|
788
|
+
(r.metaKey || r.ctrlKey) && ae(e, "out");
|
|
793
789
|
},
|
|
794
790
|
0: (r) => {
|
|
795
791
|
if (r.metaKey || r.ctrlKey) {
|
|
@@ -815,8 +811,8 @@ function Tn(e, t) {
|
|
|
815
811
|
const c = (r) => {
|
|
816
812
|
if (r.target instanceof HTMLElement && r.target.id === "input-box" || e.currentNodes.length === 0) return !1;
|
|
817
813
|
if (r.clipboardData) {
|
|
818
|
-
const a =
|
|
819
|
-
magic:
|
|
814
|
+
const a = Ee(e.currentNodes).map((h) => h.nodeObj), d = Le({
|
|
815
|
+
magic: Oe,
|
|
820
816
|
data: a
|
|
821
817
|
});
|
|
822
818
|
return r.clipboardData.setData("text/plain", d), r.preventDefault(), !0;
|
|
@@ -830,7 +826,7 @@ function Tn(e, t) {
|
|
|
830
826
|
if (a)
|
|
831
827
|
try {
|
|
832
828
|
const d = JSON.parse(a);
|
|
833
|
-
if (d && d.magic ===
|
|
829
|
+
if (d && d.magic === Oe && Array.isArray(d.data)) {
|
|
834
830
|
const h = d.data, u = h.map((y) => ({ nodeObj: y }));
|
|
835
831
|
h.length > 0 && e.currentNode && (e.copyNodes(u, e.currentNode), r.preventDefault());
|
|
836
832
|
return;
|
|
@@ -840,28 +836,28 @@ function Tn(e, t) {
|
|
|
840
836
|
e.pasteHandler && e.pasteHandler(r);
|
|
841
837
|
});
|
|
842
838
|
}
|
|
843
|
-
const
|
|
839
|
+
const Cn = function(e, t) {
|
|
844
840
|
if (!t)
|
|
845
|
-
return
|
|
841
|
+
return he(e), e;
|
|
846
842
|
let n = e.querySelector(".insert-preview");
|
|
847
843
|
const o = `insert-preview ${t} show`;
|
|
848
|
-
return n || (n =
|
|
849
|
-
},
|
|
844
|
+
return n || (n = document.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
845
|
+
}, he = function(e) {
|
|
850
846
|
if (!e) return;
|
|
851
847
|
const t = e.querySelectorAll(".insert-preview");
|
|
852
848
|
for (const n of t || [])
|
|
853
849
|
n.remove();
|
|
854
|
-
},
|
|
850
|
+
}, He = function(e, t) {
|
|
855
851
|
for (const n of t) {
|
|
856
852
|
const o = n.parentElement.parentElement.contains(e);
|
|
857
853
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
858
854
|
}
|
|
859
855
|
return !0;
|
|
860
|
-
},
|
|
856
|
+
}, En = function(e) {
|
|
861
857
|
const t = document.createElement("div");
|
|
862
858
|
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
|
|
863
859
|
};
|
|
864
|
-
class
|
|
860
|
+
class Sn {
|
|
865
861
|
mind;
|
|
866
862
|
isMoving = !1;
|
|
867
863
|
interval = null;
|
|
@@ -878,31 +874,31 @@ class An {
|
|
|
878
874
|
this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
|
|
879
875
|
}
|
|
880
876
|
}
|
|
881
|
-
function
|
|
877
|
+
function Nn(e) {
|
|
882
878
|
return {
|
|
883
879
|
isDragging: !1,
|
|
884
880
|
insertType: null,
|
|
885
881
|
meet: null,
|
|
886
|
-
ghost:
|
|
887
|
-
edgeMoveController: new
|
|
882
|
+
ghost: En(e),
|
|
883
|
+
edgeMoveController: new Sn(e),
|
|
888
884
|
startX: 0,
|
|
889
885
|
startY: 0,
|
|
890
886
|
pointerId: null
|
|
891
887
|
};
|
|
892
888
|
}
|
|
893
|
-
const
|
|
894
|
-
function
|
|
889
|
+
const kn = 5;
|
|
890
|
+
function Ie(e, t, n, o = !1) {
|
|
895
891
|
if (e.spacePressed) return !1;
|
|
896
892
|
const s = n.target;
|
|
897
893
|
if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
|
|
898
894
|
t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.selection?.cancel();
|
|
899
895
|
let i = e.currentNodes;
|
|
900
|
-
return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o &&
|
|
896
|
+
return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o && lt(e, t), !0;
|
|
901
897
|
}
|
|
902
|
-
function
|
|
898
|
+
function rt(e, t, n) {
|
|
903
899
|
e.style.transform = `translate(${t - 10}px, ${n - 10}px)`, e.style.display = "block";
|
|
904
900
|
}
|
|
905
|
-
function
|
|
901
|
+
function lt(e, t) {
|
|
906
902
|
const { dragged: n } = e;
|
|
907
903
|
if (!n) return;
|
|
908
904
|
const o = document.activeElement;
|
|
@@ -911,57 +907,57 @@ function ft(e, t) {
|
|
|
911
907
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
912
908
|
e.dragMoveHelper.clear();
|
|
913
909
|
}
|
|
914
|
-
function
|
|
910
|
+
function Tn(e, t, n) {
|
|
915
911
|
const { dragged: o } = e;
|
|
916
912
|
if (!o || t.pointerId !== n.pointerId) return;
|
|
917
913
|
const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i);
|
|
918
|
-
if (!t.isDragging && l >
|
|
914
|
+
if (!t.isDragging && l > kn && lt(e, t), !t.isDragging) return;
|
|
919
915
|
const c = e.container.getBoundingClientRect();
|
|
920
|
-
|
|
921
|
-
const r = 12 * e.scaleVal, a =
|
|
922
|
-
if (
|
|
916
|
+
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);
|
|
917
|
+
const r = 12 * e.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - r);
|
|
918
|
+
if (He(a, o)) {
|
|
923
919
|
t.meet = a;
|
|
924
920
|
const d = a.getBoundingClientRect(), h = d.y;
|
|
925
921
|
n.clientY > h + d.height ? t.insertType = "after" : t.insertType = "in";
|
|
926
922
|
} else {
|
|
927
|
-
const d =
|
|
928
|
-
if (
|
|
923
|
+
const d = document.elementFromPoint(n.clientX, n.clientY + r);
|
|
924
|
+
if (He(d, o)) {
|
|
929
925
|
t.meet = d;
|
|
930
926
|
const u = d.getBoundingClientRect().y;
|
|
931
927
|
n.clientY < u ? t.insertType = "before" : t.insertType = "in";
|
|
932
928
|
} else
|
|
933
929
|
t.insertType = null, t.meet = null;
|
|
934
930
|
}
|
|
935
|
-
t.meet &&
|
|
931
|
+
t.meet && Cn(t.meet, t.insertType);
|
|
936
932
|
}
|
|
937
|
-
function
|
|
933
|
+
function _n(e, t, n) {
|
|
938
934
|
const { dragged: o } = e;
|
|
939
935
|
if (!(!o || t.pointerId !== n.pointerId)) {
|
|
940
936
|
t.edgeMoveController.stop();
|
|
941
937
|
for (const s of o)
|
|
942
938
|
s.parentElement.parentElement.style.opacity = "1";
|
|
943
|
-
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (
|
|
939
|
+
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
940
|
}
|
|
945
941
|
}
|
|
946
|
-
function
|
|
942
|
+
function pe(e, t) {
|
|
947
943
|
const { dragged: n } = e;
|
|
948
944
|
if (n) {
|
|
949
945
|
t.edgeMoveController.stop();
|
|
950
946
|
for (const o of n)
|
|
951
947
|
o.parentElement.parentElement.style.opacity = "1";
|
|
952
|
-
t.meet &&
|
|
948
|
+
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
949
|
}
|
|
954
950
|
}
|
|
955
|
-
function
|
|
951
|
+
function Ln(e) {
|
|
956
952
|
return () => {
|
|
957
953
|
};
|
|
958
954
|
}
|
|
959
|
-
function
|
|
955
|
+
function An(e) {
|
|
960
956
|
const { dragMoveHelper: t } = e;
|
|
961
957
|
let n = 0;
|
|
962
958
|
e.spacePressed = !1;
|
|
963
959
|
let o = null;
|
|
964
|
-
const s = /* @__PURE__ */ new Map(), i = e.editable ?
|
|
960
|
+
const s = /* @__PURE__ */ new Map(), i = e.editable ? Nn(e) : null;
|
|
965
961
|
let l = null, c = null, r = null, a = null;
|
|
966
962
|
const d = 500, h = 10, u = () => {
|
|
967
963
|
l !== null && (clearTimeout(l), l = null, c = null, r = null, a = null);
|
|
@@ -971,23 +967,23 @@ function jn(e) {
|
|
|
971
967
|
if (f.id === "input-box" || f.closest("#input-box")) return !1;
|
|
972
968
|
const k = f.closest(".svg-label");
|
|
973
969
|
if (k) {
|
|
974
|
-
const
|
|
975
|
-
if (
|
|
976
|
-
if (
|
|
977
|
-
return w ? e.editArrowLabel(
|
|
978
|
-
if (
|
|
979
|
-
return w ? e.editSummary(
|
|
970
|
+
const M = k.dataset.svgId, te = k.dataset.type, Z = document.getElementById(M);
|
|
971
|
+
if (Z) {
|
|
972
|
+
if (te === "arrow")
|
|
973
|
+
return w ? e.editArrowLabel(Z) : e.selectArrow(Z), !0;
|
|
974
|
+
if (te === "summary")
|
|
975
|
+
return w ? e.editSummary(Z) : e.selectSummary(Z), !0;
|
|
980
976
|
}
|
|
981
977
|
}
|
|
982
978
|
if (f.closest(".topiclinks")) {
|
|
983
|
-
const
|
|
984
|
-
if (
|
|
985
|
-
return w ? e.editArrowLabel(
|
|
979
|
+
const M = f.closest("g");
|
|
980
|
+
if (M)
|
|
981
|
+
return w ? e.editArrowLabel(M) : e.selectArrow(M), !0;
|
|
986
982
|
}
|
|
987
983
|
if (f.closest(".summary")) {
|
|
988
|
-
const
|
|
989
|
-
if (
|
|
990
|
-
return w ? e.editSummary(
|
|
984
|
+
const M = f.closest("g");
|
|
985
|
+
if (M)
|
|
986
|
+
return w ? e.editSummary(M) : e.selectSummary(M), !0;
|
|
991
987
|
}
|
|
992
988
|
return !1;
|
|
993
989
|
}, p = (f) => {
|
|
@@ -1017,7 +1013,7 @@ function jn(e) {
|
|
|
1017
1013
|
}, g = (f) => {
|
|
1018
1014
|
if (!e.editable) return;
|
|
1019
1015
|
const w = f.target;
|
|
1020
|
-
|
|
1016
|
+
re(w) && e.beginEdit(w), v(w, !0);
|
|
1021
1017
|
}, m = (f) => {
|
|
1022
1018
|
if (f.pointerType === "mouse" || s.size > 1) return;
|
|
1023
1019
|
const w = (/* @__PURE__ */ new Date()).getTime(), k = w - n;
|
|
@@ -1028,25 +1024,25 @@ function jn(e) {
|
|
|
1028
1024
|
f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
1029
1025
|
}, L = (f) => {
|
|
1030
1026
|
if (f.pointerType === "touch" && (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), s.size === 2)) {
|
|
1031
|
-
const [
|
|
1032
|
-
o =
|
|
1027
|
+
const [M, te] = Array.from(s.values());
|
|
1028
|
+
o = Pe(M, te), u();
|
|
1033
1029
|
}
|
|
1034
1030
|
t.moved = !1;
|
|
1035
1031
|
const w = f.target, k = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
1036
1032
|
if (i && (f.button === 0 || f.pointerType === "touch")) {
|
|
1037
1033
|
if (f.pointerType === "touch" && s.size > 1)
|
|
1038
|
-
(i.isDragging || i.pointerId !== null) &&
|
|
1034
|
+
(i.isDragging || i.pointerId !== null) && pe(e, i);
|
|
1039
1035
|
else if (f.pointerType === "touch" && s.size === 1)
|
|
1040
|
-
(
|
|
1041
|
-
|
|
1036
|
+
(re(w) || w.closest("me-tpc")) && (c = { x: f.clientX, y: f.clientY }, r = w, a = f.pointerId, l = window.setTimeout(() => {
|
|
1037
|
+
Ie(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
1038
|
}, d));
|
|
1043
|
-
else if (f.pointerType === "mouse" &&
|
|
1039
|
+
else if (f.pointerType === "mouse" && Ie(e, i, f, !1)) {
|
|
1044
1040
|
w.setPointerCapture(f.pointerId);
|
|
1045
1041
|
return;
|
|
1046
1042
|
}
|
|
1047
1043
|
}
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1044
|
+
const O = e.spacePressed && f.button === 0 && f.pointerType === "mouse", W = !e.editable || f.button === k && f.pointerType === "mouse" || f.pointerType === "touch";
|
|
1045
|
+
!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
1046
|
}, T = (f) => {
|
|
1051
1047
|
if (f.pointerType === "touch" && s.has(f.pointerId)) {
|
|
1052
1048
|
if (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), l !== null && c !== null && f.pointerId === a) {
|
|
@@ -1054,23 +1050,23 @@ function jn(e) {
|
|
|
1054
1050
|
Math.sqrt(w * w + k * k) > h && u();
|
|
1055
1051
|
}
|
|
1056
1052
|
if (s.size >= 2) {
|
|
1057
|
-
const [w, k] = Array.from(s.values()),
|
|
1053
|
+
const [w, k] = Array.from(s.values()), O = Pe(w, k);
|
|
1058
1054
|
if (o == null)
|
|
1059
|
-
o =
|
|
1055
|
+
o = O;
|
|
1060
1056
|
else {
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1057
|
+
if (o > 0) {
|
|
1058
|
+
const W = O / o;
|
|
1059
|
+
e.scale(e.scaleVal * W, {
|
|
1060
|
+
x: (w.x + k.x) / 2,
|
|
1061
|
+
y: (w.y + k.y) / 2
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
o = O;
|
|
1069
1065
|
}
|
|
1070
1066
|
return;
|
|
1071
1067
|
}
|
|
1072
1068
|
}
|
|
1073
|
-
if (!(i && i.pointerId !== null && (
|
|
1069
|
+
if (!(i && i.pointerId !== null && (Tn(e, i, f), i.isDragging))) {
|
|
1074
1070
|
if (f.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
|
|
1075
1071
|
const w = f.clientX - t.x, k = f.clientY - t.y;
|
|
1076
1072
|
t.onMove(w, k);
|
|
@@ -1080,24 +1076,24 @@ function jn(e) {
|
|
|
1080
1076
|
}, E = (f) => {
|
|
1081
1077
|
if (f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) {
|
|
1082
1078
|
const w = i.isDragging;
|
|
1083
|
-
if (
|
|
1079
|
+
if (_n(e, i, f), y(f.target, f.pointerId), w)
|
|
1084
1080
|
return;
|
|
1085
1081
|
}
|
|
1086
1082
|
t.mousedown && (y(f.target, f.pointerId), t.clear());
|
|
1087
1083
|
}, C = () => {
|
|
1088
|
-
u(), t.mousedown && t.clear(), i && (i.isDragging || i.pointerId !== null) &&
|
|
1084
|
+
u(), t.mousedown && t.clear(), i && (i.isDragging || i.pointerId !== null) && pe(e, i);
|
|
1089
1085
|
}, S = (f) => {
|
|
1090
|
-
f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === f.pointerId &&
|
|
1086
|
+
f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === f.pointerId && pe(e, i), E(f);
|
|
1091
1087
|
}, N = (f) => {
|
|
1092
1088
|
if (f.preventDefault(), f.button !== 2 || !e.editable) return;
|
|
1093
1089
|
const w = f.target;
|
|
1094
|
-
|
|
1090
|
+
re(w) && !w.classList.contains("selected") && e.selectNode(w), setTimeout(() => {
|
|
1095
1091
|
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", f);
|
|
1096
1092
|
}, 200);
|
|
1097
|
-
},
|
|
1098
|
-
f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey ? f.deltaY < 0 ?
|
|
1093
|
+
}, D = (f) => {
|
|
1094
|
+
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
1095
|
}, { container: _ } = e;
|
|
1100
|
-
return
|
|
1096
|
+
return Qe([
|
|
1101
1097
|
{ dom: _, evt: "pointerdown", func: L },
|
|
1102
1098
|
{ dom: _, evt: "pointermove", func: T },
|
|
1103
1099
|
{ dom: _, evt: "pointerup", func: E },
|
|
@@ -1106,13 +1102,13 @@ function jn(e) {
|
|
|
1106
1102
|
{ dom: _, evt: "click", func: p },
|
|
1107
1103
|
{ dom: _, evt: "dblclick", func: g },
|
|
1108
1104
|
{ dom: _, evt: "contextmenu", func: N },
|
|
1109
|
-
{ dom: _, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel :
|
|
1105
|
+
{ dom: _, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : D },
|
|
1110
1106
|
{ dom: _, evt: "blur", func: C },
|
|
1111
1107
|
{ dom: _, evt: "keydown", func: b },
|
|
1112
1108
|
{ dom: _, evt: "keyup", func: x }
|
|
1113
1109
|
]);
|
|
1114
1110
|
}
|
|
1115
|
-
function
|
|
1111
|
+
function Dn() {
|
|
1116
1112
|
return {
|
|
1117
1113
|
handlers: {},
|
|
1118
1114
|
addListener: function(e, t) {
|
|
@@ -1136,31 +1132,31 @@ function Hn() {
|
|
|
1136
1132
|
}
|
|
1137
1133
|
};
|
|
1138
1134
|
}
|
|
1139
|
-
const
|
|
1135
|
+
const H = "http://www.w3.org/2000/svg", fe = function(e) {
|
|
1140
1136
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
1141
1137
|
let c = s;
|
|
1142
1138
|
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
|
-
},
|
|
1139
|
+
}, ye = function(e, t, n, o) {
|
|
1144
1140
|
const { anchor: s = "middle", color: i, dataType: l, svgId: c } = o, r = document.createElement("div");
|
|
1145
1141
|
r.className = "svg-label", r.style.color = i || "#666";
|
|
1146
1142
|
const a = "label-" + c;
|
|
1147
1143
|
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 =
|
|
1144
|
+
}, ct = function(e, t, n) {
|
|
1145
|
+
const o = document.createElementNS(H, "path");
|
|
1150
1146
|
return A(o, {
|
|
1151
1147
|
d: e,
|
|
1152
1148
|
stroke: t || "#666",
|
|
1153
1149
|
fill: "none",
|
|
1154
1150
|
"stroke-width": n
|
|
1155
1151
|
}), o;
|
|
1156
|
-
},
|
|
1157
|
-
const t =
|
|
1152
|
+
}, Q = function(e) {
|
|
1153
|
+
const t = document.createElementNS(H, "svg");
|
|
1158
1154
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
1159
|
-
},
|
|
1160
|
-
const e =
|
|
1155
|
+
}, Re = function() {
|
|
1156
|
+
const e = document.createElementNS(H, "line");
|
|
1161
1157
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
1162
|
-
},
|
|
1163
|
-
const s =
|
|
1158
|
+
}, Mn = function(e, t, n, o) {
|
|
1159
|
+
const s = document.createElementNS(H, "g");
|
|
1164
1160
|
return [
|
|
1165
1161
|
{
|
|
1166
1162
|
name: "line",
|
|
@@ -1175,7 +1171,7 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1175
1171
|
d: n
|
|
1176
1172
|
}
|
|
1177
1173
|
].forEach((l, c) => {
|
|
1178
|
-
const r = l.d, a =
|
|
1174
|
+
const r = l.d, a = document.createElementNS(H, "path"), d = {
|
|
1179
1175
|
d: r,
|
|
1180
1176
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
1181
1177
|
fill: "none",
|
|
@@ -1183,7 +1179,7 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1183
1179
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
1184
1180
|
};
|
|
1185
1181
|
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 =
|
|
1182
|
+
const h = document.createElementNS(H, "path");
|
|
1187
1183
|
A(h, {
|
|
1188
1184
|
d: r,
|
|
1189
1185
|
stroke: "transparent",
|
|
@@ -1191,14 +1187,14 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1191
1187
|
"stroke-width": "15"
|
|
1192
1188
|
}), s.appendChild(h), s.appendChild(a), s[l.name] = a;
|
|
1193
1189
|
}), s;
|
|
1194
|
-
},
|
|
1190
|
+
}, at = function(e, t, n) {
|
|
1195
1191
|
if (!t) return;
|
|
1196
1192
|
const o = n.label, s = t.cloneNode(!0);
|
|
1197
1193
|
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
1198
1194
|
left:${t.style.left};
|
|
1199
1195
|
top:${t.style.top};
|
|
1200
1196
|
max-width: 200px;
|
|
1201
|
-
`,
|
|
1197
|
+
`, tt(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
1202
1198
|
i.stopPropagation();
|
|
1203
1199
|
const l = i.key;
|
|
1204
1200
|
if (l === "Enter" || l === "Tab") {
|
|
@@ -1207,8 +1203,8 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1207
1203
|
}
|
|
1208
1204
|
}), s.addEventListener("blur", () => {
|
|
1209
1205
|
if (!s) return;
|
|
1210
|
-
const i = s.
|
|
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,
|
|
1206
|
+
const i = s.innerText?.trim() || "";
|
|
1207
|
+
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
1208
|
name: "finishEditSummary",
|
|
1213
1209
|
obj: n
|
|
1214
1210
|
}) : e.bus.fire("operation", {
|
|
@@ -1216,32 +1212,32 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1216
1212
|
obj: n
|
|
1217
1213
|
}));
|
|
1218
1214
|
});
|
|
1219
|
-
},
|
|
1215
|
+
}, Pn = function(e) {
|
|
1220
1216
|
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
1217
|
this.lines.innerHTML = "";
|
|
1222
1218
|
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(
|
|
1219
|
+
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];
|
|
1220
|
+
if (a.style.borderColor = m, this.lines.appendChild(ct(p, m, "3")), e && e !== r)
|
|
1225
1221
|
continue;
|
|
1226
|
-
const b =
|
|
1227
|
-
x.tagName === "svg" && x.remove(), r.appendChild(b),
|
|
1222
|
+
const b = Q("subLines"), x = r.lastChild;
|
|
1223
|
+
x.tagName === "svg" && x.remove(), r.appendChild(b), dt(this, b, m, r, v, !0);
|
|
1228
1224
|
}
|
|
1229
1225
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
1230
|
-
},
|
|
1226
|
+
}, dt = function(e, t, n, o, s, i) {
|
|
1231
1227
|
const l = o.firstChild, c = o.children[1].children;
|
|
1232
1228
|
if (c.length === 0) return;
|
|
1233
1229
|
const r = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
|
|
1234
1230
|
for (let u = 0; u < c.length; u++) {
|
|
1235
1231
|
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(
|
|
1232
|
+
t.appendChild(ct(L, x, "2"));
|
|
1237
1233
|
const T = v.children[1];
|
|
1238
1234
|
if (T) {
|
|
1239
1235
|
if (!T.expanded) continue;
|
|
1240
1236
|
} else
|
|
1241
1237
|
continue;
|
|
1242
|
-
|
|
1238
|
+
dt(e, t, x, y, s);
|
|
1243
1239
|
}
|
|
1244
|
-
},
|
|
1240
|
+
}, Be = {
|
|
1245
1241
|
addChild: "插入子节点",
|
|
1246
1242
|
addParent: "插入父节点",
|
|
1247
1243
|
addSibling: "插入同级节点",
|
|
@@ -1254,9 +1250,9 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1254
1250
|
linkBidirectional: "双向连接",
|
|
1255
1251
|
clickTips: "请点击目标节点",
|
|
1256
1252
|
summary: "摘要"
|
|
1257
|
-
},
|
|
1258
|
-
cn:
|
|
1259
|
-
zh_CN:
|
|
1253
|
+
}, Fe = {
|
|
1254
|
+
cn: Be,
|
|
1255
|
+
zh_CN: Be,
|
|
1260
1256
|
zh_TW: {
|
|
1261
1257
|
addChild: "插入子節點",
|
|
1262
1258
|
addParent: "插入父節點",
|
|
@@ -1398,7 +1394,7 @@ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
|
1398
1394
|
summary: "Rezumat"
|
|
1399
1395
|
}
|
|
1400
1396
|
};
|
|
1401
|
-
function
|
|
1397
|
+
function On(e, t) {
|
|
1402
1398
|
t = t === !0 ? {
|
|
1403
1399
|
focus: !0,
|
|
1404
1400
|
link: !0
|
|
@@ -1408,8 +1404,8 @@ function Bn(e, t) {
|
|
|
1408
1404
|
return C.innerText = E, C.className = "tips", C;
|
|
1409
1405
|
}, o = (E, C, S) => {
|
|
1410
1406
|
const N = document.createElement("li");
|
|
1411
|
-
return N.id = E, N.innerHTML = `<span>${
|
|
1412
|
-
}, s =
|
|
1407
|
+
return N.id = E, N.innerHTML = `<span>${me(C)}</span><span ${S ? 'class="key"' : ""}>${me(S)}</span>`, N;
|
|
1408
|
+
}, 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
1409
|
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
1410
|
for (let E = 0; E < t.extend.length; E++) {
|
|
1415
1411
|
const C = t.extend[E], S = o(C.name, C.name, C.key || "");
|
|
@@ -1422,10 +1418,10 @@ function Bn(e, t) {
|
|
|
1422
1418
|
let x = !0;
|
|
1423
1419
|
const L = (E) => {
|
|
1424
1420
|
const C = E.target;
|
|
1425
|
-
if (
|
|
1421
|
+
if (re(C)) {
|
|
1426
1422
|
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 +
|
|
1423
|
+
const S = m.offsetHeight, N = m.offsetWidth, D = m.getBoundingClientRect(), _ = E.clientY - D.top, R = E.clientX - D.left;
|
|
1424
|
+
S + _ > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = _ + 15 + "px"), N + R > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = R + 10 + "px");
|
|
1429
1425
|
}
|
|
1430
1426
|
};
|
|
1431
1427
|
e.bus.addListener("showContextMenu", L), b.onclick = (E) => {
|
|
@@ -1454,8 +1450,8 @@ function Bn(e, t) {
|
|
|
1454
1450
|
"click",
|
|
1455
1451
|
(N) => {
|
|
1456
1452
|
N.preventDefault(), S.remove();
|
|
1457
|
-
const
|
|
1458
|
-
(
|
|
1453
|
+
const D = N.target;
|
|
1454
|
+
(D.parentElement.tagName === "ME-PARENT" || D.parentElement.tagName === "ME-ROOT") && e.createArrow(C, D, E);
|
|
1459
1455
|
},
|
|
1460
1456
|
{
|
|
1461
1457
|
once: !0
|
|
@@ -1468,7 +1464,7 @@ function Bn(e, t) {
|
|
|
1468
1464
|
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
1465
|
};
|
|
1470
1466
|
}
|
|
1471
|
-
const
|
|
1467
|
+
const $n = function(e) {
|
|
1472
1468
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
1473
1469
|
type: "summary",
|
|
1474
1470
|
value: e.obj.id
|
|
@@ -1483,7 +1479,7 @@ const Fn = function(e) {
|
|
|
1483
1479
|
value: [e.obj.id]
|
|
1484
1480
|
};
|
|
1485
1481
|
};
|
|
1486
|
-
function
|
|
1482
|
+
function jn(e) {
|
|
1487
1483
|
let t = [], n = -1, o = e.getData(), s = [];
|
|
1488
1484
|
e.undo = function() {
|
|
1489
1485
|
if (n > -1) {
|
|
@@ -1514,7 +1510,7 @@ function Yn(e) {
|
|
|
1514
1510
|
prev: o,
|
|
1515
1511
|
operation: r.name,
|
|
1516
1512
|
currentSelected: s.map((h) => h.id),
|
|
1517
|
-
currentTarget:
|
|
1513
|
+
currentTarget: $n(r),
|
|
1518
1514
|
next: a
|
|
1519
1515
|
};
|
|
1520
1516
|
t.push(d), o = a, n = t.length - 1;
|
|
@@ -1527,24 +1523,24 @@ function Yn(e) {
|
|
|
1527
1523
|
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", c), e.container.removeEventListener("keydown", l);
|
|
1528
1524
|
};
|
|
1529
1525
|
}
|
|
1530
|
-
const
|
|
1531
|
-
side:
|
|
1532
|
-
left:
|
|
1533
|
-
right:
|
|
1534
|
-
full:
|
|
1535
|
-
living:
|
|
1536
|
-
zoomin:
|
|
1537
|
-
zoomout:
|
|
1538
|
-
},
|
|
1526
|
+
const Hn = '<?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>', 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="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>', 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="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>', 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="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>', 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="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>', 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="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>', Xn = {
|
|
1527
|
+
side: Hn,
|
|
1528
|
+
left: In,
|
|
1529
|
+
right: Rn,
|
|
1530
|
+
full: Bn,
|
|
1531
|
+
living: Fn,
|
|
1532
|
+
zoomin: Yn,
|
|
1533
|
+
zoomout: Wn
|
|
1534
|
+
}, z = (e, t) => {
|
|
1539
1535
|
const n = document.createElement("span");
|
|
1540
|
-
return n.id = e, n.innerHTML =
|
|
1536
|
+
return n.id = e, n.innerHTML = Xn[t], n;
|
|
1541
1537
|
};
|
|
1542
|
-
function
|
|
1543
|
-
const t = document.createElement("div"), n =
|
|
1538
|
+
function zn(e) {
|
|
1539
|
+
const t = document.createElement("div"), n = z("fullscreen", "full"), o = z("toCenter", "living"), s = z("zoomout", "zoomout"), i = z("zoomin", "zoomin");
|
|
1544
1540
|
t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
|
|
1545
1541
|
let l = null;
|
|
1546
1542
|
const c = () => {
|
|
1547
|
-
const a = e.container.getBoundingClientRect(), d =
|
|
1543
|
+
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
1544
|
l = {
|
|
1549
1545
|
containerRect: a,
|
|
1550
1546
|
currentTransform: d,
|
|
@@ -1567,8 +1563,8 @@ function Jn(e) {
|
|
|
1567
1563
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1568
1564
|
}, t;
|
|
1569
1565
|
}
|
|
1570
|
-
function
|
|
1571
|
-
const t = document.createElement("div"), n =
|
|
1566
|
+
function Gn(e) {
|
|
1567
|
+
const t = document.createElement("div"), n = z("tbltl", "left"), o = z("tbltr", "right"), s = z("tblts", "side");
|
|
1572
1568
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1573
1569
|
e.initLeft();
|
|
1574
1570
|
}, o.onclick = () => {
|
|
@@ -1577,10 +1573,10 @@ function Zn(e) {
|
|
|
1577
1573
|
e.initSide();
|
|
1578
1574
|
}, t;
|
|
1579
1575
|
}
|
|
1580
|
-
function
|
|
1581
|
-
e.container.append(
|
|
1576
|
+
function Vn(e) {
|
|
1577
|
+
e.container.append(zn(e)), e.container.append(Gn(e));
|
|
1582
1578
|
}
|
|
1583
|
-
class
|
|
1579
|
+
class qn {
|
|
1584
1580
|
_listeners = /* @__PURE__ */ new Map();
|
|
1585
1581
|
addEventListener(t, n) {
|
|
1586
1582
|
const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
@@ -1603,15 +1599,15 @@ class eo {
|
|
|
1603
1599
|
off = this.removeEventListener;
|
|
1604
1600
|
emit = this.dispatchEvent;
|
|
1605
1601
|
}
|
|
1606
|
-
const
|
|
1602
|
+
const Ye = (e, t = "px") => typeof e == "number" ? e + t : e, F = ({ style: e }, t, n) => {
|
|
1607
1603
|
if (typeof t == "object")
|
|
1608
1604
|
for (const [o, s] of Object.entries(t))
|
|
1609
|
-
s !== void 0 && (e[o] =
|
|
1610
|
-
else n !== void 0 && (e[t] =
|
|
1611
|
-
},
|
|
1605
|
+
s !== void 0 && (e[o] = Ye(s));
|
|
1606
|
+
else n !== void 0 && (e[t] = Ye(n));
|
|
1607
|
+
}, We = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1612
1608
|
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1613
1609
|
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1614
|
-
},
|
|
1610
|
+
}, Kn = (e) => {
|
|
1615
1611
|
let t, n = -1, o = !1;
|
|
1616
1612
|
return {
|
|
1617
1613
|
next: (...s) => {
|
|
@@ -1623,7 +1619,7 @@ const qe = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1623
1619
|
cancelAnimationFrame(n), o = !1;
|
|
1624
1620
|
}
|
|
1625
1621
|
};
|
|
1626
|
-
},
|
|
1622
|
+
}, Xe = (e, t, n = "touch") => {
|
|
1627
1623
|
switch (n) {
|
|
1628
1624
|
case "center": {
|
|
1629
1625
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -1634,16 +1630,16 @@ const qe = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1634
1630
|
case "touch":
|
|
1635
1631
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1636
1632
|
}
|
|
1637
|
-
},
|
|
1638
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1633
|
+
}, Un = () => matchMedia("(hover: none), (pointer: coarse)").matches, Jn = () => "safari" in window, ve = (e) => Array.isArray(e) ? e : [e], ht = (e) => (t, n, o, s = {}) => {
|
|
1634
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = ve(n), t = ve(t);
|
|
1639
1635
|
for (const i of t)
|
|
1640
1636
|
if (i)
|
|
1641
1637
|
for (const l of n)
|
|
1642
1638
|
i[e](l, o, { capture: !1, ...s });
|
|
1643
|
-
},
|
|
1639
|
+
}, Y = ht("addEventListener"), $ = ht("removeEventListener"), ne = (e) => {
|
|
1644
1640
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1645
1641
|
return { x: t, y: n, target: o };
|
|
1646
|
-
},
|
|
1642
|
+
}, q = (e, t = document) => ve(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), Zn = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1647
1643
|
switch (o) {
|
|
1648
1644
|
case "alt":
|
|
1649
1645
|
return e.altKey;
|
|
@@ -1652,18 +1648,18 @@ const qe = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1652
1648
|
case "shift":
|
|
1653
1649
|
return e.shiftKey;
|
|
1654
1650
|
}
|
|
1655
|
-
}) : !1), { abs:
|
|
1651
|
+
}) : !1), { abs: X, max: ze, min: Ge, ceil: Ve } = Math, qe = (e = []) => ({
|
|
1656
1652
|
stored: e,
|
|
1657
1653
|
selected: [],
|
|
1658
1654
|
touched: [],
|
|
1659
1655
|
changed: { added: [], removed: [] }
|
|
1660
1656
|
});
|
|
1661
|
-
class
|
|
1657
|
+
class Qn extends qn {
|
|
1662
1658
|
static version = "mind-elixir-fork";
|
|
1663
1659
|
// Options
|
|
1664
1660
|
_options;
|
|
1665
1661
|
// Selection store
|
|
1666
|
-
_selection =
|
|
1662
|
+
_selection = qe();
|
|
1667
1663
|
// Area element and clipping element
|
|
1668
1664
|
_area;
|
|
1669
1665
|
_clippingElement;
|
|
@@ -1676,7 +1672,7 @@ class io extends eo {
|
|
|
1676
1672
|
_latestElement;
|
|
1677
1673
|
// Dynamically constructed area rect
|
|
1678
1674
|
_areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 };
|
|
1679
|
-
_areaRect =
|
|
1675
|
+
_areaRect = We();
|
|
1680
1676
|
// If a single click is being performed, it's a single-click until the user dragged the mouse
|
|
1681
1677
|
_singleClick = !0;
|
|
1682
1678
|
_frame;
|
|
@@ -1731,44 +1727,44 @@ class io extends eo {
|
|
|
1731
1727
|
for (const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1732
1728
|
typeof this[i] == "function" && (this[i] = this[i].bind(this));
|
|
1733
1729
|
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),
|
|
1730
|
+
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
1731
|
willChange: "top, left, bottom, right, width, height",
|
|
1736
1732
|
top: 0,
|
|
1737
1733
|
left: 0,
|
|
1738
1734
|
position: "fixed"
|
|
1739
|
-
}),
|
|
1735
|
+
}), F(this._clippingElement, {
|
|
1740
1736
|
overflow: "hidden",
|
|
1741
1737
|
position: "fixed",
|
|
1742
1738
|
transform: "translate3d(0, 0, 0)",
|
|
1743
1739
|
// https://stackoverflow.com/a/38268846
|
|
1744
1740
|
pointerEvents: "none",
|
|
1745
1741
|
zIndex: "1"
|
|
1746
|
-
}), this._frame =
|
|
1742
|
+
}), this._frame = Kn((i) => {
|
|
1747
1743
|
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
|
|
1748
1744
|
}), this.enable();
|
|
1749
1745
|
}
|
|
1750
1746
|
_toggleStartEvents(t = !0) {
|
|
1751
|
-
const { document: n, features: o } = this._options, s = t ?
|
|
1747
|
+
const { document: n, features: o } = this._options, s = t ? Y : $;
|
|
1752
1748
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1753
1749
|
}
|
|
1754
1750
|
_onTapStart(t, n = !1) {
|
|
1755
|
-
const { x: o, y: s, target: i } =
|
|
1756
|
-
if (t instanceof MouseEvent && !
|
|
1751
|
+
const { x: o, y: s, target: i } = ne(t), { document: l, startAreas: c, boundaries: r, features: a, behaviour: d } = this._options, h = i.getBoundingClientRect();
|
|
1752
|
+
if (t instanceof MouseEvent && !Zn(t, d.triggers))
|
|
1757
1753
|
return;
|
|
1758
|
-
const u =
|
|
1759
|
-
this._targetElement = y.find((m) =>
|
|
1754
|
+
const u = q(c, l), y = q(r, l);
|
|
1755
|
+
this._targetElement = y.find((m) => Xe(m.getBoundingClientRect(), h));
|
|
1760
1756
|
const v = t.composedPath(), p = u.find((m) => v.includes(m));
|
|
1761
1757
|
if (this._targetBoundary = y.find((m) => v.includes(m)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1762
1758
|
return;
|
|
1763
1759
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1764
1760
|
const g = l.scrollingElement ?? l.body;
|
|
1765
|
-
this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0),
|
|
1761
|
+
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
1762
|
}
|
|
1767
1763
|
_onSingleTap(t) {
|
|
1768
1764
|
const {
|
|
1769
1765
|
singleTap: { intersect: n },
|
|
1770
1766
|
range: o
|
|
1771
|
-
} = this._options.features, s =
|
|
1767
|
+
} = this._options.features, s = ne(t);
|
|
1772
1768
|
let i;
|
|
1773
1769
|
if (n === "native")
|
|
1774
1770
|
i = s.target;
|
|
@@ -1804,36 +1800,36 @@ class io extends eo {
|
|
|
1804
1800
|
container: n,
|
|
1805
1801
|
document: o,
|
|
1806
1802
|
behaviour: { startThreshold: s }
|
|
1807
|
-
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } =
|
|
1803
|
+
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } = ne(t);
|
|
1808
1804
|
if (
|
|
1809
1805
|
// Single number for both coordinates
|
|
1810
|
-
typeof s == "number" &&
|
|
1811
|
-
typeof s == "object" &&
|
|
1806
|
+
typeof s == "number" && X(c + r - (i + l)) >= s || // Different x and y threshold
|
|
1807
|
+
typeof s == "object" && X(c - i) >= s.x || X(r - l) >= s.y
|
|
1812
1808
|
) {
|
|
1813
|
-
if (
|
|
1814
|
-
|
|
1809
|
+
if ($(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1810
|
+
$(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1815
1811
|
return;
|
|
1816
1812
|
}
|
|
1817
|
-
|
|
1813
|
+
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
1814
|
}
|
|
1819
1815
|
this._handleMoveEvent(t);
|
|
1820
1816
|
}
|
|
1821
1817
|
_setupSelectionArea() {
|
|
1822
1818
|
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
1823
|
-
this._scrollAvailable ? (
|
|
1819
|
+
this._scrollAvailable ? (F(t, {
|
|
1824
1820
|
top: s.top,
|
|
1825
1821
|
left: s.left,
|
|
1826
1822
|
width: s.width,
|
|
1827
1823
|
height: s.height
|
|
1828
|
-
}),
|
|
1824
|
+
}), F(o, {
|
|
1829
1825
|
marginTop: -s.top,
|
|
1830
1826
|
marginLeft: -s.left
|
|
1831
|
-
})) : (
|
|
1827
|
+
})) : (F(t, {
|
|
1832
1828
|
top: 0,
|
|
1833
1829
|
left: 0,
|
|
1834
1830
|
width: "100%",
|
|
1835
1831
|
height: "100%"
|
|
1836
|
-
}),
|
|
1832
|
+
}), F(o, {
|
|
1837
1833
|
marginTop: 0,
|
|
1838
1834
|
marginLeft: 0
|
|
1839
1835
|
}));
|
|
@@ -1841,7 +1837,7 @@ class io extends eo {
|
|
|
1841
1837
|
_onTapMove(t) {
|
|
1842
1838
|
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling;
|
|
1843
1839
|
this._targetElement;
|
|
1844
|
-
const { x: c, y: r } =
|
|
1840
|
+
const { x: c, y: r } = ne(t);
|
|
1845
1841
|
if (o.x2 = c, o.y2 = r, this._lastMousePosition.x = c, this._lastMousePosition.y = r, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1846
1842
|
this._scrollingActive = !0;
|
|
1847
1843
|
const a = () => {
|
|
@@ -1851,7 +1847,7 @@ class io extends eo {
|
|
|
1851
1847
|
}
|
|
1852
1848
|
const d = this._options.mindElixirInstance;
|
|
1853
1849
|
if (d && d.move) {
|
|
1854
|
-
const h = n.x ?
|
|
1850
|
+
const h = n.x ? Ve(n.x / l) : 0, u = n.y ? Ve(n.y / l) : 0;
|
|
1855
1851
|
(h || u) && (d.move(-h, -u), o.x1 -= h, o.y1 -= u);
|
|
1856
1852
|
}
|
|
1857
1853
|
i.next(t), requestAnimationFrame(a);
|
|
@@ -1863,7 +1859,7 @@ class io extends eo {
|
|
|
1863
1859
|
}
|
|
1864
1860
|
_handleMoveEvent(t) {
|
|
1865
1861
|
const { features: n } = this._options;
|
|
1866
|
-
(n.touch &&
|
|
1862
|
+
(n.touch && Un() || this._scrollAvailable && Jn()) && t.preventDefault();
|
|
1867
1863
|
}
|
|
1868
1864
|
_onScroll() {
|
|
1869
1865
|
const {
|
|
@@ -1873,7 +1869,7 @@ class io extends eo {
|
|
|
1873
1869
|
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
1870
|
}
|
|
1875
1871
|
_onStartAreaScroll() {
|
|
1876
|
-
this._targetBoundaryScrolled = !0,
|
|
1872
|
+
this._targetBoundaryScrolled = !0, $(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1877
1873
|
}
|
|
1878
1874
|
_wheelScroll(t) {
|
|
1879
1875
|
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 +1892,9 @@ class io extends eo {
|
|
|
1896
1892
|
scrolling: { startScrollMargins: d }
|
|
1897
1893
|
}
|
|
1898
1894
|
} = s;
|
|
1899
|
-
r < i.left + d.x ? (t.x = -
|
|
1900
|
-
const h =
|
|
1901
|
-
this._areaRect =
|
|
1895
|
+
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;
|
|
1896
|
+
const h = Ge(l, r), u = Ge(c, a), y = ze(l, r), v = ze(c, a);
|
|
1897
|
+
this._areaRect = We(h, u, y - h, v - u);
|
|
1902
1898
|
}
|
|
1903
1899
|
_redrawSelectionArea() {
|
|
1904
1900
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1906,13 +1902,13 @@ class io extends eo {
|
|
|
1906
1902
|
}
|
|
1907
1903
|
_onTapStop(t, n) {
|
|
1908
1904
|
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1909
|
-
|
|
1905
|
+
$(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
1906
|
}
|
|
1911
1907
|
_updateElementSelection() {
|
|
1912
1908
|
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
1909
|
for (let p = 0; p < t.length; p++) {
|
|
1914
1910
|
const g = t[p];
|
|
1915
|
-
if (
|
|
1911
|
+
if (Xe(s, g.getBoundingClientRect(), r)) {
|
|
1916
1912
|
if (l.includes(g))
|
|
1917
1913
|
i.includes(g) && !c.includes(g) && c.push(g);
|
|
1918
1914
|
else if (d && i.includes(g)) {
|
|
@@ -1982,7 +1978,7 @@ class io extends eo {
|
|
|
1982
1978
|
* Will update everything that can be selected
|
|
1983
1979
|
*/
|
|
1984
1980
|
resolveSelectables() {
|
|
1985
|
-
this._selectables =
|
|
1981
|
+
this._selectables = q(this._options.selectables, this._options.document);
|
|
1986
1982
|
}
|
|
1987
1983
|
/**
|
|
1988
1984
|
* Same as deselecting, but for all elements currently selected
|
|
@@ -1991,7 +1987,7 @@ class io extends eo {
|
|
|
1991
1987
|
*/
|
|
1992
1988
|
clearSelection(t = !0, n = !1) {
|
|
1993
1989
|
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 =
|
|
1990
|
+
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = qe(t ? [] : s);
|
|
1995
1991
|
}
|
|
1996
1992
|
/**
|
|
1997
1993
|
* @returns {Array} Selected elements
|
|
@@ -2051,7 +2047,7 @@ class io extends eo {
|
|
|
2051
2047
|
* @param quiet If this should not trigger the move event
|
|
2052
2048
|
*/
|
|
2053
2049
|
select(t, n = !1) {
|
|
2054
|
-
const { changed: o, selected: s, stored: i } = this._selection, l =
|
|
2050
|
+
const { changed: o, selected: s, stored: i } = this._selection, l = q(t, this._options.document).filter((c) => !s.includes(c) && !i.includes(c));
|
|
2055
2051
|
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
2052
|
}
|
|
2057
2053
|
/**
|
|
@@ -2060,12 +2056,12 @@ class io extends eo {
|
|
|
2060
2056
|
* @param quiet If this should not trigger the move event
|
|
2061
2057
|
*/
|
|
2062
2058
|
deselect(t, n = !1) {
|
|
2063
|
-
const { selected: o, stored: s, changed: i } = this._selection, l =
|
|
2059
|
+
const { selected: o, stored: s, changed: i } = this._selection, l = q(t, this._options.document).filter((c) => o.includes(c) || s.includes(c));
|
|
2064
2060
|
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
2061
|
}
|
|
2066
2062
|
}
|
|
2067
|
-
function
|
|
2068
|
-
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new
|
|
2063
|
+
function eo(e) {
|
|
2064
|
+
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new Qn({
|
|
2069
2065
|
selectables: [".map-container me-tpc"],
|
|
2070
2066
|
boundaries: [e.container],
|
|
2071
2067
|
container: e.selectionContainer,
|
|
@@ -2124,10 +2120,10 @@ function ro(e) {
|
|
|
2124
2120
|
);
|
|
2125
2121
|
e.selection = n;
|
|
2126
2122
|
}
|
|
2127
|
-
const
|
|
2123
|
+
const to = function(e, t = !0) {
|
|
2128
2124
|
this.theme = e;
|
|
2129
2125
|
const o = {
|
|
2130
|
-
...(e.type === "dark" ?
|
|
2126
|
+
...(e.type === "dark" ? we : be).cssVar,
|
|
2131
2127
|
...e.cssVar
|
|
2132
2128
|
}, s = Object.keys(o);
|
|
2133
2129
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -2135,7 +2131,7 @@ const lo = function(e, t = !0) {
|
|
|
2135
2131
|
this.container.style.setProperty(l, o[l]);
|
|
2136
2132
|
}
|
|
2137
2133
|
t && this.refresh();
|
|
2138
|
-
},
|
|
2134
|
+
}, no = function(e) {
|
|
2139
2135
|
return {
|
|
2140
2136
|
dom: e,
|
|
2141
2137
|
moved: !1,
|
|
@@ -2158,7 +2154,7 @@ const lo = function(e, t = !0) {
|
|
|
2158
2154
|
},
|
|
2159
2155
|
cb: null,
|
|
2160
2156
|
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 =
|
|
2157
|
+
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
2158
|
{ dom: t, evt: "pointermove", func: this.handlePointerMove },
|
|
2163
2159
|
{ dom: t, evt: "pointerleave", func: this.handleClear },
|
|
2164
2160
|
{ dom: t, evt: "pointerup", func: this.handleClear },
|
|
@@ -2170,19 +2166,19 @@ const lo = function(e, t = !0) {
|
|
|
2170
2166
|
this.moved = !1, this.pointerdown = !1;
|
|
2171
2167
|
}
|
|
2172
2168
|
};
|
|
2173
|
-
},
|
|
2174
|
-
create:
|
|
2175
|
-
},
|
|
2176
|
-
function
|
|
2169
|
+
}, Ke = {
|
|
2170
|
+
create: no
|
|
2171
|
+
}, oo = "#4dc4ff";
|
|
2172
|
+
function ft(e, t, n, o, s, i, l, c) {
|
|
2177
2173
|
return {
|
|
2178
2174
|
x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
|
|
2179
2175
|
y: t / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
2180
2176
|
};
|
|
2181
2177
|
}
|
|
2182
|
-
function
|
|
2183
|
-
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(),
|
|
2178
|
+
function so(e, t, n) {
|
|
2179
|
+
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), fe(e));
|
|
2184
2180
|
}
|
|
2185
|
-
function
|
|
2181
|
+
function oe(e, t, n, o, s) {
|
|
2186
2182
|
A(e, {
|
|
2187
2183
|
x1: t + "",
|
|
2188
2184
|
y1: n + "",
|
|
@@ -2190,7 +2186,7 @@ function le(e, t, n, o, s) {
|
|
|
2190
2186
|
y2: s + ""
|
|
2191
2187
|
});
|
|
2192
2188
|
}
|
|
2193
|
-
function
|
|
2189
|
+
function Ue(e, t, n, o, s, i, l, c, r, a) {
|
|
2194
2190
|
const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${c} ${r}`;
|
|
2195
2191
|
if (e.line.setAttribute("d", d), a.style) {
|
|
2196
2192
|
const p = a.style;
|
|
@@ -2198,7 +2194,7 @@ function tt(e, t, n, o, s, i, l, c, r, a) {
|
|
|
2198
2194
|
}
|
|
2199
2195
|
const h = e.querySelectorAll('path[stroke="transparent"]');
|
|
2200
2196
|
h.length > 0 && h[0].setAttribute("d", d);
|
|
2201
|
-
const u =
|
|
2197
|
+
const u = ce(i, l, c, r);
|
|
2202
2198
|
if (u) {
|
|
2203
2199
|
const p = `M ${u.x1} ${u.y1} L ${c} ${r} L ${u.x2} ${u.y2}`;
|
|
2204
2200
|
if (e.arrow1.setAttribute("d", p), h.length > 1 && h[1].setAttribute("d", p), a.style) {
|
|
@@ -2207,7 +2203,7 @@ function tt(e, t, n, o, s, i, l, c, r, a) {
|
|
|
2207
2203
|
}
|
|
2208
2204
|
}
|
|
2209
2205
|
if (a.bidirectional) {
|
|
2210
|
-
const p =
|
|
2206
|
+
const p = ce(o, s, t, n);
|
|
2211
2207
|
if (p) {
|
|
2212
2208
|
const g = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
|
|
2213
2209
|
if (e.arrow2.setAttribute("d", g), h.length > 2 && h[2].setAttribute("d", g), a.style) {
|
|
@@ -2216,15 +2212,15 @@ function tt(e, t, n, o, s, i, l, c, r, a) {
|
|
|
2216
2212
|
}
|
|
2217
2213
|
}
|
|
2218
2214
|
}
|
|
2219
|
-
const { x: y, y: v } =
|
|
2220
|
-
if (e.labelEl &&
|
|
2215
|
+
const { x: y, y: v } = ft(t, n, o, s, i, l, c, r);
|
|
2216
|
+
if (e.labelEl && so(e.labelEl, y, v), a.style?.labelColor) {
|
|
2221
2217
|
const p = e.labelEl;
|
|
2222
2218
|
p && (p.style.color = a.style.labelColor);
|
|
2223
2219
|
}
|
|
2224
|
-
|
|
2220
|
+
po(e);
|
|
2225
2221
|
}
|
|
2226
|
-
function
|
|
2227
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
2222
|
+
function de(e, t, n) {
|
|
2223
|
+
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
2224
|
return {
|
|
2229
2225
|
w: i,
|
|
2230
2226
|
h: l,
|
|
@@ -2234,7 +2230,7 @@ function pe(e, t, n) {
|
|
|
2234
2230
|
ctrlY: d
|
|
2235
2231
|
};
|
|
2236
2232
|
}
|
|
2237
|
-
function
|
|
2233
|
+
function K(e) {
|
|
2238
2234
|
let t, n;
|
|
2239
2235
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
2240
2236
|
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 +2238,8 @@ function Z(e) {
|
|
|
2242
2238
|
y: n
|
|
2243
2239
|
};
|
|
2244
2240
|
}
|
|
2245
|
-
const
|
|
2246
|
-
const o =
|
|
2241
|
+
const io = function(e, t, n) {
|
|
2242
|
+
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
2243
|
let p, g;
|
|
2248
2244
|
if (h < 150) {
|
|
2249
2245
|
const b = t.closest("me-main").className === "lhs" ? -1 : 1;
|
|
@@ -2259,32 +2255,32 @@ const fo = function(e, t, n) {
|
|
|
2259
2255
|
p = { x: x + C, y: L + S }, g = { x: T - C, y: E - S };
|
|
2260
2256
|
}
|
|
2261
2257
|
return { delta1: p, delta2: g };
|
|
2262
|
-
},
|
|
2258
|
+
}, De = function(e, t, n, o, s) {
|
|
2263
2259
|
if (!t || !n)
|
|
2264
2260
|
return;
|
|
2265
2261
|
if (!o.delta1 || !o.delta2) {
|
|
2266
|
-
const N =
|
|
2262
|
+
const N = io(e, t, n);
|
|
2267
2263
|
o.delta1 = N.delta1, o.delta2 = N.delta2;
|
|
2268
2264
|
}
|
|
2269
|
-
const i =
|
|
2265
|
+
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
2266
|
if (!p) return;
|
|
2271
2267
|
const g = `M ${p.x1} ${p.y1} L ${y} ${v} L ${p.x2} ${p.y2}`;
|
|
2272
2268
|
let m = "";
|
|
2273
2269
|
if (o.bidirectional) {
|
|
2274
|
-
const N =
|
|
2270
|
+
const N = ce(a, d, c, r);
|
|
2275
2271
|
if (!N) return;
|
|
2276
2272
|
m = `M ${N.x1} ${N.y1} L ${c} ${r} L ${N.x2} ${N.y2}`;
|
|
2277
2273
|
}
|
|
2278
|
-
const b =
|
|
2274
|
+
const b = Mn(`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
2275
|
b.id = E;
|
|
2280
|
-
const C = e.markdown ? e.markdown(o.label, o) : o.label, S =
|
|
2276
|
+
const C = e.markdown ? e.markdown(o.label, o) : o.label, S = ye(C, x, L, {
|
|
2281
2277
|
anchor: "middle",
|
|
2282
2278
|
color: T,
|
|
2283
2279
|
dataType: "arrow",
|
|
2284
2280
|
svgId: E
|
|
2285
2281
|
});
|
|
2286
|
-
b.labelEl = S, b.arrowObj = o, b.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.linkSvgGroup.appendChild(b),
|
|
2287
|
-
},
|
|
2282
|
+
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));
|
|
2283
|
+
}, ro = function(e, t, n = {}) {
|
|
2288
2284
|
const o = {
|
|
2289
2285
|
id: V(),
|
|
2290
2286
|
label: "Custom Link",
|
|
@@ -2292,21 +2288,21 @@ const fo = function(e, t, n) {
|
|
|
2292
2288
|
to: t.nodeObj.id,
|
|
2293
2289
|
...n
|
|
2294
2290
|
};
|
|
2295
|
-
|
|
2291
|
+
De(this, e, t, o), this.bus.fire("operation", {
|
|
2296
2292
|
name: "createArrow",
|
|
2297
2293
|
obj: o
|
|
2298
2294
|
});
|
|
2299
|
-
},
|
|
2300
|
-
|
|
2295
|
+
}, lo = function(e) {
|
|
2296
|
+
ue(this);
|
|
2301
2297
|
const t = { ...e, id: V() };
|
|
2302
|
-
|
|
2298
|
+
De(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2303
2299
|
name: "createArrow",
|
|
2304
2300
|
obj: t
|
|
2305
2301
|
});
|
|
2306
|
-
},
|
|
2302
|
+
}, co = function(e) {
|
|
2307
2303
|
let t;
|
|
2308
2304
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2309
|
-
|
|
2305
|
+
ue(this);
|
|
2310
2306
|
const n = t.arrowObj.id;
|
|
2311
2307
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.labelEl?.remove(), t.remove(), this.bus.fire("operation", {
|
|
2312
2308
|
name: "removeArrow",
|
|
@@ -2314,14 +2310,14 @@ const fo = function(e, t, n) {
|
|
|
2314
2310
|
id: n
|
|
2315
2311
|
}
|
|
2316
2312
|
});
|
|
2317
|
-
},
|
|
2313
|
+
}, ao = function(e) {
|
|
2318
2314
|
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(
|
|
2315
|
+
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);
|
|
2316
|
+
ut(this, t, s, i);
|
|
2317
|
+
}, ho = function() {
|
|
2318
|
+
ue(this), this.currentArrow = null;
|
|
2319
|
+
}, ge = function(e, t) {
|
|
2320
|
+
const n = document.createElementNS(H, "path");
|
|
2325
2321
|
return A(n, {
|
|
2326
2322
|
d: e,
|
|
2327
2323
|
stroke: t,
|
|
@@ -2330,70 +2326,70 @@ const fo = function(e, t, n) {
|
|
|
2330
2326
|
"stroke-linecap": "round",
|
|
2331
2327
|
"stroke-linejoin": "round"
|
|
2332
2328
|
}), n;
|
|
2333
|
-
},
|
|
2334
|
-
const n = document.createElementNS(
|
|
2329
|
+
}, fo = function(e, t) {
|
|
2330
|
+
const n = document.createElementNS(H, "g");
|
|
2335
2331
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2336
|
-
const o =
|
|
2332
|
+
const o = ge(e.line.getAttribute("d"), t);
|
|
2337
2333
|
n.appendChild(o);
|
|
2338
|
-
const s =
|
|
2334
|
+
const s = ge(e.arrow1.getAttribute("d"), t);
|
|
2339
2335
|
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2340
|
-
const i =
|
|
2336
|
+
const i = ge(e.arrow2.getAttribute("d"), t);
|
|
2341
2337
|
n.appendChild(i);
|
|
2342
2338
|
}
|
|
2343
2339
|
e.insertBefore(n, e.firstChild);
|
|
2344
|
-
},
|
|
2340
|
+
}, uo = function(e) {
|
|
2345
2341
|
const t = e.querySelector(".arrow-highlight");
|
|
2346
2342
|
t && t.remove();
|
|
2347
|
-
},
|
|
2343
|
+
}, po = function(e) {
|
|
2348
2344
|
const t = e.querySelector(".arrow-highlight");
|
|
2349
2345
|
if (!t) return;
|
|
2350
2346
|
const n = t.querySelectorAll("path");
|
|
2351
2347
|
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
|
-
},
|
|
2348
|
+
}, ue = function(e) {
|
|
2349
|
+
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && uo(e.currentArrow);
|
|
2350
|
+
}, ut = function(e, t, n, o) {
|
|
2355
2351
|
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: d, currentArrow: h, bus: u } = e;
|
|
2356
2352
|
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;`,
|
|
2353
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), fo(h, oo);
|
|
2354
|
+
let { x: y, y: v } = K(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: b } = o, { x, y: L } = K(o);
|
|
2355
|
+
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
2356
|
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",
|
|
2357
|
+
const C = K({ ...n, ctrlX: p, ctrlY: g });
|
|
2358
|
+
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
2359
|
}), e.helper2.init(d, (T, E) => {
|
|
2364
2360
|
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",
|
|
2361
|
+
const C = K({ ...o, ctrlX: m, ctrlY: b });
|
|
2362
|
+
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
2363
|
});
|
|
2368
2364
|
};
|
|
2369
|
-
function
|
|
2365
|
+
function go() {
|
|
2370
2366
|
this.linkSvgGroup.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((t) => t.remove());
|
|
2371
2367
|
for (let t = 0; t < this.arrows.length; t++) {
|
|
2372
2368
|
const n = this.arrows[t];
|
|
2373
2369
|
try {
|
|
2374
|
-
|
|
2370
|
+
De(this, this.findEle(n.from), this.findEle(n.to), n, !0);
|
|
2375
2371
|
} catch {
|
|
2376
2372
|
}
|
|
2377
2373
|
}
|
|
2378
2374
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
2379
2375
|
}
|
|
2380
|
-
function
|
|
2381
|
-
|
|
2376
|
+
function mo(e) {
|
|
2377
|
+
ue(this), e && e.labelEl && at(this, e.labelEl, e.arrowObj);
|
|
2382
2378
|
}
|
|
2383
|
-
function
|
|
2384
|
-
this.arrows = this.arrows.filter((e) =>
|
|
2379
|
+
function yo() {
|
|
2380
|
+
this.arrows = this.arrows.filter((e) => le(e.from, this.nodeData) && le(e.to, this.nodeData));
|
|
2385
2381
|
}
|
|
2386
|
-
const
|
|
2382
|
+
const vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2387
2383
|
__proto__: null,
|
|
2388
|
-
createArrow:
|
|
2389
|
-
createArrowFrom:
|
|
2390
|
-
editArrowLabel:
|
|
2391
|
-
removeArrow:
|
|
2392
|
-
renderArrow:
|
|
2393
|
-
selectArrow:
|
|
2394
|
-
tidyArrow:
|
|
2395
|
-
unselectArrow:
|
|
2396
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2384
|
+
createArrow: ro,
|
|
2385
|
+
createArrowFrom: lo,
|
|
2386
|
+
editArrowLabel: mo,
|
|
2387
|
+
removeArrow: co,
|
|
2388
|
+
renderArrow: go,
|
|
2389
|
+
selectArrow: ao,
|
|
2390
|
+
tidyArrow: yo,
|
|
2391
|
+
unselectArrow: ho
|
|
2392
|
+
}, Symbol.toStringTag, { value: "Module" })), bo = function(e) {
|
|
2397
2393
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2398
2394
|
if (e.length === 1) {
|
|
2399
2395
|
const r = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
@@ -2430,11 +2426,11 @@ const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2430
2426
|
start: i,
|
|
2431
2427
|
end: l
|
|
2432
2428
|
};
|
|
2433
|
-
},
|
|
2434
|
-
const t = document.createElementNS(
|
|
2429
|
+
}, wo = function(e) {
|
|
2430
|
+
const t = document.createElementNS(H, "g");
|
|
2435
2431
|
return t.setAttribute("id", e), t;
|
|
2436
|
-
},
|
|
2437
|
-
const n = document.createElementNS(
|
|
2432
|
+
}, Je = function(e, t) {
|
|
2433
|
+
const n = document.createElementNS(H, "path");
|
|
2438
2434
|
return A(n, {
|
|
2439
2435
|
d: e,
|
|
2440
2436
|
stroke: t || "#666",
|
|
@@ -2442,89 +2438,89 @@ const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2442
2438
|
"stroke-linecap": "round",
|
|
2443
2439
|
"stroke-width": "2"
|
|
2444
2440
|
}), n;
|
|
2445
|
-
},
|
|
2441
|
+
}, xo = (e) => e.parentElement.parentElement, Co = function(e, { parent: t, start: n }) {
|
|
2446
2442
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2447
2443
|
let i;
|
|
2448
2444
|
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 =
|
|
2445
|
+
}, Me = function(e, t) {
|
|
2446
|
+
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 = Co(e, t);
|
|
2451
2447
|
let v = 1 / 0, p = 0, g = 0, m = 0;
|
|
2452
2448
|
for (let f = i; f <= l; f++) {
|
|
2453
2449
|
const w = u.children?.[f];
|
|
2454
2450
|
if (!w)
|
|
2455
2451
|
return e.removeSummary(n), null;
|
|
2456
|
-
const k =
|
|
2457
|
-
f === i && (g =
|
|
2452
|
+
const k = xo(e.findEle(w.id)), { offsetLeft: O, offsetTop: W } = j(r, k), M = i === l ? 10 : 20;
|
|
2453
|
+
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
2454
|
}
|
|
2459
2455
|
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
|
-
},
|
|
2456
|
+
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;
|
|
2457
|
+
y === B.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 }));
|
|
2458
|
+
const R = wo(D);
|
|
2459
|
+
return R.appendChild(b), e.labelContainer.appendChild(x), fe(x), R.summaryObj = t, R.labelEl = x, d.appendChild(R), R;
|
|
2460
|
+
}, Eo = function(e = {}) {
|
|
2465
2461
|
if (!this.currentNodes) return;
|
|
2466
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } =
|
|
2462
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = bo(t), c = { id: V(), parent: s, start: i, end: l, label: "summary", style: e.style }, r = Me(this, c);
|
|
2467
2463
|
n.push(c), this.editSummary(r), o.fire("operation", {
|
|
2468
2464
|
name: "createSummary",
|
|
2469
2465
|
obj: c
|
|
2470
2466
|
});
|
|
2471
|
-
},
|
|
2467
|
+
}, So = function(e) {
|
|
2472
2468
|
const t = V(), n = { ...e, id: t };
|
|
2473
|
-
|
|
2469
|
+
Me(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2474
2470
|
name: "createSummary",
|
|
2475
2471
|
obj: n
|
|
2476
2472
|
});
|
|
2477
|
-
},
|
|
2473
|
+
}, No = function(e) {
|
|
2478
2474
|
const t = this.summaries.findIndex((n) => n.id === e);
|
|
2479
2475
|
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
2476
|
name: "removeSummary",
|
|
2481
2477
|
obj: { id: e }
|
|
2482
2478
|
});
|
|
2483
|
-
},
|
|
2479
|
+
}, ko = function(e) {
|
|
2484
2480
|
const t = e.labelEl;
|
|
2485
2481
|
t && t.classList.add("selected"), this.currentSummary = e;
|
|
2486
|
-
},
|
|
2482
|
+
}, To = function() {
|
|
2487
2483
|
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
2488
|
-
},
|
|
2484
|
+
}, _o = function() {
|
|
2489
2485
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2490
2486
|
try {
|
|
2491
|
-
|
|
2487
|
+
Me(this, e);
|
|
2492
2488
|
} catch {
|
|
2493
2489
|
}
|
|
2494
2490
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2495
|
-
},
|
|
2496
|
-
e && e.labelEl &&
|
|
2497
|
-
},
|
|
2491
|
+
}, Lo = function(e) {
|
|
2492
|
+
e && e.labelEl && at(this, e.labelEl, e.summaryObj);
|
|
2493
|
+
}, Ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2498
2494
|
__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(
|
|
2495
|
+
createSummary: Eo,
|
|
2496
|
+
createSummaryFrom: So,
|
|
2497
|
+
editSummary: Lo,
|
|
2498
|
+
removeSummary: No,
|
|
2499
|
+
renderSummary: _o,
|
|
2500
|
+
selectSummary: ko,
|
|
2501
|
+
unselectSummary: To
|
|
2502
|
+
}, Symbol.toStringTag, { value: "Module" })), P = "http://www.w3.org/2000/svg";
|
|
2503
|
+
function Do(e, t) {
|
|
2504
|
+
const n = document.createElementNS(P, "svg");
|
|
2509
2505
|
return A(n, {
|
|
2510
2506
|
version: "1.1",
|
|
2511
|
-
xmlns:
|
|
2507
|
+
xmlns: P,
|
|
2512
2508
|
height: e,
|
|
2513
2509
|
width: t
|
|
2514
2510
|
}), n;
|
|
2515
2511
|
}
|
|
2516
|
-
function
|
|
2512
|
+
function Mo(e, t) {
|
|
2517
2513
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2518
2514
|
}
|
|
2519
|
-
function
|
|
2520
|
-
const s = document.createElementNS(
|
|
2515
|
+
function Po(e, t, n, o) {
|
|
2516
|
+
const s = document.createElementNS(P, "g");
|
|
2521
2517
|
let i = "";
|
|
2522
2518
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2523
2519
|
`).forEach((c, r) => {
|
|
2524
|
-
const a = document.createElementNS(
|
|
2520
|
+
const a = document.createElementNS(P, "text");
|
|
2525
2521
|
A(a, {
|
|
2526
2522
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2527
|
-
y: o + parseInt(t.paddingTop) +
|
|
2523
|
+
y: o + parseInt(t.paddingTop) + Mo(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
|
|
2528
2524
|
"text-anchor": "start",
|
|
2529
2525
|
"font-family": t.fontFamily,
|
|
2530
2526
|
"font-size": `${t.fontSize}`,
|
|
@@ -2533,10 +2529,10 @@ function Io(e, t, n, o) {
|
|
|
2533
2529
|
}), a.innerHTML = c, s.appendChild(a);
|
|
2534
2530
|
}), s;
|
|
2535
2531
|
}
|
|
2536
|
-
function
|
|
2532
|
+
function Oo(e, t, n, o) {
|
|
2537
2533
|
let s = "";
|
|
2538
2534
|
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2539
|
-
const i = document.createElementNS(
|
|
2535
|
+
const i = document.createElementNS(P, "foreignObject");
|
|
2540
2536
|
A(i, {
|
|
2541
2537
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2542
2538
|
y: o + parseInt(t.paddingTop) + "",
|
|
@@ -2549,8 +2545,8 @@ function Bo(e, t, n, o) {
|
|
|
2549
2545
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2550
2546
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2551
2547
|
}
|
|
2552
|
-
function
|
|
2553
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2548
|
+
function $o(e, t) {
|
|
2549
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = j(e.nodes, t), i = document.createElementNS(P, "rect");
|
|
2554
2550
|
return A(i, {
|
|
2555
2551
|
x: o + "",
|
|
2556
2552
|
y: s + "",
|
|
@@ -2563,8 +2559,8 @@ function Fo(e, t) {
|
|
|
2563
2559
|
"stroke-width": n.borderWidth
|
|
2564
2560
|
}), i;
|
|
2565
2561
|
}
|
|
2566
|
-
function
|
|
2567
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2562
|
+
function se(e, t, n = !1) {
|
|
2563
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = j(e.nodes, t), l = document.createElementNS(P, "rect");
|
|
2568
2564
|
A(l, {
|
|
2569
2565
|
x: s + "",
|
|
2570
2566
|
y: i + "",
|
|
@@ -2576,13 +2572,13 @@ function ce(e, t, n = !1) {
|
|
|
2576
2572
|
stroke: o.borderColor,
|
|
2577
2573
|
"stroke-width": o.borderWidth
|
|
2578
2574
|
});
|
|
2579
|
-
const c = document.createElementNS(
|
|
2575
|
+
const c = document.createElementNS(P, "g");
|
|
2580
2576
|
c.appendChild(l);
|
|
2581
2577
|
let r;
|
|
2582
|
-
return n ? r =
|
|
2578
|
+
return n ? r = Oo(t, o, s, i) : r = Po(t, o, s, i), c.appendChild(r), c;
|
|
2583
2579
|
}
|
|
2584
|
-
function
|
|
2585
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2580
|
+
function jo(e, t) {
|
|
2581
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = j(e.nodes, t), i = document.createElementNS(P, "a"), l = document.createElementNS(P, "text");
|
|
2586
2582
|
return A(l, {
|
|
2587
2583
|
x: o + "",
|
|
2588
2584
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2593,8 +2589,8 @@ function Yo(e, t) {
|
|
|
2593
2589
|
fill: `${n.color}`
|
|
2594
2590
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2595
2591
|
}
|
|
2596
|
-
function
|
|
2597
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2592
|
+
function Ho(e, t) {
|
|
2593
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = j(e.nodes, t), i = document.createElementNS(P, "image");
|
|
2598
2594
|
return A(i, {
|
|
2599
2595
|
x: o + "",
|
|
2600
2596
|
y: s + "",
|
|
@@ -2603,8 +2599,8 @@ function Wo(e, t) {
|
|
|
2603
2599
|
href: t.src
|
|
2604
2600
|
}), i;
|
|
2605
2601
|
}
|
|
2606
|
-
const
|
|
2607
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
2602
|
+
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">', Ro = (e, t = !1) => {
|
|
2603
|
+
const n = e.nodes, o = n.offsetHeight + ie * 2, s = n.offsetWidth + ie * 2, i = Do(o + "px", s + "px"), l = document.createElementNS(P, "svg"), c = document.createElementNS(P, "rect");
|
|
2608
2604
|
A(c, {
|
|
2609
2605
|
x: "0",
|
|
2610
2606
|
y: "0",
|
|
@@ -2612,7 +2608,7 @@ const ae = 100, Xo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2612
2608
|
height: `${o}`,
|
|
2613
2609
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2614
2610
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((h) => {
|
|
2615
|
-
const u = h.cloneNode(!0), { offsetLeft: y, offsetTop: v } =
|
|
2611
|
+
const u = h.cloneNode(!0), { offsetLeft: y, offsetTop: v } = j(n, h.parentElement);
|
|
2616
2612
|
u.setAttribute("x", `${y}`), u.setAttribute("y", `${v}`), l.appendChild(u);
|
|
2617
2613
|
});
|
|
2618
2614
|
const r = n.querySelector(".lines")?.cloneNode(!0);
|
|
@@ -2621,22 +2617,22 @@ const ae = 100, Xo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2621
2617
|
a && l.appendChild(a);
|
|
2622
2618
|
const d = n.querySelector(".summary")?.cloneNode(!0);
|
|
2623
2619
|
return d && l.appendChild(d), n.querySelectorAll("me-tpc").forEach((h) => {
|
|
2624
|
-
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(
|
|
2620
|
+
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(se(e, h, !t)) : (l.appendChild($o(e, h)), l.appendChild(se(e, h.text, !t)));
|
|
2625
2621
|
}), n.querySelectorAll(".tags > span").forEach((h) => {
|
|
2626
|
-
l.appendChild(
|
|
2622
|
+
l.appendChild(se(e, h));
|
|
2627
2623
|
}), n.querySelectorAll(".icons > span").forEach((h) => {
|
|
2628
|
-
l.appendChild(
|
|
2624
|
+
l.appendChild(se(e, h));
|
|
2629
2625
|
}), n.querySelectorAll(".hyper-link").forEach((h) => {
|
|
2630
|
-
l.appendChild(
|
|
2626
|
+
l.appendChild(jo(e, h));
|
|
2631
2627
|
}), n.querySelectorAll("img").forEach((h) => {
|
|
2632
|
-
l.appendChild(
|
|
2628
|
+
l.appendChild(Ho(e, h));
|
|
2633
2629
|
}), A(l, {
|
|
2634
|
-
x:
|
|
2635
|
-
y:
|
|
2630
|
+
x: ie + "",
|
|
2631
|
+
y: ie + "",
|
|
2636
2632
|
overflow: "visible"
|
|
2637
2633
|
}), i.appendChild(l), i;
|
|
2638
|
-
},
|
|
2639
|
-
function
|
|
2634
|
+
}, Bo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Io + e.outerHTML);
|
|
2635
|
+
function Fo(e) {
|
|
2640
2636
|
return new Promise((t, n) => {
|
|
2641
2637
|
const o = new FileReader();
|
|
2642
2638
|
o.onload = (s) => {
|
|
@@ -2646,11 +2642,11 @@ function qo(e) {
|
|
|
2646
2642
|
}, o.readAsDataURL(e);
|
|
2647
2643
|
});
|
|
2648
2644
|
}
|
|
2649
|
-
const
|
|
2650
|
-
const n =
|
|
2645
|
+
const Yo = function(e = !1, t) {
|
|
2646
|
+
const n = Ro(this, e), o = Bo(n, t);
|
|
2651
2647
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2652
|
-
},
|
|
2653
|
-
const n = this.exportSvg(e, t), o = await
|
|
2648
|
+
}, Wo = async function(e = !1, t) {
|
|
2649
|
+
const n = this.exportSvg(e, t), o = await Fo(n);
|
|
2654
2650
|
return new Promise((s, i) => {
|
|
2655
2651
|
const l = new Image();
|
|
2656
2652
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
@@ -2658,66 +2654,66 @@ const Vo = function(e = !1, t) {
|
|
|
2658
2654
|
c.width = l.width, c.height = l.height, c.getContext("2d").drawImage(l, 0, 0), c.toBlob(s, "image/png", 1);
|
|
2659
2655
|
}, l.src = o, l.onerror = i;
|
|
2660
2656
|
});
|
|
2661
|
-
},
|
|
2657
|
+
}, Xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2662
2658
|
__proto__: null,
|
|
2663
|
-
exportPng:
|
|
2664
|
-
exportSvg:
|
|
2659
|
+
exportPng: Wo,
|
|
2660
|
+
exportSvg: Yo
|
|
2665
2661
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2666
|
-
function
|
|
2662
|
+
function zo(e, t) {
|
|
2667
2663
|
return async function(...n) {
|
|
2668
2664
|
const o = this.before[t];
|
|
2669
2665
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2670
2666
|
};
|
|
2671
2667
|
}
|
|
2672
|
-
const
|
|
2673
|
-
for (let e = 0; e <
|
|
2674
|
-
const t =
|
|
2675
|
-
|
|
2668
|
+
const Ze = Object.keys(it), pt = {};
|
|
2669
|
+
for (let e = 0; e < Ze.length; e++) {
|
|
2670
|
+
const t = Ze[e];
|
|
2671
|
+
pt[t] = zo(it[t], t);
|
|
2676
2672
|
}
|
|
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
|
-
...
|
|
2673
|
+
const Go = {
|
|
2674
|
+
getObjById: le,
|
|
2675
|
+
generateNewObj: gt,
|
|
2676
|
+
layout: mt,
|
|
2677
|
+
linkDiv: Pn,
|
|
2678
|
+
editTopic: Et,
|
|
2679
|
+
createWrapper: bt,
|
|
2680
|
+
createParent: wt,
|
|
2681
|
+
createChildren: xt,
|
|
2682
|
+
createTopic: Ct,
|
|
2683
|
+
findEle: et,
|
|
2684
|
+
changeTheme: to,
|
|
2685
|
+
...mn,
|
|
2686
|
+
...pt,
|
|
2687
|
+
...vo,
|
|
2688
|
+
...Ao,
|
|
2689
|
+
...Xo,
|
|
2694
2690
|
init(e) {
|
|
2695
2691
|
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,
|
|
2692
|
+
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 && Vn(this), this.keypress && xn(this, this.keypress), this.editable && (eo(this), this.disposable.push(Ln())), this.contextMenu && this.disposable.push(On(this, this.contextMenu)), this.allowUndo && this.disposable.push(jn(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2697
2693
|
},
|
|
2698
2694
|
destroy() {
|
|
2699
2695
|
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
2696
|
}
|
|
2701
2697
|
};
|
|
2702
|
-
function
|
|
2698
|
+
function Vo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, containerHeight: a }) {
|
|
2703
2699
|
let d = t + n / 2;
|
|
2704
2700
|
const h = e + o / 2;
|
|
2705
2701
|
let u;
|
|
2706
|
-
r ===
|
|
2702
|
+
r === B.LHS ? u = i + l : u = i;
|
|
2707
2703
|
const y = s + c / 2, p = (1 - Math.abs(y - h) / a) * 0.25 * (n / 2);
|
|
2708
|
-
return r ===
|
|
2704
|
+
return r === B.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${y} ${u} ${y}`;
|
|
2709
2705
|
}
|
|
2710
|
-
function
|
|
2706
|
+
function qo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, isFirst: a }) {
|
|
2711
2707
|
const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2712
2708
|
let h = 0, u = 0;
|
|
2713
2709
|
a ? h = e + o / 2 : h = e + o;
|
|
2714
2710
|
const y = s + c;
|
|
2715
2711
|
let v = 0, p = 0, g = 0;
|
|
2716
2712
|
const m = Math.abs(h - y) / 300 * d;
|
|
2717
|
-
return r ===
|
|
2713
|
+
return r === B.LHS ? (g = t, v = g + d, p = g - d, u = i + d, `M ${v} ${h} C ${g} ${h} ${g + m} ${y} ${p} ${y} H ${u}`) : (g = t + n, v = g - d, p = g + d, u = i + l - d, `M ${v} ${h} C ${g} ${h} ${g - m} ${y} ${p} ${y} H ${u}`);
|
|
2718
2714
|
}
|
|
2719
|
-
const
|
|
2720
|
-
function
|
|
2715
|
+
const Ko = "5.9.2";
|
|
2716
|
+
function Uo(e) {
|
|
2721
2717
|
return {
|
|
2722
2718
|
x: 0,
|
|
2723
2719
|
y: 0,
|
|
@@ -2732,8 +2728,7 @@ function ns(e) {
|
|
|
2732
2728
|
}
|
|
2733
2729
|
};
|
|
2734
2730
|
}
|
|
2735
|
-
|
|
2736
|
-
function B({
|
|
2731
|
+
function I({
|
|
2737
2732
|
el: e,
|
|
2738
2733
|
direction: t,
|
|
2739
2734
|
locale: n,
|
|
@@ -2762,27 +2757,27 @@ function B({
|
|
|
2762
2757
|
let S = null;
|
|
2763
2758
|
const N = Object.prototype.toString.call(e);
|
|
2764
2759
|
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 =
|
|
2760
|
+
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 || Vo, this.generateSubBranch = y || qo, 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 = Uo(this), this.bus = Dn(), this.container = document.createElement("div"), this.selectionContainer = r || this.container, this.container.className = "map-container";
|
|
2761
|
+
const D = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2762
|
+
this.theme = p || (D.matches ? we : be);
|
|
2763
|
+
const _ = document.createElement("div");
|
|
2764
|
+
_.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 = Re(), this.line2 = Re(), 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(An(this)), C && (this.pasteHandler = C);
|
|
2770
2765
|
}
|
|
2771
|
-
|
|
2772
|
-
Object.defineProperty(
|
|
2766
|
+
I.prototype = Go;
|
|
2767
|
+
Object.defineProperty(I.prototype, "currentNode", {
|
|
2773
2768
|
get() {
|
|
2774
2769
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
2775
2770
|
},
|
|
2776
2771
|
enumerable: !0
|
|
2777
2772
|
});
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2773
|
+
I.LEFT = 0;
|
|
2774
|
+
I.RIGHT = 1;
|
|
2775
|
+
I.SIDE = 2;
|
|
2776
|
+
I.THEME = be;
|
|
2777
|
+
I.DARK_THEME = we;
|
|
2778
|
+
I.version = Ko;
|
|
2779
|
+
I.E = et;
|
|
2780
|
+
I.new = (e) => ({
|
|
2786
2781
|
nodeData: {
|
|
2787
2782
|
id: V(),
|
|
2788
2783
|
topic: e || "new topic",
|
|
@@ -2790,10 +2785,10 @@ B.new = (e) => ({
|
|
|
2790
2785
|
}
|
|
2791
2786
|
});
|
|
2792
2787
|
export {
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2788
|
+
we as DARK_THEME,
|
|
2789
|
+
Jo as LEFT,
|
|
2790
|
+
Zo as RIGHT,
|
|
2791
|
+
Qo as SIDE,
|
|
2792
|
+
be as THEME,
|
|
2793
|
+
I as default
|
|
2799
2794
|
};
|