@billtaofbj/explosion-diagram 1.0.0 → 1.2.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.
package/dist/index.es.js CHANGED
@@ -2,16 +2,16 @@ import { Fragment as e, Transition as t, computed as n, createBlock as r, create
2
2
  import { BrandWatermark as D } from "@billtaofbj/core";
3
3
  import { useRoute as O, useRouter as k } from "vue-router";
4
4
  import { ElMessage as A, ElMessageBox as j } from "element-plus";
5
- import { ArrowDown as M, ArrowLeft as ee, Back as te, Bell as N, Clock as P, Close as F, Connection as I, Delete as L, Download as R, Files as z, Link as B, Loading as V, Monitor as H, Promotion as U, RefreshLeft as W, RefreshRight as ne, Share as re, Upload as G, ZoomIn as ie, ZoomOut as K } from "@element-plus/icons-vue";
5
+ import { ArrowDown as M, ArrowLeft as N, Back as ee, Bell as te, Clock as P, Close as F, Connection as ne, Delete as re, Download as I, Files as L, Link as R, Loading as z, Monitor as B, Promotion as V, RefreshLeft as H, RefreshRight as U, Share as W, Upload as G, ZoomIn as K, ZoomOut as ie } from "@element-plus/icons-vue";
6
6
  import q from "axios";
7
- import * as J from "yjs";
8
- import { HocuspocusProvider as ae } from "@hocuspocus/provider";
7
+ import * as ae from "yjs";
8
+ import { HocuspocusProvider as oe } from "@hocuspocus/provider";
9
9
  //#region \0plugin-vue:export-helper
10
- var Y = (e, t) => {
10
+ var J = (e, t) => {
11
11
  let n = e.__vccOpts || e;
12
12
  for (let [e, r] of t) n[e] = r;
13
13
  return n;
14
- }, oe = { class: "chat-header" }, se = { class: "chat-header-left" }, X = { class: "chat-title" }, ce = { class: "online-users-list" }, le = { class: "online-user-item" }, ue = { class: "online-user-name" }, de = { key: 1 }, fe = { class: "online-user-name" }, pe = { class: "chat-header-right" }, Z = {
14
+ }, Y = { class: "chat-header" }, X = { class: "chat-header-left" }, se = { class: "chat-title" }, ce = { class: "online-users-list" }, le = { class: "online-user-item" }, ue = { class: "online-user-name" }, Z = { key: 1 }, de = { class: "online-user-name" }, fe = { class: "chat-header-right" }, pe = {
15
15
  key: 0,
16
16
  class: "chat-empty"
17
17
  }, me = { class: "chat-empty-hint" }, he = { key: 1 }, ge = { class: "message-content" }, Q = {
@@ -20,13 +20,13 @@ var Y = (e, t) => {
20
20
  }, _e = {
21
21
  key: 0,
22
22
  class: "message-mention"
23
- }, ve = ["innerHTML"], ye = { class: "message-time" }, $ = {
23
+ }, ve = ["innerHTML"], ye = { class: "message-time" }, be = {
24
24
  key: 1,
25
25
  class: "chat-message chat-message-ai"
26
- }, be = { class: "message-avatar ai" }, xe = { class: "chat-input-area" }, Se = {
26
+ }, xe = { class: "message-avatar ai" }, Se = { class: "chat-input-area" }, Ce = {
27
27
  key: 0,
28
28
  class: "mention-popup"
29
- }, Ce = ["onClick", "onMouseenter"], we = { key: 1 }, Te = /*#__PURE__*/ Y({
29
+ }, $ = ["onClick", "onMouseenter"], we = { key: 1 }, Te = /*#__PURE__*/ J({
30
30
  __name: "AiChatPanel",
31
31
  props: {
32
32
  visible: {
@@ -77,44 +77,44 @@ var Y = (e, t) => {
77
77
  "clear-unread"
78
78
  ],
79
79
  setup(t, { emit: l }) {
80
- let u = t, m = l, h = v(""), _ = v(null), D = v(null), O = v(!1), k = v([]), A = v(0), j = "", M = -1, ee = {
80
+ let u = t, m = l, h = v(""), _ = v(null), D = v(null), O = v(!1), k = v([]), A = v(0), j = "", M = -1, N = {
81
81
  id: "ai-assistant",
82
82
  name: "AI助手",
83
83
  color: "#409EFF",
84
84
  isAi: !0
85
- }, te = n(() => {
85
+ }, ee = n(() => {
86
86
  let e = u.currentUser.id, t = /* @__PURE__ */ new Set();
87
- return [ee, ...u.collabUsers.filter((n) => {
87
+ return [N, ...u.collabUsers.filter((n) => {
88
88
  let r = n.clientId || n.id || "";
89
89
  if (r && r === e) return !1;
90
90
  let i = String(r || n.name || "");
91
91
  return t.has(i) ? !1 : (t.add(i), !0);
92
92
  })];
93
- }), P = n(() => te.value.length + 1), I = (e) => e.role === "ai" ? "chat-message-ai" : u.isCollab && e.user_id && e.user_id !== u.currentUser.id ? "chat-message-other" : "chat-message-user", R = (e) => e.role === "ai" ? { background: "linear-gradient(135deg, #409EFF, #337ECC)" } : { background: e.user_color || "#67C23A" }, z = (e) => (e.user_name || "U").charAt(0), B = (e) => {
93
+ }), P = n(() => ee.value.length + 1), ne = (e) => e.role === "ai" ? "chat-message-ai" : u.isCollab && e.user_id && e.user_id !== u.currentUser.id ? "chat-message-other" : "chat-message-user", I = (e) => e.role === "ai" ? { background: "linear-gradient(135deg, #409EFF, #337ECC)" } : { background: e.user_color || "#67C23A" }, L = (e) => (e.user_name || "U").charAt(0), R = (e) => {
94
94
  if (!u.isCollab) return;
95
95
  let t = typeof e == "string" ? e : e.target?.value || h.value, n = t.length, r = t.lastIndexOf("@", n);
96
96
  if (r !== -1 && r < n) {
97
97
  let e = t.slice(r + 1, n);
98
98
  if (!e.includes(" ") && !e.includes("\n")) {
99
- j = e, M = r, k.value = te.value.filter((t) => t.name && t.name.toLowerCase().includes(e.toLowerCase())), O.value = k.value.length > 0, A.value = 0;
99
+ j = e, M = r, k.value = ee.value.filter((t) => t.name && t.name.toLowerCase().includes(e.toLowerCase())), O.value = k.value.length > 0, A.value = 0;
100
100
  return;
101
101
  }
102
102
  }
103
103
  O.value = !1;
104
- }, V = () => {
104
+ }, z = () => {
105
105
  O.value && (A.value = Math.min(A.value + 1, k.value.length - 1));
106
- }, W = () => {
106
+ }, H = () => {
107
107
  O.value && (A.value = Math.max(A.value - 1, 0));
108
- }, ne = (e) => {
108
+ }, U = (e) => {
109
109
  let t = h.value.slice(0, M), n = h.value.slice(M + j.length + 1);
110
110
  h.value = `${t}@${e.name} ${n}`, O.value = !1;
111
- }, re = (e) => {
111
+ }, W = (e) => {
112
112
  if (e) {
113
113
  if (e.shiftKey) return;
114
114
  if (O.value) {
115
115
  let t = k.value[A.value];
116
116
  if (t) {
117
- e.preventDefault(), ne(t);
117
+ e.preventDefault(), U(t);
118
118
  return;
119
119
  }
120
120
  }
@@ -140,15 +140,15 @@ var Y = (e, t) => {
140
140
  class: "ai-chat-panel",
141
141
  style: p({ width: t.panelWidth + "px" })
142
142
  }, [
143
- o("div", oe, [o("div", se, [
143
+ o("div", Y, [o("div", X, [
144
144
  c(u, {
145
145
  size: 18,
146
146
  color: "#409EFF"
147
147
  }, {
148
- default: w(() => [c(S(H))]),
148
+ default: w(() => [c(S(B))]),
149
149
  _: 1
150
150
  }),
151
- o("span", X, x(t.isCollab ? "协作聊天" : "AI 助手"), 1),
151
+ o("span", se, x(t.isCollab ? "协作聊天" : "AI 助手"), 1),
152
152
  t.isCollab ? (g(), r(v, {
153
153
  key: 0,
154
154
  width: 200,
@@ -180,7 +180,7 @@ var Y = (e, t) => {
180
180
  _: 1
181
181
  }, 8, ["type"]),
182
182
  l[4] ||= o("span", { class: "self-tag" }, "(我)", -1)
183
- ]), (g(!0), a(e, null, y(te.value, (e) => (g(), a("div", {
183
+ ]), (g(!0), a(e, null, y(ee.value, (e) => (g(), a("div", {
184
184
  key: e.id || e.clientId,
185
185
  class: "online-user-item"
186
186
  }, [
@@ -191,10 +191,10 @@ var Y = (e, t) => {
191
191
  key: 0,
192
192
  size: 14
193
193
  }, {
194
- default: w(() => [c(S(H))]),
194
+ default: w(() => [c(S(B))]),
195
195
  _: 1
196
- })) : (g(), a("span", de, x((e.name || "U").charAt(0)), 1))], 4),
197
- o("span", fe, x(e.name || "未知用户"), 1),
196
+ })) : (g(), a("span", Z, x((e.name || "U").charAt(0)), 1))], 4),
197
+ o("span", de, x(e.name || "未知用户"), 1),
198
198
  e.isAi ? (g(), r(d, {
199
199
  key: 0,
200
200
  size: "small",
@@ -217,7 +217,7 @@ var Y = (e, t) => {
217
217
  ]))), 128))])]),
218
218
  _: 1
219
219
  })) : i("", !0)
220
- ]), o("div", pe, [
220
+ ]), o("div", fe, [
221
221
  t.isCollab && t.unreadMention ? (g(), a("div", {
222
222
  key: 0,
223
223
  class: "mention-bell",
@@ -227,7 +227,7 @@ var Y = (e, t) => {
227
227
  size: 18,
228
228
  color: "#F56C6C"
229
229
  }, {
230
- default: w(() => [c(S(N))]),
230
+ default: w(() => [c(S(te))]),
231
231
  _: 1
232
232
  })])) : i("", !0),
233
233
  c(C, {
@@ -238,7 +238,7 @@ var Y = (e, t) => {
238
238
  title: "清空对话"
239
239
  }, {
240
240
  default: w(() => [c(u, null, {
241
- default: w(() => [c(S(L))]),
241
+ default: w(() => [c(S(re))]),
242
242
  _: 1
243
243
  })]),
244
244
  _: 1
@@ -262,12 +262,12 @@ var Y = (e, t) => {
262
262
  ref_key: "messagesRef",
263
263
  ref: _
264
264
  }, [
265
- t.messages.length === 0 ? (g(), a("div", Z, [
265
+ t.messages.length === 0 ? (g(), a("div", pe, [
266
266
  c(u, {
267
267
  size: 40,
268
268
  color: "#c0c4cc"
269
269
  }, {
270
- default: w(() => [c(S(H))]),
270
+ default: w(() => [c(S(B))]),
271
271
  _: 1
272
272
  }),
273
273
  o("p", null, x(t.isCollab ? "协作聊天室" : "你好!我是 AI 助手"), 1),
@@ -275,17 +275,17 @@ var Y = (e, t) => {
275
275
  ])) : i("", !0),
276
276
  (g(!0), a(e, null, y(t.messages, (e) => (g(), a("div", {
277
277
  key: e._msgId || e.time + e.content,
278
- class: f(["chat-message", I(e)])
278
+ class: f(["chat-message", ne(e)])
279
279
  }, [o("div", {
280
280
  class: "message-avatar",
281
- style: p(R(e))
281
+ style: p(I(e))
282
282
  }, [e.role === "ai" ? (g(), r(u, {
283
283
  key: 0,
284
284
  size: 16
285
285
  }, {
286
- default: w(() => [c(S(H))]),
286
+ default: w(() => [c(S(B))]),
287
287
  _: 1
288
- })) : (g(), a("span", he, x(z(e)), 1))], 4), o("div", ge, [
288
+ })) : (g(), a("span", he, x(L(e)), 1))], 4), o("div", ge, [
289
289
  t.isCollab && e.role === "user" ? (g(), a("div", Q, [o("span", {
290
290
  class: "message-sender",
291
291
  style: p({ color: e.user_color || "#67C23A" })
@@ -296,8 +296,8 @@ var Y = (e, t) => {
296
296
  }, null, 8, ve),
297
297
  o("div", ye, x(e.time), 1)
298
298
  ])], 2))), 128)),
299
- t.loading ? (g(), a("div", $, [o("div", be, [c(u, { size: 16 }, {
300
- default: w(() => [c(S(H))]),
299
+ t.loading ? (g(), a("div", be, [o("div", xe, [c(u, { size: 16 }, {
300
+ default: w(() => [c(S(B))]),
301
301
  _: 1
302
302
  })]), l[7] ||= o("div", { class: "message-content" }, [o("div", { class: "message-text typing-indicator" }, [
303
303
  o("span"),
@@ -305,7 +305,7 @@ var Y = (e, t) => {
305
305
  o("span")
306
306
  ])], -1)])) : i("", !0)
307
307
  ], 512),
308
- o("div", xe, [o("div", {
308
+ o("div", Se, [o("div", {
309
309
  class: "chat-input-wrapper",
310
310
  ref_key: "inputWrapperRef",
311
311
  ref: D
@@ -320,21 +320,21 @@ var Y = (e, t) => {
320
320
  },
321
321
  placeholder: t.isCollab ? "输入消息... @提及成员" : "输入消息...",
322
322
  onKeydown: [
323
- T(E(re, ["exact"]), ["enter"]),
324
- T(E(V, ["prevent"]), ["down"]),
325
- T(E(W, ["prevent"]), ["up"])
323
+ T(E(W, ["exact"]), ["enter"]),
324
+ T(E(z, ["prevent"]), ["down"]),
325
+ T(E(H, ["prevent"]), ["up"])
326
326
  ],
327
- onInput: B,
327
+ onInput: R,
328
328
  resize: "none"
329
329
  }, null, 8, [
330
330
  "modelValue",
331
331
  "placeholder",
332
332
  "onKeydown"
333
333
  ]),
334
- O.value ? (g(), a("div", Se, [(g(!0), a(e, null, y(k.value, (e, t) => (g(), a("div", {
334
+ O.value ? (g(), a("div", Ce, [(g(!0), a(e, null, y(k.value, (e, t) => (g(), a("div", {
335
335
  key: e.id || e.clientId,
336
336
  class: f(["mention-item", { active: t === A.value }]),
337
- onClick: (t) => ne(e),
337
+ onClick: (t) => U(e),
338
338
  onMouseenter: (e) => A.value = t
339
339
  }, [o("div", {
340
340
  class: "mention-avatar",
@@ -343,18 +343,18 @@ var Y = (e, t) => {
343
343
  key: 0,
344
344
  size: 12
345
345
  }, {
346
- default: w(() => [c(S(H))]),
346
+ default: w(() => [c(S(B))]),
347
347
  _: 1
348
- })) : (g(), a("span", we, x((e.name || "U").charAt(0)), 1))], 4), o("span", null, x(e.name), 1)], 42, Ce))), 128))])) : i("", !0),
348
+ })) : (g(), a("span", we, x((e.name || "U").charAt(0)), 1))], 4), o("span", null, x(e.name), 1)], 42, $))), 128))])) : i("", !0),
349
349
  c(C, {
350
350
  class: "send-btn",
351
351
  type: "primary",
352
352
  circle: "",
353
353
  disabled: !h.value.trim() || t.loading,
354
- onClick: re
354
+ onClick: W
355
355
  }, {
356
356
  default: w(() => [c(u, null, {
357
- default: w(() => [c(S(U))]),
357
+ default: w(() => [c(S(V))]),
358
358
  _: 1
359
359
  })]),
360
360
  _: 1
@@ -513,8 +513,119 @@ function Ee() {
513
513
  };
514
514
  }
515
515
  //#endregion
516
+ //#region ../../src/composables/useAiApi.js
517
+ var De = [
518
+ "我可以帮您优化流程图布局、检查节点逻辑,或者提供流程设计建议。请问有什么需要帮助的?",
519
+ "这个流程图的节点连接看起来很清晰。建议检查一下是否有遗漏的分支或异常处理路径。",
520
+ "根据当前的流程结构,我建议在关键决策节点后添加明确的条件标注,使流程更易理解。",
521
+ "流程图中的泳道划分很合理。如果需要,我可以帮您分析各角色的职责分配是否均衡。",
522
+ "我可以帮您检查流程中是否存在循环依赖或死锁风险。需要我逐条分析吗?",
523
+ "建议在流程开始和结束节点使用统一的样式,这样可以让读者更快识别流程的起止点。",
524
+ "这个执行图的逻辑链路比较长,建议在中间添加一些检查点节点,便于流程监控和调试。",
525
+ "我可以帮您生成流程图的文字说明文档,方便团队成员理解流程细节。"
526
+ ];
527
+ function Oe() {
528
+ return De[Math.floor(Math.random() * De.length)];
529
+ }
530
+ async function ke(e, t, n) {
531
+ let r = { "Content-Type": "application/json" };
532
+ e.apiKey && (r.Authorization = `Bearer ${e.apiKey}`);
533
+ let i = await fetch(e.url, {
534
+ method: "POST",
535
+ headers: r,
536
+ body: JSON.stringify({
537
+ model: e.model || "gpt-4o-mini",
538
+ messages: t,
539
+ temperature: e.temperature ?? .7,
540
+ max_tokens: e.maxTokens ?? 4096
541
+ }),
542
+ signal: n
543
+ });
544
+ if (!i.ok) {
545
+ let e = await i.text().catch(() => "");
546
+ throw Error(`AI API error ${i.status}: ${e}`);
547
+ }
548
+ return (await i.json()).choices?.[0]?.message?.content || "";
549
+ }
550
+ function Ae(e) {
551
+ let t = v(!1), n = null, r = () => {
552
+ let t = typeof e == "function" ? e() : e;
553
+ return !!(t && t.url);
554
+ }, i = () => typeof e == "function" ? e() : e || {};
555
+ return {
556
+ loading: t,
557
+ isAvailable: r,
558
+ chat: async (e, r = []) => {
559
+ let a = i();
560
+ if (!a.url) return Oe();
561
+ t.value = !0, n && n.abort(), n = new AbortController();
562
+ try {
563
+ return await ke(a, [
564
+ {
565
+ role: "system",
566
+ content: a.chatPrompt || "你是一个有帮助的AI助手,擅长文档编辑和流程设计。请简洁回答用户问题。"
567
+ },
568
+ ...r.map((e) => ({
569
+ role: e.role === "ai" ? "assistant" : "user",
570
+ content: e.content
571
+ })),
572
+ {
573
+ role: "user",
574
+ content: e
575
+ }
576
+ ], n.signal);
577
+ } catch (e) {
578
+ return e.name === "AbortError" ? "" : (console.warn("[useAiApi] Chat error, falling back to mock:", e), Oe());
579
+ } finally {
580
+ t.value = !1;
581
+ }
582
+ },
583
+ generate: async (e, r) => {
584
+ let a = i();
585
+ if (!a.url) return {
586
+ success: !1,
587
+ message: "AI生成功能开发中,敬请期待..."
588
+ };
589
+ t.value = !0, n && n.abort(), n = new AbortController();
590
+ try {
591
+ let t = await ke(a, [{
592
+ role: "system",
593
+ content: a.generatePrompt || `你是一个专业的${r || "流程图"}生成助手。根据用户的描述,生成对应的JSON数据结构。只返回JSON,不要包含其他文字或markdown代码块标记。`
594
+ }, {
595
+ role: "user",
596
+ content: e
597
+ }], n.signal), i = null;
598
+ try {
599
+ let e = t.replace(/^```(?:json)?\s*/i, "").replace(/\s*```$/i, "").trim();
600
+ i = JSON.parse(e);
601
+ } catch {
602
+ i = null;
603
+ }
604
+ return {
605
+ success: !0,
606
+ content: t,
607
+ parsed: i
608
+ };
609
+ } catch (e) {
610
+ return e.name === "AbortError" ? {
611
+ success: !1,
612
+ message: "已取消"
613
+ } : (console.warn("[useAiApi] Generate error:", e), {
614
+ success: !1,
615
+ message: `AI生成失败: ${e.message}`
616
+ });
617
+ } finally {
618
+ t.value = !1;
619
+ }
620
+ },
621
+ abort: () => {
622
+ n &&= (n.abort(), null);
623
+ }
624
+ };
625
+ }
626
+ //#endregion
516
627
  //#region ../../src/composables/useVersionHistory.js
517
- var De = "/api/document-versions", Oe = 5e3, ke = () => {
628
+ var je = "/api/document-versions", Me = 5e3, Ne = () => {
518
629
  let e = v([]), t = v(!1);
519
630
  return {
520
631
  versions: e,
@@ -522,13 +633,13 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
522
633
  saveVersion: async ({ documentId: e, docType: t, content: n, userId: r, userName: i }) => {
523
634
  if (!e || !t || !n) return null;
524
635
  try {
525
- let { data: a } = await q.post(De, {
636
+ let { data: a } = await q.post(je, {
526
637
  document_id: e,
527
638
  doc_type: t,
528
639
  content: typeof n == "string" ? n : JSON.stringify(n),
529
640
  user_id: r || null,
530
641
  user_name: i || null
531
- }, { timeout: Oe });
642
+ }, { timeout: Me });
532
643
  return a;
533
644
  } catch (e) {
534
645
  return console.warn("[useVersionHistory] Failed to save version:", e), null;
@@ -538,9 +649,9 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
538
649
  if (!n) return [];
539
650
  t.value = !0;
540
651
  try {
541
- let { data: t } = await q.get(De, {
652
+ let { data: t } = await q.get(je, {
542
653
  params: { document_id: n },
543
- timeout: Oe
654
+ timeout: Me
544
655
  });
545
656
  return e.value = t, t;
546
657
  } catch (t) {
@@ -551,26 +662,26 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
551
662
  },
552
663
  getVersionContent: async (e) => {
553
664
  try {
554
- let { data: t } = await q.get(`${De}/${e}`, { timeout: Oe });
665
+ let { data: t } = await q.get(`${je}/${e}`, { timeout: Me });
555
666
  return t;
556
667
  } catch (e) {
557
668
  return console.warn("[useVersionHistory] Failed to get version content:", e), null;
558
669
  }
559
670
  }
560
671
  };
561
- }, Ae = { class: "version-history-panel" }, je = {
672
+ }, Pe = { class: "version-history-panel" }, Fe = {
562
673
  key: 0,
563
674
  class: "loading-state"
564
- }, Me = {
675
+ }, Ie = {
565
676
  key: 1,
566
677
  class: "empty-state"
567
- }, Ne = {
678
+ }, Le = {
568
679
  key: 2,
569
680
  class: "version-list"
570
- }, Pe = {
681
+ }, Re = {
571
682
  key: 0,
572
683
  class: "current-version"
573
- }, Fe = { class: "current-version-header" }, Ie = { class: "version-number" }, Le = ["onClick"], Re = { class: "version-number" }, ze = { class: "version-user" }, Be = { class: "panel-footer" }, Ve = /*#__PURE__*/ Y({
684
+ }, ze = { class: "current-version-header" }, Be = { class: "version-number" }, Ve = ["onClick"], He = { class: "version-number" }, Ue = { class: "version-user" }, We = { class: "panel-footer" }, Ge = /*#__PURE__*/ J({
574
685
  __name: "VersionHistoryPanel",
575
686
  props: {
576
687
  modelValue: {
@@ -584,7 +695,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
584
695
  },
585
696
  emits: ["update:modelValue", "apply"],
586
697
  setup(t, { expose: n, emit: l }) {
587
- let u = t, d = l, { versions: p, loading: m, loadVersions: h, getVersionContent: _ } = ke(), T = v(!1), E = v(null), D = v(!1), O = v(null);
698
+ let u = t, d = l, { versions: p, loading: m, loadVersions: h, getVersionContent: _ } = Ne(), T = v(!1), E = v(null), D = v(!1), O = v(null);
588
699
  C(() => u.modelValue, (e) => {
589
700
  T.value = e, e && u.documentId && (E.value = null, h(u.documentId).then((e) => {
590
701
  e && e.length > 0 && (O.value = e[0]);
@@ -606,7 +717,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
606
717
  }
607
718
  }, M = () => {
608
719
  T.value = !1;
609
- }, ee = (e) => {
720
+ }, N = (e) => {
610
721
  if (!e) return "";
611
722
  let t = new Date(e), n = (e) => String(e).padStart(2, "0");
612
723
  return `${t.getFullYear()}-${n(t.getMonth() + 1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
@@ -621,7 +732,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
621
732
  size: "420px",
622
733
  "before-close": M
623
734
  }, {
624
- footer: w(() => [o("div", Be, [c(_, {
735
+ footer: w(() => [o("div", We, [c(_, {
625
736
  type: "primary",
626
737
  disabled: !E.value,
627
738
  loading: D.value,
@@ -630,25 +741,25 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
630
741
  default: w(() => [...n[4] ||= [s(" 切换到此版本 ", -1)]]),
631
742
  _: 1
632
743
  }, 8, ["disabled", "loading"])])]),
633
- default: w(() => [o("div", Ae, [S(m) ? (g(), a("div", je, [c(l, { class: "is-loading" }, {
634
- default: w(() => [c(S(V))]),
744
+ default: w(() => [o("div", Pe, [S(m) ? (g(), a("div", Fe, [c(l, { class: "is-loading" }, {
745
+ default: w(() => [c(S(z))]),
635
746
  _: 1
636
- }), n[1] ||= o("span", null, "加载中...", -1)])) : S(p).length === 0 ? (g(), a("div", Me, [c(l, {
747
+ }), n[1] ||= o("span", null, "加载中...", -1)])) : S(p).length === 0 ? (g(), a("div", Ie, [c(l, {
637
748
  size: 48,
638
749
  color: "#c0c4cc"
639
750
  }, {
640
751
  default: w(() => [c(S(P))]),
641
752
  _: 1
642
- }), n[2] ||= o("p", null, "暂无历史版本", -1)])) : (g(), a("div", Ne, [O.value ? (g(), a("div", Pe, [o("div", Fe, [c(u, {
753
+ }), n[2] ||= o("p", null, "暂无历史版本", -1)])) : (g(), a("div", Le, [O.value ? (g(), a("div", Re, [o("div", ze, [c(u, {
643
754
  type: "success",
644
755
  size: "small"
645
756
  }, {
646
757
  default: w(() => [...n[3] ||= [s("当前版本", -1)]]),
647
758
  _: 1
648
- }), o("span", Ie, "v" + x(O.value.version_number), 1)])])) : i("", !0), c(h, null, {
759
+ }), o("span", Be, "v" + x(O.value.version_number), 1)])])) : i("", !0), c(h, null, {
649
760
  default: w(() => [(g(!0), a(e, null, y(S(p), (e) => (g(), r(d, {
650
761
  key: e.id,
651
- timestamp: ee(e.created_at),
762
+ timestamp: N(e.created_at),
652
763
  placement: "top",
653
764
  type: E.value?.id === e.id ? "primary" : "",
654
765
  hollow: E.value?.id !== e.id
@@ -656,7 +767,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
656
767
  default: w(() => [o("div", {
657
768
  class: f(["version-item", { active: E.value?.id === e.id }]),
658
769
  onClick: (t) => k(e)
659
- }, [o("span", Re, "版本号:v" + x(e.version_number), 1), o("span", ze, "提交人:" + x(e.user_name || "未知用户"), 1)], 10, Le)]),
770
+ }, [o("span", He, "版本号:v" + x(e.version_number), 1), o("span", Ue, "提交人:" + x(e.user_name || "未知用户"), 1)], 10, Ve)]),
660
771
  _: 2
661
772
  }, 1032, [
662
773
  "timestamp",
@@ -669,10 +780,10 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
669
780
  }, 8, ["modelValue"]);
670
781
  };
671
782
  }
672
- }, [["__scopeId", "data-v-87924b7c"]]), He = { class: "toolbar" }, Ue = { class: "toolbar-left" }, We = { class: "toolbar-center" }, Ge = { class: "toolbar-right" }, Ke = {
783
+ }, [["__scopeId", "data-v-87924b7c"]]), Ke = { class: "toolbar" }, qe = { class: "toolbar-left" }, Je = { class: "toolbar-center" }, Ye = { class: "toolbar-right" }, Xe = {
673
784
  key: 0,
674
785
  class: "collab-users"
675
- }, qe = ["title"], Je = /*#__PURE__*/ Y({
786
+ }, Ze = ["title"], Qe = /*#__PURE__*/ J({
676
787
  __name: "Toolbar",
677
788
  props: {
678
789
  title: {
@@ -691,6 +802,14 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
691
802
  showHistory: {
692
803
  type: Boolean,
693
804
  default: !1
805
+ },
806
+ showBackButton: {
807
+ type: Boolean,
808
+ default: !0
809
+ },
810
+ titleDisabled: {
811
+ type: Boolean,
812
+ default: !1
694
813
  }
695
814
  },
696
815
  emits: [
@@ -716,26 +835,28 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
716
835
  let n = t, l = v(n.title);
717
836
  return C(() => n.title, (e) => l.value = e), (n, u) => {
718
837
  let d = b("el-icon"), f = b("el-button"), m = b("el-input"), h = b("el-dropdown-item"), _ = b("el-dropdown-menu"), v = b("el-dropdown"), C = b("el-tooltip"), T = b("el-divider");
719
- return g(), a("div", He, [
720
- o("div", Ue, [c(f, {
838
+ return g(), a("div", Ke, [
839
+ o("div", qe, [t.showBackButton ? (g(), r(f, {
840
+ key: 0,
721
841
  onClick: u[0] ||= (e) => n.$emit("back"),
722
842
  size: "small",
723
843
  circle: ""
724
844
  }, {
725
845
  default: w(() => [c(d, null, {
726
- default: w(() => [c(S(ee))]),
846
+ default: w(() => [c(S(N))]),
727
847
  _: 1
728
848
  })]),
729
849
  _: 1
730
- }), c(m, {
850
+ })) : i("", !0), c(m, {
731
851
  modelValue: l.value,
732
852
  "onUpdate:modelValue": u[1] ||= (e) => l.value = e,
733
853
  onBlur: u[2] ||= (e) => n.$emit("update:title", l.value),
854
+ disabled: t.titleDisabled,
734
855
  placeholder: "输入标题",
735
856
  class: "title-input",
736
857
  size: "small"
737
- }, null, 8, ["modelValue"])]),
738
- o("div", We, [
858
+ }, null, 8, ["modelValue", "disabled"])]),
859
+ o("div", Je, [
739
860
  c(v, {
740
861
  trigger: "click",
741
862
  onCommand: u[3] ||= (e) => n.$emit("add-component", e)
@@ -799,7 +920,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
799
920
  onClick: u[4] ||= (e) => n.$emit("export-json")
800
921
  }, {
801
922
  default: w(() => [c(d, null, {
802
- default: w(() => [c(S(R))]),
923
+ default: w(() => [c(S(I))]),
803
924
  _: 1
804
925
  })]),
805
926
  _: 1
@@ -834,7 +955,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
834
955
  title: "将选中零件组合为一个"
835
956
  }, {
836
957
  default: w(() => [c(d, null, {
837
- default: w(() => [c(S(z))]),
958
+ default: w(() => [c(S(L))]),
838
959
  _: 1
839
960
  })]),
840
961
  _: 1
@@ -853,7 +974,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
853
974
  onClick: u[7] ||= (e) => n.$emit("toggle-connecting")
854
975
  }, {
855
976
  default: w(() => [c(d, null, {
856
- default: w(() => [c(S(I))]),
977
+ default: w(() => [c(S(ne))]),
857
978
  _: 1
858
979
  })]),
859
980
  _: 1
@@ -875,7 +996,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
875
996
  disabled: !t.canUndo
876
997
  }, {
877
998
  default: w(() => [c(d, null, {
878
- default: w(() => [c(S(W))]),
999
+ default: w(() => [c(S(H))]),
879
1000
  _: 1
880
1001
  })]),
881
1002
  _: 1
@@ -887,7 +1008,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
887
1008
  disabled: !t.canRedo
888
1009
  }, {
889
1010
  default: w(() => [c(d, null, {
890
- default: w(() => [c(S(ne))]),
1011
+ default: w(() => [c(S(U))]),
891
1012
  _: 1
892
1013
  })]),
893
1014
  _: 1
@@ -899,7 +1020,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
899
1020
  onClick: u[11] ||= (e) => n.$emit("zoom-in")
900
1021
  }, {
901
1022
  default: w(() => [c(d, null, {
902
- default: w(() => [c(S(ie))]),
1023
+ default: w(() => [c(S(K))]),
903
1024
  _: 1
904
1025
  })]),
905
1026
  _: 1
@@ -910,19 +1031,19 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
910
1031
  onClick: u[12] ||= (e) => n.$emit("zoom-out")
911
1032
  }, {
912
1033
  default: w(() => [c(d, null, {
913
- default: w(() => [c(S(K))]),
1034
+ default: w(() => [c(S(ie))]),
914
1035
  _: 1
915
1036
  })]),
916
1037
  _: 1
917
1038
  })
918
1039
  ]),
919
- o("div", Ge, [
920
- t.onlineUsers.length > 0 ? (g(), a("div", Ke, [(g(!0), a(e, null, y(t.onlineUsers.slice(0, 5), (e) => (g(), a("div", {
1040
+ o("div", Ye, [
1041
+ t.onlineUsers.length > 0 ? (g(), a("div", Xe, [(g(!0), a(e, null, y(t.onlineUsers.slice(0, 5), (e) => (g(), a("div", {
921
1042
  key: e.clientId,
922
1043
  class: "collab-avatar",
923
1044
  style: p({ background: e.color }),
924
1045
  title: e.name
925
- }, x(e.name?.charAt(0)), 13, qe))), 128))])) : i("", !0),
1046
+ }, x(e.name?.charAt(0)), 13, Ze))), 128))])) : i("", !0),
926
1047
  t.isJoinMode ? i("", !0) : (g(), r(f, {
927
1048
  key: 1,
928
1049
  size: "small",
@@ -930,7 +1051,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
930
1051
  onClick: u[13] ||= (e) => n.$emit("toggle-collab")
931
1052
  }, {
932
1053
  default: w(() => [c(d, null, {
933
- default: w(() => [c(S(re))]),
1054
+ default: w(() => [c(S(W))]),
934
1055
  _: 1
935
1056
  }), o("span", null, x(t.isConnected ? "协作中" : "协作"), 1)]),
936
1057
  _: 1
@@ -943,7 +1064,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
943
1064
  title: "分享链接"
944
1065
  }, {
945
1066
  default: w(() => [c(d, null, {
946
- default: w(() => [c(S(B))]),
1067
+ default: w(() => [c(S(R))]),
947
1068
  _: 1
948
1069
  })]),
949
1070
  _: 1
@@ -988,7 +1109,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
988
1109
  onClick: u[16] ||= (e) => n.$emit("save")
989
1110
  }, {
990
1111
  default: w(() => [c(d, null, {
991
- default: w(() => [c(S(R))]),
1112
+ default: w(() => [c(S(I))]),
992
1113
  _: 1
993
1114
  })]),
994
1115
  _: 1
@@ -1010,38 +1131,38 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1010
1131
  ]);
1011
1132
  };
1012
1133
  }
1013
- }, [["__scopeId", "data-v-919c0dae"]]), Ye = ["viewBox"], Xe = ["id"], Ze = [
1134
+ }, [["__scopeId", "data-v-5c549dd2"]]), $e = ["viewBox"], et = ["id"], tt = [
1014
1135
  "x",
1015
1136
  "y",
1016
1137
  "width",
1017
1138
  "height"
1018
- ], Qe = [
1139
+ ], nt = [
1019
1140
  "transform",
1020
1141
  "onMousedown",
1021
1142
  "onDblclick",
1022
1143
  "onMouseenter"
1023
- ], $e = [
1144
+ ], rt = [
1024
1145
  "href",
1025
1146
  "width",
1026
1147
  "height"
1027
- ], et = ["innerHTML", "transform"], tt = [
1148
+ ], it = ["innerHTML", "transform"], at = [
1028
1149
  "points",
1029
1150
  "fill",
1030
1151
  "stroke",
1031
1152
  "stroke-width"
1032
- ], nt = [
1153
+ ], ot = [
1033
1154
  "width",
1034
1155
  "height",
1035
1156
  "fill",
1036
1157
  "stroke",
1037
1158
  "stroke-width"
1038
- ], rt = [
1159
+ ], st = [
1039
1160
  "width",
1040
1161
  "height",
1041
1162
  "fill",
1042
1163
  "stroke",
1043
1164
  "stroke-width"
1044
- ], it = [
1165
+ ], ct = [
1045
1166
  "cx",
1046
1167
  "cy",
1047
1168
  "rx",
@@ -1049,67 +1170,67 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1049
1170
  "fill",
1050
1171
  "stroke",
1051
1172
  "stroke-width"
1052
- ], at = [
1173
+ ], lt = [
1053
1174
  "points",
1054
1175
  "fill",
1055
1176
  "stroke",
1056
1177
  "stroke-width"
1057
- ], ot = [
1178
+ ], ut = [
1058
1179
  "points",
1059
1180
  "fill",
1060
1181
  "stroke",
1061
1182
  "stroke-width"
1062
- ], st = [
1183
+ ], dt = [
1063
1184
  "width",
1064
1185
  "height",
1065
1186
  "stroke",
1066
1187
  "stroke-width"
1067
- ], ct = [
1188
+ ], ft = [
1068
1189
  "x",
1069
1190
  "y",
1070
1191
  "fill",
1071
1192
  "font-size"
1072
- ], lt = ["x", "y"], ut = [
1193
+ ], pt = ["x", "y"], mt = [
1073
1194
  "x",
1074
1195
  "y",
1075
1196
  "fill",
1076
1197
  "font-size"
1077
- ], dt = [
1198
+ ], ht = [
1078
1199
  "x",
1079
1200
  "y",
1080
1201
  "fill",
1081
1202
  "font-size"
1082
- ], ft = ["x", "y"], pt = { key: 12 }, mt = [
1203
+ ], gt = ["x", "y"], _t = { key: 12 }, vt = [
1083
1204
  "x",
1084
1205
  "y",
1085
1206
  "onMousedown"
1086
- ], ht = ["y", "onMousedown"], gt = ["x", "onMousedown"], _t = ["onMousedown"], vt = { key: 13 }, yt = [
1207
+ ], yt = ["y", "onMousedown"], bt = ["x", "onMousedown"], xt = ["onMousedown"], St = { key: 13 }, Ct = [
1087
1208
  "cx",
1088
1209
  "cy",
1089
1210
  "onMousedown"
1090
- ], bt = ["x", "y"], xt = [
1211
+ ], wt = ["x", "y"], Tt = [
1091
1212
  "d",
1092
1213
  "stroke",
1093
1214
  "stroke-width",
1094
1215
  "stroke-dasharray",
1095
1216
  "onMousedown"
1096
- ], St = ["x", "y"], Ct = [
1217
+ ], Et = ["x", "y"], Dt = [
1097
1218
  "x1",
1098
1219
  "y1",
1099
1220
  "x2",
1100
1221
  "y2"
1101
- ], wt = { key: 1 }, Tt = [
1222
+ ], Ot = { key: 1 }, kt = [
1102
1223
  "cx",
1103
1224
  "cy",
1104
1225
  "onMousedown"
1105
- ], Et = [
1226
+ ], At = [
1106
1227
  "href",
1107
1228
  "x",
1108
1229
  "y",
1109
1230
  "width",
1110
1231
  "height",
1111
1232
  "clip-path"
1112
- ], Dt = { class: "popup-tooltip-key" }, Ot = { class: "popup-tooltip-val" }, kt = /*#__PURE__*/ Y({
1233
+ ], jt = { class: "popup-tooltip-key" }, Mt = { class: "popup-tooltip-val" }, Nt = /*#__PURE__*/ J({
1113
1234
  __name: "DiagramCanvas",
1114
1235
  props: {
1115
1236
  components: {
@@ -1276,7 +1397,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1276
1397
  width: e.width,
1277
1398
  height: e.height,
1278
1399
  rx: "4"
1279
- }, null, 8, Ze)], 8, Xe))), 128))]),
1400
+ }, null, 8, tt)], 8, et))), 128))]),
1280
1401
  (g(!0), a(e, null, y(m.value, (s) => (g(), a("g", {
1281
1402
  key: s.id,
1282
1403
  transform: `translate(${s.x}, ${s.y})`,
@@ -1293,19 +1414,19 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1293
1414
  height: s.height,
1294
1415
  preserveAspectRatio: "xMidYMid meet",
1295
1416
  style: p({ pointerEvents: b(s) ? "none" : "all" })
1296
- }, null, 12, $e)) : s.shape === "svg" ? (g(), a("g", {
1417
+ }, null, 12, rt)) : s.shape === "svg" ? (g(), a("g", {
1297
1418
  key: 1,
1298
1419
  innerHTML: s.svgContent || "",
1299
1420
  transform: `scale(${s.width / (s.svgWidth || 100)}, ${s.height / (s.svgHeight || 100)})`,
1300
1421
  style: p({ pointerEvents: b(s) ? "none" : "all" })
1301
- }, null, 12, et)) : s.shape === "polygon" ? (g(), a("polygon", {
1422
+ }, null, 12, it)) : s.shape === "polygon" ? (g(), a("polygon", {
1302
1423
  key: 2,
1303
1424
  points: s.points || "",
1304
1425
  fill: s.fill || "#fff",
1305
1426
  stroke: t.selectedIds.includes(s.id) ? "#409EFF" : s.stroke || "#ccc",
1306
1427
  "stroke-width": t.selectedIds.includes(s.id) ? 2 : 1,
1307
1428
  style: p({ pointerEvents: b(s) ? "none" : "all" })
1308
- }, null, 12, tt)) : s.shape === "group" && s.id !== t.expandedGroupId ? (g(), a("rect", {
1429
+ }, null, 12, at)) : s.shape === "group" && s.id !== t.expandedGroupId ? (g(), a("rect", {
1309
1430
  key: 3,
1310
1431
  width: s.width,
1311
1432
  height: s.height,
@@ -1314,7 +1435,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1314
1435
  "stroke-dasharray": "6,3",
1315
1436
  "stroke-width": t.selectedIds.includes(s.id) ? 2 : 1,
1316
1437
  style: { "pointer-events": "all" }
1317
- }, null, 8, nt)) : s.shape === "rect" ? (g(), a("rect", {
1438
+ }, null, 8, ot)) : s.shape === "rect" ? (g(), a("rect", {
1318
1439
  key: 4,
1319
1440
  width: s.width,
1320
1441
  height: s.height,
@@ -1323,7 +1444,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1323
1444
  stroke: t.selectedIds.includes(s.id) ? "#409EFF" : s.stroke || "#ccc",
1324
1445
  "stroke-width": t.selectedIds.includes(s.id) ? 2 : 1,
1325
1446
  style: p({ pointerEvents: b(s) ? "none" : "all" })
1326
- }, null, 12, rt)) : s.shape === "circle" ? (g(), a("ellipse", {
1447
+ }, null, 12, st)) : s.shape === "circle" ? (g(), a("ellipse", {
1327
1448
  key: 5,
1328
1449
  cx: s.width / 2,
1329
1450
  cy: s.height / 2,
@@ -1333,21 +1454,21 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1333
1454
  stroke: t.selectedIds.includes(s.id) ? "#409EFF" : s.stroke || "#ccc",
1334
1455
  "stroke-width": t.selectedIds.includes(s.id) ? 2 : 1,
1335
1456
  style: p({ pointerEvents: b(s) ? "none" : "all" })
1336
- }, null, 12, it)) : s.shape === "diamond" ? (g(), a("polygon", {
1457
+ }, null, 12, ct)) : s.shape === "diamond" ? (g(), a("polygon", {
1337
1458
  key: 6,
1338
1459
  points: `${s.width / 2},0 ${s.width},${s.height / 2} ${s.width / 2},${s.height} 0,${s.height / 2}`,
1339
1460
  fill: s.fill || "#fff",
1340
1461
  stroke: t.selectedIds.includes(s.id) ? "#409EFF" : s.stroke || "#ccc",
1341
1462
  "stroke-width": t.selectedIds.includes(s.id) ? 2 : 1,
1342
1463
  style: p({ pointerEvents: b(s) ? "none" : "all" })
1343
- }, null, 12, at)) : s.shape === "triangle" ? (g(), a("polygon", {
1464
+ }, null, 12, lt)) : s.shape === "triangle" ? (g(), a("polygon", {
1344
1465
  key: 7,
1345
1466
  points: `${s.width / 2},0 ${s.width},${s.height} 0,${s.height}`,
1346
1467
  fill: s.fill || "#fff",
1347
1468
  stroke: t.selectedIds.includes(s.id) ? "#409EFF" : s.stroke || "#ccc",
1348
1469
  "stroke-width": t.selectedIds.includes(s.id) ? 2 : 1,
1349
1470
  style: p({ pointerEvents: b(s) ? "none" : "all" })
1350
- }, null, 12, ot)) : (g(), a("rect", {
1471
+ }, null, 12, ut)) : (g(), a("rect", {
1351
1472
  key: 8,
1352
1473
  width: s.width,
1353
1474
  height: s.height,
@@ -1355,7 +1476,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1355
1476
  stroke: t.selectedIds.includes(s.id) ? "#409EFF" : "#ccc",
1356
1477
  "stroke-width": t.selectedIds.includes(s.id) ? 2 : 1,
1357
1478
  style: p({ pointerEvents: b(s) ? "none" : "all" })
1358
- }, null, 12, st)),
1479
+ }, null, 12, dt)),
1359
1480
  s.shape === "image" ? (g(), a(e, { key: 9 }, [o("text", {
1360
1481
  x: s.width / 2,
1361
1482
  y: s.height + 10,
@@ -1364,7 +1485,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1364
1485
  fill: s.textColor || "#333",
1365
1486
  "font-size": s.fontSize || 14,
1366
1487
  style: { "pointer-events": "none" }
1367
- }, x(s.label), 9, ct), s.description ? (g(), a("text", {
1488
+ }, x(s.label), 9, ft), s.description ? (g(), a("text", {
1368
1489
  key: 0,
1369
1490
  x: s.width / 2,
1370
1491
  y: s.height + 10 + (s.fontSize || 14) + 2,
@@ -1373,7 +1494,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1373
1494
  fill: "#999",
1374
1495
  "font-size": "11",
1375
1496
  style: { "pointer-events": "none" }
1376
- }, x(s.description), 9, lt)) : i("", !0)], 64)) : s.shape === "group" && s.id !== t.expandedGroupId ? (g(), a("text", {
1497
+ }, x(s.description), 9, pt)) : i("", !0)], 64)) : s.shape === "group" && s.id !== t.expandedGroupId ? (g(), a("text", {
1377
1498
  key: 10,
1378
1499
  x: s.width / 2,
1379
1500
  y: s.height + 10,
@@ -1382,7 +1503,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1382
1503
  fill: s.textColor || "#333",
1383
1504
  "font-size": s.fontSize || 14,
1384
1505
  style: { "pointer-events": "none" }
1385
- }, x(s.label), 9, ut)) : s.shape === "group" ? i("", !0) : (g(), a(e, { key: 11 }, [o("text", {
1506
+ }, x(s.label), 9, mt)) : s.shape === "group" ? i("", !0) : (g(), a(e, { key: 11 }, [o("text", {
1386
1507
  x: s.width / 2,
1387
1508
  y: s.height / 2 - (s.description ? 6 : 0),
1388
1509
  "text-anchor": "middle",
@@ -1390,7 +1511,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1390
1511
  fill: s.textColor || "#333",
1391
1512
  "font-size": s.fontSize || 14,
1392
1513
  style: { "pointer-events": "none" }
1393
- }, x(s.label), 9, dt), s.description ? (g(), a("text", {
1514
+ }, x(s.label), 9, ht), s.description ? (g(), a("text", {
1394
1515
  key: 0,
1395
1516
  x: s.width / 2,
1396
1517
  y: s.height / 2 + 12,
@@ -1399,8 +1520,8 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1399
1520
  fill: "#999",
1400
1521
  "font-size": "11",
1401
1522
  style: { "pointer-events": "none" }
1402
- }, x(s.description), 9, ft)) : i("", !0)], 64)),
1403
- t.selectedIds.includes(s.id) && !b(s) ? (g(), a("g", pt, [
1523
+ }, x(s.description), 9, gt)) : i("", !0)], 64)),
1524
+ t.selectedIds.includes(s.id) && !b(s) ? (g(), a("g", _t, [
1404
1525
  o("rect", {
1405
1526
  x: s.width - 5,
1406
1527
  y: s.height - 5,
@@ -1411,7 +1532,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1411
1532
  "stroke-width": "1",
1412
1533
  style: { cursor: "nwse-resize" },
1413
1534
  onMousedown: E((e) => n.$emit("start-resize", s, "se", e), ["stop"])
1414
- }, null, 40, mt),
1535
+ }, null, 40, vt),
1415
1536
  o("rect", {
1416
1537
  x: -5,
1417
1538
  y: s.height - 5,
@@ -1422,7 +1543,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1422
1543
  "stroke-width": "1",
1423
1544
  style: { cursor: "nesw-resize" },
1424
1545
  onMousedown: E((e) => n.$emit("start-resize", s, "sw", e), ["stop"])
1425
- }, null, 40, ht),
1546
+ }, null, 40, yt),
1426
1547
  o("rect", {
1427
1548
  x: s.width - 5,
1428
1549
  y: -5,
@@ -1433,7 +1554,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1433
1554
  "stroke-width": "1",
1434
1555
  style: { cursor: "nesw-resize" },
1435
1556
  onMousedown: E((e) => n.$emit("start-resize", s, "ne", e), ["stop"])
1436
- }, null, 40, gt),
1557
+ }, null, 40, bt),
1437
1558
  o("rect", {
1438
1559
  x: -5,
1439
1560
  y: -5,
@@ -1444,9 +1565,9 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1444
1565
  "stroke-width": "1",
1445
1566
  style: { cursor: "nwse-resize" },
1446
1567
  onMousedown: E((e) => n.$emit("start-resize", s, "nw", e), ["stop"])
1447
- }, null, 40, _t)
1568
+ }, null, 40, xt)
1448
1569
  ])) : i("", !0),
1449
- (t.selectedIds.includes(s.id) || t.connectingMode) && !b(s) && !(t.editingPolygon && t.editingPolygon.id === s.id) ? (g(), a("g", vt, [(g(!0), a(e, null, y(w(s), (e, t) => (g(), a("circle", {
1570
+ (t.selectedIds.includes(s.id) || t.connectingMode) && !b(s) && !(t.editingPolygon && t.editingPolygon.id === s.id) ? (g(), a("g", St, [(g(!0), a(e, null, y(w(s), (e, t) => (g(), a("circle", {
1450
1571
  key: t,
1451
1572
  cx: e.x,
1452
1573
  cy: e.y,
@@ -1456,7 +1577,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1456
1577
  "stroke-width": "1",
1457
1578
  style: { cursor: "crosshair" },
1458
1579
  onMousedown: E((t) => n.$emit("start-connect", s, e, t), ["stop"])
1459
- }, null, 40, yt))), 128))])) : i("", !0),
1580
+ }, null, 40, Ct))), 128))])) : i("", !0),
1460
1581
  t.editingPolygon && t.editingPolygon.id === s.id ? (g(), a("text", {
1461
1582
  key: 14,
1462
1583
  x: s.width / 2,
@@ -1465,8 +1586,8 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1465
1586
  fill: "#409EFF",
1466
1587
  "font-size": "11",
1467
1588
  style: { "pointer-events": "none" }
1468
- }, "双击退出编辑", 8, bt)) : i("", !0)
1469
- ], 44, Qe))), 128)),
1589
+ }, "双击退出编辑", 8, wt)) : i("", !0)
1590
+ ], 44, nt))), 128)),
1470
1591
  (g(!0), a(e, null, y(t.connections, (e) => (g(), a("g", {
1471
1592
  key: e.id,
1472
1593
  style: p(S(e) ? "pointer-events:none;opacity:0.5;" : "")
@@ -1480,14 +1601,14 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1480
1601
  "pointer-events": "stroke",
1481
1602
  style: { cursor: "pointer" },
1482
1603
  onMousedown: E((t) => n.$emit("select", e, "connection", t), ["stop"])
1483
- }, null, 40, xt), e.label ? (g(), a("text", {
1604
+ }, null, 40, Tt), e.label ? (g(), a("text", {
1484
1605
  key: 0,
1485
1606
  x: D(e).x,
1486
1607
  y: D(e).y - 6,
1487
1608
  "text-anchor": "middle",
1488
1609
  fill: "#666",
1489
1610
  "font-size": "12"
1490
- }, x(e.label), 9, St)) : i("", !0)], 4))), 128)),
1611
+ }, x(e.label), 9, Et)) : i("", !0)], 4))), 128)),
1491
1612
  t.drawingConn ? (g(), a("line", {
1492
1613
  key: 0,
1493
1614
  x1: t.drawingConn.x1,
@@ -1497,8 +1618,8 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1497
1618
  stroke: "#409EFF",
1498
1619
  "stroke-width": "2",
1499
1620
  "stroke-dasharray": "4,4"
1500
- }, null, 8, Ct)) : i("", !0),
1501
- t.editingPolygon ? (g(), a("g", wt, [(g(!0), a(e, null, y(C.value, (e, n) => (g(), a("circle", {
1621
+ }, null, 8, Dt)) : i("", !0),
1622
+ t.editingPolygon ? (g(), a("g", Ot, [(g(!0), a(e, null, y(C.value, (e, n) => (g(), a("circle", {
1502
1623
  key: "pv-" + n,
1503
1624
  cx: t.editingPolygon.x + e.x,
1504
1625
  cy: t.editingPolygon.y + e.y,
@@ -1508,7 +1629,7 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1508
1629
  "stroke-width": "1.5",
1509
1630
  style: { cursor: "move" },
1510
1631
  onMousedown: E((e) => j(t.editingPolygon, n, e), ["stop"])
1511
- }, null, 40, Tt))), 128))])) : i("", !0),
1632
+ }, null, 40, kt))), 128))])) : i("", !0),
1512
1633
  (g(!0), a(e, null, y(m.value, (e) => (g(), a("g", { key: "img-" + e.id }, [e.shape === "group" && e.imageUrl && e.id !== t.expandedGroupId ? (g(), a("image", {
1513
1634
  key: 0,
1514
1635
  href: e.imageUrl,
@@ -1519,8 +1640,8 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1519
1640
  preserveAspectRatio: "xMidYMid slice",
1520
1641
  "clip-path": `url(#clip-${e.id})`,
1521
1642
  style: { "pointer-events": "none" }
1522
- }, null, 8, Et)) : i("", !0)]))), 128))
1523
- ], 40, Ye)), d.value && d.value.popupConfig && d.value.popupConfig.length ? (g(), a("div", {
1643
+ }, null, 8, At)) : i("", !0)]))), 128))
1644
+ ], 40, $e)), d.value && d.value.popupConfig && d.value.popupConfig.length ? (g(), a("div", {
1524
1645
  key: 0,
1525
1646
  class: "popup-tooltip",
1526
1647
  style: p({
@@ -1530,13 +1651,13 @@ var De = "/api/document-versions", Oe = 5e3, ke = () => {
1530
1651
  }, [(g(!0), a(e, null, y(d.value.popupConfig, (e, t) => (g(), a("div", {
1531
1652
  key: t,
1532
1653
  class: "popup-tooltip-row"
1533
- }, [o("span", Dt, x(e.key) + ":", 1), o("span", Ot, x(e.value), 1)]))), 128))], 4)) : i("", !0)], 512));
1654
+ }, [o("span", jt, x(e.key) + ":", 1), o("span", Mt, x(e.value), 1)]))), 128))], 4)) : i("", !0)], 512));
1534
1655
  }
1535
1656
  }, [["__scopeId", "data-v-f89f4797"]]);
1536
1657
  //#endregion
1537
1658
  //#region ../../src/composables/useExplosionCollaboration.js
1538
- function At(e, { roomPrefix: t, syncKey: n = "_data" } = {}) {
1539
- let r = new J.Doc(), i = v(!1), a = v(!1), o = v(!1), s = v(!1), c = v([]), l = null, u = null, d = null, f = null, p = !1, m = null, g = `ws://${window.location.hostname || "localhost"}:1234`, _ = `${t}-${e}`, y = () => {
1659
+ function Pt(e, { roomPrefix: t, syncKey: n = "_data" } = {}) {
1660
+ let r = new ae.Doc(), i = v(!1), a = v(!1), o = v(!1), s = v(!1), c = v([]), l = null, u = null, d = null, f = null, p = !1, m = null, g = `ws://${window.location.hostname || "localhost"}:1234`, _ = `${t}-${e}`, y = () => {
1540
1661
  b(), m = setInterval(() => {
1541
1662
  if (l && l.connection && l.connection.ws && l.connection.ws.readyState === WebSocket.CLOSED) try {
1542
1663
  l.connect();
@@ -1547,7 +1668,7 @@ function At(e, { roomPrefix: t, syncKey: n = "_data" } = {}) {
1547
1668
  }, b = () => {
1548
1669
  m &&= (clearInterval(m), null);
1549
1670
  };
1550
- l = new ae({
1671
+ l = new oe({
1551
1672
  url: g,
1552
1673
  name: _,
1553
1674
  document: r,
@@ -1650,8 +1771,8 @@ function At(e, { roomPrefix: t, syncKey: n = "_data" } = {}) {
1650
1771
  }
1651
1772
  //#endregion
1652
1773
  //#region ../../src/composables/useExplosionDiagramCollaboration.js
1653
- var jt = (e, { onRemoteChange: t } = {}) => {
1654
- let n = At(e, {
1774
+ var Ft = (e, { onRemoteChange: t } = {}) => {
1775
+ let n = Pt(e, {
1655
1776
  roomPrefix: "explosion-diagram",
1656
1777
  syncKey: "_data"
1657
1778
  });
@@ -1679,69 +1800,108 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1679
1800
  pushToYjs: r,
1680
1801
  pullFromYjs: i
1681
1802
  };
1682
- }, Mt = { class: "explosion-diagram-editor" }, Nt = {
1803
+ }, It = { class: "explosion-diagram-editor" }, Lt = {
1683
1804
  key: 0,
1684
1805
  class: "group-breadcrumb"
1685
- }, Pt = { class: "editor-body" }, Ft = {
1806
+ }, Rt = { class: "editor-body" }, zt = {
1686
1807
  key: 0,
1687
1808
  class: "props-panel"
1688
- }, It = { class: "prop-row" }, Lt = { class: "prop-row" }, Rt = { class: "prop-row" }, zt = { class: "prop-row" }, Bt = { class: "prop-row" }, Vt = {
1809
+ }, Bt = { class: "prop-row" }, Vt = { class: "prop-row" }, Ht = { class: "prop-row" }, Ut = { class: "prop-row" }, Wt = { class: "prop-row" }, Gt = {
1689
1810
  key: 0,
1690
1811
  class: "group-image-preview"
1691
- }, Ht = ["src"], Ut = { class: "prop-row" }, Wt = { class: "prop-row" }, Gt = { class: "prop-row" }, Kt = { class: "prop-row" }, qt = { class: "prop-row" }, Jt = { class: "prop-row" }, Yt = { class: "prop-row" }, Xt = { class: "prop-row" }, Zt = { class: "prop-row" }, Qt = { style: {
1812
+ }, Kt = ["src"], qt = { class: "prop-row" }, Jt = { class: "prop-row" }, Yt = { class: "prop-row" }, Xt = { class: "prop-row" }, Zt = { class: "prop-row" }, Qt = { class: "prop-row" }, $t = { class: "prop-row" }, en = { class: "prop-row" }, tn = { class: "prop-row" }, nn = { style: {
1692
1813
  "margin-bottom": "8px",
1693
1814
  display: "flex",
1694
1815
  gap: "8px"
1695
- } }, $t = "explosion-diagram", en = /*#__PURE__*/ Y({
1816
+ } }, rn = "explosion-diagram", an = /*#__PURE__*/ J({
1696
1817
  __name: "ExplosionDiagramEditor",
1818
+ props: {
1819
+ docId: {
1820
+ type: [Number, String],
1821
+ default: null
1822
+ },
1823
+ apiBase: {
1824
+ type: String,
1825
+ default: "/api"
1826
+ },
1827
+ saveApi: {
1828
+ type: [String, Function],
1829
+ default: null
1830
+ },
1831
+ loadApi: {
1832
+ type: [String, Function],
1833
+ default: null
1834
+ },
1835
+ wsUrl: {
1836
+ type: String,
1837
+ default: ""
1838
+ },
1839
+ user: {
1840
+ type: Object,
1841
+ default: null
1842
+ },
1843
+ uiConfig: {
1844
+ type: Object,
1845
+ default: () => ({})
1846
+ },
1847
+ aiApi: {
1848
+ type: [String, Object],
1849
+ default: null
1850
+ }
1851
+ },
1697
1852
  setup(l) {
1698
- let u = O(), d = k(), f = v(null), p = v(!1), C = v(!1), { saveVersion: T } = ke(), E = Ee(), D = _({
1853
+ let u = l, d = n(() => ({
1854
+ backButton: "show",
1855
+ titleEditable: !0,
1856
+ authorEditable: !0,
1857
+ ...u.uiConfig
1858
+ })), f = n(() => u.docId ?? p.params.id), p = O(), C = k(), T = v(u.docId ?? null), E = v(!1), D = v(!1), { saveVersion: M } = Ne(), N = Ee(), te = Ae(() => u.aiApi), P = _({
1699
1859
  title: "爆炸图",
1700
1860
  components: [],
1701
1861
  connections: []
1702
- }), M = v(!1), ee = v(!1), N = v(!1), P = null, F = v([]), I = v(-1), L = v(null), R = v([]), z = v(null), B = v(null), V = v(!1), H = v(null), U = v(null), W = v([]), ne = v(null), re = v(null), G = v(!1), ie = v(null), K = v([]), J = n(() => W.value.length ? W.value[W.value.length - 1] : null), ae = n(() => {
1703
- if (!J.value) return D.components;
1862
+ }), F = v(!1), ne = v(!1), re = v(!1), I = null, L = v([]), R = v(-1), z = v(null), B = v([]), V = v(null), H = v(null), U = v(!1), W = v(null), G = v(null), K = v([]), ie = v(null), ae = v(null), oe = v(!1), J = v(null), Y = v([]), X = n(() => K.value.length ? K.value[K.value.length - 1] : null), se = n(() => {
1863
+ if (!X.value) return P.components;
1704
1864
  let e = (t) => {
1705
1865
  let n = /* @__PURE__ */ new Set([t]);
1706
- return D.components.filter((e) => e.groupId === t).forEach((t) => {
1866
+ return P.components.filter((e) => e.groupId === t).forEach((t) => {
1707
1867
  n.add(t.id), t.shape === "group" && e(t.id).forEach((e) => n.add(e));
1708
1868
  }), n;
1709
- }, t = e(J.value);
1710
- return D.components.filter((e) => t.has(e.id));
1711
- }), Y = n(() => {
1712
- if (!J.value) return D.connections;
1713
- let e = new Set(ae.value.map((e) => e.id));
1714
- return D.connections.filter((t) => e.has(t.fromId) || e.has(t.toId));
1715
- }), oe = n(() => {
1716
- if (!J.value) return "0 0 2000 1500";
1717
- let e = D.components.find((e) => e.id === J.value);
1869
+ }, t = e(X.value);
1870
+ return P.components.filter((e) => t.has(e.id));
1871
+ }), ce = n(() => {
1872
+ if (!X.value) return P.connections;
1873
+ let e = new Set(se.value.map((e) => e.id));
1874
+ return P.connections.filter((t) => e.has(t.fromId) || e.has(t.toId));
1875
+ }), le = n(() => {
1876
+ if (!X.value) return "0 0 2000 1500";
1877
+ let e = P.components.find((e) => e.id === X.value);
1718
1878
  if (!e) return "0 0 2000 1500";
1719
- let t = ae.value.filter((e) => e.id !== J.value);
1879
+ let t = se.value.filter((e) => e.id !== X.value);
1720
1880
  if (!t.length) return `${e.x} ${e.y} ${e.width} ${e.height}`;
1721
1881
  let n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
1722
1882
  return t.forEach((e) => {
1723
1883
  n = Math.min(n, e.x), r = Math.min(r, e.y), i = Math.max(i, e.x + e.width), a = Math.max(a, e.y + e.height);
1724
1884
  }), `${n - 40} ${r - 40} ${i - n + 80} ${a - r + 80}`;
1725
- }), se = (e) => D.components.find((t) => t.id === e), X = () => {
1726
- F.value = F.value.slice(0, I.value + 1), F.value.push(JSON.stringify({
1727
- components: D.components,
1728
- connections: D.connections
1729
- })), I.value = F.value.length - 1, ce();
1730
- }, ce = () => {
1731
- M.value && P && P.pushToYjs(D);
1732
- }, le = () => {
1733
- if (I.value > 0) {
1734
- I.value--;
1735
- let e = JSON.parse(F.value[I.value]);
1736
- D.components = e.components, D.connections = e.connections, ce();
1885
+ }), ue = (e) => P.components.find((t) => t.id === e), Z = () => {
1886
+ L.value = L.value.slice(0, R.value + 1), L.value.push(JSON.stringify({
1887
+ components: P.components,
1888
+ connections: P.connections
1889
+ })), R.value = L.value.length - 1, de();
1890
+ }, de = () => {
1891
+ F.value && I && I.pushToYjs(P);
1892
+ }, fe = () => {
1893
+ if (R.value > 0) {
1894
+ R.value--;
1895
+ let e = JSON.parse(L.value[R.value]);
1896
+ P.components = e.components, P.connections = e.connections, de();
1737
1897
  }
1738
- }, ue = () => {
1739
- if (I.value < F.value.length - 1) {
1740
- I.value++;
1741
- let e = JSON.parse(F.value[I.value]);
1742
- D.components = e.components, D.connections = e.connections, ce();
1898
+ }, pe = () => {
1899
+ if (R.value < L.value.length - 1) {
1900
+ R.value++;
1901
+ let e = JSON.parse(L.value[R.value]);
1902
+ P.components = e.components, P.connections = e.connections, de();
1743
1903
  }
1744
- }, de = () => {}, fe = () => {}, pe = 0, Z = () => `comp-${++pe}-${Date.now()}`, me = {
1904
+ }, me = () => {}, he = () => {}, ge = 0, Q = () => `comp-${++ge}-${Date.now()}`, _e = {
1745
1905
  rect: [140, 60],
1746
1906
  circle: [80, 80],
1747
1907
  diamond: [100, 80],
@@ -1751,20 +1911,20 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1751
1911
  polygon: [150, 120],
1752
1912
  svg: [120, 120],
1753
1913
  group: [200, 150]
1754
- }, he = v(null), ge = v(null), Q = null, _e = (e) => {
1914
+ }, ve = v(null), ye = v(null), be = null, xe = (e) => {
1755
1915
  if (e === "image") {
1756
- Q = "image", he.value?.click();
1916
+ be = "image", ve.value?.click();
1757
1917
  return;
1758
1918
  }
1759
1919
  if (e === "svg") {
1760
- Q = "svg", ge.value?.click();
1920
+ be = "svg", ye.value?.click();
1761
1921
  return;
1762
1922
  }
1763
1923
  if (e === "polygon") {
1764
1924
  let e = {
1765
- id: Z(),
1925
+ id: Q(),
1766
1926
  shape: "polygon",
1767
- label: `${D.components.length + 1}`,
1927
+ label: `${P.components.length + 1}`,
1768
1928
  description: "",
1769
1929
  x: 300 + Math.random() * 200,
1770
1930
  y: 200 + Math.random() * 200,
@@ -1776,14 +1936,14 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1776
1936
  textColor: "#333",
1777
1937
  fontSize: 14
1778
1938
  };
1779
- J.value && (e.groupId = J.value), D.components.push(e), X();
1939
+ X.value && (e.groupId = X.value), P.components.push(e), Z();
1780
1940
  return;
1781
1941
  }
1782
1942
  if (e === "group") {
1783
1943
  let e = {
1784
- id: Z(),
1944
+ id: Q(),
1785
1945
  shape: "group",
1786
- label: `${D.components.length + 1}`,
1946
+ label: `${P.components.length + 1}`,
1787
1947
  description: "",
1788
1948
  x: 300 + Math.random() * 200,
1789
1949
  y: 200 + Math.random() * 200,
@@ -1795,13 +1955,13 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1795
1955
  textColor: "#333",
1796
1956
  fontSize: 14
1797
1957
  };
1798
- J.value && (e.groupId = J.value), D.components.push(e), X();
1958
+ X.value && (e.groupId = X.value), P.components.push(e), Z();
1799
1959
  return;
1800
1960
  }
1801
- let [t, n] = me[e] || [120, 60], r = {
1802
- id: Z(),
1961
+ let [t, n] = _e[e] || [120, 60], r = {
1962
+ id: Q(),
1803
1963
  shape: e,
1804
- label: `${D.components.length + 1}`,
1964
+ label: `${P.components.length + 1}`,
1805
1965
  description: "",
1806
1966
  x: 300 + Math.random() * 200,
1807
1967
  y: 200 + Math.random() * 200,
@@ -1812,19 +1972,19 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1812
1972
  textColor: "#333",
1813
1973
  fontSize: 14
1814
1974
  };
1815
- J.value && (r.groupId = J.value), D.components.push(r), X();
1816
- }, ve = async (e) => {
1975
+ X.value && (r.groupId = X.value), P.components.push(r), Z();
1976
+ }, Se = async (e) => {
1817
1977
  let t = e.target.files?.[0];
1818
1978
  if (!t) return;
1819
1979
  let n = new FormData();
1820
- n.append("file", t), Q === "image" && n.append("remove_bg", "true");
1980
+ n.append("file", t), be === "image" && n.append("remove_bg", "true");
1821
1981
  try {
1822
- let e = await q.post("/api/files/upload/image", n), r = e.data.url || e.data.file_path;
1823
- if (Q === "image") {
1982
+ let e = await q.post(`${u.apiBase}/files/upload/image`, n), r = e.data.url || e.data.file_path;
1983
+ if (be === "image") {
1824
1984
  let e = {
1825
- id: Z(),
1985
+ id: Q(),
1826
1986
  shape: "image",
1827
- label: `${D.components.length + 1}`,
1987
+ label: `${P.components.length + 1}`,
1828
1988
  description: "",
1829
1989
  x: 300 + Math.random() * 200,
1830
1990
  y: 200 + Math.random() * 200,
@@ -1836,17 +1996,17 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1836
1996
  textColor: "#333",
1837
1997
  fontSize: 14
1838
1998
  };
1839
- J.value && (e.groupId = J.value), D.components.push(e);
1840
- } else if (Q === "svg") {
1999
+ X.value && (e.groupId = X.value), P.components.push(e);
2000
+ } else if (be === "svg") {
1841
2001
  let e = await t.text(), n = new DOMParser().parseFromString(e, "image/svg+xml").querySelector("svg"), r = n?.getAttribute("width") || 100, i = n?.getAttribute("height") || 100, a = n?.getAttribute("viewBox"), o = parseFloat(r), s = parseFloat(i);
1842
2002
  if (a) {
1843
2003
  let e = a.split(/[\s,]+/).map(Number);
1844
2004
  o = e[2] || o, s = e[3] || s;
1845
2005
  }
1846
2006
  let c = n?.innerHTML || "", l = {
1847
- id: Z(),
2007
+ id: Q(),
1848
2008
  shape: "svg",
1849
- label: `${D.components.length + 1}`,
2009
+ label: `${P.components.length + 1}`,
1850
2010
  description: "",
1851
2011
  x: 300 + Math.random() * 200,
1852
2012
  y: 200 + Math.random() * 200,
@@ -1860,29 +2020,29 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1860
2020
  textColor: "#333",
1861
2021
  fontSize: 14
1862
2022
  };
1863
- J.value && (l.groupId = J.value), D.components.push(l);
2023
+ X.value && (l.groupId = X.value), P.components.push(l);
1864
2024
  }
1865
- X();
2025
+ Z();
1866
2026
  } catch {
1867
2027
  A.error("上传失败");
1868
2028
  }
1869
2029
  e.target.value = "";
1870
- }, ye = (e, t, n) => {
2030
+ }, Ce = (e, t, n) => {
1871
2031
  if (n && (n.ctrlKey || n.metaKey)) {
1872
- R.value.includes(e.id) ? R.value = R.value.filter((t) => t !== e.id) : R.value.push(e.id), L.value = R.value[R.value.length - 1] || null, B.value = L.value ? D.components.find((e) => e.id === L.value) : null, z.value = "component";
2032
+ B.value.includes(e.id) ? B.value = B.value.filter((t) => t !== e.id) : B.value.push(e.id), z.value = B.value[B.value.length - 1] || null, H.value = z.value ? P.components.find((e) => e.id === z.value) : null, V.value = "component";
1873
2033
  return;
1874
2034
  }
1875
- L.value = e.id, R.value = [e.id], z.value = t, B.value = e, U.value = null;
2035
+ z.value = e.id, B.value = [e.id], V.value = t, H.value = e, G.value = null;
1876
2036
  }, $ = () => {
1877
- L.value = null, R.value = [], z.value = null, B.value = null, U.value = null;
1878
- }, be = (e, t, n) => {
1879
- let r = xe(n), i = e.x, a = e.y, o = e.width, s = e.height, c = e.shape === "polygon" ? (e.points || "").trim().split(/\s+/).map((e) => e.split(",").map(Number)) : null, l = e.shape === "group", u = l ? D.components.filter((t) => t.groupId === e.id && t.id !== e.id) : [], d = u.map((e) => ({
2037
+ z.value = null, B.value = [], V.value = null, H.value = null, G.value = null;
2038
+ }, we = (e, t, n) => {
2039
+ let r = De(n), i = e.x, a = e.y, o = e.width, s = e.height, c = e.shape === "polygon" ? (e.points || "").trim().split(/\s+/).map((e) => e.split(",").map(Number)) : null, l = e.shape === "group", u = l ? P.components.filter((t) => t.groupId === e.id && t.id !== e.id) : [], d = u.map((e) => ({
1880
2040
  id: e.id,
1881
2041
  x: e.x,
1882
2042
  y: e.y,
1883
2043
  w: e.width,
1884
2044
  h: e.height
1885
- })), f = new Set(l ? u.map((e) => e.id) : [e.id]), p = D.connections.filter((e) => f.has(e.fromId) || f.has(e.toId)).map((e) => ({
2045
+ })), f = new Set(l ? u.map((e) => e.id) : [e.id]), p = P.connections.filter((e) => f.has(e.fromId) || f.has(e.toId)).map((e) => ({
1886
2046
  conn: e,
1887
2047
  fromAnchor: e.fromAnchor ? {
1888
2048
  x: e.fromAnchor.x,
@@ -1893,7 +2053,7 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1893
2053
  y: e.toAnchor.y
1894
2054
  } : null
1895
2055
  })), m = (n) => {
1896
- let m = xe(n), h = m.x - r.x, g = m.y - r.y, _ = o, v = s, y = i, b = a;
2056
+ let m = De(n), h = m.x - r.x, g = m.y - r.y, _ = o, v = s, y = i, b = a;
1897
2057
  if (t === "se" ? (_ = o + h, v = s + g) : t === "sw" ? (y = i + h, _ = o - h, v = s + g) : t === "ne" ? (_ = o + h, b = a + g, v = s - g) : t === "nw" && (y = i + h, b = a + g, _ = o - h, v = s - g), _ = Math.max(30, _), v = Math.max(20, v), e.x = y, e.y = b, e.width = _, e.height = v, c && o > 0 && s > 0 && (e.points = c.map(([e, t]) => `${Math.round(e * _ / o)},${Math.round(t * v / s)}`).join(" ")), o > 0 && s > 0) {
1898
2058
  let e = _ / o, t = v / s;
1899
2059
  l && u.forEach((n, r) => {
@@ -1913,10 +2073,10 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1913
2073
  });
1914
2074
  }
1915
2075
  }, h = () => {
1916
- document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", h), X();
2076
+ document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", h), Z();
1917
2077
  };
1918
2078
  document.addEventListener("mousemove", m), document.addEventListener("mouseup", h);
1919
- }, xe = (e) => {
2079
+ }, De = (e) => {
1920
2080
  let t = document.querySelector(".diagram-svg");
1921
2081
  if (!t) return {
1922
2082
  x: 0,
@@ -1927,20 +2087,20 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1927
2087
  x: (e.clientX - n.left) / n.width * r.width + r.x,
1928
2088
  y: (e.clientY - n.top) / n.height * r.height + r.y
1929
2089
  };
1930
- }, Se = (e, t, n, r = !1) => {
1931
- let i = D.components.find((t) => t.id === e);
2090
+ }, Oe = (e, t, n, r = !1) => {
2091
+ let i = P.components.find((t) => t.id === e);
1932
2092
  if (!i) return;
1933
2093
  let a = t - i.x, o = n - i.y;
1934
- i.x = t, i.y = n, i.shape === "group" && i.id && D.components.forEach((e) => {
2094
+ i.x = t, i.y = n, i.shape === "group" && i.id && P.components.forEach((e) => {
1935
2095
  e.groupId === i.id && e.id !== i.id && (e.x += a, e.y += o);
1936
- }), r && X();
1937
- }, Ce = (e) => {
2096
+ }), r && Z();
2097
+ }, ke = (e) => {
1938
2098
  if (e.shape === "group") {
1939
- je(e);
2099
+ Ie(e);
1940
2100
  return;
1941
2101
  }
1942
2102
  if (e.shape === "polygon") {
1943
- U.value && U.value.id === e.id ? U.value = null : U.value = e;
2103
+ G.value && G.value.id === e.id ? G.value = null : G.value = e;
1944
2104
  return;
1945
2105
  }
1946
2106
  j.prompt("编辑标签", "组件", {
@@ -1949,12 +2109,12 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1949
2109
  }).then(({ value: t }) => {
1950
2110
  t !== null && (e.label = t);
1951
2111
  }).catch(() => {});
1952
- }, we = () => {
1953
- L.value && (z.value === "component" ? (D.components = D.components.filter((e) => e.id !== L.value), D.connections = D.connections.filter((e) => e.fromId !== L.value && e.toId !== L.value)) : D.connections = D.connections.filter((e) => e.id !== L.value), $(), X());
1954
- }, De = (e, t, n) => {
1955
- V.value = !0;
2112
+ }, je = () => {
2113
+ z.value && (V.value === "component" ? (P.components = P.components.filter((e) => e.id !== z.value), P.connections = P.connections.filter((e) => e.fromId !== z.value && e.toId !== z.value)) : P.connections = P.connections.filter((e) => e.id !== z.value), $(), Z());
2114
+ }, Me = (e, t, n) => {
2115
+ U.value = !0;
1956
2116
  let r = e.x + t.x, i = e.y + t.y;
1957
- H.value = {
2117
+ W.value = {
1958
2118
  x1: r,
1959
2119
  y1: i,
1960
2120
  x2: r,
@@ -1963,14 +2123,14 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1963
2123
  let a = n.target.closest("svg"), o = (e) => {
1964
2124
  if (!a) return;
1965
2125
  let t = a.getBoundingClientRect(), n = a.viewBox.baseVal;
1966
- H.value.x2 = (e.clientX - t.left) / t.width * n.width + n.x, H.value.y2 = (e.clientY - t.top) / t.height * n.height + n.y;
2126
+ W.value.x2 = (e.clientX - t.left) / t.width * n.width + n.x, W.value.y2 = (e.clientY - t.top) / t.height * n.height + n.y;
1967
2127
  }, s = (n) => {
1968
- if (document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s), H.value = null, !a) {
1969
- V.value = !1;
2128
+ if (document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s), W.value = null, !a) {
2129
+ U.value = !1;
1970
2130
  return;
1971
2131
  }
1972
2132
  let r = a.getBoundingClientRect(), i = a.viewBox.baseVal, c = (n.clientX - r.left) / r.width * i.width + i.x, l = (n.clientY - r.top) / r.height * i.height + i.y, u = null, d = 30;
1973
- for (let t of D.components) {
2133
+ for (let t of P.components) {
1974
2134
  if (t.id === e.id) continue;
1975
2135
  let n = [
1976
2136
  {
@@ -1996,13 +2156,13 @@ var jt = (e, { onRemoteChange: t } = {}) => {
1996
2156
  }
1997
2157
  }
1998
2158
  if (!u) {
1999
- for (let t of D.components) if (t.id !== e.id && c >= t.x && c <= t.x + t.width && l >= t.y && l <= t.y + t.height) {
2159
+ for (let t of P.components) if (t.id !== e.id && c >= t.x && c <= t.x + t.width && l >= t.y && l <= t.y + t.height) {
2000
2160
  u = t;
2001
2161
  break;
2002
2162
  }
2003
2163
  }
2004
- u && (D.connections.find((t) => t.fromId === e.id && t.toId === u.id) || (D.connections.push({
2005
- id: Z(),
2164
+ u && (P.connections.find((t) => t.fromId === e.id && t.toId === u.id) || (P.connections.push({
2165
+ id: Q(),
2006
2166
  fromId: e.id,
2007
2167
  toId: u.id,
2008
2168
  fromAnchor: {
@@ -2016,11 +2176,11 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2016
2176
  label: "",
2017
2177
  lineWidth: 2,
2018
2178
  dashed: !1
2019
- }), X())), V.value = !1;
2179
+ }), Z())), U.value = !1;
2020
2180
  };
2021
2181
  document.addEventListener("mousemove", o), document.addEventListener("mouseup", s);
2022
- }, Oe = () => {
2023
- let e = D.components.filter((e) => R.value.includes(e.id));
2182
+ }, Pe = () => {
2183
+ let e = P.components.filter((e) => B.value.includes(e.id));
2024
2184
  if (e.length < 2) {
2025
2185
  A.warning("请至少选择2个零件进行组合");
2026
2186
  return;
@@ -2029,7 +2189,7 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2029
2189
  e.forEach((e) => {
2030
2190
  t = Math.min(t, e.x), n = Math.min(n, e.y), r = Math.max(r, e.x + e.width), i = Math.max(i, e.y + e.height);
2031
2191
  });
2032
- let a = Z();
2192
+ let a = Q();
2033
2193
  e.forEach((e) => {
2034
2194
  e.groupId = a;
2035
2195
  });
@@ -2048,231 +2208,246 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2048
2208
  fontSize: 14,
2049
2209
  movable: !1
2050
2210
  };
2051
- J.value && (o.groupId = J.value), D.components = [
2052
- ...D.components.filter((e) => !R.value.includes(e.id)),
2211
+ X.value && (o.groupId = X.value), P.components = [
2212
+ ...P.components.filter((e) => !B.value.includes(e.id)),
2053
2213
  o,
2054
2214
  ...e
2055
- ], R.value = [], X();
2056
- }, Ae = (e) => {
2057
- let t = D.components.filter((t) => t.groupId === e.id && t.id !== e.id);
2215
+ ], B.value = [], Z();
2216
+ }, Fe = (e) => {
2217
+ let t = P.components.filter((t) => t.groupId === e.id && t.id !== e.id);
2058
2218
  if (!t.length) return;
2059
2219
  let n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
2060
2220
  t.forEach((e) => {
2061
2221
  n = Math.min(n, e.x), r = Math.min(r, e.y), i = Math.max(i, e.x + e.width), a = Math.max(a, e.y + e.height);
2062
- }), e.x = n - 10, e.y = r - 10, e.width = i - n + 20, e.height = a - r + 20, X();
2063
- }, je = (e) => {
2064
- W.value.push(e.id), $();
2065
- }, Me = () => {
2066
- W.value.length && (W.value.pop(), $());
2067
- }, Ne = (e) => {
2068
- W.value = W.value.slice(0, e + 1), $();
2069
- }, Pe = async (e) => {
2222
+ }), e.x = n - 10, e.y = r - 10, e.width = i - n + 20, e.height = a - r + 20, Z();
2223
+ }, Ie = (e) => {
2224
+ K.value.push(e.id), $();
2225
+ }, Le = () => {
2226
+ K.value.length && (K.value.pop(), $());
2227
+ }, Re = (e) => {
2228
+ K.value = K.value.slice(0, e + 1), $();
2229
+ }, ze = async (e) => {
2070
2230
  let t = e.target.files?.[0];
2071
- if (!t || !B.value) return;
2231
+ if (!t || !H.value) return;
2072
2232
  let n = new FormData();
2073
2233
  n.append("file", t);
2074
2234
  try {
2075
- let e = await q.post("/api/files/upload/image", n);
2076
- B.value.imageUrl = e.data.url || e.data.file_path, Ae(B.value);
2235
+ let e = await q.post(`${u.apiBase}/files/upload/image`, n);
2236
+ H.value.imageUrl = e.data.url || e.data.file_path, Fe(H.value);
2077
2237
  } catch {
2078
2238
  A.error("上传失败");
2079
2239
  }
2080
2240
  e.target.value = "";
2081
- }, Fe = () => {
2082
- let e = D.components;
2241
+ }, Be = () => {
2242
+ let e = P.components;
2083
2243
  if (!e.length) return;
2084
2244
  let t = Math.ceil(Math.sqrt(e.length));
2085
- D.components = e.map((e, n) => ({
2245
+ P.components = e.map((e, n) => ({
2086
2246
  ...e,
2087
2247
  x: 100 + n % t * 200,
2088
2248
  y: 100 + Math.floor(n / t) * 120
2089
- })), X();
2090
- }, Ie = () => d.push("/"), Le = [
2091
- "我可以帮您优化爆炸图布局、检查组件标注,或者提供装配顺序建议。请问有什么需要帮助的?",
2092
- "这个爆炸图的组件分布很清晰。建议检查连接线是否准确反映了实际装配关系。",
2093
- "根据当前的爆炸图结构,我建议为关键组件添加编号说明,便于阅读理解。",
2094
- "我可以帮您检查爆炸图中是否有遗漏的零部件或多余的标注。需要我逐个分析吗?",
2095
- "建议在爆炸图中添加装配方向指示箭头,这样可以让装配流程更加直观。",
2096
- "这个爆炸图的层次感不错。如果需要,我可以帮您优化组件间距和标注位置。",
2097
- "我可以帮您将爆炸图的数据导出为BOM清单格式,方便采购和生产管理。",
2098
- "文档中的组件信息很详细。建议补充每个组件的规格参数和供应商信息。"
2099
- ], Re = async (e, t = {}) => {
2100
- let n = f.value ? `${$t}-${f.value}` : null;
2101
- await E.sendMessage(e, {
2249
+ })), Z();
2250
+ }, Ve = () => {
2251
+ u.docId ?? C.push("/");
2252
+ }, He = async (e, t = {}) => {
2253
+ let n = T.value ? `${rn}-${T.value}` : null;
2254
+ await N.sendMessage(e, {
2102
2255
  ...t,
2103
2256
  roomId: n
2104
2257
  });
2105
- let r = t.mentionedUser, i = r && r.toLowerCase().includes("ai"), a = E.collabUsers.value.filter((e) => e.name !== E.currentUser.value.name);
2106
- (!r || i || a.length === 0) && (E.loading.value = !0, setTimeout(() => {
2107
- E.sendAiMessage(Le[Math.floor(Math.random() * Le.length)], n), E.loading.value = !1;
2108
- }, 800 + Math.random() * 1200));
2109
- }, ze = () => {
2110
- let e = f.value ? `${$t}-${f.value}` : null;
2111
- E.clearMessages(e);
2112
- }, Be = () => {
2113
- if (!f.value) {
2258
+ let r = t.mentionedUser, i = r && r.toLowerCase().includes("ai"), a = N.collabUsers.value.filter((e) => e.name !== N.currentUser.value.name);
2259
+ if (!r || i || a.length === 0) {
2260
+ N.loading.value = !0;
2261
+ try {
2262
+ let t = await te.chat(e, N.messages.value);
2263
+ N.sendAiMessage(t, n);
2264
+ } catch (e) {
2265
+ N.sendAiMessage("AI 请求失败: " + (e.message || "未知错误"), n);
2266
+ } finally {
2267
+ N.loading.value = !1;
2268
+ }
2269
+ }
2270
+ }, Ue = () => {
2271
+ let e = T.value ? `${rn}-${T.value}` : null;
2272
+ N.clearMessages(e);
2273
+ }, We = () => {
2274
+ if (!T.value) {
2114
2275
  A.warning("请先保存文档");
2115
2276
  return;
2116
2277
  }
2117
- C.value = !0;
2118
- }, He = (e) => {
2278
+ D.value = !0;
2279
+ }, Ke = (e) => {
2119
2280
  try {
2120
2281
  let t = typeof e == "string" ? JSON.parse(e) : e;
2121
- t.components && (D.components = t.components), t.connections && (D.connections = t.connections), $();
2282
+ t.components && (P.components = t.components), t.connections && (P.connections = t.connections), $();
2122
2283
  } catch (e) {
2123
2284
  console.error("Version apply error:", e);
2124
2285
  }
2125
- }, Ue = async () => {
2126
- if (M.value && P?.collaborationClosed.value && !N.value) {
2286
+ }, qe = async () => {
2287
+ if (F.value && I?.collaborationClosed.value && !re.value) {
2127
2288
  A.warning("协作已关闭,无法保存");
2128
2289
  return;
2129
2290
  }
2130
2291
  try {
2131
2292
  let e = {
2132
- title: D.title,
2293
+ title: P.title,
2133
2294
  view_type: "diagram",
2134
2295
  config: JSON.stringify({
2135
- components: D.components,
2136
- connections: D.connections
2296
+ components: P.components,
2297
+ connections: P.connections
2137
2298
  })
2138
2299
  };
2139
- f.value ? await q.put(`/api/explosion-views/${f.value}`, e) : f.value = (await q.post("/api/explosion-views/", e)).data.id, A.success("保存成功"), T({
2140
- documentId: f.value,
2300
+ if (typeof u.saveApi == "function") {
2301
+ let t = await u.saveApi(e, T.value);
2302
+ t?.id && (T.value = t.id);
2303
+ } else if (typeof u.saveApi == "string") T.value ? await q.put(u.saveApi, e) : T.value = (await q.post(u.saveApi, e)).data.id;
2304
+ else {
2305
+ let t = u.apiBase;
2306
+ T.value ? await q.put(`${t}/explosion-views/${T.value}`, e) : T.value = (await q.post(`${t}/explosion-views/`, e)).data.id;
2307
+ }
2308
+ A.success("保存成功"), M({
2309
+ documentId: T.value,
2141
2310
  docType: "diagram",
2142
2311
  content: JSON.stringify({
2143
- components: D.components,
2144
- connections: D.connections
2312
+ components: P.components,
2313
+ connections: P.connections
2145
2314
  }),
2146
- userId: String(E.currentUser.value?.id || ""),
2147
- userName: E.currentUser.value?.name || "未知"
2315
+ userId: String(N.currentUser.value?.id || ""),
2316
+ userName: N.currentUser.value?.name || "未知"
2148
2317
  });
2149
2318
  } catch {
2150
2319
  A.error("保存失败");
2151
2320
  }
2152
- }, We = async () => {
2153
- if (u.params.id) try {
2154
- let e = (await q.get(`/api/explosion-views/${u.params.id}`)).data;
2155
- if (f.value = e.id, D.title = e.title, e.config) {
2321
+ }, Je = async () => {
2322
+ if (f.value) try {
2323
+ let e;
2324
+ if (typeof u.loadApi == "function") e = await u.loadApi(f.value);
2325
+ else if (typeof u.loadApi == "string") e = (await q.get(u.loadApi)).data;
2326
+ else {
2327
+ let t = u.apiBase;
2328
+ e = (await q.get(`${t}/explosion-views/${f.value}`)).data;
2329
+ }
2330
+ if (T.value = e.id, P.title = e.title, e.config) {
2156
2331
  let t = JSON.parse(e.config);
2157
- D.components = t.components || [], D.connections = t.connections || [];
2332
+ P.components = t.components || [], P.connections = t.connections || [];
2158
2333
  }
2159
- X();
2334
+ Z();
2160
2335
  } catch (e) {
2161
2336
  console.error("load error", e);
2162
2337
  }
2163
- else X();
2164
- }, Ge = async (e) => {
2338
+ else Z();
2339
+ }, Ye = async (e) => {
2165
2340
  try {
2166
2341
  let t = document.querySelector(".diagram-svg");
2167
2342
  if (!t) return A.error("未找到SVG元素");
2168
2343
  let n = new XMLSerializer().serializeToString(t);
2169
2344
  if (e === "svg") {
2170
2345
  let e = new Blob([n], { type: "image/svg+xml;charset=utf-8" }), t = URL.createObjectURL(e), r = document.createElement("a");
2171
- r.href = t, r.download = `${D.title || "爆炸图"}.svg`, r.click(), URL.revokeObjectURL(t);
2346
+ r.href = t, r.download = `${P.title || "爆炸图"}.svg`, r.click(), URL.revokeObjectURL(t);
2172
2347
  } else if (e === "png") {
2173
2348
  let e = document.createElement("canvas"), t = e.getContext("2d"), r = new Image(), i = new Blob([n], { type: "image/svg+xml;charset=utf-8" }), a = URL.createObjectURL(i);
2174
2349
  r.onload = () => {
2175
2350
  e.width = r.width, e.height = r.height, t.fillStyle = "#fff", t.fillRect(0, 0, e.width, e.height), t.drawImage(r, 0, 0), e.toBlob((e) => {
2176
2351
  let t = document.createElement("a");
2177
- t.href = URL.createObjectURL(e), t.download = `${D.title || "爆炸图"}.png`, t.click();
2352
+ t.href = URL.createObjectURL(e), t.download = `${P.title || "爆炸图"}.png`, t.click();
2178
2353
  }), URL.revokeObjectURL(a);
2179
2354
  }, r.src = a;
2180
2355
  } else A.info(`导出 ${e} 开发中`);
2181
2356
  } catch {
2182
2357
  A.error("导出失败");
2183
2358
  }
2184
- }, Ke = (e) => {
2185
- P &&= (P.destroy(), null), P = jt(e, { onRemoteChange: (e) => {
2186
- e.title && (D.title = e.title), e.components && (D.components = e.components), e.connections && (D.connections = e.connections), $();
2187
- } }), P._setSyncReady(!1);
2188
- }, qe = async () => {
2189
- if (M.value) return;
2190
- if (!f.value && (await Ue(), !f.value)) {
2359
+ }, Xe = (e) => {
2360
+ I &&= (I.destroy(), null), I = Ft(e, { onRemoteChange: (e) => {
2361
+ e.title && (P.title = e.title), e.components && (P.components = e.components), e.connections && (P.connections = e.connections), $();
2362
+ } }), I._setSyncReady(!1);
2363
+ }, Ze = async () => {
2364
+ if (F.value) return;
2365
+ if (!T.value && (await qe(), !T.value)) {
2191
2366
  A.error("请先保存文档");
2192
2367
  return;
2193
2368
  }
2194
- Ke(String(f.value)), P.connect();
2369
+ Xe(String(T.value)), I.connect();
2195
2370
  let e = {
2196
2371
  name: `用户${Math.floor(Math.random() * 1e3)}`,
2197
2372
  color: `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`
2198
2373
  }, t = () => {
2199
- if (P.provider && P.provider.synced) {
2200
- P._setSyncReady(!0), P.setLocalUser(e);
2201
- let t = P.pullFromYjs();
2202
- t ? (t.title && (D.title = t.title), t.components && (D.components = t.components), t.connections && (D.connections = t.connections), $()) : D.components.length > 0 && P.pushToYjs(D), M.value = !0, N.value = !0, ee.value = !1, E.setCollabContext({
2203
- ydoc: P.ydoc,
2204
- provider: P.provider,
2205
- onlineUsers: P.onlineUsers
2206
- }), E.setCurrentUser({
2207
- id: P.provider.awareness.clientID,
2374
+ if (I.provider && I.provider.synced) {
2375
+ I._setSyncReady(!0), I.setLocalUser(e);
2376
+ let t = I.pullFromYjs();
2377
+ t ? (t.title && (P.title = t.title), t.components && (P.components = t.components), t.connections && (P.connections = t.connections), $()) : P.components.length > 0 && I.pushToYjs(P), F.value = !0, re.value = !0, ne.value = !1, N.setCollabContext({
2378
+ ydoc: I.ydoc,
2379
+ provider: I.provider,
2380
+ onlineUsers: I.onlineUsers
2381
+ }), N.setCurrentUser({
2382
+ id: I.provider.awareness.clientID,
2208
2383
  name: e.name,
2209
2384
  color: e.color
2210
2385
  }), A.success("协作已开启");
2211
2386
  } else setTimeout(t, 100);
2212
2387
  };
2213
2388
  setTimeout(t, 200);
2214
- }, Ye = () => {
2215
- P && (P.closeCollaboration(), M.value = !1, N.value = !1, A.info("协作已关闭"));
2216
- }, Xe = () => {
2217
- let e = u.params.id;
2389
+ }, $e = () => {
2390
+ I && (I.closeCollaboration(), F.value = !1, re.value = !1, A.info("协作已关闭"));
2391
+ }, et = () => {
2392
+ let e = p.params.id;
2218
2393
  if (!e) return;
2219
- Ke(e), P.connect();
2394
+ Xe(e), I.connect();
2220
2395
  let t = {
2221
2396
  name: `协作人${Math.floor(Math.random() * 1e3)}`,
2222
2397
  color: `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`
2223
2398
  }, n = () => {
2224
- if (P.provider && P.provider.synced) {
2225
- if (P.checkCollaborationClosed()) {
2226
- P.disconnect(), M.value = !1, A.warning("该协作已关闭,无法加入");
2399
+ if (I.provider && I.provider.synced) {
2400
+ if (I.checkCollaborationClosed()) {
2401
+ I.disconnect(), F.value = !1, A.warning("该协作已关闭,无法加入");
2227
2402
  return;
2228
2403
  }
2229
- P._setSyncReady(!0), P.setLocalUser(t);
2230
- let e = P.pullFromYjs();
2231
- e && (e.title && (D.title = e.title), e.components && (D.components = e.components), e.connections && (D.connections = e.connections), $()), M.value = !0, N.value = !1, E.setCollabContext({
2232
- ydoc: P.ydoc,
2233
- provider: P.provider,
2234
- onlineUsers: P.onlineUsers
2235
- }), E.setCurrentUser({
2236
- id: P.provider.awareness.clientID,
2404
+ I._setSyncReady(!0), I.setLocalUser(t);
2405
+ let e = I.pullFromYjs();
2406
+ e && (e.title && (P.title = e.title), e.components && (P.components = e.components), e.connections && (P.connections = e.connections), $()), F.value = !0, re.value = !1, N.setCollabContext({
2407
+ ydoc: I.ydoc,
2408
+ provider: I.provider,
2409
+ onlineUsers: I.onlineUsers
2410
+ }), N.setCurrentUser({
2411
+ id: I.provider.awareness.clientID,
2237
2412
  name: t.name,
2238
2413
  color: t.color
2239
2414
  }), A.success("已加入协作");
2240
2415
  } else setTimeout(n, 100);
2241
2416
  };
2242
2417
  setTimeout(n, 200);
2243
- }, Ze = () => {
2244
- M.value ? Ye() : qe();
2245
- }, Qe = async () => {
2246
- if (M.value || await qe(), !f.value && (await Ue(), !f.value)) {
2418
+ }, tt = () => {
2419
+ F.value ? $e() : Ze();
2420
+ }, nt = async () => {
2421
+ if (F.value || await Ze(), !T.value && (await qe(), !T.value)) {
2247
2422
  A.warning("请先保存文档后再分享");
2248
2423
  return;
2249
2424
  }
2250
- let e = `${window.location.origin}/explosion-diagram/${f.value}?collab=1`;
2425
+ let e = `${window.location.origin}/explosion-diagram/${T.value}?collab=1`;
2251
2426
  try {
2252
2427
  await navigator.clipboard.writeText(e), A.success("协作链接已复制到剪贴板");
2253
2428
  } catch {
2254
2429
  A.info("协作链接: " + e);
2255
2430
  }
2256
- }, $e = () => {
2257
- K.value = (B.value?.popupConfig || []).map((e) => ({ ...e })), G.value = !0;
2258
- }, et = () => {
2259
- K.value.push({
2431
+ }, rt = () => {
2432
+ Y.value = (H.value?.popupConfig || []).map((e) => ({ ...e })), oe.value = !0;
2433
+ }, it = () => {
2434
+ Y.value.push({
2260
2435
  key: "",
2261
2436
  value: ""
2262
2437
  });
2263
- }, tt = () => {
2264
- B.value.popupConfig = K.value.filter((e) => e.key.trim()), G.value = !1, X();
2265
- }, nt = (e) => {
2438
+ }, at = () => {
2439
+ H.value.popupConfig = Y.value.filter((e) => e.key.trim()), oe.value = !1, Z();
2440
+ }, ot = (e) => {
2266
2441
  let t = e.target.files?.[0];
2267
2442
  if (!t) return;
2268
2443
  let n = new FileReader();
2269
2444
  n.onload = () => {
2270
2445
  try {
2271
2446
  let e = JSON.parse(n.result);
2272
- Array.isArray(e) ? K.value = e.map((e) => ({
2447
+ Array.isArray(e) ? Y.value = e.map((e) => ({
2273
2448
  key: String(e.key || ""),
2274
2449
  value: String(e.value || "")
2275
- })) : typeof e == "object" && (K.value = Object.entries(e).map(([e, t]) => ({
2450
+ })) : typeof e == "object" && (Y.value = Object.entries(e).map(([e, t]) => ({
2276
2451
  key: e,
2277
2452
  value: String(t)
2278
2453
  }))), A.success("导入成功");
@@ -2280,68 +2455,70 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2280
2455
  A.error("JSON解析失败");
2281
2456
  }
2282
2457
  }, n.readAsText(t), e.target.value = "";
2283
- }, rt = () => {
2458
+ }, st = () => {
2284
2459
  let e = JSON.stringify({
2285
- title: D.title,
2286
- components: D.components,
2287
- connections: D.connections
2460
+ title: P.title,
2461
+ components: P.components,
2462
+ connections: P.connections
2288
2463
  }, null, 2), t = new Blob([e], { type: "application/json" }), n = URL.createObjectURL(t), r = document.createElement("a");
2289
- r.href = n, r.download = `${D.title || "爆炸图"}.json`, r.click(), URL.revokeObjectURL(n), A.success("导出成功");
2290
- }, it = (e) => {
2464
+ r.href = n, r.download = `${P.title || "爆炸图"}.json`, r.click(), URL.revokeObjectURL(n), A.success("导出成功");
2465
+ }, ct = (e) => {
2291
2466
  let t = e.target.files?.[0];
2292
2467
  if (!t) return;
2293
2468
  let n = new FileReader();
2294
2469
  n.onload = () => {
2295
2470
  try {
2296
2471
  let e = JSON.parse(n.result);
2297
- e.title && (D.title = e.title), e.components && (D.components = e.components), e.connections && (D.connections = e.connections), $(), X(), A.success("导入成功");
2472
+ e.title && (P.title = e.title), e.components && (P.components = e.components), e.connections && (P.connections = e.connections), $(), Z(), A.success("导入成功");
2298
2473
  } catch {
2299
2474
  A.error("JSON解析失败");
2300
2475
  }
2301
2476
  }, n.readAsText(t), e.target.value = "";
2302
2477
  };
2303
2478
  m(async () => {
2304
- let e = localStorage.getItem("editor-user-name") || `用户${Math.floor(Math.random() * 1e3)}`;
2305
- localStorage.setItem("editor-user-name", e), E.setCurrentUser({
2306
- id: Date.now(),
2479
+ let e = u.user?.name || localStorage.getItem("editor-user-name") || `用户${Math.floor(Math.random() * 1e3)}`;
2480
+ localStorage.setItem("editor-user-name", e), N.setCurrentUser({
2481
+ id: u.user?.id || Date.now(),
2307
2482
  name: e,
2308
- color: "#409eff"
2309
- }), await We(), u.params.id && u.query.collab === "1" && Xe();
2483
+ color: u.user?.color || "#409eff"
2484
+ }), await Je(), f.value && p.query.collab === "1" && et();
2310
2485
  });
2311
- let at = (e) => {
2312
- e.key === "Delete" && L.value && we(), (e.ctrlKey || e.metaKey) && e.key === "z" && (e.preventDefault(), le()), (e.ctrlKey || e.metaKey) && e.key === "y" && (e.preventDefault(), ue());
2486
+ let lt = (e) => {
2487
+ e.key === "Delete" && z.value && je(), (e.ctrlKey || e.metaKey) && e.key === "z" && (e.preventDefault(), fe()), (e.ctrlKey || e.metaKey) && e.key === "y" && (e.preventDefault(), pe());
2313
2488
  };
2314
- return m(() => document.addEventListener("keydown", at)), h(() => {
2315
- document.removeEventListener("keydown", at), P &&= (P.destroy(), null);
2489
+ return m(() => document.addEventListener("keydown", lt)), h(() => {
2490
+ document.removeEventListener("keydown", lt), I &&= (I.destroy(), null);
2316
2491
  }), (n, l) => {
2317
- let d = b("el-breadcrumb-item"), m = b("el-breadcrumb"), h = b("el-icon"), _ = b("el-button"), v = b("el-tooltip"), T = b("el-input"), O = b("el-input-number"), k = b("el-color-picker"), A = b("el-switch"), j = b("el-table-column"), ee = b("el-table"), q = b("el-dialog"), ce = b("Monitor");
2318
- return g(), a("div", Mt, [
2319
- c(Je, {
2320
- title: D.title,
2321
- "onUpdate:title": l[0] ||= (e) => D.title = e,
2322
- "can-undo": I.value > 0,
2323
- "can-redo": I.value < F.value.length - 1,
2324
- "connecting-mode": V.value,
2325
- "is-connected": M.value,
2326
- "online-users": S(P) ? S(P).onlineUsers.value : [],
2327
- "is-join-mode": S(u).query.collab === "1",
2328
- onBack: Ie,
2329
- onAddComponent: _e,
2330
- onToggleConnecting: l[1] ||= (e) => V.value = !V.value,
2331
- onGroupSelected: Oe,
2332
- onAutoLayout: Fe,
2333
- onUndo: le,
2334
- onRedo: ue,
2335
- onZoomIn: de,
2336
- onZoomOut: fe,
2337
- onExport: Ge,
2338
- onSave: Ue,
2339
- onToggleCollab: Ze,
2340
- onShareCollab: Qe,
2341
- onExportJson: rt,
2342
- onImportJson: l[2] ||= (e) => re.value?.click(),
2343
- "show-history": !!f.value,
2344
- onHistory: Be
2492
+ let u = b("el-breadcrumb-item"), f = b("el-breadcrumb"), m = b("el-icon"), h = b("el-button"), _ = b("el-tooltip"), v = b("el-input"), C = b("el-input-number"), O = b("el-color-picker"), k = b("el-switch"), A = b("el-table-column"), j = b("el-table"), M = b("el-dialog"), te = b("Monitor");
2493
+ return g(), a("div", It, [
2494
+ c(Qe, {
2495
+ title: P.title,
2496
+ "onUpdate:title": l[0] ||= (e) => P.title = e,
2497
+ "can-undo": R.value > 0,
2498
+ "can-redo": R.value < L.value.length - 1,
2499
+ "connecting-mode": U.value,
2500
+ "is-connected": F.value,
2501
+ "online-users": S(I) ? S(I).onlineUsers.value : [],
2502
+ "is-join-mode": S(p).query.collab === "1",
2503
+ "show-back-button": d.value.backButton === "show",
2504
+ "title-disabled": !d.value.titleEditable,
2505
+ onBack: Ve,
2506
+ onAddComponent: xe,
2507
+ onToggleConnecting: l[1] ||= (e) => U.value = !U.value,
2508
+ onGroupSelected: Pe,
2509
+ onAutoLayout: Be,
2510
+ onUndo: fe,
2511
+ onRedo: pe,
2512
+ onZoomIn: me,
2513
+ onZoomOut: he,
2514
+ onExport: Ye,
2515
+ onSave: qe,
2516
+ onToggleCollab: tt,
2517
+ onShareCollab: nt,
2518
+ onExportJson: st,
2519
+ onImportJson: l[2] ||= (e) => ae.value?.click(),
2520
+ "show-history": !!T.value,
2521
+ onHistory: We
2345
2522
  }, null, 8, [
2346
2523
  "title",
2347
2524
  "can-undo",
@@ -2350,91 +2527,93 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2350
2527
  "is-connected",
2351
2528
  "online-users",
2352
2529
  "is-join-mode",
2530
+ "show-back-button",
2531
+ "title-disabled",
2353
2532
  "show-history"
2354
2533
  ]),
2355
2534
  o("input", {
2356
2535
  ref_key: "fileInputRef",
2357
- ref: he,
2536
+ ref: ve,
2358
2537
  type: "file",
2359
2538
  accept: "image/*,.svg",
2360
2539
  style: { display: "none" },
2361
- onChange: ve
2540
+ onChange: Se
2362
2541
  }, null, 544),
2363
2542
  o("input", {
2364
2543
  ref_key: "svgInputRef",
2365
- ref: ge,
2544
+ ref: ye,
2366
2545
  type: "file",
2367
2546
  accept: ".svg",
2368
2547
  style: { display: "none" },
2369
- onChange: ve
2548
+ onChange: Se
2370
2549
  }, null, 544),
2371
2550
  o("input", {
2372
2551
  ref_key: "groupImageInputRef",
2373
- ref: ne,
2552
+ ref: ie,
2374
2553
  type: "file",
2375
2554
  accept: "image/*",
2376
2555
  style: { display: "none" },
2377
- onChange: Pe
2556
+ onChange: ze
2378
2557
  }, null, 544),
2379
2558
  o("input", {
2380
2559
  ref_key: "importJsonInputRef",
2381
- ref: re,
2560
+ ref: ae,
2382
2561
  type: "file",
2383
2562
  accept: ".json",
2384
2563
  style: { display: "none" },
2385
- onChange: it
2564
+ onChange: ct
2386
2565
  }, null, 544),
2387
- W.value.length ? (g(), a("div", Nt, [c(m, { separator: "/" }, {
2388
- default: w(() => [c(d, {
2389
- onClick: l[3] ||= (e) => Ne(-1),
2566
+ K.value.length ? (g(), a("div", Lt, [c(f, { separator: "/" }, {
2567
+ default: w(() => [c(u, {
2568
+ onClick: l[3] ||= (e) => Re(-1),
2390
2569
  style: { cursor: "pointer" }
2391
2570
  }, {
2392
2571
  default: w(() => [...l[27] ||= [s("根目录", -1)]]),
2393
2572
  _: 1
2394
- }), (g(!0), a(e, null, y(W.value, (e, t) => (g(), r(d, {
2573
+ }), (g(!0), a(e, null, y(K.value, (e, t) => (g(), r(u, {
2395
2574
  key: e,
2396
- onClick: (e) => Ne(t),
2575
+ onClick: (e) => Re(t),
2397
2576
  style: { cursor: "pointer" }
2398
2577
  }, {
2399
- default: w(() => [s(x(se(e)?.label || "组合"), 1)]),
2578
+ default: w(() => [s(x(ue(e)?.label || "组合"), 1)]),
2400
2579
  _: 2
2401
2580
  }, 1032, ["onClick"]))), 128))]),
2402
2581
  _: 1
2403
- }), c(v, {
2582
+ }), c(_, {
2404
2583
  content: "返回上一层",
2405
2584
  placement: "bottom"
2406
2585
  }, {
2407
- default: w(() => [c(_, {
2586
+ default: w(() => [c(h, {
2408
2587
  size: "small",
2409
2588
  circle: "",
2410
- onClick: Me
2589
+ onClick: Le
2411
2590
  }, {
2412
- default: w(() => [c(h, null, {
2413
- default: w(() => [c(S(te))]),
2591
+ default: w(() => [c(m, null, {
2592
+ default: w(() => [c(S(ee))]),
2414
2593
  _: 1
2415
2594
  })]),
2416
2595
  _: 1
2417
2596
  })]),
2418
2597
  _: 1
2419
2598
  })])) : i("", !0),
2420
- o("div", Pt, [c(kt, {
2421
- components: ae.value,
2422
- connections: Y.value,
2423
- "selected-id": L.value,
2424
- "selected-ids": R.value,
2425
- "connecting-mode": V.value,
2426
- "drawing-conn": H.value,
2427
- "editing-polygon": U.value,
2428
- "view-box": oe.value,
2429
- "is-expanded": !!J.value,
2430
- "expanded-group-id": J.value,
2431
- onSelect: ye,
2432
- onEdit: Ce,
2599
+ o("div", Rt, [c(Nt, {
2600
+ components: se.value,
2601
+ connections: ce.value,
2602
+ "selected-id": z.value,
2603
+ "selected-ids": B.value,
2604
+ "connecting-mode": U.value,
2605
+ "drawing-conn": W.value,
2606
+ "editing-polygon": G.value,
2607
+ "view-box": le.value,
2608
+ "is-expanded": !!X.value,
2609
+ "expanded-group-id": X.value,
2610
+ onSelect: Ce,
2611
+ onEdit: ke,
2433
2612
  onClearSelection: $,
2434
- onStartConnect: De,
2435
- onStartResize: be,
2436
- onMoveComponent: Se,
2437
- onDragPolygonVertex: X
2613
+ onStartConnect: Me,
2614
+ onStartResize: we,
2615
+ onMoveComponent: Oe,
2616
+ onDragPolygonVertex: Z
2438
2617
  }, null, 8, [
2439
2618
  "components",
2440
2619
  "connections",
@@ -2447,134 +2626,134 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2447
2626
  "is-expanded",
2448
2627
  "expanded-group-id"
2449
2628
  ]), c(t, { name: "slide" }, {
2450
- default: w(() => [B.value ? (g(), a("div", Ft, [o("h4", null, x(z.value === "component" ? "组件属性" : "连线属性"), 1), z.value === "component" ? (g(), a(e, { key: 0 }, [
2451
- o("div", It, [l[28] ||= o("label", null, "标签", -1), c(T, {
2452
- modelValue: B.value.label,
2453
- "onUpdate:modelValue": l[4] ||= (e) => B.value.label = e,
2629
+ default: w(() => [H.value ? (g(), a("div", zt, [o("h4", null, x(V.value === "component" ? "组件属性" : "连线属性"), 1), V.value === "component" ? (g(), a(e, { key: 0 }, [
2630
+ o("div", Bt, [l[28] ||= o("label", null, "标签", -1), c(v, {
2631
+ modelValue: H.value.label,
2632
+ "onUpdate:modelValue": l[4] ||= (e) => H.value.label = e,
2454
2633
  size: "small"
2455
2634
  }, null, 8, ["modelValue"])]),
2456
- o("div", Lt, [l[29] ||= o("label", null, "描述", -1), c(T, {
2457
- modelValue: B.value.description,
2458
- "onUpdate:modelValue": l[5] ||= (e) => B.value.description = e,
2635
+ o("div", Vt, [l[29] ||= o("label", null, "描述", -1), c(v, {
2636
+ modelValue: H.value.description,
2637
+ "onUpdate:modelValue": l[5] ||= (e) => H.value.description = e,
2459
2638
  size: "small"
2460
2639
  }, null, 8, ["modelValue"])]),
2461
- B.value.shape === "group" ? (g(), a(e, { key: 0 }, [
2462
- o("div", Rt, [l[30] ||= o("label", null, "宽度", -1), c(O, {
2463
- modelValue: B.value.width,
2464
- "onUpdate:modelValue": l[6] ||= (e) => B.value.width = e,
2640
+ H.value.shape === "group" ? (g(), a(e, { key: 0 }, [
2641
+ o("div", Ht, [l[30] ||= o("label", null, "宽度", -1), c(C, {
2642
+ modelValue: H.value.width,
2643
+ "onUpdate:modelValue": l[6] ||= (e) => H.value.width = e,
2465
2644
  min: 40,
2466
2645
  max: 2e3,
2467
2646
  size: "small"
2468
2647
  }, null, 8, ["modelValue"])]),
2469
- o("div", zt, [l[31] ||= o("label", null, "高度", -1), c(O, {
2470
- modelValue: B.value.height,
2471
- "onUpdate:modelValue": l[7] ||= (e) => B.value.height = e,
2648
+ o("div", Ut, [l[31] ||= o("label", null, "高度", -1), c(C, {
2649
+ modelValue: H.value.height,
2650
+ "onUpdate:modelValue": l[7] ||= (e) => H.value.height = e,
2472
2651
  min: 30,
2473
2652
  max: 1500,
2474
2653
  size: "small"
2475
2654
  }, null, 8, ["modelValue"])]),
2476
- o("div", Bt, [l[34] ||= o("label", null, "显示图片", -1), B.value.imageUrl ? (g(), a("div", Vt, [o("img", {
2477
- src: B.value.imageUrl,
2655
+ o("div", Wt, [l[34] ||= o("label", null, "显示图片", -1), H.value.imageUrl ? (g(), a("div", Gt, [o("img", {
2656
+ src: H.value.imageUrl,
2478
2657
  style: {
2479
2658
  "max-width": "100%",
2480
2659
  "max-height": "80px",
2481
2660
  border: "1px solid #e4e7ed",
2482
2661
  "border-radius": "4px"
2483
2662
  }
2484
- }, null, 8, Ht), c(_, {
2663
+ }, null, 8, Kt), c(h, {
2485
2664
  size: "small",
2486
2665
  type: "danger",
2487
2666
  text: "",
2488
- onClick: l[8] ||= (e) => B.value.imageUrl = ""
2667
+ onClick: l[8] ||= (e) => H.value.imageUrl = ""
2489
2668
  }, {
2490
2669
  default: w(() => [...l[32] ||= [s("移除", -1)]]),
2491
2670
  _: 1
2492
- })])) : (g(), r(_, {
2671
+ })])) : (g(), r(h, {
2493
2672
  key: 1,
2494
2673
  size: "small",
2495
- onClick: l[9] ||= (e) => ne.value?.click()
2674
+ onClick: l[9] ||= (e) => ie.value?.click()
2496
2675
  }, {
2497
2676
  default: w(() => [...l[33] ||= [s("上传图片", -1)]]),
2498
2677
  _: 1
2499
2678
  }))]),
2500
- c(_, {
2679
+ c(h, {
2501
2680
  size: "small",
2502
- onClick: l[10] ||= (e) => Ae(B.value)
2681
+ onClick: l[10] ||= (e) => Fe(H.value)
2503
2682
  }, {
2504
2683
  default: w(() => [...l[35] ||= [s("适配子零件", -1)]]),
2505
2684
  _: 1
2506
2685
  })
2507
- ], 64)) : (g(), a(e, { key: 1 }, [o("div", Ut, [l[36] ||= o("label", null, "宽度", -1), c(O, {
2508
- modelValue: B.value.width,
2509
- "onUpdate:modelValue": l[11] ||= (e) => B.value.width = e,
2686
+ ], 64)) : (g(), a(e, { key: 1 }, [o("div", qt, [l[36] ||= o("label", null, "宽度", -1), c(C, {
2687
+ modelValue: H.value.width,
2688
+ "onUpdate:modelValue": l[11] ||= (e) => H.value.width = e,
2510
2689
  min: 40,
2511
2690
  max: 400,
2512
2691
  size: "small"
2513
- }, null, 8, ["modelValue"])]), o("div", Wt, [l[37] ||= o("label", null, "高度", -1), c(O, {
2514
- modelValue: B.value.height,
2515
- "onUpdate:modelValue": l[12] ||= (e) => B.value.height = e,
2692
+ }, null, 8, ["modelValue"])]), o("div", Jt, [l[37] ||= o("label", null, "高度", -1), c(C, {
2693
+ modelValue: H.value.height,
2694
+ "onUpdate:modelValue": l[12] ||= (e) => H.value.height = e,
2516
2695
  min: 30,
2517
2696
  max: 300,
2518
2697
  size: "small"
2519
2698
  }, null, 8, ["modelValue"])])], 64)),
2520
- o("div", Gt, [l[38] ||= o("label", null, "填充色", -1), c(k, {
2521
- modelValue: B.value.fill,
2522
- "onUpdate:modelValue": l[13] ||= (e) => B.value.fill = e,
2699
+ o("div", Yt, [l[38] ||= o("label", null, "填充色", -1), c(O, {
2700
+ modelValue: H.value.fill,
2701
+ "onUpdate:modelValue": l[13] ||= (e) => H.value.fill = e,
2523
2702
  size: "small"
2524
2703
  }, null, 8, ["modelValue"])]),
2525
- o("div", Kt, [l[39] ||= o("label", null, "边框色", -1), c(k, {
2526
- modelValue: B.value.stroke,
2527
- "onUpdate:modelValue": l[14] ||= (e) => B.value.stroke = e,
2704
+ o("div", Xt, [l[39] ||= o("label", null, "边框色", -1), c(O, {
2705
+ modelValue: H.value.stroke,
2706
+ "onUpdate:modelValue": l[14] ||= (e) => H.value.stroke = e,
2528
2707
  size: "small"
2529
2708
  }, null, 8, ["modelValue"])]),
2530
- o("div", qt, [l[40] ||= o("label", null, "文字色", -1), c(k, {
2531
- modelValue: B.value.textColor,
2532
- "onUpdate:modelValue": l[15] ||= (e) => B.value.textColor = e,
2709
+ o("div", Zt, [l[40] ||= o("label", null, "文字色", -1), c(O, {
2710
+ modelValue: H.value.textColor,
2711
+ "onUpdate:modelValue": l[15] ||= (e) => H.value.textColor = e,
2533
2712
  size: "small"
2534
2713
  }, null, 8, ["modelValue"])]),
2535
- o("div", Jt, [l[41] ||= o("label", null, "字号", -1), c(O, {
2536
- modelValue: B.value.fontSize,
2537
- "onUpdate:modelValue": l[16] ||= (e) => B.value.fontSize = e,
2714
+ o("div", Qt, [l[41] ||= o("label", null, "字号", -1), c(C, {
2715
+ modelValue: H.value.fontSize,
2716
+ "onUpdate:modelValue": l[16] ||= (e) => H.value.fontSize = e,
2538
2717
  min: 10,
2539
2718
  max: 32,
2540
2719
  size: "small"
2541
2720
  }, null, 8, ["modelValue"])]),
2542
- c(_, {
2721
+ c(h, {
2543
2722
  size: "small",
2544
- onClick: $e
2723
+ onClick: rt
2545
2724
  }, {
2546
2725
  default: w(() => [...l[42] ||= [s("属性弹框设置", -1)]]),
2547
2726
  _: 1
2548
2727
  }),
2549
- c(_, {
2728
+ c(h, {
2550
2729
  size: "small",
2551
2730
  type: "danger",
2552
- onClick: we
2731
+ onClick: je
2553
2732
  }, {
2554
2733
  default: w(() => [...l[43] ||= [s("删除", -1)]]),
2555
2734
  _: 1
2556
2735
  })
2557
- ], 64)) : z.value === "connection" ? (g(), a(e, { key: 1 }, [
2558
- o("div", Yt, [l[44] ||= o("label", null, "标签", -1), c(T, {
2559
- modelValue: B.value.label,
2560
- "onUpdate:modelValue": l[17] ||= (e) => B.value.label = e,
2736
+ ], 64)) : V.value === "connection" ? (g(), a(e, { key: 1 }, [
2737
+ o("div", $t, [l[44] ||= o("label", null, "标签", -1), c(v, {
2738
+ modelValue: H.value.label,
2739
+ "onUpdate:modelValue": l[17] ||= (e) => H.value.label = e,
2561
2740
  size: "small"
2562
2741
  }, null, 8, ["modelValue"])]),
2563
- o("div", Xt, [l[45] ||= o("label", null, "线宽", -1), c(O, {
2564
- modelValue: B.value.lineWidth,
2565
- "onUpdate:modelValue": l[18] ||= (e) => B.value.lineWidth = e,
2742
+ o("div", en, [l[45] ||= o("label", null, "线宽", -1), c(C, {
2743
+ modelValue: H.value.lineWidth,
2744
+ "onUpdate:modelValue": l[18] ||= (e) => H.value.lineWidth = e,
2566
2745
  min: 1,
2567
2746
  max: 6,
2568
2747
  size: "small"
2569
2748
  }, null, 8, ["modelValue"])]),
2570
- o("div", Zt, [l[46] ||= o("label", null, "虚线", -1), c(A, {
2571
- modelValue: B.value.dashed,
2572
- "onUpdate:modelValue": l[19] ||= (e) => B.value.dashed = e
2749
+ o("div", tn, [l[46] ||= o("label", null, "虚线", -1), c(k, {
2750
+ modelValue: H.value.dashed,
2751
+ "onUpdate:modelValue": l[19] ||= (e) => H.value.dashed = e
2573
2752
  }, null, 8, ["modelValue"])]),
2574
- c(_, {
2753
+ c(h, {
2575
2754
  size: "small",
2576
2755
  type: "danger",
2577
- onClick: we
2756
+ onClick: je
2578
2757
  }, {
2579
2758
  default: w(() => [...l[47] ||= [s("删除", -1)]]),
2580
2759
  _: 1
@@ -2582,58 +2761,58 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2582
2761
  ], 64)) : i("", !0)])) : i("", !0)]),
2583
2762
  _: 1
2584
2763
  })]),
2585
- c(q, {
2586
- modelValue: G.value,
2587
- "onUpdate:modelValue": l[22] ||= (e) => G.value = e,
2764
+ c(M, {
2765
+ modelValue: oe.value,
2766
+ "onUpdate:modelValue": l[22] ||= (e) => oe.value = e,
2588
2767
  title: "属性弹框设置",
2589
2768
  width: "500",
2590
2769
  "append-to-body": ""
2591
2770
  }, {
2592
- footer: w(() => [c(_, { onClick: l[21] ||= (e) => G.value = !1 }, {
2771
+ footer: w(() => [c(h, { onClick: l[21] ||= (e) => oe.value = !1 }, {
2593
2772
  default: w(() => [...l[51] ||= [s("取消", -1)]]),
2594
2773
  _: 1
2595
- }), c(_, {
2774
+ }), c(h, {
2596
2775
  type: "primary",
2597
- onClick: tt
2776
+ onClick: at
2598
2777
  }, {
2599
2778
  default: w(() => [...l[52] ||= [s("保存", -1)]]),
2600
2779
  _: 1
2601
2780
  })]),
2602
- default: w(() => [o("div", Qt, [
2603
- c(_, {
2781
+ default: w(() => [o("div", nn, [
2782
+ c(h, {
2604
2783
  size: "small",
2605
- onClick: et
2784
+ onClick: it
2606
2785
  }, {
2607
2786
  default: w(() => [...l[48] ||= [s("+ 添加一行", -1)]]),
2608
2787
  _: 1
2609
2788
  }),
2610
- c(_, {
2789
+ c(h, {
2611
2790
  size: "small",
2612
- onClick: l[20] ||= (e) => ie.value?.click()
2791
+ onClick: l[20] ||= (e) => J.value?.click()
2613
2792
  }, {
2614
2793
  default: w(() => [...l[49] ||= [s("导入JSON", -1)]]),
2615
2794
  _: 1
2616
2795
  }),
2617
2796
  o("input", {
2618
2797
  ref_key: "popupConfigImportRef",
2619
- ref: ie,
2798
+ ref: J,
2620
2799
  type: "file",
2621
2800
  accept: ".json",
2622
2801
  style: { display: "none" },
2623
- onChange: nt
2802
+ onChange: ot
2624
2803
  }, null, 544)
2625
- ]), c(ee, {
2626
- data: K.value,
2804
+ ]), c(j, {
2805
+ data: Y.value,
2627
2806
  border: "",
2628
2807
  size: "small",
2629
2808
  "max-height": "300"
2630
2809
  }, {
2631
2810
  default: w(() => [
2632
- c(j, {
2811
+ c(A, {
2633
2812
  label: "属性名",
2634
2813
  "min-width": "120"
2635
2814
  }, {
2636
- default: w(({ row: e }) => [c(T, {
2815
+ default: w(({ row: e }) => [c(v, {
2637
2816
  modelValue: e.key,
2638
2817
  "onUpdate:modelValue": (t) => e.key = t,
2639
2818
  size: "small",
@@ -2641,11 +2820,11 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2641
2820
  }, null, 8, ["modelValue", "onUpdate:modelValue"])]),
2642
2821
  _: 1
2643
2822
  }),
2644
- c(j, {
2823
+ c(A, {
2645
2824
  label: "悬浮内容",
2646
2825
  "min-width": "200"
2647
2826
  }, {
2648
- default: w(({ row: e }) => [c(T, {
2827
+ default: w(({ row: e }) => [c(v, {
2649
2828
  modelValue: e.value,
2650
2829
  "onUpdate:modelValue": (t) => e.value = t,
2651
2830
  size: "small",
@@ -2653,15 +2832,15 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2653
2832
  }, null, 8, ["modelValue", "onUpdate:modelValue"])]),
2654
2833
  _: 1
2655
2834
  }),
2656
- c(j, {
2835
+ c(A, {
2657
2836
  width: "60",
2658
2837
  label: "操作"
2659
2838
  }, {
2660
- default: w(({ $index: e }) => [c(_, {
2839
+ default: w(({ $index: e }) => [c(h, {
2661
2840
  size: "small",
2662
2841
  type: "danger",
2663
2842
  text: "",
2664
- onClick: (t) => K.value.splice(e, 1)
2843
+ onClick: (t) => Y.value.splice(e, 1)
2665
2844
  }, {
2666
2845
  default: w(() => [...l[50] ||= [s("删除", -1)]]),
2667
2846
  _: 1
@@ -2673,33 +2852,33 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2673
2852
  }, 8, ["data"])]),
2674
2853
  _: 1
2675
2854
  }, 8, ["modelValue"]),
2676
- c(_, {
2855
+ c(h, {
2677
2856
  class: "ai-chat-fab",
2678
- type: p.value ? "primary" : "default",
2857
+ type: E.value ? "primary" : "default",
2679
2858
  circle: "",
2680
2859
  size: "large",
2681
- onClick: l[23] ||= (e) => p.value = !p.value,
2860
+ onClick: l[23] ||= (e) => E.value = !E.value,
2682
2861
  title: "AI助手"
2683
2862
  }, {
2684
- default: w(() => [c(h, null, {
2685
- default: w(() => [c(ce)]),
2863
+ default: w(() => [c(m, null, {
2864
+ default: w(() => [c(te)]),
2686
2865
  _: 1
2687
2866
  })]),
2688
2867
  _: 1
2689
2868
  }, 8, ["type"]),
2690
2869
  c(Te, {
2691
- visible: p.value,
2692
- messages: S(E).messages.value,
2693
- loading: S(E).loading.value,
2694
- "is-collab": S(E).isCollabMode.value,
2695
- "collab-users": S(E).collabUsers.value,
2696
- "current-user": S(E).currentUser.value,
2697
- "is-owner": N.value,
2698
- onSend: Re,
2699
- onClose: l[24] ||= (e) => p.value = !1,
2700
- "unread-mention": S(E).unreadMention.value,
2701
- onClearUnread: l[25] ||= (e) => S(E).clearUnreadMention(),
2702
- onClear: ze
2870
+ visible: E.value,
2871
+ messages: S(N).messages.value,
2872
+ loading: S(N).loading.value,
2873
+ "is-collab": S(N).isCollabMode.value,
2874
+ "collab-users": S(N).collabUsers.value,
2875
+ "current-user": S(N).currentUser.value,
2876
+ "is-owner": re.value,
2877
+ onSend: He,
2878
+ onClose: l[24] ||= (e) => E.value = !1,
2879
+ "unread-mention": S(N).unreadMention.value,
2880
+ onClearUnread: l[25] ||= (e) => S(N).clearUnreadMention(),
2881
+ onClear: Ue
2703
2882
  }, null, 8, [
2704
2883
  "visible",
2705
2884
  "messages",
@@ -2710,16 +2889,16 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2710
2889
  "is-owner",
2711
2890
  "unread-mention"
2712
2891
  ]),
2713
- c(Ve, {
2714
- modelValue: C.value,
2715
- "onUpdate:modelValue": l[26] ||= (e) => C.value = e,
2716
- "document-id": f.value,
2717
- onApply: He
2892
+ c(Ge, {
2893
+ modelValue: D.value,
2894
+ "onUpdate:modelValue": l[26] ||= (e) => D.value = e,
2895
+ "document-id": T.value,
2896
+ onApply: Ke
2718
2897
  }, null, 8, ["modelValue", "document-id"])
2719
2898
  ]);
2720
2899
  };
2721
2900
  }
2722
- }, [["__scopeId", "data-v-f2d3d8e9"]]), tn = l({
2901
+ }, [["__scopeId", "data-v-f876f109"]]), on = l({
2723
2902
  name: "YourCompanyExplosionDiagram",
2724
2903
  props: {
2725
2904
  docId: {
@@ -2730,6 +2909,14 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2730
2909
  type: String,
2731
2910
  default: "/api"
2732
2911
  },
2912
+ saveApi: {
2913
+ type: [String, Function],
2914
+ default: null
2915
+ },
2916
+ loadApi: {
2917
+ type: [String, Function],
2918
+ default: null
2919
+ },
2733
2920
  wsUrl: {
2734
2921
  type: String,
2735
2922
  default: ""
@@ -2745,14 +2932,22 @@ var jt = (e, { onRemoteChange: t } = {}) => {
2745
2932
  roomId: {
2746
2933
  type: String,
2747
2934
  default: ""
2935
+ },
2936
+ uiConfig: {
2937
+ type: Object,
2938
+ default: () => ({})
2939
+ },
2940
+ aiApi: {
2941
+ type: [String, Object],
2942
+ default: null
2748
2943
  }
2749
2944
  },
2750
2945
  setup(e, { slots: t }) {
2751
2946
  return () => u("div", {
2752
2947
  class: "yourcompany-explosion-diagram-wrapper",
2753
2948
  style: "position:relative"
2754
- }, [u(en, { ...e }), u(D)]);
2949
+ }, [u(an, { ...e }), u(D)]);
2755
2950
  }
2756
2951
  });
2757
2952
  //#endregion
2758
- export { tn as default };
2953
+ export { on as default };