@billtaofbj/mindmap 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2745 @@
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, h as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as p, onMounted as m, onUnmounted as h, openBlock as g, ref as _, renderList as v, resolveComponent as y, toDisplayString as b, unref as x, vShow as S, watch as C, withCtx as w, withDirectives as T, withKeys as E, withModifiers as D } from "vue";
2
+ import { BrandWatermark as O } from "@billtaofbj/core";
3
+ import { useRoute as k, useRouter as A } from "vue-router";
4
+ import { ElMessage as j, ElMessageBox as M } from "element-plus";
5
+ import { Aim as N, ArrowLeft as P, Bell as F, Brush as I, Check as L, Clock as R, Close as z, CopyDocument as B, Delete as V, Document as H, DocumentCopy as U, Download as W, Edit as G, FullScreen as K, Grid as q, InfoFilled as ee, Link as te, Loading as ne, Monitor as J, Picture as re, Plus as ie, Promotion as ae, Refresh as oe, RefreshLeft as se, RefreshRight as ce, Scissor as Y, Share as le, Switch as ue, ZoomIn as de, ZoomOut as fe } from "@element-plus/icons-vue";
6
+ import X from "axios";
7
+ import * as pe from "yjs";
8
+ import { HocuspocusProvider as me } from "@hocuspocus/provider";
9
+ //#region \0plugin-vue:export-helper
10
+ var Z = (e, t) => {
11
+ let n = e.__vccOpts || e;
12
+ for (let [e, r] of t) n[e] = r;
13
+ return n;
14
+ }, Q = { class: "chat-header" }, he = { class: "chat-header-left" }, ge = { class: "chat-title" }, _e = { class: "online-users-list" }, $ = { class: "online-user-item" }, ve = { class: "online-user-name" }, ye = { key: 1 }, be = { class: "online-user-name" }, xe = { class: "chat-header-right" }, Se = {
15
+ key: 0,
16
+ class: "chat-empty"
17
+ }, Ce = { class: "chat-empty-hint" }, we = { key: 1 }, Te = { class: "message-content" }, Ee = {
18
+ key: 0,
19
+ class: "message-meta"
20
+ }, De = {
21
+ key: 0,
22
+ class: "message-mention"
23
+ }, Oe = ["innerHTML"], ke = { class: "message-time" }, Ae = {
24
+ key: 1,
25
+ class: "chat-message chat-message-ai"
26
+ }, je = { class: "message-avatar ai" }, Me = { class: "chat-input-area" }, Ne = {
27
+ key: 0,
28
+ class: "mention-popup"
29
+ }, Pe = ["onClick", "onMouseenter"], Fe = { key: 1 }, Ie = /*#__PURE__*/ Z({
30
+ __name: "AiChatPanel",
31
+ props: {
32
+ visible: {
33
+ type: Boolean,
34
+ default: !1
35
+ },
36
+ messages: {
37
+ type: Array,
38
+ default: () => []
39
+ },
40
+ loading: {
41
+ type: Boolean,
42
+ default: !1
43
+ },
44
+ panelWidth: {
45
+ type: Number,
46
+ default: 360
47
+ },
48
+ isCollab: {
49
+ type: Boolean,
50
+ default: !1
51
+ },
52
+ collabUsers: {
53
+ type: Array,
54
+ default: () => []
55
+ },
56
+ currentUser: {
57
+ type: Object,
58
+ default: () => ({
59
+ id: "",
60
+ name: "",
61
+ color: ""
62
+ })
63
+ },
64
+ isOwner: {
65
+ type: Boolean,
66
+ default: !0
67
+ },
68
+ unreadMention: {
69
+ type: Boolean,
70
+ default: !1
71
+ }
72
+ },
73
+ emits: [
74
+ "send",
75
+ "close",
76
+ "clear",
77
+ "clear-unread"
78
+ ],
79
+ setup(c, { emit: l }) {
80
+ let p = c, m = l, h = _(""), S = _(null), T = _(null), O = _(!1), k = _([]), A = _(0), j = "", M = -1, N = {
81
+ id: "ai-assistant",
82
+ name: "AI助手",
83
+ color: "#409EFF",
84
+ isAi: !0
85
+ }, P = t(() => {
86
+ let e = p.currentUser.id, t = /* @__PURE__ */ new Set();
87
+ return [N, ...p.collabUsers.filter((n) => {
88
+ let r = n.clientId || n.id || "";
89
+ if (r && r === e) return !1;
90
+ let i = String(r || n.name || "");
91
+ return t.has(i) ? !1 : (t.add(i), !0);
92
+ })];
93
+ }), I = t(() => P.value.length + 1), L = (e) => e.role === "ai" ? "chat-message-ai" : p.isCollab && e.user_id && e.user_id !== p.currentUser.id ? "chat-message-other" : "chat-message-user", R = (e) => e.role === "ai" ? { background: "linear-gradient(135deg, #409EFF, #337ECC)" } : { background: e.user_color || "#67C23A" }, B = (e) => (e.user_name || "U").charAt(0), H = (e) => {
94
+ if (!p.isCollab) return;
95
+ let t = typeof e == "string" ? e : e.target?.value || h.value, n = t.length, r = t.lastIndexOf("@", n);
96
+ if (r !== -1 && r < n) {
97
+ let e = t.slice(r + 1, n);
98
+ if (!e.includes(" ") && !e.includes("\n")) {
99
+ j = e, M = r, k.value = P.value.filter((t) => t.name && t.name.toLowerCase().includes(e.toLowerCase())), O.value = k.value.length > 0, A.value = 0;
100
+ return;
101
+ }
102
+ }
103
+ O.value = !1;
104
+ }, U = () => {
105
+ O.value && (A.value = Math.min(A.value + 1, k.value.length - 1));
106
+ }, W = () => {
107
+ O.value && (A.value = Math.max(A.value - 1, 0));
108
+ }, G = (e) => {
109
+ let t = h.value.slice(0, M), n = h.value.slice(M + j.length + 1);
110
+ h.value = `${t}@${e.name} ${n}`, O.value = !1;
111
+ }, K = (e) => {
112
+ if (e) {
113
+ if (e.shiftKey) return;
114
+ if (O.value) {
115
+ let t = k.value[A.value];
116
+ if (t) {
117
+ e.preventDefault(), G(t);
118
+ return;
119
+ }
120
+ }
121
+ e.preventDefault();
122
+ }
123
+ let t = h.value.trim();
124
+ if (!t || p.loading) return;
125
+ let n = null;
126
+ if (p.isCollab) {
127
+ let e = t.match(/@(\S+)/);
128
+ e && (n = e[1]);
129
+ }
130
+ m("send", t, { mentionedUser: n }), h.value = "", O.value = !1;
131
+ }, q = () => {
132
+ u(() => {
133
+ S.value && (S.value.scrollTop = S.value.scrollHeight);
134
+ });
135
+ };
136
+ return C(() => p.messages.length, q), C(() => p.messages, q, { deep: !0 }), (t, l) => {
137
+ let u = y("el-icon"), p = y("el-tag"), _ = y("el-popover"), C = y("el-button"), j = y("el-input");
138
+ return c.visible ? (g(), i("div", {
139
+ key: 0,
140
+ class: "ai-chat-panel",
141
+ style: f({ width: c.panelWidth + "px" })
142
+ }, [
143
+ a("div", Q, [a("div", he, [
144
+ s(u, {
145
+ size: 18,
146
+ color: "#409EFF"
147
+ }, {
148
+ default: w(() => [s(x(J))]),
149
+ _: 1
150
+ }),
151
+ a("span", ge, b(c.isCollab ? "协作聊天" : "AI 助手"), 1),
152
+ c.isCollab ? (g(), n(_, {
153
+ key: 0,
154
+ width: 200,
155
+ placement: "bottom-start",
156
+ trigger: "click"
157
+ }, {
158
+ reference: w(() => [s(p, {
159
+ size: "small",
160
+ type: "success",
161
+ effect: "plain",
162
+ class: "online-tag"
163
+ }, {
164
+ default: w(() => [o(b(I.value) + "人在线 ", 1)]),
165
+ _: 1
166
+ })]),
167
+ default: w(() => [a("div", _e, [a("div", $, [
168
+ a("div", {
169
+ class: "online-user-avatar",
170
+ style: f({ background: c.currentUser.color || "#409EFF" })
171
+ }, b((c.currentUser.name || "U").charAt(0)), 5),
172
+ a("span", ve, b(c.currentUser.name || "我"), 1),
173
+ s(p, {
174
+ size: "small",
175
+ type: c.isOwner ? "warning" : "success",
176
+ effect: "plain",
177
+ class: "role-tag"
178
+ }, {
179
+ default: w(() => [o(b(c.isOwner ? "发起人" : "协作人"), 1)]),
180
+ _: 1
181
+ }, 8, ["type"]),
182
+ l[4] ||= a("span", { class: "self-tag" }, "(我)", -1)
183
+ ]), (g(!0), i(e, null, v(P.value, (e) => (g(), i("div", {
184
+ key: e.id || e.clientId,
185
+ class: "online-user-item"
186
+ }, [
187
+ a("div", {
188
+ class: "online-user-avatar",
189
+ style: f({ background: e.color || "#909399" })
190
+ }, [e.isAi ? (g(), n(u, {
191
+ key: 0,
192
+ size: 14
193
+ }, {
194
+ default: w(() => [s(x(J))]),
195
+ _: 1
196
+ })) : (g(), i("span", ye, b((e.name || "U").charAt(0)), 1))], 4),
197
+ a("span", be, b(e.name || "未知用户"), 1),
198
+ e.isAi ? (g(), n(p, {
199
+ key: 0,
200
+ size: "small",
201
+ type: "primary",
202
+ effect: "plain",
203
+ class: "role-tag"
204
+ }, {
205
+ default: w(() => [...l[5] ||= [o("AI助手", -1)]]),
206
+ _: 1
207
+ })) : (g(), n(p, {
208
+ key: 1,
209
+ size: "small",
210
+ type: "success",
211
+ effect: "plain",
212
+ class: "role-tag"
213
+ }, {
214
+ default: w(() => [...l[6] ||= [o("协作人", -1)]]),
215
+ _: 1
216
+ }))
217
+ ]))), 128))])]),
218
+ _: 1
219
+ })) : r("", !0)
220
+ ]), a("div", xe, [
221
+ c.isCollab && c.unreadMention ? (g(), i("div", {
222
+ key: 0,
223
+ class: "mention-bell",
224
+ title: "有新消息",
225
+ onClick: l[0] ||= (e) => m("clear-unread")
226
+ }, [s(u, {
227
+ size: 18,
228
+ color: "#F56C6C"
229
+ }, {
230
+ default: w(() => [s(x(F))]),
231
+ _: 1
232
+ })])) : r("", !0),
233
+ s(C, {
234
+ text: "",
235
+ circle: "",
236
+ size: "small",
237
+ onClick: l[1] ||= (e) => t.$emit("clear"),
238
+ title: "清空对话"
239
+ }, {
240
+ default: w(() => [s(u, null, {
241
+ default: w(() => [s(x(V))]),
242
+ _: 1
243
+ })]),
244
+ _: 1
245
+ }),
246
+ s(C, {
247
+ text: "",
248
+ circle: "",
249
+ size: "small",
250
+ onClick: l[2] ||= (e) => t.$emit("close"),
251
+ title: "关闭"
252
+ }, {
253
+ default: w(() => [s(u, null, {
254
+ default: w(() => [s(x(z))]),
255
+ _: 1
256
+ })]),
257
+ _: 1
258
+ })
259
+ ])]),
260
+ a("div", {
261
+ class: "chat-messages",
262
+ ref_key: "messagesRef",
263
+ ref: S
264
+ }, [
265
+ c.messages.length === 0 ? (g(), i("div", Se, [
266
+ s(u, {
267
+ size: 40,
268
+ color: "#c0c4cc"
269
+ }, {
270
+ default: w(() => [s(x(J))]),
271
+ _: 1
272
+ }),
273
+ a("p", null, b(c.isCollab ? "协作聊天室" : "你好!我是 AI 助手"), 1),
274
+ a("p", Ce, b(c.isCollab ? "与团队成员和AI助手实时聊天" : "可以问我任何关于文档编辑的问题"), 1)
275
+ ])) : r("", !0),
276
+ (g(!0), i(e, null, v(c.messages, (e) => (g(), i("div", {
277
+ key: e._msgId || e.time + e.content,
278
+ class: d(["chat-message", L(e)])
279
+ }, [a("div", {
280
+ class: "message-avatar",
281
+ style: f(R(e))
282
+ }, [e.role === "ai" ? (g(), n(u, {
283
+ key: 0,
284
+ size: 16
285
+ }, {
286
+ default: w(() => [s(x(J))]),
287
+ _: 1
288
+ })) : (g(), i("span", we, b(B(e)), 1))], 4), a("div", Te, [
289
+ c.isCollab && e.role === "user" ? (g(), i("div", Ee, [a("span", {
290
+ class: "message-sender",
291
+ style: f({ color: e.user_color || "#67C23A" })
292
+ }, b(e.user_name || "用户"), 5), e.mentioned_user ? (g(), i("span", De, "@" + b(e.mentioned_user), 1)) : r("", !0)])) : r("", !0),
293
+ a("div", {
294
+ class: "message-text",
295
+ innerHTML: e.content
296
+ }, null, 8, Oe),
297
+ a("div", ke, b(e.time), 1)
298
+ ])], 2))), 128)),
299
+ c.loading ? (g(), i("div", Ae, [a("div", je, [s(u, { size: 16 }, {
300
+ default: w(() => [s(x(J))]),
301
+ _: 1
302
+ })]), l[7] ||= a("div", { class: "message-content" }, [a("div", { class: "message-text typing-indicator" }, [
303
+ a("span"),
304
+ a("span"),
305
+ a("span")
306
+ ])], -1)])) : r("", !0)
307
+ ], 512),
308
+ a("div", Me, [a("div", {
309
+ class: "chat-input-wrapper",
310
+ ref_key: "inputWrapperRef",
311
+ ref: T
312
+ }, [
313
+ s(j, {
314
+ modelValue: h.value,
315
+ "onUpdate:modelValue": l[3] ||= (e) => h.value = e,
316
+ type: "textarea",
317
+ autosize: {
318
+ minRows: 1,
319
+ maxRows: 4
320
+ },
321
+ placeholder: c.isCollab ? "输入消息... @提及成员" : "输入消息...",
322
+ onKeydown: [
323
+ E(D(K, ["exact"]), ["enter"]),
324
+ E(D(U, ["prevent"]), ["down"]),
325
+ E(D(W, ["prevent"]), ["up"])
326
+ ],
327
+ onInput: H,
328
+ resize: "none"
329
+ }, null, 8, [
330
+ "modelValue",
331
+ "placeholder",
332
+ "onKeydown"
333
+ ]),
334
+ O.value ? (g(), i("div", Ne, [(g(!0), i(e, null, v(k.value, (e, t) => (g(), i("div", {
335
+ key: e.id || e.clientId,
336
+ class: d(["mention-item", { active: t === A.value }]),
337
+ onClick: (t) => G(e),
338
+ onMouseenter: (e) => A.value = t
339
+ }, [a("div", {
340
+ class: "mention-avatar",
341
+ style: f({ background: e.color || "#909399" })
342
+ }, [e.isAi ? (g(), n(u, {
343
+ key: 0,
344
+ size: 12
345
+ }, {
346
+ default: w(() => [s(x(J))]),
347
+ _: 1
348
+ })) : (g(), i("span", Fe, b((e.name || "U").charAt(0)), 1))], 4), a("span", null, b(e.name), 1)], 42, Pe))), 128))])) : r("", !0),
349
+ s(C, {
350
+ class: "send-btn",
351
+ type: "primary",
352
+ circle: "",
353
+ disabled: !h.value.trim() || c.loading,
354
+ onClick: K
355
+ }, {
356
+ default: w(() => [s(u, null, {
357
+ default: w(() => [s(x(ae))]),
358
+ _: 1
359
+ })]),
360
+ _: 1
361
+ }, 8, ["disabled"])
362
+ ], 512)])
363
+ ], 4)) : r("", !0);
364
+ };
365
+ }
366
+ }, [["__scopeId", "data-v-01960100"]]);
367
+ //#endregion
368
+ //#region ../../src/composables/useChat.js
369
+ function Le() {
370
+ let e = _([]), t = _(!1), n = _(!1), r = _([]), i = _({
371
+ id: "",
372
+ name: "",
373
+ color: ""
374
+ }), a = _(!1), o = null, s = null, c = null, l = /* @__PURE__ */ new Set(), u = "/api/chat", d = null, f = ({ ydoc: t, provider: s, onlineUsers: u }) => {
375
+ if (t) {
376
+ n.value = !0, c = u, d && d(), d = C(c, (e) => {
377
+ r.value = Array.isArray(e) ? e : [];
378
+ }, {
379
+ immediate: !0,
380
+ deep: !0
381
+ });
382
+ try {
383
+ o = t.getArray("chat-messages"), o.observe((t) => {
384
+ try {
385
+ t.changes.added.forEach((t) => {
386
+ t.content.getContent().forEach((t) => {
387
+ t && t._msgId && !l.has(t._msgId) && (l.add(t._msgId), e.value = [...e.value, t], t.mentioned_user && t.user_id !== i.value.id && (a.value = !0));
388
+ });
389
+ });
390
+ } catch (e) {
391
+ console.warn("[useChat] Y.Array observer error:", e);
392
+ }
393
+ });
394
+ } catch (e) {
395
+ console.warn("[useChat] Failed to create Y.Array:", e);
396
+ }
397
+ }
398
+ }, p = (e) => {
399
+ i.value = {
400
+ ...i.value,
401
+ ...e
402
+ };
403
+ }, m = (e) => {
404
+ r.value = e || [];
405
+ }, g = () => {
406
+ let e = /* @__PURE__ */ new Date();
407
+ return `${e.getHours().toString().padStart(2, "0")}:${e.getMinutes().toString().padStart(2, "0")}`;
408
+ }, v = async (t, r = {}) => {
409
+ let a = {
410
+ _msgId: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
411
+ role: "user",
412
+ content: t,
413
+ time: g(),
414
+ user_id: i.value.id,
415
+ user_name: i.value.name,
416
+ user_color: i.value.color,
417
+ mentioned_user: r.mentionedUser || null
418
+ };
419
+ if (l.add(a._msgId), e.value = [...e.value, a], o && x(n)) try {
420
+ o.push([a]);
421
+ } catch (e) {
422
+ console.warn("[useChat] Failed to push to Y.Array:", e);
423
+ }
424
+ if (r.roomId) try {
425
+ await X.post(u, {
426
+ room_id: r.roomId,
427
+ role: "user",
428
+ content: t,
429
+ user_id: i.value.id,
430
+ user_name: i.value.name,
431
+ mentioned_user: r.mentionedUser || null
432
+ });
433
+ } catch (e) {
434
+ console.warn("[useChat] Failed to persist message:", e);
435
+ }
436
+ }, y = async (t, r) => {
437
+ let i = {
438
+ _msgId: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
439
+ role: "ai",
440
+ content: t,
441
+ time: g(),
442
+ user_id: "ai-assistant",
443
+ user_name: "AI助手"
444
+ };
445
+ if (l.add(i._msgId), e.value = [...e.value, i], o && x(n)) try {
446
+ o.push([i]);
447
+ } catch (e) {
448
+ console.warn("[useChat] Failed to push AI message to Y.Array:", e);
449
+ }
450
+ if (r) try {
451
+ await X.post(u, {
452
+ room_id: r,
453
+ role: "ai",
454
+ content: t,
455
+ user_id: "ai-assistant",
456
+ user_name: "AI助手"
457
+ });
458
+ } catch (e) {
459
+ console.warn("[useChat] Failed to persist AI message:", e);
460
+ }
461
+ }, b = async (t) => {
462
+ if (t) try {
463
+ let n = await X.get(u, { params: { room_id: t } });
464
+ if (Array.isArray(n.data)) {
465
+ let t = n.data.map((e) => ({
466
+ _msgId: e._msgId || `hist-${e.id || Date.now()}`,
467
+ role: e.role,
468
+ content: e.content,
469
+ time: e.time || g(),
470
+ user_id: e.user_id || "",
471
+ user_name: e.user_name || "",
472
+ user_color: e.user_color || "",
473
+ mentioned_user: e.mentioned_user || null
474
+ }));
475
+ t.forEach((e) => l.add(e._msgId)), e.value = [...t, ...e.value];
476
+ }
477
+ } catch (e) {
478
+ console.warn("[useChat] Failed to load history:", e);
479
+ }
480
+ }, S = async (t) => {
481
+ if (e.value = [], l.clear(), t) try {
482
+ await X.delete(u, { params: { room_id: t } });
483
+ } catch (e) {
484
+ console.warn("[useChat] Failed to clear messages on server:", e);
485
+ }
486
+ }, w = () => {
487
+ a.value = !1;
488
+ }, T = () => {
489
+ if (d &&= (d(), null), o && s) {
490
+ try {
491
+ o.unobserve(s);
492
+ } catch {}
493
+ s = null;
494
+ }
495
+ o = null, c = null, l.clear();
496
+ };
497
+ return h(() => T()), {
498
+ messages: e,
499
+ loading: t,
500
+ isCollabMode: n,
501
+ collabUsers: r,
502
+ currentUser: i,
503
+ unreadMention: a,
504
+ setCollabContext: f,
505
+ setCurrentUser: p,
506
+ updateCollabUsers: m,
507
+ sendMessage: v,
508
+ sendAiMessage: y,
509
+ loadHistory: b,
510
+ clearMessages: S,
511
+ clearUnreadMention: w,
512
+ destroy: T
513
+ };
514
+ }
515
+ //#endregion
516
+ //#region ../../src/composables/useVersionHistory.js
517
+ var Re = "/api/document-versions", ze = 5e3, Be = () => {
518
+ let e = _([]), t = _(!1);
519
+ return {
520
+ versions: e,
521
+ loading: t,
522
+ saveVersion: async ({ documentId: e, docType: t, content: n, userId: r, userName: i }) => {
523
+ if (!e || !t || !n) return null;
524
+ try {
525
+ let { data: a } = await X.post(Re, {
526
+ document_id: e,
527
+ doc_type: t,
528
+ content: typeof n == "string" ? n : JSON.stringify(n),
529
+ user_id: r || null,
530
+ user_name: i || null
531
+ }, { timeout: ze });
532
+ return a;
533
+ } catch (e) {
534
+ return console.warn("[useVersionHistory] Failed to save version:", e), null;
535
+ }
536
+ },
537
+ loadVersions: async (n) => {
538
+ if (!n) return [];
539
+ t.value = !0;
540
+ try {
541
+ let { data: t } = await X.get(Re, {
542
+ params: { document_id: n },
543
+ timeout: ze
544
+ });
545
+ return e.value = t, t;
546
+ } catch (t) {
547
+ return console.warn("[useVersionHistory] Failed to load versions:", t), e.value = [], [];
548
+ } finally {
549
+ t.value = !1;
550
+ }
551
+ },
552
+ getVersionContent: async (e) => {
553
+ try {
554
+ let { data: t } = await X.get(`${Re}/${e}`, { timeout: ze });
555
+ return t;
556
+ } catch (e) {
557
+ return console.warn("[useVersionHistory] Failed to get version content:", e), null;
558
+ }
559
+ }
560
+ };
561
+ }, Ve = { class: "version-history-panel" }, He = {
562
+ key: 0,
563
+ class: "loading-state"
564
+ }, Ue = {
565
+ key: 1,
566
+ class: "empty-state"
567
+ }, We = {
568
+ key: 2,
569
+ class: "version-list"
570
+ }, Ge = {
571
+ key: 0,
572
+ class: "current-version"
573
+ }, Ke = { class: "current-version-header" }, qe = { class: "version-number" }, Je = ["onClick"], Ye = { class: "version-number" }, Xe = { class: "version-user" }, Ze = { class: "panel-footer" }, Qe = /*#__PURE__*/ Z({
574
+ __name: "VersionHistoryPanel",
575
+ props: {
576
+ modelValue: {
577
+ type: Boolean,
578
+ default: !1
579
+ },
580
+ documentId: {
581
+ type: [Number, String],
582
+ default: null
583
+ }
584
+ },
585
+ emits: ["update:modelValue", "apply"],
586
+ setup(t, { expose: c, emit: l }) {
587
+ let u = t, f = l, { versions: p, loading: m, loadVersions: h, getVersionContent: S } = Be(), T = _(!1), E = _(null), D = _(!1), O = _(null);
588
+ C(() => u.modelValue, (e) => {
589
+ T.value = e, e && u.documentId && (E.value = null, h(u.documentId).then((e) => {
590
+ e && e.length > 0 && (O.value = e[0]);
591
+ }));
592
+ }), C(T, (e) => {
593
+ f("update:modelValue", e);
594
+ });
595
+ let k = (e) => {
596
+ E.value = e;
597
+ }, A = async () => {
598
+ if (E.value) {
599
+ D.value = !0;
600
+ try {
601
+ let e = await S(E.value.id);
602
+ e && e.content ? (O.value = E.value, E.value = null, f("apply", e.content), j.success("已切换到版本 v" + O.value.version_number)) : j.error("获取版本内容失败");
603
+ } finally {
604
+ D.value = !1;
605
+ }
606
+ }
607
+ }, M = () => {
608
+ T.value = !1;
609
+ }, N = (e) => {
610
+ if (!e) return "";
611
+ let t = new Date(e), n = (e) => String(e).padStart(2, "0");
612
+ return `${t.getFullYear()}-${n(t.getMonth() + 1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
613
+ };
614
+ return c({ currentVersion: O }), (t, c) => {
615
+ let l = y("el-icon"), u = y("el-tag"), f = y("el-timeline-item"), h = y("el-timeline"), _ = y("el-button"), S = y("el-drawer");
616
+ return g(), n(S, {
617
+ modelValue: T.value,
618
+ "onUpdate:modelValue": c[0] ||= (e) => T.value = e,
619
+ title: "更新履历",
620
+ direction: "rtl",
621
+ size: "420px",
622
+ "before-close": M
623
+ }, {
624
+ footer: w(() => [a("div", Ze, [s(_, {
625
+ type: "primary",
626
+ disabled: !E.value,
627
+ loading: D.value,
628
+ onClick: A
629
+ }, {
630
+ default: w(() => [...c[4] ||= [o(" 切换到此版本 ", -1)]]),
631
+ _: 1
632
+ }, 8, ["disabled", "loading"])])]),
633
+ default: w(() => [a("div", Ve, [x(m) ? (g(), i("div", He, [s(l, { class: "is-loading" }, {
634
+ default: w(() => [s(x(ne))]),
635
+ _: 1
636
+ }), c[1] ||= a("span", null, "加载中...", -1)])) : x(p).length === 0 ? (g(), i("div", Ue, [s(l, {
637
+ size: 48,
638
+ color: "#c0c4cc"
639
+ }, {
640
+ default: w(() => [s(x(R))]),
641
+ _: 1
642
+ }), c[2] ||= a("p", null, "暂无历史版本", -1)])) : (g(), i("div", We, [O.value ? (g(), i("div", Ge, [a("div", Ke, [s(u, {
643
+ type: "success",
644
+ size: "small"
645
+ }, {
646
+ default: w(() => [...c[3] ||= [o("当前版本", -1)]]),
647
+ _: 1
648
+ }), a("span", qe, "v" + b(O.value.version_number), 1)])])) : r("", !0), s(h, null, {
649
+ default: w(() => [(g(!0), i(e, null, v(x(p), (e) => (g(), n(f, {
650
+ key: e.id,
651
+ timestamp: N(e.created_at),
652
+ placement: "top",
653
+ type: E.value?.id === e.id ? "primary" : "",
654
+ hollow: E.value?.id !== e.id
655
+ }, {
656
+ default: w(() => [a("div", {
657
+ class: d(["version-item", { active: E.value?.id === e.id }]),
658
+ onClick: (t) => k(e)
659
+ }, [a("span", Ye, "版本号:v" + b(e.version_number), 1), a("span", Xe, "提交人:" + b(e.user_name || "未知用户"), 1)], 10, Je)]),
660
+ _: 2
661
+ }, 1032, [
662
+ "timestamp",
663
+ "type",
664
+ "hollow"
665
+ ]))), 128))]),
666
+ _: 1
667
+ })]))])]),
668
+ _: 1
669
+ }, 8, ["modelValue"]);
670
+ };
671
+ }
672
+ }, [["__scopeId", "data-v-87924b7c"]]), $e = [
673
+ {
674
+ label: "默认",
675
+ value: "default",
676
+ config: {}
677
+ },
678
+ {
679
+ label: "海洋蓝",
680
+ value: "ocean",
681
+ config: {
682
+ lineColor: "#1E90FF",
683
+ backgroundColor: "#F0F8FF",
684
+ root: {
685
+ fillColor: "#1E90FF",
686
+ color: "#fff",
687
+ borderColor: "#1E90FF"
688
+ },
689
+ second: {
690
+ fillColor: "#E3F2FD",
691
+ color: "#1565C0",
692
+ borderColor: "#1E90FF"
693
+ },
694
+ node: { color: "#333" }
695
+ }
696
+ },
697
+ {
698
+ label: "深海",
699
+ value: "deepSea",
700
+ config: {
701
+ lineColor: "#003366",
702
+ backgroundColor: "#E6F3FF",
703
+ root: {
704
+ fillColor: "#003366",
705
+ color: "#fff",
706
+ borderColor: "#003366"
707
+ },
708
+ second: {
709
+ fillColor: "#E3F2FD",
710
+ color: "#0D47A1",
711
+ borderColor: "#006994"
712
+ },
713
+ node: { color: "#333" }
714
+ }
715
+ },
716
+ {
717
+ label: "珊瑚红",
718
+ value: "coral",
719
+ config: {
720
+ lineColor: "#FF7F50",
721
+ backgroundColor: "#FFF5F5",
722
+ root: {
723
+ fillColor: "#FF7F50",
724
+ color: "#fff",
725
+ borderColor: "#FF7F50"
726
+ },
727
+ second: {
728
+ fillColor: "#FFEBEE",
729
+ color: "#C62828",
730
+ borderColor: "#FF6B6B"
731
+ },
732
+ node: { color: "#333" }
733
+ }
734
+ },
735
+ {
736
+ label: "薄荷绿",
737
+ value: "mint",
738
+ config: {
739
+ lineColor: "#3EB489",
740
+ backgroundColor: "#F0FFF0",
741
+ root: {
742
+ fillColor: "#3EB489",
743
+ color: "#fff",
744
+ borderColor: "#3EB489"
745
+ },
746
+ second: {
747
+ fillColor: "#E8F5E9",
748
+ color: "#1B5E20",
749
+ borderColor: "#3EB489"
750
+ },
751
+ node: { color: "#333" }
752
+ }
753
+ },
754
+ {
755
+ label: "日落橙",
756
+ value: "sunset",
757
+ config: {
758
+ lineColor: "#FF6B35",
759
+ backgroundColor: "#FFF8F0",
760
+ root: {
761
+ fillColor: "#FF6B35",
762
+ color: "#fff",
763
+ borderColor: "#FF6B35"
764
+ },
765
+ second: {
766
+ fillColor: "#FFF3E0",
767
+ color: "#E65100",
768
+ borderColor: "#F7931E"
769
+ },
770
+ node: { color: "#333" }
771
+ }
772
+ },
773
+ {
774
+ label: "晨曦金",
775
+ value: "dawn",
776
+ config: {
777
+ lineColor: "#FFB347",
778
+ backgroundColor: "#FFFAF0",
779
+ root: {
780
+ fillColor: "#FFB347",
781
+ color: "#fff",
782
+ borderColor: "#FFB347"
783
+ },
784
+ second: {
785
+ fillColor: "#FFFDE7",
786
+ color: "#F57F17",
787
+ borderColor: "#FFCC33"
788
+ },
789
+ node: { color: "#333" }
790
+ }
791
+ },
792
+ {
793
+ label: "秋棕",
794
+ value: "autumn",
795
+ config: {
796
+ lineColor: "#D2691E",
797
+ backgroundColor: "#FFF8DC",
798
+ root: {
799
+ fillColor: "#D2691E",
800
+ color: "#fff",
801
+ borderColor: "#D2691E"
802
+ },
803
+ second: {
804
+ fillColor: "#EFEBE9",
805
+ color: "#4E342E",
806
+ borderColor: "#CD853F"
807
+ },
808
+ node: { color: "#333" }
809
+ }
810
+ },
811
+ {
812
+ label: "琥珀",
813
+ value: "amber",
814
+ config: {
815
+ lineColor: "#FFBF00",
816
+ backgroundColor: "#FFFFF0",
817
+ root: {
818
+ fillColor: "#FFBF00",
819
+ color: "#333",
820
+ borderColor: "#FFBF00"
821
+ },
822
+ second: {
823
+ fillColor: "#FFFDE7",
824
+ color: "#F57F17",
825
+ borderColor: "#FFD700"
826
+ },
827
+ node: { color: "#333" }
828
+ }
829
+ },
830
+ {
831
+ label: "森林绿",
832
+ value: "forest",
833
+ config: {
834
+ lineColor: "#228B22",
835
+ backgroundColor: "#F0FFF0",
836
+ root: {
837
+ fillColor: "#228B22",
838
+ color: "#fff",
839
+ borderColor: "#228B22"
840
+ },
841
+ second: {
842
+ fillColor: "#E8F5E9",
843
+ color: "#1B5E20",
844
+ borderColor: "#32CD32"
845
+ },
846
+ node: { color: "#333" }
847
+ }
848
+ },
849
+ {
850
+ label: "翡翠",
851
+ value: "emerald",
852
+ config: {
853
+ lineColor: "#50C878",
854
+ backgroundColor: "#F5FFFA",
855
+ root: {
856
+ fillColor: "#50C878",
857
+ color: "#fff",
858
+ borderColor: "#50C878"
859
+ },
860
+ second: {
861
+ fillColor: "#E8F5E9",
862
+ color: "#2E7D32",
863
+ borderColor: "#98FB98"
864
+ },
865
+ node: { color: "#333" }
866
+ }
867
+ },
868
+ {
869
+ label: "橄榄",
870
+ value: "olive",
871
+ config: {
872
+ lineColor: "#808000",
873
+ backgroundColor: "#FAFAD2",
874
+ root: {
875
+ fillColor: "#808000",
876
+ color: "#fff",
877
+ borderColor: "#808000"
878
+ },
879
+ second: {
880
+ fillColor: "#F1F8E9",
881
+ color: "#33691E",
882
+ borderColor: "#9ACD32"
883
+ },
884
+ node: { color: "#333" }
885
+ }
886
+ },
887
+ {
888
+ label: "紫罗兰",
889
+ value: "violet",
890
+ config: {
891
+ lineColor: "#8A2BE2",
892
+ backgroundColor: "#F8F0FF",
893
+ root: {
894
+ fillColor: "#8A2BE2",
895
+ color: "#fff",
896
+ borderColor: "#8A2BE2"
897
+ },
898
+ second: {
899
+ fillColor: "#F3E5F5",
900
+ color: "#6A1B9A",
901
+ borderColor: "#9370DB"
902
+ },
903
+ node: { color: "#333" }
904
+ }
905
+ },
906
+ {
907
+ label: "薰衣草",
908
+ value: "lavender",
909
+ config: {
910
+ lineColor: "#9C27B0",
911
+ backgroundColor: "#FAF0FF",
912
+ root: {
913
+ fillColor: "#9C27B0",
914
+ color: "#fff",
915
+ borderColor: "#9C27B0"
916
+ },
917
+ second: {
918
+ fillColor: "#F3E5F5",
919
+ color: "#7B1FA2",
920
+ borderColor: "#CE93D8"
921
+ },
922
+ node: { color: "#333" }
923
+ }
924
+ },
925
+ {
926
+ label: "李子紫",
927
+ value: "plum",
928
+ config: {
929
+ lineColor: "#8E4585",
930
+ backgroundColor: "#FFF0F5",
931
+ root: {
932
+ fillColor: "#8E4585",
933
+ color: "#fff",
934
+ borderColor: "#8E4585"
935
+ },
936
+ second: {
937
+ fillColor: "#FCE4EC",
938
+ color: "#AD1457",
939
+ borderColor: "#DDA0DD"
940
+ },
941
+ node: { color: "#333" }
942
+ }
943
+ },
944
+ {
945
+ label: "兰花粉",
946
+ value: "orchid",
947
+ config: {
948
+ lineColor: "#DA70D6",
949
+ backgroundColor: "#FFF0FF",
950
+ root: {
951
+ fillColor: "#DA70D6",
952
+ color: "#fff",
953
+ borderColor: "#DA70D6"
954
+ },
955
+ second: {
956
+ fillColor: "#F3E5F5",
957
+ color: "#C2185B",
958
+ borderColor: "#EE82EE"
959
+ },
960
+ node: { color: "#333" }
961
+ }
962
+ },
963
+ {
964
+ label: "现代灰",
965
+ value: "modern",
966
+ config: {
967
+ lineColor: "#333333",
968
+ backgroundColor: "#FAFAFA",
969
+ root: {
970
+ fillColor: "#333333",
971
+ color: "#fff",
972
+ borderColor: "#333333"
973
+ },
974
+ second: {
975
+ fillColor: "#F5F5F5",
976
+ color: "#212121",
977
+ borderColor: "#555555"
978
+ },
979
+ node: { color: "#333" }
980
+ }
981
+ },
982
+ {
983
+ label: "极简",
984
+ value: "minimal",
985
+ config: {
986
+ lineColor: "#2C3E50",
987
+ backgroundColor: "#ECF0F1",
988
+ root: {
989
+ fillColor: "#2C3E50",
990
+ color: "#fff",
991
+ borderColor: "#2C3E50"
992
+ },
993
+ second: {
994
+ fillColor: "#ECEFF1",
995
+ color: "#263238",
996
+ borderColor: "#34495E"
997
+ },
998
+ node: { color: "#333" }
999
+ }
1000
+ },
1001
+ {
1002
+ label: "商务蓝",
1003
+ value: "corporate",
1004
+ config: {
1005
+ lineColor: "#2C3E50",
1006
+ backgroundColor: "#F5F6FA",
1007
+ root: {
1008
+ fillColor: "#2C3E50",
1009
+ color: "#fff",
1010
+ borderColor: "#2C3E50"
1011
+ },
1012
+ second: {
1013
+ fillColor: "#E3F2FD",
1014
+ color: "#1565C0",
1015
+ borderColor: "#3498DB"
1016
+ },
1017
+ node: { color: "#333" }
1018
+ }
1019
+ },
1020
+ {
1021
+ label: "科技蓝",
1022
+ value: "tech",
1023
+ config: {
1024
+ lineColor: "#00D4FF",
1025
+ backgroundColor: "#F0F8FF",
1026
+ root: {
1027
+ fillColor: "#00D4FF",
1028
+ color: "#fff",
1029
+ borderColor: "#00D4FF"
1030
+ },
1031
+ second: {
1032
+ fillColor: "#E0F7FA",
1033
+ color: "#006064",
1034
+ borderColor: "#7B2FBE"
1035
+ },
1036
+ node: { color: "#333" }
1037
+ }
1038
+ },
1039
+ {
1040
+ label: "霓虹",
1041
+ value: "neon",
1042
+ config: {
1043
+ lineColor: "#00FF88",
1044
+ backgroundColor: "#1A1A2E",
1045
+ root: {
1046
+ fillColor: "#00FF88",
1047
+ color: "#1A1A2E",
1048
+ borderColor: "#00FF88"
1049
+ },
1050
+ second: {
1051
+ fillColor: "#16213E",
1052
+ color: "#00FF88",
1053
+ borderColor: "#FF00FF"
1054
+ },
1055
+ node: { color: "#ccc" }
1056
+ }
1057
+ },
1058
+ {
1059
+ label: "樱花粉",
1060
+ value: "sakura",
1061
+ config: {
1062
+ lineColor: "#FFB7C5",
1063
+ backgroundColor: "#FFF5F5",
1064
+ root: {
1065
+ fillColor: "#FFB7C5",
1066
+ color: "#fff",
1067
+ borderColor: "#FFB7C5"
1068
+ },
1069
+ second: {
1070
+ fillColor: "#FFF0F5",
1071
+ color: "#C2185B",
1072
+ borderColor: "#FF69B4"
1073
+ },
1074
+ node: { color: "#333" }
1075
+ }
1076
+ },
1077
+ {
1078
+ label: "蜜桃",
1079
+ value: "peach",
1080
+ config: {
1081
+ lineColor: "#FFDAB9",
1082
+ backgroundColor: "#FFFAF0",
1083
+ root: {
1084
+ fillColor: "#FFA07A",
1085
+ color: "#fff",
1086
+ borderColor: "#FFA07A"
1087
+ },
1088
+ second: {
1089
+ fillColor: "#FFF3E0",
1090
+ color: "#E65100",
1091
+ borderColor: "#FFDAB9"
1092
+ },
1093
+ node: { color: "#333" }
1094
+ }
1095
+ },
1096
+ {
1097
+ label: "暗夜",
1098
+ value: "dark",
1099
+ config: {
1100
+ lineColor: "#4FC3F7",
1101
+ backgroundColor: "#1a1a2e",
1102
+ root: {
1103
+ fillColor: "#4FC3F7",
1104
+ color: "#1a1a2e",
1105
+ borderColor: "#4FC3F7"
1106
+ },
1107
+ second: {
1108
+ fillColor: "#2d2d44",
1109
+ color: "#E0E0E0",
1110
+ borderColor: "#4FC3F7"
1111
+ },
1112
+ node: { color: "#B0B0B0" }
1113
+ }
1114
+ },
1115
+ {
1116
+ label: "抹茶",
1117
+ value: "matcha",
1118
+ config: {
1119
+ lineColor: "#6B8E23",
1120
+ backgroundColor: "#F5F5DC",
1121
+ root: {
1122
+ fillColor: "#6B8E23",
1123
+ color: "#fff",
1124
+ borderColor: "#6B8E23"
1125
+ },
1126
+ second: {
1127
+ fillColor: "#F1F8E9",
1128
+ color: "#33691E",
1129
+ borderColor: "#8BC34A"
1130
+ },
1131
+ node: { color: "#333" }
1132
+ }
1133
+ },
1134
+ {
1135
+ label: "玫瑰金",
1136
+ value: "roseGold",
1137
+ config: {
1138
+ lineColor: "#B76E79",
1139
+ backgroundColor: "#FFF5F5",
1140
+ root: {
1141
+ fillColor: "#B76E79",
1142
+ color: "#fff",
1143
+ borderColor: "#B76E79"
1144
+ },
1145
+ second: {
1146
+ fillColor: "#FCE4EC",
1147
+ color: "#880E4F",
1148
+ borderColor: "#E8A0B0"
1149
+ },
1150
+ node: { color: "#333" }
1151
+ }
1152
+ },
1153
+ {
1154
+ label: "克莱因蓝",
1155
+ value: "kleinBlue",
1156
+ config: {
1157
+ lineColor: "#002FA7",
1158
+ backgroundColor: "#F0F4FF",
1159
+ root: {
1160
+ fillColor: "#002FA7",
1161
+ color: "#fff",
1162
+ borderColor: "#002FA7"
1163
+ },
1164
+ second: {
1165
+ fillColor: "#E8EAF6",
1166
+ color: "#1A237E",
1167
+ borderColor: "#3F51B5"
1168
+ },
1169
+ node: { color: "#333" }
1170
+ }
1171
+ },
1172
+ {
1173
+ label: "大地棕",
1174
+ value: "earth",
1175
+ config: {
1176
+ lineColor: "#8B4513",
1177
+ backgroundColor: "#FAF0E6",
1178
+ root: {
1179
+ fillColor: "#8B4513",
1180
+ color: "#fff",
1181
+ borderColor: "#8B4513"
1182
+ },
1183
+ second: {
1184
+ fillColor: "#EFEBE9",
1185
+ color: "#3E2723",
1186
+ borderColor: "#A0522D"
1187
+ },
1188
+ node: { color: "#333" }
1189
+ }
1190
+ },
1191
+ {
1192
+ label: "天空蓝",
1193
+ value: "skyBlue",
1194
+ config: {
1195
+ lineColor: "#87CEEB",
1196
+ backgroundColor: "#E8F4FD",
1197
+ root: {
1198
+ fillColor: "#42A5F5",
1199
+ color: "#fff",
1200
+ borderColor: "#42A5F5"
1201
+ },
1202
+ second: {
1203
+ fillColor: "#E3F2FD",
1204
+ color: "#1565C0",
1205
+ borderColor: "#90CAF9"
1206
+ },
1207
+ node: { color: "#333" }
1208
+ }
1209
+ }
1210
+ ], et = { class: "toolbar-left" }, tt = { class: "toolbar-center" }, nt = { class: "option-list" }, rt = ["onClick"], it = { class: "theme-picker" }, at = { class: "theme-header" }, ot = { class: "theme-count" }, st = { class: "theme-grid" }, ct = ["onClick", "title"], lt = { class: "theme-name" }, ut = { class: "zoom-value" }, dt = { class: "toolbar-right" }, ft = {
1211
+ key: 0,
1212
+ class: "collab-users"
1213
+ }, pt = ["title"], mt = {
1214
+ key: 0,
1215
+ class: "collab-more"
1216
+ }, ht = /*#__PURE__*/ Z({
1217
+ __name: "MindMapToolbar",
1218
+ props: {
1219
+ undoCount: {
1220
+ type: Number,
1221
+ default: 0
1222
+ },
1223
+ redoCount: {
1224
+ type: Number,
1225
+ default: 0
1226
+ },
1227
+ currentLayout: {
1228
+ type: String,
1229
+ default: "mindMap"
1230
+ },
1231
+ currentTheme: {
1232
+ type: String,
1233
+ default: "default"
1234
+ },
1235
+ zoomPercent: {
1236
+ type: Number,
1237
+ default: 100
1238
+ },
1239
+ autoFit: {
1240
+ type: Boolean,
1241
+ default: !0
1242
+ },
1243
+ isCollaborating: {
1244
+ type: Boolean,
1245
+ default: !1
1246
+ },
1247
+ isCollabOwner: {
1248
+ type: Boolean,
1249
+ default: !1
1250
+ },
1251
+ collabUsers: {
1252
+ type: Array,
1253
+ default: () => []
1254
+ },
1255
+ modelTitle: {
1256
+ type: String,
1257
+ default: ""
1258
+ },
1259
+ modelAuthor: {
1260
+ type: String,
1261
+ default: ""
1262
+ },
1263
+ isRootNode: {
1264
+ type: Boolean,
1265
+ default: !1
1266
+ },
1267
+ showHistory: {
1268
+ type: Boolean,
1269
+ default: !1
1270
+ }
1271
+ },
1272
+ emits: [
1273
+ "back",
1274
+ "undo",
1275
+ "redo",
1276
+ "insert-child",
1277
+ "insert-sibling",
1278
+ "reverse-layout",
1279
+ "delete-node",
1280
+ "change-layout",
1281
+ "change-theme",
1282
+ "zoom-in",
1283
+ "zoom-out",
1284
+ "fit-view",
1285
+ "toggle-auto-fit",
1286
+ "reset-view",
1287
+ "export",
1288
+ "save",
1289
+ "toggle-collab",
1290
+ "share-collab",
1291
+ "update:title",
1292
+ "update:author",
1293
+ "ai-generate",
1294
+ "history"
1295
+ ],
1296
+ setup(t, { emit: c }) {
1297
+ let l = (e) => {
1298
+ e.target.closest("input, textarea, .el-input, .el-select") || e.preventDefault();
1299
+ }, u = t, p = c, m = _(u.modelTitle), h = _(u.modelAuthor);
1300
+ C(m, (e) => p("update:title", e)), C(h, (e) => p("update:author", e)), C(() => u.modelTitle, (e) => {
1301
+ m.value = e;
1302
+ }), C(() => u.modelAuthor, (e) => {
1303
+ h.value = e;
1304
+ });
1305
+ let S = _(!1), T = _(""), E = () => {
1306
+ T.value.trim() && (p("ai-generate", T.value.trim()), S.value = !1, T.value = "");
1307
+ }, O = [
1308
+ {
1309
+ label: "思维导图",
1310
+ value: "mindMap"
1311
+ },
1312
+ {
1313
+ label: "逻辑结构图",
1314
+ value: "logicalStructure"
1315
+ },
1316
+ {
1317
+ label: "向左逻辑结构图",
1318
+ value: "logicalStructureLeft"
1319
+ },
1320
+ {
1321
+ label: "组织结构图",
1322
+ value: "organizationStructure"
1323
+ },
1324
+ {
1325
+ label: "目录组织图",
1326
+ value: "catalogOrganization"
1327
+ },
1328
+ {
1329
+ label: "时间轴(右)",
1330
+ value: "timeline"
1331
+ },
1332
+ {
1333
+ label: "时间轴(下)",
1334
+ value: "timeline2"
1335
+ },
1336
+ {
1337
+ label: "竖向时间轴",
1338
+ value: "verticalTimeline"
1339
+ },
1340
+ {
1341
+ label: "竖向时间轴2",
1342
+ value: "verticalTimeline2"
1343
+ },
1344
+ {
1345
+ label: "竖向时间轴3",
1346
+ value: "verticalTimeline3"
1347
+ },
1348
+ {
1349
+ label: "鱼骨图",
1350
+ value: "fishbone"
1351
+ },
1352
+ {
1353
+ label: "鱼骨图2",
1354
+ value: "fishbone2"
1355
+ }
1356
+ ], k = $e;
1357
+ return (c, u) => {
1358
+ let p = y("el-icon"), _ = y("el-button"), C = y("el-input"), A = y("el-divider"), j = y("el-popover"), M = y("el-dropdown-item"), F = y("el-dropdown-menu"), R = y("el-dropdown"), z = y("Clock"), U = y("el-dialog");
1359
+ return g(), i(e, null, [a("div", {
1360
+ class: "mindmap-toolbar",
1361
+ onMousedown: l
1362
+ }, [
1363
+ a("div", et, [
1364
+ s(_, {
1365
+ size: "small",
1366
+ circle: "",
1367
+ onClick: u[0] ||= (e) => c.$emit("back"),
1368
+ title: "返回"
1369
+ }, {
1370
+ default: w(() => [s(p, null, {
1371
+ default: w(() => [s(x(P))]),
1372
+ _: 1
1373
+ })]),
1374
+ _: 1
1375
+ }),
1376
+ s(C, {
1377
+ modelValue: m.value,
1378
+ "onUpdate:modelValue": u[1] ||= (e) => m.value = e,
1379
+ class: "title-input",
1380
+ placeholder: "思维导图标题 *",
1381
+ size: "small",
1382
+ style: { width: "200px" },
1383
+ disabled: t.isCollaborating && !t.isCollabOwner,
1384
+ required: ""
1385
+ }, null, 8, ["modelValue", "disabled"]),
1386
+ s(C, {
1387
+ modelValue: h.value,
1388
+ "onUpdate:modelValue": u[2] ||= (e) => h.value = e,
1389
+ class: "author-input",
1390
+ placeholder: "作者 *",
1391
+ size: "small",
1392
+ style: { width: "120px" },
1393
+ required: ""
1394
+ }, null, 8, ["modelValue"])
1395
+ ]),
1396
+ a("div", tt, [
1397
+ s(_, {
1398
+ size: "small",
1399
+ circle: "",
1400
+ onClick: u[3] ||= (e) => c.$emit("undo"),
1401
+ disabled: t.undoCount <= 0,
1402
+ title: "撤销"
1403
+ }, {
1404
+ default: w(() => [s(p, null, {
1405
+ default: w(() => [s(x(se))]),
1406
+ _: 1
1407
+ })]),
1408
+ _: 1
1409
+ }, 8, ["disabled"]),
1410
+ s(_, {
1411
+ size: "small",
1412
+ circle: "",
1413
+ onClick: u[4] ||= (e) => c.$emit("redo"),
1414
+ disabled: t.redoCount <= 0,
1415
+ title: "重做"
1416
+ }, {
1417
+ default: w(() => [s(p, null, {
1418
+ default: w(() => [s(x(ce))]),
1419
+ _: 1
1420
+ })]),
1421
+ _: 1
1422
+ }, 8, ["disabled"]),
1423
+ s(A, { direction: "vertical" }),
1424
+ s(_, {
1425
+ size: "small",
1426
+ circle: "",
1427
+ onClick: u[5] ||= (e) => S.value = !0,
1428
+ title: "AI生成"
1429
+ }, {
1430
+ default: w(() => [...u[24] ||= [a("svg", {
1431
+ viewBox: "0 0 24 24",
1432
+ width: "14",
1433
+ height: "14",
1434
+ fill: "none",
1435
+ stroke: "currentColor",
1436
+ "stroke-width": "2"
1437
+ }, [a("path", { d: "M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" })], -1)]]),
1438
+ _: 1
1439
+ }),
1440
+ s(_, {
1441
+ size: "small",
1442
+ circle: "",
1443
+ onClick: u[6] ||= (e) => c.$emit("insert-child"),
1444
+ title: "插入子节点"
1445
+ }, {
1446
+ default: w(() => [s(p, null, {
1447
+ default: w(() => [s(x(ie))]),
1448
+ _: 1
1449
+ })]),
1450
+ _: 1
1451
+ }),
1452
+ s(_, {
1453
+ size: "small",
1454
+ circle: "",
1455
+ onClick: u[7] ||= (e) => c.$emit("insert-sibling"),
1456
+ title: "插入同级节点",
1457
+ disabled: t.isRootNode
1458
+ }, {
1459
+ default: w(() => [s(p, null, {
1460
+ default: w(() => [s(x(B))]),
1461
+ _: 1
1462
+ })]),
1463
+ _: 1
1464
+ }, 8, ["disabled"]),
1465
+ s(_, {
1466
+ size: "small",
1467
+ circle: "",
1468
+ onClick: u[8] ||= (e) => c.$emit("reverse-layout"),
1469
+ title: "反转方向",
1470
+ disabled: t.isCollaborating && !t.isCollabOwner
1471
+ }, {
1472
+ default: w(() => [s(p, null, {
1473
+ default: w(() => [s(x(ue))]),
1474
+ _: 1
1475
+ })]),
1476
+ _: 1
1477
+ }, 8, ["disabled"]),
1478
+ s(_, {
1479
+ size: "small",
1480
+ circle: "",
1481
+ onClick: u[9] ||= (e) => c.$emit("delete-node"),
1482
+ title: "删除节点"
1483
+ }, {
1484
+ default: w(() => [s(p, null, {
1485
+ default: w(() => [s(x(V))]),
1486
+ _: 1
1487
+ })]),
1488
+ _: 1
1489
+ }),
1490
+ s(A, { direction: "vertical" }),
1491
+ s(j, {
1492
+ trigger: "click",
1493
+ width: "220",
1494
+ placement: "bottom-start"
1495
+ }, {
1496
+ reference: w(() => [s(_, {
1497
+ size: "small",
1498
+ circle: "",
1499
+ title: "布局类型",
1500
+ disabled: t.isCollaborating && !t.isCollabOwner
1501
+ }, {
1502
+ default: w(() => [s(p, null, {
1503
+ default: w(() => [s(x(q))]),
1504
+ _: 1
1505
+ })]),
1506
+ _: 1
1507
+ }, 8, ["disabled"])]),
1508
+ default: w(() => [a("div", nt, [(g(), i(e, null, v(O, (e) => a("div", {
1509
+ key: e.value,
1510
+ class: d(["option-item", { active: t.currentLayout === e.value }]),
1511
+ onClick: (t) => c.$emit("change-layout", e.value)
1512
+ }, b(e.label), 11, rt)), 64))])]),
1513
+ _: 1
1514
+ }),
1515
+ s(j, {
1516
+ trigger: "click",
1517
+ width: "380",
1518
+ placement: "bottom-end"
1519
+ }, {
1520
+ reference: w(() => [s(_, {
1521
+ size: "small",
1522
+ circle: "",
1523
+ title: "主题",
1524
+ disabled: t.isCollaborating && !t.isCollabOwner
1525
+ }, {
1526
+ default: w(() => [s(p, null, {
1527
+ default: w(() => [s(x(I))]),
1528
+ _: 1
1529
+ })]),
1530
+ _: 1
1531
+ }, 8, ["disabled"])]),
1532
+ default: w(() => [a("div", it, [a("div", at, [u[25] ||= a("h4", null, "选择主题", -1), a("span", ot, b(x(k).length) + " 种配色", 1)]), a("div", st, [(g(!0), i(e, null, v(x(k), (e) => (g(), i("div", {
1533
+ key: e.value,
1534
+ class: d(["theme-item", { active: t.currentTheme === e.value }]),
1535
+ onClick: (t) => c.$emit("change-theme", e.value),
1536
+ onMousedown: u[10] ||= D(() => {}, ["prevent"]),
1537
+ title: e.label
1538
+ }, [a("div", {
1539
+ class: "theme-preview",
1540
+ style: f({ background: e.config?.backgroundColor || "#fff" })
1541
+ }, [a("div", {
1542
+ class: "theme-line",
1543
+ style: f({ background: e.config?.root?.fillColor || "#549688" })
1544
+ }, null, 4)], 4), a("span", lt, b(e.label), 1)], 42, ct))), 128))])])]),
1545
+ _: 1
1546
+ }),
1547
+ s(A, { direction: "vertical" }),
1548
+ s(_, {
1549
+ size: "small",
1550
+ circle: "",
1551
+ onClick: u[11] ||= (e) => c.$emit("zoom-in"),
1552
+ title: "放大"
1553
+ }, {
1554
+ default: w(() => [s(p, null, {
1555
+ default: w(() => [s(x(de))]),
1556
+ _: 1
1557
+ })]),
1558
+ _: 1
1559
+ }),
1560
+ a("span", ut, b(t.zoomPercent) + "%", 1),
1561
+ s(_, {
1562
+ size: "small",
1563
+ circle: "",
1564
+ onClick: u[12] ||= (e) => c.$emit("zoom-out"),
1565
+ title: "缩小"
1566
+ }, {
1567
+ default: w(() => [s(p, null, {
1568
+ default: w(() => [s(x(fe))]),
1569
+ _: 1
1570
+ })]),
1571
+ _: 1
1572
+ }),
1573
+ s(_, {
1574
+ size: "small",
1575
+ circle: "",
1576
+ onClick: u[13] ||= (e) => c.$emit("fit-view"),
1577
+ title: "适应画布"
1578
+ }, {
1579
+ default: w(() => [s(p, null, {
1580
+ default: w(() => [s(x(K))]),
1581
+ _: 1
1582
+ })]),
1583
+ _: 1
1584
+ }),
1585
+ s(_, {
1586
+ size: "small",
1587
+ circle: "",
1588
+ type: t.autoFit ? "primary" : "default",
1589
+ onClick: u[14] ||= (e) => c.$emit("toggle-auto-fit"),
1590
+ title: "自动适应画布"
1591
+ }, {
1592
+ default: w(() => [s(p, null, {
1593
+ default: w(() => [s(x(N))]),
1594
+ _: 1
1595
+ })]),
1596
+ _: 1
1597
+ }, 8, ["type"]),
1598
+ s(_, {
1599
+ size: "small",
1600
+ circle: "",
1601
+ onClick: u[15] ||= (e) => c.$emit("reset-view"),
1602
+ title: "复位",
1603
+ disabled: t.isCollaborating && !t.isCollabOwner
1604
+ }, {
1605
+ default: w(() => [s(p, null, {
1606
+ default: w(() => [s(x(oe))]),
1607
+ _: 1
1608
+ })]),
1609
+ _: 1
1610
+ }, 8, ["disabled"])
1611
+ ]),
1612
+ a("div", dt, [
1613
+ t.collabUsers.length > 0 ? (g(), i("div", ft, [(g(!0), i(e, null, v(t.collabUsers.slice(0, 5), (e) => (g(), i("div", {
1614
+ key: e.clientId,
1615
+ class: "collab-avatar",
1616
+ style: f({ background: e.color }),
1617
+ title: e.name
1618
+ }, b(e.name?.charAt(0)), 13, pt))), 128)), t.collabUsers.length > 5 ? (g(), i("span", mt, "+" + b(t.collabUsers.length - 5), 1)) : r("", !0)])) : r("", !0),
1619
+ !t.isCollaborating || t.isCollabOwner ? (g(), n(_, {
1620
+ key: 1,
1621
+ size: "small",
1622
+ type: t.isCollaborating ? "success" : "default",
1623
+ onClick: u[16] ||= (e) => c.$emit("toggle-collab"),
1624
+ title: "协作"
1625
+ }, {
1626
+ default: w(() => [s(p, null, {
1627
+ default: w(() => [s(x(le))]),
1628
+ _: 1
1629
+ }), a("span", null, b(t.isCollaborating ? "协作中" : "协作"), 1)]),
1630
+ _: 1
1631
+ }, 8, ["type"])) : r("", !0),
1632
+ !t.isCollaborating || t.isCollabOwner ? (g(), n(_, {
1633
+ key: 2,
1634
+ size: "small",
1635
+ circle: "",
1636
+ onClick: u[17] ||= (e) => c.$emit("share-collab"),
1637
+ title: "分享链接"
1638
+ }, {
1639
+ default: w(() => [s(p, null, {
1640
+ default: w(() => [s(x(te))]),
1641
+ _: 1
1642
+ })]),
1643
+ _: 1
1644
+ })) : r("", !0),
1645
+ s(R, {
1646
+ trigger: "click",
1647
+ onCommand: u[18] ||= (e) => c.$emit("export", e)
1648
+ }, {
1649
+ dropdown: w(() => [s(F, null, {
1650
+ default: w(() => [
1651
+ s(M, { command: "png" }, {
1652
+ default: w(() => [s(p, null, {
1653
+ default: w(() => [s(x(re))]),
1654
+ _: 1
1655
+ }), u[27] ||= o("导出 PNG ", -1)]),
1656
+ _: 1
1657
+ }),
1658
+ s(M, { command: "svg" }, {
1659
+ default: w(() => [s(p, null, {
1660
+ default: w(() => [s(x(H))]),
1661
+ _: 1
1662
+ }), u[28] ||= o("导出 SVG ", -1)]),
1663
+ _: 1
1664
+ }),
1665
+ s(M, { command: "pdf" }, {
1666
+ default: w(() => [s(p, null, {
1667
+ default: w(() => [s(x(H))]),
1668
+ _: 1
1669
+ }), u[29] ||= o("导出 PDF ", -1)]),
1670
+ _: 1
1671
+ })
1672
+ ]),
1673
+ _: 1
1674
+ })]),
1675
+ default: w(() => [s(_, {
1676
+ size: "small",
1677
+ type: "warning"
1678
+ }, {
1679
+ default: w(() => [s(p, null, {
1680
+ default: w(() => [s(x(W))]),
1681
+ _: 1
1682
+ }), u[26] ||= a("span", null, "导出", -1)]),
1683
+ _: 1
1684
+ })]),
1685
+ _: 1
1686
+ }),
1687
+ s(_, {
1688
+ size: "small",
1689
+ onClick: u[19] ||= (e) => c.$emit("save"),
1690
+ type: "primary"
1691
+ }, {
1692
+ default: w(() => [s(p, null, {
1693
+ default: w(() => [s(x(L))]),
1694
+ _: 1
1695
+ }), u[30] ||= a("span", null, "保存", -1)]),
1696
+ _: 1
1697
+ }),
1698
+ t.showHistory ? (g(), n(_, {
1699
+ key: 3,
1700
+ size: "small",
1701
+ circle: "",
1702
+ title: "更新履历",
1703
+ onClick: u[20] ||= (e) => c.$emit("history")
1704
+ }, {
1705
+ default: w(() => [s(p, null, {
1706
+ default: w(() => [s(z)]),
1707
+ _: 1
1708
+ })]),
1709
+ _: 1
1710
+ })) : r("", !0)
1711
+ ])
1712
+ ], 32), s(U, {
1713
+ modelValue: S.value,
1714
+ "onUpdate:modelValue": u[23] ||= (e) => S.value = e,
1715
+ title: "AI生成思维导图",
1716
+ width: "70vw",
1717
+ top: "50px",
1718
+ center: "",
1719
+ class: "ai-dialog"
1720
+ }, {
1721
+ footer: w(() => [s(_, { onClick: u[22] ||= (e) => S.value = !1 }, {
1722
+ default: w(() => [...u[31] ||= [o("取消", -1)]]),
1723
+ _: 1
1724
+ }), s(_, {
1725
+ type: "primary",
1726
+ onClick: E
1727
+ }, {
1728
+ default: w(() => [...u[32] ||= [o("生成", -1)]]),
1729
+ _: 1
1730
+ })]),
1731
+ default: w(() => [s(C, {
1732
+ modelValue: T.value,
1733
+ "onUpdate:modelValue": u[21] ||= (e) => T.value = e,
1734
+ type: "textarea",
1735
+ autosize: {
1736
+ minRows: 27,
1737
+ maxRows: 27
1738
+ },
1739
+ placeholder: "请输入提示词,描述你想要生成的思维导图...",
1740
+ class: "ai-textarea"
1741
+ }, null, 8, ["modelValue"])]),
1742
+ _: 1
1743
+ }, 8, ["modelValue"])], 64);
1744
+ };
1745
+ }
1746
+ }, [["__scopeId", "data-v-47a9ddfc"]]), gt = { class: "mindmap-property-panel" }, _t = { class: "panel-header" }, vt = {
1747
+ key: 0,
1748
+ class: "panel-content"
1749
+ }, yt = { class: "section" }, bt = { class: "section" }, xt = { class: "setting-row" }, St = { class: "setting-row" }, Ct = { class: "setting-row" }, wt = { class: "setting-row" }, Tt = { class: "setting-row" }, Et = { class: "section" }, Dt = { class: "section" }, Ot = { class: "tags-list" }, kt = { class: "tag-input-row" }, At = { class: "section" }, jt = {
1750
+ key: 1,
1751
+ class: "panel-empty"
1752
+ }, Mt = /*#__PURE__*/ Z({
1753
+ __name: "MindMapPropertyPanel",
1754
+ props: {
1755
+ visible: {
1756
+ type: Boolean,
1757
+ default: !0
1758
+ },
1759
+ node: {
1760
+ type: Object,
1761
+ default: null
1762
+ }
1763
+ },
1764
+ emits: [
1765
+ "close",
1766
+ "update-text",
1767
+ "update-style",
1768
+ "update-note",
1769
+ "update-tags",
1770
+ "update-hyperlink"
1771
+ ],
1772
+ setup(t, { emit: r }) {
1773
+ let c = t, l = r, u = _(""), d = _(14), f = _(""), p = _(""), m = _(""), h = _("rect"), D = _(""), O = _([]), k = _(""), A = _(""), j = _("");
1774
+ C(() => c.node, (e) => {
1775
+ if (!e) return;
1776
+ let t = e.nodeData?.data || {};
1777
+ u.value = t.text || "", D.value = t.note || "", O.value = t.tag ? [...t.tag] : [], A.value = t.hyperlink || "", j.value = t.hyperlinkTitle || "";
1778
+ let n = e.getData?.("style") || {};
1779
+ d.value = parseInt(n.fontSize) || 14, f.value = n.color || "", p.value = n.background || "", m.value = n.borderColor || "", h.value = n.shape || "rect";
1780
+ }, { immediate: !0 });
1781
+ let M = () => {
1782
+ l("update-text", u.value);
1783
+ }, N = (e, t) => {
1784
+ l("update-style", { [e]: t });
1785
+ }, P = () => {
1786
+ l("update-note", D.value);
1787
+ }, F = () => {
1788
+ l("update-hyperlink", {
1789
+ hyperlink: A.value,
1790
+ hyperlinkTitle: j.value
1791
+ });
1792
+ }, I = () => {
1793
+ k.value.trim() && (O.value.push({ text: k.value.trim() }), l("update-tags", [...O.value]), k.value = "");
1794
+ }, L = (e) => {
1795
+ O.value.splice(e, 1), l("update-tags", [...O.value]);
1796
+ };
1797
+ return (r, c) => {
1798
+ let l = y("el-icon"), _ = y("el-button"), C = y("el-input"), R = y("el-slider"), B = y("el-color-picker"), V = y("el-option"), H = y("el-select"), U = y("el-tag");
1799
+ return T((g(), i("div", gt, [a("div", _t, [c[16] ||= a("span", { class: "header-label" }, "属性", -1), s(_, {
1800
+ size: "small",
1801
+ circle: "",
1802
+ onClick: c[0] ||= (e) => r.$emit("close")
1803
+ }, {
1804
+ default: w(() => [s(l, null, {
1805
+ default: w(() => [s(x(z))]),
1806
+ _: 1
1807
+ })]),
1808
+ _: 1
1809
+ })]), t.node ? (g(), i("div", vt, [
1810
+ a("div", yt, [c[17] ||= a("div", { class: "section-title" }, "节点文本", -1), s(C, {
1811
+ modelValue: u.value,
1812
+ "onUpdate:modelValue": c[1] ||= (e) => u.value = e,
1813
+ size: "small",
1814
+ onChange: M,
1815
+ placeholder: "输入节点文本"
1816
+ }, null, 8, ["modelValue"])]),
1817
+ a("div", bt, [
1818
+ c[23] ||= a("div", { class: "section-title" }, "样式", -1),
1819
+ a("div", xt, [c[18] ||= a("label", null, "字体大小", -1), s(R, {
1820
+ modelValue: d.value,
1821
+ "onUpdate:modelValue": c[2] ||= (e) => d.value = e,
1822
+ min: 12,
1823
+ max: 30,
1824
+ step: 1,
1825
+ onChange: c[3] ||= (e) => N("fontSize", e + "px"),
1826
+ style: { width: "140px" }
1827
+ }, null, 8, ["modelValue"])]),
1828
+ a("div", St, [c[19] ||= a("label", null, "字体颜色", -1), s(B, {
1829
+ modelValue: f.value,
1830
+ "onUpdate:modelValue": c[4] ||= (e) => f.value = e,
1831
+ onChange: c[5] ||= (e) => N("color", e),
1832
+ size: "small"
1833
+ }, null, 8, ["modelValue"])]),
1834
+ a("div", Ct, [c[20] ||= a("label", null, "背景色", -1), s(B, {
1835
+ modelValue: p.value,
1836
+ "onUpdate:modelValue": c[6] ||= (e) => p.value = e,
1837
+ onChange: c[7] ||= (e) => N("background", e),
1838
+ size: "small"
1839
+ }, null, 8, ["modelValue"])]),
1840
+ a("div", wt, [c[21] ||= a("label", null, "边框色", -1), s(B, {
1841
+ modelValue: m.value,
1842
+ "onUpdate:modelValue": c[8] ||= (e) => m.value = e,
1843
+ onChange: c[9] ||= (e) => N("borderColor", e),
1844
+ size: "small"
1845
+ }, null, 8, ["modelValue"])]),
1846
+ a("div", Tt, [c[22] ||= a("label", null, "形状", -1), s(H, {
1847
+ modelValue: h.value,
1848
+ "onUpdate:modelValue": c[10] ||= (e) => h.value = e,
1849
+ size: "small",
1850
+ onChange: c[11] ||= (e) => N("shape", e)
1851
+ }, {
1852
+ default: w(() => [
1853
+ s(V, {
1854
+ label: "矩形",
1855
+ value: "rect"
1856
+ }),
1857
+ s(V, {
1858
+ label: "圆角矩形",
1859
+ value: "roundedRect"
1860
+ }),
1861
+ s(V, {
1862
+ label: "胶囊",
1863
+ value: "capsule"
1864
+ })
1865
+ ]),
1866
+ _: 1
1867
+ }, 8, ["modelValue"])])
1868
+ ]),
1869
+ a("div", Et, [c[24] ||= a("div", { class: "section-title" }, "备注", -1), s(C, {
1870
+ modelValue: D.value,
1871
+ "onUpdate:modelValue": c[12] ||= (e) => D.value = e,
1872
+ type: "textarea",
1873
+ rows: 3,
1874
+ size: "small",
1875
+ onChange: P,
1876
+ placeholder: "添加备注..."
1877
+ }, null, 8, ["modelValue"])]),
1878
+ a("div", Dt, [
1879
+ c[26] ||= a("div", { class: "section-title" }, "标签", -1),
1880
+ a("div", Ot, [(g(!0), i(e, null, v(O.value, (e, t) => (g(), n(U, {
1881
+ key: t,
1882
+ closable: "",
1883
+ size: "small",
1884
+ onClose: (e) => L(t)
1885
+ }, {
1886
+ default: w(() => [o(b(e.text || e), 1)]),
1887
+ _: 2
1888
+ }, 1032, ["onClose"]))), 128))]),
1889
+ a("div", kt, [s(C, {
1890
+ modelValue: k.value,
1891
+ "onUpdate:modelValue": c[13] ||= (e) => k.value = e,
1892
+ size: "small",
1893
+ placeholder: "新标签",
1894
+ onKeyup: E(I, ["enter"]),
1895
+ style: { width: "120px" }
1896
+ }, null, 8, ["modelValue"]), s(_, {
1897
+ size: "small",
1898
+ onClick: I,
1899
+ disabled: !k.value.trim()
1900
+ }, {
1901
+ default: w(() => [...c[25] ||= [o("添加", -1)]]),
1902
+ _: 1
1903
+ }, 8, ["disabled"])])
1904
+ ]),
1905
+ a("div", At, [
1906
+ c[27] ||= a("div", { class: "section-title" }, "超链接", -1),
1907
+ s(C, {
1908
+ modelValue: A.value,
1909
+ "onUpdate:modelValue": c[14] ||= (e) => A.value = e,
1910
+ size: "small",
1911
+ placeholder: "https://...",
1912
+ onChange: F
1913
+ }, null, 8, ["modelValue"]),
1914
+ s(C, {
1915
+ modelValue: j.value,
1916
+ "onUpdate:modelValue": c[15] ||= (e) => j.value = e,
1917
+ size: "small",
1918
+ placeholder: "链接标题",
1919
+ onChange: F,
1920
+ style: { "margin-top": "6px" }
1921
+ }, null, 8, ["modelValue"])
1922
+ ])
1923
+ ])) : (g(), i("div", jt, [s(l, {
1924
+ size: 32,
1925
+ color: "#c0c4cc"
1926
+ }, {
1927
+ default: w(() => [s(x(ee))]),
1928
+ _: 1
1929
+ }), c[28] ||= a("p", null, "点击节点编辑属性", -1)]))], 512)), [[S, t.visible]]);
1930
+ };
1931
+ }
1932
+ }, [["__scopeId", "data-v-c06f1443"]]), Nt = /*#__PURE__*/ Z({
1933
+ __name: "MindMapContextMenu",
1934
+ props: {
1935
+ visible: {
1936
+ type: Boolean,
1937
+ default: !1
1938
+ },
1939
+ x: {
1940
+ type: Number,
1941
+ default: 0
1942
+ },
1943
+ y: {
1944
+ type: Number,
1945
+ default: 0
1946
+ }
1947
+ },
1948
+ emits: ["command", "close"],
1949
+ setup(e, { emit: t }) {
1950
+ let n = t, r = (e) => {
1951
+ n("command", e), n("close");
1952
+ };
1953
+ return (t, n) => {
1954
+ let c = y("el-icon");
1955
+ return T((g(), i("div", {
1956
+ class: "mindmap-context-menu",
1957
+ style: f({
1958
+ left: e.x + "px",
1959
+ top: e.y + "px"
1960
+ })
1961
+ }, [
1962
+ a("div", {
1963
+ class: "menu-item",
1964
+ onClick: n[0] ||= (e) => r("insertChild")
1965
+ }, [s(c, null, {
1966
+ default: w(() => [s(x(ie))]),
1967
+ _: 1
1968
+ }), n[7] ||= o("插入子节点 ", -1)]),
1969
+ a("div", {
1970
+ class: "menu-item",
1971
+ onClick: n[1] ||= (e) => r("insertSibling")
1972
+ }, [s(c, null, {
1973
+ default: w(() => [s(x(B))]),
1974
+ _: 1
1975
+ }), n[8] ||= o("插入同级节点 ", -1)]),
1976
+ n[14] ||= a("div", { class: "menu-divider" }, null, -1),
1977
+ a("div", {
1978
+ class: "menu-item",
1979
+ onClick: n[2] ||= (e) => r("edit")
1980
+ }, [s(c, null, {
1981
+ default: w(() => [s(x(G))]),
1982
+ _: 1
1983
+ }), n[9] ||= o("编辑文本 ", -1)]),
1984
+ a("div", {
1985
+ class: "menu-item",
1986
+ onClick: n[3] ||= (e) => r("delete")
1987
+ }, [s(c, null, {
1988
+ default: w(() => [s(x(V))]),
1989
+ _: 1
1990
+ }), n[10] ||= o("删除节点 ", -1)]),
1991
+ n[15] ||= a("div", { class: "menu-divider" }, null, -1),
1992
+ a("div", {
1993
+ class: "menu-item",
1994
+ onClick: n[4] ||= (e) => r("copy")
1995
+ }, [s(c, null, {
1996
+ default: w(() => [s(x(H))]),
1997
+ _: 1
1998
+ }), n[11] ||= o("复制 ", -1)]),
1999
+ a("div", {
2000
+ class: "menu-item",
2001
+ onClick: n[5] ||= (e) => r("cut")
2002
+ }, [s(c, null, {
2003
+ default: w(() => [s(x(Y))]),
2004
+ _: 1
2005
+ }), n[12] ||= o("剪切 ", -1)]),
2006
+ a("div", {
2007
+ class: "menu-item",
2008
+ onClick: n[6] ||= (e) => r("paste")
2009
+ }, [s(c, null, {
2010
+ default: w(() => [s(x(U))]),
2011
+ _: 1
2012
+ }), n[13] ||= o("粘贴 ", -1)])
2013
+ ], 4)), [[S, e.visible]]);
2014
+ };
2015
+ }
2016
+ }, [["__scopeId", "data-v-0ca9bee8"]]), Pt = { class: "export-options" }, Ft = /*#__PURE__*/ Z({
2017
+ __name: "MindMapExportDialog",
2018
+ props: { visible: {
2019
+ type: Boolean,
2020
+ default: !1
2021
+ } },
2022
+ emits: ["update:visible", "export"],
2023
+ setup(e, { emit: t }) {
2024
+ let r = t, i = (e) => {
2025
+ r("export", e), r("update:visible", !1);
2026
+ };
2027
+ return (t, r) => {
2028
+ let c = y("el-icon"), l = y("el-button"), u = y("el-dialog");
2029
+ return g(), n(u, {
2030
+ "model-value": e.visible,
2031
+ title: "导出思维导图",
2032
+ width: "400px",
2033
+ "onUpdate:modelValue": r[4] ||= (e) => t.$emit("update:visible", e),
2034
+ onClose: r[5] ||= (e) => t.$emit("update:visible", !1)
2035
+ }, {
2036
+ footer: w(() => [s(l, { onClick: r[3] ||= (e) => t.$emit("update:visible", !1) }, {
2037
+ default: w(() => [...r[9] ||= [o("取消", -1)]]),
2038
+ _: 1
2039
+ })]),
2040
+ default: w(() => [a("div", Pt, [
2041
+ a("div", {
2042
+ class: "export-item",
2043
+ onClick: r[0] ||= (e) => i("png")
2044
+ }, [s(c, {
2045
+ size: 32,
2046
+ color: "#409eff"
2047
+ }, {
2048
+ default: w(() => [s(x(re))]),
2049
+ _: 1
2050
+ }), r[6] ||= a("div", { class: "export-info" }, [a("div", { class: "export-name" }, "PNG 图片"), a("div", { class: "export-desc" }, "高清位图,适合分享和预览")], -1)]),
2051
+ a("div", {
2052
+ class: "export-item",
2053
+ onClick: r[1] ||= (e) => i("svg")
2054
+ }, [s(c, {
2055
+ size: 32,
2056
+ color: "#67c23a"
2057
+ }, {
2058
+ default: w(() => [s(x(H))]),
2059
+ _: 1
2060
+ }), r[7] ||= a("div", { class: "export-info" }, [a("div", { class: "export-name" }, "SVG 矢量图"), a("div", { class: "export-desc" }, "无损缩放,适合印刷和编辑")], -1)]),
2061
+ a("div", {
2062
+ class: "export-item",
2063
+ onClick: r[2] ||= (e) => i("pdf")
2064
+ }, [s(c, {
2065
+ size: 32,
2066
+ color: "#f56c6c"
2067
+ }, {
2068
+ default: w(() => [s(x(H))]),
2069
+ _: 1
2070
+ }), r[8] ||= a("div", { class: "export-info" }, [a("div", { class: "export-name" }, "PDF 文档"), a("div", { class: "export-desc" }, "通用格式,适合打印和归档")], -1)])
2071
+ ])]),
2072
+ _: 1
2073
+ }, 8, ["model-value"]);
2074
+ };
2075
+ }
2076
+ }, [["__scopeId", "data-v-c9798127"]]), It = (e) => {
2077
+ let t = new pe.Doc(), n = _(!1), r = _([]), i = _(""), a = _(!1), o = !1, s = null;
2078
+ t.getXmlFragment("default");
2079
+ let c = `ws://${window.location.hostname || "localhost"}:1234`, l = null, u = new me({
2080
+ url: c,
2081
+ name: e,
2082
+ document: t,
2083
+ connect: !1,
2084
+ reconnect: !0,
2085
+ onClose: () => {
2086
+ n.value = !1, f();
2087
+ },
2088
+ onConnect: () => {
2089
+ n.value = !0, d();
2090
+ }
2091
+ }), d = () => {
2092
+ f(), l = setInterval(() => {
2093
+ if (u.connection && u.connection.ws) try {
2094
+ u.connection.ws.send(JSON.stringify({ type: "ping" }));
2095
+ } catch {}
2096
+ }, 3e4);
2097
+ }, f = () => {
2098
+ l &&= (clearInterval(l), null);
2099
+ }, p = t.getMap("mindmap");
2100
+ t.getMap("meta"), u.awareness.on("change", () => {
2101
+ r.value = Array.from(u.awareness.getStates().entries()).filter(([e, t]) => t.user).map(([e, t]) => ({
2102
+ clientId: e,
2103
+ ...t.user
2104
+ }));
2105
+ }), p.observe((e) => {
2106
+ e.keysChanged.has("_closed") && (a.value = p.get("_closed") === !0);
2107
+ });
2108
+ let m = (e) => {
2109
+ u.awareness.setLocalStateField("user", {
2110
+ id: e.id || `user-${Date.now()}`,
2111
+ name: e.name || `用户${Math.floor(Math.random() * 1e3)}`,
2112
+ color: e.color || h(),
2113
+ ...e
2114
+ });
2115
+ }, h = () => {
2116
+ let e = [
2117
+ "#409EFF",
2118
+ "#67C23A",
2119
+ "#E6A23C",
2120
+ "#F56C6C",
2121
+ "#909399",
2122
+ "#9B59B6",
2123
+ "#1ABC9C",
2124
+ "#3498DB"
2125
+ ];
2126
+ return e[Math.floor(Math.random() * e.length)];
2127
+ }, g = () => {
2128
+ u.connect();
2129
+ }, v = () => p, y = () => {
2130
+ u.disconnect();
2131
+ }, b = () => {
2132
+ a.value = !0, t.transact(() => {
2133
+ p.set("_closed", !0);
2134
+ }), u.disconnect();
2135
+ }, x = () => p.get("_closed") === !0 ? (a.value = !0, !0) : !1, S = (e) => {
2136
+ o || (s && clearTimeout(s), s = setTimeout(() => {
2137
+ let n = JSON.stringify(e);
2138
+ p.get("root") !== n && t.transact(() => {
2139
+ p.set("root", n);
2140
+ });
2141
+ }, 50));
2142
+ }, C = (e) => {
2143
+ p.observe((t) => {
2144
+ if (t.keysChanged.has("root")) {
2145
+ let t = p.get("root");
2146
+ if (t) try {
2147
+ o = !0, e(JSON.parse(t)), setTimeout(() => {
2148
+ o = !1;
2149
+ }, 100);
2150
+ } catch (e) {
2151
+ console.error("Failed to parse remote mind map data:", e), o = !1;
2152
+ }
2153
+ }
2154
+ });
2155
+ }, w = () => {
2156
+ let t = `${window.location.origin}/mindmap-editor/${e}?collab=1`;
2157
+ return i.value = t, t;
2158
+ };
2159
+ return {
2160
+ ydoc: t,
2161
+ provider: u,
2162
+ isConnected: n,
2163
+ onlineUsers: r,
2164
+ shareUrl: i,
2165
+ collaborationClosed: a,
2166
+ setUserInfo: m,
2167
+ connect: g,
2168
+ disconnect: y,
2169
+ closeCollaboration: b,
2170
+ checkCollaborationClosed: x,
2171
+ syncToYjs: S,
2172
+ getYData: v,
2173
+ onRemoteChange: C,
2174
+ generateShareUrl: w,
2175
+ copyShareUrl: async () => {
2176
+ let e = i.value || w();
2177
+ try {
2178
+ return await navigator.clipboard.writeText(e), !0;
2179
+ } catch {
2180
+ return !1;
2181
+ }
2182
+ },
2183
+ destroy: () => {
2184
+ f(), s && clearTimeout(s), u.awareness.setLocalState(null), u.disconnect(), t.destroy();
2185
+ }
2186
+ };
2187
+ }, Lt = { class: "mindmap-editor" }, Rt = { class: "editor-main" }, zt = "mindmap", Bt = /*#__PURE__*/ Z({
2188
+ __name: "MindMapEditor",
2189
+ setup(e) {
2190
+ let n = k(), r = A(), o = _(null), c = _(null), l = _(!1), d = _(!1), f = _(!1), { saveVersion: h } = Be(), v = Le(), b = _({
2191
+ visible: !1,
2192
+ x: 0,
2193
+ y: 0
2194
+ }), S = null, T = !1, E = null, O = _(!1), N = _(!1), P = _(!1), F = _([]), I = _(""), L = _(""), R = _(n.params.id || null), z = _(null), B = t(() => !!z.value), V = _(!1);
2195
+ C(B, () => {
2196
+ u(() => {
2197
+ S && (S.getElRectInfo(), S.resize(), q.value && S.view.fit(void 0, !0));
2198
+ });
2199
+ });
2200
+ let H = _("mindMap"), U = _("default"), W = _(0), G = _(0), K = _(100), q = _(!0), ee = {
2201
+ data: {
2202
+ text: "中心主题",
2203
+ expand: !0
2204
+ },
2205
+ children: [{
2206
+ data: {
2207
+ text: "分支主题 1",
2208
+ expand: !0
2209
+ },
2210
+ children: [{
2211
+ data: { text: "子主题 1.1" },
2212
+ children: []
2213
+ }, {
2214
+ data: { text: "子主题 1.2" },
2215
+ children: []
2216
+ }]
2217
+ }, {
2218
+ data: {
2219
+ text: "分支主题 2",
2220
+ expand: !0
2221
+ },
2222
+ children: [{
2223
+ data: { text: "子主题 2.1" },
2224
+ children: []
2225
+ }, {
2226
+ data: { text: "子主题 2.2" },
2227
+ children: []
2228
+ }]
2229
+ }]
2230
+ }, te = JSON.parse(JSON.stringify(ee)), ne = async () => {
2231
+ if (!o.value) return;
2232
+ let e = await import("./simple-mind-map-DFGmd5vc.mjs"), t = e.default || e, [r, i, a, s, c, l, d, f, p, m, h, g, _] = await Promise.all([
2233
+ import("./Export-C11gtER2.mjs"),
2234
+ import("./Drag-BNJqZaaB.mjs"),
2235
+ import("./Select-CY_n5-r2.mjs"),
2236
+ import("./KeyboardNavigation-BznWjRqo.mjs"),
2237
+ import("./Scrollbar-5bObtsl_.mjs"),
2238
+ import("./MiniMap-BtFFvLbR.mjs"),
2239
+ import("./OuterFrame-D-P0EKq5.mjs"),
2240
+ import("./RainbowLines-CGp8BmNt.mjs"),
2241
+ import("./Painter-D3byksYq.mjs"),
2242
+ import("./Search-1GRF2dmm.mjs"),
2243
+ import("./NodeImgAdjust-CU_ka96q.mjs"),
2244
+ import("./Watermark-B-zBgHXG.mjs"),
2245
+ import("./Formula-rim6V3Ro.mjs")
2246
+ ]), v = r.default, y = i.default, b = a.default, x = s.default, C = c.default, w = l.default, E = d.default, D = f.default, O = p.default, k = m.default, A = h.default, j = g.default, M = _.default, N = ee, P = n.params.id;
2247
+ if (P) try {
2248
+ let { documentAPI: e } = await import("./api-D2rfJWe_.mjs"), t = await e.get(P);
2249
+ if (t.data?.content) {
2250
+ let e = JSON.parse(t.data.content);
2251
+ e && e.data && (N = e, te = JSON.parse(JSON.stringify(e)));
2252
+ }
2253
+ t.data?.title && (I.value = t.data.title), t.data?.author && (L.value = t.data.author);
2254
+ } catch (e) {
2255
+ console.warn("Failed to load document:", e);
2256
+ }
2257
+ S = new t({
2258
+ el: o.value,
2259
+ data: N,
2260
+ layout: H.value,
2261
+ theme: U.value,
2262
+ scaleRatio: .1,
2263
+ mousewheelAction: "move",
2264
+ mousewheelMoveStep: 100,
2265
+ initRootNodePosition: ["center", "center"],
2266
+ fitPadding: 50,
2267
+ enableCtrlKeyNodeSelection: !0,
2268
+ deleteNodeActive: !0,
2269
+ maxHistoryCount: 500,
2270
+ fit: !0,
2271
+ enableAutoEnterTextEditWhenKeydown: !1,
2272
+ enableShortcutOnlyWhenMouseInSvg: !0
2273
+ }), S.addPlugin(v), S.addPlugin(y), S.addPlugin(b), S.addPlugin(x), S.addPlugin(C), S.addPlugin(w), S.addPlugin(E), S.addPlugin(D), S.addPlugin(O), S.addPlugin(k), S.addPlugin(A), S.addPlugin(j), S.addPlugin(M), S.on("node_click", (e) => {
2274
+ z.value = e, V.value = !e.parent;
2275
+ }), S.on("draw_click", () => {
2276
+ z.value = null, V.value = !1;
2277
+ }), S.on("history_change", () => {
2278
+ re();
2279
+ }), S.on("back_forward", (e, t) => {
2280
+ W.value = e || 0, G.value = (t || 1) - 1 - (e || 0);
2281
+ }), S.on("data_change", () => {
2282
+ he();
2283
+ }), S.on("before_show_text_edit", () => {
2284
+ Q = !0, Z && clearTimeout(Z);
2285
+ }), S.on("hide_text_edit", () => {
2286
+ Q = !1, q.value && u(() => ge());
2287
+ }), S.on("scale", (e) => {
2288
+ K.value = Math.round(e * 100);
2289
+ }), S.on("node_tree_render_end", () => {
2290
+ re(), T || (T = !0, u(() => {
2291
+ S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0), ve();
2292
+ }));
2293
+ });
2294
+ }, re = () => {
2295
+ if (S) try {
2296
+ let e = S.command;
2297
+ W.value = e.activeHistoryIndex || 0, G.value = (e.history?.length || 1) - 1 - (e.activeHistoryIndex || 0);
2298
+ } catch {
2299
+ W.value = 0, G.value = 0;
2300
+ }
2301
+ }, ie = async () => {
2302
+ if (!S) return;
2303
+ E = It(n.params.id || `mindmap-${Date.now()}`), E.connect();
2304
+ let e = `用户${Math.floor(Math.random() * 1e3)}`;
2305
+ E.setUserInfo({ name: e }), v.setCollabContext({
2306
+ ydoc: E.ydoc,
2307
+ provider: E.provider,
2308
+ onlineUsers: F
2309
+ }), v.setCurrentUser({
2310
+ id: E.provider.awareness.clientID,
2311
+ name: e,
2312
+ color: `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`
2313
+ }), E.syncToYjs(S.getData()), E.onRemoteChange((e) => {
2314
+ S && S.setData(e);
2315
+ }), S.on("data_change", () => {
2316
+ E && E.syncToYjs(S.getData());
2317
+ }), P.value = !0, O.value = !0, N.value = !0;
2318
+ let t = setInterval(() => {
2319
+ E && (F.value = [...E.onlineUsers.value]);
2320
+ }, 1e3);
2321
+ E._userSyncTimer = t, n.params.id || await ke();
2322
+ let r = E.generateShareUrl();
2323
+ j.success("协作已开启,分享链接已复制");
2324
+ try {
2325
+ await navigator.clipboard.writeText(r);
2326
+ } catch {}
2327
+ }, ae = () => {
2328
+ E &&= (E._userSyncTimer && clearInterval(E._userSyncTimer), E.closeCollaboration(), null), P.value = !1, O.value = !1, N.value = !1, F.value = [], j.info("协作已关闭");
2329
+ }, oe = async () => {
2330
+ if (!S) return;
2331
+ let e = n.params.id;
2332
+ if (!e) return;
2333
+ E = It(e), E.connect();
2334
+ let t = `协作人${Math.floor(Math.random() * 1e3)}`;
2335
+ if (E.setUserInfo({ name: t }), v.setCollabContext({
2336
+ ydoc: E.ydoc,
2337
+ provider: E.provider,
2338
+ onlineUsers: F
2339
+ }), v.setCurrentUser({
2340
+ id: E.provider.awareness.clientID,
2341
+ name: t,
2342
+ color: `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`
2343
+ }), E.onRemoteChange((e) => {
2344
+ S && S.setData(e);
2345
+ }), S.on("data_change", () => {
2346
+ E && E.syncToYjs(S.getData());
2347
+ }), await new Promise((e) => {
2348
+ let t = () => {
2349
+ let t = E.getYData().get("root");
2350
+ if (t) try {
2351
+ let e = JSON.parse(t);
2352
+ S.setData(e);
2353
+ } catch {}
2354
+ e();
2355
+ };
2356
+ if (E.isConnected.value) t();
2357
+ else {
2358
+ let e = C(() => E.isConnected.value, (n) => {
2359
+ n && (e(), t());
2360
+ });
2361
+ }
2362
+ }), E.checkCollaborationClosed()) {
2363
+ j.warning("该协作已关闭,无法加入"), E.disconnect(), E = null;
2364
+ return;
2365
+ }
2366
+ P.value = !0, O.value = !0, N.value = !1;
2367
+ let r = setInterval(() => {
2368
+ E && (F.value = [...E.onlineUsers.value]);
2369
+ }, 1e3);
2370
+ E._userSyncTimer = r, j.success("已加入协作");
2371
+ }, se = async () => {
2372
+ if (!E) await ie();
2373
+ else {
2374
+ let e = E.generateShareUrl();
2375
+ try {
2376
+ await navigator.clipboard.writeText(e), j.success("分享链接已复制到剪贴板");
2377
+ } catch {
2378
+ j.info("分享链接: " + e);
2379
+ }
2380
+ }
2381
+ }, ce = () => r.push("/"), Y = (e) => {
2382
+ S && (e === "child" ? S.execCommand("INSERT_CHILD_NODE") : S.execCommand("INSERT_NODE"));
2383
+ }, le = () => {
2384
+ S && S.execCommand("REMOVE_NODE");
2385
+ }, ue = () => {
2386
+ if (!S) return;
2387
+ let e = S.getData(), t = (e) => {
2388
+ e.children && e.children.length > 0 && (e.children.reverse(), e.children.forEach(t));
2389
+ };
2390
+ t(e), S.setData(e), u(() => {
2391
+ S && (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2392
+ });
2393
+ }, de = () => S?.execCommand("BACK"), fe = () => S?.execCommand("FORWARD"), X = () => S?.view.enlarge(), pe = () => S?.view.narrow(), me = () => {
2394
+ S && (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2395
+ }, Z = null, Q = !1, he = () => {
2396
+ !q.value || !S || Q || (Z && clearTimeout(Z), Z = setTimeout(() => {
2397
+ Q || (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2398
+ }, 200));
2399
+ }, ge = () => {
2400
+ S && (Z && clearTimeout(Z), S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2401
+ }, _e = async () => {
2402
+ if (S) {
2403
+ try {
2404
+ await M.confirm("确定要复位思维导图吗?将恢复到最近一次保存的状态。", "复位确认", {
2405
+ confirmButtonText: "确定",
2406
+ cancelButtonText: "取消",
2407
+ type: "warning"
2408
+ });
2409
+ } catch {
2410
+ return;
2411
+ }
2412
+ S.setData(te), u(() => {
2413
+ S && (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2414
+ });
2415
+ }
2416
+ }, $ = null, ve = () => {
2417
+ !o.value || !S || ($ = new ResizeObserver(() => {
2418
+ S && (S.getElRectInfo(), S.resize());
2419
+ }), $.observe(o.value));
2420
+ }, ye = (e) => {
2421
+ H.value = e, S && S.svg?.attr({ opacity: 0 }), S?.setLayout(e);
2422
+ let t = () => {
2423
+ S && (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0), S.svg?.attr({ opacity: 1 }), S.off("node_tree_render_end", t));
2424
+ };
2425
+ S?.on("node_tree_render_end", t), setTimeout(() => {
2426
+ S && (S.svg?.attr({ opacity: 1 }), S.off("node_tree_render_end", t));
2427
+ }, 3e3);
2428
+ }, be = (e) => {
2429
+ U.value = e;
2430
+ let t = $e.find((t) => t.value === e);
2431
+ t && t.config && Object.keys(t.config).length > 0 ? S?.setThemeConfig(t.config) : S?.setTheme("default");
2432
+ }, xe = (e) => {
2433
+ !S || !z.value || (z.value.setData({ text: e }), S.render());
2434
+ }, Se = (e) => {
2435
+ if (!S || !z.value) return;
2436
+ let t = z.value.getData("style") || {};
2437
+ z.value.setData("style", {
2438
+ ...t,
2439
+ ...e
2440
+ }), S.render();
2441
+ }, Ce = (e) => {
2442
+ !S || !z.value || z.value.setData({ note: e });
2443
+ }, we = (e) => {
2444
+ !S || !z.value || z.value.setData({ tag: e });
2445
+ }, Te = ({ hyperlink: e, hyperlinkTitle: t }) => {
2446
+ !S || !z.value || z.value.setData({
2447
+ hyperlink: e,
2448
+ hyperlinkTitle: t
2449
+ });
2450
+ }, Ee = (e) => {
2451
+ e === "png" || e === "svg" ? l.value = !0 : Oe(e);
2452
+ }, De = async (e) => {
2453
+ j.info("AI生成功能开发中,敬请期待...");
2454
+ }, Oe = async (e) => {
2455
+ if (S) try {
2456
+ e === "png" ? await S.export.exportImg() : e === "svg" ? await S.export.exportSvg() : e === "pdf" && await S.export.exportPdf(), j.success("导出成功");
2457
+ } catch (e) {
2458
+ j.error("导出失败: " + e.message);
2459
+ }
2460
+ }, ke = async () => {
2461
+ if (S) {
2462
+ if (O.value && !N.value && (!E || !E.isConnected.value || E.collaborationClosed.value)) {
2463
+ j.error("协作已关闭,无法提交保存");
2464
+ return;
2465
+ }
2466
+ if (!I.value?.trim()) {
2467
+ j.warning("请输入思维导图标题");
2468
+ return;
2469
+ }
2470
+ if (!L.value?.trim()) {
2471
+ j.warning("请输入作者");
2472
+ return;
2473
+ }
2474
+ try {
2475
+ let e = S.getData(), t = JSON.stringify(e), i = n.params.id, { documentAPI: a } = await import("./api-D2rfJWe_.mjs");
2476
+ if (i) await a.update(i, {
2477
+ content: t,
2478
+ title: I.value.trim(),
2479
+ doc_type: "mindmap"
2480
+ }), R.value = i;
2481
+ else {
2482
+ let e = await a.create({
2483
+ title: I.value.trim(),
2484
+ content: t,
2485
+ doc_type: "mindmap"
2486
+ });
2487
+ R.value = e.data.id, r.replace(`/mindmap-editor/${e.data.id}`);
2488
+ }
2489
+ te = JSON.parse(JSON.stringify(e)), j.success("保存成功"), h({
2490
+ documentId: String(R.value || ""),
2491
+ docType: "mindmap",
2492
+ content: JSON.stringify(e),
2493
+ userId: String(v.currentUser.value?.id || ""),
2494
+ userName: v.currentUser.value?.name || L.value || "未知"
2495
+ });
2496
+ } catch (e) {
2497
+ j.error("保存失败: " + e.message);
2498
+ }
2499
+ }
2500
+ }, Ae = (e) => {
2501
+ b.value = {
2502
+ visible: !0,
2503
+ x: e.clientX,
2504
+ y: e.clientY
2505
+ };
2506
+ }, je = (e) => {
2507
+ switch (e) {
2508
+ case "insertChild":
2509
+ Y("child");
2510
+ break;
2511
+ case "insertSibling":
2512
+ Y("sibling");
2513
+ break;
2514
+ case "edit":
2515
+ z.value && (S?.execCommand("ACTIVE_NODE", z.value), S?.textEdit.enterTextEdit());
2516
+ break;
2517
+ case "delete":
2518
+ le();
2519
+ break;
2520
+ case "copy":
2521
+ S?.execCommand("COPY");
2522
+ break;
2523
+ case "cut":
2524
+ S?.execCommand("CUT");
2525
+ break;
2526
+ case "paste":
2527
+ S?.execCommand("PASTE");
2528
+ break;
2529
+ }
2530
+ }, Me = () => {
2531
+ b.value.visible = !1;
2532
+ }, Ne = [
2533
+ "我可以帮您梳理思维导图结构、扩展节点内容,或者提供思路启发。请问有什么需要帮助的?",
2534
+ "这个思维导图的层级结构很清晰。建议在二级节点下添加更多细节,让内容更加丰富。",
2535
+ "根据当前的主题,我建议您尝试从不同维度展开思考,比如时间、空间、因果、对比等角度。",
2536
+ "思维导图中的关键词提炼得很好。如果需要,我可以帮您将某些节点展开为更详细的描述。",
2537
+ "我可以帮您检查思维导图中是否存在重复或遗漏的分支。需要我逐个节点分析吗?",
2538
+ "建议使用不同的颜色和图标来区分不同分支的重要性,这样可以让思维导图更加直观。",
2539
+ "这个思维导图的逻辑框架不错。建议在关键节点添加备注,方便后续回顾和补充。",
2540
+ "我可以帮您将思维导图转换为大纲文本,或者根据现有内容生成新的分支建议。"
2541
+ ], Pe = async (e, t = {}) => {
2542
+ let r = n.params.id ? `${zt}-${n.params.id}` : null;
2543
+ await v.sendMessage(e, {
2544
+ ...t,
2545
+ roomId: r
2546
+ });
2547
+ let i = t.mentionedUser, a = i && i.toLowerCase().includes("ai"), o = v.collabUsers.value.filter((e) => e.name !== v.currentUser.value.name);
2548
+ (!i || a || o.length === 0) && (v.loading.value = !0, setTimeout(() => {
2549
+ v.sendAiMessage(Ne[Math.floor(Math.random() * Ne.length)], r), v.loading.value = !1;
2550
+ }, 800 + Math.random() * 1200));
2551
+ }, Fe = () => {
2552
+ let e = n.params.id ? `${zt}-${n.params.id}` : null;
2553
+ v.clearMessages(e);
2554
+ }, Re = () => {
2555
+ if (!n.params.id) {
2556
+ j.warning("请先保存文档");
2557
+ return;
2558
+ }
2559
+ f.value = !0;
2560
+ }, ze = (e) => {
2561
+ try {
2562
+ let t = typeof e == "string" ? JSON.parse(e) : e;
2563
+ t && S && (S.setData(t), u(() => {
2564
+ S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0);
2565
+ }));
2566
+ } catch (e) {
2567
+ console.error("Version apply error:", e);
2568
+ }
2569
+ };
2570
+ return m(async () => {
2571
+ await u(), await ne(), document.addEventListener("click", Me), n.query.collab === "1" && n.params.id && await oe();
2572
+ }), p(() => {
2573
+ document.removeEventListener("click", Me), Z && clearTimeout(Z), E &&= (E.destroy(), null), $ &&= ($.disconnect(), null), S &&= (S.destroy(), null);
2574
+ }), (e, t) => {
2575
+ let n = y("el-icon"), r = y("el-button");
2576
+ return g(), i("div", Lt, [
2577
+ s(ht, {
2578
+ "undo-count": W.value,
2579
+ "redo-count": G.value,
2580
+ "current-layout": H.value,
2581
+ "current-theme": U.value,
2582
+ "zoom-percent": K.value,
2583
+ "auto-fit": q.value,
2584
+ "is-collaborating": O.value,
2585
+ "is-collab-owner": N.value,
2586
+ "collab-users": F.value,
2587
+ "model-title": I.value,
2588
+ "model-author": L.value,
2589
+ "is-root-node": V.value,
2590
+ onBack: ce,
2591
+ onUndo: de,
2592
+ onRedo: fe,
2593
+ onInsertChild: t[0] ||= (e) => Y("child"),
2594
+ onInsertSibling: t[1] ||= (e) => Y("sibling"),
2595
+ onReverseLayout: ue,
2596
+ onDeleteNode: le,
2597
+ onChangeLayout: ye,
2598
+ onChangeTheme: be,
2599
+ onZoomIn: X,
2600
+ onZoomOut: pe,
2601
+ onFitView: me,
2602
+ onToggleAutoFit: t[2] ||= (e) => q.value = !q.value,
2603
+ onResetView: _e,
2604
+ onExport: Ee,
2605
+ onSave: ke,
2606
+ onToggleCollab: t[3] ||= (e) => O.value ? ae() : ie(),
2607
+ onShareCollab: se,
2608
+ "onUpdate:title": t[4] ||= (e) => I.value = e,
2609
+ "onUpdate:author": t[5] ||= (e) => L.value = e,
2610
+ onAiGenerate: De,
2611
+ "show-history": !!R.value,
2612
+ onHistory: Re
2613
+ }, null, 8, [
2614
+ "undo-count",
2615
+ "redo-count",
2616
+ "current-layout",
2617
+ "current-theme",
2618
+ "zoom-percent",
2619
+ "auto-fit",
2620
+ "is-collaborating",
2621
+ "is-collab-owner",
2622
+ "collab-users",
2623
+ "model-title",
2624
+ "model-author",
2625
+ "is-root-node",
2626
+ "show-history"
2627
+ ]),
2628
+ a("div", Rt, [a("div", {
2629
+ class: "canvas-area",
2630
+ ref_key: "canvasRef",
2631
+ ref: c,
2632
+ onContextmenu: D(Ae, ["prevent"])
2633
+ }, [a("div", {
2634
+ class: "mindmap-container",
2635
+ ref_key: "containerRef",
2636
+ ref: o
2637
+ }, null, 512)], 544), s(Mt, {
2638
+ visible: B.value,
2639
+ node: z.value,
2640
+ onClose: t[6] ||= (e) => z.value = null,
2641
+ onUpdateText: xe,
2642
+ onUpdateStyle: Se,
2643
+ onUpdateNote: Ce,
2644
+ onUpdateTags: we,
2645
+ onUpdateHyperlink: Te
2646
+ }, null, 8, ["visible", "node"])]),
2647
+ s(Nt, {
2648
+ visible: b.value.visible,
2649
+ x: b.value.x,
2650
+ y: b.value.y,
2651
+ onCommand: je,
2652
+ onClose: t[7] ||= (e) => b.value.visible = !1
2653
+ }, null, 8, [
2654
+ "visible",
2655
+ "x",
2656
+ "y"
2657
+ ]),
2658
+ s(Ft, {
2659
+ visible: l.value,
2660
+ "onUpdate:visible": t[8] ||= (e) => l.value = e,
2661
+ onExport: Oe
2662
+ }, null, 8, ["visible"]),
2663
+ s(r, {
2664
+ class: "ai-chat-fab",
2665
+ type: d.value ? "primary" : "default",
2666
+ circle: "",
2667
+ size: "large",
2668
+ onClick: t[9] ||= (e) => d.value = !d.value,
2669
+ title: "AI助手"
2670
+ }, {
2671
+ default: w(() => [s(n, null, {
2672
+ default: w(() => [s(x(J))]),
2673
+ _: 1
2674
+ })]),
2675
+ _: 1
2676
+ }, 8, ["type"]),
2677
+ s(Ie, {
2678
+ visible: d.value,
2679
+ messages: x(v).messages.value,
2680
+ loading: x(v).loading.value,
2681
+ "is-collab": x(v).isCollabMode.value,
2682
+ "collab-users": x(v).collabUsers.value,
2683
+ "current-user": x(v).currentUser.value,
2684
+ "is-owner": N.value,
2685
+ onSend: Pe,
2686
+ onClose: t[10] ||= (e) => d.value = !1,
2687
+ "unread-mention": x(v).unreadMention.value,
2688
+ onClearUnread: t[11] ||= (e) => x(v).clearUnreadMention(),
2689
+ onClear: Fe
2690
+ }, null, 8, [
2691
+ "visible",
2692
+ "messages",
2693
+ "loading",
2694
+ "is-collab",
2695
+ "collab-users",
2696
+ "current-user",
2697
+ "is-owner",
2698
+ "unread-mention"
2699
+ ]),
2700
+ s(Qe, {
2701
+ modelValue: f.value,
2702
+ "onUpdate:modelValue": t[12] ||= (e) => f.value = e,
2703
+ "document-id": R.value,
2704
+ onApply: ze
2705
+ }, null, 8, ["modelValue", "document-id"])
2706
+ ]);
2707
+ };
2708
+ }
2709
+ }, [["__scopeId", "data-v-6b850065"]]), Vt = c({
2710
+ name: "YourCompanyMindmap",
2711
+ props: {
2712
+ docId: {
2713
+ type: [Number, String],
2714
+ default: null
2715
+ },
2716
+ apiBase: {
2717
+ type: String,
2718
+ default: "/api"
2719
+ },
2720
+ wsUrl: {
2721
+ type: String,
2722
+ default: ""
2723
+ },
2724
+ user: {
2725
+ type: Object,
2726
+ default: () => ({
2727
+ id: "",
2728
+ name: "",
2729
+ color: ""
2730
+ })
2731
+ },
2732
+ roomId: {
2733
+ type: String,
2734
+ default: ""
2735
+ }
2736
+ },
2737
+ setup(e, { slots: t }) {
2738
+ return () => l("div", {
2739
+ class: "yourcompany-mindmap-wrapper",
2740
+ style: "position:relative"
2741
+ }, [l(Bt, { ...e }), l(O)]);
2742
+ }
2743
+ });
2744
+ //#endregion
2745
+ export { Vt as default };